You are on page 1of 4

Assignment Solution No.

1 CS401 Fall 2013


MC120401420
Solution Q.1 a)
0FF1: 1234
Segment : Offset
0FF1 : 1234 (16-bit Segment Offset Pair)
In order to calclate t!e "!#sical address $e "t %ero to t!e rig!t of
segment &ale' to do t!at $e mlti"l# t!e segment &ale $it! !e(adecimal
&ale
Secondl# $e "t %ero to t!e left of offset &ale
)o$ 20-bit segment &ale $ill be 0FF10
*nd 20-bit offset &ale $ill be 01234
)o$ $e add t!em
0FF10
01234
------------------------------
11144
* 20-bit &ale t!s t!e "!#sical address of gi&en Segment : Offset Pair
Solution Q.1 a)
1+6, : *23*
Segment : Offset
1+6, : *23* (16-bit Segment Offset Pair)
In order to calclate t!e "!#sical address $e "t %ero to t!e rig!t of
segment &ale' to do t!at $e mlti"l# t!e segment &ale $it! !e(adecimal
&ale
Secondl# $e "t %ero to t!e left of offset &ale
)o$ 20-bit segment &ale $ill be 1+6,0
*nd 20-bit offset &ale $ill be 0*23*
)o$ $e add t!em
1+6,0
0*23*
------------------------------
1F,-*
* 20-bit &ale t!s t!e "!#sical address of gi&en Segment : Offset Pair
Sorr# .ac/ of time
org 0(01000
mo& b(' 1nm10 2"oint b( to 1st nmber
mo& c(' 3 2load cont of nmber to c(
mo& a(' 0 2initiali%e sm to %ero
l1: add a(' b( 2add nmber to a(
add b(' 2 2ad&ance to b( to b( nmber
sb c(' 1 2nmber to be added redced
4n% l1 2if nmber remains add ne(t
mo& 1total0' a( 2$rite bac/ sm in memor#
-------- 2di& 1total0' c(
mo& d(' 1total0 2
mo& a(' 0(4c00
int 0(21
nm1: d$ 1'2'3'4'+'4'3'2'1
total d$ 0
1org 0(01000
mo& a(' 1nm10
mo& b(' 1nm1520
add a(' b(
mo& b(' 1nm1540
add a(' b(
mo& b(' 1nm1560
add a(' b(
mo& b(' 1nm15,0
add a(' b(
mo& b(' 1nm15100
add a(' b(
mo& b(' 1nm15120
add a(' b(
mo& b(' 1nm15140
add a(' b(
mo& b(' 1nm15160
add a(' b(
mo& a(' 0(4c00
int 0(21
nm1: d$ 1'2'3'4'+'4'3'2'1

You might also like