I. Assembler Commands: A) Command A: Assemble A Program
I. Assembler Commands: A) Command A: Assemble A Program
LAB#02
I. Assembler Commands
The following letters stands for,
A Assemble a program.
U Disassemble a program
It is used to assemble a program using the 8088 assembly language as shown in Figure 2.1
Figure 2.2 Disassemble Command with addresses and machine codes for each instruction
The program control commands are considered as the part of System commands. The three
basic commands are as under:
G Execute program
R Display or modify the contents of registers.
T Trace program execution.
Command syntax G [=<Start address>], [<Break point 1>, <Break point 2>... <Break point
n>]
The ‘=’ sign in the above syntax indicates a <Start address> parameter to be given.
If “=” is not used, then the system assumes any parameters as break points.
<Start address> specifies the beginning address of the program to be executed.
f <Start address> not given, execution will start at the default value, which is the
current CS: IP location.
<Break point> shows the program results (at the specified instruction locations given
by programmer) as to determine whether the program runs as expected.
Up to 10 break points are allowed.
Multiple break points make debugging easier when the program contains flow
control instructions, such as conditional jumps (e.g., JNZ, JC, JNE).
If no break point is set, control will not return to the user, until the program
execution is completed.
Figure 2.3 shows the execution of code using G command.
MSB LSB
bit # bit #
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
XX X X XX OF D IF TF S ZF X A XX P X CY
X X F F X F F X
Flag register is a bit-addressable register and holds 16 different bits. These bits are used
individually to indicate different status as well as control. The 16 flag bits are shown above
with their bit locations. Among the 16 bits, only nine bits are used and the rest are reserved for
future. There are six status flags and three control flags. Overflow, Sign, Zero, Auxiliary,
Parity, and Carry flags are considered as status flags whereas Direction, Interrupt, and Trap
flags are the control flags. The Flag registers are described in Table 2.1 with their names and
possible values.
Figure 2.5 shows a program execution with Trace command in which three (3) numbers of
instructions are executed.
Activity- 1:
Assemble and unassemble the following code and fill the following table.
Activity- 2:
Give answers to the following questions after unassemble the code:
Why the values 0200H and 0400H are written as 0002 and 0004, in the opcode, respectively?
Answer:
Due to the little endian convention lower byte is filled in the lower memory and higher byte is
filled in the higher memory.
Write the number of bytes and the value of IP register taken by each instruction.
Answer:
3 Bytes
3 Bytes
Sir Syed University of Engineering & Technology 11 | P a g e
Department of Computer Science & Information Technology
Computer Organization & Assembly Language (CS-215L) LAB # 02
2 Bytes
Activity- 3:
Assemble a program using the DEBUG programming utility to move the decimal values in the
registers, as given below:
AX = 543110
BX = 932110
CX = 4503210
DX = 2310210
(Hint: First convert the above numbers in Hexadecimal system)
Activity- 4:
Apply the program control command T to execute the code give in Activity -1 & 3. Capture
the screenshot. Write down and analyze the values of each registers including IP and Flag
registers.
TASK#01:
1)
AX=0200 , BX=0000
2)
BX=0400 , AX=0200
3)
AX=0600, BX=0400
TASK#03:
To Check 200 Offset Value We First Have To Change The Value Of Instruction Pointer To
200.
Direction Flag 0 0 0
Interrupt Flag 1 1 1
Trap Flag 0 0 0
Sign Flag 0 0 0
Zero Flag 0 0 0
Auxiliary Carry Flag 0 0 0
Parity Flag 1 1 1
Carry Flag 0 0 0
Activity- 5:
Apply the program control command G to execute the code give in Activity -1 & 3. Capture
the screenshot. Write down and analyze the values of each registers including IP and Flag
registers.
TASK#01:
AX=600,BX=0400
Flags Output
Overflow Flag 0
Direction Flag 0
Interrupt Flag 1
Trap Flag 0
Sign Flag 0
Zero Flag 0
Auxiliary Carry Flag 0
Parity Flag 1
Carry Flag 0
TASK#03:
Flags Output
Overflow Flag 0
Direction Flag 0
Interrupt Flag 1
Trap Flag 0
Sign Flag 0
Zero Flag 0
Auxiliary Carry Flag 0
Parity Flag 1
Carry Flag 0