CS401 Assembly Language Assignment Solution Fall 2012

Part (A):
Calculate physical address of the following segment offset pairs. Explain each and every step for calculating the physical address.                                  (Calculation:3 marks, Explanation:2 marks)
  1. 2C3E:0199
  2. 8000:0250

Part (B):
Assemble the given program using NASM.
(5 marks)
ORG 0100H
MOV AX,5H
ADD AX,44ABH
MOV BX,10
ADD AX,BX
SUB AX,0F12H
MOV BX,15
ADD AX,BX
MOV AX,0X4C00
INT 0X21
solution of part B:
1 ORG 0100H AX 0005 0103 0 0 0 0 1
BX 0000
2 MOV AX,5H AX 44B0 0106 0 0 0 0 1
BX 0000
3 ADD AX,44ABH AX 44B0 0109 0 0 0 0 1
BX 000A
4 MOV BX,10 AX 44BA 010B 0 0 0 0 0
BX 000A
6 ADD AX,BX AX 35A8 010E 0 0 0 0 0
BX 000A
7 SUB AX,0F12H AX 35A8 0111 0 0 0 0 0
BX 000F
8 MOV BX,15 AX 35B7 0113 0 0 1 0 0
BX 000F
9 ADD AX,BX AX 4C00 0116 0 0 1 0

  1. Now we execute the program with F2 key (instruction will move one by one) and write down the contents of the specified registers in the given table.


Instruction
Register current value after the instruction execution
IP
(Instruction Pointer)
Flags
CF
ZF
PF
SF
AF
1 ORG 0100H AX






BX
2 MOV AX,5H AX






BX
3 ADD AX,44ABH AX






BX
4 MOV BX,10 AX






BX
6 ADD AX,BX AX






BX
7 SUB AX,0F12H AX






BX
8 MOV BX,15 AX






BX
9 ADD AX,BX AX






BX

Question No. 2:
Now after attempting previous question, You are able to write, assemble and debug a program. So write a program using Conditional Jump instructions that will add all odd numbers between 1 to 20 (not including 1 & 20). Explain each instruction of program in your own words and also attach the snapshot of your AFD showing the executed code results.
(Program:5 marks, Explanation: 3 marks & Snapshot: 2 marks)
Note: Provide snapshot of your program which will be run in AFD window. It is strictly prohibited the copied assignment.

Leave a Reply

Related Posts Plugin for WordPress, Blogger...