chiark / gitweb /
fix totally bogus single-byte serial command handling; consequently rearrange section...
authorian <ian>
Fri, 30 Dec 2005 00:34:55 +0000 (00:34 +0000)
committerian <ian>
Fri, 30 Dec 2005 00:34:55 +0000 (00:34 +0000)
detpic/energy.asm
detpic/panic.asm
detpic/program.asm

index 9fb51ef33b6f0b23f7026a03d8758521e76b838d..5f3032cdaa998c50bf50b560a99cbecef60046fa 100644 (file)
@@ -105,11 +105,9 @@ power_fault_init @
        ; now we are Off
        return
 
+command_power_section code 0x2080
 ;--------------------
-command_power @
-       bra_nc  command_power_off
-       ; command is ON:
-
+command_power_on @
 ; Off -> On; noop in other states
        pinlat_ifl p0_booster_shutdown
        return  ; On or Retry
@@ -123,7 +121,7 @@ command_power @
        goto    cdu_on
 
 ;----------
-command_power_off
+command_power_off @
 ; On -> Off; noop in other states
        pinlat_ifh p0_booster_shutdown
        return  ; Off, Stopping or Persists
@@ -136,6 +134,7 @@ power_off_now
        pin_vh  p0_booster_shutdown
        goto    cdu_off
 
+code2 code
 ;--------------------
 power_fault_intrl @
        bt_f_if0 INTCON3, INT1IF
@@ -143,7 +142,7 @@ power_fault_intrl @
        ; we have a fault:
 
        bc_f    INTCON3, INT1IF
-       rcall   power_off_now
+       call    power_off_now
 
        mov_fw  retry_wait
        bra_z   power_fault_stop ; we were Off or On, goto Stopping
index c3ca79ee982e86ec68dce5cd31d5f2997aaf7ab7..1be0db6c4e2dc7bc55c379d258cb2d18aac1a659 100644 (file)
@@ -542,7 +542,7 @@ near_gots code
 got_aargh @
        panic   morse_T
 
-near_serialrx_table code 0x2100
+command_crashed_section code 0x2100
 ;----------
 command_crashed @
 panic_crashread_commanded @
index 860bf63083998288f9acb9062d1513d2300a5ac7..3549f404515effd03783cb84056e6a64bdf34e0f 100644 (file)
@@ -113,16 +113,15 @@ serialrx_generalmsg @
 ;  FSR0 ->     start of message                undefined
 ;  *FSR0       message                         undefined
 ;
-;                              ; INDF0=MM ww ww ww ww ii ii ii
-       rlc_fw  INDF0           ; W =   ww ww ww ww ii ii ii ??  C=MM Z=00
-       bra_c   serialrx_if_multibyte
+       mov_fw  INDF0
+       bra_n   serialrx_if_multibyte
        bra_z   command_crashed
-       ; single-byte non-0 command, has to be ON or OFF
-       ;       ie supposedly   ; INDF0=zz zz II zz zz zz zz PP  C=zz
-       rrc_fw  INDF0           ; W =   zz zz zz II zz zz zz zz  C=PP
-       xor_lw  0x10            ; W =   zz zz zz zz zz zz zz zz  C=PP Z=OK
-       bra_n   serialrx_bad
-       goto    command_power
+
+       xor_lw  0x21
+       bra_z   command_power_on
+       xor_lw  0x01
+       bra_z   command_power_off
+       bra     serialrx_bad
 
 ;-----
 serialrx_if_multibyte
@@ -149,15 +148,12 @@ serialrx_if_multibyte
        goto    serialrx_bad            ; 1 1110 xxx
        goto    serialrx_bad            ; 1 1111 xxx
 
-       goto    serialrx_bad    ; 0 0000 xxx
-       goto    serialrx_bad    ; 0 0001 xxx
-       goto    serialrx_bad    ; 0 0000 xxx
-
 ;-----
 serialrx_bad
        mov_ff  INDF0, t
        panic   morse_HX
 
+code2 code
 ;--------------------
 command_ping
        mov_fw  POSTINC0
@@ -169,7 +165,6 @@ command_ping
 
 command_ping_bad panic morse_HP
 
-code2 code
 ;======================================================================
 ; SLAVE