From: ian Date: Sat, 10 May 2008 20:38:29 +0000 (+0000) Subject: wagglers work - before remove debug X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=988daff18809b3ad659590c618d8514705402eba;p=trains.git wagglers work - before remove debug --- diff --git a/detpic/program.asm b/detpic/program.asm index b210f21..8f2595d 100644 --- a/detpic/program.asm +++ b/detpic/program.asm @@ -38,6 +38,7 @@ common_local_init call points_local_init call polarity_local_init call detect_local_init + call wagglers_local_init return ;---------------------------------------- @@ -64,6 +65,7 @@ master_init call serialtxbuf_init call polarity_master_init call points_master_init + call wagglers_master_init call common_local_init call nmra_init call serialtxfc_init @@ -154,7 +156,7 @@ serialrx_if_multibyte goto command_polarity ; 1 0010 xxx goto command_watchdog ; 1 0011 xxx goto command_point ; 1 0100 xxx - goto serialrx_bad ; 1 0101 xxx + goto command_waggle ; 1 0101 xxx goto serialrx_bad ; 1 0110 xxx goto serialrx_bad ; 1 0111 xxx goto serialrx_bad ; 1 1000 xxx diff --git a/detpic/waggle.asm b/detpic/waggle.asm index f5beee3..73c9599 100644 --- a/detpic/waggle.asm +++ b/detpic/waggle.asm @@ -19,8 +19,8 @@ waggle_lpins_section udata waggle_lpins ; MASTER - Access bank variables etc. udata_acs ; idle busy -waggle_message res 1 ; 00000000 101 wwwwY -waggle_slave res 1 ; ???????? 000 SSSss +waggle_slave res 1 ; 11111111 000 SSSss +waggle_message res 1 ; ???????? 101 wwwwY ;====================================================================== ; LOCAL WAGGLERS @@ -36,23 +36,30 @@ waggle_local_do @ mov_wf t ; t = 101 WWWWY + mov_wf xdebug intrlh_fsr0_save - mov_lfsr waggle_lpins | b'011110', 0 - ; FSR0 = aaaa 101 11110 - and_wff FSR0L ; FSR0 = aaaa 101 WWWW0 - ; INDF0 = bbbb bbbb LAT*-addr - mov_fw POSTINC0 ; W = bbbb bbbb (one-bit mask) - ; INDF0 = LAT*-addr + mov_lfsr waggle_lpins | 0x01, 0 + ; FSR0 = aaaa 000 00001 + ior_wff FSR0L ; FSR0 = aaaa 101 WWWW1 + ; *FSR0 = bbbb bbbb (one-bit mask) + mov_ff FSR0L, xdebug+1 + mov_fw POSTDEC0 ; W = bbbb bbbb + ; *FSR0 = LAT*-addrl + mov_wf xdebug+2 bra_z waggle_nonexistent - mov_ff INDF0, FSR0L + mov_ff INDF0, FSR0L ; FSR0L = LAT*-addr + mov_ff FSR0L, xdebug+3 set_f FSR0H ; FSR0 = 1111 LAT*-addr - ; INDF0 = + ; *FSR0 = bt_f_if0 t, 0 ; test Y bra waggle_ifclear ; set: + mov_wf xdebug+4 + mov_ff FSR0H, xdebug+6 + mov_ff FSR0L, xdebug+5 ior_wff INDF0 ;... waggle_local_done @@ -73,20 +80,25 @@ waggle_nonexistent ; LOCAL WAGGLERS - INITIALISATION ;---------------------------------------- -wagglers_local_init +wagglers_local_init @ outputs_local_init picno2wagglemap, maxwaggles, waggle_lpins, bkwaggleix2portnumbitnum return ;====================================================================== ; MASTER -; No initialisation needed; we just pass on the commands as they come in. +; No serious initialisation needed; +; we just pass on the commands as they come in. + +wagglers_master_init @ + set_f waggle_slave + return ;---------------------------------------------------------------------- command_waggle @ ; ie 1010 1sss ; OSS wwwwV - tst_f_ifnz waggle_message + bt_f_if0 waggle_slave, 7 bra command_waggle_busy mov_fw PREINC0 ; F0->[1], W = OSS wwwwV N = 0 @@ -107,7 +119,7 @@ command_waggle @ ;---------- waggle_needwrite @ - bt_f_if1 waggle_message, 7 + bt_f_if1 waggle_slave, 7 return pop mov_fw waggle_slave @@ -116,7 +128,9 @@ waggle_needwrite @ ;---------- waggle_getwritebyte @ mov_fw waggle_slave + bra_n waggle_getwritebyte_ifidle cmp_fw_ifne cwslave +waggle_getwritebyte_ifidle return ;... mov_lw 0x04 ; WAGGLED @@ -125,7 +139,7 @@ waggle_getwritebyte @ ; that's a foregone conclusion mov_fw waggle_message - clr_f waggle_message + set_f waggle_slave goto i2c_getwritebyte_yes command_waggle_badmsg panic morse_AX