Hardware Reference
In-Depth Information
processed and loads only one copy. This is especially useful if several files use the
same header file. In this case, only one copy is included in the combined source
file. In order to include the file, the #include must be the first token of the line
without leading white space, and the file path must be between double quotes.
If there is a single source file, say pr.s , then it is assumed that the project name
is pr , and the combined file will be pr.$ . If there is more than one source file, then
the basename of the first file is taken to be the projectname, and used for the defi-
nition of the .$ file, which is generated by the assembler by concatenating the
source files. This behavior can be overridden if the command line contains a ''-o
projname'' flag before the first source file, in which case the combined file will be
projname .$.
Note that there are some drawbacks in using include files and more than one
source. It is necessary that the names of labels, variables and constants are differ-
ent for all sources. Moreover, the file which is eventually assembled to the load file
is the projname . $ file, so the line numbers mentioned by the assembler in case of
errors and warnings are determined with respect to this file. For very small
projects, it is sometimes simplest to put the entire program in one file and avoid
#include .
C.5.3 Some Differences with Other 8088 Assemblers
The assembler, as88 , is patterned after the standard UNIX assembler, and, as
such, differs in some ways from the Microsoft Macro Assembler MASM and the
Borland 8088 assembler TASM. Those two assemblers were designed for the MS-
DOS operating system, and in places the assembler issues and the operating system
issues are closely interrelated. Both MASM and TASM support all 8088 memory
models allowed by MS-DOS. There is, for example, the tiny memory model, in
which all code and data must fit in 64 KB, the small model, in which the code seg-
ment and the data segment each can be 64 KB, and large models, which contain
multiple code and data segments. The difference between those models depends
on the use of the segment registers. The large model allows far calls and changes
in the DS register. The processor itself puts some restrictions on the segment regis-
ters (e.g., the CS register is not allowed as destination in a MOV instruction). To
make tracing simpler, the memory model used in as88 resembles the small model,
although the assembler without the tracer can handle the segment registers without
additional restrictions.
These other assemblers do not have a .BSS section, and initialize memory only
in the DATA sections. Usually the assembler file starts with some header informa-
tion, then the DATA section, which is indicated by the keyword .data , followed by
the program text after the keyword .code . The header has a keyword title to name
the program, a keyword .model to indicate the memory model, and a keyword
.stack to reserve memory for the stack segment. If the intended binary is a .com
 
 
Search WWH ::




Custom Search