Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CS401 Computer Architecture and Assembly Language Programming Assignment No. 01
#1
CS401 Computer Architecture and Assembly Language Programming Assignment No. 01 Discussion and Solution Fall 2014 Due Date Nov 24, 2014


We have the following register values:

AX = 420AH,

BX = A12EH,

DS = 22EAH,

CS = 0100H,

ES = 0FEAH,

SS = 0FE0H,

SI = 0010,

BP = 02ACH and

DI = 0300H.



You are required to calculate the physical address generated by each of the following instructions?



mov [bx+si+di],ax
ADD AX,[BP+12]


Note: Every instruction is independent of others.





Question No. 2: (10 marks)



Assemble the given program using NASM.
[ORG 0X0100]

MOV CX, 5

XOR AX, AX

MOV BX, NUM



L1: ADD AX, [BX]

ADD BX, 2

SUB CX, 1

JNZ L1



MOV [SUM], AX

MOV AX, 0X4C00

INT 0X21



NUM: DW 0, 1, 2, 3, 4.

SUM: DW 0

[ATTACH=CONFIG]24151[/ATTACH]







After that load the Debugger by typing AFD in the command prompt like in Fig 1.




Fig 1: Loading debugger.



The AFD window will be opened. The complete description is given below in fig 2
Fig 2: AFD description.



When the program is loaded in the debugger, it is loaded at offset 0100, which displaces all memory accesses in our program. Execute the program step by step and examine how the memory is read and the registers are updated, how the instruction pointer moves forward.


Now we execute the program with F2 key (instruction will move one by one) and write down the contents of the specified registers in the given table





Instruction
Register current value after the instruction execution
IP

(Instruction Pointer)
Flags

OF
CF
ZF
PF
SF
AF
1


[ORG 0X0100]
AX









BX


CX


DX


2


MOV CX, 10


AX









BX


CX


DX


3


XOR AX, AX


AX









BX


CX


DX


4


MOV BX, NUM


AX









BX


CX


DX


5


ADD AX, [BX]


AX











BX


CX


DX


6


ADD BX, 2


AX









BX


CX


DX


7


SUB CX, 1


AX









BX


CX


DX


8


JNZ L1


AX









BX


CX


DX


9


ADD AX, [BX]


AX











BX


CX


DX


10


ADD BX, 2


AX









BX


CX


DX


11


SUB CX, 1


AX









BX


CX


DX


12


JNZ L1


AX









BX


CX


DX


13


ADD AX, [BX]


AX











BX


CX


DX


14


ADD BX, 2


AX









BX


CX


DX


15


SUB CX, 1


AX









BX


CX


DX


16


JNZ L1


AX









BX


CX


DX


17


ADD AX, [BX]


AX











BX


CX


DX


18


ADD BX, 2


AX









BX


CX


DX


19


SUB CX, 1


AX









BX


CX


DX


20


JNZ L1


AX









BX


CX


DX


21


ADD AX, [BX]


AX











BX


CX


DX


22


ADD BX, 2


AX









BX


CX


DX


23


SUB CX, 1


AX









BX


CX


DX


24


JNZ L1


AX



BX


CX


DX


25


MOV [SUM], AX


AX





BX

CX

DX

26


MOV AX, 0X4C00


AX





BX

CX

DX

27


INT 0X21


AX






BX

CX

DX


Table: Register contents after the execution of each instruction.


Attached Files
.jpg   CS401ComputerArchitectureandAssemblyLanguageProgrammingAssignment1SolutionFall2014.jpg (Size: 82.7 KB / Downloads: 355)

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#2
We have the following register values:
AX = 420AH,
BX = A12EH,
DS = 22EAH,
CS = 0100H,
ES = 0FEAH,
SS = 0FE0H,
SI = 0010,
BP = 02ACH and
DI = 0300H.

You are required to calculate the physical address generated by each of the following instructions?

mov [bx+si+di],ax
ADD AX,[BP+12]

Solution:
1.mov [bx+si+di],ax
EA= A12EH+0010+ 0300
=AF24H
Physical address = segment*0x10+EA
= DS +EA
=22EAH + AF24H
=0x321934



ADD AX,[BP+12]
EA = 420AH , [02ACH+12]
= ADD 420AH, 02424
= 44434

Physical address = segment*0x10+EA
=SS+EA
= 0FE0H+44434
=0x45948
is it rite?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cs403 Assignment 3 Helping material May 8,2010 viki 1 5,203 04-28-2020, 03:19 PM
Last Post: ClaireBeauc
  cs301 assignment no 3 Solution 20 January 2016 Vuhelper 0 11,089 01-20-2016, 03:32 PM
Last Post: Vuhelper
  CS201 Assignment vo 3 Solution 20th January 2016 Vuhelper 2 2,597 01-20-2016, 03:28 PM
Last Post: Vuhelper
  CS101 Assignment no 3 Solution 20th January 2016 Vuhelper 0 2,279 01-20-2016, 03:25 PM
Last Post: Vuhelper
  SOC101 INTRODUCTION TO SOCIOLOGY assignment no 3 Solution 20 January 2016 Vuhelper 0 1,869 01-20-2016, 03:19 PM
Last Post: Vuhelper
  CS402 Assignment No 4 Solution & Discussion Xpert 0 2,097 08-01-2015, 02:33 AM
Last Post: Xpert
  cs101 Assignment No. 1 Solution 21 may spring 2015 semester Xpert 0 2,909 05-21-2015, 12:41 AM
Last Post: Xpert
  Assignment solution eng 301 due date 20 may 2015 rumesa khan 3 4,531 05-20-2015, 01:34 AM
Last Post: Xpert
  PHY301 Circuit Theory Assignment No. 1 idea Solution spring may 2015 semester Xpert 0 1,558 05-15-2015, 03:52 AM
Last Post: Xpert
  Assignment No. 01 Spring 2015 Information Systems CS507 idea solution spring 2015 Xpert 0 2,447 05-15-2015, 03:49 AM
Last Post: Xpert

Forum Jump:


Users browsing this thread: 1 Guest(s)