Professional Documents
Culture Documents
CS 250
1
1. Why Assembly Language?
Complete control over the processor
Space efficiency
Faster running (execution)
System programs
Communication programs
2
basic structure of assembly program
3
mov ds, ax
(to be discussed shortly)
In general
(1) a character can be defined by enclosing paired single (‘) or double (“) or its ASCII
code value)
(2) a string of character (text) is defined by the text enclosed by a paired (‘) or (“) and
must be ended by $
(3) the identifier is the name of the first memory allocation
Abte DB 12, 99, 20
Defines a memory allocation of 3 bytes. The Abte is the variable name whose initial
value is 12.
(4) DUP operator defines a number of same value allocations
For example, Ones DB 5 DUP (1)
Defines 5 bytes whose initial values are 1.
4
defined with a PROC directive and whose termination is defined by an ENDP
directive:
Proc name PROC
…
Proc name ENDP
For example:
Hello PROC
…
Hello ENDP
Note:
1) both source and destination can not be memory referenced addresses
2) if the destination is a segment register, then source can not be an immediate value
(constant)
For example MOV ax @data is not allowed which should be replaced by following
two instructions:
MOV ax @data
MOV ds ax
where, @data is an immediate value after assembler
3) OFFSET is an operator whose result is an immediate value:
OFFSET MESSAGE is the distance in bytes from the beginning of the data
segment to the first byte in MESSAGE
5
Example:
DOS function 09h: display a string of characters whose offset is specified by DX.
AH : 09h
DX : offset of MESSAGE