background image

9-26 Vol. 3A

PROCESSOR MANAGEMENT AND INITIALIZATION

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.

Example 9-4.  Build File

INIT_BLD_EXAMPLE;

SEGMENT

        *SEGMENTS(DPL = 0)

    ,   startup.startup_code(BASE = 0FFFF0000H)

    ;

TASK

        BOOT_TASK(OBJECT = startup, INITIAL,DPL = 0, 

NOT INTENABLED)

,       PROTECTED_MODE_TASK(OBJECT = main_module,DPL = 0, 

NOT INTENABLED)

    ;

TABLE

    GDT (

        LOCATION = GDT_EPROM

    ,   ENTRY = (

            10:   PROTECTED_MODE_TASK

    ,

startup.startup_code

    ,       startup.startup_data

    ,       main_module.data

    ,       main_module.code

    ,       main_module.stack

          )

        ),

    IDT (

        LOCATION = IDT_EPROM

        );

MEMORY

    (

        RESERVE = (0..3FFFH 

-- Area for the GDT, IDT, TSS copied from ROM

    ,              60000H..0FFFEFFFFH)

    ,   RANGE = (ROM_AREA = ROM (0FFFF0000H..0FFFFFFFFH)) 

-- Eprom size 64K

    ,   RANGE = (RAM_AREA = RAM (4000H..05FFFFH))