55
CHAPTER 4 INTERNAL CPU FUNCTIONS
Data memory is undefined when it is reset. For this reason, it is to be initialized to zero (RAM clear) usually
at the start of a program. Remember to perform this initialization. Otherwise, unexpected bugs may occur.
Example The following program clears data at addresses 000H to 1FFH in RAM.
SET1 MBE
SEL MB0
MOV XA,#00H
MOV HL,#04H
RAMC0: MOV @HL,A ; Clear 04H to FFHNote
INCS L ; L <– L + 1
BR RAMC0
INCS H ; H <– H + 1
BR RAMC0
SEL MB1
RAMC1: MOV @HL,A ; Clear 100H to 1FFH
INCS L ; L <– L + 1
BR RAMC1
INCS H ; H <– H + 1
Note Data memory locations at 000H to 003H are allocated to general registers XA and HL, so these are
not cleared.