Hardware Reference
In-Depth Information
file, then the tiny model is used, all segment registers are equal, and at the head of
this combined segment 256 bytes are reserved for a ''Program Segment Prefix.''
Instead of the .WORD , .BYTE , and ASCIZ directives, these assemblers have
keywords DW for define word and DB for define byte. After the DB directive, a
string can be defined inside a pair of double quotes. Labels for data definitions are
not followed by a colon. Large chunks of memory are initialized by the DUP
keyword, which is preceded by a count and followed by an initialization.
For
example, the statement
LABEL DB 1000 DUP (0)
initializes 1000 bytes of memory with ASCII zero bytes at the label LABEL .
Furthermore, labels for subroutines are not followed by a colon, but by the
keyword PROC . At the end of the subroutine, the label is repeated and followed by
the keyword ENDP , so the assembler can infer the exact scope of a subroutine.
Local labels are not supported.
The keywords for the instructions are identical in MASM, TASM, and as88 .
Also, the source is put after the destination in two operand instructions. However,
it is common practice to use registers for the passing of arguments to functions,
instead of on the stack. If, however, assembly routines are used inside C or C++
programs, then it is advisable to use the stack in order to comply with the C sub-
routine calling mechanism. This is not a real difference, since it is also possible to
use registers instead of the stack for arguments in as88 .
The biggest difference between the MASM, TASM and as88 is in making sys-
tem calls. The system is called in MASM and TASM by means of a system inter-
rupt INT . The most common one is INT 21H , which is intended for the MS-DOS
function calls. The call number is put in AX , so again we have passing of arguments
in registers. For different devices there are different interrupt vectors, and interrupt
numbers, such as INT 16H for the BIOS keyboard functions and INT 10H for the dis-
play. In order to program these functions, the programmer has to be aware of a
great deal of device-dependent information.
In contrast, the UNIX system calls
available in as88 are much easier to use.
C.6 THE TRACER
80 ordinary (VT100) terminal,
with the ANSI standard commands for terminals. On UNIX or Linux machines, the
terminal emulator in the X-window system usually meets the requirements. On
Windows machines, the ansi.sys driver usually has to be loaded in the system ini-
tialization files as described below. In the tracer examples, we have already seen
the layout of the tracer window. As can be seen in Fig. C-10, the tracer screen is
subdivided into seven windows.
The tracer-debugger is meant to run on a 24
×
 
 
Search WWH ::




Custom Search