Assembler directives:


Segment directives:

cseg

dseg

bseg


selects the current segment.


cseg for code and constants

dseg for data.


cseg is active by default



Location counter:

org number


sets the value of the current segments location. If cseg is active, then code will be placed at address number after the org directive


Location counter for each segment defaults to 0



End directive

end


signals the end of the source file.



Equate directive

TEN equ 10


Whenever the symbol TEN occurs in the text it will be replaced by 10

Data directive

X data 34h

PSW data 0d0h


single byte data held in RAM or SFR can be given a name


X is the byte at location 34h in RAM

PSW is the name of the SFR register at 0d0h



Bit directive

b bit 7

CF bit 0d7h


single bit data held in RAM or SFR can be given a name


b is the bit at location 7 in bit addressable RAM

CF is the name of the bit at 0d7h - the carry flag



Labels

l1: mov a,#34


Symbols must



All symbols are translated to uppercase by the assembler.

Labels are symbols with a trailing colon. They represent the location of the instruction or assembler directive.

DB directive

copyright_msg:

db ‘(c) Copyright, 1996’


allocates space for initialised data in the cseg a byte at a time. Can only be used when cseg is active



DS directive

buffer: ds 16


reserves so many bytes (16) of data in RAM for variable data. The dseg must be active.



DBIT directive

io_map: dbit 12


reserves so many bits (12) of data in bit addressable RAM for variable data. The bseg must be active.


The file mod2051 contains many of these directives.

159.233 Assembler 4 - 1