Sunday, 17 November 2013

CS401 Computer Architecture and Assembly Language Programming idea solution Assignment No 1 November 20, 2013

Q 1: Calculate physical address for the following segment-offset pairs:
  1. a.      0FF1:1234
  2. b.      1568:A23A
Marks [5+5]
Q 2: Write an assembly language code to calculate arithmetic mean of the following Array elements and store result in DX.
Array = 1, 2, 3, 4, 5, 4, 3, 2, 1
Also attach snapshot of AFD window showing the arithmetic mean in DX register.
In order to calculate the physical address of some location in the memory, we must have segment:offset pair.  Now suppose that segment:offset pair is 1234:5678. It means we have a Segment base address CS=0x1234 and an Offset Address say IP=0x5678. In order to generate 20-bits address of the two CS and IP registers, the following technique is used:

1. We put a zero to the right of CS i.e. CS=0x12340. To put a 0 to the right, we multiply the segment value with hexadecimal value 0x10.
2. We put a zero to the left of IP i.e. IP =0x05678.
3. We Add the two new values which is 0x12340+0x05678 = 0x179B8 (a 20-bit value) which is the physical address for given segment:offset pair

Calculate physical address for the following segment-offset pairs
a. 0FF1:1234

segment : offset pair = 0FF1 : 1234
Segment = 0FF1
offset = 1234
physical Address = segment * 0x10 + offset
= 0FF1 * 0x10 + 1234
= 0FF10 + 1234
= 11144



segment : offset pair = 1568 : A23A
Segment = 1568
offset = A23A
physical Address = segment * 0x10 + offset
= 1568 * 0x10 + A23A
= 15680 + A23A
physical address = 1F8bA
zakki


Marks [10]