![](/images/new-backgrounds/1290705/290705107x1.webp)
ARCHITECTURE AND INSTRUCTIONS
The process of translation might involve per- forming some additional activities before the output is truly machine code. These activities, like relocation and linkage, are part of the translation process. Throughout this text, references to translation (assembling, compil- ing) imply all necessary activities to produce object code.
A program written in assembly language is a symbolic representation of the machine- language program.
The relation between the
A
~g~~CE _ TRANSLATOR~g~bEECT
(MACHINE
LANGUAGE)
Figure 2-11. Translation Process
SOURCE_ ASSEMBLER f---0BJECT
CODECODE
lASSEMBLY(MACHINE
ANGUAGE)LANGUAGE)
SOURCEBOBJEC,
CODECODE
LANGUAGE)LANGUAGE)
Figure 2-12. Assemblers and Compilers
you concentrate on the task you are pro- gramming. The compiler may generate less efficient object code, but good compilers can sometimes generate more efficient object code than you could have written in assembly language.
SYMBOLIC NAMES
The primary advantage of using assembly language instead of machine language is the ability to use symbolic names. Let's illustrate this point using
CYCLE: |
|
|
IN | AX,5 | ;read word from port 5 into AX |
INC | AX | ;increment AX |
OUT | 2,AX | ;write result to port 2 |
JMP | CYCLE | ;keep repeating |
The above program is simpler to read and understand because it uses symbolic names instead of numbers as much as possible. The opcodes ofthe four instructions are
Register Names
Besides the opcode fields, there are other fields in the object code (see above example). The contents of these fields must be specified in the
For example, the INC instruction has a