Hardware Reference
In-Depth Information
been chosen as the running example. While 8088s are rarely encountered any
more, every Core i7 is capable of executing 8088 programs, so the lessons learned
here are still applicable to modern machines. Furthermore, most of the Core i7's
basic instructions are the same as the 8088's, only using 32-bit registers instead of
16-bit registers. Thus, this appendix can also be seen as a gentle introduction to
Core i7 assembly language programming.
In order to program any machine in assembly language, the programmer must
have a detailed knowledge of the machine's instruction set architecture. Accord-
ingly, Sections C.1 through C.4 of this appendix are devoted to the architecture of
the 8088, its memory organization, addressing modes, and instructions. Section
C.5 discusses the assembler, which is used in this appendix and which is available
for free, as described later. The notation used in this appendix is the one used by
this assembler. Other assemblers use different notations, so readers already famil-
iar with 8088 assembly programming should be alert for differences. Section C.6
discusses an interpreter/tracer/debugger tool, which can be downloaded to help the
beginner programmer get programs debugged. Section C.7 describes the installa-
tion of the tools, and how to get started. Section C.8 contain programs, examples,
exercises and solutions.
C.1 OVERVIEW
We will start our tour of assembly language programming with a few words on
assembly language and then give a small example to illustrate it.
C.1.1 Assembly Language
Every assembler uses mnemonics , that is, short words such as ADD , SUB , and
MUL for machine instructions such as add, subtract, and multiply, to make them
easy to remember. In addition, assemblers allow the use of symbolic names for
constants and labels to indicate instruction and memory addresses. Also, most
assemblers support some number of pseudoinstructions , which do not translate
into ISA instructions, but which are commands to the assembler to guide the
assembly process.
When a program in assembly language is fed to a program called an assem-
bler , the assembler converts the program into a binary program suitable for
actual execution. This program can then be run on the actual hardware. However,
when beginners start to program in assembly language, they often make errors and
the binary program just stops, without any clue as to what went wrong. To make
life easier for beginners, it is sometimes possible to run the binary program not on
the actual hardware, but on a simulator, which executes one instruction at a time
and gives a detailed display of what it is doing.
In this way, debugging is much
 
 
 
Search WWH ::




Custom Search