=========================
Byte 20 0000h
+ PIC number (guaranteed to be in range 0..63 inclusive)
+
+Byte 20 0001h
bit 0 1 for the main PIC (#0)
0 otherwise
1-7 currently unused, set to 0
-Byte 20 0001h
- PIC number (guaranteed to be in range 0..63 inclusive)
I2C
===
TOTRACK equ 0x2 ; byte 2: to-track buffer location (in BSR5)
TOTRACKBIT equ 0x3 ; byte 3: bit location of pointer within byte
-BUFFERPAGE equ 5
+NMRA_BUFF_PAGE equ 5
+
+; flash locations for PIC-dependent info:
+
+F_PIC_NO_U equ 20h ; flash location of PIC number
+F_PIC_NO_H equ 00h
+F_PIC_NO_L equ 00h
+
+F_I2C_CTRL_U equ 20h ; flash location of i2c control byte
+F_I2C_CTRL_H equ 00h
+F_I2C_CTRL_L equ 01h
+
+; i2c specifit stuff
+
+I2C_BUFF_PAGE equ 4 ; put i2c relevant stuff into buffer page 4
+PIC_NO equ 00h ; pic no goes to 400h
+I2C_CTRL equ 01h ; i2c ctrl bit goes to 401h
+
+
ifdef SLOW_VERSION
bcf IPR1,5,0 ; set to low-priority interrupt
+;----------------------------------------------------------------------------
+
+; copy PIC-dependent info out of flash memory
+
+ movlw F_PIC_NO_U ; set table pointer to point to
+ movwf TBLPTRU ; PIC number in flash
+ movlw F_PIC_NO_H
+ movwf TBLPTRH
+ movlw F_PIC_NO_L
+ movwf TBLPTRL
+
+ tblrd *+ ; read then increment pointer
+ ; (now points to i2c control byte)
+
+ movlb I2C_BUFF_PAGE ; ser BSR=i2c BSR (4)
+ movff TABLAT, PIC_NO ; move pic number into normal memory
+
+ tblrd * ; read i2c
+
+ movff TABLAT, I2C_CTRL ; move i2c_ctrl byte into normal memory
+
+; now have: PIC number in 400h, i2c control byte in 401h
+
;----------------------------------------------------------------------------
; i2c setup