mov_wf b ; W = b = received byte
D 0x70
+ mov_fw cslot
+ call debugbyte
mov_fw cbyte
call debugbyte
mov_fw b
mov_fw POSTINC1 ; W = detbasel; FSR1 -> lastd0
rcall read_got_detectbyte_prep ; b = 0d00dddd
; u = 0C00CCCC
+ ;mov_ff b, xdebug+5
bt_f_if1 b, 6 ; b bit .d......
bs_f b, 4 ; b = 0d0ddddd
; ^ ^ copies of same bit
;----------
read_got_detectors_b1 ; b = dddddddd
+; ; W = detbasel; FSR1 -> detbasel
+ add_lw 5 ; W = adjdetbasel
+ bs_f FSR1L, 2 ; FSR1L -> lastd1
bc_f cbyte, 4 ; cbyte = M0B00000
- mov_fw POSTINC1 ; W = detbasel; FSR1 -> lastd0
- inc_f FSR1L ; FSR1 -> lastd1
- add_lw 5 ; W = detbasel+8
+ mov_ff xdebug+4, xdebug+5
+ mov_ff xdebug+3, xdebug+4
+ mov_ff b, xdebug+3
rcall read_got_detectbyte_prep
goto addmsgs_all
;----------
read_got_detectors_b2 ; b = dddddddd
+; ; W = detbasel; FSR1 -> detbasel
+ add_lw 13 ; W = adjdetbasel
+ inc_f FSR1L ; FSR1 -> lastd0
+ inc_f FSR1L ; FSR1 -> lastd2
bc_f cbyte,5 ; cbyte = M0000000
- mov_fw POSTDEC1 ; W = detbasel; FSR1 -> flags
- bs_f FSR1L, 2 ; FSR1L -> lastd2
- add_lw 13 ; W = detbasel+16
rcall read_got_detectbyte_prep
goto addmsgs_all
; lastd<n> [o0]*
; FSR1 -> lastd<n>
;
- mov_wf xdebug+0
mov_wf u ; u = [C0]*
- mov_ff INDF1, xdebug+1
+ D 0x74
+ mov_fw FSR1L
+ call debugbyte
+ mov_fw u
+ call debugbyte
xor_wff INDF1 ; lastd<n> = [d0]*
; to force test of repeated detection notification,
; comment out previous line
- mov_ff INDF1, xdebug+2
mov_lw 0x07
ior_wff FSR1L ; FSR1L -> detmsgh
return ; to addmsgs_<something>, very shortly
;----------------------------------------
read_got_notfirst
+; ; FSR1 -> flags
+ mov_fw PREINC1 ; W = detbasel; FSR1 -> detbasel
bt_f_if1 cbyte, 4
bra read_got_detectors_b1
bt_f_if1 cbyte, 5
; NOS return address for i2cmu_read_got_byte
;
mov_wf t ; t = adjdetbasel
+ D 0x73
+ mov_fw INDF1
+ call debugbyte
mov_fw b ; W = [d0]*
+ call debugbyte
xor_wfw INDF1 ; W = [C0]*, Z iff same
; where C set iff change to that detection segment
bra_nz read_got_detectbyte_prep_ifsomething
; Ok, we have a slave:
D 0x71
- mov_fw cslot
- call debugbyte
mov_fw INDF1 ; W = new slave number
goto i2cm_read_start
nextslave_looparound
+ bt_f_if1 xdebug+6,2
+ goto boom2
+
+ bt_f_if1 xdebug+6,1
+ bs_f xdebug+6,2
+
; now we do our own detection
mov_lw (slavetable + ste_flags) & 0xff ; select our own slot
mov_wf cslot
D 0x72
- mov_fw cslot
- call debugbyte
call read_detection_head_master
goto i2cmu_read_got_byte
+boom2
+ panic morse_TI1
;----------------------------------------
i2c_needwrite @
mov_fw TABLAT ; W = EOOOOSSS, N = E
tblrd_postinc_fixup ; TABLAT = DSSSSSSS, N (still) = E
- bra_nn mascan_init_ifabsent
+ bra_nn mascan_init_ifabsent ; E.......
mov_ff t, POSTINC0 ; ste_slave = slave
mov_wf u ; u = 1OOOOSSS
mov_wf POSTINC0 ; detbasel
clr_f POSTINC0 ; lastd0
- clr_f POSTINC0 ; lastd1
clr_f POSTINC0 ; lastd2
set_f POSTINC0 ; unused
+ clr_f POSTINC0 ; lastd1
mov_fw u ; W = 10000SSS
xor_lw b'10011000' ^ 0x80 ; W = detmsgh
;----------
addmsg_one
-; TOS - 4 -> bt_f_if1 w, b'bbb'
+; TOS - 4 -> bt_f_if1 u, b'bbb'
; TOSL ???bbb00
; other conditions on entry and exit as for entry to addmsgs_<kind>, above
;dec_f_ifz xdebug+7
;bra boom
-
- mov_ff t, xdebug+1
+ D 0x75
+ mov_fw TOSL
+ call debugbyte
rr_fw TOSL ; W = 0???bbb0
- mov_wf xdebug+2
rr_w ; W = 00???bbb
ior_lw 0xf8 ; W = 11111bbb
mov_wf FSR0L ; FSR0L = 11111bbb
- mov_wf xdebug+3
clr_f FSR0H ; FSR0 -> bitnum2bit[bbb]
add_wfw t ; W = adjdetbasel + 11111bbb
; ie = 0 SSSSSSS (det msg low byte)
mov_wf v ; v = 0 SSSSSSS (det msg low byte)
+ bra_n addmsg_bad
mov_fw b ; W = [d0]*
and_wfw INDF0 ; train: W = 0x00, Z=1; none: W = 0*d0*, Z=0
bt_f_if0 STATUS, Z
mov_lw 0x08 ; train: W = 0 000 0 000; none: W = 0 000 1 000
xor_wfw INDF1 ; W = 1 001 Y SSS (det msg high byte)
+ call debugbyte
call serial_addbyte
+ ;bt_f_if1 xdebug+6, 0
+ ;bra boom
+
mov_fw v ; W = 0 SSSSSSS (det msg low byte)
+ call debugbyte
goto serial_addbyte_another
-boom panic morse_TI5
+addmsg_bad panic morse_DJ
+boom
+ panic morse_TI5
;======================================================================
include final.inc