CS 401 Computer Architecture and Assembly Language Programming, Exercises of Computer Science

CS 401 Computer Architecture and Assembly Language Programming exercise solution

Typology: Exercises

2018/2019

Uploaded on 07/07/2019

Khadijashakeel
Khadijashakeel 🇵🇰

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 401 Computer Architecture and Assembly Language
Programming
Assignment #01
Deadline
Your assignment must be uploaded / submitted before or on October 18, 2006.
Upload Instructions
Please view the assignment submission process document provided to you by the Virtual
University to upload the assignment.
Rules for Marking
Please note that your assignment will not be graded if:
It is submitted after due date
The file you uploaded does not open
The file you uploaded is copied from some one else
It is in some format other than .doc
Objective
The assignment has been designed to enable you:
To know about different addressing modes
To calculate effective address and physical address
To know about the comparisons and conditions
Question # 1. What is wrong with following instructions?
)a mov [byte1], 20
)b mov [111],[333]
)c mov [BX],[SI]
)d mov CS, SS
)e mov DL, CX
Solution:
a. Size of movement is not specified.
b. Memory to memory data movement is not allowed
c. Memory to memory data movement is not allowed.
d. Segment to Segment movement is not allowed.
e. Size mismatch.
Question # 2 What is the effective address generated by the following combinations if
they are valid. Initially BX= 0x0200, SI= 0x0020, DI= 0x0002, BP= 0X400 AND SP=
0XFFFF?
a) bx + bp
b) bx + sp
pf3
pf4

Partial preview of the text

Download CS 401 Computer Architecture and Assembly Language Programming and more Exercises Computer Science in PDF only on Docsity!

CS 401 Computer Architecture and Assembly Language

Programming

Assignment

Deadline

Your assignment must be uploaded / submitted before or on October 18, 2006.

Upload Instructions

Please view the assignment submission process document provided to you by the Virtual

University to upload the assignment.

Rules for Marking

Please note that your assignment will not be graded if:

  • It is submitted after due date
  • The file you uploaded does not open
  • The file you uploaded is copied from some one else
  • It is in some format other than .doc

Objective

The assignment has been designed to enable you:

  • To know about different addressing modes
  • To calculate effective address and physical address
  • To know about the comparisons and conditions

Question # 1. What is wrong with following instructions?

)a mov [byte1], 20

)b mov [111],[333]

)c mov [BX],[SI]

)d mov CS, SS

)e mov DL, CX

Solution:

a. Size of movement is not specified.

b. Memory to memory data movement is not allowed

c. Memory to memory data movement is not allowed.

d. Segment to Segment movement is not allowed.

e. Size mismatch.

Question # 2 What is the effective address generated by the following combinations if

they are valid. Initially BX= 0x0200, SI= 0x0020, DI= 0x0002, BP= 0X400 AND SP=

0XFFFF?

a) bx + bp

b) bx + sp

c) bx + di

d) bx-si

e) bx + 100

Solution:

a) Invalid

b) Invalid

c) 0x

d) Invalid

e) 0x

Question # 3

If AX=0x8000 and BX=0x0001 and “cmp ax, bx” is executed, which of the following

jumps will be taken? Each part is independent of others. Also give the value of Z, S, and

C flags.

.a jg greater

.b jl smaller

.c ja above

.d jb below

Solution:

Instructions Jump ZF SF CF

Jg greater Not taken 0 0 0

Jl smaller Taken 0 0 0

Ja above Taken 0 0 0

Jb below Not taken 0 0 0

CS401 Assignment No. 1 Fall

2011 solution

Question No. 1: a) Suppose your computer has a processor with 24-bit address lines. What is maximum amount of memory that can be attached in your system? (Show the step(s) for calculation of maximum addressable memory) (2.5 marks) Solution: – Accessible memory addresses = 2number of address bits 224 = 16777216 bytes 16777216 / 1024 = 16384 KB 16384 / 1024 = 16 MB b) How many address bits are required for accessing 1GB RAM? (Show the step(s) for calculation of required address bits) (2.5 marks) Solution: – As you know 1GB means 1024MB so we can write it as 1GB = 1024 x 1MB As you know that 1MB is 220

_______

0BA23 = physical address 3) D3B8 0 0 F222 +


E2DA2 = physical address 4) 00A0 0 0 1234 +


01C34 = physical address 5) 8FEF 0 0 0FFF +


90EEF = physical address b) What is effective address generated by the following instructions? Every instruction is independent of others. vusolutions Initially bx = 0x0101, bp=0x0222, si=0x1234, var1=0x1771 (1 mark each)

_1. mov ax, [bx+si]

  1. mov ax, [bx+100] (100 is in decimal)
  2. mov ax, [bp+si]
  3. mov ax, [var1+bp]_
  4. mov ax, [si+var1] Solution: – 1) Effectice address = [bx+si] = [0101 + 1234] = [1335] 2) Effectice address = [bx + 100] After converting 100 into hexadecimal Effectice address = [bx + 64] = [0101 + 64] = [0165] 3) Effective address = [bp+si] = [0222 + 1234] = [1456] 4) Effective address = [var1+bp] = [1771 + 0222] = [1993] 5) Effective address = [si + var1] = [1234 + 1771] = [29A5]