| Example: |
.ORG 0x1000
EEPROM_Dest = 0x1E0
SRAM_Source = 0x100
BYTECount = 22 ; These are the eleven (11) AtoD values
SRAMtoEETest:
LDI R25, EEPROM_Dest >> 8
LDI R24, EEPROM_Dest & 0xFF ; R25:R24 = target address: copy to EEPROM
LDI R23, SRAM_Source >> 8
LDI R22, SRAM_Source & 0xFF ; R23:R22 = source address; copy from SRAM
LDI R21, BYTECount >> 8
LDI R20, BYTECount & 0xFF ; R21:R20 = number of bytes to copy
JMP AmemcpySRAMtoEEPROM |
| Test it: |
m>:1010000091E080EE71E060E050E046E10C94293020
m>:00000001FF
m>de+ 0x1e0 32
EEPROM contents:
01E0: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................
01F0: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................
m>@ 0x1000
m>de+ 0x1e0 32
EEPROM contents:
01E0: 00 00 00 00 00 00 00 00-F1 03 00 00 C3 00 E4 00 ................
01F0: E0 00 00 00 5D 01 FF FF-FF FF FF FF FF FF FF FF ....]...........
m>
|
| Notes: |
The bPtrTo and bPtrFrom values are not checked for validity. |
| The wCount value is limited to 1,023 (= 0x7FF) BYTEs. |
| If wCount is zero, it exits immediately with no EEPROM change. |
Dropin: (setup code) |
; Setup for the memcpySRAMtoEEPROM() call:
; Passed: R25:R24 BYTE * bPtrTo pointer to the EEPROM destination
; R23:R22 BYTE * bPtrFrom pointer to the SRAM source buffer
; R21:R20 WORD wCount number of BYTEs to copy
; Returns: R25:R24 BYTE * bPtrTo the caller's bPtrTo value (unmodified)
; Alters: The FLAGs and the memory block referenced
|
| Also see: |
The memcpyEEPROM,
memcpyEEPROMtoEEPROM,
and memcpy System Functions and
the ECS (in Edit) System Command.
|