call points_local_init
call polarity_local_init
call detect_local_init
+ call wagglers_local_init
return
;----------------------------------------
call serialtxbuf_init
call polarity_master_init
call points_master_init
+ call wagglers_master_init
call common_local_init
call nmra_init
call serialtxfc_init
goto command_polarity ; 1 0010 xxx
goto command_watchdog ; 1 0011 xxx
goto command_point ; 1 0100 xxx
- goto serialrx_bad ; 1 0101 xxx
+ goto command_waggle ; 1 0101 xxx
goto serialrx_bad ; 1 0110 xxx
goto serialrx_bad ; 1 0111 xxx
goto serialrx_bad ; 1 1000 xxx
; MASTER - Access bank variables etc.
udata_acs ; idle busy
-waggle_message res 1 ; 00000000 101 wwwwY
-waggle_slave res 1 ; ???????? 000 SSSss
+waggle_slave res 1 ; 11111111 000 SSSss
+waggle_message res 1 ; ???????? 101 wwwwY
;======================================================================
; LOCAL WAGGLERS
mov_wf t ; t = 101 WWWWY
+ mov_wf xdebug
intrlh_fsr0_save
- mov_lfsr waggle_lpins | b'011110', 0
- ; FSR0 = aaaa 101 11110
- and_wff FSR0L ; FSR0 = aaaa 101 WWWW0
- ; INDF0 = bbbb bbbb LAT*-addr
- mov_fw POSTINC0 ; W = bbbb bbbb (one-bit mask)
- ; INDF0 = LAT*-addr
+ mov_lfsr waggle_lpins | 0x01, 0
+ ; FSR0 = aaaa 000 00001
+ ior_wff FSR0L ; FSR0 = aaaa 101 WWWW1
+ ; *FSR0 = bbbb bbbb (one-bit mask)
+ mov_ff FSR0L, xdebug+1
+ mov_fw POSTDEC0 ; W = bbbb bbbb
+ ; *FSR0 = LAT*-addrl
+ mov_wf xdebug+2
bra_z waggle_nonexistent
- mov_ff INDF0, FSR0L
+ mov_ff INDF0, FSR0L ; FSR0L = LAT*-addr
+ mov_ff FSR0L, xdebug+3
set_f FSR0H ; FSR0 = 1111 LAT*-addr
- ; INDF0 = <latch>
+ ; *FSR0 = <latch>
bt_f_if0 t, 0 ; test Y
bra waggle_ifclear
; set:
+ mov_wf xdebug+4
+ mov_ff FSR0H, xdebug+6
+ mov_ff FSR0L, xdebug+5
ior_wff INDF0
;...
waggle_local_done
; LOCAL WAGGLERS - INITIALISATION
;----------------------------------------
-wagglers_local_init
+wagglers_local_init @
outputs_local_init picno2wagglemap, maxwaggles, waggle_lpins, bkwaggleix2portnumbitnum
return
;======================================================================
; MASTER
-; No initialisation needed; we just pass on the commands as they come in.
+; No serious initialisation needed;
+; we just pass on the commands as they come in.
+
+wagglers_master_init @
+ set_f waggle_slave
+ return
;----------------------------------------------------------------------
command_waggle @
; ie 1010 1sss
; OSS wwwwV
- tst_f_ifnz waggle_message
+ bt_f_if0 waggle_slave, 7
bra command_waggle_busy
mov_fw PREINC0 ; F0->[1], W = OSS wwwwV N = 0
;----------
waggle_needwrite @
- bt_f_if1 waggle_message, 7
+ bt_f_if1 waggle_slave, 7
return
pop
mov_fw waggle_slave
;----------
waggle_getwritebyte @
mov_fw waggle_slave
+ bra_n waggle_getwritebyte_ifidle
cmp_fw_ifne cwslave
+waggle_getwritebyte_ifidle
return
;...
mov_lw 0x04 ; WAGGLED
; that's a foregone conclusion
mov_fw waggle_message
- clr_f waggle_message
+ set_f waggle_slave
goto i2c_getwritebyte_yes
command_waggle_badmsg panic morse_AX