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 c4ea72ddae54e73ee42cdb7f71b99e6986058c4c..48ae077e9effc7e915cebea8baf1e439f95dd93b 100644 (file)
@@ -59,8 +59,6 @@ master_init
 ; Master-specific initialisation.
        call    memory_erase
        clr_f   flags
- set_f xdebug+7
- clr_f xdebug+6
        call    serial_init
        call    i2cm_init
        call    serialtxbuf_init
@@ -75,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
- ;Dl 0x01
        call    nmra_serialrx_intrl
- ;Dl 0x02
        call    power_fault_intrl
- ;Dl 0x03
        call    serialtxfc_intrl
- ;Dl 0x04
        call    serialtx_intrl
- ;Dl 0x05
        call    points_local_intrl
- ;Dl 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:
@@ -112,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
 
 ;-----
@@ -156,7 +169,6 @@ command_ping
        call    serial_addbyte
        mov_fw  t
        bra_n   command_ping_bad
- mov_wf xdebug+6
        goto    serial_addbyte_another
 
 command_ping_bad panic morse_HP