From: ian Date: Sun, 27 Apr 2008 23:04:36 +0000 (+0000) Subject: sort of ability to use debug buffer in nmra output routines X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=a0c4ac039624475b0d566a08a9a6cc4e17600322;p=trains.git sort of ability to use debug buffer in nmra output routines --- diff --git a/detpic/nmra-stream.asm b/detpic/nmra-stream.asm index 9637e76..14d8775 100644 --- a/detpic/nmra-stream.asm +++ b/detpic/nmra-stream.asm @@ -79,6 +79,10 @@ macros ifndef SLOW_VERSION debug macro debugvalue + ; uncomment this to get copious stuff in the debug buffer + ; NB that strictly this does not work because debugbyte messes with + ; FSR0[LH] and if we interrupt debugbyte we will trash FSR0 + ; Dl debugvalue endm endif @@ -235,7 +239,10 @@ nmra_serialrx_intrl @ ; serial_receive: -; debug 'h' ; write 'h' to serial port + debug 'h' ; write 'h' to serial port + Df fromserial + Df totrack + bt_fa_if1 RCSTA,FERR ; if FERR set (= framing error), then panic goto panic_ferr bt_fa_if1 RCSTA,OERR ; if OERR set (= overrun error), then panic @@ -244,18 +251,18 @@ nmra_serialrx_intrl @ mov_ff fromserial,FSR0L ; set low byte of INDF0 pointer mov_lw bufferpage mov_wfa FSR0H ; set high byte of INDF0 pointer -; debug '1' + debug '1' mov_fw RCREG ; get received byte mov_wf INDF0 ; copy to received register ; check whether bit 7 is clear. ; If so, move to next buffer (or process other kind of message) bra_nn end_message ; (STATUS N still from mov_fw RCREG) -; debug '3' + debug '3' ; If not, move to next byte inc_fa fromserial ; advance fromserial pointer by 1 byte -; debug '4' + debug '4' mov_lw 0x0f and_wfw fromserial @@ -320,6 +327,10 @@ master_interrupt_high @ ; timer0 interrupt debug ',' ; write ',' to serial port + Df fromserial + Df totrack + Df nmractrl + bc_fa INTCON,TMR0IF ; clear interrupt-set bit ifdef SLOW_VERSION @@ -456,11 +467,12 @@ advance_read_buffer ; aaaabbbb -> bbbbaaaa -> bbbb(aaaa+1) -> 0000(aaaa+1) -> (aaaa+1)0000 bt_f_if1 totrack, 6 ; were we doing watchdog broadcasts ? bra advance_read_buffer_ifwatchdog + mov_fw totrack add_lw 0x10 and_lw 0x30 mov_wf totrack - debug '9' ; write 'v' to serial port + debug '9' ; write '9' to serial port inc_f acknmra bs_f PIE1, TXIE ; ensure we tell host to send us more