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.

loaded into register A. So the CPU looks first at reg A, gets the address<br />

0101, <strong>and</strong> stores the data 0011 there, by a WRITE operation.<br />

PC 0 1 1 1 1 MOV Acc --+ M instruction found<br />

0101 0 0 1 1<br />

accumulator<br />

3 data moved<br />

Figure 3.10<br />

MOV Acc- M instruction. Again, note how register A must be interrogated for an<br />

address; this time the address is where the data is to be written.<br />

That completes the instructions we shall need for our program in<br />

the next section, with the exception of one final instruction, which in<br />

fulfilling itself, needs no explanation.<br />

stop STOP 0000<br />

A SIMPLE PROGRAM TO ADD TWO NUMBERS<br />

Table 3.1<br />

In rough outline, a program to add a number 6 10 in memory to another<br />

number 5 10 somewhere else in memory, <strong>and</strong> put the result 11 10 back<br />

into memory would look like this:<br />

1 Get the number 6 10 <strong>and</strong> put it into the accumulator.<br />

2 Get the number 5 10 <strong>and</strong> then add it, putting the result back into the<br />

accumulator.<br />

3 Put the accumulator contents back into memory.<br />

This program is shown nicely assembled in memory in Table 3.1.<br />

The two columns of 4-bit numbers show the instructions/data <strong>and</strong> the<br />

addresses where they are stored.<br />

EXECUTE cycle number<br />

(These numbers correspond<br />

to those in the titles of<br />

figures 3.15 to 3.25)<br />

Mnemonic<br />

Op-code<br />

or data<br />

(*indicates<br />

data)<br />

Address<br />

Effect of instruction<br />

2<br />

3&4<br />

5<br />

6<br />

MVIA<br />

MOV M-Acc<br />

ADI<br />

MOV Acc-M<br />

STOP<br />

0010<br />

0111*<br />

0110<br />

1111<br />

0101*<br />

0111<br />

0000<br />

0110*<br />

0000<br />

0001<br />

0010<br />

0011<br />

0100<br />

0101<br />

0110<br />

0111<br />

Move the number 0111 into register A, ready to be used as<br />

an address.<br />

Move memory contents into accumulator.<br />

Add the number 0101 (5 10 ) to the accumulator, <strong>and</strong> put<br />

result in accumulator.<br />

Move accumulator contents into memory.<br />

Stop.<br />

Data 0110 (6 10 ) to be added.<br />

32

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

Saved successfully!

Ooh no, something went wrong!