Subversion Repositories svn.mios

Rev

Blame | Last modification | View Log | RSS feed

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


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 
               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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
  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. 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
  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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
               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)
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE  8


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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 
               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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 10


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 
               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)
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 11


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 ;; ==========================================================================
               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!) ]---
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 12


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
  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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 13


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 14


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 15


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 16


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  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
  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.
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 17


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 EF87 F019 00016         goto    USER_Init
3004 00017 _USER_Tick
3004 EFA7 F019 00018         goto    USER_Tick
3008 00019 _USER_Timer
3008 EFB0 F019 00020         goto    USER_Timer
300C 00021 _USER_MPROC_DebugTrigger
300C EFB3 F019 00022         goto    USER_MPROC_DebugTrigger
3010 00023 _USER_DISPLAY_Init
3010 EFB4 F019 00024         goto    USER_DISPLAY_Init
3014 00025 _USER_DISPLAY_Tick
3014 EFB5 F019 00026         goto    USER_DISPLAY_Tick
3018 00027 _USER_SR_Service_Prepare
3018 EFD7 F019 00028         goto    USER_SR_Service_Prepare
301C 00029 _USER_SR_Service_Finish
301C EFD8 F019 00030         goto    USER_SR_Service_Finish
3020 00031 _USER_DIN_NotifyToggle
3020 EFD5 F019 00032         goto    USER_DIN_NotifyToggle
3024 00033 _USER_ENC_NotifyChange
3024 EFD6 F019 00034         goto    USER_ENC_NotifyChange
3028 00035 _USER_AIN_NotifyChange
3028 EFD9 F019 00036         goto    USER_AIN_NotifyChange
302C 00037 _USER_MPROC_NotifyReceivedByte
302C EFBF F019 00038         goto    USER_MPROC_NotifyReceivedByte
3030 00039 _USER_MPROC_NotifyTimeout
3030 EFBC F019 00040         goto    USER_MPROC_NotifyTimeout
3034 00041 _USER_MPROC_NotifyReceivedEvent
3034 EFB8 F019 00042         goto    USER_MPROC_NotifyReceivedEvent
3038 00043 _USER_MPROC_NotifyFoundEvent
3038 EFBB F019 00044         goto    USER_MPROC_NotifyFoundEvent
303C 00045 _USER_LCD_Init
303C EF80 F019 00046         goto    USER_LCD_Init
3040 00047 _USER_LCD_Clear
3040 EF81 F019 00048         goto    USER_LCD_Clear
3044 00049 _USER_LCD_CursorSet
3044 EF82 F019 00050         goto    USER_LCD_CursorSet
3048 00051 _USER_LCD_PrintChar
3048 EF83 F019 00052         goto    USER_LCD_PrintChar
304C 00053 _USER_MIDI_NotifyRx
304C EFC5 F019 00054         goto    USER_MIDI_NotifyRx
3050 00055 _USER_MIDI_NotifyTx
3050 EFC2 F019 00056         goto    USER_MIDI_NotifyTx
3054 00057 _USER_LCD_Data
3054 EF84 F019 00058         goto    USER_LCD_Data
3058 00059 _USER_LCD_Cmd
3058 EF85 F019 00060         goto    USER_LCD_Cmd
305C 00061 _USER_LCD_SpecialCharInit
305C EF86 F019 00062         goto    USER_LCD_SpecialCharInit
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 18


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
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 ;; ---[ variables used by application ]---
               00034 #include "app_defines.h"
               00001 ; $Id: app_defines.h bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; Specific Defines and variables of MIOS Application
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
3080 00013 #define TIA_STAT_ENGINE_DISABLE         0   ; if set, TIA tick and TIA interrupt will not be processed
3080 00014 #define TIA_STAT_FORCE_REFRESH          1   ; if set, a refresh will be forced with next TIA_Tick
3080 00015 #define TIA_STAT_CC_DUMP_REQ            2   ; if set, a CC dump will be sent
3080 00016 #define TIA_STAT_SAVED_GIE          3   ; save the GIE bit for nested interrupt disables
3080 00017 #define TIA_STAT_TRIGGER_RESET          4   ; if set, the TIA will be reset with next TIA_Tick
               00018 
               00019 ;; ==========================================================================
               00020 
3080 00021 #define TIA_PLAY_MODE_POLY          0
3080 00022 #define TIA_PLAY_MODE_SUS_KEY           1
3080 00023 #define TIA_PLAY_MODE_LEGATO_OFF        2
3080 00024 #define TIA_PLAY_MODE_ONLY_WT_OFF       3
               00025 
               00026 ;; ==========================================================================
3080 00027 #define TIA_MIDI_SYNC_SEND_CLK          0       ; send MIDI clock
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 19


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
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        0x83; magic numbers - if they don't exists in bankstick at BANK_MAGIC_ADDRESS,
3080 00045 #define BANKSTICK_MAGICP        0x12 ; the stick will be ignored until it has been formatted
3080 00046 #define BANKSTICK_MAGICK        BANKSTICK_MAGICP+1 ; the stick will be ignored until it has been formatted
               00047 
               00048 ;; ==========================================================================
               00049 
3080 00050 #define REG_TEMP_TEST_FLAG      0
3080 00051 #define REG_TEMP_UP_FLAG        1
3080 00052 #define REG_TEMP_DOWN_FLAG      2
               00053 
               00054 #if DEFAULT_TIA_DEBUG_ON == 1 
               00055 ;;#if DEFAULT_TIA_DEBUG_BS == 1   ;; for BankStick
3080 00056 #define TIA_DEBUG_EE_FLAG               0   ;;REGA flag
3080 00057 #define TIA_DEBUG_EE_RW                 1   ;;REGA RW:0=Read/1=Write
3080 00058 #define TIA_DEBUG_EE_PAGE               2   ;;REGA RW:0=One byte/1=One Page(64 bytes)
3080 00059 #define TIA_DEBUG_EE_ERROR              3   ;;REGA 0=No Error/1=Error
3080 00060 #define TIA_DEBUG_EE_READONLY   4   ;;REGA RW:0=No Error/1=Error
3080 00061 #define TIA_DEBUG_EE_WRERR      5   ;;REGA 0=No Error/1=Error
3080 00062 #define TIA_DEBUG_EE_PINIT      6   ;;REGA RW:0=No Error/1=Error
3080 00063 #define TIA_DEBUG_EE_SYX        7   ;;REGA RW:0=No Error/1=Error
               00064 
3080 00065 #define TIA_DEBUG_EE_PK                 0   ;;REGB 0=Patch/1=Kit/Wavetable
3080 00066 #define TIA_DEBUG_EE_WT         1   ;;REGB 0=Kit/1=Wavetable
3080 00067 #define TIA_DEBUG_BS_RWCHK              2   ;;REGB 0=Read/Write/1=Check
3080 00068 #define TIA_DEBUG_BS_SIZE               3   ;;REGB 0=Internal/1=External
3080 00069 #define TIA_DEBUG_BS_INTEXT             4   ;;REGB Chk:0=32k/1=64k
3080 00070 #define TIA_DEBUG_BS_FORMAT             5   ;;REGB Chk:0=Connected! Ok/1=Reformated!
3080 00071 #define TIA_DEBUG_BS_FPROTECT   6   ;;REGB Chk:format protected
3080 00072 #define TIA_DEBUG_BS_TPROTECT   7   ;;REGB Chk:type protected
3080 00073 #define TIA_DEBUG_BS_READY      5   ;;REGB Chk:bankstick ready     
               00074 ;;#endif
               00075 #endif
               00076 
               00077 ;; ==========================================================================
               00078         ;; free memory for user applications:   
               00079         ;; 0x010-0x37f
               00080 
               00081 ;; ==========================================================================
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 20


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


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


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


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


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


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
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 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 27


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 
     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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 28


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     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 
     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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 29


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 30


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
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
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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 31


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     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
               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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 32


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 33


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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
               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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 34


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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!
               00040 
               00041 ;; ---[ Custom LCD driver ]---
               00042 #include "app_lcd.inc"
               00001 ; $Id: app_lcd.inc 69 2008-02-01 00:20:18Z tk $
               00002 ;
               00003 ; MIOS Custom LCD Driver Skeleton
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 ;; --------------------------------------------------------------------------
               00014 ;;  Following system variables are given by MIOS and can be directly 
               00015 ;;  accessed by the driver. The addresses are defined in mios.h and
               00016 ;;  should not be changed
               00017 ;; 
               00018 ;;  MIOS_GLCD_BUFFER         a 8 byte buffer for data transfers
               00019 ;;  MIOS_LCD_OPTION1         contains the first LCD option given by MIOS_LCD_TypeSet
               00020 ;;  MIOS_LCD_OPTION2         contains the second LCD option given by MIOS_LCD_TypeSet
               00021 ;;  MIOS_LCD_CURSOR_POS      the current cursor pos of characters (GLCD: multiplied by width)
               00022 ;;  MIOS_GLCD_GCURSOR_X      for GLCDs: the current X position of graphical cursor
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 35


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


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


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


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


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


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


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


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


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00010 ;
               00011 ; Settings which can be modified:
               00012 ;
               00013 ; Number of update cycles (* 1mS) the LEDs will stay active on a Rx/Tx event
33F0 00014 #define MIDI_RXTX_LED_DELAY 15
               00015 ; DOUT pin number of Rx LED
33F0 00016 #define MIDI_RXTX_RX_LED    DEFAULT_MIDI_RX_LED
               00017 ; DOUT pin number of Tx LED
33F0 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 ;; --------------------------------------------------------------------------
33F0 00038 MIDI_RXTX_IO_Init
33F0 9C95      00039     bcf     DEFAULT_MIDI_RX_TRIS, DEFAULT_MIDI_RX_PIN
33F2 9E95      00040     bcf     DEFAULT_MIDI_TX_TRIS, DEFAULT_MIDI_TX_PIN
33F4 0012      00041         return
               00042 
               00043 ;; --------------------------------------------------------------------------
               00044 ;;  FUNCTION: MIDI_RXTX_IO_Init
               00045 ;;  DESCRIPTION: this function has to be called from the USER_Init
               00046 ;;  only if Leds are assigned to IO pins
               00047 ;; --------------------------------------------------------------------------
33F6 00048 MIDI_RXTX_NotifyRx_BeatClk
33F6 2B69      00049     incf    MIDI_RXTX_BEAT_CTR, F
33F8 0E17      00050     movlw   0x17
33FA 6569      00051     cpfsgt  MIDI_RXTX_BEAT_CTR, BANKED
               00052     rgoto   MIDI_RXTX_NotifyRx_BeatClk_End
33FC D004          M         bra     label
33FE 6B69      00053     clrf    MIDI_RXTX_BEAT_CTR
3400 0E0F      00054         movlw   MIDI_RXTX_LED_DELAY
               00055         SET_BSR MIDI_RXTX_RX_CTR
3402 0100          M         movlb   HIGH(reg)
3404 6F67      00056         movwf   MIDI_RXTX_RX_CTR, BANKED    
3406 00057 MIDI_RXTX_NotifyRx_BeatClk_End
3406 0012      00058         return
               00059     
               00060 ;; --------------------------------------------------------------------------
               00061 ;;  FUNCTION: MIDI_RXTX_NotifyRx
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 45


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00114         
               00115 #if MIDI_RXTX_USE_IO
               00116     bcf     DEFAULT_MIDI_RX_LAT, DEFAULT_MIDI_RX_PIN
               00117     movf    MIOS_PARAMETER1, W
               00118     skpz
               00119     bsf     DEFAULT_MIDI_RX_LAT, DEFAULT_MIDI_RX_PIN
               00120 #else
               00121     movlw       MIDI_RXTX_RX_LED
               00122         call    MIOS_DOUT_PinSet
               00123 #endif
               00124 
               00125         ;; set the Tx LED depending on counter state
               00126         SET_BSR MIDI_RXTX_TX_CTR
               00127         movf    MIDI_RXTX_TX_CTR, W, BANKED
               00128         skpz
               00129         movlw   0x01
               00130         movwf   MIOS_PARAMETER1
               00131 
               00132 #if MIDI_RXTX_USE_IO
               00133     bcf     DEFAULT_MIDI_TX_LAT, DEFAULT_MIDI_TX_PIN
               00134     movf    MIOS_PARAMETER1, W
               00135     skpz
               00136     bsf     DEFAULT_MIDI_TX_LAT, DEFAULT_MIDI_TX_PIN
               00137 #else
               00138     movlw       MIDI_RXTX_TX_LED
               00139         call    MIOS_DOUT_PinSet
               00140 #endif
               00141 #endif
3418 0012      00142         return
               00369 #include "special_characters.inc"
               00001 ; $Id: special_characters.inc 125 2008-02-27 09:10:44Z nils $
               00002 ;
               00003 ; This file contains all special characters used by the application
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 ;; --------------------------------------------------------------------------
               00014 ;;  Table of special characters
               00015 ;;  NOTE: only seven characters are really used by the CS, the others can contain
               00016 ;;  random bitpatterns, therefore this table only contains 16 bytes
               00017 ;; --------------------------------------------------------------------------
341A 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
341A 0301      00022         db b'00000001', b'00000011'; 1st and 2nd line of special char
341C 0307      00023         db b'00000111', b'00000011'; 3rd and 4th line of special char
341E 0001      00024         db b'00000001', b'00000000'; 5th and 6th line of special char
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 47


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3420 0000      00025         db b'00000000', b'00000000'; 7th and 8th line of special char
               00026         ;; char #1: right-arrow
3422 0000      00027         db b'00000000', b'00000000'; 1st and 2nd line of special char
3424 1000      00028         db b'00000000', b'00010000'; 3rd and 4th line of special char
3426 1C18      00029         db b'00011000', b'00011100'; 5th and 6th line of special char
3428 1018      00030         db b'00011000', b'00010000'; 7th and 8th line of special char
               00031         ;; char #2: inverted 1
342A 131B      00032         db b'00011011', b'00010011'; 1st and 2nd line of special char
342C 1B1B      00033         db b'00011011', b'00011011'; 3rd and 4th line of special char
342E 1B1B      00034         db b'00011011', b'00011011'; 5th and 6th line of special char
3430 1F11      00035         db b'00010001', b'00011111'; 7th and 8th line of special char
               00036         ;; char #3: inverted 2
3432 0E11      00037         db b'00010001', b'00001110'; 1st and 2nd line of special char
3434 1D1E      00038         db b'00011110', b'00011101'; 3rd and 4th line of special char
3436 171B      00039         db b'00011011', b'00010111'; 5th and 6th line of special char
3438 1F00      00040         db b'00000000', b'00011111'; 7th and 8th line of special char
               00041         ;; char #4: inverted 3
343A 1D00      00042         db b'00000000', b'00011101'; 1st and 2nd line of special char
343C 1D1B      00043         db b'00011011', b'00011101'; 3rd and 4th line of special char
343E 0E1E      00044         db b'00011110', b'00001110'; 5th and 6th line of special char
3440 1F11      00045         db b'00010001', b'00011111'; 7th and 8th line of special char
               00046         ;; char #5: inverted 4
3442 191D      00047         db b'00011101', b'00011001'; 1st and 2nd line of special char
3444 0D15      00048         db b'00010101', b'00001101'; 3rd and 4th line of special char
3446 1D00      00049         db b'00000000', b'00011101'; 5th and 6th line of special char
3448 1F1D      00050         db b'00011101', b'00011111'; 7th and 8th line of special char
               00051         ;; char #6: inverted '-'
344A 1F1F      00052         db b'00011111', b'00011111'; 1st and 2nd line of special char
344C 001F      00053         db b'00011111', b'00000000'; 3rd and 4th line of special char
344E 1F1F      00054         db b'00011111', b'00011111'; 5th and 6th line of special char
3450 1F1F      00055         db b'00011111', b'00011111'; 7th and 8th line of special char
               00056         ;; char #7: left/right arrow
3452 0301      00057         db b'00000001', b'00000011'; line 1 / 2
3454 1307      00058         db b'00000111', b'00010011'; line 3 / 4
3456 1C19      00059         db b'00011001', b'00011100'; line 5 / 6
3458 1018      00060         db b'00011000', b'00010000'; line 7 / 8
               00370 
               00371 #if DEFAULT_TIA_DEBUG_ON == 1
               00372 ;; ---[ Debug Mess driver ]---
               00373 #include "debug_msg.inc"
               00001 ; $Id: debug_msg.inc 626 2009-01-19 21:36:33Z tk $
               00002 ;
               00003 ;  Help functions to send debug messages to MIOS Terminal via SysEx
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 2009 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 
               00014 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 48


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00015 ;;  FUNCTION: DEBUG_MSG_SendHeader
               00016 ;;  DESCRIPTION: sends the SysEx header
               00017 ;;  IN:   -
               00018 ;;  OUT:  -
               00019 ;;  USES: BSR, FSR1
               00020 ;; --------------------------------------------------------------------------
345A 00021 _DEBUG_MSG_SendHeader   ; for C
345A 00022 DEBUG_MSG_SendHeader
               00023         ;; this SysEx command will be parsed by MIOS Terminal to print out text messages
345A 0EF0      00024         movlw   0xf0
345C EC24 F016 00025         call    MIOS_MIDI_TxBufferPut
3460 0E00      00026         movlw   0x00
3462 EC24 F016 00027         call    MIOS_MIDI_TxBufferPut
3466 0E00      00028         movlw   0x00
3468 EC24 F016 00029         call    MIOS_MIDI_TxBufferPut
346C 0E7E      00030         movlw   0x7e
346E EC24 F016 00031         call    MIOS_MIDI_TxBufferPut
3472 0E32      00032         movlw   0x32
3474 EC24 F016 00033         call    MIOS_MIDI_TxBufferPut
3478 EC04 F016 00034         call    MIOS_MIDI_DeviceIDGet
347C EC24 F016 00035         call    MIOS_MIDI_TxBufferPut
3480 0E0D      00036         movlw   0x0d
3482 EC24 F016 00037         call    MIOS_MIDI_TxBufferPut
3486 0E40      00038         movlw   0x40
3488 EC24 F016 00039         call    MIOS_MIDI_TxBufferPut
               00040 
               00041         ;; following characters will be print on terminal
348C 0012      00042         return
               00043 
               00044 
               00045 ;; --------------------------------------------------------------------------
               00046 ;;  FUNCTION: DEBUG_MSG_SendFooter
               00047 ;;  DESCRIPTION: sends the SysEx footer
               00048 ;;  IN:   -
               00049 ;;  OUT:  -
               00050 ;;  USES: BSR, FSR1
               00051 ;; --------------------------------------------------------------------------
348E 00052 _DEBUG_MSG_SendFooter   ; for C
348E 00053 DEBUG_MSG_SendFooter
               00054         ;; finish SysEx stream - MIOS Terminal will print the received characters now
348E 0EF7      00055         movlw   0xf7
3490 EC24 F016 00056         call    MIOS_MIDI_TxBufferPut
3494 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 ;; --------------------------------------------------------------------------
3496 00067 _DEBUG_MSG_SendChar     ; for C
3496 00068 DEBUG_MSG_SendChar
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 49


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3496 0B7F      00069         andlw   0x7f    ; ensure that MSB is cleared, otherwise we would violate the MIDI protocol
3498 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 ;; --------------------------------------------------------------------------
349C 00081 DEBUG_MSG_SendASMString
               00082         ;; we expect that the zero-terminated string is located behind the "call" instruction
               00083         ;; transfer pointer to TBLPTR[LHU]
349C CFFD FFF6 00084         movff   TOSL, TBLPTRL
34A0 CFFE FFF7 00085         movff   TOSH, TBLPTRH
34A4 CFFF FFF8 00086         movff   TOSU, TBLPTRU
               00087 
               00088         ;; print until zero is read
34A8 00089 DEBUG_MSG_SendASMStringLoop
34A8 0009      00090         tblrd*+
34AA 50F5      00091         movf    TABLAT, W
34AC E002      00092         bz      DEBUG_MSG_SendASMStringLoop_End
34AE DFF3      00093         rcall   DEBUG_MSG_SendChar
               00094         rgoto   DEBUG_MSG_SendASMStringLoop
34B0 D7FB          M         bra     label
34B2 00095 DEBUG_MSG_SendASMStringLoop_End
               00096 
               00097         ;; return pointer now in TBLPTR[LH]
               00098 
               00099         ;; ensure that it is aligned to next instruction
34B2 50F6      00100         movf    TBLPTRL, W
34B4 0B01      00101         andlw   0x01
34B6 E005      00102         bz      DEBUG_MSG_SendASMString_NoIAlign
34B8 2AF6      00103         incf    TBLPTRL, F
34BA B4D8      00104         skpnz
34BC 2AF7      00105         incf    TBLPTRH, F
34BE B4D8      00106         skpnz
34C0 2AF8      00107         incf    TBLPTRU, F
34C2 00108 DEBUG_MSG_SendASMString_NoIAlign
               00109 
               00110         IRQ_DISABLE
34C2 9EF2          M         bcf     INTCON, GIE
34C4 50F6      00111         movf    TBLPTRL, W
34C6 6EFD      00112         movwf   TOSL
34C8 50F7      00113         movf    TBLPTRH, W
34CA 6EFE      00114         movwf   TOSH
34CC 50F8      00115         movf    TBLPTRU, W
34CE 6EFF      00116         movwf   TOSU
               00117         IRQ_ENABLE
34D0 8EF2          M         bsf     INTCON, GIE
34D2 0012      00118         return
               00119 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 50


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 ;; --------------------------------------------------------------------------
34D4 00135 _DEBUG_MSG_SendBCD1     ; for C
34D4 00136 DEBUG_MSG_SendBCD1
34D4 00137 _DEBUG_MSG_SendHex1     ; for C
34D4 00138 DEBUG_MSG_SendHex1
34D4 0B0F      00139         andlw   0x0f
34D6 0FF6      00140         addlw   -0x0a
34D8 B0D8      00141         skpnc
34DA 0F07      00142         addlw   0x07
34DC 0F3A      00143         addlw   0x3a
               00144         rgoto   DEBUG_MSG_SendChar
34DE 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 ;; --------------------------------------------------------------------------
34E0 00154 _DEBUG_MSG_SendHex2     ; for C
34E0 00155 DEBUG_MSG_SendHex2
34E0 6EF3      00156         movwf   PRODL
34E2 38F3      00157         swapf   PRODL, W
34E4 DFF7      00158         rcall   DEBUG_MSG_SendBCD1
34E6 50F3      00159         movf    PRODL, W
               00160         rgoto   DEBUG_MSG_SendBCD1
34E8 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 ;; --------------------------------------------------------------------------
34EA 00170 _DEBUG_MSG_SendBCD2     ; for C
34EA 00171 DEBUG_MSG_SendBCD2
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 51


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
34EA 6A03      00172         clrf    MIOS_PARAMETER1
34EC ECF4 F016 00173         call    MIOS_HLP_Dec2BCD
               00174         rgoto   DEBUG_MSG_SendBCD2_Cont
34F0 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 ;; --------------------------------------------------------------------------
34F2 00183 _DEBUG_MSG_SendBCD3     ; for C
34F2 00184 DEBUG_MSG_SendBCD3
34F2 6A03      00185         clrf    MIOS_PARAMETER1
34F4 ECF4 F016 00186         call    MIOS_HLP_Dec2BCD
               00187         rgoto   DEBUG_MSG_SendBCD3_Cont
34F8 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
34FA 00198 DEBUG_MSG_SendBCD4
34FA ECF4 F016 00199         call    MIOS_HLP_Dec2BCD
               00200         rgoto   DEBUG_MSG_SendBCD4_Cont
34FE D007          M         bra     label
               00201 
               00202 ;; --------------------------------------------------------------------------
               00203 ;;  FUNCTION: DEBUG_MSG_SendBCD5
               00204 ;;  DESCRIPTION: prints a 16-bit as BCD (decimal value) -- five digits
               00205 ;;  IN:   Low-byte in WREG, High-byte in MIOS_PARAMETER1
               00206 ;;  IN:   Value in WREG
               00207 ;;  OUT:  -
               00208 ;;  USES: BSR, FSR1, MIOS_PARAMETER[123]
               00209 ;; --------------------------------------------------------------------------
               00210 ;_DEBUG_MSG_SendBCD5    ; "unsigned int" parameter converted in debug_msg.asm
3500 00211 DEBUG_MSG_SendBCD5
3500 ECF4 F016 00212         call    MIOS_HLP_Dec2BCD
               00213 
               00214 ;; -----------------
3504 00215 DEBUG_MSG_SendBCD5_Cont
3504 5005      00216         movf    MIOS_PARAMETER3, W
3506 0B0F      00217         andlw   0x0f
3508 E112      00218         bnz     DEBUG_MSG_SendBCD_D5
               00219 
350A 0E20      00220         movlw   ' '
350C DFC4      00221         rcall   DEBUG_MSG_SendChar
               00222 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 52


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
350E 00223 DEBUG_MSG_SendBCD4_Cont
350E 3804      00224         swapf   MIOS_PARAMETER2, W
3510 0B0F      00225         andlw   0x0f
3512 E10E      00226         bnz     DEBUG_MSG_SendBCD_D4
               00227 
3514 0E20      00228         movlw   ' '
3516 DFBF      00229         rcall   DEBUG_MSG_SendChar
               00230 
3518 00231 DEBUG_MSG_SendBCD3_Cont
3518 5004      00232         movf    MIOS_PARAMETER2, W
351A 0B0F      00233         andlw   0x0f
351C E10B      00234         bnz     DEBUG_MSG_SendBCD_D3
               00235 
351E 0E20      00236         movlw   ' '
3520 DFBA      00237         rcall   DEBUG_MSG_SendChar
               00238 
3522 00239 DEBUG_MSG_SendBCD2_Cont
3522 3803      00240         swapf   MIOS_PARAMETER1, W
3524 0B0F      00241         andlw   0x0f
3526 E108      00242         bnz     DEBUG_MSG_SendBCD_D2
               00243 
3528 0E20      00244         movlw   ' '
352A DFB5      00245         rcall   DEBUG_MSG_SendChar
               00246 
352C 00247 DEBUG_MSG_SendBCD1_Cont
               00248         rgoto   DEBUG_MSG_SendBCD_D1
352C D007          M         bra     label
               00249         
               00250 
               00251         ;; ---
352E 00252 DEBUG_MSG_SendBCD_D5
352E DFD2      00253         rcall   DEBUG_MSG_SendBCD1
3530 00254 DEBUG_MSG_SendBCD_D4
3530 3804      00255         swapf   MIOS_PARAMETER2, W
3532 DFD0      00256         rcall   DEBUG_MSG_SendBCD1
3534 00257 DEBUG_MSG_SendBCD_D3
3534 5004      00258         movf    MIOS_PARAMETER2, W
3536 DFCE      00259         rcall   DEBUG_MSG_SendBCD1
3538 00260 DEBUG_MSG_SendBCD_D2
3538 3803      00261         swapf   MIOS_PARAMETER1, W
353A DFCC      00262         rcall   DEBUG_MSG_SendBCD1
353C 00263 DEBUG_MSG_SendBCD_D1
353C 5003      00264         movf    MIOS_PARAMETER1, W
               00265         rgoto   DEBUG_MSG_SendBCD1
353E 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 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 53


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


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


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


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


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
354C EC2D F01A 00268     call        DEBUG_MSG_SendHeader
               00269 
3550 EC4E F01A 00270         call    DEBUG_MSG_SendASMString
3554 6E49 2E74 00271     db  "Int. EE R/W Debug:", 0
     4520 2045 
     2F52 2057 
     6544 7562 
     3A67 0000 
               00272     
3568 00273 TIA_Debug_EE_Do_Read
               00274     BRA_IFSET TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_EE_Do_Write
3568 B264          M         btfsc   reg, bit, reg_a
356A D00C          M         bra     label
356C EC4E F01A 00275         call    DEBUG_MSG_SendASMString
3570 5220 6165 00276     db  " Read Int. Preset", 0
     2064 6E49 
     2E74 5020 
     6572 6573 
     0074      
               00277     rgoto   TIA_Debug_EE_Do_ReadWrite_End
3582 D01B          M         bra     label
               00278     
3584 00279 TIA_Debug_EE_Do_Write
3584 EC4E F01A 00280     call        DEBUG_MSG_SendASMString
3588 5720 6972 00281     db  " Write Int. Preset", 0
     6574 4920 
     746E 202E 
     7250 7365 
     7465 0000 
359C 00282 TIA_Debug_EE_Do_Write_byte
               00283     BRA_IFSET TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE, ACCESS, TIA_Debug_EE_Do_Write_Page
359C B464          M         btfsc   reg, bit, reg_a
359E D007          M         bra     label
35A0 EC4E F01A 00284     call        DEBUG_MSG_SendASMString
35A4 2D20 6220 00285     db  " - byte", 0    
     7479 0065 
               00286     rgoto   TIA_Debug_EE_Do_ReadWrite_End
35AC D006          M         bra     label
35AE 00287 TIA_Debug_EE_Do_Write_Page    
35AE EC4E F01A 00288     call        DEBUG_MSG_SendASMString
35B2 2D20 7020 00289     db  " - page", 0    
     6761 0065 
35BA 00290 TIA_Debug_EE_Do_ReadWrite_End
               00291 
35BA 00292 TIA_Debug_EE_Do_PInit
               00293     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PINIT, ACCESS, TIA_Debug_EE_Do_PInit_End
35BA AC64          M         btfss   reg, bit, reg_a
35BC D00B          M         bra     label
35BE 9D64      00294     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PINIT
35C0 EC4E F01A 00295         call    DEBUG_MSG_SendASMString
35C4 2820 6150 00296     db  " (Patch Init)", 0
     6374 2068 
     6E49 7469 
     0029      
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 59


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00297     rgoto   TIA_Debug_EE_Do_Sysex_End
35D2 D00D          M         bra     label
35D4 00298 TIA_Debug_EE_Do_PInit_End
               00299 
35D4 00300 TIA_Debug_EE_Do_Sysex
               00301     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_SYX, ACCESS, TIA_Debug_EE_Do_Sysex_End
35D4 AE64          M         btfss   reg, bit, reg_a
35D6 D00B          M         bra     label
35D8 9F64      00302     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_SYX
35DA EC4E F01A 00303         call    DEBUG_MSG_SendASMString
35DE 2820 7953 00304     db  " (Sysex Action)", 0
     6573 2078 
     6341 6974 
     6E6F 0029 
35EE 00305 TIA_Debug_EE_Do_Sysex_End
               00306 
35EE 00307 TIA_Debug_EE_Do_Read_Cont
               00308     BRA_IFSET TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_EE_Do_Read_Cont_End
35EE B264          M         btfsc   reg, bit, reg_a
35F0 D003          M         bra     label
35F2 EC4E F01A 00309         call    DEBUG_MSG_SendASMString
35F6 002E      00310     db  ".", 0
35F8 00311 TIA_Debug_EE_Do_Read_Cont_End
               00312 
35F8 00313 TIA_Debug_EE_Do_Write_Ok
               00314     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_EE_Do_WriteError_End
35F8 A264          M         btfss   reg, bit, reg_a
35FA D03F          M         bra     label
               00315     BRA_IFSET TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR, ACCESS, TIA_Debug_EE_Do_Write_Error
35FC B664          M         btfsc   reg, bit, reg_a
35FE D007          M         bra     label
3600 EC4E F01A 00316         call    DEBUG_MSG_SendASMString
3604 2D20 4F20 00317     db  " - Ok.", 0
     2E6B 0000 
               00318     rgoto   TIA_Debug_EE_Do_WriteError_End
360C D036          M         bra     label
               00319     
360E 00320 TIA_Debug_EE_Do_Write_Error
360E EC4E F01A 00321     call        DEBUG_MSG_SendASMString
3612 2D20 4520 00322     db  " - Error:", 0
     7272 726F 
     003A      
361C 00323 TIA_Debug_EE_Do_Write_ErrorReadonly
               00324     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_READONLY, ACCESS, TIA_Debug_EE_Do_Write_ErrorBS
361C A864          M         btfss   reg, bit, reg_a
361E D00E          M         bra     label
3620 EC4E F01A 00325     call        DEBUG_MSG_SendASMString
3624 4520 2045 00326     db  " EE in ReadOnly Mode.", 0    
     6E69 5220 
     6165 4F64 
     6C6E 2079 
     6F4D 6564 
     002E      
               00327     rgoto   TIA_Debug_EE_Do_WriteError_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 60


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
363A D01F          M         bra     label
363C 00328 TIA_Debug_EE_Do_Write_ErrorBS  
               00329     BRA_IFCLR TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_WRERR, ACCESS, TIA_Debug_EE_Do_WriteError_End 
363C AA64          M         btfss   reg, bit, reg_a
363E D01D          M         bra     label
3640 5166      00330     movf        TIA_DEBUG_EE_REG2, W
3642 EC79 F01A 00331     call        DEBUG_MSG_SendBCD3
3646 EC4E F01A 00332     call        DEBUG_MSG_SendASMString
364A 4520 2045 00333     db  " EE Write problem(s)", 0   
     7257 7469 
     2065 7270 
     626F 656C 
     286D 2973 
     0000      
3660 00334 TIA_Debug_EE_Do_WriteError_Mismatch
               00335     BRA_IFCLR TIA_DEBUG_EE_REG1, 0, ACCESS, TIA_Debug_EE_Do_WriteError_End 
3660 A065          M         btfss   reg, bit, reg_a
3662 D00B          M         bra     label
3664 EC4E F01A 00336     call        DEBUG_MSG_SendASMString
3668 6228 7479 00337     db  "(byte mismatch).", 0      
     2065 696D 
     6D73 7461 
     6863 2E29 
     0000      
367A 00338 TIA_Debug_EE_Do_WriteError_End
               00339 
               00340 
367A 00341 TIA_Debug_EE_Do_Footer
367A EC47 F01A 00342         call    DEBUG_MSG_SendFooter
367E 6B64      00343     clrf    TIA_DEBUG_EE_REGA
               00344     ;clrf    TIA_DEBUG_EE_REGB
3680 6B65      00345     clrf    TIA_DEBUG_EE_REG1
3682 6B66      00346     clrf    TIA_DEBUG_EE_REG2    
               00347     ;;rgoto TIA_Debug_EE_Do_End   
               00348 
3684 00349 TIA_Debug_EE_Do_End    
3684 0012      00350     return
               00351 
               00352 ;; --------------------------------------------------------------------------
               00353 ;;  Check for changes in TIA registers, transfer values to TIA
               00354 ;;  and handle Wavetable
               00355 ;; --------------------------------------------------------------------------
3686 00356 TIA_Debug_BS_Do 
               00357     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK, ACCESS, TIA_Debug_BS_Do_End
3686 B462          M         btfsc   reg, bit, reg_a
3688 D0C0          M         bra     label
               00358     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG, ACCESS, TIA_Debug_BS_Do_Clr
368A A05B          M         btfss   reg, bit, reg_a
368C D0BA          M         bra     label
368E 905B      00359     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3690 EC2D F01A 00360     call        DEBUG_MSG_SendHeader
               00361 
3694 EC4E F01A 00362         call    DEBUG_MSG_SendASMString
3698 7845 2E74 00363     db  "Ext. BS R/W Debug:", 0
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 61


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     4220 2053 
     2F52 2057 
     6544 7562 
     3A67 0000 
               00364     
36AC 00365 TIA_Debug_BS_Do_Read
               00366     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_BS_Do_Write
36AC B25B          M         btfsc   reg, bit, reg_a
36AE D016          M         bra     label
36B0 EC4E F01A 00367         call    DEBUG_MSG_SendASMString
36B4 5220 6165 00368     db  " Read Bank:", 0
     2064 6142 
     6B6E 003A 
36C0 505E      00369     movf        TIA_DEBUG_BS_REG3, W
36C2 EC79 F01A 00370     call        DEBUG_MSG_SendBCD3
36C6 EC4E F01A 00371         call    DEBUG_MSG_SendASMString
36CA 5020 6572 00372     db  " Preset:", 0
     6573 3A74 
     0000      
36D4 505F      00373     movf        TIA_DEBUG_BS_REG4, W
36D6 EC79 F01A 00374     call        DEBUG_MSG_SendBCD3
               00375     rgoto   TIA_Debug_BS_Do_ReadWrite_End
36DA D025          M         bra     label
36DC 00376 TIA_Debug_BS_Do_Write
36DC EC4E F01A 00377     call        DEBUG_MSG_SendASMString
36E0 5720 6972 00378     db  " Write Bank:", 0
     6574 4220 
     6E61 3A6B 
     0000      
36EE 505E      00379     movf        TIA_DEBUG_BS_REG3, W
36F0 EC79 F01A 00380     call        DEBUG_MSG_SendBCD3
36F4 EC4E F01A 00381         call    DEBUG_MSG_SendASMString
36F8 5020 6572 00382     db  " Preset:", 0
     6573 3A74 
     0000      
3702 505F      00383     movf        TIA_DEBUG_BS_REG4, W
3704 EC79 F01A 00384     call        DEBUG_MSG_SendBCD3
3708 00385 TIA_Debug_BS_Do_Write_byte
               00386     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE, ACCESS, TIA_Debug_BS_Do_Write_Page
3708 B45B          M         btfsc   reg, bit, reg_a
370A D007          M         bra     label
370C EC4E F01A 00387     call        DEBUG_MSG_SendASMString
3710 2D20 6220 00388     db  " - byte", 0    
     7479 0065 
               00389     rgoto   TIA_Debug_BS_Do_ReadWrite_End
3718 D006          M         bra     label
371A 00390 TIA_Debug_BS_Do_Write_Page    
371A EC4E F01A 00391     call        DEBUG_MSG_SendASMString
371E 2D20 7020 00392     db  " - page", 0    
     6761 0065 
3726 00393 TIA_Debug_BS_Do_ReadWrite_End
               00394     
3726 00395 TIA_Debug_BS_Do_PInit
               00396     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PINIT, ACCESS, TIA_Debug_BS_Do_PInit_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 62


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3726 AC5B          M         btfss   reg, bit, reg_a
3728 D00A          M         bra     label
372A EC4E F01A 00397         call    DEBUG_MSG_SendASMString
372E 2820 7250 00398     db  " (Preset Init)", 0
     7365 7465 
     4920 696E 
     2974 0000 
373E 00399 TIA_Debug_BS_Do_PInit_End
               00400 
373E 00401 TIA_Debug_BS_Do_Sysex
               00402     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_SYX, ACCESS, TIA_Debug_BS_Do_Sysex_End
373E AE5B          M         btfss   reg, bit, reg_a
3740 D00A          M         bra     label
3742 EC4E F01A 00403         call    DEBUG_MSG_SendASMString
3746 2820 7953 00404     db  " (Sysex Action)", 0
     6573 2078 
     6341 6974 
     6E6F 0029 
3756 00405 TIA_Debug_BS_Do_Sysex_End
               00406 
3756 00407 TIA_Debug_BS_Do_Read_Cont
               00408     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_BS_Do_Read_Cont_End
3756 B25B          M         btfsc   reg, bit, reg_a
3758 D003          M         bra     label
375A EC4E F01A 00409         call    DEBUG_MSG_SendASMString
375E 002E      00410     db  ".", 0
3760 00411 TIA_Debug_BS_Do_Read_Cont_End
               00412 
3760 00413 TIA_Debug_BS_Do_Write_Ok
               00414     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW, ACCESS, TIA_Debug_BS_Do_WriteError_End
3760 A25B          M         btfss   reg, bit, reg_a
3762 D04D          M         bra     label
               00415     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR, ACCESS, TIA_Debug_BS_Do_Write_Error
3764 B65B          M         btfsc   reg, bit, reg_a
3766 D007          M         bra     label
3768 EC4E F01A 00416         call    DEBUG_MSG_SendASMString
376C 2D20 4F20 00417     db  " - Ok.", 0
     2E6B 0000 
               00418     rgoto   TIA_Debug_BS_Do_WriteError_End
3774 D044          M         bra     label
               00419     
3776 00420 TIA_Debug_BS_Do_Write_Error
3776 EC4E F01A 00421     call        DEBUG_MSG_SendASMString
377A 2D20 4520 00422     db  " - Error:", 0
     7272 726F 
     003A      
3784 00423 TIA_Debug_BS_Do_Write_ErrorReadonly
               00424     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_READONLY, ACCESS, TIA_Debug_BS_Do_Write_ErrorBS
3784 A85B          M         btfss   reg, bit, reg_a
3786 D00E          M         bra     label
3788 EC4E F01A 00425     call        DEBUG_MSG_SendASMString
378C 4220 2053 00426     db  " BS in ReadOnly Mode.", 0    
     6E69 5220 
     6165 4F64 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 63


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     6C6E 2079 
     6F4D 6564 
     002E      
               00427     rgoto   TIA_Debug_BS_Do_WriteError_End
37A2 D02D          M         bra     label
37A4 00428 TIA_Debug_BS_Do_Write_ErrorBS  
               00429     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_WRERR, ACCESS, TIA_Debug_BS_Do_WriteError_End 
37A4 AA5B          M         btfss   reg, bit, reg_a
37A6 D02B          M         bra     label
37A8 505D      00430     movf        TIA_DEBUG_BS_REG2, W
37AA EC79 F01A 00431     call        DEBUG_MSG_SendBCD3
37AE EC4E F01A 00432     call        DEBUG_MSG_SendASMString
37B2 4220 2053 00433     db  " BS Write problem(s)", 0   
     7257 7469 
     2065 7270 
     626F 656C 
     286D 2973 
     0000      
37C8 00434 TIA_Debug_BS_Do_WriteError_Mismatch
               00435     BRA_IFCLR TIA_DEBUG_BS_REG1, 0, ACCESS, TIA_Debug_BS_Do_WriteError_BSAbsent 
37C8 A05C          M         btfss   reg, bit, reg_a
37CA D00B          M         bra     label
37CC EC4E F01A 00436     call        DEBUG_MSG_SendASMString
37D0 6228 7479 00437     db  "(byte mismatch).", 0    
     2065 696D 
     6D73 7461 
     6863 2E29 
     0000      
37E2 00438 TIA_Debug_BS_Do_WriteError_BSAbsent
               00439     BRA_IFCLR TIA_DEBUG_BS_REG1, 1, ACCESS, TIA_Debug_BS_Do_WriteError_End 
37E2 A25C          M         btfss   reg, bit, reg_a
37E4 D00C          M         bra     label
37E6 EC4E F01A 00440     call        DEBUG_MSG_SendASMString
37EA 4228 2053 00441     db  "(BS not available).", 0    
     6F6E 2074 
     7661 6961 
     616C 6C62 
     2965 002E 
37FE 00442 TIA_Debug_BS_Do_WriteError_End
               00443 
               00444     
37FE 00445 TIA_Debug_BS_Do_Footer
37FE EC47 F01A 00446         call    DEBUG_MSG_SendFooter
3802 00447 TIA_Debug_BS_Do_Clr
3802 6A5B      00448     clrf TIA_DEBUG_BS_REGA
3804 6B62      00449     clrf TIA_DEBUG_BS_REGB
3806 6A5C      00450     clrf TIA_DEBUG_BS_REG1
3808 6A5D      00451     clrf TIA_DEBUG_BS_REG2
               00452     ;;rgoto TIA_Debug_BS_End   
               00453     
380A 00454 TIA_Debug_BS_Do_End
               00455 
               00456 
380A 0012      00457     return
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 64


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00458 
               00459 
               00460 
               00461 ;; --------------------------------------------------------------------------
               00462 ;;  Check for changes in TIA registers, transfer values to TIA
               00463 ;;  and handle Wavetable
               00464 ;; --------------------------------------------------------------------------
               00465 
380C 00466 TIA_Debug_BS_Check 
               00467     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK, ACCESS, TIA_Debug_BS_Check_End
380C A462          M         btfss   reg, bit, reg_a
380E D2B1          M         bra     label
               00468     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG, ACCESS, TIA_Debug_BS_Check_End
3810 A05B          M         btfss   reg, bit, reg_a
3812 D2AF          M         bra     label
3814 905B      00469     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3816 EC2D F01A 00470     call        DEBUG_MSG_SendHeader
               00471 
381A EC4E F01A 00472         call    DEBUG_MSG_SendASMString
381E 5342 4320 00473     db  "BS Check Debug:", 0
     6568 6B63 
     4420 6265 
     6775 003A 
               00474 #if DEFAULT_TIA_DEBUG_BS_MODE    
               00475     ;; checked Bank    
382E EC4E F01A 00476         call    DEBUG_MSG_SendASMString
3832 4220 6E61 00477     db  " Bank:", 0
     3A6B 0000 
383A 5019      00478     movf    TIA_BANKSTICK_CHK_CTR, W
383C EC79 F01A 00479     call        DEBUG_MSG_SendBCD3
               00480 
3840 EC4E F01A 00481         call    DEBUG_MSG_SendASMString
3844 202C 5342 00482     db  ", BS addr:", 0
     6120 6464 
     3A72 0000 
3850 501A      00483     movf        TIA_BANKSTICK_ID, W
3852 EC79 F01A 00484     call        DEBUG_MSG_SendBCD3
               00485     
3856 EC4E F01A 00486     call        DEBUG_MSG_SendASMString
385A 202C 6F42 00487     db  ", Box Status:", 0
     2078 7453 
     7461 7375 
     003A      
3868 505C      00488     movf        TIA_DEBUG_BS_REG1, W
386A EC79 F01A 00489     call        DEBUG_MSG_SendBCD3
               00490 
               00491 
               00492     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_IntExt
386E A862          M         btfss   reg, bit, reg_a
3870 D17D          M         bra     label
3872 EC4E F01A 00493         call    DEBUG_MSG_SendASMString
3876 202C 6142 00494     db  ", Bank addr:", 0
     6B6E 6120 
     6464 3A72 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 65


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     0000      
3884 505D      00495     movf        TIA_DEBUG_BS_REG2, W
3886 EC79 F01A 00496     call        DEBUG_MSG_SendBCD3
               00497     
388A EC4E F01A 00498         call    DEBUG_MSG_SendASMString
388E 202C 614D 00499     db  ", Magic0:", 0
     6967 3063 
     003A      
3898 505E      00500     movf        TIA_DEBUG_BS_REG3, W
389A EC79 F01A 00501     call        DEBUG_MSG_SendBCD3
               00502     
389E EC4E F01A 00503         call    DEBUG_MSG_SendASMString
38A2 4D20 6761 00504     db  " Magic1:", 0
     6369 3A31 
     0000      
38AC 505F      00505     movf        TIA_DEBUG_BS_REG4, W
38AE EC79 F01A 00506     call        DEBUG_MSG_SendBCD3
               00507   
38B2 EC4E F01A 00508         call    DEBUG_MSG_SendASMString
38B6 202C 5342 00509     db  ", BS Status:", 0
     5320 6174 
     7574 3A73 
     0000      
38C4 501C      00510     movf        TIA_BANKSTICK_STAT, W
38C6 EC79 F01A 00511     call        DEBUG_MSG_SendBCD3
38CA EC4E F01A 00512         call    DEBUG_MSG_SendASMString
38CE 002F      00513     db  "/", 0
               00514         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 7
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
38D0 AE1C          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
38D2 D004          M         bra     label
38D4     M TIA_Debug_WRITEBINx_1
38D4 EC4E F01A     M     call        DEBUG_MSG_SendASMString
38D8 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
38DA D003          M         bra     label
38DC     M TIA_Debug_WRITEBINx_0
38DC EC4E F01A     M     call        DEBUG_MSG_SendASMString
38E0 0030          M     db  "0", 0
38E2     M TIA_Debug_WRITEBINx_End
               00515         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 6 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
38E2 AC1C          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
38E4 D004          M         bra     label
38E6     M TIA_Debug_WRITEBINx_1
38E6 EC4E F01A     M     call        DEBUG_MSG_SendASMString
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 66


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
38EA 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
38EC D003          M         bra     label
38EE     M TIA_Debug_WRITEBINx_0
38EE EC4E F01A     M     call        DEBUG_MSG_SendASMString
38F2 0030          M     db  "0", 0
38F4     M TIA_Debug_WRITEBINx_End
               00516         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 5
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
38F4 AA1C          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
38F6 D004          M         bra     label
38F8     M TIA_Debug_WRITEBINx_1
38F8 EC4E F01A     M     call        DEBUG_MSG_SendASMString
38FC 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
38FE D003          M         bra     label
3900     M TIA_Debug_WRITEBINx_0
3900 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3904 0030          M     db  "0", 0
3906     M TIA_Debug_WRITEBINx_End
               00517         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 4 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3906 A81C          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3908 D004          M         bra     label
390A     M TIA_Debug_WRITEBINx_1
390A EC4E F01A     M     call        DEBUG_MSG_SendASMString
390E 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3910 D003          M         bra     label
3912     M TIA_Debug_WRITEBINx_0
3912 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3916 0030          M     db  "0", 0
3918     M TIA_Debug_WRITEBINx_End
               00518         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 3
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3918 A61C          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
391A D004          M         bra     label
391C     M TIA_Debug_WRITEBINx_1
391C EC4E F01A     M     call        DEBUG_MSG_SendASMString
3920 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3922 D003          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 67


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3924     M TIA_Debug_WRITEBINx_0
3924 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3928 0030          M     db  "0", 0
392A     M TIA_Debug_WRITEBINx_End
               00519         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 2 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
392A A41C          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
392C D004          M         bra     label
392E     M TIA_Debug_WRITEBINx_1
392E EC4E F01A     M     call        DEBUG_MSG_SendASMString
3932 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3934 D003          M         bra     label
3936     M TIA_Debug_WRITEBINx_0
3936 EC4E F01A     M     call        DEBUG_MSG_SendASMString
393A 0030          M     db  "0", 0
393C     M TIA_Debug_WRITEBINx_End
               00520         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 1
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
393C A21C          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
393E D004          M         bra     label
3940     M TIA_Debug_WRITEBINx_1
3940 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3944 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3946 D003          M         bra     label
3948     M TIA_Debug_WRITEBINx_0
3948 EC4E F01A     M     call        DEBUG_MSG_SendASMString
394C 0030          M     db  "0", 0
394E     M TIA_Debug_WRITEBINx_End
               00521         TIA_Debug_WRITEBINx TIA_BANKSTICK_STAT, 0 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
394E A01C          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3950 D004          M         bra     label
3952     M TIA_Debug_WRITEBINx_1
3952 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3956 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3958 D003          M         bra     label
395A     M TIA_Debug_WRITEBINx_0
395A EC4E F01A     M     call        DEBUG_MSG_SendASMString
395E 0030          M     db  "0", 0
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 68


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3960     M TIA_Debug_WRITEBINx_End
               00522     ;movf       TIA_BANKSTICK_STAT, W
               00523     ;call       DEBUG_MSG_SendBCD3
               00524     
               00525     
3960 EC4E F01A 00526     call        DEBUG_MSG_SendASMString
3964 202C 5342 00527     db  ", BS Type:", 0
     5420 7079 
     3A65 0000 
3970 5163      00528     movf        TIA_DEBUG_BS_REG9, W
3972 EC79 F01A 00529     call        DEBUG_MSG_SendBCD3
3976 EC4E F01A 00530         call    DEBUG_MSG_SendASMString
397A 002F      00531     db  "/", 0
               00532     TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 7
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
397C AF63          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
397E D004          M         bra     label
3980     M TIA_Debug_WRITEBINx_1
3980 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3984 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3986 D003          M         bra     label
3988     M TIA_Debug_WRITEBINx_0
3988 EC4E F01A     M     call        DEBUG_MSG_SendASMString
398C 0030          M     db  "0", 0
398E     M TIA_Debug_WRITEBINx_End
               00533         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 6 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
398E AD63          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3990 D004          M         bra     label
3992     M TIA_Debug_WRITEBINx_1
3992 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3996 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3998 D003          M         bra     label
399A     M TIA_Debug_WRITEBINx_0
399A EC4E F01A     M     call        DEBUG_MSG_SendASMString
399E 0030          M     db  "0", 0
39A0     M TIA_Debug_WRITEBINx_End
               00534         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 5
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
39A0 AB63          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 69


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
39A2 D004          M         bra     label
39A4     M TIA_Debug_WRITEBINx_1
39A4 EC4E F01A     M     call        DEBUG_MSG_SendASMString
39A8 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
39AA D003          M         bra     label
39AC     M TIA_Debug_WRITEBINx_0
39AC EC4E F01A     M     call        DEBUG_MSG_SendASMString
39B0 0030          M     db  "0", 0
39B2     M TIA_Debug_WRITEBINx_End
               00535         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 4 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
39B2 A963          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
39B4 D004          M         bra     label
39B6     M TIA_Debug_WRITEBINx_1
39B6 EC4E F01A     M     call        DEBUG_MSG_SendASMString
39BA 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
39BC D003          M         bra     label
39BE     M TIA_Debug_WRITEBINx_0
39BE EC4E F01A     M     call        DEBUG_MSG_SendASMString
39C2 0030          M     db  "0", 0
39C4     M TIA_Debug_WRITEBINx_End
               00536         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 3
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
39C4 A763          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
39C6 D004          M         bra     label
39C8     M TIA_Debug_WRITEBINx_1
39C8 EC4E F01A     M     call        DEBUG_MSG_SendASMString
39CC 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
39CE D003          M         bra     label
39D0     M TIA_Debug_WRITEBINx_0
39D0 EC4E F01A     M     call        DEBUG_MSG_SendASMString
39D4 0030          M     db  "0", 0
39D6     M TIA_Debug_WRITEBINx_End
               00537         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 2 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
39D6 A563          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
39D8 D004          M         bra     label
39DA     M TIA_Debug_WRITEBINx_1
39DA EC4E F01A     M     call        DEBUG_MSG_SendASMString
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 70


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
39DE 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
39E0 D003          M         bra     label
39E2     M TIA_Debug_WRITEBINx_0
39E2 EC4E F01A     M     call        DEBUG_MSG_SendASMString
39E6 0030          M     db  "0", 0
39E8     M TIA_Debug_WRITEBINx_End
               00538         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 1
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
39E8 A363          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
39EA D004          M         bra     label
39EC     M TIA_Debug_WRITEBINx_1
39EC EC4E F01A     M     call        DEBUG_MSG_SendASMString
39F0 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
39F2 D003          M         bra     label
39F4     M TIA_Debug_WRITEBINx_0
39F4 EC4E F01A     M     call        DEBUG_MSG_SendASMString
39F8 0030          M     db  "0", 0
39FA     M TIA_Debug_WRITEBINx_End
               00539         TIA_Debug_WRITEBINx TIA_DEBUG_BS_REG9, 0 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
39FA A163          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
39FC D004          M         bra     label
39FE     M TIA_Debug_WRITEBINx_1
39FE EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A02 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3A04 D003          M         bra     label
3A06     M TIA_Debug_WRITEBINx_0
3A06 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A0A 0030          M     db  "0", 0
3A0C     M TIA_Debug_WRITEBINx_End
               00540     ;movf       TIA_BANKSTICK_SIZE, W
               00541     ;call       DEBUG_MSG_SendBCD3
               00542    
               00543 
3A0C EC4E F01A 00544     call        DEBUG_MSG_SendASMString
3A10 202C 5342 00545     db  ", BS Size:", 0
     5320 7A69 
     3A65 0000 
3A1C 501D      00546     movf        TIA_BANKSTICK_SIZE, W
3A1E EC79 F01A 00547     call        DEBUG_MSG_SendBCD3
3A22 EC4E F01A 00548         call    DEBUG_MSG_SendASMString
3A26 002F      00549     db  "/", 0
               00550     TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 7
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 71


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3A28 AE1D          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3A2A D004          M         bra     label
3A2C     M TIA_Debug_WRITEBINx_1
3A2C EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A30 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3A32 D003          M         bra     label
3A34     M TIA_Debug_WRITEBINx_0
3A34 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A38 0030          M     db  "0", 0
3A3A     M TIA_Debug_WRITEBINx_End
               00551         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 6 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3A3A AC1D          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3A3C D004          M         bra     label
3A3E     M TIA_Debug_WRITEBINx_1
3A3E EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A42 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3A44 D003          M         bra     label
3A46     M TIA_Debug_WRITEBINx_0
3A46 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A4A 0030          M     db  "0", 0
3A4C     M TIA_Debug_WRITEBINx_End
               00552         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 5
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3A4C AA1D          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3A4E D004          M         bra     label
3A50     M TIA_Debug_WRITEBINx_1
3A50 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A54 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3A56 D003          M         bra     label
3A58     M TIA_Debug_WRITEBINx_0
3A58 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A5C 0030          M     db  "0", 0
3A5E     M TIA_Debug_WRITEBINx_End
               00553         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 4 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 72


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M     
3A5E A81D          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3A60 D004          M         bra     label
3A62     M TIA_Debug_WRITEBINx_1
3A62 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A66 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3A68 D003          M         bra     label
3A6A     M TIA_Debug_WRITEBINx_0
3A6A EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A6E 0030          M     db  "0", 0
3A70     M TIA_Debug_WRITEBINx_End
               00554         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 3
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3A70 A61D          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3A72 D004          M         bra     label
3A74     M TIA_Debug_WRITEBINx_1
3A74 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A78 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3A7A D003          M         bra     label
3A7C     M TIA_Debug_WRITEBINx_0
3A7C EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A80 0030          M     db  "0", 0
3A82     M TIA_Debug_WRITEBINx_End
               00555         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 2 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3A82 A41D          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3A84 D004          M         bra     label
3A86     M TIA_Debug_WRITEBINx_1
3A86 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A8A 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3A8C D003          M         bra     label
3A8E     M TIA_Debug_WRITEBINx_0
3A8E EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A92 0030          M     db  "0", 0
3A94     M TIA_Debug_WRITEBINx_End
               00556         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 1
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3A94 A21D          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 73


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3A96 D004          M         bra     label
3A98     M TIA_Debug_WRITEBINx_1
3A98 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3A9C 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3A9E D003          M         bra     label
3AA0     M TIA_Debug_WRITEBINx_0
3AA0 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3AA4 0030          M     db  "0", 0
3AA6     M TIA_Debug_WRITEBINx_End
               00557         TIA_Debug_WRITEBINx TIA_BANKSTICK_SIZE, 0 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3AA6 A01D          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3AA8 D004          M         bra     label
3AAA     M TIA_Debug_WRITEBINx_1
3AAA EC4E F01A     M     call        DEBUG_MSG_SendASMString
3AAE 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3AB0 D003          M         bra     label
3AB2     M TIA_Debug_WRITEBINx_0
3AB2 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3AB6 0030          M     db  "0", 0
3AB8     M TIA_Debug_WRITEBINx_End
               00558     ;movf       TIA_BANKSTICK_SIZE, W
               00559     ;call       DEBUG_MSG_SendBCD3
               00560     
3AB8 EC4E F01A 00561         call    DEBUG_MSG_SendASMString
3ABC 202C 5342 00562     db  ", BS Ready:", 0
     5220 6165 
     7964 003A 
3AC8 501B      00563     movf        TIA_BANKSTICK_RDY, W
3ACA EC79 F01A 00564     call        DEBUG_MSG_SendBCD3
3ACE EC4E F01A 00565         call    DEBUG_MSG_SendASMString
3AD2 002F      00566     db  "/", 0
               00567         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 7
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3AD4 AE1B          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3AD6 D004          M         bra     label
3AD8     M TIA_Debug_WRITEBINx_1
3AD8 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3ADC 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3ADE D003          M         bra     label
3AE0     M TIA_Debug_WRITEBINx_0
3AE0 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3AE4 0030          M     db  "0", 0
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 74


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3AE6     M TIA_Debug_WRITEBINx_End
               00568         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 6 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3AE6 AC1B          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3AE8 D004          M         bra     label
3AEA     M TIA_Debug_WRITEBINx_1
3AEA EC4E F01A     M     call        DEBUG_MSG_SendASMString
3AEE 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3AF0 D003          M         bra     label
3AF2     M TIA_Debug_WRITEBINx_0
3AF2 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3AF6 0030          M     db  "0", 0
3AF8     M TIA_Debug_WRITEBINx_End
               00569         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 5
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3AF8 AA1B          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3AFA D004          M         bra     label
3AFC     M TIA_Debug_WRITEBINx_1
3AFC EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B00 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3B02 D003          M         bra     label
3B04     M TIA_Debug_WRITEBINx_0
3B04 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B08 0030          M     db  "0", 0
3B0A     M TIA_Debug_WRITEBINx_End
               00570         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 4 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3B0A A81B          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3B0C D004          M         bra     label
3B0E     M TIA_Debug_WRITEBINx_1
3B0E EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B12 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3B14 D003          M         bra     label
3B16     M TIA_Debug_WRITEBINx_0
3B16 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B1A 0030          M     db  "0", 0
3B1C     M TIA_Debug_WRITEBINx_End
               00571         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 3
                   M         LOCAL   TIA_Debug_WRITEBINx_1
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 75


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3B1C A61B          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3B1E D004          M         bra     label
3B20     M TIA_Debug_WRITEBINx_1
3B20 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B24 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3B26 D003          M         bra     label
3B28     M TIA_Debug_WRITEBINx_0
3B28 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B2C 0030          M     db  "0", 0
3B2E     M TIA_Debug_WRITEBINx_End
               00572         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 2 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3B2E A41B          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3B30 D004          M         bra     label
3B32     M TIA_Debug_WRITEBINx_1
3B32 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B36 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3B38 D003          M         bra     label
3B3A     M TIA_Debug_WRITEBINx_0
3B3A EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B3E 0030          M     db  "0", 0
3B40     M TIA_Debug_WRITEBINx_End
               00573         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 1
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
3B40 A21B          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3B42 D004          M         bra     label
3B44     M TIA_Debug_WRITEBINx_1
3B44 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B48 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3B4A D003          M         bra     label
3B4C     M TIA_Debug_WRITEBINx_0
3B4C EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B50 0030          M     db  "0", 0
3B52     M TIA_Debug_WRITEBINx_End
               00574         TIA_Debug_WRITEBINx TIA_BANKSTICK_RDY, 0 
                   M         LOCAL   TIA_Debug_WRITEBINx_1
                   M         LOCAL   TIA_Debug_WRITEBINx_0
                   M         LOCAL   TIA_Debug_WRITEBINx_End
                   M     
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 76


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3B52 A01B          M     btfss   REG, FLAG_b
                   M     rgoto   TIA_Debug_WRITEBINx_0
3B54 D004          M         bra     label
3B56     M TIA_Debug_WRITEBINx_1
3B56 EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B5A 0031          M     db  "1", 0
                   M     rgoto   TIA_Debug_WRITEBINx_End
3B5C D003          M         bra     label
3B5E     M TIA_Debug_WRITEBINx_0
3B5E EC4E F01A     M     call        DEBUG_MSG_SendASMString
3B62 0030          M     db  "0", 0
3B64     M TIA_Debug_WRITEBINx_End
               00575     
3B64 EC4E F01A 00576         call    DEBUG_MSG_SendASMString
3B68 202C 0000 00577     db  ", ", 0    
               00578 #endif  
               00579    
3B6C 00580 TIA_Debug_BS_Check_IntExt
               00581     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_Ext
3B6C B862          M         btfsc   reg, bit, reg_a
3B6E D019          M         bra     label
3B70 EC4E F01A 00582         call    DEBUG_MSG_SendASMString
3B74 4920 746E 00583     db  " Int. Patch /BS:", 0
     202E 6150 
     6374 2068 
     422F 3A53 
     0000      
3B86 501A      00584     movf        TIA_BANKSTICK_ID, W
3B88 EC79 F01A 00585     call        DEBUG_MSG_SendBCD3
3B8C EC4E F01A 00586         call    DEBUG_MSG_SendASMString
3B90 6420 7369 00587     db  " disconnected.", 0
     6F63 6E6E 
     6365 6574 
     2E64 0000 
               00588     rgoto   TIA_Debug_BS_Check_Footer
3BA0 D0E4          M         bra     label
3BA2 00589 TIA_Debug_BS_Check_Ext
               00590     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_IntExt_End
3BA2 A862          M         btfss   reg, bit, reg_a
3BA4 D005          M         bra     label
3BA6 EC4E F01A 00591     call        DEBUG_MSG_SendASMString
3BAA 4520 7478 00592     db  " Ext.", 0
     002E      
3BB0 00593 TIA_Debug_BS_Check_IntExt_End
               00594     
3BB0 00595 TIA_Debug_BS_Check_Size
               00596     ;;BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT, ACCESS, TIA_Debug_BS_Check_Size_End
               00597     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_Size_End
3BB0 A862          M         btfss   reg, bit, reg_a
3BB2 D00C          M         bra     label
               00598     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE, ACCESS, TIA_Debug_BS_Check_64k
3BB4 B662          M         btfsc   reg, bit, reg_a
3BB6 D004          M         bra     label
3BB8 EC4E F01A 00599     call        DEBUG_MSG_SendASMString
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 77


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3BBC 3233 006B 00600     db  "32k", 0
3BC0 00601 TIA_Debug_BS_Check_64k
               00602     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE, ACCESS, TIA_Debug_BS_Check_Size_End
3BC0 A662          M         btfss   reg, bit, reg_a
3BC2 D004          M         bra     label
3BC4 EC4E F01A 00603     call        DEBUG_MSG_SendASMString
3BC8 3436 006B 00604     db  "64k", 0
3BCC 00605 TIA_Debug_BS_Check_Size_End
               00606 
3BCC 00607 TIA_Debug_BS_Check_Type
               00608     ;;BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT, ACCESS, TIA_Debug_BS_Check_Type_End
               00609     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK, ACCESS, TIA_Debug_BS_Check_KWT
3BCC B062          M         btfsc   reg, bit, reg_a
3BCE D00B          M         bra     label
3BD0 EC4E F01A 00610     call        DEBUG_MSG_SendASMString
3BD4 2020 4250 00611     db  "  PBank", 0
     6E61 006B 
3BDC 5019      00612     movf    TIA_BANKSTICK_CHK_CTR, W
3BDE BA5B      00613     btfsc   TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS
3BE0 0B1C      00614     andlw   0x1c
3BE2 EC79 F01A 00615     call        DEBUG_MSG_SendBCD3  
3BE6 00616 TIA_Debug_BS_Check_KWT
               00617     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK, ACCESS, TIA_Debug_BS_Check_Type_End
3BE6 A062          M         btfss   reg, bit, reg_a
3BE8 D01B          M         bra     label
3BEA 00618 TIA_Debug_BS_Check_K
               00619     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT, ACCESS, TIA_Debug_BS_Check_WT
3BEA B262          M         btfsc   reg, bit, reg_a
3BEC D00B          M         bra     label
3BEE EC4E F01A 00620     call        DEBUG_MSG_SendASMString
3BF2 2020 424B 00621     db  "  KBank", 0
     6E61 006B 
3BFA 5019      00622     movf    TIA_BANKSTICK_CHK_CTR, W
3BFC BA5B      00623     btfsc   TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS
3BFE 0B1C      00624     andlw   0x1c
3C00 EC79 F01A 00625     call        DEBUG_MSG_SendBCD3  
3C04 00626 TIA_Debug_BS_Check_WT    
               00627     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT, ACCESS, TIA_Debug_BS_Check_Type_End
3C04 A262          M         btfss   reg, bit, reg_a
3C06 D00C          M         bra     label
3C08 9362      00628     bcf     TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
3C0A EC4E F01A 00629     call        DEBUG_MSG_SendASMString
3C0E 5720 4254 00630     db  " WTBank", 0
     6E61 006B 
3C16 5019      00631     movf    TIA_BANKSTICK_CHK_CTR, W
3C18 BA5B      00632     btfsc   TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS
3C1A 0B1C      00633     andlw   0x1c
3C1C EC79 F01A 00634     call        DEBUG_MSG_SendBCD3  
3C20 00635 TIA_Debug_BS_Check_Type_End
               00636 
               00637 
               00638 
3C20 00639 TIA_Debug_BS_Check_Ready
               00640     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT, ACCESS, TIA_Debug_BS_Check_Ready_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 78


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3C20 BA62          M         btfsc   reg, bit, reg_a
3C22 D02E          M         bra     label
               00641     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT, ACCESS, TIA_Debug_BS_Check_Ready_End
3C24 BC62          M         btfsc   reg, bit, reg_a
3C26 D02C          M         bra     label
               00642     BRA_IFSET TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_TPROTECT, ACCESS, TIA_Debug_BS_Check_Ready_End
3C28 BE62          M         btfsc   reg, bit, reg_a
3C2A D02A          M         bra     label
               00643     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_Ready_End
3C2C A862          M         btfss   reg, bit, reg_a
3C2E D028          M         bra     label
               00644     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS, TIA_Debug_BS_Check_ReadyOk
3C30 BA5B          M         btfsc   reg, bit, reg_a
3C32 D008          M         bra     label
3C34 EC4E F01A 00645         call    DEBUG_MSG_SendASMString
3C38 6C20 616F 00646     db  " loaded Ok", 0
     6564 2064 
     6B4F 0000 
3C44 00647 TIA_Debug_BS_Check_ReadyOk
               00648     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY, ACCESS, TIA_Debug_BS_Check_Ready_End
3C44 AA5B          M         btfss   reg, bit, reg_a
3C46 D01C          M         bra     label
3C48 EC4E F01A 00649         call    DEBUG_MSG_SendASMString
3C4C 002D      00650     db  "-", 0
3C4E 5019      00651     movf    TIA_BANKSTICK_CHK_CTR, W
3C50 0B1C      00652     andlw   0x1c
3C52 0F03      00653     addlw   0x03
3C54 EC79 F01A 00654     call        DEBUG_MSG_SendBCD3  
3C58 EC4E F01A 00655         call    DEBUG_MSG_SendASMString
3C5C 6C20 616F 00656     db  " loaded Ok /BS:", 0
     6564 2064 
     6B4F 2F20 
     5342 003A 
3C6C 501A      00657     movf        TIA_BANKSTICK_ID, W
3C6E EC79 F01A 00658     call        DEBUG_MSG_SendBCD3
3C72 EC4E F01A 00659         call    DEBUG_MSG_SendASMString
3C76 7220 6165 00660     db  " ready!", 0
     7964 0021 
3C7E 9A5B      00661     bcf     TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY
3C80 00662 TIA_Debug_BS_Check_Ready_End
               00663 
               00664 
3C80 00665 TIA_Debug_BS_Check_Format
               00666     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT, ACCESS, TIA_Debug_BS_Check_Format_End
3C80 AA62          M         btfss   reg, bit, reg_a
3C82 D00A          M         bra     label
3C84 9B62      00667     bcf     TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT
3C86 EC4E F01A 00668     call        DEBUG_MSG_SendASMString
3C8A 5220 6665 00669     db  " Reformated!", 0
     726F 616D 
     6574 2164 
     0000      
3C98 00670 TIA_Debug_BS_Check_Format_End
               00671 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 79


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3C98 00672 TIA_Debug_BS_Check_FormatProtect
               00673     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT, ACCESS, TIA_Debug_BS_Check_FormatProtect_End
3C98 AC62          M         btfss   reg, bit, reg_a
3C9A D021          M         bra     label
3C9C 9D62      00674     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT
3C9E EC4E F01A 00675         call    DEBUG_MSG_SendASMString
3CA2 002D      00676     db  "-", 0
3CA4 5019      00677     movf    TIA_BANKSTICK_CHK_CTR, W
3CA6 0B1C      00678     andlw   0x1c
3CA8 0F03      00679     addlw   0x03
3CAA EC79 F01A 00680     call        DEBUG_MSG_SendBCD3  
3CAE EC4E F01A 00681         call    DEBUG_MSG_SendASMString
3CB2 6E20 746F 00682     db  " not valid /BS:", 0
     7620 6C61 
     6469 2F20 
     5342 003A 
3CC2 501A      00683     movf        TIA_BANKSTICK_ID, W
3CC4 EC79 F01A 00684     call        DEBUG_MSG_SendBCD3
3CC8 EC4E F01A 00685     call        DEBUG_MSG_SendASMString
3CCC 2820 6F66 00686     db  " (format inhibit)", 0
     6D72 7461 
     6920 686E 
     6269 7469 
     0029      
3CDE 00687 TIA_Debug_BS_Check_FormatProtect_End
               00688 
3CDE 00689 TIA_Debug_BS_Check_TypeProtect
               00690     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_TPROTECT, ACCESS, TIA_Debug_BS_Check_TypeProtect_End
3CDE AE62          M         btfss   reg, bit, reg_a
3CE0 D021          M         bra     label
3CE2 9F62      00691     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_TPROTECT
3CE4 EC4E F01A 00692         call    DEBUG_MSG_SendASMString
3CE8 002D      00693     db  "-", 0
3CEA 5019      00694     movf    TIA_BANKSTICK_CHK_CTR, W
3CEC 0B1C      00695     andlw   0x1c
3CEE 0F03      00696     addlw   0x03
3CF0 EC79 F01A 00697     call        DEBUG_MSG_SendBCD3  
3CF4 EC4E F01A 00698         call    DEBUG_MSG_SendASMString
3CF8 6E20 746F 00699     db  " not valid /BS:", 0
     7620 6C61 
     6469 2F20 
     5342 003A 
3D08 501A      00700     movf        TIA_BANKSTICK_ID, W
3D0A EC79 F01A 00701     call        DEBUG_MSG_SendBCD3
3D0E EC4E F01A 00702     call        DEBUG_MSG_SendASMString
3D12 2820 7974 00703     db  " (type protected)", 0
     6570 7020 
     6F72 6574 
     7463 6465 
     0029      
3D24 00704 TIA_Debug_BS_Check_TypeProtect_End
               00705 
3D24 00706 TIA_Debug_BS_Check_Error
               00707     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT, ACCESS, TIA_Debug_BS_Check_Error_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 80


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3D24 A862          M         btfss   reg, bit, reg_a
3D26 D020          M         bra     label
               00708     BRA_IFCLR TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT, ACCESS, TIA_Debug_BS_Check_Error_End
3D28 AA62          M         btfss   reg, bit, reg_a
3D2A D01E          M         bra     label
               00709     BRA_IFCLR TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR, ACCESS, TIA_Debug_BS_Check_NoError
3D2C A65B          M         btfss   reg, bit, reg_a
3D2E D012          M         bra     label
3D30 5160      00710     movf        TIA_DEBUG_BS_REG5, W
3D32 EC79 F01A 00711     call        DEBUG_MSG_SendBCD3
3D36 EC4E F01A 00712     call        DEBUG_MSG_SendASMString
3D3A 4520 7272 00713     db  " Error(s), Last:", 0
     726F 7328 
     2C29 4C20 
     7361 3A74 
     0000      
3D4C 5161      00714     movf        TIA_DEBUG_BS_REG6, W
3D4E EC79 F01A 00715     call        DEBUG_MSG_SendBCD3
3D52 965B      00716     bcf     TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3D54 00717 TIA_Debug_BS_Check_NoError
               00718     BRA_IFSET TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR, ACCESS, TIA_Debug_BS_Check_Error_End
3D54 B65B          M         btfsc   reg, bit, reg_a
3D56 D008          M         bra     label
3D58 EC4E F01A 00719     call        DEBUG_MSG_SendASMString
3D5C 4E20 206F 00720     db  " No error.", 0
     7265 6F72 
     2E72 0000 
3D68 00721 TIA_Debug_BS_Check_Error_End
3D68 6B60      00722     clrf    TIA_DEBUG_BS_REG5
               00723     
3D6A 00724 TIA_Debug_BS_Check_Footer
3D6A EC47 F01A 00725         call    DEBUG_MSG_SendFooter
3D6E 00726 TIA_Debug_BS_Check_Clr
3D6E 6A5B      00727     clrf TIA_DEBUG_BS_REGA
3D70 6B62      00728     clrf TIA_DEBUG_BS_REGB
               00729 
               00730     ;;rgoto TIA_Debug_BS_Check_End
               00731   
3D72 00732 TIA_Debug_BS_Check_End
3D72 0012      00733     return
               00734 
               00735 
               00736 
               00375 #endif
               00376 
               00377 ;; ---[ TIA kernel ]---
               00378 #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 ;
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 81


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 ;; --------------------------------------------------------------------------
3D74 00033 TIA_LEDMTR_Init
3D74 6B6A      00034     clrf    TIA_LEDMTR_STAT
3D76 6B6B      00035     clrf    TIA_LEDMTR_VALUE
3D78 0012      00036     return
               00037         ;; reset will be released with first call of TIA_SR_Handler
               00038 
               00039 ;; --------------------------------------------------------------------------
               00040 ;;  LEDMTR module Handler
               00041 ;; --------------------------------------------------------------------------
3D7A 00042 TIA_LEDMTR_Handler
               00043         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
3D7A 0101          M         movlb   HIGH(reg)
               00044     ;; Template run prioity
               00045     BRA_IFCLR TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ, ACCESS, TIA_LEDMTR_Handler_End
3D7C A06A          M         btfss   reg, bit, reg_a
3D7E D021          M         bra     label
               00046     
3D80 00047 TIA_LEDMTR_Handler_Meter_Norm     
               00048     ;;BRA_IFSET TIA_LEDMTR_STAT, TIA_LEDMTR_TIA_MODE, ACCESS, TIA_LEDMTR_Handler_Meter_Sampler
3D80 916A      00049     bcf     TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ
               00050 
3D82 6B6B      00051     clrf    TIA_LEDMTR_VALUE
3D84 0E01      00052     movlw   0x01
3D86 6104      00053     cpfslt  TIA_AUDV0
3D88 8F6B      00054     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR0
3D8A 0E07      00055     movlw   0x07
3D8C 6104      00056     cpfslt  TIA_AUDV0
3D8E 8D6B      00057     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR1
3D90 0E0B      00058     movlw   0x0b
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 82


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3D92 6104      00059     cpfslt  TIA_AUDV0
3D94 8B6B      00060     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR2
3D96 0E0E      00061     movlw   0x0e
3D98 6104      00062     cpfslt  TIA_AUDV0
3D9A 896B      00063     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR3
               00064     
3D9C 0E01      00065     movlw   0x01
3D9E 6105      00066     cpfslt  TIA_AUDV1
3DA0 876B      00067     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR4
3DA2 0E07      00068     movlw   0x07
3DA4 6105      00069     cpfslt  TIA_AUDV1
3DA6 856B      00070     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR5
3DA8 0E0B      00071     movlw   0x0b
3DAA 6105      00072     cpfslt  TIA_AUDV1
3DAC 836B      00073     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR6
3DAE 0E0E      00074     movlw   0x0e
3DB0 6105      00075     cpfslt  TIA_AUDV1
3DB2 816B      00076     bsf     TIA_LEDMTR_VALUE, TIA_LEDMTR7 
               00077 
3DB4 516B      00078     movf    TIA_LEDMTR_VALUE, W
3DB6 6E03      00079     movwf   MIOS_PARAMETER1
               00080     rgoto   TIA_LEDMTR_Handler_Set
3DB8 D001          M         bra     label
               00081     
3DBA 00082 TIA_LEDMTR_Handler_Meter_Sampler 
3DBA 6A03      00083     clrf    MIOS_PARAMETER1
               00084     ; To Do
               00085     ;;rgoto   TIA_LEDMTR_Handler_Set
               00086 
3DBC 00087 TIA_LEDMTR_Handler_Set
3DBC 0E00      00088     movlw   TIA_LEDMTR_REG
3DBE EC68 F016 00089     call    MIOS_DOUT_SRSet
               00090 
3DC2 00091 TIA_LEDMTR_Handler_End
3DC2 0012      00092         return
               00093 
               00094 ;; --------------------------------------------------------------------------
               00095 ;;  TIA_LEDMTR Led Pattern orange to green
               00096 ;; --------------------------------------------------------------------------
3DC4 00097 TIA_LEDMTR_PlayFormat
3DC4 D82D      00098         rcall   TIA_LEDMTR_Player_Init
               00099 
3DC6 00100 TIA_LEDMTR_PlayFormat_R
3DC6 D82C      00101         rcall   TIA_LEDMTR_Player_Init
3DC8 0E11      00102         movlw   0x11
3DCA D83D      00103         rcall   TIA_LEDMTR_Player_On_Wait01
3DCC 0E03      00104         movlw   0x03
3DCE D83E      00105         rcall   TIA_LEDMTR_Wait
               00106         rgoto   TIA_LEDMTR_End
3DD0 D026          M         bra     label
               00107 
3DD2 00108 TIA_LEDMTR_PlayFormat_O
3DD2 D826      00109         rcall   TIA_LEDMTR_Player_Init
3DD4 0E33      00110         movlw   0x33
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 83


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3DD6 D837      00111         rcall   TIA_LEDMTR_Player_On_Wait01
3DD8 0E01      00112         movlw   0x01
3DDA D838      00113         rcall   TIA_LEDMTR_Wait
               00114         rgoto   TIA_LEDMTR_End
3DDC D020          M         bra     label
               00115 
3DDE 00116 TIA_LEDMTR_PlayFormat_G1
3DDE D820      00117         rcall   TIA_LEDMTR_Player_Init
3DE0 0E77      00118         movlw   0x77
3DE2 D831      00119         rcall   TIA_LEDMTR_Player_On_Wait01
3DE4 0E03      00120         movlw   0x03
3DE6 D832      00121         rcall   TIA_LEDMTR_Wait
               00122         rgoto   TIA_LEDMTR_End
3DE8 D01A          M         bra     label
               00123 
3DEA 00124 TIA_LEDMTR_PlayFormat_G2
3DEA D81A      00125         rcall   TIA_LEDMTR_Player_Init
3DEC 0EFF      00126         movlw   0xff
3DEE D82B      00127         rcall   TIA_LEDMTR_Player_On_Wait01
3DF0 0E03      00128         movlw   0x03
3DF2 D82C      00129         rcall   TIA_LEDMTR_Wait
               00130         rgoto   TIA_LEDMTR_End
3DF4 D014          M         bra     label
               00131     
               00132 ;; --------------------------------------------------------------------------
               00133 ;;  TIA_LEDMTR Led Pattern orange to green
               00134 ;; --------------------------------------------------------------------------
3DF6 00135 TIA_LEDMTR_PlayOtoG
3DF6 D814      00136         rcall   TIA_LEDMTR_Player_Init
               00137 
3DF8 0E22      00138         movlw   0x22
3DFA D825      00139         rcall   TIA_LEDMTR_Player_On_Wait01
3DFC 0E03      00140         movlw   0x03
3DFE D826      00141         rcall   TIA_LEDMTR_Wait
3E00 0E44      00142         movlw   0x44
3E02 D821      00143         rcall   TIA_LEDMTR_Player_On_Wait01
3E04 0E03      00144         movlw   0x03
3E06 D822      00145         rcall   TIA_LEDMTR_Wait
3E08 0E88      00146         movlw   0x88
3E0A D81D      00147         rcall   TIA_LEDMTR_Player_On_Wait01
               00148 
               00149         rgoto   TIA_LEDMTR_End
3E0C D008          M         bra     label
               00150     
               00151 ;; --------------------------------------------------------------------------
               00152 ;;  TIA_LEDMTR Led Pattern orange to red
               00153 ;; --------------------------------------------------------------------------
3E0E 00154 TIA_LEDMTR_PlayOtoR
3E0E D808      00155         rcall   TIA_LEDMTR_Player_Init
               00156 
3E10 0E22      00157         movlw   0x22
3E12 D819      00158         rcall   TIA_LEDMTR_Player_On_Wait01
3E14 0E03      00159         movlw   0x03
3E16 D81A      00160         rcall   TIA_LEDMTR_Wait
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 84


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3E18 0E11      00161         movlw   0x11
3E1A D815      00162         rcall   TIA_LEDMTR_Player_On_Wait01
               00163 
               00164         rgoto   TIA_LEDMTR_End
3E1C D000          M         bra     label
               00165     
               00166 
               00167 
               00168 ;; --------------------------------------------------------------------------
               00169 ;;  TIA_LEDMTR End 
               00170 ;; --------------------------------------------------------------------------
3E1E 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
3E1E 0012      00174     return
               00175 
               00176 
               00177 ;; --------------------------------------------------------------------------
               00178 ;;  TIA_LEDMTR Initialization routine
               00179 ;; --------------------------------------------------------------------------
3E20 00180 TIA_LEDMTR_Player_Init
3E20 8010      00181         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn off TIA software synth part
               00182 
               00183         SET_BSR TIA_BASE
3E22 0101          M         movlb   HIGH(reg)
3E24 6A03      00184     clrf    MIOS_PARAMETER1
3E26 0E00      00185     movlw   TIA_LEDMTR_REG
3E28 EC68 F016 00186     call    MIOS_DOUT_SRSet
3E2C 0012      00187     return
               00188 ;; --------------------------------------------------------------------------
               00189 ;;  TIA_LEDMTR a note (in: Note Number)
               00190 ;; --------------------------------------------------------------------------
3E2E 00191 TIA_LEDMTR_Player_On
               00192         SET_BSR TIA_BASE
3E2E 0101          M         movlb   HIGH(reg)
3E30 6E03      00193     movwf   MIOS_PARAMETER1
3E32 0E00      00194     movlw   TIA_LEDMTR_REG
3E34 EC68 F016 00195     call    MIOS_DOUT_SRSet
3E38 0012      00196     return
               00197 
3E3A 00198 TIA_LEDMTR_Player_Off
               00199         SET_BSR TIA_BASE
3E3A 0101          M         movlb   HIGH(reg)
3E3C 6A03      00200     clrf    MIOS_PARAMETER1
3E3E 0E00      00201     movlw   TIA_LEDMTR_REG
3E40 EC68 F016 00202     call    MIOS_DOUT_SRSet
3E44 0012      00203     return
               00204     
3E46 00205 TIA_LEDMTR_Player_On_Wait01
3E46 DFF3      00206         rcall   TIA_LEDMTR_Player_On
3E48 0E01      00207         movlw   0x01
               00208         rgoto   TIA_LEDMTR_Wait
3E4A D000          M         bra     label
               00209     
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 85


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00210 
               00211 ;; --------------------------------------------------------------------------
               00212 ;;  TIA_LEDMTR wait for a certain time and poll TIA_SR Handler
               00213 ;; --------------------------------------------------------------------------
3E4C 00214 TIA_LEDMTR_Wait
3E4C 6E06      00215         movwf   TMP1
3E4E 0004      00216         clrwdt
3E50 00217 TIA_LEDMTR_WaitLoop
3E50 0E0A      00218         movlw   10
3E52 ECCE F016 00219         call    MIOS_Delay
3E56 2E06      00220         decfsz  TMP1, F
               00221         rgoto   TIA_LEDMTR_WaitLoop
3E58 D7FB          M         bra     label
3E5A 0012      00222         return
               00223 
               00379 ;#include "tia_lcd.inc"
               00380 #include "tia_patch.inc"
               00001 ; $Id: tia_patch.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; TIA Patch routines
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               00011 ; ==========================================================================
               00012 
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  Init Routine for patch parameters
               00016 ;;  Note that the MIDI events are initialized separately, this routine will
               00017 ;;  be called on power-on and after a new MIDI dump has been loaded
               00018 ;; --------------------------------------------------------------------------
3E5C 00019 TIA_PATCH_Init
               00020         ;; disable TIA engine
3E5C 8010      00021         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00022 
               00023         ;; clear the whole TIA SFR memory space
3E5E 0E00      00024         movlw   ((TIA_SW_CLEAR_END-TIA_SW_CLEAR_BEGIN)+1) & 0xff
3E60 6E06      00025         movwf   TMP1
3E62 EE01 F000 00026         lfsr    FSR0, TIA_SW_CLEAR_BEGIN
3E66 00027 TIA_PATCH_Init_ClearLoop
3E66 6AEE      00028         clrf    POSTINC0
3E68 2E06      00029         decfsz  TMP1, F
               00030         rgoto   TIA_PATCH_Init_ClearLoop
3E6A D7FD          M         bra     label
               00031 
               00032         ;; fetch 128 TIA parameters from EEPROM
3E6C 6A06      00033         clrf    TMP1
3E6E 0E00      00034     movlw   EEPROM_PATCH & 0xff
3E70 6EA9      00035         movwf   EEADR
3E72 0E00      00036     movlw   (EEPROM_PATCH >> 8) & 0xff
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 86


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
3E74 6EAA      00037     movwf   EEADRH
3E76 C014 F011 00038     movff   TIA_PBANK, TIA_BANK
3E7A C013 F012 00039     movff   TIA_PATCH, TIA_PRESET
3E7E 00040 TIA_PATCH_InitEELoop
3E7E 5006      00041         movf    TMP1, W
3E80 ECDC F031 00042         call    TIA_SYSEX_TABLE_Get; get CC number
3E84 6E07      00043         movwf   TMP2            ; temporary store number in TMP2
               00044 
3E86 C006 FFA9 00045         movff   TMP1, EEADR     ; read parameter from current TIA bank
3E8A EC08 F020 00046         call    TIA_BANK_Read
3E8E 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
3E90 BE07          M         btfsc   reg, bit, reg_a
3E92 D004          M         bra     label
3E94 00051 TIA_PATCH_InitEELoopN
               00052         ;; if TMP2[7] == 0, then set CC parameter
3E94 5007      00053         movf    TMP2, W
3E96 EC5C F02F 00054         call    TIA_CCIN_Set
               00055         rgoto   TIA_PATCH_InitEELoopC
3E9A D008          M         bra     label
3E9C 00056 TIA_PATCH_InitEELoopS
               00057         ;; if TMP2[7..4] == 9, then set split point
3E9C 5007      00058         movf    TMP2, W
3E9E 0BF0      00059         andlw   0xf0
3EA0 0A90      00060         xorlw   0x90
3EA2 E104      00061         bnz     TIA_PATCH_InitEELoopC
3EA4 5007      00062         movf    TMP2, W
3EA6 D81F      00063         rcall   TIA_PATCH_GetSplitPointer
3EA8 C003 FFE7 00064         movff   MIOS_PARAMETER1, INDF1
3EAC 00065 TIA_PATCH_InitEELoopC
               00066 
3EAC 2A06      00067         incf    TMP1, F         ; increment CC counter, loop until 0x80
               00068         BRA_IFCLR TMP1, 7, ACCESS, TIA_PATCH_InitEELoop
3EAE AE06          M         btfss   reg, bit, reg_a
3EB0 D7E6          M         bra     label
               00069 
               00070         ;; get and store the MIDI channels
3EB2 0E7C      00071         movlw   EEPROM_CFG_BASE & 0xff
3EB4 6EA9      00072         movwf   EEADR
3EB6 ECB0 F016 00073         call    MIOS_EEPROM_Read
3EBA CFE8 F160 00074         movff   WREG, TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL
3EBE ECB0 F016 00075         call    MIOS_EEPROM_Read
3EC2 CFE8 F120 00076         movff   WREG, TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL
               00077         ;; get and store the device ID
3EC6 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
3ECA EC04 F016 00081         call    MIOS_MIDI_DeviceIDGet
               00082 #endif
3ECE 6E20      00083         movwf   TIA_MIDI_DEVICE
               00084     
3ED0 ECB0 F016 00085     call        MIOS_EEPROM_Read
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 87


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00086     ;; Empty
               00087 
               00088         ;; force a refresh of all registers
3ED4 8210      00089         bsf     TIA_STAT, TIA_STAT_FORCE_REFRESH
               00090 
               00091         ;; enable TIA engine again
3ED6 9010      00092         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00093 
               00094 #if DEFAULT_TIA_DEBUG_ON == 1 
3ED8 8D64      00095     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PINIT
3EDA ECA3 F01A 00096     call    TIA_Debug_EE_Do
3EDE 8C5B      00097     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PINIT
3EE0 EC43 F01B 00098     call    TIA_Debug_BS_Do
               00099 #endif
3EE4 0012      00100         return
               00101 
               00102 
               00103 
               00104 ;; --------------------------------------------------------------------------
               00105 ;;  This help routine returns the pointer to TIA_Vx_SPLIT_xxx depending
               00106 ;;  on WREG
               00107 ;;  OUT: pointer in FSR1
               00108 ;; --------------------------------------------------------------------------
3EE6 00109 TIA_PATCH_GetSplitPointer
3EE6 EE11 F021 00110         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_SPLIT_LOWER
3EEA B0E8      00111         btfsc   WREG, 0
3EEC EE11 F022 00112         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_SPLIT_UPPER
               00113         
3EF0 30E8      00114         rrf     WREG, W
3EF2 0B01      00115         andlw   0x01
3EF4 0D40      00116         mullw   TIA_Vx_RECORD_LEN
3EF6 50F3      00117         movf    PRODL, W
3EF8 26E1      00118         addwf   FSR1L, F
3EFA 0012      00119         return
               00381 #include "tia_bank.inc"
               00001 ; $Id: tia_bank.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox SID
               00004 ; BankStick Handler
               00005 ;
               00006 ; (Bank Load/Store routines located in tia_pbank.inc and tia_ebank.inc)
               00007 ;
               00008 ; ==========================================================================
               00009 ;
               00010 ;  Copyright 1998-2007 Thorsten Klose (tk@midibox.org)
               00011 ;  Licensed for personal non-commercial use only.
               00012 ;  All other rights reserved.
               00013 ; 
               00014 ; ==========================================================================
               00015 
               00016 ;; --------------------------------------------------------------------------
               00017 ;;  Writes data to EEPROM or BankStick
               00018 ;;  IN: Value in WREG, address offset in EEADR
               00019 ;;  OUT: increments address
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 88


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00020 ;; --------------------------------------------------------------------------
3EFC 00021 TIA_BANK_Write
3EFC 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
3EFE D8C9      00024         rcall   TIA_BANK_GetBankStickAvailable
3F00 E01C      00025         bz      TIA_BANK_WriteInternal
3F02 5012      00026         movf    TIA_PRESET, W
3F04 E01A      00027         bz      TIA_BANK_WriteInternal
               00028 
               00029     ;; test BS Size 64/128 Patchs, 
               00030     ;rcall   TIA_BANK_GetBankStickSize
               00031     ;bnz     TIA_BANK_WriteBankStick
               00032     ;; exit if patch exceeds 63
               00033     ;btfsc      TIA_PRESET, 6
               00034     ;rgoto   TIA_BANK_WriteInternal
               00035 
3F06 00036 TIA_BANK_WriteBankStick                         ; BankStick write:
3F06 0E00      00037     movlw   0x00
3F08 0F00      00038     addlw   DEFAULT_BS_READONLY     ; exit if BS_READONLY
3F0A E10F      00039     bnz  TIA_BANK_WriteBankStick_NOk
3F0C 00040 TIA_BANK_WriteBankStick_Ok    
               00041 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F0C 9562      00042     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3F0E 825B      00043     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3F10 945B      00044     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3F12 965B      00045     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3F14 805B      00046     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
               00047 #endif
3F16 D89D      00048         rcall   TIA_BANK_SetBankStickAddress
3F18 5005      00049         movf    MIOS_PARAMETER3, W              ; get byte from temp. register
3F1A ECBA F016 00050         call    MIOS_BANKSTICK_Write    ; write content
               00051         ;; here we could add an error exception handler
               00052 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS== 1
3F1E E00B      00053     bz      TIA_BANK_WriteBankStick_NOk_DebugSkp
3F20 6E5C      00054     movwf   TIA_DEBUG_BS_REG1
3F22 2A5D      00055     incf    TIA_DEBUG_BS_REG2, F
3F24 865B      00056     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3F26 8A5B      00057     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_WRERR
               00058     rgoto   TIA_BANK_WriteBankStick_NOk_DebugSkp
3F28 D006          M         bra     label
               00059 #endif
3F2A 00060 TIA_BANK_WriteBankStick_NOk
               00061 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F2A 9562      00062     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3F2C 825B      00063     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3F2E 945B      00064     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3F30 865B      00065     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3F32 885B      00066     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_READONLY
3F34 805B      00067     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3F36 00068 TIA_BANK_WriteBankStick_NOk_DebugSkp    
               00069 #endif
3F36 2AA9      00070         incf    EEADR, F                ; increment EEPROM address
               00071         rgoto   TIA_BANK_Write_End
3F38 D01C          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 89


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00072 
3F3A 00073 TIA_BANK_WriteInternal
3F3A 0E00      00074     movlw   0x00
3F3C 0F00      00075     addlw   DEFAULT_EE_READONLY     ; exit if EE_READONLY
3F3E E00E      00076     bz      TIA_BANK_WriteInternal_Ok
               00077 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3F40 8364      00078     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3F42 9564      00079     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3F44 8764      00080     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR
3F46 8964      00081     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_READONLY
3F48 8164      00082     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00083 #endif
3F4A 2AA9      00084         incf    EEADR, F                ; increment EEADR
               00085         rgoto   TIA_BANK_Write_End              ; and goto end
3F4C D012          M         bra     label
               00086         ;; don't write if address in range between 0x7c and 0x7f (used to save channel and device number)
               00087         BRA_IFSET EEADR, 7, ACCESS, TIA_BANK_WriteInternal_Ok
3F4E BEA9          M         btfsc   reg, bit, reg_a
3F50 D005          M         bra     label
3F52 0E7B      00088         movlw   0x7c-1
3F54 64A9      00089         cpfsgt  EEADR, ACCESS
               00090         rgoto   TIA_BANK_WriteInternal_Ok
3F56 D002          M         bra     label
3F58 2AA9      00091         incf    EEADR, F                ; increment EEADR
               00092         rgoto   TIA_BANK_Write_End              ; and goto end
3F5A D00B          M         bra     label
3F5C 00093 TIA_BANK_WriteInternal_Ok
               00094 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3F5C 8364      00095     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3F5E 9564      00096     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3F60 8164      00097     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00098 #endif
3F62 5005      00099         movf    MIOS_PARAMETER3, W              ; get byte from temp. register
3F64 ECB2 F016 00100         call    MIOS_EEPROM_Write               ; write to EEPROM
               00101         ;; here we could add an error exception handler
               00102 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3F68 E004      00103     bz      TIA_BANK_Write_End
3F6A 6F65      00104     movwf   TIA_DEBUG_EE_REG1
3F6C 2B66      00105     incf    TIA_DEBUG_EE_REG2, F
3F6E 8764      00106     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR
3F70 8B64      00107     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_WRERR
               00108 #endif
3F72 00109 TIA_BANK_Write_End
               00110         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
3F72 0101          M         movlb   HIGH(reg)
3F74 0012      00111         return
               00112 
               00113 ;; --------------------------------------------------------------------------
               00114 ;;  Writes a page of 64 bytes to EEPROM or BankStick
               00115 ;;  IN: Value in FSR1 buffer, address offset in EEADR
               00116 ;;  OUT: increments address
               00117 ;; --------------------------------------------------------------------------
3F76 00118 TIA_BANK_WritePage
               00119 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 90


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00120         ;; align EEADR if necessary
3F76 0EC0      00121         movlw   0xc0
3F78 16A9      00122         andwf   EEADR, F
               00123 
               00124         ;; branch to internal patch if bankstick is not available or Patch is 0
3F7A 5012      00125         movf    TIA_PRESET, W
3F7C E022      00126         bz      TIA_BANK_WritePageInternal
               00127 
3F7E 00128 TIA_BANK_WritePageBankStick                     ; BankStick write:
3F7E 0E00      00129     movlw   0x00
3F80 0F00      00130     addlw   DEFAULT_BS_READONLY     ; exit if BS_READONLY
3F82 E009      00131     bz      TIA_BANK_WritePageBankStick_Ok
3F84 00132 TIA_BANK_WritePageBankStick_ReadOnly
               00133     ;;  BS Read Only Error #0x02
3F84 0E02      00134     movlw   0x02
3F86 6E26      00135     movwf   TIA_SYSEX_ERROR
               00136 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F88 9562      00137     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3F8A 825B      00138     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3F8C 845B      00139     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3F8E 865B      00140     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3F90 885B      00141     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_READONLY
3F92 805B      00142     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
               00143  #endif
               00144     rgoto TIA_BANK_WritePageBankStick_End
3F94 D013          M         bra     label
               00145    
3F96 00146 TIA_BANK_WritePageBankStick_Ok    
               00147 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
3F96 9562      00148     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
3F98 825B      00149     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
3F9A 845B      00150     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
3F9C 965B      00151     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3F9E 805B      00152     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
3FA0 C011 F05E 00153     movff   TIA_BANK, TIA_DEBUG_BS_REG3
3FA4 C012 F05F 00154     movff   TIA_PRESET, TIA_DEBUG_BS_REG4
               00155 #endif
3FA8 D854      00156         rcall   TIA_BANK_SetBankStickAddress
               00157         ;; buffer already prepared in FSR1
3FAA ECF2 F016 00158         call    MIOS_BANKSTICK_WritePage        ; write page
               00159         ;; here we could add an error exception handler
3FAE E006      00160     bz      TIA_BANK_WritePageBankStick_End
               00161     ;;  BS WritePage Error #0x07
3FB0 0E07      00162     movlw   0x07
3FB2 6E26      00163     movwf   TIA_SYSEX_ERROR
               00164 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS== 1
3FB4 6E5C      00165     movwf   TIA_DEBUG_BS_REG1
3FB6 2A5D      00166     incf    TIA_DEBUG_BS_REG2, F
3FB8 865B      00167     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
3FBA 8A5B      00168     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_WRERR
               00169 #endif
3FBC 00170 TIA_BANK_WritePageBankStick_End
3FBC 0E40      00171         movlw   0x40                            ; increment EEPROM address by 0x40
3FBE 26A9      00172         addwf   EEADR, F
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 91


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00173         rgoto   TIA_BANK_WritePage_End
3FC0 D025          M         bra     label
               00174 
3FC2 00175 TIA_BANK_WritePageInternal
3FC2 6A12      00176     clrf    TIA_PRESET
3FC4 0E00      00177     movlw   0x00
3FC6 0F00      00178     addlw   DEFAULT_EE_READONLY     ; exit if EE_READONLY
3FC8 E00A      00179     bz      TIA_BANK_WritePageInternalLoop
               00180     ;; Internal EE Readonly Error #1
3FCA 0E01      00181     movlw   0x01
3FCC 6E26      00182     movwf   TIA_SYSEX_ERROR
               00183 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3FCE 8364      00184     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3FD0 8564      00185     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3FD2 8764      00186     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR
3FD4 8964      00187     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_READONLY
3FD6 8164      00188     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00189 #endif
3FD8 0E40      00190     movlw   0x40
3FDA 26A9      00191         addwf   EEADR, F                        ; increment EEADR
               00192         rgoto   TIA_BANK_WritePage_End          ; and goto next
3FDC D017          M         bra     label
               00193         ;; write 64 bytes
3FDE 00194 TIA_BANK_WritePageInternalLoop
               00195 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3FDE 8364      00196     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
3FE0 8564      00197     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
3FE2 8164      00198     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
               00199 #endif
               00200         ;; don't write if address in range between 0x7c and 0x7f (used to save channel and device number)
               00201         BRA_IFSET EEADR, 7, ACCESS, TIA_BANK_WritePageInternal_Ok
3FE4 BEA9          M         btfsc   reg, bit, reg_a
3FE6 D005          M         bra     label
3FE8 0E7B      00202         movlw   0x7c-1
3FEA 64A9      00203         cpfsgt  EEADR, ACCESS
               00204         rgoto   TIA_BANK_WritePageInternal_Ok
3FEC D002          M         bra     label
3FEE 2AA9      00205         incf    EEADR, F                        ; increment EEADR
               00206         rgoto   TIA_BANK_WritePage_Next         ; and goto next
3FF0 D00A          M         bra     label
3FF2 00207 TIA_BANK_WritePageInternal_Ok
3FF2 50A9      00208         movf    EEADR, W
3FF4 0B3F      00209         andlw   0x3f
3FF6 50E3      00210         movf    PLUSW1, W                       ; get byte from buffer
3FF8 ECB2 F016 00211         call    MIOS_EEPROM_Write               ; write to EEPROM
               00212         ;; here we could add an error exception handler
               00213 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
3FFC E004      00214     bz      TIA_BANK_WritePage_Next
3FFE 6F65      00215     movwf   TIA_DEBUG_EE_REG1
4000 2B66      00216     incf    TIA_DEBUG_EE_REG2, F
4002 8764      00217     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_ERROR
4004 8B64      00218     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_WRERR
               00219 #endif
4006 00220 TIA_BANK_WritePage_Next
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 92


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4006 50A9      00221         movf    EEADR, W
4008 0B3F      00222         andlw   0x3f
400A E1E9      00223         bnz     TIA_BANK_WritePageInternalLoop
               00224 
400C 00225 TIA_BANK_WritePage_End
               00226         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
400C 0101          M         movlb   HIGH(reg)
400E 0012      00227         return
               00228 
               00229     
               00230 ;; --------------------------------------------------------------------------
               00231 ;;  Read data from EEPROM or BankStick
               00232 ;;  IN: address offset in EEADR,
               00233 ;;      internal perset in EEADRH, 
               00234 ;;      Patch number in MIOS_PARAMETER2,
               00235 ;;      Bank number in TIA_BANK.
               00236 ;;  OUT: 7-bit result in WREG, increments address
               00237 ;; --------------------------------------------------------------------------
               00238 
4010 00239 TIA_BANK_Read
               00240         ;; branch to internal patch if bankstick is not available or Patch is 0    
4010 5011      00241     movf    TIA_BANK, W
4012 D837      00242     rcall   TIA_BANK_GetBankStickReady
4014 E013      00243         bz      TIA_BANK_ReadInternal
4016 5012      00244         movf    TIA_PRESET, W
4018 E011      00245         bz      TIA_BANK_ReadInternal
               00246      
401A D840      00247     rcall   TIA_BANK_GetBankStickSize
401C E102      00248     bnz     TIA_BANK_ReadBankStick
               00249 
401E BC12      00250     btfsc       TIA_PRESET, 6
               00251     rgoto   TIA_BANK_Read_End    
4020 D013          M         bra     label
               00252 
4022 00253 TIA_BANK_ReadBankStick                          ; BankStick read:
               00254 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4022 9562      00255     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
4024 925B      00256     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_RW
4026 945B      00257     bcf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_PAGE
4028 805B      00258     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
402A C011 F05E 00259     movff   TIA_BANK, TIA_DEBUG_BS_REG3
402E C012 F05F 00260     movff   TIA_PRESET, TIA_DEBUG_BS_REG4
               00261 #endif
4032 D80F      00262         rcall   TIA_BANK_SetBankStickAddress
4034 ECB8 F016 00263         call    MIOS_BANKSTICK_Read             ; read content
4038 2AA9      00264         incf    EEADR, F                        ; increment EEPROM address
               00265         rgoto   TIA_BANK_Read_End
403A D006          M         bra     label
               00266         
403C 00267 TIA_BANK_ReadInternal
               00268 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_EE== 1
403C 9364      00269     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_RW
403E 9564      00270     bcf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_PAGE
4040 8164      00271     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_FLAG
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 93


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00272 #endif
4042 6A12      00273         clrf    TIA_PRESET
4044 ECB0 F016 00274         call    MIOS_EEPROM_Read
               00275 
4048 00276 TIA_BANK_Read_End
               00277         SET_BSR TIA_BASE                        ; fix BSR after a MIOS routine has been called
4048 0101          M         movlb   HIGH(reg)
404A 0012      00278         return
               00279 
               00280 
               00281 ;; --------------------------------------------------------------------------
               00282 ;;  This function sets a BankStick address
               00283 ;;  IN: patch offset in EEADR
               00284 ;;      patch number in MIOS_PARAMETER2
               00285 ;;      BankStick number in TIA_BANK
               00286 ;;  OUT: address in MIOS_PARAMETER[12]
               00287 ;;       BankStick selected via MIOS_BANKSTICK_CtrlSet
               00288 ;; --------------------------------------------------------------------------
404C 00289 TIA_BANK_SetBankStickAddressMagic
404C 6A03      00290     clrf    MIOS_PARAMETER1
404E 6A04      00291     clrf    MIOS_PARAMETER2
               00292     rgoto TIA_BANK_SetBankStickAddress_Cont
4050 D006          M         bra     label
               00293 
4052 00294 TIA_BANK_SetBankStickAddress
               00295 
4052 CFA9 F003 00296         movff   EEADR, MIOS_PARAMETER1          ; copy address to low-byte
4056 B012      00297     btfsc       TIA_PRESET, 0
4058 8E03      00298         bsf     MIOS_PARAMETER1, 7              ; select upper address range on odd bank number
405A 4012      00299     rrncf   TIA_PRESET, W      ; high-byte
405C 6E04      00300     movwf   MIOS_PARAMETER2
               00301 
405E 00302 TIA_BANK_SetBankStickAddress_Cont
405E 501A      00303         movf    TIA_BANKSTICK_ID, W
               00304 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4060 0F80      00305     addlw   0x80        ; (Enable verify slower write accesses)
               00306 #endif
4062 ECEE F016 00307         call    MIOS_BANKSTICK_CtrlSet
               00308         
4066 D81A      00309     rcall   TIA_BANK_GetBankStickSize
4068 B4D8      00310         skpnz
               00311     rgoto   TIA_BANK_SetBankStickAddress_32k
406A D005          M         bra     label
               00312     
406C 00313 TIA_BANK_SetBankStickAddress_64k
406C B011      00314         btfsc   TIA_BANK, 0
406E 8C04      00315         bsf     MIOS_PARAMETER2, 6
4070 B211      00316     btfsc       TIA_BANK, 1
4072 8E04      00317         bsf     MIOS_PARAMETER2, 7
               00318     rgoto   TIA_BANK_SetBankStickAddress_End
4074 D005          M         bra     label
               00319     
4076 00320 TIA_BANK_SetBankStickAddress_32k
4076 9A04      00321     bcf MIOS_PARAMETER2, 5
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 94


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4078 B011      00322         btfsc   TIA_BANK, 0
407A 8A04      00323         bsf     MIOS_PARAMETER2, 5
407C B211      00324     btfsc       TIA_BANK, 1
407E 8C04      00325         bsf     MIOS_PARAMETER2, 6
               00326 
4080 00327 TIA_BANK_SetBankStickAddress_End
4080 0012      00328     return
               00329     
               00330 
               00331 ;; --------------------------------------------------------------------------
               00332 ;;  This function returns the bankstick available status for the current bank
               00333 ;;  IN: Bank number WREG
               00334 ;;  OUT: WREG != 0 when bankstick available
               00335 ;; --------------------------------------------------------------------------
4082 00336 TIA_BANK_GetBankStickReady
4082 40E8      00337     rrncf   WREG, W
4084 40E8      00338     rrncf   WREG, W
4086 0B07      00339     andlw   0x07
4088 6E1A      00340     movwf       TIA_BANKSTICK_ID
408A ECC6 F016 00341         call    MIOS_HLP_GetBitORMask
408E 141B      00342         andwf   TIA_BANKSTICK_RDY, W
4090 0012      00343         return
               00344     
               00345 ;; --------------------------------------------------------------------------
               00346 ;;  This function returns the bankstick available status for the current bank
               00347 ;;  IN: BankStick number in TIA_PBANK
               00348 ;;  OUT: WREG != 0 when bankstick available
               00349 ;; --------------------------------------------------------------------------
4092 00350 TIA_BANK_GetBankStickAvailable
4092 501A      00351     movf        TIA_BANKSTICK_ID, W
4094 ECC6 F016 00352         call    MIOS_HLP_GetBitORMask
4098 141C      00353         andwf   TIA_BANKSTICK_STAT, W
409A 0012      00354         return
               00355 ;; --------------------------------------------------------------------------
               00356 ;;  This function returns the bankstick available status for the current bank
               00357 ;;  IN: BankStick number in TIA_BANKSTICK_ID
               00358 ;;  OUT: BankStick size in WREG and TIA_BANKSTICK_SIZE
               00359 ;; --------------------------------------------------------------------------
409C 00360 TIA_BANK_GetBankStickSize
409C 501A      00361     movf        TIA_BANKSTICK_ID, W
409E ECC6 F016 00362         call    MIOS_HLP_GetBitORMask
40A2 141D      00363         andwf   TIA_BANKSTICK_SIZE, W
40A4 0012      00364         return
               00365     
               00366 
               00367 
               00368 ;; --------------------------------------------------------------------------
               00369 ;; selects address of magic number depending on TIA_BANKSTICK_CHK_CTR
               00370 ;; TIA_BANKSTICK_CHK_CTR or TIA_PBANK
               00371 ;; --------------------------------------------------------------------------
40A6 00372 TIA_BANK_CheckStick_SelectMagic
               00373         ;; select BankStick depending on TIA_BANKSTICK_CHK_CTR
40A6 6E05      00374     movwf   MIOS_PARAMETER3
40A8 40E8      00375     rrncf   WREG, W
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 95


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
40AA 40E8      00376     rrncf   WREG, W
40AC 0B07      00377     andlw   0x07
40AE 0F80      00378     addlw   0x80        ; (Enable verify slower write accesses)
40B0 ECEE F016 00379         call    MIOS_BANKSTICK_CtrlSet
               00380 
               00381         ;; determine if this is a 64k BankStick:
               00382         ;; read from address 0x8000, store value in PRODL
40B4 0E0F      00383         movlw   0x0f ;; between 0x03 - 0x7f
40B6 6E03      00384         movwf   MIOS_PARAMETER1
40B8 0E80      00385         movlw   0x80
40BA 6E04      00386         movwf   MIOS_PARAMETER2
40BC ECB8 F016 00387         call    MIOS_BANKSTICK_Read
40C0 6EF3      00388         movwf   PRODL
               00389 
               00390         ;; add 0x42 and write number to 0x0000
40C2 0E0F      00391         movlw   0x0f ;; between 0x03 - 0x7f
40C4 6E03      00392         movwf   MIOS_PARAMETER1
40C6 6A04      00393         clrf    MIOS_PARAMETER2
40C8 50F3      00394     movf    PRODL, W
40CA 0F42      00395         addlw   0x42
40CC ECBA F016 00396         call    MIOS_BANKSTICK_Write
               00397 
               00398         ;; read again number from 0x8000, check if we still see the old value
40D0 0E0F      00399         movlw   0x0f ;; between 0x03 - 0x7f
40D2 6E03      00400         movwf   MIOS_PARAMETER1
40D4 0E80      00401         movlw   0x80
40D6 6E04      00402         movwf   MIOS_PARAMETER2
40D8 ECB8 F016 00403         call    MIOS_BANKSTICK_Read
40DC 18F3      00404         xorwf   PRODL, W
40DE E107      00405     bnz     TIA_BANK_CheckStick_SelectMagic_32k
40E0 00406 TIA_BANK_CheckStick_SelectMagic_64k     ; (64k device)
               00407         ;; try to read from BankStick (address 0x0000, 0x4000, 0x8000 or 0xc000)
40E0 6A03      00408         clrf    MIOS_PARAMETER1
40E2 6A04      00409         clrf    MIOS_PARAMETER2
40E4 B005      00410         btfsc   MIOS_PARAMETER3, 0
40E6 8C04      00411         bsf     MIOS_PARAMETER2, 6
40E8 B205      00412     btfsc       MIOS_PARAMETER3, 1
40EA 8E04      00413         bsf     MIOS_PARAMETER2, 7
               00414     rgoto   TIA_BANK_CheckStick_SelectMagic_End
40EC D006          M         bra     label
               00415     
40EE 00416 TIA_BANK_CheckStick_SelectMagic_32k     ; (32k device)
               00417         ;; try to read from BankStick (address 0x0000, 0x2000, 0x4000 or 0x0600)
40EE 6A03      00418         clrf    MIOS_PARAMETER1
40F0 6A04      00419         clrf    MIOS_PARAMETER2
40F2 B005      00420         btfsc   MIOS_PARAMETER3, 0
40F4 8A04      00421         bsf     MIOS_PARAMETER2, 5
40F6 B205      00422     btfsc       MIOS_PARAMETER3, 1
40F8 8C04      00423         bsf     MIOS_PARAMETER2, 6
               00424     ;; rgoto   TIA_BANK_CheckStick_SelectMagic_End
40FA 00425 TIA_BANK_CheckStick_SelectMagic_End
40FA 0012      00426         return
               00427 
               00428 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 96


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00429 
               00430 
               00431 
               00432 ;; --------------------------------------------------------------------------
               00433 ;;  Check Stick: try to read from BankStick, clear the appr. flag in
               00434 ;;  TIA_BANKSTICK_STAT if BankStick not available
               00435 ;; --------------------------------------------------------------------------
40FC 00436 TIA_BANK_CheckStick
               00437 
               00438         ;; increment check counter, wrap at 32
40FC 2819      00439         incf    TIA_BANKSTICK_CHK_CTR, W
40FE 0B1F      00440         andlw   0x1f
4100 6E19      00441         movwf   TIA_BANKSTICK_CHK_CTR
               00442     
4102 90D8      00443     clrc
4104 4019      00444         rrncf   TIA_BANKSTICK_CHK_CTR, W
4106 40E8      00445     rrncf   WREG, W
4108 0B07      00446     andlw   0x07
410A 6E1A      00447     movwf   TIA_BANKSTICK_ID
               00448     
               00449         ;; select "magic number" and try to read from BankStick
410C 5019      00450     movf    TIA_BANKSTICK_CHK_CTR, W
410E DFCB      00451         rcall   TIA_BANK_CheckStick_SelectMagic
               00452 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4110 C004 F05D 00453     movff   MIOS_PARAMETER2, TIA_DEBUG_BS_REG2
               00454 #endif
4114 ECB8 F016 00455         call    MIOS_BANKSTICK_Read
               00456         ;; this sets the MIOS_BOX_STAT_BS_AVAILABLE flag
               00457 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4118 C002 F05C 00458     movff   MIOS_BOX_STAT, TIA_DEBUG_BS_REG1 
               00459 #endif
               00460 
               00461         ;; save old BankStick status in TMP1
411C C01C F006 00462         movff   TIA_BANKSTICK_STAT, TMP1
               00463 
               00464         ;; modify the available flag of current bankstick
               00465         BRA_IFSET MIOS_BOX_STAT, MIOS_BOX_STAT_BS_AVAILABLE, ACCESS, TIA_BANK_CheckStick_AccPassed
4120 B002          M         btfsc   reg, bit, reg_a
4122 D005          M         bra     label
4124 00466 TIA_BANK_CheckStick_AccFailed
4124 501A      00467         movf    TIA_BANKSTICK_ID, W
4126 ECC4 F016 00468         call    MIOS_HLP_GetBitANDMask
412A 141C      00469         andwf   TIA_BANKSTICK_STAT, W
               00470         rgoto   TIA_BANK_CheckStick_AccCont
412C D004          M         bra     label
412E 00471 TIA_BANK_CheckStick_AccPassed
412E 501A      00472         movf    TIA_BANKSTICK_ID, W
4130 ECC6 F016 00473         call    MIOS_HLP_GetBitORMask
4134 101C      00474         iorwf   TIA_BANKSTICK_STAT, W
4136 00475 TIA_BANK_CheckStick_AccCont
4136 6E07      00476     movwf   TMP2
               00477 
               00478         ;; check if flag has been changed
4138 5007      00479         movf    TMP2, W
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 97


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
413A 1806      00480         xorwf   TMP1, W
413C E00A      00481     bz  TIA_BANK_CheckStick_End
413E 8010      00482     bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE, ACCESS
               00483 
               00484 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4140 805B      00485     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_FLAG
4142 8562      00486     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_RWCHK
               00487 #endif
               00488  
               00489     ;; flag changed - branch depending on available status
4144 501A      00490         movf    TIA_BANKSTICK_ID, W
4146 ECC6 F016 00491         call    MIOS_HLP_GetBitORMask
414A 1407      00492         andwf   TMP2, W
414C E150      00493         bnz     TIA_BANK_CheckStick_Ext
               00494     rgoto TIA_BANK_CheckStick_Int
414E D002          M         bra     label
4150 9010      00495     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
4152 00496 TIA_BANK_CheckStick_End    
4152 0012      00497     return
               00498 
               00499 
               00500 
               00501 
               00502         ;; ------------------------------------------------------------------
               00503         ;; --> Internal Patch
4154 00504 TIA_BANK_CheckStick_Int
               00505 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4154 9962      00506     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT
               00507 #endif
4156 00508 TIA_BANK_CheckStick_IntReload
               00509         ;;      TABLE_ADDR TEXT_INTBANK_0               ; print message
               00510         ;;      call    MIOS_LCD_PrintMessage
               00511         ;;      call    MIOS_LCD_PrintMessage
               00512     
               00513     ;; reset size
4156 5007      00514     movf        TMP2, W
4158 161D      00515         andwf   TIA_BANKSTICK_SIZE, F
               00516 
415A 00517 TIA_BANK_CheckStick_Int_StatOk
415A C007 F01C 00518     movff   TMP2, TIA_BANKSTICK_STAT
415E EC07 F01F 00519     call    TIA_LEDMTR_PlayOtoR         ;; play mled orange to red pattern 
4162 ECD0 F022 00520     call        TIA_TUNE_PlayDisconnect     ;; play tune 5    
4166 EC1D F01F 00521     call    TIA_LEDMTR_Player_Off
               00522     
               00523         ;; branch depending on patch/kit BankStick
               00524 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
416A 0E04      00525         movlw   DEFAULT_BS_KBANK_ID-1
416C 641A      00526         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00527         rgoto   TIA_BANK_CheckStick_Int_P
416E D02A          M         bra     label
4170 B219      00528     btfsc   TIA_BANKSTICK_CHK_CTR, 1
               00529     rgoto       TIA_BANK_CheckStick_Int_WT
4172 D014          M         bra     label
               00530     
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 98


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4174 00531 TIA_BANK_CheckStick_Int_K
               00532 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4174 8162      00533     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
4176 9362      00534     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
               00535 #endif
4178 501A      00536         movf    TIA_BANKSTICK_ID, W         ;; clear flag
417A ECC4 F016 00537         call    MIOS_HLP_GetBitANDMask
417E 161B      00538         andwf   TIA_BANKSTICK_RDY, F   
4180 0E05      00539     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
4182 6E25      00540     movwf   TIA_SYSEX_ADDRESS
4184 EC38 F02E 00541         call    _TIA_SYSEX_End_CFG_Read 
4188 5019      00542     movf    TIA_BANKSTICK_CHK_CTR, W
418A 1816      00543     xorwf   TIA_KBANK, W
418C E12F      00544     bnz     TIA_BANK_CheckStick_Int_End
418E 6A16      00545     clrf    TIA_KBANK                   ;; Reinit to...
4190 6A15      00546     clrf    TIA_KIT
4192 0E0F      00547     movlw   0x0f                        ;; send sysex CFG All
4194 6E25      00548     movwf   TIA_SYSEX_ADDRESS
4196 EC38 F02E 00549         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
               00550         rgoto   TIA_BANK_CheckStick_Int_End 
419A D028          M         bra     label
               00551     
419C 00552 TIA_BANK_CheckStick_Int_WT
               00553 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
419C 8162      00554     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
419E 8362      00555     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
               00556 #endif
41A0 501A      00557         movf    TIA_BANKSTICK_ID, W         ;; clear flag
41A2 ECC4 F016 00558         call    MIOS_HLP_GetBitANDMask
41A6 161B      00559         andwf   TIA_BANKSTICK_RDY, F   
41A8 0E05      00560     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
41AA 6E25      00561     movwf   TIA_SYSEX_ADDRESS
41AC EC38 F02E 00562         call    _TIA_SYSEX_End_CFG_Read 
41B0 5019      00563     movf    TIA_BANKSTICK_CHK_CTR, W
41B2 1818      00564     xorwf   TIA_WBANK, W
41B4 E11B      00565     bnz     TIA_BANK_CheckStick_Int_End
41B6 6A18      00566     clrf    TIA_WBANK                   ;; Reinit to...
41B8 6A17      00567     clrf    TIA_WT
41BA 0E0F      00568     movlw   0x0f                        ;; send sysex CFG All
41BC 6E25      00569     movwf   TIA_SYSEX_ADDRESS
41BE EC38 F02E 00570         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
               00571         rgoto   TIA_BANK_CheckStick_Int_End 
41C2 D014          M         bra     label
               00572 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00573 
41C4 00574 TIA_BANK_CheckStick_Int_P
               00575 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
41C4 9162      00576     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
               00577 #endif
41C6 501A      00578         movf    TIA_BANKSTICK_ID, W         ;; clear flag
41C8 ECC4 F016 00579         call    MIOS_HLP_GetBitANDMask
41CC 161B      00580         andwf   TIA_BANKSTICK_RDY, F   
41CE 0E05      00581     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
41D0 6E25      00582     movwf   TIA_SYSEX_ADDRESS
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 99


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
41D2 EC38 F02E 00583         call    _TIA_SYSEX_End_CFG_Read 
41D6 5019      00584     movf    TIA_BANKSTICK_CHK_CTR, W
41D8 1814      00585     xorwf   TIA_PBANK, W
41DA E108      00586     bnz     TIA_BANK_CheckStick_Int_End
41DC 6A14      00587     clrf    TIA_PBANK                   ;; Reinit to...
41DE 6A13      00588     clrf    TIA_PATCH
41E0 0E0F      00589     movlw   0x0f                        ;; send sysex CFG All
41E2 6E25      00590     movwf   TIA_SYSEX_ADDRESS
41E4 EC38 F02E 00591         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
41E8 EC2E F01F 00592         call    TIA_PATCH_Init
               00593         ;;rgoto TIA_BANK_CheckStick_Int_End 
               00594     
41EC 00595 TIA_BANK_CheckStick_Int_End    
41EC 0012      00596         return
               00597 
               00598 
               00599         ;; ------------------------------------------------------------------
               00600         ;; --> External Patch
41EE 00601 TIA_BANK_CheckStick_Ext
               00602 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
41EE 8962      00603     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_INTEXT
               00604 #endif
               00605         ;;      TABLE_ADDR TEXT_EXTBANK_0               ; print message
               00606         ;;      call    MIOS_LCD_PrintMessage
               00607         ;;      call    MIOS_LCD_PrintMessage
               00608 
               00609         ;; new setup will be reloaded automatically
               00610         ;; set reinit counter - CS configuration will be restored after one second
               00611         ;movlw  10
               00612         ;movwf  CS_MENU_REINIT_CFG_CTR
               00613 
               00614         ;; now check if the magic numbers exist in bankstick bank - if not, format bank automatically
41F0 0E32      00615         movlw   50                              ; wait some ms to get a stable status
41F2 ECCE F016 00616         call    MIOS_Delay                      
               00617 
41F6 5019      00618     movf    TIA_BANKSTICK_CHK_CTR, W
41F8 DF56      00619         rcall   TIA_BANK_CheckStick_SelectMagic
41FA ECB8 F016 00620         call    MIOS_BANKSTICK_Read
               00621 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
41FE 6E5E      00622     movwf   TIA_DEBUG_BS_REG3
               00623 #endif
4200 0A83      00624         xorlw   BANKSTICK_MAGIC0                ; branch to unformatted message if number not equal
4202 A4D8      00625     skpz
               00626         rgoto   TIA_BANK_CheckStick_Unformatted
4204 D073          M         bra     label
               00627     
               00628     ;; magic numbers are different between Patch/Kit-WT bankstick
               00629 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
4206 0E04      00630         movlw   DEFAULT_BS_KBANK_ID-1
4208 641A      00631         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00632         rgoto   TIA_BANK_CheckStick_Ext_P
420A D017          M         bra     label
               00633 
               00634 ;; Kit / Wavetable
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 100


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
420C 00635 TIA_BANK_CheckStick_Ext_K 
               00636     ;; Magic ( Kit suite)
               00637     ;; set bankstick type depending on second byte (BANKSTICK_MAGICK/P)
               00638 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
420C 501A      00639         movf    TIA_BANKSTICK_ID, W
420E ECC6 F016 00640         call    MIOS_HLP_GetBitORMask
4212 1363      00641         iorwf   TIA_DEBUG_BS_REG9, F
               00642 #endif
4214 ECB8 F016 00643         call    MIOS_BANKSTICK_Read 
4218 6E06      00644     movwf   TMP1
               00645 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
421A 6E5F      00646     movwf   TIA_DEBUG_BS_REG4
               00647 #endif
421C 0A13      00648         xorlw   BANKSTICK_MAGICK
421E E009      00649         bz      TIA_BANK_CheckStrick_Ext_Type_K
4220 00650 TIA_BANK_CheckStrick_Ext_Type_NotK
4220 5006      00651     movf    TMP1, W
4222 0A12      00652     xorlw       BANKSTICK_MAGICP
4224 A4D8      00653     skpz
               00654     rgoto       TIA_BANK_CheckStick_Unformatted             ;; format
4226 D062          M         bra     label
4228 0E01      00655     movlw   DEFAULT_BS_FPROTECT          ;; type format protection
422A 0A01      00656     xorlw   0x01
422C B4D8      00657     skpnz
               00658     rgoto   TIA_BANK_CheckStick_Unformatted_TProtect    ;; exit
422E D06B          M         bra     label
               00659     rgoto   TIA_BANK_CheckStick_Unformatted             ;; format
4230 D05D          M         bra     label
4232 00660 TIA_BANK_CheckStrick_Ext_Type_K
4232 0E13      00661     movlw   BANKSTICK_MAGICK            ;; valid type
4234 6E06      00662     movwf   TMP1
               00663 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4236 8162      00664     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
               00665 #endif
               00666         rgoto   TIA_BANK_CheckStick_Ext_Size
4238 D016          M         bra     label
               00667 #endif      ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00668 
               00669 ;; Patch
423A 00670 TIA_BANK_CheckStick_Ext_P 
               00671     ;; Magic (Patch suite)
               00672     ;; set bankstick type depending on second byte (BANKSTICK_MAGICK/P)
               00673 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
423A 501A      00674         movf    TIA_BANKSTICK_ID, W
423C ECC4 F016 00675         call    MIOS_HLP_GetBitANDMask
4240 1763      00676         andwf   TIA_DEBUG_BS_REG9, F
               00677 #endif
4242 ECB8 F016 00678         call    MIOS_BANKSTICK_Read 
4246 6E06      00679     movwf   TMP1
               00680 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4248 6E5F      00681     movwf   TIA_DEBUG_BS_REG4
               00682 #endif
424A 0A12      00683         xorlw   BANKSTICK_MAGICP
424C E009      00684         bz      TIA_BANK_CheckStrick_Ext_Type_P
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 101


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
424E 00685 TIA_BANK_CheckStrick_Ext_Type_NotP
424E 5006      00686     movf    TMP1, W
4250 0A13      00687     xorlw       BANKSTICK_MAGICK            
4252 A4D8      00688     skpz
               00689     rgoto       TIA_BANK_CheckStick_Unformatted             ;; format
4254 D04B          M         bra     label
4256 0E01      00690     movlw   DEFAULT_BS_FPROTECT          ;; type format protection
4258 0A01      00691     xorlw   0x01
425A B4D8      00692     skpnz
               00693     rgoto   TIA_BANK_CheckStick_Unformatted_TProtect    ;; exit
425C D054          M         bra     label
               00694     rgoto   TIA_BANK_CheckStick_Unformatted             ;; format
425E D046          M         bra     label
4260 00695 TIA_BANK_CheckStrick_Ext_Type_P         ;; valid type
4260 0E12      00696     movlw   BANKSTICK_MAGICP
4262 6E06      00697     movwf   TMP1
               00698 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4264 9162      00699     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
               00700 #endif
               00701         ;;rgoto TIA_BANK_CheckStick_Ext_Size
               00702 
4266 00703 TIA_BANK_CheckStick_Ext_Size
               00704     ;; set bankstick size depending on third byte (32=32k, 64=64k)
               00705 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4266 9762      00706     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE
               00707 #endif
4268 501A      00708         movf    TIA_BANKSTICK_ID, W
426A ECC4 F016 00709         call    MIOS_HLP_GetBitANDMask
426E 161D      00710         andwf   TIA_BANKSTICK_SIZE, F       ;; clear size
4270 ECB8 F016 00711         call    MIOS_BANKSTICK_Read
4274 0A40      00712         xorlw   64
4276 E105      00713         bnz     TIA_BANK_CheckStrick_Ext_Not64k
4278 00714 TIA_BANK_CheckStrick_Ext_64k
               00715 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4278 8762      00716     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE
               00717 #endif
427A 501A      00718         movf    TIA_BANKSTICK_ID, W
427C ECC6 F016 00719         call    MIOS_HLP_GetBitORMask
4280 121D      00720         iorwf   TIA_BANKSTICK_SIZE, F       ;; set size
4282 00721 TIA_BANK_CheckStrick_Ext_Not64k
               00722 
4282 00723 TIA_BANK_CheckStick_Ext_Fix ; to do if necessary...
               00724         ;; fix patches if required (and enabled via ENABLE_PATCH_FIXING)
               00725     ;movff      TIA_BANKSTICK_CHK_CTR, TIA_PBANK
               00726         ;rcall  TIA_BANK_FixPatches
               00727         ;; ok
               00728     
4282 00729 TIA_BANK_CheckStick_Ext_Stat
               00730 
4282 5019      00731     movf    TIA_BANKSTICK_CHK_CTR, W
               00732     
4284 5019      00733     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 1st bank of current BS
4286 0B1C      00734     andlw   0x1c
4288 DF0E      00735         rcall   TIA_BANK_CheckStick_SelectMagic
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 102


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
428A ECB8 F016 00736         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
428E 0A83      00737         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
4290 E12C      00738         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
4292 ECB8 F016 00739         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
4296 1806      00740         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
4298 E128      00741         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00742 
429A 5019      00743     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 2nd bank of current BS
429C 0B1C      00744     andlw   0x1c
429E 0F01      00745     addlw   0x01
42A0 DF02      00746         rcall   TIA_BANK_CheckStick_SelectMagic
42A2 ECB8 F016 00747         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
42A6 0A83      00748         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
42A8 E120      00749         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
42AA ECB8 F016 00750         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
42AE 1806      00751         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
42B0 E11C      00752         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00753     
42B2 5019      00754     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 3rd bank of current BS
42B4 0B1C      00755     andlw   0x1c
42B6 0F02      00756     addlw   0x02
42B8 DEF6      00757         rcall   TIA_BANK_CheckStick_SelectMagic
42BA ECB8 F016 00758         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
42BE 0A83      00759         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
42C0 E114      00760         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
42C2 ECB8 F016 00761         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
42C6 1806      00762         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
42C8 E110      00763         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00764     
42CA 5019      00765     movf    TIA_BANKSTICK_CHK_CTR, W    ;; test 4th bank of current BS
42CC 0B1C      00766     andlw   0x1c
42CE 0F03      00767     addlw   0x03
42D0 DEEA      00768         rcall   TIA_BANK_CheckStick_SelectMagic
42D2 ECB8 F016 00769         call    MIOS_BANKSTICK_Read         ;; read first byte from BankStick (magic0)
42D6 0A83      00770         xorlw   BANKSTICK_MAGIC0            ;; branch to unformatted message if number not equal
42D8 E108      00771         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
42DA ECB8 F016 00772         call    MIOS_BANKSTICK_Read         ;; read second byte from BankStick (magicPK)
42DE 1806      00773         xorwf   TMP1, W                     ;; branch to unformatted message if number not equal
42E0 E104      00774         bnz     TIA_BANK_CheckStick_Ext_Stat_NotOk
               00775 
42E2 00776 TIA_BANK_CheckStick_Ext_Stat_Ok   
42E2 C007 F01C 00777     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00778 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
42E6 8A5B      00779     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_BS_READY 
               00780 #endif  
               00781     rgoto TIA_BANK_CheckStick_Ext_ReadySet
42E8 D02C          M         bra     label
42EA 00782 TIA_BANK_CheckStick_Ext_Stat_NotOk      ;; status not ready
               00783     rgoto   TIA_BANK_CheckStick_Ext_End ;; end
42EA D03A          M         bra     label
               00784     
42EC 00785 TIA_BANK_CheckStick_Unformatted    
42EC 0E01      00786     movlw   DEFAULT_BS_FPROTECT          ;; BS format inhibit
42EE 0A02      00787     xorlw   0x02
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 103


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
42F0 E006      00788     bz      TIA_BANK_CheckStick_Unformatted_FProtect 
               00789 
42F2 C019 F011 00790     movff   TIA_BANKSTICK_CHK_CTR, TIA_BANK
42F6 D856      00791         rcall   TIA_BANK_FormatStick            ;; --> format bankstick
42F8 C011 F019 00792     movff   TIA_BANK, TIA_BANKSTICK_CHK_CTR
               00793     rgoto       TIA_BANK_CheckStick_Ext_End ;; end
42FC D031          M         bra     label
               00794     
42FE 00795 TIA_BANK_CheckStick_Unformatted_FProtect
42FE C007 F01C 00796     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00797 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4302 8D62      00798     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FPROTECT
               00799 #endif
               00800     rgoto       TIA_BANK_CheckStick_Ext_ReadyClr
4304 D004          M         bra     label
               00801 
4306 00802 TIA_BANK_CheckStick_Unformatted_TProtect
4306 C007 F01C 00803     movff   TMP2, TIA_BANKSTICK_STAT    ;; status is set
               00804 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
430A 8F62      00805     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_TPROTECT
               00806 #endif
               00807     rgoto       TIA_BANK_CheckStick_Ext_ReadyClr
430C D000          M         bra     label
               00808 
430E 00809 TIA_BANK_CheckStick_Ext_ReadyClr
430E 501A      00810         movf    TIA_BANKSTICK_ID, W         ;; clear flag
4310 ECC4 F016 00811         call    MIOS_HLP_GetBitANDMask
4314 161B      00812         andwf   TIA_BANKSTICK_RDY, F   
4316 EC07 F01F 00813     call    TIA_LEDMTR_PlayOtoR         ;; play mled orange to red pattern 
431A ECFC F022 00814     call        TIA_TUNE_PlayWrong          ;; play wrong tune     
431E EC1D F01F 00815     call    TIA_LEDMTR_Player_Off
4322 0E05      00816     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
4324 6E25      00817     movwf   TIA_SYSEX_ADDRESS
4326 EC38 F02E 00818         call    _TIA_SYSEX_End_CFG_Read 
432A 5019      00819     movf    TIA_BANKSTICK_CHK_CTR, W
432C 1814      00820     xorwf   TIA_PBANK, W
432E E118      00821     bnz     TIA_BANK_CheckStick_Ext_End
4330 6A14      00822     clrf    TIA_PBANK                   ;; Reinit to...
4332 6A12      00823     clrf    TIA_PRESET
4334 0E0F      00824     movlw   0x0f                        ;; send sysex CFG All
4336 6E25      00825     movwf   TIA_SYSEX_ADDRESS
4338 EC38 F02E 00826         call    _TIA_SYSEX_End_CFG_Read     ;; ...internal patch
433C 9010      00827     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
433E EF2E F01F 00828         goto    TIA_PATCH_Init
               00829     ;;rgoto   TIA_BANK_CheckStick_Ext_End 
               00830     
4342 00831 TIA_BANK_CheckStick_Ext_ReadySet 
4342 501A      00832         movf    TIA_BANKSTICK_ID, W         ;; set flag
4344 ECC6 F016 00833         call    MIOS_HLP_GetBitORMask
4348 121B      00834         iorwf   TIA_BANKSTICK_RDY, F
434A ECFB F01E 00835     call    TIA_LEDMTR_PlayOtoG         ;; play mled orange to green pattern 
434E ECE6 F022 00836     call        TIA_TUNE_PlayOk             ;; play ready tune    
4352 EC1D F01F 00837     call    TIA_LEDMTR_Player_Off
4356 0E05      00838     movlw   0x05 ;;send CFG_BSInfo      ;; send sysex CFG BS infos
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 104


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4358 6E25      00839     movwf   TIA_SYSEX_ADDRESS
435A EC38 F02E 00840         call    _TIA_SYSEX_End_CFG_Read 
435E 9010      00841     bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00842     ;;rgoto   TIA_BANK_CheckStick_Ext_End
               00843 
4360 00844 TIA_BANK_CheckStick_Ext_End
4360 0012      00845         return
               00846        
               00847     
               00848     
               00849 ;; --------------------------------------------------------------------------
               00850 ;;  Format Stick: copy the lead default patch into the currently selected BankStick Bank
               00851 ;;  IN: bank number in TIA_PBANK
               00852 ;; --------------------------------------------------------------------------
4362 00853 TEXT_FORMATBANK_0 STRING 20, 0x00, "* Formatting xxk *  "
4362 1400 202A     M         da      ((length) << 8) | (pos), str
     6F46 6D72 
     7461 6974 
     676E 7820 
     6B78 2A20 
     2020      
4378 00854 TEXT_FORMATBANK_1 STRING 20, 0x40, "* Patch x  0     *  "
4378 1440 202A     M         da      ((length) << 8) | (pos), str
     6150 6374 
     2068 2078 
     3020 2020 
     2020 2A20 
     2020      
438E 00855 TEXT_FORMATBANK_K STRING 20, 0x40, "* Ensemble 000   *  "
438E 1440 202A     M         da      ((length) << 8) | (pos), str
     6E45 6573 
     626D 656C 
     3020 3030 
     2020 2A20 
     2020      
               00856 
43A4 00857 TIA_BANK_FormatStick
               00858         ;; select BankStick depending on TIA_BANKSTICK_CHK_CTR
43A4 4011      00859     rrncf   TIA_BANK, W
43A6 40E8      00860     rrncf   WREG, W
43A8 0B07      00861     andlw   0x07
43AA 6E1A      00862     movwf       TIA_BANKSTICK_ID
               00863 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
43AC 0F80      00864     addlw   0x80        ; (Enable verify slower write accesses)
               00865 #endif
43AE ECEE F016 00866         call    MIOS_BANKSTICK_CtrlSet
               00867     
43B2 ECE3 F01E 00868     call    TIA_LEDMTR_PlayFormat_R
               00869 
               00870         ;; determine if this is a 64k BankStick:
               00871         ;; read from address 0x8000, store value in PRODL
43B6 0E0F      00872         movlw   0x0f ;; between 0x03 - 0x7f
43B8 6E03      00873         movwf   MIOS_PARAMETER1
43BA 0E80      00874         movlw   0x80
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 105


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
43BC 6E04      00875         movwf   MIOS_PARAMETER2
43BE ECB8 F016 00876         call    MIOS_BANKSTICK_Read
43C2 6EF3      00877         movwf   PRODL
               00878 
               00879         ;; add 0x42 and write number to 0x0000
43C4 0E0F      00880         movlw   0x0f ;; between 0x03 - 0x7f
43C6 6E03      00881         movwf   MIOS_PARAMETER1
43C8 6A04      00882         clrf    MIOS_PARAMETER2
43CA 50F3      00883     movf    PRODL, W
43CC 0F42      00884         addlw   0x42
43CE ECBA F016 00885         call    MIOS_BANKSTICK_Write
43D2 A4D8      00886     skpz
               00887     rgoto   TIA_BANK_FormatStick_Err_Handler
43D4 D0BD          M         bra     label
               00888 
               00889         ;; read again number from 0x8000, check if we still see the old value
43D6 0E0F      00890         movlw   0x0f ;; between 0x03 - 0x7f
43D8 6E03      00891         movwf   MIOS_PARAMETER1
43DA 0E80      00892         movlw   0x80
43DC 6E04      00893         movwf   MIOS_PARAMETER2
43DE ECB8 F016 00894         call    MIOS_BANKSTICK_Read
43E2 18F3      00895         xorwf   PRODL, W
43E4 E107      00896     bnz     TIA_BANK_FormatStick_32k
43E6 00897 TIA_BANK_FormatStick_64k
               00898 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
43E6 8762      00899     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE
               00900 #endif
               00901         ;; set flag in size register
43E8 501A      00902         movf    TIA_BANKSTICK_ID, W
43EA ECC6 F016 00903         call    MIOS_HLP_GetBitORMask
43EE 121D      00904         iorwf   TIA_BANKSTICK_SIZE, F
               00905         ;; write 64 to address 0x0002
43F0 0E40      00906         movlw   64
               00907         rgoto   TIA_BANK_FormatStick_SizeIDCont
43F2 D006          M         bra     label
43F4 00908 TIA_BANK_FormatStick_32k
               00909 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
43F4 9762      00910     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_SIZE
               00911 #endif
               00912         ;; clear flag in size register
43F6 501A      00913         movf    TIA_BANKSTICK_ID, W
43F8 ECC4 F016 00914         call    MIOS_HLP_GetBitANDMask
43FC 161D      00915         andwf   TIA_BANKSTICK_SIZE, F
               00916         ;; write 32 to address 0x0002
43FE 0E20      00917         movlw   32
               00918         ;;rgoto TIA_BANK_FormatStick_SizeIDCont
4400 00919 TIA_BANK_FormatStick_SizeIDCont
4400 6E06      00920         movwf   TMP1
4402 5019      00921     movf    TIA_BANKSTICK_CHK_CTR, W
4404 DE50      00922         rcall   TIA_BANK_CheckStick_SelectMagic
4406 0E02      00923         movlw   0x02
4408 6E03      00924         movwf   MIOS_PARAMETER1
440A 5006      00925         movf    TMP1, W
440C ECBA F016 00926         call    MIOS_BANKSTICK_Write
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 106


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4410 A4D8      00927     skpz
               00928     rgoto   TIA_BANK_FormatStick_Err_Handler
4412 D09E          M         bra     label
               00929 
               00930         ;; print format message
               00931         ;TABLE_ADDR TEXT_FORMATBANK_0
               00932         ;call   MIOS_LCD_PrintMessage
               00933         ;call   MIOS_LCD_PrintMessage
               00934 
               00935         ;; print bankstick size
               00936         ;movlw  0x00 + 13
               00937         ;call   MIOS_LCD_CursorSet
               00938         ;movf   PRODL, W
               00939         ;call   MIOS_LCD_PrintBCD2
               00940 
               00941 
4414 0E32      00942         movlw   50                              ; wait some ms to get a stable status
4416 ECCE F016 00943         call    MIOS_Delay                      
               00944 
               00945         ;; now branch depending on Ensemble/Patch
               00946 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
441A 0E04      00947         movlw   DEFAULT_BS_KBANK_ID-1
441C 641A      00948         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               00949         rgoto   TIA_BANK_FormatStick_P
441E D022          M         bra     label
4420 B211      00950     btfsc   TIA_BANK, 1
               00951     rgoto       TIA_BANK_FormatStick_WT
4422 D010          M         bra     label
               00952     
4424 00953 TIA_BANK_FormatStick_K
               00954         ;; copy Patch 0 (internal kit) to upload buffer
4424 6AA9      00955         clrf    EEADR
4426 0E01      00956     movlw   (EEPROM_KIT >> 8) & 0xff
4428 6EAA      00957     movwf   EEADRH
442A EE07 F000 00958         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
442E 00959 TIA_BANK_FormatStick_K_CIntLoop
442E ECB0 F016 00960         call    MIOS_EEPROM_Read
4432 6EEE      00961         movwf   POSTINC0
4434 AEA9      00962         btfss   EEADR, 7
               00963         rgoto   TIA_BANK_FormatStick_K_CIntLoop
4436 D7FB          M         bra     label
               00964         ;; clear name
4438 EE07 F000 00965         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
443C 00966 TIA_BANK_FormatStick_K_ClearLoop
443C 6AEE      00967         clrf    POSTINC0
               00968         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_K_ClearLoop
443E A8E9          M         btfss   reg, bit, reg_a
4440 D7FD          M         bra     label
               00969     rgoto   TIA_BANK_FormatStick_Data    
4442 D01F          M         bra     label
               00970     
4444 00971 TIA_BANK_FormatStick_WT
               00972         ;; copy Patch 0 (internal patch) to upload buffer
4444 6AA9      00973         clrf    EEADR
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 107


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4446 0E02      00974     movlw   (EEPROM_WAVETABLE >> 8) & 0xff
4448 6EAA      00975     movwf   EEADRH
444A EE07 F000 00976         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
444E 00977 TIA_BANK_FormatStick_WT_CIntLoop
444E ECB0 F016 00978         call    MIOS_EEPROM_Read
4452 6EEE      00979         movwf   POSTINC0
4454 AEA9      00980         btfss   EEADR, 7
               00981         rgoto   TIA_BANK_FormatStick_WT_CIntLoop
4456 D7FB          M         bra     label
               00982         ;; clear name
4458 EE07 F000 00983         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
445C 00984 TIA_BANK_FormatStick_WT_ClearLoop
445C 6AEE      00985         clrf    POSTINC0
               00986         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_WT_ClearLoop
445E A8E9          M         btfss   reg, bit, reg_a
4460 D7FD          M         bra     label
               00987     rgoto   TIA_BANK_FormatStick_Data
4462 D00F          M         bra     label
               00988 
               00989 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               00990 
4464 00991 TIA_BANK_FormatStick_P
               00992         ;; copy Patch 0 (internal patch) to upload buffer
4464 6AA9      00993         clrf    EEADR
4466 0E00      00994     movlw   (EEPROM_PATCH >> 8) & 0xff
4468 6EAA      00995     movwf   EEADRH
446A EE07 F000 00996         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
446E 00997 TIA_BANK_FormatStick_P_CIntLoop
446E ECB0 F016 00998         call    MIOS_EEPROM_Read
4472 6EEE      00999         movwf   POSTINC0
4474 AEA9      01000         btfss   EEADR, 7
               01001         rgoto   TIA_BANK_FormatStick_P_CIntLoop
4476 D7FB          M         bra     label
               01002         ;; clear name
4478 EE07 F000 01003         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN
447C 01004 TIA_BANK_FormatStick_P_ClearLoop
447C 6AEE      01005         clrf    POSTINC0
               01006         BRA_IFCLR FSR0L, 4, ACCESS, TIA_BANK_FormatStick_P_ClearLoop
447E A8E9          M         btfss   reg, bit, reg_a
4480 D7FD          M         bra     label
               01007     ;;rgoto   TIA_BANK_FormatStick_Data
               01008 
               01009 
               01010 
               01011     
4482 01012 TIA_BANK_FormatStick_Data  
4482 ECE9 F01E 01013     call    TIA_LEDMTR_PlayFormat_O
               01014         ;; now format patch 1 to 127 (64k) or 63 (32k)
4486 0E01      01015         movlw   0x01
4488 6EA9      01016         movwf   EEADR   ; use EEADR as patch ctr
               01017     ;; Select BS Adress
448A 6A03      01018     clrf    MIOS_PARAMETER1
448C B0A9      01019     btfsc       EEADR, 0
448E 8E03      01020         bsf     MIOS_PARAMETER1, 7              ; select upper address range on odd bank number
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 108


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4490 30A9      01021     rrf     EEADR, W    
4492 6E04      01022         movwf   MIOS_PARAMETER2 ; copy patch to high-byte
4494 DE03      01023     rcall   TIA_BANK_GetBankStickSize
4496 B4D8      01024         skpnz
               01025     rgoto   TIA_BANK_FormatStick_Data_32k
4498 D005          M         bra     label
449A 01026 TIA_BANK_FormatStick_Data_64k
449A B011      01027         btfsc   TIA_BANK, 0
449C 8C04      01028         bsf     MIOS_PARAMETER2, 6
449E B211      01029     btfsc       TIA_BANK, 1
44A0 8E04      01030         bsf     MIOS_PARAMETER2, 7
               01031     rgoto   TIA_BANK_FormatStick_Data_OuterLoop
44A2 D005          M         bra     label
44A4 01032 TIA_BANK_FormatStick_Data_32k
44A4 9A04      01033     bcf MIOS_PARAMETER2, 5
44A6 B011      01034         btfsc   TIA_BANK, 0
44A8 8A04      01035         bsf     MIOS_PARAMETER2, 5
44AA B211      01036     btfsc       TIA_BANK, 1
44AC 8C04      01037         bsf     MIOS_PARAMETER2, 6
               01038     
44AE 01039 TIA_BANK_FormatStick_Data_OuterLoop
               01040         ;; copy 0x80 words
44AE EE17 F000 01041         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN 
44B2 0004      01042         clrwdt                  ; feed watchdog
               01043         ;; buffer already prepared in FSR1
44B4 ECF2 F016 01044         call    MIOS_BANKSTICK_WritePage        ; write page
44B8 A4D8      01045     skpz
               01046     rgoto   TIA_BANK_FormatStick_Err_Handler
44BA D04A          M         bra     label
44BC 0E40      01047         movlw   0x40                            ; increment FSR1 by 0x40
44BE 26E1      01048         addwf   FSR1L, F
44C0 0004      01049         clrwdt                  ; feed watchdog
44C2 ECF2 F016 01050         call    MIOS_BANKSTICK_WritePage        ; write page
44C6 A4D8      01051     skpz
               01052     rgoto   TIA_BANK_FormatStick_Err_Handler
44C8 D043          M         bra     label
               01053         ;; continue until last patch is reached
44CA 2AA9      01054         incf    EEADR, F
44CC 501A      01055         movf    TIA_BANKSTICK_ID, W
44CE ECC6 F016 01056         call    MIOS_HLP_GetBitORMask
44D2 141D      01057         andwf   TIA_BANKSTICK_SIZE, W
44D4 0E7F      01058         movlw   128-1
44D6 B4D8      01059         skpnz
44D8 0E3F      01060         movlw   64-1
44DA 64A9      01061         cpfsgt  EEADR, ACCESS
               01062         rgoto TIA_BANK_FormatStick_Data_OuterLoop
44DC D7E8          M         bra     label
44DE 01063 TIA_BANK_FormatStick_Data_End
               01064      
44DE ECEF F01E 01065     call    TIA_LEDMTR_PlayFormat_G1
               01066     
               01067     ;; write bank new name
               01068     ;; add name offset to MP1 start @0x10
44E2 0E10      01069     movlw   NEW_BANK_NAME & 0xff
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 109


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
44E4 6EA9      01070         movwf   EEADR
44E6 0E03      01071     movlw   (NEW_BANK_NAME >> 8) & 0xff
44E8 6EAA      01072     movwf   EEADRH 
44EA 5019      01073     movf    TIA_BANKSTICK_CHK_CTR, W
44EC DDDC      01074         rcall   TIA_BANK_CheckStick_SelectMagic
44EE 0E10      01075     movlw   0x10
44F0 6E03      01076     movwf   MIOS_PARAMETER1
44F2 01077 TIA_BANK_FormatStick_Name_Loop
44F2 ECB0 F016 01078     call    MIOS_EEPROM_Read
44F6 ECBA F016 01079     call    MIOS_BANKSTICK_Write
44FA A4D8      01080     skpz
               01081     rgoto   TIA_BANK_FormatStick_Err_Handler
44FC D029          M         bra     label
44FE AA03      01082     btfss   MIOS_PARAMETER1, 5    ; until == 0x20
               01083     rgoto   TIA_BANK_FormatStick_Name_Loop
4500 D7F8          M         bra     label
               01084 #if 0
               01085         ;; clear address 0x0020-0x007f
               01086 TIA_BANK_FormatStick_P_CfgLoop
               01087         movlw   0x00
               01088         call    MIOS_BANKSTICK_Write            ; write 0
               01089     skpz
               01090     rgoto   TIA_BANK_FormatStick_Err_Handler
               01091         btfss   MIOS_PARAMETER1, 7    ; until == 0x80
               01092         rgoto TIA_BANK_FormatStick_P_CfgLoop
               01093 #endif
               01094     
               01095         ;;; write magic byte 0 to confirm valid content
4502 6A03      01096     clrf    MIOS_PARAMETER1
4504 0E83      01097         movlw   BANKSTICK_MAGIC0
4506 ECBA F016 01098         call    MIOS_BANKSTICK_Write
450A A4D8      01099     skpz
               01100     rgoto   TIA_BANK_FormatStick_Err_Handler
450C D021          M         bra     label
               01101     
               01102 #if DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               01103     ;; now branch depending on Kit/Patch
450E 0E04      01104         movlw   DEFAULT_BS_KBANK_ID-1
4510 641A      01105         cpfsgt  TIA_BANKSTICK_ID, ACCESS
               01106         rgoto   TIA_BANK_FormatStick_P_Cont
4512 D012          M         bra     label
4514 B211      01107     btfsc   TIA_BANK, 1
               01108     rgoto       TIA_BANK_FormatStick_WT_Cont
4516 D008          M         bra     label
               01109     
4518 01110 TIA_BANK_FormatStick_K_Cont
               01111         ;; select first external kit
               01112         ;movlw  1
               01113         ;movwf  TIA_KIT
               01114         ;; store number in EEPROM
               01115         ;call   TIA_KIT_StoreDefaultNum
               01116         ;; write magic byte K(kit/wavetable), valid content and type
4518 0E13      01117         movlw   BANKSTICK_MAGICK
451A ECBA F016 01118         call    MIOS_BANKSTICK_Write
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 110


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
451E A4D8      01119     skpz
               01120     rgoto   TIA_BANK_FormatStick_Err_Handler
4520 D017          M         bra     label
               01121 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4522 8162      01122     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
4524 9362      01123     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
               01124 #endif
               01125     rgoto   TIA_BANK_FormatStick_Cont
4526 D00E          M         bra     label
               01126 
4528 01127 TIA_BANK_FormatStick_WT_Cont 
               01128         ;; select first external wavetable
               01129         ;movlw  1
               01130         ;movwf  TIA_WT
               01131         ;; store number in EEPROM
               01132         ;call   TIA_KIT_StoreDefaultNum
               01133         ;; write magic byte K(kit/wavetable), valid content and type
4528 0E13      01134         movlw   BANKSTICK_MAGICK
452A ECBA F016 01135         call    MIOS_BANKSTICK_Write
452E A4D8      01136     skpz
               01137     rgoto   TIA_BANK_FormatStick_Err_Handler
4530 D00F          M         bra     label
               01138 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4532 8162      01139     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
4534 8362      01140     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_WT
               01141 #endif
               01142     rgoto   TIA_BANK_FormatStick_Cont
4536 D006          M         bra     label
               01143 #endif  ;; DEFAULT_BS_KBANK_ID >= 0 && DEFAULT_BS_KBANK_ID <= 7
               01144 
4538 01145 TIA_BANK_FormatStick_P_Cont
               01146         ;; select first external patch
               01147         ;movlw  1
               01148         ;movwf  TIA_PRESET
               01149         ;; store number in EEPROM
               01150         ;call   TIA_KIT_StoreDefaultNum
               01151         ;; and branch to end
               01152     ;;rgoto    TIA_BANK_FormatStick_Cont
               01153         ;; write magic byte P(patch), valid content and type
4538 0E12      01154         movlw   BANKSTICK_MAGICP
453A ECBA F016 01155         call    MIOS_BANKSTICK_Write
453E A4D8      01156     skpz
               01157     rgoto   TIA_BANK_FormatStick_Err_Handler
4540 D007          M         bra     label
               01158 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4542 9162      01159     bcf TIA_DEBUG_BS_REGB, TIA_DEBUG_EE_PK
               01160 #endif
               01161     ;;rgoto   TIA_BANK_FormatStick_Cont
               01162 
4544 01163 TIA_BANK_FormatStick_Cont
               01164 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4544 8B62      01165     bsf TIA_DEBUG_BS_REGB, TIA_DEBUG_BS_FORMAT
               01166 #endif
               01167         ;; play tune, new setup will be reloaded automatically
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 111


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01168         ;movf   TIA_PBANK, W
4546 EC36 F023 01169         call    TIA_TUNE_Play1
454A ECF5 F01E 01170     call    TIA_LEDMTR_PlayFormat_G2
               01171     rgoto   TIA_BANK_CheckStick_End 
454E D601          M         bra     label
               01172 
               01173     
4550 01174 TIA_BANK_FormatStick_Err_Handler
               01175 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
4550 6F61      01176     movwf   TIA_DEBUG_BS_REG6
4552 865B      01177     bsf     TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_ERROR
4554 2B60      01178     incf    TIA_DEBUG_BS_REG5, F
4556 501A      01179     movf        TIA_BANKSTICK_ID, W
4558 ECC4 F016 01180         call    MIOS_HLP_GetBitANDMask
455C 1763      01181     andwf       TIA_DEBUG_BS_REG9, F
               01182 #endif    
               01183     ;; realign on first bank of current BankStick
455E 5211      01184     movf    TIA_BANK, F
4560 0B1C      01185     andlw   0x1c
4562 28E8      01186     incf    WREG, W    ;; next will be first
4564 6E11      01187     movwf   TIA_BANK   
               01188     ;; reinit STAT registers
4566 501A      01189     movf        TIA_BANKSTICK_ID, W
4568 ECC4 F016 01190         call    MIOS_HLP_GetBitANDMask
456C 161C      01191         andwf   TIA_BANKSTICK_STAT, F
456E 161D      01192     andwf       TIA_BANKSTICK_SIZE, F
               01193 
4570 01194 TIA_BANK_FormatStickEnd
               01195         ;; set reinit counter - CS configuration will be restored after 1 second
               01196         ;movlw  10
               01197         ;movwf  CS_MENU_REINIT_CFG_CTR
4570 0012      01198         return
               01199 
               01200 ;; --------------------------------------------------------------------------
               01201 
               01202 
               01203 
               01204 
               01205 ;; --------------------------------------------------------------------------
               01206 ;;  Fix Patches - temporary routine to modify all patches stored in BankStick
               01207 ;;  IN: bank number in TIA_PBANK
               01208 ;; --------------------------------------------------------------------------
4572 01209 TEXT_FIXBANK_0 STRING 20, 0x00, "* Fixing         *  "
4572 1400 202A     M         da      ((length) << 8) | (pos), str
     6946 6978 
     676E 2020 
     2020 2020 
     2020 2A20 
     2020      
4588 01210 TEXT_FIXBANK_1 STRING 20, 0x40, "* Patch x  0     *  "
4588 1440 202A     M         da      ((length) << 8) | (pos), str
     6150 6374 
     2068 2078 
     3020 2020 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 112


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
     2020 2A20 
     2020      
               01211 
459E 01212 TIA_BANK_FixPatches
               01213 #if 0
               01214         ;; select BankStick depending on TIA_PBANK
               01215     movf    TIA_BANKSTICK_CHK_CTR, W
               01216         rcall   TIA_BANK_SetBankStickId
               01217 #if DEFAULT_TIA_DEBUG_ON == 1 && DEFAULT_TIA_DEBUG_BS == 1
               01218     addlw   0x80        ; (Enable verify slower write accesses)
               01219 #endif
               01220         call    MIOS_BANKSTICK_CtrlSet
               01221 
               01222         ;; print message
               01223         TABLE_ADDR TEXT_FIXBANK_0
               01224         call    MIOS_LCD_PrintMessage
               01225         call    MIOS_LCD_PrintMessage
               01226 
               01227         ;; print bank number
               01228         movlw   0x40 + 8
               01229         call    MIOS_LCD_CursorSet
               01230         movf    TIA_PBANK, W
               01231         addlw   'A'
               01232         call    MIOS_LCD_PrintChar
               01233 
               01234         ;; now fixing patch 1 to 127 (64k) or 63 (32k)
               01235         movlw   0x01
               01236         movwf   TIA_PRESET      ; starting patch
               01237 TIA_BANK_FixPatches_OuterLoop
               01238         movlw   0x49
               01239         call    MIOS_LCD_CursorSet
               01240         incf    TIA_PRESET, W
               01241         call    MIOS_LCD_PrintBCD3
               01242 
               01243         ;; fix pitchbender assignment if K#P not already assigned to other parameter
               01244         movlw   TIA_Ix_P_KP_BASE+TIA_Ix_Px_ASSIGN1
               01245         movwf   EEADR
               01246         clrf    EEADRH
               01247         call    TIA_BANK_SetBankStickAddress
               01248         call    MIOS_BANKSTICK_Read
               01249         bnz     TIA_BANK_FixPatches_NoPbFix
               01250 TIA_BANK_FixPatches_PbFix
               01251         decf    MIOS_PARAMETER1, F
               01252         movlw   0x50
               01253         call    MIOS_BANKSTICK_Write
               01254 TIA_BANK_FixPatches_NoPbFix
               01255 
               01256 #if 0
               01257         movf    TIA_PRESET, W
               01258         ;call   TIA_TUNE_Play3_Note
               01259 #endif
               01260 
               01261         ;; continue until last patch is reached
               01262         incf    TIA_PRESET, F
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 113


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01263 
               01264         movf    TIA_PBANK, W
               01265         call    MIOS_HLP_GetBitORMask
               01266         andwf   TIA_BANKSTICK_SIZE, W
               01267         movlw   128-1
               01268         skpnz
               01269         movlw   64-1
               01270         cpfsgt  TIA_PRESET, W
               01271         rgoto TIA_BANK_FixPatches_OuterLoop
               01272 
               01273         ;; switch to internal patch
               01274         clrf    TIA_PRESET
               01275 
               01276 TIA_BANK_FixPatchesEnd
               01277 #endif
459E 0012      01278         return
               01279 
               00382 #include "tia_tune.inc"
               00001 ; $Id: tia_tune.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Routines to play short tunes (when a BankStick is attached/deattached)
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  TIA_PLAY Disconnected Tune
               00016 ;; --------------------------------------------------------------------------
45A0 00017 TIA_TUNE_PlayDisconnect
45A0 0E0D      00018     movlw   0x0d
45A2 6E06      00019     movwf   TMP1
45A4 0E06      00020         movlw   0x06
45A6 D878      00021         rcall   TIA_TUNE_Note_Init
               00022 
45A8 0E0B      00023         movlw   0x0b
45AA D888      00024         rcall   TIA_TUNE_Note_On_Wait01
45AC 0E01      00025         movlw   0x01
45AE D886      00026         rcall   TIA_TUNE_Note_On_Wait01
45B0 0E01      00027         movlw   0x01
45B2 D887      00028         rcall   TIA_TUNE_Wait
45B4 0E18      00029         movlw   0x18
45B6 D882      00030         rcall   TIA_TUNE_Note_On_Wait01
45B8 0E10      00031         movlw   0x10
45BA D880      00032         rcall   TIA_TUNE_Note_On_Wait01
45BC 0E04      00033         movlw   0x04
45BE D875      00034         rcall   TIA_TUNE_Note_On
45C0 0E02      00035         movlw   0x02
45C2 D87F      00036         rcall   TIA_TUNE_Wait
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 114


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
45C4 D876      00037         rcall   TIA_TUNE_Note_Off
45C6 0E02      00038         movlw   0x02
45C8 D87C      00039         rcall   TIA_TUNE_Wait
               00040 
               00041         rgoto   TIA_TUNE_End
45CA D064          M         bra     label
               00042     
               00043 ;; --------------------------------------------------------------------------
               00044 ;;  TIA_PLAY Ok Tune
               00045 ;; --------------------------------------------------------------------------
45CC 00046 TIA_TUNE_PlayOk
45CC 0E0D      00047     movlw   0x0d
45CE 6E06      00048     movwf   TMP1
45D0 0E06      00049         movlw   0x06
45D2 D862      00050         rcall   TIA_TUNE_Note_Init
               00051 
45D4 0E0B      00052         movlw   0x0b
45D6 D872      00053         rcall   TIA_TUNE_Note_On_Wait01
45D8 0E04      00054         movlw   0x04
45DA D870      00055         rcall   TIA_TUNE_Note_On_Wait01
45DC 0E01      00056         movlw   0x01
45DE D871      00057         rcall   TIA_TUNE_Wait
45E0 0E18      00058         movlw   0x18
45E2 D86C      00059         rcall   TIA_TUNE_Note_On_Wait01
45E4 0E10      00060         movlw   0x10
45E6 D86A      00061         rcall   TIA_TUNE_Note_On_Wait01
45E8 0E01      00062         movlw   0x01
45EA D85F      00063         rcall   TIA_TUNE_Note_On
45EC 0E02      00064         movlw   0x02
45EE D869      00065         rcall   TIA_TUNE_Wait
45F0 D860      00066         rcall   TIA_TUNE_Note_Off
45F2 0E02      00067         movlw   0x02
45F4 D866      00068         rcall   TIA_TUNE_Wait
               00069 
               00070         rgoto   TIA_TUNE_End
45F6 D04E          M         bra     label
               00071 
               00072 ;; --------------------------------------------------------------------------
               00073 ;;  TIA_PLAY Wrong Tune
               00074 ;; --------------------------------------------------------------------------
45F8 00075 TIA_TUNE_PlayWrong
45F8 0E0D      00076     movlw   0x0d
45FA 6E06      00077     movwf   TMP1
45FC 0E06      00078         movlw   0x06
45FE D84C      00079         rcall   TIA_TUNE_Note_Init
               00080 
4600 0E0B      00081         movlw   0x0b
4602 D85C      00082         rcall   TIA_TUNE_Note_On_Wait01
4604 0E04      00083         movlw   0x04
4606 D85A      00084         rcall   TIA_TUNE_Note_On_Wait01
4608 0E05      00085         movlw   0x05
460A D85B      00086         rcall   TIA_TUNE_Wait
460C 0E18      00087         movlw   0x18
460E D856      00088         rcall   TIA_TUNE_Note_On_Wait01
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 115


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4610 0E10      00089         movlw   0x10
4612 D854      00090         rcall   TIA_TUNE_Note_On_Wait01
4614 0E1D      00091         movlw   0x1d
4616 D849      00092         rcall   TIA_TUNE_Note_On
4618 0E0F      00093         movlw   0x0f
461A D853      00094         rcall   TIA_TUNE_Wait
461C D84A      00095         rcall   TIA_TUNE_Note_Off
461E 0E04      00096         movlw   0x04
4620 D850      00097         rcall   TIA_TUNE_Wait
               00098 
               00099         rgoto   TIA_TUNE_End   
4622 D038          M         bra     label
               00100     
               00101 ;; --------------------------------------------------------------------------
               00102 ;;  TIA_PLAY Fanfare Tune
               00103 ;; --------------------------------------------------------------------------
4624 00104 TIA_TUNE_Play_Fanfare
4624 0E02      00105     movlw   0x02
4626 D838      00106         rcall   TIA_TUNE_Note_Init
               00107 
4628 0E0F      00108     movlw   0x0f
462A 6E06      00109     movwf   TMP1
462C 0E0B      00110         movlw   0x0b
462E D846      00111         rcall   TIA_TUNE_Note_On_Wait01
4630 0E08      00112     movlw   0x08
4632 6E06      00113     movwf   TMP1
4634 0E08      00114         movlw   0x08
4636 D842      00115         rcall   TIA_TUNE_Note_On_Wait01
4638 0E04      00116     movlw   0x04
463A 6E06      00117     movwf   TMP1
463C 0E06      00118         movlw   0x06
463E D83E      00119         rcall   TIA_TUNE_Note_On_Wait01
4640 0E0B      00120     movlw   0x0b
4642 6E06      00121     movwf   TMP1
4644 0E05      00122         movlw   0x05
4646 D83A      00123         rcall   TIA_TUNE_Note_On_Wait01
               00124 
               00125 
4648 0E0F      00126         movlw   0x0f
464A D83B      00127         rcall   TIA_TUNE_Wait
464C 0E08      00128     movlw   0x08
464E 6E06      00129     movwf   TMP1
4650 0E06      00130         movlw   0x06
4652 D834      00131         rcall   TIA_TUNE_Note_On_Wait01
4654 0E04      00132     movlw       0x04
4656 D835      00133         rcall   TIA_TUNE_Wait
4658 0E0C      00134     movlw   0x0c
465A 6E06      00135     movwf   TMP1
465C 0E05      00136         movlw   0x05
465E D82E      00137         rcall   TIA_TUNE_Note_On_Wait01
               00138 
               00139 
4660 0E1A      00140         movlw   0x1a
4662 D82F      00141         rcall   TIA_TUNE_Wait
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 116


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4664 D826      00142         rcall   TIA_TUNE_Note_Off
4666 0E06      00143         movlw   0x06
4668 D82C      00144         rcall   TIA_TUNE_Wait
               00145 
               00146         rgoto   TIA_TUNE_End
466A D014          M         bra     label
               00147     
               00148 ;; --------------------------------------------------------------------------
               00149 ;;  TIA_PLAY Tune #1
               00150 ;; --------------------------------------------------------------------------
466C 00151 TIA_TUNE_Play1
466C 0E0D      00152     movlw   0x0d
466E 6E06      00153     movwf   TMP1
4670 0E08      00154         movlw   0x08
4672 D812      00155         rcall   TIA_TUNE_Note_Init
               00156 
4674 0E0B      00157         movlw   0x0b
4676 D822      00158         rcall   TIA_TUNE_Note_On_Wait01
4678 0E02      00159         movlw   0x02
467A D820      00160         rcall   TIA_TUNE_Note_On_Wait01
467C 0E03      00161         movlw   0x03
467E D821      00162         rcall   TIA_TUNE_Wait
4680 0E10      00163         movlw   0x10
4682 D81C      00164         rcall   TIA_TUNE_Note_On_Wait01
4684 0E1C      00165         movlw   0x1c
               00166         ;movf   TMP2,W
4686 D811      00167         rcall   TIA_TUNE_Note_On
4688 0E30      00168         movlw   0x30
468A D81B      00169         rcall   TIA_TUNE_Wait
468C D812      00170         rcall   TIA_TUNE_Note_Off
468E 0E04      00171         movlw   0x04
4690 D818      00172         rcall   TIA_TUNE_Wait
               00173 
               00174         rgoto   TIA_TUNE_End
4692 D000          M         bra     label
               00175     
               00176 ;; --------------------------------------------------------------------------
               00177 ;;  TIA_PLAY End 
               00178 ;; --------------------------------------------------------------------------
4694 00179 TIA_TUNE_End
4694 9010      00180         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn on TIA software synth part again
               00181         ;goto   TIA_PATCH_Init                  ; init patch and exit
4696 0012      00182     return
               00183 
               00184 
               00185 ;; --------------------------------------------------------------------------
               00186 ;;  TIA_PLAY Initialization routine
               00187 ;; --------------------------------------------------------------------------
4698 00188 TIA_TUNE_Note_Init
4698 8010      00189         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE; turn off TIA software synth part
               00190 
               00191         SET_BSR TIA_BASE
469A 0101          M         movlb   HIGH(reg)
469C 0B0F      00192         andlw   0x0f
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 117


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
469E 6F00      00193         movwf   TIA_AUDC0, BANKED
46A0 5006      00194     movf    TMP1, W
46A2 0B0F      00195     andlw   0x0f
46A4 6F04      00196         movwf   TIA_AUDV0, BANKED
46A6 EF6F F023 00197     goto        _TIA_SR_Handler
               00198 ;; --------------------------------------------------------------------------
               00199 ;;  TIA_PLAY a note (in: Note Number)
               00200 ;; --------------------------------------------------------------------------
46AA 00201 TIA_TUNE_Note_On
               00202         SET_BSR TIA_BASE
46AA 0101          M         movlb   HIGH(reg)
46AC 6F02      00203         movwf   TIA_AUDF0, BANKED
               00204 
46AE EF6F F023 00205         goto    _TIA_SR_Handler  
               00206 
46B2 00207 TIA_TUNE_Note_Off
               00208         SET_BSR TIA_BASE
46B2 0101          M         movlb   HIGH(reg)
46B4 6B04      00209         clrf    TIA_AUDV0, BANKED
46B6 6B05      00210         clrf    TIA_AUDV1, BANKED
46B8 EF6F F023 00211         goto    _TIA_SR_Handler
               00212 
46BC 00213 TIA_TUNE_Note_On_Wait01
46BC DFF6      00214         rcall   TIA_TUNE_Note_On
46BE 0E01      00215         movlw   0x01
               00216         rgoto   TIA_TUNE_Wait
46C0 D000          M         bra     label
               00217     
               00218 
               00219 ;; --------------------------------------------------------------------------
               00220 ;;  TIA_PLAY wait for a certain time and poll TIA_SR Handler
               00221 ;; --------------------------------------------------------------------------
46C2 00222 TIA_TUNE_Wait
46C2 6E06      00223         movwf   TMP1
46C4 0004      00224         clrwdt
46C6 00225 TIA_TUNE_WaitLoop
46C6 0E0A      00226         movlw   10
46C8 ECCE F016 00227         call    MIOS_Delay
46CC 2E06      00228         decfsz  TMP1, F
               00229         rgoto   TIA_TUNE_WaitLoop
46CE D7FB          M         bra     label
46D0 0012      00230         return
               00383 #include "tia_sr.inc"
               00001 ; $Id: tia_sr.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; TIA Shift Register Service Routine
               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 ; 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 118


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00012 ; ==========================================================================
               00013 ;
               00014 ; define the pins to which the MBHPS_TIA module is connected
               00015 ;
               00016 #if DEFAULT_IS_CARTRIDGE==1
               00017 TIA_SR_LAT_SCLK EQU     LATC
               00018 TIA_SR_PIN_SCLK EQU     0               ; Pin C.0
               00019 TIA_SR_LAT_RCLK EQU     LATC
               00020 TIA_SR_PIN_RCLK EQU     2               ; Pin C.2
               00021 TIA_SR_LAT_OUT  EQU     LATC
               00022 TIA_SR_PIN_OUT  EQU     3               ; Pin C.3
               00023 
               00024 TIA_SR_LAT_WR     EQU   LATC
               00025 TIA_SR_PIN_WR     EQU   1               ; Pin C.1
               00026 #else    
  00000F8C     00027 TIA_SR_LAT_SCLK EQU     LATD
  00000005     00028 TIA_SR_PIN_SCLK EQU     5               ; Pin D.5
  00000F8B     00029 TIA_SR_LAT_RCLK EQU     LATC
  00000004     00030 TIA_SR_PIN_RCLK EQU     4               ; Pin C.4
  00000F8C     00031 TIA_SR_LAT_OUT  EQU     LATD
  00000006     00032 TIA_SR_PIN_OUT  EQU     6               ; Pin D.6
               00033 
  00000F8B     00034 TIA_SR_LAT_WR   EQU     LATC
  00000005     00035 TIA_SR_PIN_WR   EQU     5               ; Pin C.5
               00036 #endif
               00037 
               00038 ;; --------------------------------------------------------------------------
               00039 ;;  Initialize the MBHP_TIA module
               00040 ;; --------------------------------------------------------------------------
46D2 00041 TIA_SR_Init
               00042         ;; reset the TIA
46D2 6A03      00043     clrf        MIOS_PARAMETER1
46D4 6A04      00044         clrf    MIOS_PARAMETER2
46D6 D827      00045         rcall   TIA_SR_Write     
46D8 0012      00046     return
               00047         ;; reset will be released with first call of TIA_SR_Handler
               00048 
               00049 ;; --------------------------------------------------------------------------
               00050 ;;  Check for changes in TIA registers, transfer values to TIA
               00051 ;;  and handle Wavetable
               00052 ;; --------------------------------------------------------------------------
46DA 00053 TIA_SR_Handler
46DA B010      00054         btfsc   TIA_STAT, TIA_STAT_ENGINE_DISABLE
46DC 0012      00055         return
               00056 
               00057         ;call   TIA_WT_Handler                  ; call wavetable handler before continue
46DE 00058 _TIA_SR_Handler
46DE 00059 TIA_SR_Start
               00060 
               00061         TABLE_ADDR TIA_SR_REGWRITE_TABLE        ; contains order of register accesses
46DE 0EE0          M         movlw   LOW(addr)               ; store Lo Byte
46E0 6EF6          M         movwf   TBLPTRL
46E2 0E47          M         movlw   HIGH(addr)              ; store Hi Byte
46E4 6EF7          M         movwf   TBLPTRH
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 119


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M #if PIC_DERIVATIVE_CODE_SIZE > 0x10000
46E6 0E00          M         movlw   UPPER(addr)             ; store Upper Byte
46E8 6EF8          M         movwf   TBLPTRU
                   M #endif
46EA 0E06      00062         movlw   6               ; number of registers (0x06)
46EC 6E06      00063         movwf   TMP1                            ; TMP1 is the loop counter
46EE EE01 F000 00064         lfsr    FSR0, TIA_BASE                  ; store base address of TIA registers in FSR0
46F2 EE11 F010 00065         lfsr    FSR1, TIA_SHADOW_BASE           ; store base address of shadow registers in FSR1
               00066 
               00067         IRQ_DISABLE                             ; disable interrupts
46F6 9EF2          M         bcf     INTCON, GIE
               00068 
46F8 00069 TIA_SR_Loop
46F8 0009      00070         tblrd*+
46FA 50F5      00071         movf    TABLAT, W
46FC CFEB F004 00072         movff   PLUSW0, MIOS_PARAMETER2         ; store value of TIA in MIOS_PARAMETER1 and increment FSR0
               00073         BRA_IFSET TIA_STAT, TIA_STAT_FORCE_REFRESH, ACCESS, TIA_SR_Transfer; don't skip if refresh has been forced
4700 B210          M         btfsc   reg, bit, reg_a
4702 D004          M         bra     label
4704 50E3      00074         movf    PLUSW1, W                       ; get content of appr. shadow register
4706 6204      00075         cpfseq  MIOS_PARAMETER2, ACCESS; transfer to TIA if not equal
               00076         rgoto TIA_SR_Transfer   
4708 D001          M         bra     label
               00077         rgoto   TIA_SR_Next                     ; skip following code if equal
470A D008          M         bra     label
               00078 
470C 00079 TIA_SR_Transfer
               00080         ;; register change: write value into shadow register and transfer it to TIA
470C 50F5      00081         movf    TABLAT, W
470E C004 FFE3 00082         movff   MIOS_PARAMETER2, PLUSW1         ; store value in shadow register
               00083 
4712 50F5      00084         movf    TABLAT, W                       ; extract address, add offset
4714 0F05      00085     addlw   0x05
4716 6E03      00086         movwf   MIOS_PARAMETER1                 ; store in address register
               00087 
4718 D806      00088         rcall   TIA_SR_Write                    ; transfer to TIA
471A 816A      00089     bsf     TIA_LEDMTR_STAT, TIA_LEDMTR_AUDX_REQ
               00090     
471C 00091 TIA_SR_Next
471C 2E06      00092         decfsz  TMP1, F                         ; decrement loop counter until it is zero
               00093         rgoto   TIA_SR_Loop
471E D7EC          M         bra     label
               00094 
               00095         IRQ_ENABLE                              ; enable interrupts again
4720 8EF2          M         bsf     INTCON, GIE
               00096 
4722 9210      00097         bcf     TIA_STAT, TIA_STAT_FORCE_REFRESH; clear refresh request (if it has been set before)
               00098 
4724 0012      00099         return
               00100         
               00101 ;; --------------------------------------------------------------------------
               00102 ;;  TIA Write: write to TIA register
               00103 ;; --------------------------------------------------------------------------
4726 00104 TIA_SR_Write
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 120


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00105         ;; TIA signals:
               00106         ;; MIOS_PARAMETER2[4..0]: Data
               00107         ;; MIOS_PARAMETER1[3..0]: Address
               00108         ;; temporary used as counter: MIOS_PARAMETER3
               00109 
4726 9A8C      00110     bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK    ; clear clock
               00111 
               00112         ;; superfast transfer with unrolled loop (takes some memory, but guarantees the
               00113         ;; lowest system load :)
               00114 TIA_SR_WRITE_BIT MACRO reg, bit
               00115         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
               00116         btfsc   reg, bit
               00117         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
               00118         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
               00119         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00120         ENDM
               00121 #if DEFAULT_IS_CARTRIDGE==1
               00122         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 4     ; IC8.O0
               00123         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 3     ; IC8.O1
               00124         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 2     ; IC8.O2
               00125         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 1     ; IC8.O3
               00126         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 0     ; IC8.O4
               00127         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O5
               00128         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O6
               00129         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC8.O7
               00130 
               00131         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 3     ; IC7.O0
               00132         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 2     ; IC7.O1
               00133         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 1     ; IC7.O2
               00134         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 0     ; IC7.O3
               00135         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O4
               00136         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O5
               00137         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O6
               00138         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC7.O7
               00139 
               00140 #else    
               00141         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 0     ; IC2.O0
4728 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
472A B004          M         btfsc   reg, bit
472C 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
472E 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4730 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00142         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 1     ; IC2.O1
4732 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4734 B204          M         btfsc   reg, bit
4736 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4738 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
473A 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00143         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 2     ; IC2.O2
473C 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
473E B404          M         btfsc   reg, bit
4740 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4742 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4744 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 121


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00144         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 3     ; IC2.O3
4746 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4748 B604          M         btfsc   reg, bit
474A 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
474C 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
474E 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00145         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 4     ; IC2.O4
4750 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4752 B804          M         btfsc   reg, bit
4754 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4756 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4758 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00146         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O5
475A 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
475C BE04          M         btfsc   reg, bit
475E 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4760 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4762 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00147         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O6
4764 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4766 BE04          M         btfsc   reg, bit
4768 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
476A 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
476C 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00148         TIA_SR_WRITE_BIT MIOS_PARAMETER2, 7     ; IC2.O7
476E 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4770 BE04          M         btfsc   reg, bit
4772 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4774 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4776 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00149 
               00150         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 3     ; IC3.O0
4778 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
477A B603          M         btfsc   reg, bit
477C 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
477E 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4780 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00151         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 2     ; IC3.O1
4782 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4784 B403          M         btfsc   reg, bit
4786 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4788 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
478A 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00152         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 1     ; IC3.O2
478C 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
478E B203          M         btfsc   reg, bit
4790 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
4792 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
4794 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00153         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 0     ; IC3.O3
4796 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
4798 B003          M         btfsc   reg, bit
479A 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
479C 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 122


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
479E 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00154         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O4
47A0 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
47A2 BE03          M         btfsc   reg, bit
47A4 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
47A6 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
47A8 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00155         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O5
47AA 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
47AC BE03          M         btfsc   reg, bit
47AE 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
47B0 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
47B2 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00156         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O6
47B4 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
47B6 BE03          M         btfsc   reg, bit
47B8 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
47BA 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
47BC 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00157         TIA_SR_WRITE_BIT MIOS_PARAMETER1, 7     ; IC3.O7
47BE 9C8C          M         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT  ; set out pin depending on register content (reg.bit)
47C0 BE03          M         btfsc   reg, bit
47C2 8C8C          M         bsf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT
47C4 8A8C          M         bsf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; rising clock edge
47C6 9A8C          M         bcf     TIA_SR_LAT_SCLK, TIA_SR_PIN_SCLK        ; falling clock edge
               00158 #endif
47C8 888B      00159     bsf     TIA_SR_LAT_RCLK, TIA_SR_PIN_RCLK    ; latch TIA values
               00160 
47CA 9A8B      00161         bcf     TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; enable write (MBHP_TIA: chip select)
47CC 9C8C      00162         bcf     TIA_SR_LAT_OUT, TIA_SR_PIN_OUT      ; clear out pin (standby)
47CE 988B      00163     bcf     TIA_SR_LAT_RCLK, TIA_SR_PIN_RCLK    ; release latch
               00164     
47D0 9A8B      00165     bcf TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; enable write (MBHP_TIA: chip select)
47D2 D000      00166         bra     $+2                             ; to ensure compatibility with on-board oscillator,
47D4 D000      00167         bra     $+2                             ; wait for 0.840 uS (1 us) (> one TIA clock cycle)
47D6 D000      00168         bra     $+2
47D8 D000      00169         bra     $+2
47DA D000      00170         bra     $+2
47DC 8A8B      00171         bsf     TIA_SR_LAT_WR, TIA_SR_PIN_WR    ; disable write (MBHP_TIA: chip select)
               00172     
47DE 0012      00173         return
               00174 
               00175 ;; --------------------------------------------------------------------------
47E0 00176 TIA_SR_REGWRITE_TABLE
               00177         ;; order in which the TIA registers are written
47E0 0100 0302 00178         db      0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
     0504 0006 
               00179     
               00180     
               00181     
               00182     
               00384 #include "tia_sw.inc"
               00001 ; $Id: tia_sw.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 123


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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)
47E8 00009 #define TIA_SW_MEASURE_PERFORMANCE 0
               00010 ;
               00011 ; ==========================================================================
               00012 ;
               00013 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00014 ;  Idea for ENV Curve Parameter and OSC synchronization by Jess D. Skov-Nielsen
               00015 ;  Licensed for personal non-commercial use only.
               00016 ;  All other rights reserved.
               00017 ; 
               00018 ; ==========================================================================
               00019 
               00020 ;; ==========================================================================
               00021 ;;  TIA Flags
               00022 ;; ==========================================================================
               00023 
               00024 
               00025 
               00026 
  00000000     00027 Vx_STAT_VOICE_ACTIVE     EQU 0
  00000001     00028 Vx_STAT_GATE_SET_REQ     EQU 1
  00000002     00029 Vx_STAT_GATE_CLR_REQ     EQU 2
  00000003     00030 Vx_STAT_GATE_ACTIVE      EQU 3
  00000004     00031 Vx_STAT_PORTA_ENABLE     EQU 4
  00000005     00032 Vx_STAT_GATE_NOTE_ON     EQU 5
  00000006     00033 Vx_STAT_ENV_ACTIVE       EQU 6
               00034 
  00000000     00035 Vx_MODE_GSA_ACTIVE       EQU 0
  00000001     00036 Vx_MODE_PORTA_CONST      EQU 1
  00000002     00037 Vx_MODE_KEY_EXTENDED     EQU 2
  00000003     00038 Vx_MODE_VEL2AMP_ON       EQU 3
  00000004     00039 Vx_MODE_ENV2AMP_ON       EQU 4
  00000005     00040 Vx_MODE_ENV2PITCH_ON     EQU 5
  00000006     00041 Vx_MODE_ARP_SYNC_ON      EQU 6
               00042 
  00000000     00043 ENVAUDx_MODTYP_AB        EQU 0
  00000001     00044 ENVAUDx_MODTYP_AxB       EQU 1
  00000003     00045 Vx_ENV_SYNC_ON           EQU 3
               00046 
  00000000     00047 Vx_OPTION_WT_ON          EQU 0
  00000001     00048 Vx_OPTION_WTSYNC_ON      EQU 1
  00000002     00049 Vx_OPTION_KIT_ON         EQU 2
  00000003     00050 Vx_OPTION_SAMPLER_ON     EQU 3
               00051 
  00000000     00052 LFOx_MODE_ENABLE                 EQU 0
  00000001     00053 LFOx_MODE_SYNC           EQU 1
  00000002     00054 LFOx_MODE_SYNC_ALL       EQU 2
  00000003     00055 LFOx_MODE_RESERVED       EQU 3
  00000004     00056 LFOx_MODE_WAVEFORM0      EQU 4
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 124


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00000005     00057 LFOx_MODE_WAVEFORM1      EQU 5
  00000006     00058 LFOx_MODE_WAVEFORM2      EQU 6
  00000007     00059 LFOx_MODE_DECINC                 EQU 7
               00060 
  00000000     00061 ENVx_MODE_ATTACK                 EQU 0
  00000001     00062 ENVx_MODE_DECAY          EQU 1
  00000002     00063 ENVx_MODE_SUSTAIN        EQU 2
  00000003     00064 ENVx_MODE_RELEASE        EQU 3
  00000004     00065 ENVx_MODE_FREE           EQU 4
               00066 ;ENVx_MODE_RESERVED      EQU 5
               00067 ;ENVx_MODE_RESERVED      EQU 6
               00068 ;ENVx_MODE_RESERVED      EQU 7
               00069 
               00070 
  00000000     00071 ASSIGNED_LFOS_1         EQU     0
  00000001     00072 ASSIGNED_LFOS_2         EQU     1
  00000002     00073 ASSIGNED_LFOS_3         EQU     2
  00000003     00074 ASSIGNED_LFOS_4         EQU     3
  00000004     00075 ASSIGNED_ENVS_1         EQU     4
  00000005     00076 ASSIGNED_ENVS_2         EQU     5
  00000006     00077 ASSIGNED_ENVS_A0        EQU     6
  00000007     00078 ASSIGNED_ENVS_A1        EQU     7
               00079 
  00000000     00080 WT_STATE_STOP           EQU     0
  00000001     00081 WT_STATE_RESET          EQU     1
               00082 
  00000004     00083 WT_STATE_GATE           EQU     4       ; for TB303 option
  00000005     00084 WT_STATE_SLIDE          EQU     5
  00000006     00085 WT_STATE_SLIDE_PREV     EQU     6
  00000007     00086 WT_STATE_PLAY_2ND       EQU     7
               00087 
  00000000     00088 SE_OPTION_TB303         EQU     0
  00000001     00089 SE_OPTION_FIP           EQU     1
  00000002     00090 SE_OPTION_ENV2PORTA     EQU     2
  00000003     00091 SE_OPTION_ENV2VOL       EQU     3
  00000004     00092 SE_OPTION_GSA           EQU     4
               00093 
               00094 ;; ==========================================================================
               00095 
               00096 
               00097 ;; --------------------------------------------------------------------------
               00098 ;;  TIA Software Handler: Software Synthesizer part for the TIA
               00099 ;;  called by User Timer every 800 us
               00100 ;; --------------------------------------------------------------------------
47E8 00101 TIA_SW_Handler
               00102 #if TIA_SW_MEASURE_PERFORMANCE
               00103         bsf     PORTD, 4
               00104 #endif
               00105 
               00106         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
47E8 0101          M         movlb   HIGH(reg)
               00107 
               00108         ;; return immediately if engine has been disabled
47EA B010      00109         btfsc   TIA_STAT, TIA_STAT_ENGINE_DISABLE
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 125


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
47EC 0012      00110         return
               00111 
               00112         ;; handle with MIDI clock
47EE 00113 TIA_SW_Clk
47EE 2BF1      00114         incf    TIA_MIDI_SYNC_CTR, F, BANKED
               00115 
               00116         ;; register last counter value on 0xf8 or if TIA_MIDI_SYNC_CTR == 0xff (no clock received)
47F0 9DF0      00117         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED
47F2 29F1      00118         incf    TIA_MIDI_SYNC_CTR, W, BANKED
47F4 E003      00119         bz      TIA_SW_Clk_F8
               00120         BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_F8, BANKED, TIA_SW_Clk_NoF8
47F6 A9F0          M         btfss   reg, bit, reg_a
47F8 D005          M         bra     label
47FA 99F0      00121         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_F8, BANKED
47FC 00122 TIA_SW_Clk_F8
47FC 8DF0      00123         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED
47FE C1F1 F1F2 00124         movff   TIA_MIDI_SYNC_CTR, TIA_MIDI_SYNC_CTR_REG
4802 6BF1      00125         clrf    TIA_MIDI_SYNC_CTR, BANKED
4804 00126 TIA_SW_Clk_NoF8
               00127 
               00128         ;; handle with double resolution of TIA_SW clock
4804 9FF0      00129         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00130 
               00131         ;; if MIDI sync enabled: clock LFOs/ENVs two times on every MIDI clock event
4806 51F1      00132         movf    TIA_MIDI_SYNC_CTR, W, BANKED
4808 B4D8      00133         skpnz
480A 8FF0      00134         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00135 
480C 90D8      00136         clrc
480E 31F2      00137         rrf     TIA_MIDI_SYNC_CTR_REG, W, BANKED
4810 19F1      00138         xorwf   TIA_MIDI_SYNC_CTR, W, BANKED
4812 B4D8      00139         skpnz
4814 8FF0      00140         bsf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
               00141 
               00142         ;; A MIDI clock start event restarts all LFOs
               00143         BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_FA, BANKED, TIA_SW_Clk_NoFA
4816 ABF0          M         btfss   reg, bit, reg_a
4818 D003          M         bra     label
481A 9BF0      00144         bcf     TIA_MIDI_SYNC, TIA_MIDI_SYNC_FA, BANKED
481C 00145 TIA_SW_Clk_FA
481C EC25 F029 00146         call    TIA_SW_Hlp_SyncAllLFOs
               00147 
               00148         ;btfsc  TIA_SE_OPTION, SE_OPTION_TB303, BANKED
               00149         ;bsf    TIA_WT_STATE, WT_STATE_RESET, BANKED
               00150 
4820 00151 TIA_SW_Clk_NoFA
               00152 
4820 CFF3 F1F6 00153         movff   PRODL, SAVED_PRODL      ; save PROD[LH] - we are in an interrupt routine
4824 CFF4 F1F7 00154         movff   PRODH, SAVED_PRODH
               00155 
               00156         ;; generate new pseudo-random number
4828 511C      00157         movf    TIA_LFO_RANDOM_SEED_L, W, BANKED
482A 031D      00158         mulwf   TIA_LFO_RANDOM_SEED_H, BANKED
482C 50D6      00159         movf    TMR0L, W
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 126


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
482E 24F3      00160         addwf   PRODL, W
4830 6F1C      00161         movwf   TIA_LFO_RANDOM_SEED_L, BANKED
4832 0E69      00162         movlw   0x69
4834 20F4      00163         addwfc  PRODH, W
4836 6F1D      00164         movwf   TIA_LFO_RANDOM_SEED_H, BANKED
               00165 
               00166 
               00167         ;; wavetable handler: check for MIDI Sync
               00168 ;       BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_WT_ARP, BANKED, TIA_SW_Wt
               00169 ;       BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_1, BANKED, TIA_SW_Wt_End
               00170 ;TIA_SW_Wt
               00171 ;       movf    TIA_WT_RATE, W, BANKED
               00172 ;       bz      TIA_SW_Wt_End
               00173 
               00174 ;       movf    TIA_WT_CTR, W, BANKED
               00175 ;       bnz     TIA_SW_Wt_Next
               00176 
               00177 ;       comf    TIA_WT_RATE, W, BANKED
               00178 ;       andlw   0x7f
               00179 ;       BRA_IFCLR TIA_MIDI_SYNC, TIA_MIDI_SYNC_WT_ARP, BANKED, TIA_SW_Wt_IntClk
               00180 ;TIA_SW_Wt_ExtClk
               00181 ;       btfss   TIA_SE_OPTION, SE_OPTION_TB303, BANKED
               00182 ;       addlw 1
               00183 ;       movwf   TIA_WT_CTR, BANKED      
               00184 ;       rgoto   TIA_SW_Wt_PlayNext
               00185 ;TIA_SW_Wt_IntClk
               00186 ;       skpnz                   ; never use 0x00 (avoid wdt reset on overloaded engine)
               00187 ;       addlw   1
               00188 ;       movwf   TIA_WT_CTR, BANKED
               00189 ;       clrc
               00190 ;       rlf     TIA_WT_CTR, F, BANKED
               00191         ;;      rgoto   TIA_SW_Wt_PlayNext
               00192 
               00193 ;TIA_SW_Wt_PlayNext
               00194 ;       incf    TIA_WT_CLK_REQ_CTR, F, BANKED
               00195 ;       rgoto   TIA_SW_Wt_End
               00196 
               00197 ;TIA_SW_Wt_Next
               00198 ;       decf    TIA_WT_CTR, F, BANKED
               00199 ;TIA_SW_Wt_End
               00200 
               00201         ;; ARPs: check for MIDI Sync
4838 00202 TIA_SW_ARPs
4838 EE11 F020 00203         lfsr    FSR1, TIA_V1_BASE
483C 0E04      00204     movlw       TIA_Vx_MODE
483E BCE3      00205     btfsc   PLUSW1, Vx_MODE_ARP_SYNC_ON
4840 BFF0      00206     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4842 D858      00207         rcall   TIA_SW_Arp
4844 EE11 F060 00208         lfsr    FSR1, TIA_V2_BASE
4848 0E04      00209     movlw       TIA_Vx_MODE
484A BCE3      00210     btfsc   PLUSW1, Vx_MODE_ARP_SYNC_ON
484C BFF0      00211     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
484E D852      00212         rcall   TIA_SW_Arp
4850 00213 TIA_SW_ARPs_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 127


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00214 
               00215         ;; LFOs: check for MIDI Sync
4850 00216 TIA_SW_LFOs
4850 6B0F      00217         clrf    TIA_SW_LFO_NUMBER, BANKED
4852 EE11 F0A0 00218     lfsr        FSR1, TIA_LFO1_BASE
4856 B11F      00219     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_1, BANKED
4858 BFF0      00220     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
485A DB3F      00221         rcall   TIA_SW_LFO
485C 2B0F      00222         incf    TIA_SW_LFO_NUMBER, F, BANKED
485E EE11 F0A7 00223     lfsr        FSR1, TIA_LFO2_BASE
4862 B31F      00224     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_2, BANKED
4864 BFF0      00225     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4866 DB39      00226         rcall   TIA_SW_LFO
4868 2B0F      00227         incf    TIA_SW_LFO_NUMBER, F, BANKED
486A EE11 F0AE 00228     lfsr        FSR1, TIA_LFO3_BASE
486E B51F      00229     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_3, BANKED
4870 BFF0      00230     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
4872 DB33      00231         rcall   TIA_SW_LFO
4874 2B0F      00232         incf    TIA_SW_LFO_NUMBER, F, BANKED
4876 EE11 F0B5 00233     lfsr        FSR1, TIA_LFO4_BASE
487A B71F      00234     btfsc   TIA_MOD_SYNC, ASSIGNED_LFOS_4, BANKED
487C BFF0      00235     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
487E DB2D      00236         rcall   TIA_SW_LFO
4880 00237 TIA_SW_LFOs_End
               00238 
               00239         ;; ENVs: check for MIDI Sync
4880 00240 TIA_SW_ENVs
               00241     ;; Enveloppe for AUD0(voice 1)
4880 6B0F      00242         clrf    TIA_SW_ENV_NUMBER, BANKED
4882 EE11 F0BC 00243     lfsr        FSR1, TIA_ENVAUD0_BASE
4886 EE21 F020 00244     lfsr        FSR2, TIA_V1_BASE
488A 0E2A      00245     movlw   TIA_Vx_ENV_OPTION
               00246     BRA_IFCLR   PLUSW2, Vx_ENV_SYNC_ON, ACCESS, TIA_SW_ENVs_v1_Ok
488C A6DB          M         btfss   reg, bit, reg_a
488E D002          M         bra     label
               00247     BRA_IFCLR   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED, TIA_SW_ENVs_v1_Nok
4890 AFF0          M         btfss   reg, bit, reg_a
4892 D003          M         bra     label
4894 00248 TIA_SW_ENVs_v1_Ok
4894 38DB      00249         swapf   PLUSW2, W
4896 0B07      00250     andlw   0x07
4898 DB66      00251         rcall   TIA_SW_ENV
489A 00252 TIA_SW_ENVs_v1_Nok
               00253     ;; Enveloppe for AUD1(voice 2)
489A 2B0F      00254         incf    TIA_SW_ENV_NUMBER, BANKED
489C EE11 F0C7 00255     lfsr        FSR1, TIA_ENVAUD1_BASE
48A0 EE21 F060 00256     lfsr        FSR2, TIA_V2_BASE
48A4 0E2A      00257     movlw   TIA_Vx_ENV_OPTION
               00258     BRA_IFCLR   PLUSW2, Vx_ENV_SYNC_ON, ACCESS, TIA_SW_ENVs_v2_Ok
48A6 A6DB          M         btfss   reg, bit, reg_a
48A8 D002          M         bra     label
               00259     BRA_IFCLR   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED, TIA_SW_ENVs_v2_Nok
48AA AFF0          M         btfss   reg, bit, reg_a
48AC D003          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 128


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
48AE 00260 TIA_SW_ENVs_v2_Ok
48AE 38DB      00261         swapf   PLUSW2, W
48B0 0B07      00262     andlw   0x07
48B2 DB59      00263         rcall   TIA_SW_ENV
48B4 00264 TIA_SW_ENVs_v2_Nok
               00265     ;; Enveloppe 1
48B4 2B0F      00266         incf    TIA_SW_ENV_NUMBER, BANKED
48B6 EE11 F0D2 00267     lfsr        FSR1, TIA_ENV1_BASE
48BA 511E      00268         movf    TIA_ENVx_CURVES, W, BANKED
48BC B91F      00269     btfsc   TIA_MOD_SYNC, ASSIGNED_ENVS_1, BANKED
48BE BFF0      00270     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
48C0 DB52      00271         rcall   TIA_SW_ENV
               00272     ;; Enveloppe 2
48C2 2B0F      00273         incf    TIA_SW_ENV_NUMBER, BANKED
48C4 EE11 F0DD 00274     lfsr        FSR1, TIA_ENV2_BASE
48C8 391E      00275         swapf   TIA_ENVx_CURVES, W, BANKED
48CA BB1F      00276     btfsc   TIA_MOD_SYNC, ASSIGNED_ENVS_2, BANKED
48CC BFF0      00277     btfsc   TIA_MIDI_SYNC, TIA_MIDI_SYNC_TICK_2, BANKED
48CE DB4B      00278         rcall   TIA_SW_ENV
48D0 00279 TIA_SW_ENVs_End
               00280 
               00281     SET_BSR     TIA_BASE
48D0 0101          M         movlb   HIGH(reg)
48D2 6B0E      00282         clrf    TIA_SW_VOICE, BANKED    ; loop counter
48D4 EE11 F020 00283         lfsr    FSR1, TIA_V1_BASE
48D8 00284 TIA_SW_VoiceLoop
48D8 0E10      00285         movlw   TIA_Vx_NOTE
48DA 50E3      00286         movf    PLUSW1, W
48DC E002      00287         bz      TIA_SW_VoiceLoop_NoPitchChange
48DE 00288 TIA_SW_VoiceLoop_PitchChange
48DE D85C      00289         rcall   TIA_SW_Note
48E0 D8D0      00290         rcall   TIA_SW_Pitch
               00291    
48E2 00292 TIA_SW_VoiceLoop_NoPitchChange
48E2 D992      00293         rcall   TIA_SW_Porta
48E4 DA3C      00294     rcall       TIA_SW_Amp
               00295 
48E6 00296 TIA_SW_VoiceLoop_Next
48E6 0E40      00297         movlw   TIA_Vx_RECORD_LEN
48E8 26E1      00298         addwf   FSR1L, F
48EA 2B0E      00299         incf    TIA_SW_VOICE, F, BANKED
48EC 0E01      00300         movlw   2-1
48EE 650E      00301         cpfsgt  TIA_SW_VOICE, BANKED
               00302         rgoto TIA_SW_VoiceLoop
48F0 D7F3          M         bra     label
               00303 
48F2 00304 TIA_SW_Handler_End
               00305 
               00306 #if TIA_SW_MEASURE_PERFORMANCE
               00307         bcf     PORTD, 4
               00308 #endif
               00309 
48F2 0012      00310         return
               00311 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 129


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00312 
               00313 
               00314 
               00315 
               00316 ;; --------------------------------------------------------------------------
               00317 ;; This function handles the arpeggiator
               00318 ;; --------------------------------------------------------------------------
48F4 00319 TIA_SW_Arp
               00320         ;; skip if arpeggiator rate == 0
48F4 0E13      00321         movlw   TIA_Vx_ARP_RATE
48F6 50E3      00322         movf    PLUSW1, W
48F8 E04E      00323         bz      TIA_SW_Arp_End
               00324 
               00325         ;; a counter is incremented on each function call
               00326         ;; arpeggiator is stepped forward once the counter has reached the
               00327         ;; compare value: rate^0x7f + 1, multiply by 2 if MIDI sync not enabled
48FA 0A7F      00328         xorlw   0x7f
48FC 0F01      00329         addlw   1
48FE 6E0B      00330     movwf       IRQ_TMP1        ; compare value => IRQ_TMP1
4900 90D8      00331         clrc
4902 0E04      00332     movlw       TIA_Vx_MODE
4904 ACE3      00333         btfss   PLUSW1, Vx_MODE_ARP_SYNC_ON, ACCESS     ; (*2 reduce the rate a little if no MIDI sync)
4906 360B      00334         rlf     IRQ_TMP1, F
               00335 
4908 0E01      00336         movlw   1
490A 6E0C      00337         movwf   IRQ_TMP2        ; incrementer => IRQ_TMP2
               00338 
               00339         ;; special option: constant time arp cycle
               00340         ;; if 1 key is pressed, use the original incrementer
               00341         ;; if 2 keys are pressed, increment by 2
               00342         ;; if 3 keys are pressed, increment by 3
               00343         ;; if 4 keys are pressed, increment by 4
490C 0E23      00344         movlw   TIA_Vx_NOTE_STACK_1
490E 50E3      00345         movf    PLUSW1, W
4910 A4D8      00346         skpz
4912 2A0C      00347         incf    IRQ_TMP2, F
               00348 
4914 0E24      00349         movlw   TIA_Vx_NOTE_STACK_2
4916 50E3      00350         movf    PLUSW1, W
4918 A4D8      00351         skpz
491A 2A0C      00352         incf    IRQ_TMP2, F
               00353         
491C 0E25      00354         movlw   TIA_Vx_NOTE_STACK_3
491E 50E3      00355         movf    PLUSW1, W
4920 A4D8      00356         skpz
4922 2A0C      00357         incf    IRQ_TMP2, F
               00358 
               00359         ;; increment counter
4924 0E15      00360         movlw   TIA_Vx_ARP_CTR
4926 50E3      00361         movf    PLUSW1, W
4928 260C      00362         addwf   IRQ_TMP2, F
492A E206      00363         bc      TIA_SW_Arp_Overrun
492C 0E15      00364         movlw   TIA_Vx_ARP_CTR
492E C00C FFE3 00365         movff   IRQ_TMP2, PLUSW1
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 130


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00366 
               00367         ;; branch to the end so long the counter is less than the compare value
4932 500C      00368         movf    IRQ_TMP2, W
4934 5C0B      00369         subwf   IRQ_TMP1, W
4936 E22F      00370         bc      TIA_SW_Arp_End
               00371 
4938 00372 TIA_SW_Arp_Overrun
               00373         ;; clear counter
4938 0E15      00374         movlw   TIA_Vx_ARP_CTR
493A 6AE3      00375         clrf    PLUSW1
               00376 
               00377         ;; increment note number (1 of 4)
493C 0E14      00378         movlw   TIA_Vx_ARP_NOTE_NUMBER
493E 28E3      00379         incf    PLUSW1, W
4940 0B03      00380         andlw   0x03
4942 6E0B      00381         movwf   IRQ_TMP1
               00382 
               00383         ;; reset note number if last one reached (TIA_Vx_NOTE_STACK_x is zero)
4944 0E22      00384         movlw   TIA_Vx_NOTE_STACK_0
4946 240B      00385         addwf   IRQ_TMP1, W
4948 50E3      00386         movf    PLUSW1, W
494A B4D8      00387         skpnz
494C 6A0B      00388         clrf    IRQ_TMP1
               00389 
               00390         ;; save new note number
494E 0E14      00391         movlw   TIA_Vx_ARP_NOTE_NUMBER
4950 C00B FFE3 00392         movff   IRQ_TMP1, PLUSW1
               00393         
               00394         ;; select note
4954 0E1E      00395         movlw   TIA_Vx_ARP_NOTE_0
4956 240B      00396         addwf   IRQ_TMP1, W
               00397 
               00398         ;; save new note number if != zero and != last note
4958 50E3      00399         movf    PLUSW1, W
495A E01D      00400         bz      TIA_SW_Arp_NoNewNote
495C 6E0B      00401         movwf   IRQ_TMP1
495E 0E10      00402         movlw   TIA_Vx_NOTE
4960 50E3      00403         movf    PLUSW1, W
4962 180B      00404         xorwf   IRQ_TMP1, W
4964 E018      00405         bz      TIA_SW_Arp_NoNewNote
4966 00406 TIA_SW_Arp_NewNote
4966 0E10      00407         movlw   TIA_Vx_NOTE
4968 C00B FFE3 00408         movff   IRQ_TMP1, PLUSW1
               00409 
               00410 
496C 0E0E      00411         movlw   TIA_Vx_PORTA_RATE
496E 50E3      00412         movf    PLUSW1, W
4970 E012      00413         bz      TIA_SW_Arp_NoPorta
4972 00414 TIA_SW_Arp_Porta
4972 0E03      00415         movlw   TIA_Vx_STAT
4974 88E3      00416         bsf     PLUSW1, Vx_STAT_PORTA_ENABLE
               00417 
               00418         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
               00419 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 131


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00420 
4976 0E09      00421         movlw   TIA_Vx_FRQ_L
4978 CFE3 F00B 00422         movff   PLUSW1, IRQ_TMP1
497C 0E0A      00423         movlw   TIA_Vx_FRQ_H
497E CFE3 F00C 00424         movff   PLUSW1, IRQ_TMP2    
               00425 
4982 0E1C      00426         movlw   TIA_Vx_PORTA_FRQ_L
4984 C00B FFE3 00427         movff   IRQ_TMP1, PLUSW1
4988 0E1D      00428         movlw   TIA_Vx_PORTA_FRQ_H
498A C00C FFE3 00429         movff   IRQ_TMP2, PLUSW1   
               00430 
498E 0E1A      00431     movlw   TIA_Vx_PORTA_CTR_L 
4990 6AE3      00432         clrf    PLUSW1
4992 0E1B      00433     movlw   TIA_Vx_PORTA_CTR_H 
4994 6AE3      00434         clrf    PLUSW1
               00435 
               00436     
4996 00437 TIA_SW_Arp_NoV1
               00438 
4996 00439 TIA_SW_Arp_NoPorta
               00440 
4996 00441 TIA_SW_Arp_NoNewNote
               00442 
4996 00443 TIA_SW_Arp_End
4996 0012      00444         return
               00445 
               00446 
               00447 ;; --------------------------------------------------------------------------
               00448 ;; This function handles the gates and initial note frequency
               00449 ;; --------------------------------------------------------------------------
4998 00450 TIA_SW_Note
               00451 
               00452 
               00453    
               00454         ;; check note delay counter, set/clear gate bit
4998 0E12      00455         movlw   TIA_Vx_NOTE_DELAY_CTR
499A 50E3      00456         movf    PLUSW1, W
499C E003      00457         bz      TIA_SW_Note_NoDelay
499E 0E12      00458         movlw   TIA_Vx_NOTE_DELAY_CTR
49A0 06E3      00459         decf    PLUSW1, F
               00460         rgoto   TIA_SW_Note_DelayCont
49A2 D03F          M         bra     label
49A4 00461 TIA_SW_Note_NoDelay
49A4 0E03      00462         movlw   TIA_Vx_STAT
               00463         BRA_IFSET PLUSW1, Vx_STAT_GATE_CLR_REQ, ACCESS, TIA_SW_Note_NoteOffReq
49A6 B4E3          M         btfsc   reg, bit, reg_a
49A8 D003          M         bra     label
               00464         BRA_IFSET PLUSW1, Vx_STAT_GATE_SET_REQ, ACCESS, TIA_SW_Note_NoteOnReq
49AA B2E3          M         btfsc   reg, bit, reg_a
49AC D01A          M         bra     label
               00465         rgoto   TIA_SW_Note_DelayCont
49AE D039          M         bra     label
               00466     
49B0 00467 TIA_SW_Note_NoteOffReq
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 132


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4A02 30E3      00519     rrf     PLUSW1, W
4A04 40E8      00520     rrncf   WREG, W
4A06 0B0C      00521     andlw   0x0c
4A08 B10E      00522     btfsc       TIA_SW_VOICE, 0, BANKED
4A0A 38E8      00523     swapf   WREG, W
4A0C 6E0B      00524         movwf   IRQ_TMP1
               00525  
               00526         ;; sync assigned ENVs
4A0E 0E17      00527     movlw       TIA_Vx_AMP_MOD
4A10 50E3      00528         movf    PLUSW1, W
4A12 0B30      00529     andlw   0x30
4A14 120B      00530     iorwf   IRQ_TMP1, F
               00531     
4A16 0E16      00532     movlw       TIA_Vx_PITCH_MOD    
4A18 38E3      00533         swapf   PLUSW1, W
4A1A 0B03      00534     andlw   0x03
4A1C 100B      00535     iorwf   IRQ_TMP1, W
4A1E EC4B F029 00536         call    TIA_SW_Hlp_ENVAttack
               00537     
               00538 
               00539 
4A22 00540 TIA_SW_Note_DelayCont
               00541 
4A22 0E0C      00542         movlw   TIA_Vx_TRANSPOSE
4A24 50E3      00543         movf    PLUSW1, W
4A26 0840      00544         sublw   0x40
4A28 0AFF      00545         xorlw   0xff
4A2A 6E0B      00546         movwf   IRQ_TMP1
4A2C 0E10      00547         movlw   TIA_Vx_NOTE
4A2E 50E3      00548         movf    PLUSW1, W
4A30 240B      00549         addwf   IRQ_TMP1, W
4A32 0F01      00550         addlw   1
4A34 6E0C      00551         movwf   IRQ_TMP2
4A36 087F      00552         sublw   0x7f
4A38 E207      00553         bc      TIA_SW_Note_NoOverflow
4A3A 0E0C      00554         movlw   TIA_Vx_TRANSPOSE
               00555         BRA_IFSET PLUSW1, 6, ACCESS, TIA_SW_Note_PosSaturation
4A3C BCE3          M         btfsc   reg, bit, reg_a
4A3E D002          M         bra     label
4A40 00556 TIA_SW_Note_NegSaturation
4A40 6A0C      00557         clrf    IRQ_TMP2
               00558         rgoto   TIA_SW_Note_NoOverflow
4A42 D002          M         bra     label
4A44 00559 TIA_SW_Note_PosSaturation
4A44 0E7F      00560         movlw   0x7f
4A46 6E0C      00561     movwf   IRQ_TMP2
4A48 00562 TIA_SW_Note_NoOverflow
               00563         ;; set target frequency depending on note number
4A48 500C      00564         movf    IRQ_TMP2, W
4A4A BEE8      00565     btfsc       WREG, 7; the note value
4A4C 0E7F      00566         movlw 0x7f
4A4E 6E0C      00567     movwf   IRQ_TMP2
               00568     
4A50 0E04      00569         movlw   TIA_Vx_MODE
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 134


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00570         BRA_IFSET PLUSW1, Vx_MODE_KEY_EXTENDED, ACCESS, TIA_SW_Note_KeyMode_Extended    
4A52 B4E3          M         btfsc   reg, bit, reg_a
4A54 D00D          M         bra     label
4A56 00571 TIA_SW_Note_KeyMode_NonExtended 
4A56 90D8      00572     clrc
4A58 0E05      00573     movlw   TIA_Vx_KEY_OFFSET
4A5A 50E3      00574     movf    PLUSW1, W
4A5C 5E0C      00575     subwf   IRQ_TMP2, F
4A5E 0E00      00576     movlw   0x00
4A60 B0D8      00577     skpnc
4A62 0E1F      00578     movlw   0x1f
4A64 640C      00579     cpfsgt  IRQ_TMP2, ACCESS
4A66 500C      00580     movf    IRQ_TMP2, W
4A68 36E8      00581     rlf     WREG, F
4A6A 36E8      00582     rlf     WREG, F
4A6C 34E8      00583     rlf     WREG, W
               00584     rgoto   TIA_SW_Note_TargetCopy 
4A6E D002          M         bra     label
               00585 
4A70 00586 TIA_SW_Note_KeyMode_Extended      
               00587     ;;etendu (7bits to 8bits note)
4A70 90D8      00588     clrc
4A72 340C      00589     rlf     IRQ_TMP2, W
               00590 
4A74 00591 TIA_SW_Note_TargetCopy
4A74 6E03      00592     movwf   MIOS_PARAMETER1
               00593         
4A76 0E08      00594         movlw   TIA_Vx_TARGET_FRQ_H
4A78 C003 FFE3 00595         movff   MIOS_PARAMETER1, PLUSW1
4A7C 0E07      00596         movlw   TIA_Vx_TARGET_FRQ_L
4A7E 6AE3      00597         clrf    PLUSW1
4A80 00598 TIA_SW_Note_End
4A80 0012      00599         return
               00600   
               00601     
               00602 ;; --------------------------------------------------------------------------
               00603 ;; This function handles the Note Pitch
               00604 ;; --------------------------------------------------------------------------
4A82 00605 TIA_SW_Pitch
               00606         ;; skip Pitchbender+Finetune processing if PITCHRANGE == zero
4A82 0E0D      00607         movlw   TIA_Vx_PITCHRANGE
4A84 50E3      00608         movf    PLUSW1, W
4A86 E04D      00609         bz      TIA_SW_Pitch_MOD
               00610 
               00611     
               00612         ;; result stored in IRQ_TMP[12]
4A88 6A0B      00613         clrf    IRQ_TMP1
4A8A 6A0C      00614         clrf    IRQ_TMP2
4A8C 6A0D      00615     clrf        IRQ_TMP3
               00616 
               00617         ;; calc IRQ_TMP[12] = pitchbender (9-bit signed)
4A8E 0E0B      00618         movlw   TIA_Vx_PITCHBENDER
4A90 50E3      00619         movf    PLUSW1, W
4A92 6E0B      00620     movwf       IRQ_TMP1
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 135


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4A94 E007      00621         bz      TIA_SW_Pitch_NoPitchBender
4A96 00622 TIA_SW_Pitch_PitchBender
4A96 90D8      00623     clrc                        ; multiply with 2
4A98 BE0B      00624         btfsc   IRQ_TMP1, 7
4A9A 80D8      00625         setc
4A9C 360B      00626     rlf     IRQ_TMP1, F
4A9E 360D      00627     rlf     IRQ_TMP3, F
4AA0 B00D      00628         btfsc   IRQ_TMP3, 0     
4AA2 1E0B      00629     comf    IRQ_TMP1, F
4AA4 00630 TIA_SW_Pitch_NoPitchBender
               00631 
4AA4 90D8      00632         clrc
               00633         ;; skip tuning if IRQ_TMP[12] == zero
4AA6 500B      00634         movf    IRQ_TMP1, W
4AA8 100C      00635         iorwf   IRQ_TMP2, W
4AAA E03B      00636         bz      TIA_SW_Pitch_MOD
               00637 
4AAC 500B      00638         movf    IRQ_TMP1, W
4AAE 6FFA      00639         movwf   MUL_B_L, BANKED
4AB0 500C      00640         movf    IRQ_TMP2, W
4AB2 6FFB      00641         movwf   MUL_B_H, BANKED
               00642 
               00643         ;; get f_in[target], save it in IRQ_TMP[12]
4AB4 90D8      00644     clrc
4AB6 0E0C      00645         movlw   TIA_Vx_TRANSPOSE
4AB8 50E3      00646         movf    PLUSW1, W
4ABA 0840      00647         sublw   0x40
4ABC 0AFF      00648         xorlw   0xff
4ABE 6E0E      00649         movwf   IRQ_TMP4
4AC0 0E10      00650         movlw   TIA_Vx_NOTE
4AC2 50E3      00651         movf    PLUSW1, W
4AC4 240E      00652         addwf   IRQ_TMP4, W
               00653         ;; add pitchrange depending on direction with saturation
               00654         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Pitch_Decrease
4AC6 B00D          M         btfsc   reg, bit, reg_a
4AC8 D009          M         bra     label
4ACA 00655 TIA_SW_Pitch_Increase
               00656 
4ACA 0F01      00657         addlw   1
4ACC 6E0C      00658         movwf   IRQ_TMP2
4ACE 0E0D      00659         movlw   TIA_Vx_PITCHRANGE
4AD0 50E3      00660         movf    PLUSW1, W
4AD2 240C      00661         addwf   IRQ_TMP2, W
4AD4 BEE8      00662         btfsc   WREG, 7
4AD6 0E7F      00663         movlw 0x7f
4AD8 6E0C      00664         movwf   IRQ_TMP2
               00665         rgoto   TIA_SW_Pitch_Increase_Cont
4ADA D006          M         bra     label
4ADC 00666 TIA_SW_Pitch_Decrease
4ADC 6E0C      00667         movwf   IRQ_TMP2
4ADE 0E0D      00668         movlw   TIA_Vx_PITCHRANGE
4AE0 04E3      00669         decf    PLUSW1, W
4AE2 5E0C      00670         subwf   IRQ_TMP2, F
4AE4 BE0C      00671         btfsc   IRQ_TMP2, 7
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 136


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4AE6 6A0C      00672         clrf IRQ_TMP2
4AE8 00673 TIA_SW_Pitch_Increase_Cont
               00674         ;; set target frequency depending on note number
4AE8 500C      00675         movf    IRQ_TMP2, W
4AEA BEE8      00676     btfsc       WREG, 7; the note value
4AEC 0E7F      00677         movlw 0x7f
4AEE 6E0C      00678     movwf   IRQ_TMP2
               00679     
4AF0 0E04      00680         movlw   TIA_Vx_MODE
               00681         BRA_IFSET PLUSW1, Vx_MODE_KEY_EXTENDED, ACCESS, TIA_SW_Pitch_KeyMode_Extended    
4AF2 B4E3          M         btfsc   reg, bit, reg_a
4AF4 D00B          M         bra     label
4AF6 00682 TIA_SW_Pitch_KeyMode_NonExtended 
4AF6 90D8      00683     clrc
4AF8 0E05      00684     movlw   TIA_Vx_KEY_OFFSET
4AFA 50E3      00685     movf    PLUSW1, W
4AFC 5E0C      00686     subwf   IRQ_TMP2, F
4AFE 0E1F      00687     movlw   0x1f
4B00 640C      00688     cpfsgt  IRQ_TMP2, ACCESS
4B02 500C      00689     movf    IRQ_TMP2, W
4B04 36E8      00690     rlf     WREG, F
4B06 36E8      00691     rlf     WREG, F
4B08 34E8      00692     rlf     WREG, W
               00693     rgoto   TIA_SW_Pitch_KeyMode_End 
4B0A D002          M         bra     label
               00694 
4B0C 00695 TIA_SW_Pitch_KeyMode_Extended      
               00696     ;;etendu (7bits to 8bits note)
4B0C 90D8      00697     clrc
4B0E 340C      00698     rlf     IRQ_TMP2, W
               00699     
4B10 00700 TIA_SW_Pitch_KeyMode_End    
4B10 6E04      00701     movwf   MIOS_PARAMETER2
4B12 6A03      00702     clrf    MIOS_PARAMETER1
               00703     
               00704         ;; result: low-byte in WREG and MIOS_PARAMETER1, high-byte in MIOS_PARAMETER2
               00705 
               00706         ;; add and multiply to target frequency
4B14 CFE2 FFDA 00707         movff   FSR1H, FSR2H
4B18 50E1      00708         movf    FSR1L, W
4B1A 0F07      00709         addlw   TIA_Vx_TARGET_FRQ_L
4B1C 6ED9      00710         movwf   FSR2L
4B1E EC75 F029 00711         call    TIA_SW_Hlp_AddMul
               00712 
4B22 00713 TIA_SW_Pitch_MOD
4B22 0E04      00714     movlw       TIA_Vx_MODE
               00715     BRA_IFCLR PLUSW1, Vx_MODE_ENV2PITCH_ON, ACCESS, TIA_SW_Pitch_Mods
4B24 AAE3          M         btfss   reg, bit, reg_a
4B26 D045          M         bra     label
               00716 
               00717     ;; store dedicated enveloppe value in MUL_A_[LH],sign in MIOS_PARAMETER3
4B28 0E40      00718     movlw   0x40
4B2A B10E      00719     btfsc   TIA_SW_VOICE, 0
4B2C 0E80      00720     movlw   0x80
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 137


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4B2E EC3B F028 00721         call    TIA_SW_Hlp_GetMOD
               00722         ;; result in IRQ_TMP[123]
4B32 C00D F005 00723     movff   IRQ_TMP3, MIOS_PARAMETER3
4B36 500C      00724     movf    IRQ_TMP2, W
               00725     ;btfsc   MIOS_PARAMETER3, 0
               00726     ;comf    IRQ_TMP2, W
4B38 0B7F      00727     andlw   0x7f
4B3A 6FF9      00728     movwf   MUL_A_H
4B3C 500B      00729     movf    IRQ_TMP1, W
               00730     ;btfsc   MIOS_PARAMETER3, 0
               00731     ;comf    IRQ_TMP1, W
4B3E 6FF8      00732     movwf   MUL_A_L
               00733 
               00734         ;; modulate amplitude
               00735         ;; assigned LFOs and ENVs in WREG   
4B40 0E16      00736         movlw   TIA_Vx_PITCH_MOD
4B42 50E3      00737         movf    PLUSW1, W
4B44 0B3F      00738     andlw   0x3f
4B46 EC3B F028 00739         call    TIA_SW_Hlp_GetMOD
               00740         ;; result in IRQ_TMP[123]
               00741    
4B4A 00742 TIA_SW_Pitch_Mods_Env_AxB
               00743     ;; Modulation mode
4B4A 0E2A      00744     movlw   TIA_Vx_ENV_OPTION
4B4C 50E3      00745     movf    PLUSW1, W
4B4E 0B03      00746     andlw   0x03
4B50 28E8      00747     incf    WREG, W
               00748     BRA_IFCLR WREG, ENVAUDx_MODTYP_AxB, ACCESS, TIA_SW_Pitch_Mods_Env_AB  
4B52 A2E8          M         btfss   reg, bit, reg_a
4B54 D010          M         bra     label
               00749     BRA_IFSET WREG, ENVAUDx_MODTYP_AB, ACCESS,TIA_SW_Pitch_Mods_Env_AxB_NotDoubled
4B56 B0E8          M         btfsc   reg, bit, reg_a
4B58 D002          M         bra     label
               00750     ;; Double the Dedicated ENVAUDx for AxB only Mode
4B5A 37F8      00751     rlf     MUL_A_L, F
4B5C 37F9      00752     rlf     MUL_A_H, F    
4B5E 00753 TIA_SW_Pitch_Mods_Env_AxB_NotDoubled
4B5E 500C      00754     movf    IRQ_TMP2, W
4B60 6FFB      00755     movwf   MUL_B_H
4B62 500B      00756     movf    IRQ_TMP1, W
4B64 6FFA      00757     movwf   MUL_B_L
               00758     ;; multiplication
4B66 ECDA F019 00759         call    MATH_MUL16_16
4B6A 51FE      00760         movf    MUL_R_2, W, BANKED
4B6C 6E0B      00761     movwf   IRQ_TMP1   
4B6E 51FF      00762     movf        MUL_R_3, W, BANKED
4B70 6E0C      00763     movwf   IRQ_TMP2
               00764     ;; process sign
4B72 5005      00765     movf    MIOS_PARAMETER3, W
4B74 1A0D      00766     xorwf   IRQ_TMP3, F
               00767 
4B76 00768 TIA_SW_Pitch_Mods_Env_AB
               00769     ;; Modulation mode
4B76 0E2A      00770     movlw   TIA_Vx_ENV_OPTION
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 138


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4B78 50E3      00771     movf    PLUSW1, W
4B7A 0B03      00772     andlw   0x03
4B7C 28E8      00773     incf    WREG, W
               00774     BRA_IFCLR WREG, ENVAUDx_MODTYP_AB, ACCESS,TIA_SW_Pitch_Mods_Cont
4B7E A0E8          M         btfss   reg, bit, reg_a
4B80 D01E          M         bra     label
4B82 5005      00775     movf    MIOS_PARAMETER3, W
4B84 180D      00776     xorwf   IRQ_TMP3, W
4B86 E00D      00777         bz      TIA_SW_Pitch_Mods_Env_AB_Add
4B88 00778 TIA_SW_Pitch_Mods_Env_AB_Sub
4B88 500B      00779         movf    IRQ_TMP1, W
4B8A 5DF8      00780         subwf   MUL_A_L, W
4B8C 6E0B      00781     movwf   IRQ_TMP1
4B8E 500C      00782         movf    IRQ_TMP2, W
4B90 59F9      00783         subwfb  MUL_A_H, W
4B92 6E0C      00784     movwf   IRQ_TMP2
4B94 E203      00785     bc      TIA_SW_Pitch_Mods_Env_AB_Sub_NoCarry
4B96 1E0B      00786     comf    IRQ_TMP1, F        ;;Sign already in IRQ_TMP3
4B98 1E0C      00787     comf    IRQ_TMP2, F
               00788     rgoto   TIA_SW_Pitch_Mods_Cont    
4B9A D011          M         bra     label
4B9C 00789 TIA_SW_Pitch_Mods_Env_AB_Sub_NoCarry
4B9C C005 F00D 00790     movff   MIOS_PARAMETER3, IRQ_TMP3
               00791     rgoto   TIA_SW_Pitch_Mods_Cont      
4BA0 D00E          M         bra     label
               00792 
4BA2 00793 TIA_SW_Pitch_Mods_Env_AB_Add
4BA2 51F8      00794         movf    MUL_A_L, W
4BA4 260B      00795         addwf   IRQ_TMP1, F     
4BA6 51F9      00796         movf    MUL_A_H, W
4BA8 220C      00797         addwfc  IRQ_TMP2, F     
               00798         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
4BAA E309      00799         bnc     TIA_SW_Pitch_Mods_Cont
4BAC 680B      00800         setf    IRQ_TMP1        
4BAE 680C      00801         setf    IRQ_TMP2        
               00802     rgoto   TIA_SW_Pitch_Mods_Cont
4BB0 D006          M         bra     label
               00803 
4BB2 00804 TIA_SW_Pitch_Mods
               00805         ;; modulate pitch
               00806         ;; assigned LFOs and ENVs in WREG
4BB2 0E16      00807         movlw   TIA_Vx_PITCH_MOD
4BB4 50E3      00808         movf    PLUSW1, W
4BB6 0B3F      00809     andlw   0x3f
4BB8 E00C      00810     bz      TIA_SW_Pitch_CopyFrq
4BBA EC3B F028 00811         call    TIA_SW_Hlp_GetMOD
               00812         ;; unsigned result in IRQ_TMP[12]
               00813         ;; sign in IRQ_TMP3[0]    
               00814 
4BBE 00815 TIA_SW_Pitch_Mods_Cont 
               00816         ;; skip tuning if IRQ_TMP[12] == zero
4BBE 500B      00817         movf    IRQ_TMP1, W
4BC0 100C      00818         iorwf   IRQ_TMP2, W
4BC2 E007      00819         bz      TIA_SW_Pitch_CopyFrq
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 139


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00820     
               00821         ;; add to target frequency
4BC4 CFE2 FFDA 00822         movff   FSR1H, FSR2H
4BC8 50E1      00823         movf    FSR1L, W
4BCA 0F07      00824         addlw   TIA_Vx_TARGET_FRQ_L
4BCC 6ED9      00825         movwf   FSR2L
4BCE EC91 F029 00826         call    TIA_SW_Hlp_Add16
               00827                                                  
4BD2 00828 TIA_SW_Pitch_CopyFrq
4BD2 0E03      00829         movlw   TIA_Vx_STAT
               00830         BRA_IFSET PLUSW1, Vx_STAT_PORTA_ENABLE, ACCESS, TIA_SW_Pitch_End
4BD4 B8E3          M         btfsc   reg, bit, reg_a
4BD6 D017          M         bra     label
               00831 
4BD8 0E07      00832         movlw   TIA_Vx_TARGET_FRQ_L
4BDA CFE3 F003 00833         movff   PLUSW1, MIOS_PARAMETER1
4BDE 0E08      00834         movlw   TIA_Vx_TARGET_FRQ_H
4BE0 CFE3 F004 00835         movff   PLUSW1, MIOS_PARAMETER2    
               00836 
4BE4 0E09      00837         movlw   TIA_Vx_FRQ_L
4BE6 C003 FFE3 00838         movff   MIOS_PARAMETER1, PLUSW1
4BEA 0E0A      00839         movlw   TIA_Vx_FRQ_H
4BEC C004 FFE3 00840         movff   MIOS_PARAMETER2, PLUSW1     
               00841 
4BF0 EE21 F002 00842     lfsr        FSR2, TIA_AUDF0
4BF4 B10E      00843     btfsc   TIA_SW_VOICE, 0
4BF6 EE21 F003 00844     lfsr        FSR2, TIA_AUDF1
               00845 
4BFA 1C04      00846     comf    MIOS_PARAMETER2, W
4BFC 30E8      00847     rrf     WREG, W
4BFE 30E8      00848     rrf     WREG, W
4C00 30E8      00849     rrf     WREG, W
4C02 0B1F      00850     andlw   0x1f
4C04 6EDF      00851     movwf   INDF2    
               00852 
4C06 00853 TIA_SW_Pitch_End
4C06 0012      00854         return
               00855 
               00856 
               00857 ;; --------------------------------------------------------------------------
               00858 ;; This function handles the Portamento
               00859 ;; --------------------------------------------------------------------------
4C08 00860 TIA_SW_Porta
4C08 0E03      00861         movlw   TIA_Vx_STAT
               00862         BRA_IFCLR PLUSW1, Vx_STAT_PORTA_ENABLE, ACCESS, TIA_SW_Porta_End
4C0A A8E3          M         btfss   reg, bit, reg_a
4C0C D0A0          M         bra     label
               00863 
4C0E EE21 F002 00864     lfsr        FSR2, TIA_AUDF0
4C12 B10E      00865     btfsc   TIA_SW_VOICE, 0
4C14 EE21 F003 00866     lfsr        FSR2, TIA_AUDF1
               00867 
               00868         ;; branch depending on portamento option
4C18 0E04      00869         movlw   TIA_Vx_MODE
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 140


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00870         BRA_IFCLR PLUSW1, Vx_MODE_PORTA_CONST, ACCESS, TIA_SW_Porta_NORM
4C1A A2E3          M         btfss   reg, bit, reg_a
4C1C D04C          M         bra     label
               00871         ;; ------------------------------------------------------------------
               00872         ;; "constant" portamento mode (constant glide time)
4C1E 00873 TIA_SW_Porta_CONST
               00874     
               00875         ;; counter -> MUL_A_[LH]
4C1E 0E1A      00876         movlw   TIA_Vx_PORTA_CTR_L
4C20 CFE3 F1F8 00877         movff   PLUSW1, MUL_A_L
4C24 0E1B      00878         movlw   TIA_Vx_PORTA_CTR_H
4C26 CFE3 F1F9 00879         movff   PLUSW1, MUL_A_H
               00880         ;; Add delay to portamento counter -> MUL_A_[LH]
               00881         ;; get portamento delay from envelope table 
4C2A 0E0E      00882         movlw   TIA_Vx_PORTA_RATE
4C2C 50E3      00883         movf    PLUSW1, W
4C2E EC26 F032 00884         call    TIA_ENV_TABLE_Get
               00885     ;; add result to counter
4C32 90D8      00886     clrc
4C34 5003      00887     movf    MIOS_PARAMETER1, W
4C36 27F8      00888         addwf   MUL_A_L, F
4C38 5004      00889     movf    MIOS_PARAMETER2, W
4C3A 23F9      00890         addwfc  MUL_A_H, F
4C3C E23B      00891     bc     TIA_SW_Porta_CONST_Cont_Reached
               00892     
4C3E 0E1A      00893         movlw   TIA_Vx_PORTA_CTR_L
4C40 C1F8 FFE3 00894         movff   MUL_A_L, PLUSW1
4C44 0E1B      00895         movlw   TIA_Vx_PORTA_CTR_H
4C46 C1F9 FFE3 00896         movff   MUL_A_H, PLUSW1   
               00897  
               00898         ;; target frequency -> MIOS_PARAMETER[12]
4C4A 0E07      00899     movlw       TIA_Vx_TARGET_FRQ_L
4C4C CFE3 F003 00900     movff       PLUSW1, MIOS_PARAMETER1
4C50 0E08      00901         movlw   TIA_Vx_TARGET_FRQ_H
4C52 CFE3 F004 00902         movff   PLUSW1, MIOS_PARAMETER2
               00903 
               00904         ;; get difference between target and previous frequency -> IRQ_TMP[12]
4C56 0E1C      00905         movlw   TIA_Vx_PORTA_FRQ_L
4C58 50E3      00906         movf    PLUSW1, W
4C5A 5C03      00907         subwf   MIOS_PARAMETER1, W
4C5C 6E0B      00908         movwf   IRQ_TMP1
4C5E 0E1D      00909         movlw   TIA_Vx_PORTA_FRQ_H
4C60 50E3      00910         movf    PLUSW1, W
4C62 5804      00911         subwfb  MIOS_PARAMETER2, W
4C64 6E0C      00912         movwf   IRQ_TMP2
               00913         ;; convert IRQ_TMP[12] to absolute value
4C66 900D      00914     bcf IRQ_TMP3, 0
4C68 A0D8      00915     btfss   STATUS, C
4C6A 800D      00916     bsf IRQ_TMP3, 0
4C6C A0D8      00917     btfss   STATUS, C
4C6E 1E0B      00918     comf    IRQ_TMP1, F
4C70 A0D8      00919     btfss   STATUS, C
4C72 1E0C      00920     comf    IRQ_TMP2, F
               00921         ;; result in IRQ_TMP[12], sign in IRQ_TMP3[0]
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 141


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00922 
               00923         ;; increment four to ensure that target will be reached
4C74 0E01      00924     movlw       1
4C76 260B      00925         addwf   IRQ_TMP1, F
4C78 0E00      00926         movlw   0
4C7A 220C      00927         addwfc  IRQ_TMP2, F
4C7C C00B F1FA 00928         movff   IRQ_TMP1, MUL_B_L
4C80 C00C F1FB 00929         movff   IRQ_TMP2, MUL_B_H
               00930 
               00931         ;; calc MUL_A_[LH] * MUL_B_[LH]
4C84 ECDA F019 00932         call    MATH_MUL16_16
               00933         ;; result in MUL_R_2 (low-byte) and MUL_R_3 (high-byte)
               00934     
               00935         ;; branch depending on direction
               00936         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Porta_CONST_Down
4C88 B00D          M         btfsc   reg, bit, reg_a
4C8A D009          M         bra     label
4C8C 00937 TIA_SW_Porta_CONST_Up   
               00938         ;; add scaled value to starting frequency
4C8C 0E1C      00939         movlw   TIA_Vx_PORTA_FRQ_L
4C8E 50E3      00940         movf    PLUSW1, W
4C90 25FE      00941         addwf   MUL_R_2, W, BANKED
4C92 6E0B      00942         movwf   IRQ_TMP1
               00943 
4C94 0E1D      00944         movlw   TIA_Vx_PORTA_FRQ_H
4C96 50E3      00945         movf    PLUSW1, W
4C98 21FF      00946         addwfc  MUL_R_3, W, BANKED
4C9A 6E0C      00947         movwf   IRQ_TMP2
               00948 
               00949         ;; continue at normal portamento routine
               00950         rgoto   TIA_SW_Porta_CONST_Up_Cont
4C9C D033          M         bra     label
               00951     
4C9E 00952 TIA_SW_Porta_CONST_Down
               00953         ;; subtract scaled value from starting frequency
4C9E 0E1C      00954         movlw   TIA_Vx_PORTA_FRQ_L
4CA0 CFE3 F00B 00955         movff   PLUSW1, IRQ_TMP1
4CA4 0E1D      00956         movlw   TIA_Vx_PORTA_FRQ_H
4CA6 CFE3 F00C 00957         movff   PLUSW1, IRQ_TMP2
               00958 
4CAA 51FE      00959         movf    MUL_R_2, W, BANKED
4CAC 5E0B      00960         subwf   IRQ_TMP1, F
4CAE 51FF      00961         movf    MUL_R_3, W, BANKED
4CB0 5A0C      00962         subwfb  IRQ_TMP2, F
               00963 
               00964         ;; continue at normal portamento routine
               00965         rgoto   TIA_SW_Porta_CONST_Down_Cont
4CB2 D033          M         bra     label
               00966 
4CB4 00967 TIA_SW_Porta_CONST_Cont_Reached
4CB4 D038      00968     bra     TIA_SW_Porta_Cont_Reached
               00969 
               00970         ;; ------------------------------------------------------------------
               00971         ;; "normal" portamento mode (non-constant glide time)
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 142


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4CB6 00972 TIA_SW_Porta_NORM
               00973     ;; multiply rate with current frequency
               00974         ;; get portamento multiplier from envelope table -> MUL_A
4CB6 0E0E      00975         movlw   TIA_Vx_PORTA_RATE
4CB8 50E3      00976         movf    PLUSW1, W
4CBA EC26 F032 00977         call    TIA_ENV_TABLE_Get
4CBE C003 F1F8 00978         movff   MIOS_PARAMETER1, MUL_A_L
4CC2 C004 F1F9 00979         movff   MIOS_PARAMETER2, MUL_A_H
               00980 
               00981         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               00982 
               00983         ;; get current frequency -> MUL_B
               00984     
4CC6 0E09      00985         movlw   TIA_Vx_FRQ_L
4CC8 CFE3 F1FA 00986         movff   PLUSW1, MUL_B_L
4CCC CFE3 F00B 00987     movff       PLUSW1, IRQ_TMP1
4CD0 0E0A      00988         movlw   TIA_Vx_FRQ_H
4CD2 CFE3 F1FB 00989         movff   PLUSW1, MUL_B_H
4CD6 CFE3 F00C 00990     movff       PLUSW1, IRQ_TMP2
               00991     
4CDA ECDA F019 00992         call    MATH_MUL16_16
               00993         ;; result in MUL_R_2 (low-byte) and MUL_R_3 (high-byte)
               00994         ;; ensure that result is != 0
4CDE 51FE      00995         movf    MUL_R_2, W, BANKED
4CE0 11FF      00996         iorwf   MUL_R_3, W, BANKED
4CE2 B4D8      00997         skpnz
4CE4 2BFE      00998         incf    MUL_R_2, F, BANKED
               00999 
               01000         ;; TIA_Vx_FRQ += result (depending on Portamento Direction)
               01001         ;movff  MUL_R_2, IRQ_TMP1
               01002 
               01003         ;; store target frequency in MIOS_PARAMETER[12]
4CE6 0E07      01004         movlw   TIA_Vx_TARGET_FRQ_L
4CE8 CFE3 F003 01005         movff   PLUSW1, MIOS_PARAMETER1
4CEC 0E08      01006         movlw   TIA_Vx_TARGET_FRQ_H
4CEE CFE3 F004 01007         movff   PLUSW1, MIOS_PARAMETER2
               01008 
               01009         ;; branch depending on portamento direction
               01010         ;; check if value > current value
4CF2 5003      01011         movf    MIOS_PARAMETER1, W
4CF4 5C0B      01012         subwf   IRQ_TMP1, W
4CF6 5004      01013         movf    MIOS_PARAMETER2, W
4CF8 580C      01014         subwfb  IRQ_TMP2, W
4CFA E20B      01015     bc TIA_SW_Porta_Down
               01016    
4CFC 01017 TIA_SW_Porta_Up ;; decrement FRQ
4CFC 51FE      01018         movf    MUL_R_2, W
4CFE 260B      01019         addwf   IRQ_TMP1, F
4D00 51FF      01020         movf    MUL_R_3, W, BANKED
4D02 220C      01021         addwfc  IRQ_TMP2, F
               01022 
4D04 01023 TIA_SW_Porta_CONST_Up_Cont      ; re-used by ENV2 option
               01024         ;; check if value > MAX_VALUE
4D04 90D8      01025     clrc
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 143


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4D06 500B      01026         movf    IRQ_TMP1, W
4D08 5C03      01027         subwf   MIOS_PARAMETER1, W
4D0A 500C      01028         movf    IRQ_TMP2, W
4D0C 5804      01029         subwfb  MIOS_PARAMETER2, W
4D0E E213      01030         bc      TIA_SW_Porta_Cont               ; branch to end if MAX_VALUE not reached
               01031         rgoto   TIA_SW_Porta_Cont_Reached               ; else copy MAX_VALUE into value and finish portamento
4D10 D00A          M         bra     label
               01032 
4D12 01033 TIA_SW_Porta_Down  ;; increment FRQ
4D12 51FE      01034         movf    MUL_R_2, W
4D14 5E0B      01035         subwf   IRQ_TMP1, F
4D16 51FF      01036         movf    MUL_R_3, W, BANKED
4D18 5A0C      01037         subwfb  IRQ_TMP2, F
               01038 
4D1A 01039 TIA_SW_Porta_CONST_Down_Cont    ; re-used by ENV2 option
               01040         ;; check if value < MIN_VALUE
4D1A 90D8      01041     clrc
4D1C 5003      01042         movf    MIOS_PARAMETER1, W
4D1E 5C0B      01043         subwf   IRQ_TMP1, W
4D20 5004      01044         movf    MIOS_PARAMETER2, W
4D22 580C      01045         subwfb  IRQ_TMP2, W
4D24 E208      01046         bc      TIA_SW_Porta_Cont               ; branch to end if MIN_VALUE not reached
               01047         ; else copy MIN_VALUE into value and finish portamento
               01048         ;rgoto  TIA_SW_Porta_Cont_Reached               ; else copy MAX_VALUE into value and finish portamento
               01049         
4D26 01050 TIA_SW_Porta_Cont_Reached
4D26 0E07      01051         movlw   TIA_Vx_TARGET_FRQ_L
4D28 CFE3 F00B 01052         movff   PLUSW1, IRQ_TMP1
               01053     
4D2C 0E08      01054         movlw   TIA_Vx_TARGET_FRQ_H
4D2E CFE3 F00C 01055         movff   PLUSW1, IRQ_TMP2
               01056 
4D32 0E03      01057         movlw   TIA_Vx_STAT
4D34 98E3      01058         bcf     PLUSW1, Vx_STAT_PORTA_ENABLE
               01059     
4D36 01060 TIA_SW_Porta_Cont
               01061 
               01062 
               01063     
               01064     ;; Copy Freq
4D36 0E09      01065         movlw   TIA_Vx_FRQ_L
4D38 C00B FFE3 01066     movff       IRQ_TMP1, PLUSW1
4D3C 0E0A      01067         movlw   TIA_Vx_FRQ_H
4D3E C00C FFE3 01068     movff       IRQ_TMP2, PLUSW1
               01069 
4D42 1C0C      01070     comf    IRQ_TMP2, W
4D44 30E8      01071     rrf     WREG, W
4D46 30E8      01072     rrf     WREG, W
4D48 30E8      01073     rrf     WREG, W
4D4A 0B1F      01074     andlw   0x1f
4D4C 6EDF      01075     movwf   INDF2  
               01076         
4D4E 01077 TIA_SW_Porta_End    
4D4E 0012      01078         return
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 144


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01079 
               01080 ;; --------------------------------------------------------------------------
               01081 ;; Help Function used from tia_midi.inc and tia_ccin.inc to reset ENV2
               01082 ;; --------------------------------------------------------------------------
4D50 01083 TIA_SW_Hlp_PortaCTR_Reset
4D50 C000 F001 01084         movff   FSR0, FSR1
               01085 
4D54 0E1A      01086     movlw   TIA_Vx_PORTA_CTR_L 
4D56 6AE3      01087         clrf    PLUSW1, ACCESS
4D58 0E1B      01088     movlw   TIA_Vx_PORTA_CTR_H 
4D5A 6AE3      01089         clrf    PLUSW1, ACCESS
               01090 
4D5C 0012      01091         return
               01092 
               01093 ;; --------------------------------------------------------------------------
               01094 ;; This function handles the amplitude
               01095 ;; --------------------------------------------------------------------------
4D5E 01096 TIA_SW_Amp
               01097     ;; TIA_AUDCx
4D5E EE21 F000 01098     lfsr        FSR2, TIA_BASE
4D62 0E04      01099     movlw   0x04
4D64 250E      01100     addwf   TIA_SW_VOICE, W
4D66 6ED9      01101     movwf   FSR2L
               01102     
               01103 
4D68 01104 TIA_SW_Amp_MasterVol    
               01105     ;; Vx volume * Master Volume
4D68 0E0F      01106     movlw       TIA_Vx_VOLUME
4D6A 50E3      01107         movf    PLUSW1, W
4D6C 6E0B      01108     movwf   IRQ_TMP1
4D6E 510B      01109     movf    TIA_MASTER_VOL, W
4D70 0F01      01110         addlw   1
4D72 020B      01111     mulwf   IRQ_TMP1
4D74 36F3      01112     rlf     PRODL, F
4D76 34F4      01113     rlf     PRODH, W
4D78 6E03      01114     movwf   MIOS_PARAMETER1
4D7A B4D8      01115     skpnz
               01116     rgoto   TIA_SW_Amp_Gate
4D7C D090          M         bra     label
               01117 
               01118 #if 0
               01119     movlw       TIA_Vx_MODE
               01120     BRA_IFCLR PLUSW1, Vx_MODE_ENV2AMP_ON, ACCESS, TIA_SW_Amp_Mods
               01121 
               01122     ;; store dedicated enveloppe value in MUL_A_[LH],sign in MIOS_PARAMETER3
               01123     movlw   0x40
               01124     btfsc   TIA_SW_VOICE, 0
               01125     movlw   0x80
               01126         call    TIA_SW_Hlp_GetMOD
               01127         ;; result in IRQ_TMP[123]
               01128     movff   IRQ_TMP3, MIOS_PARAMETER3
               01129     movf    IRQ_TMP2, W
               01130     andlw   0x7f
               01131     movwf   MUL_A_H
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 145


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01186         subwf   MUL_A_L, W
               01187     movwf   IRQ_TMP1
               01188         movf    IRQ_TMP2, W
               01189         subwfb  MUL_A_H, W
               01190     movwf   IRQ_TMP2
               01191     clrf    IRQ_TMP3
               01192     bc      TIA_SW_Amp_Mods_Cont
               01193     clrf    IRQ_TMP1
               01194     clrf    IRQ_TMP2
               01195     rgoto   TIA_SW_Amp_Mods_Cont    
               01196 
               01197 TIA_SW_Amp_Mods_Env_AB_Pos
               01198         movf    MUL_A_L, W
               01199         addwf   IRQ_TMP1, F     
               01200         movf    MUL_A_H, W
               01201         addwfc  IRQ_TMP2, F     
               01202 TIA_SW_Amp_Mods_Env_AB_Set
               01203         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
               01204         bnc     TIA_SW_Amp_Mods_Cont
               01205         setf    IRQ_TMP1        
               01206         setf    IRQ_TMP2        
               01207     rgoto   TIA_SW_Amp_Mods_Cont
               01208 
               01209 TIA_SW_Amp_Mods
               01210         ;; modulate pitch
               01211         ;; assigned LFOs and ENVs in WREG
               01212         movlw   TIA_Vx_PITCH_MOD
               01213         movf    PLUSW1, W
               01214     andlw   0x3f
               01215     bz      TIA_SW_Amp_CopyFrq
               01216         call    TIA_SW_Hlp_GetMOD
               01217         ;; unsigned result in IRQ_TMP[12]
               01218         ;; sign in IRQ_TMP3[0]    
               01219 
               01220 TIA_SW_Amp_Mods_Cont 
               01221         ;; skip tuning if IRQ_TMP[12] == zero
               01222         movf    IRQ_TMP1, W
               01223         iorwf   IRQ_TMP2, W
               01224         bz      TIA_SW_Amp_Mods_End
               01225     
               01226                                      
               01227 #else
               01228 
4D7E 01229 TIA_SW_Amp_Mods
4D7E 0E04      01230     movlw       TIA_Vx_MODE
               01231     BRA_IFCLR PLUSW1, Vx_MODE_ENV2AMP_ON, ACCESS, TIA_SW_Amp_Mods_Cont
4D80 A8E3          M         btfss   reg, bit, reg_a
4D82 D03D          M         bra     label
               01232     
               01233     ;; Modulation type in MIOS_PARAMETER3
4D84 0E2A      01234     movlw   TIA_Vx_ENV_OPTION
4D86 50E3      01235     movf    PLUSW1, W
4D88 0B03      01236     andlw   0x03
4D8A 6E05      01237     movwf   MIOS_PARAMETER3
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 147


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4D8C 2A05      01238     incf    MIOS_PARAMETER3, F
               01239 
               01240     ;; prepare enveloppe value in MIOS_PARAMETER2
               01241     ;; env2amp in WREG
4D8E 0E40      01242     movlw   0x40
4D90 B10E      01243     btfsc   TIA_SW_VOICE, 0
4D92 0E80      01244     movlw   0x80
4D94 EC3B F028 01245         call    TIA_SW_Hlp_GetMOD
               01246         ;; result in IRQ_TMP[123]
4D98 500C      01247     movf    IRQ_TMP2, W
4D9A B00D      01248     btfsc   IRQ_TMP3, 0
4D9C 1C0C      01249     comf    IRQ_TMP2, W
4D9E 0B7F      01250     andlw   0x7f
4DA0 6E04      01251     movwf   MIOS_PARAMETER2
               01252 
               01253         ;; modulate amplitude
               01254         ;; assigned LFOs and ENVs in WREG
4DA2 0E17      01255         movlw   TIA_Vx_AMP_MOD
4DA4 50E3      01256         movf    PLUSW1, W
4DA6 0B3F      01257     andlw   0x3f
4DA8 EC3B F028 01258         call    TIA_SW_Hlp_GetMOD
               01259         ;; result in IRQ_TMP[123]
               01260     
               01261 
4DAC 01262 TIA_SW_Amp_Mods_Env_AxB
               01263     BRA_IFCLR MIOS_PARAMETER3, ENVAUDx_MODTYP_AxB, ACCESS, TIA_SW_Amp_Mods_Env_AB
4DAC A205          M         btfss   reg, bit, reg_a
4DAE D017          M         bra     label
               01264     BRA_IFSET MIOS_PARAMETER3, ENVAUDx_MODTYP_AB, ACCESS, TIA_SW_Amp_Mods_Env_AB_AxB
4DB0 B005          M         btfsc   reg, bit, reg_a
4DB2 D010          M         bra     label
4DB4 3604      01265     rlcf   MIOS_PARAMETER2, F
4DB6 0E3F      01266     movlw   0x3f
4DB8 6EF4      01267         movwf   PRODH
4DBA 6AF3      01268         clrf    PRODL
4DBC ECB5 F028 01269         call    TIA_SW_Hlp_AddOffset16
               01270     ;; result in IRQ_TMP[12]
4DC0 500C      01271     movf    IRQ_TMP2, W
4DC2 BE0C      01272     btfsc   IRQ_TMP2, 7
4DC4 0E7F      01273     movlw   0x7f
               01274     
4DC6 0204      01275     mulwf   MIOS_PARAMETER2
4DC8 36F3      01276     rlf     PRODL, F
4DCA 34F4      01277     rlf     PRODH, W
4DCC BEE8      01278     btfsc   WREG, 7
4DCE 0E7F      01279     movlw   0x7f
4DD0 6E04      01280     movwf   MIOS_PARAMETER2    
               01281     rgoto   TIA_SW_Amp_Mods_Env_Cont
4DD2 D00C          M         bra     label
               01282     
4DD4 01283 TIA_SW_Amp_Mods_Env_AB_AxB    
4DD4 500C      01284     movf    IRQ_TMP2, W
4DD6 0204      01285     mulwf   MIOS_PARAMETER2
4DD8 50F4      01286     movf    PRODH, W
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 148


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4DDA 6E0C      01287     movwf   IRQ_TMP2
4DDC 6A0B      01288     clrf    IRQ_TMP1
               01289 
4DDE 01290 TIA_SW_Amp_Mods_Env_AB
4DDE 3004      01291     rrf     MIOS_PARAMETER2, W 
4DE0 ECB1 F028 01292         call    TIA_SW_Hlp_AddOffset
               01293         ;; result in IRQ_TMP[12]  
4DE4 500C      01294     movf    IRQ_TMP2, W
4DE6 BE0C      01295     btfsc   IRQ_TMP2, 7
4DE8 0E7F      01296     movlw   0x7f
4DEA 6E04      01297     movwf   MIOS_PARAMETER2
               01298     
4DEC 01299 TIA_SW_Amp_Mods_Env_Cont
4DEC 5003      01300     movf        MIOS_PARAMETER1, W
4DEE 04E8      01301     decf    WREG, W
4DF0 0204      01302     mulwf   MIOS_PARAMETER2
4DF2 36F3      01303     rlf     PRODL, F
4DF4 34F4      01304     rlf     PRODH, W
4DF6 BEE8      01305     btfsc   WREG, 7
4DF8 0E7F      01306     movlw   0x7f
4DFA 6E03      01307     movwf   MIOS_PARAMETER1
               01308     rgoto   TIA_SW_Amp_Mods_End
4DFC D00E          M         bra     label
               01309     
4DFE 01310 TIA_SW_Amp_Mods_Cont
               01311         ;; modulate amplitude
               01312         ;; assigned LFOs and ENVs in WREG
4DFE 0E17      01313         movlw   TIA_Vx_AMP_MOD
4E00 50E3      01314         movf    PLUSW1, W
4E02 0B3F      01315     andlw   0x3f
4E04 E00A      01316     bz      TIA_SW_Amp_Mods_End
4E06 EC3B F028 01317         call    TIA_SW_Hlp_GetMOD
               01318         ;; result in IRQ_TMP[123]
4E0A B00D      01319     btfsc   IRQ_TMP3, 0
4E0C 6A03      01320     clrf    MIOS_PARAMETER1
4E0E 5003      01321     movf    MIOS_PARAMETER1, W
4E10 020C      01322     mulwf   IRQ_TMP2
4E12 44F4      01323     rlncf   PRODH, W
4E14 BEE8      01324     btfsc   WREG, 7
4E16 0E7F      01325     movlw   0x7f
4E18 6E03      01326     movwf   MIOS_PARAMETER1
               01327 #endif
4E1A 01328 TIA_SW_Amp_Mods_End
               01329 
4E1A 0E03      01330     movlw       TIA_Vx_STAT
               01331         BRA_IFSET PLUSW1, Vx_STAT_ENV_ACTIVE, ACCESS, TIA_SW_Amp_Vel   
4E1C BCE3          M         btfsc   reg, bit, reg_a
4E1E D002          M         bra     label
               01332         BRA_IFCLR PLUSW1, Vx_STAT_GATE_NOTE_ON, ACCESS, TIA_SW_Amp_Vel_End
4E20 AAE3          M         btfss   reg, bit, reg_a
4E22 D03D          M         bra     label
4E24 01333 TIA_SW_Amp_Vel    
4E24 0E04      01334     movlw       TIA_Vx_MODE
               01335     BRA_IFCLR PLUSW1, Vx_MODE_VEL2AMP_ON, ACCESS, TIA_SW_Amp_Vel_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 149


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4E26 A6E3          M         btfss   reg, bit, reg_a
4E28 D03A          M         bra     label
               01336     ;; Velocity calc
4E2A 0E29      01337     movlw   TIA_Vx_DEPTH_VELOCITY
4E2C 50E3      01338     movf        PLUSW1, W
4E2E 6E0C      01339     movwf   IRQ_TMP2
4E30 0A40      01340     xorlw   0x40
4E32 E035      01341     bz      TIA_SW_Amp_Vel_End
               01342     
4E34 6A0D      01343     clrf    IRQ_TMP3
4E36 0E29      01344     movlw   TIA_Vx_DEPTH_VELOCITY
4E38 ACE3      01345         btfss   PLUSW1, 6, ACCESS
4E3A 800D      01346     bsf     IRQ_TMP3, 0
               01347     
4E3C 500C      01348     movf    IRQ_TMP2, W
4E3E 0B3F      01349         andlw   0x3f
               01350         ;; depth * velocity
4E40 90D8      01351         clrc
4E42 34E8      01352         rlf     WREG, W
               01353         ;addlw  2
               01354     ;movwf   IRQ_TMP2
               01355        
4E44 B00D      01356     btfsc       IRQ_TMP3, 0, ACCESS
               01357     rgoto   TIA_SW_Amp_Vel_Neg
4E46 D01A          M         bra     label
               01358     
4E48 01359 TIA_SW_Amp_Vel_Pos   
4E48 0F02      01360         addlw   2
4E4A 6E0C      01361     movwf   IRQ_TMP2
               01362     
4E4C 0E28      01363     movlw       TIA_Vx_LAST_VELOCITY
4E4E 50E3      01364         movf    PLUSW1, W
4E50 020C      01365     mulwf   IRQ_TMP2
4E52 90D8      01366     clrc
4E54 36F3      01367     rlf     PRODL, F
4E56 34F4      01368     rlf     PRODH, W
4E58 0F01      01369         addlw   1
4E5A 6E0C      01370     movwf   IRQ_TMP2
               01371     
4E5C 0E04      01372     movlw       TIA_Vx_MODE
               01373     BRA_IFSET PLUSW1, Vx_MODE_GSA_ACTIVE, ACCESS, TIA_SW_Amp_Vel_Pos_GSA
4E5E B0E3          M         btfsc   reg, bit, reg_a
4E60 D006          M         bra     label
4E62 5003      01374         movf    MIOS_PARAMETER1, W
4E64 020C      01375     mulwf   IRQ_TMP2
4E66 36F3      01376     rlf     PRODL, F
4E68 34F4      01377     rlf     PRODH, W
4E6A 6E03      01378     movwf   MIOS_PARAMETER1
               01379     rgoto   TIA_SW_Amp_Vel_End
4E6C D018          M         bra     label
4E6E 01380 TIA_SW_Amp_Vel_Pos_GSA
4E6E 5003      01381         movf    MIOS_PARAMETER1, W
4E70 087F      01382     sublw   0x7f
4E72 020C      01383     mulwf   IRQ_TMP2
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 150


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4E74 36F3      01384     rlf     PRODL, F
4E76 34F4      01385     rlf     PRODH, W
4E78 2603      01386     addwf   MIOS_PARAMETER1, F
               01387     rgoto   TIA_SW_Amp_Vel_End
4E7A D011          M         bra     label
               01388 
4E7C 01389 TIA_SW_Amp_Vel_Neg
4E7C 1CE8      01390     comf    WREG, W
4E7E 0B7F      01391     andlw   0x7f
4E80 0F02      01392     addlw       2
4E82 6E0C      01393     movwf   IRQ_TMP2
               01394     
4E84 0E28      01395     movlw       TIA_Vx_LAST_VELOCITY
4E86 50E3      01396         movf    PLUSW1, W
4E88 020C      01397     mulwf   IRQ_TMP2
4E8A 90D8      01398     clrc
4E8C 36F3      01399     rlf     PRODL, F
4E8E 34F4      01400     rlf     PRODH, W
4E90 0F01      01401         addlw   1
4E92 6E0C      01402     movwf   IRQ_TMP2
               01403 
4E94 5003      01404         movf    MIOS_PARAMETER1, W
4E96 020C      01405     mulwf   IRQ_TMP2
4E98 36F3      01406     rlf     PRODL, F
4E9A 34F4      01407     rlf     PRODH, W
4E9C 5E03      01408     subwf   MIOS_PARAMETER1, F
               01409     ;rgoto   TIA_SW_Amp_Vel_End
4E9E 01410 TIA_SW_Amp_Vel_End
               01411 
4E9E 01412 TIA_SW_Amp_Gate
4E9E 0E04      01413     movlw       TIA_Vx_MODE
               01414     BRA_IFCLR PLUSW1, Vx_MODE_ENV2AMP_ON, ACCESS, TIA_SW_Amp_Gate_Act
4EA0 A8E3          M         btfss   reg, bit, reg_a
4EA2 D003          M         bra     label
4EA4 0E03      01415     movlw       TIA_Vx_STAT
               01416     BRA_IFSET PLUSW1, Vx_STAT_ENV_ACTIVE, ACCESS, TIA_SW_Amp_CopyAmp
4EA6 BCE3          M         btfsc   reg, bit, reg_a
4EA8 D011          M         bra     label
4EAA 01417 TIA_SW_Amp_Gate_Act
4EAA 0E03      01418     movlw       TIA_Vx_STAT
               01419     BRA_IFSET PLUSW1, Vx_STAT_GATE_ACTIVE, ACCESS, TIA_SW_Amp_CopyAmp
4EAC B6E3          M         btfsc   reg, bit, reg_a
4EAE D00E          M         bra     label
4EB0 0E0F      01420         movlw   0x0f
4EB2 14DF      01421         andwf   INDF2, W
4EB4 E011      01422     bz      TIA_SW_Amp_End
               01423     
4EB6 01424 TIA_SW_Amp_Gate_FadeOut
4EB6 6E0C      01425     movwf   IRQ_TMP2
4EB8 0E02      01426     movlw   0x02    ;;TIA_GATE_FADE
4EBA 5A0C      01427     subwfb  IRQ_TMP2, F
4EBC A0D8      01428     skpc
4EBE 6A0C      01429     clrf    IRQ_TMP2
4EC0 0EF0      01430         movlw   0xf0
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 151


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4EC2 16DF      01431         andwf   INDF2, F
4EC4 0E0F      01432     movlw       0x0f
4EC6 140C      01433         andwf   IRQ_TMP2, W
4EC8 12DF      01434         iorwf   INDF2, F
               01435     rgoto   TIA_SW_Amp_End
4ECA D006          M         bra     label
               01436     
4ECC 01437 TIA_SW_Amp_Gate_ClrSkp
               01438 
4ECC 01439 TIA_SW_Amp_CopyAmp
4ECC 90D8      01440     clrc
4ECE 3203      01441         rrf     MIOS_PARAMETER1, F
4ED0 4203      01442     rrncf   MIOS_PARAMETER1, F
4ED2 4003      01443     rrncf   MIOS_PARAMETER1, W
4ED4 0B0F      01444         andlw   0x0f
4ED6 6EDF      01445         movwf   INDF2
4ED8 01446 TIA_SW_Amp_End
               01447 
4ED8 0012      01448     return
               01449 
               01450 
               01451 ;; --------------------------------------------------------------------------
               01452 ;; This function handles the LFOs
               01453 ;; --------------------------------------------------------------------------
4EDA 01454 TIA_SW_LFO
               01455         ;; LFO number in TIA_SW_LFO_NUMBER - calculate base address
               01456         ;lfsr   FSR1, TIA_LFO1_BASE
               01457         ;movf   TIA_SW_LFO_NUMBER, W, BANKED
               01458         ;mullw  TIA_LFOx_RECORD_LEN
               01459         ;movf   PRODL, W
               01460         ;addwf  FSR1L, F
               01461 
               01462         ;; clear result register and skip LFO if not enabled
4EDA 0E00      01463         movlw   TIA_LFOx_MODE
               01464         BRA_IFSET PLUSW1, LFOx_MODE_ENABLE, ACCESS, TIA_SW_LFO_Enabled
4EDC B0E3          M         btfsc   reg, bit, reg_a
4EDE D005          M         bra     label
4EE0 01465 TIA_SW_LFO_Disabled
4EE0 0E05      01466         movlw   TIA_LFOx_RVALUE_L
4EE2 6AE3      01467         clrf    PLUSW1
4EE4 0E06      01468         movlw   TIA_LFOx_RVALUE_H
4EE6 6AE3      01469         clrf    PLUSW1
               01470         rgoto   TIA_SW_LFO_End
4EE8 D03D          M         bra     label
4EEA 01471 TIA_SW_LFO_Enabled
               01472         
               01473         ;; increment step counter, store result also in IRQ_TMP1
4EEA 0E02      01474         movlw   TIA_LFOx_CTR
4EEC 2AE3      01475         incf    PLUSW1, F
4EEE CFE3 F00B 01476         movff   PLUSW1, IRQ_TMP1
               01477 
               01478         ;; get CTR/ADD entry from LFO table depending on LFO Rate
4EF2 0E01      01479         movlw   TIA_LFOx_RATE
4EF4 50E3      01480         movf    PLUSW1, W
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 152


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4EF6 ECB6 F032 01481         call    TIA_LFO_TABLE_Get
               01482         ;; result: CTR value in WREG and MIOS_PARAMETER1, ADD value in MIOS_PARAMETER2
               01483 
               01484         ;; exit if max step counter value (CTR) not reached
               01485         ;;      movf    MIOS_PARAMETER1, W
4EFA 5C0B      01486         subwf   IRQ_TMP1, W     ; result of LFOx_CTR in IRQ_TMP1
4EFC E333      01487         bnc     TIA_SW_LFO_End
               01488 
               01489         ;; else clear step counter
4EFE 0E02      01490         movlw   TIA_LFOx_CTR
4F00 6AE3      01491         clrf    PLUSW1
               01492 
               01493         ;; skip multiply routine if LFO_x_DEPTH is 0x40 (zero depth)
4F02 0E04      01494         movlw   TIA_LFOx_DEPTH
4F04 50E3      01495         movf    PLUSW1, W
4F06 0A40      01496         xorlw   0x40
4F08 E105      01497         bnz     TIA_SW_LFO_DepthOk
4F0A 01498 TIA_SW_LFO_Depth40
               01499         ;; clear 16bit result value registers and exit
4F0A 0E05      01500         movlw   TIA_LFOx_RVALUE_L
4F0C 6AE3      01501         clrf    PLUSW1
4F0E 0E06      01502         movlw   TIA_LFOx_RVALUE_H
4F10 6AE3      01503         clrf    PLUSW1
               01504         rgoto   TIA_SW_LFO_End
4F12 D028          M         bra     label
4F14 01505 TIA_SW_LFO_DepthOk
               01506 
               01507         ;; add or subtract ADD value to linear LFO value
4F14 0E03      01508         movlw   TIA_LFOx_VALUE
4F16 CFE3 F00D 01509         movff   PLUSW1, IRQ_TMP3
               01510 
4F1A 0E00      01511         movlw   TIA_LFOx_MODE
               01512         BRA_IFSET PLUSW1, LFOx_MODE_DECINC, ACCESS, TIA_SW_LFO_Dec
4F1C BEE3          M         btfsc   reg, bit, reg_a
4F1E D008          M         bra     label
4F20 01513 TIA_SW_LFO_Inc
4F20 5004      01514         movf    MIOS_PARAMETER2, W              ; get ADD value
4F22 260D      01515         addwf   IRQ_TMP3, F                     ; add to linear LFO value
4F24 E30D      01516         bnc     TIA_SW_LFO_Cont                 ; skip next if max value (0xff) not reached
4F26 1C0D      01517         comf    IRQ_TMP3, W                     ; subtract the missing ticks
4F28 260D      01518         addwf   IRQ_TMP3, F
4F2A 0E00      01519         movlw   TIA_LFOx_MODE
4F2C 8EE3      01520         bsf     PLUSW1, LFOx_MODE_DECINC                ; switch to decrement
               01521         rgoto   TIA_SW_LFO_Cont
4F2E D008          M         bra     label
               01522 
4F30 01523 TIA_SW_LFO_Dec
4F30 5004      01524         movf    MIOS_PARAMETER2, W              ; get ADD value
4F32 5E0D      01525         subwf   IRQ_TMP3, F                     ; decrement from linear LFO value
4F34 E205      01526         bc      TIA_SW_LFO_Cont                 ; skip next if min value (0x00) not reached
4F36 1C0D      01527         comf    IRQ_TMP3, W                     ; add the missing ticks
4F38 0F01      01528         addlw   1
4F3A 260D      01529         addwf   IRQ_TMP3, F
4F3C 0E00      01530         movlw   TIA_LFOx_MODE
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 153


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
4F3E 9EE3      01531         bcf     PLUSW1, LFOx_MODE_DECINC                ; switch to increment
4F40 01532 TIA_SW_LFO_Cont
               01533 
               01534         ;; write back IRQ_TMP3 -> TIA_LFOx_VALUE
4F40 0E03      01535         movlw   TIA_LFOx_VALUE
4F42 C00D FFE3 01536         movff   IRQ_TMP3, PLUSW1
               01537 
               01538         ;; convert linear LFO value to waveform by using the TIA_SW_LFO_Hlp_Waveform function
               01539         ;; LFO mode in IRQ_TMP1
4F46 0E00      01540         movlw   TIA_LFOx_MODE
4F48 CFE3 F00B 01541         movff   PLUSW1, IRQ_TMP1
               01542         ;; LFO depth in IRQ_TMP2
4F4C 0E04      01543         movlw   TIA_LFOx_DEPTH
4F4E CFE3 F00C 01544         movff   PLUSW1, IRQ_TMP2
               01545         ;; linear LFO value in WREG
4F52 500D      01546         movf    IRQ_TMP3, W
               01547         ;; process waveform
               01548     
4F54 ECDB F028 01549         call    TIA_SW_LFO_Hlp_Waveform
               01550     
               01551         ;; store 16bit result in RVALUE registers
4F58 0E05      01552         movlw   TIA_LFOx_RVALUE_L
4F5A CFF3 FFE3 01553         movff   PRODL, PLUSW1
4F5E 0E06      01554         movlw   TIA_LFOx_RVALUE_H
4F60 CFF4 FFE3 01555         movff   PRODH, PLUSW1
4F64 01556 TIA_SW_LFO_End
4F64 0012      01557         return
               01558 
               01559 
               01560 ;; --------------------------------------------------------------------------
               01561 ;; This function handles the ENVs
               01562 ;; expects TIA_ENVx_CURVES bitfield (lower or upper nibble) in WREG
               01563 ;; 
               01564 ;; TIA_ENVx_CURVES.7 and TIA_ENVx_CURVES.3 contain the ACCENT flag which
               01565 ;; is used in TB303 mode (copied to IRQ_TMP4.3
               01566 ;; --------------------------------------------------------------------------
4F66 01567 TIA_SW_ENV
4F66 0B07      01568         andlw   0x07
4F68 6E0E      01569         movwf   IRQ_TMP4
               01570     
4F6A 510F      01571     movf    TIA_SW_ENV_NUMBER, W, BANKED
4F6C 0BFE      01572     andlw   0xfe
4F6E E108      01573     bnz  TIA_SW_ENV_VxStatSkp
               01574 
               01575         ;; Vx dedicated Env clear/set Active
4F70 0E03      01576     movlw   TIA_Vx_STAT
4F72 9CDB      01577     bcf     PLUSW2, Vx_STAT_ENV_ACTIVE
4F74 0E00      01578         movlw   TIA_ENVx_MODE
4F76 50E3      01579     movf    PLUSW1, W
4F78 0B1F      01580     andlw   0x1f
4F7A E002      01581     bz  TIA_SW_ENV_VxStatSkp
4F7C 0E03      01582     movlw   TIA_Vx_STAT
4F7E 8CDB      01583     bsf     PLUSW2, Vx_STAT_ENV_ACTIVE    
4F80 01584 TIA_SW_ENV_VxStatSkp
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 154


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01585 
               01586         ;; prepare call of TIA_SW_ENV_GetBendedValue
4F80 0E07      01587         movlw   TIA_ENVx_CURVE
4F82 CFE3 F00C 01588         movff   PLUSW1, IRQ_TMP2
4F86 0E02      01589         movlw   TIA_ENVx_CTR_H
4F88 CFE3 F00B 01590         movff   PLUSW1, IRQ_TMP1
               01591 
               01592         ;; branch depending on ENV state
4F8C 0E00      01593         movlw   TIA_ENVx_MODE
               01594         BRA_IFSET PLUSW1, ENVx_MODE_RELEASE, ACCESS, TIA_SW_ENV_Release
4F8E B6E3          M         btfsc   reg, bit, reg_a
4F90 D03E          M         bra     label
               01595         BRA_IFCLR PLUSW1, ENVx_MODE_ATTACK, ACCESS, TIA_SW_ENV_Calc
4F92 A0E3          M         btfss   reg, bit, reg_a
4F94 D054          M         bra     label
               01596         BRA_IFSET PLUSW1, ENVx_MODE_SUSTAIN, ACCESS, TIA_SW_ENV_Sustain
4F96 B4E3          M         btfsc   reg, bit, reg_a
4F98 D032          M         bra     label
               01597         BRA_IFSET PLUSW1, ENVx_MODE_DECAY, ACCESS, TIA_SW_ENV_Decay
4F9A B2E3          M         btfsc   reg, bit, reg_a
4F9C D013          M         bra     label
               01598 
4F9E 01599 TIA_SW_ENV_Attack
               01600         ;; get attack rate depending on curve setting
4F9E 0E03      01601         movlw   TIA_ENVx_ATTACK
4FA0 CFE3 F00D 01602         movff   PLUSW1, IRQ_TMP3
4FA4 500E      01603         movf    IRQ_TMP4, W
4FA6 0B01      01604         andlw   0x01
4FA8 ECAA F029 01605         call    TIA_SW_ENV_GetBendedValue
               01606         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01607 
               01608         ;; add to ENV counter
4FAC 0E01      01609         movlw   TIA_ENVx_CTR_L
4FAE 50E3      01610         movf    PLUSW1, W
4FB0 2603      01611         addwf   MIOS_PARAMETER1, F
4FB2 0E02      01612         movlw   TIA_ENVx_CTR_H
4FB4 50E3      01613         movf    PLUSW1, W
4FB6 2204      01614         addwfc  MIOS_PARAMETER2, F
4FB8 E342      01615         bnc     TIA_SW_ENV_Calc
               01616 
               01617         ;; if value >= 0xffff: set to 0xffff, switch to Decay
4FBA 6803      01618         setf    MIOS_PARAMETER1
4FBC 6804      01619         setf    MIOS_PARAMETER2
4FBE 0E00      01620         movlw   TIA_ENVx_MODE
4FC0 82E3      01621         bsf     PLUSW1, ENVx_MODE_DECAY
               01622         rgoto   TIA_SW_ENV_Calc
4FC2 D03D          M         bra     label
               01623     
               01624     
               01625 
4FC4 01626 TIA_SW_ENV_Decay
               01627         ;; get decay rate depending on curve setting
4FC4 0E04      01628         movlw   TIA_ENVx_DECAY
4FC6 CFE3 F00D 01629         movff   PLUSW1, IRQ_TMP3
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 155


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01630 
4FCA 500E      01631         movf    IRQ_TMP4, W
4FCC 0B02      01632         andlw   0x02
4FCE ECAA F029 01633         call    TIA_SW_ENV_GetBendedValue
               01634         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01635 
               01636         ;; subtraction with current counter value
4FD2 0E01      01637         movlw   TIA_ENVx_CTR_L
4FD4 CFE3 F00B 01638         movff   PLUSW1, IRQ_TMP1
4FD8 0E02      01639         movlw   TIA_ENVx_CTR_H
4FDA CFE3 F00C 01640         movff   PLUSW1, IRQ_TMP2
               01641 
4FDE 5003      01642         movf    MIOS_PARAMETER1, W
4FE0 5C0B      01643         subwf   IRQ_TMP1, W
4FE2 6E03      01644         movwf   MIOS_PARAMETER1
4FE4 5004      01645         movf    MIOS_PARAMETER2, W
4FE6 580C      01646         subwfb  IRQ_TMP2, W
4FE8 6E04      01647         movwf   MIOS_PARAMETER2
4FEA E309      01648         bnc     TIA_SW_ENV_Sustain
               01649 
               01650         ;; check if counter value < sustain value
4FEC 0E05      01651         movlw   TIA_ENVx_SUSTAIN
4FEE 34E3      01652         rlf     PLUSW1, W
4FF0 0BFE      01653         andlw   0xfe
4FF2 6E0B      01654         movwf   IRQ_TMP1
4FF4 0E00      01655         movlw   0x00
4FF6 5C03      01656         subwf   MIOS_PARAMETER1, W
4FF8 500B      01657         movf    IRQ_TMP1, W
4FFA 5804      01658         subwfb  MIOS_PARAMETER2, W
4FFC E220      01659         bc      TIA_SW_ENV_Calc
               01660 
4FFE 01661 TIA_SW_ENV_Sustain
               01662         ;; write sustain value into counter
4FFE 0E05      01663         movlw   TIA_ENVx_SUSTAIN
5000 34E3      01664         rlf     PLUSW1, W
5002 0BFE      01665         andlw   0xfe
5004 6E04      01666         movwf   MIOS_PARAMETER2
5006 6A03      01667         clrf    MIOS_PARAMETER1
               01668 
5008 0E00      01669         movlw   TIA_ENVx_MODE
500A 84E3      01670         bsf     PLUSW1, ENVx_MODE_SUSTAIN
               01671         rgoto   TIA_SW_ENV_Calc
500C D018          M         bra     label
               01672 
500E 01673 TIA_SW_ENV_Release
               01674         ;; get release rate depending on curve setting
500E 0E06      01675         movlw   TIA_ENVx_RELEASE
5010 CFE3 F00D 01676         movff   PLUSW1, IRQ_TMP3
5014 500E      01677         movf    IRQ_TMP4, W
5016 0B04      01678         andlw   0x04
5018 ECAA F029 01679         call    TIA_SW_ENV_GetBendedValue
               01680         ;; result: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               01681         
               01682         ;; subtraction with current counter value
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 156


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
501C 0E01      01683         movlw   TIA_ENVx_CTR_L
501E CFE3 F00B 01684         movff   PLUSW1, IRQ_TMP1
5022 0E02      01685         movlw   TIA_ENVx_CTR_H
5024 CFE3 F00C 01686         movff   PLUSW1, IRQ_TMP2
               01687 
5028 5003      01688         movf    MIOS_PARAMETER1, W
502A 5C0B      01689         subwf   IRQ_TMP1, W
502C 6E03      01690         movwf   MIOS_PARAMETER1
502E 5004      01691         movf    MIOS_PARAMETER2, W
5030 580C      01692         subwfb  IRQ_TMP2, W
5032 6E04      01693         movwf   MIOS_PARAMETER2
5034 E204      01694         bc      TIA_SW_ENV_Calc
               01695 
               01696         ;; zero reached
5036 6A03      01697         clrf    MIOS_PARAMETER1
5038 6A04      01698         clrf    MIOS_PARAMETER2
503A 0E00      01699         movlw   TIA_ENVx_MODE
503C 6AE3      01700         clrf    PLUSW1
503E 01701 TIA_SW_ENV_Calc
               01702         ;; copy MIOS_PARAMETER[12] to TIA_ENVx_CTR_[LH]
503E 0E01      01703         movlw   TIA_ENVx_CTR_L
5040 C003 FFE3 01704         movff   MIOS_PARAMETER1, PLUSW1
5044 0E02      01705         movlw   TIA_ENVx_CTR_H
5046 C004 FFE3 01706         movff   MIOS_PARAMETER2, PLUSW1
               01707 
               01708         ;; calculate envelope value depending on envelope rate
               01709         
               01710         ;; clear ENV ResultValue Registers
504A 0E09      01711         movlw   TIA_ENVx_RVALUE_L
504C 6AE3      01712         clrf    PLUSW1
504E 0E0A      01713         movlw   TIA_ENVx_RVALUE_H
5050 6AE3      01714         clrf    PLUSW1
               01715 
               01716         ;; skip multiply routine if ENV_x_DEPTH is 0x40
5052 0E08      01717         movlw   TIA_ENVx_DEPTH
5054 50E3      01718         movf    PLUSW1, W
5056 0A40      01719         xorlw 0x40
5058 E00D      01720         bz      TIA_SW_ENV_End
               01721 
               01722         ;; convert linear ENV value to waveform by using the TIA_SW_ENV_Hlp_Waveform function
               01723         ;; depth in IRQ_TMP2
505A 0E08      01724         movlw   TIA_ENVx_DEPTH
505C CFE3 F00C 01725         movff   PLUSW1, IRQ_TMP2
               01726         ;; linear ENV value in WREG
5060 0E02      01727         movlw   TIA_ENVx_CTR_H
5062 30E3      01728         rrf     PLUSW1, W
               01729         ;; process waveform
5064 ECD3 F028 01730         call    TIA_SW_ENV_Hlp_Waveform
               01731         ;; store 16bit result in RVALUE registers
5068 0E09      01732         movlw   TIA_ENVx_RVALUE_L
506A CFF3 FFE3 01733         movff   PRODL, PLUSW1
506E 0E0A      01734         movlw   TIA_ENVx_RVALUE_H
5070 CFF4 FFE3 01735         movff   PRODH, PLUSW1
5074 01736 TIA_SW_ENV_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 157


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5074 0012      01737         return
               01738 
               01739 
               01740 ;; --------------------------------------------------------------------------
               01741 ;; Help Function: add modulation values depending on enabled sources
               01742 ;; In: Enabled LFOs and ENCs in WREG, 7-bit offset in IRQ_TMP4
               01743 ;; Out: signed 16bit result value in IRQ_TMP[12]
               01744 ;; --------------------------------------------------------------------------
5076 01745 TIA_SW_Hlp_GetMOD
5076 6A0B      01746         clrf    IRQ_TMP1
5078 6A0C      01747         clrf    IRQ_TMP2
507A 6A0D      01748         clrf    IRQ_TMP3
507C 6E0E      01749         movwf   IRQ_TMP4        ; save assigned LFOs and ENVs in IRQ_TMP4
               01750 
               01751         ;; add all enabled LFO values (16 bit -> 24 bit)
               01752         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_1, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO1
507E A00E          M         btfss   reg, bit, reg_a
5080 D00A          M         bra     label
5082 01753 TIA_SW_Hlp_GetMOD_LFO1
5082 51A5      01754         movf    TIA_LFO1_BASE + TIA_LFOx_RVALUE_L, W, BANKED
5084 260B      01755         addwf   IRQ_TMP1, F
5086 51A6      01756         movf    TIA_LFO1_BASE + TIA_LFOx_RVALUE_H, W, BANKED
5088 220C      01757         addwfc  IRQ_TMP2, F
508A 0E00      01758         movlw   0x00
508C BFA6      01759         btfsc   TIA_LFO1_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
508E 0EFF      01760         movlw   0xff
5090 B0D8      01761         skpnc
5092 0F01      01762         addlw   1
5094 260D      01763         addwf   IRQ_TMP3, F
5096 01764 TIA_SW_Hlp_GetMOD_NoLFO1
               01765 
               01766         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_2, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO2
5096 A20E          M         btfss   reg, bit, reg_a
5098 D00A          M         bra     label
509A 01767 TIA_SW_Hlp_GetMOD_LFO2
509A 51AC      01768         movf    TIA_LFO2_BASE + TIA_LFOx_RVALUE_L, W, BANKED
509C 260B      01769         addwf   IRQ_TMP1, F
509E 51AD      01770         movf    TIA_LFO2_BASE + TIA_LFOx_RVALUE_H, W, BANKED
50A0 220C      01771         addwfc  IRQ_TMP2, F
50A2 0E00      01772         movlw   0x00
50A4 BFAD      01773         btfsc   TIA_LFO2_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
50A6 0EFF      01774         movlw   0xff
50A8 B0D8      01775         skpnc
50AA 0F01      01776         addlw   1
50AC 260D      01777         addwf   IRQ_TMP3, F
50AE 01778 TIA_SW_Hlp_GetMOD_NoLFO2
               01779 
               01780         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_3, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO3
50AE A40E          M         btfss   reg, bit, reg_a
50B0 D00A          M         bra     label
50B2 01781 TIA_SW_Hlp_GetMOD_LFO3
50B2 51B3      01782         movf    TIA_LFO3_BASE + TIA_LFOx_RVALUE_L, W, BANKED
50B4 260B      01783         addwf   IRQ_TMP1, F
50B6 51B4      01784         movf    TIA_LFO3_BASE + TIA_LFOx_RVALUE_H, W, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 158


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
50B8 220C      01785         addwfc  IRQ_TMP2, F
50BA 0E00      01786         movlw   0x00
50BC BFB4      01787         btfsc   TIA_LFO3_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
50BE 0EFF      01788         movlw   0xff
50C0 B0D8      01789         skpnc
50C2 0F01      01790         addlw   1
50C4 260D      01791         addwf   IRQ_TMP3, F
50C6 01792 TIA_SW_Hlp_GetMOD_NoLFO3
               01793 
               01794         BRA_IFCLR IRQ_TMP4, ASSIGNED_LFOS_4, ACCESS, TIA_SW_Hlp_GetMOD_NoLFO4
50C6 A60E          M         btfss   reg, bit, reg_a
50C8 D00A          M         bra     label
50CA 01795 TIA_SW_Hlp_GetMOD_LFO4
50CA 51BA      01796         movf    TIA_LFO4_BASE + TIA_LFOx_RVALUE_L, W, BANKED
50CC 260B      01797         addwf   IRQ_TMP1, F
50CE 51BB      01798         movf    TIA_LFO4_BASE + TIA_LFOx_RVALUE_H, W, BANKED
50D0 220C      01799         addwfc  IRQ_TMP2, F
50D2 0E00      01800         movlw   0x00
50D4 BFBB      01801         btfsc   TIA_LFO4_BASE + TIA_LFOx_RVALUE_H, 7, BANKED
50D6 0EFF      01802         movlw   0xff
50D8 B0D8      01803         skpnc
50DA 0F01      01804         addlw   1
50DC 260D      01805         addwf   IRQ_TMP3, F
50DE 01806 TIA_SW_Hlp_GetMOD_NoLFO4
               01807 
               01808         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_1, ACCESS, TIA_SW_Hlp_GetMOD_NoENV1
50DE A80E          M         btfss   reg, bit, reg_a
50E0 D00A          M         bra     label
50E2 01809 TIA_SW_Hlp_GetMOD_ENV1
50E2 51DB      01810         movf    TIA_ENV1_BASE + TIA_ENVx_RVALUE_L, W, BANKED
50E4 260B      01811         addwf   IRQ_TMP1, F
50E6 51DC      01812         movf    TIA_ENV1_BASE + TIA_ENVx_RVALUE_H, W, BANKED
50E8 220C      01813         addwfc  IRQ_TMP2, F
50EA 0E00      01814         movlw   0x00
50EC BFDC      01815         btfsc   TIA_ENV1_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
50EE 0EFF      01816         movlw   0xff
50F0 B0D8      01817         skpnc
50F2 0F01      01818         addlw   1
50F4 260D      01819         addwf   IRQ_TMP3, F
50F6 01820 TIA_SW_Hlp_GetMOD_NoENV1
               01821 
               01822         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_2, ACCESS, TIA_SW_Hlp_GetMOD_NoENV2
50F6 AA0E          M         btfss   reg, bit, reg_a
50F8 D00A          M         bra     label
50FA 01823 TIA_SW_Hlp_GetMOD_ENV2
50FA 51E6      01824         movf    TIA_ENV2_BASE + TIA_ENVx_RVALUE_L, W, BANKED
50FC 260B      01825         addwf   IRQ_TMP1, F
50FE 51E7      01826         movf    TIA_ENV2_BASE + TIA_ENVx_RVALUE_H, W, BANKED
5100 220C      01827         addwfc  IRQ_TMP2, F
5102 0E00      01828         movlw   0x00
5104 BFE7      01829         btfsc   TIA_ENV2_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
5106 0EFF      01830         movlw   0xff
5108 B0D8      01831         skpnc
510A 0F01      01832         addlw   1
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 159


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
510C 260D      01833         addwf   IRQ_TMP3, F
510E 01834 TIA_SW_Hlp_GetMOD_NoENV2
               01835 
               01836         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_A0, ACCESS, TIA_SW_Hlp_GetMOD_NoENVAUD0
510E AC0E          M         btfss   reg, bit, reg_a
5110 D00A          M         bra     label
5112 01837 TIA_SW_Hlp_GetMOD_ENVAUD0
5112 51C5      01838         movf    TIA_ENVAUD0_BASE + TIA_ENVx_RVALUE_L, W, BANKED
5114 260B      01839         addwf   IRQ_TMP1, F
5116 51C6      01840         movf    TIA_ENVAUD0_BASE + TIA_ENVx_RVALUE_H, W, BANKED
5118 220C      01841         addwfc  IRQ_TMP2, F
511A 0E00      01842         movlw   0x00
511C BFC6      01843         btfsc   TIA_ENVAUD0_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
511E 0EFF      01844         movlw   0xff
5120 B0D8      01845         skpnc
5122 0F01      01846         addlw   1
5124 260D      01847         addwf   IRQ_TMP3, F
5126 01848 TIA_SW_Hlp_GetMOD_NoENVAUD0
               01849 
               01850         BRA_IFCLR IRQ_TMP4, ASSIGNED_ENVS_A1, ACCESS, TIA_SW_Hlp_GetMOD_NoENVAUD1
5126 AE0E          M         btfss   reg, bit, reg_a
5128 D00A          M         bra     label
512A 01851 TIA_SW_Hlp_GetMOD_ENVAUD1
512A 51D0      01852         movf    TIA_ENVAUD1_BASE + TIA_ENVx_RVALUE_L, W, BANKED
512C 260B      01853         addwf   IRQ_TMP1, F
512E 51D1      01854         movf    TIA_ENVAUD1_BASE + TIA_ENVx_RVALUE_H, W, BANKED
5130 220C      01855         addwfc  IRQ_TMP2, F
5132 0E00      01856         movlw   0x00
5134 BFD1      01857         btfsc   TIA_ENVAUD1_BASE + TIA_ENVx_RVALUE_H, 7, BANKED
5136 0EFF      01858         movlw   0xff
5138 B0D8      01859         skpnc
513A 0F01      01860         addlw   1
513C 260D      01861         addwf   IRQ_TMP3, F
513E 01862 TIA_SW_Hlp_GetMOD_NoENVAUD1
               01863         
               01864         ;; saturate to absolute 16 bit-value, keep sign in IRQ_TMP3[0]
               01865         BRA_IFSET IRQ_TMP3, 7, ACCESS, TIA_SW_Hlp_GetMOD_Negative
513E BE0D          M         btfsc   reg, bit, reg_a
5140 D006          M         bra     label
5142 01866 TIA_SW_Hlp_GetMOD_Positive
5142 500D      01867         movf    IRQ_TMP3, W
5144 E00D      01868         bz      TIA_SW_Hlp_GetMOD_Cont
5146 680B      01869         setf    IRQ_TMP1
5148 680C      01870         setf    IRQ_TMP2
514A 6A0D      01871         clrf    IRQ_TMP3        ; save sign in IRQ_TMP3
               01872         rgoto   TIA_SW_Hlp_GetMOD_Cont
514C D009          M         bra     label
               01873 
514E 01874 TIA_SW_Hlp_GetMOD_Negative
514E 500D      01875         movf    IRQ_TMP3, W
5150 0B7F      01876         andlw   0x7f
5152 E102      01877         bnz     TIA_SW_Hlp_GetMOD_Negative_C
5154 6A0B      01878         clrf    IRQ_TMP1
5156 6A0C      01879         clrf    IRQ_TMP2
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 160


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5158 01880 TIA_SW_Hlp_GetMOD_Negative_C
5158 1E0B      01881         comf    IRQ_TMP1, F     ; invert result
515A 1E0C      01882         comf    IRQ_TMP2, F
515C 0E01      01883         movlw   0x01            ; save sign in IRQ_TMP3
515E 6E0D      01884         movwf   IRQ_TMP3
5160 01885 TIA_SW_Hlp_GetMOD_Cont
               01886 
5160 0012      01887         return
               01888 
               01889 ;; --------------------------------------------------------------------------
               01890 ;; Help Function to add a 7-bit offset to IRQ_TMP[123] and saturate
               01891 ;; In:  offset in WREG, absolute 16-bit value in IRQ_TMP[12], sign in IRQ_TMP3[0]
               01892 ;; Out: New value in IRQ_TMP[12]
               01893 ;; --------------------------------------------------------------------------
5162 01894 TIA_SW_Hlp_AddOffset
5162 90D8      01895         clrc
5164 34E8      01896         rlf     WREG, W
5166 6EF4      01897         movwf   PRODH
5168 6AF3      01898         clrf    PRODL
               01899         ;;      rgoto   TIA_SW_Hlp_AddOffset16
               01900 
               01901 ;; --------------------------------------------------------------------------
               01902 ;; Help Function to add a 16-bit offset to IRQ_TMP[123] and saturate
               01903 ;; In:  offset in PROD[LH], absolute 16-bit value in IRQ_TMP[12], sign in IRQ_TMP3[0]
               01904 ;; Out: New value in IRQ_TMP[12]
               01905 ;; --------------------------------------------------------------------------
516A 01906 TIA_SW_Hlp_AddOffset16
               01907         ;; add offset and saturate
               01908         BRA_IFSET IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_AddOffset16_Negative
516A B00D          M         btfsc   reg, bit, reg_a
516C D008          M         bra     label
516E 01909 TIA_SW_Hlp_AddOffset16_Positive
516E 50F3      01910         movf    PRODL, W        ; add offset
5170 260B      01911         addwf   IRQ_TMP1, F
5172 50F4      01912         movf    PRODH, W
5174 220C      01913         addwfc  IRQ_TMP2, F
5176 E30C      01914         bnc     TIA_SW_Hlp_AddOffset16_End
5178 680B      01915         setf    IRQ_TMP1        ; saturate
517A 680C      01916         setf    IRQ_TMP2
               01917         rgoto   TIA_SW_Hlp_AddOffset16_End
517C D009          M         bra     label
517E 01918 TIA_SW_Hlp_AddOffset16_Negative
517E 500B      01919         movf    IRQ_TMP1, W     ; subtract offset
5180 5CF3      01920         subwf   PRODL, W
5182 6E0B      01921         movwf   IRQ_TMP1
5184 500C      01922         movf    IRQ_TMP2, W
5186 58F4      01923         subwfb  PRODH, W
5188 6E0C      01924         movwf   IRQ_TMP2
518A E202      01925         bc      TIA_SW_Hlp_AddOffset16_End
518C 6A0B      01926         clrf    IRQ_TMP1
518E 6A0C      01927         clrf    IRQ_TMP2
5190 01928 TIA_SW_Hlp_AddOffset16_End
               01929 
5190 0012      01930         return
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 161


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01931 
               01932 ;; --------------------------------------------------------------------------
               01933 ;; Help Function: Get absolute value
               01934 ;; IN:  signed 16-bit value in IRQ_TMP[12]
               01935 ;; Out: unsigned absolute value in IRQ_TMP[12]
               01936 ;;      sign in IRQ_TMP3[0]
               01937 ;; --------------------------------------------------------------------------
5192 01938 TIA_SW_Hlp_GetAbs16
               01939         ;; convert IRQ_TMP[12] to unsigned integer, keep sign in IRQ_TMP3[0]
5192 6A0D      01940         clrf    IRQ_TMP3
               01941         BRA_IFCLR IRQ_TMP2, 7, ACCESS, TIA_SW_Hlp_GetABS16_Pos
5194 AE0C          M         btfss   reg, bit, reg_a
5196 D006          M         bra     label
5198 01942 TIA_SW_Hlp_GetABS16_Neg
5198 800D      01943         bsf     IRQ_TMP3, 0     ; memorize sign in IRQ_TMP3[0]
519A 1E0B      01944         comf    IRQ_TMP1, F
519C 1E0C      01945         comf    IRQ_TMP2, F
519E 2A0B      01946         incf    IRQ_TMP1, F
51A0 B4D8      01947         skpnz
51A2 2A0C      01948         incf    IRQ_TMP2, F
51A4 01949 TIA_SW_Hlp_GetABS16_Pos
51A4 0012      01950         return
               01951 
               01952 
               01953 ;; --------------------------------------------------------------------------
               01954 ;; Help Function for ENV Waveforms (resuses the LFO Waveform routine)
               01955 ;; In:  ENV_x_VALUE in WREG
               01956 ;;      ENV_x_DEPTH in IRQ_TMP2,
               01957 ;;      Accent flag in IRQ_TMP4.3
               01958 ;; Out: Result in PROD[LH]
               01959 ;; --------------------------------------------------------------------------
51A6 01960 TIA_SW_ENV_Hlp_Waveform
               01961 
               01962 ;       BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_SW_ENV_Hlp_Waveform_NotTB303
               01963 ;TIA_SW_ENV_Hlp_Waveform_TB303
               01964 ;       movwf   IRQ_TMP1
               01965 ;       ;; in TB303 mode the depth parameter is used as "env mod" which is always positive
               01966 ;       ;; modify depth depending on ACCENT flag
               01967 ;       rrf     IRQ_TMP2, W
               01968 ;       andlw   0x3f
               01969 ;       movwf   IRQ_TMP2
               01970 ;       BRA_IFCLR IRQ_TMP4, 3, ACCESS, TIA_SW_ENV_Hlp_Waveform_NoAcc
               01971 ;TIA_SW_ENV_Hlp_Waveform_Acc
               01972 ;;      addlw   0x10
               01973 ;       movwf   IRQ_TMP2
               01974 ;TIA_SW_ENV_Hlp_Waveform_NoAcc
               01975 ;       movf    IRQ_TMP1, W
               01976 ;       andlw   0x7f
               01977 ;       mulwf   IRQ_TMP2, ACCESS
               01978 ;       return
               01979 
               01980 ;TIA_SW_ENV_Hlp_Waveform_NotTB303
               01981         ;; set mode to 0x10, don't overwrite WREG
51A6 6A0B      01982         clrf    IRQ_TMP1
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 162


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
51A8 880B      01983         bsf     IRQ_TMP1, 4     ; (triangle waveform)
               01984 
               01985         ;; convert linear envelope value
51AA 0B7F      01986         andlw   0x7f
51AC BC0C      01987         btfsc   IRQ_TMP2, 6; shift positive values to > 0x0000
51AE 0F80      01988         addlw 0x80      
51B0 AC0C      01989         btfss   IRQ_TMP2, 6; inversion if depth < 0x40
51B2 0A7F      01990         xorlw 0x7f      
               01991         rgoto   TIA_SW_ENV_Hlp_Waveform_Cont
51B4 D002          M         bra     label
               01992 
               01993 ;; --------------------------------------------------------------------------
               01994 ;; Help Function for LFO and ENV Waveforms
               01995 ;; In:  LFO_x_VALUE in WREG
               01996 ;;      LFO_x_MODE in IRQ_TMP1
               01997 ;;      LFO_x_DEPTH in IRQ_TMP2,
               01998 ;;      LFO/ENV number in TIA_SW_LFO_NUMBER
               01999 ;;      pointer to LFOx_BASE in FSR1
               02000 ;; Out: Result in PROD[LH]
               02001 ;;      Scaled Value in IRQ_TMP1
               02002 ;; --------------------------------------------------------------------------
51B6 02003 TIA_SW_LFO_Hlp_Waveform
               02004         ;; invert if negative depth (<0x40)
51B6 AC0C      02005         btfss   IRQ_TMP2, 6
51B8 0AFF      02006         xorlw 0xff
               02007 
               02008         ;; envelope waveform routine continues here
51BA 02009 TIA_SW_ENV_Hlp_Waveform_Cont
51BA 6E0D      02010         movwf   IRQ_TMP3
               02011 
               02012         ;; get absolute value of depth from TIA_DEPTH_TABLE
               02013         ;; (to keep it compatible with MIDIbox TIA V1.5)
51BC 500C      02014         movf    IRQ_TMP2, W
51BE D8C3      02015         rcall   TIA_SW_Hlp_Abs7
51C0 0F3E      02016         addlw   TIA_DEPTH_TABLE & 0xff
51C2 6EF6      02017         movwf   TBLPTRL
51C4 6AF7      02018         clrf    TBLPTRH
51C6 0E32      02019         movlw   TIA_DEPTH_TABLE >> 8
51C8 22F7      02020         addwfc  TBLPTRH, F
51CA 0009      02021         tblrd*+
51CC 50F5      02022         movf    TABLAT, W
51CE 6E0C      02023         movwf   IRQ_TMP2
               02024         
               02025         ;; branch depending on selected waveform
51D0 380B      02026         swapf   IRQ_TMP1, W
51D2 0B07      02027         andlw   0x07
               02028         JUMPTABLE_2BYTES_UNSECURE
51D4 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               02029         rgoto   TIA_SW_LFO_Hlp_WFBranch_0
51D8 D007          M         bra     label
               02030         rgoto   TIA_SW_LFO_Hlp_WFBranch_1
51DA D00A          M         bra     label
               02031         rgoto   TIA_SW_LFO_Hlp_WFBranch_2
51DC D00D          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 163


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02032         rgoto   TIA_SW_LFO_Hlp_WFBranch_3
51DE D011          M         bra     label
               02033         rgoto   TIA_SW_LFO_Hlp_WFBranch_4
51E0 D014          M         bra     label
               02034         rgoto   TIA_SW_LFO_Hlp_WFBranch_5
51E2 D02A          M         bra     label
               02035         rgoto   TIA_SW_LFO_Hlp_WFBranch_6
51E4 D001          M         bra     label
               02036         rgoto   TIA_SW_LFO_Hlp_WFBranch_7
51E6 D000          M         bra     label
               02037 
51E8 02038 TIA_SW_LFO_Hlp_WFBranch_0       ; Sine
51E8 02039 TIA_SW_LFO_Hlp_WFBranch_6       ; (reserved)
51E8 02040 TIA_SW_LFO_Hlp_WFBranch_7       ; (reserved)
51E8 500D      02041         movf    IRQ_TMP3, W
51EA ECD0 F018 02042         call    TIA_SIN_TABLE_Get
               02043         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
51EE D025          M         bra     label
               02044 
51F0 02045 TIA_SW_LFO_Hlp_WFBranch_1       ; Triangle
               02046         ;; Triangle: return unsigned value
51F0 500D      02047         movf    IRQ_TMP3, W
51F2 AE0D      02048         btfss   IRQ_TMP3, 7
51F4 0A7F      02049         xorlw   0x7f
               02050         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
51F6 D021          M         bra     label
               02051 
51F8 02052 TIA_SW_LFO_Hlp_WFBranch_2       ; sawtooth
               02053         ;; Sawtooth: x/2, MODE_DECINC is the eight bit
51F8 300D      02054         rrf     IRQ_TMP3, W
51FA 0B7F      02055         andlw   0x7f
51FC BE0B      02056         btfsc   IRQ_TMP1, LFOx_MODE_DECINC ; (IRQ_TMP1=LFO_x_MODE)
51FE 0980      02057         iorlw   0x80
               02058         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
5200 D01C          M         bra     label
5202 02059 TIA_SW_LFO_Hlp_WFBranch_3       ; pulse
               02060         ;; Pulse: 0x00 when Dec, 0xff when Inc, take inversion bit also into account
5202 0E00      02061         movlw   0x00
5204 BE0B      02062         btfsc   IRQ_TMP1, LFOx_MODE_DECINC; (IRQ_TMP1=LFO_x_MODE)
5206 0EFF      02063         movlw 0xff 
               02064         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
5208 D018          M         bra     label
520A 02065 TIA_SW_LFO_Hlp_WFBranch_4       ; random
               02066         ;; each second LFO is in S&H mode
               02067         BRA_IFCLR TIA_SW_LFO_NUMBER, 0, BANKED, TIA_SW_LFO_Hlp_WFBranch_4_Random
520A A10F          M         btfss   reg, bit, reg_a
520C D00C          M         bra     label
520E 02068 TIA_SW_LFO_Hlp_WFBranch_4_S_H
520E 500D      02069         movf    IRQ_TMP3, W     ; latch on period match
5210 0E05      02070         movlw   TIA_LFOx_RVALUE_L
5212 B4D8      02071         skpnz
5214 0EFE      02072         movlw   TIA_LFOx_RVALUE_L - TIA_LFOx_RECORD_LEN
5216 CFE3 FFF3 02073         movff   PLUSW1, PRODL
               02074 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 164


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
521A 0E06      02075         movlw   TIA_LFOx_RVALUE_H
521C B4D8      02076         skpnz
521E 0EFF      02077         movlw   TIA_LFOx_RVALUE_H - TIA_LFOx_RECORD_LEN
5220 CFE3 FFF4 02078         movff   PLUSW1, PRODH
               02079         rgoto   TIA_SW_LFO_Hlp_Waveform_End
5224 D011          M         bra     label
               02080 
5226 02081 TIA_SW_LFO_Hlp_WFBranch_4_Random
5226 511D      02082         movf    TIA_LFO_RANDOM_SEED_H, W, BANKED
5228 0B55      02083         andlw   0x55
522A 6E0B      02084         movwf   IRQ_TMP1
522C 511C      02085         movf    TIA_LFO_RANDOM_SEED_L, W, BANKED
522E 0BAA      02086         andlw   0xaa
5230 100B      02087         iorwf   IRQ_TMP1, W
5232 24CE      02088         addwf   TMR1L, W        ; super-random ;-)
5234 18CC      02089         xorwf   TMR2, W
               02090         rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
5236 D001          M         bra     label
               02091 
5238 02092 TIA_SW_LFO_Hlp_WFBranch_5       ; (AIN)
               02093 #if ENABLE_AIN_LFO_WAVEFORM
               02094         movf    TIA_SW_LFO_NUMBER, W, BANKED
               02095         movff   FSR1L, IRQ_TMP1         ; save FSR1
               02096         movff   FSR1H, IRQ_TMP3
               02097         call    MIOS_AIN_PinGet         ; get value of analog pin
               02098         movff   IRQ_TMP1, FSR1L         ; restore FSR1
               02099         movff   IRQ_TMP3, FSR1H
               02100         SET_BSR TIA_BASE
               02101         rrf     MIOS_PARAMETER2, F      ; convert 10bit to 8bit
               02102         rrf     MIOS_PARAMETER1, F
               02103         rrf     MIOS_PARAMETER2, F
               02104         rrf     MIOS_PARAMETER1, W
               02105 
               02106         ;; biased at 0x80
               02107         BRA_IFSET WREG, 7, ACCESS, TIA_SW_LFO_Hlp_WFBranch_Cont
               02108         xorlw   0x7f
               02109         addlw   1
               02110         btfsc   WREG, 7
               02111         movlw 0x7f
               02112 #else
5238 0E80      02113         movlw   0x80
               02114 #endif
               02115         ;;      rgoto   TIA_SW_LFO_Hlp_WFBranch_Cont
               02116 
523A 02117 TIA_SW_LFO_Hlp_WFBranch_Cont
523A 6E0B      02118         movwf   IRQ_TMP1
               02119 
               02120         ;; process scaling (depth * scaled value)
523C 0B7F      02121         andlw   0x7f            ; remove sign from value
523E 020C      02122         mulwf   IRQ_TMP2        ; multiply with depth (in IRQ_TMP2)
               02123         ;; result in PROD[LH]
               02124 
               02125         ;; invert if DECINC flag not set
               02126         BRA_IFSET IRQ_TMP1, 7, ACCESS, TIA_SW_LFO_Hlp_Waveform_End
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 165


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5240 BE0B          M         btfsc   reg, bit, reg_a
5242 D002          M         bra     label
5244 1EF3      02127         comf    PRODL, F
5246 1EF4      02128         comf    PRODH, F
5248 02129 TIA_SW_LFO_Hlp_Waveform_End
5248 0012      02130         return
               02131 
               02132 
               02133 ;; --------------------------------------------------------------------------
               02134 ;; Help Function to sync all LFOs
               02135 ;; --------------------------------------------------------------------------
524A 02136 TIA_SW_Hlp_SyncAllLFOs
524A EE21 F0A0 02137         lfsr    FSR2, TIA_LFO1_BASE + TIA_LFOx_MODE
524E 0E04      02138         movlw   0x04
5250 6E0B      02139         movwf   IRQ_TMP1
5252 02140 TIA_SW_Hlp_SyncAllLFOs_Loop
5252 EC3E F029 02141         call    TIA_SW_Hlp_SyncLFO_Now
5256 2E0B      02142         decfsz  IRQ_TMP1, F
               02143         rgoto   TIA_SW_Hlp_SyncAllLFOs_Loop
5258 D7FC          M         bra     label
525A 0012      02144         return
               02145 
               02146 ;; --------------------------------------------------------------------------
               02147 ;; Help Function for gate bit, syncs the LFOs
               02148 ;; In: TIA_Vx_PITCH_MOD | TIA_Vx_VOLUME_MOD | assigned filter flags
               02149 ;; --------------------------------------------------------------------------
525C 02150 TIA_SW_Hlp_SyncLFOs
525C EE21 F0A0 02151         lfsr    FSR2, TIA_LFO1_BASE + TIA_LFOx_MODE
5260 6E0B      02152         movwf   IRQ_TMP1
5262 D806      02153         rcall   TIA_SW_Hlp_SyncSingleLFO
5264 320B      02154         rrf     IRQ_TMP1, F
5266 D804      02155         rcall   TIA_SW_Hlp_SyncSingleLFO
5268 320B      02156         rrf     IRQ_TMP1, F
526A D802      02157         rcall   TIA_SW_Hlp_SyncSingleLFO
526C 320B      02158         rrf     IRQ_TMP1, F
526E D800      02159         rcall   TIA_SW_Hlp_SyncSingleLFO
               02160 
               02161 
5270 02162 TIA_SW_Hlp_SyncSingleLFO
               02163         BRA_IFSET INDF2, LFOx_MODE_SYNC_ALL, ACCESS, TIA_SW_Hlp_SyncLFO_Now
5270 B4DF          M         btfsc   reg, bit, reg_a
5272 D004          M         bra     label
               02164         BRA_IFCLR IRQ_TMP1, 0, ACCESS, TIA_SW_Hlp_SyncLFO_Skip
5274 A00B          M         btfss   reg, bit, reg_a
5276 D00C          M         bra     label
               02165         BRA_IFCLR INDF2, LFOx_MODE_SYNC, ACCESS, TIA_SW_Hlp_SyncLFO_Skip
5278 A2DF          M         btfss   reg, bit, reg_a
527A D00A          M         bra     label
527C 02166 TIA_SW_Hlp_SyncLFO_Now
527C 9EDF      02167         bcf     INDF2, LFOx_MODE_DECINC
527E 2AD9      02168         incf    FSR2L, F        ; switch to LFO_x_RATE
5280 2AD9      02169         incf    FSR2L, F        ; switch to LFO_x_CTR
5282 6ADE      02170         clrf    POSTINC2        ; clear counter,
               02171                                 ; switch to LFO_x_VALUE
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 166


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5284 0E80      02172         movlw   0x80            ; write 0x80 into value
5286 6EDE      02173         movwf   POSTINC2
               02174                                 ; switch to LFO_x_DEPTH
5288 2AD9      02175         incf    FSR2L, F        ; switch to LFO_x_RVALUE_L
528A 6ADE      02176         clrf    POSTINC2        ; clear LFO_x_RAVLUE_L
528C 6ADE      02177         clrf    POSTINC2        ; clear LFO_x_RAVLUE_H
               02178 
528E 0012      02179         return
               02180         
5290 02181 TIA_SW_Hlp_SyncLFO_Skip
5290 0E07      02182         movlw   TIA_LFOx_RECORD_LEN             ; switch to LFO_x+1_MODE
5292 26D9      02183         addwf   FSR2L, F
5294 0012      02184         return
               02185 
               02186 ;; --------------------------------------------------------------------------
               02187 ;; Help Function for gate bit, sets ENVs to attack mode
               02188 ;; In: TIA_Vx_ENVS | assigned filter flags
               02189 ;; --------------------------------------------------------------------------
5296 02190 TIA_SW_Hlp_ENVAttack
               02191         ;; set envelope generators to attack mode if voice (or filter) has been assigned
5296 6E0B      02192         movwf   IRQ_TMP1
               02193 
               02194         ;movf   IRQ_TMP1, W
5298 0B11      02195         andlw   0x11
529A E002      02196         bz      TIA_SW_Hlp_ENVAttack_Not1
529C 0E01      02197         movlw   (1 << ENVx_MODE_ATTACK)
529E 6FD2      02198         movwf   TIA_ENV1_BASE + TIA_ENVx_MODE, BANKED
52A0 02199 TIA_SW_Hlp_ENVAttack_Not1
               02200 
52A0 500B      02201         movf    IRQ_TMP1, W
52A2 0B22      02202         andlw   0x22
52A4 E002      02203         bz      TIA_SW_Hlp_ENVAttack_Not2
52A6 0E01      02204         movlw   (1 << ENVx_MODE_ATTACK)
52A8 6FDD      02205         movwf   TIA_ENV2_BASE + TIA_ENVx_MODE, BANKED
52AA 02206 TIA_SW_Hlp_ENVAttack_Not2
               02207 
52AA 500B      02208         movf    IRQ_TMP1, W
52AC 0B0C      02209     andlw       0x0c
52AE E002      02210         bz      TIA_SW_Hlp_ENVAttack_Not3
52B0 0E01      02211         movlw   (1 << ENVx_MODE_ATTACK)
52B2 6FBC      02212         movwf   TIA_ENVAUD0_BASE + TIA_ENVx_MODE, BANKED
52B4 02213 TIA_SW_Hlp_ENVAttack_Not3
               02214 
52B4 500B      02215         movf    IRQ_TMP1, W
52B6 0BC0      02216         andlw   0xc0
52B8 E002      02217         bz      TIA_SW_Hlp_ENVAttack_Not4
52BA 0E01      02218         movlw   (1 << ENVx_MODE_ATTACK)
52BC 6FC7      02219         movwf   TIA_ENVAUD1_BASE + TIA_ENVx_MODE, BANKED
52BE 02220 TIA_SW_Hlp_ENVAttack_Not4
52BE 0012      02221         return
               02222 
               02223 ;; --------------------------------------------------------------------------
               02224 ;; Help Function for gate bit, sets ENVs to release mode
               02225 ;; In: TIA_Vx_ENVS | assigned filter flags
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 167


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02226 ;; --------------------------------------------------------------------------
52C0 02227 TIA_SW_Hlp_ENVRelease
               02228         ;; set envelope generators to release mode if voice (or filter) has been assigned
52C0 6E0B      02229         movwf   IRQ_TMP1
               02230 
52C2 0B11      02231         andlw   0x11
52C4 E002      02232         bz      TIA_SW_Hlp_ENVRelease_Not1
52C6 0E08      02233         movlw   (1 << ENVx_MODE_RELEASE)
52C8 6FD2      02234         movwf   TIA_ENV1_BASE + TIA_ENVx_MODE, BANKED
52CA 02235 TIA_SW_Hlp_ENVRelease_Not1
               02236 
52CA 500B      02237         movf    IRQ_TMP1, W
52CC 0B22      02238         andlw   0x22
52CE E002      02239         bz      TIA_SW_Hlp_ENVRelease_Not2
52D0 0E08      02240         movlw   (1 << ENVx_MODE_RELEASE)
52D2 6FDD      02241         movwf   TIA_ENV2_BASE + TIA_ENVx_MODE, BANKED
52D4 02242 TIA_SW_Hlp_ENVRelease_Not2
               02243 
52D4 500B      02244         movf    IRQ_TMP1, W
52D6 0B0C      02245     andlw       0x0c
52D8 E002      02246         bz      TIA_SW_Hlp_ENVRelease_Not3
52DA 0E08      02247         movlw   (1 << ENVx_MODE_RELEASE)
52DC 6FBC      02248         movwf   TIA_ENVAUD0_BASE + TIA_ENVx_MODE, BANKED
52DE 02249 TIA_SW_Hlp_ENVRelease_Not3
               02250 
52DE 500B      02251         movf    IRQ_TMP1, W
52E0 0BC0      02252         andlw   0xc0
52E2 E002      02253         bz      TIA_SW_Hlp_ENVRelease_Not4
52E4 0E08      02254         movlw   (1 << ENVx_MODE_RELEASE)
52E6 6FC7      02255         movwf   TIA_ENVAUD1_BASE + TIA_ENVx_MODE, BANKED
52E8 02256 TIA_SW_Hlp_ENVRelease_Not4
52E8 0012      02257         return
               02258 
               02259 ;; --------------------------------------------------------------------------
               02260 ;; Help Function for TIA_SW_Pitch
               02261 ;; IN: TIA_Vx_TARGET_FRQ_LH in FSR2
               02262 ;; OUT: new result in TIA_Vx_TARGET_FRQ_LH
               02263 ;; --------------------------------------------------------------------------
52EA 02264 TIA_SW_Hlp_AddMul
               02265         BRA_IFCLR IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_AddMul_Pos
52EA A00D          M         btfss   reg, bit, reg_a
52EC D00D          M         bra     label
52EE 02266 TIA_SW_Hlp_AddMul_Neg
               02267         ;; calc MUL_A_[LH] = TIA_Vx_FRQ_[LH] - MIOS_PARAMETER[12]
52EE 5003      02268         movf    MIOS_PARAMETER1, W
52F0 5CDE      02269         subwf   POSTINC2, W     ; TIA_Vx_TARGET_FRQ_LH+0, W, BANKED
52F2 6FF8      02270         movwf   MUL_A_L, BANKED
52F4 5004      02271         movf    MIOS_PARAMETER2, W
52F6 58DD      02272         subwfb  POSTDEC2, W     ; TIA_Vx_TARGET_FRQ_LH+1, W, BANKED
52F8 6FF9      02273         movwf   MUL_A_H, BANKED
               02274 
               02275         ;; calc MUL_R_[12] = MUL_A_[LH] * MUL_B_[LH]
52FA ECDA F019 02276         call    MATH_MUL16_16
               02277         ;; TIA_Vx_FRQ -= result
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 168


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
52FE 51FD      02278         movf    MUL_R_1, W, BANKED
5300 5EDE      02279         subwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
5302 51FE      02280         movf    MUL_R_2, W, BANKED
5304 5ADD      02281         subwfb  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
5306 0012      02282         return
               02283 
5308 02284 TIA_SW_Hlp_AddMul_Pos
               02285         ;; calc MUL_A_[LH] = MIOS_PARAMETER[12] - TIA_Vx_FRQ_[LH]
5308 50DE      02286         movf    POSTINC2, W     ; TIA_Vx_TARGET_FRQ_LH+0, W, BANKED
530A 5C03      02287         subwf   MIOS_PARAMETER1, W
530C 6FF8      02288         movwf   MUL_A_L, BANKED
530E 50DD      02289         movf    POSTDEC2, W     ; TIA_Vx_TARGET_FRQ_LH+1, W, BANKED
5310 5804      02290         subwfb  MIOS_PARAMETER2, W
5312 6FF9      02291         movwf   MUL_A_H, BANKED
               02292 
               02293         ;; calc MUL_R_[12] = MUL_A_[LH] * MUL_B_[LH]
5314 ECDA F019 02294         call    MATH_MUL16_16
               02295         ;; TIA_Vx_FRQ += result
5318 51FD      02296         movf    MUL_R_1, W, BANKED
531A 26DE      02297         addwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
531C 51FE      02298         movf    MUL_R_2, W, BANKED
531E 22DD      02299         addwfc  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
5320 0012      02300         return
               02301     
               02302     
               02303 ;; --------------------------------------------------------------------------
               02304 ;; Help Function for TIA_SW_Pitch
               02305 ;; IN:  addend and IRQ_TMP[12], TIA_Vx_TARGET_FRQ_LH in FSR2
               02306 ;; OUT: new result in TIA_Vx_TARGET_FRQ_LH
               02307 ;; --------------------------------------------------------------------------
5322 02308 TIA_SW_Hlp_Add16
               02309         ;; divide / 4 for a better scaling
               02310         ;clrc
               02311         ;rrf    IRQ_TMP2, F
               02312         ;rrf    IRQ_TMP1, F
               02313         ;clrc
               02314         ;rrf    IRQ_TMP2, F
               02315         ;rrf    IRQ_TMP1, F
               02316                 
               02317         BRA_IFCLR IRQ_TMP3, 0, ACCESS, TIA_SW_Hlp_Add16_Pos
5322 A00D          M         btfss   reg, bit, reg_a
5324 D008          M         bra     label
5326 02318 TIA_SW_Hlp_Add16_Neg
               02319         ;; TIA_Vx_TARGET_FRQ -= MOD 
5326 500B      02320         movf    IRQ_TMP1, W
5328 5EDE      02321         subwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
532A 500C      02322         movf    IRQ_TMP2, W
532C 5ADD      02323         subwfb  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
               02324         ;; saturate on overflow
532E E202      02325         bc      TIA_SW_Hlp_Add16_Neg_End
5330 6ADE      02326         clrf    POSTINC2        ; TIA_Vx_TARGET_FRQ_LH+0, BANKED
5332 6ADD      02327         clrf    POSTDEC2        ; TIA_Vx_TARGET_FRQ_LH+1, BANKED
5334 02328 TIA_SW_Hlp_Add16_Neg_End
5334 0012      02329         return
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 169


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02330 
5336 02331 TIA_SW_Hlp_Add16_Pos
               02332         ;; TIA_Vx_TARGET_FRQ += MOD
5336 500B      02333         movf    IRQ_TMP1, W
5338 26DE      02334         addwf   POSTINC2, F     ; TIA_Vx_TARGET_FRQ_LH+0, F, BANKED
533A 500C      02335         movf    IRQ_TMP2, W
533C 22DD      02336         addwfc  POSTDEC2, F     ; TIA_Vx_TARGET_FRQ_LH+1, F, BANKED
               02337         ;; saturate on overflow (set frequency to zero to avoid unwanted HF beeps)
533E E302      02338         bnc     TIA_SW_Hlp_Add16_Pos_End
5340 68DE      02339         setf    POSTINC2        ; TIA_Vx_TARGET_FRQ_LH+0, BANKED
5342 68DD      02340         setf    POSTDEC2        ; TIA_Vx_TARGET_FRQ_LH+1, BANKED
5344 02341 TIA_SW_Hlp_Add16_Pos_End
5344 0012      02342         return
               02343 
               02344 
               02345 ;; --------------------------------------------------------------------------
               02346 ;; Help Function for TIA_SW_ENV, etc.
               02347 ;; IN:  7-bit signed value in WREG
               02348 ;; OUT: absolute value (0x00-0x3f) in WREG
               02349 ;; --------------------------------------------------------------------------
5346 02350 TIA_SW_Hlp_Abs7
5346 50E8      02351         movf    WREG, W
5348 B4D8      02352         skpnz
534A 0F01      02353         addlw   1
534C ACE8      02354         btfss   WREG, 6
534E 0840      02355         sublw 0x40
5350 0B3F      02356         andlw   0x3f
5352 0012      02357         return
               02358 
               02359 ;; --------------------------------------------------------------------------
               02360 ;; Help Function for TIA_SW_ENV
               02361 ;; IN:  ENV_x_CTR_H in IRQ_TMP1
               02362 ;;      ENV_x_CURVE in IRQ_TMP2
               02363 ;;      ENV_x_ATTACK/ENV_x_DECAY or ENV_x_SUSTAIN in IRQ_TMP3
               02364 ;;      WREG != 0: use curve, WREG == 0: don't use curve parameter
               02365 ;; OUT: value which should be added to - or subtracted from - ENV_x_CTR_[LH]
               02366 ;;      low-byte in WREG and MIOS_PARAMETER1; high-byte in MIOS_PARAMETER2
               02367 ;; --------------------------------------------------------------------------
5354 02368 TIA_SW_ENV_GetBendedValue
5354 E103      02369         bnz     TIA_SW_ENV_GetBendedValue_Curve
               02370 
               02371         ;; curve not selected, get value from ENV_TABLE
5356 500D      02372         movf    IRQ_TMP3, W
5358 EF26 F032 02373         goto    TIA_ENV_TABLE_Get
               02374 
535C 02375 TIA_SW_ENV_GetBendedValue_Curve
               02376         ;; return ENV_x_DECAY when ENV_x_CURVE == 0x40
535C 0E40      02377         movlw   0x40
535E 620C      02378         cpfseq  IRQ_TMP2, ACCESS
               02379         rgoto TIA_SW_ENV_GetBendedValue_UD
5360 D002          M         bra     label
5362 1C0D      02380         comf    IRQ_TMP3, W
               02381         rgoto   TIA_SW_ENV_GetBendedValue_Cont
5364 D011          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 170


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               02382 
5366 02383 TIA_SW_ENV_GetBendedValue_UD
               02384         ;; feedback: calculate ABS7(CURVE) * ENV_x_CTR_H
5366 500C      02385         movf    IRQ_TMP2, W             ; get absolute value of curve parameter
5368 DFEE      02386         rcall   TIA_SW_Hlp_Abs7
536A 020B      02387         mulwf   IRQ_TMP1, ACCESS        ; multiply with current counter value
               02388         
               02389         ;; when CURVE parameter < 0x40: bend down, else up
               02390         BRA_IFCLR IRQ_TMP2, 6, ACCESS, TIA_SW_ENV_GetBendedValue_Down
536C AC0C          M         btfss   reg, bit, reg_a
536E D007          M         bra     label
5370 02391 TIA_SW_ENV_GetBendedValue_Up
5370 1E0D      02392         comf    IRQ_TMP3, F
5372 9E0D      02393         bcf     IRQ_TMP3, 7
5374 50F4      02394         movf    PRODH, W
5376 5C0D      02395         subwf   IRQ_TMP3, W
5378 BEE8      02396         btfsc   WREG, 7
537A 0E00      02397         movlw 0x00
               02398         rgoto   TIA_SW_ENV_GetBendedValue_Cont
537C D005          M         bra     label
               02399 
537E 02400 TIA_SW_ENV_GetBendedValue_Down
537E 1C0D      02401         comf    IRQ_TMP3, W
5380 0B7F      02402         andlw   0x7f
5382 24F4      02403         addwf   PRODH, W
5384 BEE8      02404         btfsc   WREG, 7
5386 0E7F      02405         movlw 0x7f
               02406         ;;      rgoto   TIA_SW_ENV_GetBendedValue_Cont
               02407 
5388 02408 TIA_SW_ENV_GetBendedValue_Cont
5388 0B7F      02409         andlw   0x7f
538A EF41 F018 02410         goto    TIA_FRQ_TABLE_Get
               02411 
               02412 
               02413 ;; --------------------------------------------------------------------------
               02414 ;; Help Function used from tia_midi.inc and tia_ccin.inc to reset ENV2
               02415 ;; --------------------------------------------------------------------------
538E 02416 TIA_SW_Hlp_ENV2Reset
               02417         SET_BSR TIA_BASE
538E 0101          M         movlb   HIGH(reg)
               02418 
5390 0E01      02419         movlw   (1 << ENVx_MODE_ATTACK)
5392 6FC7      02420         movwf   TIA_ENVAUD1_BASE + TIA_ENVx_MODE, BANKED
               02421 
5394 6BC8      02422         clrf    TIA_ENVAUD1_BASE + TIA_ENVx_CTR_L, BANKED
5396 6BC9      02423         clrf    TIA_ENVAUD1_BASE + TIA_ENVx_CTR_H, BANKED
               02424 
5398 0012      02425         return
               02426 
               02427 
               02428 
               00385 ;#include "tia_wt.inc"
               00386 #include "tia_midi.inc"
               00001 ; $Id: tia_midi.inc bdupeyron.tech@gmail.com(Antichambre)
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 171


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 ;; --------------------------------------------------------------------------
539A 00022 TIA_MIDI_NotifyReceivedEvent
               00023 
               00024         ;; branch to appr. TIA routine depending on received event
539A 3803      00025         swapf   MIOS_PARAMETER1, W
539C 0B07      00026         andlw   0x07
               00027         JUMPTABLE_2BYTES_UNSECURE
539E ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00028         rgoto   TIA_MIDI_NoteOff
53A2 D040          M         bra     label
               00029         rgoto   TIA_MIDI_NoteOn
53A4 D006          M         bra     label
               00030         rgoto   TIA_MIDI_AfterTouch
53A6 D0C2          M         bra     label
               00031         rgoto   TIA_MIDI_CC
53A8 D081          M         bra     label
               00032         rgoto   TIA_MIDI_ProgramChange
53AA D0A7          M         bra     label
               00033         rgoto   TIA_MIDI_PolyAfterTouch
53AC D0BC          M         bra     label
               00034         rgoto   TIA_MIDI_PitchBender
53AE D06D          M         bra     label
53B0 0012      00035         return
               00036 
               00037 ;; --------------------------------------------------------------------------
               00038 ;;  This function is rcalled to forward a Note On event to the synthesizer
               00039 ;;  Input:
               00040 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00041 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00042 ;;     o third  MIDI event byte in MIOS_PARAMETER3
               00043 ;; --------------------------------------------------------------------------
53B2 00044 TIA_MIDI_NoteOn
53B2 5005      00045         movf    MIOS_PARAMETER3, W      ; branch to NoteOff if velocity is zero
53B4 B4D8      00046         skpnz
               00047         rgoto   TIA_MIDI_NoteOff
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 172


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
53B6 D036          M         bra     label
               00048     
               00049 
               00050     
               00051         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
53B8 0101          M         movlb   HIGH(reg)
               00052 
               00053         BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED, TIA_MIDI_NoteOn_MonoMode
53BA A10C          M         btfss   reg, bit, reg_a
53BC D00F          M         bra     label
53BE 00054 TIA_MIDI_NoteOn_PolyMode
               00055         ;; in poly mode we only react on MIDI channel of voice 1!
53BE 5003      00056         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
53C0 0B0F      00057         andlw   0x0f
53C2 6320      00058         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
53C4 0012      00059         return
               00060         
               00061         ;; in poly mode: determine free voice
53C6 0E01      00062         movlw   0x01
53C8 5342      00063         movf    TIA_V1_BASE + TIA_Vx_NOTE_STACK_0, F, BANKED
53CA E004      00064         bz      TIA_MIDI_NoteOn_Poly_Cont
53CC 0E02      00065         movlw   0x02
53CE 5382      00066         movf    TIA_V2_BASE + TIA_Vx_NOTE_STACK_0, F, BANKED
53D0 E001      00067         bz      TIA_MIDI_NoteOn_Poly_Cont
               00068         rgoto   TIA_MIDI_NoteOn_Poly_Failed
53D2 D026          M         bra     label
53D4 00069 TIA_MIDI_NoteOn_Poly_Cont
53D4 6E0A      00070         movwf   TMP5            ; TMP5 contains the voices which should be played
53D6 D960      00071     rcall   TIA_MIDI_GetAssignedKeys
53D8 D95F      00072     rcall   TIA_MIDI_GetAssignedKeys
               00073         rgoto   TIA_MIDI_NoteOn_Start_Handlers
53DA D005          M         bra     label
               00074 
53DC 00075 TIA_MIDI_NoteOn_MonoMode
               00076         ;; check for the assigned MIDI channels, result in TMP5
53DC D938      00077         rcall   TIA_MIDI_GetAssignedChannels
53DE D944      00078         rcall   TIA_MIDI_GetAssignedVoices
53E0 D95B      00079     rcall   TIA_MIDI_GetAssignedKeys
               00080         ;; leave routine if no voice is assigned to channel
53E2 B4D8      00081         skpnz
53E4 0012      00082         return
               00083 
53E6 00084 TIA_MIDI_NoteOn_Start_Handlers
               00085         IRQ_DISABLE
53E6 9EF2          M         bcf     INTCON, GIE
               00086 
               00087         ;; --[ Voice 1 Handler ]--
53E8 00088 TIA_MIDI_NoteOn_V1
               00089         BRA_IFCLR TMP5, 0, ACCESS, TIA_MIDI_NoteOn_V1_Failed
53E8 A00A          M         btfss   reg, bit, reg_a
53EA D00C          M         bra     label
53EC EE11 F042 00090         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_NOTE_STACK_0         ; push note to stack
53F0 D8A9      00091         rcall   TIA_MIDI_Hlp_PushNote
               00092         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOn_V1_Failed    ; exit if note already in stack
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 173


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
53F2 B0E8          M         btfsc   reg, bit, reg_a
53F4 D007          M         bra     label
53F6 EE01 F020 00093         lfsr    FSR0, TIA_V1_BASE
53FA 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
53FC D8D4      00096         rcall   TIA_MIDI_Hlp_NoteOn                             ; call note-on handler
53FE EE21 F020 00097         lfsr    FSR2, TIA_V1_BASE                               ; sort notes for arpeggios
5402 D966      00098         rcall   TIA_MIDI_Arp_Sorter
5404 00099 TIA_MIDI_NoteOn_V1_Failed
               00100 
               00101         ;; --[ Voice 2 Handler ]--
5404 00102 TIA_MIDI_NoteOn_V2
               00103         BRA_IFCLR TMP5, 1, ACCESS, TIA_MIDI_NoteOn_V2_Failed
5404 A20A          M         btfss   reg, bit, reg_a
5406 D00C          M         bra     label
5408 EE11 F082 00104         lfsr    FSR1, TIA_V2_BASE + TIA_Vx_NOTE_STACK_0         ; push note to stack
540C D89B      00105         rcall   TIA_MIDI_Hlp_PushNote
               00106         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOn_V2_Failed    ; exit if note already in stack
540E B0E8          M         btfsc   reg, bit, reg_a
5410 D007          M         bra     label
5412 EE01 F060 00107         lfsr    FSR0, TIA_V2_BASE
5416 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
5418 D8C6      00110         rcall   TIA_MIDI_Hlp_NoteOn                             ; call note-on handler
541A EE21 F060 00111         lfsr    FSR2, TIA_V2_BASE                               ; sort notes for arpeggios
541E D958      00112         rcall   TIA_MIDI_Arp_Sorter
5420 00113 TIA_MIDI_NoteOn_V2_Failed
               00114 
5420 00115 TIA_MIDI_NoteOn_Poly_Failed
               00116 
               00117         IRQ_ENABLE
5420 8EF2          M         bsf     INTCON, GIE
5422 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 ;; --------------------------------------------------------------------------
5424 00127 TIA_MIDI_NoteOff
               00128         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
5424 0101          M         movlb   HIGH(reg)
               00129 
               00130         ;; ensure that velocity is cleared
5426 6A05      00131         clrf    MIOS_PARAMETER3
               00132 
               00133         BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED, TIA_MIDI_NoteOff_MonoMode
5428 A10C          M         btfss   reg, bit, reg_a
542A D003          M         bra     label
542C 00134 TIA_MIDI_NoteOff_PolyMode
               00135         ;; in poly mode, handle all channels
542C 0E0F      00136         movlw   0x0f
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 174


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
542E 6E0A      00137         movwf   TMP5
               00138         rgoto   TIA_MIDI_NoteOff_Start_Handlers
5430 D005          M         bra     label
5432 00139 TIA_MIDI_NoteOff_MonoMode
               00140         ;; check for the assigned MIDI channels, result in TMP5
5432 D90D      00141         rcall   TIA_MIDI_GetAssignedChannels
5434 D919      00142         rcall   TIA_MIDI_GetAssignedVoices ; (not so optimal if split points modified during notes are played)
5436 D930      00143     rcall   TIA_MIDI_GetAssignedKeys
               00144         ;; leave routine if no voice is assigned to channel
5438 B4D8      00145         skpnz
543A 0012      00146         return
               00147 
543C 00148 TIA_MIDI_NoteOff_Start_Handlers
               00149         IRQ_DISABLE
543C 9EF2          M         bcf     INTCON, GIE
               00150 
               00151         ;; --[ Voice 1 Handler ]--
543E 00152 TIA_MIDI_NoteOff_V1
               00153         BRA_IFCLR TMP5, 0, ACCESS, TIA_MIDI_NoteOff_V1_NotFnd
543E A00A          M         btfss   reg, bit, reg_a
5440 D010          M         bra     label
5442 EE11 F042 00154         lfsr    FSR1, TIA_V1_BASE + TIA_Vx_NOTE_STACK_0         ; pop note from stack
5446 CFE7 F008 00155         movff   INDF1, TMP3                                     ; save current #0 entry in TMP3 for later use
544A D895      00156         rcall   TIA_MIDI_Hlp_PopNote
               00157         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOff_V1_NotFnd
544C B0E8          M         btfsc   reg, bit, reg_a
544E D009          M         bra     label
5450 EE01 F020 00158         lfsr    FSR0, TIA_V1_BASE
5454 5008      00159         movf    TMP3, W                                         ; restore note
5456 D8DA      00160         rcall   TIA_MIDI_Hlp_NoteOff
               00161         RCALL_IFSET WREG, 0, ACCESS, TIA_MIDI_Hlp_NoteOn
5458 B0E8          M         btfsc   reg, bit, reg_a
545A D8A5          M         rcall   label
545C EE21 F020 00162         lfsr    FSR2, TIA_V1_BASE                               ; sort notes for arpeggios
5460 D937      00163         rcall   TIA_MIDI_Arp_Sorter
5462 00164 TIA_MIDI_NoteOff_V1_NotFnd
               00165 
               00166         ;; --[ Voice 2 Handler ]--
5462 00167 TIA_MIDI_NoteOff_V2
               00168         BRA_IFCLR TMP5, 1, ACCESS, TIA_MIDI_NoteOff_V2_NotFnd
5462 A20A          M         btfss   reg, bit, reg_a
5464 D010          M         bra     label
5466 EE11 F082 00169         lfsr    FSR1, TIA_V2_BASE + TIA_Vx_NOTE_STACK_0         ; pop note from stack
546A CFE7 F008 00170         movff   INDF1, TMP3                                     ; save current #0 entry in TMP3 for later use
546E D883      00171         rcall   TIA_MIDI_Hlp_PopNote
               00172         BRA_IFSET WREG, 0, ACCESS, TIA_MIDI_NoteOff_V2_NotFnd
5470 B0E8          M         btfsc   reg, bit, reg_a
5472 D009          M         bra     label
5474 EE01 F060 00173         lfsr    FSR0, TIA_V2_BASE
5478 5008      00174         movf    TMP3, W                                         ; restore note
547A D8C8      00175         rcall   TIA_MIDI_Hlp_NoteOff
               00176         RCALL_IFSET WREG, 0, ACCESS, TIA_MIDI_Hlp_NoteOn
547C B0E8          M         btfsc   reg, bit, reg_a
547E D893          M         rcall   label
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 175


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5480 EE21 F060 00177         lfsr    FSR2, TIA_V2_BASE                               ; sort notes for arpeggios
5484 D925      00178         rcall   TIA_MIDI_Arp_Sorter
5486 00179 TIA_MIDI_NoteOff_V2_NotFnd
               00180 
               00181         IRQ_ENABLE
5486 8EF2          M         bsf     INTCON, GIE
5488 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 ;; --------------------------------------------------------------------------
548A 00192 TIA_MIDI_PitchBender
               00193         SET_BSR TIA_BASE
548A 0101          M         movlb   HIGH(reg)
548C 3404      00194     rlf MIOS_PARAMETER2, W
548E 0BFE      00195         andlw   0xfe
5490 0A80      00196         xorlw   0x80
5492 6E04      00197     movwf   MIOS_PARAMETER2
               00198     
5494 5003      00199         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
5496 0B0F      00200         andlw   0x0f
5498 00201 TIA_MIDI_PitchBender_v1
5498 6320      00202         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
               00203         rgoto TIA_MIDI_PitchBender_v2
549A D003          M         bra     label
549C 5004      00204     movf    MIOS_PARAMETER2, W
549E 6F2B      00205         movwf   TIA_V1_BASE + TIA_Vx_PITCHBENDER, BANKED
               00206     rgoto   TIA_MIDI_PitchBender_End
54A0 D004          M         bra     label
               00207     
54A2 00208 TIA_MIDI_PitchBender_v2
54A2 6360      00209         cpfseq  TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
               00210         rgoto TIA_MIDI_PitchBender_End
54A4 D002          M         bra     label
54A6 5004      00211     movf    MIOS_PARAMETER2, W
54A8 6F6B      00212         movwf   TIA_V2_BASE + TIA_Vx_PITCHBENDER, BANKED
54AA 00213 TIA_MIDI_PitchBender_End
54AA 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 ;; --------------------------------------------------------------------------
54AC 00223 TIA_MIDI_CC
               00224         SET_BSR TIA_BASE
54AC 0101          M         movlb   HIGH(reg)
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 176


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00225 
               00226         ;; special treatment for CC#0 (bank change)
54AE 5004      00227         movf    MIOS_PARAMETER2, W
54B0 E11A      00228         bnz     TIA_MIDI_CC_No00
54B2 00229 TIA_MIDI_CC_00
               00230         ;; exit if bank number >= DEFAULT_BS_KBANK_ID*4
54B2 0E14      00231     movlw   DEFAULT_BS_KBANK_ID*4
54B4 6005      00232     cpfslt  MIOS_PARAMETER3
54B6 0012      00233     return
               00234 
54B8 5003      00235     movf        MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
54BA 0B0F      00236         andlw   0x0f
54BC 6320      00237         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
54BE 0012      00238         return
               00239     
54C0 C005 F014 00240         movff   MIOS_PARAMETER3, TIA_PBANK
               00241 
               00242     ;; Int.Patch if ==0
54C4 5013      00243     movf    TIA_PATCH, W
54C6 E00C      00244     bz      TIA_MIDI_CC_00_Ok
               00245     
               00246     ;; Banstick Ready
54C8 5014      00247     movf    TIA_PBANK, W
54CA EC41 F020 00248     call    TIA_BANK_GetBankStickReady
54CE B4D8      00249         skpnz
54D0 6A13      00250     clrf    TIA_PATCH   ;; to Int. Patch if BS not ready
               00251      
               00252     ;; Banstick Size
54D2 EC4E F020 00253     call    TIA_BANK_GetBankStickSize
54D6 E104      00254     bnz     TIA_MIDI_CC_00_Ok
               00255     ;; 64/128 patches
54D8 5013      00256     movf    TIA_PATCH, W
54DA 0BC0      00257     andlw   0xc0
54DC A4D8      00258     skpz
54DE 6A13      00259     clrf    TIA_PATCH   ;; to Int. Patch if >63
               00260     
54E0 00261 TIA_MIDI_CC_00_Ok
54E0 EC2E F01F 00262         call    TIA_PATCH_Init
               00263         ;;goto  USER_DISPLAY_Init
54E4 00264 TIA_MIDI_CC_00_End
54E4 0012      00265     return
               00266 
               00267 
54E6 00268 TIA_MIDI_CC_No00
54E6 5003      00269         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
54E8 0B0F      00270         andlw   0x0f
54EA 6320      00271         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
54EC 0012      00272         return
               00273 
               00274         ;; forward CC to CCIN_Set routine
54EE C005 F003 00275         movff   MIOS_PARAMETER3, MIOS_PARAMETER1
54F2 5004      00276         movf    MIOS_PARAMETER2, W
54F4 EC5C F02F 00277         call    TIA_CCIN_Set
               00278 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 177


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
54F8 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 ;; --------------------------------------------------------------------------
54FA 00288 TIA_MIDI_ProgramChange
               00289         SET_BSR TIA_BASE
54FA 0101          M         movlb   HIGH(reg)
               00290 
54FC 5003      00291         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
54FE 0B0F      00292         andlw   0x0f
5500 6320      00293         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
5502 0012      00294         return
               00295     
               00296     ;; Int.Patch if ==0 
5504 5004      00297     movf    MIOS_PARAMETER2, W
5506 E00A      00298     bz      TIA_MIDI_ProgramChange_Ok
               00299     
               00300     ;; Banstick Ready
5508 5014      00301     movf    TIA_PBANK, W
550A EC41 F020 00302     call    TIA_BANK_GetBankStickReady
550E B4D8      00303         skpnz
5510 6A04      00304     clrf    MIOS_PARAMETER2
               00305      
               00306     ;; Banstick Size
5512 EC4E F020 00307     call    TIA_BANK_GetBankStickSize
5516 E102      00308     bnz     TIA_MIDI_ProgramChange_Ok
               00309     ;; 64/128 patches
5518 BC04      00310     btfsc       MIOS_PARAMETER2, 6
               00311     rgoto   TIA_MIDI_ProgramChange_End   
551A D004          M         bra     label
               00312     
551C 00313 TIA_MIDI_ProgramChange_Ok
551C C004 F013 00314         movff   MIOS_PARAMETER2, TIA_PATCH
5520 EC2E F01F 00315         call    TIA_PATCH_Init
               00316         ;;goto  USER_DISPLAY_Init
5524 00317 TIA_MIDI_ProgramChange_End
5524 0012      00318     return
               00319 
               00320 ;; --------------------------------------------------------------------------
               00321 ;;  This function is rcalled to forward a Poly Aftertouch event to the synthesizer
               00322 ;;  Input:
               00323 ;;     o first  MIDI event byte in MIOS_PARAMETER1
               00324 ;;     o second MIDI event byte in MIOS_PARAMETER2
               00325 ;; --------------------------------------------------------------------------
5526 00326 TIA_MIDI_PolyAfterTouch
5526 C004 F005 00327         movff   MIOS_PARAMETER2, MIOS_PARAMETER3
               00328         rgoto   TIA_MIDI_AfterTouch
552A D000          M         bra     label
               00329 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 178


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               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 ;; --------------------------------------------------------------------------
552C 00337 TIA_MIDI_AfterTouch
               00338         SET_BSR TIA_BASE
552C 0101          M         movlb   HIGH(reg)
               00339 
552E 5003      00340         movf    MIOS_PARAMETER1, W      ; leave routine if MIDI channel doesn't match
5530 0B0F      00341         andlw   0x0f
5532 6320      00342         cpfseq  TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, BANKED
5534 0012      00343         return
               00344 
5536 5005      00345         movf    MIOS_PARAMETER3, W
5538 00346 _TIA_MIDI_AfterTouch
5538 6E03      00347         movwf   MIOS_PARAMETER1
               00348         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
553A 0101          M         movlb   HIGH(reg)
553C EE11 F0E8 00349         lfsr    FSR1, TIA_CTRL_AFTERTOUCH_BASE; prepare FSR1
5540 EF20 F030 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         ;; ------------------------------------------------------------------
5544 00360 TIA_MIDI_Hlp_PushNote
5544 6A06      00361         clrf    TMP1
               00362         ;; do nothing if note is already stored in note stack
5546 00363 TIA_MIDI_Hlp_PushNote_CheckLoop
5546 5006      00364         movf    TMP1, W
5548 50E3      00365         movf    PLUSW1, W
554A 1804      00366         xorwf   MIOS_PARAMETER2, W
554C B4D8      00367         skpnz
               00368         rgoto   TIA_MIDI_Hlp_PushNote_Failed       ; leave note routine if note already stored
554E D012          M         bra     label
5550 2A06      00369         incf    TMP1, F
5552 0E04      00370         movlw   TIA_NOTE_STACK_LEN
5554 6206      00371         cpfseq  TMP1, ACCESS
               00372         rgoto TIA_MIDI_Hlp_PushNote_CheckLoop
5556 D7F7          M         bra     label
               00373         
               00374         ;; shift right note stack 
5558 0E02      00375         movlw   (TIA_NOTE_STACK_LEN-2)
555A 6E06      00376         movwf   TMP1
555C 00377 TIA_MIDI_Hlp_PushNote_ShiftLoop
555C 5006      00378         movf    TMP1, W
555E CFE3 F007 00379         movff   PLUSW1, TMP2
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 179


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5562 2806      00380         incf    TMP1, W
5564 C007 FFE3 00381         movff   TMP2, PLUSW1
5568 0606      00382         decf    TMP1, F
556A 2806      00383         incf    TMP1, W
556C E1F7      00384         bnz     TIA_MIDI_Hlp_PushNote_ShiftLoop
               00385 
               00386         ;; store new note at offset 0
556E C004 FFE7 00387         movff   MIOS_PARAMETER2, INDF1
               00388 
5572 0C00      00389         retlw   0x00            ; return 0x00 as error status
               00390 
5574 00391 TIA_MIDI_Hlp_PushNote_Failed
5574 0C01      00392         retlw   0x01            ; return 0x01 as error status
               00393 
               00394         ;; ------------------------------------------------------------------
               00395 
               00396         ;; ------------------------------------------------------------------
               00397         ;; Pop a note from the stack
               00398         ;; ------------------------------------------------------------------
5576 00399 TIA_MIDI_Hlp_PopNote
               00400         ; search for note entry with the same number, erase it and push the entries behind
5576 6A06      00401         clrf    TMP1
5578 00402 TIA_MIDI_Hlp_PopNote_SearchLoop
5578 5006      00403         movf    TMP1, W
557A 50E3      00404         movf    PLUSW1, W
557C 1804      00405         xorwf   MIOS_PARAMETER2, W
557E E005      00406         bz      TIA_MIDI_Hlp_PopNote_Found
5580 2A06      00407         incf    TMP1, F
5582 0E04      00408         movlw   TIA_NOTE_STACK_LEN
5584 6206      00409         cpfseq  TMP1, ACCESS
               00410         rgoto TIA_MIDI_Hlp_PopNote_SearchLoop
5586 D7F8          M         bra     label
               00411         rgoto   TIA_MIDI_Hlp_PopNote_Failed
5588 D00D          M         bra     label
558A 00412 TIA_MIDI_Hlp_PopNote_Found
               00413 
               00414         ;; push the entries behind the found entry
558A 00415 TIA_MIDI_Hlp_PopNote_ShiftLoop
558A 2806      00416         incf    TMP1, W
558C CFE3 F007 00417         movff   PLUSW1, TMP2
5590 5006      00418         movf    TMP1, W
5592 C007 FFE3 00419         movff   TMP2, PLUSW1
5596 2A06      00420         incf    TMP1, F
5598 0E04      00421         movlw   TIA_NOTE_STACK_LEN
559A 6206      00422         cpfseq  TMP1, ACCESS
               00423         rgoto TIA_MIDI_Hlp_PopNote_ShiftLoop
559C D7F6          M         bra     label
               00424         ;; clear the last entry
559E 0E03      00425         movlw   TIA_NOTE_STACK_LEN-1
55A0 6AE3      00426         clrf    PLUSW1
55A2 0C00      00427         retlw   0x00            ; return with 0x00: note deleted from stack
               00428 
55A4 00429 TIA_MIDI_Hlp_PopNote_Failed
55A4 0C01      00430         retlw   0x01            ; return with 0x01: note not found in stack
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 180


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00431 
               00432         ;; ------------------------------------------------------------------
               00433 
               00434         ;; ------------------------------------------------------------------
               00435         ;; Note On help function
               00436         ;; ------------------------------------------------------------------
55A6 00437 TIA_MIDI_Hlp_NoteOn
               00438 ;   BRA_IFCLR TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED, TIA_MIDI_Hlp_NoteOn_NoNewNote
55A6 00439 TIA_MIDI_Hlp_NoteOn_NewNote
55A6 0E10      00440         movlw   TIA_Vx_NOTE
55A8 CFEB FFF5 00441         movff   PLUSW0, TABLAT
55AC CFE7 FFEB 00442         movff   INDF1, PLUSW0
55B0 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 
55B0 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 
55B0 0E0E      00463     movlw       TIA_Vx_PORTA_RATE
55B2 50EB      00464     movf        PLUSW0, W
55B4 E012      00465     bz  TIA_MIDI_Hlp_NoteOn_SusKeyNoPor
55B6 00466 TIA_MIDI_Hlp_NoteOn_SusKeyPor_NC
55B6 0E03      00467         movlw   TIA_Vx_STAT
55B8 88EB      00468         bsf     PLUSW0, Vx_STAT_PORTA_ENABLE
               00469 
               00470         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
               00471 
55BA 0E09      00472         movlw   TIA_Vx_FRQ_L
55BC CFEB F006 00473         movff   PLUSW0, TMP1
55C0 0E0A      00474         movlw   TIA_Vx_FRQ_H
55C2 CFEB F007 00475         movff   PLUSW0, TMP2    
               00476 
55C6 0E1C      00477         movlw   TIA_Vx_PORTA_FRQ_L
55C8 C006 FFEB 00478         movff   TMP1, PLUSW0
55CC 0E1D      00479         movlw   TIA_Vx_PORTA_FRQ_H
55CE C007 FFEB 00480         movff   TMP2, PLUSW0   
               00481     
55D2 0E1A      00482     movlw   TIA_Vx_PORTA_CTR_L 
55D4 6AEB      00483         clrf    PLUSW0
55D6 0E1B      00484     movlw   TIA_Vx_PORTA_CTR_H 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 181


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
55D8 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 
55DA 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)
55DA 0E15      00495         movlw   TIA_Vx_ARP_CTR
55DC 6AEB      00496         clrf    PLUSW0
55DE 0E14      00497         movlw   TIA_Vx_ARP_NOTE_NUMBER
55E0 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
55E2 D81C      00511         rcall   TIA_MIDI_Hlp_GateOn
               00512 
               00513 
               00514         ;; ---[ END handle velocity ]---
               00515     
               00516         ;; ---[ BEGIN handle velocity ]---
               00517     
55E4 C003 F006 00518         movff   MIOS_PARAMETER1, TMP1   ; store MIOS_PARAMETER1
55E8 C004 F007 00519         movff   MIOS_PARAMETER2, TMP2   ; store MIOS_PARAMETER2
55EC 5005      00520         movf    MIOS_PARAMETER3, W      ; copy velocity value to MIOS_PARAMETER1
55EE E00D      00521         bz      TIA_MIDI_Hlp_NoteOn_NoVel; no velocity on note off!
55F0 6E03      00522     movwf   MIOS_PARAMETER1
55F2 0E28      00523     movlw   TIA_Vx_LAST_VELOCITY 
55F4 C005 FFEB 00524         movff   MIOS_PARAMETER3, PLUSW0   
               00525         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
55F8 0101          M         movlb   HIGH(reg)
55FA EE10 F000 00526         lfsr    FSR1, FSR0
55FE ECB1 F02F 00527         call    TIA_CCIN_Cmd_VELOCITY_SkpCopy   ; set velocity value
5602 C006 F003 00528         movff   TMP1, MIOS_PARAMETER1   ; restore MIOS_PARAMETER1
5606 C007 F004 00529         movff   TMP2, MIOS_PARAMETER2   ; restore MIOS_PARAMETER2
               00530         ;; ---[ END handle velocity ]---
               00531 
               00532 
               00533 
560A 00534 TIA_MIDI_Hlp_NoteOn_NoVel
               00535 
560A 00536 TIA_MIDI_Hlp_NoteOn_TrgGateLSkp
560A 0012      00537         return
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 182


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00538 
               00539 
               00540         ;; ------------------------------------------------------------------
               00541         ;; Note Off help function
               00542         ;; ------------------------------------------------------------------
560C 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
560C 6204      00548         cpfseq  MIOS_PARAMETER2, ACCESS
               00549         rgoto TIA_MIDI_Hlp_NoteOff_End
560E D005          M         bra     label
5610 D812      00550         rcall   TIA_MIDI_Hlp_GateOff
5612 00551 TIA_MIDI_Hlp_NoteOff_NoGOff
               00552         ;; ------------------------------------------------------------------
               00553 
               00554         ;; if still note available, play new note in NoteOn Section
5612 50E7      00555         movf    INDF1, W
5614 A4D8      00556         skpz
5616 0C01      00557         retlw   0x01            ; return, request Note On!
               00558 
               00559         ;; else request gate clear bit
5618 D80E      00560         rcall   TIA_MIDI_Hlp_GateOff
561A 00561 TIA_MIDI_Hlp_NoteOff_End
561A 0C00      00562         retlw   0x00            ; return, request NO Note On!
               00563 
               00564         ;; ------------------------------------------------------------------
               00565 
               00566         ;; ------------------------------------------------------------------
               00567         ;; Gate On help function
               00568         ;; ------------------------------------------------------------------
561C 00569 TIA_MIDI_Hlp_GateOn
561C 90D8      00570         clrc
561E 0E11      00571         movlw   TIA_Vx_NOTE_DELAY
5620 34EB      00572         rlf     PLUSW0, W
5622 6EF5      00573         movwf   TABLAT
5624 0E12      00574         movlw   TIA_Vx_NOTE_DELAY_CTR
5626 CFF5 FFEB 00575         movff   TABLAT, PLUSW0
               00576 
562A 0E03      00577         movlw   TIA_Vx_STAT
               00578         ;btfsc  TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
562C 82EB      00579         bsf     PLUSW0, Vx_STAT_GATE_SET_REQ
562E 80EB      00580         bsf     PLUSW0, Vx_STAT_VOICE_ACTIVE
               00581 
               00582         ;; reset wavetable handler (only voice 1 can do this!)
5630 50E9      00583         movf    FSR0L, W
5632 0A20      00584         xorlw   TIA_V1_BASE & 0xff
               00585         ;skpnz
               00586         ;bsf    TIA_WT_STATE, WT_STATE_RESET, BANKED
               00587 
5634 0012      00588         return
               00589 
               00590         ;; ------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 183


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00591         ;; Gate Off help function
               00592         ;; ------------------------------------------------------------------
5636 00593 TIA_MIDI_Hlp_GateOff
5636 90D8      00594         clrc
5638 0E11      00595         movlw   TIA_Vx_NOTE_DELAY
563A 34EB      00596         rlf     PLUSW0, W
563C 6EF5      00597         movwf   TABLAT
563E 0E12      00598         movlw   TIA_Vx_NOTE_DELAY_CTR
5640 CFF5 FFEB 00599         movff   TABLAT, PLUSW0
               00600 
5644 0E03      00601         movlw   TIA_Vx_STAT
5646 92EB      00602         bcf     PLUSW0, Vx_STAT_GATE_SET_REQ
5648 84EB      00603         bsf     PLUSW0, Vx_STAT_GATE_CLR_REQ
564A 90EB      00604         bcf     PLUSW0, Vx_STAT_VOICE_ACTIVE
564C 0012      00605         return
               00606 
               00607         ;; ------------------------------------------------------------------
               00608         ;; for Note On/Note Off in Mono mode
               00609         ;; MIDI channel in MIOS_PARAMETER1[0..3]
               00610         ;; result in TMP5
564E 00611 TIA_MIDI_GetAssignedChannels
564E 6A0A      00612         clrf    TMP5            ; TMP5 contains the voices which should be played
               00613         
5650 5003      00614         movf    MIOS_PARAMETER1, W
5652 0B0F      00615         andlw   0x0f
5654 1920      00616         xorwf   TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, W, BANKED
5656 B4D8      00617         skpnz
5658 800A      00618         bsf     TMP5, 0         ; play voice 1
               00619 
565A 5003      00620         movf    MIOS_PARAMETER1, W
565C 0B0F      00621         andlw   0x0f
565E 1960      00622         xorwf   TIA_V2_BASE + TIA_Vx_MIDI_CHANNEL, W, BANKED
5660 B4D8      00623         skpnz
5662 820A      00624         bsf     TMP5, 1         ; play voice 2
               00625     
               00626    
5664 500A      00627     movf        TMP5, W
5666 0012      00628         return
               00629 
               00630         ;; ------------------------------------------------------------------
               00631         ;; for Note On/Off in Mono mode
               00632         ;; note number in MIOS_PARAMETER2
               00633         ;; result will be ANDed to TMP5 --- TIA_MIDI_GetAssignedChannels should be called before!
               00634 TIA_MIDI_GETASSIGNEDVOICEx MACRO FLAG_Vx, TIA_Vx_BASE
               00635         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00636         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00637         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_End
               00638 
               00639         ;; handle split points
               00640         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
               00641         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
               00642         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
               00643     
               00644         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 184


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00645         cpfslt  MIOS_PARAMETER2, ACCESS
               00646         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00647         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00648 
               00649 TIA_MIDI_GETASSIGNEDVOICEx_LOk
               00650         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
               00651         cpfsgt  MIOS_PARAMETER2, ACCESS
               00652         rgoto TIA_MIDI_GETASSIGNEDVOICEx_End
               00653 TIA_MIDI_GETASSIGNEDVOICEx_LOff
               00654         bcf     TMP5, FLAG_Vx           ; don't play voice
               00655 TIA_MIDI_GETASSIGNEDVOICEx_End
               00656         ENDM
               00657 
5668 00658 TIA_MIDI_GetAssignedVoices
               00659         TIA_MIDI_GETASSIGNEDVOICEx 0, TIA_V1_BASE
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOk
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOff
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_End
                   M 
                   M         ;; handle split points
5668 5121          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
566A 1122          M         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
566C E008          M         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
                   M     
566E 5121          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
5670 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
5672 D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
5674 D003          M         bra     label
                   M 
5676     M TIA_MIDI_GETASSIGNEDVOICEx_LOk
5676 5122          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
5678 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_End
567A D001          M         bra     label
567C     M TIA_MIDI_GETASSIGNEDVOICEx_LOff
567C 900A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
567E     M TIA_MIDI_GETASSIGNEDVOICEx_End
               00660         TIA_MIDI_GETASSIGNEDVOICEx 1, TIA_V2_BASE
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOk
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_LOff
                   M         LOCAL   TIA_MIDI_GETASSIGNEDVOICEx_End
                   M 
                   M         ;; handle split points
567E 5161          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED     ; (don't split if 0)
5680 1162          M         iorwf   TIA_Vx_BASE + TIA_Vx_SPLIT_UPPER, W, BANKED
5682 E008          M         bz      TIA_MIDI_GETASSIGNEDVOICEx_End
                   M     
5684 5161          M         movf    TIA_Vx_BASE + TIA_Vx_SPLIT_LOWER, W, BANKED
5686 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDVOICEx_LOk
5688 D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDVOICEx_LOff
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 185


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_LOk
56A0 D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDKEYx_LOff
56A2 D006          M         bra     label
                   M 
56A4     M TIA_MIDI_GETASSIGNEDKEYx_LOk
56A4 0E1F          M     movlw   0x1f
56A6 6526          M     cpfsgt  TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, BANKED
56A8 5126          M     movf    TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, W, BANKED
56AA 2525          M         addwf   TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
56AC 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_End
56AE D001          M         bra     label
56B0     M TIA_MIDI_GETASSIGNEDKEYx_LOff
56B0 900A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
56B2     M TIA_MIDI_GETASSIGNEDKEYx_End
               00695         TIA_MIDI_GETASSIGNEDKEYx 1, TIA_V2_BASE
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOk
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_LOff
                   M         LOCAL   TIA_MIDI_GETASSIGNEDKEYx_End
                   M 
56B2 B564          M     btfsc   TIA_Vx_BASE + TIA_Vx_MODE, Vx_MODE_KEY_EXTENDED, BANKED
                   M     rgoto   TIA_MIDI_GETASSIGNEDKEYx_End
56B4 D00B          M         bra     label
                   M     
56B6 5165          M         movf    TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
56B8 6004          M         cpfslt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_LOk
56BA D001          M         bra     label
                   M         rgoto   TIA_MIDI_GETASSIGNEDKEYx_LOff
56BC D006          M         bra     label
                   M 
56BE     M TIA_MIDI_GETASSIGNEDKEYx_LOk
56BE 0E1F          M     movlw   0x1f
56C0 6566          M     cpfsgt  TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, BANKED
56C2 5166          M     movf    TIA_Vx_BASE + TIA_Vx_KEY_LENGTH, W, BANKED
56C4 2565          M         addwf   TIA_Vx_BASE + TIA_Vx_KEY_OFFSET, W, BANKED
56C6 6404          M         cpfsgt  MIOS_PARAMETER2, ACCESS
                   M         rgoto TIA_MIDI_GETASSIGNEDKEYx_End
56C8 D001          M         bra     label
56CA     M TIA_MIDI_GETASSIGNEDKEYx_LOff
56CA 920A          M         bcf     TMP5, FLAG_Vx           ; don't play voice
56CC     M TIA_MIDI_GETASSIGNEDKEYx_End
56CC 500A      00696     movf        TMP5, W
56CE 0012      00697         return    
               00698 
               00699     
               00700         ;; ------------------------------------------------------------------
               00701         ;; arpeggiator sorter
               00702         ;; expecting base pointer to voice record in FSR2
56D0 00703 TIA_MIDI_Arp_Sorter
               00704         ;; TIA_Vx_ARP_NOTE_0 -> FSR0
56D0 CFDA FFEA 00705         movff   FSR2H, FSR0H
56D4 50D9      00706         movf    FSR2L, W
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 187


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
56D6 0F1E      00707         addlw   TIA_Vx_ARP_NOTE_0
56D8 6EE9      00708         movwf   FSR0L
               00709 
               00710         ;; TIA_Vx_NOTE_STACK_0 -> FSR1
56DA CFDA FFE2 00711         movff   FSR2H, FSR1H
56DE 50D9      00712         movf    FSR2L, W
56E0 0F22      00713         addlw   TIA_Vx_NOTE_STACK_0
56E2 6EE1      00714         movwf   FSR1L
               00715 
56E4 CFE9 F006 00716         movff   FSR0L, TMP1     ; save pointer to ARP_NOTE_0 in TMP1
               00717         ;; clear all current entries
56E8 6AEE      00718         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_0)
56EA 6AEE      00719         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_1)
56EC 6AEE      00720         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_2)
56EE 6AEE      00721         clrf    POSTINC0        ; (TIA_Vx_ARP_NOTE_3)
56F0 C006 FFE9 00722         movff   TMP1, FSR0L     ; restore pointer to ARP_NOTE_0 from TMP1
               00723 
56F4 50E7      00724         movf    INDF1, W        ; (TIA_Vx_NOTE_STACK_0)
56F6 E017      00725         bz      TIA_MIDI_Arp_Sorter_End
               00726 
56F8 50E6      00727         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_0)
56FA D816      00728         rcall   TIA_MIDI_ARP_Sorter_Add
56FC 50E6      00729         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_1)
56FE D814      00730         rcall   TIA_MIDI_ARP_Sorter_Add
5700 50E6      00731         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_2)
5702 D812      00732         rcall   TIA_MIDI_ARP_Sorter_Add
5704 50E6      00733         movf    POSTINC1, W     ; (TIA_Vx_NOTE_STACK_3)
5706 D810      00734         rcall   TIA_MIDI_ARP_Sorter_Add
               00735 
               00736         ;; if rate is > 0, and arp has been reset: copy first arp note into TIA_Vx_NOTE
5708 0E13      00737         movlw   TIA_Vx_ARP_RATE
570A 50DB      00738         movf    PLUSW2, W
570C E00C      00739         bz      TIA_MIDI_Arp_Sorter_End
570E 0E15      00740         movlw   TIA_Vx_ARP_CTR
5710 50DB      00741         movf    PLUSW2, W
5712 E109      00742         bnz     TIA_MIDI_Arp_Sorter_End
5714 0E14      00743         movlw   TIA_Vx_ARP_NOTE_NUMBER
5716 50DB      00744         movf    PLUSW2, W
5718 E106      00745         bnz     TIA_MIDI_Arp_Sorter_End
               00746 
571A 0E1E      00747         movlw   TIA_Vx_ARP_NOTE_0
571C CFDB FFF5 00748         movff   PLUSW2, TABLAT
5720 0E10      00749         movlw   TIA_Vx_NOTE
5722 CFF5 FFDB 00750         movff   TABLAT, PLUSW2
               00751 
5726 00752 TIA_MIDI_Arp_Sorter_End
5726 0012      00753         return
               00754 
               00755 ;; ---
               00756         ;; add to ARP note buffer, sort automatically from lowest to highest note
5728 00757 TIA_MIDI_ARP_Sorter_Add
5728 B4D8      00758         skpnz                   ; only add notes > 0
572A 0012      00759         return
               00760 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 188


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
572C 6E06      00761         movwf   TMP1            ; store new note number in TMP2
572E 6A07      00762         clrf    TMP2            ; TMP2 used as loop counter
5730 00763 TIA_MIDI_ARP_Sorter_Loop
5730 5007      00764         movf    TMP2, W
5732 50EB      00765         movf    PLUSW0, W
5734 E006      00766         bz      TIA_MIDI_ARP_Sorter_Push; the fourth note will ever be pushed as the appr. byte is zero
5736 5C06      00767         subwf   TMP1, W
5738 E304      00768         bnc     TIA_MIDI_ARP_Sorter_Push
573A 2A07      00769         incf    TMP2, F
               00770         BRA_IFCLR TMP2, 2, ACCESS, TIA_MIDI_ARP_Sorter_Loop
573C A407          M         btfss   reg, bit, reg_a
573E D7F8          M         bra     label
5740 0012      00771         return                  ; this case never happens
               00772 
5742 00773 TIA_MIDI_ARP_Sorter_Push
5742 5007      00774         movf    TMP2, W         ; fourth note: no shift required
5744 0A03      00775         xorlw   0x03
5746 E00D      00776         bz      TIA_MIDI_ARP_Sorter_PushN
5748 0E02      00777         movlw   0x02
574A 6E08      00778         movwf   TMP3
574C 00779 TIA_MIDI_ARP_Sorter_PushL
574C 5008      00780         movf    TMP3, W
574E CFEB F009 00781         movff   PLUSW0, TMP4
5752 0F01      00782         addlw   1
5754 C009 FFEB 00783         movff   TMP4, PLUSW0
5758 5007      00784         movf    TMP2, W
575A 1808      00785         xorwf   TMP3, W
575C E002      00786         bz      TIA_MIDI_ARP_Sorter_PushN
575E 0608      00787         decf    TMP3, F
               00788         rgoto   TIA_MIDI_ARP_Sorter_PushL
5760 D7F5          M         bra     label
               00789 
5762 00790 TIA_MIDI_ARP_Sorter_PushN
5762 5007      00791         movf    TMP2, W
5764 C006 FFEB 00792         movff   TMP1, PLUSW0
5768 0012      00793         return
               00387 #include "tia_sysex.inc"
               00001 ; $Id: tia_sysex.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA SysEx Parser
               00004 ;
               00005 ; ==========================================================================
               00006 ;
               00007 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00008 ;  Licensed for personal non-commercial use only.
               00009 ;  All other rights reserved.
               00010 ; 
               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]
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 189


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
  00000003     00018 TIA_SYSEX_STATE_TYPE_RECEIVED   EQU     3       ; used by Action PATCH_[Read/Write]
  00000002     00019 TIA_SYSEX_STATE_WAIT_CHECKSUM   EQU     2       ; used by Action PATCH_Write
               00020 
  00000005     00021 TIA_SYSEX_STATE_AH_RECEIVED     EQU     5       ; used by Action PAR_[Read/Write]
  00000004     00022 TIA_SYSEX_STATE_AL_RECEIVED     EQU     4       ; used by Action PAR_[Read/Write]
  00000003     00023 TIA_SYSEX_STATE_D_RECEIVED      EQU     3       ; used by Action PAR_[Write]
               00024 
  00000005     00025 TIA_SYSEX_STATE_A_RECEIVED      EQU     5       ; used by Action CFG_[Read/Write]
  00000004     00026 TIA_SYSEX_STATE_DH_RECEIVED     EQU     4       ; used by Action CFG_[Read/Write]
  00000003     00027 TIA_SYSEX_STATE_DL_RECEIVED     EQU     3       ; used by Action CFG_[Read/Write]
               00028 
               00029 ;; --------------------------------------------------------------------------
               00030 ;;  This sysex parser waits for the TIA Header 
               00031 ;; --------------------------------------------------------------------------
576A 00032 TIA_SYSEX_SysExCheck
               00033         ;; store received byte in TIA_SYSEX_IN
576A 6E23      00034         movwf   TIA_SYSEX_IN
               00035 
               00036         ;; ignore realtime messages
576C 0EF8      00037         movlw   0xf8
576E 6023      00038         cpfslt  TIA_SYSEX_IN, ACCESS
5770 0012      00039         return
               00040 
               00041         ;; check sysex state
               00042         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_MYSYSEX, ACCESS, TIA_SYSEX_Handler
5772 BE21          M         btfsc   reg, bit, reg_a
5774 D026          M         bra     label
               00043 
5776 5021      00044         movf    TIA_SYSEX_STATE, W
5778 D80E      00045         rcall   TIA_SYSEX_SysExHeaderGet
577A 6223      00046         cpfseq  TIA_SYSEX_IN, ACCESS
               00047         rgoto TIA_SYSEX_SysExCheckFailed
577C D00A          M         bra     label
577E 2A21      00048         incf    TIA_SYSEX_STATE, F
5780 5021      00049         movf    TIA_SYSEX_STATE, W
5782 0B07      00050         andlw   0x07
5784 0A06      00051         xorlw   0x06    ; wait for 6 bytes (f0 00 00 7E 46 <device-id>)
5786 E106      00052         bnz     TIA_SYSEX_SysExCheckOk
               00053 
               00054         ;; SysEx ID received, lets go
5788 0E80      00055         movlw   (1 << TIA_SYSEX_STATE_MYSYSEX)
578A 6E21      00056         movwf   TIA_SYSEX_STATE
578C EC28 F016 00057         call    MIOS_MPROC_MergerDisable
               00058         rgoto   TIA_SYSEX_SysExCheckOk
5790 D001          M         bra     label
               00059 
5792 00060 TIA_SYSEX_SysExCheckFailed
               00061         ;; reset the sysex counter and action ID
5792 D80B      00062         rcall   TIA_SYSEX_ActionInvalid
5794 00063 TIA_SYSEX_SysExCheckOk
               00064 
5794 00065 TIA_SYSEX_SysExCheck_End
5794 0012      00066         return
               00067 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 190


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00068 ; ==========================================================================
               00069 
               00070 ;; --------------------------------------------------------------------------
               00071 ;;  Returns expected MIDI bytes from SysEx header
               00072 ;; --------------------------------------------------------------------------
5796 00073 TIA_SYSEX_SysExHeaderGet
5796 0B07      00074         andlw   0x07
               00075         JUMPTABLE_2BYTES_UNSECURE
5798 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
579C 0CF0      00076         retlw   0xf0
579E 0C00      00077         retlw   0x00            ; Vendor ID
57A0 0C00      00078         retlw   0x00
57A2 0C7E      00079         retlw   0x7e
57A4 0C51      00080         retlw   0x51            ; MIDIbox TIA ID (51 - the ultimative number + 4)
57A6 5020      00081         movf    TIA_MIDI_DEVICE, W
57A8 0012      00082         return
               00083 
               00084 ;; --------------------------------------------------------------------------
               00085 ;;  Action Invalid will be invoked when receiving an invalid sequence
               00086 ;; --------------------------------------------------------------------------
57AA 00087 TIA_SYSEX_ActionInvalid
               00088 
               00089 ;; --------------------------------------------------------------------------
               00090 ;;  Action finished will be invoked when midi action is done
               00091 ;; --------------------------------------------------------------------------
57AA 00092 TIA_SYSEX_ActionFinished
57AA 6A21      00093         clrf    TIA_SYSEX_STATE
57AC 6A22      00094         clrf    TIA_SYSEX_ACTION
               00095 #if DEFAULT_TIA_DEBUG_ON == 1 
57AE 8F64      00096     bsf TIA_DEBUG_EE_REGA, TIA_DEBUG_EE_SYX
57B0 ECA3 F01A 00097     call    TIA_Debug_EE_Do
57B4 8E5B      00098     bsf TIA_DEBUG_BS_REGA, TIA_DEBUG_EE_SYX
57B6 EC43 F01B 00099     call    TIA_Debug_BS_Do
               00100 #endif
               00101         ;; reinit patch if engine has been disabled during upload
57BA 9010      00102         bcf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
               00103         
57BC EC2A F016 00104         call    MIOS_MPROC_MergerEnable
               00105         rgoto   TIA_SYSEX_SysExCheck_End
57C0 D7E9          M         bra     label
               00106 
               00107 
               00108 ;; --------------------------------------------------------------------------
               00109 ;;  MIDI Check action: perform a sysex action
               00110 ;; --------------------------------------------------------------------------
57C2 00111 TIA_SYSEX_Handler
               00112         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_ACTION, ACCESS, TIA_SYSEX_Handler_DoAction
57C2 BC21          M         btfsc   reg, bit, reg_a
57C4 D005          M         bra     label
               00113 
57C6 8C21      00114         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_ACTION
               00115 
57C8 C023 F022 00116         movff   TIA_SYSEX_IN, TIA_SYSEX_ACTION  ; store action ID
57CC D81A      00117         rcall   TIA_SYSEX_Handler_InitAction    ; initialize the action
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 191


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00118         rgoto   TIA_SYSEX_SysExCheck_End        ; branch to the end
57CE D7E2          M         bra     label
               00119 
               00120         ;; ---
               00121 
57D0 00122 TIA_SYSEX_Handler_DoAction
               00123         ;; branch to end if status byte (i.e. F7)
               00124         BRA_IFSET TIA_SYSEX_IN, 7, ACCESS, TIA_SYSEX_Handler_EndAction
57D0 BE23          M         btfsc   reg, bit, reg_a
57D2 D02E          M         bra     label
               00125 
               00126         ;; branch depending on current action ID
57D4 5022      00127         movf    TIA_SYSEX_ACTION, W
               00128         JUMPTABLE_2BYTES 16     ; 16 entries
57D6 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
57D8 B0D8          M         skpnc
57DA 0EF0          M         movlw   -(max_value)
57DC 0F10          M         addlw   max_value
57DE ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00129         rgoto   TIA_SYSEX_ActionInvalid
57E2 D7E3          M         bra     label
               00130         rgoto   TIA_SYSEX_Action_PRESET_Read
57E4 D040          M         bra     label
               00131         rgoto   TIA_SYSEX_Action_PRESET_Write
57E6 D08D          M         bra     label
               00132         rgoto   TIA_SYSEX_Action_BANK_Read
57E8 D108          M         bra     label
               00133         rgoto   TIA_SYSEX_Action_BANK_WriteName
57EA D169          M         bra     label
               00134         rgoto   TIA_SYSEX_Action_PAR_Read
57EC D1B8          M         bra     label
               00135         rgoto   TIA_SYSEX_Action_PAR_Write
57EE D1E8          M         bra     label
               00136         rgoto   TIA_SYSEX_ActionInvalid
57F0 D7DC          M         bra     label
               00137         rgoto   TIA_SYSEX_ActionInvalid
57F2 D7DB          M         bra     label
               00138         rgoto   TIA_SYSEX_ActionInvalid
57F4 D7DA          M         bra     label
               00139         rgoto   TIA_SYSEX_ActionInvalid
57F6 D7D9          M         bra     label
               00140         rgoto   TIA_SYSEX_Action_BANK_Sel
57F8 D219          M         bra     label
               00141         rgoto   TIA_SYSEX_Action_CFG_Read
57FA D231          M         bra     label
               00142         rgoto   TIA_SYSEX_Action_CFG_Write
57FC D2B9          M         bra     label
               00143         rgoto   TIA_SYSEX_Action_RequestCC
57FE D2E9          M         bra     label
               00144         rgoto   TIA_SYSEX_Action_Ping
5800 D2EC          M         bra     label
               00145 
               00146 
               00147 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 192


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00148 ;;  Initialize an action depending on TIA_SYSEX_ACTION
               00149 ;; --------------------------------------------------------------------------
5802 00150 TIA_SYSEX_Handler_InitAction
5802 5022      00151         movf    TIA_SYSEX_ACTION, W
               00152         JUMPTABLE_2BYTES 16     ; 16 entries
5804 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
5806 B0D8          M         skpnc
5808 0EF0          M         movlw   -(max_value)
580A 0F10          M         addlw   max_value
580C ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00153         rgoto   TIA_SYSEX_ActionInvalid
5810 D7CC          M         bra     label
               00154         rgoto   TIA_SYSEX_Init_PRESET_Read
5812 D028          M         bra     label
               00155         rgoto   TIA_SYSEX_Init_PRESET_Write
5814 D072          M         bra     label
               00156         rgoto   TIA_SYSEX_Init_BANK_Read
5816 D0ED          M         bra     label
               00157         rgoto   TIA_SYSEX_Init_BANK_WriteName
5818 D151          M         bra     label
               00158     rgoto       TIA_SYSEX_Init_PAR_Read
581A D1A0          M         bra     label
               00159         rgoto   TIA_SYSEX_Init_PAR_Write
581C D1D0          M         bra     label
               00160         rgoto   TIA_SYSEX_ActionInvalid
581E D7C5          M         bra     label
               00161         rgoto   TIA_SYSEX_ActionInvalid
5820 D7C4          M         bra     label
               00162         rgoto   TIA_SYSEX_ActionInvalid
5822 D7C3          M         bra     label
               00163         rgoto   TIA_SYSEX_ActionInvalid
5824 D7C2          M         bra     label
               00164         rgoto   TIA_SYSEX_Init_BANK_Sel
5826 D200          M         bra     label
               00165         rgoto   TIA_SYSEX_Init_CFG_Read
5828 D219          M         bra     label
               00166         rgoto   TIA_SYSEX_Init_CFG_Write
582A D2A0          M         bra     label
               00167         rgoto   TIA_SYSEX_Init_RequestCC
582C D2D1          M         bra     label
               00168         rgoto   TIA_SYSEX_Init_Ping
582E D2D4          M         bra     label
               00169 
               00170         
               00171 ;; --------------------------------------------------------------------------
               00172 ;;  Finish an action depending on TIA_SYSEX_ACTION
               00173 ;; --------------------------------------------------------------------------
5830 00174 TIA_SYSEX_Handler_EndAction
               00175         ;; if sysex footer (F7) has not been received here, action is invalid!
5830 0EF7      00176         movlw   0xf7
5832 1823      00177         xorwf   TIA_SYSEX_IN, W
5834 E1BA      00178         bnz     TIA_SYSEX_ActionInvalid
               00179 
               00180         ;; else finish action
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 193


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5836 5022      00181         movf    TIA_SYSEX_ACTION, W
               00182         JUMPTABLE_2BYTES 16     ; 16 entries
5838 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
583A B0D8          M         skpnc
583C 0EF0          M         movlw   -(max_value)
583E 0F10          M         addlw   max_value
5840 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00183         rgoto   TIA_SYSEX_ActionInvalid
5844 D7B2          M         bra     label
               00184         rgoto   TIA_SYSEX_End_PRESET_Read
5846 D022          M         bra     label
               00185         rgoto   TIA_SYSEX_End_PRESET_Write
5848 D083          M         bra     label
               00186         rgoto   TIA_SYSEX_End_BANK_Read
584A D0E4          M         bra     label
               00187         rgoto   TIA_SYSEX_End_BANK_WriteName
584C D151          M         bra     label
               00188         rgoto   TIA_SYSEX_End_PAR_Read
584E D196          M         bra     label
               00189         rgoto   TIA_SYSEX_End_PAR_Write
5850 D1CC          M         bra     label
               00190         rgoto   TIA_SYSEX_ActionInvalid
5852 D7AB          M         bra     label
               00191         rgoto   TIA_SYSEX_ActionInvalid
5854 D7AA          M         bra     label
               00192         rgoto   TIA_SYSEX_ActionInvalid
5856 D7A9          M         bra     label
               00193         rgoto   TIA_SYSEX_ActionInvalid
5858 D7A8          M         bra     label
               00194         rgoto   TIA_SYSEX_End_BANK_Sel
585A D1EB          M         bra     label
               00195         rgoto   TIA_SYSEX_End_CFG_Read
585C D207          M         bra     label
               00196         rgoto   TIA_SYSEX_End_CFG_Write
585E D29C          M         bra     label
               00197         rgoto   TIA_SYSEX_End_RequestCC
5860 D2B9          M         bra     label
               00198         rgoto   TIA_SYSEX_End_Ping
5862 D2BC          M         bra     label
               00199 
               00200 ;; --------------------------------------------------------------------------
               00201 ;;  MIDI Action: Patch Read
               00202 ;; --------------------------------------------------------------------------
5864 00203 TIA_SYSEX_Init_PRESET_Read
5864 0012      00204         return
               00205 
5866 00206 TIA_SYSEX_Action_PRESET_Read
               00207         ;; receive <type> <bank> <patch> F7
5866 00208 TIA_SYSEX_Action_PRESET_Read_T
               00209         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_Read_B
5866 B621          M         btfsc   reg, bit, reg_a
5868 D004          M         bra     label
586A 8621      00210         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
586C C023 F025 00211         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 194


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00212         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5870 D791          M         bra     label
               00213 
5872 00214 TIA_SYSEX_Action_PRESET_Read_B
               00215         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_Read_P
5872 B821          M         btfsc   reg, bit, reg_a
5874 D004          M         bra     label
5876 8821      00216         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED    
5878 C023 F011 00217         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00218         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
587C D78B          M         bra     label
               00219     
587E 00220 TIA_SYSEX_Action_PRESET_Read_P
               00221         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_ReadStall
587E BA21          M         btfsc   reg, bit, reg_a
5880 D004          M         bra     label
5882 8A21      00222         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
5884 C023 F012 00223         movff   TIA_SYSEX_IN, TIA_PRESET                ; load preset
               00224         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5888 D785          M         bra     label
               00225                 
588A 00226 TIA_SYSEX_Action_PRESET_ReadStall
               00227         ;; do nothing until sysex footer (F7) has been received
               00228         rgoto   TIA_SYSEX_SysExCheck_End
588A D784          M         bra     label
               00229 
588C 00230 TIA_SYSEX_End_PRESET_Read
               00231         ;; action invalid if patch number has not been received
               00232         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
588C AA21          M         btfss   reg, bit, reg_a
588E D78D          M         bra     label
               00233 
5890 C011 F007 00234     movff   TIA_BANK, TMP2  ;; store relative bank
5894 5025      00235     movf        TIA_SYSEX_ADDRESS, W
5896 DADD      00236     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank      ; set bank to absolute
5898 6E26      00237     movwf   TIA_SYSEX_ERROR
589A E10F      00238     bnz     TIA_SYSEX_End_PRESET_Read_Cont
               00239     
589C 5012      00240     movf        TIA_PRESET, W
589E E00D      00241     bz      TIA_SYSEX_End_PRESET_Read_Cont    
58A0 5011      00242     movf    TIA_BANK, W
58A2 EC41 F020 00243     call    TIA_BANK_GetBankStickReady
58A6 A4D8      00244     skpz
               00245         rgoto   TIA_SYSEX_End_PRESET_Read_Size
58A8 D003          M         bra     label
               00246     ;; BS not ready Error #3
58AA 0E03      00247     movlw   0x03
58AC 6E26      00248     movwf   TIA_SYSEX_ERROR
               00249     rgoto   TIA_SYSEX_End_PRESET_Read_Cont
58AE D005          M         bra     label
58B0 00250 TIA_SYSEX_End_PRESET_Read_Size    
58B0 EC4E F020 00251     call    TIA_BANK_GetBankStickSize
58B4 E102      00252     bnz     TIA_SYSEX_End_PRESET_Read_Cont
               00253 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 195


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
58B6 BC12      00254     btfsc       TIA_PRESET, 6
58B8 6A12      00255         clrf    TIA_PRESET
               00256 
58BA 00257 TIA_SYSEX_End_PRESET_Read_Cont
               00258 
               00259         ;; send SysEx header
58BA DA98      00260         rcall   TIA_SYSEX_Send_SysExHeader
               00261 
               00262         ;; Send PRESET_Read ID
58BC 0E01      00263         movlw   0x01
58BE EC24 F016 00264         call    MIOS_MIDI_TxBufferPut
               00265 
               00266         ;; send requested preset type number
58C2 5025      00267     movf        TIA_SYSEX_ADDRESS, W
58C4 0B7F      00268     andlw   0x7f
58C6 EC24 F016 00269         call    MIOS_MIDI_TxBufferPut
               00270     
               00271         ;; send requested relative bank number
58CA 5007      00272         movf    TMP2, W
58CC 0B1F      00273     andlw   0x1f
58CE EC24 F016 00274         call    MIOS_MIDI_TxBufferPut
               00275     
               00276         ;; send requested preset number
58D2 5012      00277         movf    TIA_PRESET, W
58D4 0B7F      00278     andlw   0x7f
58D6 EC24 F016 00279         call    MIOS_MIDI_TxBufferPut
               00280     
58DA 5026      00281     movf    TIA_SYSEX_ERROR, W
58DC E004      00282     bz      TIA_SYSEX_End_PRESET_Read_Cont_Ok
58DE 0B7F      00283     andlw       0x7f
58E0 EC24 F016 00284         call    MIOS_MIDI_TxBufferPut
               00285     rgoto   TIA_SYSEX_End_PRESET_Read_Footer
58E4 D007          M         bra     label
               00286     
58E6 00287 TIA_SYSEX_End_PRESET_Read_Cont_Ok 
               00288         ;; clear checksum
58E6 6A24      00289         clrf    TIA_SYSEX_CHECKSUM
               00290 
               00291     ;movf       TIA_SYSEX_ADDRESS, W
               00292     ;rcall   TIA_SYSEX_Hlp_GetAbsoluteBank     ; set bank to absolute
               00293         ;; send patch (128 bytes)
58E8 DA9F      00294         rcall   TIA_SYSEX_Hlp_SendPreset        
               00295 
               00296         ;; send checksum
58EA 5024      00297         movf    TIA_SYSEX_CHECKSUM, W
58EC 0880      00298         sublw   0x80
58EE 0B7F      00299         andlw   0x7f
58F0 EC24 F016 00300         call    MIOS_MIDI_TxBufferPut
               00301 
58F4 00302 TIA_SYSEX_End_PRESET_Read_Footer
               00303         ;; send of SysEx footer
58F4 0E01      00304         movlw   0x01            ; (independend from merger state)
58F6 DA8D      00305         rcall   TIA_SYSEX_Send_SysExFooter
               00306 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 196


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00307         ;; finish Action
               00308         rgoto   TIA_SYSEX_ActionFinished
58F8 D758          M         bra     label
               00309 
               00310 ;; --------------------------------------------------------------------------
               00311 ;;  MIDI Action: Patch Write
               00312 ;; --------------------------------------------------------------------------
58FA 00313 TIA_SYSEX_Init_PRESET_Write
               00314         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
58FA 8010      00315         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
58FC EC59 F023 00316     call    TIA_TUNE_Note_Off
5900 0012      00317         return
               00318 
5902 00319 TIA_SYSEX_Action_PRESET_Write
               00320         ;; receive <type> <bank> <patch> <128 bytes> F7
5902 00321 TIA_SYSEX_Action_PRESET_WriteT
               00322         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteB
5902 B621          M         btfsc   reg, bit, reg_a
5904 D004          M         bra     label
5906 8621      00323         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
5908 C023 F025 00324         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00325         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
590C D743          M         bra     label
               00326 
590E 00327 TIA_SYSEX_Action_PRESET_WriteB
               00328         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteP
590E B821          M         btfsc   reg, bit, reg_a
5910 D004          M         bra     label
5912 8821      00329         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
5914 C023 F011 00330         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00331         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5918 D73D          M         bra     label
               00332     
591A 00333 TIA_SYSEX_Action_PRESET_WriteP
               00334         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_Action_PRESET_WriteC
591A BA21          M         btfsc   reg, bit, reg_a
591C D007          M         bra     label
591E 8A21      00335         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
5920 C023 F012 00336         movff   TIA_SYSEX_IN, TIA_PRESET                ; load preset 
               00337     
5924 6A24      00338         clrf    TIA_SYSEX_CHECKSUM              ; clear checksum
5926 6AA9      00339         clrf    EEADR                   ; clear address
5928 6A26      00340     clrf    TIA_SYSEX_ERROR      ; clear reply error
               00341         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
592A D734          M         bra     label
               00342         
592C 00343 TIA_SYSEX_Action_PRESET_WriteC
               00344         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM, ACCESS, TIA_SYSEX_Action_PRESET_WriteChk
592C B421          M         btfsc   reg, bit, reg_a
592E D00D          M         bra     label
               00345 
5930 EE07 F000 00346         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN                    ; init pointer to upload buffer
5934 CFA9 FFE9 00347         movff   EEADR, FSR0L
               00348 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 197


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00349         ;; store received byte in upload buffer
5938 5023      00350         movf    TIA_SYSEX_IN, W
593A 6EEF      00351         movwf   INDF0
               00352 
               00353         ;; add to checksum
593C 0B7F      00354         andlw   0x7f
593E 2624      00355         addwf   TIA_SYSEX_CHECKSUM, F
               00356         
               00357         ;; increment address
5940 2AA9      00358         incf    EEADR, F
               00359 
               00360         ;; if FSR0L is zero, go into WAIT_CHECKSUM state
5942 0E80      00361         movlw   0x80
5944 60A9      00362         cpfslt  EEADR, ACCESS
5946 8421      00363         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM
               00364 
               00365         ;; wait for next byte
               00366         rgoto   TIA_SYSEX_SysExCheck_End
5948 D725          M         bra     label
               00367 
594A 00368 TIA_SYSEX_Action_PRESET_WriteChk
               00369         ;; store received byte in checksum (using TIA_SYSEX_ADDRESS as store register)
594A C023 FFA9 00370         movff   TIA_SYSEX_IN, EEADR
               00371 
               00372         ;; wait for next byte
               00373         rgoto   TIA_SYSEX_SysExCheck_End
594E D722          M         bra     label
               00374 
5950 00375 TIA_SYSEX_End_PRESET_Write
               00376         ;; action invalid if checksum has not been received
               00377         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_WAIT_CHECKSUM, ACCESS, TIA_SYSEX_ActionInvalid
5950 A421          M         btfss   reg, bit, reg_a
5952 D72B          M         bra     label
               00378 
               00379         ;; calc final checksum
5954 5024      00380         movf    TIA_SYSEX_CHECKSUM, W
5956 0880      00381         sublw   0x80
5958 0B7F      00382         andlw   0x7f
               00383 
               00384         ;; compare with received checksum
595A 18A9      00385         xorwf   EEADR, W
               00386 
               00387         ;; if not equal jump to ActionInvalid
595C A4D8      00388         skpz
               00389         rgoto   TIA_SYSEX_End_PRESET_Write_Reply_ChksumErr
595E D01F          M         bra     label
               00390     
5960 5025      00391     movf        TIA_SYSEX_ADDRESS, W
5962 DA77      00392     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank
5964 6E26      00393     movwf   TIA_SYSEX_ERROR
5966 E123      00394     bnz     TIA_SYSEX_End_PRESET_Write_Reply
               00395     
5968 5012      00396     movf        TIA_PRESET, W
596A E00A      00397     bz      TIA_SYSEX_End_PRESET_Write_Cont    
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 198


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
596C 5011      00398     movf    TIA_BANK, W
596E EC41 F020 00399     call    TIA_BANK_GetBankStickReady
5972 B4D8      00400     skpnz
               00401         rgoto   TIA_SYSEX_End_PRESET_Write_Reply_NotReady
5974 D017          M         bra     label
               00402      
5976 EC4E F020 00403     call    TIA_BANK_GetBankStickSize
597A E102      00404     bnz     TIA_SYSEX_End_PRESET_Write_Cont
               00405 
597C BC12      00406     btfsc       TIA_PRESET, 6
               00407     rgoto       TIA_SYSEX_End_PRESET_Write_Reply_32k
597E D015          M         bra     label
               00408 
5980 00409 TIA_SYSEX_End_PRESET_Write_Cont
               00410         ;; write buffer to EEPROM
5980 EE17 F000 00411         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN    ; init pointer to upload buffer
5984 0E00      00412     movlw   EEPROM_PATCH & 0xff
5986 6EA9      00413         movwf   EEADR
5988 0E00      00414     movlw   (EEPROM_PATCH >> 8) & 0xff
598A 6EAA      00415     movwf   EEADRH
               00416         
598C 00417 TIA_SYSEX_End_PRESET_WritePages
598C 0004      00418         clrwdt                  ; feed watchdog
598E ECBB F01F 00419         call    TIA_BANK_WritePage      ; write a 64 bytes page to EEPROM
               00420         ;; increment FSR1 by 0x40
5992 0E40      00421         movlw   0x40
5994 26E1      00422         addwf   FSR1L, F
5996 0004      00423         clrwdt                  ; feed watchdog
5998 ECBB F01F 00424     call        TIA_BANK_WritePage      ; write a 64 bytes page to EEPROM
               00425     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
599C D008          M         bra     label
               00426     ;; to do... bank num in command and set patch/kit/WT +init if BANK==xBANK/ PRESET==xPRESET
               00427 
599E 00428 TIA_SYSEX_End_PRESET_Write_Reply_ChksumErr
               00429     ;; CheckSum Error #5
599E 0E05      00430     movlw   0x05
59A0 6E26      00431     movwf   TIA_SYSEX_ERROR
               00432     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
59A2 D005          M         bra     label
               00433     
59A4 00434 TIA_SYSEX_End_PRESET_Write_Reply_NotReady
               00435     ;; BS not ready Error #3
59A4 0E03      00436     movlw   0x03
59A6 6E26      00437     movwf   TIA_SYSEX_ERROR
               00438     rgoto   TIA_SYSEX_End_PRESET_Write_Reply
59A8 D002          M         bra     label
               00439 
59AA 00440 TIA_SYSEX_End_PRESET_Write_Reply_32k
               00441     ;; BS 32k 64 presets max Error #4
59AA 0E04      00442     movlw   0x04
59AC 6E26      00443     movwf   TIA_SYSEX_ERROR
               00444     ;;rgoto   TIA_SYSEX_End_PRESET_Write_Reply
               00445         
59AE 00446 TIA_SYSEX_End_PRESET_Write_Reply
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 199


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00447         ;; send SysEx header
59AE DA1E      00448         rcall   TIA_SYSEX_Send_SysExHeader
               00449 
               00450         ;; Send PRESET_Write ID
59B0 0E02      00451         movlw   0x02
59B2 EC24 F016 00452         call    MIOS_MIDI_TxBufferPut
               00453 
               00454         ;; send requested preset type number
59B6 DA69      00455     rcall   TIA_SYSEX_Hlp_GetRelativeBank
59B8 0B7F      00456     andlw   0x7f
59BA EC24 F016 00457         call    MIOS_MIDI_TxBufferPut
               00458     
               00459         ;; send requested bank number
59BE 5011      00460         movf    TIA_BANK, W
59C0 0B1F      00461     andlw   0x1f
59C2 EC24 F016 00462         call    MIOS_MIDI_TxBufferPut
               00463     
               00464         ;; send requested preset number
59C6 5012      00465         movf    TIA_PRESET, W
59C8 0B7F      00466     andlw   0x7f
59CA EC24 F016 00467         call    MIOS_MIDI_TxBufferPut
               00468 
               00469         ;; send error status
59CE 5026      00470     movf    TIA_SYSEX_ERROR, W
59D0 0B7F      00471     andlw   0x7f
59D2 EC24 F016 00472         call    MIOS_MIDI_TxBufferPut
               00473 
               00474         ;; send of SysEx footer
59D6 0E01      00475         movlw   0x01            ; (independend from merger state)
59D8 DA1C      00476         rcall   TIA_SYSEX_Send_SysExFooter
               00477 
               00478         ;; finish Action
               00479         rgoto   TIA_SYSEX_ActionFinished
59DA D6E7          M         bra     label
               00480 
59DC 00481 TIA_SYSEX_End_PRESET_Write_STR
               00482         STRING  20, 0x00, "Patch A  1 uploaded "
59DC 1400 6150     M         da      ((length) << 8) | (pos), str
     6374 2068 
     2041 3120 
     7520 6C70 
     616F 6564 
     2064      
               00483 
               00484 ;; --------------------------------------------------------------------------
               00485 ;;  MIDI Action: All Patch Read
               00486 ;; --------------------------------------------------------------------------
59F2 00487 TIA_SYSEX_Init_BANK_Read
               00488         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
59F2 8010      00489         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
59F4 EC59 F023 00490     call    TIA_TUNE_Note_Off
59F8 0012      00491         return
               00492 
59FA 00493 TIA_SYSEX_Action_BANK_Read
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 200


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00494         ;; receive <type> <bank> F7
59FA 00495 TIA_SYSEX_Action_BANK_Read_T
               00496         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_Read_B
59FA B621          M         btfsc   reg, bit, reg_a
59FC D004          M         bra     label
59FE 8621      00497         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
5A00 C023 F025 00498         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00499         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5A04 D6C7          M         bra     label
               00500 
5A06 00501 TIA_SYSEX_Action_BANK_Read_B    
               00502         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_ReadStall
5A06 B821          M         btfsc   reg, bit, reg_a
5A08 D004          M         bra     label
5A0A 8821      00503         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
5A0C C023 F011 00504         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00505         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5A10 D6C1          M         bra     label
               00506                 
5A12 00507 TIA_SYSEX_Action_BANK_ReadStall
               00508         ;; do nothing until sysex footer (F7) has been received
               00509         rgoto   TIA_SYSEX_SysExCheck_End
5A12 D6C0          M         bra     label
               00510 
5A14 00511 TIA_SYSEX_End_BANK_Read
               00512         ;; action invalid if patch number has not been received
               00513         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5A14 A821          M         btfss   reg, bit, reg_a
5A16 D6C9          M         bra     label
               00514     
5A18 C011 F007 00515     movff   TIA_BANK, TMP2  ;; store relative bank
5A1C 5025      00516     movf        TIA_SYSEX_ADDRESS, W
5A1E DA19      00517     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank   ; set bank to absolute
5A20 6E26      00518     movwf   TIA_SYSEX_ERROR
5A22 E10A      00519     bnz     TIA_SYSEX_End_BANK_Read_Cont
               00520     
5A24 5012      00521     movf        TIA_PRESET, W
5A26 E008      00522     bz      TIA_SYSEX_End_BANK_Read_Cont    
5A28 5011      00523     movf    TIA_BANK, W
5A2A EC41 F020 00524     call    TIA_BANK_GetBankStickReady
5A2E A4D8      00525     skpz
               00526         rgoto   TIA_SYSEX_End_BANK_Read_Cont
5A30 D003          M         bra     label
               00527     ;; BS not ready Error #3
5A32 0E03      00528     movlw   0x03
5A34 6E26      00529     movwf   TIA_SYSEX_ERROR
               00530     rgoto   TIA_SYSEX_End_BANK_Read_Cont
5A36 D000          M         bra     label
               00531 
5A38 00532 TIA_SYSEX_End_BANK_Read_Cont
               00533 
               00534         ;; send SysEx header
5A38 D9D9      00535         rcall   TIA_SYSEX_Send_SysExHeader
               00536 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 201


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00537         ;; send PTCHES_Write ID
5A3A 0E03      00538         movlw   0x03
5A3C EC24 F016 00539         call    MIOS_MIDI_TxBufferPut
               00540     
               00541         ;; send requested preset type number
5A40 5025      00542     movf        TIA_SYSEX_ADDRESS, W
5A42 0B7F      00543     andlw   0x7f
5A44 EC24 F016 00544         call    MIOS_MIDI_TxBufferPut
               00545     
               00546         ;; send requested bank number
5A48 5007      00547         movf    TMP2, W
5A4A 0B1F      00548     andlw   0x1f
5A4C EC24 F016 00549         call    MIOS_MIDI_TxBufferPut
               00550 
               00551     ;movf       TIA_SYSEX_ADDRESS, W
               00552     ;rcall   TIA_SYSEX_Hlp_GetAbsoluteBank   ; set bank to absolute    
5A50 5011      00553     movf    TIA_BANK, W
5A52 EC41 F020 00554     call    TIA_BANK_GetBankStickReady
               00555         ;; send requested bank size
5A56 EC4E F020 00556     call    TIA_BANK_GetBankStickSize
5A5A EC24 F016 00557         call    MIOS_MIDI_TxBufferPut
               00558     
5A5E 5026      00559     movf    TIA_SYSEX_ERROR, W
5A60 E004      00560     bz      TIA_SYSEX_End_BANK_Read_Cont_Ok
5A62 0B7F      00561     andlw       0x7f
5A64 EC24 F016 00562         call    MIOS_MIDI_TxBufferPut
               00563     rgoto   TIA_SYSEX_End_BANK_Read_Footer
5A68 D026          M         bra     label
               00564     
5A6A 00565 TIA_SYSEX_End_BANK_Read_Cont_Ok 
               00566 
               00567         ;; clear checksum
5A6A 6A24      00568         clrf    TIA_SYSEX_CHECKSUM
               00569 
               00570 #if 1    
               00571     ;; send bank informations 
5A6C EC26 F020 00572         call    TIA_BANK_SetBankStickAddressMagic
5A70 00573 TIA_SYSEX_End_BANK_Read_Cont_Name_Loop
5A70 ECB8 F016 00574         call    MIOS_BANKSTICK_Read             ; read content, inc MIOS_PARAMETER12
5A74 6EF5      00575         movwf   TABLAT              ; store data in TABLAT
               00576     
5A76 5003      00577     movf    MIOS_PARAMETER1, W
5A78 0BF0      00578     andlw   0xf0
5A7A 0A10      00579     xorlw   0x10
5A7C E104      00580     bnz     TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
5A7E 0E20      00581         movlw   0x20
5A80 60F5      00582         cpfslt  TABLAT, ACCESS      ; ensure that patch name doesn't contain characters < 0x20
               00583     rgoto   TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
5A82 D001          M         bra     label
5A84 6EF5      00584         movwf   TABLAT
5A86 00585 TIA_SYSEX_End_BANK_Read_Cont_Name_Jump
5A86 50F5      00586     movf    TABLAT, W
5A88 0B7F      00587     andlw   0x7f
5A8A 2624      00588         addwf   TIA_SYSEX_CHECKSUM, F
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 202


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5A8C EC24 F016 00589         call    MIOS_MIDI_TxBufferPut
5A90 AE03      00590     btfss   MIOS_PARAMETER1, 7            ; until == 0x20 send 16 bytes
               00591     rgoto   TIA_SYSEX_End_BANK_Read_Cont_Name_Loop
5A92 D7EE          M         bra     label
               00592 
               00593         ;; 127 patches to send(1-127), TIA_PRESET used as counter
5A94 0E01      00594     movlw   0x01
5A96 6E12      00595     movwf   TIA_PRESET
               00596 #else
               00597     
               00598         ;; 128 patches to send, TIA_PRESET used as counter
               00599     clrf        TIA_PRESET
               00600 #endif    
               00601     
5A98 00602 TIA_SYSEX_End_BANK_Read_OL      ; outer loop
5A98 0004      00603         clrwdt                      ; feed the watchdog
5A9A D9C6      00604         rcall   TIA_SYSEX_Hlp_SendPreset        ; send 128 bytes
               00605 
5A9C 2A12      00606         incf    TIA_PRESET, F       ; loop 64/128 times depends on BS Size
5A9E EC4E F020 00607     call    TIA_BANK_GetBankStickSize
5AA2 0E7F      00608         movlw   128-1
5AA4 B4D8      00609         skpnz
5AA6 0E3F      00610         movlw   64-1
5AA8 6412      00611         cpfsgt  TIA_PRESET, ACCESS
               00612         rgoto TIA_SYSEX_End_BANK_Read_OL
5AAA D7F6          M         bra     label
               00613 
               00614         ;; send checksum
5AAC 5024      00615         movf    TIA_SYSEX_CHECKSUM, W
5AAE 0880      00616         sublw   0x80
5AB0 0B7F      00617         andlw   0x7f
5AB2 EC24 F016 00618         call    MIOS_MIDI_TxBufferPut
               00619 
5AB6 00620 TIA_SYSEX_End_BANK_Read_Footer
               00621         ;; send of SysEx footer
5AB6 0E01      00622         movlw   0x01            ; (independend from merger state)
5AB8 D9AC      00623         rcall   TIA_SYSEX_Send_SysExFooter
               00624 
               00625         ;; finish Action
               00626         rgoto   TIA_SYSEX_ActionFinished
5ABA D677          M         bra     label
               00627 
               00628 
               00629 ;; --------------------------------------------------------------------------
               00630 ;;  MIDI Action: Bank Write Name
               00631 ;; --------------------------------------------------------------------------
5ABC 00632 TIA_SYSEX_Init_BANK_WriteName
               00633         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
               00634         ;;bsf   TIA_STAT, TIA_STAT_ENGINE_DISABLE
5ABC 0012      00635         return
               00636 
5ABE 00637 TIA_SYSEX_Action_BANK_WriteName
               00638         ;; receive <type> <bank> <16 bytes> F7
5ABE 00639 TIA_SYSEX_Action_BANK_WriteNameT
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 203


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00640         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_WriteNameB
5ABE B621          M         btfsc   reg, bit, reg_a
5AC0 D004          M         bra     label
5AC2 8621      00641         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_TYPE_RECEIVED
5AC4 C023 F025 00642         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS         ; load preset type
               00643         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5AC8 D665          M         bra     label
               00644 
5ACA 00645 TIA_SYSEX_Action_BANK_WriteNameB
               00646         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED, ACCESS, TIA_SYSEX_Action_BANK_WriteNameC
5ACA B821          M         btfsc   reg, bit, reg_a
5ACC D006          M         bra     label
5ACE 8821      00647         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_BANK_RECEIVED
5AD0 C023 F011 00648         movff   TIA_SYSEX_IN, TIA_BANK          ; load bank
               00649     
5AD4 6AA9      00650         clrf    EEADR                       ; clear address
5AD6 6A26      00651     clrf    TIA_SYSEX_ERROR             ; clear reply error
               00652         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byt
5AD8 D65D          M         bra     label
               00653         
5ADA 00654 TIA_SYSEX_Action_BANK_WriteNameC
5ADA EE07 F000 00655         lfsr    FSR0, BANKSTICK_FORMAT_BEGIN                    ; init pointer to upload buffer
5ADE CFA9 FFE9 00656         movff   EEADR, FSR0L
               00657 
               00658         ;; store received byte in upload buffer
5AE2 5023      00659         movf    TIA_SYSEX_IN, W
5AE4 6EEF      00660         movwf   INDF0
               00661 
               00662         ;; increment address
5AE6 2AA9      00663         incf    EEADR, F
               00664 
               00665         ;; if FSR0L is zero, go into WAIT_CHECKSUM state
5AE8 0E10      00666         movlw   0x10
5AEA 60A9      00667         cpfslt  EEADR, ACCESS
5AEC 8A21      00668     bsf TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED
               00669     
               00670         ;; wait for next byte
               00671         rgoto   TIA_SYSEX_SysExCheck_End
5AEE D652          M         bra     label
               00672 
5AF0 00673 TIA_SYSEX_End_BANK_WriteName
               00674         ;; action invalid if checksum has not been received
               00675         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_PRESET_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5AF0 AA21          M         btfss   reg, bit, reg_a
5AF2 D65B          M         bra     label
               00676 
5AF4 5025      00677     movf        TIA_SYSEX_ADDRESS, W
5AF6 D9AD      00678     rcall   TIA_SYSEX_Hlp_GetAbsoluteBank
5AF8 6E26      00679     movwf   TIA_SYSEX_ERROR
5AFA E11D      00680     bnz     TIA_SYSEX_End_BANK_WriteName_Reply
               00681   
5AFC 5011      00682     movf    TIA_BANK, W
5AFE EC41 F020 00683     call    TIA_BANK_GetBankStickReady
5B02 B4D8      00684     skpnz
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 204


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00685         rgoto   TIA_SYSEX_End_BANK_WriteName_Reply_NotReady
5B04 D015          M         bra     label
               00686 
5B06 00687 TIA_SYSEX_End_BANK_WriteName_Cont
5B06 EE17 F000 00688         lfsr    FSR1, BANKSTICK_FORMAT_BEGIN    ; init pointer to upload buffer
               00689     ;; add name offset to MP1 start @0x10
5B0A EC26 F020 00690         call    TIA_BANK_SetBankStickAddressMagic  
5B0E 0E10      00691     movlw   0x10
5B10 2603      00692     addwf   MIOS_PARAMETER1, F
               00693     
5B12 00694 TIA_SYSEX_End_BANK_WriteName_Loop 
5B12 0004      00695         clrwdt                  ; feed watchdog
5B14 0E20      00696         movlw   0x20
5B16 61E7      00697         cpfslt  INDF1, BANKED      ; ensure that patch name doesn't contain characters < 0x20
5B18 6EE7      00698     movwf   INDF1
5B1A 00699 TIA_SYSEX_End_BANK_WriteName_Loop_Jump 
5B1A 50E6      00700     movf    POSTINC1, W
5B1C ECBA F016 00701         call    MIOS_BANKSTICK_Write     ; write byte to EEPROM
5B20 E104      00702     bnz     TIA_SYSEX_End_BANK_WriteName_Reply_WError
               00703 
               00704     ;; if FSR0L is zero, go into WAIT_CHECKSUM state
5B22 0E20      00705         movlw   0x20
5B24 6003      00706         cpfslt  MIOS_PARAMETER1, ACCESS
               00707     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply
5B26 D007          M         bra     label
               00708     rgoto   TIA_SYSEX_End_BANK_WriteName_Loop
5B28 D7F4          M         bra     label
               00709 
5B2A 00710 TIA_SYSEX_End_BANK_WriteName_Reply_WError
               00711     ;; BS write byte Error #8
5B2A 0E08      00712     movlw   0x08
5B2C 6E26      00713     movwf   TIA_SYSEX_ERROR
               00714     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply       
5B2E D003          M         bra     label
               00715 
5B30 00716 TIA_SYSEX_End_BANK_WriteName_Reply_NotReady
               00717     ;; BS not ready Error #3
5B30 0E03      00718     movlw   0x03
5B32 6E26      00719     movwf   TIA_SYSEX_ERROR
               00720     rgoto   TIA_SYSEX_End_BANK_WriteName_Reply
5B34 D000          M         bra     label
               00721         
5B36 00722 TIA_SYSEX_End_BANK_WriteName_Reply
               00723         ;; send SysEx header
5B36 D95A      00724         rcall   TIA_SYSEX_Send_SysExHeader
               00725 
               00726         ;; Send PRESET_WriteName ID
5B38 0E04      00727         movlw   0x04
5B3A EC24 F016 00728         call    MIOS_MIDI_TxBufferPut
               00729 
               00730         ;; send requested preset type number
5B3E D9A5      00731     rcall   TIA_SYSEX_Hlp_GetRelativeBank
5B40 0B7F      00732     andlw   0x7f
5B42 EC24 F016 00733         call    MIOS_MIDI_TxBufferPut
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 205


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00734     
               00735         ;; send requested bank number
5B46 5011      00736         movf    TIA_BANK, W
5B48 0B1F      00737     andlw   0x1f
5B4A EC24 F016 00738         call    MIOS_MIDI_TxBufferPut
               00739 
               00740         ;; send error status
5B4E 5026      00741     movf    TIA_SYSEX_ERROR, W
5B50 0B7F      00742     andlw   0x7f
5B52 EC24 F016 00743         call    MIOS_MIDI_TxBufferPut
               00744 
               00745         ;; send of SysEx footer
5B56 0E01      00746         movlw   0x01            ; (independend from merger state)
5B58 D95C      00747         rcall   TIA_SYSEX_Send_SysExFooter
               00748 
               00749         ;; finish Action
               00750         rgoto   TIA_SYSEX_ActionFinished
5B5A D627          M         bra     label
               00751 
               00752 ;; --------------------------------------------------------------------------
               00753 ;;  MIDI Action: Parameter Read
               00754 ;; --------------------------------------------------------------------------
5B5C 00755 TIA_SYSEX_Init_PAR_Read
5B5C 0012      00756         return
               00757 
5B5E 00758 TIA_SYSEX_Action_PAR_Read
               00759         ;; receive <AH> <AL> F7
5B5E 00760 TIA_SYSEX_Action_PAR_ReadAH
               00761         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_ReadAL
5B5E BA21          M         btfsc   reg, bit, reg_a
5B60 D005          M         bra     label
5B62 8A21      00762         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED
5B64 6A25      00763         clrf    TIA_SYSEX_ADDRESS               ; clear register and set TIA_SYSEX_ADDRESS[7] if IN[0] is set
5B66 B023      00764         btfsc   TIA_SYSEX_IN, 0
5B68 8E25      00765         bsf     TIA_SYSEX_ADDRESS, 7
               00766         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5B6A D614          M         bra     label
               00767         
5B6C 00768 TIA_SYSEX_Action_PAR_ReadAL
               00769         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_ReadStall
5B6C B821          M         btfsc   reg, bit, reg_a
5B6E D005          M         bra     label
5B70 8821      00770         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED
5B72 5023      00771         movf    TIA_SYSEX_IN, W                 ; OR TIA_SYSEX_ADDRESS with low-byte
5B74 0B7F      00772         andlw   0x7f
5B76 1225      00773         iorwf   TIA_SYSEX_ADDRESS, F
               00774         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5B78 D60D          M         bra     label
               00775 
5B7A 00776 TIA_SYSEX_Action_PAR_ReadStall
               00777         ;; do nothing until sysex footer (F7) has been received
               00778         rgoto   TIA_SYSEX_SysExCheck_End
5B7A D60C          M         bra     label
               00779 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 206


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5B7C 00780 TIA_SYSEX_End_PAR_Read
               00781         ;; action invalid if low-byte of address has not been received
               00782         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5B7C A821          M         btfss   reg, bit, reg_a
5B7E D615          M         bra     label
               00783 
               00784         ;; send SysEx header
5B80 D935      00785         rcall   TIA_SYSEX_Send_SysExHeader
               00786 
               00787         ;; send PAR_Write ID
5B82 0E06      00788         movlw   0x06
5B84 EC24 F016 00789         call    MIOS_MIDI_TxBufferPut
               00790 
               00791         ;; send AH
5B88 0E00      00792         movlw   0x00
5B8A BE25      00793         btfsc   TIA_SYSEX_ADDRESS, 7
5B8C 0E01      00794         movlw 0x01
5B8E EC24 F016 00795         call    MIOS_MIDI_TxBufferPut
               00796 
               00797         ;; send AL
5B92 5025      00798         movf    TIA_SYSEX_ADDRESS, W
5B94 0B7F      00799         andlw   0x7f
5B96 EC24 F016 00800         call    MIOS_MIDI_TxBufferPut
               00801 
               00802         ;; get corresponding CC parameter from address
5B9A 5025      00803         movf    TIA_SYSEX_ADDRESS, W
5B9C ECDC F031 00804         call    TIA_SYSEX_TABLE_Get
               00805 
               00806         ;; branch if EEPROM value should be sent
               00807         BRA_IFSET WREG, 7, ACCESS, TIA_SYSEX_Action_PAR_Read_EE
5BA0 BEE8          M         btfsc   reg, bit, reg_a
5BA2 D003          M         bra     label
               00808 
5BA4 00809 TIA_SYSEX_Action_PAR_Read_RAM
               00810         ;; get CC value from RAM
5BA4 EC07 F031 00811         call    TIA_CCOUT_Get
               00812         rgoto   TIA_SYSEX_Action_PAR_Read_Cont
5BA8 D004          M         bra     label
5BAA 00813 TIA_SYSEX_Action_PAR_Read_EE
               00814         ;; read value from EEPROM
5BAA C025 FFA9 00815         movff   TIA_SYSEX_ADDRESS, EEADR
5BAE EC08 F020 00816         call    TIA_BANK_Read
5BB2 00817 TIA_SYSEX_Action_PAR_Read_Cont
               00818         ;; send value
5BB2 0B7F      00819         andlw   0x7f
5BB4 EC24 F016 00820         call    MIOS_MIDI_TxBufferPut
               00821         
               00822         ;; send of SysEx footer
5BB8 0E01      00823         movlw   0x01            ; (independend from merger state)
5BBA D92B      00824         rcall   TIA_SYSEX_Send_SysExFooter
               00825 
               00826         ;; finish Action
               00827         rgoto   TIA_SYSEX_ActionFinished
5BBC D5F6          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 207


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00828 
               00829 ;; --------------------------------------------------------------------------
               00830 ;;  MIDI Action: Parameter Write
               00831 ;; --------------------------------------------------------------------------
5BBE 00832 TIA_SYSEX_Init_PAR_Write
5BBE 0012      00833         return
               00834 
5BC0 00835 TIA_SYSEX_Action_PAR_Write
               00836         ;; receive <AH> <AL> <value> F7
5BC0 00837 TIA_SYSEX_Action_PAR_WriteAH
               00838         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteAL
5BC0 BA21          M         btfsc   reg, bit, reg_a
5BC2 D005          M         bra     label
5BC4 8A21      00839         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AH_RECEIVED
5BC6 6A25      00840         clrf    TIA_SYSEX_ADDRESS               ; clear register and set TIA_SYSEX_ADDRESS[7] if IN[0] is set
5BC8 B023      00841         btfsc   TIA_SYSEX_IN, 0
5BCA 8E25      00842         bsf     TIA_SYSEX_ADDRESS, 7
               00843         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5BCC D5E3          M         bra     label
               00844         
5BCE 00845 TIA_SYSEX_Action_PAR_WriteAL
               00846         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteD
5BCE B821          M         btfsc   reg, bit, reg_a
5BD0 D005          M         bra     label
5BD2 8821      00847         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_AL_RECEIVED
5BD4 5023      00848         movf    TIA_SYSEX_IN, W                 ; OR TIA_SYSEX_ADDRESS with low-byte
5BD6 0B7F      00849         andlw   0x7f
5BD8 1225      00850         iorwf   TIA_SYSEX_ADDRESS, F
               00851         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5BDA D5DC          M         bra     label
               00852 
5BDC 00853 TIA_SYSEX_Action_PAR_WriteD
               00854         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED, ACCESS, TIA_SYSEX_Action_PAR_WriteStall
5BDC B621          M         btfsc   reg, bit, reg_a
5BDE D004          M         bra     label
5BE0 8621      00855         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED     
5BE2 C023 F024 00856         movff   TIA_SYSEX_IN, TIA_SYSEX_CHECKSUM; store byte in TIA_SYSEX_CHECKSUM (used as write buffer here)
               00857         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5BE6 D5D6          M         bra     label
               00858 
5BE8 00859 TIA_SYSEX_Action_PAR_WriteStall
               00860         ;; do nothing until sysex footer (F7) has been received
               00861         rgoto   TIA_SYSEX_SysExCheck_End
5BE8 D5D5          M         bra     label
               00862 
5BEA 00863 TIA_SYSEX_End_PAR_Write
               00864         ;; action invalid if data has not been received
               00865         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_D_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5BEA A621          M         btfss   reg, bit, reg_a
5BEC D5DE          M         bra     label
               00866 
               00867         ;; get corresponding CC parameter from address
5BEE 5025      00868         movf    TIA_SYSEX_ADDRESS, W
5BF0 ECDC F031 00869         call    TIA_SYSEX_TABLE_Get
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 208


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5BF4 6E06      00870         movwf   TMP1
               00871 
               00872         ;; branch if value should be saved in EEPROM
               00873         BRA_IFSET TMP1, 7, ACCESS, TIA_SYSEX_Action_PAR_Write_EE
5BF6 BE06          M         btfsc   reg, bit, reg_a
5BF8 D005          M         bra     label
               00874 
5BFA 00875 TIA_SYSEX_Action_PAR_Write_RAM
               00876         ;; write CC value to RAM
5BFA C024 F003 00877         movff   TIA_SYSEX_CHECKSUM, MIOS_PARAMETER1 ; byte has been stored in _CHECKSUM
5BFE EC5C F02F 00878         call    TIA_CCIN_Set
               00879         rgoto   TIA_SYSEX_Action_PAR_Write_Cont
5C02 D00F          M         bra     label
5C04 00880 TIA_SYSEX_Action_PAR_Write_EE
               00881         ;; if split parameter, redirect to TIA_Vx_SPLIT_xxx
5C04 5006      00882         movf    TMP1, W
5C06 0BF0      00883         andlw   0xf0
5C08 0A90      00884         xorlw   0x90
5C0A E106      00885         bnz     TIA_SYSEX_Action_PAR_Write_EEC
5C0C 00886 TIA_SYSEX_Action_PAR_Write_EES
5C0C 5006      00887         movf    TMP1, W
5C0E EC73 F01F 00888         call    TIA_PATCH_GetSplitPointer
5C12 C024 FFE3 00889         movff   TIA_SYSEX_CHECKSUM, PLUSW1
               00890         rgoto   TIA_SYSEX_Action_PAR_Write_Cont
5C16 D005          M         bra     label
               00891 
5C18 00892 TIA_SYSEX_Action_PAR_Write_EEC
               00893         ;; write value to EEPROM
5C18 C025 FFA9 00894         movff   TIA_SYSEX_ADDRESS, EEADR
5C1C 5024      00895         movf    TIA_SYSEX_CHECKSUM, W; byte has been stored in _CHECKSUM
5C1E EC7E F01F 00896         call    TIA_BANK_Write
5C22 00897 TIA_SYSEX_Action_PAR_Write_Cont
               00898 
               00899         ;; send acknowledge
5C22 ECF0 F02E 00900         call    TIA_SYSEX_Send_Acknowledge
               00901 
               00902         ;; finish Action
               00903         rgoto   TIA_SYSEX_ActionFinished
5C26 D5C1          M         bra     label
               00904 
               00905 ;; --------------------------------------------------------------------------
               00906 ;;  MIDI Action: Switch Bank
               00907 ;; --------------------------------------------------------------------------
5C28 00908 TIA_SYSEX_Init_BANK_Sel
5C28 6A25      00909         clrf    TIA_SYSEX_ADDRESS
5C2A 0012      00910         return
               00911 
5C2C 00912 TIA_SYSEX_Action_BANK_Sel
               00913         ;; store bank in TIA_SYSEX_ADDRESS
5C2C C023 F025 00914         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS
               00915         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5C30 D5B1          M         bra     label
               00916 
5C32 00917 TIA_SYSEX_End_BANK_Sel
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 209


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00918         ;; check if BankStick available
5C32 0E0F      00919         movlw   0x0f
5C34 6025      00920         cpfslt  TIA_SYSEX_ADDRESS, ACCESS
               00921         rgoto TIA_SYSEX_End_BANK_SelInv
5C36 D008          M         bra     label
5C38 5025      00922         movf    TIA_SYSEX_ADDRESS, W
5C3A ECC6 F016 00923         call    MIOS_HLP_GetBitORMask
5C3E 141C      00924         andwf   TIA_BANKSTICK_STAT, W
5C40 E003      00925         bz      TIA_SYSEX_End_BANK_SelInv
               00926 
               00927         ;; change to bank immediately
5C42 C025 F014 00928         movff   TIA_SYSEX_ADDRESS, TIA_PBANK
5C46 D8EF      00929         rcall   TIA_SYSEX_ChangeMPatch
               00930 
               00931         ;;      rgoto   TIA_SYSEX_End_BANK_Cont
               00932 
               00933         ;; don't select new bankstick
5C48 00934 TIA_SYSEX_End_BANK_SelInv
               00935 
5C48 00936 TIA_SYSEX_End_BANK_Cont
               00937         ;; send acknowledge with bank number
5C48 D8D1      00938         rcall   TIA_SYSEX_Send_SysExHeader
               00939 
5C4A 0E0F      00940         movlw   0x0f            ; (acknowledge ID)
5C4C EC24 F016 00941         call    MIOS_MIDI_TxBufferPut
               00942 
5C50 5014      00943         movf    TIA_PBANK, W
5C52 EC24 F016 00944         call    MIOS_MIDI_TxBufferPut
               00945 
               00946         ;; send of SysEx footer
5C56 0E01      00947         movlw   0x01            ; (independend from merger state)
5C58 D8DC      00948         rcall   TIA_SYSEX_Send_SysExFooter
               00949 
               00950         ;; finish Action
               00951         rgoto   TIA_SYSEX_ActionFinished
5C5A D5A7          M         bra     label
               00952 
               00953 ;; --------------------------------------------------------------------------
               00954 ;;  MIDI Action: Configuration Write
               00955 ;; --------------------------------------------------------------------------
5C5C 00956 TIA_SYSEX_Init_CFG_Read
5C5C 0012      00957     return
5C5E 00958 TIA_SYSEX_Action_CFG_Read    
               00959         ;; send <A> <DH> <DL> F7
5C5E 00960 TIA_SYSEX_Action_CFG_ReadA
               00961         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_ReadStall
5C5E BA21          M         btfsc   reg, bit, reg_a
5C60 D004          M         bra     label
5C62 8A21      00962         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED
5C64 C023 F025 00963         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS ; store address in TIA_SYSEX_ADDRESS
               00964         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5C68 D595          M         bra     label
               00965 
5C6A 00966 TIA_SYSEX_Action_CFG_ReadStall
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 210


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00967         ;; do nothing until sysex footer (F7) has been received
               00968         rgoto   TIA_SYSEX_SysExCheck_End
5C6A D594          M         bra     label
               00969     
5C6C 00970 TIA_SYSEX_End_CFG_Read
               00971     ;; action invalid if low-byte of address has not been received
               00972         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5C6C AA21          M         btfss   reg, bit, reg_a
5C6E D59D          M         bra     label
5C70 00973 _TIA_SYSEX_End_CFG_Read
               00974         ;; send SysEx header
5C70 D8BD      00975         rcall   TIA_SYSEX_Send_SysExHeader
               00976 
               00977         ;; send CFG_Read ID
5C72 0E0C      00978         movlw   0x0c
5C74 EC24 F016 00979         call    MIOS_MIDI_TxBufferPut
               00980 
               00981         ;; send A
5C78 5025      00982         movf    TIA_SYSEX_ADDRESS, W
5C7A EC24 F016 00983         call    MIOS_MIDI_TxBufferPut
               00984     
               00985         ;; branch depending on current action ID
5C7E 5025      00986         movf    TIA_SYSEX_ADDRESS, W
               00987         JUMPTABLE_2BYTES 16     ; 16 entries
5C80 0FF0          M         addlw   -(max_value)    ; ensure that jump index is not greater than (max_value-1)
5C82 B0D8          M         skpnc
5C84 0EF0          M         movlw   -(max_value)
5C86 0F10          M         addlw   max_value
5C88 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00988         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
5C8C D00F          M         bra     label
               00989         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
5C8E D00E          M         bra     label
               00990         rgoto   TIA_SYSEX_End_CFG_Read_EEPROM
5C90 D00D          M         bra     label
               00991         rgoto   TIA_SYSEX_End_CFG_Read_Bank
5C92 D01D          M         bra     label
               00992         rgoto   TIA_SYSEX_End_CFG_Read_Patch
5C94 D02F          M         bra     label
               00993         rgoto   TIA_SYSEX_End_CFG_Read_BSInfo
5C96 D052          M         bra     label
               00994         rgoto   TIA_SYSEX_End_CFG_Read_All
5C98 D031          M         bra     label
               00995         rgoto   TIA_SYSEX_End_CFG_Read_All
5C9A D030          M         bra     label
               00996         rgoto   TIA_SYSEX_End_CFG_Read_All
5C9C D02F          M         bra     label
               00997         rgoto   TIA_SYSEX_End_CFG_Read_All
5C9E D02E          M         bra     label
               00998         rgoto   TIA_SYSEX_End_CFG_Read_All
5CA0 D02D          M         bra     label
               00999         rgoto   TIA_SYSEX_End_CFG_Read_All
5CA2 D02C          M         bra     label
               01000         rgoto   TIA_SYSEX_End_CFG_Read_All
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 211


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5CA4 D02B          M         bra     label
               01001         rgoto   TIA_SYSEX_End_CFG_Read_All
5CA6 D02A          M         bra     label
               01002         rgoto   TIA_SYSEX_End_CFG_Read_All
5CA8 D029          M         bra     label
               01003         rgoto   TIA_SYSEX_End_CFG_Read_All
5CAA D028          M         bra     label
               01004     
               01005     
               01006     ;BRA_IFSET TIA_SYSEX_ADDRESS, 2, ACCESS, TIA_SYSEX_End_CFG_Read_All
               01007     
5CAC 01008 TIA_SYSEX_End_CFG_Read_EEPROM    
               01009         ;; calc resulting EEADR
5CAC 5025      01010         movf    TIA_SYSEX_ADDRESS, W
5CAE 0B03      01011         andlw   0x03
5CB0 0F7C      01012         addlw   EEPROM_CFG_BASE & 0xff
5CB2 6EA9      01013         movwf   EEADR
               01014 
               01015         ;; read value from EEPROM
5CB4 ECB0 F016 01016         call    MIOS_EEPROM_Read
5CB8 6E24      01017         movwf   TIA_SYSEX_CHECKSUM      ; (value is stored in TIA_SYSEX_CHECKSUM)    
               01018     
               01019         ;; send DH
5CBA 0E00      01020         movlw   0x00
5CBC BE24      01021         btfsc   TIA_SYSEX_CHECKSUM, 7
5CBE 0E01      01022         movlw   0x01
5CC0 EC24 F016 01023         call    MIOS_MIDI_TxBufferPut
               01024 
               01025         ;; send DL
5CC4 5024      01026         movf    TIA_SYSEX_CHECKSUM, W
5CC6 0B7F      01027         andlw   0x7f
5CC8 EC24 F016 01028         call    MIOS_MIDI_TxBufferPut
               01029     rgoto   TIA_SYSEX_End_CFG_Read_Cont
5CCC D04C          M         bra     label
               01030     
5CCE 01031 TIA_SYSEX_End_CFG_Read_Bank   
               01032     ;; send current bank number
5CCE 5014      01033         movf    TIA_PBANK, W
5CD0 EC24 F016 01034         call    MIOS_MIDI_TxBufferPut
               01035 
               01036 #if 0    
               01037     ;; send bank type
               01038     call        TIA_BANK_SetBankStickAddressMagic
               01039     incf    MIOS_PARAMETER1, F
               01040     call        MIOS_BANKSTICK_Read
               01041     movwf   TIA_SYSEX_CHECKSUM
               01042     movlw   BANKSTICK_MAGIC1
               01043     subwf   TIA_SYSEX_CHECKSUM, W
               01044     andlw   0x7f
               01045         call    MIOS_MIDI_TxBufferPut  
               01046 #endif
               01047 
               01048     ;; send bank name    
5CD4 EC26 F020 01049     call        TIA_BANK_SetBankStickAddressMagic
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 212


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5CD8 0E10      01050     movlw   0x10
5CDA 2603      01051     addwf   MIOS_PARAMETER1, F
5CDC 01052 TIA_SYSEX_End_CFG_Read_Bank_NameLoop
5CDC ECB8 F016 01053     call        MIOS_BANKSTICK_Read
5CE0 6E24      01054     movwf   TIA_SYSEX_CHECKSUM
5CE2 0E20      01055     movlw   0x20
5CE4 6024      01056     cpfslt  TIA_SYSEX_CHECKSUM
5CE6 5024      01057     movf    TIA_SYSEX_CHECKSUM, W
5CE8 0B7F      01058     andlw   0x7f
5CEA EC24 F016 01059         call    MIOS_MIDI_TxBufferPut  
5CEE AA03      01060     btfss   MIOS_PARAMETER1, 5
               01061     rgoto   TIA_SYSEX_End_CFG_Read_Bank_NameLoop
5CF0 D7F5          M         bra     label
               01062     rgoto   TIA_SYSEX_End_CFG_Read_Cont
5CF2 D039          M         bra     label
               01063     
5CF4 01064 TIA_SYSEX_End_CFG_Read_Patch
               01065     ;; send current patch number
5CF4 5013      01066         movf    TIA_PATCH, W
5CF6 EC24 F016 01067         call    MIOS_MIDI_TxBufferPut
               01068     rgoto   TIA_SYSEX_End_CFG_Read_Cont
5CFA D035          M         bra     label
               01069     
               01070         
5CFC 01071 TIA_SYSEX_End_CFG_Read_All
               01072         ;; calc resulting EEADR
5CFC 0E7C      01073         movlw   EEPROM_CFG_BASE & 0xff
5CFE 6EA9      01074         movwf   EEADR
               01075 
               01076         ;; read value from EEPROM
5D00 ECB0 F016 01077         call    MIOS_EEPROM_Read
5D04 6E24      01078         movwf   TIA_SYSEX_CHECKSUM      ; (v2 ch is stored in TIA_SYSEX_CHECKSUM)    
               01079 
               01080         ;; send v2 ch
5D06 5024      01081         movf    TIA_SYSEX_CHECKSUM, W
5D08 EC24 F016 01082         call    MIOS_MIDI_TxBufferPut
               01083 
               01084         ;; read value from EEPROM
5D0C ECB0 F016 01085         call    MIOS_EEPROM_Read
5D10 6E24      01086         movwf   TIA_SYSEX_CHECKSUM      ; (v1 ch is stored in TIA_SYSEX_CHECKSUM)    
               01087 
               01088         ;; send v1 ch
5D12 5024      01089         movf    TIA_SYSEX_CHECKSUM, W
5D14 EC24 F016 01090         call    MIOS_MIDI_TxBufferPut
               01091 
               01092         ;; read value from EEPROM
5D18 ECB0 F016 01093         call    MIOS_EEPROM_Read
5D1C 6E24      01094         movwf   TIA_SYSEX_CHECKSUM      ; (v1 ch is stored in TIA_SYSEX_CHECKSUM) 
               01095         
               01096         ;; send DH/DL (device ID)
5D1E 0E00      01097         movlw   0x00
5D20 BE24      01098         btfsc   TIA_SYSEX_CHECKSUM, 7
5D22 0E01      01099         movlw   0x01
5D24 EC24 F016 01100         call    MIOS_MIDI_TxBufferPut
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 213


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5D28 5024      01101         movf    TIA_SYSEX_CHECKSUM, W
5D2A 0B7F      01102         andlw   0x7f
5D2C EC24 F016 01103         call    MIOS_MIDI_TxBufferPut
               01104      
               01105     ;; send current bank number
5D30 5014      01106         movf    TIA_PBANK, W
5D32 EC24 F016 01107         call    MIOS_MIDI_TxBufferPut
               01108     
               01109     ;; send current patch number
5D36 5013      01110         movf    TIA_PATCH, W
5D38 EC24 F016 01111         call    MIOS_MIDI_TxBufferPut
               01112     
               01113 
5D3C 01114 TIA_SYSEX_End_CFG_Read_BSInfo
               01115         ;; send DH/DL (bank status)
5D3C 0E00      01116         movlw   0x00
5D3E BE1B      01117         btfsc   TIA_BANKSTICK_RDY, 7
5D40 0E01      01118         movlw   0x01
5D42 EC24 F016 01119         call    MIOS_MIDI_TxBufferPut
5D46 501B      01120         movf    TIA_BANKSTICK_RDY, W
5D48 0B7F      01121         andlw   0x7f
5D4A EC24 F016 01122         call    MIOS_MIDI_TxBufferPut    
               01123 
               01124         ;; send DH/DL (bank size)
5D4E 0E00      01125         movlw   0x00
5D50 BE1D      01126         btfsc   TIA_BANKSTICK_SIZE, 7
5D52 0E01      01127         movlw   0x01
5D54 EC24 F016 01128         call    MIOS_MIDI_TxBufferPut
5D58 501D      01129         movf    TIA_BANKSTICK_SIZE, W
5D5A 0B7F      01130         andlw   0x7f
5D5C EC24 F016 01131         call    MIOS_MIDI_TxBufferPut 
               01132     
               01133     ;; send Kit/WT start Id
5D60 0E05      01134     movlw       DEFAULT_BS_KBANK_ID
5D62 EC24 F016 01135         call    MIOS_MIDI_TxBufferPut   
               01136             
               01137 
5D66 01138 TIA_SYSEX_End_CFG_Read_Cont  
               01139         ;; send of SysEx footer
5D66 0E01      01140         movlw   0x01            ; (independend from merger state)
5D68 D854      01141         rcall   TIA_SYSEX_Send_SysExFooter
               01142 
               01143         ;; finish Action
               01144         rgoto   TIA_SYSEX_ActionFinished
5D6A D51F          M         bra     label
               01145     
               01146 ;; --------------------------------------------------------------------------
               01147 ;;  MIDI Action: Configuration Write
               01148 ;; --------------------------------------------------------------------------
5D6C 01149 TIA_SYSEX_Init_CFG_Write
               01150         ;; disable TIA engine until end of transfer (will be requested by ActionFinished)
5D6C 8010      01151         bsf     TIA_STAT, TIA_STAT_ENGINE_DISABLE
5D6E 0012      01152         return
               01153 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 214


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5D70 01154 TIA_SYSEX_Action_CFG_Write
               01155         ;; receive <A> <DH> <DL> F7
5D70 01156 TIA_SYSEX_Action_CFG_WriteA
               01157         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteDH
5D70 BA21          M         btfsc   reg, bit, reg_a
5D72 D004          M         bra     label
5D74 8A21      01158         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_A_RECEIVED
5D76 C023 F025 01159         movff   TIA_SYSEX_IN, TIA_SYSEX_ADDRESS ; store address in TIA_SYSEX_ADDRESS
               01160         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5D7A D50C          M         bra     label
               01161         
5D7C 01162 TIA_SYSEX_Action_CFG_WriteDH
               01163         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteDL
5D7C B821          M         btfsc   reg, bit, reg_a
5D7E D005          M         bra     label
5D80 8821      01164         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_DH_RECEIVED
5D82 3823      01165         swapf   TIA_SYSEX_IN, W                 ; store high-nibble in TIA_SYSEX_CHECKSUM (used as data buffer here)
5D84 0BF0      01166         andlw   0xf0
5D86 6E24      01167         movwf   TIA_SYSEX_CHECKSUM
               01168         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5D88 D505          M         bra     label
               01169 
5D8A 01170 TIA_SYSEX_Action_CFG_WriteDL
               01171         BRA_IFSET TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED, ACCESS, TIA_SYSEX_Action_CFG_WriteStall
5D8A B621          M         btfsc   reg, bit, reg_a
5D8C D004          M         bra     label
5D8E 8621      01172         bsf     TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED
5D90 5023      01173         movf    TIA_SYSEX_IN, W                 ; store low-nibble in TIA_SYSEX_CHECKSUM (used as data buffer here)
5D92 1224      01174         iorwf   TIA_SYSEX_CHECKSUM, F
               01175         rgoto   TIA_SYSEX_SysExCheck_End        ; wait for next byte
5D94 D4FF          M         bra     label
               01176 
5D96 01177 TIA_SYSEX_Action_CFG_WriteStall
               01178         ;; do nothing until sysex footer (F7) has been received
               01179         rgoto   TIA_SYSEX_SysExCheck_End
5D96 D4FE          M         bra     label
               01180 
5D98 01181 TIA_SYSEX_End_CFG_Write
               01182         ;; action invalid if data has not been received
               01183         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_DL_RECEIVED, ACCESS, TIA_SYSEX_ActionInvalid
5D98 A621          M         btfss   reg, bit, reg_a
5D9A D507          M         bra     label
               01184 
               01185         ;; calc resulting EEADR
5D9C 5025      01186         movf    TIA_SYSEX_ADDRESS, W
5D9E 0B03      01187         andlw   0x03
5DA0 0F7C      01188         addlw   EEPROM_CFG_BASE & 0xff
5DA2 6EA9      01189         movwf   EEADR
               01190 
               01191         ;; write value to EEPROM
5DA4 5024      01192         movf    TIA_SYSEX_CHECKSUM, W   ; (value has been stored in TIA_SYSEX_CHECKSUM)
5DA6 ECB2 F016 01193         call    MIOS_EEPROM_Write
               01194         
               01195         ;; send response
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 215


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5DAA D820      01196         rcall   TIA_SYSEX_Send_SysExHeader
               01197 
               01198         ;; send CFG_Write ID
5DAC 0E0D      01199         movlw   0x0d
5DAE EC24 F016 01200         call    MIOS_MIDI_TxBufferPut
               01201 
               01202         ;; send A
5DB2 5025      01203         movf    TIA_SYSEX_ADDRESS, W
5DB4 EC24 F016 01204         call    MIOS_MIDI_TxBufferPut
               01205 
               01206         ;; send DH
5DB8 0E00      01207         movlw   0x00
5DBA BE24      01208         btfsc   TIA_SYSEX_CHECKSUM, 7
5DBC 0E01      01209         movlw   0x01
5DBE EC24 F016 01210         call    MIOS_MIDI_TxBufferPut
               01211 
               01212         ;; send DL
5DC2 5024      01213         movf    TIA_SYSEX_CHECKSUM, W
5DC4 0B7F      01214         andlw   0x7f
5DC6 EC24 F016 01215         call    MIOS_MIDI_TxBufferPut
               01216             
               01217         ;; send of SysEx footer
5DCA 0E01      01218         movlw   0x01            ; (independent from merger state)
               01219         rgoto   TIA_SYSEX_Send_SysExFooter
5DCC D022          M         bra     label
               01220 
               01221         ;; finish Action
               01222         rgoto   TIA_SYSEX_ActionFinished
5DCE D4ED          M         bra     label
               01223 
               01224 ;; --------------------------------------------------------------------------
               01225 ;;  MIDI Action: CC Request
               01226 ;; --------------------------------------------------------------------------
5DD0 01227 TIA_SYSEX_Init_RequestCC
5DD0 0012      01228         return
               01229 
5DD2 01230 TIA_SYSEX_Action_RequestCC
               01231         ;; do nothing until sysex footer (F7) has been received
               01232         rgoto   TIA_SYSEX_SysExCheck_End
5DD2 D4E0          M         bra     label
               01233 
5DD4 01234 TIA_SYSEX_End_RequestCC
               01235         ;; request CC dump (handled by tia_ccout.inc)
5DD4 8410      01236         bsf     TIA_STAT, TIA_STAT_CC_DUMP_REQ
               01237 
               01238         ;; finish Action
               01239         rgoto   TIA_SYSEX_ActionFinished
5DD6 D4E9          M         bra     label
               01240 
               01241 
               01242 ;; --------------------------------------------------------------------------
               01243 ;;  MIDI Action: Ping
               01244 ;; --------------------------------------------------------------------------
5DD8 01245 TIA_SYSEX_Init_Ping
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 216


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5DD8 0012      01246         return
               01247 
5DDA 01248 TIA_SYSEX_Action_Ping
               01249         ;; do nothing until sysex footer (F7) has been received
               01250         rgoto   TIA_SYSEX_SysExCheck_End
5DDA D4DC          M         bra     label
               01251 
5DDC 01252 TIA_SYSEX_End_Ping
               01253         ;; send Acknowledge
5DDC D801      01254         rcall   TIA_SYSEX_Send_Acknowledge
               01255 
               01256         ;; finish Action
               01257         rgoto   TIA_SYSEX_ActionFinished
5DDE D4E5          M         bra     label
               01258 
               01259 
               01260 
               01261 ;; --------------------------------------------------------------------------
               01262 ;;  MIDI Send Acknowledge (Util function)
               01263 ;; --------------------------------------------------------------------------
5DE0 01264 TIA_SYSEX_Send_Acknowledge
5DE0 D805      01265         rcall   TIA_SYSEX_Send_SysExHeader
               01266 
5DE2 0E0F      01267         movlw   0x0f            ; (acknowledge ID)
5DE4 EC24 F016 01268         call    MIOS_MIDI_TxBufferPut
               01269 
               01270         ;; send of SysEx footer
5DE8 0E01      01271         movlw   0x01            ; (independend from merger state)
               01272         rgoto   TIA_SYSEX_Send_SysExFooter
5DEA D013          M         bra     label
               01273 
               01274 ;; --------------------------------------------------------------------------
               01275 ;;  Send TIA SysEx Header (Util function)
               01276 ;; --------------------------------------------------------------------------
5DEC 01277 TIA_SYSEX_Send_SysExHeader
               01278         ;; if TIA_SYSEX_SYXSTATE > 0, check merger flag to allow propper sysex merging
               01279         BRA_IFCLR TIA_SYSEX_STATE, TIA_SYSEX_STATE_MYSYSEX, ACCESS, TIA_SYSEX_Send_SysExHeader_Skp
5DEC AE21          M         btfss   reg, bit, reg_a
5DEE D007          M         bra     label
5DF0 EC12 F016 01280         call    MIOS_MIDI_MergerGet
5DF4 0B01      01281         andlw   0x01
5DF6 E003      01282         bz      TIA_SYSEX_Send_SysExHeader_Skp
5DF8 0E05      01283         movlw   0x05            ; send only DEVICE_ID
5DFA 6E06      01284         movwf   TMP1
               01285         rgoto   TIA_SYSEX_Send_SysExHeaderLoop
5DFC D001          M         bra     label
5DFE 01286 TIA_SYSEX_Send_SysExHeader_Skp
               01287 
5DFE 6A06      01288         clrf    TMP1
5E00 01289 TIA_SYSEX_Send_SysExHeaderLoop
5E00 5006      01290         movf    TMP1, W
5E02 DCC9      01291         rcall   TIA_SYSEX_SysExHeaderGet
5E04 EC24 F016 01292         call    MIOS_MIDI_TxBufferPut
5E08 2A06      01293         incf    TMP1, F
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 217


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5E0A 0E06      01294         movlw   0x06
5E0C 6206      01295         cpfseq  TMP1, ACCESS
               01296         rgoto TIA_SYSEX_Send_SysExHeaderLoop
5E0E D7F8          M         bra     label
5E10 0012      01297         return
               01298 
               01299 ;; --------------------------------------------------------------------------
               01300 ;;  MIDI Send SysEx Footer (Util function)
               01301 ;; --------------------------------------------------------------------------
5E12 01302 TIA_SYSEX_Send_SysExFooter
               01303         ;; if WREG[0]=1: send F7 regardless of the merger state
               01304         BRA_IFSET WREG, 0, ACCESS, TIA_SYSEX_Send_SysExFooter_Force
5E12 B0E8          M         btfsc   reg, bit, reg_a
5E14 D005          M         bra     label
               01305         ;; send footer only if merger has been enabled
               01306         ;; to ensure a proper MIDI protocol
5E16 EC12 F016 01307         call    MIOS_MIDI_MergerGet
5E1A 0B01      01308         andlw   0x01
5E1C B4D8      01309         skpnz
5E1E 0012      01310         return
               01311 
5E20 01312 TIA_SYSEX_Send_SysExFooter_Force
5E20 0EF7      01313         movlw   0xf7
5E22 EF24 F016 01314         goto    MIOS_MIDI_TxBufferPut
               01315 
               01316 
               01317 ;; --------------------------------------------------------------------------
               01318 ;;  Changes the TIA Master patch
               01319 ;;  IN: patch number in TIA_PATCH
               01320 ;;      bank number in TIA_PBANK
               01321 ;; --------------------------------------------------------------------------
5E26 01322 TIA_SYSEX_ChangeMPatch
5E26 0012      01323         return
               01324 
               01325 
               01326 ;; --------------------------------------------------------------------------
               01327 ;;  Sends a patch
               01328 ;;  IN: patch number in TIA_PATCH
               01329 ;;      bank number in TIA_PBANK
               01330 ;;      TIA_SYSEX_CHECKSUM should be cleared if required
               01331 ;;  OUT: 256 bytes will be sent
               01332 ;;       checksum in TIA_SYSEX_CHECKSUM
               01333 ;; --------------------------------------------------------------------------
5E28 01334 TIA_SYSEX_Hlp_SendPreset
5E28 0E00      01335     movlw   (EEPROM_PATCH >> 8) & 0xff
5E2A 6EAA      01336     movwf   EEADRH
5E2C 6AA9      01337         clrf    EEADR                   ; 0x80 bytes to send, use EEADR as counter
               01338     ;;rgoto   TIA_SYSEX_Hlp_SendPresetLoop
5E2E 01339 TIA_SYSEX_Hlp_SendPresetLoop
5E2E EC08 F020 01340         call    TIA_BANK_Read   ; read patch content (EEADR will be incremented)
5E32 6EF5      01341         movwf   TABLAT          ; store data in TABLAT
               01342 
5E34 0E11      01343         movlw   0x10+1          ; ensure that patch name doesn't contain characters < 0x20
5E36 60A9      01344         cpfslt  EEADR, ACCESS
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 218


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               01345         rgoto TIA_SYSEX_Hlp_SendPresetLoop_NoN
5E38 D004          M         bra     label
5E3A 01346 TIA_SYSEX_Hlp_SendPresetLoop_N
5E3A 0E20      01347         movlw   0x20
5E3C 60F5      01348         cpfslt  TABLAT, ACCESS
               01349         rgoto TIA_SYSEX_Hlp_SendPresetLoop_NoN
5E3E D001          M         bra     label
5E40 6EF5      01350         movwf   TABLAT
5E42 01351 TIA_SYSEX_Hlp_SendPresetLoop_NoN
5E42 50F5      01352         movf    TABLAT, W
5E44 0B7F      01353         andlw   0x7f            ; add to checksum
5E46 2624      01354         addwf   TIA_SYSEX_CHECKSUM, F
               01355 
5E48 EC24 F016 01356         call    MIOS_MIDI_TxBufferPut; send byte
               01357 
5E4C AEA9      01358         btfss   EEADR, 7
               01359         rgoto   TIA_SYSEX_Hlp_SendPresetLoop    ; loop 128 times
5E4E D7EF          M         bra     label
               01360 
5E50 0012      01361         return
               01362     
               01363     
               01364     
               01365 ;; --------------------------------------------------------------------------
               01366 ;;  This function returns the absolute BANK # from relative xBANK #
               01367 ;;  IN: Relative Bank in TIA_BANK, preset type in WREG
               01368 ;;  OUT: Abslolute Bank in TIA_BANK, Error in WREG
               01369 ;; --------------------------------------------------------------------------
5E52 01370 TIA_SYSEX_Hlp_GetAbsoluteBank
5E52 6E06      01371     movwf   TMP1
               01372     BRA_IFCLR  TMP1, 0, ACCESS, TIA_SYSEX_Hlp_GetAbsoluteBank_P
5E54 A006          M         btfss   reg, bit, reg_a
5E56 D012          M         bra     label
5E58 01373 TIA_SYSEX_Hlp_GetAbsoluteBank_K
5E58 0E06      01374     movlw   16-(DEFAULT_BS_KBANK_ID*2)
5E5A 6011      01375     cpfslt  TIA_BANK, ACCESS
               01376     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_Err
5E5C D014          M         bra     label
5E5E 5011      01377     movf    TIA_BANK, W
5E60 0B06      01378     andlw   0x06
5E62 44E8      01379     rlncf   WREG, W
5E64 B011      01380     btfsc   TIA_BANK, 0
5E66 28E8      01381     incf    WREG, W
5E68 0F14      01382     addlw   DEFAULT_BS_KBANK_ID*4
               01383     BRA_IFSET  TMP1, 1, ACCESS, TIA_SYSEX_Hlp_GetAbsoluteBank_WT
5E6A B206          M         btfsc   reg, bit, reg_a
5E6C D003          M         bra     label
5E6E 6E11      01384     movwf   TIA_BANK
5E70 0E00      01385     movlw   0x00
               01386     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
5E72 D00A          M         bra     label
               01387     
5E74 01388 TIA_SYSEX_Hlp_GetAbsoluteBank_WT
5E74 0F02      01389     addlw   0x02
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 219


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5E76 6E11      01390     movwf   TIA_BANK   
5E78 0E00      01391     movlw   0x00
               01392     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
5E7A D006          M         bra     label
               01393     
5E7C 01394 TIA_SYSEX_Hlp_GetAbsoluteBank_P
               01395     ;; Saturate to max Patch banks (DEFAULT_BS_KBANK_ID*4-1)
5E7C 0E14      01396     movlw   DEFAULT_BS_KBANK_ID*4
5E7E 6011      01397     cpfslt  TIA_BANK, ACCESS
               01398     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_Err
5E80 D002          M         bra     label
5E82 0E00      01399     movlw   0x00
               01400     rgoto   TIA_SYSEX_Hlp_GetAbsoluteBank_End
5E84 D001          M         bra     label
               01401     
5E86 01402 TIA_SYSEX_Hlp_GetAbsoluteBank_Err
5E86 0E06      01403     movlw   0x06 ;; not valid xBANK
               01404     
5E88 01405 TIA_SYSEX_Hlp_GetAbsoluteBank_End
5E88 0012      01406         return
               01407 
               01408 ;; --------------------------------------------------------------------------
               01409 ;;  This function returns the absolute BANK # from relative xBANK #
               01410 ;;  IN:  Abslolute Bank in TIA_BANK
               01411 ;;  OUT: Relative Bank in TIA_BANK, preset type in WREG
               01412 ;; --------------------------------------------------------------------------
5E8A 01413 TIA_SYSEX_Hlp_GetRelativeBank
               01414     ;; Saturate to 32 absolute banks
5E8A 0E1F      01415     movlw   0x1f
5E8C 6011      01416     cpfslt  TIA_BANK, ACCESS
5E8E 6E11      01417     movwf   TIA_BANK
5E90 0E14      01418     movlw   DEFAULT_BS_KBANK_ID*4
5E92 5C11      01419     subwf   TIA_BANK, W
5E94 6E06      01420     movwf   TMP1
5E96 E702      01421     bnn     TIA_SYSEX_Hlp_GetRelativeBank_K
5E98 01422 TIA_SYSEX_Hlp_GetRelativeBank_P   
5E98 0E00      01423     movlw   0x00
               01424     rgoto   TIA_SYSEX_Hlp_GetRelativeBank_End
5E9A D00D          M         bra     label
5E9C 01425 TIA_SYSEX_Hlp_GetRelativeBank_K
               01426     BRA_IFSET  TMP1, 1, ACCESS, TIA_SYSEX_Hlp_GetRelativeBank_WT 
5E9C B206          M         btfsc   reg, bit, reg_a
5E9E D005          M         bra     label
5EA0 28E8      01427     incf    WREG, W
5EA2 40E8      01428     rrncf   WREG, W
5EA4 6E11      01429     movwf   TIA_BANK
5EA6 0E01      01430     movlw   0x01
               01431     rgoto   TIA_SYSEX_Hlp_GetRelativeBank_End
5EA8 D006          M         bra     label
5EAA 01432 TIA_SYSEX_Hlp_GetRelativeBank_WT
5EAA 04E8      01433     decf    WREG, W
5EAC BEE8      01434     btfsc   WREG, 7
5EAE 0E00      01435     movlw   0x00
5EB0 40E8      01436     rrncf   WREG, W
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 220


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5EB2 6E11      01437     movwf   TIA_BANK
5EB4 0E03      01438     movlw   0x03
5EB6 01439 TIA_SYSEX_Hlp_GetRelativeBank_End
5EB6 0012      01440         return
               00388 #include "tia_ccin.inc"
               00001 ; $Id: tia_ccin.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; CC Input Handling
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  IN: index of CC parameter in WREG, value in MIOS_PARAMETER1
               00016 ;; --------------------------------------------------------------------------
5EB8 00017 TIA_CCIN_Set
5EB8 D9EE      00018         rcall   TIA_CC_TABLE_Get        ; prepare a CC action
               00019         ;; now:
               00020         ;; value     is in MIOS_PARAMETER1
               00021         ;; command   is in MIOS_PARAMETER2
               00022         ;; parameter is in FSR1 (pointer)
               00023 
               00024         ;; branch depending on command
5EBA 5004      00025         movf    MIOS_PARAMETER2, W
5EBC 0B0F      00026         andlw   0x0f
               00027         JUMPTABLE_2BYTES_UNSECURE
5EBE ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00028         rgoto   TIA_CCIN_Cmd_NOP
5EC2 D00F          M         bra     label
               00029         rgoto   TIA_CCIN_Cmd_V12
5EC4 D00F          M         bra     label
               00030         rgoto   TIA_CCIN_Cmd_7BIT
5EC6 D014          M         bra     label
               00031         rgoto   TIA_CCIN_Cmd_7BIT_W_PORTA
5EC8 D022          M         bra     label
               00032         rgoto   TIA_CCIN_Cmd_7BIT_4L
5ECA D02A          M         bra     label
               00033         rgoto   TIA_CCIN_Cmd_7BIT_4U
5ECC D02F          M         bra     label
               00034         rgoto   TIA_CCIN_Cmd_SUSKEY
5ECE D042          M         bra     label
               00035         rgoto   TIA_CCIN_Cmd_VELOCITY
5ED0 D046          M         bra     label
               00036         rgoto   TIA_CCIN_Cmd_AFTERTOUCH
5ED2 D0B6          M         bra     label
               00037         rgoto   TIA_CCIN_Cmd_MODWHEEL
5ED4 D0ED          M         bra     label
               00038         rgoto   TIA_CCIN_Cmd_WAVEFORM
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 221


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5ED6 D127          M         bra     label
               00039     rgoto       TIA_CCIN_Cmd_NOP
5ED8 D004          M         bra     label
               00040         rgoto   TIA_CCIN_Cmd_NOP
5EDA D003          M         bra     label
               00041         rgoto   TIA_CCIN_Cmd_PLAY_MODE
5EDC D133          M         bra     label
               00042         rgoto   TIA_CCIN_Cmd_NOP
5EDE D001          M         bra     label
               00043         rgoto   TIA_CCIN_Cmd_NOP
5EE0 D000          M         bra     label
               00044 
               00045 ; ==========================================================================
               00046 
               00047 ;; --------------------------------------------------------------------------
5EE2 00048 TIA_CCIN_Cmd_NOP
               00049         ;; no jump to end, since no CS update is required
               00050         ;;      rgoto   TIA_CCIN_Cmd_End
5EE2 0012      00051         return
               00052 
               00053 ;; --------------------------------------------------------------------------
5EE4 00054 TIA_CCIN_Cmd_V12
5EE4 50E1      00055         movf    FSR1L, W                ; parameter contains first CC, save it
5EE6 6E05      00056         movwf   MIOS_PARAMETER3
5EE8 DFE7      00057         rcall   TIA_CCIN_Set            ; set first voice
5EEA 2A05      00058         incf    MIOS_PARAMETER3, F
5EEC 5005      00059         movf    MIOS_PARAMETER3, W
               00060         rgoto   TIA_CCIN_Set            ; set second voice
5EEE D7E4          M         bra     label
               00061 
               00062 ;; --------------------------------------------------------------------------
5EF0 00063 TIA_CCIN_Cmd_7BIT
               00064     ;; special treatment, GSA falling -> Gate falls
5EF0 0E24      00065         movlw   (TIA_V1_BASE + TIA_Vx_MODE) & 0xff  ;; V1 MODE register
5EF2 18E1      00066     xorwf   FSR1L, W
5EF4 E003      00067     bz      TIA_CCIN_Cmd_7BIT_GSA_Fall
5EF6 0E64      00068     movlw   (TIA_V2_BASE + TIA_Vx_MODE) & 0xff  ;; V2 MODE register
5EF8 18E1      00069     xorwf   FSR1L, W
5EFA E106      00070     bnz     TIA_CCIN_Cmd_7BIT_End
5EFC 00071 TIA_CCIN_Cmd_7BIT_GSA_Fall    ;; detect fall of GSA
5EFC B0E7      00072     btfsc   INDF1, Vx_MODE_GSA_ACTIVE
5EFE B003      00073     btfsc   MIOS_PARAMETER1, Vx_MODE_GSA_ACTIVE
5F00 D003      00074     bra     TIA_CCIN_Cmd_7BIT_End
               00075     ;; clear gate
5F02 06E1      00076     decf    FSR1L, F    ;; Vx STAT register
5F04 96E7      00077     bcf     INDF1, Vx_STAT_GATE_ACTIVE
5F06 2AE1      00078     incf    FSR1L, F    ;; Vx MODE register
5F08 00079 TIA_CCIN_Cmd_7BIT_End
               00080     ;; normal treatment
5F08 C003 FFE7 00081     movff       MIOS_PARAMETER1, INDF1
               00082     
               00083         rgoto   TIA_CCIN_Cmd_End
5F0C D163          M         bra     label
               00084     
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 222


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00085 ;; --------------------------------------------------------------------------
5F0E 00086 TIA_CCIN_Cmd_7BIT_W_PORTA
5F0E 9610      00087         bcf     TIA_STAT, TIA_STAT_SAVED_GIE    ; for nested IRQ disables
5F10 BEF2      00088         btfsc   INTCON, GIE
5F12 8610      00089         bsf     TIA_STAT, TIA_STAT_SAVED_GIE
               00090         IRQ_DISABLE
5F14 9EF2          M         bcf     INTCON, GIE
               00091 
               00092         ;; works only with TIA_Vx_TRANSPOSE,  _PITCHRANGE
5F16 C003 FFE7 00093         movff   MIOS_PARAMETER1, INDF1
               00094 
               00095 #if 0
               00096         ;; enable portamento if rate is > 0
               00097         ;; switch to TIA_Vx_PORTA_RATE
               00098         movf    FSR1L, W
               00099         andlw   0x03
               00100         iorlw   TIA_V1_PORTA_RATE & 0xfc
               00101         movwf   FSR1L
               00102         movf    INDF1, W
               00103         bz      TIA_CCIN_Cmd_7BIT_W_PORTA_End
               00104 
               00105         movf    FSR1L, W
               00106         andlw   0x03
               00107         iorlw   TIA_V1_MODE & 0xfc
               00108         movwf   FSR1L
               00109         bsf     INDF1, Vx_STAT_PORTA_ENABLE
               00110 #endif
               00111 
5F1A 00112 TIA_CCIN_Cmd_7BIT_W_PORTA_End
               00113         ;;      IRQ_ENABLE
5F1A B610      00114         btfsc   TIA_STAT, TIA_STAT_SAVED_GIE    ; nested IRQ enable
5F1C 8EF2      00115         bsf     INTCON, GIE
               00116         
               00117         rgoto   TIA_CCIN_Cmd_End
5F1E D15A          M         bra     label
               00118 
               00119 
               00120 ;; --------------------------------------------------------------------------
5F20 00121 TIA_CCIN_Cmd_7BIT_4L
5F20 0EF0      00122         movlw   0xf0
5F22 16E7      00123         andwf   INDF1, F
5F24 5003      00124         movf    MIOS_PARAMETER1, W
5F26 0B0F      00125         andlw   0x0f
5F28 12E7      00126         iorwf   INDF1, F
               00127         rgoto   TIA_CCIN_Cmd_End
5F2A D154          M         bra     label
               00128 
               00129 ;; --------------------------------------------------------------------------
5F2C 00130 TIA_CCIN_Cmd_7BIT_4U
5F2C 0E0F      00131         movlw   0x0f
5F2E 16E7      00132         andwf   INDF1, F
5F30 3803      00133         swapf   MIOS_PARAMETER1, W
5F32 0BF0      00134         andlw   0xf0
5F34 12E7      00135         iorwf   INDF1, F
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 223


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00136         rgoto   TIA_CCIN_Cmd_End
5F36 D14E          M         bra     label
               00137 
               00138 ;; --------------------------------------------------------------------------
5F38 00139 TIA_CCIN_Cmd_7BIT_TO_7_4
5F38 0E0F      00140         movlw   0x0f
5F3A 16E7      00141         andwf   INDF1, F
5F3C 3403      00142         rlf     MIOS_PARAMETER1, W
5F3E 0BF0      00143         andlw   0xf0
5F40 12E7      00144         iorwf   INDF1, F
               00145         rgoto   TIA_CCIN_Cmd_End
5F42 D148          M         bra     label
               00146 
               00147 ;; --------------------------------------------------------------------------
5F44 00148 TIA_CCIN_Cmd_7BIT_TO_3_0
5F44 0EF0      00149         movlw   0xf0
5F46 16E7      00150         andwf   INDF1, F
5F48 3003      00151         rrf     MIOS_PARAMETER1, W
5F4A 32E8      00152         rrf     WREG, F
5F4C 30E8      00153         rrf     WREG, W
5F4E 0B0F      00154         andlw   0x0f
5F50 12E7      00155         iorwf   INDF1, F
               00156         rgoto   TIA_CCIN_Cmd_End
5F52 D140          M         bra     label
               00157 
               00158 ;; --------------------------------------------------------------------------
5F54 00159 TIA_CCIN_Cmd_SUSKEY
5F54 930C      00160         bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
5F56 5003      00161         movf    MIOS_PARAMETER1, W
5F58 A4D8      00162         skpz
5F5A 830C      00163         bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
               00164 
               00165         ;rrf    MIOS_PARAMETER1, W
               00166         ;andlw  0x3f
               00167         ;movwf  TIA_KEYTRACKING, BANKED
               00168 
               00169         rgoto   TIA_CCIN_Cmd_End
5F5C D13B          M         bra     label
               00170 
               00171 ; ==========================================================================
               00172 
               00173         ;; ------------------------------------------------------------------
               00174         ;; Controller Handler Macro
               00175         ;; ------------------------------------------------------------------
               00176 TIA_CCIN_SETHLP_MACRO_DO_CTRL MACRO BASE, LAST_VALUE, DEPTH_VALUE, INIT_VALUE, ASSIGN_VALUE
               00177         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
               00178         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
               00179     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
               00180         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00181 
               00182     ;; Velocity calc
               00183     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
               00184     xorlw   0x40
               00185     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 224


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00186     
               00187     movf        BASE + DEPTH_VALUE, W, BANKED
               00188         andlw   0x3f
               00189         clrc
               00190         rlf     WREG, W
               00191     ;movwf   MIOS_PARAMETER1
               00192    
               00193         btfss   BASE + DEPTH_VALUE, 6, BANKED
               00194     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
               00195     
               00196 TIA_CCIN_CmdHlp_DoCtrl_Pos    
               00197         addlw   2
               00198     movwf   MIOS_PARAMETER1
               00199     
               00200     movf        BASE + LAST_VALUE, W, BANKED
               00201     mulwf   MIOS_PARAMETER1
               00202     clrc
               00203     rlf     PRODL, F
               00204     rlf     PRODH, W
               00205         addlw   1
               00206     movwf   MIOS_PARAMETER1
               00207     
               00208     movf        BASE + INIT_VALUE, W, BANKED
               00209     sublw   0x7f
               00210     mulwf   MIOS_PARAMETER1
               00211     rlf     PRODL, F
               00212     rlf     PRODH, W
               00213     addwf   BASE + INIT_VALUE, W, BANKED
               00214     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00215 
               00216 TIA_CCIN_CmdHlp_DoCtrl_Neg
               00217     comf    WREG, W
               00218     andlw   0x7f
               00219     addlw       2
               00220     movwf   MIOS_PARAMETER1
               00221 
               00222     movf        BASE + LAST_VALUE, W, BANKED
               00223     mulwf   MIOS_PARAMETER1
               00224     clrc
               00225     rlf     PRODL, F
               00226     rlf     PRODH, W
               00227         addlw   1
               00228     movwf   MIOS_PARAMETER1
               00229 
               00230     movf        BASE + INIT_VALUE, W, BANKED
               00231     mulwf   MIOS_PARAMETER1
               00232     rlf     PRODL, F
               00233     rlf     PRODH, W
               00234     subwf   BASE + INIT_VALUE, W, BANKED
               00235     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
               00236     
               00237 TIA_CCIN_CmdHlp_DoCtrl_NoDepth
               00238     movf        BASE + INIT_VALUE, W, BANKED
               00239     
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 225


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00240 TIA_CCIN_CmdHlp_DoCtrl_Cont
               00241     movwf   MIOS_PARAMETER1
               00242         movf    BASE + ASSIGN_VALUE, W, BANKED
               00243 
               00244         ENDM
               00245 
               00246 ; ==========================================================================
5F5E 00247 TIA_CCIN_Cmd_VELOCITY
               00248 
5F5E C003 FFE7 00249         movff   MIOS_PARAMETER1, INDF1
5F62 00250 TIA_CCIN_Cmd_VELOCITY_SkpCopy
5F62 0E60      00251     movlw   TIA_V2_BASE & 0xff
5F64 60E1      00252     cpfslt  FSR1L, ACCESS
               00253     rgoto   TIA_CCIN_Cmd_VELOCITY_A1
5F66 D035          M         bra     label
               00254     
5F68 00255 TIA_CCIN_Cmd_VELOCITY_A0
               00256 
5F68 5146      00257         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VELOCITY, W, BANKED ; exit when velocity assigned to 0
5F6A E069      00258     bz  TIA_CCIN_Cmd_VELOCITY_End
5F6C 0A05      00259         xorlw   5                               ; CC#5 is Velocity Init
5F6E E067      00260         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
5F70 5146      00261         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VELOCITY, W, BANKED
5F72 0A0E      00262         xorlw   14                              ; CC#14 is Velocity Depth
5F74 E064      00263         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
               00264 
               00265         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_V1_BASE, TIA_Vx_LAST_VELOCITY, TIA_Vx_DEPTH_VELOCITY, TIA_Vx_INIT_VELOCITY, TIA_Vx_ASSIGN_VELOCITY
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
5F76 5149          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5F78 0A40          M     xorlw   0x40
5F7A E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5F7C 5149          M     movf        BASE + DEPTH_VALUE, W, BANKED
5F7E 0B3F          M         andlw   0x3f
5F80 90D8          M         clrc
5F82 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5F84 AD49          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5F86 D010          M         bra     label
                   M     
5F88     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5F88 0F02          M         addlw   2
5F8A 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5F8C 5148          M     movf        BASE + LAST_VALUE, W, BANKED
5F8E 0203          M     mulwf   MIOS_PARAMETER1
5F90 90D8          M     clrc
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 226


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5F92 36F3          M     rlf     PRODL, F
5F94 34F4          M     rlf     PRODH, W
5F96 0F01          M         addlw   1
5F98 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5F9A 5147          M     movf        BASE + INIT_VALUE, W, BANKED
5F9C 087F          M     sublw   0x7f
5F9E 0203          M     mulwf   MIOS_PARAMETER1
5FA0 36F3          M     rlf     PRODL, F
5FA2 34F4          M     rlf     PRODH, W
5FA4 2547          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5FA6 D012          M         bra     label
                   M 
5FA8     M TIA_CCIN_CmdHlp_DoCtrl_Neg
5FA8 1CE8          M     comf    WREG, W
5FAA 0B7F          M     andlw   0x7f
5FAC 0F02          M     addlw       2
5FAE 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5FB0 5148          M     movf        BASE + LAST_VALUE, W, BANKED
5FB2 0203          M     mulwf   MIOS_PARAMETER1
5FB4 90D8          M     clrc
5FB6 36F3          M     rlf     PRODL, F
5FB8 34F4          M     rlf     PRODH, W
5FBA 0F01          M         addlw   1
5FBC 6E03          M     movwf   MIOS_PARAMETER1
                   M 
5FBE 5147          M     movf        BASE + INIT_VALUE, W, BANKED
5FC0 0203          M     mulwf   MIOS_PARAMETER1
5FC2 36F3          M     rlf     PRODL, F
5FC4 34F4          M     rlf     PRODH, W
5FC6 5D47          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
5FC8 D001          M         bra     label
                   M     
5FCA     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
5FCA 5147          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
5FCC     M TIA_CCIN_CmdHlp_DoCtrl_Cont
5FCC 6E03          M     movwf   MIOS_PARAMETER1
5FCE 5146          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00266 
               00267     rgoto   TIA_CCIN_Cmd_VELOCITY_Set
5FD0 D035          M         bra     label
               00268     
5FD2 00269 TIA_CCIN_Cmd_VELOCITY_A1
               00270 
5FD2 5186      00271         movf    TIA_V2_BASE + TIA_Vx_ASSIGN_VELOCITY, W, BANKED ; exit when velocity assigned to 0
5FD4 E034      00272         bz      TIA_CCIN_Cmd_VELOCITY_End
5FD6 0A06      00273         xorlw   6                               ; CC#6 is Velocity Init
5FD8 E032      00274         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
5FDA 5146      00275         movf    TIA_V1_BASE + TIA_Vx_ASSIGN_VELOCITY, W, BANKED
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 227


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
5FDC 0A0F      00276         xorlw   15                              ; CC#15 is Velocity Depth
5FDE E02F      00277         bz      TIA_CCIN_Cmd_VELOCITY_End       ; prevent endless loop
               00278 
               00279         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_V2_BASE, TIA_Vx_LAST_VELOCITY, TIA_Vx_DEPTH_VELOCITY, TIA_Vx_INIT_VELOCITY, TIA_Vx_ASSIGN_VELOCITY
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
5FE0 5189          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
5FE2 0A40          M     xorlw   0x40
5FE4 E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
5FE6 5189          M     movf        BASE + DEPTH_VALUE, W, BANKED
5FE8 0B3F          M         andlw   0x3f
5FEA 90D8          M         clrc
5FEC 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
5FEE AD89          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
5FF0 D010          M         bra     label
                   M     
5FF2     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
5FF2 0F02          M         addlw   2
5FF4 6E03          M     movwf   MIOS_PARAMETER1
                   M     
5FF6 5188          M     movf        BASE + LAST_VALUE, W, BANKED
5FF8 0203          M     mulwf   MIOS_PARAMETER1
5FFA 90D8          M     clrc
5FFC 36F3          M     rlf     PRODL, F
5FFE 34F4          M     rlf     PRODH, W
6000 0F01          M         addlw   1
6002 6E03          M     movwf   MIOS_PARAMETER1
                   M     
6004 5187          M     movf        BASE + INIT_VALUE, W, BANKED
6006 087F          M     sublw   0x7f
6008 0203          M     mulwf   MIOS_PARAMETER1
600A 36F3          M     rlf     PRODL, F
600C 34F4          M     rlf     PRODH, W
600E 2587          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
6010 D012          M         bra     label
                   M 
6012     M TIA_CCIN_CmdHlp_DoCtrl_Neg
6012 1CE8          M     comf    WREG, W
6014 0B7F          M     andlw   0x7f
6016 0F02          M     addlw       2
6018 6E03          M     movwf   MIOS_PARAMETER1
                   M 
601A 5188          M     movf        BASE + LAST_VALUE, W, BANKED
601C 0203          M     mulwf   MIOS_PARAMETER1
601E 90D8          M     clrc
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 228


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6020 36F3          M     rlf     PRODL, F
6022 34F4          M     rlf     PRODH, W
6024 0F01          M         addlw   1
6026 6E03          M     movwf   MIOS_PARAMETER1
                   M 
6028 5187          M     movf        BASE + INIT_VALUE, W, BANKED
602A 0203          M     mulwf   MIOS_PARAMETER1
602C 36F3          M     rlf     PRODL, F
602E 34F4          M     rlf     PRODH, W
6030 5D87          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
6032 D001          M         bra     label
                   M     
6034     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
6034 5187          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
6036     M TIA_CCIN_CmdHlp_DoCtrl_Cont
6036 6E03          M     movwf   MIOS_PARAMETER1
6038 5186          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00280     rgoto   TIA_CCIN_Cmd_VELOCITY_Set
603A D000          M         bra     label
               00281     
603C 00282 TIA_CCIN_Cmd_VELOCITY_Set
               00283         rgoto   TIA_CCIN_Set
603C D73D          M         bra     label
               00284         
603E 00285 TIA_CCIN_Cmd_VELOCITY_End
               00286         rgoto   TIA_CCIN_Cmd_End
603E D0CA          M         bra     label
               00287 
               00288 ;; --------------------------------------------------------------------------
6040 00289 TIA_CCIN_Cmd_AFTERTOUCH
6040 C003 FFE7 00290         movff   MIOS_PARAMETER1, INDF1
               00291 
6044 51E8      00292         movf    TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN, W, BANKED
               00293     ;; exit when aftertouch assigned to 0
6046 E033      00294         bz      TIA_CCIN_Cmd_AFTERTOUCH_End
6048 0A03      00295         xorlw   3                               ; CC#3 is Aftertouch Init
604A E031      00296         bz      TIA_CCIN_Cmd_AFTERTOUCH_End     ; prevent endless loop
604C 51E8      00297         movf    TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN, W, BANKED
604E 0A0C      00298         xorlw   12                              ; CC#12 is Aftertouch Depth
6050 E02E      00299         bz      TIA_CCIN_Cmd_AFTERTOUCH_End     ; prevent endless loop
               00300 
               00301         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_CTRL_AFTERTOUCH_BASE, TIA_CTRLx_LAST, TIA_CTRLx_DEPTH, TIA_CTRLx_INIT, TIA_CTRLx_ASSIGN
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
6052 51EB          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
6054 0A40          M     xorlw   0x40
6056 E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 229


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M     
6058 51EB          M     movf        BASE + DEPTH_VALUE, W, BANKED
605A 0B3F          M         andlw   0x3f
605C 90D8          M         clrc
605E 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
6060 ADEB          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
6062 D010          M         bra     label
                   M     
6064     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
6064 0F02          M         addlw   2
6066 6E03          M     movwf   MIOS_PARAMETER1
                   M     
6068 51EA          M     movf        BASE + LAST_VALUE, W, BANKED
606A 0203          M     mulwf   MIOS_PARAMETER1
606C 90D8          M     clrc
606E 36F3          M     rlf     PRODL, F
6070 34F4          M     rlf     PRODH, W
6072 0F01          M         addlw   1
6074 6E03          M     movwf   MIOS_PARAMETER1
                   M     
6076 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
6078 087F          M     sublw   0x7f
607A 0203          M     mulwf   MIOS_PARAMETER1
607C 36F3          M     rlf     PRODL, F
607E 34F4          M     rlf     PRODH, W
6080 25E9          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
6082 D012          M         bra     label
                   M 
6084     M TIA_CCIN_CmdHlp_DoCtrl_Neg
6084 1CE8          M     comf    WREG, W
6086 0B7F          M     andlw   0x7f
6088 0F02          M     addlw       2
608A 6E03          M     movwf   MIOS_PARAMETER1
                   M 
608C 51EA          M     movf        BASE + LAST_VALUE, W, BANKED
608E 0203          M     mulwf   MIOS_PARAMETER1
6090 90D8          M     clrc
6092 36F3          M     rlf     PRODL, F
6094 34F4          M     rlf     PRODH, W
6096 0F01          M         addlw   1
6098 6E03          M     movwf   MIOS_PARAMETER1
                   M 
609A 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
609C 0203          M     mulwf   MIOS_PARAMETER1
609E 36F3          M     rlf     PRODL, F
60A0 34F4          M     rlf     PRODH, W
60A2 5DE9          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
60A4 D001          M         bra     label
                   M     
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 230


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
60A6     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
60A6 51E9          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
60A8     M TIA_CCIN_CmdHlp_DoCtrl_Cont
60A8 6E03          M     movwf   MIOS_PARAMETER1
60AA 51E8          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00302         rgoto   TIA_CCIN_Set
60AC D705          M         bra     label
               00303         
60AE 00304 TIA_CCIN_Cmd_AFTERTOUCH_End
               00305         rgoto   TIA_CCIN_Cmd_End
60AE D092          M         bra     label
               00306 
               00307 ;; --------------------------------------------------------------------------
60B0 00308 TIA_CCIN_Cmd_MODWHEEL
60B0 C003 FFE7 00309         movff   MIOS_PARAMETER1, INDF1
60B4 51EC      00310         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED    
               00311     ;; exit when modwheel assigned to 0
60B6 E036      00312         bz      TIA_CCIN_Cmd_MODWHEEL_End
60B8 05EC      00313         decf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED    
               00314     ;; prevent endless loop if assigned to CC#1
60BA E034      00315         bz      TIA_CCIN_Cmd_MODWHEEL_End
60BC 51EC      00316         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED
60BE 0A02      00317         xorlw   2                               ; CC#2 is Modwheel Init
60C0 E031      00318         bz      TIA_CCIN_Cmd_MODWHEEL_End       ; prevent endless loop
60C2 51EC      00319         movf    TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN, W, BANKED
60C4 0A0B      00320         xorlw   11                              ; CC#11 is Modulation Wheel Depth
60C6 E02E      00321         bz      TIA_CCIN_Cmd_MODWHEEL_End       ; prevent endless loop
               00322 
               00323         TIA_CCIN_SETHLP_MACRO_DO_CTRL TIA_CTRL_MODWHEEL_BASE, TIA_CTRLx_LAST, TIA_CTRLx_DEPTH, TIA_CTRLx_INIT, TIA_CTRLx_ASSIGN
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Neg
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Pos
                   M     LOCAL   TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M         LOCAL   TIA_CCIN_CmdHlp_DoCtrl_Cont
                   M 
                   M     ;; Velocity calc
60C8 51EF          M     movf        BASE + DEPTH_VALUE, W, BANKED   ; calc (DEPTH+1)*4 * LAST_VALUE
60CA 0A40          M     xorlw   0x40
60CC E027          M     bz      TIA_CCIN_CmdHlp_DoCtrl_NoDepth
                   M     
60CE 51EF          M     movf        BASE + DEPTH_VALUE, W, BANKED
60D0 0B3F          M         andlw   0x3f
60D2 90D8          M         clrc
60D4 34E8          M         rlf     WREG, W
                   M     ;movwf   MIOS_PARAMETER1
                   M    
60D6 ADEF          M         btfss   BASE + DEPTH_VALUE, 6, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Neg
60D8 D010          M         bra     label
                   M     
60DA     M TIA_CCIN_CmdHlp_DoCtrl_Pos    
60DA 0F02          M         addlw   2
60DC 6E03          M     movwf   MIOS_PARAMETER1
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 231


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
                   M     
60DE 51EE          M     movf        BASE + LAST_VALUE, W, BANKED
60E0 0203          M     mulwf   MIOS_PARAMETER1
60E2 90D8          M     clrc
60E4 36F3          M     rlf     PRODL, F
60E6 34F4          M     rlf     PRODH, W
60E8 0F01          M         addlw   1
60EA 6E03          M     movwf   MIOS_PARAMETER1
                   M     
60EC 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
60EE 087F          M     sublw   0x7f
60F0 0203          M     mulwf   MIOS_PARAMETER1
60F2 36F3          M     rlf     PRODL, F
60F4 34F4          M     rlf     PRODH, W
60F6 25ED          M     addwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
60F8 D012          M         bra     label
                   M 
60FA     M TIA_CCIN_CmdHlp_DoCtrl_Neg
60FA 1CE8          M     comf    WREG, W
60FC 0B7F          M     andlw   0x7f
60FE 0F02          M     addlw       2
6100 6E03          M     movwf   MIOS_PARAMETER1
                   M 
6102 51EE          M     movf        BASE + LAST_VALUE, W, BANKED
6104 0203          M     mulwf   MIOS_PARAMETER1
6106 90D8          M     clrc
6108 36F3          M     rlf     PRODL, F
610A 34F4          M     rlf     PRODH, W
610C 0F01          M         addlw   1
610E 6E03          M     movwf   MIOS_PARAMETER1
                   M 
6110 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
6112 0203          M     mulwf   MIOS_PARAMETER1
6114 36F3          M     rlf     PRODL, F
6116 34F4          M     rlf     PRODH, W
6118 5DED          M     subwf   BASE + INIT_VALUE, W, BANKED
                   M     rgoto   TIA_CCIN_CmdHlp_DoCtrl_Cont
611A D001          M         bra     label
                   M     
611C     M TIA_CCIN_CmdHlp_DoCtrl_NoDepth
611C 51ED          M     movf        BASE + INIT_VALUE, W, BANKED
                   M     
611E     M TIA_CCIN_CmdHlp_DoCtrl_Cont
611E 6E03          M     movwf   MIOS_PARAMETER1
6120 51EC          M         movf    BASE + ASSIGN_VALUE, W, BANKED
                   M 
               00324         rgoto   TIA_CCIN_Set
6122 D6CA          M         bra     label
               00325 
6124 00326 TIA_CCIN_Cmd_MODWHEEL_End
               00327         rgoto   TIA_CCIN_Cmd_End
6124 D057          M         bra     label
               00328 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 232


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00329 ;; --------------------------------------------------------------------------
6126 00330 TIA_CCIN_Cmd_WAVEFORM
6126 2A03      00331     incf    MIOS_PARAMETER1, F  ;; skip 0
6128 0E05      00332     movlw   0x05
612A 6003      00333     cpfslt  MIOS_PARAMETER1, ACCESS     ;; skip 5
612C 2A03      00334     incf    MIOS_PARAMETER1, F
               00335     
612E 0E08      00336     movlw   0x08             
6130 6403      00337     cpfsgt  MIOS_PARAMETER1, ACCESS     ;; skip 8-11
               00338     rgoto   TIA_CCIN_Cmd_WAVEFORM_Cont
6132 D002          M         bra     label
6134 0E03      00339     movlw   0x03
6136 2603      00340     addwf   MIOS_PARAMETER1, F    
               00341 
6138 00342 TIA_CCIN_Cmd_WAVEFORM_Cont
6138 0E0D      00343     movlw   0x0d                ;; skip 13
613A 6003      00344     cpfslt  MIOS_PARAMETER1, ACCESS
613C 2A03      00345     incf    MIOS_PARAMETER1, F    
613E 5003      00346     movf    MIOS_PARAMETER1, W     
6140 6EE7      00347         movwf   INDF1
               00348 
               00349         rgoto   TIA_CCIN_Cmd_End
6142 D048          M         bra     label
               00350 
               00351 ;; --------------------------------------------------------------------------
               00352 ;TIA_CCIN_Cmd_MONO
               00353 ;       bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00354 ;       bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00355 ;       movf    MIOS_PARAMETER1, W
               00356 ;       skpz
               00357 ;       bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00358 ;       rgoto   TIA_CCIN_Cmd_End
               00359 
               00360 ;; --------------------------------------------------------------------------
6144 00361 TIA_CCIN_Cmd_PLAY_MODE
6144 910C      00362         bcf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00363         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00364         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00365 
               00366         ;btfsc  MIOS_PARAMETER1, 0
               00367         ;bcf    TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00368 
               00369         ;btfsc  MIOS_PARAMETER1, 1
               00370         ;bcf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00371 
6146 B003      00372         btfsc   MIOS_PARAMETER1, 0
6148 810C      00373         bsf     TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00374 
               00375         ;btfsc  TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
               00376         ;bsf    TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00377 
               00378         rgoto   TIA_CCIN_Cmd_End    
614A D044          M         bra     label
               00379 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 233


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00380 ;; --------------------------------------------------------------------------
614C 00381 TIA_CCIN_Cmd_PlayNote
614C 0403      00382         decf    MIOS_PARAMETER1, W      ; do nothing if 0x01 played (hold note)
614E E032      00383         bz      TIA_CCIN_Cmd_PlayNote_End
               00384 
6150 9610      00385         bcf     TIA_STAT, TIA_STAT_SAVED_GIE    ; for nested IRQ disables
6152 BEF2      00386         btfsc   INTCON, GIE
6154 8610      00387         bsf     TIA_STAT, TIA_STAT_SAVED_GIE
               00388         IRQ_DISABLE
6156 9EF2          M         bcf     INTCON, GIE
               00389 
6158 50E1      00390         movf    FSR1L, W                ; parameter contains voice offset, calc base address
615A 0D40      00391         mullw   TIA_Vx_RECORD_LEN
615C EE11 F020 00392         lfsr    FSR1, TIA_V1_BASE
6160 50F3      00393         movf    PRODL, W
6162 26E1      00394         addwf   FSR1L, F
               00395 
               00396         ;; set/clear gate bit
               00397         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_NotTB303
               00398         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_NotTB303
6164 00399 TIA_CCIN_Cmd_PlayNote_TB303
               00400         ;BRA_IFSET TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED, TIA_CCIN_Cmd_PlayNote_Cont
               00401         ;BRA_IFSET TIA_WT_STATE, WT_STATE_GATE, BANKED, TIA_CCIN_Cmd_PlayNote_On
               00402         ;; gate will be released by sequencer
               00403         rgoto   TIA_CCIN_Cmd_PlayNote_Cont
6164 D012          M         bra     label
6166 00404 TIA_CCIN_Cmd_PlayNote_NotTB303
               00405 
6166 5003      00406         movf    MIOS_PARAMETER1, W
6168 E104      00407         bnz     TIA_CCIN_Cmd_PlayNote_On
616A 00408 TIA_CCIN_Cmd_PlayNote_Off
               00409         ;; clear gate bit + note and branch to end
616A 0E03      00410         movlw   TIA_Vx_STAT
616C 92E3      00411         bcf     PLUSW1, Vx_STAT_GATE_SET_REQ
616E 84E3      00412         bsf     PLUSW1, Vx_STAT_GATE_CLR_REQ
               00413         rgoto   TIA_CCIN_Cmd_PlayNote_End
6170 D021          M         bra     label
               00414 
6172 00415 TIA_CCIN_Cmd_PlayNote_On
               00416         ;; set gate bit
6172 0E03      00417         movlw   TIA_Vx_STAT
               00418         BRA_IFCLR PLUSW1, Vx_STAT_VOICE_ACTIVE, ACCESS, TIA_CCIN_Cmd_PlayNote_Cont
6174 A0E3          M         btfss   reg, bit, reg_a
6176 D009          M         bra     label
6178 84E3      00419         bsf     PLUSW1, Vx_STAT_GATE_CLR_REQ
617A 82E3      00420         bsf     PLUSW1, Vx_STAT_GATE_SET_REQ
               00421 
               00422         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_On_NoTB303
               00423         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_On_NoTB303
               00424         rgoto   TIA_CCIN_Cmd_PlayNote_Cont
617C D006          M         bra     label
617E 00425 TIA_CCIN_Cmd_PlayNote_On_NoTB303
617E D81C      00426         rcall   TIA_CCIN_Cmd_PlayNote_PHelp     ; help function for alternative portamento
               00427         ;; enable portamento if rate > 0
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 234


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6180 0E0E      00428         movlw   TIA_Vx_PORTA_RATE
6182 52E3      00429         movf    PLUSW1, F
6184 E002      00430         bz      TIA_CCIN_Cmd_PlayNote_Cont
6186 0E03      00431         movlw   TIA_Vx_STAT
6188 88E3      00432         bsf     PLUSW1, Vx_STAT_PORTA_ENABLE
618A 00433 TIA_CCIN_Cmd_PlayNote_Cont
               00434 
               00435         ;BRA_IFCLR TIA_SE_OPTION, SE_OPTION_TB303, BANKED, TIA_CCIN_Cmd_PlayNote_NoTB303Sl
               00436         ;BRA_IFCLR TIA_WT_STATE, WT_STATE_PLAY_2ND, BANKED, TIA_CCIN_Cmd_PlayNote_NoTB303Sl
618A 00437 TIA_CCIN_Cmd_PlayNote_TB303Sl
               00438         ;; enable portamento depending on previous step
618A 9923      00439         bcf     TIA_V1_BASE + TIA_Vx_STAT, Vx_STAT_PORTA_ENABLE, BANKED
               00440         ;btfsc  TIA_WT_STATE, WT_STATE_SLIDE_PREV, BANKED
618C 8923      00441         bsf     TIA_V1_BASE + TIA_Vx_STAT, Vx_STAT_PORTA_ENABLE, BANKED
618E D814      00442         rcall   TIA_CCIN_Cmd_PlayNote_PHelp     ; help function for alternative portamento
6190 00443 TIA_CCIN_Cmd_PlayNote_NoTB303Sl
               00444 
               00445         ;; set new note
               00446         ;; if > 0x7c, play arpeggiator note
6190 0E7C      00447         movlw   0x7c
6192 6003      00448         cpfslt  MIOS_PARAMETER1, ACCESS
               00449         rgoto TIA_CCIN_Cmd_PlayNote_Arp
6194 D004          M         bra     label
6196 00450 TIA_CCIN_Cmd_PlayNote_Norm
6196 0E10      00451         movlw   TIA_Vx_NOTE
6198 C003 FFE3 00452         movff   MIOS_PARAMETER1, PLUSW1
               00453         rgoto   TIA_CCIN_Cmd_PlayNote_End
619C D00B          M         bra     label
619E 00454 TIA_CCIN_Cmd_PlayNote_Arp
619E 0E1E      00455         movlw   TIA_Vx_ARP_NOTE_0
61A0 2403      00456         addwf   MIOS_PARAMETER1, W
61A2 0F84      00457         addlw   -0x7c
61A4 50E3      00458         movf    PLUSW1, W
61A6 E102      00459         bnz     TIA_CCIN_Cmd_PlayNote_ArpNow
61A8 0E1E      00460         movlw   TIA_Vx_ARP_NOTE_0       ; if xth key not pressed: play first ARP note
61AA 50E3      00461         movf    PLUSW1, W
61AC 00462 TIA_CCIN_Cmd_PlayNote_ArpNow
61AC 6EF3      00463         movwf   PRODL
61AE 0E10      00464         movlw   TIA_Vx_NOTE
61B0 CFF3 FFE3 00465         movff   PRODL, PLUSW1
               00466 
61B4 00467 TIA_CCIN_Cmd_PlayNote_End
               00468         ;;      IRQ_ENABLE
61B4 B610      00469         btfsc   TIA_STAT, TIA_STAT_SAVED_GIE    ; nested IRQ enable
61B6 8EF2      00470         bsf     INTCON, GIE
               00471         ;;      rgoto   TIA_CCIN_Cmd_End
               00472 
               00473 ;; --------
               00474 ;; help function for alternative portamento effect
61B8 00475 TIA_CCIN_Cmd_PlayNote_PHelp
               00476         ;btfss  TIA_SE_OPTION, SE_OPTION_ENV2PORTA, BANKED
61B8 0012      00477         return
               00478 
               00479         ;; reset ENV2
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 235


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
61BA ECC7 F029 00480         call    TIA_SW_Hlp_ENV2Reset
               00481         
               00482         ;; store current frequency in TIA_Vx_PORTA_FRQ_L
61BE EE21 F002 00483         lfsr    FSR2, TIA_AUDF0
61C2 50E1      00484         movf    FSR1L, W
61C4 0A60      00485         xorlw   TIA_V2_BASE & 0xff
61C6 B4D8      00486         skpnz
61C8 EE21 F003 00487         lfsr    FSR2, TIA_AUDF1
               00488 
61CC 0E1C      00489         movlw   TIA_Vx_PORTA_FRQ_L
61CE CFDE FFE3 00490         movff   POSTINC2, PLUSW1
               00491         ;movlw  TIA_Vx_PORTA_FRQ_H
               00492         ;movff  POSTDEC2, PLUSW1
               00493         
61D2 0012      00494         return
               00495 
               00496 ;; --------------------------------------------------------------------------
61D4 00497 TIA_CCIN_Cmd_End
61D4 0012      00498         return
               00499 
               00389 #include "tia_ccout.inc"
               00001 ; $Id: tia_ccout.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; CC Output Handling
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  reacts on a CC dump request
               00016 ;; --------------------------------------------------------------------------
61D6 00017 TIA_CCOUT_Handler
               00018         ;; do nothing if dump has not been requested
61D6 A410      00019         btfss   TIA_STAT, TIA_STAT_CC_DUMP_REQ
61D8 0012      00020         return
               00021 
               00022         ;; clear request
61DA 9410      00023         bcf     TIA_STAT, TIA_STAT_CC_DUMP_REQ
               00024 
61DC 6A06      00025         clrf    TMP1                    ; TMP1 used as loop counter
61DE 00026 TIA_CCOUT_Handler_Loop
61DE 5006      00027         movf    TMP1, W
61E0 EC07 F031 00028         call    TIA_CCOUT_Get           ; get CC parameter value
61E4 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)
61E6 BE07          M         btfsc   reg, bit, reg_a
61E8 D00E          M         bra     label
               00031 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 236


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00032         ;; send CC
61EA C120 FFE8 00033         movff   TIA_V1_BASE + TIA_Vx_MIDI_CHANNEL, WREG
61EE 09B0      00034         iorlw   0xb0
61F0 EC24 F016 00035         call    MIOS_MIDI_TxBufferPut
61F4 5006      00036         movf    TMP1, W
61F6 EC24 F016 00037         call    MIOS_MIDI_TxBufferPut
61FA 5007      00038         movf    TMP2, W
61FC EC24 F016 00039         call    MIOS_MIDI_TxBufferPut
               00040 
6200 0E08      00041         movlw   8                       ; add a short delay of 8 mS for slow sequencers
6202 ECCE F016 00042         call    MIOS_Delay
               00043 
6206 00044 TIA_CCOUT_Handler_Next
6206 2A06      00045         incf    TMP1, F                 ; loop until 128 (bit 8 set)
               00046         BRA_IFCLR TMP1, 7, ACCESS, TIA_CCOUT_Handler_Loop
6208 AE06          M         btfss   reg, bit, reg_a
620A D7E9          M         bra     label
               00047         
620C 0012      00048         return
               00049 
               00050 ;; --------------------------------------------------------------------------
               00051 ;;  IN: index of CC parameter in WREG
               00052 ;;  OUT: CC value in WREG
               00053 ;; --------------------------------------------------------------------------
620E 00054 TIA_CCOUT_Get
620E D843      00055         rcall   TIA_CC_TABLE_Get        ; prepare a CC action
               00056         ;; now:
               00057         ;; command   is in MIOS_PARAMETER2
               00058         ;; parameter is in FSR1 (pointer)
               00059 
6210 00060 TIA_CCOUT_Set_Cmd
               00061         ;; branch depending on command
6210 5004      00062         movf    MIOS_PARAMETER2, W
6212 0B0F      00063         andlw   0x0f
               00064         JUMPTABLE_2BYTES_UNSECURE
6214 ECC8 F016     M         call    MIOS_HLP_GetIndex_2bytes
               00065         rgoto   TIA_CCOUT_Cmd_NOP
6218 D00F          M         bra     label
               00066         rgoto   TIA_CCOUT_Cmd_V12
621A D00F          M         bra     label
               00067         rgoto   TIA_CCOUT_Cmd_7BIT
621C D010          M         bra     label
               00068         rgoto   TIA_CCOUT_Cmd_7BIT; (W_PORTA ignored here)
621E D00F          M         bra     label
               00069         rgoto   TIA_CCOUT_Cmd_7BIT_4L
6220 D010          M         bra     label
               00070         rgoto   TIA_CCOUT_Cmd_7BIT_4U
6222 D012          M         bra     label
               00071         rgoto   TIA_CCOUT_Cmd_SUSKEY
6224 D01C          M         bra     label
               00072         rgoto   TIA_CCOUT_Cmd_VELOCITY
6226 D01E          M         bra     label
               00073         rgoto   TIA_CCOUT_Cmd_AFTERTOUCH
6228 D01E          M         bra     label
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 237


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00074         rgoto   TIA_CCOUT_Cmd_MODWHEEL
622A D01E          M         bra     label
               00075         rgoto   TIA_CCOUT_Cmd_WAVEFORM
622C D01E          M         bra     label
               00076         rgoto   TIA_CCOUT_Cmd_NOP
622E D004          M         bra     label
               00077         rgoto   TIA_CCOUT_Cmd_NOP
6230 D003          M         bra     label
               00078         rgoto   TIA_CCOUT_Cmd_Cmd_PLAY_MODE
6232 D02D          M         bra     label
               00079         rgoto   TIA_CCOUT_Cmd_NOP
6234 D001          M         bra     label
               00080         rgoto   TIA_CCOUT_Cmd_NOP; (PLAY_NOTE)
6236 D000          M         bra     label
               00081 
               00082 ; ==========================================================================
               00083 
               00084 
               00085 ;; --------------------------------------------------------------------------
6238 00086 TIA_CCOUT_Cmd_NOP
6238 0012      00087         return
               00088 
               00089 ;; --------------------------------------------------------------------------
623A 00090 TIA_CCOUT_Cmd_V12
623A 50E1      00091         movf    FSR1L, W                ; parameter contains first CC, only return this parameter!
               00092         rgoto   TIA_CCOUT_Get
623C D7E8          M         bra     label
               00093 
               00094 ;; --------------------------------------------------------------------------
623E 00095 TIA_CCOUT_Cmd_7BIT
623E 50E7      00096         movf    INDF1, W
6240 0012      00097         return
               00098 
               00099 ;; --------------------------------------------------------------------------
6242 00100 TIA_CCOUT_Cmd_7BIT_4L
6242 50E7      00101         movf    INDF1, W
6244 0B0F      00102         andlw   0x0f
6246 0012      00103         return
               00104 
               00105 ;; --------------------------------------------------------------------------
6248 00106 TIA_CCOUT_Cmd_7BIT_4U
6248 38E7      00107         swapf   INDF1, W
624A 0B0F      00108         andlw   0x0f
624C 0012      00109         return
               00110 
               00111 ;; --------------------------------------------------------------------------
624E 00112 TIA_CCOUT_Cmd_7BIT_TO_7_4
624E 30E7      00113         rrf     INDF1, W
6250 0B78      00114         andlw   0x78
6252 0012      00115         return
               00116 
               00117 ;; --------------------------------------------------------------------------
6254 00118 TIA_CCOUT_Cmd_7BIT_TO_3_0
6254 34E7      00119         rlf     INDF1, W
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 238


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6256 36E8      00120         rlf     WREG, F
6258 34E8      00121         rlf     WREG, W
625A 0B78      00122         andlw   0x78
625C 0012      00123         return
               00124 
               00125 ;; --------------------------------------------------------------------------
625E 00126 TIA_CCOUT_Cmd_SUSKEY
               00127         ;rrf    TIA_KEYTRACKING, W, BANKED
               00128         ;andlw  0x7e
               00129 
625E B30C      00130         btfsc   TIA_PLAY_MODE, TIA_PLAY_MODE_SUS_KEY, BANKED
6260 0E01      00131         movlw 0x01
6262 0012      00132         return
               00133 
               00134 ;; --------------------------------------------------------------------------
6264 00135 TIA_CCOUT_Cmd_VELOCITY
               00136         rgoto   TIA_CCOUT_Cmd_7BIT
6264 D7EC          M         bra     label
               00137 
               00138 ;; --------------------------------------------------------------------------
6266 00139 TIA_CCOUT_Cmd_AFTERTOUCH
               00140         rgoto   TIA_CCOUT_Cmd_7BIT
6266 D7EB          M         bra     label
               00141 
               00142 ;; --------------------------------------------------------------------------
6268 00143 TIA_CCOUT_Cmd_MODWHEEL
               00144         rgoto   TIA_CCOUT_Cmd_7BIT
6268 D7EA          M         bra     label
               00145 
               00146 ;; --------------------------------------------------------------------------
626A 00147 TIA_CCOUT_Cmd_WAVEFORM
626A 50E7      00148         movf    INDF1, W
626C 0B0F      00149     andlw   0x0f
626E 6E03      00150     movwf   MIOS_PARAMETER1
6270 0E0D      00151     movlw   0x0d                ;; skip 13
6272 6003      00152     cpfslt  MIOS_PARAMETER1
6274 0603      00153     decf    MIOS_PARAMETER1, F 
               00154 
6276 0E08      00155     movlw   0x08             
6278 6403      00156     cpfsgt  MIOS_PARAMETER1     ;; skip 8-11
               00157     rgoto   TIA_CCOUT_Cmd_WAVEFORM_Cont
627A D002          M         bra     label
627C 0E03      00158     movlw   0x03
627E 5E03      00159     subwf   MIOS_PARAMETER1, F    
               00160 
6280 00161 TIA_CCOUT_Cmd_WAVEFORM_Cont   
               00162 
6280 0E05      00163     movlw   0x05
6282 6003      00164     cpfslt  MIOS_PARAMETER1     ;; skip 5
6284 0603      00165     decf    MIOS_PARAMETER1, F
               00166     
6286 0603      00167     decf    MIOS_PARAMETER1, F  ;; skip 0
6288 5003      00168     movf        MIOS_PARAMETER1, W
               00169 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 239


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
628A 0012      00170         return
               00171 
               00172 ;; --------------------------------------------------------------------------
628C 00173 TIA_CCOUT_Cmd_MONO
628C 0012      00174         return                  ; (ignored)
               00175 
               00176 ;; --------------------------------------------------------------------------
628E 00177 TIA_CCOUT_Cmd_Cmd_PLAY_MODE
628E 0E00      00178         movlw   0x00
               00179         ;btfss  TIA_PLAY_MODE, TIA_PLAY_MODE_LEGATO_OFF, BANKED
               00180         ;movlw 0x01
               00181         ;btfss  TIA_PLAY_MODE, TIA_PLAY_MODE_ONLY_WT_OFF, BANKED
               00182         ;movlw 0x03
6290 B10C      00183         btfsc   TIA_PLAY_MODE, TIA_PLAY_MODE_POLY, BANKED
6292 0E01      00184         movlw 0x01
6294 0012      00185         return
               00390 #include "tia_cc_table.inc"
               00001 ; $Id: tia_cc_table.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; CC Table
               00005 ; used by tia_ccin.inc and tia_ccout.inc
               00006 ;
               00007 ; ==========================================================================
               00008 ;
               00009 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00010 ;  Licensed for personal non-commercial use only.
               00011 ;  All other rights reserved.
               00012 ; 
               00013 ; ==========================================================================
               00014 
               00015 
  00000000     00016 SET_CC_NOP          EQU 0x00
  00000001     00017 SET_CC_V12              EQU     0x01
  00000002     00018 SET_CC_7BIT         EQU 0x02
  00000003     00019 SET_CC_7BIT_W_PORTA     EQU     0x03
  00000004     00020 SET_CC_7BIT_4L          EQU     0x04
  00000005     00021 SET_CC_7BIT_4U          EQU     0x05
  00000006     00022 SET_CC_SUSKEY           EQU     0x06
  00000007     00023 SET_CC_VELOCITY         EQU     0x07
  00000008     00024 SET_CC_AFTERTOUCH       EQU     0x08
  00000009     00025 SET_CC_MODWHEEL         EQU     0x09
  0000000A     00026 SET_CC_WAVEFORM         EQU     0x0a
  0000000B     00027 SET_CC_CTRL_4L      EQU 0x0b
  0000000C     00028 SET_CC_CTRL_4U      EQU 0x0c
  0000000D     00029 SET_CC_PLAY_MODE    EQU 0x0d
  0000000E     00030 SET_CC_DEBUG        EQU 0x0e
  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 ;; --------------------------------------------------------------------------
6296 00037 TIA_CC_TABLE_Get
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 240


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00038         SET_BSR TIA_BASE                ; prepare BSR for TIA register access
6296 0101          M         movlb   HIGH(reg)
6298 EE11 F000 00039         lfsr    FSR1, TIA_BASE          ; prepare FSR1
               00040 
629C 90D8      00041         clrc
629E 34E8      00042         rlf     WREG, W
62A0 0FB8      00043         addlw   TIA_CC_TABLE & 0xff
62A2 6EF6      00044         movwf   TBLPTRL
62A4 6AF7      00045         clrf    TBLPTRH
62A6 0E62      00046         movlw   TIA_CC_TABLE >> 8
62A8 22F7      00047         addwfc  TBLPTRH, F
               00048 
62AA 0009      00049         tblrd*+
62AC CFF5 F004 00050         movff   TABLAT, MIOS_PARAMETER2 ; -> command
62B0 0009      00051         tblrd*+
62B2 CFF5 FFE1 00052         movff   TABLAT, FSR1L           ; -> parameter
62B6 0012      00053         return
               00054 
               00055 
               00056 ; ==========================================================================
               00057 
62B8 00058 TIA_CC_TABLE
               00059         ;; 0x00-0x0f
62B8 0000      00060         db      SET_CC_NOP,                             0x00
62BA EE09      00061         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_LAST) & 0xff
62BC ED09      00062         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_INIT) & 0xff
62BE E908      00063         db      SET_CC_AFTERTOUCH,                              (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_INIT) & 0xff
62C0 0501      00064         db      SET_CC_V12,                 0x05
62C2 4707      00065         db      SET_CC_VELOCITY,                (TIA_V1_BASE + TIA_Vx_INIT_VELOCITY) & 0xff
62C4 8707      00066         db      SET_CC_VELOCITY,                                (TIA_V2_BASE + TIA_Vx_INIT_VELOCITY) & 0xff
62C6 0B02      00067         db      SET_CC_7BIT,                                    TIA_MASTER_VOL & 0xff    
62C8 0901      00068         db      SET_CC_V12,                 0x09
62CA 2F02      00069         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_VOLUME) & 0xff
62CC 6F02      00070         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_VOLUME) & 0xff
62CE EF09      00071         db      SET_CC_MODWHEEL,                                (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_DEPTH) & 0xff
62D0 EB08      00072         db      SET_CC_AFTERTOUCH,                              (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_DEPTH) & 0xff
62D2 0E01      00073         db      SET_CC_V12,                 0x0e
62D4 4902      00074         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_DEPTH_VELOCITY) & 0xff
62D6 8902      00075         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_DEPTH_VELOCITY) & 0xff
               00076 
               00077         ;; 0x10-0x1f
62D8 1101      00078         db      SET_CC_V12,                 0x11
62DA 000A      00079         db      SET_CC_WAVEFORM,                TIA_AUDC0 & 0x0f
62DC 010A      00080         db      SET_CC_WAVEFORM,                TIA_AUDC1 & 0x0f
62DE 1401      00081         db      SET_CC_V12,                 0x14
62E0 2402      00082         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_MODE) & 0xff
62E2 6402      00083         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_MODE) & 0xff
62E4 1701      00084         db      SET_CC_V12,                 0x17
62E6 2C03      00085         db      SET_CC_7BIT_W_PORTA,                    (TIA_V1_BASE + TIA_Vx_TRANSPOSE) & 0xff
62E8 6C03      00086         db      SET_CC_7BIT_W_PORTA,                    (TIA_V2_BASE + TIA_Vx_TRANSPOSE) & 0xff
62EA 1A01      00087         db      SET_CC_V12,                 0x1a
62EC 2D03      00088         db      SET_CC_7BIT_W_PORTA,                    (TIA_V1_BASE + TIA_Vx_PITCHRANGE) & 0xff
62EE 6D03      00089         db      SET_CC_7BIT_W_PORTA,                    (TIA_V2_BASE + TIA_Vx_PITCHRANGE) & 0xff
62F0 1D01      00090         db      SET_CC_V12,                 0x1d
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 241


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
62F2 2E02      00091         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_PORTA_RATE) & 0xff
62F4 6E02      00092         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_PORTA_RATE) & 0xff
62F6 2001      00093         db      SET_CC_V12,                 0x20
               00094 
               00095         ;; 0x20-0x2f
62F8 3302      00096         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_ARP_RATE) & 0xff
62FA 7302      00097         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_ARP_RATE) & 0xff
62FC 2301      00098         db      SET_CC_V12,                 0x23
62FE 3102      00099         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_NOTE_DELAY) & 0xff
6300 7102      00100         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_NOTE_DELAY) & 0xff
6302 2601      00101         db      SET_CC_V12,                 0x26
6304 2502      00102         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KEY_OFFSET) & 0xff
6306 6502      00103         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KEY_OFFSET) & 0xff
6308 2901      00104         db      SET_CC_V12,                 0x29
630A 2602      00105         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KEY_LENGTH) & 0xff
630C 6602      00106         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KEY_LENGTH) & 0xff
630E 2C01      00107         db      SET_CC_V12,                 0x2c
6310 4602      00108         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_ASSIGN_VELOCITY) & 0xff
6312 8602      00109         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_ASSIGN_VELOCITY) & 0xff
6314 2F01      00110         db      SET_CC_V12,                 0x2f
6316 4A02      00111         db      SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_ENV_OPTION) & 0xff
               00112  
               00113     ;; 0x30-0x3f    
6318 8A02      00114         db      SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_ENV_OPTION) & 0xff
631A 3201      00115     db  SET_CC_V12,                 0x32
631C C402      00116         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_DEPTH) & 0xff
631E CF02      00117         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_DEPTH) & 0xff
6320 3501      00118     db  SET_CC_V12,                                     0x35
6322 C302      00119         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_CURVE) & 0xff
6324 CE02      00120         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_CURVE) & 0xff
6326 3801      00121     db  SET_CC_V12,                                     0x38
6328 BF02      00122         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_ATTACK) & 0xff
632A CA02      00123     db  SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_ATTACK) & 0xff
632C 3B01      00124     db  SET_CC_V12,                                     0x3b
632E C002      00125     db  SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_DECAY) & 0xff
6330 CB02      00126         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_DECAY) & 0xff  
6332 3E01      00127         db      SET_CC_V12,                                     0x3e
6334 C102      00128         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_SUSTAIN) & 0xff
6336 CC02      00129         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_SUSTAIN) & 0xff
               00130     
               00131     ;; 0x40-0x4f 
6338 4101      00132         db      SET_CC_V12,                                     0x41
633A C202      00133         db      SET_CC_7BIT,                    (TIA_ENVAUD0_BASE + TIA_ENVx_RELEASE) & 0xff
633C CD02      00134         db      SET_CC_7BIT,                    (TIA_ENVAUD1_BASE + TIA_ENVx_RELEASE) & 0xff
633E 4400      00135     db  SET_CC_NOP,                                     0x44
6340 4B00      00136     db  SET_CC_NOP,                     (TIA_V1_BASE + TIA_Vx_OPTION) & 0xff
6342 8B02      00137     db  SET_CC_7BIT,                    (TIA_V2_BASE + TIA_Vx_OPTION) & 0xff
6344 4701      00138         db      SET_CC_V12,                 0x47
6346 4C02      00139     db  SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_WBANK) & 0xff
6348 8C02      00140     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_WBANK) & 0xff
634A 4A01      00141         db      SET_CC_V12,                 0x4a
634C 4D02      00142     db  SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_WT) & 0xff
634E 8D02      00143     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_WT) & 0xff
6350 4D01      00144         db      SET_CC_V12,                 0x4d
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 242


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6352 4F02      00145     db  SET_CC_7BIT,                    (TIA_V1_BASE + TIA_Vx_WT_RATE) & 0xff
6354 8F02      00146     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_WT_RATE) & 0xff
6356 5001      00147     db  SET_CC_V12,                 0x50
               00148     
               00149     ;; 0x40-0x4f 
6358 5702      00150     db  SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KBANK) & 0xff
635A 9702      00151     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KBANK) & 0xff
635C 5301      00152         db      SET_CC_V12,                 0x53
635E 5802      00153     db  SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_KIT) & 0xff
6360 9802      00154     db  SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_KIT) & 0xff
6362 0000      00155     db  SET_CC_NOP,                     0x00
6364 1F02      00156         db      SET_CC_7BIT,                                    TIA_MOD_SYNC & 0xff
6366 5801      00157         db      SET_CC_V12,                                     0x58
6368 3702      00158         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_AMP_MOD) & 0xff
636A 7702      00159         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_AMP_MOD) & 0xff
636C 5B01      00160         db      SET_CC_V12,                                     0x5b
636E 3602      00161         db      SET_CC_7BIT,                                    (TIA_V1_BASE + TIA_Vx_PITCH_MOD) & 0xff
6370 7602      00162         db      SET_CC_7BIT,                                    (TIA_V2_BASE + TIA_Vx_PITCH_MOD) & 0xff
6372 A002      00163     db  SET_CC_7BIT,                            (TIA_LFO1_BASE + TIA_LFOx_MODE) & 0xff
6374 A702      00164         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_MODE) & 0xff  
6376 AE02      00165         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_MODE) & 0xff
               00166     
               00167         ;; 0x60-0x6f
6378 B502      00168         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_MODE) & 0xff
637A A102      00169         db      SET_CC_7BIT,                (TIA_LFO1_BASE + TIA_LFOx_RATE) & 0xff
637C A802      00170         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_RATE) & 0xff
637E AF02      00171         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_RATE) & 0xff
6380 B602      00172         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_RATE) & 0xff      
6382 A402      00173         db      SET_CC_7BIT,                            (TIA_LFO1_BASE + TIA_LFOx_DEPTH) & 0xff
6384 AB02      00174         db      SET_CC_7BIT,                            (TIA_LFO2_BASE + TIA_LFOx_DEPTH) & 0xff
6386 B202      00175         db      SET_CC_7BIT,                            (TIA_LFO3_BASE + TIA_LFOx_DEPTH) & 0xff
6388 B902      00176         db      SET_CC_7BIT,                            (TIA_LFO4_BASE + TIA_LFOx_DEPTH) & 0xff
638A DA02      00177         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_DEPTH) & 0xff
638C E502      00178         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_DEPTH) & 0xff
638E D902      00179     db  SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_CURVE) & 0xff
6390 E402      00180         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_CURVE) & 0xff
6392 D502      00181         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_ATTACK) & 0xff
6394 E002      00182         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_ATTACK) & 0xff
6396 D602      00183         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_DECAY) & 0xff
               00184     
               00185         ;; 0x70-0x7f 
6398 E102      00186         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_DECAY) & 0xff
639A D702      00187         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_SUSTAIN) & 0xff
639C E202      00188         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_SUSTAIN) & 0xff
639E D802      00189         db      SET_CC_7BIT,                            (TIA_ENV1_BASE + TIA_ENVx_RELEASE) & 0xff
63A0 E302      00190         db      SET_CC_7BIT,                            (TIA_ENV2_BASE + TIA_ENVx_RELEASE) & 0xff
63A2 1E02      00191         db      SET_CC_7BIT,                    TIA_ENVx_CURVES & 0xff
63A4 0000      00192     db  SET_CC_NOP,                                     0x00
63A6 EC02      00193     db  SET_CC_7BIT,                    (TIA_CTRL_MODWHEEL_BASE + TIA_CTRLx_ASSIGN) & 0xff
63A8 E802      00194         db      SET_CC_7BIT,                    (TIA_CTRL_AFTERTOUCH_BASE + TIA_CTRLx_ASSIGN) & 0xff
63AA 7A01      00195         db      SET_CC_V12,                                     0x7a
63AC 000F      00196         db      SET_CC_PLAY_NOTE,                               0x00; (Voice 1)
63AE 010F      00197         db      SET_CC_PLAY_NOTE,                               0x01; (Voice 2)
63B0 0000      00198     db  SET_CC_NOP,                                     0x00
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 243


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
63B2 F004      00199         db      SET_CC_7BIT_4L,                                 TIA_MIDI_SYNC & 0xff
63B4 0000      00200     db  SET_CC_NOP,                                     0x00
63B6 000D      00201         db      SET_CC_PLAY_MODE,                               0x00
               00202 
               00203 ; ==========================================================================
               00391 #include "tia_sysex_table.inc"
               00001 ; $Id: tia_sysex_table.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; SysEx reference table
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014 ;; --------------------------------------------------------------------------
               00015 ;;  IN: index of SysEx entry (0x00-0xff) in WREG
               00016 ;;  OUT: appr. CC number in WREG - if [7] set, no CC available
               00017 ;; --------------------------------------------------------------------------
63B8 00018 TIA_SYSEX_TABLE_Get
63B8 BEE8      00019         btfsc   WREG, 7; Wavtable area: return 0xff
63BA 0CFF      00020         retlw 0xff                      
               00021 
63BC 0FCC      00022         addlw   TIA_SYSEX_TABLE & 0xff                  ; calc: TIA_SYSEX_TABLE + index
63BE 6EF6      00023         movwf   TBLPTRL                                 ; result in TBLPTR[LH]
63C0 6AF7      00024         clrf    TBLPTRH
63C2 0E63      00025         movlw   (TIA_SYSEX_TABLE >> 8) & 0xff
63C4 22F7      00026         addwfc  TBLPTRH, F
63C6 0008      00027         tblrd*                                          ; read from table
63C8 50F5      00028         movf    TABLAT, W                               ; return table entry
63CA 0012      00029         return
               00030 
               00031 
               00032         ;; SyxTab maps the SysEx offset to the CC number
63CC 00033 TIA_SYSEX_TABLE
               00034         ;; 0x00-0x0f
63CC 8180      00035         db      0x80, 0x81      ; Patch Name
63CE 8382      00036         db      0x82, 0x83
63D0 8584      00037         db      0x84, 0x85
63D2 8786      00038         db      0x86, 0x87
63D4 8988      00039         db      0x88, 0x89
63D6 8B8A      00040         db      0x8a, 0x8b
63D8 8D8C      00041         db      0x8c, 0x8d
63DA 8F8E      00042         db      0x8e, 0x8f
               00043 
               00044         ;; 0x10-0x1f
63DC 7F07      00045         db      0x07, 0x7f      ; Master Volume, Play Mode
63DE 737B      00046         db      0x7b, 0x73      ; SusKey, ENVx curves
63E0 567D      00047         db      0x7d, 0x56      ; MIDI Sync, Modulation Sync 
63E2 FFFF      00048         db      0xff, 0xff      ; 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 244


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
63E4 FFFF      00049     db  0xff, 0xff      ; 
63E6 0277      00050         db      0x77, 0x02      ; Modulation Assign, Modulation Init Value
63E8 780B      00051         db      0x0b, 0x78      ; Modulation Depth, Aftertouch Assign
63EA 0C03      00052     db  0x03, 0x0c      ; Aftertouch Init Value, Aftertouch Depth       
               00053 
               00054         ;; 0x20-0x2f 
               00055     ;; Voice 1 (AUD0)
63EC 1709      00056         db      0x09, 0x17      ; V1 Volume, V1 Transpose
63EE 1411      00057         db      0x11, 0x14      ; V1 Waveform, V1 Mo0x24de
63F0 1D1A      00058         db      0x1a, 0x1d      ; V1 PitchRange, V1 Portamento
63F2 2320      00059         db      0x20, 0x23      ; V1 Arp Rate, V1 Delay
63F4 2926      00060         db      0x26, 0x29      ; V1 Key Offset, V1 Key Length
63F6 9190      00061         db      0x90, 0x91      ; Split V1 Lower, Split V1 Upper
63F8 052C      00062         db      0x2c, 0x05      ; V1 Velocity Assign, V1 Velocity Init Value
63FA 2F0E      00063         db      0x0e, 0x2f      ; V1 Velocity Depth, ENVAUD0 Options
               00064     ;; 0x30-0x3f    
63FC 3532      00065     db  0x32, 0x35      ; ENVAUD0 Depth, ENVAUD0 Curve
63FE 3B38      00066     db  0x38, 0x3b      ; ENVAUD0 Attack, ENVAUD0 Decay
6400 413E      00067         db      0x3e, 0x41      ; ENVAUD0 Sustain, ENVAUD0 Release
6402 4744      00068         db      0x44, 0x47      ; V1 Sofware Options, V1 Wavetable Bank
6404 4D4A      00069         db      0x4a, 0x4d      ; V1 Wavetable Patch, V1 Wavetable Rate
6406 5350      00070         db      0x50, 0x53      ; V1 Kit Bank, V1 Kit Patch
6408 5B58      00071         db      0x58, 0x5b      ; V1 Assigned Amplitude Mods, V1 Assigned Pitch Mods
640A FFFF      00072         db      0xff, 0xff      ;
               00073     
               00074     ;; Voice 2 (AUD1)
               00075         ;; 0x40-0x4f
640C 180A      00076         db      0x0a, 0x18      ; V2 Volume, V2 Transpose
640E 1512      00077         db      0x12, 0x15      ; V2 Waveform, V2 Mode
6410 1E1B      00078         db      0x1b, 0x1e      ; V2 PitchRange, V2 Portamento
6412 2421      00079         db      0x21, 0x24      ; V2 Arp Rate, V2 Delay
6414 2A27      00080         db      0x27, 0x2a      ; V2 Key Offset, V2 Key Length
6416 9291      00081         db      0x91, 0x92      ; Split V2 Lower, Split V2 Upper
6418 062D      00082         db      0x2d, 0x06      ; V2 Velocity Assign, V2 Velocity Init Value
641A 300F      00083         db      0x0f, 0x30      ; V2 Velocity Depth, ENVAUD1 Options
               00084     ;; 0x50-0x5f    
641C 3633      00085     db  0x33, 0x36      ; ENVAUD1 Depth, ENVAUD1 Curve
641E 3C39      00086     db  0x39, 0x3c      ; ENVAUD1 Attack, ENVAUD1 Decay
6420 423F      00087         db      0x3f, 0x42      ; ENVAUD1 Sustain, ENVAUD1 Release
6422 4845      00088         db      0x45, 0x48      ; V2 Sofware Options, V2 Wavetable Bank
6424 4E4B      00089         db      0x4b, 0x4e      ; V2 Wavetable Patch, V2 Wavetable Rate
6426 5451      00090         db      0x51, 0x54      ; V2 Kit Bank, V2 Kit Patch
6428 5C59      00091         db      0x59, 0x5c      ; V2 Assigned Amplitude Mods, V2 Assigned Pitch Mods
642A FFFF      00092     db  0xff, 0xff      ;
               00093 
               00094         ;; 0x60-0x77
642C 615D      00095         db      0x5d, 0x61      ; LFO1 Mode, LFO1 Rate
642E 5E65      00096         db      0x65, 0x5e      ; LFO1 Depth, LFO2 Mode
6430 6662      00097         db      0x62, 0x66      ; LFO2 Rate, LFO2 Depth
6432 635F      00098         db      0x5f, 0x63      ; LFO3 Mode, LFO3 Rate
6434 6067      00099         db      0x67, 0x60      ; LFO3 Depth, LFO4 Mode
6436 6864      00100         db      0x64, 0x68      ; LFO4 Rate, LFO4 Depth
               00101     
6438 6B69      00102         db      0x69, 0x6b      ; ENV1 Depth, ENV1 Curve
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 245


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
643A 6F6D      00103         db      0x6d, 0x6f      ; ENV1 Attack, ENV1 Decay
643C 7371      00104         db      0x71, 0x73      ; ENV1 Sustain, ENV1 Release
643E 6C6A      00105         db      0x6a, 0x6c      ; ENV2 Depth, ENV2 Curve
6440 706E      00106         db      0x6e, 0x70      ; ENV2 Attack, ENV2 Decay
6442 7472      00107         db      0x72, 0x74      ; ENV2 Sustain, ENV2 Release
               00108 
               00109 
6444 FFFF      00110         db      0xff, 0xff      ;
6446 FFFF      00111         db      0xff, 0xff      ;
               00112     
6448 FFFF      00113         db      0xff, 0xff      ; CFG Reserved
644A FFFF      00114         db      0xff, 0xff  ; CFG Reserved
               00115     
               00392 #include "tia_env_table.inc"
               00001 ; $Id: tia_env_table.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Envelope Table
               00005 ; generated with env_delay.pl - calculates sweep from 800 uS to 30s
               00006 ;
               00007 ; ==========================================================================
               00008 ;
               00009 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00010 ;  Licensed for personal non-commercial use only.
               00011 ;  All other rights reserved.
               00012 ; 
               00013 ; ==========================================================================
               00014 
               00015 ;; --------------------------------------------------------------------------
               00016 ;; In: index (0x00-0x7f) in WREG
               00017 ;; Out: low byte in WREG and MIOS_PARAMETER1, high byte in MIOS_PARAMETER2
               00018 ;; --------------------------------------------------------------------------
644C 00019 TIA_ENV_TABLE_Get
644C 90D8      00020         clrc
644E 34E8      00021         rlf     WREG, W
6450 0F6A      00022         addlw   TIA_ENV_TABLE & 0xff
6452 6EF6      00023         movwf   TBLPTRL
6454 6AF7      00024         clrf    TBLPTRH
6456 0E64      00025         movlw   TIA_ENV_TABLE >> 8
6458 22F7      00026         addwfc  TBLPTRH, F
               00027 
645A 0009      00028         tblrd*+
645C CFF5 F003 00029         movff   TABLAT, MIOS_PARAMETER1
6460 0009      00030         tblrd*+
6462 CFF5 F004 00031         movff   TABLAT, MIOS_PARAMETER2
6466 5003      00032         movf    MIOS_PARAMETER1, W
6468 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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 246


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


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00149 ; 113 | 12.9335 |     0 |     4
               00150 ; 114 | 13.6076 |     0 |     3
               00151 ; 115 | 14.3208 |     0 |     3
               00152 ; 116 | 15.0756 |     0 |     3
               00153 ; 117 | 15.8746 |     0 |     3
               00154 ; 118 | 16.7207 |     0 |     3
               00155 ; 119 | 17.6171 |     0 |     2
               00156 ; 120 | 18.5671 |     0 |     2
               00157 ; 121 | 19.5742 |     0 |     2
               00158 ; 122 | 20.6422 |     0 |     2
               00159 ; 123 | 21.7753 |     0 |     2
               00160 ; 124 | 22.9777 |     0 |     2
               00161 ; 125 | 24.2542 |     0 |     2
               00162 ; 126 | 25.6098 |     0 |     2
               00163 ; 127 | 27.0500 |     0 |     1
               00164 
646A 00165 TIA_ENV_TABLE
646A FFFF      00166         db      0xff, 0xff      ; delay=0.0008
646C FFFF      00167         db      0xff, 0xff      ; delay=0.0008
646E CAC4      00168         db      0xc4, 0xca      ; delay=0.0010
6470 7CD9      00169         db      0xd9, 0x7c      ; delay=0.0016
6472 4C15      00170         db      0x15, 0x4c      ; delay=0.0027
6474 3129      00171         db      0x29, 0x31      ; delay=0.0042
6476 21C6      00172         db      0xc6, 0x21      ; delay=0.0061
6478 1869      00173         db      0x69, 0x18      ; delay=0.0084
647A 1261      00174         db      0x61, 0x12      ; delay=0.0111
647C 0E4A      00175         db      0x4a, 0x0e      ; delay=0.0143
647E 0B67      00176         db      0x67, 0x0b      ; delay=0.0180
6480 094C      00177         db      0x4c, 0x09      ; delay=0.0220
6482 07B7      00178         db      0xb7, 0x07      ; delay=0.0265
6484 0680      00179         db      0x80, 0x06      ; delay=0.0315
6486 058B      00180         db      0x8b, 0x05      ; delay=0.0369
6488 04C8      00181         db      0xc8, 0x04      ; delay=0.0428
648A 0429      00182         db      0x29, 0x04      ; delay=0.0492
648C 03A7      00183         db      0xa7, 0x03      ; delay=0.0560
648E 033B      00184         db      0x3b, 0x03      ; delay=0.0634
6490 02E0      00185         db      0xe0, 0x02      ; delay=0.0712
6492 0293      00186         db      0x93, 0x02      ; delay=0.0796
6494 0250      00187         db      0x50, 0x02      ; delay=0.0884
6496 0217      00188         db      0x17, 0x02      ; delay=0.0978
6498 01E6      00189         db      0xe6, 0x01      ; delay=0.1078
649A 01BB      00190         db      0xbb, 0x01      ; delay=0.1183
649C 0195      00191         db      0x95, 0x01      ; delay=0.1294
649E 0173      00192         db      0x73, 0x01      ; delay=0.1411
64A0 0155      00193         db      0x55, 0x01      ; delay=0.1533
64A2 013B      00194         db      0x3b, 0x01      ; delay=0.1662
64A4 0123      00195         db      0x23, 0x01      ; delay=0.1798
64A6 010E      00196         db      0x0e, 0x01      ; delay=0.1940
64A8 00FB      00197         db      0xfb, 0x00      ; delay=0.2088
64AA 00E9      00198         db      0xe9, 0x00      ; delay=0.2244
64AC 00D9      00199         db      0xd9, 0x00      ; delay=0.2407
64AE 00CB      00200         db      0xcb, 0x00      ; delay=0.2578
64B0 00BE      00201         db      0xbe, 0x00      ; delay=0.2756
64B2 00B2      00202         db      0xb2, 0x00      ; delay=0.2942
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 249


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
64B4 00A7      00203         db      0xa7, 0x00      ; delay=0.3136
64B6 009D      00204         db      0x9d, 0x00      ; delay=0.3339
64B8 0093      00205         db      0x93, 0x00      ; delay=0.3550
64BA 008B      00206         db      0x8b, 0x00      ; delay=0.3771
64BC 0083      00207         db      0x83, 0x00      ; delay=0.4001
64BE 007B      00208         db      0x7b, 0x00      ; delay=0.4241
64C0 0074      00209         db      0x74, 0x00      ; delay=0.4492
64C2 006E      00210         db      0x6e, 0x00      ; delay=0.4753
64C4 0068      00211         db      0x68, 0x00      ; delay=0.5024
64C6 0062      00212         db      0x62, 0x00      ; delay=0.5308
64C8 005D      00213         db      0x5d, 0x00      ; delay=0.5603
64CA 0058      00214         db      0x58, 0x00      ; delay=0.5910
64CC 0054      00215         db      0x54, 0x00      ; delay=0.6231
64CE 004F      00216         db      0x4f, 0x00      ; delay=0.6565
64D0 004B      00217         db      0x4b, 0x00      ; delay=0.6913
64D2 0048      00218         db      0x48, 0x00      ; delay=0.7275
64D4 0044      00219         db      0x44, 0x00      ; delay=0.7653
64D6 0041      00220         db      0x41, 0x00      ; delay=0.8046
64D8 003E      00221         db      0x3e, 0x00      ; delay=0.8456
64DA 003B      00222         db      0x3b, 0x00      ; delay=0.8883
64DC 0038      00223         db      0x38, 0x00      ; delay=0.9328
64DE 0035      00224         db      0x35, 0x00      ; delay=0.9792
64E0 0033      00225         db      0x33, 0x00      ; delay=1.0276
64E2 0030      00226         db      0x30, 0x00      ; delay=1.0780
64E4 002E      00227         db      0x2e, 0x00      ; delay=1.1305
64E6 002C      00228         db      0x2c, 0x00      ; delay=1.1854
64E8 002A      00229         db      0x2a, 0x00      ; delay=1.2425
64EA 0028      00230         db      0x28, 0x00      ; delay=1.3021
64EC 0026      00231         db      0x26, 0x00      ; delay=1.3643
64EE 0024      00232         db      0x24, 0x00      ; delay=1.4292
64F0 0023      00233         db      0x23, 0x00      ; delay=1.4970
64F2 0021      00234         db      0x21, 0x00      ; delay=1.5677
64F4 001F      00235         db      0x1f, 0x00      ; delay=1.6415
64F6 001E      00236         db      0x1e, 0x00      ; delay=1.7186
64F8 001D      00237         db      0x1d, 0x00      ; delay=1.7991
64FA 001B      00238         db      0x1b, 0x00      ; delay=1.8832
64FC 001A      00239         db      0x1a, 0x00      ; delay=1.9710
64FE 0019      00240         db      0x19, 0x00      ; delay=2.0629
6500 0018      00241         db      0x18, 0x00      ; delay=2.1589
6502 0017      00242         db      0x17, 0x00      ; delay=2.2592
6504 0016      00243         db      0x16, 0x00      ; delay=2.3642
6506 0015      00244         db      0x15, 0x00      ; delay=2.4740
6508 0014      00245         db      0x14, 0x00      ; delay=2.5890
650A 0013      00246         db      0x13, 0x00      ; delay=2.7092
650C 0012      00247         db      0x12, 0x00      ; delay=2.8352
650E 0011      00248         db      0x11, 0x00      ; delay=2.9670
6510 0010      00249         db      0x10, 0x00      ; delay=3.1051
6512 0010      00250         db      0x10, 0x00      ; delay=3.2498
6514 000F      00251         db      0x0f, 0x00      ; delay=3.4015
6516 000E      00252         db      0x0e, 0x00      ; delay=3.5605
6518 000E      00253         db      0x0e, 0x00      ; delay=3.7272
651A 000D      00254         db      0x0d, 0x00      ; delay=3.9020
651C 000C      00255         db      0x0c, 0x00      ; delay=4.0855
651E 000C      00256         db      0x0c, 0x00      ; delay=4.2781
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 250


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6520 000B      00257         db      0x0b, 0x00      ; delay=4.4802
6522 000B      00258         db      0x0b, 0x00      ; delay=4.6925
6524 000A      00259         db      0x0a, 0x00      ; delay=4.9155
6526 000A      00260         db      0x0a, 0x00      ; delay=5.1498
6528 0009      00261         db      0x09, 0x00      ; delay=5.3961
652A 0009      00262         db      0x09, 0x00      ; delay=5.6550
652C 0008      00263         db      0x08, 0x00      ; delay=5.9273
652E 0008      00264         db      0x08, 0x00      ; delay=6.2138
6530 0008      00265         db      0x08, 0x00      ; delay=6.5153
6532 0007      00266         db      0x07, 0x00      ; delay=6.8327
6534 0007      00267         db      0x07, 0x00      ; delay=7.1670
6536 0006      00268         db      0x06, 0x00      ; delay=7.5190
6538 0006      00269         db      0x06, 0x00      ; delay=7.8900
653A 0006      00270         db      0x06, 0x00      ; delay=8.2811
653C 0006      00271         db      0x06, 0x00      ; delay=8.6934
653E 0005      00272         db      0x05, 0x00      ; delay=9.1283
6540 0005      00273         db      0x05, 0x00      ; delay=9.5871
6542 0005      00274         db      0x05, 0x00      ; delay=10.0714
6544 0004      00275         db      0x04, 0x00      ; delay=10.5827
6546 0004      00276         db      0x04, 0x00      ; delay=11.1227
6548 0004      00277         db      0x04, 0x00      ; delay=11.6932
654A 0004      00278         db      0x04, 0x00      ; delay=12.2961
654C 0004      00279         db      0x04, 0x00      ; delay=12.9335
654E 0003      00280         db      0x03, 0x00      ; delay=13.6076
6550 0003      00281         db      0x03, 0x00      ; delay=14.3208
6552 0003      00282         db      0x03, 0x00      ; delay=15.0756
6554 0003      00283         db      0x03, 0x00      ; delay=15.8746
6556 0003      00284         db      0x03, 0x00      ; delay=16.7207
6558 0002      00285         db      0x02, 0x00      ; delay=17.6171
655A 0002      00286         db      0x02, 0x00      ; delay=18.5671
655C 0002      00287         db      0x02, 0x00      ; delay=19.5742
655E 0002      00288         db      0x02, 0x00      ; delay=20.6422
6560 0002      00289         db      0x02, 0x00      ; delay=21.7753
6562 0002      00290         db      0x02, 0x00      ; delay=22.9777
6564 0002      00291         db      0x02, 0x00      ; delay=24.2542
6566 0002      00292         db      0x02, 0x00      ; delay=25.6098
6568 0001      00293         db      0x01, 0x00      ; delay=27.0500
656A 0001      00294         db      0x01, 0x00      ; dummy
               00393 #include "tia_lfo_table.inc"
               00001 ; $Id: tia_lfo_table.inc 111 2008-02-22 00:41:21Z tk $
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; LFO Table
               00005 ; generated with lfo_frq.pl - calculates sweep from 0.001 Hz to 50 Hz
               00006 ;
               00007 ; ==========================================================================
               00008 ;
               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 ;; --------------------------------------------------------------------------
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 251


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00016 ;; In: index (0x00-0x7f) in WREG
               00017 ;; Out: CTR value in WREG and MIOS_PARAMETER1, ADD value in MIOS_PARAMETER2
               00018 ;; --------------------------------------------------------------------------
656C 00019 TIA_LFO_TABLE_Get
656C 90D8      00020         clrc
656E 34E8      00021         rlf     WREG, W
6570 0F88      00022         addlw   TIA_LFO_TABLE & 0xff
6572 6EF6      00023         movwf   TBLPTRL
6574 6AF7      00024         clrf    TBLPTRH
6576 0E65      00025         movlw   TIA_LFO_TABLE >> 8
6578 22F7      00026         addwfc  TBLPTRH, F
               00027 
657A 0009      00028         tblrd*+
657C CFF5 F004 00029         movff   TABLAT, MIOS_PARAMETER2 ; -> ADD value
6580 0009      00030         tblrd*+
6582 50F5      00031         movf    TABLAT, W
6584 6E03      00032         movwf   MIOS_PARAMETER1         ; -> CTR value
6586 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
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 252


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00124 ;  88 | 13.204 |   2 |  11 | 13.428
               00125 ;  89 | 13.644 |   2 |  11 | 13.428
               00126 ;  90 | 14.097 |   3 |  17 | 13.835
               00127 ;  91 | 14.565 |   1 |   6 | 14.648
               00128 ;  92 | 15.047 |   4 |  25 | 15.259
               00129 ;  93 | 15.544 |   2 |  13 | 15.869
               00130 ;  94 | 16.056 |   2 |  13 | 15.869
               00131 ;  95 | 16.584 |   3 |  20 | 16.276
               00132 ;  96 | 17.129 |   1 |   7 | 17.090
               00133 ;  97 | 17.690 |   3 |  22 | 17.904
               00134 ;  98 | 18.269 |   2 |  15 | 18.311
               00135 ;  99 | 18.866 |   3 |  23 | 18.717
               00136 ; 100 | 19.481 |   1 |   8 | 19.531
               00137 ; 101 | 20.115 |   3 |  25 | 20.345
               00138 ; 102 | 20.769 |   2 |  17 | 20.752
               00139 ; 103 | 21.443 |   1 |   9 | 21.973
               00140 ; 104 | 22.139 |   1 |   9 | 21.973
               00141 ; 105 | 22.855 |   2 |  19 | 23.193
               00142 ; 106 | 23.594 |   2 |  19 | 23.193
               00143 ; 107 | 24.356 |   1 |  10 | 24.414
               00144 ; 108 | 25.141 |   2 |  21 | 25.635
               00145 ; 109 | 25.950 |   2 |  21 | 25.635
               00146 ; 110 | 26.785 |   1 |  11 | 26.855
               00147 ; 111 | 27.646 |   2 |  23 | 28.076
               00148 ; 112 | 28.533 |   2 |  23 | 28.076
               00149 ; 113 | 29.447 |   1 |  12 | 29.297
               00150 ; 114 | 30.390 |   2 |  25 | 30.518
               00151 ; 115 | 31.362 |   1 |  13 | 31.738
               00152 ; 116 | 32.365 |   1 |  13 | 31.738
               00153 ; 117 | 33.398 |   1 |  14 | 34.180
               00154 ; 118 | 34.463 |   1 |  14 | 34.180
               00155 ; 119 | 35.562 |   2 |  29 | 35.400
               00156 ; 120 | 36.694 |   1 |  15 | 36.621
               00157 ; 121 | 37.861 |   2 |  31 | 37.842
               00158 ; 122 | 39.065 |   1 |  16 | 39.062
               00159 ; 123 | 40.306 |   2 |  33 | 40.283
               00160 ; 124 | 41.585 |   1 |  17 | 41.504
               00161 ; 125 | 42.904 |   1 |  18 | 43.945
               00162 ; 126 | 44.263 |   1 |  18 | 43.945
               00163 ; 127 | 45.665 |   1 |  19 | 46.387
               00164 
6588 00165 TIA_LFO_TABLE
6588 FF01      00166         db      0x01, 0xff      ; ADD/CTR for frq=  0.00
658A FF01      00167         db      0x01, 0xff      ; ADD/CTR for frq=  0.00
658C 4D01      00168         db      0x01, 0x4d      ; ADD/CTR for frq=  0.03
658E 2601      00169         db      0x01, 0x26      ; ADD/CTR for frq=  0.06
6590 1901      00170         db      0x01, 0x19      ; ADD/CTR for frq=  0.10
6592 1301      00171         db      0x01, 0x13      ; ADD/CTR for frq=  0.13
6594 0F01      00172         db      0x01, 0x0f      ; ADD/CTR for frq=  0.16
6596 0C01      00173         db      0x01, 0x0c      ; ADD/CTR for frq=  0.20
6598 1502      00174         db      0x02, 0x15      ; ADD/CTR for frq=  0.23
659A 0901      00175         db      0x01, 0x09      ; ADD/CTR for frq=  0.27
659C 1703      00176         db      0x03, 0x17      ; ADD/CTR for frq=  0.32
659E 0701      00177         db      0x01, 0x07      ; ADD/CTR for frq=  0.35
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 254


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
65A0 0601      00178         db      0x01, 0x06      ; ADD/CTR for frq=  0.41
65A2 0B02      00179         db      0x02, 0x0b      ; ADD/CTR for frq=  0.44
65A4 0501      00180         db      0x01, 0x05      ; ADD/CTR for frq=  0.49
65A6 0902      00181         db      0x02, 0x09      ; ADD/CTR for frq=  0.54
65A8 1104      00182         db      0x04, 0x11      ; ADD/CTR for frq=  0.57
65AA 1305      00183         db      0x05, 0x13      ; ADD/CTR for frq=  0.64
65AC 0B03      00184         db      0x03, 0x0b      ; ADD/CTR for frq=  0.67
65AE 0A03      00185         db      0x03, 0x0a      ; ADD/CTR for frq=  0.73
65B0 1306      00186         db      0x06, 0x13      ; ADD/CTR for frq=  0.77
65B2 1407      00187         db      0x07, 0x14      ; ADD/CTR for frq=  0.85
65B4 0803      00188         db      0x03, 0x08      ; ADD/CTR for frq=  0.92
65B6 0502      00189         db      0x02, 0x05      ; ADD/CTR for frq=  0.98
65B8 0C05      00190         db      0x05, 0x0c      ; ADD/CTR for frq=  1.02
65BA 0904      00191         db      0x04, 0x09      ; ADD/CTR for frq=  1.09
65BC 0D06      00192         db      0x06, 0x0d      ; ADD/CTR for frq=  1.13
65BE 0201      00193         db      0x01, 0x02      ; ADD/CTR for frq=  1.22
65C0 0F08      00194         db      0x08, 0x0f      ; ADD/CTR for frq=  1.30
65C2 0905      00195         db      0x05, 0x09      ; ADD/CTR for frq=  1.36
65C4 0704      00196         db      0x04, 0x07      ; ADD/CTR for frq=  1.40
65C6 0503      00197         db      0x03, 0x05      ; ADD/CTR for frq=  1.46
65C8 0B07      00198         db      0x07, 0x0b      ; ADD/CTR for frq=  1.55
65CA 0302      00199         db      0x02, 0x03      ; ADD/CTR for frq=  1.63
65CC 0705      00200         db      0x05, 0x07      ; ADD/CTR for frq=  1.74
65CE 0403      00201         db      0x03, 0x04      ; ADD/CTR for frq=  1.83
65D0 0504      00202         db      0x04, 0x05      ; ADD/CTR for frq=  1.95
65D2 0504      00203         db      0x04, 0x05      ; ADD/CTR for frq=  1.95
65D4 0706      00204         db      0x06, 0x07      ; ADD/CTR for frq=  2.09
65D6 0807      00205         db      0x07, 0x08      ; ADD/CTR for frq=  2.14
65D8 0C0B      00206         db      0x0b, 0x0c      ; ADD/CTR for frq=  2.24
65DA 0101      00207         db      0x01, 0x01      ; ADD/CTR for frq=  2.44
65DC 0101      00208         db      0x01, 0x01      ; ADD/CTR for frq=  2.44
65DE 0B0C      00209         db      0x0c, 0x0b      ; ADD/CTR for frq=  2.66
65E0 0809      00210         db      0x09, 0x08      ; ADD/CTR for frq=  2.75
65E2 0607      00211         db      0x07, 0x06      ; ADD/CTR for frq=  2.85
65E4 0506      00212         db      0x06, 0x05      ; ADD/CTR for frq=  2.93
65E6 0405      00213         db      0x05, 0x04      ; ADD/CTR for frq=  3.05
65E8 0304      00214         db      0x04, 0x03      ; ADD/CTR for frq=  3.26
65EA 0304      00215         db      0x04, 0x03      ; ADD/CTR for frq=  3.26
65EC 0507      00216         db      0x07, 0x05      ; ADD/CTR for frq=  3.42
65EE 0203      00217         db      0x03, 0x02      ; ADD/CTR for frq=  3.66
65F0 0203      00218         db      0x03, 0x02      ; ADD/CTR for frq=  3.66
65F2 0508      00219         db      0x08, 0x05      ; ADD/CTR for frq=  3.91
65F4 0305      00220         db      0x05, 0x03      ; ADD/CTR for frq=  4.07
65F6 0407      00221         db      0x07, 0x04      ; ADD/CTR for frq=  4.27
65F8 0407      00222         db      0x07, 0x04      ; ADD/CTR for frq=  4.27
65FA 060B      00223         db      0x0b, 0x06      ; ADD/CTR for frq=  4.48
65FC 080F      00224         db      0x0f, 0x08      ; ADD/CTR for frq=  4.58
65FE 0102      00225         db      0x02, 0x01      ; ADD/CTR for frq=  4.88
6600 0913      00226         db      0x13, 0x09      ; ADD/CTR for frq=  5.15
6602 060D      00227         db      0x0d, 0x06      ; ADD/CTR for frq=  5.29
6604 0409      00228         db      0x09, 0x04      ; ADD/CTR for frq=  5.49
6606 0307      00229         db      0x07, 0x03      ; ADD/CTR for frq=  5.70
6608 0307      00230         db      0x07, 0x03      ; ADD/CTR for frq=  5.70
660A 0205      00231         db      0x05, 0x02      ; ADD/CTR for frq=  6.10
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 255


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
660C 050D      00232         db      0x0d, 0x05      ; ADD/CTR for frq=  6.35
660E 0308      00233         db      0x08, 0x03      ; ADD/CTR for frq=  6.51
6610 040B      00234         db      0x0b, 0x04      ; ADD/CTR for frq=  6.71
6612 050E      00235         db      0x0e, 0x05      ; ADD/CTR for frq=  6.84
6614 0103      00236         db      0x03, 0x01      ; ADD/CTR for frq=  7.32
6616 0103      00237         db      0x03, 0x01      ; ADD/CTR for frq=  7.32
6618 0510      00238         db      0x10, 0x05      ; ADD/CTR for frq=  7.81
661A 030A      00239         db      0x0a, 0x03      ; ADD/CTR for frq=  8.14
661C 030A      00240         db      0x0a, 0x03      ; ADD/CTR for frq=  8.14
661E 0207      00241         db      0x07, 0x02      ; ADD/CTR for frq=  8.54
6620 030B      00242         db      0x0b, 0x03      ; ADD/CTR for frq=  8.95
6622 030B      00243         db      0x0b, 0x03      ; ADD/CTR for frq=  8.95
6624 0513      00244         db      0x13, 0x05      ; ADD/CTR for frq=  9.28
6626 0104      00245         db      0x04, 0x01      ; ADD/CTR for frq=  9.77
6628 0411      00246         db      0x11, 0x04      ; ADD/CTR for frq= 10.38
662A 030D      00247         db      0x0d, 0x03      ; ADD/CTR for frq= 10.58
662C 0209      00248         db      0x09, 0x02      ; ADD/CTR for frq= 10.99
662E 0209      00249         db      0x09, 0x02      ; ADD/CTR for frq= 10.99
6630 030E      00250         db      0x0e, 0x03      ; ADD/CTR for frq= 11.39
6632 0105      00251         db      0x05, 0x01      ; ADD/CTR for frq= 12.21
6634 0105      00252         db      0x05, 0x01      ; ADD/CTR for frq= 12.21
6636 0310      00253         db      0x10, 0x03      ; ADD/CTR for frq= 13.02
6638 020B      00254         db      0x0b, 0x02      ; ADD/CTR for frq= 13.43
663A 020B      00255         db      0x0b, 0x02      ; ADD/CTR for frq= 13.43
663C 0311      00256         db      0x11, 0x03      ; ADD/CTR for frq= 13.83
663E 0106      00257         db      0x06, 0x01      ; ADD/CTR for frq= 14.65
6640 0419      00258         db      0x19, 0x04      ; ADD/CTR for frq= 15.26
6642 020D      00259         db      0x0d, 0x02      ; ADD/CTR for frq= 15.87
6644 020D      00260         db      0x0d, 0x02      ; ADD/CTR for frq= 15.87
6646 0314      00261         db      0x14, 0x03      ; ADD/CTR for frq= 16.28
6648 0107      00262         db      0x07, 0x01      ; ADD/CTR for frq= 17.09
664A 0316      00263         db      0x16, 0x03      ; ADD/CTR for frq= 17.90
664C 020F      00264         db      0x0f, 0x02      ; ADD/CTR for frq= 18.31
664E 0317      00265         db      0x17, 0x03      ; ADD/CTR for frq= 18.72
6650 0108      00266         db      0x08, 0x01      ; ADD/CTR for frq= 19.53
6652 0319      00267         db      0x19, 0x03      ; ADD/CTR for frq= 20.35
6654 0211      00268         db      0x11, 0x02      ; ADD/CTR for frq= 20.75
6656 0109      00269         db      0x09, 0x01      ; ADD/CTR for frq= 21.97
6658 0109      00270         db      0x09, 0x01      ; ADD/CTR for frq= 21.97
665A 0213      00271         db      0x13, 0x02      ; ADD/CTR for frq= 23.19
665C 0213      00272         db      0x13, 0x02      ; ADD/CTR for frq= 23.19
665E 010A      00273         db      0x0a, 0x01      ; ADD/CTR for frq= 24.41
6660 0215      00274         db      0x15, 0x02      ; ADD/CTR for frq= 25.63
6662 0215      00275         db      0x15, 0x02      ; ADD/CTR for frq= 25.63
6664 010B      00276         db      0x0b, 0x01      ; ADD/CTR for frq= 26.86
6666 0217      00277         db      0x17, 0x02      ; ADD/CTR for frq= 28.08
6668 0217      00278         db      0x17, 0x02      ; ADD/CTR for frq= 28.08
666A 010C      00279         db      0x0c, 0x01      ; ADD/CTR for frq= 29.30
666C 0219      00280         db      0x19, 0x02      ; ADD/CTR for frq= 30.52
666E 010D      00281         db      0x0d, 0x01      ; ADD/CTR for frq= 31.74
6670 010D      00282         db      0x0d, 0x01      ; ADD/CTR for frq= 31.74
6672 010E      00283         db      0x0e, 0x01      ; ADD/CTR for frq= 34.18
6674 010E      00284         db      0x0e, 0x01      ; ADD/CTR for frq= 34.18
6676 021D      00285         db      0x1d, 0x02      ; ADD/CTR for frq= 35.40
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 256


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
6678 010F      00286         db      0x0f, 0x01      ; ADD/CTR for frq= 36.62
667A 021F      00287         db      0x1f, 0x02      ; ADD/CTR for frq= 37.84
667C 0110      00288         db      0x10, 0x01      ; ADD/CTR for frq= 39.06
667E 0221      00289         db      0x21, 0x02      ; ADD/CTR for frq= 40.28
6680 0111      00290         db      0x11, 0x01      ; ADD/CTR for frq= 41.50
6682 0112      00291         db      0x12, 0x01      ; ADD/CTR for frq= 43.95
6684 0112      00292         db      0x12, 0x01      ; ADD/CTR for frq= 43.95
6686 0113      00293         db      0x13, 0x01      ; ADD/CTR for frq= 46.39
6688 0113      00294         db      0x13, 0x01      ; dummy
               00394 ;#include "tia_note_table.inc"
               00395 
               00396 
               00397 
               00398 ;; these three tables are now included from the mios_tables.inc file
               00399 ;; to save code space
               00400         ;; #include "tia_frq_table.inc"
               00401         ;; #include "tia_sin_table.inc"
               00402         ;; #include "tia_depth_table.inc"
               00403 
               00404 ;; ---[ TIA EEPROM content ]---
               00405 #include "tia_presets.inc"
               00001 ; $Id: tia_presets.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Presets (EEPROM content)
               00005 ;
               00006 ; ==========================================================================
               00007 ;
               00008 ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
               00009 ;  Licensed for personal non-commercial use only.
               00010 ;  All other rights reserved.
               00011 ; 
               00012 ; ==========================================================================
               00013 
               00014         ERRORLEVEL      -220    ; suppress "Address exceeds maximum range for this processor."
               00015         ;; this is (unfortunately) required for gpasm
               00016 
               00017 ;; ==========================================================================
               00018 ;; default patch
               00019 ;; ==========================================================================
F00000           00020         org     0xf00000        ; eeprom base address
F00000 00021 EEPROM_PATCH
               00022 #include "src/tia_preset_p.inc"
               00001 ; $Id: tia_preset_p.inc bdupeyron.tech@gmail.com(Antichambre)
               00002 ;
               00003 ; MIDIbox TIA
               00004 ; Patch Preset (EEPROM content)
               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 ; 
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 257


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00012 ; ==========================================================================
F00000 00013 EEPROM_PATCH_PATCHNAME
F00000 6E49 6574 00014         de      'I','n','t','e','r','n','a','l',' ','P','a','t','c','h',' ',' '
     6E72 6C61 
     5020 7461 
     6863 2020 
               00015 
               00016 ;; NOTE: due to a bug in the PIC18F assembler, we have to define the presets on a very laborious way
               00017 
F00010 007F      00018 EEPROM_PATCH_MASTER_VOLUME                        de 0x7f, 0x00   ;; 0x10
F00012 00019 EEPROM_PATCH_POLY                                 ;de 0x00        ;; 0x11
F00012 0000      00020 EEPROM_PATCH_SUSKEY                               de 0x00, 0x00   ;; 0x12
F00014 00021 EEPROM_PATCH_ENVx_CURVES                          ;de 0x00                ;; 0x13
F00014 0000      00022 EEPROM_PATCH_MIDI_SYNC                            de 0x00, 0x00   ;; 0x14
F00016 00023 EEPROM_PATCH_MOD_SYNC                             ;de 0x00        ;; 0x15
F00016 0000      00024 EEPROM_PATCH_FREE1                                de 0x00, 0x00   ;; 0x16
F00018 00025 EEPROM_PATCH_FREE2                                ;de 0x00        ;; 0x17
F00018 0000      00026 EEPROM_PATCH_FREE3                                de 0x00, 0x00   ;; 0x18
F0001A 00027 EEPROM_PATCH_FREE4                                ;de 0x00        ;; 0x19
F0001A 0000      00028 EEPROM_PATCH_MODULATION_ASSIGN                    de 0x00, 0x00   ;; 0x1a
F0001C 00029 EEPROM_PATCH_MODULATION_INIT                      ;de 0x00        ;; 0x1b
F0001C 007F      00030 EEPROM_PATCH_MODULATION_DEPTH                     de 0x7f, 0x00   ;; 0x1c
F0001E 00031 EEPROM_PATCH_AFTERTOUCH_ASSIGN                    ;de 0x00        ;; 0x1d
F0001E 7F00      00032 EEPROM_PATCH_AFTERTOUCH_INIT                      de 0x00, 0x7f   ;; 0x1e
F00020 00033 EEPROM_PATCH_AFTERTOUCH_DEPTH                     ;de 0x7f        ;; 0x1f
               00034 
F00020 407F      00035 EEPROM_PATCH_VOICE1_VOLUME                        de 0x7f, 0x40 ;; 0x20
F00022 00036 EEPROM_PATCH_VOICE1_TRANSPOSE                     ;de 0x40        ;; 0x21
F00022 0004      00037 EEPROM_PATCH_VOICE1_WAVEFORM                      de 0x04, 0x00 ;; 0x22
F00024 00038 EEPROM_PATCH_VOICE1_MODE                          ;de 0x00        ;; 0x23
F00024 0002      00039 EEPROM_PATCH_VOICE1_PITCHRANGE                    de 0x02, 0x00 ;; 0x24
F00026 00040 EEPROM_PATCH_VOICE1_PORTAMENTO                    ;de 0x00        ;; 0x25
F00026 0000      00041 EEPROM_PATCH_VOICE1_ARPEGGIATOR                   de 0x00, 0x00   ;; 0x26
F00028 00042 EEPROM_PATCH_VOICE1_DELAY                         ;de 0x00        ;; 0x27
F00028 1F18      00043 EEPROM_PATCH_VOICE1_KEY_OFFSET                    de 0x18, 0x1f   ;; 0x28
F0002A 00044 EEPROM_PATCH_VOICE1_KEY_LENGTH                    ;de 0x1f              ;; 0x29
F0002A 0000      00045 EEPROM_PATCH_VOICE1_SPLIT_LOWER                   de 0x00, 0x00 ;; 0x2a
F0002C 00046 EEPROM_PATCH_VOICE1_SPLIT_UPPER                   ;de 0x00        ;; 0x2b
F0002C 0000      00047 EEPROM_PATCH_VOICE1_VEL_ASSIGN                    de 0x00, 0x00   ;; 0x2c
F0002E 00048 EEPROM_PATCH_VOICE1_VEL_INIT                      ;de 0x00              ;; 0x2d
F0002E 007F      00049 EEPROM_PATCH_VOICE1_VEL_DEPTH                     de 0x7f, 0x00 ;; 0x2e
F00030 00050 EEPROM_PATCH_VOICE1_ENV_OPTION                    ;de 0x00        ;; 0x2f
F00030 4040      00051 EEPROM_PATCH_VOICE1_ENV_DEPTH                     de 0x40, 0x40 ;; 0x30
F00032 00052 EEPROM_PATCH_VOICE1_ENV_CURVE                     ;de 0x40              ;; 0x31
F00032 7F00      00053 EEPROM_PATCH_VOICE1_ENV_ATTACK                    de 0x00, 0x7f   ;; 0x32
F00034 00054 EEPROM_PATCH_VOICE1_ENV_DECAY                     ;de 0x7f        ;; 0x33
F00034 007F      00055 EEPROM_PATCH_VOICE1_ENV_SUSTAIN                   de 0x7f, 0x00   ;; 0x34
F00036 00056 EEPROM_PATCH_VOICE1_ENV_RELEASE                   ;de 0x00        ;; 0x35
F00036 0000      00057 EEPROM_PATCH_VOICE1_OPTIONS                       de 0x00, 0x00 ;; 0x36
F00038 00058 EEPROM_PATCH_VOICE1_WBANK                         ;de 0x00        ;; 0x37
F00038 0000      00059 EEPROM_PATCH_VOICE1_WT                            de 0x00, 0x00   ;; 0x38
F0003A 00060 EEPROM_PATCH_VOICE1_WT_RATE                       ;de 0x10        ;; 0x39
F0003A 0000      00061 EEPROM_PATCH_VOICE1_KBANK                         de 0x00, 0x00 ;; 0x3a
F0003C 00062 EEPROM_PATCH_VOICE1_KIT                           ;de 0x00        ;; 0x5b
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 258


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F0003C 0000      00063 EEPROM_PATCH_VOICE1_MOD2AMP                       de 0x00, 0x00 ;; 0x5c
F0003E 00064 EEPROM_PATCH_VOICE1_MOD2PITCH                     ;de 0x00        ;; 0x3d
F0003E 0000      00065 EEPROM_PATCH_VOICE1_FREE2                         de 0x00, 0x00 ;; 0x3e
F00040 00066 EEPROM_PATCH_VOICE1_FREE3                         ;de 0x00        ;; 0x3f
               00067 
F00040 407F      00068 EEPROM_PATCH_VOICE2_VOLUME                        de 0x7f, 0x40 ;; 0x40
F00042 00069 EEPROM_PATCH_VOICE2_TRANSPOSE                     ;de 0x40        ;; 0x41
F00042 0000      00070 EEPROM_PATCH_VOICE2_WAVEFORM                      de 0x00, 0x00 ;; 0x42
F00044 00071 EEPROM_PATCH_VOICE2_MODE                          ;de 0x00        ;; 0x43
F00044 0002      00072 EEPROM_PATCH_VOICE2_PITCHRANGE                    de 0x02, 0x00 ;; 0x44
F00046 00073 EEPROM_PATCH_VOICE2_PORTAMENTO                    ;de 0x00        ;; 0x45
F00046 0000      00074 EEPROM_PATCH_VOICE2_ARPEGGIATOR                   de 0x00, 0x00   ;; 0x46
F00048 00075 EEPROM_PATCH_VOICE2_DELAY                         ;de 0x00        ;; 0x47
F00048 1F3C      00076 EEPROM_PATCH_VOICE2_KEY_OFFSET                    de 0x3c, 0x1f   ;; 0x48
F0004A 00077 EEPROM_PATCH_VOICE2_KEY_LENGTH                    ;de 0x1f              ;; 0x49
F0004A 0000      00078 EEPROM_PATCH_VOICE2_SPLIT_LOWER                   de 0x00, 0x00 ;; 0x4a
F0004C 00079 EEPROM_PATCH_VOICE2_SPLIT_UPPER                   ;de 0x00        ;; 0x4b
F0004C 0000      00080 EEPROM_PATCH_VOICE2_VEL_ASSIGN                    de 0x00, 0x00   ;; 0x4c
F0004E 00081 EEPROM_PATCH_VOICE2_VEL_INIT                      ;de 0x00              ;; 0x4d
F0004E 007F      00082 EEPROM_PATCH_VOICE2_VEL_DEPTH                     de 0x7f, 0x00 ;; 0x4e
F00050 00083 EEPROM_PATCH_VOICE2_ENV_OPTION                    ;de 0x00        ;; 0x4f
F00050 4040      00084 EEPROM_PATCH_VOICE2_ENV_DEPTH                     de 0x40, 0x40 ;; 0x50
F00052 00085 EEPROM_PATCH_VOICE2_ENV_CURVE                     ;de 0x40              ;; 0x51
F00052 7F00      00086 EEPROM_PATCH_VOICE2_ENV_ATTACK                    de 0x00, 0x7f   ;; 0x52
F00054 00087 EEPROM_PATCH_VOICE2_ENV_DECAY                     ;de 0x7f        ;; 0x53
F00054 007F      00088 EEPROM_PATCH_VOICE2_ENV_SUSTAIN                   de 0x7f, 0x00   ;; 0x54
F00056 00089 EEPROM_PATCH_VOICE2_ENV_RELEASE                   ;de 0x00        ;; 0x55
F00056 0000      00090 EEPROM_PATCH_VOICE2_OPTIONS                       de 0x00, 0x00 ;; 0x56
F00058 00091 EEPROM_PATCH_VOICE2_WBANK                         ;de 0x00        ;; 0x57
F00058 0000      00092 EEPROM_PATCH_VOICE2_WT                            de 0x00, 0x00   ;; 0x58
F0005A 00093 EEPROM_PATCH_VOICE2_WT_RATE                       ;de 0x10        ;; 0x59
F0005A 0000      00094 EEPROM_PATCH_VOICE2_KBANK                         de 0x00, 0x00 ;; 0x5a
F0005C 00095 EEPROM_PATCH_VOICE2_KIT                           ;de 0x00        ;; 0x5b
F0005C 0000      00096 EEPROM_PATCH_VOICE2_MOD2AMP                       de 0x00, 0x00 ;; 0x5c
F0005E 00097 EEPROM_PATCH_VOICE2_MOD2PITCH                     ;de 0x00        ;; 0x5d
F0005E 0000      00098 EEPROM_PATCH_VOICE2_FREE2                         de 0x00, 0x00 ;; 0x5e
F00060 00099 EEPROM_PATCH_VOICE2_FREE3                         ;de 0x00        ;; 0x5f
               00100 
F00060 1007      00101 EEPROM_PATCH_LFO1_MODE                            de 0x07, 0x10 ;; 0x60
F00062 00102 EEPROM_PATCH_LFO1_RATE                            ;de 0x10        ;; 0x61
F00062 077F      00103 EEPROM_PATCH_LFO1_DEPTH                           de 0x7f, 0x07 ;; 0x62
F00064 00104 EEPROM_PATCH_LFO2_MODE                            ;de 0x07        ;; 0x63
F00064 0020      00105 EEPROM_PATCH_LFO2_RATE                            de 0x20, 0x00 ;; 0x64
F00066 00106 EEPROM_PATCH_LFO2_DEPTH                           ;de 0x00        ;; 0x65
F00066 0301      00107 EEPROM_PATCH_LFO3_MODE                            de 0x01, 0x03 ;; 0x66
F00068 00108 EEPROM_PATCH_LFO3_RATE                            ;de 0x03        ;; 0x67
F00068 017F      00109 EEPROM_PATCH_LFO3_DEPTH                           de 0x7f, 0x01 ;; 0x68
F0006A 00110 EEPROM_PATCH_LFO4_MODE                            ;de 0x01        ;; 0x69
F0006A 0040      00111 EEPROM_PATCH_LFO4_RATE                            de 0x40, 0x00 ;; 0x6a
F0006C 00112 EEPROM_PATCH_LFO4_DEPTH                           ;de 0x00        ;; 0x6b
               00113 
F0006C 407F      00114 EEPROM_PATCH_ENV1_DEPTH                           de 0x7f, 0x40 ;; 0x6c 
F0006E 00115 EEPROM_PATCH_ENV1_CURVE                           ;de 0x40        ;; 0x6d
F0006E 4040      00116 EEPROM_PATCH_ENV1_ATTACK                          de 0x40, 0x40   ;; 0x6e
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 259


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


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
F0011A 0000      00023 EEPROM_KIT_WT_RATE_2                              de 0x00, 0x00   ;; 0x10
F0011C 00024 EEPROM_KIT_ENVx_CURVE_2                           ;de 0x40        ;; 0x73
F0011C 6060      00025 EEPROM_KIT_ENVx_ATTACK_2                          de 0x60, 0x60 ;; 0x74
F0011E 00026 EEPROM_KIT_ENVx_DECAY_2                           ;de 0x60        ;; 0x75
F0011E 4020      00027 EEPROM_KIT_ENVx_SUSTAIN_2                         de 0x20, 0x40 ;; 0x76
F00120 00028 EEPROM_KIT_ENVx_RELEASE_2                         ;de 0x40        ;; 0x77
               00029 
F00120 007F      00030 EEPROM_KIT_WAVETABLE_3                        de 0x7f, 0x00   ;; 0x10
F00122 0000      00031 EEPROM_KIT_WT_RATE_3                              de 0x00, 0x00   ;; 0x10
F00124 00032 EEPROM_KIT_ENVx_CURVE_3                           ;de 0x40        ;; 0x73
F00124 6060      00033 EEPROM_KIT_ENVx_ATTACK_3                          de 0x60, 0x60 ;; 0x74
F00126 00034 EEPROM_KIT_ENVx_DECAY_3                           ;de 0x60        ;; 0x75
F00126 4020      00035 EEPROM_KIT_ENVx_SUSTAIN_3                         de 0x20, 0x40 ;; 0x76
F00128 00036 EEPROM_KIT_ENVx_RELEASE_3                         ;de 0x40        ;; 0x77
               00037 
F00128 007F      00038 EEPROM_KIT_WAVETABLE_4                        de 0x7f, 0x00   ;; 0x10
F0012A 0000      00039 EEPROM_KIT_WT_RATE_4                              de 0x00, 0x00   ;; 0x10
F0012C 00040 EEPROM_KIT_ENVx_CURVE_4                           ;de 0x40        ;; 0x73
F0012C 6060      00041 EEPROM_KIT_ENVx_ATTACK_4                          de 0x60, 0x60 ;; 0x74
F0012E 00042 EEPROM_KIT_ENVx_DECAY_4                           ;de 0x60        ;; 0x75
F0012E 4020      00043 EEPROM_KIT_ENVx_SUSTAIN_4                         de 0x20, 0x40 ;; 0x76
F00130 00044 EEPROM_KIT_ENVx_RELEASE_4                         ;de 0x40        ;; 0x77
               00045 
F00130 007F      00046 EEPROM_KIT_WAVETABLE_5                        de 0x7f, 0x00   ;; 0x10
F00132 0000      00047 EEPROM_KIT_WT_RATE_5                              de 0x00, 0x00   ;; 0x10
F00134 00048 EEPROM_KIT_ENVx_CURVE_5                           ;de 0x40        ;; 0x73
F00134 6060      00049 EEPROM_KIT_ENVx_ATTACK_5                          de 0x60, 0x60 ;; 0x74
F00136 00050 EEPROM_KIT_ENVx_DECAY_5                           ;de 0x60        ;; 0x75
F00136 4020      00051 EEPROM_KIT_ENVx_SUSTAIN_5                         de 0x20, 0x40 ;; 0x76
F00138 00052 EEPROM_KIT_ENVx_RELEASE_5                         ;de 0x40        ;; 0x77
               00053 
F00138 007F      00054 EEPROM_KIT_WAVETABLE_6                        de 0x7f, 0x00   ;; 0x10
F0013A 0000      00055 EEPROM_KIT_WT_RATE_6                              de 0x00, 0x00   ;; 0x10
F0013C 00056 EEPROM_KIT_ENVx_CURVE_6                           ;de 0x40        ;; 0x73
F0013C 6060      00057 EEPROM_KIT_ENVx_ATTACK_6                          de 0x60, 0x60 ;; 0x74
F0013E 00058 EEPROM_KIT_ENVx_DECAY_6                           ;de 0x60        ;; 0x75
F0013E 4020      00059 EEPROM_KIT_ENVx_SUSTAIN_6                         de 0x20, 0x40 ;; 0x76
F00140 00060 EEPROM_KIT_ENVx_RELEASE_6                         ;de 0x40        ;; 0x77
               00061 
F00140 007F      00062 EEPROM_KIT_WAVETABLE_7                        de 0x7f, 0x00   ;; 0x10
F00142 0000      00063 EEPROM_KIT_WT_RATE_7                              de 0x00, 0x00   ;; 0x10
F00144 00064 EEPROM_KIT_ENVx_CURVE_7                           ;de 0x40        ;; 0x73
F00144 6060      00065 EEPROM_KIT_ENVx_ATTACK_7                          de 0x60, 0x60 ;; 0x74
F00146 00066 EEPROM_KIT_ENVx_DECAY_7                           ;de 0x60        ;; 0x75
F00146 4020      00067 EEPROM_KIT_ENVx_SUSTAIN_7                         de 0x20, 0x40 ;; 0x76
F00148 00068 EEPROM_KIT_ENVx_RELEASE_7                         ;de 0x40        ;; 0x77
               00069 
F00148 007F      00070 EEPROM_KIT_WAVETABLE_8                        de 0x7f, 0x00   ;; 0x10
F0014A 0000      00071 EEPROM_KIT_WT_RATE_8                              de 0x00, 0x00   ;; 0x10
F0014C 00072 EEPROM_KIT_ENVx_CURVE_8                           ;de 0x40        ;; 0x73
F0014C 6060      00073 EEPROM_KIT_ENVx_ATTACK_8                          de 0x60, 0x60 ;; 0x74
F0014E 00074 EEPROM_KIT_ENVx_DECAY_8                           ;de 0x60        ;; 0x75
F0014E 4020      00075 EEPROM_KIT_ENVx_SUSTAIN_8                         de 0x20, 0x40 ;; 0x76
F00150 00076 EEPROM_KIT_ENVx_RELEASE_8                         ;de 0x40        ;; 0x77
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 261


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE
 
               00077 
F00150 007F      00078 EEPROM_KIT_WAVETABLE_9                        de 0x7f, 0x00   ;; 0x10
F00152 0000      00079 EEPROM_KIT_WT_RATE_9                              de 0x00, 0x00   ;; 0x10
F00154 00080 EEPROM_KIT_ENVx_CURVE_9                           ;de 0x40        ;; 0x73
F00154 6060      00081 EEPROM_KIT_ENVx_ATTACK_9                          de 0x60, 0x60 ;; 0x74
F00156 00082 EEPROM_KIT_ENVx_DECAY_9                           ;de 0x60        ;; 0x75
F00156 4020      00083 EEPROM_KIT_ENVx_SUSTAIN_9                         de 0x20, 0x40 ;; 0x76
F00158 00084 EEPROM_KIT_ENVx_RELEASE_9                         ;de 0x40        ;; 0x77
               00085 
F00158 007F      00086 EEPROM_KIT_WAVETABLE_10                        de 0x7f, 0x00   ;; 0x10
F0015A 0000      00087 EEPROM_KIT_WT_RATE_10                              de 0x00, 0x00   ;; 0x10
F0015C 00088 EEPROM_KIT_ENVx_CURVE_10                           ;de 0x40        ;; 0x73
F0015C 6060      00089 EEPROM_KIT_ENVx_ATTACK_10                         de 0x60, 0x60 ;; 0x74
F0015E 00090 EEPROM_KIT_ENVx_DECAY_10                           ;de 0x60        ;; 0x75
F0015E 4020      00091 EEPROM_KIT_ENVx_SUSTAIN_10                         de 0x20, 0x40        ;; 0x76
F00160 00092 EEPROM_KIT_ENVx_RELEASE_10                         ;de 0x40        ;; 0x77
               00093 
F00160 007F      00094 EEPROM_KIT_WAVETABLE_11                        de 0x7f, 0x00   ;; 0x10
F00162 0000      00095 EEPROM_KIT_WT_RATE_11                              de 0x00, 0x00   ;; 0x10
F00164 00096 EEPROM_KIT_ENVx_CURVE_11                           ;de 0x40        ;; 0x73
F00164 6060      00097 EEPROM_KIT_ENVx_ATTACK_11                          de 0x60, 0x60        ;; 0x74
F00166 00098 EEPROM_KIT_ENVx_DECAY_11                           ;de 0x60        ;; 0x75
F00166 4020      00099 EEPROM_KIT_ENVx_SUSTAIN_11                         de 0x20, 0x40        ;; 0x76
F00168 00100 EEPROM_KIT_ENVx_RELEASE_11                         ;de 0x40        ;; 0x77
               00101 
F00168 007F      00102 EEPROM_KIT_WAVETABLE_12                        de 0x7f, 0x00   ;; 0x52
F0016A 0000      00103 EEPROM_KIT_WT_RATE_12                              de 0x00, 0x00   ;; 0x10
F0016C 00104 EEPROM_KIT_ENVx_CURVE_12                           ;de 0x40        ;; 0x53
F0016C 6060      00105 EEPROM_KIT_ENVx_ATTACK_12                          de 0x60, 0x60        ;; 0x54
F0016E 00106 EEPROM_KIT_ENVx_DECAY_12                           ;de 0x60        ;; 0x55
F0016E 4020      00107 EEPROM_KIT_ENVx_SUSTAIN_12                         de 0x20, 0x40        ;; 0x56
F00170 00108 EEPROM_KIT_ENVx_RELEASE_12                         ;de 0x40        ;; 0x57
               00109 
F00170 007F      00110 EEPROM_KIT_WAVETABLE_13                        de 0x7f, 0x00   ;; 0x58
F00172 0000      00111 EEPROM_KIT_WT_RATE_13                              de 0x00, 0x00   ;; 0x10
F00174 00112 EEPROM_KIT_ENVx_CURVE_13                           ;de 0x40        ;; 0x59
F00174 6060      00113 EEPROM_KIT_ENVx_ATTACK_13                          de 0x60, 0x60        ;; 0x5a
F00176 00114 EEPROM_KIT_ENVx_DECAY_13                           ;de 0x60        ;; 0x5b
F00176 4020      00115 EEPROM_KIT_ENVx_SUSTAIN_13                         de 0x20, 0x40        ;; 0x5c
F00178 00116 EEPROM_KIT_ENVx_RELEASE_13                         ;de 0x40        ;; 0x5d
               00117 
F00178 007F      00118 EEPROM_KIT_WAVETABLE_14                        de 0x7f, 0x00   ;; 0x5e
F0017A 0000      00119 EEPROM_KIT_WT_RATE_14                              de 0x00, 0x00   ;; 0x10
F0017C 00120 EEPROM_KIT_ENVx_CURVE_14                           ;de 0x40        ;; 0x5f
F0017C 6060      00121 EEPROM_KIT_ENVx_ATTACK_14                          de 0x60, 0x60        ;; 0x60
F0017E 00122 EEPROM_KIT_ENVx_DECAY_14                           ;de 0x60        ;; 0x61
F0017E 4020      00123 EEPROM_KIT_ENVx_SUSTAIN_14                         de 0x20, 0x40        ;; 0x62
F00180 00124 EEPROM_KIT_ENVx_RELEASE_14                         ;de 0x40        ;; 0x63
               00125 
F00180 007F      00126 EEPROM_KIT_WAVETABLE_15                        de 0x7f, 0x00   ;; 0x64
F00182 0000      00127 EEPROM_KIT_WT_RATE_15                              de 0x00, 0x00   ;; 0x10
F00184 00128 EEPROM_KIT_ENVx_CURVE_15                           ;de 0x40        ;; 0x65
F00184 6060      00129 EEPROM_KIT_ENVx_ATTACK_15                          de 0x60, 0x60        ;; 0x66
F00186 00130 EEPROM_KIT_ENVx_DECAY_15                           ;de 0x60        ;; 0x67
gpasm-0.13.7 beta               setup_tia_base.asm1-30-2014  10:42:04          PAGE 262


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


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


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.asm1-30-2014  10:42:04          PAGE 265


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.asm1-30-2014  10:42:04          PAGE 266


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.asm1-30-2014  10:42:04          PAGE 267


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.asm1-30-2014  10:42:04          PAGE 268


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.asm1-30-2014  10:42:04          PAGE 269


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                             000000