gplink-0.13.4 alpha
Copyright (c) 1998-2005 gputils project
Listing File Generated: 2-10-2007  00:55:23
 
 
Address  Value    Disassembly              Source
-------  -----    -----------              ------
                                           ;; BEGIN inserted by fixasm.pl
                                           ;; MPASM workarounds:
                                           BANKED  EQU 1
                                           ;; END inserted by fixasm.pl
                                           ;--------------------------------------------------------
                                           ; File Created by SDCC : FreeWare ANSI-C Compiler
                                           ; Version 2.5.0 #1020 (May  8 2005)
                                           ; This file generated Sat Feb 10 00:55:22 2007
                                           ;--------------------------------------------------------
                                           ; PIC16 port for the Microchip 16-bit core micros
                                           ;--------------------------------------------------------
                                           	list	p=18f452
                                           
                                           	radix dec
                                           
                                           ;--------------------------------------------------------
                                           ; extern variables in this module
                                           ;--------------------------------------------------------
                                           	extern _MIOS_BOX_CFG0
                                           	extern _MIOS_BOX_CFG1
                                           	extern _MIOS_BOX_STAT
                                           	extern _MIOS_PARAMETER1
                                           	extern _MIOS_PARAMETER2
                                           	extern _MIOS_PARAMETER3
                                           	extern _PORTAbits
                                           	extern _PORTBbits
                                           	extern _PORTCbits
                                           	extern _PORTDbits
                                           	extern _PORTEbits
                                           	extern _LATAbits
                                           	extern _LATBbits
                                           	extern _LATCbits
                                           	extern _LATDbits
                                           	extern _LATEbits
                                           	extern _TRISAbits
                                           	extern _TRISBbits
                                           	extern _TRISCbits
                                           	extern _TRISDbits
                                           	extern _TRISEbits
                                           	extern _PIE1bits
                                           	extern _PIR1bits
                                           	extern _IPR1bits
                                           	extern _PIE2bits
                                           	extern _PIR2bits
                                           	extern _IPR2bits
                                           	extern _EECON1bits
                                           	extern _RCSTAbits
                                           	extern _TXSTAbits
                                           	extern _T3CONbits
                                           	extern _CCP2CONbits
                                           	extern _CCP1CONbits
                                           	extern _ADCON1bits
                                           	extern _ADCON0bits
                                           	extern _SSPCON2bits
                                           	extern _SSPCON1bits
                                           	extern _SSPSTATbits
                                           	extern _T2CONbits
                                           	extern _T1CONbits
                                           	extern _RCONbits
                                           	extern _WDTCONbits
                                           	extern _LVDCONbits
                                           	extern _OSCCONbits
                                           	extern _T0CONbits
                                           	extern _STATUSbits
                                           	extern _INTCON3bits
                                           	extern _INTCON2bits
                                           	extern _INTCONbits
                                           	extern _STKPTRbits
                                           	extern _mclock_state
                                           	extern _mclock_pin_state
                                           	extern _mclock_ctr_24
                                           	extern _mclock_ctr_beats
                                           	extern _mclock_ctr_measures
                                           	extern _sm_button_column
                                           	extern _sm_button_row
                                           	extern _sm_button_value
                                           	extern _PORTA
                                           	extern _PORTB
                                           	extern _PORTC
                                           	extern _PORTD
                                           	extern _PORTE
                                           	extern _LATA
                                           	extern _LATB
                                           	extern _LATC
                                           	extern _LATD
                                           	extern _LATE
                                           	extern _TRISA
                                           	extern _TRISB
                                           	extern _TRISC
                                           	extern _TRISD
                                           	extern _TRISE
                                           	extern _PIE1
                                           	extern _PIR1
                                           	extern _IPR1
                                           	extern _PIE2
                                           	extern _PIR2
                                           	extern _IPR2
                                           	extern _EECON1
                                           	extern _EECON2
                                           	extern _EEDATA
                                           	extern _EEADR
                                           	extern _RCSTA
                                           	extern _TXSTA
                                           	extern _TXREG
                                           	extern _RCREG
                                           	extern _SPBRG
                                           	extern _T3CON
                                           	extern _TMR3L
                                           	extern _TMR3H
                                           	extern _CCP2CON
                                           	extern _CCPR2L
                                           	extern _CCPR2H
                                           	extern _CCP1CON
                                           	extern _CCPR1L
                                           	extern _CCPR1H
                                           	extern _ADCON1
                                           	extern _ADCON0
                                           	extern _ADRESL
                                           	extern _ADRESH
                                           	extern _SSPCON2
                                           	extern _SSPCON1
                                           	extern _SSPSTAT
                                           	extern _SSPADD
                                           	extern _SSPBUF
                                           	extern _T2CON
                                           	extern _PR2
                                           	extern _TMR2
                                           	extern _T1CON
                                           	extern _TMR1L
                                           	extern _TMR1H
                                           	extern _RCON
                                           	extern _WDTCON
                                           	extern _LVDCON
                                           	extern _OSCCON
                                           	extern _T0CON
                                           	extern _TMR0L
                                           	extern _TMR0H
                                           	extern _STATUS
                                           	extern _FSR2L
                                           	extern _FSR2H
                                           	extern _PLUSW2
                                           	extern _PREINC2
                                           	extern _POSTDEC2
                                           	extern _POSTINC2
                                           	extern _INDF2
                                           	extern _BSR
                                           	extern _FSR1L
                                           	extern _FSR1H
                                           	extern _PLUSW1
                                           	extern _PREINC1
                                           	extern _POSTDEC1
                                           	extern _POSTINC1
                                           	extern _INDF1
                                           	extern _WREG
                                           	extern _FSR0L
                                           	extern _FSR0H
                                           	extern _PLUSW0
                                           	extern _PREINC0
                                           	extern _POSTDEC0
                                           	extern _POSTINC0
                                           	extern _INDF0
                                           	extern _INTCON3
                                           	extern _INTCON2
                                           	extern _INTCON
                                           	extern _PRODL
                                           	extern _PRODH
                                           	extern _TABLAT
                                           	extern _TBLPTRL
                                           	extern _TBLPTRH
                                           	extern _TBLPTRU
                                           	extern _PCL
                                           	extern _PCLATH
                                           	extern _PCLATU
                                           	extern _STKPTR
                                           	extern _TOSL
                                           	extern _TOSH
                                           	extern _TOSU
                                           	extern _MIOS_MIDI_TxBufferPut
                                           	extern _MIOS_AIN_DeadbandSet
                                           	extern _MIOS_AIN_NumberSet
                                           	extern _MIOS_AIN_Pin7bitGet
                                           	extern _MIOS_AIN_UnMuxed
                                           	extern _MIOS_DOUT_SRSet
                                           	extern _MIOS_SRIO_NumberSet
                                           	extern _MIOS_SRIO_TS_SensitivitySet
                                           	extern _MIOS_SRIO_UpdateFrqSet
                                           	extern _MIOS_LCD_CursorSet
                                           	extern _MIOS_LCD_PrintBCD1
                                           	extern _MIOS_LCD_PrintBCD2
                                           	extern _MIOS_LCD_PrintBCD3
                                           	extern _MIOS_LCD_PrintCString
                                           	extern _MIOS_CLCD_SpecialCharsInit
                                           	extern _MCLOCK_Init
                                           	extern _MCLOCK_Tick
                                           	extern _MCLOCK_Timer
                                           	extern _MCLOCK_BPMSet
                                           	extern _MCLOCK_DoStop
                                           	extern _MCLOCK_DoPlay
                                           	extern _SM_Init
                                           	extern _SM_PrepareCol
                                           	extern _SM_GetRow
                                           	extern _SM_ButtonHandler
                                           	extern _MIOS_MPROC_EVENT_TABLE
                                           	extern _MIOS_ENC_PIN_TABLE
                                           
                                           ;--------------------------------------------------------
                                           ; public variables in this module
                                           ;--------------------------------------------------------
                                           	global _pg
                                           	global _hold2
                                           	global _hold1
                                           	global _lastep
                                           	global _pattern
                                           	global _PUSH
                                           	global _SM_NotifyToggle
                                           	global _midi_channel
                                           	global _transpose
                                           	global _last_mx_pin
                                           	global _prg
                                           	global __tik
                                           	global _step
                                           	global _app_flags
                                           	global _kb
                                           	global _led_num
                                           	global _AIN_NotifyChange
                                           	global _Init
                                           	global _PRG_CHNG
                                           	global _CTROL
                                           	global _ALL_NOTE_OFF
                                           	global _KEY_NOTE
                                           	global _GET_NCHR
                                           	global _Tick
                                           	global _Timer
                                           	global _DISPLAY_Init
                                           	global _DISPLAY_Tick
                                           	global _MPROC_NotifyReceivedEvnt
                                           	global _MPROC_NotifyFoundEvent
                                           	global _MPROC_NotifyTimeout
                                           	global _MPROC_NotifyReceivedByte
                                           	global _SR_Service_Prepare
                                           	global _SR_Service_Finish
                                           	global _DIN_NotifyToggle
                                           	global _ENC_NotifyChange
                                           	global _note_map
                                           	global _lcd_charset
                                           	global _led_pos
                                           	global _chans
                                           	global _patchans
                                           	global _note_name
                                           ;--------------------------------------------------------
                                           ;	Equates to used internal registers
                                           ;--------------------------------------------------------
                                           STATUS	equ	0xfd8
                                           WREG	equ	0xfe8
                                           TBLPTRL	equ	0xff6
                                           TBLPTRH	equ	0xff7
                                           TBLPTRU	equ	0xff8
                                           TABLAT	equ	0xff5
                                           FSR0L	equ	0xfe1 ;; normaly 0xfe9, changed by fixasm.pl
                                           FSR0H	equ	0xfe2 ;; normaly 0xfea, changed by fixasm.pl
                                           FSR1L	equ	0xfe9 ;; normaly 0xfe1, changed by fixasm.pl
                                           FSR2L	equ	0xfd9
                                           INDF0	equ	0xfe7 ;; normaly 0xfef, changed by fixasm.pl
                                           POSTDEC1	equ	0xfed ;; normaly 0xfe5, changed by fixasm.pl
                                           PREINC1	equ	0xfec ;; normaly 0xfe4, changed by fixasm.pl
                                           PLUSW2	equ	0xfdb
                                           PRODL	equ	0xff3
                                           PRODH	equ	0xff4
                                           
                                           
                                           	idata
                                           _midi_channel	db	0x00
                                           _transpose	db	0x00
                                           __tik	db	0x00
                                           _step	db	0x00
                                           _lastep	db	0x00
                                           
                                           
                                           ; Internal registers
                                           .registers	udata_ovr	0x010
                                           r0x00	res	1
                                           r0x01	res	1
                                           r0x02	res	1
                                           r0x03	res	1
                                           r0x04	res	1
                                           r0x05	res	1
                                           r0x06	res	1
                                           
                                           udata_main_0	udata
                                           _pattern	res	256
                                           
                                           udata_main_1	udata
                                           _hold1	res	16
                                           
                                           udata_main_2	udata
                                           _hold2	res	16
                                           
                                           udata_main_3	udata
                                           _pg	res	1
                                           
                                           udata_main_4	udata
                                           _prg	res	16
                                           
                                           udata_main_5	udata
                                           _last_mx_pin	res	1
                                           
                                           udata_main_6	udata
                                           _app_flags	res	1
                                           
                                           udata_main_7	udata
                                           _kb	res	1
                                           
                                           ;--------------------------------------------------------
                                           ; global & static initialisations
                                           ;--------------------------------------------------------
                                           ; I code from now on!
                                           ; ; Starting pCode block
                                           S_main__SM_NotifyToggle	code
                                           _SM_NotifyToggle:
                                           ;	.line	231; main.c	void SM_NotifyToggle(unsigned char pin, unsigned char value) __wparam
0034b6   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
0034b8   ffed
0034ba   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
0034bc   ffd9
0034be   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
0034c0   ffed
0034c2   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
0034c4   ffed
0034c6   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
0034c8   ffed
0034ca   6e10     movwf	0x10, 0            	MOVWF	r0x00
0034cc   0e02     movlw	0x2                	MOVLW	0x02
0034ce   cfdb     movff	0xfdb, 0x11        	MOVFF	PLUSW2, r0x01
0034d0   f011
                                           ;	.line	233; main.c	last_mx_pin=pin;		//MAP KEYBOARD
0034d2   c010     movff	0x10, 0xcb         	MOVFF	r0x00, _last_mx_pin
0034d4   f0cb
                                           ;	.line	288; main.c	switch(pin){//SPECIAL KEYS
0034d6   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0034d8   e101     bnz	0x34dc               	BNZ	_00417_DS_
0034da   d074     bra	0x35c4               	BRA	_00389_DS_
                                           _00417_DS_:
0034dc   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0034de   0a04     xorlw	0x4                	XORLW	0x04
0034e0   e101     bnz	0x34e4               	BNZ	_00419_DS_
0034e2   d06d     bra	0x35be               	BRA	_00387_DS_
                                           _00419_DS_:
0034e4   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0034e6   0a05     xorlw	0x5                	XORLW	0x05
0034e8   e101     bnz	0x34ec               	BNZ	_00421_DS_
0034ea   d065     bra	0x35b6               	BRA	_00386_DS_
                                           _00421_DS_:
0034ec   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0034ee   0a06     xorlw	0x6                	XORLW	0x06
0034f0   e101     bnz	0x34f4               	BNZ	_00423_DS_
0034f2   d05d     bra	0x35ae               	BRA	_00385_DS_
                                           _00423_DS_:
0034f4   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0034f6   0a07     xorlw	0x7                	XORLW	0x07
0034f8   e101     bnz	0x34fc               	BNZ	_00425_DS_
0034fa   d055     bra	0x35a6               	BRA	_00384_DS_
                                           _00425_DS_:
0034fc   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0034fe   0a0c     xorlw	0xc                	XORLW	0x0c
003500   e101     bnz	0x3504               	BNZ	_00427_DS_
003502   d041     bra	0x3586               	BRA	_00376_DS_
                                           _00427_DS_:
003504   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003506   0a0f     xorlw	0xf                	XORLW	0x0f
003508   e101     bnz	0x350c               	BNZ	_00429_DS_
00350a   d045     bra	0x3596               	BRA	_00380_DS_
                                           _00429_DS_:
00350c   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00350e   0a3a     xorlw	0x3a               	XORLW	0x3a
003510   e022     bz	0x3556                	BZ	_00364_DS_
003512   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003514   0a3b     xorlw	0x3b               	XORLW	0x3b
003516   e007     bz	0x3526                	BZ	_00358_DS_
003518   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00351a   0a3c     xorlw	0x3c               	XORLW	0x3c
00351c   e02c     bz	0x3576                	BZ	_00372_DS_
00351e   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003520   0a3d     xorlw	0x3d               	XORLW	0x3d
003522   e021     bz	0x3566                	BZ	_00368_DS_
003524   d04f     bra	0x35c4               	BRA	_00389_DS_
                                           _00358_DS_:
                                           ;	.line	291; main.c	if(!value)return;
003526   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003528   e101     bnz	0x352c               	BNZ	_00360_DS_
00352a   d061     bra	0x35ee               	BRA	_00394_DS_
                                           _00360_DS_:
                                           ;	.line	292; main.c	if(kb.RUNSTOP==0){//PLAY
00352c   6ae8     clrf	0xe8, 0             	CLRF	WREG
00352e   0100     movlb	0                  	BANKSEL	_kb
003530   bdcd     btfsc	0xcd, 0x6, 0x1     	BTFSC	_kb, 6, B
003532   2ae8     incf	0xe8, 0x1, 0        	INCF	WREG, F
003534   6e12     movwf	0x12, 0            	MOVWF	r0x02
003536   5012     movf	0x12, 0, 0          	MOVF	r0x02, W
003538   e105     bnz	0x3544               	BNZ	_00362_DS_
                                           _00439_DS_:
00353a   0100     movlb	0                  	BANKSEL	_kb
                                           ;	.line	293; main.c	kb.RUNSTOP=1;
00353c   8dcd     bsf	0xcd, 0x6, 0x1       	BSF	_kb, 6, B
                                           ;	.line	294; main.c	MCLOCK_DoPlay();
00353e   ec84     call	0x4308, 0           	CALL	_MCLOCK_DoPlay
003540   f021
003542   d040     bra	0x35c4               	BRA	_00389_DS_
                                           _00362_DS_:
003544   0100     movlb	0                  	BANKSEL	_kb
                                           ;	.line	296; main.c	kb.RUNSTOP=0;
003546   9dcd     bcf	0xcd, 0x6, 0x1       	BCF	_kb, 6, B
                                           ;	.line	297; main.c	MCLOCK_DoStop();
003548   ece7     call	0x41ce, 0           	CALL	_MCLOCK_DoStop
00354a   f020
00354c   0100     movlb	0                  	BANKSEL	__tik
                                           ;	.line	298; main.c	_tik=0;//16 step reset
00354e   6bc7     clrf	0xc7, 0x1           	CLRF	__tik, B
003550   0100     movlb	0                  	BANKSEL	_step
                                           ;	.line	299; main.c	step=0;//16 step reset
003552   6bc8     clrf	0xc8, 0x1           	CLRF	_step, B
                                           ;	.line	301; main.c	break;
003554   d037     bra	0x35c4               	BRA	_00389_DS_
                                           _00364_DS_:
                                           ;	.line	307; main.c	case 58:if(value){kb.CTRL=0; }else{kb.CTRL=1;}break;//CTRL
003556   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003558   e003     bz	0x3560                	BZ	_00366_DS_
00355a   0100     movlb	0                  	BANKSEL	_kb
00355c   91cd     bcf	0xcd, 0, 0x1         	BCF	_kb, 0, B
00355e   d032     bra	0x35c4               	BRA	_00389_DS_
                                           _00366_DS_:
003560   0100     movlb	0                  	BANKSEL	_kb
003562   81cd     bsf	0xcd, 0, 0x1         	BSF	_kb, 0, B
003564   d02f     bra	0x35c4               	BRA	_00389_DS_
                                           _00368_DS_:
                                           ;	.line	308; main.c	case 61:if(value){kb.COMMODORE=0;}else{kb.COMMODORE=1;}break;//COMMODORE
003566   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003568   e003     bz	0x3570                	BZ	_00370_DS_
00356a   0100     movlb	0                  	BANKSEL	_kb
00356c   99cd     bcf	0xcd, 0x4, 0x1       	BCF	_kb, 4, B
00356e   d02a     bra	0x35c4               	BRA	_00389_DS_
                                           _00370_DS_:
003570   0100     movlb	0                  	BANKSEL	_kb
003572   89cd     bsf	0xcd, 0x4, 0x1       	BSF	_kb, 4, B
003574   d027     bra	0x35c4               	BRA	_00389_DS_
                                           _00372_DS_:
                                           ;	.line	309; main.c	case 60:if(value){kb.SPACE=0;}else{kb.SPACE=1;}break;//SPACE
003576   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003578   e003     bz	0x3580                	BZ	_00374_DS_
00357a   0100     movlb	0                  	BANKSEL	_kb
00357c   9bcd     bcf	0xcd, 0x5, 0x1       	BCF	_kb, 5, B
00357e   d022     bra	0x35c4               	BRA	_00389_DS_
                                           _00374_DS_:
003580   0100     movlb	0                  	BANKSEL	_kb
003582   8bcd     bsf	0xcd, 0x5, 0x1       	BSF	_kb, 5, B
003584   d01f     bra	0x35c4               	BRA	_00389_DS_
                                           _00376_DS_:
                                           ;	.line	310; main.c	case 12:if(value){kb.RSHIFT=0;}else{kb.RSHIFT=1;}break;//RSHIFT
003586   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003588   e003     bz	0x3590                	BZ	_00378_DS_
00358a   0100     movlb	0                  	BANKSEL	_kb
00358c   93cd     bcf	0xcd, 0x1, 0x1       	BCF	_kb, 1, B
00358e   d01a     bra	0x35c4               	BRA	_00389_DS_
                                           _00378_DS_:
003590   0100     movlb	0                  	BANKSEL	_kb
003592   83cd     bsf	0xcd, 0x1, 0x1       	BSF	_kb, 1, B
003594   d017     bra	0x35c4               	BRA	_00389_DS_
                                           _00380_DS_:
                                           ;	.line	311; main.c	case 15:if(value){kb.LSHIFT=0;}else{kb.LSHIFT=1;}break;//LSHIFT
003596   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003598   e003     bz	0x35a0                	BZ	_00382_DS_
00359a   0100     movlb	0                  	BANKSEL	_kb
00359c   95cd     bcf	0xcd, 0x2, 0x1       	BCF	_kb, 2, B
00359e   d012     bra	0x35c4               	BRA	_00389_DS_
                                           _00382_DS_:
0035a0   0100     movlb	0                  	BANKSEL	_kb
0035a2   85cd     bsf	0xcd, 0x2, 0x1       	BSF	_kb, 2, B
0035a4   d00f     bra	0x35c4               	BRA	_00389_DS_
                                           _00384_DS_:
                                           ;	.line	313; main.c	case 7:transpose=72;break;// F1-F2
0035a6   0e48     movlw	0x48               	MOVLW	0x48
0035a8   0100     movlb	0                  	BANKSEL	_transpose
0035aa   6fc6     movwf	0xc6, 0x1          	MOVWF	_transpose, B
0035ac   d00b     bra	0x35c4               	BRA	_00389_DS_
                                           _00385_DS_:
                                           ;	.line	314; main.c	case 6:transpose=60;break;// F3-F4
0035ae   0e3c     movlw	0x3c               	MOVLW	0x3c
0035b0   0100     movlb	0                  	BANKSEL	_transpose
0035b2   6fc6     movwf	0xc6, 0x1          	MOVWF	_transpose, B
0035b4   d007     bra	0x35c4               	BRA	_00389_DS_
                                           _00386_DS_:
                                           ;	.line	315; main.c	case 5:transpose=48;break;// F5-F6
0035b6   0e30     movlw	0x30               	MOVLW	0x30
0035b8   0100     movlb	0                  	BANKSEL	_transpose
0035ba   6fc6     movwf	0xc6, 0x1          	MOVWF	_transpose, B
0035bc   d003     bra	0x35c4               	BRA	_00389_DS_
                                           _00387_DS_:
                                           ;	.line	316; main.c	case 4:transpose=36;break;// F7-F8
0035be   0e24     movlw	0x24               	MOVLW	0x24
0035c0   0100     movlb	0                  	BANKSEL	_transpose
0035c2   6fc6     movwf	0xc6, 0x1          	MOVWF	_transpose, B
                                           _00389_DS_:
                                           ;	.line	324; main.c	if(kb.CTRL==1){if(value)CTROL(pin);return;}// (keyboard.c)
0035c4   6ae8     clrf	0xe8, 0             	CLRF	WREG
0035c6   0100     movlb	0                  	BANKSEL	_kb
0035c8   b1cd     btfsc	0xcd, 0, 0x1       	BTFSC	_kb, 0, B
0035ca   2ae8     incf	0xe8, 0x1, 0        	INCF	WREG, F
0035cc   6e12     movwf	0x12, 0            	MOVWF	r0x02
0035ce   5012     movf	0x12, 0, 0          	MOVF	r0x02, W
0035d0   0a01     xorlw	0x1                	XORLW	0x01
0035d2   e108     bnz	0x35e4               	BNZ	_00393_DS_
0035d4   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
0035d6   e005     bz	0x35e2                	BZ	_00391_DS_
0035d8   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0035da   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
0035dc   ec87     call	0x330e, 0           	CALL	_CTROL
0035de   f019
0035e0   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           _00391_DS_:
0035e2   d005     bra	0x35ee               	BRA	_00394_DS_
                                           _00393_DS_:
                                           ;	.line	333; main.c	KEY_NOTE(value);//FREE PLAY (freeplay.c)
0035e4   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
0035e6   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
0035e8   ec45     call	0x3a8a, 0           	CALL	_KEY_NOTE
0035ea   f01d
0035ec   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           _00394_DS_:
                                           ;	.line	335; main.c	return;
0035ee   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
0035f0   f012
0035f2   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
0035f4   f011
0035f6   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
0035f8   f010
0035fa   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
0035fc   ffd9
0035fe   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__ENC_NotifyChange	code
                                           _ENC_NotifyChange:
                                           ;	.line	215; main.c	void ENC_NotifyChange(unsigned char encoder, char incrementer) __wparam
0043e6   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
0043e8   ffed
0043ea   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
0043ec   ffd9
                                           ;	.line	217; main.c	}
0043ee   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
0043f0   ffd9
0043f2   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__DIN_NotifyToggle	code
                                           _DIN_NotifyToggle:
                                           ;	.line	206; main.c	void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam
0043f4   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
0043f6   ffed
0043f8   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
0043fa   ffd9
                                           ;	.line	208; main.c	}
0043fc   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
0043fe   ffd9
004400   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__SR_Service_Finish	code
                                           _SR_Service_Finish:
                                           ;	.line	199; main.c	SM_GetRow();
0044f6   ec57     call	0x38ae, 0           	CALL	_SM_GetRow
0044f8   f01c
0044fa   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__SR_Service_Prepare	code
                                           _SR_Service_Prepare:
004174   0100     movlb	0                  	BANKSEL	_mclock_pin_state
                                           ;	.line	173; main.c	if( mclock_pin_state.CLK_REQ ) {// Send one byte on j14 :)
004176   a1d8     btfss	0xd8, 0, 0x1       	BTFSS	_mclock_pin_state, 0, B
004178   d012     bra	0x419e               	BRA	_00340_DS_
                                           ; removed redundant BANKSEL
                                           ;	.line	174; main.c	mclock_pin_state.CLK_REQ = 0;
00417a   91d8     bcf	0xd8, 0, 0x1         	BCF	_mclock_pin_state, 0, B
                                           ;	.line	175; main.c	PORTDbits.RD4 = 1;    PORTDbits.RD4 = 0;
00417c   8883     bsf	0x83, 0x4, 0         	BSF	_PORTDbits, 4
00417e   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
                                           ;	.line	176; main.c	PORTDbits.RD4 = 1;    PORTDbits.RD4 = 0;
004180   8883     bsf	0x83, 0x4, 0         	BSF	_PORTDbits, 4
004182   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
                                           ;	.line	177; main.c	PORTDbits.RD4 = 1;    PORTDbits.RD4 = 0;
004184   8883     bsf	0x83, 0x4, 0         	BSF	_PORTDbits, 4
004186   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
                                           ;	.line	178; main.c	PORTDbits.RD4 = 1;    PORTDbits.RD4 = 0;
004188   8883     bsf	0x83, 0x4, 0         	BSF	_PORTDbits, 4
00418a   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
                                           ;	.line	179; main.c	PORTDbits.RD4 = 1;    PORTDbits.RD4 = 0;
00418c   8883     bsf	0x83, 0x4, 0         	BSF	_PORTDbits, 4
00418e   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
                                           ;	.line	180; main.c	PORTDbits.RD4 = 1;    PORTDbits.RD4 = 0;
004190   8883     bsf	0x83, 0x4, 0         	BSF	_PORTDbits, 4
004192   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
                                           ;	.line	181; main.c	PORTDbits.RD4 = 1;    PORTDbits.RD4 = 0;
004194   8883     bsf	0x83, 0x4, 0         	BSF	_PORTDbits, 4
004196   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
                                           ;	.line	182; main.c	PORTDbits.RD4 = 1;    PORTDbits.RD4 = 0;
004198   8883     bsf	0x83, 0x4, 0         	BSF	_PORTDbits, 4
00419a   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
00419c   d001     bra	0x41a0               	BRA	_00341_DS_
                                           _00340_DS_:
                                           ;	.line	184; main.c	PORTDbits.RD4 = 0;
00419e   9883     bcf	0x83, 0x4, 0         	BCF	_PORTDbits, 4
                                           _00341_DS_:
                                           ;	.line	189; main.c	SM_PrepareCol();
0041a0   ec4d     call	0x389a, 0           	CALL	_SM_PrepareCol
0041a2   f01c
0041a4   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__MPROC_NotifyReceivedByte	code
                                           _MPROC_NotifyReceivedByte:
                                           ;	.line	162; main.c	void MPROC_NotifyReceivedByte(unsigned char byte) __wparam
004402   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
004404   ffed
004406   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
004408   ffd9
                                           ;	.line	164; main.c	}
00440a   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
00440c   ffd9
00440e   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__MPROC_NotifyTimeout	code
                                           _MPROC_NotifyTimeout:
                                           ;	.line	157; main.c	}
004512   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__MPROC_NotifyFoundEvent	code
                                           _MPROC_NotifyFoundEvent:
                                           ;	.line	147; main.c	void MPROC_NotifyFoundEvent(unsigned entry, unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam
004410   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
004412   ffed
004414   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
004416   ffd9
                                           ;	.line	149; main.c	}
004418   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
00441a   ffd9
00441c   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__MPROC_NotifyReceivedEvnt	code
                                           _MPROC_NotifyReceivedEvnt:
                                           ;	.line	139; main.c	void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam
00441e   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
004420   ffed
004422   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
004424   ffd9
                                           ;	.line	141; main.c	}
004426   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
004428   ffd9
00442a   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__DISPLAY_Tick	code
                                           _DISPLAY_Tick:
00442c   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	109; main.c	if( !app_flags.DISPLAY_UPDATE_REQ )
00442e   b1cc     btfsc	0xcc, 0, 0x1       	BTFSC	_app_flags, 0, B
004430   d001     bra	0x4434               	BRA	_00317_DS_
                                           ;	.line	110; main.c	return;
004432   d002     bra	0x4438               	BRA	_00318_DS_
                                           _00317_DS_:
004434   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	111; main.c	app_flags.DISPLAY_UPDATE_REQ = 0;
004436   91cc     bcf	0xcc, 0, 0x1         	BCF	_app_flags, 0, B
                                           _00318_DS_:
004438   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__DISPLAY_Init	code
                                           _DISPLAY_Init:
0041a6   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	93; main.c	app_flags.DISPLAY_UPDATE_REQ = 1;
0041a8   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
                                           ;	.line	94; main.c	led_num(0);//LITE LED 1
0041aa   0e00     movlw	0                  	MOVLW	0x00
0041ac   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
0041ae   ecf8     call	0x3df0, 0           	CALL	_led_num
0041b0   f01e
0041b2   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           ;	.line	95; main.c	MIOS_LCD_CursorSet(0x00);
0041b4   0e00     movlw	0                  	MOVLW	0x00
0041b6   ec88     call	0x2d10, 0           	CALL	_MIOS_LCD_CursorSet
0041b8   f016
                                           ;	.line	96; main.c	MIOS_LCD_PrintCString(" .: SIDABITBOX64 :. ");
0041ba   0e00     movlw	0                  	MOVLW	UPPER(__str_9)
0041bc   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
0041be   0e37     movlw	0x37               	MOVLW	HIGH(__str_9)
0041c0   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
0041c2   0e34     movlw	0x34               	MOVLW	LOW(__str_9)
0041c4   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
0041c6   f020
0041c8   0e02     movlw	0x2                	MOVLW	0x02
0041ca   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
0041cc   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__Timer	code
                                           _Timer:
                                           ;	.line	81; main.c	MCLOCK_Timer();
0044fc   ec5c     call	0x42b8, 0           	CALL	_MCLOCK_Timer
0044fe   f021
004500   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__Tick	code
                                           _Tick:
                                           ;	.line	69; main.c	SM_ButtonHandler();
0044dc   ec6d     call	0x38da, 0           	CALL	_SM_ButtonHandler
0044de   f01c
                                           ;	.line	71; main.c	MCLOCK_Tick();
0044e0   ec93     call	0x3f26, 0           	CALL	_MCLOCK_Tick
0044e2   f01f
0044e4   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__GET_NCHR	code
                                           _GET_NCHR:
                                           ;	.line	70; freeplay.c	void GET_NCHR(unsigned char note){// DISPLAY LITTERAL NOTES !!!
003c6c   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
003c6e   ffed
003c70   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
003c72   ffd9
003c74   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
003c76   ffed
003c78   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
003c7a   ffed
003c7c   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
003c7e   ffed
003c80   c013     movff	0x13, 0xfed        	MOVFF	r0x03, POSTDEC1
003c82   ffed
003c84   0e02     movlw	0x2                	MOVLW	0x02
003c86   cfdb     movff	0xfdb, 0x10        	MOVFF	PLUSW2, r0x00
003c88   f010
                                           ;	.line	75; freeplay.c	if(note==0x80){
003c8a   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003c8c   0a80     xorlw	0x80               	XORLW	0x80
003c8e   e10d     bnz	0x3caa               	BNZ	_00284_DS_
                                           ;	.line	76; freeplay.c	MIOS_LCD_CursorSet(0x51);
003c90   0e51     movlw	0x51               	MOVLW	0x51
003c92   ec88     call	0x2d10, 0           	CALL	_MIOS_LCD_CursorSet
003c94   f016
                                           ;	.line	77; freeplay.c	MIOS_LCD_PrintCString("NUL");//
003c96   0e00     movlw	0                  	MOVLW	UPPER(__str_7)
003c98   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003c9a   0e37     movlw	0x37               	MOVLW	HIGH(__str_7)
003c9c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003c9e   0e2c     movlw	0x2c               	MOVLW	LOW(__str_7)
003ca0   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
003ca2   f020
003ca4   0e02     movlw	0x2                	MOVLW	0x02
003ca6   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	78; freeplay.c	return;
003ca8   d03b     bra	0x3d20               	BRA	_00290_DS_
                                           _00284_DS_:
                                           ;	.line	81; freeplay.c	if(note==0x81){
003caa   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003cac   0a81     xorlw	0x81               	XORLW	0x81
003cae   e10d     bnz	0x3cca               	BNZ	_00294_DS_
                                           ;	.line	82; freeplay.c	MIOS_LCD_CursorSet(0x51);
003cb0   0e51     movlw	0x51               	MOVLW	0x51
003cb2   ec88     call	0x2d10, 0           	CALL	_MIOS_LCD_CursorSet
003cb4   f016
                                           ;	.line	83; freeplay.c	MIOS_LCD_PrintCString("PAD");//
003cb6   0e00     movlw	0                  	MOVLW	UPPER(__str_8)
003cb8   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003cba   0e37     movlw	0x37               	MOVLW	HIGH(__str_8)
003cbc   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003cbe   0e30     movlw	0x30               	MOVLW	LOW(__str_8)
003cc0   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
003cc2   f020
003cc4   0e02     movlw	0x2                	MOVLW	0x02
003cc6   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	84; freeplay.c	return;
003cc8   d02b     bra	0x3d20               	BRA	_00290_DS_
                                           _00294_DS_:
                                           ;	.line	87; freeplay.c	do{
003cca   6a11     clrf	0x11, 0             	CLRF	r0x01
003ccc   6a12     clrf	0x12, 0             	CLRF	r0x02
                                           _00287_DS_:
                                           ;	.line	88; freeplay.c	oct++;
003cce   0e0c     movlw	0xc                	MOVLW	0x0c
003cd0   2612     addwf	0x12, 0x1, 0       	ADDWF	r0x02, F
003cd2   2a11     incf	0x11, 0x1, 0        	INCF	r0x01, F
                                           ;	.line	92; freeplay.c	while(n<=note);
003cd4   5012     movf	0x12, 0, 0          	MOVF	r0x02, W
003cd6   5c10     subwf	0x10, 0, 0         	SUBWF	r0x00, W
003cd8   e2fa     bc	0x3cce                	BC	_00287_DS_
                                           ;	.line	93; freeplay.c	oct--;
003cda   0611     decf	0x11, 0x1, 0        	DECF	r0x01, F
                                           ;	.line	96; freeplay.c	MIOS_LCD_CursorSet(0x51);
003cdc   0e51     movlw	0x51               	MOVLW	0x51
003cde   ec88     call	0x2d10, 0           	CALL	_MIOS_LCD_CursorSet
003ce0   f016
                                           ; ;multiply lit val:0X0c by variable r0x01 and store in r0x02
                                           ; ;Unrolled 8 X 8 multiplication
                                           ; ;FIXME: the function does not support result==WREG
                                           ;	.line	97; freeplay.c	MIOS_LCD_PrintCString(note_name[note-12*oct]);//
003ce2   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003ce4   0d0c     mullw	0xc                	MULLW	0x0c
003ce6   cff3     movff	0xff3, 0x12        	MOVFF	PRODL, r0x02
003ce8   f012
003cea   5012     movf	0x12, 0, 0          	MOVF	r0x02, W
003cec   5e10     subwf	0x10, 0x1, 0       	SUBWF	r0x00, F
                                           ; ;multiply lit val:0X03 by variable r0x00 and store in r0x00
                                           ; ;Unrolled 8 X 8 multiplication
                                           ; ;FIXME: the function does not support result==WREG
003cee   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003cf0   0d03     mullw	0x3                	MULLW	0x03
003cf2   cff3     movff	0xff3, 0x10        	MOVFF	PRODL, r0x00
003cf4   f010
003cf6   cff4     movff	0xff4, 0x12        	MOVFF	PRODH, r0x02
003cf8   f012
003cfa   0e08     movlw	0x8                	MOVLW	LOW(_note_name)
003cfc   2610     addwf	0x10, 0x1, 0       	ADDWF	r0x00, F
003cfe   0e37     movlw	0x37               	MOVLW	HIGH(_note_name)
003d00   2212     addwfc	0x12, 0x1, 0      	ADDWFC	r0x02, F
003d02   0e00     movlw	0                  	MOVLW	UPPER(_note_name)
003d04   6a13     clrf	0x13, 0             	CLRF	r0x03
003d06   2213     addwfc	0x13, 0x1, 0      	ADDWFC	r0x03, F
003d08   5013     movf	0x13, 0, 0          	MOVF	r0x03, W
003d0a   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003d0c   5012     movf	0x12, 0, 0          	MOVF	r0x02, W
003d0e   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003d10   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003d12   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
003d14   f020
003d16   0e02     movlw	0x2                	MOVLW	0x02
003d18   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	98; freeplay.c	MIOS_LCD_PrintBCD1(oct);
003d1a   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003d1c   ec8e     call	0x2d1c, 0           	CALL	_MIOS_LCD_PrintBCD1
003d1e   f016
                                           _00290_DS_:
                                           ;	.line	99; freeplay.c	return ; 
003d20   cfec     movff	0xfec, 0x13        	MOVFF	PREINC1, r0x03
003d22   f013
003d24   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
003d26   f012
003d28   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
003d2a   f011
003d2c   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
003d2e   f010
003d30   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
003d32   ffd9
003d34   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__KEY_NOTE	code
                                           _KEY_NOTE:
                                           ;	.line	22; freeplay.c	void KEY_NOTE(unsigned char value) // SEND A NOTE ON KEY PRESS
003a8a   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
003a8c   ffed
003a8e   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
003a90   ffd9
003a92   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
003a94   ffed
003a96   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
003a98   ffed
003a9a   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
003a9c   ffed
003a9e   c013     movff	0x13, 0xfed        	MOVFF	r0x03, POSTDEC1
003aa0   ffed
003aa2   c014     movff	0x14, 0xfed        	MOVFF	r0x04, POSTDEC1
003aa4   ffed
003aa6   c015     movff	0x15, 0xfed        	MOVFF	r0x05, POSTDEC1
003aa8   ffed
003aaa   c016     movff	0x16, 0xfed        	MOVFF	r0x06, POSTDEC1
003aac   ffed
003aae   0e02     movlw	0x2                	MOVLW	0x02
003ab0   cfdb     movff	0xfdb, 0x10        	MOVFF	PLUSW2, r0x00
003ab2   f010
003ab4   0100     movlb	0                  	BANKSEL	_last_mx_pin
                                           ;	.line	26; freeplay.c	if(last_mx_pin==0){
003ab6   51cb     movf	0xcb, 0, 0x1        	MOVF	_last_mx_pin, W, B
003ab8   e10f     bnz	0x3ad8               	BNZ	_00265_DS_
                                           ;	.line	27; freeplay.c	MIOS_LCD_CursorSet(0x00);	
003aba   0e00     movlw	0                  	MOVLW	0x00
003abc   ec88     call	0x2d10, 0           	CALL	_MIOS_LCD_CursorSet
003abe   f016
                                           ;	.line	28; freeplay.c	MIOS_LCD_PrintCString("ALL NOTES OFF");
003ac0   0e00     movlw	0                  	MOVLW	UPPER(__str_6)
003ac2   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003ac4   0e36     movlw	0x36               	MOVLW	HIGH(__str_6)
003ac6   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003ac8   0efa     movlw	0xfa               	MOVLW	LOW(__str_6)
003aca   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
003acc   f020
003ace   0e02     movlw	0x2                	MOVLW	0x02
003ad0   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	29; freeplay.c	ALL_NOTE_OFF();
003ad2   ec9f     call	0x413e, 0           	CALL	_ALL_NOTE_OFF
003ad4   f020
                                           ;	.line	30; freeplay.c	return;
003ad6   d046     bra	0x3b64               	BRA	_00268_DS_
                                           ; ;multiply lit val:0X02 by variable _last_mx_pin and store in r0x01
                                           ; ;Unrolled 8 X 8 multiplication
                                           ; ;FIXME: the function does not support result==WREG
                                           _00265_DS_:
                                           ;	.line	44; freeplay.c	if(note_map[last_mx_pin][0]==0x80){
003ad8   6a12     clrf	0x12, 0             	CLRF	r0x02
003ada   90d8     bcf	0xd8, 0, 0           	BCF	STATUS, 0
003adc   0100     movlb	0                  	BANKSEL	_last_mx_pin
003ade   35cb     rlcf	0xcb, 0, 0x1        	RLCF	_last_mx_pin, W, B
003ae0   6e11     movwf	0x11, 0            	MOVWF	r0x01
003ae2   3612     rlcf	0x12, 0x1, 0        	RLCF	r0x02, F
003ae4   0e00     movlw	0                  	MOVLW	LOW(_note_map)
003ae6   2611     addwf	0x11, 0x1, 0       	ADDWF	r0x01, F
003ae8   0e36     movlw	0x36               	MOVLW	HIGH(_note_map)
003aea   2212     addwfc	0x12, 0x1, 0      	ADDWFC	r0x02, F
003aec   0e00     movlw	0                  	MOVLW	UPPER(_note_map)
003aee   6a13     clrf	0x13, 0             	CLRF	r0x03
003af0   2213     addwfc	0x13, 0x1, 0      	ADDWFC	r0x03, F
003af2   c011     movff	0x11, 0xff6        	MOVFF	r0x01, TBLPTRL
003af4   fff6
003af6   c012     movff	0x12, 0xff7        	MOVFF	r0x02, TBLPTRH
003af8   fff7
003afa   c013     movff	0x13, 0xff8        	MOVFF	r0x03, TBLPTRU
003afc   fff8
003afe   0009     tblrd	*+                 	TBLRD*+	
003b00   cff5     movff	0xff5, 0x11        	MOVFF	TABLAT, r0x01
003b02   f011
003b04   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003b06   0a80     xorlw	0x80               	XORLW	0x80
                                           ;	.line	50; freeplay.c	return;//Do not send stupid datas !
003b08   e02d     bz	0x3b64                	BZ	_00268_DS_
                                           ;	.line	54; freeplay.c	MIOS_MIDI_TxBufferPut(144 + midi_channel);
003b0a   0e90     movlw	0x90               	MOVLW	0x90
003b0c   0100     movlb	0                  	BANKSEL	_midi_channel
003b0e   25c5     addwf	0xc5, 0, 0x1       	ADDWF	_midi_channel, W, B
003b10   6e11     movwf	0x11, 0            	MOVWF	r0x01
003b12   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003b14   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003b16   f016
                                           ; ;multiply lit val:0X02 by variable _last_mx_pin and store in r0x01
                                           ; ;Unrolled 8 X 8 multiplication
                                           ; ;FIXME: the function does not support result==WREG
                                           ;	.line	55; freeplay.c	MIOS_MIDI_TxBufferPut(note_map[last_mx_pin][0]+transpose);
003b18   6a14     clrf	0x14, 0             	CLRF	r0x04
003b1a   90d8     bcf	0xd8, 0, 0           	BCF	STATUS, 0
003b1c   0100     movlb	0                  	BANKSEL	_last_mx_pin
003b1e   35cb     rlcf	0xcb, 0, 0x1        	RLCF	_last_mx_pin, W, B
003b20   6e11     movwf	0x11, 0            	MOVWF	r0x01
003b22   3614     rlcf	0x14, 0x1, 0        	RLCF	r0x04, F
003b24   0e00     movlw	0                  	MOVLW	LOW(_note_map)
003b26   2611     addwf	0x11, 0x1, 0       	ADDWF	r0x01, F
003b28   0e36     movlw	0x36               	MOVLW	HIGH(_note_map)
003b2a   2214     addwfc	0x14, 0x1, 0      	ADDWFC	r0x04, F
003b2c   0e00     movlw	0                  	MOVLW	UPPER(_note_map)
003b2e   6a15     clrf	0x15, 0             	CLRF	r0x05
003b30   2215     addwfc	0x15, 0x1, 0      	ADDWFC	r0x05, F
003b32   c011     movff	0x11, 0xff6        	MOVFF	r0x01, TBLPTRL
003b34   fff6
003b36   c014     movff	0x14, 0xff7        	MOVFF	r0x04, TBLPTRH
003b38   fff7
003b3a   c015     movff	0x15, 0xff8        	MOVFF	r0x05, TBLPTRU
003b3c   fff8
003b3e   0009     tblrd	*+                 	TBLRD*+	
003b40   cff5     movff	0xff5, 0x11        	MOVFF	TABLAT, r0x01
003b42   f011
003b44   c0c6     movff	0xc6, 0x16         	MOVFF	_transpose, r0x06
003b46   f016
003b48   5016     movf	0x16, 0, 0          	MOVF	r0x06, W
003b4a   2611     addwf	0x11, 0x1, 0       	ADDWF	r0x01, F
003b4c   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003b4e   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003b50   f016
                                           ;	.line	56; freeplay.c	MIOS_MIDI_TxBufferPut(value ? 0x00 : 0x7F);
003b52   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003b54   e002     bz	0x3b5a                	BZ	_00270_DS_
003b56   6a10     clrf	0x10, 0             	CLRF	r0x00
003b58   d002     bra	0x3b5e               	BRA	_00271_DS_
                                           _00270_DS_:
003b5a   0e7f     movlw	0x7f               	MOVLW	0x7f
003b5c   6e10     movwf	0x10, 0            	MOVWF	r0x00
                                           _00271_DS_:
003b5e   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003b60   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003b62   f016
                                           _00268_DS_:
                                           ;	.line	60; freeplay.c	return ; 
003b64   cfec     movff	0xfec, 0x16        	MOVFF	PREINC1, r0x06
003b66   f016
003b68   cfec     movff	0xfec, 0x15        	MOVFF	PREINC1, r0x05
003b6a   f015
003b6c   cfec     movff	0xfec, 0x14        	MOVFF	PREINC1, r0x04
003b6e   f014
003b70   cfec     movff	0xfec, 0x13        	MOVFF	PREINC1, r0x03
003b72   f013
003b74   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
003b76   f012
003b78   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
003b7a   f011
003b7c   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
003b7e   f010
003b80   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
003b82   ffd9
003b84   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__ALL_NOTE_OFF	code
                                           _ALL_NOTE_OFF:
                                           ;	.line	6; freeplay.c	void ALL_NOTE_OFF(){//KILL EVERY NOTES 
00413e   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
004140   ffed
004142   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
004144   ffed
                                           ;	.line	9; freeplay.c	for(i=0;i<15;i++){
004146   6a10     clrf	0x10, 0             	CLRF	r0x00
                                           _00256_DS_:
004148   0e0f     movlw	0xf                	MOVLW	0x0f
00414a   5c10     subwf	0x10, 0, 0         	SUBWF	r0x00, W
00414c   e20e     bc	0x416a                	BC	_00260_DS_
                                           ;	.line	10; freeplay.c	MIOS_MIDI_TxBufferPut(176 + i);//Controller Chn i
00414e   0eb0     movlw	0xb0               	MOVLW	0xb0
004150   2410     addwf	0x10, 0, 0         	ADDWF	r0x00, W
004152   6e11     movwf	0x11, 0            	MOVWF	r0x01
004154   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
004156   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
004158   f016
                                           ;	.line	11; freeplay.c	MIOS_MIDI_TxBufferPut(123);//ALL NOTE OFF // http://www.borg.com/~jglatt/tech/midispec/ctllist.htm
00415a   0e7b     movlw	0x7b               	MOVLW	0x7b
00415c   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
00415e   f016
                                           ;	.line	12; freeplay.c	MIOS_MIDI_TxBufferPut(0x00);
004160   0e00     movlw	0                  	MOVLW	0x00
004162   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
004164   f016
                                           ;	.line	9; freeplay.c	for(i=0;i<15;i++){
004166   2a10     incf	0x10, 0x1, 0        	INCF	r0x00, F
004168   d7ef     bra	0x4148               	BRA	_00256_DS_
                                           _00260_DS_:
                                           ;	.line	14; freeplay.c	return;
00416a   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
00416c   f011
00416e   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
004170   f010
004172   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__PUSH	code
                                           _PUSH:
                                           ;	.line	39; push.c	void PUSH(){
003b86   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
003b88   ffed
003b8a   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
003b8c   ffed
003b8e   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
003b90   ffed
003b92   c013     movff	0x13, 0xfed        	MOVFF	r0x03, POSTDEC1
003b94   ffed
003b96   c014     movff	0x14, 0xfed        	MOVFF	r0x04, POSTDEC1
003b98   ffed
003b9a   0100     movlb	0                  	BANKSEL	__tik
                                           ;	.line	43; push.c	if( _tik == 24 )_tik=0;  
003b9c   51c7     movf	0xc7, 0, 0x1        	MOVF	__tik, W, B
003b9e   0a18     xorlw	0x18               	XORLW	0x18
003ba0   e102     bnz	0x3ba6               	BNZ	_00225_DS_
                                           _00241_DS_:
003ba2   0100     movlb	0                  	BANKSEL	__tik
003ba4   6bc7     clrf	0xc7, 0x1           	CLRF	__tik, B
                                           _00225_DS_:
003ba6   0100     movlb	0                  	BANKSEL	__tik
                                           ;	.line	46; push.c	if(_tik==0 || _tik==6 || _tik==12 || _tik==18){ // ON MORE STEP :)
003ba8   51c7     movf	0xc7, 0, 0x1        	MOVF	__tik, W, B
003baa   e00d     bz	0x3bc6                	BZ	_00228_DS_
                                           _00243_DS_:
003bac   0100     movlb	0                  	BANKSEL	__tik
003bae   51c7     movf	0xc7, 0, 0x1        	MOVF	__tik, W, B
003bb0   0a06     xorlw	0x6                	XORLW	0x06
003bb2   e009     bz	0x3bc6                	BZ	_00228_DS_
                                           _00245_DS_:
003bb4   0100     movlb	0                  	BANKSEL	__tik
003bb6   51c7     movf	0xc7, 0, 0x1        	MOVF	__tik, W, B
003bb8   0a0c     xorlw	0xc                	XORLW	0x0c
003bba   e005     bz	0x3bc6                	BZ	_00228_DS_
                                           _00247_DS_:
003bbc   0100     movlb	0                  	BANKSEL	__tik
003bbe   51c7     movf	0xc7, 0, 0x1        	MOVF	__tik, W, B
003bc0   0a12     xorlw	0x12               	XORLW	0x12
003bc2   e001     bz	0x3bc6                	BZ	_00228_DS_
003bc4   d046     bra	0x3c52               	BRA	_00229_DS_
                                           _00228_DS_:
003bc6   0100     movlb	0                  	BANKSEL	_step
                                           ;	.line	48; push.c	if(step==16)step=0;//16 step reset
003bc8   51c8     movf	0xc8, 0, 0x1        	MOVF	_step, W, B
003bca   0a10     xorlw	0x10               	XORLW	0x10
003bcc   e102     bnz	0x3bd2               	BNZ	_00227_DS_
                                           _00251_DS_:
003bce   0100     movlb	0                  	BANKSEL	_step
003bd0   6bc8     clrf	0xc8, 0x1           	CLRF	_step, B
                                           ; ;multiply lit val:0X02 by variable _step and store in r0x00
                                           ; ;Unrolled 8 X 8 multiplication
                                           ; ;FIXME: the function does not support result==WREG
                                           _00227_DS_:
                                           ;	.line	119; push.c	MIOS_DOUT_SRSet(1,led_pos[step][0]);
003bd2   6a11     clrf	0x11, 0             	CLRF	r0x01
003bd4   90d8     bcf	0xd8, 0, 0           	BCF	STATUS, 0
003bd6   0100     movlb	0                  	BANKSEL	_step
003bd8   35c8     rlcf	0xc8, 0, 0x1        	RLCF	_step, W, B
003bda   6e10     movwf	0x10, 0            	MOVWF	r0x00
003bdc   3611     rlcf	0x11, 0x1, 0        	RLCF	r0x01, F
003bde   0ea8     movlw	0xa8               	MOVLW	LOW(_led_pos)
003be0   2610     addwf	0x10, 0x1, 0       	ADDWF	r0x00, F
003be2   0e36     movlw	0x36               	MOVLW	HIGH(_led_pos)
003be4   2211     addwfc	0x11, 0x1, 0      	ADDWFC	r0x01, F
003be6   0e00     movlw	0                  	MOVLW	UPPER(_led_pos)
003be8   6a12     clrf	0x12, 0             	CLRF	r0x02
003bea   2212     addwfc	0x12, 0x1, 0      	ADDWFC	r0x02, F
003bec   c010     movff	0x10, 0xff6        	MOVFF	r0x00, TBLPTRL
003bee   fff6
003bf0   c011     movff	0x11, 0xff7        	MOVFF	r0x01, TBLPTRH
003bf2   fff7
003bf4   c012     movff	0x12, 0xff8        	MOVFF	r0x02, TBLPTRU
003bf6   fff8
003bf8   0009     tblrd	*+                 	TBLRD*+	
003bfa   cff5     movff	0xff5, 0x10        	MOVFF	TABLAT, r0x00
003bfc   f010
003bfe   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003c00   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003c02   0e01     movlw	0x1                	MOVLW	0x01
003c04   ec38     call	0x4470, 0           	CALL	_MIOS_DOUT_SRSet
003c06   f022
003c08   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           ; ;multiply lit val:0X02 by variable _step and store in r0x00
                                           ; ;Unrolled 8 X 8 multiplication
                                           ; ;FIXME: the function does not support result==WREG
                                           ;	.line	120; push.c	MIOS_DOUT_SRSet(2,led_pos[step][1]);
003c0a   6a13     clrf	0x13, 0             	CLRF	r0x03
003c0c   90d8     bcf	0xd8, 0, 0           	BCF	STATUS, 0
003c0e   0100     movlb	0                  	BANKSEL	_step
003c10   35c8     rlcf	0xc8, 0, 0x1        	RLCF	_step, W, B
003c12   6e10     movwf	0x10, 0            	MOVWF	r0x00
003c14   3613     rlcf	0x13, 0x1, 0        	RLCF	r0x03, F
003c16   0ea8     movlw	0xa8               	MOVLW	LOW(_led_pos)
003c18   2610     addwf	0x10, 0x1, 0       	ADDWF	r0x00, F
003c1a   0e36     movlw	0x36               	MOVLW	HIGH(_led_pos)
003c1c   2213     addwfc	0x13, 0x1, 0      	ADDWFC	r0x03, F
003c1e   0e00     movlw	0                  	MOVLW	UPPER(_led_pos)
003c20   6a14     clrf	0x14, 0             	CLRF	r0x04
003c22   2214     addwfc	0x14, 0x1, 0      	ADDWFC	r0x04, F
003c24   2a10     incf	0x10, 0x1, 0        	INCF	r0x00, F
003c26   b0d8     btfsc	0xd8, 0, 0         	BTFSC	STATUS, 0
003c28   2a13     incf	0x13, 0x1, 0        	INCF	r0x03, F
003c2a   b0d8     btfsc	0xd8, 0, 0         	BTFSC	STATUS, 0
003c2c   2a14     incf	0x14, 0x1, 0        	INCF	r0x04, F
003c2e   c010     movff	0x10, 0xff6        	MOVFF	r0x00, TBLPTRL
003c30   fff6
003c32   c013     movff	0x13, 0xff7        	MOVFF	r0x03, TBLPTRH
003c34   fff7
003c36   c014     movff	0x14, 0xff8        	MOVFF	r0x04, TBLPTRU
003c38   fff8
003c3a   0009     tblrd	*+                 	TBLRD*+	
003c3c   cff5     movff	0xff5, 0x10        	MOVFF	TABLAT, r0x00
003c3e   f010
003c40   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003c42   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003c44   0e02     movlw	0x2                	MOVLW	0x02
003c46   ec38     call	0x4470, 0           	CALL	_MIOS_DOUT_SRSet
003c48   f022
003c4a   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           ;	.line	122; push.c	lastep=step;//mem last step
003c4c   c0c8     movff	0xc8, 0xc9         	MOVFF	_step, _lastep
003c4e   f0c9
                                           ;	.line	123; push.c	step++;//16 step counter
003c50   2bc8     incf	0xc8, 0x1, 0x1      	INCF	_step, F, B
                                           _00229_DS_:
003c52   0100     movlb	0                  	BANKSEL	__tik
                                           ;	.line	127; push.c	_tik++;
003c54   2bc7     incf	0xc7, 0x1, 0x1      	INCF	__tik, F, B
                                           ;	.line	128; push.c	return;
003c56   cfec     movff	0xfec, 0x14        	MOVFF	PREINC1, r0x04
003c58   f014
003c5a   cfec     movff	0xfec, 0x13        	MOVFF	PREINC1, r0x03
003c5c   f013
003c5e   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
003c60   f012
003c62   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
003c64   f011
003c66   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
003c68   f010
003c6a   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__CTROL	code
                                           _CTROL:
                                           ;	.line	2; keyboard.c	void CTROL(unsigned char pin){
00330e   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
003310   ffed
003312   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
003314   ffd9
003316   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
003318   ffed
00331a   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
00331c   ffed
00331e   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
003320   ffed
003322   0e02     movlw	0x2                	MOVLW	0x02
003324   cfdb     movff	0xfdb, 0x10        	MOVFF	PLUSW2, r0x00
003326   f010
                                           ;	.line	3; keyboard.c	MIOS_LCD_CursorSet(0x00);
003328   0e00     movlw	0                  	MOVLW	0x00
00332a   ec88     call	0x2d10, 0           	CALL	_MIOS_LCD_CursorSet
00332c   f016
                                           ;	.line	6; keyboard.c	switch(pin){//SPECIAL KEYS
00332e   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003330   e101     bnz	0x3334               	BNZ	_00184_DS_
003332   d07d     bra	0x342e               	BRA	_00157_DS_
                                           _00184_DS_:
003334   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003336   0a02     xorlw	0x2                	XORLW	0x02
003338   e101     bnz	0x333c               	BNZ	_00186_DS_
00333a   d07d     bra	0x3436               	BRA	_00158_DS_
                                           _00186_DS_:
00333c   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00333e   0a03     xorlw	0x3                	XORLW	0x03
003340   e101     bnz	0x3344               	BNZ	_00188_DS_
003342   d08d     bra	0x345e               	BRA	_00159_DS_
                                           _00188_DS_:
003344   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003346   0a08     xorlw	0x8                	XORLW	0x08
003348   e101     bnz	0x334c               	BNZ	_00190_DS_
00334a   d069     bra	0x341e               	BRA	_00155_DS_
                                           _00190_DS_:
00334c   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00334e   0a0f     xorlw	0xf                	XORLW	0x0f
003350   e101     bnz	0x3354               	BNZ	_00192_DS_
003352   d069     bra	0x3426               	BRA	_00156_DS_
                                           _00192_DS_:
003354   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003356   0a10     xorlw	0x10               	XORLW	0x10
003358   e101     bnz	0x335c               	BNZ	_00194_DS_
00335a   d059     bra	0x340e               	BRA	_00153_DS_
                                           _00194_DS_:
00335c   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00335e   0a17     xorlw	0x17               	XORLW	0x17
003360   e101     bnz	0x3364               	BNZ	_00196_DS_
003362   d059     bra	0x3416               	BRA	_00154_DS_
                                           _00196_DS_:
003364   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003366   0a18     xorlw	0x18               	XORLW	0x18
003368   e101     bnz	0x336c               	BNZ	_00198_DS_
00336a   d049     bra	0x33fe               	BRA	_00151_DS_
                                           _00198_DS_:
00336c   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00336e   0a1f     xorlw	0x1f               	XORLW	0x1f
003370   e101     bnz	0x3374               	BNZ	_00200_DS_
003372   d049     bra	0x3406               	BRA	_00152_DS_
                                           _00200_DS_:
003374   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003376   0a20     xorlw	0x20               	XORLW	0x20
003378   e101     bnz	0x337c               	BNZ	_00202_DS_
00337a   d039     bra	0x33ee               	BRA	_00149_DS_
                                           _00202_DS_:
00337c   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00337e   0a27     xorlw	0x27               	XORLW	0x27
003380   e101     bnz	0x3384               	BNZ	_00204_DS_
003382   d039     bra	0x33f6               	BRA	_00150_DS_
                                           _00204_DS_:
003384   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003386   0a28     xorlw	0x28               	XORLW	0x28
003388   e02a     bz	0x33de                	BZ	_00147_DS_
00338a   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00338c   0a2f     xorlw	0x2f               	XORLW	0x2f
00338e   e02b     bz	0x33e6                	BZ	_00148_DS_
003390   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003392   0a30     xorlw	0x30               	XORLW	0x30
003394   e01c     bz	0x33ce                	BZ	_00145_DS_
003396   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003398   0a36     xorlw	0x36               	XORLW	0x36
00339a   e101     bnz	0x339e               	BNZ	_00212_DS_
00339c   d074     bra	0x3486               	BRA	_00160_DS_
                                           _00212_DS_:
00339e   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0033a0   0a37     xorlw	0x37               	XORLW	0x37
0033a2   e019     bz	0x33d6                	BZ	_00146_DS_
0033a4   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0033a6   0a38     xorlw	0x38               	XORLW	0x38
0033a8   e00a     bz	0x33be                	BZ	_00143_DS_
0033aa   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0033ac   0a39     xorlw	0x39               	XORLW	0x39
0033ae   e004     bz	0x33b8                	BZ	_00142_DS_
0033b0   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0033b2   0a3f     xorlw	0x3f               	XORLW	0x3f
0033b4   e008     bz	0x33c6                	BZ	_00144_DS_
0033b6   d070     bra	0x3498               	BRA	_00161_DS_
                                           _00142_DS_:
0033b8   0100     movlb	0                  	BANKSEL	_midi_channel
                                           ;	.line	8; keyboard.c	case 57:midi_channel=0;break;//MIDICHAN 1  (keyb:esc)
0033ba   6bc5     clrf	0xc5, 0x1           	CLRF	_midi_channel, B
0033bc   d06d     bra	0x3498               	BRA	_00161_DS_
                                           _00143_DS_:
                                           ;	.line	9; keyboard.c	case 56:midi_channel=1;break;//MIDICHAN 2  (keyb:1)
0033be   0e01     movlw	0x1                	MOVLW	0x01
0033c0   0100     movlb	0                  	BANKSEL	_midi_channel
0033c2   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
0033c4   d069     bra	0x3498               	BRA	_00161_DS_
                                           _00144_DS_:
                                           ;	.line	10; keyboard.c	case 63:midi_channel=2;break;//MIDICHAN 3  (keyb:2)
0033c6   0e02     movlw	0x2                	MOVLW	0x02
0033c8   0100     movlb	0                  	BANKSEL	_midi_channel
0033ca   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
0033cc   d065     bra	0x3498               	BRA	_00161_DS_
                                           _00145_DS_:
                                           ;	.line	11; keyboard.c	case 48:midi_channel=3;break;//MIDICHAN 4  (keyb:3)
0033ce   0e03     movlw	0x3                	MOVLW	0x03
0033d0   0100     movlb	0                  	BANKSEL	_midi_channel
0033d2   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
0033d4   d061     bra	0x3498               	BRA	_00161_DS_
                                           _00146_DS_:
                                           ;	.line	12; keyboard.c	case 55:midi_channel=4;break;//MIDICHAN 5  (keyb:4)
0033d6   0e04     movlw	0x4                	MOVLW	0x04
0033d8   0100     movlb	0                  	BANKSEL	_midi_channel
0033da   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
0033dc   d05d     bra	0x3498               	BRA	_00161_DS_
                                           _00147_DS_:
                                           ;	.line	13; keyboard.c	case 40:midi_channel=5;break;//MIDICHAN 6  (keyb:5)
0033de   0e05     movlw	0x5                	MOVLW	0x05
0033e0   0100     movlb	0                  	BANKSEL	_midi_channel
0033e2   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
0033e4   d059     bra	0x3498               	BRA	_00161_DS_
                                           _00148_DS_:
                                           ;	.line	14; keyboard.c	case 47:midi_channel=6;break;//MIDICHAN 7  (keyb:6)
0033e6   0e06     movlw	0x6                	MOVLW	0x06
0033e8   0100     movlb	0                  	BANKSEL	_midi_channel
0033ea   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
0033ec   d055     bra	0x3498               	BRA	_00161_DS_
                                           _00149_DS_:
                                           ;	.line	15; keyboard.c	case 32:midi_channel=7;break;//MIDICHAN 8  (keyb:7)
0033ee   0e07     movlw	0x7                	MOVLW	0x07
0033f0   0100     movlb	0                  	BANKSEL	_midi_channel
0033f2   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
0033f4   d051     bra	0x3498               	BRA	_00161_DS_
                                           _00150_DS_:
                                           ;	.line	16; keyboard.c	case 39:midi_channel=8;break;//MIDICHAN 9  (keyb:8)
0033f6   0e08     movlw	0x8                	MOVLW	0x08
0033f8   0100     movlb	0                  	BANKSEL	_midi_channel
0033fa   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
0033fc   d04d     bra	0x3498               	BRA	_00161_DS_
                                           _00151_DS_:
                                           ;	.line	17; keyboard.c	case 24:midi_channel=9;break;//MIDICHAN 10 (keyb:9)
0033fe   0e09     movlw	0x9                	MOVLW	0x09
003400   0100     movlb	0                  	BANKSEL	_midi_channel
003402   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
003404   d049     bra	0x3498               	BRA	_00161_DS_
                                           _00152_DS_:
                                           ;	.line	18; keyboard.c	case 31:midi_channel=10;break;//MIDICHAN 11 (keyb:0)
003406   0e0a     movlw	0xa                	MOVLW	0x0a
003408   0100     movlb	0                  	BANKSEL	_midi_channel
00340a   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
00340c   d045     bra	0x3498               	BRA	_00161_DS_
                                           _00153_DS_:
                                           ;	.line	19; keyboard.c	case 16:midi_channel=11;break;//MIDICHAN 12 (keyb:+)
00340e   0e0b     movlw	0xb                	MOVLW	0x0b
003410   0100     movlb	0                  	BANKSEL	_midi_channel
003412   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
003414   d041     bra	0x3498               	BRA	_00161_DS_
                                           _00154_DS_:
                                           ;	.line	20; keyboard.c	case 23:midi_channel=12;break;//MIDICHAN 13 (keyb:-)
003416   0e0c     movlw	0xc                	MOVLW	0x0c
003418   0100     movlb	0                  	BANKSEL	_midi_channel
00341a   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
00341c   d03d     bra	0x3498               	BRA	_00161_DS_
                                           _00155_DS_:
                                           ;	.line	21; keyboard.c	case 8: midi_channel=13;break;//MIDICHAN 14 (keyb:£)
00341e   0e0d     movlw	0xd                	MOVLW	0x0d
003420   0100     movlb	0                  	BANKSEL	_midi_channel
003422   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
003424   d039     bra	0x3498               	BRA	_00161_DS_
                                           _00156_DS_:
                                           ;	.line	22; keyboard.c	case 15:midi_channel=14;break;//MIDICHAN 15 (keyb:clr-home)
003426   0e0e     movlw	0xe                	MOVLW	0x0e
003428   0100     movlb	0                  	BANKSEL	_midi_channel
00342a   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
00342c   d035     bra	0x3498               	BRA	_00161_DS_
                                           _00157_DS_:
                                           ;	.line	23; keyboard.c	case 0 :midi_channel=15;break;//MIDICHAN 16 (keyb:inst-del)
00342e   0e0f     movlw	0xf                	MOVLW	0x0f
003430   0100     movlb	0                  	BANKSEL	_midi_channel
003432   6fc5     movwf	0xc5, 0x1          	MOVWF	_midi_channel, B
003434   d031     bra	0x3498               	BRA	_00161_DS_
                                           _00158_DS_:
                                           ;	.line	26; keyboard.c	case 2:PRG_CHNG(prg[midi_channel]+1);break;//CRSR RIGHT :PRG++
003436   0eb5     movlw	0xb5               	MOVLW	LOW(_prg)
003438   0100     movlb	0                  	BANKSEL	_midi_channel
00343a   25c5     addwf	0xc5, 0, 0x1       	ADDWF	_midi_channel, W, B
00343c   6e10     movwf	0x10, 0            	MOVWF	r0x00
00343e   6a11     clrf	0x11, 0             	CLRF	r0x01
003440   0e00     movlw	0                  	MOVLW	HIGH(_prg)
003442   2211     addwfc	0x11, 0x1, 0      	ADDWFC	r0x01, F
003444   c010     movff	0x10, 0xfe1        	MOVFF	r0x00, FSR0L
003446   ffe1
003448   c011     movff	0x11, 0xfe2        	MOVFF	r0x01, FSR0H
00344a   ffe2
00344c   cfe7     movff	0xfe7, 0x10        	MOVFF	INDF0, r0x00
00344e   f010
003450   2a10     incf	0x10, 0x1, 0        	INCF	r0x00, F
003452   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003454   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003456   ec9b     call	0x3d36, 0           	CALL	_PRG_CHNG
003458   f01e
00345a   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
00345c   d01d     bra	0x3498               	BRA	_00161_DS_
                                           _00159_DS_:
                                           ;	.line	27; keyboard.c	case 3:PRG_CHNG(prg[midi_channel]-1);break;//CRSR LEFT  :PRG--
00345e   0eb5     movlw	0xb5               	MOVLW	LOW(_prg)
003460   0100     movlb	0                  	BANKSEL	_midi_channel
003462   25c5     addwf	0xc5, 0, 0x1       	ADDWF	_midi_channel, W, B
003464   6e10     movwf	0x10, 0            	MOVWF	r0x00
003466   6a12     clrf	0x12, 0             	CLRF	r0x02
003468   0e00     movlw	0                  	MOVLW	HIGH(_prg)
00346a   2212     addwfc	0x12, 0x1, 0      	ADDWFC	r0x02, F
00346c   c010     movff	0x10, 0xfe1        	MOVFF	r0x00, FSR0L
00346e   ffe1
003470   c012     movff	0x12, 0xfe2        	MOVFF	r0x02, FSR0H
003472   ffe2
003474   cfe7     movff	0xfe7, 0x10        	MOVFF	INDF0, r0x00
003476   f010
003478   0610     decf	0x10, 0x1, 0        	DECF	r0x00, F
00347a   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00347c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00347e   ec9b     call	0x3d36, 0           	CALL	_PRG_CHNG
003480   f01e
003482   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
003484   d009     bra	0x3498               	BRA	_00161_DS_
                                           _00160_DS_:
                                           ;	.line	31; keyboard.c	MIOS_LCD_PrintCString("EDIT PATTERN");
003486   0e00     movlw	0                  	MOVLW	UPPER(__str_5)
003488   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00348a   0e36     movlw	0x36               	MOVLW	HIGH(__str_5)
00348c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00348e   0ee4     movlw	0xe4               	MOVLW	LOW(__str_5)
003490   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
003492   f020
003494   0e02     movlw	0x2                	MOVLW	0x02
003496   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           _00161_DS_:
003498   0100     movlb	0                  	BANKSEL	_midi_channel
                                           ;	.line	48; keyboard.c	led_num(midi_channel);
00349a   51c5     movf	0xc5, 0, 0x1        	MOVF	_midi_channel, W, B
00349c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00349e   ecf8     call	0x3df0, 0           	CALL	_led_num
0034a0   f01e
0034a2   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           ;	.line	49; keyboard.c	return;
0034a4   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
0034a6   f012
0034a8   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
0034aa   f011
0034ac   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
0034ae   f010
0034b0   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
0034b2   ffd9
0034b4   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__PRG_CHNG	code
                                           _PRG_CHNG:
                                           ;	.line	9; prg_change.c	void PRG_CHNG(unsigned char prgnum){//CHANGE PROGRAM FOR CURRENT MIDI CHANNEL
003d36   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
003d38   ffed
003d3a   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
003d3c   ffd9
003d3e   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
003d40   ffed
003d42   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
003d44   ffed
003d46   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
003d48   ffed
003d4a   0e02     movlw	0x2                	MOVLW	0x02
003d4c   cfdb     movff	0xfdb, 0x10        	MOVFF	PLUSW2, r0x00
003d4e   f010
                                           ;	.line	10; prg_change.c	if(prgnum>127)prgnum=127;
003d50   0e80     movlw	0x80               	MOVLW	0x80
003d52   5c10     subwf	0x10, 0, 0         	SUBWF	r0x00, W
003d54   e302     bnc	0x3d5a               	BNC	_00137_DS_
003d56   0e7f     movlw	0x7f               	MOVLW	0x7f
003d58   6e10     movwf	0x10, 0            	MOVWF	r0x00
                                           _00137_DS_:
                                           ;	.line	11; prg_change.c	prg[midi_channel]=prgnum;
003d5a   0eb5     movlw	0xb5               	MOVLW	LOW(_prg)
003d5c   0100     movlb	0                  	BANKSEL	_midi_channel
003d5e   25c5     addwf	0xc5, 0, 0x1       	ADDWF	_midi_channel, W, B
003d60   6e11     movwf	0x11, 0            	MOVWF	r0x01
003d62   6a12     clrf	0x12, 0             	CLRF	r0x02
003d64   0e00     movlw	0                  	MOVLW	HIGH(_prg)
003d66   2212     addwfc	0x12, 0x1, 0      	ADDWFC	r0x02, F
003d68   c011     movff	0x11, 0xfe1        	MOVFF	r0x01, FSR0L
003d6a   ffe1
003d6c   c012     movff	0x12, 0xfe2        	MOVFF	r0x02, FSR0H
003d6e   ffe2
003d70   c010     movff	0x10, 0xfe7        	MOVFF	r0x00, INDF0
003d72   ffe7
                                           ;	.line	12; prg_change.c	MIOS_LCD_CursorSet(0x00);
003d74   0e00     movlw	0                  	MOVLW	0x00
003d76   ec88     call	0x2d10, 0           	CALL	_MIOS_LCD_CursorSet
003d78   f016
                                           ;	.line	13; prg_change.c	MIOS_LCD_PrintCString("CHN");
003d7a   0e00     movlw	0                  	MOVLW	UPPER(__str_3)
003d7c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003d7e   0e36     movlw	0x36               	MOVLW	HIGH(__str_3)
003d80   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003d82   0eda     movlw	0xda               	MOVLW	LOW(__str_3)
003d84   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
003d86   f020
003d88   0e02     movlw	0x2                	MOVLW	0x02
003d8a   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
003d8c   0100     movlb	0                  	BANKSEL	_midi_channel
                                           ;	.line	14; prg_change.c	MIOS_LCD_PrintBCD2(midi_channel+1);
003d8e   29c5     incf	0xc5, 0, 0x1        	INCF	_midi_channel, W, B
003d90   6e11     movwf	0x11, 0            	MOVWF	r0x01
003d92   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003d94   ec90     call	0x2d20, 0           	CALL	_MIOS_LCD_PrintBCD2
003d96   f016
                                           ;	.line	15; prg_change.c	MIOS_LCD_PrintCString(" PRG");
003d98   0e00     movlw	0                  	MOVLW	UPPER(__str_4)
003d9a   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003d9c   0e36     movlw	0x36               	MOVLW	HIGH(__str_4)
003d9e   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003da0   0ede     movlw	0xde               	MOVLW	LOW(__str_4)
003da2   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
003da4   f020
003da6   0e02     movlw	0x2                	MOVLW	0x02
003da8   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	16; prg_change.c	MIOS_LCD_PrintBCD3(prg[midi_channel]);
003daa   0eb5     movlw	0xb5               	MOVLW	LOW(_prg)
003dac   0100     movlb	0                  	BANKSEL	_midi_channel
003dae   25c5     addwf	0xc5, 0, 0x1       	ADDWF	_midi_channel, W, B
003db0   6e11     movwf	0x11, 0            	MOVWF	r0x01
003db2   6a12     clrf	0x12, 0             	CLRF	r0x02
003db4   0e00     movlw	0                  	MOVLW	HIGH(_prg)
003db6   2212     addwfc	0x12, 0x1, 0      	ADDWFC	r0x02, F
003db8   c011     movff	0x11, 0xfe1        	MOVFF	r0x01, FSR0L
003dba   ffe1
003dbc   c012     movff	0x12, 0xfe2        	MOVFF	r0x02, FSR0H
003dbe   ffe2
003dc0   cfe7     movff	0xfe7, 0x11        	MOVFF	INDF0, r0x01
003dc2   f011
003dc4   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003dc6   ec92     call	0x2d24, 0           	CALL	_MIOS_LCD_PrintBCD3
003dc8   f016
                                           ;	.line	18; prg_change.c	MIOS_MIDI_TxBufferPut(192 + midi_channel);//PRG CHANGE
003dca   0ec0     movlw	0xc0               	MOVLW	0xc0
003dcc   0100     movlb	0                  	BANKSEL	_midi_channel
003dce   25c5     addwf	0xc5, 0, 0x1       	ADDWF	_midi_channel, W, B
003dd0   6e11     movwf	0x11, 0            	MOVWF	r0x01
003dd2   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003dd4   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003dd6   f016
                                           ;	.line	19; prg_change.c	MIOS_MIDI_TxBufferPut(prgnum);//PRG CHANGE NUM
003dd8   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003dda   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003ddc   f016
                                           ;	.line	21; prg_change.c	return;
003dde   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
003de0   f012
003de2   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
003de4   f011
003de6   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
003de8   f010
003dea   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
003dec   ffd9
003dee   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__Init	code
                                           _Init:
                                           ;	.line	24; init.c	MIOS_CLCD_SpecialCharsInit(lcd_charset);
004024   0e00     movlw	0                  	MOVLW	UPPER(_lcd_charset)
004026   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
004028   0e36     movlw	0x36               	MOVLW	HIGH(_lcd_charset)
00402a   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00402c   0e80     movlw	0x80               	MOVLW	LOW(_lcd_charset)
00402e   ec9f     call	0x433e, 0           	CALL	_MIOS_CLCD_SpecialCharsInit
004030   f021
004032   0e02     movlw	0x2                	MOVLW	0x02
004034   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	27; init.c	MIOS_SRIO_NumberSet(16);           // use up to 16 shift registers
004036   0e10     movlw	0x10               	MOVLW	0x10
004038   ec78     call	0x2cf0, 0           	CALL	_MIOS_SRIO_NumberSet
00403a   f016
                                           ;	.line	28; init.c	MIOS_SRIO_UpdateFrqSet(1);         // set update frequency
00403c   0e01     movlw	0x1                	MOVLW	0x01
00403e   ec80     call	0x2d00, 0           	CALL	_MIOS_SRIO_UpdateFrqSet
004040   f016
                                           ;	.line	31; init.c	MIOS_SRIO_TS_SensitivitySet(0);    // disable touch sensors
004042   0e00     movlw	0                  	MOVLW	0x00
004044   ec7c     call	0x2cf8, 0           	CALL	_MIOS_SRIO_TS_SensitivitySet
004046   f016
                                           ;	.line	34; init.c	MIOS_AIN_NumberSet(8);   // nb pots connected
004048   0e08     movlw	0x8                	MOVLW	0x08
00404a   ec36     call	0x2c6c, 0           	CALL	_MIOS_AIN_NumberSet
00404c   f016
                                           ;	.line	35; init.c	MIOS_AIN_UnMuxed();      // no AINX4 modules are used
00404e   ec40     call	0x2c80, 0           	CALL	_MIOS_AIN_UnMuxed
004050   f016
                                           ;	.line	36; init.c	MIOS_AIN_DeadbandSet(7); // should be 7 when 7bit resolution is used
004052   0e07     movlw	0x7                	MOVLW	0x07
004054   ec30     call	0x2c60, 0           	CALL	_MIOS_AIN_DeadbandSet
004056   f016
                                           ;	.line	39; init.c	SM_Init();
004058   ec35     call	0x386a, 0           	CALL	_SM_Init
00405a   f01c
                                           ;	.line	42; init.c	MCLOCK_Init();
00405c   ec3b     call	0x4276, 0           	CALL	_MCLOCK_Init
00405e   f021
                                           ;	.line	43; init.c	MCLOCK_BPMSet(120);
004060   0e78     movlw	0x78               	MOVLW	0x78
004062   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
004064   ec39     call	0x4072, 0           	CALL	_MCLOCK_BPMSet
004066   f020
004068   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           ;	.line	47; init.c	transpose=36;
00406a   0e24     movlw	0x24               	MOVLW	0x24
00406c   0100     movlb	0                  	BANKSEL	_transpose
00406e   6fc6     movwf	0xc6, 0x1          	MOVWF	_transpose, B
004070   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__AIN_NotifyChange	code
                                           _AIN_NotifyChange:
                                           ;	.line	5; ain.c	void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam
00374a   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
00374c   ffed
00374e   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
003750   ffd9
003752   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
003754   ffed
003756   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
003758   ffed
00375a   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
00375c   ffed
00375e   c013     movff	0x13, 0xfed        	MOVFF	r0x03, POSTDEC1
003760   ffed
003762   6e10     movwf	0x10, 0            	MOVWF	r0x00
003764   0e02     movlw	0x2                	MOVLW	0x02
003766   cfdb     movff	0xfdb, 0x11        	MOVFF	PLUSW2, r0x01
003768   f011
00376a   0e03     movlw	0x3                	MOVLW	0x03
00376c   cfdb     movff	0xfdb, 0x12        	MOVFF	PLUSW2, r0x02
00376e   f012
                                           ;	.line	9; ain.c	MIOS_LCD_CursorSet(0x40); // 2nd line
003770   0e40     movlw	0x40               	MOVLW	0x40
003772   ec88     call	0x2d10, 0           	CALL	_MIOS_LCD_CursorSet
003774   f016
                                           ;	.line	36; ain.c	switch(pin){
003776   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003778   e008     bz	0x378a                	BZ	_00109_DS_
00377a   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00377c   0a01     xorlw	0x1                	XORLW	0x01
00377e   e027     bz	0x37ce                	BZ	_00110_DS_
003780   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003782   0a03     xorlw	0x3                	XORLW	0x03
003784   e101     bnz	0x3788               	BNZ	_00126_DS_
003786   d045     bra	0x3812               	BRA	_00111_DS_
                                           _00126_DS_:
003788   d065     bra	0x3854               	BRA	_00115_DS_
                                           _00109_DS_:
                                           ;	.line	39; ain.c	MIOS_LCD_PrintCString("cc46:");
00378a   0e00     movlw	0                  	MOVLW	UPPER(__str_0)
00378c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00378e   0e36     movlw	0x36               	MOVLW	HIGH(__str_0)
003790   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003792   0ec8     movlw	0xc8               	MOVLW	LOW(__str_0)
003794   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
003796   f020
003798   0e02     movlw	0x2                	MOVLW	0x02
00379a   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	40; ain.c	MIOS_LCD_PrintBCD3(MIOS_AIN_Pin7bitGet(pin));
00379c   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00379e   ec38     call	0x2c70, 0           	CALL	_MIOS_AIN_Pin7bitGet
0037a0   f016
0037a2   6e13     movwf	0x13, 0            	MOVWF	r0x03
0037a4   5013     movf	0x13, 0, 0          	MOVF	r0x03, W
0037a6   ec92     call	0x2d24, 0           	CALL	_MIOS_LCD_PrintBCD3
0037a8   f016
                                           ;	.line	41; ain.c	MIOS_MIDI_TxBufferPut(176 + midi_channel); // CC at channel n
0037aa   0eb0     movlw	0xb0               	MOVLW	0xb0
0037ac   0100     movlb	0                  	BANKSEL	_midi_channel
0037ae   25c5     addwf	0xc5, 0, 0x1       	ADDWF	_midi_channel, W, B
0037b0   6e13     movwf	0x13, 0            	MOVWF	r0x03
0037b2   5013     movf	0x13, 0, 0          	MOVF	r0x03, W
0037b4   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
0037b6   f016
                                           ;	.line	42; ain.c	MIOS_MIDI_TxBufferPut(46);  // pin number corresponds to CC number
0037b8   0e2e     movlw	0x2e               	MOVLW	0x2e
0037ba   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
0037bc   f016
                                           ;	.line	43; ain.c	MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));   // don't send 10bit pin_value,
0037be   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0037c0   ec38     call	0x2c70, 0           	CALL	_MIOS_AIN_Pin7bitGet
0037c2   f016
0037c4   6e13     movwf	0x13, 0            	MOVWF	r0x03
0037c6   5013     movf	0x13, 0, 0          	MOVF	r0x03, W
0037c8   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
0037ca   f016
                                           ;	.line	45; ain.c	break;
0037cc   d043     bra	0x3854               	BRA	_00115_DS_
                                           _00110_DS_:
                                           ;	.line	48; ain.c	MIOS_LCD_PrintCString("cc47:");
0037ce   0e00     movlw	0                  	MOVLW	UPPER(__str_1)
0037d0   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
0037d2   0e36     movlw	0x36               	MOVLW	HIGH(__str_1)
0037d4   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
0037d6   0ece     movlw	0xce               	MOVLW	LOW(__str_1)
0037d8   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
0037da   f020
0037dc   0e02     movlw	0x2                	MOVLW	0x02
0037de   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	49; ain.c	MIOS_LCD_PrintBCD3(MIOS_AIN_Pin7bitGet(pin));
0037e0   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0037e2   ec38     call	0x2c70, 0           	CALL	_MIOS_AIN_Pin7bitGet
0037e4   f016
0037e6   6e13     movwf	0x13, 0            	MOVWF	r0x03
0037e8   5013     movf	0x13, 0, 0          	MOVF	r0x03, W
0037ea   ec92     call	0x2d24, 0           	CALL	_MIOS_LCD_PrintBCD3
0037ec   f016
                                           ;	.line	50; ain.c	MIOS_MIDI_TxBufferPut(176 + midi_channel); // CC at channel n
0037ee   0eb0     movlw	0xb0               	MOVLW	0xb0
0037f0   0100     movlb	0                  	BANKSEL	_midi_channel
0037f2   25c5     addwf	0xc5, 0, 0x1       	ADDWF	_midi_channel, W, B
0037f4   6e13     movwf	0x13, 0            	MOVWF	r0x03
0037f6   5013     movf	0x13, 0, 0          	MOVF	r0x03, W
0037f8   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
0037fa   f016
                                           ;	.line	51; ain.c	MIOS_MIDI_TxBufferPut(47);  // pin number corresponds to CC number
0037fc   0e2f     movlw	0x2f               	MOVLW	0x2f
0037fe   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003800   f016
                                           ;	.line	52; ain.c	MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));   // don't send 10bit pin_value,
003802   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003804   ec38     call	0x2c70, 0           	CALL	_MIOS_AIN_Pin7bitGet
003806   f016
003808   6e10     movwf	0x10, 0            	MOVWF	r0x00
00380a   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
00380c   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
00380e   f016
                                           ;	.line	54; ain.c	break;
003810   d021     bra	0x3854               	BRA	_00115_DS_
                                           _00111_DS_:
                                           ;	.line	58; ain.c	if((pin_value >>2)>=208)return;
003812   90d8     bcf	0xd8, 0, 0           	BCF	STATUS, 0
003814   3012     rrcf	0x12, 0, 0          	RRCF	r0x02, W
003816   6e10     movwf	0x10, 0            	MOVWF	r0x00
003818   3011     rrcf	0x11, 0, 0          	RRCF	r0x01, W
00381a   6e11     movwf	0x11, 0            	MOVWF	r0x01
00381c   90d8     bcf	0xd8, 0, 0           	BCF	STATUS, 0
00381e   3210     rrcf	0x10, 0x1, 0        	RRCF	r0x00, F
003820   3211     rrcf	0x11, 0x1, 0        	RRCF	r0x01, F
003822   0e00     movlw	0                  	MOVLW	0x00
003824   5c10     subwf	0x10, 0, 0         	SUBWF	r0x00, W
003826   e102     bnz	0x382c               	BNZ	_00127_DS_
003828   0ed0     movlw	0xd0               	MOVLW	0xd0
00382a   5c11     subwf	0x11, 0, 0         	SUBWF	r0x01, W
                                           _00127_DS_:
00382c   e213     bc	0x3854                	BC	_00115_DS_
                                           ;	.line	59; ain.c	MIOS_LCD_PrintCString("bpm:");
00382e   0e00     movlw	0                  	MOVLW	UPPER(__str_2)
003830   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003832   0e36     movlw	0x36               	MOVLW	HIGH(__str_2)
003834   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003836   0ed4     movlw	0xd4               	MOVLW	LOW(__str_2)
003838   ecfb     call	0x41f6, 0           	CALL	_MIOS_LCD_PrintCString
00383a   f020
00383c   0e02     movlw	0x2                	MOVLW	0x02
00383e   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
                                           ;	.line	60; ain.c	MIOS_LCD_PrintBCD3(48+(pin_value >>2));
003840   0e30     movlw	0x30               	MOVLW	0x30
003842   2611     addwf	0x11, 0x1, 0       	ADDWF	r0x01, F
003844   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
003846   ec92     call	0x2d24, 0           	CALL	_MIOS_LCD_PrintBCD3
003848   f016
                                           ;	.line	61; ain.c	MCLOCK_BPMSet(48+(pin_value >>2));
00384a   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
00384c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00384e   ec39     call	0x4072, 0           	CALL	_MCLOCK_BPMSet
003850   f020
003852   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           _00115_DS_:
                                           ;	.line	67; ain.c	return;
003854   cfec     movff	0xfec, 0x13        	MOVFF	PREINC1, r0x03
003856   f013
003858   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
00385a   f012
00385c   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
00385e   f011
003860   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
003862   f010
003864   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
003866   ffd9
003868   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_main__led_num	code
                                           _led_num:
                                           ;	.line	23; leds.c	void led_num(unsigned char num){//LIT LED
003df0   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
003df2   ffed
003df4   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
003df6   ffd9
003df8   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
003dfa   ffed
003dfc   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
003dfe   ffed
003e00   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
003e02   ffed
003e04   c013     movff	0x13, 0xfed        	MOVFF	r0x03, POSTDEC1
003e06   ffed
003e08   c014     movff	0x14, 0xfed        	MOVFF	r0x04, POSTDEC1
003e0a   ffed
003e0c   0e02     movlw	0x2                	MOVLW	0x02
003e0e   cfdb     movff	0xfdb, 0x10        	MOVFF	PLUSW2, r0x00
003e10   f010
                                           ; ;multiply lit val:0X02 by variable r0x00 and store in r0x00
                                           ; ;Unrolled 8 X 8 multiplication
                                           ; ;FIXME: the function does not support result==WREG
                                           ;	.line	24; leds.c	MIOS_DOUT_SRSet(1,led_pos[num][0]);
003e12   6a11     clrf	0x11, 0             	CLRF	r0x01
003e14   90d8     bcf	0xd8, 0, 0           	BCF	STATUS, 0
003e16   3610     rlcf	0x10, 0x1, 0        	RLCF	r0x00, F
003e18   3611     rlcf	0x11, 0x1, 0        	RLCF	r0x01, F
003e1a   0ea8     movlw	0xa8               	MOVLW	LOW(_led_pos)
003e1c   2410     addwf	0x10, 0, 0         	ADDWF	r0x00, W
003e1e   6e12     movwf	0x12, 0            	MOVWF	r0x02
003e20   0e36     movlw	0x36               	MOVLW	HIGH(_led_pos)
003e22   2011     addwfc	0x11, 0, 0        	ADDWFC	r0x01, W
003e24   6e13     movwf	0x13, 0            	MOVWF	r0x03
003e26   6a14     clrf	0x14, 0             	CLRF	r0x04
003e28   0e00     movlw	0                  	MOVLW	UPPER(_led_pos)
003e2a   2214     addwfc	0x14, 0x1, 0      	ADDWFC	r0x04, F
003e2c   c012     movff	0x12, 0xff6        	MOVFF	r0x02, TBLPTRL
003e2e   fff6
003e30   c013     movff	0x13, 0xff7        	MOVFF	r0x03, TBLPTRH
003e32   fff7
003e34   c014     movff	0x14, 0xff8        	MOVFF	r0x04, TBLPTRU
003e36   fff8
003e38   0009     tblrd	*+                 	TBLRD*+	
003e3a   cff5     movff	0xff5, 0x12        	MOVFF	TABLAT, r0x02
003e3c   f012
003e3e   5012     movf	0x12, 0, 0          	MOVF	r0x02, W
003e40   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003e42   0e01     movlw	0x1                	MOVLW	0x01
003e44   ec38     call	0x4470, 0           	CALL	_MIOS_DOUT_SRSet
003e46   f022
003e48   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           ;	.line	25; leds.c	MIOS_DOUT_SRSet(2,led_pos[num][1]);
003e4a   0ea8     movlw	0xa8               	MOVLW	LOW(_led_pos)
003e4c   2610     addwf	0x10, 0x1, 0       	ADDWF	r0x00, F
003e4e   0e36     movlw	0x36               	MOVLW	HIGH(_led_pos)
003e50   2211     addwfc	0x11, 0x1, 0      	ADDWFC	r0x01, F
003e52   0e00     movlw	0                  	MOVLW	UPPER(_led_pos)
003e54   6a12     clrf	0x12, 0             	CLRF	r0x02
003e56   2212     addwfc	0x12, 0x1, 0      	ADDWFC	r0x02, F
003e58   2a10     incf	0x10, 0x1, 0        	INCF	r0x00, F
003e5a   b0d8     btfsc	0xd8, 0, 0         	BTFSC	STATUS, 0
003e5c   2a11     incf	0x11, 0x1, 0        	INCF	r0x01, F
003e5e   b0d8     btfsc	0xd8, 0, 0         	BTFSC	STATUS, 0
003e60   2a12     incf	0x12, 0x1, 0        	INCF	r0x02, F
003e62   c010     movff	0x10, 0xff6        	MOVFF	r0x00, TBLPTRL
003e64   fff6
003e66   c011     movff	0x11, 0xff7        	MOVFF	r0x01, TBLPTRH
003e68   fff7
003e6a   c012     movff	0x12, 0xff8        	MOVFF	r0x02, TBLPTRU
003e6c   fff8
003e6e   0009     tblrd	*+                 	TBLRD*+	
003e70   cff5     movff	0xff5, 0x10        	MOVFF	TABLAT, r0x00
003e72   f010
003e74   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003e76   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
003e78   0e02     movlw	0x2                	MOVLW	0x02
003e7a   ec38     call	0x4470, 0           	CALL	_MIOS_DOUT_SRSet
003e7c   f022
003e7e   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
                                           ;	.line	26; leds.c	return;
003e80   cfec     movff	0xfec, 0x14        	MOVFF	PREINC1, r0x04
003e82   f014
003e84   cfec     movff	0xfec, 0x13        	MOVFF	PREINC1, r0x03
003e86   f013
003e88   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
003e8a   f012
003e8c   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
003e8e   f011
003e90   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
003e92   f010
003e94   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
003e96   ffd9
003e98   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block for Ival
                                           	code
                                           _note_map:
003600   3f80     incfsz	0x80, 0x1, 0x1    	DB	0x80, 0x3f, 0x80, 0x3f, 0x80, 0x7e, 0x80, 0x7f
003602   3f80     incfsz	0x80, 0x1, 0x1    
003604   7e80     btg	0x80, 0x7, 0         
003606   7f80     btg	0x80, 0x7, 0x1       
003608   c080     movff	0x80, 0x180        	DB	0x80, 0xc0, 0x80, 0xc1, 0x80, 0xc2, 0x80, 0xc3
00360a   c180
00360c   c280     movff	0x280, 0x380       
00360e   c380
003610   2420     addwf	0x20, 0, 0         	DB	0x20, 0x24, 0x1f, 0x2a, 0x80, 0x5d, 0x10, 0x3f
003612   2a1f     incf	0x1f, 0x1, 0        
003614   5d80     subwf	0x80, 0, 0x1       
003616   3f10     incfsz	0x10, 0x1, 0x1    
003618   db80     rcall	0x3d1a             	DB	0x80, 0xdb, 0x80, 0x3d, 0x21, 0x3f, 0x22, 0x3f
00361a   3d80     incfsz	0x80, 0, 0x1      
00361c   3f21     incfsz	0x21, 0x1, 0x1    
00361e   3f22     incfsz	0x22, 0x1, 0x1    
003620   2b80     incf	0x80, 0x1, 0x1      	DB	0x80, 0x2b, 0x1c, 0x50, 0x0d, 0x4c, 0x0c, 0x3c
003622   501c     movf	0x1c, 0, 0          
003624   4c0d     dcfsnz	0xd, 0, 0         
003626   3c0c     incfsz	0xc, 0, 0         
003628   3e0e     incfsz	0xe, 0x1, 0       	DB	0x0e, 0x3e, 0x0f, 0x5b, 0x1d, 0x40, 0x1e, 0x2d
00362a   5b0f     subwfb	0xf, 0x1, 0x1     
00362c   401d     rrncf	0x1d, 0, 0         
00362e   2d1e     decfsz	0x1e, 0, 0x1      
003630   3919     swapf	0x19, 0, 0x1       	DB	0x19, 0x39, 0x18, 0x49, 0x0a, 0x4a, 0x09, 0x4e
003632   4918     infsnz	0x18, 0, 0x1      
003634   4a0a     infsnz	0xa, 0x1, 0       
003636   4e09     dcfsnz	0x9, 0x1, 0       
003638   4d0b     dcfsnz	0xb, 0, 0x1       	DB	0x0b, 0x4d, 0x80, 0x4b, 0x1a, 0x4f, 0x1b, 0x30
00363a   4b80     infsnz	0x80, 0x1, 0x1    
00363c   4f1a     dcfsnz	0x1a, 0x1, 0x1    
00363e   301b     rrcf	0x1b, 0, 0          
003640   3716     rlcf	0x16, 0x1, 0x1      	DB	0x16, 0x37, 0x15, 0x59, 0x06, 0x47, 0x05, 0x56
003642   5915     subwfb	0x15, 0, 0x1      
003644   4706     rlncf	0x6, 0x1, 0x1      
003646   5605     subfwb	0x5, 0x1, 0       
003648   4207     rrncf	0x7, 0x1, 0        	DB	0x07, 0x42, 0x08, 0x48, 0x17, 0x55, 0x80, 0x38
00364a   4808     infsnz	0x8, 0, 0         
00364c   5517     subfwb	0x17, 0, 0x1      
00364e   3880     swapf	0x80, 0, 0         
003650   3512     rlcf	0x12, 0, 0x1        	DB	0x12, 0x35, 0x11, 0x52, 0x03, 0x44, 0x02, 0x58
003652   5211     movf	0x11, 0x1, 0        
003654   4403     rlncf	0x3, 0, 0          
003656   5802     subwfb	0x2, 0, 0         
003658   4304     rrncf	0x4, 0x1, 0x1      	DB	0x04, 0x43, 0x80, 0x46, 0x13, 0x54, 0x14, 0x36
00365a   4680     rlncf	0x80, 0x1, 0       
00365c   5413     subfwb	0x13, 0, 0        
00365e   3614     rlcf	0x14, 0x1, 0        
003660   330f     rrcf	0xf, 0x1, 0x1       	DB	0x0f, 0x33, 0x0e, 0x57, 0x80, 0x41, 0x80, 0xdb
003662   570e     subfwb	0xe, 0x1, 0x1     
003664   4180     rrncf	0x80, 0, 0x1       
003666   db80     rcall	0x3d68             
003668   5a00     subwfb	0, 0x1, 0         	DB	0x00, 0x5a, 0x01, 0x53, 0x10, 0x45, 0x80, 0x34
00366a   5301     movf	0x1, 0x1, 0x1       
00366c   4510     rlncf	0x10, 0, 0x1       
00366e   3480     rlcf	0x80, 0, 0          
003670   3180     rrcf	0x80, 0, 0x1        	DB	0x80, 0x31, 0x80, 0xf8, 0x80, 0xff, 0x80, 0xe0
003672   f880     dw	0xf880  ;unknown opcode 
003674   ff80     dw	0xff80  ;unknown opcode 
003676   e080     bz	0x3578                
003678   2080     addwfc	0x80, 0, 0        	DB	0x80, 0x20, 0x80, 0xfc, 0x0c, 0x51, 0x0d, 0x32
00367a   fc80     dw	0xfc80  ;unknown opcode 
00367c   510c     movf	0xc, 0, 0x1         
00367e   320d     rrcf	0xd, 0x1, 0         
                                           ; ; Starting pCode block for Ival
                                           _lcd_charset:
003680   0000     nop                      	DB	0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f
003682   0000     nop                      
003684   1f1f     comf	0x1f, 0x1, 0x1      
003686   1f1f     comf	0x1f, 0x1, 0x1      
003688   0000     nop                      	DB	0x00, 0x00, 0x00, 0x00, 0x1f, 0x11, 0x11, 0x1f
00368a   0000     nop                      
00368c   111f     iorwf	0x1f, 0, 0x1       
00368e   1f11     comf	0x11, 0x1, 0x1      
003690   0e1f     movlw	0x1f               	DB	0x1f, 0x0e, 0x04, 0x00, 0x1f, 0x1f, 0x1f, 0x1f
003692   0004     clrwdt                   
003694   1f1f     comf	0x1f, 0x1, 0x1      
003696   1f1f     comf	0x1f, 0x1, 0x1      
003698   0e1f     movlw	0x1f               	DB	0x1f, 0x0e, 0x04, 0x00, 0x1f, 0x11, 0x11, 0x1f
00369a   0004     clrwdt                   
00369c   111f     iorwf	0x1f, 0, 0x1       
00369e   1f11     comf	0x11, 0x1, 0x1      
0036a0   0c08     retlw	0x8                	DB	0x08, 0x0c, 0x0e, 0x0f, 0x0f, 0x0e, 0x0c, 0x08
0036a2   0f0e     addlw	0xe                
0036a4   0e0f     movlw	0xf                
0036a6   080c     sublw	0xc                
                                           ; ; Starting pCode block for Ival
                                           _led_pos:
0036a8   0001     dw	0x1  ;unknown opcode  	DB	0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00
0036aa   0002     dw	0x2  ;unknown opcode  
0036ac   0004     clrwdt                   
0036ae   0008     tblrd	*                  
0036b0   0010     retfie	0                 	DB	0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00
0036b2   0020     dw	0x20  ;unknown opcode 
0036b4   0040     dw	0x40  ;unknown opcode 
0036b6   0080     dw	0x80  ;unknown opcode 
0036b8   0100     movlb	0                  	DB	0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08
0036ba   0200     mulwf	0, 0               
0036bc   0400     decf	0, 0, 0             
0036be   0800     sublw	0                  
0036c0   1000     iorwf	0, 0, 0            	DB	0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80
0036c2   2000     addwfc	0, 0, 0           
0036c4   4000     rrncf	0, 0, 0            
0036c6   8000     bsf	0, 0, 0              
                                           ; ; Starting pCode block
                                           __str_0:
0036c8   6363     cpfseq	0x63, 0x1         	DB	0x63, 0x63, 0x34, 0x36, 0x3a, 0x00
0036ca   3634     rlcf	0x34, 0x1, 0        
0036cc   003a     dw	0x3a  ;unknown opcode 
                                           ; ; Starting pCode block
                                           __str_1:
0036ce   6363     cpfseq	0x63, 0x1         	DB	0x63, 0x63, 0x34, 0x37, 0x3a, 0x00
0036d0   3734     rlcf	0x34, 0x1, 0x1      
0036d2   003a     dw	0x3a  ;unknown opcode 
                                           ; ; Starting pCode block
                                           __str_2:
0036d4   7062     btg	0x62, 0, 0           	DB	0x62, 0x70, 0x6d, 0x3a, 0x00
0036d6   3a6d     swapf	0x6d, 0x1, 0       
0036d8   0000     nop                      
                                           ; ; Starting pCode block
                                           __str_3:
0036da   4843     infsnz	0x43, 0, 0        	DB	0x43, 0x48, 0x4e, 0x00
0036dc   004e     dw	0x4e  ;unknown opcode 
                                           ; ; Starting pCode block
                                           __str_4:
0036de   5020     movf	0x20, 0, 0          	DB	0x20, 0x50, 0x52, 0x47, 0x00
0036e0   4752     rlncf	0x52, 0x1, 0x1     
0036e2   0000     nop                      
                                           ; ; Starting pCode block
                                           __str_5:
0036e4   4445     rlncf	0x45, 0, 0         	DB	0x45, 0x44, 0x49, 0x54, 0x20, 0x50, 0x41, 0x54
0036e6   5449     subfwb	0x49, 0, 0        
0036e8   5020     movf	0x20, 0, 0          
0036ea   5441     subfwb	0x41, 0, 0        
0036ec   4554     rlncf	0x54, 0, 0x1       	DB	0x54, 0x45, 0x52, 0x4e, 0x00
0036ee   4e52     dcfsnz	0x52, 0x1, 0      
0036f0   0000     nop                      
                                           ; ; Starting pCode block for Ival
                                           _chans:
0036f2   0800     sublw	0                  	DB	0x00, 0x08, 0x07, 0x00
0036f4   0007     daw                      
                                           ; ; Starting pCode block for Ival
                                           _patchans:
0036f6   0000     nop                      	DB	0x00, 0x00, 0x00, 0x00
0036f8   0000     nop                      
                                           ; ; Starting pCode block
                                           __str_6:
0036fa   4c41     dcfsnz	0x41, 0, 0        	DB	0x41, 0x4c, 0x4c, 0x20, 0x4e, 0x4f, 0x54, 0x45
0036fc   204c     addwfc	0x4c, 0, 0        
0036fe   4f4e     dcfsnz	0x4e, 0x1, 0x1    
003700   4554     rlncf	0x54, 0, 0x1       
003702   2053     addwfc	0x53, 0, 0        	DB	0x53, 0x20, 0x4f, 0x46, 0x46, 0x00
003704   464f     rlncf	0x4f, 0x1, 0       
003706   0046     dw	0x46  ;unknown opcode 
                                           ; ; Starting pCode block for Ival
                                           _note_name:
003708   2d43     decfsz	0x43, 0, 0x1      	DB	0x43, 0x2d, 0x00, 0x43, 0x23, 0x00, 0x44, 0x2d
00370a   4300     rrncf	0, 0x1, 0x1        
00370c   0023     dw	0x23  ;unknown opcode 
00370e   2d44     decfsz	0x44, 0, 0x1      
003710   4400     rlncf	0, 0, 0            	DB	0x00, 0x44, 0x23, 0x00, 0x45, 0x2d, 0x00, 0x46
003712   0023     dw	0x23  ;unknown opcode 
003714   2d45     decfsz	0x45, 0, 0x1      
003716   4600     rlncf	0, 0x1, 0          
003718   002d     dw	0x2d  ;unknown opcode 	DB	0x2d, 0x00, 0x46, 0x23, 0x00, 0x47, 0x2d, 0x00
00371a   2346     addwfc	0x46, 0x1, 0x1    
00371c   4700     rlncf	0, 0x1, 0x1        
00371e   002d     dw	0x2d  ;unknown opcode 
003720   2347     addwfc	0x47, 0x1, 0x1    	DB	0x47, 0x23, 0x00, 0x41, 0x2d, 0x00, 0x41, 0x23
003722   4100     rrncf	0, 0, 0x1          
003724   002d     dw	0x2d  ;unknown opcode 
003726   2341     addwfc	0x41, 0x1, 0x1    
003728   4200     rrncf	0, 0x1, 0          	DB	0x00, 0x42, 0x2d, 0x00
00372a   002d     dw	0x2d  ;unknown opcode 
                                           ; ; Starting pCode block
                                           __str_7:
00372c   554e     subfwb	0x4e, 0, 0x1      	DB	0x4e, 0x55, 0x4c, 0x00
00372e   004c     dw	0x4c  ;unknown opcode 
                                           ; ; Starting pCode block
                                           __str_8:
003730   4150     rrncf	0x50, 0, 0x1       	DB	0x50, 0x41, 0x44, 0x00
003732   0044     dw	0x44  ;unknown opcode 
                                           ; ; Starting pCode block
                                           __str_9:
003734   2e20     decfsz	0x20, 0x1, 0      	DB	0x20, 0x2e, 0x3a, 0x20, 0x53, 0x49, 0x44, 0x41
003736   203a     addwfc	0x3a, 0, 0        
003738   4953     infsnz	0x53, 0, 0x1      
00373a   4144     rrncf	0x44, 0, 0x1       
00373c   4942     infsnz	0x42, 0, 0x1      	DB	0x42, 0x49, 0x54, 0x42, 0x4f, 0x58, 0x36, 0x34
00373e   4254     rrncf	0x54, 0x1, 0       
003740   584f     subwfb	0x4f, 0, 0        
003742   3436     rlcf	0x36, 0, 0          
003744   3a20     swapf	0x20, 0x1, 0       	DB	0x20, 0x3a, 0x2e, 0x20, 0x00
003746   202e     addwfc	0x2e, 0, 0        
003748   0000     nop                      
                                           
                                           
                                           ; Statistics:
                                           ; code size:	 2506 (0x09ca) bytes (1.91%)
                                           ;           	 1253 (0x04e5) words
                                           ; udata size:	  308 (0x0134) bytes (24.06%)
                                           ; access size:	    7 (0x0007) bytes
                                           
                                           
                                           	end
                                           ;; BEGIN inserted by fixasm.pl
                                           ;; MPASM workarounds:
                                           BANKED  EQU 1
                                           ;; END inserted by fixasm.pl
                                           ;--------------------------------------------------------
                                           ; File Created by SDCC : FreeWare ANSI-C Compiler
                                           ; Version 2.5.0 #1020 (May  8 2005)
                                           ; This file generated Sat Feb 10 00:55:22 2007
                                           ;--------------------------------------------------------
                                           ; PIC16 port for the Microchip 16-bit core micros
                                           ;--------------------------------------------------------
                                           	list	p=18f452
                                           
                                           	radix dec
                                           
                                           ;--------------------------------------------------------
                                           ; extern variables in this module
                                           ;--------------------------------------------------------
                                           	extern _MIOS_BOX_CFG0
                                           	extern _MIOS_BOX_CFG1
                                           	extern _MIOS_BOX_STAT
                                           	extern _MIOS_PARAMETER1
                                           	extern _MIOS_PARAMETER2
                                           	extern _MIOS_PARAMETER3
                                           	extern _PORTAbits
                                           	extern _PORTBbits
                                           	extern _PORTCbits
                                           	extern _PORTDbits
                                           	extern _PORTEbits
                                           	extern _LATAbits
                                           	extern _LATBbits
                                           	extern _LATCbits
                                           	extern _LATDbits
                                           	extern _LATEbits
                                           	extern _TRISAbits
                                           	extern _TRISBbits
                                           	extern _TRISCbits
                                           	extern _TRISDbits
                                           	extern _TRISEbits
                                           	extern _PIE1bits
                                           	extern _PIR1bits
                                           	extern _IPR1bits
                                           	extern _PIE2bits
                                           	extern _PIR2bits
                                           	extern _IPR2bits
                                           	extern _EECON1bits
                                           	extern _RCSTAbits
                                           	extern _TXSTAbits
                                           	extern _T3CONbits
                                           	extern _CCP2CONbits
                                           	extern _CCP1CONbits
                                           	extern _ADCON1bits
                                           	extern _ADCON0bits
                                           	extern _SSPCON2bits
                                           	extern _SSPCON1bits
                                           	extern _SSPSTATbits
                                           	extern _T2CONbits
                                           	extern _T1CONbits
                                           	extern _RCONbits
                                           	extern _WDTCONbits
                                           	extern _LVDCONbits
                                           	extern _OSCCONbits
                                           	extern _T0CONbits
                                           	extern _STATUSbits
                                           	extern _INTCON3bits
                                           	extern _INTCON2bits
                                           	extern _INTCONbits
                                           	extern _STKPTRbits
                                           	extern _app_flags
                                           	extern _PORTA
                                           	extern _PORTB
                                           	extern _PORTC
                                           	extern _PORTD
                                           	extern _PORTE
                                           	extern _LATA
                                           	extern _LATB
                                           	extern _LATC
                                           	extern _LATD
                                           	extern _LATE
                                           	extern _TRISA
                                           	extern _TRISB
                                           	extern _TRISC
                                           	extern _TRISD
                                           	extern _TRISE
                                           	extern _PIE1
                                           	extern _PIR1
                                           	extern _IPR1
                                           	extern _PIE2
                                           	extern _PIR2
                                           	extern _IPR2
                                           	extern _EECON1
                                           	extern _EECON2
                                           	extern _EEDATA
                                           	extern _EEADR
                                           	extern _RCSTA
                                           	extern _TXSTA
                                           	extern _TXREG
                                           	extern _RCREG
                                           	extern _SPBRG
                                           	extern _T3CON
                                           	extern _TMR3L
                                           	extern _TMR3H
                                           	extern _CCP2CON
                                           	extern _CCPR2L
                                           	extern _CCPR2H
                                           	extern _CCP1CON
                                           	extern _CCPR1L
                                           	extern _CCPR1H
                                           	extern _ADCON1
                                           	extern _ADCON0
                                           	extern _ADRESL
                                           	extern _ADRESH
                                           	extern _SSPCON2
                                           	extern _SSPCON1
                                           	extern _SSPSTAT
                                           	extern _SSPADD
                                           	extern _SSPBUF
                                           	extern _T2CON
                                           	extern _PR2
                                           	extern _TMR2
                                           	extern _T1CON
                                           	extern _TMR1L
                                           	extern _TMR1H
                                           	extern _RCON
                                           	extern _WDTCON
                                           	extern _LVDCON
                                           	extern _OSCCON
                                           	extern _T0CON
                                           	extern _TMR0L
                                           	extern _TMR0H
                                           	extern _STATUS
                                           	extern _FSR2L
                                           	extern _FSR2H
                                           	extern _PLUSW2
                                           	extern _PREINC2
                                           	extern _POSTDEC2
                                           	extern _POSTINC2
                                           	extern _INDF2
                                           	extern _BSR
                                           	extern _FSR1L
                                           	extern _FSR1H
                                           	extern _PLUSW1
                                           	extern _PREINC1
                                           	extern _POSTDEC1
                                           	extern _POSTINC1
                                           	extern _INDF1
                                           	extern _WREG
                                           	extern _FSR0L
                                           	extern _FSR0H
                                           	extern _PLUSW0
                                           	extern _PREINC0
                                           	extern _POSTDEC0
                                           	extern _POSTINC0
                                           	extern _INDF0
                                           	extern _INTCON3
                                           	extern _INTCON2
                                           	extern _INTCON
                                           	extern _PRODL
                                           	extern _PRODH
                                           	extern _TABLAT
                                           	extern _TBLPTRL
                                           	extern _TBLPTRH
                                           	extern _TBLPTRU
                                           	extern _PCL
                                           	extern _PCLATH
                                           	extern _PCLATU
                                           	extern _STKPTR
                                           	extern _TOSL
                                           	extern _TOSH
                                           	extern _TOSU
                                           	extern _MIOS_MIDI_TxBufferPut
                                           	extern _MIOS_TIMER_ReInit
                                           	extern _PUSH
                                           	extern _MIOS_MPROC_EVENT_TABLE
                                           	extern _MIOS_ENC_PIN_TABLE
                                           
                                           ;--------------------------------------------------------
                                           ; public variables in this module
                                           ;--------------------------------------------------------
                                           	global _REMB1
                                           	global _REMB0
                                           	global _LOOPCOUNT
                                           	global _BARGB1
                                           	global _BARGB0
                                           	global _AARGB2
                                           	global _AARGB1
                                           	global _AARGB0
                                           	global _MCLOCK_Init
                                           	global _MCLOCK_Tick
                                           	global _MCLOCK_Timer
                                           	global _MCLOCK_GetTimerValue
                                           	global _MCLOCK_BPMSet
                                           	global _MCLOCK_BPMGet
                                           	global _MCLOCK_ResetMeter
                                           	global _MCLOCK_SendMeter
                                           	global _MCLOCK_DoStop
                                           	global _MCLOCK_DoPause
                                           	global _MCLOCK_DoPlay
                                           	global _MCLOCK_DoRew
                                           	global _MCLOCK_DoFwd
                                           	global _mclock_state
                                           	global _mclock_pin_state
                                           	global _mclock_tick_ctr
                                           	global _bpm
                                           	global _mclock_ctr_24
                                           	global _mclock_ctr_beats
                                           	global _mclock_ctr_measures
                                           ;--------------------------------------------------------
                                           ;	Equates to used internal registers
                                           ;--------------------------------------------------------
                                           STATUS	equ	0xfd8
                                           WREG	equ	0xfe8
                                           FSR1L	equ	0xfe9 ;; normaly 0xfe1, changed by fixasm.pl
                                           FSR2L	equ	0xfd9
                                           POSTDEC1	equ	0xfed ;; normaly 0xfe5, changed by fixasm.pl
                                           PREINC1	equ	0xfec ;; normaly 0xfe4, changed by fixasm.pl
                                           PLUSW2	equ	0xfdb
                                           PRODL	equ	0xff3
                                           PRODH	equ	0xff4
                                           
                                           
                                           ; Internal registers
                                           .registers	udata_ovr	0x010
                                           r0x00	res	1
                                           r0x01	res	1
                                           r0x02	res	1
                                           r0x03	res	1
                                           r0x04	res	1
                                           r0x05	res	1
                                           
                                           udata_mclock_0	udata
                                           _AARGB0	res	1
                                           
                                           udata_mclock_1	udata
                                           _AARGB1	res	1
                                           
                                           udata_mclock_2	udata
                                           _AARGB2	res	1
                                           
                                           udata_mclock_3	udata
                                           _BARGB0	res	1
                                           
                                           udata_mclock_4	udata
                                           _BARGB1	res	1
                                           
                                           udata_mclock_5	udata
                                           _LOOPCOUNT	res	1
                                           
                                           udata_mclock_6	udata
                                           _REMB0	res	1
                                           
                                           udata_mclock_7	udata
                                           _REMB1	res	1
                                           
                                           udata_mclock_8	udata
                                           _mclock_tick_ctr	res	1
                                           
                                           udata_mclock_9	udata
                                           _mclock_state	res	1
                                           
                                           udata_mclock_10	udata
                                           _mclock_pin_state	res	1
                                           
                                           udata_mclock_11	udata
                                           _mclock_ctr_24	res	1
                                           
                                           udata_mclock_12	udata
                                           _mclock_ctr_beats	res	1
                                           
                                           udata_mclock_13	udata
                                           _mclock_ctr_measures	res	1
                                           
                                           udata_mclock_14	udata
                                           _bpm	res	1
                                           
                                           ;--------------------------------------------------------
                                           ; global & static initialisations
                                           ;--------------------------------------------------------
                                           ; I code from now on!
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_DoFwd	code
                                           _MCLOCK_DoFwd:
004260   0100     movlb	0                  	BANKSEL	_mclock_ctr_measures
                                           ;	.line	377; mclock.c	++mclock_ctr_measures;
004262   2bdb     incf	0xdb, 0x1, 0x1      	INCF	_mclock_ctr_measures, F, B
004264   0100     movlb	0                  	BANKSEL	_mclock_ctr_24
                                           ;	.line	378; mclock.c	mclock_ctr_24 = 0;
004266   6bd9     clrf	0xd9, 0x1           	CLRF	_mclock_ctr_24, B
004268   0100     movlb	0                  	BANKSEL	_mclock_ctr_beats
                                           ;	.line	379; mclock.c	mclock_ctr_beats = 0;
00426a   6bda     clrf	0xda, 0x1           	CLRF	_mclock_ctr_beats, B
                                           ;	.line	382; mclock.c	MCLOCK_SendMeter();
00426c   ec4d     call	0x3e9a, 0           	CALL	_MCLOCK_SendMeter
00426e   f01f
004270   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	385; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
004272   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
004274   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_DoRew	code
                                           _MCLOCK_DoRew:
004212   0100     movlb	0                  	BANKSEL	_mclock_ctr_measures
                                           ;	.line	363; mclock.c	if( mclock_ctr_measures ) --mclock_ctr_measures;
004214   51db     movf	0xdb, 0, 0x1        	MOVF	_mclock_ctr_measures, W, B
004216   e001     bz	0x421a                	BZ	_00197_DS_
                                           ; removed redundant BANKSEL
004218   07db     decf	0xdb, 0x1, 0x1      	DECF	_mclock_ctr_measures, F, B
                                           _00197_DS_:
00421a   0100     movlb	0                  	BANKSEL	_mclock_ctr_24
                                           ;	.line	364; mclock.c	mclock_ctr_24 = 0;
00421c   6bd9     clrf	0xd9, 0x1           	CLRF	_mclock_ctr_24, B
00421e   0100     movlb	0                  	BANKSEL	_mclock_ctr_beats
                                           ;	.line	365; mclock.c	mclock_ctr_beats = 0;
004220   6bda     clrf	0xda, 0x1           	CLRF	_mclock_ctr_beats, B
                                           ;	.line	368; mclock.c	MCLOCK_SendMeter();
004222   ec4d     call	0x3e9a, 0           	CALL	_MCLOCK_SendMeter
004224   f01f
004226   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	371; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
004228   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
00422a   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_DoPlay	code
                                           _MCLOCK_DoPlay:
                                           ;	.line	350; mclock.c	MCLOCK_ResetMeter();
004308   ec1d     call	0x443a, 0           	CALL	_MCLOCK_ResetMeter
00430a   f022
                                           ;	.line	352; mclock.c	MCLOCK_SendMeter();
00430c   ec4d     call	0x3e9a, 0           	CALL	_MCLOCK_SendMeter
00430e   f01f
004310   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	354; mclock.c	mclock_state.START_REQ = 1;
004312   85d7     bsf	0xd7, 0x2, 0x1       	BSF	_mclock_state, 2, B
004314   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	357; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
004316   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
004318   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_DoPause	code
                                           _MCLOCK_DoPause:
                                           ;	.line	328; mclock.c	void MCLOCK_DoPause(void)
0040ba   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
0040bc   ffed
0040be   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	331; mclock.c	if( mclock_state.RUN ) {
0040c0   a1d7     btfss	0xd7, 0, 0x1       	BTFSS	_mclock_state, 0, B
0040c2   d007     bra	0x40d2               	BRA	_00182_DS_
                                           ; removed redundant BANKSEL
                                           ;	.line	333; mclock.c	if( mclock_state.PAUSE ) {
0040c4   a3d7     btfss	0xd7, 0x1, 0x1     	BTFSS	_mclock_state, 1, B
0040c6   d002     bra	0x40cc               	BRA	_00179_DS_
                                           ; removed redundant BANKSEL
                                           ;	.line	334; mclock.c	mclock_state.CONT_REQ = 1;
0040c8   89d7     bsf	0xd7, 0x4, 0x1       	BSF	_mclock_state, 4, B
0040ca   d014     bra	0x40f4               	BRA	_00183_DS_
                                           _00179_DS_:
0040cc   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	336; mclock.c	mclock_state.PAUSE = 1;
0040ce   83d7     bsf	0xd7, 0x1, 0x1       	BSF	_mclock_state, 1, B
0040d0   d011     bra	0x40f4               	BRA	_00183_DS_
                                           _00182_DS_:
0040d2   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	340; mclock.c	mclock_state.PAUSE = mclock_state.PAUSE ? 0 : 1;
0040d4   a3d7     btfss	0xd7, 0x1, 0x1     	BTFSS	_mclock_state, 1, B
0040d6   d002     bra	0x40dc               	BRA	_00186_DS_
0040d8   6a10     clrf	0x10, 0             	CLRF	r0x00
0040da   d002     bra	0x40e0               	BRA	_00187_DS_
                                           _00186_DS_:
0040dc   0e01     movlw	0x1                	MOVLW	0x01
0040de   6e10     movwf	0x10, 0            	MOVWF	r0x00
                                           _00187_DS_:
0040e0   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0040e2   0b01     andlw	0x1                	ANDLW	0x01
0040e4   44e8     rlncf	0xe8, 0, 0         	RLNCF	WREG, W
0040e6   0bfe     andlw	0xfe               	ANDLW	0xfe
0040e8   6ef4     movwf	0xf4, 0            	MOVWF	PRODH
0040ea   0100     movlb	0                  	BANKSEL	_mclock_state
0040ec   51d7     movf	0xd7, 0, 0x1        	MOVF	_mclock_state, W, B
0040ee   0bfd     andlw	0xfd               	ANDLW	0xfd
0040f0   10f4     iorwf	0xf4, 0, 0         	IORWF	PRODH, W
                                           ; removed redundant BANKSEL
0040f2   6fd7     movwf	0xd7, 0x1          	MOVWF	_mclock_state, B
                                           _00183_DS_:
0040f4   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	344; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
0040f6   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
0040f8   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
0040fa   f010
0040fc   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_DoStop	code
                                           _MCLOCK_DoStop:
                                           ;	.line	313; mclock.c	void MCLOCK_DoStop(void)
0041ce   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
0041d0   ffed
                                           ;	.line	315; mclock.c	if( mclock_state.RUN == 0 ) {
0041d2   6ae8     clrf	0xe8, 0             	CLRF	WREG
0041d4   0100     movlb	0                  	BANKSEL	_mclock_state
0041d6   b1d7     btfsc	0xd7, 0, 0x1       	BTFSC	_mclock_state, 0, B
0041d8   2ae8     incf	0xe8, 0x1, 0        	INCF	WREG, F
0041da   6e10     movwf	0x10, 0            	MOVWF	r0x00
0041dc   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0041de   e104     bnz	0x41e8               	BNZ	_00168_DS_
                                           ;	.line	317; mclock.c	MCLOCK_ResetMeter();
0041e0   ec1d     call	0x443a, 0           	CALL	_MCLOCK_ResetMeter
0041e2   f022
                                           ;	.line	319; mclock.c	MCLOCK_SendMeter();
0041e4   ec4d     call	0x3e9a, 0           	CALL	_MCLOCK_SendMeter
0041e6   f01f
                                           _00168_DS_:
0041e8   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	322; mclock.c	mclock_state.STOP_REQ = 1;
0041ea   87d7     bsf	0xd7, 0x3, 0x1       	BSF	_mclock_state, 3, B
0041ec   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	325; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
0041ee   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
0041f0   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
0041f2   f010
0041f4   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_SendMeter	code
                                           _MCLOCK_SendMeter:
                                           ;	.line	300; mclock.c	void MCLOCK_SendMeter(void)
003e9a   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
003e9c   ffed
003e9e   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
003ea0   ffed
003ea2   c012     movff	0x12, 0xfed        	MOVFF	r0x02, POSTDEC1
003ea4   ffed
003ea6   c013     movff	0x13, 0xfed        	MOVFF	r0x03, POSTDEC1
003ea8   ffed
003eaa   c014     movff	0x14, 0xfed        	MOVFF	r0x04, POSTDEC1
003eac   ffed
003eae   c015     movff	0x15, 0xfed        	MOVFF	r0x05, POSTDEC1
003eb0   ffed
                                           ;	.line	302; mclock.c	unsigned int songpos = (mclock_ctr_beats << 2) | (mclock_ctr_measures << 4);
003eb2   c0da     movff	0xda, 0x10         	MOVFF	_mclock_ctr_beats, r0x00
003eb4   f010
003eb6   6a11     clrf	0x11, 0             	CLRF	r0x01
003eb8   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003eba   6e12     movwf	0x12, 0            	MOVWF	r0x02
003ebc   2612     addwf	0x12, 0x1, 0       	ADDWF	r0x02, F
003ebe   3411     rlcf	0x11, 0, 0          	RLCF	r0x01, W
003ec0   6e13     movwf	0x13, 0            	MOVWF	r0x03
003ec2   90d8     bcf	0xd8, 0, 0           	BCF	STATUS, 0
003ec4   3612     rlcf	0x12, 0x1, 0        	RLCF	r0x02, F
003ec6   3613     rlcf	0x13, 0x1, 0        	RLCF	r0x03, F
003ec8   c0db     movff	0xdb, 0x10         	MOVFF	_mclock_ctr_measures, r0x00
003eca   f010
003ecc   6a11     clrf	0x11, 0             	CLRF	r0x01
003ece   3811     swapf	0x11, 0, 0         	SWAPF	r0x01, W
003ed0   0bf0     andlw	0xf0               	ANDLW	0xf0
003ed2   6e15     movwf	0x15, 0            	MOVWF	r0x05
003ed4   3810     swapf	0x10, 0, 0         	SWAPF	r0x00, W
003ed6   6e14     movwf	0x14, 0            	MOVWF	r0x04
003ed8   0b0f     andlw	0xf                	ANDLW	0x0f
003eda   1a14     xorwf	0x14, 0x1, 0       	XORWF	r0x04, F
003edc   2615     addwf	0x15, 0x1, 0       	ADDWF	r0x05, F
003ede   5014     movf	0x14, 0, 0          	MOVF	r0x04, W
003ee0   1212     iorwf	0x12, 0x1, 0       	IORWF	r0x02, F
003ee2   5015     movf	0x15, 0, 0          	MOVF	r0x05, W
003ee4   1213     iorwf	0x13, 0x1, 0       	IORWF	r0x03, F
                                           ;	.line	304; mclock.c	MIOS_MIDI_TxBufferPut(0xf2);
003ee6   0ef2     movlw	0xf2               	MOVLW	0xf2
003ee8   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003eea   f016
                                           ;	.line	305; mclock.c	MIOS_MIDI_TxBufferPut((unsigned char)(songpos & 0x7f));
003eec   0e7f     movlw	0x7f               	MOVLW	0x7f
003eee   1412     andwf	0x12, 0, 0         	ANDWF	r0x02, W
003ef0   6e10     movwf	0x10, 0            	MOVWF	r0x00
003ef2   6a11     clrf	0x11, 0             	CLRF	r0x01
003ef4   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
003ef6   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003ef8   f016
                                           ;	.line	306; mclock.c	MIOS_MIDI_TxBufferPut((unsigned char)(songpos >> 7) & 0x7f);
003efa   3412     rlcf	0x12, 0, 0          	RLCF	r0x02, W
003efc   3413     rlcf	0x13, 0, 0          	RLCF	r0x03, W
003efe   6e12     movwf	0x12, 0            	MOVWF	r0x02
003f00   6a13     clrf	0x13, 0             	CLRF	r0x03
003f02   3613     rlcf	0x13, 0x1, 0        	RLCF	r0x03, F
003f04   9e12     bcf	0x12, 0x7, 0         	BCF	r0x02, 7
003f06   5012     movf	0x12, 0, 0          	MOVF	r0x02, W
003f08   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003f0a   f016
003f0c   cfec     movff	0xfec, 0x15        	MOVFF	PREINC1, r0x05
003f0e   f015
003f10   cfec     movff	0xfec, 0x14        	MOVFF	PREINC1, r0x04
003f12   f014
003f14   cfec     movff	0xfec, 0x13        	MOVFF	PREINC1, r0x03
003f16   f013
003f18   cfec     movff	0xfec, 0x12        	MOVFF	PREINC1, r0x02
003f1a   f012
003f1c   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
003f1e   f011
003f20   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
003f22   f010
003f24   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_ResetMeter	code
                                           _MCLOCK_ResetMeter:
00443a   0100     movlb	0                  	BANKSEL	_mclock_ctr_24
                                           ;	.line	292; mclock.c	mclock_ctr_24 = 0;
00443c   6bd9     clrf	0xd9, 0x1           	CLRF	_mclock_ctr_24, B
00443e   0100     movlb	0                  	BANKSEL	_mclock_ctr_beats
                                           ;	.line	293; mclock.c	mclock_ctr_beats = 0;
004440   6bda     clrf	0xda, 0x1           	CLRF	_mclock_ctr_beats, B
004442   0100     movlb	0                  	BANKSEL	_mclock_ctr_measures
                                           ;	.line	294; mclock.c	mclock_ctr_measures = 0;
004444   6bdb     clrf	0xdb, 0x1           	CLRF	_mclock_ctr_measures, B
004446   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_BPMGet	code
                                           _MCLOCK_BPMGet:
004502   0100     movlb	0                  	BANKSEL	_bpm
                                           ;	.line	279; mclock.c	return bpm;
004504   51dc     movf	0xdc, 0, 0x1        	MOVF	_bpm, W, B
004506   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_BPMSet	code
                                           _MCLOCK_BPMSet:
                                           ;	.line	270; mclock.c	void MCLOCK_BPMSet(unsigned char _bpm)
004072   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
004074   ffed
004076   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
004078   ffd9
00407a   c010     movff	0x10, 0xfed        	MOVFF	r0x00, POSTDEC1
00407c   ffed
00407e   c011     movff	0x11, 0xfed        	MOVFF	r0x01, POSTDEC1
004080   ffed
004082   0e02     movlw	0x2                	MOVLW	0x02
004084   cfdb     movff	0xfdb, 0xdc        	MOVFF	PLUSW2, _bpm
004086   f0dc
004088   0100     movlb	0                  	BANKSEL	_bpm
                                           ;	.line	274; mclock.c	MIOS_TIMER_ReInit(3, MCLOCK_GetTimerValue(bpm));
00408a   51dc     movf	0xdc, 0, 0x1        	MOVF	_bpm, W, B
00408c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00408e   ecd7     call	0x3fae, 0           	CALL	_MCLOCK_GetTimerValue
004090   f01f
004092   6e10     movwf	0x10, 0            	MOVWF	r0x00
004094   cff3     movff	0xff3, 0x11        	MOVFF	PRODL, r0x01
004096   f011
004098   2ae9     incf	0xe9, 0x1, 0        	INCF	FSR1L, F
00409a   5011     movf	0x11, 0, 0          	MOVF	r0x01, W
00409c   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
00409e   5010     movf	0x10, 0, 0          	MOVF	r0x00, W
0040a0   6eed     movwf	0xed, 0            	MOVWF	POSTDEC1
0040a2   0e03     movlw	0x3                	MOVLW	0x03
0040a4   eceb     call	0x43d6, 0           	CALL	_MIOS_TIMER_ReInit
0040a6   f021
0040a8   0e02     movlw	0x2                	MOVLW	0x02
0040aa   26e9     addwf	0xe9, 0x1, 0       	ADDWF	FSR1L, F
0040ac   cfec     movff	0xfec, 0x11        	MOVFF	PREINC1, r0x01
0040ae   f011
0040b0   cfec     movff	0xfec, 0x10        	MOVFF	PREINC1, r0x00
0040b2   f010
0040b4   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
0040b6   ffd9
0040b8   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_GetTimerValue	code
                                           _MCLOCK_GetTimerValue:
                                           ;	.line	183; mclock.c	unsigned int MCLOCK_GetTimerValue(unsigned char bpm)
003fae   cfd9     movff	0xfd9, 0xfed       	MOVFF	FSR2L, POSTDEC1
003fb0   ffed
003fb2   cfe9     movff	0xfe9, 0xfd9       	MOVFF	FSR1L, FSR2L
003fb4   ffd9
003fb6   0e02     movlw	0x2                	MOVLW	0x02
003fb8   cfdb     movff	0xfdb, 0xd2        	MOVFF	PLUSW2, _BARGB1
003fba   f0d2
                                           ;	.line	195; mclock.c	LOOPCOUNT = 24;
003fbc   0e18     movlw	0x18               	MOVLW	0x18
003fbe   0100     movlb	0                  	BANKSEL	_LOOPCOUNT
003fc0   6fd3     movwf	0xd3, 0x1          	MOVWF	_LOOPCOUNT, B
                                           ;	.line	196; mclock.c	AARGB0 = (unsigned char)(3125000L >> 16L);
003fc2   0e2f     movlw	0x2f               	MOVLW	0x2f
003fc4   0100     movlb	0                  	BANKSEL	_AARGB0
003fc6   6fce     movwf	0xce, 0x1          	MOVWF	_AARGB0, B
                                           ;	.line	197; mclock.c	AARGB1 = (unsigned char)(3125000L >>  8L);
003fc8   0eaf     movlw	0xaf               	MOVLW	0xaf
003fca   0100     movlb	0                  	BANKSEL	_AARGB1
003fcc   6fcf     movwf	0xcf, 0x1          	MOVWF	_AARGB1, B
                                           ;	.line	198; mclock.c	AARGB2 = (unsigned char)(3125000L >>  0L);
003fce   0e08     movlw	0x8                	MOVLW	0x08
003fd0   0100     movlb	0                  	BANKSEL	_AARGB2
003fd2   6fd0     movwf	0xd0, 0x1          	MOVWF	_AARGB2, B
003fd4   0100     movlb	0                  	BANKSEL	_BARGB0
                                           ;	.line	199; mclock.c	BARGB0 = 0;
003fd6   6bd1     clrf	0xd1, 0x1           	CLRF	_BARGB0, B
                                           ;	.line	202; mclock.c	REMB0 = 1;
003fd8   0e01     movlw	0x1                	MOVLW	0x01
003fda   0100     movlb	0                  	BANKSEL	_REMB0
003fdc   6fd4     movwf	0xd4, 0x1          	MOVWF	_REMB0, B
003fde   0100     movlb	0                  	banksel _LOOPCOUNT;
003fe0   6bd4     clrf	0xd4, 0x1           	CLRF _REMB0
003fe2   6bd5     clrf	0xd5, 0x1           	CLRF _REMB1
003fe4   0e18     movlw	0x18               	MOVLW 24
003fe6   6fd3     movwf	0xd3, 0x1          	MOVWF _LOOPCOUNT
                                           LOOPU2416:
003fe8   35d0     rlcf	0xd0, 0, 0x1        	RLCF _AARGB2, W ;shift dividend left to move next bit to remainder
003fea   37cf     rlcf	0xcf, 0x1, 0x1      	RLCF _AARGB1, F ;
003fec   37ce     rlcf	0xce, 0x1, 0x1      	RLCF _AARGB0, F ;
003fee   37d5     rlcf	0xd5, 0x1, 0x1      	RLCF _REMB1, F ;shift carry (next dividend bit) into remainder
003ff0   37d4     rlcf	0xd4, 0x1, 0x1      	RLCF _REMB0, F
003ff2   37d0     rlcf	0xd0, 0x1, 0x1      	RLCF _AARGB2, F ;finish shifting the dividend and save carry in AARGB2.0,
                                           	;since remainder can be 17 bit long in some cases
                                           	;(e.g. 0x800000/0xFFFF). This bit will also serve
                                           	;as the next result bit.
003ff4   51d2     movf	0xd2, 0, 0x1        	MOVF _BARGB1, W ;substract divisor from 16-bit remainder
003ff6   5fd5     subwf	0xd5, 0x1, 0x1     	SUBWF _REMB1, F ;
003ff8   51d1     movf	0xd1, 0, 0x1        	MOVF _BARGB0, W ;
003ffa   a0d8     btfss	0xd8, 0, 0         	SKPC ;
003ffc   3dd1     incfsz	0xd1, 0, 0x1      	INCFSZ _BARGB0, W ;
003ffe   5fd4     subwf	0xd4, 0x1, 0x1     	SUBWF _REMB0, F ;
                                           	;here we also need to take into account the 17th bit of remainder, which
                                           	;is in AARGB2.0. If we dont have a borrow after subtracting from lower
                                           	;16 bits of remainder, then there is no borrow regardless of 17th bit
                                           	;value. But, if we have the borrow, then that will depend on 17th bit
                                           	;value. If it is 1, then no final borrow will occur. If it is 0, borrow
                                           	;will occur. These values match the borrow flag polarity.
004000   b0d8     btfsc	0xd8, 0, 0         	SKPNC ;if no borrow after 16 bit subtraction
004002   81d0     bsf	0xd0, 0, 0x1         	BSF _AARGB2, 0 ;then there is no borrow in result. Overwrite
                                           	;AARGB2.0 with 1 to indicate no
                                           	;borrow.
                                           	;if borrow did occur, AARGB2.0 already
                                           	;holds the final borrow value (0-borrow,
                                           	;1-no borrow)
004004   b1d0     btfsc	0xd0, 0, 0x1       	BTFSC _AARGB2, 0 ;if no borrow after 17-bit subtraction
004006   d003     bra	0x400e               	BRA UOK46LL ;skip remainder restoration.
004008   27d4     addwf	0xd4, 0x1, 0x1     	ADDWF _REMB0, F ;restore higher byte of remainder. (w
                                           	;contains the value subtracted from it
                                           	;previously)
00400a   51d2     movf	0xd2, 0, 0x1        	MOVF _BARGB1, W ;restore lower byte of remainder
00400c   27d5     addwf	0xd5, 0x1, 0x1     	ADDWF _REMB1, F ;
                                           UOK46LL:
00400e   2fd3     decfsz	0xd3, 0x1, 0x1    	DECFSZ _LOOPCOUNT, f ;decrement counter
004010   d7eb     bra	0x3fe8               	BRA LOOPU2416 ;and repeat the loop if not zero.
004012   c0cf     movff	0xcf, 0xff3        	movff _AARGB1, _PRODL
004014   fff3
004016   51d0     movf	0xd0, 0, 0x1        	movf _AARGB2, W
004018   0012     return	0                 	return
                                           ;	.line	264; mclock.c	return 0; // dummy return 
00401a   6af3     clrf	0xf3, 0             	CLRF	PRODL
00401c   6ae8     clrf	0xe8, 0             	CLRF	WREG
00401e   cfec     movff	0xfec, 0xfd9       	MOVFF	PREINC1, FSR2L
004020   ffd9
004022   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_Timer	code
                                           _MCLOCK_Timer:
0042b8   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	157; mclock.c	if( mclock_state.RUN && !mclock_state.PAUSE) {
0042ba   a1d7     btfss	0xd7, 0, 0x1       	BTFSS	_mclock_state, 0, B
0042bc   d006     bra	0x42ca               	BRA	_00142_DS_
                                           ; removed redundant BANKSEL
0042be   b3d7     btfsc	0xd7, 0x1, 0x1     	BTFSC	_mclock_state, 1, B
0042c0   d004     bra	0x42ca               	BRA	_00142_DS_
0042c2   0100     movlb	0                  	BANKSEL	_mclock_tick_ctr
                                           ;	.line	158; mclock.c	++mclock_tick_ctr;
0042c4   2bd6     incf	0xd6, 0x1, 0x1      	INCF	_mclock_tick_ctr, F, B
0042c6   0100     movlb	0                  	BANKSEL	_mclock_pin_state
                                           ;	.line	159; mclock.c	mclock_pin_state.CLK_REQ = 1;
0042c8   81d8     bsf	0xd8, 0, 0x1         	BSF	_mclock_pin_state, 0, B
                                           _00142_DS_:
0042ca   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_Tick	code
                                           _MCLOCK_Tick:
003f26   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	85; mclock.c	if( mclock_state.START_REQ ) {
003f28   a5d7     btfss	0xd7, 0x2, 0x1     	BTFSS	_mclock_state, 2, B
003f2a   d008     bra	0x3f3c               	BRA	_00110_DS_
                                           ; removed redundant BANKSEL
                                           ;	.line	86; mclock.c	mclock_state.START_REQ = 0;
003f2c   95d7     bcf	0xd7, 0x2, 0x1       	BCF	_mclock_state, 2, B
                                           ;	.line	87; mclock.c	MIOS_MIDI_TxBufferPut(0xfa);
003f2e   0efa     movlw	0xfa               	MOVLW	0xfa
003f30   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003f32   f016
003f34   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	88; mclock.c	mclock_state.RUN = 1;
003f36   81d7     bsf	0xd7, 0, 0x1         	BSF	_mclock_state, 0, B
003f38   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	91; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
003f3a   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
                                           _00110_DS_:
003f3c   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	95; mclock.c	if( mclock_state.CONT_REQ ) {
003f3e   a9d7     btfss	0xd7, 0x4, 0x1     	BTFSS	_mclock_state, 4, B
003f40   d008     bra	0x3f52               	BRA	_00112_DS_
                                           ; removed redundant BANKSEL
                                           ;	.line	96; mclock.c	mclock_state.CONT_REQ = 0;
003f42   99d7     bcf	0xd7, 0x4, 0x1       	BCF	_mclock_state, 4, B
                                           ;	.line	97; mclock.c	MIOS_MIDI_TxBufferPut(0xfb);
003f44   0efb     movlw	0xfb               	MOVLW	0xfb
003f46   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003f48   f016
003f4a   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	98; mclock.c	mclock_state.PAUSE = 0;
003f4c   93d7     bcf	0xd7, 0x1, 0x1       	BCF	_mclock_state, 1, B
003f4e   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	101; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
003f50   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
                                           _00112_DS_:
003f52   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	105; mclock.c	if( mclock_state.STOP_REQ ) {
003f54   a7d7     btfss	0xd7, 0x3, 0x1     	BTFSS	_mclock_state, 3, B
003f56   d00b     bra	0x3f6e               	BRA	_00119_DS_
                                           ; removed redundant BANKSEL
                                           ;	.line	106; mclock.c	mclock_state.STOP_REQ = 0;
003f58   97d7     bcf	0xd7, 0x3, 0x1       	BCF	_mclock_state, 3, B
                                           ;	.line	107; mclock.c	MIOS_MIDI_TxBufferPut(0xfc);
003f5a   0efc     movlw	0xfc               	MOVLW	0xfc
003f5c   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003f5e   f016
003f60   0100     movlb	0                  	BANKSEL	_mclock_state
                                           ;	.line	108; mclock.c	mclock_state.RUN = 0;
003f62   91d7     bcf	0xd7, 0, 0x1         	BCF	_mclock_state, 0, B
                                           ;	.line	109; mclock.c	mclock_state.PAUSE = 0;
003f64   93d7     bcf	0xd7, 0x1, 0x1       	BCF	_mclock_state, 1, B
003f66   0100     movlb	0                  	BANKSEL	_mclock_tick_ctr
                                           ;	.line	110; mclock.c	mclock_tick_ctr = 0; // prevent that any requested 0xf8 will be sent
003f68   6bd6     clrf	0xd6, 0x1           	CLRF	_mclock_tick_ctr, B
003f6a   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	113; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
003f6c   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
                                           _00119_DS_:
003f6e   0100     movlb	0                  	BANKSEL	_mclock_tick_ctr
                                           ;	.line	117; mclock.c	while( mclock_tick_ctr ) {
003f70   51d6     movf	0xd6, 0, 0x1        	MOVF	_mclock_tick_ctr, W, B
003f72   e01c     bz	0x3fac                	BZ	_00122_DS_
                                           ;	.line	118; mclock.c	MIOS_MIDI_TxBufferPut(0xf8);
003f74   0ef8     movlw	0xf8               	MOVLW	0xf8
003f76   ec24     call	0x2c48, 0           	CALL	_MIOS_MIDI_TxBufferPut
003f78   f016
                                           ;	.line	125; mclock.c	INTCONbits.GIE = 0; // disable interrupts
003f7a   9ef2     bcf	0xf2, 0x7, 0         	BCF	_INTCONbits, 7
003f7c   0100     movlb	0                  	BANKSEL	_mclock_tick_ctr
                                           ;	.line	126; mclock.c	--mclock_tick_ctr;
003f7e   07d6     decf	0xd6, 0x1, 0x1      	DECF	_mclock_tick_ctr, F, B
                                           ;	.line	127; mclock.c	INTCONbits.GIE = 1; // enable interrupts
003f80   8ef2     bsf	0xf2, 0x7, 0         	BSF	_INTCONbits, 7
                                           ;	.line	130; mclock.c	PUSH();
003f82   ecc3     call	0x3b86, 0           	CALL	_PUSH
003f84   f01d
003f86   0100     movlb	0                  	BANKSEL	_mclock_ctr_24
                                           ;	.line	131; mclock.c	if( ++mclock_ctr_24 == 24 ) {
003f88   2bd9     incf	0xd9, 0x1, 0x1      	INCF	_mclock_ctr_24, F, B
003f8a   51d9     movf	0xd9, 0, 0x1        	MOVF	_mclock_ctr_24, W, B
003f8c   0a18     xorlw	0x18               	XORLW	0x18
003f8e   e10b     bnz	0x3fa6               	BNZ	_00118_DS_
                                           _00132_DS_:
003f90   0100     movlb	0                  	BANKSEL	_mclock_ctr_24
                                           ;	.line	132; mclock.c	mclock_ctr_24 = 0;
003f92   6bd9     clrf	0xd9, 0x1           	CLRF	_mclock_ctr_24, B
003f94   0100     movlb	0                  	BANKSEL	_mclock_ctr_beats
                                           ;	.line	133; mclock.c	if( ++mclock_ctr_beats == 4 ) {
003f96   2bda     incf	0xda, 0x1, 0x1      	INCF	_mclock_ctr_beats, F, B
003f98   51da     movf	0xda, 0, 0x1        	MOVF	_mclock_ctr_beats, W, B
003f9a   0a04     xorlw	0x4                	XORLW	0x04
003f9c   e104     bnz	0x3fa6               	BNZ	_00118_DS_
                                           _00134_DS_:
003f9e   0100     movlb	0                  	BANKSEL	_mclock_ctr_beats
                                           ;	.line	134; mclock.c	mclock_ctr_beats = 0;
003fa0   6bda     clrf	0xda, 0x1           	CLRF	_mclock_ctr_beats, B
003fa2   0100     movlb	0                  	BANKSEL	_mclock_ctr_measures
                                           ;	.line	135; mclock.c	++mclock_ctr_measures;
003fa4   2bdb     incf	0xdb, 0x1, 0x1      	INCF	_mclock_ctr_measures, F, B
                                           _00118_DS_:
003fa6   0100     movlb	0                  	BANKSEL	_app_flags
                                           ;	.line	140; mclock.c	app_flags.DISPLAY_UPDATE_REQ = 1;
003fa8   81cc     bsf	0xcc, 0, 0x1         	BSF	_app_flags, 0, B
003faa   d7e1     bra	0x3f6e               	BRA	_00119_DS_
                                           _00122_DS_:
003fac   0012     return	0                 	RETURN	
                                           
                                           ; ; Starting pCode block
                                           S_mclock__MCLOCK_Init	code
                                           _MCLOCK_Init:
                                           ;	.line	64; mclock.c	mclock_state.ALL = 0;
004276   0e00     movlw	0                  	MOVLW	0x00
004278   0100     movlb	0                  	BANKSEL	_mclock_state
00427a   6fd7     movwf	0xd7, 0x1          	MOVWF	_mclock_state, B
                                           ;	.line	65; mclock.c	mclock_pin_state.ALL = 0;
00427c   0e00     movlw	0                  	MOVLW	0x00
00427e   0100     movlb	0                  	BANKSEL	_mclock_pin_state
004280   6fd8     movwf	0xd8, 0x1          	MOVWF	_mclock_pin_state, B
004282   0100     movlb	0                  	BANKSEL	_mclock_tick_ctr
                                           ;	.line	66; mclock.c	mclock_tick_ctr = 0;
004284   6bd6     clrf	0xd6, 0x1           	CLRF	_mclock_tick_ctr, B
                                           ;	.line	68; mclock.c	MCLOCK_ResetMeter();
004286   ec1d     call	0x443a, 0           	CALL	_MCLOCK_ResetMeter
004288   f022
00428a   0012     return	0                 	RETURN	
                                           
                                           
                                           
                                           ; Statistics:
                                           ; code size:	  736 (0x02e0) bytes (0.56%)
                                           ;           	  368 (0x0170) words
                                           ; udata size:	   15 (0x000f) bytes (1.17%)
                                           ; access size:	    6 (0x0006) bytes
                                           
                                           
                                           	end
                                           ;
                                           ; This is the MIOS wrapper for SDCC
                                           ;
                                           ; the upper boundary of the stacks are defined here 
                                           ; customize the values for your needs
                                           #ifndef STACK_HEAD
                                           #define STACK_HEAD 0x37f
                                           #endif
                                           
                                           #ifndef STACK_IRQ_HEAD
                                           #define STACK_IRQ_HEAD 0x33f
                                           #endif
                                           ;
                                           ; ==========================================================================
                                           ;
                                           ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
                                           ;  Licensed for personal non-commercial use only.
                                           ;  All other rights reserved.
                                           ; 
                                           ; ==========================================================================
                                           
                                           ;; ---[ MIOS header file ]---
                                           #include "mios.h"
                                           ;
                                           ; MIOS Definitions file
                                           ;
                                           ; ==========================================================================
                                           ;
                                           ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
                                           ;  Licensed for personal non-commercial use only.
                                           ;  All other rights reserved.
                                           ; 
                                           ; ==========================================================================
                                           
                                            
                                           ;; ==========================================================================
                                           ;;  Select the device here
                                           ;;     0: PIC18F452   (writable range: 0x0400-0x7fff)
                                           ;;     1: PIC18F4620  (writable range: 0x0400-0xffff)
                                           ;;     2: PIC18F4520  (writable range: 0x0400-0x7fff)
                                           ;; ==========================================================================
                                           
                                           #define PIC_DERIVATIVE_TYPE	0
                                           
                                           ;; ==========================================================================
                                           ;;  Assembler directives & device specific include file
                                           ;; ==========================================================================
                                           
                                           #if PIC_DERIVATIVE_TYPE == 0
                                           	LIST P=PIC18F452, R=DEC
                                           #include <p18f452.inc>
                                                   LIST
                                           ; P18F452.INC  Standard Header File, Version 1.4   Microchip Technology, Inc.
                                                   NOLIST
                                           #endif
                                           
                                           #if PIC_DERIVATIVE_TYPE == 1
                                           	LIST P=PIC18F4620, R=DEC
                                           #include <p18f4620.inc>
                                           #endif
                                           	
                                           #if PIC_DERIVATIVE_TYPE == 2
                                           	LIST P=PIC18F4520, R=DEC
                                           #include <p18f4520.inc>
                                           #endif
                                           
                                           ;; ==========================================================================
                                           ;;  General constants
                                           ;; ==========================================================================
                                           
                                           ;; used by MIOS_MIDI_Interface*
                                           MIOS_MIDI_INTERFACE_COMMON	EQU	0x00
                                           MIOS_MIDI_INTERFACE_TO_HOST	EQU	0x01
                                           
                                           ;; used by MIOS_MIDI_Merger*
                                           MIOS_MIDI_MERGER_DISABLED	EQU	0x00
                                           MIOS_MIDI_MERGER_ENABLED	EQU	0x01
                                           MIOS_MIDI_MERGER_MBLINK_EP	EQU	0x02
                                           MIOS_MIDI_MERGER_MBLINK_FP	EQU	0x03
                                           
                                           ;; used by MIOS_ENC_PIN_TABLE
                                           MIOS_ENC_MODE_NON_DETENTED	EQU	0x00
                                           MIOS_ENC_MODE_DETENTED		EQU	0x80
                                           MIOS_ENC_MODE_DETENTED2		EQU	0x81
                                           
                                           ;; used by MIOS_ENC_Speed*
                                           MIOS_ENC_SPEED_SLOW		EQU	0
                                           MIOS_ENC_SPEED_NORMAL		EQU	1
                                           MIOS_ENC_SPEED_FAST		EQU	2
                                           
                                           ;; used by MIOS_LCD_Type*
                                           MIOS_LCD_TYPE_CLCD		EQU	0x00
                                           MIOS_LCD_TYPE_GLCD0		EQU	0x01
                                           MIOS_LCD_TYPE_GLCD1		EQU	0x02
                                           MIOS_LCD_TYPE_GLCD2		EQU	0x03
                                           MIOS_LCD_TYPE_GLCD3		EQU	0x04
                                           MIOS_LCD_TYPE_GLCD4		EQU	0x05
                                           MIOS_LCD_TYPE_MLCD		EQU	0x06
                                           MIOS_LCD_TYPE_GLCD_CUSTOM	EQU	0x07
                                           
                                           ;; location of default 5x8 font for graphical displays
                                           MIOS_GLCD_FONT			EQU	0x7cfc
                                           
                                           ;; general config flags (never overwrite this flags directly!!!)
                                           MIOS_BOX_CFG0_LCD_TYPE0		EQU 0	; selects LCD type, bit 0
                                           MIOS_BOX_CFG0_LCD_TYPE1		EQU 1	; selects LCD type, bit 1
                                           MIOS_BOX_CFG0_LCD_TYPE2		EQU 2	; selects LCD type, bit 2
                                           MIOS_BOX_CFG0_USE_GLCD		EQU 3	; if 1, graphical LCD is connected
                                           MIOS_BOX_CFG0_MERGER		EQU 4	; if 1, MIDI merger is enabled
                                           MIOS_BOX_CFG0_MBLINK		EQU 5	; if 1, MIDIbox Link is enabled
                                           MIOS_BOX_CFG0_TO_HOST		EQU 6	; if 1, MIDI interface will run with 38400 baud instead of 31250
                                           MIOS_BOX_CFG0_20MHz		EQU 7	; if 1, it is assumed that box is running with 20 MHz, else with 40 MHz
                                           
                                           MIOS_BOX_CFG1_BS_A0		EQU 0	; A0 of BankStick (never change the bit position)
                                           MIOS_BOX_CFG1_BS_A1		EQU 1	; A1 of BankStick (never change the bit position)
                                           MIOS_BOX_CFG1_BS_A2		EQU 2	; A2 of BankStick (never change the bit position)
                                           MIOS_BOX_CFG1_BS_DIS_VERIFY	EQU 3	; if 1, writes to the BankStick will not be verified
                                           MIOS_BOX_CFG1_IIC_STRETCH_CLK	EQU 4	; if 1, IIC clock stretching enabled
                                           
                                           ;; general status flags (never overwrite this flags directly!!!)
                                           MIOS_BOX_STAT_BS_AVAILABLE	EQU 0	; if 1, BankStick is available
                                           MIOS_BOX_STAT_MBLINK_TUNNEL_PASS EQU 1  ; if 1, a MBLinked event will be tunnled
                                           MIOS_BOX_STAT_SUSPEND_ALL       EQU 2   ; if 1, all system and user tasks are suspended
                                           MIOS_BOX_STAT_SUSPEND_USER      EQU 3   ; if 1, all user tasks are suspended
                                           MIOS_BOX_STAT_AUTOREPEAT	EQU 4	; if 1, start the auto-repeat handler
                                           MIOS_BOX_STAT_MLCD_TRANSFER	EQU 5	; if 1, a transfer to the MLCD has been started
                                           MIOS_BOX_STAT_FERR		EQU 6	; if 1, a frame error happened during MIDI receive
                                           
                                           ;; ==========================================================================
                                           ;;  MIOS Special Function Registers
                                           ;; ==========================================================================
                                           
                                           MIOS_BOX_CFG0	EQU	0x000
                                           MIOS_BOX_CFG1	EQU	0x001
                                           MIOS_BOX_STAT	EQU	0x002
                                           MIOS_PARAMETER1	EQU	0x003
                                           MIOS_PARAMETER2	EQU	0x004
                                           MIOS_PARAMETER3	EQU	0x005
                                           
                                           ;; ==========================================================================
                                           ;;  temporary registers for main programs
                                           ;; ==========================================================================
                                           TMP1		EQU	0x006
                                           TMP2		EQU	0x007
                                           TMP3		EQU	0x008
                                           TMP4		EQU	0x009
                                           TMP5		EQU	0x00a
                                           
                                           ;; ==========================================================================
                                           ;;  temporary registers for IRQs
                                           ;; ==========================================================================
                                           IRQ_TMP1	EQU	0x00b
                                           IRQ_TMP2	EQU	0x00c
                                           IRQ_TMP3	EQU	0x00d
                                           IRQ_TMP4	EQU	0x00e
                                           IRQ_TMP5	EQU	0x00f
                                           
                                           ;; ==========================================================================
                                           ;;  free memory space for user application:
                                           ;; ==========================================================================
                                           	;; 0x010-0x37f
                                           
                                           ;; ==========================================================================
                                           ;;  MIOS System Registers -- not defined here -- 
                                           ;;  never use these memory locations!
                                           ;; ==========================================================================
                                           	;; 0x380-0x6ff
                                           
                                           ;; ==========================================================================
                                           ;;  MIOS System Registers for custom LCD driver
                                           ;; ==========================================================================
                                           MIOS_GLCD_BUFFER	EQU	0x570	; note: the buffer must be located at ...0-...7
                                           MIOS_LCD_OPTION1	EQU	0x578	; contains the first LCD option given by MIOS_LCD_TypeSet
                                           MIOS_LCD_OPTION2	EQU	0x579	; contains the second LCD option given by MIOS_LCD_TypeSet
                                           MIOS_LCD_CURSOR_POS	EQU	0x57a	; the current cursor pos of characters (GLCD: multiplied by width)
                                           MIOS_GLCD_GCURSOR_X	EQU	0x57b	; for GLCDs: the current X position of graphical cursor
                                           MIOS_GLCD_GCURSOR_Y	EQU	0x57c	; for GLCDs: the current Y position of graphical cursor
                                           MIOS_GLCD_FONT_WIDTH	EQU	0x57d	; for GLCDs: the fontwidth given by MIOS_GLCD_FontInit
                                           MIOS_GLCD_FONT_HEIGHT	EQU	0x57e	; for GLCDs: the fontheight given by MIOS_GLCD_FontInit
                                           MIOS_GLCD_FONT_X0	EQU	0x57f	; for GLCDs: the first byte within a char entry
                                           MIOS_GLCD_FONT_OFFSET	EQU	0x580	; for GLCDs: the byte offset between the characters
                                           MIOS_GLCD_FONT_PTRL	EQU	0x581	; for GLCDs: pointer to the character table, low-byte
                                           MIOS_GLCD_FONT_PTRH	EQU	0x582	; for GLCDs: pointer to the character table, high-byte
                                           MIOS_LCD_TIMEOUT0	EQU	0x583   ; can be used for timeout loops
                                           MIOS_LCD_TIMEOUT1	EQU	0x584   ; can be used for timeout loops
                                           MIOS_GLCD_TMP1		EQU	0x585   ; can be used as temporary buffer
                                           MIOS_GLCD_TMP2		EQU	0x586   ; can be used as temporary buffer
                                           MIOS_GLCD_TMP3		EQU	0x587   ; can be used as temporary buffer
                                           MIOS_GLCD_TMP4		EQU	0x588   ; can be used as temporary buffer
                                           MIOS_LCD_Y0_OFFSET	EQU	0x589   ; Y0 offset of LCD
                                           MIOS_LCD_Y1_OFFSET	EQU	0x58a   ; Y1 offset of LCD
                                           MIOS_LCD_Y2_OFFSET	EQU	0x58b   ; Y2 offset of LCD
                                           MIOS_LCD_Y3_OFFSET	EQU	0x58c   ; Y3 offset of LCD
                                           MIOS_LCD_CURSOR_POS_REAL EQU	0x58d	; unmapped cursor position which has been set with MIOS_LCD_CursorSet
                                           
                                           ;; ---[ vectors to MIOS functions (never change!) ]---
                                           #include "mios_vectors.inc"
                                           MIOS_MIDI_BeginStream                   EQU	0x2c00
                                           MIOS_MIDI_DeviceIDAutoSet               EQU	0x2c04
                                           MIOS_MIDI_DeviceIDGet                   EQU	0x2c08
                                           MIOS_MIDI_DeviceIDSet                   EQU	0x2c0c
                                           MIOS_MIDI_EndStream                     EQU	0x2c10
                                           MIOS_MIDI_Init                          EQU	0x2c14
                                           MIOS_MIDI_InterfaceAutoSet              EQU	0x2c18
                                           MIOS_MIDI_InterfaceGet                  EQU	0x2c1c
                                           MIOS_MIDI_InterfaceSet                  EQU	0x2c20
                                           MIOS_MIDI_MergerGet                     EQU	0x2c24
                                           MIOS_MIDI_MergerSet                     EQU	0x2c28
                                           MIOS_MIDI_RxBufferFree                  EQU	0x2c2c
                                           MIOS_MIDI_RxBufferGet                   EQU	0x2c30
                                           MIOS_MIDI_RxBufferPut                   EQU	0x2c34
                                           MIOS_MIDI_RxBufferUsed                  EQU	0x2c38
                                           MIOS_MIDI_TxBufferFlush                 EQU	0x2c3c
                                           MIOS_MIDI_TxBufferFree                  EQU	0x2c40
                                           MIOS_MIDI_TxBufferGet                   EQU	0x2c44
                                           MIOS_MIDI_TxBufferPut                   EQU	0x2c48
                                           MIOS_MIDI_TxBufferUsed                  EQU	0x2c4c
                                           MIOS_MPROC_MergerDisable                EQU	0x2c50
                                           MIOS_MPROC_MergerEnable                 EQU	0x2c54
                                           MIOS_MPROC_MergerGet                    EQU	0x2c58
                                           MIOS_AIN_DeadbandGet                    EQU	0x2c5c
                                           MIOS_AIN_DeadbandSet                    EQU	0x2c60
                                           MIOS_AIN_Muxed                          EQU	0x2c64
                                           MIOS_AIN_NumberGet                      EQU	0x2c68
                                           MIOS_AIN_NumberSet                      EQU	0x2c6c
                                           MIOS_AIN_Pin7bitGet                     EQU	0x2c70
                                           MIOS_AIN_PinGet                         EQU	0x2c74
                                           MIOS_AIN_PinLSBGet                      EQU	0x2c78
                                           MIOS_AIN_PinMSBGet                      EQU	0x2c7c
                                           MIOS_AIN_UnMuxed                        EQU	0x2c80
                                           MIOS_MF_PWM_DutyCycleDownGet            EQU	0x2c84
                                           MIOS_MF_PWM_DutyCycleDownSet            EQU	0x2c88
                                           MIOS_MF_PWM_DutyCycleUpGet              EQU	0x2c8c
                                           MIOS_MF_PWM_DutyCycleUpSet              EQU	0x2c90
                                           MIOS_MF_DeadbandGet                     EQU	0x2c94
                                           MIOS_MF_DeadbandSet                     EQU	0x2c98
                                           MIOS_MF_Disable                         EQU	0x2c9c
                                           MIOS_MF_Enable                          EQU	0x2ca0
                                           MIOS_MF_FaderMove                       EQU	0x2ca4
                                           MIOS_MF_SuspendDisable                  EQU	0x2ca8
                                           MIOS_MF_SuspendEnable                   EQU	0x2cac
                                           MIOS_MF_SuspendGet                      EQU	0x2cb0
                                           MIOS_DIN_PinGet                         EQU	0x2cb4
                                           MIOS_DIN_SRGet                          EQU	0x2cb8
                                           MIOS_DOUT_PinGet                        EQU	0x2cbc
                                           MIOS_DOUT_PinSet                        EQU	0x2cc0
                                           MIOS_DOUT_PinSet0                       EQU	0x2cc4
                                           MIOS_DOUT_PinSet1                       EQU	0x2cc8
                                           MIOS_DOUT_SRGet                         EQU	0x2ccc
                                           MIOS_DOUT_SRSet                         EQU	0x2cd0
                                           MIOS_ENC_Abs7bitAdd                     EQU	0x2cd4
                                           MIOS_ENC_Abs7bitGet                     EQU	0x2cd8
                                           MIOS_ENC_Abs7bitSet                     EQU	0x2cdc
                                           MIOS_ENC_NumberGet                      EQU	0x2ce0
                                           MIOS_ENC_SpeedGet                       EQU	0x2ce4
                                           MIOS_ENC_SpeedSet                       EQU	0x2ce8
                                           MIOS_SRIO_NumberGet                     EQU	0x2cec
                                           MIOS_SRIO_NumberSet                     EQU	0x2cf0
                                           MIOS_SRIO_TS_SensitivityGet             EQU	0x2cf4
                                           MIOS_SRIO_TS_SensitivitySet             EQU	0x2cf8
                                           MIOS_SRIO_UpdateFrqGet                  EQU	0x2cfc
                                           MIOS_SRIO_UpdateFrqSet                  EQU	0x2d00
                                           MIOS_LCD_Clear                          EQU	0x2d04
                                           MIOS_LCD_Cmd                            EQU	0x2d08
                                           MIOS_LCD_CursorGet                      EQU	0x2d0c
                                           MIOS_LCD_CursorSet                      EQU	0x2d10
                                           MIOS_LCD_Data                           EQU	0x2d14
                                           MIOS_LCD_Init                           EQU	0x2d18
                                           MIOS_LCD_PrintBCD1	                EQU	0x2d1c
                                           MIOS_LCD_PrintBCD2                      EQU	0x2d20
                                           MIOS_LCD_PrintBCD3                      EQU	0x2d24
                                           MIOS_LCD_PrintChar	                EQU	0x2d28
                                           MIOS_LCD_PrintHex1	                EQU	0x2d2c
                                           MIOS_LCD_PrintHex2                      EQU	0x2d30
                                           MIOS_LCD_PrintMessage                   EQU	0x2d34
                                           MIOS_LCD_PrintPreconfString             EQU	0x2d38
                                           MIOS_LCD_PrintString                    EQU	0x2d3c
                                           MIOS_LCD_TypeAutoSet                    EQU	0x2d40
                                           MIOS_LCD_TypeGet                        EQU	0x2d44
                                           MIOS_LCD_TypeSet                        EQU	0x2d48
                                           MIOS_LCD_YAddressGet                    EQU	0x2d4c
                                           MIOS_LCD_YAddressSet                    EQU	0x2d50
                                           MIOS_GLCD_FontInit                      EQU	0x2d54
                                           MIOS_GLCD_GCursorGet                    EQU	0x2d58
                                           MIOS_GLCD_GCursorSet                    EQU	0x2d5c
                                           MIOS_EEPROM_Read                        EQU	0x2d60
                                           MIOS_EEPROM_Write                       EQU	0x2d64
                                           MIOS_FLASH_Read                         EQU	0x2d68
                                           MIOS_FLASH_Write                        EQU	0x2d6c
                                           MIOS_BANKSTICK_Read                     EQU	0x2d70
                                           MIOS_BANKSTICK_Write                    EQU	0x2d74
                                           MIOS_TIMER_Init                         EQU	0x2d78
                                           MIOS_TIMER_Start                        EQU	0x2d7c
                                           MIOS_TIMER_Stop                         EQU	0x2d80
                                           MIOS_HLP_AddressFromTable               EQU	0x2d84
                                           MIOS_HLP_GetBitANDMask                  EQU	0x2d88
                                           MIOS_HLP_GetBitORMask                   EQU	0x2d8c
                                           MIOS_HLP_GetIndex_2bytes                EQU	0x2d90
                                           MIOS_HLP_GetIndex_4bytes                EQU	0x2d94
                                           MIOS_HLP_IndirectJump                   EQU	0x2d98
                                           MIOS_Delay                              EQU	0x2d9c
                                           MIOS_GPCounterGet                       EQU	0x2da0
                                           MIOS_Reset                              EQU	0x2da4
                                           MIOS_SystemResume                       EQU	0x2da8
                                           MIOS_SystemSuspend                      EQU	0x2dac
                                           MIOS_UserResume                         EQU	0x2db0
                                           MIOS_UserSuspend                        EQU	0x2db4
                                           MIOS_HLP_16bitAddSaturate		EQU	0x2db8
                                           MIOS_DIN_PinAutoRepeatEnable		EQU	0x2dbc
                                           MIOS_DIN_PinAutoRepeatDisable		EQU	0x2dc0
                                           MIOS_DIN_PinAutoRepeatGet		EQU	0x2dc4
                                           MIOS_CLCD_SpecialCharInit		EQU	0x2dc8
                                           MIOS_CLCD_SpecialCharsInit		EQU	0x2dcc
                                           MIOS_AIN_DynamicPrioSet			EQU	0x2dd0
                                           MIOS_AIN_DynamicPrioGet			EQU	0x2dd4
                                           MIOS_AIN_LastPinsGet			EQU	0x2dd8
                                           MIOS_BANKSTICK_CtrlSet			EQU	0x2ddc
                                           MIOS_BANKSTICK_CtrlGet			EQU	0x2de0
                                           MIOS_BANKSTICK_WritePage		EQU	0x2de4
                                           MIOS_HLP_Dec2BCD			EQU	0x2de8
                                           MIOS_LCD_PrintBCD4			EQU	0x2dec
                                           MIOS_LCD_PrintBCD5                      EQU	0x2df0
                                           MIOS_LCD_MessageStart			EQU	0x2df4
                                           MIOS_LCD_MessageStop			EQU	0x2df8
                                           MIOS_MF_PWM_PeriodGet                   EQU	0x2dfc
                                           MIOS_MF_PWM_PeriodSet                   EQU	0x2e00
                                           MIOS_IIC_Start				EQU	0x2e04
                                           MIOS_IIC_Stop				EQU	0x2e08
                                           MIOS_IIC_ByteSend			EQU	0x2e0c
                                           MIOS_IIC_ByteReceive			EQU	0x2e10
                                           MIOS_IIC_AckSend			EQU	0x2e14
                                           MIOS_IIC_NakSend			EQU	0x2e18
                                           MIOS_IIC_CtrlSet			EQU	0x2e1c
                                           MIOS_IIC_CtrlGet			EQU	0x2e20
                                           MIOS_SRIO_DebounceSet			EQU	0x2e24
                                           MIOS_SRIO_DebounceGet			EQU	0x2e28
                                           MIOS_MF_TouchDetectionReset		EQU	0x2e2c
                                           MIOS_BANKSTICK_ReadPage			EQU	0x2e30
                                           MIOS_EEPROM_ReadPage			EQU	0x2e34
                                           MIOS_EEPROM_WritePage			EQU	0x2e38
                                           MIOS_TIMER_ReInit			EQU	0x2e3c
                                           MIOS_RESERVED_144                       EQU	0x2e40
                                           MIOS_RESERVED_145                       EQU	0x2e44
                                           MIOS_RESERVED_146                       EQU	0x2e48
                                           MIOS_RESERVED_147                       EQU	0x2e4c
                                           MIOS_RESERVED_148                       EQU	0x2e50
                                           MIOS_RESERVED_149                       EQU	0x2e54
                                           MIOS_RESERVED_150                       EQU	0x2e58
                                           MIOS_RESERVED_151                       EQU	0x2e5c
                                           MIOS_RESERVED_152                       EQU	0x2e60
                                           MIOS_RESERVED_153                       EQU	0x2e64
                                           MIOS_RESERVED_154                       EQU	0x2e68
                                           MIOS_RESERVED_155                       EQU	0x2e6c
                                           MIOS_RESERVED_156                       EQU	0x2e70
                                           MIOS_RESERVED_157                       EQU	0x2e74
                                           MIOS_RESERVED_158                       EQU	0x2e78
                                           MIOS_RESERVED_159                       EQU	0x2e7c
                                           MIOS_RESERVED_160                       EQU	0x2e80
                                           MIOS_RESERVED_161                       EQU	0x2e84
                                           MIOS_RESERVED_162                       EQU	0x2e88
                                           MIOS_RESERVED_163                       EQU	0x2e8c
                                           MIOS_RESERVED_164                       EQU	0x2e90
                                           MIOS_RESERVED_165                       EQU	0x2e94
                                           MIOS_RESERVED_166                       EQU	0x2e98
                                           MIOS_RESERVED_167                       EQU	0x2e9c
                                           MIOS_RESERVED_168                       EQU	0x2ea0
                                           MIOS_RESERVED_169                       EQU	0x2ea4
                                           MIOS_RESERVED_170                       EQU	0x2ea8
                                           MIOS_RESERVED_171                       EQU	0x2eac
                                           MIOS_RESERVED_172                       EQU	0x2eb0
                                           MIOS_RESERVED_173                       EQU	0x2eb4
                                           MIOS_RESERVED_174                       EQU	0x2eb8
                                           MIOS_RESERVED_175                       EQU	0x2ebc
                                           MIOS_RESERVED_176                       EQU	0x2ec0
                                           MIOS_RESERVED_177                       EQU	0x2ec4
                                           MIOS_RESERVED_178                       EQU	0x2ec8
                                           MIOS_RESERVED_179                       EQU	0x2ecc
                                           MIOS_RESERVED_180                       EQU	0x2ed0
                                           MIOS_RESERVED_181                       EQU	0x2ed4
                                           MIOS_RESERVED_182                       EQU	0x2ed8
                                           MIOS_RESERVED_183                       EQU	0x2edc
                                           MIOS_RESERVED_184                       EQU	0x2ee0
                                           MIOS_RESERVED_185                       EQU	0x2ee4
                                           MIOS_RESERVED_186                       EQU	0x2ee8
                                           MIOS_RESERVED_187                       EQU	0x2eec
                                           MIOS_RESERVED_188                       EQU	0x2ef0
                                           MIOS_RESERVED_189                       EQU	0x2ef4
                                           MIOS_RESERVED_190                       EQU	0x2ef8
                                           MIOS_RESERVED_191                       EQU	0x2efc
                                           MIOS_RESERVED_192                       EQU	0x2f00
                                           MIOS_RESERVED_193                       EQU	0x2f04
                                           MIOS_RESERVED_194                       EQU	0x2f08
                                           MIOS_RESERVED_195                       EQU	0x2f0c
                                           MIOS_RESERVED_196                       EQU	0x2f10
                                           MIOS_RESERVED_197                       EQU	0x2f14
                                           MIOS_RESERVED_198                       EQU	0x2f18
                                           MIOS_RESERVED_199                       EQU	0x2f1c
                                           MIOS_RESERVED_200                       EQU	0x2f20
                                           MIOS_RESERVED_201                       EQU	0x2f24
                                           MIOS_RESERVED_202                       EQU	0x2f28
                                           MIOS_RESERVED_203                       EQU	0x2f2c
                                           MIOS_RESERVED_204                       EQU	0x2f30
                                           MIOS_RESERVED_205                       EQU	0x2f34
                                           MIOS_RESERVED_206                       EQU	0x2f38
                                           MIOS_RESERVED_207                       EQU	0x2f3c
                                           MIOS_RESERVED_208                       EQU	0x2f40
                                           MIOS_RESERVED_209                       EQU	0x2f44
                                           MIOS_RESERVED_210                       EQU	0x2f48
                                           MIOS_RESERVED_211                       EQU	0x2f4c
                                           MIOS_RESERVED_212                       EQU	0x2f50
                                           MIOS_RESERVED_213                       EQU	0x2f54
                                           MIOS_RESERVED_214                       EQU	0x2f58
                                           MIOS_RESERVED_215                       EQU	0x2f5c
                                           MIOS_RESERVED_216                       EQU	0x2f60
                                           MIOS_RESERVED_217                       EQU	0x2f64
                                           MIOS_RESERVED_218                       EQU	0x2f68
                                           MIOS_RESERVED_219                       EQU	0x2f6c
                                           MIOS_RESERVED_220                       EQU	0x2f70
                                           MIOS_RESERVED_221                       EQU	0x2f74
                                           MIOS_RESERVED_222                       EQU	0x2f78
                                           MIOS_RESERVED_223                       EQU	0x2f7c
                                           MIOS_RESERVED_224                       EQU	0x2f80
                                           MIOS_RESERVED_225                       EQU	0x2f84
                                           MIOS_RESERVED_226                       EQU	0x2f88
                                           MIOS_RESERVED_227                       EQU	0x2f8c
                                           MIOS_RESERVED_228                       EQU	0x2f90
                                           MIOS_RESERVED_229                       EQU	0x2f94
                                           MIOS_RESERVED_230                       EQU	0x2f98
                                           MIOS_RESERVED_231                       EQU	0x2f9c
                                           MIOS_RESERVED_232                       EQU	0x2fa0
                                           MIOS_RESERVED_233                       EQU	0x2fa4
                                           MIOS_RESERVED_234                       EQU	0x2fa8
                                           MIOS_RESERVED_235                       EQU	0x2fac
                                           MIOS_RESERVED_236                       EQU	0x2fb0
                                           MIOS_RESERVED_237                       EQU	0x2fb4
                                           MIOS_RESERVED_238                       EQU	0x2fb8
                                           MIOS_RESERVED_239                       EQU	0x2fbc
                                           MIOS_RESERVED_240                       EQU	0x2fc0
                                           MIOS_RESERVED_241                       EQU	0x2fc4
                                           MIOS_RESERVED_242                       EQU	0x2fc8
                                           MIOS_RESERVED_243                       EQU	0x2fcc
                                           MIOS_RESERVED_244                       EQU	0x2fd0
                                           MIOS_RESERVED_245                       EQU	0x2fd4
                                           MIOS_RESERVED_246                       EQU	0x2fd8
                                           MIOS_RESERVED_247                       EQU	0x2fdc
                                           MIOS_RESERVED_248                       EQU	0x2fe0
                                           MIOS_RESERVED_249                       EQU	0x2fe4
                                           MIOS_RESERVED_250                       EQU	0x2fe8
                                           MIOS_RESERVED_251                       EQU	0x2fec
                                           MIOS_RESERVED_252                       EQU	0x2ff0
                                           MIOS_RESERVED_253                       EQU	0x2ff4
                                           MIOS_RESERVED_254                       EQU	0x2ff8
                                           MIOS_RESERVED_255                       EQU	0x2ffc
                                           
                                           ;; ---[ user hooks (never change!) ]---
                                           #include "user_vectors.inc"
                                           ;
                                           ; User vectortable - contains user hooks to MIOS
                                           ;
                                           ; ==========================================================================
                                           ;
                                           ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
                                           ;  Licensed for personal non-commercial use only.
                                           ;  All other rights reserved.
                                           ; 
                                           ; ==========================================================================
                                           
                                           	;; never change the origin or the order of entries!
                                           	org	0x3000
                                           _User_Init
003000   efbf     goto	0x397e              	goto	USER_Init
003002   f01c
                                           _USER_Tick
003004   efc5     goto	0x398a              	goto	USER_Tick
003006   f01c
                                           _USER_Timer
003008   efcb     goto	0x3996              	goto	USER_Timer
00300a   f01c
                                           _USER_MPROC_DebugTrigger
00300c   efda     goto	0x39b4              	goto	USER_MPROC_DebugTrigger
00300e   f01c
                                           _USER_DISPLAY_Init
003010   efdb     goto	0x39b6              	goto	USER_DISPLAY_Init
003012   f01c
                                           _USER_DISPLAY_Tick
003014   efe1     goto	0x39c2              	goto	USER_DISPLAY_Tick
003016   f01c
                                           _USER_SR_Service_Prepare
003018   ef1d     goto	0x3a3a              	goto	USER_SR_Service_Prepare
00301a   f01d
                                           _USER_SR_Service_Finish
00301c   ef2c     goto	0x3a58              	goto	USER_SR_Service_Finish
00301e   f01d
                                           _USER_DIN_NotifyToggle
003020   ef0d     goto	0x3a1a              	goto	USER_DIN_NotifyToggle
003022   f01d
                                           _USER_ENC_NotifyChange
003024   ef15     goto	0x3a2a              	goto	USER_ENC_NotifyChange
003026   f01d
                                           _USER_AIN_NotifyChange
003028   ef3b     goto	0x3a76              	goto	USER_AIN_NotifyChange
00302a   f01d
                                           _USER_MPROC_NotifyReceivedByte
00302c   ef05     goto	0x3a0a              	goto	USER_MPROC_NotifyReceivedByte
00302e   f01d
                                           _USER_MPROC_NotifyTimeout
003030   efff     goto	0x39fe              	goto	USER_MPROC_NotifyTimeout
003032   f01c
                                           _USER_MPROC_NotifyReceivedEvent
003034   efe7     goto	0x39ce              	goto	USER_MPROC_NotifyReceivedEvent
003036   f01c
                                           _USER_MPROC_NotifyFoundEvent
003038   eff2     goto	0x39e4              	goto	USER_MPROC_NotifyFoundEvent
00303a   f01c
                                           _USER_LCD_Init
00303c   ef80     goto	0x3300              	goto	USER_LCD_Init
00303e   f019
                                           _USER_LCD_Clear
003040   ef81     goto	0x3302              	goto	USER_LCD_Clear
003042   f019
                                           _USER_LCD_CursorSet
003044   ef82     goto	0x3304              	goto	USER_LCD_CursorSet
003046   f019
                                           _USER_LCD_PrintChar
003048   ef83     goto	0x3306              	goto	USER_LCD_PrintChar
00304a   f019
                                           _USER_MIDI_NotifyRx
00304c   ef0c     goto	0x3a18              	goto	USER_MIDI_NotifyRx
00304e   f01d
                                           _USER_MIDI_NotifyTx
003050   ef0b     goto	0x3a16              	goto	USER_MIDI_NotifyTx
003052   f01d
                                           _USER_LCD_Data
003054   ef84     goto	0x3308              	goto	USER_LCD_Data
003056   f019
                                           _USER_LCD_Cmd
003058   ef85     goto	0x330a              	goto	USER_LCD_Cmd
00305a   f019
                                           _USER_LCD_SpecialCharInit
00305c   ef86     goto	0x330c              	goto	USER_LCD_SpecialCharInit
00305e   f019
                                           USER_RESERVED_25
003060   0012     return	0                 	return
003062   0000     nop                      	nop
                                           USER_RESERVED_26
003064   0012     return	0                 	return
003066   0000     nop                      	nop
                                           USER_RESERVED_27
003068   0012     return	0                 	return
00306a   0000     nop                      	nop
                                           USER_RESERVED_28
00306c   0012     return	0                 	return
00306e   0000     nop                      	nop
                                           USER_RESERVED_29
003070   0012     return	0                 	return
003072   0000     nop                      	nop
                                           USER_RESERVED_30
003074   0012     return	0                 	return
003076   0000     nop                      	nop
                                           USER_RESERVED_31
003078   0012     return	0                 	return
00307a   0000     nop                      	nop
                                           USER_RESERVED_32
00307c   0012     return	0                 	return
00307e   0000     nop                      	nop
                                           
                                           ;; ==========================================================================
                                           ;;  General Application Settings
                                           ;; ==========================================================================
                                           
                                           ;; ---[ configuration table for MIDI processor and rotary encoders ]---
                                           #include "mios_tables.inc"
                                           ;
                                           ; Configuration Tables for MIOS Application
                                           ;
                                           ; ==========================================================================
                                           ;
                                           ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
                                           ;  Licensed for personal non-commercial use only.
                                           ;  All other rights reserved.
                                           ; 
                                           ; ==========================================================================
                                           
                                           	org	0x3080		; never change the origin!
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;; The MIDI Trigger table maps incoming MIDI events to control elements
                                           ;; (pots/faders, encoders, buttons, LEDs, ...)
                                           ;; 
                                           ;; After the MIOS MIDI processor (MPROC) has received a complete event, it
                                           ;; searches in this table for a matching entry and calls USER_MPROC_NotifyFoundEvent
                                           ;; with the table index in WREG and the MIDI event in MIOS_PARAMETER[123]
                                           ;; 
                                           ;; Note also that the MIDI processor stops scanning the table after
                                           ;; the first MT_EOT entry
                                           ;; 
                                           ;; Note2: never change the origin (memory location) of this table!
                                           ;; 
                                           ;; Optionally this table can also be used to define events, which should be
                                           ;; transmitted (Example: see example_ain64_din128_dout128), so that incoming
                                           ;; and outgoing events are located at one place
                                           ;; 
                                           ;; The table *must* contain 256 entries. Unused entries should be filled with
                                           ;; MT_EOT.
                                           ;; --------------------------------------------------------------------------
                                           
                                           	;; MIDI Trigger entry structure
                                           MT_ENTRY MACRO event_0, event_1
                                           	dw	(event_1 << 8) | event_0
                                           	ENDM
                                           
                                           MT_EOT	MACRO
003080   ffff     dw	0xffff  ;unknown opcode 	dw	0xffff
003082   ffff     dw	0xffff  ;unknown opcode 
003084   ffff     dw	0xffff  ;unknown opcode 
003086   ffff     dw	0xffff  ;unknown opcode 
003088   ffff     dw	0xffff  ;unknown opcode 
00308a   ffff     dw	0xffff  ;unknown opcode 
00308c   ffff     dw	0xffff  ;unknown opcode 
00308e   ffff     dw	0xffff  ;unknown opcode 
003090   ffff     dw	0xffff  ;unknown opcode 
003092   ffff     dw	0xffff  ;unknown opcode 
003094   ffff     dw	0xffff  ;unknown opcode 
003096   ffff     dw	0xffff  ;unknown opcode 
003098   ffff     dw	0xffff  ;unknown opcode 
00309a   ffff     dw	0xffff  ;unknown opcode 
00309c   ffff     dw	0xffff  ;unknown opcode 
00309e   ffff     dw	0xffff  ;unknown opcode 
0030a0   ffff     dw	0xffff  ;unknown opcode 
0030a2   ffff     dw	0xffff  ;unknown opcode 
0030a4   ffff     dw	0xffff  ;unknown opcode 
0030a6   ffff     dw	0xffff  ;unknown opcode 
0030a8   ffff     dw	0xffff  ;unknown opcode 
0030aa   ffff     dw	0xffff  ;unknown opcode 
0030ac   ffff     dw	0xffff  ;unknown opcode 
0030ae   ffff     dw	0xffff  ;unknown opcode 
0030b0   ffff     dw	0xffff  ;unknown opcode 
0030b2   ffff     dw	0xffff  ;unknown opcode 
0030b4   ffff     dw	0xffff  ;unknown opcode 
0030b6   ffff     dw	0xffff  ;unknown opcode 
0030b8   ffff     dw	0xffff  ;unknown opcode 
0030ba   ffff     dw	0xffff  ;unknown opcode 
0030bc   ffff     dw	0xffff  ;unknown opcode 
0030be   ffff     dw	0xffff  ;unknown opcode 
0030c0   ffff     dw	0xffff  ;unknown opcode 
0030c2   ffff     dw	0xffff  ;unknown opcode 
0030c4   ffff     dw	0xffff  ;unknown opcode 
0030c6   ffff     dw	0xffff  ;unknown opcode 
0030c8   ffff     dw	0xffff  ;unknown opcode 
0030ca   ffff     dw	0xffff  ;unknown opcode 
0030cc   ffff     dw	0xffff  ;unknown opcode 
0030ce   ffff     dw	0xffff  ;unknown opcode 
0030d0   ffff     dw	0xffff  ;unknown opcode 
0030d2   ffff     dw	0xffff  ;unknown opcode 
0030d4   ffff     dw	0xffff  ;unknown opcode 
0030d6   ffff     dw	0xffff  ;unknown opcode 
0030d8   ffff     dw	0xffff  ;unknown opcode 
0030da   ffff     dw	0xffff  ;unknown opcode 
0030dc   ffff     dw	0xffff  ;unknown opcode 
0030de   ffff     dw	0xffff  ;unknown opcode 
0030e0   ffff     dw	0xffff  ;unknown opcode 
0030e2   ffff     dw	0xffff  ;unknown opcode 
0030e4   ffff     dw	0xffff  ;unknown opcode 
0030e6   ffff     dw	0xffff  ;unknown opcode 
0030e8   ffff     dw	0xffff  ;unknown opcode 
0030ea   ffff     dw	0xffff  ;unknown opcode 
0030ec   ffff     dw	0xffff  ;unknown opcode 
0030ee   ffff     dw	0xffff  ;unknown opcode 
0030f0   ffff     dw	0xffff  ;unknown opcode 
0030f2   ffff     dw	0xffff  ;unknown opcode 
0030f4   ffff     dw	0xffff  ;unknown opcode 
0030f6   ffff     dw	0xffff  ;unknown opcode 
0030f8   ffff     dw	0xffff  ;unknown opcode 
0030fa   ffff     dw	0xffff  ;unknown opcode 
0030fc   ffff     dw	0xffff  ;unknown opcode 
0030fe   ffff     dw	0xffff  ;unknown opcode 
003100   ffff     dw	0xffff  ;unknown opcode 
003102   ffff     dw	0xffff  ;unknown opcode 
003104   ffff     dw	0xffff  ;unknown opcode 
003106   ffff     dw	0xffff  ;unknown opcode 
003108   ffff     dw	0xffff  ;unknown opcode 
00310a   ffff     dw	0xffff  ;unknown opcode 
00310c   ffff     dw	0xffff  ;unknown opcode 
00310e   ffff     dw	0xffff  ;unknown opcode 
003110   ffff     dw	0xffff  ;unknown opcode 
003112   ffff     dw	0xffff  ;unknown opcode 
003114   ffff     dw	0xffff  ;unknown opcode 
003116   ffff     dw	0xffff  ;unknown opcode 
003118   ffff     dw	0xffff  ;unknown opcode 
00311a   ffff     dw	0xffff  ;unknown opcode 
00311c   ffff     dw	0xffff  ;unknown opcode 
00311e   ffff     dw	0xffff  ;unknown opcode 
003120   ffff     dw	0xffff  ;unknown opcode 
003122   ffff     dw	0xffff  ;unknown opcode 
003124   ffff     dw	0xffff  ;unknown opcode 
003126   ffff     dw	0xffff  ;unknown opcode 
003128   ffff     dw	0xffff  ;unknown opcode 
00312a   ffff     dw	0xffff  ;unknown opcode 
00312c   ffff     dw	0xffff  ;unknown opcode 
00312e   ffff     dw	0xffff  ;unknown opcode 
003130   ffff     dw	0xffff  ;unknown opcode 
003132   ffff     dw	0xffff  ;unknown opcode 
003134   ffff     dw	0xffff  ;unknown opcode 
003136   ffff     dw	0xffff  ;unknown opcode 
003138   ffff     dw	0xffff  ;unknown opcode 
00313a   ffff     dw	0xffff  ;unknown opcode 
00313c   ffff     dw	0xffff  ;unknown opcode 
00313e   ffff     dw	0xffff  ;unknown opcode 
003140   ffff     dw	0xffff  ;unknown opcode 
003142   ffff     dw	0xffff  ;unknown opcode 
003144   ffff     dw	0xffff  ;unknown opcode 
003146   ffff     dw	0xffff  ;unknown opcode 
003148   ffff     dw	0xffff  ;unknown opcode 
00314a   ffff     dw	0xffff  ;unknown opcode 
00314c   ffff     dw	0xffff  ;unknown opcode 
00314e   ffff     dw	0xffff  ;unknown opcode 
003150   ffff     dw	0xffff  ;unknown opcode 
003152   ffff     dw	0xffff  ;unknown opcode 
003154   ffff     dw	0xffff  ;unknown opcode 
003156   ffff     dw	0xffff  ;unknown opcode 
003158   ffff     dw	0xffff  ;unknown opcode 
00315a   ffff     dw	0xffff  ;unknown opcode 
00315c   ffff     dw	0xffff  ;unknown opcode 
00315e   ffff     dw	0xffff  ;unknown opcode 
003160   ffff     dw	0xffff  ;unknown opcode 
003162   ffff     dw	0xffff  ;unknown opcode 
003164   ffff     dw	0xffff  ;unknown opcode 
003166   ffff     dw	0xffff  ;unknown opcode 
003168   ffff     dw	0xffff  ;unknown opcode 
00316a   ffff     dw	0xffff  ;unknown opcode 
00316c   ffff     dw	0xffff  ;unknown opcode 
00316e   ffff     dw	0xffff  ;unknown opcode 
003170   ffff     dw	0xffff  ;unknown opcode 
003172   ffff     dw	0xffff  ;unknown opcode 
003174   ffff     dw	0xffff  ;unknown opcode 
003176   ffff     dw	0xffff  ;unknown opcode 
003178   ffff     dw	0xffff  ;unknown opcode 
00317a   ffff     dw	0xffff  ;unknown opcode 
00317c   ffff     dw	0xffff  ;unknown opcode 
00317e   ffff     dw	0xffff  ;unknown opcode 
003180   ffff     dw	0xffff  ;unknown opcode 
003182   ffff     dw	0xffff  ;unknown opcode 
003184   ffff     dw	0xffff  ;unknown opcode 
003186   ffff     dw	0xffff  ;unknown opcode 
003188   ffff     dw	0xffff  ;unknown opcode 
00318a   ffff     dw	0xffff  ;unknown opcode 
00318c   ffff     dw	0xffff  ;unknown opcode 
00318e   ffff     dw	0xffff  ;unknown opcode 
003190   ffff     dw	0xffff  ;unknown opcode 
003192   ffff     dw	0xffff  ;unknown opcode 
003194   ffff     dw	0xffff  ;unknown opcode 
003196   ffff     dw	0xffff  ;unknown opcode 
003198   ffff     dw	0xffff  ;unknown opcode 
00319a   ffff     dw	0xffff  ;unknown opcode 
00319c   ffff     dw	0xffff  ;unknown opcode 
00319e   ffff     dw	0xffff  ;unknown opcode 
0031a0   ffff     dw	0xffff  ;unknown opcode 
0031a2   ffff     dw	0xffff  ;unknown opcode 
0031a4   ffff     dw	0xffff  ;unknown opcode 
0031a6   ffff     dw	0xffff  ;unknown opcode 
0031a8   ffff     dw	0xffff  ;unknown opcode 
0031aa   ffff     dw	0xffff  ;unknown opcode 
0031ac   ffff     dw	0xffff  ;unknown opcode 
0031ae   ffff     dw	0xffff  ;unknown opcode 
0031b0   ffff     dw	0xffff  ;unknown opcode 
0031b2   ffff     dw	0xffff  ;unknown opcode 
0031b4   ffff     dw	0xffff  ;unknown opcode 
0031b6   ffff     dw	0xffff  ;unknown opcode 
0031b8   ffff     dw	0xffff  ;unknown opcode 
0031ba   ffff     dw	0xffff  ;unknown opcode 
0031bc   ffff     dw	0xffff  ;unknown opcode 
0031be   ffff     dw	0xffff  ;unknown opcode 
0031c0   ffff     dw	0xffff  ;unknown opcode 
0031c2   ffff     dw	0xffff  ;unknown opcode 
0031c4   ffff     dw	0xffff  ;unknown opcode 
0031c6   ffff     dw	0xffff  ;unknown opcode 
0031c8   ffff     dw	0xffff  ;unknown opcode 
0031ca   ffff     dw	0xffff  ;unknown opcode 
0031cc   ffff     dw	0xffff  ;unknown opcode 
0031ce   ffff     dw	0xffff  ;unknown opcode 
0031d0   ffff     dw	0xffff  ;unknown opcode 
0031d2   ffff     dw	0xffff  ;unknown opcode 
0031d4   ffff     dw	0xffff  ;unknown opcode 
0031d6   ffff     dw	0xffff  ;unknown opcode 
0031d8   ffff     dw	0xffff  ;unknown opcode 
0031da   ffff     dw	0xffff  ;unknown opcode 
0031dc   ffff     dw	0xffff  ;unknown opcode 
0031de   ffff     dw	0xffff  ;unknown opcode 
0031e0   ffff     dw	0xffff  ;unknown opcode 
0031e2   ffff     dw	0xffff  ;unknown opcode 
0031e4   ffff     dw	0xffff  ;unknown opcode 
0031e6   ffff     dw	0xffff  ;unknown opcode 
0031e8   ffff     dw	0xffff  ;unknown opcode 
0031ea   ffff     dw	0xffff  ;unknown opcode 
0031ec   ffff     dw	0xffff  ;unknown opcode 
0031ee   ffff     dw	0xffff  ;unknown opcode 
0031f0   ffff     dw	0xffff  ;unknown opcode 
0031f2   ffff     dw	0xffff  ;unknown opcode 
0031f4   ffff     dw	0xffff  ;unknown opcode 
0031f6   ffff     dw	0xffff  ;unknown opcode 
0031f8   ffff     dw	0xffff  ;unknown opcode 
0031fa   ffff     dw	0xffff  ;unknown opcode 
0031fc   ffff     dw	0xffff  ;unknown opcode 
0031fe   ffff     dw	0xffff  ;unknown opcode 
003200   ffff     dw	0xffff  ;unknown opcode 
003202   ffff     dw	0xffff  ;unknown opcode 
003204   ffff     dw	0xffff  ;unknown opcode 
003206   ffff     dw	0xffff  ;unknown opcode 
003208   ffff     dw	0xffff  ;unknown opcode 
00320a   ffff     dw	0xffff  ;unknown opcode 
00320c   ffff     dw	0xffff  ;unknown opcode 
00320e   ffff     dw	0xffff  ;unknown opcode 
003210   ffff     dw	0xffff  ;unknown opcode 
003212   ffff     dw	0xffff  ;unknown opcode 
003214   ffff     dw	0xffff  ;unknown opcode 
003216   ffff     dw	0xffff  ;unknown opcode 
003218   ffff     dw	0xffff  ;unknown opcode 
00321a   ffff     dw	0xffff  ;unknown opcode 
00321c   ffff     dw	0xffff  ;unknown opcode 
00321e   ffff     dw	0xffff  ;unknown opcode 
003220   ffff     dw	0xffff  ;unknown opcode 
003222   ffff     dw	0xffff  ;unknown opcode 
003224   ffff     dw	0xffff  ;unknown opcode 
003226   ffff     dw	0xffff  ;unknown opcode 
003228   ffff     dw	0xffff  ;unknown opcode 
00322a   ffff     dw	0xffff  ;unknown opcode 
00322c   ffff     dw	0xffff  ;unknown opcode 
00322e   ffff     dw	0xffff  ;unknown opcode 
003230   ffff     dw	0xffff  ;unknown opcode 
003232   ffff     dw	0xffff  ;unknown opcode 
003234   ffff     dw	0xffff  ;unknown opcode 
003236   ffff     dw	0xffff  ;unknown opcode 
003238   ffff     dw	0xffff  ;unknown opcode 
00323a   ffff     dw	0xffff  ;unknown opcode 
00323c   ffff     dw	0xffff  ;unknown opcode 
00323e   ffff     dw	0xffff  ;unknown opcode 
003240   ffff     dw	0xffff  ;unknown opcode 
003242   ffff     dw	0xffff  ;unknown opcode 
003244   ffff     dw	0xffff  ;unknown opcode 
003246   ffff     dw	0xffff  ;unknown opcode 
003248   ffff     dw	0xffff  ;unknown opcode 
00324a   ffff     dw	0xffff  ;unknown opcode 
00324c   ffff     dw	0xffff  ;unknown opcode 
00324e   ffff     dw	0xffff  ;unknown opcode 
003250   ffff     dw	0xffff  ;unknown opcode 
003252   ffff     dw	0xffff  ;unknown opcode 
003254   ffff     dw	0xffff  ;unknown opcode 
003256   ffff     dw	0xffff  ;unknown opcode 
003258   ffff     dw	0xffff  ;unknown opcode 
00325a   ffff     dw	0xffff  ;unknown opcode 
00325c   ffff     dw	0xffff  ;unknown opcode 
00325e   ffff     dw	0xffff  ;unknown opcode 
003260   ffff     dw	0xffff  ;unknown opcode 
003262   ffff     dw	0xffff  ;unknown opcode 
003264   ffff     dw	0xffff  ;unknown opcode 
003266   ffff     dw	0xffff  ;unknown opcode 
003268   ffff     dw	0xffff  ;unknown opcode 
00326a   ffff     dw	0xffff  ;unknown opcode 
00326c   ffff     dw	0xffff  ;unknown opcode 
00326e   ffff     dw	0xffff  ;unknown opcode 
003270   ffff     dw	0xffff  ;unknown opcode 
003272   ffff     dw	0xffff  ;unknown opcode 
003274   ffff     dw	0xffff  ;unknown opcode 
003276   ffff     dw	0xffff  ;unknown opcode 
003278   ffff     dw	0xffff  ;unknown opcode 
00327a   ffff     dw	0xffff  ;unknown opcode 
00327c   ffff     dw	0xffff  ;unknown opcode 
00327e   ffff     dw	0xffff  ;unknown opcode 
                                           	ENDM
                                           
                                           
                                           	global	_MIOS_MPROC_EVENT_TABLE
                                           
                                           _MIOS_MPROC_EVENT_TABLE
                                           MIOS_MPROC_EVENT_TABLE
                                           	;; entry 0x00-0x0f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0x10-0x1f	
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0x20-0x2f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	
                                           	;; entry 0x30-0x3f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	
                                           	;; entry 0x40-0x4f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	
                                           	;; entry 0x50-0x5f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           		
                                           	;; entry 0x60-0x6f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0x70-0x7f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0x80-0x8f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0x90-0x9f
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0xa0-0xaf
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0xb1-0xbf
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0xc0-0xcf
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0xd0-0xdf
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0xe0-0xef
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           	;; entry 0xf0-0xff
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           	MT_EOT
                                           
                                           
                                           
                                           ; ==========================================================================
                                           
                                           	org	0x3280		; never change the origin!
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;; In this table DIN pins have to be assigned to rotary encoders for the
                                           ;; MIOS_ENC driver 
                                           ;; 
                                           ;; up to 64 entries are provided
                                           ;; 
                                           ;; The table must be terminated with an ENC_EOT entry. Unused entries should
                                           ;; be filled with ENC_EOT
                                           ;; 
                                           ;; ENC_ENTRY provides following parameters
                                           ;;    o first parameter: number of shift register - 1, 2, 3, ... 16
                                           ;;    o second parameter: number of pin; since two pins are necessary
                                           ;;      for each encoder, an even number is expected: 0, 2, 4 or 6
                                           ;;    o the third parameter contains the encoder mode:
                                           ;;      either MIOS_ENC_MODE_NON_DETENTED
                                           ;;          or MIOS_ENC_MODE_DETENTED
                                           ;;
                                           ;; Configuration Examples:
                                           ;;    ENC_ENTRY  1,  0,  MIOS_ENC_MODE_NON_DETENTED    ; non-detented encoder at pin 0 and 1 of SR 1
                                           ;;    ENC_ENTRY  1,  2,  MIOS_ENC_MODE_DETENTED        ; detented encoder at pin 2 and 3 of SR 1
                                           ;;    ENC_ENTRY  9,  6,  MIOS_ENC_MODE_NON_DETENTED    ; non-detented encoder at pin 6 and 7 of SR 9
                                           ;; --------------------------------------------------------------------------
                                           
                                           	;; encoder entry structure
                                           ENC_ENTRY MACRO sr, din_0, mode
                                           	dw	(mode << 8) | (din_0 + 8*(sr-1))
                                           	ENDM	
                                           ENC_EOT	MACRO
003280   ffff     dw	0xffff  ;unknown opcode 	dw	0xffff
003282   ffff     dw	0xffff  ;unknown opcode 
003284   ffff     dw	0xffff  ;unknown opcode 
003286   ffff     dw	0xffff  ;unknown opcode 
003288   ffff     dw	0xffff  ;unknown opcode 
00328a   ffff     dw	0xffff  ;unknown opcode 
00328c   ffff     dw	0xffff  ;unknown opcode 
00328e   ffff     dw	0xffff  ;unknown opcode 
003290   ffff     dw	0xffff  ;unknown opcode 
003292   ffff     dw	0xffff  ;unknown opcode 
003294   ffff     dw	0xffff  ;unknown opcode 
003296   ffff     dw	0xffff  ;unknown opcode 
003298   ffff     dw	0xffff  ;unknown opcode 
00329a   ffff     dw	0xffff  ;unknown opcode 
00329c   ffff     dw	0xffff  ;unknown opcode 
00329e   ffff     dw	0xffff  ;unknown opcode 
0032a0   ffff     dw	0xffff  ;unknown opcode 
0032a2   ffff     dw	0xffff  ;unknown opcode 
0032a4   ffff     dw	0xffff  ;unknown opcode 
0032a6   ffff     dw	0xffff  ;unknown opcode 
0032a8   ffff     dw	0xffff  ;unknown opcode 
0032aa   ffff     dw	0xffff  ;unknown opcode 
0032ac   ffff     dw	0xffff  ;unknown opcode 
0032ae   ffff     dw	0xffff  ;unknown opcode 
0032b0   ffff     dw	0xffff  ;unknown opcode 
0032b2   ffff     dw	0xffff  ;unknown opcode 
0032b4   ffff     dw	0xffff  ;unknown opcode 
0032b6   ffff     dw	0xffff  ;unknown opcode 
0032b8   ffff     dw	0xffff  ;unknown opcode 
0032ba   ffff     dw	0xffff  ;unknown opcode 
0032bc   ffff     dw	0xffff  ;unknown opcode 
0032be   ffff     dw	0xffff  ;unknown opcode 
0032c0   ffff     dw	0xffff  ;unknown opcode 
0032c2   ffff     dw	0xffff  ;unknown opcode 
0032c4   ffff     dw	0xffff  ;unknown opcode 
0032c6   ffff     dw	0xffff  ;unknown opcode 
0032c8   ffff     dw	0xffff  ;unknown opcode 
0032ca   ffff     dw	0xffff  ;unknown opcode 
0032cc   ffff     dw	0xffff  ;unknown opcode 
0032ce   ffff     dw	0xffff  ;unknown opcode 
0032d0   ffff     dw	0xffff  ;unknown opcode 
0032d2   ffff     dw	0xffff  ;unknown opcode 
0032d4   ffff     dw	0xffff  ;unknown opcode 
0032d6   ffff     dw	0xffff  ;unknown opcode 
0032d8   ffff     dw	0xffff  ;unknown opcode 
0032da   ffff     dw	0xffff  ;unknown opcode 
0032dc   ffff     dw	0xffff  ;unknown opcode 
0032de   ffff     dw	0xffff  ;unknown opcode 
0032e0   ffff     dw	0xffff  ;unknown opcode 
0032e2   ffff     dw	0xffff  ;unknown opcode 
0032e4   ffff     dw	0xffff  ;unknown opcode 
0032e6   ffff     dw	0xffff  ;unknown opcode 
0032e8   ffff     dw	0xffff  ;unknown opcode 
0032ea   ffff     dw	0xffff  ;unknown opcode 
0032ec   ffff     dw	0xffff  ;unknown opcode 
0032ee   ffff     dw	0xffff  ;unknown opcode 
0032f0   ffff     dw	0xffff  ;unknown opcode 
0032f2   ffff     dw	0xffff  ;unknown opcode 
0032f4   ffff     dw	0xffff  ;unknown opcode 
0032f6   ffff     dw	0xffff  ;unknown opcode 
0032f8   ffff     dw	0xffff  ;unknown opcode 
0032fa   ffff     dw	0xffff  ;unknown opcode 
0032fc   ffff     dw	0xffff  ;unknown opcode 
0032fe   ffff     dw	0xffff  ;unknown opcode 
                                           	ENDM
                                           
                                           	global	_MIOS_ENC_PIN_TABLE
                                           
                                           _MIOS_ENC_PIN_TABLE
                                           MIOS_ENC_PIN_TABLE
                                           	;; encoders 1-16
                                           	;;        SR  Pin  Mode
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           
                                           	;; encoders 17-32
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           
                                           	;; encoders 33-48
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           
                                           	;; encoders 49-64
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           	ENC_EOT
                                           
                                           	org	0x3300		; never change the origin!
                                           
                                           ;; ---[ Custom LCD driver ]---
                                           #include "app_lcd.inc"
                                           ;
                                           ; MIOS Custom LCD Driver Skeleton
                                           ;
                                           ; ==========================================================================
                                           ;
                                           ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
                                           ;  Licensed for personal non-commercial use only.
                                           ;  All other rights reserved.
                                           ; 
                                           ; ==========================================================================
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  Following system variables are given by MIOS and can be directly 
                                           ;;  accessed by the driver. The addresses are defined in mios.h and
                                           ;;  should not be changed
                                           ;; 
                                           ;;  MIOS_GLCD_BUFFER	     a 8 byte buffer for data transfers
                                           ;;  MIOS_LCD_OPTION1	     contains the first LCD option given by MIOS_LCD_TypeSet
                                           ;;  MIOS_LCD_OPTION2	     contains the second LCD option given by MIOS_LCD_TypeSet
                                           ;;  MIOS_LCD_CURSOR_POS	     the current cursor pos of characters (GLCD: multiplied by width)
                                           ;;  MIOS_GLCD_GCURSOR_X	     for GLCDs: the current X position of graphical cursor
                                           ;;  MIOS_GLCD_GCURSOR_Y	     for GLCDs: the current Y position of graphical cursor
                                           ;;  MIOS_GLCD_FONT_WIDTH     for GLCDs: the fontwidth given by MIOS_GLCD_FontInit
                                           ;;  MIOS_GLCD_FONT_HEIGHT    for GLCDs: the fontheight given by MIOS_GLCD_FontInit
                                           ;;  MIOS_GLCD_FONT_X0        for GLCDs: the first byte within a char entry
                                           ;;  MIOS_GLCD_FONT_OFFSET    for GLCDs: the byte offset between the characters
                                           ;;  MIOS_GLCD_FONT_PTRL      for GLCDs: pointer to the character table, low-byte
                                           ;;  MIOS_GLCD_FONT_PTRH      for GLCDs: pointer to the character table, high-byte
                                           ;;  MIOS_LCD_TIMEOUT0        can be used for timeout loops
                                           ;;  MIOS_LCD_TIMEOUT1        can be used for timeout loops
                                           ;;  MIOS_GLCD_TMP1           can be used as temporary buffer
                                           ;;  MIOS_GLCD_TMP2           can be used as temporary buffer
                                           ;;  MIOS_GLCD_TMP3           can be used as temporary buffer
                                           ;;  MIOS_GLCD_TMP4           can be used as temporary buffer
                                           ;;  MIOS_LCD_Y0_OFFSET       Y0 offset of LCD
                                           ;;  MIOS_LCD_Y1_OFFSET       Y1 offset of LCD
                                           ;;  MIOS_LCD_Y2_OFFSET       Y2 offset of LCD
                                           ;;  MIOS_LCD_Y3_OFFSET       Y3 offset of LCD
                                           ;;  MIOS_LCD_CURSOR_POS_REAL unmapped cursor position which has been set with MIOS_LCD_CursorSet
                                           ;; 
                                           ;;  Note: the addresses are located in an upper bank and therefore have to
                                           ;;        be accessed with the BANKED flag. Also the BSR has to be justified
                                           ;;        before using the registers
                                           ;;  Example:
                                           ;;	SET_BSR MIOS_LCD_OPTION1	; sets BSR to the bank where MIOS_LCD_*
                                           ;;					; has been located. You don't need to
                                           ;;					; change the BSR for the other LCD registers
                                           ;;      movf    MIOS_LCD_OPTION1, W, BANKED	; get LCD option #1
                                           ;; 
                                           ;;  Important: to allow a proper interaction with MIOS applications, you are
                                           ;;  only allowed to modify MIOS_PARAMETER[123], the mutliplication registers
                                           ;;  and FSR1. You are not allowed to change TMP[1-5] or FSR0
                                           ;;  if you need some temporary registers, use the given addresses above or
                                           ;;  locate them to addresses which are not used by the application
                                           ;; --------------------------------------------------------------------------
                                           	
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when the custom LCD should be initialized
                                           ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
                                           ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
                                           ;;  Out: -
                                           ;; --------------------------------------------------------------------------
                                           USER_LCD_Init
003300   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when the custom LCD should be cleared
                                           ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
                                           ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
                                           ;;  Out: -
                                           ;; --------------------------------------------------------------------------
                                           USER_LCD_Clear
003302   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when the cursor should be changed
                                           ;;  In:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
                                           ;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
                                           ;;       MIOS_GLCD_CURSOR_X - horizontal cursor position (for GLCDs)
                                           ;;       MIOS_GLCD_CURSOR_X - vertical cursor position   (for GLCDs)
                                           ;;       MIOS_LCD_CURSOR    - character cursor position  (for CLCDs)
                                           ;;  Out: -
                                           ;; --------------------------------------------------------------------------
                                           USER_LCD_CursorSet
003304   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when a character should be print
                                           ;;  In:  WREG - character
                                           ;;       all other MIOS_*LCD_* registers
                                           ;;  Out: GLCDs should justify the X/Y cursor position
                                           ;; --------------------------------------------------------------------------
                                           USER_LCD_PrintChar
003306   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  FUNCTION: USER_LCD_Data
                                           ;;  DESCRIPTION: sends a data value to the LCD display.<BR>
                                           ;;  On CLCDs: branch directly to USER_LCD_PrintChar<BR>
                                           ;;  On GLCDs: ignore this function!
                                           ;;  IN:  data which should be sent
                                           ;;  OUT: -
                                           ;;  NOTE: see the custom_lcd_example for further details
                                           ;; --------------------------------------------------------------------------
                                           USER_LCD_Data
003308   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  FUNCTION: USER_LCD_Cmd
                                           ;;  DESCRIPTION: sends a command to the LCD display.<BR>
                                           ;;  On CLCDs: use this function to decode the HD44780 commands if required<BR>
                                           ;;  On GLCDs: ignore this function!
                                           ;;  IN:  command which should be sent
                                           ;;  OUT: -
                                           ;;  NOTE: see the custom_lcd_example for further details
                                           ;; --------------------------------------------------------------------------
                                           USER_LCD_Cmd
00330a   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  FUNCTION: USER_LCD_SpecialCharInit
                                           ;;  DESCRIPTION: see MIOS_CLCD_SpecialCharInit
                                           ;;  IN:  number of special character (0-7) in WREG
                                           ;;       pointer to special char pattern in TBLPTR (consists of 8
                                           ;;          entries for every character-line)
                                           ;;  OUT: TBLPTR has to be set to next table entry (TBLPTR+=8)
                                           ;;  NOTE: see the custom_lcd_example for further details
                                           ;; --------------------------------------------------------------------------
                                           USER_LCD_SpecialCharInit
00330c   0012     return	0                 	return
                                           
                                           ; Don't enable this --- its only used by a special testcase which checks 
                                           ; parameter passing on functions which are difficult to verify with
                                           ; directed tests
                                           #ifndef PARAMETER_PASSING_TEST
                                           #define PARAMETER_PASSING_TEST 0
                                           #endif
                                           
                                           ;; ==========================================================================
                                           ;;  Export MIOS variables
                                           ;; ==========================================================================
                                           	global	_MIOS_BOX_CFG0
                                           	global	_MIOS_BOX_CFG1
                                           	global	_MIOS_BOX_STAT
                                           	global	_MIOS_PARAMETER1
                                           	global	_MIOS_PARAMETER2
                                           	global	_MIOS_PARAMETER3
                                           
                                           MIOS_VARIABLES		udata	0x0000
                                           _MIOS_BOX_CFG0		res	1
                                           _MIOS_BOX_CFG1		res	1
                                           _MIOS_BOX_STAT		res	1
                                           _MIOS_PARAMETER1	res	1
                                           _MIOS_PARAMETER2	res	1
                                           _MIOS_PARAMETER3	res	1
                                           _TMP1			res	1
                                           _TMP2			res	1
                                           _TMP3			res	1
                                           _TMP4			res	1
                                           _TMP5			res	1
                                           _IRQ_TMP1		res	1
                                           _IRQ_TMP2		res	1
                                           _IRQ_TMP3		res	1
                                           _IRQ_TMP4		res	1
                                           _IRQ_TMP5		res	1
                                           
                                           ;; ==========================================================================
                                           ;;  All MIOS hooks in one file
                                           ;; ==========================================================================
                                           
                                           MIOS_WRAPPER_CODE	code
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS after startup to initialize the 
                                           ;;  application
                                           ;; --------------------------------------------------------------------------
                                           USER_Init
                                           	extern	_Init
                                           
00397e   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
003980   f07f
003982   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
003984   f07f
003986   ef12     goto	0x4024              	goto	_Init	
003988   f020
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS in the mainloop when nothing else is to do
                                           ;; --------------------------------------------------------------------------
                                           USER_Tick
                                           	extern	_Tick
                                           
00398a   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
00398c   f07f
00398e   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
003990   f07f
003992   ef6e     goto	0x44dc              	goto	_Tick
003994   f022
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is periodically called by MIOS. The frequency has to be
                                           ;;  initialized with MIOS_Timer_Set
                                           ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
                                           ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
                                           ;; --------------------------------------------------------------------------
                                           USER_Timer
                                           	extern	_Timer
                                           
003996   ee23     lfsr	0x2, 0x33f          	lfsr	FSR2, STACK_IRQ_HEAD	; initialize IRQ stack
003998   f03f
00399a   cfe9     movff	0xfe9, 0xfdd       	movff	FSR0L, POSTDEC2		; save FSR0[LH] on IRQ stack
00399c   ffdd
00399e   cfea     movff	0xfea, 0xfdd       	movff	FSR0H, POSTDEC2
0039a0   ffdd
0039a2   ee03     lfsr	0, 0x33d            	lfsr	FSR0, STACK_IRQ_HEAD-2	; write stack pointer also to FSR0
0039a4   f03d
0039a6   ec7e     call	0x44fc, 0           	call	_Timer			; call C hook
0039a8   f022
0039aa   c33f     movff	0x33f, 0xfe9       	movff	STACK_IRQ_HEAD-0, FSR0L	; restore FSR0[LH] directly from memory (more fail save)
0039ac   ffe9
0039ae   c33e     movff	0x33e, 0xfea       	movff	STACK_IRQ_HEAD-1, FSR0H	; restore FSR0[LH] directly from memory (more fail save)
0039b0   ffea
0039b2   0012     return	0                 	return
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when a debug command has been received
                                           ;;  via SysEx
                                           ;;  Input:
                                           ;;     o WREG, MIOS_PARAMETER1, MIOS_PARAMETER2, MIOS_PARAMETER3 like
                                           ;;       specified in the debug command
                                           ;;  Output:
                                           ;;     o return values WREG, MIOS_PARAMETER1, MIOS_PARAMETER2, MIOS_PARAMETER3
                                           ;; --------------------------------------------------------------------------
                                           USER_MPROC_DebugTrigger
                                           	;; not really required for C programs
0039b4   0012     return	0                 	return
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when the display content should be 
                                           ;;  initialized. Thats the case during startup and after a temporary message
                                           ;;  has been printed on the screen
                                           ;; --------------------------------------------------------------------------
                                           USER_DISPLAY_Init
                                           	extern	_DISPLAY_Init
                                           
0039b6   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
0039b8   f07f
0039ba   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
0039bc   f07f
0039be   efd3     goto	0x41a6              	goto	_DISPLAY_Init
0039c0   f020
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called in the mainloop when no temporary message is shown
                                           ;;  on screen. Print the realtime messages here
                                           ;; --------------------------------------------------------------------------
                                           USER_DISPLAY_Tick
                                           	extern	_DISPLAY_Tick
                                           
0039c2   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
0039c4   f07f
0039c6   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
0039c8   f07f
0039ca   ef16     goto	0x442c              	goto	_DISPLAY_Tick
0039cc   f022
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when a complete MIDI event has been received
                                           ;;  Input:
                                           ;;     o first  MIDI event byte in MIOS_PARAMETER1
                                           ;;     o second MIDI event byte in MIOS_PARAMETER2
                                           ;;     o third  MIDI event byte in MIOS_PARAMETER3
                                           ;; --------------------------------------------------------------------------
                                           USER_MPROC_NotifyReceivedEvent
                                           	extern	_MPROC_NotifyReceivedEvnt
                                           
0039ce   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
0039d0   f07f
0039d2   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
0039d4   f07f
                                           
0039d6   c005     movff	0x5, 0xfed         	movff	MIOS_PARAMETER3, POSTDEC0
0039d8   ffed
0039da   c004     movff	0x4, 0xfed         	movff	MIOS_PARAMETER2, POSTDEC0
0039dc   ffed
0039de   5003     movf	0x3, 0, 0           	movf	MIOS_PARAMETER1, W
0039e0   ef0f     goto	0x441e              	goto	_MPROC_NotifyReceivedEvnt
0039e2   f022
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when a MIDI event has been received
                                           ;;  which has been specified in the CONFIG_MIDI_IN table
                                           ;;  Input:
                                           ;;     o number of entry in WREG
                                           ;;     o first  MIDI event byte in MIOS_PARAMETER1
                                           ;;     o second MIDI event byte in MIOS_PARAMETER2
                                           ;;     o third  MIDI event byte in MIOS_PARAMETER3
                                           ;; --------------------------------------------------------------------------
                                           USER_MPROC_NotifyFoundEvent
                                           	extern	_MPROC_NotifyFoundEvent
                                           
0039e4   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
0039e6   f07f
0039e8   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
0039ea   f07f
                                           
0039ec   c005     movff	0x5, 0xfed         	movff	MIOS_PARAMETER3, POSTDEC0
0039ee   ffed
0039f0   c004     movff	0x4, 0xfed         	movff	MIOS_PARAMETER2, POSTDEC0
0039f2   ffed
0039f4   c003     movff	0x3, 0xfed         	movff	MIOS_PARAMETER1, POSTDEC0
0039f6   ffed
0039f8   6eed     movwf	0xed, 0            	movwf	POSTDEC0		; TK: required for SDCC 2.5.0, don't know why...
                                           	;; entry number still in wreg
0039fa   ef08     goto	0x4410              	goto	_MPROC_NotifyFoundEvent
0039fc   f022
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when a MIDI event has not been completly
                                           ;;  received within 2 seconds
                                           ;; --------------------------------------------------------------------------
                                           USER_MPROC_NotifyTimeout
                                           	extern	_MPROC_NotifyTimeout
                                           
0039fe   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
003a00   f07f
003a02   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
003a04   f07f
003a06   ef89     goto	0x4512              	goto	_MPROC_NotifyTimeout
003a08   f022
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when a MIDI byte has been received
                                           ;;  Input:
                                           ;;     o received MIDI byte in WREG and MIOS_PARAMETER1
                                           ;; --------------------------------------------------------------------------
                                           USER_MPROC_NotifyReceivedByte
                                           	extern	_MPROC_NotifyReceivedByte
                                           
003a0a   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
003a0c   f07f
003a0e   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
003a10   f07f
                                           
                                           	;; MIDI byte still in WREG
003a12   ef01     goto	0x4402              	goto	_MPROC_NotifyReceivedByte
003a14   f022
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS before the transfer of a MIDI byte. 
                                           ;;  It can be used to monitor the Tx activity or to do any other actions
                                           ;;  (e.g. to switch a pin for multiplexed MIDI Outs) before the byte will 
                                           ;;  be sent.
                                           ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
                                           ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
                                           ;;  Input:
                                           ;;     o transmitted byte in WREG
                                           ;; --------------------------------------------------------------------------
                                           USER_MIDI_NotifyTx
                                           	;; too time consuming for C programs --- should be handled so fast as
                                           	;; possible and therefore serviced in assembler
003a16   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when a MIDI byte has been received.
                                           ;;  It can be used to monitor the Rx activity or to do any action - e.g.
                                           ;;  to react on realtime events like MIDI clock (0xf8) with a minimum latency
                                           ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
                                           ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible!
                                           ;;  Input:
                                           ;;     o received byte in WREG
                                           ;; --------------------------------------------------------------------------
                                           USER_MIDI_NotifyRx
                                           	;; too time consuming for C programs --- should be handled so fast as
                                           	;; possible and therefore serviced in assembler
003a18   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when an button has been toggled
                                           ;;  Input:
                                           ;;     o Button number in WREG and MIOS_PARAMETER1
                                           ;;     o Button value MIOS_PARAMETER2:
                                           ;;       - 1 if button has been released (=5V)
                                           ;;       - 0 if button has been pressed (=0V)
                                           ;; --------------------------------------------------------------------------
                                           USER_DIN_NotifyToggle
                                           	extern	_DIN_NotifyToggle
                                           
003a1a   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
003a1c   f07f
003a1e   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
003a20   f07f
                                           
003a22   c004     movff	0x4, 0xfed         	movff	MIOS_PARAMETER2, POSTDEC0
003a24   ffed
                                           	;; button number still in WREG
003a26   effa     goto	0x43f4              	goto	_DIN_NotifyToggle
003a28   f021
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when an encoder has been moved
                                           ;;  Input:
                                           ;;     o Encoder number in WREG and MIOS_PARAMETER1
                                           ;;     o signed incrementer value in MIOS_PARAMETER2:
                                           ;;       - is positive when encoder has been turned clockwise
                                           ;;       - is negative when encoder has been turned counter clockwise
                                           ;; --------------------------------------------------------------------------
                                           USER_ENC_NotifyChange
                                           	extern	_ENC_NotifyChange
                                           
003a2a   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
003a2c   f07f
003a2e   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
003a30   f07f
                                           
003a32   c004     movff	0x4, 0xfed         	movff	MIOS_PARAMETER2, POSTDEC0
003a34   ffed
                                           	;; encoder number still in WREG
003a36   eff3     goto	0x43e6              	goto	_ENC_NotifyChange
003a38   f021
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS before the shift register are loaded
                                           ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
                                           ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible
                                           ;; --------------------------------------------------------------------------
                                           USER_SR_Service_Prepare
                                           	extern	_SR_Service_Prepare
                                           
003a3a   ee23     lfsr	0x2, 0x33f          	lfsr	FSR2, STACK_IRQ_HEAD	; initialize IRQ stack
003a3c   f03f
003a3e   cfe9     movff	0xfe9, 0xfdd       	movff	FSR0L, POSTDEC2		; save FSR0[LH] on IRQ stack
003a40   ffdd
003a42   cfea     movff	0xfea, 0xfdd       	movff	FSR0H, POSTDEC2
003a44   ffdd
003a46   ee03     lfsr	0, 0x33d            	lfsr	FSR0, STACK_IRQ_HEAD-2	; write stack pointer also to FSR0
003a48   f03d
003a4a   ecba     call	0x4174, 0           	call	_SR_Service_Prepare	; call C hook
003a4c   f020
003a4e   c33f     movff	0x33f, 0xfe9       	movff	STACK_IRQ_HEAD-0, FSR0L	; restore FSR0[LH] directly from memory (more fail save)
003a50   ffe9
003a52   c33e     movff	0x33e, 0xfea       	movff	STACK_IRQ_HEAD-1, FSR0H	; restore FSR0[LH] directly from memory (more fail save)
003a54   ffea
003a56   0012     return	0                 	return
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS after the shift register have been loaded
                                           ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
                                           ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible
                                           ;; --------------------------------------------------------------------------
                                           USER_SR_Service_Finish
                                           	extern	_SR_Service_Finish
                                           
003a58   ee23     lfsr	0x2, 0x33f          	lfsr	FSR2, STACK_IRQ_HEAD	; initialize IRQ stack
003a5a   f03f
003a5c   cfe9     movff	0xfe9, 0xfdd       	movff	FSR0L, POSTDEC2		; save FSR0[LH] on IRQ stack
003a5e   ffdd
003a60   cfea     movff	0xfea, 0xfdd       	movff	FSR0H, POSTDEC2
003a62   ffdd
003a64   ee03     lfsr	0, 0x33d            	lfsr	FSR0, STACK_IRQ_HEAD-2	; write stack pointer also to FSR0
003a66   f03d
003a68   ec7b     call	0x44f6, 0           	call	_SR_Service_Finish	; call C hook
003a6a   f022
003a6c   c33f     movff	0x33f, 0xfe9       	movff	STACK_IRQ_HEAD-0, FSR0L	; restore FSR0[LH] directly from memory (more fail save)
003a6e   ffe9
003a70   c33e     movff	0x33e, 0xfea       	movff	STACK_IRQ_HEAD-1, FSR0H	; restore FSR0[LH] directly from memory (more fail save)
003a72   ffea
003a74   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  This function is called by MIOS when a pot has been moved
                                           ;;  Input:
                                           ;;     o Pot number in WREG and MIOS_PARAMETER1
                                           ;;     o LSB value in MIOS_PARAMETER2
                                           ;;     o MSB value in MIOS_PARAMETER3
                                           ;; --------------------------------------------------------------------------
                                           USER_AIN_NotifyChange
                                           	extern	_AIN_NotifyChange
                                           
003a76   ee03     lfsr	0, 0x37f            	lfsr	FSR0, STACK_HEAD	; initialize stack
003a78   f07f
003a7a   ee23     lfsr	0x2, 0x37f          	lfsr	FSR2, STACK_HEAD
003a7c   f07f
                                           
003a7e   c005     movff	0x5, 0xfed         	movff	MIOS_PARAMETER3, POSTDEC0
003a80   ffed
003a82   c004     movff	0x4, 0xfed         	movff	MIOS_PARAMETER2, POSTDEC0
003a84   ffed
                                           	;; pot number still in WREG
003a86   efa5     goto	0x374a              	goto	_AIN_NotifyChange
003a88   f01b
                                           
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;; ==========================================================================
                                           ;;  LINKS TO THE MIOS FUNCTIONS
                                           ;; ==========================================================================
                                           ;; --------------------------------------------------------------------------
                                           
                                           .MIOS_MIDI_BeginStream code MIOS_MIDI_BeginStream
                                           _MIOS_MIDI_BeginStream
                                           	global	_MIOS_MIDI_BeginStream
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_DeviceIDAutoSet code MIOS_MIDI_DeviceIDAutoSet
                                           _MIOS_MIDI_DeviceIDAutoSet
                                           	global	_MIOS_MIDI_DeviceIDAutoSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_DeviceIDGet code MIOS_MIDI_DeviceIDGet
                                           _MIOS_MIDI_DeviceIDGet
                                           	global	_MIOS_MIDI_DeviceIDGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_DeviceIDSet code MIOS_MIDI_DeviceIDSet
                                           _MIOS_MIDI_DeviceIDSet
                                           	global	_MIOS_MIDI_DeviceIDSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_EndStream code MIOS_MIDI_EndStream
                                           _MIOS_MIDI_EndStream
                                           	global	_MIOS_MIDI_EndStream
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_Init code MIOS_MIDI_Init
                                           _MIOS_MIDI_Init
                                           	global	_MIOS_MIDI_Init
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_InterfaceAutoSet code MIOS_MIDI_InterfaceAutoSet
                                           _MIOS_MIDI_InterfaceAutoSet
                                           	global	_MIOS_MIDI_InterfaceAutoSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_InterfaceGet code MIOS_MIDI_InterfaceGet
                                           _MIOS_MIDI_InterfaceGet
                                           	global	_MIOS_MIDI_InterfaceGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_InterfaceSet code MIOS_MIDI_InterfaceSet
                                           _MIOS_MIDI_InterfaceSet
                                           	global	_MIOS_MIDI_InterfaceSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_MergerGet code MIOS_MIDI_MergerGet
                                           _MIOS_MIDI_MergerGet
                                           	global	_MIOS_MIDI_MergerGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_MergerSet code MIOS_MIDI_MergerSet
                                           _MIOS_MIDI_MergerSet
                                           	global	_MIOS_MIDI_MergerSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_RxBufferFree code MIOS_MIDI_RxBufferFree
                                           _MIOS_MIDI_RxBufferFree
                                           	global	_MIOS_MIDI_RxBufferFree
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_RxBufferGet code MIOS_MIDI_RxBufferGet
                                           _MIOS_MIDI_RxBufferGet
                                           	global	_MIOS_MIDI_RxBufferGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_RxBufferPut code MIOS_MIDI_RxBufferPut
                                           _MIOS_MIDI_RxBufferPut
                                           	global	_MIOS_MIDI_RxBufferPut
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_RxBufferUsed code MIOS_MIDI_RxBufferUsed
                                           _MIOS_MIDI_RxBufferUsed
                                           	global	_MIOS_MIDI_RxBufferUsed
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_TxBufferFlush code MIOS_MIDI_TxBufferFlush
                                           _MIOS_MIDI_TxBufferFlush
                                           	global	_MIOS_MIDI_TxBufferFlush
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_TxBufferFree code MIOS_MIDI_TxBufferFree
                                           _MIOS_MIDI_TxBufferFree
                                           	global	_MIOS_MIDI_TxBufferFree
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_TxBufferGet code MIOS_MIDI_TxBufferGet
                                           _MIOS_MIDI_TxBufferGet
                                           	global	_MIOS_MIDI_TxBufferGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_TxBufferPut code MIOS_MIDI_TxBufferPut
                                           _MIOS_MIDI_TxBufferPut
                                           	global	_MIOS_MIDI_TxBufferPut
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MIDI_TxBufferUsed code MIOS_MIDI_TxBufferUsed
                                           _MIOS_MIDI_TxBufferUsed
                                           	global	_MIOS_MIDI_TxBufferUsed
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MPROC_MergerDisable code MIOS_MPROC_MergerDisable
                                           _MIOS_MPROC_MergerDisable
                                           	global	_MIOS_MPROC_MergerDisable
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MPROC_MergerEnable code MIOS_MPROC_MergerEnable
                                           _MIOS_MPROC_MergerEnable
                                           	global	_MIOS_MPROC_MergerEnable
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MPROC_MergerGet code MIOS_MPROC_MergerGet
                                           _MIOS_MPROC_MergerGet
                                           	global	_MIOS_MPROC_MergerGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_DeadbandGet code MIOS_AIN_DeadbandGet
                                           _MIOS_AIN_DeadbandGet
                                           	global	_MIOS_AIN_DeadbandGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_DeadbandSet code MIOS_AIN_DeadbandSet
                                           _MIOS_AIN_DeadbandSet
                                           	global	_MIOS_AIN_DeadbandSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_Muxed code MIOS_AIN_Muxed
                                           _MIOS_AIN_Muxed
                                           	global	_MIOS_AIN_Muxed
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_NumberGet code MIOS_AIN_NumberGet
                                           _MIOS_AIN_NumberGet
                                           	global	_MIOS_AIN_NumberGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_NumberSet code MIOS_AIN_NumberSet
                                           _MIOS_AIN_NumberSet
                                           	global	_MIOS_AIN_NumberSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_Pin7bitGet code MIOS_AIN_Pin7bitGet
                                           _MIOS_AIN_Pin7bitGet
                                           	global	_MIOS_AIN_Pin7bitGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_PinGet code
                                           _MIOS_AIN_PinGet
                                           	global	_MIOS_AIN_PinGet
                                           
0044e6   ec3a     call	0x2c74, 0           	call	MIOS_AIN_PinGet
0044e8   f016
0044ea   c004     movff	0x4, 0xff3         	movff	MIOS_PARAMETER2, PRODL	; high byte -> PRODL
0044ec   fff3
0044ee   0012     return	0                 	return				; low byte already in WREG
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_PinLSBGet code MIOS_AIN_PinLSBGet
                                           _MIOS_AIN_PinLSBGet
                                           	global	_MIOS_AIN_PinLSBGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_PinMSBGet code MIOS_AIN_PinMSBGet
                                           _MIOS_AIN_PinMSBGet
                                           	global	_MIOS_AIN_PinMSBGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_UnMuxed code MIOS_AIN_UnMuxed
                                           _MIOS_AIN_UnMuxed
                                           	global	_MIOS_AIN_UnMuxed
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_PWM_DutyCycleDownGet code MIOS_MF_PWM_DutyCycleDownGet
                                           _MIOS_MF_PWM_DutyCycleDownGet
                                           	global	_MIOS_MF_PWM_DutyCycleDownGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_PWM_DutyCycleDownSet code MIOS_MF_PWM_DutyCycleDownSet
                                           _MIOS_MF_PWM_DutyCycleDownSet
                                           	global	_MIOS_MF_PWM_DutyCycleDownSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_PWM_DutyCycleUpGet code MIOS_MF_PWM_DutyCycleUpGet
                                           _MIOS_MF_PWM_DutyCycleUpGet
                                           	global	_MIOS_MF_PWM_DutyCycleUpGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_PWM_DutyCycleUpSet code MIOS_MF_PWM_DutyCycleUpSet
                                           _MIOS_MF_PWM_DutyCycleUpSet
                                           	global	_MIOS_MF_PWM_DutyCycleUpSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_DeadbandGet code MIOS_MF_DeadbandGet
                                           _MIOS_MF_DeadbandGet
                                           	global	_MIOS_MF_DeadbandGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_DeadbandSet code MIOS_MF_DeadbandSet
                                           _MIOS_MF_DeadbandSet
                                           	global	_MIOS_MF_DeadbandSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_Disable code MIOS_MF_Disable
                                           _MIOS_MF_Disable
                                           	global	_MIOS_MF_Disable
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_Enable code MIOS_MF_Enable
                                           _MIOS_MF_Enable
                                           	global	_MIOS_MF_Enable
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_FaderMove code
                                           _MIOS_MF_FaderMove
                                           	global	_MIOS_MF_FaderMove
                                           
004386   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004388   ffd9
00438a   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
00438c   f003
00438e   cfdc     movff	0xfdc, 0x4          	movff	PREINC2, MIOS_PARAMETER2
004390   f004
004392   ef52     goto	0x2ca4              	goto	MIOS_MF_FaderMove
004394   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_SuspendDisable code MIOS_MF_SuspendDisable
                                           _MIOS_MF_SuspendDisable
                                           	global	_MIOS_MF_SuspendDisable
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_SuspendEnable code MIOS_MF_SuspendEnable
                                           _MIOS_MF_SuspendEnable
                                           	global	_MIOS_MF_SuspendEnable
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_SuspendGet code MIOS_MF_SuspendGet
                                           _MIOS_MF_SuspendGet
                                           	global	_MIOS_MF_SuspendGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_PWM_PeriodGet code MIOS_MF_PWM_PeriodGet
                                           _MIOS_MF_PWM_PeriodGet
                                           	global	_MIOS_MF_PWM_PeriodGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_PWM_PeriodSet code MIOS_MF_PWM_PeriodSet
                                           _MIOS_MF_PWM_PeriodSet
                                           	global	_MIOS_MF_PWM_PeriodSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_MF_TouchDetectionReset code MIOS_MF_TouchDetectionReset
                                           _MIOS_MF_TouchDetectionReset
                                           	global	_MIOS_MF_TouchDetectionReset
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DIN_PinGet code MIOS_DIN_PinGet
                                           _MIOS_DIN_PinGet
                                           	global	_MIOS_DIN_PinGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DIN_SRGet code MIOS_DIN_SRGet
                                           _MIOS_DIN_SRGet
                                           	global	_MIOS_DIN_SRGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DOUT_PinGet code MIOS_DOUT_PinGet
                                           _MIOS_DOUT_PinGet
                                           	global	_MIOS_DOUT_PinGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DOUT_PinSet code
                                           _MIOS_DOUT_PinSet
                                           	global	_MIOS_DOUT_PinSet
                                           
004464   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004466   ffd9
004468   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
00446a   f003
00446c   ef60     goto	0x2cc0              	goto	MIOS_DOUT_PinSet
00446e   f016
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DOUT_PinSet0 code MIOS_DOUT_PinSet0
                                           _MIOS_DOUT_PinSet0
                                           	global	_MIOS_DOUT_PinSet0
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DOUT_PinSet1 code MIOS_DOUT_PinSet1
                                           _MIOS_DOUT_PinSet1
                                           	global	_MIOS_DOUT_PinSet1
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DOUT_SRGet code MIOS_DOUT_SRGet
                                           _MIOS_DOUT_SRGet
                                           	global	_MIOS_DOUT_SRGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DOUT_SRSet code
                                           _MIOS_DOUT_SRSet
                                           	global	_MIOS_DOUT_SRSet
                                           	
004470   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004472   ffd9
004474   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
004476   f003
004478   ef68     goto	0x2cd0              	goto	MIOS_DOUT_SRSet
00447a   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_ENC_Abs7bitAdd code
                                           _MIOS_ENC_Abs7bitAdd
                                           	global	_MIOS_ENC_Abs7bitAdd
                                           	
00447c   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
00447e   ffd9
004480   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
004482   f003
004484   ef6a     goto	0x2cd4              	goto	MIOS_ENC_Abs7bitAdd
004486   f016
                                           	
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_ENC_Abs7bitGet code MIOS_ENC_Abs7bitGet
                                           _MIOS_ENC_Abs7bitGet
                                           	global	_MIOS_ENC_Abs7bitGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_ENC_Abs7bitSet code
                                           _MIOS_ENC_Abs7bitSet
                                           	global	_MIOS_ENC_Abs7bitSet
                                           
004488   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
00448a   ffd9
00448c   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
00448e   f003
004490   ef6e     goto	0x2cdc              	goto	MIOS_ENC_Abs7bitSet
004492   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_ENC_NumberGet code MIOS_ENC_NumberGet
                                           _MIOS_ENC_NumberGet
                                           	global	_MIOS_ENC_NumberGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_ENC_SpeedGet code
                                           _MIOS_ENC_SpeedGet
                                           	global	_MIOS_ENC_SpeedGet
                                           
004494   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004496   ffd9
004498   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
00449a   f003
00449c   ef72     goto	0x2ce4              	goto	MIOS_ENC_SpeedGet
00449e   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_ENC_SpeedSet code
                                           _MIOS_ENC_SpeedSet
                                           	global	_MIOS_ENC_SpeedSet
                                           
004396   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004398   ffd9
00439a   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
00439c   f003
00439e   cfdc     movff	0xfdc, 0x4          	movff	PREINC2, MIOS_PARAMETER2
0043a0   f004
0043a2   ef74     goto	0x2ce8              	goto	MIOS_ENC_SpeedSet
0043a4   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SRIO_NumberGet code MIOS_SRIO_NumberGet
                                           _MIOS_SRIO_NumberGet
                                           	global	_MIOS_SRIO_NumberGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SRIO_NumberSet code MIOS_SRIO_NumberSet
                                           _MIOS_SRIO_NumberSet
                                           	global	_MIOS_SRIO_NumberSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SRIO_TS_SensitivityGet code MIOS_SRIO_TS_SensitivityGet
                                           _MIOS_SRIO_TS_SensitivityGet
                                           	global	_MIOS_SRIO_TS_SensitivityGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SRIO_TS_SensitivitySet code MIOS_SRIO_TS_SensitivitySet
                                           _MIOS_SRIO_TS_SensitivitySet
                                           	global	_MIOS_SRIO_TS_SensitivitySet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SRIO_UpdateFrqGet code MIOS_SRIO_UpdateFrqGet
                                           _MIOS_SRIO_UpdateFrqGet
                                           	global	_MIOS_SRIO_UpdateFrqGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SRIO_UpdateFrqSet code MIOS_SRIO_UpdateFrqSet
                                           _MIOS_SRIO_UpdateFrqSet
                                           	global	_MIOS_SRIO_UpdateFrqSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SRIO_DebounceGet code MIOS_SRIO_DebounceGet
                                           _MIOS_SRIO_DebounceGet
                                           	global	_MIOS_SRIO_DebounceGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SRIO_DebounceSet code MIOS_SRIO_DebounceSet
                                           _MIOS_SRIO_DebounceSet
                                           	global	_MIOS_SRIO_DebounceSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_Clear code MIOS_LCD_Clear
                                           _MIOS_LCD_Clear
                                           	global	_MIOS_LCD_Clear
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_Cmd code MIOS_LCD_Cmd
                                           _MIOS_LCD_Cmd
                                           	global	_MIOS_LCD_Cmd
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_CursorGet code MIOS_LCD_CursorGet
                                           _MIOS_LCD_CursorGet
                                           	global	_MIOS_LCD_CursorGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_CursorSet code MIOS_LCD_CursorSet
                                           _MIOS_LCD_CursorSet
                                           	global	_MIOS_LCD_CursorSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_Data code MIOS_LCD_Data
                                           _MIOS_LCD_Data
                                           	global	_MIOS_LCD_Data
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_Init code MIOS_LCD_Init
                                           _MIOS_LCD_Init
                                           	global	_MIOS_LCD_Init
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintBCD1 code MIOS_LCD_PrintBCD1
                                           _MIOS_LCD_PrintBCD1
                                           	global	_MIOS_LCD_PrintBCD1
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintBCD2 code MIOS_LCD_PrintBCD2
                                           _MIOS_LCD_PrintBCD2
                                           	global	_MIOS_LCD_PrintBCD2
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintBCD3 code MIOS_LCD_PrintBCD3
                                           _MIOS_LCD_PrintBCD3
                                           	global	_MIOS_LCD_PrintBCD3
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintBCD4 code
                                           _MIOS_LCD_PrintBCD4
                                           	global	_MIOS_LCD_PrintBCD4
                                           
0044a0   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0044a2   ffd9
0044a4   cfdc     movff	0xfdc, 0x3         	movff	PREINC2, MIOS_PARAMETER1
0044a6   f003
0044a8   eff6     goto	0x2dec              	goto	MIOS_LCD_PrintBCD4
0044aa   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintBCD5 code
                                           _MIOS_LCD_PrintBCD5
                                           	global	_MIOS_LCD_PrintBCD5
                                           
0044ac   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0044ae   ffd9
0044b0   cfdc     movff	0xfdc, 0x3         	movff	PREINC2, MIOS_PARAMETER1
0044b2   f003
0044b4   eff8     goto	0x2df0              	goto	MIOS_LCD_PrintBCD5
0044b6   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintChar code MIOS_LCD_PrintChar
                                           _MIOS_LCD_PrintChar
                                           	global	_MIOS_LCD_PrintChar
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintHex1 code MIOS_LCD_PrintHex1
                                           _MIOS_LCD_PrintHex1
                                           	global	_MIOS_LCD_PrintHex1
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintHex2 code MIOS_LCD_PrintHex2
                                           _MIOS_LCD_PrintHex2
                                           	global	_MIOS_LCD_PrintHex2
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintMessage code
                                           _MIOS_LCD_PrintMessage
                                           	global	_MIOS_LCD_PrintMessage
                                           
00431a   6ef6     movwf	0xf6, 0            	movwf	TBLPTRL
00431c   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
00431e   ffd9
004320   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
004322   fff7
004324   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
004326   fff8
004328   ef9a     goto	0x2d34              	goto	MIOS_LCD_PrintMessage
00432a   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintPreconfString code
                                           _MIOS_LCD_PrintPreconfString
                                           	global	_MIOS_LCD_PrintPreconfString
                                           
0042cc   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0042ce   ffd9
0042d0   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
0042d2   fff8
0042d4   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
0042d6   fff7
0042d8   cfdc     movff	0xfdc, 0xff6       	movff	PREINC2, TBLPTRL
0042da   fff6
0042dc   ef9c     goto	0x2d38              	goto	MIOS_LCD_PrintPreconfString
0042de   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintString code
                                           _MIOS_LCD_PrintString
                                           	global	_MIOS_LCD_PrintString
                                           
00432c   6ef6     movwf	0xf6, 0            	movwf	TBLPTRL
00432e   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004330   ffd9
004332   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
004334   fff7
004336   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
004338   fff8
00433a   ef9e     goto	0x2d3c              	goto	MIOS_LCD_PrintString
00433c   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_TypeAutoSet code MIOS_LCD_TypeAutoSet
                                           _MIOS_LCD_TypeAutoSet
                                           	global	_MIOS_LCD_TypeAutoSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_TypeGet code MIOS_LCD_TypeGet
                                           _MIOS_LCD_TypeGet
                                           	global	_MIOS_LCD_TypeGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_TypeSet code
                                           _MIOS_LCD_TypeSet
                                           	global	_MIOS_LCD_TypeSet
                                           
0043a6   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0043a8   ffd9
0043aa   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
0043ac   f003
0043ae   cfdc     movff	0xfdc, 0x4          	movff	PREINC2, MIOS_PARAMETER2
0043b0   f004
0043b2   efa4     goto	0x2d48              	goto	MIOS_LCD_TypeSet
0043b4   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_YAddressGet code
                                           _MIOS_LCD_YAddressGet
                                           	global	_MIOS_LCD_YAddressGet
00450e   efa6     goto	0x2d4c              	goto	MIOS_LCD_YAddressGet
004510   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_YAddressSet code
                                           _MIOS_LCD_YAddressSet
                                           	global	_MIOS_LCD_YAddressSet
                                           
0042e0   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0042e2   ffd9
0042e4   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1
0042e6   cfdc     movff	0xfdc, 0x4          	movff	PREINC2, MIOS_PARAMETER2
0042e8   f004
0042ea   cfdc     movff	0xfdc, 0x5          	movff	PREINC2, MIOS_PARAMETER3
0042ec   f005
0042ee   50dc     movf	0xdc, 0, 0          	movf	PREINC2, W
0042f0   efa8     goto	0x2d50              	goto	MIOS_LCD_YAddressSet
0042f2   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_MessageStart code MIOS_LCD_MessageStart
                                           _MIOS_LCD_MessageStart
                                           	global	_MIOS_LCD_MessageStart
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_MessageStop code MIOS_LCD_MessageStop
                                           _MIOS_LCD_MessageStop
                                           	global	_MIOS_LCD_MessageStop
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_CLCD_SpecialCharInit code
                                           _MIOS_CLCD_SpecialCharInit
                                           	global	_MIOS_CLCD_SpecialCharInit
                                           
0042f4   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0042f6   ffd9
0042f8   cfdc     movff	0xfdc, 0xff6       	movff	PREINC2, TBLPTRL
0042fa   fff6
0042fc   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
0042fe   fff7
004300   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
004302   fff8
004304   efe4     goto	0x2dc8              	goto	MIOS_CLCD_SpecialCharInit
004306   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_CLCD_SpecialCharsInit code
                                           _MIOS_CLCD_SpecialCharsInit
                                           	global	_MIOS_CLCD_SpecialCharsInit
                                           
00433e   6ef6     movwf	0xf6, 0            	movwf	TBLPTRL
004340   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004342   ffd9
004344   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
004346   fff7
004348   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
00434a   fff8
00434c   efe6     goto	0x2dcc              	goto	MIOS_CLCD_SpecialCharsInit
00434e   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_GLCD_FontInit code
                                           _MIOS_GLCD_FontInit
                                           	global	_MIOS_GLCD_FontInit
                                           
004350   6ef6     movwf	0xf6, 0            	movwf	TBLPTRL
004352   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004354   ffd9
004356   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
004358   fff7
00435a   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
00435c   fff8
00435e   efaa     goto	0x2d54              	goto	MIOS_GLCD_FontInit
004360   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_GLCD_GCursorGet code MIOS_GLCD_GCursorGet
                                           _MIOS_GLCD_GCursorGet
                                           	global	_MIOS_GLCD_GCursorGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_GLCD_GCursorSet code
                                           _MIOS_GLCD_GCursorSet
                                           	global	_MIOS_GLCD_GCursorSet
                                           
0044b8   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0044ba   ffd9
0044bc   cfdc     movff	0xfdc, 0x3          	movff	PREINC2, MIOS_PARAMETER1
0044be   f003
0044c0   efae     goto	0x2d5c              	goto	MIOS_GLCD_GCursorSet
0044c2   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_EEPROM_Read code
                                           _MIOS_EEPROM_Read
                                           	global	_MIOS_EEPROM_Read
                                           
004508   6ea9     movwf	0xa9, 0            	movwf	EEADR
00450a   efb0     goto	0x2d60              	goto	MIOS_EEPROM_Read
00450c   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_EEPROM_Write code
                                           _MIOS_EEPROM_Write
                                           	global	_MIOS_EEPROM_Write
                                           
0044c4   6ea9     movwf	0xa9, 0            	movwf	EEADR
0044c6   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0044c8   ffd9
0044ca   50dc     movf	0xdc, 0, 0          	movf	PREINC2, W
0044cc   efb2     goto	0x2d64              	goto	MIOS_EEPROM_Write
0044ce   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_EEPROM_ReadPage code
                                           _MIOS_EEPROM_ReadPage
                                           	global	_MIOS_EEPROM_ReadPage
                                           
004362   6ea9     movwf	0xa9, 0            	movwf	EEADR
004364   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004366   ffd9
004368   cfdc     movff	0xfdc, 0xfe1       	movff	PREINC2, FSR1L
00436a   ffe1
00436c   cfdc     movff	0xfdc, 0xfe2       	movff	PREINC2, FSR1H
00436e   ffe2
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movlw	0x56
                                           	cpfseq	EEADR, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	FSR1L, ACCESS
                                           	return
                                           
                                           	movlw	0x03
                                           	cpfseq	FSR1H, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
004370   ef1a     goto	0x2e34              	goto	MIOS_EEPROM_ReadPage
004372   f017
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_EEPROM_WritePage code
                                           _MIOS_EEPROM_WritePage
                                           	global	_MIOS_EEPROM_WritePage
                                           
004374   6ea9     movwf	0xa9, 0            	movwf	EEADR
004376   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004378   ffd9
00437a   cfdc     movff	0xfdc, 0xfe1       	movff	PREINC2, FSR1L
00437c   ffe1
00437e   cfdc     movff	0xfdc, 0xfe2       	movff	PREINC2, FSR1H
004380   ffe2
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movlw	0x56
                                           	cpfseq	EEADR, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	FSR1L, ACCESS
                                           	return
                                           
                                           	movlw	0x03
                                           	cpfseq	FSR1H, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
004382   ef1c     goto	0x2e38              	goto	MIOS_EEPROM_WritePage
004384   f017
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_FLASH_Read code
                                           _MIOS_FLASH_Read
                                           	global	_MIOS_FLASH_Read
                                           
00422c   6ef6     movwf	0xf6, 0            	movwf	TBLPTRL
00422e   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004230   ffd9
004232   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
004234   fff7
004236   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
004238   fff8
00423a   cfdc     movff	0xfdc, 0xfe1       	movff	PREINC2, FSR1L
00423c   ffe1
00423e   cfdc     movff	0xfdc, 0xfe2       	movff	PREINC2, FSR1H
004240   ffe2
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movlw	0x56
                                           	cpfseq	TBLPTRL, ACCESS
                                           	return
                                           
                                           	movlw	0x78
                                           	cpfseq	TBLPTRH, ACCESS
                                           	return
                                           
                                           	movlw	0x00
                                           	cpfseq	TBLPTRU, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	FSR1L, ACCESS
                                           	return
                                           
                                           	movlw	0x03
                                           	cpfseq	FSR1H, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
004242   efb4     goto	0x2d68              	goto	MIOS_FLASH_Read
004244   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_FLASH_Write code
                                           _MIOS_FLASH_Write
                                           	global	_MIOS_FLASH_Write
                                           
004246   6ef6     movwf	0xf6, 0            	movwf	TBLPTRL
004248   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
00424a   ffd9
00424c   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
00424e   fff7
004250   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
004252   fff8
004254   cfdc     movff	0xfdc, 0xfe1       	movff	PREINC2, FSR1L
004256   ffe1
004258   cfdc     movff	0xfdc, 0xfe2       	movff	PREINC2, FSR1H
00425a   ffe2
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movlw	0x56
                                           	cpfseq	TBLPTRL, ACCESS
                                           	return
                                           
                                           	movlw	0x78
                                           	cpfseq	TBLPTRH, ACCESS
                                           	return
                                           
                                           	movlw	0x00
                                           	cpfseq	TBLPTRU, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	FSR1L, ACCESS
                                           	return
                                           
                                           	movlw	0x03
                                           	cpfseq	FSR1H, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
00425c   efb6     goto	0x2d6c              	goto	MIOS_FLASH_Write
00425e   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_BANKSTICK_Read code
                                           _MIOS_BANKSTICK_Read
                                           	global	_MIOS_BANKSTICK_Read
                                           
004448   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1
00444a   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
00444c   ffd9
00444e   cfdc     movff	0xfdc, 0x4         	movff	PREINC2, MIOS_PARAMETER2
004450   f004
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movlw	0x12
                                           	cpfseq	MIOS_PARAMETER1, ACCESS
                                           	return
                                           
                                           	movlw	0x34
                                           	cpfseq	MIOS_PARAMETER2, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
004452   efb8     goto	0x2d70              	goto	MIOS_BANKSTICK_Read
004454   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_BANKSTICK_Write code
                                           _MIOS_BANKSTICK_Write
                                           	global	_MIOS_BANKSTICK_Write
                                           
0043b6   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1
0043b8   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0043ba   ffd9
0043bc   cfdc     movff	0xfdc, 0x4         	movff	PREINC2, MIOS_PARAMETER2
0043be   f004
0043c0   50dc     movf	0xdc, 0, 0          	movf	PREINC2, W
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movwf	TMP1
                                           	movlw	0x56
                                           	cpfseq	TMP1, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	MIOS_PARAMETER1, ACCESS
                                           	return
                                           
                                           	movlw	0x34
                                           	cpfseq	MIOS_PARAMETER2, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
0043c2   efba     goto	0x2d74              	goto	MIOS_BANKSTICK_Write
0043c4   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_BANKSTICK_CtrlSet code MIOS_BANKSTICK_CtrlSet
                                           _MIOS_BANKSTICK_CtrlSet
                                           	global	_MIOS_BANKSTICK_CtrlSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_BANKSTICK_CtrlGet code MIOS_BANKSTICK_CtrlGet
                                           _MIOS_BANKSTICK_CtrlGet
                                           	global	_MIOS_BANKSTICK_CtrlGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_BANKSTICK_WritePage code
                                           _MIOS_BANKSTICK_WritePage
                                           	global	_MIOS_BANKSTICK_WritePage
                                           
00428c   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1
00428e   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004290   ffd9
004292   cfdc     movff	0xfdc, 0x4         	movff	PREINC2, MIOS_PARAMETER2
004294   f004
004296   cfdc     movff	0xfdc, 0xfe1       	movff	PREINC2, FSR1L
004298   ffe1
00429a   cfdc     movff	0xfdc, 0xfe2       	movff	PREINC2, FSR1H
00429c   ffe2
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movlw	0x56
                                           	cpfseq	MIOS_PARAMETER1, ACCESS
                                           	return
                                           
                                           	movlw	0x78
                                           	cpfseq	MIOS_PARAMETER2, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	FSR1L, ACCESS
                                           	return
                                           
                                           	movlw	0x03
                                           	cpfseq	FSR1H, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
00429e   eff2     goto	0x2de4              	goto	MIOS_BANKSTICK_WritePage
0042a0   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_BANKSTICK_ReadPage code
                                           _MIOS_BANKSTICK_ReadPage
                                           	global	_MIOS_BANKSTICK_ReadPage
                                           	
0042a2   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1
0042a4   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0042a6   ffd9
0042a8   cfdc     movff	0xfdc, 0x4         	movff	PREINC2, MIOS_PARAMETER2
0042aa   f004
0042ac   cfdc     movff	0xfdc, 0xfe1       	movff	PREINC2, FSR1L
0042ae   ffe1
0042b0   cfdc     movff	0xfdc, 0xfe2       	movff	PREINC2, FSR1H
0042b2   ffe2
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movlw	0x56
                                           	cpfseq	MIOS_PARAMETER1, ACCESS
                                           	return
                                           
                                           	movlw	0x78
                                           	cpfseq	MIOS_PARAMETER2, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	FSR1L, ACCESS
                                           	return
                                           
                                           	movlw	0x03
                                           	cpfseq	FSR1H, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
0042b4   ef18     goto	0x2e30              	goto	MIOS_BANKSTICK_ReadPage
0042b6   f017
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_TIMER_Init code
                                           _MIOS_TIMER_Init
                                           	global	_MIOS_TIMER_Init
                                           
0043c6   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0043c8   ffd9
0043ca   cfdc     movff	0xfdc, 0x3         	movff	PREINC2, MIOS_PARAMETER1
0043cc   f003
0043ce   cfdc     movff	0xfdc, 0x4         	movff	PREINC2, MIOS_PARAMETER2
0043d0   f004
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movwf	TMP1
                                           	movlw	0x56
                                           	cpfseq	TMP1, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	MIOS_PARAMETER1, ACCESS
                                           	return
                                           
                                           	movlw	0x34
                                           	cpfseq	MIOS_PARAMETER2, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
0043d2   efbc     goto	0x2d78              	goto	MIOS_TIMER_Init
0043d4   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_TIMER_Start code MIOS_TIMER_Start
                                           _MIOS_TIMER_Start
                                           	global	_MIOS_TIMER_Start
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_TIMER_Stop code MIOS_TIMER_Stop
                                           _MIOS_TIMER_Stop
                                           	global	_MIOS_TIMER_Stop
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_TIMER_ReInit code
                                           _MIOS_TIMER_ReInit
                                           	global	_MIOS_TIMER_ReInit
                                           
0043d6   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0043d8   ffd9
0043da   cfdc     movff	0xfdc, 0x3         	movff	PREINC2, MIOS_PARAMETER1
0043dc   f003
0043de   cfdc     movff	0xfdc, 0x4         	movff	PREINC2, MIOS_PARAMETER2
0043e0   f004
                                           
                                           #if PARAMETER_PASSING_TEST
                                           	movwf	TMP1
                                           	movlw	0x56
                                           	cpfseq	TMP1, ACCESS
                                           	return
                                           
                                           	movlw	0x12
                                           	cpfseq	MIOS_PARAMETER1, ACCESS
                                           	return
                                           
                                           	movlw	0x34
                                           	cpfseq	MIOS_PARAMETER2, ACCESS
                                           	return
                                           
                                           	movlw	0x1a
                                           	movwf	MIOS_PARAMETER1
                                           	return
                                           #endif
                                           
0043e2   ef1e     goto	0x2e3c              	goto	MIOS_TIMER_ReInit
0043e4   f017
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_HLP_GetBitANDMask code MIOS_HLP_GetBitANDMask
                                           _MIOS_HLP_GetBitANDMask
                                           	global	_MIOS_HLP_GetBitANDMask
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_HLP_GetBitORMask code MIOS_HLP_GetBitORMask
                                           _MIOS_HLP_GetBitORMask
                                           	global	_MIOS_HLP_GetBitORMask
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_HLP_16bitAddSaturate code
                                           _MIOS_HLP_16bitAddSaturate
                                           	global	_MIOS_HLP_16bitAddSaturate
                                           
0040fe   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
004100   ffd9
004102   6e0a     movwf	0xa, 0             	movwf	TMP5
                                           
004104   cfdc     movff	0xfdc, 0xfe1       	movff	PREINC2, FSR1L
004106   ffe1
004108   cfdc     movff	0xfdc, 0xfe2       	movff	PREINC2, FSR1H
00410a   ffe2
00410c   52dc     movf	0xdc, 0x1, 0        	movf	PREINC2, F
00410e   cfdc     movff	0xfdc, 0x3         	movff	PREINC2, MIOS_PARAMETER1
004110   f003
004112   cfdc     movff	0xfdc, 0x4         	movff	PREINC2, MIOS_PARAMETER2
004114   f004
                                           
004116   cfe6     movff	0xfe6, 0x6         	movff	POSTINC1, TMP1	; due to requirement that FSR1 is aligned to 16bit address
004118   f006
00411a   cfe6     movff	0xfe6, 0x7         	movff	POSTINC1, TMP2
00411c   f007
00411e   ee10     lfsr	0x1, 0x6            	lfsr	FSR1, TMP1
004120   f006
                                           
004122   500a     movf	0xa, 0, 0           	movf	TMP5, W
004124   ecdc     call	0x2db8, 0           	call	MIOS_HLP_16bitAddSaturate
004126   f016
004128   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
00412a   ffd9
00412c   cfdc     movff	0xfdc, 0xfe1       	movff	PREINC2, FSR1L
00412e   ffe1
004130   cfdc     movff	0xfdc, 0xfe2       	movff	PREINC2, FSR1H
004132   ffe2
004134   c006     movff	0x6, 0xfe6         	movff	TMP1, POSTINC1
004136   ffe6
004138   c007     movff	0x7, 0xfe6         	movff	TMP2, POSTINC1
00413a   ffe6
00413c   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_HLP_Dec2BCD code
                                           _MIOS_HLP_Dec2BCD
                                           	global	_MIOS_HLP_Dec2BCD
                                           
0044d0   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1
0044d2   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0044d4   ffd9
0044d6   50dc     movf	0xdc, 0, 0          	movf	PREINC2, W
0044d8   eff4     goto	0x2de8              	goto	MIOS_HLP_Dec2BCD
0044da   f016
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_Delay code MIOS_Delay
                                           _MIOS_Delay
                                           	global	_MIOS_Delay
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_GPCounterGet code MIOS_GPCounterGet
                                           _MIOS_GPCounterGet
                                           	global	_MIOS_GPCounterGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_Reset code MIOS_Reset
                                           _MIOS_Reset
                                           	global	_MIOS_Reset
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SystemResume code MIOS_SystemResume
                                           _MIOS_SystemResume
                                           	global	_MIOS_SystemResume
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_SystemSuspend code MIOS_SystemSuspend
                                           _MIOS_SystemSuspend
                                           	global	_MIOS_SystemSuspend
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_UserResume code MIOS_UserResume
                                           _MIOS_UserResume
                                           	global	_MIOS_UserResume
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_UserSuspend code MIOS_UserSuspend
                                           _MIOS_UserSuspend
                                           	global	_MIOS_UserSuspend
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DIN_PinAutoRepeatEnable code MIOS_DIN_PinAutoRepeatEnable
                                           _MIOS_DIN_PinAutoRepeatEnable
                                           	global	_MIOS_DIN_PinAutoRepeatEnable
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DIN_PinAutoRepeatDisable code MIOS_DIN_PinAutoRepeatDisable
                                           _MIOS_DIN_PinAutoRepeatDisable
                                           	global	_MIOS_DIN_PinAutoRepeatDisable
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_DIN_PinAutoRepeatGet code MIOS_DIN_PinAutoRepeatGet
                                           _MIOS_DIN_PinAutoRepeatGet
                                           	global	_MIOS_DIN_PinAutoRepeatGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_DynamicPrioSet code MIOS_AIN_DynamicPrioSet
                                           _MIOS_AIN_DynamicPrioSet
                                           	global	_MIOS_AIN_DynamicPrioSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_DynamicPrioGet code MIOS_AIN_DynamicPrioGet
                                           _MIOS_AIN_DynamicPrioGet
                                           	global	_MIOS_AIN_DynamicPrioGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_AIN_LastPinsGet code MIOS_AIN_LastPinsGet
                                           _MIOS_AIN_LastPinsGet
                                           	global	_MIOS_AIN_LastPinsGet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_IIC_Start code MIOS_IIC_Start
                                           _MIOS_IIC_Start
                                           	global	_MIOS_IIC_Start
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_IIC_Stop code MIOS_IIC_Stop
                                           _MIOS_IIC_Stop
                                           	global	_MIOS_IIC_Stop
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_IIC_ByteSend code MIOS_IIC_ByteSend
                                           _MIOS_IIC_ByteSend
                                           	global	_MIOS_IIC_ByteSend
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_IIC_ByteReceive code MIOS_IIC_ByteReceive
                                           _MIOS_IIC_ByteReceive
                                           	global	_MIOS_IIC_ByteReceive
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_IIC_AckSend code MIOS_IIC_AckSend
                                           _MIOS_IIC_AckSend
                                           	global	_MIOS_IIC_AckSend
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_IIC_NakSend code MIOS_IIC_NakSend
                                           _MIOS_IIC_NakSend
                                           	global	_MIOS_IIC_NakSend
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_IIC_CtrlSet code MIOS_IIC_CtrlSet
                                           _MIOS_IIC_CtrlSet
                                           	global	_MIOS_IIC_CtrlSet
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_IIC_CtrlGet code MIOS_IIC_CtrlGet
                                           _MIOS_IIC_CtrlGet
                                           	global	_MIOS_IIC_CtrlGet
                                           
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;; ==========================================================================
                                           ;;  Special functions supported by the wrapper
                                           ;; ==========================================================================
                                           ;; --------------------------------------------------------------------------
                                           
                                           ;; --------------------------------------------------------------------------
                                           .MIOS_LCD_PrintCString code
                                           _MIOS_LCD_PrintCString
                                           	global	_MIOS_LCD_PrintCString
                                           
0041f6   6ef6     movwf	0xf6, 0            	movwf	TBLPTRL
0041f8   cfe9     movff	0xfe9, 0xfd9       	movff	FSR0L, FSR2L
0041fa   ffd9
0041fc   cfdc     movff	0xfdc, 0xff7       	movff	PREINC2, TBLPTRH
0041fe   fff7
004200   cfdc     movff	0xfdc, 0xff8       	movff	PREINC2, TBLPTRU
004202   fff8
                                           _MIOS_LCD_PrintCStringLoop
004204   0009     tblrd	*+                 	tblrd*+
004206   50f5     movf	0xf5, 0, 0          	movf	TABLAT, W
004208   e003     bz	0x4210                	bz	_MIOS_LCD_PrintCString_End
00420a   ec94     call	0x2d28, 0           	call	MIOS_LCD_PrintChar
00420c   f016
00420e   d7fa     bra	0x4204               	bra	_MIOS_LCD_PrintCStringLoop
                                           _MIOS_LCD_PrintCString_End
004210   0012     return	0                 	return
                                           
                                           	END
                                           ;; BEGIN inserted by fixasm.pl
                                           ;; MPASM workarounds:
                                           BANKED  EQU 1
                                           ;; END inserted by fixasm.pl
                                           ;--------------------------------------------------------
                                           ; File Created by SDCC : FreeWare ANSI-C Compiler
                                           ; Version 2.5.0 #1020 (May  8 2005)
                                           ; This file generated Sat Feb 10 00:55:22 2007
                                           ;--------------------------------------------------------
                                           ; PIC16 port for the Microchip 16-bit core micros
                                           ;--------------------------------------------------------
                                           	list	p=18f452
                                           
                                           	radix dec
                                           
                                           ;--------------------------------------------------------
                                           ; public variables in this module
                                           ;--------------------------------------------------------
                                           	global _PORTAbits
                                           	global _PORTBbits
                                           	global _PORTCbits
                                           	global _PORTDbits
                                           	global _PORTEbits
                                           	global _LATAbits
                                           	global _LATBbits
                                           	global _LATCbits
                                           	global _LATDbits
                                           	global _LATEbits
                                           	global _TRISAbits
                                           	global _TRISBbits
                                           	global _TRISCbits
                                           	global _TRISDbits
                                           	global _TRISEbits
                                           	global _PIE1bits
                                           	global _PIR1bits
                                           	global _IPR1bits
                                           	global _PIE2bits
                                           	global _PIR2bits
                                           	global _IPR2bits
                                           	global _EECON1bits
                                           	global _RCSTAbits
                                           	global _TXSTAbits
                                           	global _T3CONbits
                                           	global _CCP2CONbits
                                           	global _CCP1CONbits
                                           	global _ADCON1bits
                                           	global _ADCON0bits
                                           	global _SSPCON2bits
                                           	global _SSPCON1bits
                                           	global _SSPSTATbits
                                           	global _T2CONbits
                                           	global _T1CONbits
                                           	global _RCONbits
                                           	global _WDTCONbits
                                           	global _LVDCONbits
                                           	global _OSCCONbits
                                           	global _T0CONbits
                                           	global _STATUSbits
                                           	global _INTCON3bits
                                           	global _INTCON2bits
                                           	global _INTCONbits
                                           	global _STKPTRbits
                                           	global _PORTA
                                           	global _PORTB
                                           	global _PORTC
                                           	global _PORTD
                                           	global _PORTE
                                           	global _LATA
                                           	global _LATB
                                           	global _LATC
                                           	global _LATD
                                           	global _LATE
                                           	global _TRISA
                                           	global _TRISB
                                           	global _TRISC
                                           	global _TRISD
                                           	global _TRISE
                                           	global _PIE1
                                           	global _PIR1
                                           	global _IPR1
                                           	global _PIE2
                                           	global _PIR2
                                           	global _IPR2
                                           	global _EECON1
                                           	global _EECON2
                                           	global _EEDATA
                                           	global _EEADR
                                           	global _RCSTA
                                           	global _TXSTA
                                           	global _TXREG
                                           	global _RCREG
                                           	global _SPBRG
                                           	global _T3CON
                                           	global _TMR3L
                                           	global _TMR3H
                                           	global _CCP2CON
                                           	global _CCPR2L
                                           	global _CCPR2H
                                           	global _CCP1CON
                                           	global _CCPR1L
                                           	global _CCPR1H
                                           	global _ADCON1
                                           	global _ADCON0
                                           	global _ADRESL
                                           	global _ADRESH
                                           	global _SSPCON2
                                           	global _SSPCON1
                                           	global _SSPSTAT
                                           	global _SSPADD
                                           	global _SSPBUF
                                           	global _T2CON
                                           	global _PR2
                                           	global _TMR2
                                           	global _T1CON
                                           	global _TMR1L
                                           	global _TMR1H
                                           	global _RCON
                                           	global _WDTCON
                                           	global _LVDCON
                                           	global _OSCCON
                                           	global _T0CON
                                           	global _TMR0L
                                           	global _TMR0H
                                           	global _STATUS
                                           	global _FSR2L
                                           	global _FSR2H
                                           	global _PLUSW2
                                           	global _PREINC2
                                           	global _POSTDEC2
                                           	global _POSTINC2
                                           	global _INDF2
                                           	global _BSR
                                           	global _FSR1L
                                           	global _FSR1H
                                           	global _PLUSW1
                                           	global _PREINC1
                                           	global _POSTDEC1
                                           	global _POSTINC1
                                           	global _INDF1
                                           	global _WREG
                                           	global _FSR0L
                                           	global _FSR0H
                                           	global _PLUSW0
                                           	global _PREINC0
                                           	global _POSTDEC0
                                           	global _POSTINC0
                                           	global _INDF0
                                           	global _INTCON3
                                           	global _INTCON2
                                           	global _INTCON
                                           	global _PRODL
                                           	global _PRODH
                                           	global _TABLAT
                                           	global _TBLPTRL
                                           	global _TBLPTRH
                                           	global _TBLPTRU
                                           	global _PCL
                                           	global _PCLATH
                                           	global _PCLATU
                                           	global _STKPTR
                                           	global _TOSL
                                           	global _TOSH
                                           	global _TOSU
                                           
                                           
                                           ustat_pic18f452_00	udata	0X0F80
                                           
                                           _PORTA	res	0
                                           _PORTAbits	res	1
                                           
                                           _PORTB	res	0
                                           _PORTBbits	res	1
                                           
                                           _PORTC	res	0
                                           _PORTCbits	res	1
                                           
                                           _PORTD	res	0
                                           _PORTDbits	res	1
                                           
                                           _PORTE	res	0
                                           _PORTEbits	res	1
                                           
                                           
                                           ustat_pic18f452_01	udata	0X0F89
                                           
                                           _LATA	res	0
                                           _LATAbits	res	1
                                           
                                           _LATB	res	0
                                           _LATBbits	res	1
                                           
                                           _LATC	res	0
                                           _LATCbits	res	1
                                           
                                           _LATD	res	0
                                           _LATDbits	res	1
                                           
                                           _LATE	res	0
                                           _LATEbits	res	1
                                           
                                           
                                           ustat_pic18f452_02	udata	0X0F92
                                           
                                           _TRISA	res	0
                                           _TRISAbits	res	1
                                           
                                           _TRISB	res	0
                                           _TRISBbits	res	1
                                           
                                           _TRISC	res	0
                                           _TRISCbits	res	1
                                           
                                           _TRISD	res	0
                                           _TRISDbits	res	1
                                           
                                           _TRISE	res	0
                                           _TRISEbits	res	1
                                           
                                           
                                           ustat_pic18f452_03	udata	0X0F9D
                                           
                                           _PIE1	res	0
                                           _PIE1bits	res	1
                                           
                                           _PIR1	res	0
                                           _PIR1bits	res	1
                                           
                                           _IPR1	res	0
                                           _IPR1bits	res	1
                                           
                                           _PIE2	res	0
                                           _PIE2bits	res	1
                                           
                                           _PIR2	res	0
                                           _PIR2bits	res	1
                                           
                                           _IPR2	res	0
                                           _IPR2bits	res	1
                                           
                                           
                                           ustat_pic18f452_04	udata	0X0FA6
                                           
                                           _EECON1	res	0
                                           _EECON1bits	res	1
                                           _EECON2	res	1
                                           _EEDATA	res	1
                                           _EEADR	res	1
                                           
                                           
                                           ustat_pic18f452_05	udata	0X0FAB
                                           
                                           _RCSTA	res	0
                                           _RCSTAbits	res	1
                                           
                                           _TXSTA	res	0
                                           _TXSTAbits	res	1
                                           _TXREG	res	1
                                           _RCREG	res	1
                                           _SPBRG	res	1
                                           
                                           
                                           ustat_pic18f452_06	udata	0X0FB1
                                           
                                           _T3CON	res	0
                                           _T3CONbits	res	1
                                           _TMR3L	res	1
                                           _TMR3H	res	1
                                           
                                           
                                           ustat_pic18f452_07	udata	0X0FBA
                                           
                                           _CCP2CON	res	0
                                           _CCP2CONbits	res	1
                                           _CCPR2L	res	1
                                           _CCPR2H	res	1
                                           
                                           _CCP1CON	res	0
                                           _CCP1CONbits	res	1
                                           _CCPR1L	res	1
                                           _CCPR1H	res	1
                                           
                                           
                                           ustat_pic18f452_08	udata	0X0FC1
                                           
                                           _ADCON1	res	0
                                           _ADCON1bits	res	1
                                           
                                           _ADCON0	res	0
                                           _ADCON0bits	res	1
                                           _ADRESL	res	1
                                           _ADRESH	res	1
                                           
                                           _SSPCON2	res	0
                                           _SSPCON2bits	res	1
                                           
                                           _SSPCON1	res	0
                                           _SSPCON1bits	res	1
                                           
                                           _SSPSTAT	res	0
                                           _SSPSTATbits	res	1
                                           _SSPADD	res	1
                                           _SSPBUF	res	1
                                           
                                           _T2CON	res	0
                                           _T2CONbits	res	1
                                           _PR2	res	1
                                           _TMR2	res	1
                                           
                                           _T1CON	res	0
                                           _T1CONbits	res	1
                                           _TMR1L	res	1
                                           _TMR1H	res	1
                                           
                                           _RCON	res	0
                                           _RCONbits	res	1
                                           
                                           _WDTCON	res	0
                                           _WDTCONbits	res	1
                                           
                                           _LVDCON	res	0
                                           _LVDCONbits	res	1
                                           
                                           _OSCCON	res	0
                                           _OSCCONbits	res	1
                                           
                                           
                                           ustat_pic18f452_09	udata	0X0FD5
                                           
                                           _T0CON	res	0
                                           _T0CONbits	res	1
                                           _TMR0L	res	1
                                           _TMR0H	res	1
                                           
                                           _STATUS	res	0
                                           _STATUSbits	res	1
                                           _FSR2L	res	1
                                           _FSR2H	res	1
                                           _PLUSW2	res	1
                                           _PREINC2	res	1
                                           _POSTDEC2	res	1
                                           _POSTINC2	res	1
                                           _INDF2	res	1
                                           _BSR	res	1
                                           _FSR0L	res	1
                                           _FSR0H	res	1
                                           _PLUSW0	res	1
                                           _PREINC0	res	1
                                           _POSTDEC0	res	1
                                           _POSTINC0	res	1
                                           _INDF0	res	1
                                           _WREG	res	1
                                           _FSR1L	res	1
                                           _FSR1H	res	1
                                           _PLUSW1	res	1
                                           _PREINC1	res	1
                                           _POSTDEC1	res	1
                                           _POSTINC1	res	1
                                           _INDF1	res	1
                                           
                                           _INTCON3	res	0
                                           _INTCON3bits	res	1
                                           
                                           _INTCON2	res	0
                                           _INTCON2bits	res	1
                                           
                                           _INTCON	res	0
                                           _INTCONbits	res	1
                                           _PRODL	res	1
                                           _PRODH	res	1
                                           _TABLAT	res	1
                                           _TBLPTRL	res	1
                                           _TBLPTRH	res	1
                                           _TBLPTRU	res	1
                                           _PCL	res	1
                                           _PCLATH	res	1
                                           _PCLATU	res	1
                                           
                                           _STKPTR	res	0
                                           _STKPTRbits	res	1
                                           _TOSL	res	1
                                           _TOSH	res	1
                                           _TOSU	res	1
                                           
                                           ;--------------------------------------------------------
                                           ; global & static initialisations
                                           ;--------------------------------------------------------
                                           ; I code from now on!
                                           
                                           
                                           ; Statistics:
                                           ; code size:	   -1 (0xffffffff) bytes (3276800.00%)
                                           ;           	2147483647 (0x7fffffff) words
                                           ; udata size:	  101 (0x0065) bytes (7.89%)
                                           ; access size:	    0 (0x0000) bytes
                                           
                                           
                                           	end
                                           ;
                                           ; Scan Matrix Driver, simple version
                                           ; 
                                           ; This driver demonstrates how to scan a matrix of up to 8x8 buttons/keys
                                           ; by using one DOUT and one DIN shift register
                                           ; 
                                           ; This include file provides following functions:
                                           ;
                                           ;    o SM_Init:         initializes the scan matrix
                                           ;                       should be called from USER_Init
                                           ;
                                           ;    o SM_PrepareCol:   prepares the DOUT register to drive a column
                                           ;                       should be called from USER_SR_Service_Prepare
                                           ;
                                           ;    o SM_GetRow:       gets the DIN values of the selected column
                                           ;                       should be called from USER_SR_Service_Finish
                                           ;
                                           ;    o SM_ButtonHandler: to be called from USER_Tick
                                           ;
                                           ;
                                           ;    Following function is located in main.c:
                                           ;    o SM_NotifyToggle: called from SM_ButtonHandler on button changes
                                           ;
                                           ;
                                           ; Define the shift register which drives the column here
                                           ; we are counting from zero! The first DOUT register is 0x00, the second 0x01, etc...
                                           #define SM_COLUMN_DOUT	0x00
                                           ;
                                           ; Define the shift register which gets the row values here
                                           ; we are counting from zero! The first DIN register is 0x00, the second 0x01, etc...
                                           #define SM_ROW_DIN	0x00
                                           ;
                                           ; set this constant to 1 if the colums/rows are swapped (means: the cathodes and
                                           ; not the anodes of the diodes are connected together)
                                           #define SM_SWAP_CR	0
                                           ;
                                           ; ==========================================================================
                                           ;
                                           ;  Copyright 2006 Thorsten Klose (tk@midibox.org)
                                           ;  Licensed for personal non-commercial use only.
                                           ;  All other rights reserved.
                                           ; 
                                           ; ==========================================================================
                                           
                                           	list	p=18f452
                                           	radix	dec
                                           #include "mios_wrapper/mios.h"
                                           ;
                                           ; MIOS Definitions file
                                           ;
                                           ; ==========================================================================
                                           ;
                                           ;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
                                           ;  Licensed for personal non-commercial use only.
                                           ;  All other rights reserved.
                                           ; 
                                           ; ==========================================================================
                                           
                                            
                                           ;; ==========================================================================
                                           ;;  Select the device here
                                           ;;     0: PIC18F452   (writable range: 0x0400-0x7fff)
                                           ;;     1: PIC18F4620  (writable range: 0x0400-0xffff)
                                           ;;     2: PIC18F4520  (writable range: 0x0400-0x7fff)
                                           ;; ==========================================================================
                                           
                                           #define PIC_DERIVATIVE_TYPE	0
                                           
                                           ;; ==========================================================================
                                           ;;  Assembler directives & device specific include file
                                           ;; ==========================================================================
                                           
                                           #if PIC_DERIVATIVE_TYPE == 0
                                           	LIST P=PIC18F452, R=DEC
                                           #include <p18f452.inc>
                                                   LIST
                                           ; P18F452.INC  Standard Header File, Version 1.4   Microchip Technology, Inc.
                                                   NOLIST
                                           #endif
                                           
                                           #if PIC_DERIVATIVE_TYPE == 1
                                           	LIST P=PIC18F4620, R=DEC
                                           #include <p18f4620.inc>
                                           #endif
                                           	
                                           #if PIC_DERIVATIVE_TYPE == 2
                                           	LIST P=PIC18F4520, R=DEC
                                           #include <p18f4520.inc>
                                           #endif
                                           
                                           ;; ==========================================================================
                                           ;;  General constants
                                           ;; ==========================================================================
                                           
                                           ;; used by MIOS_MIDI_Interface*
                                           MIOS_MIDI_INTERFACE_COMMON	EQU	0x00
                                           MIOS_MIDI_INTERFACE_TO_HOST	EQU	0x01
                                           
                                           ;; used by MIOS_MIDI_Merger*
                                           MIOS_MIDI_MERGER_DISABLED	EQU	0x00
                                           MIOS_MIDI_MERGER_ENABLED	EQU	0x01
                                           MIOS_MIDI_MERGER_MBLINK_EP	EQU	0x02
                                           MIOS_MIDI_MERGER_MBLINK_FP	EQU	0x03
                                           
                                           ;; used by MIOS_ENC_PIN_TABLE
                                           MIOS_ENC_MODE_NON_DETENTED	EQU	0x00
                                           MIOS_ENC_MODE_DETENTED		EQU	0x80
                                           MIOS_ENC_MODE_DETENTED2		EQU	0x81
                                           
                                           ;; used by MIOS_ENC_Speed*
                                           MIOS_ENC_SPEED_SLOW		EQU	0
                                           MIOS_ENC_SPEED_NORMAL		EQU	1
                                           MIOS_ENC_SPEED_FAST		EQU	2
                                           
                                           ;; used by MIOS_LCD_Type*
                                           MIOS_LCD_TYPE_CLCD		EQU	0x00
                                           MIOS_LCD_TYPE_GLCD0		EQU	0x01
                                           MIOS_LCD_TYPE_GLCD1		EQU	0x02
                                           MIOS_LCD_TYPE_GLCD2		EQU	0x03
                                           MIOS_LCD_TYPE_GLCD3		EQU	0x04
                                           MIOS_LCD_TYPE_GLCD4		EQU	0x05
                                           MIOS_LCD_TYPE_MLCD		EQU	0x06
                                           MIOS_LCD_TYPE_GLCD_CUSTOM	EQU	0x07
                                           
                                           ;; location of default 5x8 font for graphical displays
                                           MIOS_GLCD_FONT			EQU	0x7cfc
                                           
                                           ;; general config flags (never overwrite this flags directly!!!)
                                           MIOS_BOX_CFG0_LCD_TYPE0		EQU 0	; selects LCD type, bit 0
                                           MIOS_BOX_CFG0_LCD_TYPE1		EQU 1	; selects LCD type, bit 1
                                           MIOS_BOX_CFG0_LCD_TYPE2		EQU 2	; selects LCD type, bit 2
                                           MIOS_BOX_CFG0_USE_GLCD		EQU 3	; if 1, graphical LCD is connected
                                           MIOS_BOX_CFG0_MERGER		EQU 4	; if 1, MIDI merger is enabled
                                           MIOS_BOX_CFG0_MBLINK		EQU 5	; if 1, MIDIbox Link is enabled
                                           MIOS_BOX_CFG0_TO_HOST		EQU 6	; if 1, MIDI interface will run with 38400 baud instead of 31250
                                           MIOS_BOX_CFG0_20MHz		EQU 7	; if 1, it is assumed that box is running with 20 MHz, else with 40 MHz
                                           
                                           MIOS_BOX_CFG1_BS_A0		EQU 0	; A0 of BankStick (never change the bit position)
                                           MIOS_BOX_CFG1_BS_A1		EQU 1	; A1 of BankStick (never change the bit position)
                                           MIOS_BOX_CFG1_BS_A2		EQU 2	; A2 of BankStick (never change the bit position)
                                           MIOS_BOX_CFG1_BS_DIS_VERIFY	EQU 3	; if 1, writes to the BankStick will not be verified
                                           MIOS_BOX_CFG1_IIC_STRETCH_CLK	EQU 4	; if 1, IIC clock stretching enabled
                                           
                                           ;; general status flags (never overwrite this flags directly!!!)
                                           MIOS_BOX_STAT_BS_AVAILABLE	EQU 0	; if 1, BankStick is available
                                           MIOS_BOX_STAT_MBLINK_TUNNEL_PASS EQU 1  ; if 1, a MBLinked event will be tunnled
                                           MIOS_BOX_STAT_SUSPEND_ALL       EQU 2   ; if 1, all system and user tasks are suspended
                                           MIOS_BOX_STAT_SUSPEND_USER      EQU 3   ; if 1, all user tasks are suspended
                                           MIOS_BOX_STAT_AUTOREPEAT	EQU 4	; if 1, start the auto-repeat handler
                                           MIOS_BOX_STAT_MLCD_TRANSFER	EQU 5	; if 1, a transfer to the MLCD has been started
                                           MIOS_BOX_STAT_FERR		EQU 6	; if 1, a frame error happened during MIDI receive
                                           
                                           ;; ==========================================================================
                                           ;;  MIOS Special Function Registers
                                           ;; ==========================================================================
                                           
                                           MIOS_BOX_CFG0	EQU	0x000
                                           MIOS_BOX_CFG1	EQU	0x001
                                           MIOS_BOX_STAT	EQU	0x002
                                           MIOS_PARAMETER1	EQU	0x003
                                           MIOS_PARAMETER2	EQU	0x004
                                           MIOS_PARAMETER3	EQU	0x005
                                           
                                           ;; ==========================================================================
                                           ;;  temporary registers for main programs
                                           ;; ==========================================================================
                                           TMP1		EQU	0x006
                                           TMP2		EQU	0x007
                                           TMP3		EQU	0x008
                                           TMP4		EQU	0x009
                                           TMP5		EQU	0x00a
                                           
                                           ;; ==========================================================================
                                           ;;  temporary registers for IRQs
                                           ;; ==========================================================================
                                           IRQ_TMP1	EQU	0x00b
                                           IRQ_TMP2	EQU	0x00c
                                           IRQ_TMP3	EQU	0x00d
                                           IRQ_TMP4	EQU	0x00e
                                           IRQ_TMP5	EQU	0x00f
                                           
                                           ;; ==========================================================================
                                           ;;  free memory space for user application:
                                           ;; ==========================================================================
                                           	;; 0x010-0x37f
                                           
                                           ;; ==========================================================================
                                           ;;  MIOS System Registers -- not defined here -- 
                                           ;;  never use these memory locations!
                                           ;; ==========================================================================
                                           	;; 0x380-0x6ff
                                           
                                           ;; ==========================================================================
                                           ;;  MIOS System Registers for custom LCD driver
                                           ;; ==========================================================================
                                           MIOS_GLCD_BUFFER	EQU	0x570	; note: the buffer must be located at ...0-...7
                                           MIOS_LCD_OPTION1	EQU	0x578	; contains the first LCD option given by MIOS_LCD_TypeSet
                                           MIOS_LCD_OPTION2	EQU	0x579	; contains the second LCD option given by MIOS_LCD_TypeSet
                                           MIOS_LCD_CURSOR_POS	EQU	0x57a	; the current cursor pos of characters (GLCD: multiplied by width)
                                           MIOS_GLCD_GCURSOR_X	EQU	0x57b	; for GLCDs: the current X position of graphical cursor
                                           MIOS_GLCD_GCURSOR_Y	EQU	0x57c	; for GLCDs: the current Y position of graphical cursor
                                           MIOS_GLCD_FONT_WIDTH	EQU	0x57d	; for GLCDs: the fontwidth given by MIOS_GLCD_FontInit
                                           MIOS_GLCD_FONT_HEIGHT	EQU	0x57e	; for GLCDs: the fontheight given by MIOS_GLCD_FontInit
                                           MIOS_GLCD_FONT_X0	EQU	0x57f	; for GLCDs: the first byte within a char entry
                                           MIOS_GLCD_FONT_OFFSET	EQU	0x580	; for GLCDs: the byte offset between the characters
                                           MIOS_GLCD_FONT_PTRL	EQU	0x581	; for GLCDs: pointer to the character table, low-byte
                                           MIOS_GLCD_FONT_PTRH	EQU	0x582	; for GLCDs: pointer to the character table, high-byte
                                           MIOS_LCD_TIMEOUT0	EQU	0x583   ; can be used for timeout loops
                                           MIOS_LCD_TIMEOUT1	EQU	0x584   ; can be used for timeout loops
                                           MIOS_GLCD_TMP1		EQU	0x585   ; can be used as temporary buffer
                                           MIOS_GLCD_TMP2		EQU	0x586   ; can be used as temporary buffer
                                           MIOS_GLCD_TMP3		EQU	0x587   ; can be used as temporary buffer
                                           MIOS_GLCD_TMP4		EQU	0x588   ; can be used as temporary buffer
                                           MIOS_LCD_Y0_OFFSET	EQU	0x589   ; Y0 offset of LCD
                                           MIOS_LCD_Y1_OFFSET	EQU	0x58a   ; Y1 offset of LCD
                                           MIOS_LCD_Y2_OFFSET	EQU	0x58b   ; Y2 offset of LCD
                                           MIOS_LCD_Y3_OFFSET	EQU	0x58c   ; Y3 offset of LCD
                                           MIOS_LCD_CURSOR_POS_REAL EQU	0x58d	; unmapped cursor position which has been set with MIOS_LCD_CursorSet
                                           #include "mios_wrapper/mios_vectors.inc"
                                           MIOS_MIDI_BeginStream                   EQU	0x2c00
                                           MIOS_MIDI_DeviceIDAutoSet               EQU	0x2c04
                                           MIOS_MIDI_DeviceIDGet                   EQU	0x2c08
                                           MIOS_MIDI_DeviceIDSet                   EQU	0x2c0c
                                           MIOS_MIDI_EndStream                     EQU	0x2c10
                                           MIOS_MIDI_Init                          EQU	0x2c14
                                           MIOS_MIDI_InterfaceAutoSet              EQU	0x2c18
                                           MIOS_MIDI_InterfaceGet                  EQU	0x2c1c
                                           MIOS_MIDI_InterfaceSet                  EQU	0x2c20
                                           MIOS_MIDI_MergerGet                     EQU	0x2c24
                                           MIOS_MIDI_MergerSet                     EQU	0x2c28
                                           MIOS_MIDI_RxBufferFree                  EQU	0x2c2c
                                           MIOS_MIDI_RxBufferGet                   EQU	0x2c30
                                           MIOS_MIDI_RxBufferPut                   EQU	0x2c34
                                           MIOS_MIDI_RxBufferUsed                  EQU	0x2c38
                                           MIOS_MIDI_TxBufferFlush                 EQU	0x2c3c
                                           MIOS_MIDI_TxBufferFree                  EQU	0x2c40
                                           MIOS_MIDI_TxBufferGet                   EQU	0x2c44
                                           MIOS_MIDI_TxBufferPut                   EQU	0x2c48
                                           MIOS_MIDI_TxBufferUsed                  EQU	0x2c4c
                                           MIOS_MPROC_MergerDisable                EQU	0x2c50
                                           MIOS_MPROC_MergerEnable                 EQU	0x2c54
                                           MIOS_MPROC_MergerGet                    EQU	0x2c58
                                           MIOS_AIN_DeadbandGet                    EQU	0x2c5c
                                           MIOS_AIN_DeadbandSet                    EQU	0x2c60
                                           MIOS_AIN_Muxed                          EQU	0x2c64
                                           MIOS_AIN_NumberGet                      EQU	0x2c68
                                           MIOS_AIN_NumberSet                      EQU	0x2c6c
                                           MIOS_AIN_Pin7bitGet                     EQU	0x2c70
                                           MIOS_AIN_PinGet                         EQU	0x2c74
                                           MIOS_AIN_PinLSBGet                      EQU	0x2c78
                                           MIOS_AIN_PinMSBGet                      EQU	0x2c7c
                                           MIOS_AIN_UnMuxed                        EQU	0x2c80
                                           MIOS_MF_PWM_DutyCycleDownGet            EQU	0x2c84
                                           MIOS_MF_PWM_DutyCycleDownSet            EQU	0x2c88
                                           MIOS_MF_PWM_DutyCycleUpGet              EQU	0x2c8c
                                           MIOS_MF_PWM_DutyCycleUpSet              EQU	0x2c90
                                           MIOS_MF_DeadbandGet                     EQU	0x2c94
                                           MIOS_MF_DeadbandSet                     EQU	0x2c98
                                           MIOS_MF_Disable                         EQU	0x2c9c
                                           MIOS_MF_Enable                          EQU	0x2ca0
                                           MIOS_MF_FaderMove                       EQU	0x2ca4
                                           MIOS_MF_SuspendDisable                  EQU	0x2ca8
                                           MIOS_MF_SuspendEnable                   EQU	0x2cac
                                           MIOS_MF_SuspendGet                      EQU	0x2cb0
                                           MIOS_DIN_PinGet                         EQU	0x2cb4
                                           MIOS_DIN_SRGet                          EQU	0x2cb8
                                           MIOS_DOUT_PinGet                        EQU	0x2cbc
                                           MIOS_DOUT_PinSet                        EQU	0x2cc0
                                           MIOS_DOUT_PinSet0                       EQU	0x2cc4
                                           MIOS_DOUT_PinSet1                       EQU	0x2cc8
                                           MIOS_DOUT_SRGet                         EQU	0x2ccc
                                           MIOS_DOUT_SRSet                         EQU	0x2cd0
                                           MIOS_ENC_Abs7bitAdd                     EQU	0x2cd4
                                           MIOS_ENC_Abs7bitGet                     EQU	0x2cd8
                                           MIOS_ENC_Abs7bitSet                     EQU	0x2cdc
                                           MIOS_ENC_NumberGet                      EQU	0x2ce0
                                           MIOS_ENC_SpeedGet                       EQU	0x2ce4
                                           MIOS_ENC_SpeedSet                       EQU	0x2ce8
                                           MIOS_SRIO_NumberGet                     EQU	0x2cec
                                           MIOS_SRIO_NumberSet                     EQU	0x2cf0
                                           MIOS_SRIO_TS_SensitivityGet             EQU	0x2cf4
                                           MIOS_SRIO_TS_SensitivitySet             EQU	0x2cf8
                                           MIOS_SRIO_UpdateFrqGet                  EQU	0x2cfc
                                           MIOS_SRIO_UpdateFrqSet                  EQU	0x2d00
                                           MIOS_LCD_Clear                          EQU	0x2d04
                                           MIOS_LCD_Cmd                            EQU	0x2d08
                                           MIOS_LCD_CursorGet                      EQU	0x2d0c
                                           MIOS_LCD_CursorSet                      EQU	0x2d10
                                           MIOS_LCD_Data                           EQU	0x2d14
                                           MIOS_LCD_Init                           EQU	0x2d18
                                           MIOS_LCD_PrintBCD1	                EQU	0x2d1c
                                           MIOS_LCD_PrintBCD2                      EQU	0x2d20
                                           MIOS_LCD_PrintBCD3                      EQU	0x2d24
                                           MIOS_LCD_PrintChar	                EQU	0x2d28
                                           MIOS_LCD_PrintHex1	                EQU	0x2d2c
                                           MIOS_LCD_PrintHex2                      EQU	0x2d30
                                           MIOS_LCD_PrintMessage                   EQU	0x2d34
                                           MIOS_LCD_PrintPreconfString             EQU	0x2d38
                                           MIOS_LCD_PrintString                    EQU	0x2d3c
                                           MIOS_LCD_TypeAutoSet                    EQU	0x2d40
                                           MIOS_LCD_TypeGet                        EQU	0x2d44
                                           MIOS_LCD_TypeSet                        EQU	0x2d48
                                           MIOS_LCD_YAddressGet                    EQU	0x2d4c
                                           MIOS_LCD_YAddressSet                    EQU	0x2d50
                                           MIOS_GLCD_FontInit                      EQU	0x2d54
                                           MIOS_GLCD_GCursorGet                    EQU	0x2d58
                                           MIOS_GLCD_GCursorSet                    EQU	0x2d5c
                                           MIOS_EEPROM_Read                        EQU	0x2d60
                                           MIOS_EEPROM_Write                       EQU	0x2d64
                                           MIOS_FLASH_Read                         EQU	0x2d68
                                           MIOS_FLASH_Write                        EQU	0x2d6c
                                           MIOS_BANKSTICK_Read                     EQU	0x2d70
                                           MIOS_BANKSTICK_Write                    EQU	0x2d74
                                           MIOS_TIMER_Init                         EQU	0x2d78
                                           MIOS_TIMER_Start                        EQU	0x2d7c
                                           MIOS_TIMER_Stop                         EQU	0x2d80
                                           MIOS_HLP_AddressFromTable               EQU	0x2d84
                                           MIOS_HLP_GetBitANDMask                  EQU	0x2d88
                                           MIOS_HLP_GetBitORMask                   EQU	0x2d8c
                                           MIOS_HLP_GetIndex_2bytes                EQU	0x2d90
                                           MIOS_HLP_GetIndex_4bytes                EQU	0x2d94
                                           MIOS_HLP_IndirectJump                   EQU	0x2d98
                                           MIOS_Delay                              EQU	0x2d9c
                                           MIOS_GPCounterGet                       EQU	0x2da0
                                           MIOS_Reset                              EQU	0x2da4
                                           MIOS_SystemResume                       EQU	0x2da8
                                           MIOS_SystemSuspend                      EQU	0x2dac
                                           MIOS_UserResume                         EQU	0x2db0
                                           MIOS_UserSuspend                        EQU	0x2db4
                                           MIOS_HLP_16bitAddSaturate		EQU	0x2db8
                                           MIOS_DIN_PinAutoRepeatEnable		EQU	0x2dbc
                                           MIOS_DIN_PinAutoRepeatDisable		EQU	0x2dc0
                                           MIOS_DIN_PinAutoRepeatGet		EQU	0x2dc4
                                           MIOS_CLCD_SpecialCharInit		EQU	0x2dc8
                                           MIOS_CLCD_SpecialCharsInit		EQU	0x2dcc
                                           MIOS_AIN_DynamicPrioSet			EQU	0x2dd0
                                           MIOS_AIN_DynamicPrioGet			EQU	0x2dd4
                                           MIOS_AIN_LastPinsGet			EQU	0x2dd8
                                           MIOS_BANKSTICK_CtrlSet			EQU	0x2ddc
                                           MIOS_BANKSTICK_CtrlGet			EQU	0x2de0
                                           MIOS_BANKSTICK_WritePage		EQU	0x2de4
                                           MIOS_HLP_Dec2BCD			EQU	0x2de8
                                           MIOS_LCD_PrintBCD4			EQU	0x2dec
                                           MIOS_LCD_PrintBCD5                      EQU	0x2df0
                                           MIOS_LCD_MessageStart			EQU	0x2df4
                                           MIOS_LCD_MessageStop			EQU	0x2df8
                                           MIOS_MF_PWM_PeriodGet                   EQU	0x2dfc
                                           MIOS_MF_PWM_PeriodSet                   EQU	0x2e00
                                           MIOS_IIC_Start				EQU	0x2e04
                                           MIOS_IIC_Stop				EQU	0x2e08
                                           MIOS_IIC_ByteSend			EQU	0x2e0c
                                           MIOS_IIC_ByteReceive			EQU	0x2e10
                                           MIOS_IIC_AckSend			EQU	0x2e14
                                           MIOS_IIC_NakSend			EQU	0x2e18
                                           MIOS_IIC_CtrlSet			EQU	0x2e1c
                                           MIOS_IIC_CtrlGet			EQU	0x2e20
                                           MIOS_SRIO_DebounceSet			EQU	0x2e24
                                           MIOS_SRIO_DebounceGet			EQU	0x2e28
                                           MIOS_MF_TouchDetectionReset		EQU	0x2e2c
                                           MIOS_BANKSTICK_ReadPage			EQU	0x2e30
                                           MIOS_EEPROM_ReadPage			EQU	0x2e34
                                           MIOS_EEPROM_WritePage			EQU	0x2e38
                                           MIOS_TIMER_ReInit			EQU	0x2e3c
                                           MIOS_RESERVED_144                       EQU	0x2e40
                                           MIOS_RESERVED_145                       EQU	0x2e44
                                           MIOS_RESERVED_146                       EQU	0x2e48
                                           MIOS_RESERVED_147                       EQU	0x2e4c
                                           MIOS_RESERVED_148                       EQU	0x2e50
                                           MIOS_RESERVED_149                       EQU	0x2e54
                                           MIOS_RESERVED_150                       EQU	0x2e58
                                           MIOS_RESERVED_151                       EQU	0x2e5c
                                           MIOS_RESERVED_152                       EQU	0x2e60
                                           MIOS_RESERVED_153                       EQU	0x2e64
                                           MIOS_RESERVED_154                       EQU	0x2e68
                                           MIOS_RESERVED_155                       EQU	0x2e6c
                                           MIOS_RESERVED_156                       EQU	0x2e70
                                           MIOS_RESERVED_157                       EQU	0x2e74
                                           MIOS_RESERVED_158                       EQU	0x2e78
                                           MIOS_RESERVED_159                       EQU	0x2e7c
                                           MIOS_RESERVED_160                       EQU	0x2e80
                                           MIOS_RESERVED_161                       EQU	0x2e84
                                           MIOS_RESERVED_162                       EQU	0x2e88
                                           MIOS_RESERVED_163                       EQU	0x2e8c
                                           MIOS_RESERVED_164                       EQU	0x2e90
                                           MIOS_RESERVED_165                       EQU	0x2e94
                                           MIOS_RESERVED_166                       EQU	0x2e98
                                           MIOS_RESERVED_167                       EQU	0x2e9c
                                           MIOS_RESERVED_168                       EQU	0x2ea0
                                           MIOS_RESERVED_169                       EQU	0x2ea4
                                           MIOS_RESERVED_170                       EQU	0x2ea8
                                           MIOS_RESERVED_171                       EQU	0x2eac
                                           MIOS_RESERVED_172                       EQU	0x2eb0
                                           MIOS_RESERVED_173                       EQU	0x2eb4
                                           MIOS_RESERVED_174                       EQU	0x2eb8
                                           MIOS_RESERVED_175                       EQU	0x2ebc
                                           MIOS_RESERVED_176                       EQU	0x2ec0
                                           MIOS_RESERVED_177                       EQU	0x2ec4
                                           MIOS_RESERVED_178                       EQU	0x2ec8
                                           MIOS_RESERVED_179                       EQU	0x2ecc
                                           MIOS_RESERVED_180                       EQU	0x2ed0
                                           MIOS_RESERVED_181                       EQU	0x2ed4
                                           MIOS_RESERVED_182                       EQU	0x2ed8
                                           MIOS_RESERVED_183                       EQU	0x2edc
                                           MIOS_RESERVED_184                       EQU	0x2ee0
                                           MIOS_RESERVED_185                       EQU	0x2ee4
                                           MIOS_RESERVED_186                       EQU	0x2ee8
                                           MIOS_RESERVED_187                       EQU	0x2eec
                                           MIOS_RESERVED_188                       EQU	0x2ef0
                                           MIOS_RESERVED_189                       EQU	0x2ef4
                                           MIOS_RESERVED_190                       EQU	0x2ef8
                                           MIOS_RESERVED_191                       EQU	0x2efc
                                           MIOS_RESERVED_192                       EQU	0x2f00
                                           MIOS_RESERVED_193                       EQU	0x2f04
                                           MIOS_RESERVED_194                       EQU	0x2f08
                                           MIOS_RESERVED_195                       EQU	0x2f0c
                                           MIOS_RESERVED_196                       EQU	0x2f10
                                           MIOS_RESERVED_197                       EQU	0x2f14
                                           MIOS_RESERVED_198                       EQU	0x2f18
                                           MIOS_RESERVED_199                       EQU	0x2f1c
                                           MIOS_RESERVED_200                       EQU	0x2f20
                                           MIOS_RESERVED_201                       EQU	0x2f24
                                           MIOS_RESERVED_202                       EQU	0x2f28
                                           MIOS_RESERVED_203                       EQU	0x2f2c
                                           MIOS_RESERVED_204                       EQU	0x2f30
                                           MIOS_RESERVED_205                       EQU	0x2f34
                                           MIOS_RESERVED_206                       EQU	0x2f38
                                           MIOS_RESERVED_207                       EQU	0x2f3c
                                           MIOS_RESERVED_208                       EQU	0x2f40
                                           MIOS_RESERVED_209                       EQU	0x2f44
                                           MIOS_RESERVED_210                       EQU	0x2f48
                                           MIOS_RESERVED_211                       EQU	0x2f4c
                                           MIOS_RESERVED_212                       EQU	0x2f50
                                           MIOS_RESERVED_213                       EQU	0x2f54
                                           MIOS_RESERVED_214                       EQU	0x2f58
                                           MIOS_RESERVED_215                       EQU	0x2f5c
                                           MIOS_RESERVED_216                       EQU	0x2f60
                                           MIOS_RESERVED_217                       EQU	0x2f64
                                           MIOS_RESERVED_218                       EQU	0x2f68
                                           MIOS_RESERVED_219                       EQU	0x2f6c
                                           MIOS_RESERVED_220                       EQU	0x2f70
                                           MIOS_RESERVED_221                       EQU	0x2f74
                                           MIOS_RESERVED_222                       EQU	0x2f78
                                           MIOS_RESERVED_223                       EQU	0x2f7c
                                           MIOS_RESERVED_224                       EQU	0x2f80
                                           MIOS_RESERVED_225                       EQU	0x2f84
                                           MIOS_RESERVED_226                       EQU	0x2f88
                                           MIOS_RESERVED_227                       EQU	0x2f8c
                                           MIOS_RESERVED_228                       EQU	0x2f90
                                           MIOS_RESERVED_229                       EQU	0x2f94
                                           MIOS_RESERVED_230                       EQU	0x2f98
                                           MIOS_RESERVED_231                       EQU	0x2f9c
                                           MIOS_RESERVED_232                       EQU	0x2fa0
                                           MIOS_RESERVED_233                       EQU	0x2fa4
                                           MIOS_RESERVED_234                       EQU	0x2fa8
                                           MIOS_RESERVED_235                       EQU	0x2fac
                                           MIOS_RESERVED_236                       EQU	0x2fb0
                                           MIOS_RESERVED_237                       EQU	0x2fb4
                                           MIOS_RESERVED_238                       EQU	0x2fb8
                                           MIOS_RESERVED_239                       EQU	0x2fbc
                                           MIOS_RESERVED_240                       EQU	0x2fc0
                                           MIOS_RESERVED_241                       EQU	0x2fc4
                                           MIOS_RESERVED_242                       EQU	0x2fc8
                                           MIOS_RESERVED_243                       EQU	0x2fcc
                                           MIOS_RESERVED_244                       EQU	0x2fd0
                                           MIOS_RESERVED_245                       EQU	0x2fd4
                                           MIOS_RESERVED_246                       EQU	0x2fd8
                                           MIOS_RESERVED_247                       EQU	0x2fdc
                                           MIOS_RESERVED_248                       EQU	0x2fe0
                                           MIOS_RESERVED_249                       EQU	0x2fe4
                                           MIOS_RESERVED_250                       EQU	0x2fe8
                                           MIOS_RESERVED_251                       EQU	0x2fec
                                           MIOS_RESERVED_252                       EQU	0x2ff0
                                           MIOS_RESERVED_253                       EQU	0x2ff4
                                           MIOS_RESERVED_254                       EQU	0x2ff8
                                           MIOS_RESERVED_255                       EQU	0x2ffc
                                           #include "macros.inc"
                                           ;
                                           ; Macro Definitions
                                           ;
                                           ; ==========================================================================
                                           ;
                                           ;  Copyright 2006 Thorsten Klose (tk@midibox.org)
                                           ;  Licensed for personal non-commercial use only.
                                           ;  All other rights reserved.
                                           ; 
                                           ; ==========================================================================
                                           
                                           IFSET	MACRO	reg, bit, instr
                                           	btfsc	reg, bit
                                           	instr
                                           	ENDM
                                           
                                           
                                           IFCLR	MACRO	reg, bit, instr
                                           	btfss	reg, bit
                                           	instr
                                           	ENDM
                                           
                                           BIFSET	MACRO	reg, bit, reg_a, instr
                                           	btfsc	reg, bit, reg_a
                                           	instr
                                           	ENDM
                                           
                                           
                                           BIFCLR	MACRO	reg, bit, reg_a, instr
                                           	btfss	reg, bit, reg_a
                                           	instr
                                           	ENDM
                                           
                                           ;; ==========================================================================
                                           
                                           IFNEQ   MACRO   reg, reg_a, instr
                                                   cpfseq  reg, reg_a
                                                   instr
                                                   ENDM
                                           
                                           IFLEQ   MACRO   reg, reg_a, instr
                                                   cpfsgt  reg, reg_a
                                                   instr
                                                   ENDM
                                           
                                           IFGEQ   MACRO   reg, reg_a, instr
                                                   cpfslt  reg, reg_a
                                                   instr
                                                   ENDM
                                           
                                           	
                                           ;; ==========================================================================
                                           
                                           IRQ_DISABLE MACRO
                                                   bcf     INTCON, GIE
                                                   ENDM
                                           
                                           IRQ_ENABLE MACRO
                                                   bsf     INTCON, GIE
                                                   ENDM
                                           
                                           ;; ==========================================================================
                                           
                                           TABLE_ADDR_FULL MACRO addr
                                                   movlw   LOW(addr)
                                                   movwf   TBLPTRL
                                                   movlw   HIGH(addr)
                                                   movwf   TBLPTRH
                                                   movlw   (((addr) >> 16) & 0xff) ; store upper Byte
                                                   movwf   TBLPTRU
                                                   ENDM
                                                   
                                           TABLE_ADDR MACRO addr
                                                   movlw   LOW(addr)
                                                   movwf   TBLPTRL
                                                   movlw   HIGH(addr)
                                                   movwf   TBLPTRH
                                                   ENDM
                                           
                                           TABLE_ADD_W MACRO
                                           	addwf	TBLPTRL, F
                                           	movlw	0x00
                                           	addwfc	TBLPTRH, F
                                                   ENDM
                                           
                                           ;; ==========================================================================
                                           
                                           JUMPTABLE_2BYTES MACRO max_value
                                           	addlw	-max_value	; ensure that jump index is not greater than (max_value-1)
                                           	skpnc
                                           	movlw	-max_value
                                           	addlw	max_value
                                           	call	MIOS_HLP_GetIndex_2bytes
                                           	ENDM
                                           
                                           JUMPTABLE_2BYTES_UNSECURE MACRO
                                           	call	MIOS_HLP_GetIndex_2bytes
                                           	ENDM
                                           
                                           JUMPTABLE_4BYTES MACRO max_value
                                           	addlw	-max_value	; ensure that jump index is not greater than (max_value-1)
                                           	skpnc
                                           	return
                                           	addlw	max_value
                                           	call	MIOS_HLP_GetIndex_4bytes
                                           	ENDM
                                           
                                           JUMPTABLE_4BYTES_UNSECURE MACRO
                                           	call	MIOS_HLP_GetIndex_4bytes
                                           	ENDM
                                           
                                           ;; ==========================================================================
                                           
                                           TWOBYTE_ENTRY MACRO low_byte, high_byte
                                                   dw      (high_byte << 8) | (low_byte)
                                                   ENDM
                                           
                                           ;; ==========================================================================
                                           
                                           #define skpnz	btfsc	STATUS, Z 
                                           #define skpz	btfss	STATUS, Z 
                                           #define skpndc	btfsc	STATUS, DC 
                                           #define skpdc	btfss	STATUS, DC
                                           #define skpnc	btfsc	STATUS, C
                                           #define skpc	btfss	STATUS, C
                                           #define clrc	bcf	STATUS, C
                                           #define setc	bsf	STATUS, C
                                           #define clrz	bcf	STATUS, Z
                                           #define setz	bsf	STATUS, Z
                                           #define rrf	rrcf	
                                           #define rlf	rlcf
                                           
                                           rgoto   MACRO   label
003876   d7fd     bra	0x3872                       bra     label
                                                   ENDM
                                           
                                           SET_BSR MACRO   reg
003894   0100     movlb	0                          movlb   HIGH(reg)
                                                   ENDM
                                           
                                           ;; ==========================================================================
                                           
                                           FONT_ENTRY MACRO width, height, x0, char_offset
                                           	dw	((height) << 8) | (width), ((char_offset) << 8) | (x0)
                                           	ENDM
                                           
                                           ;; ==========================================================================
                                           
                                           STRING MACRO length, pos, str
                                           	da	((length) << 8) | (pos), str
                                           	ENDM
                                           
                                           ;; ==========================================================================
                                           
                                           ; ==========================================================================
                                           
                                           	;; export lables
                                           	global	_SM_Init		; (compiler removes the "_", see sm_simple.h)
                                           	global	_SM_PrepareCol
                                           	global	_SM_GetRow
                                           	global	_SM_ButtonHandler
                                           
                                           	global	_sm_button_column
                                           	global	_sm_button_row
                                           	global	_sm_button_value
                                           
                                           	;; import lables
                                           	extern	_SM_NotifyToggle
                                           
                                           ; ==========================================================================
                                           
                                           accessram		udata		; (no access ram required, these variables can be located anywhere)
                                           
                                           _sm_button_column	res	1	; exported to C, therefore an "_" has been added
                                           _sm_button_row		res	1
                                           _sm_button_value	res	1
                                           
                                           sm_selected_column	res	1
                                           sm_button_column_ctr	res	1
                                           
                                           sm_row_values		res	8
                                           sm_row_changed		res	8
                                           
                                           ; ==========================================================================
                                           SM_SIMPLE code
                                           ; ==========================================================================
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  FUNCTION: SM_Init
                                           ;;  DESCRIPTION: This function initializes the scan matrix.
                                           ;;  It should be called from USER_Init
                                           ;;  IN:   -
                                           ;;  OUT:  -
                                           ;;  USES: BSR
                                           ;; --------------------------------------------------------------------------
                                           _SM_Init ; (for C)
                                           SM_Init
                                           	;; set button value to initial value (1) of all 64 buttons
00386a   ee10     lfsr	0x1, 0x85           	lfsr	FSR1, sm_row_values
00386c   f085
00386e   0e08     movlw	0x8                	movlw	0x08
003870   6ef3     movwf	0xf3, 0            	movwf	PRODL
                                           SM_Init_Loop1
003872   68e6     setf	0xe6, 0             	setf	POSTINC1
003874   2ef3     decfsz	0xf3, 0x1, 0      	decfsz	PRODL, F
                                           	rgoto	SM_Init_Loop1
                                           
                                           	;; clear "changed" status of all 64 buttons
003878   ee10     lfsr	0x1, 0x8d           	lfsr	FSR1, sm_row_changed
00387a   f08d
00387c   0e08     movlw	0x8                	movlw	0x08
00387e   6ef3     movwf	0xf3, 0            	movwf	PRODL
                                           SM_Init_Loop2
003880   6ae6     clrf	0xe6, 0             	clrf	POSTINC1
003882   2ef3     decfsz	0xf3, 0x1, 0      	decfsz	PRODL, F
                                           	rgoto	SM_Init_Loop2
                                           
                                           	;; select first column
003886   0e00     movlw	0                  	movlw	0x00
003888   ecc4     call	0x2d88, 0           	call	MIOS_HLP_GetBitANDMask	; (inverted 1 of 8 code)
00388a   f016
00388c   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1
00388e   0e00     movlw	0                  	movlw	SM_COLUMN_DOUT
003890   ec68     call	0x2cd0, 0           	call	MIOS_DOUT_SRSet
003892   f016
                                           
                                           	;; remember that this column has been selected
                                           	SET_BSR	sm_selected_column
003896   6b83     clrf	0x83, 0x1           	clrf	sm_selected_column, BANKED
                                           
003898   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  FUNCTION: SM_PrepareCol
                                           ;;  DESCRIPTION: This function prepares the DOUT register to drive a column
                                           ;;  It should be called from USER_SR_Service_Prepare
                                           ;;  IN:   -
                                           ;;  OUT:  -
                                           ;;  USES: BSR
                                           ;; --------------------------------------------------------------------------
                                           ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
                                           ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible
                                           ;; --------------------------------------------------------------------------
                                           _SM_PrepareCol ; (for C)
                                           SM_PrepareCol
                                           	;; select next DOUT register
                                           
                                           	;; (current column + 1) & 0x07
                                           	SET_BSR	sm_selected_column
00389c   2983     incf	0x83, 0, 0x1        	incf	sm_selected_column, W, BANKED	; (* see note below)
00389e   0b07     andlw	0x7                	andlw	0x07
0038a0   ecc4     call	0x2d88, 0           	call	MIOS_HLP_GetBitANDMask	; (inverted 1 of 8 code)
0038a2   f016
0038a4   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1
0038a6   0e00     movlw	0                  	movlw	SM_COLUMN_DOUT
0038a8   ec68     call	0x2cd0, 0           	call	MIOS_DOUT_SRSet
0038aa   f016
                                           
                                           	;; (*) note: the incremented "selected column" value won't be saved here, but
                                           	;; after SM_GetRow has been executed. 
                                           	;; Why?
                                           	;; because the new DOUT value will be "visible" after the DIN chain has
                                           	;; been captured by the SRIO driver, therefore the column which has been
                                           	;; selected here will be visible during the upper next scan
0038ac   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  FUNCTION: SM_GetRow
                                           ;;  DESCRIPTION: This function gets the DIN values of the selected column
                                           ;;  It should be called from USER_SR_Service_Finish
                                           ;;  IN:   -
                                           ;;  OUT:  -
                                           ;;  USES: -
                                           ;; --------------------------------------------------------------------------
                                           ;;  Note that this is an interrupt service routine! Use FSR2 instead of FSR0
                                           ;;  and IRQ_TMPx instead of TMPx -- and make the routine as fast as possible
                                           ;; --------------------------------------------------------------------------
                                           _SM_GetRow ; (for C)
                                           SM_GetRow
                                           	;; determine changes and save new value in SW_ROWx_VALUE depending on selected column
0038ae   0e00     movlw	0                  	movlw	SM_ROW_DIN
0038b0   ec5c     call	0x2cb8, 0           	call	MIOS_DIN_SRGet
0038b2   f016
0038b4   ee10     lfsr	0x1, 0x85           	lfsr	FSR1, sm_row_values
0038b6   f085
                                           	SET_BSR	sm_selected_column
0038ba   5183     movf	0x83, 0, 0x1        	movf	sm_selected_column, W, BANKED
0038bc   cfe3     movff	0xfe3, 0xb         	movff	PLUSW1, IRQ_TMP1
0038be   f00b
0038c0   c003     movff	0x3, 0xfe3         	movff	MIOS_PARAMETER1, PLUSW1
0038c2   ffe3
                                           
                                           	;; old value in IRQ_TMP1
                                           	;; new value in MIOS_PARAMETER1
                                           	;; select SM_ROWx_CHANGED register
0038c4   ee10     lfsr	0x1, 0x8d           	lfsr	FSR1, sm_row_changed
0038c6   f08d
0038c8   5183     movf	0x83, 0, 0x1        	movf	sm_selected_column, W, BANKED
0038ca   26e1     addwf	0xe1, 0x1, 0       	addwf	FSR1L, F
                                           
                                           	;; changes are: IRQ_TMP1 xor MIOS_PARAMETER1
0038cc   500b     movf	0xb, 0, 0           	movf	IRQ_TMP1, W
0038ce   1803     xorwf	0x3, 0, 0          	xorwf	MIOS_PARAMETER1, W
                                           
                                           	;; OR the result to the already notified changes (if they has not been zeroed by the ButtonHandler)
0038d0   12e7     iorwf	0xe7, 0x1, 0       	iorwf	INDF1, F
                                           
                                           	;; increment column, wrap at 8
0038d2   2983     incf	0x83, 0, 0x1        	incf	sm_selected_column, W, BANKED
0038d4   0b07     andlw	0x7                	andlw	0x07
0038d6   6f83     movwf	0x83, 0x1          	movwf	sm_selected_column, BANKED
                                           	
0038d8   0012     return	0                 	return
                                           
                                           ;; --------------------------------------------------------------------------
                                           ;;  FUNCTION: SM_ButtonHandler
                                           ;;  DESCRIPTION: This function should be called from USER_Tick (in the
                                           ;;  mainprogram) to ask for button changes. Events (change from 0->1 or
                                           ;;  from 1->0) will be notified via the SM_NotifyToggle hook
                                           ;;  which behaves similar to the USER_DIN_NotifyToggle hook provided by
                                           ;;  MIOS itself
                                           ;; 
                                           ;;  IN:   -
                                           ;;  OUT:  -
                                           ;;  USES: -
                                           ;; --------------------------------------------------------------------------
                                           _SM_ButtonHandler ; (for C)
                                           SM_ButtonHandler
                                           	SET_BSR	sm_button_column_ctr
0038dc   6b84     clrf	0x84, 0x1           	clrf	sm_button_column_ctr, BANKED
                                           SM_ButtonHandler_Loop
0038de   ee10     lfsr	0x1, 0x8d           	lfsr	FSR1, sm_row_changed
0038e0   f08d
0038e2   5184     movf	0x84, 0, 0x1        	movf	sm_button_column_ctr, W, BANKED
0038e4   26e1     addwf	0xe1, 0x1, 0       	addwf	FSR1L, F
0038e6   50e7     movf	0xe7, 0, 0          	movf	INDF1, W
0038e8   e010     bz	0x390a                	bz	SM_ButtonHandler_Loop_Next
0038ea   b0e7     btfsc	0xe7, 0, 0         	btfsc	INDF1, 0		; fastest solution...
0038ec   d813     rcall	0x3914             	rcall	SM_NotifyToggle_Pin0
0038ee   b2e7     btfsc	0xe7, 0x1, 0       	btfsc	INDF1, 1
0038f0   d814     rcall	0x391a             	rcall	SM_NotifyToggle_Pin1
0038f2   b4e7     btfsc	0xe7, 0x2, 0       	btfsc	INDF1, 2
0038f4   d815     rcall	0x3920             	rcall	SM_NotifyToggle_Pin2
0038f6   b6e7     btfsc	0xe7, 0x3, 0       	btfsc	INDF1, 3
0038f8   d816     rcall	0x3926             	rcall	SM_NotifyToggle_Pin3
0038fa   b8e7     btfsc	0xe7, 0x4, 0       	btfsc	INDF1, 4
0038fc   d817     rcall	0x392c             	rcall	SM_NotifyToggle_Pin4
0038fe   bae7     btfsc	0xe7, 0x5, 0       	btfsc	INDF1, 5
003900   d818     rcall	0x3932             	rcall	SM_NotifyToggle_Pin5
003902   bce7     btfsc	0xe7, 0x6, 0       	btfsc	INDF1, 6
003904   d819     rcall	0x3938             	rcall	SM_NotifyToggle_Pin6
003906   bee7     btfsc	0xe7, 0x7, 0       	btfsc	INDF1, 7
003908   d81a     rcall	0x393e             	rcall	SM_NotifyToggle_Pin7
                                           SM_ButtonHandler_Loop_Next
00390a   2b84     incf	0x84, 0x1, 0x1      	incf	sm_button_column_ctr, F, BANKED
00390c   0e07     movlw	0x7                	movlw	0x08-1		; (8 columns)
00390e   6584     cpfsgt	0x84, 0x1         	cpfsgt	sm_button_column_ctr, BANKED
                                           	rgoto	SM_ButtonHandler_Loop
003912   0012     return	0                 	return
                                           
                                           	;; ---
                                           
                                           SM_NotifyToggle_Pin0
003914   90e7     bcf	0xe7, 0, 0           	bcf	INDF1, 0			; clear "changed" flag
003916   0e00     movlw	0                  	movlw	0x00
                                           	rgoto	SM_NotifyToggle_Pin_Cont
                                           SM_NotifyToggle_Pin1
00391a   92e7     bcf	0xe7, 0x1, 0         	bcf	INDF1, 1			; clear "changed" flag
00391c   0e01     movlw	0x1                	movlw	0x01
                                           	rgoto	SM_NotifyToggle_Pin_Cont
                                           SM_NotifyToggle_Pin2
003920   94e7     bcf	0xe7, 0x2, 0         	bcf	INDF1, 2			; clear "changed" flag
003922   0e02     movlw	0x2                	movlw	0x02
                                           	rgoto	SM_NotifyToggle_Pin_Cont
                                           SM_NotifyToggle_Pin3
003926   96e7     bcf	0xe7, 0x3, 0         	bcf	INDF1, 3			; clear "changed" flag
003928   0e03     movlw	0x3                	movlw	0x03
                                           	rgoto	SM_NotifyToggle_Pin_Cont
                                           SM_NotifyToggle_Pin4
00392c   98e7     bcf	0xe7, 0x4, 0         	bcf	INDF1, 4			; clear "changed" flag
00392e   0e04     movlw	0x4                	movlw	0x04
                                           	rgoto	SM_NotifyToggle_Pin_Cont
                                           SM_NotifyToggle_Pin5
003932   9ae7     bcf	0xe7, 0x5, 0         	bcf	INDF1, 5			; clear "changed" flag
003934   0e05     movlw	0x5                	movlw	0x05
                                           	rgoto	SM_NotifyToggle_Pin_Cont
                                           SM_NotifyToggle_Pin6
003938   9ce7     bcf	0xe7, 0x6, 0         	bcf	INDF1, 6			; clear "changed" flag
00393a   0e06     movlw	0x6                	movlw	0x06
                                           	rgoto	SM_NotifyToggle_Pin_Cont
                                           SM_NotifyToggle_Pin7
00393e   9ee7     bcf	0xe7, 0x7, 0         	bcf	INDF1, 7			; clear "changed" flag
003940   0e07     movlw	0x7                	movlw	0x07
                                           	;; 	rgoto	SM_NotifyToggle_Pin_Cont
                                           SM_NotifyToggle_Pin_Cont
003942   6f81     movwf	0x81, 0x1          	movwf	_sm_button_row, BANKED
                                           
                                           	;; store pin value in SM_BUTTON_VALUE
003944   ee10     lfsr	0x1, 0x85           	lfsr	FSR1, sm_row_values
003946   f085
003948   5184     movf	0x84, 0, 0x1        	movf	sm_button_column_ctr, W, BANKED
00394a   26e1     addwf	0xe1, 0x1, 0       	addwf	FSR1L, F
00394c   5181     movf	0x81, 0, 0x1        	movf	_sm_button_row, W, BANKED
00394e   ecc6     call	0x2d8c, 0           	call	MIOS_HLP_GetBitORMask
003950   f016
003952   14e7     andwf	0xe7, 0, 0         	andwf	INDF1, W
003954   a4d8     btfss	0xd8, 0x2, 0       	skpz
003956   0e01     movlw	0x1                	movlw	0x01
003958   6f82     movwf	0x82, 0x1          	movwf	_sm_button_value
                                           
                                           	;; for compatibility with USER_DIN_NotifyToggle:
                                           	;; save button value in MIOS_PARAMETER2
00395a   6e04     movwf	0x4, 0             	movwf	MIOS_PARAMETER2
                                           	;; save button number (0x00-0xff) in MIOS_PARAMETER1
                                           	;; if more than 256 buttons are connected, use SM_BUTTON_COLUMN and SM_BUTTON_ROW to determine the number
                                           #if SM_SWAP_CR
                                           	movf	sm_button_column_ctr, W, BANKED
                                           	movwf	_sm_button_column, BANKED
                                           	movf	_sm_button_row, W, BANKED
                                           	mullw	0x08
                                           	movf	PRODL, W
                                           	addwf	_sm_button_column, W, BANKED	
                                           #else
00395c   5184     movf	0x84, 0, 0x1        	movf	sm_button_column_ctr, W, BANKED
00395e   6f80     movwf	0x80, 0x1          	movwf	_sm_button_column, BANKED
003960   0d08     mullw	0x8                	mullw	0x08
003962   50f3     movf	0xf3, 0, 0          	movf	PRODL, W
003964   2581     addwf	0x81, 0, 0x1       	addwf	_sm_button_row, W, BANKED
                                           #endif
                                           
                                           	;; call C hook
003966   6e03     movwf	0x3, 0             	movwf	MIOS_PARAMETER1			; button number still in WREG
003968   c082     movff	0x82, 0xfed        	movff	_sm_button_value, POSTDEC0	; pin value
00396a   ffed
00396c   ec5b     call	0x34b6, 0           	call	_SM_NotifyToggle
00396e   f01a
003970   2ae9     incf	0xe9, 0x1, 0        	incf	FSR0L, F			; restore stack pointer
                                           
003972   ee10     lfsr	0x1, 0x8d           	lfsr	FSR1, sm_row_changed	; fix FSR1 if it has been overwritten
003974   f08d
                                           	SET_BSR	sm_button_column_ctr
003978   5184     movf	0x84, 0, 0x1        	movf	sm_button_column_ctr, W, BANKED
00397a   26e1     addwf	0xe1, 0x1, 0       	addwf	FSR1L, F
00397c   0012     return	0                 	return
                                           
                                           ; ==========================================================================
                                           	END
