VUSuperior Chat Room

Tuesday, 19 May 2015

CS401 - Computer Architecture and Assembly Language Programming Assignment No. 1 Solution and Discussion Spring 2015 Due Date: May 20, 2015

CS401 Assembly language
Question No.1:


Solution:
1.      BX+SI+0xFF00
By adding these registers we get effective address
BX+SI+0xFF00
0x is offset
0000
+01A2
+FF00
=166A0
Physical Address
DX is the default of BX
BX=DXx10
=0A2Ex10
=0A2E0
Adding all registers again
0A2E0+166A0=26A40
This is the physical address.

2.      BP+DI+0xA000
By adding these registers we get effective address
BP+DI+0xA000
0x is offset
0000
+000A
+A000
A00A
Physical Address
BP is the default value of SS
BP=SSx10
BP=12A1x10
BP=12A10
Add all registers again
12A10+A00A=1CA1A
Question No.2:

 www.vusuperior.net
Solution:
Code:
[org 0x0100]
MOV CX, 5 ; DECIMAL MOVE 5
MOV BP, P_NUM ; PUTING ADDRESS OF P_NUM TO BP
MOV AX, [BP] ; FIST ELEMENT TO AX
ADD BP, 6 ; MOVING ON 4RTH ELEMENT OF P_NUM
MOV BX, [BP]
ADD BP, 2
MOV DX, [BP]
ADD AX, BX
ADD AX, DX
MOV DX, AX
MOV AX, 0X0C400
INT 0X21
P_NUM DW 2, 3, 5, 7, 11







0 comments:

Post a Comment