LAB#02 Assembler & Program Execution Commands Using Debug Utility
LAB#02 Assembler & Program Execution Commands Using Debug Utility
LAB#02
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:
Instruction IP Value Memory
MOV AX,0200 0100 3 Bytes
MOV AX,0400 0103 3 Bytes
ADD AX, BX 0106 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)
AX=5431→1537
Result Remainder
5431/16=339.4375 .4376*16=7
339/16=21.1875 .1875*16=3
21/16=1.3125 .3125*16=5
1 1
BX=9321→2469
Result Remainder
9321/16=582.5625 .5625*16=9
582/16=36.375 .375*16=6
36/16=2.25 .25*16=4
2 2
CX=45032→AFE8
Result Remainder
45032/16=2814.5 .5*16=8
2814/16=175.875 .875*16=E
175/16=10.9375 .9375*16=F
10 → A A
DX=23102→5A3E
Result Remainder
23102/16=1443.875 .875*16=E
1443/16=90.1875 .1875*16=3
90/16=5.625 .625*16=A
5 5
Unassembled:
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:
REGISTER VALUES:
Step#01:
AX=0200 , BX=0000, CX=0000, DX=0000
Step#02:
AX=0200 , BX=0400, CX=0000, DX=0000
Step#03:
AX=0600, BX=0400, CX=0000, DX=0000
Sir Syed University of Engineering & Technology
Department of Computer Science & Information Technology
Computer Organization & Assembly Language (CS-215L) LAB # 02
FLAG VALUES:
IP VALUES:
Step#01:
103
Step#02:
106
Step#03:
108
TASK#03:
To Check 200 Offset Value We First Have To Change The Value Of Instruction Pointer To
200.
Step#01:
AX=1537 , BX=0000 , CX=0000,DX=0000
Step#02:
AX=1537 ,BX=2469 , CX=0000,DX=0000
Step#03:
AX=1537 ,BX=2469, CX=AFE8,DX=0000
Step#04:
AX=1537 ,BX=2469, CX=AFE8,DX=5A3E
IP VALUES:
Step#01:
IP=0203
Step#02:
IP=0206
Step#03:
IP=0209
Step#04:
IP=020C
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:
Register Values:
AX=600,BX=0400
Flags Output
Overflow Flag 0
Direction Flag 0
Interrupt Flag 1
Sign Flag 0
Zero Flag 0
Auxiliary Carry Flag 0
Parity Flag 1
Carry Flag 0
IP Values:
IP=0108
TASK#03:
Register Values:
Flags Output
Overflow Flag 0
Direction Flag 0
Interrupt Flag 1
Sign Flag 1
Zero Flag 0
Auxiliary Carry Flag 0
Parity Flag 0
Carry Flag 0
IP Values:
IP=020C