File Version Update: (Dated: 19-May-2011)
This version of file contains:
· Content of the Course (Done)
· FAQ updated version.(These must be read once because some very basic definition and question are being answered)
· Glossary updated version.(These must be read once because some very basic terms are being explained which you even might not found in the book) (Done)
· Solved Past Assignment Selected for MID Term. (Done)
· Solved Question From Mid-Term Papers (Done))
· MCQs GIGA File (with references) (Done)
·
Note: Use Table Of Content to view the Topics, In PDF(Portable Document Format) format , you can check Bookmarks menu.
Disclaimer: There might be some human errors, if you find please let me know at , duplication of data may be possible but at least possible level.
----:Table of Content:----
Table of Content
File Version Update: (Dated: 19-May-2011) 1
Table of Content 2
Introduction To NASM and AFD. 6
Important Register Names 6
Notes of CS401 7
Example Programs From Handout 11
; a program to add three numbers using registers 11
; a program to add three numbers using memory variables 11
; a program to add three numbers accessed using a single label 12
; a program to add three numbers accessed using a single label 12
; a program to add three numbers directly in memory 12
; a program to add three numbers using byte variables 12
; a program to add three numbers using indirect addressing 13
; a program to add ten numbers 13
; a program to add ten numbers using register + offset addressing 14
; a program to add ten numbers without a separate counter 14
; a program to add ten numbers without a separate counter 14
; sorting a list of ten numbers using bubble sort 14
; 4bit multiplication algorithm 15
; 16bit multiplication 15
; 16bit multiplication using test for bit testing 16
; bubble sort algorithm as a subroutine 16
; bubble sort subroutine called twice 17
; bubble sort subroutine using swap subroutine 17
; bubble sort and swap subroutines saving and restoring registers 18
; bubble sort subroutine taking parameters from stack 18
; bubble sort subroutine using a local variable 19
; clear the screen 20
; hello world in assembly 20
; number printing algorithm 21
; hello world at desired screen location 22
; clear screen using string instructions 23
; hello world printing with a null terminated string 24
; hello world printing with length calculation subroutine 25
; scroll up the screen 26
; scroll down the screen 26
; comparing null terminated strings 27
; hooking divide by zero interrupt 28
; print string using bios service 29
; print string and keyboard wait using BIOS services 29
FAQ of CS401(Latest Updated) 30
Question: What is Computer Architecture 30
Question: Explain Segment Override prefix 30
Question: What is offset? 30
Question: What is Subroutine? 30
Question: Explain Segmented memory model 30
Question: What is Address wraparound? 30
Question: Explain Linear memory model. 30
Question: What's the difference between .COM and .EXE formats? 30
Question: Is MS-DOS Dead? 31
Question: How can I read a character without echoing it to the screen, and without waiting for the user to press the Enter key? 31
Question: What is NASM? 31
Question: What is difference b/w assembler and disassembler? 31
Question: What are the functions of Parity and Sign flag? 31
Question: WHAT IS MACHINE LANGUAGE? 31
Question: WHEN TO USE ASSEMBLY LANGUAGE 31
Question: What are interrupts? 31
Question: What are registers? 32
Question: What is control bus and what function it performs? 32
Question: What do you mean by Peripherl devices? 32
Question: What is difference b/w physical and logical address? 32
Question: What is difference between DATA LABEL and CODE LABEL? 32
Question: What is Segment Wrap Around? 32
Question: What is BIOS and how it can be updated? 32
Question: What BIOS Does? 32
Question: What is Interrupt vector Table? 33
Question: What are the terms ASCII CODE and SCAN CODE? 33
Question: What is Virtual Machine? 33
Question: What are Registers and why these are needed? 33
Question: What is Big-Endian and Little-Endian? 34
Question: How we calculate Physical Address? 34
Question: What is a Stack? 34
GLOSSARY Updated Version 34
Absolute Address: 34
Past Solved Assignments Questions 39
Q1) Differentiate Between register and Memory location (4) 39
Q2) Commands to view data in Memory Window 1 & 2: 39
Q3) Code to Swap two numbers: 39
Q4) Explain the instructions with example. 39
Q6) which instructions are legal. If illegal correct them. 39
Q7) Calculating physical address. 40
How these instructions are legal or illegal. If illegal tell the reason and how we can make this legal, 40
Calculate the effective address and the physical address accessed by each of the following instructions. Also give the value of the designated register in each instruction by looking up the dump of a portion of physical memory given below. 41
All questions are independent of each other. Assume the registers are initialized as 41
Question # 1. What is wrong with following instructions? 42
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? 42
bx + bp 42
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. 42
Write a program in Assembly Language to find the maximum number and the minimum number from an array of ten numbers. 42
Suppose AL contains 10011011b and CF= 0. Give the new contents of AL after each of the following instructions is executed. Assume the preceding initial conditions for each part of this question. 43
Q#1 AX contains a number between 0-15. Write code to complement the corresponding bit in BX. For example if AX contains 6; complement the 6th bit of BX. (Note: First bit in BX is at 0th position and last bit is at 15th position) 43
Q#2 Suppose that AX=0x3412, BX=0x7856, CX= 0x1CAB, and SP=0x100. Given the contents of AX, BX, CX, and SP after executing the following instructions: 43
Identify the problems in the following instructions and correct them by replacing them with one or two instruction having the same effect. 44
Write a program to calculate the square of 10 by using a loop that adds 10 to the accumulator 10 times. 44
If AX=8FFF and BX=0FFF 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. 44
Write a program to swap every pair of bits in the AX register. 45
Calculate the physical memory address generated by the following segment offset pairs. 45
A. Identify the problems in the following instructions and correct them by replacing them with one or two instruction having the same effect. 46
a. Write a program in assembly language that calculate the factorial of a number where 46
factorial is defined as: 46
b. If AX=8FFF and BX=0FFF and “cmp ax, bx” is executed, which of the following 47
jumps will be taken? Each part is independent of others. Also give the value of Z, S, 47
and C flags. 47
Write a sequence of instruction to do each of the following: 47
a. Put the sum 1+ 4+7+ … +148 in AX 47
b. Put the sum 100+95+90+ … +5 in AX 47
Spring 2011 Latest Papers (Current) 49
Paper No.1 49
Which flag affected by often AND operator 49
Explain divide overflow error. 50
for what purpose "INT4" is reserved. 50
Double working of Exchange instruction with help of an example. 50
What is the difference between LES and LDS intruction. 50
Paper No.2 51
Two form of String Moves Instruction? 51
Describe push & pop with help of example? 51
Describe the working of the CALL instruction with the reference of Stack. 51
Describe the working of the RET with the reference of Stack. 51
Q3: what is stack n define with example? 51
How value of IP Register is saved & updated when call . instruction executed. 52
AX = 0x3412, BX=0x7856, CX= 0x1CAB, Sp=0x100 52
How many parameter a subroutinecan receive through stack. 52
Paper No.3 52
Mid-Term Past Papers (Updated Version) 52
Short Question Paper (Set-1) 52
Q What is difference between SHR and SAR instructions? 53
The bit Shift Logical Right (SHR) 53
Shift Arithmetic Right (SAR) 53
Q Every charcther is displayed on the screen in the form of word. What each byte of this word represents? 2marks 54
Q When the instruction”push ax” is excuted in decrement stack how the value of SP will 54
change? Or Operation of PUSH ..Marks 3 54
Q Define address bus? 5 marks 54
Q Explain the working of shift logical left SHL? 5 marks 54
Short Question Paper (Set-2) 55
Write any two control instructions. 55
RET instruction take how many arguments 55
Explain the fuction of rotate right (ROR) instruction 55
Write down the names of four segment registers? 55
Given that [BX+0x0100] BX=0x0100 56
Short Question Paper (Set-3) 56
What are the instructions used by assembly language for permanent and temporary diversions. 56
Which instruction is used to determine zero bit in string. 56
Explain the use of TEST instruction. 56
Describe local variables. 56
Describe MOVS and CMPS instructions 57
Short Question Paper (Set-4) 57
What is direct addressing"? 57
What is conditional jump"? 57
How are strings handled"? 57
Differentiate between SHR, SAL, SAR". 57
Write a calculator for adding strings". 57
Short Question Paper (Set-5) 57
Q:1 data clear algorithum in assmly language code? 5 MARKS 57
Q4: multiplication in assmbley language 5 marks 57
Short Question Paper (Set-6) 58
For what purpose "INT 1" is reserved ? 58
Define implied operand? 58
Tell the Formula to scroll up the screen 58
Explain the process of ADC? 59
Short Question Paper (Set-7) 59
Explain the fuction of rotate right (ROR) instruction 59
Why REP prefix is generally not used with LODS instruction? 59
Write all steps of algorithm for printing number 352. 59
24. What are the result after performing the instruction (each carry 1 marks ) 60
Explain the complete operation of Interrupt when it is generated. 60
Short Question Paper (Set-8) 60
Why is it necessary to provide the segment and offset address in case of FAR jump ? 60
What’s your understanding about Incrementing and Decrementing Stack? 60
IF DF=0 what its represent and IF DF=1 what its represent ? 61
What is the Difference between CALL and RET 61
Explain how extended shifting is performed 61
Write a subroutine to calculate the string length.? 61
Short Question Paper (Set-9) 62
Define short jump 62
Short Question Paper (Set-11) 62
Short Question Paper (Set-15) 62
How two dimensional coordinate system of the screen is converted into the one dimensional memory? 63
Write down the purpose of FAR Jump 63
How the value of stack pointer (sp) changes after every PUSH or POP instruction ? 63
Short Question Paper (Set-17) 63
Explain AND, OR and XOR operations with truth tables. [ 5 marks ] 63
Explain the complete operation of interrupt when it is generated. [ 5 marks ] 63
Tell the formula to scroll up the screen. [ 3 marks ] 63
Why we need to clear the stack? [ 3 marks ] 63
Short Question Paper (Set-18) 63
Which instruction is used to determine the zero byte in string? (2) 63
The second byte in the word designated for one screen location holds the foreground and background colors for the character.which colors are represented by 0th , 1st and 2nd bits (from Least significant side) 63
How the data is displayed on monitor screen? (5) 64
Write an assembly language program that clear the screen using the string instruction? 64
clear screen using string instructions 64
Short Question Paper (Set-19) 64
MCQz 64
Lecture Wise Solved MCQz 64
MCQz (Set-1) 91
MCQz (Set-2) 92
MCQz (Set-3) 92
MCQz (Set-4) 94
MCQz (Set-5) 98
MCQz (Set-6) 101
MCQz (Set-7) 102
MCQz (Set-8) 104
MCQz (Set-9) 107
MCQz (Set-10) 110
MCQz (Set-11) 115
MCQz (Set-12) 119
MCQz (Set-13) 125
MCQz (Set-14) 126
MCQz (Set-14) 127
MCQz (Set-15) 130
MCQz (Set-16) 133
MCQz (Set-17) 135
MCQz (Set-18) 139
MCQz (Set-19) 142
MCQz (Set-20) 142
MCQz (Set-21) 142
MCQz (Set-22) 142
MCQz Unsolved (Set-15) 251
Lecture Wise MCQs 279
======>======
======
Introduction To NASM and AFD.
Firstly Install the NASM , & AFD in hard Drive (Just Copy and Paste)Let us just say in D Drive.
Open windows RUN box and Type cmd.
Command Prompt will open. Open D: Drive and then go to NASM folder by typing CD NASM. CD=Change Directory
Type Edit and Edit Menu of Command Prompt will appear. Write your Assembly Language Code.
Press Alt to open File Menu. Select Save option and provide a suitable name to the file.
And Finally save the file with the extension “.asm” (For assembly Language Files).
Now we have to convert this .asm file into .com , and this will be performed by the nasm.
For this operation, type this command.
nasm (input_file_name).asm –o (output_name).com –l (output_name).lst
Remember “()” are for just reference .do not add them to the file name.if have file name ex01.asm then use (file_name)=ex01.asm do not type this (file_name)=(ex01).asm
In case of successful conversion , no error message will appear. But if there is some error message, please recheck your code by typing this code in command prompt.
Edit (input_file_name).asm (A Blue window will appear where you can examine your code)
Now you have compilled your program ,move to next step which we will launch the program in ADF (Advance Full Screen Debugger) where we will execute each statement of our code and will check different changing values of different registers, and Data values in data windows. A snapshot of the AFD is given Below.