Page 359 - Embedded Microprocessor Systems Real World Design
P. 359
The Real World
Real microprocessors range from fairly simple devices, like this example system, to much
more complex devices. Further enhancements that you might see on a real processor
include:
More registers. Some might have special functions, such as a stack pointer (discussed
elsewhere in this book).
Independent bus interface and execution units (the Intel x86 family has this). This permits
the bus to fetch a new instruction while an old one is executing, improving overall
performance.
Internal peripheral devices such as timers.
Interrupt capability, where an external event can temporarily redirect program execution.
Capability for another processor to control the bus, allowing multiple processors to share
a single bus.
Code Formats
Getting instructions into the microprocessor means storing them in the control store
memory in some way. The code (that is, the ones and zeros that get loaded into memory
for the microprocessor to execute) is called machine co&. Of course, writing programs in
machine code would be very tedious. Every branch address would have to be calculated by
hand, and if you needed to insert an instruction between two existing instructions, you would
have to recalculate all the addresses.
The next level up from machine code is assembly. Assembly code replaces the machine
code with simple statements that are translated directly into machine code by assembler
software. There is one assembly statement per microprocessor instruction.
The assembler allows branches to be defined with labels (names), and the assembler
calculates branch addresses. Assembler statements usually are abbreviations of the instruc-
tion functions.
A machine instruction that moves data between two registers, R1 and R2, might use an
assembler statement like this:
MOV R1, R2 (MOVe R1 to R2)
A statement that moves an immediate value of 23 into register R1 might look like this:
MVI R1, 23 (Move Immediate value 23 to R1)
A branch instruction might look like this:
JMP label (JUMP to address of label)
To insert a new line of code, you must edit the sourcejile, which contains the assembly
statements. The assembler is run and new machine code is produced, which then is
340 Appendix D