avr: reduce register use in com2WaitForDataState1ms

This commit is contained in:
Martin Preuss
2023-04-22 12:12:19 +02:00
parent 3b44fb9c5b
commit 462515b566

View File

@@ -189,23 +189,22 @@ com2WaitForAttnHigh_done:
; ---------------------------------------------------------------------------
; com2WaitForDataState1ms
;
; Waits up to COM2_MAXWAIT_US loops for high ATTN line
; Waits up to 100ms for high DATA line
; IN:
; - R16: state to wait for (00 for low, 0xff for high)
; OUT:
; - CFLAG: set if state reached, cleared otherwise
; REGS: R24 (R22)
; REGS: R17, R22
com2WaitForDataState1ms:
ldi r24, 100
ldi r17, 100
com2WaitForDataState1ms_loop:
push r17
in r17, COM_PIN_DATA
eor r17, r16
andi r17, (1<<COM_PINNUM_DATA)
pop r17
in r22, COM_PIN_DATA
eor r22, r16
andi r22, (1<<COM_PINNUM_DATA)
breq com2WaitForDataState1ms_stateReached
Utils_WaitNanoSecs 10000, 0, r22 ; wait for 10us
dec r24
dec r17
brne com2WaitForDataState1ms_loop
clc
ret