Skip to main content

Computer Architecture and Assembly Language Programming, Assignment No.1 solution

Course code: CS504
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

  1. [org 0x0100]
  1. mov bx, 0                                                                  ; initialize array index to zero
  1. mov ax, 0                                                                   ; initialize sum to zero
  1. l1: add ax, [addnum +bx]                                       ; add number to ax              
  1. add bx, 2                                                                  ; advance bx to next index
  1. cmp bx, 16                                                              ; are we beyond the last index
  1. jne l1                                                                        ; if not add next number
  1. mov [totalsum], ax                                                 ; write back sum in memory
  1. mov ax, 0x4c00                                                            ; terminate program
  2. int 0x21
  1. addnum: dw 15, 20, 25, 30, 35, 40, 45,50
  1. totalsum: dw 0
  2. 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

Popular posts from this blog

Drupal Answers Weekly Newsletter - Wednesday, December 31, 2014

Top new questions this week: Can I delete old hook_update_N functions? Suppose you have a custom module, and you have hook_update_N() implementations in your .install file. If you have old update functions, and all updates have run in all sites that the module is ... node-update hook-update-n   asked by AyeshK ...

[New post] 8th Class Result 2014 PEC Hafizabad Board

Muhammad Waqas posted: "PEC Hafizabad Board 8th Class Result 2014 expected date is 28th March, 2014 by PEC. Punjab Examination Commission (PEC) will announce 8th class result for Hafizabad Board soon and all the students of Hafizabad Board who are extremely waiting for the resul" New post on Jobs in Pakistan 8th Class Result 2014 PEC Hafizabad Board by Muhammad Waqas ...

[New post] 1st Year (11th Class) Result 2014 BISE Rawalpindi Board

Xaib Aslam posted: "BISERWP board Inter part 1 result expected on 10th October 2014 according our source. students of Rawalpindi board desperately waiting for 11th class result. 1st they upload the 12th class result and after some time they ready for showing the 1st year fin" New post on Jobs in Pakistan 1st Year (11th Class) Result 2014 BISE Rawalpindi Board by Xaib Aslam ...