Course code: CS504
Solution-
Join Our Groups:
http://Groups.Google.Com/group/vubest
http://facebook.com/groups/vubest
Show your LOVE Please Like us on facebook
Click Thumbs Up
Assignment No. 01
Computer Architecture and Assembly Language Programming
Question No. 1:
Calculate physical address of your AFD window contains CS and IP register (segment offset pairs).
Explain each and every step for calculating the physical address.
(Calculation:4 marks
Explanation:3 marks
Snapshot:3 marks )
Note: Provide snapshot of your AFD window. Please give us this type of your AFD window and mention which segment register value and offset value you have used for calculating physical address. Please see below sample snapshot.
Solution:-
Physical address = 1E090 + 00100 = 1E190
CS:1E090
IP:00100
Physical address : 1E190
Question No. 2:
Write a program to add these 8 numbers (15, 20, 25, 30, 35, 40, 45, and 50) with using conditional jump. Explain each instruction of program in your own words.
( Program:5 marks
Snapshot: 5 marks )
Note: Provide snapshot of your program which will be run in AFD window. It is strictly prohibited the copied assignment.
Solution-
Program code
- [org 0x0100]
- mov bx, 0 ; initialize array index to zero
- mov ax, 0 ; initialize sum to zero
- l1: add ax, [addnum +bx] ; add number to ax
- add bx, 2 ; advance bx to next index
- cmp bx, 16 ; are we beyond the last index
- jne l1 ; if not add next number
- mov [totalsum], ax ; write back sum in memory
- mov ax, 0x4c00 ; terminate program
- int 0x21
- addnum: dw 15, 20, 25, 30, 35, 40, 45,50
- totalsum: dw 0
- Total sum (result) show in AX register
Join Our Groups:
http://Groups.Google.Com/group/vubest
http://facebook.com/groups/vubest
Show your LOVE Please Like us on facebook
Click Thumbs Up
Comments
Post a Comment