Вы находитесь на странице: 1из 4

Computer Organization and Assembly

Language
CS – 204

Instructor
Ms. Saman Iftikhar
Submitted By
Muzaffar Salik
Roll Number: 1388
BS – CS (4th Semester)

College of Computer Sciences and Information Studies


Government College University, Faisalabad.
BS (cs) Assignment # 1
cs-204

Computer Organization and Assembly Language

Assignment # 1 Dated: Thursday, March 17, 2011


Total Marks = 40
Assignment due on next Thursday before class

Q.1. How do assembler and linker work together? 5 Marks


An assembler is a program that converts s source-code programs from assembly language into
machine e language. The assembler can optionally generate a source listing file with line
numbers, memory add resses, source code statement s, and a cross -reference listing of symbols
and variables used in a program
The task for the linker is to grab all object files and make one executable. It uses the object files
generated by the compiler and the assembler tool together with some regenerated libraries (for
example libc, where some standard functions are defined (memcpy, malloc, printf ...). Because of
the linker, you can call from one C-file functions that are defined in an other one. The linker will
search the object files for finding the references.
Q.2. Translate the following C++ expression to assembly language. 5 Marks
X = ( Y * 4 ) +3
Mov eax,Y ;Move Y t o the EAX register
i mul eax,4 ;Mul t i p l y 4 t o the EAX register
Add eax,3 ;add 3 t o the EAX register
mov X, eax ;Move EAX to X
Q.3. How does the Intel IA-32 processor architecture demonstrate an example of a virtual machine? 5 Marks
The virtual machine concept in Intel IA-32 processor is an effective way of showing how each
layer in a IA-32 processor architecture represents an abstraction of a machine. Layers can be
constructed of hardware or software, and programs written at any layer can be translated or
interpreted by the next-lowest layer. The virtual machine concept can be related to IA-32
processor architecture and real-world computer layers. Including digital logic micro architecture,
instruction set architecture, operating system, assembly language and high-level languages.
Q.4. What is the binary representation of the following hexadecimal numbers? 6 Marks
a. B697C7A1
B 6 9 7 C 7 A 1
101 011 100 011 110 011 101 0001
1 0 1 1 0 1 0
(B697C7A1)16= (10110110100101111100011110100001)2
b. 6ACDFA95
6 A C D F A 9 5
011 101 110 110 111 101 100 0101
0 0 0 1 1 0 1

3/23/2011 8:41:01 PM BY
M.IRFAN ARSHAD
BS (cs) Assignment # 1
cs-204

(6ACDFA95)16= (01101010110011011111101010010101)2

Q.5. What is the 16-bit hexadecimal representation of each signed decimal integer? 6 Marks
a. -452

16 452
16 28 4
` 1 C
(452)10= (1C4)16
2’s Complement of 1C4 is E3C
So (-452)10= (E3C)16

b. -62
16 62
3 E
(62)10= (3E)16
2’s Complement of 3E is C2
So (-62)10= (C2)16

Q.6. What is the 8-bit binary (2’s complement) representation of each of the following signed decimal integers. 6
Marks
a. -36
2 36
2 18 0
2 9 0
2 4 1
2 2 0
2 1 0
(36)10= (00100100)2
2’s Complement
00100100
11011011
+ 1
(-36)10= (11011100)2

b. -98
2 98
2 49 0
2 24 1
2 12 0
2 6 0
2 3 0
1 1

3/23/2011 8:41:01 PM BY
M.IRFAN ARSHAD
BS (cs) Assignment # 1
cs-204

(98)10= (01100010)2
2’s Complement
01100010
10011101
+ 1
(-98)10= (10011110)2

Q.5. What is the largest unsigned integer that may be stored in 20 bits? 5 Marks

20-bit
integer Unsigned: 20 log102 From 0 to 1048575
0 to (2n − 1)

Q.6. If a Boolean function has 4 inputs, how many rows would be required for its truth table? 2 Marks

Input Rows
4 16

3/23/2011 8:41:01 PM BY
M.IRFAN ARSHAD

Вам также может понравиться