From: ian Date: Mon, 19 Dec 2005 11:50:47 +0000 (+0000) Subject: working on master program, serial despatch table, etc.; make master.asm compile to... X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=f9a48254eb70c6cc12e7cbf989d7d930b9f790e8;p=trains.git working on master program, serial despatch table, etc.; make asm compile to .o (but not tie it in yet) --- diff --git a/detpic/final.inc b/detpic/final.inc index 66e74ec..947ef64 100644 --- a/detpic/final.inc +++ b/detpic/final.inc @@ -13,5 +13,7 @@ include ../iwjpictest/syncwrite.inc include reverse.fin include program.fin + include nmra-stream.fin + include power.fin end diff --git a/detpic/master.asm b/detpic/master.asm index 6986573..87711aa 100644 --- a/detpic/master.asm +++ b/detpic/master.asm @@ -20,9 +20,11 @@ master call serial_interrupts_init call nmra_init - fixme up to here + panic morse_TI4 +; fixme up to here call detect_slave_init + clr_f PCLATU bs_f INTCON, GIEH bs_f INTCON, GIEL @@ -35,10 +37,85 @@ master ;---------- master_interrupt_low enter_interrupt_low - call serialrx_intrl - call serialtx_intrl + call nmra_serialrx_intrl + ;call serialtx_intrl call points_local_intrl call i2cm_intrl panic morse_IL +serialrx_table_section code 0x2000 +;-------------------- +serialrx_generalmsg +; FSR0 -> start of message +; ; 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 + 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 + +;----- +serialrx_if_multibyte + rr_fw INDF0 ; W = ii MM ww ww ww ww ii ii + and_lw 0x3c ; W = zz zz ww ww ww ww zz zz + add_wff PCL + ; <--- here is zero + + goto serialrx_bad ; 1 0000 xxx + goto command_ping ; 1 0001 xxx + goto command_polarity ; 1 0010 xxx + goto serialrx_bad ; 1 0011 xxx + goto command_point ; 1 0100 xxx + goto serialrx_bad ; 1 0101 xxx + goto serialrx_bad ; 1 0110 xxx + goto serialrx_bad ; 1 0111 xxx + goto serialrx_bad ; 1 1000 xxx + goto serialrx_bad ; 1 1001 xxx + goto serialrx_bad ; 1 1010 xxx + goto serialrx_bad ; 1 1011 xxx + goto serialrx_bad ; 1 1100 xxx + goto serialrx_bad ; 1 1101 xxx + 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 + +; bra_z crashed_master_do +; mov_fw INDF0 +; bra_z crashed_master_do +; +; serialrx_check 0x00, 0x21, command_power_on +; serialrx_check 0x21, 0x20, command_power_off +; +; and_lw 0xf8 ; W^0x20 = MM ww ww ww ww zz zz zz +; +; serialrx_check 0x00, 0xa0, point_master_do +; serialrx_check 0xa0, 0x88, ping_master_do +; serialrx_check 0x88, 0x90, polarity_master_do +; +; serialrx_check 0x90, 0x90, polarity_master_do +; +; mov_wf t ; t = MM ww ww ww ww zz zz zz +; +; xor_lw 0x +; +; and_lw + + +;-------------------- +command_ping + panic morse_UC + +;---------------------------------------------------------------------- include final.inc diff --git a/detpic/master.inc b/detpic/master.inc new file mode 100644 index 0000000..2e98250 --- /dev/null +++ b/detpic/master.inc @@ -0,0 +1 @@ +; extern master diff --git a/detpic/morse.messages b/detpic/morse.messages index 2111b5b..34c15e4 100644 --- a/detpic/morse.messages +++ b/detpic/morse.messages @@ -20,6 +20,7 @@ # Miscellaneous E ; `expected'; we were told to panic +HX ::t ; host sent unknown command # Problematic interrupts IH INTCON,INTCON3,PIR1,PIR2,PIR3 ; Interrupt source not found (high pri.) @@ -40,6 +41,7 @@ X test-sofar:ch ; bad character received from host # Unimplemented things UP +UC UL UM UE diff --git a/detpic/nmra-stream.fin b/detpic/nmra-stream.fin new file mode 100644 index 0000000..6253733 --- /dev/null +++ b/detpic/nmra-stream.fin @@ -0,0 +1,4 @@ + extern nmra_init + extern serial_init + extern serial_interrupts_init + extern nmra_serialrx_intrl diff --git a/detpic/panic.fin b/detpic/panic.fin index 42d7ca1..dfa3e9f 100644 --- a/detpic/panic.fin +++ b/detpic/panic.fin @@ -5,3 +5,4 @@ extern i2csu_write_panicd extern i2csu_read_begin_panicd extern i2csu_read_another_panicd + extern command_crashed diff --git a/detpic/power.asm b/detpic/power.asm index 1be9017..83bdab0 100644 --- a/detpic/power.asm +++ b/detpic/power.asm @@ -1,5 +1,8 @@ ;====================================================================== +command_power +; C 1 iff command is ON undefined + power_on ??? ; from cebpic/nmra-stream.asm's setup bcf PORTB,2,0 ; booster shutdown L diff --git a/detpic/power.fin b/detpic/power.fin new file mode 100644 index 0000000..fd73b2f --- /dev/null +++ b/detpic/power.fin @@ -0,0 +1 @@ + extern command_power