Program Memory

MPASM Assembler

Program Memory

Program memory code must be preceded by a CODE section declaration.

Absolute Code

Start CLRW

OPTION

:

Relocatable Code

CODE

Start CLRW

OPTION

:

If more than one CODE section is defined in a source file, each section must have a unique name. If the name is not specified, it will be given the default name .code.

Each program memory section must be contiguous within a single source file. A section may not be broken into pieces within a singe source file.

The physical address of the code can be fixed by supplying the optional address parameter of the CODE directive. Situations where this might be necessary are:

  • Specifying interrupt vectors
  • Ensuring that a code segment does not overlap page boundaries
  • Example Relocatable Code

    Reset CODE H'0lFF'

    GOTO Start

    Main CODE

    CLRW

    OPTION


    Microchip Technology Inc.
    Microchip's Web Site
    Voice: (480) 792-7200
    Fax: (480) 899-9210
    Microchip's E-mail Address
    PreviousNext