chiark / gitweb /
actually reconsider who to write to if wslave is empty
authorian <ian>
Fri, 30 Dec 2005 03:01:18 +0000 (03:01 +0000)
committerian <ian>
Fri, 30 Dec 2005 03:01:18 +0000 (03:01 +0000)
detpic/mascan.asm

index ad3eb8dc9156415aff6c7f56c3e2f355911e0001..e8ed66f2766ed58eea70ce4d9b1425384d68273e 100644 (file)
@@ -46,8 +46,11 @@ i2cmu_write_next_byte
 i2cm_intrl @
 ; handles i2c interrupt using i2cm_interrupt[_definite],
 ; according to the rules for <something>_intrl.
+ bs_f xdebug+0, 3
+ mov_ff PIR1, xdebug+1
        bt_f_if0 PIR1, SSPIF
        return
+ bs_f xdebug+0, 4
        call    i2cm_interrupt_definite
        intrl_handled_nostack
 
@@ -199,11 +202,22 @@ i2c_arrange_next_byte
 ; DECIDING WHICH SLAVE TO ADDRESS
 ;...
 i2c_arrange_something
+i2cmu_done
 ; figure out what to do next - which pic to address, etc.
        bs_f    cbyte, cbyte_halted
 
        tst_f_ifnz wslave       ; anyone asked to write ?
        bra     arrange_write
+
+       ; Anyone else to write to ?
+       ; add calls to needwrite_<foo> here:
+       call    polarity_needwrite
+       call    points_needwrite
+       ; end of list of calls to needwrite_<foo>
+
+       ; no, if we're here, no-one wants to write:
+       bs_f xdebug+0, 6
+
 nextslave_nowrite
        ; no writing needed, we consider reading:
        bt_f_if1 flags, flags_polarising
@@ -239,22 +253,6 @@ nextslave_looparound
        call    read_detection_head_master
        goto    i2cmu_read_got_byte
 
-;----------------------------------------
-i2cmu_done
-       ; So we've done one write.
-       bs_f    cbyte, cbyte_halted
-
-       tst_f_ifnz wslave       ; anyone asked in the meantime ?
-       bra     arrange_write
-
-       ; Anyone else to write to ?
-       ; add calls to needwrite_<foo> here:
-       call    polarity_needwrite
-       call    points_needwrite
-       ; end of list of calls to needwrite_<foo>
-
-       ; no, if we're here, no-one wants to write
-       bra     nextslave_nowrite
 
 ;----------------------------------------
 i2c_needwrite @
@@ -269,6 +267,7 @@ i2c_needwrite @
 ;----------
 arrange_write
 ;  wslave      slave to write to
+ bs_f xdebug+0, 0
        bc_f    cbyte, cbyte_halted
        mov_fw  wslave
        mov_wf  cwslave