improved "run" code.

This commit is contained in:
Martin Preuss
2025-07-07 21:44:40 +02:00
parent 4f497fc41a
commit 245d44c05d
7 changed files with 126 additions and 72 deletions

View File

@@ -147,20 +147,32 @@ comOnUart0StartReading:
; ---------------------------------------------------------------------------
; @routine ComOnUart0_Run @global
;
; @return CFLAG set if something done, cleared otherwise
; @clobbers all
ComOnUart0_Run:
ldi yl, LOW(comOnUart0_iface)
ldi yh, HIGH(comOnUart0_iface)
ldd r16, Y+UART_HW2_IFACE_OFFS_MODE
clr r18
ComOnUart0_Run_loop:
push r16 ; current state
rcall comOnUart0RunMode ; (all but Y)
pop r17 ; previous state (pop from r16 into r17)
push r18
push r16 ; current state
rcall comOnUart0RunMode ; (all but Y)
pop r17 ; previous state (pop from r16 into r17)
pop r18
; read new state
ldd r16, Y+UART_HW2_IFACE_OFFS_MODE
cp r16, r17
brne ComOnUart0_Run_loop ; state changed, run again
breq ComOnUart0_Run_loopEnd
ldi r18, 1
rjmp ComOnUart0_Run_loop ; state changed, run again
ComOnUart0_Run_loopEnd:
tst r18
clc
breq ComOnUart0_Run_end
sec
ComOnUart0_Run_end:
ret
; @end