Boot Loader
4-22
*
* Transfer code
*
LOOP LACC *+,8 ; Load ACC with high byte of code shifted by 8 bits
SACL HBYTE ; Store high byte
LACL *+,AR0 ; Load ACC with low byte of code
AND #0FFH ; Mask off upper 24 bits
OR HBYTE ; OR ACC with high byte to form 16-bit code word
SACL CODEWORD ; Store code word
LACL DEST ; Load destination address
TBLW CODEWORD ; Transfer code to destination address
ADD #1 ; Add 1 to destination address
SACL DEST ; Save new address
BANZ LOOP,AR1 ; Determine if end of code is reached
SPLK #0,GREG ; Disable entire global memory
INTR 0 ; Branch to reset vector and execute code.
.END
Note:
The INTR instruction in the boot loader program causes the processor to
push a return address onto the stack, but the device does not use a RET to
return to this address. Therefore, your program must execute a POP
instruction to get the address off the stack.