Subversion Repositories svn.mios

Rev

Blame | Last modification | View Log | RSS feed

gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00001 ; $Id: setup_tia_base.asm bdupeyron.tech@gmail.com(Antichambre)
               00002         LIST R=DEC
               00003 ;
               00004 ; Prepared Setup File for TIA Cartridge version
               00005 ;
               00006 
               00007         ;; here you can change the default device ID - if you are using
               00008         ;; some cores as slave, set:
               00009         ;;    o DEFAULT_DEVICE_ID 0x01  ; for the first slave
               00010         ;;    o DEFAULT_DEVICE_ID 0x02  ; for the second slave
               00011         ;;    o DEFAULT_DEVICE_ID 0x03  ; for the third slave
0000 00012 #define DEFAULT_DEVICE_ID 0x00
               00013 
               00014         ;; if this option is enabled (1), the DEFAULT_DEVICE_ID won't be used, but
               00015         ;; it will be automatically derived from the MIOS Device ID instead
0000 00016 #define AUTO_DEVICE_ID  0
               00017 
               00018         ;; default MIDI channel:
0000 00019 #define DEFAULT_MIDI_CHANNEL  1
               00020 
               00021     ;; if != 0, special variations for cartridge version hardware:
0000 00022 #define DEFAULT_IS_CARTRIDGE  1
               00023 
               00024     ;; Kit and Wavetable fisrt:
               00025     ;;      positionbanks start at this bankstick address(id):
               00026     ;;      Becarrefull! Change this value may reformat your BankStick
               00027     ;;      look at DEFAULT_BS_FPROTECT Value *!
0000 00028 #define DEFAULT_BS_KBANK_ID   5
               00029     ;; Default BankStick format protection:
               00030     ;;      0: No protection.
               00031     ;;     *1: Protects banks which are not good type or position.
               00032     ;;      Depend on DEFAULT_BS_KBANK_ID.
               00033     ;;      2: Never format at startup (Sysex command available).
0000 00034 #define DEFAULT_BS_FPROTECT   1
               00035     ;; BankStick read only:
0000 00036 #define DEFAULT_BS_READONLY   0
               00037 
               00038     ;; Default EEPROM Protection:
               00039     ;;      Eeprom read only:
0000 00040 #define DEFAULT_EE_READONLY   1
               00041     ;;      internal patch Protection
               00042 
               00043     ;; Default Debugger Options:
               00044     ;;      Degug Enabled/disabled
0000 00045 #define DEFAULT_TIA_DEBUG_ON  1
               00046     ;;      BankStick Degug Enabled/disabled
0000 00047 #define DEFAULT_TIA_DEBUG_BS  1
               00048     ;;      BankStick Degug Mode
               00049     ;;      0: Basic.
               00050     ;;      1: Advanced.
0000 00051 #define DEFAULT_TIA_DEBUG_BS_MODE  0
               00052     ;;      Eeprom Degug Enabled/disabled
               00053     ;;      no effect if DEFAULT_TIA_DEBUG_ON == 0
0000 00054 #define DEFAULT_TIA_DEBUG_EE  1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  2


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00055 
               00056         ;; use PORTA and PORTE (J5 of the core module) as output
               00057         ;; you can address these pins in cs_menu_io_tables.inc as "shift register" #0
0000 00058 #define ENABLE_J5 0
               00059 
0000 00060 #define TIA_LEDMTR_ENABLE       1
               00061     ;; define the shift registers (note: HERE the shift register begin with 0: 1st SR is 0, 2nd is 1, 3rd is 2, ...)
0000 00062 #define TIA_LEDMTR_REG  0       ; shift register for led metering (HERE: first shift register in the chain)
               00063 
               00064     ;; For MIDI activity monitor:
0000 00065 #define DEFAULT_MIDI_MONITOR_ENABLED 1  ; if 1, the Tx/Rx LEDs are enabled
               00066     ;;define the DOUT pins for the Rx and Tx LED:
               00067     ;; if 0: MIDI Rx/Tx LEDs are assigned to the DOUT chain, pin 0x00-0x7f
               00068     ;; if 1: MIDI Rx/Tx LEDs are assigned to specials pins
0000 00069 #define MIDI_RXTX_USE_IO       1                                          
               00070 #if MIDI_RXTX_USE_IO 
0000 00071 #define DEFAULT_MIDI_RX_LAT LATD
0000 00072 #define DEFAULT_MIDI_RX_TRIS TRISD
0000 00073 #define DEFAULT_MIDI_RX_PIN 6   ; Pin D.6
0000 00074 #define DEFAULT_MIDI_TX_LAT LATD
0000 00075 #define DEFAULT_MIDI_TX_TRIS TRISD
0000 00076 #define DEFAULT_MIDI_TX_PIN 7   ; Pin D.7
               00077 #else
               00078 #define DEFAULT_MIDI_RX_LED 0x41        ; DOUT SR#9, pin D1
               00079 #define DEFAULT_MIDI_TX_LED 0x42        ; DOUT SR#9, pin D2
               00080 #endif
               00081 
               00082         ;; define the AOUT interface which is used here:
               00083         ;;   1: one MBHP_AOUT module
               00084         ;;   2: up to 4 (chained) MBHP_AOUT_LC modules
               00085         ;;   3: one MBHP_AOUT_NG module
               00086         ;; all other values invalid!
0000 00087 #define AOUT_INTERFACE_TYPE 0
               00088 
               00089         ;; only relevant if one or more AOUT_LC modules are used:
               00090         ;; define the resolution configuration here
               00091         ;;   0: first channel 12bit, second channel 4bit
               00092         ;;   1: first channel 8bit, second channel 8bit
               00093         ;;   2: combines M1,M2 and/or M3/M4: first channel 12bit, second channel 12bit, third channel 8bit, fourth channel ignored!
               00094         ;; all other values invalid!
0000 00095 #define AOUT_LC_RESOLUTION_OPTION_M1 0
0000 00096 #define AOUT_LC_RESOLUTION_OPTION_M2 0
0000 00097 #define AOUT_LC_RESOLUTION_OPTION_M3 0
0000 00098 #define AOUT_LC_RESOLUTION_OPTION_M4 0
               00099 
               00100         ;; enable the 6th LFO waveform (analog inputs)
0000 00101 #define ENABLE_AIN_LFO_WAVEFORM 0
               00102 
               00103 #include "src/main.inc"
               00001 ; $Id: main.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIOS Application
               00004 ; MIDIbox TIA
               00005 ;
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00006 ; -> see README.txt for details
               00007 ;
               00008 ; ==========================================================================
               00009 ;
               00010 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00011 ;  Licensed for personal non-commercial use only.
               00012 ;  All other rights reserved.
               00013 ; 
               00014 ; ==========================================================================
               00015 ;
               00016 ; Version:                <-------------------->
0000 00017 #define MBTIA_VERSION_STR "MIDIboxTIA V1.beta  "
               00018 ; (fixed string length - 20 characters!)
               00019 ;
               00020 
               00021 ;; ---[ MIOS header file ]---
               00022 #include <mios.h>
               00001 ; $Id: mios.h 822 2009-09-17 18:39:53Z tk $
               00002 ;
               00003 ; MIOS Definitions file
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2008 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 
               00014 ;; ==========================================================================
               00015 ;;  Include basic defines which characterize the derivative to
               00016 ;;  simplify dependencies within MIOS source code
               00017 ;; ==========================================================================
               00018 #include <hw_flags.h>
               00001 
               00002 #ifndef _HW_FLAGS_H
0000 00003 #define _HW_FLAGS_H
               00004 
               00005 #ifdef __18F452
               00006 #define PIC_DERIVATIVE_CODE_SIZE        0x08000
               00007 #define PIC_DERIVATIVE_RAM_SIZE         0x600
               00008 #define PIC_DERIVATIVE_EEPROM_SIZE      0x100
               00009 #define PIC_DERIVATIVE_IRQ_WORKAROUND   0
               00010 #define PIC_DERIVATIVE_NEW_ADC          0
               00011 #define PIC_DERIVATIVE_CMCON_INIT       0
               00012 #define PIC_DERIVATIVE_T08BIT_INVERTED  0
               00013 #define PIC_DERIVATIVE_SET_LCD_4BIT     0
               00014 #endif
               00015 
               00016 #ifdef __18F4620
               00017 #define PIC_DERIVATIVE_CODE_SIZE        0x10000
               00018 #define PIC_DERIVATIVE_RAM_SIZE         0xf80
               00019 #define PIC_DERIVATIVE_EEPROM_SIZE      0x400
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00020 #define PIC_DERIVATIVE_IRQ_WORKAROUND   1
               00021 #define PIC_DERIVATIVE_NEW_ADC          1
               00022 #define PIC_DERIVATIVE_CMCON_INIT       1
               00023 #define PIC_DERIVATIVE_T08BIT_INVERTED  1
               00024 #define PIC_DERIVATIVE_SET_LCD_4BIT     0
               00025 #endif
               00026         
               00027 #ifdef __18F4520
               00028 #define PIC_DERIVATIVE_CODE_SIZE        0x08000
               00029 #define PIC_DERIVATIVE_RAM_SIZE         0x600
               00030 #define PIC_DERIVATIVE_EEPROM_SIZE      0x100
               00031 #define PIC_DERIVATIVE_IRQ_WORKAROUND   1
               00032 #define PIC_DERIVATIVE_NEW_ADC          1
               00033 #define PIC_DERIVATIVE_CMCON_INIT       1
               00034 #define PIC_DERIVATIVE_T08BIT_INVERTED  0
               00035 #define PIC_DERIVATIVE_SET_LCD_4BIT     0
               00036 #endif
               00037 
               00038 #ifdef __18F4682
               00039 #define PIC_DERIVATIVE_CODE_SIZE        0x14000
               00040 #define PIC_DERIVATIVE_RAM_SIZE         0xd00
               00041 #define PIC_DERIVATIVE_EEPROM_SIZE      0x400
               00042 #define PIC_DERIVATIVE_IRQ_WORKAROUND   0
               00043 #define PIC_DERIVATIVE_NEW_ADC          1
               00044 #define PIC_DERIVATIVE_CMCON_INIT       1
               00045 #define PIC_DERIVATIVE_T08BIT_INVERTED  0
               00046 #define PIC_DERIVATIVE_SET_LCD_4BIT     1
               00047 #endif
               00048 
               00049 #ifdef __18F4685
0000 00050 #define PIC_DERIVATIVE_CODE_SIZE        0x18000
0000 00051 #define PIC_DERIVATIVE_RAM_SIZE         0xd00
0000 00052 #define PIC_DERIVATIVE_EEPROM_SIZE      0x400
0000 00053 #define PIC_DERIVATIVE_IRQ_WORKAROUND   0
0000 00054 #define PIC_DERIVATIVE_NEW_ADC          1
0000 00055 #define PIC_DERIVATIVE_CMCON_INIT       1
0000 00056 #define PIC_DERIVATIVE_T08BIT_INVERTED  0
0000 00057 #define PIC_DERIVATIVE_SET_LCD_4BIT     1
               00058 #endif
               00059 
               00060 #endif
               00019  
               00020 ;; ==========================================================================
               00021 ;;  Assembler directives & device specific include file
               00022 ;;
               00023 ;;  Natively supported devices are listed here.
               00024 ;; ==========================================================================
               00025 
               00026 #ifdef __18F452
               00027         LIST R=DEC
               00028 #include <p18f452.inc>
               00029 #endif
               00030 
               00031 #ifdef __18F4620
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00032         LIST R=DEC
               00033 #include <p18f4620.inc>
               00034 #endif
               00035         
               00036 #ifdef __18F4520
               00037         LIST R=DEC
               00038 #include <p18f4520.inc>
               00039 #endif
               00040 
               00041 #ifdef __18F4682
               00042         LIST R=DEC
               00043 #include <p18f4682.inc>
               00044 #endif
               00045 
               00046 #ifdef __18F4685
               00047         LIST R=DEC
               00048 #include <p18f4685.inc>
               00001         LIST
               00002 
               00003 ;==========================================================================
               00004 ;  MPASM PIC18F4685 processor include
               00005 ; 
               00006 ;  (c) Copyright 1999-2007 Microchip Technology, All rights reserved
               00007 ;==========================================================================
               00008 
               04822         LIST
               00049 #endif
               00050 
               00051 
               00052 ;; ==========================================================================
               00053 ;;  General constants
               00054 ;; ==========================================================================
               00055 
               00056 ;; used by MIOS_MIDI_Interface*
  00000000     00057 MIOS_MIDI_INTERFACE_COMMON      EQU     0x00
  00000001     00058 MIOS_MIDI_INTERFACE_TO_HOST     EQU     0x01
               00059 
               00060 ;; used by MIOS_MIDI_Merger*
  00000000     00061 MIOS_MIDI_MERGER_DISABLED       EQU     0x00
  00000001     00062 MIOS_MIDI_MERGER_ENABLED        EQU     0x01
  00000002     00063 MIOS_MIDI_MERGER_MBLINK_EP      EQU     0x02
  00000003     00064 MIOS_MIDI_MERGER_MBLINK_FP      EQU     0x03
               00065 
               00066 ;; used by MIOS_ENC_PIN_TABLE
               00067 #ifdef MIOS_OLD_ENCODER_MODES
               00068 MIOS_ENC_MODE_NON_DETENTED      EQU     0x00
               00069 MIOS_ENC_MODE_DETENTED          EQU     0x80
               00070 MIOS_ENC_MODE_DETENTED1         EQU     0x80
               00071 MIOS_ENC_MODE_DETENTED2         EQU     0x81
               00072 MIOS_ENC_MODE_DETENTED3         EQU     0x82
               00073 #else
               00074 ;; new encoder modes: each bit of MIOS_ENC_MODE_xx tells, if an INC / DEC is 
               00075 ;; being triggered on the corresponding edge. 
               00076 ;; Bit      7   6   5   4  
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00077 ;; DEC     <-  <-  <-  <-
               00078 ;; Pin A ___|-------|_______
               00079 ;; Pin B _______|-------|___
               00080 ;; INC      ->  ->  ->  ->
               00081 ;; Bit      0   1   2   3
               00082 ;; Ex.:          Bit  76543210
               00083 ;;      DETENTED2 = 0b00100010 = 0x22
               00084 ;;      -> INC will be triggered on edge 1, DEC on edge 5
  000000FF     00085 MIOS_ENC_MODE_NON_DETENTED      EQU     0xff
  000000AA     00086 MIOS_ENC_MODE_DETENTED          EQU     0xaa
  000000AA     00087 MIOS_ENC_MODE_DETENTED1         EQU     0xaa
  00000022     00088 MIOS_ENC_MODE_DETENTED2         EQU     0x22
  00000088     00089 MIOS_ENC_MODE_DETENTED3         EQU     0x88
  000000A5     00090 MIOS_ENC_MODE_DETENTED4         EQU     0xa5
  0000005A     00091 MIOS_ENC_MODE_DETENTED5         EQU     0x5a
               00092 #endif
               00093 
               00094 ;; used by MIOS_ENC_Speed*
  00000000     00095 MIOS_ENC_SPEED_SLOW             EQU     0
  00000001     00096 MIOS_ENC_SPEED_NORMAL           EQU     1
  00000002     00097 MIOS_ENC_SPEED_FAST             EQU     2
               00098 
               00099 ;; used by MIOS_LCD_Type*
  00000000     00100 MIOS_LCD_TYPE_CLCD              EQU     0x00
  00000001     00101 MIOS_LCD_TYPE_GLCD0             EQU     0x01
  00000002     00102 MIOS_LCD_TYPE_GLCD1             EQU     0x02
  00000003     00103 MIOS_LCD_TYPE_GLCD2             EQU     0x03
  00000004     00104 MIOS_LCD_TYPE_GLCD3             EQU     0x04
  00000005     00105 MIOS_LCD_TYPE_GLCD4             EQU     0x05
  00000006     00106 MIOS_LCD_TYPE_MLCD              EQU     0x06
  00000007     00107 MIOS_LCD_TYPE_GLCD_CUSTOM       EQU     0x07
               00108 
               00109 ;; location of default 5x8 font for graphical displays
  00007CFC     00110 MIOS_GLCD_FONT                  EQU     0x7cfc
               00111 
               00112 ;; general config flags (never overwrite this flags directly!!!)
  00000000     00113 MIOS_BOX_CFG0_LCD_TYPE0         EQU 0   ; selects LCD type, bit 0
  00000001     00114 MIOS_BOX_CFG0_LCD_TYPE1         EQU 1   ; selects LCD type, bit 1
  00000002     00115 MIOS_BOX_CFG0_LCD_TYPE2         EQU 2   ; selects LCD type, bit 2
  00000003     00116 MIOS_BOX_CFG0_USE_GLCD          EQU 3   ; if 1, graphical LCD is connected
  00000004     00117 MIOS_BOX_CFG0_MERGER            EQU 4   ; if 1, MIDI merger is enabled
  00000005     00118 MIOS_BOX_CFG0_MBLINK            EQU 5   ; if 1, MIDIbox Link is enabled
  00000006     00119 MIOS_BOX_CFG0_TO_HOST           EQU 6   ; if 1, MIDI interface will run with 38400 baud instead of 31250
  00000007     00120 MIOS_BOX_CFG0_20MHz             EQU 7   ; if 1, it is assumed that box is running with 20 MHz, else with 40 MHz
               00121 
  00000000     00122 MIOS_BOX_CFG1_BS_A0             EQU 0   ; A0 of BankStick (never change the bit position)
  00000001     00123 MIOS_BOX_CFG1_BS_A1             EQU 1   ; A1 of BankStick (never change the bit position)
  00000002     00124 MIOS_BOX_CFG1_BS_A2             EQU 2   ; A2 of BankStick (never change the bit position)
  00000003     00125 MIOS_BOX_CFG1_BS_DIS_VERIFY     EQU 3   ; if 1, writes to the BankStick will not be verified
  00000004     00126 MIOS_BOX_CFG1_IIC_STRETCH_CLK   EQU 4   ; if 1, IIC clock stretching enabled
               00127 
               00128 ;; general status flags (never overwrite this flags directly!!!)
  00000000     00129 MIOS_BOX_STAT_BS_AVAILABLE      EQU 0   ; if 1, BankStick is available
  00000001     00130 MIOS_BOX_STAT_MBLINK_TUNNEL_PASS EQU 1  ; if 1, a MBLinked event will be tunnled
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00000002     00131 MIOS_BOX_STAT_SUSPEND_ALL       EQU 2   ; if 1, all system and user tasks are suspended
  00000003     00132 MIOS_BOX_STAT_SUSPEND_USER      EQU 3   ; if 1, all user tasks are suspended
  00000004     00133 MIOS_BOX_STAT_AUTOREPEAT        EQU 4   ; if 1, start the auto-repeat handler
  00000005     00134 MIOS_BOX_STAT_MLCD_TRANSFER     EQU 5   ; if 1, a transfer to the MLCD has been started
  00000006     00135 MIOS_BOX_STAT_FERR              EQU 6   ; if 1, a frame error happened during MIDI receive
               00136 
               00137 ;; ==========================================================================
               00138 ;;  MIOS Special Function Registers
               00139 ;; ==========================================================================
               00140 
  00000000     00141 MIOS_BOX_CFG0   EQU     0x000
  00000001     00142 MIOS_BOX_CFG1   EQU     0x001
  00000002     00143 MIOS_BOX_STAT   EQU     0x002
  00000003     00144 MIOS_PARAMETER1 EQU     0x003
  00000004     00145 MIOS_PARAMETER2 EQU     0x004
  00000005     00146 MIOS_PARAMETER3 EQU     0x005
               00147 
               00148 ;; ==========================================================================
               00149 ;;  temporary registers for main programs
               00150 ;; ==========================================================================
  00000006     00151 TMP1            EQU     0x006
  00000007     00152 TMP2            EQU     0x007
  00000008     00153 TMP3            EQU     0x008
  00000009     00154 TMP4            EQU     0x009
  0000000A     00155 TMP5            EQU     0x00a
               00156 
               00157 ;; ==========================================================================
               00158 ;;  temporary registers for IRQs
               00159 ;; ==========================================================================
  0000000B     00160 IRQ_TMP1        EQU     0x00b
  0000000C     00161 IRQ_TMP2        EQU     0x00c
  0000000D     00162 IRQ_TMP3        EQU     0x00d
  0000000E     00163 IRQ_TMP4        EQU     0x00e
  0000000F     00164 IRQ_TMP5        EQU     0x00f
               00165 
               00166 ;; ==========================================================================
               00167 ;;  free memory space for user application:
               00168 ;; ==========================================================================
               00169         ;; 0x010-0x37f
               00170 
               00171 ;; ==========================================================================
               00172 ;;  MIOS System Registers -- not defined here -- 
               00173 ;;  never use these memory locations!
               00174 ;; ==========================================================================
               00175         ;; 0x380-0x6ff
               00176 
               00177 ;; ==========================================================================
               00178 ;;  MIOS System Registers for custom LCD driver
               00179 ;; ==========================================================================
  00000570     00180 MIOS_GLCD_BUFFER        EQU     0x570   ; note: the buffer must be located at ...0-...7
  00000578     00181 MIOS_LCD_OPTION1        EQU     0x578   ; contains the first LCD option given by MIOS_LCD_TypeSet
  00000579     00182 MIOS_LCD_OPTION2        EQU     0x579   ; contains the second LCD option given by MIOS_LCD_TypeSet
  0000057A     00183 MIOS_LCD_CURSOR_POS     EQU     0x57a   ; the current cursor pos of characters (GLCD: multiplied by width)
  0000057B     00184 MIOS_GLCD_GCURSOR_X     EQU     0x57b   ; for GLCDs: the current X position of graphical cursor
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  8


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  0000057C     00185 MIOS_GLCD_GCURSOR_Y     EQU     0x57c   ; for GLCDs: the current Y position of graphical cursor
  0000057D     00186 MIOS_GLCD_FONT_WIDTH    EQU     0x57d   ; for GLCDs: the fontwidth given by MIOS_GLCD_FontInit
  0000057E     00187 MIOS_GLCD_FONT_HEIGHT   EQU     0x57e   ; for GLCDs: the fontheight given by MIOS_GLCD_FontInit
  0000057F     00188 MIOS_GLCD_FONT_X0       EQU     0x57f   ; for GLCDs: the first byte within a char entry
  00000580     00189 MIOS_GLCD_FONT_OFFSET   EQU     0x580   ; for GLCDs: the byte offset between the characters
  00000581     00190 MIOS_GLCD_FONT_PTRL     EQU     0x581   ; for GLCDs: pointer to the character table, low-byte
  00000582     00191 MIOS_GLCD_FONT_PTRH     EQU     0x582   ; for GLCDs: pointer to the character table, high-byte
  00000583     00192 MIOS_LCD_TIMEOUT0       EQU     0x583   ; can be used for timeout loops
  00000584     00193 MIOS_LCD_TIMEOUT1       EQU     0x584   ; can be used for timeout loops
  00000585     00194 MIOS_GLCD_TMP1          EQU     0x585   ; can be used as temporary buffer
  00000586     00195 MIOS_GLCD_TMP2          EQU     0x586   ; can be used as temporary buffer
  00000587     00196 MIOS_GLCD_TMP3          EQU     0x587   ; can be used as temporary buffer
  00000588     00197 MIOS_GLCD_TMP4          EQU     0x588   ; can be used as temporary buffer
  00000589     00198 MIOS_LCD_Y0_OFFSET      EQU     0x589   ; Y0 offset of LCD
  0000058A     00199 MIOS_LCD_Y1_OFFSET      EQU     0x58a   ; Y1 offset of LCD
  0000058B     00200 MIOS_LCD_Y2_OFFSET      EQU     0x58b   ; Y2 offset of LCD
  0000058C     00201 MIOS_LCD_Y3_OFFSET      EQU     0x58c   ; Y3 offset of LCD
  0000058D     00202 MIOS_LCD_CURSOR_POS_REAL EQU    0x58d   ; unmapped cursor position which has been set with MIOS_LCD_CursorSet
  0000058E     00203 MIOS_GLCD_FONT_PTRU     EQU     0x58e   ; for GLCDs: pointer to the character table, upper-byte (>64k flash derivatives only)
               00023 
               00024 ;; ---[ useful macros ]---
               00025 #include <macros.h>
               00001 ; $Id: macros.h 49 2008-01-30 21:47:31Z tk $
               00002 ;
               00003 ; Macro Definitions
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 BRA_IFSET       MACRO   reg, bit, reg_a, label
               00014         btfsc   reg, bit, reg_a
               00015         bra     label
               00016         ENDM
               00017 
               00018 
               00019 BRA_IFCLR       MACRO   reg, bit, reg_a, label
               00020         btfss   reg, bit, reg_a
               00021         bra     label
               00022         ENDM
               00023 
               00024 GOTO_IFSET      MACRO   reg, bit, reg_a, label
               00025         btfsc   reg, bit, reg_a
               00026         goto    label
               00027         ENDM
               00028 
               00029 
               00030 GOTO_IFCLR      MACRO   reg, bit, reg_a, label
               00031         btfss   reg, bit, reg_a
               00032         goto    label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00033         ENDM
               00034 
               00035 CALL_IFSET      MACRO   reg, bit, reg_a, label
               00036         btfsc   reg, bit, reg_a
               00037         call    label
               00038         ENDM
               00039 
               00040 
               00041 CALL_IFCLR      MACRO   reg, bit, reg_a, label
               00042         btfss   reg, bit, reg_a
               00043         call    label
               00044         ENDM
               00045 
               00046 RCALL_IFSET     MACRO   reg, bit, reg_a, label
               00047         btfsc   reg, bit, reg_a
               00048         rcall   label
               00049         ENDM
               00050 
               00051 
               00052 RCALL_IFCLR     MACRO   reg, bit, reg_a, label
               00053         btfss   reg, bit, reg_a
               00054         rcall   label
               00055         ENDM
               00056 
               00057 ;; ==========================================================================
               00058 
               00059 IRQ_DISABLE MACRO
               00060         bcf     INTCON, GIE
               00061         ENDM
               00062 
               00063 IRQ_ENABLE MACRO
               00064         bsf     INTCON, GIE
               00065         ENDM
               00066 
               00067 ;; ==========================================================================
               00068 
               00069 TABLE_ADDR_FULL MACRO addr
               00070         movlw   LOW(addr)               ; store Lo Byte
               00071         movwf   TBLPTRL
               00072         movlw   HIGH(addr)              ; store Hi Byte
               00073         movwf   TBLPTRH
               00074         movlw   UPPER(addr)             ; store upper Byte
               00075         movwf   TBLPTRU
               00076         ENDM
               00077         
               00078 TABLE_ADDR MACRO addr
               00079         movlw   LOW(addr)               ; store Lo Byte
               00080         movwf   TBLPTRL
               00081         movlw   HIGH(addr)              ; store Hi Byte
               00082         movwf   TBLPTRH
               00083 #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
               00084         movlw   UPPER(addr)             ; store Upper Byte
               00085         movwf   TBLPTRU
               00086 #endif
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 10


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00087         ENDM
               00088         
               00089 TABLE_H MACRO   addr
               00090         movlw   HIGH(addr)              ; store Hi Byte
               00091         movwf   TBLPTRH
               00092         ENDM
               00093 
               00094 TABLE_L MACRO   addr
               00095         movlw   LOW(addr)               ; store Lo Byte
               00096         movwf   TBLPTRL
               00097         ENDM
               00098 
               00099 TABLE_ADD_W MACRO
               00100         addwf   TBLPTRL, F
               00101         movlw   0x00
               00102         addwfc  TBLPTRH, F
               00103 #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
               00104         movlw   0x00
               00105         addwfc  TBLPTRU, F
               00106 #endif
               00107         ENDM
               00108 
               00109 TABLE_ADDR_MUL_W MACRO addr, multiplicator
               00110         mullw   multiplicator
               00111         movlw   LOW(addr)
               00112         addwf   PRODL, W
               00113         movwf   TBLPTRL
               00114         movlw   HIGH(addr)
               00115         addwfc  PRODH, W
               00116         movwf   TBLPTRH
               00117 #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
               00118         clrf    TBLPTRU
               00119         movlw   UPPER(addr)
               00120         addwfc  TBLPTRU, F
               00121 #endif
               00122         ENDM
               00123 
               00124 ;; ==========================================================================
               00125 
               00126 JUMPTABLE_2BYTES MACRO max_value
               00127         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
               00128         skpnc
               00129         movlw   -(max_value)
               00130         addlw   max_value
               00131         call    MIOS_HLP_GetIndex_2bytes
               00132         ENDM
               00133 
               00134 JUMPTABLE_2BYTES_UNSECURE MACRO
               00135         call    MIOS_HLP_GetIndex_2bytes
               00136         ENDM
               00137 
               00138 JUMPTABLE_4BYTES MACRO max_value
               00139         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
               00140         skpnc
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 11


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00141         return
               00142         addlw   (max_value)
               00143         call    MIOS_HLP_GetIndex_4bytes
               00144         ENDM
               00145 
               00146 JUMPTABLE_4BYTES_UNSECURE MACRO
               00147         call    MIOS_HLP_GetIndex_4bytes
               00148         ENDM
               00149 
               00150 ;; ==========================================================================
               00151 
               00152 TWOBYTE_ENTRY MACRO low_byte, high_byte
               00153         dw      (high_byte << 8) | (low_byte)
               00154         ENDM
               00155 
               00156 ;; ==========================================================================
               00157 
0000 00158 #define skpnz   btfsc   STATUS, Z 
0000 00159 #define skpz    btfss   STATUS, Z 
0000 00160 #define skpndc  btfsc   STATUS, DC 
0000 00161 #define skpdc   btfss   STATUS, DC
0000 00162 #define skpnc   btfsc   STATUS, C
0000 00163 #define skpc    btfss   STATUS, C
0000 00164 #define clrc    bcf     STATUS, C
0000 00165 #define setc    bsf     STATUS, C
0000 00166 #define clrz    bcf     STATUS, Z
0000 00167 #define setz    bsf     STATUS, Z
0000 00168 #define rrf     rrcf    
0000 00169 #define rlf     rlcf
               00170 
               00171 rgoto   MACRO   label
               00172         bra     label
               00173         ENDM
               00174 
               00175 SET_BSR MACRO   reg
               00176         movlb   HIGH(reg)
               00177         ENDM
               00178 
               00179 ;; ==========================================================================
               00180 
               00181 FONT_ENTRY MACRO width, height, x0, char_offset
               00182         dw      ((height) << 8) | (width), ((char_offset) << 8) | (x0)
               00183         ENDM
               00184 
               00185 ;; ==========================================================================
               00186 
               00187 STRING MACRO length, pos, str
               00188         da      ((length) << 8) | (pos), str
               00189         ENDM
               00190 
               00191 ;; ==========================================================================
               00026 
               00027 ;; ---[ vectors to MIOS functions (never change!) ]---
               00028 #include <mios_vectors.inc>
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 12


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00001 ; $Id: mios_vectors.inc 49 2008-01-30 21:47:31Z tk $
               00002 
  00002C00     00003 MIOS_MIDI_BeginStream                   EQU     0x2c00
  00002C04     00004 MIOS_MIDI_DeviceIDAutoSet               EQU     0x2c04
  00002C08     00005 MIOS_MIDI_DeviceIDGet                   EQU     0x2c08
  00002C0C     00006 MIOS_MIDI_DeviceIDSet                   EQU     0x2c0c
  00002C10     00007 MIOS_MIDI_EndStream                     EQU     0x2c10
  00002C14     00008 MIOS_MIDI_Init                          EQU     0x2c14
  00002C18     00009 MIOS_MIDI_InterfaceAutoSet              EQU     0x2c18
  00002C1C     00010 MIOS_MIDI_InterfaceGet                  EQU     0x2c1c
  00002C20     00011 MIOS_MIDI_InterfaceSet                  EQU     0x2c20
  00002C24     00012 MIOS_MIDI_MergerGet                     EQU     0x2c24
  00002C28     00013 MIOS_MIDI_MergerSet                     EQU     0x2c28
  00002C2C     00014 MIOS_MIDI_RxBufferFree                  EQU     0x2c2c
  00002C30     00015 MIOS_MIDI_RxBufferGet                   EQU     0x2c30
  00002C34     00016 MIOS_MIDI_RxBufferPut                   EQU     0x2c34
  00002C38     00017 MIOS_MIDI_RxBufferUsed                  EQU     0x2c38
  00002C3C     00018 MIOS_MIDI_TxBufferFlush                 EQU     0x2c3c
  00002C40     00019 MIOS_MIDI_TxBufferFree                  EQU     0x2c40
  00002C44     00020 MIOS_MIDI_TxBufferGet                   EQU     0x2c44
  00002C48     00021 MIOS_MIDI_TxBufferPut                   EQU     0x2c48
  00002C4C     00022 MIOS_MIDI_TxBufferUsed                  EQU     0x2c4c
  00002C50     00023 MIOS_MPROC_MergerDisable                EQU     0x2c50
  00002C54     00024 MIOS_MPROC_MergerEnable                 EQU     0x2c54
  00002C58     00025 MIOS_MPROC_MergerGet                    EQU     0x2c58
  00002C5C     00026 MIOS_AIN_DeadbandGet                    EQU     0x2c5c
  00002C60     00027 MIOS_AIN_DeadbandSet                    EQU     0x2c60
  00002C64     00028 MIOS_AIN_Muxed                          EQU     0x2c64
  00002C68     00029 MIOS_AIN_NumberGet                      EQU     0x2c68
  00002C6C     00030 MIOS_AIN_NumberSet                      EQU     0x2c6c
  00002C70     00031 MIOS_AIN_Pin7bitGet                     EQU     0x2c70
  00002C74     00032 MIOS_AIN_PinGet                         EQU     0x2c74
  00002C78     00033 MIOS_AIN_PinLSBGet                      EQU     0x2c78
  00002C7C     00034 MIOS_AIN_PinMSBGet                      EQU     0x2c7c
  00002C80     00035 MIOS_AIN_UnMuxed                        EQU     0x2c80
  00002C84     00036 MIOS_MF_PWM_DutyCycleDownGet            EQU     0x2c84
  00002C88     00037 MIOS_MF_PWM_DutyCycleDownSet            EQU     0x2c88
  00002C8C     00038 MIOS_MF_PWM_DutyCycleUpGet              EQU     0x2c8c
  00002C90     00039 MIOS_MF_PWM_DutyCycleUpSet              EQU     0x2c90
  00002C94     00040 MIOS_MF_DeadbandGet                     EQU     0x2c94
  00002C98     00041 MIOS_MF_DeadbandSet                     EQU     0x2c98
  00002C9C     00042 MIOS_MF_Disable                         EQU     0x2c9c
  00002CA0     00043 MIOS_MF_Enable                          EQU     0x2ca0
  00002CA4     00044 MIOS_MF_FaderMove                       EQU     0x2ca4
  00002CA8     00045 MIOS_MF_SuspendDisable                  EQU     0x2ca8
  00002CAC     00046 MIOS_MF_SuspendEnable                   EQU     0x2cac
  00002CB0     00047 MIOS_MF_SuspendGet                      EQU     0x2cb0
  00002CB4     00048 MIOS_DIN_PinGet                         EQU     0x2cb4
  00002CB8     00049 MIOS_DIN_SRGet                          EQU     0x2cb8
  00002CBC     00050 MIOS_DOUT_PinGet                        EQU     0x2cbc
  00002CC0     00051 MIOS_DOUT_PinSet                        EQU     0x2cc0
  00002CC4     00052 MIOS_DOUT_PinSet0                       EQU     0x2cc4
  00002CC8     00053 MIOS_DOUT_PinSet1                       EQU     0x2cc8
  00002CCC     00054 MIOS_DOUT_SRGet                         EQU     0x2ccc
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 13


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00002CD0     00055 MIOS_DOUT_SRSet                         EQU     0x2cd0
  00002CD4     00056 MIOS_ENC_Abs7bitAdd                     EQU     0x2cd4
  00002CD8     00057 MIOS_ENC_Abs7bitGet                     EQU     0x2cd8
  00002CDC     00058 MIOS_ENC_Abs7bitSet                     EQU     0x2cdc
  00002CE0     00059 MIOS_ENC_NumberGet                      EQU     0x2ce0
  00002CE4     00060 MIOS_ENC_SpeedGet                       EQU     0x2ce4
  00002CE8     00061 MIOS_ENC_SpeedSet                       EQU     0x2ce8
  00002CEC     00062 MIOS_SRIO_NumberGet                     EQU     0x2cec
  00002CF0     00063 MIOS_SRIO_NumberSet                     EQU     0x2cf0
  00002CF4     00064 MIOS_SRIO_TS_SensitivityGet             EQU     0x2cf4
  00002CF8     00065 MIOS_SRIO_TS_SensitivitySet             EQU     0x2cf8
  00002CFC     00066 MIOS_SRIO_UpdateFrqGet                  EQU     0x2cfc
  00002D00     00067 MIOS_SRIO_UpdateFrqSet                  EQU     0x2d00
  00002D04     00068 MIOS_LCD_Clear                          EQU     0x2d04
  00002D08     00069 MIOS_LCD_Cmd                            EQU     0x2d08
  00002D0C     00070 MIOS_LCD_CursorGet                      EQU     0x2d0c
  00002D10     00071 MIOS_LCD_CursorSet                      EQU     0x2d10
  00002D14     00072 MIOS_LCD_Data                           EQU     0x2d14
  00002D18     00073 MIOS_LCD_Init                           EQU     0x2d18
  00002D1C     00074 MIOS_LCD_PrintBCD1                      EQU     0x2d1c
  00002D20     00075 MIOS_LCD_PrintBCD2                      EQU     0x2d20
  00002D24     00076 MIOS_LCD_PrintBCD3                      EQU     0x2d24
  00002D28     00077 MIOS_LCD_PrintChar                      EQU     0x2d28
  00002D2C     00078 MIOS_LCD_PrintHex1                      EQU     0x2d2c
  00002D30     00079 MIOS_LCD_PrintHex2                      EQU     0x2d30
  00002D34     00080 MIOS_LCD_PrintMessage                   EQU     0x2d34
  00002D38     00081 MIOS_LCD_PrintPreconfString             EQU     0x2d38
  00002D3C     00082 MIOS_LCD_PrintString                    EQU     0x2d3c
  00002D40     00083 MIOS_LCD_TypeAutoSet                    EQU     0x2d40
  00002D44     00084 MIOS_LCD_TypeGet                        EQU     0x2d44
  00002D48     00085 MIOS_LCD_TypeSet                        EQU     0x2d48
  00002D4C     00086 MIOS_LCD_YAddressGet                    EQU     0x2d4c
  00002D50     00087 MIOS_LCD_YAddressSet                    EQU     0x2d50
  00002D54     00088 MIOS_GLCD_FontInit                      EQU     0x2d54
  00002D58     00089 MIOS_GLCD_GCursorGet                    EQU     0x2d58
  00002D5C     00090 MIOS_GLCD_GCursorSet                    EQU     0x2d5c
  00002D60     00091 MIOS_EEPROM_Read                        EQU     0x2d60
  00002D64     00092 MIOS_EEPROM_Write                       EQU     0x2d64
  00002D68     00093 MIOS_FLASH_Read                         EQU     0x2d68
  00002D6C     00094 MIOS_FLASH_Write                        EQU     0x2d6c
  00002D70     00095 MIOS_BANKSTICK_Read                     EQU     0x2d70
  00002D74     00096 MIOS_BANKSTICK_Write                    EQU     0x2d74
  00002D78     00097 MIOS_TIMER_Init                         EQU     0x2d78
  00002D7C     00098 MIOS_TIMER_Start                        EQU     0x2d7c
  00002D80     00099 MIOS_TIMER_Stop                         EQU     0x2d80
  00002D84     00100 MIOS_HLP_AddressFromTable               EQU     0x2d84
  00002D88     00101 MIOS_HLP_GetBitANDMask                  EQU     0x2d88
  00002D8C     00102 MIOS_HLP_GetBitORMask                   EQU     0x2d8c
  00002D90     00103 MIOS_HLP_GetIndex_2bytes                EQU     0x2d90
  00002D94     00104 MIOS_HLP_GetIndex_4bytes                EQU     0x2d94
  00002D98     00105 MIOS_HLP_IndirectJump                   EQU     0x2d98
  00002D9C     00106 MIOS_Delay                              EQU     0x2d9c
  00002DA0     00107 MIOS_GPCounterGet                       EQU     0x2da0
  00002DA4     00108 MIOS_Reset                              EQU     0x2da4
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 14


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00002DA8     00109 MIOS_SystemResume                       EQU     0x2da8
  00002DAC     00110 MIOS_SystemSuspend                      EQU     0x2dac
  00002DB0     00111 MIOS_UserResume                         EQU     0x2db0
  00002DB4     00112 MIOS_UserSuspend                        EQU     0x2db4
  00002DB8     00113 MIOS_HLP_16bitAddSaturate               EQU     0x2db8
  00002DBC     00114 MIOS_DIN_PinAutoRepeatEnable            EQU     0x2dbc
  00002DC0     00115 MIOS_DIN_PinAutoRepeatDisable           EQU     0x2dc0
  00002DC4     00116 MIOS_DIN_PinAutoRepeatGet               EQU     0x2dc4
  00002DC8     00117 MIOS_CLCD_SpecialCharInit               EQU     0x2dc8
  00002DCC     00118 MIOS_CLCD_SpecialCharsInit              EQU     0x2dcc
  00002DD0     00119 MIOS_AIN_DynamicPrioSet                 EQU     0x2dd0
  00002DD4     00120 MIOS_AIN_DynamicPrioGet                 EQU     0x2dd4
  00002DD8     00121 MIOS_AIN_LastPinsGet                    EQU     0x2dd8
  00002DDC     00122 MIOS_BANKSTICK_CtrlSet                  EQU     0x2ddc
  00002DE0     00123 MIOS_BANKSTICK_CtrlGet                  EQU     0x2de0
  00002DE4     00124 MIOS_BANKSTICK_WritePage                EQU     0x2de4
  00002DE8     00125 MIOS_HLP_Dec2BCD                        EQU     0x2de8
  00002DEC     00126 MIOS_LCD_PrintBCD4                      EQU     0x2dec
  00002DF0     00127 MIOS_LCD_PrintBCD5                      EQU     0x2df0
  00002DF4     00128 MIOS_LCD_MessageStart                   EQU     0x2df4
  00002DF8     00129 MIOS_LCD_MessageStop                    EQU     0x2df8
  00002DFC     00130 MIOS_MF_PWM_PeriodGet                   EQU     0x2dfc
  00002E00     00131 MIOS_MF_PWM_PeriodSet                   EQU     0x2e00
  00002E04     00132 MIOS_IIC_Start                          EQU     0x2e04
  00002E08     00133 MIOS_IIC_Stop                           EQU     0x2e08
  00002E0C     00134 MIOS_IIC_ByteSend                       EQU     0x2e0c
  00002E10     00135 MIOS_IIC_ByteReceive                    EQU     0x2e10
  00002E14     00136 MIOS_IIC_AckSend                        EQU     0x2e14
  00002E18     00137 MIOS_IIC_NakSend                        EQU     0x2e18
  00002E1C     00138 MIOS_IIC_CtrlSet                        EQU     0x2e1c
  00002E20     00139 MIOS_IIC_CtrlGet                        EQU     0x2e20
  00002E24     00140 MIOS_SRIO_DebounceSet                   EQU     0x2e24
  00002E28     00141 MIOS_SRIO_DebounceGet                   EQU     0x2e28
  00002E2C     00142 MIOS_MF_TouchDetectionReset             EQU     0x2e2c
  00002E30     00143 MIOS_BANKSTICK_ReadPage                 EQU     0x2e30
  00002E34     00144 MIOS_EEPROM_ReadPage                    EQU     0x2e34
  00002E38     00145 MIOS_EEPROM_WritePage                   EQU     0x2e38
  00002E3C     00146 MIOS_TIMER_ReInit                       EQU     0x2e3c
  00002E40     00147 MIOS_RESERVED_144                       EQU     0x2e40
  00002E44     00148 MIOS_RESERVED_145                       EQU     0x2e44
  00002E48     00149 MIOS_RESERVED_146                       EQU     0x2e48
  00002E4C     00150 MIOS_RESERVED_147                       EQU     0x2e4c
  00002E50     00151 MIOS_RESERVED_148                       EQU     0x2e50
  00002E54     00152 MIOS_RESERVED_149                       EQU     0x2e54
  00002E58     00153 MIOS_RESERVED_150                       EQU     0x2e58
  00002E5C     00154 MIOS_RESERVED_151                       EQU     0x2e5c
  00002E60     00155 MIOS_RESERVED_152                       EQU     0x2e60
  00002E64     00156 MIOS_RESERVED_153                       EQU     0x2e64
  00002E68     00157 MIOS_RESERVED_154                       EQU     0x2e68
  00002E6C     00158 MIOS_RESERVED_155                       EQU     0x2e6c
  00002E70     00159 MIOS_RESERVED_156                       EQU     0x2e70
  00002E74     00160 MIOS_RESERVED_157                       EQU     0x2e74
  00002E78     00161 MIOS_RESERVED_158                       EQU     0x2e78
  00002E7C     00162 MIOS_RESERVED_159                       EQU     0x2e7c
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 15


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00002E80     00163 MIOS_RESERVED_160                       EQU     0x2e80
  00002E84     00164 MIOS_RESERVED_161                       EQU     0x2e84
  00002E88     00165 MIOS_RESERVED_162                       EQU     0x2e88
  00002E8C     00166 MIOS_RESERVED_163                       EQU     0x2e8c
  00002E90     00167 MIOS_RESERVED_164                       EQU     0x2e90
  00002E94     00168 MIOS_RESERVED_165                       EQU     0x2e94
  00002E98     00169 MIOS_RESERVED_166                       EQU     0x2e98
  00002E9C     00170 MIOS_RESERVED_167                       EQU     0x2e9c
  00002EA0     00171 MIOS_RESERVED_168                       EQU     0x2ea0
  00002EA4     00172 MIOS_RESERVED_169                       EQU     0x2ea4
  00002EA8     00173 MIOS_RESERVED_170                       EQU     0x2ea8
  00002EAC     00174 MIOS_RESERVED_171                       EQU     0x2eac
  00002EB0     00175 MIOS_RESERVED_172                       EQU     0x2eb0
  00002EB4     00176 MIOS_RESERVED_173                       EQU     0x2eb4
  00002EB8     00177 MIOS_RESERVED_174                       EQU     0x2eb8
  00002EBC     00178 MIOS_RESERVED_175                       EQU     0x2ebc
  00002EC0     00179 MIOS_RESERVED_176                       EQU     0x2ec0
  00002EC4     00180 MIOS_RESERVED_177                       EQU     0x2ec4
  00002EC8     00181 MIOS_RESERVED_178                       EQU     0x2ec8
  00002ECC     00182 MIOS_RESERVED_179                       EQU     0x2ecc
  00002ED0     00183 MIOS_RESERVED_180                       EQU     0x2ed0
  00002ED4     00184 MIOS_RESERVED_181                       EQU     0x2ed4
  00002ED8     00185 MIOS_RESERVED_182                       EQU     0x2ed8
  00002EDC     00186 MIOS_RESERVED_183                       EQU     0x2edc
  00002EE0     00187 MIOS_RESERVED_184                       EQU     0x2ee0
  00002EE4     00188 MIOS_RESERVED_185                       EQU     0x2ee4
  00002EE8     00189 MIOS_RESERVED_186                       EQU     0x2ee8
  00002EEC     00190 MIOS_RESERVED_187                       EQU     0x2eec
  00002EF0     00191 MIOS_RESERVED_188                       EQU     0x2ef0
  00002EF4     00192 MIOS_RESERVED_189                       EQU     0x2ef4
  00002EF8     00193 MIOS_RESERVED_190                       EQU     0x2ef8
  00002EFC     00194 MIOS_RESERVED_191                       EQU     0x2efc
  00002F00     00195 MIOS_RESERVED_192                       EQU     0x2f00
  00002F04     00196 MIOS_RESERVED_193                       EQU     0x2f04
  00002F08     00197 MIOS_RESERVED_194                       EQU     0x2f08
  00002F0C     00198 MIOS_RESERVED_195                       EQU     0x2f0c
  00002F10     00199 MIOS_RESERVED_196                       EQU     0x2f10
  00002F14     00200 MIOS_RESERVED_197                       EQU     0x2f14
  00002F18     00201 MIOS_RESERVED_198                       EQU     0x2f18
  00002F1C     00202 MIOS_RESERVED_199                       EQU     0x2f1c
  00002F20     00203 MIOS_RESERVED_200                       EQU     0x2f20
  00002F24     00204 MIOS_RESERVED_201                       EQU     0x2f24
  00002F28     00205 MIOS_RESERVED_202                       EQU     0x2f28
  00002F2C     00206 MIOS_RESERVED_203                       EQU     0x2f2c
  00002F30     00207 MIOS_RESERVED_204                       EQU     0x2f30
  00002F34     00208 MIOS_RESERVED_205                       EQU     0x2f34
  00002F38     00209 MIOS_RESERVED_206                       EQU     0x2f38
  00002F3C     00210 MIOS_RESERVED_207                       EQU     0x2f3c
  00002F40     00211 MIOS_RESERVED_208                       EQU     0x2f40
  00002F44     00212 MIOS_RESERVED_209                       EQU     0x2f44
  00002F48     00213 MIOS_RESERVED_210                       EQU     0x2f48
  00002F4C     00214 MIOS_RESERVED_211                       EQU     0x2f4c
  00002F50     00215 MIOS_RESERVED_212                       EQU     0x2f50
  00002F54     00216 MIOS_RESERVED_213                       EQU     0x2f54
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 16


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00002F58     00217 MIOS_RESERVED_214                       EQU     0x2f58
  00002F5C     00218 MIOS_RESERVED_215                       EQU     0x2f5c
  00002F60     00219 MIOS_RESERVED_216                       EQU     0x2f60
  00002F64     00220 MIOS_RESERVED_217                       EQU     0x2f64
  00002F68     00221 MIOS_RESERVED_218                       EQU     0x2f68
  00002F6C     00222 MIOS_RESERVED_219                       EQU     0x2f6c
  00002F70     00223 MIOS_RESERVED_220                       EQU     0x2f70
  00002F74     00224 MIOS_RESERVED_221                       EQU     0x2f74
  00002F78     00225 MIOS_RESERVED_222                       EQU     0x2f78
  00002F7C     00226 MIOS_RESERVED_223                       EQU     0x2f7c
  00002F80     00227 MIOS_RESERVED_224                       EQU     0x2f80
  00002F84     00228 MIOS_RESERVED_225                       EQU     0x2f84
  00002F88     00229 MIOS_RESERVED_226                       EQU     0x2f88
  00002F8C     00230 MIOS_RESERVED_227                       EQU     0x2f8c
  00002F90     00231 MIOS_RESERVED_228                       EQU     0x2f90
  00002F94     00232 MIOS_RESERVED_229                       EQU     0x2f94
  00002F98     00233 MIOS_RESERVED_230                       EQU     0x2f98
  00002F9C     00234 MIOS_RESERVED_231                       EQU     0x2f9c
  00002FA0     00235 MIOS_RESERVED_232                       EQU     0x2fa0
  00002FA4     00236 MIOS_RESERVED_233                       EQU     0x2fa4
  00002FA8     00237 MIOS_RESERVED_234                       EQU     0x2fa8
  00002FAC     00238 MIOS_RESERVED_235                       EQU     0x2fac
  00002FB0     00239 MIOS_RESERVED_236                       EQU     0x2fb0
  00002FB4     00240 MIOS_RESERVED_237                       EQU     0x2fb4
  00002FB8     00241 MIOS_RESERVED_238                       EQU     0x2fb8
  00002FBC     00242 MIOS_RESERVED_239                       EQU     0x2fbc
  00002FC0     00243 MIOS_RESERVED_240                       EQU     0x2fc0
  00002FC4     00244 MIOS_RESERVED_241                       EQU     0x2fc4
  00002FC8     00245 MIOS_RESERVED_242                       EQU     0x2fc8
  00002FCC     00246 MIOS_RESERVED_243                       EQU     0x2fcc
  00002FD0     00247 MIOS_RESERVED_244                       EQU     0x2fd0
  00002FD4     00248 MIOS_RESERVED_245                       EQU     0x2fd4
  00002FD8     00249 MIOS_RESERVED_246                       EQU     0x2fd8
  00002FDC     00250 MIOS_RESERVED_247                       EQU     0x2fdc
  00002FE0     00251 MIOS_RESERVED_248                       EQU     0x2fe0
  00002FE4     00252 MIOS_RESERVED_249                       EQU     0x2fe4
  00002FE8     00253 MIOS_RESERVED_250                       EQU     0x2fe8
  00002FEC     00254 MIOS_RESERVED_251                       EQU     0x2fec
  00002FF0     00255 MIOS_RESERVED_252                       EQU     0x2ff0
  00002FF4     00256 MIOS_RESERVED_253                       EQU     0x2ff4
  00002FF8     00257 MIOS_RESERVED_254                       EQU     0x2ff8
  00002FFC     00258 MIOS_RESERVED_255                       EQU     0x2ffc
               00029 
               00030 ;; ---[ user hooks (never change!) ]---
               00031 #include <user_vectors.inc>
               00001 ; $Id: user_vectors.inc 49 2008-01-30 21:47:31Z tk $
               00002 ;
               00003 ; User vectortable - contains user hooks to MIOS
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 17


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013         ;; never change the origin or the order of entries!
3000           00014         org     0x3000
3000 00015 _User_Init
3000 EF87 F019 00016         goto    USER_Init
3004 00017 _USER_Tick
3004 EFA9 F019 00018         goto    USER_Tick
3008 00019 _USER_Timer
3008 EFB2 F019 00020         goto    USER_Timer
300C 00021 _USER_MPROC_DebugTrigger
300C EFB5 F019 00022         goto    USER_MPROC_DebugTrigger
3010 00023 _USER_DISPLAY_Init
3010 EFB6 F019 00024         goto    USER_DISPLAY_Init
3014 00025 _USER_DISPLAY_Tick
3014 EFB7 F019 00026         goto    USER_DISPLAY_Tick
3018 00027 _USER_SR_Service_Prepare
3018 EFDB F019 00028         goto    USER_SR_Service_Prepare
301C 00029 _USER_SR_Service_Finish
301C EFDC F019 00030         goto    USER_SR_Service_Finish
3020 00031 _USER_DIN_NotifyToggle
3020 EFD9 F019 00032         goto    USER_DIN_NotifyToggle
3024 00033 _USER_ENC_NotifyChange
3024 EFDA F019 00034         goto    USER_ENC_NotifyChange
3028 00035 _USER_AIN_NotifyChange
3028 EFDD F019 00036         goto    USER_AIN_NotifyChange
302C 00037 _USER_MPROC_NotifyReceivedByte
302C EFC3 F019 00038         goto    USER_MPROC_NotifyReceivedByte
3030 00039 _USER_MPROC_NotifyTimeout
3030 EFC0 F019 00040         goto    USER_MPROC_NotifyTimeout
3034 00041 _USER_MPROC_NotifyReceivedEvent
3034 EFBC F019 00042         goto    USER_MPROC_NotifyReceivedEvent
3038 00043 _USER_MPROC_NotifyFoundEvent
3038 EFBF F019 00044         goto    USER_MPROC_NotifyFoundEvent
303C 00045 _USER_LCD_Init
303C EF80 F019 00046         goto    USER_LCD_Init
3040 00047 _USER_LCD_Clear
3040 EF81 F019 00048         goto    USER_LCD_Clear
3044 00049 _USER_LCD_CursorSet
3044 EF82 F019 00050         goto    USER_LCD_CursorSet
3048 00051 _USER_LCD_PrintChar
3048 EF83 F019 00052         goto    USER_LCD_PrintChar
304C 00053 _USER_MIDI_NotifyRx
304C EFC9 F019 00054         goto    USER_MIDI_NotifyRx
3050 00055 _USER_MIDI_NotifyTx
3050 EFC6 F019 00056         goto    USER_MIDI_NotifyTx
3054 00057 _USER_LCD_Data
3054 EF84 F019 00058         goto    USER_LCD_Data
3058 00059 _USER_LCD_Cmd
3058 EF85 F019 00060         goto    USER_LCD_Cmd
305C 00061 _USER_LCD_SpecialCharInit
305C EF86 F019 00062         goto    USER_LCD_SpecialCharInit
3060 00063 USER_RESERVED_25
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 18


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3060 0012      00064         return
3062 0000      00065         nop
3064 00066 USER_RESERVED_26
3064 0012      00067         return
3066 0000      00068         nop
3068 00069 USER_RESERVED_27
3068 0012      00070         return
306A 0000      00071         nop
306C 00072 USER_RESERVED_28
306C 0012      00073         return
306E 0000      00074         nop
3070 00075 USER_RESERVED_29
3070 0012      00076         return
3072 0000      00077         nop
3074 00078 USER_RESERVED_30
3074 0012      00079         return
3076 0000      00080         nop
3078 00081 USER_RESERVED_31
3078 0012      00082         return
307A 0000      00083         nop
307C 00084 USER_RESERVED_32
307C 0012      00085         return
307E 0000      00086         nop
               00032 
               00033 ;; ---[ variables used by application ]---
               00034 #include "app_defines.h"
               00001 ; $Id: app_defines.h bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; Specific Defines and variables of MIOS Application
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
3080 00013 #define TIA_STAT_ENGINE_DISABLE         0   ; if set, TIA tick and TIA interrupt will not be processed
3080 00014 #define TIA_STAT_FORCE_REFRESH          1   ; if set, a refresh will be forced with next TIA_Tick
3080 00015 #define TIA_STAT_CC_DUMP_REQ            2   ; if set, a CC dump will be sent
3080 00016 #define TIA_STAT_SAVED_GIE          3   ; save the GIE bit for nested interrupt disables
3080 00017 #define TIA_STAT_TRIGGER_RESET          4   ; if set, the TIA will be reset with next TIA_Tick
               00018 
               00019 ;; ==========================================================================
               00020 
3080 00021 #define TIA_PLAY_MODE_POLY          0
3080 00022 #define TIA_PLAY_MODE_SUS_KEY           1
3080 00023 #define TIA_PLAY_MODE_LEGATO_OFF        2
3080 00024 #define TIA_PLAY_MODE_ONLY_WT_OFF       3
               00025 
               00026 ;; ==========================================================================
3080 00027 #define TIA_MIDI_SYNC_SEND_CLK          0       ; send MIDI clock
3080 00028 #define TIA_MIDI_SYNC_F8            4   ; bit 4 notifies a received MIDI clock
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 19


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3080 00029 #define TIA_MIDI_SYNC_FA            5   ; bit 5 notifies a received MIDI clock start
3080 00030 #define TIA_MIDI_SYNC_TICK_1        6   ; bit 6 notifies that the TIA_SW engine should be clocked with common resolution
3080 00031 #define TIA_MIDI_SYNC_TICK_2        7   ; bit 7 notifies that the TIA_SW engine should be clocked with double resolution
               00032 
               00033 ;; ==========================================================================
               00034 
3080 00035 #define TIA_MOD_SYNC_LFO1           0   ; sync LFO1
3080 00036 #define TIA_MOD_SYNC_LFO2           1   ; sync LFO2
3080 00037 #define TIA_MOD_SYNC_LFO3           2   ; sync LFO3
3080 00038 #define TIA_MOD_SYNC_LFO4           3   ; sync LFO4
3080 00039 #define TIA_MOD_SYNC_ENV1           4   ; sync ENV1
3080 00040 #define TIA_MOD_SYNC_ENV2           5   ; sync ENV2
               00041 
               00042 ;; ==========================================================================
               00043 
3080 00044 #define BANKSTICK_MAGIC0        0x83; magic numbers - if they don't exists in bankstick at BANK_MAGIC_ADDRESS,
3080 00045 #define BANKSTICK_MAGICP        0x12 ; the stick will be ignored until it has been formatted
3080 00046 #define BANKSTICK_MAGICK        BANKSTICK_MAGICP+1 ; the stick will be ignored until it has been formatted
               00047 
               00048 ;; ==========================================================================
               00049 
3080 00050 #define REG_TEMP_TEST_FLAG      0
3080 00051 #define REG_TEMP_UP_FLAG        1
3080 00052 #define REG_TEMP_DOWN_FLAG      2
               00053 
               00054 #if DEFAULT_TIA_DEBUG_ON == 1 
               00055 ;;#if DEFAULT_TIA_DEBUG_BS == 1   ;; for BankStick
3080 00056 #define TIA_DEBUG_EE_FLAG               0   ;;REGA flag
3080 00057 #define TIA_DEBUG_EE_RW                 1   ;;REGA RW:0=Read/1=Write
3080 00058 #define TIA_DEBUG_EE_PAGE               2   ;;REGA RW:0=One byte/1=One Page(64 bytes)
3080 00059 #define TIA_DEBUG_EE_ERROR              3   ;;REGA 0=No Error/1=Error
3080 00060 #define TIA_DEBUG_EE_READONLY   4   ;;REGA RW:0=No Error/1=Error
3080 00061 #define TIA_DEBUG_EE_WRERR      5   ;;REGA 0=No Error/1=Error
3080 00062 #define TIA_DEBUG_EE_PINIT      6   ;;REGA RW:0=No Error/1=Error
3080 00063 #define TIA_DEBUG_EE_SYX        7   ;;REGA RW:0=No Error/1=Error
               00064 
3080 00065 #define TIA_DEBUG_EE_PK                 0   ;;REGB 0=Patch/1=Kit/Wavetable
3080 00066 #define TIA_DEBUG_EE_WT         1   ;;REGB 0=Kit/1=Wavetable
3080 00067 #define TIA_DEBUG_BS_RWCHK              2   ;;REGB 0=Read/Write/1=Check
3080 00068 #define TIA_DEBUG_BS_SIZE               3   ;;REGB 0=Internal/1=External
3080 00069 #define TIA_DEBUG_BS_INTEXT             4   ;;REGB Chk:0=32k/1=64k
3080 00070 #define TIA_DEBUG_BS_FORMAT             5   ;;REGB Chk:0=Connected! Ok/1=Reformated!
3080 00071 #define TIA_DEBUG_BS_FPROTECT   6   ;;REGB Chk:format protected
3080 00072 #define TIA_DEBUG_BS_TPROTECT   7   ;;REGB Chk:type protected
3080 00073 #define TIA_DEBUG_BS_READY      5   ;;REGB Chk:bankstick ready     
               00074 ;;#endif
               00075 #endif
               00076 
               00077 ;; ==========================================================================
               00078         ;; free memory for user applications:   
               00079         ;; 0x010-0x37f
               00080 
               00081 ;; ==========================================================================
               00082 ;;  General TIA Control Variables in ACCESS page
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 20


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00083 ;; ==========================================================================
  00000010     00084 TIA_STAT                EQU     0x010
               00085 
  00000011     00086 TIA_BANK                EQU     0x011
  00000012     00087 TIA_PRESET              EQU     0x012
  00000013     00088 TIA_PATCH               EQU     0x013
  00000014     00089 TIA_PBANK               EQU     0x014
  00000015     00090 TIA_KIT                 EQU     0x015
  00000016     00091 TIA_KBANK               EQU     0x016
  00000017     00092 TIA_WT                  EQU     0x017
  00000018     00093 TIA_WBANK               EQU     0x018
  00000019     00094 TIA_BANKSTICK_CHK_CTR   EQU     0x019
  0000001A     00095 TIA_BANKSTICK_ID        EQU     0x01a
  0000001B     00096 TIA_BANKSTICK_RDY       EQU     0x01b
  0000001C     00097 TIA_BANKSTICK_STAT      EQU     0x01c
  0000001D     00098 TIA_BANKSTICK_SIZE      EQU     0x01d
               00099 
  00000020     00100 TIA_MIDI_DEVICE         EQU     0x020
               00101 
               00102 ;; ==========================================================================
               00103 ;;  Variables used by the MIDI processor in tia_sysex.inc
               00104 ;; ==========================================================================
  00000021     00105 TIA_SYSEX_STATE         EQU     0x021
  00000022     00106 TIA_SYSEX_ACTION        EQU     0x022
  00000023     00107 TIA_SYSEX_IN            EQU     0x023
  00000024     00108 TIA_SYSEX_CHECKSUM      EQU     0x024
  00000025     00109 TIA_SYSEX_ADDRESS       EQU     0x025
  00000026     00110 TIA_SYSEX_ERROR     EQU 0x026
               00111 
               00112 ;; ==========================================================================
               00113 ;; free: 0x27-0x5a
               00114 
               00115 ;;temporary
  00000030     00116 REG_TEMP        EQU     0x030
  00000031     00117 REG_TEMP2       EQU     0x031
  00000032     00118 REG_TEMP3       EQU     0x032
  00000033     00119 REG_TEMP4       EQU     0x033
               00120 
  00000034     00121 REG_TEMP5       EQU     0x034
  00000035     00122 REG_TEMP6       EQU     0x035
               00123 ;; ==========================================================================
               00124 
               00125 #if DEFAULT_TIA_DEBUG_ON == 1
               00126 #if DEFAULT_TIA_DEBUG_BS == 1   ;; for BankStick
  0000005B     00127 TIA_DEBUG_BS_REGA               EQU     0x05b
  0000005C     00128 TIA_DEBUG_BS_REG1       EQU     0x05c
  0000005D     00129 TIA_DEBUG_BS_REG2       EQU     0x05d
  0000005E     00130 TIA_DEBUG_BS_REG3               EQU     0x05e
  0000005F     00131 TIA_DEBUG_BS_REG4               EQU     0x05f
  00000060     00132 TIA_DEBUG_BS_REG5               EQU     0x060
  00000061     00133 TIA_DEBUG_BS_REG6               EQU     0x061
  00000062     00134 TIA_DEBUG_BS_REGB               EQU     0x062
  00000063     00135 TIA_DEBUG_BS_REG9               EQU     0x063
               00136 #endif
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 21


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00137 #if DEFAULT_TIA_DEBUG_EE == 1   ;; for BankStick
  00000064     00138 TIA_DEBUG_EE_REGA               EQU     0x064
  00000065     00139 TIA_DEBUG_EE_REG1       EQU     0x065
  00000066     00140 TIA_DEBUG_EE_REG2               EQU     0x066
               00141 #endif
               00142 #endif
               00143 
               00144 ;; ==========================================================================
               00145 
  00000067     00146 MIDI_RXTX_RX_CTR        EQU     0x067
  00000068     00147 MIDI_RXTX_TX_CTR        EQU     0x068
  00000069     00148 MIDI_RXTX_BEAT_CTR      EQU     0x069
               00149 
               00150 ;; ==========================================================================
               00151 
  0000006A     00152 TIA_LEDMTR_STAT     EQU 0x06a
  0000006B     00153 TIA_LEDMTR_VALUE        EQU     0x06b
               00154 
               00155 ;; ==========================================================================
               00156 
  0000006C     00157 AOUT_FILTER_TMP_L       EQU     0x06c   ; used in tia_sw.inc as temporary storage for [filter value
  0000006D     00158 AOUT_FILTER_TMP_H       EQU     0x06d
               00159 
               00160 ;; ==========================================================================
               00161 
  0000006E     00162 AOUT_INVERTED           EQU     0x06e
  0000006F     00163 AOUT_UPDATE_REQ         EQU     0x06f
  00000070     00164 AOUT_VALUES             EQU     0x070  ; ..0x07f (8 * 16bit words)
               00165 
               00166 ;; ==========================================================================
               00167         ;; note: 0x080-0x0ff used by CS_TIAS1
               00168 ;; ==========================================================================
               00169 ;;  a lot of TIA control variables in BANKED page
               00170 ;; ==========================================================================
  00000100     00171 TIA_SW_CLEAR_BEGIN      EQU     0x100           ; used to initialize the whole TIA_SW memory
  000001FF     00172 TIA_SW_CLEAR_END                EQU     0x1ff           ; also used as 256 byte download buffer (!)                                                            
               00173                                                             
  00000100     00174 TIA_BASE          EQU   0x100           ; address space of TIA chip (used: 0x00-0x05)
               00175 
  00000100     00176 TIA_AUDC0      EQU TIA_BASE+0x00        ;; control. for voice 1 (Aud0)
  00000101     00177 TIA_AUDC1      EQU TIA_BASE+0x01        ;; control. for voice 2 (Aud1)
  00000102     00178 TIA_AUDF0      EQU TIA_BASE+0x02        ;; freq. for voice 1 (Aud0)
  00000103     00179 TIA_AUDF1      EQU TIA_BASE+0x03        ;; freq. for voice 2 (Aud1)
  00000104     00180 TIA_AUDV0      EQU TIA_BASE+0x04        ;; vol. for voice 1 (Aud0)
  00000105     00181 TIA_AUDV1      EQU TIA_BASE+0x05        ;; vol. for voice 2 (Aud1)
               00182                                                               
  0000010B     00183 TIA_MASTER_VOL          EQU     TIA_BASE+0x0b   ; internal TIA_SW register
  0000010C     00184 TIA_PLAY_MODE           EQU     TIA_BASE+0x0c   ; internal TIA_SW register
  0000010D     00185 TIA_SE_OPTION           EQU     TIA_BASE+0x0d   ; internal TIA_SW register
  0000010E     00186 TIA_SW_VOICE            EQU     TIA_BASE+0x0e   ; internal TIA_SW register
  0000010F     00187 TIA_SW_LFO_NUMBER       EQU     TIA_BASE+0x0f   ; internal TIA_SW register
  0000010F     00188 TIA_SW_ENV_NUMBER       EQU     TIA_SW_LFO_NUMBER
               00189 
  0000010F     00190 TIA_BASE_END            EQU     0x10f
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 22


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00191 
               00192 ;; ==========================================================================
               00193 
  00000110     00194 TIA_SHADOW_BASE         EQU     0x110           ; shadow addresses, necessary to determine changes (used: 0x00-0x05)
               00195 
               00196         ;; (TIA_SHADOW_BASE + 0x00) to (TIA_SHADOW_BASE + 0x05) allocated by shadow registers
               00197 
  0000011C     00198 TIA_LFO_RANDOM_SEED_L   EQU     TIA_SHADOW_BASE+0x0c    ; internal TIA_SW register
  0000011D     00199 TIA_LFO_RANDOM_SEED_H   EQU     TIA_SHADOW_BASE+0x0d    ; internal TIA_SW register
  0000011E     00200 TIA_ENVx_CURVES         EQU     TIA_SHADOW_BASE+0x0e    ; internal TIA_SW register
  0000011F     00201 TIA_MOD_SYNC            EQU     TIA_SHADOW_BASE+0x0f    ; internal TIA_SW register
               00202 
  0000011F     00203 TIA_SHADOW_END          EQU     0x11f
               00204 
               00205 ;; ==========================================================================
               00206 
  00000040     00207 TIA_Vx_RECORD_LEN       EQU     64      ;; 64 Max
               00208 
  00000000     00209 TIA_Vx_MIDI_CHANNEL       EQU   0x00
  00000001     00210 TIA_Vx_SPLIT_LOWER        EQU   0x01
  00000002     00211 TIA_Vx_SPLIT_UPPER        EQU   0x02
  00000003     00212 TIA_Vx_STAT               EQU   0x03
  00000004     00213 TIA_Vx_MODE               EQU   0x04    ; Always follow TIA_Vx_STAT
  00000005     00214 TIA_Vx_KEY_OFFSET         EQU   0x05
  00000006     00215 TIA_Vx_KEY_LENGTH         EQU   0x06
  00000007     00216 TIA_Vx_TARGET_FRQ_L       EQU   0x07
  00000008     00217 TIA_Vx_TARGET_FRQ_H       EQU   0x08
  00000009     00218 TIA_Vx_FRQ_L              EQU   0x09
  0000000A     00219 TIA_Vx_FRQ_H              EQU   0x0a
  0000000B     00220 TIA_Vx_PITCHBENDER        EQU   0x0b
  0000000C     00221 TIA_Vx_TRANSPOSE          EQU   0x0c
  0000000D     00222 TIA_Vx_PITCHRANGE         EQU   0x0d
  0000000E     00223 TIA_Vx_PORTA_RATE         EQU   0x0e
  0000000F     00224 TIA_Vx_VOLUME             EQU   0x0f
  00000010     00225 TIA_Vx_NOTE               EQU   0x10
  00000011     00226 TIA_Vx_NOTE_DELAY         EQU   0x11
  00000012     00227 TIA_Vx_NOTE_DELAY_CTR     EQU   0x12
  00000013     00228 TIA_Vx_ARP_RATE           EQU   0x13
  00000014     00229 TIA_Vx_ARP_NOTE_NUMBER    EQU   0x14
  00000015     00230 TIA_Vx_ARP_CTR            EQU   0x15
  00000016     00231 TIA_Vx_PITCH_MOD          EQU   0x16
  00000017     00232 TIA_Vx_AMP_MOD            EQU   0x17
  00000018     00233 TIA_Vx_SPARE              EQU   0x18
               00234                
  00000019     00235 TIA_Vx_SPARE1             EQU   0x19    ; allocated
  0000001A     00236 TIA_Vx_SPARE2             EQU   0x1a    ; only free of constant time portamento not activated
  0000001B     00237 TIA_Vx_SPARE3             EQU   0x1b    ; only free of constant time portamento not activated
  0000001C     00238 TIA_Vx_SPARE4             EQU   0x1c    ; only free of constant time portamento not activated
  0000001D     00239 TIA_Vx_SPARE5             EQU   0x1d    ; only free of constant time portamento not activated
               00240 
  0000001A     00241 TIA_Vx_PORTA_CTR_L        EQU   TIA_Vx_SPARE2
  0000001B     00242 TIA_Vx_PORTA_CTR_H        EQU   TIA_Vx_SPARE3
  0000001C     00243 TIA_Vx_PORTA_FRQ_L        EQU   TIA_Vx_SPARE4
  0000001D     00244 TIA_Vx_PORTA_FRQ_H        EQU   TIA_Vx_SPARE5
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 23


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00245                                                               
  0000001E     00246 TIA_Vx_ARP_NOTE_0         EQU   0x1e
  0000001F     00247 TIA_Vx_ARP_NOTE_1         EQU   0x1f
  00000020     00248 TIA_Vx_ARP_NOTE_2         EQU   0x20
  00000021     00249 TIA_Vx_ARP_NOTE_3         EQU   0x21
  00000022     00250 TIA_Vx_NOTE_STACK_0       EQU   0x22
  00000023     00251 TIA_Vx_NOTE_STACK_1       EQU   0x23
  00000024     00252 TIA_Vx_NOTE_STACK_2       EQU   0x24
  00000025     00253 TIA_Vx_NOTE_STACK_3       EQU   0x25
  00000004     00254 TIA_NOTE_STACK_LEN        EQU   TIA_Vx_NOTE_STACK_3-TIA_Vx_NOTE_STACK_0+1
               00255 
  00000026     00256 TIA_Vx_ASSIGN_VELOCITY    EQU   0x26
  00000027     00257 TIA_Vx_INIT_VELOCITY      EQU   0x27
  00000028     00258 TIA_Vx_LAST_VELOCITY      EQU   0x28
  00000029     00259 TIA_Vx_DEPTH_VELOCITY     EQU   0x29
               00260 
  0000002A     00261 TIA_Vx_ENV_OPTION         EQU   0x2a
  0000002B     00262 TIA_Vx_OPTION             EQU   0x2b
  0000002C     00263 TIA_Vx_WBANK              EQU   0x2c
  0000002D     00264 TIA_Vx_WT                 EQU   0x2d
  0000002E     00265 TIA_Vx_WT_STATE           EQU   0x2e
  0000002F     00266 TIA_Vx_WT_RATE            EQU   0x2f
  00000030     00267 TIA_Vx_WT_CLK_REQ_CTR     EQU   0x30
  00000031     00268 TIA_Vx_WT_CTR             EQU   0x31
  00000032     00269 TIA_Vx_WT_POS             EQU   0x32
  00000033     00270 TIA_Vx_WT_SAVED_PATCH     EQU   0x33 ;; a eliminer
  00000034     00271 TIA_Vx_WT_ASSIGN_P1       EQU   0x34
  00000035     00272 TIA_Vx_WT_ASSIGN_P2       EQU   0x35
  00000036     00273 TIA_Vx_WT_ASSIGN_P3       EQU   0x36
  00000037     00274 TIA_Vx_KBANK              EQU   0x37
  00000038     00275 TIA_Vx_KIT                EQU   0x38
  00000039     00276 TIA_Vx_KIT_STATE          EQU   0x39
  0000003A     00277 TIA_Vx_KIT_RATE           EQU   0x3a
  0000003B     00278 TIA_Vx_KIT_CLK_REQ_CTR    EQU   0x3b
  0000003C     00279 TIA_Vx_KIT_CTR            EQU   0x3c
  0000003D     00280 TIA_Vx_KIT_POS            EQU   0x3d
               00281 
  0000003E     00282 TIA_Vx_FREE1              EQU   0x3e
  0000003F     00283 TIA_Vx_FREE2              EQU   0x3f
               00284                                                                                
  00000120     00285 TIA_V1_BASE             EQU     0x120 + 0 * TIA_Vx_RECORD_LEN   ; 0x0120-0x15f
  00000160     00286 TIA_V2_BASE             EQU     0x120 + 1 * TIA_Vx_RECORD_LEN   ; 0x0160-0x19f
               00287 
               00288 ;; ==========================================================================
               00289 
  00000007     00290 TIA_LFOx_RECORD_LEN     EQU     7
  00000000     00291 TIA_LFOx_MODE       EQU 0x00
  00000001     00292 TIA_LFOx_RATE       EQU 0x01
  00000002     00293 TIA_LFOx_CTR        EQU 0x02
  00000003     00294 TIA_LFOx_VALUE          EQU     0x03
  00000004     00295 TIA_LFOx_DEPTH          EQU     0x04
  00000005     00296 TIA_LFOx_RVALUE_L   EQU 0x05
  00000006     00297 TIA_LFOx_RVALUE_H   EQU 0x06
               00298 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 24


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  000001A0     00299 TIA_LFO1_BASE           EQU     0x1a0 + 0 * TIA_LFOx_RECORD_LEN ; 0x1a0-0x1a6
  000001A7     00300 TIA_LFO2_BASE           EQU     0x1a0 + 1 * TIA_LFOx_RECORD_LEN ; 0x1a7-0x1ad
  000001AE     00301 TIA_LFO3_BASE           EQU     0x1a0 + 2 * TIA_LFOx_RECORD_LEN ; 0x1ae-0x1b4
  000001B5     00302 TIA_LFO4_BASE           EQU     0x1a0 + 3 * TIA_LFOx_RECORD_LEN ; 0x1b5-0x1bb
               00303 
               00304 ;; ==========================================================================
               00305 
  0000000B     00306 TIA_ENVx_RECORD_LEN     EQU     11
  00000000     00307 TIA_ENVx_MODE       EQU 0x00
  00000001     00308 TIA_ENVx_CTR_L          EQU     0x01
               00309 
  00000002     00310 TIA_ENVx_CTR_H          EQU     0x02
  00000003     00311 TIA_ENVx_ATTACK         EQU     0x03
  00000004     00312 TIA_ENVx_DECAY          EQU     0x04
  00000005     00313 TIA_ENVx_SUSTAIN    EQU 0x05
  00000006     00314 TIA_ENVx_RELEASE    EQU 0x06
  00000007     00315 TIA_ENVx_CURVE          EQU     0x07
  00000008     00316 TIA_ENVx_DEPTH          EQU     0x08
  00000009     00317 TIA_ENVx_RVALUE_L   EQU 0x09
  0000000A     00318 TIA_ENVx_RVALUE_H   EQU 0x0a
               00319 
  000001BC     00320 TIA_ENVAUD0_BASE        EQU     0x1bc + 0 * TIA_ENVx_RECORD_LEN ; 0x1bc-0x1c6
  000001C7     00321 TIA_ENVAUD1_BASE        EQU     0x1bc + 1 * TIA_ENVx_RECORD_LEN ; 0x1c7-0x1d1
  000001D2     00322 TIA_ENV1_BASE           EQU     0x1bc + 2 * TIA_ENVx_RECORD_LEN ; 0x1d2-0x1dc
  000001DD     00323 TIA_ENV2_BASE           EQU     0x1bc + 3 * TIA_ENVx_RECORD_LEN ; 0x1dd-0x1e7
               00324 
               00325 ;; ==========================================================================
               00326 
  00000004     00327 TIA_CTRLx_RECORD_LEN    EQU     4
  00000000     00328 TIA_CTRLx_ASSIGN        EQU     0x00
  00000001     00329 TIA_CTRLx_INIT          EQU     0x01
  00000002     00330 TIA_CTRLx_LAST          EQU     0x02
  00000003     00331 TIA_CTRLx_DEPTH         EQU     0x03
               00332 
  000001E8     00333 TIA_CTRL_AFTERTOUCH_BASE        EQU     0x1e8 + 0 * TIA_CTRLx_RECORD_LEN        ; 0x1e8-0x1eb
  000001EC     00334 TIA_CTRL_MODWHEEL_BASE          EQU     0x1e8 + 1 * TIA_CTRLx_RECORD_LEN        ; 0x1ec-0x1ef
               00335 
               00336 ;; ==========================================================================
               00337 
  000001F0     00338 TIA_MIDI_SYNC           EQU     0x1f0
  000001F1     00339 TIA_MIDI_SYNC_CTR       EQU     0x1f1
  000001F2     00340 TIA_MIDI_SYNC_CTR_REG   EQU     0x1f2
               00341                                                                                
               00342 ;; ==========================================================================
               00343                                                                                
               00344 ; free 0x1f4-0x1f5
               00345 ;; ==========================================================================
               00346 
  000001F6     00347 SAVED_PRODL             EQU     0x1f6   ; used by tia_sw.inc
  000001F7     00348 SAVED_PRODH             EQU     0x1f7   ; used by tia_sw.inc
               00349 
               00350 ;; ==========================================================================
  000001F8     00351 MUL_A_L                 EQU     0x1f8   ; used by math_mul16_16.inc
  000001F9     00352 MUL_A_H                 EQU     0x1f9
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 25


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  000001FA     00353 MUL_B_L                 EQU     0x1fa
  000001FB     00354 MUL_B_H                 EQU     0x1fb
  000001FC     00355 MUL_R_0                 EQU     0x1fc
  000001FD     00356 MUL_R_1                 EQU     0x1fd
  000001FE     00357 MUL_R_2                 EQU     0x1fe
  000001FF     00358 MUL_R_3                 EQU     0x1ff
               00359 
               00360                                                               
  000001F8     00361 DIV_A_0                 EQU     MUL_A_L ; used by math_div16_16.inc
  000001F9     00362 DIV_A_1                 EQU     MUL_A_H
  000001FA     00363 DIV_A_2                 EQU     MUL_B_L
  000001FB     00364 DIV_B_0                 EQU     MUL_B_H
  000001FC     00365 DIV_B_1                 EQU     MUL_R_0
  000001FD     00366 DIV_COUNT               EQU     MUL_R_1
  000001FE     00367 DIV_REM_0               EQU     MUL_R_2
  000001FF     00368 DIV_REM_1               EQU     MUL_R_3
               00369 
               00370 
               00371 ;; ==========================================================================
  00000700     00372 BANKSTICK_FORMAT_BEGIN  EQU     0x700           ; buffer temporary used to format the BankStick
  000007FF     00373 BANKSTICK_FORMAT_END    EQU     0x7ff           ; CS variables have to be initialized again after formatting
               00374 
               00375 
               00376                              
               00377 
               00378 
               00379                              
               00380 ;; ==========================================================================
               00381 
               00382                              
               00383                              
               00384                              ;;free 0x3c8-0x37f
               00035 
               00036 ; ==========================================================================
               00037 
               00038 ;; ---[ configuration table for MIDI processor and rotary encoders ]---
               00039 #include "mios_tables.inc"
               00001 ; $Id: mios_tables.inc 339 2008-05-14 20:26:50Z tk $
               00002 ;
               00003 ; Configuration Tables for MIOS Application
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
3080           00013         org     0x3080          ; never change the origin!
               00014 
               00015 ;; --------------------------------------------------------------------------
               00016 ;; The MIDI Trigger table maps incoming MIDI events to control elements
               00017 ;; (pots/faders, encoders, buttons, LEDs, ...)
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 26


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00018 ;; 
               00019 ;; After the MIOS MIDI processor (MPROC) has received a complete event, it
               00020 ;; searches in this table for a matching entry and calls USER_MPROC_NotifyFoundEvent
               00021 ;; with the table index in WREG and the MIDI event in MIOS_PARAMETER[123]
               00022 ;; 
               00023 ;; Note also that the MIDI processor stops scanning the table after
               00024 ;; the first MT_EOT entry
               00025 ;; 
               00026 ;; Note2: never change the origin (memory location) of this table!
               00027 ;; 
               00028 ;; Optionally this table can also be used to define events, which should be
               00029 ;; transmitted (Example: see example_ain64_din128_dout128), so that incoming
               00030 ;; and outgoing events are located at one place
               00031 ;; 
               00032 ;; The table *must* contain 256 entries. Unused entries should be filled with
               00033 ;; MT_EOT.
               00034 ;; --------------------------------------------------------------------------
               00035 
               00036         ;; MIDI Trigger entry structure
               00037 MT_ENTRY MACRO event_0, event_1
               00038         dw      (event_1 << 8) | event_0
               00039         ENDM
               00040 
               00041 MT_EOT  MACRO
               00042         dw      0xffff
               00043         ENDM
               00044 
               00045 
3080 00046 MIOS_MPROC_EVENT_TABLE
               00047         ;; this "end of table" entry ensures that MIOS will stop searching here
               00048         MT_EOT
3080 FFFF          M         dw      0xffff
               00049 
               00050 
               00051         ;; dirty but allowed so long as MT_EOT can be found at 0x3080:
               00052         ;; since the MIDIbox TIA application doesn't get use of the MPROC_EVENT_TABLE,
               00053         ;; we are using the address range from 0x3082 to 0x327f for other
               00054         ;; application specific tables
               00055 
               00056 #include "tia_frq_table.inc"
               00001 ; $Id: tia_frq_table.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Frequency Table (refer to the TIA spec)
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 27


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00015 ;; In: note index (0x00-0x7f) in WREG
               00016 ;; Out: frq low byte in WREG and MIOS_PARAMETER1, frq high byte in MIOS_PARAMETER2
               00017 ;; --------------------------------------------------------------------------
3082 00018 TIA_FRQ_TABLE_Get
3082 90D8      00019         clrc
3084 34E8      00020         rlf     WREG, W
3086 0FA0      00021         addlw   TIA_FRQ_TABLE & 0xff
3088 6EF6      00022         movwf   TBLPTRL
308A 6AF7      00023         clrf    TBLPTRH
308C 0E30      00024         movlw   TIA_FRQ_TABLE >> 8
308E 22F7      00025         addwfc  TBLPTRH, F
               00026 
3090 0009      00027         tblrd*+
3092 CFF5 F003 00028         movff   TABLAT, MIOS_PARAMETER1
3096 0009      00029         tblrd*+
3098 CFF5 F004 00030         movff   TABLAT, MIOS_PARAMETER2
309C 5003      00031         movf    MIOS_PARAMETER1, W
309E 0012      00032         return
               00033 
               00034 ; ==========================================================================
               00035 
30A0 00036 TIA_FRQ_TABLE
30A0 0028 002B 00037         dw      0x0028,0x002b,0x002d,0x0030,0x0033,0x0036,0x0039,0x003d,0x0040,0x0044,0x0048,0x004c
     002D 0030 
     0033 0036 
     0039 003D 
     0040 0044 
     0048 004C 
30B8 0051 0056 00038         dw      0x0051,0x0056,0x005b,0x0060,0x0066,0x006c,0x0073,0x007a,0x0081
     005B 0060 
     0066 006C 
     0073 007A 
     0081      
               00039 
30CA 0089 0091 00040         dw      0x0089,0x0091,0x0099,0x00a3,0x00ac,0x00b7,0x00c1,0x00cd,0x00d9,0x00e6,0x00f4,0x0102 ; c-2
     0099 00A3 
     00AC 00B7 
     00C1 00CD 
     00D9 00E6 
     00F4 0102 
30E2 0112 0122 00041         dw      0x0112,0x0122,0x0133,0x0146,0x0159,0x016e,0x0183,0x019b,0x01b3,0x01cd,0x01e8,0x0205 ; c-1
     0133 0146 
     0159 016E 
     0183 019B 
     01B3 01CD 
     01E8 0205 
30FA 0224 0245 00042         dw      0x0224,0x0245,0x0267,0x028c,0x02b3,0x02da,0x0307,0x0336,0x0366,0x039a,0x03d1,0x040b ; c-0
     0267 028C 
     02B3 02DA 
     0307 0336 
     0366 039A 
     03D1 040B 
3112 0449 048A 00043         dw      0x0449,0x048a,0x04cf,0x0518,0x0566,0x05b8,0x060f,0x066c,0x06cd,0x0735,0x07a3,0x0817 ; C-1
     04CF 0518 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 28


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     0566 05B8 
     060F 066C 
     06CD 0735 
     07A3 0817 
312A 0892 0915 00044         dw      0x0892,0x0915,0x099f,0x0A31,0x0Acd,0x0B71,0x0C1f,0x0Cd8,0x0D9b,0x0E6a,0x0F46,0x102e ; C-2
     099F 0A31 
     0ACD 0B71 
     0C1F 0CD8 
     0D9B 0E6A 
     0F46 102E 
3142 1125 122A 00045         dw      0x1125,0x122a,0x133e,0x1463,0x159a,0x16e3,0x183f,0x19b0,0x1B37,0x1Cd5,0x1E8c,0x205d ; C-3
     133E 1463 
     159A 16E3 
     183F 19B0 
     1B37 1CD5 
     1E8C 205D 
315A 224A 2454 00046         dw      0x224a,0x2454,0x267d,0x28c7,0x2B34,0x2Dc6,0x307e,0x3361,0x366f,0x39ab,0x3D19,0x40bc ; C-4
     267D 28C7 
     2B34 2DC6 
     307E 3361 
     366F 39AB 
     3D19 40BC 
3172 4495 48A8 00047         dw      0x4495,0x48a8,0x4Cfc,0x518f,0x5668,0x5B8c,0x60fe,0x66c2,0x6Cde,0x7357,0x7A34,0x8177 ; C-5
     4CFC 518F 
     5668 5B8C 
     60FE 66C2 
     6CDE 7357 
     7A34 8177 
318A 892A 9153 00048         dw      0x892a,0x9153,0x99f6,0xA31e,0xACd1,0xB718,0xC1fc,0xCD85,0xD9bc,0xE6af,0xF467        ; C-6
     99F6 A31E 
     ACD1 B718 
     C1FC CD85 
     D9BC E6AF 
     F467      
               00049 
               00057 #include "tia_sin_table.inc"
               00001 ; $Id: tia_sin_table.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Sinus Table
               00005 ; generated with tiatab.pl
               00006 ;
               00007 ; ==========================================================================
               00008 ;
               00009 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00010 ;  Licensed for personal non-commercial use only.
               00011 ;  All other rights reserved.
               00012 ; 
               00013 ; ==========================================================================
               00014 
               00015 ;; --------------------------------------------------------------------------
               00016 ;; In: index (0x00-0xff) in WREG
               00017 ;; Out: Sin value in WREG and MIOS_PARAMETER1
               00018 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 29


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
31A0 00019 TIA_SIN_TABLE_Get
               00020         ;; note: the table has only 128 entries, the upper entries are just
               00021         ;; inverted, so we can save some memory
31A0 6E03      00022         movwf   MIOS_PARAMETER1
31A2 AE03      00023         btfss   MIOS_PARAMETER1, 7
31A4 0A7F      00024         xorlw   0x7f
31A6 0B7F      00025         andlw   0x7f
               00026 
31A8 0FBE      00027         addlw   TIA_SIN_TABLE & 0xff
31AA 6EF6      00028         movwf   TBLPTRL
31AC 6AF7      00029         clrf    TBLPTRH
31AE 0E31      00030         movlw   TIA_SIN_TABLE >> 8
31B0 22F7      00031         addwfc  TBLPTRH, F
               00032 
31B2 0009      00033         tblrd*+
31B4 50F5      00034         movf    TABLAT, W
31B6 BE03      00035         btfsc   MIOS_PARAMETER1, 7
31B8 0980      00036         iorlw 0x80
31BA 6E03      00037         movwf   MIOS_PARAMETER1
31BC 0012      00038         return
               00039 
               00040 ; ==========================================================================
               00041 
31BE 00042 TIA_SIN_TABLE
31BE 0100      00043         db      0x00, 0x01
31C0 0403      00044         db      0x03, 0x04
31C2 0706      00045         db      0x06, 0x07
31C4 0A09      00046         db      0x09, 0x0a
31C6 0E0C      00047         db      0x0c, 0x0e
31C8 110F      00048         db      0x0f, 0x11
31CA 1412      00049         db      0x12, 0x14
31CC 1715      00050         db      0x15, 0x17
31CE 1A18      00051         db      0x18, 0x1a
31D0 1D1C      00052         db      0x1c, 0x1d
31D2 201F      00053         db      0x1f, 0x20
31D4 2322      00054         db      0x22, 0x23
31D6 2625      00055         db      0x25, 0x26
31D8 2928      00056         db      0x28, 0x29
31DA 2C2B      00057         db      0x2b, 0x2c
31DC 2F2E      00058         db      0x2e, 0x2f
31DE 3230      00059         db      0x30, 0x32
31E0 3533      00060         db      0x33, 0x35
31E2 3836      00061         db      0x36, 0x38
31E4 3A39      00062         db      0x39, 0x3a
31E6 3D3C      00063         db      0x3c, 0x3d
31E8 403F      00064         db      0x3f, 0x40
31EA 4341      00065         db      0x41, 0x43
31EC 4544      00066         db      0x44, 0x45
31EE 4847      00067         db      0x47, 0x48
31F0 4A49      00068         db      0x49, 0x4a
31F2 4D4C      00069         db      0x4c, 0x4d
31F4 4F4E      00070         db      0x4e, 0x4f
31F6 5251      00071         db      0x51, 0x52
31F8 5453      00072         db      0x53, 0x54
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 30


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
31FA 5755      00073         db      0x55, 0x57
31FC 5958      00074         db      0x58, 0x59
31FE 5B5A      00075         db      0x5a, 0x5b
3200 5D5C      00076         db      0x5c, 0x5d
3202 5F5E      00077         db      0x5e, 0x5f
3204 6160      00078         db      0x60, 0x61
3206 6362      00079         db      0x62, 0x63
3208 6564      00080         db      0x64, 0x65
320A 6766      00081         db      0x66, 0x67
320C 6968      00082         db      0x68, 0x69
320E 6B6A      00083         db      0x6a, 0x6b
3210 6C6C      00084         db      0x6c, 0x6c
3212 6E6D      00085         db      0x6d, 0x6e
3214 706F      00086         db      0x6f, 0x70
3216 7170      00087         db      0x70, 0x71
3218 7372      00088         db      0x72, 0x73
321A 7473      00089         db      0x73, 0x74
321C 7575      00090         db      0x75, 0x75
321E 7676      00091         db      0x76, 0x76
3220 7777      00092         db      0x77, 0x77
3222 7978      00093         db      0x78, 0x79
3224 7A79      00094         db      0x79, 0x7a
3226 7A7A      00095         db      0x7a, 0x7a
3228 7B7B      00096         db      0x7b, 0x7b
322A 7C7C      00097         db      0x7c, 0x7c
322C 7D7C      00098         db      0x7c, 0x7d
322E 7D7D      00099         db      0x7d, 0x7d
3230 7E7E      00100         db      0x7e, 0x7e
3232 7E7E      00101         db      0x7e, 0x7e
3234 7F7F      00102         db      0x7f, 0x7f
3236 7F7F      00103         db      0x7f, 0x7f
3238 7F7F      00104         db      0x7f, 0x7f
323A 7F7F      00105         db      0x7f, 0x7f
323C 7F7F      00106         db      0x7f, 0x7f
               00058 #include "tia_depth_table.inc"
               00001 ; $Id: tia_depth_table.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Depth Table
               00005 ; derived from MIDIbox TIA V1.5
               00006 ; required since the frequency table has been changed to keep the influence
               00007 ; of the depth parameter compatible with older firmware versions
               00008 ;
               00009 ; ==========================================================================
               00010 ;
               00011 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00012 ;  Licensed for personal non-commercial use only.
               00013 ;  All other rights reserved.
               00014 ; 
               00015 ; ==========================================================================
               00016 
323E 00017 TIA_DEPTH_TABLE
323E 0100 0302 00018         db      0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
     0504 0706 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 31


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3246 0A08 0E0C 00019         db      0x08, 0x0a, 0x0c, 0x0e, 0x11, 0x12, 0x13, 0x14
     1211 1413 
324E 1615 1818 00020         db      0x15, 0x16, 0x18, 0x18, 0x1b, 0x1c, 0x1e, 0x20
     1C1B 201E 
3256 2422 2826 00021         db      0x22, 0x24, 0x26, 0x28, 0x2b, 0x2d, 0x30, 0x33
     2D2B 3330 
325E 3936 403D 00022         db      0x36, 0x39, 0x3d, 0x40, 0x44, 0x48, 0x4d, 0x51
     4844 514D 
3266 5B56 6661 00023         db      0x56, 0x5b, 0x61, 0x66, 0x6c, 0x73, 0x7a, 0x81
     736C 817A 
326E 9189 A399 00024         db      0x89, 0x91, 0x99, 0xa3, 0xac, 0xb7, 0xc2, 0xcd
     B7AC CDC2 
3276 E6D9 FFF4 00025         db      0xd9, 0xe6, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff
     FFFF FFFF 
               00059 
               00060 ; ==========================================================================
               00061 
3280           00062         org     0x3280          ; never change the origin!
               00063 
               00064 ;; --------------------------------------------------------------------------
               00065 ;; In this table DIN pins have to be assigned to rotary encoders for the
               00066 ;; MIOS_ENC driver 
               00067 ;; 
               00068 ;; up to 64 entries are provided
               00069 ;; 
               00070 ;; The table must be terminated with an ENC_EOT entry. Unused entries should
               00071 ;; be filled with ENC_EOT
               00072 ;; 
               00073 ;; ENC_ENTRY provides following parameters
               00074 ;;    o first parameter: number of shift register - 1, 2, 3, ... 16
               00075 ;;    o second parameter: number of pin; since two pins are necessary
               00076 ;;      for each encoder, an even number is expected: 0, 2, 4 or 6
               00077 ;;    o the third parameter contains the encoder mode:
               00078 ;;      either MIOS_ENC_MODE_NON_DETENTED
               00079 ;;          or MIOS_ENC_MODE_DETENTED
               00080 ;;          or MIOS_ENC_MODE_DETENTED2
               00081 ;;
               00082 ;; Configuration Examples:
               00083 ;;    ENC_ENTRY  1,  0,  MIOS_ENC_MODE_NON_DETENTED    ; non-detented encoder at pin 0 and 1 of SR 1
               00084 ;;    ENC_ENTRY  1,  2,  MIOS_ENC_MODE_DETENTED        ; detented encoder at pin 2 and 3 of SR 1
               00085 ;;    ENC_ENTRY  9,  6,  MIOS_ENC_MODE_NON_DETENTED    ; non-detented encoder at pin 6 and 7 of SR 9
               00086 ;; --------------------------------------------------------------------------
               00087 
               00088         ;; encoder entry structure
               00089 ENC_ENTRY MACRO sr, din_0, mode
               00090         dw      (mode << 8) | (din_0 + 8*(sr-1))
               00091         ENDM    
               00092 ENC_EOT MACRO
               00093         dw      0xffff
               00094         ENDM
               00095 
3280 00096 MIOS_ENC_PIN_TABLE
               00097         ;; encoders 1-16
               00098         ENC_EOT
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 32


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3280 FFFF          M         dw      0xffff
               00099         ENC_EOT
3282 FFFF          M         dw      0xffff
               00100         ENC_EOT
3284 FFFF          M         dw      0xffff
               00101         ENC_EOT
3286 FFFF          M         dw      0xffff
               00102         ENC_EOT
3288 FFFF          M         dw      0xffff
               00103         ENC_EOT
328A FFFF          M         dw      0xffff
               00104         ENC_EOT
328C FFFF          M         dw      0xffff
               00105         ENC_EOT
328E FFFF          M         dw      0xffff
               00106         ENC_EOT
3290 FFFF          M         dw      0xffff
               00107         ENC_EOT
3292 FFFF          M         dw      0xffff
               00108         ENC_EOT
3294 FFFF          M         dw      0xffff
               00109         ENC_EOT
3296 FFFF          M         dw      0xffff
               00110         ENC_EOT
3298 FFFF          M         dw      0xffff
               00111         ENC_EOT
329A FFFF          M         dw      0xffff
               00112         ENC_EOT
329C FFFF          M         dw      0xffff
               00113         ENC_EOT
329E FFFF          M         dw      0xffff
               00114 
               00115         ;; encoders 17-32
               00116         ENC_EOT
32A0 FFFF          M         dw      0xffff
               00117         ENC_EOT
32A2 FFFF          M         dw      0xffff
               00118         ENC_EOT
32A4 FFFF          M         dw      0xffff
               00119         ENC_EOT
32A6 FFFF          M         dw      0xffff
               00120         ENC_EOT
32A8 FFFF          M         dw      0xffff
               00121         ENC_EOT
32AA FFFF          M         dw      0xffff
               00122         ENC_EOT
32AC FFFF          M         dw      0xffff
               00123         ENC_EOT
32AE FFFF          M         dw      0xffff
               00124         ENC_EOT
32B0 FFFF          M         dw      0xffff
               00125         ENC_EOT
32B2 FFFF          M         dw      0xffff
               00126         ENC_EOT
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 33


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
32B4 FFFF          M         dw      0xffff
               00127         ENC_EOT
32B6 FFFF          M         dw      0xffff
               00128         ENC_EOT
32B8 FFFF          M         dw      0xffff
               00129         ENC_EOT
32BA FFFF          M         dw      0xffff
               00130         ENC_EOT
32BC FFFF          M         dw      0xffff
               00131         ENC_EOT
32BE FFFF          M         dw      0xffff
               00132 
               00133         ;; encoders 33-48
               00134         ENC_EOT
32C0 FFFF          M         dw      0xffff
               00135         ENC_EOT
32C2 FFFF          M         dw      0xffff
               00136         ENC_EOT
32C4 FFFF          M         dw      0xffff
               00137         ENC_EOT
32C6 FFFF          M         dw      0xffff
               00138         ENC_EOT
32C8 FFFF          M         dw      0xffff
               00139         ENC_EOT
32CA FFFF          M         dw      0xffff
               00140         ENC_EOT
32CC FFFF          M         dw      0xffff
               00141         ENC_EOT
32CE FFFF          M         dw      0xffff
               00142         ENC_EOT
32D0 FFFF          M         dw      0xffff
               00143         ENC_EOT
32D2 FFFF          M         dw      0xffff
               00144         ENC_EOT
32D4 FFFF          M         dw      0xffff
               00145         ENC_EOT
32D6 FFFF          M         dw      0xffff
               00146         ENC_EOT
32D8 FFFF          M         dw      0xffff
               00147         ENC_EOT
32DA FFFF          M         dw      0xffff
               00148         ENC_EOT
32DC FFFF          M         dw      0xffff
               00149         ENC_EOT
32DE FFFF          M         dw      0xffff
               00150 
               00151         ;; encoders 49-64
               00152         ENC_EOT
32E0 FFFF          M         dw      0xffff
               00153         ENC_EOT
32E2 FFFF          M         dw      0xffff
               00154         ENC_EOT
32E4 FFFF          M         dw      0xffff
               00155         ENC_EOT
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 34


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
32E6 FFFF          M         dw      0xffff
               00156         ENC_EOT
32E8 FFFF          M         dw      0xffff
               00157         ENC_EOT
32EA FFFF          M         dw      0xffff
               00158         ENC_EOT
32EC FFFF          M         dw      0xffff
               00159         ENC_EOT
32EE FFFF          M         dw      0xffff
               00160         ENC_EOT
32F0 FFFF          M         dw      0xffff
               00161         ENC_EOT
32F2 FFFF          M         dw      0xffff
               00162         ENC_EOT
32F4 FFFF          M         dw      0xffff
               00163         ENC_EOT
32F6 FFFF          M         dw      0xffff
               00164         ENC_EOT
32F8 FFFF          M         dw      0xffff
               00165         ENC_EOT
32FA FFFF          M         dw      0xffff
               00166         ENC_EOT
32FC FFFF          M         dw      0xffff
               00167         ENC_EOT
32FE FFFF          M         dw      0xffff
               00168 
               00169 
3300           00170         org     0x3300          ; never change the origin!
               00040 
               00041 ;; ---[ Custom LCD driver ]---
               00042 #include "app_lcd.inc"
               00001 ; $Id: app_lcd.inc 69 2008-02-01 00:20:18Z tk $
               00002 ;
               00003 ; MIOS Custom LCD Driver Skeleton
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 ;; --------------------------------------------------------------------------
               00014 ;;  Following system variables are given by MIOS and can be directly 
               00015 ;;  accessed by the driver. The addresses are defined in mios.h and
               00016 ;;  should not be changed
               00017 ;; 
               00018 ;;  MIOS_GLCD_BUFFER         a 8 byte buffer for data transfers
               00019 ;;  MIOS_LCD_OPTION1         contains the first LCD option given by MIOS_LCD_TypeSet
               00020 ;;  MIOS_LCD_OPTION2         contains the second LCD option given by MIOS_LCD_TypeSet
               00021 ;;  MIOS_LCD_CURSOR_POS      the current cursor pos of characters (GLCD: multiplied by width)
               00022 ;;  MIOS_GLCD_GCURSOR_X      for GLCDs: the current X position of graphical cursor
               00023 ;;  MIOS_GLCD_GCURSOR_Y      for GLCDs: the current Y position of graphical cursor
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 35


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00024 ;;  MIOS_GLCD_FONT_WIDTH     for GLCDs: the fontwidth given by MIOS_GLCD_FontInit
               00025 ;;  MIOS_GLCD_FONT_HEIGHT    for GLCDs: the fontheight given by MIOS_GLCD_FontInit
               00026 ;;  MIOS_GLCD_FONT_X0        for GLCDs: the first byte within a char entry
               00027 ;;  MIOS_GLCD_FONT_OFFSET    for GLCDs: the byte offset between the characters
               00028 ;;  MIOS_GLCD_FONT_PTRL      for GLCDs: pointer to the character table, low-byte
               00029 ;;  MIOS_GLCD_FONT_PTRH      for GLCDs: pointer to the character table, high-byte
               00030 ;;  MIOS_LCD_TIMEOUT0        can be used for timeout loops
               00031 ;;  MIOS_LCD_TIMEOUT1        can be used for timeout loops
               00032 ;;  MIOS_GLCD_TMP1           can be used as temporary buffer
               00033 ;;  MIOS_GLCD_TMP2           can be used as temporary buffer
               00034 ;;  MIOS_GLCD_TMP3           can be used as temporary buffer
               00035 ;;  MIOS_GLCD_TMP4           can be used as temporary buffer
               00036 ;;  MIOS_LCD_Y0_OFFSET       Y0 offset of LCD
               00037 ;;  MIOS_LCD_Y1_OFFSET       Y1 offset of LCD
               00038 ;;  MIOS_LCD_Y2_OFFSET       Y2 offset of LCD
               00039 ;;  MIOS_LCD_Y3_OFFSET       Y3 offset of LCD
               00040 ;;  MIOS_LCD_CURSOR_POS_REAL unmapped cursor position which has been set with MIOS_LCD_CursorSet
               00041 ;; 
               00042 ;;  Note: the addresses are located in an upper bank and therefore have to
               00043 ;;        be accessed with the BANKED flag. Also the BSR has to be justified
               00044 ;;        before using the registers
               00045 ;;  Example:
               00046 ;;      SET_BSR MIOS_LCD_OPTION1        ; sets BSR to the bank where MIOS_LCD_*
               00047 ;;                                      ; has been located. You don't need to
               00048 ;;                                      ; change the BSR for the other LCD registers
               00049 ;;      movf    MIOS_LCD_OPTION1, W, BANKED     ; get LCD option #1
               00050 ;; 
               00051 ;;  Important: to allow a proper interaction with MIOS applications, you are
               00052 ;;  only allowed to modify MIOS_PARAMETER[123], the mutliplication registers
               00053 ;;  and FSR1. You are not allowed to change TMP[1-5] or FSR0
               00054 ;;  if you need some temporary registers, use the given addresses above or
               00055 ;;  locate them to addresses which are not used by the application
               00056 ;; --------------------------------------------------------------------------
               00057         
               00058 ;; --------------------------------------------------------------------------
               00059 ;;  This function is called by MIOS when the custom LCD should be initialized
               00060 ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
               00061 ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
               00062 ;;  Out: -
               00063 ;; --------------------------------------------------------------------------
3300 00064 USER_LCD_Init
3300 0012      00065         return
               00066 
               00067 ;; --------------------------------------------------------------------------
               00068 ;;  This function is called by MIOS when the custom LCD should be cleared
               00069 ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
               00070 ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
               00071 ;;  Out: -
               00072 ;; --------------------------------------------------------------------------
3302 00073 USER_LCD_Clear
3302 0012      00074         return
               00075 
               00076 ;; --------------------------------------------------------------------------
               00077 ;;  This function is called by MIOS when the cursor should be changed
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 36


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00078 ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
               00079 ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
               00080 ;;       MIOS_GLCD_CURSOR_X - horizontal cursor position (for GLCDs)
               00081 ;;       MIOS_GLCD_CURSOR_X - vertical cursor position   (for GLCDs)
               00082 ;;       MIOS_LCD_CURSOR    - character cursor position  (for CLCDs)
               00083 ;;  Out: -
               00084 ;; --------------------------------------------------------------------------
3304 00085 USER_LCD_CursorSet
3304 0012      00086         return
               00087 
               00088 ;; --------------------------------------------------------------------------
               00089 ;;  This function is called by MIOS when a character should be print
               00090 ;;  In:  WREG - character
               00091 ;;       all other MIOS_*LCD_* registers
               00092 ;;  Out: GLCDs should justify the X/Y cursor position
               00093 ;; --------------------------------------------------------------------------
3306 00094 USER_LCD_PrintChar
3306 0012      00095         return
               00096 
               00097 ;; --------------------------------------------------------------------------
               00098 ;;  FUNCTION: USER_LCD_Data
               00099 ;;  DESCRIPTION: sends a data value to the LCD display.<BR>
               00100 ;;  On CLCDs: branch directly to USER_LCD_PrintChar<BR>
               00101 ;;  On GLCDs: ignore this function!
               00102 ;;  IN:  data which should be sent
               00103 ;;  OUT: -
               00104 ;;  NOTE: see the custom_lcd_example for further details
               00105 ;; --------------------------------------------------------------------------
3308 00106 USER_LCD_Data
3308 0012      00107         return
               00108 
               00109 ;; --------------------------------------------------------------------------
               00110 ;;  FUNCTION: USER_LCD_Cmd
               00111 ;;  DESCRIPTION: sends a command to the LCD display.<BR>
               00112 ;;  On CLCDs: use this function to decode the HD44780 commands if required<BR>
               00113 ;;  On GLCDs: ignore this function!
               00114 ;;  IN:  command which should be sent
               00115 ;;  OUT: -
               00116 ;;  NOTE: see the custom_lcd_example for further details
               00117 ;; --------------------------------------------------------------------------
330A 00118 USER_LCD_Cmd
330A 0012      00119         return
               00120 
               00121 ;; --------------------------------------------------------------------------
               00122 ;;  FUNCTION: USER_LCD_SpecialCharInit
               00123 ;;  DESCRIPTION: see MIOS_CLCD_SpecialCharInit
               00124 ;;  IN:  number of special character (0-7) in WREG
               00125 ;;       pointer to special char pattern in TBLPTR (consists of 8
               00126 ;;          entries for every character-line)
               00127 ;;  OUT: TBLPTR has to be set to next table entry (TBLPTR+=8)
               00128 ;;  NOTE: see the custom_lcd_example for further details
               00129 ;; --------------------------------------------------------------------------
330C 00130 USER_LCD_SpecialCharInit
330C 0012      00131         return
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 37


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00043 
               00044 ;; ==========================================================================
               00045 ;;  All MIOS hooks in one file
               00046 ;; ==========================================================================
               00047 
               00048 ;; --------------------------------------------------------------------------
               00049 ;;  This function is called by MIOS after startup to initialize the 
               00050 ;;  application
               00051 ;; --------------------------------------------------------------------------
330E 00052 USER_Init
               00053         ;; initialize application specific variables
330E 6A10      00054         clrf    TIA_STAT
3310 6A21      00055         clrf    TIA_SYSEX_STATE
3312 6A22      00056         clrf    TIA_SYSEX_ACTION
3314 6819      00057         setf    TIA_BANKSTICK_CHK_CTR   ; (we have to start with BS0 in TIA_BANK_CheckStick)
               00058 
               00059         ;; initialize the timer for the TIA_SW handler
3316 0EFE      00060         movlw   8190 & 0xff             ; every 819 us (in order to be timing accurate with the PIC16F version!)
3318 6E03      00061         movwf   MIOS_PARAMETER1
331A 0E1F      00062         movlw   8190 >> 8
331C 6E04      00063         movwf   MIOS_PARAMETER2
331E 0E00      00064         movlw   0x00                    ; prescaler 1:1
3320 ECBC F016 00065         call    MIOS_TIMER_Init
               00066 
               00067         ;; initialize the MBHP_TIA module
3324 ECE6 F021 00068         call    TIA_SR_Init
               00069   
               00070 
               00071         ;; init patch
3328 6A13      00072         clrf    TIA_PATCH
332A 6A14      00073         clrf    TIA_PBANK
332C ECAD F01D 00074         call    TIA_PATCH_Init
               00075     
               00076 
               00077         ;; initialize the shift registers
3330 0E01      00078         movlw   0x01                    ; use only first register (maximum would be 16!)
3332 EC78 F016 00079         call    MIOS_SRIO_NumberSet
3336 0E01      00080         movlw   0x01                    ; set update frequncy
3338 EC80 F016 00081         call    MIOS_SRIO_UpdateFrqSet
333C 0E00      00082         movlw   0x00                    ; disable touch sensor
333E EC7C F016 00083         call    MIOS_SRIO_TS_SensitivitySet
               00084     
               00085 #if TIA_LEDMTR_ENABLE
3342 EC39 F01D 00086     call   TIA_LEDMTR_Init
               00087 #endif     
               00088 
               00089         ;; initialize J5 for driving LEDs if enabled
               00090 #if ENABLE_J5
               00091         movlw   0x00
               00092         call    J5_IO_Init
               00093 #endif
               00094 
               00095 #if MIDI_RXTX_USE_IO 
3346 ECFC F019 00096     call    MIDI_RXTX_IO_Init
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 38


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00097 #endif
               00098 
               00099 #if ENABLE_AIN_LFO_WAVEFORM
               00100         movlw   0x06                    ; enable the first 6 analog inputs
               00101         call    MIOS_AIN_NumberSet
               00102         call    MIOS_AIN_UnMuxed        ; not multiplexed
               00103         movlw   0x03                    ; 8 bit resolution
               00104 #endif
               00105 
               00106         ;; initialize the AOUT module
               00107         ;call   AOUT_Init
               00108 
               00109         ;; initialize the integrated MIDI merger
334A 0E00      00110         movlw   MIOS_MIDI_MERGER_DISABLED       ; should be disabled for a synthesizer
334C EC14 F016 00111         call    MIOS_MIDI_MergerSet
               00112 
3350 0012      00113         return
               00114 
               00115 
               00116 
               00117 ;; --------------------------------------------------------------------------
               00118 ;;  This function is called by MIOS in the mainloop when nothing else is to do
               00119 ;; --------------------------------------------------------------------------
3352 00120 USER_Tick
               00121 
               00122 #if DEFAULT_TIA_DEBUG_ON
               00123         ;; ---[ call TIA debug handler ]---
3352 ECBF F01A 00124     call    TIA_Debug_Handler
               00125 #endif
               00126 
               00127         ;; ---[ check BankStick status ]---
3356 ECFB F01E 00128         call    TIA_BANK_CheckStick
               00129 
               00130         ;; ---[ update AOUTs channels (if enabled) ]---
               00131 ;       IRQ_DISABLE
               00132 ;       call    AOUT_Update
               00133 ;       IRQ_ENABLE
               00134 
               00135         ;; ---[ call TIA shift register handler ]---
335A ECEA F021 00136         call    TIA_SR_Handler
               00137 
               00138         ;; ---[ handle with CC dump reuqests ]---
335E EC68 F02F 00139         call    TIA_CCOUT_Handler
               00140     
               00141 
               00142 
3362 0012      00143         return
               00144 
               00145 
               00146 ;; --------------------------------------------------------------------------
               00147 ;;  This function is periodically called by MIOS. The frequency has to be
               00148 ;;  initialized with MIOS_Timer_Set
               00149 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00150 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 39


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00151 ;; --------------------------------------------------------------------------
3364 00152 USER_Timer
               00153 
               00154         ;; ---[ call Software TIA Handler ]---
3364 EC71 F022 00155         call    TIA_SW_Handler
               00156 
3368 0012      00157         return
               00158 
               00159 ;; --------------------------------------------------------------------------
               00160 ;;  This function is called by MIOS when a debug command has been received
               00161 ;;  via SysEx
               00162 ;;  Input:
               00163 ;;     o WREG, MIOS_PARAMETER1, MIOS_PARAMETER2, MIOS_PARAMETER3 like
               00164 ;;       specified in the debug command
               00165 ;;  Output:
               00166 ;;     o return values WREG, MIOS_PARAMETER1, MIOS_PARAMETER2, MIOS_PARAMETER3
               00167 ;; --------------------------------------------------------------------------
336A 00168 USER_MPROC_DebugTrigger
336A 0012      00169         return
               00170 
               00171 
               00172 ;; --------------------------------------------------------------------------
               00173 ;;  This function is called by MIOS when the display content should be 
               00174 ;;  initialized. Thats the case during startup and after a temporary message
               00175 ;;  has been printed on the screen
               00176 ;; --------------------------------------------------------------------------
336C 00177 USER_DISPLAY_Init
336C 0012      00178     return
               00179 
               00180 ;; --------------------------------------------------------------------------
               00181 ;;  This function is called in the mainloop when no temporary message is shown
               00182 ;;  on screen. Print the realtime messages here
               00183 ;; --------------------------------------------------------------------------
336E 00184 USER_DISPLAY_Tick
               00185         ;; call MIDI RxTx handler and exit
336E EC10 F01A 00186         call    MIDI_RXTX_Handler
               00187 
               00188 #if TIA_LEDMTR_ENABLE
3372 EC3C F01D 00189     call    TIA_LEDMTR_Handler
               00190 #endif     
               00191 
               00192 
               00193 
3376 0012      00194         return
               00195 
               00196 ;; --------------------------------------------------------------------------
               00197 ;;  This function is called by MIOS when a complete MIDI event has been received
               00198 ;;  Input:
               00199 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00200 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00201 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00202 ;; --------------------------------------------------------------------------
3378 00203 USER_MPROC_NotifyReceivedEvent
               00204         ;; branch to ReceiveEvent function of TIA synth
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 40


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00205 
3378 EF4A F028 00206         goto    TIA_MIDI_NotifyReceivedEvent
               00207     
337C 0012      00208         return
               00209 
               00210 ;; --------------------------------------------------------------------------
               00211 ;;  This function is called by MIOS when a MIDI event has been received
               00212 ;;  which has been specified in the CONFIG_MIDI_IN table
               00213 ;;  Input:
               00214 ;;     o number of entry in WREG
               00215 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00216 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00217 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00218 ;; --------------------------------------------------------------------------
337E 00219 USER_MPROC_NotifyFoundEvent
               00220 
337E 0012      00221         return
               00222 
               00223 
               00224 ;; --------------------------------------------------------------------------
               00225 ;;  This function is called by MIOS when a MIDI event has not been completly
               00226 ;;  received within 2 seconds
               00227 ;; --------------------------------------------------------------------------
3380 00228 USER_MPROC_NotifyTimeout
               00229         ;; -> jump to "ActionInvalid" for a proper reset of the sysex parser
3380 EF52 F02A 00230         goto    TIA_SYSEX_ActionInvalid
3384 0012      00231         return
               00232     
               00233 ;; --------------------------------------------------------------------------
               00234 ;;  This function is called by MIOS when a MIDI byte has been received
               00235 ;;  Input:
               00236 ;;     o received MIDI byte in WREG and MIOS_PARAMETER1
               00237 ;; --------------------------------------------------------------------------
3386 00238 USER_MPROC_NotifyReceivedByte
               00239         ;; -> continue at TIA_MPROC_SysExCheck
3386 EF32 F02A 00240         goto    TIA_SYSEX_SysExCheck
338A 0012      00241         return
               00242         
               00243 ;; --------------------------------------------------------------------------
               00244 ;;  This function is called by MIOS before the transfer of a MIDI byte. 
               00245 ;;  It can be used to monitor the Tx activity or to do any other actions
               00246 ;;  (e.g. to switch a pin for multiplexed MIDI Outs) before the byte will 
               00247 ;;  be sent.
               00248 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00249 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
               00250 ;;  Input:
               00251 ;;     o transmitted byte in WREG
               00252 ;; --------------------------------------------------------------------------
338C 00253 USER_MIDI_NotifyTx
               00254         ;; notify Tx event to MIDI_RXTX handler
338C EF0C F01A 00255         goto    MIDI_RXTX_NotifyTx
3390 0012      00256         return
               00257     
               00258 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 41


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00259 ;;  This function is called by MIOS when a MIDI byte has been received.
               00260 ;;  It can be used to monitor the Rx activity or to do any action - e.g.
               00261 ;;  to react on realtime events like MIDI clock (0xf8) with a minimum latency
               00262 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00263 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
               00264 ;;  Input:
               00265 ;;     o received byte in WREG
               00266 ;; --------------------------------------------------------------------------
3392 00267 USER_MIDI_NotifyRx
               00268         ;; temporary save received byte in IRQ_TMP1
3392 6E0B      00269         movwf   IRQ_TMP1
               00270 
               00271         ;; if MIDI clock: notify clock
3394 EE21 F0F0 00272         lfsr    FSR2, TIA_MIDI_SYNC
3398 0AF8      00273         xorlw   0xf8
339A E103      00274         bnz USER_MIDI_NotifyRx_NoF8
339C 88DF      00275         bsf     INDF2, TIA_MIDI_SYNC_F8
339E EFFF F019 00276     goto        MIDI_RXTX_NotifyRx_BeatClk
33A2 00277 USER_MIDI_NotifyRx_NoF8
               00278         ;; if MIDI start: notify start
33A2 500B      00279         movf    IRQ_TMP1, W
33A4 0AFA      00280         xorlw   0xfa
33A6 E102      00281     bnz USER_MIDI_NotifyRx_NoFA
33A8 8ADF      00282         bsf     INDF2, TIA_MIDI_SYNC_FA
33AA 6B69      00283     clrf    MIDI_RXTX_BEAT_CTR
33AC 00284 USER_MIDI_NotifyRx_NoFA
               00285     
               00286         ;; notify Rx event to MIDI_RXTX handler
33AC EF08 F01A 00287         goto    MIDI_RXTX_NotifyRx
               00288 
               00289     
33B0 0012      00290         return
               00291     
               00292 ;; --------------------------------------------------------------------------
               00293 ;;  This function is called by MIOS when an button has been toggled
               00294 ;;  Input:
               00295 ;;     o Button number in WREG and MIOS_PARAMETER1
               00296 ;;     o Button value MIOS_PARAMETER2:
               00297 ;;       - 1 if button has been released (=5V)
               00298 ;;       - 0 if button has been pressed (=0V)
               00299 ;; --------------------------------------------------------------------------
33B2 00300 USER_DIN_NotifyToggle
33B2 0012      00301         return
               00302 
               00303 
               00304 ;; --------------------------------------------------------------------------
               00305 ;;  This function is called by MIOS when an encoder has been moved
               00306 ;;  Input:
               00307 ;;     o Encoder number in WREG and MIOS_PARAMETER1
               00308 ;;     o signed incrementer value in MIOS_PARAMETER2:
               00309 ;;       - is positive when encoder has been turned clockwise
               00310 ;;       - is negative when encoder has been turned counter clockwise
               00311 ;; --------------------------------------------------------------------------
33B4 00312 USER_ENC_NotifyChange
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 42


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
33B4 0012      00313         return
               00314 
               00315 
               00316 ;; --------------------------------------------------------------------------
               00317 ;;  This function is called by MIOS before the shift register are loaded
               00318 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00319 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible
               00320 ;; --------------------------------------------------------------------------
33B6 00321 USER_SR_Service_Prepare
33B6 0012      00322         return
               00323     
               00324 ;; --------------------------------------------------------------------------
               00325 ;;  This function is called by MIOS after the shift register have been loaded
               00326 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00327 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible
               00328 ;; --------------------------------------------------------------------------
33B8 00329 USER_SR_Service_Finish
33B8 0012      00330         return
               00331 
               00332 ;; --------------------------------------------------------------------------
               00333 ;;  This function is called by MIOS when a pot has been moved
               00334 ;;  Input:
               00335 ;;     o Pot number in WREG and MIOS_PARAMETER1
               00336 ;;     o LSB value in MIOS_PARAMETER2
               00337 ;;     o MSB value in MIOS_PARAMETER3
               00338 ;; --------------------------------------------------------------------------
33BA 00339 USER_AIN_NotifyChange
33BA 0012      00340         return
               00341 
               00342 
               00343 ;; ==========================================================================
               00344 ;;  Application code (see comments in files)
               00345 ;; ==========================================================================
               00346 
               00347 ;; ---[ modules from code library ]---
               00348 ; override default pin definitions of AOUT driver
               00349 ;#define AOUT_LAT_CS    LATC    ; The chip select pin CS#
               00350 ;#define AOUT_TRIS_CS   TRISC   ; is connected to Port C.3 
               00351 ;#define AOUT_PIN_CS    3       ; (CANNOT be shared with other outputs!)
               00352 ;
               00353 ;#define AOUT_LAT_DIN   LATC    ; The data input pin DIN
               00354 ;#define AOUT_TRIS_DIN  TRISC   ; is connected to Port C.1
               00355 ;#define AOUT_PIN_DIN   1       ; (can be shared with other outputs)
               00356 ;;
               00357 ;#define AOUT_LAT_SCLK  LATC    ; The shift clock input pin SCLK
               00358 ;#define AOUT_TRIS_SCLK TRISC   ; is connected to Port C.0
               00359 ;#define AOUT_PIN_SCLK  0       ; (can be shared with other outputs)
               00360 ; include AOUT driver (located in $MIOS_PATH/modules/aout/)
               00361 ;#include <aout.inc>
               00362 
               00363 ;#define J5_IO_DONT_USE_INPUT_FUNCTIONS 1
               00364 ;#include <j5_io.inc>
               00365 
               00366 ;; ---[ reusable functions ]---
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 43


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00367 #include "math_mul16_16.inc"
               00001 ; $Id: math_mul16_16.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;; Multiply 16x16 bit routine from the PIC18F452 datasheet, Chapter 7.2 "8 X 8 HARDWARE MULTIPLIER, Operation"
               00003 
               00004 ;; MUL_R_3:MUL_R_0 = MUL_A_H:MUL_A_L * MUL_B_H:MUL_B_L
               00005 ;;           = (MUL_A_H * MUL_B_H * 2^16) +
               00006 ;;             (MUL_A_H * MUL_B_L * 2^8) +
               00007 ;;             (MUL_A_L * MUL_B_H * 2^8) +
               00008 ;;             (MUL_A_L * MUL_B_L)
               00009 
33BC 00010 MATH_MUL16_16
               00011         SET_BSR MUL_R_0
33BC 0101          M         movlb   HIGH(reg)
               00012         
33BE 51F8      00013         movf    MUL_A_L, W
33C0 03FA      00014         mulwf   MUL_B_L         ; MUL_A_L * MUL_B_L -> PRODH:PRODL
33C2 CFF4 F1FD 00015         movff   PRODH, MUL_R_1
33C6 CFF3 F1FC 00016         movff   PRODL, MUL_R_0
               00017         
33CA 51F9      00018         movf    MUL_A_H, W
33CC 03FB      00019         mulwf   MUL_B_H         ; MUL_A_H * MUL_B_H -> PRODH:PRODL
33CE CFF4 F1FF 00020         movff   PRODH, MUL_R_3
33D2 CFF3 F1FE 00021         movff   PRODL, MUL_R_2
               00022 
33D6 51F8      00023         movf    MUL_A_L, W
33D8 03FB      00024         mulwf   MUL_B_H         ; MUL_A_L * MUL_B_H -> PRODH:PRODL
33DA 50F3      00025         movf    PRODL, W
33DC 27FD      00026         addwf   MUL_R_1, F      ; Add cross
33DE 50F4      00027         movf    PRODH, W        ; products
33E0 23FE      00028         addwfc  MUL_R_2, F
33E2 6AE8      00029         clrf    WREG
33E4 23FF      00030         addwfc  MUL_R_3, F
               00031 
33E6 51F9      00032         movf    MUL_A_H, W
33E8 03FA      00033         mulwf   MUL_B_L         ; MUL_A_H * MUL_B_L -> PRODH:PRODL
33EA 50F3      00034         movf    PRODL, W
33EC 27FD      00035         addwf   MUL_R_1, F      ; Add cross
33EE 50F4      00036         movf    PRODH, W        ; products
33F0 23FE      00037         addwfc  MUL_R_2, F
33F2 6AE8      00038         clrf    WREG
33F4 23FF      00039         addwfc  MUL_R_3, F
               00040 
33F6 0012      00041         return
               00368 #include "midi_rxtx.inc"
               00001 ; $Id: midi_rxtx.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; This file includes helpful functions to monitor the MIDI Rx/Tx activity
               00004 ;
               00005 ;    o MIDI_RXTX_NotifyRx:    to be called when a MIDI byte has been received
               00006 ;    o MIDI_RXTX_NotifyTx:    to be called when a MIDI byte has been sent
               00007 ;    o MIDI_RXTX_Handler:     to be called from USER_SR_Service_Prepare
               00008 ;
               00009 ; See the function headers for further details
               00010 ;
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 44


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00011 ; Settings which can be modified:
               00012 ;
               00013 ; Number of update cycles (* 1mS) the LEDs will stay active on a Rx/Tx event
33F8 00014 #define MIDI_RXTX_LED_DELAY 15
               00015 ; DOUT pin number of Rx LED
33F8 00016 #define MIDI_RXTX_RX_LED    DEFAULT_MIDI_RX_LED
               00017 ; DOUT pin number of Tx LED
33F8 00018 #define MIDI_RXTX_TX_LED    DEFAULT_MIDI_TX_LED
               00019 ;
               00020 ; Following registers have to be located to free addresses in app_defines.h:
               00021 ;
               00022 ;MIDI_RXTX_RX_CTR       EQU     0x019
               00023 ;MIDI_RXTX_TX_CTR       EQU     0x01a
               00024 ;
               00025 ; ==========================================================================
               00026 ;
               00027 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00028 ;  Licensed for personal non-commercial use only.
               00029 ;  All other rights reserved.
               00030 ; 
               00031 ; ==========================================================================
               00032 
               00033 ;; --------------------------------------------------------------------------
               00034 ;;  FUNCTION: MIDI_RXTX_IO_Init
               00035 ;;  DESCRIPTION: this function has to be called from the USER_Init
               00036 ;;  only if Leds are assigned to IO pins
               00037 ;; --------------------------------------------------------------------------
33F8 00038 MIDI_RXTX_IO_Init
33F8 9C95      00039     bcf     DEFAULT_MIDI_RX_TRIS, DEFAULT_MIDI_RX_PIN
33FA 9E95      00040     bcf     DEFAULT_MIDI_TX_TRIS, DEFAULT_MIDI_TX_PIN
33FC 0012      00041         return
               00042 
               00043 ;; --------------------------------------------------------------------------
               00044 ;;  FUNCTION: MIDI_RXTX_IO_Init
               00045 ;;  DESCRIPTION: this function has to be called from the USER_Init
               00046 ;;  only if Leds are assigned to IO pins
               00047 ;; --------------------------------------------------------------------------
33FE 00048 MIDI_RXTX_NotifyRx_BeatClk
33FE 2B69      00049     incf    MIDI_RXTX_BEAT_CTR, F
3400 0E17      00050     movlw   0x17
3402 6569      00051     cpfsgt  MIDI_RXTX_BEAT_CTR, BANKED
               00052     rgoto   MIDI_RXTX_NotifyRx_BeatClk_End
3404 D004          M         bra     label
3406 6B69      00053     clrf    MIDI_RXTX_BEAT_CTR
3408 0E0F      00054         movlw   MIDI_RXTX_LED_DELAY
               00055         SET_BSR MIDI_RXTX_RX_CTR
340A 0100          M         movlb   HIGH(reg)
340C 6F67      00056         movwf   MIDI_RXTX_RX_CTR, BANKED    
340E 00057 MIDI_RXTX_NotifyRx_BeatClk_End
340E 0012      00058         return
               00059     
               00060 ;; --------------------------------------------------------------------------
               00061 ;;  FUNCTION: MIDI_RXTX_NotifyRx
               00062 ;;  DESCRIPTION: this function has to be called from the USER_MIDI_NotifyRx
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 45


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00063 ;;  hook when a MIDI event has been received to reload the RX counter
               00064 ;; --------------------------------------------------------------------------
3410 00065 MIDI_RXTX_NotifyRx
3410 0E0F      00066         movlw   MIDI_RXTX_LED_DELAY
               00067         SET_BSR MIDI_RXTX_RX_CTR
3412 0100          M         movlb   HIGH(reg)
3414 6F67      00068         movwf   MIDI_RXTX_RX_CTR, BANKED
3416 0012      00069         return
               00070 
               00071 ;; --------------------------------------------------------------------------
               00072 ;;  FUNCTION: MIDI_RXTX_NotifyTx
               00073 ;;  DESCRIPTION: this function has to be called from the USER_MIDI_NotifyTx
               00074 ;;  hook when a MIDI event will be transmitted to reload the TX counter
               00075 ;; --------------------------------------------------------------------------
3418 00076 MIDI_RXTX_NotifyTx
3418 0E0F      00077         movlw   MIDI_RXTX_LED_DELAY
               00078         SET_BSR MIDI_RXTX_TX_CTR
341A 0100          M         movlb   HIGH(reg)
341C 6F68      00079         movwf   MIDI_RXTX_TX_CTR, BANKED
341E 0012      00080         return
               00081 
               00082 ;; --------------------------------------------------------------------------
               00083 ;;  FUNCTION: MIDI_RXTX_Handler
               00084 ;;  DESCRIPTION: this function has to be called from the USER_SR_ServicePrpeare
               00085 ;;  hook, it decrements the Rx/Tx counters and sets the LEDs depending on the
               00086 ;;  counter values
               00087 ;; --------------------------------------------------------------------------
3420 00088 MIDI_RXTX_Handler
               00089 #if DEFAULT_MIDI_MONITOR_ENABLED == 1
               00090         ;; Decrement Rx counter if != 0
               00091         SET_BSR MIDI_RXTX_RX_CTR
3420 0100          M         movlb   HIGH(reg)
3422 5167      00092         movf    MIDI_RXTX_RX_CTR, W, BANKED
3424 A4D8      00093         skpz
3426 0767      00094         decf    MIDI_RXTX_RX_CTR, F, BANKED
               00095 
               00096         ;; Decrement Tx counter if != 0
               00097         SET_BSR MIDI_RXTX_TX_CTR
3428 0100          M         movlb   HIGH(reg)
342A 5168      00098         movf    MIDI_RXTX_TX_CTR, W, BANKED
342C A4D8      00099         skpz
342E 0768      00100         decf    MIDI_RXTX_TX_CTR, F, BANKED
               00101 
               00102 
               00103         ;; 
               00104         ;; remove the code below if you don't want to use LEDs to
               00105         ;; indicate the counter state
               00106         ;; 
               00107 
               00108         ;; set the Rx LED depending on counter state
               00109         SET_BSR MIDI_RXTX_RX_CTR
3430 0100          M         movlb   HIGH(reg)
3432 5167      00110         movf    MIDI_RXTX_RX_CTR, W, BANKED
3434 A4D8      00111         skpz
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 46


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3436 0E01      00112         movlw   0x01
3438 6E03      00113         movwf   MIOS_PARAMETER1
               00114         
               00115 #if MIDI_RXTX_USE_IO
343A 9C8C      00116     bcf     DEFAULT_MIDI_RX_LAT, DEFAULT_MIDI_RX_PIN
343C 5003      00117     movf    MIOS_PARAMETER1, W
343E A4D8      00118     skpz
3440 8C8C      00119     bsf     DEFAULT_MIDI_RX_LAT, DEFAULT_MIDI_RX_PIN
               00120 #else
               00121     movlw       MIDI_RXTX_RX_LED
               00122         call    MIOS_DOUT_PinSet
               00123 #endif
               00124 
               00125         ;; set the Tx LED depending on counter state
               00126         SET_BSR MIDI_RXTX_TX_CTR
3442 0100          M         movlb   HIGH(reg)
3444 5168      00127         movf    MIDI_RXTX_TX_CTR, W, BANKED
3446 A4D8      00128         skpz
3448 0E01      00129         movlw   0x01
344A 6E03      00130         movwf   MIOS_PARAMETER1
               00131 
               00132 #if MIDI_RXTX_USE_IO
344C 9E8C      00133     bcf     DEFAULT_MIDI_TX_LAT, DEFAULT_MIDI_TX_PIN
344E 5003      00134     movf    MIOS_PARAMETER1, W
3450 A4D8      00135     skpz
3452 8E8C      00136     bsf     DEFAULT_MIDI_TX_LAT, DEFAULT_MIDI_TX_PIN
               00137 #else
               00138     movlw       MIDI_RXTX_TX_LED
               00139         call    MIOS_DOUT_PinSet
               00140 #endif
               00141 #endif
3454 0012      00142         return
               00369 #include "special_characters.inc"
               00001 ; $Id: special_characters.inc 125 2008-02-27 09:10:44Z nils $
               00002 ;
               00003 ; This file contains all special characters used by the application
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 ;; --------------------------------------------------------------------------
               00014 ;;  Table of special characters
               00015 ;;  NOTE: only seven characters are really used by the CS, the others can contain
               00016 ;;  random bitpatterns, therefore this table only contains 16 bytes
               00017 ;; --------------------------------------------------------------------------
3456 00018 CS_MENU_SPECIAL_CHARS
               00019         ;; due to an imperfection in the MPASM we have
               00020         ;; to write two bytes in every line :-(
               00021         ;; char #0: left-arrow
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 47


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3456 0301      00022         db b'00000001', b'00000011'; 1st and 2nd line of special char
3458 0307      00023         db b'00000111', b'00000011'; 3rd and 4th line of special char
345A 0001      00024         db b'00000001', b'00000000'; 5th and 6th line of special char
345C 0000      00025         db b'00000000', b'00000000'; 7th and 8th line of special char
               00026         ;; char #1: right-arrow
345E 0000      00027         db b'00000000', b'00000000'; 1st and 2nd line of special char
3460 1000      00028         db b'00000000', b'00010000'; 3rd and 4th line of special char
3462 1C18      00029         db b'00011000', b'00011100'; 5th and 6th line of special char
3464 1018      00030         db b'00011000', b'00010000'; 7th and 8th line of special char
               00031         ;; char #2: inverted 1
3466 131B      00032         db b'00011011', b'00010011'; 1st and 2nd line of special char
3468 1B1B      00033         db b'00011011', b'00011011'; 3rd and 4th line of special char
346A 1B1B      00034         db b'00011011', b'00011011'; 5th and 6th line of special char
346C 1F11      00035         db b'00010001', b'00011111'; 7th and 8th line of special char
               00036         ;; char #3: inverted 2
346E 0E11      00037         db b'00010001', b'00001110'; 1st and 2nd line of special char
3470 1D1E      00038         db b'00011110', b'00011101'; 3rd and 4th line of special char
3472 171B      00039         db b'00011011', b'00010111'; 5th and 6th line of special char
3474 1F00      00040         db b'00000000', b'00011111'; 7th and 8th line of special char
               00041         ;; char #4: inverted 3
3476 1D00      00042         db b'00000000', b'00011101'; 1st and 2nd line of special char
3478 1D1B      00043         db b'00011011', b'00011101'; 3rd and 4th line of special char
347A 0E1E      00044         db b'00011110', b'00001110'; 5th and 6th line of special char
347C 1F11      00045         db b'00010001', b'00011111'; 7th and 8th line of special char
               00046         ;; char #5: inverted 4
347E 191D      00047         db b'00011101', b'00011001'; 1st and 2nd line of special char
3480 0D15      00048         db b'00010101', b'00001101'; 3rd and 4th line of special char
3482 1D00      00049         db b'00000000', b'00011101'; 5th and 6th line of special char
3484 1F1D      00050         db b'00011101', b'00011111'; 7th and 8th line of special char
               00051         ;; char #6: inverted '-'
3486 1F1F      00052         db b'00011111', b'00011111'; 1st and 2nd line of special char
3488 001F      00053         db b'00011111', b'00000000'; 3rd and 4th line of special char
348A 1F1F      00054         db b'00011111', b'00011111'; 5th and 6th line of special char
348C 1F1F      00055         db b'00011111', b'00011111'; 7th and 8th line of special char
               00056         ;; char #7: left/right arrow
348E 0301      00057         db b'00000001', b'00000011'; line 1 / 2
3490 1307      00058         db b'00000111', b'00010011'; line 3 / 4
3492 1C19      00059         db b'00011001', b'00011100'; line 5 / 6
3494 1018      00060         db b'00011000', b'00010000'; line 7 / 8
               00370 
               00371 #if DEFAULT_TIA_DEBUG_ON == 1
               00372 ;; ---[ Debug Mess driver ]---
               00373 #include "debug_msg.inc"
               00001 ; $Id: debug_msg.inc 626 2009-01-19 21:36:33Z tk $
               00002 ;
               00003 ;  Help functions to send debug messages to MIOS Terminal via SysEx
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 2009 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 48


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00012 
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  FUNCTION: DEBUG_MSG_SendHeader
               00016 ;;  DESCRIPTION: sends the SysEx header
               00017 ;;  IN:   -
               00018 ;;  OUT:  -
               00019 ;;  USES: BSR, FSR1
               00020 ;; --------------------------------------------------------------------------
3496 00021 _DEBUG_MSG_SendHeader   ; for C
3496 00022 DEBUG_MSG_SendHeader
               00023         ;; this SysEx command will be parsed by MIOS Terminal to print out text messages
3496 0EF0      00024         movlw   0xf0
3498 EC24 F016 00025         call    MIOS_MIDI_TxBufferPut
349C 0E00      00026         movlw   0x00
349E EC24 F016 00027         call    MIOS_MIDI_TxBufferPut
34A2 0E00      00028         movlw   0x00
34A4 EC24 F016 00029         call    MIOS_MIDI_TxBufferPut
34A8 0E7E      00030         movlw   0x7e
34AA EC24 F016 00031         call    MIOS_MIDI_TxBufferPut
34AE 0E32      00032         movlw   0x32
34B0 EC24 F016 00033         call    MIOS_MIDI_TxBufferPut
34B4 EC04 F016 00034         call    MIOS_MIDI_DeviceIDGet
34B8 EC24 F016 00035         call    MIOS_MIDI_TxBufferPut
34BC 0E0D      00036         movlw   0x0d
34BE EC24 F016 00037         call    MIOS_MIDI_TxBufferPut
34C2 0E40      00038         movlw   0x40
34C4 EC24 F016 00039         call    MIOS_MIDI_TxBufferPut
               00040 
               00041         ;; following characters will be print on terminal
34C8 0012      00042         return
               00043 
               00044 
               00045 ;; --------------------------------------------------------------------------
               00046 ;;  FUNCTION: DEBUG_MSG_SendFooter
               00047 ;;  DESCRIPTION: sends the SysEx footer
               00048 ;;  IN:   -
               00049 ;;  OUT:  -
               00050 ;;  USES: BSR, FSR1
               00051 ;; --------------------------------------------------------------------------
34CA 00052 _DEBUG_MSG_SendFooter   ; for C
34CA 00053 DEBUG_MSG_SendFooter
               00054         ;; finish SysEx stream - MIOS Terminal will print the received characters now
34CA 0EF7      00055         movlw   0xf7
34CC EC24 F016 00056         call    MIOS_MIDI_TxBufferPut
34D0 0012      00057         return
               00058 
               00059 
               00060 ;; --------------------------------------------------------------------------
               00061 ;;  FUNCTION: DEBUG_MSG_SendChar
               00062 ;;  DESCRIPTION: sends a single character
               00063 ;;  IN:   Character in WREG
               00064 ;;  OUT:  -
               00065 ;;  USES: BSR, FSR1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 49


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00066 ;; --------------------------------------------------------------------------
34D2 00067 _DEBUG_MSG_SendChar     ; for C
34D2 00068 DEBUG_MSG_SendChar
34D2 0B7F      00069         andlw   0x7f    ; ensure that MSB is cleared, otherwise we would violate the MIDI protocol
34D4 EF24 F016 00070         goto    MIOS_MIDI_TxBufferPut
               00071 
               00072 
               00073 ;; --------------------------------------------------------------------------
               00074 ;;  FUNCTION: DEBUG_MSG_SendASMString
               00075 ;;  DESCRIPTION: used in assembly programs to send a string
               00076 ;;               see example in README.txt for usage
               00077 ;;  IN:   zero-terminated string after call instruction
               00078 ;;  OUT:  -
               00079 ;;  USES: BSR, FSR1, TBLPTR[LHU], TABLAT
               00080 ;; --------------------------------------------------------------------------
34D8 00081 DEBUG_MSG_SendASMString
               00082         ;; we expect that the zero-terminated string is located behind the "call" instruction
               00083         ;; transfer pointer to TBLPTR[LHU]
34D8 CFFD FFF6 00084         movff   TOSL, TBLPTRL
34DC CFFE FFF7 00085         movff   TOSH, TBLPTRH
34E0 CFFF FFF8 00086         movff   TOSU, TBLPTRU
               00087 
               00088         ;; print until zero is read
34E4 00089 DEBUG_MSG_SendASMStringLoop
34E4 0009      00090         tblrd*+
34E6 50F5      00091         movf    TABLAT, W
34E8 E002      00092         bz      DEBUG_MSG_SendASMStringLoop_End
34EA DFF3      00093         rcall   DEBUG_MSG_SendChar
               00094         rgoto   DEBUG_MSG_SendASMStringLoop
34EC D7FB          M         bra     label
34EE 00095 DEBUG_MSG_SendASMStringLoop_End
               00096 
               00097         ;; return pointer now in TBLPTR[LH]
               00098 
               00099         ;; ensure that it is aligned to next instruction
34EE 50F6      00100         movf    TBLPTRL, W
34F0 0B01      00101         andlw   0x01
34F2 E005      00102         bz      DEBUG_MSG_SendASMString_NoIAlign
34F4 2AF6      00103         incf    TBLPTRL, F
34F6 B4D8      00104         skpnz
34F8 2AF7      00105         incf    TBLPTRH, F
34FA B4D8      00106         skpnz
34FC 2AF8      00107         incf    TBLPTRU, F
34FE 00108 DEBUG_MSG_SendASMString_NoIAlign
               00109 
               00110         IRQ_DISABLE
34FE 9EF2          M         bcf     INTCON, GIE
3500 50F6      00111         movf    TBLPTRL, W
3502 6EFD      00112         movwf   TOSL
3504 50F7      00113         movf    TBLPTRH, W
3506 6EFE      00114         movwf   TOSH
3508 50F8      00115         movf    TBLPTRU, W
350A 6EFF      00116         movwf   TOSU
               00117         IRQ_ENABLE
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 50


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
350C 8EF2          M         bsf     INTCON, GIE
350E 0012      00118         return
               00119 
               00120 
               00121 ;; --------------------------------------------------------------------------
               00122 ;;  FUNCTION: DEBUG_MSG_SendBCD1
               00123 ;;  DESCRIPTION: sends a 8-bit value as BCD (decimal value) -- one digit only
               00124 ;;  IN:   Value in WREG
               00125 ;;  OUT:  -
               00126 ;;  USES: BSR, FSR1
               00127 ;; --------------------------------------------------------------------------
               00128 ;; --------------------------------------------------------------------------
               00129 ;;  FUNCTION: DEBUG_MSG_SendHex1
               00130 ;;  DESCRIPTION: sends a 4-bit hex value
               00131 ;;  IN:   Value in WREG
               00132 ;;  OUT:  -
               00133 ;;  USES: BSR, FSR1
               00134 ;; --------------------------------------------------------------------------
3510 00135 _DEBUG_MSG_SendBCD1     ; for C
3510 00136 DEBUG_MSG_SendBCD1
3510 00137 _DEBUG_MSG_SendHex1     ; for C
3510 00138 DEBUG_MSG_SendHex1
3510 0B0F      00139         andlw   0x0f
3512 0FF6      00140         addlw   -0x0a
3514 B0D8      00141         skpnc
3516 0F07      00142         addlw   0x07
3518 0F3A      00143         addlw   0x3a
               00144         rgoto   DEBUG_MSG_SendChar
351A D7DB          M         bra     label
               00145 
               00146 
               00147 ;; --------------------------------------------------------------------------
               00148 ;;  FUNCTION: DEBUG_MSG_SendHex2
               00149 ;;  DESCRIPTION: sends a 8-bit hex value
               00150 ;;  IN:   Value in WREG
               00151 ;;  OUT:  -
               00152 ;;  USES: BSR, FSR1, PRODL (!)
               00153 ;; --------------------------------------------------------------------------
351C 00154 _DEBUG_MSG_SendHex2     ; for C
351C 00155 DEBUG_MSG_SendHex2
351C 6EF3      00156         movwf   PRODL
351E 38F3      00157         swapf   PRODL, W
3520 DFF7      00158         rcall   DEBUG_MSG_SendBCD1
3522 50F3      00159         movf    PRODL, W
               00160         rgoto   DEBUG_MSG_SendBCD1
3524 D7F5          M         bra     label
               00161 
               00162 
               00163 ;; --------------------------------------------------------------------------
               00164 ;;  FUNCTION: DEBUG_MSG_SendBCD2
               00165 ;;  DESCRIPTION: prints a 8-bit value as BCD (decimal value) -- two digits only
               00166 ;;  IN:   Value in WREG
               00167 ;;  OUT:  -
               00168 ;;  USES: BSR, FSR1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 51


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00169 ;; --------------------------------------------------------------------------
3526 00170 _DEBUG_MSG_SendBCD2     ; for C
3526 00171 DEBUG_MSG_SendBCD2
3526 6A03      00172         clrf    MIOS_PARAMETER1
3528 ECF4 F016 00173         call    MIOS_HLP_Dec2BCD
               00174         rgoto   DEBUG_MSG_SendBCD2_Cont
352C D018          M         bra     label
               00175 
               00176 ;; --------------------------------------------------------------------------
               00177 ;;  FUNCTION: DEBUG_MSG_SendBCD3
               00178 ;;  DESCRIPTION: prints a 8-bit value as BCD (decimal value) -- all three digits
               00179 ;;  IN:   Value in WREG
               00180 ;;  OUT:  -
               00181 ;;  USES: BSR, FSR1
               00182 ;; --------------------------------------------------------------------------
352E 00183 _DEBUG_MSG_SendBCD3     ; for C
352E 00184 DEBUG_MSG_SendBCD3
352E 6A03      00185         clrf    MIOS_PARAMETER1
3530 ECF4 F016 00186         call    MIOS_HLP_Dec2BCD
               00187         rgoto   DEBUG_MSG_SendBCD3_Cont
3534 D00F          M         bra     label
               00188 
               00189 ;; --------------------------------------------------------------------------
               00190 ;;  FUNCTION: DEBUG_MSG_SendBCD4
               00191 ;;  DESCRIPTION: prints a 16-bit as BCD (decimal value) -- four digits
               00192 ;;  IN:   Low-byte in WREG, High-byte in MIOS_PARAMETER1
               00193 ;;  IN:   Value in WREG
               00194 ;;  OUT:  -
               00195 ;;  USES: BSR, FSR1, MIOS_PARAMETER[123]
               00196 ;; --------------------------------------------------------------------------
               00197 ;_DEBUG_MSG_SendBCD4    ; "unsigned int" parameter converted in debug_msg.asm
3536 00198 DEBUG_MSG_SendBCD4
3536 ECF4 F016 00199         call    MIOS_HLP_Dec2BCD
               00200         rgoto   DEBUG_MSG_SendBCD4_Cont
353A D007          M         bra     label
               00201 
               00202 ;; --------------------------------------------------------------------------
               00203 ;;  FUNCTION: DEBUG_MSG_SendBCD5
               00204 ;;  DESCRIPTION: prints a 16-bit as BCD (decimal value) -- five digits
               00205 ;;  IN:   Low-byte in WREG, High-byte in MIOS_PARAMETER1
               00206 ;;  IN:   Value in WREG
               00207 ;;  OUT:  -
               00208 ;;  USES: BSR, FSR1, MIOS_PARAMETER[123]
               00209 ;; --------------------------------------------------------------------------
               00210 ;_DEBUG_MSG_SendBCD5    ; "unsigned int" parameter converted in debug_msg.asm
353C 00211 DEBUG_MSG_SendBCD5
353C ECF4 F016 00212         call    MIOS_HLP_Dec2BCD
               00213 
               00214 ;; -----------------
3540 00215 DEBUG_MSG_SendBCD5_Cont
3540 5005      00216         movf    MIOS_PARAMETER3, W
3542 0B0F      00217         andlw   0x0f
3544 E112      00218         bnz     DEBUG_MSG_SendBCD_D5
               00219 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 52


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3546 0E20      00220         movlw   ' '
3548 DFC4      00221         rcall   DEBUG_MSG_SendChar
               00222 
354A 00223 DEBUG_MSG_SendBCD4_Cont
354A 3804      00224         swapf   MIOS_PARAMETER2, W
354C 0B0F      00225         andlw   0x0f
354E E10E      00226         bnz     DEBUG_MSG_SendBCD_D4
               00227 
3550 0E20      00228         movlw   ' '
3552 DFBF      00229         rcall   DEBUG_MSG_SendChar
               00230 
3554 00231 DEBUG_MSG_SendBCD3_Cont
3554 5004      00232         movf    MIOS_PARAMETER2, W
3556 0B0F      00233         andlw   0x0f
3558 E10B      00234         bnz     DEBUG_MSG_SendBCD_D3
               00235 
355A 0E20      00236         movlw   ' '
355C DFBA      00237         rcall   DEBUG_MSG_SendChar
               00238 
355E 00239 DEBUG_MSG_SendBCD2_Cont
355E 3803      00240         swapf   MIOS_PARAMETER1, W
3560 0B0F      00241         andlw   0x0f
3562 E108      00242         bnz     DEBUG_MSG_SendBCD_D2
               00243 
3564 0E20      00244         movlw   ' '
3566 DFB5      00245         rcall   DEBUG_MSG_SendChar
               00246 
3568 00247 DEBUG_MSG_SendBCD1_Cont
               00248         rgoto   DEBUG_MSG_SendBCD_D1
3568 D007          M         bra     label
               00249         
               00250 
               00251         ;; ---
356A 00252 DEBUG_MSG_SendBCD_D5
356A DFD2      00253         rcall   DEBUG_MSG_SendBCD1
356C 00254 DEBUG_MSG_SendBCD_D4
356C 3804      00255         swapf   MIOS_PARAMETER2, W
356E DFD0      00256         rcall   DEBUG_MSG_SendBCD1
3570 00257 DEBUG_MSG_SendBCD_D3
3570 5004      00258         movf    MIOS_PARAMETER2, W
3572 DFCE      00259         rcall   DEBUG_MSG_SendBCD1
3574 00260 DEBUG_MSG_SendBCD_D2
3574 3803      00261         swapf   MIOS_PARAMETER1, W
3576 DFCC      00262         rcall   DEBUG_MSG_SendBCD1
3578 00263 DEBUG_MSG_SendBCD_D1
3578 5003      00264         movf    MIOS_PARAMETER1, W
               00265         rgoto   DEBUG_MSG_SendBCD1
357A D7CA          M         bra     label
               00266 
               00267 
               00268 ;; --------------------------------------------------------------------------
               00269 ;;  FUNCTION: DEBUG_MSG_SendCString
               00270 ;;  C_DECLARATION: void DEBUG_MSG_SendCString(char *str)
               00271 ;;  DESCRIPTION: sends a 0-terminated string --- only provided by the C Wrapper!
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 53


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00272 ;;  C_IN: Pointer to 0-terminated String in <str>
               00273 ;;  USES: BSR, FSR1
               00274 ;; --------------------------------------------------------------------------
               00374 #include "tia_debug.inc"
               00001 ; $Id: tia_debug.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; TIA Debugging Service Routine
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 
               00015 ;; --------------------------------------------------------------------------
               00016 ;;  Initialize the TIA Debugger module
               00017 ;; --------------------------------------------------------------------------
357C 00018 TIA_Debug_Init
357C 0012      00019     return
               00020 
               00021 ;; --------------------------------------------------------------------------
               00022 ;;  Check for changes in TIA registers, transfer values to TIA
               00023 ;;  and handle Wavetable
               00024 ;; --------------------------------------------------------------------------
357E 00025 TIA_Debug_Handler
               00026 
               00027 #if DEFAULT_TIA_DEBUG_BS 
357E D964      00028     rcall   TIA_Debug_BS_Check
               00029 #endif
               00030 
               00031 #if 0   
               00032     BRA_IFCLR REG_TEMP, 0, ACCESS, TIA_Debug_Handler_Jump0
               00033     bcf REG_TEMP, 0
               00034     call        DEBUG_MSG_SendHeader
               00035     call        DEBUG_MSG_SendASMString
               00036     db  "env mode:", 0
               00037     movf    REG_TEMP2, W
               00038     call        DEBUG_MSG_SendBCD3
               00039 
               00040         call    DEBUG_MSG_SendASMString
               00041     db  " Modulation:", 0
               00042     BRA_IFSET REG_TEMP, 3, ACCESS, TIA_Debug_Handler_test_neg
               00043 TIA_Debug_Handler_test_pos
               00044         call    DEBUG_MSG_SendASMString
               00045     db  "+", 0
               00046     bra     TIA_Debug_Handler_test_Cont
               00047 TIA_Debug_Handler_test_neg
               00048     call        DEBUG_MSG_SendASMString
               00049         db      "-", 0
               00050 TIA_Debug_Handler_test_Cont  
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 54


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00051 
               00052     movf    REG_TEMP3, W
               00053     call        DEBUG_MSG_SendBCD3
               00054 
               00055         call    DEBUG_MSG_SendFooter
               00056 TIA_Debug_Handler_Jump0
               00057 #endif  
               00058 #if 0
               00059     BRA_IFCLR REG_TEMP, 0, ACCESS, TIA_Debug_Handler_Jump0
               00060     bcf REG_TEMP, 0
               00061     call        DEBUG_MSG_SendHeader
               00062     call        DEBUG_MSG_SendASMString
               00063     db  " bank read!:", 0
               00064         call    DEBUG_MSG_SendFooter
               00065 TIA_Debug_Handler_Jump0
               00066 
               00067     BRA_IFCLR REG_TEMP, 1, ACCESS, TIA_Debug_Handler_Jump1
               00068     bcf REG_TEMP, 1
               00069     call        DEBUG_MSG_SendHeader
               00070     call        DEBUG_MSG_SendASMString
               00071     db  " bank write!:", 0
               00072         call    DEBUG_MSG_SendFooter
               00073 TIA_Debug_Handler_Jump1
               00074 
               00075 #endif  
               00076 
               00077 #if 0    
               00078 
               00079     BRA_IFCLR REG_TEMP, REG_TEMP_TEST_FLAG, ACCESS, TIA_Debug_Handler_Cont
               00080     bcf REG_TEMP, REG_TEMP_TEST_FLAG
               00081     call        DEBUG_MSG_SendHeader
               00082     call        DEBUG_MSG_SendASMString
               00083     db  " tune test:", 0
               00084         call    DEBUG_MSG_SendFooter
               00085     
               00086     call    TIA_TUNE_Play_Fanfare
               00087 #endif 
               00088 
               00089 #if 0    
               00090 
               00091     BRA_IFCLR REG_TEMP, 1, ACCESS, TIA_Debug_Handler_Cont
               00092     bcf REG_TEMP, 1
               00093     call        DEBUG_MSG_SendHeader
               00094     call        DEBUG_MSG_SendASMString
               00095     db  " tune test passed:", 0
               00096         call    DEBUG_MSG_SendFooter
               00097 #endif 
               00098 
               00099 #if 0    
               00100 
               00101     BRA_IFCLR REG_TEMP, REG_TEMP_TEST_FLAG, ACCESS, TIA_Debug_Handler_Cont
               00102     bcf REG_TEMP, REG_TEMP_TEST_FLAG
               00103 
               00104     
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 55


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00105     call        DEBUG_MSG_SendHeader
               00106     
               00107 
               00108         call    DEBUG_MSG_SendASMString
               00109     db  " waveform:", 0
               00110 
               00111     movlw   0x11
               00112         call    TIA_CCOUT_Get           ; get CC parameter value
               00113     call        DEBUG_MSG_SendBCD3
               00114 
               00115         call    DEBUG_MSG_SendFooter
               00116 #endif 
               00117 
               00118 
               00119 #if 0    
               00120 
               00121     BRA_IFCLR REG_TEMP, REG_TEMP_TEST_FLAG, ACCESS, TIA_Debug_Handler_Cont
               00122     bcf REG_TEMP, REG_TEMP_TEST_FLAG
               00123     
               00124     call        DEBUG_MSG_SendHeader
               00125     
               00126 
               00127         call    DEBUG_MSG_SendASMString
               00128     db  " Env:", 0
               00129     BRA_IFSET REG_TEMP, 3, ACCESS, TIA_Debug_Handler_vel_neg
               00130 TIA_Debug_Handler_vel_pos
               00131         call    DEBUG_MSG_SendASMString
               00132     db  "+", 0
               00133     bra     TIA_Debug_Handler_vel_Cont
               00134 TIA_Debug_Handler_vel_neg
               00135     call        DEBUG_MSG_SendASMString
               00136         db      "-", 0
               00137 TIA_Debug_Handler_vel_Cont   
               00138 
               00139     movf        REG_TEMP2, W
               00140     call        DEBUG_MSG_SendBCD3
               00141 
               00142         call    DEBUG_MSG_SendFooter
               00143 #endif 
               00144 
               00145 #if 0   
               00146 
               00147     BRA_IFCLR REG_TEMP, REG_TEMP_TEST_FLAG, ACCESS, TIA_Debug_Handler_Cont
               00148     bcf REG_TEMP, REG_TEMP_TEST_FLAG
               00149     call        DEBUG_MSG_SendHeader
               00150     
               00151         call    DEBUG_MSG_SendASMString
               00152     db  "Value:", 0
               00153     movf        REG_TEMP2, W
               00154     call        DEBUG_MSG_SendBCD3
               00155 
               00156         call    DEBUG_MSG_SendASMString
               00157     db  " /CC:", 0
               00158     movf        REG_TEMP3, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 56


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00159     call        DEBUG_MSG_SendBCD3
               00160 
               00161         call    DEBUG_MSG_SendFooter
               00162 #endif 
               00163     
               00164 #if 0    
               00165     BRA_IFCLR REG_TEMP, REG_TEMP_TEST_FLAG, ACCESS, TIA_Debug_Handler_Cont
               00166     bcf REG_TEMP, REG_TEMP_TEST_FLAG
               00167     call        DEBUG_MSG_SendHeader
               00168         call    DEBUG_MSG_SendASMString
               00169     db  "ctr:", 0
               00170     
               00171     movf        REG_TEMP3, W, ACCESS
               00172     movwf   MIOS_PARAMETER1
               00173     movf        REG_TEMP2, W, ACCESS
               00174         call    DEBUG_MSG_SendBCD5
               00175     BRA_IFSET REG_TEMP, 4, ACCESS, TIA_Debug_Handler_ctr_c
               00176 TIA_Debug_Handler_ctr_nc
               00177         call    DEBUG_MSG_SendASMString
               00178     db  "", 0
               00179     bra     TIA_Debug_Handler_ctr_Cont
               00180 TIA_Debug_Handler_ctr_c
               00181     call        DEBUG_MSG_SendASMString
               00182         db      " overflow", 0
               00183 TIA_Debug_Handler_ctr_Cont
               00184 
               00185         call    DEBUG_MSG_SendASMString
               00186     db  " /current:", 0
               00187     
               00188     movf        REG_TEMP7, W, ACCESS
               00189     movwf   MIOS_PARAMETER1
               00190     movf        REG_TEMP6, W, ACCESS
               00191         call    DEBUG_MSG_SendBCD5
               00192 
               00193         call    DEBUG_MSG_SendASMString
               00194     db  " /target:", 0
               00195     
               00196     movf        REG_TEMP5, W, ACCESS
               00197     movwf   MIOS_PARAMETER1
               00198     movf        REG_TEMP4, W, ACCESS
               00199         call    DEBUG_MSG_SendBCD5
               00200     
               00201         call    DEBUG_MSG_SendASMString
               00202     db  " /delta:", 0
               00203         movf    REG_TEMP13, W, ACCESS
               00204     movwf   MIOS_PARAMETER1
               00205     movf        REG_TEMP12, W, ACCESS
               00206         call    DEBUG_MSG_SendBCD5
               00207     BRA_IFSET REG_TEMP, 3, ACCESS, TIA_Debug_Handler_delta_neg
               00208 TIA_Debug_Handler_delta_pos
               00209         call    DEBUG_MSG_SendASMString
               00210     db  "+", 0
               00211     bra     TIA_Debug_Handler_delta_Cont
               00212 TIA_Debug_Handler_delta_neg
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 57


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00213     call        DEBUG_MSG_SendASMString
               00214         db      "-", 0
               00215 TIA_Debug_Handler_delta_Cont    
               00216     movf        REG_TEMP9, W, ACCESS
               00217     movwf   MIOS_PARAMETER1
               00218     movf        REG_TEMP8, W, ACCESS
               00219         call    DEBUG_MSG_SendBCD5
               00220 
               00221         call    DEBUG_MSG_SendASMString
               00222     db  " /result:", 0
               00223     
               00224     movf        REG_TEMP11, W, ACCESS
               00225     movwf   MIOS_PARAMETER1
               00226     movf        REG_TEMP10, W, ACCESS
               00227         call    DEBUG_MSG_SendBCD5
               00228         call    DEBUG_MSG_SendFooter
               00229 #endif 
               00230 
3580 00231 TIA_Debug_Handler_Cont
               00232 
               00233 
3580 00234 TIA_Debug_Handler_End
3580 0012      00235         return
               00236 
               00237 
               00238 ;; --------------------------------------------------------------------------
               00239 ;;  MACRO
               00240 ;;  '0' or '1' for send binary number
               00241 ;; --------------------------------------------------------------------------
               00242 TIA_Debug_WRITEBINx MACRO REG, FLAG_b 
               00243         LOCAL   TIA_Debug_WRITEBINx_1
               00244         LOCAL   TIA_Debug_WRITEBINx_0
               00245         LOCAL   TIA_Debug_WRITEBINx_End
               00246     
               00247     btfss   REG, FLAG_b
               00248     rgoto   TIA_Debug_WRITEBINx_0
               00249 TIA_Debug_WRITEBINx_1
               00250     call        DEBUG_MSG_SendASMString
               00251     db  "1", 0
               00252     rgoto   TIA_Debug_WRITEBINx_End
               00253 TIA_Debug_WRITEBINx_0
               00254     call        DEBUG_MSG_SendASMString
               00255     db  "0", 0
               00256 TIA_Debug_WRITEBINx_End
               00257         ENDM
               00258     
               00259     
               00260 ;; --------------------------------------------------------------------------
               00261 ;;  Check for changes in TIA registers, transfer values to/Volumes/AV 1/Projets Live/live Library/Presets/MIDI Effects/Max MIDI Effect/MB-TIA Mgr v1_Beta/MB-TIA_Mgr_1b .maxpat TIA
               00262 ;;  and handle Wavetable
               00263 ;; --------------------------------------------------------------------------
3582 00264 TIA_Debug_EE_Do
               00265     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG, ACCESS, TIA_Debug_EE_Do_End
3582 A064          M         btfss   reg, bit, reg_a
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 58


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3584 D09D          M         bra     label
3586 9164      00266     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG  
               00267     
3588 EC4B F01A 00268     call        DEBUG_MSG_SendHeader
               00269 
358C EC6C F01A 00270         call    DEBUG_MSG_SendASMString
3590 6E49 2E74 00271     db  "Int. EE R/W Debug:", 0
     4520 2045 
     2F52 2057 
     6544 7562 
     3A67 0000 
               00272     
35A4 00273 TIA_Debug_EE_Do_Read
               00274     BRA_IFSET TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_EE_Do_Write
35A4 B264          M         btfsc   reg, bit, reg_a
35A6 D00C          M         bra     label
35A8 EC6C F01A 00275         call    DEBUG_MSG_SendASMString
35AC 5220 6165 00276     db  " Read Int. Preset", 0
     2064 6E49 
     2E74 5020 
     6572 6573 
     0074      
               00277     rgoto   TIA_Debug_EE_Do_ReadWrite_End
35BE D01B          M         bra     label
               00278     
35C0 00279 TIA_Debug_EE_Do_Write
35C0 EC6C F01A 00280     call        DEBUG_MSG_SendASMString
35C4 5720 6972 00281     db  " Write Int. Preset", 0
     6574 4920 
     746E 202E 
     7250 7365 
     7465 0000 
35D8 00282 TIA_Debug_EE_Do_Write_byte
               00283     BRA_IFSET TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE, ACCESS, TIA_Debug_EE_Do_Write_Page
35D8 B464          M         btfsc   reg, bit, reg_a
35DA D007          M         bra     label
35DC EC6C F01A 00284     call        DEBUG_MSG_SendASMString
35E0 2D20 6220 00285     db  " - byte", 0    
     7479 0065 
               00286     rgoto   TIA_Debug_EE_Do_ReadWrite_End
35E8 D006          M         bra     label
35EA 00287 TIA_Debug_EE_Do_Write_Page    
35EA EC6C F01A 00288     call        DEBUG_MSG_SendASMString
35EE 2D20 7020 00289     db  " - page", 0    
     6761 0065 
35F6 00290 TIA_Debug_EE_Do_ReadWrite_End
               00291 
35F6 00292 TIA_Debug_EE_Do_PInit
               00293     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PINIT, ACCESS, TIA_Debug_EE_Do_PInit_End
35F6 AC64          M         btfss   reg, bit, reg_a
35F8 D00B          M         bra     label
35FA 9D64      00294     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PINIT
35FC EC6C F01A 00295         call    DEBUG_MSG_SendASMString
3600 2820 6150 00296     db  " (Patch Init)", 0
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 59


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     6374 2068 
     6E49 7469 
     0029      
               00297     rgoto   TIA_Debug_EE_Do_Sysex_End
360E D00D          M         bra     label
3610 00298 TIA_Debug_EE_Do_PInit_End
               00299 
3610 00300 TIA_Debug_EE_Do_Sysex
               00301     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_SYX, ACCESS, TIA_Debug_EE_Do_Sysex_End
3610 AE64          M         btfss   reg, bit, reg_a
3612 D00B          M         bra     label
3614 9F64      00302     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_SYX
3616 EC6C F01A 00303         call    DEBUG_MSG_SendASMString
361A 2820 7953 00304     db  " (Sysex Action)", 0
     6573 2078 
     6341 6974 
     6E6F 0029 
362A 00305 TIA_Debug_EE_Do_Sysex_End
               00306 
362A 00307 TIA_Debug_EE_Do_Read_Cont
               00308     BRA_IFSET TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_EE_Do_Read_Cont_End
362A B264          M         btfsc   reg, bit, reg_a
362C D003          M         bra     label
362E EC6C F01A 00309         call    DEBUG_MSG_SendASMString
3632 002E      00310     db  ".", 0
3634 00311 TIA_Debug_EE_Do_Read_Cont_End
               00312 
3634 00313 TIA_Debug_EE_Do_Write_Ok
               00314     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_EE_Do_WriteError_End
3634 A264          M         btfss   reg, bit, reg_a
3636 D03F          M         bra     label
               00315     BRA_IFSET TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR, ACCESS, TIA_Debug_EE_Do_Write_Error
3638 B664          M         btfsc   reg, bit, reg_a
363A D007          M         bra     label
363C EC6C F01A 00316         call    DEBUG_MSG_SendASMString
3640 2D20 4F20 00317     db  " - Ok.", 0
     2E6B 0000 
               00318     rgoto   TIA_Debug_EE_Do_WriteError_End
3648 D036          M         bra     label
               00319     
364A 00320 TIA_Debug_EE_Do_Write_Error
364A EC6C F01A 00321     call        DEBUG_MSG_SendASMString
364E 2D20 4520 00322     db  " - Error:", 0
     7272 726F 
     003A      
3658 00323 TIA_Debug_EE_Do_Write_ErrorReadonly
               00324     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_READONLY, ACCESS, TIA_Debug_EE_Do_Write_ErrorBS
3658 A864          M         btfss   reg, bit, reg_a
365A D00E          M         bra     label
365C EC6C F01A 00325     call        DEBUG_MSG_SendASMString
3660 4520 2045 00326     db  " EE in ReadOnly Mode.", 0    
     6E69 5220 
     6165 4F64 
     6C6E 2079 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 60


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     6F4D 6564 
     002E      
               00327     rgoto   TIA_Debug_EE_Do_WriteError_End
3676 D01F          M         bra     label
3678 00328 TIA_Debug_EE_Do_Write_ErrorBS  
               00329     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_WRERR, ACCESS, TIA_Debug_EE_Do_WriteError_End 
3678 AA64          M         btfss   reg, bit, reg_a
367A D01D          M         bra     label
367C 5166      00330     movf        TIA_DEBUG_EE_REG2, W
367E EC97 F01A 00331     call        DEBUG_MSG_SendBCD3
3682 EC6C F01A 00332     call        DEBUG_MSG_SendASMString
3686 4520 2045 00333     db  " EE Write problem(s)", 0   
     7257 7469 
     2065 7270 
     626F 656C 
     286D 2973 
     0000      
369C 00334 TIA_Debug_EE_Do_WriteError_Mismatch
               00335     BRA_IFCLR TIA_DEBUG_EE_REG1, 0, ACCESS, TIA_Debug_EE_Do_WriteError_End 
369C A065          M         btfss   reg, bit, reg_a
369E D00B          M         bra     label
36A0 EC6C F01A 00336     call        DEBUG_MSG_SendASMString
36A4 6228 7479 00337     db  "(byte mismatch).", 0      
     2065 696D 
     6D73 7461 
     6863 2E29 
     0000      
36B6 00338 TIA_Debug_EE_Do_WriteError_End
               00339 
               00340 
36B6 00341 TIA_Debug_EE_Do_Footer
36B6 EC65 F01A 00342         call    DEBUG_MSG_SendFooter
36BA 6B64      00343     clrf    TIA_DEBUG_EE_REGA
               00344     ;clrf    TIA_DEBUG_EE_REGB
36BC 6B65      00345     clrf    TIA_DEBUG_EE_REG1
36BE 6B66      00346     clrf    TIA_DEBUG_EE_REG2    
               00347     ;;rgoto TIA_Debug_EE_Do_End   
               00348 
36C0 00349 TIA_Debug_EE_Do_End    
36C0 0012      00350     return
               00351 
               00352 ;; --------------------------------------------------------------------------
               00353 ;;  Check for changes in TIA registers, transfer values to TIA
               00354 ;;  and handle Wavetable
               00355 ;; --------------------------------------------------------------------------
36C2 00356 TIA_Debug_BS_Do 
               00357     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK, ACCESS, TIA_Debug_BS_Do_End
36C2 B462          M         btfsc   reg, bit, reg_a
36C4 D0C0          M         bra     label
               00358     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG, ACCESS, TIA_Debug_BS_Do_Clr
36C6 A05B          M         btfss   reg, bit, reg_a
36C8 D0BA          M         bra     label
36CA 905B      00359     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
36CC EC4B F01A 00360     call        DEBUG_MSG_SendHeader
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 61


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00361 
36D0 EC6C F01A 00362         call    DEBUG_MSG_SendASMString
36D4 7845 2E74 00363     db  "Ext. BS R/W Debug:", 0
     4220 2053 
     2F52 2057 
     6544 7562 
     3A67 0000 
               00364     
36E8 00365 TIA_Debug_BS_Do_Read
               00366     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_BS_Do_Write
36E8 B25B          M         btfsc   reg, bit, reg_a
36EA D016          M         bra     label
36EC EC6C F01A 00367         call    DEBUG_MSG_SendASMString
36F0 5220 6165 00368     db  " Read Bank:", 0
     2064 6142 
     6B6E 003A 
36FC 505E      00369     movf        TIA_DEBUG_BS_REG3, W
36FE EC97 F01A 00370     call        DEBUG_MSG_SendBCD3
3702 EC6C F01A 00371         call    DEBUG_MSG_SendASMString
3706 5020 6572 00372     db  " Preset:", 0
     6573 3A74 
     0000      
3710 505F      00373     movf        TIA_DEBUG_BS_REG4, W
3712 EC97 F01A 00374     call        DEBUG_MSG_SendBCD3
               00375     rgoto   TIA_Debug_BS_Do_ReadWrite_End
3716 D025          M         bra     label
3718 00376 TIA_Debug_BS_Do_Write
3718 EC6C F01A 00377     call        DEBUG_MSG_SendASMString
371C 5720 6972 00378     db  " Write Bank:", 0
     6574 4220 
     6E61 3A6B 
     0000      
372A 505E      00379     movf        TIA_DEBUG_BS_REG3, W
372C EC97 F01A 00380     call        DEBUG_MSG_SendBCD3
3730 EC6C F01A 00381         call    DEBUG_MSG_SendASMString
3734 5020 6572 00382     db  " Preset:", 0
     6573 3A74 
     0000      
373E 505F      00383     movf        TIA_DEBUG_BS_REG4, W
3740 EC97 F01A 00384     call        DEBUG_MSG_SendBCD3
3744 00385 TIA_Debug_BS_Do_Write_byte
               00386     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE, ACCESS, TIA_Debug_BS_Do_Write_Page
3744 B45B          M         btfsc   reg, bit, reg_a
3746 D007          M         bra     label
3748 EC6C F01A 00387     call        DEBUG_MSG_SendASMString
374C 2D20 6220 00388     db  " - byte", 0    
     7479 0065 
               00389     rgoto   TIA_Debug_BS_Do_ReadWrite_End
3754 D006          M         bra     label
3756 00390 TIA_Debug_BS_Do_Write_Page    
3756 EC6C F01A 00391     call        DEBUG_MSG_SendASMString
375A 2D20 7020 00392     db  " - page", 0    
     6761 0065 
3762 00393 TIA_Debug_BS_Do_ReadWrite_End
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 62


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00394     
3762 00395 TIA_Debug_BS_Do_PInit
               00396     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PINIT, ACCESS, TIA_Debug_BS_Do_PInit_End
3762 AC5B          M         btfss   reg, bit, reg_a
3764 D00A          M         bra     label
3766 EC6C F01A 00397         call    DEBUG_MSG_SendASMString
376A 2820 7250 00398     db  " (Preset Init)", 0
     7365 7465 
     4920 696E 
     2974 0000 
377A 00399 TIA_Debug_BS_Do_PInit_End
               00400 
377A 00401 TIA_Debug_BS_Do_Sysex
               00402     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_SYX, ACCESS, TIA_Debug_BS_Do_Sysex_End
377A AE5B          M         btfss   reg, bit, reg_a
377C D00A          M         bra     label
377E EC6C F01A 00403         call    DEBUG_MSG_SendASMString
3782 2820 7953 00404     db  " (Sysex Action)", 0
     6573 2078 
     6341 6974 
     6E6F 0029 
3792 00405 TIA_Debug_BS_Do_Sysex_End
               00406 
3792 00407 TIA_Debug_BS_Do_Read_Cont
               00408     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_BS_Do_Read_Cont_End
3792 B25B          M         btfsc   reg, bit, reg_a
3794 D003          M         bra     label
3796 EC6C F01A 00409         call    DEBUG_MSG_SendASMString
379A 002E      00410     db  ".", 0
379C 00411 TIA_Debug_BS_Do_Read_Cont_End
               00412 
379C 00413 TIA_Debug_BS_Do_Write_Ok
               00414     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_BS_Do_WriteError_End
379C A25B          M         btfss   reg, bit, reg_a
379E D04D          M         bra     label
               00415     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR, ACCESS, TIA_Debug_BS_Do_Write_Error
37A0 B65B          M         btfsc   reg, bit, reg_a
37A2 D007          M         bra     label
37A4 EC6C F01A 00416         call    DEBUG_MSG_SendASMString
37A8 2D20 4F20 00417     db  " - Ok.", 0
     2E6B 0000 
               00418     rgoto   TIA_Debug_BS_Do_WriteError_End
37B0 D044          M         bra     label
               00419     
37B2 00420 TIA_Debug_BS_Do_Write_Error
37B2 EC6C F01A 00421     call        DEBUG_MSG_SendASMString
37B6 2D20 4520 00422     db  " - Error:", 0
     7272 726F 
     003A      
37C0 00423 TIA_Debug_BS_Do_Write_ErrorReadonly
               00424     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_READONLY, ACCESS, TIA_Debug_BS_Do_Write_ErrorBS
37C0 A85B          M         btfss   reg, bit, reg_a
37C2 D00E          M         bra     label
37C4 EC6C F01A 00425     call        DEBUG_MSG_SendASMString
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 63


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
37C8 4220 2053 00426     db  " BS in ReadOnly Mode.", 0    
     6E69 5220 
     6165 4F64 
     6C6E 2079 
     6F4D 6564 
     002E      
               00427     rgoto   TIA_Debug_BS_Do_WriteError_End
37DE D02D          M         bra     label
37E0 00428 TIA_Debug_BS_Do_Write_ErrorBS  
               00429     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_WRERR, ACCESS, TIA_Debug_BS_Do_WriteError_End 
37E0 AA5B          M         btfss   reg, bit, reg_a
37E2 D02B          M         bra     label
37E4 505D      00430     movf        TIA_DEBUG_BS_REG2, W
37E6 EC97 F01A 00431     call        DEBUG_MSG_SendBCD3
37EA EC6C F01A 00432     call        DEBUG_MSG_SendASMString
37EE 4220 2053 00433     db  " BS Write problem(s)", 0   
     7257 7469 
     2065 7270 
     626F 656C 
     286D 2973 
     0000      
3804 00434 TIA_Debug_BS_Do_WriteError_Mismatch
               00435     BRA_IFCLR TIA_DEBUG_BS_REG1, 0, ACCESS, TIA_Debug_BS_Do_WriteError_BSAbsent 
3804 A05C          M         btfss   reg, bit, reg_a
3806 D00B          M         bra     label
3808 EC6C F01A 00436     call        DEBUG_MSG_SendASMString
380C 6228 7479 00437     db  "(byte mismatch).", 0    
     2065 696D 
     6D73 7461 
     6863 2E29 
     0000      
381E 00438 TIA_Debug_BS_Do_WriteError_BSAbsent
               00439     BRA_IFCLR TIA_DEBUG_BS_REG1, 1, ACCESS, TIA_Debug_BS_Do_WriteError_End 
381E A25C          M         btfss   reg, bit, reg_a
3820 D00C          M         bra     label
3822 EC6C F01A 00440     call        DEBUG_MSG_SendASMString
3826 4228 2053 00441     db  "(BS not available).", 0    
     6F6E 2074 
     7661 6961 
     616C 6C62 
     2965 002E 
383A 00442 TIA_Debug_BS_Do_WriteError_End
               00443 
               00444     
383A 00445 TIA_Debug_BS_Do_Footer
383A EC65 F01A 00446         call    DEBUG_MSG_SendFooter
383E 00447 TIA_Debug_BS_Do_Clr
383E 6A5B      00448     clrf TIA_DEBUG_BS_REGA
3840 6B62      00449     clrf TIA_DEBUG_BS_REGB
3842 6A5C      00450     clrf TIA_DEBUG_BS_REG1
3844 6A5D      00451     clrf TIA_DEBUG_BS_REG2
               00452     ;;rgoto TIA_Debug_BS_End   
               00453     
3846 00454 TIA_Debug_BS_Do_End
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 64


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00455 
               00456 
3846 0012      00457     return
               00458 
               00459 
               00460 
               00461 ;; --------------------------------------------------------------------------
               00462 ;;  Check for changes in TIA registers, transfer values to TIA
               00463 ;;  and handle Wavetable
               00464 ;; --------------------------------------------------------------------------
               00465 
3848 00466 TIA_Debug_BS_Check 
               00467     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK, ACCESS, TIA_Debug_BS_Check_End
3848 A462          M         btfss   reg, bit, reg_a
384A D112          M         bra     label
               00468     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG, ACCESS, TIA_Debug_BS_Check_End
384C A05B          M         btfss   reg, bit, reg_a
384E D110          M         bra     label
3850 905B      00469     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3852 EC4B F01A 00470     call        DEBUG_MSG_SendHeader
               00471 
3856 EC6C F01A 00472         call    DEBUG_MSG_SendASMString
385A 5342 4320 00473     db  "BS Check Debug:", 0
     6568 6B63 
     4420 6265 
     6775 003A 
               00474 #if DEFAULT_TIA_DEBUG_BS_MODE    
               00475     ;; checked Bank    
               00476         call    DEBUG_MSG_SendASMString
               00477     db  " Bank:", 0
               00478     movf    TIA_BANKSTICK_CHK_CTR, W
               00479     call        DEBUG_MSG_SendBCD3
               00480 
               00481         call    DEBUG_MSG_SendASMString
               00482     db  ", BS addr:", 0
               00483     movf        TIA_BANKSTICK_ID, W
               00484     call        DEBUG_MSG_SendBCD3
               00485     
               00486     call        DEBUG_MSG_SendASMString
               00487     db  ", Box Status:", 0
               00488     movf        TIA_DEBUG_BS_REG1, W
               00489     call        DEBUG_MSG_SendBCD3
               00490 
               00491 
               00492     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_IntExt
               00493         call    DEBUG_MSG_SendASMString
               00494     db  ", Bank addr:", 0
               00495     movf        TIA_DEBUG_BS_REG2, W
               00496     call        DEBUG_MSG_SendBCD3
               00497     
               00498         call    DEBUG_MSG_SendASMString
               00499     db  ", Magic0:", 0
               00500     movf        TIA_DEBUG_BS_REG3, W
               00501     call        DEBUG_MSG_SendBCD3
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 65


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00502     
               00503         call    DEBUG_MSG_SendASMString
               00504     db  " Magic1:", 0
               00505     movf        TIA_DEBUG_BS_REG4, W
               00506     call        DEBUG_MSG_SendBCD3
               00507   
               00508         call    DEBUG_MSG_SendASMString
               00509     db  ", BS Status:", 0
               00510     movf        TIA_BANKSTICK_STAT, W
               00511     call        DEBUG_MSG_SendBCD3
               00512         call    DEBUG_MSG_SendASMString
               00513     db  "/", 0
               00514         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 7
               00515         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 6 
               00516         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 5
               00517         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 4 
               00518         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 3
               00519         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 2 
               00520         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 1
               00521         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 0 
               00522     ;movf       TIA_BANKSTICK_STAT, W
               00523     ;call       DEBUG_MSG_SendBCD3
               00524     
               00525     
               00526     call        DEBUG_MSG_SendASMString
               00527     db  ", BS Type:", 0
               00528     movf        TIA_DEBUG_BS_REG9, W
               00529     call        DEBUG_MSG_SendBCD3
               00530         call    DEBUG_MSG_SendASMString
               00531     db  "/", 0
               00532     TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 7
               00533         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 6 
               00534         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 5
               00535         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 4 
               00536         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 3
               00537         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 2 
               00538         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 1
               00539         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 0 
               00540     ;movf       TIA_BANKSTICK_SIZE, W
               00541     ;call       DEBUG_MSG_SendBCD3
               00542    
               00543 
               00544     call        DEBUG_MSG_SendASMString
               00545     db  ", BS Size:", 0
               00546     movf        TIA_BANKSTICK_SIZE, W
               00547     call        DEBUG_MSG_SendBCD3
               00548         call    DEBUG_MSG_SendASMString
               00549     db  "/", 0
               00550     TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 7
               00551         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 6 
               00552         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 5
               00553         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 4 
               00554         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 3
               00555         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 2 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 66


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00556         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 1
               00557         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 0 
               00558     ;movf       TIA_BANKSTICK_SIZE, W
               00559     ;call       DEBUG_MSG_SendBCD3
               00560     
               00561         call    DEBUG_MSG_SendASMString
               00562     db  ", BS Ready:", 0
               00563     movf        TIA_BANKSTICK_RDY, W
               00564     call        DEBUG_MSG_SendBCD3
               00565         call    DEBUG_MSG_SendASMString
               00566     db  "/", 0
               00567         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 7
               00568         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 6 
               00569         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 5
               00570         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 4 
               00571         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 3
               00572         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 2 
               00573         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 1
               00574         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 0 
               00575     
               00576         call    DEBUG_MSG_SendASMString
               00577     db  ", ", 0    
               00578 #endif  
               00579    
386A 00580 TIA_Debug_BS_Check_IntExt
               00581     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_Ext
386A B862          M         btfsc   reg, bit, reg_a
386C D019          M         bra     label
386E EC6C F01A 00582         call    DEBUG_MSG_SendASMString
3872 4920 746E 00583     db  " Int. Patch /BS:", 0
     202E 6150 
     6374 2068 
     422F 3A53 
     0000      
3884 501A      00584     movf        TIA_BANKSTICK_ID, W
3886 EC97 F01A 00585     call        DEBUG_MSG_SendBCD3
388A EC6C F01A 00586         call    DEBUG_MSG_SendASMString
388E 6420 7369 00587     db  " disconnected.", 0
     6F63 6E6E 
     6365 6574 
     2E64 0000 
               00588     rgoto   TIA_Debug_BS_Check_Footer
389E D0E4          M         bra     label
38A0 00589 TIA_Debug_BS_Check_Ext
               00590     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_IntExt_End
38A0 A862          M         btfss   reg, bit, reg_a
38A2 D005          M         bra     label
38A4 EC6C F01A 00591     call        DEBUG_MSG_SendASMString
38A8 4520 7478 00592     db  " Ext.", 0
     002E      
38AE 00593 TIA_Debug_BS_Check_IntExt_End
               00594     
38AE 00595 TIA_Debug_BS_Check_Size
               00596     ;;BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT, ACCESS, TIA_Debug_BS_Check_Size_End
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 67


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00597     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_Size_End
38AE A862          M         btfss   reg, bit, reg_a
38B0 D00C          M         bra     label
               00598     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE, ACCESS, TIA_Debug_BS_Check_64k
38B2 B662          M         btfsc   reg, bit, reg_a
38B4 D004          M         bra     label
38B6 EC6C F01A 00599     call        DEBUG_MSG_SendASMString
38BA 3233 006B 00600     db  "32k", 0
38BE 00601 TIA_Debug_BS_Check_64k
               00602     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE, ACCESS, TIA_Debug_BS_Check_Size_End
38BE A662          M         btfss   reg, bit, reg_a
38C0 D004          M         bra     label
38C2 EC6C F01A 00603     call        DEBUG_MSG_SendASMString
38C6 3436 006B 00604     db  "64k", 0
38CA 00605 TIA_Debug_BS_Check_Size_End
               00606 
38CA 00607 TIA_Debug_BS_Check_Type
               00608     ;;BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT, ACCESS, TIA_Debug_BS_Check_Type_End
               00609     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK, ACCESS, TIA_Debug_BS_Check_KWT
38CA B062          M         btfsc   reg, bit, reg_a
38CC D00B          M         bra     label
38CE EC6C F01A 00610     call        DEBUG_MSG_SendASMString
38D2 2020 4250 00611     db  "  PBank", 0
     6E61 006B 
38DA 5019      00612     movf    TIA_BANKSTICK_CHK_CTR, W
38DC BA5B      00613     btfsc   TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS
38DE 0B1C      00614     andlw   0x1c
38E0 EC97 F01A 00615     call        DEBUG_MSG_SendBCD3  
38E4 00616 TIA_Debug_BS_Check_KWT
               00617     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK, ACCESS, TIA_Debug_BS_Check_Type_End
38E4 A062          M         btfss   reg, bit, reg_a
38E6 D01B          M         bra     label
38E8 00618 TIA_Debug_BS_Check_K
               00619     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT, ACCESS, TIA_Debug_BS_Check_WT
38E8 B262          M         btfsc   reg, bit, reg_a
38EA D00B          M         bra     label
38EC EC6C F01A 00620     call        DEBUG_MSG_SendASMString
38F0 2020 424B 00621     db  "  KBank", 0
     6E61 006B 
38F8 5019      00622     movf    TIA_BANKSTICK_CHK_CTR, W
38FA BA5B      00623     btfsc   TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS
38FC 0B1C      00624     andlw   0x1c
38FE EC97 F01A 00625     call        DEBUG_MSG_SendBCD3  
3902 00626 TIA_Debug_BS_Check_WT    
               00627     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT, ACCESS, TIA_Debug_BS_Check_Type_End
3902 A262          M         btfss   reg, bit, reg_a
3904 D00C          M         bra     label
3906 9362      00628     bcf     TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
3908 EC6C F01A 00629     call        DEBUG_MSG_SendASMString
390C 5720 4254 00630     db  " WTBank", 0
     6E61 006B 
3914 5019      00631     movf    TIA_BANKSTICK_CHK_CTR, W
3916 BA5B      00632     btfsc   TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS
3918 0B1C      00633     andlw   0x1c
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 68


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
391A EC97 F01A 00634     call        DEBUG_MSG_SendBCD3  
391E 00635 TIA_Debug_BS_Check_Type_End
               00636 
               00637 
               00638 
391E 00639 TIA_Debug_BS_Check_Ready
               00640     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT, ACCESS, TIA_Debug_BS_Check_Ready_End
391E BA62          M         btfsc   reg, bit, reg_a
3920 D02E          M         bra     label
               00641     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT, ACCESS, TIA_Debug_BS_Check_Ready_End
3922 BC62          M         btfsc   reg, bit, reg_a
3924 D02C          M         bra     label
               00642     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_TPROTECT, ACCESS, TIA_Debug_BS_Check_Ready_End
3926 BE62          M         btfsc   reg, bit, reg_a
3928 D02A          M         bra     label
               00643     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_Ready_End
392A A862          M         btfss   reg, bit, reg_a
392C D028          M         bra     label
               00644     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS, TIA_Debug_BS_Check_ReadyOk
392E BA5B          M         btfsc   reg, bit, reg_a
3930 D008          M         bra     label
3932 EC6C F01A 00645         call    DEBUG_MSG_SendASMString
3936 6C20 616F 00646     db  " loaded Ok", 0
     6564 2064 
     6B4F 0000 
3942 00647 TIA_Debug_BS_Check_ReadyOk
               00648     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS, TIA_Debug_BS_Check_Ready_End
3942 AA5B          M         btfss   reg, bit, reg_a
3944 D01C          M         bra     label
3946 EC6C F01A 00649         call    DEBUG_MSG_SendASMString
394A 002D      00650     db  "-", 0
394C 5019      00651     movf    TIA_BANKSTICK_CHK_CTR, W
394E 0B1C      00652     andlw   0x1c
3950 0F03      00653     addlw   0x03
3952 EC97 F01A 00654     call        DEBUG_MSG_SendBCD3  
3956 EC6C F01A 00655         call    DEBUG_MSG_SendASMString
395A 6C20 616F 00656     db  " loaded Ok /BS:", 0
     6564 2064 
     6B4F 2F20 
     5342 003A 
396A 501A      00657     movf        TIA_BANKSTICK_ID, W
396C EC97 F01A 00658     call        DEBUG_MSG_SendBCD3
3970 EC6C F01A 00659         call    DEBUG_MSG_SendASMString
3974 7220 6165 00660     db  " ready!", 0
     7964 0021 
397C 9A5B      00661     bcf     TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY
397E 00662 TIA_Debug_BS_Check_Ready_End
               00663 
               00664 
397E 00665 TIA_Debug_BS_Check_Format
               00666     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT, ACCESS, TIA_Debug_BS_Check_Format_End
397E AA62          M         btfss   reg, bit, reg_a
3980 D00A          M         bra     label
3982 9B62      00667     bcf     TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 69


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3984 EC6C F01A 00668     call        DEBUG_MSG_SendASMString
3988 5220 6665 00669     db  " Reformated!", 0
     726F 616D 
     6574 2164 
     0000      
3996 00670 TIA_Debug_BS_Check_Format_End
               00671 
3996 00672 TIA_Debug_BS_Check_FormatProtect
               00673     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT, ACCESS, TIA_Debug_BS_Check_FormatProtect_End
3996 AC62          M         btfss   reg, bit, reg_a
3998 D021          M         bra     label
399A 9D62      00674     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT
399C EC6C F01A 00675         call    DEBUG_MSG_SendASMString
39A0 002D      00676     db  "-", 0
39A2 5019      00677     movf    TIA_BANKSTICK_CHK_CTR, W
39A4 0B1C      00678     andlw   0x1c
39A6 0F03      00679     addlw   0x03
39A8 EC97 F01A 00680     call        DEBUG_MSG_SendBCD3  
39AC EC6C F01A 00681         call    DEBUG_MSG_SendASMString
39B0 6E20 746F 00682     db  " not valid /BS:", 0
     7620 6C61 
     6469 2F20 
     5342 003A 
39C0 501A      00683     movf        TIA_BANKSTICK_ID, W
39C2 EC97 F01A 00684     call        DEBUG_MSG_SendBCD3
39C6 EC6C F01A 00685     call        DEBUG_MSG_SendASMString
39CA 2820 6F66 00686     db  " (format inhibit)", 0
     6D72 7461 
     6920 686E 
     6269 7469 
     0029      
39DC 00687 TIA_Debug_BS_Check_FormatProtect_End
               00688 
39DC 00689 TIA_Debug_BS_Check_TypeProtect
               00690     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_TPROTECT, ACCESS, TIA_Debug_BS_Check_TypeProtect_End
39DC AE62          M         btfss   reg, bit, reg_a
39DE D021          M         bra     label
39E0 9F62      00691     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_TPROTECT
39E2 EC6C F01A 00692         call    DEBUG_MSG_SendASMString
39E6 002D      00693     db  "-", 0
39E8 5019      00694     movf    TIA_BANKSTICK_CHK_CTR, W
39EA 0B1C      00695     andlw   0x1c
39EC 0F03      00696     addlw   0x03
39EE EC97 F01A 00697     call        DEBUG_MSG_SendBCD3  
39F2 EC6C F01A 00698         call    DEBUG_MSG_SendASMString
39F6 6E20 746F 00699     db  " not valid /BS:", 0
     7620 6C61 
     6469 2F20 
     5342 003A 
3A06 501A      00700     movf        TIA_BANKSTICK_ID, W
3A08 EC97 F01A 00701     call        DEBUG_MSG_SendBCD3
3A0C EC6C F01A 00702     call        DEBUG_MSG_SendASMString
3A10 2820 7974 00703     db  " (type protected)", 0
     6570 7020 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 70


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     6F72 6574 
     7463 6465 
     0029      
3A22 00704 TIA_Debug_BS_Check_TypeProtect_End
               00705 
3A22 00706 TIA_Debug_BS_Check_Error
               00707     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_Error_End
3A22 A862          M         btfss   reg, bit, reg_a
3A24 D020          M         bra     label
               00708     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT, ACCESS, TIA_Debug_BS_Check_Error_End
3A26 AA62          M         btfss   reg, bit, reg_a
3A28 D01E          M         bra     label
               00709     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR, ACCESS, TIA_Debug_BS_Check_NoError
3A2A A65B          M         btfss   reg, bit, reg_a
3A2C D012          M         bra     label
3A2E 5160      00710     movf        TIA_DEBUG_BS_REG5, W
3A30 EC97 F01A 00711     call        DEBUG_MSG_SendBCD3
3A34 EC6C F01A 00712     call        DEBUG_MSG_SendASMString
3A38 4520 7272 00713     db  " Error(s), Last:", 0
     726F 7328 
     2C29 4C20 
     7361 3A74 
     0000      
3A4A 5161      00714     movf        TIA_DEBUG_BS_REG6, W
3A4C EC97 F01A 00715     call        DEBUG_MSG_SendBCD3
3A50 965B      00716     bcf     TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3A52 00717 TIA_Debug_BS_Check_NoError
               00718     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR, ACCESS, TIA_Debug_BS_Check_Error_End
3A52 B65B          M         btfsc   reg, bit, reg_a
3A54 D008          M         bra     label
3A56 EC6C F01A 00719     call        DEBUG_MSG_SendASMString
3A5A 4E20 206F 00720     db  " No error.", 0
     7265 6F72 
     2E72 0000 
3A66 00721 TIA_Debug_BS_Check_Error_End
3A66 6B60      00722     clrf    TIA_DEBUG_BS_REG5
               00723     
3A68 00724 TIA_Debug_BS_Check_Footer
3A68 EC65 F01A 00725         call    DEBUG_MSG_SendFooter
3A6C 00726 TIA_Debug_BS_Check_Clr
3A6C 6A5B      00727     clrf TIA_DEBUG_BS_REGA
3A6E 6B62      00728     clrf TIA_DEBUG_BS_REGB
               00729 
               00730     ;;rgoto TIA_Debug_BS_Check_End
               00731   
3A70 00732 TIA_Debug_BS_Check_End
3A70 0012      00733     return
               00734 
               00735 
               00736 
               00375 #endif
               00376 
               00377 ;; ---[ TIA kernel ]---
               00378 #include "tia_led_meter.inc"
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 71


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00001 ; $Id: tia_led_meter.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; TIA Cartridge Led Meter Module
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 ;
               00014 ; define the pins to which the Leds Meters are connected
               00015 ;
               00016 
  00000007     00017 TIA_LEDMTR0     EQU     7
  00000006     00018 TIA_LEDMTR1     EQU     6
  00000005     00019 TIA_LEDMTR2     EQU     5
  00000004     00020 TIA_LEDMTR3     EQU     4
               00021 
  00000003     00022 TIA_LEDMTR4     EQU     3
  00000002     00023 TIA_LEDMTR5     EQU     2
  00000001     00024 TIA_LEDMTR6     EQU     1
  00000000     00025 TIA_LEDMTR7     EQU     0
               00026 
  00000000     00027 TIA_LEDMTR_AUDX_REQ   EQU 0
  00000001     00028 TIA_LEDMTR_TIA_MODE   EQU 1      ;; Swith between Normal & Sampler Mode
               00029 
               00030 ;; --------------------------------------------------------------------------
               00031 ;;  Initialize the LEDMTR module
               00032 ;; --------------------------------------------------------------------------
3A72 00033 TIA_LEDMTR_Init
3A72 6B6A      00034     clrf    TIA_LEDMTR_STAT
3A74 6B6B      00035     clrf    TIA_LEDMTR_VALUE
3A76 0012      00036     return
               00037         ;; reset will be released with first call of TIA_SR_Handler
               00038 
               00039 ;; --------------------------------------------------------------------------
               00040 ;;  LEDMTR module Handler
               00041 ;; --------------------------------------------------------------------------
3A78 00042 TIA_LEDMTR_Handler
               00043         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
3A78 0101          M         movlb   HIGH(reg)
               00044     ;; Template run prioity
               00045     BRA_IFCLR TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ, ACCESS, TIA_LEDMTR_Handler_End
3A7A A06A          M         btfss   reg, bit, reg_a
3A7C D021          M         bra     label
               00046     
3A7E 00047 TIA_LEDMTR_Handler_Meter_Norm     
               00048     ;;BRA_IFSET TIA_LEDMTR_STAT, TIA_LEDMTR_TIA_MODE, ACCESS, TIA_LEDMTR_Handler_Meter_Sampler
3A7E 916A      00049     bcf     TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ
               00050 
3A80 6B6B      00051     clrf    TIA_LEDMTR_VALUE
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 72


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3A82 0E01      00052     movlw   0x01
3A84 6104      00053     cpfslt  TIA_AUDV0
3A86 8F6B      00054     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR0
3A88 0E07      00055     movlw   0x07
3A8A 6104      00056     cpfslt  TIA_AUDV0
3A8C 8D6B      00057     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR1
3A8E 0E0B      00058     movlw   0x0b
3A90 6104      00059     cpfslt  TIA_AUDV0
3A92 8B6B      00060     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR2
3A94 0E0E      00061     movlw   0x0e
3A96 6104      00062     cpfslt  TIA_AUDV0
3A98 896B      00063     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR3
               00064     
3A9A 0E01      00065     movlw   0x01
3A9C 6105      00066     cpfslt  TIA_AUDV1
3A9E 876B      00067     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR4
3AA0 0E07      00068     movlw   0x07
3AA2 6105      00069     cpfslt  TIA_AUDV1
3AA4 856B      00070     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR5
3AA6 0E0B      00071     movlw   0x0b
3AA8 6105      00072     cpfslt  TIA_AUDV1
3AAA 836B      00073     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR6
3AAC 0E0E      00074     movlw   0x0e
3AAE 6105      00075     cpfslt  TIA_AUDV1
3AB0 816B      00076     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR7 
               00077 
3AB2 516B      00078     movf    TIA_LEDMTR_VALUE, W
3AB4 6E03      00079     movwf   MIOS_PARAMETER1
               00080     rgoto   TIA_LEDMTR_Handler_Set
3AB6 D001          M         bra     label
               00081     
3AB8 00082 TIA_LEDMTR_Handler_Meter_Sampler 
3AB8 6A03      00083     clrf    MIOS_PARAMETER1
               00084     ; To Do
               00085     ;;rgoto   TIA_LEDMTR_Handler_Set
               00086 
3ABA 00087 TIA_LEDMTR_Handler_Set
3ABA 0E00      00088     movlw   TIA_LEDMTR_REG
3ABC EC68 F016 00089     call    MIOS_DOUT_SRSet
               00090 
3AC0 00091 TIA_LEDMTR_Handler_End
3AC0 0012      00092         return
               00093 
               00094 ;; --------------------------------------------------------------------------
               00095 ;;  TIA_LEDMTR Led Pattern orange to green
               00096 ;; --------------------------------------------------------------------------
3AC2 00097 TIA_LEDMTR_PlayFormat
3AC2 D82D      00098         rcall   TIA_LEDMTR_Player_Init
               00099 
3AC4 00100 TIA_LEDMTR_PlayFormat_R
3AC4 D82C      00101         rcall   TIA_LEDMTR_Player_Init
3AC6 0E11      00102         movlw   0x11
3AC8 D83D      00103         rcall   TIA_LEDMTR_Player_On_Wait01
3ACA 0E03      00104         movlw   0x03
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 73


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3ACC D83E      00105         rcall   TIA_LEDMTR_Wait
               00106         rgoto   TIA_LEDMTR_End
3ACE D026          M         bra     label
               00107 
3AD0 00108 TIA_LEDMTR_PlayFormat_O
3AD0 D826      00109         rcall   TIA_LEDMTR_Player_Init
3AD2 0E33      00110         movlw   0x33
3AD4 D837      00111         rcall   TIA_LEDMTR_Player_On_Wait01
3AD6 0E01      00112         movlw   0x01
3AD8 D838      00113         rcall   TIA_LEDMTR_Wait
               00114         rgoto   TIA_LEDMTR_End
3ADA D020          M         bra     label
               00115 
3ADC 00116 TIA_LEDMTR_PlayFormat_G1
3ADC D820      00117         rcall   TIA_LEDMTR_Player_Init
3ADE 0E77      00118         movlw   0x77
3AE0 D831      00119         rcall   TIA_LEDMTR_Player_On_Wait01
3AE2 0E03      00120         movlw   0x03
3AE4 D832      00121         rcall   TIA_LEDMTR_Wait
               00122         rgoto   TIA_LEDMTR_End
3AE6 D01A          M         bra     label
               00123 
3AE8 00124 TIA_LEDMTR_PlayFormat_G2
3AE8 D81A      00125         rcall   TIA_LEDMTR_Player_Init
3AEA 0EFF      00126         movlw   0xff
3AEC D82B      00127         rcall   TIA_LEDMTR_Player_On_Wait01
3AEE 0E03      00128         movlw   0x03
3AF0 D82C      00129         rcall   TIA_LEDMTR_Wait
               00130         rgoto   TIA_LEDMTR_End
3AF2 D014          M         bra     label
               00131     
               00132 ;; --------------------------------------------------------------------------
               00133 ;;  TIA_LEDMTR Led Pattern orange to green
               00134 ;; --------------------------------------------------------------------------
3AF4 00135 TIA_LEDMTR_PlayOtoG
3AF4 D814      00136         rcall   TIA_LEDMTR_Player_Init
               00137 
3AF6 0E22      00138         movlw   0x22
3AF8 D825      00139         rcall   TIA_LEDMTR_Player_On_Wait01
3AFA 0E03      00140         movlw   0x03
3AFC D826      00141         rcall   TIA_LEDMTR_Wait
3AFE 0E44      00142         movlw   0x44
3B00 D821      00143         rcall   TIA_LEDMTR_Player_On_Wait01
3B02 0E03      00144         movlw   0x03
3B04 D822      00145         rcall   TIA_LEDMTR_Wait
3B06 0E88      00146         movlw   0x88
3B08 D81D      00147         rcall   TIA_LEDMTR_Player_On_Wait01
               00148 
               00149         rgoto   TIA_LEDMTR_End
3B0A D008          M         bra     label
               00150     
               00151 ;; --------------------------------------------------------------------------
               00152 ;;  TIA_LEDMTR Led Pattern orange to red
               00153 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 74


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3B0C 00154 TIA_LEDMTR_PlayOtoR
3B0C D808      00155         rcall   TIA_LEDMTR_Player_Init
               00156 
3B0E 0E22      00157         movlw   0x22
3B10 D819      00158         rcall   TIA_LEDMTR_Player_On_Wait01
3B12 0E03      00159         movlw   0x03
3B14 D81A      00160         rcall   TIA_LEDMTR_Wait
3B16 0E11      00161         movlw   0x11
3B18 D815      00162         rcall   TIA_LEDMTR_Player_On_Wait01
               00163 
               00164         rgoto   TIA_LEDMTR_End
3B1A D000          M         bra     label
               00165     
               00166 
               00167 
               00168 ;; --------------------------------------------------------------------------
               00169 ;;  TIA_LEDMTR End 
               00170 ;; --------------------------------------------------------------------------
3B1C 00171 TIA_LEDMTR_End
               00172         ;bcf    TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn on TIA software synth part again
               00173         ;goto   TIA_PATCH_Init                  ; init patch and exit
3B1C 0012      00174     return
               00175 
               00176 
               00177 ;; --------------------------------------------------------------------------
               00178 ;;  TIA_LEDMTR Initialization routine
               00179 ;; --------------------------------------------------------------------------
3B1E 00180 TIA_LEDMTR_Player_Init
3B1E 8010      00181         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn off TIA software synth part
               00182 
               00183         SET_BSR TIA_BASE
3B20 0101          M         movlb   HIGH(reg)
3B22 6A03      00184     clrf    MIOS_PARAMETER1
3B24 0E00      00185     movlw   TIA_LEDMTR_REG
3B26 EC68 F016 00186     call    MIOS_DOUT_SRSet
3B2A 0012      00187     return
               00188 ;; --------------------------------------------------------------------------
               00189 ;;  TIA_LEDMTR a note (in: Note Number)
               00190 ;; --------------------------------------------------------------------------
3B2C 00191 TIA_LEDMTR_Player_On
               00192         SET_BSR TIA_BASE
3B2C 0101          M         movlb   HIGH(reg)
3B2E 6E03      00193     movwf   MIOS_PARAMETER1
3B30 0E00      00194     movlw   TIA_LEDMTR_REG
3B32 EC68 F016 00195     call    MIOS_DOUT_SRSet
3B36 0012      00196     return
               00197 
3B38 00198 TIA_LEDMTR_Player_Off
               00199         SET_BSR TIA_BASE
3B38 0101          M         movlb   HIGH(reg)
3B3A 6A03      00200     clrf    MIOS_PARAMETER1
3B3C 0E00      00201     movlw   TIA_LEDMTR_REG
3B3E EC68 F016 00202     call    MIOS_DOUT_SRSet
3B42 0012      00203     return
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 75


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00204     
3B44 00205 TIA_LEDMTR_Player_On_Wait01
3B44 DFF3      00206         rcall   TIA_LEDMTR_Player_On
3B46 0E01      00207         movlw   0x01
               00208         rgoto   TIA_LEDMTR_Wait
3B48 D000          M         bra     label
               00209     
               00210 
               00211 ;; --------------------------------------------------------------------------
               00212 ;;  TIA_LEDMTR wait for a certain time and poll TIA_SR Handler
               00213 ;; --------------------------------------------------------------------------
3B4A 00214 TIA_LEDMTR_Wait
3B4A 6E06      00215         movwf   TMP1
3B4C 0004      00216         clrwdt
3B4E 00217 TIA_LEDMTR_WaitLoop
3B4E 0E0A      00218         movlw   10
3B50 ECCE F016 00219         call    MIOS_Delay
3B54 2E06      00220         decfsz  TMP1, F
               00221         rgoto   TIA_LEDMTR_WaitLoop
3B56 D7FB          M         bra     label
3B58 0012      00222         return
               00223 
               00379 ;#include "tia_lcd.inc"
               00380 #include "tia_patch.inc"
               00001 ; $Id: tia_patch.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; TIA Patch routines
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  Init Routine for patch parameters
               00016 ;;  Note that the MIDI events are initialized separately, this routine will
               00017 ;;  be called on power-on and after a new MIDI dump has been loaded
               00018 ;; --------------------------------------------------------------------------
3B5A 00019 TIA_PATCH_Init
               00020         ;; disable TIA engine
3B5A 8010      00021         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00022 
               00023         ;; clear the whole TIA SFR memory space
3B5C 0E00      00024         movlw   ((TIA_SW_CLEAR_END-TIA_SW_CLEAR_BEGIN)+1) & 0xff
3B5E 6E06      00025         movwf   TMP1
3B60 EE01 F000 00026         lfsr    FSR0, TIA_SW_CLEAR_BEGIN
3B64 00027 TIA_PATCH_Init_ClearLoop
3B64 6AEE      00028         clrf    POSTINC0
3B66 2E06      00029         decfsz  TMP1, F
               00030         rgoto   TIA_PATCH_Init_ClearLoop
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 76


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3B68 D7FD          M         bra     label
               00031 
               00032         ;; fetch 128 TIA parameters from EEPROM
3B6A 6A06      00033         clrf    TMP1
3B6C 0E00      00034     movlw   EEPROM_PATCH & 0xff
3B6E 6EA9      00035         movwf   EEADR
3B70 0E00      00036     movlw   (EEPROM_PATCH >> 8) & 0xff
3B72 6EAA      00037     movwf   EEADRH
3B74 C014 F011 00038     movff   TIA_PBANK, TIA_BANK
3B78 C013 F012 00039     movff   TIA_PATCH, TIA_PRESET
3B7C 00040 TIA_PATCH_InitEELoop
3B7C 5006      00041         movf    TMP1, W
3B7E EC59 F030 00042         call    TIA_SYSEX_TABLE_Get; get CC number
3B82 6E07      00043         movwf   TMP2            ; temporary store number in TMP2
               00044 
3B84 C006 FFA9 00045         movff   TMP1, EEADR     ; read parameter from current TIA bank
3B88 EC85 F01E 00046         call    TIA_BANK_Read
3B8C 6E03      00047     movwf       MIOS_PARAMETER1 ; store value in MIOS_PARAMETER1
               00048 
               00049         ;; branch depending on TMP2[7..4]
               00050         BRA_IFSET TMP2, 7, ACCESS, TIA_PATCH_InitEELoopS
3B8E BE07          M         btfsc   reg, bit, reg_a
3B90 D004          M         bra     label
3B92 00051 TIA_PATCH_InitEELoopN
               00052         ;; if TMP2[7] == 0, then set CC parameter
3B92 5007      00053         movf    TMP2, W
3B94 ECD9 F02D 00054         call    TIA_CCIN_Set
               00055         rgoto   TIA_PATCH_InitEELoopC
3B98 D008          M         bra     label
3B9A 00056 TIA_PATCH_InitEELoopS
               00057         ;; if TMP2[7..4] == 9, then set split point
3B9A 5007      00058         movf    TMP2, W
3B9C 0BF0      00059         andlw   0xf0
3B9E 0A90      00060         xorlw   0x90
3BA0 E104      00061         bnz     TIA_PATCH_InitEELoopC
3BA2 5007      00062         movf    TMP2, W
3BA4 D81D      00063         rcall   TIA_PATCH_GetSplitPointer
3BA6 C003 FFE7 00064         movff   MIOS_PARAMETER1, INDF1
3BAA 00065 TIA_PATCH_InitEELoopC
               00066 
3BAA 2A06      00067         incf    TMP1, F         ; increment CC counter, loop until 0x80
               00068         BRA_IFCLR TMP1, 7, ACCESS, TIA_PATCH_InitEELoop
3BAC AE06          M         btfss   reg, bit, reg_a
3BAE D7E6          M         bra     label
               00069 
               00070         ;; get and store the MIDI channels
3BB0 0E7C      00071         movlw   EEPROM_CFG_BASE & 0xff
3BB2 6EA9      00072         movwf   EEADR
3BB4 ECB0 F016 00073         call    MIOS_EEPROM_Read
3BB8 CFE8 F160 00074         movff   WREG, TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL
3BBC ECB0 F016 00075         call    MIOS_EEPROM_Read
3BC0 CFE8 F120 00076         movff   WREG, TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL
               00077         ;; get and store the device ID
3BC4 ECB0 F016 00078         call    MIOS_EEPROM_Read        
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 77


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00079 #if AUTO_DEVICE_ID
               00080         ;; if AUTO_ID enabled, derive the TIA device ID from the MIOS device ID instead
               00081         call    MIOS_MIDI_DeviceIDGet
               00082 #endif
3BC8 6E20      00083         movwf   TIA_MIDI_DEVICE
               00084     
3BCA ECB0 F016 00085     call        MIOS_EEPROM_Read
               00086     ;; Empty
               00087 
               00088         ;; force a refresh of all registers
3BCE 8210      00089         bsf     TIA_STAT, TIA_STAT_FORCE_REFRESH
               00090 
               00091         ;; enable TIA engine again
3BD0 9010      00092         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00093 
               00094 #if DEFAULT_TIA_DEBUG_ON == 1 
3BD2 8D64      00095     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PINIT
3BD4 ECC1 F01A 00096     call    TIA_Debug_EE_Do
3BD8 8C5B      00097     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PINIT
3BDA EC61 F01B 00098     call    TIA_Debug_BS_Do
               00099 #endif
3BDE 0012      00100         return
               00101 
               00102 
               00103 
               00104 ;; --------------------------------------------------------------------------
               00105 ;;  This help routine returns the pointer to TIA_Vx_SPLIT_xxx depending
               00106 ;;  on WREG
               00107 ;;  OUT: pointer in FSR1
               00108 ;; --------------------------------------------------------------------------
3BE0 00109 TIA_PATCH_GetSplitPointer
3BE0 EE11 F021 00110         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_SPLIT_LOWER
3BE4 B0E8      00111         btfsc   WREG, 0
3BE6 EE11 F022 00112         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_SPLIT_UPPER
               00113         
3BEA 30E8      00114         rrf     WREG, W
3BEC 0B01      00115         andlw   0x01
3BEE 0D40      00116         mullw   TIA_Vx_RECORD_LEN
3BF0 50F3      00117         movf    PRODL, W
3BF2 26E1      00118         addwf   FSR1L, F
3BF4 0012      00119         return
               00381 #include "tia_bank.inc"
               00001 ; $Id: tia_bank.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox SID
               00004 ; BankStick Handler
               00005 ;
               00006 ; (Bank Load/Store routines located in tia_pbank.inc and tia_ebank.inc)
               00007 ;
               00008 ; ==========================================================================
               00009 ;
               00010 ;  Copyright 1998-2007 Thorsten Klose (tk@midibox.org)
               00011 ;  Licensed for personal non-commercial use only.
               00012 ;  All other rights reserved.
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 78


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00013 ; 
               00014 ; ==========================================================================
               00015 
               00016 ;; --------------------------------------------------------------------------
               00017 ;;  Writes data to EEPROM or BankStick
               00018 ;;  IN: Value in WREG, address offset in EEADR
               00019 ;;  OUT: increments address
               00020 ;; --------------------------------------------------------------------------
3BF6 00021 TIA_BANK_Write
3BF6 6E11      00022         movwf   TIA_BANK                        ; temporary save word in TIA_BANK
               00023         ;; branch to internal patch if bankstick is not available or Patch is 0
3BF8 D8C9      00024         rcall   TIA_BANK_GetBankStickAvailable
3BFA E01C      00025         bz      TIA_BANK_WriteInternal
3BFC 5012      00026         movf    TIA_PRESET, W
3BFE E01A      00027         bz      TIA_BANK_WriteInternal
               00028 
               00029     ;; test BS Size 64/128 Patchs, 
               00030     ;rcall   TIA_BANK_GetBankStickSize
               00031     ;bnz     TIA_BANK_WriteBankStick
               00032     ;; exit if patch exceeds 63
               00033     ;btfsc      TIA_PRESET, 6
               00034     ;rgoto   TIA_BANK_WriteInternal
               00035 
3C00 00036 TIA_BANK_WriteBankStick                         ; BankStick write:
3C00 0E00      00037     movlw   0x00
3C02 0F00      00038     addlw   DEFAULT_BS_READONLY     ; exit if BS_READONLY
3C04 E10F      00039     bnz  TIA_BANK_WriteBankStick_NOk
3C06 00040 TIA_BANK_WriteBankStick_Ok    
               00041 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3C06 9562      00042     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3C08 825B      00043     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3C0A 945B      00044     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3C0C 965B      00045     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3C0E 805B      00046     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
               00047 #endif
3C10 D89D      00048         rcall   TIA_BANK_SetBankStickAddress
3C12 5005      00049         movf    MIOS_PARAMETER3, W              ; get byte from temp. register
3C14 ECBA F016 00050         call    MIOS_BANKSTICK_Write    ; write content
               00051         ;; here we could add an error exception handler
               00052 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS== 1
3C18 E00B      00053     bz      TIA_BANK_WriteBankStick_NOk_DebugSkp
3C1A 6E5C      00054     movwf   TIA_DEBUG_BS_REG1
3C1C 2A5D      00055     incf    TIA_DEBUG_BS_REG2, F
3C1E 865B      00056     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3C20 8A5B      00057     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_WRERR
               00058     rgoto   TIA_BANK_WriteBankStick_NOk_DebugSkp
3C22 D006          M         bra     label
               00059 #endif
3C24 00060 TIA_BANK_WriteBankStick_NOk
               00061 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3C24 9562      00062     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3C26 825B      00063     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3C28 945B      00064     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3C2A 865B      00065     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 79


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3C2C 885B      00066     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_READONLY
3C2E 805B      00067     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3C30 00068 TIA_BANK_WriteBankStick_NOk_DebugSkp    
               00069 #endif
3C30 2AA9      00070         incf    EEADR, F                ; increment EEPROM address
               00071         rgoto   TIA_BANK_Write_End
3C32 D01C          M         bra     label
               00072 
3C34 00073 TIA_BANK_WriteInternal
3C34 0E00      00074     movlw   0x00
3C36 0F01      00075     addlw   DEFAULT_EE_READONLY     ; exit if EE_READONLY
3C38 E00E      00076     bz      TIA_BANK_WriteInternal_Ok
               00077 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3C3A 8364      00078     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3C3C 9564      00079     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3C3E 8764      00080     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR
3C40 8964      00081     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_READONLY
3C42 8164      00082     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00083 #endif
3C44 2AA9      00084         incf    EEADR, F                ; increment EEADR
               00085         rgoto   TIA_BANK_Write_End              ; and goto end
3C46 D012          M         bra     label
               00086         ;; don't write if address in range between 0x7c and 0x7f (used to save channel and device number)
               00087         BRA_IFSET EEADR, 7, ACCESS, TIA_BANK_WriteInternal_Ok
3C48 BEA9          M         btfsc   reg, bit, reg_a
3C4A D005          M         bra     label
3C4C 0E7B      00088         movlw   0x7c-1
3C4E 64A9      00089         cpfsgt  EEADR, ACCESS
               00090         rgoto   TIA_BANK_WriteInternal_Ok
3C50 D002          M         bra     label
3C52 2AA9      00091         incf    EEADR, F                ; increment EEADR
               00092         rgoto   TIA_BANK_Write_End              ; and goto end
3C54 D00B          M         bra     label
3C56 00093 TIA_BANK_WriteInternal_Ok
               00094 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3C56 8364      00095     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3C58 9564      00096     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3C5A 8164      00097     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00098 #endif
3C5C 5005      00099         movf    MIOS_PARAMETER3, W              ; get byte from temp. register
3C5E ECB2 F016 00100         call    MIOS_EEPROM_Write               ; write to EEPROM
               00101         ;; here we could add an error exception handler
               00102 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3C62 E004      00103     bz      TIA_BANK_Write_End
3C64 6F65      00104     movwf   TIA_DEBUG_EE_REG1
3C66 2B66      00105     incf    TIA_DEBUG_EE_REG2, F
3C68 8764      00106     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR
3C6A 8B64      00107     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_WRERR
               00108 #endif
3C6C 00109 TIA_BANK_Write_End
               00110         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
3C6C 0101          M         movlb   HIGH(reg)
3C6E 0012      00111         return
               00112 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 80


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00113 ;; --------------------------------------------------------------------------
               00114 ;;  Writes a page of 64 bytes to EEPROM or BankStick
               00115 ;;  IN: Value in FSR1 buffer, address offset in EEADR
               00116 ;;  OUT: increments address
               00117 ;; --------------------------------------------------------------------------
3C70 00118 TIA_BANK_WritePage
               00119 
               00120         ;; align EEADR if necessary
3C70 0EC0      00121         movlw   0xc0
3C72 16A9      00122         andwf   EEADR, F
               00123 
               00124         ;; branch to internal patch if bankstick is not available or Patch is 0
3C74 5012      00125         movf    TIA_PRESET, W
3C76 E022      00126         bz      TIA_BANK_WritePageInternal
               00127 
3C78 00128 TIA_BANK_WritePageBankStick                     ; BankStick write:
3C78 0E00      00129     movlw   0x00
3C7A 0F00      00130     addlw   DEFAULT_BS_READONLY     ; exit if BS_READONLY
3C7C E009      00131     bz      TIA_BANK_WritePageBankStick_Ok
3C7E 00132 TIA_BANK_WritePageBankStick_ReadOnly
               00133     ;;  BS Read Only Error #0x02
3C7E 0E02      00134     movlw   0x02
3C80 6E26      00135     movwf   TIA_SYSEX_ERROR
               00136 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3C82 9562      00137     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3C84 825B      00138     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3C86 845B      00139     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3C88 865B      00140     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3C8A 885B      00141     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_READONLY
3C8C 805B      00142     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
               00143  #endif
               00144     rgoto TIA_BANK_WritePageBankStick_End
3C8E D013          M         bra     label
               00145    
3C90 00146 TIA_BANK_WritePageBankStick_Ok    
               00147 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3C90 9562      00148     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3C92 825B      00149     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3C94 845B      00150     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3C96 965B      00151     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3C98 805B      00152     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3C9A C011 F05E 00153     movff   TIA_BANK, TIA_DEBUG_BS_REG3
3C9E C012 F05F 00154     movff   TIA_PRESET, TIA_DEBUG_BS_REG4
               00155 #endif
3CA2 D854      00156         rcall   TIA_BANK_SetBankStickAddress
               00157         ;; buffer already prepared in FSR1
3CA4 ECF2 F016 00158         call    MIOS_BANKSTICK_WritePage        ; write page
               00159         ;; here we could add an error exception handler
3CA8 E006      00160     bz      TIA_BANK_WritePageBankStick_End
               00161     ;;  BS WritePage Error #0x07
3CAA 0E07      00162     movlw   0x07
3CAC 6E26      00163     movwf   TIA_SYSEX_ERROR
               00164 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS== 1
3CAE 6E5C      00165     movwf   TIA_DEBUG_BS_REG1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 81


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3CB0 2A5D      00166     incf    TIA_DEBUG_BS_REG2, F
3CB2 865B      00167     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3CB4 8A5B      00168     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_WRERR
               00169 #endif
3CB6 00170 TIA_BANK_WritePageBankStick_End
3CB6 0E40      00171         movlw   0x40                            ; increment EEPROM address by 0x40
3CB8 26A9      00172         addwf   EEADR, F
               00173         rgoto   TIA_BANK_WritePage_End
3CBA D025          M         bra     label
               00174 
3CBC 00175 TIA_BANK_WritePageInternal
3CBC 6A12      00176     clrf    TIA_PRESET
3CBE 0E00      00177     movlw   0x00
3CC0 0F01      00178     addlw   DEFAULT_EE_READONLY     ; exit if EE_READONLY
3CC2 E00A      00179     bz      TIA_BANK_WritePageInternalLoop
               00180     ;; Internal EE Readonly Error #1
3CC4 0E01      00181     movlw   0x01
3CC6 6E26      00182     movwf   TIA_SYSEX_ERROR
               00183 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3CC8 8364      00184     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3CCA 8564      00185     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3CCC 8764      00186     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR
3CCE 8964      00187     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_READONLY
3CD0 8164      00188     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00189 #endif
3CD2 0E40      00190     movlw   0x40
3CD4 26A9      00191         addwf   EEADR, F                        ; increment EEADR
               00192         rgoto   TIA_BANK_WritePage_End          ; and goto next
3CD6 D017          M         bra     label
               00193         ;; write 64 bytes
3CD8 00194 TIA_BANK_WritePageInternalLoop
               00195 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3CD8 8364      00196     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3CDA 8564      00197     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3CDC 8164      00198     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00199 #endif
               00200         ;; don't write if address in range between 0x7c and 0x7f (used to save channel and device number)
               00201         BRA_IFSET EEADR, 7, ACCESS, TIA_BANK_WritePageInternal_Ok
3CDE BEA9          M         btfsc   reg, bit, reg_a
3CE0 D005          M         bra     label
3CE2 0E7B      00202         movlw   0x7c-1
3CE4 64A9      00203         cpfsgt  EEADR, ACCESS
               00204         rgoto   TIA_BANK_WritePageInternal_Ok
3CE6 D002          M         bra     label
3CE8 2AA9      00205         incf    EEADR, F                        ; increment EEADR
               00206         rgoto   TIA_BANK_WritePage_Next         ; and goto next
3CEA D00A          M         bra     label
3CEC 00207 TIA_BANK_WritePageInternal_Ok
3CEC 50A9      00208         movf    EEADR, W
3CEE 0B3F      00209         andlw   0x3f
3CF0 50E3      00210         movf    PLUSW1, W                       ; get byte from buffer
3CF2 ECB2 F016 00211         call    MIOS_EEPROM_Write               ; write to EEPROM
               00212         ;; here we could add an error exception handler
               00213 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 82


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3CF6 E004      00214     bz      TIA_BANK_WritePage_Next
3CF8 6F65      00215     movwf   TIA_DEBUG_EE_REG1
3CFA 2B66      00216     incf    TIA_DEBUG_EE_REG2, F
3CFC 8764      00217     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR
3CFE 8B64      00218     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_WRERR
               00219 #endif
3D00 00220 TIA_BANK_WritePage_Next
3D00 50A9      00221         movf    EEADR, W
3D02 0B3F      00222         andlw   0x3f
3D04 E1E9      00223         bnz     TIA_BANK_WritePageInternalLoop
               00224 
3D06 00225 TIA_BANK_WritePage_End
               00226         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
3D06 0101          M         movlb   HIGH(reg)
3D08 0012      00227         return
               00228 
               00229     
               00230 ;; --------------------------------------------------------------------------
               00231 ;;  Read data from EEPROM or BankStick
               00232 ;;  IN: address offset in EEADR,
               00233 ;;      internal perset in EEADRH, 
               00234 ;;      Patch number in MIOS_PARAMETER2,
               00235 ;;      Bank number in TIA_BANK.
               00236 ;;  OUT: 7-bit result in WREG, increments address
               00237 ;; --------------------------------------------------------------------------
               00238 
3D0A 00239 TIA_BANK_Read
               00240         ;; branch to internal patch if bankstick is not available or Patch is 0    
3D0A 5011      00241     movf    TIA_BANK, W
3D0C D837      00242     rcall   TIA_BANK_GetBankStickReady
3D0E E013      00243         bz      TIA_BANK_ReadInternal
3D10 5012      00244         movf    TIA_PRESET, W
3D12 E011      00245         bz      TIA_BANK_ReadInternal
               00246      
3D14 D840      00247     rcall   TIA_BANK_GetBankStickSize
3D16 E102      00248     bnz     TIA_BANK_ReadBankStick
               00249 
3D18 BC12      00250     btfsc       TIA_PRESET, 6
               00251     rgoto   TIA_BANK_Read_End    
3D1A D013          M         bra     label
               00252 
3D1C 00253 TIA_BANK_ReadBankStick                          ; BankStick read:
               00254 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3D1C 9562      00255     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3D1E 925B      00256     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3D20 945B      00257     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3D22 805B      00258     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3D24 C011 F05E 00259     movff   TIA_BANK, TIA_DEBUG_BS_REG3
3D28 C012 F05F 00260     movff   TIA_PRESET, TIA_DEBUG_BS_REG4
               00261 #endif
3D2C D80F      00262         rcall   TIA_BANK_SetBankStickAddress
3D2E ECB8 F016 00263         call    MIOS_BANKSTICK_Read             ; read content
3D32 2AA9      00264         incf    EEADR, F                        ; increment EEPROM address
               00265         rgoto   TIA_BANK_Read_End
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 83


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3D34 D006          M         bra     label
               00266         
3D36 00267 TIA_BANK_ReadInternal
               00268 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3D36 9364      00269     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3D38 9564      00270     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3D3A 8164      00271     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00272 #endif
3D3C 6A12      00273         clrf    TIA_PRESET
3D3E ECB0 F016 00274         call    MIOS_EEPROM_Read
               00275 
3D42 00276 TIA_BANK_Read_End
               00277         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
3D42 0101          M         movlb   HIGH(reg)
3D44 0012      00278         return
               00279 
               00280 
               00281 ;; --------------------------------------------------------------------------
               00282 ;;  This function sets a BankStick address
               00283 ;;  IN: patch offset in EEADR
               00284 ;;      patch number in MIOS_PARAMETER2
               00285 ;;      BankStick number in TIA_BANK
               00286 ;;  OUT: address in MIOS_PARAMETER[12]
               00287 ;;       BankStick selected via MIOS_BANKSTICK_CtrlSet
               00288 ;; --------------------------------------------------------------------------
3D46 00289 TIA_BANK_SetBankStickAddressMagic
3D46 6A03      00290     clrf    MIOS_PARAMETER1
3D48 6A04      00291     clrf    MIOS_PARAMETER2
               00292     rgoto TIA_BANK_SetBankStickAddress_Cont
3D4A D006          M         bra     label
               00293 
3D4C 00294 TIA_BANK_SetBankStickAddress
               00295 
3D4C CFA9 F003 00296         movff   EEADR, MIOS_PARAMETER1          ; copy address to low-byte
3D50 B012      00297     btfsc       TIA_PRESET, 0
3D52 8E03      00298         bsf     MIOS_PARAMETER1, 7              ; select upper address range on odd bank number
3D54 4012      00299     rrncf   TIA_PRESET, W      ; high-byte
3D56 6E04      00300     movwf   MIOS_PARAMETER2
               00301 
3D58 00302 TIA_BANK_SetBankStickAddress_Cont
3D58 501A      00303         movf    TIA_BANKSTICK_ID, W
               00304 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3D5A 0F80      00305     addlw   0x80        ; (Enable verify slower write accesses)
               00306 #endif
3D5C ECEE F016 00307         call    MIOS_BANKSTICK_CtrlSet
               00308         
3D60 D81A      00309     rcall   TIA_BANK_GetBankStickSize
3D62 B4D8      00310         skpnz
               00311     rgoto   TIA_BANK_SetBankStickAddress_32k
3D64 D005          M         bra     label
               00312     
3D66 00313 TIA_BANK_SetBankStickAddress_64k
3D66 B011      00314         btfsc   TIA_BANK, 0
3D68 8C04      00315         bsf     MIOS_PARAMETER2, 6
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 84


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3D6A B211      00316     btfsc       TIA_BANK, 1
3D6C 8E04      00317         bsf     MIOS_PARAMETER2, 7
               00318     rgoto   TIA_BANK_SetBankStickAddress_End
3D6E D005          M         bra     label
               00319     
3D70 00320 TIA_BANK_SetBankStickAddress_32k
3D70 9A04      00321     bcf MIOS_PARAMETER2, 5
3D72 B011      00322         btfsc   TIA_BANK, 0
3D74 8A04      00323         bsf     MIOS_PARAMETER2, 5
3D76 B211      00324     btfsc       TIA_BANK, 1
3D78 8C04      00325         bsf     MIOS_PARAMETER2, 6
               00326 
3D7A 00327 TIA_BANK_SetBankStickAddress_End
3D7A 0012      00328     return
               00329     
               00330 
               00331 ;; --------------------------------------------------------------------------
               00332 ;;  This function returns the bankstick available status for the current bank
               00333 ;;  IN: Bank number WREG
               00334 ;;  OUT: WREG != 0 when bankstick available
               00335 ;; --------------------------------------------------------------------------
3D7C 00336 TIA_BANK_GetBankStickReady
3D7C 40E8      00337     rrncf   WREG, W
3D7E 40E8      00338     rrncf   WREG, W
3D80 0B07      00339     andlw   0x07
3D82 6E1A      00340     movwf       TIA_BANKSTICK_ID
3D84 ECC6 F016 00341         call    MIOS_HLP_GetBitORMask
3D88 141B      00342         andwf   TIA_BANKSTICK_RDY, W
3D8A 0012      00343         return
               00344     
               00345 ;; --------------------------------------------------------------------------
               00346 ;;  This function returns the bankstick available status for the current bank
               00347 ;;  IN: BankStick number in TIA_PBANK
               00348 ;;  OUT: WREG != 0 when bankstick available
               00349 ;; --------------------------------------------------------------------------
3D8C 00350 TIA_BANK_GetBankStickAvailable
3D8C 501A      00351     movf        TIA_BANKSTICK_ID, W
3D8E ECC6 F016 00352         call    MIOS_HLP_GetBitORMask
3D92 141C      00353         andwf   TIA_BANKSTICK_STAT, W
3D94 0012      00354         return
               00355 ;; --------------------------------------------------------------------------
               00356 ;;  This function returns the bankstick available status for the current bank
               00357 ;;  IN: BankStick number in TIA_BANKSTICK_ID
               00358 ;;  OUT: BankStick size in WREG and TIA_BANKSTICK_SIZE
               00359 ;; --------------------------------------------------------------------------
3D96 00360 TIA_BANK_GetBankStickSize
3D96 501A      00361     movf        TIA_BANKSTICK_ID, W
3D98 ECC6 F016 00362         call    MIOS_HLP_GetBitORMask
3D9C 141D      00363         andwf   TIA_BANKSTICK_SIZE, W
3D9E 0012      00364         return
               00365     
               00366 
               00367 
               00368 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 85


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00369 ;; selects address of magic number depending on TIA_BANKSTICK_CHK_CTR
               00370 ;; TIA_BANKSTICK_CHK_CTR or TIA_PBANK
               00371 ;; --------------------------------------------------------------------------
3DA0 00372 TIA_BANK_CheckStick_SelectMagic
               00373         ;; select BankStick depending on TIA_BANKSTICK_CHK_CTR
3DA0 6E05      00374     movwf   MIOS_PARAMETER3
3DA2 40E8      00375     rrncf   WREG, W
3DA4 40E8      00376     rrncf   WREG, W
3DA6 0B07      00377     andlw   0x07
3DA8 0F80      00378     addlw   0x80        ; (Enable verify slower write accesses)
3DAA ECEE F016 00379         call    MIOS_BANKSTICK_CtrlSet
               00380 
               00381         ;; determine if this is a 64k BankStick:
               00382         ;; read from address 0x8000, store value in PRODL
3DAE 0E0F      00383         movlw   0x0f ;; between 0x03 - 0x7f
3DB0 6E03      00384         movwf   MIOS_PARAMETER1
3DB2 0E80      00385         movlw   0x80
3DB4 6E04      00386         movwf   MIOS_PARAMETER2
3DB6 ECB8 F016 00387         call    MIOS_BANKSTICK_Read
3DBA 6EF3      00388         movwf   PRODL
               00389 
               00390         ;; add 0x42 and write number to 0x0000
3DBC 0E0F      00391         movlw   0x0f ;; between 0x03 - 0x7f
3DBE 6E03      00392         movwf   MIOS_PARAMETER1
3DC0 6A04      00393         clrf    MIOS_PARAMETER2
3DC2 50F3      00394     movf    PRODL, W
3DC4 0F42      00395         addlw   0x42
3DC6 ECBA F016 00396         call    MIOS_BANKSTICK_Write
               00397 
               00398         ;; read again number from 0x8000, check if we still see the old value
3DCA 0E0F      00399         movlw   0x0f ;; between 0x03 - 0x7f
3DCC 6E03      00400         movwf   MIOS_PARAMETER1
3DCE 0E80      00401         movlw   0x80
3DD0 6E04      00402         movwf   MIOS_PARAMETER2
3DD2 ECB8 F016 00403         call    MIOS_BANKSTICK_Read
3DD6 18F3      00404         xorwf   PRODL, W
3DD8 E107      00405     bnz     TIA_BANK_CheckStick_SelectMagic_32k
3DDA 00406 TIA_BANK_CheckStick_SelectMagic_64k     ; (64k device)
               00407         ;; try to read from BankStick (address 0x0000, 0x4000, 0x8000 or 0xc000)
3DDA 6A03      00408         clrf    MIOS_PARAMETER1
3DDC 6A04      00409         clrf    MIOS_PARAMETER2
3DDE B005      00410         btfsc   MIOS_PARAMETER3, 0
3DE0 8C04      00411         bsf     MIOS_PARAMETER2, 6
3DE2 B205      00412     btfsc       MIOS_PARAMETER3, 1
3DE4 8E04      00413         bsf     MIOS_PARAMETER2, 7
               00414     rgoto   TIA_BANK_CheckStick_SelectMagic_End
3DE6 D006          M         bra     label
               00415     
3DE8 00416 TIA_BANK_CheckStick_SelectMagic_32k     ; (32k device)
               00417         ;; try to read from BankStick (address 0x0000, 0x2000, 0x4000 or 0x0600)
3DE8 6A03      00418         clrf    MIOS_PARAMETER1
3DEA 6A04      00419         clrf    MIOS_PARAMETER2
3DEC B005      00420         btfsc   MIOS_PARAMETER3, 0
3DEE 8A04      00421         bsf     MIOS_PARAMETER2, 5
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 86


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3DF0 B205      00422     btfsc       MIOS_PARAMETER3, 1
3DF2 8C04      00423         bsf     MIOS_PARAMETER2, 6
               00424     ;; rgoto   TIA_BANK_CheckStick_SelectMagic_End
3DF4 00425 TIA_BANK_CheckStick_SelectMagic_End
3DF4 0012      00426         return
               00427 
               00428 
               00429 
               00430 
               00431 
               00432 ;; --------------------------------------------------------------------------
               00433 ;;  Check Stick: try to read from BankStick, clear the appr. flag in
               00434 ;;  TIA_BANKSTICK_STAT if BankStick not available
               00435 ;; --------------------------------------------------------------------------
3DF6 00436 TIA_BANK_CheckStick
               00437 
               00438         ;; increment check counter, wrap at 32
3DF6 2819      00439         incf    TIA_BANKSTICK_CHK_CTR, W
3DF8 0B1F      00440         andlw   0x1f
3DFA 6E19      00441         movwf   TIA_BANKSTICK_CHK_CTR
               00442     
3DFC 90D8      00443     clrc
3DFE 4019      00444         rrncf   TIA_BANKSTICK_CHK_CTR, W
3E00 40E8      00445     rrncf   WREG, W
3E02 0B07      00446     andlw   0x07
3E04 6E1A      00447     movwf   TIA_BANKSTICK_ID
               00448     
               00449         ;; select "magic number" and try to read from BankStick
3E06 5019      00450     movf    TIA_BANKSTICK_CHK_CTR, W
3E08 DFCB      00451         rcall   TIA_BANK_CheckStick_SelectMagic
               00452 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3E0A C004 F05D 00453     movff   MIOS_PARAMETER2, TIA_DEBUG_BS_REG2
               00454 #endif
3E0E ECB8 F016 00455         call    MIOS_BANKSTICK_Read
               00456         ;; this sets the MIOS_BOX_STAT_BS_AVAILABLE flag
               00457 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3E12 C002 F05C 00458     movff   MIOS_BOX_STAT, TIA_DEBUG_BS_REG1 
               00459 #endif
               00460 
               00461         ;; save old BankStick status in TMP1
3E16 C01C F006 00462         movff   TIA_BANKSTICK_STAT, TMP1
               00463 
               00464         ;; modify the available flag of current bankstick
               00465         BRA_IFSET MIOS_BOX_STAT, MIOS_BOX_STAT_BS_AVAILABLE, ACCESS, TIA_BANK_CheckStick_AccPassed
3E1A B002          M         btfsc   reg, bit, reg_a
3E1C D005          M         bra     label
3E1E 00466 TIA_BANK_CheckStick_AccFailed
3E1E 501A      00467         movf    TIA_BANKSTICK_ID, W
3E20 ECC4 F016 00468         call    MIOS_HLP_GetBitANDMask
3E24 141C      00469         andwf   TIA_BANKSTICK_STAT, W
               00470         rgoto   TIA_BANK_CheckStick_AccCont
3E26 D004          M         bra     label
3E28 00471 TIA_BANK_CheckStick_AccPassed
3E28 501A      00472         movf    TIA_BANKSTICK_ID, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 87


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3E2A ECC6 F016 00473         call    MIOS_HLP_GetBitORMask
3E2E 101C      00474         iorwf   TIA_BANKSTICK_STAT, W
3E30 00475 TIA_BANK_CheckStick_AccCont
3E30 6E07      00476     movwf   TMP2
               00477 
               00478         ;; check if flag has been changed
3E32 5007      00479         movf    TMP2, W
3E34 1806      00480         xorwf   TMP1, W
3E36 E00A      00481     bz  TIA_BANK_CheckStick_End
3E38 8010      00482     bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE, ACCESS
               00483 
               00484 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3E3A 805B      00485     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3E3C 8562      00486     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
               00487 #endif
               00488  
               00489     ;; flag changed - branch depending on available status
3E3E 501A      00490         movf    TIA_BANKSTICK_ID, W
3E40 ECC6 F016 00491         call    MIOS_HLP_GetBitORMask
3E44 1407      00492         andwf   TMP2, W
3E46 E150      00493         bnz     TIA_BANK_CheckStick_Ext
               00494     rgoto TIA_BANK_CheckStick_Int
3E48 D002          M         bra     label
3E4A 9010      00495     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
3E4C 00496 TIA_BANK_CheckStick_End    
3E4C 0012      00497     return
               00498 
               00499 
               00500 
               00501 
               00502         ;; ------------------------------------------------------------------
               00503         ;; --> Internal Patch
3E4E 00504 TIA_BANK_CheckStick_Int
               00505 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3E4E 9962      00506     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT
               00507 #endif
3E50 00508 TIA_BANK_CheckStick_IntReload
               00509         ;;      TABLE_ADDR TEXT_INTBANK_0               ; print message
               00510         ;;      call    MIOS_LCD_PrintMessage
               00511         ;;      call    MIOS_LCD_PrintMessage
               00512     
               00513     ;; reset size
3E50 5007      00514     movf        TMP2, W
3E52 161D      00515         andwf   TIA_BANKSTICK_SIZE, F
               00516 
3E54 00517 TIA_BANK_CheckStick_Int_StatOk
3E54 C007 F01C 00518     movff   TMP2, TIA_BANKSTICK_STAT
3E58 EC86 F01D 00519     call    TIA_LEDMTR_PlayOtoR         ;; play mled orange to red pattern 
3E5C EC4D F021 00520     call        TIA_TUNE_PlayDisconnect     ;; play tune 5    
3E60 EC9C F01D 00521     call    TIA_LEDMTR_Player_Off
               00522     
               00523         ;; branch depending on patch/kit BankStick
               00524 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
3E64 0E04      00525         movlw   DEFAULT_BS_KBANK_ID-1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 88


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3E66 641A      00526         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00527         rgoto   TIA_BANK_CheckStick_Int_P
3E68 D02A          M         bra     label
3E6A B219      00528     btfsc   TIA_BANKSTICK_CHK_CTR, 1
               00529     rgoto       TIA_BANK_CheckStick_Int_WT
3E6C D014          M         bra     label
               00530     
3E6E 00531 TIA_BANK_CheckStick_Int_K
               00532 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3E6E 8162      00533     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
3E70 9362      00534     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
               00535 #endif
3E72 501A      00536         movf    TIA_BANKSTICK_ID, W         ;; clear flag
3E74 ECC4 F016 00537         call    MIOS_HLP_GetBitANDMask
3E78 161B      00538         andwf   TIA_BANKSTICK_RDY, F   
3E7A 0E05      00539     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
3E7C 6E25      00540     movwf   TIA_SYSEX_ADDRESS
3E7E ECB5 F02C 00541         call    _TIA_SYSEX_End_CFG_Read 
3E82 5019      00542     movf    TIA_BANKSTICK_CHK_CTR, W
3E84 1816      00543     xorwf   TIA_KBANK, W
3E86 E12F      00544     bnz     TIA_BANK_CheckStick_Int_End
3E88 6A16      00545     clrf    TIA_KBANK                   ;; Reinit to...
3E8A 6A15      00546     clrf    TIA_KIT
3E8C 0E0F      00547     movlw   0x0f                        ;; send sysex CFG All
3E8E 6E25      00548     movwf   TIA_SYSEX_ADDRESS
3E90 ECB5 F02C 00549         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
               00550         rgoto   TIA_BANK_CheckStick_Int_End 
3E94 D028          M         bra     label
               00551     
3E96 00552 TIA_BANK_CheckStick_Int_WT
               00553 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3E96 8162      00554     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
3E98 8362      00555     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
               00556 #endif
3E9A 501A      00557         movf    TIA_BANKSTICK_ID, W         ;; clear flag
3E9C ECC4 F016 00558         call    MIOS_HLP_GetBitANDMask
3EA0 161B      00559         andwf   TIA_BANKSTICK_RDY, F   
3EA2 0E05      00560     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
3EA4 6E25      00561     movwf   TIA_SYSEX_ADDRESS
3EA6 ECB5 F02C 00562         call    _TIA_SYSEX_End_CFG_Read 
3EAA 5019      00563     movf    TIA_BANKSTICK_CHK_CTR, W
3EAC 1818      00564     xorwf   TIA_WBANK, W
3EAE E11B      00565     bnz     TIA_BANK_CheckStick_Int_End
3EB0 6A18      00566     clrf    TIA_WBANK                   ;; Reinit to...
3EB2 6A17      00567     clrf    TIA_WT
3EB4 0E0F      00568     movlw   0x0f                        ;; send sysex CFG All
3EB6 6E25      00569     movwf   TIA_SYSEX_ADDRESS
3EB8 ECB5 F02C 00570         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
               00571         rgoto   TIA_BANK_CheckStick_Int_End 
3EBC D014          M         bra     label
               00572 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00573 
3EBE 00574 TIA_BANK_CheckStick_Int_P
               00575 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 89


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3EBE 9162      00576     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
               00577 #endif
3EC0 501A      00578         movf    TIA_BANKSTICK_ID, W         ;; clear flag
3EC2 ECC4 F016 00579         call    MIOS_HLP_GetBitANDMask
3EC6 161B      00580         andwf   TIA_BANKSTICK_RDY, F   
3EC8 0E05      00581     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
3ECA 6E25      00582     movwf   TIA_SYSEX_ADDRESS
3ECC ECB5 F02C 00583         call    _TIA_SYSEX_End_CFG_Read 
3ED0 5019      00584     movf    TIA_BANKSTICK_CHK_CTR, W
3ED2 1814      00585     xorwf   TIA_PBANK, W
3ED4 E108      00586     bnz     TIA_BANK_CheckStick_Int_End
3ED6 6A14      00587     clrf    TIA_PBANK                   ;; Reinit to...
3ED8 6A13      00588     clrf    TIA_PATCH
3EDA 0E0F      00589     movlw   0x0f                        ;; send sysex CFG All
3EDC 6E25      00590     movwf   TIA_SYSEX_ADDRESS
3EDE ECB5 F02C 00591         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
3EE2 ECAD F01D 00592         call    TIA_PATCH_Init
               00593         ;;rgoto TIA_BANK_CheckStick_Int_End 
               00594     
3EE6 00595 TIA_BANK_CheckStick_Int_End    
3EE6 0012      00596         return
               00597 
               00598 
               00599         ;; ------------------------------------------------------------------
               00600         ;; --> External Patch
3EE8 00601 TIA_BANK_CheckStick_Ext
               00602 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3EE8 8962      00603     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT
               00604 #endif
               00605         ;;      TABLE_ADDR TEXT_EXTBANK_0               ; print message
               00606         ;;      call    MIOS_LCD_PrintMessage
               00607         ;;      call    MIOS_LCD_PrintMessage
               00608 
               00609         ;; new setup will be reloaded automatically
               00610         ;; set reinit counter - CS configuration will be restored after one second
               00611         ;movlw  10
               00612         ;movwf  CS_MENU_REINIT_CFG_CTR
               00613 
               00614         ;; now check if the magic numbers exist in bankstick bank - if not, format bank automatically
3EEA 0E32      00615         movlw   50                              ; wait some ms to get a stable status
3EEC ECCE F016 00616         call    MIOS_Delay                      
               00617 
3EF0 5019      00618     movf    TIA_BANKSTICK_CHK_CTR, W
3EF2 DF56      00619         rcall   TIA_BANK_CheckStick_SelectMagic
3EF4 ECB8 F016 00620         call    MIOS_BANKSTICK_Read
               00621 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3EF8 6E5E      00622     movwf   TIA_DEBUG_BS_REG3
               00623 #endif
3EFA 0A83      00624         xorlw   BANKSTICK_MAGIC0                ; branch to unformatted message if number not equal
3EFC A4D8      00625     skpz
               00626         rgoto   TIA_BANK_CheckStick_Unformatted
3EFE D073          M         bra     label
               00627     
               00628     ;; magic numbers are different between Patch/Kit-WT bankstick
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 90


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00629 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
3F00 0E04      00630         movlw   DEFAULT_BS_KBANK_ID-1
3F02 641A      00631         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00632         rgoto   TIA_BANK_CheckStick_Ext_P
3F04 D017          M         bra     label
               00633 
               00634 ;; Kit / Wavetable
3F06 00635 TIA_BANK_CheckStick_Ext_K 
               00636     ;; Magic ( Kit suite)
               00637     ;; set bankstick type depending on second byte (BANKSTICK_MAGICK/P)
               00638 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F06 501A      00639         movf    TIA_BANKSTICK_ID, W
3F08 ECC6 F016 00640         call    MIOS_HLP_GetBitORMask
3F0C 1363      00641         iorwf   TIA_DEBUG_BS_REG9, F
               00642 #endif
3F0E ECB8 F016 00643         call    MIOS_BANKSTICK_Read 
3F12 6E06      00644     movwf   TMP1
               00645 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F14 6E5F      00646     movwf   TIA_DEBUG_BS_REG4
               00647 #endif
3F16 0A13      00648         xorlw   BANKSTICK_MAGICK
3F18 E009      00649         bz      TIA_BANK_CheckStrick_Ext_Type_K
3F1A 00650 TIA_BANK_CheckStrick_Ext_Type_NotK
3F1A 5006      00651     movf    TMP1, W
3F1C 0A12      00652     xorlw       BANKSTICK_MAGICP
3F1E A4D8      00653     skpz
               00654     rgoto       TIA_BANK_CheckStick_Unformatted             ;; format
3F20 D062          M         bra     label
3F22 0E01      00655     movlw   DEFAULT_BS_FPROTECT          ;; type format protection
3F24 0A01      00656     xorlw   0x01
3F26 B4D8      00657     skpnz
               00658     rgoto   TIA_BANK_CheckStick_Unformatted_TProtect    ;; exit
3F28 D06B          M         bra     label
               00659     rgoto   TIA_BANK_CheckStick_Unformatted             ;; format
3F2A D05D          M         bra     label
3F2C 00660 TIA_BANK_CheckStrick_Ext_Type_K
3F2C 0E13      00661     movlw   BANKSTICK_MAGICK            ;; valid type
3F2E 6E06      00662     movwf   TMP1
               00663 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F30 8162      00664     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
               00665 #endif
               00666         rgoto   TIA_BANK_CheckStick_Ext_Size
3F32 D016          M         bra     label
               00667 #endif      ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00668 
               00669 ;; Patch
3F34 00670 TIA_BANK_CheckStick_Ext_P 
               00671     ;; Magic (Patch suite)
               00672     ;; set bankstick type depending on second byte (BANKSTICK_MAGICK/P)
               00673 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F34 501A      00674         movf    TIA_BANKSTICK_ID, W
3F36 ECC4 F016 00675         call    MIOS_HLP_GetBitANDMask
3F3A 1763      00676         andwf   TIA_DEBUG_BS_REG9, F
               00677 #endif
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 91


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3F3C ECB8 F016 00678         call    MIOS_BANKSTICK_Read 
3F40 6E06      00679     movwf   TMP1
               00680 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F42 6E5F      00681     movwf   TIA_DEBUG_BS_REG4
               00682 #endif
3F44 0A12      00683         xorlw   BANKSTICK_MAGICP
3F46 E009      00684         bz      TIA_BANK_CheckStrick_Ext_Type_P
3F48 00685 TIA_BANK_CheckStrick_Ext_Type_NotP
3F48 5006      00686     movf    TMP1, W
3F4A 0A13      00687     xorlw       BANKSTICK_MAGICK            
3F4C A4D8      00688     skpz
               00689     rgoto       TIA_BANK_CheckStick_Unformatted             ;; format
3F4E D04B          M         bra     label
3F50 0E01      00690     movlw   DEFAULT_BS_FPROTECT          ;; type format protection
3F52 0A01      00691     xorlw   0x01
3F54 B4D8      00692     skpnz
               00693     rgoto   TIA_BANK_CheckStick_Unformatted_TProtect    ;; exit
3F56 D054          M         bra     label
               00694     rgoto   TIA_BANK_CheckStick_Unformatted             ;; format
3F58 D046          M         bra     label
3F5A 00695 TIA_BANK_CheckStrick_Ext_Type_P         ;; valid type
3F5A 0E12      00696     movlw   BANKSTICK_MAGICP
3F5C 6E06      00697     movwf   TMP1
               00698 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F5E 9162      00699     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
               00700 #endif
               00701         ;;rgoto TIA_BANK_CheckStick_Ext_Size
               00702 
3F60 00703 TIA_BANK_CheckStick_Ext_Size
               00704     ;; set bankstick size depending on third byte (32=32k, 64=64k)
               00705 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F60 9762      00706     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE
               00707 #endif
3F62 501A      00708         movf    TIA_BANKSTICK_ID, W
3F64 ECC4 F016 00709         call    MIOS_HLP_GetBitANDMask
3F68 161D      00710         andwf   TIA_BANKSTICK_SIZE, F       ;; clear size
3F6A ECB8 F016 00711         call    MIOS_BANKSTICK_Read
3F6E 0A40      00712         xorlw   64
3F70 E105      00713         bnz     TIA_BANK_CheckStrick_Ext_Not64k
3F72 00714 TIA_BANK_CheckStrick_Ext_64k
               00715 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F72 8762      00716     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE
               00717 #endif
3F74 501A      00718         movf    TIA_BANKSTICK_ID, W
3F76 ECC6 F016 00719         call    MIOS_HLP_GetBitORMask
3F7A 121D      00720         iorwf   TIA_BANKSTICK_SIZE, F       ;; set size
3F7C 00721 TIA_BANK_CheckStrick_Ext_Not64k
               00722 
3F7C 00723 TIA_BANK_CheckStick_Ext_Fix ; to do if necessary...
               00724         ;; fix patches if required (and enabled via ENABLE_PATCH_FIXING)
               00725     ;movff      TIA_BANKSTICK_CHK_CTR, TIA_PBANK
               00726         ;rcall  TIA_BANK_FixPatches
               00727         ;; ok
               00728     
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 92


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3F7C 00729 TIA_BANK_CheckStick_Ext_Stat
               00730 
3F7C 5019      00731     movf    TIA_BANKSTICK_CHK_CTR, W
               00732     
3F7E 5019      00733     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 1st bank of current BS
3F80 0B1C      00734     andlw   0x1c
3F82 DF0E      00735         rcall   TIA_BANK_CheckStick_SelectMagic
3F84 ECB8 F016 00736         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
3F88 0A83      00737         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
3F8A E12C      00738         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
3F8C ECB8 F016 00739         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
3F90 1806      00740         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
3F92 E128      00741         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00742 
3F94 5019      00743     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 2nd bank of current BS
3F96 0B1C      00744     andlw   0x1c
3F98 0F01      00745     addlw   0x01
3F9A DF02      00746         rcall   TIA_BANK_CheckStick_SelectMagic
3F9C ECB8 F016 00747         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
3FA0 0A83      00748         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
3FA2 E120      00749         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
3FA4 ECB8 F016 00750         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
3FA8 1806      00751         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
3FAA E11C      00752         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00753     
3FAC 5019      00754     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 3rd bank of current BS
3FAE 0B1C      00755     andlw   0x1c
3FB0 0F02      00756     addlw   0x02
3FB2 DEF6      00757         rcall   TIA_BANK_CheckStick_SelectMagic
3FB4 ECB8 F016 00758         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
3FB8 0A83      00759         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
3FBA E114      00760         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
3FBC ECB8 F016 00761         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
3FC0 1806      00762         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
3FC2 E110      00763         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00764     
3FC4 5019      00765     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 4th bank of current BS
3FC6 0B1C      00766     andlw   0x1c
3FC8 0F03      00767     addlw   0x03
3FCA DEEA      00768         rcall   TIA_BANK_CheckStick_SelectMagic
3FCC ECB8 F016 00769         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
3FD0 0A83      00770         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
3FD2 E108      00771         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
3FD4 ECB8 F016 00772         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
3FD8 1806      00773         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
3FDA E104      00774         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00775 
3FDC 00776 TIA_BANK_CheckStick_Ext_Stat_Ok   
3FDC C007 F01C 00777     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00778 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3FE0 8A5B      00779     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY 
               00780 #endif  
               00781     rgoto TIA_BANK_CheckStick_Ext_ReadySet
3FE2 D02C          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 93


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3FE4 00782 TIA_BANK_CheckStick_Ext_Stat_NotOk      ;; status not ready
               00783     rgoto   TIA_BANK_CheckStick_Ext_End ;; end
3FE4 D03A          M         bra     label
               00784     
3FE6 00785 TIA_BANK_CheckStick_Unformatted    
3FE6 0E01      00786     movlw   DEFAULT_BS_FPROTECT          ;; BS format inhibit
3FE8 0A02      00787     xorlw   0x02
3FEA E006      00788     bz      TIA_BANK_CheckStick_Unformatted_FProtect 
               00789 
3FEC C019 F011 00790     movff   TIA_BANKSTICK_CHK_CTR, TIA_BANK
3FF0 D856      00791         rcall   TIA_BANK_FormatStick            ;; --> format bankstick
3FF2 C011 F019 00792     movff   TIA_BANK, TIA_BANKSTICK_CHK_CTR
               00793     rgoto       TIA_BANK_CheckStick_Ext_End ;; end
3FF6 D031          M         bra     label
               00794     
3FF8 00795 TIA_BANK_CheckStick_Unformatted_FProtect
3FF8 C007 F01C 00796     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00797 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3FFC 8D62      00798     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT
               00799 #endif
               00800     rgoto       TIA_BANK_CheckStick_Ext_ReadyClr
3FFE D004          M         bra     label
               00801 
4000 00802 TIA_BANK_CheckStick_Unformatted_TProtect
4000 C007 F01C 00803     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00804 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4004 8F62      00805     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_TPROTECT
               00806 #endif
               00807     rgoto       TIA_BANK_CheckStick_Ext_ReadyClr
4006 D000          M         bra     label
               00808 
4008 00809 TIA_BANK_CheckStick_Ext_ReadyClr
4008 501A      00810         movf    TIA_BANKSTICK_ID, W         ;; clear flag
400A ECC4 F016 00811         call    MIOS_HLP_GetBitANDMask
400E 161B      00812         andwf   TIA_BANKSTICK_RDY, F   
4010 EC86 F01D 00813     call    TIA_LEDMTR_PlayOtoR         ;; play mled orange to red pattern 
4014 EC79 F021 00814     call        TIA_TUNE_PlayWrong          ;; play wrong tune     
4018 EC9C F01D 00815     call    TIA_LEDMTR_Player_Off
401C 0E05      00816     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
401E 6E25      00817     movwf   TIA_SYSEX_ADDRESS
4020 ECB5 F02C 00818         call    _TIA_SYSEX_End_CFG_Read 
4024 5019      00819     movf    TIA_BANKSTICK_CHK_CTR, W
4026 1814      00820     xorwf   TIA_PBANK, W
4028 E118      00821     bnz     TIA_BANK_CheckStick_Ext_End
402A 6A14      00822     clrf    TIA_PBANK                   ;; Reinit to...
402C 6A12      00823     clrf    TIA_PRESET
402E 0E0F      00824     movlw   0x0f                        ;; send sysex CFG All
4030 6E25      00825     movwf   TIA_SYSEX_ADDRESS
4032 ECB5 F02C 00826         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
4036 9010      00827     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
4038 EFAD F01D 00828         goto    TIA_PATCH_Init
               00829     ;;rgoto   TIA_BANK_CheckStick_Ext_End 
               00830     
403C 00831 TIA_BANK_CheckStick_Ext_ReadySet 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 94


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
403C 501A      00832         movf    TIA_BANKSTICK_ID, W         ;; set flag
403E ECC6 F016 00833         call    MIOS_HLP_GetBitORMask
4042 121B      00834         iorwf   TIA_BANKSTICK_RDY, F
4044 EC7A F01D 00835     call    TIA_LEDMTR_PlayOtoG         ;; play mled orange to green pattern 
4048 EC63 F021 00836     call        TIA_TUNE_PlayOk             ;; play ready tune    
404C EC9C F01D 00837     call    TIA_LEDMTR_Player_Off
4050 0E05      00838     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
4052 6E25      00839     movwf   TIA_SYSEX_ADDRESS
4054 ECB5 F02C 00840         call    _TIA_SYSEX_End_CFG_Read 
4058 9010      00841     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00842     ;;rgoto   TIA_BANK_CheckStick_Ext_End
               00843 
405A 00844 TIA_BANK_CheckStick_Ext_End
405A 0012      00845         return
               00846        
               00847     
               00848     
               00849 ;; --------------------------------------------------------------------------
               00850 ;;  Format Stick: copy the lead default patch into the currently selected BankStick Bank
               00851 ;;  IN: bank number in TIA_PBANK
               00852 ;; --------------------------------------------------------------------------
405C 00853 TEXT_FORMATBANK_0 STRING 20, 0x00, "* Formatting xxk *  "
405C 1400 202A     M         da      ((length) << 8) | (pos), str
     6F46 6D72 
     7461 6974 
     676E 7820 
     6B78 2A20 
     2020      
4072 00854 TEXT_FORMATBANK_1 STRING 20, 0x40, "* Patch x  0     *  "
4072 1440 202A     M         da      ((length) << 8) | (pos), str
     6150 6374 
     2068 2078 
     3020 2020 
     2020 2A20 
     2020      
4088 00855 TEXT_FORMATBANK_K STRING 20, 0x40, "* Ensemble 000   *  "
4088 1440 202A     M         da      ((length) << 8) | (pos), str
     6E45 6573 
     626D 656C 
     3020 3030 
     2020 2A20 
     2020      
               00856 
409E 00857 TIA_BANK_FormatStick
               00858         ;; select BankStick depending on TIA_BANKSTICK_CHK_CTR
409E 4011      00859     rrncf   TIA_BANK, W
40A0 40E8      00860     rrncf   WREG, W
40A2 0B07      00861     andlw   0x07
40A4 6E1A      00862     movwf       TIA_BANKSTICK_ID
               00863 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
40A6 0F80      00864     addlw   0x80        ; (Enable verify slower write accesses)
               00865 #endif
40A8 ECEE F016 00866         call    MIOS_BANKSTICK_CtrlSet
               00867     
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 95


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
40AC EC62 F01D 00868     call    TIA_LEDMTR_PlayFormat_R
               00869 
               00870         ;; determine if this is a 64k BankStick:
               00871         ;; read from address 0x8000, store value in PRODL
40B0 0E0F      00872         movlw   0x0f ;; between 0x03 - 0x7f
40B2 6E03      00873         movwf   MIOS_PARAMETER1
40B4 0E80      00874         movlw   0x80
40B6 6E04      00875         movwf   MIOS_PARAMETER2
40B8 ECB8 F016 00876         call    MIOS_BANKSTICK_Read
40BC 6EF3      00877         movwf   PRODL
               00878 
               00879         ;; add 0x42 and write number to 0x0000
40BE 0E0F      00880         movlw   0x0f ;; between 0x03 - 0x7f
40C0 6E03      00881         movwf   MIOS_PARAMETER1
40C2 6A04      00882         clrf    MIOS_PARAMETER2
40C4 50F3      00883     movf    PRODL, W
40C6 0F42      00884         addlw   0x42
40C8 ECBA F016 00885         call    MIOS_BANKSTICK_Write
40CC A4D8      00886     skpz
               00887     rgoto   TIA_BANK_FormatStick_Err_Handler
40CE D0BD          M         bra     label
               00888 
               00889         ;; read again number from 0x8000, check if we still see the old value
40D0 0E0F      00890         movlw   0x0f ;; between 0x03 - 0x7f
40D2 6E03      00891         movwf   MIOS_PARAMETER1
40D4 0E80      00892         movlw   0x80
40D6 6E04      00893         movwf   MIOS_PARAMETER2
40D8 ECB8 F016 00894         call    MIOS_BANKSTICK_Read
40DC 18F3      00895         xorwf   PRODL, W
40DE E107      00896     bnz     TIA_BANK_FormatStick_32k
40E0 00897 TIA_BANK_FormatStick_64k
               00898 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
40E0 8762      00899     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE
               00900 #endif
               00901         ;; set flag in size register
40E2 501A      00902         movf    TIA_BANKSTICK_ID, W
40E4 ECC6 F016 00903         call    MIOS_HLP_GetBitORMask
40E8 121D      00904         iorwf   TIA_BANKSTICK_SIZE, F
               00905         ;; write 64 to address 0x0002
40EA 0E40      00906         movlw   64
               00907         rgoto   TIA_BANK_FormatStick_SizeIDCont
40EC D006          M         bra     label
40EE 00908 TIA_BANK_FormatStick_32k
               00909 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
40EE 9762      00910     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE
               00911 #endif
               00912         ;; clear flag in size register
40F0 501A      00913         movf    TIA_BANKSTICK_ID, W
40F2 ECC4 F016 00914         call    MIOS_HLP_GetBitANDMask
40F6 161D      00915         andwf   TIA_BANKSTICK_SIZE, F
               00916         ;; write 32 to address 0x0002
40F8 0E20      00917         movlw   32
               00918         ;;rgoto TIA_BANK_FormatStick_SizeIDCont
40FA 00919 TIA_BANK_FormatStick_SizeIDCont
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 96


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
40FA 6E06      00920         movwf   TMP1
40FC 5019      00921     movf    TIA_BANKSTICK_CHK_CTR, W
40FE DE50      00922         rcall   TIA_BANK_CheckStick_SelectMagic
4100 0E02      00923         movlw   0x02
4102 6E03      00924         movwf   MIOS_PARAMETER1
4104 5006      00925         movf    TMP1, W
4106 ECBA F016 00926         call    MIOS_BANKSTICK_Write
410A A4D8      00927     skpz
               00928     rgoto   TIA_BANK_FormatStick_Err_Handler
410C D09E          M         bra     label
               00929 
               00930         ;; print format message
               00931         ;TABLE_ADDR TEXT_FORMATBANK_0
               00932         ;call   MIOS_LCD_PrintMessage
               00933         ;call   MIOS_LCD_PrintMessage
               00934 
               00935         ;; print bankstick size
               00936         ;movlw  0x00 + 13
               00937         ;call   MIOS_LCD_CursorSet
               00938         ;movf   PRODL, W
               00939         ;call   MIOS_LCD_PrintBCD2
               00940 
               00941 
410E 0E32      00942         movlw   50                              ; wait some ms to get a stable status
4110 ECCE F016 00943         call    MIOS_Delay                      
               00944 
               00945         ;; now branch depending on Ensemble/Patch
               00946 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
4114 0E04      00947         movlw   DEFAULT_BS_KBANK_ID-1
4116 641A      00948         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00949         rgoto   TIA_BANK_FormatStick_P
4118 D022          M         bra     label
411A B211      00950     btfsc   TIA_BANK, 1
               00951     rgoto       TIA_BANK_FormatStick_WT
411C D010          M         bra     label
               00952     
411E 00953 TIA_BANK_FormatStick_K
               00954         ;; copy Patch 0 (internal kit) to upload buffer
411E 6AA9      00955         clrf    EEADR
4120 0E01      00956     movlw   (EEPROM_KIT >> 8) & 0xff
4122 6EAA      00957     movwf   EEADRH
4124 EE07 F000 00958         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
4128 00959 TIA_BANK_FormatStick_K_CIntLoop
4128 ECB0 F016 00960         call    MIOS_EEPROM_Read
412C 6EEE      00961         movwf   POSTINC0
412E AEA9      00962         btfss   EEADR, 7
               00963         rgoto   TIA_BANK_FormatStick_K_CIntLoop
4130 D7FB          M         bra     label
               00964         ;; clear name
4132 EE07 F000 00965         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
4136 00966 TIA_BANK_FormatStick_K_ClearLoop
4136 6AEE      00967         clrf    POSTINC0
               00968         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_K_ClearLoop
4138 A8E9          M         btfss   reg, bit, reg_a
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 97


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
413A D7FD          M         bra     label
               00969     rgoto   TIA_BANK_FormatStick_Data    
413C D01F          M         bra     label
               00970     
413E 00971 TIA_BANK_FormatStick_WT
               00972         ;; copy Patch 0 (internal patch) to upload buffer
413E 6AA9      00973         clrf    EEADR
4140 0E02      00974     movlw   (EEPROM_WAVETABLE >> 8) & 0xff
4142 6EAA      00975     movwf   EEADRH
4144 EE07 F000 00976         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
4148 00977 TIA_BANK_FormatStick_WT_CIntLoop
4148 ECB0 F016 00978         call    MIOS_EEPROM_Read
414C 6EEE      00979         movwf   POSTINC0
414E AEA9      00980         btfss   EEADR, 7
               00981         rgoto   TIA_BANK_FormatStick_WT_CIntLoop
4150 D7FB          M         bra     label
               00982         ;; clear name
4152 EE07 F000 00983         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
4156 00984 TIA_BANK_FormatStick_WT_ClearLoop
4156 6AEE      00985         clrf    POSTINC0
               00986         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_WT_ClearLoop
4158 A8E9          M         btfss   reg, bit, reg_a
415A D7FD          M         bra     label
               00987     rgoto   TIA_BANK_FormatStick_Data
415C D00F          M         bra     label
               00988 
               00989 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00990 
415E 00991 TIA_BANK_FormatStick_P
               00992         ;; copy Patch 0 (internal patch) to upload buffer
415E 6AA9      00993         clrf    EEADR
4160 0E00      00994     movlw   (EEPROM_PATCH >> 8) & 0xff
4162 6EAA      00995     movwf   EEADRH
4164 EE07 F000 00996         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
4168 00997 TIA_BANK_FormatStick_P_CIntLoop
4168 ECB0 F016 00998         call    MIOS_EEPROM_Read
416C 6EEE      00999         movwf   POSTINC0
416E AEA9      01000         btfss   EEADR, 7
               01001         rgoto   TIA_BANK_FormatStick_P_CIntLoop
4170 D7FB          M         bra     label
               01002         ;; clear name
4172 EE07 F000 01003         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
4176 01004 TIA_BANK_FormatStick_P_ClearLoop
4176 6AEE      01005         clrf    POSTINC0
               01006         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_P_ClearLoop
4178 A8E9          M         btfss   reg, bit, reg_a
417A D7FD          M         bra     label
               01007     ;;rgoto   TIA_BANK_FormatStick_Data
               01008 
               01009 
               01010 
               01011     
417C 01012 TIA_BANK_FormatStick_Data  
417C EC68 F01D 01013     call    TIA_LEDMTR_PlayFormat_O
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 98


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01014         ;; now format patch 1 to 127 (64k) or 63 (32k)
4180 0E01      01015         movlw   0x01
4182 6EA9      01016         movwf   EEADR   ; use EEADR as patch ctr
               01017     ;; Select BS Adress
4184 6A03      01018     clrf    MIOS_PARAMETER1
4186 B0A9      01019     btfsc       EEADR, 0
4188 8E03      01020         bsf     MIOS_PARAMETER1, 7              ; select upper address range on odd bank number
418A 30A9      01021     rrf     EEADR, W    
418C 6E04      01022         movwf   MIOS_PARAMETER2 ; copy patch to high-byte
418E DE03      01023     rcall   TIA_BANK_GetBankStickSize
4190 B4D8      01024         skpnz
               01025     rgoto   TIA_BANK_FormatStick_Data_32k
4192 D005          M         bra     label
4194 01026 TIA_BANK_FormatStick_Data_64k
4194 B011      01027         btfsc   TIA_BANK, 0
4196 8C04      01028         bsf     MIOS_PARAMETER2, 6
4198 B211      01029     btfsc       TIA_BANK, 1
419A 8E04      01030         bsf     MIOS_PARAMETER2, 7
               01031     rgoto   TIA_BANK_FormatStick_Data_OuterLoop
419C D005          M         bra     label
419E 01032 TIA_BANK_FormatStick_Data_32k
419E 9A04      01033     bcf MIOS_PARAMETER2, 5
41A0 B011      01034         btfsc   TIA_BANK, 0
41A2 8A04      01035         bsf     MIOS_PARAMETER2, 5
41A4 B211      01036     btfsc       TIA_BANK, 1
41A6 8C04      01037         bsf     MIOS_PARAMETER2, 6
               01038     
41A8 01039 TIA_BANK_FormatStick_Data_OuterLoop
               01040         ;; copy 0x80 words
41A8 EE17 F000 01041         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN 
41AC 0004      01042         clrwdt                  ; feed watchdog
               01043         ;; buffer already prepared in FSR1
41AE ECF2 F016 01044         call    MIOS_BANKSTICK_WritePage        ; write page
41B2 A4D8      01045     skpz
               01046     rgoto   TIA_BANK_FormatStick_Err_Handler
41B4 D04A          M         bra     label
41B6 0E40      01047         movlw   0x40                            ; increment FSR1 by 0x40
41B8 26E1      01048         addwf   FSR1L, F
41BA 0004      01049         clrwdt                  ; feed watchdog
41BC ECF2 F016 01050         call    MIOS_BANKSTICK_WritePage        ; write page
41C0 A4D8      01051     skpz
               01052     rgoto   TIA_BANK_FormatStick_Err_Handler
41C2 D043          M         bra     label
               01053         ;; continue until last patch is reached
41C4 2AA9      01054         incf    EEADR, F
41C6 501A      01055         movf    TIA_BANKSTICK_ID, W
41C8 ECC6 F016 01056         call    MIOS_HLP_GetBitORMask
41CC 141D      01057         andwf   TIA_BANKSTICK_SIZE, W
41CE 0E7F      01058         movlw   128-1
41D0 B4D8      01059         skpnz
41D2 0E3F      01060         movlw   64-1
41D4 64A9      01061         cpfsgt  EEADR, ACCESS
               01062         rgoto TIA_BANK_FormatStick_Data_OuterLoop
41D6 D7E8          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 99


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
41D8 01063 TIA_BANK_FormatStick_Data_End
               01064      
41D8 EC6E F01D 01065     call    TIA_LEDMTR_PlayFormat_G1
               01066     
               01067     ;; write bank new name
               01068     ;; add name offset to MP1 start @0x10
41DC 0E10      01069     movlw   NEW_BANK_NAME & 0xff
41DE 6EA9      01070         movwf   EEADR
41E0 0E03      01071     movlw   (NEW_BANK_NAME >> 8) & 0xff
41E2 6EAA      01072     movwf   EEADRH 
41E4 5019      01073     movf    TIA_BANKSTICK_CHK_CTR, W
41E6 DDDC      01074         rcall   TIA_BANK_CheckStick_SelectMagic
41E8 0E10      01075     movlw   0x10
41EA 6E03      01076     movwf   MIOS_PARAMETER1
41EC 01077 TIA_BANK_FormatStick_Name_Loop
41EC ECB0 F016 01078     call    MIOS_EEPROM_Read
41F0 ECBA F016 01079     call    MIOS_BANKSTICK_Write
41F4 A4D8      01080     skpz
               01081     rgoto   TIA_BANK_FormatStick_Err_Handler
41F6 D029          M         bra     label
41F8 AA03      01082     btfss   MIOS_PARAMETER1, 5    ; until == 0x20
               01083     rgoto   TIA_BANK_FormatStick_Name_Loop
41FA D7F8          M         bra     label
               01084 #if 0
               01085         ;; clear address 0x0020-0x007f
               01086 TIA_BANK_FormatStick_P_CfgLoop
               01087         movlw   0x00
               01088         call    MIOS_BANKSTICK_Write            ; write 0
               01089     skpz
               01090     rgoto   TIA_BANK_FormatStick_Err_Handler
               01091         btfss   MIOS_PARAMETER1, 7    ; until == 0x80
               01092         rgoto TIA_BANK_FormatStick_P_CfgLoop
               01093 #endif
               01094     
               01095         ;;; write magic byte 0 to confirm valid content
41FC 6A03      01096     clrf    MIOS_PARAMETER1
41FE 0E83      01097         movlw   BANKSTICK_MAGIC0
4200 ECBA F016 01098         call    MIOS_BANKSTICK_Write
4204 A4D8      01099     skpz
               01100     rgoto   TIA_BANK_FormatStick_Err_Handler
4206 D021          M         bra     label
               01101     
               01102 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               01103     ;; now branch depending on Kit/Patch
4208 0E04      01104         movlw   DEFAULT_BS_KBANK_ID-1
420A 641A      01105         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               01106         rgoto   TIA_BANK_FormatStick_P_Cont
420C D012          M         bra     label
420E B211      01107     btfsc   TIA_BANK, 1
               01108     rgoto       TIA_BANK_FormatStick_WT_Cont
4210 D008          M         bra     label
               01109     
4212 01110 TIA_BANK_FormatStick_K_Cont
               01111         ;; select first external kit
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 100


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01112         ;movlw  1
               01113         ;movwf  TIA_KIT
               01114         ;; store number in EEPROM
               01115         ;call   TIA_KIT_StoreDefaultNum
               01116         ;; write magic byte K(kit/wavetable), valid content and type
4212 0E13      01117         movlw   BANKSTICK_MAGICK
4214 ECBA F016 01118         call    MIOS_BANKSTICK_Write
4218 A4D8      01119     skpz
               01120     rgoto   TIA_BANK_FormatStick_Err_Handler
421A D017          M         bra     label
               01121 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
421C 8162      01122     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
421E 9362      01123     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
               01124 #endif
               01125     rgoto   TIA_BANK_FormatStick_Cont
4220 D00E          M         bra     label
               01126 
4222 01127 TIA_BANK_FormatStick_WT_Cont 
               01128         ;; select first external wavetable
               01129         ;movlw  1
               01130         ;movwf  TIA_WT
               01131         ;; store number in EEPROM
               01132         ;call   TIA_KIT_StoreDefaultNum
               01133         ;; write magic byte K(kit/wavetable), valid content and type
4222 0E13      01134         movlw   BANKSTICK_MAGICK
4224 ECBA F016 01135         call    MIOS_BANKSTICK_Write
4228 A4D8      01136     skpz
               01137     rgoto   TIA_BANK_FormatStick_Err_Handler
422A D00F          M         bra     label
               01138 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
422C 8162      01139     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
422E 8362      01140     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
               01141 #endif
               01142     rgoto   TIA_BANK_FormatStick_Cont
4230 D006          M         bra     label
               01143 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               01144 
4232 01145 TIA_BANK_FormatStick_P_Cont
               01146         ;; select first external patch
               01147         ;movlw  1
               01148         ;movwf  TIA_PRESET
               01149         ;; store number in EEPROM
               01150         ;call   TIA_KIT_StoreDefaultNum
               01151         ;; and branch to end
               01152     ;;rgoto    TIA_BANK_FormatStick_Cont
               01153         ;; write magic byte P(patch), valid content and type
4232 0E12      01154         movlw   BANKSTICK_MAGICP
4234 ECBA F016 01155         call    MIOS_BANKSTICK_Write
4238 A4D8      01156     skpz
               01157     rgoto   TIA_BANK_FormatStick_Err_Handler
423A D007          M         bra     label
               01158 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
423C 9162      01159     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
               01160 #endif
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 101


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01161     ;;rgoto   TIA_BANK_FormatStick_Cont
               01162 
423E 01163 TIA_BANK_FormatStick_Cont
               01164 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
423E 8B62      01165     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT
               01166 #endif
               01167         ;; play tune, new setup will be reloaded automatically
               01168         ;movf   TIA_PBANK, W
4240 ECB3 F021 01169         call    TIA_TUNE_Play1
4244 EC74 F01D 01170     call    TIA_LEDMTR_PlayFormat_G2
               01171     rgoto   TIA_BANK_CheckStick_End 
4248 D601          M         bra     label
               01172 
               01173     
424A 01174 TIA_BANK_FormatStick_Err_Handler
               01175 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
424A 6F61      01176     movwf   TIA_DEBUG_BS_REG6
424C 865B      01177     bsf     TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
424E 2B60      01178     incf    TIA_DEBUG_BS_REG5, F
4250 501A      01179     movf        TIA_BANKSTICK_ID, W
4252 ECC4 F016 01180         call    MIOS_HLP_GetBitANDMask
4256 1763      01181     andwf       TIA_DEBUG_BS_REG9, F
               01182 #endif    
               01183     ;; realign on first bank of current BankStick
4258 5211      01184     movf    TIA_BANK, F
425A 0B1C      01185     andlw   0x1c
425C 28E8      01186     incf    WREG, W    ;; next will be first
425E 6E11      01187     movwf   TIA_BANK   
               01188     ;; reinit STAT registers
4260 501A      01189     movf        TIA_BANKSTICK_ID, W
4262 ECC4 F016 01190         call    MIOS_HLP_GetBitANDMask
4266 161C      01191         andwf   TIA_BANKSTICK_STAT, F
4268 161D      01192     andwf       TIA_BANKSTICK_SIZE, F
               01193 
426A 01194 TIA_BANK_FormatStickEnd
               01195         ;; set reinit counter - CS configuration will be restored after 1 second
               01196         ;movlw  10
               01197         ;movwf  CS_MENU_REINIT_CFG_CTR
426A 0012      01198         return
               01199 
               01200 ;; --------------------------------------------------------------------------
               01201 
               01202 
               01203 
               01204 
               01205 ;; --------------------------------------------------------------------------
               01206 ;;  Fix Patches - temporary routine to modify all patches stored in BankStick
               01207 ;;  IN: bank number in TIA_PBANK
               01208 ;; --------------------------------------------------------------------------
426C 01209 TEXT_FIXBANK_0 STRING 20, 0x00, "* Fixing         *  "
426C 1400 202A     M         da      ((length) << 8) | (pos), str
     6946 6978 
     676E 2020 
     2020 2020 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 102


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     2020 2A20 
     2020      
4282 01210 TEXT_FIXBANK_1 STRING 20, 0x40, "* Patch x  0     *  "
4282 1440 202A     M         da      ((length) << 8) | (pos), str
     6150 6374 
     2068 2078 
     3020 2020 
     2020 2A20 
     2020      
               01211 
4298 01212 TIA_BANK_FixPatches
               01213 #if 0
               01214         ;; select BankStick depending on TIA_PBANK
               01215     movf    TIA_BANKSTICK_CHK_CTR, W
               01216         rcall   TIA_BANK_SetBankStickId
               01217 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
               01218     addlw   0x80        ; (Enable verify slower write accesses)
               01219 #endif
               01220         call    MIOS_BANKSTICK_CtrlSet
               01221 
               01222         ;; print message
               01223         TABLE_ADDR TEXT_FIXBANK_0
               01224         call    MIOS_LCD_PrintMessage
               01225         call    MIOS_LCD_PrintMessage
               01226 
               01227         ;; print bank number
               01228         movlw   0x40 + 8
               01229         call    MIOS_LCD_CursorSet
               01230         movf    TIA_PBANK, W
               01231         addlw   'A'
               01232         call    MIOS_LCD_PrintChar
               01233 
               01234         ;; now fixing patch 1 to 127 (64k) or 63 (32k)
               01235         movlw   0x01
               01236         movwf   TIA_PRESET      ; starting patch
               01237 TIA_BANK_FixPatches_OuterLoop
               01238         movlw   0x49
               01239         call    MIOS_LCD_CursorSet
               01240         incf    TIA_PRESET, W
               01241         call    MIOS_LCD_PrintBCD3
               01242 
               01243         ;; fix pitchbender assignment if K#P not already assigned to other parameter
               01244         movlw   TIA_Ix_P_KP_BASE+TIA_Ix_Px_ASSIGN1
               01245         movwf   EEADR
               01246         clrf    EEADRH
               01247         call    TIA_BANK_SetBankStickAddress
               01248         call    MIOS_BANKSTICK_Read
               01249         bnz     TIA_BANK_FixPatches_NoPbFix
               01250 TIA_BANK_FixPatches_PbFix
               01251         decf    MIOS_PARAMETER1, F
               01252         movlw   0x50
               01253         call    MIOS_BANKSTICK_Write
               01254 TIA_BANK_FixPatches_NoPbFix
               01255 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 103


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01256 #if 0
               01257         movf    TIA_PRESET, W
               01258         ;call   TIA_TUNE_Play3_Note
               01259 #endif
               01260 
               01261         ;; continue until last patch is reached
               01262         incf    TIA_PRESET, F
               01263 
               01264         movf    TIA_PBANK, W
               01265         call    MIOS_HLP_GetBitORMask
               01266         andwf   TIA_BANKSTICK_SIZE, W
               01267         movlw   128-1
               01268         skpnz
               01269         movlw   64-1
               01270         cpfsgt  TIA_PRESET, W
               01271         rgoto TIA_BANK_FixPatches_OuterLoop
               01272 
               01273         ;; switch to internal patch
               01274         clrf    TIA_PRESET
               01275 
               01276 TIA_BANK_FixPatchesEnd
               01277 #endif
4298 0012      01278         return
               01279 
               00382 #include "tia_tune.inc"
               00001 ; $Id: tia_tune.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Routines to play short tunes (when a BankStick is attached/deattached)
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  TIA_PLAY Disconnected Tune
               00016 ;; --------------------------------------------------------------------------
429A 00017 TIA_TUNE_PlayDisconnect
429A 0E0D      00018     movlw   0x0d
429C 6E06      00019     movwf   TMP1
429E 0E06      00020         movlw   0x06
42A0 D878      00021         rcall   TIA_TUNE_Note_Init
               00022 
42A2 0E0B      00023         movlw   0x0b
42A4 D888      00024         rcall   TIA_TUNE_Note_On_Wait01
42A6 0E01      00025         movlw   0x01
42A8 D886      00026         rcall   TIA_TUNE_Note_On_Wait01
42AA 0E01      00027         movlw   0x01
42AC D887      00028         rcall   TIA_TUNE_Wait
42AE 0E18      00029         movlw   0x18
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 104


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
42B0 D882      00030         rcall   TIA_TUNE_Note_On_Wait01
42B2 0E10      00031         movlw   0x10
42B4 D880      00032         rcall   TIA_TUNE_Note_On_Wait01
42B6 0E04      00033         movlw   0x04
42B8 D875      00034         rcall   TIA_TUNE_Note_On
42BA 0E02      00035         movlw   0x02
42BC D87F      00036         rcall   TIA_TUNE_Wait
42BE D876      00037         rcall   TIA_TUNE_Note_Off
42C0 0E02      00038         movlw   0x02
42C2 D87C      00039         rcall   TIA_TUNE_Wait
               00040 
               00041         rgoto   TIA_TUNE_End
42C4 D064          M         bra     label
               00042     
               00043 ;; --------------------------------------------------------------------------
               00044 ;;  TIA_PLAY Ok Tune
               00045 ;; --------------------------------------------------------------------------
42C6 00046 TIA_TUNE_PlayOk
42C6 0E0D      00047     movlw   0x0d
42C8 6E06      00048     movwf   TMP1
42CA 0E06      00049         movlw   0x06
42CC D862      00050         rcall   TIA_TUNE_Note_Init
               00051 
42CE 0E0B      00052         movlw   0x0b
42D0 D872      00053         rcall   TIA_TUNE_Note_On_Wait01
42D2 0E04      00054         movlw   0x04
42D4 D870      00055         rcall   TIA_TUNE_Note_On_Wait01
42D6 0E01      00056         movlw   0x01
42D8 D871      00057         rcall   TIA_TUNE_Wait
42DA 0E18      00058         movlw   0x18
42DC D86C      00059         rcall   TIA_TUNE_Note_On_Wait01
42DE 0E10      00060         movlw   0x10
42E0 D86A      00061         rcall   TIA_TUNE_Note_On_Wait01
42E2 0E01      00062         movlw   0x01
42E4 D85F      00063         rcall   TIA_TUNE_Note_On
42E6 0E02      00064         movlw   0x02
42E8 D869      00065         rcall   TIA_TUNE_Wait
42EA D860      00066         rcall   TIA_TUNE_Note_Off
42EC 0E02      00067         movlw   0x02
42EE D866      00068         rcall   TIA_TUNE_Wait
               00069 
               00070         rgoto   TIA_TUNE_End
42F0 D04E          M         bra     label
               00071 
               00072 ;; --------------------------------------------------------------------------
               00073 ;;  TIA_PLAY Wrong Tune
               00074 ;; --------------------------------------------------------------------------
42F2 00075 TIA_TUNE_PlayWrong
42F2 0E0D      00076     movlw   0x0d
42F4 6E06      00077     movwf   TMP1
42F6 0E06      00078         movlw   0x06
42F8 D84C      00079         rcall   TIA_TUNE_Note_Init
               00080 
42FA 0E0B      00081         movlw   0x0b
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 105


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
42FC D85C      00082         rcall   TIA_TUNE_Note_On_Wait01
42FE 0E04      00083         movlw   0x04
4300 D85A      00084         rcall   TIA_TUNE_Note_On_Wait01
4302 0E05      00085         movlw   0x05
4304 D85B      00086         rcall   TIA_TUNE_Wait
4306 0E18      00087         movlw   0x18
4308 D856      00088         rcall   TIA_TUNE_Note_On_Wait01
430A 0E10      00089         movlw   0x10
430C D854      00090         rcall   TIA_TUNE_Note_On_Wait01
430E 0E1D      00091         movlw   0x1d
4310 D849      00092         rcall   TIA_TUNE_Note_On
4312 0E0F      00093         movlw   0x0f
4314 D853      00094         rcall   TIA_TUNE_Wait
4316 D84A      00095         rcall   TIA_TUNE_Note_Off
4318 0E04      00096         movlw   0x04
431A D850      00097         rcall   TIA_TUNE_Wait
               00098 
               00099         rgoto   TIA_TUNE_End   
431C D038          M         bra     label
               00100     
               00101 ;; --------------------------------------------------------------------------
               00102 ;;  TIA_PLAY Fanfare Tune
               00103 ;; --------------------------------------------------------------------------
431E 00104 TIA_TUNE_Play_Fanfare
431E 0E02      00105     movlw   0x02
4320 D838      00106         rcall   TIA_TUNE_Note_Init
               00107 
4322 0E0F      00108     movlw   0x0f
4324 6E06      00109     movwf   TMP1
4326 0E0B      00110         movlw   0x0b
4328 D846      00111         rcall   TIA_TUNE_Note_On_Wait01
432A 0E08      00112     movlw   0x08
432C 6E06      00113     movwf   TMP1
432E 0E08      00114         movlw   0x08
4330 D842      00115         rcall   TIA_TUNE_Note_On_Wait01
4332 0E04      00116     movlw   0x04
4334 6E06      00117     movwf   TMP1
4336 0E06      00118         movlw   0x06
4338 D83E      00119         rcall   TIA_TUNE_Note_On_Wait01
433A 0E0B      00120     movlw   0x0b
433C 6E06      00121     movwf   TMP1
433E 0E05      00122         movlw   0x05
4340 D83A      00123         rcall   TIA_TUNE_Note_On_Wait01
               00124 
               00125 
4342 0E0F      00126         movlw   0x0f
4344 D83B      00127         rcall   TIA_TUNE_Wait
4346 0E08      00128     movlw   0x08
4348 6E06      00129     movwf   TMP1
434A 0E06      00130         movlw   0x06
434C D834      00131         rcall   TIA_TUNE_Note_On_Wait01
434E 0E04      00132     movlw       0x04
4350 D835      00133         rcall   TIA_TUNE_Wait
4352 0E0C      00134     movlw   0x0c
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 106


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4354 6E06      00135     movwf   TMP1
4356 0E05      00136         movlw   0x05
4358 D82E      00137         rcall   TIA_TUNE_Note_On_Wait01
               00138 
               00139 
435A 0E1A      00140         movlw   0x1a
435C D82F      00141         rcall   TIA_TUNE_Wait
435E D826      00142         rcall   TIA_TUNE_Note_Off
4360 0E06      00143         movlw   0x06
4362 D82C      00144         rcall   TIA_TUNE_Wait
               00145 
               00146         rgoto   TIA_TUNE_End
4364 D014          M         bra     label
               00147     
               00148 ;; --------------------------------------------------------------------------
               00149 ;;  TIA_PLAY Tune #1
               00150 ;; --------------------------------------------------------------------------
4366 00151 TIA_TUNE_Play1
4366 0E0D      00152     movlw   0x0d
4368 6E06      00153     movwf   TMP1
436A 0E08      00154         movlw   0x08
436C D812      00155         rcall   TIA_TUNE_Note_Init
               00156 
436E 0E0B      00157         movlw   0x0b
4370 D822      00158         rcall   TIA_TUNE_Note_On_Wait01
4372 0E02      00159         movlw   0x02
4374 D820      00160         rcall   TIA_TUNE_Note_On_Wait01
4376 0E03      00161         movlw   0x03
4378 D821      00162         rcall   TIA_TUNE_Wait
437A 0E10      00163         movlw   0x10
437C D81C      00164         rcall   TIA_TUNE_Note_On_Wait01
437E 0E1C      00165         movlw   0x1c
               00166         ;movf   TMP2,W
4380 D811      00167         rcall   TIA_TUNE_Note_On
4382 0E30      00168         movlw   0x30
4384 D81B      00169         rcall   TIA_TUNE_Wait
4386 D812      00170         rcall   TIA_TUNE_Note_Off
4388 0E04      00171         movlw   0x04
438A D818      00172         rcall   TIA_TUNE_Wait
               00173 
               00174         rgoto   TIA_TUNE_End
438C D000          M         bra     label
               00175     
               00176 ;; --------------------------------------------------------------------------
               00177 ;;  TIA_PLAY End 
               00178 ;; --------------------------------------------------------------------------
438E 00179 TIA_TUNE_End
438E 9010      00180         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn on TIA software synth part again
               00181         ;goto   TIA_PATCH_Init                  ; init patch and exit
4390 0012      00182     return
               00183 
               00184 
               00185 ;; --------------------------------------------------------------------------
               00186 ;;  TIA_PLAY Initialization routine
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 107


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00187 ;; --------------------------------------------------------------------------
4392 00188 TIA_TUNE_Note_Init
4392 8010      00189         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn off TIA software synth part
               00190 
               00191         SET_BSR TIA_BASE
4394 0101          M         movlb   HIGH(reg)
4396 0B0F      00192         andlw   0x0f
4398 6F00      00193         movwf   TIA_AUDC0, BANKED
439A 5006      00194     movf    TMP1, W
439C 0B0F      00195     andlw   0x0f
439E 6F04      00196         movwf   TIA_AUDV0, BANKED
43A0 EFEC F021 00197     goto        _TIA_SR_Handler
               00198 ;; --------------------------------------------------------------------------
               00199 ;;  TIA_PLAY a note (in: Note Number)
               00200 ;; --------------------------------------------------------------------------
43A4 00201 TIA_TUNE_Note_On
               00202         SET_BSR TIA_BASE
43A4 0101          M         movlb   HIGH(reg)
43A6 6F02      00203         movwf   TIA_AUDF0, BANKED
               00204 
43A8 EFEC F021 00205         goto    _TIA_SR_Handler  
               00206 
43AC 00207 TIA_TUNE_Note_Off
               00208         SET_BSR TIA_BASE
43AC 0101          M         movlb   HIGH(reg)
43AE 6B04      00209         clrf    TIA_AUDV0, BANKED
43B0 6B05      00210         clrf    TIA_AUDV1, BANKED
43B2 EFEC F021 00211         goto    _TIA_SR_Handler
               00212 
43B6 00213 TIA_TUNE_Note_On_Wait01
43B6 DFF6      00214         rcall   TIA_TUNE_Note_On
43B8 0E01      00215         movlw   0x01
               00216         rgoto   TIA_TUNE_Wait
43BA D000          M         bra     label
               00217     
               00218 
               00219 ;; --------------------------------------------------------------------------
               00220 ;;  TIA_PLAY wait for a certain time and poll TIA_SR Handler
               00221 ;; --------------------------------------------------------------------------
43BC 00222 TIA_TUNE_Wait
43BC 6E06      00223         movwf   TMP1
43BE 0004      00224         clrwdt
43C0 00225 TIA_TUNE_WaitLoop
43C0 0E0A      00226         movlw   10
43C2 ECCE F016 00227         call    MIOS_Delay
43C6 2E06      00228         decfsz  TMP1, F
               00229         rgoto   TIA_TUNE_WaitLoop
43C8 D7FB          M         bra     label
43CA 0012      00230         return
               00383 #include "tia_sr.inc"
               00001 ; $Id: tia_sr.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; TIA Shift Register Service Routine
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 108


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 ;
               00014 ; define the pins to which the MBHPS_TIA module is connected
               00015 ;
               00016 #if DEFAULT_IS_CARTRIDGE==1
  00000F8B     00017 TIA_SR_LAT_SCLK EQU     LATC
  00000000     00018 TIA_SR_PIN_SCLK EQU     0               ; Pin C.0
  00000F8B     00019 TIA_SR_LAT_RCLK EQU     LATC
  00000002     00020 TIA_SR_PIN_RCLK EQU     2               ; Pin C.2
  00000F8B     00021 TIA_SR_LAT_OUT  EQU     LATC
  00000003     00022 TIA_SR_PIN_OUT  EQU     3               ; Pin C.3
               00023 
  00000F8B     00024 TIA_SR_LAT_WR     EQU   LATC
  00000001     00025 TIA_SR_PIN_WR     EQU   1               ; Pin C.1
               00026 #else    
               00027 TIA_SR_LAT_SCLK EQU     LATD
               00028 TIA_SR_PIN_SCLK EQU     5               ; Pin D.5
               00029 TIA_SR_LAT_RCLK EQU     LATC
               00030 TIA_SR_PIN_RCLK EQU     4               ; Pin C.4
               00031 TIA_SR_LAT_OUT  EQU     LATD
               00032 TIA_SR_PIN_OUT  EQU     6               ; Pin D.6
               00033 
               00034 TIA_SR_LAT_WR   EQU     LATC
               00035 TIA_SR_PIN_WR   EQU     5               ; Pin C.5
               00036 #endif
               00037 
               00038 ;; --------------------------------------------------------------------------
               00039 ;;  Initialize the MBHP_TIA module
               00040 ;; --------------------------------------------------------------------------
43CC 00041 TIA_SR_Init
               00042         ;; reset the TIA
43CC 6A03      00043     clrf        MIOS_PARAMETER1
43CE 6A04      00044         clrf    MIOS_PARAMETER2
43D0 D827      00045         rcall   TIA_SR_Write     
43D2 0012      00046     return
               00047         ;; reset will be released with first call of TIA_SR_Handler
               00048 
               00049 ;; --------------------------------------------------------------------------
               00050 ;;  Check for changes in TIA registers, transfer values to TIA
               00051 ;;  and handle Wavetable
               00052 ;; --------------------------------------------------------------------------
43D4 00053 TIA_SR_Handler
43D4 B010      00054         btfsc   TIA_STAT, TIA_STAT_ENGINE_DISABLE
43D6 0012      00055         return
               00056 
               00057         ;call   TIA_WT_Handler                  ; call wavetable handler before continue
43D8 00058 _TIA_SR_Handler
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 109


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
43D8 00059 TIA_SR_Start
               00060 
               00061         TABLE_ADDR TIA_SR_REGWRITE_TABLE        ; contains order of register accesses
43D8 0EDA          M         movlw   LOW(addr)               ; store Lo Byte
43DA 6EF6          M         movwf   TBLPTRL
43DC 0E44          M         movlw   HIGH(addr)              ; store Hi Byte
43DE 6EF7          M         movwf   TBLPTRH
                   M #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
43E0 0E00          M         movlw   UPPER(addr)             ; store Upper Byte
43E2 6EF8          M         movwf   TBLPTRU
                   M #endif
43E4 0E06      00062         movlw   6               ; number of registers (0x06)
43E6 6E06      00063         movwf   TMP1                            ; TMP1 is the loop counter
43E8 EE01 F000 00064         lfsr    FSR0, TIA_BASE                  ; store base address of TIA registers in FSR0
43EC EE11 F010 00065         lfsr    FSR1, TIA_SHADOW_BASE           ; store base address of shadow registers in FSR1
               00066 
               00067         IRQ_DISABLE                             ; disable interrupts
43F0 9EF2          M         bcf     INTCON, GIE
               00068 
43F2 00069 TIA_SR_Loop
43F2 0009      00070         tblrd*+
43F4 50F5      00071         movf    TABLAT, W
43F6 CFEB F004 00072         movff   PLUSW0, MIOS_PARAMETER2         ; store value of TIA in MIOS_PARAMETER1 and increment FSR0
               00073         BRA_IFSET TIA_STAT, TIA_STAT_FORCE_REFRESH, ACCESS, TIA_SR_Transfer; don't skip if refresh has been forced
43FA B210          M         btfsc   reg, bit, reg_a
43FC D004          M         bra     label
43FE 50E3      00074         movf    PLUSW1, W                       ; get content of appr. shadow register
4400 6204      00075         cpfseq  MIOS_PARAMETER2, ACCESS; transfer to TIA if not equal
               00076         rgoto TIA_SR_Transfer   
4402 D001          M         bra     label
               00077         rgoto   TIA_SR_Next                     ; skip following code if equal
4404 D008          M         bra     label
               00078 
4406 00079 TIA_SR_Transfer
               00080         ;; register change: write value into shadow register and transfer it to TIA
4406 50F5      00081         movf    TABLAT, W
4408 C004 FFE3 00082         movff   MIOS_PARAMETER2, PLUSW1         ; store value in shadow register
               00083 
440C 50F5      00084         movf    TABLAT, W                       ; extract address, add offset
440E 0F05      00085     addlw   0x05
4410 6E03      00086         movwf   MIOS_PARAMETER1                 ; store in address register
               00087 
4412 D806      00088         rcall   TIA_SR_Write                    ; transfer to TIA
4414 816A      00089     bsf     TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ
               00090     
4416 00091 TIA_SR_Next
4416 2E06      00092         decfsz  TMP1, F                         ; decrement loop counter until it is zero
               00093         rgoto   TIA_SR_Loop
4418 D7EC          M         bra     label
               00094 
               00095         IRQ_ENABLE                              ; enable interrupts again
441A 8EF2          M         bsf     INTCON, GIE
               00096 
441C 9210      00097         bcf     TIA_STAT, TIA_STAT_FORCE_REFRESH; clear refresh request (if it has been set before)
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 110


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00098 
441E 0012      00099         return
               00100         
               00101 ;; --------------------------------------------------------------------------
               00102 ;;  TIA Write: write to TIA register
               00103 ;; --------------------------------------------------------------------------
4420 00104 TIA_SR_Write
               00105         ;; TIA signals:
               00106         ;; MIOS_PARAMETER2[4..0]: Data
               00107         ;; MIOS_PARAMETER1[3..0]: Address
               00108         ;; temporary used as counter: MIOS_PARAMETER3
               00109 
4420 908B      00110     bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK    ; clear clock
               00111 
               00112         ;; superfast transfer with unrolled loop (takes some memory, but guarantees the
               00113         ;; lowest system load :)
               00114 TIA_SR_WRITE_BIT MACRO reg, bit
               00115         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
               00116         btfsc   reg, bit
               00117         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
               00118         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
               00119         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00120         ENDM
               00121 #if DEFAULT_IS_CARTRIDGE==1
               00122         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 4     ; IC8.O0
4422 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4424 B804          M         btfsc   reg, bit
4426 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4428 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
442A 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00123         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 3     ; IC8.O1
442C 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
442E B604          M         btfsc   reg, bit
4430 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4432 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4434 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00124         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 2     ; IC8.O2
4436 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4438 B404          M         btfsc   reg, bit
443A 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
443C 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
443E 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00125         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 1     ; IC8.O3
4440 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4442 B204          M         btfsc   reg, bit
4444 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4446 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4448 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00126         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 0     ; IC8.O4
444A 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
444C B004          M         btfsc   reg, bit
444E 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4450 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4452 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 111


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00127         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O5
4454 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4456 BE04          M         btfsc   reg, bit
4458 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
445A 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
445C 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00128         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O6
445E 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4460 BE04          M         btfsc   reg, bit
4462 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4464 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4466 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00129         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O7
4468 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
446A BE04          M         btfsc   reg, bit
446C 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
446E 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4470 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00130 
               00131         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 3     ; IC7.O0
4472 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4474 B603          M         btfsc   reg, bit
4476 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4478 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
447A 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00132         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 2     ; IC7.O1
447C 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
447E B403          M         btfsc   reg, bit
4480 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4482 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4484 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00133         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 1     ; IC7.O2
4486 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4488 B203          M         btfsc   reg, bit
448A 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
448C 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
448E 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00134         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 0     ; IC7.O3
4490 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4492 B003          M         btfsc   reg, bit
4494 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4496 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4498 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00135         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O4
449A 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
449C BE03          M         btfsc   reg, bit
449E 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
44A0 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
44A2 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00136         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O5
44A4 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
44A6 BE03          M         btfsc   reg, bit
44A8 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
44AA 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 112


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
44AC 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00137         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O6
44AE 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
44B0 BE03          M         btfsc   reg, bit
44B2 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
44B4 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
44B6 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00138         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O7
44B8 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
44BA BE03          M         btfsc   reg, bit
44BC 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
44BE 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
44C0 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00139 
               00140 #else    
               00141         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 0     ; IC2.O0
               00142         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 1     ; IC2.O1
               00143         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 2     ; IC2.O2
               00144         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 3     ; IC2.O3
               00145         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 4     ; IC2.O4
               00146         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O5
               00147         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O6
               00148         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O7
               00149 
               00150         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 3     ; IC3.O0
               00151         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 2     ; IC3.O1
               00152         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 1     ; IC3.O2
               00153         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 0     ; IC3.O3
               00154         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O4
               00155         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O5
               00156         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O6
               00157         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O7
               00158 #endif
44C2 848B      00159     bsf     TIA_SR_LAT_RCLK, TIA_SR_PIN_RCLK    ; latch TIA values
               00160 
44C4 928B      00161         bcf     TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; enable write (MBHP_TIA: chip select)
44C6 968B      00162         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT      ; clear out pin (standby)
44C8 948B      00163     bcf     TIA_SR_LAT_RCLK, TIA_SR_PIN_RCLK    ; release latch
               00164     
44CA 928B      00165     bcf TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; enable write (MBHP_TIA: chip select)
44CC D000      00166         bra     $+2                             ; to ensure compatibility with on-board oscillator,
44CE D000      00167         bra     $+2                             ; wait for 0.840 uS (1 us) (> one TIA clock cycle)
44D0 D000      00168         bra     $+2
44D2 D000      00169         bra     $+2
44D4 D000      00170         bra     $+2
44D6 828B      00171         bsf     TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; disable write (MBHP_TIA: chip select)
               00172     
44D8 0012      00173         return
               00174 
               00175 ;; --------------------------------------------------------------------------
44DA 00176 TIA_SR_REGWRITE_TABLE
               00177         ;; order in which the TIA registers are written
44DA 0100 0302 00178         db      0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
     0504 0006 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 113


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00179     
               00180     
               00181     
               00182     
               00384 #include "tia_sw.inc"
               00001 ; $Id: tia_sw.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Software Synthesizer Engine
               00005 ; mostly optimized for PIC16F - special adaption for PIC18F to be done
               00006 ;  
               00007 ; Activate this #define to measure the performance with a scope
               00008 ; (connect the probe to J14)
44E2 00009 #define TIA_SW_MEASURE_PERFORMANCE 0
               00010 ;
               00011 ; ==========================================================================
               00012 ;
               00013 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00014 ;  Idea for ENV Curve Parameter and OSC synchronization by Jess D. Skov-Nielsen
               00015 ;  Licensed for personal non-commercial use only.
               00016 ;  All other rights reserved.
               00017 ; 
               00018 ; ==========================================================================
               00019 
               00020 ;; ==========================================================================
               00021 ;;  TIA Flags
               00022 ;; ==========================================================================
               00023 
               00024 
               00025 
               00026 
  00000000     00027 Vx_STAT_VOICE_ACTIVE     EQU 0
  00000001     00028 Vx_STAT_GATE_SET_REQ     EQU 1
  00000002     00029 Vx_STAT_GATE_CLR_REQ     EQU 2
  00000003     00030 Vx_STAT_GATE_ACTIVE      EQU 3
  00000004     00031 Vx_STAT_PORTA_ENABLE     EQU 4
  00000005     00032 Vx_STAT_GATE_NOTE_ON     EQU 5
  00000006     00033 Vx_STAT_ENV_ACTIVE       EQU 6
               00034 
  00000000     00035 Vx_MODE_GSA_ACTIVE       EQU 0
  00000001     00036 Vx_MODE_PORTA_CONST      EQU 1
  00000002     00037 Vx_MODE_KEY_EXTENDED     EQU 2
  00000003     00038 Vx_MODE_VEL2AMP_ON       EQU 3
  00000004     00039 Vx_MODE_ENV2AMP_ON       EQU 4
  00000005     00040 Vx_MODE_ENV2PITCH_ON     EQU 5
  00000006     00041 Vx_MODE_ARP_SYNC_ON      EQU 6
               00042 
  00000000     00043 ENVAUDx_MODTYP_AB        EQU 0
  00000001     00044 ENVAUDx_MODTYP_AxB       EQU 1
  00000003     00045 Vx_ENV_SYNC_ON           EQU 3
               00046 
  00000000     00047 Vx_OPTION_WT_ON          EQU 0
  00000001     00048 Vx_OPTION_WTSYNC_ON      EQU 1
  00000002     00049 Vx_OPTION_KIT_ON         EQU 2
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 114


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00000003     00050 Vx_OPTION_SAMPLER_ON     EQU 3
               00051 
  00000000     00052 LFOx_MODE_ENABLE                 EQU 0
  00000001     00053 LFOx_MODE_SYNC           EQU 1
  00000002     00054 LFOx_MODE_SYNC_ALL       EQU 2
  00000003     00055 LFOx_MODE_RESERVED       EQU 3
  00000004     00056 LFOx_MODE_WAVEFORM0      EQU 4
  00000005     00057 LFOx_MODE_WAVEFORM1      EQU 5
  00000006     00058 LFOx_MODE_WAVEFORM2      EQU 6
  00000007     00059 LFOx_MODE_DECINC                 EQU 7
               00060 
  00000000     00061 ENVx_MODE_ATTACK                 EQU 0
  00000001     00062 ENVx_MODE_DECAY          EQU 1
  00000002     00063 ENVx_MODE_SUSTAIN        EQU 2
  00000003     00064 ENVx_MODE_RELEASE        EQU 3
  00000004     00065 ENVx_MODE_FREE           EQU 4
               00066 ;ENVx_MODE_RESERVED      EQU 5
               00067 ;ENVx_MODE_RESERVED      EQU 6
               00068 ;ENVx_MODE_RESERVED      EQU 7
               00069 
               00070 
  00000000     00071 ASSIGNED_LFOS_1         EQU     0
  00000001     00072 ASSIGNED_LFOS_2         EQU     1
  00000002     00073 ASSIGNED_LFOS_3         EQU     2
  00000003     00074 ASSIGNED_LFOS_4         EQU     3
  00000004     00075 ASSIGNED_ENVS_1         EQU     4
  00000005     00076 ASSIGNED_ENVS_2         EQU     5
  00000006     00077 ASSIGNED_ENVS_A0        EQU     6
  00000007     00078 ASSIGNED_ENVS_A1        EQU     7
               00079 
  00000000     00080 WT_STATE_STOP           EQU     0
  00000001     00081 WT_STATE_RESET          EQU     1
               00082 
  00000004     00083 WT_STATE_GATE           EQU     4       ; for TB303 option
  00000005     00084 WT_STATE_SLIDE          EQU     5
  00000006     00085 WT_STATE_SLIDE_PREV     EQU     6
  00000007     00086 WT_STATE_PLAY_2ND       EQU     7
               00087 
  00000000     00088 SE_OPTION_TB303         EQU     0
  00000001     00089 SE_OPTION_FIP           EQU     1
  00000002     00090 SE_OPTION_ENV2PORTA     EQU     2
  00000003     00091 SE_OPTION_ENV2VOL       EQU     3
  00000004     00092 SE_OPTION_GSA           EQU     4
               00093 
               00094 ;; ==========================================================================
               00095 
               00096 
               00097 ;; --------------------------------------------------------------------------
               00098 ;;  TIA Software Handler: Software Synthesizer part for the TIA
               00099 ;;  called by User Timer every 800 us
               00100 ;; --------------------------------------------------------------------------
44E2 00101 TIA_SW_Handler
               00102 #if TIA_SW_MEASURE_PERFORMANCE
               00103         bsf     PORTD, 4
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 115


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00104 #endif
               00105 
               00106         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
44E2 0101          M         movlb   HIGH(reg)
               00107 
               00108         ;; return immediately if engine has been disabled
44E4 B010      00109         btfsc   TIA_STAT, TIA_STAT_ENGINE_DISABLE
44E6 0012      00110         return
               00111 
               00112         ;; handle with MIDI clock
44E8 00113 TIA_SW_Clk
44E8 2BF1      00114         incf    TIA_MIDI_SYNC_CTR, F, BANKED
               00115 
               00116         ;; register last counter value on 0xf8 or if TIA_MIDI_SYNC_CTR == 0xff (no clock received)
44EA 9DF0      00117         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED
44EC 29F1      00118         incf    TIA_MIDI_SYNC_CTR, W, BANKED
44EE E003      00119         bz      TIA_SW_Clk_F8
               00120         BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_F8, BANKED, TIA_SW_Clk_NoF8
44F0 A9F0          M         btfss   reg, bit, reg_a
44F2 D005          M         bra     label
44F4 99F0      00121         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_F8, BANKED
44F6 00122 TIA_SW_Clk_F8
44F6 8DF0      00123         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED
44F8 C1F1 F1F2 00124         movff   TIA_MIDI_SYNC_CTR, TIA_MIDI_SYNC_CTR_REG
44FC 6BF1      00125         clrf    TIA_MIDI_SYNC_CTR, BANKED
44FE 00126 TIA_SW_Clk_NoF8
               00127 
               00128         ;; handle with double resolution of TIA_SW clock
44FE 9FF0      00129         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00130 
               00131         ;; if MIDI sync enabled: clock LFOs/ENVs two times on every MIDI clock event
4500 51F1      00132         movf    TIA_MIDI_SYNC_CTR, W, BANKED
4502 B4D8      00133         skpnz
4504 8FF0      00134         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00135 
4506 90D8      00136         clrc
4508 31F2      00137         rrf     TIA_MIDI_SYNC_CTR_REG, W, BANKED
450A 19F1      00138         xorwf   TIA_MIDI_SYNC_CTR, W, BANKED
450C B4D8      00139         skpnz
450E 8FF0      00140         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00141 
               00142         ;; A MIDI clock start event restarts all LFOs
               00143         BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_FA, BANKED, TIA_SW_Clk_NoFA
4510 ABF0          M         btfss   reg, bit, reg_a
4512 D003          M         bra     label
4514 9BF0      00144         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_FA, BANKED
4516 00145 TIA_SW_Clk_FA
4516 ECA2 F027 00146         call    TIA_SW_Hlp_SyncAllLFOs
               00147 
               00148         ;btfsc  TIA_SE_OPTION, SE_OPTION_TB303, BANKED
               00149         ;bsf    TIA_WT_STATE, WT_STATE_RESET, BANKED
               00150 
451A 00151 TIA_SW_Clk_NoFA
               00152 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 116


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
451A CFF3 F1F6 00153         movff   PRODL, SAVED_PRODL      ; save PROD[LH] - we are in an interrupt routine
451E CFF4 F1F7 00154         movff   PRODH, SAVED_PRODH
               00155 
               00156         ;; generate new pseudo-random number
4522 511C      00157         movf    TIA_LFO_RANDOM_SEED_L, W, BANKED
4524 031D      00158         mulwf   TIA_LFO_RANDOM_SEED_H, BANKED
4526 50D6      00159         movf    TMR0L, W
4528 24F3      00160         addwf   PRODL, W
452A 6F1C      00161         movwf   TIA_LFO_RANDOM_SEED_L, BANKED
452C 0E69      00162         movlw   0x69
452E 20F4      00163         addwfc  PRODH, W
4530 6F1D      00164         movwf   TIA_LFO_RANDOM_SEED_H, BANKED
               00165 
               00166 
               00167         ;; wavetable handler: check for MIDI Sync
               00168 ;       BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_WT_ARP, BANKED, TIA_SW_Wt
               00169 ;       BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED, TIA_SW_Wt_End
               00170 ;TIA_SW_Wt
               00171 ;       movf    TIA_WT_RATE, W, BANKED
               00172 ;       bz      TIA_SW_Wt_End
               00173 
               00174 ;       movf    TIA_WT_CTR, W, BANKED
               00175 ;       bnz     TIA_SW_Wt_Next
               00176 
               00177 ;       comf    TIA_WT_RATE, W, BANKED
               00178 ;       andlw   0x7f
               00179 ;       BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_WT_ARP, BANKED, TIA_SW_Wt_IntClk
               00180 ;TIA_SW_Wt_ExtClk
               00181 ;       btfss   TIA_SE_OPTION, SE_OPTION_TB303, BANKED
               00182 ;       addlw 1
               00183 ;       movwf   TIA_WT_CTR, BANKED      
               00184 ;       rgoto   TIA_SW_Wt_PlayNext
               00185 ;TIA_SW_Wt_IntClk
               00186 ;       skpnz                   ; never use 0x00 (avoid wdt reset on overloaded engine)
               00187 ;       addlw   1
               00188 ;       movwf   TIA_WT_CTR, BANKED
               00189 ;       clrc
               00190 ;       rlf     TIA_WT_CTR, F, BANKED
               00191         ;;      rgoto   TIA_SW_Wt_PlayNext
               00192 
               00193 ;TIA_SW_Wt_PlayNext
               00194 ;       incf    TIA_WT_CLK_REQ_CTR, F, BANKED
               00195 ;       rgoto   TIA_SW_Wt_End
               00196 
               00197 ;TIA_SW_Wt_Next
               00198 ;       decf    TIA_WT_CTR, F, BANKED
               00199 ;TIA_SW_Wt_End
               00200 
               00201         ;; ARPs: check for MIDI Sync
4532 00202 TIA_SW_ARPs
4532 EE11 F020 00203         lfsr    FSR1, TIA_V1_BASE
4536 0E04      00204     movlw       TIA_Vx_MODE
4538 BCE3      00205     btfsc   PLUSW1, Vx_MODE_ARP_SYNC_ON
453A BFF0      00206     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 117


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
453C D858      00207         rcall   TIA_SW_Arp
453E EE11 F060 00208         lfsr    FSR1, TIA_V2_BASE
4542 0E04      00209     movlw       TIA_Vx_MODE
4544 BCE3      00210     btfsc   PLUSW1, Vx_MODE_ARP_SYNC_ON
4546 BFF0      00211     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4548 D852      00212         rcall   TIA_SW_Arp
454A 00213 TIA_SW_ARPs_End
               00214 
               00215         ;; LFOs: check for MIDI Sync
454A 00216 TIA_SW_LFOs
454A 6B0F      00217         clrf    TIA_SW_LFO_NUMBER, BANKED
454C EE11 F0A0 00218     lfsr        FSR1, TIA_LFO1_BASE
4550 B11F      00219     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_1, BANKED
4552 BFF0      00220     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4554 DB3F      00221         rcall   TIA_SW_LFO
4556 2B0F      00222         incf    TIA_SW_LFO_NUMBER, F, BANKED
4558 EE11 F0A7 00223     lfsr        FSR1, TIA_LFO2_BASE
455C B31F      00224     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_2, BANKED
455E BFF0      00225     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4560 DB39      00226         rcall   TIA_SW_LFO
4562 2B0F      00227         incf    TIA_SW_LFO_NUMBER, F, BANKED
4564 EE11 F0AE 00228     lfsr        FSR1, TIA_LFO3_BASE
4568 B51F      00229     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_3, BANKED
456A BFF0      00230     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
456C DB33      00231         rcall   TIA_SW_LFO
456E 2B0F      00232         incf    TIA_SW_LFO_NUMBER, F, BANKED
4570 EE11 F0B5 00233     lfsr        FSR1, TIA_LFO4_BASE
4574 B71F      00234     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_4, BANKED
4576 BFF0      00235     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4578 DB2D      00236         rcall   TIA_SW_LFO
457A 00237 TIA_SW_LFOs_End
               00238 
               00239         ;; ENVs: check for MIDI Sync
457A 00240 TIA_SW_ENVs
               00241     ;; Enveloppe for AUD0(voice 1)
457A 6B0F      00242         clrf    TIA_SW_ENV_NUMBER, BANKED
457C EE11 F0BC 00243     lfsr        FSR1, TIA_ENVAUD0_BASE
4580 EE21 F020 00244     lfsr        FSR2, TIA_V1_BASE
4584 0E2A      00245     movlw   TIA_Vx_ENV_OPTION
               00246     BRA_IFCLR   PLUSW2, Vx_ENV_SYNC_ON, ACCESS, TIA_SW_ENVs_v1_Ok
4586 A6DB          M         btfss   reg, bit, reg_a
4588 D002          M         bra     label
               00247     BRA_IFCLR   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED, TIA_SW_ENVs_v1_Nok
458A AFF0          M         btfss   reg, bit, reg_a
458C D003          M         bra     label
458E 00248 TIA_SW_ENVs_v1_Ok
458E 38DB      00249         swapf   PLUSW2, W
4590 0B07      00250     andlw   0x07
4592 DB66      00251         rcall   TIA_SW_ENV
4594 00252 TIA_SW_ENVs_v1_Nok
               00253     ;; Enveloppe for AUD1(voice 2)
4594 2B0F      00254         incf    TIA_SW_ENV_NUMBER, BANKED
4596 EE11 F0C7 00255     lfsr        FSR1, TIA_ENVAUD1_BASE
459A EE21 F060 00256     lfsr        FSR2, TIA_V2_BASE
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 118


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
459E 0E2A      00257     movlw   TIA_Vx_ENV_OPTION
               00258     BRA_IFCLR   PLUSW2, Vx_ENV_SYNC_ON, ACCESS, TIA_SW_ENVs_v2_Ok
45A0 A6DB          M         btfss   reg, bit, reg_a
45A2 D002          M         bra     label
               00259     BRA_IFCLR   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED, TIA_SW_ENVs_v2_Nok
45A4 AFF0          M         btfss   reg, bit, reg_a
45A6 D003          M         bra     label
45A8 00260 TIA_SW_ENVs_v2_Ok
45A8 38DB      00261         swapf   PLUSW2, W
45AA 0B07      00262     andlw   0x07
45AC DB59      00263         rcall   TIA_SW_ENV
45AE 00264 TIA_SW_ENVs_v2_Nok
               00265     ;; Enveloppe 1
45AE 2B0F      00266         incf    TIA_SW_ENV_NUMBER, BANKED
45B0 EE11 F0D2 00267     lfsr        FSR1, TIA_ENV1_BASE
45B4 511E      00268         movf    TIA_ENVx_CURVES, W, BANKED
45B6 B91F      00269     btfsc   TIA_MOD_SYNC, ASSIGNED_ENVS_1, BANKED
45B8 BFF0      00270     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
45BA DB52      00271         rcall   TIA_SW_ENV
               00272     ;; Enveloppe 2
45BC 2B0F      00273         incf    TIA_SW_ENV_NUMBER, BANKED
45BE EE11 F0DD 00274     lfsr        FSR1, TIA_ENV2_BASE
45C2 391E      00275         swapf   TIA_ENVx_CURVES, W, BANKED
45C4 BB1F      00276     btfsc   TIA_MOD_SYNC, ASSIGNED_ENVS_2, BANKED
45C6 BFF0      00277     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
45C8 DB4B      00278         rcall   TIA_SW_ENV
45CA 00279 TIA_SW_ENVs_End
               00280 
               00281     SET_BSR     TIA_BASE
45CA 0101          M         movlb   HIGH(reg)
45CC 6B0E      00282         clrf    TIA_SW_VOICE, BANKED    ; loop counter
45CE EE11 F020 00283         lfsr    FSR1, TIA_V1_BASE
45D2 00284 TIA_SW_VoiceLoop
45D2 0E10      00285         movlw   TIA_Vx_NOTE
45D4 50E3      00286         movf    PLUSW1, W
45D6 E002      00287         bz      TIA_SW_VoiceLoop_NoPitchChange
45D8 00288 TIA_SW_VoiceLoop_PitchChange
45D8 D85C      00289         rcall   TIA_SW_Note
45DA D8D0      00290         rcall   TIA_SW_Pitch
               00291    
45DC 00292 TIA_SW_VoiceLoop_NoPitchChange
45DC D992      00293         rcall   TIA_SW_Porta
45DE DA3C      00294     rcall       TIA_SW_Amp
               00295 
45E0 00296 TIA_SW_VoiceLoop_Next
45E0 0E40      00297         movlw   TIA_Vx_RECORD_LEN
45E2 26E1      00298         addwf   FSR1L, F
45E4 2B0E      00299         incf    TIA_SW_VOICE, F, BANKED
45E6 0E01      00300         movlw   2-1
45E8 650E      00301         cpfsgt  TIA_SW_VOICE, BANKED
               00302         rgoto TIA_SW_VoiceLoop
45EA D7F3          M         bra     label
               00303 
45EC 00304 TIA_SW_Handler_End
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 119


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00305 
               00306 #if TIA_SW_MEASURE_PERFORMANCE
               00307         bcf     PORTD, 4
               00308 #endif
               00309 
45EC 0012      00310         return
               00311 
               00312 
               00313 
               00314 
               00315 
               00316 ;; --------------------------------------------------------------------------
               00317 ;; This function handles the arpeggiator
               00318 ;; --------------------------------------------------------------------------
45EE 00319 TIA_SW_Arp
               00320         ;; skip if arpeggiator rate == 0
45EE 0E13      00321         movlw   TIA_Vx_ARP_RATE
45F0 50E3      00322         movf    PLUSW1, W
45F2 E04E      00323         bz      TIA_SW_Arp_End
               00324 
               00325         ;; a counter is incremented on each function call
               00326         ;; arpeggiator is stepped forward once the counter has reached the
               00327         ;; compare value: rate^0x7f + 1, multiply by 2 if MIDI sync not enabled
45F4 0A7F      00328         xorlw   0x7f
45F6 0F01      00329         addlw   1
45F8 6E0B      00330     movwf       IRQ_TMP1        ; compare value => IRQ_TMP1
45FA 90D8      00331         clrc
45FC 0E04      00332     movlw       TIA_Vx_MODE
45FE ACE3      00333         btfss   PLUSW1, Vx_MODE_ARP_SYNC_ON, ACCESS     ; (*2 reduce the rate a little if no MIDI sync)
4600 360B      00334         rlf     IRQ_TMP1, F
               00335 
4602 0E01      00336         movlw   1
4604 6E0C      00337         movwf   IRQ_TMP2        ; incrementer => IRQ_TMP2
               00338 
               00339         ;; special option: constant time arp cycle
               00340         ;; if 1 key is pressed, use the original incrementer
               00341         ;; if 2 keys are pressed, increment by 2
               00342         ;; if 3 keys are pressed, increment by 3
               00343         ;; if 4 keys are pressed, increment by 4
4606 0E23      00344         movlw   TIA_Vx_NOTE_STACK_1
4608 50E3      00345         movf    PLUSW1, W
460A A4D8      00346         skpz
460C 2A0C      00347         incf    IRQ_TMP2, F
               00348 
460E 0E24      00349         movlw   TIA_Vx_NOTE_STACK_2
4610 50E3      00350         movf    PLUSW1, W
4612 A4D8      00351         skpz
4614 2A0C      00352         incf    IRQ_TMP2, F
               00353         
4616 0E25      00354         movlw   TIA_Vx_NOTE_STACK_3
4618 50E3      00355         movf    PLUSW1, W
461A A4D8      00356         skpz
461C 2A0C      00357         incf    IRQ_TMP2, F
               00358 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 120


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00359         ;; increment counter
461E 0E15      00360         movlw   TIA_Vx_ARP_CTR
4620 50E3      00361         movf    PLUSW1, W
4622 260C      00362         addwf   IRQ_TMP2, F
4624 E206      00363         bc      TIA_SW_Arp_Overrun
4626 0E15      00364         movlw   TIA_Vx_ARP_CTR
4628 C00C FFE3 00365         movff   IRQ_TMP2, PLUSW1
               00366 
               00367         ;; branch to the end so long the counter is less than the compare value
462C 500C      00368         movf    IRQ_TMP2, W
462E 5C0B      00369         subwf   IRQ_TMP1, W
4630 E22F      00370         bc      TIA_SW_Arp_End
               00371 
4632 00372 TIA_SW_Arp_Overrun
               00373         ;; clear counter
4632 0E15      00374         movlw   TIA_Vx_ARP_CTR
4634 6AE3      00375         clrf    PLUSW1
               00376 
               00377         ;; increment note number (1 of 4)
4636 0E14      00378         movlw   TIA_Vx_ARP_NOTE_NUMBER
4638 28E3      00379         incf    PLUSW1, W
463A 0B03      00380         andlw   0x03
463C 6E0B      00381         movwf   IRQ_TMP1
               00382 
               00383         ;; reset note number if last one reached (TIA_Vx_NOTE_STACK_x is zero)
463E 0E22      00384         movlw   TIA_Vx_NOTE_STACK_0
4640 240B      00385         addwf   IRQ_TMP1, W
4642 50E3      00386         movf    PLUSW1, W
4644 B4D8      00387         skpnz
4646 6A0B      00388         clrf    IRQ_TMP1
               00389 
               00390         ;; save new note number
4648 0E14      00391         movlw   TIA_Vx_ARP_NOTE_NUMBER
464A C00B FFE3 00392         movff   IRQ_TMP1, PLUSW1
               00393         
               00394         ;; select note
464E 0E1E      00395         movlw   TIA_Vx_ARP_NOTE_0
4650 240B      00396         addwf   IRQ_TMP1, W
               00397 
               00398         ;; save new note number if != zero and != last note
4652 50E3      00399         movf    PLUSW1, W
4654 E01D      00400         bz      TIA_SW_Arp_NoNewNote
4656 6E0B      00401         movwf   IRQ_TMP1
4658 0E10      00402         movlw   TIA_Vx_NOTE
465A 50E3      00403         movf    PLUSW1, W
465C 180B      00404         xorwf   IRQ_TMP1, W
465E E018      00405         bz      TIA_SW_Arp_NoNewNote
4660 00406 TIA_SW_Arp_NewNote
4660 0E10      00407         movlw   TIA_Vx_NOTE
4662 C00B FFE3 00408         movff   IRQ_TMP1, PLUSW1
               00409 
               00410 
4666 0E0E      00411         movlw   TIA_Vx_PORTA_RATE
4668 50E3      00412         movf    PLUSW1, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 121


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
466A E012      00413         bz      TIA_SW_Arp_NoPorta
466C 00414 TIA_SW_Arp_Porta
466C 0E03      00415         movlw   TIA_Vx_STAT
466E 88E3      00416         bsf     PLUSW1, Vx_STAT_PORTA_ENABLE
               00417 
               00418         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
               00419 
               00420 
4670 0E09      00421         movlw   TIA_Vx_FRQ_L
4672 CFE3 F00B 00422         movff   PLUSW1, IRQ_TMP1
4676 0E0A      00423         movlw   TIA_Vx_FRQ_H
4678 CFE3 F00C 00424         movff   PLUSW1, IRQ_TMP2    
               00425 
467C 0E1C      00426         movlw   TIA_Vx_PORTA_FRQ_L
467E C00B FFE3 00427         movff   IRQ_TMP1, PLUSW1
4682 0E1D      00428         movlw   TIA_Vx_PORTA_FRQ_H
4684 C00C FFE3 00429         movff   IRQ_TMP2, PLUSW1   
               00430 
4688 0E1A      00431     movlw   TIA_Vx_PORTA_CTR_L 
468A 6AE3      00432         clrf    PLUSW1
468C 0E1B      00433     movlw   TIA_Vx_PORTA_CTR_H 
468E 6AE3      00434         clrf    PLUSW1
               00435 
               00436     
4690 00437 TIA_SW_Arp_NoV1
               00438 
4690 00439 TIA_SW_Arp_NoPorta
               00440 
4690 00441 TIA_SW_Arp_NoNewNote
               00442 
4690 00443 TIA_SW_Arp_End
4690 0012      00444         return
               00445 
               00446 
               00447 ;; --------------------------------------------------------------------------
               00448 ;; This function handles the gates and initial note frequency
               00449 ;; --------------------------------------------------------------------------
4692 00450 TIA_SW_Note
               00451 
               00452 
               00453    
               00454         ;; check note delay counter, set/clear gate bit
4692 0E12      00455         movlw   TIA_Vx_NOTE_DELAY_CTR
4694 50E3      00456         movf    PLUSW1, W
4696 E003      00457         bz      TIA_SW_Note_NoDelay
4698 0E12      00458         movlw   TIA_Vx_NOTE_DELAY_CTR
469A 06E3      00459         decf    PLUSW1, F
               00460         rgoto   TIA_SW_Note_DelayCont
469C D03F          M         bra     label
469E 00461 TIA_SW_Note_NoDelay
469E 0E03      00462         movlw   TIA_Vx_STAT
               00463         BRA_IFSET PLUSW1, Vx_STAT_GATE_CLR_REQ, ACCESS, TIA_SW_Note_NoteOffReq
46A0 B4E3          M         btfsc   reg, bit, reg_a
46A2 D003          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 122


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00464         BRA_IFSET PLUSW1, Vx_STAT_GATE_SET_REQ, ACCESS, TIA_SW_Note_NoteOnReq
46A4 B2E3          M         btfsc   reg, bit, reg_a
46A6 D01A          M         bra     label
               00465         rgoto   TIA_SW_Note_DelayCont
46A8 D039          M         bra     label
               00466     
46AA 00467 TIA_SW_Note_NoteOffReq
46AA 94E3      00468         bcf     PLUSW1, Vx_STAT_GATE_CLR_REQ
46AC 9AE3      00469     bcf     PLUSW1, Vx_STAT_GATE_NOTE_ON 
46AE 0E04      00470         movlw   TIA_Vx_MODE
               00471     ; (don't clear gate bit if GSA (gate stays active) 
               00472     BRA_IFSET PLUSW1, Vx_MODE_GSA_ACTIVE, ACCESS, TIA_SW_Note_NoteOffReqSkp
46B0 B0E3          M         btfsc   reg, bit, reg_a
46B2 D002          M         bra     label
46B4 0E03      00473         movlw   TIA_Vx_STAT
46B6 96E3      00474     bcf     PLUSW1, Vx_STAT_GATE_ACTIVE
46B8 00475 TIA_SW_Note_NoteOffReqSkp
               00476         ;; sync voice ENVs
46B8 0E04      00477     movlw       TIA_Vx_MODE
46BA 30E3      00478     rrf     PLUSW1, W
46BC 40E8      00479     rrncf   WREG, W
46BE 0B0C      00480     andlw   0x0c
46C0 B10E      00481     btfsc       TIA_SW_VOICE, 0, BANKED
46C2 38E8      00482     swapf   WREG, W
46C4 6E0B      00483         movwf   IRQ_TMP1
               00484         ;; sync assigned ENVs
46C6 0E17      00485     movlw       TIA_Vx_AMP_MOD
46C8 50E3      00486         movf    PLUSW1, W
46CA 0B30      00487     andlw   0x30
46CC 120B      00488     iorwf   IRQ_TMP1, F
               00489     
46CE 0E16      00490     movlw       TIA_Vx_PITCH_MOD    
46D0 38E3      00491         swapf   PLUSW1, W
46D2 0B03      00492     andlw   0x03
46D4 100B      00493     iorwf   IRQ_TMP1, W
46D6 ECDD F027 00494     call        TIA_SW_Hlp_ENVRelease
               00495         rgoto   TIA_SW_Note_DelayCont
46DA D020          M         bra     label
               00496 
46DC 00497 TIA_SW_Note_NoteOnReq
46DC 0E03      00498         movlw   TIA_Vx_STAT
46DE 92E3      00499         bcf     PLUSW1, Vx_STAT_GATE_SET_REQ
46E0 8AE3      00500     bsf     PLUSW1, Vx_STAT_GATE_NOTE_ON 
46E2 00501 TIA_SW_Note_NoteOnReqSkp
46E2 0E03      00502         movlw   TIA_Vx_STAT
46E4 86E3      00503         bsf     PLUSW1, Vx_STAT_GATE_ACTIVE
               00504     
               00505         ;; sync assigned LFOs
46E6 0E17      00506     movlw       TIA_Vx_AMP_MOD
46E8 50E3      00507         movf    PLUSW1, W
46EA 0B07      00508     andlw   0x07
46EC 6E0B      00509     movwf   IRQ_TMP1
               00510     
46EE 0E16      00511     movlw       TIA_Vx_PITCH_MOD    
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 123


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
46F0 50E3      00512         movf    PLUSW1, W
46F2 0B07      00513     andlw   0x07
46F4 100B      00514     iorwf   IRQ_TMP1, W
46F6 ECAB F027 00515         call    TIA_SW_Hlp_SyncLFOs
               00516 
               00517         ;; sync voice ENVs
46FA 0E04      00518     movlw       TIA_Vx_MODE
46FC 30E3      00519     rrf     PLUSW1, W
46FE 40E8      00520     rrncf   WREG, W
4700 0B0C      00521     andlw   0x0c
4702 B10E      00522     btfsc       TIA_SW_VOICE, 0, BANKED
4704 38E8      00523     swapf   WREG, W
4706 6E0B      00524         movwf   IRQ_TMP1
               00525  
               00526         ;; sync assigned ENVs
4708 0E17      00527     movlw       TIA_Vx_AMP_MOD
470A 50E3      00528         movf    PLUSW1, W
470C 0B30      00529     andlw   0x30
470E 120B      00530     iorwf   IRQ_TMP1, F
               00531     
4710 0E16      00532     movlw       TIA_Vx_PITCH_MOD    
4712 38E3      00533         swapf   PLUSW1, W
4714 0B03      00534     andlw   0x03
4716 100B      00535     iorwf   IRQ_TMP1, W
4718 ECC8 F027 00536         call    TIA_SW_Hlp_ENVAttack
               00537     
               00538 
               00539 
471C 00540 TIA_SW_Note_DelayCont
               00541 
471C 0E0C      00542         movlw   TIA_Vx_TRANSPOSE
471E 50E3      00543         movf    PLUSW1, W
4720 0840      00544         sublw   0x40
4722 0AFF      00545         xorlw   0xff
4724 6E0B      00546         movwf   IRQ_TMP1
4726 0E10      00547         movlw   TIA_Vx_NOTE
4728 50E3      00548         movf    PLUSW1, W
472A 240B      00549         addwf   IRQ_TMP1, W
472C 0F01      00550         addlw   1
472E 6E0C      00551         movwf   IRQ_TMP2
4730 087F      00552         sublw   0x7f
4732 E207      00553         bc      TIA_SW_Note_NoOverflow
4734 0E0C      00554         movlw   TIA_Vx_TRANSPOSE
               00555         BRA_IFSET PLUSW1, 6, ACCESS, TIA_SW_Note_PosSaturation
4736 BCE3          M         btfsc   reg, bit, reg_a
4738 D002          M         bra     label
473A 00556 TIA_SW_Note_NegSaturation
473A 6A0C      00557         clrf    IRQ_TMP2
               00558         rgoto   TIA_SW_Note_NoOverflow
473C D002          M         bra     label
473E 00559 TIA_SW_Note_PosSaturation
473E 0E7F      00560         movlw   0x7f
4740 6E0C      00561     movwf   IRQ_TMP2
4742 00562 TIA_SW_Note_NoOverflow
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 124


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00563         ;; set target frequency depending on note number
4742 500C      00564         movf    IRQ_TMP2, W
4744 BEE8      00565     btfsc       WREG, 7; the note value
4746 0E7F      00566         movlw 0x7f
4748 6E0C      00567     movwf   IRQ_TMP2
               00568     
474A 0E04      00569         movlw   TIA_Vx_MODE
               00570         BRA_IFSET PLUSW1, Vx_MODE_KEY_EXTENDED, ACCESS, TIA_SW_Note_KeyMode_Extended    
474C B4E3          M         btfsc   reg, bit, reg_a
474E D00D          M         bra     label
4750 00571 TIA_SW_Note_KeyMode_NonExtended 
4750 90D8      00572     clrc
4752 0E05      00573     movlw   TIA_Vx_KEY_OFFSET
4754 50E3      00574     movf    PLUSW1, W
4756 5E0C      00575     subwf   IRQ_TMP2, F
4758 0E00      00576     movlw   0x00
475A B0D8      00577     skpnc
475C 0E1F      00578     movlw   0x1f
475E 640C      00579     cpfsgt  IRQ_TMP2, ACCESS
4760 500C      00580     movf    IRQ_TMP2, W
4762 36E8      00581     rlf     WREG, F
4764 36E8      00582     rlf     WREG, F
4766 34E8      00583     rlf     WREG, W
               00584     rgoto   TIA_SW_Note_TargetCopy 
4768 D002          M         bra     label
               00585 
476A 00586 TIA_SW_Note_KeyMode_Extended      
               00587     ;;etendu (7bits to 8bits note)
476A 90D8      00588     clrc
476C 340C      00589     rlf     IRQ_TMP2, W
               00590 
476E 00591 TIA_SW_Note_TargetCopy
476E 6E03      00592     movwf   MIOS_PARAMETER1
               00593         
4770 0E08      00594         movlw   TIA_Vx_TARGET_FRQ_H
4772 C003 FFE3 00595         movff   MIOS_PARAMETER1, PLUSW1
4776 0E07      00596         movlw   TIA_Vx_TARGET_FRQ_L
4778 6AE3      00597         clrf    PLUSW1
477A 00598 TIA_SW_Note_End
477A 0012      00599         return
               00600   
               00601     
               00602 ;; --------------------------------------------------------------------------
               00603 ;; This function handles the Note Pitch
               00604 ;; --------------------------------------------------------------------------
477C 00605 TIA_SW_Pitch
               00606         ;; skip Pitchbender+Finetune processing if PITCHRANGE == zero
477C 0E0D      00607         movlw   TIA_Vx_PITCHRANGE
477E 50E3      00608         movf    PLUSW1, W
4780 E04D      00609         bz      TIA_SW_Pitch_MOD
               00610 
               00611     
               00612         ;; result stored in IRQ_TMP[12]
4782 6A0B      00613         clrf    IRQ_TMP1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 125


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4784 6A0C      00614         clrf    IRQ_TMP2
4786 6A0D      00615     clrf        IRQ_TMP3
               00616 
               00617         ;; calc IRQ_TMP[12] = pitchbender (9-bit signed)
4788 0E0B      00618         movlw   TIA_Vx_PITCHBENDER
478A 50E3      00619         movf    PLUSW1, W
478C 6E0B      00620     movwf       IRQ_TMP1
478E E007      00621         bz      TIA_SW_Pitch_NoPitchBender
4790 00622 TIA_SW_Pitch_PitchBender
4790 90D8      00623     clrc                        ; multiply with 2
4792 BE0B      00624         btfsc   IRQ_TMP1, 7
4794 80D8      00625         setc
4796 360B      00626     rlf     IRQ_TMP1, F
4798 360D      00627     rlf     IRQ_TMP3, F
479A B00D      00628         btfsc   IRQ_TMP3, 0     
479C 1E0B      00629     comf    IRQ_TMP1, F
479E 00630 TIA_SW_Pitch_NoPitchBender
               00631 
479E 90D8      00632         clrc
               00633         ;; skip tuning if IRQ_TMP[12] == zero
47A0 500B      00634         movf    IRQ_TMP1, W
47A2 100C      00635         iorwf   IRQ_TMP2, W
47A4 E03B      00636         bz      TIA_SW_Pitch_MOD
               00637 
47A6 500B      00638         movf    IRQ_TMP1, W
47A8 6FFA      00639         movwf   MUL_B_L, BANKED
47AA 500C      00640         movf    IRQ_TMP2, W
47AC 6FFB      00641         movwf   MUL_B_H, BANKED
               00642 
               00643         ;; get f_in[target], save it in IRQ_TMP[12]
47AE 90D8      00644     clrc
47B0 0E0C      00645         movlw   TIA_Vx_TRANSPOSE
47B2 50E3      00646         movf    PLUSW1, W
47B4 0840      00647         sublw   0x40
47B6 0AFF      00648         xorlw   0xff
47B8 6E0E      00649         movwf   IRQ_TMP4
47BA 0E10      00650         movlw   TIA_Vx_NOTE
47BC 50E3      00651         movf    PLUSW1, W
47BE 240E      00652         addwf   IRQ_TMP4, W
               00653         ;; add pitchrange depending on direction with saturation
               00654         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Pitch_Decrease
47C0 B00D          M         btfsc   reg, bit, reg_a
47C2 D009          M         bra     label
47C4 00655 TIA_SW_Pitch_Increase
               00656 
47C4 0F01      00657         addlw   1
47C6 6E0C      00658         movwf   IRQ_TMP2
47C8 0E0D      00659         movlw   TIA_Vx_PITCHRANGE
47CA 50E3      00660         movf    PLUSW1, W
47CC 240C      00661         addwf   IRQ_TMP2, W
47CE BEE8      00662         btfsc   WREG, 7
47D0 0E7F      00663         movlw 0x7f
47D2 6E0C      00664         movwf   IRQ_TMP2
               00665         rgoto   TIA_SW_Pitch_Increase_Cont
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 126


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
47D4 D006          M         bra     label
47D6 00666 TIA_SW_Pitch_Decrease
47D6 6E0C      00667         movwf   IRQ_TMP2
47D8 0E0D      00668         movlw   TIA_Vx_PITCHRANGE
47DA 04E3      00669         decf    PLUSW1, W
47DC 5E0C      00670         subwf   IRQ_TMP2, F
47DE BE0C      00671         btfsc   IRQ_TMP2, 7
47E0 6A0C      00672         clrf IRQ_TMP2
47E2 00673 TIA_SW_Pitch_Increase_Cont
               00674         ;; set target frequency depending on note number
47E2 500C      00675         movf    IRQ_TMP2, W
47E4 BEE8      00676     btfsc       WREG, 7; the note value
47E6 0E7F      00677         movlw 0x7f
47E8 6E0C      00678     movwf   IRQ_TMP2
               00679     
47EA 0E04      00680         movlw   TIA_Vx_MODE
               00681         BRA_IFSET PLUSW1, Vx_MODE_KEY_EXTENDED, ACCESS, TIA_SW_Pitch_KeyMode_Extended    
47EC B4E3          M         btfsc   reg, bit, reg_a
47EE D00B          M         bra     label
47F0 00682 TIA_SW_Pitch_KeyMode_NonExtended 
47F0 90D8      00683     clrc
47F2 0E05      00684     movlw   TIA_Vx_KEY_OFFSET
47F4 50E3      00685     movf    PLUSW1, W
47F6 5E0C      00686     subwf   IRQ_TMP2, F
47F8 0E1F      00687     movlw   0x1f
47FA 640C      00688     cpfsgt  IRQ_TMP2, ACCESS
47FC 500C      00689     movf    IRQ_TMP2, W
47FE 36E8      00690     rlf     WREG, F
4800 36E8      00691     rlf     WREG, F
4802 34E8      00692     rlf     WREG, W
               00693     rgoto   TIA_SW_Pitch_KeyMode_End 
4804 D002          M         bra     label
               00694 
4806 00695 TIA_SW_Pitch_KeyMode_Extended      
               00696     ;;etendu (7bits to 8bits note)
4806 90D8      00697     clrc
4808 340C      00698     rlf     IRQ_TMP2, W
               00699     
480A 00700 TIA_SW_Pitch_KeyMode_End    
480A 6E04      00701     movwf   MIOS_PARAMETER2
480C 6A03      00702     clrf    MIOS_PARAMETER1
               00703     
               00704         ;; result: low-byte in WREG and MIOS_PARAMETER1, high-byte in MIOS_PARAMETER2
               00705 
               00706         ;; add and multiply to target frequency
480E CFE2 FFDA 00707         movff   FSR1H, FSR2H
4812 50E1      00708         movf    FSR1L, W
4814 0F07      00709         addlw   TIA_Vx_TARGET_FRQ_L
4816 6ED9      00710         movwf   FSR2L
4818 ECF2 F027 00711         call    TIA_SW_Hlp_AddMul
               00712 
481C 00713 TIA_SW_Pitch_MOD
481C 0E04      00714     movlw       TIA_Vx_MODE
               00715     BRA_IFCLR PLUSW1, Vx_MODE_ENV2PITCH_ON, ACCESS, TIA_SW_Pitch_Mods
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 127


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
481E AAE3          M         btfss   reg, bit, reg_a
4820 D045          M         bra     label
               00716 
               00717     ;; store dedicated enveloppe value in MUL_A_[LH],sign in MIOS_PARAMETER3
4822 0E40      00718     movlw   0x40
4824 B10E      00719     btfsc   TIA_SW_VOICE, 0
4826 0E80      00720     movlw   0x80
4828 ECB8 F026 00721         call    TIA_SW_Hlp_GetMOD
               00722         ;; result in IRQ_TMP[123]
482C C00D F005 00723     movff   IRQ_TMP3, MIOS_PARAMETER3
4830 500C      00724     movf    IRQ_TMP2, W
               00725     ;btfsc   MIOS_PARAMETER3, 0
               00726     ;comf    IRQ_TMP2, W
4832 0B7F      00727     andlw   0x7f
4834 6FF9      00728     movwf   MUL_A_H
4836 500B      00729     movf    IRQ_TMP1, W
               00730     ;btfsc   MIOS_PARAMETER3, 0
               00731     ;comf    IRQ_TMP1, W
4838 6FF8      00732     movwf   MUL_A_L
               00733 
               00734         ;; modulate amplitude
               00735         ;; assigned LFOs and ENVs in WREG   
483A 0E16      00736         movlw   TIA_Vx_PITCH_MOD
483C 50E3      00737         movf    PLUSW1, W
483E 0B3F      00738     andlw   0x3f
4840 ECB8 F026 00739         call    TIA_SW_Hlp_GetMOD
               00740         ;; result in IRQ_TMP[123]
               00741    
4844 00742 TIA_SW_Pitch_Mods_Env_AxB
               00743     ;; Modulation mode
4844 0E2A      00744     movlw   TIA_Vx_ENV_OPTION
4846 50E3      00745     movf    PLUSW1, W
4848 0B03      00746     andlw   0x03
484A 28E8      00747     incf    WREG, W
               00748     BRA_IFCLR WREG, ENVAUDx_MODTYP_AxB, ACCESS, TIA_SW_Pitch_Mods_Env_AB  
484C A2E8          M         btfss   reg, bit, reg_a
484E D010          M         bra     label
               00749     BRA_IFSET WREG, ENVAUDx_MODTYP_AB, ACCESS,TIA_SW_Pitch_Mods_Env_AxB_NotDoubled
4850 B0E8          M         btfsc   reg, bit, reg_a
4852 D002          M         bra     label
               00750     ;; Double the Dedicated ENVAUDx for AxB only Mode
4854 37F8      00751     rlf     MUL_A_L, F
4856 37F9      00752     rlf     MUL_A_H, F    
4858 00753 TIA_SW_Pitch_Mods_Env_AxB_NotDoubled
4858 500C      00754     movf    IRQ_TMP2, W
485A 6FFB      00755     movwf   MUL_B_H
485C 500B      00756     movf    IRQ_TMP1, W
485E 6FFA      00757     movwf   MUL_B_L
               00758     ;; multiplication
4860 ECDE F019 00759         call    MATH_MUL16_16
4864 51FE      00760         movf    MUL_R_2, W, BANKED
4866 6E0B      00761     movwf   IRQ_TMP1   
4868 51FF      00762     movf        MUL_R_3, W, BANKED
486A 6E0C      00763     movwf   IRQ_TMP2
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 128


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00764     ;; process sign
486C 5005      00765     movf    MIOS_PARAMETER3, W
486E 1A0D      00766     xorwf   IRQ_TMP3, F
               00767 
4870 00768 TIA_SW_Pitch_Mods_Env_AB
               00769     ;; Modulation mode
4870 0E2A      00770     movlw   TIA_Vx_ENV_OPTION
4872 50E3      00771     movf    PLUSW1, W
4874 0B03      00772     andlw   0x03
4876 28E8      00773     incf    WREG, W
               00774     BRA_IFCLR WREG, ENVAUDx_MODTYP_AB, ACCESS,TIA_SW_Pitch_Mods_Cont
4878 A0E8          M         btfss   reg, bit, reg_a
487A D01E          M         bra     label
487C 5005      00775     movf    MIOS_PARAMETER3, W
487E 180D      00776     xorwf   IRQ_TMP3, W
4880 E00D      00777         bz      TIA_SW_Pitch_Mods_Env_AB_Add
4882 00778 TIA_SW_Pitch_Mods_Env_AB_Sub
4882 500B      00779         movf    IRQ_TMP1, W
4884 5DF8      00780         subwf   MUL_A_L, W
4886 6E0B      00781     movwf   IRQ_TMP1
4888 500C      00782         movf    IRQ_TMP2, W
488A 59F9      00783         subwfb  MUL_A_H, W
488C 6E0C      00784     movwf   IRQ_TMP2
488E E203      00785     bc      TIA_SW_Pitch_Mods_Env_AB_Sub_NoCarry
4890 1E0B      00786     comf    IRQ_TMP1, F        ;;Sign already in IRQ_TMP3
4892 1E0C      00787     comf    IRQ_TMP2, F
               00788     rgoto   TIA_SW_Pitch_Mods_Cont    
4894 D011          M         bra     label
4896 00789 TIA_SW_Pitch_Mods_Env_AB_Sub_NoCarry
4896 C005 F00D 00790     movff   MIOS_PARAMETER3, IRQ_TMP3
               00791     rgoto   TIA_SW_Pitch_Mods_Cont      
489A D00E          M         bra     label
               00792 
489C 00793 TIA_SW_Pitch_Mods_Env_AB_Add
489C 51F8      00794         movf    MUL_A_L, W
489E 260B      00795         addwf   IRQ_TMP1, F     
48A0 51F9      00796         movf    MUL_A_H, W
48A2 220C      00797         addwfc  IRQ_TMP2, F     
               00798         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
48A4 E309      00799         bnc     TIA_SW_Pitch_Mods_Cont
48A6 680B      00800         setf    IRQ_TMP1        
48A8 680C      00801         setf    IRQ_TMP2        
               00802     rgoto   TIA_SW_Pitch_Mods_Cont
48AA D006          M         bra     label
               00803 
48AC 00804 TIA_SW_Pitch_Mods
               00805         ;; modulate pitch
               00806         ;; assigned LFOs and ENVs in WREG
48AC 0E16      00807         movlw   TIA_Vx_PITCH_MOD
48AE 50E3      00808         movf    PLUSW1, W
48B0 0B3F      00809     andlw   0x3f
48B2 E00C      00810     bz      TIA_SW_Pitch_CopyFrq
48B4 ECB8 F026 00811         call    TIA_SW_Hlp_GetMOD
               00812         ;; unsigned result in IRQ_TMP[12]
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 129


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00813         ;; sign in IRQ_TMP3[0]    
               00814 
48B8 00815 TIA_SW_Pitch_Mods_Cont 
               00816         ;; skip tuning if IRQ_TMP[12] == zero
48B8 500B      00817         movf    IRQ_TMP1, W
48BA 100C      00818         iorwf   IRQ_TMP2, W
48BC E007      00819         bz      TIA_SW_Pitch_CopyFrq
               00820     
               00821         ;; add to target frequency
48BE CFE2 FFDA 00822         movff   FSR1H, FSR2H
48C2 50E1      00823         movf    FSR1L, W
48C4 0F07      00824         addlw   TIA_Vx_TARGET_FRQ_L
48C6 6ED9      00825         movwf   FSR2L
48C8 EC0E F028 00826         call    TIA_SW_Hlp_Add16
               00827                                                  
48CC 00828 TIA_SW_Pitch_CopyFrq
48CC 0E03      00829         movlw   TIA_Vx_STAT
               00830         BRA_IFSET PLUSW1, Vx_STAT_PORTA_ENABLE, ACCESS, TIA_SW_Pitch_End
48CE B8E3          M         btfsc   reg, bit, reg_a
48D0 D017          M         bra     label
               00831 
48D2 0E07      00832         movlw   TIA_Vx_TARGET_FRQ_L
48D4 CFE3 F003 00833         movff   PLUSW1, MIOS_PARAMETER1
48D8 0E08      00834         movlw   TIA_Vx_TARGET_FRQ_H
48DA CFE3 F004 00835         movff   PLUSW1, MIOS_PARAMETER2    
               00836 
48DE 0E09      00837         movlw   TIA_Vx_FRQ_L
48E0 C003 FFE3 00838         movff   MIOS_PARAMETER1, PLUSW1
48E4 0E0A      00839         movlw   TIA_Vx_FRQ_H
48E6 C004 FFE3 00840         movff   MIOS_PARAMETER2, PLUSW1     
               00841 
48EA EE21 F002 00842     lfsr        FSR2, TIA_AUDF0
48EE B10E      00843     btfsc   TIA_SW_VOICE, 0
48F0 EE21 F003 00844     lfsr        FSR2, TIA_AUDF1
               00845 
48F4 1C04      00846     comf    MIOS_PARAMETER2, W
48F6 30E8      00847     rrf     WREG, W
48F8 30E8      00848     rrf     WREG, W
48FA 30E8      00849     rrf     WREG, W
48FC 0B1F      00850     andlw   0x1f
48FE 6EDF      00851     movwf   INDF2    
               00852 
4900 00853 TIA_SW_Pitch_End
4900 0012      00854         return
               00855 
               00856 
               00857 ;; --------------------------------------------------------------------------
               00858 ;; This function handles the Portamento
               00859 ;; --------------------------------------------------------------------------
4902 00860 TIA_SW_Porta
4902 0E03      00861         movlw   TIA_Vx_STAT
               00862         BRA_IFCLR PLUSW1, Vx_STAT_PORTA_ENABLE, ACCESS, TIA_SW_Porta_End
4904 A8E3          M         btfss   reg, bit, reg_a
4906 D0A0          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 130


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00863 
4908 EE21 F002 00864     lfsr        FSR2, TIA_AUDF0
490C B10E      00865     btfsc   TIA_SW_VOICE, 0
490E EE21 F003 00866     lfsr        FSR2, TIA_AUDF1
               00867 
               00868         ;; branch depending on portamento option
4912 0E04      00869         movlw   TIA_Vx_MODE
               00870         BRA_IFCLR PLUSW1, Vx_MODE_PORTA_CONST, ACCESS, TIA_SW_Porta_NORM
4914 A2E3          M         btfss   reg, bit, reg_a
4916 D04C          M         bra     label
               00871         ;; ------------------------------------------------------------------
               00872         ;; "constant" portamento mode (constant glide time)
4918 00873 TIA_SW_Porta_CONST
               00874     
               00875         ;; counter -> MUL_A_[LH]
4918 0E1A      00876         movlw   TIA_Vx_PORTA_CTR_L
491A CFE3 F1F8 00877         movff   PLUSW1, MUL_A_L
491E 0E1B      00878         movlw   TIA_Vx_PORTA_CTR_H
4920 CFE3 F1F9 00879         movff   PLUSW1, MUL_A_H
               00880         ;; Add delay to portamento counter -> MUL_A_[LH]
               00881         ;; get portamento delay from envelope table 
4924 0E0E      00882         movlw   TIA_Vx_PORTA_RATE
4926 50E3      00883         movf    PLUSW1, W
4928 ECA3 F030 00884         call    TIA_ENV_TABLE_Get
               00885     ;; add result to counter
492C 90D8      00886     clrc
492E 5003      00887     movf    MIOS_PARAMETER1, W
4930 27F8      00888         addwf   MUL_A_L, F
4932 5004      00889     movf    MIOS_PARAMETER2, W
4934 23F9      00890         addwfc  MUL_A_H, F
4936 E23B      00891     bc     TIA_SW_Porta_CONST_Cont_Reached
               00892     
4938 0E1A      00893         movlw   TIA_Vx_PORTA_CTR_L
493A C1F8 FFE3 00894         movff   MUL_A_L, PLUSW1
493E 0E1B      00895         movlw   TIA_Vx_PORTA_CTR_H
4940 C1F9 FFE3 00896         movff   MUL_A_H, PLUSW1   
               00897  
               00898         ;; target frequency -> MIOS_PARAMETER[12]
4944 0E07      00899     movlw       TIA_Vx_TARGET_FRQ_L
4946 CFE3 F003 00900     movff       PLUSW1, MIOS_PARAMETER1
494A 0E08      00901         movlw   TIA_Vx_TARGET_FRQ_H
494C CFE3 F004 00902         movff   PLUSW1, MIOS_PARAMETER2
               00903 
               00904         ;; get difference between target and previous frequency -> IRQ_TMP[12]
4950 0E1C      00905         movlw   TIA_Vx_PORTA_FRQ_L
4952 50E3      00906         movf    PLUSW1, W
4954 5C03      00907         subwf   MIOS_PARAMETER1, W
4956 6E0B      00908         movwf   IRQ_TMP1
4958 0E1D      00909         movlw   TIA_Vx_PORTA_FRQ_H
495A 50E3      00910         movf    PLUSW1, W
495C 5804      00911         subwfb  MIOS_PARAMETER2, W
495E 6E0C      00912         movwf   IRQ_TMP2
               00913         ;; convert IRQ_TMP[12] to absolute value
4960 900D      00914     bcf IRQ_TMP3, 0
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 131


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4962 A0D8      00915     btfss   STATUS, C
4964 800D      00916     bsf IRQ_TMP3, 0
4966 A0D8      00917     btfss   STATUS, C
4968 1E0B      00918     comf    IRQ_TMP1, F
496A A0D8      00919     btfss   STATUS, C
496C 1E0C      00920     comf    IRQ_TMP2, F
               00921         ;; result in IRQ_TMP[12], sign in IRQ_TMP3[0]
               00922 
               00923         ;; increment four to ensure that target will be reached
496E 0E01      00924     movlw       1
4970 260B      00925         addwf   IRQ_TMP1, F
4972 0E00      00926         movlw   0
4974 220C      00927         addwfc  IRQ_TMP2, F
4976 C00B F1FA 00928         movff   IRQ_TMP1, MUL_B_L
497A C00C F1FB 00929         movff   IRQ_TMP2, MUL_B_H
               00930 
               00931         ;; calc MUL_A_[LH] * MUL_B_[LH]
497E ECDE F019 00932         call    MATH_MUL16_16
               00933         ;; result in MUL_R_2 (low-byte) and MUL_R_3 (high-byte)
               00934     
               00935         ;; branch depending on direction
               00936         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Porta_CONST_Down
4982 B00D          M         btfsc   reg, bit, reg_a
4984 D009          M         bra     label
4986 00937 TIA_SW_Porta_CONST_Up   
               00938         ;; add scaled value to starting frequency
4986 0E1C      00939         movlw   TIA_Vx_PORTA_FRQ_L
4988 50E3      00940         movf    PLUSW1, W
498A 25FE      00941         addwf   MUL_R_2, W, BANKED
498C 6E0B      00942         movwf   IRQ_TMP1
               00943 
498E 0E1D      00944         movlw   TIA_Vx_PORTA_FRQ_H
4990 50E3      00945         movf    PLUSW1, W
4992 21FF      00946         addwfc  MUL_R_3, W, BANKED
4994 6E0C      00947         movwf   IRQ_TMP2
               00948 
               00949         ;; continue at normal portamento routine
               00950         rgoto   TIA_SW_Porta_CONST_Up_Cont
4996 D033          M         bra     label
               00951     
4998 00952 TIA_SW_Porta_CONST_Down
               00953         ;; subtract scaled value from starting frequency
4998 0E1C      00954         movlw   TIA_Vx_PORTA_FRQ_L
499A CFE3 F00B 00955         movff   PLUSW1, IRQ_TMP1
499E 0E1D      00956         movlw   TIA_Vx_PORTA_FRQ_H
49A0 CFE3 F00C 00957         movff   PLUSW1, IRQ_TMP2
               00958 
49A4 51FE      00959         movf    MUL_R_2, W, BANKED
49A6 5E0B      00960         subwf   IRQ_TMP1, F
49A8 51FF      00961         movf    MUL_R_3, W, BANKED
49AA 5A0C      00962         subwfb  IRQ_TMP2, F
               00963 
               00964         ;; continue at normal portamento routine
               00965         rgoto   TIA_SW_Porta_CONST_Down_Cont
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 132


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
49AC D033          M         bra     label
               00966 
49AE 00967 TIA_SW_Porta_CONST_Cont_Reached
49AE D038      00968     bra     TIA_SW_Porta_Cont_Reached
               00969 
               00970         ;; ------------------------------------------------------------------
               00971         ;; "normal" portamento mode (non-constant glide time)
49B0 00972 TIA_SW_Porta_NORM
               00973     ;; multiply rate with current frequency
               00974         ;; get portamento multiplier from envelope table -> MUL_A
49B0 0E0E      00975         movlw   TIA_Vx_PORTA_RATE
49B2 50E3      00976         movf    PLUSW1, W
49B4 ECA3 F030 00977         call    TIA_ENV_TABLE_Get
49B8 C003 F1F8 00978         movff   MIOS_PARAMETER1, MUL_A_L
49BC C004 F1F9 00979         movff   MIOS_PARAMETER2, MUL_A_H
               00980 
               00981         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               00982 
               00983         ;; get current frequency -> MUL_B
               00984     
49C0 0E09      00985         movlw   TIA_Vx_FRQ_L
49C2 CFE3 F1FA 00986         movff   PLUSW1, MUL_B_L
49C6 CFE3 F00B 00987     movff       PLUSW1, IRQ_TMP1
49CA 0E0A      00988         movlw   TIA_Vx_FRQ_H
49CC CFE3 F1FB 00989         movff   PLUSW1, MUL_B_H
49D0 CFE3 F00C 00990     movff       PLUSW1, IRQ_TMP2
               00991     
49D4 ECDE F019 00992         call    MATH_MUL16_16
               00993         ;; result in MUL_R_2 (low-byte) and MUL_R_3 (high-byte)
               00994         ;; ensure that result is != 0
49D8 51FE      00995         movf    MUL_R_2, W, BANKED
49DA 11FF      00996         iorwf   MUL_R_3, W, BANKED
49DC B4D8      00997         skpnz
49DE 2BFE      00998         incf    MUL_R_2, F, BANKED
               00999 
               01000         ;; TIA_Vx_FRQ += result (depending on Portamento Direction)
               01001         ;movff  MUL_R_2, IRQ_TMP1
               01002 
               01003         ;; store target frequency in MIOS_PARAMETER[12]
49E0 0E07      01004         movlw   TIA_Vx_TARGET_FRQ_L
49E2 CFE3 F003 01005         movff   PLUSW1, MIOS_PARAMETER1
49E6 0E08      01006         movlw   TIA_Vx_TARGET_FRQ_H
49E8 CFE3 F004 01007         movff   PLUSW1, MIOS_PARAMETER2
               01008 
               01009         ;; branch depending on portamento direction
               01010         ;; check if value > current value
49EC 5003      01011         movf    MIOS_PARAMETER1, W
49EE 5C0B      01012         subwf   IRQ_TMP1, W
49F0 5004      01013         movf    MIOS_PARAMETER2, W
49F2 580C      01014         subwfb  IRQ_TMP2, W
49F4 E20B      01015     bc TIA_SW_Porta_Down
               01016    
49F6 01017 TIA_SW_Porta_Up ;; decrement FRQ
49F6 51FE      01018         movf    MUL_R_2, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 133


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
49F8 260B      01019         addwf   IRQ_TMP1, F
49FA 51FF      01020         movf    MUL_R_3, W, BANKED
49FC 220C      01021         addwfc  IRQ_TMP2, F
               01022 
49FE 01023 TIA_SW_Porta_CONST_Up_Cont      ; re-used by ENV2 option
               01024         ;; check if value > MAX_VALUE
49FE 90D8      01025     clrc
4A00 500B      01026         movf    IRQ_TMP1, W
4A02 5C03      01027         subwf   MIOS_PARAMETER1, W
4A04 500C      01028         movf    IRQ_TMP2, W
4A06 5804      01029         subwfb  MIOS_PARAMETER2, W
4A08 E213      01030         bc      TIA_SW_Porta_Cont               ; branch to end if MAX_VALUE not reached
               01031         rgoto   TIA_SW_Porta_Cont_Reached               ; else copy MAX_VALUE into value and finish portamento
4A0A D00A          M         bra     label
               01032 
4A0C 01033 TIA_SW_Porta_Down  ;; increment FRQ
4A0C 51FE      01034         movf    MUL_R_2, W
4A0E 5E0B      01035         subwf   IRQ_TMP1, F
4A10 51FF      01036         movf    MUL_R_3, W, BANKED
4A12 5A0C      01037         subwfb  IRQ_TMP2, F
               01038 
4A14 01039 TIA_SW_Porta_CONST_Down_Cont    ; re-used by ENV2 option
               01040         ;; check if value < MIN_VALUE
4A14 90D8      01041     clrc
4A16 5003      01042         movf    MIOS_PARAMETER1, W
4A18 5C0B      01043         subwf   IRQ_TMP1, W
4A1A 5004      01044         movf    MIOS_PARAMETER2, W
4A1C 580C      01045         subwfb  IRQ_TMP2, W
4A1E E208      01046         bc      TIA_SW_Porta_Cont               ; branch to end if MIN_VALUE not reached
               01047         ; else copy MIN_VALUE into value and finish portamento
               01048         ;rgoto  TIA_SW_Porta_Cont_Reached               ; else copy MAX_VALUE into value and finish portamento
               01049         
4A20 01050 TIA_SW_Porta_Cont_Reached
4A20 0E07      01051         movlw   TIA_Vx_TARGET_FRQ_L
4A22 CFE3 F00B 01052         movff   PLUSW1, IRQ_TMP1
               01053     
4A26 0E08      01054         movlw   TIA_Vx_TARGET_FRQ_H
4A28 CFE3 F00C 01055         movff   PLUSW1, IRQ_TMP2
               01056 
4A2C 0E03      01057         movlw   TIA_Vx_STAT
4A2E 98E3      01058         bcf     PLUSW1, Vx_STAT_PORTA_ENABLE
               01059     
4A30 01060 TIA_SW_Porta_Cont
               01061 
               01062 
               01063     
               01064     ;; Copy Freq
4A30 0E09      01065         movlw   TIA_Vx_FRQ_L
4A32 C00B FFE3 01066     movff       IRQ_TMP1, PLUSW1
4A36 0E0A      01067         movlw   TIA_Vx_FRQ_H
4A38 C00C FFE3 01068     movff       IRQ_TMP2, PLUSW1
               01069 
4A3C 1C0C      01070     comf    IRQ_TMP2, W
4A3E 30E8      01071     rrf     WREG, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 134


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4A40 30E8      01072     rrf     WREG, W
4A42 30E8      01073     rrf     WREG, W
4A44 0B1F      01074     andlw   0x1f
4A46 6EDF      01075     movwf   INDF2  
               01076         
4A48 01077 TIA_SW_Porta_End    
4A48 0012      01078         return
               01079 
               01080 ;; --------------------------------------------------------------------------
               01081 ;; Help Function used from tia_midi.inc and tia_ccin.inc to reset ENV2
               01082 ;; --------------------------------------------------------------------------
4A4A 01083 TIA_SW_Hlp_PortaCTR_Reset
4A4A C000 F001 01084         movff   FSR0, FSR1
               01085 
4A4E 0E1A      01086     movlw   TIA_Vx_PORTA_CTR_L 
4A50 6AE3      01087         clrf    PLUSW1, ACCESS
4A52 0E1B      01088     movlw   TIA_Vx_PORTA_CTR_H 
4A54 6AE3      01089         clrf    PLUSW1, ACCESS
               01090 
4A56 0012      01091         return
               01092 
               01093 ;; --------------------------------------------------------------------------
               01094 ;; This function handles the amplitude
               01095 ;; --------------------------------------------------------------------------
4A58 01096 TIA_SW_Amp
               01097     ;; TIA_AUDCx
4A58 EE21 F000 01098     lfsr        FSR2, TIA_BASE
4A5C 0E04      01099     movlw   0x04
4A5E 250E      01100     addwf   TIA_SW_VOICE, W
4A60 6ED9      01101     movwf   FSR2L
               01102     
               01103 
4A62 01104 TIA_SW_Amp_MasterVol    
               01105     ;; Vx volume * Master Volume
4A62 0E0F      01106     movlw       TIA_Vx_VOLUME
4A64 50E3      01107         movf    PLUSW1, W
4A66 6E0B      01108     movwf   IRQ_TMP1
4A68 510B      01109     movf    TIA_MASTER_VOL, W
4A6A 0F01      01110         addlw   1
4A6C 020B      01111     mulwf   IRQ_TMP1
4A6E 36F3      01112     rlf     PRODL, F
4A70 34F4      01113     rlf     PRODH, W
4A72 6E03      01114     movwf   MIOS_PARAMETER1
4A74 B4D8      01115     skpnz
               01116     rgoto   TIA_SW_Amp_Gate
4A76 D090          M         bra     label
               01117 
               01118 #if 0
               01119     movlw       TIA_Vx_MODE
               01120     BRA_IFCLR PLUSW1, Vx_MODE_ENV2AMP_ON, ACCESS, TIA_SW_Amp_Mods
               01121 
               01122     ;; store dedicated enveloppe value in MUL_A_[LH],sign in MIOS_PARAMETER3
               01123     movlw   0x40
               01124     btfsc   TIA_SW_VOICE, 0
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 135


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01125     movlw   0x80
               01126         call    TIA_SW_Hlp_GetMOD
               01127         ;; result in IRQ_TMP[123]
               01128     movff   IRQ_TMP3, MIOS_PARAMETER3
               01129     movf    IRQ_TMP2, W
               01130     andlw   0x7f
               01131     movwf   MUL_A_H
               01132     movf    IRQ_TMP1, W
               01133     movwf   MUL_A_L
               01134 
               01135         ;; modulate amplitude
               01136         ;; assigned LFOs and ENVs in WREG   
               01137         movlw   TIA_Vx_PITCH_MOD
               01138         movf    PLUSW1, W
               01139     andlw   0x3f
               01140         call    TIA_SW_Hlp_GetMOD
               01141         ;; result in IRQ_TMP[123]
               01142    
               01143 TIA_SW_Amp_Mods_Env_AxB
               01144     ;; Modulation mode
               01145     movlw   TIA_Vx_ENV_OPTION
               01146     movf    PLUSW1, W
               01147     andlw   0x03
               01148     incf    WREG, W
               01149     BRA_IFCLR WREG, ENVAUDx_MODTYP_AxB, ACCESS, TIA_SW_Amp_Mods_Env_AB  
               01150     BRA_IFSET WREG, ENVAUDx_MODTYP_AB, ACCESS,TIA_SW_Amp_Mods_Env_AxB_NotDoubled
               01151     ;; Double the Dedicated ENVAUDx for AxB only Mode
               01152     rlf     MUL_A_L, F
               01153     rlf     MUL_A_H, F    
               01154 TIA_SW_Amp_Mods_Env_AxB_NotDoubled
               01155     movf    IRQ_TMP2, W
               01156     movwf   MUL_B_H
               01157     movf    IRQ_TMP1, W
               01158     movwf   MUL_B_L
               01159     ;; multiplication
               01160         call    MATH_MUL16_16
               01161         movf    MUL_R_2, W, BANKED
               01162     movwf   IRQ_TMP1   
               01163     movf        MUL_R_3, W, BANKED
               01164     movwf   IRQ_TMP2
               01165     ;; process sign
               01166     movf    MIOS_PARAMETER3, W
               01167     xorwf   IRQ_TMP3, F
               01168 
               01169 TIA_SW_Amp_Mods_Env_AB
               01170     ;; Modulation mode
               01171     movlw   TIA_Vx_ENV_OPTION
               01172     movf    PLUSW1, W
               01173     btfsc   TIA_SW_VOICE, 0
               01174     swapf   WREG, W
               01175     andlw   0x03
               01176     incf    WREG, W
               01177     BRA_IFCLR WREG, ENVAUDx_MODTYP_AB, ACCESS,TIA_SW_Amp_Mods_Cont
               01178     movf    MIOS_PARAMETER3, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 136


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01179         bz      TIA_SW_Amp_Mods_Env_AB_Pos
               01180 TIA_SW_Amp_Mods_Env_AB_Neg
               01181     comf    MUL_A_L, F
               01182     comf    MUL_A_H, F
               01183     movf    IRQ_TMP3, W
               01184         bz      TIA_SW_Amp_Mods_Env_AB_Pos
               01185         movf    IRQ_TMP1, W
               01186         subwf   MUL_A_L, W
               01187     movwf   IRQ_TMP1
               01188         movf    IRQ_TMP2, W
               01189         subwfb  MUL_A_H, W
               01190     movwf   IRQ_TMP2
               01191     clrf    IRQ_TMP3
               01192     bc      TIA_SW_Amp_Mods_Cont
               01193     clrf    IRQ_TMP1
               01194     clrf    IRQ_TMP2
               01195     rgoto   TIA_SW_Amp_Mods_Cont    
               01196 
               01197 TIA_SW_Amp_Mods_Env_AB_Pos
               01198         movf    MUL_A_L, W
               01199         addwf   IRQ_TMP1, F     
               01200         movf    MUL_A_H, W
               01201         addwfc  IRQ_TMP2, F     
               01202 TIA_SW_Amp_Mods_Env_AB_Set
               01203         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
               01204         bnc     TIA_SW_Amp_Mods_Cont
               01205         setf    IRQ_TMP1        
               01206         setf    IRQ_TMP2        
               01207     rgoto   TIA_SW_Amp_Mods_Cont
               01208 
               01209 TIA_SW_Amp_Mods
               01210         ;; modulate pitch
               01211         ;; assigned LFOs and ENVs in WREG
               01212         movlw   TIA_Vx_PITCH_MOD
               01213         movf    PLUSW1, W
               01214     andlw   0x3f
               01215     bz      TIA_SW_Amp_CopyFrq
               01216         call    TIA_SW_Hlp_GetMOD
               01217         ;; unsigned result in IRQ_TMP[12]
               01218         ;; sign in IRQ_TMP3[0]    
               01219 
               01220 TIA_SW_Amp_Mods_Cont 
               01221         ;; skip tuning if IRQ_TMP[12] == zero
               01222         movf    IRQ_TMP1, W
               01223         iorwf   IRQ_TMP2, W
               01224         bz      TIA_SW_Amp_Mods_End
               01225     
               01226                                      
               01227 #else
               01228 
4A78 01229 TIA_SW_Amp_Mods
4A78 0E04      01230     movlw       TIA_Vx_MODE
               01231     BRA_IFCLR PLUSW1, Vx_MODE_ENV2AMP_ON, ACCESS, TIA_SW_Amp_Mods_Cont
4A7A A8E3          M         btfss   reg, bit, reg_a
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 137


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4A7C D03D          M         bra     label
               01232     
               01233     ;; Modulation type in MIOS_PARAMETER3
4A7E 0E2A      01234     movlw   TIA_Vx_ENV_OPTION
4A80 50E3      01235     movf    PLUSW1, W
4A82 0B03      01236     andlw   0x03
4A84 6E05      01237     movwf   MIOS_PARAMETER3
4A86 2A05      01238     incf    MIOS_PARAMETER3, F
               01239 
               01240     ;; prepare enveloppe value in MIOS_PARAMETER2
               01241     ;; env2amp in WREG
4A88 0E40      01242     movlw   0x40
4A8A B10E      01243     btfsc   TIA_SW_VOICE, 0
4A8C 0E80      01244     movlw   0x80
4A8E ECB8 F026 01245         call    TIA_SW_Hlp_GetMOD
               01246         ;; result in IRQ_TMP[123]
4A92 500C      01247     movf    IRQ_TMP2, W
4A94 B00D      01248     btfsc   IRQ_TMP3, 0
4A96 1C0C      01249     comf    IRQ_TMP2, W
4A98 0B7F      01250     andlw   0x7f
4A9A 6E04      01251     movwf   MIOS_PARAMETER2
               01252 
               01253         ;; modulate amplitude
               01254         ;; assigned LFOs and ENVs in WREG
4A9C 0E17      01255         movlw   TIA_Vx_AMP_MOD
4A9E 50E3      01256         movf    PLUSW1, W
4AA0 0B3F      01257     andlw   0x3f
4AA2 ECB8 F026 01258         call    TIA_SW_Hlp_GetMOD
               01259         ;; result in IRQ_TMP[123]
               01260     
               01261 
4AA6 01262 TIA_SW_Amp_Mods_Env_AxB
               01263     BRA_IFCLR MIOS_PARAMETER3, ENVAUDx_MODTYP_AxB, ACCESS, TIA_SW_Amp_Mods_Env_AB
4AA6 A205          M         btfss   reg, bit, reg_a
4AA8 D017          M         bra     label
               01264     BRA_IFSET MIOS_PARAMETER3, ENVAUDx_MODTYP_AB, ACCESS, TIA_SW_Amp_Mods_Env_AB_AxB
4AAA B005          M         btfsc   reg, bit, reg_a
4AAC D010          M         bra     label
4AAE 3604      01265     rlcf   MIOS_PARAMETER2, F
4AB0 0E3F      01266     movlw   0x3f
4AB2 6EF4      01267         movwf   PRODH
4AB4 6AF3      01268         clrf    PRODL
4AB6 EC32 F027 01269         call    TIA_SW_Hlp_AddOffset16
               01270     ;; result in IRQ_TMP[12]
4ABA 500C      01271     movf    IRQ_TMP2, W
4ABC BE0C      01272     btfsc   IRQ_TMP2, 7
4ABE 0E7F      01273     movlw   0x7f
               01274     
4AC0 0204      01275     mulwf   MIOS_PARAMETER2
4AC2 36F3      01276     rlf     PRODL, F
4AC4 34F4      01277     rlf     PRODH, W
4AC6 BEE8      01278     btfsc   WREG, 7
4AC8 0E7F      01279     movlw   0x7f
4ACA 6E04      01280     movwf   MIOS_PARAMETER2    
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 138


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01281     rgoto   TIA_SW_Amp_Mods_Env_Cont
4ACC D00C          M         bra     label
               01282     
4ACE 01283 TIA_SW_Amp_Mods_Env_AB_AxB    
4ACE 500C      01284     movf    IRQ_TMP2, W
4AD0 0204      01285     mulwf   MIOS_PARAMETER2
4AD2 50F4      01286     movf    PRODH, W
4AD4 6E0C      01287     movwf   IRQ_TMP2
4AD6 6A0B      01288     clrf    IRQ_TMP1
               01289 
4AD8 01290 TIA_SW_Amp_Mods_Env_AB
4AD8 3004      01291     rrf     MIOS_PARAMETER2, W 
4ADA EC2E F027 01292         call    TIA_SW_Hlp_AddOffset
               01293         ;; result in IRQ_TMP[12]  
4ADE 500C      01294     movf    IRQ_TMP2, W
4AE0 BE0C      01295     btfsc   IRQ_TMP2, 7
4AE2 0E7F      01296     movlw   0x7f
4AE4 6E04      01297     movwf   MIOS_PARAMETER2
               01298     
4AE6 01299 TIA_SW_Amp_Mods_Env_Cont
4AE6 5003      01300     movf        MIOS_PARAMETER1, W
4AE8 04E8      01301     decf    WREG, W
4AEA 0204      01302     mulwf   MIOS_PARAMETER2
4AEC 36F3      01303     rlf     PRODL, F
4AEE 34F4      01304     rlf     PRODH, W
4AF0 BEE8      01305     btfsc   WREG, 7
4AF2 0E7F      01306     movlw   0x7f
4AF4 6E03      01307     movwf   MIOS_PARAMETER1
               01308     rgoto   TIA_SW_Amp_Mods_End
4AF6 D00E          M         bra     label
               01309     
4AF8 01310 TIA_SW_Amp_Mods_Cont
               01311         ;; modulate amplitude
               01312         ;; assigned LFOs and ENVs in WREG
4AF8 0E17      01313         movlw   TIA_Vx_AMP_MOD
4AFA 50E3      01314         movf    PLUSW1, W
4AFC 0B3F      01315     andlw   0x3f
4AFE E00A      01316     bz      TIA_SW_Amp_Mods_End
4B00 ECB8 F026 01317         call    TIA_SW_Hlp_GetMOD
               01318         ;; result in IRQ_TMP[123]
4B04 B00D      01319     btfsc   IRQ_TMP3, 0
4B06 6A03      01320     clrf    MIOS_PARAMETER1
4B08 5003      01321     movf    MIOS_PARAMETER1, W
4B0A 020C      01322     mulwf   IRQ_TMP2
4B0C 44F4      01323     rlncf   PRODH, W
4B0E BEE8      01324     btfsc   WREG, 7
4B10 0E7F      01325     movlw   0x7f
4B12 6E03      01326     movwf   MIOS_PARAMETER1
               01327 #endif
4B14 01328 TIA_SW_Amp_Mods_End
               01329 
4B14 0E03      01330     movlw       TIA_Vx_STAT
               01331         BRA_IFSET PLUSW1, Vx_STAT_ENV_ACTIVE, ACCESS, TIA_SW_Amp_Vel   
4B16 BCE3          M         btfsc   reg, bit, reg_a
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 139


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4B18 D002          M         bra     label
               01332         BRA_IFCLR PLUSW1, Vx_STAT_GATE_NOTE_ON, ACCESS, TIA_SW_Amp_Vel_End
4B1A AAE3          M         btfss   reg, bit, reg_a
4B1C D03D          M         bra     label
4B1E 01333 TIA_SW_Amp_Vel    
4B1E 0E04      01334     movlw       TIA_Vx_MODE
               01335     BRA_IFCLR PLUSW1, Vx_MODE_VEL2AMP_ON, ACCESS, TIA_SW_Amp_Vel_End
4B20 A6E3          M         btfss   reg, bit, reg_a
4B22 D03A          M         bra     label
               01336     ;; Velocity calc
4B24 0E29      01337     movlw   TIA_Vx_DEPTH_VELOCITY
4B26 50E3      01338     movf        PLUSW1, W
4B28 6E0C      01339     movwf   IRQ_TMP2
4B2A 0A40      01340     xorlw   0x40
4B2C E035      01341     bz      TIA_SW_Amp_Vel_End
               01342     
4B2E 6A0D      01343     clrf    IRQ_TMP3
4B30 0E29      01344     movlw   TIA_Vx_DEPTH_VELOCITY
4B32 ACE3      01345         btfss   PLUSW1, 6, ACCESS
4B34 800D      01346     bsf     IRQ_TMP3, 0
               01347     
4B36 500C      01348     movf    IRQ_TMP2, W
4B38 0B3F      01349         andlw   0x3f
               01350         ;; depth * velocity
4B3A 90D8      01351         clrc
4B3C 34E8      01352         rlf     WREG, W
               01353         ;addlw  2
               01354     ;movwf   IRQ_TMP2
               01355        
4B3E B00D      01356     btfsc       IRQ_TMP3, 0, ACCESS
               01357     rgoto   TIA_SW_Amp_Vel_Neg
4B40 D01A          M         bra     label
               01358     
4B42 01359 TIA_SW_Amp_Vel_Pos   
4B42 0F02      01360         addlw   2
4B44 6E0C      01361     movwf   IRQ_TMP2
               01362     
4B46 0E28      01363     movlw       TIA_Vx_LAST_VELOCITY
4B48 50E3      01364         movf    PLUSW1, W
4B4A 020C      01365     mulwf   IRQ_TMP2
4B4C 90D8      01366     clrc
4B4E 36F3      01367     rlf     PRODL, F
4B50 34F4      01368     rlf     PRODH, W
4B52 0F01      01369         addlw   1
4B54 6E0C      01370     movwf   IRQ_TMP2
               01371     
4B56 0E04      01372     movlw       TIA_Vx_MODE
               01373     BRA_IFSET PLUSW1, Vx_MODE_GSA_ACTIVE, ACCESS, TIA_SW_Amp_Vel_Pos_GSA
4B58 B0E3          M         btfsc   reg, bit, reg_a
4B5A D006          M         bra     label
4B5C 5003      01374         movf    MIOS_PARAMETER1, W
4B5E 020C      01375     mulwf   IRQ_TMP2
4B60 36F3      01376     rlf     PRODL, F
4B62 34F4      01377     rlf     PRODH, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 140


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4B64 6E03      01378     movwf   MIOS_PARAMETER1
               01379     rgoto   TIA_SW_Amp_Vel_End
4B66 D018          M         bra     label
4B68 01380 TIA_SW_Amp_Vel_Pos_GSA
4B68 5003      01381         movf    MIOS_PARAMETER1, W
4B6A 087F      01382     sublw   0x7f
4B6C 020C      01383     mulwf   IRQ_TMP2
4B6E 36F3      01384     rlf     PRODL, F
4B70 34F4      01385     rlf     PRODH, W
4B72 2603      01386     addwf   MIOS_PARAMETER1, F
               01387     rgoto   TIA_SW_Amp_Vel_End
4B74 D011          M         bra     label
               01388 
4B76 01389 TIA_SW_Amp_Vel_Neg
4B76 1CE8      01390     comf    WREG, W
4B78 0B7F      01391     andlw   0x7f
4B7A 0F02      01392     addlw       2
4B7C 6E0C      01393     movwf   IRQ_TMP2
               01394     
4B7E 0E28      01395     movlw       TIA_Vx_LAST_VELOCITY
4B80 50E3      01396         movf    PLUSW1, W
4B82 020C      01397     mulwf   IRQ_TMP2
4B84 90D8      01398     clrc
4B86 36F3      01399     rlf     PRODL, F
4B88 34F4      01400     rlf     PRODH, W
4B8A 0F01      01401         addlw   1
4B8C 6E0C      01402     movwf   IRQ_TMP2
               01403 
4B8E 5003      01404         movf    MIOS_PARAMETER1, W
4B90 020C      01405     mulwf   IRQ_TMP2
4B92 36F3      01406     rlf     PRODL, F
4B94 34F4      01407     rlf     PRODH, W
4B96 5E03      01408     subwf   MIOS_PARAMETER1, F
               01409     ;rgoto   TIA_SW_Amp_Vel_End
4B98 01410 TIA_SW_Amp_Vel_End
               01411 
4B98 01412 TIA_SW_Amp_Gate
4B98 0E04      01413     movlw       TIA_Vx_MODE
               01414     BRA_IFCLR PLUSW1, Vx_MODE_ENV2AMP_ON, ACCESS, TIA_SW_Amp_Gate_Act
4B9A A8E3          M         btfss   reg, bit, reg_a
4B9C D003          M         bra     label
4B9E 0E03      01415     movlw       TIA_Vx_STAT
               01416     BRA_IFSET PLUSW1, Vx_STAT_ENV_ACTIVE, ACCESS, TIA_SW_Amp_CopyAmp
4BA0 BCE3          M         btfsc   reg, bit, reg_a
4BA2 D011          M         bra     label
4BA4 01417 TIA_SW_Amp_Gate_Act
4BA4 0E03      01418     movlw       TIA_Vx_STAT
               01419     BRA_IFSET PLUSW1, Vx_STAT_GATE_ACTIVE, ACCESS, TIA_SW_Amp_CopyAmp
4BA6 B6E3          M         btfsc   reg, bit, reg_a
4BA8 D00E          M         bra     label
4BAA 0E0F      01420         movlw   0x0f
4BAC 14DF      01421         andwf   INDF2, W
4BAE E011      01422     bz      TIA_SW_Amp_End
               01423     
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 141


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4BB0 01424 TIA_SW_Amp_Gate_FadeOut
4BB0 6E0C      01425     movwf   IRQ_TMP2
4BB2 0E02      01426     movlw   0x02    ;;TIA_GATE_FADE
4BB4 5A0C      01427     subwfb  IRQ_TMP2, F
4BB6 A0D8      01428     skpc
4BB8 6A0C      01429     clrf    IRQ_TMP2
4BBA 0EF0      01430         movlw   0xf0
4BBC 16DF      01431         andwf   INDF2, F
4BBE 0E0F      01432     movlw       0x0f
4BC0 140C      01433         andwf   IRQ_TMP2, W
4BC2 12DF      01434         iorwf   INDF2, F
               01435     rgoto   TIA_SW_Amp_End
4BC4 D006          M         bra     label
               01436     
4BC6 01437 TIA_SW_Amp_Gate_ClrSkp
               01438 
4BC6 01439 TIA_SW_Amp_CopyAmp
4BC6 90D8      01440     clrc
4BC8 3203      01441         rrf     MIOS_PARAMETER1, F
4BCA 4203      01442     rrncf   MIOS_PARAMETER1, F
4BCC 4003      01443     rrncf   MIOS_PARAMETER1, W
4BCE 0B0F      01444         andlw   0x0f
4BD0 6EDF      01445         movwf   INDF2
4BD2 01446 TIA_SW_Amp_End
               01447 
4BD2 0012      01448     return
               01449 
               01450 
               01451 ;; --------------------------------------------------------------------------
               01452 ;; This function handles the LFOs
               01453 ;; --------------------------------------------------------------------------
4BD4 01454 TIA_SW_LFO
               01455         ;; LFO number in TIA_SW_LFO_NUMBER - calculate base address
               01456         ;lfsr   FSR1, TIA_LFO1_BASE
               01457         ;movf   TIA_SW_LFO_NUMBER, W, BANKED
               01458         ;mullw  TIA_LFOx_RECORD_LEN
               01459         ;movf   PRODL, W
               01460         ;addwf  FSR1L, F
               01461 
               01462         ;; clear result register and skip LFO if not enabled
4BD4 0E00      01463         movlw   TIA_LFOx_MODE
               01464         BRA_IFSET PLUSW1, LFOx_MODE_ENABLE, ACCESS, TIA_SW_LFO_Enabled
4BD6 B0E3          M         btfsc   reg, bit, reg_a
4BD8 D005          M         bra     label
4BDA 01465 TIA_SW_LFO_Disabled
4BDA 0E05      01466         movlw   TIA_LFOx_RVALUE_L
4BDC 6AE3      01467         clrf    PLUSW1
4BDE 0E06      01468         movlw   TIA_LFOx_RVALUE_H
4BE0 6AE3      01469         clrf    PLUSW1
               01470         rgoto   TIA_SW_LFO_End
4BE2 D03D          M         bra     label
4BE4 01471 TIA_SW_LFO_Enabled
               01472         
               01473         ;; increment step counter, store result also in IRQ_TMP1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 142


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4BE4 0E02      01474         movlw   TIA_LFOx_CTR
4BE6 2AE3      01475         incf    PLUSW1, F
4BE8 CFE3 F00B 01476         movff   PLUSW1, IRQ_TMP1
               01477 
               01478         ;; get CTR/ADD entry from LFO table depending on LFO Rate
4BEC 0E01      01479         movlw   TIA_LFOx_RATE
4BEE 50E3      01480         movf    PLUSW1, W
4BF0 EC33 F031 01481         call    TIA_LFO_TABLE_Get
               01482         ;; result: CTR value in WREG and MIOS_PARAMETER1, ADD value in MIOS_PARAMETER2
               01483 
               01484         ;; exit if max step counter value (CTR) not reached
               01485         ;;      movf    MIOS_PARAMETER1, W
4BF4 5C0B      01486         subwf   IRQ_TMP1, W     ; result of LFOx_CTR in IRQ_TMP1
4BF6 E333      01487         bnc     TIA_SW_LFO_End
               01488 
               01489         ;; else clear step counter
4BF8 0E02      01490         movlw   TIA_LFOx_CTR
4BFA 6AE3      01491         clrf    PLUSW1
               01492 
               01493         ;; skip multiply routine if LFO_x_DEPTH is 0x40 (zero depth)
4BFC 0E04      01494         movlw   TIA_LFOx_DEPTH
4BFE 50E3      01495         movf    PLUSW1, W
4C00 0A40      01496         xorlw   0x40
4C02 E105      01497         bnz     TIA_SW_LFO_DepthOk
4C04 01498 TIA_SW_LFO_Depth40
               01499         ;; clear 16bit result value registers and exit
4C04 0E05      01500         movlw   TIA_LFOx_RVALUE_L
4C06 6AE3      01501         clrf    PLUSW1
4C08 0E06      01502         movlw   TIA_LFOx_RVALUE_H
4C0A 6AE3      01503         clrf    PLUSW1
               01504         rgoto   TIA_SW_LFO_End
4C0C D028          M         bra     label
4C0E 01505 TIA_SW_LFO_DepthOk
               01506 
               01507         ;; add or subtract ADD value to linear LFO value
4C0E 0E03      01508         movlw   TIA_LFOx_VALUE
4C10 CFE3 F00D 01509         movff   PLUSW1, IRQ_TMP3
               01510 
4C14 0E00      01511         movlw   TIA_LFOx_MODE
               01512         BRA_IFSET PLUSW1, LFOx_MODE_DECINC, ACCESS, TIA_SW_LFO_Dec
4C16 BEE3          M         btfsc   reg, bit, reg_a
4C18 D008          M         bra     label
4C1A 01513 TIA_SW_LFO_Inc
4C1A 5004      01514         movf    MIOS_PARAMETER2, W              ; get ADD value
4C1C 260D      01515         addwf   IRQ_TMP3, F                     ; add to linear LFO value
4C1E E30D      01516         bnc     TIA_SW_LFO_Cont                 ; skip next if max value (0xff) not reached
4C20 1C0D      01517         comf    IRQ_TMP3, W                     ; subtract the missing ticks
4C22 260D      01518         addwf   IRQ_TMP3, F
4C24 0E00      01519         movlw   TIA_LFOx_MODE
4C26 8EE3      01520         bsf     PLUSW1, LFOx_MODE_DECINC                ; switch to decrement
               01521         rgoto   TIA_SW_LFO_Cont
4C28 D008          M         bra     label
               01522 
4C2A 01523 TIA_SW_LFO_Dec
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 143


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4C2A 5004      01524         movf    MIOS_PARAMETER2, W              ; get ADD value
4C2C 5E0D      01525         subwf   IRQ_TMP3, F                     ; decrement from linear LFO value
4C2E E205      01526         bc      TIA_SW_LFO_Cont                 ; skip next if min value (0x00) not reached
4C30 1C0D      01527         comf    IRQ_TMP3, W                     ; add the missing ticks
4C32 0F01      01528         addlw   1
4C34 260D      01529         addwf   IRQ_TMP3, F
4C36 0E00      01530         movlw   TIA_LFOx_MODE
4C38 9EE3      01531         bcf     PLUSW1, LFOx_MODE_DECINC                ; switch to increment
4C3A 01532 TIA_SW_LFO_Cont
               01533 
               01534         ;; write back IRQ_TMP3 -> TIA_LFOx_VALUE
4C3A 0E03      01535         movlw   TIA_LFOx_VALUE
4C3C C00D FFE3 01536         movff   IRQ_TMP3, PLUSW1
               01537 
               01538         ;; convert linear LFO value to waveform by using the TIA_SW_LFO_Hlp_Waveform function
               01539         ;; LFO mode in IRQ_TMP1
4C40 0E00      01540         movlw   TIA_LFOx_MODE
4C42 CFE3 F00B 01541         movff   PLUSW1, IRQ_TMP1
               01542         ;; LFO depth in IRQ_TMP2
4C46 0E04      01543         movlw   TIA_LFOx_DEPTH
4C48 CFE3 F00C 01544         movff   PLUSW1, IRQ_TMP2
               01545         ;; linear LFO value in WREG
4C4C 500D      01546         movf    IRQ_TMP3, W
               01547         ;; process waveform
               01548     
4C4E EC58 F027 01549         call    TIA_SW_LFO_Hlp_Waveform
               01550     
               01551         ;; store 16bit result in RVALUE registers
4C52 0E05      01552         movlw   TIA_LFOx_RVALUE_L
4C54 CFF3 FFE3 01553         movff   PRODL, PLUSW1
4C58 0E06      01554         movlw   TIA_LFOx_RVALUE_H
4C5A CFF4 FFE3 01555         movff   PRODH, PLUSW1
4C5E 01556 TIA_SW_LFO_End
4C5E 0012      01557         return
               01558 
               01559 
               01560 ;; --------------------------------------------------------------------------
               01561 ;; This function handles the ENVs
               01562 ;; expects TIA_ENVx_CURVES bitfield (lower or upper nibble) in WREG
               01563 ;; 
               01564 ;; TIA_ENVx_CURVES.7 and TIA_ENVx_CURVES.3 contain the ACCENT flag which
               01565 ;; is used in TB303 mode (copied to IRQ_TMP4.3
               01566 ;; --------------------------------------------------------------------------
4C60 01567 TIA_SW_ENV
4C60 0B07      01568         andlw   0x07
4C62 6E0E      01569         movwf   IRQ_TMP4
               01570     
4C64 510F      01571     movf    TIA_SW_ENV_NUMBER, W, BANKED
4C66 0BFE      01572     andlw   0xfe
4C68 E108      01573     bnz  TIA_SW_ENV_VxStatSkp
               01574 
               01575         ;; Vx dedicated Env clear/set Active
4C6A 0E03      01576     movlw   TIA_Vx_STAT
4C6C 9CDB      01577     bcf     PLUSW2, Vx_STAT_ENV_ACTIVE
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 144


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4C6E 0E00      01578         movlw   TIA_ENVx_MODE
4C70 50E3      01579     movf    PLUSW1, W
4C72 0B1F      01580     andlw   0x1f
4C74 E002      01581     bz  TIA_SW_ENV_VxStatSkp
4C76 0E03      01582     movlw   TIA_Vx_STAT
4C78 8CDB      01583     bsf     PLUSW2, Vx_STAT_ENV_ACTIVE    
4C7A 01584 TIA_SW_ENV_VxStatSkp
               01585 
               01586         ;; prepare call of TIA_SW_ENV_GetBendedValue
4C7A 0E07      01587         movlw   TIA_ENVx_CURVE
4C7C CFE3 F00C 01588         movff   PLUSW1, IRQ_TMP2
4C80 0E02      01589         movlw   TIA_ENVx_CTR_H
4C82 CFE3 F00B 01590         movff   PLUSW1, IRQ_TMP1
               01591 
               01592         ;; branch depending on ENV state
4C86 0E00      01593         movlw   TIA_ENVx_MODE
               01594         BRA_IFSET PLUSW1, ENVx_MODE_RELEASE, ACCESS, TIA_SW_ENV_Release
4C88 B6E3          M         btfsc   reg, bit, reg_a
4C8A D03E          M         bra     label
               01595         BRA_IFCLR PLUSW1, ENVx_MODE_ATTACK, ACCESS, TIA_SW_ENV_Calc
4C8C A0E3          M         btfss   reg, bit, reg_a
4C8E D054          M         bra     label
               01596         BRA_IFSET PLUSW1, ENVx_MODE_SUSTAIN, ACCESS, TIA_SW_ENV_Sustain
4C90 B4E3          M         btfsc   reg, bit, reg_a
4C92 D032          M         bra     label
               01597         BRA_IFSET PLUSW1, ENVx_MODE_DECAY, ACCESS, TIA_SW_ENV_Decay
4C94 B2E3          M         btfsc   reg, bit, reg_a
4C96 D013          M         bra     label
               01598 
4C98 01599 TIA_SW_ENV_Attack
               01600         ;; get attack rate depending on curve setting
4C98 0E03      01601         movlw   TIA_ENVx_ATTACK
4C9A CFE3 F00D 01602         movff   PLUSW1, IRQ_TMP3
4C9E 500E      01603         movf    IRQ_TMP4, W
4CA0 0B01      01604         andlw   0x01
4CA2 EC27 F028 01605         call    TIA_SW_ENV_GetBendedValue
               01606         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01607 
               01608         ;; add to ENV counter
4CA6 0E01      01609         movlw   TIA_ENVx_CTR_L
4CA8 50E3      01610         movf    PLUSW1, W
4CAA 2603      01611         addwf   MIOS_PARAMETER1, F
4CAC 0E02      01612         movlw   TIA_ENVx_CTR_H
4CAE 50E3      01613         movf    PLUSW1, W
4CB0 2204      01614         addwfc  MIOS_PARAMETER2, F
4CB2 E342      01615         bnc     TIA_SW_ENV_Calc
               01616 
               01617         ;; if value >= 0xffff: set to 0xffff, switch to Decay
4CB4 6803      01618         setf    MIOS_PARAMETER1
4CB6 6804      01619         setf    MIOS_PARAMETER2
4CB8 0E00      01620         movlw   TIA_ENVx_MODE
4CBA 82E3      01621         bsf     PLUSW1, ENVx_MODE_DECAY
               01622         rgoto   TIA_SW_ENV_Calc
4CBC D03D          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 145


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01623     
               01624     
               01625 
4CBE 01626 TIA_SW_ENV_Decay
               01627         ;; get decay rate depending on curve setting
4CBE 0E04      01628         movlw   TIA_ENVx_DECAY
4CC0 CFE3 F00D 01629         movff   PLUSW1, IRQ_TMP3
               01630 
4CC4 500E      01631         movf    IRQ_TMP4, W
4CC6 0B02      01632         andlw   0x02
4CC8 EC27 F028 01633         call    TIA_SW_ENV_GetBendedValue
               01634         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01635 
               01636         ;; subtraction with current counter value
4CCC 0E01      01637         movlw   TIA_ENVx_CTR_L
4CCE CFE3 F00B 01638         movff   PLUSW1, IRQ_TMP1
4CD2 0E02      01639         movlw   TIA_ENVx_CTR_H
4CD4 CFE3 F00C 01640         movff   PLUSW1, IRQ_TMP2
               01641 
4CD8 5003      01642         movf    MIOS_PARAMETER1, W
4CDA 5C0B      01643         subwf   IRQ_TMP1, W
4CDC 6E03      01644         movwf   MIOS_PARAMETER1
4CDE 5004      01645         movf    MIOS_PARAMETER2, W
4CE0 580C      01646         subwfb  IRQ_TMP2, W
4CE2 6E04      01647         movwf   MIOS_PARAMETER2
4CE4 E309      01648         bnc     TIA_SW_ENV_Sustain
               01649 
               01650         ;; check if counter value < sustain value
4CE6 0E05      01651         movlw   TIA_ENVx_SUSTAIN
4CE8 34E3      01652         rlf     PLUSW1, W
4CEA 0BFE      01653         andlw   0xfe
4CEC 6E0B      01654         movwf   IRQ_TMP1
4CEE 0E00      01655         movlw   0x00
4CF0 5C03      01656         subwf   MIOS_PARAMETER1, W
4CF2 500B      01657         movf    IRQ_TMP1, W
4CF4 5804      01658         subwfb  MIOS_PARAMETER2, W
4CF6 E220      01659         bc      TIA_SW_ENV_Calc
               01660 
4CF8 01661 TIA_SW_ENV_Sustain
               01662         ;; write sustain value into counter
4CF8 0E05      01663         movlw   TIA_ENVx_SUSTAIN
4CFA 34E3      01664         rlf     PLUSW1, W
4CFC 0BFE      01665         andlw   0xfe
4CFE 6E04      01666         movwf   MIOS_PARAMETER2
4D00 6A03      01667         clrf    MIOS_PARAMETER1
               01668 
4D02 0E00      01669         movlw   TIA_ENVx_MODE
4D04 84E3      01670         bsf     PLUSW1, ENVx_MODE_SUSTAIN
               01671         rgoto   TIA_SW_ENV_Calc
4D06 D018          M         bra     label
               01672 
4D08 01673 TIA_SW_ENV_Release
               01674         ;; get release rate depending on curve setting
4D08 0E06      01675         movlw   TIA_ENVx_RELEASE
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 146


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4D0A CFE3 F00D 01676         movff   PLUSW1, IRQ_TMP3
4D0E 500E      01677         movf    IRQ_TMP4, W
4D10 0B04      01678         andlw   0x04
4D12 EC27 F028 01679         call    TIA_SW_ENV_GetBendedValue
               01680         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01681         
               01682         ;; subtraction with current counter value
4D16 0E01      01683         movlw   TIA_ENVx_CTR_L
4D18 CFE3 F00B 01684         movff   PLUSW1, IRQ_TMP1
4D1C 0E02      01685         movlw   TIA_ENVx_CTR_H
4D1E CFE3 F00C 01686         movff   PLUSW1, IRQ_TMP2
               01687 
4D22 5003      01688         movf    MIOS_PARAMETER1, W
4D24 5C0B      01689         subwf   IRQ_TMP1, W
4D26 6E03      01690         movwf   MIOS_PARAMETER1
4D28 5004      01691         movf    MIOS_PARAMETER2, W
4D2A 580C      01692         subwfb  IRQ_TMP2, W
4D2C 6E04      01693         movwf   MIOS_PARAMETER2
4D2E E204      01694         bc      TIA_SW_ENV_Calc
               01695 
               01696         ;; zero reached
4D30 6A03      01697         clrf    MIOS_PARAMETER1
4D32 6A04      01698         clrf    MIOS_PARAMETER2
4D34 0E00      01699         movlw   TIA_ENVx_MODE
4D36 6AE3      01700         clrf    PLUSW1
4D38 01701 TIA_SW_ENV_Calc
               01702         ;; copy MIOS_PARAMETER[12] to TIA_ENVx_CTR_[LH]
4D38 0E01      01703         movlw   TIA_ENVx_CTR_L
4D3A C003 FFE3 01704         movff   MIOS_PARAMETER1, PLUSW1
4D3E 0E02      01705         movlw   TIA_ENVx_CTR_H
4D40 C004 FFE3 01706         movff   MIOS_PARAMETER2, PLUSW1
               01707 
               01708         ;; calculate envelope value depending on envelope rate
               01709         
               01710         ;; clear ENV ResultValue Registers
4D44 0E09      01711         movlw   TIA_ENVx_RVALUE_L
4D46 6AE3      01712         clrf    PLUSW1
4D48 0E0A      01713         movlw   TIA_ENVx_RVALUE_H
4D4A 6AE3      01714         clrf    PLUSW1
               01715 
               01716         ;; skip multiply routine if ENV_x_DEPTH is 0x40
4D4C 0E08      01717         movlw   TIA_ENVx_DEPTH
4D4E 50E3      01718         movf    PLUSW1, W
4D50 0A40      01719         xorlw 0x40
4D52 E00D      01720         bz      TIA_SW_ENV_End
               01721 
               01722         ;; convert linear ENV value to waveform by using the TIA_SW_ENV_Hlp_Waveform function
               01723         ;; depth in IRQ_TMP2
4D54 0E08      01724         movlw   TIA_ENVx_DEPTH
4D56 CFE3 F00C 01725         movff   PLUSW1, IRQ_TMP2
               01726         ;; linear ENV value in WREG
4D5A 0E02      01727         movlw   TIA_ENVx_CTR_H
4D5C 30E3      01728         rrf     PLUSW1, W
               01729         ;; process waveform
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 147


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4D5E EC50 F027 01730         call    TIA_SW_ENV_Hlp_Waveform
               01731         ;; store 16bit result in RVALUE registers
4D62 0E09      01732         movlw   TIA_ENVx_RVALUE_L
4D64 CFF3 FFE3 01733         movff   PRODL, PLUSW1
4D68 0E0A      01734         movlw   TIA_ENVx_RVALUE_H
4D6A CFF4 FFE3 01735         movff   PRODH, PLUSW1
4D6E 01736 TIA_SW_ENV_End
4D6E 0012      01737         return
               01738 
               01739 
               01740 ;; --------------------------------------------------------------------------
               01741 ;; Help Function: add modulation values depending on enabled sources
               01742 ;; In: Enabled LFOs and ENCs in WREG, 7-bit offset in IRQ_TMP4
               01743 ;; Out: signed 16bit result value in IRQ_TMP[12]
               01744 ;; --------------------------------------------------------------------------
4D70 01745 TIA_SW_Hlp_GetMOD
4D70 6A0B      01746         clrf    IRQ_TMP1
4D72 6A0C      01747         clrf    IRQ_TMP2
4D74 6A0D      01748         clrf    IRQ_TMP3
4D76 6E0E      01749         movwf   IRQ_TMP4        ; save assigned LFOs and ENVs in IRQ_TMP4
               01750 
               01751         ;; add all enabled LFO values (16 bit -> 24 bit)
               01752         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_1, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO1
4D78 A00E          M         btfss   reg, bit, reg_a
4D7A D00A          M         bra     label
4D7C 01753 TIA_SW_Hlp_GetMOD_LFO1
4D7C 51A5      01754         movf    TIA_LFO1_BASE + TIA_LFOx_RVALUE_L, W, BANKED
4D7E 260B      01755         addwf   IRQ_TMP1, F
4D80 51A6      01756         movf    TIA_LFO1_BASE + TIA_LFOx_RVALUE_H, W, BANKED
4D82 220C      01757         addwfc  IRQ_TMP2, F
4D84 0E00      01758         movlw   0x00
4D86 BFA6      01759         btfsc   TIA_LFO1_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
4D88 0EFF      01760         movlw   0xff
4D8A B0D8      01761         skpnc
4D8C 0F01      01762         addlw   1
4D8E 260D      01763         addwf   IRQ_TMP3, F
4D90 01764 TIA_SW_Hlp_GetMOD_NoLFO1
               01765 
               01766         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_2, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO2
4D90 A20E          M         btfss   reg, bit, reg_a
4D92 D00A          M         bra     label
4D94 01767 TIA_SW_Hlp_GetMOD_LFO2
4D94 51AC      01768         movf    TIA_LFO2_BASE + TIA_LFOx_RVALUE_L, W, BANKED
4D96 260B      01769         addwf   IRQ_TMP1, F
4D98 51AD      01770         movf    TIA_LFO2_BASE + TIA_LFOx_RVALUE_H, W, BANKED
4D9A 220C      01771         addwfc  IRQ_TMP2, F
4D9C 0E00      01772         movlw   0x00
4D9E BFAD      01773         btfsc   TIA_LFO2_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
4DA0 0EFF      01774         movlw   0xff
4DA2 B0D8      01775         skpnc
4DA4 0F01      01776         addlw   1
4DA6 260D      01777         addwf   IRQ_TMP3, F
4DA8 01778 TIA_SW_Hlp_GetMOD_NoLFO2
               01779 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 148


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01780         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_3, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO3
4DA8 A40E          M         btfss   reg, bit, reg_a
4DAA D00A          M         bra     label
4DAC 01781 TIA_SW_Hlp_GetMOD_LFO3
4DAC 51B3      01782         movf    TIA_LFO3_BASE + TIA_LFOx_RVALUE_L, W, BANKED
4DAE 260B      01783         addwf   IRQ_TMP1, F
4DB0 51B4      01784         movf    TIA_LFO3_BASE + TIA_LFOx_RVALUE_H, W, BANKED
4DB2 220C      01785         addwfc  IRQ_TMP2, F
4DB4 0E00      01786         movlw   0x00
4DB6 BFB4      01787         btfsc   TIA_LFO3_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
4DB8 0EFF      01788         movlw   0xff
4DBA B0D8      01789         skpnc
4DBC 0F01      01790         addlw   1
4DBE 260D      01791         addwf   IRQ_TMP3, F
4DC0 01792 TIA_SW_Hlp_GetMOD_NoLFO3
               01793 
               01794         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_4, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO4
4DC0 A60E          M         btfss   reg, bit, reg_a
4DC2 D00A          M         bra     label
4DC4 01795 TIA_SW_Hlp_GetMOD_LFO4
4DC4 51BA      01796         movf    TIA_LFO4_BASE + TIA_LFOx_RVALUE_L, W, BANKED
4DC6 260B      01797         addwf   IRQ_TMP1, F
4DC8 51BB      01798         movf    TIA_LFO4_BASE + TIA_LFOx_RVALUE_H, W, BANKED
4DCA 220C      01799         addwfc  IRQ_TMP2, F
4DCC 0E00      01800         movlw   0x00
4DCE BFBB      01801         btfsc   TIA_LFO4_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
4DD0 0EFF      01802         movlw   0xff
4DD2 B0D8      01803         skpnc
4DD4 0F01      01804         addlw   1
4DD6 260D      01805         addwf   IRQ_TMP3, F
4DD8 01806 TIA_SW_Hlp_GetMOD_NoLFO4
               01807 
               01808         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_1, ACCESS, TIA_SW_Hlp_GetMOD_NoENV1
4DD8 A80E          M         btfss   reg, bit, reg_a
4DDA D00A          M         bra     label
4DDC 01809 TIA_SW_Hlp_GetMOD_ENV1
4DDC 51DB      01810         movf    TIA_ENV1_BASE + TIA_ENVx_RVALUE_L, W, BANKED
4DDE 260B      01811         addwf   IRQ_TMP1, F
4DE0 51DC      01812         movf    TIA_ENV1_BASE + TIA_ENVx_RVALUE_H, W, BANKED
4DE2 220C      01813         addwfc  IRQ_TMP2, F
4DE4 0E00      01814         movlw   0x00
4DE6 BFDC      01815         btfsc   TIA_ENV1_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
4DE8 0EFF      01816         movlw   0xff
4DEA B0D8      01817         skpnc
4DEC 0F01      01818         addlw   1
4DEE 260D      01819         addwf   IRQ_TMP3, F
4DF0 01820 TIA_SW_Hlp_GetMOD_NoENV1
               01821 
               01822         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_2, ACCESS, TIA_SW_Hlp_GetMOD_NoENV2
4DF0 AA0E          M         btfss   reg, bit, reg_a
4DF2 D00A          M         bra     label
4DF4 01823 TIA_SW_Hlp_GetMOD_ENV2
4DF4 51E6      01824         movf    TIA_ENV2_BASE + TIA_ENVx_RVALUE_L, W, BANKED
4DF6 260B      01825         addwf   IRQ_TMP1, F
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 149


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4DF8 51E7      01826         movf    TIA_ENV2_BASE + TIA_ENVx_RVALUE_H, W, BANKED
4DFA 220C      01827         addwfc  IRQ_TMP2, F
4DFC 0E00      01828         movlw   0x00
4DFE BFE7      01829         btfsc   TIA_ENV2_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
4E00 0EFF      01830         movlw   0xff
4E02 B0D8      01831         skpnc
4E04 0F01      01832         addlw   1
4E06 260D      01833         addwf   IRQ_TMP3, F
4E08 01834 TIA_SW_Hlp_GetMOD_NoENV2
               01835 
               01836         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_A0, ACCESS, TIA_SW_Hlp_GetMOD_NoENVAUD0
4E08 AC0E          M         btfss   reg, bit, reg_a
4E0A D00A          M         bra     label
4E0C 01837 TIA_SW_Hlp_GetMOD_ENVAUD0
4E0C 51C5      01838         movf    TIA_ENVAUD0_BASE + TIA_ENVx_RVALUE_L, W, BANKED
4E0E 260B      01839         addwf   IRQ_TMP1, F
4E10 51C6      01840         movf    TIA_ENVAUD0_BASE + TIA_ENVx_RVALUE_H, W, BANKED
4E12 220C      01841         addwfc  IRQ_TMP2, F
4E14 0E00      01842         movlw   0x00
4E16 BFC6      01843         btfsc   TIA_ENVAUD0_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
4E18 0EFF      01844         movlw   0xff
4E1A B0D8      01845         skpnc
4E1C 0F01      01846         addlw   1
4E1E 260D      01847         addwf   IRQ_TMP3, F
4E20 01848 TIA_SW_Hlp_GetMOD_NoENVAUD0
               01849 
               01850         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_A1, ACCESS, TIA_SW_Hlp_GetMOD_NoENVAUD1
4E20 AE0E          M         btfss   reg, bit, reg_a
4E22 D00A          M         bra     label
4E24 01851 TIA_SW_Hlp_GetMOD_ENVAUD1
4E24 51D0      01852         movf    TIA_ENVAUD1_BASE + TIA_ENVx_RVALUE_L, W, BANKED
4E26 260B      01853         addwf   IRQ_TMP1, F
4E28 51D1      01854         movf    TIA_ENVAUD1_BASE + TIA_ENVx_RVALUE_H, W, BANKED
4E2A 220C      01855         addwfc  IRQ_TMP2, F
4E2C 0E00      01856         movlw   0x00
4E2E BFD1      01857         btfsc   TIA_ENVAUD1_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
4E30 0EFF      01858         movlw   0xff
4E32 B0D8      01859         skpnc
4E34 0F01      01860         addlw   1
4E36 260D      01861         addwf   IRQ_TMP3, F
4E38 01862 TIA_SW_Hlp_GetMOD_NoENVAUD1
               01863         
               01864         ;; saturate to absolute 16 bit-value, keep sign in IRQ_TMP3[0]
               01865         BRA_IFSET IRQ_TMP3, 7, ACCESS, TIA_SW_Hlp_GetMOD_Negative
4E38 BE0D          M         btfsc   reg, bit, reg_a
4E3A D006          M         bra     label
4E3C 01866 TIA_SW_Hlp_GetMOD_Positive
4E3C 500D      01867         movf    IRQ_TMP3, W
4E3E E00D      01868         bz      TIA_SW_Hlp_GetMOD_Cont
4E40 680B      01869         setf    IRQ_TMP1
4E42 680C      01870         setf    IRQ_TMP2
4E44 6A0D      01871         clrf    IRQ_TMP3        ; save sign in IRQ_TMP3
               01872         rgoto   TIA_SW_Hlp_GetMOD_Cont
4E46 D009          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 150


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01873 
4E48 01874 TIA_SW_Hlp_GetMOD_Negative
4E48 500D      01875         movf    IRQ_TMP3, W
4E4A 0B7F      01876         andlw   0x7f
4E4C E102      01877         bnz     TIA_SW_Hlp_GetMOD_Negative_C
4E4E 6A0B      01878         clrf    IRQ_TMP1
4E50 6A0C      01879         clrf    IRQ_TMP2
4E52 01880 TIA_SW_Hlp_GetMOD_Negative_C
4E52 1E0B      01881         comf    IRQ_TMP1, F     ; invert result
4E54 1E0C      01882         comf    IRQ_TMP2, F
4E56 0E01      01883         movlw   0x01            ; save sign in IRQ_TMP3
4E58 6E0D      01884         movwf   IRQ_TMP3
4E5A 01885 TIA_SW_Hlp_GetMOD_Cont
               01886 
4E5A 0012      01887         return
               01888 
               01889 ;; --------------------------------------------------------------------------
               01890 ;; Help Function to add a 7-bit offset to IRQ_TMP[123] and saturate
               01891 ;; In:  offset in WREG, absolute 16-bit value in IRQ_TMP[12], sign in IRQ_TMP3[0]
               01892 ;; Out: New value in IRQ_TMP[12]
               01893 ;; --------------------------------------------------------------------------
4E5C 01894 TIA_SW_Hlp_AddOffset
4E5C 90D8      01895         clrc
4E5E 34E8      01896         rlf     WREG, W
4E60 6EF4      01897         movwf   PRODH
4E62 6AF3      01898         clrf    PRODL
               01899         ;;      rgoto   TIA_SW_Hlp_AddOffset16
               01900 
               01901 ;; --------------------------------------------------------------------------
               01902 ;; Help Function to add a 16-bit offset to IRQ_TMP[123] and saturate
               01903 ;; In:  offset in PROD[LH], absolute 16-bit value in IRQ_TMP[12], sign in IRQ_TMP3[0]
               01904 ;; Out: New value in IRQ_TMP[12]
               01905 ;; --------------------------------------------------------------------------
4E64 01906 TIA_SW_Hlp_AddOffset16
               01907         ;; add offset and saturate
               01908         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_AddOffset16_Negative
4E64 B00D          M         btfsc   reg, bit, reg_a
4E66 D008          M         bra     label
4E68 01909 TIA_SW_Hlp_AddOffset16_Positive
4E68 50F3      01910         movf    PRODL, W        ; add offset
4E6A 260B      01911         addwf   IRQ_TMP1, F
4E6C 50F4      01912         movf    PRODH, W
4E6E 220C      01913         addwfc  IRQ_TMP2, F
4E70 E30C      01914         bnc     TIA_SW_Hlp_AddOffset16_End
4E72 680B      01915         setf    IRQ_TMP1        ; saturate
4E74 680C      01916         setf    IRQ_TMP2
               01917         rgoto   TIA_SW_Hlp_AddOffset16_End
4E76 D009          M         bra     label
4E78 01918 TIA_SW_Hlp_AddOffset16_Negative
4E78 500B      01919         movf    IRQ_TMP1, W     ; subtract offset
4E7A 5CF3      01920         subwf   PRODL, W
4E7C 6E0B      01921         movwf   IRQ_TMP1
4E7E 500C      01922         movf    IRQ_TMP2, W
4E80 58F4      01923         subwfb  PRODH, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 151


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4E82 6E0C      01924         movwf   IRQ_TMP2
4E84 E202      01925         bc      TIA_SW_Hlp_AddOffset16_End
4E86 6A0B      01926         clrf    IRQ_TMP1
4E88 6A0C      01927         clrf    IRQ_TMP2
4E8A 01928 TIA_SW_Hlp_AddOffset16_End
               01929 
4E8A 0012      01930         return
               01931 
               01932 ;; --------------------------------------------------------------------------
               01933 ;; Help Function: Get absolute value
               01934 ;; IN:  signed 16-bit value in IRQ_TMP[12]
               01935 ;; Out: unsigned absolute value in IRQ_TMP[12]
               01936 ;;      sign in IRQ_TMP3[0]
               01937 ;; --------------------------------------------------------------------------
4E8C 01938 TIA_SW_Hlp_GetAbs16
               01939         ;; convert IRQ_TMP[12] to unsigned integer, keep sign in IRQ_TMP3[0]
4E8C 6A0D      01940         clrf    IRQ_TMP3
               01941         BRA_IFCLR IRQ_TMP2, 7, ACCESS, TIA_SW_Hlp_GetABS16_Pos
4E8E AE0C          M         btfss   reg, bit, reg_a
4E90 D006          M         bra     label
4E92 01942 TIA_SW_Hlp_GetABS16_Neg
4E92 800D      01943         bsf     IRQ_TMP3, 0     ; memorize sign in IRQ_TMP3[0]
4E94 1E0B      01944         comf    IRQ_TMP1, F
4E96 1E0C      01945         comf    IRQ_TMP2, F
4E98 2A0B      01946         incf    IRQ_TMP1, F
4E9A B4D8      01947         skpnz
4E9C 2A0C      01948         incf    IRQ_TMP2, F
4E9E 01949 TIA_SW_Hlp_GetABS16_Pos
4E9E 0012      01950         return
               01951 
               01952 
               01953 ;; --------------------------------------------------------------------------
               01954 ;; Help Function for ENV Waveforms (resuses the LFO Waveform routine)
               01955 ;; In:  ENV_x_VALUE in WREG
               01956 ;;      ENV_x_DEPTH in IRQ_TMP2,
               01957 ;;      Accent flag in IRQ_TMP4.3
               01958 ;; Out: Result in PROD[LH]
               01959 ;; --------------------------------------------------------------------------
4EA0 01960 TIA_SW_ENV_Hlp_Waveform
               01961 
               01962 ;       BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_SW_ENV_Hlp_Waveform_NotTB303
               01963 ;TIA_SW_ENV_Hlp_Waveform_TB303
               01964 ;       movwf   IRQ_TMP1
               01965 ;       ;; in TB303 mode the depth parameter is used as "env mod" which is always positive
               01966 ;       ;; modify depth depending on ACCENT flag
               01967 ;       rrf     IRQ_TMP2, W
               01968 ;       andlw   0x3f
               01969 ;       movwf   IRQ_TMP2
               01970 ;       BRA_IFCLR IRQ_TMP4, 3, ACCESS, TIA_SW_ENV_Hlp_Waveform_NoAcc
               01971 ;TIA_SW_ENV_Hlp_Waveform_Acc
               01972 ;;      addlw   0x10
               01973 ;       movwf   IRQ_TMP2
               01974 ;TIA_SW_ENV_Hlp_Waveform_NoAcc
               01975 ;       movf    IRQ_TMP1, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 152


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01976 ;       andlw   0x7f
               01977 ;       mulwf   IRQ_TMP2, ACCESS
               01978 ;       return
               01979 
               01980 ;TIA_SW_ENV_Hlp_Waveform_NotTB303
               01981         ;; set mode to 0x10, don't overwrite WREG
4EA0 6A0B      01982         clrf    IRQ_TMP1
4EA2 880B      01983         bsf     IRQ_TMP1, 4     ; (triangle waveform)
               01984 
               01985         ;; convert linear envelope value
4EA4 0B7F      01986         andlw   0x7f
4EA6 BC0C      01987         btfsc   IRQ_TMP2, 6; shift positive values to > 0x0000
4EA8 0F80      01988         addlw 0x80      
4EAA AC0C      01989         btfss   IRQ_TMP2, 6; inversion if depth < 0x40
4EAC 0A7F      01990         xorlw 0x7f      
               01991         rgoto   TIA_SW_ENV_Hlp_Waveform_Cont
4EAE D002          M         bra     label
               01992 
               01993 ;; --------------------------------------------------------------------------
               01994 ;; Help Function for LFO and ENV Waveforms
               01995 ;; In:  LFO_x_VALUE in WREG
               01996 ;;      LFO_x_MODE in IRQ_TMP1
               01997 ;;      LFO_x_DEPTH in IRQ_TMP2,
               01998 ;;      LFO/ENV number in TIA_SW_LFO_NUMBER
               01999 ;;      pointer to LFOx_BASE in FSR1
               02000 ;; Out: Result in PROD[LH]
               02001 ;;      Scaled Value in IRQ_TMP1
               02002 ;; --------------------------------------------------------------------------
4EB0 02003 TIA_SW_LFO_Hlp_Waveform
               02004         ;; invert if negative depth (<0x40)
4EB0 AC0C      02005         btfss   IRQ_TMP2, 6
4EB2 0AFF      02006         xorlw 0xff
               02007 
               02008         ;; envelope waveform routine continues here
4EB4 02009 TIA_SW_ENV_Hlp_Waveform_Cont
4EB4 6E0D      02010         movwf   IRQ_TMP3
               02011 
               02012         ;; get absolute value of depth from TIA_DEPTH_TABLE
               02013         ;; (to keep it compatible with MIDIbox TIA V1.5)
4EB6 500C      02014         movf    IRQ_TMP2, W
4EB8 D8C3      02015         rcall   TIA_SW_Hlp_Abs7
4EBA 0F3E      02016         addlw   TIA_DEPTH_TABLE & 0xff
4EBC 6EF6      02017         movwf   TBLPTRL
4EBE 6AF7      02018         clrf    TBLPTRH
4EC0 0E32      02019         movlw   TIA_DEPTH_TABLE >> 8
4EC2 22F7      02020         addwfc  TBLPTRH, F
4EC4 0009      02021         tblrd*+
4EC6 50F5      02022         movf    TABLAT, W
4EC8 6E0C      02023         movwf   IRQ_TMP2
               02024         
               02025         ;; branch depending on selected waveform
4ECA 380B      02026         swapf   IRQ_TMP1, W
4ECC 0B07      02027         andlw   0x07
               02028         JUMPTABLE_2BYTES_UNSECURE
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 153


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4ECE ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               02029         rgoto   TIA_SW_LFO_Hlp_WFBranch_0
4ED2 D007          M         bra     label
               02030         rgoto   TIA_SW_LFO_Hlp_WFBranch_1
4ED4 D00A          M         bra     label
               02031         rgoto   TIA_SW_LFO_Hlp_WFBranch_2
4ED6 D00D          M         bra     label
               02032         rgoto   TIA_SW_LFO_Hlp_WFBranch_3
4ED8 D011          M         bra     label
               02033         rgoto   TIA_SW_LFO_Hlp_WFBranch_4
4EDA D014          M         bra     label
               02034         rgoto   TIA_SW_LFO_Hlp_WFBranch_5
4EDC D02A          M         bra     label
               02035         rgoto   TIA_SW_LFO_Hlp_WFBranch_6
4EDE D001          M         bra     label
               02036         rgoto   TIA_SW_LFO_Hlp_WFBranch_7
4EE0 D000          M         bra     label
               02037 
4EE2 02038 TIA_SW_LFO_Hlp_WFBranch_0       ; Sine
4EE2 02039 TIA_SW_LFO_Hlp_WFBranch_6       ; (reserved)
4EE2 02040 TIA_SW_LFO_Hlp_WFBranch_7       ; (reserved)
4EE2 500D      02041         movf    IRQ_TMP3, W
4EE4 ECD0 F018 02042         call    TIA_SIN_TABLE_Get
               02043         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4EE8 D025          M         bra     label
               02044 
4EEA 02045 TIA_SW_LFO_Hlp_WFBranch_1       ; Triangle
               02046         ;; Triangle: return unsigned value
4EEA 500D      02047         movf    IRQ_TMP3, W
4EEC AE0D      02048         btfss   IRQ_TMP3, 7
4EEE 0A7F      02049         xorlw   0x7f
               02050         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4EF0 D021          M         bra     label
               02051 
4EF2 02052 TIA_SW_LFO_Hlp_WFBranch_2       ; sawtooth
               02053         ;; Sawtooth: x/2, MODE_DECINC is the eight bit
4EF2 300D      02054         rrf     IRQ_TMP3, W
4EF4 0B7F      02055         andlw   0x7f
4EF6 BE0B      02056         btfsc   IRQ_TMP1, LFOx_MODE_DECINC ; (IRQ_TMP1=LFO_x_MODE)
4EF8 0980      02057         iorlw   0x80
               02058         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4EFA D01C          M         bra     label
4EFC 02059 TIA_SW_LFO_Hlp_WFBranch_3       ; pulse
               02060         ;; Pulse: 0x00 when Dec, 0xff when Inc, take inversion bit also into account
4EFC 0E00      02061         movlw   0x00
4EFE BE0B      02062         btfsc   IRQ_TMP1, LFOx_MODE_DECINC; (IRQ_TMP1=LFO_x_MODE)
4F00 0EFF      02063         movlw 0xff 
               02064         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4F02 D018          M         bra     label
4F04 02065 TIA_SW_LFO_Hlp_WFBranch_4       ; random
               02066         ;; each second LFO is in S&H mode
               02067         BRA_IFCLR TIA_SW_LFO_NUMBER, 0, BANKED, TIA_SW_LFO_Hlp_WFBranch_4_Random
4F04 A10F          M         btfss   reg, bit, reg_a
4F06 D00C          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 154


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4F08 02068 TIA_SW_LFO_Hlp_WFBranch_4_S_H
4F08 500D      02069         movf    IRQ_TMP3, W     ; latch on period match
4F0A 0E05      02070         movlw   TIA_LFOx_RVALUE_L
4F0C B4D8      02071         skpnz
4F0E 0EFE      02072         movlw   TIA_LFOx_RVALUE_L - TIA_LFOx_RECORD_LEN
4F10 CFE3 FFF3 02073         movff   PLUSW1, PRODL
               02074 
4F14 0E06      02075         movlw   TIA_LFOx_RVALUE_H
4F16 B4D8      02076         skpnz
4F18 0EFF      02077         movlw   TIA_LFOx_RVALUE_H - TIA_LFOx_RECORD_LEN
4F1A CFE3 FFF4 02078         movff   PLUSW1, PRODH
               02079         rgoto   TIA_SW_LFO_Hlp_Waveform_End
4F1E D011          M         bra     label
               02080 
4F20 02081 TIA_SW_LFO_Hlp_WFBranch_4_Random
4F20 511D      02082         movf    TIA_LFO_RANDOM_SEED_H, W, BANKED
4F22 0B55      02083         andlw   0x55
4F24 6E0B      02084         movwf   IRQ_TMP1
4F26 511C      02085         movf    TIA_LFO_RANDOM_SEED_L, W, BANKED
4F28 0BAA      02086         andlw   0xaa
4F2A 100B      02087         iorwf   IRQ_TMP1, W
4F2C 24CE      02088         addwf   TMR1L, W        ; super-random ;-)
4F2E 18CC      02089         xorwf   TMR2, W
               02090         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4F30 D001          M         bra     label
               02091 
4F32 02092 TIA_SW_LFO_Hlp_WFBranch_5       ; (AIN)
               02093 #if ENABLE_AIN_LFO_WAVEFORM
               02094         movf    TIA_SW_LFO_NUMBER, W, BANKED
               02095         movff   FSR1L, IRQ_TMP1         ; save FSR1
               02096         movff   FSR1H, IRQ_TMP3
               02097         call    MIOS_AIN_PinGet         ; get value of analog pin
               02098         movff   IRQ_TMP1, FSR1L         ; restore FSR1
               02099         movff   IRQ_TMP3, FSR1H
               02100         SET_BSR TIA_BASE
               02101         rrf     MIOS_PARAMETER2, F      ; convert 10bit to 8bit
               02102         rrf     MIOS_PARAMETER1, F
               02103         rrf     MIOS_PARAMETER2, F
               02104         rrf     MIOS_PARAMETER1, W
               02105 
               02106         ;; biased at 0x80
               02107         BRA_IFSET WREG, 7, ACCESS, TIA_SW_LFO_Hlp_WFBranch_Cont
               02108         xorlw   0x7f
               02109         addlw   1
               02110         btfsc   WREG, 7
               02111         movlw 0x7f
               02112 #else
4F32 0E80      02113         movlw   0x80
               02114 #endif
               02115         ;;      rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
               02116 
4F34 02117 TIA_SW_LFO_Hlp_WFBranch_Cont
4F34 6E0B      02118         movwf   IRQ_TMP1
               02119 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 155


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02120         ;; process scaling (depth * scaled value)
4F36 0B7F      02121         andlw   0x7f            ; remove sign from value
4F38 020C      02122         mulwf   IRQ_TMP2        ; multiply with depth (in IRQ_TMP2)
               02123         ;; result in PROD[LH]
               02124 
               02125         ;; invert if DECINC flag not set
               02126         BRA_IFSET IRQ_TMP1, 7, ACCESS, TIA_SW_LFO_Hlp_Waveform_End
4F3A BE0B          M         btfsc   reg, bit, reg_a
4F3C D002          M         bra     label
4F3E 1EF3      02127         comf    PRODL, F
4F40 1EF4      02128         comf    PRODH, F
4F42 02129 TIA_SW_LFO_Hlp_Waveform_End
4F42 0012      02130         return
               02131 
               02132 
               02133 ;; --------------------------------------------------------------------------
               02134 ;; Help Function to sync all LFOs
               02135 ;; --------------------------------------------------------------------------
4F44 02136 TIA_SW_Hlp_SyncAllLFOs
4F44 EE21 F0A0 02137         lfsr    FSR2, TIA_LFO1_BASE + TIA_LFOx_MODE
4F48 0E04      02138         movlw   0x04
4F4A 6E0B      02139         movwf   IRQ_TMP1
4F4C 02140 TIA_SW_Hlp_SyncAllLFOs_Loop
4F4C ECBB F027 02141         call    TIA_SW_Hlp_SyncLFO_Now
4F50 2E0B      02142         decfsz  IRQ_TMP1, F
               02143         rgoto   TIA_SW_Hlp_SyncAllLFOs_Loop
4F52 D7FC          M         bra     label
4F54 0012      02144         return
               02145 
               02146 ;; --------------------------------------------------------------------------
               02147 ;; Help Function for gate bit, syncs the LFOs
               02148 ;; In: TIA_Vx_PITCH_MOD | TIA_Vx_VOLUME_MOD | assigned filter flags
               02149 ;; --------------------------------------------------------------------------
4F56 02150 TIA_SW_Hlp_SyncLFOs
4F56 EE21 F0A0 02151         lfsr    FSR2, TIA_LFO1_BASE + TIA_LFOx_MODE
4F5A 6E0B      02152         movwf   IRQ_TMP1
4F5C D806      02153         rcall   TIA_SW_Hlp_SyncSingleLFO
4F5E 320B      02154         rrf     IRQ_TMP1, F
4F60 D804      02155         rcall   TIA_SW_Hlp_SyncSingleLFO
4F62 320B      02156         rrf     IRQ_TMP1, F
4F64 D802      02157         rcall   TIA_SW_Hlp_SyncSingleLFO
4F66 320B      02158         rrf     IRQ_TMP1, F
4F68 D800      02159         rcall   TIA_SW_Hlp_SyncSingleLFO
               02160 
               02161 
4F6A 02162 TIA_SW_Hlp_SyncSingleLFO
               02163         BRA_IFSET INDF2, LFOx_MODE_SYNC_ALL, ACCESS, TIA_SW_Hlp_SyncLFO_Now
4F6A B4DF          M         btfsc   reg, bit, reg_a
4F6C D004          M         bra     label
               02164         BRA_IFCLR IRQ_TMP1, 0, ACCESS, TIA_SW_Hlp_SyncLFO_Skip
4F6E A00B          M         btfss   reg, bit, reg_a
4F70 D00C          M         bra     label
               02165         BRA_IFCLR INDF2, LFOx_MODE_SYNC, ACCESS, TIA_SW_Hlp_SyncLFO_Skip
4F72 A2DF          M         btfss   reg, bit, reg_a
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 156


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4F74 D00A          M         bra     label
4F76 02166 TIA_SW_Hlp_SyncLFO_Now
4F76 9EDF      02167         bcf     INDF2, LFOx_MODE_DECINC
4F78 2AD9      02168         incf    FSR2L, F        ; switch to LFO_x_RATE
4F7A 2AD9      02169         incf    FSR2L, F        ; switch to LFO_x_CTR
4F7C 6ADE      02170         clrf    POSTINC2        ; clear counter,
               02171                                 ; switch to LFO_x_VALUE
4F7E 0E80      02172         movlw   0x80            ; write 0x80 into value
4F80 6EDE      02173         movwf   POSTINC2
               02174                                 ; switch to LFO_x_DEPTH
4F82 2AD9      02175         incf    FSR2L, F        ; switch to LFO_x_RVALUE_L
4F84 6ADE      02176         clrf    POSTINC2        ; clear LFO_x_RAVLUE_L
4F86 6ADE      02177         clrf    POSTINC2        ; clear LFO_x_RAVLUE_H
               02178 
4F88 0012      02179         return
               02180         
4F8A 02181 TIA_SW_Hlp_SyncLFO_Skip
4F8A 0E07      02182         movlw   TIA_LFOx_RECORD_LEN             ; switch to LFO_x+1_MODE
4F8C 26D9      02183         addwf   FSR2L, F
4F8E 0012      02184         return
               02185 
               02186 ;; --------------------------------------------------------------------------
               02187 ;; Help Function for gate bit, sets ENVs to attack mode
               02188 ;; In: TIA_Vx_ENVS | assigned filter flags
               02189 ;; --------------------------------------------------------------------------
4F90 02190 TIA_SW_Hlp_ENVAttack
               02191         ;; set envelope generators to attack mode if voice (or filter) has been assigned
4F90 6E0B      02192         movwf   IRQ_TMP1
               02193 
               02194         ;movf   IRQ_TMP1, W
4F92 0B11      02195         andlw   0x11
4F94 E002      02196         bz      TIA_SW_Hlp_ENVAttack_Not1
4F96 0E01      02197         movlw   (1 << ENVx_MODE_ATTACK)
4F98 6FD2      02198         movwf   TIA_ENV1_BASE + TIA_ENVx_MODE, BANKED
4F9A 02199 TIA_SW_Hlp_ENVAttack_Not1
               02200 
4F9A 500B      02201         movf    IRQ_TMP1, W
4F9C 0B22      02202         andlw   0x22
4F9E E002      02203         bz      TIA_SW_Hlp_ENVAttack_Not2
4FA0 0E01      02204         movlw   (1 << ENVx_MODE_ATTACK)
4FA2 6FDD      02205         movwf   TIA_ENV2_BASE + TIA_ENVx_MODE, BANKED
4FA4 02206 TIA_SW_Hlp_ENVAttack_Not2
               02207 
4FA4 500B      02208         movf    IRQ_TMP1, W
4FA6 0B0C      02209     andlw       0x0c
4FA8 E002      02210         bz      TIA_SW_Hlp_ENVAttack_Not3
4FAA 0E01      02211         movlw   (1 << ENVx_MODE_ATTACK)
4FAC 6FBC      02212         movwf   TIA_ENVAUD0_BASE + TIA_ENVx_MODE, BANKED
4FAE 02213 TIA_SW_Hlp_ENVAttack_Not3
               02214 
4FAE 500B      02215         movf    IRQ_TMP1, W
4FB0 0BC0      02216         andlw   0xc0
4FB2 E002      02217         bz      TIA_SW_Hlp_ENVAttack_Not4
4FB4 0E01      02218         movlw   (1 << ENVx_MODE_ATTACK)
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 157


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4FB6 6FC7      02219         movwf   TIA_ENVAUD1_BASE + TIA_ENVx_MODE, BANKED
4FB8 02220 TIA_SW_Hlp_ENVAttack_Not4
4FB8 0012      02221         return
               02222 
               02223 ;; --------------------------------------------------------------------------
               02224 ;; Help Function for gate bit, sets ENVs to release mode
               02225 ;; In: TIA_Vx_ENVS | assigned filter flags
               02226 ;; --------------------------------------------------------------------------
4FBA 02227 TIA_SW_Hlp_ENVRelease
               02228         ;; set envelope generators to release mode if voice (or filter) has been assigned
4FBA 6E0B      02229         movwf   IRQ_TMP1
               02230 
4FBC 0B11      02231         andlw   0x11
4FBE E002      02232         bz      TIA_SW_Hlp_ENVRelease_Not1
4FC0 0E08      02233         movlw   (1 << ENVx_MODE_RELEASE)
4FC2 6FD2      02234         movwf   TIA_ENV1_BASE + TIA_ENVx_MODE, BANKED
4FC4 02235 TIA_SW_Hlp_ENVRelease_Not1
               02236 
4FC4 500B      02237         movf    IRQ_TMP1, W
4FC6 0B22      02238         andlw   0x22
4FC8 E002      02239         bz      TIA_SW_Hlp_ENVRelease_Not2
4FCA 0E08      02240         movlw   (1 << ENVx_MODE_RELEASE)
4FCC 6FDD      02241         movwf   TIA_ENV2_BASE + TIA_ENVx_MODE, BANKED
4FCE 02242 TIA_SW_Hlp_ENVRelease_Not2
               02243 
4FCE 500B      02244         movf    IRQ_TMP1, W
4FD0 0B0C      02245     andlw       0x0c
4FD2 E002      02246         bz      TIA_SW_Hlp_ENVRelease_Not3
4FD4 0E08      02247         movlw   (1 << ENVx_MODE_RELEASE)
4FD6 6FBC      02248         movwf   TIA_ENVAUD0_BASE + TIA_ENVx_MODE, BANKED
4FD8 02249 TIA_SW_Hlp_ENVRelease_Not3
               02250 
4FD8 500B      02251         movf    IRQ_TMP1, W
4FDA 0BC0      02252         andlw   0xc0
4FDC E002      02253         bz      TIA_SW_Hlp_ENVRelease_Not4
4FDE 0E08      02254         movlw   (1 << ENVx_MODE_RELEASE)
4FE0 6FC7      02255         movwf   TIA_ENVAUD1_BASE + TIA_ENVx_MODE, BANKED
4FE2 02256 TIA_SW_Hlp_ENVRelease_Not4
4FE2 0012      02257         return
               02258 
               02259 ;; --------------------------------------------------------------------------
               02260 ;; Help Function for TIA_SW_Pitch
               02261 ;; IN: TIA_Vx_TARGET_FRQ_LH in FSR2
               02262 ;; OUT: new result in TIA_Vx_TARGET_FRQ_LH
               02263 ;; --------------------------------------------------------------------------
4FE4 02264 TIA_SW_Hlp_AddMul
               02265         BRA_IFCLR IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_AddMul_Pos
4FE4 A00D          M         btfss   reg, bit, reg_a
4FE6 D00D          M         bra     label
4FE8 02266 TIA_SW_Hlp_AddMul_Neg
               02267         ;; calc MUL_A_[LH] = TIA_Vx_FRQ_[LH] - MIOS_PARAMETER[12]
4FE8 5003      02268         movf    MIOS_PARAMETER1, W
4FEA 5CDE      02269         subwf   POSTINC2, W     ; TIA_Vx_TARGET_FRQ_LH+0, W, BANKED
4FEC 6FF8      02270         movwf   MUL_A_L, BANKED
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 158


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4FEE 5004      02271         movf    MIOS_PARAMETER2, W
4FF0 58DD      02272         subwfb  POSTDEC2, W     ; TIA_Vx_TARGET_FRQ_LH+1, W, BANKED
4FF2 6FF9      02273         movwf   MUL_A_H, BANKED
               02274 
               02275         ;; calc MUL_R_[12] = MUL_A_[LH] * MUL_B_[LH]
4FF4 ECDE F019 02276         call    MATH_MUL16_16
               02277         ;; TIA_Vx_FRQ -= result
4FF8 51FD      02278         movf    MUL_R_1, W, BANKED
4FFA 5EDE      02279         subwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
4FFC 51FE      02280         movf    MUL_R_2, W, BANKED
4FFE 5ADD      02281         subwfb  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
5000 0012      02282         return
               02283 
5002 02284 TIA_SW_Hlp_AddMul_Pos
               02285         ;; calc MUL_A_[LH] = MIOS_PARAMETER[12] - TIA_Vx_FRQ_[LH]
5002 50DE      02286         movf    POSTINC2, W     ; TIA_Vx_TARGET_FRQ_LH+0, W, BANKED
5004 5C03      02287         subwf   MIOS_PARAMETER1, W
5006 6FF8      02288         movwf   MUL_A_L, BANKED
5008 50DD      02289         movf    POSTDEC2, W     ; TIA_Vx_TARGET_FRQ_LH+1, W, BANKED
500A 5804      02290         subwfb  MIOS_PARAMETER2, W
500C 6FF9      02291         movwf   MUL_A_H, BANKED
               02292 
               02293         ;; calc MUL_R_[12] = MUL_A_[LH] * MUL_B_[LH]
500E ECDE F019 02294         call    MATH_MUL16_16
               02295         ;; TIA_Vx_FRQ += result
5012 51FD      02296         movf    MUL_R_1, W, BANKED
5014 26DE      02297         addwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
5016 51FE      02298         movf    MUL_R_2, W, BANKED
5018 22DD      02299         addwfc  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
501A 0012      02300         return
               02301     
               02302     
               02303 ;; --------------------------------------------------------------------------
               02304 ;; Help Function for TIA_SW_Pitch
               02305 ;; IN:  addend and IRQ_TMP[12], TIA_Vx_TARGET_FRQ_LH in FSR2
               02306 ;; OUT: new result in TIA_Vx_TARGET_FRQ_LH
               02307 ;; --------------------------------------------------------------------------
501C 02308 TIA_SW_Hlp_Add16
               02309         ;; divide / 4 for a better scaling
               02310         ;clrc
               02311         ;rrf    IRQ_TMP2, F
               02312         ;rrf    IRQ_TMP1, F
               02313         ;clrc
               02314         ;rrf    IRQ_TMP2, F
               02315         ;rrf    IRQ_TMP1, F
               02316                 
               02317         BRA_IFCLR IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_Add16_Pos
501C A00D          M         btfss   reg, bit, reg_a
501E D008          M         bra     label
5020 02318 TIA_SW_Hlp_Add16_Neg
               02319         ;; TIA_Vx_TARGET_FRQ -= MOD 
5020 500B      02320         movf    IRQ_TMP1, W
5022 5EDE      02321         subwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
5024 500C      02322         movf    IRQ_TMP2, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 159


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5026 5ADD      02323         subwfb  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
               02324         ;; saturate on overflow
5028 E202      02325         bc      TIA_SW_Hlp_Add16_Neg_End
502A 6ADE      02326         clrf    POSTINC2        ; TIA_Vx_TARGET_FRQ_LH+0, BANKED
502C 6ADD      02327         clrf    POSTDEC2        ; TIA_Vx_TARGET_FRQ_LH+1, BANKED
502E 02328 TIA_SW_Hlp_Add16_Neg_End
502E 0012      02329         return
               02330 
5030 02331 TIA_SW_Hlp_Add16_Pos
               02332         ;; TIA_Vx_TARGET_FRQ += MOD
5030 500B      02333         movf    IRQ_TMP1, W
5032 26DE      02334         addwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
5034 500C      02335         movf    IRQ_TMP2, W
5036 22DD      02336         addwfc  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
               02337         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
5038 E302      02338         bnc     TIA_SW_Hlp_Add16_Pos_End
503A 68DE      02339         setf    POSTINC2        ; TIA_Vx_TARGET_FRQ_LH+0, BANKED
503C 68DD      02340         setf    POSTDEC2        ; TIA_Vx_TARGET_FRQ_LH+1, BANKED
503E 02341 TIA_SW_Hlp_Add16_Pos_End
503E 0012      02342         return
               02343 
               02344 
               02345 ;; --------------------------------------------------------------------------
               02346 ;; Help Function for TIA_SW_ENV, etc.
               02347 ;; IN:  7-bit signed value in WREG
               02348 ;; OUT: absolute value (0x00-0x3f) in WREG
               02349 ;; --------------------------------------------------------------------------
5040 02350 TIA_SW_Hlp_Abs7
5040 50E8      02351         movf    WREG, W
5042 B4D8      02352         skpnz
5044 0F01      02353         addlw   1
5046 ACE8      02354         btfss   WREG, 6
5048 0840      02355         sublw 0x40
504A 0B3F      02356         andlw   0x3f
504C 0012      02357         return
               02358 
               02359 ;; --------------------------------------------------------------------------
               02360 ;; Help Function for TIA_SW_ENV
               02361 ;; IN:  ENV_x_CTR_H in IRQ_TMP1
               02362 ;;      ENV_x_CURVE in IRQ_TMP2
               02363 ;;      ENV_x_ATTACK/ENV_x_DECAY or ENV_x_SUSTAIN in IRQ_TMP3
               02364 ;;      WREG != 0: use curve, WREG == 0: don't use curve parameter
               02365 ;; OUT: value which should be added to - or subtracted from - ENV_x_CTR_[LH]
               02366 ;;      low-byte in WREG and MIOS_PARAMETER1; high-byte in MIOS_PARAMETER2
               02367 ;; --------------------------------------------------------------------------
504E 02368 TIA_SW_ENV_GetBendedValue
504E E103      02369         bnz     TIA_SW_ENV_GetBendedValue_Curve
               02370 
               02371         ;; curve not selected, get value from ENV_TABLE
5050 500D      02372         movf    IRQ_TMP3, W
5052 EFA3 F030 02373         goto    TIA_ENV_TABLE_Get
               02374 
5056 02375 TIA_SW_ENV_GetBendedValue_Curve
               02376         ;; return ENV_x_DECAY when ENV_x_CURVE == 0x40
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 160


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5056 0E40      02377         movlw   0x40
5058 620C      02378         cpfseq  IRQ_TMP2, ACCESS
               02379         rgoto TIA_SW_ENV_GetBendedValue_UD
505A D002          M         bra     label
505C 1C0D      02380         comf    IRQ_TMP3, W
               02381         rgoto   TIA_SW_ENV_GetBendedValue_Cont
505E D011          M         bra     label
               02382 
5060 02383 TIA_SW_ENV_GetBendedValue_UD
               02384         ;; feedback: calculate ABS7(CURVE) * ENV_x_CTR_H
5060 500C      02385         movf    IRQ_TMP2, W             ; get absolute value of curve parameter
5062 DFEE      02386         rcall   TIA_SW_Hlp_Abs7
5064 020B      02387         mulwf   IRQ_TMP1, ACCESS        ; multiply with current counter value
               02388         
               02389         ;; when CURVE parameter < 0x40: bend down, else up
               02390         BRA_IFCLR IRQ_TMP2, 6, ACCESS, TIA_SW_ENV_GetBendedValue_Down
5066 AC0C          M         btfss   reg, bit, reg_a
5068 D007          M         bra     label
506A 02391 TIA_SW_ENV_GetBendedValue_Up
506A 1E0D      02392         comf    IRQ_TMP3, F
506C 9E0D      02393         bcf     IRQ_TMP3, 7
506E 50F4      02394         movf    PRODH, W
5070 5C0D      02395         subwf   IRQ_TMP3, W
5072 BEE8      02396         btfsc   WREG, 7
5074 0E00      02397         movlw 0x00
               02398         rgoto   TIA_SW_ENV_GetBendedValue_Cont
5076 D005          M         bra     label
               02399 
5078 02400 TIA_SW_ENV_GetBendedValue_Down
5078 1C0D      02401         comf    IRQ_TMP3, W
507A 0B7F      02402         andlw   0x7f
507C 24F4      02403         addwf   PRODH, W
507E BEE8      02404         btfsc   WREG, 7
5080 0E7F      02405         movlw 0x7f
               02406         ;;      rgoto   TIA_SW_ENV_GetBendedValue_Cont
               02407 
5082 02408 TIA_SW_ENV_GetBendedValue_Cont
5082 0B7F      02409         andlw   0x7f
5084 EF41 F018 02410         goto    TIA_FRQ_TABLE_Get
               02411 
               02412 
               02413 ;; --------------------------------------------------------------------------
               02414 ;; Help Function used from tia_midi.inc and tia_ccin.inc to reset ENV2
               02415 ;; --------------------------------------------------------------------------
5088 02416 TIA_SW_Hlp_ENV2Reset
               02417         SET_BSR TIA_BASE
5088 0101          M         movlb   HIGH(reg)
               02418 
508A 0E01      02419         movlw   (1 << ENVx_MODE_ATTACK)
508C 6FC7      02420         movwf   TIA_ENVAUD1_BASE + TIA_ENVx_MODE, BANKED
               02421 
508E 6BC8      02422         clrf    TIA_ENVAUD1_BASE + TIA_ENVx_CTR_L, BANKED
5090 6BC9      02423         clrf    TIA_ENVAUD1_BASE + TIA_ENVx_CTR_H, BANKED
               02424 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 161


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5092 0012      02425         return
               02426 
               02427 
               02428 
               00385 ;#include "tia_wt.inc"
               00386 #include "tia_midi.inc"
               00001 ; $Id: tia_midi.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; MIDI Interface part
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  This function is called by TIA_MPROC when a complete MIDI event has been
               00016 ;;  received
               00017 ;;  Input:
               00018 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00019 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00020 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00021 ;; --------------------------------------------------------------------------
5094 00022 TIA_MIDI_NotifyReceivedEvent
               00023 
               00024         ;; branch to appr. TIA routine depending on received event
5094 3803      00025         swapf   MIOS_PARAMETER1, W
5096 0B07      00026         andlw   0x07
               00027         JUMPTABLE_2BYTES_UNSECURE
5098 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00028         rgoto   TIA_MIDI_NoteOff
509C D040          M         bra     label
               00029         rgoto   TIA_MIDI_NoteOn
509E D006          M         bra     label
               00030         rgoto   TIA_MIDI_AfterTouch
50A0 D0C2          M         bra     label
               00031         rgoto   TIA_MIDI_CC
50A2 D081          M         bra     label
               00032         rgoto   TIA_MIDI_ProgramChange
50A4 D0A7          M         bra     label
               00033         rgoto   TIA_MIDI_PolyAfterTouch
50A6 D0BC          M         bra     label
               00034         rgoto   TIA_MIDI_PitchBender
50A8 D06D          M         bra     label
50AA 0012      00035         return
               00036 
               00037 ;; --------------------------------------------------------------------------
               00038 ;;  This function is rcalled to forward a Note On event to the synthesizer
               00039 ;;  Input:
               00040 ;;     o first  MIDI event byte in MIOS_PARAMETER1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 162


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00041 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00042 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00043 ;; --------------------------------------------------------------------------
50AC 00044 TIA_MIDI_NoteOn
50AC 5005      00045         movf    MIOS_PARAMETER3, W      ; branch to NoteOff if velocity is zero
50AE B4D8      00046         skpnz
               00047         rgoto   TIA_MIDI_NoteOff
50B0 D036          M         bra     label
               00048     
               00049 
               00050     
               00051         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
50B2 0101          M         movlb   HIGH(reg)
               00052 
               00053         BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED, TIA_MIDI_NoteOn_MonoMode
50B4 A10C          M         btfss   reg, bit, reg_a
50B6 D00F          M         bra     label
50B8 00054 TIA_MIDI_NoteOn_PolyMode
               00055         ;; in poly mode we only react on MIDI channel of voice 1!
50B8 5003      00056         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
50BA 0B0F      00057         andlw   0x0f
50BC 6320      00058         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
50BE 0012      00059         return
               00060         
               00061         ;; in poly mode: determine free voice
50C0 0E01      00062         movlw   0x01
50C2 5342      00063         movf    TIA_V1_BASE + TIA_Vx_NOTE_STACK_0, F, BANKED
50C4 E004      00064         bz      TIA_MIDI_NoteOn_Poly_Cont
50C6 0E02      00065         movlw   0x02
50C8 5382      00066         movf    TIA_V2_BASE + TIA_Vx_NOTE_STACK_0, F, BANKED
50CA E001      00067         bz      TIA_MIDI_NoteOn_Poly_Cont
               00068         rgoto   TIA_MIDI_NoteOn_Poly_Failed
50CC D026          M         bra     label
50CE 00069 TIA_MIDI_NoteOn_Poly_Cont
50CE 6E0A      00070         movwf   TMP5            ; TMP5 contains the voices which should be played
50D0 D960      00071     rcall   TIA_MIDI_GetAssignedKeys
50D2 D95F      00072     rcall   TIA_MIDI_GetAssignedKeys
               00073         rgoto   TIA_MIDI_NoteOn_Start_Handlers
50D4 D005          M         bra     label
               00074 
50D6 00075 TIA_MIDI_NoteOn_MonoMode
               00076         ;; check for the assigned MIDI channels, result in TMP5
50D6 D938      00077         rcall   TIA_MIDI_GetAssignedChannels
50D8 D944      00078         rcall   TIA_MIDI_GetAssignedVoices
50DA D95B      00079     rcall   TIA_MIDI_GetAssignedKeys
               00080         ;; leave routine if no voice is assigned to channel
50DC B4D8      00081         skpnz
50DE 0012      00082         return
               00083 
50E0 00084 TIA_MIDI_NoteOn_Start_Handlers
               00085         IRQ_DISABLE
50E0 9EF2          M         bcf     INTCON, GIE
               00086 
               00087         ;; --[ Voice 1 Handler ]--
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 163


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
50E2 00088 TIA_MIDI_NoteOn_V1
               00089         BRA_IFCLR TMP5, 0, ACCESS, TIA_MIDI_NoteOn_V1_Failed
50E2 A00A          M         btfss   reg, bit, reg_a
50E4 D00C          M         bra     label
50E6 EE11 F042 00090         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_NOTE_STACK_0         ; push note to stack
50EA D8A9      00091         rcall   TIA_MIDI_Hlp_PushNote
               00092         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOn_V1_Failed    ; exit if note already in stack
50EC B0E8          M         btfsc   reg, bit, reg_a
50EE D007          M         bra     label
50F0 EE01 F020 00093         lfsr    FSR0, TIA_V1_BASE
50F4 5004      00094         movf    MIOS_PARAMETER2, W                              ; note which should be disabled
               00095 ;       RCALL_IFSET TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED, TIA_MIDI_Hlp_GateOff       ; request gate-off if !legato
50F6 D8D4      00096         rcall   TIA_MIDI_Hlp_NoteOn                             ; call note-on handler
50F8 EE21 F020 00097         lfsr    FSR2, TIA_V1_BASE                               ; sort notes for arpeggios
50FC D966      00098         rcall   TIA_MIDI_Arp_Sorter
50FE 00099 TIA_MIDI_NoteOn_V1_Failed
               00100 
               00101         ;; --[ Voice 2 Handler ]--
50FE 00102 TIA_MIDI_NoteOn_V2
               00103         BRA_IFCLR TMP5, 1, ACCESS, TIA_MIDI_NoteOn_V2_Failed
50FE A20A          M         btfss   reg, bit, reg_a
5100 D00C          M         bra     label
5102 EE11 F082 00104         lfsr    FSR1, TIA_V2_BASE + TIA_Vx_NOTE_STACK_0         ; push note to stack
5106 D89B      00105         rcall   TIA_MIDI_Hlp_PushNote
               00106         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOn_V2_Failed    ; exit if note already in stack
5108 B0E8          M         btfsc   reg, bit, reg_a
510A D007          M         bra     label
510C EE01 F060 00107         lfsr    FSR0, TIA_V2_BASE
5110 5004      00108         movf    MIOS_PARAMETER2, W                              ; note which should be disabled
               00109 ;       RCALL_IFSET TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED, TIA_MIDI_Hlp_GateOff       ; request gate-off if !legato
5112 D8C6      00110         rcall   TIA_MIDI_Hlp_NoteOn                             ; call note-on handler
5114 EE21 F060 00111         lfsr    FSR2, TIA_V2_BASE                               ; sort notes for arpeggios
5118 D958      00112         rcall   TIA_MIDI_Arp_Sorter
511A 00113 TIA_MIDI_NoteOn_V2_Failed
               00114 
511A 00115 TIA_MIDI_NoteOn_Poly_Failed
               00116 
               00117         IRQ_ENABLE
511A 8EF2          M         bsf     INTCON, GIE
511C 0012      00118         return
               00119 
               00120 ;; --------------------------------------------------------------------------
               00121 ;;  This function is rcalled to forward a Note Off event to the synthesizer
               00122 ;;  Input:
               00123 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00124 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00125 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00126 ;; --------------------------------------------------------------------------
511E 00127 TIA_MIDI_NoteOff
               00128         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
511E 0101          M         movlb   HIGH(reg)
               00129 
               00130         ;; ensure that velocity is cleared
5120 6A05      00131         clrf    MIOS_PARAMETER3
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 164


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00132 
               00133         BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED, TIA_MIDI_NoteOff_MonoMode
5122 A10C          M         btfss   reg, bit, reg_a
5124 D003          M         bra     label
5126 00134 TIA_MIDI_NoteOff_PolyMode
               00135         ;; in poly mode, handle all channels
5126 0E0F      00136         movlw   0x0f
5128 6E0A      00137         movwf   TMP5
               00138         rgoto   TIA_MIDI_NoteOff_Start_Handlers
512A D005          M         bra     label
512C 00139 TIA_MIDI_NoteOff_MonoMode
               00140         ;; check for the assigned MIDI channels, result in TMP5
512C D90D      00141         rcall   TIA_MIDI_GetAssignedChannels
512E D919      00142         rcall   TIA_MIDI_GetAssignedVoices ; (not so optimal if split points modified during notes are played)
5130 D930      00143     rcall   TIA_MIDI_GetAssignedKeys
               00144         ;; leave routine if no voice is assigned to channel
5132 B4D8      00145         skpnz
5134 0012      00146         return
               00147 
5136 00148 TIA_MIDI_NoteOff_Start_Handlers
               00149         IRQ_DISABLE
5136 9EF2          M         bcf     INTCON, GIE
               00150 
               00151         ;; --[ Voice 1 Handler ]--
5138 00152 TIA_MIDI_NoteOff_V1
               00153         BRA_IFCLR TMP5, 0, ACCESS, TIA_MIDI_NoteOff_V1_NotFnd
5138 A00A          M         btfss   reg, bit, reg_a
513A D010          M         bra     label
513C EE11 F042 00154         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_NOTE_STACK_0         ; pop note from stack
5140 CFE7 F008 00155         movff   INDF1, TMP3                                     ; save current #0 entry in TMP3 for later use
5144 D895      00156         rcall   TIA_MIDI_Hlp_PopNote
               00157         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOff_V1_NotFnd
5146 B0E8          M         btfsc   reg, bit, reg_a
5148 D009          M         bra     label
514A EE01 F020 00158         lfsr    FSR0, TIA_V1_BASE
514E 5008      00159         movf    TMP3, W                                         ; restore note
5150 D8DA      00160         rcall   TIA_MIDI_Hlp_NoteOff
               00161         RCALL_IFSET WREG, 0, ACCESS, TIA_MIDI_Hlp_NoteOn
5152 B0E8          M         btfsc   reg, bit, reg_a
5154 D8A5          M         rcall   label
5156 EE21 F020 00162         lfsr    FSR2, TIA_V1_BASE                               ; sort notes for arpeggios
515A D937      00163         rcall   TIA_MIDI_Arp_Sorter
515C 00164 TIA_MIDI_NoteOff_V1_NotFnd
               00165 
               00166         ;; --[ Voice 2 Handler ]--
515C 00167 TIA_MIDI_NoteOff_V2
               00168         BRA_IFCLR TMP5, 1, ACCESS, TIA_MIDI_NoteOff_V2_NotFnd
515C A20A          M         btfss   reg, bit, reg_a
515E D010          M         bra     label
5160 EE11 F082 00169         lfsr    FSR1, TIA_V2_BASE + TIA_Vx_NOTE_STACK_0         ; pop note from stack
5164 CFE7 F008 00170         movff   INDF1, TMP3                                     ; save current #0 entry in TMP3 for later use
5168 D883      00171         rcall   TIA_MIDI_Hlp_PopNote
               00172         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOff_V2_NotFnd
516A B0E8          M         btfsc   reg, bit, reg_a
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 165


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
516C D009          M         bra     label
516E EE01 F060 00173         lfsr    FSR0, TIA_V2_BASE
5172 5008      00174         movf    TMP3, W                                         ; restore note
5174 D8C8      00175         rcall   TIA_MIDI_Hlp_NoteOff
               00176         RCALL_IFSET WREG, 0, ACCESS, TIA_MIDI_Hlp_NoteOn
5176 B0E8          M         btfsc   reg, bit, reg_a
5178 D893          M         rcall   label
517A EE21 F060 00177         lfsr    FSR2, TIA_V2_BASE                               ; sort notes for arpeggios
517E D925      00178         rcall   TIA_MIDI_Arp_Sorter
5180 00179 TIA_MIDI_NoteOff_V2_NotFnd
               00180 
               00181         IRQ_ENABLE
5180 8EF2          M         bsf     INTCON, GIE
5182 0012      00182         return
               00183 
               00184 
               00185 ;; --------------------------------------------------------------------------
               00186 ;;  This function is rcalled to forward a PitchBender event to the synthesizer
               00187 ;;  Input:
               00188 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00189 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00190 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00191 ;; --------------------------------------------------------------------------
5184 00192 TIA_MIDI_PitchBender
               00193         SET_BSR TIA_BASE
5184 0101          M         movlb   HIGH(reg)
5186 3404      00194     rlf MIOS_PARAMETER2, W
5188 0BFE      00195         andlw   0xfe
518A 0A80      00196         xorlw   0x80
518C 6E04      00197     movwf   MIOS_PARAMETER2
               00198     
518E 5003      00199         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
5190 0B0F      00200         andlw   0x0f
5192 00201 TIA_MIDI_PitchBender_v1
5192 6320      00202         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
               00203         rgoto TIA_MIDI_PitchBender_v2
5194 D003          M         bra     label
5196 5004      00204     movf    MIOS_PARAMETER2, W
5198 6F2B      00205         movwf   TIA_V1_BASE + TIA_Vx_PITCHBENDER, BANKED
               00206     rgoto   TIA_MIDI_PitchBender_End
519A D004          M         bra     label
               00207     
519C 00208 TIA_MIDI_PitchBender_v2
519C 6360      00209         cpfseq  TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
               00210         rgoto TIA_MIDI_PitchBender_End
519E D002          M         bra     label
51A0 5004      00211     movf    MIOS_PARAMETER2, W
51A2 6F6B      00212         movwf   TIA_V2_BASE + TIA_Vx_PITCHBENDER, BANKED
51A4 00213 TIA_MIDI_PitchBender_End
51A4 0012      00214         return
               00215 
               00216 ;; --------------------------------------------------------------------------
               00217 ;;  This function is rcalled to forward a Controller event to the synthesizer
               00218 ;;  Input:
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 166


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00219 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00220 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00221 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00222 ;; --------------------------------------------------------------------------
51A6 00223 TIA_MIDI_CC
               00224         SET_BSR TIA_BASE
51A6 0101          M         movlb   HIGH(reg)
               00225 
               00226         ;; special treatment for CC#0 (bank change)
51A8 5004      00227         movf    MIOS_PARAMETER2, W
51AA E11A      00228         bnz     TIA_MIDI_CC_No00
51AC 00229 TIA_MIDI_CC_00
               00230         ;; exit if bank number >= DEFAULT_BS_KBANK_ID*4
51AC 0E14      00231     movlw   DEFAULT_BS_KBANK_ID*4
51AE 6005      00232     cpfslt  MIOS_PARAMETER3
51B0 0012      00233     return
               00234 
51B2 5003      00235     movf        MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
51B4 0B0F      00236         andlw   0x0f
51B6 6320      00237         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
51B8 0012      00238         return
               00239     
51BA C005 F014 00240         movff   MIOS_PARAMETER3, TIA_PBANK
               00241 
               00242     ;; Int.Patch if ==0
51BE 5013      00243     movf    TIA_PATCH, W
51C0 E00C      00244     bz      TIA_MIDI_CC_00_Ok
               00245     
               00246     ;; Banstick Ready
51C2 5014      00247     movf    TIA_PBANK, W
51C4 ECBE F01E 00248     call    TIA_BANK_GetBankStickReady
51C8 B4D8      00249         skpnz
51CA 6A13      00250     clrf    TIA_PATCH   ;; to Int. Patch if BS not ready
               00251      
               00252     ;; Banstick Size
51CC ECCB F01E 00253     call    TIA_BANK_GetBankStickSize
51D0 E104      00254     bnz     TIA_MIDI_CC_00_Ok
               00255     ;; 64/128 patches
51D2 5013      00256     movf    TIA_PATCH, W
51D4 0BC0      00257     andlw   0xc0
51D6 A4D8      00258     skpz
51D8 6A13      00259     clrf    TIA_PATCH   ;; to Int. Patch if >63
               00260     
51DA 00261 TIA_MIDI_CC_00_Ok
51DA ECAD F01D 00262         call    TIA_PATCH_Init
               00263         ;;goto  USER_DISPLAY_Init
51DE 00264 TIA_MIDI_CC_00_End
51DE 0012      00265     return
               00266 
               00267 
51E0 00268 TIA_MIDI_CC_No00
51E0 5003      00269         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
51E2 0B0F      00270         andlw   0x0f
51E4 6320      00271         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 167


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
51E6 0012      00272         return
               00273 
               00274         ;; forward CC to CCIN_Set routine
51E8 C005 F003 00275         movff   MIOS_PARAMETER3, MIOS_PARAMETER1
51EC 5004      00276         movf    MIOS_PARAMETER2, W
51EE ECD9 F02D 00277         call    TIA_CCIN_Set
               00278 
51F2 0012      00279         return
               00280 
               00281 
               00282 ;; --------------------------------------------------------------------------
               00283 ;;  This function is rcalled to forward a Program Change event to the synthesizer
               00284 ;;  Input:
               00285 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00286 ;;     o second  MIDI event byte in MIOS_PARAMETER2
               00287 ;; --------------------------------------------------------------------------
51F4 00288 TIA_MIDI_ProgramChange
               00289         SET_BSR TIA_BASE
51F4 0101          M         movlb   HIGH(reg)
               00290 
51F6 5003      00291         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
51F8 0B0F      00292         andlw   0x0f
51FA 6320      00293         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
51FC 0012      00294         return
               00295     
               00296     ;; Int.Patch if ==0 
51FE 5004      00297     movf    MIOS_PARAMETER2, W
5200 E00A      00298     bz      TIA_MIDI_ProgramChange_Ok
               00299     
               00300     ;; Banstick Ready
5202 5014      00301     movf    TIA_PBANK, W
5204 ECBE F01E 00302     call    TIA_BANK_GetBankStickReady
5208 B4D8      00303         skpnz
520A 6A04      00304     clrf    MIOS_PARAMETER2
               00305      
               00306     ;; Banstick Size
520C ECCB F01E 00307     call    TIA_BANK_GetBankStickSize
5210 E102      00308     bnz     TIA_MIDI_ProgramChange_Ok
               00309     ;; 64/128 patches
5212 BC04      00310     btfsc       MIOS_PARAMETER2, 6
               00311     rgoto   TIA_MIDI_ProgramChange_End   
5214 D004          M         bra     label
               00312     
5216 00313 TIA_MIDI_ProgramChange_Ok
5216 C004 F013 00314         movff   MIOS_PARAMETER2, TIA_PATCH
521A ECAD F01D 00315         call    TIA_PATCH_Init
               00316         ;;goto  USER_DISPLAY_Init
521E 00317 TIA_MIDI_ProgramChange_End
521E 0012      00318     return
               00319 
               00320 ;; --------------------------------------------------------------------------
               00321 ;;  This function is rcalled to forward a Poly Aftertouch event to the synthesizer
               00322 ;;  Input:
               00323 ;;     o first  MIDI event byte in MIOS_PARAMETER1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 168


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00324 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00325 ;; --------------------------------------------------------------------------
5220 00326 TIA_MIDI_PolyAfterTouch
5220 C004 F005 00327         movff   MIOS_PARAMETER2, MIOS_PARAMETER3
               00328         rgoto   TIA_MIDI_AfterTouch
5224 D000          M         bra     label
               00329 
               00330 ;; --------------------------------------------------------------------------
               00331 ;;  This function is rcalled to forward a Aftertouch event to the synthesizer
               00332 ;;  Input:
               00333 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00334 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00335 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00336 ;; --------------------------------------------------------------------------
5226 00337 TIA_MIDI_AfterTouch
               00338         SET_BSR TIA_BASE
5226 0101          M         movlb   HIGH(reg)
               00339 
5228 5003      00340         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
522A 0B0F      00341         andlw   0x0f
522C 6320      00342         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
522E 0012      00343         return
               00344 
5230 5005      00345         movf    MIOS_PARAMETER3, W
5232 00346 _TIA_MIDI_AfterTouch
5232 6E03      00347         movwf   MIOS_PARAMETER1
               00348         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
5234 0101          M         movlb   HIGH(reg)
5236 EE11 F0E8 00349         lfsr    FSR1, TIA_CTRL_AFTERTOUCH_BASE; prepare FSR1
523A EF9D F02E 00350         goto    TIA_CCIN_Cmd_AFTERTOUCH ; set aftertouch value
               00351 
               00352 
               00353 ;; --------------------------------------------------------------------------
               00354 ;;  help routines
               00355 ;; --------------------------------------------------------------------------
               00356 
               00357         ;; ------------------------------------------------------------------
               00358         ;; Push a note into the stack
               00359         ;; ------------------------------------------------------------------
523E 00360 TIA_MIDI_Hlp_PushNote
523E 6A06      00361         clrf    TMP1
               00362         ;; do nothing if note is already stored in note stack
5240 00363 TIA_MIDI_Hlp_PushNote_CheckLoop
5240 5006      00364         movf    TMP1, W
5242 50E3      00365         movf    PLUSW1, W
5244 1804      00366         xorwf   MIOS_PARAMETER2, W
5246 B4D8      00367         skpnz
               00368         rgoto   TIA_MIDI_Hlp_PushNote_Failed       ; leave note routine if note already stored
5248 D012          M         bra     label
524A 2A06      00369         incf    TMP1, F
524C 0E04      00370         movlw   TIA_NOTE_STACK_LEN
524E 6206      00371         cpfseq  TMP1, ACCESS
               00372         rgoto TIA_MIDI_Hlp_PushNote_CheckLoop
5250 D7F7          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 169


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00373         
               00374         ;; shift right note stack 
5252 0E02      00375         movlw   (TIA_NOTE_STACK_LEN-2)
5254 6E06      00376         movwf   TMP1
5256 00377 TIA_MIDI_Hlp_PushNote_ShiftLoop
5256 5006      00378         movf    TMP1, W
5258 CFE3 F007 00379         movff   PLUSW1, TMP2
525C 2806      00380         incf    TMP1, W
525E C007 FFE3 00381         movff   TMP2, PLUSW1
5262 0606      00382         decf    TMP1, F
5264 2806      00383         incf    TMP1, W
5266 E1F7      00384         bnz     TIA_MIDI_Hlp_PushNote_ShiftLoop
               00385 
               00386         ;; store new note at offset 0
5268 C004 FFE7 00387         movff   MIOS_PARAMETER2, INDF1
               00388 
526C 0C00      00389         retlw   0x00            ; return 0x00 as error status
               00390 
526E 00391 TIA_MIDI_Hlp_PushNote_Failed
526E 0C01      00392         retlw   0x01            ; return 0x01 as error status
               00393 
               00394         ;; ------------------------------------------------------------------
               00395 
               00396         ;; ------------------------------------------------------------------
               00397         ;; Pop a note from the stack
               00398         ;; ------------------------------------------------------------------
5270 00399 TIA_MIDI_Hlp_PopNote
               00400         ; search for note entry with the same number, erase it and push the entries behind
5270 6A06      00401         clrf    TMP1
5272 00402 TIA_MIDI_Hlp_PopNote_SearchLoop
5272 5006      00403         movf    TMP1, W
5274 50E3      00404         movf    PLUSW1, W
5276 1804      00405         xorwf   MIOS_PARAMETER2, W
5278 E005      00406         bz      TIA_MIDI_Hlp_PopNote_Found
527A 2A06      00407         incf    TMP1, F
527C 0E04      00408         movlw   TIA_NOTE_STACK_LEN
527E 6206      00409         cpfseq  TMP1, ACCESS
               00410         rgoto TIA_MIDI_Hlp_PopNote_SearchLoop
5280 D7F8          M         bra     label
               00411         rgoto   TIA_MIDI_Hlp_PopNote_Failed
5282 D00D          M         bra     label
5284 00412 TIA_MIDI_Hlp_PopNote_Found
               00413 
               00414         ;; push the entries behind the found entry
5284 00415 TIA_MIDI_Hlp_PopNote_ShiftLoop
5284 2806      00416         incf    TMP1, W
5286 CFE3 F007 00417         movff   PLUSW1, TMP2
528A 5006      00418         movf    TMP1, W
528C C007 FFE3 00419         movff   TMP2, PLUSW1
5290 2A06      00420         incf    TMP1, F
5292 0E04      00421         movlw   TIA_NOTE_STACK_LEN
5294 6206      00422         cpfseq  TMP1, ACCESS
               00423         rgoto TIA_MIDI_Hlp_PopNote_ShiftLoop
5296 D7F6          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 170


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00424         ;; clear the last entry
5298 0E03      00425         movlw   TIA_NOTE_STACK_LEN-1
529A 6AE3      00426         clrf    PLUSW1
529C 0C00      00427         retlw   0x00            ; return with 0x00: note deleted from stack
               00428 
529E 00429 TIA_MIDI_Hlp_PopNote_Failed
529E 0C01      00430         retlw   0x01            ; return with 0x01: note not found in stack
               00431 
               00432         ;; ------------------------------------------------------------------
               00433 
               00434         ;; ------------------------------------------------------------------
               00435         ;; Note On help function
               00436         ;; ------------------------------------------------------------------
52A0 00437 TIA_MIDI_Hlp_NoteOn
               00438 ;   BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED, TIA_MIDI_Hlp_NoteOn_NoNewNote
52A0 00439 TIA_MIDI_Hlp_NoteOn_NewNote
52A0 0E10      00440         movlw   TIA_Vx_NOTE
52A2 CFEB FFF5 00441         movff   PLUSW0, TABLAT
52A6 CFE7 FFEB 00442         movff   INDF1, PLUSW0
52AA 00443 TIA_MIDI_Hlp_NoteOn_NoNewNote
               00444 
               00445         ;; if sus-key enabled, skip enable portamento when only one key pressed
               00446 ;       BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED, TIA_MIDI_Hlp_NoteOn_SusKeyPor
               00447 
               00448         ;; special case: don't disable portamento on a note off event
               00449 ;       movf    MIOS_PARAMETER3, W
               00450 ;       bz      TIA_MIDI_Hlp_NoteOn_SusKeySkip
               00451 
               00452 ;       movlw   TIA_Vx_STAT
               00453 ;       bcf     PLUSW0, Vx_STAT_PORTA_ENABLE
               00454 
               00455 ;       movlw   0x01
               00456 ;       movf    PLUSW1, W
               00457 ;       bz      TIA_MIDI_Hlp_NoteOn_SusKeyNoPor
               00458 
52AA 00459 TIA_MIDI_Hlp_NoteOn_SusKeyPor
               00460         ;BRA_IFSET TIA_SE_OPTION, SE_OPTION_ENV2PORTA, BANKED, TIA_MIDI_Hlp_NoteOn_SusKeyPor_NC
               00461         ;; enable portamento if rate is > 0
               00462 
52AA 0E0E      00463     movlw       TIA_Vx_PORTA_RATE
52AC 50EB      00464     movf        PLUSW0, W
52AE E012      00465     bz  TIA_MIDI_Hlp_NoteOn_SusKeyNoPor
52B0 00466 TIA_MIDI_Hlp_NoteOn_SusKeyPor_NC
52B0 0E03      00467         movlw   TIA_Vx_STAT
52B2 88EB      00468         bsf     PLUSW0, Vx_STAT_PORTA_ENABLE
               00469 
               00470         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
               00471 
52B4 0E09      00472         movlw   TIA_Vx_FRQ_L
52B6 CFEB F006 00473         movff   PLUSW0, TMP1
52BA 0E0A      00474         movlw   TIA_Vx_FRQ_H
52BC CFEB F007 00475         movff   PLUSW0, TMP2    
               00476 
52C0 0E1C      00477         movlw   TIA_Vx_PORTA_FRQ_L
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 171


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
52C2 C006 FFEB 00478         movff   TMP1, PLUSW0
52C6 0E1D      00479         movlw   TIA_Vx_PORTA_FRQ_H
52C8 C007 FFEB 00480         movff   TMP2, PLUSW0   
               00481     
52CC 0E1A      00482     movlw   TIA_Vx_PORTA_CTR_L 
52CE 6AEB      00483         clrf    PLUSW0
52D0 0E1B      00484     movlw   TIA_Vx_PORTA_CTR_H 
52D2 6AEB      00485         clrf    PLUSW0
               00486 
               00487         ;; reset Porta counter if constant time flag enabled
               00488         ;movlw  TIA_Vx_MODE
               00489         ;CALL_IFSET PLUSW0, Vx_MODE_PORTA_CONST, ACCESS, TIA_SW_Hlp_PortaCTR_Reset
               00490 
52D4 00491 TIA_MIDI_Hlp_NoteOn_SusKeyNoPor
               00492 ;TIA_MIDI_Hlp_NoteOn_SusKeySkip
               00493 
               00494         ;; always re-init arpeggiator (in mono as well as in legato mode)
52D4 0E15      00495         movlw   TIA_Vx_ARP_CTR
52D6 6AEB      00496         clrf    PLUSW0
52D8 0E14      00497         movlw   TIA_Vx_ARP_NOTE_NUMBER
52DA 6AEB      00498         clrf    PLUSW0          ; (next increment will play the second note)
               00499 
               00500         ;; skip the rest if legato mode and current note is first note
               00501 ;       BRA_IFSET TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED, TIA_MIDI_Hlp_NoteOn_TrgGateNL
               00502 ;       movf    MIOS_PARAMETER2, W
               00503 ;       cpfseq  INDF1, ACCESS
               00504 ;       rgoto TIA_MIDI_Hlp_NoteOn_TrgGateLSkp
               00505 ;       movlw   0x01
               00506 ;       movf    PLUSW1, W
               00507 ;       bnz     TIA_MIDI_Hlp_NoteOn_TrgGateLSkp
               00508 ;TIA_MIDI_Hlp_NoteOn_TrgGateNL
               00509 
               00510         ;; request gate bit
52DC D81C      00511         rcall   TIA_MIDI_Hlp_GateOn
               00512 
               00513 
               00514         ;; ---[ END handle velocity ]---
               00515     
               00516         ;; ---[ BEGIN handle velocity ]---
               00517     
52DE C003 F006 00518         movff   MIOS_PARAMETER1, TMP1   ; store MIOS_PARAMETER1
52E2 C004 F007 00519         movff   MIOS_PARAMETER2, TMP2   ; store MIOS_PARAMETER2
52E6 5005      00520         movf    MIOS_PARAMETER3, W      ; copy velocity value to MIOS_PARAMETER1
52E8 E00D      00521         bz      TIA_MIDI_Hlp_NoteOn_NoVel; no velocity on note off!
52EA 6E03      00522     movwf   MIOS_PARAMETER1
52EC 0E28      00523     movlw   TIA_Vx_LAST_VELOCITY 
52EE C005 FFEB 00524         movff   MIOS_PARAMETER3, PLUSW0   
               00525         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
52F2 0101          M         movlb   HIGH(reg)
52F4 EE10 F000 00526         lfsr    FSR1, FSR0
52F8 EC2E F02E 00527         call    TIA_CCIN_Cmd_VELOCITY_SkpCopy   ; set velocity value
52FC C006 F003 00528         movff   TMP1, MIOS_PARAMETER1   ; restore MIOS_PARAMETER1
5300 C007 F004 00529         movff   TMP2, MIOS_PARAMETER2   ; restore MIOS_PARAMETER2
               00530         ;; ---[ END handle velocity ]---
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 172


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00531 
               00532 
               00533 
5304 00534 TIA_MIDI_Hlp_NoteOn_NoVel
               00535 
5304 00536 TIA_MIDI_Hlp_NoteOn_TrgGateLSkp
5304 0012      00537         return
               00538 
               00539 
               00540         ;; ------------------------------------------------------------------
               00541         ;; Note Off help function
               00542         ;; ------------------------------------------------------------------
5306 00543 TIA_MIDI_Hlp_NoteOff
               00544         ;; last note number of #0 (before pop) in WREG!
               00545 
               00546         ;; if not in legato mode and current note-off number equal to last entry #0: gate off
               00547 ;       BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED, TIA_MIDI_Hlp_NoteOff_NoGOff
5306 6204      00548         cpfseq  MIOS_PARAMETER2, ACCESS
               00549         rgoto TIA_MIDI_Hlp_NoteOff_End
5308 D005          M         bra     label
530A D812      00550         rcall   TIA_MIDI_Hlp_GateOff
530C 00551 TIA_MIDI_Hlp_NoteOff_NoGOff
               00552         ;; ------------------------------------------------------------------
               00553 
               00554         ;; if still note available, play new note in NoteOn Section
530C 50E7      00555         movf    INDF1, W
530E A4D8      00556         skpz
5310 0C01      00557         retlw   0x01            ; return, request Note On!
               00558 
               00559         ;; else request gate clear bit
5312 D80E      00560         rcall   TIA_MIDI_Hlp_GateOff
5314 00561 TIA_MIDI_Hlp_NoteOff_End
5314 0C00      00562         retlw   0x00            ; return, request NO Note On!
               00563 
               00564         ;; ------------------------------------------------------------------
               00565 
               00566         ;; ------------------------------------------------------------------
               00567         ;; Gate On help function
               00568         ;; ------------------------------------------------------------------
5316 00569 TIA_MIDI_Hlp_GateOn
5316 90D8      00570         clrc
5318 0E11      00571         movlw   TIA_Vx_NOTE_DELAY
531A 34EB      00572         rlf     PLUSW0, W
531C 6EF5      00573         movwf   TABLAT
531E 0E12      00574         movlw   TIA_Vx_NOTE_DELAY_CTR
5320 CFF5 FFEB 00575         movff   TABLAT, PLUSW0
               00576 
5324 0E03      00577         movlw   TIA_Vx_STAT
               00578         ;btfsc  TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
5326 82EB      00579         bsf     PLUSW0, Vx_STAT_GATE_SET_REQ
5328 80EB      00580         bsf     PLUSW0, Vx_STAT_VOICE_ACTIVE
               00581 
               00582         ;; reset wavetable handler (only voice 1 can do this!)
532A 50E9      00583         movf    FSR0L, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 173


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
532C 0A20      00584         xorlw   TIA_V1_BASE & 0xff
               00585         ;skpnz
               00586         ;bsf    TIA_WT_STATE, WT_STATE_RESET, BANKED
               00587 
532E 0012      00588         return
               00589 
               00590         ;; ------------------------------------------------------------------
               00591         ;; Gate Off help function
               00592         ;; ------------------------------------------------------------------
5330 00593 TIA_MIDI_Hlp_GateOff
5330 90D8      00594         clrc
5332 0E11      00595         movlw   TIA_Vx_NOTE_DELAY
5334 34EB      00596         rlf     PLUSW0, W
5336 6EF5      00597         movwf   TABLAT
5338 0E12      00598         movlw   TIA_Vx_NOTE_DELAY_CTR
533A CFF5 FFEB 00599         movff   TABLAT, PLUSW0
               00600 
533E 0E03      00601         movlw   TIA_Vx_STAT
5340 92EB      00602         bcf     PLUSW0, Vx_STAT_GATE_SET_REQ
5342 84EB      00603         bsf     PLUSW0, Vx_STAT_GATE_CLR_REQ
5344 90EB      00604         bcf     PLUSW0, Vx_STAT_VOICE_ACTIVE
5346 0012      00605         return
               00606 
               00607         ;; ------------------------------------------------------------------
               00608         ;; for Note On/Note Off in Mono mode
               00609         ;; MIDI channel in MIOS_PARAMETER1[0..3]
               00610         ;; result in TMP5
5348 00611 TIA_MIDI_GetAssignedChannels
5348 6A0A      00612         clrf    TMP5            ; TMP5 contains the voices which should be played
               00613         
534A 5003      00614         movf    MIOS_PARAMETER1, W
534C 0B0F      00615         andlw   0x0f
534E 1920      00616         xorwf   TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, W, BANKED
5350 B4D8      00617         skpnz
5352 800A      00618         bsf     TMP5, 0         ; play voice 1
               00619 
5354 5003      00620         movf    MIOS_PARAMETER1, W
5356 0B0F      00621         andlw   0x0f
5358 1960      00622         xorwf   TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL, W, BANKED
535A B4D8      00623         skpnz
535C 820A      00624         bsf     TMP5, 1         ; play voice 2
               00625     
               00626    
535E 500A      00627     movf        TMP5, W
5360 0012      00628         return
               00629 
               00630         ;; ------------------------------------------------------------------
               00631         ;; for Note On/Off in Mono mode
               00632         ;; note number in MIOS_PARAMETER2
               00633         ;; result will be ANDed to TMP5 --- TIA_MIDI_GetAssignedChannels should be called before!
               00634 TIA_MIDI_GETASSIGNEDVOICEx MACRO FLAG_Vx, TIA_Vx_BASE
               00635         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00636         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00637         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_End
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 174


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00638 
               00639         ;; handle split points
               00640         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
               00641         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
               00642         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
               00643     
               00644         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
               00645         cpfslt  MIOS_PARAMETER2, ACCESS
               00646         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00647         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00648 
               00649 TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00650         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
               00651         cpfsgt  MIOS_PARAMETER2, ACCESS
               00652         rgoto TIA_MIDI_GETASSIGNEDVOICEx_End
               00653 TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00654         bcf     TMP5, FLAG_Vx           ; don't play voice
               00655 TIA_MIDI_GETASSIGNEDVOICEx_End
               00656         ENDM
               00657 
5362 00658 TIA_MIDI_GetAssignedVoices
               00659         TIA_MIDI_GETASSIGNEDVOICEx 0, TIA_V1_BASE
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOk
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOff
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_End
                   M 
                   M         ;; handle split points
5362 5121          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
5364 1122          M         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
5366 E008          M         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
                   M     
5368 5121          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
536A 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
536C D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
536E D003          M         bra     label
                   M 
5370     M TIA_MIDI_GETASSIGNEDVOICEx_LOk
5370 5122          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
5372 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_End
5374 D001          M         bra     label
5376     M TIA_MIDI_GETASSIGNEDVOICEx_LOff
5376 900A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
5378     M TIA_MIDI_GETASSIGNEDVOICEx_End
               00660         TIA_MIDI_GETASSIGNEDVOICEx 1, TIA_V2_BASE
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOk
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOff
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_End
                   M 
                   M         ;; handle split points
5378 5161          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
537A 1162          M         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 175


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
537C E008          M         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
                   M     
537E 5161          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
5380 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
5382 D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
5384 D003          M         bra     label
                   M 
5386     M TIA_MIDI_GETASSIGNEDVOICEx_LOk
5386 5162          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
5388 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_End
538A D001          M         bra     label
538C     M TIA_MIDI_GETASSIGNEDVOICEx_LOff
538C 920A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
538E     M TIA_MIDI_GETASSIGNEDVOICEx_End
538E 500A      00661     movf        TMP5, W
5390 0012      00662         return
               00663     
               00664         ;; ------------------------------------------------------------------
               00665         ;; for Note On/Off in Mono mode
               00666         ;; note number in MIOS_PARAMETER2
               00667         ;; result will be ANDed to TMP5 --- TIA_MIDI_GetAssignedChannels should be called before!
               00668 TIA_MIDI_GETASSIGNEDKEYx MACRO FLAG_Vx, TIA_Vx_BASE
               00669         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOk
               00670         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOff
               00671         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_End
               00672 
               00673     btfsc   TIA_Vx_BASE + TIA_Vx_MODE, Vx_MODE_KEY_EXTENDED, BANKED
               00674     rgoto   TIA_MIDI_GETASSIGNEDKEYx_End
               00675     
               00676         movf    TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
               00677         cpfslt  MIOS_PARAMETER2, ACCESS
               00678         rgoto TIA_MIDI_GETASSIGNEDKEYx_LOk
               00679         rgoto   TIA_MIDI_GETASSIGNEDKEYx_LOff
               00680 
               00681 TIA_MIDI_GETASSIGNEDKEYx_LOk
               00682     movlw   0x1f
               00683     cpfsgt  TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, BANKED
               00684     movf    TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, W, BANKED
               00685         addwf   TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
               00686         cpfsgt  MIOS_PARAMETER2, ACCESS
               00687         rgoto TIA_MIDI_GETASSIGNEDKEYx_End
               00688 TIA_MIDI_GETASSIGNEDKEYx_LOff
               00689         bcf     TMP5, FLAG_Vx           ; don't play voice
               00690 TIA_MIDI_GETASSIGNEDKEYx_End
               00691         ENDM
               00692 
5392 00693 TIA_MIDI_GetAssignedKeys
               00694         TIA_MIDI_GETASSIGNEDKEYx 0, TIA_V1_BASE
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOk
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOff
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_End
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 176


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M 
5392 B524          M     btfsc   TIA_Vx_BASE + TIA_Vx_MODE, Vx_MODE_KEY_EXTENDED, BANKED
                   M     rgoto   TIA_MIDI_GETASSIGNEDKEYx_End
5394 D00B          M         bra     label
                   M     
5396 5125          M         movf    TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
5398 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_LOk
539A D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDKEYx_LOff
539C D006          M         bra     label
                   M 
539E     M TIA_MIDI_GETASSIGNEDKEYx_LOk
539E 0E1F          M     movlw   0x1f
53A0 6526          M     cpfsgt  TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, BANKED
53A2 5126          M     movf    TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, W, BANKED
53A4 2525          M         addwf   TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
53A6 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_End
53A8 D001          M         bra     label
53AA     M TIA_MIDI_GETASSIGNEDKEYx_LOff
53AA 900A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
53AC     M TIA_MIDI_GETASSIGNEDKEYx_End
               00695         TIA_MIDI_GETASSIGNEDKEYx 1, TIA_V2_BASE
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOk
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOff
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_End
                   M 
53AC B564          M     btfsc   TIA_Vx_BASE + TIA_Vx_MODE, Vx_MODE_KEY_EXTENDED, BANKED
                   M     rgoto   TIA_MIDI_GETASSIGNEDKEYx_End
53AE D00B          M         bra     label
                   M     
53B0 5165          M         movf    TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
53B2 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_LOk
53B4 D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDKEYx_LOff
53B6 D006          M         bra     label
                   M 
53B8     M TIA_MIDI_GETASSIGNEDKEYx_LOk
53B8 0E1F          M     movlw   0x1f
53BA 6566          M     cpfsgt  TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, BANKED
53BC 5166          M     movf    TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, W, BANKED
53BE 2565          M         addwf   TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
53C0 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_End
53C2 D001          M         bra     label
53C4     M TIA_MIDI_GETASSIGNEDKEYx_LOff
53C4 920A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
53C6     M TIA_MIDI_GETASSIGNEDKEYx_End
53C6 500A      00696     movf        TMP5, W
53C8 0012      00697         return    
               00698 
               00699     
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 177


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00700         ;; ------------------------------------------------------------------
               00701         ;; arpeggiator sorter
               00702         ;; expecting base pointer to voice record in FSR2
53CA 00703 TIA_MIDI_Arp_Sorter
               00704         ;; TIA_Vx_ARP_NOTE_0 -> FSR0
53CA CFDA FFEA 00705         movff   FSR2H, FSR0H
53CE 50D9      00706         movf    FSR2L, W
53D0 0F1E      00707         addlw   TIA_Vx_ARP_NOTE_0
53D2 6EE9      00708         movwf   FSR0L
               00709 
               00710         ;; TIA_Vx_NOTE_STACK_0 -> FSR1
53D4 CFDA FFE2 00711         movff   FSR2H, FSR1H
53D8 50D9      00712         movf    FSR2L, W
53DA 0F22      00713         addlw   TIA_Vx_NOTE_STACK_0
53DC 6EE1      00714         movwf   FSR1L
               00715 
53DE CFE9 F006 00716         movff   FSR0L, TMP1     ; save pointer to ARP_NOTE_0 in TMP1
               00717         ;; clear all current entries
53E2 6AEE      00718         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_0)
53E4 6AEE      00719         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_1)
53E6 6AEE      00720         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_2)
53E8 6AEE      00721         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_3)
53EA C006 FFE9 00722         movff   TMP1, FSR0L     ; restore pointer to ARP_NOTE_0 from TMP1
               00723 
53EE 50E7      00724         movf    INDF1, W        ; (TIA_Vx_NOTE_STACK_0)
53F0 E017      00725         bz      TIA_MIDI_Arp_Sorter_End
               00726 
53F2 50E6      00727         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_0)
53F4 D816      00728         rcall   TIA_MIDI_ARP_Sorter_Add
53F6 50E6      00729         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_1)
53F8 D814      00730         rcall   TIA_MIDI_ARP_Sorter_Add
53FA 50E6      00731         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_2)
53FC D812      00732         rcall   TIA_MIDI_ARP_Sorter_Add
53FE 50E6      00733         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_3)
5400 D810      00734         rcall   TIA_MIDI_ARP_Sorter_Add
               00735 
               00736         ;; if rate is > 0, and arp has been reset: copy first arp note into TIA_Vx_NOTE
5402 0E13      00737         movlw   TIA_Vx_ARP_RATE
5404 50DB      00738         movf    PLUSW2, W
5406 E00C      00739         bz      TIA_MIDI_Arp_Sorter_End
5408 0E15      00740         movlw   TIA_Vx_ARP_CTR
540A 50DB      00741         movf    PLUSW2, W
540C E109      00742         bnz     TIA_MIDI_Arp_Sorter_End
540E 0E14      00743         movlw   TIA_Vx_ARP_NOTE_NUMBER
5410 50DB      00744         movf    PLUSW2, W
5412 E106      00745         bnz     TIA_MIDI_Arp_Sorter_End
               00746 
5414 0E1E      00747         movlw   TIA_Vx_ARP_NOTE_0
5416 CFDB FFF5 00748         movff   PLUSW2, TABLAT
541A 0E10      00749         movlw   TIA_Vx_NOTE
541C CFF5 FFDB 00750         movff   TABLAT, PLUSW2
               00751 
5420 00752 TIA_MIDI_Arp_Sorter_End
5420 0012      00753         return
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 178


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00754 
               00755 ;; ---
               00756         ;; add to ARP note buffer, sort automatically from lowest to highest note
5422 00757 TIA_MIDI_ARP_Sorter_Add
5422 B4D8      00758         skpnz                   ; only add notes > 0
5424 0012      00759         return
               00760 
5426 6E06      00761         movwf   TMP1            ; store new note number in TMP2
5428 6A07      00762         clrf    TMP2            ; TMP2 used as loop counter
542A 00763 TIA_MIDI_ARP_Sorter_Loop
542A 5007      00764         movf    TMP2, W
542C 50EB      00765         movf    PLUSW0, W
542E E006      00766         bz      TIA_MIDI_ARP_Sorter_Push; the fourth note will ever be pushed as the appr. byte is zero
5430 5C06      00767         subwf   TMP1, W
5432 E304      00768         bnc     TIA_MIDI_ARP_Sorter_Push
5434 2A07      00769         incf    TMP2, F
               00770         BRA_IFCLR TMP2, 2, ACCESS, TIA_MIDI_ARP_Sorter_Loop
5436 A407          M         btfss   reg, bit, reg_a
5438 D7F8          M         bra     label
543A 0012      00771         return                  ; this case never happens
               00772 
543C 00773 TIA_MIDI_ARP_Sorter_Push
543C 5007      00774         movf    TMP2, W         ; fourth note: no shift required
543E 0A03      00775         xorlw   0x03
5440 E00D      00776         bz      TIA_MIDI_ARP_Sorter_PushN
5442 0E02      00777         movlw   0x02
5444 6E08      00778         movwf   TMP3
5446 00779 TIA_MIDI_ARP_Sorter_PushL
5446 5008      00780         movf    TMP3, W
5448 CFEB F009 00781         movff   PLUSW0, TMP4
544C 0F01      00782         addlw   1
544E C009 FFEB 00783         movff   TMP4, PLUSW0
5452 5007      00784         movf    TMP2, W
5454 1808      00785         xorwf   TMP3, W
5456 E002      00786         bz      TIA_MIDI_ARP_Sorter_PushN
5458 0608      00787         decf    TMP3, F
               00788         rgoto   TIA_MIDI_ARP_Sorter_PushL
545A D7F5          M         bra     label
               00789 
545C 00790 TIA_MIDI_ARP_Sorter_PushN
545C 5007      00791         movf    TMP2, W
545E C006 FFEB 00792         movff   TMP1, PLUSW0
5462 0012      00793         return
               00387 #include "tia_sysex.inc"
               00001 ; $Id: tia_sysex.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA SysEx Parser
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 179


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00011 ; ==========================================================================
               00012 
  00000007     00013 TIA_SYSEX_STATE_MYSYSEX         EQU     7
  00000006     00014 TIA_SYSEX_STATE_ACTION          EQU     6
               00015 
  00000005     00016 TIA_SYSEX_STATE_PRESET_RECEIVED EQU     5       ; used by Action PATCH_[Read/Write]
  00000004     00017 TIA_SYSEX_STATE_BANK_RECEIVED   EQU     4       ; used by Action PATCH_[Read/Write]
  00000003     00018 TIA_SYSEX_STATE_TYPE_RECEIVED   EQU     3       ; used by Action PATCH_[Read/Write]
  00000002     00019 TIA_SYSEX_STATE_WAIT_CHECKSUM   EQU     2       ; used by Action PATCH_Write
               00020 
  00000005     00021 TIA_SYSEX_STATE_AH_RECEIVED     EQU     5       ; used by Action PAR_[Read/Write]
  00000004     00022 TIA_SYSEX_STATE_AL_RECEIVED     EQU     4       ; used by Action PAR_[Read/Write]
  00000003     00023 TIA_SYSEX_STATE_D_RECEIVED      EQU     3       ; used by Action PAR_[Write]
               00024 
  00000005     00025 TIA_SYSEX_STATE_A_RECEIVED      EQU     5       ; used by Action CFG_[Read/Write]
  00000004     00026 TIA_SYSEX_STATE_DH_RECEIVED     EQU     4       ; used by Action CFG_[Read/Write]
  00000003     00027 TIA_SYSEX_STATE_DL_RECEIVED     EQU     3       ; used by Action CFG_[Read/Write]
               00028 
               00029 ;; --------------------------------------------------------------------------
               00030 ;;  This sysex parser waits for the TIA Header 
               00031 ;; --------------------------------------------------------------------------
5464 00032 TIA_SYSEX_SysExCheck
               00033         ;; store received byte in TIA_SYSEX_IN
5464 6E23      00034         movwf   TIA_SYSEX_IN
               00035 
               00036         ;; ignore realtime messages
5466 0EF8      00037         movlw   0xf8
5468 6023      00038         cpfslt  TIA_SYSEX_IN, ACCESS
546A 0012      00039         return
               00040 
               00041         ;; check sysex state
               00042         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_MYSYSEX, ACCESS, TIA_SYSEX_Handler
546C BE21          M         btfsc   reg, bit, reg_a
546E D026          M         bra     label
               00043 
5470 5021      00044         movf    TIA_SYSEX_STATE, W
5472 D80E      00045         rcall   TIA_SYSEX_SysExHeaderGet
5474 6223      00046         cpfseq  TIA_SYSEX_IN, ACCESS
               00047         rgoto TIA_SYSEX_SysExCheckFailed
5476 D00A          M         bra     label
5478 2A21      00048         incf    TIA_SYSEX_STATE, F
547A 5021      00049         movf    TIA_SYSEX_STATE, W
547C 0B07      00050         andlw   0x07
547E 0A06      00051         xorlw   0x06    ; wait for 6 bytes (f0 00 00 7E 46 <device-id>)
5480 E106      00052         bnz     TIA_SYSEX_SysExCheckOk
               00053 
               00054         ;; SysEx ID received, lets go
5482 0E80      00055         movlw   (1 << TIA_SYSEX_STATE_MYSYSEX)
5484 6E21      00056         movwf   TIA_SYSEX_STATE
5486 EC28 F016 00057         call    MIOS_MPROC_MergerDisable
               00058         rgoto   TIA_SYSEX_SysExCheckOk
548A D001          M         bra     label
               00059 
548C 00060 TIA_SYSEX_SysExCheckFailed
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 180


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00061         ;; reset the sysex counter and action ID
548C D80B      00062         rcall   TIA_SYSEX_ActionInvalid
548E 00063 TIA_SYSEX_SysExCheckOk
               00064 
548E 00065 TIA_SYSEX_SysExCheck_End
548E 0012      00066         return
               00067 
               00068 ; ==========================================================================
               00069 
               00070 ;; --------------------------------------------------------------------------
               00071 ;;  Returns expected MIDI bytes from SysEx header
               00072 ;; --------------------------------------------------------------------------
5490 00073 TIA_SYSEX_SysExHeaderGet
5490 0B07      00074         andlw   0x07
               00075         JUMPTABLE_2BYTES_UNSECURE
5492 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
5496 0CF0      00076         retlw   0xf0
5498 0C00      00077         retlw   0x00            ; Vendor ID
549A 0C00      00078         retlw   0x00
549C 0C7E      00079         retlw   0x7e
549E 0C51      00080         retlw   0x51            ; MIDIbox TIA ID (51 - the ultimative number + 4)
54A0 5020      00081         movf    TIA_MIDI_DEVICE, W
54A2 0012      00082         return
               00083 
               00084 ;; --------------------------------------------------------------------------
               00085 ;;  Action Invalid will be invoked when receiving an invalid sequence
               00086 ;; --------------------------------------------------------------------------
54A4 00087 TIA_SYSEX_ActionInvalid
               00088 
               00089 ;; --------------------------------------------------------------------------
               00090 ;;  Action finished will be invoked when midi action is done
               00091 ;; --------------------------------------------------------------------------
54A4 00092 TIA_SYSEX_ActionFinished
54A4 6A21      00093         clrf    TIA_SYSEX_STATE
54A6 6A22      00094         clrf    TIA_SYSEX_ACTION
               00095 #if DEFAULT_TIA_DEBUG_ON == 1 
54A8 8F64      00096     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_SYX
54AA ECC1 F01A 00097     call    TIA_Debug_EE_Do
54AE 8E5B      00098     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_SYX
54B0 EC61 F01B 00099     call    TIA_Debug_BS_Do
               00100 #endif
               00101         ;; reinit patch if engine has been disabled during upload
54B4 9010      00102         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00103         
54B6 EC2A F016 00104         call    MIOS_MPROC_MergerEnable
               00105         rgoto   TIA_SYSEX_SysExCheck_End
54BA D7E9          M         bra     label
               00106 
               00107 
               00108 ;; --------------------------------------------------------------------------
               00109 ;;  MIDI Check action: perform a sysex action
               00110 ;; --------------------------------------------------------------------------
54BC 00111 TIA_SYSEX_Handler
               00112         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_ACTION, ACCESS, TIA_SYSEX_Handler_DoAction
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 181


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
54BC BC21          M         btfsc   reg, bit, reg_a
54BE D005          M         bra     label
               00113 
54C0 8C21      00114         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_ACTION
               00115 
54C2 C023 F022 00116         movff   TIA_SYSEX_IN, TIA_SYSEX_ACTION  ; store action ID
54C6 D81A      00117         rcall   TIA_SYSEX_Handler_InitAction    ; initialize the action
               00118         rgoto   TIA_SYSEX_SysExCheck_End        ; branch to the end
54C8 D7E2          M         bra     label
               00119 
               00120         ;; ---
               00121 
54CA 00122 TIA_SYSEX_Handler_DoAction
               00123         ;; branch to end if status byte (i.e. F7)
               00124         BRA_IFSET TIA_SYSEX_IN, 7, ACCESS, TIA_SYSEX_Handler_EndAction
54CA BE23          M         btfsc   reg, bit, reg_a
54CC D02E          M         bra     label
               00125 
               00126         ;; branch depending on current action ID
54CE 5022      00127         movf    TIA_SYSEX_ACTION, W
               00128         JUMPTABLE_2BYTES 16     ; 16 entries
54D0 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
54D2 B0D8          M         skpnc
54D4 0EF0          M         movlw   -(max_value)
54D6 0F10          M         addlw   max_value
54D8 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00129         rgoto   TIA_SYSEX_ActionInvalid
54DC D7E3          M         bra     label
               00130         rgoto   TIA_SYSEX_Action_PRESET_Read
54DE D040          M         bra     label
               00131         rgoto   TIA_SYSEX_Action_PRESET_Write
54E0 D08D          M         bra     label
               00132         rgoto   TIA_SYSEX_Action_BANK_Read
54E2 D108          M         bra     label
               00133         rgoto   TIA_SYSEX_Action_BANK_WriteName
54E4 D169          M         bra     label
               00134         rgoto   TIA_SYSEX_Action_PAR_Read
54E6 D1B8          M         bra     label
               00135         rgoto   TIA_SYSEX_Action_PAR_Write
54E8 D1E8          M         bra     label
               00136         rgoto   TIA_SYSEX_ActionInvalid
54EA D7DC          M         bra     label
               00137         rgoto   TIA_SYSEX_ActionInvalid
54EC D7DB          M         bra     label
               00138         rgoto   TIA_SYSEX_ActionInvalid
54EE D7DA          M         bra     label
               00139         rgoto   TIA_SYSEX_ActionInvalid
54F0 D7D9          M         bra     label
               00140         rgoto   TIA_SYSEX_Action_BANK_Sel
54F2 D219          M         bra     label
               00141         rgoto   TIA_SYSEX_Action_CFG_Read
54F4 D231          M         bra     label
               00142         rgoto   TIA_SYSEX_Action_CFG_Write
54F6 D2B9          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 182


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00143         rgoto   TIA_SYSEX_Action_RequestCC
54F8 D2E9          M         bra     label
               00144         rgoto   TIA_SYSEX_Action_Ping
54FA D2EC          M         bra     label
               00145 
               00146 
               00147 ;; --------------------------------------------------------------------------
               00148 ;;  Initialize an action depending on TIA_SYSEX_ACTION
               00149 ;; --------------------------------------------------------------------------
54FC 00150 TIA_SYSEX_Handler_InitAction
54FC 5022      00151         movf    TIA_SYSEX_ACTION, W
               00152         JUMPTABLE_2BYTES 16     ; 16 entries
54FE 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
5500 B0D8          M         skpnc
5502 0EF0          M         movlw   -(max_value)
5504 0F10          M         addlw   max_value
5506 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00153         rgoto   TIA_SYSEX_ActionInvalid
550A D7CC          M         bra     label
               00154         rgoto   TIA_SYSEX_Init_PRESET_Read
550C D028          M         bra     label
               00155         rgoto   TIA_SYSEX_Init_PRESET_Write
550E D072          M         bra     label
               00156         rgoto   TIA_SYSEX_Init_BANK_Read
5510 D0ED          M         bra     label
               00157         rgoto   TIA_SYSEX_Init_BANK_WriteName
5512 D151          M         bra     label
               00158     rgoto       TIA_SYSEX_Init_PAR_Read
5514 D1A0          M         bra     label
               00159         rgoto   TIA_SYSEX_Init_PAR_Write
5516 D1D0          M         bra     label
               00160         rgoto   TIA_SYSEX_ActionInvalid
5518 D7C5          M         bra     label
               00161         rgoto   TIA_SYSEX_ActionInvalid
551A D7C4          M         bra     label
               00162         rgoto   TIA_SYSEX_ActionInvalid
551C D7C3          M         bra     label
               00163         rgoto   TIA_SYSEX_ActionInvalid
551E D7C2          M         bra     label
               00164         rgoto   TIA_SYSEX_Init_BANK_Sel
5520 D200          M         bra     label
               00165         rgoto   TIA_SYSEX_Init_CFG_Read
5522 D219          M         bra     label
               00166         rgoto   TIA_SYSEX_Init_CFG_Write
5524 D2A0          M         bra     label
               00167         rgoto   TIA_SYSEX_Init_RequestCC
5526 D2D1          M         bra     label
               00168         rgoto   TIA_SYSEX_Init_Ping
5528 D2D4          M         bra     label
               00169 
               00170         
               00171 ;; --------------------------------------------------------------------------
               00172 ;;  Finish an action depending on TIA_SYSEX_ACTION
               00173 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 183


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
552A 00174 TIA_SYSEX_Handler_EndAction
               00175         ;; if sysex footer (F7) has not been received here, action is invalid!
552A 0EF7      00176         movlw   0xf7
552C 1823      00177         xorwf   TIA_SYSEX_IN, W
552E E1BA      00178         bnz     TIA_SYSEX_ActionInvalid
               00179 
               00180         ;; else finish action
5530 5022      00181         movf    TIA_SYSEX_ACTION, W
               00182         JUMPTABLE_2BYTES 16     ; 16 entries
5532 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
5534 B0D8          M         skpnc
5536 0EF0          M         movlw   -(max_value)
5538 0F10          M         addlw   max_value
553A ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00183         rgoto   TIA_SYSEX_ActionInvalid
553E D7B2          M         bra     label
               00184         rgoto   TIA_SYSEX_End_PRESET_Read
5540 D022          M         bra     label
               00185         rgoto   TIA_SYSEX_End_PRESET_Write
5542 D083          M         bra     label
               00186         rgoto   TIA_SYSEX_End_BANK_Read
5544 D0E4          M         bra     label
               00187         rgoto   TIA_SYSEX_End_BANK_WriteName
5546 D151          M         bra     label
               00188         rgoto   TIA_SYSEX_End_PAR_Read
5548 D196          M         bra     label
               00189         rgoto   TIA_SYSEX_End_PAR_Write
554A D1CC          M         bra     label
               00190         rgoto   TIA_SYSEX_ActionInvalid
554C D7AB          M         bra     label
               00191         rgoto   TIA_SYSEX_ActionInvalid
554E D7AA          M         bra     label
               00192         rgoto   TIA_SYSEX_ActionInvalid
5550 D7A9          M         bra     label
               00193         rgoto   TIA_SYSEX_ActionInvalid
5552 D7A8          M         bra     label
               00194         rgoto   TIA_SYSEX_End_BANK_Sel
5554 D1EB          M         bra     label
               00195         rgoto   TIA_SYSEX_End_CFG_Read
5556 D207          M         bra     label
               00196         rgoto   TIA_SYSEX_End_CFG_Write
5558 D29C          M         bra     label
               00197         rgoto   TIA_SYSEX_End_RequestCC
555A D2B9          M         bra     label
               00198         rgoto   TIA_SYSEX_End_Ping
555C D2BC          M         bra     label
               00199 
               00200 ;; --------------------------------------------------------------------------
               00201 ;;  MIDI Action: Patch Read
               00202 ;; --------------------------------------------------------------------------
555E 00203 TIA_SYSEX_Init_PRESET_Read
555E 0012      00204         return
               00205 
5560 00206 TIA_SYSEX_Action_PRESET_Read
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 184


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00207         ;; receive <type> <bank> <patch> F7
5560 00208 TIA_SYSEX_Action_PRESET_Read_T
               00209         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_Read_B
5560 B621          M         btfsc   reg, bit, reg_a
5562 D004          M         bra     label
5564 8621      00210         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
5566 C023 F025 00211         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00212         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
556A D791          M         bra     label
               00213 
556C 00214 TIA_SYSEX_Action_PRESET_Read_B
               00215         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_Read_P
556C B821          M         btfsc   reg, bit, reg_a
556E D004          M         bra     label
5570 8821      00216         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED    
5572 C023 F011 00217         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00218         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5576 D78B          M         bra     label
               00219     
5578 00220 TIA_SYSEX_Action_PRESET_Read_P
               00221         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_ReadStall
5578 BA21          M         btfsc   reg, bit, reg_a
557A D004          M         bra     label
557C 8A21      00222         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
557E C023 F012 00223         movff   TIA_SYSEX_IN, TIA_PRESET                ; load preset
               00224         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5582 D785          M         bra     label
               00225                 
5584 00226 TIA_SYSEX_Action_PRESET_ReadStall
               00227         ;; do nothing until sysex footer (F7) has been received
               00228         rgoto   TIA_SYSEX_SysExCheck_End
5584 D784          M         bra     label
               00229 
5586 00230 TIA_SYSEX_End_PRESET_Read
               00231         ;; action invalid if patch number has not been received
               00232         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5586 AA21          M         btfss   reg, bit, reg_a
5588 D78D          M         bra     label
               00233 
558A C011 F007 00234     movff   TIA_BANK, TMP2  ;; store relative bank
558E 5025      00235     movf        TIA_SYSEX_ADDRESS, W
5590 DADD      00236     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank      ; set bank to absolute
5592 6E26      00237     movwf   TIA_SYSEX_ERROR
5594 E10F      00238     bnz     TIA_SYSEX_End_PRESET_Read_Cont
               00239     
5596 5012      00240     movf        TIA_PRESET, W
5598 E00D      00241     bz      TIA_SYSEX_End_PRESET_Read_Cont    
559A 5011      00242     movf    TIA_BANK, W
559C ECBE F01E 00243     call    TIA_BANK_GetBankStickReady
55A0 A4D8      00244     skpz
               00245         rgoto   TIA_SYSEX_End_PRESET_Read_Size
55A2 D003          M         bra     label
               00246     ;; BS not ready Error #3
55A4 0E03      00247     movlw   0x03
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 185


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
55A6 6E26      00248     movwf   TIA_SYSEX_ERROR
               00249     rgoto   TIA_SYSEX_End_PRESET_Read_Cont
55A8 D005          M         bra     label
55AA 00250 TIA_SYSEX_End_PRESET_Read_Size    
55AA ECCB F01E 00251     call    TIA_BANK_GetBankStickSize
55AE E102      00252     bnz     TIA_SYSEX_End_PRESET_Read_Cont
               00253 
55B0 BC12      00254     btfsc       TIA_PRESET, 6
55B2 6A12      00255         clrf    TIA_PRESET
               00256 
55B4 00257 TIA_SYSEX_End_PRESET_Read_Cont
               00258 
               00259         ;; send SysEx header
55B4 DA98      00260         rcall   TIA_SYSEX_Send_SysExHeader
               00261 
               00262         ;; Send PRESET_Read ID
55B6 0E01      00263         movlw   0x01
55B8 EC24 F016 00264         call    MIOS_MIDI_TxBufferPut
               00265 
               00266         ;; send requested preset type number
55BC 5025      00267     movf        TIA_SYSEX_ADDRESS, W
55BE 0B7F      00268     andlw   0x7f
55C0 EC24 F016 00269         call    MIOS_MIDI_TxBufferPut
               00270     
               00271         ;; send requested relative bank number
55C4 5007      00272         movf    TMP2, W
55C6 0B1F      00273     andlw   0x1f
55C8 EC24 F016 00274         call    MIOS_MIDI_TxBufferPut
               00275     
               00276         ;; send requested preset number
55CC 5012      00277         movf    TIA_PRESET, W
55CE 0B7F      00278     andlw   0x7f
55D0 EC24 F016 00279         call    MIOS_MIDI_TxBufferPut
               00280     
55D4 5026      00281     movf    TIA_SYSEX_ERROR, W
55D6 E004      00282     bz      TIA_SYSEX_End_PRESET_Read_Cont_Ok
55D8 0B7F      00283     andlw       0x7f
55DA EC24 F016 00284         call    MIOS_MIDI_TxBufferPut
               00285     rgoto   TIA_SYSEX_End_PRESET_Read_Footer
55DE D007          M         bra     label
               00286     
55E0 00287 TIA_SYSEX_End_PRESET_Read_Cont_Ok 
               00288         ;; clear checksum
55E0 6A24      00289         clrf    TIA_SYSEX_CHECKSUM
               00290 
               00291     ;movf       TIA_SYSEX_ADDRESS, W
               00292     ;rcall   TIA_SYSEX_Hlp_GetAbsoluteBank     ; set bank to absolute
               00293         ;; send patch (128 bytes)
55E2 DA9F      00294         rcall   TIA_SYSEX_Hlp_SendPreset        
               00295 
               00296         ;; send checksum
55E4 5024      00297         movf    TIA_SYSEX_CHECKSUM, W
55E6 0880      00298         sublw   0x80
55E8 0B7F      00299         andlw   0x7f
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 186


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
55EA EC24 F016 00300         call    MIOS_MIDI_TxBufferPut
               00301 
55EE 00302 TIA_SYSEX_End_PRESET_Read_Footer
               00303         ;; send of SysEx footer
55EE 0E01      00304         movlw   0x01            ; (independend from merger state)
55F0 DA8D      00305         rcall   TIA_SYSEX_Send_SysExFooter
               00306 
               00307         ;; finish Action
               00308         rgoto   TIA_SYSEX_ActionFinished
55F2 D758          M         bra     label
               00309 
               00310 ;; --------------------------------------------------------------------------
               00311 ;;  MIDI Action: Patch Write
               00312 ;; --------------------------------------------------------------------------
55F4 00313 TIA_SYSEX_Init_PRESET_Write
               00314         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
55F4 8010      00315         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
55F6 ECD6 F021 00316     call    TIA_TUNE_Note_Off
55FA 0012      00317         return
               00318 
55FC 00319 TIA_SYSEX_Action_PRESET_Write
               00320         ;; receive <type> <bank> <patch> <128 bytes> F7
55FC 00321 TIA_SYSEX_Action_PRESET_WriteT
               00322         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteB
55FC B621          M         btfsc   reg, bit, reg_a
55FE D004          M         bra     label
5600 8621      00323         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
5602 C023 F025 00324         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00325         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5606 D743          M         bra     label
               00326 
5608 00327 TIA_SYSEX_Action_PRESET_WriteB
               00328         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteP
5608 B821          M         btfsc   reg, bit, reg_a
560A D004          M         bra     label
560C 8821      00329         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
560E C023 F011 00330         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00331         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5612 D73D          M         bra     label
               00332     
5614 00333 TIA_SYSEX_Action_PRESET_WriteP
               00334         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteC
5614 BA21          M         btfsc   reg, bit, reg_a
5616 D007          M         bra     label
5618 8A21      00335         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
561A C023 F012 00336         movff   TIA_SYSEX_IN, TIA_PRESET                ; load preset 
               00337     
561E 6A24      00338         clrf    TIA_SYSEX_CHECKSUM              ; clear checksum
5620 6AA9      00339         clrf    EEADR                   ; clear address
5622 6A26      00340     clrf    TIA_SYSEX_ERROR      ; clear reply error
               00341         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5624 D734          M         bra     label
               00342         
5626 00343 TIA_SYSEX_Action_PRESET_WriteC
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 187


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00344         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM, ACCESS, TIA_SYSEX_Action_PRESET_WriteChk
5626 B421          M         btfsc   reg, bit, reg_a
5628 D00D          M         bra     label
               00345 
562A EE07 F000 00346         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN                    ; init pointer to upload buffer
562E CFA9 FFE9 00347         movff   EEADR, FSR0L
               00348 
               00349         ;; store received byte in upload buffer
5632 5023      00350         movf    TIA_SYSEX_IN, W
5634 6EEF      00351         movwf   INDF0
               00352 
               00353         ;; add to checksum
5636 0B7F      00354         andlw   0x7f
5638 2624      00355         addwf   TIA_SYSEX_CHECKSUM, F
               00356         
               00357         ;; increment address
563A 2AA9      00358         incf    EEADR, F
               00359 
               00360         ;; if FSR0L is zero, go into WAIT_CHECKSUM state
563C 0E80      00361         movlw   0x80
563E 60A9      00362         cpfslt  EEADR, ACCESS
5640 8421      00363         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM
               00364 
               00365         ;; wait for next byte
               00366         rgoto   TIA_SYSEX_SysExCheck_End
5642 D725          M         bra     label
               00367 
5644 00368 TIA_SYSEX_Action_PRESET_WriteChk
               00369         ;; store received byte in checksum (using TIA_SYSEX_ADDRESS as store register)
5644 C023 FFA9 00370         movff   TIA_SYSEX_IN, EEADR
               00371 
               00372         ;; wait for next byte
               00373         rgoto   TIA_SYSEX_SysExCheck_End
5648 D722          M         bra     label
               00374 
564A 00375 TIA_SYSEX_End_PRESET_Write
               00376         ;; action invalid if checksum has not been received
               00377         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM, ACCESS, TIA_SYSEX_ActionInvalid
564A A421          M         btfss   reg, bit, reg_a
564C D72B          M         bra     label
               00378 
               00379         ;; calc final checksum
564E 5024      00380         movf    TIA_SYSEX_CHECKSUM, W
5650 0880      00381         sublw   0x80
5652 0B7F      00382         andlw   0x7f
               00383 
               00384         ;; compare with received checksum
5654 18A9      00385         xorwf   EEADR, W
               00386 
               00387         ;; if not equal jump to ActionInvalid
5656 A4D8      00388         skpz
               00389         rgoto   TIA_SYSEX_End_PRESET_Write_Reply_ChksumErr
5658 D01F          M         bra     label
               00390     
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 188


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
565A 5025      00391     movf        TIA_SYSEX_ADDRESS, W
565C DA77      00392     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank
565E 6E26      00393     movwf   TIA_SYSEX_ERROR
5660 E123      00394     bnz     TIA_SYSEX_End_PRESET_Write_Reply
               00395     
5662 5012      00396     movf        TIA_PRESET, W
5664 E00A      00397     bz      TIA_SYSEX_End_PRESET_Write_Cont    
5666 5011      00398     movf    TIA_BANK, W
5668 ECBE F01E 00399     call    TIA_BANK_GetBankStickReady
566C B4D8      00400     skpnz
               00401         rgoto   TIA_SYSEX_End_PRESET_Write_Reply_NotReady
566E D017          M         bra     label
               00402      
5670 ECCB F01E 00403     call    TIA_BANK_GetBankStickSize
5674 E102      00404     bnz     TIA_SYSEX_End_PRESET_Write_Cont
               00405 
5676 BC12      00406     btfsc       TIA_PRESET, 6
               00407     rgoto       TIA_SYSEX_End_PRESET_Write_Reply_32k
5678 D015          M         bra     label
               00408 
567A 00409 TIA_SYSEX_End_PRESET_Write_Cont
               00410         ;; write buffer to EEPROM
567A EE17 F000 00411         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN    ; init pointer to upload buffer
567E 0E00      00412     movlw   EEPROM_PATCH & 0xff
5680 6EA9      00413         movwf   EEADR
5682 0E00      00414     movlw   (EEPROM_PATCH >> 8) & 0xff
5684 6EAA      00415     movwf   EEADRH
               00416         
5686 00417 TIA_SYSEX_End_PRESET_WritePages
5686 0004      00418         clrwdt                  ; feed watchdog
5688 EC38 F01E 00419         call    TIA_BANK_WritePage      ; write a 64 bytes page to EEPROM
               00420         ;; increment FSR1 by 0x40
568C 0E40      00421         movlw   0x40
568E 26E1      00422         addwf   FSR1L, F
5690 0004      00423         clrwdt                  ; feed watchdog
5692 EC38 F01E 00424     call        TIA_BANK_WritePage      ; write a 64 bytes page to EEPROM
               00425     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
5696 D008          M         bra     label
               00426     ;; to do... bank num in command and set patch/kit/WT +init if BANK==xBANK/ PRESET==xPRESET
               00427 
5698 00428 TIA_SYSEX_End_PRESET_Write_Reply_ChksumErr
               00429     ;; CheckSum Error #5
5698 0E05      00430     movlw   0x05
569A 6E26      00431     movwf   TIA_SYSEX_ERROR
               00432     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
569C D005          M         bra     label
               00433     
569E 00434 TIA_SYSEX_End_PRESET_Write_Reply_NotReady
               00435     ;; BS not ready Error #3
569E 0E03      00436     movlw   0x03
56A0 6E26      00437     movwf   TIA_SYSEX_ERROR
               00438     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
56A2 D002          M         bra     label
               00439 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 189


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
56A4 00440 TIA_SYSEX_End_PRESET_Write_Reply_32k
               00441     ;; BS 32k 64 presets max Error #4
56A4 0E04      00442     movlw   0x04
56A6 6E26      00443     movwf   TIA_SYSEX_ERROR
               00444     ;;rgoto   TIA_SYSEX_End_PRESET_Write_Reply
               00445         
56A8 00446 TIA_SYSEX_End_PRESET_Write_Reply
               00447         ;; send SysEx header
56A8 DA1E      00448         rcall   TIA_SYSEX_Send_SysExHeader
               00449 
               00450         ;; Send PRESET_Write ID
56AA 0E02      00451         movlw   0x02
56AC EC24 F016 00452         call    MIOS_MIDI_TxBufferPut
               00453 
               00454         ;; send requested preset type number
56B0 DA69      00455     rcall   TIA_SYSEX_Hlp_GetRelativeBank
56B2 0B7F      00456     andlw   0x7f
56B4 EC24 F016 00457         call    MIOS_MIDI_TxBufferPut
               00458     
               00459         ;; send requested bank number
56B8 5011      00460         movf    TIA_BANK, W
56BA 0B1F      00461     andlw   0x1f
56BC EC24 F016 00462         call    MIOS_MIDI_TxBufferPut
               00463     
               00464         ;; send requested preset number
56C0 5012      00465         movf    TIA_PRESET, W
56C2 0B7F      00466     andlw   0x7f
56C4 EC24 F016 00467         call    MIOS_MIDI_TxBufferPut
               00468 
               00469         ;; send error status
56C8 5026      00470     movf    TIA_SYSEX_ERROR, W
56CA 0B7F      00471     andlw   0x7f
56CC EC24 F016 00472         call    MIOS_MIDI_TxBufferPut
               00473 
               00474         ;; send of SysEx footer
56D0 0E01      00475         movlw   0x01            ; (independend from merger state)
56D2 DA1C      00476         rcall   TIA_SYSEX_Send_SysExFooter
               00477 
               00478         ;; finish Action
               00479         rgoto   TIA_SYSEX_ActionFinished
56D4 D6E7          M         bra     label
               00480 
56D6 00481 TIA_SYSEX_End_PRESET_Write_STR
               00482         STRING  20, 0x00, "Patch A  1 uploaded "
56D6 1400 6150     M         da      ((length) << 8) | (pos), str
     6374 2068 
     2041 3120 
     7520 6C70 
     616F 6564 
     2064      
               00483 
               00484 ;; --------------------------------------------------------------------------
               00485 ;;  MIDI Action: All Patch Read
               00486 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 190


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
56EC 00487 TIA_SYSEX_Init_BANK_Read
               00488         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
56EC 8010      00489         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
56EE ECD6 F021 00490     call    TIA_TUNE_Note_Off
56F2 0012      00491         return
               00492 
56F4 00493 TIA_SYSEX_Action_BANK_Read
               00494         ;; receive <type> <bank> F7
56F4 00495 TIA_SYSEX_Action_BANK_Read_T
               00496         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_Read_B
56F4 B621          M         btfsc   reg, bit, reg_a
56F6 D004          M         bra     label
56F8 8621      00497         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
56FA C023 F025 00498         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00499         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
56FE D6C7          M         bra     label
               00500 
5700 00501 TIA_SYSEX_Action_BANK_Read_B    
               00502         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_ReadStall
5700 B821          M         btfsc   reg, bit, reg_a
5702 D004          M         bra     label
5704 8821      00503         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
5706 C023 F011 00504         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00505         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
570A D6C1          M         bra     label
               00506                 
570C 00507 TIA_SYSEX_Action_BANK_ReadStall
               00508         ;; do nothing until sysex footer (F7) has been received
               00509         rgoto   TIA_SYSEX_SysExCheck_End
570C D6C0          M         bra     label
               00510 
570E 00511 TIA_SYSEX_End_BANK_Read
               00512         ;; action invalid if patch number has not been received
               00513         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
570E A821          M         btfss   reg, bit, reg_a
5710 D6C9          M         bra     label
               00514     
5712 C011 F007 00515     movff   TIA_BANK, TMP2  ;; store relative bank
5716 5025      00516     movf        TIA_SYSEX_ADDRESS, W
5718 DA19      00517     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank   ; set bank to absolute
571A 6E26      00518     movwf   TIA_SYSEX_ERROR
571C E10A      00519     bnz     TIA_SYSEX_End_BANK_Read_Cont
               00520     
571E 5012      00521     movf        TIA_PRESET, W
5720 E008      00522     bz      TIA_SYSEX_End_BANK_Read_Cont    
5722 5011      00523     movf    TIA_BANK, W
5724 ECBE F01E 00524     call    TIA_BANK_GetBankStickReady
5728 A4D8      00525     skpz
               00526         rgoto   TIA_SYSEX_End_BANK_Read_Cont
572A D003          M         bra     label
               00527     ;; BS not ready Error #3
572C 0E03      00528     movlw   0x03
572E 6E26      00529     movwf   TIA_SYSEX_ERROR
               00530     rgoto   TIA_SYSEX_End_BANK_Read_Cont
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 191


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5730 D000          M         bra     label
               00531 
5732 00532 TIA_SYSEX_End_BANK_Read_Cont
               00533 
               00534         ;; send SysEx header
5732 D9D9      00535         rcall   TIA_SYSEX_Send_SysExHeader
               00536 
               00537         ;; send PTCHES_Write ID
5734 0E03      00538         movlw   0x03
5736 EC24 F016 00539         call    MIOS_MIDI_TxBufferPut
               00540     
               00541         ;; send requested preset type number
573A 5025      00542     movf        TIA_SYSEX_ADDRESS, W
573C 0B7F      00543     andlw   0x7f
573E EC24 F016 00544         call    MIOS_MIDI_TxBufferPut
               00545     
               00546         ;; send requested bank number
5742 5007      00547         movf    TMP2, W
5744 0B1F      00548     andlw   0x1f
5746 EC24 F016 00549         call    MIOS_MIDI_TxBufferPut
               00550 
               00551     ;movf       TIA_SYSEX_ADDRESS, W
               00552     ;rcall   TIA_SYSEX_Hlp_GetAbsoluteBank   ; set bank to absolute    
574A 5011      00553     movf    TIA_BANK, W
574C ECBE F01E 00554     call    TIA_BANK_GetBankStickReady
               00555         ;; send requested bank size
5750 ECCB F01E 00556     call    TIA_BANK_GetBankStickSize
5754 EC24 F016 00557         call    MIOS_MIDI_TxBufferPut
               00558     
5758 5026      00559     movf    TIA_SYSEX_ERROR, W
575A E004      00560     bz      TIA_SYSEX_End_BANK_Read_Cont_Ok
575C 0B7F      00561     andlw       0x7f
575E EC24 F016 00562         call    MIOS_MIDI_TxBufferPut
               00563     rgoto   TIA_SYSEX_End_BANK_Read_Footer
5762 D026          M         bra     label
               00564     
5764 00565 TIA_SYSEX_End_BANK_Read_Cont_Ok 
               00566 
               00567         ;; clear checksum
5764 6A24      00568         clrf    TIA_SYSEX_CHECKSUM
               00569 
               00570 #if 1    
               00571     ;; send bank informations 
5766 ECA3 F01E 00572         call    TIA_BANK_SetBankStickAddressMagic
576A 00573 TIA_SYSEX_End_BANK_Read_Cont_Name_Loop
576A ECB8 F016 00574         call    MIOS_BANKSTICK_Read             ; read content, inc MIOS_PARAMETER12
576E 6EF5      00575         movwf   TABLAT              ; store data in TABLAT
               00576     
5770 5003      00577     movf    MIOS_PARAMETER1, W
5772 0BF0      00578     andlw   0xf0
5774 0A10      00579     xorlw   0x10
5776 E104      00580     bnz     TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
5778 0E20      00581         movlw   0x20
577A 60F5      00582         cpfslt  TABLAT, ACCESS      ; ensure that patch name doesn't contain characters < 0x20
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 192


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00583     rgoto   TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
577C D001          M         bra     label
577E 6EF5      00584         movwf   TABLAT
5780 00585 TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
5780 50F5      00586     movf    TABLAT, W
5782 0B7F      00587     andlw   0x7f
5784 2624      00588         addwf   TIA_SYSEX_CHECKSUM, F
5786 EC24 F016 00589         call    MIOS_MIDI_TxBufferPut
578A AE03      00590     btfss   MIOS_PARAMETER1, 7            ; until == 0x20 send 16 bytes
               00591     rgoto   TIA_SYSEX_End_BANK_Read_Cont_Name_Loop
578C D7EE          M         bra     label
               00592 
               00593         ;; 127 patches to send(1-127), TIA_PRESET used as counter
578E 0E01      00594     movlw   0x01
5790 6E12      00595     movwf   TIA_PRESET
               00596 #else
               00597     
               00598         ;; 128 patches to send, TIA_PRESET used as counter
               00599     clrf        TIA_PRESET
               00600 #endif    
               00601     
5792 00602 TIA_SYSEX_End_BANK_Read_OL      ; outer loop
5792 0004      00603         clrwdt                      ; feed the watchdog
5794 D9C6      00604         rcall   TIA_SYSEX_Hlp_SendPreset        ; send 128 bytes
               00605 
5796 2A12      00606         incf    TIA_PRESET, F       ; loop 64/128 times depends on BS Size
5798 ECCB F01E 00607     call    TIA_BANK_GetBankStickSize
579C 0E7F      00608         movlw   128-1
579E B4D8      00609         skpnz
57A0 0E3F      00610         movlw   64-1
57A2 6412      00611         cpfsgt  TIA_PRESET, ACCESS
               00612         rgoto TIA_SYSEX_End_BANK_Read_OL
57A4 D7F6          M         bra     label
               00613 
               00614         ;; send checksum
57A6 5024      00615         movf    TIA_SYSEX_CHECKSUM, W
57A8 0880      00616         sublw   0x80
57AA 0B7F      00617         andlw   0x7f
57AC EC24 F016 00618         call    MIOS_MIDI_TxBufferPut
               00619 
57B0 00620 TIA_SYSEX_End_BANK_Read_Footer
               00621         ;; send of SysEx footer
57B0 0E01      00622         movlw   0x01            ; (independend from merger state)
57B2 D9AC      00623         rcall   TIA_SYSEX_Send_SysExFooter
               00624 
               00625         ;; finish Action
               00626         rgoto   TIA_SYSEX_ActionFinished
57B4 D677          M         bra     label
               00627 
               00628 
               00629 ;; --------------------------------------------------------------------------
               00630 ;;  MIDI Action: Bank Write Name
               00631 ;; --------------------------------------------------------------------------
57B6 00632 TIA_SYSEX_Init_BANK_WriteName
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 193


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00633         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
               00634         ;;bsf   TIA_STAT, TIA_STAT_ENGINE_DISABLE
57B6 0012      00635         return
               00636 
57B8 00637 TIA_SYSEX_Action_BANK_WriteName
               00638         ;; receive <type> <bank> <16 bytes> F7
57B8 00639 TIA_SYSEX_Action_BANK_WriteNameT
               00640         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_WriteNameB
57B8 B621          M         btfsc   reg, bit, reg_a
57BA D004          M         bra     label
57BC 8621      00641         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
57BE C023 F025 00642         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00643         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
57C2 D665          M         bra     label
               00644 
57C4 00645 TIA_SYSEX_Action_BANK_WriteNameB
               00646         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_WriteNameC
57C4 B821          M         btfsc   reg, bit, reg_a
57C6 D006          M         bra     label
57C8 8821      00647         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
57CA C023 F011 00648         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00649     
57CE 6AA9      00650         clrf    EEADR                       ; clear address
57D0 6A26      00651     clrf    TIA_SYSEX_ERROR             ; clear reply error
               00652         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byt
57D2 D65D          M         bra     label
               00653         
57D4 00654 TIA_SYSEX_Action_BANK_WriteNameC
57D4 EE07 F000 00655         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN                    ; init pointer to upload buffer
57D8 CFA9 FFE9 00656         movff   EEADR, FSR0L
               00657 
               00658         ;; store received byte in upload buffer
57DC 5023      00659         movf    TIA_SYSEX_IN, W
57DE 6EEF      00660         movwf   INDF0
               00661 
               00662         ;; increment address
57E0 2AA9      00663         incf    EEADR, F
               00664 
               00665         ;; if FSR0L is zero, go into WAIT_CHECKSUM state
57E2 0E10      00666         movlw   0x10
57E4 60A9      00667         cpfslt  EEADR, ACCESS
57E6 8A21      00668     bsf TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
               00669     
               00670         ;; wait for next byte
               00671         rgoto   TIA_SYSEX_SysExCheck_End
57E8 D652          M         bra     label
               00672 
57EA 00673 TIA_SYSEX_End_BANK_WriteName
               00674         ;; action invalid if checksum has not been received
               00675         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
57EA AA21          M         btfss   reg, bit, reg_a
57EC D65B          M         bra     label
               00676 
57EE 5025      00677     movf        TIA_SYSEX_ADDRESS, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 194


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
57F0 D9AD      00678     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank
57F2 6E26      00679     movwf   TIA_SYSEX_ERROR
57F4 E11D      00680     bnz     TIA_SYSEX_End_BANK_WriteName_Reply
               00681   
57F6 5011      00682     movf    TIA_BANK, W
57F8 ECBE F01E 00683     call    TIA_BANK_GetBankStickReady
57FC B4D8      00684     skpnz
               00685         rgoto   TIA_SYSEX_End_BANK_WriteName_Reply_NotReady
57FE D015          M         bra     label
               00686 
5800 00687 TIA_SYSEX_End_BANK_WriteName_Cont
5800 EE17 F000 00688         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN    ; init pointer to upload buffer
               00689     ;; add name offset to MP1 start @0x10
5804 ECA3 F01E 00690         call    TIA_BANK_SetBankStickAddressMagic  
5808 0E10      00691     movlw   0x10
580A 2603      00692     addwf   MIOS_PARAMETER1, F
               00693     
580C 00694 TIA_SYSEX_End_BANK_WriteName_Loop 
580C 0004      00695         clrwdt                  ; feed watchdog
580E 0E20      00696         movlw   0x20
5810 61E7      00697         cpfslt  INDF1, BANKED      ; ensure that patch name doesn't contain characters < 0x20
5812 6EE7      00698     movwf   INDF1
5814 00699 TIA_SYSEX_End_BANK_WriteName_Loop_Jump 
5814 50E6      00700     movf    POSTINC1, W
5816 ECBA F016 00701         call    MIOS_BANKSTICK_Write     ; write byte to EEPROM
581A E104      00702     bnz     TIA_SYSEX_End_BANK_WriteName_Reply_WError
               00703 
               00704     ;; if FSR0L is zero, go into WAIT_CHECKSUM state
581C 0E20      00705         movlw   0x20
581E 6003      00706         cpfslt  MIOS_PARAMETER1, ACCESS
               00707     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply
5820 D007          M         bra     label
               00708     rgoto   TIA_SYSEX_End_BANK_WriteName_Loop
5822 D7F4          M         bra     label
               00709 
5824 00710 TIA_SYSEX_End_BANK_WriteName_Reply_WError
               00711     ;; BS write byte Error #8
5824 0E08      00712     movlw   0x08
5826 6E26      00713     movwf   TIA_SYSEX_ERROR
               00714     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply       
5828 D003          M         bra     label
               00715 
582A 00716 TIA_SYSEX_End_BANK_WriteName_Reply_NotReady
               00717     ;; BS not ready Error #3
582A 0E03      00718     movlw   0x03
582C 6E26      00719     movwf   TIA_SYSEX_ERROR
               00720     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply
582E D000          M         bra     label
               00721         
5830 00722 TIA_SYSEX_End_BANK_WriteName_Reply
               00723         ;; send SysEx header
5830 D95A      00724         rcall   TIA_SYSEX_Send_SysExHeader
               00725 
               00726         ;; Send PRESET_WriteName ID
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 195


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5832 0E04      00727         movlw   0x04
5834 EC24 F016 00728         call    MIOS_MIDI_TxBufferPut
               00729 
               00730         ;; send requested preset type number
5838 D9A5      00731     rcall   TIA_SYSEX_Hlp_GetRelativeBank
583A 0B7F      00732     andlw   0x7f
583C EC24 F016 00733         call    MIOS_MIDI_TxBufferPut
               00734     
               00735         ;; send requested bank number
5840 5011      00736         movf    TIA_BANK, W
5842 0B1F      00737     andlw   0x1f
5844 EC24 F016 00738         call    MIOS_MIDI_TxBufferPut
               00739 
               00740         ;; send error status
5848 5026      00741     movf    TIA_SYSEX_ERROR, W
584A 0B7F      00742     andlw   0x7f
584C EC24 F016 00743         call    MIOS_MIDI_TxBufferPut
               00744 
               00745         ;; send of SysEx footer
5850 0E01      00746         movlw   0x01            ; (independend from merger state)
5852 D95C      00747         rcall   TIA_SYSEX_Send_SysExFooter
               00748 
               00749         ;; finish Action
               00750         rgoto   TIA_SYSEX_ActionFinished
5854 D627          M         bra     label
               00751 
               00752 ;; --------------------------------------------------------------------------
               00753 ;;  MIDI Action: Parameter Read
               00754 ;; --------------------------------------------------------------------------
5856 00755 TIA_SYSEX_Init_PAR_Read
5856 0012      00756         return
               00757 
5858 00758 TIA_SYSEX_Action_PAR_Read
               00759         ;; receive <AH> <AL> F7
5858 00760 TIA_SYSEX_Action_PAR_ReadAH
               00761         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_ReadAL
5858 BA21          M         btfsc   reg, bit, reg_a
585A D005          M         bra     label
585C 8A21      00762         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED
585E 6A25      00763         clrf    TIA_SYSEX_ADDRESS               ; clear register and set TIA_SYSEX_ADDRESS[7] if IN[0] is set
5860 B023      00764         btfsc   TIA_SYSEX_IN, 0
5862 8E25      00765         bsf     TIA_SYSEX_ADDRESS, 7
               00766         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5864 D614          M         bra     label
               00767         
5866 00768 TIA_SYSEX_Action_PAR_ReadAL
               00769         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_ReadStall
5866 B821          M         btfsc   reg, bit, reg_a
5868 D005          M         bra     label
586A 8821      00770         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED
586C 5023      00771         movf    TIA_SYSEX_IN, W                 ; OR TIA_SYSEX_ADDRESS with low-byte
586E 0B7F      00772         andlw   0x7f
5870 1225      00773         iorwf   TIA_SYSEX_ADDRESS, F
               00774         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 196


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5872 D60D          M         bra     label
               00775 
5874 00776 TIA_SYSEX_Action_PAR_ReadStall
               00777         ;; do nothing until sysex footer (F7) has been received
               00778         rgoto   TIA_SYSEX_SysExCheck_End
5874 D60C          M         bra     label
               00779 
5876 00780 TIA_SYSEX_End_PAR_Read
               00781         ;; action invalid if low-byte of address has not been received
               00782         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5876 A821          M         btfss   reg, bit, reg_a
5878 D615          M         bra     label
               00783 
               00784         ;; send SysEx header
587A D935      00785         rcall   TIA_SYSEX_Send_SysExHeader
               00786 
               00787         ;; send PAR_Write ID
587C 0E06      00788         movlw   0x06
587E EC24 F016 00789         call    MIOS_MIDI_TxBufferPut
               00790 
               00791         ;; send AH
5882 0E00      00792         movlw   0x00
5884 BE25      00793         btfsc   TIA_SYSEX_ADDRESS, 7
5886 0E01      00794         movlw 0x01
5888 EC24 F016 00795         call    MIOS_MIDI_TxBufferPut
               00796 
               00797         ;; send AL
588C 5025      00798         movf    TIA_SYSEX_ADDRESS, W
588E 0B7F      00799         andlw   0x7f
5890 EC24 F016 00800         call    MIOS_MIDI_TxBufferPut
               00801 
               00802         ;; get corresponding CC parameter from address
5894 5025      00803         movf    TIA_SYSEX_ADDRESS, W
5896 EC59 F030 00804         call    TIA_SYSEX_TABLE_Get
               00805 
               00806         ;; branch if EEPROM value should be sent
               00807         BRA_IFSET WREG, 7, ACCESS, TIA_SYSEX_Action_PAR_Read_EE
589A BEE8          M         btfsc   reg, bit, reg_a
589C D003          M         bra     label
               00808 
589E 00809 TIA_SYSEX_Action_PAR_Read_RAM
               00810         ;; get CC value from RAM
589E EC84 F02F 00811         call    TIA_CCOUT_Get
               00812         rgoto   TIA_SYSEX_Action_PAR_Read_Cont
58A2 D004          M         bra     label
58A4 00813 TIA_SYSEX_Action_PAR_Read_EE
               00814         ;; read value from EEPROM
58A4 C025 FFA9 00815         movff   TIA_SYSEX_ADDRESS, EEADR
58A8 EC85 F01E 00816         call    TIA_BANK_Read
58AC 00817 TIA_SYSEX_Action_PAR_Read_Cont
               00818         ;; send value
58AC 0B7F      00819         andlw   0x7f
58AE EC24 F016 00820         call    MIOS_MIDI_TxBufferPut
               00821         
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 197


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00822         ;; send of SysEx footer
58B2 0E01      00823         movlw   0x01            ; (independend from merger state)
58B4 D92B      00824         rcall   TIA_SYSEX_Send_SysExFooter
               00825 
               00826         ;; finish Action
               00827         rgoto   TIA_SYSEX_ActionFinished
58B6 D5F6          M         bra     label
               00828 
               00829 ;; --------------------------------------------------------------------------
               00830 ;;  MIDI Action: Parameter Write
               00831 ;; --------------------------------------------------------------------------
58B8 00832 TIA_SYSEX_Init_PAR_Write
58B8 0012      00833         return
               00834 
58BA 00835 TIA_SYSEX_Action_PAR_Write
               00836         ;; receive <AH> <AL> <value> F7
58BA 00837 TIA_SYSEX_Action_PAR_WriteAH
               00838         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteAL
58BA BA21          M         btfsc   reg, bit, reg_a
58BC D005          M         bra     label
58BE 8A21      00839         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED
58C0 6A25      00840         clrf    TIA_SYSEX_ADDRESS               ; clear register and set TIA_SYSEX_ADDRESS[7] if IN[0] is set
58C2 B023      00841         btfsc   TIA_SYSEX_IN, 0
58C4 8E25      00842         bsf     TIA_SYSEX_ADDRESS, 7
               00843         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
58C6 D5E3          M         bra     label
               00844         
58C8 00845 TIA_SYSEX_Action_PAR_WriteAL
               00846         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteD
58C8 B821          M         btfsc   reg, bit, reg_a
58CA D005          M         bra     label
58CC 8821      00847         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED
58CE 5023      00848         movf    TIA_SYSEX_IN, W                 ; OR TIA_SYSEX_ADDRESS with low-byte
58D0 0B7F      00849         andlw   0x7f
58D2 1225      00850         iorwf   TIA_SYSEX_ADDRESS, F
               00851         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
58D4 D5DC          M         bra     label
               00852 
58D6 00853 TIA_SYSEX_Action_PAR_WriteD
               00854         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteStall
58D6 B621          M         btfsc   reg, bit, reg_a
58D8 D004          M         bra     label
58DA 8621      00855         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED     
58DC C023 F024 00856         movff   TIA_SYSEX_IN, TIA_SYSEX_CHECKSUM; store byte in TIA_SYSEX_CHECKSUM (used as write buffer here)
               00857         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
58E0 D5D6          M         bra     label
               00858 
58E2 00859 TIA_SYSEX_Action_PAR_WriteStall
               00860         ;; do nothing until sysex footer (F7) has been received
               00861         rgoto   TIA_SYSEX_SysExCheck_End
58E2 D5D5          M         bra     label
               00862 
58E4 00863 TIA_SYSEX_End_PAR_Write
               00864         ;; action invalid if data has not been received
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 198


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00865         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
58E4 A621          M         btfss   reg, bit, reg_a
58E6 D5DE          M         bra     label
               00866 
               00867         ;; get corresponding CC parameter from address
58E8 5025      00868         movf    TIA_SYSEX_ADDRESS, W
58EA EC59 F030 00869         call    TIA_SYSEX_TABLE_Get
58EE 6E06      00870         movwf   TMP1
               00871 
               00872         ;; branch if value should be saved in EEPROM
               00873         BRA_IFSET TMP1, 7, ACCESS, TIA_SYSEX_Action_PAR_Write_EE
58F0 BE06          M         btfsc   reg, bit, reg_a
58F2 D005          M         bra     label
               00874 
58F4 00875 TIA_SYSEX_Action_PAR_Write_RAM
               00876         ;; write CC value to RAM
58F4 C024 F003 00877         movff   TIA_SYSEX_CHECKSUM, MIOS_PARAMETER1 ; byte has been stored in _CHECKSUM
58F8 ECD9 F02D 00878         call    TIA_CCIN_Set
               00879         rgoto   TIA_SYSEX_Action_PAR_Write_Cont
58FC D00F          M         bra     label
58FE 00880 TIA_SYSEX_Action_PAR_Write_EE
               00881         ;; if split parameter, redirect to TIA_Vx_SPLIT_xxx
58FE 5006      00882         movf    TMP1, W
5900 0BF0      00883         andlw   0xf0
5902 0A90      00884         xorlw   0x90
5904 E106      00885         bnz     TIA_SYSEX_Action_PAR_Write_EEC
5906 00886 TIA_SYSEX_Action_PAR_Write_EES
5906 5006      00887         movf    TMP1, W
5908 ECF0 F01D 00888         call    TIA_PATCH_GetSplitPointer
590C C024 FFE3 00889         movff   TIA_SYSEX_CHECKSUM, PLUSW1
               00890         rgoto   TIA_SYSEX_Action_PAR_Write_Cont
5910 D005          M         bra     label
               00891 
5912 00892 TIA_SYSEX_Action_PAR_Write_EEC
               00893         ;; write value to EEPROM
5912 C025 FFA9 00894         movff   TIA_SYSEX_ADDRESS, EEADR
5916 5024      00895         movf    TIA_SYSEX_CHECKSUM, W; byte has been stored in _CHECKSUM
5918 ECFB F01D 00896         call    TIA_BANK_Write
591C 00897 TIA_SYSEX_Action_PAR_Write_Cont
               00898 
               00899         ;; send acknowledge
591C EC6D F02D 00900         call    TIA_SYSEX_Send_Acknowledge
               00901 
               00902         ;; finish Action
               00903         rgoto   TIA_SYSEX_ActionFinished
5920 D5C1          M         bra     label
               00904 
               00905 ;; --------------------------------------------------------------------------
               00906 ;;  MIDI Action: Switch Bank
               00907 ;; --------------------------------------------------------------------------
5922 00908 TIA_SYSEX_Init_BANK_Sel
5922 6A25      00909         clrf    TIA_SYSEX_ADDRESS
5924 0012      00910         return
               00911 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 199


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5926 00912 TIA_SYSEX_Action_BANK_Sel
               00913         ;; store bank in TIA_SYSEX_ADDRESS
5926 C023 F025 00914         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS
               00915         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
592A D5B1          M         bra     label
               00916 
592C 00917 TIA_SYSEX_End_BANK_Sel
               00918         ;; check if BankStick available
592C 0E0F      00919         movlw   0x0f
592E 6025      00920         cpfslt  TIA_SYSEX_ADDRESS, ACCESS
               00921         rgoto TIA_SYSEX_End_BANK_SelInv
5930 D008          M         bra     label
5932 5025      00922         movf    TIA_SYSEX_ADDRESS, W
5934 ECC6 F016 00923         call    MIOS_HLP_GetBitORMask
5938 141C      00924         andwf   TIA_BANKSTICK_STAT, W
593A E003      00925         bz      TIA_SYSEX_End_BANK_SelInv
               00926 
               00927         ;; change to bank immediately
593C C025 F014 00928         movff   TIA_SYSEX_ADDRESS, TIA_PBANK
5940 D8EF      00929         rcall   TIA_SYSEX_ChangeMPatch
               00930 
               00931         ;;      rgoto   TIA_SYSEX_End_BANK_Cont
               00932 
               00933         ;; don't select new bankstick
5942 00934 TIA_SYSEX_End_BANK_SelInv
               00935 
5942 00936 TIA_SYSEX_End_BANK_Cont
               00937         ;; send acknowledge with bank number
5942 D8D1      00938         rcall   TIA_SYSEX_Send_SysExHeader
               00939 
5944 0E0F      00940         movlw   0x0f            ; (acknowledge ID)
5946 EC24 F016 00941         call    MIOS_MIDI_TxBufferPut
               00942 
594A 5014      00943         movf    TIA_PBANK, W
594C EC24 F016 00944         call    MIOS_MIDI_TxBufferPut
               00945 
               00946         ;; send of SysEx footer
5950 0E01      00947         movlw   0x01            ; (independend from merger state)
5952 D8DC      00948         rcall   TIA_SYSEX_Send_SysExFooter
               00949 
               00950         ;; finish Action
               00951         rgoto   TIA_SYSEX_ActionFinished
5954 D5A7          M         bra     label
               00952 
               00953 ;; --------------------------------------------------------------------------
               00954 ;;  MIDI Action: Configuration Write
               00955 ;; --------------------------------------------------------------------------
5956 00956 TIA_SYSEX_Init_CFG_Read
5956 0012      00957     return
5958 00958 TIA_SYSEX_Action_CFG_Read    
               00959         ;; send <A> <DH> <DL> F7
5958 00960 TIA_SYSEX_Action_CFG_ReadA
               00961         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_ReadStall
5958 BA21          M         btfsc   reg, bit, reg_a
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 200


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
595A D004          M         bra     label
595C 8A21      00962         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED
595E C023 F025 00963         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS ; store address in TIA_SYSEX_ADDRESS
               00964         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5962 D595          M         bra     label
               00965 
5964 00966 TIA_SYSEX_Action_CFG_ReadStall
               00967         ;; do nothing until sysex footer (F7) has been received
               00968         rgoto   TIA_SYSEX_SysExCheck_End
5964 D594          M         bra     label
               00969     
5966 00970 TIA_SYSEX_End_CFG_Read
               00971     ;; action invalid if low-byte of address has not been received
               00972         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5966 AA21          M         btfss   reg, bit, reg_a
5968 D59D          M         bra     label
596A 00973 _TIA_SYSEX_End_CFG_Read
               00974         ;; send SysEx header
596A D8BD      00975         rcall   TIA_SYSEX_Send_SysExHeader
               00976 
               00977         ;; send CFG_Read ID
596C 0E0C      00978         movlw   0x0c
596E EC24 F016 00979         call    MIOS_MIDI_TxBufferPut
               00980 
               00981         ;; send A
5972 5025      00982         movf    TIA_SYSEX_ADDRESS, W
5974 EC24 F016 00983         call    MIOS_MIDI_TxBufferPut
               00984     
               00985         ;; branch depending on current action ID
5978 5025      00986         movf    TIA_SYSEX_ADDRESS, W
               00987         JUMPTABLE_2BYTES 16     ; 16 entries
597A 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
597C B0D8          M         skpnc
597E 0EF0          M         movlw   -(max_value)
5980 0F10          M         addlw   max_value
5982 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00988         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
5986 D00F          M         bra     label
               00989         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
5988 D00E          M         bra     label
               00990         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
598A D00D          M         bra     label
               00991         rgoto   TIA_SYSEX_End_CFG_Read_Bank
598C D01D          M         bra     label
               00992         rgoto   TIA_SYSEX_End_CFG_Read_Patch
598E D02F          M         bra     label
               00993         rgoto   TIA_SYSEX_End_CFG_Read_BSInfo
5990 D052          M         bra     label
               00994         rgoto   TIA_SYSEX_End_CFG_Read_All
5992 D031          M         bra     label
               00995         rgoto   TIA_SYSEX_End_CFG_Read_All
5994 D030          M         bra     label
               00996         rgoto   TIA_SYSEX_End_CFG_Read_All
5996 D02F          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 201


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00997         rgoto   TIA_SYSEX_End_CFG_Read_All
5998 D02E          M         bra     label
               00998         rgoto   TIA_SYSEX_End_CFG_Read_All
599A D02D          M         bra     label
               00999         rgoto   TIA_SYSEX_End_CFG_Read_All
599C D02C          M         bra     label
               01000         rgoto   TIA_SYSEX_End_CFG_Read_All
599E D02B          M         bra     label
               01001         rgoto   TIA_SYSEX_End_CFG_Read_All
59A0 D02A          M         bra     label
               01002         rgoto   TIA_SYSEX_End_CFG_Read_All
59A2 D029          M         bra     label
               01003         rgoto   TIA_SYSEX_End_CFG_Read_All
59A4 D028          M         bra     label
               01004     
               01005     
               01006     ;BRA_IFSET TIA_SYSEX_ADDRESS, 2, ACCESS, TIA_SYSEX_End_CFG_Read_All
               01007     
59A6 01008 TIA_SYSEX_End_CFG_Read_EEPROM    
               01009         ;; calc resulting EEADR
59A6 5025      01010         movf    TIA_SYSEX_ADDRESS, W
59A8 0B03      01011         andlw   0x03
59AA 0F7C      01012         addlw   EEPROM_CFG_BASE & 0xff
59AC 6EA9      01013         movwf   EEADR
               01014 
               01015         ;; read value from EEPROM
59AE ECB0 F016 01016         call    MIOS_EEPROM_Read
59B2 6E24      01017         movwf   TIA_SYSEX_CHECKSUM      ; (value is stored in TIA_SYSEX_CHECKSUM)    
               01018     
               01019         ;; send DH
59B4 0E00      01020         movlw   0x00
59B6 BE24      01021         btfsc   TIA_SYSEX_CHECKSUM, 7
59B8 0E01      01022         movlw   0x01
59BA EC24 F016 01023         call    MIOS_MIDI_TxBufferPut
               01024 
               01025         ;; send DL
59BE 5024      01026         movf    TIA_SYSEX_CHECKSUM, W
59C0 0B7F      01027         andlw   0x7f
59C2 EC24 F016 01028         call    MIOS_MIDI_TxBufferPut
               01029     rgoto   TIA_SYSEX_End_CFG_Read_Cont
59C6 D04C          M         bra     label
               01030     
59C8 01031 TIA_SYSEX_End_CFG_Read_Bank   
               01032     ;; send current bank number
59C8 5014      01033         movf    TIA_PBANK, W
59CA EC24 F016 01034         call    MIOS_MIDI_TxBufferPut
               01035 
               01036 #if 0    
               01037     ;; send bank type
               01038     call        TIA_BANK_SetBankStickAddressMagic
               01039     incf    MIOS_PARAMETER1, F
               01040     call        MIOS_BANKSTICK_Read
               01041     movwf   TIA_SYSEX_CHECKSUM
               01042     movlw   BANKSTICK_MAGIC1
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 202


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01043     subwf   TIA_SYSEX_CHECKSUM, W
               01044     andlw   0x7f
               01045         call    MIOS_MIDI_TxBufferPut  
               01046 #endif
               01047 
               01048     ;; send bank name    
59CE ECA3 F01E 01049     call        TIA_BANK_SetBankStickAddressMagic
59D2 0E10      01050     movlw   0x10
59D4 2603      01051     addwf   MIOS_PARAMETER1, F
59D6 01052 TIA_SYSEX_End_CFG_Read_Bank_NameLoop
59D6 ECB8 F016 01053     call        MIOS_BANKSTICK_Read
59DA 6E24      01054     movwf   TIA_SYSEX_CHECKSUM
59DC 0E20      01055     movlw   0x20
59DE 6024      01056     cpfslt  TIA_SYSEX_CHECKSUM
59E0 5024      01057     movf    TIA_SYSEX_CHECKSUM, W
59E2 0B7F      01058     andlw   0x7f
59E4 EC24 F016 01059         call    MIOS_MIDI_TxBufferPut  
59E8 AA03      01060     btfss   MIOS_PARAMETER1, 5
               01061     rgoto   TIA_SYSEX_End_CFG_Read_Bank_NameLoop
59EA D7F5          M         bra     label
               01062     rgoto   TIA_SYSEX_End_CFG_Read_Cont
59EC D039          M         bra     label
               01063     
59EE 01064 TIA_SYSEX_End_CFG_Read_Patch
               01065     ;; send current patch number
59EE 5013      01066         movf    TIA_PATCH, W
59F0 EC24 F016 01067         call    MIOS_MIDI_TxBufferPut
               01068     rgoto   TIA_SYSEX_End_CFG_Read_Cont
59F4 D035          M         bra     label
               01069     
               01070         
59F6 01071 TIA_SYSEX_End_CFG_Read_All
               01072         ;; calc resulting EEADR
59F6 0E7C      01073         movlw   EEPROM_CFG_BASE & 0xff
59F8 6EA9      01074         movwf   EEADR
               01075 
               01076         ;; read value from EEPROM
59FA ECB0 F016 01077         call    MIOS_EEPROM_Read
59FE 6E24      01078         movwf   TIA_SYSEX_CHECKSUM      ; (v2 ch is stored in TIA_SYSEX_CHECKSUM)    
               01079 
               01080         ;; send v2 ch
5A00 5024      01081         movf    TIA_SYSEX_CHECKSUM, W
5A02 EC24 F016 01082         call    MIOS_MIDI_TxBufferPut
               01083 
               01084         ;; read value from EEPROM
5A06 ECB0 F016 01085         call    MIOS_EEPROM_Read
5A0A 6E24      01086         movwf   TIA_SYSEX_CHECKSUM      ; (v1 ch is stored in TIA_SYSEX_CHECKSUM)    
               01087 
               01088         ;; send v1 ch
5A0C 5024      01089         movf    TIA_SYSEX_CHECKSUM, W
5A0E EC24 F016 01090         call    MIOS_MIDI_TxBufferPut
               01091 
               01092         ;; read value from EEPROM
5A12 ECB0 F016 01093         call    MIOS_EEPROM_Read
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 203


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5A16 6E24      01094         movwf   TIA_SYSEX_CHECKSUM      ; (v1 ch is stored in TIA_SYSEX_CHECKSUM) 
               01095         
               01096         ;; send DH/DL (device ID)
5A18 0E00      01097         movlw   0x00
5A1A BE24      01098         btfsc   TIA_SYSEX_CHECKSUM, 7
5A1C 0E01      01099         movlw   0x01
5A1E EC24 F016 01100         call    MIOS_MIDI_TxBufferPut
5A22 5024      01101         movf    TIA_SYSEX_CHECKSUM, W
5A24 0B7F      01102         andlw   0x7f
5A26 EC24 F016 01103         call    MIOS_MIDI_TxBufferPut
               01104      
               01105     ;; send current bank number
5A2A 5014      01106         movf    TIA_PBANK, W
5A2C EC24 F016 01107         call    MIOS_MIDI_TxBufferPut
               01108     
               01109     ;; send current patch number
5A30 5013      01110         movf    TIA_PATCH, W
5A32 EC24 F016 01111         call    MIOS_MIDI_TxBufferPut
               01112     
               01113 
5A36 01114 TIA_SYSEX_End_CFG_Read_BSInfo
               01115         ;; send DH/DL (bank status)
5A36 0E00      01116         movlw   0x00
5A38 BE1B      01117         btfsc   TIA_BANKSTICK_RDY, 7
5A3A 0E01      01118         movlw   0x01
5A3C EC24 F016 01119         call    MIOS_MIDI_TxBufferPut
5A40 501B      01120         movf    TIA_BANKSTICK_RDY, W
5A42 0B7F      01121         andlw   0x7f
5A44 EC24 F016 01122         call    MIOS_MIDI_TxBufferPut    
               01123 
               01124         ;; send DH/DL (bank size)
5A48 0E00      01125         movlw   0x00
5A4A BE1D      01126         btfsc   TIA_BANKSTICK_SIZE, 7
5A4C 0E01      01127         movlw   0x01
5A4E EC24 F016 01128         call    MIOS_MIDI_TxBufferPut
5A52 501D      01129         movf    TIA_BANKSTICK_SIZE, W
5A54 0B7F      01130         andlw   0x7f
5A56 EC24 F016 01131         call    MIOS_MIDI_TxBufferPut 
               01132     
               01133     ;; send Kit/WT start Id
5A5A 0E05      01134     movlw       DEFAULT_BS_KBANK_ID
5A5C EC24 F016 01135         call    MIOS_MIDI_TxBufferPut   
               01136             
               01137 
5A60 01138 TIA_SYSEX_End_CFG_Read_Cont  
               01139         ;; send of SysEx footer
5A60 0E01      01140         movlw   0x01            ; (independend from merger state)
5A62 D854      01141         rcall   TIA_SYSEX_Send_SysExFooter
               01142 
               01143         ;; finish Action
               01144         rgoto   TIA_SYSEX_ActionFinished
5A64 D51F          M         bra     label
               01145     
               01146 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 204


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01147 ;;  MIDI Action: Configuration Write
               01148 ;; --------------------------------------------------------------------------
5A66 01149 TIA_SYSEX_Init_CFG_Write
               01150         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
5A66 8010      01151         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
5A68 0012      01152         return
               01153 
5A6A 01154 TIA_SYSEX_Action_CFG_Write
               01155         ;; receive <A> <DH> <DL> F7
5A6A 01156 TIA_SYSEX_Action_CFG_WriteA
               01157         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteDH
5A6A BA21          M         btfsc   reg, bit, reg_a
5A6C D004          M         bra     label
5A6E 8A21      01158         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED
5A70 C023 F025 01159         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS ; store address in TIA_SYSEX_ADDRESS
               01160         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5A74 D50C          M         bra     label
               01161         
5A76 01162 TIA_SYSEX_Action_CFG_WriteDH
               01163         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteDL
5A76 B821          M         btfsc   reg, bit, reg_a
5A78 D005          M         bra     label
5A7A 8821      01164         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED
5A7C 3823      01165         swapf   TIA_SYSEX_IN, W                 ; store high-nibble in TIA_SYSEX_CHECKSUM (used as data buffer here)
5A7E 0BF0      01166         andlw   0xf0
5A80 6E24      01167         movwf   TIA_SYSEX_CHECKSUM
               01168         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5A82 D505          M         bra     label
               01169 
5A84 01170 TIA_SYSEX_Action_CFG_WriteDL
               01171         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteStall
5A84 B621          M         btfsc   reg, bit, reg_a
5A86 D004          M         bra     label
5A88 8621      01172         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED
5A8A 5023      01173         movf    TIA_SYSEX_IN, W                 ; store low-nibble in TIA_SYSEX_CHECKSUM (used as data buffer here)
5A8C 1224      01174         iorwf   TIA_SYSEX_CHECKSUM, F
               01175         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5A8E D4FF          M         bra     label
               01176 
5A90 01177 TIA_SYSEX_Action_CFG_WriteStall
               01178         ;; do nothing until sysex footer (F7) has been received
               01179         rgoto   TIA_SYSEX_SysExCheck_End
5A90 D4FE          M         bra     label
               01180 
5A92 01181 TIA_SYSEX_End_CFG_Write
               01182         ;; action invalid if data has not been received
               01183         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5A92 A621          M         btfss   reg, bit, reg_a
5A94 D507          M         bra     label
               01184 
               01185         ;; calc resulting EEADR
5A96 5025      01186         movf    TIA_SYSEX_ADDRESS, W
5A98 0B03      01187         andlw   0x03
5A9A 0F7C      01188         addlw   EEPROM_CFG_BASE & 0xff
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 205


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5A9C 6EA9      01189         movwf   EEADR
               01190 
               01191         ;; write value to EEPROM
5A9E 5024      01192         movf    TIA_SYSEX_CHECKSUM, W   ; (value has been stored in TIA_SYSEX_CHECKSUM)
5AA0 ECB2 F016 01193         call    MIOS_EEPROM_Write
               01194         
               01195         ;; send response
5AA4 D820      01196         rcall   TIA_SYSEX_Send_SysExHeader
               01197 
               01198         ;; send CFG_Write ID
5AA6 0E0D      01199         movlw   0x0d
5AA8 EC24 F016 01200         call    MIOS_MIDI_TxBufferPut
               01201 
               01202         ;; send A
5AAC 5025      01203         movf    TIA_SYSEX_ADDRESS, W
5AAE EC24 F016 01204         call    MIOS_MIDI_TxBufferPut
               01205 
               01206         ;; send DH
5AB2 0E00      01207         movlw   0x00
5AB4 BE24      01208         btfsc   TIA_SYSEX_CHECKSUM, 7
5AB6 0E01      01209         movlw   0x01
5AB8 EC24 F016 01210         call    MIOS_MIDI_TxBufferPut
               01211 
               01212         ;; send DL
5ABC 5024      01213         movf    TIA_SYSEX_CHECKSUM, W
5ABE 0B7F      01214         andlw   0x7f
5AC0 EC24 F016 01215         call    MIOS_MIDI_TxBufferPut
               01216             
               01217         ;; send of SysEx footer
5AC4 0E01      01218         movlw   0x01            ; (independent from merger state)
               01219         rgoto   TIA_SYSEX_Send_SysExFooter
5AC6 D022          M         bra     label
               01220 
               01221         ;; finish Action
               01222         rgoto   TIA_SYSEX_ActionFinished
5AC8 D4ED          M         bra     label
               01223 
               01224 ;; --------------------------------------------------------------------------
               01225 ;;  MIDI Action: CC Request
               01226 ;; --------------------------------------------------------------------------
5ACA 01227 TIA_SYSEX_Init_RequestCC
5ACA 0012      01228         return
               01229 
5ACC 01230 TIA_SYSEX_Action_RequestCC
               01231         ;; do nothing until sysex footer (F7) has been received
               01232         rgoto   TIA_SYSEX_SysExCheck_End
5ACC D4E0          M         bra     label
               01233 
5ACE 01234 TIA_SYSEX_End_RequestCC
               01235         ;; request CC dump (handled by tia_ccout.inc)
5ACE 8410      01236         bsf     TIA_STAT, TIA_STAT_CC_DUMP_REQ
               01237 
               01238         ;; finish Action
               01239         rgoto   TIA_SYSEX_ActionFinished
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 206


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5AD0 D4E9          M         bra     label
               01240 
               01241 
               01242 ;; --------------------------------------------------------------------------
               01243 ;;  MIDI Action: Ping
               01244 ;; --------------------------------------------------------------------------
5AD2 01245 TIA_SYSEX_Init_Ping
5AD2 0012      01246         return
               01247 
5AD4 01248 TIA_SYSEX_Action_Ping
               01249         ;; do nothing until sysex footer (F7) has been received
               01250         rgoto   TIA_SYSEX_SysExCheck_End
5AD4 D4DC          M         bra     label
               01251 
5AD6 01252 TIA_SYSEX_End_Ping
               01253         ;; send Acknowledge
5AD6 D801      01254         rcall   TIA_SYSEX_Send_Acknowledge
               01255 
               01256         ;; finish Action
               01257         rgoto   TIA_SYSEX_ActionFinished
5AD8 D4E5          M         bra     label
               01258 
               01259 
               01260 
               01261 ;; --------------------------------------------------------------------------
               01262 ;;  MIDI Send Acknowledge (Util function)
               01263 ;; --------------------------------------------------------------------------
5ADA 01264 TIA_SYSEX_Send_Acknowledge
5ADA D805      01265         rcall   TIA_SYSEX_Send_SysExHeader
               01266 
5ADC 0E0F      01267         movlw   0x0f            ; (acknowledge ID)
5ADE EC24 F016 01268         call    MIOS_MIDI_TxBufferPut
               01269 
               01270         ;; send of SysEx footer
5AE2 0E01      01271         movlw   0x01            ; (independend from merger state)
               01272         rgoto   TIA_SYSEX_Send_SysExFooter
5AE4 D013          M         bra     label
               01273 
               01274 ;; --------------------------------------------------------------------------
               01275 ;;  Send TIA SysEx Header (Util function)
               01276 ;; --------------------------------------------------------------------------
5AE6 01277 TIA_SYSEX_Send_SysExHeader
               01278         ;; if TIA_SYSEX_SYXSTATE > 0, check merger flag to allow propper sysex merging
               01279         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_MYSYSEX, ACCESS, TIA_SYSEX_Send_SysExHeader_Skp
5AE6 AE21          M         btfss   reg, bit, reg_a
5AE8 D007          M         bra     label
5AEA EC12 F016 01280         call    MIOS_MIDI_MergerGet
5AEE 0B01      01281         andlw   0x01
5AF0 E003      01282         bz      TIA_SYSEX_Send_SysExHeader_Skp
5AF2 0E05      01283         movlw   0x05            ; send only DEVICE_ID
5AF4 6E06      01284         movwf   TMP1
               01285         rgoto   TIA_SYSEX_Send_SysExHeaderLoop
5AF6 D001          M         bra     label
5AF8 01286 TIA_SYSEX_Send_SysExHeader_Skp
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 207


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01287 
5AF8 6A06      01288         clrf    TMP1
5AFA 01289 TIA_SYSEX_Send_SysExHeaderLoop
5AFA 5006      01290         movf    TMP1, W
5AFC DCC9      01291         rcall   TIA_SYSEX_SysExHeaderGet
5AFE EC24 F016 01292         call    MIOS_MIDI_TxBufferPut
5B02 2A06      01293         incf    TMP1, F
5B04 0E06      01294         movlw   0x06
5B06 6206      01295         cpfseq  TMP1, ACCESS
               01296         rgoto TIA_SYSEX_Send_SysExHeaderLoop
5B08 D7F8          M         bra     label
5B0A 0012      01297         return
               01298 
               01299 ;; --------------------------------------------------------------------------
               01300 ;;  MIDI Send SysEx Footer (Util function)
               01301 ;; --------------------------------------------------------------------------
5B0C 01302 TIA_SYSEX_Send_SysExFooter
               01303         ;; if WREG[0]=1: send F7 regardless of the merger state
               01304         BRA_IFSET WREG, 0, ACCESS, TIA_SYSEX_Send_SysExFooter_Force
5B0C B0E8          M         btfsc   reg, bit, reg_a
5B0E D005          M         bra     label
               01305         ;; send footer only if merger has been enabled
               01306         ;; to ensure a proper MIDI protocol
5B10 EC12 F016 01307         call    MIOS_MIDI_MergerGet
5B14 0B01      01308         andlw   0x01
5B16 B4D8      01309         skpnz
5B18 0012      01310         return
               01311 
5B1A 01312 TIA_SYSEX_Send_SysExFooter_Force
5B1A 0EF7      01313         movlw   0xf7
5B1C EF24 F016 01314         goto    MIOS_MIDI_TxBufferPut
               01315 
               01316 
               01317 ;; --------------------------------------------------------------------------
               01318 ;;  Changes the TIA Master patch
               01319 ;;  IN: patch number in TIA_PATCH
               01320 ;;      bank number in TIA_PBANK
               01321 ;; --------------------------------------------------------------------------
5B20 01322 TIA_SYSEX_ChangeMPatch
5B20 0012      01323         return
               01324 
               01325 
               01326 ;; --------------------------------------------------------------------------
               01327 ;;  Sends a patch
               01328 ;;  IN: patch number in TIA_PATCH
               01329 ;;      bank number in TIA_PBANK
               01330 ;;      TIA_SYSEX_CHECKSUM should be cleared if required
               01331 ;;  OUT: 256 bytes will be sent
               01332 ;;       checksum in TIA_SYSEX_CHECKSUM
               01333 ;; --------------------------------------------------------------------------
5B22 01334 TIA_SYSEX_Hlp_SendPreset
5B22 0E00      01335     movlw   (EEPROM_PATCH >> 8) & 0xff
5B24 6EAA      01336     movwf   EEADRH
5B26 6AA9      01337         clrf    EEADR                   ; 0x80 bytes to send, use EEADR as counter
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 208


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01338     ;;rgoto   TIA_SYSEX_Hlp_SendPresetLoop
5B28 01339 TIA_SYSEX_Hlp_SendPresetLoop
5B28 EC85 F01E 01340         call    TIA_BANK_Read   ; read patch content (EEADR will be incremented)
5B2C 6EF5      01341         movwf   TABLAT          ; store data in TABLAT
               01342 
5B2E 0E11      01343         movlw   0x10+1          ; ensure that patch name doesn't contain characters < 0x20
5B30 60A9      01344         cpfslt  EEADR, ACCESS
               01345         rgoto TIA_SYSEX_Hlp_SendPresetLoop_NoN
5B32 D004          M         bra     label
5B34 01346 TIA_SYSEX_Hlp_SendPresetLoop_N
5B34 0E20      01347         movlw   0x20
5B36 60F5      01348         cpfslt  TABLAT, ACCESS
               01349         rgoto TIA_SYSEX_Hlp_SendPresetLoop_NoN
5B38 D001          M         bra     label
5B3A 6EF5      01350         movwf   TABLAT
5B3C 01351 TIA_SYSEX_Hlp_SendPresetLoop_NoN
5B3C 50F5      01352         movf    TABLAT, W
5B3E 0B7F      01353         andlw   0x7f            ; add to checksum
5B40 2624      01354         addwf   TIA_SYSEX_CHECKSUM, F
               01355 
5B42 EC24 F016 01356         call    MIOS_MIDI_TxBufferPut; send byte
               01357 
5B46 AEA9      01358         btfss   EEADR, 7
               01359         rgoto   TIA_SYSEX_Hlp_SendPresetLoop    ; loop 128 times
5B48 D7EF          M         bra     label
               01360 
5B4A 0012      01361         return
               01362     
               01363     
               01364     
               01365 ;; --------------------------------------------------------------------------
               01366 ;;  This function returns the absolute BANK # from relative xBANK #
               01367 ;;  IN: Relative Bank in TIA_BANK, preset type in WREG
               01368 ;;  OUT: Abslolute Bank in TIA_BANK, Error in WREG
               01369 ;; --------------------------------------------------------------------------
5B4C 01370 TIA_SYSEX_Hlp_GetAbsoluteBank
5B4C 6E06      01371     movwf   TMP1
               01372     BRA_IFCLR  TMP1, 0, ACCESS, TIA_SYSEX_Hlp_GetAbsoluteBank_P
5B4E A006          M         btfss   reg, bit, reg_a
5B50 D012          M         bra     label
5B52 01373 TIA_SYSEX_Hlp_GetAbsoluteBank_K
5B52 0E06      01374     movlw   16-(DEFAULT_BS_KBANK_ID*2)
5B54 6011      01375     cpfslt  TIA_BANK, ACCESS
               01376     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_Err
5B56 D014          M         bra     label
5B58 5011      01377     movf    TIA_BANK, W
5B5A 0B06      01378     andlw   0x06
5B5C 44E8      01379     rlncf   WREG, W
5B5E B011      01380     btfsc   TIA_BANK, 0
5B60 28E8      01381     incf    WREG, W
5B62 0F14      01382     addlw   DEFAULT_BS_KBANK_ID*4
               01383     BRA_IFSET  TMP1, 1, ACCESS, TIA_SYSEX_Hlp_GetAbsoluteBank_WT
5B64 B206          M         btfsc   reg, bit, reg_a
5B66 D003          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 209


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5B68 6E11      01384     movwf   TIA_BANK
5B6A 0E00      01385     movlw   0x00
               01386     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
5B6C D00A          M         bra     label
               01387     
5B6E 01388 TIA_SYSEX_Hlp_GetAbsoluteBank_WT
5B6E 0F02      01389     addlw   0x02
5B70 6E11      01390     movwf   TIA_BANK   
5B72 0E00      01391     movlw   0x00
               01392     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
5B74 D006          M         bra     label
               01393     
5B76 01394 TIA_SYSEX_Hlp_GetAbsoluteBank_P
               01395     ;; Saturate to max Patch banks (DEFAULT_BS_KBANK_ID*4-1)
5B76 0E14      01396     movlw   DEFAULT_BS_KBANK_ID*4
5B78 6011      01397     cpfslt  TIA_BANK, ACCESS
               01398     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_Err
5B7A D002          M         bra     label
5B7C 0E00      01399     movlw   0x00
               01400     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
5B7E D001          M         bra     label
               01401     
5B80 01402 TIA_SYSEX_Hlp_GetAbsoluteBank_Err
5B80 0E06      01403     movlw   0x06 ;; not valid xBANK
               01404     
5B82 01405 TIA_SYSEX_Hlp_GetAbsoluteBank_End
5B82 0012      01406         return
               01407 
               01408 ;; --------------------------------------------------------------------------
               01409 ;;  This function returns the absolute BANK # from relative xBANK #
               01410 ;;  IN:  Abslolute Bank in TIA_BANK
               01411 ;;  OUT: Relative Bank in TIA_BANK, preset type in WREG
               01412 ;; --------------------------------------------------------------------------
5B84 01413 TIA_SYSEX_Hlp_GetRelativeBank
               01414     ;; Saturate to 32 absolute banks
5B84 0E1F      01415     movlw   0x1f
5B86 6011      01416     cpfslt  TIA_BANK, ACCESS
5B88 6E11      01417     movwf   TIA_BANK
5B8A 0E14      01418     movlw   DEFAULT_BS_KBANK_ID*4
5B8C 5C11      01419     subwf   TIA_BANK, W
5B8E 6E06      01420     movwf   TMP1
5B90 E702      01421     bnn     TIA_SYSEX_Hlp_GetRelativeBank_K
5B92 01422 TIA_SYSEX_Hlp_GetRelativeBank_P   
5B92 0E00      01423     movlw   0x00
               01424     rgoto   TIA_SYSEX_Hlp_GetRelativeBank_End
5B94 D00D          M         bra     label
5B96 01425 TIA_SYSEX_Hlp_GetRelativeBank_K
               01426     BRA_IFSET  TMP1, 1, ACCESS, TIA_SYSEX_Hlp_GetRelativeBank_WT 
5B96 B206          M         btfsc   reg, bit, reg_a
5B98 D005          M         bra     label
5B9A 28E8      01427     incf    WREG, W
5B9C 40E8      01428     rrncf   WREG, W
5B9E 6E11      01429     movwf   TIA_BANK
5BA0 0E01      01430     movlw   0x01
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 210


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01431     rgoto   TIA_SYSEX_Hlp_GetRelativeBank_End
5BA2 D006          M         bra     label
5BA4 01432 TIA_SYSEX_Hlp_GetRelativeBank_WT
5BA4 04E8      01433     decf    WREG, W
5BA6 BEE8      01434     btfsc   WREG, 7
5BA8 0E00      01435     movlw   0x00
5BAA 40E8      01436     rrncf   WREG, W
5BAC 6E11      01437     movwf   TIA_BANK
5BAE 0E03      01438     movlw   0x03
5BB0 01439 TIA_SYSEX_Hlp_GetRelativeBank_End
5BB0 0012      01440         return
               00388 #include "tia_ccin.inc"
               00001 ; $Id: tia_ccin.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; CC Input Handling
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  IN: index of CC parameter in WREG, value in MIOS_PARAMETER1
               00016 ;; --------------------------------------------------------------------------
5BB2 00017 TIA_CCIN_Set
5BB2 D9EE      00018         rcall   TIA_CC_TABLE_Get        ; prepare a CC action
               00019         ;; now:
               00020         ;; value     is in MIOS_PARAMETER1
               00021         ;; command   is in MIOS_PARAMETER2
               00022         ;; parameter is in FSR1 (pointer)
               00023 
               00024         ;; branch depending on command
5BB4 5004      00025         movf    MIOS_PARAMETER2, W
5BB6 0B0F      00026         andlw   0x0f
               00027         JUMPTABLE_2BYTES_UNSECURE
5BB8 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00028         rgoto   TIA_CCIN_Cmd_NOP
5BBC D00F          M         bra     label
               00029         rgoto   TIA_CCIN_Cmd_V12
5BBE D00F          M         bra     label
               00030         rgoto   TIA_CCIN_Cmd_7BIT
5BC0 D014          M         bra     label
               00031         rgoto   TIA_CCIN_Cmd_7BIT_W_PORTA
5BC2 D022          M         bra     label
               00032         rgoto   TIA_CCIN_Cmd_7BIT_4L
5BC4 D02A          M         bra     label
               00033         rgoto   TIA_CCIN_Cmd_7BIT_4U
5BC6 D02F          M         bra     label
               00034         rgoto   TIA_CCIN_Cmd_SUSKEY
5BC8 D042          M         bra     label
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 211


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00035         rgoto   TIA_CCIN_Cmd_VELOCITY
5BCA D046          M         bra     label
               00036         rgoto   TIA_CCIN_Cmd_AFTERTOUCH
5BCC D0B6          M         bra     label
               00037         rgoto   TIA_CCIN_Cmd_MODWHEEL
5BCE D0ED          M         bra     label
               00038         rgoto   TIA_CCIN_Cmd_WAVEFORM
5BD0 D127          M         bra     label
               00039     rgoto       TIA_CCIN_Cmd_NOP
5BD2 D004          M         bra     label
               00040         rgoto   TIA_CCIN_Cmd_NOP
5BD4 D003          M         bra     label
               00041         rgoto   TIA_CCIN_Cmd_PLAY_MODE
5BD6 D133          M         bra     label
               00042         rgoto   TIA_CCIN_Cmd_NOP
5BD8 D001          M         bra     label
               00043         rgoto   TIA_CCIN_Cmd_NOP
5BDA D000          M         bra     label
               00044 
               00045 ; ==========================================================================
               00046 
               00047 ;; --------------------------------------------------------------------------
5BDC 00048 TIA_CCIN_Cmd_NOP
               00049         ;; no jump to end, since no CS update is required
               00050         ;;      rgoto   TIA_CCIN_Cmd_End
5BDC 0012      00051         return
               00052 
               00053 ;; --------------------------------------------------------------------------
5BDE 00054 TIA_CCIN_Cmd_V12
5BDE 50E1      00055         movf    FSR1L, W                ; parameter contains first CC, save it
5BE0 6E05      00056         movwf   MIOS_PARAMETER3
5BE2 DFE7      00057         rcall   TIA_CCIN_Set            ; set first voice
5BE4 2A05      00058         incf    MIOS_PARAMETER3, F
5BE6 5005      00059         movf    MIOS_PARAMETER3, W
               00060         rgoto   TIA_CCIN_Set            ; set second voice
5BE8 D7E4          M         bra     label
               00061 
               00062 ;; --------------------------------------------------------------------------
5BEA 00063 TIA_CCIN_Cmd_7BIT
               00064     ;; special treatment, GSA falling -> Gate falls
5BEA 0E24      00065         movlw   (TIA_V1_BASE + TIA_Vx_MODE) & 0xff  ;; V1 MODE register
5BEC 18E1      00066     xorwf   FSR1L, W
5BEE E003      00067     bz      TIA_CCIN_Cmd_7BIT_GSA_Fall
5BF0 0E64      00068     movlw   (TIA_V2_BASE + TIA_Vx_MODE) & 0xff  ;; V2 MODE register
5BF2 18E1      00069     xorwf   FSR1L, W
5BF4 E106      00070     bnz     TIA_CCIN_Cmd_7BIT_End
5BF6 00071 TIA_CCIN_Cmd_7BIT_GSA_Fall    ;; detect fall of GSA
5BF6 B0E7      00072     btfsc   INDF1, Vx_MODE_GSA_ACTIVE
5BF8 B003      00073     btfsc   MIOS_PARAMETER1, Vx_MODE_GSA_ACTIVE
5BFA D003      00074     bra     TIA_CCIN_Cmd_7BIT_End
               00075     ;; clear gate
5BFC 06E1      00076     decf    FSR1L, F    ;; Vx STAT register
5BFE 96E7      00077     bcf     INDF1, Vx_STAT_GATE_ACTIVE
5C00 2AE1      00078     incf    FSR1L, F    ;; Vx MODE register
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 212


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5C02 00079 TIA_CCIN_Cmd_7BIT_End
               00080     ;; normal treatment
5C02 C003 FFE7 00081     movff       MIOS_PARAMETER1, INDF1
               00082     
               00083         rgoto   TIA_CCIN_Cmd_End
5C06 D163          M         bra     label
               00084     
               00085 ;; --------------------------------------------------------------------------
5C08 00086 TIA_CCIN_Cmd_7BIT_W_PORTA
5C08 9610      00087         bcf     TIA_STAT, TIA_STAT_SAVED_GIE    ; for nested IRQ disables
5C0A BEF2      00088         btfsc   INTCON, GIE
5C0C 8610      00089         bsf     TIA_STAT, TIA_STAT_SAVED_GIE
               00090         IRQ_DISABLE
5C0E 9EF2          M         bcf     INTCON, GIE
               00091 
               00092         ;; works only with TIA_Vx_TRANSPOSE,  _PITCHRANGE
5C10 C003 FFE7 00093         movff   MIOS_PARAMETER1, INDF1
               00094 
               00095 #if 0
               00096         ;; enable portamento if rate is > 0
               00097         ;; switch to TIA_Vx_PORTA_RATE
               00098         movf    FSR1L, W
               00099         andlw   0x03
               00100         iorlw   TIA_V1_PORTA_RATE & 0xfc
               00101         movwf   FSR1L
               00102         movf    INDF1, W
               00103         bz      TIA_CCIN_Cmd_7BIT_W_PORTA_End
               00104 
               00105         movf    FSR1L, W
               00106         andlw   0x03
               00107         iorlw   TIA_V1_MODE & 0xfc
               00108         movwf   FSR1L
               00109         bsf     INDF1, Vx_STAT_PORTA_ENABLE
               00110 #endif
               00111 
5C14 00112 TIA_CCIN_Cmd_7BIT_W_PORTA_End
               00113         ;;      IRQ_ENABLE
5C14 B610      00114         btfsc   TIA_STAT, TIA_STAT_SAVED_GIE    ; nested IRQ enable
5C16 8EF2      00115         bsf     INTCON, GIE
               00116         
               00117         rgoto   TIA_CCIN_Cmd_End
5C18 D15A          M         bra     label
               00118 
               00119 
               00120 ;; --------------------------------------------------------------------------
5C1A 00121 TIA_CCIN_Cmd_7BIT_4L
5C1A 0EF0      00122         movlw   0xf0
5C1C 16E7      00123         andwf   INDF1, F
5C1E 5003      00124         movf    MIOS_PARAMETER1, W
5C20 0B0F      00125         andlw   0x0f
5C22 12E7      00126         iorwf   INDF1, F
               00127         rgoto   TIA_CCIN_Cmd_End
5C24 D154          M         bra     label
               00128 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 213


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00129 ;; --------------------------------------------------------------------------
5C26 00130 TIA_CCIN_Cmd_7BIT_4U
5C26 0E0F      00131         movlw   0x0f
5C28 16E7      00132         andwf   INDF1, F
5C2A 3803      00133         swapf   MIOS_PARAMETER1, W
5C2C 0BF0      00134         andlw   0xf0
5C2E 12E7      00135         iorwf   INDF1, F
               00136         rgoto   TIA_CCIN_Cmd_End
5C30 D14E          M         bra     label
               00137 
               00138 ;; --------------------------------------------------------------------------
5C32 00139 TIA_CCIN_Cmd_7BIT_TO_7_4
5C32 0E0F      00140         movlw   0x0f
5C34 16E7      00141         andwf   INDF1, F
5C36 3403      00142         rlf     MIOS_PARAMETER1, W
5C38 0BF0      00143         andlw   0xf0
5C3A 12E7      00144         iorwf   INDF1, F
               00145         rgoto   TIA_CCIN_Cmd_End
5C3C D148          M         bra     label
               00146 
               00147 ;; --------------------------------------------------------------------------
5C3E 00148 TIA_CCIN_Cmd_7BIT_TO_3_0
5C3E 0EF0      00149         movlw   0xf0
5C40 16E7      00150         andwf   INDF1, F
5C42 3003      00151         rrf     MIOS_PARAMETER1, W
5C44 32E8      00152         rrf     WREG, F
5C46 30E8      00153         rrf     WREG, W
5C48 0B0F      00154         andlw   0x0f
5C4A 12E7      00155         iorwf   INDF1, F
               00156         rgoto   TIA_CCIN_Cmd_End
5C4C D140          M         bra     label
               00157 
               00158 ;; --------------------------------------------------------------------------
5C4E 00159 TIA_CCIN_Cmd_SUSKEY
5C4E 930C      00160         bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
5C50 5003      00161         movf    MIOS_PARAMETER1, W
5C52 A4D8      00162         skpz
5C54 830C      00163         bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
               00164 
               00165         ;rrf    MIOS_PARAMETER1, W
               00166         ;andlw  0x3f
               00167         ;movwf  TIA_KEYTRACKING, BANKED
               00168 
               00169         rgoto   TIA_CCIN_Cmd_End
5C56 D13B          M         bra     label
               00170 
               00171 ; ==========================================================================
               00172 
               00173         ;; ------------------------------------------------------------------
               00174         ;; Controller Handler Macro
               00175         ;; ------------------------------------------------------------------
               00176 TIA_CCIN_SETHLP_MACRO_DO_CTRL MACRO BASE, LAST_VALUE, DEPTH_VALUE, INIT_VALUE, ASSIGN_VALUE
               00177         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
               00178         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 214


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00179     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
               00180         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00181 
               00182     ;; Velocity calc
               00183     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
               00184     xorlw   0x40
               00185     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
               00186     
               00187     movf        BASE + DEPTH_VALUE, W, BANKED
               00188         andlw   0x3f
               00189         clrc
               00190         rlf     WREG, W
               00191     ;movwf   MIOS_PARAMETER1
               00192    
               00193         btfss   BASE + DEPTH_VALUE, 6, BANKED
               00194     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
               00195     
               00196 TIA_CCIN_CmdHlp_DoCtrl_Pos    
               00197         addlw   2
               00198     movwf   MIOS_PARAMETER1
               00199     
               00200     movf        BASE + LAST_VALUE, W, BANKED
               00201     mulwf   MIOS_PARAMETER1
               00202     clrc
               00203     rlf     PRODL, F
               00204     rlf     PRODH, W
               00205         addlw   1
               00206     movwf   MIOS_PARAMETER1
               00207     
               00208     movf        BASE + INIT_VALUE, W, BANKED
               00209     sublw   0x7f
               00210     mulwf   MIOS_PARAMETER1
               00211     rlf     PRODL, F
               00212     rlf     PRODH, W
               00213     addwf   BASE + INIT_VALUE, W, BANKED
               00214     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00215 
               00216 TIA_CCIN_CmdHlp_DoCtrl_Neg
               00217     comf    WREG, W
               00218     andlw   0x7f
               00219     addlw       2
               00220     movwf   MIOS_PARAMETER1
               00221 
               00222     movf        BASE + LAST_VALUE, W, BANKED
               00223     mulwf   MIOS_PARAMETER1
               00224     clrc
               00225     rlf     PRODL, F
               00226     rlf     PRODH, W
               00227         addlw   1
               00228     movwf   MIOS_PARAMETER1
               00229 
               00230     movf        BASE + INIT_VALUE, W, BANKED
               00231     mulwf   MIOS_PARAMETER1
               00232     rlf     PRODL, F
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 215


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00233     rlf     PRODH, W
               00234     subwf   BASE + INIT_VALUE, W, BANKED
               00235     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00236     
               00237 TIA_CCIN_CmdHlp_DoCtrl_NoDepth
               00238     movf        BASE + INIT_VALUE, W, BANKED
               00239     
               00240 TIA_CCIN_CmdHlp_DoCtrl_Cont
               00241     movwf   MIOS_PARAMETER1
               00242         movf    BASE + ASSIGN_VALUE, W, BANKED
               00243 
               00244         ENDM
               00245 
               00246 ; ==========================================================================
5C58 00247 TIA_CCIN_Cmd_VELOCITY
               00248 
5C58 C003 FFE7 00249         movff   MIOS_PARAMETER1, INDF1
5C5C 00250 TIA_CCIN_Cmd_VELOCITY_SkpCopy
5C5C 0E60      00251     movlw   TIA_V2_BASE & 0xff
5C5E 60E1      00252     cpfslt  FSR1L, ACCESS
               00253     rgoto   TIA_CCIN_Cmd_VELOCITY_A1
5C60 D035          M         bra     label
               00254     
5C62 00255 TIA_CCIN_Cmd_VELOCITY_A0
               00256 
5C62 5146      00257         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VELOCITY, W, BANKED ; exit when velocity assigned to 0
5C64 E069      00258     bz  TIA_CCIN_Cmd_VELOCITY_End
5C66 0A05      00259         xorlw   5                               ; CC#5 is Velocity Init
5C68 E067      00260         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
5C6A 5146      00261         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VELOCITY, W, BANKED
5C6C 0A0E      00262         xorlw   14                              ; CC#14 is Velocity Depth
5C6E E064      00263         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
               00264 
               00265         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_V1_BASE, TIA_Vx_LAST_VELOCITY, TIA_Vx_DEPTH_VELOCITY, TIA_Vx_INIT_VELOCITY, TIA_Vx_ASSIGN_VELOCITY
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
5C70 5149          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5C72 0A40          M     xorlw   0x40
5C74 E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5C76 5149          M     movf        BASE + DEPTH_VALUE, W, BANKED
5C78 0B3F          M         andlw   0x3f
5C7A 90D8          M         clrc
5C7C 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5C7E AD49          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5C80 D010          M         bra     label
                   M     
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 216


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5C82     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5C82 0F02          M         addlw   2
5C84 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5C86 5148          M     movf        BASE + LAST_VALUE, W, BANKED
5C88 0203          M     mulwf   MIOS_PARAMETER1
5C8A 90D8          M     clrc
5C8C 36F3          M     rlf     PRODL, F
5C8E 34F4          M     rlf     PRODH, W
5C90 0F01          M         addlw   1
5C92 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5C94 5147          M     movf        BASE + INIT_VALUE, W, BANKED
5C96 087F          M     sublw   0x7f
5C98 0203          M     mulwf   MIOS_PARAMETER1
5C9A 36F3          M     rlf     PRODL, F
5C9C 34F4          M     rlf     PRODH, W
5C9E 2547          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5CA0 D012          M         bra     label
                   M 
5CA2     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5CA2 1CE8          M     comf    WREG, W
5CA4 0B7F          M     andlw   0x7f
5CA6 0F02          M     addlw       2
5CA8 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5CAA 5148          M     movf        BASE + LAST_VALUE, W, BANKED
5CAC 0203          M     mulwf   MIOS_PARAMETER1
5CAE 90D8          M     clrc
5CB0 36F3          M     rlf     PRODL, F
5CB2 34F4          M     rlf     PRODH, W
5CB4 0F01          M         addlw   1
5CB6 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5CB8 5147          M     movf        BASE + INIT_VALUE, W, BANKED
5CBA 0203          M     mulwf   MIOS_PARAMETER1
5CBC 36F3          M     rlf     PRODL, F
5CBE 34F4          M     rlf     PRODH, W
5CC0 5D47          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5CC2 D001          M         bra     label
                   M     
5CC4     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5CC4 5147          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5CC6     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5CC6 6E03          M     movwf   MIOS_PARAMETER1
5CC8 5146          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00266 
               00267     rgoto   TIA_CCIN_Cmd_VELOCITY_Set
5CCA D035          M         bra     label
               00268     
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 217


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5CCC 00269 TIA_CCIN_Cmd_VELOCITY_A1
               00270 
5CCC 5186      00271         movf    TIA_V2_BASE + TIA_Vx_ASSIGN_VELOCITY, W, BANKED ; exit when velocity assigned to 0
5CCE E034      00272         bz      TIA_CCIN_Cmd_VELOCITY_End
5CD0 0A06      00273         xorlw   6                               ; CC#6 is Velocity Init
5CD2 E032      00274         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
5CD4 5146      00275         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VELOCITY, W, BANKED
5CD6 0A0F      00276         xorlw   15                              ; CC#15 is Velocity Depth
5CD8 E02F      00277         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
               00278 
               00279         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_V2_BASE, TIA_Vx_LAST_VELOCITY, TIA_Vx_DEPTH_VELOCITY, TIA_Vx_INIT_VELOCITY, TIA_Vx_ASSIGN_VELOCITY
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
5CDA 5189          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5CDC 0A40          M     xorlw   0x40
5CDE E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5CE0 5189          M     movf        BASE + DEPTH_VALUE, W, BANKED
5CE2 0B3F          M         andlw   0x3f
5CE4 90D8          M         clrc
5CE6 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5CE8 AD89          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5CEA D010          M         bra     label
                   M     
5CEC     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5CEC 0F02          M         addlw   2
5CEE 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5CF0 5188          M     movf        BASE + LAST_VALUE, W, BANKED
5CF2 0203          M     mulwf   MIOS_PARAMETER1
5CF4 90D8          M     clrc
5CF6 36F3          M     rlf     PRODL, F
5CF8 34F4          M     rlf     PRODH, W
5CFA 0F01          M         addlw   1
5CFC 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5CFE 5187          M     movf        BASE + INIT_VALUE, W, BANKED
5D00 087F          M     sublw   0x7f
5D02 0203          M     mulwf   MIOS_PARAMETER1
5D04 36F3          M     rlf     PRODL, F
5D06 34F4          M     rlf     PRODH, W
5D08 2587          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5D0A D012          M         bra     label
                   M 
5D0C     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5D0C 1CE8          M     comf    WREG, W
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 218


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5D0E 0B7F          M     andlw   0x7f
5D10 0F02          M     addlw       2
5D12 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5D14 5188          M     movf        BASE + LAST_VALUE, W, BANKED
5D16 0203          M     mulwf   MIOS_PARAMETER1
5D18 90D8          M     clrc
5D1A 36F3          M     rlf     PRODL, F
5D1C 34F4          M     rlf     PRODH, W
5D1E 0F01          M         addlw   1
5D20 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5D22 5187          M     movf        BASE + INIT_VALUE, W, BANKED
5D24 0203          M     mulwf   MIOS_PARAMETER1
5D26 36F3          M     rlf     PRODL, F
5D28 34F4          M     rlf     PRODH, W
5D2A 5D87          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5D2C D001          M         bra     label
                   M     
5D2E     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5D2E 5187          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5D30     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5D30 6E03          M     movwf   MIOS_PARAMETER1
5D32 5186          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00280     rgoto   TIA_CCIN_Cmd_VELOCITY_Set
5D34 D000          M         bra     label
               00281     
5D36 00282 TIA_CCIN_Cmd_VELOCITY_Set
               00283         rgoto   TIA_CCIN_Set
5D36 D73D          M         bra     label
               00284         
5D38 00285 TIA_CCIN_Cmd_VELOCITY_End
               00286         rgoto   TIA_CCIN_Cmd_End
5D38 D0CA          M         bra     label
               00287 
               00288 ;; --------------------------------------------------------------------------
5D3A 00289 TIA_CCIN_Cmd_AFTERTOUCH
5D3A C003 FFE7 00290         movff   MIOS_PARAMETER1, INDF1
               00291 
5D3E 51E8      00292         movf    TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN, W, BANKED
               00293     ;; exit when aftertouch assigned to 0
5D40 E033      00294         bz      TIA_CCIN_Cmd_AFTERTOUCH_End
5D42 0A03      00295         xorlw   3                               ; CC#3 is Aftertouch Init
5D44 E031      00296         bz      TIA_CCIN_Cmd_AFTERTOUCH_End     ; prevent endless loop
5D46 51E8      00297         movf    TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN, W, BANKED
5D48 0A0C      00298         xorlw   12                              ; CC#12 is Aftertouch Depth
5D4A E02E      00299         bz      TIA_CCIN_Cmd_AFTERTOUCH_End     ; prevent endless loop
               00300 
               00301         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_CTRL_AFTERTOUCH_BASE, TIA_CTRLx_LAST, TIA_CTRLx_DEPTH, TIA_CTRLx_INIT, TIA_CTRLx_ASSIGN
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 219


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
5D4C 51EB          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5D4E 0A40          M     xorlw   0x40
5D50 E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5D52 51EB          M     movf        BASE + DEPTH_VALUE, W, BANKED
5D54 0B3F          M         andlw   0x3f
5D56 90D8          M         clrc
5D58 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5D5A ADEB          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5D5C D010          M         bra     label
                   M     
5D5E     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5D5E 0F02          M         addlw   2
5D60 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5D62 51EA          M     movf        BASE + LAST_VALUE, W, BANKED
5D64 0203          M     mulwf   MIOS_PARAMETER1
5D66 90D8          M     clrc
5D68 36F3          M     rlf     PRODL, F
5D6A 34F4          M     rlf     PRODH, W
5D6C 0F01          M         addlw   1
5D6E 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5D70 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
5D72 087F          M     sublw   0x7f
5D74 0203          M     mulwf   MIOS_PARAMETER1
5D76 36F3          M     rlf     PRODL, F
5D78 34F4          M     rlf     PRODH, W
5D7A 25E9          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5D7C D012          M         bra     label
                   M 
5D7E     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5D7E 1CE8          M     comf    WREG, W
5D80 0B7F          M     andlw   0x7f
5D82 0F02          M     addlw       2
5D84 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5D86 51EA          M     movf        BASE + LAST_VALUE, W, BANKED
5D88 0203          M     mulwf   MIOS_PARAMETER1
5D8A 90D8          M     clrc
5D8C 36F3          M     rlf     PRODL, F
5D8E 34F4          M     rlf     PRODH, W
5D90 0F01          M         addlw   1
5D92 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5D94 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 220


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5D96 0203          M     mulwf   MIOS_PARAMETER1
5D98 36F3          M     rlf     PRODL, F
5D9A 34F4          M     rlf     PRODH, W
5D9C 5DE9          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5D9E D001          M         bra     label
                   M     
5DA0     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5DA0 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5DA2     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5DA2 6E03          M     movwf   MIOS_PARAMETER1
5DA4 51E8          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00302         rgoto   TIA_CCIN_Set
5DA6 D705          M         bra     label
               00303         
5DA8 00304 TIA_CCIN_Cmd_AFTERTOUCH_End
               00305         rgoto   TIA_CCIN_Cmd_End
5DA8 D092          M         bra     label
               00306 
               00307 ;; --------------------------------------------------------------------------
5DAA 00308 TIA_CCIN_Cmd_MODWHEEL
5DAA C003 FFE7 00309         movff   MIOS_PARAMETER1, INDF1
5DAE 51EC      00310         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED    
               00311     ;; exit when modwheel assigned to 0
5DB0 E036      00312         bz      TIA_CCIN_Cmd_MODWHEEL_End
5DB2 05EC      00313         decf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED    
               00314     ;; prevent endless loop if assigned to CC#1
5DB4 E034      00315         bz      TIA_CCIN_Cmd_MODWHEEL_End
5DB6 51EC      00316         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED
5DB8 0A02      00317         xorlw   2                               ; CC#2 is Modwheel Init
5DBA E031      00318         bz      TIA_CCIN_Cmd_MODWHEEL_End       ; prevent endless loop
5DBC 51EC      00319         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED
5DBE 0A0B      00320         xorlw   11                              ; CC#11 is Modulation Wheel Depth
5DC0 E02E      00321         bz      TIA_CCIN_Cmd_MODWHEEL_End       ; prevent endless loop
               00322 
               00323         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_CTRL_MODWHEEL_BASE, TIA_CTRLx_LAST, TIA_CTRLx_DEPTH, TIA_CTRLx_INIT, TIA_CTRLx_ASSIGN
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
5DC2 51EF          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5DC4 0A40          M     xorlw   0x40
5DC6 E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5DC8 51EF          M     movf        BASE + DEPTH_VALUE, W, BANKED
5DCA 0B3F          M         andlw   0x3f
5DCC 90D8          M         clrc
5DCE 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 221


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5DD0 ADEF          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5DD2 D010          M         bra     label
                   M     
5DD4     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5DD4 0F02          M         addlw   2
5DD6 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5DD8 51EE          M     movf        BASE + LAST_VALUE, W, BANKED
5DDA 0203          M     mulwf   MIOS_PARAMETER1
5DDC 90D8          M     clrc
5DDE 36F3          M     rlf     PRODL, F
5DE0 34F4          M     rlf     PRODH, W
5DE2 0F01          M         addlw   1
5DE4 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5DE6 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
5DE8 087F          M     sublw   0x7f
5DEA 0203          M     mulwf   MIOS_PARAMETER1
5DEC 36F3          M     rlf     PRODL, F
5DEE 34F4          M     rlf     PRODH, W
5DF0 25ED          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5DF2 D012          M         bra     label
                   M 
5DF4     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5DF4 1CE8          M     comf    WREG, W
5DF6 0B7F          M     andlw   0x7f
5DF8 0F02          M     addlw       2
5DFA 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5DFC 51EE          M     movf        BASE + LAST_VALUE, W, BANKED
5DFE 0203          M     mulwf   MIOS_PARAMETER1
5E00 90D8          M     clrc
5E02 36F3          M     rlf     PRODL, F
5E04 34F4          M     rlf     PRODH, W
5E06 0F01          M         addlw   1
5E08 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5E0A 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
5E0C 0203          M     mulwf   MIOS_PARAMETER1
5E0E 36F3          M     rlf     PRODL, F
5E10 34F4          M     rlf     PRODH, W
5E12 5DED          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5E14 D001          M         bra     label
                   M     
5E16     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5E16 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5E18     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5E18 6E03          M     movwf   MIOS_PARAMETER1
5E1A 51EC          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 222


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00324         rgoto   TIA_CCIN_Set
5E1C D6CA          M         bra     label
               00325 
5E1E 00326 TIA_CCIN_Cmd_MODWHEEL_End
               00327         rgoto   TIA_CCIN_Cmd_End
5E1E D057          M         bra     label
               00328 
               00329 ;; --------------------------------------------------------------------------
5E20 00330 TIA_CCIN_Cmd_WAVEFORM
5E20 2A03      00331     incf    MIOS_PARAMETER1, F  ;; skip 0
5E22 0E05      00332     movlw   0x05
5E24 6003      00333     cpfslt  MIOS_PARAMETER1, ACCESS     ;; skip 5
5E26 2A03      00334     incf    MIOS_PARAMETER1, F
               00335     
5E28 0E08      00336     movlw   0x08             
5E2A 6403      00337     cpfsgt  MIOS_PARAMETER1, ACCESS     ;; skip 8-11
               00338     rgoto   TIA_CCIN_Cmd_WAVEFORM_Cont
5E2C D002          M         bra     label
5E2E 0E03      00339     movlw   0x03
5E30 2603      00340     addwf   MIOS_PARAMETER1, F    
               00341 
5E32 00342 TIA_CCIN_Cmd_WAVEFORM_Cont
5E32 0E0D      00343     movlw   0x0d                ;; skip 13
5E34 6003      00344     cpfslt  MIOS_PARAMETER1, ACCESS
5E36 2A03      00345     incf    MIOS_PARAMETER1, F    
5E38 5003      00346     movf    MIOS_PARAMETER1, W     
5E3A 6EE7      00347         movwf   INDF1
               00348 
               00349         rgoto   TIA_CCIN_Cmd_End
5E3C D048          M         bra     label
               00350 
               00351 ;; --------------------------------------------------------------------------
               00352 ;TIA_CCIN_Cmd_MONO
               00353 ;       bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00354 ;       bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00355 ;       movf    MIOS_PARAMETER1, W
               00356 ;       skpz
               00357 ;       bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00358 ;       rgoto   TIA_CCIN_Cmd_End
               00359 
               00360 ;; --------------------------------------------------------------------------
5E3E 00361 TIA_CCIN_Cmd_PLAY_MODE
5E3E 910C      00362         bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00363         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00364         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00365 
               00366         ;btfsc  MIOS_PARAMETER1, 0
               00367         ;bcf    TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00368 
               00369         ;btfsc  MIOS_PARAMETER1, 1
               00370         ;bcf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00371 
5E40 B003      00372         btfsc   MIOS_PARAMETER1, 0
5E42 810C      00373         bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 223


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00374 
               00375         ;btfsc  TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00376         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00377 
               00378         rgoto   TIA_CCIN_Cmd_End    
5E44 D044          M         bra     label
               00379 
               00380 ;; --------------------------------------------------------------------------
5E46 00381 TIA_CCIN_Cmd_PlayNote
5E46 0403      00382         decf    MIOS_PARAMETER1, W      ; do nothing if 0x01 played (hold note)
5E48 E032      00383         bz      TIA_CCIN_Cmd_PlayNote_End
               00384 
5E4A 9610      00385         bcf     TIA_STAT, TIA_STAT_SAVED_GIE    ; for nested IRQ disables
5E4C BEF2      00386         btfsc   INTCON, GIE
5E4E 8610      00387         bsf     TIA_STAT, TIA_STAT_SAVED_GIE
               00388         IRQ_DISABLE
5E50 9EF2          M         bcf     INTCON, GIE
               00389 
5E52 50E1      00390         movf    FSR1L, W                ; parameter contains voice offset, calc base address
5E54 0D40      00391         mullw   TIA_Vx_RECORD_LEN
5E56 EE11 F020 00392         lfsr    FSR1, TIA_V1_BASE
5E5A 50F3      00393         movf    PRODL, W
5E5C 26E1      00394         addwf   FSR1L, F
               00395 
               00396         ;; set/clear gate bit
               00397         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_NotTB303
               00398         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_NotTB303
5E5E 00399 TIA_CCIN_Cmd_PlayNote_TB303
               00400         ;BRA_IFSET TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED, TIA_CCIN_Cmd_PlayNote_Cont
               00401         ;BRA_IFSET TIA_WT_STATE, WT_STATE_GATE, BANKED, TIA_CCIN_Cmd_PlayNote_On
               00402         ;; gate will be released by sequencer
               00403         rgoto   TIA_CCIN_Cmd_PlayNote_Cont
5E5E D012          M         bra     label
5E60 00404 TIA_CCIN_Cmd_PlayNote_NotTB303
               00405 
5E60 5003      00406         movf    MIOS_PARAMETER1, W
5E62 E104      00407         bnz     TIA_CCIN_Cmd_PlayNote_On
5E64 00408 TIA_CCIN_Cmd_PlayNote_Off
               00409         ;; clear gate bit + note and branch to end
5E64 0E03      00410         movlw   TIA_Vx_STAT
5E66 92E3      00411         bcf     PLUSW1, Vx_STAT_GATE_SET_REQ
5E68 84E3      00412         bsf     PLUSW1, Vx_STAT_GATE_CLR_REQ
               00413         rgoto   TIA_CCIN_Cmd_PlayNote_End
5E6A D021          M         bra     label
               00414 
5E6C 00415 TIA_CCIN_Cmd_PlayNote_On
               00416         ;; set gate bit
5E6C 0E03      00417         movlw   TIA_Vx_STAT
               00418         BRA_IFCLR PLUSW1, Vx_STAT_VOICE_ACTIVE, ACCESS, TIA_CCIN_Cmd_PlayNote_Cont
5E6E A0E3          M         btfss   reg, bit, reg_a
5E70 D009          M         bra     label
5E72 84E3      00419         bsf     PLUSW1, Vx_STAT_GATE_CLR_REQ
5E74 82E3      00420         bsf     PLUSW1, Vx_STAT_GATE_SET_REQ
               00421 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 224


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00422         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_On_NoTB303
               00423         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_On_NoTB303
               00424         rgoto   TIA_CCIN_Cmd_PlayNote_Cont
5E76 D006          M         bra     label
5E78 00425 TIA_CCIN_Cmd_PlayNote_On_NoTB303
5E78 D81C      00426         rcall   TIA_CCIN_Cmd_PlayNote_PHelp     ; help function for alternative portamento
               00427         ;; enable portamento if rate > 0
5E7A 0E0E      00428         movlw   TIA_Vx_PORTA_RATE
5E7C 52E3      00429         movf    PLUSW1, F
5E7E E002      00430         bz      TIA_CCIN_Cmd_PlayNote_Cont
5E80 0E03      00431         movlw   TIA_Vx_STAT
5E82 88E3      00432         bsf     PLUSW1, Vx_STAT_PORTA_ENABLE
5E84 00433 TIA_CCIN_Cmd_PlayNote_Cont
               00434 
               00435         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_NoTB303Sl
               00436         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_NoTB303Sl
5E84 00437 TIA_CCIN_Cmd_PlayNote_TB303Sl
               00438         ;; enable portamento depending on previous step
5E84 9923      00439         bcf     TIA_V1_BASE + TIA_Vx_STAT, Vx_STAT_PORTA_ENABLE, BANKED
               00440         ;btfsc  TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED
5E86 8923      00441         bsf     TIA_V1_BASE + TIA_Vx_STAT, Vx_STAT_PORTA_ENABLE, BANKED
5E88 D814      00442         rcall   TIA_CCIN_Cmd_PlayNote_PHelp     ; help function for alternative portamento
5E8A 00443 TIA_CCIN_Cmd_PlayNote_NoTB303Sl
               00444 
               00445         ;; set new note
               00446         ;; if > 0x7c, play arpeggiator note
5E8A 0E7C      00447         movlw   0x7c
5E8C 6003      00448         cpfslt  MIOS_PARAMETER1, ACCESS
               00449         rgoto TIA_CCIN_Cmd_PlayNote_Arp
5E8E D004          M         bra     label
5E90 00450 TIA_CCIN_Cmd_PlayNote_Norm
5E90 0E10      00451         movlw   TIA_Vx_NOTE
5E92 C003 FFE3 00452         movff   MIOS_PARAMETER1, PLUSW1
               00453         rgoto   TIA_CCIN_Cmd_PlayNote_End
5E96 D00B          M         bra     label
5E98 00454 TIA_CCIN_Cmd_PlayNote_Arp
5E98 0E1E      00455         movlw   TIA_Vx_ARP_NOTE_0
5E9A 2403      00456         addwf   MIOS_PARAMETER1, W
5E9C 0F84      00457         addlw   -0x7c
5E9E 50E3      00458         movf    PLUSW1, W
5EA0 E102      00459         bnz     TIA_CCIN_Cmd_PlayNote_ArpNow
5EA2 0E1E      00460         movlw   TIA_Vx_ARP_NOTE_0       ; if xth key not pressed: play first ARP note
5EA4 50E3      00461         movf    PLUSW1, W
5EA6 00462 TIA_CCIN_Cmd_PlayNote_ArpNow
5EA6 6EF3      00463         movwf   PRODL
5EA8 0E10      00464         movlw   TIA_Vx_NOTE
5EAA CFF3 FFE3 00465         movff   PRODL, PLUSW1
               00466 
5EAE 00467 TIA_CCIN_Cmd_PlayNote_End
               00468         ;;      IRQ_ENABLE
5EAE B610      00469         btfsc   TIA_STAT, TIA_STAT_SAVED_GIE    ; nested IRQ enable
5EB0 8EF2      00470         bsf     INTCON, GIE
               00471         ;;      rgoto   TIA_CCIN_Cmd_End
               00472 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 225


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00473 ;; --------
               00474 ;; help function for alternative portamento effect
5EB2 00475 TIA_CCIN_Cmd_PlayNote_PHelp
               00476         ;btfss  TIA_SE_OPTION, SE_OPTION_ENV2PORTA, BANKED
5EB2 0012      00477         return
               00478 
               00479         ;; reset ENV2
5EB4 EC44 F028 00480         call    TIA_SW_Hlp_ENV2Reset
               00481         
               00482         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
5EB8 EE21 F002 00483         lfsr    FSR2, TIA_AUDF0
5EBC 50E1      00484         movf    FSR1L, W
5EBE 0A60      00485         xorlw   TIA_V2_BASE & 0xff
5EC0 B4D8      00486         skpnz
5EC2 EE21 F003 00487         lfsr    FSR2, TIA_AUDF1
               00488 
5EC6 0E1C      00489         movlw   TIA_Vx_PORTA_FRQ_L
5EC8 CFDE FFE3 00490         movff   POSTINC2, PLUSW1
               00491         ;movlw  TIA_Vx_PORTA_FRQ_H
               00492         ;movff  POSTDEC2, PLUSW1
               00493         
5ECC 0012      00494         return
               00495 
               00496 ;; --------------------------------------------------------------------------
5ECE 00497 TIA_CCIN_Cmd_End
5ECE 0012      00498         return
               00499 
               00389 #include "tia_ccout.inc"
               00001 ; $Id: tia_ccout.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; CC Output Handling
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  reacts on a CC dump request
               00016 ;; --------------------------------------------------------------------------
5ED0 00017 TIA_CCOUT_Handler
               00018         ;; do nothing if dump has not been requested
5ED0 A410      00019         btfss   TIA_STAT, TIA_STAT_CC_DUMP_REQ
5ED2 0012      00020         return
               00021 
               00022         ;; clear request
5ED4 9410      00023         bcf     TIA_STAT, TIA_STAT_CC_DUMP_REQ
               00024 
5ED6 6A06      00025         clrf    TMP1                    ; TMP1 used as loop counter
5ED8 00026 TIA_CCOUT_Handler_Loop
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 226


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5ED8 5006      00027         movf    TMP1, W
5EDA EC84 F02F 00028         call    TIA_CCOUT_Get           ; get CC parameter value
5EDE 6E07      00029         movwf   TMP2                    ; store value in TMP2
               00030         BRA_IFSET TMP2, 7, ACCESS, TIA_CCOUT_Handler_Next ; (returns WREG[7] if non-CC value)
5EE0 BE07          M         btfsc   reg, bit, reg_a
5EE2 D00E          M         bra     label
               00031 
               00032         ;; send CC
5EE4 C120 FFE8 00033         movff   TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, WREG
5EE8 09B0      00034         iorlw   0xb0
5EEA EC24 F016 00035         call    MIOS_MIDI_TxBufferPut
5EEE 5006      00036         movf    TMP1, W
5EF0 EC24 F016 00037         call    MIOS_MIDI_TxBufferPut
5EF4 5007      00038         movf    TMP2, W
5EF6 EC24 F016 00039         call    MIOS_MIDI_TxBufferPut
               00040 
5EFA 0E08      00041         movlw   8                       ; add a short delay of 8 mS for slow sequencers
5EFC ECCE F016 00042         call    MIOS_Delay
               00043 
5F00 00044 TIA_CCOUT_Handler_Next
5F00 2A06      00045         incf    TMP1, F                 ; loop until 128 (bit 8 set)
               00046         BRA_IFCLR TMP1, 7, ACCESS, TIA_CCOUT_Handler_Loop
5F02 AE06          M         btfss   reg, bit, reg_a
5F04 D7E9          M         bra     label
               00047         
5F06 0012      00048         return
               00049 
               00050 ;; --------------------------------------------------------------------------
               00051 ;;  IN: index of CC parameter in WREG
               00052 ;;  OUT: CC value in WREG
               00053 ;; --------------------------------------------------------------------------
5F08 00054 TIA_CCOUT_Get
5F08 D843      00055         rcall   TIA_CC_TABLE_Get        ; prepare a CC action
               00056         ;; now:
               00057         ;; command   is in MIOS_PARAMETER2
               00058         ;; parameter is in FSR1 (pointer)
               00059 
5F0A 00060 TIA_CCOUT_Set_Cmd
               00061         ;; branch depending on command
5F0A 5004      00062         movf    MIOS_PARAMETER2, W
5F0C 0B0F      00063         andlw   0x0f
               00064         JUMPTABLE_2BYTES_UNSECURE
5F0E ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00065         rgoto   TIA_CCOUT_Cmd_NOP
5F12 D00F          M         bra     label
               00066         rgoto   TIA_CCOUT_Cmd_V12
5F14 D00F          M         bra     label
               00067         rgoto   TIA_CCOUT_Cmd_7BIT
5F16 D010          M         bra     label
               00068         rgoto   TIA_CCOUT_Cmd_7BIT; (W_PORTA ignored here)
5F18 D00F          M         bra     label
               00069         rgoto   TIA_CCOUT_Cmd_7BIT_4L
5F1A D010          M         bra     label
               00070         rgoto   TIA_CCOUT_Cmd_7BIT_4U
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 227


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5F1C D012          M         bra     label
               00071         rgoto   TIA_CCOUT_Cmd_SUSKEY
5F1E D01C          M         bra     label
               00072         rgoto   TIA_CCOUT_Cmd_VELOCITY
5F20 D01E          M         bra     label
               00073         rgoto   TIA_CCOUT_Cmd_AFTERTOUCH
5F22 D01E          M         bra     label
               00074         rgoto   TIA_CCOUT_Cmd_MODWHEEL
5F24 D01E          M         bra     label
               00075         rgoto   TIA_CCOUT_Cmd_WAVEFORM
5F26 D01E          M         bra     label
               00076         rgoto   TIA_CCOUT_Cmd_NOP
5F28 D004          M         bra     label
               00077         rgoto   TIA_CCOUT_Cmd_NOP
5F2A D003          M         bra     label
               00078         rgoto   TIA_CCOUT_Cmd_Cmd_PLAY_MODE
5F2C D02D          M         bra     label
               00079         rgoto   TIA_CCOUT_Cmd_NOP
5F2E D001          M         bra     label
               00080         rgoto   TIA_CCOUT_Cmd_NOP; (PLAY_NOTE)
5F30 D000          M         bra     label
               00081 
               00082 ; ==========================================================================
               00083 
               00084 
               00085 ;; --------------------------------------------------------------------------
5F32 00086 TIA_CCOUT_Cmd_NOP
5F32 0012      00087         return
               00088 
               00089 ;; --------------------------------------------------------------------------
5F34 00090 TIA_CCOUT_Cmd_V12
5F34 50E1      00091         movf    FSR1L, W                ; parameter contains first CC, only return this parameter!
               00092         rgoto   TIA_CCOUT_Get
5F36 D7E8          M         bra     label
               00093 
               00094 ;; --------------------------------------------------------------------------
5F38 00095 TIA_CCOUT_Cmd_7BIT
5F38 50E7      00096         movf    INDF1, W
5F3A 0012      00097         return
               00098 
               00099 ;; --------------------------------------------------------------------------
5F3C 00100 TIA_CCOUT_Cmd_7BIT_4L
5F3C 50E7      00101         movf    INDF1, W
5F3E 0B0F      00102         andlw   0x0f
5F40 0012      00103         return
               00104 
               00105 ;; --------------------------------------------------------------------------
5F42 00106 TIA_CCOUT_Cmd_7BIT_4U
5F42 38E7      00107         swapf   INDF1, W
5F44 0B0F      00108         andlw   0x0f
5F46 0012      00109         return
               00110 
               00111 ;; --------------------------------------------------------------------------
5F48 00112 TIA_CCOUT_Cmd_7BIT_TO_7_4
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 228


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5F48 30E7      00113         rrf     INDF1, W
5F4A 0B78      00114         andlw   0x78
5F4C 0012      00115         return
               00116 
               00117 ;; --------------------------------------------------------------------------
5F4E 00118 TIA_CCOUT_Cmd_7BIT_TO_3_0
5F4E 34E7      00119         rlf     INDF1, W
5F50 36E8      00120         rlf     WREG, F
5F52 34E8      00121         rlf     WREG, W
5F54 0B78      00122         andlw   0x78
5F56 0012      00123         return
               00124 
               00125 ;; --------------------------------------------------------------------------
5F58 00126 TIA_CCOUT_Cmd_SUSKEY
               00127         ;rrf    TIA_KEYTRACKING, W, BANKED
               00128         ;andlw  0x7e
               00129 
5F58 B30C      00130         btfsc   TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
5F5A 0E01      00131         movlw 0x01
5F5C 0012      00132         return
               00133 
               00134 ;; --------------------------------------------------------------------------
5F5E 00135 TIA_CCOUT_Cmd_VELOCITY
               00136         rgoto   TIA_CCOUT_Cmd_7BIT
5F5E D7EC          M         bra     label
               00137 
               00138 ;; --------------------------------------------------------------------------
5F60 00139 TIA_CCOUT_Cmd_AFTERTOUCH
               00140         rgoto   TIA_CCOUT_Cmd_7BIT
5F60 D7EB          M         bra     label
               00141 
               00142 ;; --------------------------------------------------------------------------
5F62 00143 TIA_CCOUT_Cmd_MODWHEEL
               00144         rgoto   TIA_CCOUT_Cmd_7BIT
5F62 D7EA          M         bra     label
               00145 
               00146 ;; --------------------------------------------------------------------------
5F64 00147 TIA_CCOUT_Cmd_WAVEFORM
5F64 50E7      00148         movf    INDF1, W
5F66 0B0F      00149     andlw   0x0f
5F68 6E03      00150     movwf   MIOS_PARAMETER1
5F6A 0E0D      00151     movlw   0x0d                ;; skip 13
5F6C 6003      00152     cpfslt  MIOS_PARAMETER1
5F6E 0603      00153     decf    MIOS_PARAMETER1, F 
               00154 
5F70 0E08      00155     movlw   0x08             
5F72 6403      00156     cpfsgt  MIOS_PARAMETER1     ;; skip 8-11
               00157     rgoto   TIA_CCOUT_Cmd_WAVEFORM_Cont
5F74 D002          M         bra     label
5F76 0E03      00158     movlw   0x03
5F78 5E03      00159     subwf   MIOS_PARAMETER1, F    
               00160 
5F7A 00161 TIA_CCOUT_Cmd_WAVEFORM_Cont   
               00162 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 229


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5F7A 0E05      00163     movlw   0x05
5F7C 6003      00164     cpfslt  MIOS_PARAMETER1     ;; skip 5
5F7E 0603      00165     decf    MIOS_PARAMETER1, F
               00166     
5F80 0603      00167     decf    MIOS_PARAMETER1, F  ;; skip 0
5F82 5003      00168     movf        MIOS_PARAMETER1, W
               00169 
5F84 0012      00170         return
               00171 
               00172 ;; --------------------------------------------------------------------------
5F86 00173 TIA_CCOUT_Cmd_MONO
5F86 0012      00174         return                  ; (ignored)
               00175 
               00176 ;; --------------------------------------------------------------------------
5F88 00177 TIA_CCOUT_Cmd_Cmd_PLAY_MODE
5F88 0E00      00178         movlw   0x00
               00179         ;btfss  TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00180         ;movlw 0x01
               00181         ;btfss  TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00182         ;movlw 0x03
5F8A B10C      00183         btfsc   TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
5F8C 0E01      00184         movlw 0x01
5F8E 0012      00185         return
               00390 #include "tia_cc_table.inc"
               00001 ; $Id: tia_cc_table.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; CC Table
               00005 ; used by tia_ccin.inc and tia_ccout.inc
               00006 ;
               00007 ; ==========================================================================
               00008 ;
               00009 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00010 ;  Licensed for personal non-commercial use only.
               00011 ;  All other rights reserved.
               00012 ; 
               00013 ; ==========================================================================
               00014 
               00015 
  00000000     00016 SET_CC_NOP          EQU 0x00
  00000001     00017 SET_CC_V12              EQU     0x01
  00000002     00018 SET_CC_7BIT         EQU 0x02
  00000003     00019 SET_CC_7BIT_W_PORTA     EQU     0x03
  00000004     00020 SET_CC_7BIT_4L          EQU     0x04
  00000005     00021 SET_CC_7BIT_4U          EQU     0x05
  00000006     00022 SET_CC_SUSKEY           EQU     0x06
  00000007     00023 SET_CC_VELOCITY         EQU     0x07
  00000008     00024 SET_CC_AFTERTOUCH       EQU     0x08
  00000009     00025 SET_CC_MODWHEEL         EQU     0x09
  0000000A     00026 SET_CC_WAVEFORM         EQU     0x0a
  0000000B     00027 SET_CC_CTRL_4L      EQU 0x0b
  0000000C     00028 SET_CC_CTRL_4U      EQU 0x0c
  0000000D     00029 SET_CC_PLAY_MODE    EQU 0x0d
  0000000E     00030 SET_CC_DEBUG        EQU 0x0e
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 230


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  0000000F     00031 SET_CC_PLAY_NOTE    EQU 0x0f
               00032 
               00033 ;; --------------------------------------------------------------------------
               00034 ;;  IN: index of CC parameter in WREG
               00035 ;;  OUT: reads CC table and returns command in MIOS_PARAMETER2 and parameter
               00036 ;; --------------------------------------------------------------------------
5F90 00037 TIA_CC_TABLE_Get
               00038         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
5F90 0101          M         movlb   HIGH(reg)
5F92 EE11 F000 00039         lfsr    FSR1, TIA_BASE          ; prepare FSR1
               00040 
5F96 90D8      00041         clrc
5F98 34E8      00042         rlf     WREG, W
5F9A 0FB2      00043         addlw   TIA_CC_TABLE & 0xff
5F9C 6EF6      00044         movwf   TBLPTRL
5F9E 6AF7      00045         clrf    TBLPTRH
5FA0 0E5F      00046         movlw   TIA_CC_TABLE >> 8
5FA2 22F7      00047         addwfc  TBLPTRH, F
               00048 
5FA4 0009      00049         tblrd*+
5FA6 CFF5 F004 00050         movff   TABLAT, MIOS_PARAMETER2 ; -> command
5FAA 0009      00051         tblrd*+
5FAC CFF5 FFE1 00052         movff   TABLAT, FSR1L           ; -> parameter
5FB0 0012      00053         return
               00054 
               00055 
               00056 ; ==========================================================================
               00057 
5FB2 00058 TIA_CC_TABLE
               00059         ;; 0x00-0x0f
5FB2 0000      00060         db      SET_CC_NOP,                             0x00
5FB4 EE09      00061         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_LAST) & 0xff
5FB6 ED09      00062         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_INIT) & 0xff
5FB8 E908      00063         db      SET_CC_AFTERTOUCH,                              (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_INIT) & 0xff
5FBA 0501      00064         db      SET_CC_V12,                 0x05
5FBC 4707      00065         db      SET_CC_VELOCITY,                (TIA_V1_BASE + TIA_Vx_INIT_VELOCITY) & 0xff
5FBE 8707      00066         db      SET_CC_VELOCITY,                                (TIA_V2_BASE + TIA_Vx_INIT_VELOCITY) & 0xff
5FC0 0B02      00067         db      SET_CC_7BIT,                                    TIA_MASTER_VOL & 0xff    
5FC2 0901      00068         db      SET_CC_V12,                 0x09
5FC4 2F02      00069         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_VOLUME) & 0xff
5FC6 6F02      00070         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_VOLUME) & 0xff
5FC8 EF09      00071         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_DEPTH) & 0xff
5FCA EB08      00072         db      SET_CC_AFTERTOUCH,                              (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_DEPTH) & 0xff
5FCC 0E01      00073         db      SET_CC_V12,                 0x0e
5FCE 4902      00074         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_DEPTH_VELOCITY) & 0xff
5FD0 8902      00075         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_DEPTH_VELOCITY) & 0xff
               00076 
               00077         ;; 0x10-0x1f
5FD2 1101      00078         db      SET_CC_V12,                 0x11
5FD4 000A      00079         db      SET_CC_WAVEFORM,                TIA_AUDC0 & 0x0f
5FD6 010A      00080         db      SET_CC_WAVEFORM,                TIA_AUDC1 & 0x0f
5FD8 1401      00081         db      SET_CC_V12,                 0x14
5FDA 2402      00082         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_MODE) & 0xff
5FDC 6402      00083         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_MODE) & 0xff
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 231


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5FDE 1701      00084         db      SET_CC_V12,                 0x17
5FE0 2C03      00085         db      SET_CC_7BIT_W_PORTA,                    (TIA_V1_BASE + TIA_Vx_TRANSPOSE) & 0xff
5FE2 6C03      00086         db      SET_CC_7BIT_W_PORTA,                    (TIA_V2_BASE + TIA_Vx_TRANSPOSE) & 0xff
5FE4 1A01      00087         db      SET_CC_V12,                 0x1a
5FE6 2D03      00088         db      SET_CC_7BIT_W_PORTA,                    (TIA_V1_BASE + TIA_Vx_PITCHRANGE) & 0xff
5FE8 6D03      00089         db      SET_CC_7BIT_W_PORTA,                    (TIA_V2_BASE + TIA_Vx_PITCHRANGE) & 0xff
5FEA 1D01      00090         db      SET_CC_V12,                 0x1d
5FEC 2E02      00091         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_PORTA_RATE) & 0xff
5FEE 6E02      00092         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_PORTA_RATE) & 0xff
5FF0 2001      00093         db      SET_CC_V12,                 0x20
               00094 
               00095         ;; 0x20-0x2f
5FF2 3302      00096         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_ARP_RATE) & 0xff
5FF4 7302      00097         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_ARP_RATE) & 0xff
5FF6 2301      00098         db      SET_CC_V12,                 0x23
5FF8 3102      00099         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_NOTE_DELAY) & 0xff
5FFA 7102      00100         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_NOTE_DELAY) & 0xff
5FFC 2601      00101         db      SET_CC_V12,                 0x26
5FFE 2502      00102         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KEY_OFFSET) & 0xff
6000 6502      00103         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KEY_OFFSET) & 0xff
6002 2901      00104         db      SET_CC_V12,                 0x29
6004 2602      00105         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KEY_LENGTH) & 0xff
6006 6602      00106         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KEY_LENGTH) & 0xff
6008 2C01      00107         db      SET_CC_V12,                 0x2c
600A 4602      00108         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_ASSIGN_VELOCITY) & 0xff
600C 8602      00109         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_ASSIGN_VELOCITY) & 0xff
600E 2F01      00110         db      SET_CC_V12,                 0x2f
6010 4A02      00111         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_ENV_OPTION) & 0xff
               00112  
               00113     ;; 0x30-0x3f    
6012 8A02      00114         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_ENV_OPTION) & 0xff
6014 3201      00115     db  SET_CC_V12,                 0x32
6016 C402      00116         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_DEPTH) & 0xff
6018 CF02      00117         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_DEPTH) & 0xff
601A 3501      00118     db  SET_CC_V12,                                     0x35
601C C302      00119         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_CURVE) & 0xff
601E CE02      00120         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_CURVE) & 0xff
6020 3801      00121     db  SET_CC_V12,                                     0x38
6022 BF02      00122         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_ATTACK) & 0xff
6024 CA02      00123     db  SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_ATTACK) & 0xff
6026 3B01      00124     db  SET_CC_V12,                                     0x3b
6028 C002      00125     db  SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_DECAY) & 0xff
602A CB02      00126         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_DECAY) & 0xff  
602C 3E01      00127         db      SET_CC_V12,                                     0x3e
602E C102      00128         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_SUSTAIN) & 0xff
6030 CC02      00129         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_SUSTAIN) & 0xff
               00130     
               00131     ;; 0x40-0x4f 
6032 4101      00132         db      SET_CC_V12,                                     0x41
6034 C202      00133         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_RELEASE) & 0xff
6036 CD02      00134         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_RELEASE) & 0xff
6038 4400      00135     db  SET_CC_NOP,                                     0x44
603A 4B00      00136     db  SET_CC_NOP,                     (TIA_V1_BASE + TIA_Vx_OPTION) & 0xff
603C 8B02      00137     db  SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_OPTION) & 0xff
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 232


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
603E 4701      00138         db      SET_CC_V12,                 0x47
6040 4C02      00139     db  SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_WBANK) & 0xff
6042 8C02      00140     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_WBANK) & 0xff
6044 4A01      00141         db      SET_CC_V12,                 0x4a
6046 4D02      00142     db  SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_WT) & 0xff
6048 8D02      00143     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_WT) & 0xff
604A 4D01      00144         db      SET_CC_V12,                 0x4d
604C 4F02      00145     db  SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_WT_RATE) & 0xff
604E 8F02      00146     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_WT_RATE) & 0xff
6050 5001      00147     db  SET_CC_V12,                 0x50
               00148     
               00149     ;; 0x40-0x4f 
6052 5702      00150     db  SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KBANK) & 0xff
6054 9702      00151     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KBANK) & 0xff
6056 5301      00152         db      SET_CC_V12,                 0x53
6058 5802      00153     db  SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KIT) & 0xff
605A 9802      00154     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KIT) & 0xff
605C 0000      00155     db  SET_CC_NOP,                     0x00
605E 1F02      00156         db      SET_CC_7BIT,                                    TIA_MOD_SYNC & 0xff
6060 5801      00157         db      SET_CC_V12,                                     0x58
6062 3702      00158         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_AMP_MOD) & 0xff
6064 7702      00159         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_AMP_MOD) & 0xff
6066 5B01      00160         db      SET_CC_V12,                                     0x5b
6068 3602      00161         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_PITCH_MOD) & 0xff
606A 7602      00162         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_PITCH_MOD) & 0xff
606C A002      00163     db  SET_CC_7BIT,                            (TIA_LFO1_BASE + TIA_LFOx_MODE) & 0xff
606E A702      00164         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_MODE) & 0xff  
6070 AE02      00165         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_MODE) & 0xff
               00166     
               00167         ;; 0x60-0x6f
6072 B502      00168         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_MODE) & 0xff
6074 A102      00169         db      SET_CC_7BIT,                (TIA_LFO1_BASE + TIA_LFOx_RATE) & 0xff
6076 A802      00170         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_RATE) & 0xff
6078 AF02      00171         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_RATE) & 0xff
607A B602      00172         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_RATE) & 0xff      
607C A402      00173         db      SET_CC_7BIT,                            (TIA_LFO1_BASE + TIA_LFOx_DEPTH) & 0xff
607E AB02      00174         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_DEPTH) & 0xff
6080 B202      00175         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_DEPTH) & 0xff
6082 B902      00176         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_DEPTH) & 0xff
6084 DA02      00177         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_DEPTH) & 0xff
6086 E502      00178         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_DEPTH) & 0xff
6088 D902      00179     db  SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_CURVE) & 0xff
608A E402      00180         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_CURVE) & 0xff
608C D502      00181         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_ATTACK) & 0xff
608E E002      00182         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_ATTACK) & 0xff
6090 D602      00183         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_DECAY) & 0xff
               00184     
               00185         ;; 0x70-0x7f 
6092 E102      00186         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_DECAY) & 0xff
6094 D702      00187         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_SUSTAIN) & 0xff
6096 E202      00188         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_SUSTAIN) & 0xff
6098 D802      00189         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_RELEASE) & 0xff
609A E302      00190         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_RELEASE) & 0xff
609C 1E02      00191         db      SET_CC_7BIT,                    TIA_ENVx_CURVES & 0xff
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 233


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
609E 0000      00192     db  SET_CC_NOP,                                     0x00
60A0 EC02      00193     db  SET_CC_7BIT,                    (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN) & 0xff
60A2 E802      00194         db      SET_CC_7BIT,                    (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN) & 0xff
60A4 7A01      00195         db      SET_CC_V12,                                     0x7a
60A6 000F      00196         db      SET_CC_PLAY_NOTE,                               0x00; (Voice 1)
60A8 010F      00197         db      SET_CC_PLAY_NOTE,                               0x01; (Voice 2)
60AA 0000      00198     db  SET_CC_NOP,                                     0x00
60AC F004      00199         db      SET_CC_7BIT_4L,                                 TIA_MIDI_SYNC & 0xff
60AE 0000      00200     db  SET_CC_NOP,                                     0x00
60B0 000D      00201         db      SET_CC_PLAY_MODE,                               0x00
               00202 
               00203 ; ==========================================================================
               00391 #include "tia_sysex_table.inc"
               00001 ; $Id: tia_sysex_table.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; SysEx reference table
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  IN: index of SysEx entry (0x00-0xff) in WREG
               00016 ;;  OUT: appr. CC number in WREG - if [7] set, no CC available
               00017 ;; --------------------------------------------------------------------------
60B2 00018 TIA_SYSEX_TABLE_Get
60B2 BEE8      00019         btfsc   WREG, 7; Wavtable area: return 0xff
60B4 0CFF      00020         retlw 0xff                      
               00021 
60B6 0FC6      00022         addlw   TIA_SYSEX_TABLE & 0xff                  ; calc: TIA_SYSEX_TABLE + index
60B8 6EF6      00023         movwf   TBLPTRL                                 ; result in TBLPTR[LH]
60BA 6AF7      00024         clrf    TBLPTRH
60BC 0E60      00025         movlw   (TIA_SYSEX_TABLE >> 8) & 0xff
60BE 22F7      00026         addwfc  TBLPTRH, F
60C0 0008      00027         tblrd*                                          ; read from table
60C2 50F5      00028         movf    TABLAT, W                               ; return table entry
60C4 0012      00029         return
               00030 
               00031 
               00032         ;; SyxTab maps the SysEx offset to the CC number
60C6 00033 TIA_SYSEX_TABLE
               00034         ;; 0x00-0x0f
60C6 8180      00035         db      0x80, 0x81      ; Patch Name
60C8 8382      00036         db      0x82, 0x83
60CA 8584      00037         db      0x84, 0x85
60CC 8786      00038         db      0x86, 0x87
60CE 8988      00039         db      0x88, 0x89
60D0 8B8A      00040         db      0x8a, 0x8b
60D2 8D8C      00041         db      0x8c, 0x8d
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 234


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
60D4 8F8E      00042         db      0x8e, 0x8f
               00043 
               00044         ;; 0x10-0x1f
60D6 7F07      00045         db      0x07, 0x7f      ; Master Volume, Play Mode
60D8 737B      00046         db      0x7b, 0x73      ; SusKey, ENVx curves
60DA 567D      00047         db      0x7d, 0x56      ; MIDI Sync, Modulation Sync 
60DC FFFF      00048         db      0xff, 0xff      ; 
60DE FFFF      00049     db  0xff, 0xff      ; 
60E0 0277      00050         db      0x77, 0x02      ; Modulation Assign, Modulation Init Value
60E2 780B      00051         db      0x0b, 0x78      ; Modulation Depth, Aftertouch Assign
60E4 0C03      00052     db  0x03, 0x0c      ; Aftertouch Init Value, Aftertouch Depth       
               00053 
               00054         ;; 0x20-0x2f 
               00055     ;; Voice 1 (AUD0)
60E6 1709      00056         db      0x09, 0x17      ; V1 Volume, V1 Transpose
60E8 1411      00057         db      0x11, 0x14      ; V1 Waveform, V1 Mo0x24de
60EA 1D1A      00058         db      0x1a, 0x1d      ; V1 PitchRange, V1 Portamento
60EC 2320      00059         db      0x20, 0x23      ; V1 Arp Rate, V1 Delay
60EE 2926      00060         db      0x26, 0x29      ; V1 Key Offset, V1 Key Length
60F0 9190      00061         db      0x90, 0x91      ; Split V1 Lower, Split V1 Upper
60F2 052C      00062         db      0x2c, 0x05      ; V1 Velocity Assign, V1 Velocity Init Value
60F4 2F0E      00063         db      0x0e, 0x2f      ; V1 Velocity Depth, ENVAUD0 Options
               00064     ;; 0x30-0x3f    
60F6 3532      00065     db  0x32, 0x35      ; ENVAUD0 Depth, ENVAUD0 Curve
60F8 3B38      00066     db  0x38, 0x3b      ; ENVAUD0 Attack, ENVAUD0 Decay
60FA 413E      00067         db      0x3e, 0x41      ; ENVAUD0 Sustain, ENVAUD0 Release
60FC 4744      00068         db      0x44, 0x47      ; V1 Sofware Options, V1 Wavetable Bank
60FE 4D4A      00069         db      0x4a, 0x4d      ; V1 Wavetable Patch, V1 Wavetable Rate
6100 5350      00070         db      0x50, 0x53      ; V1 Kit Bank, V1 Kit Patch
6102 5B58      00071         db      0x58, 0x5b      ; V1 Assigned Amplitude Mods, V1 Assigned Pitch Mods
6104 FFFF      00072         db      0xff, 0xff      ;
               00073     
               00074     ;; Voice 2 (AUD1)
               00075         ;; 0x40-0x4f
6106 180A      00076         db      0x0a, 0x18      ; V2 Volume, V2 Transpose
6108 1512      00077         db      0x12, 0x15      ; V2 Waveform, V2 Mode
610A 1E1B      00078         db      0x1b, 0x1e      ; V2 PitchRange, V2 Portamento
610C 2421      00079         db      0x21, 0x24      ; V2 Arp Rate, V2 Delay
610E 2A27      00080         db      0x27, 0x2a      ; V2 Key Offset, V2 Key Length
6110 9291      00081         db      0x91, 0x92      ; Split V2 Lower, Split V2 Upper
6112 062D      00082         db      0x2d, 0x06      ; V2 Velocity Assign, V2 Velocity Init Value
6114 300F      00083         db      0x0f, 0x30      ; V2 Velocity Depth, ENVAUD1 Options
               00084     ;; 0x50-0x5f    
6116 3633      00085     db  0x33, 0x36      ; ENVAUD1 Depth, ENVAUD1 Curve
6118 3C39      00086     db  0x39, 0x3c      ; ENVAUD1 Attack, ENVAUD1 Decay
611A 423F      00087         db      0x3f, 0x42      ; ENVAUD1 Sustain, ENVAUD1 Release
611C 4845      00088         db      0x45, 0x48      ; V2 Sofware Options, V2 Wavetable Bank
611E 4E4B      00089         db      0x4b, 0x4e      ; V2 Wavetable Patch, V2 Wavetable Rate
6120 5451      00090         db      0x51, 0x54      ; V2 Kit Bank, V2 Kit Patch
6122 5C59      00091         db      0x59, 0x5c      ; V2 Assigned Amplitude Mods, V2 Assigned Pitch Mods
6124 FFFF      00092     db  0xff, 0xff      ;
               00093 
               00094         ;; 0x60-0x77
6126 615D      00095         db      0x5d, 0x61      ; LFO1 Mode, LFO1 Rate
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 235


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6128 5E65      00096         db      0x65, 0x5e      ; LFO1 Depth, LFO2 Mode
612A 6662      00097         db      0x62, 0x66      ; LFO2 Rate, LFO2 Depth
612C 635F      00098         db      0x5f, 0x63      ; LFO3 Mode, LFO3 Rate
612E 6067      00099         db      0x67, 0x60      ; LFO3 Depth, LFO4 Mode
6130 6864      00100         db      0x64, 0x68      ; LFO4 Rate, LFO4 Depth
               00101     
6132 6B69      00102         db      0x69, 0x6b      ; ENV1 Depth, ENV1 Curve
6134 6F6D      00103         db      0x6d, 0x6f      ; ENV1 Attack, ENV1 Decay
6136 7371      00104         db      0x71, 0x73      ; ENV1 Sustain, ENV1 Release
6138 6C6A      00105         db      0x6a, 0x6c      ; ENV2 Depth, ENV2 Curve
613A 706E      00106         db      0x6e, 0x70      ; ENV2 Attack, ENV2 Decay
613C 7472      00107         db      0x72, 0x74      ; ENV2 Sustain, ENV2 Release
               00108 
               00109 
613E FFFF      00110         db      0xff, 0xff      ;
6140 FFFF      00111         db      0xff, 0xff      ;
               00112     
6142 FFFF      00113         db      0xff, 0xff      ; CFG Reserved
6144 FFFF      00114         db      0xff, 0xff  ; CFG Reserved
               00115     
               00392 #include "tia_env_table.inc"
               00001 ; $Id: tia_env_table.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Envelope Table
               00005 ; generated with env_delay.pl - calculates sweep from 800 uS to 30s
               00006 ;
               00007 ; ==========================================================================
               00008 ;
               00009 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00010 ;  Licensed for personal non-commercial use only.
               00011 ;  All other rights reserved.
               00012 ; 
               00013 ; ==========================================================================
               00014 
               00015 ;; --------------------------------------------------------------------------
               00016 ;; In: index (0x00-0x7f) in WREG
               00017 ;; Out: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               00018 ;; --------------------------------------------------------------------------
6146 00019 TIA_ENV_TABLE_Get
6146 90D8      00020         clrc
6148 34E8      00021         rlf     WREG, W
614A 0F64      00022         addlw   TIA_ENV_TABLE & 0xff
614C 6EF6      00023         movwf   TBLPTRL
614E 6AF7      00024         clrf    TBLPTRH
6150 0E61      00025         movlw   TIA_ENV_TABLE >> 8
6152 22F7      00026         addwfc  TBLPTRH, F
               00027 
6154 0009      00028         tblrd*+
6156 CFF5 F003 00029         movff   TABLAT, MIOS_PARAMETER1
615A 0009      00030         tblrd*+
615C CFF5 F004 00031         movff   TABLAT, MIOS_PARAMETER2
6160 5003      00032         movf    MIOS_PARAMETER1, W
6162 0012      00033         return
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 236


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00034 
               00035 ;   x |  Time/s | ADD_H | ADD_L 
               00036 ; ----+---------+-------+-------
               00037 ;   1 |  0.0008 |   256 |     0
               00038 ;   2 |  0.0010 |   202 |   196
               00039 ;   3 |  0.0016 |   124 |   217
               00040 ;   4 |  0.0027 |    76 |    21
               00041 ;   5 |  0.0042 |    49 |    41
               00042 ;   6 |  0.0061 |    33 |   198
               00043 ;   7 |  0.0084 |    24 |   105
               00044 ;   8 |  0.0111 |    18 |    97
               00045 ;   9 |  0.0143 |    14 |    74
               00046 ;  10 |  0.0180 |    11 |   103
               00047 ;  11 |  0.0220 |     9 |    76
               00048 ;  12 |  0.0265 |     7 |   183
               00049 ;  13 |  0.0315 |     6 |   128
               00050 ;  14 |  0.0369 |     5 |   139
               00051 ;  15 |  0.0428 |     4 |   200
               00052 ;  16 |  0.0492 |     4 |    41
               00053 ;  17 |  0.0560 |     3 |   167
               00054 ;  18 |  0.0634 |     3 |    59
               00055 ;  19 |  0.0712 |     2 |   224
               00056 ;  20 |  0.0796 |     2 |   147
               00057 ;  21 |  0.0884 |     2 |    80
               00058 ;  22 |  0.0978 |     2 |    23
               00059 ;  23 |  0.1078 |     1 |   230
               00060 ;  24 |  0.1183 |     1 |   187
               00061 ;  25 |  0.1294 |     1 |   149
               00062 ;  26 |  0.1411 |     1 |   115
               00063 ;  27 |  0.1533 |     1 |    85
               00064 ;  28 |  0.1662 |     1 |    59
               00065 ;  29 |  0.1798 |     1 |    35
               00066 ;  30 |  0.1940 |     1 |    14
               00067 ;  31 |  0.2088 |     0 |   251
               00068 ;  32 |  0.2244 |     0 |   233
               00069 ;  33 |  0.2407 |     0 |   217
               00070 ;  34 |  0.2578 |     0 |   203
               00071 ;  35 |  0.2756 |     0 |   190
               00072 ;  36 |  0.2942 |     0 |   178
               00073 ;  37 |  0.3136 |     0 |   167
               00074 ;  38 |  0.3339 |     0 |   157
               00075 ;  39 |  0.3550 |     0 |   147
               00076 ;  40 |  0.3771 |     0 |   139
               00077 ;  41 |  0.4001 |     0 |   131
               00078 ;  42 |  0.4241 |     0 |   123
               00079 ;  43 |  0.4492 |     0 |   116
               00080 ;  44 |  0.4753 |     0 |   110
               00081 ;  45 |  0.5024 |     0 |   104
               00082 ;  46 |  0.5308 |     0 |    98
               00083 ;  47 |  0.5603 |     0 |    93
               00084 ;  48 |  0.5910 |     0 |    88
               00085 ;  49 |  0.6231 |     0 |    84
               00086 ;  50 |  0.6565 |     0 |    79
               00087 ;  51 |  0.6913 |     0 |    75
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 237


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00088 ;  52 |  0.7275 |     0 |    72
               00089 ;  53 |  0.7653 |     0 |    68
               00090 ;  54 |  0.8046 |     0 |    65
               00091 ;  55 |  0.8456 |     0 |    62
               00092 ;  56 |  0.8883 |     0 |    59
               00093 ;  57 |  0.9328 |     0 |    56
               00094 ;  58 |  0.9792 |     0 |    53
               00095 ;  59 |  1.0276 |     0 |    51
               00096 ;  60 |  1.0780 |     0 |    48
               00097 ;  61 |  1.1305 |     0 |    46
               00098 ;  62 |  1.1854 |     0 |    44
               00099 ;  63 |  1.2425 |     0 |    42
               00100 ;  64 |  1.3021 |     0 |    40
               00101 ;  65 |  1.3643 |     0 |    38
               00102 ;  66 |  1.4292 |     0 |    36
               00103 ;  67 |  1.4970 |     0 |    35
               00104 ;  68 |  1.5677 |     0 |    33
               00105 ;  69 |  1.6415 |     0 |    31
               00106 ;  70 |  1.7186 |     0 |    30
               00107 ;  71 |  1.7991 |     0 |    29
               00108 ;  72 |  1.8832 |     0 |    27
               00109 ;  73 |  1.9710 |     0 |    26
               00110 ;  74 |  2.0629 |     0 |    25
               00111 ;  75 |  2.1589 |     0 |    24
               00112 ;  76 |  2.2592 |     0 |    23
               00113 ;  77 |  2.3642 |     0 |    22
               00114 ;  78 |  2.4740 |     0 |    21
               00115 ;  79 |  2.5890 |     0 |    20
               00116 ;  80 |  2.7092 |     0 |    19
               00117 ;  81 |  2.8352 |     0 |    18
               00118 ;  82 |  2.9670 |     0 |    17
               00119 ;  83 |  3.1051 |     0 |    16
               00120 ;  84 |  3.2498 |     0 |    16
               00121 ;  85 |  3.4015 |     0 |    15
               00122 ;  86 |  3.5605 |     0 |    14
               00123 ;  87 |  3.7272 |     0 |    14
               00124 ;  88 |  3.9020 |     0 |    13
               00125 ;  89 |  4.0855 |     0 |    12
               00126 ;  90 |  4.2781 |     0 |    12
               00127 ;  91 |  4.4802 |     0 |    11
               00128 ;  92 |  4.6925 |     0 |    11
               00129 ;  93 |  4.9155 |     0 |    10
               00130 ;  94 |  5.1498 |     0 |    10
               00131 ;  95 |  5.3961 |     0 |     9
               00132 ;  96 |  5.6550 |     0 |     9
               00133 ;  97 |  5.9273 |     0 |     8
               00134 ;  98 |  6.2138 |     0 |     8
               00135 ;  99 |  6.5153 |     0 |     8
               00136 ; 100 |  6.8327 |     0 |     7
               00137 ; 101 |  7.1670 |     0 |     7
               00138 ; 102 |  7.5190 |     0 |     6
               00139 ; 103 |  7.8900 |     0 |     6
               00140 ; 104 |  8.2811 |     0 |     6
               00141 ; 105 |  8.6934 |     0 |     6
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 238


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00142 ; 106 |  9.1283 |     0 |     5
               00143 ; 107 |  9.5871 |     0 |     5
               00144 ; 108 | 10.0714 |     0 |     5
               00145 ; 109 | 10.5827 |     0 |     4
               00146 ; 110 | 11.1227 |     0 |     4
               00147 ; 111 | 11.6932 |     0 |     4
               00148 ; 112 | 12.2961 |     0 |     4
               00149 ; 113 | 12.9335 |     0 |     4
               00150 ; 114 | 13.6076 |     0 |     3
               00151 ; 115 | 14.3208 |     0 |     3
               00152 ; 116 | 15.0756 |     0 |     3
               00153 ; 117 | 15.8746 |     0 |     3
               00154 ; 118 | 16.7207 |     0 |     3
               00155 ; 119 | 17.6171 |     0 |     2
               00156 ; 120 | 18.5671 |     0 |     2
               00157 ; 121 | 19.5742 |     0 |     2
               00158 ; 122 | 20.6422 |     0 |     2
               00159 ; 123 | 21.7753 |     0 |     2
               00160 ; 124 | 22.9777 |     0 |     2
               00161 ; 125 | 24.2542 |     0 |     2
               00162 ; 126 | 25.6098 |     0 |     2
               00163 ; 127 | 27.0500 |     0 |     1
               00164 
6164 00165 TIA_ENV_TABLE
6164 FFFF      00166         db      0xff, 0xff      ; delay=0.0008
6166 FFFF      00167         db      0xff, 0xff      ; delay=0.0008
6168 CAC4      00168         db      0xc4, 0xca      ; delay=0.0010
616A 7CD9      00169         db      0xd9, 0x7c      ; delay=0.0016
616C 4C15      00170         db      0x15, 0x4c      ; delay=0.0027
616E 3129      00171         db      0x29, 0x31      ; delay=0.0042
6170 21C6      00172         db      0xc6, 0x21      ; delay=0.0061
6172 1869      00173         db      0x69, 0x18      ; delay=0.0084
6174 1261      00174         db      0x61, 0x12      ; delay=0.0111
6176 0E4A      00175         db      0x4a, 0x0e      ; delay=0.0143
6178 0B67      00176         db      0x67, 0x0b      ; delay=0.0180
617A 094C      00177         db      0x4c, 0x09      ; delay=0.0220
617C 07B7      00178         db      0xb7, 0x07      ; delay=0.0265
617E 0680      00179         db      0x80, 0x06      ; delay=0.0315
6180 058B      00180         db      0x8b, 0x05      ; delay=0.0369
6182 04C8      00181         db      0xc8, 0x04      ; delay=0.0428
6184 0429      00182         db      0x29, 0x04      ; delay=0.0492
6186 03A7      00183         db      0xa7, 0x03      ; delay=0.0560
6188 033B      00184         db      0x3b, 0x03      ; delay=0.0634
618A 02E0      00185         db      0xe0, 0x02      ; delay=0.0712
618C 0293      00186         db      0x93, 0x02      ; delay=0.0796
618E 0250      00187         db      0x50, 0x02      ; delay=0.0884
6190 0217      00188         db      0x17, 0x02      ; delay=0.0978
6192 01E6      00189         db      0xe6, 0x01      ; delay=0.1078
6194 01BB      00190         db      0xbb, 0x01      ; delay=0.1183
6196 0195      00191         db      0x95, 0x01      ; delay=0.1294
6198 0173      00192         db      0x73, 0x01      ; delay=0.1411
619A 0155      00193         db      0x55, 0x01      ; delay=0.1533
619C 013B      00194         db      0x3b, 0x01      ; delay=0.1662
619E 0123      00195         db      0x23, 0x01      ; delay=0.1798
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 239


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
61A0 010E      00196         db      0x0e, 0x01      ; delay=0.1940
61A2 00FB      00197         db      0xfb, 0x00      ; delay=0.2088
61A4 00E9      00198         db      0xe9, 0x00      ; delay=0.2244
61A6 00D9      00199         db      0xd9, 0x00      ; delay=0.2407
61A8 00CB      00200         db      0xcb, 0x00      ; delay=0.2578
61AA 00BE      00201         db      0xbe, 0x00      ; delay=0.2756
61AC 00B2      00202         db      0xb2, 0x00      ; delay=0.2942
61AE 00A7      00203         db      0xa7, 0x00      ; delay=0.3136
61B0 009D      00204         db      0x9d, 0x00      ; delay=0.3339
61B2 0093      00205         db      0x93, 0x00      ; delay=0.3550
61B4 008B      00206         db      0x8b, 0x00      ; delay=0.3771
61B6 0083      00207         db      0x83, 0x00      ; delay=0.4001
61B8 007B      00208         db      0x7b, 0x00      ; delay=0.4241
61BA 0074      00209         db      0x74, 0x00      ; delay=0.4492
61BC 006E      00210         db      0x6e, 0x00      ; delay=0.4753
61BE 0068      00211         db      0x68, 0x00      ; delay=0.5024
61C0 0062      00212         db      0x62, 0x00      ; delay=0.5308
61C2 005D      00213         db      0x5d, 0x00      ; delay=0.5603
61C4 0058      00214         db      0x58, 0x00      ; delay=0.5910
61C6 0054      00215         db      0x54, 0x00      ; delay=0.6231
61C8 004F      00216         db      0x4f, 0x00      ; delay=0.6565
61CA 004B      00217         db      0x4b, 0x00      ; delay=0.6913
61CC 0048      00218         db      0x48, 0x00      ; delay=0.7275
61CE 0044      00219         db      0x44, 0x00      ; delay=0.7653
61D0 0041      00220         db      0x41, 0x00      ; delay=0.8046
61D2 003E      00221         db      0x3e, 0x00      ; delay=0.8456
61D4 003B      00222         db      0x3b, 0x00      ; delay=0.8883
61D6 0038      00223         db      0x38, 0x00      ; delay=0.9328
61D8 0035      00224         db      0x35, 0x00      ; delay=0.9792
61DA 0033      00225         db      0x33, 0x00      ; delay=1.0276
61DC 0030      00226         db      0x30, 0x00      ; delay=1.0780
61DE 002E      00227         db      0x2e, 0x00      ; delay=1.1305
61E0 002C      00228         db      0x2c, 0x00      ; delay=1.1854
61E2 002A      00229         db      0x2a, 0x00      ; delay=1.2425
61E4 0028      00230         db      0x28, 0x00      ; delay=1.3021
61E6 0026      00231         db      0x26, 0x00      ; delay=1.3643
61E8 0024      00232         db      0x24, 0x00      ; delay=1.4292
61EA 0023      00233         db      0x23, 0x00      ; delay=1.4970
61EC 0021      00234         db      0x21, 0x00      ; delay=1.5677
61EE 001F      00235         db      0x1f, 0x00      ; delay=1.6415
61F0 001E      00236         db      0x1e, 0x00      ; delay=1.7186
61F2 001D      00237         db      0x1d, 0x00      ; delay=1.7991
61F4 001B      00238         db      0x1b, 0x00      ; delay=1.8832
61F6 001A      00239         db      0x1a, 0x00      ; delay=1.9710
61F8 0019      00240         db      0x19, 0x00      ; delay=2.0629
61FA 0018      00241         db      0x18, 0x00      ; delay=2.1589
61FC 0017      00242         db      0x17, 0x00      ; delay=2.2592
61FE 0016      00243         db      0x16, 0x00      ; delay=2.3642
6200 0015      00244         db      0x15, 0x00      ; delay=2.4740
6202 0014      00245         db      0x14, 0x00      ; delay=2.5890
6204 0013      00246         db      0x13, 0x00      ; delay=2.7092
6206 0012      00247         db      0x12, 0x00      ; delay=2.8352
6208 0011      00248         db      0x11, 0x00      ; delay=2.9670
620A 0010      00249         db      0x10, 0x00      ; delay=3.1051
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 240


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
620C 0010      00250         db      0x10, 0x00      ; delay=3.2498
620E 000F      00251         db      0x0f, 0x00      ; delay=3.4015
6210 000E      00252         db      0x0e, 0x00      ; delay=3.5605
6212 000E      00253         db      0x0e, 0x00      ; delay=3.7272
6214 000D      00254         db      0x0d, 0x00      ; delay=3.9020
6216 000C      00255         db      0x0c, 0x00      ; delay=4.0855
6218 000C      00256         db      0x0c, 0x00      ; delay=4.2781
621A 000B      00257         db      0x0b, 0x00      ; delay=4.4802
621C 000B      00258         db      0x0b, 0x00      ; delay=4.6925
621E 000A      00259         db      0x0a, 0x00      ; delay=4.9155
6220 000A      00260         db      0x0a, 0x00      ; delay=5.1498
6222 0009      00261         db      0x09, 0x00      ; delay=5.3961
6224 0009      00262         db      0x09, 0x00      ; delay=5.6550
6226 0008      00263         db      0x08, 0x00      ; delay=5.9273
6228 0008      00264         db      0x08, 0x00      ; delay=6.2138
622A 0008      00265         db      0x08, 0x00      ; delay=6.5153
622C 0007      00266         db      0x07, 0x00      ; delay=6.8327
622E 0007      00267         db      0x07, 0x00      ; delay=7.1670
6230 0006      00268         db      0x06, 0x00      ; delay=7.5190
6232 0006      00269         db      0x06, 0x00      ; delay=7.8900
6234 0006      00270         db      0x06, 0x00      ; delay=8.2811
6236 0006      00271         db      0x06, 0x00      ; delay=8.6934
6238 0005      00272         db      0x05, 0x00      ; delay=9.1283
623A 0005      00273         db      0x05, 0x00      ; delay=9.5871
623C 0005      00274         db      0x05, 0x00      ; delay=10.0714
623E 0004      00275         db      0x04, 0x00      ; delay=10.5827
6240 0004      00276         db      0x04, 0x00      ; delay=11.1227
6242 0004      00277         db      0x04, 0x00      ; delay=11.6932
6244 0004      00278         db      0x04, 0x00      ; delay=12.2961
6246 0004      00279         db      0x04, 0x00      ; delay=12.9335
6248 0003      00280         db      0x03, 0x00      ; delay=13.6076
624A 0003      00281         db      0x03, 0x00      ; delay=14.3208
624C 0003      00282         db      0x03, 0x00      ; delay=15.0756
624E 0003      00283         db      0x03, 0x00      ; delay=15.8746
6250 0003      00284         db      0x03, 0x00      ; delay=16.7207
6252 0002      00285         db      0x02, 0x00      ; delay=17.6171
6254 0002      00286         db      0x02, 0x00      ; delay=18.5671
6256 0002      00287         db      0x02, 0x00      ; delay=19.5742
6258 0002      00288         db      0x02, 0x00      ; delay=20.6422
625A 0002      00289         db      0x02, 0x00      ; delay=21.7753
625C 0002      00290         db      0x02, 0x00      ; delay=22.9777
625E 0002      00291         db      0x02, 0x00      ; delay=24.2542
6260 0002      00292         db      0x02, 0x00      ; delay=25.6098
6262 0001      00293         db      0x01, 0x00      ; delay=27.0500
6264 0001      00294         db      0x01, 0x00      ; dummy
               00393 #include "tia_lfo_table.inc"
               00001 ; $Id: tia_lfo_table.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; LFO Table
               00005 ; generated with lfo_frq.pl - calculates sweep from 0.001 Hz to 50 Hz
               00006 ;
               00007 ; ==========================================================================
               00008 ;
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 241


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00009 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00010 ;  Licensed for personal non-commercial use only.
               00011 ;  All other rights reserved.
               00012 ; 
               00013 ; ==========================================================================
               00014 
               00015 ;; --------------------------------------------------------------------------
               00016 ;; In: index (0x00-0x7f) in WREG
               00017 ;; Out: CTR value in WREG and MIOS_PARAMETER1, ADD value in MIOS_PARAMETER2
               00018 ;; --------------------------------------------------------------------------
6266 00019 TIA_LFO_TABLE_Get
6266 90D8      00020         clrc
6268 34E8      00021         rlf     WREG, W
626A 0F82      00022         addlw   TIA_LFO_TABLE & 0xff
626C 6EF6      00023         movwf   TBLPTRL
626E 6AF7      00024         clrf    TBLPTRH
6270 0E62      00025         movlw   TIA_LFO_TABLE >> 8
6272 22F7      00026         addwfc  TBLPTRH, F
               00027 
6274 0009      00028         tblrd*+
6276 CFF5 F004 00029         movff   TABLAT, MIOS_PARAMETER2 ; -> ADD value
627A 0009      00030         tblrd*+
627C 50F5      00031         movf    TABLAT, W
627E 6E03      00032         movwf   MIOS_PARAMETER1         ; -> CTR value
6280 0012      00033         return
               00034 
               00035 ;   x | Frq.   | CTR | ADD | Result Frq
               00036 ; ----+--------+-----+-----+-----------
               00037 ;   1 |  0.000 | 255 |   1 |  0.001
               00038 ;   2 |  0.031 |  77 |   1 |  0.032
               00039 ;   3 |  0.063 |  38 |   1 |  0.064
               00040 ;   4 |  0.096 |  25 |   1 |  0.098
               00041 ;   5 |  0.130 |  19 |   1 |  0.128
               00042 ;   6 |  0.165 |  15 |   1 |  0.163
               00043 ;   7 |  0.201 |  12 |   1 |  0.203
               00044 ;   8 |  0.238 |  21 |   2 |  0.233
               00045 ;   9 |  0.276 |   9 |   1 |  0.271
               00046 ;  10 |  0.316 |  23 |   3 |  0.318
               00047 ;  11 |  0.357 |   7 |   1 |  0.349
               00048 ;  12 |  0.399 |   6 |   1 |  0.407
               00049 ;  13 |  0.442 |  11 |   2 |  0.444
               00050 ;  14 |  0.487 |   5 |   1 |  0.488
               00051 ;  15 |  0.533 |   9 |   2 |  0.543
               00052 ;  16 |  0.580 |  17 |   4 |  0.574
               00053 ;  17 |  0.629 |  19 |   5 |  0.642
               00054 ;  18 |  0.680 |  11 |   3 |  0.666
               00055 ;  19 |  0.732 |  10 |   3 |  0.732
               00056 ;  20 |  0.785 |  19 |   6 |  0.771
               00057 ;  21 |  0.840 |  20 |   7 |  0.854
               00058 ;  22 |  0.897 |   8 |   3 |  0.916
               00059 ;  23 |  0.956 |   5 |   2 |  0.977
               00060 ;  24 |  1.017 |  12 |   5 |  1.017
               00061 ;  25 |  1.079 |   9 |   4 |  1.085
               00062 ;  26 |  1.144 |  13 |   6 |  1.127
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 242


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00063 ;  27 |  1.210 |   2 |   1 |  1.221
               00064 ;  28 |  1.278 |  15 |   8 |  1.302
               00065 ;  29 |  1.349 |   9 |   5 |  1.356
               00066 ;  30 |  1.422 |   7 |   4 |  1.395
               00067 ;  31 |  1.497 |   5 |   3 |  1.465
               00068 ;  32 |  1.574 |  11 |   7 |  1.554
               00069 ;  33 |  1.654 |   3 |   2 |  1.628
               00070 ;  34 |  1.736 |   7 |   5 |  1.744
               00071 ;  35 |  1.821 |   4 |   3 |  1.831
               00072 ;  36 |  1.908 |   5 |   4 |  1.953
               00073 ;  37 |  1.998 |   5 |   4 |  1.953
               00074 ;  38 |  2.091 |   7 |   6 |  2.093
               00075 ;  39 |  2.187 |   8 |   7 |  2.136
               00076 ;  40 |  2.285 |  12 |  11 |  2.238
               00077 ;  41 |  2.387 |   1 |   1 |  2.441
               00078 ;  42 |  2.492 |   1 |   1 |  2.441
               00079 ;  43 |  2.600 |  11 |  12 |  2.663
               00080 ;  44 |  2.712 |   8 |   9 |  2.747
               00081 ;  45 |  2.827 |   6 |   7 |  2.848
               00082 ;  46 |  2.945 |   5 |   6 |  2.930
               00083 ;  47 |  3.067 |   4 |   5 |  3.052
               00084 ;  48 |  3.193 |   3 |   4 |  3.255
               00085 ;  49 |  3.323 |   3 |   4 |  3.255
               00086 ;  50 |  3.457 |   5 |   7 |  3.418
               00087 ;  51 |  3.595 |   2 |   3 |  3.662
               00088 ;  52 |  3.737 |   2 |   3 |  3.662
               00089 ;  53 |  3.884 |   5 |   8 |  3.906
               00090 ;  54 |  4.035 |   3 |   5 |  4.069
               00091 ;  55 |  4.191 |   4 |   7 |  4.272
               00092 ;  56 |  4.352 |   4 |   7 |  4.272
               00093 ;  57 |  4.518 |   6 |  11 |  4.476
               00094 ;  58 |  4.689 |   8 |  15 |  4.578
               00095 ;  59 |  4.865 |   1 |   2 |  4.883
               00096 ;  60 |  5.047 |   9 |  19 |  5.154
               00097 ;  61 |  5.234 |   6 |  13 |  5.290
               00098 ;  62 |  5.427 |   4 |   9 |  5.493
               00099 ;  63 |  5.626 |   3 |   7 |  5.697
               00100 ;  64 |  5.831 |   3 |   7 |  5.697
               00101 ;  65 |  6.043 |   2 |   5 |  6.104
               00102 ;  66 |  6.261 |   5 |  13 |  6.348
               00103 ;  67 |  6.486 |   3 |   8 |  6.510
               00104 ;  68 |  6.718 |   4 |  11 |  6.714
               00105 ;  69 |  6.957 |   5 |  14 |  6.836
               00106 ;  70 |  7.203 |   1 |   3 |  7.324
               00107 ;  71 |  7.457 |   1 |   3 |  7.324
               00108 ;  72 |  7.719 |   5 |  16 |  7.812
               00109 ;  73 |  7.989 |   3 |  10 |  8.138
               00110 ;  74 |  8.267 |   3 |  10 |  8.138
               00111 ;  75 |  8.554 |   2 |   7 |  8.545
               00112 ;  76 |  8.850 |   3 |  11 |  8.952
               00113 ;  77 |  9.155 |   3 |  11 |  8.952
               00114 ;  78 |  9.470 |   5 |  19 |  9.277
               00115 ;  79 |  9.794 |   1 |   4 |  9.766
               00116 ;  80 | 10.128 |   4 |  17 | 10.376
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 243


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00117 ;  81 | 10.473 |   3 |  13 | 10.579
               00118 ;  82 | 10.828 |   2 |   9 | 10.986
               00119 ;  83 | 11.195 |   2 |   9 | 10.986
               00120 ;  84 | 11.572 |   3 |  14 | 11.393
               00121 ;  85 | 11.962 |   1 |   5 | 12.207
               00122 ;  86 | 12.363 |   1 |   5 | 12.207
               00123 ;  87 | 12.777 |   3 |  16 | 13.021
               00124 ;  88 | 13.204 |   2 |  11 | 13.428
               00125 ;  89 | 13.644 |   2 |  11 | 13.428
               00126 ;  90 | 14.097 |   3 |  17 | 13.835
               00127 ;  91 | 14.565 |   1 |   6 | 14.648
               00128 ;  92 | 15.047 |   4 |  25 | 15.259
               00129 ;  93 | 15.544 |   2 |  13 | 15.869
               00130 ;  94 | 16.056 |   2 |  13 | 15.869
               00131 ;  95 | 16.584 |   3 |  20 | 16.276
               00132 ;  96 | 17.129 |   1 |   7 | 17.090
               00133 ;  97 | 17.690 |   3 |  22 | 17.904
               00134 ;  98 | 18.269 |   2 |  15 | 18.311
               00135 ;  99 | 18.866 |   3 |  23 | 18.717
               00136 ; 100 | 19.481 |   1 |   8 | 19.531
               00137 ; 101 | 20.115 |   3 |  25 | 20.345
               00138 ; 102 | 20.769 |   2 |  17 | 20.752
               00139 ; 103 | 21.443 |   1 |   9 | 21.973
               00140 ; 104 | 22.139 |   1 |   9 | 21.973
               00141 ; 105 | 22.855 |   2 |  19 | 23.193
               00142 ; 106 | 23.594 |   2 |  19 | 23.193
               00143 ; 107 | 24.356 |   1 |  10 | 24.414
               00144 ; 108 | 25.141 |   2 |  21 | 25.635
               00145 ; 109 | 25.950 |   2 |  21 | 25.635
               00146 ; 110 | 26.785 |   1 |  11 | 26.855
               00147 ; 111 | 27.646 |   2 |  23 | 28.076
               00148 ; 112 | 28.533 |   2 |  23 | 28.076
               00149 ; 113 | 29.447 |   1 |  12 | 29.297
               00150 ; 114 | 30.390 |   2 |  25 | 30.518
               00151 ; 115 | 31.362 |   1 |  13 | 31.738
               00152 ; 116 | 32.365 |   1 |  13 | 31.738
               00153 ; 117 | 33.398 |   1 |  14 | 34.180
               00154 ; 118 | 34.463 |   1 |  14 | 34.180
               00155 ; 119 | 35.562 |   2 |  29 | 35.400
               00156 ; 120 | 36.694 |   1 |  15 | 36.621
               00157 ; 121 | 37.861 |   2 |  31 | 37.842
               00158 ; 122 | 39.065 |   1 |  16 | 39.062
               00159 ; 123 | 40.306 |   2 |  33 | 40.283
               00160 ; 124 | 41.585 |   1 |  17 | 41.504
               00161 ; 125 | 42.904 |   1 |  18 | 43.945
               00162 ; 126 | 44.263 |   1 |  18 | 43.945
               00163 ; 127 | 45.665 |   1 |  19 | 46.387
               00164 
6282 00165 TIA_LFO_TABLE
6282 FF01      00166         db      0x01, 0xff      ; ADD/CTR for frq=  0.00
6284 FF01      00167         db      0x01, 0xff      ; ADD/CTR for frq=  0.00
6286 4D01      00168         db      0x01, 0x4d      ; ADD/CTR for frq=  0.03
6288 2601      00169         db      0x01, 0x26      ; ADD/CTR for frq=  0.06
628A 1901      00170         db      0x01, 0x19      ; ADD/CTR for frq=  0.10
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 244


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
628C 1301      00171         db      0x01, 0x13      ; ADD/CTR for frq=  0.13
628E 0F01      00172         db      0x01, 0x0f      ; ADD/CTR for frq=  0.16
6290 0C01      00173         db      0x01, 0x0c      ; ADD/CTR for frq=  0.20
6292 1502      00174         db      0x02, 0x15      ; ADD/CTR for frq=  0.23
6294 0901      00175         db      0x01, 0x09      ; ADD/CTR for frq=  0.27
6296 1703      00176         db      0x03, 0x17      ; ADD/CTR for frq=  0.32
6298 0701      00177         db      0x01, 0x07      ; ADD/CTR for frq=  0.35
629A 0601      00178         db      0x01, 0x06      ; ADD/CTR for frq=  0.41
629C 0B02      00179         db      0x02, 0x0b      ; ADD/CTR for frq=  0.44
629E 0501      00180         db      0x01, 0x05      ; ADD/CTR for frq=  0.49
62A0 0902      00181         db      0x02, 0x09      ; ADD/CTR for frq=  0.54
62A2 1104      00182         db      0x04, 0x11      ; ADD/CTR for frq=  0.57
62A4 1305      00183         db      0x05, 0x13      ; ADD/CTR for frq=  0.64
62A6 0B03      00184         db      0x03, 0x0b      ; ADD/CTR for frq=  0.67
62A8 0A03      00185         db      0x03, 0x0a      ; ADD/CTR for frq=  0.73
62AA 1306      00186         db      0x06, 0x13      ; ADD/CTR for frq=  0.77
62AC 1407      00187         db      0x07, 0x14      ; ADD/CTR for frq=  0.85
62AE 0803      00188         db      0x03, 0x08      ; ADD/CTR for frq=  0.92
62B0 0502      00189         db      0x02, 0x05      ; ADD/CTR for frq=  0.98
62B2 0C05      00190         db      0x05, 0x0c      ; ADD/CTR for frq=  1.02
62B4 0904      00191         db      0x04, 0x09      ; ADD/CTR for frq=  1.09
62B6 0D06      00192         db      0x06, 0x0d      ; ADD/CTR for frq=  1.13
62B8 0201      00193         db      0x01, 0x02      ; ADD/CTR for frq=  1.22
62BA 0F08      00194         db      0x08, 0x0f      ; ADD/CTR for frq=  1.30
62BC 0905      00195         db      0x05, 0x09      ; ADD/CTR for frq=  1.36
62BE 0704      00196         db      0x04, 0x07      ; ADD/CTR for frq=  1.40
62C0 0503      00197         db      0x03, 0x05      ; ADD/CTR for frq=  1.46
62C2 0B07      00198         db      0x07, 0x0b      ; ADD/CTR for frq=  1.55
62C4 0302      00199         db      0x02, 0x03      ; ADD/CTR for frq=  1.63
62C6 0705      00200         db      0x05, 0x07      ; ADD/CTR for frq=  1.74
62C8 0403      00201         db      0x03, 0x04      ; ADD/CTR for frq=  1.83
62CA 0504      00202         db      0x04, 0x05      ; ADD/CTR for frq=  1.95
62CC 0504      00203         db      0x04, 0x05      ; ADD/CTR for frq=  1.95
62CE 0706      00204         db      0x06, 0x07      ; ADD/CTR for frq=  2.09
62D0 0807      00205         db      0x07, 0x08      ; ADD/CTR for frq=  2.14
62D2 0C0B      00206         db      0x0b, 0x0c      ; ADD/CTR for frq=  2.24
62D4 0101      00207         db      0x01, 0x01      ; ADD/CTR for frq=  2.44
62D6 0101      00208         db      0x01, 0x01      ; ADD/CTR for frq=  2.44
62D8 0B0C      00209         db      0x0c, 0x0b      ; ADD/CTR for frq=  2.66
62DA 0809      00210         db      0x09, 0x08      ; ADD/CTR for frq=  2.75
62DC 0607      00211         db      0x07, 0x06      ; ADD/CTR for frq=  2.85
62DE 0506      00212         db      0x06, 0x05      ; ADD/CTR for frq=  2.93
62E0 0405      00213         db      0x05, 0x04      ; ADD/CTR for frq=  3.05
62E2 0304      00214         db      0x04, 0x03      ; ADD/CTR for frq=  3.26
62E4 0304      00215         db      0x04, 0x03      ; ADD/CTR for frq=  3.26
62E6 0507      00216         db      0x07, 0x05      ; ADD/CTR for frq=  3.42
62E8 0203      00217         db      0x03, 0x02      ; ADD/CTR for frq=  3.66
62EA 0203      00218         db      0x03, 0x02      ; ADD/CTR for frq=  3.66
62EC 0508      00219         db      0x08, 0x05      ; ADD/CTR for frq=  3.91
62EE 0305      00220         db      0x05, 0x03      ; ADD/CTR for frq=  4.07
62F0 0407      00221         db      0x07, 0x04      ; ADD/CTR for frq=  4.27
62F2 0407      00222         db      0x07, 0x04      ; ADD/CTR for frq=  4.27
62F4 060B      00223         db      0x0b, 0x06      ; ADD/CTR for frq=  4.48
62F6 080F      00224         db      0x0f, 0x08      ; ADD/CTR for frq=  4.58
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 245


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
62F8 0102      00225         db      0x02, 0x01      ; ADD/CTR for frq=  4.88
62FA 0913      00226         db      0x13, 0x09      ; ADD/CTR for frq=  5.15
62FC 060D      00227         db      0x0d, 0x06      ; ADD/CTR for frq=  5.29
62FE 0409      00228         db      0x09, 0x04      ; ADD/CTR for frq=  5.49
6300 0307      00229         db      0x07, 0x03      ; ADD/CTR for frq=  5.70
6302 0307      00230         db      0x07, 0x03      ; ADD/CTR for frq=  5.70
6304 0205      00231         db      0x05, 0x02      ; ADD/CTR for frq=  6.10
6306 050D      00232         db      0x0d, 0x05      ; ADD/CTR for frq=  6.35
6308 0308      00233         db      0x08, 0x03      ; ADD/CTR for frq=  6.51
630A 040B      00234         db      0x0b, 0x04      ; ADD/CTR for frq=  6.71
630C 050E      00235         db      0x0e, 0x05      ; ADD/CTR for frq=  6.84
630E 0103      00236         db      0x03, 0x01      ; ADD/CTR for frq=  7.32
6310 0103      00237         db      0x03, 0x01      ; ADD/CTR for frq=  7.32
6312 0510      00238         db      0x10, 0x05      ; ADD/CTR for frq=  7.81
6314 030A      00239         db      0x0a, 0x03      ; ADD/CTR for frq=  8.14
6316 030A      00240         db      0x0a, 0x03      ; ADD/CTR for frq=  8.14
6318 0207      00241         db      0x07, 0x02      ; ADD/CTR for frq=  8.54
631A 030B      00242         db      0x0b, 0x03      ; ADD/CTR for frq=  8.95
631C 030B      00243         db      0x0b, 0x03      ; ADD/CTR for frq=  8.95
631E 0513      00244         db      0x13, 0x05      ; ADD/CTR for frq=  9.28
6320 0104      00245         db      0x04, 0x01      ; ADD/CTR for frq=  9.77
6322 0411      00246         db      0x11, 0x04      ; ADD/CTR for frq= 10.38
6324 030D      00247         db      0x0d, 0x03      ; ADD/CTR for frq= 10.58
6326 0209      00248         db      0x09, 0x02      ; ADD/CTR for frq= 10.99
6328 0209      00249         db      0x09, 0x02      ; ADD/CTR for frq= 10.99
632A 030E      00250         db      0x0e, 0x03      ; ADD/CTR for frq= 11.39
632C 0105      00251         db      0x05, 0x01      ; ADD/CTR for frq= 12.21
632E 0105      00252         db      0x05, 0x01      ; ADD/CTR for frq= 12.21
6330 0310      00253         db      0x10, 0x03      ; ADD/CTR for frq= 13.02
6332 020B      00254         db      0x0b, 0x02      ; ADD/CTR for frq= 13.43
6334 020B      00255         db      0x0b, 0x02      ; ADD/CTR for frq= 13.43
6336 0311      00256         db      0x11, 0x03      ; ADD/CTR for frq= 13.83
6338 0106      00257         db      0x06, 0x01      ; ADD/CTR for frq= 14.65
633A 0419      00258         db      0x19, 0x04      ; ADD/CTR for frq= 15.26
633C 020D      00259         db      0x0d, 0x02      ; ADD/CTR for frq= 15.87
633E 020D      00260         db      0x0d, 0x02      ; ADD/CTR for frq= 15.87
6340 0314      00261         db      0x14, 0x03      ; ADD/CTR for frq= 16.28
6342 0107      00262         db      0x07, 0x01      ; ADD/CTR for frq= 17.09
6344 0316      00263         db      0x16, 0x03      ; ADD/CTR for frq= 17.90
6346 020F      00264         db      0x0f, 0x02      ; ADD/CTR for frq= 18.31
6348 0317      00265         db      0x17, 0x03      ; ADD/CTR for frq= 18.72
634A 0108      00266         db      0x08, 0x01      ; ADD/CTR for frq= 19.53
634C 0319      00267         db      0x19, 0x03      ; ADD/CTR for frq= 20.35
634E 0211      00268         db      0x11, 0x02      ; ADD/CTR for frq= 20.75
6350 0109      00269         db      0x09, 0x01      ; ADD/CTR for frq= 21.97
6352 0109      00270         db      0x09, 0x01      ; ADD/CTR for frq= 21.97
6354 0213      00271         db      0x13, 0x02      ; ADD/CTR for frq= 23.19
6356 0213      00272         db      0x13, 0x02      ; ADD/CTR for frq= 23.19
6358 010A      00273         db      0x0a, 0x01      ; ADD/CTR for frq= 24.41
635A 0215      00274         db      0x15, 0x02      ; ADD/CTR for frq= 25.63
635C 0215      00275         db      0x15, 0x02      ; ADD/CTR for frq= 25.63
635E 010B      00276         db      0x0b, 0x01      ; ADD/CTR for frq= 26.86
6360 0217      00277         db      0x17, 0x02      ; ADD/CTR for frq= 28.08
6362 0217      00278         db      0x17, 0x02      ; ADD/CTR for frq= 28.08
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 246


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6364 010C      00279         db      0x0c, 0x01      ; ADD/CTR for frq= 29.30
6366 0219      00280         db      0x19, 0x02      ; ADD/CTR for frq= 30.52
6368 010D      00281         db      0x0d, 0x01      ; ADD/CTR for frq= 31.74
636A 010D      00282         db      0x0d, 0x01      ; ADD/CTR for frq= 31.74
636C 010E      00283         db      0x0e, 0x01      ; ADD/CTR for frq= 34.18
636E 010E      00284         db      0x0e, 0x01      ; ADD/CTR for frq= 34.18
6370 021D      00285         db      0x1d, 0x02      ; ADD/CTR for frq= 35.40
6372 010F      00286         db      0x0f, 0x01      ; ADD/CTR for frq= 36.62
6374 021F      00287         db      0x1f, 0x02      ; ADD/CTR for frq= 37.84
6376 0110      00288         db      0x10, 0x01      ; ADD/CTR for frq= 39.06
6378 0221      00289         db      0x21, 0x02      ; ADD/CTR for frq= 40.28
637A 0111      00290         db      0x11, 0x01      ; ADD/CTR for frq= 41.50
637C 0112      00291         db      0x12, 0x01      ; ADD/CTR for frq= 43.95
637E 0112      00292         db      0x12, 0x01      ; ADD/CTR for frq= 43.95
6380 0113      00293         db      0x13, 0x01      ; ADD/CTR for frq= 46.39
6382 0113      00294         db      0x13, 0x01      ; dummy
               00394 ;#include "tia_note_table.inc"
               00395 
               00396 
               00397 
               00398 ;; these three tables are now included from the mios_tables.inc file
               00399 ;; to save code space
               00400         ;; #include "tia_frq_table.inc"
               00401         ;; #include "tia_sin_table.inc"
               00402         ;; #include "tia_depth_table.inc"
               00403 
               00404 ;; ---[ TIA EEPROM content ]---
               00405 #include "tia_presets.inc"
               00001 ; $Id: tia_presets.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Presets (EEPROM content)
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014         ERRORLEVEL      -220    ; suppress "Address exceeds maximum range for this processor."
               00015         ;; this is (unfortunately) required for gpasm
               00016 
               00017 ;; ==========================================================================
               00018 ;; default patch
               00019 ;; ==========================================================================
F00000           00020         org     0xf00000        ; eeprom base address
F00000 00021 EEPROM_PATCH
               00022 #include "src/tia_preset_p.inc"
               00001 ; $Id: tia_preset_p.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Patch Preset (EEPROM content)
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 247


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
F00000 00013 EEPROM_PATCH_PATCHNAME
F00000 6E49 6574 00014         de      'I','n','t','e','r','n','a','l',' ','P','a','t','c','h',' ',' '
     6E72 6C61 
     5020 7461 
     6863 2020 
               00015 
               00016 ;; NOTE: due to a bug in the PIC18F assembler, we have to define the presets on a very laborious way
               00017 
F00010 007F      00018 EEPROM_PATCH_MASTER_VOLUME                        de 0x7f, 0x00   ;; 0x10
F00012 00019 EEPROM_PATCH_POLY                                 ;de 0x00        ;; 0x11
F00012 0000      00020 EEPROM_PATCH_SUSKEY                               de 0x00, 0x00   ;; 0x12
F00014 00021 EEPROM_PATCH_ENVx_CURVES                          ;de 0x00                ;; 0x13
F00014 0000      00022 EEPROM_PATCH_MIDI_SYNC                            de 0x00, 0x00   ;; 0x14
F00016 00023 EEPROM_PATCH_MOD_SYNC                             ;de 0x00        ;; 0x15
F00016 0000      00024 EEPROM_PATCH_FREE1                                de 0x00, 0x00   ;; 0x16
F00018 00025 EEPROM_PATCH_FREE2                                ;de 0x00        ;; 0x17
F00018 0000      00026 EEPROM_PATCH_FREE3                                de 0x00, 0x00   ;; 0x18
F0001A 00027 EEPROM_PATCH_FREE4                                ;de 0x00        ;; 0x19
F0001A 0000      00028 EEPROM_PATCH_MODULATION_ASSIGN                    de 0x00, 0x00   ;; 0x1a
F0001C 00029 EEPROM_PATCH_MODULATION_INIT                      ;de 0x00        ;; 0x1b
F0001C 007F      00030 EEPROM_PATCH_MODULATION_DEPTH                     de 0x7f, 0x00   ;; 0x1c
F0001E 00031 EEPROM_PATCH_AFTERTOUCH_ASSIGN                    ;de 0x00        ;; 0x1d
F0001E 7F00      00032 EEPROM_PATCH_AFTERTOUCH_INIT                      de 0x00, 0x7f   ;; 0x1e
F00020 00033 EEPROM_PATCH_AFTERTOUCH_DEPTH                     ;de 0x7f        ;; 0x1f
               00034 
F00020 407F      00035 EEPROM_PATCH_VOICE1_VOLUME                        de 0x7f, 0x40 ;; 0x20
F00022 00036 EEPROM_PATCH_VOICE1_TRANSPOSE                     ;de 0x40        ;; 0x21
F00022 0004      00037 EEPROM_PATCH_VOICE1_WAVEFORM                      de 0x04, 0x00 ;; 0x22
F00024 00038 EEPROM_PATCH_VOICE1_MODE                          ;de 0x00        ;; 0x23
F00024 0002      00039 EEPROM_PATCH_VOICE1_PITCHRANGE                    de 0x02, 0x00 ;; 0x24
F00026 00040 EEPROM_PATCH_VOICE1_PORTAMENTO                    ;de 0x00        ;; 0x25
F00026 0000      00041 EEPROM_PATCH_VOICE1_ARPEGGIATOR                   de 0x00, 0x00   ;; 0x26
F00028 00042 EEPROM_PATCH_VOICE1_DELAY                         ;de 0x00        ;; 0x27
F00028 1F18      00043 EEPROM_PATCH_VOICE1_KEY_OFFSET                    de 0x18, 0x1f   ;; 0x28
F0002A 00044 EEPROM_PATCH_VOICE1_KEY_LENGTH                    ;de 0x1f              ;; 0x29
F0002A 0000      00045 EEPROM_PATCH_VOICE1_SPLIT_LOWER                   de 0x00, 0x00 ;; 0x2a
F0002C 00046 EEPROM_PATCH_VOICE1_SPLIT_UPPER                   ;de 0x00        ;; 0x2b
F0002C 0000      00047 EEPROM_PATCH_VOICE1_VEL_ASSIGN                    de 0x00, 0x00   ;; 0x2c
F0002E 00048 EEPROM_PATCH_VOICE1_VEL_INIT                      ;de 0x00              ;; 0x2d
F0002E 007F      00049 EEPROM_PATCH_VOICE1_VEL_DEPTH                     de 0x7f, 0x00 ;; 0x2e
F00030 00050 EEPROM_PATCH_VOICE1_ENV_OPTION                    ;de 0x00        ;; 0x2f
F00030 4040      00051 EEPROM_PATCH_VOICE1_ENV_DEPTH                     de 0x40, 0x40 ;; 0x30
F00032 00052 EEPROM_PATCH_VOICE1_ENV_CURVE                     ;de 0x40              ;; 0x31
F00032 7F00      00053 EEPROM_PATCH_VOICE1_ENV_ATTACK                    de 0x00, 0x7f   ;; 0x32
F00034 00054 EEPROM_PATCH_VOICE1_ENV_DECAY                     ;de 0x7f        ;; 0x33
F00034 007F      00055 EEPROM_PATCH_VOICE1_ENV_SUSTAIN                   de 0x7f, 0x00   ;; 0x34
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 248


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F00036 00056 EEPROM_PATCH_VOICE1_ENV_RELEASE                   ;de 0x00        ;; 0x35
F00036 0000      00057 EEPROM_PATCH_VOICE1_OPTIONS                       de 0x00, 0x00 ;; 0x36
F00038 00058 EEPROM_PATCH_VOICE1_WBANK                         ;de 0x00        ;; 0x37
F00038 0000      00059 EEPROM_PATCH_VOICE1_WT                            de 0x00, 0x00   ;; 0x38
F0003A 00060 EEPROM_PATCH_VOICE1_WT_RATE                       ;de 0x10        ;; 0x39
F0003A 0000      00061 EEPROM_PATCH_VOICE1_KBANK                         de 0x00, 0x00 ;; 0x3a
F0003C 00062 EEPROM_PATCH_VOICE1_KIT                           ;de 0x00        ;; 0x5b
F0003C 0000      00063 EEPROM_PATCH_VOICE1_MOD2AMP                       de 0x00, 0x00 ;; 0x5c
F0003E 00064 EEPROM_PATCH_VOICE1_MOD2PITCH                     ;de 0x00        ;; 0x3d
F0003E 0000      00065 EEPROM_PATCH_VOICE1_FREE2                         de 0x00, 0x00 ;; 0x3e
F00040 00066 EEPROM_PATCH_VOICE1_FREE3                         ;de 0x00        ;; 0x3f
               00067 
F00040 407F      00068 EEPROM_PATCH_VOICE2_VOLUME                        de 0x7f, 0x40 ;; 0x40
F00042 00069 EEPROM_PATCH_VOICE2_TRANSPOSE                     ;de 0x40        ;; 0x41
F00042 0000      00070 EEPROM_PATCH_VOICE2_WAVEFORM                      de 0x00, 0x00 ;; 0x42
F00044 00071 EEPROM_PATCH_VOICE2_MODE                          ;de 0x00        ;; 0x43
F00044 0002      00072 EEPROM_PATCH_VOICE2_PITCHRANGE                    de 0x02, 0x00 ;; 0x44
F00046 00073 EEPROM_PATCH_VOICE2_PORTAMENTO                    ;de 0x00        ;; 0x45
F00046 0000      00074 EEPROM_PATCH_VOICE2_ARPEGGIATOR                   de 0x00, 0x00   ;; 0x46
F00048 00075 EEPROM_PATCH_VOICE2_DELAY                         ;de 0x00        ;; 0x47
F00048 1F3C      00076 EEPROM_PATCH_VOICE2_KEY_OFFSET                    de 0x3c, 0x1f   ;; 0x48
F0004A 00077 EEPROM_PATCH_VOICE2_KEY_LENGTH                    ;de 0x1f              ;; 0x49
F0004A 0000      00078 EEPROM_PATCH_VOICE2_SPLIT_LOWER                   de 0x00, 0x00 ;; 0x4a
F0004C 00079 EEPROM_PATCH_VOICE2_SPLIT_UPPER                   ;de 0x00        ;; 0x4b
F0004C 0000      00080 EEPROM_PATCH_VOICE2_VEL_ASSIGN                    de 0x00, 0x00   ;; 0x4c
F0004E 00081 EEPROM_PATCH_VOICE2_VEL_INIT                      ;de 0x00              ;; 0x4d
F0004E 007F      00082 EEPROM_PATCH_VOICE2_VEL_DEPTH                     de 0x7f, 0x00 ;; 0x4e
F00050 00083 EEPROM_PATCH_VOICE2_ENV_OPTION                    ;de 0x00        ;; 0x4f
F00050 4040      00084 EEPROM_PATCH_VOICE2_ENV_DEPTH                     de 0x40, 0x40 ;; 0x50
F00052 00085 EEPROM_PATCH_VOICE2_ENV_CURVE                     ;de 0x40              ;; 0x51
F00052 7F00      00086 EEPROM_PATCH_VOICE2_ENV_ATTACK                    de 0x00, 0x7f   ;; 0x52
F00054 00087 EEPROM_PATCH_VOICE2_ENV_DECAY                     ;de 0x7f        ;; 0x53
F00054 007F      00088 EEPROM_PATCH_VOICE2_ENV_SUSTAIN                   de 0x7f, 0x00   ;; 0x54
F00056 00089 EEPROM_PATCH_VOICE2_ENV_RELEASE                   ;de 0x00        ;; 0x55
F00056 0000      00090 EEPROM_PATCH_VOICE2_OPTIONS                       de 0x00, 0x00 ;; 0x56
F00058 00091 EEPROM_PATCH_VOICE2_WBANK                         ;de 0x00        ;; 0x57
F00058 0000      00092 EEPROM_PATCH_VOICE2_WT                            de 0x00, 0x00   ;; 0x58
F0005A 00093 EEPROM_PATCH_VOICE2_WT_RATE                       ;de 0x10        ;; 0x59
F0005A 0000      00094 EEPROM_PATCH_VOICE2_KBANK                         de 0x00, 0x00 ;; 0x5a
F0005C 00095 EEPROM_PATCH_VOICE2_KIT                           ;de 0x00        ;; 0x5b
F0005C 0000      00096 EEPROM_PATCH_VOICE2_MOD2AMP                       de 0x00, 0x00 ;; 0x5c
F0005E 00097 EEPROM_PATCH_VOICE2_MOD2PITCH                     ;de 0x00        ;; 0x5d
F0005E 0000      00098 EEPROM_PATCH_VOICE2_FREE2                         de 0x00, 0x00 ;; 0x5e
F00060 00099 EEPROM_PATCH_VOICE2_FREE3                         ;de 0x00        ;; 0x5f
               00100 
F00060 1007      00101 EEPROM_PATCH_LFO1_MODE                            de 0x07, 0x10 ;; 0x60
F00062 00102 EEPROM_PATCH_LFO1_RATE                            ;de 0x10        ;; 0x61
F00062 077F      00103 EEPROM_PATCH_LFO1_DEPTH                           de 0x7f, 0x07 ;; 0x62
F00064 00104 EEPROM_PATCH_LFO2_MODE                            ;de 0x07        ;; 0x63
F00064 0020      00105 EEPROM_PATCH_LFO2_RATE                            de 0x20, 0x00 ;; 0x64
F00066 00106 EEPROM_PATCH_LFO2_DEPTH                           ;de 0x00        ;; 0x65
F00066 0301      00107 EEPROM_PATCH_LFO3_MODE                            de 0x01, 0x03 ;; 0x66
F00068 00108 EEPROM_PATCH_LFO3_RATE                            ;de 0x03        ;; 0x67
F00068 017F      00109 EEPROM_PATCH_LFO3_DEPTH                           de 0x7f, 0x01 ;; 0x68
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 249


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F0006A 00110 EEPROM_PATCH_LFO4_MODE                            ;de 0x01        ;; 0x69
F0006A 0040      00111 EEPROM_PATCH_LFO4_RATE                            de 0x40, 0x00 ;; 0x6a
F0006C 00112 EEPROM_PATCH_LFO4_DEPTH                           ;de 0x00        ;; 0x6b
               00113 
F0006C 407F      00114 EEPROM_PATCH_ENV1_DEPTH                           de 0x7f, 0x40 ;; 0x6c 
F0006E 00115 EEPROM_PATCH_ENV1_CURVE                           ;de 0x40        ;; 0x6d
F0006E 4040      00116 EEPROM_PATCH_ENV1_ATTACK                          de 0x40, 0x40   ;; 0x6e
F00070 00117 EEPROM_PATCH_ENV1_DECAY                           ;de 0x40        ;; 0x6f
F00070 4040      00118 EEPROM_PATCH_ENV1_SUSTAIN                         de 0x40, 0x40 ;; 0x70
F00072 00119 EEPROM_PATCH_ENV1_RELEASE                         ;de 0x40        ;; 0x71
F00072 4000      00120 EEPROM_PATCH_ENV2_DEPTH                           de 0x00, 0x40   ;; 0x72
F00074 00121 EEPROM_PATCH_ENV2_CURVE                           ;de 0x40        ;; 0x73
F00074 6060      00122 EEPROM_PATCH_ENV2_ATTACK                          de 0x60, 0x60 ;; 0x74
F00076 00123 EEPROM_PATCH_ENV2_DECAY                           ;de 0x60        ;; 0x75
F00076 4020      00124 EEPROM_PATCH_ENV2_SUSTAIN                         de 0x20, 0x40 ;; 0x76
F00078 00125 EEPROM_PATCH_ENV2_RELEASE                         ;de 0x40        ;; 0x77
               00126 
F00078 0000      00127 EEPROM_PATCH_FREE5                                de 0x00, 0x00 ;; 0x78
F0007A 00128 EEPROM_PATCH_FREE6                                ;de 0x00        ;; 0x79
F0007A 0000      00129 EEPROM_PATCH_FREE7                                de 0x00, 0x00 ;; 0x7a
F0007C 00130 EEPROM_PATCH_FREE8                                ;de 0x00        ;; 0x7b
               00131 
F0007C 00132 EEPROM_CFG_BASE
F0007C 0000      00133 EEPROM_PATCH_V2_CHANNEL                           de (DEFAULT_MIDI_CHANNEL-1)& 0x0f, (DEFAULT_MIDI_CHANNEL-1)& 0x0f ;; 0x7c - can only be written with CFG command
F0007E 00134 EEPROM_PATCH_V1_CHANNEL                           ;de 0         ;; 0x7d - can only be written with CFG command
F0007E 0000      00135 EEPROM_PATCH_DEVICE                               de DEFAULT_DEVICE_ID, 0x00  ;; 0x7e - can only be written with CFG command
F00080 00136 EEPROM_PATCH_CFG_FREE                             ;de 0x00      ;; 0x7f - can only be written with CFG command
               00137 
               00023 
               00024 
               00025 ;; ==========================================================================
               00026 ;; default ensemble
               00027 ;; ==========================================================================
F00100           00028         org     0xf00100
F00100 00029 EEPROM_KIT
               00030 #include "src/tia_preset_k.inc"
               00001 ; $Id: tia_preset_k.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Kit Preset (EEPROM content)
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
F00100 6E49 6574 00013         de  'I','n','t','e','r','n','a','l',' ','K','i','t',' ',' ',' ',' '
     6E72 6C61 
     4B20 7469 
     2020 2020 
F00110 0000      00014 EEPROM_KIT_WAVETABLE_1                        de 0x00, 0x00   ;; 0x10
F00112 0000      00015 EEPROM_KIT_WT_RATE_1                              de 0x00, 0x00   ;; 0x10
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 250


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F00114 00016 EEPROM_KIT_ENVx_CURVE_1                           ;de 0x40        ;; 0x73
F00114 6060      00017 EEPROM_KIT_ENVx_ATTACK_1                          de 0x60, 0x60 ;; 0x74
F00116 00018 EEPROM_KIT_ENVx_DECAY_1                           ;de 0x60        ;; 0x75
F00116 4020      00019 EEPROM_KIT_ENVx_SUSTAIN_1                         de 0x20, 0x40 ;; 0x76
F00118 00020 EEPROM_KIT_ENVx_RELEASE_1                         ;de 0x40        ;; 0x77
               00021 
F00118 007F      00022 EEPROM_KIT_WAVETABLE_2                        de 0x7f, 0x00   ;; 0x10
F0011A 0000      00023 EEPROM_KIT_WT_RATE_2                              de 0x00, 0x00   ;; 0x10
F0011C 00024 EEPROM_KIT_ENVx_CURVE_2                           ;de 0x40        ;; 0x73
F0011C 6060      00025 EEPROM_KIT_ENVx_ATTACK_2                          de 0x60, 0x60 ;; 0x74
F0011E 00026 EEPROM_KIT_ENVx_DECAY_2                           ;de 0x60        ;; 0x75
F0011E 4020      00027 EEPROM_KIT_ENVx_SUSTAIN_2                         de 0x20, 0x40 ;; 0x76
F00120 00028 EEPROM_KIT_ENVx_RELEASE_2                         ;de 0x40        ;; 0x77
               00029 
F00120 007F      00030 EEPROM_KIT_WAVETABLE_3                        de 0x7f, 0x00   ;; 0x10
F00122 0000      00031 EEPROM_KIT_WT_RATE_3                              de 0x00, 0x00   ;; 0x10
F00124 00032 EEPROM_KIT_ENVx_CURVE_3                           ;de 0x40        ;; 0x73
F00124 6060      00033 EEPROM_KIT_ENVx_ATTACK_3                          de 0x60, 0x60 ;; 0x74
F00126 00034 EEPROM_KIT_ENVx_DECAY_3                           ;de 0x60        ;; 0x75
F00126 4020      00035 EEPROM_KIT_ENVx_SUSTAIN_3                         de 0x20, 0x40 ;; 0x76
F00128 00036 EEPROM_KIT_ENVx_RELEASE_3                         ;de 0x40        ;; 0x77
               00037 
F00128 007F      00038 EEPROM_KIT_WAVETABLE_4                        de 0x7f, 0x00   ;; 0x10
F0012A 0000      00039 EEPROM_KIT_WT_RATE_4                              de 0x00, 0x00   ;; 0x10
F0012C 00040 EEPROM_KIT_ENVx_CURVE_4                           ;de 0x40        ;; 0x73
F0012C 6060      00041 EEPROM_KIT_ENVx_ATTACK_4                          de 0x60, 0x60 ;; 0x74
F0012E 00042 EEPROM_KIT_ENVx_DECAY_4                           ;de 0x60        ;; 0x75
F0012E 4020      00043 EEPROM_KIT_ENVx_SUSTAIN_4                         de 0x20, 0x40 ;; 0x76
F00130 00044 EEPROM_KIT_ENVx_RELEASE_4                         ;de 0x40        ;; 0x77
               00045 
F00130 007F      00046 EEPROM_KIT_WAVETABLE_5                        de 0x7f, 0x00   ;; 0x10
F00132 0000      00047 EEPROM_KIT_WT_RATE_5                              de 0x00, 0x00   ;; 0x10
F00134 00048 EEPROM_KIT_ENVx_CURVE_5                           ;de 0x40        ;; 0x73
F00134 6060      00049 EEPROM_KIT_ENVx_ATTACK_5                          de 0x60, 0x60 ;; 0x74
F00136 00050 EEPROM_KIT_ENVx_DECAY_5                           ;de 0x60        ;; 0x75
F00136 4020      00051 EEPROM_KIT_ENVx_SUSTAIN_5                         de 0x20, 0x40 ;; 0x76
F00138 00052 EEPROM_KIT_ENVx_RELEASE_5                         ;de 0x40        ;; 0x77
               00053 
F00138 007F      00054 EEPROM_KIT_WAVETABLE_6                        de 0x7f, 0x00   ;; 0x10
F0013A 0000      00055 EEPROM_KIT_WT_RATE_6                              de 0x00, 0x00   ;; 0x10
F0013C 00056 EEPROM_KIT_ENVx_CURVE_6                           ;de 0x40        ;; 0x73
F0013C 6060      00057 EEPROM_KIT_ENVx_ATTACK_6                          de 0x60, 0x60 ;; 0x74
F0013E 00058 EEPROM_KIT_ENVx_DECAY_6                           ;de 0x60        ;; 0x75
F0013E 4020      00059 EEPROM_KIT_ENVx_SUSTAIN_6                         de 0x20, 0x40 ;; 0x76
F00140 00060 EEPROM_KIT_ENVx_RELEASE_6                         ;de 0x40        ;; 0x77
               00061 
F00140 007F      00062 EEPROM_KIT_WAVETABLE_7                        de 0x7f, 0x00   ;; 0x10
F00142 0000      00063 EEPROM_KIT_WT_RATE_7                              de 0x00, 0x00   ;; 0x10
F00144 00064 EEPROM_KIT_ENVx_CURVE_7                           ;de 0x40        ;; 0x73
F00144 6060      00065 EEPROM_KIT_ENVx_ATTACK_7                          de 0x60, 0x60 ;; 0x74
F00146 00066 EEPROM_KIT_ENVx_DECAY_7                           ;de 0x60        ;; 0x75
F00146 4020      00067 EEPROM_KIT_ENVx_SUSTAIN_7                         de 0x20, 0x40 ;; 0x76
F00148 00068 EEPROM_KIT_ENVx_RELEASE_7                         ;de 0x40        ;; 0x77
               00069 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 251


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F00148 007F      00070 EEPROM_KIT_WAVETABLE_8                        de 0x7f, 0x00   ;; 0x10
F0014A 0000      00071 EEPROM_KIT_WT_RATE_8                              de 0x00, 0x00   ;; 0x10
F0014C 00072 EEPROM_KIT_ENVx_CURVE_8                           ;de 0x40        ;; 0x73
F0014C 6060      00073 EEPROM_KIT_ENVx_ATTACK_8                          de 0x60, 0x60 ;; 0x74
F0014E 00074 EEPROM_KIT_ENVx_DECAY_8                           ;de 0x60        ;; 0x75
F0014E 4020      00075 EEPROM_KIT_ENVx_SUSTAIN_8                         de 0x20, 0x40 ;; 0x76
F00150 00076 EEPROM_KIT_ENVx_RELEASE_8                         ;de 0x40        ;; 0x77
               00077 
F00150 007F      00078 EEPROM_KIT_WAVETABLE_9                        de 0x7f, 0x00   ;; 0x10
F00152 0000      00079 EEPROM_KIT_WT_RATE_9                              de 0x00, 0x00   ;; 0x10
F00154 00080 EEPROM_KIT_ENVx_CURVE_9                           ;de 0x40        ;; 0x73
F00154 6060      00081 EEPROM_KIT_ENVx_ATTACK_9                          de 0x60, 0x60 ;; 0x74
F00156 00082 EEPROM_KIT_ENVx_DECAY_9                           ;de 0x60        ;; 0x75
F00156 4020      00083 EEPROM_KIT_ENVx_SUSTAIN_9                         de 0x20, 0x40 ;; 0x76
F00158 00084 EEPROM_KIT_ENVx_RELEASE_9                         ;de 0x40        ;; 0x77
               00085 
F00158 007F      00086 EEPROM_KIT_WAVETABLE_10                        de 0x7f, 0x00   ;; 0x10
F0015A 0000      00087 EEPROM_KIT_WT_RATE_10                              de 0x00, 0x00   ;; 0x10
F0015C 00088 EEPROM_KIT_ENVx_CURVE_10                           ;de 0x40        ;; 0x73
F0015C 6060      00089 EEPROM_KIT_ENVx_ATTACK_10                         de 0x60, 0x60 ;; 0x74
F0015E 00090 EEPROM_KIT_ENVx_DECAY_10                           ;de 0x60        ;; 0x75
F0015E 4020      00091 EEPROM_KIT_ENVx_SUSTAIN_10                         de 0x20, 0x40        ;; 0x76
F00160 00092 EEPROM_KIT_ENVx_RELEASE_10                         ;de 0x40        ;; 0x77
               00093 
F00160 007F      00094 EEPROM_KIT_WAVETABLE_11                        de 0x7f, 0x00   ;; 0x10
F00162 0000      00095 EEPROM_KIT_WT_RATE_11                              de 0x00, 0x00   ;; 0x10
F00164 00096 EEPROM_KIT_ENVx_CURVE_11                           ;de 0x40        ;; 0x73
F00164 6060      00097 EEPROM_KIT_ENVx_ATTACK_11                          de 0x60, 0x60        ;; 0x74
F00166 00098 EEPROM_KIT_ENVx_DECAY_11                           ;de 0x60        ;; 0x75
F00166 4020      00099 EEPROM_KIT_ENVx_SUSTAIN_11                         de 0x20, 0x40        ;; 0x76
F00168 00100 EEPROM_KIT_ENVx_RELEASE_11                         ;de 0x40        ;; 0x77
               00101 
F00168 007F      00102 EEPROM_KIT_WAVETABLE_12                        de 0x7f, 0x00   ;; 0x52
F0016A 0000      00103 EEPROM_KIT_WT_RATE_12                              de 0x00, 0x00   ;; 0x10
F0016C 00104 EEPROM_KIT_ENVx_CURVE_12                           ;de 0x40        ;; 0x53
F0016C 6060      00105 EEPROM_KIT_ENVx_ATTACK_12                          de 0x60, 0x60        ;; 0x54
F0016E 00106 EEPROM_KIT_ENVx_DECAY_12                           ;de 0x60        ;; 0x55
F0016E 4020      00107 EEPROM_KIT_ENVx_SUSTAIN_12                         de 0x20, 0x40        ;; 0x56
F00170 00108 EEPROM_KIT_ENVx_RELEASE_12                         ;de 0x40        ;; 0x57
               00109 
F00170 007F      00110 EEPROM_KIT_WAVETABLE_13                        de 0x7f, 0x00   ;; 0x58
F00172 0000      00111 EEPROM_KIT_WT_RATE_13                              de 0x00, 0x00   ;; 0x10
F00174 00112 EEPROM_KIT_ENVx_CURVE_13                           ;de 0x40        ;; 0x59
F00174 6060      00113 EEPROM_KIT_ENVx_ATTACK_13                          de 0x60, 0x60        ;; 0x5a
F00176 00114 EEPROM_KIT_ENVx_DECAY_13                           ;de 0x60        ;; 0x5b
F00176 4020      00115 EEPROM_KIT_ENVx_SUSTAIN_13                         de 0x20, 0x40        ;; 0x5c
F00178 00116 EEPROM_KIT_ENVx_RELEASE_13                         ;de 0x40        ;; 0x5d
               00117 
F00178 007F      00118 EEPROM_KIT_WAVETABLE_14                        de 0x7f, 0x00   ;; 0x5e
F0017A 0000      00119 EEPROM_KIT_WT_RATE_14                              de 0x00, 0x00   ;; 0x10
F0017C 00120 EEPROM_KIT_ENVx_CURVE_14                           ;de 0x40        ;; 0x5f
F0017C 6060      00121 EEPROM_KIT_ENVx_ATTACK_14                          de 0x60, 0x60        ;; 0x60
F0017E 00122 EEPROM_KIT_ENVx_DECAY_14                           ;de 0x60        ;; 0x61
F0017E 4020      00123 EEPROM_KIT_ENVx_SUSTAIN_14                         de 0x20, 0x40        ;; 0x62
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 252


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F00180 00124 EEPROM_KIT_ENVx_RELEASE_14                         ;de 0x40        ;; 0x63
               00125 
F00180 007F      00126 EEPROM_KIT_WAVETABLE_15                        de 0x7f, 0x00   ;; 0x64
F00182 0000      00127 EEPROM_KIT_WT_RATE_15                              de 0x00, 0x00   ;; 0x10
F00184 00128 EEPROM_KIT_ENVx_CURVE_15                           ;de 0x40        ;; 0x65
F00184 6060      00129 EEPROM_KIT_ENVx_ATTACK_15                          de 0x60, 0x60        ;; 0x66
F00186 00130 EEPROM_KIT_ENVx_DECAY_15                           ;de 0x60        ;; 0x67
F00186 4020      00131 EEPROM_KIT_ENVx_SUSTAIN_15                         de 0x20, 0x40        ;; 0x68
F00188 00132 EEPROM_KIT_ENVx_RELEASE_15                         ;de 0x40        ;; 0x69
               00133 
F00188 007F      00134 EEPROM_KIT_WAVETABLE_16                        de 0x7f, 0x00   ;; 0x6a
F0018A 0000      00135 EEPROM_KIT_WT_RATE_16                              de 0x00, 0x00   ;; 0x10
F0018C 00136 EEPROM_KIT_ENVx_CURVE_16                           ;de 0x40        ;; 0x6b
F0018C 6060      00137 EEPROM_KIT_ENVx_ATTACK_16                          de 0x60, 0x60        ;; 0x6c
F0018E 00138 EEPROM_KIT_ENVx_DECAY_16                           ;de 0x60        ;; 0x6d
F0018E 4020      00139 EEPROM_KIT_ENVx_SUSTAIN_16                         de 0x20, 0x40        ;; 0x6e
F00190 00140 EEPROM_KIT_ENVx_RELEASE_16                         ;de 0x40        ;; 0x6f
               00141 
               00031 
               00032 
               00033 ;; ==========================================================================
               00034 ;; misc parameters which are stored in internal EEPROM
               00035 ;; ==========================================================================
F00200           00036         org     0xf00200
F00200 00037 EEPROM_WAVETABLE
               00038 #include "src/tia_preset_wt.inc"
               00001 ; $Id: tia_preset_w.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Wavetable Preset (EEPROM content)
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
F00200 6E49 2E74 00013         de  'I','n','t','.',' ','W','a','v','e','t','a','b','l','e',' ',' '
     5720 7661 
     7465 6261 
     656C 2020 
F00210 007F 0000 00014         de      0x7f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     0000 0000 
     0000 0000 
     0000 0000 
F00220 0000 0000 00015         de      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     0000 0000 
     0000 0000 
     0000 0000 
F00230 0000 0000 00016         de      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     0000 0000 
     0000 0000 
     0000 0000 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 253


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F00240 0000 0000 00017         de      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     0000 0000 
     0000 0000 
     0000 0000 
F00250 0000 0000 00018         de      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     0000 0000 
     0000 0000 
     0000 0000 
F00260 0000 0000 00019     de  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     0000 0000 
     0000 0000 
     0000 0000 
F00270 0000 0000 00020         de      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     0000 0000 
     0000 0000 
     0000 0000 
               00039 
               00040 ;; ==========================================================================
               00041 ;; misc parameters which are stored in internal EEPROM
               00042 ;; ==========================================================================
F00300           00043         org     0xf00300
F00300 00044 EEPROM_BANK_NAME
F00300 6E49 6574 00045         de  'I','n','t','e','r','n','a','l',' ',' ',' ',' ',' ',' ',' ',' '
     6E72 6C61 
     2020 2020 
     2020 2020 
F00310 00046 NEW_BANK_NAME
F00310 654E 2077 00047         de  'N','e','w',' ','B','a','n','k',' ',' ',' ',' ',' ',' ',' ',' '
     6142 6B6E 
     2020 2020 
     2020 2020 
F00320 00048 NEW_KIT_NAME
F00320 654E 2077 00049         de  'N','e','w',' ','K','i','t',' ',' ',' ',' ',' ',' ',' ',' ',' '
     694B 2074 
     2020 2020 
     2020 2020 
F00330 00050 NEW_WAVETABLE_NAME
F00330 654E 2077 00406 
     6157 6576 
     6274 206C 
     2020 2020 
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 254


SYMBOL TABLE
  LABEL                             VALUE 

A                                 00000000
ABAT                              00000004
ABDEN                             00000000
ABDOVF                            00000007
ACCESS                            00000000
ACKDT                             00000005
ACKEN                             00000004
ACKSTAT                           00000006
ACQT0                             00000003
ACQT1                             00000004
ACQT2                             00000005
ADCON0                            00000FC2
ADCON1                            00000FC1
ADCON2                            00000FC0
ADCS0                             00000000
ADCS1                             00000001
ADCS2                             00000002
ADDEN                             00000003
ADEN                              00000003
ADFM                              00000007
ADIE                              00000006
ADIF                              00000006
ADIP                              00000006
ADON                              00000000
ADRES                             00000FC3
ADRESH                            00000FC4
ADRESL                            00000FC3
AN0                               00000000
AN1                               00000001
AN10                              00000000
AN2                               00000002
AN3                               00000003
AN4                               00000005
AN5                               00000000
AN6                               00000001
AN7                               00000002
AN8                               00000001
AN9                               00000004
AOUT_FILTER_TMP_H                 0000006D
AOUT_FILTER_TMP_L                 0000006C
AOUT_INVERTED                     0000006E
AOUT_UPDATE_REQ                   0000006F
AOUT_VALUES                       00000070
ASSIGNED_ENVS_1                   00000004
ASSIGNED_ENVS_2                   00000005
ASSIGNED_ENVS_A0                  00000006
ASSIGNED_ENVS_A1                  00000007
ASSIGNED_LFOS_1                   00000000
ASSIGNED_LFOS_2                   00000001
ASSIGNED_LFOS_3                   00000002
ASSIGNED_LFOS_4                   00000003
B0CON                             00000E20
B0D0                              00000E26
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 255


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B0D00                             00000000
B0D01                             00000001
B0D02                             00000002
B0D03                             00000003
B0D04                             00000004
B0D05                             00000005
B0D06                             00000006
B0D07                             00000007
B0D1                              00000E27
B0D10                             00000000
B0D11                             00000001
B0D12                             00000002
B0D13                             00000003
B0D14                             00000004
B0D15                             00000005
B0D16                             00000006
B0D17                             00000007
B0D2                              00000E28
B0D20                             00000000
B0D21                             00000001
B0D22                             00000002
B0D23                             00000003
B0D24                             00000004
B0D25                             00000005
B0D26                             00000006
B0D27                             00000007
B0D3                              00000E29
B0D30                             00000000
B0D31                             00000001
B0D32                             00000002
B0D33                             00000003
B0D34                             00000004
B0D35                             00000005
B0D36                             00000006
B0D37                             00000007
B0D4                              00000E2A
B0D40                             00000000
B0D41                             00000001
B0D42                             00000002
B0D43                             00000003
B0D44                             00000004
B0D45                             00000005
B0D46                             00000006
B0D47                             00000007
B0D5                              00000E2B
B0D50                             00000000
B0D51                             00000001
B0D52                             00000002
B0D53                             00000003
B0D54                             00000004
B0D55                             00000005
B0D56                             00000006
B0D57                             00000007
B0D6                              00000E2C
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 256


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B0D60                             00000000
B0D61                             00000001
B0D62                             00000002
B0D63                             00000003
B0D64                             00000004
B0D65                             00000005
B0D66                             00000006
B0D67                             00000007
B0D7                              00000E2D
B0D70                             00000000
B0D71                             00000001
B0D72                             00000002
B0D73                             00000003
B0D74                             00000004
B0D75                             00000005
B0D76                             00000006
B0D77                             00000007
B0DLC                             00000E25
B0EIDH                            00000E23
B0EIDL                            00000E24
B0IE                              00000002
B0SIDH                            00000E21
B0SIDL                            00000E22
B0TXEN                            00000002
B1CON                             00000E30
B1D0                              00000E36
B1D00                             00000000
B1D01                             00000001
B1D02                             00000002
B1D03                             00000003
B1D04                             00000004
B1D05                             00000005
B1D06                             00000006
B1D07                             00000007
B1D1                              00000E37
B1D10                             00000000
B1D11                             00000001
B1D12                             00000002
B1D13                             00000003
B1D14                             00000004
B1D15                             00000005
B1D16                             00000006
B1D17                             00000007
B1D2                              00000E38
B1D20                             00000000
B1D21                             00000001
B1D22                             00000002
B1D23                             00000003
B1D24                             00000004
B1D25                             00000005
B1D26                             00000006
B1D27                             00000007
B1D3                              00000E39
B1D30                             00000000
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 257


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B1D31                             00000001
B1D32                             00000002
B1D33                             00000003
B1D34                             00000004
B1D35                             00000005
B1D36                             00000006
B1D37                             00000007
B1D4                              00000E3A
B1D40                             00000000
B1D41                             00000001
B1D42                             00000002
B1D43                             00000003
B1D44                             00000004
B1D45                             00000005
B1D46                             00000006
B1D47                             00000007
B1D5                              00000E3B
B1D50                             00000000
B1D51                             00000001
B1D52                             00000002
B1D53                             00000003
B1D54                             00000004
B1D55                             00000005
B1D56                             00000006
B1D57                             00000007
B1D6                              00000E3C
B1D60                             00000000
B1D61                             00000001
B1D62                             00000002
B1D63                             00000003
B1D64                             00000004
B1D65                             00000005
B1D66                             00000006
B1D67                             00000007
B1D7                              00000E3D
B1D70                             00000000
B1D71                             00000001
B1D72                             00000002
B1D73                             00000003
B1D74                             00000004
B1D75                             00000005
B1D76                             00000006
B1D77                             00000007
B1DLC                             00000E35
B1EIDH                            00000E33
B1EIDL                            00000E34
B1IE                              00000003
B1SIDH                            00000E31
B1SIDL                            00000E32
B1TXEN                            00000003
B2CON                             00000E40
B2D0                              00000E46
B2D00                             00000000
B2D01                             00000001
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 258


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B2D02                             00000002
B2D03                             00000003
B2D04                             00000004
B2D05                             00000005
B2D06                             00000006
B2D07                             00000007
B2D1                              00000E47
B2D10                             00000000
B2D11                             00000001
B2D12                             00000002
B2D13                             00000003
B2D14                             00000004
B2D15                             00000005
B2D16                             00000006
B2D17                             00000007
B2D2                              00000E48
B2D20                             00000000
B2D21                             00000001
B2D22                             00000002
B2D23                             00000003
B2D24                             00000004
B2D25                             00000005
B2D26                             00000006
B2D27                             00000007
B2D3                              00000E49
B2D30                             00000000
B2D31                             00000001
B2D32                             00000002
B2D33                             00000003
B2D34                             00000004
B2D35                             00000005
B2D36                             00000006
B2D37                             00000007
B2D4                              00000E4A
B2D40                             00000000
B2D41                             00000001
B2D42                             00000002
B2D43                             00000003
B2D44                             00000004
B2D45                             00000005
B2D46                             00000006
B2D47                             00000007
B2D5                              00000E4B
B2D50                             00000000
B2D51                             00000001
B2D52                             00000002
B2D53                             00000003
B2D54                             00000004
B2D55                             00000005
B2D56                             00000006
B2D57                             00000007
B2D6                              00000E4C
B2D60                             00000000
B2D61                             00000001
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 259


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B2D62                             00000002
B2D63                             00000003
B2D64                             00000004
B2D65                             00000005
B2D66                             00000006
B2D67                             00000007
B2D7                              00000E4D
B2D70                             00000000
B2D71                             00000001
B2D72                             00000002
B2D73                             00000003
B2D74                             00000004
B2D75                             00000005
B2D76                             00000006
B2D77                             00000007
B2DLC                             00000E45
B2EIDH                            00000E43
B2EIDL                            00000E44
B2IE                              00000004
B2SIDH                            00000E41
B2SIDL                            00000E42
B2TXEN                            00000004
B3CON                             00000E50
B3D0                              00000E56
B3D00                             00000000
B3D01                             00000001
B3D02                             00000002
B3D03                             00000003
B3D04                             00000004
B3D05                             00000005
B3D06                             00000006
B3D07                             00000007
B3D1                              00000E57
B3D10                             00000000
B3D11                             00000001
B3D12                             00000002
B3D13                             00000003
B3D14                             00000004
B3D15                             00000005
B3D16                             00000006
B3D17                             00000007
B3D2                              00000E58
B3D20                             00000000
B3D21                             00000001
B3D22                             00000002
B3D23                             00000003
B3D24                             00000004
B3D25                             00000005
B3D26                             00000006
B3D27                             00000007
B3D3                              00000E59
B3D30                             00000000
B3D31                             00000001
B3D32                             00000002
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 260


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B3D33                             00000003
B3D34                             00000004
B3D35                             00000005
B3D36                             00000006
B3D37                             00000007
B3D4                              00000E5A
B3D40                             00000000
B3D41                             00000001
B3D42                             00000002
B3D43                             00000003
B3D44                             00000004
B3D45                             00000005
B3D46                             00000006
B3D47                             00000007
B3D5                              00000E5B
B3D50                             00000000
B3D51                             00000001
B3D52                             00000002
B3D53                             00000003
B3D54                             00000004
B3D55                             00000005
B3D56                             00000006
B3D57                             00000007
B3D6                              00000E5C
B3D60                             00000000
B3D61                             00000001
B3D62                             00000002
B3D63                             00000003
B3D64                             00000004
B3D65                             00000005
B3D66                             00000006
B3D67                             00000007
B3D7                              00000E5D
B3D70                             00000000
B3D71                             00000001
B3D72                             00000002
B3D73                             00000003
B3D74                             00000004
B3D75                             00000005
B3D76                             00000006
B3D77                             00000007
B3DLC                             00000E55
B3EIDH                            00000E53
B3EIDL                            00000E54
B3IE                              00000005
B3SIDH                            00000E51
B3SIDL                            00000E52
B3TXEN                            00000005
B46D77                            00000007
B4CON                             00000E60
B4D0                              00000E66
B4D00                             00000000
B4D01                             00000001
B4D02                             00000002
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 261


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B4D03                             00000003
B4D04                             00000004
B4D05                             00000005
B4D06                             00000006
B4D07                             00000007
B4D1                              00000E67
B4D10                             00000000
B4D11                             00000001
B4D12                             00000002
B4D13                             00000003
B4D14                             00000004
B4D15                             00000005
B4D16                             00000006
B4D17                             00000007
B4D2                              00000E68
B4D20                             00000000
B4D21                             00000001
B4D22                             00000002
B4D23                             00000003
B4D24                             00000004
B4D25                             00000005
B4D26                             00000006
B4D27                             00000007
B4D3                              00000E69
B4D30                             00000000
B4D31                             00000001
B4D32                             00000002
B4D33                             00000003
B4D34                             00000004
B4D35                             00000005
B4D36                             00000006
B4D37                             00000007
B4D4                              00000E6A
B4D40                             00000000
B4D41                             00000001
B4D42                             00000002
B4D43                             00000003
B4D44                             00000004
B4D45                             00000005
B4D46                             00000006
B4D47                             00000007
B4D5                              00000E6B
B4D50                             00000000
B4D51                             00000001
B4D52                             00000002
B4D53                             00000003
B4D54                             00000004
B4D55                             00000005
B4D56                             00000006
B4D57                             00000007
B4D6                              00000E6C
B4D60                             00000000
B4D61                             00000001
B4D62                             00000002
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 262


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B4D63                             00000003
B4D64                             00000004
B4D65                             00000005
B4D66                             00000006
B4D67                             00000007
B4D7                              00000E6D
B4D70                             00000000
B4D71                             00000001
B4D72                             00000002
B4D73                             00000003
B4D74                             00000004
B4D75                             00000005
B4D76                             00000006
B4D77                             00000007
B4DLC                             00000E65
B4EIDH                            00000E63
B4EIDL                            00000E64
B4IE                              00000006
B4SIDH                            00000E61
B4SIDL                            00000E62
B4TXEN                            00000006
B57D07                            00000007
B57D23                            00000003
B5CON                             00000E70
B5D0                              00000E76
B5D00                             00000000
B5D01                             00000001
B5D02                             00000002
B5D03                             00000003
B5D04                             00000004
B5D05                             00000005
B5D06                             00000006
B5D07                             00000007
B5D1                              00000E77
B5D10                             00000000
B5D11                             00000001
B5D12                             00000002
B5D13                             00000003
B5D14                             00000004
B5D15                             00000005
B5D16                             00000006
B5D17                             00000007
B5D2                              00000E78
B5D20                             00000000
B5D21                             00000001
B5D22                             00000002
B5D23                             00000003
B5D24                             00000004
B5D25                             00000005
B5D26                             00000006
B5D27                             00000007
B5D3                              00000E79
B5D30                             00000000
B5D31                             00000001
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 263


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
B5D32                             00000002
B5D33                             00000003
B5D34                             00000004
B5D35                             00000005
B5D36                             00000006
B5D37                             00000007
B5D4                              00000E7A
B5D40                             00000000
B5D41                             00000001
B5D42                             00000002
B5D43                             00000003
B5D44                             00000004
B5D45                             00000005
B5D46                             00000006
B5D47                             00000007
B5D5                              00000E7B
B5D50                             00000000
B5D51                             00000001
B5D52                             00000002
B5D53                             00000003
B5D54                             00000004
B5D55                             00000005
B5D56                             00000006
B5D57                             00000007
B5D6                              00000E7C
B5D60                             00000000
B5D61                             00000001
B5D62                             00000002
B5D63                             00000003
B5D64                             00000004
B5D65                             00000005
B5D66                             00000006
B5D67                             00000007
B5D7                              00000E7D
B5D70                             00000000
B5D71                             00000001
B5D72                             00000002
B5D73                             00000003
B5D74                             00000004
B5D75                             00000005
B5D76                             00000006
B5D77                             00000007
B5DLC                             00000E75
B5EIDH                            00000E73
B5EIDL                            00000E74
B5IE                              00000007
B5SIDH                            00000E71
B5SIDL                            00000E72
B5TXEN                            00000007
BANKED                            00000001
BANKSTICK_FORMAT_BEGIN            00000700
BANKSTICK_FORMAT_END              000007FF
BAUDCON                           00000FB8
BCLIE                             00000003
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 264


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
BCLIF                             00000003
BCLIP                             00000003
BF                                00000000
BGST                              00000005
BIE0                              00000DFA
BOR                               00000000
BRG16                             00000003
BRGCON1                           00000F70
BRGCON2                           00000F71
BRGCON3                           00000F72
BRGH                              00000002
BRP0                              00000000
BRP1                              00000001
BRP2                              00000002
BRP3                              00000003
BRP4                              00000004
BRP5                              00000005
BSEL0                             00000DF8
BSR                               00000FE0
C                                 00000000
C1INA                             00000001
C1INB                             00000000
C1INV                             00000004
C1OUT                             00000006
C2INA                             00000003
C2INB                             00000002
C2INV                             00000005
C2OUT                             00000007
CANCAP                            00000004
CANCON                            00000F6F
CANCON_RO0                        00000F5F
CANCON_RO1                        00000F4F
CANCON_RO2                        00000F3F
CANCON_RO3                        00000F2F
CANCON_RO4                        00000E7F
CANCON_RO5                        00000E6F
CANCON_RO6                        00000E5F
CANCON_RO7                        00000E4F
CANCON_RO8                        00000E3F
CANCON_RO9                        00000E2F
CANRX                             00000003
CANSTAT                           00000F6E
CANSTAT_RO0                       00000F5E
CANSTAT_RO1                       00000F4E
CANSTAT_RO2                       00000F3E
CANSTAT_RO3                       00000F2E
CANSTAT_RO4                       00000E7E
CANSTAT_RO5                       00000E6E
CANSTAT_RO6                       00000E5E
CANSTAT_RO7                       00000E4E
CANSTAT_RO8                       00000E3E
CANSTAT_RO9                       00000E2E
CANTX                             00000002
CCP1                              00000002
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 265


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
CCP1CON                           00000FBD
CCP1IE                            00000002
CCP1IF                            00000002
CCP1IP                            00000002
CCP1M0                            00000000
CCP1M1                            00000001
CCP1M2                            00000002
CCP1M3                            00000003
CCPR1                             00000FBE
CCPR1H                            00000FBF
CCPR1L                            00000FBE
CFGS                              00000006
CHS0                              00000002
CHS1                              00000003
CHS2                              00000004
CHS3                              00000005
CIOCON                            00000F73
CIS                               00000003
CK                                00000006
CKE                               00000006
CKP                               00000004
CLKI                              00000007
CLKO                              00000006
CM0                               00000000
CM1                               00000001
CM2                               00000002
CMCON                             00000FB4
CMIE                              00000006
CMIF                              00000006
CMIP                              00000006
COMSTAT                           00000F74
CREN                              00000004
CS                                00000002
CSRC                              00000007
CS_MENU_SPECIAL_CHARS             00003456
CVR0                              00000000
CVR1                              00000001
CVR2                              00000002
CVR3                              00000003
CVRCON                            00000FB5
CVREF_CVRCON                      00000004
CVREF_PORTA                       00000000
CVREN                             00000007
CVROE                             00000006
CVRR                              00000005
CVRSS                             00000004
D                                 00000005
DATA_ADDRESS                      00000005
DC                                00000001
DC1B0                             00000004
DC1B1                             00000005
DEBUG_MSG_SendASMString           000034D8
DEBUG_MSG_SendASMStringLoop       000034E4
DEBUG_MSG_SendASMStringLoop_End   000034EE
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 266


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
DEBUG_MSG_SendASMString_NoIAlign  000034FE
DEBUG_MSG_SendBCD1                00003510
DEBUG_MSG_SendBCD1_Cont           00003568
DEBUG_MSG_SendBCD2                00003526
DEBUG_MSG_SendBCD2_Cont           0000355E
DEBUG_MSG_SendBCD3                0000352E
DEBUG_MSG_SendBCD3_Cont           00003554
DEBUG_MSG_SendBCD4                00003536
DEBUG_MSG_SendBCD4_Cont           0000354A
DEBUG_MSG_SendBCD5                0000353C
DEBUG_MSG_SendBCD5_Cont           00003540
DEBUG_MSG_SendBCD_D1              00003578
DEBUG_MSG_SendBCD_D2              00003574
DEBUG_MSG_SendBCD_D3              00003570
DEBUG_MSG_SendBCD_D4              0000356C
DEBUG_MSG_SendBCD_D5              0000356A
DEBUG_MSG_SendChar                000034D2
DEBUG_MSG_SendFooter              000034CA
DEBUG_MSG_SendHeader              00003496
DEBUG_MSG_SendHex1                00003510
DEBUG_MSG_SendHex2                0000351C
DFLC0                             00000000
DFLC1                             00000001
DFLC2                             00000002
DFLC3                             00000003
DFLC4                             00000004
DIV_A_0                           000001F8
DIV_A_1                           000001F9
DIV_A_2                           000001FA
DIV_B_0                           000001FB
DIV_B_1                           000001FC
DIV_COUNT                         000001FD
DIV_REM_0                         000001FE
DIV_REM_1                         000001FF
DLC0                              00000000
DLC1                              00000001
DLC2                              00000002
DLC3                              00000003
DONE                              00000001
D_A                               00000005
ECANCON                           00000F77
ECCP1                             00000004
ECCP1AS                           00000FB6
ECCP1CON                          00000FBA
ECCP1DEL                          00000FB7
ECCP1IE                           00000000
ECCP1IF                           00000000
ECCP1IP                           00000000
ECCP1M0                           00000000
ECCP1M1                           00000001
ECCP1M2                           00000002
ECCP1M3                           00000003
ECCPAS0                           00000004
ECCPAS1                           00000005
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 267


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
ECCPAS2                           00000006
ECCPASE                           00000007
ECCPR1                            00000FBB
ECCPR1H                           00000FBC
ECCPR1L                           00000FBB
EDC1B0                            00000004
EDC1B1                            00000005
EEADR                             00000FA9
EEADRH                            00000FAA
EECON1                            00000FA6
EECON2                            00000FA7
EEDATA                            00000FA8
EEIE                              00000004
EEIF                              00000004
EEIP                              00000004
EEPGD                             00000007
EEPROM_BANK_NAME                  00F00300
EEPROM_CFG_BASE                   00F0007C
EEPROM_KIT                        00F00100
EEPROM_KIT_ENVx_ATTACK_1          00F00114
EEPROM_KIT_ENVx_ATTACK_10         00F0015C
EEPROM_KIT_ENVx_ATTACK_11         00F00164
EEPROM_KIT_ENVx_ATTACK_12         00F0016C
EEPROM_KIT_ENVx_ATTACK_13         00F00174
EEPROM_KIT_ENVx_ATTACK_14         00F0017C
EEPROM_KIT_ENVx_ATTACK_15         00F00184
EEPROM_KIT_ENVx_ATTACK_16         00F0018C
EEPROM_KIT_ENVx_ATTACK_2          00F0011C
EEPROM_KIT_ENVx_ATTACK_3          00F00124
EEPROM_KIT_ENVx_ATTACK_4          00F0012C
EEPROM_KIT_ENVx_ATTACK_5          00F00134
EEPROM_KIT_ENVx_ATTACK_6          00F0013C
EEPROM_KIT_ENVx_ATTACK_7          00F00144
EEPROM_KIT_ENVx_ATTACK_8          00F0014C
EEPROM_KIT_ENVx_ATTACK_9          00F00154
EEPROM_KIT_ENVx_CURVE_1           00F00114
EEPROM_KIT_ENVx_CURVE_10          00F0015C
EEPROM_KIT_ENVx_CURVE_11          00F00164
EEPROM_KIT_ENVx_CURVE_12          00F0016C
EEPROM_KIT_ENVx_CURVE_13          00F00174
EEPROM_KIT_ENVx_CURVE_14          00F0017C
EEPROM_KIT_ENVx_CURVE_15          00F00184
EEPROM_KIT_ENVx_CURVE_16          00F0018C
EEPROM_KIT_ENVx_CURVE_2           00F0011C
EEPROM_KIT_ENVx_CURVE_3           00F00124
EEPROM_KIT_ENVx_CURVE_4           00F0012C
EEPROM_KIT_ENVx_CURVE_5           00F00134
EEPROM_KIT_ENVx_CURVE_6           00F0013C
EEPROM_KIT_ENVx_CURVE_7           00F00144
EEPROM_KIT_ENVx_CURVE_8           00F0014C
EEPROM_KIT_ENVx_CURVE_9           00F00154
EEPROM_KIT_ENVx_DECAY_1           00F00116
EEPROM_KIT_ENVx_DECAY_10          00F0015E
EEPROM_KIT_ENVx_DECAY_11          00F00166
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 268


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
EEPROM_KIT_ENVx_DECAY_12          00F0016E
EEPROM_KIT_ENVx_DECAY_13          00F00176
EEPROM_KIT_ENVx_DECAY_14          00F0017E
EEPROM_KIT_ENVx_DECAY_15          00F00186
EEPROM_KIT_ENVx_DECAY_16          00F0018E
EEPROM_KIT_ENVx_DECAY_2           00F0011E
EEPROM_KIT_ENVx_DECAY_3           00F00126
EEPROM_KIT_ENVx_DECAY_4           00F0012E
EEPROM_KIT_ENVx_DECAY_5           00F00136
EEPROM_KIT_ENVx_DECAY_6           00F0013E
EEPROM_KIT_ENVx_DECAY_7           00F00146
EEPROM_KIT_ENVx_DECAY_8           00F0014E
EEPROM_KIT_ENVx_DECAY_9           00F00156
EEPROM_KIT_ENVx_RELEASE_1         00F00118
EEPROM_KIT_ENVx_RELEASE_10        00F00160
EEPROM_KIT_ENVx_RELEASE_11        00F00168
EEPROM_KIT_ENVx_RELEASE_12        00F00170
EEPROM_KIT_ENVx_RELEASE_13        00F00178
EEPROM_KIT_ENVx_RELEASE_14        00F00180
EEPROM_KIT_ENVx_RELEASE_15        00F00188
EEPROM_KIT_ENVx_RELEASE_16        00F00190
EEPROM_KIT_ENVx_RELEASE_2         00F00120
EEPROM_KIT_ENVx_RELEASE_3         00F00128
EEPROM_KIT_ENVx_RELEASE_4         00F00130
EEPROM_KIT_ENVx_RELEASE_5         00F00138
EEPROM_KIT_ENVx_RELEASE_6         00F00140
EEPROM_KIT_ENVx_RELEASE_7         00F00148
EEPROM_KIT_ENVx_RELEASE_8         00F00150
EEPROM_KIT_ENVx_RELEASE_9         00F00158
EEPROM_KIT_ENVx_SUSTAIN_1         00F00116
EEPROM_KIT_ENVx_SUSTAIN_10        00F0015E
EEPROM_KIT_ENVx_SUSTAIN_11        00F00166
EEPROM_KIT_ENVx_SUSTAIN_12        00F0016E
EEPROM_KIT_ENVx_SUSTAIN_13        00F00176
EEPROM_KIT_ENVx_SUSTAIN_14        00F0017E
EEPROM_KIT_ENVx_SUSTAIN_15        00F00186
EEPROM_KIT_ENVx_SUSTAIN_16        00F0018E
EEPROM_KIT_ENVx_SUSTAIN_2         00F0011E
EEPROM_KIT_ENVx_SUSTAIN_3         00F00126
EEPROM_KIT_ENVx_SUSTAIN_4         00F0012E
EEPROM_KIT_ENVx_SUSTAIN_5         00F00136
EEPROM_KIT_ENVx_SUSTAIN_6         00F0013E
EEPROM_KIT_ENVx_SUSTAIN_7         00F00146
EEPROM_KIT_ENVx_SUSTAIN_8         00F0014E
EEPROM_KIT_ENVx_SUSTAIN_9         00F00156
EEPROM_KIT_WAVETABLE_1            00F00110
EEPROM_KIT_WAVETABLE_10           00F00158
EEPROM_KIT_WAVETABLE_11           00F00160
EEPROM_KIT_WAVETABLE_12           00F00168
EEPROM_KIT_WAVETABLE_13           00F00170
EEPROM_KIT_WAVETABLE_14           00F00178
EEPROM_KIT_WAVETABLE_15           00F00180
EEPROM_KIT_WAVETABLE_16           00F00188
EEPROM_KIT_WAVETABLE_2            00F00118
gpasm-0.13.7 beta               setup_tia_cartridge.asm1-30-2014  10:42:05          PAGE 269


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
EEPROM_KIT_WAVETABLE_3            00F00120
EEPROM_KIT_WAVETABLE_4            00F00128
EEPROM_KIT_WAVETABLE_5            00F00130
EEPROM_KIT_WAVETABLE_6            00F00138
EEPROM_KIT_WAVETABLE_7            00F00140
EEPROM_KIT_WAVETABLE_8            00F00148
EEPROM_KIT_WAVETABLE_9            00F00150
EEPROM_KIT_WT_RATE_1              00F00112
EEPROM_KIT_WT_RATE_10             00F0015A
EEPROM_KIT_WT_RATE_11             00F00162
EEPROM_KIT_WT_RATE_12             00F0016A
EEPROM_KIT_WT_RATE_13             00F00172
EEPROM_KIT_WT_RATE_14             00F0017A
EEPROM_KIT_WT_RATE_15             00F00182
EEPROM_KIT_WT_RATE_16             00F0018A
EEPROM_KIT_WT_RATE_2              00F0011A
EEPROM_KIT_WT_RATE_3              00F00122
EEPROM_KIT_WT_RATE_4              00F0012A
EEPROM_KIT_WT_RATE_5              00F00132
EEPROM_KIT_WT_RATE_6              00F0013A
EEPROM_KIT_WT_RATE_7              00F00142
EEPROM_KIT_WT_RATE_8              00F0014A
EEPROM_KIT_WT_RATE_9              00F00152
EEPROM_PATCH                      00F00000
EEPROM_PATCH_AFTERTOUCH_ASSIGN    00F0001E
EEPROM_PATCH_AFTERTOUCH_DEPTH     00F00020
EEPROM_PATCH_AFTERTOUCH_INIT      00F0001E
EEPROM_PATCH_CFG_FREE             00F00080
EEPROM_PATCH_DEVICE               00F0007E
EEPROM_PATCH_ENV1_ATTACK          00F0006E
EEPROM_PATCH_ENV1_CURVE           00F0006E
EEPROM_PATCH_ENV1_DECAY           00F00070
EEPROM_PATCH_ENV1_DEPTH           00F0006C
EEPROM_PATCH_ENV1_RELEASE         00F00072
EEPROM_PATCH_ENV1_SUSTAIN         00F00070
EEPROM_PATCH_ENV2_ATTACK          00F00074
EEPROM_PATCH_ENV2_CURVE           00F00074
EEPROM_PATCH_EN