52 lines
869 B
NASM
52 lines
869 B
NASM
|
|
|
|
|
|
; ***************************************************************************
|
|
; Utils_FillSram
|
|
;
|
|
; IN:
|
|
; - x: pointer to SRAM to fill
|
|
; - r16: value to fill the SRAM with
|
|
; - r17: size of area to fill
|
|
; OUT:
|
|
; - nothing
|
|
; MODIFIED REGISTERS: r17, x
|
|
|
|
Utils_FillSram:
|
|
tst r17
|
|
breq Utils_FillSram_end
|
|
|
|
Utils_FillSram_loop:
|
|
st x+, r16
|
|
dec r17
|
|
brne Utils_FillSram_loop
|
|
Utils_FillSram_end:
|
|
ret
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; Increment a 32 bit counter at the address given by X.
|
|
; IN:
|
|
; - X: Address of the 4 byte counter (1. byte is LSB)
|
|
; OUT:
|
|
; - nothing
|
|
; MODIFIED REGISTERS: r18, r19, r20, r21, 22
|
|
|
|
Utils_IncrementCounter32:
|
|
ld r18, x+
|
|
ld r19, x+
|
|
ld r20, x+
|
|
ld r21, x
|
|
clr r22
|
|
inc r18
|
|
adc r19, r22
|
|
adc r20, r22
|
|
adc r21, r22
|
|
st x, r21
|
|
st -x, r20
|
|
st -x, r19
|
|
st -x, r18
|
|
ret
|
|
|