Hardware Reference
In-Depth Information
Project HlloWrld num file HlloWrld.#
Project HlloWrld loadfile HlloWrld.88.
and the corresponding three files created. If there are no error messages, give the
tracer command:
t88 HlloWrld
The tracer display will appear with the arrow in the upper right-hand window
pointing to the
MOV CX,de-hw
instruction of line 6. Now hit the return (called Enter on PC keyboards) key.
Notice that the instruction pointed to is now
PUSH CX
and the value of CX in the left-hand window is now 12. Hit return again and notice
that the middle window on the top line now contains the value 000c, which is hex-
adecimal for 12. This window shows the stack, which now has one word contain-
ing 12. Now hit return three more times to see the PUSH instructions on lines 8, 9,
and 10 being carried out. At this point, the stack will have four items and the pro-
gram counter in the left-hand window will have the value 000b.
The next time return is hit, the system call is executed and the string ''Hello
World\n'' is displayed in the lower right-hand window. Note that SP now has the
value 0x7ff0. After the next return, SP is incremented by 8 and becomes 0x7ff8.
After four more returns, the exit system call completes and the tracer exits.
To be certain that you understand how everything works, fetch the file
hlloWrld.s into your favorite editor. It is better not to use a word processor. On
UNIX systems, ex , vi ,or emacs are good choices. On Windows systems, notepad is
a simple editor, usually reachable from
Start > Programs > Accessories > Notepad
Do not use Word since the display will not look right and the output may be for-
matted incorrectly.
Modify the string on line 19 to display a different message, then save the file,
assemble it, and run it with the tracer.
You are now starting to do assembly lan-
guage programming.
C.8.2 General Registers Example
The next example demonstrates in more detail how the registers are displayed
and one of the pitfalls of multiplication on the 8088. In Fig. C-13, part of the pro-
gram genReg.s is shown on the left. To its right are two tracer register windows,
corresponding to different stages of the program's execution. Fig. C-13(b) shows
the register state after line 7 has been executed. The instruction
MOV AX,258
on line 4 loads the value 258 in AX , which results in the value 1 being loaded into
 
Search WWH ::




Custom Search