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.
RAMC0:
RAMC1:
Note Data memory locations at 000H to 003H are allocated to general registers XA and HL, so these are
not cleared.
SET1
MBE
SEL
MB0
MOV
XA,#00H
MOV
HL,#04H
MOV
@HL,A
INCS
L
BR
RAMC0
INCS
H
BR
RAMC0
SEL
MB1
MOV
@HL,A
INCS
L
BR
RAMC1
INCS
H
CHAPTER 4 INTERNAL CPU FUNCTIONS
Note
; Clear 04H to FFH
; L <– L + 1
; H <– H + 1
; Clear 100H to 1FFH
; L <– L + 1
; H <– H + 1
5 5