**Make changes before upload. I will not be responsible for your marks.**
Computer
Architecture and Assembly Language Programming (CS401) Assignment
No. 1 |
Total marks = 20
Deadline Date: November 14, 2023 |
Please carefully read the following instructions
before attempting assignment.
RULES
FOR MARKING
It
should be clear that your assignment would not get any credit if:
- The assignment is submitted
after the due date.
- The submitted assignment does
not open or file is corrupt.
- Strict action will be taken if
submitted solution is copied from any other student or from the internet.
You
should concern the recommended books to clarify your concepts as handouts are
not sufficient.
You
are supposed to submit your assignment in .doc or
docx format.
Any other formats like scan images, PDF, zip, rar, ppt and bmp etc.
will not be accepted.
Lectures
covered: 1-10
Topics
covered: Data Declaration and Direct Addressing, Indirect Addressing, Branching,
Unconditional jumps and relative addressing
NOTE
No
assignment will be accepted after the due date
via email in any case (whether it is the case of load shedding
or internet malfunctioning). Hence refrain from uploading assignment in the
last hour of the deadline. It is recommended to upload your solution file at
least two days before its closing date.
If
you find any mistake or confusion in the assignment (Question statement),
please contact your instructor before the deadline. After the deadline, no queries
will be entertained in this regard.
For any query, feel free to email at cs401@vu.edu.pk
Problem
statements:
Mr. Zaid is a student of Virtual
University of Pakistan, his VUID is BC230212345. In Fall 2023, he enrolled
himself in the CS401, Computer Architecture and Assembly Language Programming.
Mr. Zaid has very good programming skills in Assembly language programming. He
wrote an assembly language program in which he used direct addressing method to
store some data at specific segment: offset pair. The segment address he
provided were the first four numeric digits of his VUID, while offset he
provided were preceding four numeric digits i.e., first four digits of
his VUID are 2302 and preceding four numbers are 1234. The data he stored in
the given offset pair was stored in specific 24254 address in the physical
memory.
Task No. 1 (10 Marks)
You are required to use your own
VUID as Mr. Zaid did, and do the following tasks:
1) Find out the physical address from your
segment: offset pair.
2) What will be the last possible
physical address accessible using your segment address?
3) What will be the first possible
physical address accessible using your segment address?
4) Write assembly language
instruction(s) to store any data in your offset address of current code segment.
5) Write assembly language
instruction(s) to store any data in your segment offset pair.
Note: Assume the VUID is already in hexadecimal
format, so you don’t have to convert it.
Task No. 2 (10 Marks)
Write assembly language program
that:
a) Stores VUID in the memory.
b) Sums up all even digits of your
VUID.
c) Sums up all odd digits of your VUID.
d) Subtracts the sum of odd digits
from the sum of even digits.
e) Stores the result in memory.
Submission details:
Following
are required in a single MS-Word document.
a) Solution(s) of task 1.
b) Assembly language program for task
2.
c) Screenshot showing the results.
“Best
of luck”
SOLUTION:
FOR PAID SOLUTION CONTACT
ME ON WHATSAPP
Change highlighted text according to VUID
TASK
No. 1
1)
Find out the physical address from your
segment: offset pair.
Physical Address = Segment + Offset
VU ID = BC230212345
Segment: 2302
Offset: 1234.
Physical Address 23020 + 01234
Physical Address = 24254
2)
What will be the last possible physical
address accessible using your segment address?
Physical Address Segment + Max Offset
Max Offset FFFF
Physical Address = 23020 + OFFFF
Physical Address 3301F
3)
What will be the first possible physical
address accessible using your segment address?
Physical Address Segment + Min Offset
Min offset 0000
Physical Address = 23020 + 00000
Physical Address 23020
4)
Write assembly language instruction(s) to
store any data in your offset address of current code segment.
.org Ox01001
data: dw 45
mov byte [offset_address], data
mov ax, 0x4c00
int 0x21
5)
Write assembly language instruction(s) to
store any data in your segment offset pair.
org[Ox01001
data: dw 3456
mov ax, Ox1904
mov ds, ax
mov [segment_address], data
mov ax, 0x4c00
int 0x21
****************************************************************************************************************************
Task No. 2
[org 0x0100]
jmp start
stdId: dw 1, 6, 0, 4, 0, 4, 5, 6, 7
odd_sum: dw 0
answer: dw 0
start:
mov bx, stdId
mov cx, 9
xor ax, ax
loop1:
mov dx, [bx]
test dx, 1
jnz odd_number
add ax, dx
jmp next_number
odd_number:
add [odd_sum], dx
next_number:
add bx, 2
sub cx, 1
jnz loop1
sub ax, [odd_sum]
mov [answer], ax
mov ax, 0x4c00
int 0x21
Post a Comment
Don't Forget To Join My FB Group VU Vicky
THANK YOU :)