chiark / gitweb /
getwritebyte_polarity, etc.
authorian <ian>
Sun, 25 Dec 2005 13:04:49 +0000 (13:04 +0000)
committerian <ian>
Sun, 25 Dec 2005 13:04:49 +0000 (13:04 +0000)
detpic/reverse.asm

index abe7eb06448d5bbb6f6efdadd9b7cf15baa350ac..1e57c37cf1018d757e3012bd4433418eba761e9d 100644 (file)
@@ -173,12 +173,18 @@ board_next_none
 board_next_none_more_message
        panic   morse_RL
 
+;----------------------------------------------------------------------
+polarity_master_init
+       panic   morse_URM
+       ; need to set up polarity_cmds
+
 ;----------------------------------------------------------------------
 needwrite_polarity
-;  <something>_needwrite will see if we need to talk to a slave
+;  needwrite_<something> will see if we need to talk to a slave
 ;    if not it will simply return
 ;    if we _do_, it will store the slave no. in needwrite_slave
-;    and then pop and return
+;     and then pop and return.  In this case getwritebyte_polarity
+;     on this slave must provide a byte next time it is called.
 ;  nb register usage may need to be adjusted for wiring into mascan i2cm_...
        mov_lfsr polarity_cmds, 0
 polarity_needwrite_loop
@@ -197,10 +203,23 @@ polarity_needwrite_loop
        pop
        return
 
+near_getwritebyteyes code
 ;----------------------------------------------------------------------
-polarity_master_init
-       panic   morse_URM
-       ; need to set up polarity_cmds
+getwritebyte_polarity
+;  getwritebyte_<something> finds a byte to write to a particular
+;   slave.  If we have something to write, puts the byte in W
+;   and does `goto getwritebyte_yes'.  Otherwise simply returns.
+;
+;              on entry                return, `no'    branch-away, `yes'
+;  cwslave     slave number            preserved       preserved
+;  W           undefined               trashed         byte for slave
+;
+       mov_lfsr polarity_cmds, 0
+       add_wf  FSR0L
+       mov_fw  INDF0
+       bra_n   getwritebyte_yes
+       ; no:
+       return
 
 ;======================================================================
  include final.inc