I get the point of MOV
, STA
and LDA
instructions, but what I don't understand is why are there three different instructions for two different processes?
STA
is for copying data from accumulator to memory location,LDA
is for copying data from memory location to accumulator andMOV
is for copying data between registers plus registers and memory.So, what I can do with STA
and LDA
instructions can be done with MOV
instruction too, right?
The instructions LDA
and STA
move data between memory and A
. The instruction MOV
either moves data between registers, or between a register and a memory location specified by HL
.
LDA
and STA
are used when the address can be resolved at assembly/link time.
MOV
is used when the memory address is computed at run time, and is placed in HL
. For example, when you are iterating through an array.
You have discovered direct and indirect memory addressing.