100% found this document useful (2 votes)
629 views

LAB#02 Assembler & Program Execution Commands Using Debug Utility

This document describes a lab assignment on assembly language and the debug utility. The lab involves assembling and unassembling code to move values into registers, then using the debug commands T and G to step through and run the code. The values in the registers and flags are observed and analyzed after each step. The objectives are to practice assembling code, observing program execution, and analyzing register and flag values.

Uploaded by

Mohib Uddin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
629 views

LAB#02 Assembler & Program Execution Commands Using Debug Utility

This document describes a lab assignment on assembly language and the debug utility. The lab involves assembling and unassembling code to move values into registers, then using the debug commands T and G to step through and run the code. The values in the registers and flags are observed and analyzed after each step. The objectives are to practice assembling code, observing program execution, and analyzing register and flag values.

Uploaded by

Mohib Uddin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Computer Organization & Assembly Language (CS-215L) LAB # 02

LAB#02

ASSEMBLER & PROGRAM EXECUTION COMMANDS


USING DEBUG UTILITY

Activity- 1:
Assemble and Unassemble the following code and fill the following table.

Logical Address Opcode Assembly code Comments


072A:0100 B80002 MOV AX, 0200H ; AX=0200

072A:0103 BB0004 MOV BX, 0400H ; BX=0400

072A:0106 01D8 ADD AX, BX ; AX=AX+BX


; AX=0400+0200
; AX=0600

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.

Sir Syed University of Engineering & Technology


Department of Computer Science & Information Technology
Computer Organization & Assembly Language (CS-215L) LAB # 02

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)

DECIMAL TO HEXADECIMAL CONVERSION:

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

Sir Syed University of Engineering & Technology


Department of Computer Science & Information Technology
Computer Organization & Assembly Language (CS-215L) LAB # 02

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:

Flags Output Step 1 Output Step 2 Output Step 3


Overflow Flag 0 0 0
Direction Flag 0 0 0
Interrupt Flag 1 1 1
Sign Flag 1 1 0
Zero Flag 0 0 0
Auxiliary Carry Flag 0 0 0
Parity Flag 0 0 1
Carry Flag 0 0 0

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

Sir Syed University of Engineering & Technology


Department of Computer Science & Information Technology
Computer Organization & Assembly Language (CS-215L) LAB # 02

FLAG REGISTER VALUES:

Flags Output Step 1 Output Step 2 Output Step 3 Output Step 4


Overflow Flag 0 0 0 0
Direction Flag 0 0 0 0
Interrupt Flag 1 1 1 1
Sign Flag 1 1 1 1
Zero Flag 0 0 0 0
Auxiliary Carry 0 0 0 0
Parity Flag 0 0 0 0
Carry Flag 0 0 0 0

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.

Sir Syed University of Engineering & Technology


Department of Computer Science & Information Technology
Computer Organization & Assembly Language (CS-215L) LAB # 02

TASK#01:

Register Values:

AX=600,BX=0400

Flag Register Values:

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:

AX=1537, BX=2469, CX=AFE8, DX=5A3E

Flag Register Values:

Sir Syed University of Engineering & Technology


Department of Computer Science & Information Technology
Computer Organization & Assembly Language (CS-215L) LAB # 02

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

Sir Syed University of Engineering & Technology


Department of Computer Science & Information Technology

You might also like