## ALP Programming Guide and Reference

[prev][next][parent][TOC]

### ORG (Adjust Segment Location Counter)

The ORG directive sets the location counter to the value of Expression. Subsequent instructions are generated beginning at this new location.

Syntax

    ORG   Expression

Remarks

The assembler must know all names used in Expression on pass 1, and the value must be either absolute or in the same segment as the location counter.

The numeric value of Expression must not be a quantity larger than that which is representable by an unsigned integer having the same word size as the current segment.

You can use the current address operator ($) to refer to the current value of the location counter.

Example

    ORG      120H
    ORG      $ + 2       ; SKIP   NEXT   2   BYTES

To conditionally skip to the next 256-byte boundary:

    CSEG      SEGMENT      PAGE
    BEGIN     =            $
             .
             .
             .
             IF   ( $ - BEGIN )   MOD   256
    ; IF   NOT   ALREADY   ON   256   BYTE   BOUNDARY
             ORG   ( $ - BEGIN ) + 256 - ( ( $ - BEGIN )   MOD   256 )
             ENDIF