chiark / gitweb /
Send HELLO as a result of all slaves being online. Do not crash if slave is slow...
[trains.git] / detpic / panic.asm
index 65e84fa96777357f74174f9a6e2d63bb89e61f40..663d7fe443fe2b33109e52aba34b013fe1d5e871 100644 (file)
@@ -428,7 +428,7 @@ panicd_process_input_byte
 ;----------
 write_ifnot_00
        bt_f_if0 panicst, panicst_acked ; well, ignore that !
-       return
+       bra     write_only_tellmode
        ; OK, we have an instruction:
 
        bt_w_if1 7 ; huh?
@@ -436,16 +436,24 @@ write_ifnot_00
        bt_w_if1 6
        bra     panic_crashread_setpointer
        bt_f_if0 idloc1,idloc1_master
-       return ; all the remaining options are for master only
+       bra     write_ifnot0_ifnotmaster
+       ; the next few options are for master only:
+
        bt_w_if1 5
        bra     write_if_master_slaveselect
        bt_w_if1 4
        bra     write_if_master_masterread
-       bt_w_if1 3
+       bt_w_if0 3
        bra     write_if_master_slaveread
-
-       xor_lw  0x11
+;...
+write_ifnot0_ifnotmaster
+       xor_lw  0x09
        bra_z   panic_reset
+       xor_lw  0x09
+;...
+write_only_tellmode
+       xor_lw  0x0a
+       bra_z   panic_tellmode
        ; nope, well, we ignore it
        return
 
@@ -466,10 +474,21 @@ panic_crashread_setpointer
 panic_noop
        return
 
-;======================================================================
+;======================================================================#
+; SPECIAL COMMANDS 0x08..0x0f
+
+;----------
 panic_reset
        reset
 
+;----------
+panic_tellmode
+       bt_f_if0 idloc1,idloc1_master
+       return
+       mov_lw  0x0b
+       bc_f    panicst, panicst_acked
+       goto    serial_write_char
+
 ;======================================================================
 ; MASTER READOUT AND MASTER READOUT OF SLAVES
 
@@ -535,6 +554,10 @@ pan_i2cmu_done
        mov_lw  ' '
        goto    serial_write_char
 
+;----------
+pan_i2cmu_slave_no_ack
+       i2cpanic morse_SP
+
 ;======================================================================
 ; SLAVE I2C