From: ian Date: Mon, 26 Dec 2005 23:34:09 +0000 (+0000) Subject: check that point is on a board with points X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=ea9450a453e1ec2051e8b53f9567df54800b3116;p=trains.git check that point is on a board with points --- diff --git a/detpic/morse.messages b/detpic/morse.messages index 578985c..1c0d2bc 100644 --- a/detpic/morse.messages +++ b/detpic/morse.messages @@ -53,7 +53,6 @@ TI5 ; for iwj # Unimplemented things UEC UER -UPC UCT UCI UCP @@ -88,6 +87,7 @@ RL FSR0L ; POLARITY message too long PB points:pointmsg ; Firing point when already busy PI points:pointmsg,T3CON ; Unexpected Timer 3 interrupt PU points:pointmsg ; Firing nonexistent point +PS points:pointslave,points:pointmsg ; Firing point on nonexistent board PF ::t ; Flash mentions point not on board PX ; Host sent >2-byte POINT command PM ; Firing point when master/CDU busy diff --git a/detpic/points.asm b/detpic/points.asm index c194bb6..b7c02cd 100644 --- a/detpic/points.asm +++ b/detpic/points.asm @@ -20,6 +20,10 @@ ptix2latbit_section udata ptix2latbit pointslave res 1 ; 00SS Sss0 ie slave*2 ! pointmsg res 1 + udata 0x340 +slave2ptinfo res maxpics +slave2ptinfo_anypoints equ 0 + ;====================================================================== ;====================================================================== @@ -240,6 +244,23 @@ point_timer_init_endif_masterslave points_master_init clr_f pointslave clr_f pointmsg + + load_tblptr picno2ptmap + mov_lfsr slave2ptinfo-1, 0 + mov_lw maxpics + mov_wf t +points_master_init_board_loop + clr_f PREINC0 + mov_lw maxpoints/8 +points_master_init_byte_loop + tblrd_postinc_fixup + tst_f_ifnz TABLAT + bs_f INDF0, slave2ptinfo_anypoints + dec_w_ifnz + bra points_master_init_byte_loop + dec_f_ifnz t + bra points_master_init_board_loop + return ;---------------------------------------------------------------------- @@ -266,9 +287,8 @@ command_point and_lw 0x06 ; W = 0000 0ss0 ior_wff pointslave ; pointslave = 00SS Sss0 - panic morse_UPC ; should check that this slave exists rr_fw pointslave ; W = 000S SSss - bra_nz point_needwrite_yes + bra_nz command_point_ifslave mov_fw pointmsg goto point_local_do @@ -276,6 +296,15 @@ command_point command_point_badmsg panic morse_PX command_point_busy panic morse_PB +;---------- +command_point_ifslave + mov_lfsr slave2ptinfo, 0 + add_wff FSR0L + bt_f_if1 INDF0, slave2ptinfo_anypoints + goto i2c_needwrite + ; oops: + panic morse_PS + ;---------- points_needwrite rr_fw pointslave ; W = 000S SSss