chiark / gitweb /
Implement waggle
authorian <ian>
Sat, 10 May 2008 11:43:12 +0000 (11:43 +0000)
committerian <ian>
Sat, 10 May 2008 11:43:12 +0000 (11:43 +0000)
detpic/Makefile
detpic/common.inc
detpic/detect.asm
detpic/mascan.asm
detpic/morse.messages
detpic/points.asm
detpic/program.asm
detpic/variables.asm
detpic/waggle.asm

index b947e9eb97303753b2077536ed85c5ae1a736da7..32ad5eff36dd85967277cbc4fa57d640a95c0b67 100644 (file)
@@ -4,7 +4,7 @@ PICNOS=         0 1 2
 
 FILES=                 variables vectors                               \
                        panic routines-led i2clib+panic                 \
-                       misc detect points serout                       \
+                       misc detect points waggle serout                \
                        syncwrite mascan energy                         \
                        reverse nmra-stream tick watchdog
 
index afbd0556f6899858863b6dfc1c541416f1d788ea..c92abfa3d5b82c981732217a7cb80b5621798b18 100644 (file)
@@ -49,7 +49,7 @@ tickdiv_us equ tick_us * tickdiv
 ;              interrupt, or any routine run during initialisation.
 ;              May therefore not be used in background loop with
 ;              interrupts enabled.  May not be used by high-priority
-;              ISR (unless explicitly saved, eg isrh_fsr0_{save,restore}).
+;              ISR (unless explicitly saved, eg intrlh_fsr0_{save,restore}).
 ;
 ; High ISR     May be used/trashed by any routine run in high-priority
 ;              interrupt, or any routine run during initialisation.
@@ -189,14 +189,14 @@ enter_interrupt_low macro
        mov_ff  STKPTR, isr_low_save_stkptr
        endm
 
-intrh_fsr0_save macro
-       mov_ff  FSR0L, isr_high_save_fsr0
-       mov_ff  FSR0H, isr_high_save_fsr0+1
+intrlh_fsr0_save macro ; Low ISR on master, High ISR on slave
+       mov_ff  FSR0L, isr_lh_save_fsr0
+       mov_ff  FSR0H, isr_lh_save_fsr0+1
        endm
 
-intrh_fsr0_restore macro
-       mov_ff  isr_high_save_fsr0,   FSR0L
-       mov_ff  isr_high_save_fsr0+1, FSR0H
+intrlh_fsr0_restore macro
+       mov_ff  isr_lh_save_fsr0,   FSR0L
+       mov_ff  isr_lh_save_fsr0+1, FSR0H
        endm
 
 intrl_handled_core macro ; for internal use only
index 49bcf740ebc35615d25563d19fd7354913ddadb7..3d57473ae027b9760542b707a073a02d5d3a26fb 100644 (file)
@@ -50,6 +50,7 @@
 ;
 ;      11RRRRRR        Set reverse to RRRRRR, see reverse.asm
 ;      100PPPPP        Fire point PPPPP
+;      101WWWWX        Set waggler WWWW to X
 ;
 ;      00000000        Acknowlege that slave has crashed, and
 ;                       switch into crash readout mode
index 36c16f495fdfed36b1f8f1e6c31ce5d9a7334a06..9a1b8200ccfbe7e4d8a6bd4546a3e15c7a2218f5 100644 (file)
@@ -42,6 +42,7 @@ i2cmu_write_next_byte
        Dl 0x91
        ; add calls to getwritebyte_<foo> here:
        call    polarity_getwritebyte
+       call    waggle_getwritebyte
        call    points_getwritebyte
        ; end of list of calls to getwritebyte_<foo>
        ; so, no-one wants this slave:
@@ -253,6 +254,7 @@ i2cmu_done
        ; Anyone else to write to ?
        ; add calls to needwrite_<foo> here:
        call    polarity_needwrite
+       call    waggle_needwrite
        call    points_needwrite
        ; end of list of calls to needwrite_<foo>
 
index 5a23384d0061bd2e24dfb52dbb4d41d27fbd116b..e35a02bcafd477e1b6e0bde1fadb0ecd66bf5956 100644 (file)
@@ -57,6 +57,11 @@ IL   INTCON,INTCON3,PIR1,PIR2 ; Interrupt source not found (low pri.)
 # W - watchdog
 WX                                     ; bad watchdog command
 
+# A - waggles
+AX                                     ; Host sent >2-byte WAGGLE command
+AB                                     ; Host WAGGLE when already waggling
+AU                                     ; Waggling nonexistent waggle
+
 # Messages for i2clib, S*
 SM     i2clib+panic:st,:sspstat,:sspcon1,:sspcon2 ; m.,i., ctrlr bad state
 SS     SSPSTAT,SSPCON1                 ; s.,i., controller bad state
index 8f711a19b84a824270af3e4381ce1459affe96f3..9ccc07bf05ff3e406763ccebfb680116cda7af9f 100644 (file)
@@ -56,9 +56,9 @@ point_local_do @
 
        mov_wf  pointmsg        ; pointmsg = SS zz zz pp  pp pp pp pp
 
-       intrh_fsr0_save         ; point_set_pin uses FSR0, see below
+       intrlh_fsr0_save        ; point_set_pin uses FSR0, see below
        call    point_set_pin
-       intrh_fsr0_restore
+       intrlh_fsr0_restore
 
        clr_f   TMR3L           ; also copies TMR3H into actual timer register
        bs_f    T3CON, TMR3ON
@@ -234,9 +234,6 @@ points_needwrite @
        bt_f_if1 STATUS, Z ; nothing ?
        return
        ; we need to write something:
-;...
-;----------
-point_needwrite_yes
        pop
        goto    i2c_needwrite
 
index 43f7fd724e6a3e7e1323a81bf09119646acfd75a..b210f21e986dbd60970199c0f59de4770b2bb094 100644 (file)
@@ -221,6 +221,8 @@ i2csu_write_data
        bra     polarity_local_do
        bt_w_if0 5
        bra     point_local_do
+       bra     waggle_local_do
+
 i2csu_write_if_bad
        mov_wf  t
        panic   morse_DX
index 978571eb5b50f37163667322822bb4782561ca6e..d06b87c8d86cef2fd8d4fdc158c177473e06aaa0 100644 (file)
@@ -24,7 +24,7 @@ isr_low_save_w                res     1 ; see {enter,return}_interrupt_low
 isr_low_save_status    res     1 ;  in common.inc
 isr_low_save_stkptr    res     1 ;
 
-isr_high_save_fsr0     res     2 ; for isrh_fsr0_{save,restore}
+isr_lh_save_fsr0       res     2 ; for intrlh_fsr0_{save,restore}
 
 xdebug                 res     8
 
index ab56f0c72a6f2d22985fbaf61cd643ac56b06d48..f5beee381e18e8374271c45bce021e10276bea0d 100644 (file)
@@ -84,29 +84,25 @@ wagglers_local_init
 
 ;----------------------------------------------------------------------
 command_waggle @
-                               ;       ie              1010 1Yss
-                               ;                       OSSS wwww
+                               ;       ie              1010 1sss
+                               ;                       OSS wwwwV
        tst_f_ifnz waggle_message
        bra     command_waggle_busy
 
-       mov_fw  POSTINC0                ; W =           1010 1Yss
-       and_lw  0x03                    ; W =           0000 00ss
-       mov_lw  waggle_slave            ; slave =       0000 00ss
+       mov_fw  PREINC0                 ; F0->[1], W =  OSS wwwwV  N = 0
+       bra_n   command_waggle_badmsg
+       and_lw  0x1f                    ; W =           000 wwwwV
+       xor_wff INDF0                   ; [1] =         0SS 00000
+       ior_lw  0xa0                    ; W =           101 wwwwV
+       mov_wf  waggle_message          ; message =     101 wwwwV
 
-       rr_fw   INDF0                   ; W =           w0SSS www
-       rr_w                            ; W =           ww0SSS ww
-       and_lw  0x1c                    ; W =           000S SS00
-       add_wff waggle_slave            ; slave =       000S SSss  C = 0
+       rr_fw   POSTDEC0                ; F0->[0], W =  00SS 0000
+       rr_w                            ; W =           000S S000
+       xor_wfw INDF0                   ; W =           101S Tsss
+       xor_lw  0xa8                    ; W =           000S Ssss
+       mov_wf  waggle_slave            ; slave =       000S Ssss
 
-                                       ;                          C = Y
-       rlc_fw  INDF0                   ; W =           sss wwwwY  C = O
-       bra_c   command_waggle_badmsg
-       and_lw  0x1f                    ; W =           000 wwwwY
-       ior_lw  0xa0                    ; W =           101 wwwwY
-       mov_wf  waggle_message          ; message =     101 wwwwY
-
-       tst_f_ifnz waggle_slave
-       bra     waggle_local_do
+       bra_z   waggle_local_do
        goto    i2c_needwrite
 
 ;----------