Utils: Dixed Utils_IncrementCounter32, added Utils_IncrementCounter16.

This commit is contained in:
Martin Preuss
2023-01-29 18:50:41 +01:00
parent 6d59a818a5
commit 704ca66baa

View File

@@ -79,8 +79,9 @@ Utils_IncrementCounter32:
ld r19, x+
ld r20, x+
ld r21, x
clr r22
inc r18
ldi r22, 1
add r18, r22
clr r22 ; doesn't affect carry flag
adc r19, r22
adc r20, r22
adc r21, r22
@@ -92,6 +93,27 @@ Utils_IncrementCounter32:
; ***************************************************************************
; Increment a 16 bit counter at the address given by X.
; IN:
; - X: Address of the 2 byte counter (1. byte is LSB)
; OUT:
; - nothing
; MODIFIED REGISTERS: r18, r19, 22
Utils_IncrementCounter16:
ld r18, x+
ld r19, x
ldi r22, 1
add r18, r22
clr r22 ; doesn't affect carry flag
adc r19, r22
st x, r19
st -x, r18
ret
; ***************************************************************************
; Utils_ReadEeprom