;======================================================================
+; TRACK POWER AND SHORT CIRCUIT
+ include common.inc
+ code
+
+;======================================================================
command_power
; C 1 iff command is ON undefined
+ panic morse_UEC
;power_on ???
; from cebpic/nmra-stream.asm's setup
bcf PORTB,0,0 ; user fault L or Z
+power_polarising
+ panic morse_UER
-master_interrupt_high
-; either booster timer interrupt or short circuit
- panic morse_UES ; fixme check short circuit
- call nmra_interrupt_timer
-
-trackpower_polarising
+;======================================================================
+ include final.inc
;----------------------------------------
; MASTER - Access bank variables and other sections
- udata
-polarities_commanded_buffer res maxpics+1
- ; Each byte is:
- ; 11RRRRRRR reverse command for slave, waiting to write
- ; 000000001 that pic is not a reversers pic
- ; 000000000 we have written any relevant command
- ; 000000002 sentinel
+; values for ste_revcmd:
+ ; 11RRRRRR reverse command for slave, waiting to write
+ ; 00000001 this is not a reversers pic
+ ; 00000000 we have written any relevant command
;======================================================================
; LOCAL REVERSERS
; and so on until f for bit 5. (See polarity_do_here, below.)
;
; we accumulate (`gather') the `g' bits in t.
-;
-
- panic morse_UM
-;; mov_lfsr message_buffer_start,0
-
-
- mov_lfsr polarities_commanded_buffer,1
+ mov_lfsr slavetable + ste_revcmd, 1
mov_fw POSTINC0 ; W = 10010RRR
mov_wf t ; t = 10010ggg
xor_lw b'10001000' ; t = 00011ggg
; FSR1 -> pic we've just filled
;...
board_next_loop
- dec_fw PREINC1 ; FSR1 -> pic after one we're testing
- ; W = 1??????? existing reverse command
+ mov_lw ste_size
+ add_wff FSR1L ; FSR1 -> pic after one we're testing
+ if ste_szln2 + maxpics_ln2 == 8
+ bra_c board_next_none
+ else
+ error "reliance on carry flag for incrementing FSR1 fails"
+ endif
+ dec_fw INDF1 ; W = 1??????? existing reverse command
; 00000000 not a reversers pic
; ffffffff no existing command
- ; 00000001 sentinel
bra_z board_next_loop ; not a reversers pic
- bra_nn board_next_none ; sentinel
- bt_f_if0 INDF1,7 ; 1....... existing command
+ bt_f_if0 INDF1, 7 ; 1....... existing command
; 0....... no existing command
inc_f polarities_waiting
return
; now we're exiting from the loop in when_reverse_message_found
pop ; that disposes of the call to `board'
- goto trackpower_decide
- ; that will turn it off, since polarities_waiting is nonzero
+ call power_polarising
+ mov_lfsr slavetable + ste_revcmd, 1
+ mov_fw INDF1 ; there's always a board 0, us:
+ goto polarity_local_do
;----------
board_next_none_more_message
panic morse_RL
-;----------
-trackpower_decide
- panic morse_UE
-
;======================================================================
include final.inc