From 3d7baac8332c9d54b7693147f7ef0a5a9d460fdb Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 18 Dec 2005 19:50:27 +0000 Subject: [PATCH] test-sofar supports crashread protocol --- detpic/test-sofar.asm | 53 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/detpic/test-sofar.asm b/detpic/test-sofar.asm index 2b256f6..5b854bf 100644 --- a/detpic/test-sofar.asm +++ b/detpic/test-sofar.asm @@ -67,6 +67,7 @@ ch res 1 mode res 1 mode_readhex equ 0 +mode_crashread res 1 readwrite res 1 ; ff means we're writing or going to write, FSR1 @@ -96,10 +97,17 @@ master_interrupt_low ; buffer is 0x200 onwards ; FSR0 is buffer pointer ; FSR2 is the write cursor +; FSR1 is the crash readout protocol cursor +; (and may be trashed by non-crash-readout things) master clr_f mode + call bitnum2bit_init + call points_local_init + call polarity_local_init + call detect_local_init + call serial_setup call i2cm_init call led_green @@ -138,7 +146,20 @@ serialu_read_char mov_lw ~0x1f and_wfw ch - bra_z m_ch_bad + bra_z m_ch_readown + + ; digit ? + mov_fw ch + add_lw -('9'+1) + bra_nn m_ch_notdigit + add_lw ('9'+1) - '0' + bra_z m_ch_0 + bra_nn m_ch_digit + +m_ch_notdigit + + bt_f_if1 mode, mode_crashread + bra m_ch_crashsetown mov_lw ',' xor_wfw ch @@ -164,14 +185,6 @@ serialu_read_char xor_wfw ch bra_z m_ch_dollar - mov_fw ch - add_lw -('9'+1) - bra_nn m_ch_notdigit - add_lw ('9'+1) - '0' - bra_z m_ch_0 - bra_nn m_ch_digit - -m_ch_notdigit mov_fw ch mov_wf POSTINC0 clr_f INDF0 @@ -200,9 +213,31 @@ m_ch_hat ;---------- m_ch_setreadwrite mov_fw ch + bra_z m_ch_startcrashread mov_wf readwrite return +;---------- +m_ch_crashsetown + mov_fw ch + goto panic_crashread_setpointer + +;---------- +m_ch_readown + bc_f ch, 4 ; ch is now our byte counter +m_ch_readown_loop + mov_fw POSTINC1 + call serial_write_char + dec_f_ifnz ch + bra m_ch_readown_loop + return + +;---------- +m_ch_startcrashread + bs_f mode,mode_crashread + mov_lfsr 0x0,1 + return + ;---------- m_ch_comma goto i2cm_read_another -- 2.30.2