Subversion Repositories svn.mios

Rev

Blame | Last modification | View Log | RSS feed

gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          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 base module
               00005 ;
               00006 
               00007 
               00008     ;; here you can change the default device ID - if you are using
               00009         ;; some cores as slave, set:
               00010         ;;    o DEFAULT_DEVICE_ID 0x01  ; for the first slave
               00011         ;;    o DEFAULT_DEVICE_ID 0x02  ; for the second slave
               00012         ;;    o DEFAULT_DEVICE_ID 0x03  ; for the third slave
0000 00013 #define DEFAULT_DEVICE_ID 0x00
               00014 
               00015         ;; if this option is enabled (1), the DEFAULT_DEVICE_ID won't be used, but
               00016         ;; it will be automatically derived from the MIOS Device ID instead
0000 00017 #define AUTO_DEVICE_ID  1
               00018         
               00019         ;; default MIDI channel:
0000 00020 #define DEFAULT_MIDI_CHANNEL  1
               00021 
               00022     ;; if != 0, special variations for cartridge version hardware:
0000 00023 #define DEFAULT_IS_CARTRIDGE  1
               00024 
               00025     ;; Kit and Wavetable fisrt:
               00026     ;;      position, banks start at this bankstick address(id):
               00027     ;;      Becarrefull! Change this value may reformat your BankStick
               00028     ;;      look at DEFAULT_BS_FPROTECT Value *!
0000 00029 #define DEFAULT_BS_KBANK_ID   5
               00030     ;; Default BankStick format protection:
               00031     ;;      0: No protection.
               00032     ;;     *1: Protects banks which are not good type or position.
               00033     ;;      Depend on DEFAULT_BS_KBANK_ID.
               00034     ;;      2: Never format at startup.
0000 00035 #define DEFAULT_BS_FPROTECT   1
               00036     ;; BankStick read only:
0000 00037 #define DEFAULT_BS_READONLY   0
               00038 
               00039     ;; Default EEPROM Protection:
               00040     ;;      Eeprom read only:
0000 00041 #define DEFAULT_EE_READONLY   0
               00042     ;;      internal patch Protection
               00043 
               00044     ;; Adjustable Gate fade out option:
               00045     ;; to avoid click when envelope is off or envelope release is null.
               00046     ;; Uses USER_Timer period N * 819 (us), default N=2 (1.638ms).
0000 00047 #define DEFAULT_TIA_GATE_FADEOUT   2
               00048 
               00049 
               00050 ;; here you can change Serial DOG LCD connection pins
               00051 ;; for Cartridge version
               00052 #if DEFAULT_IS_CARTRIDGE
               00053 ;; Clock/data/DC
0000 00054 #define USER_LCD_TRIS_SCLK  TRISB
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE  2


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
0000 00055 #define USER_LCD_LAT_SCLK       LATB    ; Pin B.3
0000 00056 #define USER_LCD_PIN_SCLK       3
0000 00057 #define USER_LCD_TRIS_SDA   TRISB
0000 00058 #define USER_LCD_LAT_SDA        LATB    ; Pin B.2
0000 00059 #define USER_LCD_PIN_SDA        2
0000 00060 #define USER_LCD_TRIS_DC    TRISB
0000 00061 #define USER_LCD_LAT_DC         LATB    ; Pin B.1
0000 00062 #define USER_LCD_PIN_DC         1
               00063 
               00064 ;; Chip Select Line
0000 00065 #define USER_LCD_TRIS_CS        TRISB
0000 00066 #define USER_LCD_LAT_CS         LATB    ; 
0000 00067 #define USER_LCD_PIN_CS0    3
               00068 #endif
               00069 
               00070 
               00071         ;; use PORTA and PORTE (J5 of the core module) as output
               00072         ;; you can address these pins in cs_menu_io_tables.inc as "shift register" #0
0000 00073 #define ENABLE_J5 0
               00074 
0000 00075 #define TIA_LEDMTR_ENABLE       0
               00076     ;; define the shift registers (note: HERE the shift register begin with 0: 1st SR is 0, 2nd is 1, 3rd is 2, ...)
0000 00077 #define TIA_LEDMTR_REG  0       ; shift register for led metering (HERE: first shift register in the chain)
               00078 
               00079     ;; For MIDI activity monitor:
0000 00080 #define DEFAULT_MIDI_MONITOR_ENABLED 0  ; if 1, the Tx/Rx LEDs are enabled
               00081     ;;define the DOUT pins for the Rx and Tx LED:
               00082     ;; if 0: MIDI Rx/Tx LEDs are assigned to the DOUT chain, pin 0x00-0x7f
               00083     ;; if 1: MIDI Rx/Tx LEDs are assigned to specials pins
0000 00084 #define MIDI_RXTX_USE_IO       0                                          
               00085 #if MIDI_RXTX_USE_IO
               00086 #define DEFAULT_MIDI_RX_LAT LATD
               00087 #define DEFAULT_MIDI_RX_TRIS TRISD
               00088 #define DEFAULT_MIDI_RX_PIN 6   ; Pin D.6
               00089 #define DEFAULT_MIDI_TX_LAT LATD
               00090 #define DEFAULT_MIDI_TX_TRIS TRISD
               00091 #define DEFAULT_MIDI_TX_PIN 7   ; Pin D.7
               00092 #else
0000 00093 #define DEFAULT_MIDI_RX_LED 0x41        ; DOUT SR#9, pin D1
0000 00094 #define DEFAULT_MIDI_TX_LED 0x42        ; DOUT SR#9, pin D2
               00095 #endif
               00096 
               00097         ;; define the AOUT interface which is used here:
               00098         ;;   1: one MBHP_AOUT module
               00099         ;;   2: up to 4 (chained) MBHP_AOUT_LC modules
               00100         ;;   3: one MBHP_AOUT_NG module
               00101         ;; all other values invalid!
0000 00102 #define AOUT_INTERFACE_TYPE 0
               00103 
               00104         ;; only relevant if one or more AOUT_LC modules are used:
               00105         ;; define the resolution configuration here
               00106         ;;   0: first channel 12bit, second channel 4bit
               00107         ;;   1: first channel 8bit, second channel 8bit
               00108         ;;   2: combines M1,M2 and/or M3/M4: first channel 12bit, second channel 12bit, third channel 8bit, fourth channel ignored!
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00109         ;; all other values invalid!
0000 00110 #define AOUT_LC_RESOLUTION_OPTION_M1 0
0000 00111 #define AOUT_LC_RESOLUTION_OPTION_M2 0
0000 00112 #define AOUT_LC_RESOLUTION_OPTION_M3 0
0000 00113 #define AOUT_LC_RESOLUTION_OPTION_M4 0
               00114 
               00115         ;; enable the 6th LFO waveform (analog inputs)
0000 00116 #define ENABLE_AIN_LFO_WAVEFORM 0
               00117 
               00118 #include "src/main.inc"
               00001 ; $Id: main.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIOS Application
               00004 ; MIDIbox TIA
               00005 ;
               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 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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  
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE  8


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
  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 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 10


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 11


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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 ;; ==========================================================================
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 12


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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>
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 13


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 14


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 15


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 16


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 17


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013         ;; never change the origin or the order of entries!
3000           00014         org     0x3000
3000 00015 _User_Init
3000 EF69 F01A 00016         goto    USER_Init
3004 00017 _USER_Tick
3004 EF90 F01A 00018         goto    USER_Tick
3008 00019 _USER_Timer
3008 EF97 F01A 00020         goto    USER_Timer
300C 00021 _USER_MPROC_DebugTrigger
300C EF9A F01A 00022         goto    USER_MPROC_DebugTrigger
3010 00023 _USER_DISPLAY_Init
3010 EFAF F01A 00024         goto    USER_DISPLAY_Init
3014 00025 _USER_DISPLAY_Tick
3014 EFC2 F01A 00026         goto    USER_DISPLAY_Tick
3018 00027 _USER_SR_Service_Prepare
3018 EFE4 F01A 00028         goto    USER_SR_Service_Prepare
301C 00029 _USER_SR_Service_Finish
301C EFE5 F01A 00030         goto    USER_SR_Service_Finish
3020 00031 _USER_DIN_NotifyToggle
3020 EFE2 F01A 00032         goto    USER_DIN_NotifyToggle
3024 00033 _USER_ENC_NotifyChange
3024 EFE3 F01A 00034         goto    USER_ENC_NotifyChange
3028 00035 _USER_AIN_NotifyChange
3028 EFE6 F01A 00036         goto    USER_AIN_NotifyChange
302C 00037 _USER_MPROC_NotifyReceivedByte
302C EFCC F01A 00038         goto    USER_MPROC_NotifyReceivedByte
3030 00039 _USER_MPROC_NotifyTimeout
3030 EFC9 F01A 00040         goto    USER_MPROC_NotifyTimeout
3034 00041 _USER_MPROC_NotifyReceivedEvent
3034 EFC5 F01A 00042         goto    USER_MPROC_NotifyReceivedEvent
3038 00043 _USER_MPROC_NotifyFoundEvent
3038 EFC8 F01A 00044         goto    USER_MPROC_NotifyFoundEvent
303C 00045 _USER_LCD_Init
303C EF80 F019 00046         goto    USER_LCD_Init
3040 00047 _USER_LCD_Clear
3040 EFF5 F019 00048         goto    USER_LCD_Clear
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 18


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3044 00049 _USER_LCD_CursorSet
3044 EF0C F01A 00050         goto    USER_LCD_CursorSet
3048 00051 _USER_LCD_PrintChar
3048 EF35 F01A 00052         goto    USER_LCD_PrintChar
304C 00053 _USER_MIDI_NotifyRx
304C EFD2 F01A 00054         goto    USER_MIDI_NotifyRx
3050 00055 _USER_MIDI_NotifyTx
3050 EFCF F01A 00056         goto    USER_MIDI_NotifyTx
3054 00057 _USER_LCD_Data
3054 EF9E F019 00058         goto    USER_LCD_Data
3058 00059 _USER_LCD_Cmd
3058 EFC0 F019 00060         goto    USER_LCD_Cmd
305C 00061 _USER_LCD_SpecialCharInit
305C EF68 F01A 00062         goto    USER_LCD_SpecialCharInit
3060 00063 USER_RESERVED_25
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 
               00034 
               00035 ;; ---[ variables used by application ]---
               00036 #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 ; ==========================================================================
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 19


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
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        0x77; 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         ;; free memory for user applications:   
               00050         ;; 0x010-0x37f
               00051 
               00052 ;; ==========================================================================
               00053 ;;  General TIA Control Variables in ACCESS page
               00054 ;; ==========================================================================
  00000010     00055 TIA_STAT                EQU     0x010
               00056 
  00000011     00057 TIA_BANK                EQU     0x011
  00000012     00058 TIA_PRESET              EQU     0x012
  00000013     00059 TIA_PATCH               EQU     0x013
  00000014     00060 TIA_PBANK               EQU     0x014
  00000015     00061 TIA_KIT                 EQU     0x015 ;;a degager
  00000016     00062 TIA_KBANK               EQU     0x016 ;;a degager
  00000017     00063 TIA_WT                  EQU     0x017 ;;a degager
  00000018     00064 TIA_WBANK               EQU     0x018 ;;a degager
  00000019     00065 TIA_BANKSTICK_CHK_CTR   EQU     0x019
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 20


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  0000001A     00066 TIA_BANKSTICK_ID        EQU     0x01a
  0000001B     00067 TIA_BANKSTICK_RDY       EQU     0x01b
  0000001C     00068 TIA_BANKSTICK_STAT      EQU     0x01c
  0000001D     00069 TIA_BANKSTICK_SIZE      EQU     0x01d
               00070 
  00000020     00071 TIA_MIDI_DEVICE         EQU     0x020
               00072 
               00073 ;; ==========================================================================
               00074 ;;  Variables used by the MIDI processor in tia_sysex.inc
               00075 ;; ==========================================================================
  00000021     00076 TIA_SYSEX_STATE         EQU     0x021
  00000022     00077 TIA_SYSEX_ACTION        EQU     0x022
  00000023     00078 TIA_SYSEX_IN            EQU     0x023
  00000024     00079 TIA_SYSEX_CHECKSUM      EQU     0x024
  00000025     00080 TIA_SYSEX_ADDRESS       EQU     0x025
  00000026     00081 TIA_SYSEX_ERROR     EQU 0x026
               00082 
               00083 ;; ==========================================================================
  00000027     00084 TIA_WT_VOICE            EQU     0x027
               00085 ;; free: 0x28-0x66
               00086 
               00087 ;; ==========================================================================
               00088 
  00000067     00089 MIDI_RXTX_RX_CTR        EQU     0x067
  00000068     00090 MIDI_RXTX_TX_CTR        EQU     0x068
  00000069     00091 MIDI_RXTX_BEAT_CTR      EQU     0x069
               00092 
               00093 ;; ==========================================================================
               00094 
  0000006A     00095 TIA_LEDMTR_STAT     EQU 0x06a
  0000006B     00096 TIA_LEDMTR_VALUE        EQU     0x06b
               00097 
               00098 ;; ==========================================================================
               00099 
  0000006C     00100 AOUT_FILTER_TMP_L       EQU     0x06c   ; used in tia_sw.inc as temporary storage for [filter value
  0000006D     00101 AOUT_FILTER_TMP_H       EQU     0x06d
               00102 
               00103 ;; ==========================================================================
               00104 
  0000006E     00105 AOUT_INVERTED           EQU     0x06e
  0000006F     00106 AOUT_UPDATE_REQ         EQU     0x06f
  00000070     00107 AOUT_VALUES             EQU     0x070  ; ..0x07f (8 * 16bit words)
               00108 
               00109 ;; ==========================================================================
               00110         ;; note: 0x080-0x0ff used by CS_TIAS1
               00111 ;; ==========================================================================
               00112 ;;  a lot of TIA control variables in BANKED page
               00113 ;; ==========================================================================
  00000100     00114 TIA_SW_CLEAR_BEGIN      EQU     0x100           ; used to initialize the whole TIA_SW memory
  000001FF     00115 TIA_SW_CLEAR_END                EQU     0x1ff           ; also used as 256 byte download buffer (!)                                                            
               00116                                                             
  00000100     00117 TIA_BASE          EQU   0x100           ; address space of TIA chip (used: 0x00-0x05)
               00118 
  00000100     00119 TIA_AUDC0      EQU TIA_BASE+0x00        ;; control. for voice 1 (Aud0)
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 21


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00000101     00120 TIA_AUDC1      EQU TIA_BASE+0x01        ;; control. for voice 2 (Aud1)
  00000102     00121 TIA_AUDF0      EQU TIA_BASE+0x02        ;; freq. for voice 1 (Aud0)
  00000103     00122 TIA_AUDF1      EQU TIA_BASE+0x03        ;; freq. for voice 2 (Aud1)
  00000104     00123 TIA_AUDV0      EQU TIA_BASE+0x04        ;; vol. for voice 1 (Aud0)
  00000105     00124 TIA_AUDV1      EQU TIA_BASE+0x05        ;; vol. for voice 2 (Aud1)
               00125                                                               
  0000010B     00126 TIA_MASTER_VOL          EQU     TIA_BASE+0x0b   ; internal TIA_SW register
  0000010C     00127 TIA_PLAY_MODE           EQU     TIA_BASE+0x0c   ; internal TIA_SW register
  0000010D     00128 TIA_SE_OPTION           EQU     TIA_BASE+0x0d   ; internal TIA_SW register
  0000010E     00129 TIA_SW_VOICE            EQU     TIA_BASE+0x0e   ; internal TIA_SW register
  0000010F     00130 TIA_SW_LFO_NUMBER       EQU     TIA_BASE+0x0f   ; internal TIA_SW register
  0000010F     00131 TIA_SW_ENV_NUMBER       EQU     TIA_SW_LFO_NUMBER
               00132 
  0000010F     00133 TIA_BASE_END            EQU     0x10f
               00134 
               00135 ;; ==========================================================================
               00136 
  00000110     00137 TIA_SHADOW_BASE         EQU     0x110           ; shadow addresses, necessary to determine changes (used: 0x00-0x05)
               00138 
               00139         ;; (TIA_SHADOW_BASE + 0x00) to (TIA_SHADOW_BASE + 0x05) allocated by shadow registers
               00140 
  0000011B     00141 TIA_Vx_ENV_CURVES       EQU     TIA_SHADOW_BASE+0x0b    ; internal TIA_SW register
  0000011C     00142 TIA_LFO_RANDOM_SEED_L   EQU     TIA_SHADOW_BASE+0x0c    ; internal TIA_SW register
  0000011D     00143 TIA_LFO_RANDOM_SEED_H   EQU     TIA_SHADOW_BASE+0x0d    ; internal TIA_SW register
  0000011E     00144 TIA_ENVx_CURVES         EQU     TIA_SHADOW_BASE+0x0e    ; internal TIA_SW register
  0000011F     00145 TIA_MOD_SYNC            EQU     TIA_SHADOW_BASE+0x0f    ; internal TIA_SW register
               00146 
               00147                                                                                
  0000011F     00148 TIA_SHADOW_END          EQU     0x11f
               00149 
               00150 ;; ==========================================================================
               00151 
  00000040     00152 TIA_Vx_RECORD_LEN       EQU     64      ;; 64 Max
               00153 
  00000000     00154 TIA_Vx_MIDI_CHANNEL       EQU   0x00
  00000001     00155 TIA_Vx_SPLIT_LOWER        EQU   0x01
  00000002     00156 TIA_Vx_SPLIT_UPPER        EQU   0x02
  00000003     00157 TIA_Vx_STAT               EQU   0x03
  00000004     00158 TIA_Vx_MODE               EQU   0x04    ; Always follow TIA_Vx_STAT
  00000005     00159 TIA_Vx_KEY_OFFSET         EQU   0x05
  00000006     00160 TIA_Vx_KEY_LENGTH         EQU   0x06
  00000007     00161 TIA_Vx_TARGET_FRQ_L       EQU   0x07
  00000008     00162 TIA_Vx_TARGET_FRQ_H       EQU   0x08
  00000009     00163 TIA_Vx_FRQ_L              EQU   0x09
  0000000A     00164 TIA_Vx_FRQ_H              EQU   0x0a
  0000000B     00165 TIA_Vx_PITCHBENDER        EQU   0x0b
  0000000C     00166 TIA_Vx_TRANSPOSE          EQU   0x0c
  0000000D     00167 TIA_Vx_PITCHRANGE         EQU   0x0d
  0000000E     00168 TIA_Vx_PORTA_RATE         EQU   0x0e
  0000000F     00169 TIA_Vx_VOLUME             EQU   0x0f
  00000010     00170 TIA_Vx_NOTE               EQU   0x10
  00000011     00171 TIA_Vx_NOTE_DELAY         EQU   0x11
  00000012     00172 TIA_Vx_NOTE_DELAY_CTR     EQU   0x12
  00000013     00173 TIA_Vx_ARP_RATE           EQU   0x13
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 22


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00000014     00174 TIA_Vx_ARP_NOTE_NUMBER    EQU   0x14
  00000015     00175 TIA_Vx_ARP_CTR            EQU   0x15
  00000016     00176 TIA_Vx_PITCH_MOD          EQU   0x16
  00000017     00177 TIA_Vx_AMP_MOD            EQU   0x17
  00000018     00178 TIA_Vx_SPARE              EQU   0x18
               00179                
  00000019     00180 TIA_Vx_SPARE1             EQU   0x19    ; allocated
  0000001A     00181 TIA_Vx_SPARE2             EQU   0x1a    ; only free of constant time portamento not activated
  0000001B     00182 TIA_Vx_SPARE3             EQU   0x1b    ; only free of constant time portamento not activated
  0000001C     00183 TIA_Vx_SPARE4             EQU   0x1c    ; only free of constant time portamento not activated
  0000001D     00184 TIA_Vx_SPARE5             EQU   0x1d    ; only free of constant time portamento not activated
               00185 
  0000001A     00186 TIA_Vx_PORTA_CTR_L        EQU   TIA_Vx_SPARE2
  0000001B     00187 TIA_Vx_PORTA_CTR_H        EQU   TIA_Vx_SPARE3
  0000001C     00188 TIA_Vx_PORTA_FRQ_L        EQU   TIA_Vx_SPARE4
  0000001D     00189 TIA_Vx_PORTA_FRQ_H        EQU   TIA_Vx_SPARE5
               00190                                                               
  0000001E     00191 TIA_Vx_ARP_NOTE_0         EQU   0x1e
  0000001F     00192 TIA_Vx_ARP_NOTE_1         EQU   0x1f
  00000020     00193 TIA_Vx_ARP_NOTE_2         EQU   0x20
  00000021     00194 TIA_Vx_ARP_NOTE_3         EQU   0x21
  00000022     00195 TIA_Vx_NOTE_STACK_0       EQU   0x22
  00000023     00196 TIA_Vx_NOTE_STACK_1       EQU   0x23
  00000024     00197 TIA_Vx_NOTE_STACK_2       EQU   0x24
  00000025     00198 TIA_Vx_NOTE_STACK_3       EQU   0x25
  00000004     00199 TIA_NOTE_STACK_LEN        EQU   TIA_Vx_NOTE_STACK_3-TIA_Vx_NOTE_STACK_0+1
               00200 
  00000026     00201 TIA_Vx_ASSIGN_VEL    EQU        0x26
  00000027     00202 TIA_Vx_INIT_VEL      EQU        0x27
  00000028     00203 TIA_Vx_LAST_VEL      EQU        0x28
  00000029     00204 TIA_Vx_DEPTH_VEL     EQU        0x29
               00205 
  0000002A     00206 TIA_Vx_ENV_MODE         EQU     0x2a                                                                              
  0000002B     00207 TIA_Vx_OPTION             EQU   0x2b
               00208                                                                                
  0000002C     00209 TIA_Vx_WBANK              EQU   0x2c    ;; don't change order
  0000002D     00210 TIA_Vx_WT                 EQU   0x2d    ;; don't change order
  0000002E     00211 TIA_Vx_WT_STATE           EQU   0x2e    ;; don't change order
  0000002F     00212 TIA_Vx_WT_RATE            EQU   0x2f
  00000030     00213 TIA_Vx_WT_CLK_REQ_CTR     EQU   0x30
  00000031     00214 TIA_Vx_WT_CTR             EQU   0x31
  00000032     00215 TIA_Vx_WT_POS             EQU   0x32
  00000033     00216 TIA_Vx_WT_ASSIGN_P1       EQU   0x33
  00000034     00217 TIA_Vx_WT_ASSIGN_P2       EQU   0x34
  00000035     00218 TIA_Vx_WT_ASSIGN_P3       EQU   0x35
  00000036     00219 TIA_Vx_WT_303_TICK_CTR    EQU   0x36
               00220                                                                                
  00000037     00221 TIA_Vx_WT_ATTACK       EQU      0x37    ;; don't change order
  00000038     00222 TIA_Vx_WT_DECAY        EQU      0x38    ;; don't change order
  00000039     00223 TIA_Vx_WT_SUSTAIN      EQU      0x39    ;; don't change order
  0000003A     00224 TIA_Vx_WT_RELEASE      EQU      0x3a    ;; don't change order
               00225                                                                                
  0000003B     00226 TIA_Vx_FREE1              EQU   0x3b
  0000003C     00227 TIA_Vx_FREE2              EQU   0x3c
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 23


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  0000003D     00228 TIA_Vx_FREE3              EQU   0x3d
  0000003E     00229 TIA_Vx_FREE4              EQU   0x3e
  0000003F     00230 TIA_Vx_FREE5              EQU   0x3f
               00231                                                                                
  00000120     00232 TIA_V1_BASE             EQU     0x120 + 0 * TIA_Vx_RECORD_LEN   ; 0x0120-0x15f
  00000160     00233 TIA_V2_BASE             EQU     0x120 + 1 * TIA_Vx_RECORD_LEN   ; 0x0160-0x19f
               00234 
               00235 ;; ==========================================================================
               00236 
  00000007     00237 TIA_LFOx_RECORD_LEN     EQU     7
  00000000     00238 TIA_LFOx_MODE       EQU 0x00
  00000001     00239 TIA_LFOx_RATE       EQU 0x01
  00000002     00240 TIA_LFOx_CTR        EQU 0x02
  00000003     00241 TIA_LFOx_VALUE          EQU     0x03
  00000004     00242 TIA_LFOx_DEPTH          EQU     0x04
  00000005     00243 TIA_LFOx_RVALUE_L   EQU 0x05
  00000006     00244 TIA_LFOx_RVALUE_H   EQU 0x06
               00245 
  000001A0     00246 TIA_LFO1_BASE           EQU     0x1a0 + 0 * TIA_LFOx_RECORD_LEN ; 0x1a0-0x1a6
  000001A7     00247 TIA_LFO2_BASE           EQU     0x1a0 + 1 * TIA_LFOx_RECORD_LEN ; 0x1a7-0x1ad
  000001AE     00248 TIA_LFO3_BASE           EQU     0x1a0 + 2 * TIA_LFOx_RECORD_LEN ; 0x1ae-0x1b4
  000001B5     00249 TIA_LFO4_BASE           EQU     0x1a0 + 3 * TIA_LFOx_RECORD_LEN ; 0x1b5-0x1bb
               00250 
               00251 ;; ==========================================================================
               00252 
  0000000B     00253 TIA_ENVx_RECORD_LEN     EQU     11
  00000000     00254 TIA_ENVx_MODE       EQU 0x00
  00000001     00255 TIA_ENVx_CTR_L          EQU     0x01
  00000002     00256 TIA_ENVx_CTR_H          EQU     0x02
  00000003     00257 TIA_ENVx_ATTACK         EQU     0x03    ;; don't change order
  00000004     00258 TIA_ENVx_DECAY          EQU     0x04    ;; don't change order
  00000005     00259 TIA_ENVx_SUSTAIN    EQU 0x05    ;; don't change order
  00000006     00260 TIA_ENVx_RELEASE    EQU 0x06    ;; don't change order
  00000007     00261 TIA_ENVx_CURVE          EQU     0x07
  00000008     00262 TIA_ENVx_DEPTH          EQU     0x08
  00000009     00263 TIA_ENVx_RVALUE_L   EQU 0x09
  0000000A     00264 TIA_ENVx_RVALUE_H   EQU 0x0a
               00265 
  000001BC     00266 TIA_V1_ENV_BASE EQU     0x1bc + 0 * TIA_ENVx_RECORD_LEN ; 0x1bc-0x1c6
  000001C7     00267 TIA_V2_ENV_BASE     EQU 0x1bc + 1 * TIA_ENVx_RECORD_LEN ; 0x1c7-0x1d1
  000001D2     00268 TIA_ENV1_BASE           EQU     0x1bc + 2 * TIA_ENVx_RECORD_LEN ; 0x1d2-0x1dc
  000001DD     00269 TIA_ENV2_BASE           EQU     0x1bc + 3 * TIA_ENVx_RECORD_LEN ; 0x1dd-0x1e7
               00270 
               00271 ;; ==========================================================================
               00272 
  00000004     00273 TIA_CTRLx_RECORD_LEN    EQU     4
  00000000     00274 TIA_CTRLx_ASSIGN        EQU     0x00
  00000001     00275 TIA_CTRLx_INIT          EQU     0x01
  00000002     00276 TIA_CTRLx_LAST          EQU     0x02
  00000003     00277 TIA_CTRLx_DEPTH         EQU     0x03
               00278 
  000001E8     00279 TIA_CTRL_AFTERTOUCH_BASE        EQU     0x1e8 + 0 * TIA_CTRLx_RECORD_LEN        ; 0x1e8-0x1eb
  000001EC     00280 TIA_CTRL_MODWHEEL_BASE          EQU     0x1e8 + 1 * TIA_CTRLx_RECORD_LEN        ; 0x1ec-0x1ef
               00281 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 24


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00282 ;; ==========================================================================
               00283 
  000001F0     00284 TIA_MIDI_SYNC           EQU     0x1f0
  000001F1     00285 TIA_MIDI_SYNC_CTR       EQU     0x1f1
  000001F2     00286 TIA_MIDI_SYNC_CTR_REG   EQU     0x1f2
               00287                                                                                
               00288 ;; ==========================================================================
               00289                                                                                
               00290 ; free 0x1f4-0x1f5
               00291 ;; ==========================================================================
               00292 
  000001F6     00293 SAVED_PRODL             EQU     0x1f6   ; used by tia_sw.inc
  000001F7     00294 SAVED_PRODH             EQU     0x1f7   ; used by tia_sw.inc
               00295 
               00296 ;; ==========================================================================
  000001F8     00297 MUL_A_L                 EQU     0x1f8   ; used by math_mul16_16.inc
  000001F9     00298 MUL_A_H                 EQU     0x1f9
  000001FA     00299 MUL_B_L                 EQU     0x1fa
  000001FB     00300 MUL_B_H                 EQU     0x1fb
  000001FC     00301 MUL_R_0                 EQU     0x1fc
  000001FD     00302 MUL_R_1                 EQU     0x1fd
  000001FE     00303 MUL_R_2                 EQU     0x1fe
  000001FF     00304 MUL_R_3                 EQU     0x1ff
               00305 
               00306                                                               
  000001F8     00307 DIV_A_0                 EQU     MUL_A_L ; used by math_div16_16.inc
  000001F9     00308 DIV_A_1                 EQU     MUL_A_H
  000001FA     00309 DIV_A_2                 EQU     MUL_B_L
  000001FB     00310 DIV_B_0                 EQU     MUL_B_H
  000001FC     00311 DIV_B_1                 EQU     MUL_R_0
  000001FD     00312 DIV_COUNT               EQU     MUL_R_1
  000001FE     00313 DIV_REM_0               EQU     MUL_R_2
  000001FF     00314 DIV_REM_1               EQU     MUL_R_3
               00315 
               00316 
               00317 ;; ==========================================================================
  00000200     00318 BANKSTICK_FORMAT_BEGIN  EQU     0x200           ; buffer temporary used to format the BankStick
  000002FF     00319 BANKSTICK_FORMAT_END    EQU     0x2ff           ; CS reserved 
               00320 
               00321 ;; ==========================================================================
  00000007     00322 TIA_Vx_KIT_RECORD_LEN   EQU     7
               00323                                                                                
  00000000     00324 TIA_Vx_KBANK              EQU   0x00    ;; don't change order
  00000001     00325 TIA_Vx_KIT                EQU   0x01    ;; don't change order
  00000002     00326 TIA_Vx_KIT_STATE          EQU   0x02    ;; don't change order
  00000003     00327 TIA_Vx_KIT_RATE           EQU   0x03
  00000004     00328 TIA_Vx_KIT_CLK_REQ_CTR    EQU   0x04
  00000005     00329 TIA_Vx_KIT_CTR            EQU   0x05
  00000006     00330 TIA_Vx_KIT_POS            EQU   0x06
               00331                                                                                
  00000300     00332 TIA_V1_KIT              EQU     0x300 + 0 * TIA_Vx_RECORD_LEN   ; 0x0300-0x306
  00000340     00333 TIA_V2_KIT              EQU     0x300 + 1 * TIA_Vx_RECORD_LEN   ; 0x0307-0x30d
               00334                                                                                
               00335 ;;free 0x30e-0x37f
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 25


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00037 
               00038 
               00039 ; ==========================================================================
               00040 
               00041 ;; ---[ configuration table for MIDI processor and rotary encoders ]---
               00042 #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, ...)
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 26


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
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 ;; --------------------------------------------------------------------------
               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 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 27


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     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 
     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 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 28


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     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 ;; --------------------------------------------------------------------------
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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 29


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
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
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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 30


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
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 
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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 31


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 32


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 33


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
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!
               00043 
               00044 ;; ---[ Custom LCD driver ]---
               00045 #include "app_lcd.inc"
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 34


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00001 ; $Id: app_lcd.inc 69 2008-02-01 00:20:18Z tk $
               00002 ;
               00003 ; MIOS Custom LCD Driver Example
               00004 ; for up to 8 * DOG GLCD (every display provides a resolution of 128x64)
               00005 ;;
               00006 ; This driver allows to drive up to 8 of them, every display is connected
               00007 ; to a dedicated chip select line at port B. They can be addressed with
               00008 ; following (graphical) cursor positions:
               00009 ; 
               00010 ; I have swapped these round to make it easier for people with PIC18f4685
               00011 ; so they are limited to 4x displays. Therefore the first display is on PortB.7
               00012 ; 
               00013 ; CS at PortB.7     CS at PortB.6     
               00014 ; +--------------+  +--------------+  
               00015 ; |              |  |              |  
               00016 ; | X =   0..127 |  | X = 128..255 |    
               00017 ; | Y =   0..  7 |  | Y =   0..  7 | 
               00018 ; |              |  |              |  
               00019 ; +--------------+  +--------------+  
               00020 ;
               00021 ; CS at PortB.5     CS at PortB.4     
               00022 ; +--------------+  +--------------+ 
               00023 ; |              |  |              | 
               00024 ; | X =   0..127 |  | X = 128..255 | 
               00025 ; | Y =   8.. 15 |  | Y =   8.. 15 | 
               00026 ; |              |  |              | 
               00027 ; +--------------+  +--------------+ 
               00028 ;
               00029 ; CS at PortB.3     CS at PortB.2   
               00030 ; +--------------+  +--------------+
               00031 ; |              |  |              |
               00032 ; | X =   0..127 |  | X = 128..255 |
               00033 ; | Y =  16.. 23 |  | Y =  16.. 23 |
               00034 ; |              |  |              |
               00035 ; +--------------+  +--------------+
               00036 ;
               00037 ; CS at PortB.1     CS at PortB.0   
               00038 ; +--------------+  +--------------+
               00039 ; |              |  |              |
               00040 ; | X =   0..127 |  | X = 128..255 |
               00041 ; | Y =  24.. 31 |  | Y =  24.. 31 |
               00042 ; |              |  |              |
               00043 ; +--------------+  +--------------+
               00044 ;
               00045 ; The arrangement can be modified below the USER_LCD_Data_CS and USER_LCD_GCursorSet label
               00046 ;
               00047 ; ==========================================================================
               00048 ;
               00049 ;  Copyright (C) 2009  Phil Taylor (phil@taylor.org.uk)
               00050 ;  Copyright (C) 2003  Thorsten Klose (tk@midibox.org)
               00051 ;  Licensed for personal non-commercial use only.
               00052 ;  All other rights reserved.
               00053 ; 
               00054 ; ==========================================================================
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 35


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00055 
               00056 ;; --------------------------------------------------------------------------
               00057 ;;  Following system variables are given by MIOS and can be directly 
               00058 ;;  accessed by the driver. The addresses are defined in mios.h and
               00059 ;;  should not be changed
               00060 ;; 
               00061 ;;  MIOS_GLCD_BUFFER         a 8 byte buffer for data transfers
               00062 ;;  MIOS_LCD_OPTION1         contains the first LCD option given by MIOS_LCD_TypeSet
               00063 ;;  MIOS_LCD_OPTION2         contains the second LCD option given by MIOS_LCD_TypeSet
               00064 ;;  MIOS_LCD_CURSOR_POS      the current cursor pos of characters (GLCD: multiplied by width)
               00065 ;;  MIOS_GLCD_GCURSOR_X      for GLCDs: the current X position of graphical cursor
               00066 ;;  MIOS_GLCD_GCURSOR_Y      for GLCDs: the current Y position of graphical cursor
               00067 ;;  MIOS_GLCD_FONT_WIDTH     for GLCDs: the fontwidth given by MIOS_GLCD_FontInit
               00068 ;;  MIOS_GLCD_FONT_HEIGHT    for GLCDs: the fontheight given by MIOS_GLCD_FontInit
               00069 ;;  MIOS_GLCD_FONT_X0        for GLCDs: the first byte within a char entry
               00070 ;;  MIOS_GLCD_FONT_OFFSET    for GLCDs: the byte offset between the characters
               00071 ;;  MIOS_GLCD_FONT_PTRL      for GLCDs: pointer to the character table, low-byte
               00072 ;;  MIOS_GLCD_FONT_PTRH      for GLCDs: pointer to the character table, high-byte
               00073 ;;  MIOS_LCD_TIMEOUT0        can be used for timeout loops
               00074 ;;  MIOS_LCD_TIMEOUT1        can be used for timeout loops
               00075 ;;  MIOS_GLCD_TMP1           can be used as temporary buffer
               00076 ;;  MIOS_GLCD_TMP2           can be used as temporary buffer
               00077 ;;  MIOS_GLCD_TMP3           can be used as temporary buffer
               00078 ;;  MIOS_GLCD_TMP4           can be used as temporary buffer
               00079 ;;  MIOS_LCD_Y0_OFFSET       Y0 offset of LCD
               00080 ;;  MIOS_LCD_Y1_OFFSET       Y1 offset of LCD
               00081 ;;  MIOS_LCD_Y2_OFFSET       Y2 offset of LCD
               00082 ;;  MIOS_LCD_Y3_OFFSET       Y3 offset of LCD
               00083 ;;  MIOS_LCD_CURSOR_POS_REAL unmapped cursor position which has been set with MIOS_LCD_CursorSet
               00084 ;; 
               00085 ;;  Note: the addresses are located in an upper bank and therefore have to
               00086 ;;        be accessed with the BANKED flag. Also the BSR has to be justified
               00087 ;;        before using the registers
               00088 ;;  Example:
               00089 ;;      SET_BSR MIOS_LCD_OPTION1        ; sets BSR to the bank where MIOS_LCD_*
               00090 ;;                                      ; has been located. You don't need to
               00091 ;;                                      ; change the BSR for the other LCD registers
               00092 ;;      movf    MIOS_LCD_OPTION1, W, BANKED     ; get LCD option #1
               00093 ;; 
               00094 ;;  Important: to allow a proper interaction with MIOS applications, you are
               00095 ;;  only allowed to modify MIOS_PARAMETER[123], the mutliplication registers
               00096 ;;  and FSR1. You are not allowed to change TMP[1-5] or FSR0
               00097 ;;  if you need some temporary registers, use the given addresses above or
               00098 ;;  locate them to addresses which are not used by the application
               00099 ;; --------------------------------------------------------------------------
               00100 
               00101 ;; Clock/data/DC
               00102 #ifndef USER_LCD_TRIS_SCLK
               00103 #define USER_LCD_TRIS_SCLK  TRISD
               00104 #endif
               00105 #ifndef USER_LCD_TRIS_SCLK
               00106 #define USER_LCD_LAT_SCLK       LATD    ; Pin D.7
               00107 #endif
               00108 #ifndef USER_LCD_PIN_SCLK
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 36


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00109 #define USER_LCD_PIN_SCLK       7
               00110 #endif
               00111 #ifndef USER_LCD_TRIS_SDA
               00112 #define USER_LCD_TRIS_SDA   TRISD
               00113 #endif
               00114 #ifndef USER_LCD_LAT_SDA
               00115 #define USER_LCD_LAT_SDA        LATD    ; Pin D.6
               00116 #endif
               00117 #ifndef USER_LCD_PIN_SDA
               00118 #define USER_LCD_PIN_SDA        6
               00119 #endif
               00120 #ifndef USER_LCD_TRIS_DC
               00121 #define USER_LCD_TRIS_DC    TRISD
               00122 #endif
               00123 #ifndef USER_LCD_LAT_DC
               00124 #define USER_LCD_LAT_DC         LATD    ; Pin D.5
               00125 #endif
               00126 #ifndef USER_LCD_PIN_DC
               00127 #define USER_LCD_PIN_DC         5
               00128 #endif
               00129 ;; Chip Select Lines 0-7
               00130 #ifndef USER_LCD_TRIS_CS
               00131 #define USER_LCD_TRIS_CS    TRISB
               00132 #endif
               00133 #ifndef USER_LCD_LAT_CS
               00134 #define USER_LCD_LAT_CS         LATB    ; Pin B.7 .. B.0
               00135 #endif
               00136 #ifndef USER_LCD_PIN_CS0
               00137 #define USER_LCD_PIN_CS0        7
               00138 #endif
               00139 #if DEFAULT_IS_CARTRIDGE==0
               00140 #ifndef USER_LCD_PIN_CS1
               00141 #define USER_LCD_PIN_CS1        6 
               00142 #endif
               00143 #ifndef USER_LCD_PIN_CS2 
               00144 #define USER_LCD_PIN_CS2        5
               00145 #endif
               00146 #ifndef USER_LCD_PIN_CS3 
               00147 #define USER_LCD_PIN_CS3        4
               00148 #endif
               00149 #endif
               00150 
               00151 ;; --------------------------------------------------------------------------
               00152 ;;  This function is called by MIOS when the custom LCD should be initialized
               00153 ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
               00154 ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
               00155 ;;  Out: -
               00156 ;; --------------------------------------------------------------------------
3300 00157 USER_LCD_Init
               00158         ;; notify that a graphical LCD has been connected
3300 8600      00159         bsf     MIOS_BOX_CFG0, MIOS_BOX_CFG0_USE_GLCD  
               00160 
               00161         ;movlw  100                     ; 100 ms delay
               00162         ;call   MIOS_Delay
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 37


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00163         ;; initialization sequence based on the example from the DOG datasheet
3302 0E40      00164         movlw   0x40            ; 2 - Display start line = 0
3304 D83D      00165         rcall   USER_LCD_Cmd
3306 0EA1      00166         movlw   0xA1            ; 8 - ADC Normal mode = 0 
3308 D83B      00167         rcall   USER_LCD_Cmd
330A 0EC0      00168         movlw   0xC0            ; 15 - COMS normal = 1/65  duty
330C D839      00169         rcall   USER_LCD_Cmd
330E 0EA6      00170         movlw   0xA6            ;  9 - Display  = normal  
3310 D837      00171         rcall   USER_LCD_Cmd
3312 0EA2      00172         movlw   0xA2            ; 11 - 1/65 duty 1/9 bias for 65x132 display
3314 D835      00173         rcall   USER_LCD_Cmd
3316 0E2F      00174         movlw   0x2F            ; 16  - Power control set = B.,R,F all ON
3318 D833      00175         rcall   USER_LCD_Cmd
331A 0EF8      00176         movlw   0xF8            ; 20-1 - select Booster ratio set
331C D831      00177         rcall   USER_LCD_Cmd
331E 0E00      00178         movlw   0x00            ; 20-2 - Booster ratio register  
3320 D82F      00179         rcall   USER_LCD_Cmd ;  (must be preceeded by 20-1)
3322 0E27      00180         movlw   0x27            ; 17 - VO volt reg set 
3324 D82D      00181         rcall   USER_LCD_Cmd
3326 0E81      00182         movlw   0x81            ; 18-1 - Elect vol control - contrast
3328 D82B      00183         rcall   USER_LCD_Cmd 
332A 0E10      00184         movlw   0x10            ; 18-2 - Contrast level dec 22  
332C D829      00185         rcall   USER_LCD_Cmd;   (must be preceeded by 18-1)
332E 0EAC      00186         movlw   0xAC            ; 19-1 - Static Indicator - set off
3330 D827      00187         rcall   USER_LCD_Cmd
3332 0E00      00188         movlw   0x00            ; 19-2 - No Indicator
3334 D825      00189         rcall   USER_LCD_Cmd;   (must be preceeded with 19-1)
3336 0EAF      00190         movlw   0xAF            ; 20 - Display ON
3338 D823      00191         rcall   USER_LCD_Cmd
               00192 
               00193 
               00194         ;; clear display
               00195         rgoto   USER_LCD_Clear
333A D057          M         bra     label
               00196 
               00197 
               00198 ;; --------------------------------------------------------------------------
               00199 ;;  FUNCTION: USER_LCD_Data
               00200 ;;  DESCRIPTION: sends a data value to the LCD display.<BR>
               00201 ;;  On CLCDs: branch directly to USER_LCD_PrintChar<BR>
               00202 ;;  On GLCDs: ignore this function!
               00203 ;;  IN:  data which should be sent
               00204 ;;  OUT: -
               00205 ;; --------------------------------------------------------------------------
333C 00206 USER_LCD_Data
               00207         ;; store byte in buffer
               00208         SET_BSR MIOS_GLCD_BUFFER
333C 0105          M         movlb   HIGH(reg)
333E 6F70      00209         movwf   MIOS_GLCD_BUFFER+0, BANKED
               00210         ;; data byte
3340 9293      00211     bcf USER_LCD_TRIS_DC, USER_LCD_PIN_DC
3342 828A      00212         bsf     USER_LCD_LAT_DC, USER_LCD_PIN_DC
               00213 
               00214         ;; deselect all CS
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 38


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3344 9693      00215         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS0
3346 868A      00216     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS0
               00217 #ifdef USER_LCD_PIN_CS1
               00218         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS1
               00219     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS1
               00220 #endif
               00221 #ifdef USER_LCD_PIN_CS2
               00222         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS2
               00223     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS2
               00224 #endif
               00225 #ifdef USER_LCD_PIN_CS3
               00226         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS3
               00227     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS3
               00228 #endif
               00229 
               00230         ;; select display depending on current cursor position
               00231         ;; THIS PART COULD BE CHANGED FOR DIFFERENT DISPLAY CONFIGURATIONS
               00232         ;; 
3348 00233 USER_LCD_Data_CS
3348 0E07      00234         movlw   1*8-1
334A 657C      00235         cpfsgt  MIOS_GLCD_GCURSOR_Y, BANKED
               00236         rgoto   USER_LCD_Data_CS_BANKA
334C D007          M         bra     label
334E 0E0F      00237         movlw   2*8-1
3350 657C      00238         cpfsgt  MIOS_GLCD_GCURSOR_Y, BANKED
               00239 
3352 00240 USER_LCD_Data_CS_BANKB
3352 0E7F      00241         movlw   1*128-1
3354 657B      00242         cpfsgt  MIOS_GLCD_GCURSOR_X, BANKED
               00243         rgoto   USER_LCD_Data_CS_BANKB_LOW
3356 D001          M         bra     label
3358 00244 USER_LCD_Data_CS_BANKB_HIGH
               00245 #ifdef USER_LCD_PIN_CS3
               00246         bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS3
               00247 #endif
               00248         rgoto   USER_LCD_Data_CS_Done
3358 D006          M         bra     label
335A 00249 USER_LCD_Data_CS_BANKB_LOW
               00250 #ifdef USER_LCD_PIN_CS2
               00251         bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS2
               00252 #endif
               00253         rgoto   USER_LCD_Data_CS_Done
335A D005          M         bra     label
               00254     
335C 00255 USER_LCD_Data_CS_BANKA
335C 0E7F      00256         movlw   1*128-1
335E 657B      00257         cpfsgt  MIOS_GLCD_GCURSOR_X, BANKED
               00258         rgoto   USER_LCD_Data_CS_BANKA_LOW
3360 D001          M         bra     label
3362 00259 USER_LCD_Data_CS_BANKA_HIGH
               00260 #ifdef USER_LCD_PIN_CS1
               00261         bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS1
               00262 #endif
               00263         rgoto   USER_LCD_Data_CS_Done
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 39


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3362 D001          M         bra     label
3364 00264 USER_LCD_Data_CS_BANKA_LOW
3364 968A      00265         bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS0
               00266         ;rgoto  USER_LCD_Data_CS_Done 
               00267 
3366 00268 USER_LCD_Data_CS_Done
               00269         ;; transfer data to display
3366 5170      00270         movf    MIOS_GLCD_BUFFER+0, W, BANKED
3368 D812      00271         rcall   USER_LCD_ShiftByte
               00272         ;; increment graphical cursor
               00273         SET_BSR MIOS_GLCD_GCURSOR_X;
336A 0105          M         movlb   HIGH(reg)
336C 2B7B      00274         incf    MIOS_GLCD_GCURSOR_X, F, BANKED
               00275         ;; deselect displays
               00276 #ifdef USER_LCD_PIN_CS0
336E 868A      00277     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS0
               00278 #endif
               00279 #ifdef USER_LCD_PIN_CS1
               00280     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS1
               00281 #endif
               00282 #ifdef USER_LCD_PIN_CS2
               00283     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS2
               00284 #endif
               00285 #ifdef USER_LCD_PIN_CS3
               00286     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS3
               00287 #endif
               00288 
               00289         ;; if new X position reached, set LCD cursor of all displays to 0
3370 00290 USER_LCD_Data_RstTst2
3370 517B      00291         movf    MIOS_GLCD_GCURSOR_X, W, BANKED
3372 0A7F      00292         xorlw   1*128-1
3374 E004      00293         bz      USER_LCD_Data_Rst
3376 517B      00294         movf    MIOS_GLCD_GCURSOR_X, W, BANKED
3378 0AFF      00295         xorlw   2*128-1
337A E001      00296         bz      USER_LCD_Data_Rst
337C 0012      00297         return
               00298 
337E 00299 USER_LCD_Data_Rst
337E 0E80      00300         movlw   0x80
               00301         ;;rgoto USER_LCD_Cmd
               00302 
               00303 ;; --------------------------------------------------------------------------
               00304 ;;  FUNCTION: USER_LCD_Cmd
               00305 ;;  DESCRIPTION: sends a command to the LCD display.<BR>
               00306 ;;  On CLCDs: use this function to decode the HD44780 commands if required<BR>
               00307 ;;  On GLCDs: ignore this function!
               00308 ;;  IN:  command which should be sent
               00309 ;;  OUT: -
               00310 ;; --------------------------------------------------------------------------
3380 00311 USER_LCD_Cmd
               00312         ;; command byte
3380 9293      00313     bcf USER_LCD_TRIS_DC, USER_LCD_PIN_DC
3382 928A      00314         bcf     USER_LCD_LAT_DC, USER_LCD_PIN_DC
               00315         ;; select all LCDs
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 40


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3384 9693      00316         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS0
3386 968A      00317     bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS0
               00318 #ifdef USER_LCD_PIN_CS1
               00319         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS1
               00320     bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS1
               00321 #endif
               00322 #ifdef USER_LCD_PIN_CS2
               00323         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS2
               00324     bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS2
               00325 #endif
               00326 #ifdef USER_LCD_PIN_CS3
               00327         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS3
               00328     bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS3
               00329 #endif
               00330         ;; transfer command to display
3388 D802      00331         rcall   USER_LCD_ShiftByte
               00332         ;; deselect displays and exit
338A 868A      00333     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS0
               00334 #ifdef USER_LCD_PIN_CS1
               00335     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS1
               00336 #endif
               00337 #ifdef USER_LCD_PIN_CS2
               00338     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS2
               00339 #endif
               00340 #ifdef USER_LCD_PIN_CS3
               00341     bsf     USER_LCD_LAT_CS, USER_LCD_PIN_CS3
               00342 #endif
338C 0012      00343         return
               00344 
               00345 ;; --------------------------------------------------------------------------
               00346 ;;  This function is NOT called by MIOS, but only used by the custom driver
               00347 ;;  to transfer a data/command byte
               00348 ;;  In:  WREG - data/command byte
               00349 ;;       chip select lines must be set before calling this function!
               00350 ;;  Out: -
               00351 ;; --------------------------------------------------------------------------
338E 00352 USER_LCD_ShiftByte
338E 9693      00353         bcf     USER_LCD_TRIS_SCLK, USER_LCD_PIN_SCLK
3390 9493      00354     bcf     USER_LCD_TRIS_SDA, USER_LCD_PIN_SDA
               00355 
               00356 USER_LCD_ShiftByte_HLP MACRO bit
               00357         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
               00358         ;btfss  WREG, bit
               00359         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
               00360         btfsc   WREG, bit
               00361         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
               00362     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
               00363         ENDM
               00364 
               00365         USER_LCD_ShiftByte_HLP 7
3392 868A          M         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
                   M         ;btfss  WREG, bit
3394 948A          M         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
3396 BEE8          M         btfsc   WREG, bit
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 41


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3398 848A          M         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
339A 968A          M     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
               00366         USER_LCD_ShiftByte_HLP 6
339C 868A          M         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
                   M         ;btfss  WREG, bit
339E 948A          M         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
33A0 BCE8          M         btfsc   WREG, bit
33A2 848A          M         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
33A4 968A          M     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
               00367         USER_LCD_ShiftByte_HLP 5
33A6 868A          M         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
                   M         ;btfss  WREG, bit
33A8 948A          M         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
33AA BAE8          M         btfsc   WREG, bit
33AC 848A          M         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
33AE 968A          M     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
               00368         USER_LCD_ShiftByte_HLP 4
33B0 868A          M         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
                   M         ;btfss  WREG, bit
33B2 948A          M         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
33B4 B8E8          M         btfsc   WREG, bit
33B6 848A          M         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
33B8 968A          M     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
               00369         USER_LCD_ShiftByte_HLP 3
33BA 868A          M         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
                   M         ;btfss  WREG, bit
33BC 948A          M         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
33BE B6E8          M         btfsc   WREG, bit
33C0 848A          M         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
33C2 968A          M     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
               00370         USER_LCD_ShiftByte_HLP 2
33C4 868A          M         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
                   M         ;btfss  WREG, bit
33C6 948A          M         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
33C8 B4E8          M         btfsc   WREG, bit
33CA 848A          M         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
33CC 968A          M     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
               00371         USER_LCD_ShiftByte_HLP 1
33CE 868A          M         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
                   M         ;btfss  WREG, bit
33D0 948A          M         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
33D2 B2E8          M         btfsc   WREG, bit
33D4 848A          M         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
33D6 968A          M     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
               00372         USER_LCD_ShiftByte_HLP 0
33D8 868A          M         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
                   M         ;btfss  WREG, bit
33DA 948A          M         bcf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA              ; set SDA depending on current MSB
33DC B0E8          M         btfsc   WREG, bit
33DE 848A          M         bsf     USER_LCD_LAT_SDA, USER_LCD_PIN_SDA
33E0 968A          M     bcf USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; falling clock edge
33E2 0000      00373         nop
33E4 868A      00374         bsf     USER_LCD_LAT_SCLK, USER_LCD_PIN_SCLK    ; rising clock edge
               00375 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 42


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
33E6 0012      00376         return
               00377 
               00378         
               00379 ;; --------------------------------------------------------------------------
               00380 ;;  Determine Chip Select Line
               00381 ;; --------------------------------------------------------------------------
33E8 00382 USER_LCD_DetermineCS
33E8 0012      00383         return
               00384 
               00385 ;; --------------------------------------------------------------------------
               00386 ;;  This function is called by MIOS when the custom LCD should be cleared
               00387 ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
               00388 ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
               00389 ;;  Out: -
               00390 ;; --------------------------------------------------------------------------
33EA 00391 USER_LCD_Clear
               00392         SET_BSR MIOS_GLCD_GCURSOR_Y     ; 8 lines to clear
33EA 0105          M         movlb   HIGH(reg)
33EC 6B7C      00393         clrf    MIOS_GLCD_GCURSOR_Y, BANKED
33EE 00394 USER_LCD_ClearOuterLoop
               00395 
               00396         SET_BSR MIOS_GLCD_GCURSOR_X     ; 128 columns to clear
33EE 0105          M         movlb   HIGH(reg)
33F0 6B7B      00397         clrf    MIOS_GLCD_GCURSOR_X, BANKED
33F2 D812      00398         rcall   USER_LCD_CursorSet
               00399 
               00400         ;; data bytes
33F4 9293      00401     bcf USER_LCD_TRIS_DC, USER_LCD_PIN_DC
33F6 828A      00402         bsf     USER_LCD_LAT_DC, USER_LCD_PIN_DC
               00403         ;; select all LCDs
33F8 9693      00404         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS0
33FA 968A      00405     bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS0
               00406 #ifdef USER_LCD_PIN_CS1
               00407         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS1
               00408     bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS1
               00409 #endif
               00410 #ifdef USER_LCD_PIN_CS2
               00411         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS2
               00412     bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS2
               00413 #endif
               00414 #ifdef USER_LCD_PIN_CS3
               00415         bcf     USER_LCD_TRIS_CS, USER_LCD_PIN_CS3
               00416     bcf     USER_LCD_LAT_CS, USER_LCD_PIN_CS3
               00417 #endif
33FC 00418 USER_LCD_ClearInnerLoop
               00419         ;; transfer 0x00 to display
33FC 0E00      00420         movlw   0x00
33FE DFC7      00421         rcall   USER_LCD_ShiftByte
               00422         ;; increment graphical cursor
               00423         SET_BSR MIOS_GLCD_GCURSOR_X     ; 
3400 0105          M         movlb   HIGH(reg)
3402 2B7B      00424         incf    MIOS_GLCD_GCURSOR_X, F, BANKED
3404 0E7F      00425         movlw   128-1
3406 657B      00426         cpfsgt  MIOS_GLCD_GCURSOR_X, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 43


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00427         rgoto   USER_LCD_ClearInnerLoop
3408 D7F9          M         bra     label
               00428 
340A 2B7C      00429         incf    MIOS_GLCD_GCURSOR_Y, F, BANKED
340C 0E07      00430         movlw   8-1
340E 657C      00431         cpfsgt  MIOS_GLCD_GCURSOR_Y, BANKED
               00432         rgoto   USER_LCD_ClearOuterLoop
3410 D7EE          M         bra     label
               00433 
               00434         ;; set cursor to 0 and exit
3412 0E00      00435         movlw   0x00
3414 EF88 F016 00436         goto    MIOS_LCD_CursorSet
               00437 
               00438 
               00439 ;; --------------------------------------------------------------------------
               00440 ;;  This function is called by MIOS when the cursor should be changed
               00441 ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
               00442 ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
               00443 ;;       MIOS_GLCD_CURSOR_X - horizontal cursor position (for GLCDs)
               00444 ;;       MIOS_GLCD_CURSOR_Y - vertical cursor position   (for GLCDs)
               00445 ;;       MIOS_LCD_CURSOR_POS - character cursor position  (for CLCDs)
               00446 ;;  Out: -
               00447 ;; --------------------------------------------------------------------------
3418 00448 USER_LCD_CursorSet
               00449                 rgoto   USER_LCD_GCursorSet
3418 D000          M         bra     label
               00450 
               00451 
               00452 ;; --------------------------------------------------------------------------
               00453 ;;  This function is NOT called by MIOS, but only used by the custom driver
               00454 ;;  to set the cursor positions
               00455 ;;  In:  graphical cursor position in MIOS_GLCD_GCURSOR_X and MIOS_GLCD_GCURSOR_Y
               00456 ;;  Out: -
               00457 ;; --------------------------------------------------------------------------
341A 00458 USER_LCD_GCursorSet
               00459         
               00460         ;; Set X position, wrap at 128 (LCD X cursor must be less than 128!)
               00461         SET_BSR MIOS_GLCD_GCURSOR_X
341A 0105          M         movlb   HIGH(reg)
341C 517B      00462         movf    MIOS_GLCD_GCURSOR_X, W, BANKED
341E 6F70      00463         movwf   MIOS_GLCD_BUFFER+0, BANKED
3420 0E7F      00464         movlw   128-1
3422 6570      00465         cpfsgt  MIOS_GLCD_BUFFER+0, BANKED
               00466         rgoto   USER_LCD_GCursorSet_X_Cont
3424 D007          M         bra     label
3426 0E80      00467         movlw   -128
3428 2770      00468         addwf   MIOS_GLCD_BUFFER+0, F, BANKED
342A 0E7F      00469         movlw   128-1
342C 6570      00470         cpfsgt  MIOS_GLCD_BUFFER+0, BANKED
               00471         rgoto   USER_LCD_GCursorSet_X_Cont
342E D002          M         bra     label
3430 0E80      00472         movlw   -128
3432 2770      00473         addwf   MIOS_GLCD_BUFFER+0, F, BANKED
               00474 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 44


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3434 00475 USER_LCD_GCursorSet_X_Cont
               00476         ; First remove 4 LSB and send
               00477         ; Then remove 4 MSB and send
3434 3970      00478         swapf   MIOS_GLCD_BUFFER+0, W, BANKED ; Swap bottom 4 bits with top 4
3436 0B0F      00479         andlw   0x0f ; Mask out top 4 bits (actually bottom 4!)
3438 0910      00480         iorlw   0x10   ; Column address set upper bit
343A DFA2      00481         rcall   USER_LCD_Cmd
343C 5170      00482         movf    MIOS_GLCD_BUFFER+0, W, BANKED 
343E 0B0F      00483         andlw   0x0f ; Mask out top 4 bits
3440 DF9F      00484         rcall   USER_LCD_Cmd
               00485         
               00486         
               00487         ;; Set Y position, wrap at 8 (LCD Y cursor must be less than 8!)
3442 517C      00488         movf    MIOS_GLCD_GCURSOR_Y, W, BANKED
3444 6F70      00489         movwf   MIOS_GLCD_BUFFER+0, BANKED
3446 0E07      00490         movlw   8-1
3448 6570      00491         cpfsgt  MIOS_GLCD_BUFFER+0, BANKED
               00492         rgoto   USER_LCD_GCursorSet_Y_Cont
344A D00C          M         bra     label
344C 0EF8      00493         movlw   -8
344E 2770      00494         addwf   MIOS_GLCD_BUFFER+0, F, BANKED
3450 0E07      00495         movlw   8-1
3452 6570      00496         cpfsgt  MIOS_GLCD_BUFFER+0, BANKED
               00497         rgoto   USER_LCD_GCursorSet_Y_Cont
3454 D007          M         bra     label
3456 0EF8      00498         movlw   -8
3458 2770      00499         addwf   MIOS_GLCD_BUFFER+0, F, BANKED
345A 0E07      00500         movlw   8-1
345C 6570      00501         cpfsgt  MIOS_GLCD_BUFFER+0, BANKED
               00502         rgoto   USER_LCD_GCursorSet_Y_Cont
345E D002          M         bra     label
3460 0EF8      00503         movlw   -8
3462 2770      00504         addwf   MIOS_GLCD_BUFFER+0, F, BANKED
3464 00505 USER_LCD_GCursorSet_Y_Cont
3464 5170      00506         movf    MIOS_GLCD_BUFFER+0, W, BANKED
3466 09B0      00507         iorlw   0xb0 ; Display Column H=W+0xb0 (select bank+line)
               00508         rgoto   USER_LCD_Cmd
3468 D78B          M         bra     label
               00509 
               00510 
               00511 
               00512 
               00513 ;; --------------------------------------------------------------------------
               00514 ;;  This function is called by MIOS when a character should be print
               00515 ;;  In:  WREG - character
               00516 ;;       all other MIOS_*LCD_* registers
               00517 ;;  Out: GLCDs should justify the X/Y cursor position
               00518 ;; --------------------------------------------------------------------------
346A 00519 USER_LCD_PrintChar
               00520         ;; calc offset address to character
               00521         SET_BSR MIOS_GLCD_TMP1
346A 0105          M         movlb   HIGH(reg)
346C 6F85      00522         movwf   MIOS_GLCD_TMP1, BANKED
               00523 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 45


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00524         ;; how much bytes per character?
346E 5180      00525         movf    MIOS_GLCD_FONT_OFFSET, W, BANKED
3470 037E      00526         mulwf   MIOS_GLCD_FONT_HEIGHT, BANKED
               00527 
               00528         ;; multiply with character value
3472 5185      00529         movf    MIOS_GLCD_TMP1, W, BANKED
3474 02F3      00530         mulwf   PRODL
               00531 
3476 CFF6 F585 00532         movff   TBLPTRL, MIOS_GLCD_TMP1         ; store current TBLPTR in temp. register
347A CFF7 F586 00533         movff   TBLPTRH, MIOS_GLCD_TMP2
               00534 
347E 5181      00535         movf    MIOS_GLCD_FONT_PTRL, W, BANKED
3480 257F      00536         addwf   MIOS_GLCD_FONT_X0, W, BANKED
3482 24F3      00537         addwf   PRODL, W
3484 6EF6      00538         movwf   TBLPTRL
3486 5182      00539         movf    MIOS_GLCD_FONT_PTRH, W, BANKED
3488 20F4      00540         addwfc  PRODH, W
348A 6EF7      00541         movwf   TBLPTRH
               00542 
348C 517E      00543         movf    MIOS_GLCD_FONT_HEIGHT, W, BANKED
348E 6EE2      00544         movwf   FSR1H
               00545 
               00546         
               00547         
3490 00548 USER_LCD_PrintCharOuterLoop
3490 517D      00549         movf    MIOS_GLCD_FONT_WIDTH, W, BANKED
3492 6EE1      00550         movwf   FSR1L
3494 00551 USER_LCD_PrintCharLoop
3494 0009      00552         tblrd*+                         ; read from flash and increment table pointer
3496 50F5      00553         movf    TABLAT, W               ; get result
3498 DF51      00554         rcall   USER_LCD_Data           ; write out
349A 2EE1      00555         decfsz  FSR1L, F                ; loop until zero
               00556         rgoto   USER_LCD_PrintCharLoop
349C D7FB          M         bra     label
               00557 
349E 4EE2      00558         dcfsnz  FSR1H, F
               00559         rgoto   USER_LCD_PrintCharLoop_End
34A0 D00C          M         bra     label
               00560 
34A2 517D      00561         movf    MIOS_GLCD_FONT_WIDTH, W, BANKED
34A4 5D80      00562         subwf   MIOS_GLCD_FONT_OFFSET, W, BANKED
34A6 E004      00563         bz      USER_LCD_PrintCharFixLoopEnd
34A8 6EE1      00564         movwf   FSR1L
34AA 00565 USER_LCD_PrintCharFixLoop
34AA 0009      00566         tblrd*+
34AC 2EE1      00567         decfsz  FSR1L, F
               00568         rgoto   USER_LCD_PrintCharFixLoop
34AE D7FD          M         bra     label
               00569 
34B0 00570 USER_LCD_PrintCharFixLoopEnd
               00571         
34B0 2B7C      00572         incf    MIOS_GLCD_GCURSOR_Y, F, BANKED
34B2 517D      00573         movf    MIOS_GLCD_FONT_WIDTH, W, BANKED
34B4 5F7B      00574         subwf   MIOS_GLCD_GCURSOR_X, F, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 46


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
34B6 DFB1      00575         rcall   USER_LCD_GCursorSet
               00576 
               00577         rgoto   USER_LCD_PrintCharOuterLoop
34B8 D7EB          M         bra     label
               00578 
34BA 00579 USER_LCD_PrintCharLoop_End
34BA 057E      00580         decf    MIOS_GLCD_FONT_HEIGHT, W, BANKED
34BC E004      00581         bz      USER_LCD_PrintChar_NoYFix
34BE 1D7E      00582         comf    MIOS_GLCD_FONT_HEIGHT, W, BANKED
34C0 0F02      00583         addlw   2
34C2 277C      00584         addwf   MIOS_GLCD_GCURSOR_Y, F, BANKED
34C4 DFAA      00585         rcall   USER_LCD_GCursorSet
34C6 00586 USER_LCD_PrintChar_NoYFix
34C6 C585 FFF6 00587         movff   MIOS_GLCD_TMP1, TBLPTRL         ; restore TBLPTR from temp. register
34CA C586 FFF7 00588         movff   MIOS_GLCD_TMP2, TBLPTRH
34CE 0012      00589         return
               00590 
               00591 
               00592 ;; --------------------------------------------------------------------------
               00593 ;;  FUNCTION: USER_LCD_SpecialCharInit
               00594 ;;  DESCRIPTION: see MIOS_CLCD_SpecialCharInit
               00595 ;;  IN:  number of special character (0-7) in WREG
               00596 ;;       pointer to special char pattern in TBLPTR (consists of 8
               00597 ;;          entries for every character-line)
               00598 ;;  OUT: TBLPTR has to be set to next table entry (TBLPTR+=8)
               00599 ;; --------------------------------------------------------------------------
34D0 00600 USER_LCD_SpecialCharInit
               00601         ;; not used by this driver
34D0 0012      00602         return
               00046 
               00047 ;; ==========================================================================
               00048 ;;  All MIOS hooks in one file
               00049 ;; ==========================================================================
               00050 
               00051 ;; --------------------------------------------------------------------------
               00052 ;;  This function is called by MIOS after startup to initialize the 
               00053 ;;  application
               00054 ;; --------------------------------------------------------------------------
34D2 00055 USER_Init
               00056         ;; initialize application specific variables
34D2 6A10      00057         clrf    TIA_STAT
34D4 6A21      00058         clrf    TIA_SYSEX_STATE
34D6 6A22      00059         clrf    TIA_SYSEX_ACTION
34D8 6819      00060         setf    TIA_BANKSTICK_CHK_CTR   ; (we have to start with BS0 in TIA_BANK_CheckStick)
               00061 
               00062         ;; initialize the timer for the TIA_SW handler
34DA 0EFE      00063         movlw   8190 & 0xff             ; every 819 us
34DC 6E03      00064         movwf   MIOS_PARAMETER1
34DE 0E1F      00065         movlw   8190 >> 8
34E0 6E04      00066         movwf   MIOS_PARAMETER2
34E2 0E00      00067         movlw   0x00                    ; prescaler 1:1
34E4 ECBC F016 00068         call    MIOS_TIMER_Init
               00069 
               00070         ;; initialize the MBHP_TIA module
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 47


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
34E8 EC51 F01F 00071         call    TIA_SR_Init
               00072   
               00073 
               00074         ;; init patch
34EC 6A13      00075         clrf    TIA_PATCH
34EE 6A14      00076         clrf    TIA_PBANK
34F0 ECAC F01B 00077         call    TIA_PATCH_Init
               00078     
               00079 
               00080         ;; initialize the shift registers
34F4 0E01      00081         movlw   0x01                    ; use only first register (maximum would be 16!)
34F6 EC78 F016 00082         call    MIOS_SRIO_NumberSet
34FA 0E01      00083         movlw   0x01                    ; set update frequncy
34FC EC80 F016 00084         call    MIOS_SRIO_UpdateFrqSet
3500 0E00      00085         movlw   0x00                    ; disable touch sensor
3502 EC7C F016 00086         call    MIOS_SRIO_TS_SensitivitySet
               00087     
               00088 #if TIA_LEDMTR_ENABLE
               00089     call   TIA_LEDMTR_Init
               00090 #endif     
               00091 
               00092         ;; initialize J5 for driving LEDs if enabled
               00093 #if ENABLE_J5
               00094         movlw   0x00
               00095         call    J5_IO_Init
               00096 #endif
               00097 
3506 0E0F      00098     movlw       0x0f            ; all newer PIC18F derivatives (like PIC18F4685) all pin digits
3508 6EC1      00099         movwf   ADCON1
350A 0E07      00100     movlw   07h 
350C 6EB4      00101     movwf   CMCON
               00102 
               00103 #if MIDI_RXTX_USE_IO 
               00104     call    MIDI_RXTX_IO_Init
               00105 #endif
               00106 
               00107 #if ENABLE_AIN_LFO_WAVEFORM
               00108         movlw   0x06                    ; enable the first 6 analog inputs
               00109         call    MIOS_AIN_NumberSet
               00110         call    MIOS_AIN_UnMuxed        ; not multiplexed
               00111         movlw   0x03                    ; 8 bit resolution
               00112 #endif
               00113 
               00114     ;; set MB_STAT_DISPLAY_GLCD type
350E 6A03      00115     clrf    MIOS_PARAMETER1
3510 6A04      00116     clrf    MIOS_PARAMETER2
3512 0E07      00117     movlw   0x07
3514 ECA4 F016 00118     call    MIOS_LCD_TypeSet
               00119     
               00120         ;; initialize the AOUT module
               00121         ;call   AOUT_Init
               00122 
               00123         ;; initialize the integrated MIDI merger
3518 0E00      00124         movlw   MIOS_MIDI_MERGER_DISABLED       ; should be disabled for a synthesizer
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 48


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
351A EC14 F016 00125         call    MIOS_MIDI_MergerSet
               00126 
351E 0012      00127         return
               00128 
               00129 
               00130 
               00131 ;; --------------------------------------------------------------------------
               00132 ;;  This function is called by MIOS in the mainloop when nothing else is to do
               00133 ;; --------------------------------------------------------------------------
3520 00134 USER_Tick
               00135 
               00136         ;; ---[ check BankStick status ]---
3520 ECAC F01C 00137         call    TIA_BANK_CheckStick
               00138 
               00139         ;; ---[ update AOUTs channels (if enabled) ]---
               00140 ;       IRQ_DISABLE
               00141 ;       call    AOUT_Update
               00142 ;       IRQ_ENABLE
               00143 
               00144         ;; ---[ call TIA shift register handler ]---
3524 EC5F F01F 00145         call    TIA_SR_Handler
               00146 
               00147         ;; ---[ handle with CC dump reuqests ]---
3528 ECFD F02E 00148         call    TIA_CCOUT_Handler
               00149     
               00150 
               00151 
352C 0012      00152         return
               00153 
               00154 
               00155 ;; --------------------------------------------------------------------------
               00156 ;;  This function is periodically called by MIOS. The frequency has to be
               00157 ;;  initialized with MIOS_Timer_Set
               00158 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00159 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
               00160 ;; --------------------------------------------------------------------------
352E 00161 USER_Timer
               00162 
               00163         ;; ---[ call Software TIA Handler ]---
352E EC17 F020 00164         call    TIA_SW_Handler
               00165 
3532 0012      00166         return
               00167 
               00168 ;; --------------------------------------------------------------------------
               00169 ;;  This function is called by MIOS when a debug command has been received
               00170 ;;  via SysEx
               00171 ;;  Input:
               00172 ;;     o WREG, MIOS_PARAMETER1, MIOS_PARAMETER2, MIOS_PARAMETER3 like
               00173 ;;       specified in the debug command
               00174 ;;  Output:
               00175 ;;     o return values WREG, MIOS_PARAMETER1, MIOS_PARAMETER2, MIOS_PARAMETER3
               00176 ;; --------------------------------------------------------------------------
3534 00177 USER_MPROC_DebugTrigger
3534 0012      00178         return
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 49


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00179 
               00180 
               00181 ;; --------------------------------------------------------------------------
               00182 ;;  This function is called by MIOS when the display content should be 
               00183 ;;  initialized. Thats the case during startup and after a temporary message
               00184 ;;  has been printed on the screen
               00185 ;; --------------------------------------------------------------------------
3536 00186 TEXT_WELCOME_0  STRING 20, 0x00, MBTIA_VERSION_STR
3536 1400 494D     M         da      ((length) << 8) | (pos), str
     4944 6F62 
     5478 4149 
     5620 2E31 
     6562 6174 
     2020      
354C 00187 TEXT_WELCOME_10 STRING 16, 0x40, "Launching CS    "
354C 1040 614C     M         da      ((length) << 8) | (pos), str
     6E75 6863 
     6E69 2067 
     5343 2020 
     2020      
355E 00188 USER_DISPLAY_Init
               00189     ;; clear screen
355E EC82 F016 00190     call    MIOS_LCD_Clear
               00191     
               00192     TABLE_ADDR TEXT_WELCOME_0       ; print welcome message
3562 0E36          M         movlw   LOW(addr)               ; store Lo Byte
3564 6EF6          M         movwf   TBLPTRL
3566 0E35          M         movlw   HIGH(addr)              ; store Hi Byte
3568 6EF7          M         movwf   TBLPTRH
                   M #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
356A 0E00          M         movlw   UPPER(addr)             ; store Upper Byte
356C 6EF8          M         movwf   TBLPTRU
                   M #endif
356E EC9E F016 00193     call    MIOS_LCD_PrintString        ; first line
               00194     TABLE_ADDR TEXT_WELCOME_10       ; print welcome message
3572 0E4C          M         movlw   LOW(addr)               ; store Lo Byte
3574 6EF6          M         movwf   TBLPTRL
3576 0E35          M         movlw   HIGH(addr)              ; store Hi Byte
3578 6EF7          M         movwf   TBLPTRH
                   M #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
357A 0E00          M         movlw   UPPER(addr)             ; store Upper Byte
357C 6EF8          M         movwf   TBLPTRU
                   M #endif
357E EC9E F016 00195     call    MIOS_LCD_PrintString        ; first line
3582 0012      00196     return
               00197 
               00198 ;; --------------------------------------------------------------------------
               00199 ;;  This function is called in the mainloop when no temporary message is shown
               00200 ;;  on screen. Print the realtime messages here
               00201 ;; --------------------------------------------------------------------------
               00202 
3584 00203 USER_DISPLAY_Tick
               00204 
               00205 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 50


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00206         ;; call MIDI RxTx handler and exit
3584 EC17 F01B 00207         call    MIDI_RXTX_Handler
               00208 
               00209 #if TIA_LEDMTR_ENABLE
               00210     call    TIA_LEDMTR_Handler
               00211 #endif     
               00212 
               00213 
               00214 
3588 0012      00215         return
               00216 
               00217 ;; --------------------------------------------------------------------------
               00218 ;;  This function is called by MIOS when a complete MIDI event has been received
               00219 ;;  Input:
               00220 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00221 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00222 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00223 ;; --------------------------------------------------------------------------
358A 00224 USER_MPROC_NotifyReceivedEvent
               00225         ;; branch to ReceiveEvent function of TIA synth
               00226 
358A EF2E F027 00227         goto    TIA_MIDI_NotifyReceivedEvent
               00228     
358E 0012      00229         return
               00230 
               00231 ;; --------------------------------------------------------------------------
               00232 ;;  This function is called by MIOS when a MIDI event has been received
               00233 ;;  which has been specified in the CONFIG_MIDI_IN table
               00234 ;;  Input:
               00235 ;;     o number of entry in WREG
               00236 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00237 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00238 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00239 ;; --------------------------------------------------------------------------
3590 00240 USER_MPROC_NotifyFoundEvent
               00241 
3590 0012      00242         return
               00243 
               00244 
               00245 ;; --------------------------------------------------------------------------
               00246 ;;  This function is called by MIOS when a MIDI event has not been completly
               00247 ;;  received within 2 seconds
               00248 ;; --------------------------------------------------------------------------
3592 00249 USER_MPROC_NotifyTimeout
               00250         ;; -> jump to "ActionInvalid" for a proper reset of the sysex parser
3592 EF36 F029 00251         goto    TIA_SYSEX_ActionInvalid
3596 0012      00252         return
               00253     
               00254 ;; --------------------------------------------------------------------------
               00255 ;;  This function is called by MIOS when a MIDI byte has been received
               00256 ;;  Input:
               00257 ;;     o received MIDI byte in WREG and MIOS_PARAMETER1
               00258 ;; --------------------------------------------------------------------------
3598 00259 USER_MPROC_NotifyReceivedByte
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 51


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00260         ;; -> continue at TIA_MPROC_SysExCheck
3598 EF16 F029 00261         goto    TIA_SYSEX_SysExCheck
359C 0012      00262         return
               00263         
               00264 ;; --------------------------------------------------------------------------
               00265 ;;  This function is called by MIOS before the transfer of a MIDI byte. 
               00266 ;;  It can be used to monitor the Tx activity or to do any other actions
               00267 ;;  (e.g. to switch a pin for multiplexed MIDI Outs) before the byte will 
               00268 ;;  be sent.
               00269 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00270 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
               00271 ;;  Input:
               00272 ;;     o transmitted byte in WREG
               00273 ;; --------------------------------------------------------------------------
359E 00274 USER_MIDI_NotifyTx
               00275         ;; notify Tx event to MIDI_RXTX handler
359E EF13 F01B 00276         goto    MIDI_RXTX_NotifyTx
35A2 0012      00277         return
               00278     
               00279 ;; --------------------------------------------------------------------------
               00280 ;;  This function is called by MIOS when a MIDI byte has been received.
               00281 ;;  It can be used to monitor the Rx activity or to do any action - e.g.
               00282 ;;  to react on realtime events like MIDI clock (0xf8) with a minimum latency
               00283 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00284 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
               00285 ;;  Input:
               00286 ;;     o received byte in WREG
               00287 ;; --------------------------------------------------------------------------
35A4 00288 USER_MIDI_NotifyRx
               00289         ;; temporary save received byte in IRQ_TMP1
35A4 6E0B      00290         movwf   IRQ_TMP1
               00291 
               00292         ;; if MIDI clock: notify clock
35A6 EE21 F0F0 00293         lfsr    FSR2, TIA_MIDI_SYNC
35AA 0AF8      00294         xorlw   0xf8
35AC E103      00295         bnz USER_MIDI_NotifyRx_NoF8
35AE 88DF      00296         bsf     INDF2, TIA_MIDI_SYNC_F8
35B0 EF06 F01B 00297     goto        MIDI_RXTX_NotifyRx_BeatClk
35B4 00298 USER_MIDI_NotifyRx_NoF8
               00299         ;; if MIDI start: notify start
35B4 500B      00300         movf    IRQ_TMP1, W
35B6 0AFA      00301         xorlw   0xfa
35B8 E102      00302     bnz USER_MIDI_NotifyRx_NoFA
35BA 8ADF      00303         bsf     INDF2, TIA_MIDI_SYNC_FA
35BC 6B69      00304     clrf    MIDI_RXTX_BEAT_CTR
35BE 00305 USER_MIDI_NotifyRx_NoFA
               00306     
               00307         ;; notify Rx event to MIDI_RXTX handler
35BE EF0F F01B 00308         goto    MIDI_RXTX_NotifyRx
               00309 
               00310     
35C2 0012      00311         return
               00312     
               00313 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 52


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00314 ;;  This function is called by MIOS when an button has been toggled
               00315 ;;  Input:
               00316 ;;     o Button number in WREG and MIOS_PARAMETER1
               00317 ;;     o Button value MIOS_PARAMETER2:
               00318 ;;       - 1 if button has been released (=5V)
               00319 ;;       - 0 if button has been pressed (=0V)
               00320 ;; --------------------------------------------------------------------------
35C4 00321 USER_DIN_NotifyToggle
35C4 0012      00322         return
               00323 
               00324 
               00325 ;; --------------------------------------------------------------------------
               00326 ;;  This function is called by MIOS when an encoder has been moved
               00327 ;;  Input:
               00328 ;;     o Encoder number in WREG and MIOS_PARAMETER1
               00329 ;;     o signed incrementer value in MIOS_PARAMETER2:
               00330 ;;       - is positive when encoder has been turned clockwise
               00331 ;;       - is negative when encoder has been turned counter clockwise
               00332 ;; --------------------------------------------------------------------------
35C6 00333 USER_ENC_NotifyChange
35C6 0012      00334         return
               00335 
               00336 
               00337 ;; --------------------------------------------------------------------------
               00338 ;;  This function is called by MIOS before the shift register are loaded
               00339 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00340 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible
               00341 ;; --------------------------------------------------------------------------
35C8 00342 USER_SR_Service_Prepare
35C8 0012      00343         return
               00344     
               00345 ;; --------------------------------------------------------------------------
               00346 ;;  This function is called by MIOS after the shift register have been loaded
               00347 ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
               00348 ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible
               00349 ;; --------------------------------------------------------------------------
35CA 00350 USER_SR_Service_Finish
35CA 0012      00351         return
               00352 
               00353 ;; --------------------------------------------------------------------------
               00354 ;;  This function is called by MIOS when a pot has been moved
               00355 ;;  Input:
               00356 ;;     o Pot number in WREG and MIOS_PARAMETER1
               00357 ;;     o LSB value in MIOS_PARAMETER2
               00358 ;;     o MSB value in MIOS_PARAMETER3
               00359 ;; --------------------------------------------------------------------------
35CC 00360 USER_AIN_NotifyChange
35CC 0012      00361         return
               00362 
               00363 
               00364 ;; ==========================================================================
               00365 ;;  Application code (see comments in files)
               00366 ;; ==========================================================================
               00367 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 53


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00368 ;; ---[ modules from code library ]---
               00369 ; override default pin definitions of AOUT driver
               00370 ;#define AOUT_LAT_CS    LATC    ; The chip select pin CS#
               00371 ;#define AOUT_TRIS_CS   TRISC   ; is connected to Port C.3 
               00372 ;#define AOUT_PIN_CS    3       ; (CANNOT be shared with other outputs!)
               00373 ;
               00374 ;#define AOUT_LAT_DIN   LATC    ; The data input pin DIN
               00375 ;#define AOUT_TRIS_DIN  TRISC   ; is connected to Port C.1
               00376 ;#define AOUT_PIN_DIN   1       ; (can be shared with other outputs)
               00377 ;;
               00378 ;#define AOUT_LAT_SCLK  LATC    ; The shift clock input pin SCLK
               00379 ;#define AOUT_TRIS_SCLK TRISC   ; is connected to Port C.0
               00380 ;#define AOUT_PIN_SCLK  0       ; (can be shared with other outputs)
               00381 ; include AOUT driver (located in $MIOS_PATH/modules/aout/)
               00382 ;#include <aout.inc>
               00383 
               00384 ;#define J5_IO_DONT_USE_INPUT_FUNCTIONS 1
               00385 ;#include <j5_io.inc>
               00386 
               00387 ;; ---[ reusable functions ]---
               00388 #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 
35CE 00010 MATH_MUL16_16
               00011         SET_BSR MUL_R_0
35CE 0101          M         movlb   HIGH(reg)
               00012         
35D0 51F8      00013         movf    MUL_A_L, W
35D2 03FA      00014         mulwf   MUL_B_L         ; MUL_A_L * MUL_B_L -> PRODH:PRODL
35D4 CFF4 F1FD 00015         movff   PRODH, MUL_R_1
35D8 CFF3 F1FC 00016         movff   PRODL, MUL_R_0
               00017         
35DC 51F9      00018         movf    MUL_A_H, W
35DE 03FB      00019         mulwf   MUL_B_H         ; MUL_A_H * MUL_B_H -> PRODH:PRODL
35E0 CFF4 F1FF 00020         movff   PRODH, MUL_R_3
35E4 CFF3 F1FE 00021         movff   PRODL, MUL_R_2
               00022 
35E8 51F8      00023         movf    MUL_A_L, W
35EA 03FB      00024         mulwf   MUL_B_H         ; MUL_A_L * MUL_B_H -> PRODH:PRODL
35EC 50F3      00025         movf    PRODL, W
35EE 27FD      00026         addwf   MUL_R_1, F      ; Add cross
35F0 50F4      00027         movf    PRODH, W        ; products
35F2 23FE      00028         addwfc  MUL_R_2, F
35F4 6AE8      00029         clrf    WREG
35F6 23FF      00030         addwfc  MUL_R_3, F
               00031 
35F8 51F9      00032         movf    MUL_A_H, W
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 54


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
35FA 03FA      00033         mulwf   MUL_B_L         ; MUL_A_H * MUL_B_L -> PRODH:PRODL
35FC 50F3      00034         movf    PRODL, W
35FE 27FD      00035         addwf   MUL_R_1, F      ; Add cross
3600 50F4      00036         movf    PRODH, W        ; products
3602 23FE      00037         addwfc  MUL_R_2, F
3604 6AE8      00038         clrf    WREG
3606 23FF      00039         addwfc  MUL_R_3, F
               00040 
3608 0012      00041         return
               00389 #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 ;
               00011 ; Settings which can be modified:
               00012 ;
               00013 ; Number of update cycles (* 1mS) the LEDs will stay active on a Rx/Tx event
360A 00014 #define MIDI_RXTX_LED_DELAY 15
               00015 ; DOUT pin number of Rx LED
360A 00016 #define MIDI_RXTX_RX_LED    DEFAULT_MIDI_RX_LED
               00017 ; DOUT pin number of Tx LED
360A 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 ;; --------------------------------------------------------------------------
360A 00038 MIDI_RXTX_IO_Init
               00039 #if MIDI_RXTX_USE_IO 
               00040     bcf     DEFAULT_MIDI_RX_TRIS, DEFAULT_MIDI_RX_PIN
               00041     bcf     DEFAULT_MIDI_TX_TRIS, DEFAULT_MIDI_TX_PIN
               00042 #endif
360A 0012      00043         return
               00044 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 55


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00045 ;; --------------------------------------------------------------------------
               00046 ;;  FUNCTION: MIDI_RXTX_NotifyRx_BeatClk
               00047 ;;  DESCRIPTION: this function has to be called from the USER_MIDI_NotifyRx
               00048 ;;  on F8 event
               00049 ;; --------------------------------------------------------------------------
360C 00050 MIDI_RXTX_NotifyRx_BeatClk
360C 2B69      00051     incf    MIDI_RXTX_BEAT_CTR, F
360E 0E17      00052     movlw   0x17
3610 6569      00053     cpfsgt  MIDI_RXTX_BEAT_CTR, BANKED
               00054     rgoto   MIDI_RXTX_NotifyRx_BeatClk_End
3612 D004          M         bra     label
3614 6B69      00055     clrf    MIDI_RXTX_BEAT_CTR
3616 0E0F      00056         movlw   MIDI_RXTX_LED_DELAY
               00057         SET_BSR MIDI_RXTX_RX_CTR
3618 0100          M         movlb   HIGH(reg)
361A 6F67      00058         movwf   MIDI_RXTX_RX_CTR, BANKED    
361C 00059 MIDI_RXTX_NotifyRx_BeatClk_End
361C 0012      00060         return
               00061     
               00062 ;; --------------------------------------------------------------------------
               00063 ;;  FUNCTION: MIDI_RXTX_NotifyRx
               00064 ;;  DESCRIPTION: this function has to be called from the USER_MIDI_NotifyRx
               00065 ;;  hook when a MIDI event has been received to reload the RX counter
               00066 ;; --------------------------------------------------------------------------
361E 00067 MIDI_RXTX_NotifyRx
361E 0E0F      00068         movlw   MIDI_RXTX_LED_DELAY
               00069         SET_BSR MIDI_RXTX_RX_CTR
3620 0100          M         movlb   HIGH(reg)
3622 6F67      00070         movwf   MIDI_RXTX_RX_CTR, BANKED
3624 0012      00071         return
               00072 
               00073 ;; --------------------------------------------------------------------------
               00074 ;;  FUNCTION: MIDI_RXTX_NotifyTx
               00075 ;;  DESCRIPTION: this function has to be called from the USER_MIDI_NotifyTx
               00076 ;;  hook when a MIDI event will be transmitted to reload the TX counter
               00077 ;; --------------------------------------------------------------------------
3626 00078 MIDI_RXTX_NotifyTx
3626 0E0F      00079         movlw   MIDI_RXTX_LED_DELAY
               00080         SET_BSR MIDI_RXTX_TX_CTR
3628 0100          M         movlb   HIGH(reg)
362A 6F68      00081         movwf   MIDI_RXTX_TX_CTR, BANKED
362C 0012      00082         return
               00083 
               00084 ;; --------------------------------------------------------------------------
               00085 ;;  FUNCTION: MIDI_RXTX_Handler
               00086 ;;  DESCRIPTION: this function has to be called from the USER_SR_ServicePrpeare
               00087 ;;  hook, it decrements the Rx/Tx counters and sets the LEDs depending on the
               00088 ;;  counter values
               00089 ;; --------------------------------------------------------------------------
362E 00090 MIDI_RXTX_Handler
               00091 #if DEFAULT_MIDI_MONITOR_ENABLED == 1
               00092         ;; Decrement Rx counter if != 0
               00093         SET_BSR MIDI_RXTX_RX_CTR
               00094         movf    MIDI_RXTX_RX_CTR, W, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 56


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00095         skpz
               00096         decf    MIDI_RXTX_RX_CTR, F, BANKED
               00097 
               00098         ;; Decrement Tx counter if != 0
               00099         SET_BSR MIDI_RXTX_TX_CTR
               00100         movf    MIDI_RXTX_TX_CTR, W, BANKED
               00101         skpz
               00102         decf    MIDI_RXTX_TX_CTR, F, BANKED
               00103 
               00104         ;; 
               00105         ;; remove the code below if you don't want to use LEDs to
               00106         ;; indicate the counter state
               00107         ;; 
               00108 
               00109         ;; set the Rx LED depending on counter state
               00110         SET_BSR MIDI_RXTX_RX_CTR
               00111         movf    MIDI_RXTX_RX_CTR, W, BANKED
               00112         skpz
               00113         movlw   0x01
               00114         movwf   MIOS_PARAMETER1
               00115         
               00116 #if MIDI_RXTX_USE_IO
               00117     bcf     DEFAULT_MIDI_RX_LAT, DEFAULT_MIDI_RX_PIN
               00118     movf    MIOS_PARAMETER1, W
               00119     skpz
               00120     bsf     DEFAULT_MIDI_RX_LAT, DEFAULT_MIDI_RX_PIN
               00121 #else
               00122     movlw       MIDI_RXTX_RX_LED
               00123         call    MIOS_DOUT_PinSet
               00124 #endif
               00125 
               00126         ;; set the Tx LED depending on counter state
               00127         SET_BSR MIDI_RXTX_TX_CTR
               00128         movf    MIDI_RXTX_TX_CTR, W, BANKED
               00129         skpz
               00130         movlw   0x01
               00131         movwf   MIOS_PARAMETER1
               00132 
               00133 #if MIDI_RXTX_USE_IO
               00134     bcf     DEFAULT_MIDI_TX_LAT, DEFAULT_MIDI_TX_PIN
               00135     movf    MIOS_PARAMETER1, W
               00136     skpz
               00137     bsf     DEFAULT_MIDI_TX_LAT, DEFAULT_MIDI_TX_PIN
               00138 #else
               00139     movlw       MIDI_RXTX_TX_LED
               00140         call    MIOS_DOUT_PinSet
               00141 #endif
               00142 #endif
362E 0012      00143         return
               00390 #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 ;
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 57


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 ;; --------------------------------------------------------------------------
3630 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
3630 0301      00022         db b'00000001', b'00000011'; 1st and 2nd line of special char
3632 0307      00023         db b'00000111', b'00000011'; 3rd and 4th line of special char
3634 0001      00024         db b'00000001', b'00000000'; 5th and 6th line of special char
3636 0000      00025         db b'00000000', b'00000000'; 7th and 8th line of special char
               00026         ;; char #1: right-arrow
3638 0000      00027         db b'00000000', b'00000000'; 1st and 2nd line of special char
363A 1000      00028         db b'00000000', b'00010000'; 3rd and 4th line of special char
363C 1C18      00029         db b'00011000', b'00011100'; 5th and 6th line of special char
363E 1018      00030         db b'00011000', b'00010000'; 7th and 8th line of special char
               00031         ;; char #2: inverted 1
3640 131B      00032         db b'00011011', b'00010011'; 1st and 2nd line of special char
3642 1B1B      00033         db b'00011011', b'00011011'; 3rd and 4th line of special char
3644 1B1B      00034         db b'00011011', b'00011011'; 5th and 6th line of special char
3646 1F11      00035         db b'00010001', b'00011111'; 7th and 8th line of special char
               00036         ;; char #3: inverted 2
3648 0E11      00037         db b'00010001', b'00001110'; 1st and 2nd line of special char
364A 1D1E      00038         db b'00011110', b'00011101'; 3rd and 4th line of special char
364C 171B      00039         db b'00011011', b'00010111'; 5th and 6th line of special char
364E 1F00      00040         db b'00000000', b'00011111'; 7th and 8th line of special char
               00041         ;; char #4: inverted 3
3650 1D00      00042         db b'00000000', b'00011101'; 1st and 2nd line of special char
3652 1D1B      00043         db b'00011011', b'00011101'; 3rd and 4th line of special char
3654 0E1E      00044         db b'00011110', b'00001110'; 5th and 6th line of special char
3656 1F11      00045         db b'00010001', b'00011111'; 7th and 8th line of special char
               00046         ;; char #5: inverted 4
3658 191D      00047         db b'00011101', b'00011001'; 1st and 2nd line of special char
365A 0D15      00048         db b'00010101', b'00001101'; 3rd and 4th line of special char
365C 1D00      00049         db b'00000000', b'00011101'; 5th and 6th line of special char
365E 1F1D      00050         db b'00011101', b'00011111'; 7th and 8th line of special char
               00051         ;; char #6: inverted '-'
3660 1F1F      00052         db b'00011111', b'00011111'; 1st and 2nd line of special char
3662 001F      00053         db b'00011111', b'00000000'; 3rd and 4th line of special char
3664 1F1F      00054         db b'00011111', b'00011111'; 5th and 6th line of special char
3666 1F1F      00055         db b'00011111', b'00011111'; 7th and 8th line of special char
               00056         ;; char #7: left/right arrow
3668 0301      00057         db b'00000001', b'00000011'; line 1 / 2
366A 1307      00058         db b'00000111', b'00010011'; line 3 / 4
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 58


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
366C 1C19      00059         db b'00011001', b'00011100'; line 5 / 6
366E 1018      00060         db b'00011000', b'00010000'; line 7 / 8
               00391 ;; --------------------------------------------------------------------------
               00392 ;;  Including fonts from $MIOS_PATH/modules/glcd_font/
               00393 ;; --------------------------------------------------------------------------
               00394 ;;#include <glcd_font_meter_icons_h.inc>
               00395 
               00396 ;; ---[ TIA kernel ]---
               00397 #include "tia_led_meter.inc"
               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 ;; --------------------------------------------------------------------------
3670 00033 TIA_LEDMTR_Init
3670 6B6A      00034     clrf    TIA_LEDMTR_STAT
3672 6B6B      00035     clrf    TIA_LEDMTR_VALUE
3674 0012      00036     return
               00037         ;; reset will be released with first call of TIA_SR_Handler
               00038 
               00039 ;; --------------------------------------------------------------------------
               00040 ;;  LEDMTR module Handler
               00041 ;; --------------------------------------------------------------------------
3676 00042 TIA_LEDMTR_Handler
               00043         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
3676 0101          M         movlb   HIGH(reg)
               00044     ;; Template run prioity
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 59


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00045     BRA_IFCLR TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ, ACCESS, TIA_LEDMTR_Handler_End
3678 A06A          M         btfss   reg, bit, reg_a
367A D021          M         bra     label
               00046     
367C 00047 TIA_LEDMTR_Handler_Meter_Norm     
               00048     ;;BRA_IFSET TIA_LEDMTR_STAT, TIA_LEDMTR_TIA_MODE, ACCESS, TIA_LEDMTR_Handler_Meter_Sampler
367C 916A      00049     bcf     TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ
               00050 
367E 6B6B      00051     clrf    TIA_LEDMTR_VALUE
3680 0E01      00052     movlw   0x01
3682 6104      00053     cpfslt  TIA_AUDV0
3684 8F6B      00054     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR0
3686 0E07      00055     movlw   0x07
3688 6104      00056     cpfslt  TIA_AUDV0
368A 8D6B      00057     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR1
368C 0E0B      00058     movlw   0x0b
368E 6104      00059     cpfslt  TIA_AUDV0
3690 8B6B      00060     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR2
3692 0E0E      00061     movlw   0x0e
3694 6104      00062     cpfslt  TIA_AUDV0
3696 896B      00063     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR3
               00064     
3698 0E01      00065     movlw   0x01
369A 6105      00066     cpfslt  TIA_AUDV1
369C 876B      00067     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR4
369E 0E07      00068     movlw   0x07
36A0 6105      00069     cpfslt  TIA_AUDV1
36A2 856B      00070     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR5
36A4 0E0B      00071     movlw   0x0b
36A6 6105      00072     cpfslt  TIA_AUDV1
36A8 836B      00073     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR6
36AA 0E0E      00074     movlw   0x0e
36AC 6105      00075     cpfslt  TIA_AUDV1
36AE 816B      00076     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR7 
               00077 
36B0 516B      00078     movf    TIA_LEDMTR_VALUE, W
36B2 6E03      00079     movwf   MIOS_PARAMETER1
               00080     rgoto   TIA_LEDMTR_Handler_Set
36B4 D001          M         bra     label
               00081     
36B6 00082 TIA_LEDMTR_Handler_Meter_Sampler 
36B6 6A03      00083     clrf    MIOS_PARAMETER1
               00084     ; To Do
               00085     ;;rgoto   TIA_LEDMTR_Handler_Set
               00086 
36B8 00087 TIA_LEDMTR_Handler_Set
36B8 0E00      00088     movlw   TIA_LEDMTR_REG
36BA EC68 F016 00089     call    MIOS_DOUT_SRSet
               00090 
36BE 00091 TIA_LEDMTR_Handler_End
36BE 0012      00092         return
               00093 
               00094 ;; --------------------------------------------------------------------------
               00095 ;;  TIA_LEDMTR Led Pattern orange to green
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 60


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00096 ;; --------------------------------------------------------------------------
36C0 00097 TIA_LEDMTR_PlayFormat
36C0 D82D      00098         rcall   TIA_LEDMTR_Player_Init
               00099 
36C2 00100 TIA_LEDMTR_PlayFormat_R
36C2 D82C      00101         rcall   TIA_LEDMTR_Player_Init
36C4 0E11      00102         movlw   0x11
36C6 D83D      00103         rcall   TIA_LEDMTR_Player_On_Wait01
36C8 0E03      00104         movlw   0x03
36CA D83E      00105         rcall   TIA_LEDMTR_Wait
               00106         rgoto   TIA_LEDMTR_End
36CC D026          M         bra     label
               00107 
36CE 00108 TIA_LEDMTR_PlayFormat_O
36CE D826      00109         rcall   TIA_LEDMTR_Player_Init
36D0 0E33      00110         movlw   0x33
36D2 D837      00111         rcall   TIA_LEDMTR_Player_On_Wait01
36D4 0E01      00112         movlw   0x01
36D6 D838      00113         rcall   TIA_LEDMTR_Wait
               00114         rgoto   TIA_LEDMTR_End
36D8 D020          M         bra     label
               00115 
36DA 00116 TIA_LEDMTR_PlayFormat_G1
36DA D820      00117         rcall   TIA_LEDMTR_Player_Init
36DC 0E77      00118         movlw   0x77
36DE D831      00119         rcall   TIA_LEDMTR_Player_On_Wait01
36E0 0E03      00120         movlw   0x03
36E2 D832      00121         rcall   TIA_LEDMTR_Wait
               00122         rgoto   TIA_LEDMTR_End
36E4 D01A          M         bra     label
               00123 
36E6 00124 TIA_LEDMTR_PlayFormat_G2
36E6 D81A      00125         rcall   TIA_LEDMTR_Player_Init
36E8 0EFF      00126         movlw   0xff
36EA D82B      00127         rcall   TIA_LEDMTR_Player_On_Wait01
36EC 0E03      00128         movlw   0x03
36EE D82C      00129         rcall   TIA_LEDMTR_Wait
               00130         rgoto   TIA_LEDMTR_End
36F0 D014          M         bra     label
               00131     
               00132 ;; --------------------------------------------------------------------------
               00133 ;;  TIA_LEDMTR Led Pattern orange to green
               00134 ;; --------------------------------------------------------------------------
36F2 00135 TIA_LEDMTR_PlayOtoG
36F2 D814      00136         rcall   TIA_LEDMTR_Player_Init
               00137 
36F4 0E22      00138         movlw   0x22
36F6 D825      00139         rcall   TIA_LEDMTR_Player_On_Wait01
36F8 0E03      00140         movlw   0x03
36FA D826      00141         rcall   TIA_LEDMTR_Wait
36FC 0E44      00142         movlw   0x44
36FE D821      00143         rcall   TIA_LEDMTR_Player_On_Wait01
3700 0E03      00144         movlw   0x03
3702 D822      00145         rcall   TIA_LEDMTR_Wait
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 61


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3704 0E88      00146         movlw   0x88
3706 D81D      00147         rcall   TIA_LEDMTR_Player_On_Wait01
               00148 
               00149         rgoto   TIA_LEDMTR_End
3708 D008          M         bra     label
               00150     
               00151 ;; --------------------------------------------------------------------------
               00152 ;;  TIA_LEDMTR Led Pattern orange to red
               00153 ;; --------------------------------------------------------------------------
370A 00154 TIA_LEDMTR_PlayOtoR
370A D808      00155         rcall   TIA_LEDMTR_Player_Init
               00156 
370C 0E22      00157         movlw   0x22
370E D819      00158         rcall   TIA_LEDMTR_Player_On_Wait01
3710 0E03      00159         movlw   0x03
3712 D81A      00160         rcall   TIA_LEDMTR_Wait
3714 0E11      00161         movlw   0x11
3716 D815      00162         rcall   TIA_LEDMTR_Player_On_Wait01
               00163 
               00164         rgoto   TIA_LEDMTR_End
3718 D000          M         bra     label
               00165     
               00166 
               00167 
               00168 ;; --------------------------------------------------------------------------
               00169 ;;  TIA_LEDMTR End 
               00170 ;; --------------------------------------------------------------------------
371A 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
371A 0012      00174     return
               00175 
               00176 
               00177 ;; --------------------------------------------------------------------------
               00178 ;;  TIA_LEDMTR Initialization routine
               00179 ;; --------------------------------------------------------------------------
371C 00180 TIA_LEDMTR_Player_Init
371C 8010      00181         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn off TIA software synth part
               00182 
               00183         SET_BSR TIA_BASE
371E 0101          M         movlb   HIGH(reg)
3720 6A03      00184     clrf    MIOS_PARAMETER1
3722 0E00      00185     movlw   TIA_LEDMTR_REG
3724 EC68 F016 00186     call    MIOS_DOUT_SRSet
3728 0012      00187     return
               00188 ;; --------------------------------------------------------------------------
               00189 ;;  TIA_LEDMTR a note (in: Note Number)
               00190 ;; --------------------------------------------------------------------------
372A 00191 TIA_LEDMTR_Player_On
               00192         SET_BSR TIA_BASE
372A 0101          M         movlb   HIGH(reg)
372C 6E03      00193     movwf   MIOS_PARAMETER1
372E 0E00      00194     movlw   TIA_LEDMTR_REG
3730 EC68 F016 00195     call    MIOS_DOUT_SRSet
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 62


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3734 0012      00196     return
               00197 
3736 00198 TIA_LEDMTR_Player_Off
               00199         SET_BSR TIA_BASE
3736 0101          M         movlb   HIGH(reg)
3738 6A03      00200     clrf    MIOS_PARAMETER1
373A 0E00      00201     movlw   TIA_LEDMTR_REG
373C EC68 F016 00202     call    MIOS_DOUT_SRSet
3740 0012      00203     return
               00204     
3742 00205 TIA_LEDMTR_Player_On_Wait01
3742 DFF3      00206         rcall   TIA_LEDMTR_Player_On
3744 0E01      00207         movlw   0x01
               00208         rgoto   TIA_LEDMTR_Wait
3746 D000          M         bra     label
               00209     
               00210 
               00211 ;; --------------------------------------------------------------------------
               00212 ;;  TIA_LEDMTR wait for a certain time and poll TIA_SR Handler
               00213 ;; --------------------------------------------------------------------------
3748 00214 TIA_LEDMTR_Wait
3748 6E06      00215         movwf   TMP1
374A 0004      00216         clrwdt
374C 00217 TIA_LEDMTR_WaitLoop
374C 0E0A      00218         movlw   10
374E ECCE F016 00219         call    MIOS_Delay
3752 2E06      00220         decfsz  TMP1, F
               00221         rgoto   TIA_LEDMTR_WaitLoop
3754 D7FB          M         bra     label
3756 0012      00222         return
               00223 
               00398 #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 ;; --------------------------------------------------------------------------
3758 00019 TIA_PATCH_Init
               00020         ;; disable TIA engine
3758 8010      00021         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00022 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 63


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00023         ;; clear the whole TIA SFR memory space
375A 0E00      00024         movlw   ((TIA_SW_CLEAR_END-TIA_SW_CLEAR_BEGIN)+1) & 0xff
375C 6E06      00025         movwf   TMP1
375E EE01 F000 00026         lfsr    FSR0, TIA_SW_CLEAR_BEGIN
3762 00027 TIA_PATCH_Init_ClearLoop
3762 6AEE      00028         clrf    POSTINC0
3764 2E06      00029         decfsz  TMP1, F
               00030         rgoto   TIA_PATCH_Init_ClearLoop
3766 D7FD          M         bra     label
               00031 
               00032         ;; fetch 128 TIA parameters from EEPROM
3768 6A06      00033         clrf    TMP1
376A 0E00      00034     movlw   EEPROM_PATCH & 0xff
376C 6EA9      00035         movwf   EEADR
376E 0E00      00036     movlw   (EEPROM_PATCH >> 8) & 0xff
3770 6EAA      00037     movwf   EEADRH
3772 00038 TIA_PATCH_InitEELoop
3772 C014 F011 00039     movff   TIA_PBANK, TIA_BANK
3776 C013 F012 00040     movff   TIA_PATCH, TIA_PRESET
377A 5006      00041         movf    TMP1, W
377C ECF0 F02F 00042         call    TIA_SYSEX_TABLE_Get; get CC number
3780 6E07      00043         movwf   TMP2            ; temporary store number in TMP2
               00044 
3782 C006 FFA9 00045         movff   TMP1, EEADR     ; read parameter from current TIA bank
3786 EC42 F01C 00046         call    TIA_BANK_Read
378A 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
378C BE07          M         btfsc   reg, bit, reg_a
378E D004          M         bra     label
3790 00051 TIA_PATCH_InitEELoopN
               00052         ;; if TMP2[7] == 0, then set CC parameter
3790 5007      00053         movf    TMP2, W
3792 EC03 F02D 00054         call    TIA_CCIN_Set
               00055         rgoto   TIA_PATCH_InitEELoopC
3796 D008          M         bra     label
3798 00056 TIA_PATCH_InitEELoopS
               00057         ;; if TMP2[7..4] == 9, then set split point
3798 5007      00058         movf    TMP2, W
379A 0BF0      00059         andlw   0xf0
379C 0A90      00060         xorlw   0x90
379E E104      00061         bnz     TIA_PATCH_InitEELoopC
37A0 5007      00062         movf    TMP2, W
37A2 D819      00063         rcall   TIA_PATCH_GetSplitPointer
37A4 C003 FFE7 00064         movff   MIOS_PARAMETER1, INDF1
37A8 00065 TIA_PATCH_InitEELoopC
               00066 
37A8 2A06      00067         incf    TMP1, F         ; increment CC counter, loop until 0x80
               00068         BRA_IFCLR TMP1, 7, ACCESS, TIA_PATCH_InitEELoop
37AA AE06          M         btfss   reg, bit, reg_a
37AC D7E2          M         bra     label
               00069 
               00070         ;; get and store the MIDI channels
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 64


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
37AE 0E7E      00071         movlw   EEPROM_CFG_BASE & 0xff
37B0 6EA9      00072         movwf   EEADR
37B2 ECB0 F016 00073         call    MIOS_EEPROM_Read
37B6 CFE8 F160 00074         movff   WREG, TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL
37BA ECB0 F016 00075         call    MIOS_EEPROM_Read
37BE CFE8 F120 00076         movff   WREG, TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL
               00077         ;; get and store the device ID
37C2 ECB0 F016 00078         call    MIOS_EEPROM_Read        
               00079 #if AUTO_DEVICE_ID
               00080         ;; if AUTO_ID enabled, derive the TIA device ID from the MIOS device ID instead
37C6 EC04 F016 00081         call    MIOS_MIDI_DeviceIDGet
               00082 #endif
37CA 6E20      00083         movwf   TIA_MIDI_DEVICE
               00084     
37CC ECB0 F016 00085     call        MIOS_EEPROM_Read
               00086     ;; Empty
               00087 
               00088         ;; force a refresh of all registers
37D0 8210      00089         bsf     TIA_STAT, TIA_STAT_FORCE_REFRESH
               00090 
               00091         ;; enable TIA engine again
37D2 9010      00092         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00093 
37D4 0012      00094         return
               00095 
               00096 
               00097 
               00098 ;; --------------------------------------------------------------------------
               00099 ;;  This help routine returns the pointer to TIA_Vx_SPLIT_xxx depending
               00100 ;;  on WREG
               00101 ;;  OUT: pointer in FSR1
               00102 ;; --------------------------------------------------------------------------
37D6 00103 TIA_PATCH_GetSplitPointer
37D6 EE11 F021 00104         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_SPLIT_LOWER
37DA B0E8      00105         btfsc   WREG, 0
37DC EE11 F022 00106         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_SPLIT_UPPER
               00107         
37E0 30E8      00108         rrf     WREG, W
37E2 0B01      00109         andlw   0x01
37E4 0D40      00110         mullw   TIA_Vx_RECORD_LEN
37E6 50F3      00111         movf    PRODL, W
37E8 26E1      00112         addwf   FSR1L, F
37EA 0012      00113         return
               00399 #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)
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 65


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00011 ;  Licensed for personal non-commercial use only.
               00012 ;  All other rights reserved.
               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 ;; --------------------------------------------------------------------------
37EC 00021 TIA_BANK_Write
37EC 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
37EE D87F      00024         rcall   TIA_BANK_GetBankStickAvailable
37F0 E00B      00025         bz      TIA_BANK_WriteInternal
37F2 5012      00026         movf    TIA_PRESET, W
37F4 E009      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 
37F6 00036 TIA_BANK_WriteBankStick                         ; BankStick write:
37F6 0E00      00037     movlw   0x00
37F8 0F00      00038     addlw   DEFAULT_BS_READONLY     ; exit if BS_READONLY
37FA E104      00039     bnz  TIA_BANK_WriteBankStick_NOk
37FC 00040 TIA_BANK_WriteBankStick_Ok    
37FC D859      00041         rcall   TIA_BANK_SetBankStickAddress
37FE 5005      00042         movf    MIOS_PARAMETER3, W              ; get byte from temp. register
3800 ECBA F016 00043         call    MIOS_BANKSTICK_Write    ; write content
               00044         ;; here we could add an error exception handler
3804 00045 TIA_BANK_WriteBankStick_NOk
3804 2AA9      00046         incf    EEADR, F                ; increment EEPROM address
               00047         rgoto   TIA_BANK_Write_End
3806 D00F          M         bra     label
               00048 
3808 00049 TIA_BANK_WriteInternal
3808 0E00      00050     movlw   0x00
380A 0F00      00051     addlw   DEFAULT_EE_READONLY     ; exit if EE_READONLY
380C E009      00052     bz      TIA_BANK_WriteInternal_Ok
380E 2AA9      00053         incf    EEADR, F                ; increment EEADR
               00054         rgoto   TIA_BANK_Write_End              ; and goto end
3810 D00A          M         bra     label
               00055         ;; don't write if address in range between 0x7c and 0x7f (used to save channel and device number)
               00056         BRA_IFSET EEADR, 7, ACCESS, TIA_BANK_WriteInternal_Ok
3812 BEA9          M         btfsc   reg, bit, reg_a
3814 D005          M         bra     label
3816 0E7B      00057         movlw   0x7c-1
3818 64A9      00058         cpfsgt  EEADR, ACCESS
               00059         rgoto   TIA_BANK_WriteInternal_Ok
381A D002          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 66


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
381C 2AA9      00060         incf    EEADR, F                ; increment EEADR
               00061         rgoto   TIA_BANK_Write_End              ; and goto end
381E D003          M         bra     label
3820 00062 TIA_BANK_WriteInternal_Ok
3820 5005      00063         movf    MIOS_PARAMETER3, W              ; get byte from temp. register
3822 ECB2 F016 00064         call    MIOS_EEPROM_Write               ; write to EEPROM
               00065         ;; here we could add an error exception handler
3826 00066 TIA_BANK_Write_End
               00067         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
3826 0101          M         movlb   HIGH(reg)
3828 0012      00068         return
               00069 
               00070 ;; --------------------------------------------------------------------------
               00071 ;;  Writes a page of 64 bytes to EEPROM or BankStick
               00072 ;;  IN: Value in FSR1 buffer, address offset in EEADR
               00073 ;;  OUT: increments address
               00074 ;; --------------------------------------------------------------------------
382A 00075 TIA_BANK_WritePage
               00076 
               00077         ;; align EEADR if necessary
382A 0EC0      00078         movlw   0xc0
382C 16A9      00079         andwf   EEADR, F
               00080 
               00081         ;; branch to internal patch if bankstick is not available or Patch is 0
382E 5012      00082         movf    TIA_PRESET, W
3830 E00F      00083         bz      TIA_BANK_WritePageInternal
               00084 
3832 00085 TIA_BANK_WritePageBankStick                     ; BankStick write:
3832 0E00      00086     movlw   0x00
3834 0F00      00087     addlw   DEFAULT_BS_READONLY     ; exit if BS_READONLY
3836 E003      00088     bz      TIA_BANK_WritePageBankStick_Ok
3838 00089 TIA_BANK_WritePageBankStick_ReadOnly
               00090     ;;  BS Read Only Error #0x02
3838 0E02      00091     movlw   0x02
383A 6E26      00092     movwf   TIA_SYSEX_ERROR
               00093     rgoto TIA_BANK_WritePageBankStick_End
383C D006          M         bra     label
               00094    
383E 00095 TIA_BANK_WritePageBankStick_Ok    
383E D838      00096         rcall   TIA_BANK_SetBankStickAddress
               00097         ;; buffer already prepared in FSR1
3840 ECF2 F016 00098         call    MIOS_BANKSTICK_WritePage        ; write page
               00099         ;; here we could add an error exception handler
3844 E002      00100     bz      TIA_BANK_WritePageBankStick_End
               00101     ;;  BS WritePage Error #0x07
3846 0E07      00102     movlw   0x07
3848 6E26      00103     movwf   TIA_SYSEX_ERROR
384A 00104 TIA_BANK_WritePageBankStick_End
384A 0E40      00105         movlw   0x40                            ; increment EEPROM address by 0x40
384C 26A9      00106         addwf   EEADR, F
               00107         rgoto   TIA_BANK_WritePage_End
384E D018          M         bra     label
               00108 
3850 00109 TIA_BANK_WritePageInternal
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 67


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3850 6A12      00110     clrf    TIA_PRESET
3852 0E00      00111     movlw   0x00
3854 0F00      00112     addlw   DEFAULT_EE_READONLY     ; exit if EE_READONLY
3856 E005      00113     bz      TIA_BANK_WritePageInternalLoop
               00114     ;; Internal EE Readonly Error #1
3858 0E01      00115     movlw   0x01
385A 6E26      00116     movwf   TIA_SYSEX_ERROR
385C 0E40      00117     movlw   0x40
385E 26A9      00118         addwf   EEADR, F                        ; increment EEADR
               00119         rgoto   TIA_BANK_WritePage_End          ; and goto next
3860 D00F          M         bra     label
               00120         ;; write 64 bytes
3862 00121 TIA_BANK_WritePageInternalLoop
               00122         ;; don't write if address in range between 0x7c and 0x7f (used to save channel and device number)
               00123         BRA_IFSET EEADR, 7, ACCESS, TIA_BANK_WritePageInternal_Ok
3862 BEA9          M         btfsc   reg, bit, reg_a
3864 D005          M         bra     label
3866 0E7B      00124         movlw   0x7c-1
3868 64A9      00125         cpfsgt  EEADR, ACCESS
               00126         rgoto   TIA_BANK_WritePageInternal_Ok
386A D002          M         bra     label
386C 2AA9      00127         incf    EEADR, F                        ; increment EEADR
               00128         rgoto   TIA_BANK_WritePage_Next         ; and goto next
386E D005          M         bra     label
3870 00129 TIA_BANK_WritePageInternal_Ok
3870 50A9      00130         movf    EEADR, W
3872 0B3F      00131         andlw   0x3f
3874 50E3      00132         movf    PLUSW1, W                       ; get byte from buffer
3876 ECB2 F016 00133         call    MIOS_EEPROM_Write               ; write to EEPROM
               00134         ;; here we could add an error exception handler
387A 00135 TIA_BANK_WritePage_Next
387A 50A9      00136         movf    EEADR, W
387C 0B3F      00137         andlw   0x3f
387E E1F1      00138         bnz     TIA_BANK_WritePageInternalLoop
               00139 
3880 00140 TIA_BANK_WritePage_End
               00141         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
3880 0101          M         movlb   HIGH(reg)
3882 0012      00142         return
               00143 
               00144     
               00145 ;; --------------------------------------------------------------------------
               00146 ;;  Read data from EEPROM or BankStick
               00147 ;;  IN: address offset in EEADR,
               00148 ;;      internal perset in EEADRH, 
               00149 ;;      Patch number in MIOS_PARAMETER2,
               00150 ;;      Bank number in TIA_BANK.
               00151 ;;  OUT: 7-bit result in WREG, increments address
               00152 ;; --------------------------------------------------------------------------
               00153 
3884 00154 TIA_BANK_Read
               00155         ;; branch to internal patch if bankstick is not available or Patch is 0    
3884 5011      00156     movf    TIA_BANK, W
3886 D82B      00157     rcall   TIA_BANK_GetBankStickReady
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 68


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3888 E00B      00158         bz      TIA_BANK_ReadInternal
388A 5012      00159         movf    TIA_PRESET, W
388C E009      00160         bz      TIA_BANK_ReadInternal
               00161      
388E D834      00162     rcall   TIA_BANK_GetBankStickSize
3890 E102      00163     bnz     TIA_BANK_ReadBankStick
               00164 
3892 BC12      00165     btfsc       TIA_PRESET, 6
               00166     rgoto   TIA_BANK_Read_End    
3894 D008          M         bra     label
               00167 
3896 00168 TIA_BANK_ReadBankStick                          ; BankStick read:
3896 D80C      00169         rcall   TIA_BANK_SetBankStickAddress
3898 ECB8 F016 00170         call    MIOS_BANKSTICK_Read             ; read content
389C 2AA9      00171         incf    EEADR, F                        ; increment EEPROM address
               00172         rgoto   TIA_BANK_Read_End
389E D003          M         bra     label
               00173         
38A0 00174 TIA_BANK_ReadInternal
38A0 6A12      00175         clrf    TIA_PRESET
38A2 ECB0 F016 00176         call    MIOS_EEPROM_Read
               00177 
38A6 00178 TIA_BANK_Read_End
               00179         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
38A6 0101          M         movlb   HIGH(reg)
38A8 0012      00180         return
               00181 
               00182 
               00183 ;; --------------------------------------------------------------------------
               00184 ;;  This function sets a BankStick address
               00185 ;;  IN: patch offset in EEADR
               00186 ;;      patch number in MIOS_PARAMETER2
               00187 ;;      BankStick number in TIA_BANK
               00188 ;;  OUT: address in MIOS_PARAMETER[12]
               00189 ;;       BankStick selected via MIOS_BANKSTICK_CtrlSet
               00190 ;; --------------------------------------------------------------------------
38AA 00191 TIA_BANK_SetBankStickAddressMagic
38AA 6A03      00192     clrf    MIOS_PARAMETER1
38AC 6A04      00193     clrf    MIOS_PARAMETER2
               00194     rgoto TIA_BANK_SetBankStickAddress_Cont
38AE D006          M         bra     label
               00195 
38B0 00196 TIA_BANK_SetBankStickAddress
               00197 
38B0 CFA9 F003 00198         movff   EEADR, MIOS_PARAMETER1          ; copy address to low-byte
38B4 B012      00199     btfsc       TIA_PRESET, 0
38B6 8E03      00200         bsf     MIOS_PARAMETER1, 7              ; select upper address range on odd bank number
38B8 4012      00201     rrncf   TIA_PRESET, W      ; high-byte
38BA 6E04      00202     movwf   MIOS_PARAMETER2
               00203 
38BC 00204 TIA_BANK_SetBankStickAddress_Cont
38BC 501A      00205         movf    TIA_BANKSTICK_ID, W
38BE ECEE F016 00206         call    MIOS_BANKSTICK_CtrlSet
               00207         
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 69


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
38C2 D81A      00208     rcall   TIA_BANK_GetBankStickSize
38C4 B4D8      00209         skpnz
               00210     rgoto   TIA_BANK_SetBankStickAddress_32k
38C6 D005          M         bra     label
               00211     
38C8 00212 TIA_BANK_SetBankStickAddress_64k
38C8 B011      00213         btfsc   TIA_BANK, 0
38CA 8C04      00214         bsf     MIOS_PARAMETER2, 6
38CC B211      00215     btfsc       TIA_BANK, 1
38CE 8E04      00216         bsf     MIOS_PARAMETER2, 7
               00217     rgoto   TIA_BANK_SetBankStickAddress_End
38D0 D005          M         bra     label
               00218     
38D2 00219 TIA_BANK_SetBankStickAddress_32k
38D2 9A04      00220     bcf MIOS_PARAMETER2, 5
38D4 B011      00221         btfsc   TIA_BANK, 0
38D6 8A04      00222         bsf     MIOS_PARAMETER2, 5
38D8 B211      00223     btfsc       TIA_BANK, 1
38DA 8C04      00224         bsf     MIOS_PARAMETER2, 6
               00225 
38DC 00226 TIA_BANK_SetBankStickAddress_End
38DC 0012      00227     return
               00228     
               00229 
               00230 ;; --------------------------------------------------------------------------
               00231 ;;  This function returns the bankstick available status for the current bank
               00232 ;;  IN: Bank number WREG
               00233 ;;  OUT: WREG != 0 when bankstick available
               00234 ;; --------------------------------------------------------------------------
38DE 00235 TIA_BANK_GetBankStickReady
38DE 40E8      00236     rrncf   WREG, W
38E0 40E8      00237     rrncf   WREG, W
38E2 0B07      00238     andlw   0x07
38E4 6E1A      00239     movwf       TIA_BANKSTICK_ID
38E6 ECC6 F016 00240         call    MIOS_HLP_GetBitORMask
38EA 141B      00241         andwf   TIA_BANKSTICK_RDY, W
38EC 0012      00242         return
               00243     
               00244 ;; --------------------------------------------------------------------------
               00245 ;;  This function returns the bankstick available status for the current bank
               00246 ;;  IN: BankStick number in TIA_PBANK
               00247 ;;  OUT: WREG != 0 when bankstick available
               00248 ;; --------------------------------------------------------------------------
38EE 00249 TIA_BANK_GetBankStickAvailable
38EE 501A      00250     movf        TIA_BANKSTICK_ID, W
38F0 ECC6 F016 00251         call    MIOS_HLP_GetBitORMask
38F4 141C      00252         andwf   TIA_BANKSTICK_STAT, W
38F6 0012      00253         return
               00254 ;; --------------------------------------------------------------------------
               00255 ;;  This function returns the bankstick available status for the current bank
               00256 ;;  IN: BankStick number in TIA_BANKSTICK_ID
               00257 ;;  OUT: BankStick size in WREG and TIA_BANKSTICK_SIZE
               00258 ;; --------------------------------------------------------------------------
38F8 00259 TIA_BANK_GetBankStickSize
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 70


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
38F8 501A      00260     movf        TIA_BANKSTICK_ID, W
38FA ECC6 F016 00261         call    MIOS_HLP_GetBitORMask
38FE 141D      00262         andwf   TIA_BANKSTICK_SIZE, W
3900 0012      00263         return
               00264     
               00265 
               00266 
               00267 ;; --------------------------------------------------------------------------
               00268 ;; selects address of magic number depending on TIA_BANKSTICK_CHK_CTR
               00269 ;; TIA_BANKSTICK_CHK_CTR or TIA_PBANK
               00270 ;; --------------------------------------------------------------------------
3902 00271 TIA_BANK_CheckStick_SelectMagic
               00272         ;; select BankStick depending on TIA_BANKSTICK_CHK_CTR
3902 6E05      00273     movwf   MIOS_PARAMETER3
3904 40E8      00274     rrncf   WREG, W
3906 40E8      00275     rrncf   WREG, W
3908 0B07      00276     andlw   0x07
390A 0F80      00277     addlw   0x80        ; (Enable verify slower write accesses)
390C ECEE F016 00278         call    MIOS_BANKSTICK_CtrlSet
               00279 
               00280         ;; determine if this is a 64k BankStick:
               00281         ;; read from address 0x8000, store value in PRODL
3910 0E0F      00282         movlw   0x0f ;; between 0x03 - 0x7f
3912 6E03      00283         movwf   MIOS_PARAMETER1
3914 0E80      00284         movlw   0x80
3916 6E04      00285         movwf   MIOS_PARAMETER2
3918 ECB8 F016 00286         call    MIOS_BANKSTICK_Read
391C 6EF3      00287         movwf   PRODL
               00288 
               00289         ;; add 0x42 and write number to 0x0000
391E 0E0F      00290         movlw   0x0f ;; between 0x03 - 0x7f
3920 6E03      00291         movwf   MIOS_PARAMETER1
3922 6A04      00292         clrf    MIOS_PARAMETER2
3924 50F3      00293     movf    PRODL, W
3926 0F42      00294         addlw   0x42
3928 ECBA F016 00295         call    MIOS_BANKSTICK_Write
               00296 
               00297         ;; read again number from 0x8000, check if we still see the old value
392C 0E0F      00298         movlw   0x0f ;; between 0x03 - 0x7f
392E 6E03      00299         movwf   MIOS_PARAMETER1
3930 0E80      00300         movlw   0x80
3932 6E04      00301         movwf   MIOS_PARAMETER2
3934 ECB8 F016 00302         call    MIOS_BANKSTICK_Read
3938 18F3      00303         xorwf   PRODL, W
393A E107      00304     bnz     TIA_BANK_CheckStick_SelectMagic_32k
393C 00305 TIA_BANK_CheckStick_SelectMagic_64k     ; (64k device)
               00306         ;; try to read from BankStick (address 0x0000, 0x4000, 0x8000 or 0xc000)
393C 6A03      00307         clrf    MIOS_PARAMETER1
393E 6A04      00308         clrf    MIOS_PARAMETER2
3940 B005      00309         btfsc   MIOS_PARAMETER3, 0
3942 8C04      00310         bsf     MIOS_PARAMETER2, 6
3944 B205      00311     btfsc       MIOS_PARAMETER3, 1
3946 8E04      00312         bsf     MIOS_PARAMETER2, 7
               00313     rgoto   TIA_BANK_CheckStick_SelectMagic_End
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 71


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3948 D006          M         bra     label
               00314     
394A 00315 TIA_BANK_CheckStick_SelectMagic_32k     ; (32k device)
               00316         ;; try to read from BankStick (address 0x0000, 0x2000, 0x4000 or 0x0600)
394A 6A03      00317         clrf    MIOS_PARAMETER1
394C 6A04      00318         clrf    MIOS_PARAMETER2
394E B005      00319         btfsc   MIOS_PARAMETER3, 0
3950 8A04      00320         bsf     MIOS_PARAMETER2, 5
3952 B205      00321     btfsc       MIOS_PARAMETER3, 1
3954 8C04      00322         bsf     MIOS_PARAMETER2, 6
               00323     ;; rgoto   TIA_BANK_CheckStick_SelectMagic_End
3956 00324 TIA_BANK_CheckStick_SelectMagic_End
3956 0012      00325         return
               00326 
               00327 
               00328 
               00329 
               00330 
               00331 ;; --------------------------------------------------------------------------
               00332 ;;  Check Stick: try to read from BankStick, clear the appr. flag in
               00333 ;;  TIA_BANKSTICK_STAT if BankStick not available
               00334 ;; --------------------------------------------------------------------------
3958 00335 TIA_BANK_CheckStick
               00336 
               00337         ;; increment check counter, wrap at 32
3958 2819      00338         incf    TIA_BANKSTICK_CHK_CTR, W
395A 0B1F      00339         andlw   0x1f
395C 6E19      00340         movwf   TIA_BANKSTICK_CHK_CTR
               00341     
395E 90D8      00342     clrc
3960 4019      00343         rrncf   TIA_BANKSTICK_CHK_CTR, W
3962 40E8      00344     rrncf   WREG, W
3964 0B07      00345     andlw   0x07
3966 6E1A      00346     movwf   TIA_BANKSTICK_ID
               00347     
               00348         ;; select "magic number" and try to read from BankStick
3968 5019      00349     movf    TIA_BANKSTICK_CHK_CTR, W
396A DFCB      00350         rcall   TIA_BANK_CheckStick_SelectMagic
396C ECB8 F016 00351         call    MIOS_BANKSTICK_Read
               00352         ;; this sets the MIOS_BOX_STAT_BS_AVAILABLE flag
               00353 
               00354         ;; save old BankStick status in TMP1
3970 C01C F006 00355         movff   TIA_BANKSTICK_STAT, TMP1
               00356 
               00357         ;; modify the available flag of current bankstick
               00358         BRA_IFSET MIOS_BOX_STAT, MIOS_BOX_STAT_BS_AVAILABLE, ACCESS, TIA_BANK_CheckStick_AccPassed
3974 B002          M         btfsc   reg, bit, reg_a
3976 D005          M         bra     label
3978 00359 TIA_BANK_CheckStick_AccFailed
3978 501A      00360         movf    TIA_BANKSTICK_ID, W
397A ECC4 F016 00361         call    MIOS_HLP_GetBitANDMask
397E 141C      00362         andwf   TIA_BANKSTICK_STAT, W
               00363         rgoto   TIA_BANK_CheckStick_AccCont
3980 D004          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 72


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3982 00364 TIA_BANK_CheckStick_AccPassed
3982 501A      00365         movf    TIA_BANKSTICK_ID, W
3984 ECC6 F016 00366         call    MIOS_HLP_GetBitORMask
3988 101C      00367         iorwf   TIA_BANKSTICK_STAT, W
398A 00368 TIA_BANK_CheckStick_AccCont
398A 6E07      00369     movwf   TMP2
               00370 
               00371         ;; check if flag has been changed
398C 5007      00372         movf    TMP2, W
398E 1806      00373         xorwf   TMP1, W
3990 E008      00374     bz  TIA_BANK_CheckStick_End
3992 8010      00375     bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE, ACCESS
               00376 
               00377     ;; flag changed - branch depending on available status
3994 501A      00378         movf    TIA_BANKSTICK_ID, W
3996 ECC6 F016 00379         call    MIOS_HLP_GetBitORMask
399A 1407      00380         andwf   TMP2, W
399C E14A      00381         bnz     TIA_BANK_CheckStick_Ext
               00382     rgoto TIA_BANK_CheckStick_Int
399E D002          M         bra     label
39A0 9010      00383     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
39A2 00384 TIA_BANK_CheckStick_End    
39A2 0012      00385     return
               00386 
               00387 
               00388 
               00389 
               00390         ;; ------------------------------------------------------------------
               00391         ;; --> Internal Patch
39A4 00392 TIA_BANK_CheckStick_Int
               00393 
               00394     ;; reset size
39A4 5007      00395     movf        TMP2, W
39A6 161D      00396         andwf   TIA_BANKSTICK_SIZE, F
               00397 
39A8 00398 TIA_BANK_CheckStick_Int_StatOk
39A8 C007 F01C 00399     movff   TMP2, TIA_BANKSTICK_STAT
39AC EC85 F01B 00400     call    TIA_LEDMTR_PlayOtoR         ;; play mled orange to red pattern 
39B0 ECB8 F01E 00401     call        TIA_TUNE_PlayDisconnect     ;; play tune 5    
39B4 EC9B F01B 00402     call    TIA_LEDMTR_Player_Off
               00403     
               00404         ;; branch depending on patch/kit BankStick
               00405 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
39B8 0E04      00406         movlw   DEFAULT_BS_KBANK_ID-1
39BA 641A      00407         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00408         rgoto   TIA_BANK_CheckStick_Int_P
39BC D026          M         bra     label
39BE B219      00409     btfsc   TIA_BANKSTICK_CHK_CTR, 1
               00410     rgoto       TIA_BANK_CheckStick_Int_WT
39C0 D012          M         bra     label
               00411     
39C2 00412 TIA_BANK_CheckStick_Int_K
39C2 501A      00413         movf    TIA_BANKSTICK_ID, W         ;; clear flag
39C4 ECC4 F016 00414         call    MIOS_HLP_GetBitANDMask
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 73


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
39C8 161B      00415         andwf   TIA_BANKSTICK_RDY, F   
39CA 0E05      00416     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
39CC 6E25      00417     movwf   TIA_SYSEX_ADDRESS
39CE ECBE F02B 00418         call    _TIA_SYSEX_End_CFG_Read 
39D2 5019      00419     movf    TIA_BANKSTICK_CHK_CTR, W
39D4 1816      00420     xorwf   TIA_KBANK, W
39D6 E12C      00421     bnz     TIA_BANK_CheckStick_Int_End
39D8 6A16      00422     clrf    TIA_KBANK                   ;; Reinit to...
39DA 6A15      00423     clrf    TIA_KIT
39DC 0E0F      00424     movlw   0x0f                        ;; send sysex CFG All
39DE 6E25      00425     movwf   TIA_SYSEX_ADDRESS
39E0 ECBE F02B 00426         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
               00427         rgoto   TIA_BANK_CheckStick_Int_End 
39E4 D025          M         bra     label
               00428     
39E6 00429 TIA_BANK_CheckStick_Int_WT
39E6 501A      00430         movf    TIA_BANKSTICK_ID, W         ;; clear flag
39E8 ECC4 F016 00431         call    MIOS_HLP_GetBitANDMask
39EC 161B      00432         andwf   TIA_BANKSTICK_RDY, F   
39EE 0E05      00433     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
39F0 6E25      00434     movwf   TIA_SYSEX_ADDRESS
39F2 ECBE F02B 00435         call    _TIA_SYSEX_End_CFG_Read 
39F6 5019      00436     movf    TIA_BANKSTICK_CHK_CTR, W
39F8 1818      00437     xorwf   TIA_WBANK, W
39FA E11A      00438     bnz     TIA_BANK_CheckStick_Int_End
39FC 6A18      00439     clrf    TIA_WBANK                   ;; Reinit to...
39FE 6A17      00440     clrf    TIA_WT
3A00 0E0F      00441     movlw   0x0f                        ;; send sysex CFG All
3A02 6E25      00442     movwf   TIA_SYSEX_ADDRESS
3A04 ECBE F02B 00443         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
               00444         rgoto   TIA_BANK_CheckStick_Int_End 
3A08 D013          M         bra     label
               00445 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00446 
3A0A 00447 TIA_BANK_CheckStick_Int_P
3A0A 501A      00448         movf    TIA_BANKSTICK_ID, W         ;; clear flag
3A0C ECC4 F016 00449         call    MIOS_HLP_GetBitANDMask
3A10 161B      00450         andwf   TIA_BANKSTICK_RDY, F   
3A12 0E05      00451     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
3A14 6E25      00452     movwf   TIA_SYSEX_ADDRESS
3A16 ECBE F02B 00453         call    _TIA_SYSEX_End_CFG_Read 
3A1A 5019      00454     movf    TIA_BANKSTICK_CHK_CTR, W
3A1C 1814      00455     xorwf   TIA_PBANK, W
3A1E E108      00456     bnz     TIA_BANK_CheckStick_Int_End
3A20 6A14      00457     clrf    TIA_PBANK                   ;; Reinit to...
3A22 6A13      00458     clrf    TIA_PATCH
3A24 0E0F      00459     movlw   0x0f                        ;; send sysex CFG All
3A26 6E25      00460     movwf   TIA_SYSEX_ADDRESS
3A28 ECBE F02B 00461         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
3A2C ECAC F01B 00462         call    TIA_PATCH_Init
               00463         ;;rgoto TIA_BANK_CheckStick_Int_End 
               00464     
3A30 00465 TIA_BANK_CheckStick_Int_End    
3A30 0012      00466         return
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 74


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00467 
               00468 
               00469         ;; ------------------------------------------------------------------
               00470         ;; --> External Patch
3A32 00471 TIA_BANK_CheckStick_Ext
               00472         ;;      TABLE_ADDR TEXT_EXTBANK_0               ; print message
               00473         ;;      call    MIOS_LCD_PrintMessage
               00474         ;;      call    MIOS_LCD_PrintMessage
               00475 
               00476         ;; new setup will be reloaded automatically
               00477         ;; set reinit counter - CS configuration will be restored after one second
               00478         ;movlw  10
               00479         ;movwf  CS_MENU_REINIT_CFG_CTR
               00480 
               00481         ;; now check if the magic numbers exist in bankstick bank - if not, format bank automatically
3A32 0E32      00482         movlw   50                              ; wait some ms to get a stable status
3A34 ECCE F016 00483         call    MIOS_Delay                      
               00484 
3A38 5019      00485     movf    TIA_BANKSTICK_CHK_CTR, W
3A3A DF63      00486         rcall   TIA_BANK_CheckStick_SelectMagic
3A3C ECB8 F016 00487         call    MIOS_BANKSTICK_Read
3A40 0A77      00488         xorlw   BANKSTICK_MAGIC0                ; branch to unformatted message if number not equal
3A42 A4D8      00489     skpz
               00490         rgoto   TIA_BANK_CheckStick_Unformatted
3A44 D064          M         bra     label
               00491     
               00492     ;; magic numbers are different between Patch/Kit-WT bankstick
               00493 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
3A46 0E04      00494         movlw   DEFAULT_BS_KBANK_ID-1
3A48 641A      00495         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00496         rgoto   TIA_BANK_CheckStick_Ext_P
3A4A D011          M         bra     label
               00497 
               00498 ;; Kit / Wavetable
3A4C 00499 TIA_BANK_CheckStick_Ext_K 
               00500     ;; Magic ( Kit suite)
               00501     ;; set bankstick type depending on second byte (BANKSTICK_MAGICK/P)
3A4C ECB8 F016 00502         call    MIOS_BANKSTICK_Read 
3A50 6E06      00503     movwf   TMP1
3A52 0A13      00504         xorlw   BANKSTICK_MAGICK
3A54 E009      00505         bz      TIA_BANK_CheckStrick_Ext_Type_K
3A56 00506 TIA_BANK_CheckStrick_Ext_Type_NotK
3A56 5006      00507     movf    TMP1, W
3A58 0A12      00508     xorlw       BANKSTICK_MAGICP
3A5A A4D8      00509     skpz
               00510     rgoto       TIA_BANK_CheckStick_Unformatted             ;; format
3A5C D058          M         bra     label
3A5E 0E01      00511     movlw   DEFAULT_BS_FPROTECT          ;; type format protection
3A60 0A01      00512     xorlw   0x01
3A62 B4D8      00513     skpnz
               00514     rgoto   TIA_BANK_CheckStick_Unformatted_TProtect    ;; exit
3A64 D060          M         bra     label
               00515     rgoto   TIA_BANK_CheckStick_Unformatted             ;; format
3A66 D053          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 75


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3A68 00516 TIA_BANK_CheckStrick_Ext_Type_K
3A68 0E13      00517     movlw   BANKSTICK_MAGICK            ;; valid type
3A6A 6E06      00518     movwf   TMP1
               00519         rgoto   TIA_BANK_CheckStick_Ext_Size
3A6C D010          M         bra     label
               00520 #endif      ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00521 
               00522 ;; Patch
3A6E 00523 TIA_BANK_CheckStick_Ext_P 
               00524     ;; Magic (Patch suite)
               00525     ;; set bankstick type depending on second byte (BANKSTICK_MAGICK/P)
3A6E ECB8 F016 00526         call    MIOS_BANKSTICK_Read 
3A72 6E06      00527     movwf   TMP1
3A74 0A12      00528         xorlw   BANKSTICK_MAGICP
3A76 E009      00529         bz      TIA_BANK_CheckStrick_Ext_Type_P
3A78 00530 TIA_BANK_CheckStrick_Ext_Type_NotP
3A78 5006      00531     movf    TMP1, W
3A7A 0A13      00532     xorlw       BANKSTICK_MAGICK            
3A7C A4D8      00533     skpz
               00534     rgoto       TIA_BANK_CheckStick_Unformatted             ;; format
3A7E D047          M         bra     label
3A80 0E01      00535     movlw   DEFAULT_BS_FPROTECT          ;; type format protection
3A82 0A01      00536     xorlw   0x01
3A84 B4D8      00537     skpnz
               00538     rgoto   TIA_BANK_CheckStick_Unformatted_TProtect    ;; exit
3A86 D04F          M         bra     label
               00539     rgoto   TIA_BANK_CheckStick_Unformatted             ;; format
3A88 D042          M         bra     label
3A8A 00540 TIA_BANK_CheckStrick_Ext_Type_P         ;; valid type
3A8A 0E12      00541     movlw   BANKSTICK_MAGICP
3A8C 6E06      00542     movwf   TMP1
               00543         ;;rgoto TIA_BANK_CheckStick_Ext_Size
               00544 
3A8E 00545 TIA_BANK_CheckStick_Ext_Size
               00546     ;; set bankstick size depending on third byte (32=32k, 64=64k)
3A8E 501A      00547         movf    TIA_BANKSTICK_ID, W
3A90 ECC4 F016 00548         call    MIOS_HLP_GetBitANDMask
3A94 161D      00549         andwf   TIA_BANKSTICK_SIZE, F       ;; clear size
3A96 ECB8 F016 00550         call    MIOS_BANKSTICK_Read
3A9A 0A40      00551         xorlw   64
3A9C E104      00552         bnz     TIA_BANK_CheckStrick_Ext_Not64k
3A9E 00553 TIA_BANK_CheckStrick_Ext_64k
3A9E 501A      00554         movf    TIA_BANKSTICK_ID, W
3AA0 ECC6 F016 00555         call    MIOS_HLP_GetBitORMask
3AA4 121D      00556         iorwf   TIA_BANKSTICK_SIZE, F       ;; set size
3AA6 00557 TIA_BANK_CheckStrick_Ext_Not64k
               00558 
3AA6 00559 TIA_BANK_CheckStick_Ext_Fix ; to do if necessary...
               00560         ;; fix patches if required (and enabled via ENABLE_PATCH_FIXING)
               00561     ;movff      TIA_BANKSTICK_CHK_CTR, TIA_PBANK
               00562         ;rcall  TIA_BANK_FixPatches
               00563         ;; ok
               00564     
3AA6 00565 TIA_BANK_CheckStick_Ext_Stat
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 76


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00566 
3AA6 5019      00567     movf    TIA_BANKSTICK_CHK_CTR, W
               00568     
3AA8 5019      00569     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 1st bank of current BS
3AAA 0B1C      00570     andlw   0x1c
3AAC DF2A      00571         rcall   TIA_BANK_CheckStick_SelectMagic
3AAE ECB8 F016 00572         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
3AB2 0A77      00573         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
3AB4 E12B      00574         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
3AB6 ECB8 F016 00575         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
3ABA 1806      00576         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
3ABC E127      00577         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00578 
3ABE 5019      00579     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 2nd bank of current BS
3AC0 0B1C      00580     andlw   0x1c
3AC2 0F01      00581     addlw   0x01
3AC4 DF1E      00582         rcall   TIA_BANK_CheckStick_SelectMagic
3AC6 ECB8 F016 00583         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
3ACA 0A77      00584         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
3ACC E11F      00585         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
3ACE ECB8 F016 00586         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
3AD2 1806      00587         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
3AD4 E11B      00588         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00589     
3AD6 5019      00590     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 3rd bank of current BS
3AD8 0B1C      00591     andlw   0x1c
3ADA 0F02      00592     addlw   0x02
3ADC DF12      00593         rcall   TIA_BANK_CheckStick_SelectMagic
3ADE ECB8 F016 00594         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
3AE2 0A77      00595         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
3AE4 E113      00596         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
3AE6 ECB8 F016 00597         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
3AEA 1806      00598         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
3AEC E10F      00599         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00600     
3AEE 5019      00601     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 4th bank of current BS
3AF0 0B1C      00602     andlw   0x1c
3AF2 0F03      00603     addlw   0x03
3AF4 DF06      00604         rcall   TIA_BANK_CheckStick_SelectMagic
3AF6 ECB8 F016 00605         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
3AFA 0A77      00606         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
3AFC E107      00607         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
3AFE ECB8 F016 00608         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
3B02 1806      00609         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
3B04 E103      00610         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00611 
3B06 00612 TIA_BANK_CheckStick_Ext_Stat_Ok   
3B06 C007 F01C 00613     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00614     rgoto TIA_BANK_CheckStick_Ext_ReadySet
3B0A D02A          M         bra     label
3B0C 00615 TIA_BANK_CheckStick_Ext_Stat_NotOk      ;; status not ready
               00616     rgoto   TIA_BANK_CheckStick_Ext_End ;; end
3B0C D038          M         bra     label
               00617     
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 77


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3B0E 00618 TIA_BANK_CheckStick_Unformatted    
3B0E 0E01      00619     movlw   DEFAULT_BS_FPROTECT          ;; BS format inhibit
3B10 0A02      00620     xorlw   0x02
3B12 E006      00621     bz      TIA_BANK_CheckStick_Unformatted_FProtect 
               00622 
3B14 C019 F011 00623     movff   TIA_BANKSTICK_CHK_CTR, TIA_BANK
3B18 D854      00624         rcall   TIA_BANK_FormatStick            ;; --> format bankstick
3B1A C011 F019 00625     movff   TIA_BANK, TIA_BANKSTICK_CHK_CTR
               00626     rgoto       TIA_BANK_CheckStick_Ext_End ;; end
3B1E D02F          M         bra     label
               00627     
3B20 00628 TIA_BANK_CheckStick_Unformatted_FProtect
3B20 C007 F01C 00629     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00630     rgoto       TIA_BANK_CheckStick_Ext_ReadyClr
3B24 D003          M         bra     label
               00631 
3B26 00632 TIA_BANK_CheckStick_Unformatted_TProtect
3B26 C007 F01C 00633     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00634     rgoto       TIA_BANK_CheckStick_Ext_ReadyClr
3B2A D000          M         bra     label
               00635 
3B2C 00636 TIA_BANK_CheckStick_Ext_ReadyClr
3B2C 501A      00637         movf    TIA_BANKSTICK_ID, W         ;; clear flag
3B2E ECC4 F016 00638         call    MIOS_HLP_GetBitANDMask
3B32 161B      00639         andwf   TIA_BANKSTICK_RDY, F   
3B34 EC85 F01B 00640     call    TIA_LEDMTR_PlayOtoR         ;; play mled orange to red pattern 
3B38 ECE4 F01E 00641     call        TIA_TUNE_PlayWrong          ;; play wrong tune     
3B3C EC9B F01B 00642     call    TIA_LEDMTR_Player_Off
3B40 0E05      00643     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
3B42 6E25      00644     movwf   TIA_SYSEX_ADDRESS
3B44 ECBE F02B 00645         call    _TIA_SYSEX_End_CFG_Read 
3B48 5019      00646     movf    TIA_BANKSTICK_CHK_CTR, W
3B4A 1814      00647     xorwf   TIA_PBANK, W
3B4C E118      00648     bnz     TIA_BANK_CheckStick_Ext_End
3B4E 6A14      00649     clrf    TIA_PBANK                   ;; Reinit to...
3B50 6A12      00650     clrf    TIA_PRESET
3B52 0E0F      00651     movlw   0x0f                        ;; send sysex CFG All
3B54 6E25      00652     movwf   TIA_SYSEX_ADDRESS
3B56 ECBE F02B 00653         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
3B5A 9010      00654     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
3B5C EFAC F01B 00655         goto    TIA_PATCH_Init
               00656     ;;rgoto   TIA_BANK_CheckStick_Ext_End 
               00657     
3B60 00658 TIA_BANK_CheckStick_Ext_ReadySet 
3B60 501A      00659         movf    TIA_BANKSTICK_ID, W         ;; set flag
3B62 ECC6 F016 00660         call    MIOS_HLP_GetBitORMask
3B66 121B      00661         iorwf   TIA_BANKSTICK_RDY, F
3B68 EC79 F01B 00662     call    TIA_LEDMTR_PlayOtoG         ;; play mled orange to green pattern 
3B6C ECCE F01E 00663     call        TIA_TUNE_PlayOk             ;; play ready tune    
3B70 EC9B F01B 00664     call    TIA_LEDMTR_Player_Off
3B74 0E05      00665     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
3B76 6E25      00666     movwf   TIA_SYSEX_ADDRESS
3B78 ECBE F02B 00667         call    _TIA_SYSEX_End_CFG_Read 
3B7C 9010      00668     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 78


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00669     ;;rgoto   TIA_BANK_CheckStick_Ext_End
               00670 
3B7E 00671 TIA_BANK_CheckStick_Ext_End
3B7E 0012      00672         return
               00673        
               00674     
               00675     
               00676 ;; --------------------------------------------------------------------------
               00677 ;;  Format Stick: copy the lead default patch into the currently selected BankStick Bank
               00678 ;;  IN: bank number in TIA_PBANK
               00679 ;; --------------------------------------------------------------------------
3B80 00680 TEXT_FORMATBANK_0 STRING 20, 0x00, "* Formatting xxk *  "
3B80 1400 202A     M         da      ((length) << 8) | (pos), str
     6F46 6D72 
     7461 6974 
     676E 7820 
     6B78 2A20 
     2020      
3B96 00681 TEXT_FORMATBANK_1 STRING 20, 0x40, "* Patch x  0     *  "
3B96 1440 202A     M         da      ((length) << 8) | (pos), str
     6150 6374 
     2068 2078 
     3020 2020 
     2020 2A20 
     2020      
3BAC 00682 TEXT_FORMATBANK_K STRING 20, 0x40, "* Ensemble 000   *  "
3BAC 1440 202A     M         da      ((length) << 8) | (pos), str
     6E45 6573 
     626D 656C 
     3020 3030 
     2020 2A20 
     2020      
               00683 
3BC2 00684 TIA_BANK_FormatStick
               00685         ;; select BankStick depending on TIA_BANKSTICK_CHK_CTR
3BC2 4011      00686     rrncf   TIA_BANK, W
3BC4 40E8      00687     rrncf   WREG, W
3BC6 0B07      00688     andlw   0x07
3BC8 6E1A      00689     movwf       TIA_BANKSTICK_ID
3BCA ECEE F016 00690         call    MIOS_BANKSTICK_CtrlSet
               00691     
3BCE EC61 F01B 00692     call    TIA_LEDMTR_PlayFormat_R
               00693 
               00694         ;; determine if this is a 64k BankStick:
               00695         ;; read from address 0x8000, store value in PRODL
3BD2 0E0F      00696         movlw   0x0f ;; between 0x03 - 0x7f
3BD4 6E03      00697         movwf   MIOS_PARAMETER1
3BD6 0E80      00698         movlw   0x80
3BD8 6E04      00699         movwf   MIOS_PARAMETER2
3BDA ECB8 F016 00700         call    MIOS_BANKSTICK_Read
3BDE 6EF3      00701         movwf   PRODL
               00702 
               00703         ;; add 0x42 and write number to 0x0000
3BE0 0E0F      00704         movlw   0x0f ;; between 0x03 - 0x7f
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 79


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3BE2 6E03      00705         movwf   MIOS_PARAMETER1
3BE4 6A04      00706         clrf    MIOS_PARAMETER2
3BE6 50F3      00707     movf    PRODL, W
3BE8 0F42      00708         addlw   0x42
3BEA ECBA F016 00709         call    MIOS_BANKSTICK_Write
3BEE A4D8      00710     skpz
               00711     rgoto   TIA_BANK_FormatStick_Err_Handler
3BF0 D0B5          M         bra     label
               00712 
               00713         ;; read again number from 0x8000, check if we still see the old value
3BF2 0E0F      00714         movlw   0x0f ;; between 0x03 - 0x7f
3BF4 6E03      00715         movwf   MIOS_PARAMETER1
3BF6 0E80      00716         movlw   0x80
3BF8 6E04      00717         movwf   MIOS_PARAMETER2
3BFA ECB8 F016 00718         call    MIOS_BANKSTICK_Read
3BFE 18F3      00719         xorwf   PRODL, W
3C00 E106      00720     bnz     TIA_BANK_FormatStick_32k
3C02 00721 TIA_BANK_FormatStick_64k
               00722         ;; set flag in size register
3C02 501A      00723         movf    TIA_BANKSTICK_ID, W
3C04 ECC6 F016 00724         call    MIOS_HLP_GetBitORMask
3C08 121D      00725         iorwf   TIA_BANKSTICK_SIZE, F
               00726         ;; write 64 to address 0x0002
3C0A 0E40      00727         movlw   64
               00728         rgoto   TIA_BANK_FormatStick_SizeIDCont
3C0C D005          M         bra     label
3C0E 00729 TIA_BANK_FormatStick_32k
               00730         ;; clear flag in size register
3C0E 501A      00731         movf    TIA_BANKSTICK_ID, W
3C10 ECC4 F016 00732         call    MIOS_HLP_GetBitANDMask
3C14 161D      00733         andwf   TIA_BANKSTICK_SIZE, F
               00734         ;; write 32 to address 0x0002
3C16 0E20      00735         movlw   32
               00736         ;;rgoto TIA_BANK_FormatStick_SizeIDCont
3C18 00737 TIA_BANK_FormatStick_SizeIDCont
3C18 6E06      00738         movwf   TMP1
3C1A 5019      00739     movf    TIA_BANKSTICK_CHK_CTR, W
3C1C DE72      00740         rcall   TIA_BANK_CheckStick_SelectMagic
3C1E 0E02      00741         movlw   0x02
3C20 6E03      00742         movwf   MIOS_PARAMETER1
3C22 5006      00743         movf    TMP1, W
3C24 ECBA F016 00744         call    MIOS_BANKSTICK_Write
3C28 A4D8      00745     skpz
               00746     rgoto   TIA_BANK_FormatStick_Err_Handler
3C2A D098          M         bra     label
               00747 
3C2C 0E32      00748         movlw   50                              ; wait some ms to get a stable status
3C2E ECCE F016 00749         call    MIOS_Delay                      
               00750 
               00751         ;; now branch depending on Ensemble/Patch
               00752 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
3C32 0E04      00753         movlw   DEFAULT_BS_KBANK_ID-1
3C34 641A      00754         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00755         rgoto   TIA_BANK_FormatStick_P
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 80


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3C36 D022          M         bra     label
3C38 B211      00756     btfsc   TIA_BANK, 1
               00757     rgoto       TIA_BANK_FormatStick_WT
3C3A D010          M         bra     label
               00758     
3C3C 00759 TIA_BANK_FormatStick_K
               00760         ;; copy Patch 0 (internal kit) to upload buffer
3C3C 6AA9      00761         clrf    EEADR
3C3E 0E02      00762     movlw   (EEPROM_KIT >> 8) & 0xff
3C40 6EAA      00763     movwf   EEADRH
3C42 EE02 F000 00764         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
3C46 00765 TIA_BANK_FormatStick_K_CIntLoop
3C46 ECB0 F016 00766         call    MIOS_EEPROM_Read
3C4A 6EEE      00767         movwf   POSTINC0
3C4C AEA9      00768         btfss   EEADR, 7
               00769         rgoto   TIA_BANK_FormatStick_K_CIntLoop
3C4E D7FB          M         bra     label
               00770         ;; clear name
3C50 EE02 F000 00771         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
3C54 00772 TIA_BANK_FormatStick_K_ClearLoop
3C54 6AEE      00773         clrf    POSTINC0
               00774         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_K_ClearLoop
3C56 A8E9          M         btfss   reg, bit, reg_a
3C58 D7FD          M         bra     label
               00775     rgoto   TIA_BANK_FormatStick_Data    
3C5A D01F          M         bra     label
               00776     
3C5C 00777 TIA_BANK_FormatStick_WT
               00778         ;; copy Patch 0 (internal patch) to upload buffer
3C5C 6AA9      00779         clrf    EEADR
3C5E 0E01      00780     movlw   (EEPROM_WAVETABLE >> 8) & 0xff
3C60 6EAA      00781     movwf   EEADRH
3C62 EE02 F000 00782         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
3C66 00783 TIA_BANK_FormatStick_WT_CIntLoop
3C66 ECB0 F016 00784         call    MIOS_EEPROM_Read
3C6A 6EEE      00785         movwf   POSTINC0
3C6C AEA9      00786         btfss   EEADR, 7
               00787         rgoto   TIA_BANK_FormatStick_WT_CIntLoop
3C6E D7FB          M         bra     label
               00788         ;; clear name
3C70 EE02 F000 00789         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
3C74 00790 TIA_BANK_FormatStick_WT_ClearLoop
3C74 6AEE      00791         clrf    POSTINC0
               00792         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_WT_ClearLoop
3C76 A8E9          M         btfss   reg, bit, reg_a
3C78 D7FD          M         bra     label
               00793     rgoto   TIA_BANK_FormatStick_Data
3C7A D00F          M         bra     label
               00794 
               00795 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00796 
3C7C 00797 TIA_BANK_FormatStick_P
               00798         ;; copy Patch 0 (internal patch) to upload buffer
3C7C 6AA9      00799         clrf    EEADR
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 81


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3C7E 0E00      00800     movlw   (EEPROM_PATCH >> 8) & 0xff
3C80 6EAA      00801     movwf   EEADRH
3C82 EE02 F000 00802         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
3C86 00803 TIA_BANK_FormatStick_P_CIntLoop
3C86 ECB0 F016 00804         call    MIOS_EEPROM_Read
3C8A 6EEE      00805         movwf   POSTINC0
3C8C AEA9      00806         btfss   EEADR, 7
               00807         rgoto   TIA_BANK_FormatStick_P_CIntLoop
3C8E D7FB          M         bra     label
               00808         ;; clear name
3C90 EE02 F000 00809         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
3C94 00810 TIA_BANK_FormatStick_P_ClearLoop
3C94 6AEE      00811         clrf    POSTINC0
               00812         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_P_ClearLoop
3C96 A8E9          M         btfss   reg, bit, reg_a
3C98 D7FD          M         bra     label
               00813     ;;rgoto   TIA_BANK_FormatStick_Data
               00814 
               00815 
               00816 
               00817     
3C9A 00818 TIA_BANK_FormatStick_Data  
3C9A EC67 F01B 00819     call    TIA_LEDMTR_PlayFormat_O
               00820         ;; now format patch 1 to 127 (64k) or 63 (32k)
3C9E 0E01      00821         movlw   0x01
3CA0 6EA9      00822         movwf   EEADR   ; use EEADR as patch ctr
               00823     ;; Select BS Adress
3CA2 6A03      00824     clrf    MIOS_PARAMETER1
3CA4 B0A9      00825     btfsc       EEADR, 0
3CA6 8E03      00826         bsf     MIOS_PARAMETER1, 7              ; select upper address range on odd bank number
3CA8 30A9      00827     rrf     EEADR, W    
3CAA 6E04      00828         movwf   MIOS_PARAMETER2 ; copy patch to high-byte
3CAC DE25      00829     rcall   TIA_BANK_GetBankStickSize
3CAE B4D8      00830         skpnz
               00831     rgoto   TIA_BANK_FormatStick_Data_32k
3CB0 D005          M         bra     label
3CB2 00832 TIA_BANK_FormatStick_Data_64k
3CB2 B011      00833         btfsc   TIA_BANK, 0
3CB4 8C04      00834         bsf     MIOS_PARAMETER2, 6
3CB6 B211      00835     btfsc       TIA_BANK, 1
3CB8 8E04      00836         bsf     MIOS_PARAMETER2, 7
               00837     rgoto   TIA_BANK_FormatStick_Data_OuterLoop
3CBA D005          M         bra     label
3CBC 00838 TIA_BANK_FormatStick_Data_32k
3CBC 9A04      00839     bcf MIOS_PARAMETER2, 5
3CBE B011      00840         btfsc   TIA_BANK, 0
3CC0 8A04      00841         bsf     MIOS_PARAMETER2, 5
3CC2 B211      00842     btfsc       TIA_BANK, 1
3CC4 8C04      00843         bsf     MIOS_PARAMETER2, 6
               00844     
3CC6 00845 TIA_BANK_FormatStick_Data_OuterLoop
               00846         ;; copy 0x80 words
3CC6 EE12 F000 00847         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN 
3CCA 0004      00848         clrwdt                  ; feed watchdog
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 82


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00849         ;; buffer already prepared in FSR1
3CCC ECF2 F016 00850         call    MIOS_BANKSTICK_WritePage        ; write page
3CD0 A4D8      00851     skpz
               00852     rgoto   TIA_BANK_FormatStick_Err_Handler
3CD2 D044          M         bra     label
3CD4 0E40      00853         movlw   0x40                            ; increment FSR1 by 0x40
3CD6 26E1      00854         addwf   FSR1L, F
3CD8 0004      00855         clrwdt                  ; feed watchdog
3CDA ECF2 F016 00856         call    MIOS_BANKSTICK_WritePage        ; write page
3CDE A4D8      00857     skpz
               00858     rgoto   TIA_BANK_FormatStick_Err_Handler
3CE0 D03D          M         bra     label
               00859         ;; continue until last patch is reached
3CE2 2AA9      00860         incf    EEADR, F
3CE4 501A      00861         movf    TIA_BANKSTICK_ID, W
3CE6 ECC6 F016 00862         call    MIOS_HLP_GetBitORMask
3CEA 141D      00863         andwf   TIA_BANKSTICK_SIZE, W
3CEC 0E7F      00864         movlw   128-1
3CEE B4D8      00865         skpnz
3CF0 0E3F      00866         movlw   64-1
3CF2 64A9      00867         cpfsgt  EEADR, ACCESS
               00868         rgoto TIA_BANK_FormatStick_Data_OuterLoop
3CF4 D7E8          M         bra     label
3CF6 00869 TIA_BANK_FormatStick_Data_End
               00870      
3CF6 EC6D F01B 00871     call    TIA_LEDMTR_PlayFormat_G1
               00872     
               00873     ;; write bank new name
               00874     ;; add name offset to MP1 start @0x10
3CFA 0E10      00875     movlw   NEW_BANK_NAME & 0xff
3CFC 6EA9      00876         movwf   EEADR
3CFE 0E03      00877     movlw   (NEW_BANK_NAME >> 8) & 0xff
3D00 6EAA      00878     movwf   EEADRH 
3D02 5019      00879     movf    TIA_BANKSTICK_CHK_CTR, W
3D04 DDFE      00880         rcall   TIA_BANK_CheckStick_SelectMagic
3D06 0E10      00881     movlw   0x10
3D08 6E03      00882     movwf   MIOS_PARAMETER1
3D0A 00883 TIA_BANK_FormatStick_Name_Loop
3D0A ECB0 F016 00884     call    MIOS_EEPROM_Read
3D0E ECBA F016 00885     call    MIOS_BANKSTICK_Write
3D12 A4D8      00886     skpz
               00887     rgoto   TIA_BANK_FormatStick_Err_Handler
3D14 D023          M         bra     label
3D16 AA03      00888     btfss   MIOS_PARAMETER1, 5    ; until == 0x20
               00889     rgoto   TIA_BANK_FormatStick_Name_Loop
3D18 D7F8          M         bra     label
               00890        
               00891         ;;; write magic byte 0 to confirm valid content
3D1A 6A03      00892     clrf    MIOS_PARAMETER1
3D1C 0E77      00893         movlw   BANKSTICK_MAGIC0
3D1E ECBA F016 00894         call    MIOS_BANKSTICK_Write
3D22 A4D8      00895     skpz
               00896     rgoto   TIA_BANK_FormatStick_Err_Handler
3D24 D01B          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 83


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00897     
               00898 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00899     ;; now branch depending on Kit/Patch
3D26 0E04      00900         movlw   DEFAULT_BS_KBANK_ID-1
3D28 641A      00901         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00902         rgoto   TIA_BANK_FormatStick_P_Cont
3D2A D00E          M         bra     label
3D2C B211      00903     btfsc   TIA_BANK, 1
               00904     rgoto       TIA_BANK_FormatStick_WT_Cont
3D2E D006          M         bra     label
               00905     
3D30 00906 TIA_BANK_FormatStick_K_Cont
               00907         ;; select first external kit
               00908         ;movlw  1
               00909         ;movwf  TIA_KIT
               00910         ;; store number in EEPROM
               00911         ;call   TIA_KIT_StoreDefaultNum
               00912         ;; write magic byte K(kit/wavetable), valid content and type
3D30 0E13      00913         movlw   BANKSTICK_MAGICK
3D32 ECBA F016 00914         call    MIOS_BANKSTICK_Write
3D36 A4D8      00915     skpz
               00916     rgoto   TIA_BANK_FormatStick_Err_Handler
3D38 D011          M         bra     label
               00917     rgoto   TIA_BANK_FormatStick_Cont
3D3A D00B          M         bra     label
               00918 
3D3C 00919 TIA_BANK_FormatStick_WT_Cont 
               00920         ;; select first external wavetable
               00921         ;movlw  1
               00922         ;movwf  TIA_WT
               00923         ;; store number in EEPROM
               00924         ;call   TIA_KIT_StoreDefaultNum
               00925         ;; write magic byte K(kit/wavetable), valid content and type
3D3C 0E13      00926         movlw   BANKSTICK_MAGICK
3D3E ECBA F016 00927         call    MIOS_BANKSTICK_Write
3D42 A4D8      00928     skpz
               00929     rgoto   TIA_BANK_FormatStick_Err_Handler
3D44 D00B          M         bra     label
               00930     rgoto   TIA_BANK_FormatStick_Cont
3D46 D005          M         bra     label
               00931 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00932 
3D48 00933 TIA_BANK_FormatStick_P_Cont
               00934         ;; select first external patch
               00935         ;movlw  1
               00936         ;movwf  TIA_PRESET
               00937         ;; store number in EEPROM
               00938         ;call   TIA_KIT_StoreDefaultNum
               00939         ;; and branch to end
               00940     ;;rgoto    TIA_BANK_FormatStick_Cont
               00941         ;; write magic byte P(patch), valid content and type
3D48 0E12      00942         movlw   BANKSTICK_MAGICP
3D4A ECBA F016 00943         call    MIOS_BANKSTICK_Write
3D4E A4D8      00944     skpz
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 84


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00945     rgoto   TIA_BANK_FormatStick_Err_Handler
3D50 D005          M         bra     label
               00946     ;;rgoto   TIA_BANK_FormatStick_Cont
               00947 
3D52 00948 TIA_BANK_FormatStick_Cont
               00949         ;; play tune, new setup will be reloaded automatically
               00950         ;movf   TIA_PBANK, W
3D52 EC1E F01F 00951         call    TIA_TUNE_Play1
3D56 EC73 F01B 00952     call    TIA_LEDMTR_PlayFormat_G2
               00953     rgoto   TIA_BANK_CheckStick_End 
3D5A D623          M         bra     label
               00954 
               00955     
3D5C 00956 TIA_BANK_FormatStick_Err_Handler 
               00957     ;; realign on first bank of current BankStick
3D5C 5211      00958     movf    TIA_BANK, F
3D5E 0B1C      00959     andlw   0x1c
3D60 28E8      00960     incf    WREG, W    ;; next will be first
3D62 6E11      00961     movwf   TIA_BANK   
               00962     ;; reinit STAT registers
3D64 501A      00963     movf        TIA_BANKSTICK_ID, W
3D66 ECC4 F016 00964         call    MIOS_HLP_GetBitANDMask
3D6A 161C      00965         andwf   TIA_BANKSTICK_STAT, F
3D6C 161D      00966     andwf       TIA_BANKSTICK_SIZE, F
               00967 
3D6E 00968 TIA_BANK_FormatStickEnd
3D6E 0012      00969         return
               00970 
               00971 ;; --------------------------------------------------------------------------
               00972 
               00400 #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 ;; --------------------------------------------------------------------------
3D70 00017 TIA_TUNE_PlayDisconnect
3D70 0E0D      00018     movlw   0x0d
3D72 6E06      00019     movwf   TMP1
3D74 0E06      00020         movlw   0x06
3D76 D878      00021         rcall   TIA_TUNE_Note_Init
               00022 
3D78 0E0B      00023         movlw   0x0b
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 85


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3D7A D888      00024         rcall   TIA_TUNE_Note_On_Wait01
3D7C 0E01      00025         movlw   0x01
3D7E D886      00026         rcall   TIA_TUNE_Note_On_Wait01
3D80 0E01      00027         movlw   0x01
3D82 D887      00028         rcall   TIA_TUNE_Wait
3D84 0E18      00029         movlw   0x18
3D86 D882      00030         rcall   TIA_TUNE_Note_On_Wait01
3D88 0E10      00031         movlw   0x10
3D8A D880      00032         rcall   TIA_TUNE_Note_On_Wait01
3D8C 0E04      00033         movlw   0x04
3D8E D875      00034         rcall   TIA_TUNE_Note_On
3D90 0E02      00035         movlw   0x02
3D92 D87F      00036         rcall   TIA_TUNE_Wait
3D94 D876      00037         rcall   TIA_TUNE_Note_Off
3D96 0E02      00038         movlw   0x02
3D98 D87C      00039         rcall   TIA_TUNE_Wait
               00040 
               00041         rgoto   TIA_TUNE_End
3D9A D064          M         bra     label
               00042     
               00043 ;; --------------------------------------------------------------------------
               00044 ;;  TIA_PLAY Ok Tune
               00045 ;; --------------------------------------------------------------------------
3D9C 00046 TIA_TUNE_PlayOk
3D9C 0E0D      00047     movlw   0x0d
3D9E 6E06      00048     movwf   TMP1
3DA0 0E06      00049         movlw   0x06
3DA2 D862      00050         rcall   TIA_TUNE_Note_Init
               00051 
3DA4 0E0B      00052         movlw   0x0b
3DA6 D872      00053         rcall   TIA_TUNE_Note_On_Wait01
3DA8 0E04      00054         movlw   0x04
3DAA D870      00055         rcall   TIA_TUNE_Note_On_Wait01
3DAC 0E01      00056         movlw   0x01
3DAE D871      00057         rcall   TIA_TUNE_Wait
3DB0 0E18      00058         movlw   0x18
3DB2 D86C      00059         rcall   TIA_TUNE_Note_On_Wait01
3DB4 0E10      00060         movlw   0x10
3DB6 D86A      00061         rcall   TIA_TUNE_Note_On_Wait01
3DB8 0E01      00062         movlw   0x01
3DBA D85F      00063         rcall   TIA_TUNE_Note_On
3DBC 0E02      00064         movlw   0x02
3DBE D869      00065         rcall   TIA_TUNE_Wait
3DC0 D860      00066         rcall   TIA_TUNE_Note_Off
3DC2 0E02      00067         movlw   0x02
3DC4 D866      00068         rcall   TIA_TUNE_Wait
               00069 
               00070         rgoto   TIA_TUNE_End
3DC6 D04E          M         bra     label
               00071 
               00072 ;; --------------------------------------------------------------------------
               00073 ;;  TIA_PLAY Wrong Tune
               00074 ;; --------------------------------------------------------------------------
3DC8 00075 TIA_TUNE_PlayWrong
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 86


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3DC8 0E0D      00076     movlw   0x0d
3DCA 6E06      00077     movwf   TMP1
3DCC 0E06      00078         movlw   0x06
3DCE D84C      00079         rcall   TIA_TUNE_Note_Init
               00080 
3DD0 0E0B      00081         movlw   0x0b
3DD2 D85C      00082         rcall   TIA_TUNE_Note_On_Wait01
3DD4 0E04      00083         movlw   0x04
3DD6 D85A      00084         rcall   TIA_TUNE_Note_On_Wait01
3DD8 0E05      00085         movlw   0x05
3DDA D85B      00086         rcall   TIA_TUNE_Wait
3DDC 0E18      00087         movlw   0x18
3DDE D856      00088         rcall   TIA_TUNE_Note_On_Wait01
3DE0 0E10      00089         movlw   0x10
3DE2 D854      00090         rcall   TIA_TUNE_Note_On_Wait01
3DE4 0E1D      00091         movlw   0x1d
3DE6 D849      00092         rcall   TIA_TUNE_Note_On
3DE8 0E0F      00093         movlw   0x0f
3DEA D853      00094         rcall   TIA_TUNE_Wait
3DEC D84A      00095         rcall   TIA_TUNE_Note_Off
3DEE 0E04      00096         movlw   0x04
3DF0 D850      00097         rcall   TIA_TUNE_Wait
               00098 
               00099         rgoto   TIA_TUNE_End   
3DF2 D038          M         bra     label
               00100     
               00101 ;; --------------------------------------------------------------------------
               00102 ;;  TIA_PLAY Fanfare Tune
               00103 ;; --------------------------------------------------------------------------
3DF4 00104 TIA_TUNE_Play_Fanfare
3DF4 0E02      00105     movlw   0x02
3DF6 D838      00106         rcall   TIA_TUNE_Note_Init
               00107 
3DF8 0E0F      00108     movlw   0x0f
3DFA 6E06      00109     movwf   TMP1
3DFC 0E0B      00110         movlw   0x0b
3DFE D846      00111         rcall   TIA_TUNE_Note_On_Wait01
3E00 0E08      00112     movlw   0x08
3E02 6E06      00113     movwf   TMP1
3E04 0E08      00114         movlw   0x08
3E06 D842      00115         rcall   TIA_TUNE_Note_On_Wait01
3E08 0E04      00116     movlw   0x04
3E0A 6E06      00117     movwf   TMP1
3E0C 0E06      00118         movlw   0x06
3E0E D83E      00119         rcall   TIA_TUNE_Note_On_Wait01
3E10 0E0B      00120     movlw   0x0b
3E12 6E06      00121     movwf   TMP1
3E14 0E05      00122         movlw   0x05
3E16 D83A      00123         rcall   TIA_TUNE_Note_On_Wait01
               00124 
               00125 
3E18 0E0F      00126         movlw   0x0f
3E1A D83B      00127         rcall   TIA_TUNE_Wait
3E1C 0E08      00128     movlw   0x08
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 87


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3E1E 6E06      00129     movwf   TMP1
3E20 0E06      00130         movlw   0x06
3E22 D834      00131         rcall   TIA_TUNE_Note_On_Wait01
3E24 0E04      00132     movlw       0x04
3E26 D835      00133         rcall   TIA_TUNE_Wait
3E28 0E0C      00134     movlw   0x0c
3E2A 6E06      00135     movwf   TMP1
3E2C 0E05      00136         movlw   0x05
3E2E D82E      00137         rcall   TIA_TUNE_Note_On_Wait01
               00138 
               00139 
3E30 0E1A      00140         movlw   0x1a
3E32 D82F      00141         rcall   TIA_TUNE_Wait
3E34 D826      00142         rcall   TIA_TUNE_Note_Off
3E36 0E06      00143         movlw   0x06
3E38 D82C      00144         rcall   TIA_TUNE_Wait
               00145 
               00146         rgoto   TIA_TUNE_End
3E3A D014          M         bra     label
               00147     
               00148 ;; --------------------------------------------------------------------------
               00149 ;;  TIA_PLAY Tune #1
               00150 ;; --------------------------------------------------------------------------
3E3C 00151 TIA_TUNE_Play1
3E3C 0E0D      00152     movlw   0x0d
3E3E 6E06      00153     movwf   TMP1
3E40 0E08      00154         movlw   0x08
3E42 D812      00155         rcall   TIA_TUNE_Note_Init
               00156 
3E44 0E0B      00157         movlw   0x0b
3E46 D822      00158         rcall   TIA_TUNE_Note_On_Wait01
3E48 0E02      00159         movlw   0x02
3E4A D820      00160         rcall   TIA_TUNE_Note_On_Wait01
3E4C 0E03      00161         movlw   0x03
3E4E D821      00162         rcall   TIA_TUNE_Wait
3E50 0E10      00163         movlw   0x10
3E52 D81C      00164         rcall   TIA_TUNE_Note_On_Wait01
3E54 0E1C      00165         movlw   0x1c
               00166         ;movf   TMP2,W
3E56 D811      00167         rcall   TIA_TUNE_Note_On
3E58 0E30      00168         movlw   0x30
3E5A D81B      00169         rcall   TIA_TUNE_Wait
3E5C D812      00170         rcall   TIA_TUNE_Note_Off
3E5E 0E04      00171         movlw   0x04
3E60 D818      00172         rcall   TIA_TUNE_Wait
               00173 
               00174         rgoto   TIA_TUNE_End
3E62 D000          M         bra     label
               00175     
               00176 ;; --------------------------------------------------------------------------
               00177 ;;  TIA_PLAY End 
               00178 ;; --------------------------------------------------------------------------
3E64 00179 TIA_TUNE_End
3E64 9010      00180         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn on TIA software synth part again
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 88


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00181         ;goto   TIA_PATCH_Init                  ; init patch and exit
3E66 0012      00182     return
               00183 
               00184 
               00185 ;; --------------------------------------------------------------------------
               00186 ;;  TIA_PLAY Initialization routine
               00187 ;; --------------------------------------------------------------------------
3E68 00188 TIA_TUNE_Note_Init
3E68 8010      00189         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn off TIA software synth part
               00190 
               00191         SET_BSR TIA_BASE
3E6A 0101          M         movlb   HIGH(reg)
3E6C 0B0F      00192         andlw   0x0f
3E6E 6F00      00193         movwf   TIA_AUDC0, BANKED
3E70 5006      00194     movf    TMP1, W
3E72 0B0F      00195     andlw   0x0f
3E74 6F04      00196         movwf   TIA_AUDV0, BANKED
3E76 EF63 F01F 00197     goto        _TIA_SR_Handler
               00198 ;; --------------------------------------------------------------------------
               00199 ;;  TIA_PLAY a note (in: Note Number)
               00200 ;; --------------------------------------------------------------------------
3E7A 00201 TIA_TUNE_Note_On
               00202         SET_BSR TIA_BASE
3E7A 0101          M         movlb   HIGH(reg)
3E7C 6F02      00203         movwf   TIA_AUDF0, BANKED
               00204 
3E7E EF63 F01F 00205         goto    _TIA_SR_Handler  
               00206 
3E82 00207 TIA_TUNE_Note_Off
               00208         SET_BSR TIA_BASE
3E82 0101          M         movlb   HIGH(reg)
3E84 6B04      00209         clrf    TIA_AUDV0, BANKED
3E86 6B05      00210         clrf    TIA_AUDV1, BANKED
3E88 EF63 F01F 00211         goto    _TIA_SR_Handler
               00212 
3E8C 00213 TIA_TUNE_Note_On_Wait01
3E8C DFF6      00214         rcall   TIA_TUNE_Note_On
3E8E 0E01      00215         movlw   0x01
               00216         rgoto   TIA_TUNE_Wait
3E90 D000          M         bra     label
               00217     
               00218 
               00219 ;; --------------------------------------------------------------------------
               00220 ;;  TIA_PLAY wait for a certain time and poll TIA_SR Handler
               00221 ;; --------------------------------------------------------------------------
3E92 00222 TIA_TUNE_Wait
3E92 6E06      00223         movwf   TMP1
3E94 0004      00224         clrwdt
3E96 00225 TIA_TUNE_WaitLoop
3E96 0E0A      00226         movlw   10
3E98 ECCE F016 00227         call    MIOS_Delay
3E9C 2E06      00228         decfsz  TMP1, F
               00229         rgoto   TIA_TUNE_WaitLoop
3E9E D7FB          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 89


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3EA0 0012      00230         return
               00401 #include "tia_sr.inc"
               00001 ; $Id: tia_sr.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; TIA Shift Register 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 ; 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 ;; --------------------------------------------------------------------------
3EA2 00041 TIA_SR_Init
               00042         ;; reset the TIA
3EA2 0E00      00043         movlw   0x00     ;; value for 'LEAD' waveform
3EA4 6F00      00044         movwf   TIA_AUDC0, BANKED
3EA6 0E00      00045     movlw       0x00    ;; value for pitch
3EA8 6F02      00046         movwf   TIA_AUDF0, BANKED
3EAA 0E00      00047     movlw       0x00    ;; value for volume
3EAC 6F04      00048     movwf       TIA_AUDV0, BANKED
3EAE 0E00      00049         movlw   0x00     ;; value for 'LEAD' waveform
3EB0 6F01      00050         movwf   TIA_AUDC1, BANKED
3EB2 0E00      00051     movlw       0x00    ;; value for pitch
3EB4 6F03      00052         movwf   TIA_AUDF1, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 90


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3EB6 0E00      00053     movlw       0x00    ;; value for volume
3EB8 6F05      00054     movwf       TIA_AUDV1, BANKED
3EBA D801      00055         rcall   TIA_SR_Handler
               00056 
3EBC 0012      00057     return
               00058         ;; reset will be released with first call of TIA_SR_Handler
               00059 
               00060 ;; --------------------------------------------------------------------------
               00061 ;;  Check for changes in TIA registers, transfer values to TIA
               00062 ;;  and handle Wavetable
               00063 ;; --------------------------------------------------------------------------
3EBE 00064 TIA_SR_Handler
3EBE B010      00065         btfsc   TIA_STAT, TIA_STAT_ENGINE_DISABLE
3EC0 0012      00066         return
               00067 
3EC2 EC60 F026 00068         call    TIA_WT_Handler                  ; call wavetable handler before continue
3EC6 00069 _TIA_SR_Handler
               00070 
3EC6 00071 TIA_SR_Start
               00072     
3EC6 EE01 F000 00073         lfsr    FSR0, TIA_BASE                  ; store base address of TIA registers in FSR0
3ECA EE11 F010 00074         lfsr    FSR1, TIA_SHADOW_BASE   ; store base address of shadow registers in FSR1
3ECE 6A07      00075     clrf    TMP2                    ; TMP2 as Voice(Audx) Number
               00076     
               00077         IRQ_DISABLE                             ; disable interrupts
3ED0 9EF2          M         bcf     INTCON, GIE
               00078         
3ED2 00079 TIA_SR_Audx_Loop
               00080     ;; check volume change
3ED2 0E04      00081     movlw   0x04
3ED4 B007      00082     btfsc   TMP2, 0
3ED6 0F01      00083     addlw   0x01
3ED8 6E06      00084     movwf   TMP1        ; AudVx register (0x04 or 0x05)
3EDA 50EB      00085     movf    PLUSW0, W
3EDC 6E04      00086     movwf   MIOS_PARAMETER2
3EDE E11E      00087     bnz     TIA_SR_Audx_SoundOn  ;; Volume not 0 -> SoundOn  
               00088 
               00089     ;; On Sound Off
3EE0 00090 TIA_SR_Audx_SoundOff
3EE0 5006      00091     movf    TMP1, W
3EE2 50E3      00092     movf    PLUSW1, W
3EE4 E02B      00093     bz      TIA_SR_Audx_Loop_Next       ; exit if shadow already clear(no V change)
               00094 
               00095     TABLE_ADDR TIA_SR_REGWRITEOFF_TABLE ; contains order of register accesses
3EE6 0E28          M         movlw   LOW(addr)               ; store Lo Byte
3EE8 6EF6          M         movwf   TBLPTRL
3EEA 0E40          M         movlw   HIGH(addr)              ; store Hi Byte
3EEC 6EF7          M         movwf   TBLPTRH
                   M #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
3EEE 0E00          M         movlw   UPPER(addr)             ; store Upper Byte
3EF0 6EF8          M         movwf   TBLPTRU
                   M #endif
3EF2 0E00      00096     movlw   0x00
3EF4 B007      00097     btfsc   TMP2, 0
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 91


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3EF6 0E03      00098     movlw   0x03
3EF8 26F6      00099     addwf   TBLPTRL, F
               00100 
3EFA 00101 TIA_SR_Audx_SoundOff_C
3EFA 0009      00102     tblrd*+
               00103     ;; -> Check polynom Resync
3EFC 50F5      00104     movf        TABLAT, W
3EFE AEEB      00105     btfss   PLUSW0, 7
               00106     rgoto   TIA_SR_Audx_SoundOff_Norm       ; exit if resync not requested
3F00 D009          M         bra     label
3F02 6A04      00107     clrf    MIOS_PARAMETER2
3F04 D82A      00108     rcall   TIA_SR_Transfer 
               00109 
3F06 00110 TIA_SR_Audx_SoundOff_V
3F06 0009      00111     tblrd*+
3F08 6A04      00112     clrf    MIOS_PARAMETER2
3F0A D827      00113     rcall   TIA_SR_Transfer
               00114 
3F0C 00115 TIA_SR_Audx_SoundOff_F
3F0C 0009      00116     tblrd*+
3F0E 6A04      00117     clrf    MIOS_PARAMETER2
3F10 D824      00118     rcall   TIA_SR_Transfer
               00119     rgoto   TIA_SR_Audx_Loop_Next
3F12 D014          M         bra     label
               00120    
3F14 00121 TIA_SR_Audx_SoundOff_Norm
3F14 0009      00122     tblrd*+
3F16 6A04      00123     clrf    MIOS_PARAMETER2
3F18 D820      00124     rcall   TIA_SR_Transfer
               00125     rgoto   TIA_SR_Audx_Loop_Next
3F1A D010          M         bra     label
               00126 
               00127 
               00128      
               00129     ;; On Sound On
3F1C 00130 TIA_SR_Audx_SoundOn 
               00131     TABLE_ADDR TIA_SR_REGWRITEON_TABLE  ; contains order of register accesses
3F1C 0E22          M         movlw   LOW(addr)               ; store Lo Byte
3F1E 6EF6          M         movwf   TBLPTRL
3F20 0E40          M         movlw   HIGH(addr)              ; store Hi Byte
3F22 6EF7          M         movwf   TBLPTRH
                   M #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
3F24 0E00          M         movlw   UPPER(addr)             ; store Upper Byte
3F26 6EF8          M         movwf   TBLPTRU
                   M #endif
3F28 0E00      00132     movlw   0x00
3F2A B007      00133     btfsc   TMP2, 0
3F2C 0E03      00134     movlw   0x03
3F2E 26F6      00135     addwf   TBLPTRL, F
3F30 0E03      00136     movlw       3               ; number of registers (0x06)
3F32 6E06      00137         movwf   TMP1                            ; TMP1 is the loop counter  
3F34 00138 TIA_SR_Audx_SoundOn_Loop    
3F34 0009      00139     tblrd*+
3F36 D808      00140     rcall   TIA_SR_Check
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 92


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3F38 2E06      00141         decfsz  TMP1, F                         ; decrement loop counter until it is zero
               00142         rgoto   TIA_SR_Audx_SoundOn_Loop
3F3A D7FC          M         bra     label
               00143     ;;rgoto   TIA_SR_Audx_Loop_Next
               00144 
3F3C 00145 TIA_SR_Audx_Loop_Next
3F3C 2A07      00146     incf    TMP2, F
3F3E A207      00147         btfss   TMP2, 1                         ; decrement loop counter until it is zero
               00148         rgoto   TIA_SR_Audx_Loop    
3F40 D7C8          M         bra     label
               00149 
               00150         IRQ_ENABLE                              ; enable interrupts again
3F42 8EF2          M         bsf     INTCON, GIE
               00151 
3F44 9210      00152         bcf     TIA_STAT, TIA_STAT_FORCE_REFRESH; clear refresh request (if it has been set before)
               00153 
3F46 0012      00154         return
               00155 
               00156 ;; --------------------------------------------------------------------------
               00157 ;;  TIA Check: compare base and shadow registers
               00158 ;; --------------------------------------------------------------------------
3F48 00159 TIA_SR_Check
3F48 50F5      00160         movf    TABLAT, W
3F4A CFEB F004 00161         movff   PLUSW0, MIOS_PARAMETER2         ; store value of TIA in MIOS_PARAMETER1 and increment FSR0
               00162         BRA_IFSET TIA_STAT, TIA_STAT_FORCE_REFRESH, ACCESS, TIA_SR_Transfer; don't skip if refresh has been forced
3F4E B210          M         btfsc   reg, bit, reg_a
3F50 D004          M         bra     label
3F52 50E3      00163         movf    PLUSW1, W                       ; get content of appr. shadow register
3F54 6204      00164         cpfseq  MIOS_PARAMETER2, ACCESS; transfer to TIA if not equal
               00165     rgoto   TIA_SR_Transfer
3F56 D001          M         bra     label
3F58 0012      00166         return                  ; skip following code if equal 
               00167 
               00168     
               00169 ;; --------------------------------------------------------------------------
               00170 ;;  TIA Transfer: Store in shadow and transfer
               00171 ;; --------------------------------------------------------------------------
3F5A 00172 TIA_SR_Transfer   
               00173     ;; register change: write value into shadow register and transfer it to TIA
3F5A 50F5      00174         movf    TABLAT, W
3F5C C004 FFE3 00175         movff   MIOS_PARAMETER2, PLUSW1         ; store value in shadow register
               00176 
               00177     ;; extract address, add offset
3F60 50F5      00178         movf    TABLAT, W
3F62 0F05      00179     addlw   0x05
3F64 6E03      00180         movwf   MIOS_PARAMETER1                 ; store in address register
               00181 
               00182         ;;rcall TIA_SR_Write                    ; transfer to TIA
3F66 816A      00183     bsf     TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ
               00184 
               00185 ;; --------------------------------------------------------------------------
               00186 ;;  TIA Write: write to TIA register
               00187 ;; --------------------------------------------------------------------------
3F68 00188 TIA_SR_Write
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 93


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00189         ;; TIA signals:
               00190         ;; MIOS_PARAMETER2[4..0]: Data
               00191         ;; MIOS_PARAMETER1[3..0]: Address
               00192         ;; temporary used as counter: MIOS_PARAMETER3
               00193 
3F68 908B      00194     bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK    ; clear clock
               00195 
               00196         ;; superfast transfer with unrolled loop (takes some memory, but guarantees the
               00197         ;; lowest system load :)
               00198 TIA_SR_WRITE_BIT MACRO reg, bit
               00199         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
               00200         btfsc   reg, bit
               00201         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
               00202         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
               00203         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00204         ENDM
               00205 #if DEFAULT_IS_CARTRIDGE==1
               00206         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 4     ; IC8.O0
3F6A 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3F6C B804          M         btfsc   reg, bit
3F6E 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3F70 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3F72 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00207         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 3     ; IC8.O1
3F74 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3F76 B604          M         btfsc   reg, bit
3F78 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3F7A 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3F7C 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00208         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 2     ; IC8.O2
3F7E 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3F80 B404          M         btfsc   reg, bit
3F82 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3F84 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3F86 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00209         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 1     ; IC8.O3
3F88 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3F8A B204          M         btfsc   reg, bit
3F8C 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3F8E 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3F90 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00210         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 0     ; IC8.O4
3F92 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3F94 B004          M         btfsc   reg, bit
3F96 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3F98 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3F9A 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00211         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O5
3F9C 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3F9E BE04          M         btfsc   reg, bit
3FA0 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FA2 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FA4 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00212         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O6
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 94


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3FA6 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FA8 BE04          M         btfsc   reg, bit
3FAA 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FAC 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FAE 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00213         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O7
3FB0 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FB2 BE04          M         btfsc   reg, bit
3FB4 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FB6 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FB8 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00214 
               00215         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 3     ; IC7.O0
3FBA 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FBC B603          M         btfsc   reg, bit
3FBE 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FC0 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FC2 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00216         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 2     ; IC7.O1
3FC4 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FC6 B403          M         btfsc   reg, bit
3FC8 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FCA 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FCC 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00217         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 1     ; IC7.O2
3FCE 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FD0 B203          M         btfsc   reg, bit
3FD2 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FD4 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FD6 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00218         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 0     ; IC7.O3
3FD8 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FDA B003          M         btfsc   reg, bit
3FDC 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FDE 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FE0 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00219         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O4
3FE2 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FE4 BE03          M         btfsc   reg, bit
3FE6 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FE8 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FEA 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00220         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O5
3FEC 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FEE BE03          M         btfsc   reg, bit
3FF0 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FF2 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FF4 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00221         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O6
3FF6 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
3FF8 BE03          M         btfsc   reg, bit
3FFA 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
3FFC 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
3FFE 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 95


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00222         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O7
4000 968B          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4002 BE03          M         btfsc   reg, bit
4004 868B          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4006 808B          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4008 908B          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00223 
               00224 #else    
               00225         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 0     ; IC2.O0
               00226         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 1     ; IC2.O1
               00227         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 2     ; IC2.O2
               00228         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 3     ; IC2.O3
               00229         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 4     ; IC2.O4
               00230         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O5
               00231         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O6
               00232         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O7
               00233 
               00234         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 3     ; IC3.O0
               00235         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 2     ; IC3.O1
               00236         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 1     ; IC3.O2
               00237         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 0     ; IC3.O3
               00238         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O4
               00239         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O5
               00240         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O6
               00241         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O7
               00242 #endif
400A 848B      00243     bsf     TIA_SR_LAT_RCLK, TIA_SR_PIN_RCLK    ; latch TIA values
               00244 
400C 928B      00245         bcf     TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; enable write (MBHP_TIA: chip select)
400E 968B      00246         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT      ; clear out pin (standby)
4010 948B      00247     bcf     TIA_SR_LAT_RCLK, TIA_SR_PIN_RCLK    ; release latch
               00248     
4012 928B      00249     bcf TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; enable write (MBHP_TIA: chip select)
4014 D000      00250         bra     $+2                             ; to ensure compatibility with on-board oscillator,
4016 D000      00251         bra     $+2                             ; wait for 0.840 uS (1 us) (> one TIA clock cycle)
4018 D000      00252         bra     $+2
401A D000      00253         bra     $+2
401C D000      00254         bra     $+2
401E 828B      00255         bsf     TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; disable write (MBHP_TIA: chip select)
               00256 
4020 0012      00257         return
               00258 
               00259 ;; --------------------------------------------------------------------------
4022 00260 TIA_SR_REGWRITEON_TABLE
               00261         ;; order in which the TIA registers are written
               00262     ;; AudCx > AudFx > AudVx
4022 0200 0104 00263         db      0x00, 0x02, 0x04, 0x01, 0x03, 0x05
     0503      
               00264 ;; --------------------------------------------------------------------------
4028 00265 TIA_SR_REGWRITEOFF_TABLE
               00266         ;; order in which the TIA registers are written
               00267     ;; AudCx > AudVx > AudFx
4028 0400 0102 00268         db      0x00, 0x04, 0x02, 0x01, 0x05, 0x03    
     0305      
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 96


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00269     
               00270     
               00271     
               00402 #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)
402E 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_GATE_NOTE_ON     EQU 4
  00000005     00032 Vx_STAT_ENV_ACTIVE       EQU 5
  00000006     00033 Vx_STAT_PORTA_ENABLE     EQU 6
  00000007     00034 Vx_STAT_GRP_REQ          EQU 7
               00035 
  00000000     00036 Vx_MODE_GSA_ACTIVE       EQU 0  ;; Gate Stay Active
  00000001     00037 Vx_MODE_GRP_ACTIVE       EQU 1  ;; Gate Resyncs Polynom Active
  00000002     00038 Vx_MODE_PORTA_CONST      EQU 2
  00000003     00039 Vx_MODE_KEY_EXTENDED     EQU 3
  00000004     00040 Vx_MODE_VEL2AMP_ON       EQU 4
  00000005     00041 Vx_MODE_ARP_SYNC_ON      EQU 5
               00042 
  00000000     00043 Vx_ENV_MODTYP_EM         EQU 0
  00000001     00044 Vx_ENV_MODTYP_ExM        EQU 1
  00000002     00045 Vx_ENV_TOAMP_ON          EQU 2
  00000003     00046 Vx_ENV_TOPITCH_ON        EQU 3
  00000004     00047 Vx_ENV_SYNC_ON           EQU 4
               00048 
  00000000     00049 Vx_OPTION_WT_ON          EQU 0
  00000001     00050 Vx_OPTION_WTSYNC_ON      EQU 1
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 97


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00000002     00051 Vx_OPTION_KIT_ON         EQU 2
  00000003     00052 Vx_OPTION_SAMPLER_ON     EQU 3
               00053 ;; A ajouter dans MAX
  00000004     00054 Vx_OPTION_ONLY_WT_OFF    EQU 4
  00000005     00055 Vx_OPTION_TB303          EQU 5
  00000006     00056 Vx_OPTION_ENV2PORTA          EQU 6
               00057 
  00000000     00058 LFOx_MODE_ENABLE                 EQU 0
  00000001     00059 LFOx_MODE_SYNC           EQU 1
  00000002     00060 LFOx_MODE_SYNC_ALL       EQU 2
  00000003     00061 LFOx_MODE_RESERVED       EQU 3
  00000004     00062 LFOx_MODE_WAVEFORM0      EQU 4
  00000005     00063 LFOx_MODE_WAVEFORM1      EQU 5
  00000006     00064 LFOx_MODE_WAVEFORM2      EQU 6
  00000007     00065 LFOx_MODE_DECINC                 EQU 7
               00066 
  00000000     00067 ENVx_MODE_ATTACK                 EQU 0
  00000001     00068 ENVx_MODE_DECAY          EQU 1
  00000002     00069 ENVx_MODE_SUSTAIN        EQU 2
  00000003     00070 ENVx_MODE_RELEASE        EQU 3
  00000004     00071 ENVx_MODE_FREE           EQU 4
               00072 ;ENVx_MODE_RESERVED      EQU 5
               00073 ;ENVx_MODE_RESERVED      EQU 6
               00074 ;ENVx_MODE_RESERVED      EQU 7
               00075 
               00076 
  00000000     00077 ASSIGNED_LFOS_1         EQU     0
  00000001     00078 ASSIGNED_LFOS_2         EQU     1
  00000002     00079 ASSIGNED_LFOS_3         EQU     2
  00000003     00080 ASSIGNED_LFOS_4         EQU     3
  00000004     00081 ASSIGNED_ENVS_1         EQU     4
  00000005     00082 ASSIGNED_ENVS_2         EQU     5
  00000006     00083 ASSIGNED_ENVS_A0        EQU     6
  00000007     00084 ASSIGNED_ENVS_A1        EQU     7
               00085 
  00000000     00086 WT_STATE_STOP           EQU     0
  00000001     00087 WT_STATE_RESET          EQU     1
  00000002     00088 WT_STATE_INIT_REQ   EQU 2
  00000003     00089 WT_STATE_SEND_CLK   EQU 3   ; WT Voice 1(Aud0) prior
  00000004     00090 WT_STATE_GATE           EQU     4       ; for TB303 option
  00000005     00091 WT_STATE_SLIDE          EQU     5
  00000006     00092 WT_STATE_SLIDE_PREV     EQU     6
  00000007     00093 WT_STATE_PLAY_2ND       EQU     7
               00094 
  00000000     00095 SE_OPTION_TB303         EQU     0
  00000001     00096 SE_OPTION_FIP           EQU     1
  00000002     00097 SE_OPTION_ENV2PORTA     EQU     2
  00000003     00098 SE_OPTION_ENV2VOL       EQU     3
  00000004     00099 SE_OPTION_GSA           EQU     4
               00100 
               00101 ;; ==========================================================================
               00102 
               00103 
               00104 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 98


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00105 ;;  TIA Software Handler: Software Synthesizer part for the TIA
               00106 ;;  called by User Timer every 800 us
               00107 ;; --------------------------------------------------------------------------
402E 00108 TIA_SW_Handler
               00109 #if TIA_SW_MEASURE_PERFORMANCE
               00110         bsf     PORTD, 4
               00111 #endif
               00112 
               00113         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
402E 0101          M         movlb   HIGH(reg)
               00114 
               00115         ;; return immediately if engine has been disabled
4030 B010      00116         btfsc   TIA_STAT, TIA_STAT_ENGINE_DISABLE
4032 0012      00117         return
               00118 
               00119         ;; handle with MIDI clock
4034 00120 TIA_SW_Clk
4034 2BF1      00121         incf    TIA_MIDI_SYNC_CTR, F, BANKED
               00122 
               00123         ;; register last counter value on 0xf8 or if TIA_MIDI_SYNC_CTR == 0xff (no clock received)
4036 9DF0      00124         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED
4038 29F1      00125         incf    TIA_MIDI_SYNC_CTR, W, BANKED
403A E003      00126         bz      TIA_SW_Clk_F8
               00127         BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_F8, BANKED, TIA_SW_Clk_NoF8
403C A9F0          M         btfss   reg, bit, reg_a
403E D005          M         bra     label
4040 99F0      00128         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_F8, BANKED
4042 00129 TIA_SW_Clk_F8
4042 8DF0      00130         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED
4044 C1F1 F1F2 00131         movff   TIA_MIDI_SYNC_CTR, TIA_MIDI_SYNC_CTR_REG
4048 6BF1      00132         clrf    TIA_MIDI_SYNC_CTR, BANKED
404A 00133 TIA_SW_Clk_NoF8
               00134 
               00135         ;; handle with double resolution of TIA_SW clock
404A 9FF0      00136         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00137 
               00138         ;; if MIDI sync enabled: clock LFOs/ENVs two times on every MIDI clock event
404C 51F1      00139         movf    TIA_MIDI_SYNC_CTR, W, BANKED
404E B4D8      00140         skpnz
4050 8FF0      00141         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00142 
4052 90D8      00143         clrc
4054 31F2      00144         rrf     TIA_MIDI_SYNC_CTR_REG, W, BANKED
4056 19F1      00145         xorwf   TIA_MIDI_SYNC_CTR, W, BANKED
4058 B4D8      00146         skpnz
405A 8FF0      00147         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00148 
               00149         ;; A MIDI clock start event restarts all LFOs
               00150         BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_FA, BANKED, TIA_SW_Clk_NoFA
405C ABF0          M         btfss   reg, bit, reg_a
405E D005          M         bra     label
4060 9BF0      00151         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_FA, BANKED
4062 00152 TIA_SW_Clk_FA
4062 EC81 F025 00153         call    TIA_SW_Hlp_SyncAllLFOs
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 99


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00154 
               00155         ;btfsc  TIA_SE_OPTION, SE_OPTION_TB303, BANKED
4066 0E2E      00156     movlw       TIA_Vx_WT_STATE
4068 82EB      00157         bsf     PLUSW0, WT_STATE_RESET
               00158 
406A 00159 TIA_SW_Clk_NoFA
               00160 
406A CFF3 F1F6 00161         movff   PRODL, SAVED_PRODL      ; save PROD[LH] - we are in an interrupt routine
406E CFF4 F1F7 00162         movff   PRODH, SAVED_PRODH
               00163 
               00164         ;; generate new pseudo-random number
4072 511C      00165         movf    TIA_LFO_RANDOM_SEED_L, W, BANKED
4074 031D      00166         mulwf   TIA_LFO_RANDOM_SEED_H, BANKED
4076 50D6      00167         movf    TMR0L, W
4078 24F3      00168         addwf   PRODL, W
407A 6F1C      00169         movwf   TIA_LFO_RANDOM_SEED_L, BANKED
407C 0E69      00170         movlw   0x69
407E 20F4      00171         addwfc  PRODH, W
4080 6F1D      00172         movwf   TIA_LFO_RANDOM_SEED_H, BANKED
               00173 
               00174 
               00175     SET_BSR     TIA_BASE
4082 0101          M         movlb   HIGH(reg)
4084 6B0E      00176         clrf    TIA_SW_VOICE, BANKED    ; loop counter
4086 EE11 F020 00177         lfsr    FSR1, TIA_V1_BASE
408A 00178 TIA_SW_Wt_VoiceLoop
               00179 
               00180         ;; wavetable handler: check for MIDI Sync
408A 0E2B      00181     movlw   TIA_Vx_OPTION
               00182     BRA_IFCLR PLUSW0, Vx_OPTION_WTSYNC_ON, ACCESS, TIA_SW_Wt
408C A2EB          M         btfss   reg, bit, reg_a
408E D002          M         bra     label
               00183         BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED, TIA_SW_Wt_VoiceLoop_Next
4090 ADF0          M         btfss   reg, bit, reg_a
4092 D021          M         bra     label
4094 00184 TIA_SW_Wt
4094 0E2F      00185     movlw   TIA_Vx_WT_RATE
4096 50E3      00186         movf    PLUSW1, W
4098 E01E      00187         bz      TIA_SW_Wt_VoiceLoop_Next
               00188 
409A 0E31      00189     movlw   TIA_Vx_WT_CTR
409C 50E3      00190         movf    PLUSW1, W
409E E119      00191         bnz     TIA_SW_Wt_Next
               00192 
40A0 0E2B      00193     movlw   TIA_Vx_OPTION
               00194     BRA_IFCLR PLUSW0, Vx_OPTION_WTSYNC_ON, ACCESS, TIA_SW_Wt_IntClk
40A2 A2EB          M         btfss   reg, bit, reg_a
40A4 D008          M         bra     label
40A6 00195 TIA_SW_Wt_ExtClk
40A6 0E2F      00196     movlw   TIA_Vx_WT_RATE
40A8 1CE3      00197         comf    PLUSW1, W
40AA 0B7F      00198         andlw   0x7f
40AC 6E0B      00199     movwf   IRQ_TMP1
               00200 ;       btfss   TIA_SE_OPTION, SE_OPTION_TB303, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 100


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00201 ;       addlw 1
               00202 
40AE 0E31      00203     movlw   TIA_Vx_WT_CTR
40B0 C00B FFE3 00204         movff   IRQ_TMP1, PLUSW1
               00205         rgoto   TIA_SW_Wt_PlayNext
40B4 D00B          M         bra     label
40B6 00206 TIA_SW_Wt_IntClk
40B6 0E2F      00207     movlw   TIA_Vx_WT_RATE
40B8 1CE3      00208         comf    PLUSW1, W
40BA 0B7F      00209         andlw   0x7f
40BC B4D8      00210         skpnz                   ; never use 0x00 (avoid wdt reset on overloaded engine)
40BE 0F01      00211         addlw   1
40C0 6E0B      00212     movwf   IRQ_TMP1
40C2 0E31      00213     movlw   TIA_Vx_WT_CTR
40C4 C00B FFE3 00214         movff   IRQ_TMP1, PLUSW1
40C8 90D8      00215         clrc
40CA 36E3      00216         rlf     PLUSW1, F
               00217         ;;      rgoto   TIA_SW_Wt_PlayNext
               00218 
40CC 00219 TIA_SW_Wt_PlayNext
40CC 0E30      00220     movlw   TIA_Vx_WT_CLK_REQ_CTR
40CE 2AE3      00221         incf    PLUSW1, F
               00222         rgoto   TIA_SW_Wt_VoiceLoop_Next
40D0 D002          M         bra     label
               00223 
40D2 00224 TIA_SW_Wt_Next
40D2 0E31      00225     movlw   TIA_Vx_WT_CTR
40D4 06E3      00226         decf    PLUSW1, F
               00227 
40D6 00228 TIA_SW_Wt_VoiceLoop_Next
40D6 0E40      00229         movlw   TIA_Vx_RECORD_LEN
40D8 26E1      00230         addwf   FSR1L, F
40DA 2B0E      00231         incf    TIA_SW_VOICE, F, BANKED
40DC 0E01      00232         movlw   2-1
40DE 650E      00233         cpfsgt  TIA_SW_VOICE, BANKED
               00234         rgoto TIA_SW_Wt_VoiceLoop
40E0 D7D4          M         bra     label
               00235 
               00236 
               00237 
               00238     ;; ARPs: check for MIDI Sync
40E2 00239 TIA_SW_ARPs
40E2 EE11 F020 00240         lfsr    FSR1, TIA_V1_BASE
40E6 0E04      00241     movlw       TIA_Vx_MODE
40E8 BAE3      00242     btfsc   PLUSW1, Vx_MODE_ARP_SYNC_ON
40EA BFF0      00243     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
40EC D858      00244         rcall   TIA_SW_Arp
40EE EE11 F060 00245         lfsr    FSR1, TIA_V2_BASE
40F2 0E04      00246     movlw       TIA_Vx_MODE
40F4 BAE3      00247     btfsc   PLUSW1, Vx_MODE_ARP_SYNC_ON
40F6 BFF0      00248     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
40F8 D852      00249         rcall   TIA_SW_Arp
40FA 00250 TIA_SW_ARPs_End
               00251 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 101


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00252         ;; LFOs: check for MIDI Sync
40FA 00253 TIA_SW_LFOs
40FA 6B0F      00254         clrf    TIA_SW_LFO_NUMBER, BANKED
40FC EE11 F0A0 00255     lfsr        FSR1, TIA_LFO1_BASE
4100 B11F      00256     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_1, BANKED
4102 BFF0      00257     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4104 DB46      00258         rcall   TIA_SW_LFO
4106 2B0F      00259         incf    TIA_SW_LFO_NUMBER, F, BANKED
4108 EE11 F0A7 00260     lfsr        FSR1, TIA_LFO2_BASE
410C B31F      00261     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_2, BANKED
410E BFF0      00262     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4110 DB40      00263         rcall   TIA_SW_LFO
4112 2B0F      00264         incf    TIA_SW_LFO_NUMBER, F, BANKED
4114 EE11 F0AE 00265     lfsr        FSR1, TIA_LFO3_BASE
4118 B51F      00266     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_3, BANKED
411A BFF0      00267     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
411C DB3A      00268         rcall   TIA_SW_LFO
411E 2B0F      00269         incf    TIA_SW_LFO_NUMBER, F, BANKED
4120 EE11 F0B5 00270     lfsr        FSR1, TIA_LFO4_BASE
4124 B71F      00271     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_4, BANKED
4126 BFF0      00272     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4128 DB34      00273         rcall   TIA_SW_LFO
412A 00274 TIA_SW_LFOs_End
               00275 
               00276         ;; ENVs: check for MIDI Sync
412A 00277 TIA_SW_ENVs
               00278     ;; Enveloppe for AUD0(voice 1)
412A 6B0F      00279         clrf    TIA_SW_ENV_NUMBER, BANKED
412C EE11 F0BC 00280     lfsr        FSR1, TIA_V1_ENV_BASE
4130 EE21 F020 00281     lfsr        FSR2, TIA_V1_BASE
4134 0E2A      00282     movlw   TIA_Vx_ENV_MODE
               00283     BRA_IFCLR   PLUSW2, Vx_ENV_SYNC_ON, ACCESS, TIA_SW_ENVs_v1_Ok
4136 A8DB          M         btfss   reg, bit, reg_a
4138 D002          M         bra     label
               00284     BRA_IFCLR   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED, TIA_SW_ENVs_v1_Nok
413A AFF0          M         btfss   reg, bit, reg_a
413C D003          M         bra     label
413E 00285 TIA_SW_ENVs_v1_Ok
413E 511B      00286     movf        TIA_Vx_ENV_CURVES, W, BANKED
4140 0B07      00287     andlw   0x07
4142 DB6D      00288         rcall   TIA_SW_ENV
4144 00289 TIA_SW_ENVs_v1_Nok
               00290     ;; Enveloppe for AUD1(voice 2)
4144 2B0F      00291         incf    TIA_SW_ENV_NUMBER, BANKED
4146 EE11 F0C7 00292     lfsr        FSR1, TIA_V2_ENV_BASE
414A EE21 F060 00293     lfsr        FSR2, TIA_V2_BASE
414E 0E2A      00294     movlw   TIA_Vx_ENV_MODE
               00295     BRA_IFCLR   PLUSW2, Vx_ENV_SYNC_ON, ACCESS, TIA_SW_ENVs_v2_Ok
4150 A8DB          M         btfss   reg, bit, reg_a
4152 D002          M         bra     label
               00296     BRA_IFCLR   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED, TIA_SW_ENVs_v2_Nok
4154 AFF0          M         btfss   reg, bit, reg_a
4156 D003          M         bra     label
4158 00297 TIA_SW_ENVs_v2_Ok
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 102


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4158 391B      00298         swapf   TIA_Vx_ENV_CURVES, W, BANKED
415A 0B07      00299     andlw   0x07
415C DB60      00300         rcall   TIA_SW_ENV
415E 00301 TIA_SW_ENVs_v2_Nok
               00302     ;; Enveloppe 1
415E 2B0F      00303         incf    TIA_SW_ENV_NUMBER, BANKED
4160 EE11 F0D2 00304     lfsr        FSR1, TIA_ENV1_BASE
4164 511E      00305         movf    TIA_ENVx_CURVES, W, BANKED
4166 B91F      00306     btfsc   TIA_MOD_SYNC, ASSIGNED_ENVS_1, BANKED
4168 BFF0      00307     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
416A DB59      00308         rcall   TIA_SW_ENV
               00309     ;; Enveloppe 2
416C 2B0F      00310         incf    TIA_SW_ENV_NUMBER, BANKED
416E EE11 F0DD 00311     lfsr        FSR1, TIA_ENV2_BASE
4172 391E      00312         swapf   TIA_ENVx_CURVES, W, BANKED
4174 BB1F      00313     btfsc   TIA_MOD_SYNC, ASSIGNED_ENVS_2, BANKED
4176 BFF0      00314     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4178 DB52      00315         rcall   TIA_SW_ENV
417A 00316 TIA_SW_ENVs_End
               00317 
               00318     SET_BSR     TIA_BASE
417A 0101          M         movlb   HIGH(reg)
417C 6B0E      00319         clrf    TIA_SW_VOICE, BANKED    ; loop counter
417E EE11 F020 00320         lfsr    FSR1, TIA_V1_BASE
4182 00321 TIA_SW_VoiceLoop
4182 0E10      00322         movlw   TIA_Vx_NOTE
4184 50E3      00323         movf    PLUSW1, W
4186 E002      00324         bz      TIA_SW_VoiceLoop_NoPitchChange
4188 00325 TIA_SW_VoiceLoop_PitchChange
4188 D85C      00326         rcall   TIA_SW_Note
418A D8CE      00327         rcall   TIA_SW_Pitch
               00328    
418C 00329 TIA_SW_VoiceLoop_NoPitchChange
418C D990      00330         rcall   TIA_SW_Porta
418E DA3A      00331     rcall       TIA_SW_Amp
               00332 
4190 00333 TIA_SW_VoiceLoop_Next
4190 0E40      00334         movlw   TIA_Vx_RECORD_LEN
4192 26E1      00335         addwf   FSR1L, F
4194 2B0E      00336         incf    TIA_SW_VOICE, F, BANKED
4196 0E01      00337         movlw   2-1
4198 650E      00338         cpfsgt  TIA_SW_VOICE, BANKED
               00339         rgoto TIA_SW_VoiceLoop
419A D7F3          M         bra     label
               00340 
419C 00341 TIA_SW_Handler_End
               00342 
               00343 #if TIA_SW_MEASURE_PERFORMANCE
               00344         bcf     PORTD, 4
               00345 #endif
               00346 
419C 0012      00347         return
               00348 
               00349 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 103


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00350 
               00351 
               00352 
               00353 ;; --------------------------------------------------------------------------
               00354 ;; This function handles the arpeggiator
               00355 ;; --------------------------------------------------------------------------
419E 00356 TIA_SW_Arp
               00357         ;; skip if arpeggiator rate == 0
419E 0E13      00358         movlw   TIA_Vx_ARP_RATE
41A0 50E3      00359         movf    PLUSW1, W
41A2 E04E      00360         bz      TIA_SW_Arp_End
               00361 
               00362         ;; a counter is incremented on each function call
               00363         ;; arpeggiator is stepped forward once the counter has reached the
               00364         ;; compare value: rate^0x7f + 1, multiply by 2 if MIDI sync not enabled
41A4 0A7F      00365         xorlw   0x7f
41A6 0F01      00366         addlw   1
41A8 6E0B      00367     movwf       IRQ_TMP1        ; compare value => IRQ_TMP1
41AA 90D8      00368         clrc
41AC 0E04      00369     movlw       TIA_Vx_MODE
41AE AAE3      00370         btfss   PLUSW1, Vx_MODE_ARP_SYNC_ON, ACCESS     ; (*2 reduce the rate a little if no MIDI sync)
41B0 360B      00371         rlf     IRQ_TMP1, F
               00372 
41B2 0E01      00373         movlw   1
41B4 6E0C      00374         movwf   IRQ_TMP2        ; incrementer => IRQ_TMP2
               00375 
               00376         ;; special option: constant time arp cycle
               00377         ;; if 1 key is pressed, use the original incrementer
               00378         ;; if 2 keys are pressed, increment by 2
               00379         ;; if 3 keys are pressed, increment by 3
               00380         ;; if 4 keys are pressed, increment by 4
41B6 0E23      00381         movlw   TIA_Vx_NOTE_STACK_1
41B8 50E3      00382         movf    PLUSW1, W
41BA A4D8      00383         skpz
41BC 2A0C      00384         incf    IRQ_TMP2, F
               00385 
41BE 0E24      00386         movlw   TIA_Vx_NOTE_STACK_2
41C0 50E3      00387         movf    PLUSW1, W
41C2 A4D8      00388         skpz
41C4 2A0C      00389         incf    IRQ_TMP2, F
               00390         
41C6 0E25      00391         movlw   TIA_Vx_NOTE_STACK_3
41C8 50E3      00392         movf    PLUSW1, W
41CA A4D8      00393         skpz
41CC 2A0C      00394         incf    IRQ_TMP2, F
               00395 
               00396         ;; increment counter
41CE 0E15      00397         movlw   TIA_Vx_ARP_CTR
41D0 50E3      00398         movf    PLUSW1, W
41D2 260C      00399         addwf   IRQ_TMP2, F
41D4 E206      00400         bc      TIA_SW_Arp_Overrun
41D6 0E15      00401         movlw   TIA_Vx_ARP_CTR
41D8 C00C FFE3 00402         movff   IRQ_TMP2, PLUSW1
               00403 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 104


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00404         ;; branch to the end so long the counter is less than the compare value
41DC 500C      00405         movf    IRQ_TMP2, W
41DE 5C0B      00406         subwf   IRQ_TMP1, W
41E0 E22F      00407         bc      TIA_SW_Arp_End
               00408 
41E2 00409 TIA_SW_Arp_Overrun
               00410         ;; clear counter
41E2 0E15      00411         movlw   TIA_Vx_ARP_CTR
41E4 6AE3      00412         clrf    PLUSW1
               00413 
               00414         ;; increment note number (1 of 4)
41E6 0E14      00415         movlw   TIA_Vx_ARP_NOTE_NUMBER
41E8 28E3      00416         incf    PLUSW1, W
41EA 0B03      00417         andlw   0x03
41EC 6E0B      00418         movwf   IRQ_TMP1
               00419 
               00420         ;; reset note number if last one reached (TIA_Vx_NOTE_STACK_x is zero)
41EE 0E22      00421         movlw   TIA_Vx_NOTE_STACK_0
41F0 240B      00422         addwf   IRQ_TMP1, W
41F2 50E3      00423         movf    PLUSW1, W
41F4 B4D8      00424         skpnz
41F6 6A0B      00425         clrf    IRQ_TMP1
               00426 
               00427         ;; save new note number
41F8 0E14      00428         movlw   TIA_Vx_ARP_NOTE_NUMBER
41FA C00B FFE3 00429         movff   IRQ_TMP1, PLUSW1
               00430         
               00431         ;; select note
41FE 0E1E      00432         movlw   TIA_Vx_ARP_NOTE_0
4200 240B      00433         addwf   IRQ_TMP1, W
               00434 
               00435         ;; save new note number if != zero and != last note
4202 50E3      00436         movf    PLUSW1, W
4204 E01D      00437         bz      TIA_SW_Arp_NoNewNote
4206 6E0B      00438         movwf   IRQ_TMP1
4208 0E10      00439         movlw   TIA_Vx_NOTE
420A 50E3      00440         movf    PLUSW1, W
420C 180B      00441         xorwf   IRQ_TMP1, W
420E E018      00442         bz      TIA_SW_Arp_NoNewNote
4210 00443 TIA_SW_Arp_NewNote
4210 0E10      00444         movlw   TIA_Vx_NOTE
4212 C00B FFE3 00445         movff   IRQ_TMP1, PLUSW1
               00446 
               00447 
4216 0E0E      00448         movlw   TIA_Vx_PORTA_RATE
4218 50E3      00449         movf    PLUSW1, W
421A E012      00450         bz      TIA_SW_Arp_NoPorta
421C 00451 TIA_SW_Arp_Porta
421C 0E03      00452         movlw   TIA_Vx_STAT
421E 8CE3      00453         bsf     PLUSW1, Vx_STAT_PORTA_ENABLE
               00454 
               00455         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
               00456 
               00457 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 105


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4220 0E09      00458         movlw   TIA_Vx_FRQ_L
4222 CFE3 F00B 00459         movff   PLUSW1, IRQ_TMP1
4226 0E0A      00460         movlw   TIA_Vx_FRQ_H
4228 CFE3 F00C 00461         movff   PLUSW1, IRQ_TMP2    
               00462 
422C 0E1C      00463         movlw   TIA_Vx_PORTA_FRQ_L
422E C00B FFE3 00464         movff   IRQ_TMP1, PLUSW1
4232 0E1D      00465         movlw   TIA_Vx_PORTA_FRQ_H
4234 C00C FFE3 00466         movff   IRQ_TMP2, PLUSW1   
               00467 
4238 0E1A      00468     movlw   TIA_Vx_PORTA_CTR_L 
423A 6AE3      00469         clrf    PLUSW1
423C 0E1B      00470     movlw   TIA_Vx_PORTA_CTR_H 
423E 6AE3      00471         clrf    PLUSW1
               00472 
               00473     
4240 00474 TIA_SW_Arp_NoV1
               00475 
4240 00476 TIA_SW_Arp_NoPorta
               00477 
4240 00478 TIA_SW_Arp_NoNewNote
               00479 
4240 00480 TIA_SW_Arp_End
4240 0012      00481         return
               00482 
               00483 
               00484 ;; --------------------------------------------------------------------------
               00485 ;; This function handles the gates and initial note frequency
               00486 ;; --------------------------------------------------------------------------
4242 00487 TIA_SW_Note
               00488 
               00489 
               00490    
               00491         ;; check note delay counter, set/clear gate bit
4242 0E12      00492         movlw   TIA_Vx_NOTE_DELAY_CTR
4244 50E3      00493         movf    PLUSW1, W
4246 E003      00494         bz      TIA_SW_Note_NoDelay
4248 0E12      00495         movlw   TIA_Vx_NOTE_DELAY_CTR
424A 06E3      00496         decf    PLUSW1, F
               00497         rgoto   TIA_SW_Note_DelayCont
424C D03D          M         bra     label
424E 00498 TIA_SW_Note_NoDelay
424E 0E03      00499         movlw   TIA_Vx_STAT
               00500         BRA_IFSET PLUSW1, Vx_STAT_GATE_CLR_REQ, ACCESS, TIA_SW_Note_NoteOffReq
4250 B4E3          M         btfsc   reg, bit, reg_a
4252 D003          M         bra     label
               00501         BRA_IFSET PLUSW1, Vx_STAT_GATE_SET_REQ, ACCESS, TIA_SW_Note_NoteOnReq
4254 B2E3          M         btfsc   reg, bit, reg_a
4256 D019          M         bra     label
               00502         rgoto   TIA_SW_Note_DelayCont
4258 D037          M         bra     label
               00503     
425A 00504 TIA_SW_Note_NoteOffReq
425A 94E3      00505         bcf     PLUSW1, Vx_STAT_GATE_CLR_REQ
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 106


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
425C 98E3      00506     bcf     PLUSW1, Vx_STAT_GATE_NOTE_ON 
425E 0E04      00507         movlw   TIA_Vx_MODE
               00508     ; (don't clear gate bit if GSA (gate stays active) 
               00509     BRA_IFSET PLUSW1, Vx_MODE_GSA_ACTIVE, ACCESS, TIA_SW_Note_NoteOffReqSkp
4260 B0E3          M         btfsc   reg, bit, reg_a
4262 D002          M         bra     label
4264 0E03      00510         movlw   TIA_Vx_STAT
4266 96E3      00511     bcf     PLUSW1, Vx_STAT_GATE_ACTIVE
4268 00512 TIA_SW_Note_NoteOffReqSkp
               00513         ;; sync voice ENVs
4268 0E2A      00514     movlw       TIA_Vx_ENV_MODE
426A 50E3      00515     movf     PLUSW1, W
               00516     ;rrf     PLUSW1, W
               00517     ;rrncf   WREG, W
426C 0B0C      00518     andlw   0x0c
426E B10E      00519     btfsc       TIA_SW_VOICE, 0, BANKED
4270 38E8      00520     swapf   WREG, W
4272 6E0B      00521         movwf   IRQ_TMP1
               00522         ;; sync assigned ENVs
4274 0E17      00523     movlw       TIA_Vx_AMP_MOD
4276 50E3      00524         movf    PLUSW1, W
4278 0B30      00525     andlw   0x30
427A 120B      00526     iorwf   IRQ_TMP1, F
               00527     
427C 0E16      00528     movlw       TIA_Vx_PITCH_MOD    
427E 38E3      00529         swapf   PLUSW1, W
4280 0B03      00530     andlw   0x03
4282 100B      00531     iorwf   IRQ_TMP1, W
4284 ECBC F025 00532     call        TIA_SW_Hlp_ENVRelease
               00533         rgoto   TIA_SW_Note_DelayCont
4288 D01F          M         bra     label
               00534 
428A 00535 TIA_SW_Note_NoteOnReq
428A 0E03      00536         movlw   TIA_Vx_STAT
428C 92E3      00537         bcf     PLUSW1, Vx_STAT_GATE_SET_REQ
428E 88E3      00538     bsf     PLUSW1, Vx_STAT_GATE_NOTE_ON 
4290 00539 TIA_SW_Note_NoteOnReqSkp
4290 0E03      00540         movlw   TIA_Vx_STAT
4292 86E3      00541         bsf     PLUSW1, Vx_STAT_GATE_ACTIVE
               00542     
               00543         ;; sync assigned LFOs
4294 0E17      00544     movlw       TIA_Vx_AMP_MOD
4296 50E3      00545         movf    PLUSW1, W
4298 0B07      00546     andlw   0x07
429A 6E0B      00547     movwf   IRQ_TMP1
               00548     
429C 0E16      00549     movlw       TIA_Vx_PITCH_MOD    
429E 50E3      00550         movf    PLUSW1, W
42A0 0B07      00551     andlw   0x07
42A2 100B      00552     iorwf   IRQ_TMP1, W
42A4 EC8A F025 00553         call    TIA_SW_Hlp_SyncLFOs
               00554 
               00555         ;; sync voice ENVs
42A8 0E2A      00556     movlw       TIA_Vx_ENV_MODE
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 107


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
42AA 50E3      00557     movf     PLUSW1, W
               00558     ;rrf     PLUSW1, W
               00559     ;;rrncf   WREG, W
42AC 0B0C      00560     andlw   0x0c
42AE B10E      00561     btfsc       TIA_SW_VOICE, 0, BANKED
42B0 38E8      00562     swapf   WREG, W
42B2 6E0B      00563         movwf   IRQ_TMP1
               00564  
               00565         ;; sync assigned ENVs
42B4 0E17      00566     movlw       TIA_Vx_AMP_MOD
42B6 50E3      00567         movf    PLUSW1, W
42B8 0B30      00568     andlw   0x30
42BA 120B      00569     iorwf   IRQ_TMP1, F
               00570     
42BC 0E16      00571     movlw       TIA_Vx_PITCH_MOD    
42BE 38E3      00572         swapf   PLUSW1, W
42C0 0B03      00573     andlw   0x03
42C2 100B      00574     iorwf   IRQ_TMP1, W
42C4 ECA7 F025 00575         call    TIA_SW_Hlp_ENVAttack
               00576     
               00577 
               00578 
42C8 00579 TIA_SW_Note_DelayCont
               00580 
42C8 0E0C      00581         movlw   TIA_Vx_TRANSPOSE
42CA 50E3      00582         movf    PLUSW1, W
42CC 0840      00583         sublw   0x40
42CE 0AFF      00584         xorlw   0xff
42D0 6E0B      00585         movwf   IRQ_TMP1
42D2 0E10      00586         movlw   TIA_Vx_NOTE
42D4 50E3      00587         movf    PLUSW1, W
42D6 240B      00588         addwf   IRQ_TMP1, W
42D8 0F01      00589         addlw   1
42DA 6E0C      00590         movwf   IRQ_TMP2
42DC 087F      00591         sublw   0x7f
42DE E207      00592         bc      TIA_SW_Note_NoOverflow
42E0 0E0C      00593         movlw   TIA_Vx_TRANSPOSE
               00594         BRA_IFSET PLUSW1, 6, ACCESS, TIA_SW_Note_PosSaturation
42E2 BCE3          M         btfsc   reg, bit, reg_a
42E4 D002          M         bra     label
42E6 00595 TIA_SW_Note_NegSaturation
42E6 6A0C      00596         clrf    IRQ_TMP2
               00597         rgoto   TIA_SW_Note_NoOverflow
42E8 D002          M         bra     label
42EA 00598 TIA_SW_Note_PosSaturation
42EA 0E7F      00599         movlw   0x7f
42EC 6E0C      00600     movwf   IRQ_TMP2
42EE 00601 TIA_SW_Note_NoOverflow
               00602         ;; set target frequency depending on note number
42EE 500C      00603         movf    IRQ_TMP2, W
42F0 BEE8      00604     btfsc       WREG, 7; the note value
42F2 0E7F      00605         movlw 0x7f
42F4 6E0C      00606     movwf   IRQ_TMP2
               00607     
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 108


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
42F6 0E04      00608         movlw   TIA_Vx_MODE
               00609         BRA_IFSET PLUSW1, Vx_MODE_KEY_EXTENDED, ACCESS, TIA_SW_Note_KeyMode_Extended    
42F8 B6E3          M         btfsc   reg, bit, reg_a
42FA D00D          M         bra     label
42FC 00610 TIA_SW_Note_KeyMode_NonExtended 
42FC 90D8      00611     clrc
42FE 0E05      00612     movlw   TIA_Vx_KEY_OFFSET
4300 50E3      00613     movf    PLUSW1, W
4302 5E0C      00614     subwf   IRQ_TMP2, F
4304 0E00      00615     movlw   0x00
4306 B0D8      00616     skpnc
4308 0E1F      00617     movlw   0x1f
430A 640C      00618     cpfsgt  IRQ_TMP2, ACCESS
430C 500C      00619     movf    IRQ_TMP2, W
430E 36E8      00620     rlf     WREG, F
4310 36E8      00621     rlf     WREG, F
4312 34E8      00622     rlf     WREG, W
               00623     rgoto   TIA_SW_Note_TargetCopy 
4314 D002          M         bra     label
               00624 
4316 00625 TIA_SW_Note_KeyMode_Extended      
               00626     ;;etendu (7bit note to 8bit pitch)
4316 90D8      00627     clrc
4318 340C      00628     rlf     IRQ_TMP2, W
               00629 
431A 00630 TIA_SW_Note_TargetCopy
431A 6E03      00631     movwf   MIOS_PARAMETER1
               00632         
431C 0E08      00633         movlw   TIA_Vx_TARGET_FRQ_H
431E C003 FFE3 00634         movff   MIOS_PARAMETER1, PLUSW1
4322 0E07      00635         movlw   TIA_Vx_TARGET_FRQ_L
4324 6AE3      00636         clrf    PLUSW1
4326 00637 TIA_SW_Note_End
4326 0012      00638         return
               00639   
               00640     
               00641 ;; --------------------------------------------------------------------------
               00642 ;; This function handles the Note Pitch
               00643 ;; --------------------------------------------------------------------------
4328 00644 TIA_SW_Pitch
               00645         ;; skip Pitchbender+Finetune processing if PITCHRANGE == zero
4328 0E0D      00646         movlw   TIA_Vx_PITCHRANGE
432A 50E3      00647         movf    PLUSW1, W
432C E04D      00648         bz      TIA_SW_Pitch_MOD
               00649 
               00650     
               00651         ;; result stored in IRQ_TMP[12]
432E 6A0B      00652         clrf    IRQ_TMP1
4330 6A0C      00653         clrf    IRQ_TMP2
4332 6A0D      00654     clrf        IRQ_TMP3
               00655 
               00656         ;; calc IRQ_TMP[12] = pitchbender (9-bit signed)
4334 0E0B      00657         movlw   TIA_Vx_PITCHBENDER
4336 50E3      00658         movf    PLUSW1, W
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 109


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4338 6E0B      00659     movwf       IRQ_TMP1
433A E007      00660         bz      TIA_SW_Pitch_NoPitchBender
433C 00661 TIA_SW_Pitch_PitchBender
433C 90D8      00662     clrc                        ; multiply with 2
433E BE0B      00663         btfsc   IRQ_TMP1, 7
4340 80D8      00664         setc
4342 360B      00665     rlf     IRQ_TMP1, F
4344 360D      00666     rlf     IRQ_TMP3, F
4346 B00D      00667         btfsc   IRQ_TMP3, 0     
4348 1E0B      00668     comf    IRQ_TMP1, F
434A 00669 TIA_SW_Pitch_NoPitchBender
               00670 
434A 90D8      00671         clrc
               00672         ;; skip tuning if IRQ_TMP[12] == zero
434C 500B      00673         movf    IRQ_TMP1, W
434E 100C      00674         iorwf   IRQ_TMP2, W
4350 E03B      00675         bz      TIA_SW_Pitch_MOD
               00676 
4352 500B      00677         movf    IRQ_TMP1, W
4354 6FFA      00678         movwf   MUL_B_L, BANKED
4356 500C      00679         movf    IRQ_TMP2, W
4358 6FFB      00680         movwf   MUL_B_H, BANKED
               00681 
               00682         ;; get f_in[target], save it in IRQ_TMP[12]
435A 90D8      00683     clrc
435C 0E0C      00684         movlw   TIA_Vx_TRANSPOSE
435E 50E3      00685         movf    PLUSW1, W
4360 0840      00686         sublw   0x40
4362 0AFF      00687         xorlw   0xff
4364 6E0E      00688         movwf   IRQ_TMP4
4366 0E10      00689         movlw   TIA_Vx_NOTE
4368 50E3      00690         movf    PLUSW1, W
436A 240E      00691         addwf   IRQ_TMP4, W
               00692         ;; add pitchrange depending on direction with saturation
               00693         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Pitch_Decrease
436C B00D          M         btfsc   reg, bit, reg_a
436E D009          M         bra     label
4370 00694 TIA_SW_Pitch_Increase
               00695 
4370 0F01      00696         addlw   1
4372 6E0C      00697         movwf   IRQ_TMP2
4374 0E0D      00698         movlw   TIA_Vx_PITCHRANGE
4376 50E3      00699         movf    PLUSW1, W
4378 240C      00700         addwf   IRQ_TMP2, W
437A BEE8      00701         btfsc   WREG, 7
437C 0E7F      00702         movlw 0x7f
437E 6E0C      00703         movwf   IRQ_TMP2
               00704         rgoto   TIA_SW_Pitch_Increase_Cont
4380 D006          M         bra     label
4382 00705 TIA_SW_Pitch_Decrease
4382 6E0C      00706         movwf   IRQ_TMP2
4384 0E0D      00707         movlw   TIA_Vx_PITCHRANGE
4386 04E3      00708         decf    PLUSW1, W
4388 5E0C      00709         subwf   IRQ_TMP2, F
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 110


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
438A BE0C      00710         btfsc   IRQ_TMP2, 7
438C 6A0C      00711         clrf IRQ_TMP2
438E 00712 TIA_SW_Pitch_Increase_Cont
               00713         ;; set target frequency depending on note number
438E 500C      00714         movf    IRQ_TMP2, W
4390 BEE8      00715     btfsc       WREG, 7; the note value
4392 0E7F      00716         movlw 0x7f
4394 6E0C      00717     movwf   IRQ_TMP2
               00718     
4396 0E04      00719         movlw   TIA_Vx_MODE
               00720         BRA_IFSET PLUSW1, Vx_MODE_KEY_EXTENDED, ACCESS, TIA_SW_Pitch_KeyMode_Extended    
4398 B6E3          M         btfsc   reg, bit, reg_a
439A D00B          M         bra     label
439C 00721 TIA_SW_Pitch_KeyMode_NonExtended 
439C 90D8      00722     clrc
439E 0E05      00723     movlw   TIA_Vx_KEY_OFFSET
43A0 50E3      00724     movf    PLUSW1, W
43A2 5E0C      00725     subwf   IRQ_TMP2, F
43A4 0E1F      00726     movlw   0x1f
43A6 640C      00727     cpfsgt  IRQ_TMP2, ACCESS
43A8 500C      00728     movf    IRQ_TMP2, W
43AA 36E8      00729     rlf     WREG, F
43AC 36E8      00730     rlf     WREG, F
43AE 34E8      00731     rlf     WREG, W
               00732     rgoto   TIA_SW_Pitch_KeyMode_End 
43B0 D002          M         bra     label
               00733 
43B2 00734 TIA_SW_Pitch_KeyMode_Extended      
               00735     ;;etendu (7bits to 8bits note)
43B2 90D8      00736     clrc
43B4 340C      00737     rlf     IRQ_TMP2, W
               00738     
43B6 00739 TIA_SW_Pitch_KeyMode_End    
43B6 6E04      00740     movwf   MIOS_PARAMETER2
43B8 6A03      00741     clrf    MIOS_PARAMETER1
               00742     
               00743         ;; result: low-byte in WREG and MIOS_PARAMETER1, high-byte in MIOS_PARAMETER2
               00744 
               00745         ;; add and multiply to target frequency
43BA CFE2 FFDA 00746         movff   FSR1H, FSR2H
43BE 50E1      00747         movf    FSR1L, W
43C0 0F07      00748         addlw   TIA_Vx_TARGET_FRQ_L
43C2 6ED9      00749         movwf   FSR2L
43C4 ECD1 F025 00750         call    TIA_SW_Hlp_AddMul
               00751 
43C8 00752 TIA_SW_Pitch_MOD
43C8 0E2A      00753     movlw       TIA_Vx_ENV_MODE
               00754     BRA_IFCLR PLUSW1, Vx_ENV_TOPITCH_ON, ACCESS, TIA_SW_Pitch_Mods
43CA A6E3          M         btfss   reg, bit, reg_a
43CC D045          M         bra     label
               00755 
               00756     ;; store dedicated enveloppe value in MUL_A_[LH],sign in MIOS_PARAMETER3
43CE 0E40      00757     movlw   0x40
43D0 B10E      00758     btfsc   TIA_SW_VOICE, 0
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 111


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
43D2 0E80      00759     movlw   0x80
43D4 EC97 F024 00760         call    TIA_SW_Hlp_GetMOD
               00761         ;; result in IRQ_TMP[123]
43D8 C00D F005 00762     movff   IRQ_TMP3, MIOS_PARAMETER3
43DC 500C      00763     movf    IRQ_TMP2, W
               00764     ;btfsc   MIOS_PARAMETER3, 0
               00765     ;comf    IRQ_TMP2, W
43DE 0B7F      00766     andlw   0x7f
43E0 6FF9      00767     movwf   MUL_A_H
43E2 500B      00768     movf    IRQ_TMP1, W
               00769     ;btfsc   MIOS_PARAMETER3, 0
               00770     ;comf    IRQ_TMP1, W
43E4 6FF8      00771     movwf   MUL_A_L
               00772 
               00773         ;; modulate amplitude
               00774         ;; assigned LFOs and ENVs in WREG   
43E6 0E16      00775         movlw   TIA_Vx_PITCH_MOD
43E8 50E3      00776         movf    PLUSW1, W
43EA 0B3F      00777     andlw   0x3f
43EC EC97 F024 00778         call    TIA_SW_Hlp_GetMOD
               00779         ;; result in IRQ_TMP[123]
               00780    
43F0 00781 TIA_SW_Pitch_Mods_Env_ExM
               00782     ;; Modulation mode
43F0 0E2A      00783     movlw   TIA_Vx_ENV_MODE
43F2 50E3      00784     movf    PLUSW1, W
43F4 0B03      00785     andlw   0x03
43F6 28E8      00786     incf    WREG, W
               00787     BRA_IFCLR WREG, Vx_ENV_MODTYP_ExM, ACCESS, TIA_SW_Pitch_Mods_Env_EM  
43F8 A2E8          M         btfss   reg, bit, reg_a
43FA D010          M         bra     label
               00788     BRA_IFSET WREG, Vx_ENV_MODTYP_EM, ACCESS,TIA_SW_Pitch_Mods_Env_ExM_NotDoubled
43FC B0E8          M         btfsc   reg, bit, reg_a
43FE D002          M         bra     label
               00789     ;; Double the Dedicated ENVAUDx for AxB only Mode
4400 37F8      00790     rlf     MUL_A_L, F
4402 37F9      00791     rlf     MUL_A_H, F    
4404 00792 TIA_SW_Pitch_Mods_Env_ExM_NotDoubled
4404 500C      00793     movf    IRQ_TMP2, W
4406 6FFB      00794     movwf   MUL_B_H
4408 500B      00795     movf    IRQ_TMP1, W
440A 6FFA      00796     movwf   MUL_B_L
               00797     ;; multiplication
440C ECE7 F01A 00798         call    MATH_MUL16_16
4410 51FE      00799         movf    MUL_R_2, W, BANKED
4412 6E0B      00800     movwf   IRQ_TMP1   
4414 51FF      00801     movf        MUL_R_3, W, BANKED
4416 6E0C      00802     movwf   IRQ_TMP2
               00803     ;; process sign
4418 5005      00804     movf    MIOS_PARAMETER3, W
441A 1A0D      00805     xorwf   IRQ_TMP3, F
               00806 
441C 00807 TIA_SW_Pitch_Mods_Env_EM
               00808     ;; Modulation mode
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 112


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
441C 0E2A      00809     movlw   TIA_Vx_ENV_MODE
441E 50E3      00810     movf    PLUSW1, W
4420 0B03      00811     andlw   0x03
4422 28E8      00812     incf    WREG, W
               00813     BRA_IFCLR WREG, Vx_ENV_MODTYP_EM, ACCESS,TIA_SW_Pitch_Mods_Cont
4424 A0E8          M         btfss   reg, bit, reg_a
4426 D01E          M         bra     label
4428 5005      00814     movf    MIOS_PARAMETER3, W
442A 180D      00815     xorwf   IRQ_TMP3, W
442C E00D      00816         bz      TIA_SW_Pitch_Mods_Env_EM_Add
442E 00817 TIA_SW_Pitch_Mods_Env_EM_Sub
442E 500B      00818         movf    IRQ_TMP1, W
4430 5DF8      00819         subwf   MUL_A_L, W
4432 6E0B      00820     movwf   IRQ_TMP1
4434 500C      00821         movf    IRQ_TMP2, W
4436 59F9      00822         subwfb  MUL_A_H, W
4438 6E0C      00823     movwf   IRQ_TMP2
443A E203      00824     bc      TIA_SW_Pitch_Mods_Env_EM_Sub_NoCarry
443C 1E0B      00825     comf    IRQ_TMP1, F        ;;Sign already in IRQ_TMP3
443E 1E0C      00826     comf    IRQ_TMP2, F
               00827     rgoto   TIA_SW_Pitch_Mods_Cont    
4440 D011          M         bra     label
4442 00828 TIA_SW_Pitch_Mods_Env_EM_Sub_NoCarry
4442 C005 F00D 00829     movff   MIOS_PARAMETER3, IRQ_TMP3
               00830     rgoto   TIA_SW_Pitch_Mods_Cont      
4446 D00E          M         bra     label
               00831 
4448 00832 TIA_SW_Pitch_Mods_Env_EM_Add
4448 51F8      00833         movf    MUL_A_L, W
444A 260B      00834         addwf   IRQ_TMP1, F     
444C 51F9      00835         movf    MUL_A_H, W
444E 220C      00836         addwfc  IRQ_TMP2, F     
               00837         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
4450 E309      00838         bnc     TIA_SW_Pitch_Mods_Cont
4452 680B      00839         setf    IRQ_TMP1        
4454 680C      00840         setf    IRQ_TMP2        
               00841     rgoto   TIA_SW_Pitch_Mods_Cont
4456 D006          M         bra     label
               00842 
4458 00843 TIA_SW_Pitch_Mods
               00844         ;; modulate pitch
               00845         ;; assigned LFOs and ENVs in WREG
4458 0E16      00846         movlw   TIA_Vx_PITCH_MOD
445A 50E3      00847         movf    PLUSW1, W
445C 0B3F      00848     andlw   0x3f
445E E00C      00849     bz      TIA_SW_Pitch_CopyFrq
4460 EC97 F024 00850         call    TIA_SW_Hlp_GetMOD
               00851         ;; unsigned result in IRQ_TMP[12]
               00852         ;; sign in IRQ_TMP3[0]    
               00853 
4464 00854 TIA_SW_Pitch_Mods_Cont 
               00855         ;; skip tuning if IRQ_TMP[12] == zero
4464 500B      00856         movf    IRQ_TMP1, W
4466 100C      00857         iorwf   IRQ_TMP2, W
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 113


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4468 E007      00858         bz      TIA_SW_Pitch_CopyFrq
               00859     
               00860         ;; add to target frequency
446A CFE2 FFDA 00861         movff   FSR1H, FSR2H
446E 50E1      00862         movf    FSR1L, W
4470 0F07      00863         addlw   TIA_Vx_TARGET_FRQ_L
4472 6ED9      00864         movwf   FSR2L
4474 ECED F025 00865         call    TIA_SW_Hlp_Add16
               00866                                                  
4478 00867 TIA_SW_Pitch_CopyFrq
4478 0E03      00868         movlw   TIA_Vx_STAT
               00869         BRA_IFSET PLUSW1, Vx_STAT_PORTA_ENABLE, ACCESS, TIA_SW_Pitch_End
447A BCE3          M         btfsc   reg, bit, reg_a
447C D017          M         bra     label
               00870 
447E 0E07      00871         movlw   TIA_Vx_TARGET_FRQ_L
4480 CFE3 F003 00872         movff   PLUSW1, MIOS_PARAMETER1
4484 0E08      00873         movlw   TIA_Vx_TARGET_FRQ_H
4486 CFE3 F004 00874         movff   PLUSW1, MIOS_PARAMETER2    
               00875 
448A 0E09      00876         movlw   TIA_Vx_FRQ_L
448C C003 FFE3 00877         movff   MIOS_PARAMETER1, PLUSW1
4490 0E0A      00878         movlw   TIA_Vx_FRQ_H
4492 C004 FFE3 00879         movff   MIOS_PARAMETER2, PLUSW1     
               00880 
4496 EE21 F002 00881     lfsr        FSR2, TIA_AUDF0
449A B10E      00882     btfsc   TIA_SW_VOICE, 0
449C EE21 F003 00883     lfsr        FSR2, TIA_AUDF1
               00884 
44A0 1C04      00885     comf    MIOS_PARAMETER2, W
44A2 30E8      00886     rrf     WREG, W
44A4 30E8      00887     rrf     WREG, W
44A6 30E8      00888     rrf     WREG, W
44A8 0B1F      00889     andlw   0x1f
44AA 6EDF      00890     movwf   INDF2    
               00891 
44AC 00892 TIA_SW_Pitch_End
44AC 0012      00893         return
               00894 
               00895 
               00896 ;; --------------------------------------------------------------------------
               00897 ;; This function handles the Portamento
               00898 ;; --------------------------------------------------------------------------
44AE 00899 TIA_SW_Porta
44AE 0E03      00900         movlw   TIA_Vx_STAT
               00901         BRA_IFCLR PLUSW1, Vx_STAT_PORTA_ENABLE, ACCESS, TIA_SW_Porta_End
44B0 ACE3          M         btfss   reg, bit, reg_a
44B2 D0A0          M         bra     label
               00902 
44B4 EE21 F002 00903     lfsr        FSR2, TIA_AUDF0
44B8 B10E      00904     btfsc   TIA_SW_VOICE, 0
44BA EE21 F003 00905     lfsr        FSR2, TIA_AUDF1
               00906 
               00907         ;; branch depending on portamento option
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 114


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
44BE 0E04      00908         movlw   TIA_Vx_MODE
               00909         BRA_IFCLR PLUSW1, Vx_MODE_PORTA_CONST, ACCESS, TIA_SW_Porta_NORM
44C0 A4E3          M         btfss   reg, bit, reg_a
44C2 D04C          M         bra     label
               00910         ;; ------------------------------------------------------------------
               00911         ;; "constant" portamento mode (constant glide time)
44C4 00912 TIA_SW_Porta_CONST
               00913     
               00914         ;; counter -> MUL_A_[LH]
44C4 0E1A      00915         movlw   TIA_Vx_PORTA_CTR_L
44C6 CFE3 F1F8 00916         movff   PLUSW1, MUL_A_L
44CA 0E1B      00917         movlw   TIA_Vx_PORTA_CTR_H
44CC CFE3 F1F9 00918         movff   PLUSW1, MUL_A_H
               00919         ;; Add delay to portamento counter -> MUL_A_[LH]
               00920         ;; get portamento delay from envelope table 
44D0 0E0E      00921         movlw   TIA_Vx_PORTA_RATE
44D2 50E3      00922         movf    PLUSW1, W
44D4 EC3A F030 00923         call    TIA_ENV_TABLE_Get
               00924     ;; add result to counter
44D8 90D8      00925     clrc
44DA 5003      00926     movf    MIOS_PARAMETER1, W
44DC 27F8      00927         addwf   MUL_A_L, F
44DE 5004      00928     movf    MIOS_PARAMETER2, W
44E0 23F9      00929         addwfc  MUL_A_H, F
44E2 E23B      00930     bc     TIA_SW_Porta_CONST_Cont_Reached
               00931     
44E4 0E1A      00932         movlw   TIA_Vx_PORTA_CTR_L
44E6 C1F8 FFE3 00933         movff   MUL_A_L, PLUSW1
44EA 0E1B      00934         movlw   TIA_Vx_PORTA_CTR_H
44EC C1F9 FFE3 00935         movff   MUL_A_H, PLUSW1   
               00936  
               00937         ;; target frequency -> MIOS_PARAMETER[12]
44F0 0E07      00938     movlw       TIA_Vx_TARGET_FRQ_L
44F2 CFE3 F003 00939     movff       PLUSW1, MIOS_PARAMETER1
44F6 0E08      00940         movlw   TIA_Vx_TARGET_FRQ_H
44F8 CFE3 F004 00941         movff   PLUSW1, MIOS_PARAMETER2
               00942 
               00943         ;; get difference between target and previous frequency -> IRQ_TMP[12]
44FC 0E1C      00944         movlw   TIA_Vx_PORTA_FRQ_L
44FE 50E3      00945         movf    PLUSW1, W
4500 5C03      00946         subwf   MIOS_PARAMETER1, W
4502 6E0B      00947         movwf   IRQ_TMP1
4504 0E1D      00948         movlw   TIA_Vx_PORTA_FRQ_H
4506 50E3      00949         movf    PLUSW1, W
4508 5804      00950         subwfb  MIOS_PARAMETER2, W
450A 6E0C      00951         movwf   IRQ_TMP2
               00952         ;; convert IRQ_TMP[12] to absolute value
450C 900D      00953     bcf IRQ_TMP3, 0
450E A0D8      00954     btfss   STATUS, C
4510 800D      00955     bsf IRQ_TMP3, 0
4512 A0D8      00956     btfss   STATUS, C
4514 1E0B      00957     comf    IRQ_TMP1, F
4516 A0D8      00958     btfss   STATUS, C
4518 1E0C      00959     comf    IRQ_TMP2, F
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 115


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00960         ;; result in IRQ_TMP[12], sign in IRQ_TMP3[0]
               00961 
               00962         ;; increment four to ensure that target will be reached
451A 0E01      00963     movlw       1
451C 260B      00964         addwf   IRQ_TMP1, F
451E 0E00      00965         movlw   0
4520 220C      00966         addwfc  IRQ_TMP2, F
4522 C00B F1FA 00967         movff   IRQ_TMP1, MUL_B_L
4526 C00C F1FB 00968         movff   IRQ_TMP2, MUL_B_H
               00969 
               00970         ;; calc MUL_A_[LH] * MUL_B_[LH]
452A ECE7 F01A 00971         call    MATH_MUL16_16
               00972         ;; result in MUL_R_2 (low-byte) and MUL_R_3 (high-byte)
               00973     
               00974         ;; branch depending on direction
               00975         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Porta_CONST_Down
452E B00D          M         btfsc   reg, bit, reg_a
4530 D009          M         bra     label
4532 00976 TIA_SW_Porta_CONST_Up   
               00977         ;; add scaled value to starting frequency
4532 0E1C      00978         movlw   TIA_Vx_PORTA_FRQ_L
4534 50E3      00979         movf    PLUSW1, W
4536 25FE      00980         addwf   MUL_R_2, W, BANKED
4538 6E0B      00981         movwf   IRQ_TMP1
               00982 
453A 0E1D      00983         movlw   TIA_Vx_PORTA_FRQ_H
453C 50E3      00984         movf    PLUSW1, W
453E 21FF      00985         addwfc  MUL_R_3, W, BANKED
4540 6E0C      00986         movwf   IRQ_TMP2
               00987 
               00988         ;; continue at normal portamento routine
               00989         rgoto   TIA_SW_Porta_CONST_Up_Cont
4542 D033          M         bra     label
               00990     
4544 00991 TIA_SW_Porta_CONST_Down
               00992         ;; subtract scaled value from starting frequency
4544 0E1C      00993         movlw   TIA_Vx_PORTA_FRQ_L
4546 CFE3 F00B 00994         movff   PLUSW1, IRQ_TMP1
454A 0E1D      00995         movlw   TIA_Vx_PORTA_FRQ_H
454C CFE3 F00C 00996         movff   PLUSW1, IRQ_TMP2
               00997 
4550 51FE      00998         movf    MUL_R_2, W, BANKED
4552 5E0B      00999         subwf   IRQ_TMP1, F
4554 51FF      01000         movf    MUL_R_3, W, BANKED
4556 5A0C      01001         subwfb  IRQ_TMP2, F
               01002 
               01003         ;; continue at normal portamento routine
               01004         rgoto   TIA_SW_Porta_CONST_Down_Cont
4558 D033          M         bra     label
               01005 
455A 01006 TIA_SW_Porta_CONST_Cont_Reached
455A D038      01007     bra     TIA_SW_Porta_Cont_Reached
               01008 
               01009         ;; ------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 116


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01010         ;; "normal" portamento mode (non-constant glide time)
455C 01011 TIA_SW_Porta_NORM
               01012     ;; multiply rate with current frequency
               01013         ;; get portamento multiplier from envelope table -> MUL_A
455C 0E0E      01014         movlw   TIA_Vx_PORTA_RATE
455E 50E3      01015         movf    PLUSW1, W
4560 EC3A F030 01016         call    TIA_ENV_TABLE_Get
4564 C003 F1F8 01017         movff   MIOS_PARAMETER1, MUL_A_L
4568 C004 F1F9 01018         movff   MIOS_PARAMETER2, MUL_A_H
               01019 
               01020         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01021 
               01022         ;; get current frequency -> MUL_B
               01023     
456C 0E09      01024         movlw   TIA_Vx_FRQ_L
456E CFE3 F1FA 01025         movff   PLUSW1, MUL_B_L
4572 CFE3 F00B 01026     movff       PLUSW1, IRQ_TMP1
4576 0E0A      01027         movlw   TIA_Vx_FRQ_H
4578 CFE3 F1FB 01028         movff   PLUSW1, MUL_B_H
457C CFE3 F00C 01029     movff       PLUSW1, IRQ_TMP2
               01030     
4580 ECE7 F01A 01031         call    MATH_MUL16_16
               01032         ;; result in MUL_R_2 (low-byte) and MUL_R_3 (high-byte)
               01033         ;; ensure that result is != 0
4584 51FE      01034         movf    MUL_R_2, W, BANKED
4586 11FF      01035         iorwf   MUL_R_3, W, BANKED
4588 B4D8      01036         skpnz
458A 2BFE      01037         incf    MUL_R_2, F, BANKED
               01038 
               01039         ;; TIA_Vx_FRQ += result (depending on Portamento Direction)
               01040         ;movff  MUL_R_2, IRQ_TMP1
               01041 
               01042         ;; store target frequency in MIOS_PARAMETER[12]
458C 0E07      01043         movlw   TIA_Vx_TARGET_FRQ_L
458E CFE3 F003 01044         movff   PLUSW1, MIOS_PARAMETER1
4592 0E08      01045         movlw   TIA_Vx_TARGET_FRQ_H
4594 CFE3 F004 01046         movff   PLUSW1, MIOS_PARAMETER2
               01047 
               01048         ;; branch depending on portamento direction
               01049         ;; check if value > current value
4598 5003      01050         movf    MIOS_PARAMETER1, W
459A 5C0B      01051         subwf   IRQ_TMP1, W
459C 5004      01052         movf    MIOS_PARAMETER2, W
459E 580C      01053         subwfb  IRQ_TMP2, W
45A0 E20B      01054     bc TIA_SW_Porta_Down
               01055    
45A2 01056 TIA_SW_Porta_Up ;; decrement FRQ
45A2 51FE      01057         movf    MUL_R_2, W
45A4 260B      01058         addwf   IRQ_TMP1, F
45A6 51FF      01059         movf    MUL_R_3, W, BANKED
45A8 220C      01060         addwfc  IRQ_TMP2, F
               01061 
45AA 01062 TIA_SW_Porta_CONST_Up_Cont      ; re-used by ENV2 option
               01063         ;; check if value > MAX_VALUE
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 117


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
45AA 90D8      01064     clrc
45AC 500B      01065         movf    IRQ_TMP1, W
45AE 5C03      01066         subwf   MIOS_PARAMETER1, W
45B0 500C      01067         movf    IRQ_TMP2, W
45B2 5804      01068         subwfb  MIOS_PARAMETER2, W
45B4 E213      01069         bc      TIA_SW_Porta_Cont               ; branch to end if MAX_VALUE not reached
               01070         rgoto   TIA_SW_Porta_Cont_Reached               ; else copy MAX_VALUE into value and finish portamento
45B6 D00A          M         bra     label
               01071 
45B8 01072 TIA_SW_Porta_Down  ;; increment FRQ
45B8 51FE      01073         movf    MUL_R_2, W
45BA 5E0B      01074         subwf   IRQ_TMP1, F
45BC 51FF      01075         movf    MUL_R_3, W, BANKED
45BE 5A0C      01076         subwfb  IRQ_TMP2, F
               01077 
45C0 01078 TIA_SW_Porta_CONST_Down_Cont    ; re-used by ENV2 option
               01079         ;; check if value < MIN_VALUE
45C0 90D8      01080     clrc
45C2 5003      01081         movf    MIOS_PARAMETER1, W
45C4 5C0B      01082         subwf   IRQ_TMP1, W
45C6 5004      01083         movf    MIOS_PARAMETER2, W
45C8 580C      01084         subwfb  IRQ_TMP2, W
45CA E208      01085         bc      TIA_SW_Porta_Cont               ; branch to end if MIN_VALUE not reached
               01086         ; else copy MIN_VALUE into value and finish portamento
               01087         ;rgoto  TIA_SW_Porta_Cont_Reached               ; else copy MAX_VALUE into value and finish portamento
               01088         
45CC 01089 TIA_SW_Porta_Cont_Reached
45CC 0E07      01090         movlw   TIA_Vx_TARGET_FRQ_L
45CE CFE3 F00B 01091         movff   PLUSW1, IRQ_TMP1
               01092     
45D2 0E08      01093         movlw   TIA_Vx_TARGET_FRQ_H
45D4 CFE3 F00C 01094         movff   PLUSW1, IRQ_TMP2
               01095 
45D8 0E03      01096         movlw   TIA_Vx_STAT
45DA 9CE3      01097         bcf     PLUSW1, Vx_STAT_PORTA_ENABLE
               01098     
45DC 01099 TIA_SW_Porta_Cont
               01100 
               01101 
               01102     
               01103     ;; Copy Freq
45DC 0E09      01104         movlw   TIA_Vx_FRQ_L
45DE C00B FFE3 01105     movff       IRQ_TMP1, PLUSW1
45E2 0E0A      01106         movlw   TIA_Vx_FRQ_H
45E4 C00C FFE3 01107     movff       IRQ_TMP2, PLUSW1
               01108 
45E8 1C0C      01109     comf    IRQ_TMP2, W
45EA 30E8      01110     rrf     WREG, W
45EC 30E8      01111     rrf     WREG, W
45EE 30E8      01112     rrf     WREG, W
45F0 0B1F      01113     andlw   0x1f
45F2 6EDF      01114     movwf   INDF2  
               01115         
45F4 01116 TIA_SW_Porta_End    
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 118


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
45F4 0012      01117         return
               01118 
               01119 ;; --------------------------------------------------------------------------
               01120 ;; Help Function used from tia_midi.inc and tia_ccin.inc to reset ENV2
               01121 ;; --------------------------------------------------------------------------
45F6 01122 TIA_SW_Hlp_PortaCTR_Reset
45F6 C000 F001 01123         movff   FSR0, FSR1
               01124 
45FA 0E1A      01125     movlw   TIA_Vx_PORTA_CTR_L 
45FC 6AE3      01126         clrf    PLUSW1, ACCESS
45FE 0E1B      01127     movlw   TIA_Vx_PORTA_CTR_H 
4600 6AE3      01128         clrf    PLUSW1, ACCESS
               01129 
4602 0012      01130         return
               01131 
               01132 ;; --------------------------------------------------------------------------
               01133 ;; This function handles the amplitude
               01134 ;; --------------------------------------------------------------------------
4604 01135 TIA_SW_Amp
               01136     ;; TIA_AUDCx
4604 EE21 F000 01137     lfsr        FSR2, TIA_BASE
4608 0E04      01138     movlw   0x04
460A 250E      01139     addwf   TIA_SW_VOICE, W
460C 6ED9      01140     movwf   FSR2L
               01141     
               01142 
460E 01143 TIA_SW_Amp_MasterVol    
               01144     ;; Vx volume * Master Volume
460E 0E0F      01145     movlw       TIA_Vx_VOLUME
4610 50E3      01146         movf    PLUSW1, W
4612 6E0B      01147     movwf   IRQ_TMP1
4614 510B      01148     movf    TIA_MASTER_VOL, W
4616 0F01      01149         addlw   1
4618 020B      01150     mulwf   IRQ_TMP1
461A 36F3      01151     rlf     PRODL, F
461C 34F4      01152     rlf     PRODH, W
461E 6E03      01153     movwf   MIOS_PARAMETER1
4620 B4D8      01154     skpnz
               01155     rgoto   TIA_SW_Amp_Gate
4622 D090          M         bra     label
               01156 
               01157 #if 0
               01158     movlw       TIA_Vx_ENV_MODE
               01159     BRA_IFCLR PLUSW1, Vx_ENV_TOAMP_ON, ACCESS, TIA_SW_Amp_Mods
               01160 
               01161     ;; store dedicated enveloppe value in MUL_A_[LH],sign in MIOS_PARAMETER3
               01162     movlw   0x40
               01163     btfsc   TIA_SW_VOICE, 0
               01164     movlw   0x80
               01165         call    TIA_SW_Hlp_GetMOD
               01166         ;; result in IRQ_TMP[123]
               01167     movff   IRQ_TMP3, MIOS_PARAMETER3
               01168     movf    IRQ_TMP2, W
               01169     andlw   0x7f
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 119


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01170     movwf   MUL_A_H
               01171     movf    IRQ_TMP1, W
               01172     movwf   MUL_A_L
               01173 
               01174         ;; modulate amplitude
               01175         ;; assigned LFOs and ENVs in WREG   
               01176         movlw   TIA_Vx_PITCH_MOD
               01177         movf    PLUSW1, W
               01178     andlw   0x3f
               01179         call    TIA_SW_Hlp_GetMOD
               01180         ;; result in IRQ_TMP[123]
               01181    
               01182 TIA_SW_Amp_Mods_Env_ExM
               01183     ;; Modulation mode
               01184     movlw   TIA_Vx_ENV_MODE
               01185     movf    PLUSW1, W
               01186     andlw   0x03
               01187     incf    WREG, W
               01188     BRA_IFCLR WREG, Vx_ENV_MODTYP_ExM, ACCESS, TIA_SW_Amp_Mods_Env_EM  
               01189     BRA_IFSET WREG, Vx_ENV_MODTYP_EM, ACCESS,TIA_SW_Amp_Mods_Env_ExM_NotDoubled
               01190     ;; Double the Dedicated ENVAUDx for AxB only Mode
               01191     rlf     MUL_A_L, F
               01192     rlf     MUL_A_H, F    
               01193 TIA_SW_Amp_Mods_Env_ExM_NotDoubled
               01194     movf    IRQ_TMP2, W
               01195     movwf   MUL_B_H
               01196     movf    IRQ_TMP1, W
               01197     movwf   MUL_B_L
               01198     ;; multiplication
               01199         call    MATH_MUL16_16
               01200         movf    MUL_R_2, W, BANKED
               01201     movwf   IRQ_TMP1   
               01202     movf        MUL_R_3, W, BANKED
               01203     movwf   IRQ_TMP2
               01204     ;; process sign
               01205     movf    MIOS_PARAMETER3, W
               01206     xorwf   IRQ_TMP3, F
               01207 
               01208 TIA_SW_Amp_Mods_Env_EM
               01209     ;; Modulation mode
               01210     movlw   TIA_Vx_ENV_MODE
               01211     movf    PLUSW1, W
               01212     btfsc   TIA_SW_VOICE, 0
               01213     swapf   WREG, W
               01214     andlw   0x03
               01215     incf    WREG, W
               01216     BRA_IFCLR WREG, Vx_ENV_MODTYP_EM, ACCESS,TIA_SW_Amp_Mods_Cont
               01217     movf    MIOS_PARAMETER3, W
               01218         bz      TIA_SW_Amp_Mods_Env_EM_Pos
               01219 TIA_SW_Amp_Mods_Env_EM_Neg
               01220     comf    MUL_A_L, F
               01221     comf    MUL_A_H, F
               01222     movf    IRQ_TMP3, W
               01223         bz      TIA_SW_Amp_Mods_Env_EM_Pos
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 120


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01224         movf    IRQ_TMP1, W
               01225         subwf   MUL_A_L, W
               01226     movwf   IRQ_TMP1
               01227         movf    IRQ_TMP2, W
               01228         subwfb  MUL_A_H, W
               01229     movwf   IRQ_TMP2
               01230     clrf    IRQ_TMP3
               01231     bc      TIA_SW_Amp_Mods_Cont
               01232     clrf    IRQ_TMP1
               01233     clrf    IRQ_TMP2
               01234     rgoto   TIA_SW_Amp_Mods_Cont    
               01235 
               01236 TIA_SW_Amp_Mods_Env_EM_Pos
               01237         movf    MUL_A_L, W
               01238         addwf   IRQ_TMP1, F     
               01239         movf    MUL_A_H, W
               01240         addwfc  IRQ_TMP2, F     
               01241 TIA_SW_Amp_Mods_Env_EM_Set
               01242         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
               01243         bnc     TIA_SW_Amp_Mods_Cont
               01244         setf    IRQ_TMP1        
               01245         setf    IRQ_TMP2        
               01246     rgoto   TIA_SW_Amp_Mods_Cont
               01247 
               01248 TIA_SW_Amp_Mods
               01249         ;; modulate pitch
               01250         ;; assigned LFOs and ENVs in WREG
               01251         movlw   TIA_Vx_PITCH_MOD
               01252         movf    PLUSW1, W
               01253     andlw   0x3f
               01254     bz      TIA_SW_Amp_CopyFrq
               01255         call    TIA_SW_Hlp_GetMOD
               01256         ;; unsigned result in IRQ_TMP[12]
               01257         ;; sign in IRQ_TMP3[0]    
               01258 
               01259 TIA_SW_Amp_Mods_Cont 
               01260         ;; skip tuning if IRQ_TMP[12] == zero
               01261         movf    IRQ_TMP1, W
               01262         iorwf   IRQ_TMP2, W
               01263         bz      TIA_SW_Amp_Mods_End
               01264     
               01265                                      
               01266 #else
               01267 
4624 01268 TIA_SW_Amp_Mods
4624 0E2A      01269     movlw       TIA_Vx_ENV_MODE
               01270     BRA_IFCLR PLUSW1, Vx_ENV_TOAMP_ON, ACCESS, TIA_SW_Amp_Mods_Cont
4626 A4E3          M         btfss   reg, bit, reg_a
4628 D03D          M         bra     label
               01271     
               01272     ;; Modulation type in MIOS_PARAMETER3
462A 0E2A      01273     movlw   TIA_Vx_ENV_MODE
462C 50E3      01274     movf    PLUSW1, W
462E 0B03      01275     andlw   0x03
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 121


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4630 6E05      01276     movwf   MIOS_PARAMETER3
4632 2A05      01277     incf    MIOS_PARAMETER3, F
               01278 
               01279     ;; prepare enveloppe value in MIOS_PARAMETER2
               01280     ;; env2amp in WREG
4634 0E40      01281     movlw   0x40
4636 B10E      01282     btfsc   TIA_SW_VOICE, 0
4638 0E80      01283     movlw   0x80
463A EC97 F024 01284         call    TIA_SW_Hlp_GetMOD
               01285         ;; result in IRQ_TMP[123]
463E 500C      01286     movf    IRQ_TMP2, W
4640 B00D      01287     btfsc   IRQ_TMP3, 0
4642 1C0C      01288     comf    IRQ_TMP2, W
4644 0B7F      01289     andlw   0x7f
4646 6E04      01290     movwf   MIOS_PARAMETER2
               01291 
               01292         ;; modulate amplitude
               01293         ;; assigned LFOs and ENVs in WREG
4648 0E17      01294         movlw   TIA_Vx_AMP_MOD
464A 50E3      01295         movf    PLUSW1, W
464C 0B3F      01296     andlw   0x3f
464E EC97 F024 01297         call    TIA_SW_Hlp_GetMOD
               01298         ;; result in IRQ_TMP[123]
               01299     
               01300 
4652 01301 TIA_SW_Amp_Mods_Env_ExM
               01302     BRA_IFCLR MIOS_PARAMETER3, Vx_ENV_MODTYP_ExM, ACCESS, TIA_SW_Amp_Mods_Env_EM
4652 A205          M         btfss   reg, bit, reg_a
4654 D017          M         bra     label
               01303     BRA_IFSET MIOS_PARAMETER3, Vx_ENV_MODTYP_EM, ACCESS, TIA_SW_Amp_Mods_Env_EM_ExM
4656 B005          M         btfsc   reg, bit, reg_a
4658 D010          M         bra     label
465A 3604      01304     rlcf   MIOS_PARAMETER2, F
465C 0E3F      01305     movlw   0x3f
465E 6EF4      01306         movwf   PRODH
4660 6AF3      01307         clrf    PRODL
4662 EC11 F025 01308         call    TIA_SW_Hlp_AddOffset16
               01309     ;; result in IRQ_TMP[12]
4666 500C      01310     movf    IRQ_TMP2, W
4668 BE0C      01311     btfsc   IRQ_TMP2, 7
466A 0E7F      01312     movlw   0x7f
               01313     
466C 0204      01314     mulwf   MIOS_PARAMETER2
466E 36F3      01315     rlf     PRODL, F
4670 34F4      01316     rlf     PRODH, W
4672 BEE8      01317     btfsc   WREG, 7
4674 0E7F      01318     movlw   0x7f
4676 6E04      01319     movwf   MIOS_PARAMETER2    
               01320     rgoto   TIA_SW_Amp_Mods_Env_Cont
4678 D00C          M         bra     label
               01321     
467A 01322 TIA_SW_Amp_Mods_Env_EM_ExM    
467A 500C      01323     movf    IRQ_TMP2, W
467C 0204      01324     mulwf   MIOS_PARAMETER2
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 122


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
467E 50F4      01325     movf    PRODH, W
4680 6E0C      01326     movwf   IRQ_TMP2
4682 6A0B      01327     clrf    IRQ_TMP1
               01328 
4684 01329 TIA_SW_Amp_Mods_Env_EM
4684 3004      01330     rrf     MIOS_PARAMETER2, W 
4686 EC0D F025 01331         call    TIA_SW_Hlp_AddOffset
               01332         ;; result in IRQ_TMP[12]  
468A 500C      01333     movf    IRQ_TMP2, W
468C BE0C      01334     btfsc   IRQ_TMP2, 7
468E 0E7F      01335     movlw   0x7f
4690 6E04      01336     movwf   MIOS_PARAMETER2
               01337     
4692 01338 TIA_SW_Amp_Mods_Env_Cont
4692 5003      01339     movf        MIOS_PARAMETER1, W
4694 04E8      01340     decf    WREG, W
4696 0204      01341     mulwf   MIOS_PARAMETER2
4698 36F3      01342     rlf     PRODL, F
469A 34F4      01343     rlf     PRODH, W
469C BEE8      01344     btfsc   WREG, 7
469E 0E7F      01345     movlw   0x7f
46A0 6E03      01346     movwf   MIOS_PARAMETER1
               01347     rgoto   TIA_SW_Amp_Mods_End
46A2 D00E          M         bra     label
               01348     
46A4 01349 TIA_SW_Amp_Mods_Cont
               01350         ;; modulate amplitude
               01351         ;; assigned LFOs and ENVs in WREG
46A4 0E17      01352         movlw   TIA_Vx_AMP_MOD
46A6 50E3      01353         movf    PLUSW1, W
46A8 0B3F      01354     andlw   0x3f
46AA E00A      01355     bz      TIA_SW_Amp_Mods_End
46AC EC97 F024 01356         call    TIA_SW_Hlp_GetMOD
               01357         ;; result in IRQ_TMP[123]
46B0 B00D      01358     btfsc   IRQ_TMP3, 0
46B2 6A03      01359     clrf    MIOS_PARAMETER1
46B4 5003      01360     movf    MIOS_PARAMETER1, W
46B6 020C      01361     mulwf   IRQ_TMP2
46B8 44F4      01362     rlncf   PRODH, W
46BA BEE8      01363     btfsc   WREG, 7
46BC 0E7F      01364     movlw   0x7f
46BE 6E03      01365     movwf   MIOS_PARAMETER1
               01366 #endif
46C0 01367 TIA_SW_Amp_Mods_End
               01368 
46C0 0E03      01369     movlw       TIA_Vx_STAT
               01370         BRA_IFSET PLUSW1, Vx_STAT_ENV_ACTIVE, ACCESS, TIA_SW_Amp_Vel   
46C2 BAE3          M         btfsc   reg, bit, reg_a
46C4 D002          M         bra     label
               01371         BRA_IFCLR PLUSW1, Vx_STAT_GATE_NOTE_ON, ACCESS, TIA_SW_Amp_Vel_End
46C6 A8E3          M         btfss   reg, bit, reg_a
46C8 D03D          M         bra     label
46CA 01372 TIA_SW_Amp_Vel    
46CA 0E04      01373     movlw       TIA_Vx_MODE
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 123


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01374     BRA_IFCLR PLUSW1, Vx_MODE_VEL2AMP_ON, ACCESS, TIA_SW_Amp_Vel_End
46CC A8E3          M         btfss   reg, bit, reg_a
46CE D03A          M         bra     label
               01375     ;; Velocity calc
46D0 0E29      01376     movlw   TIA_Vx_DEPTH_VEL
46D2 50E3      01377     movf        PLUSW1, W
46D4 6E0C      01378     movwf   IRQ_TMP2
46D6 0A40      01379     xorlw   0x40
46D8 E035      01380     bz      TIA_SW_Amp_Vel_End
               01381     
46DA 6A0D      01382     clrf    IRQ_TMP3
46DC 0E29      01383     movlw   TIA_Vx_DEPTH_VEL
46DE ACE3      01384         btfss   PLUSW1, 6, ACCESS
46E0 800D      01385     bsf     IRQ_TMP3, 0
               01386     
46E2 500C      01387     movf    IRQ_TMP2, W
46E4 0B3F      01388         andlw   0x3f
               01389         ;; depth * velocity
46E6 90D8      01390         clrc
46E8 34E8      01391         rlf     WREG, W
               01392         ;addlw  2
               01393     ;movwf   IRQ_TMP2
               01394        
46EA B00D      01395     btfsc       IRQ_TMP3, 0, ACCESS
               01396     rgoto   TIA_SW_Amp_Vel_Neg
46EC D01A          M         bra     label
               01397     
46EE 01398 TIA_SW_Amp_Vel_Pos   
46EE 0F02      01399         addlw   2
46F0 6E0C      01400     movwf   IRQ_TMP2
               01401     
46F2 0E28      01402     movlw       TIA_Vx_LAST_VEL
46F4 50E3      01403         movf    PLUSW1, W
46F6 020C      01404     mulwf   IRQ_TMP2
46F8 90D8      01405     clrc
46FA 36F3      01406     rlf     PRODL, F
46FC 34F4      01407     rlf     PRODH, W
46FE 0F01      01408         addlw   1
4700 6E0C      01409     movwf   IRQ_TMP2
               01410     
4702 0E04      01411     movlw       TIA_Vx_MODE
               01412     BRA_IFSET PLUSW1, Vx_MODE_GSA_ACTIVE, ACCESS, TIA_SW_Amp_Vel_Pos_GSA
4704 B0E3          M         btfsc   reg, bit, reg_a
4706 D006          M         bra     label
4708 5003      01413         movf    MIOS_PARAMETER1, W
470A 020C      01414     mulwf   IRQ_TMP2
470C 36F3      01415     rlf     PRODL, F
470E 34F4      01416     rlf     PRODH, W
4710 6E03      01417     movwf   MIOS_PARAMETER1
               01418     rgoto   TIA_SW_Amp_Vel_End
4712 D018          M         bra     label
4714 01419 TIA_SW_Amp_Vel_Pos_GSA
4714 5003      01420         movf    MIOS_PARAMETER1, W
4716 087F      01421     sublw   0x7f
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 124


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4718 020C      01422     mulwf   IRQ_TMP2
471A 36F3      01423     rlf     PRODL, F
471C 34F4      01424     rlf     PRODH, W
471E 2603      01425     addwf   MIOS_PARAMETER1, F
               01426     rgoto   TIA_SW_Amp_Vel_End
4720 D011          M         bra     label
               01427 
4722 01428 TIA_SW_Amp_Vel_Neg
4722 1CE8      01429     comf    WREG, W
4724 0B7F      01430     andlw   0x7f
4726 0F02      01431     addlw       2
4728 6E0C      01432     movwf   IRQ_TMP2
               01433     
472A 0E28      01434     movlw       TIA_Vx_LAST_VEL
472C 50E3      01435         movf    PLUSW1, W
472E 020C      01436     mulwf   IRQ_TMP2
4730 90D8      01437     clrc
4732 36F3      01438     rlf     PRODL, F
4734 34F4      01439     rlf     PRODH, W
4736 0F01      01440         addlw   1
4738 6E0C      01441     movwf   IRQ_TMP2
               01442 
473A 5003      01443         movf    MIOS_PARAMETER1, W
473C 020C      01444     mulwf   IRQ_TMP2
473E 36F3      01445     rlf     PRODL, F
4740 34F4      01446     rlf     PRODH, W
4742 5E03      01447     subwf   MIOS_PARAMETER1, F
               01448     ;rgoto   TIA_SW_Amp_Vel_End
4744 01449 TIA_SW_Amp_Vel_End
               01450 
4744 01451 TIA_SW_Amp_Gate
4744 0E2A      01452     movlw       TIA_Vx_ENV_MODE
               01453     BRA_IFCLR PLUSW1, Vx_ENV_TOAMP_ON, ACCESS, TIA_SW_Amp_Gate_Act
4746 A4E3          M         btfss   reg, bit, reg_a
4748 D003          M         bra     label
474A 0E03      01454     movlw       TIA_Vx_STAT
               01455     BRA_IFSET PLUSW1, Vx_STAT_ENV_ACTIVE, ACCESS, TIA_SW_Amp_CopyAmp
474C BAE3          M         btfsc   reg, bit, reg_a
474E D018          M         bra     label
4750 01456 TIA_SW_Amp_Gate_Act
4750 0E03      01457     movlw       TIA_Vx_STAT
               01458     BRA_IFSET PLUSW1, Vx_STAT_GATE_ACTIVE, ACCESS, TIA_SW_Amp_CopyAmp
4752 B6E3          M         btfsc   reg, bit, reg_a
4754 D015          M         bra     label
4756 0E0F      01459         movlw   0x0f
4758 14DF      01460         andwf   INDF2, W
475A E00C      01461     bz      TIA_SW_Amp_PolynomResync
               01462 
475C 01463 TIA_SW_Amp_Gate_FadeOut
475C 6E0C      01464     movwf   IRQ_TMP2
475E 0E02      01465     movlw   DEFAULT_TIA_GATE_FADEOUT
4760 5A0C      01466     subwfb  IRQ_TMP2, F
4762 E201      01467     bc      TIA_SW_Amp_Gate_FadeOut_Norm
4764 01468 TIA_SW_Amp_Gate_FadeOut_Clear
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 125


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4764 6A0C      01469     clrf    IRQ_TMP2
               01470     
4766 01471 TIA_SW_Amp_Gate_FadeOut_Norm
4766 0EF0      01472         movlw   0xf0
4768 16DF      01473         andwf   INDF2, F
476A 0E0F      01474     movlw       0x0f
476C 140C      01475         andwf   IRQ_TMP2, W
476E 10DF      01476         iorwf   INDF2, W
4770 0B0F      01477     andlw   0x0f
4772 6EDF      01478     movwf   INDF2
4774 01479 TIA_SW_Amp_PolynomResync
4774 0E04      01480     movlw       TIA_Vx_MODE
               01481     BRA_IFCLR PLUSW1, Vx_MODE_GRP_ACTIVE, ACCESS, TIA_SW_Amp_End
4776 A2E3          M         btfss   reg, bit, reg_a
4778 D00B          M         bra     label
477A 0EFC      01482     movlw   -4
477C 8EDB      01483     bsf     PLUSW2, 7
               01484     rgoto   TIA_SW_Amp_End
477E D008          M         bra     label
               01485 
4780 01486 TIA_SW_Amp_CopyAmp
4780 90D8      01487     clrc
4782 3203      01488         rrf     MIOS_PARAMETER1, F
4784 4203      01489     rrncf   MIOS_PARAMETER1, F
4786 4003      01490     rrncf   MIOS_PARAMETER1, W
4788 0B0F      01491         andlw   0x0f
478A 6EDF      01492         movwf   INDF2
478C 0EFC      01493     movlw   -4
478E 9EDB      01494     bcf     PLUSW2, 7
4790 01495 TIA_SW_Amp_End
4790 0012      01496     return
               01497 
               01498 
               01499 ;; --------------------------------------------------------------------------
               01500 ;; This function handles the LFOs
               01501 ;; --------------------------------------------------------------------------
4792 01502 TIA_SW_LFO
               01503         ;; LFO number in TIA_SW_LFO_NUMBER - calculate base address
               01504         ;lfsr   FSR1, TIA_LFO1_BASE
               01505         ;movf   TIA_SW_LFO_NUMBER, W, BANKED
               01506         ;mullw  TIA_LFOx_RECORD_LEN
               01507         ;movf   PRODL, W
               01508         ;addwf  FSR1L, F
               01509 
               01510         ;; clear result register and skip LFO if not enabled
4792 0E00      01511         movlw   TIA_LFOx_MODE
               01512         BRA_IFSET PLUSW1, LFOx_MODE_ENABLE, ACCESS, TIA_SW_LFO_Enabled
4794 B0E3          M         btfsc   reg, bit, reg_a
4796 D005          M         bra     label
4798 01513 TIA_SW_LFO_Disabled
4798 0E05      01514         movlw   TIA_LFOx_RVALUE_L
479A 6AE3      01515         clrf    PLUSW1
479C 0E06      01516         movlw   TIA_LFOx_RVALUE_H
479E 6AE3      01517         clrf    PLUSW1
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 126


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01518         rgoto   TIA_SW_LFO_End
47A0 D03D          M         bra     label
47A2 01519 TIA_SW_LFO_Enabled
               01520         
               01521         ;; increment step counter, store result also in IRQ_TMP1
47A2 0E02      01522         movlw   TIA_LFOx_CTR
47A4 2AE3      01523         incf    PLUSW1, F
47A6 CFE3 F00B 01524         movff   PLUSW1, IRQ_TMP1
               01525 
               01526         ;; get CTR/ADD entry from LFO table depending on LFO Rate
47AA 0E01      01527         movlw   TIA_LFOx_RATE
47AC 50E3      01528         movf    PLUSW1, W
47AE ECCA F030 01529         call    TIA_LFO_TABLE_Get
               01530         ;; result: CTR value in WREG and MIOS_PARAMETER1, ADD value in MIOS_PARAMETER2
               01531 
               01532         ;; exit if max step counter value (CTR) not reached
               01533         ;;      movf    MIOS_PARAMETER1, W
47B2 5C0B      01534         subwf   IRQ_TMP1, W     ; result of LFOx_CTR in IRQ_TMP1
47B4 E333      01535         bnc     TIA_SW_LFO_End
               01536 
               01537         ;; else clear step counter
47B6 0E02      01538         movlw   TIA_LFOx_CTR
47B8 6AE3      01539         clrf    PLUSW1
               01540 
               01541         ;; skip multiply routine if LFO_x_DEPTH is 0x40 (zero depth)
47BA 0E04      01542         movlw   TIA_LFOx_DEPTH
47BC 50E3      01543         movf    PLUSW1, W
47BE 0A40      01544         xorlw   0x40
47C0 E105      01545         bnz     TIA_SW_LFO_DepthOk
47C2 01546 TIA_SW_LFO_Depth40
               01547         ;; clear 16bit result value registers and exit
47C2 0E05      01548         movlw   TIA_LFOx_RVALUE_L
47C4 6AE3      01549         clrf    PLUSW1
47C6 0E06      01550         movlw   TIA_LFOx_RVALUE_H
47C8 6AE3      01551         clrf    PLUSW1
               01552         rgoto   TIA_SW_LFO_End
47CA D028          M         bra     label
47CC 01553 TIA_SW_LFO_DepthOk
               01554 
               01555         ;; add or subtract ADD value to linear LFO value
47CC 0E03      01556         movlw   TIA_LFOx_VALUE
47CE CFE3 F00D 01557         movff   PLUSW1, IRQ_TMP3
               01558 
47D2 0E00      01559         movlw   TIA_LFOx_MODE
               01560         BRA_IFSET PLUSW1, LFOx_MODE_DECINC, ACCESS, TIA_SW_LFO_Dec
47D4 BEE3          M         btfsc   reg, bit, reg_a
47D6 D008          M         bra     label
47D8 01561 TIA_SW_LFO_Inc
47D8 5004      01562         movf    MIOS_PARAMETER2, W              ; get ADD value
47DA 260D      01563         addwf   IRQ_TMP3, F                     ; add to linear LFO value
47DC E30D      01564         bnc     TIA_SW_LFO_Cont                 ; skip next if max value (0xff) not reached
47DE 1C0D      01565         comf    IRQ_TMP3, W                     ; subtract the missing ticks
47E0 260D      01566         addwf   IRQ_TMP3, F
47E2 0E00      01567         movlw   TIA_LFOx_MODE
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 127


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
47E4 8EE3      01568         bsf     PLUSW1, LFOx_MODE_DECINC                ; switch to decrement
               01569         rgoto   TIA_SW_LFO_Cont
47E6 D008          M         bra     label
               01570 
47E8 01571 TIA_SW_LFO_Dec
47E8 5004      01572         movf    MIOS_PARAMETER2, W              ; get ADD value
47EA 5E0D      01573         subwf   IRQ_TMP3, F                     ; decrement from linear LFO value
47EC E205      01574         bc      TIA_SW_LFO_Cont                 ; skip next if min value (0x00) not reached
47EE 1C0D      01575         comf    IRQ_TMP3, W                     ; add the missing ticks
47F0 0F01      01576         addlw   1
47F2 260D      01577         addwf   IRQ_TMP3, F
47F4 0E00      01578         movlw   TIA_LFOx_MODE
47F6 9EE3      01579         bcf     PLUSW1, LFOx_MODE_DECINC                ; switch to increment
47F8 01580 TIA_SW_LFO_Cont
               01581 
               01582         ;; write back IRQ_TMP3 -> TIA_LFOx_VALUE
47F8 0E03      01583         movlw   TIA_LFOx_VALUE
47FA C00D FFE3 01584         movff   IRQ_TMP3, PLUSW1
               01585 
               01586         ;; convert linear LFO value to waveform by using the TIA_SW_LFO_Hlp_Waveform function
               01587         ;; LFO mode in IRQ_TMP1
47FE 0E00      01588         movlw   TIA_LFOx_MODE
4800 CFE3 F00B 01589         movff   PLUSW1, IRQ_TMP1
               01590         ;; LFO depth in IRQ_TMP2
4804 0E04      01591         movlw   TIA_LFOx_DEPTH
4806 CFE3 F00C 01592         movff   PLUSW1, IRQ_TMP2
               01593         ;; linear LFO value in WREG
480A 500D      01594         movf    IRQ_TMP3, W
               01595         ;; process waveform
               01596     
480C EC37 F025 01597         call    TIA_SW_LFO_Hlp_Waveform
               01598     
               01599         ;; store 16bit result in RVALUE registers
4810 0E05      01600         movlw   TIA_LFOx_RVALUE_L
4812 CFF3 FFE3 01601         movff   PRODL, PLUSW1
4816 0E06      01602         movlw   TIA_LFOx_RVALUE_H
4818 CFF4 FFE3 01603         movff   PRODH, PLUSW1
481C 01604 TIA_SW_LFO_End
481C 0012      01605         return
               01606 
               01607 
               01608 ;; --------------------------------------------------------------------------
               01609 ;; This function handles the ENVs
               01610 ;; expects TIA_ENVx_CURVES bitfield (lower or upper nibble) in WREG
               01611 ;; 
               01612 ;; TIA_ENVx_CURVES.7 and TIA_ENVx_CURVES.3 contain the ACCENT flag which
               01613 ;; is used in TB303 mode (copied to IRQ_TMP4.3
               01614 ;; --------------------------------------------------------------------------
481E 01615 TIA_SW_ENV
481E 0B07      01616         andlw   0x07
4820 6E0E      01617         movwf   IRQ_TMP4
               01618     
4822 510F      01619     movf    TIA_SW_ENV_NUMBER, W, BANKED
4824 0BFE      01620     andlw   0xfe
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 128


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4826 E108      01621     bnz  TIA_SW_ENV_VxStatSkp
               01622 
               01623         ;; Vx dedicated Env clear/set Active
4828 0E03      01624     movlw   TIA_Vx_STAT
482A 9ADB      01625     bcf     PLUSW2, Vx_STAT_ENV_ACTIVE
482C 0E00      01626         movlw   TIA_ENVx_MODE
482E 50E3      01627     movf    PLUSW1, W
4830 0B1F      01628     andlw   0x1f
4832 E002      01629     bz  TIA_SW_ENV_VxStatSkp
4834 0E03      01630     movlw   TIA_Vx_STAT
4836 8ADB      01631     bsf     PLUSW2, Vx_STAT_ENV_ACTIVE    
4838 01632 TIA_SW_ENV_VxStatSkp
               01633 
               01634         ;; prepare call of TIA_SW_ENV_GetBendedValue
4838 0E07      01635         movlw   TIA_ENVx_CURVE
483A CFE3 F00C 01636         movff   PLUSW1, IRQ_TMP2
483E 0E02      01637         movlw   TIA_ENVx_CTR_H
4840 CFE3 F00B 01638         movff   PLUSW1, IRQ_TMP1
               01639 
               01640         ;; branch depending on ENV state
4844 0E00      01641         movlw   TIA_ENVx_MODE
               01642         BRA_IFSET PLUSW1, ENVx_MODE_RELEASE, ACCESS, TIA_SW_ENV_Release
4846 B6E3          M         btfsc   reg, bit, reg_a
4848 D03E          M         bra     label
               01643         BRA_IFCLR PLUSW1, ENVx_MODE_ATTACK, ACCESS, TIA_SW_ENV_Calc
484A A0E3          M         btfss   reg, bit, reg_a
484C D054          M         bra     label
               01644         BRA_IFSET PLUSW1, ENVx_MODE_SUSTAIN, ACCESS, TIA_SW_ENV_Sustain
484E B4E3          M         btfsc   reg, bit, reg_a
4850 D032          M         bra     label
               01645         BRA_IFSET PLUSW1, ENVx_MODE_DECAY, ACCESS, TIA_SW_ENV_Decay
4852 B2E3          M         btfsc   reg, bit, reg_a
4854 D013          M         bra     label
               01646 
4856 01647 TIA_SW_ENV_Attack
               01648         ;; get attack rate depending on curve setting
4856 0E03      01649         movlw   TIA_ENVx_ATTACK
4858 CFE3 F00D 01650         movff   PLUSW1, IRQ_TMP3
485C 500E      01651         movf    IRQ_TMP4, W
485E 0B01      01652         andlw   0x01
4860 EC06 F026 01653         call    TIA_SW_ENV_GetBendedValue
               01654         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01655 
               01656         ;; add to ENV counter
4864 0E01      01657         movlw   TIA_ENVx_CTR_L
4866 50E3      01658         movf    PLUSW1, W
4868 2603      01659         addwf   MIOS_PARAMETER1, F
486A 0E02      01660         movlw   TIA_ENVx_CTR_H
486C 50E3      01661         movf    PLUSW1, W
486E 2204      01662         addwfc  MIOS_PARAMETER2, F
4870 E342      01663         bnc     TIA_SW_ENV_Calc
               01664 
               01665         ;; if value >= 0xffff: set to 0xffff, switch to Decay
4872 6803      01666         setf    MIOS_PARAMETER1
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 129


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4874 6804      01667         setf    MIOS_PARAMETER2
4876 0E00      01668         movlw   TIA_ENVx_MODE
4878 82E3      01669         bsf     PLUSW1, ENVx_MODE_DECAY
               01670         rgoto   TIA_SW_ENV_Calc
487A D03D          M         bra     label
               01671     
               01672     
               01673 
487C 01674 TIA_SW_ENV_Decay
               01675         ;; get decay rate depending on curve setting
487C 0E04      01676         movlw   TIA_ENVx_DECAY
487E CFE3 F00D 01677         movff   PLUSW1, IRQ_TMP3
               01678 
4882 500E      01679         movf    IRQ_TMP4, W
4884 0B02      01680         andlw   0x02
4886 EC06 F026 01681         call    TIA_SW_ENV_GetBendedValue
               01682         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01683 
               01684         ;; subtraction with current counter value
488A 0E01      01685         movlw   TIA_ENVx_CTR_L
488C CFE3 F00B 01686         movff   PLUSW1, IRQ_TMP1
4890 0E02      01687         movlw   TIA_ENVx_CTR_H
4892 CFE3 F00C 01688         movff   PLUSW1, IRQ_TMP2
               01689 
4896 5003      01690         movf    MIOS_PARAMETER1, W
4898 5C0B      01691         subwf   IRQ_TMP1, W
489A 6E03      01692         movwf   MIOS_PARAMETER1
489C 5004      01693         movf    MIOS_PARAMETER2, W
489E 580C      01694         subwfb  IRQ_TMP2, W
48A0 6E04      01695         movwf   MIOS_PARAMETER2
48A2 E309      01696         bnc     TIA_SW_ENV_Sustain
               01697 
               01698         ;; check if counter value < sustain value
48A4 0E05      01699         movlw   TIA_ENVx_SUSTAIN
48A6 34E3      01700         rlf     PLUSW1, W
48A8 0BFE      01701         andlw   0xfe
48AA 6E0B      01702         movwf   IRQ_TMP1
48AC 0E00      01703         movlw   0x00
48AE 5C03      01704         subwf   MIOS_PARAMETER1, W
48B0 500B      01705         movf    IRQ_TMP1, W
48B2 5804      01706         subwfb  MIOS_PARAMETER2, W
48B4 E220      01707         bc      TIA_SW_ENV_Calc
               01708 
48B6 01709 TIA_SW_ENV_Sustain
               01710         ;; write sustain value into counter
48B6 0E05      01711         movlw   TIA_ENVx_SUSTAIN
48B8 34E3      01712         rlf     PLUSW1, W
48BA 0BFE      01713         andlw   0xfe
48BC 6E04      01714         movwf   MIOS_PARAMETER2
48BE 6A03      01715         clrf    MIOS_PARAMETER1
               01716 
48C0 0E00      01717         movlw   TIA_ENVx_MODE
48C2 84E3      01718         bsf     PLUSW1, ENVx_MODE_SUSTAIN
               01719         rgoto   TIA_SW_ENV_Calc
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 130


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
48C4 D018          M         bra     label
               01720 
48C6 01721 TIA_SW_ENV_Release
               01722         ;; get release rate depending on curve setting
48C6 0E06      01723         movlw   TIA_ENVx_RELEASE
48C8 CFE3 F00D 01724         movff   PLUSW1, IRQ_TMP3
48CC 500E      01725         movf    IRQ_TMP4, W
48CE 0B04      01726         andlw   0x04
48D0 EC06 F026 01727         call    TIA_SW_ENV_GetBendedValue
               01728         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01729         
               01730         ;; subtraction with current counter value
48D4 0E01      01731         movlw   TIA_ENVx_CTR_L
48D6 CFE3 F00B 01732         movff   PLUSW1, IRQ_TMP1
48DA 0E02      01733         movlw   TIA_ENVx_CTR_H
48DC CFE3 F00C 01734         movff   PLUSW1, IRQ_TMP2
               01735 
48E0 5003      01736         movf    MIOS_PARAMETER1, W
48E2 5C0B      01737         subwf   IRQ_TMP1, W
48E4 6E03      01738         movwf   MIOS_PARAMETER1
48E6 5004      01739         movf    MIOS_PARAMETER2, W
48E8 580C      01740         subwfb  IRQ_TMP2, W
48EA 6E04      01741         movwf   MIOS_PARAMETER2
48EC E204      01742         bc      TIA_SW_ENV_Calc
               01743 
               01744         ;; zero reached
48EE 6A03      01745         clrf    MIOS_PARAMETER1
48F0 6A04      01746         clrf    MIOS_PARAMETER2
48F2 0E00      01747         movlw   TIA_ENVx_MODE
48F4 6AE3      01748         clrf    PLUSW1
48F6 01749 TIA_SW_ENV_Calc
               01750         ;; copy MIOS_PARAMETER[12] to TIA_ENVx_CTR_[LH]
48F6 0E01      01751         movlw   TIA_ENVx_CTR_L
48F8 C003 FFE3 01752         movff   MIOS_PARAMETER1, PLUSW1
48FC 0E02      01753         movlw   TIA_ENVx_CTR_H
48FE C004 FFE3 01754         movff   MIOS_PARAMETER2, PLUSW1
               01755 
               01756         ;; calculate envelope value depending on envelope rate
               01757         
               01758         ;; clear ENV ResultValue Registers
4902 0E09      01759         movlw   TIA_ENVx_RVALUE_L
4904 6AE3      01760         clrf    PLUSW1
4906 0E0A      01761         movlw   TIA_ENVx_RVALUE_H
4908 6AE3      01762         clrf    PLUSW1
               01763 
               01764         ;; skip multiply routine if ENV_x_DEPTH is 0x40
490A 0E08      01765         movlw   TIA_ENVx_DEPTH
490C 50E3      01766         movf    PLUSW1, W
490E 0A40      01767         xorlw 0x40
4910 E00D      01768         bz      TIA_SW_ENV_End
               01769 
               01770         ;; convert linear ENV value to waveform by using the TIA_SW_ENV_Hlp_Waveform function
               01771         ;; depth in IRQ_TMP2
4912 0E08      01772         movlw   TIA_ENVx_DEPTH
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 131


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4914 CFE3 F00C 01773         movff   PLUSW1, IRQ_TMP2
               01774         ;; linear ENV value in WREG
4918 0E02      01775         movlw   TIA_ENVx_CTR_H
491A 30E3      01776         rrf     PLUSW1, W
               01777         ;; process waveform
491C EC2F F025 01778         call    TIA_SW_ENV_Hlp_Waveform
               01779         ;; store 16bit result in RVALUE registers
4920 0E09      01780         movlw   TIA_ENVx_RVALUE_L
4922 CFF3 FFE3 01781         movff   PRODL, PLUSW1
4926 0E0A      01782         movlw   TIA_ENVx_RVALUE_H
4928 CFF4 FFE3 01783         movff   PRODH, PLUSW1
492C 01784 TIA_SW_ENV_End
492C 0012      01785         return
               01786 
               01787 
               01788 ;; --------------------------------------------------------------------------
               01789 ;; Help Function: add modulation values depending on enabled sources
               01790 ;; In: Enabled LFOs and ENCs in WREG, 7-bit offset in IRQ_TMP4
               01791 ;; Out: signed 16bit result value in IRQ_TMP[12]
               01792 ;; --------------------------------------------------------------------------
492E 01793 TIA_SW_Hlp_GetMOD
492E 6A0B      01794         clrf    IRQ_TMP1
4930 6A0C      01795         clrf    IRQ_TMP2
4932 6A0D      01796         clrf    IRQ_TMP3
4934 6E0E      01797         movwf   IRQ_TMP4        ; save assigned LFOs and ENVs in IRQ_TMP4
               01798 
               01799         ;; add all enabled LFO values (16 bit -> 24 bit)
               01800         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_1, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO1
4936 A00E          M         btfss   reg, bit, reg_a
4938 D00A          M         bra     label
493A 01801 TIA_SW_Hlp_GetMOD_LFO1
493A 51A5      01802         movf    TIA_LFO1_BASE + TIA_LFOx_RVALUE_L, W, BANKED
493C 260B      01803         addwf   IRQ_TMP1, F
493E 51A6      01804         movf    TIA_LFO1_BASE + TIA_LFOx_RVALUE_H, W, BANKED
4940 220C      01805         addwfc  IRQ_TMP2, F
4942 0E00      01806         movlw   0x00
4944 BFA6      01807         btfsc   TIA_LFO1_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
4946 0EFF      01808         movlw   0xff
4948 B0D8      01809         skpnc
494A 0F01      01810         addlw   1
494C 260D      01811         addwf   IRQ_TMP3, F
494E 01812 TIA_SW_Hlp_GetMOD_NoLFO1
               01813 
               01814         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_2, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO2
494E A20E          M         btfss   reg, bit, reg_a
4950 D00A          M         bra     label
4952 01815 TIA_SW_Hlp_GetMOD_LFO2
4952 51AC      01816         movf    TIA_LFO2_BASE + TIA_LFOx_RVALUE_L, W, BANKED
4954 260B      01817         addwf   IRQ_TMP1, F
4956 51AD      01818         movf    TIA_LFO2_BASE + TIA_LFOx_RVALUE_H, W, BANKED
4958 220C      01819         addwfc  IRQ_TMP2, F
495A 0E00      01820         movlw   0x00
495C BFAD      01821         btfsc   TIA_LFO2_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
495E 0EFF      01822         movlw   0xff
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 132


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4960 B0D8      01823         skpnc
4962 0F01      01824         addlw   1
4964 260D      01825         addwf   IRQ_TMP3, F
4966 01826 TIA_SW_Hlp_GetMOD_NoLFO2
               01827 
               01828         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_3, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO3
4966 A40E          M         btfss   reg, bit, reg_a
4968 D00A          M         bra     label
496A 01829 TIA_SW_Hlp_GetMOD_LFO3
496A 51B3      01830         movf    TIA_LFO3_BASE + TIA_LFOx_RVALUE_L, W, BANKED
496C 260B      01831         addwf   IRQ_TMP1, F
496E 51B4      01832         movf    TIA_LFO3_BASE + TIA_LFOx_RVALUE_H, W, BANKED
4970 220C      01833         addwfc  IRQ_TMP2, F
4972 0E00      01834         movlw   0x00
4974 BFB4      01835         btfsc   TIA_LFO3_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
4976 0EFF      01836         movlw   0xff
4978 B0D8      01837         skpnc
497A 0F01      01838         addlw   1
497C 260D      01839         addwf   IRQ_TMP3, F
497E 01840 TIA_SW_Hlp_GetMOD_NoLFO3
               01841 
               01842         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_4, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO4
497E A60E          M         btfss   reg, bit, reg_a
4980 D00A          M         bra     label
4982 01843 TIA_SW_Hlp_GetMOD_LFO4
4982 51BA      01844         movf    TIA_LFO4_BASE + TIA_LFOx_RVALUE_L, W, BANKED
4984 260B      01845         addwf   IRQ_TMP1, F
4986 51BB      01846         movf    TIA_LFO4_BASE + TIA_LFOx_RVALUE_H, W, BANKED
4988 220C      01847         addwfc  IRQ_TMP2, F
498A 0E00      01848         movlw   0x00
498C BFBB      01849         btfsc   TIA_LFO4_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
498E 0EFF      01850         movlw   0xff
4990 B0D8      01851         skpnc
4992 0F01      01852         addlw   1
4994 260D      01853         addwf   IRQ_TMP3, F
4996 01854 TIA_SW_Hlp_GetMOD_NoLFO4
               01855 
               01856         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_1, ACCESS, TIA_SW_Hlp_GetMOD_NoENV1
4996 A80E          M         btfss   reg, bit, reg_a
4998 D00A          M         bra     label
499A 01857 TIA_SW_Hlp_GetMOD_ENV1
499A 51DB      01858         movf    TIA_ENV1_BASE + TIA_ENVx_RVALUE_L, W, BANKED
499C 260B      01859         addwf   IRQ_TMP1, F
499E 51DC      01860         movf    TIA_ENV1_BASE + TIA_ENVx_RVALUE_H, W, BANKED
49A0 220C      01861         addwfc  IRQ_TMP2, F
49A2 0E00      01862         movlw   0x00
49A4 BFDC      01863         btfsc   TIA_ENV1_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
49A6 0EFF      01864         movlw   0xff
49A8 B0D8      01865         skpnc
49AA 0F01      01866         addlw   1
49AC 260D      01867         addwf   IRQ_TMP3, F
49AE 01868 TIA_SW_Hlp_GetMOD_NoENV1
               01869 
               01870         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_2, ACCESS, TIA_SW_Hlp_GetMOD_NoENV2
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 133


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
49AE AA0E          M         btfss   reg, bit, reg_a
49B0 D00A          M         bra     label
49B2 01871 TIA_SW_Hlp_GetMOD_ENV2
49B2 51E6      01872         movf    TIA_ENV2_BASE + TIA_ENVx_RVALUE_L, W, BANKED
49B4 260B      01873         addwf   IRQ_TMP1, F
49B6 51E7      01874         movf    TIA_ENV2_BASE + TIA_ENVx_RVALUE_H, W, BANKED
49B8 220C      01875         addwfc  IRQ_TMP2, F
49BA 0E00      01876         movlw   0x00
49BC BFE7      01877         btfsc   TIA_ENV2_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
49BE 0EFF      01878         movlw   0xff
49C0 B0D8      01879         skpnc
49C2 0F01      01880         addlw   1
49C4 260D      01881         addwf   IRQ_TMP3, F
49C6 01882 TIA_SW_Hlp_GetMOD_NoENV2
               01883 
               01884         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_A0, ACCESS, TIA_SW_Hlp_GetMOD_NoENVAUD0
49C6 AC0E          M         btfss   reg, bit, reg_a
49C8 D00A          M         bra     label
49CA 01885 TIA_SW_Hlp_GetMOD_ENVAUD0
49CA 51C5      01886         movf    TIA_V1_ENV_BASE + TIA_ENVx_RVALUE_L, W, BANKED
49CC 260B      01887         addwf   IRQ_TMP1, F
49CE 51C6      01888         movf    TIA_V1_ENV_BASE + TIA_ENVx_RVALUE_H, W, BANKED
49D0 220C      01889         addwfc  IRQ_TMP2, F
49D2 0E00      01890         movlw   0x00
49D4 BFC6      01891         btfsc   TIA_V1_ENV_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
49D6 0EFF      01892         movlw   0xff
49D8 B0D8      01893         skpnc
49DA 0F01      01894         addlw   1
49DC 260D      01895         addwf   IRQ_TMP3, F
49DE 01896 TIA_SW_Hlp_GetMOD_NoENVAUD0
               01897 
               01898         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_A1, ACCESS, TIA_SW_Hlp_GetMOD_NoENVAUD1
49DE AE0E          M         btfss   reg, bit, reg_a
49E0 D00A          M         bra     label
49E2 01899 TIA_SW_Hlp_GetMOD_ENVAUD1
49E2 51D0      01900         movf    TIA_V2_ENV_BASE + TIA_ENVx_RVALUE_L, W, BANKED
49E4 260B      01901         addwf   IRQ_TMP1, F
49E6 51D1      01902         movf    TIA_V2_ENV_BASE + TIA_ENVx_RVALUE_H, W, BANKED
49E8 220C      01903         addwfc  IRQ_TMP2, F
49EA 0E00      01904         movlw   0x00
49EC BFD1      01905         btfsc   TIA_V2_ENV_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
49EE 0EFF      01906         movlw   0xff
49F0 B0D8      01907         skpnc
49F2 0F01      01908         addlw   1
49F4 260D      01909         addwf   IRQ_TMP3, F
49F6 01910 TIA_SW_Hlp_GetMOD_NoENVAUD1
               01911         
               01912         ;; saturate to absolute 16 bit-value, keep sign in IRQ_TMP3[0]
               01913         BRA_IFSET IRQ_TMP3, 7, ACCESS, TIA_SW_Hlp_GetMOD_Negative
49F6 BE0D          M         btfsc   reg, bit, reg_a
49F8 D006          M         bra     label
49FA 01914 TIA_SW_Hlp_GetMOD_Positive
49FA 500D      01915         movf    IRQ_TMP3, W
49FC E00D      01916         bz      TIA_SW_Hlp_GetMOD_Cont
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 134


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
49FE 680B      01917         setf    IRQ_TMP1
4A00 680C      01918         setf    IRQ_TMP2
4A02 6A0D      01919         clrf    IRQ_TMP3        ; save sign in IRQ_TMP3
               01920         rgoto   TIA_SW_Hlp_GetMOD_Cont
4A04 D009          M         bra     label
               01921 
4A06 01922 TIA_SW_Hlp_GetMOD_Negative
4A06 500D      01923         movf    IRQ_TMP3, W
4A08 0B7F      01924         andlw   0x7f
4A0A E102      01925         bnz     TIA_SW_Hlp_GetMOD_Negative_C
4A0C 6A0B      01926         clrf    IRQ_TMP1
4A0E 6A0C      01927         clrf    IRQ_TMP2
4A10 01928 TIA_SW_Hlp_GetMOD_Negative_C
4A10 1E0B      01929         comf    IRQ_TMP1, F     ; invert result
4A12 1E0C      01930         comf    IRQ_TMP2, F
4A14 0E01      01931         movlw   0x01            ; save sign in IRQ_TMP3
4A16 6E0D      01932         movwf   IRQ_TMP3
4A18 01933 TIA_SW_Hlp_GetMOD_Cont
               01934 
4A18 0012      01935         return
               01936 
               01937 ;; --------------------------------------------------------------------------
               01938 ;; Help Function to add a 7-bit offset to IRQ_TMP[123] and saturate
               01939 ;; In:  offset in WREG, absolute 16-bit value in IRQ_TMP[12], sign in IRQ_TMP3[0]
               01940 ;; Out: New value in IRQ_TMP[12]
               01941 ;; --------------------------------------------------------------------------
4A1A 01942 TIA_SW_Hlp_AddOffset
4A1A 90D8      01943         clrc
4A1C 34E8      01944         rlf     WREG, W
4A1E 6EF4      01945         movwf   PRODH
4A20 6AF3      01946         clrf    PRODL
               01947         ;;      rgoto   TIA_SW_Hlp_AddOffset16
               01948 
               01949 ;; --------------------------------------------------------------------------
               01950 ;; Help Function to add a 16-bit offset to IRQ_TMP[123] and saturate
               01951 ;; In:  offset in PROD[LH], absolute 16-bit value in IRQ_TMP[12], sign in IRQ_TMP3[0]
               01952 ;; Out: New value in IRQ_TMP[12]
               01953 ;; --------------------------------------------------------------------------
4A22 01954 TIA_SW_Hlp_AddOffset16
               01955         ;; add offset and saturate
               01956         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_AddOffset16_Negative
4A22 B00D          M         btfsc   reg, bit, reg_a
4A24 D008          M         bra     label
4A26 01957 TIA_SW_Hlp_AddOffset16_Positive
4A26 50F3      01958         movf    PRODL, W        ; add offset
4A28 260B      01959         addwf   IRQ_TMP1, F
4A2A 50F4      01960         movf    PRODH, W
4A2C 220C      01961         addwfc  IRQ_TMP2, F
4A2E E30C      01962         bnc     TIA_SW_Hlp_AddOffset16_End
4A30 680B      01963         setf    IRQ_TMP1        ; saturate
4A32 680C      01964         setf    IRQ_TMP2
               01965         rgoto   TIA_SW_Hlp_AddOffset16_End
4A34 D009          M         bra     label
4A36 01966 TIA_SW_Hlp_AddOffset16_Negative
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 135


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4A36 500B      01967         movf    IRQ_TMP1, W     ; subtract offset
4A38 5CF3      01968         subwf   PRODL, W
4A3A 6E0B      01969         movwf   IRQ_TMP1
4A3C 500C      01970         movf    IRQ_TMP2, W
4A3E 58F4      01971         subwfb  PRODH, W
4A40 6E0C      01972         movwf   IRQ_TMP2
4A42 E202      01973         bc      TIA_SW_Hlp_AddOffset16_End
4A44 6A0B      01974         clrf    IRQ_TMP1
4A46 6A0C      01975         clrf    IRQ_TMP2
4A48 01976 TIA_SW_Hlp_AddOffset16_End
               01977 
4A48 0012      01978         return
               01979 
               01980 ;; --------------------------------------------------------------------------
               01981 ;; Help Function: Get absolute value
               01982 ;; IN:  signed 16-bit value in IRQ_TMP[12]
               01983 ;; Out: unsigned absolute value in IRQ_TMP[12]
               01984 ;;      sign in IRQ_TMP3[0]
               01985 ;; --------------------------------------------------------------------------
4A4A 01986 TIA_SW_Hlp_GetAbs16
               01987         ;; convert IRQ_TMP[12] to unsigned integer, keep sign in IRQ_TMP3[0]
4A4A 6A0D      01988         clrf    IRQ_TMP3
               01989         BRA_IFCLR IRQ_TMP2, 7, ACCESS, TIA_SW_Hlp_GetABS16_Pos
4A4C AE0C          M         btfss   reg, bit, reg_a
4A4E D006          M         bra     label
4A50 01990 TIA_SW_Hlp_GetABS16_Neg
4A50 800D      01991         bsf     IRQ_TMP3, 0     ; memorize sign in IRQ_TMP3[0]
4A52 1E0B      01992         comf    IRQ_TMP1, F
4A54 1E0C      01993         comf    IRQ_TMP2, F
4A56 2A0B      01994         incf    IRQ_TMP1, F
4A58 B4D8      01995         skpnz
4A5A 2A0C      01996         incf    IRQ_TMP2, F
4A5C 01997 TIA_SW_Hlp_GetABS16_Pos
4A5C 0012      01998         return
               01999 
               02000 
               02001 ;; --------------------------------------------------------------------------
               02002 ;; Help Function for ENV Waveforms (resuses the LFO Waveform routine)
               02003 ;; In:  ENV_x_VALUE in WREG
               02004 ;;      ENV_x_DEPTH in IRQ_TMP2,
               02005 ;;      Accent flag in IRQ_TMP4.3
               02006 ;; Out: Result in PROD[LH]
               02007 ;; --------------------------------------------------------------------------
4A5E 02008 TIA_SW_ENV_Hlp_Waveform
               02009 
               02010 ;       BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_SW_ENV_Hlp_Waveform_NotTB303
               02011 ;TIA_SW_ENV_Hlp_Waveform_TB303
               02012 ;       movwf   IRQ_TMP1
               02013 ;       ;; in TB303 mode the depth parameter is used as "env mod" which is always positive
               02014 ;       ;; modify depth depending on ACCENT flag
               02015 ;       rrf     IRQ_TMP2, W
               02016 ;       andlw   0x3f
               02017 ;       movwf   IRQ_TMP2
               02018 ;       BRA_IFCLR IRQ_TMP4, 3, ACCESS, TIA_SW_ENV_Hlp_Waveform_NoAcc
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 136


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02019 ;TIA_SW_ENV_Hlp_Waveform_Acc
               02020 ;;      addlw   0x10
               02021 ;       movwf   IRQ_TMP2
               02022 ;TIA_SW_ENV_Hlp_Waveform_NoAcc
               02023 ;       movf    IRQ_TMP1, W
               02024 ;       andlw   0x7f
               02025 ;       mulwf   IRQ_TMP2, ACCESS
               02026 ;       return
               02027 
               02028 ;TIA_SW_ENV_Hlp_Waveform_NotTB303
               02029         ;; set mode to 0x10, don't overwrite WREG
4A5E 6A0B      02030         clrf    IRQ_TMP1
4A60 880B      02031         bsf     IRQ_TMP1, 4     ; (triangle waveform)
               02032 
               02033         ;; convert linear envelope value
4A62 0B7F      02034         andlw   0x7f
4A64 BC0C      02035         btfsc   IRQ_TMP2, 6; shift positive values to > 0x0000
4A66 0F80      02036         addlw 0x80      
4A68 AC0C      02037         btfss   IRQ_TMP2, 6; inversion if depth < 0x40
4A6A 0A7F      02038         xorlw 0x7f      
               02039         rgoto   TIA_SW_ENV_Hlp_Waveform_Cont
4A6C D002          M         bra     label
               02040 
               02041 ;; --------------------------------------------------------------------------
               02042 ;; Help Function for LFO and ENV Waveforms
               02043 ;; In:  LFO_x_VALUE in WREG
               02044 ;;      LFO_x_MODE in IRQ_TMP1
               02045 ;;      LFO_x_DEPTH in IRQ_TMP2,
               02046 ;;      LFO/ENV number in TIA_SW_LFO_NUMBER
               02047 ;;      pointer to LFOx_BASE in FSR1
               02048 ;; Out: Result in PROD[LH]
               02049 ;;      Scaled Value in IRQ_TMP1
               02050 ;; --------------------------------------------------------------------------
4A6E 02051 TIA_SW_LFO_Hlp_Waveform
               02052         ;; invert if negative depth (<0x40)
4A6E AC0C      02053         btfss   IRQ_TMP2, 6
4A70 0AFF      02054         xorlw 0xff
               02055 
               02056         ;; envelope waveform routine continues here
4A72 02057 TIA_SW_ENV_Hlp_Waveform_Cont
4A72 6E0D      02058         movwf   IRQ_TMP3
               02059 
               02060         ;; get absolute value of depth from TIA_DEPTH_TABLE
               02061         ;; (to keep it compatible with MIDIbox TIA V1.5)
4A74 500C      02062         movf    IRQ_TMP2, W
4A76 D8C3      02063         rcall   TIA_SW_Hlp_Abs7
4A78 0F3E      02064         addlw   TIA_DEPTH_TABLE & 0xff
4A7A 6EF6      02065         movwf   TBLPTRL
4A7C 6AF7      02066         clrf    TBLPTRH
4A7E 0E32      02067         movlw   TIA_DEPTH_TABLE >> 8
4A80 22F7      02068         addwfc  TBLPTRH, F
4A82 0009      02069         tblrd*+
4A84 50F5      02070         movf    TABLAT, W
4A86 6E0C      02071         movwf   IRQ_TMP2
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 137


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02072         
               02073         ;; branch depending on selected waveform
4A88 380B      02074         swapf   IRQ_TMP1, W
4A8A 0B07      02075         andlw   0x07
               02076         JUMPTABLE_2BYTES_UNSECURE
4A8C ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               02077         rgoto   TIA_SW_LFO_Hlp_WFBranch_0
4A90 D007          M         bra     label
               02078         rgoto   TIA_SW_LFO_Hlp_WFBranch_1
4A92 D00A          M         bra     label
               02079         rgoto   TIA_SW_LFO_Hlp_WFBranch_2
4A94 D00D          M         bra     label
               02080         rgoto   TIA_SW_LFO_Hlp_WFBranch_3
4A96 D011          M         bra     label
               02081         rgoto   TIA_SW_LFO_Hlp_WFBranch_4
4A98 D014          M         bra     label
               02082         rgoto   TIA_SW_LFO_Hlp_WFBranch_5
4A9A D02A          M         bra     label
               02083         rgoto   TIA_SW_LFO_Hlp_WFBranch_6
4A9C D001          M         bra     label
               02084         rgoto   TIA_SW_LFO_Hlp_WFBranch_7
4A9E D000          M         bra     label
               02085 
4AA0 02086 TIA_SW_LFO_Hlp_WFBranch_0       ; Sine
4AA0 02087 TIA_SW_LFO_Hlp_WFBranch_6       ; (reserved)
4AA0 02088 TIA_SW_LFO_Hlp_WFBranch_7       ; (reserved)
4AA0 500D      02089         movf    IRQ_TMP3, W
4AA2 ECD0 F018 02090         call    TIA_SIN_TABLE_Get
               02091         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4AA6 D025          M         bra     label
               02092 
4AA8 02093 TIA_SW_LFO_Hlp_WFBranch_1       ; Triangle
               02094         ;; Triangle: return unsigned value
4AA8 500D      02095         movf    IRQ_TMP3, W
4AAA AE0D      02096         btfss   IRQ_TMP3, 7
4AAC 0A7F      02097         xorlw   0x7f
               02098         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4AAE D021          M         bra     label
               02099 
4AB0 02100 TIA_SW_LFO_Hlp_WFBranch_2       ; sawtooth
               02101         ;; Sawtooth: x/2, MODE_DECINC is the eight bit
4AB0 300D      02102         rrf     IRQ_TMP3, W
4AB2 0B7F      02103         andlw   0x7f
4AB4 BE0B      02104         btfsc   IRQ_TMP1, LFOx_MODE_DECINC ; (IRQ_TMP1=LFO_x_MODE)
4AB6 0980      02105         iorlw   0x80
               02106         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4AB8 D01C          M         bra     label
4ABA 02107 TIA_SW_LFO_Hlp_WFBranch_3       ; pulse
               02108         ;; Pulse: 0x00 when Dec, 0xff when Inc, take inversion bit also into account
4ABA 0E00      02109         movlw   0x00
4ABC BE0B      02110         btfsc   IRQ_TMP1, LFOx_MODE_DECINC; (IRQ_TMP1=LFO_x_MODE)
4ABE 0EFF      02111         movlw 0xff 
               02112         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4AC0 D018          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 138


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4AC2 02113 TIA_SW_LFO_Hlp_WFBranch_4       ; random
               02114         ;; each second LFO is in S&H mode
               02115         BRA_IFCLR TIA_SW_LFO_NUMBER, 0, BANKED, TIA_SW_LFO_Hlp_WFBranch_4_Random
4AC2 A10F          M         btfss   reg, bit, reg_a
4AC4 D00C          M         bra     label
4AC6 02116 TIA_SW_LFO_Hlp_WFBranch_4_S_H
4AC6 500D      02117         movf    IRQ_TMP3, W     ; latch on period match
4AC8 0E05      02118         movlw   TIA_LFOx_RVALUE_L
4ACA B4D8      02119         skpnz
4ACC 0EFE      02120         movlw   TIA_LFOx_RVALUE_L - TIA_LFOx_RECORD_LEN
4ACE CFE3 FFF3 02121         movff   PLUSW1, PRODL
               02122 
4AD2 0E06      02123         movlw   TIA_LFOx_RVALUE_H
4AD4 B4D8      02124         skpnz
4AD6 0EFF      02125         movlw   TIA_LFOx_RVALUE_H - TIA_LFOx_RECORD_LEN
4AD8 CFE3 FFF4 02126         movff   PLUSW1, PRODH
               02127         rgoto   TIA_SW_LFO_Hlp_Waveform_End
4ADC D011          M         bra     label
               02128 
4ADE 02129 TIA_SW_LFO_Hlp_WFBranch_4_Random
4ADE 511D      02130         movf    TIA_LFO_RANDOM_SEED_H, W, BANKED
4AE0 0B55      02131         andlw   0x55
4AE2 6E0B      02132         movwf   IRQ_TMP1
4AE4 511C      02133         movf    TIA_LFO_RANDOM_SEED_L, W, BANKED
4AE6 0BAA      02134         andlw   0xaa
4AE8 100B      02135         iorwf   IRQ_TMP1, W
4AEA 24CE      02136         addwf   TMR1L, W        ; super-random ;-)
4AEC 18CC      02137         xorwf   TMR2, W
               02138         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
4AEE D001          M         bra     label
               02139 
4AF0 02140 TIA_SW_LFO_Hlp_WFBranch_5       ; (AIN)
               02141 #if ENABLE_AIN_LFO_WAVEFORM
               02142         movf    TIA_SW_LFO_NUMBER, W, BANKED
               02143         movff   FSR1L, IRQ_TMP1         ; save FSR1
               02144         movff   FSR1H, IRQ_TMP3
               02145         call    MIOS_AIN_PinGet         ; get value of analog pin
               02146         movff   IRQ_TMP1, FSR1L         ; restore FSR1
               02147         movff   IRQ_TMP3, FSR1H
               02148         SET_BSR TIA_BASE
               02149         rrf     MIOS_PARAMETER2, F      ; convert 10bit to 8bit
               02150         rrf     MIOS_PARAMETER1, F
               02151         rrf     MIOS_PARAMETER2, F
               02152         rrf     MIOS_PARAMETER1, W
               02153 
               02154         ;; biased at 0x80
               02155         BRA_IFSET WREG, 7, ACCESS, TIA_SW_LFO_Hlp_WFBranch_Cont
               02156         xorlw   0x7f
               02157         addlw   1
               02158         btfsc   WREG, 7
               02159         movlw 0x7f
               02160 #else
4AF0 0E80      02161         movlw   0x80
               02162 #endif
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 139


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02163         ;;      rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
               02164 
4AF2 02165 TIA_SW_LFO_Hlp_WFBranch_Cont
4AF2 6E0B      02166         movwf   IRQ_TMP1
               02167 
               02168         ;; process scaling (depth * scaled value)
4AF4 0B7F      02169         andlw   0x7f            ; remove sign from value
4AF6 020C      02170         mulwf   IRQ_TMP2        ; multiply with depth (in IRQ_TMP2)
               02171         ;; result in PROD[LH]
               02172 
               02173         ;; invert if DECINC flag not set
               02174         BRA_IFSET IRQ_TMP1, 7, ACCESS, TIA_SW_LFO_Hlp_Waveform_End
4AF8 BE0B          M         btfsc   reg, bit, reg_a
4AFA D002          M         bra     label
4AFC 1EF3      02175         comf    PRODL, F
4AFE 1EF4      02176         comf    PRODH, F
4B00 02177 TIA_SW_LFO_Hlp_Waveform_End
4B00 0012      02178         return
               02179 
               02180 
               02181 ;; --------------------------------------------------------------------------
               02182 ;; Help Function to sync all LFOs
               02183 ;; --------------------------------------------------------------------------
4B02 02184 TIA_SW_Hlp_SyncAllLFOs
4B02 EE21 F0A0 02185         lfsr    FSR2, TIA_LFO1_BASE + TIA_LFOx_MODE
4B06 0E04      02186         movlw   0x04
4B08 6E0B      02187         movwf   IRQ_TMP1
4B0A 02188 TIA_SW_Hlp_SyncAllLFOs_Loop
4B0A EC9A F025 02189         call    TIA_SW_Hlp_SyncLFO_Now
4B0E 2E0B      02190         decfsz  IRQ_TMP1, F
               02191         rgoto   TIA_SW_Hlp_SyncAllLFOs_Loop
4B10 D7FC          M         bra     label
4B12 0012      02192         return
               02193 
               02194 ;; --------------------------------------------------------------------------
               02195 ;; Help Function for gate bit, syncs the LFOs
               02196 ;; In: TIA_Vx_PITCH_MOD | TIA_Vx_VOLUME_MOD | assigned filter flags
               02197 ;; --------------------------------------------------------------------------
4B14 02198 TIA_SW_Hlp_SyncLFOs
4B14 EE21 F0A0 02199         lfsr    FSR2, TIA_LFO1_BASE + TIA_LFOx_MODE
4B18 6E0B      02200         movwf   IRQ_TMP1
4B1A D806      02201         rcall   TIA_SW_Hlp_SyncSingleLFO
4B1C 320B      02202         rrf     IRQ_TMP1, F
4B1E D804      02203         rcall   TIA_SW_Hlp_SyncSingleLFO
4B20 320B      02204         rrf     IRQ_TMP1, F
4B22 D802      02205         rcall   TIA_SW_Hlp_SyncSingleLFO
4B24 320B      02206         rrf     IRQ_TMP1, F
4B26 D800      02207         rcall   TIA_SW_Hlp_SyncSingleLFO
               02208 
               02209 
4B28 02210 TIA_SW_Hlp_SyncSingleLFO
               02211         BRA_IFSET INDF2, LFOx_MODE_SYNC_ALL, ACCESS, TIA_SW_Hlp_SyncLFO_Now
4B28 B4DF          M         btfsc   reg, bit, reg_a
4B2A D004          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 140


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02212         BRA_IFCLR IRQ_TMP1, 0, ACCESS, TIA_SW_Hlp_SyncLFO_Skip
4B2C A00B          M         btfss   reg, bit, reg_a
4B2E D00C          M         bra     label
               02213         BRA_IFCLR INDF2, LFOx_MODE_SYNC, ACCESS, TIA_SW_Hlp_SyncLFO_Skip
4B30 A2DF          M         btfss   reg, bit, reg_a
4B32 D00A          M         bra     label
4B34 02214 TIA_SW_Hlp_SyncLFO_Now
4B34 9EDF      02215         bcf     INDF2, LFOx_MODE_DECINC
4B36 2AD9      02216         incf    FSR2L, F        ; switch to LFO_x_RATE
4B38 2AD9      02217         incf    FSR2L, F        ; switch to LFO_x_CTR
4B3A 6ADE      02218         clrf    POSTINC2        ; clear counter,
               02219                                 ; switch to LFO_x_VALUE
4B3C 0E80      02220         movlw   0x80            ; write 0x80 into value
4B3E 6EDE      02221         movwf   POSTINC2
               02222                                 ; switch to LFO_x_DEPTH
4B40 2AD9      02223         incf    FSR2L, F        ; switch to LFO_x_RVALUE_L
4B42 6ADE      02224         clrf    POSTINC2        ; clear LFO_x_RAVLUE_L
4B44 6ADE      02225         clrf    POSTINC2        ; clear LFO_x_RAVLUE_H
               02226 
4B46 0012      02227         return
               02228         
4B48 02229 TIA_SW_Hlp_SyncLFO_Skip
4B48 0E07      02230         movlw   TIA_LFOx_RECORD_LEN             ; switch to LFO_x+1_MODE
4B4A 26D9      02231         addwf   FSR2L, F
4B4C 0012      02232         return
               02233 
               02234 ;; --------------------------------------------------------------------------
               02235 ;; Help Function for gate bit, sets ENVs to attack mode
               02236 ;; In: TIA_Vx_ENVS | assigned filter flags
               02237 ;; --------------------------------------------------------------------------
4B4E 02238 TIA_SW_Hlp_ENVAttack
               02239         ;; set envelope generators to attack mode if voice (or filter) has been assigned
4B4E 6E0B      02240         movwf   IRQ_TMP1
               02241 
               02242         ;movf   IRQ_TMP1, W
4B50 0B11      02243         andlw   0x11
4B52 E002      02244         bz      TIA_SW_Hlp_ENVAttack_Not1
4B54 0E01      02245         movlw   (1 << ENVx_MODE_ATTACK)
4B56 6FD2      02246         movwf   TIA_ENV1_BASE + TIA_ENVx_MODE, BANKED
4B58 02247 TIA_SW_Hlp_ENVAttack_Not1
               02248 
4B58 500B      02249         movf    IRQ_TMP1, W
4B5A 0B22      02250         andlw   0x22
4B5C E002      02251         bz      TIA_SW_Hlp_ENVAttack_Not2
4B5E 0E01      02252         movlw   (1 << ENVx_MODE_ATTACK)
4B60 6FDD      02253         movwf   TIA_ENV2_BASE + TIA_ENVx_MODE, BANKED
4B62 02254 TIA_SW_Hlp_ENVAttack_Not2
               02255 
4B62 500B      02256         movf    IRQ_TMP1, W
4B64 0B0C      02257     andlw       0x0c
4B66 E002      02258         bz      TIA_SW_Hlp_ENVAttack_Not3
4B68 0E01      02259         movlw   (1 << ENVx_MODE_ATTACK)
4B6A 6FBC      02260         movwf   TIA_V1_ENV_BASE + TIA_ENVx_MODE, BANKED
4B6C 02261 TIA_SW_Hlp_ENVAttack_Not3
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 141


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02262 
4B6C 500B      02263         movf    IRQ_TMP1, W
4B6E 0BC0      02264         andlw   0xc0
4B70 E002      02265         bz      TIA_SW_Hlp_ENVAttack_Not4
4B72 0E01      02266         movlw   (1 << ENVx_MODE_ATTACK)
4B74 6FC7      02267         movwf   TIA_V2_ENV_BASE + TIA_ENVx_MODE, BANKED
4B76 02268 TIA_SW_Hlp_ENVAttack_Not4
4B76 0012      02269         return
               02270 
               02271 ;; --------------------------------------------------------------------------
               02272 ;; Help Function for gate bit, sets ENVs to release mode
               02273 ;; In: TIA_Vx_ENVS | assigned filter flags
               02274 ;; --------------------------------------------------------------------------
4B78 02275 TIA_SW_Hlp_ENVRelease
               02276         ;; set envelope generators to release mode if voice (or filter) has been assigned
4B78 6E0B      02277         movwf   IRQ_TMP1
               02278 
4B7A 0B11      02279         andlw   0x11
4B7C E002      02280         bz      TIA_SW_Hlp_ENVRelease_Not1
4B7E 0E08      02281         movlw   (1 << ENVx_MODE_RELEASE)
4B80 6FD2      02282         movwf   TIA_ENV1_BASE + TIA_ENVx_MODE, BANKED
4B82 02283 TIA_SW_Hlp_ENVRelease_Not1
               02284 
4B82 500B      02285         movf    IRQ_TMP1, W
4B84 0B22      02286         andlw   0x22
4B86 E002      02287         bz      TIA_SW_Hlp_ENVRelease_Not2
4B88 0E08      02288         movlw   (1 << ENVx_MODE_RELEASE)
4B8A 6FDD      02289         movwf   TIA_ENV2_BASE + TIA_ENVx_MODE, BANKED
4B8C 02290 TIA_SW_Hlp_ENVRelease_Not2
               02291 
4B8C 500B      02292         movf    IRQ_TMP1, W
4B8E 0B0C      02293     andlw       0x0c
4B90 E002      02294         bz      TIA_SW_Hlp_ENVRelease_Not3
4B92 0E08      02295         movlw   (1 << ENVx_MODE_RELEASE)
4B94 6FBC      02296         movwf   TIA_V1_ENV_BASE + TIA_ENVx_MODE, BANKED
4B96 02297 TIA_SW_Hlp_ENVRelease_Not3
               02298 
4B96 500B      02299         movf    IRQ_TMP1, W
4B98 0BC0      02300         andlw   0xc0
4B9A E002      02301         bz      TIA_SW_Hlp_ENVRelease_Not4
4B9C 0E08      02302         movlw   (1 << ENVx_MODE_RELEASE)
4B9E 6FC7      02303         movwf   TIA_V2_ENV_BASE + TIA_ENVx_MODE, BANKED
4BA0 02304 TIA_SW_Hlp_ENVRelease_Not4
4BA0 0012      02305         return
               02306 
               02307 ;; --------------------------------------------------------------------------
               02308 ;; Help Function for TIA_SW_Pitch
               02309 ;; IN: TIA_Vx_TARGET_FRQ_LH in FSR2
               02310 ;; OUT: new result in TIA_Vx_TARGET_FRQ_LH
               02311 ;; --------------------------------------------------------------------------
4BA2 02312 TIA_SW_Hlp_AddMul
               02313         BRA_IFCLR IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_AddMul_Pos
4BA2 A00D          M         btfss   reg, bit, reg_a
4BA4 D00D          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 142


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4BA6 02314 TIA_SW_Hlp_AddMul_Neg
               02315         ;; calc MUL_A_[LH] = TIA_Vx_FRQ_[LH] - MIOS_PARAMETER[12]
4BA6 5003      02316         movf    MIOS_PARAMETER1, W
4BA8 5CDE      02317         subwf   POSTINC2, W     ; TIA_Vx_TARGET_FRQ_LH+0, W, BANKED
4BAA 6FF8      02318         movwf   MUL_A_L, BANKED
4BAC 5004      02319         movf    MIOS_PARAMETER2, W
4BAE 58DD      02320         subwfb  POSTDEC2, W     ; TIA_Vx_TARGET_FRQ_LH+1, W, BANKED
4BB0 6FF9      02321         movwf   MUL_A_H, BANKED
               02322 
               02323         ;; calc MUL_R_[12] = MUL_A_[LH] * MUL_B_[LH]
4BB2 ECE7 F01A 02324         call    MATH_MUL16_16
               02325         ;; TIA_Vx_FRQ -= result
4BB6 51FD      02326         movf    MUL_R_1, W, BANKED
4BB8 5EDE      02327         subwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
4BBA 51FE      02328         movf    MUL_R_2, W, BANKED
4BBC 5ADD      02329         subwfb  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
4BBE 0012      02330         return
               02331 
4BC0 02332 TIA_SW_Hlp_AddMul_Pos
               02333         ;; calc MUL_A_[LH] = MIOS_PARAMETER[12] - TIA_Vx_FRQ_[LH]
4BC0 50DE      02334         movf    POSTINC2, W     ; TIA_Vx_TARGET_FRQ_LH+0, W, BANKED
4BC2 5C03      02335         subwf   MIOS_PARAMETER1, W
4BC4 6FF8      02336         movwf   MUL_A_L, BANKED
4BC6 50DD      02337         movf    POSTDEC2, W     ; TIA_Vx_TARGET_FRQ_LH+1, W, BANKED
4BC8 5804      02338         subwfb  MIOS_PARAMETER2, W
4BCA 6FF9      02339         movwf   MUL_A_H, BANKED
               02340 
               02341         ;; calc MUL_R_[12] = MUL_A_[LH] * MUL_B_[LH]
4BCC ECE7 F01A 02342         call    MATH_MUL16_16
               02343         ;; TIA_Vx_FRQ += result
4BD0 51FD      02344         movf    MUL_R_1, W, BANKED
4BD2 26DE      02345         addwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
4BD4 51FE      02346         movf    MUL_R_2, W, BANKED
4BD6 22DD      02347         addwfc  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
4BD8 0012      02348         return
               02349     
               02350     
               02351 ;; --------------------------------------------------------------------------
               02352 ;; Help Function for TIA_SW_Pitch
               02353 ;; IN:  addend and IRQ_TMP[12], TIA_Vx_TARGET_FRQ_LH in FSR2
               02354 ;; OUT: new result in TIA_Vx_TARGET_FRQ_LH
               02355 ;; --------------------------------------------------------------------------
4BDA 02356 TIA_SW_Hlp_Add16
               02357         ;; divide / 4 for a better scaling
               02358         ;clrc
               02359         ;rrf    IRQ_TMP2, F
               02360         ;rrf    IRQ_TMP1, F
               02361         ;clrc
               02362         ;rrf    IRQ_TMP2, F
               02363         ;rrf    IRQ_TMP1, F
               02364                 
               02365         BRA_IFCLR IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_Add16_Pos
4BDA A00D          M         btfss   reg, bit, reg_a
4BDC D008          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 143


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4BDE 02366 TIA_SW_Hlp_Add16_Neg
               02367         ;; TIA_Vx_TARGET_FRQ -= MOD 
4BDE 500B      02368         movf    IRQ_TMP1, W
4BE0 5EDE      02369         subwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
4BE2 500C      02370         movf    IRQ_TMP2, W
4BE4 5ADD      02371         subwfb  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
               02372         ;; saturate on overflow
4BE6 E202      02373         bc      TIA_SW_Hlp_Add16_Neg_End
4BE8 6ADE      02374         clrf    POSTINC2        ; TIA_Vx_TARGET_FRQ_LH+0, BANKED
4BEA 6ADD      02375         clrf    POSTDEC2        ; TIA_Vx_TARGET_FRQ_LH+1, BANKED
4BEC 02376 TIA_SW_Hlp_Add16_Neg_End
4BEC 0012      02377         return
               02378 
4BEE 02379 TIA_SW_Hlp_Add16_Pos
               02380         ;; TIA_Vx_TARGET_FRQ += MOD
4BEE 500B      02381         movf    IRQ_TMP1, W
4BF0 26DE      02382         addwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
4BF2 500C      02383         movf    IRQ_TMP2, W
4BF4 22DD      02384         addwfc  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
               02385         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
4BF6 E302      02386         bnc     TIA_SW_Hlp_Add16_Pos_End
4BF8 68DE      02387         setf    POSTINC2        ; TIA_Vx_TARGET_FRQ_LH+0, BANKED
4BFA 68DD      02388         setf    POSTDEC2        ; TIA_Vx_TARGET_FRQ_LH+1, BANKED
4BFC 02389 TIA_SW_Hlp_Add16_Pos_End
4BFC 0012      02390         return
               02391 
               02392 
               02393 ;; --------------------------------------------------------------------------
               02394 ;; Help Function for TIA_SW_ENV, etc.
               02395 ;; IN:  7-bit signed value in WREG
               02396 ;; OUT: absolute value (0x00-0x3f) in WREG
               02397 ;; --------------------------------------------------------------------------
4BFE 02398 TIA_SW_Hlp_Abs7
4BFE 50E8      02399         movf    WREG, W
4C00 B4D8      02400         skpnz
4C02 0F01      02401         addlw   1
4C04 ACE8      02402         btfss   WREG, 6
4C06 0840      02403         sublw 0x40
4C08 0B3F      02404         andlw   0x3f
4C0A 0012      02405         return
               02406 
               02407 ;; --------------------------------------------------------------------------
               02408 ;; Help Function for TIA_SW_ENV
               02409 ;; IN:  ENV_x_CTR_H in IRQ_TMP1
               02410 ;;      ENV_x_CURVE in IRQ_TMP2
               02411 ;;      ENV_x_ATTACK/ENV_x_DECAY or ENV_x_SUSTAIN in IRQ_TMP3
               02412 ;;      WREG != 0: use curve, WREG == 0: don't use curve parameter
               02413 ;; OUT: value which should be added to - or subtracted from - ENV_x_CTR_[LH]
               02414 ;;      low-byte in WREG and MIOS_PARAMETER1; high-byte in MIOS_PARAMETER2
               02415 ;; --------------------------------------------------------------------------
4C0C 02416 TIA_SW_ENV_GetBendedValue
4C0C E103      02417         bnz     TIA_SW_ENV_GetBendedValue_Curve
               02418 
               02419         ;; curve not selected, get value from ENV_TABLE
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 144


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4C0E 500D      02420         movf    IRQ_TMP3, W
4C10 EF3A F030 02421         goto    TIA_ENV_TABLE_Get
               02422 
4C14 02423 TIA_SW_ENV_GetBendedValue_Curve
               02424         ;; return ENV_x_DECAY when ENV_x_CURVE == 0x40
4C14 0E40      02425         movlw   0x40
4C16 620C      02426         cpfseq  IRQ_TMP2, ACCESS
               02427         rgoto TIA_SW_ENV_GetBendedValue_UD
4C18 D002          M         bra     label
4C1A 1C0D      02428         comf    IRQ_TMP3, W
               02429         rgoto   TIA_SW_ENV_GetBendedValue_Cont
4C1C D011          M         bra     label
               02430 
4C1E 02431 TIA_SW_ENV_GetBendedValue_UD
               02432         ;; feedback: calculate ABS7(CURVE) * ENV_x_CTR_H
4C1E 500C      02433         movf    IRQ_TMP2, W             ; get absolute value of curve parameter
4C20 DFEE      02434         rcall   TIA_SW_Hlp_Abs7
4C22 020B      02435         mulwf   IRQ_TMP1, ACCESS        ; multiply with current counter value
               02436         
               02437         ;; when CURVE parameter < 0x40: bend down, else up
               02438         BRA_IFCLR IRQ_TMP2, 6, ACCESS, TIA_SW_ENV_GetBendedValue_Down
4C24 AC0C          M         btfss   reg, bit, reg_a
4C26 D007          M         bra     label
4C28 02439 TIA_SW_ENV_GetBendedValue_Up
4C28 1E0D      02440         comf    IRQ_TMP3, F
4C2A 9E0D      02441         bcf     IRQ_TMP3, 7
4C2C 50F4      02442         movf    PRODH, W
4C2E 5C0D      02443         subwf   IRQ_TMP3, W
4C30 BEE8      02444         btfsc   WREG, 7
4C32 0E00      02445         movlw 0x00
               02446         rgoto   TIA_SW_ENV_GetBendedValue_Cont
4C34 D005          M         bra     label
               02447 
4C36 02448 TIA_SW_ENV_GetBendedValue_Down
4C36 1C0D      02449         comf    IRQ_TMP3, W
4C38 0B7F      02450         andlw   0x7f
4C3A 24F4      02451         addwf   PRODH, W
4C3C BEE8      02452         btfsc   WREG, 7
4C3E 0E7F      02453         movlw 0x7f
               02454         ;;      rgoto   TIA_SW_ENV_GetBendedValue_Cont
               02455 
4C40 02456 TIA_SW_ENV_GetBendedValue_Cont
4C40 0B7F      02457         andlw   0x7f
4C42 EF41 F018 02458         goto    TIA_FRQ_TABLE_Get
               02459 
               02460 
               00403 #include "tia_wt.inc"
               00001 ; $Id: tia_wt.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Wavetable Sequencer
               00005 ;
               00006 ; MEMO - when MIDI sync is enabled, following WT clock rates are usefull:
               00007 ;  126: 8 steps = 1/4 note
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 145


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00008 ;  123: 8 steps = 1/2 note
               00009 ;  117: 8 steps = 1 note
               00010 ;
               00011 ; ==========================================================================
               00012 ;
               00013 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00014 ;  Licensed for personal non-commercial use only.
               00015 ;  All other rights reserved.
               00016 ; 
               00017 ; ==========================================================================
               00018 
               00019 ;; --------------------------------------------------------------------------
               00020 ;;  TIA Wavetable Init
               00021 ;; --------------------------------------------------------------------------
4C46 00022 TIA_WT_Init
4C46 D8B4      00023     rcall   TIA_WT_Hlp_VxFromP
               00024     ;;bcf     PLUSW0, WT_STATE_INIT_REQ
               00025     
4C48 D8C0      00026     rcall   TIA_WT_Hlp_BkPst_Prepare
               00027     ;; Px assignment
4C4A 0E11      00028     movlw   17 
4C4C 6EA9      00029     movwf       EEADR
4C4E EC42 F01C 00030     call        TIA_BANK_Read    
4C52 6E03      00031         movwf   MIOS_PARAMETER1 
4C54 0E33      00032     movlw   TIA_Vx_WT_ASSIGN_P1
4C56 C003 FFEB 00033     movff   MIOS_PARAMETER1, PLUSW0
4C5A EC42 F01C 00034     call        TIA_BANK_Read    
4C5E 6E03      00035         movwf   MIOS_PARAMETER1 
4C60 0E34      00036     movlw   TIA_Vx_WT_ASSIGN_P2
4C62 C003 FFEB 00037     movff   MIOS_PARAMETER1, PLUSW0
4C66 EC42 F01C 00038     call        TIA_BANK_Read    
4C6A 6E03      00039         movwf   MIOS_PARAMETER1 
4C6C 0E35      00040     movlw   TIA_Vx_WT_ASSIGN_P3
4C6E C003 FFEB 00041     movff   MIOS_PARAMETER1, PLUSW0
               00042     ;; ADSR
4C72 EC42 F01C 00043     call        TIA_BANK_Read    
4C76 6E03      00044         movwf   MIOS_PARAMETER1 
4C78 0E37      00045     movlw   TIA_Vx_WT_ATTACK
4C7A C003 FFEB 00046     movff   MIOS_PARAMETER1, PLUSW0
4C7E EC42 F01C 00047     call        TIA_BANK_Read    
4C82 6E03      00048         movwf   MIOS_PARAMETER1 
4C84 0E38      00049     movlw   TIA_Vx_WT_DECAY
4C86 C003 FFEB 00050     movff   MIOS_PARAMETER1, PLUSW0
4C8A EC42 F01C 00051     call        TIA_BANK_Read    
4C8E 6E03      00052         movwf   MIOS_PARAMETER1 
4C90 0E39      00053     movlw   TIA_Vx_WT_SUSTAIN
4C92 C003 FFEB 00054     movff   MIOS_PARAMETER1, PLUSW0
4C96 EC42 F01C 00055     call        TIA_BANK_Read    
4C9A 6E03      00056         movwf   MIOS_PARAMETER1 
4C9C 0E3A      00057     movlw   TIA_Vx_WT_RELEASE
4C9E C003 FFEB 00058     movff   MIOS_PARAMETER1, PLUSW0
               00059       
4CA2 0012      00060     return
               00061 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 146


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00062 ;; --------------------------------------------------------------------------
               00063 ;;  TIA Wavetable ADSR copy
               00064 ;; --------------------------------------------------------------------------
               00065 
4CA4 00066 TIA_WT_ADSR_Copy
4CA4 D885      00067     rcall   TIA_WT_Hlp_VxFromP
               00068     ;; WT ADSR to Vx ADSR
4CA6 0E37      00069     movlw   TIA_Vx_WT_ATTACK
4CA8 CFEB FFE6 00070     movff   PLUSW0, POSTINC1
4CAC 0E38      00071     movlw   TIA_Vx_WT_DECAY
4CAE CFEB FFE6 00072     movff   PLUSW0, POSTINC1
4CB2 0E39      00073     movlw   TIA_Vx_WT_SUSTAIN
4CB4 CFEB FFE6 00074     movff   PLUSW0, POSTINC1
4CB8 0E3A      00075     movlw   TIA_Vx_WT_RELEASE
4CBA CFEB FFE6 00076     movff   PLUSW0, POSTINC1
4CBE 0012      00077     return
               00078        
               00079 ;; --------------------------------------------------------------------------
               00080 ;;  TIA Wavetable Handler
               00081 ;; --------------------------------------------------------------------------
4CC0 00082 TIA_WT_Handler
               00083         SET_BSR TIA_BASE                        ; init BSR
4CC0 0101          M         movlb   HIGH(reg)
               00084 
4CC2 6A27      00085         clrf    TIA_WT_VOICE    ; loop counter
4CC4 EE01 F020 00086         lfsr    FSR0, TIA_V1_BASE
4CC8 00087 TIA_WT_VoiceLoop
               00088         ;; exit handler if wavetable disabled
4CC8 0E2B      00089     movlw   TIA_Vx_OPTION
               00090     BRA_IFCLR PLUSW0, Vx_OPTION_WT_ON, ACCESS, TIA_WT_VoiceLoop_Exit
4CCA A0EB          M         btfss   reg, bit, reg_a
4CCC D06A          M         bra     label
               00091         ;; exit handler if wavetable rate == 0
4CCE 0E2F      00092     movlw  TIA_Vx_WT_RATE
4CD0 50EB      00093     movf    PLUSW0, W
4CD2 B4D8      00094         skpnz
               00095         rgoto   TIA_WT_VoiceLoop_Next
4CD4 D066          M         bra     label
               00096 
               00097         ;; reset requested?
4CD6 0E2E      00098     movlw  TIA_Vx_WT_STATE
               00099         BRA_IFCLR PLUSW0, WT_STATE_RESET, ACCESS, TIA_WT_NoReset
4CD8 A2EB          M         btfss   reg, bit, reg_a
4CDA D022          M         bra     label
4CDC 00100 TIA_WT_Reset
               00101     IRQ_DISABLE
4CDC 9EF2          M         bcf     INTCON, GIE
4CDE 92EB      00102         bcf     PLUSW0, WT_STATE_RESET
4CE0 90EB      00103         bcf     PLUSW0, WT_STATE_STOP
4CE2 9AEB      00104         bcf     PLUSW0, WT_STATE_SLIDE
4CE4 9CEB      00105         bcf     PLUSW0, WT_STATE_SLIDE_PREV
4CE6 6A36      00106     clrf    TIA_Vx_WT_303_TICK_CTR
               00107       
               00108         ;; clear counter & position and request first entry
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 147


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4CE8 0E2B      00109     movlw  TIA_Vx_OPTION
               00110         BRA_IFCLR PLUSW0, Vx_OPTION_WTSYNC_ON, ACCESS, TIA_WT_Handler_IntClk
4CEA A2EB          M         btfss   reg, bit, reg_a
4CEC D00B          M         bra     label
4CEE 00111 TIA_WT_Handler_ExtClk
4CEE 0E2F      00112     movlw  TIA_Vx_WT_RATE
4CF0 1CEB      00113         comf    PLUSW0, W
4CF2 0B7F      00114         andlw   0x7f
4CF4 6E09      00115     movwf       TMP4
4CF6 0E2E      00116     movlw  TIA_Vx_WT_STATE
4CF8 AAEB      00117         btfss   PLUSW0, Vx_OPTION_TB303
4CFA 2A09      00118         incf    TMP4, F
4CFC 0E31      00119     movlw   TIA_Vx_WT_CTR
4CFE C009 FFEB 00120         movff   TMP4, PLUSW0    
               00121         rgoto   TIA_WT_Handler_ExtClk_C
4D02 D008          M         bra     label
4D04 00122 TIA_WT_Handler_IntClk
4D04 0E2F      00123     movlw  TIA_Vx_WT_RATE
4D06 1CEB      00124         comf    PLUSW0, W
4D08 6E09      00125     movwf       TMP4
4D0A 0E31      00126     movlw   TIA_Vx_WT_CTR
4D0C C009 FFEB 00127         movff   TMP4, PLUSW0
4D10 90D8      00128         clrc
4D12 36EB      00129         rlf     PLUSW0, F
4D14 00130 TIA_WT_Handler_ExtClk_C
4D14 0E32      00131     movlw   TIA_Vx_WT_POS
4D16 6AEB      00132         clrf    PLUSW0
4D18 0E30      00133     movlw   TIA_Vx_WT_CLK_REQ_CTR
4D1A 6AEB      00134         clrf    PLUSW0
4D1C 2AEB      00135         incf    PLUSW0, F
               00136         IRQ_ENABLE
4D1E 8EF2          M         bsf     INTCON, GIE
4D20 00137 TIA_WT_NoReset
               00138 
               00139 
               00140         ;; handle all requested clocks
4D20 00141 TIA_WT_NextClkLoop
4D20 0E30      00142     movlw   TIA_Vx_WT_CLK_REQ_CTR
4D22 50EB      00143         movf    PLUSW0, W
4D24 E03E      00144         bz      TIA_WT_VoiceLoop_Next
4D26 0E2E      00145     movlw  TIA_Vx_WT_STATE
               00146         BRA_IFSET PLUSW0, WT_STATE_STOP, ACCESS, TIA_WT_VoiceLoop_Exit
4D28 B0EB          M         btfsc   reg, bit, reg_a
4D2A D03B          M         bra     label
4D2C 0E30      00147     movlw   TIA_Vx_WT_CLK_REQ_CTR
4D2E 06EB      00148         decf    PLUSW0, F
               00149 
               00150         ;; get first entry
4D30 D84C      00151     rcall   TIA_WT_Hlp_BkPst_Prepare
4D32 D85A      00152         rcall   TIA_WT_Hlp_StepCmd_Get
               00153     ;; cmd in TMP4
4D34 00154 TIA_WT_Loop
               00155         ;; branch depending on entry ID
4D34 5009      00156         movf    TMP4, W
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 148


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4D36 0B03      00157         andlw   0x03
               00158         JUMPTABLE_2BYTES_UNSECURE
4D38 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00159         rgoto   TIA_WT_Branch_Inc
4D3C D02A          M         bra     label
               00160         rgoto   TIA_WT_Branch_Play
4D3E D002          M         bra     label
               00161         rgoto   TIA_WT_Branch_Goto
4D40 D01C          M         bra     label
               00162         rgoto   TIA_WT_Branch_End
4D42 D018          M         bra     label
               00163         
4D44 00164 TIA_WT_Branch_Play
               00165         ;; send MIDI clock if enabled for synchronization of external sequencers or similar
               00166     ;; Voice 1(Aud0) priority
               00167     
4D44 0EF8      00168         movlw   0xf8
               00169         CALL_IFSET TIA_MIDI_SYNC, TIA_MIDI_SYNC_SEND_CLK, BANKED, MIOS_MIDI_TxBufferPut
4D46 B1F0          M         btfsc   reg, bit, reg_a
4D48 EC24 F016     M         call    label
               00170         SET_BSR TIA_BASE
4D4C 0101          M         movlb   HIGH(reg)
               00171     
               00172 #if 0
               00173         BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_WT_Branch_Play_NotTB303
               00174 TIA_WT_Branch_Play_TB303
               00175         ;; in TB303 mode:
               00176         ;; increment tick counter, reset if counter >= 6
               00177         incf    TIA_WT_303_TICK_CTR, F, BANKED
               00178         movlw   0x6
               00179         cpfslt  TIA_WT_303_TICK_CTR, BANKED
               00180         clrf    TIA_WT_303_TICK_CTR, BANKED
               00181 
               00182         ;; play note when counter-1 == 0
               00183         decf    TIA_WT_303_TICK_CTR, W, BANKED
               00184         bz      TIA_WT_Branch_Play_TB303Note
               00185         ;; release gate when counter-1 == 3
               00186         decf    TIA_WT_303_TICK_CTR, W, BANKED
               00187         xorlw   3
               00188         bz      TIA_WT_Branch_Play_TB303G0
               00189         rgoto   TIA_WT_NextClkLoop
               00190 
               00191 TIA_WT_Branch_Play_TB303G0
               00192         IRQ_DISABLE
               00193         ;; exception: don't clear when slide is active
               00194         BRA_IFCLR TIA_WT_STATE, WT_STATE_SLIDE, BANKED, TIA_WT_Branch_Play_TB303G0_Clr
               00195 TIA_WT_Branch_Play_TB303G0_Slide
               00196         bsf     TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED
               00197         rgoto   TIA_WT_Branch_Play_TB303G0_End
               00198 
               00199 TIA_WT_Branch_Play_TB303G0_Clr
               00200         bcf     TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED
               00201         bcf     TIA_V1_BASE + TIA_Vx_MODE, TIA_Vx_MODE_GATE_SET_REQ, BANKED
               00202         bsf     TIA_V1_BASE + TIA_Vx_MODE, TIA_Vx_MODE_GATE_CLR_REQ, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 149


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00203         ;;      rgoto   TIA_WT_Branch_Play_TB303G0_End
               00204 
               00205 TIA_WT_Branch_Play_TB303G0_End
               00206         IRQ_ENABLE
               00207         rgoto   TIA_WT_NextClkLoop
               00208 TIA_WT_Branch_Play_TB303Note
               00209 
               00210 #endif
4D4E 00211 TIA_WT_Branch_Play_NotTB303
               00212 
               00213         ;; disable interrupts until all tracks have been handled!
               00214         IRQ_DISABLE
4D4E 9EF2          M         bcf     INTCON, GIE
               00215 
4D50 D83C      00216     rcall   TIA_WT_Hlp_BkPst_Prepare
4D52 D85B      00217     rcall   TIA_WT_Hlp_StepP1_Get
               00218     ;; first parameter in TMP2
               00219 
               00220 #if 0
               00221         BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_WT_Branch_PlayP1_NotTB303
               00222 TIA_WT_Branch_PlayP1_TB303
               00223         ;; set gate flag
               00224         bcf     TIA_WT_STATE, WT_STATE_GATE, BANKED
               00225         btfsc   TMP2, 4
               00226         bsf     TIA_WT_STATE, WT_STATE_GATE, BANKED
               00227 
               00228         ;; slide flag
               00229         bcf     TIA_WT_STATE, WT_STATE_SLIDE, BANKED
               00230         btfsc   TMP2, 5
               00231         bsf     TIA_WT_STATE, WT_STATE_SLIDE, BANKED
               00232 
               00233         ;; set accent flag of voice 1 if velocity >= 8
               00234         bcf     TIA_V1_BASE + TIA_Vx_MODE, TIA_Vx_MODE_ACCENT
               00235         btfsc   TMP2, 3
               00236         bsf     TIA_V1_BASE + TIA_Vx_MODE, TIA_Vx_MODE_ACCENT
               00237 
               00238         ;; modify sustain if gate flag set and no active slide (which wouldn't retrigger the gate)
               00239         BRA_IFCLR TIA_WT_STATE, WT_STATE_GATE, BANKED, TIA_WT_Branch_Play_TB303NoteNSus
               00240         BRA_IFSET TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED, TIA_WT_Branch_Play_TB303NoteNSus
               00241         BRA_IFSET TIA_SE_OPTION, SE_OPTION_GSA, BANKED, TIA_WT_Branch_Play_TB303NoteNSus
               00242 TIA_WT_Branch_Play_TB303NoteSus
               00243         ;; 0x08 + accent/2
               00244         rlf     TMP2, W
               00245         rlf     WREG, W
               00246         addlw   0x08
               00247         andlw   0x78
               00248 
               00249         movwf   TMP2
               00250         movlw   57              ; CC#57: Voice 1 Sustain
               00251         movwf   TMP3
               00252         rcall   TIA_WT_Hlp_Play_P_Cont
               00253 TIA_WT_Branch_Play_TB303NoteNSus
               00254         rgoto   TIA_WT_Branch_PlayP1_TB303Cont
               00255 #endif
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 150


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00256 
               00257 
4D54 00258 TIA_WT_Branch_PlayP1_NotTB303
               00259         ;;btfsc TMP4, 4
               00260         ;;bsf   TMP2, 7
4D54 0E33      00261     movlw   TIA_Vx_WT_ASSIGN_P1
4D56 50EB      00262     movf    PLUSW0, W
4D58 A4D8      00263         skpz
4D5A D867      00264         rcall   TIA_WT_Hlp_Play_P
4D5C 00265 TIA_WT_Branch_PlayP1_TB303Cont
               00266 
               00267         ;; second parameter
               00268         ;;bsf   TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED ; will only be used in TB303 mode
4D5C D85A      00269     rcall   TIA_WT_Hlp_StepP2_Get
               00270     ;; second parameter in TMP2
               00271         ;;btfsc TMP4, 5
               00272         ;;bsf   TMP2, 7
               00273         ;; in TB303 mode: always assigned to CC#9 (play note of voice 1)
               00274         ;;movlw 9
               00275         ;;BRA_IFSET TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_WT_Branch_PlayP2_TB303
               00276         ;; else play assigned parameter
4D5E 0E34      00277     movlw   TIA_Vx_WT_ASSIGN_P2
4D60 50EB      00278     movf    PLUSW0, W
4D62 E001      00279         bz      TIA_WT_Branch_PlayP2_Skip
4D64 00280 TIA_WT_Branch_PlayP2_TB303
4D64 D862      00281         rcall   TIA_WT_Hlp_Play_P
4D66 00282 TIA_WT_Branch_PlayP2_Skip
               00283 
               00284         ;; third parameter
4D66 D859      00285     rcall   TIA_WT_Hlp_StepP3_Get
               00286     ;; third parameter in TMP2
               00287         ;;btfsc TMP4, 6
               00288         ;;bsf   TMP2, 7
4D68 0E35      00289     movlw   TIA_Vx_WT_ASSIGN_P3
4D6A 50EB      00290     movf    PLUSW0, W
4D6C A4D8      00291         skpz
4D6E D85D      00292         rcall   TIA_WT_Hlp_Play_P
               00293         ;;bcf   TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED
               00294 
               00295         IRQ_ENABLE              ; enable interrupts again
4D70 8EF2          M         bsf     INTCON, GIE
               00296 
4D72 00297 TIA_WT_Branch_Play_End
               00298         rgoto   TIA_WT_Branch_Inc
4D72 D00F          M         bra     label
               00299 
               00300         ;; ---
4D74 00301 TIA_WT_Branch_End
4D74 0E2E      00302     movlw   TIA_Vx_WT_STATE
4D76 80EB      00303         bsf     PLUSW0, WT_STATE_STOP
               00304         rgoto   TIA_WT_NextClkLoop
4D78 D7D3          M         bra     label
               00305         
               00306         ;; ---
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 151


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4D7A 00307 TIA_WT_Branch_Goto
               00308         ;;bcf   TIA_WT_STATE, WT_STATE_SLIDE, BANKED
               00309         ;;bcf   TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED
               00310     
4D7A D847      00311     rcall   TIA_WT_Hlp_StepP1_Get
               00312     ;; goto step in TMP2
4D7C 0E1F      00313         movlw   0x1f
4D7E 1607      00314     andwf   TMP2, F
4D80 0E32      00315     movlw   TIA_Vx_WT_POS
4D82 C007 FFEB 00316         movff   TMP2, PLUSW0 
               00317       
4D86 D830      00318         rcall   TIA_WT_Hlp_StepCmd_Get
               00319     ;; step command in TMP4
4D88 5009      00320     movf        TMP4, W
4D8A 0B03      00321         andlw   0x03
4D8C 0A02      00322         xorlw   0x02
4D8E E0F2      00323         bz      TIA_WT_Branch_End
               00324         rgoto   TIA_WT_Loop
4D90 D7D1          M         bra     label
               00325          
               00326         ;; ---
4D92 00327 TIA_WT_Branch_Inc
4D92 0E32      00328     movlw   TIA_Vx_WT_POS
4D94 28EB      00329         incf    PLUSW0, W
4D96 0B1F      00330         andlw   0x1f
4D98 6E07      00331     movwf   TMP2
4D9A 0E32      00332     movlw   TIA_Vx_WT_POS
4D9C C007 FFEB 00333         movff   TMP2, PLUSW0
               00334     rgoto       TIA_WT_NextClkLoop
4DA0 D7BF          M         bra     label
               00335 
4DA2 00336 TIA_WT_VoiceLoop_Exit
               00337 
4DA2 00338 TIA_WT_VoiceLoop_Next
4DA2 0E40      00339         movlw   TIA_Vx_RECORD_LEN
4DA4 26E9      00340         addwf   FSR0L, F
4DA6 2A27      00341         incf    TIA_WT_VOICE, F
4DA8 0E01      00342         movlw   2-1
4DAA 6427      00343         cpfsgt  TIA_WT_VOICE, ACCESS
               00344         rgoto TIA_WT_VoiceLoop
4DAC D78D          M         bra     label
4DAE 0012      00345         return
               00346     
               00347     
               00348 
               00349 ;; --------------------------------------------------------------------------
               00350     ;; get Voice number from parameter
4DB0 00351 TIA_WT_Hlp_VxFromP
4DB0 0E60      00352     movlw   TIA_V2_BASE & 0xff
4DB2 60E1      00353     cpfslt  FSR1L, ACCESS
4DB4 D005      00354     bra     TIA_WT_Init_V2
4DB6 00355 TIA_WT_Init_V1
4DB6 EE01 F020 00356     lfsr        FSR0, TIA_V1_BASE
4DBA EE11 F0BF 00357     lfsr        FSR1, TIA_V1_ENV_BASE + TIA_ENVx_ATTACK
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 152


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4DBE D004      00358     bra     TIA_WT_Hlp_VxFromP_End
4DC0 00359 TIA_WT_Init_V2  
4DC0 EE01 F060 00360     lfsr        FSR0, TIA_V2_BASE
4DC4 EE11 F0CA 00361     lfsr        FSR1, TIA_V2_ENV_BASE + TIA_ENVx_ATTACK  
4DC8 00362 TIA_WT_Hlp_VxFromP_End
4DC8 0012      00363     return
               00364 
               00365 ;; --------------------------------------------------------------------------
               00366     ;; prepare bank & preset
4DCA 00367 TIA_WT_Hlp_BkPst_Prepare
4DCA 0E2C      00368     movlw   TIA_Vx_WBANK
4DCC CFEB F011 00369     movff   PLUSW0, TIA_BANK
4DD0 5011      00370     movf    TIA_BANK, W
4DD2 0B06      00371     andlw   0x06
4DD4 44E8      00372     rlncf   WREG, W
4DD6 B011      00373     btfsc   TIA_BANK, 0
4DD8 28E8      00374     incf    WREG, W
4DDA 0F14      00375     addlw   DEFAULT_BS_KBANK_ID*4
4DDC 0F02      00376     addlw   0x02
4DDE 6E11      00377     movwf   TIA_BANK   
               00378     
4DE0 0E2D      00379     movlw   TIA_Vx_WT
4DE2 CFEB F012 00380     movff   PLUSW0, TIA_PRESET 
4DE6 0012      00381     return
               00382 
               00383 ;; --------------------------------------------------------------------------
               00384         ;; loads step command
4DE8 00385 TIA_WT_Hlp_StepCmd_Get
               00386     ;; register addr
4DE8 0E32      00387     movlw   TIA_Vx_WT_POS
4DEA 40EB      00388         rrncf   PLUSW0, W
4DEC 40E8      00389     rrncf   WREG, W
4DEE 0B07      00390     andlw   0x07
4DF0 0F18      00391     addlw   24
4DF2 6EA9      00392         movwf   EEADR
4DF4 EC42 F01C 00393     call        TIA_BANK_Read    
4DF8 6E09      00394         movwf   TMP4   
               00395     ;; 2 bits cmd extraction
4DFA 0E32      00396     movlw   TIA_Vx_WT_POS
4DFC B0EB      00397         btfsc   PLUSW0, 0 
4DFE 4209      00398         rrncf   TMP4, F       
4E00 B0EB      00399         btfsc   PLUSW0, 0 
4E02 4209      00400         rrncf   TMP4, F   
4E04 B2EB      00401         btfsc   PLUSW0, 1 
4E06 3A09      00402         swapf   TMP4, F     
4E08 0012      00403     return
               00404 
               00405 ;; --------------------------------------------------------------------------
               00406         ;; loads parameter 1 value or goto step addr
4E0A 00407 TIA_WT_Hlp_StepP1_Get
               00408     ;; register addr
4E0A 0E32      00409     movlw   TIA_Vx_WT_POS
4E0C 50EB      00410         movf    PLUSW0, W
4E0E 0F20      00411     addlw   32
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 153


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00412     rgoto TIA_WT_Hlp_StepPx_Get_End
4E10 D007          M         bra     label
               00413 ;; --------------------------------------------------------------------------
               00414         ;; loads parameter 2 value
4E12 00415 TIA_WT_Hlp_StepP2_Get
               00416     ;; register addr
4E12 0E32      00417     movlw   TIA_Vx_WT_POS
4E14 50EB      00418         movf    PLUSW0, W
4E16 0F40      00419     addlw   64
               00420     rgoto TIA_WT_Hlp_StepPx_Get_End 
4E18 D003          M         bra     label
               00421 ;; --------------------------------------------------------------------------            
               00422         ;; loads parameter 3 value
4E1A 00423 TIA_WT_Hlp_StepP3_Get
               00424     ;; register addr
4E1A 0E32      00425     movlw   TIA_Vx_WT_POS
4E1C 50EB      00426         movf    PLUSW0, W
4E1E 0F60      00427     addlw   96
               00428     ;;rgoto TIA_WT_Hlp_StepPx_Get_End
               00429 ;; --------------------------------------------------------------------------    
4E20 00430 TIA_WT_Hlp_StepPx_Get_End
4E20 6EA9      00431         movwf   EEADR
4E22 EC42 F01C 00432     call        TIA_BANK_Read    
4E26 6E07      00433         movwf   TMP2    
4E28 0012      00434     return
               00435     
               00436 ;; --------------------------------------------------------------------------
               00437         ;; play a WT entry
4E2A 00438 TIA_WT_Hlp_Play_P
4E2A 6E08      00439         movwf   TMP3    ; save CC number in TMP3
               00440 
               00441         BRA_IFSET TMP2, 7, ACCESS, TIA_WT_Hlp_Play_P_Cont
4E2C BE07          M         btfsc   reg, bit, reg_a
4E2E D010          M         bra     label
               00442 
               00443         ;; add/subtract with saturation
4E30 EC19 F02F 00444         call    TIA_CCOUT_Get
               00445 
               00446         BRA_IFSET TMP2, 6, ACCESS, TIA_WT_Hlp_Play_P_Sub
4E34 BC07          M         btfsc   reg, bit, reg_a
4E36 D007          M         bra     label
4E38 00447 TIA_WT_Hlp_Play_P_Add
4E38 2607      00448         addwf   TMP2, F
               00449         BRA_IFCLR TMP2, 7, ACCESS, TIA_WT_Hlp_Play_P_Cont
4E3A AE07          M         btfss   reg, bit, reg_a
4E3C D009          M         bra     label
4E3E 0E7F      00450         movlw   0x7f
4E40 6E07      00451         movwf   TMP2    
4E42 EF28 F027 00452         goto    TIA_WT_Hlp_Play_P_Cont  
4E46 00453 TIA_WT_Hlp_Play_P_Sub
4E46 8E07      00454         bsf     TMP2, 7
4E48 2607      00455         addwf   TMP2, F
               00456         BRA_IFCLR TMP2, 7, ACCESS, TIA_WT_Hlp_Play_P_Cont
4E4A AE07          M         btfss   reg, bit, reg_a
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 154


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4E4C D001          M         bra     label
4E4E 6A07      00457         clrf    TMP2
               00458         ;;      rgoto   TIA_WT_Hlp_Play_P_Cont  
               00459 
4E50 00460 TIA_WT_Hlp_Play_P_Cont
4E50 5007      00461         movf    TMP2, W
4E52 0B7F      00462         andlw   0x7f
4E54 6E03      00463         movwf   MIOS_PARAMETER1
4E56 5008      00464         movf    TMP3, W
4E58 EF03 F02D 00465         goto    TIA_CCIN_Set
               00404 #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 ;; --------------------------------------------------------------------------
4E5C 00022 TIA_MIDI_NotifyReceivedEvent
               00023 
               00024         ;; branch to appr. TIA routine depending on received event
4E5C 3803      00025         swapf   MIOS_PARAMETER1, W
4E5E 0B07      00026         andlw   0x07
               00027         JUMPTABLE_2BYTES_UNSECURE
4E60 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00028         rgoto   TIA_MIDI_NoteOff
4E64 D040          M         bra     label
               00029         rgoto   TIA_MIDI_NoteOn
4E66 D006          M         bra     label
               00030         rgoto   TIA_MIDI_AfterTouch
4E68 D0C2          M         bra     label
               00031         rgoto   TIA_MIDI_CC
4E6A D081          M         bra     label
               00032         rgoto   TIA_MIDI_ProgramChange
4E6C D0A7          M         bra     label
               00033         rgoto   TIA_MIDI_PolyAfterTouch
4E6E D0BC          M         bra     label
               00034         rgoto   TIA_MIDI_PitchBender
4E70 D06D          M         bra     label
4E72 0012      00035         return
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 155


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               00041 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00042 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00043 ;; --------------------------------------------------------------------------
4E74 00044 TIA_MIDI_NoteOn
4E74 5005      00045         movf    MIOS_PARAMETER3, W      ; branch to NoteOff if velocity is zero
4E76 B4D8      00046         skpnz
               00047         rgoto   TIA_MIDI_NoteOff
4E78 D036          M         bra     label
               00048     
               00049 
               00050     
               00051         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
4E7A 0101          M         movlb   HIGH(reg)
               00052 
               00053         BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED, TIA_MIDI_NoteOn_MonoMode
4E7C A10C          M         btfss   reg, bit, reg_a
4E7E D00F          M         bra     label
4E80 00054 TIA_MIDI_NoteOn_PolyMode
               00055         ;; in poly mode we only react on MIDI channel of voice 1!
4E80 5003      00056         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
4E82 0B0F      00057         andlw   0x0f
4E84 6320      00058         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
4E86 0012      00059         return
               00060         
               00061         ;; in poly mode: determine free voice
4E88 0E01      00062         movlw   0x01
4E8A 5342      00063         movf    TIA_V1_BASE + TIA_Vx_NOTE_STACK_0, F, BANKED
4E8C E004      00064         bz      TIA_MIDI_NoteOn_Poly_Cont
4E8E 0E02      00065         movlw   0x02
4E90 5382      00066         movf    TIA_V2_BASE + TIA_Vx_NOTE_STACK_0, F, BANKED
4E92 E001      00067         bz      TIA_MIDI_NoteOn_Poly_Cont
               00068         rgoto   TIA_MIDI_NoteOn_Poly_Failed
4E94 D026          M         bra     label
4E96 00069 TIA_MIDI_NoteOn_Poly_Cont
4E96 6E0A      00070         movwf   TMP5            ; TMP5 contains the voices which should be played
4E98 D960      00071     rcall   TIA_MIDI_GetAssignedKeys
4E9A D95F      00072     rcall   TIA_MIDI_GetAssignedKeys
               00073         rgoto   TIA_MIDI_NoteOn_Start_Handlers
4E9C D005          M         bra     label
               00074 
4E9E 00075 TIA_MIDI_NoteOn_MonoMode
               00076         ;; check for the assigned MIDI channels, result in TMP5
4E9E D938      00077         rcall   TIA_MIDI_GetAssignedChannels
4EA0 D944      00078         rcall   TIA_MIDI_GetAssignedVoices
4EA2 D95B      00079     rcall   TIA_MIDI_GetAssignedKeys
               00080         ;; leave routine if no voice is assigned to channel
4EA4 B4D8      00081         skpnz
4EA6 0012      00082         return
               00083 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 156


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4EA8 00084 TIA_MIDI_NoteOn_Start_Handlers
               00085         IRQ_DISABLE
4EA8 9EF2          M         bcf     INTCON, GIE
               00086 
               00087         ;; --[ Voice 1 Handler ]--
4EAA 00088 TIA_MIDI_NoteOn_V1
               00089         BRA_IFCLR TMP5, 0, ACCESS, TIA_MIDI_NoteOn_V1_Failed
4EAA A00A          M         btfss   reg, bit, reg_a
4EAC D00C          M         bra     label
4EAE EE11 F042 00090         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_NOTE_STACK_0         ; push note to stack
4EB2 D8A9      00091         rcall   TIA_MIDI_Hlp_PushNote
               00092         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOn_V1_Failed    ; exit if note already in stack
4EB4 B0E8          M         btfsc   reg, bit, reg_a
4EB6 D007          M         bra     label
4EB8 EE01 F020 00093         lfsr    FSR0, TIA_V1_BASE
4EBC 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
4EBE D8D4      00096         rcall   TIA_MIDI_Hlp_NoteOn                             ; call note-on handler
4EC0 EE21 F020 00097         lfsr    FSR2, TIA_V1_BASE                               ; sort notes for arpeggios
4EC4 D966      00098         rcall   TIA_MIDI_Arp_Sorter
4EC6 00099 TIA_MIDI_NoteOn_V1_Failed
               00100 
               00101         ;; --[ Voice 2 Handler ]--
4EC6 00102 TIA_MIDI_NoteOn_V2
               00103         BRA_IFCLR TMP5, 1, ACCESS, TIA_MIDI_NoteOn_V2_Failed
4EC6 A20A          M         btfss   reg, bit, reg_a
4EC8 D00C          M         bra     label
4ECA EE11 F082 00104         lfsr    FSR1, TIA_V2_BASE + TIA_Vx_NOTE_STACK_0         ; push note to stack
4ECE D89B      00105         rcall   TIA_MIDI_Hlp_PushNote
               00106         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOn_V2_Failed    ; exit if note already in stack
4ED0 B0E8          M         btfsc   reg, bit, reg_a
4ED2 D007          M         bra     label
4ED4 EE01 F060 00107         lfsr    FSR0, TIA_V2_BASE
4ED8 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
4EDA D8C6      00110         rcall   TIA_MIDI_Hlp_NoteOn                             ; call note-on handler
4EDC EE21 F060 00111         lfsr    FSR2, TIA_V2_BASE                               ; sort notes for arpeggios
4EE0 D958      00112         rcall   TIA_MIDI_Arp_Sorter
4EE2 00113 TIA_MIDI_NoteOn_V2_Failed
               00114 
4EE2 00115 TIA_MIDI_NoteOn_Poly_Failed
               00116 
               00117         IRQ_ENABLE
4EE2 8EF2          M         bsf     INTCON, GIE
4EE4 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 ;; --------------------------------------------------------------------------
4EE6 00127 TIA_MIDI_NoteOff
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 157


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00128         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
4EE6 0101          M         movlb   HIGH(reg)
               00129 
               00130         ;; ensure that velocity is cleared
4EE8 6A05      00131         clrf    MIOS_PARAMETER3
               00132 
               00133         BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED, TIA_MIDI_NoteOff_MonoMode
4EEA A10C          M         btfss   reg, bit, reg_a
4EEC D003          M         bra     label
4EEE 00134 TIA_MIDI_NoteOff_PolyMode
               00135         ;; in poly mode, handle all channels
4EEE 0E0F      00136         movlw   0x0f
4EF0 6E0A      00137         movwf   TMP5
               00138         rgoto   TIA_MIDI_NoteOff_Start_Handlers
4EF2 D005          M         bra     label
4EF4 00139 TIA_MIDI_NoteOff_MonoMode
               00140         ;; check for the assigned MIDI channels, result in TMP5
4EF4 D90D      00141         rcall   TIA_MIDI_GetAssignedChannels
4EF6 D919      00142         rcall   TIA_MIDI_GetAssignedVoices ; (not so optimal if split points modified during notes are played)
4EF8 D930      00143     rcall   TIA_MIDI_GetAssignedKeys
               00144         ;; leave routine if no voice is assigned to channel
4EFA B4D8      00145         skpnz
4EFC 0012      00146         return
               00147 
4EFE 00148 TIA_MIDI_NoteOff_Start_Handlers
               00149         IRQ_DISABLE
4EFE 9EF2          M         bcf     INTCON, GIE
               00150 
               00151         ;; --[ Voice 1 Handler ]--
4F00 00152 TIA_MIDI_NoteOff_V1
               00153         BRA_IFCLR TMP5, 0, ACCESS, TIA_MIDI_NoteOff_V1_NotFnd
4F00 A00A          M         btfss   reg, bit, reg_a
4F02 D010          M         bra     label
4F04 EE11 F042 00154         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_NOTE_STACK_0         ; pop note from stack
4F08 CFE7 F008 00155         movff   INDF1, TMP3                                     ; save current #0 entry in TMP3 for later use
4F0C D895      00156         rcall   TIA_MIDI_Hlp_PopNote
               00157         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOff_V1_NotFnd
4F0E B0E8          M         btfsc   reg, bit, reg_a
4F10 D009          M         bra     label
4F12 EE01 F020 00158         lfsr    FSR0, TIA_V1_BASE
4F16 5008      00159         movf    TMP3, W                                         ; restore note
4F18 D8DA      00160         rcall   TIA_MIDI_Hlp_NoteOff
               00161         RCALL_IFSET WREG, 0, ACCESS, TIA_MIDI_Hlp_NoteOn
4F1A B0E8          M         btfsc   reg, bit, reg_a
4F1C D8A5          M         rcall   label
4F1E EE21 F020 00162         lfsr    FSR2, TIA_V1_BASE                               ; sort notes for arpeggios
4F22 D937      00163         rcall   TIA_MIDI_Arp_Sorter
4F24 00164 TIA_MIDI_NoteOff_V1_NotFnd
               00165 
               00166         ;; --[ Voice 2 Handler ]--
4F24 00167 TIA_MIDI_NoteOff_V2
               00168         BRA_IFCLR TMP5, 1, ACCESS, TIA_MIDI_NoteOff_V2_NotFnd
4F24 A20A          M         btfss   reg, bit, reg_a
4F26 D010          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 158


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4F28 EE11 F082 00169         lfsr    FSR1, TIA_V2_BASE + TIA_Vx_NOTE_STACK_0         ; pop note from stack
4F2C CFE7 F008 00170         movff   INDF1, TMP3                                     ; save current #0 entry in TMP3 for later use
4F30 D883      00171         rcall   TIA_MIDI_Hlp_PopNote
               00172         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOff_V2_NotFnd
4F32 B0E8          M         btfsc   reg, bit, reg_a
4F34 D009          M         bra     label
4F36 EE01 F060 00173         lfsr    FSR0, TIA_V2_BASE
4F3A 5008      00174         movf    TMP3, W                                         ; restore note
4F3C D8C8      00175         rcall   TIA_MIDI_Hlp_NoteOff
               00176         RCALL_IFSET WREG, 0, ACCESS, TIA_MIDI_Hlp_NoteOn
4F3E B0E8          M         btfsc   reg, bit, reg_a
4F40 D893          M         rcall   label
4F42 EE21 F060 00177         lfsr    FSR2, TIA_V2_BASE                               ; sort notes for arpeggios
4F46 D925      00178         rcall   TIA_MIDI_Arp_Sorter
4F48 00179 TIA_MIDI_NoteOff_V2_NotFnd
               00180 
               00181         IRQ_ENABLE
4F48 8EF2          M         bsf     INTCON, GIE
4F4A 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 ;; --------------------------------------------------------------------------
4F4C 00192 TIA_MIDI_PitchBender
               00193         SET_BSR TIA_BASE
4F4C 0101          M         movlb   HIGH(reg)
4F4E 3404      00194     rlf MIOS_PARAMETER2, W
4F50 0BFE      00195         andlw   0xfe
4F52 0A80      00196         xorlw   0x80
4F54 6E04      00197     movwf   MIOS_PARAMETER2
               00198     
4F56 5003      00199         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
4F58 0B0F      00200         andlw   0x0f
4F5A 00201 TIA_MIDI_PitchBender_v1
4F5A 6320      00202         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
               00203         rgoto TIA_MIDI_PitchBender_v2
4F5C D003          M         bra     label
4F5E 5004      00204     movf    MIOS_PARAMETER2, W
4F60 6F2B      00205         movwf   TIA_V1_BASE + TIA_Vx_PITCHBENDER, BANKED
               00206     rgoto   TIA_MIDI_PitchBender_End
4F62 D004          M         bra     label
               00207     
4F64 00208 TIA_MIDI_PitchBender_v2
4F64 6360      00209         cpfseq  TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
               00210         rgoto TIA_MIDI_PitchBender_End
4F66 D002          M         bra     label
4F68 5004      00211     movf    MIOS_PARAMETER2, W
4F6A 6F6B      00212         movwf   TIA_V2_BASE + TIA_Vx_PITCHBENDER, BANKED
4F6C 00213 TIA_MIDI_PitchBender_End
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 159


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4F6C 0012      00214         return
               00215 
               00216 ;; --------------------------------------------------------------------------
               00217 ;;  This function is rcalled to forward a Controller event to the synthesizer
               00218 ;;  Input:
               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 ;; --------------------------------------------------------------------------
4F6E 00223 TIA_MIDI_CC
               00224         SET_BSR TIA_BASE
4F6E 0101          M         movlb   HIGH(reg)
               00225 
               00226         ;; special treatment for CC#0 (bank change)
4F70 5004      00227         movf    MIOS_PARAMETER2, W
4F72 E11A      00228         bnz     TIA_MIDI_CC_No00
4F74 00229 TIA_MIDI_CC_00
               00230         ;; exit if bank number >= DEFAULT_BS_KBANK_ID*4
4F74 0E14      00231     movlw   DEFAULT_BS_KBANK_ID*4
4F76 6005      00232     cpfslt  MIOS_PARAMETER3
4F78 0012      00233     return
               00234 
4F7A 5003      00235     movf        MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
4F7C 0B0F      00236         andlw   0x0f
4F7E 6320      00237         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
4F80 0012      00238         return
               00239     
4F82 C005 F014 00240         movff   MIOS_PARAMETER3, TIA_PBANK
               00241 
               00242     ;; Int.Patch if ==0
4F86 5013      00243     movf    TIA_PATCH, W
4F88 E00C      00244     bz      TIA_MIDI_CC_00_Ok
               00245     
               00246     ;; Banstick Ready
4F8A 5014      00247     movf    TIA_PBANK, W
4F8C EC6F F01C 00248     call    TIA_BANK_GetBankStickReady
4F90 B4D8      00249         skpnz
4F92 6A13      00250     clrf    TIA_PATCH   ;; to Int. Patch if BS not ready
               00251      
               00252     ;; Banstick Size
4F94 EC7C F01C 00253     call    TIA_BANK_GetBankStickSize
4F98 E104      00254     bnz     TIA_MIDI_CC_00_Ok
               00255     ;; 64/128 patches
4F9A 5013      00256     movf    TIA_PATCH, W
4F9C 0BC0      00257     andlw   0xc0
4F9E A4D8      00258     skpz
4FA0 6A13      00259     clrf    TIA_PATCH   ;; to Int. Patch if >63
               00260     
4FA2 00261 TIA_MIDI_CC_00_Ok
4FA2 ECAC F01B 00262         call    TIA_PATCH_Init
               00263         ;;goto  USER_DISPLAY_Init
4FA6 00264 TIA_MIDI_CC_00_End
4FA6 0012      00265     return
               00266 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 160


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00267 
4FA8 00268 TIA_MIDI_CC_No00
4FA8 5003      00269         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
4FAA 0B0F      00270         andlw   0x0f
4FAC 6320      00271         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
4FAE 0012      00272         return
               00273 
               00274         ;; forward CC to CCIN_Set routine
4FB0 C005 F003 00275         movff   MIOS_PARAMETER3, MIOS_PARAMETER1
4FB4 5004      00276         movf    MIOS_PARAMETER2, W
4FB6 EC03 F02D 00277         call    TIA_CCIN_Set
               00278 
4FBA 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 ;; --------------------------------------------------------------------------
4FBC 00288 TIA_MIDI_ProgramChange
               00289         SET_BSR TIA_BASE
4FBC 0101          M         movlb   HIGH(reg)
               00290 
4FBE 5003      00291         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
4FC0 0B0F      00292         andlw   0x0f
4FC2 6320      00293         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
4FC4 0012      00294         return
               00295     
               00296     ;; Int.Patch if ==0 
4FC6 5004      00297     movf    MIOS_PARAMETER2, W
4FC8 E00A      00298     bz      TIA_MIDI_ProgramChange_Ok
               00299     
               00300     ;; Banstick Ready
4FCA 5014      00301     movf    TIA_PBANK, W
4FCC EC6F F01C 00302     call    TIA_BANK_GetBankStickReady
4FD0 B4D8      00303         skpnz
4FD2 6A04      00304     clrf    MIOS_PARAMETER2
               00305      
               00306     ;; Banstick Size
4FD4 EC7C F01C 00307     call    TIA_BANK_GetBankStickSize
4FD8 E102      00308     bnz     TIA_MIDI_ProgramChange_Ok
               00309     ;; 64/128 patches
4FDA BC04      00310     btfsc       MIOS_PARAMETER2, 6
               00311     rgoto   TIA_MIDI_ProgramChange_End   
4FDC D004          M         bra     label
               00312     
4FDE 00313 TIA_MIDI_ProgramChange_Ok
4FDE C004 F013 00314         movff   MIOS_PARAMETER2, TIA_PATCH
4FE2 ECAC F01B 00315         call    TIA_PATCH_Init
               00316         ;;goto  USER_DISPLAY_Init
4FE6 00317 TIA_MIDI_ProgramChange_End
4FE6 0012      00318     return
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 161


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               00324 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00325 ;; --------------------------------------------------------------------------
4FE8 00326 TIA_MIDI_PolyAfterTouch
4FE8 C004 F005 00327         movff   MIOS_PARAMETER2, MIOS_PARAMETER3
               00328         rgoto   TIA_MIDI_AfterTouch
4FEC 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 ;; --------------------------------------------------------------------------
4FEE 00337 TIA_MIDI_AfterTouch
               00338         SET_BSR TIA_BASE
4FEE 0101          M         movlb   HIGH(reg)
               00339 
4FF0 5003      00340         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
4FF2 0B0F      00341         andlw   0x0f
4FF4 6320      00342         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
4FF6 0012      00343         return
               00344 
4FF8 5005      00345         movf    MIOS_PARAMETER3, W
4FFA 00346 _TIA_MIDI_AfterTouch
4FFA 6E03      00347         movwf   MIOS_PARAMETER1
               00348         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
4FFC 0101          M         movlb   HIGH(reg)
4FFE EE11 F0E8 00349         lfsr    FSR1, TIA_CTRL_AFTERTOUCH_BASE; prepare FSR1
5002 EFD4 F02D 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         ;; ------------------------------------------------------------------
5006 00360 TIA_MIDI_Hlp_PushNote
5006 6A06      00361         clrf    TMP1
               00362         ;; do nothing if note is already stored in note stack
5008 00363 TIA_MIDI_Hlp_PushNote_CheckLoop
5008 5006      00364         movf    TMP1, W
500A 50E3      00365         movf    PLUSW1, W
500C 1804      00366         xorwf   MIOS_PARAMETER2, W
500E B4D8      00367         skpnz
               00368         rgoto   TIA_MIDI_Hlp_PushNote_Failed       ; leave note routine if note already stored
5010 D012          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 162


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5012 2A06      00369         incf    TMP1, F
5014 0E04      00370         movlw   TIA_NOTE_STACK_LEN
5016 6206      00371         cpfseq  TMP1, ACCESS
               00372         rgoto TIA_MIDI_Hlp_PushNote_CheckLoop
5018 D7F7          M         bra     label
               00373         
               00374         ;; shift right note stack 
501A 0E02      00375         movlw   (TIA_NOTE_STACK_LEN-2)
501C 6E06      00376         movwf   TMP1
501E 00377 TIA_MIDI_Hlp_PushNote_ShiftLoop
501E 5006      00378         movf    TMP1, W
5020 CFE3 F007 00379         movff   PLUSW1, TMP2
5024 2806      00380         incf    TMP1, W
5026 C007 FFE3 00381         movff   TMP2, PLUSW1
502A 0606      00382         decf    TMP1, F
502C 2806      00383         incf    TMP1, W
502E E1F7      00384         bnz     TIA_MIDI_Hlp_PushNote_ShiftLoop
               00385 
               00386         ;; store new note at offset 0
5030 C004 FFE7 00387         movff   MIOS_PARAMETER2, INDF1
               00388 
5034 0C00      00389         retlw   0x00            ; return 0x00 as error status
               00390 
5036 00391 TIA_MIDI_Hlp_PushNote_Failed
5036 0C01      00392         retlw   0x01            ; return 0x01 as error status
               00393 
               00394         ;; ------------------------------------------------------------------
               00395 
               00396         ;; ------------------------------------------------------------------
               00397         ;; Pop a note from the stack
               00398         ;; ------------------------------------------------------------------
5038 00399 TIA_MIDI_Hlp_PopNote
               00400         ; search for note entry with the same number, erase it and push the entries behind
5038 6A06      00401         clrf    TMP1
503A 00402 TIA_MIDI_Hlp_PopNote_SearchLoop
503A 5006      00403         movf    TMP1, W
503C 50E3      00404         movf    PLUSW1, W
503E 1804      00405         xorwf   MIOS_PARAMETER2, W
5040 E005      00406         bz      TIA_MIDI_Hlp_PopNote_Found
5042 2A06      00407         incf    TMP1, F
5044 0E04      00408         movlw   TIA_NOTE_STACK_LEN
5046 6206      00409         cpfseq  TMP1, ACCESS
               00410         rgoto TIA_MIDI_Hlp_PopNote_SearchLoop
5048 D7F8          M         bra     label
               00411         rgoto   TIA_MIDI_Hlp_PopNote_Failed
504A D00D          M         bra     label
504C 00412 TIA_MIDI_Hlp_PopNote_Found
               00413 
               00414         ;; push the entries behind the found entry
504C 00415 TIA_MIDI_Hlp_PopNote_ShiftLoop
504C 2806      00416         incf    TMP1, W
504E CFE3 F007 00417         movff   PLUSW1, TMP2
5052 5006      00418         movf    TMP1, W
5054 C007 FFE3 00419         movff   TMP2, PLUSW1
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 163


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5058 2A06      00420         incf    TMP1, F
505A 0E04      00421         movlw   TIA_NOTE_STACK_LEN
505C 6206      00422         cpfseq  TMP1, ACCESS
               00423         rgoto TIA_MIDI_Hlp_PopNote_ShiftLoop
505E D7F6          M         bra     label
               00424         ;; clear the last entry
5060 0E03      00425         movlw   TIA_NOTE_STACK_LEN-1
5062 6AE3      00426         clrf    PLUSW1
5064 0C00      00427         retlw   0x00            ; return with 0x00: note deleted from stack
               00428 
5066 00429 TIA_MIDI_Hlp_PopNote_Failed
5066 0C01      00430         retlw   0x01            ; return with 0x01: note not found in stack
               00431 
               00432         ;; ------------------------------------------------------------------
               00433 
               00434         ;; ------------------------------------------------------------------
               00435         ;; Note On help function
               00436         ;; ------------------------------------------------------------------
5068 00437 TIA_MIDI_Hlp_NoteOn
               00438 ;   BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED, TIA_MIDI_Hlp_NoteOn_NoNewNote
5068 00439 TIA_MIDI_Hlp_NoteOn_NewNote
5068 0E10      00440         movlw   TIA_Vx_NOTE
506A CFEB FFF5 00441         movff   PLUSW0, TABLAT
506E CFE7 FFEB 00442         movff   INDF1, PLUSW0
5072 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 
5072 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 
5072 0E0E      00463     movlw       TIA_Vx_PORTA_RATE
5074 50EB      00464     movf        PLUSW0, W
5076 E012      00465     bz  TIA_MIDI_Hlp_NoteOn_SusKeyNoPor
5078 00466 TIA_MIDI_Hlp_NoteOn_SusKeyPor_NC
5078 0E03      00467         movlw   TIA_Vx_STAT
507A 8CEB      00468         bsf     PLUSW0, Vx_STAT_PORTA_ENABLE
               00469 
               00470         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
               00471 
507C 0E09      00472         movlw   TIA_Vx_FRQ_L
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 164


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
507E CFEB F006 00473         movff   PLUSW0, TMP1
5082 0E0A      00474         movlw   TIA_Vx_FRQ_H
5084 CFEB F007 00475         movff   PLUSW0, TMP2    
               00476 
5088 0E1C      00477         movlw   TIA_Vx_PORTA_FRQ_L
508A C006 FFEB 00478         movff   TMP1, PLUSW0
508E 0E1D      00479         movlw   TIA_Vx_PORTA_FRQ_H
5090 C007 FFEB 00480         movff   TMP2, PLUSW0   
               00481     
5094 0E1A      00482     movlw   TIA_Vx_PORTA_CTR_L 
5096 6AEB      00483         clrf    PLUSW0
5098 0E1B      00484     movlw   TIA_Vx_PORTA_CTR_H 
509A 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 
509C 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)
509C 0E15      00495         movlw   TIA_Vx_ARP_CTR
509E 6AEB      00496         clrf    PLUSW0
50A0 0E14      00497         movlw   TIA_Vx_ARP_NOTE_NUMBER
50A2 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
50A4 D81C      00511         rcall   TIA_MIDI_Hlp_GateOn
               00512 
               00513 
               00514         ;; ---[ END handle velocity ]---
               00515     
               00516         ;; ---[ BEGIN handle velocity ]---
               00517     
50A6 C003 F006 00518         movff   MIOS_PARAMETER1, TMP1   ; store MIOS_PARAMETER1
50AA C004 F007 00519         movff   MIOS_PARAMETER2, TMP2   ; store MIOS_PARAMETER2
50AE 5005      00520         movf    MIOS_PARAMETER3, W      ; copy velocity value to MIOS_PARAMETER1
50B0 E00D      00521         bz      TIA_MIDI_Hlp_NoteOn_NoVel; no velocity on note off!
50B2 6E03      00522     movwf   MIOS_PARAMETER1
50B4 0E28      00523     movlw   TIA_Vx_LAST_VEL 
50B6 C005 FFEB 00524         movff   MIOS_PARAMETER3, PLUSW0   
               00525         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
50BA 0101          M         movlb   HIGH(reg)
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 165


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
50BC EE10 F000 00526         lfsr    FSR1, FSR0
50C0 EC65 F02D 00527         call    TIA_CCIN_Cmd_VELOCITY_SkpCopy   ; set velocity value
50C4 C006 F003 00528         movff   TMP1, MIOS_PARAMETER1   ; restore MIOS_PARAMETER1
50C8 C007 F004 00529         movff   TMP2, MIOS_PARAMETER2   ; restore MIOS_PARAMETER2
               00530         ;; ---[ END handle velocity ]---
               00531 
               00532 
               00533 
50CC 00534 TIA_MIDI_Hlp_NoteOn_NoVel
               00535 
50CC 00536 TIA_MIDI_Hlp_NoteOn_TrgGateLSkp
50CC 0012      00537         return
               00538 
               00539 
               00540         ;; ------------------------------------------------------------------
               00541         ;; Note Off help function
               00542         ;; ------------------------------------------------------------------
50CE 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
50CE 6204      00548         cpfseq  MIOS_PARAMETER2, ACCESS
               00549         rgoto TIA_MIDI_Hlp_NoteOff_End
50D0 D005          M         bra     label
50D2 D812      00550         rcall   TIA_MIDI_Hlp_GateOff
50D4 00551 TIA_MIDI_Hlp_NoteOff_NoGOff
               00552         ;; ------------------------------------------------------------------
               00553 
               00554         ;; if still note available, play new note in NoteOn Section
50D4 50E7      00555         movf    INDF1, W
50D6 A4D8      00556         skpz
50D8 0C01      00557         retlw   0x01            ; return, request Note On!
               00558 
               00559         ;; else request gate clear bit
50DA D80E      00560         rcall   TIA_MIDI_Hlp_GateOff
50DC 00561 TIA_MIDI_Hlp_NoteOff_End
50DC 0C00      00562         retlw   0x00            ; return, request NO Note On!
               00563 
               00564         ;; ------------------------------------------------------------------
               00565 
               00566         ;; ------------------------------------------------------------------
               00567         ;; Gate On help function
               00568         ;; ------------------------------------------------------------------
50DE 00569 TIA_MIDI_Hlp_GateOn
50DE 90D8      00570         clrc
50E0 0E11      00571         movlw   TIA_Vx_NOTE_DELAY
50E2 34EB      00572         rlf     PLUSW0, W
50E4 6EF5      00573         movwf   TABLAT
50E6 0E12      00574         movlw   TIA_Vx_NOTE_DELAY_CTR
50E8 CFF5 FFEB 00575         movff   TABLAT, PLUSW0
               00576 
50EC 0E03      00577         movlw   TIA_Vx_STAT
               00578         ;btfsc  TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 166


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
50EE 82EB      00579         bsf     PLUSW0, Vx_STAT_GATE_SET_REQ
50F0 80EB      00580         bsf     PLUSW0, Vx_STAT_VOICE_ACTIVE
               00581 
               00582         ;; reset wavetable handler
50F2 0E2E      00583     movlw       TIA_Vx_WT_STATE
50F4 82EB      00584         bsf     PLUSW0, WT_STATE_RESET
               00585 
50F6 0012      00586         return
               00587 
               00588         ;; ------------------------------------------------------------------
               00589         ;; Gate Off help function
               00590         ;; ------------------------------------------------------------------
50F8 00591 TIA_MIDI_Hlp_GateOff
50F8 90D8      00592         clrc
50FA 0E11      00593         movlw   TIA_Vx_NOTE_DELAY
50FC 34EB      00594         rlf     PLUSW0, W
50FE 6EF5      00595         movwf   TABLAT
5100 0E12      00596         movlw   TIA_Vx_NOTE_DELAY_CTR
5102 CFF5 FFEB 00597         movff   TABLAT, PLUSW0
               00598 
5106 0E03      00599         movlw   TIA_Vx_STAT
5108 92EB      00600         bcf     PLUSW0, Vx_STAT_GATE_SET_REQ
510A 84EB      00601         bsf     PLUSW0, Vx_STAT_GATE_CLR_REQ
510C 90EB      00602         bcf     PLUSW0, Vx_STAT_VOICE_ACTIVE
510E 0012      00603         return
               00604 
               00605         ;; ------------------------------------------------------------------
               00606         ;; for Note On/Note Off in Mono mode
               00607         ;; MIDI channel in MIOS_PARAMETER1[0..3]
               00608         ;; result in TMP5
5110 00609 TIA_MIDI_GetAssignedChannels
5110 6A0A      00610         clrf    TMP5            ; TMP5 contains the voices which should be played
               00611         
5112 5003      00612         movf    MIOS_PARAMETER1, W
5114 0B0F      00613         andlw   0x0f
5116 1920      00614         xorwf   TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, W, BANKED
5118 B4D8      00615         skpnz
511A 800A      00616         bsf     TMP5, 0         ; play voice 1
               00617 
511C 5003      00618         movf    MIOS_PARAMETER1, W
511E 0B0F      00619         andlw   0x0f
5120 1960      00620         xorwf   TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL, W, BANKED
5122 B4D8      00621         skpnz
5124 820A      00622         bsf     TMP5, 1         ; play voice 2
               00623     
               00624    
5126 500A      00625     movf        TMP5, W
5128 0012      00626         return
               00627 
               00628         ;; ------------------------------------------------------------------
               00629         ;; for Note On/Off in Mono mode
               00630         ;; note number in MIOS_PARAMETER2
               00631         ;; result will be ANDed to TMP5 --- TIA_MIDI_GetAssignedChannels should be called before!
               00632 TIA_MIDI_GETASSIGNEDVOICEx MACRO FLAG_Vx, TIA_Vx_BASE
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 167


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00633         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00634         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00635         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_End
               00636 
               00637         ;; handle split points
               00638         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
               00639         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
               00640         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
               00641     
               00642         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
               00643         cpfslt  MIOS_PARAMETER2, ACCESS
               00644         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00645         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00646 
               00647 TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00648         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
               00649         cpfsgt  MIOS_PARAMETER2, ACCESS
               00650         rgoto TIA_MIDI_GETASSIGNEDVOICEx_End
               00651 TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00652         bcf     TMP5, FLAG_Vx           ; don't play voice
               00653 TIA_MIDI_GETASSIGNEDVOICEx_End
               00654         ENDM
               00655 
512A 00656 TIA_MIDI_GetAssignedVoices
               00657         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
512A 5121          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
512C 1122          M         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
512E E008          M         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
                   M     
5130 5121          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
5132 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
5134 D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
5136 D003          M         bra     label
                   M 
5138     M TIA_MIDI_GETASSIGNEDVOICEx_LOk
5138 5122          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
513A 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_End
513C D001          M         bra     label
513E     M TIA_MIDI_GETASSIGNEDVOICEx_LOff
513E 900A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
5140     M TIA_MIDI_GETASSIGNEDVOICEx_End
               00658         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 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 168


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M         ;; handle split points
5140 5161          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
5142 1162          M         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
5144 E008          M         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
                   M     
5146 5161          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
5148 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
514A D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
514C D003          M         bra     label
                   M 
514E     M TIA_MIDI_GETASSIGNEDVOICEx_LOk
514E 5162          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
5150 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_End
5152 D001          M         bra     label
5154     M TIA_MIDI_GETASSIGNEDVOICEx_LOff
5154 920A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
5156     M TIA_MIDI_GETASSIGNEDVOICEx_End
5156 500A      00659     movf        TMP5, W
5158 0012      00660         return
               00661     
               00662         ;; ------------------------------------------------------------------
               00663         ;; for Note On/Off in Mono mode
               00664         ;; note number in MIOS_PARAMETER2
               00665         ;; result will be ANDed to TMP5 --- TIA_MIDI_GetAssignedChannels should be called before!
               00666 TIA_MIDI_GETASSIGNEDKEYx MACRO FLAG_Vx, TIA_Vx_BASE
               00667         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOk
               00668         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOff
               00669         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_End
               00670 
               00671     btfsc   TIA_Vx_BASE + TIA_Vx_MODE, Vx_MODE_KEY_EXTENDED, BANKED
               00672     rgoto   TIA_MIDI_GETASSIGNEDKEYx_End
               00673     
               00674         movf    TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
               00675         cpfslt  MIOS_PARAMETER2, ACCESS
               00676         rgoto TIA_MIDI_GETASSIGNEDKEYx_LOk
               00677         rgoto   TIA_MIDI_GETASSIGNEDKEYx_LOff
               00678 
               00679 TIA_MIDI_GETASSIGNEDKEYx_LOk
               00680     movlw   0x1f
               00681     cpfsgt  TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, BANKED
               00682     movf    TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, W, BANKED
               00683         addwf   TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
               00684         cpfsgt  MIOS_PARAMETER2, ACCESS
               00685         rgoto TIA_MIDI_GETASSIGNEDKEYx_End
               00686 TIA_MIDI_GETASSIGNEDKEYx_LOff
               00687         bcf     TMP5, FLAG_Vx           ; don't play voice
               00688 TIA_MIDI_GETASSIGNEDKEYx_End
               00689         ENDM
               00690 
515A 00691 TIA_MIDI_GetAssignedKeys
               00692         TIA_MIDI_GETASSIGNEDKEYx 0, TIA_V1_BASE
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 169


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOk
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOff
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_End
                   M 
515A B724          M     btfsc   TIA_Vx_BASE + TIA_Vx_MODE, Vx_MODE_KEY_EXTENDED, BANKED
                   M     rgoto   TIA_MIDI_GETASSIGNEDKEYx_End
515C D00B          M         bra     label
                   M     
515E 5125          M         movf    TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
5160 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_LOk
5162 D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDKEYx_LOff
5164 D006          M         bra     label
                   M 
5166     M TIA_MIDI_GETASSIGNEDKEYx_LOk
5166 0E1F          M     movlw   0x1f
5168 6526          M     cpfsgt  TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, BANKED
516A 5126          M     movf    TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, W, BANKED
516C 2525          M         addwf   TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
516E 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_End
5170 D001          M         bra     label
5172     M TIA_MIDI_GETASSIGNEDKEYx_LOff
5172 900A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
5174     M TIA_MIDI_GETASSIGNEDKEYx_End
               00693         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 
5174 B764          M     btfsc   TIA_Vx_BASE + TIA_Vx_MODE, Vx_MODE_KEY_EXTENDED, BANKED
                   M     rgoto   TIA_MIDI_GETASSIGNEDKEYx_End
5176 D00B          M         bra     label
                   M     
5178 5165          M         movf    TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
517A 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_LOk
517C D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDKEYx_LOff
517E D006          M         bra     label
                   M 
5180     M TIA_MIDI_GETASSIGNEDKEYx_LOk
5180 0E1F          M     movlw   0x1f
5182 6566          M     cpfsgt  TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, BANKED
5184 5166          M     movf    TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, W, BANKED
5186 2565          M         addwf   TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
5188 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_End
518A D001          M         bra     label
518C     M TIA_MIDI_GETASSIGNEDKEYx_LOff
518C 920A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
518E     M TIA_MIDI_GETASSIGNEDKEYx_End
518E 500A      00694     movf        TMP5, W
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 170


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5190 0012      00695         return    
               00696 
               00697     
               00698         ;; ------------------------------------------------------------------
               00699         ;; arpeggiator sorter
               00700         ;; expecting base pointer to voice record in FSR2
5192 00701 TIA_MIDI_Arp_Sorter
               00702         ;; TIA_Vx_ARP_NOTE_0 -> FSR0
5192 CFDA FFEA 00703         movff   FSR2H, FSR0H
5196 50D9      00704         movf    FSR2L, W
5198 0F1E      00705         addlw   TIA_Vx_ARP_NOTE_0
519A 6EE9      00706         movwf   FSR0L
               00707 
               00708         ;; TIA_Vx_NOTE_STACK_0 -> FSR1
519C CFDA FFE2 00709         movff   FSR2H, FSR1H
51A0 50D9      00710         movf    FSR2L, W
51A2 0F22      00711         addlw   TIA_Vx_NOTE_STACK_0
51A4 6EE1      00712         movwf   FSR1L
               00713 
51A6 CFE9 F006 00714         movff   FSR0L, TMP1     ; save pointer to ARP_NOTE_0 in TMP1
               00715         ;; clear all current entries
51AA 6AEE      00716         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_0)
51AC 6AEE      00717         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_1)
51AE 6AEE      00718         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_2)
51B0 6AEE      00719         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_3)
51B2 C006 FFE9 00720         movff   TMP1, FSR0L     ; restore pointer to ARP_NOTE_0 from TMP1
               00721 
51B6 50E7      00722         movf    INDF1, W        ; (TIA_Vx_NOTE_STACK_0)
51B8 E017      00723         bz      TIA_MIDI_Arp_Sorter_End
               00724 
51BA 50E6      00725         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_0)
51BC D816      00726         rcall   TIA_MIDI_ARP_Sorter_Add
51BE 50E6      00727         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_1)
51C0 D814      00728         rcall   TIA_MIDI_ARP_Sorter_Add
51C2 50E6      00729         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_2)
51C4 D812      00730         rcall   TIA_MIDI_ARP_Sorter_Add
51C6 50E6      00731         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_3)
51C8 D810      00732         rcall   TIA_MIDI_ARP_Sorter_Add
               00733 
               00734         ;; if rate is > 0, and arp has been reset: copy first arp note into TIA_Vx_NOTE
51CA 0E13      00735         movlw   TIA_Vx_ARP_RATE
51CC 50DB      00736         movf    PLUSW2, W
51CE E00C      00737         bz      TIA_MIDI_Arp_Sorter_End
51D0 0E15      00738         movlw   TIA_Vx_ARP_CTR
51D2 50DB      00739         movf    PLUSW2, W
51D4 E109      00740         bnz     TIA_MIDI_Arp_Sorter_End
51D6 0E14      00741         movlw   TIA_Vx_ARP_NOTE_NUMBER
51D8 50DB      00742         movf    PLUSW2, W
51DA E106      00743         bnz     TIA_MIDI_Arp_Sorter_End
               00744 
51DC 0E1E      00745         movlw   TIA_Vx_ARP_NOTE_0
51DE CFDB FFF5 00746         movff   PLUSW2, TABLAT
51E2 0E10      00747         movlw   TIA_Vx_NOTE
51E4 CFF5 FFDB 00748         movff   TABLAT, PLUSW2
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 171


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00749 
51E8 00750 TIA_MIDI_Arp_Sorter_End
51E8 0012      00751         return
               00752 
               00753 ;; ---
               00754         ;; add to ARP note buffer, sort automatically from lowest to highest note
51EA 00755 TIA_MIDI_ARP_Sorter_Add
51EA B4D8      00756         skpnz                   ; only add notes > 0
51EC 0012      00757         return
               00758 
51EE 6E06      00759         movwf   TMP1            ; store new note number in TMP2
51F0 6A07      00760         clrf    TMP2            ; TMP2 used as loop counter
51F2 00761 TIA_MIDI_ARP_Sorter_Loop
51F2 5007      00762         movf    TMP2, W
51F4 50EB      00763         movf    PLUSW0, W
51F6 E006      00764         bz      TIA_MIDI_ARP_Sorter_Push; the fourth note will ever be pushed as the appr. byte is zero
51F8 5C06      00765         subwf   TMP1, W
51FA E304      00766         bnc     TIA_MIDI_ARP_Sorter_Push
51FC 2A07      00767         incf    TMP2, F
               00768         BRA_IFCLR TMP2, 2, ACCESS, TIA_MIDI_ARP_Sorter_Loop
51FE A407          M         btfss   reg, bit, reg_a
5200 D7F8          M         bra     label
5202 0012      00769         return                  ; this case never happens
               00770 
5204 00771 TIA_MIDI_ARP_Sorter_Push
5204 5007      00772         movf    TMP2, W         ; fourth note: no shift required
5206 0A03      00773         xorlw   0x03
5208 E00D      00774         bz      TIA_MIDI_ARP_Sorter_PushN
520A 0E02      00775         movlw   0x02
520C 6E08      00776         movwf   TMP3
520E 00777 TIA_MIDI_ARP_Sorter_PushL
520E 5008      00778         movf    TMP3, W
5210 CFEB F009 00779         movff   PLUSW0, TMP4
5214 0F01      00780         addlw   1
5216 C009 FFEB 00781         movff   TMP4, PLUSW0
521A 5007      00782         movf    TMP2, W
521C 1808      00783         xorwf   TMP3, W
521E E002      00784         bz      TIA_MIDI_ARP_Sorter_PushN
5220 0608      00785         decf    TMP3, F
               00786         rgoto   TIA_MIDI_ARP_Sorter_PushL
5222 D7F5          M         bra     label
               00787 
5224 00788 TIA_MIDI_ARP_Sorter_PushN
5224 5007      00789         movf    TMP2, W
5226 C006 FFEB 00790         movff   TMP1, PLUSW0
522A 0012      00791         return
               00405 #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)
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 172


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               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]
  00000001     00026 TIA_SYSEX_STATE_DH_RECEIVED     EQU     1       ; used by Action CFG_[Read/Write]
  00000000     00027 TIA_SYSEX_STATE_DL_RECEIVED     EQU     0       ; used by Action CFG_[Read/Write]
               00028 
               00029 ;; --------------------------------------------------------------------------
               00030 ;;  This sysex parser waits for the TIA Header 
               00031 ;; --------------------------------------------------------------------------
522C 00032 TIA_SYSEX_SysExCheck
               00033         ;; store received byte in TIA_SYSEX_IN
522C 6E23      00034         movwf   TIA_SYSEX_IN
               00035 
               00036         ;; ignore realtime messages
522E 0EF8      00037         movlw   0xf8
5230 6023      00038         cpfslt  TIA_SYSEX_IN, ACCESS
5232 0012      00039         return
               00040 
               00041         ;; check sysex state
               00042         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_MYSYSEX, ACCESS, TIA_SYSEX_Handler
5234 BE21          M         btfsc   reg, bit, reg_a
5236 D020          M         bra     label
               00043 
5238 5021      00044         movf    TIA_SYSEX_STATE, W
523A D80E      00045         rcall   TIA_SYSEX_SysExHeaderGet
523C 6223      00046         cpfseq  TIA_SYSEX_IN, ACCESS
               00047         rgoto TIA_SYSEX_SysExCheckFailed
523E D00A          M         bra     label
5240 2A21      00048         incf    TIA_SYSEX_STATE, F
5242 5021      00049         movf    TIA_SYSEX_STATE, W
5244 0B07      00050         andlw   0x07
5246 0A06      00051         xorlw   0x06    ; wait for 6 bytes (f0 00 00 7E 46 <device-id>)
5248 E106      00052         bnz     TIA_SYSEX_SysExCheckOk
               00053 
               00054         ;; SysEx ID received, lets go
524A 0E80      00055         movlw   (1 << TIA_SYSEX_STATE_MYSYSEX)
524C 6E21      00056         movwf   TIA_SYSEX_STATE
524E EC28 F016 00057         call    MIOS_MPROC_MergerDisable
               00058         rgoto   TIA_SYSEX_SysExCheckOk
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 173


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5252 D001          M         bra     label
               00059 
5254 00060 TIA_SYSEX_SysExCheckFailed
               00061         ;; reset the sysex counter and action ID
5254 D80B      00062         rcall   TIA_SYSEX_ActionInvalid
5256 00063 TIA_SYSEX_SysExCheckOk
               00064 
5256 00065 TIA_SYSEX_SysExCheck_End
5256 0012      00066         return
               00067 
               00068 ; ==========================================================================
               00069 
               00070 ;; --------------------------------------------------------------------------
               00071 ;;  Returns expected MIDI bytes from SysEx header
               00072 ;; --------------------------------------------------------------------------
5258 00073 TIA_SYSEX_SysExHeaderGet
5258 0B07      00074         andlw   0x07
               00075         JUMPTABLE_2BYTES_UNSECURE
525A ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
525E 0CF0      00076         retlw   0xf0
5260 0C00      00077         retlw   0x00            ; Vendor ID
5262 0C00      00078         retlw   0x00
5264 0C7E      00079         retlw   0x7e
5266 0C51      00080         retlw   0x51            ; MIDIbox TIA ID (51 - the ultimative number + 4)
5268 5020      00081         movf    TIA_MIDI_DEVICE, W
526A 0012      00082         return
               00083 
               00084 ;; --------------------------------------------------------------------------
               00085 ;;  Action Invalid will be invoked when receiving an invalid sequence
               00086 ;; --------------------------------------------------------------------------
526C 00087 TIA_SYSEX_ActionInvalid
               00088 
               00089 ;; --------------------------------------------------------------------------
               00090 ;;  Action finished will be invoked when midi action is done
               00091 ;; --------------------------------------------------------------------------
526C 00092 TIA_SYSEX_ActionFinished
526C 6A21      00093         clrf    TIA_SYSEX_STATE
526E 6A22      00094         clrf    TIA_SYSEX_ACTION
               00095         ;; reinit patch if engine has been disabled during upload
5270 9010      00096         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00097         
5272 EC2A F016 00098         call    MIOS_MPROC_MergerEnable
               00099         rgoto   TIA_SYSEX_SysExCheck_End
5276 D7EF          M         bra     label
               00100 
               00101 
               00102 ;; --------------------------------------------------------------------------
               00103 ;;  MIDI Check action: perform a sysex action
               00104 ;; --------------------------------------------------------------------------
5278 00105 TIA_SYSEX_Handler
               00106         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_ACTION, ACCESS, TIA_SYSEX_Handler_DoAction
5278 BC21          M         btfsc   reg, bit, reg_a
527A D005          M         bra     label
               00107 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 174


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
527C 8C21      00108         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_ACTION
               00109 
527E C023 F022 00110         movff   TIA_SYSEX_IN, TIA_SYSEX_ACTION  ; store action ID
5282 D81A      00111         rcall   TIA_SYSEX_Handler_InitAction    ; initialize the action
               00112         rgoto   TIA_SYSEX_SysExCheck_End        ; branch to the end
5284 D7E8          M         bra     label
               00113 
               00114         ;; ---
               00115 
5286 00116 TIA_SYSEX_Handler_DoAction
               00117         ;; branch to end if status byte (i.e. F7)
               00118         BRA_IFSET TIA_SYSEX_IN, 7, ACCESS, TIA_SYSEX_Handler_EndAction
5286 BE23          M         btfsc   reg, bit, reg_a
5288 D02E          M         bra     label
               00119 
               00120         ;; branch depending on current action ID
528A 5022      00121         movf    TIA_SYSEX_ACTION, W
               00122         JUMPTABLE_2BYTES 16     ; 16 entries
528C 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
528E B0D8          M         skpnc
5290 0EF0          M         movlw   -(max_value)
5292 0F10          M         addlw   max_value
5294 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00123         rgoto   TIA_SYSEX_ActionInvalid
5298 D7E9          M         bra     label
               00124         rgoto   TIA_SYSEX_Action_PRESET_Read
529A D040          M         bra     label
               00125         rgoto   TIA_SYSEX_Action_PRESET_Write
529C D093          M         bra     label
               00126         rgoto   TIA_SYSEX_Action_BANK_Read
529E D130          M         bra     label
               00127         rgoto   TIA_SYSEX_Action_BANK_WriteName
52A0 D194          M         bra     label
               00128         rgoto   TIA_SYSEX_Action_PAR_Read
52A2 D1E3          M         bra     label
               00129         rgoto   TIA_SYSEX_Action_PAR_Write
52A4 D213          M         bra     label
               00130         rgoto   TIA_SYSEX_ActionInvalid
52A6 D7E2          M         bra     label
               00131         rgoto   TIA_SYSEX_ActionInvalid
52A8 D7E1          M         bra     label
               00132         rgoto   TIA_SYSEX_ActionInvalid
52AA D7E0          M         bra     label
               00133         rgoto   TIA_SYSEX_ActionInvalid
52AC D7DF          M         bra     label
               00134         rgoto   TIA_SYSEX_Action_BANK_Sel
52AE D244          M         bra     label
               00135         rgoto   TIA_SYSEX_Action_CFG_Read
52B0 D25C          M         bra     label
               00136         rgoto   TIA_SYSEX_Action_CFG_Write
52B2 D2E9          M         bra     label
               00137         rgoto   TIA_SYSEX_Action_RequestCC
52B4 D319          M         bra     label
               00138         rgoto   TIA_SYSEX_Action_Ping
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 175


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
52B6 D31C          M         bra     label
               00139 
               00140 
               00141 ;; --------------------------------------------------------------------------
               00142 ;;  Initialize an action depending on TIA_SYSEX_ACTION
               00143 ;; --------------------------------------------------------------------------
52B8 00144 TIA_SYSEX_Handler_InitAction
52B8 5022      00145         movf    TIA_SYSEX_ACTION, W
               00146         JUMPTABLE_2BYTES 16     ; 16 entries
52BA 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
52BC B0D8          M         skpnc
52BE 0EF0          M         movlw   -(max_value)
52C0 0F10          M         addlw   max_value
52C2 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00147         rgoto   TIA_SYSEX_ActionInvalid
52C6 D7D2          M         bra     label
               00148         rgoto   TIA_SYSEX_Init_PRESET_Read
52C8 D028          M         bra     label
               00149         rgoto   TIA_SYSEX_Init_PRESET_Write
52CA D078          M         bra     label
               00150         rgoto   TIA_SYSEX_Init_BANK_Read
52CC D115          M         bra     label
               00151         rgoto   TIA_SYSEX_Init_BANK_WriteName
52CE D17C          M         bra     label
               00152     rgoto       TIA_SYSEX_Init_PAR_Read
52D0 D1CB          M         bra     label
               00153         rgoto   TIA_SYSEX_Init_PAR_Write
52D2 D1FB          M         bra     label
               00154         rgoto   TIA_SYSEX_ActionInvalid
52D4 D7CB          M         bra     label
               00155         rgoto   TIA_SYSEX_ActionInvalid
52D6 D7CA          M         bra     label
               00156         rgoto   TIA_SYSEX_ActionInvalid
52D8 D7C9          M         bra     label
               00157         rgoto   TIA_SYSEX_ActionInvalid
52DA D7C8          M         bra     label
               00158         rgoto   TIA_SYSEX_Init_BANK_Sel
52DC D22B          M         bra     label
               00159         rgoto   TIA_SYSEX_Init_CFG_Read
52DE D244          M         bra     label
               00160         rgoto   TIA_SYSEX_Init_CFG_Write
52E0 D2D0          M         bra     label
               00161         rgoto   TIA_SYSEX_Init_RequestCC
52E2 D301          M         bra     label
               00162         rgoto   TIA_SYSEX_Init_Ping
52E4 D304          M         bra     label
               00163 
               00164         
               00165 ;; --------------------------------------------------------------------------
               00166 ;;  Finish an action depending on TIA_SYSEX_ACTION
               00167 ;; --------------------------------------------------------------------------
52E6 00168 TIA_SYSEX_Handler_EndAction
               00169         ;; if sysex footer (F7) has not been received here, action is invalid!
52E6 0EF7      00170         movlw   0xf7
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 176


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
52E8 1823      00171         xorwf   TIA_SYSEX_IN, W
52EA E1C0      00172         bnz     TIA_SYSEX_ActionInvalid
               00173 
               00174         ;; else finish action
52EC 5022      00175         movf    TIA_SYSEX_ACTION, W
               00176         JUMPTABLE_2BYTES 16     ; 16 entries
52EE 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
52F0 B0D8          M         skpnc
52F2 0EF0          M         movlw   -(max_value)
52F4 0F10          M         addlw   max_value
52F6 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00177         rgoto   TIA_SYSEX_ActionInvalid
52FA D7B8          M         bra     label
               00178         rgoto   TIA_SYSEX_End_PRESET_Read
52FC D022          M         bra     label
               00179         rgoto   TIA_SYSEX_End_PRESET_Write
52FE D09E          M         bra     label
               00180         rgoto   TIA_SYSEX_End_BANK_Read
5300 D10C          M         bra     label
               00181         rgoto   TIA_SYSEX_End_BANK_WriteName
5302 D17C          M         bra     label
               00182         rgoto   TIA_SYSEX_End_PAR_Read
5304 D1C1          M         bra     label
               00183         rgoto   TIA_SYSEX_End_PAR_Write
5306 D1F7          M         bra     label
               00184         rgoto   TIA_SYSEX_ActionInvalid
5308 D7B1          M         bra     label
               00185         rgoto   TIA_SYSEX_ActionInvalid
530A D7B0          M         bra     label
               00186         rgoto   TIA_SYSEX_ActionInvalid
530C D7AF          M         bra     label
               00187         rgoto   TIA_SYSEX_ActionInvalid
530E D7AE          M         bra     label
               00188         rgoto   TIA_SYSEX_End_BANK_Sel
5310 D216          M         bra     label
               00189         rgoto   TIA_SYSEX_End_CFG_Read
5312 D232          M         bra     label
               00190         rgoto   TIA_SYSEX_End_CFG_Write
5314 D2CC          M         bra     label
               00191         rgoto   TIA_SYSEX_End_RequestCC
5316 D2E9          M         bra     label
               00192         rgoto   TIA_SYSEX_End_Ping
5318 D2EC          M         bra     label
               00193 
               00194 ;; --------------------------------------------------------------------------
               00195 ;;  MIDI Action: Patch Read
               00196 ;; --------------------------------------------------------------------------
531A 00197 TIA_SYSEX_Init_PRESET_Read
531A 0012      00198         return
               00199 
531C 00200 TIA_SYSEX_Action_PRESET_Read
               00201         ;; receive <type> <bank> <patch> F7
531C 00202 TIA_SYSEX_Action_PRESET_Read_T
               00203         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_Read_B
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 177


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
531C B621          M         btfsc   reg, bit, reg_a
531E D004          M         bra     label
5320 8621      00204         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
5322 C023 F025 00205         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00206         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5326 D797          M         bra     label
               00207 
5328 00208 TIA_SYSEX_Action_PRESET_Read_B
               00209         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_Read_P
5328 B821          M         btfsc   reg, bit, reg_a
532A D004          M         bra     label
532C 8821      00210         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED    
532E C023 F011 00211         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00212         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5332 D791          M         bra     label
               00213     
5334 00214 TIA_SYSEX_Action_PRESET_Read_P
               00215         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_ReadStall
5334 BA21          M         btfsc   reg, bit, reg_a
5336 D004          M         bra     label
5338 8A21      00216         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
533A C023 F012 00217         movff   TIA_SYSEX_IN, TIA_PRESET                ; load preset
               00218         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
533E D78B          M         bra     label
               00219                 
5340 00220 TIA_SYSEX_Action_PRESET_ReadStall
               00221         ;; do nothing until sysex footer (F7) has been received
               00222         rgoto   TIA_SYSEX_SysExCheck_End
5340 D78A          M         bra     label
               00223 
5342 00224 TIA_SYSEX_End_PRESET_Read
               00225         ;; action invalid if patch number has not been received
               00226         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5342 AA21          M         btfss   reg, bit, reg_a
5344 D793          M         bra     label
               00227 
5346 C011 F007 00228     movff   TIA_BANK, TMP2  ;; store relative bank
534A 5025      00229     movf        TIA_SYSEX_ADDRESS, W
534C DB29      00230     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank      ; set bank to absolute
534E 6E26      00231     movwf   TIA_SYSEX_ERROR
5350 E10F      00232     bnz     TIA_SYSEX_End_PRESET_Read_Cont
               00233     
5352 5012      00234     movf        TIA_PRESET, W
5354 E00D      00235     bz      TIA_SYSEX_End_PRESET_Read_Cont    
5356 5011      00236     movf    TIA_BANK, W
5358 EC6F F01C 00237     call    TIA_BANK_GetBankStickReady
535C A4D8      00238     skpz
               00239         rgoto   TIA_SYSEX_End_PRESET_Read_Size
535E D003          M         bra     label
               00240     ;; BS not ready Error #3
5360 0E03      00241     movlw   0x03
5362 6E26      00242     movwf   TIA_SYSEX_ERROR
               00243     rgoto   TIA_SYSEX_End_PRESET_Read_Cont
5364 D005          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 178


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5366 00244 TIA_SYSEX_End_PRESET_Read_Size    
5366 EC7C F01C 00245     call    TIA_BANK_GetBankStickSize
536A E102      00246     bnz     TIA_SYSEX_End_PRESET_Read_Cont
               00247 
536C BC12      00248     btfsc       TIA_PRESET, 6
536E 6A12      00249         clrf    TIA_PRESET
               00250 
5370 00251 TIA_SYSEX_End_PRESET_Read_Cont
               00252 
               00253         ;; send SysEx header
5370 DAC8      00254         rcall   TIA_SYSEX_Send_SysExHeader
               00255 
               00256         ;; Send PRESET_Read ID
5372 0E01      00257         movlw   0x01
5374 EC24 F016 00258         call    MIOS_MIDI_TxBufferPut
               00259 
               00260         ;; send requested preset type number
5378 5025      00261     movf        TIA_SYSEX_ADDRESS, W
537A 0B7F      00262     andlw   0x7f
537C EC24 F016 00263         call    MIOS_MIDI_TxBufferPut
               00264     
               00265         ;; send requested relative bank number
5380 5007      00266         movf    TMP2, W
5382 0B1F      00267     andlw   0x1f
5384 EC24 F016 00268         call    MIOS_MIDI_TxBufferPut
               00269     
               00270         ;; send requested preset number
5388 5012      00271         movf    TIA_PRESET, W
538A 0B7F      00272     andlw   0x7f
538C EC24 F016 00273         call    MIOS_MIDI_TxBufferPut
               00274    
5390 5026      00275     movf    TIA_SYSEX_ERROR, W
5392 E004      00276     bz      TIA_SYSEX_End_PRESET_Read_Cont_Ok
5394 0B7F      00277     andlw       0x7f
5396 EC24 F016 00278         call    MIOS_MIDI_TxBufferPut
               00279     rgoto   TIA_SYSEX_End_PRESET_Read_Footer
539A D00D          M         bra     label
               00280     
539C 00281 TIA_SYSEX_End_PRESET_Read_Cont_Ok 
               00282         ;; clear checksum
539C 6A24      00283         clrf    TIA_SYSEX_CHECKSUM
               00284 
539E 5025      00285     movf        TIA_SYSEX_ADDRESS, W
53A0 DAFF      00286     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank     ; set bank to absolute
               00287     
53A2 5025      00288     movf        TIA_SYSEX_ADDRESS, W
53A4 E102      00289     bnz     TIA_SYSEX_End_PRESET_Read_Cont_WTKit
               00290         ;; send patch (128 bytes)
53A6 00291 TIA_SYSEX_End_PRESET_Read_Cont_Patch    
53A6 DACB      00292         rcall   TIA_SYSEX_Hlp_SendPreset        
               00293     rgoto   TIA_SYSEX_End_PRESET_Read_Cont_ChkSum
53A8 D001          M         bra     label
               00294     
53AA 00295 TIA_SYSEX_End_PRESET_Read_Cont_WTKit   
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 179


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
53AA DADE      00296         rcall   TIA_SYSEX_Hlp_SendWTKit 
               00297 
53AC 00298 TIA_SYSEX_End_PRESET_Read_Cont_ChkSum    
               00299         ;; send checksum
53AC 5024      00300         movf    TIA_SYSEX_CHECKSUM, W
53AE 0880      00301         sublw   0x80
53B0 0B7F      00302         andlw   0x7f
53B2 EC24 F016 00303         call    MIOS_MIDI_TxBufferPut
               00304 
53B6 00305 TIA_SYSEX_End_PRESET_Read_Footer
               00306         ;; send of SysEx footer
53B6 0E01      00307         movlw   0x01            ; (independend from merger state)
53B8 DAB7      00308         rcall   TIA_SYSEX_Send_SysExFooter
               00309 
               00310         ;; finish Action
               00311         rgoto   TIA_SYSEX_ActionFinished
53BA D758          M         bra     label
               00312 
               00313 ;; --------------------------------------------------------------------------
               00314 ;;  MIDI Action: Patch Write
               00315 ;; --------------------------------------------------------------------------
53BC 00316 TIA_SYSEX_Init_PRESET_Write
               00317         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
53BC 8010      00318         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
53BE EC41 F01F 00319     call    TIA_TUNE_Note_Off
53C2 0012      00320         return
               00321 
53C4 00322 TIA_SYSEX_Action_PRESET_Write
               00323         ;; receive <type> <bank> <patch> <128 bytes> F7  //Patch type
               00324     ;; or
               00325     ;; receive <type> <bank> <patch> <256 bytes> F7  //WT or Kit preset type
53C4 00326 TIA_SYSEX_Action_PRESET_WriteT
               00327         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteB
53C4 B621          M         btfsc   reg, bit, reg_a
53C6 D004          M         bra     label
53C8 8621      00328         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
53CA C023 F025 00329         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00330         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
53CE D743          M         bra     label
               00331 
53D0 00332 TIA_SYSEX_Action_PRESET_WriteB
               00333         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteP
53D0 B821          M         btfsc   reg, bit, reg_a
53D2 D004          M         bra     label
53D4 8821      00334         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
53D6 C023 F011 00335         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00336         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
53DA D73D          M         bra     label
               00337     
53DC 00338 TIA_SYSEX_Action_PRESET_WriteP
               00339         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteDH 
53DC BA21          M         btfsc   reg, bit, reg_a
53DE D007          M         bra     label
53E0 8A21      00340         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 180


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
53E2 C023 F012 00341         movff   TIA_SYSEX_IN, TIA_PRESET                ; load preset 
               00342     
53E6 6A24      00343         clrf    TIA_SYSEX_CHECKSUM              ; clear checksum
53E8 6AA9      00344         clrf    EEADR                   ; clear address
53EA 6A26      00345     clrf    TIA_SYSEX_ERROR      ; clear reply error
               00346         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
53EC D734          M         bra     label
               00347 
53EE 00348 TIA_SYSEX_Action_PRESET_WriteDH
               00349     BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM, ACCESS, TIA_SYSEX_Action_PRESET_WriteChk
53EE B421          M         btfsc   reg, bit, reg_a
53F0 D022          M         bra     label
               00350     BRA_IFCLR TIA_SYSEX_ADDRESS, 0, ACCESS, TIA_SYSEX_Action_PRESET_WriteDL
53F2 A025          M         btfss   reg, bit, reg_a
53F4 D00E          M         bra     label
               00351         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteDL
53F6 B221          M         btfsc   reg, bit, reg_a
53F8 D00C          M         bra     label
53FA 8221      00352         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED
               00353 
53FC EE02 F000 00354         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN                    ; init pointer to upload buffer
5400 CFA9 FFE9 00355         movff   EEADR, FSR0L
               00356     ;; store received byte in upload buffer
5404 6AEF      00357     clrf    INDF0
5406 5023      00358         movf    TIA_SYSEX_IN, W
5408 A4D8      00359     skpz
540A 8EEF      00360         bsf     INDF0, 7
540C 0B7F      00361     andlw       0x7f
540E 2624      00362         addwf   TIA_SYSEX_CHECKSUM, F
               00363     ;; add to checksum  
               00364     rgoto       TIA_SYSEX_SysExCheck_End        ; wait for next byte
5410 D722          M         bra     label
               00365                 
5412 00366 TIA_SYSEX_Action_PRESET_WriteDL
               00367         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM, ACCESS, TIA_SYSEX_Action_PRESET_WriteChk
5412 B421          M         btfsc   reg, bit, reg_a
5414 D010          M         bra     label
               00368 
5416 9221      00369     bcf TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED
               00370 
5418 EE02 F000 00371         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN                    ; init pointer to upload buffer
541C CFA9 FFE9 00372         movff   EEADR, FSR0L
               00373 
5420 A025      00374     btfss   TIA_SYSEX_ADDRESS, 0, ACCESS
5422 6AEF      00375     clrf    INDF0
               00376         ;; store received byte in upload buffer
5424 5023      00377         movf    TIA_SYSEX_IN, W
5426 0B7F      00378     andlw       0x7f
5428 26EF      00379         addwf   INDF0, F
               00380 
               00381         ;; add to checksum
542A 2624      00382         addwf   TIA_SYSEX_CHECKSUM, F
               00383         
               00384         ;; increment address
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 181


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
542C 2AA9      00385         incf    EEADR, F
               00386 
               00387         ;; if FSR0L is zero, go into WAIT_CHECKSUM state
542E 0E80      00388         movlw   0x80
5430 60A9      00389         cpfslt  EEADR, ACCESS
5432 8421      00390         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM
               00391 
               00392         ;; wait for next byte
               00393         rgoto   TIA_SYSEX_SysExCheck_End
5434 D710          M         bra     label
               00394 
5436 00395 TIA_SYSEX_Action_PRESET_WriteChk
               00396         ;; store received byte in checksum (using TIA_SYSEX_ADDRESS as store register)
5436 C023 FFA9 00397         movff   TIA_SYSEX_IN, EEADR
               00398 
               00399         ;; wait for next byte
               00400         rgoto   TIA_SYSEX_SysExCheck_End
543A D70D          M         bra     label
               00401 
543C 00402 TIA_SYSEX_End_PRESET_Write
               00403         ;; action invalid if checksum has not been received
               00404         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM, ACCESS, TIA_SYSEX_ActionInvalid
543C A421          M         btfss   reg, bit, reg_a
543E D716          M         bra     label
               00405 
               00406         ;; calc final checksum
5440 5024      00407         movf    TIA_SYSEX_CHECKSUM, W
5442 0880      00408         sublw   0x80
5444 0B7F      00409         andlw   0x7f
               00410 
               00411         ;; compare with received checksum
5446 18A9      00412         xorwf   EEADR, W
               00413 
               00414         ;; if not equal jump to ActionInvalid
5448 A4D8      00415         skpz
               00416         rgoto   TIA_SYSEX_End_PRESET_Write_Reply_ChksumErr
544A D02C          M         bra     label
               00417     
544C 5025      00418     movf        TIA_SYSEX_ADDRESS, W
544E DAA8      00419     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank
5450 6E26      00420     movwf   TIA_SYSEX_ERROR
5452 5026      00421     movf        TIA_SYSEX_ERROR, W
5454 A4D8      00422     skpz
               00423         rgoto   TIA_SYSEX_End_PRESET_Write_Reply
5456 D02E          M         bra     label
               00424     
5458 5012      00425     movf        TIA_PRESET, W
545A E00A      00426     bz      TIA_SYSEX_End_PRESET_Write_Cont    
545C 5011      00427     movf    TIA_BANK, W
545E EC6F F01C 00428     call    TIA_BANK_GetBankStickReady
5462 B4D8      00429     skpnz
               00430         rgoto   TIA_SYSEX_End_PRESET_Write_Reply_NotReady
5464 D022          M         bra     label
               00431      
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 182


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5466 EC7C F01C 00432     call    TIA_BANK_GetBankStickSize
546A E102      00433     bnz     TIA_SYSEX_End_PRESET_Write_Cont
               00434 
546C BC12      00435     btfsc       TIA_PRESET, 6
               00436     rgoto       TIA_SYSEX_End_PRESET_Write_Reply_32k
546E D020          M         bra     label
               00437 
5470 00438 TIA_SYSEX_End_PRESET_Write_Cont
               00439 
               00440     BRA_IFSET TIA_SYSEX_ADDRESS, 0, ACCESS, TIA_SYSEX_End_PRESET_Write_Cont_Kit
5470 B025          M         btfsc   reg, bit, reg_a
5472 D004          M         bra     label
5474 00441 TIA_SYSEX_End_PRESET_Write_Cont_Patch
5474 6AA9      00442     clrf    EEADR
5476 0E00      00443     movlw   (EEPROM_PATCH >> 8) & 0xff
5478 6EAA      00444     movwf   EEADRH
               00445     rgoto   TIA_SYSEX_End_PRESET_WritePages
547A D009          M         bra     label
               00446 
547C 00447 TIA_SYSEX_End_PRESET_Write_Cont_Kit
               00448     BRA_IFSET TIA_SYSEX_ADDRESS, 1, ACCESS, TIA_SYSEX_End_PRESET_Write_Cont_WT
547C B225          M         btfsc   reg, bit, reg_a
547E D004          M         bra     label
5480 6AA9      00449     clrf    EEADR
5482 0E02      00450     movlw   (EEPROM_KIT >> 8) & 0xff
5484 6EAA      00451     movwf   EEADRH
               00452     rgoto   TIA_SYSEX_End_PRESET_WritePages
5486 D003          M         bra     label
               00453             
5488 00454 TIA_SYSEX_End_PRESET_Write_Cont_WT
5488 6AA9      00455     clrf    EEADR
548A 0E01      00456     movlw   (EEPROM_WAVETABLE >> 8) & 0xff
548C 6EAA      00457     movwf   EEADRH
               00458     ;;rgoto   TIA_SYSEX_End_PRESET_WritePages
               00459 
548E 00460 TIA_SYSEX_End_PRESET_WritePages
               00461         ;; write buffer to EEPROM
548E EE12 F000 00462         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN    ; init pointer to upload buffer
5492 0004      00463         clrwdt                  ; feed watchdog
5494 EC15 F01C 00464         call    TIA_BANK_WritePage      ; write a 64 bytes page to EEPROM
               00465         ;; increment FSR1 by 0x40
5498 0E40      00466         movlw   0x40
549A 26E1      00467         addwf   FSR1L, F
549C 0004      00468         clrwdt                  ; feed watchdog
549E EC15 F01C 00469     call        TIA_BANK_WritePage      ; write a 64 bytes page to EEPROM
               00470     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
54A2 D008          M         bra     label
               00471     ;; to do... bank num in command and set patch/kit/WT +init if BANK==xBANK/ PRESET==xPRESET
               00472 
54A4 00473 TIA_SYSEX_End_PRESET_Write_Reply_ChksumErr
               00474     ;; CheckSum Error #5
54A4 0E05      00475     movlw   0x05
54A6 6E26      00476     movwf   TIA_SYSEX_ERROR
               00477     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 183


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
54A8 D005          M         bra     label
               00478     
54AA 00479 TIA_SYSEX_End_PRESET_Write_Reply_NotReady
               00480     ;; BS not ready Error #3
54AA 0E03      00481     movlw   0x03
54AC 6E26      00482     movwf   TIA_SYSEX_ERROR
               00483     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
54AE D002          M         bra     label
               00484 
54B0 00485 TIA_SYSEX_End_PRESET_Write_Reply_32k
               00486     ;; BS 32k 64 presets max Error #4
54B0 0E04      00487     movlw   0x04
54B2 6E26      00488     movwf   TIA_SYSEX_ERROR
               00489     ;;rgoto   TIA_SYSEX_End_PRESET_Write_Reply
               00490         
54B4 00491 TIA_SYSEX_End_PRESET_Write_Reply
               00492         ;; send SysEx header
54B4 DA26      00493         rcall   TIA_SYSEX_Send_SysExHeader
               00494 
               00495         ;; Send PRESET_Write ID
54B6 0E02      00496         movlw   0x02
54B8 EC24 F016 00497         call    MIOS_MIDI_TxBufferPut
               00498 
               00499         ;; send requested preset type number
               00500     ;;movf      TIA_SYSEX_ADDRESS, W
54BC DA8D      00501     rcall   TIA_SYSEX_Hlp_GetRelativeBank
54BE 0B7F      00502     andlw   0x7f
54C0 EC24 F016 00503         call    MIOS_MIDI_TxBufferPut
               00504     
               00505         ;; send requested bank number
54C4 5011      00506         movf    TIA_BANK, W
54C6 0B1F      00507     andlw   0x1f
54C8 EC24 F016 00508         call    MIOS_MIDI_TxBufferPut
               00509     
               00510         ;; send requested preset number
54CC 5012      00511         movf    TIA_PRESET, W
54CE 0B7F      00512     andlw   0x7f
54D0 EC24 F016 00513         call    MIOS_MIDI_TxBufferPut
               00514 
               00515         ;; send error status
54D4 5026      00516     movf    TIA_SYSEX_ERROR, W
54D6 0B7F      00517     andlw   0x7f
54D8 EC24 F016 00518         call    MIOS_MIDI_TxBufferPut
               00519 
               00520         ;; send of SysEx footer
54DC 0E01      00521         movlw   0x01            ; (independend from merger state)
54DE DA24      00522         rcall   TIA_SYSEX_Send_SysExFooter
               00523 
               00524         ;; finish Action
               00525         rgoto   TIA_SYSEX_ActionFinished
54E0 D6C5          M         bra     label
               00526 
54E2 00527 TIA_SYSEX_End_PRESET_Write_STR
               00528         STRING  20, 0x00, "Patch A  1 uploaded "
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 184


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
54E2 1400 6150     M         da      ((length) << 8) | (pos), str
     6374 2068 
     2041 3120 
     7520 6C70 
     616F 6564 
     2064      
               00529 
               00530 ;; --------------------------------------------------------------------------
               00531 ;;  MIDI Action: All Patch Read
               00532 ;; --------------------------------------------------------------------------
54F8 00533 TIA_SYSEX_Init_BANK_Read
               00534         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
54F8 8010      00535         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
54FA EC41 F01F 00536     call    TIA_TUNE_Note_Off
54FE 0012      00537         return
               00538 
5500 00539 TIA_SYSEX_Action_BANK_Read
               00540         ;; receive <type> <bank> F7
5500 00541 TIA_SYSEX_Action_BANK_Read_T
               00542         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_Read_B
5500 B621          M         btfsc   reg, bit, reg_a
5502 D004          M         bra     label
5504 8621      00543         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
5506 C023 F025 00544         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00545         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
550A D6A5          M         bra     label
               00546 
550C 00547 TIA_SYSEX_Action_BANK_Read_B    
               00548         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_ReadStall
550C B821          M         btfsc   reg, bit, reg_a
550E D004          M         bra     label
5510 8821      00549         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
5512 C023 F011 00550         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00551         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5516 D69F          M         bra     label
               00552                 
5518 00553 TIA_SYSEX_Action_BANK_ReadStall
               00554         ;; do nothing until sysex footer (F7) has been received
               00555         rgoto   TIA_SYSEX_SysExCheck_End
5518 D69E          M         bra     label
               00556 
551A 00557 TIA_SYSEX_End_BANK_Read
               00558         ;; action invalid if patch number has not been received
               00559         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
551A A821          M         btfss   reg, bit, reg_a
551C D6A7          M         bra     label
               00560     
551E C011 F007 00561     movff   TIA_BANK, TMP2  ;; store relative bank
5522 5025      00562     movf        TIA_SYSEX_ADDRESS, W
5524 DA3D      00563     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank   ; set bank to absolute
5526 6E26      00564     movwf   TIA_SYSEX_ERROR
5528 E10A      00565     bnz     TIA_SYSEX_End_BANK_Read_Cont
               00566     
552A 5012      00567     movf        TIA_PRESET, W
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 185


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
552C E008      00568     bz      TIA_SYSEX_End_BANK_Read_Cont    
552E 5011      00569     movf    TIA_BANK, W
5530 EC6F F01C 00570     call    TIA_BANK_GetBankStickReady
5534 A4D8      00571     skpz
               00572         rgoto   TIA_SYSEX_End_BANK_Read_Cont
5536 D003          M         bra     label
               00573     ;; BS not ready Error #3
5538 0E03      00574     movlw   0x03
553A 6E26      00575     movwf   TIA_SYSEX_ERROR
               00576     rgoto   TIA_SYSEX_End_BANK_Read_Cont
553C D000          M         bra     label
               00577 
553E 00578 TIA_SYSEX_End_BANK_Read_Cont
               00579 
               00580         ;; send SysEx header
553E D9E1      00581         rcall   TIA_SYSEX_Send_SysExHeader
               00582 
               00583         ;; send PTCHES_Write ID
5540 0E03      00584         movlw   0x03
5542 EC24 F016 00585         call    MIOS_MIDI_TxBufferPut
               00586     
               00587         ;; send requested preset type number
5546 5025      00588     movf        TIA_SYSEX_ADDRESS, W
5548 0B7F      00589     andlw   0x7f
554A EC24 F016 00590         call    MIOS_MIDI_TxBufferPut
               00591     
               00592         ;; send requested bank number
554E 5007      00593         movf    TMP2, W
5550 0B1F      00594     andlw   0x1f
5552 EC24 F016 00595         call    MIOS_MIDI_TxBufferPut
               00596 
               00597     ;movf       TIA_SYSEX_ADDRESS, W
               00598     ;rcall   TIA_SYSEX_Hlp_GetAbsoluteBank   ; set bank to absolute    
5556 5011      00599     movf    TIA_BANK, W
5558 EC6F F01C 00600     call    TIA_BANK_GetBankStickReady
               00601         ;; send requested bank size
555C EC7C F01C 00602     call    TIA_BANK_GetBankStickSize
5560 EC24 F016 00603         call    MIOS_MIDI_TxBufferPut
               00604     
5564 5026      00605     movf    TIA_SYSEX_ERROR, W
5566 E004      00606     bz      TIA_SYSEX_End_BANK_Read_Cont_Ok
5568 0B7F      00607     andlw       0x7f
556A EC24 F016 00608         call    MIOS_MIDI_TxBufferPut
               00609     rgoto   TIA_SYSEX_End_BANK_Read_Footer
556E D029          M         bra     label
               00610     
5570 00611 TIA_SYSEX_End_BANK_Read_Cont_Ok 
               00612 
               00613         ;; clear checksum
5570 6A24      00614         clrf    TIA_SYSEX_CHECKSUM
               00615 
               00616 #if 1    
               00617     ;; send bank informations 
5572 EC55 F01C 00618         call    TIA_BANK_SetBankStickAddressMagic
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 186


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5576 00619 TIA_SYSEX_End_BANK_Read_Cont_Name_Loop
5576 ECB8 F016 00620         call    MIOS_BANKSTICK_Read             ; read content, inc MIOS_PARAMETER12
557A 6EF5      00621         movwf   TABLAT              ; store data in TABLAT
               00622     
557C 5003      00623     movf    MIOS_PARAMETER1, W
557E 0BF0      00624     andlw   0xf0
5580 0A10      00625     xorlw   0x10
5582 E104      00626     bnz     TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
5584 0E20      00627         movlw   0x20
5586 60F5      00628         cpfslt  TABLAT, ACCESS      ; ensure that patch name doesn't contain characters < 0x20
               00629     rgoto   TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
5588 D001          M         bra     label
558A 6EF5      00630         movwf   TABLAT
558C 00631 TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
558C 50F5      00632     movf    TABLAT, W
558E 0B7F      00633     andlw   0x7f
5590 2624      00634         addwf   TIA_SYSEX_CHECKSUM, F
5592 EC24 F016 00635         call    MIOS_MIDI_TxBufferPut
5596 AE03      00636     btfss   MIOS_PARAMETER1, 7            ; until == 0x20 send 16 bytes
               00637     rgoto   TIA_SYSEX_End_BANK_Read_Cont_Name_Loop
5598 D7EE          M         bra     label
               00638 
               00639         ;; 127 patches to send(1-127), TIA_PRESET used as counter
559A 0E01      00640     movlw   0x01
559C 6E12      00641     movwf   TIA_PRESET
               00642 #else
               00643     
               00644         ;; 128 patches to send, TIA_PRESET used as counter
               00645     clrf        TIA_PRESET
               00646 #endif    
               00647     
559E 00648 TIA_SYSEX_End_BANK_Read_OL      ; outer loop
559E 0004      00649         clrwdt                      ; feed the watchdog
55A0 A025      00650     btfss       TIA_SYSEX_ADDRESS, 0  
55A2 D9CD      00651         rcall   TIA_SYSEX_Hlp_SendPreset
55A4 B025      00652     btfsc       TIA_SYSEX_ADDRESS, 0  
55A6 D9E0      00653         rcall   TIA_SYSEX_Hlp_SendWTKit 
               00654 
55A8 00655 TIA_SYSEX_End_BANK_Read_OL_Cont
55A8 2A12      00656         incf    TIA_PRESET, F       ; loop 64/128 times depends on BS Size
55AA EC7C F01C 00657     call    TIA_BANK_GetBankStickSize
55AE 0E7F      00658         movlw   128-1
55B0 B4D8      00659         skpnz
55B2 0E3F      00660         movlw   64-1
55B4 6412      00661         cpfsgt  TIA_PRESET, ACCESS
               00662         rgoto TIA_SYSEX_End_BANK_Read_OL
55B6 D7F3          M         bra     label
               00663 
               00664         ;; send checksum
55B8 5024      00665         movf    TIA_SYSEX_CHECKSUM, W
55BA 0880      00666         sublw   0x80
55BC 0B7F      00667         andlw   0x7f
55BE EC24 F016 00668         call    MIOS_MIDI_TxBufferPut
               00669 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 187


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
55C2 00670 TIA_SYSEX_End_BANK_Read_Footer
               00671         ;; send of SysEx footer
55C2 0E01      00672         movlw   0x01            ; (independend from merger state)
55C4 D9B1      00673         rcall   TIA_SYSEX_Send_SysExFooter
               00674 
               00675         ;; finish Action
               00676         rgoto   TIA_SYSEX_ActionFinished
55C6 D652          M         bra     label
               00677 
               00678 
               00679 ;; --------------------------------------------------------------------------
               00680 ;;  MIDI Action: Bank Write Name
               00681 ;; --------------------------------------------------------------------------
55C8 00682 TIA_SYSEX_Init_BANK_WriteName
               00683         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
               00684         ;;bsf   TIA_STAT, TIA_STAT_ENGINE_DISABLE
55C8 0012      00685         return
               00686 
55CA 00687 TIA_SYSEX_Action_BANK_WriteName
               00688         ;; receive <type> <bank> <16 bytes> F7
55CA 00689 TIA_SYSEX_Action_BANK_WriteNameT
               00690         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_WriteNameB
55CA B621          M         btfsc   reg, bit, reg_a
55CC D004          M         bra     label
55CE 8621      00691         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
55D0 C023 F025 00692         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00693         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
55D4 D640          M         bra     label
               00694 
55D6 00695 TIA_SYSEX_Action_BANK_WriteNameB
               00696         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_WriteNameC
55D6 B821          M         btfsc   reg, bit, reg_a
55D8 D006          M         bra     label
55DA 8821      00697         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
55DC C023 F011 00698         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00699     
55E0 6AA9      00700         clrf    EEADR                       ; clear address
55E2 6A26      00701     clrf    TIA_SYSEX_ERROR             ; clear reply error
               00702         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byt
55E4 D638          M         bra     label
               00703         
55E6 00704 TIA_SYSEX_Action_BANK_WriteNameC
55E6 EE02 F000 00705         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN                    ; init pointer to upload buffer
55EA CFA9 FFE9 00706         movff   EEADR, FSR0L
               00707 
               00708         ;; store received byte in upload buffer
55EE 5023      00709         movf    TIA_SYSEX_IN, W
55F0 6EEF      00710         movwf   INDF0
               00711 
               00712         ;; increment address
55F2 2AA9      00713         incf    EEADR, F
               00714 
               00715         ;; if FSR0L is zero, go into WAIT_CHECKSUM state
55F4 0E10      00716         movlw   0x10
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 188


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
55F6 60A9      00717         cpfslt  EEADR, ACCESS
55F8 8A21      00718     bsf TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
               00719     
               00720         ;; wait for next byte
               00721         rgoto   TIA_SYSEX_SysExCheck_End
55FA D62D          M         bra     label
               00722 
55FC 00723 TIA_SYSEX_End_BANK_WriteName
               00724         ;; action invalid if checksum has not been received
               00725         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
55FC AA21          M         btfss   reg, bit, reg_a
55FE D636          M         bra     label
               00726 
5600 5025      00727     movf        TIA_SYSEX_ADDRESS, W
5602 D9CE      00728     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank
5604 6E26      00729     movwf   TIA_SYSEX_ERROR
5606 E11D      00730     bnz     TIA_SYSEX_End_BANK_WriteName_Reply
               00731   
5608 5011      00732     movf    TIA_BANK, W
560A EC6F F01C 00733     call    TIA_BANK_GetBankStickReady
560E B4D8      00734     skpnz
               00735         rgoto   TIA_SYSEX_End_BANK_WriteName_Reply_NotReady
5610 D015          M         bra     label
               00736 
5612 00737 TIA_SYSEX_End_BANK_WriteName_Cont
5612 EE12 F000 00738         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN    ; init pointer to upload buffer
               00739     ;; add name offset to MP1 start @0x10
5616 EC55 F01C 00740         call    TIA_BANK_SetBankStickAddressMagic  
561A 0E10      00741     movlw   0x10
561C 2603      00742     addwf   MIOS_PARAMETER1, F
               00743     
561E 00744 TIA_SYSEX_End_BANK_WriteName_Loop 
561E 0004      00745         clrwdt                  ; feed watchdog
5620 0E20      00746         movlw   0x20
5622 61E7      00747         cpfslt  INDF1, BANKED      ; ensure that patch name doesn't contain characters < 0x20
5624 6EE7      00748     movwf   INDF1
5626 00749 TIA_SYSEX_End_BANK_WriteName_Loop_Jump 
5626 50E6      00750     movf    POSTINC1, W
5628 ECBA F016 00751         call    MIOS_BANKSTICK_Write     ; write byte to EEPROM
562C E104      00752     bnz     TIA_SYSEX_End_BANK_WriteName_Reply_WError
               00753 
               00754     ;; if FSR0L is zero, go into WAIT_CHECKSUM state
562E 0E20      00755         movlw   0x20
5630 6003      00756         cpfslt  MIOS_PARAMETER1, ACCESS
               00757     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply
5632 D007          M         bra     label
               00758     rgoto   TIA_SYSEX_End_BANK_WriteName_Loop
5634 D7F4          M         bra     label
               00759 
5636 00760 TIA_SYSEX_End_BANK_WriteName_Reply_WError
               00761     ;; BS write byte Error #8
5636 0E08      00762     movlw   0x08
5638 6E26      00763     movwf   TIA_SYSEX_ERROR
               00764     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply       
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 189


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
563A D003          M         bra     label
               00765 
563C 00766 TIA_SYSEX_End_BANK_WriteName_Reply_NotReady
               00767     ;; BS not ready Error #3
563C 0E03      00768     movlw   0x03
563E 6E26      00769     movwf   TIA_SYSEX_ERROR
               00770     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply
5640 D000          M         bra     label
               00771         
5642 00772 TIA_SYSEX_End_BANK_WriteName_Reply
               00773         ;; send SysEx header
5642 D95F      00774         rcall   TIA_SYSEX_Send_SysExHeader
               00775 
               00776         ;; Send PRESET_WriteName ID
5644 0E04      00777         movlw   0x04
5646 EC24 F016 00778         call    MIOS_MIDI_TxBufferPut
               00779 
               00780         ;; send requested preset type number
564A D9C6      00781     rcall   TIA_SYSEX_Hlp_GetRelativeBank
564C 0B7F      00782     andlw   0x7f
564E EC24 F016 00783         call    MIOS_MIDI_TxBufferPut
               00784     
               00785         ;; send requested bank number
5652 5011      00786         movf    TIA_BANK, W
5654 0B1F      00787     andlw   0x1f
5656 EC24 F016 00788         call    MIOS_MIDI_TxBufferPut
               00789 
               00790         ;; send error status
565A 5026      00791     movf    TIA_SYSEX_ERROR, W
565C 0B7F      00792     andlw   0x7f
565E EC24 F016 00793         call    MIOS_MIDI_TxBufferPut
               00794 
               00795         ;; send of SysEx footer
5662 0E01      00796         movlw   0x01            ; (independend from merger state)
5664 D961      00797         rcall   TIA_SYSEX_Send_SysExFooter
               00798 
               00799         ;; finish Action
               00800         rgoto   TIA_SYSEX_ActionFinished
5666 D602          M         bra     label
               00801 
               00802 ;; --------------------------------------------------------------------------
               00803 ;;  MIDI Action: Parameter Read
               00804 ;; --------------------------------------------------------------------------
5668 00805 TIA_SYSEX_Init_PAR_Read
5668 0012      00806         return
               00807 
566A 00808 TIA_SYSEX_Action_PAR_Read
               00809         ;; receive <AH> <AL> F7
566A 00810 TIA_SYSEX_Action_PAR_ReadAH
               00811         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_ReadAL
566A BA21          M         btfsc   reg, bit, reg_a
566C D005          M         bra     label
566E 8A21      00812         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED
5670 6A25      00813         clrf    TIA_SYSEX_ADDRESS               ; clear register and set TIA_SYSEX_ADDRESS[7] if IN[0] is set
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 190


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5672 B023      00814         btfsc   TIA_SYSEX_IN, 0
5674 8E25      00815         bsf     TIA_SYSEX_ADDRESS, 7
               00816         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5676 D5EF          M         bra     label
               00817         
5678 00818 TIA_SYSEX_Action_PAR_ReadAL
               00819         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_ReadStall
5678 B821          M         btfsc   reg, bit, reg_a
567A D005          M         bra     label
567C 8821      00820         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED
567E 5023      00821         movf    TIA_SYSEX_IN, W                 ; OR TIA_SYSEX_ADDRESS with low-byte
5680 0B7F      00822         andlw   0x7f
5682 1225      00823         iorwf   TIA_SYSEX_ADDRESS, F
               00824         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5684 D5E8          M         bra     label
               00825 
5686 00826 TIA_SYSEX_Action_PAR_ReadStall
               00827         ;; do nothing until sysex footer (F7) has been received
               00828         rgoto   TIA_SYSEX_SysExCheck_End
5686 D5E7          M         bra     label
               00829 
5688 00830 TIA_SYSEX_End_PAR_Read
               00831         ;; action invalid if low-byte of address has not been received
               00832         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5688 A821          M         btfss   reg, bit, reg_a
568A D5F0          M         bra     label
               00833 
               00834         ;; send SysEx header
568C D93A      00835         rcall   TIA_SYSEX_Send_SysExHeader
               00836 
               00837         ;; send PAR_Write ID
568E 0E06      00838         movlw   0x06
5690 EC24 F016 00839         call    MIOS_MIDI_TxBufferPut
               00840 
               00841         ;; send AH
5694 0E00      00842         movlw   0x00
5696 BE25      00843         btfsc   TIA_SYSEX_ADDRESS, 7
5698 0E01      00844         movlw 0x01
569A EC24 F016 00845         call    MIOS_MIDI_TxBufferPut
               00846 
               00847         ;; send AL
569E 5025      00848         movf    TIA_SYSEX_ADDRESS, W
56A0 0B7F      00849         andlw   0x7f
56A2 EC24 F016 00850         call    MIOS_MIDI_TxBufferPut
               00851 
               00852         ;; get corresponding CC parameter from address
56A6 5025      00853         movf    TIA_SYSEX_ADDRESS, W
56A8 ECF0 F02F 00854         call    TIA_SYSEX_TABLE_Get
               00855 
               00856         ;; branch if EEPROM value should be sent
               00857         BRA_IFSET WREG, 7, ACCESS, TIA_SYSEX_Action_PAR_Read_EE
56AC BEE8          M         btfsc   reg, bit, reg_a
56AE D003          M         bra     label
               00858 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 191


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
56B0 00859 TIA_SYSEX_Action_PAR_Read_RAM
               00860         ;; get CC value from RAM
56B0 EC19 F02F 00861         call    TIA_CCOUT_Get
               00862         rgoto   TIA_SYSEX_Action_PAR_Read_Cont
56B4 D004          M         bra     label
56B6 00863 TIA_SYSEX_Action_PAR_Read_EE
               00864         ;; read value from EEPROM
56B6 C025 FFA9 00865         movff   TIA_SYSEX_ADDRESS, EEADR
56BA EC42 F01C 00866         call    TIA_BANK_Read
56BE 00867 TIA_SYSEX_Action_PAR_Read_Cont
               00868         ;; send value
56BE 0B7F      00869         andlw   0x7f
56C0 EC24 F016 00870         call    MIOS_MIDI_TxBufferPut
               00871         
               00872         ;; send of SysEx footer
56C4 0E01      00873         movlw   0x01            ; (independend from merger state)
56C6 D930      00874         rcall   TIA_SYSEX_Send_SysExFooter
               00875 
               00876         ;; finish Action
               00877         rgoto   TIA_SYSEX_ActionFinished
56C8 D5D1          M         bra     label
               00878 
               00879 ;; --------------------------------------------------------------------------
               00880 ;;  MIDI Action: Parameter Write
               00881 ;; --------------------------------------------------------------------------
56CA 00882 TIA_SYSEX_Init_PAR_Write
56CA 0012      00883         return
               00884 
56CC 00885 TIA_SYSEX_Action_PAR_Write
               00886         ;; receive <AH> <AL> <value> F7
56CC 00887 TIA_SYSEX_Action_PAR_WriteAH
               00888         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteAL
56CC BA21          M         btfsc   reg, bit, reg_a
56CE D005          M         bra     label
56D0 8A21      00889         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED
56D2 6A25      00890         clrf    TIA_SYSEX_ADDRESS               ; clear register and set TIA_SYSEX_ADDRESS[7] if IN[0] is set
56D4 B023      00891         btfsc   TIA_SYSEX_IN, 0
56D6 8E25      00892         bsf     TIA_SYSEX_ADDRESS, 7
               00893         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
56D8 D5BE          M         bra     label
               00894         
56DA 00895 TIA_SYSEX_Action_PAR_WriteAL
               00896         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteD
56DA B821          M         btfsc   reg, bit, reg_a
56DC D005          M         bra     label
56DE 8821      00897         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED
56E0 5023      00898         movf    TIA_SYSEX_IN, W                 ; OR TIA_SYSEX_ADDRESS with low-byte
56E2 0B7F      00899         andlw   0x7f
56E4 1225      00900         iorwf   TIA_SYSEX_ADDRESS, F
               00901         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
56E6 D5B7          M         bra     label
               00902 
56E8 00903 TIA_SYSEX_Action_PAR_WriteD
               00904         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteStall
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 192


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
56E8 B621          M         btfsc   reg, bit, reg_a
56EA D004          M         bra     label
56EC 8621      00905         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED     
56EE C023 F024 00906         movff   TIA_SYSEX_IN, TIA_SYSEX_CHECKSUM; store byte in TIA_SYSEX_CHECKSUM (used as write buffer here)
               00907         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
56F2 D5B1          M         bra     label
               00908 
56F4 00909 TIA_SYSEX_Action_PAR_WriteStall
               00910         ;; do nothing until sysex footer (F7) has been received
               00911         rgoto   TIA_SYSEX_SysExCheck_End
56F4 D5B0          M         bra     label
               00912 
56F6 00913 TIA_SYSEX_End_PAR_Write
               00914         ;; action invalid if data has not been received
               00915         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
56F6 A621          M         btfss   reg, bit, reg_a
56F8 D5B9          M         bra     label
               00916 
               00917         ;; get corresponding CC parameter from address
56FA 5025      00918         movf    TIA_SYSEX_ADDRESS, W
56FC ECF0 F02F 00919         call    TIA_SYSEX_TABLE_Get
5700 6E06      00920         movwf   TMP1
               00921 
               00922         ;; branch if value should be saved in EEPROM
               00923         BRA_IFSET TMP1, 7, ACCESS, TIA_SYSEX_Action_PAR_Write_EE
5702 BE06          M         btfsc   reg, bit, reg_a
5704 D005          M         bra     label
               00924 
5706 00925 TIA_SYSEX_Action_PAR_Write_RAM
               00926         ;; write CC value to RAM
5706 C024 F003 00927         movff   TIA_SYSEX_CHECKSUM, MIOS_PARAMETER1 ; byte has been stored in _CHECKSUM
570A EC03 F02D 00928         call    TIA_CCIN_Set
               00929         rgoto   TIA_SYSEX_Action_PAR_Write_Cont
570E D00F          M         bra     label
5710 00930 TIA_SYSEX_Action_PAR_Write_EE
               00931         ;; if split parameter, redirect to TIA_Vx_SPLIT_xxx
5710 5006      00932         movf    TMP1, W
5712 0BF0      00933         andlw   0xf0
5714 0A90      00934         xorlw   0x90
5716 E106      00935         bnz     TIA_SYSEX_Action_PAR_Write_EEC
5718 00936 TIA_SYSEX_Action_PAR_Write_EES
5718 5006      00937         movf    TMP1, W
571A ECEB F01B 00938         call    TIA_PATCH_GetSplitPointer
571E C024 FFE3 00939         movff   TIA_SYSEX_CHECKSUM, PLUSW1
               00940         rgoto   TIA_SYSEX_Action_PAR_Write_Cont
5722 D005          M         bra     label
               00941 
5724 00942 TIA_SYSEX_Action_PAR_Write_EEC
               00943         ;; write value to EEPROM
5724 C025 FFA9 00944         movff   TIA_SYSEX_ADDRESS, EEADR
5728 5024      00945         movf    TIA_SYSEX_CHECKSUM, W; byte has been stored in _CHECKSUM
572A ECF6 F01B 00946         call    TIA_BANK_Write
572E 00947 TIA_SYSEX_Action_PAR_Write_Cont
               00948 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 193


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00949         ;; send acknowledge
572E EC7B F02C 00950         call    TIA_SYSEX_Send_Acknowledge
               00951 
               00952         ;; finish Action
               00953         rgoto   TIA_SYSEX_ActionFinished
5732 D59C          M         bra     label
               00954 
               00955 ;; --------------------------------------------------------------------------
               00956 ;;  MIDI Action: Switch Bank
               00957 ;; --------------------------------------------------------------------------
5734 00958 TIA_SYSEX_Init_BANK_Sel
5734 6A25      00959         clrf    TIA_SYSEX_ADDRESS
5736 0012      00960         return
               00961 
5738 00962 TIA_SYSEX_Action_BANK_Sel
               00963         ;; store bank in TIA_SYSEX_ADDRESS
5738 C023 F025 00964         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS
               00965         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
573C D58C          M         bra     label
               00966 
573E 00967 TIA_SYSEX_End_BANK_Sel
               00968         ;; check if BankStick available
573E 0E0F      00969         movlw   0x0f
5740 6025      00970         cpfslt  TIA_SYSEX_ADDRESS, ACCESS
               00971         rgoto TIA_SYSEX_End_BANK_SelInv
5742 D008          M         bra     label
5744 5025      00972         movf    TIA_SYSEX_ADDRESS, W
5746 ECC6 F016 00973         call    MIOS_HLP_GetBitORMask
574A 141C      00974         andwf   TIA_BANKSTICK_STAT, W
574C E003      00975         bz      TIA_SYSEX_End_BANK_SelInv
               00976 
               00977         ;; change to bank immediately
574E C025 F014 00978         movff   TIA_SYSEX_ADDRESS, TIA_PBANK
5752 D8F4      00979         rcall   TIA_SYSEX_ChangeMPatch
               00980 
               00981         ;;      rgoto   TIA_SYSEX_End_BANK_Cont
               00982 
               00983         ;; don't select new bankstick
5754 00984 TIA_SYSEX_End_BANK_SelInv
               00985 
5754 00986 TIA_SYSEX_End_BANK_Cont
               00987         ;; send acknowledge with bank number
5754 D8D6      00988         rcall   TIA_SYSEX_Send_SysExHeader
               00989 
5756 0E0F      00990         movlw   0x0f            ; (acknowledge ID)
5758 EC24 F016 00991         call    MIOS_MIDI_TxBufferPut
               00992 
575C 5014      00993         movf    TIA_PBANK, W
575E EC24 F016 00994         call    MIOS_MIDI_TxBufferPut
               00995 
               00996         ;; send of SysEx footer
5762 0E01      00997         movlw   0x01            ; (independend from merger state)
5764 D8E1      00998         rcall   TIA_SYSEX_Send_SysExFooter
               00999 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 194


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01000         ;; finish Action
               01001         rgoto   TIA_SYSEX_ActionFinished
5766 D582          M         bra     label
               01002 
               01003 ;; --------------------------------------------------------------------------
               01004 ;;  MIDI Action: Configuration Write
               01005 ;; --------------------------------------------------------------------------
5768 01006 TIA_SYSEX_Init_CFG_Read
5768 0012      01007     return
576A 01008 TIA_SYSEX_Action_CFG_Read    
               01009         ;; send <A> <DH> <DL> F7
576A 01010 TIA_SYSEX_Action_CFG_ReadA
               01011         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_ReadStall
576A BA21          M         btfsc   reg, bit, reg_a
576C D004          M         bra     label
576E 8A21      01012         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED
5770 C023 F025 01013         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS ; store address in TIA_SYSEX_ADDRESS
               01014         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5774 D570          M         bra     label
               01015 
5776 01016 TIA_SYSEX_Action_CFG_ReadStall
               01017         ;; do nothing until sysex footer (F7) has been received
               01018         rgoto   TIA_SYSEX_SysExCheck_End
5776 D56F          M         bra     label
               01019     
5778 01020 TIA_SYSEX_End_CFG_Read
               01021     ;; action invalid if low-byte of address has not been received
               01022         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5778 AA21          M         btfss   reg, bit, reg_a
577A D578          M         bra     label
577C 01023 _TIA_SYSEX_End_CFG_Read
               01024         ;; send SysEx header
577C D8C2      01025         rcall   TIA_SYSEX_Send_SysExHeader
               01026 
               01027         ;; send CFG_Read ID
577E 0E0C      01028         movlw   0x0c
5780 EC24 F016 01029         call    MIOS_MIDI_TxBufferPut
               01030 
               01031         ;; send A
5784 5025      01032         movf    TIA_SYSEX_ADDRESS, W
5786 EC24 F016 01033         call    MIOS_MIDI_TxBufferPut
               01034     
               01035         ;; branch depending on current action ID
578A 5025      01036         movf    TIA_SYSEX_ADDRESS, W
               01037         JUMPTABLE_2BYTES 16     ; 16 entries
578C 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
578E B0D8          M         skpnc
5790 0EF0          M         movlw   -(max_value)
5792 0F10          M         addlw   max_value
5794 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               01038         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
5798 D00F          M         bra     label
               01039         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
579A D00E          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 195


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01040         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
579C D00D          M         bra     label
               01041         rgoto   TIA_SYSEX_End_CFG_Read_Bank
579E D01D          M         bra     label
               01042         rgoto   TIA_SYSEX_End_CFG_Read_Patch
57A0 D02F          M         bra     label
               01043         rgoto   TIA_SYSEX_End_CFG_Read_BSInfo
57A2 D052          M         bra     label
               01044         rgoto   TIA_SYSEX_End_CFG_Read_All
57A4 D031          M         bra     label
               01045         rgoto   TIA_SYSEX_End_CFG_Read_All
57A6 D030          M         bra     label
               01046         rgoto   TIA_SYSEX_End_CFG_Read_All
57A8 D02F          M         bra     label
               01047         rgoto   TIA_SYSEX_End_CFG_Read_All
57AA D02E          M         bra     label
               01048         rgoto   TIA_SYSEX_End_CFG_Read_All
57AC D02D          M         bra     label
               01049         rgoto   TIA_SYSEX_End_CFG_Read_All
57AE D02C          M         bra     label
               01050         rgoto   TIA_SYSEX_End_CFG_Read_All
57B0 D02B          M         bra     label
               01051         rgoto   TIA_SYSEX_End_CFG_Read_All
57B2 D02A          M         bra     label
               01052         rgoto   TIA_SYSEX_End_CFG_Read_All
57B4 D029          M         bra     label
               01053         rgoto   TIA_SYSEX_End_CFG_Read_All
57B6 D028          M         bra     label
               01054     
               01055     
               01056     ;BRA_IFSET TIA_SYSEX_ADDRESS, 2, ACCESS, TIA_SYSEX_End_CFG_Read_All
               01057     
57B8 01058 TIA_SYSEX_End_CFG_Read_EEPROM    
               01059         ;; calc resulting EEADR
57B8 5025      01060         movf    TIA_SYSEX_ADDRESS, W
57BA 0B03      01061         andlw   0x03
57BC 0F7E      01062         addlw   EEPROM_CFG_BASE & 0xff
57BE 6EA9      01063         movwf   EEADR
               01064 
               01065         ;; read value from EEPROM
57C0 ECB0 F016 01066         call    MIOS_EEPROM_Read
57C4 6E24      01067         movwf   TIA_SYSEX_CHECKSUM      ; (value is stored in TIA_SYSEX_CHECKSUM)    
               01068     
               01069         ;; send DH
57C6 0E00      01070         movlw   0x00
57C8 BE24      01071         btfsc   TIA_SYSEX_CHECKSUM, 7
57CA 0E01      01072         movlw   0x01
57CC EC24 F016 01073         call    MIOS_MIDI_TxBufferPut
               01074 
               01075         ;; send DL
57D0 5024      01076         movf    TIA_SYSEX_CHECKSUM, W
57D2 0B7F      01077         andlw   0x7f
57D4 EC24 F016 01078         call    MIOS_MIDI_TxBufferPut
               01079     rgoto   TIA_SYSEX_End_CFG_Read_Cont
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 196


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
57D8 D051          M         bra     label
               01080     
57DA 01081 TIA_SYSEX_End_CFG_Read_Bank   
               01082     ;; send current bank number
57DA 5014      01083         movf    TIA_PBANK, W
57DC EC24 F016 01084         call    MIOS_MIDI_TxBufferPut
               01085 
               01086 #if 0    
               01087     ;; send bank type
               01088     call        TIA_BANK_SetBankStickAddressMagic
               01089     incf    MIOS_PARAMETER1, F
               01090     call        MIOS_BANKSTICK_Read
               01091     movwf   TIA_SYSEX_CHECKSUM
               01092     movlw   BANKSTICK_MAGIC1
               01093     subwf   TIA_SYSEX_CHECKSUM, W
               01094     andlw   0x7f
               01095         call    MIOS_MIDI_TxBufferPut  
               01096 #endif
               01097 
               01098     ;; send bank name    
57E0 EC55 F01C 01099     call        TIA_BANK_SetBankStickAddressMagic
57E4 0E10      01100     movlw   0x10
57E6 2603      01101     addwf   MIOS_PARAMETER1, F
57E8 01102 TIA_SYSEX_End_CFG_Read_Bank_NameLoop
57E8 ECB8 F016 01103     call        MIOS_BANKSTICK_Read
57EC 6E24      01104     movwf   TIA_SYSEX_CHECKSUM
57EE 0E20      01105     movlw   0x20
57F0 6024      01106     cpfslt  TIA_SYSEX_CHECKSUM
57F2 5024      01107     movf    TIA_SYSEX_CHECKSUM, W
57F4 0B7F      01108     andlw   0x7f
57F6 EC24 F016 01109         call    MIOS_MIDI_TxBufferPut  
57FA AA03      01110     btfss   MIOS_PARAMETER1, 5
               01111     rgoto   TIA_SYSEX_End_CFG_Read_Bank_NameLoop
57FC D7F5          M         bra     label
               01112     rgoto   TIA_SYSEX_End_CFG_Read_Cont
57FE D03E          M         bra     label
               01113     
5800 01114 TIA_SYSEX_End_CFG_Read_Patch
               01115     ;; send current patch number
5800 5013      01116         movf    TIA_PATCH, W
5802 EC24 F016 01117         call    MIOS_MIDI_TxBufferPut
               01118     rgoto   TIA_SYSEX_End_CFG_Read_Cont
5806 D03A          M         bra     label
               01119     
               01120         
5808 01121 TIA_SYSEX_End_CFG_Read_All
               01122         ;; calc resulting EEADR
5808 0E7E      01123         movlw   EEPROM_CFG_BASE & 0xff
580A 6EA9      01124         movwf   EEADR
               01125 
               01126         ;; read value from EEPROM
580C ECB0 F016 01127         call    MIOS_EEPROM_Read
5810 6E24      01128         movwf   TIA_SYSEX_CHECKSUM      ; (v2 ch is stored in TIA_SYSEX_CHECKSUM)    
               01129 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 197


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01130         ;; send v2 ch
5812 5024      01131         movf    TIA_SYSEX_CHECKSUM, W
5814 EC24 F016 01132         call    MIOS_MIDI_TxBufferPut
               01133 
               01134         ;; read value from EEPROM
5818 ECB0 F016 01135         call    MIOS_EEPROM_Read
581C 6E24      01136         movwf   TIA_SYSEX_CHECKSUM      ; (v1 ch is stored in TIA_SYSEX_CHECKSUM)    
               01137 
               01138         ;; send v1 ch
581E 5024      01139         movf    TIA_SYSEX_CHECKSUM, W
5820 EC24 F016 01140         call    MIOS_MIDI_TxBufferPut
               01141 
               01142         ;; read value from EEPROM
5824 ECB0 F016 01143         call    MIOS_EEPROM_Read
5828 6E24      01144         movwf   TIA_SYSEX_CHECKSUM      ; (v1 ch is stored in TIA_SYSEX_CHECKSUM) 
               01145         
               01146         ;; send DH/DL (device ID)
582A 0E00      01147         movlw   0x00
582C BE24      01148         btfsc   TIA_SYSEX_CHECKSUM, 7
582E 0E01      01149         movlw   0x01
5830 EC24 F016 01150         call    MIOS_MIDI_TxBufferPut
5834 5024      01151         movf    TIA_SYSEX_CHECKSUM, W
5836 0B7F      01152         andlw   0x7f
5838 EC24 F016 01153         call    MIOS_MIDI_TxBufferPut
               01154      
               01155     ;; send current bank number
583C 5014      01156         movf    TIA_PBANK, W
583E EC24 F016 01157         call    MIOS_MIDI_TxBufferPut
               01158     
               01159     ;; send current patch number
5842 5013      01160         movf    TIA_PATCH, W
5844 EC24 F016 01161         call    MIOS_MIDI_TxBufferPut
               01162     
               01163 
5848 01164 TIA_SYSEX_End_CFG_Read_BSInfo
               01165         ;; send DH/DL (bank status)
5848 0E00      01166         movlw   0x00
584A BE1B      01167         btfsc   TIA_BANKSTICK_RDY, 7
584C 0E01      01168         movlw   0x01
584E EC24 F016 01169         call    MIOS_MIDI_TxBufferPut
5852 501B      01170         movf    TIA_BANKSTICK_RDY, W
5854 0B7F      01171         andlw   0x7f
5856 EC24 F016 01172         call    MIOS_MIDI_TxBufferPut    
               01173 
               01174         ;; send DH/DL (bank size)
585A 0E00      01175         movlw   0x00
585C BE1D      01176         btfsc   TIA_BANKSTICK_SIZE, 7
585E 0E01      01177         movlw   0x01
5860 EC24 F016 01178         call    MIOS_MIDI_TxBufferPut
5864 501D      01179         movf    TIA_BANKSTICK_SIZE, W
5866 0B7F      01180         andlw   0x7f
5868 EC24 F016 01181         call    MIOS_MIDI_TxBufferPut 
               01182     
               01183     ;; send Kit/WT start Id
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 198


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
586C 0E05      01184     movlw       DEFAULT_BS_KBANK_ID
586E 0B7F      01185     andlw       0x7f
5870 EC24 F016 01186         call    MIOS_MIDI_TxBufferPut  
               01187     
               01188     ;; send EEPROM Readonly
5874 0E00      01189     movlw       DEFAULT_EE_READONLY
5876 0B7F      01190         andlw   0x7f
5878 EC24 F016 01191         call    MIOS_MIDI_TxBufferPut  
               01192             
               01193 
587C 01194 TIA_SYSEX_End_CFG_Read_Cont  
               01195         ;; send of SysEx footer
587C 0E01      01196         movlw   0x01            ; (independend from merger state)
587E D854      01197         rcall   TIA_SYSEX_Send_SysExFooter
               01198 
               01199         ;; finish Action
               01200         rgoto   TIA_SYSEX_ActionFinished
5880 D4F5          M         bra     label
               01201     
               01202 ;; --------------------------------------------------------------------------
               01203 ;;  MIDI Action: Configuration Write
               01204 ;; --------------------------------------------------------------------------
5882 01205 TIA_SYSEX_Init_CFG_Write
               01206         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
5882 8010      01207         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
5884 0012      01208         return
               01209 
5886 01210 TIA_SYSEX_Action_CFG_Write
               01211         ;; receive <A> <DH> <DL> F7
5886 01212 TIA_SYSEX_Action_CFG_WriteA
               01213         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteDH
5886 BA21          M         btfsc   reg, bit, reg_a
5888 D004          M         bra     label
588A 8A21      01214         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED
588C C023 F025 01215         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS ; store address in TIA_SYSEX_ADDRESS
               01216         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5890 D4E2          M         bra     label
               01217         
5892 01218 TIA_SYSEX_Action_CFG_WriteDH
               01219         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteDL
5892 B221          M         btfsc   reg, bit, reg_a
5894 D005          M         bra     label
5896 8221      01220         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED
5898 3823      01221         swapf   TIA_SYSEX_IN, W                 ; store high-nibble in TIA_SYSEX_CHECKSUM (used as data buffer here)
589A 0BF0      01222         andlw   0xf0
589C 6E24      01223         movwf   TIA_SYSEX_CHECKSUM
               01224         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
589E D4DB          M         bra     label
               01225 
58A0 01226 TIA_SYSEX_Action_CFG_WriteDL
               01227         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteStall
58A0 B021          M         btfsc   reg, bit, reg_a
58A2 D004          M         bra     label
58A4 8021      01228         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 199


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
58A6 5023      01229         movf    TIA_SYSEX_IN, W                 ; store low-nibble in TIA_SYSEX_CHECKSUM (used as data buffer here)
58A8 1224      01230         iorwf   TIA_SYSEX_CHECKSUM, F
               01231         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
58AA D4D5          M         bra     label
               01232 
58AC 01233 TIA_SYSEX_Action_CFG_WriteStall
               01234         ;; do nothing until sysex footer (F7) has been received
               01235         rgoto   TIA_SYSEX_SysExCheck_End
58AC D4D4          M         bra     label
               01236 
58AE 01237 TIA_SYSEX_End_CFG_Write
               01238         ;; action invalid if data has not been received
               01239         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
58AE A021          M         btfss   reg, bit, reg_a
58B0 D4DD          M         bra     label
               01240 
               01241         ;; calc resulting EEADR
58B2 5025      01242         movf    TIA_SYSEX_ADDRESS, W
58B4 0B03      01243         andlw   0x03
58B6 0F7E      01244         addlw   EEPROM_CFG_BASE & 0xff
58B8 6EA9      01245         movwf   EEADR
               01246 
               01247         ;; write value to EEPROM
58BA 5024      01248         movf    TIA_SYSEX_CHECKSUM, W   ; (value has been stored in TIA_SYSEX_CHECKSUM)
58BC ECB2 F016 01249         call    MIOS_EEPROM_Write
               01250         
               01251         ;; send response
58C0 D820      01252         rcall   TIA_SYSEX_Send_SysExHeader
               01253 
               01254         ;; send CFG_Write ID
58C2 0E0D      01255         movlw   0x0d
58C4 EC24 F016 01256         call    MIOS_MIDI_TxBufferPut
               01257 
               01258         ;; send A
58C8 5025      01259         movf    TIA_SYSEX_ADDRESS, W
58CA EC24 F016 01260         call    MIOS_MIDI_TxBufferPut
               01261 
               01262         ;; send DH
58CE 0E00      01263         movlw   0x00
58D0 BE24      01264         btfsc   TIA_SYSEX_CHECKSUM, 7
58D2 0E01      01265         movlw   0x01
58D4 EC24 F016 01266         call    MIOS_MIDI_TxBufferPut
               01267 
               01268         ;; send DL
58D8 5024      01269         movf    TIA_SYSEX_CHECKSUM, W
58DA 0B7F      01270         andlw   0x7f
58DC EC24 F016 01271         call    MIOS_MIDI_TxBufferPut
               01272             
               01273         ;; send of SysEx footer
58E0 0E01      01274         movlw   0x01            ; (independent from merger state)
               01275         rgoto   TIA_SYSEX_Send_SysExFooter
58E2 D022          M         bra     label
               01276 
               01277         ;; finish Action
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 200


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01278         rgoto   TIA_SYSEX_ActionFinished
58E4 D4C3          M         bra     label
               01279 
               01280 ;; --------------------------------------------------------------------------
               01281 ;;  MIDI Action: CC Request
               01282 ;; --------------------------------------------------------------------------
58E6 01283 TIA_SYSEX_Init_RequestCC
58E6 0012      01284         return
               01285 
58E8 01286 TIA_SYSEX_Action_RequestCC
               01287         ;; do nothing until sysex footer (F7) has been received
               01288         rgoto   TIA_SYSEX_SysExCheck_End
58E8 D4B6          M         bra     label
               01289 
58EA 01290 TIA_SYSEX_End_RequestCC
               01291         ;; request CC dump (handled by tia_ccout.inc)
58EA 8410      01292         bsf     TIA_STAT, TIA_STAT_CC_DUMP_REQ
               01293 
               01294         ;; finish Action
               01295         rgoto   TIA_SYSEX_ActionFinished
58EC D4BF          M         bra     label
               01296 
               01297 
               01298 ;; --------------------------------------------------------------------------
               01299 ;;  MIDI Action: Ping
               01300 ;; --------------------------------------------------------------------------
58EE 01301 TIA_SYSEX_Init_Ping
58EE 0012      01302         return
               01303 
58F0 01304 TIA_SYSEX_Action_Ping
               01305         ;; do nothing until sysex footer (F7) has been received
               01306         rgoto   TIA_SYSEX_SysExCheck_End
58F0 D4B2          M         bra     label
               01307 
58F2 01308 TIA_SYSEX_End_Ping
               01309         ;; send Acknowledge
58F2 D801      01310         rcall   TIA_SYSEX_Send_Acknowledge
               01311 
               01312         ;; finish Action
               01313         rgoto   TIA_SYSEX_ActionFinished
58F4 D4BB          M         bra     label
               01314 
               01315 
               01316 
               01317 ;; --------------------------------------------------------------------------
               01318 ;;  MIDI Send Acknowledge (Util function)
               01319 ;; --------------------------------------------------------------------------
58F6 01320 TIA_SYSEX_Send_Acknowledge
58F6 D805      01321         rcall   TIA_SYSEX_Send_SysExHeader
               01322 
58F8 0E0F      01323         movlw   0x0f            ; (acknowledge ID)
58FA EC24 F016 01324         call    MIOS_MIDI_TxBufferPut
               01325 
               01326         ;; send of SysEx footer
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 201


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
58FE 0E01      01327         movlw   0x01            ; (independend from merger state)
               01328         rgoto   TIA_SYSEX_Send_SysExFooter
5900 D013          M         bra     label
               01329 
               01330 ;; --------------------------------------------------------------------------
               01331 ;;  Send TIA SysEx Header (Util function)
               01332 ;; --------------------------------------------------------------------------
5902 01333 TIA_SYSEX_Send_SysExHeader
               01334         ;; if TIA_SYSEX_SYXSTATE > 0, check merger flag to allow propper sysex merging
               01335         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_MYSYSEX, ACCESS, TIA_SYSEX_Send_SysExHeader_Skp
5902 AE21          M         btfss   reg, bit, reg_a
5904 D007          M         bra     label
5906 EC12 F016 01336         call    MIOS_MIDI_MergerGet
590A 0B01      01337         andlw   0x01
590C E003      01338         bz      TIA_SYSEX_Send_SysExHeader_Skp
590E 0E05      01339         movlw   0x05            ; send only DEVICE_ID
5910 6E06      01340         movwf   TMP1
               01341         rgoto   TIA_SYSEX_Send_SysExHeaderLoop
5912 D001          M         bra     label
5914 01342 TIA_SYSEX_Send_SysExHeader_Skp
               01343 
5914 6A06      01344         clrf    TMP1
5916 01345 TIA_SYSEX_Send_SysExHeaderLoop
5916 5006      01346         movf    TMP1, W
5918 DC9F      01347         rcall   TIA_SYSEX_SysExHeaderGet
591A EC24 F016 01348         call    MIOS_MIDI_TxBufferPut
591E 2A06      01349         incf    TMP1, F
5920 0E06      01350         movlw   0x06
5922 6206      01351         cpfseq  TMP1, ACCESS
               01352         rgoto TIA_SYSEX_Send_SysExHeaderLoop
5924 D7F8          M         bra     label
5926 0012      01353         return
               01354 
               01355 ;; --------------------------------------------------------------------------
               01356 ;;  MIDI Send SysEx Footer (Util function)
               01357 ;; --------------------------------------------------------------------------
5928 01358 TIA_SYSEX_Send_SysExFooter
               01359         ;; if WREG[0]=1: send F7 regardless of the merger state
               01360         BRA_IFSET WREG, 0, ACCESS, TIA_SYSEX_Send_SysExFooter_Force
5928 B0E8          M         btfsc   reg, bit, reg_a
592A D005          M         bra     label
               01361         ;; send footer only if merger has been enabled
               01362         ;; to ensure a proper MIDI protocol
592C EC12 F016 01363         call    MIOS_MIDI_MergerGet
5930 0B01      01364         andlw   0x01
5932 B4D8      01365         skpnz
5934 0012      01366         return
               01367 
5936 01368 TIA_SYSEX_Send_SysExFooter_Force
5936 0EF7      01369         movlw   0xf7
5938 EF24 F016 01370         goto    MIOS_MIDI_TxBufferPut
               01371 
               01372 
               01373 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 202


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01374 ;;  Changes the TIA Master patch
               01375 ;;  IN: patch number in TIA_PATCH
               01376 ;;      bank number in TIA_PBANK
               01377 ;; --------------------------------------------------------------------------
593C 01378 TIA_SYSEX_ChangeMPatch
593C 0012      01379         return
               01380 
               01381 
               01382 ;; --------------------------------------------------------------------------
               01383 ;;  Sends a patch
               01384 ;;  IN: patch number in TIA_PRESET
               01385 ;;      bank number in TIA_BANK
               01386 ;;      TIA_SYSEX_CHECKSUM should be cleared if required
               01387 ;;  OUT: 128 bytes will be sent
               01388 ;;       checksum in TIA_SYSEX_CHECKSUM
               01389 ;; --------------------------------------------------------------------------
593E 01390 TIA_SYSEX_Hlp_SendPreset
593E 0E00      01391     movlw   (EEPROM_PATCH >> 8) & 0xff
5940 6EAA      01392     movwf   EEADRH
5942 6AA9      01393         clrf    EEADR                   ; 0x80 bytes to send, use EEADR as counter
               01394     ;;rgoto   TIA_SYSEX_Hlp_SendPresetLoop
5944 01395 TIA_SYSEX_Hlp_SendPresetLoop
5944 EC42 F01C 01396         call    TIA_BANK_Read   ; read patch content (EEADR will be incremented)
5948 6EF5      01397         movwf   TABLAT          ; store data in TABLAT
               01398 
594A 0E11      01399         movlw   0x10+1          ; ensure that patch name doesn't contain characters < 0x20
594C 60A9      01400         cpfslt  EEADR, ACCESS
               01401         rgoto TIA_SYSEX_Hlp_SendPresetLoop_NoN
594E D004          M         bra     label
5950 01402 TIA_SYSEX_Hlp_SendPresetLoop_N
5950 0E20      01403         movlw   0x20
5952 60F5      01404         cpfslt  TABLAT, ACCESS
               01405         rgoto TIA_SYSEX_Hlp_SendPresetLoop_NoN
5954 D001          M         bra     label
5956 6EF5      01406         movwf   TABLAT
5958 01407 TIA_SYSEX_Hlp_SendPresetLoop_NoN
5958 50F5      01408         movf    TABLAT, W
595A 0B7F      01409         andlw   0x7f            ; add to checksum
595C 2624      01410         addwf   TIA_SYSEX_CHECKSUM, F
               01411 
595E EC24 F016 01412         call    MIOS_MIDI_TxBufferPut; send byte
               01413 
5962 AEA9      01414         btfss   EEADR, 7
               01415         rgoto   TIA_SYSEX_Hlp_SendPresetLoop    ; loop 128 times
5964 D7EF          M         bra     label
               01416 
5966 0012      01417         return
               01418 
               01419 ;; --------------------------------------------------------------------------
               01420 ;;  Sends a wavetable or a kit
               01421 ;;  IN: wt number in TIA_PRESET
               01422 ;;      bank number in TIA_BANK
               01423 ;;      TIA_SYSEX_CHECKSUM should be cleared if required
               01424 ;;  OUT: 256 bytes will be sent (128*2 DH+DL)
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 203


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01425 ;;       checksum in TIA_SYSEX_CHECKSUM
               01426 ;; --------------------------------------------------------------------------
5968 01427 TIA_SYSEX_Hlp_SendWTKit
5968 0E01      01428     movlw   (EEPROM_WAVETABLE >> 8) & 0xff
596A 6EAA      01429     movwf   EEADRH
596C 6AA9      01430         clrf    EEADR                   ; 0x80 bytes to send, use EEADR as counter
596E 01431 TIA_SYSEX_Hlp_SendWTKitLoop
596E EC42 F01C 01432         call    TIA_BANK_Read   ; read patch content (EEADR will be incremented)
5972 6EF5      01433         movwf   TABLAT          ; store data in TABLAT
               01434 
5974 0E11      01435         movlw   0x10+1          ; ensure that patch name doesn't contain characters < 0x20
5976 60A9      01436         cpfslt  EEADR, ACCESS
               01437         rgoto TIA_SYSEX_Hlp_SendWTKitLoop_NoN
5978 D004          M         bra     label
597A 01438 TIA_SYSEX_Hlp_SendWTKitLoop_N
597A 0E20      01439         movlw   0x20
597C 60F5      01440         cpfslt  TABLAT, ACCESS
               01441         rgoto TIA_SYSEX_Hlp_SendWTKitLoop_NoN
597E D001          M         bra     label
5980 6EF5      01442         movwf   TABLAT
5982 01443 TIA_SYSEX_Hlp_SendWTKitLoop_NoN
               01444     ;; DH
5982 0E00      01445         movlw   0x00
5984 BEF5      01446     btfsc   TABLAT, 7
5986 0E01      01447     movlw   0x01
5988 0B7F      01448         andlw   0x7f            ; add to checksum
598A 2624      01449         addwf   TIA_SYSEX_CHECKSUM, F
598C EC24 F016 01450         call    MIOS_MIDI_TxBufferPut; send DH byte
               01451     ;; DL
5990 50F5      01452         movf    TABLAT, W
5992 0B7F      01453         andlw   0x7f            ; add to checksum
5994 2624      01454         addwf   TIA_SYSEX_CHECKSUM, F
5996 EC24 F016 01455         call    MIOS_MIDI_TxBufferPut; send DL byte
               01456 
599A AEA9      01457         btfss   EEADR, 7
               01458         rgoto   TIA_SYSEX_Hlp_SendWTKitLoop     ; loop 128 times
599C D7E8          M         bra     label
               01459 
599E 0012      01460         return    
               01461     
               01462     
               01463 ;; --------------------------------------------------------------------------
               01464 ;;  This function returns the absolute BANK # from relative xBANK #
               01465 ;;  IN: Relative Bank in TIA_BANK, preset type in WREG
               01466 ;;  OUT: Abslolute Bank in TIA_BANK, Error in WREG
               01467 ;; --------------------------------------------------------------------------
59A0 01468 TIA_SYSEX_Hlp_GetAbsoluteBank
59A0 6E06      01469     movwf   TMP1
               01470     BRA_IFCLR  TMP1, 0, ACCESS, TIA_SYSEX_Hlp_GetAbsoluteBank_P
59A2 A006          M         btfss   reg, bit, reg_a
59A4 D012          M         bra     label
59A6 01471 TIA_SYSEX_Hlp_GetAbsoluteBank_K
59A6 0E06      01472     movlw   16-(DEFAULT_BS_KBANK_ID*2)
59A8 6011      01473     cpfslt  TIA_BANK, ACCESS
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 204


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01474     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_Err
59AA D014          M         bra     label
59AC 5011      01475     movf    TIA_BANK, W
59AE 0B06      01476     andlw   0x06
59B0 44E8      01477     rlncf   WREG, W
59B2 B011      01478     btfsc   TIA_BANK, 0
59B4 28E8      01479     incf    WREG, W
59B6 0F14      01480     addlw   DEFAULT_BS_KBANK_ID*4
               01481     BRA_IFSET  TMP1, 1, ACCESS, TIA_SYSEX_Hlp_GetAbsoluteBank_WT
59B8 B206          M         btfsc   reg, bit, reg_a
59BA D003          M         bra     label
59BC 6E11      01482     movwf   TIA_BANK
59BE 0E00      01483     movlw   0x00
               01484     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
59C0 D00A          M         bra     label
               01485     
59C2 01486 TIA_SYSEX_Hlp_GetAbsoluteBank_WT
59C2 0F02      01487     addlw   0x02
59C4 6E11      01488     movwf   TIA_BANK   
59C6 0E00      01489     movlw   0x00
               01490     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
59C8 D006          M         bra     label
               01491     
59CA 01492 TIA_SYSEX_Hlp_GetAbsoluteBank_P
               01493     ;; Saturate to max Patch banks (DEFAULT_BS_KBANK_ID*4-1)
59CA 0E14      01494     movlw   DEFAULT_BS_KBANK_ID*4
59CC 6011      01495     cpfslt  TIA_BANK, ACCESS
               01496     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_Err
59CE D002          M         bra     label
59D0 0E00      01497     movlw   0x00
               01498     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
59D2 D001          M         bra     label
               01499     
59D4 01500 TIA_SYSEX_Hlp_GetAbsoluteBank_Err
59D4 0E06      01501     movlw   0x06 ;; not valid xBANK
               01502     
59D6 01503 TIA_SYSEX_Hlp_GetAbsoluteBank_End
59D6 0012      01504         return
               01505 
               01506 ;; --------------------------------------------------------------------------
               01507 ;;  This function returns the absolute BANK # from relative xBANK #
               01508 ;;  IN:  Abslolute Bank in TIA_BANK
               01509 ;;  OUT: Relative Bank in TIA_BANK, preset type in WREG
               01510 ;; --------------------------------------------------------------------------
59D8 01511 TIA_SYSEX_Hlp_GetRelativeBank
               01512     ;; Saturate to 32 absolute banks
59D8 0E1F      01513     movlw   0x1f
59DA 6011      01514     cpfslt  TIA_BANK, ACCESS
59DC 6E11      01515     movwf   TIA_BANK
59DE 0E14      01516     movlw   DEFAULT_BS_KBANK_ID*4
59E0 5C11      01517     subwf   TIA_BANK, W
59E2 6E06      01518     movwf   TMP1
59E4 E702      01519     bnn     TIA_SYSEX_Hlp_GetRelativeBank_K
59E6 01520 TIA_SYSEX_Hlp_GetRelativeBank_P   
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 205


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
59E6 0E00      01521     movlw   0x00
               01522     rgoto   TIA_SYSEX_Hlp_GetRelativeBank_End
59E8 D00D          M         bra     label
59EA 01523 TIA_SYSEX_Hlp_GetRelativeBank_K
               01524     BRA_IFSET  TMP1, 1, ACCESS, TIA_SYSEX_Hlp_GetRelativeBank_WT 
59EA B206          M         btfsc   reg, bit, reg_a
59EC D005          M         bra     label
59EE 28E8      01525     incf    WREG, W
59F0 40E8      01526     rrncf   WREG, W
59F2 6E11      01527     movwf   TIA_BANK
59F4 0E01      01528     movlw   0x01
               01529     rgoto   TIA_SYSEX_Hlp_GetRelativeBank_End
59F6 D006          M         bra     label
59F8 01530 TIA_SYSEX_Hlp_GetRelativeBank_WT
59F8 04E8      01531     decf    WREG, W
59FA BEE8      01532     btfsc   WREG, 7
59FC 0E00      01533     movlw   0x00
59FE 40E8      01534     rrncf   WREG, W
5A00 6E11      01535     movwf   TIA_BANK
5A02 0E03      01536     movlw   0x03
5A04 01537 TIA_SYSEX_Hlp_GetRelativeBank_End
5A04 0012      01538         return
               00406 #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 ;; --------------------------------------------------------------------------
5A06 00017 TIA_CCIN_Set
5A06 DA5B      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
5A08 5004      00025         movf    MIOS_PARAMETER2, W
5A0A 0B0F      00026         andlw   0x0f
               00027         JUMPTABLE_2BYTES_UNSECURE
5A0C ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00028         rgoto   TIA_CCIN_Cmd_NOP
5A10 D00F          M         bra     label
               00029         rgoto   TIA_CCIN_Cmd_V12
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 206


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5A12 D00F          M         bra     label
               00030         rgoto   TIA_CCIN_Cmd_7BIT
5A14 D014          M         bra     label
               00031         rgoto   TIA_CCIN_Cmd_7BIT_W_PORTA
5A16 D02F          M         bra     label
               00032         rgoto   TIA_CCIN_Cmd_7BIT_4L
5A18 D037          M         bra     label
               00033         rgoto   TIA_CCIN_Cmd_7BIT_4U
5A1A D03C          M         bra     label
               00034         rgoto   TIA_CCIN_Cmd_SUSKEY
5A1C D04F          M         bra     label
               00035         rgoto   TIA_CCIN_Cmd_VEL
5A1E D053          M         bra     label
               00036         rgoto   TIA_CCIN_Cmd_AFTERTOUCH
5A20 D0C3          M         bra     label
               00037         rgoto   TIA_CCIN_Cmd_MODWHEEL
5A22 D0FA          M         bra     label
               00038         rgoto   TIA_CCIN_Cmd_WAVEFORM
5A24 D134          M         bra     label
               00039     rgoto       TIA_CCIN_Cmd_OPT_BANK
5A26 D14D          M         bra     label
               00040         rgoto   TIA_CCIN_Cmd_OPT_PST
5A28 D171          M         bra     label
               00041         rgoto   TIA_CCIN_Cmd_NOP
5A2A D002          M         bra     label
               00042         rgoto   TIA_CCIN_Cmd_NOP
5A2C D001          M         bra     label
               00043         rgoto   TIA_CCIN_Cmd_PlayNote
5A2E D192          M         bra     label
               00044 
               00045 ; ==========================================================================
               00046 
               00047 ;; --------------------------------------------------------------------------
5A30 00048 TIA_CCIN_Cmd_NOP
               00049         ;; no jump to end, since no CS update is required
               00050         ;;      rgoto   TIA_CCIN_Cmd_End
5A30 0012      00051         return
               00052 
               00053 ;; --------------------------------------------------------------------------
5A32 00054 TIA_CCIN_Cmd_V12
5A32 50E1      00055         movf    FSR1L, W                ; parameter contains first CC, save it
5A34 6E05      00056         movwf   MIOS_PARAMETER3
5A36 DFE7      00057         rcall   TIA_CCIN_Set            ; set first voice
5A38 2A05      00058         incf    MIOS_PARAMETER3, F
5A3A 5005      00059         movf    MIOS_PARAMETER3, W
               00060         rgoto   TIA_CCIN_Set            ; set second voice
5A3C D7E4          M         bra     label
               00061 
               00062 ;; --------------------------------------------------------------------------
5A3E 00063 TIA_CCIN_Cmd_7BIT
5A3E 00064 TIA_CCIN_Cmd_7BIT_VxMode
               00065     ;; special treatment, GSA falling -> Gate clear
5A3E 0E24      00066         movlw   (TIA_V1_BASE + TIA_Vx_MODE) & 0xff  ;; V1 MODE register
5A40 18E1      00067     xorwf   FSR1L, W
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 207


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5A42 E003      00068     bz      TIA_CCIN_Cmd_7BIT_GSA_Fall
5A44 0E64      00069     movlw   (TIA_V2_BASE + TIA_Vx_MODE) & 0xff  ;; V2 MODE register
5A46 18E1      00070     xorwf   FSR1L, W
5A48 E106      00071     bnz     TIA_CCIN_Cmd_7BIT_VxOpt
               00072     
5A4A 00073 TIA_CCIN_Cmd_7BIT_GSA_Fall    ;; detect fall of GSA
5A4A B0E7      00074     btfsc   INDF1, Vx_MODE_GSA_ACTIVE
5A4C B003      00075     btfsc   MIOS_PARAMETER1, Vx_MODE_GSA_ACTIVE
5A4E D003      00076     bra     TIA_CCIN_Cmd_7BIT_VxOpt
               00077     ;; clear gate
5A50 06E1      00078     decf    FSR1L, F    ;; Vx STAT register
5A52 96E7      00079     bcf     INDF1, Vx_STAT_GATE_ACTIVE
5A54 2AE1      00080     incf    FSR1L, F    ;; Vx MODE register
               00081     ;bra     TIA_CCIN_Cmd_7BIT_VxOpt
               00082 
5A56 00083 TIA_CCIN_Cmd_7BIT_VxOpt
               00084     ;; special treatment, WT On -> Load WT ADSR
5A56 0E4B      00085         movlw   (TIA_V1_BASE + TIA_Vx_OPTION) & 0xff  ;; V1 MODE register
5A58 18E1      00086     xorwf   FSR1L, W
5A5A E003      00087     bz      TIA_CCIN_Cmd_7BIT_VxOpt_Chk
5A5C 0E8B      00088     movlw   (TIA_V2_BASE + TIA_Vx_OPTION) & 0xff  ;; V2 MODE register
5A5E 18E1      00089     xorwf   FSR1L, W
5A60 E107      00090     bnz     TIA_CCIN_Cmd_7BIT_End
               00091     
5A62 00092 TIA_CCIN_Cmd_7BIT_VxOpt_Chk    ;; WT Enable check 
5A62 A0E7      00093     btfss   INDF1, Vx_OPTION_WT_ON
               00094     rgoto       TIA_CCIN_Cmd_7BIT_End
5A64 D005          M         bra     label
               00095     ;; Load WT ADSR
5A66 C003 FFE7 00096     movff       MIOS_PARAMETER1, INDF1
5A6A EC52 F026 00097     call    TIA_WT_ADSR_Copy
               00098     rgoto       TIA_CCIN_Cmd_End
5A6E D1C4          M         bra     label
               00099    
5A70 00100 TIA_CCIN_Cmd_7BIT_End
               00101     ;; normal treatment
5A70 C003 FFE7 00102     movff       MIOS_PARAMETER1, INDF1
               00103     
               00104         rgoto   TIA_CCIN_Cmd_End
5A74 D1C1          M         bra     label
               00105     
               00106 ;; --------------------------------------------------------------------------
5A76 00107 TIA_CCIN_Cmd_7BIT_W_PORTA
5A76 9610      00108         bcf     TIA_STAT, TIA_STAT_SAVED_GIE    ; for nested IRQ disables
5A78 BEF2      00109         btfsc   INTCON, GIE
5A7A 8610      00110         bsf     TIA_STAT, TIA_STAT_SAVED_GIE
               00111         IRQ_DISABLE
5A7C 9EF2          M         bcf     INTCON, GIE
               00112 
               00113         ;; works only with TIA_Vx_TRANSPOSE,  _PITCHRANGE
5A7E C003 FFE7 00114         movff   MIOS_PARAMETER1, INDF1
               00115 
               00116 #if 0
               00117         ;; enable portamento if rate is > 0
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 208


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00118         ;; switch to TIA_Vx_PORTA_RATE
               00119         movf    FSR1L, W
               00120         andlw   0x03
               00121         iorlw   TIA_V1_PORTA_RATE & 0xfc
               00122         movwf   FSR1L
               00123         movf    INDF1, W
               00124         bz      TIA_CCIN_Cmd_7BIT_W_PORTA_End
               00125 
               00126         movf    FSR1L, W
               00127         andlw   0x03
               00128         iorlw   TIA_V1_MODE & 0xfc
               00129         movwf   FSR1L
               00130         bsf     INDF1, Vx_STAT_PORTA_ENABLE
               00131 #endif
               00132 
5A82 00133 TIA_CCIN_Cmd_7BIT_W_PORTA_End
               00134         ;;      IRQ_ENABLE
5A82 B610      00135         btfsc   TIA_STAT, TIA_STAT_SAVED_GIE    ; nested IRQ enable
5A84 8EF2      00136         bsf     INTCON, GIE
               00137         
               00138         rgoto   TIA_CCIN_Cmd_End
5A86 D1B8          M         bra     label
               00139 
               00140 
               00141 ;; --------------------------------------------------------------------------
5A88 00142 TIA_CCIN_Cmd_7BIT_4L
5A88 0EF0      00143         movlw   0xf0
5A8A 16E7      00144         andwf   INDF1, F
5A8C 5003      00145         movf    MIOS_PARAMETER1, W
5A8E 0B0F      00146         andlw   0x0f
5A90 12E7      00147         iorwf   INDF1, F
               00148         rgoto   TIA_CCIN_Cmd_End
5A92 D1B2          M         bra     label
               00149 
               00150 ;; --------------------------------------------------------------------------
5A94 00151 TIA_CCIN_Cmd_7BIT_4U
5A94 0E0F      00152         movlw   0x0f
5A96 16E7      00153         andwf   INDF1, F
5A98 3803      00154         swapf   MIOS_PARAMETER1, W
5A9A 0BF0      00155         andlw   0xf0
5A9C 12E7      00156         iorwf   INDF1, F
               00157         rgoto   TIA_CCIN_Cmd_End
5A9E D1AC          M         bra     label
               00158 
               00159 ;; --------------------------------------------------------------------------
5AA0 00160 TIA_CCIN_Cmd_7BIT_TO_7_4
5AA0 0E0F      00161         movlw   0x0f
5AA2 16E7      00162         andwf   INDF1, F
5AA4 3403      00163         rlf     MIOS_PARAMETER1, W
5AA6 0BF0      00164         andlw   0xf0
5AA8 12E7      00165         iorwf   INDF1, F
               00166         rgoto   TIA_CCIN_Cmd_End
5AAA D1A6          M         bra     label
               00167 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 209


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00168 ;; --------------------------------------------------------------------------
5AAC 00169 TIA_CCIN_Cmd_7BIT_TO_3_0
5AAC 0EF0      00170         movlw   0xf0
5AAE 16E7      00171         andwf   INDF1, F
5AB0 3003      00172         rrf     MIOS_PARAMETER1, W
5AB2 32E8      00173         rrf     WREG, F
5AB4 30E8      00174         rrf     WREG, W
5AB6 0B0F      00175         andlw   0x0f
5AB8 12E7      00176         iorwf   INDF1, F
               00177         rgoto   TIA_CCIN_Cmd_End
5ABA D19E          M         bra     label
               00178 
               00179 ;; --------------------------------------------------------------------------
5ABC 00180 TIA_CCIN_Cmd_SUSKEY
5ABC 930C      00181         bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
5ABE 5003      00182         movf    MIOS_PARAMETER1, W
5AC0 A4D8      00183         skpz
5AC2 830C      00184         bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
               00185 
               00186         ;rrf    MIOS_PARAMETER1, W
               00187         ;andlw  0x3f
               00188         ;movwf  TIA_KEYTRACKING, BANKED
               00189 
               00190         rgoto   TIA_CCIN_Cmd_End
5AC4 D199          M         bra     label
               00191 
               00192 ; ==========================================================================
               00193 
               00194         ;; ------------------------------------------------------------------
               00195         ;; Controller Handler Macro
               00196         ;; ------------------------------------------------------------------
               00197 TIA_CCIN_SETHLP_MACRO_DO_CTRL MACRO BASE, LAST_VALUE, DEPTH_VALUE, INIT_VALUE, ASSIGN_VALUE
               00198         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
               00199         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
               00200     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
               00201         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00202 
               00203     ;; Velocity calc
               00204     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
               00205     xorlw   0x40
               00206     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
               00207     
               00208     movf        BASE + DEPTH_VALUE, W, BANKED
               00209         andlw   0x3f
               00210         clrc
               00211         rlf     WREG, W
               00212     ;movwf   MIOS_PARAMETER1
               00213    
               00214         btfss   BASE + DEPTH_VALUE, 6, BANKED
               00215     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
               00216     
               00217 TIA_CCIN_CmdHlp_DoCtrl_Pos    
               00218         addlw   2
               00219     movwf   MIOS_PARAMETER1
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 210


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00220     
               00221     movf        BASE + LAST_VALUE, W, BANKED
               00222     mulwf   MIOS_PARAMETER1
               00223     clrc
               00224     rlf     PRODL, F
               00225     rlf     PRODH, W
               00226         addlw   1
               00227     movwf   MIOS_PARAMETER1
               00228     
               00229     movf        BASE + INIT_VALUE, W, BANKED
               00230     sublw   0x7f
               00231     mulwf   MIOS_PARAMETER1
               00232     rlf     PRODL, F
               00233     rlf     PRODH, W
               00234     addwf   BASE + INIT_VALUE, W, BANKED
               00235     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00236 
               00237 TIA_CCIN_CmdHlp_DoCtrl_Neg
               00238     comf    WREG, W
               00239     andlw   0x7f
               00240     addlw       2
               00241     movwf   MIOS_PARAMETER1
               00242 
               00243     movf        BASE + LAST_VALUE, W, BANKED
               00244     mulwf   MIOS_PARAMETER1
               00245     clrc
               00246     rlf     PRODL, F
               00247     rlf     PRODH, W
               00248         addlw   1
               00249     movwf   MIOS_PARAMETER1
               00250 
               00251     movf        BASE + INIT_VALUE, W, BANKED
               00252     mulwf   MIOS_PARAMETER1
               00253     rlf     PRODL, F
               00254     rlf     PRODH, W
               00255     subwf   BASE + INIT_VALUE, W, BANKED
               00256     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00257     
               00258 TIA_CCIN_CmdHlp_DoCtrl_NoDepth
               00259     movf        BASE + INIT_VALUE, W, BANKED
               00260     
               00261 TIA_CCIN_CmdHlp_DoCtrl_Cont
               00262     movwf   MIOS_PARAMETER1
               00263         movf    BASE + ASSIGN_VALUE, W, BANKED
               00264 
               00265         ENDM
               00266 
               00267 ; ==========================================================================
5AC6 00268 TIA_CCIN_Cmd_VEL
               00269 
5AC6 C003 FFE7 00270         movff   MIOS_PARAMETER1, INDF1
5ACA 00271 TIA_CCIN_Cmd_VELOCITY_SkpCopy
5ACA 0E60      00272     movlw   TIA_V2_BASE & 0xff
5ACC 60E1      00273     cpfslt  FSR1L, ACCESS
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 211


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00274     rgoto   TIA_CCIN_Cmd_VELOCITY_A1
5ACE D035          M         bra     label
               00275     
5AD0 00276 TIA_CCIN_Cmd_VELOCITY_A0
               00277 
5AD0 5146      00278         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VEL, W, BANKED      ; exit when velocity assigned to 0
5AD2 E069      00279     bz  TIA_CCIN_Cmd_VELOCITY_End
5AD4 0A05      00280         xorlw   5                               ; CC#5 is Velocity Init
5AD6 E067      00281         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
5AD8 5146      00282         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VEL, W, BANKED
5ADA 0A0E      00283         xorlw   14                              ; CC#14 is Velocity Depth
5ADC E064      00284         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
               00285 
               00286         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_V1_BASE, TIA_Vx_LAST_VEL, TIA_Vx_DEPTH_VEL, TIA_Vx_INIT_VEL, TIA_Vx_ASSIGN_VEL
                   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
5ADE 5149          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5AE0 0A40          M     xorlw   0x40
5AE2 E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5AE4 5149          M     movf        BASE + DEPTH_VALUE, W, BANKED
5AE6 0B3F          M         andlw   0x3f
5AE8 90D8          M         clrc
5AEA 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5AEC AD49          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5AEE D010          M         bra     label
                   M     
5AF0     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5AF0 0F02          M         addlw   2
5AF2 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5AF4 5148          M     movf        BASE + LAST_VALUE, W, BANKED
5AF6 0203          M     mulwf   MIOS_PARAMETER1
5AF8 90D8          M     clrc
5AFA 36F3          M     rlf     PRODL, F
5AFC 34F4          M     rlf     PRODH, W
5AFE 0F01          M         addlw   1
5B00 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5B02 5147          M     movf        BASE + INIT_VALUE, W, BANKED
5B04 087F          M     sublw   0x7f
5B06 0203          M     mulwf   MIOS_PARAMETER1
5B08 36F3          M     rlf     PRODL, F
5B0A 34F4          M     rlf     PRODH, W
5B0C 2547          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5B0E D012          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 212


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M 
5B10     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5B10 1CE8          M     comf    WREG, W
5B12 0B7F          M     andlw   0x7f
5B14 0F02          M     addlw       2
5B16 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5B18 5148          M     movf        BASE + LAST_VALUE, W, BANKED
5B1A 0203          M     mulwf   MIOS_PARAMETER1
5B1C 90D8          M     clrc
5B1E 36F3          M     rlf     PRODL, F
5B20 34F4          M     rlf     PRODH, W
5B22 0F01          M         addlw   1
5B24 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5B26 5147          M     movf        BASE + INIT_VALUE, W, BANKED
5B28 0203          M     mulwf   MIOS_PARAMETER1
5B2A 36F3          M     rlf     PRODL, F
5B2C 34F4          M     rlf     PRODH, W
5B2E 5D47          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5B30 D001          M         bra     label
                   M     
5B32     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5B32 5147          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5B34     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5B34 6E03          M     movwf   MIOS_PARAMETER1
5B36 5146          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00287 
               00288     rgoto   TIA_CCIN_Cmd_VELOCITY_Set
5B38 D035          M         bra     label
               00289     
5B3A 00290 TIA_CCIN_Cmd_VELOCITY_A1
               00291 
5B3A 5186      00292         movf    TIA_V2_BASE + TIA_Vx_ASSIGN_VEL, W, BANKED      ; exit when velocity assigned to 0
5B3C E034      00293         bz      TIA_CCIN_Cmd_VELOCITY_End
5B3E 0A06      00294         xorlw   6                               ; CC#6 is Velocity Init
5B40 E032      00295         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
5B42 5146      00296         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VEL, W, BANKED
5B44 0A0F      00297         xorlw   15                              ; CC#15 is Velocity Depth
5B46 E02F      00298         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
               00299 
               00300         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_V2_BASE, TIA_Vx_LAST_VEL, TIA_Vx_DEPTH_VEL, TIA_Vx_INIT_VEL, TIA_Vx_ASSIGN_VEL
                   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
5B48 5189          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5B4A 0A40          M     xorlw   0x40
5B4C E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 213


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M     
5B4E 5189          M     movf        BASE + DEPTH_VALUE, W, BANKED
5B50 0B3F          M         andlw   0x3f
5B52 90D8          M         clrc
5B54 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5B56 AD89          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5B58 D010          M         bra     label
                   M     
5B5A     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5B5A 0F02          M         addlw   2
5B5C 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5B5E 5188          M     movf        BASE + LAST_VALUE, W, BANKED
5B60 0203          M     mulwf   MIOS_PARAMETER1
5B62 90D8          M     clrc
5B64 36F3          M     rlf     PRODL, F
5B66 34F4          M     rlf     PRODH, W
5B68 0F01          M         addlw   1
5B6A 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5B6C 5187          M     movf        BASE + INIT_VALUE, W, BANKED
5B6E 087F          M     sublw   0x7f
5B70 0203          M     mulwf   MIOS_PARAMETER1
5B72 36F3          M     rlf     PRODL, F
5B74 34F4          M     rlf     PRODH, W
5B76 2587          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5B78 D012          M         bra     label
                   M 
5B7A     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5B7A 1CE8          M     comf    WREG, W
5B7C 0B7F          M     andlw   0x7f
5B7E 0F02          M     addlw       2
5B80 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5B82 5188          M     movf        BASE + LAST_VALUE, W, BANKED
5B84 0203          M     mulwf   MIOS_PARAMETER1
5B86 90D8          M     clrc
5B88 36F3          M     rlf     PRODL, F
5B8A 34F4          M     rlf     PRODH, W
5B8C 0F01          M         addlw   1
5B8E 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5B90 5187          M     movf        BASE + INIT_VALUE, W, BANKED
5B92 0203          M     mulwf   MIOS_PARAMETER1
5B94 36F3          M     rlf     PRODL, F
5B96 34F4          M     rlf     PRODH, W
5B98 5D87          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5B9A D001          M         bra     label
                   M     
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 214


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5B9C     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5B9C 5187          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5B9E     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5B9E 6E03          M     movwf   MIOS_PARAMETER1
5BA0 5186          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00301     rgoto   TIA_CCIN_Cmd_VELOCITY_Set
5BA2 D000          M         bra     label
               00302     
5BA4 00303 TIA_CCIN_Cmd_VELOCITY_Set
               00304         rgoto   TIA_CCIN_Set
5BA4 D730          M         bra     label
               00305         
5BA6 00306 TIA_CCIN_Cmd_VELOCITY_End
               00307         rgoto   TIA_CCIN_Cmd_End
5BA6 D128          M         bra     label
               00308 
               00309 ;; --------------------------------------------------------------------------
5BA8 00310 TIA_CCIN_Cmd_AFTERTOUCH
5BA8 C003 FFE7 00311         movff   MIOS_PARAMETER1, INDF1
               00312 
5BAC 51E8      00313         movf    TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN, W, BANKED
               00314     ;; exit when aftertouch assigned to 0
5BAE E033      00315         bz      TIA_CCIN_Cmd_AFTERTOUCH_End
5BB0 0A03      00316         xorlw   3                               ; CC#3 is Aftertouch Init
5BB2 E031      00317         bz      TIA_CCIN_Cmd_AFTERTOUCH_End     ; prevent endless loop
5BB4 51E8      00318         movf    TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN, W, BANKED
5BB6 0A0C      00319         xorlw   12                              ; CC#12 is Aftertouch Depth
5BB8 E02E      00320         bz      TIA_CCIN_Cmd_AFTERTOUCH_End     ; prevent endless loop
               00321 
               00322         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
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
5BBA 51EB          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5BBC 0A40          M     xorlw   0x40
5BBE E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5BC0 51EB          M     movf        BASE + DEPTH_VALUE, W, BANKED
5BC2 0B3F          M         andlw   0x3f
5BC4 90D8          M         clrc
5BC6 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5BC8 ADEB          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5BCA D010          M         bra     label
                   M     
5BCC     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5BCC 0F02          M         addlw   2
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 215


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5BCE 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5BD0 51EA          M     movf        BASE + LAST_VALUE, W, BANKED
5BD2 0203          M     mulwf   MIOS_PARAMETER1
5BD4 90D8          M     clrc
5BD6 36F3          M     rlf     PRODL, F
5BD8 34F4          M     rlf     PRODH, W
5BDA 0F01          M         addlw   1
5BDC 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5BDE 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
5BE0 087F          M     sublw   0x7f
5BE2 0203          M     mulwf   MIOS_PARAMETER1
5BE4 36F3          M     rlf     PRODL, F
5BE6 34F4          M     rlf     PRODH, W
5BE8 25E9          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5BEA D012          M         bra     label
                   M 
5BEC     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5BEC 1CE8          M     comf    WREG, W
5BEE 0B7F          M     andlw   0x7f
5BF0 0F02          M     addlw       2
5BF2 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5BF4 51EA          M     movf        BASE + LAST_VALUE, W, BANKED
5BF6 0203          M     mulwf   MIOS_PARAMETER1
5BF8 90D8          M     clrc
5BFA 36F3          M     rlf     PRODL, F
5BFC 34F4          M     rlf     PRODH, W
5BFE 0F01          M         addlw   1
5C00 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5C02 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
5C04 0203          M     mulwf   MIOS_PARAMETER1
5C06 36F3          M     rlf     PRODL, F
5C08 34F4          M     rlf     PRODH, W
5C0A 5DE9          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5C0C D001          M         bra     label
                   M     
5C0E     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5C0E 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5C10     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5C10 6E03          M     movwf   MIOS_PARAMETER1
5C12 51E8          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00323         rgoto   TIA_CCIN_Set
5C14 D6F8          M         bra     label
               00324         
5C16 00325 TIA_CCIN_Cmd_AFTERTOUCH_End
               00326         rgoto   TIA_CCIN_Cmd_End
5C16 D0F0          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 216


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00327 
               00328 ;; --------------------------------------------------------------------------
5C18 00329 TIA_CCIN_Cmd_MODWHEEL
5C18 C003 FFE7 00330         movff   MIOS_PARAMETER1, INDF1
5C1C 51EC      00331         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED    
               00332     ;; exit when modwheel assigned to 0
5C1E E036      00333         bz      TIA_CCIN_Cmd_MODWHEEL_End
5C20 05EC      00334         decf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED    
               00335     ;; prevent endless loop if assigned to CC#1
5C22 E034      00336         bz      TIA_CCIN_Cmd_MODWHEEL_End
5C24 51EC      00337         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED
5C26 0A02      00338         xorlw   2                               ; CC#2 is Modwheel Init
5C28 E031      00339         bz      TIA_CCIN_Cmd_MODWHEEL_End       ; prevent endless loop
5C2A 51EC      00340         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED
5C2C 0A0B      00341         xorlw   11                              ; CC#11 is Modulation Wheel Depth
5C2E E02E      00342         bz      TIA_CCIN_Cmd_MODWHEEL_End       ; prevent endless loop
               00343 
               00344         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
5C30 51EF          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5C32 0A40          M     xorlw   0x40
5C34 E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5C36 51EF          M     movf        BASE + DEPTH_VALUE, W, BANKED
5C38 0B3F          M         andlw   0x3f
5C3A 90D8          M         clrc
5C3C 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5C3E ADEF          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5C40 D010          M         bra     label
                   M     
5C42     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5C42 0F02          M         addlw   2
5C44 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5C46 51EE          M     movf        BASE + LAST_VALUE, W, BANKED
5C48 0203          M     mulwf   MIOS_PARAMETER1
5C4A 90D8          M     clrc
5C4C 36F3          M     rlf     PRODL, F
5C4E 34F4          M     rlf     PRODH, W
5C50 0F01          M         addlw   1
5C52 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5C54 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
5C56 087F          M     sublw   0x7f
5C58 0203          M     mulwf   MIOS_PARAMETER1
5C5A 36F3          M     rlf     PRODL, F
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 217


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5C5C 34F4          M     rlf     PRODH, W
5C5E 25ED          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5C60 D012          M         bra     label
                   M 
5C62     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5C62 1CE8          M     comf    WREG, W
5C64 0B7F          M     andlw   0x7f
5C66 0F02          M     addlw       2
5C68 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5C6A 51EE          M     movf        BASE + LAST_VALUE, W, BANKED
5C6C 0203          M     mulwf   MIOS_PARAMETER1
5C6E 90D8          M     clrc
5C70 36F3          M     rlf     PRODL, F
5C72 34F4          M     rlf     PRODH, W
5C74 0F01          M         addlw   1
5C76 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5C78 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
5C7A 0203          M     mulwf   MIOS_PARAMETER1
5C7C 36F3          M     rlf     PRODL, F
5C7E 34F4          M     rlf     PRODH, W
5C80 5DED          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5C82 D001          M         bra     label
                   M     
5C84     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5C84 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5C86     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5C86 6E03          M     movwf   MIOS_PARAMETER1
5C88 51EC          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00345         rgoto   TIA_CCIN_Set
5C8A D6BD          M         bra     label
               00346 
5C8C 00347 TIA_CCIN_Cmd_MODWHEEL_End
               00348         rgoto   TIA_CCIN_Cmd_End
5C8C D0B5          M         bra     label
               00349 
               00350 
               00351 
               00352 ;; --------------------------------------------------------------------------
5C8E 00353 TIA_CCIN_Cmd_WAVEFORM
               00354 
5C8E 5003      00355     movf    MIOS_PARAMETER1, W          
5C90 0A0E      00356     xorlw   0x0e
5C92 E010      00357     bz      TIA_CCIN_Cmd_WAVEFORM_Set1
5C94 5003      00358     movf    MIOS_PARAMETER1, W          
5C96 0A0F      00359     xorlw   0x0f
5C98 E00F      00360     bz      TIA_CCIN_Cmd_WAVEFORM_Set4last
               00361     
5C9A 2A03      00362     incf    MIOS_PARAMETER1, F          ;; skip 0
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 218


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5C9C 0E05      00363     movlw   0x05
5C9E 6003      00364     cpfslt  MIOS_PARAMETER1, ACCESS     ;; skip 5
5CA0 2A03      00365     incf    MIOS_PARAMETER1, F
               00366     
5CA2 0E08      00367     movlw   0x08             
5CA4 6403      00368     cpfsgt  MIOS_PARAMETER1, ACCESS     ;; skip 8-11
               00369     rgoto   TIA_CCIN_Cmd_WAVEFORM_skp13
5CA6 D002          M         bra     label
5CA8 0E03      00370     movlw   0x03
5CAA 2603      00371     addwf   MIOS_PARAMETER1, F    
               00372 
5CAC 00373 TIA_CCIN_Cmd_WAVEFORM_skp13
5CAC 0E0D      00374     movlw   0x0d                        ;; skip 13
5CAE 6003      00375     cpfslt  MIOS_PARAMETER1, ACCESS
5CB0 2A03      00376     incf    MIOS_PARAMETER1, F  
               00377     rgoto   TIA_CCIN_Cmd_WAVEFORM_Cont  
5CB2 D004          M         bra     label
               00378 
5CB4 00379 TIA_CCIN_Cmd_WAVEFORM_Set1
5CB4 6A03      00380     clrf    MIOS_PARAMETER1
               00381     rgoto   TIA_CCIN_Cmd_WAVEFORM_Cont
5CB6 D002          M         bra     label
               00382 
5CB8 00383 TIA_CCIN_Cmd_WAVEFORM_Set4last
5CB8 0E0B      00384     movlw   0x0b
5CBA 6E03      00385     movwf   MIOS_PARAMETER1
               00386     ;;rgoto   TIA_CCIN_Cmd_WAVEFORM_Cont
               00387     
5CBC 00388 TIA_CCIN_Cmd_WAVEFORM_Cont
5CBC 5003      00389     movf    MIOS_PARAMETER1, W     
5CBE 6EE7      00390         movwf   INDF1
               00391 
               00392         rgoto   TIA_CCIN_Cmd_End
5CC0 D09B          M         bra     label
               00393 
               00394 
               00395    
               00396 ;; --------------------------------------------------------------------------
5CC2 00397 TIA_CCIN_Cmd_OPT_BANK
5CC2 5003      00398     movf    MIOS_PARAMETER1, W
5CC4 5011      00399     movf    TIA_BANK, W
5CC6 0B06      00400     andlw   0x06
5CC8 44E8      00401     rlncf   WREG, W
5CCA B011      00402     btfsc   TIA_BANK, 0
5CCC 28E8      00403     incf    WREG, W
5CCE 0F14      00404     addlw   DEFAULT_BS_KBANK_ID*4
5CD0 6E11      00405     movwf   TIA_BANK
               00406     
5CD2 0E4C      00407     movlw   (TIA_V1_BASE + TIA_Vx_WBANK) & 0xff  ;; 
5CD4 18E1      00408     xorwf   FSR1L, W
5CD6 E004      00409     bz      TIA_CCIN_Cmd_OPT_BANK_WT
5CD8 0E8C      00410     movlw   (TIA_V2_BASE + TIA_Vx_WBANK) & 0xff  ;; 
5CDA 18E1      00411     xorwf   FSR1L, W
5CDC E001      00412     bz      TIA_CCIN_Cmd_OPT_BANK_WT
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 219


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00413     rgoto   TIA_CCIN_Cmd_OPT_BANK_KIT
5CDE D015          M         bra     label
               00414     
5CE0 00415 TIA_CCIN_Cmd_OPT_BANK_WT    ;; WT Bank Change
5CE0 0E02      00416     movlw   0x02
5CE2 2611      00417     addwf   TIA_BANK, F  
               00418 
               00419     ;; check internal preset
5CE4 0E01      00420     movlw   1
5CE6 50E3      00421     movf    PLUSW1, W  ;; Vx_WT(Vx_WBANK+1) -> PRESET
5CE8 E00B      00422     bz      TIA_CCIN_Cmd_OPT_BANK_WT_Cont
5CEA 6E12      00423     movwf   TIA_PRESET   
               00424     ;; Check BS ready
5CEC 5011      00425     movf    TIA_BANK, W
5CEE EC6F F01C 00426     call    TIA_BANK_GetBankStickReady
5CF2 B4D8      00427     skpnz
               00428         rgoto   TIA_CCIN_Cmd_OPT_BANK_End
5CF4 D00A          M         bra     label
               00429     ;; Check BS size
5CF6 EC7C F01C 00430     call    TIA_BANK_GetBankStickSize
5CFA E102      00431     bnz     TIA_CCIN_Cmd_OPT_BANK_WT_Cont
               00432     ;; 32k Check preset <64
5CFC BC12      00433     btfsc       TIA_PRESET, 6
               00434     rgoto       TIA_CCIN_Cmd_OPT_BANK_End
5CFE D005          M         bra     label
               00435     
5D00 00436 TIA_CCIN_Cmd_OPT_BANK_WT_Cont    
               00437     ;; push value
5D00 C003 FFE7 00438     movff   MIOS_PARAMETER1, INDF1
5D04 EC23 F026 00439     call    TIA_WT_Init
               00440     rgoto       TIA_CCIN_Cmd_OPT_BANK_End
5D08 D000          M         bra     label
               00441     
5D0A 00442 TIA_CCIN_Cmd_OPT_BANK_KIT    ;; WT Bank Change
               00443 
5D0A 00444 TIA_CCIN_Cmd_OPT_BANK_End
               00445         rgoto   TIA_CCIN_Cmd_End
5D0A D076          M         bra     label
               00446 
               00447 ;; --------------------------------------------------------------------------
5D0C 00448 TIA_CCIN_Cmd_OPT_PST
5D0C 5003      00449     movf    MIOS_PARAMETER1, W
5D0E 6E12      00450     movwf   TIA_PRESET
               00451     
5D10 0EFF      00452     movlw   -1
5D12 50E3      00453     movf    PLUSW1, W  ;; Vx_WBANK(Vx_WT-1) -> BANK
5D14 0B06      00454     andlw   0x06
5D16 44E8      00455     rlncf   WREG, W
5D18 B011      00456     btfsc   TIA_BANK, 0
5D1A 28E8      00457     incf    WREG, W
5D1C 0F14      00458     addlw   DEFAULT_BS_KBANK_ID*4
5D1E 6E11      00459     movwf   TIA_BANK  
               00460     
5D20 0E4D      00461     movlw   (TIA_V1_BASE + TIA_Vx_WT) & 0xff  ;; 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 220


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5D22 18E1      00462     xorwf   FSR1L, W
5D24 E004      00463     bz      TIA_CCIN_Cmd_OPT_PST_WT
5D26 0E8D      00464     movlw   (TIA_V2_BASE + TIA_Vx_WT) & 0xff  ;; 
5D28 18E1      00465     xorwf   FSR1L, W
5D2A E001      00466     bz      TIA_CCIN_Cmd_OPT_PST_WT
               00467     rgoto   TIA_CCIN_Cmd_OPT_PST_Kit
5D2C D00E          M         bra     label
               00468     
5D2E 00469 TIA_CCIN_Cmd_OPT_PST_WT    ;; WT Bank Change
5D2E 0E02      00470     movlw   0x02
5D30 2611      00471     addwf   TIA_BANK, F  
               00472     ;; check internal preset
5D32 5012      00473     movf    TIA_PRESET, W  
5D34 E005      00474     bz      TIA_CCIN_Cmd_OPT_PST_WT_Cont
               00475     ;; Check BS size
5D36 EC7C F01C 00476     call    TIA_BANK_GetBankStickSize
5D3A E102      00477     bnz     TIA_CCIN_Cmd_OPT_PST_WT_Cont
               00478     ;; 32k Check preset <64
5D3C BC12      00479     btfsc       TIA_PRESET, 6
               00480     rgoto       TIA_CCIN_Cmd_OPT_PST_End
5D3E D005          M         bra     label
               00481     
5D40 00482 TIA_CCIN_Cmd_OPT_PST_WT_Cont    
               00483     ;; push value
5D40 C003 FFE7 00484     movff   MIOS_PARAMETER1, INDF1
5D44 EC23 F026 00485     call    TIA_WT_Init
               00486     rgoto       TIA_CCIN_Cmd_OPT_PST_End
5D48 D000          M         bra     label
               00487     
5D4A 00488 TIA_CCIN_Cmd_OPT_PST_Kit    ;; Kit Bank Change
               00489 
5D4A 00490 TIA_CCIN_Cmd_OPT_PST_End
               00491         rgoto   TIA_CCIN_Cmd_End    
5D4A D056          M         bra     label
               00492     
               00493     
               00494 ;; --------------------------------------------------------------------------
               00495 ;TIA_CCIN_Cmd_MONO
               00496 ;       bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00497 ;       bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00498 ;       movf    MIOS_PARAMETER1, W
               00499 ;       skpz
               00500 ;       bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00501 ;       rgoto   TIA_CCIN_Cmd_End
               00502 
               00503 ;; --------------------------------------------------------------------------
5D4C 00504 TIA_CCIN_Cmd_PLAY_MODE
5D4C 910C      00505         bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00506         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00507         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00508 
               00509         ;btfsc  MIOS_PARAMETER1, 0
               00510         ;bcf    TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00511 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 221


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00512         ;btfsc  MIOS_PARAMETER1, 1
               00513         ;bcf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00514 
5D4E B003      00515         btfsc   MIOS_PARAMETER1, 0
5D50 810C      00516         bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00517 
               00518         ;btfsc  TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00519         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00520 
               00521         rgoto   TIA_CCIN_Cmd_End    
5D52 D052          M         bra     label
               00522 
               00523 
               00524 
               00525 ;; --------------------------------------------------------------------------
5D54 00526 TIA_CCIN_Cmd_PlayNote
5D54 5003      00527         movf    MIOS_PARAMETER1, W      ; do nothing if 0x25 played (hold note)
5D56 0A25      00528     xorlw   0x25
5D58 E03B      00529         bz      TIA_CCIN_Cmd_PlayNote_End
               00530 
5D5A 9610      00531         bcf     TIA_STAT, TIA_STAT_SAVED_GIE    ; for nested IRQ disables
5D5C BEF2      00532         btfsc   INTCON, GIE
5D5E 8610      00533         bsf     TIA_STAT, TIA_STAT_SAVED_GIE
               00534         IRQ_DISABLE
5D60 9EF2          M         bcf     INTCON, GIE
               00535 
5D62 50E1      00536         movf    FSR1L, W                ; parameter contains voice offset, calc base address
5D64 EE11 F020 00537         lfsr    FSR1, TIA_V1_BASE
5D68 A4D8      00538     skpz
5D6A EE11 F060 00539         lfsr    FSR1, TIA_V2_BASE
               00540 
               00541         ;; set/clear gate bit
               00542         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_NotTB303
               00543         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_NotTB303
               00544 ;TIA_CCIN_Cmd_PlayNote_TB303
               00545         ;BRA_IFSET TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED, TIA_CCIN_Cmd_PlayNote_Cont
               00546         ;BRA_IFSET TIA_WT_STATE, WT_STATE_GATE, BANKED, TIA_CCIN_Cmd_PlayNote_On
               00547         ;; gate will be released by sequencer
               00548         ;rgoto  TIA_CCIN_Cmd_PlayNote_Cont
5D6E 00549 TIA_CCIN_Cmd_PlayNote_NotTB303
               00550 
5D6E 5003      00551         movf    MIOS_PARAMETER1, W
5D70 E105      00552         bnz     TIA_CCIN_Cmd_PlayNote_On
5D72 00553 TIA_CCIN_Cmd_PlayNote_Off
               00554         ;; clear gate bit + note and branch to end
5D72 0E03      00555         movlw   TIA_Vx_STAT
5D74 92E3      00556         bcf     PLUSW1, Vx_STAT_GATE_SET_REQ
5D76 84E3      00557         bsf     PLUSW1, Vx_STAT_GATE_CLR_REQ
5D78 90E3      00558     bcf PLUSW1, Vx_STAT_VOICE_ACTIVE
               00559         rgoto   TIA_CCIN_Cmd_PlayNote_End
5D7A D02A          M         bra     label
               00560 
5D7C 00561 TIA_CCIN_Cmd_PlayNote_On
               00562         ;; set gate bit
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 222


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5D7C 0E03      00563         movlw   TIA_Vx_STAT
               00564         ;BRA_IFCLR PLUSW1, Vx_STAT_VOICE_ACTIVE, ACCESS, TIA_CCIN_Cmd_PlayNote_Cont
5D7E 84E3      00565         bsf     PLUSW1, Vx_STAT_GATE_CLR_REQ
5D80 82E3      00566         bsf     PLUSW1, Vx_STAT_GATE_SET_REQ
5D82 80E3      00567     bsf PLUSW1, Vx_STAT_VOICE_ACTIVE
               00568 
               00569         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_On_NoTB303
               00570         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_On_NoTB303
               00571         rgoto   TIA_CCIN_Cmd_PlayNote_Cont
5D84 D006          M         bra     label
5D86 00572 TIA_CCIN_Cmd_PlayNote_On_NoTB303
5D86 D826      00573         rcall   TIA_CCIN_Cmd_PlayNote_PHelp     ; help function for alternative portamento
               00574         ;; enable portamento if rate > 0
5D88 0E0E      00575         movlw   TIA_Vx_PORTA_RATE
5D8A 50E3      00576         movf    PLUSW1, W
5D8C E002      00577         bz      TIA_CCIN_Cmd_PlayNote_Cont
5D8E 0E03      00578         movlw   TIA_Vx_STAT
5D90 8CE3      00579         bsf     PLUSW1, Vx_STAT_PORTA_ENABLE
5D92 00580 TIA_CCIN_Cmd_PlayNote_Cont
               00581 
               00582         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_NoTB303Sl
               00583         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_NoTB303Sl
               00584 ;TIA_CCIN_Cmd_PlayNote_TB303Sl
               00585         ;; enable portamento depending on previous step
               00586         ;bcf    TIA_V1_BASE + TIA_Vx_MODE, TIA_MODE_PORTA_ENABLE, BANKED
               00587         ;btfsc  TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED
               00588         ;bsf    TIA_V1_BASE + TIA_Vx_MODE, TIA_MODE_PORTA_ENABLE, BANKED
               00589         ;rcall  TIA_CCIN_Cmd_PlayNote_PHelp     ; help function for alternative portamento
5D92 00590 TIA_CCIN_Cmd_PlayNote_NoTB303Sl
               00591         ;; set new note
               00592         ;; if > 0x20, play arpeggiator note
               00593         ;movlw  0x20
               00594         ;cpfslt MIOS_PARAMETER1, ACCESS
               00595         ;rgoto TIA_CCIN_Cmd_PlayNote_Arp
5D92 00596 TIA_CCIN_Cmd_PlayNote_Norm
5D92 0E04      00597         movlw   TIA_Vx_MODE
               00598         BRA_IFSET PLUSW1, Vx_MODE_KEY_EXTENDED, ACCESS, TIA_CCIN_Cmd_PlayNote_KeyMode_Extended    
5D94 B6E3          M         btfsc   reg, bit, reg_a
5D96 D009          M         bra     label
5D98 00599 TIA_CCIN_Cmd_PlayNote_KeyMode_NonExtended 
5D98 0603      00600     decf    MIOS_PARAMETER1, F
5D9A 90D8      00601     clrc
5D9C 0E05      00602     movlw   TIA_Vx_KEY_OFFSET
5D9E 50E3      00603     movf    PLUSW1, W
5DA0 2603      00604     addwf   MIOS_PARAMETER1, F
5DA2 0E10      00605         movlw   TIA_Vx_NOTE
5DA4 C003 FFE3 00606         movff   MIOS_PARAMETER1, PLUSW1
               00607     rgoto   TIA_CCIN_Cmd_PlayNote_End 
5DA8 D013          M         bra     label
               00608 
5DAA 00609 TIA_CCIN_Cmd_PlayNote_KeyMode_Extended      
               00610     ;;etendu (5bit pitch to 7bit note)
5DAA 0603      00611     decf    MIOS_PARAMETER1, F
5DAC 90D8      00612     clrc
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 223


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5DAE 3603      00613     rlf     MIOS_PARAMETER1, F
5DB0 3603      00614     rlf     MIOS_PARAMETER1, F  
5DB2 0E10      00615         movlw   TIA_Vx_NOTE
5DB4 C003 FFE3 00616         movff   MIOS_PARAMETER1, PLUSW1
               00617         rgoto   TIA_CCIN_Cmd_PlayNote_End
5DB8 D00B          M         bra     label
               00618 
5DBA 00619 TIA_CCIN_Cmd_PlayNote_Arp
5DBA 0E1E      00620         movlw   TIA_Vx_ARP_NOTE_0
5DBC 2403      00621         addwf   MIOS_PARAMETER1, W
5DBE 0FE0      00622         addlw   -0x20
5DC0 50E3      00623         movf    PLUSW1, W
5DC2 E102      00624         bnz     TIA_CCIN_Cmd_PlayNote_ArpNow
5DC4 0E1E      00625         movlw   TIA_Vx_ARP_NOTE_0       ; if xth key not pressed: play first ARP note
5DC6 50E3      00626         movf    PLUSW1, W
5DC8 00627 TIA_CCIN_Cmd_PlayNote_ArpNow
5DC8 6EF3      00628         movwf   PRODL
5DCA 0E10      00629         movlw   TIA_Vx_NOTE
5DCC CFF3 FFE3 00630         movff   PRODL, PLUSW1
               00631 
5DD0 00632 TIA_CCIN_Cmd_PlayNote_End
               00633         ;;IRQ_ENABLE
5DD0 B610      00634         btfsc   TIA_STAT, TIA_STAT_SAVED_GIE    ; nested IRQ enable
5DD2 8EF2      00635         bsf     INTCON, GIE
               00636         ;;rgoto TIA_CCIN_Cmd_End
               00637 
               00638 ;; --------
               00639 ;; help function for alternative portamento effect
5DD4 00640 TIA_CCIN_Cmd_PlayNote_PHelp
               00641         ;btfss  TIA_SE_OPTION, Vx_OPTION_ENV2PORTA, BANKED
5DD4 0012      00642         return
               00643 
               00644         ;; reset ENV2
               00645         ;call   TIA_SW_Hlp_ENV2Reset
               00646         
               00647         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
               00648 
5DD6 0E09      00649         movlw   TIA_Vx_FRQ_L
5DD8 CFE3 FFF3 00650         movff   PLUSW1, PRODL
5DDC 0E0A      00651         movlw   TIA_Vx_FRQ_H
5DDE CFE3 FFF4 00652         movff   PLUSW1, PRODH    
               00653 
5DE2 0E1C      00654         movlw   TIA_Vx_PORTA_FRQ_L
5DE4 CFF3 FFE3 00655         movff   PRODL, PLUSW1
5DE8 0E1D      00656         movlw   TIA_Vx_PORTA_FRQ_H
5DEA CFF4 FFE3 00657         movff   PRODH, PLUSW1   
               00658 
5DEE 0E1A      00659     movlw   TIA_Vx_PORTA_CTR_L 
5DF0 6AE3      00660         clrf    PLUSW1
5DF2 0E1B      00661     movlw   TIA_Vx_PORTA_CTR_H 
5DF4 6AE3      00662         clrf    PLUSW1
               00663     
5DF6 0012      00664         return
               00665 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 224


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00666 
               00667 ;; --------------------------------------------------------------------------
5DF8 00668 TIA_CCIN_Cmd_End
5DF8 0012      00669         return
               00670 
               00407 #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 ;; --------------------------------------------------------------------------
5DFA 00017 TIA_CCOUT_Handler
               00018         ;; do nothing if dump has not been requested
5DFA A410      00019         btfss   TIA_STAT, TIA_STAT_CC_DUMP_REQ
5DFC 0012      00020         return
               00021 
               00022         ;; clear request
5DFE 9410      00023         bcf     TIA_STAT, TIA_STAT_CC_DUMP_REQ
               00024 
5E00 6A06      00025         clrf    TMP1                    ; TMP1 used as loop counter
5E02 00026 TIA_CCOUT_Handler_Loop
5E02 5006      00027         movf    TMP1, W
5E04 EC19 F02F 00028         call    TIA_CCOUT_Get           ; get CC parameter value
5E08 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)
5E0A BE07          M         btfsc   reg, bit, reg_a
5E0C D00E          M         bra     label
               00031 
               00032         ;; send CC
5E0E C120 FFE8 00033         movff   TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, WREG
5E12 09B0      00034         iorlw   0xb0
5E14 EC24 F016 00035         call    MIOS_MIDI_TxBufferPut
5E18 5006      00036         movf    TMP1, W
5E1A EC24 F016 00037         call    MIOS_MIDI_TxBufferPut
5E1E 5007      00038         movf    TMP2, W
5E20 EC24 F016 00039         call    MIOS_MIDI_TxBufferPut
               00040 
5E24 0E08      00041         movlw   8                       ; add a short delay of 8 mS for slow sequencers
5E26 ECCE F016 00042         call    MIOS_Delay
               00043 
5E2A 00044 TIA_CCOUT_Handler_Next
5E2A 2A06      00045         incf    TMP1, F                 ; loop until 128 (bit 8 set)
               00046         BRA_IFCLR TMP1, 7, ACCESS, TIA_CCOUT_Handler_Loop
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 225


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5E2C AE06          M         btfss   reg, bit, reg_a
5E2E D7E9          M         bra     label
               00047         
5E30 0012      00048         return
               00049 
               00050 ;; --------------------------------------------------------------------------
               00051 ;;  IN: index of CC parameter in WREG
               00052 ;;  OUT: CC value in WREG
               00053 ;; --------------------------------------------------------------------------
5E32 00054 TIA_CCOUT_Get
5E32 D845      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 
5E34 00060 TIA_CCOUT_Set_Cmd
               00061         ;; branch depending on command
5E34 5004      00062         movf    MIOS_PARAMETER2, W
5E36 0B0F      00063         andlw   0x0f
               00064         JUMPTABLE_2BYTES_UNSECURE
5E38 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00065         rgoto   TIA_CCOUT_Cmd_NOP
5E3C D00F          M         bra     label
               00066         rgoto   TIA_CCOUT_Cmd_V12
5E3E D00F          M         bra     label
               00067         rgoto   TIA_CCOUT_Cmd_7BIT
5E40 D010          M         bra     label
               00068         rgoto   TIA_CCOUT_Cmd_7BIT; (W_PORTA ignored here)
5E42 D00F          M         bra     label
               00069         rgoto   TIA_CCOUT_Cmd_7BIT_4L
5E44 D010          M         bra     label
               00070         rgoto   TIA_CCOUT_Cmd_7BIT_4U
5E46 D012          M         bra     label
               00071         rgoto   TIA_CCOUT_Cmd_SUSKEY
5E48 D01C          M         bra     label
               00072         rgoto   TIA_CCOUT_Cmd_VEL
5E4A D01E          M         bra     label
               00073         rgoto   TIA_CCOUT_Cmd_AFTERTOUCH
5E4C D01E          M         bra     label
               00074         rgoto   TIA_CCOUT_Cmd_MODWHEEL
5E4E D01E          M         bra     label
               00075         rgoto   TIA_CCOUT_Cmd_WAVEFORM
5E50 D01E          M         bra     label
               00076         rgoto   TIA_CCOUT_Cmd_OPT_BANK
5E52 D02E          M         bra     label
               00077         rgoto   TIA_CCOUT_Cmd_OPT_PST
5E54 D02E          M         bra     label
               00078         rgoto   TIA_CCOUT_Cmd_Cmd_PLAY_MODE
5E56 D02F          M         bra     label
               00079         rgoto   TIA_CCOUT_Cmd_NOP
5E58 D001          M         bra     label
               00080         rgoto   TIA_CCOUT_Cmd_NOP; (PLAY_NOTE)
5E5A D000          M         bra     label
               00081 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 226


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00082 ; ==========================================================================
               00083 
               00084 
               00085 ;; --------------------------------------------------------------------------
5E5C 00086 TIA_CCOUT_Cmd_NOP
5E5C 0012      00087         return
               00088 
               00089 ;; --------------------------------------------------------------------------
5E5E 00090 TIA_CCOUT_Cmd_V12
5E5E 50E1      00091         movf    FSR1L, W                ; parameter contains first CC, only return this parameter!
               00092         rgoto   TIA_CCOUT_Get
5E60 D7E8          M         bra     label
               00093 
               00094 ;; --------------------------------------------------------------------------
5E62 00095 TIA_CCOUT_Cmd_7BIT
5E62 50E7      00096         movf    INDF1, W
5E64 0012      00097         return
               00098 
               00099 ;; --------------------------------------------------------------------------
5E66 00100 TIA_CCOUT_Cmd_7BIT_4L
5E66 50E7      00101         movf    INDF1, W
5E68 0B0F      00102         andlw   0x0f
5E6A 0012      00103         return
               00104 
               00105 ;; --------------------------------------------------------------------------
5E6C 00106 TIA_CCOUT_Cmd_7BIT_4U
5E6C 38E7      00107         swapf   INDF1, W
5E6E 0B0F      00108         andlw   0x0f
5E70 0012      00109         return
               00110 
               00111 ;; --------------------------------------------------------------------------
5E72 00112 TIA_CCOUT_Cmd_7BIT_TO_7_4
5E72 30E7      00113         rrf     INDF1, W
5E74 0B78      00114         andlw   0x78
5E76 0012      00115         return
               00116 
               00117 ;; --------------------------------------------------------------------------
5E78 00118 TIA_CCOUT_Cmd_7BIT_TO_3_0
5E78 34E7      00119         rlf     INDF1, W
5E7A 36E8      00120         rlf     WREG, F
5E7C 34E8      00121         rlf     WREG, W
5E7E 0B78      00122         andlw   0x78
5E80 0012      00123         return
               00124 
               00125 ;; --------------------------------------------------------------------------
5E82 00126 TIA_CCOUT_Cmd_SUSKEY
               00127         ;rrf    TIA_KEYTRACKING, W, BANKED
               00128         ;andlw  0x7e
               00129 
5E82 B30C      00130         btfsc   TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
5E84 0E01      00131         movlw 0x01
5E86 0012      00132         return
               00133 
               00134 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 227


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5E88 00135 TIA_CCOUT_Cmd_VEL
               00136         rgoto   TIA_CCOUT_Cmd_7BIT
5E88 D7EC          M         bra     label
               00137 
               00138 ;; --------------------------------------------------------------------------
5E8A 00139 TIA_CCOUT_Cmd_AFTERTOUCH
               00140         rgoto   TIA_CCOUT_Cmd_7BIT
5E8A D7EB          M         bra     label
               00141 
               00142 ;; --------------------------------------------------------------------------
5E8C 00143 TIA_CCOUT_Cmd_MODWHEEL
               00144         rgoto   TIA_CCOUT_Cmd_7BIT
5E8C D7EA          M         bra     label
               00145 
               00146 ;; --------------------------------------------------------------------------
5E8E 00147 TIA_CCOUT_Cmd_WAVEFORM
5E8E 50E7      00148         movf    INDF1, W
5E90 0B0F      00149     andlw   0x0f
5E92 6E03      00150     movwf   MIOS_PARAMETER1
5E94 0E0D      00151     movlw   0x0d                ;; skip 13
5E96 6003      00152     cpfslt  MIOS_PARAMETER1
5E98 0603      00153     decf    MIOS_PARAMETER1, F 
               00154 
5E9A 0E08      00155     movlw   0x08             
5E9C 6403      00156     cpfsgt  MIOS_PARAMETER1     ;; skip 8-11
               00157     rgoto   TIA_CCOUT_Cmd_WAVEFORM_Cont
5E9E D002          M         bra     label
5EA0 0E03      00158     movlw   0x03
5EA2 5E03      00159     subwf   MIOS_PARAMETER1, F    
               00160 
5EA4 00161 TIA_CCOUT_Cmd_WAVEFORM_Cont   
               00162 
5EA4 0E05      00163     movlw   0x05
5EA6 6003      00164     cpfslt  MIOS_PARAMETER1     ;; skip 5
5EA8 0603      00165     decf    MIOS_PARAMETER1, F
               00166     
5EAA 0603      00167     decf    MIOS_PARAMETER1, F  ;; skip 0
5EAC 5003      00168     movf        MIOS_PARAMETER1, W
               00169 
5EAE 0012      00170         return
               00171 
               00172 ;; --------------------------------------------------------------------------
5EB0 00173 TIA_CCOUT_Cmd_OPT_BANK
               00174         rgoto   TIA_CCOUT_Cmd_7BIT
5EB0 D7D8          M         bra     label
               00175 
               00176 ;; --------------------------------------------------------------------------
5EB2 00177 TIA_CCOUT_Cmd_OPT_PST
               00178         rgoto   TIA_CCOUT_Cmd_7BIT
5EB2 D7D7          M         bra     label
               00179 
               00180 ;; --------------------------------------------------------------------------
5EB4 00181 TIA_CCOUT_Cmd_MONO
5EB4 0012      00182         return                  ; (ignored)
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 228


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00183 
               00184 ;; --------------------------------------------------------------------------
5EB6 00185 TIA_CCOUT_Cmd_Cmd_PLAY_MODE
5EB6 0E00      00186         movlw   0x00
               00187         ;btfss  TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00188         ;movlw 0x01
               00189         ;btfss  TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00190         ;movlw 0x03
5EB8 B10C      00191         btfsc   TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
5EBA 0E01      00192         movlw 0x01
5EBC 0012      00193         return
               00408 #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_VEL          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_OPT_BANK     EQU 0x0b
  0000000C     00028 SET_CC_OPT_PST      EQU 0x0c
  0000000D     00029 SET_CC_PLAY_MODE    EQU 0x0d
  0000000E     00030 SET_CC_FREE3        EQU 0x0e
  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 ;; --------------------------------------------------------------------------
5EBE 00037 TIA_CC_TABLE_Get
               00038         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
5EBE 0101          M         movlb   HIGH(reg)
5EC0 EE11 F000 00039         lfsr    FSR1, TIA_BASE          ; prepare FSR1
               00040 
5EC4 90D8      00041         clrc
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 229


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5EC6 34E8      00042         rlf     WREG, W
5EC8 0FE0      00043         addlw   TIA_CC_TABLE & 0xff
5ECA 6EF6      00044         movwf   TBLPTRL
5ECC 6AF7      00045         clrf    TBLPTRH
5ECE 0E5E      00046         movlw   TIA_CC_TABLE >> 8
5ED0 22F7      00047         addwfc  TBLPTRH, F
               00048 
5ED2 0009      00049         tblrd*+
5ED4 CFF5 F004 00050         movff   TABLAT, MIOS_PARAMETER2 ; -> command
5ED8 0009      00051         tblrd*+
5EDA CFF5 FFE1 00052         movff   TABLAT, FSR1L           ; -> parameter
5EDE 0012      00053         return
               00054 
               00055 
               00056 ; ==========================================================================
               00057 
5EE0 00058 TIA_CC_TABLE
               00059         ;; 0x00-0x0f
5EE0 0000      00060         db      SET_CC_NOP,                             0x00
5EE2 EE09      00061         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_LAST) & 0xff
5EE4 ED09      00062         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_INIT) & 0xff
5EE6 E908      00063         db      SET_CC_AFTERTOUCH,                              (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_INIT) & 0xff
5EE8 0501      00064         db      SET_CC_V12,                 0x05
5EEA 4707      00065         db      SET_CC_VEL,                     (TIA_V1_BASE + TIA_Vx_INIT_VEL) & 0xff
5EEC 8707      00066         db      SET_CC_VEL,                     (TIA_V2_BASE + TIA_Vx_INIT_VEL) & 0xff
5EEE 0B02      00067         db      SET_CC_7BIT,                                    TIA_MASTER_VOL & 0xff    
5EF0 0901      00068         db      SET_CC_V12,                 0x09
5EF2 2F02      00069         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_VOLUME) & 0xff
5EF4 6F02      00070         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_VOLUME) & 0xff
5EF6 EF09      00071         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_DEPTH) & 0xff
5EF8 EB08      00072         db      SET_CC_AFTERTOUCH,                              (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_DEPTH) & 0xff
5EFA 0E01      00073         db      SET_CC_V12,                 0x0e
5EFC 4902      00074         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_DEPTH_VEL) & 0xff
5EFE 8902      00075         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_DEPTH_VEL) & 0xff
               00076 
               00077         ;; 0x10-0x1f
5F00 1101      00078         db      SET_CC_V12,                 0x11
5F02 000A      00079         db      SET_CC_WAVEFORM,                TIA_AUDC0 & 0x0f
5F04 010A      00080         db      SET_CC_WAVEFORM,                TIA_AUDC1 & 0x0f
5F06 1401      00081         db      SET_CC_V12,                 0x14
5F08 2402      00082         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_MODE) & 0xff
5F0A 6402      00083         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_MODE) & 0xff
5F0C 1701      00084         db      SET_CC_V12,                 0x17
5F0E 2C03      00085         db      SET_CC_7BIT_W_PORTA,                    (TIA_V1_BASE + TIA_Vx_TRANSPOSE) & 0xff
5F10 6C03      00086         db      SET_CC_7BIT_W_PORTA,                    (TIA_V2_BASE + TIA_Vx_TRANSPOSE) & 0xff
5F12 1A01      00087         db      SET_CC_V12,                 0x1a
5F14 2D03      00088         db      SET_CC_7BIT_W_PORTA,                    (TIA_V1_BASE + TIA_Vx_PITCHRANGE) & 0xff
5F16 6D03      00089         db      SET_CC_7BIT_W_PORTA,                    (TIA_V2_BASE + TIA_Vx_PITCHRANGE) & 0xff
5F18 1D01      00090         db      SET_CC_V12,                 0x1d
5F1A 2E02      00091         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_PORTA_RATE) & 0xff
5F1C 6E02      00092         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_PORTA_RATE) & 0xff
5F1E 2001      00093         db      SET_CC_V12,                 0x20
               00094 
               00095         ;; 0x20-0x2f
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 230


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5F20 3302      00096         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_ARP_RATE) & 0xff
5F22 7302      00097         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_ARP_RATE) & 0xff
5F24 2301      00098         db      SET_CC_V12,                 0x23
5F26 3102      00099         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_NOTE_DELAY) & 0xff
5F28 7102      00100         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_NOTE_DELAY) & 0xff
5F2A 2601      00101         db      SET_CC_V12,                 0x26
5F2C 2502      00102         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KEY_OFFSET) & 0xff
5F2E 6502      00103         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KEY_OFFSET) & 0xff
5F30 2901      00104         db      SET_CC_V12,                 0x29
5F32 2602      00105         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KEY_LENGTH) & 0xff
5F34 6602      00106         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KEY_LENGTH) & 0xff
5F36 2C01      00107         db      SET_CC_V12,                 0x2c
5F38 4602      00108         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_ASSIGN_VEL) & 0xff
5F3A 8602      00109         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_ASSIGN_VEL) & 0xff
5F3C 2F01      00110         db      SET_CC_V12,                 0x2f
5F3E 4A02      00111         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_ENV_MODE) & 0xff
               00112  
               00113     ;; 0x30-0x3f    
5F40 8A02      00114         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_ENV_MODE) & 0xff
5F42 3201      00115     db  SET_CC_V12,                 0x32
5F44 C402      00116         db      SET_CC_7BIT,                    (TIA_V1_ENV_BASE + TIA_ENVx_DEPTH) & 0xff
5F46 CF02      00117         db      SET_CC_7BIT,                    (TIA_V2_ENV_BASE + TIA_ENVx_DEPTH) & 0xff
5F48 3501      00118     db  SET_CC_V12,                                     0x35
5F4A C302      00119         db      SET_CC_7BIT,                    (TIA_V1_ENV_BASE + TIA_ENVx_CURVE) & 0xff
5F4C CE02      00120         db      SET_CC_7BIT,                    (TIA_V2_ENV_BASE + TIA_ENVx_CURVE) & 0xff
5F4E 3801      00121     db  SET_CC_V12,                                     0x38
5F50 BF02      00122         db      SET_CC_7BIT,                    (TIA_V1_ENV_BASE + TIA_ENVx_ATTACK) & 0xff
5F52 CA02      00123     db  SET_CC_7BIT,                    (TIA_V2_ENV_BASE + TIA_ENVx_ATTACK) & 0xff
5F54 3B01      00124     db  SET_CC_V12,                                     0x3b
5F56 C002      00125     db  SET_CC_7BIT,                    (TIA_V1_ENV_BASE + TIA_ENVx_DECAY) & 0xff
5F58 CB02      00126         db      SET_CC_7BIT,                    (TIA_V2_ENV_BASE + TIA_ENVx_DECAY) & 0xff  
5F5A 3E01      00127         db      SET_CC_V12,                                     0x3e
5F5C C102      00128         db      SET_CC_7BIT,                    (TIA_V1_ENV_BASE + TIA_ENVx_SUSTAIN) & 0xff
5F5E CC02      00129         db      SET_CC_7BIT,                    (TIA_V2_ENV_BASE + TIA_ENVx_SUSTAIN) & 0xff
               00130     
               00131     ;; 0x40-0x4f 
5F60 4101      00132         db      SET_CC_V12,                                     0x41
5F62 C202      00133         db      SET_CC_7BIT,                    (TIA_V1_ENV_BASE + TIA_ENVx_RELEASE) & 0xff
5F64 CD02      00134         db      SET_CC_7BIT,                    (TIA_V2_ENV_BASE + TIA_ENVx_RELEASE) & 0xff
5F66 1B02      00135         db      SET_CC_7BIT,                    TIA_Vx_ENV_CURVES & 0xff
5F68 4501      00136         db      SET_CC_V12,                                     0x45
5F6A 4B02      00137         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_OPTION) & 0xff
5F6C 8B02      00138         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_OPTION) & 0xff
5F6E 4801      00139         db      SET_CC_V12,                                     0x48
5F70 4C0B      00140         db      SET_CC_OPT_BANK,                (TIA_V1_BASE + TIA_Vx_WBANK) & 0xff
5F72 8C0B      00141         db      SET_CC_OPT_BANK,                (TIA_V2_BASE + TIA_Vx_WBANK) & 0xff
5F74 4B01      00142         db      SET_CC_V12,                                     0x4b
5F76 4D0C      00143         db      SET_CC_OPT_PST,                 (TIA_V1_BASE + TIA_Vx_WT) & 0xff
5F78 8D0C      00144         db      SET_CC_OPT_PST,                 (TIA_V2_BASE + TIA_Vx_WT) & 0xff
5F7A 4E01      00145         db      SET_CC_V12,                                     0x4e
5F7C 4F02      00146         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_WT_RATE) & 0xff
5F7E 8F02      00147         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_WT_RATE) & 0xff
               00148     ;; 0x40-0x4f 
               00149 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 231


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5F80 0000      00150     db  SET_CC_NOP,                     0x00    ; reserved
5F82 0000      00151     db  SET_CC_NOP,                     0x00    ; reserved
5F84 0000      00152     db  SET_CC_NOP,                     0x00    ; reserved
5F86 0000      00153     db  SET_CC_NOP,                     0x00    ; reserved
5F88 0000      00154     db  SET_CC_NOP,                     0x00    ; reserved
5F8A 0000      00155     db  SET_CC_NOP,                     0x00    ; reserved
5F8C 1F02      00156         db      SET_CC_7BIT,                                    TIA_MOD_SYNC & 0xff
5F8E 5801      00157         db      SET_CC_V12,                                     0x58
5F90 3702      00158         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_AMP_MOD) & 0xff
5F92 7702      00159         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_AMP_MOD) & 0xff
5F94 5B01      00160         db      SET_CC_V12,                                     0x5b
5F96 3602      00161         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_PITCH_MOD) & 0xff
5F98 7602      00162         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_PITCH_MOD) & 0xff
5F9A A002      00163     db  SET_CC_7BIT,                            (TIA_LFO1_BASE + TIA_LFOx_MODE) & 0xff
5F9C A702      00164         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_MODE) & 0xff  
5F9E AE02      00165         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_MODE) & 0xff
               00166     
               00167         ;; 0x60-0x6f
5FA0 B502      00168         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_MODE) & 0xff
5FA2 A102      00169         db      SET_CC_7BIT,                (TIA_LFO1_BASE + TIA_LFOx_RATE) & 0xff
5FA4 A802      00170         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_RATE) & 0xff
5FA6 AF02      00171         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_RATE) & 0xff
5FA8 B602      00172         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_RATE) & 0xff      
5FAA A402      00173         db      SET_CC_7BIT,                            (TIA_LFO1_BASE + TIA_LFOx_DEPTH) & 0xff
5FAC AB02      00174         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_DEPTH) & 0xff
5FAE B202      00175         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_DEPTH) & 0xff
5FB0 B902      00176         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_DEPTH) & 0xff
5FB2 DA02      00177         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_DEPTH) & 0xff
5FB4 E502      00178         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_DEPTH) & 0xff
5FB6 D902      00179     db  SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_CURVE) & 0xff
5FB8 E402      00180         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_CURVE) & 0xff
5FBA D502      00181         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_ATTACK) & 0xff
5FBC E002      00182         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_ATTACK) & 0xff
5FBE D602      00183         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_DECAY) & 0xff
               00184     
               00185         ;; 0x70-0x7f 
5FC0 E102      00186         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_DECAY) & 0xff
5FC2 D702      00187         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_SUSTAIN) & 0xff
5FC4 E202      00188         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_SUSTAIN) & 0xff
5FC6 D802      00189         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_RELEASE) & 0xff
5FC8 E302      00190         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_RELEASE) & 0xff
5FCA 1E02      00191         db      SET_CC_7BIT,                    TIA_ENVx_CURVES & 0xff
5FCC 0000      00192     db  SET_CC_NOP,                                     0x00
5FCE EC02      00193     db  SET_CC_7BIT,                    (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN) & 0xff
5FD0 E802      00194         db      SET_CC_7BIT,                    (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN) & 0xff
5FD2 7A01      00195         db      SET_CC_V12,                 0x7a
5FD4 000F      00196         db      SET_CC_PLAY_NOTE,                               0x00; (Voice 1)
5FD6 010F      00197         db      SET_CC_PLAY_NOTE,                               0x01; (Voice 2)
5FD8 0000      00198     db  SET_CC_NOP,                                     0x00
5FDA F004      00199         db      SET_CC_7BIT_4L,                                 TIA_MIDI_SYNC & 0xff
5FDC 0000      00200     db  SET_CC_NOP,                                     0x00
5FDE 000D      00201         db      SET_CC_PLAY_MODE,                               0x00
               00202 
               00203 ; ==========================================================================
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 232


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00409 #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 ;; --------------------------------------------------------------------------
5FE0 00018 TIA_SYSEX_TABLE_Get
5FE0 BEE8      00019         btfsc   WREG, 7; Wavetable area: return 0xff
5FE2 0CFF      00020         retlw 0xff                      
               00021 
5FE4 0FF4      00022         addlw   TIA_SYSEX_TABLE & 0xff                  ; calc: TIA_SYSEX_TABLE + index
5FE6 6EF6      00023         movwf   TBLPTRL                                 ; result in TBLPTR[LH]
5FE8 6AF7      00024         clrf    TBLPTRH
5FEA 0E5F      00025         movlw   (TIA_SYSEX_TABLE >> 8) & 0xff
5FEC 22F7      00026         addwfc  TBLPTRH, F
5FEE 0008      00027         tblrd*                                          ; read from table
5FF0 50F5      00028         movf    TABLAT, W                               ; return table entry
5FF2 0012      00029         return
               00030 
               00031 
               00032         ;; SyxTab maps the SysEx offset to the CC number
5FF4 00033 TIA_SYSEX_TABLE
               00034         ;; 0x00-0x0f
5FF4 8180      00035         db      0x80, 0x81      ; Patch Name
5FF6 8382      00036         db      0x82, 0x83
5FF8 8584      00037         db      0x84, 0x85
5FFA 8786      00038         db      0x86, 0x87
5FFC 8988      00039         db      0x88, 0x89
5FFE 8B8A      00040         db      0x8a, 0x8b
6000 8D8C      00041         db      0x8c, 0x8d
6002 8F8E      00042         db      0x8e, 0x8f
               00043 
               00044         ;; 0x10-0x1f
6004 7F07      00045         db      0x07, 0x7f      ; Master Volume, Play Mode
6006 737B      00046         db      0x7b, 0x73      ; SusKey, ENVx curves
6008 567D      00047         db      0x7d, 0x56      ; MIDI Sync, Modulation Sync 
600A FF43      00048         db      0x43, 0xff      ; Vx_Env curves
600C FFFF      00049     db  0xff, 0xff      ; 
600E 0277      00050         db      0x77, 0x02      ; Modulation Assign, Modulation Init Value
6010 780B      00051         db      0x0b, 0x78      ; Modulation Depth, Aftertouch Assign
6012 0C03      00052     db  0x03, 0x0c      ; Aftertouch Init Value, Aftertouch Depth       
               00053 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 233


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00054         ;; 0x20-0x2f 
               00055     ;; Voice 1 (AUD0)
6014 1709      00056         db      0x09, 0x17      ; V1 Volume, V1 Transpose
6016 1411      00057         db      0x11, 0x14      ; V1 Waveform, V1 Mo0x24de
6018 1D1A      00058         db      0x1a, 0x1d      ; V1 PitchRange, V1 Portamento
601A 2320      00059         db      0x20, 0x23      ; V1 Arp Rate, V1 Delay
601C 2926      00060         db      0x26, 0x29      ; V1 Key Offset, V1 Key Length
601E 9190      00061         db      0x90, 0x91      ; Split V1 Lower, Split V1 Upper
6020 052C      00062         db      0x2c, 0x05      ; V1 Velocity Assign, V1 Velocity Init Value
6022 2F0E      00063         db      0x0e, 0x2f      ; V1 Velocity Depth, ENVAUD0 Options
               00064     ;; 0x30-0x3f    
6024 3532      00065     db  0x32, 0x35      ; V1 Env Depth, V1 Env Curve
6026 3B38      00066     db  0x38, 0x3b      ; V1 Env Attack, V1 Env Decay
6028 413E      00067         db      0x3e, 0x41      ; V1 Env Sustain, V1 Env Release
602A 4A48      00068         db      0x48, 0x4a      ; V1 Wavetable Bank, V1 Wavetable Patch
602C 514E      00069         db      0x4e, 0x51      ; V1 Wavetable Rate, V1 Kit Bank
602E 4554      00070         db      0x54, 0x45      ; V1 Kit Patch, V1 Sofware Options
6030 5B58      00071         db      0x58, 0x5b      ; V1 Assigned Amplitude Mods, V1 Assigned Pitch Mods
6032 FFFF      00072         db      0xff, 0xff      ;
               00073     
               00074     ;; Voice 2 (AUD1)
               00075         ;; 0x40-0x4f
6034 180A      00076         db      0x0a, 0x18      ; V2 Volume, V2 Transpose
6036 1512      00077         db      0x12, 0x15      ; V2 Waveform, V2 Mode
6038 1E1B      00078         db      0x1b, 0x1e      ; V2 PitchRange, V2 Portamento
603A 2421      00079         db      0x21, 0x24      ; V2 Arp Rate, V2 Delay
603C 2A27      00080         db      0x27, 0x2a      ; V2 Key Offset, V2 Key Length
603E 9291      00081         db      0x91, 0x92      ; Split V2 Lower, Split V2 Upper
6040 062D      00082         db      0x2d, 0x06      ; V2 Velocity Assign, V2 Velocity Init Value
6042 300F      00083         db      0x0f, 0x30      ; V2 Velocity Depth, ENVAUD1 Options
               00084     ;; 0x50-0x5f    
6044 3633      00085     db  0x33, 0x36      ; V2 Env Depth, V2 Env Curve
6046 3C39      00086     db  0x39, 0x3c      ; V2 Env Attack, V2 Env Decay
6048 423F      00087         db      0x3f, 0x42      ; V2 Env Sustain, V2 Env Release
604A 4C49      00088         db      0x49, 0x4c      ; V2 Wavetable Bank, V2 Wavetable Patch
604C 524F      00089         db      0x4f, 0x52      ; V2 Wavetable Rate, V2 Kit Bank
604E 4655      00090         db      0x55, 0x46      ; V2 Kit Patch, V2 Sofware Options
6050 5C59      00091         db      0x59, 0x5c      ; V2 Assigned Amplitude Mods, V2 Assigned Pitch Mods
6052 FFFF      00092     db  0xff, 0xff      ;
               00093 
               00094         ;; 0x60-0x77
6054 615D      00095         db      0x5d, 0x61      ; LFO1 Mode, LFO1 Rate
6056 5E65      00096         db      0x65, 0x5e      ; LFO1 Depth, LFO2 Mode
6058 6662      00097         db      0x62, 0x66      ; LFO2 Rate, LFO2 Depth
605A 635F      00098         db      0x5f, 0x63      ; LFO3 Mode, LFO3 Rate
605C 6067      00099         db      0x67, 0x60      ; LFO3 Depth, LFO4 Mode
605E 6864      00100         db      0x64, 0x68      ; LFO4 Rate, LFO4 Depth
               00101     
6060 6B69      00102         db      0x69, 0x6b      ; ENV1 Depth, ENV1 Curve
6062 6F6D      00103         db      0x6d, 0x6f      ; ENV1 Attack, ENV1 Decay
6064 7371      00104         db      0x71, 0x73      ; ENV1 Sustain, ENV1 Release
6066 6C6A      00105         db      0x6a, 0x6c      ; ENV2 Depth, ENV2 Curve
6068 706E      00106         db      0x6e, 0x70      ; ENV2 Attack, ENV2 Decay
606A 7472      00107         db      0x72, 0x74      ; ENV2 Sustain, ENV2 Release
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 234


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00108 
               00109 
606C FFFF      00110         db      0xff, 0xff      ;
606E FFFF      00111         db      0xff, 0xff      ;
               00112     
6070 FFFF      00113         db      0xff, 0xff      ; CFG Reserved
6072 FFFF      00114         db      0xff, 0xff  ; CFG Reserved
               00115     
               00410 #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 ;; --------------------------------------------------------------------------
6074 00019 TIA_ENV_TABLE_Get
6074 90D8      00020         clrc
6076 34E8      00021         rlf     WREG, W
6078 0F92      00022         addlw   TIA_ENV_TABLE & 0xff
607A 6EF6      00023         movwf   TBLPTRL
607C 6AF7      00024         clrf    TBLPTRH
607E 0E60      00025         movlw   TIA_ENV_TABLE >> 8
6080 22F7      00026         addwfc  TBLPTRH, F
               00027 
6082 0009      00028         tblrd*+
6084 CFF5 F003 00029         movff   TABLAT, MIOS_PARAMETER1
6088 0009      00030         tblrd*+
608A CFF5 F004 00031         movff   TABLAT, MIOS_PARAMETER2
608E 5003      00032         movf    MIOS_PARAMETER1, W
6090 0012      00033         return
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 235


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 236


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 237


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 
6092 00165 TIA_ENV_TABLE
6092 FFFF      00166         db      0xff, 0xff      ; delay=0.0008
6094 FFFF      00167         db      0xff, 0xff      ; delay=0.0008
6096 CAC4      00168         db      0xc4, 0xca      ; delay=0.0010
6098 7CD9      00169         db      0xd9, 0x7c      ; delay=0.0016
609A 4C15      00170         db      0x15, 0x4c      ; delay=0.0027
609C 3129      00171         db      0x29, 0x31      ; delay=0.0042
609E 21C6      00172         db      0xc6, 0x21      ; delay=0.0061
60A0 1869      00173         db      0x69, 0x18      ; delay=0.0084
60A2 1261      00174         db      0x61, 0x12      ; delay=0.0111
60A4 0E4A      00175         db      0x4a, 0x0e      ; delay=0.0143
60A6 0B67      00176         db      0x67, 0x0b      ; delay=0.0180
60A8 094C      00177         db      0x4c, 0x09      ; delay=0.0220
60AA 07B7      00178         db      0xb7, 0x07      ; delay=0.0265
60AC 0680      00179         db      0x80, 0x06      ; delay=0.0315
60AE 058B      00180         db      0x8b, 0x05      ; delay=0.0369
60B0 04C8      00181         db      0xc8, 0x04      ; delay=0.0428
60B2 0429      00182         db      0x29, 0x04      ; delay=0.0492
60B4 03A7      00183         db      0xa7, 0x03      ; delay=0.0560
60B6 033B      00184         db      0x3b, 0x03      ; delay=0.0634
60B8 02E0      00185         db      0xe0, 0x02      ; delay=0.0712
60BA 0293      00186         db      0x93, 0x02      ; delay=0.0796
60BC 0250      00187         db      0x50, 0x02      ; delay=0.0884
60BE 0217      00188         db      0x17, 0x02      ; delay=0.0978
60C0 01E6      00189         db      0xe6, 0x01      ; delay=0.1078
60C2 01BB      00190         db      0xbb, 0x01      ; delay=0.1183
60C4 0195      00191         db      0x95, 0x01      ; delay=0.1294
60C6 0173      00192         db      0x73, 0x01      ; delay=0.1411
60C8 0155      00193         db      0x55, 0x01      ; delay=0.1533
60CA 013B      00194         db      0x3b, 0x01      ; delay=0.1662
60CC 0123      00195         db      0x23, 0x01      ; delay=0.1798
60CE 010E      00196         db      0x0e, 0x01      ; delay=0.1940
60D0 00FB      00197         db      0xfb, 0x00      ; delay=0.2088
60D2 00E9      00198         db      0xe9, 0x00      ; delay=0.2244
60D4 00D9      00199         db      0xd9, 0x00      ; delay=0.2407
60D6 00CB      00200         db      0xcb, 0x00      ; delay=0.2578
60D8 00BE      00201         db      0xbe, 0x00      ; delay=0.2756
60DA 00B2      00202         db      0xb2, 0x00      ; delay=0.2942
60DC 00A7      00203         db      0xa7, 0x00      ; delay=0.3136
60DE 009D      00204         db      0x9d, 0x00      ; delay=0.3339
60E0 0093      00205         db      0x93, 0x00      ; delay=0.3550
60E2 008B      00206         db      0x8b, 0x00      ; delay=0.3771
60E4 0083      00207         db      0x83, 0x00      ; delay=0.4001
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 238


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
60E6 007B      00208         db      0x7b, 0x00      ; delay=0.4241
60E8 0074      00209         db      0x74, 0x00      ; delay=0.4492
60EA 006E      00210         db      0x6e, 0x00      ; delay=0.4753
60EC 0068      00211         db      0x68, 0x00      ; delay=0.5024
60EE 0062      00212         db      0x62, 0x00      ; delay=0.5308
60F0 005D      00213         db      0x5d, 0x00      ; delay=0.5603
60F2 0058      00214         db      0x58, 0x00      ; delay=0.5910
60F4 0054      00215         db      0x54, 0x00      ; delay=0.6231
60F6 004F      00216         db      0x4f, 0x00      ; delay=0.6565
60F8 004B      00217         db      0x4b, 0x00      ; delay=0.6913
60FA 0048      00218         db      0x48, 0x00      ; delay=0.7275
60FC 0044      00219         db      0x44, 0x00      ; delay=0.7653
60FE 0041      00220         db      0x41, 0x00      ; delay=0.8046
6100 003E      00221         db      0x3e, 0x00      ; delay=0.8456
6102 003B      00222         db      0x3b, 0x00      ; delay=0.8883
6104 0038      00223         db      0x38, 0x00      ; delay=0.9328
6106 0035      00224         db      0x35, 0x00      ; delay=0.9792
6108 0033      00225         db      0x33, 0x00      ; delay=1.0276
610A 0030      00226         db      0x30, 0x00      ; delay=1.0780
610C 002E      00227         db      0x2e, 0x00      ; delay=1.1305
610E 002C      00228         db      0x2c, 0x00      ; delay=1.1854
6110 002A      00229         db      0x2a, 0x00      ; delay=1.2425
6112 0028      00230         db      0x28, 0x00      ; delay=1.3021
6114 0026      00231         db      0x26, 0x00      ; delay=1.3643
6116 0024      00232         db      0x24, 0x00      ; delay=1.4292
6118 0023      00233         db      0x23, 0x00      ; delay=1.4970
611A 0021      00234         db      0x21, 0x00      ; delay=1.5677
611C 001F      00235         db      0x1f, 0x00      ; delay=1.6415
611E 001E      00236         db      0x1e, 0x00      ; delay=1.7186
6120 001D      00237         db      0x1d, 0x00      ; delay=1.7991
6122 001B      00238         db      0x1b, 0x00      ; delay=1.8832
6124 001A      00239         db      0x1a, 0x00      ; delay=1.9710
6126 0019      00240         db      0x19, 0x00      ; delay=2.0629
6128 0018      00241         db      0x18, 0x00      ; delay=2.1589
612A 0017      00242         db      0x17, 0x00      ; delay=2.2592
612C 0016      00243         db      0x16, 0x00      ; delay=2.3642
612E 0015      00244         db      0x15, 0x00      ; delay=2.4740
6130 0014      00245         db      0x14, 0x00      ; delay=2.5890
6132 0013      00246         db      0x13, 0x00      ; delay=2.7092
6134 0012      00247         db      0x12, 0x00      ; delay=2.8352
6136 0011      00248         db      0x11, 0x00      ; delay=2.9670
6138 0010      00249         db      0x10, 0x00      ; delay=3.1051
613A 0010      00250         db      0x10, 0x00      ; delay=3.2498
613C 000F      00251         db      0x0f, 0x00      ; delay=3.4015
613E 000E      00252         db      0x0e, 0x00      ; delay=3.5605
6140 000E      00253         db      0x0e, 0x00      ; delay=3.7272
6142 000D      00254         db      0x0d, 0x00      ; delay=3.9020
6144 000C      00255         db      0x0c, 0x00      ; delay=4.0855
6146 000C      00256         db      0x0c, 0x00      ; delay=4.2781
6148 000B      00257         db      0x0b, 0x00      ; delay=4.4802
614A 000B      00258         db      0x0b, 0x00      ; delay=4.6925
614C 000A      00259         db      0x0a, 0x00      ; delay=4.9155
614E 000A      00260         db      0x0a, 0x00      ; delay=5.1498
6150 0009      00261         db      0x09, 0x00      ; delay=5.3961
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 239


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6152 0009      00262         db      0x09, 0x00      ; delay=5.6550
6154 0008      00263         db      0x08, 0x00      ; delay=5.9273
6156 0008      00264         db      0x08, 0x00      ; delay=6.2138
6158 0008      00265         db      0x08, 0x00      ; delay=6.5153
615A 0007      00266         db      0x07, 0x00      ; delay=6.8327
615C 0007      00267         db      0x07, 0x00      ; delay=7.1670
615E 0006      00268         db      0x06, 0x00      ; delay=7.5190
6160 0006      00269         db      0x06, 0x00      ; delay=7.8900
6162 0006      00270         db      0x06, 0x00      ; delay=8.2811
6164 0006      00271         db      0x06, 0x00      ; delay=8.6934
6166 0005      00272         db      0x05, 0x00      ; delay=9.1283
6168 0005      00273         db      0x05, 0x00      ; delay=9.5871
616A 0005      00274         db      0x05, 0x00      ; delay=10.0714
616C 0004      00275         db      0x04, 0x00      ; delay=10.5827
616E 0004      00276         db      0x04, 0x00      ; delay=11.1227
6170 0004      00277         db      0x04, 0x00      ; delay=11.6932
6172 0004      00278         db      0x04, 0x00      ; delay=12.2961
6174 0004      00279         db      0x04, 0x00      ; delay=12.9335
6176 0003      00280         db      0x03, 0x00      ; delay=13.6076
6178 0003      00281         db      0x03, 0x00      ; delay=14.3208
617A 0003      00282         db      0x03, 0x00      ; delay=15.0756
617C 0003      00283         db      0x03, 0x00      ; delay=15.8746
617E 0003      00284         db      0x03, 0x00      ; delay=16.7207
6180 0002      00285         db      0x02, 0x00      ; delay=17.6171
6182 0002      00286         db      0x02, 0x00      ; delay=18.5671
6184 0002      00287         db      0x02, 0x00      ; delay=19.5742
6186 0002      00288         db      0x02, 0x00      ; delay=20.6422
6188 0002      00289         db      0x02, 0x00      ; delay=21.7753
618A 0002      00290         db      0x02, 0x00      ; delay=22.9777
618C 0002      00291         db      0x02, 0x00      ; delay=24.2542
618E 0002      00292         db      0x02, 0x00      ; delay=25.6098
6190 0001      00293         db      0x01, 0x00      ; delay=27.0500
6192 0001      00294         db      0x01, 0x00      ; dummy
               00411 #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 ;
               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 ;; --------------------------------------------------------------------------
6194 00019 TIA_LFO_TABLE_Get
6194 90D8      00020         clrc
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 240


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6196 34E8      00021         rlf     WREG, W
6198 0FB0      00022         addlw   TIA_LFO_TABLE & 0xff
619A 6EF6      00023         movwf   TBLPTRL
619C 6AF7      00024         clrf    TBLPTRH
619E 0E61      00025         movlw   TIA_LFO_TABLE >> 8
61A0 22F7      00026         addwfc  TBLPTRH, F
               00027 
61A2 0009      00028         tblrd*+
61A4 CFF5 F004 00029         movff   TABLAT, MIOS_PARAMETER2 ; -> ADD value
61A8 0009      00030         tblrd*+
61AA 50F5      00031         movf    TABLAT, W
61AC 6E03      00032         movwf   MIOS_PARAMETER1         ; -> CTR value
61AE 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
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 241


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 242


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 
61B0 00165 TIA_LFO_TABLE
61B0 FF01      00166         db      0x01, 0xff      ; ADD/CTR for frq=  0.00
61B2 FF01      00167         db      0x01, 0xff      ; ADD/CTR for frq=  0.00
61B4 4D01      00168         db      0x01, 0x4d      ; ADD/CTR for frq=  0.03
61B6 2601      00169         db      0x01, 0x26      ; ADD/CTR for frq=  0.06
61B8 1901      00170         db      0x01, 0x19      ; ADD/CTR for frq=  0.10
61BA 1301      00171         db      0x01, 0x13      ; ADD/CTR for frq=  0.13
61BC 0F01      00172         db      0x01, 0x0f      ; ADD/CTR for frq=  0.16
61BE 0C01      00173         db      0x01, 0x0c      ; ADD/CTR for frq=  0.20
61C0 1502      00174         db      0x02, 0x15      ; ADD/CTR for frq=  0.23
61C2 0901      00175         db      0x01, 0x09      ; ADD/CTR for frq=  0.27
61C4 1703      00176         db      0x03, 0x17      ; ADD/CTR for frq=  0.32
61C6 0701      00177         db      0x01, 0x07      ; ADD/CTR for frq=  0.35
61C8 0601      00178         db      0x01, 0x06      ; ADD/CTR for frq=  0.41
61CA 0B02      00179         db      0x02, 0x0b      ; ADD/CTR for frq=  0.44
61CC 0501      00180         db      0x01, 0x05      ; ADD/CTR for frq=  0.49
61CE 0902      00181         db      0x02, 0x09      ; ADD/CTR for frq=  0.54
61D0 1104      00182         db      0x04, 0x11      ; ADD/CTR for frq=  0.57
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 243


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
61D2 1305      00183         db      0x05, 0x13      ; ADD/CTR for frq=  0.64
61D4 0B03      00184         db      0x03, 0x0b      ; ADD/CTR for frq=  0.67
61D6 0A03      00185         db      0x03, 0x0a      ; ADD/CTR for frq=  0.73
61D8 1306      00186         db      0x06, 0x13      ; ADD/CTR for frq=  0.77
61DA 1407      00187         db      0x07, 0x14      ; ADD/CTR for frq=  0.85
61DC 0803      00188         db      0x03, 0x08      ; ADD/CTR for frq=  0.92
61DE 0502      00189         db      0x02, 0x05      ; ADD/CTR for frq=  0.98
61E0 0C05      00190         db      0x05, 0x0c      ; ADD/CTR for frq=  1.02
61E2 0904      00191         db      0x04, 0x09      ; ADD/CTR for frq=  1.09
61E4 0D06      00192         db      0x06, 0x0d      ; ADD/CTR for frq=  1.13
61E6 0201      00193         db      0x01, 0x02      ; ADD/CTR for frq=  1.22
61E8 0F08      00194         db      0x08, 0x0f      ; ADD/CTR for frq=  1.30
61EA 0905      00195         db      0x05, 0x09      ; ADD/CTR for frq=  1.36
61EC 0704      00196         db      0x04, 0x07      ; ADD/CTR for frq=  1.40
61EE 0503      00197         db      0x03, 0x05      ; ADD/CTR for frq=  1.46
61F0 0B07      00198         db      0x07, 0x0b      ; ADD/CTR for frq=  1.55
61F2 0302      00199         db      0x02, 0x03      ; ADD/CTR for frq=  1.63
61F4 0705      00200         db      0x05, 0x07      ; ADD/CTR for frq=  1.74
61F6 0403      00201         db      0x03, 0x04      ; ADD/CTR for frq=  1.83
61F8 0504      00202         db      0x04, 0x05      ; ADD/CTR for frq=  1.95
61FA 0504      00203         db      0x04, 0x05      ; ADD/CTR for frq=  1.95
61FC 0706      00204         db      0x06, 0x07      ; ADD/CTR for frq=  2.09
61FE 0807      00205         db      0x07, 0x08      ; ADD/CTR for frq=  2.14
6200 0C0B      00206         db      0x0b, 0x0c      ; ADD/CTR for frq=  2.24
6202 0101      00207         db      0x01, 0x01      ; ADD/CTR for frq=  2.44
6204 0101      00208         db      0x01, 0x01      ; ADD/CTR for frq=  2.44
6206 0B0C      00209         db      0x0c, 0x0b      ; ADD/CTR for frq=  2.66
6208 0809      00210         db      0x09, 0x08      ; ADD/CTR for frq=  2.75
620A 0607      00211         db      0x07, 0x06      ; ADD/CTR for frq=  2.85
620C 0506      00212         db      0x06, 0x05      ; ADD/CTR for frq=  2.93
620E 0405      00213         db      0x05, 0x04      ; ADD/CTR for frq=  3.05
6210 0304      00214         db      0x04, 0x03      ; ADD/CTR for frq=  3.26
6212 0304      00215         db      0x04, 0x03      ; ADD/CTR for frq=  3.26
6214 0507      00216         db      0x07, 0x05      ; ADD/CTR for frq=  3.42
6216 0203      00217         db      0x03, 0x02      ; ADD/CTR for frq=  3.66
6218 0203      00218         db      0x03, 0x02      ; ADD/CTR for frq=  3.66
621A 0508      00219         db      0x08, 0x05      ; ADD/CTR for frq=  3.91
621C 0305      00220         db      0x05, 0x03      ; ADD/CTR for frq=  4.07
621E 0407      00221         db      0x07, 0x04      ; ADD/CTR for frq=  4.27
6220 0407      00222         db      0x07, 0x04      ; ADD/CTR for frq=  4.27
6222 060B      00223         db      0x0b, 0x06      ; ADD/CTR for frq=  4.48
6224 080F      00224         db      0x0f, 0x08      ; ADD/CTR for frq=  4.58
6226 0102      00225         db      0x02, 0x01      ; ADD/CTR for frq=  4.88
6228 0913      00226         db      0x13, 0x09      ; ADD/CTR for frq=  5.15
622A 060D      00227         db      0x0d, 0x06      ; ADD/CTR for frq=  5.29
622C 0409      00228         db      0x09, 0x04      ; ADD/CTR for frq=  5.49
622E 0307      00229         db      0x07, 0x03      ; ADD/CTR for frq=  5.70
6230 0307      00230         db      0x07, 0x03      ; ADD/CTR for frq=  5.70
6232 0205      00231         db      0x05, 0x02      ; ADD/CTR for frq=  6.10
6234 050D      00232         db      0x0d, 0x05      ; ADD/CTR for frq=  6.35
6236 0308      00233         db      0x08, 0x03      ; ADD/CTR for frq=  6.51
6238 040B      00234         db      0x0b, 0x04      ; ADD/CTR for frq=  6.71
623A 050E      00235         db      0x0e, 0x05      ; ADD/CTR for frq=  6.84
623C 0103      00236         db      0x03, 0x01      ; ADD/CTR for frq=  7.32
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 244


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
623E 0103      00237         db      0x03, 0x01      ; ADD/CTR for frq=  7.32
6240 0510      00238         db      0x10, 0x05      ; ADD/CTR for frq=  7.81
6242 030A      00239         db      0x0a, 0x03      ; ADD/CTR for frq=  8.14
6244 030A      00240         db      0x0a, 0x03      ; ADD/CTR for frq=  8.14
6246 0207      00241         db      0x07, 0x02      ; ADD/CTR for frq=  8.54
6248 030B      00242         db      0x0b, 0x03      ; ADD/CTR for frq=  8.95
624A 030B      00243         db      0x0b, 0x03      ; ADD/CTR for frq=  8.95
624C 0513      00244         db      0x13, 0x05      ; ADD/CTR for frq=  9.28
624E 0104      00245         db      0x04, 0x01      ; ADD/CTR for frq=  9.77
6250 0411      00246         db      0x11, 0x04      ; ADD/CTR for frq= 10.38
6252 030D      00247         db      0x0d, 0x03      ; ADD/CTR for frq= 10.58
6254 0209      00248         db      0x09, 0x02      ; ADD/CTR for frq= 10.99
6256 0209      00249         db      0x09, 0x02      ; ADD/CTR for frq= 10.99
6258 030E      00250         db      0x0e, 0x03      ; ADD/CTR for frq= 11.39
625A 0105      00251         db      0x05, 0x01      ; ADD/CTR for frq= 12.21
625C 0105      00252         db      0x05, 0x01      ; ADD/CTR for frq= 12.21
625E 0310      00253         db      0x10, 0x03      ; ADD/CTR for frq= 13.02
6260 020B      00254         db      0x0b, 0x02      ; ADD/CTR for frq= 13.43
6262 020B      00255         db      0x0b, 0x02      ; ADD/CTR for frq= 13.43
6264 0311      00256         db      0x11, 0x03      ; ADD/CTR for frq= 13.83
6266 0106      00257         db      0x06, 0x01      ; ADD/CTR for frq= 14.65
6268 0419      00258         db      0x19, 0x04      ; ADD/CTR for frq= 15.26
626A 020D      00259         db      0x0d, 0x02      ; ADD/CTR for frq= 15.87
626C 020D      00260         db      0x0d, 0x02      ; ADD/CTR for frq= 15.87
626E 0314      00261         db      0x14, 0x03      ; ADD/CTR for frq= 16.28
6270 0107      00262         db      0x07, 0x01      ; ADD/CTR for frq= 17.09
6272 0316      00263         db      0x16, 0x03      ; ADD/CTR for frq= 17.90
6274 020F      00264         db      0x0f, 0x02      ; ADD/CTR for frq= 18.31
6276 0317      00265         db      0x17, 0x03      ; ADD/CTR for frq= 18.72
6278 0108      00266         db      0x08, 0x01      ; ADD/CTR for frq= 19.53
627A 0319      00267         db      0x19, 0x03      ; ADD/CTR for frq= 20.35
627C 0211      00268         db      0x11, 0x02      ; ADD/CTR for frq= 20.75
627E 0109      00269         db      0x09, 0x01      ; ADD/CTR for frq= 21.97
6280 0109      00270         db      0x09, 0x01      ; ADD/CTR for frq= 21.97
6282 0213      00271         db      0x13, 0x02      ; ADD/CTR for frq= 23.19
6284 0213      00272         db      0x13, 0x02      ; ADD/CTR for frq= 23.19
6286 010A      00273         db      0x0a, 0x01      ; ADD/CTR for frq= 24.41
6288 0215      00274         db      0x15, 0x02      ; ADD/CTR for frq= 25.63
628A 0215      00275         db      0x15, 0x02      ; ADD/CTR for frq= 25.63
628C 010B      00276         db      0x0b, 0x01      ; ADD/CTR for frq= 26.86
628E 0217      00277         db      0x17, 0x02      ; ADD/CTR for frq= 28.08
6290 0217      00278         db      0x17, 0x02      ; ADD/CTR for frq= 28.08
6292 010C      00279         db      0x0c, 0x01      ; ADD/CTR for frq= 29.30
6294 0219      00280         db      0x19, 0x02      ; ADD/CTR for frq= 30.52
6296 010D      00281         db      0x0d, 0x01      ; ADD/CTR for frq= 31.74
6298 010D      00282         db      0x0d, 0x01      ; ADD/CTR for frq= 31.74
629A 010E      00283         db      0x0e, 0x01      ; ADD/CTR for frq= 34.18
629C 010E      00284         db      0x0e, 0x01      ; ADD/CTR for frq= 34.18
629E 021D      00285         db      0x1d, 0x02      ; ADD/CTR for frq= 35.40
62A0 010F      00286         db      0x0f, 0x01      ; ADD/CTR for frq= 36.62
62A2 021F      00287         db      0x1f, 0x02      ; ADD/CTR for frq= 37.84
62A4 0110      00288         db      0x10, 0x01      ; ADD/CTR for frq= 39.06
62A6 0221      00289         db      0x21, 0x02      ; ADD/CTR for frq= 40.28
62A8 0111      00290         db      0x11, 0x01      ; ADD/CTR for frq= 41.50
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 245


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
62AA 0112      00291         db      0x12, 0x01      ; ADD/CTR for frq= 43.95
62AC 0112      00292         db      0x12, 0x01      ; ADD/CTR for frq= 43.95
62AE 0113      00293         db      0x13, 0x01      ; ADD/CTR for frq= 46.39
62B0 0113      00294         db      0x13, 0x01      ; dummy
               00412 #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 ; ==========================================================================
               00012 
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  FUNCTION: DEBUG_MSG_SendHeader
               00016 ;;  DESCRIPTION: sends the SysEx header
               00017 ;;  IN:   -
               00018 ;;  OUT:  -
               00019 ;;  USES: BSR, FSR1
               00020 ;; --------------------------------------------------------------------------
62B2 00021 _DEBUG_MSG_SendHeader   ; for C
62B2 00022 DEBUG_MSG_SendHeader
               00023         ;; this SysEx command will be parsed by MIOS Terminal to print out text messages
62B2 0EF0      00024         movlw   0xf0
62B4 EC24 F016 00025         call    MIOS_MIDI_TxBufferPut
62B8 0E00      00026         movlw   0x00
62BA EC24 F016 00027         call    MIOS_MIDI_TxBufferPut
62BE 0E00      00028         movlw   0x00
62C0 EC24 F016 00029         call    MIOS_MIDI_TxBufferPut
62C4 0E7E      00030         movlw   0x7e
62C6 EC24 F016 00031         call    MIOS_MIDI_TxBufferPut
62CA 0E32      00032         movlw   0x32
62CC EC24 F016 00033         call    MIOS_MIDI_TxBufferPut
62D0 EC04 F016 00034         call    MIOS_MIDI_DeviceIDGet
62D4 EC24 F016 00035         call    MIOS_MIDI_TxBufferPut
62D8 0E0D      00036         movlw   0x0d
62DA EC24 F016 00037         call    MIOS_MIDI_TxBufferPut
62DE 0E40      00038         movlw   0x40
62E0 EC24 F016 00039         call    MIOS_MIDI_TxBufferPut
               00040 
               00041         ;; following characters will be print on terminal
62E4 0012      00042         return
               00043 
               00044 
               00045 ;; --------------------------------------------------------------------------
               00046 ;;  FUNCTION: DEBUG_MSG_SendFooter
               00047 ;;  DESCRIPTION: sends the SysEx footer
               00048 ;;  IN:   -
               00049 ;;  OUT:  -
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 246


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00050 ;;  USES: BSR, FSR1
               00051 ;; --------------------------------------------------------------------------
62E6 00052 _DEBUG_MSG_SendFooter   ; for C
62E6 00053 DEBUG_MSG_SendFooter
               00054         ;; finish SysEx stream - MIOS Terminal will print the received characters now
62E6 0EF7      00055         movlw   0xf7
62E8 EC24 F016 00056         call    MIOS_MIDI_TxBufferPut
62EC 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
               00066 ;; --------------------------------------------------------------------------
62EE 00067 _DEBUG_MSG_SendChar     ; for C
62EE 00068 DEBUG_MSG_SendChar
62EE 0B7F      00069         andlw   0x7f    ; ensure that MSB is cleared, otherwise we would violate the MIDI protocol
62F0 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 ;; --------------------------------------------------------------------------
62F4 00081 DEBUG_MSG_SendASMString
               00082         ;; we expect that the zero-terminated string is located behind the "call" instruction
               00083         ;; transfer pointer to TBLPTR[LHU]
62F4 CFFD FFF6 00084         movff   TOSL, TBLPTRL
62F8 CFFE FFF7 00085         movff   TOSH, TBLPTRH
62FC CFFF FFF8 00086         movff   TOSU, TBLPTRU
               00087 
               00088         ;; print until zero is read
6300 00089 DEBUG_MSG_SendASMStringLoop
6300 0009      00090         tblrd*+
6302 50F5      00091         movf    TABLAT, W
6304 E002      00092         bz      DEBUG_MSG_SendASMStringLoop_End
6306 DFF3      00093         rcall   DEBUG_MSG_SendChar
               00094         rgoto   DEBUG_MSG_SendASMStringLoop
6308 D7FB          M         bra     label
630A 00095 DEBUG_MSG_SendASMStringLoop_End
               00096 
               00097         ;; return pointer now in TBLPTR[LH]
               00098 
               00099         ;; ensure that it is aligned to next instruction
630A 50F6      00100         movf    TBLPTRL, W
630C 0B01      00101         andlw   0x01
630E E005      00102         bz      DEBUG_MSG_SendASMString_NoIAlign
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 247


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6310 2AF6      00103         incf    TBLPTRL, F
6312 B4D8      00104         skpnz
6314 2AF7      00105         incf    TBLPTRH, F
6316 B4D8      00106         skpnz
6318 2AF8      00107         incf    TBLPTRU, F
631A 00108 DEBUG_MSG_SendASMString_NoIAlign
               00109 
               00110         IRQ_DISABLE
631A 9EF2          M         bcf     INTCON, GIE
631C 50F6      00111         movf    TBLPTRL, W
631E 6EFD      00112         movwf   TOSL
6320 50F7      00113         movf    TBLPTRH, W
6322 6EFE      00114         movwf   TOSH
6324 50F8      00115         movf    TBLPTRU, W
6326 6EFF      00116         movwf   TOSU
               00117         IRQ_ENABLE
6328 8EF2          M         bsf     INTCON, GIE
632A 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 ;; --------------------------------------------------------------------------
632C 00135 _DEBUG_MSG_SendBCD1     ; for C
632C 00136 DEBUG_MSG_SendBCD1
632C 00137 _DEBUG_MSG_SendHex1     ; for C
632C 00138 DEBUG_MSG_SendHex1
632C 0B0F      00139         andlw   0x0f
632E 0FF6      00140         addlw   -0x0a
6330 B0D8      00141         skpnc
6332 0F07      00142         addlw   0x07
6334 0F3A      00143         addlw   0x3a
               00144         rgoto   DEBUG_MSG_SendChar
6336 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 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 248


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6338 00154 _DEBUG_MSG_SendHex2     ; for C
6338 00155 DEBUG_MSG_SendHex2
6338 6EF3      00156         movwf   PRODL
633A 38F3      00157         swapf   PRODL, W
633C DFF7      00158         rcall   DEBUG_MSG_SendBCD1
633E 50F3      00159         movf    PRODL, W
               00160         rgoto   DEBUG_MSG_SendBCD1
6340 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
               00169 ;; --------------------------------------------------------------------------
6342 00170 _DEBUG_MSG_SendBCD2     ; for C
6342 00171 DEBUG_MSG_SendBCD2
6342 6A03      00172         clrf    MIOS_PARAMETER1
6344 ECF4 F016 00173         call    MIOS_HLP_Dec2BCD
               00174         rgoto   DEBUG_MSG_SendBCD2_Cont
6348 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 ;; --------------------------------------------------------------------------
634A 00183 _DEBUG_MSG_SendBCD3     ; for C
634A 00184 DEBUG_MSG_SendBCD3
634A 6A03      00185         clrf    MIOS_PARAMETER1
634C ECF4 F016 00186         call    MIOS_HLP_Dec2BCD
               00187         rgoto   DEBUG_MSG_SendBCD3_Cont
6350 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
6352 00198 DEBUG_MSG_SendBCD4
6352 ECF4 F016 00199         call    MIOS_HLP_Dec2BCD
               00200         rgoto   DEBUG_MSG_SendBCD4_Cont
6356 D007          M         bra     label
               00201 
               00202 ;; --------------------------------------------------------------------------
               00203 ;;  FUNCTION: DEBUG_MSG_SendBCD5
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 249


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
6358 00211 DEBUG_MSG_SendBCD5
6358 ECF4 F016 00212         call    MIOS_HLP_Dec2BCD
               00213 
               00214 ;; -----------------
635C 00215 DEBUG_MSG_SendBCD5_Cont
635C 5005      00216         movf    MIOS_PARAMETER3, W
635E 0B0F      00217         andlw   0x0f
6360 E112      00218         bnz     DEBUG_MSG_SendBCD_D5
               00219 
6362 0E20      00220         movlw   ' '
6364 DFC4      00221         rcall   DEBUG_MSG_SendChar
               00222 
6366 00223 DEBUG_MSG_SendBCD4_Cont
6366 3804      00224         swapf   MIOS_PARAMETER2, W
6368 0B0F      00225         andlw   0x0f
636A E10E      00226         bnz     DEBUG_MSG_SendBCD_D4
               00227 
636C 0E20      00228         movlw   ' '
636E DFBF      00229         rcall   DEBUG_MSG_SendChar
               00230 
6370 00231 DEBUG_MSG_SendBCD3_Cont
6370 5004      00232         movf    MIOS_PARAMETER2, W
6372 0B0F      00233         andlw   0x0f
6374 E10B      00234         bnz     DEBUG_MSG_SendBCD_D3
               00235 
6376 0E20      00236         movlw   ' '
6378 DFBA      00237         rcall   DEBUG_MSG_SendChar
               00238 
637A 00239 DEBUG_MSG_SendBCD2_Cont
637A 3803      00240         swapf   MIOS_PARAMETER1, W
637C 0B0F      00241         andlw   0x0f
637E E108      00242         bnz     DEBUG_MSG_SendBCD_D2
               00243 
6380 0E20      00244         movlw   ' '
6382 DFB5      00245         rcall   DEBUG_MSG_SendChar
               00246 
6384 00247 DEBUG_MSG_SendBCD1_Cont
               00248         rgoto   DEBUG_MSG_SendBCD_D1
6384 D007          M         bra     label
               00249         
               00250 
               00251         ;; ---
6386 00252 DEBUG_MSG_SendBCD_D5
6386 DFD2      00253         rcall   DEBUG_MSG_SendBCD1
6388 00254 DEBUG_MSG_SendBCD_D4
6388 3804      00255         swapf   MIOS_PARAMETER2, W
638A DFD0      00256         rcall   DEBUG_MSG_SendBCD1
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 250


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
638C 00257 DEBUG_MSG_SendBCD_D3
638C 5004      00258         movf    MIOS_PARAMETER2, W
638E DFCE      00259         rcall   DEBUG_MSG_SendBCD1
6390 00260 DEBUG_MSG_SendBCD_D2
6390 3803      00261         swapf   MIOS_PARAMETER1, W
6392 DFCC      00262         rcall   DEBUG_MSG_SendBCD1
6394 00263 DEBUG_MSG_SendBCD_D1
6394 5003      00264         movf    MIOS_PARAMETER1, W
               00265         rgoto   DEBUG_MSG_SendBCD1
6396 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!
               00272 ;;  C_IN: Pointer to 0-terminated String in <str>
               00273 ;;  USES: BSR, FSR1
               00274 ;; --------------------------------------------------------------------------
               00413 ;; these three tables are now included from the mios_tables.inc file
               00414 ;; to save code space
               00415         ;; #include "tia_frq_table.inc"
               00416         ;; #include "tia_sin_table.inc"
               00417         ;; #include "tia_depth_table.inc"
               00418 
               00419 
               00420 ;; ---[ TIA EEPROM content ]---
               00421 #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(Internal) Patch Preset
               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_base.asm9-22-2013  23:38:17          PAGE 251


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_Vx_ENV_CURVES                        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_base.asm9-22-2013  23:38:17          PAGE 252


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F00036 00056 EEPROM_PATCH_VOICE1_ENV_RELEASE                   ;de 0x00        ;; 0x35
F00036 0000      00057 EEPROM_PATCH_VOICE1_WBANK                         de 0x00, 0x00 ;; 0x36
F00038 00058 EEPROM_PATCH_VOICE1_WT                            ;de 0x00        ;; 0x37
F00038 0000      00059 EEPROM_PATCH_VOICE1_WT_RATE                       de 0x00, 0x00   ;; 0x38
F0003A 00060 EEPROM_PATCH_VOICE1_KBANK                         ;de 0x00        ;; 0x39
F0003A 0000      00061 EEPROM_PATCH_VOICE1_KIT                           de 0x00, 0x00 ;; 0x3a
F0003C 00062 EEPROM_PATCH_VOICE1_OPTIONS                       ;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_WBANK                         de 0x00, 0x00 ;; 0x56
F00058 00091 EEPROM_PATCH_VOICE2_WT                            ;de 0x00        ;; 0x57
F00058 0000      00092 EEPROM_PATCH_VOICE2_WT_RATE                       de 0x00, 0x00   ;; 0x58
F0005A 00093 EEPROM_PATCH_VOICE2_KBANK                         ;de 0x00        ;; 0x59
F0005A 0000      00094 EEPROM_PATCH_VOICE2_KIT                           de 0x00, 0x00 ;; 0x5a
F0005C 0000      00095 EEPROM_PATCH_VOICE2_OPTIONS                       de 0x00        ;; 0x5b
F0005E 0000      00096 EEPROM_PATCH_VOICE2_MOD2AMP                       de 0x00, 0x00 ;; 0x5c
F00060 00097 EEPROM_PATCH_VOICE2_MOD2PITCH                     ;de 0x00        ;; 0x5d
F00060 0000      00098 EEPROM_PATCH_VOICE2_FREE2                         de 0x00, 0x00 ;; 0x5e
F00062 00099 EEPROM_PATCH_VOICE2_FREE3                         ;de 0x00        ;; 0x5f
               00100 
F00062 1007      00101 EEPROM_PATCH_LFO1_MODE                            de 0x07, 0x10 ;; 0x60
F00064 00102 EEPROM_PATCH_LFO1_RATE                            ;de 0x10        ;; 0x61
F00064 077F      00103 EEPROM_PATCH_LFO1_DEPTH                           de 0x7f, 0x07 ;; 0x62
F00066 00104 EEPROM_PATCH_LFO2_MODE                            ;de 0x07        ;; 0x63
F00066 0020      00105 EEPROM_PATCH_LFO2_RATE                            de 0x20, 0x00 ;; 0x64
F00068 00106 EEPROM_PATCH_LFO2_DEPTH                           ;de 0x00        ;; 0x65
F00068 0301      00107 EEPROM_PATCH_LFO3_MODE                            de 0x01, 0x03 ;; 0x66
F0006A 00108 EEPROM_PATCH_LFO3_RATE                            ;de 0x03        ;; 0x67
F0006A 017F      00109 EEPROM_PATCH_LFO3_DEPTH                           de 0x7f, 0x01 ;; 0x68
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 253


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F0006C 00110 EEPROM_PATCH_LFO4_MODE                            ;de 0x01        ;; 0x69
F0006C 0040      00111 EEPROM_PATCH_LFO4_RATE                            de 0x40, 0x00 ;; 0x6a
F0006E 00112 EEPROM_PATCH_LFO4_DEPTH                           ;de 0x00        ;; 0x6b
               00113 
F0006E 407F      00114 EEPROM_PATCH_ENV1_DEPTH                           de 0x7f, 0x40 ;; 0x6c 
F00070 00115 EEPROM_PATCH_ENV1_CURVE                           ;de 0x40        ;; 0x6d
F00070 4040      00116 EEPROM_PATCH_ENV1_ATTACK                          de 0x40, 0x40   ;; 0x6e
F00072 00117 EEPROM_PATCH_ENV1_DECAY                           ;de 0x40        ;; 0x6f
F00072 4040      00118 EEPROM_PATCH_ENV1_SUSTAIN                         de 0x40, 0x40 ;; 0x70
F00074 00119 EEPROM_PATCH_ENV1_RELEASE                         ;de 0x40        ;; 0x71
F00074 4000      00120 EEPROM_PATCH_ENV2_DEPTH                           de 0x00, 0x40   ;; 0x72
F00076 00121 EEPROM_PATCH_ENV2_CURVE                           ;de 0x40        ;; 0x73
F00076 6060      00122 EEPROM_PATCH_ENV2_ATTACK                          de 0x60, 0x60 ;; 0x74
F00078 00123 EEPROM_PATCH_ENV2_DECAY                           ;de 0x60        ;; 0x75
F00078 4020      00124 EEPROM_PATCH_ENV2_SUSTAIN                         de 0x20, 0x40 ;; 0x76
F0007A 00125 EEPROM_PATCH_ENV2_RELEASE                         ;de 0x40        ;; 0x77
               00126 
F0007A 0000      00127 EEPROM_PATCH_FREE5                                de 0x00, 0x00 ;; 0x78
F0007C 00128 EEPROM_PATCH_FREE6                                ;de 0x00        ;; 0x79
F0007C 0000      00129 EEPROM_PATCH_FREE7                                de 0x00, 0x00 ;; 0x7a
F0007E 00130 EEPROM_PATCH_FREE8                                ;de 0x00        ;; 0x7b
               00131 
F0007E 00132 EEPROM_CFG_BASE
F0007E 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
F00080 00134 EEPROM_PATCH_V1_CHANNEL                           ;de 0         ;; 0x7d - can only be written with CFG command
F00080 0000      00135 EEPROM_PATCH_DEVICE                               de DEFAULT_DEVICE_ID, 0x00  ;; 0x7e - can only be written with CFG command
F00082 00136 EEPROM_PATCH_CFG_FREE                             ;de 0x00      ;; 0x7f - can only be written with CFG command
               00137 
               00023 
               00024 ;; ==========================================================================
               00025 ;; Default(Internal) Wavetable Preset
               00026 ;; ==========================================================================
F00100           00027         org     0xf00100
F00100 00028 EEPROM_WAVETABLE
               00029 #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 ; ==========================================================================
F00100 00013 EEPROM_WT_PRESETNAME
F00100 6E49 2E74 00014         de  'I','n','t','.',' ','W','a','v','e','t','a','b','l','e',' ','2'
     5720 7661 
     7465 6261 
     656C 3220 
F00110 00015 EEPROM_WT_FREE
F00110 6406 6579 00016     de  0x06, 100, 121, 101, 0, 0, 0, 0
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 254


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     0000 0000 
F00118 00017 EEPROM_WT_STEPCMD
F00118 0000 0000 00018         de      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
     0000 0000 
F00120 00019 EEPROM_WT_STEPDATA
               00020 ;;Steps:1  2  2  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32     ;;
F00120 0000 0000 00021     de  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0      ;; P1
     0000 0000 
     0000 0000 
     0000 0000 
     0006 0000 
     0000 0000 
     0000 0000 
     0000 0000 
F00140 0000 0000 00022     de  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0      ;; P2
     0000 0000 
     0000 0000 
     0000 0000 
     0000 0000 
     0000 0000 
     0000 0000 
     0000 0000 
F00160 0000 0000 00023     de  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0      ;; P3
     0000 0000 
     0000 0000 
     0000 0000 
     0000 0000 
     0000 0000 
     0000 0000 
     0000 0000 
               00030 
               00031 ;; ==========================================================================
               00032 ;; Default(Internal) Kit Preset
               00033 ;; ==========================================================================
F00200           00034         org     0xf00200
F00200 00035 EEPROM_KIT
               00036 #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 ; ==========================================================================
F00200 6E49 6574 00013         de  'I','n','t','e','r','n','a','l',' ','K','i','t',' ',' ',' ',' '
     6E72 6C61 
     4B20 7469 
     2020 2020 
F00210 0000      00014 EEPROM_KIT_WAVETABLE_1                        de 0x00, 0x00   ;; 0x10
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 255


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F00212 0000      00015 EEPROM_KIT_WT_RATE_1                              de 0x00, 0x00   ;; 0x10
F00214 00016 EEPROM_KIT_ENVx_CURVE_1                           ;de 0x40        ;; 0x73
F00214 6060      00017 EEPROM_KIT_ENVx_ATTACK_1                          de 0x60, 0x60 ;; 0x74
F00216 00018 EEPROM_KIT_ENVx_DECAY_1                           ;de 0x60        ;; 0x75
F00216 4020      00019 EEPROM_KIT_ENVx_SUSTAIN_1                         de 0x20, 0x40 ;; 0x76
F00218 00020 EEPROM_KIT_ENVx_RELEASE_1                         ;de 0x40        ;; 0x77
               00021 
F00218 007F      00022 EEPROM_KIT_WAVETABLE_2                        de 0x7f, 0x00   ;; 0x10
F0021A 0000      00023 EEPROM_KIT_WT_RATE_2                              de 0x00, 0x00   ;; 0x10
F0021C 00024 EEPROM_KIT_ENVx_CURVE_2                           ;de 0x40        ;; 0x73
F0021C 6060      00025 EEPROM_KIT_ENVx_ATTACK_2                          de 0x60, 0x60 ;; 0x74
F0021E 00026 EEPROM_KIT_ENVx_DECAY_2                           ;de 0x60        ;; 0x75
F0021E 4020      00027 EEPROM_KIT_ENVx_SUSTAIN_2                         de 0x20, 0x40 ;; 0x76
F00220 00028 EEPROM_KIT_ENVx_RELEASE_2                         ;de 0x40        ;; 0x77
               00029 
F00220 007F      00030 EEPROM_KIT_WAVETABLE_3                        de 0x7f, 0x00   ;; 0x10
F00222 0000      00031 EEPROM_KIT_WT_RATE_3                              de 0x00, 0x00   ;; 0x10
F00224 00032 EEPROM_KIT_ENVx_CURVE_3                           ;de 0x40        ;; 0x73
F00224 6060      00033 EEPROM_KIT_ENVx_ATTACK_3                          de 0x60, 0x60 ;; 0x74
F00226 00034 EEPROM_KIT_ENVx_DECAY_3                           ;de 0x60        ;; 0x75
F00226 4020      00035 EEPROM_KIT_ENVx_SUSTAIN_3                         de 0x20, 0x40 ;; 0x76
F00228 00036 EEPROM_KIT_ENVx_RELEASE_3                         ;de 0x40        ;; 0x77
               00037 
F00228 007F      00038 EEPROM_KIT_WAVETABLE_4                        de 0x7f, 0x00   ;; 0x10
F0022A 0000      00039 EEPROM_KIT_WT_RATE_4                              de 0x00, 0x00   ;; 0x10
F0022C 00040 EEPROM_KIT_ENVx_CURVE_4                           ;de 0x40        ;; 0x73
F0022C 6060      00041 EEPROM_KIT_ENVx_ATTACK_4                          de 0x60, 0x60 ;; 0x74
F0022E 00042 EEPROM_KIT_ENVx_DECAY_4                           ;de 0x60        ;; 0x75
F0022E 4020      00043 EEPROM_KIT_ENVx_SUSTAIN_4                         de 0x20, 0x40 ;; 0x76
F00230 00044 EEPROM_KIT_ENVx_RELEASE_4                         ;de 0x40        ;; 0x77
               00045 
F00230 007F      00046 EEPROM_KIT_WAVETABLE_5                        de 0x7f, 0x00   ;; 0x10
F00232 0000      00047 EEPROM_KIT_WT_RATE_5                              de 0x00, 0x00   ;; 0x10
F00234 00048 EEPROM_KIT_ENVx_CURVE_5                           ;de 0x40        ;; 0x73
F00234 6060      00049 EEPROM_KIT_ENVx_ATTACK_5                          de 0x60, 0x60 ;; 0x74
F00236 00050 EEPROM_KIT_ENVx_DECAY_5                           ;de 0x60        ;; 0x75
F00236 4020      00051 EEPROM_KIT_ENVx_SUSTAIN_5                         de 0x20, 0x40 ;; 0x76
F00238 00052 EEPROM_KIT_ENVx_RELEASE_5                         ;de 0x40        ;; 0x77
               00053 
F00238 007F      00054 EEPROM_KIT_WAVETABLE_6                        de 0x7f, 0x00   ;; 0x10
F0023A 0000      00055 EEPROM_KIT_WT_RATE_6                              de 0x00, 0x00   ;; 0x10
F0023C 00056 EEPROM_KIT_ENVx_CURVE_6                           ;de 0x40        ;; 0x73
F0023C 6060      00057 EEPROM_KIT_ENVx_ATTACK_6                          de 0x60, 0x60 ;; 0x74
F0023E 00058 EEPROM_KIT_ENVx_DECAY_6                           ;de 0x60        ;; 0x75
F0023E 4020      00059 EEPROM_KIT_ENVx_SUSTAIN_6                         de 0x20, 0x40 ;; 0x76
F00240 00060 EEPROM_KIT_ENVx_RELEASE_6                         ;de 0x40        ;; 0x77
               00061 
F00240 007F      00062 EEPROM_KIT_WAVETABLE_7                        de 0x7f, 0x00   ;; 0x10
F00242 0000      00063 EEPROM_KIT_WT_RATE_7                              de 0x00, 0x00   ;; 0x10
F00244 00064 EEPROM_KIT_ENVx_CURVE_7                           ;de 0x40        ;; 0x73
F00244 6060      00065 EEPROM_KIT_ENVx_ATTACK_7                          de 0x60, 0x60 ;; 0x74
F00246 00066 EEPROM_KIT_ENVx_DECAY_7                           ;de 0x60        ;; 0x75
F00246 4020      00067 EEPROM_KIT_ENVx_SUSTAIN_7                         de 0x20, 0x40 ;; 0x76
F00248 00068 EEPROM_KIT_ENVx_RELEASE_7                         ;de 0x40        ;; 0x77
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 256


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00069 
F00248 007F      00070 EEPROM_KIT_WAVETABLE_8                        de 0x7f, 0x00   ;; 0x10
F0024A 0000      00071 EEPROM_KIT_WT_RATE_8                              de 0x00, 0x00   ;; 0x10
F0024C 00072 EEPROM_KIT_ENVx_CURVE_8                           ;de 0x40        ;; 0x73
F0024C 6060      00073 EEPROM_KIT_ENVx_ATTACK_8                          de 0x60, 0x60 ;; 0x74
F0024E 00074 EEPROM_KIT_ENVx_DECAY_8                           ;de 0x60        ;; 0x75
F0024E 4020      00075 EEPROM_KIT_ENVx_SUSTAIN_8                         de 0x20, 0x40 ;; 0x76
F00250 00076 EEPROM_KIT_ENVx_RELEASE_8                         ;de 0x40        ;; 0x77
               00077 
F00250 007F      00078 EEPROM_KIT_WAVETABLE_9                        de 0x7f, 0x00   ;; 0x10
F00252 0000      00079 EEPROM_KIT_WT_RATE_9                              de 0x00, 0x00   ;; 0x10
F00254 00080 EEPROM_KIT_ENVx_CURVE_9                           ;de 0x40        ;; 0x73
F00254 6060      00081 EEPROM_KIT_ENVx_ATTACK_9                          de 0x60, 0x60 ;; 0x74
F00256 00082 EEPROM_KIT_ENVx_DECAY_9                           ;de 0x60        ;; 0x75
F00256 4020      00083 EEPROM_KIT_ENVx_SUSTAIN_9                         de 0x20, 0x40 ;; 0x76
F00258 00084 EEPROM_KIT_ENVx_RELEASE_9                         ;de 0x40        ;; 0x77
               00085 
F00258 007F      00086 EEPROM_KIT_WAVETABLE_10                        de 0x7f, 0x00   ;; 0x10
F0025A 0000      00087 EEPROM_KIT_WT_RATE_10                              de 0x00, 0x00   ;; 0x10
F0025C 00088 EEPROM_KIT_ENVx_CURVE_10                           ;de 0x40        ;; 0x73
F0025C 6060      00089 EEPROM_KIT_ENVx_ATTACK_10                         de 0x60, 0x60 ;; 0x74
F0025E 00090 EEPROM_KIT_ENVx_DECAY_10                           ;de 0x60        ;; 0x75
F0025E 4020      00091 EEPROM_KIT_ENVx_SUSTAIN_10                         de 0x20, 0x40        ;; 0x76
F00260 00092 EEPROM_KIT_ENVx_RELEASE_10                         ;de 0x40        ;; 0x77
               00093 
F00260 007F      00094 EEPROM_KIT_WAVETABLE_11                        de 0x7f, 0x00   ;; 0x10
F00262 0000      00095 EEPROM_KIT_WT_RATE_11                              de 0x00, 0x00   ;; 0x10
F00264 00096 EEPROM_KIT_ENVx_CURVE_11                           ;de 0x40        ;; 0x73
F00264 6060      00097 EEPROM_KIT_ENVx_ATTACK_11                          de 0x60, 0x60        ;; 0x74
F00266 00098 EEPROM_KIT_ENVx_DECAY_11                           ;de 0x60        ;; 0x75
F00266 4020      00099 EEPROM_KIT_ENVx_SUSTAIN_11                         de 0x20, 0x40        ;; 0x76
F00268 00100 EEPROM_KIT_ENVx_RELEASE_11                         ;de 0x40        ;; 0x77
               00101 
F00268 007F      00102 EEPROM_KIT_WAVETABLE_12                        de 0x7f, 0x00   ;; 0x52
F0026A 0000      00103 EEPROM_KIT_WT_RATE_12                              de 0x00, 0x00   ;; 0x10
F0026C 00104 EEPROM_KIT_ENVx_CURVE_12                           ;de 0x40        ;; 0x53
F0026C 6060      00105 EEPROM_KIT_ENVx_ATTACK_12                          de 0x60, 0x60        ;; 0x54
F0026E 00106 EEPROM_KIT_ENVx_DECAY_12                           ;de 0x60        ;; 0x55
F0026E 4020      00107 EEPROM_KIT_ENVx_SUSTAIN_12                         de 0x20, 0x40        ;; 0x56
F00270 00108 EEPROM_KIT_ENVx_RELEASE_12                         ;de 0x40        ;; 0x57
               00109 
F00270 007F      00110 EEPROM_KIT_WAVETABLE_13                        de 0x7f, 0x00   ;; 0x58
F00272 0000      00111 EEPROM_KIT_WT_RATE_13                              de 0x00, 0x00   ;; 0x10
F00274 00112 EEPROM_KIT_ENVx_CURVE_13                           ;de 0x40        ;; 0x59
F00274 6060      00113 EEPROM_KIT_ENVx_ATTACK_13                          de 0x60, 0x60        ;; 0x5a
F00276 00114 EEPROM_KIT_ENVx_DECAY_13                           ;de 0x60        ;; 0x5b
F00276 4020      00115 EEPROM_KIT_ENVx_SUSTAIN_13                         de 0x20, 0x40        ;; 0x5c
F00278 00116 EEPROM_KIT_ENVx_RELEASE_13                         ;de 0x40        ;; 0x5d
               00117 
F00278 007F      00118 EEPROM_KIT_WAVETABLE_14                        de 0x7f, 0x00   ;; 0x5e
F0027A 0000      00119 EEPROM_KIT_WT_RATE_14                              de 0x00, 0x00   ;; 0x10
F0027C 00120 EEPROM_KIT_ENVx_CURVE_14                           ;de 0x40        ;; 0x5f
F0027C 6060      00121 EEPROM_KIT_ENVx_ATTACK_14                          de 0x60, 0x60        ;; 0x60
F0027E 00122 EEPROM_KIT_ENVx_DECAY_14                           ;de 0x60        ;; 0x61
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 257


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F0027E 4020      00123 EEPROM_KIT_ENVx_SUSTAIN_14                         de 0x20, 0x40        ;; 0x62
F00280 00124 EEPROM_KIT_ENVx_RELEASE_14                         ;de 0x40        ;; 0x63
               00125 
F00280 007F      00126 EEPROM_KIT_WAVETABLE_15                        de 0x7f, 0x00   ;; 0x64
F00282 0000      00127 EEPROM_KIT_WT_RATE_15                              de 0x00, 0x00   ;; 0x10
F00284 00128 EEPROM_KIT_ENVx_CURVE_15                           ;de 0x40        ;; 0x65
F00284 6060      00129 EEPROM_KIT_ENVx_ATTACK_15                          de 0x60, 0x60        ;; 0x66
F00286 00130 EEPROM_KIT_ENVx_DECAY_15                           ;de 0x60        ;; 0x67
F00286 4020      00131 EEPROM_KIT_ENVx_SUSTAIN_15                         de 0x20, 0x40        ;; 0x68
F00288 00132 EEPROM_KIT_ENVx_RELEASE_15                         ;de 0x40        ;; 0x69
               00133 
F00288 007F      00134 EEPROM_KIT_WAVETABLE_16                        de 0x7f, 0x00   ;; 0x6a
F0028A 0000      00135 EEPROM_KIT_WT_RATE_16                              de 0x00, 0x00   ;; 0x10
F0028C 00136 EEPROM_KIT_ENVx_CURVE_16                           ;de 0x40        ;; 0x6b
F0028C 6060      00137 EEPROM_KIT_ENVx_ATTACK_16                          de 0x60, 0x60        ;; 0x6c
F0028E 00138 EEPROM_KIT_ENVx_DECAY_16                           ;de 0x60        ;; 0x6d
F0028E 4020      00139 EEPROM_KIT_ENVx_SUSTAIN_16                         de 0x20, 0x40        ;; 0x6e
F00290 00140 EEPROM_KIT_ENVx_RELEASE_16                         ;de 0x40        ;; 0x6f
               00141 
               00037 
               00038 ;; ==========================================================================
               00039 ;; misc parameters which are stored in internal EEPROM
               00040 ;; ==========================================================================
F00300           00041         org     0xf00300
F00300 00042 EEPROM_BANK_NAME
F00300 6E49 6574 00043         de  'I','n','t','e','r','n','a','l',' ',' ',' ',' ',' ',' ',' ',' '
     6E72 6C61 
     2020 2020 
     2020 2020 
F00310 00044 NEW_BANK_NAME
F00310 654E 2077 00045         de  'N','e','w',' ','B','a','n','k',' ',' ',' ',' ',' ',' ',' ',' '
     6142 6B6E 
     2020 2020 
     2020 2020 
F00320 00046 NEW_KIT_NAME
F00320 654E 2077 00047         de  'N','e','w',' ','K','i','t',' ',' ',' ',' ',' ',' ',' ',' ',' '
     694B 2074 
     2020 2020 
     2020 2020 
F00330 00048 NEW_WAVETABLE_NAME
F00330 654E 2077 00422 
     6157 6576 
     6274 656C 
     2020 2020 
               00423 
               00424 
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 258


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_base.asm9-22-2013  23:38:17          PAGE 259


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_base.asm9-22-2013  23:38:17          PAGE 260


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_base.asm9-22-2013  23:38:17          PAGE 261


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_base.asm9-22-2013  23:38:17          PAGE 262


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_base.asm9-22-2013  23:38:17          PAGE 263


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_base.asm9-22-2013  23:38:17          PAGE 264


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_base.asm9-22-2013  23:38:17          PAGE 265


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_base.asm9-22-2013  23:38:17          PAGE 266


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_base.asm9-22-2013  23:38:17          PAGE 267


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            00000200
BANKSTICK_FORMAT_END              000002FF
BAUDCON                           00000FB8
BCLIE                             00000003
gpasm-0.13.7 beta               setup_tia_base.asm9-22-2013  23:38:17          PAGE 268


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