SlideShare a Scribd company logo
1 of 5
Download to read offline
Computer Architecture and
Assembly Language
Programming (CS401)
Assignment # 01
Total marks = 20
Due Date:
SOLUTION FILE
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.
Topic Covered:
 Basic DOSBox and NASM understanding to run assembly code
 Various Addressing modes to access memory
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 etc.). Hence refrain from uploading assignment in the last hour of
deadline. It is recommended to upload solution file at least two days before its closing date.
If you people find any mistake or confusion in assignment (Question statement), please consult with
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 Statement:
Save your complete VUID in memory using Base Register Indirect + Offset addressing mode (if
last digit of your VUID is Odd) or Indexed Register Indirect + Offset addressing mode (if last digit
of your VUID is even).
Detailed Instructions:
This assignment will give hands on experience of how to run assembly language code using
DOSBox and NASM. First, you have to define labels for storing your VUID and then store each
alphabet/digit of VUID, step by step, in to any general purpose registers. Finally, store the
alphabet/digit from general purpose register to respective memory location (which you have
defined by label in above step).
Addressing Modes to use:
In order to access VUID and storing it in memory, you have to use ONE of the following
addressing modes:
 Base Register Indirect + Offset (only if last digit of your VUID is Odd)
 Indexed Register Indirect + Offset (only if last digit of your VUID is Even)
NOTE: Zero marks will be awarded, if you do not follow proper addressing mode.
What to Submit:
After writing your code, open DOSBox and run NASM (as described in video tutorial shared in
Announcement page of this course). Assemble the code using nasm command and take
screenshot. After that, open the COM file in debugger (AFD).
Run your code by pressing F1 key until last statement of code is reached. At this stage, Data
Window # 2 of AFD should display your complete VUID (at consecutive locations; see below
example). Also take screenshot of AFD.
Your assignment must be submitted as a SINGLE WORD document (DOC or DOCX) with:
1) Code written in Word
2) Screenshot of compilation step (DOSBox)
3) Screenshot of AFD
NOTE: When you take screenshot of compilation step and AFD, take screenshot of whole
screen, not of DOSBox and AFD. Cropping or any tempering with screenshot will result in ZERO
marks.
Example:
Suppose a student VUID is BC123456789. The last digit of this VUID is 9 which is an Odd
number. So, this student will use Base Register Indirect + Offset addressing mode to solve this
assignment.
Sample screenshot of final output:
Note that Data Window # 2 is showing student VUID:
Helping Material:
 Detailed video tutorial of how to use DOSBox and NASM is already shared with you in
Announcement page of this course
 Command to manipulate Data Windows of AFD is mentioned in AFD tutorial (link is
given in the same Announcement)
 Use ASCII table for first two alphabets of your VUID
SOLUTION:
If last digit of VUID is Odd: BASE REGISTER INDIRECT + OFFSET
[org 0x100]
mov bx, 0
mov ax, 0
mov ax, [ID+bx]
mov [myID], ax
mov ax, [ID+bx+2]
mov [myID+1], ax
mov ax, [ID+bx+4]
mov [myID+2], ax
mov ax, [ID+bx+6]
mov [myID+3], ax
mov ax, [ID+bx+8]
mov [myID+4], ax
mov ax, [ID+bx+10]
mov [myID+5], ax
mov ax, [ID+bx+12]
mov [myID+6], ax
mov ax, [ID+bx+14]
mov [myID+7], ax
mov ax, [ID+bx+16]
mov [myID+8], ax
mov ax, [ID+bx+18]
mov [myID+9], ax
mov ax, [ID+bx+20]
mov [myID+10], ax
mov ax, 0x4c00
int 0x21
ID: dw 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9
myID: dw 0
If last digit of VUID is Even: Indexed Register Indirect + Offset
[org 0x100]
mov si, 0
mov ax, 0
mov ax, [ID+si]
mov [myID], ax
mov ax, [ID+si+2]
mov [myID+1], ax
mov ax, [ID+si+4]
mov [myID+2], ax
mov ax, [ID+si+6]
mov [myID+3], ax
mov ax, [ID+si+8]
mov [myID+4], ax
mov ax, [ID+si+10]
mov [myID+5], ax
mov ax, [ID+si+12]
mov [myID+6], ax
mov ax, [ID+si+14]
mov [myID+7], ax
mov ax, [ID+si+16]
mov [myID+8], ax
mov ax, [ID+si+18]
mov [myID+9], ax
mov ax, [ID+si+20]
mov [myID+10], ax
mov ax, 0x4c00
int 0x21
ID: dw 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 8
myID: dw 0

More Related Content

Similar to Fall 2019 cs401 1_sol

M150 A Fall2010 T01
M150 A Fall2010 T01M150 A Fall2010 T01
M150 A Fall2010 T01abdalodainat
 
Aae oop xp_02
Aae oop xp_02Aae oop xp_02
Aae oop xp_02Niit Care
 
The Lab assignment will be graded out of 100 points.  There are .docx
The Lab assignment will be graded out of 100 points.  There are .docxThe Lab assignment will be graded out of 100 points.  There are .docx
The Lab assignment will be graded out of 100 points.  There are .docxjmindy
 
Beginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksJinTaek Seo
 
Introduction to Box2D Physics Engine
Introduction to Box2D Physics EngineIntroduction to Box2D Physics Engine
Introduction to Box2D Physics Enginefirstthumb
 
AdminCamp2019 - Notes V10 Upgrades - Alles was man wissen muss!
AdminCamp2019 - Notes V10 Upgrades - Alles was man wissen muss!AdminCamp2019 - Notes V10 Upgrades - Alles was man wissen muss!
AdminCamp2019 - Notes V10 Upgrades - Alles was man wissen muss!Christoph Adler
 
May 2021 Patch Tuesday
May 2021 Patch TuesdayMay 2021 Patch Tuesday
May 2021 Patch TuesdayIvanti
 
Cis 170 i lab 2 of 7
Cis 170 i lab 2 of 7Cis 170 i lab 2 of 7
Cis 170 i lab 2 of 7helpido9
 
install k+dcan cable standard tools 2.12 on windows 10 64bit
install k+dcan cable standard tools 2.12 on windows 10 64bitinstall k+dcan cable standard tools 2.12 on windows 10 64bit
install k+dcan cable standard tools 2.12 on windows 10 64bitWORLD OBD2
 
Bc0053 – vb.net & xml
Bc0053 – vb.net & xmlBc0053 – vb.net & xml
Bc0053 – vb.net & xmlsmumbahelp
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java ProgrammingKaty Allen
 
LP-I_Lab Manual_TE_AY2023-24_updated.pdf
LP-I_Lab Manual_TE_AY2023-24_updated.pdfLP-I_Lab Manual_TE_AY2023-24_updated.pdf
LP-I_Lab Manual_TE_AY2023-24_updated.pdfAmeyaKatkar
 
Technical Drafting Module 3
Technical Drafting Module 3Technical Drafting Module 3
Technical Drafting Module 3DepEd
 
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...ANIL MAHADEV
 
IBM DB2 App Development with Microsoft Visual C#
IBM DB2 App Development with Microsoft Visual C#IBM DB2 App Development with Microsoft Visual C#
IBM DB2 App Development with Microsoft Visual C#ANIL MAHADEV
 
Cis 170 ilab 2 of 7
Cis 170 ilab 2 of 7Cis 170 ilab 2 of 7
Cis 170 ilab 2 of 7comp274
 

Similar to Fall 2019 cs401 1_sol (20)

M150 A Fall2010 T01
M150 A Fall2010 T01M150 A Fall2010 T01
M150 A Fall2010 T01
 
Aae oop xp_02
Aae oop xp_02Aae oop xp_02
Aae oop xp_02
 
The Lab assignment will be graded out of 100 points.  There are .docx
The Lab assignment will be graded out of 100 points.  There are .docxThe Lab assignment will be graded out of 100 points.  There are .docx
The Lab assignment will be graded out of 100 points.  There are .docx
 
Beginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeks
 
Introduction to Box2D Physics Engine
Introduction to Box2D Physics EngineIntroduction to Box2D Physics Engine
Introduction to Box2D Physics Engine
 
AdminCamp2019 - Notes V10 Upgrades - Alles was man wissen muss!
AdminCamp2019 - Notes V10 Upgrades - Alles was man wissen muss!AdminCamp2019 - Notes V10 Upgrades - Alles was man wissen muss!
AdminCamp2019 - Notes V10 Upgrades - Alles was man wissen muss!
 
May 2021 Patch Tuesday
May 2021 Patch TuesdayMay 2021 Patch Tuesday
May 2021 Patch Tuesday
 
Machine language
Machine languageMachine language
Machine language
 
Cis 170 i lab 2 of 7
Cis 170 i lab 2 of 7Cis 170 i lab 2 of 7
Cis 170 i lab 2 of 7
 
install k+dcan cable standard tools 2.12 on windows 10 64bit
install k+dcan cable standard tools 2.12 on windows 10 64bitinstall k+dcan cable standard tools 2.12 on windows 10 64bit
install k+dcan cable standard tools 2.12 on windows 10 64bit
 
21 -windows
21  -windows21  -windows
21 -windows
 
Bc0053 – vb.net & xml
Bc0053 – vb.net & xmlBc0053 – vb.net & xml
Bc0053 – vb.net & xml
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java Programming
 
Axe027
Axe027Axe027
Axe027
 
LP-I_Lab Manual_TE_AY2023-24_updated.pdf
LP-I_Lab Manual_TE_AY2023-24_updated.pdfLP-I_Lab Manual_TE_AY2023-24_updated.pdf
LP-I_Lab Manual_TE_AY2023-24_updated.pdf
 
Technical Drafting Module 3
Technical Drafting Module 3Technical Drafting Module 3
Technical Drafting Module 3
 
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
An introduction to_application_development_in_ibm_db2_udb_using_microsoft_vis...
 
IBM DB2 App Development with Microsoft Visual C#
IBM DB2 App Development with Microsoft Visual C#IBM DB2 App Development with Microsoft Visual C#
IBM DB2 App Development with Microsoft Visual C#
 
Cis 170 ilab 2 of 7
Cis 170 ilab 2 of 7Cis 170 ilab 2 of 7
Cis 170 ilab 2 of 7
 

More from MobeenaJavid

More from MobeenaJavid (6)

Cybercrime
CybercrimeCybercrime
Cybercrime
 
Unit testing
Unit testingUnit testing
Unit testing
 
Father and daughter
Father and daughterFather and daughter
Father and daughter
 
Register
RegisterRegister
Register
 
Network
NetworkNetwork
Network
 
D-Flip-Flops(Digital Logic Design (CS302))
D-Flip-Flops(Digital Logic Design (CS302))D-Flip-Flops(Digital Logic Design (CS302))
D-Flip-Flops(Digital Logic Design (CS302))
 

Recently uploaded

Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfAnubhavMangla3
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Paige Cruz
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfalexjohnson7307
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data SciencePaolo Missier
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهMohamed Sweelam
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 

Recently uploaded (20)

Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 

Fall 2019 cs401 1_sol

  • 1. Computer Architecture and Assembly Language Programming (CS401) Assignment # 01 Total marks = 20 Due Date: SOLUTION FILE 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. Topic Covered:  Basic DOSBox and NASM understanding to run assembly code  Various Addressing modes to access memory 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 etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date. If you people find any mistake or confusion in assignment (Question statement), please consult with 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
  • 2. Problem Statement: Save your complete VUID in memory using Base Register Indirect + Offset addressing mode (if last digit of your VUID is Odd) or Indexed Register Indirect + Offset addressing mode (if last digit of your VUID is even). Detailed Instructions: This assignment will give hands on experience of how to run assembly language code using DOSBox and NASM. First, you have to define labels for storing your VUID and then store each alphabet/digit of VUID, step by step, in to any general purpose registers. Finally, store the alphabet/digit from general purpose register to respective memory location (which you have defined by label in above step). Addressing Modes to use: In order to access VUID and storing it in memory, you have to use ONE of the following addressing modes:  Base Register Indirect + Offset (only if last digit of your VUID is Odd)  Indexed Register Indirect + Offset (only if last digit of your VUID is Even) NOTE: Zero marks will be awarded, if you do not follow proper addressing mode. What to Submit: After writing your code, open DOSBox and run NASM (as described in video tutorial shared in Announcement page of this course). Assemble the code using nasm command and take screenshot. After that, open the COM file in debugger (AFD). Run your code by pressing F1 key until last statement of code is reached. At this stage, Data Window # 2 of AFD should display your complete VUID (at consecutive locations; see below example). Also take screenshot of AFD. Your assignment must be submitted as a SINGLE WORD document (DOC or DOCX) with: 1) Code written in Word 2) Screenshot of compilation step (DOSBox) 3) Screenshot of AFD NOTE: When you take screenshot of compilation step and AFD, take screenshot of whole screen, not of DOSBox and AFD. Cropping or any tempering with screenshot will result in ZERO marks.
  • 3. Example: Suppose a student VUID is BC123456789. The last digit of this VUID is 9 which is an Odd number. So, this student will use Base Register Indirect + Offset addressing mode to solve this assignment. Sample screenshot of final output: Note that Data Window # 2 is showing student VUID: Helping Material:  Detailed video tutorial of how to use DOSBox and NASM is already shared with you in Announcement page of this course  Command to manipulate Data Windows of AFD is mentioned in AFD tutorial (link is given in the same Announcement)  Use ASCII table for first two alphabets of your VUID
  • 4. SOLUTION: If last digit of VUID is Odd: BASE REGISTER INDIRECT + OFFSET [org 0x100] mov bx, 0 mov ax, 0 mov ax, [ID+bx] mov [myID], ax mov ax, [ID+bx+2] mov [myID+1], ax mov ax, [ID+bx+4] mov [myID+2], ax mov ax, [ID+bx+6] mov [myID+3], ax mov ax, [ID+bx+8] mov [myID+4], ax mov ax, [ID+bx+10] mov [myID+5], ax mov ax, [ID+bx+12] mov [myID+6], ax mov ax, [ID+bx+14] mov [myID+7], ax mov ax, [ID+bx+16] mov [myID+8], ax mov ax, [ID+bx+18] mov [myID+9], ax mov ax, [ID+bx+20] mov [myID+10], ax mov ax, 0x4c00 int 0x21 ID: dw 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9 myID: dw 0
  • 5. If last digit of VUID is Even: Indexed Register Indirect + Offset [org 0x100] mov si, 0 mov ax, 0 mov ax, [ID+si] mov [myID], ax mov ax, [ID+si+2] mov [myID+1], ax mov ax, [ID+si+4] mov [myID+2], ax mov ax, [ID+si+6] mov [myID+3], ax mov ax, [ID+si+8] mov [myID+4], ax mov ax, [ID+si+10] mov [myID+5], ax mov ax, [ID+si+12] mov [myID+6], ax mov ax, [ID+si+14] mov [myID+7], ax mov ax, [ID+si+16] mov [myID+8], ax mov ax, [ID+si+18] mov [myID+9], ax mov ax, [ID+si+20] mov [myID+10], ax mov ax, 0x4c00 int 0x21 ID: dw 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 8 myID: dw 0