HN ; host sent too much NMRA - buffers full
HM ; host sent too much NMRA - ack count overflow
HB ; data for host overran buffer
+HP ; host sent >2-byte PING command
# Regarding communications by master with slaves
MX ; slave (or intern) sent bad extra byte
PI points:pointmsg,T3CON ; Unexpected Timer 3 interrupt
PU points:pointmsg ; Firing nonexistent point
PF ::t ; Flash mentions point not on board
+PX ; Host sent >2-byte POINT command
+PM ; Firing point when master/CDU busy
;----------------------------------------
; LOCAL POINTS - Variables, hardware, etc.
;
-; Idle Firing
-; Timer 3 Off On, counting up
-; pointmsg undefined message from master
+; Idle Idle Firing Charging
+; (slave) (master) (master)
+; Timer 3 Off Off On, counting up Off
+; pointmsg undefined 0x00 message from master message
ptix2latbit equ 0x300 ; has to be a multiple of 0x100
ptix2latbit_section udata ptix2latbit
; for unused point, 0x00 and 0x00
udata_acs
+pointslave res 1 ; 00SS Sss0 ie slave*2 !
pointmsg res 1
;======================================================================
;======================================================================
+;----------------------------------------------------------------------
+command_point
+ ; FSR0 -> 1 0100 TTT O TTTTTTT
+ ; ie 1010 0SSS
+ ; OssT tttt
+ tst_f_ifnz pointmsg
+ bra command_point_busy
+
+ swap_fw POSTINC0 ; W = 0SSS 1010
+ and_lw 0x70 ; W = 0SSS 0000
+ rr_w ; W = 00SS S000
+ mov_wf pointslave ; pointslave = 00SS S000
+
+ mov_fw INDF0 ; W = OssT tttt N = O
+ bra_n command_point_badmsg
+ ; OK: ; W = 0ssT tttt
+ and_lw 0x1f ; W = 000T tttt
+ bs_w 7 ; W = 100T tttt
+ mov_wf pointmsg ; pointmsg = 100T tttt
+
+ swap_fw INDF0 ; W = tttt 0ssT
+ and_lw 0x06 ; W = 0000 0ss0
+ ior_wff pointslave ; pointslave = 00SS Sss0
+
+ rr_fw pointslave ; W = 000S SSss
+ bra_nz point_needwrite_yes
+
+ mov_fw pointmsg
+ goto point_local_do
+
+command_point_badmsg panic morse_PX
+command_point_busy panic morse_PB
+
+;----------
+points_needwrite
+ rr_fw pointslave ; W = 000S SSss
+ bt_f_if1 STATUS, Z ; nothing ?
+ return
+ ; we need to write something:
+;...
+;----------
+point_needwrite_yes
+ pop
+ goto i2c_needwrite
+
+;----------
+points_getwritebyte
+ rr_fw pointslave
+ xor_wfw cwslave
+ bt_f_if0 STATUS, Z ; right slave ?
+ return
+ ; yes:
+ mov_fw pointslave
+ goto i2c_getwritebyte_yes
+
+;======================================================================
+; CDU
+
near_gots code
cdu_init panic morse_UCI
got_pointed panic morse_UCP
+;======================================================================
include final.inc