3 Assembler Directives
3 Assembler Directives
Example:
ROOM_TEMP EQU 02H
C DB ?
SUM DW 3596.
Example:
TABLE DB 10 DUP(0)
Reserve an array of 10 bytes of memory and intialize all 10
Bytes with 0.
Array is named TABLE
Data segment
a dw 204Ah
b dw 3B2Ah
c dw 2 dup (0)
Data ends
Code segment
assume cs:code, ds:data
Start: mov ax, data
mov ds, ax
mov ax, a
mul b
mov c, ax
mov c+2, dx
mov ah, 4ch
int 21h
Code ends
End start
Example:
MAX DB 01111001B
Example:
MAX DB 49
Example:
MIN DB -20
Example:
NUM1 DB 35H
Note:
A zero must be placed in front of a hex number that
starts with a letter
Example:
NUM2 DB 0F4H
Decimal 5 2 9
BCD 0101 0010 1001
1)
BCD
35 0011 0101
+23 + 0010 0011
58 0101 1000
Example:
SECONDS DB 59H
Example:
BOY1 DB ‘RAM’
Example:
a dw 1234h
b db 23h
END label
: ; Procedure instructions
Example:
COMPLIMENT MACRO ; Start of macro
: ; Macro instructions
ENDM ; End of Macro
ENDS directive.
Its general format is:
Example:
CODE_SEG SEGMENT ; Start of code segment
– ; instructions
CODE_SEG ENDS ; End of segment
Ex:
DISPLAY MACRO 12,13
---------------------
MACRO STATEMENTS
-----------------------
ENDM
Macro Invocation:
CLRSCR
MOV DL, 40
MOV DH, 12
MOV BH, 00H
MOV AH, 02H
INT 10H
INCLUDE f1.mac
Example:
NEAR
This is used for intrasegment call i.e., a call