Assembler Directives

*=Beginning of comments

Start address (of data section or program)

ORG    $C000

declaring a constant

CONST    EQU    5

declaring variables in memory

i    RMB    4    (reserve 4 memory bytes)

declaring and initializing variables in memory

FCB    12, 20 (declares and initializes two 1-byte variables)

FDB    $1234, $ABCD (declares and initialized tow 2-byte variables)

i    FCB    12    (reserves 1-byte in memory, initialized to number 12(decimal))

Program written in columns

  1. Column: Labels

  2. Column: instruction

  3. Column: Instruction operands

  4. Column: comment

ORG

$B000

DATA1

FCB

10(Stored in $B000)

DATA2

FCB

15(Stored in $B001)

DATA3

FCB

$1A(stored in $B002)

RESULT

RMB

1(reserve 1-byte in memory)

All variables have to be initialized by programmer before use

  • int i=0 → i FCB 0

  • int i → i RMB 0

  • i = 0 → CLR i