
Register Assignment (MOV)
With this knowledge of the MOV instruction, some simple memory assignment tasks can be performed:
1) Clear the contents of Internal RAM address FFH:
MOV A,#00h ;Move the value 00h to the accumulator ;(accumulator=00h)
MOV R0,#0FFh ;Move the value FFh to R0 (R0=0FFh)
MOV @R0,A | ;Move accumulator to @R0, thus clearing |
| ;contents of FFh |
2) Clear the contents of Internal RAM address FFH (more efficient):
MOV R0,#0FFh | ;Move | the | value FFh to R0 (R0=0FFh) |
MOV @R0,#00h | ;Move | 00h | to @R0 (FFh), clearing contents of FFh |
3)Clear the contents of all bit memory, internal RAM addresses 20H through
2FH (this example will later be improved upon to require less code):
MOV 20h,#00h ;Clear Internal RAM address 20h
MOV 21h,#00h ;Clear Internal RAM address 20h
MOV 22h,#00h ;Clear Internal RAM address 20h
MOV 23h,#00h ;Clear Internal RAM address 20h
MOV 24h,#00h ;Clear Internal RAM address 20h
MOV 25h,#00h ;Clear Internal RAM address 20h
MOV 26h,#00h ;Clear Internal RAM address 20h
MOV 27h,#00h ;Clear Internal RAM address 20h
MOV 28h,#00h ;Clear Internal RAM address 20h
MOV 29h,#00h ;Clear Internal RAM address 20h
MOV 2Ah,#00h ;Clear Internal RAM address 20h
MOV 2Bh,#00h ;Clear Internal RAM address 20h
MOV 2Ch,#00h ;Clear Internal RAM address 20h
MOV 2Dh,#00h ;Clear Internal RAM address 20h
MOV 2Eh,#00h ;Clear Internal RAM address 20h
MOV 2Fh,#00h ;Clear Internal RAM address 20h