09.05.2015 Views

Microcomputer Circuits and Processes

Microcomputer Circuits and Processes

Microcomputer Circuits and Processes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The number moved into register A immediately follows the MOVE<br />

instruction in memory. That is why 0010 is a MOVE IMMEDIATE<br />

instruction, represented by the mnemonic MVI A. Care has to be taken<br />

in preparing for the next instruction in memory. The PC started out<br />

pointing to the MVI A instruction. If the PC were incremented by one,<br />

it would then point to 'the data, the number 1100. If that happened, the<br />

CPU would think 1100 were another instruction <strong>and</strong> things would go<br />

wrong. So the PC must be incremented twice, to skip over the data<br />

number. See figure 3.7.<br />

PC must<br />

skip<br />

(<br />

PC<br />

~ 0 0 1 0<br />

1 1 0 0<br />

---7 0 0 0 0<br />

instruction MVI A<br />

data<br />

next instruction (STOP)<br />

Figure 3.7<br />

The program counter must be incremented twice in all 'immediate' instructions, to skip<br />

over the data number.<br />

There is a second 'immediate' -type instruction, which is SAM's<br />

addition, 1111.<br />

add immediate data to ADI data 1111<br />

the accumulator<br />

When the CPU fetches 1111 from memory, the instruction decoder<br />

knows it must perform an addition. It also knows the number to be<br />

added to the accumulator is contained in memory immediately after the<br />

1111 instruction. Figure 3.8 shows the situation. Again, the PC must be<br />

incremented twice to skip over the data number, here 0001. This<br />

double-increment is true of any 'immediate' -type instruction.<br />

PC 1 1 1<br />

000<br />

data<br />

11 0 0 0 I accumulator ... before<br />

11 0 0 1 I···<strong>and</strong> after<br />

Figure 3.8<br />

AD! instruction. The number 0001, following the AD! instruction, is added to the<br />

accumulator, <strong>and</strong> the result is stored in the accumulator.<br />

30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!