mov_lfsr slavetable, 1 ; FSR1H -> slavetable
mov_ff cslot, FSR1L ; FSR1 -> new ste_flags
- panic morse_TI3
+ return
bt_f_if1 POSTDEC1, stf_sentinel ; FSR1 -> ste_slave
bra nextslave_looparound
; Ok, we have a slave:
# Temporary entries for testing and development
TM PIE1,SSPSTAT,SSPCON1,SSPCON2 ; Master got I2C interrupt
+TI0 ; for iwj
TI1 ; for iwj
TI2 ; for iwj
TI3 ; for iwj
TI4 ; for iwj
TI5 ; for iwj
+TI6 ; for iwj
+TI7 ; for iwj
+TI8 ; for iwj
+TI9 ; for iwj
# Main message listing. Kept sorted by section for easy reference.
# -----------------------------------------------------------------
;****************************************************************************
nmra_sendwatchdog_start @
- mov_lw 0x40
- mov_wf totrack
+ mov_lw 0x40 ; if we were in a message it's going to get
+ mov_wf totrack ; garbled; oh well.
return
nmra_sendwatchdog_stop @
;----------------------------------------
vector_reset @
-
- set_f qqTRISA
- set_f qqTRISB
- set_f qqTRISC
- set_f qqTRISD
- set_f qqTRISE
- mov_lw 0xaa
- mov_wf qqLATA
- mov_wf qqLATB
- mov_wf qqLATC
- mov_wf qqLATD
- mov_wf qqLATE
-
clr_f INTCON
bs_f RCON, IPEN ; interrupt priorities
call idlocs_init
- clr_f flags
bt_f_if0 idloc1,idloc1_master
call slave_init
master_init
; Master-specific initialisation.
call memory_erase
+ clr_f flags
call serial_init
call i2cm_init
call serialtxbuf_init
;----------------------------------------
master_interrupt_low @
enter_interrupt_low
+ D 0x80
call tick_intrl
+ D 0x01
call nmra_serialrx_intrl
+ D 0x02
call power_fault_intrl
- mov_ff PIR1, xdebug+2
- mov_ff PIE1, xdebug+3
- mov_ff IPR1, xdebug+4
- mov_ff INTCON, xdebug+5
+ D 0x03
call serialtxfc_intrl
+ D 0x04
call serialtx_intrl
+ D 0x05
call points_local_intrl
+ D 0x06
call i2cm_intrl
bs_f xdebug+0, 5
panic morse_IL
goto serialrx_bad ; 1 0000 xxx
goto command_ping ; 1 0001 xxx
goto command_polarity ; 1 0010 xxx
- goto serialrx_bad ; 1 0011 xxx
+ goto command_watchdog ; 1 0011 xxx
goto command_point ; 1 0100 xxx
goto serialrx_bad ; 1 0101 xxx
goto serialrx_bad ; 1 0110 xxx
;----------------------------------------
slave_init
; Slave-specific initialisation.
+ clr_f flags
+
mov_fw picno
call i2cs_init
bra_z tx_bufempty
mov_fw INDF0
- xor_lw 0x02
+ xor_lw 0xbb
bra_z boo
mov_fw INDF0
mov_wf TXREG
mov_fw POSTINC0 ; W = 10011OOO
and_lw 0x07 ; W = 00000OOO
bra_nz command_watchdog_bad
- mov_wf INDF0 ; W = OMMMMMMM
+ mov_fw INDF0 ; W = OMMMMMMM
bra_n command_watchdog_bad
- mov_fw watchdog ; watchdog = OMMMMMMM
+ mov_wf watchdog ; watchdog = OMMMMMMM
goto nmra_sendwatchdog_stop
command_watchdog_bad panic morse_WX
watchdog_tickdiv @
tst_f_ifnz watchdog
dec_f_ifnz watchdog
+ return
; oops, we've timed out
call nmra_sendwatchdog_start
mov_wf POSTINC1
endm
+ ; An extra idle byte:
+ set_f POSTINC1 ; ff
; Baseline Broadcast stop Forwards(I) non-Emergency S9.2 B l.98-
; as computed by ./hostside-old -st bstop
set_f POSTINC1 ; ff