Intel IA-32 Manuale Utente

Pagina di 636
Vol. 3A 9-33
PROCESSOR MANAGEMENT AND INITIALIZATION
9.10.3
MAIN.ASM Source Code
The file MAIN.ASM shown in Example 9-2 defines the data and stack segments for this appli-
cation and can be substituted with the main module task written in a high-level language that is
invoked by the IRET instruction executed by STARTUP.ASM. 
Example 9-2.  MAIN.ASM
NAME    main_module
data    SEGMENT RW
dw 1000 dup(?)
DATA    ENDS
stack stackseg 800
CODE SEGMENT ER  use32 PUBLIC
main_start:
nop
nop
nop
CODE  ENDS
END main_start, ds:data, ss:stack
9.10.4
Supporting Files
The batch file shown in Example 9-3 can be used to assemble the source code files
STARTUP.ASM and MAIN.ASM and build the final application.
Example 9-3.  Batch File to Assemble and Build the Application
ASM386 STARTUP.ASM
ASM386 MAIN.ASM
BLD386 STARTUP.OBJ, MAIN.OBJ buildfile(EPROM.BLD) bootstrap(STARTUP) 
Bootload
BLD386 performs several operations in this example:
It allocates physical memory location to segments and tables.
It generates tables using the build file and the input files.
It links object files and resolves references.
It generates a boot-loadable file to be programmed into the EPROM.
Example 9-4 shows the build file used as an input to BLD386 to perform the above functions.