Microcomputer Circuits and Processes
Microcomputer Circuits and Processes
Microcomputer Circuits and Processes
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
The accumulator is a very useful register, since it has access to the<br />
ALU, <strong>and</strong> any data put into the accumulator can then be subjected to<br />
arithmetic <strong>and</strong> logic operations. So instructions to move data in <strong>and</strong><br />
out of SAM's accumulator are vital. First, how to get data into the<br />
accumulator from memory.<br />
move memory data into Mav M-+Acc 0110<br />
accumulator, via reg A<br />
In the same way as the ADI instruction, the accumulator is expected to<br />
receive data. But, unlike the immediate instruction, the data is not in the<br />
following memory location. So where is it? The address of the data to be<br />
moved into the accumulator is contained in register A. In figure 3.9,<br />
register A has previously been loaded with the number 0111. When the<br />
CPU executes an Mav M -+Acc instruction, it first looks at register A<br />
to find out which memory location contains the data. The CPU then<br />
gets the data, here 0001, from that location, <strong>and</strong> puts it into the<br />
accumulator. This way of moving data is quite useful, since data may be<br />
got from any memory location using just the one Mav M -+ Acc<br />
instruction, by changing the address stored in register A.<br />
PC 0 1 1 0 1 instruction MOV M-Acc found<br />
0101<br />
011 0<br />
0111 000 1<br />
l'<br />
memory<br />
addresses<br />
accumulator<br />
3 data moved into<br />
accumulator<br />
Figure 3.9<br />
The instruction MOV M-+Acc. Note how register A must be interrogated, to get the<br />
address from where the data is to be obtained.<br />
Perhaps a second example of this way of doing things will help you<br />
see what is going on. This is the reverse instruction to the above, moving<br />
data out of the accumulator into memory.<br />
move accumulator data MaV Acc-+M 0111<br />
into memory, via reg A<br />
Here the number stored in the accumulator, which could be the<br />
result of an arithmetic operation, is to be put into memory somewhere.<br />
The destination of the data is an address stored in register A. Look at<br />
figure 3.10. Here the number 0011 in the accumulator has to be moved<br />
into memory. The address where it is to go, 0101, has been previously<br />
31