Friday , 22 November 2024

CS401 Assignments # 1 Solution Spring 2012

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. 

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.



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.    

Note: Provide snapshot of your program which will be run in AFD window. It is strictly prohibited the copied assignment.
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

  1. int 0x21
  1. addnum: dw 15, 20, 25, 30, 35, 40, 45,50
  1. totalsum: dw 0

Total sum (result) show in AX register

Check Also

CS401 Assignment no 03 Solution Spring 2013 has been uploaded

Please carefully read the following instructions before attempting assignment.   Rules for Marking It should be clear …

Leave a Reply

Your email address will not be published. Required fields are marked *

*