avr: reorganized common code.

This commit is contained in:
Martin Preuss
2026-04-20 23:56:52 +02:00
parent 2d2105ae00
commit abe218e7b0
12 changed files with 281 additions and 155 deletions

View File

@@ -101,6 +101,30 @@ Eeprom_WriteByteIfChanged_end:
; ---------------------------------------------------------------------------
; @routine Eeprom_WriteBytes @global
;
; Write bytes into EEPROM (if changed, thus saving on write cycles)
;
; @param X eeprom address to write to
; @param Y address in SDRAM to read from
; @param R17 number of bytes to copy
; @clobbers r16, r17, r18, X, Y
Eeprom_WriteBytes:
mov r18, r17
Eeprom_WriteBytes_loop:
ld r16, Y+
rcall Eeprom_WriteByteIfChanged
brcc Eeprom_WriteBytes_ret
adiw xh:xl, 1
dec r18
brne Eeprom_WriteBytes_loop
Eeprom_WriteBytes_ret:
ret
; @end
#endif ; AQH_AVR_COMMON_EEPROM_W_H