0% found this document useful (0 votes)
11 views8 pages

Assignment 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Assignment 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

The University of Lahore

Department of Computer Science& IT


Fall Term 2024
Title: Assignment 1 Due Date: 29-10-2024 23:59:59
Instructor: Muhammad Yasin Nasir Assig Date: 20-10-2024
Book: Assembly Language Programming Organization of the IBM PC by Ytha Yu
Subject: Computer Organization & Assembly Language
Syllabus: Selected topics from Chapter 01,03,04,05,06
Name: Roll No.

Instructions:
01. Questions are SELF EXPLANATORY. Understanding the Question is part of Solution.
02. Error in Question will be advantageous to Student.
03. Read the Questions carefully before attempting.
04. Attempt All Questions in a Precise Fashion.
05. Manage Your Time. Therefore, there will be no extension in the deadline.
06. Plagiarism may lead to F grade, so be honest.

Submission Method:
01. Assignment must be submitted individually.
02. Take print out of the given assignment. Use A4 size paper (210 × 297 millimeters or 8.27 ×
11.69 inches) to print it out. Solve the assignment on the printed sheets.
03. Use any scanner tool to convert it to pdf. Text must have clear visibility after scanning. Blurred
pdfs will be rejected.
04. Attempt the questions on the given space.
05. Upload the solved assignment (soft copy) at university portal before the deadline.
06. Submit the assignment (hard from) during the first half hour of the subsequent lecture.

Guidelines:
01. Observe the ASCII table . You have to follow character column.
02. Read the following article: Fun with modular arithmetic. Modular concepts are used to formulate
your questions.
03. Read the given example and understand the variables in the description.

First Name as String1 Middle Name as String 2 Last Name as String 3


M u h a m m a d Y a s i n N a s i r

0 1 2 3 4 5 6 7 0 1 2 3 4 0 1 2 3 4

Observe the above three strings. 𝑠1 as Muhammad, 𝑠2 as Yasin and, 𝑠3 as Nasir are three strings.
 Each string is starting with 0 index. e.g. First index is 0 and last index is 7 for string 1.
 Each string must start with CAPITAL letter followed by small letters.

Length of string is number of characters in the string, denoted by 𝐿𝑒𝑛𝑔𝑡ℎ(𝑆𝑡𝑟𝑖𝑛𝑔). For the
given strings, length of three strings are 8, 5 and 5 respectively.
04. Selection of string for the assignment.
a. Use your registered name in the CS department (Used at SAP)
b. Select first three strings of your name. e.g. Syed Abdul Wajid will be selected from Syed
Abdul Wajid Bin Arish.
c. If number of strings are lesser than three in your name, then
i. Use your first name as the second string.
ii. Use your first name as the third string.
05. Evaluate the following values for your assignment to start proceedings.
String 1 = _________________________
String 2 = _________________________
String 3 = _________________________

06. Evaluate the following values for your assignment to start proceedings. Use characters in strings
to evaluate each variable. Fill the values in the given table as per tour requirement. Note: s10
denotes the character at ‘0’ index for string1, s11 denotes the character at ‘1’ index for string1 &
so on.
Variables Values in
Variables Values Variables Values
Hexadecimal
[𝑨𝑺𝑪𝑰𝑰 (𝒔𝟏𝟎)]𝟏𝟔 𝒙𝟎 𝒎𝒐𝒅 𝟐 𝒙𝟎 𝒎𝒐𝒅 (𝟏𝟔)𝟏𝟎
= 𝒙𝟎 = 𝒚𝟎 = 𝒛𝟎
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟏)]𝟏𝟔 𝒙𝟏 𝒎𝒐𝒅 𝟐 𝒙𝟏 𝒎𝒐𝒅 (𝟏𝟔)𝟏𝟎
= 𝒙𝟏 = 𝒚𝟏 = 𝒛𝟏
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟐)]𝟏𝟔 𝒙𝟐 𝒎𝒐𝒅 𝟐 𝒙𝟐 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟐 = 𝒚𝟐 = 𝒛𝟐
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟑)]𝟏𝟔 𝒙𝟑 𝒎𝒐𝒅 𝟐 𝒙𝟑 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟑 = 𝒚𝟑 = 𝒛𝟑
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟒)]𝟏𝟔 𝒙𝟒 𝒎𝒐𝒅 𝟐 𝒙𝟒 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟒 = 𝒚𝟒 = 𝒛𝟒
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟓)]𝟏𝟔 𝒙𝟓 𝒎𝒐𝒅 𝟐 𝒙𝟓 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟓 = 𝒚𝟓 = 𝒛𝟓
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟔)]𝟏𝟔 𝒙𝟔 𝒎𝒐𝒅 𝟐 𝒙𝟔 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟔 = 𝒚𝟔 = 𝒛𝟔
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟕)]𝟏𝟔 𝒙𝟕 𝒎𝒐𝒅 𝟐 𝒙𝟕 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟕 = 𝒚𝟕 = 𝒛𝟕
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟖)]𝟏𝟔 𝒙𝟖 𝒎𝒐𝒅 𝟐 𝒙𝟖 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟖 = 𝒚𝟖 = 𝒛𝟖
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝟗)]𝟏𝟔 𝒙𝟗 𝒎𝒐𝒅 𝟐 𝒙𝟗 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟗 = 𝒚𝟗 = 𝒛𝟗
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝑨)]𝟏𝟔 𝒙𝟏𝟎 𝒎𝒐𝒅 𝟐 𝒙𝟏𝟎 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟏𝟎 = 𝒚𝟏𝟎 = 𝒛𝟏𝟎
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝑩)]𝟏𝟔 𝒙𝟏𝟏 𝒎𝒐𝒅 𝟐 𝒙𝟏𝟏 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟏𝟏 = 𝒚𝟏𝟏 = 𝒛𝟏𝟏
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟏𝑪)]𝟏𝟔 𝒙𝟏𝟐 𝒎𝒐𝒅 𝟐 𝒙𝟏𝟐 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝟏𝟐 = 𝒚𝟏𝟐 = 𝒛𝟏𝟐
Assuming the last variable in the above table using the characters in string1 is 𝒊.

© Yasin Nasir
Variables Values in
Variables Values Variables Values
Hexadecimal
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟐𝟎)]𝟏𝟔 𝒙𝒊+𝟏 𝒎𝒐𝒅 𝟐 𝒙𝒊+𝟏 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒊+𝟏 = 𝒚𝒊+𝟏 = 𝒛𝒊+𝟏
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟐𝟏)]𝟏𝟔 𝒙𝒊+𝟐 𝒎𝒐𝒅 𝟐 𝒙𝒊+𝟐 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒊+𝟐 = 𝒚𝒊+𝟐 = 𝒛𝒊+𝟐
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟐𝟐)]𝟏𝟔 𝒙𝒊+𝟑 𝒎𝒐𝒅 𝟐 𝒙𝒊+𝟑 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒊+𝟑 = 𝒚𝒊+𝟑 = 𝒛𝒊+𝟑
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟐𝟑)]𝟏𝟔 𝒙𝒊+𝟒 𝒎𝒐𝒅 𝟐 𝒙𝒊+𝟒 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒊+𝟒 = 𝒚𝒊+𝟒 = 𝒛𝒊+𝟒
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟐𝟒)]𝟏𝟔 𝒙𝒊+𝟓 𝒎𝒐𝒅 𝟐 𝒙𝒊+𝟓 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒊+𝟓 = 𝒚𝒊+𝟓 = 𝒛𝒊+𝟓

Assuming the last variable using characters in string2 is 𝒋.

Variables Values in
Variables Values Variables Values
Hexadecimal
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟑𝟎)]𝟏𝟔 𝒙𝒋+𝟏 𝒎𝒐𝒅 𝟐 𝒙𝒋+𝟏 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒋+𝟏 = 𝒚𝒋+𝟏 = 𝒛𝒋+𝟏
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟑𝟏)]𝟏𝟔 𝒙𝒋+𝟐 𝒎𝒐𝒅 𝟐 𝒙𝒋+𝟐 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒋+𝟐 = 𝒚𝒋+𝟐 = 𝒛𝒋+𝟐
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟑𝟐)]𝟏𝟔 𝒙𝒋+𝟑 𝒎𝒐𝒅 𝟐 𝒙𝒋+𝟑 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒋+𝟑 = 𝒚𝒋+𝟑 = 𝒛𝒋+𝟑
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟑𝟑)]𝟏𝟔 𝒙𝒋+𝟒 𝒎𝒐𝒅 𝟐 𝒙𝒋+𝟒 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒋+𝟒 = 𝒚𝒋+𝟒 = 𝒛𝒋+𝟒
[𝑨𝑺𝑪𝑰𝑰 ( 𝒔𝟑𝟒)]𝟏𝟔 𝒙𝒋+𝟓 𝒎𝒐𝒅 𝟐 𝒙𝒋+𝟓 𝒎𝒐𝒅 𝟏𝟔
= 𝒙𝒋+𝟓 = 𝒚𝒋+𝟓 = 𝒛𝒋+𝟓

© Yasin Nasir
Q 1: For the 8086 architecture of general computer. Use the following address and it corresponding data
table.
Address Content Equation Data
01𝐹0 𝑦1 𝑦2 𝑦3 𝑦𝑖+1 𝑦𝑖+2 𝑦𝑖+3 𝑦𝑗+1 𝑦𝑗+2
01𝐹1 𝑦1 𝑦2 𝑦5 𝑦𝑗+1 𝑦𝑗+2 𝑦𝑗+3 𝑦𝑖+1 𝑦𝑖+2
01𝐹2 𝑦𝑖+1 𝑦𝑖+2 𝑦𝑖+3 𝑦1 𝑦2 𝑦3 𝑦𝑗+3 𝑦𝑗+2
01𝐹3 𝑦𝑗+1 𝑦𝑗+2 𝑦𝑗+3 𝑦1 𝑦2 𝑦3 𝑦𝑖+2 𝑦𝑖+2
01𝐹4 𝑧1 𝑧𝑖+1
01𝐹5 𝑧𝑗+1 𝑧𝑗+2
01𝐹6 𝑧𝑗+2 𝑧𝑖+2
01𝐹7 𝑧1 𝑧𝑗+1
01𝐹8 𝑧𝑖+2 𝑧𝑗+3
01𝐹9 𝑧𝑗+2 𝑧1
01𝐹𝐴 𝑧𝑖+1 𝑧1
01𝐹𝐵 𝑧𝑗+3 𝑧𝑗+1

Part a:
i) What are the contents of memory word at address 01𝐹2?

ii) What are the contents of memory word at address 01𝐹8?

iii) What are the contents of memory word whose high byte is the byte at address 01𝐹4?

iv) What are the contents of memory word whose high byte is the byte at address 01𝐹2?

© Yasin Nasir
v) What are the contents of memory quad word whose high byte is the byte at address 01𝐹6?

vi) What are the contents of memory double word whose low byte is the byte at address 01𝐹𝐴?

vii) What are the contents of memory quad word whose low byte is the byte at address 01𝐹6?

viii) What are the contents of memory double word whose byte-2 is the byte at address 01𝐹7?

ix) What are the contents of memory quad word whose high byte-3 is the byte at address 01𝐹9?

x) What are the contents of memory quad word whose high byte-4 is the byte at address 01𝐹3?

Part b: What is
i) Bit-7 of byte 01𝐹2 ?

ii) Bit-0 of word 01𝐹3 ?

© Yasin Nasir
iii) Bit-7 of byte 01𝐹2 ?

iv) Bit-11 of word 01𝐹2 ?

v) Low nibble of byte 01𝐹2 ?

vi) High nibble of byte 01𝐹3 ?

vii) Bit-20 of double word at 01𝐹6 ?

viii) Bit-31 of quad word 01𝐹6?

ix) High nibble of ten byte at 01𝐹2 ?

x) Bit-41 of quad word 01𝐹6 ?

© Yasin Nasir
Q 2: Assuming 𝑜𝑓𝑓𝑠𝑒𝑡 = 𝑧𝑗+1 𝑧𝑗+2 𝑧𝑖+2 𝑧𝑖+3 and 𝑝ℎ𝑦𝑠𝑖𝑐𝑎𝑙 𝑎𝑑𝑑𝑟𝑒𝑠𝑠 = 𝑧𝑖+2 𝑧𝑗+2 𝑧𝑖+2 𝑧𝑖+1 𝑧3 , then calculate the
𝑠𝑒𝑔𝑚𝑒𝑛𝑡 𝑎𝑑𝑑𝑟𝑒𝑠𝑠.

Q 3: Assuming 𝑠𝑒𝑔𝑚𝑒𝑛𝑡 𝑎𝑑𝑑𝑟𝑒𝑠𝑠 = 𝑧𝑖 𝑧𝑗 𝑧𝑖−2 𝑧𝑖−3 , and 𝑜𝑓𝑓𝑠𝑒𝑡 𝑎𝑑𝑑𝑟𝑒𝑠𝑠 = 𝑧2 𝑧𝑗+2 𝑧𝑖+2 𝑧3 , then calculate
𝑝ℎ𝑦𝑠𝑖𝑐𝑎𝑙 𝑎𝑑𝑑𝑟𝑒𝑠𝑠.

Q 4: Assuming 𝑠𝑒𝑔𝑚𝑒𝑛𝑡 𝑎𝑑𝑑𝑟𝑒𝑠𝑠 = 𝑧𝑖−2 𝑧𝑗−2 𝑧𝑖+2 𝑧𝑖−1 , and 𝑝ℎ𝑦𝑠𝑖𝑐𝑎𝑙 𝑎𝑑𝑑𝑟𝑒𝑠𝑠 = 𝑧𝑖+2 𝑧𝑗+2 𝑧𝑖+2 𝑧𝑖+1 𝑧3 , then
calculate 𝑜𝑓𝑓𝑠𝑒𝑡 𝑎𝑑𝑑𝑟𝑒𝑠𝑠.

© Yasin Nasir
Q 5: Assuming 𝐴𝑋 = 𝑧𝑖−2 𝑧𝑗−2 𝑧𝑖+2 𝑧𝑖−1 and 𝐵𝑋 = 𝑧𝑖 𝑧𝑗 𝑧𝑖−2 𝑧𝑖−3 , perform the following operations in the given
table and write down the status of flag bits as 1/0.
Note: Fill the given table assuming the status of register/ flag bits after execution.
Default Flag bits SF=0 ZF=0 CF=0 AF=0 OF=0 PF=0
AX BX SF ZF CF AF OF PF
AND AX, BX
ADD AX,BX
OR AX,BX
SUB AX,BX
AND AH,BL
XOR BH,BH
XOR AL,AL
OR AH,AH

Q 6: Assuming 𝐴𝑋 = 𝑧𝑗+1 𝑧𝑗+2 𝑧𝑖+2 𝑧𝑖+3 and 𝐵𝑋 = 𝑧𝑗+2 𝑧𝑖+2 𝑧𝑖+1 𝑧3 , perform the following operations in the
given table and write down the status of flag bits as 1/0.
Note: Fill the given table assuming the status of register/ flag bits after execution.

Default Flag bits SF=1 ZF=1 CF=1 AF=1 OF=1 PF=1


AX BX SF ZF CF AF OF PF
AND AX, BX
ADD AX,BX
OR AX,BX
SUB AX,BX
AND AH,BL
XOR BH,BH
XOR AL,AL
OR AH,AH

© Yasin Nasir

You might also like