chiark / gitweb /
Send HELLO as a result of all slaves being online. Do not crash if slave is slow...
[trains.git] / detpic / program.asm
index 557e316d3bfb7435e78f32d7ec677b9b29c0024f..48ae077e9effc7e915cebea8baf1e439f95dd93b 100644 (file)
@@ -59,7 +59,6 @@ master_init
 ; Master-specific initialisation.
        call    memory_erase
        clr_f   flags
- set_f xdebug+7
        call    serial_init
        call    i2cm_init
        call    serialtxbuf_init
@@ -74,32 +73,45 @@ master_init
        call    power_polarising_init
        call    power_fault_init
        call    watchdog_init
- clr_f xdebug+0
+       call    i2c_consider_restartread ; sends hello when all slaves ack'd
        return
 
 ;----------------------------------------
 master_interrupt_low @
        enter_interrupt_low
- D 0x80
+       Dl 0x80
+       Df      INTCON
+       Df      INTCON2
+       Df      INTCON3
+       Df      PIR1
+       Df      PIR2
+       Df      PIR3
+       Dl 0x8d
        call    tick_intrl
- D 0x01
        call    nmra_serialrx_intrl
- D 0x02
        call    power_fault_intrl
- D 0x03
        call    serialtxfc_intrl
- D 0x04
        call    serialtx_intrl
- D 0x05
        call    points_local_intrl
- D 0x06
        call    i2cm_intrl
- bs_f  xdebug+0, 5
+       Dl 0x8e
+       Df      INTCON
+       Df      INTCON2
+       Df      INTCON3
+       Df      PIR1
+       Df      PIR2
+       Df      PIR3
+       Dl 0x8f
        panic   morse_IL
 
 ;----------------------------------------------------------------------
 serialrx_table_section code    0x2000
 
+;--------------------
+command_tellmode
+       mov_lw  0x09
+       goto    serial_addbyte
+
 ;--------------------
 serialrx_generalmsg @
 ;command_<something>  has same calling convention:
@@ -111,10 +123,12 @@ serialrx_generalmsg @
        bra_n   serialrx_if_multibyte
        bra_z   command_crashed
 
-       xor_lw  0x21
+       xor_lw  0x11
        bra_z   command_power_on
-       xor_lw  0x01
+       xor_lw  0x10 ^ 0x11
        bra_z   command_power_off
+       xor_lw  0x0a ^ 0x10
+       bra_z   command_tellmode
        bra     serialrx_bad
 
 ;-----