Instruction Set ArchitectureIP2022 Users Manual
162
www.ubicom.com
Example:
mov w,#0x00;load W with 0x00
mov addrx,w;copy W to ADDRX
mov w,#0x03;load W with 0x03
mov addrh,w;copy W to ADDRH
mov w,#0x80;load W with 0x80
mov addrl,w;copy W to ADDRL
iread
;read program memory
mov w,datal;move low byte to W
mov 0x1FE,w;copy W to 0x1FE
mov w,datah;move high byte to W
mov 0x1FF,w;copy W to 0x1FF
This example reads a word stored at byte
address 0x000380 in program RAM. First,
ADDRX/ADDRH/ADDRL
is
loaded
with
0x000380. After the iread instruction, the
DATAH/DATAL register holds the word read from
program RAM. Then, the lower byte of the word is
copied to data memory location 0x1FE and the
upper byte is copied to data memory location
0x1FF.