From 1f539bac96dd111efa9212f44151c2718a395087 Mon Sep 17 00:00:00 2001 From: ian Date: Mon, 26 Dec 2005 23:58:03 +0000 Subject: [PATCH] init polarity master table --- detpic/morse.messages | 3 ++- detpic/reverse.asm | 41 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/detpic/morse.messages b/detpic/morse.messages index dac7d8f..35882aa 100644 --- a/detpic/morse.messages +++ b/detpic/morse.messages @@ -56,7 +56,6 @@ UER UCT UCI UCP -URM # Messages for i2clib, S* SM i2clib+panic:st,:sspstat,:sspcon1,:sspcon2 ; m.,i., ctrlr bad state @@ -81,6 +80,8 @@ DM detect:buf0 ; master has MM bit set in buf0 # R - Reversers (polarity) RS FSR0L ; POLARITY message too short RL FSR0L ; POLARITY message too long +RF ; master board has no reversers +RG ; too many reversers boards # P - Points PB points:pointmsg ; Firing point when already busy diff --git a/detpic/reverse.asm b/detpic/reverse.asm index e2318cd..4416c10 100644 --- a/detpic/reverse.asm +++ b/detpic/reverse.asm @@ -18,7 +18,7 @@ polarity_cmds_section udata polarity_cmds res maxpics+1 ; Each byte is: ; 11RRRRRR reverse command for slave, waiting to write - ; 00000001 this is not a reversers pic + ; 00000001 this is not a reversers board ; 00000000 we have written any relevant command ; 01000000 sentinel @@ -175,8 +175,43 @@ board_next_none_more_message ;---------------------------------------------------------------------- polarity_master_init - panic morse_URM - ; need to set up polarity_cmds + + load_tblptr picno2revmasks + mov_lfsr polarity_cmds - 1, 0 + mov_lw maxpics + mov_wf t + mov_lw 0x01 ; meaning `not a reversers board' +polarity_master_init_boardloop + mov_wf PREINC0 + rcall polarity_master_init_board_mask_check + rcall polarity_master_init_board_mask_check + dec_f_ifnz t + bra polarity_master_init_boardloop + + tst_f_ifnz polarity_cmds + bra polarity_bad_masternotused + + ; OK, but now we have to work our way back and place + ; the sentinel + mov_lw 0x40 ; meaning `sentinel' + tst_f_ifnz INDF0 + bra polarity_bad_lastpicused +polarity_master_init_truncateloop + mov_wf POSTDEC0 ; overwrite with sentinel + tst_f_ifnz INDF0 ; previous one is also `not reversers board' ? + bra polarity_master_init_truncateloop ; yes + ; no. hah, we have truncated it. + + return + +polarity_master_init_board_mask_check + tblrd_postinc_fixup + tst_f_ifnz TABLAT + clr_f INDF0 ; meaning `reversers board but no command to send' + return + +polarity_bad_masternotused panic morse_RF +polarity_bad_lastpicused panic morse_RG ;---------------------------------------------------------------------- polarity_needwrite -- 2.30.2