посмотрел листинг, но тут я не уидел с какого по какой адрес он разместил в память массив
.ESEG
.ORG 0
.DB 0 ; FIRST EEPROM LOCATION NOT USED, SEE ATMEL ERRATA SHEETS
.DSEG
.ORG 0xE0
; 1 // EEPROM access example
; 2
; 3 // CodeVisionAVR C Compiler
; 4 // (C) 2000-2007 HP InfoTech S.R.L.
; 5 //
www.hpinfotech.ro; 6
; 7 // Chip: ATmega8515
; 8
; 9 flash char f[]="This is a test";
.CSEG
; 10 #pragma warn-
; 11 eeprom char e[16];
.ESEG
_e:
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
.DB 0x0
; 12 #pragma warn+
; 13 char r[16];
.DSEG
_r:
.BYTE 0x10
; 14
; 15 void main (void)
; 16 {
.CSEG
_main:
; 17 char flash *ptr_to_flash;
; 18 char eeprom *ptr_to_eeprom;
; 19 char *ptr_to_ram;
; 20
; 21 // copy the string f from FLASH to
; 22 // the string e in EEPROM
; 23 ptr_to_flash=f;
; *ptr_to_flash -> R16,R17
; *ptr_to_eeprom -> R18,R19
; *ptr_to_ram -> R20,R21
LDI R30,LOW(_f*2)
LDI R31,HIGH(_f*2)
MOVW R16,R30
; 24 ptr_to_eeprom=e;
__POINTWRM 18,19,_e
; 25 while (*ptr_to_flash)
_0x3:
MOVW R30,R16
LPM R30,Z
CPI R30,0
BREQ _0x5
; 26 *ptr_to_eeprom++=*ptr_to_flash++;
PUSH R19
PUSH R18
__ADDWRN 18,19,1
MOVW R30,R16
__ADDWRN 16,17,1
LPM R30,Z
POP R26
POP R27
RCALL __EEPROMWRB
; 27
; 28 // copy the string e from EEPROM to
; 29 // the string r in RAM
; 30 ptr_to_eeprom=e;
RJMP _0x3
_0x5:
__POINTWRM 18,19,_e
; 31 ptr_to_ram=r;
__POINTWRM 20,21,_r
; 32 while (*ptr_to_eeprom)
_0x6:
MOVW R26,R18
RCALL __EEPROMRDB
CPI R30,0
BREQ _0x8
; 33 *ptr_to_ram++=*ptr_to_eeprom++;
PUSH R21
PUSH R20
__ADDWRN 20,21,1
__ADDWRN 18,19,1
RCALL __EEPROMRDB
POP R26
POP R27
ST X,R30
; 34
; 35 // stop here
; 36 while (1);
RJMP _0x6
_0x8:
_0x9:
RJMP _0x9
; 37 }
_0xC:
NOP
RJMP _0xC
__EEPROMRDB:
SBIC EECR,EEWE
RJMP __EEPROMRDB
PUSH R31
IN R31,SREG
CLI
OUT EEARL,R26
OUT EEARH,R27
SBI EECR,EERE
IN R30,EEDR
OUT SREG,R31
POP R31
RET