From: ..::ISHFAQ::.. <mc100402092@vu.edu.pk>
Date: Tue, May 3, 2011 at 1:19 AM
Subject: CS401_Some_imp_FAQs(Must read once)
To: afaaq <afaaqtariq233@gmail.com>
Q1) Differentiate Between register and Memory location (4)
1) Registers are storage locations internal to the processor but RAM is located external to the CPU.
2) All data must be moved into a register before it can be operated whereas data has to be loaded into a CPU register from memory before the CPU can process it.
3) Registers are faster where as memory is much slower than registers.
4) In general, registers hold the data the processor is currently working on, while Memory holds the program instructions and the data the program requires.
Note: A best practice is to draw a table with two columns and highlight the difference with specifying the features in separate columns
Q2) Commands to view data in Memory Window 1 & 2:
A) Command to view data in memory window 1
Syntax: M1 Segment-Base-Address : Offset-Address
Example M1 DS : 0100
Explanation: The above example will display the contents of memory location at offset address 0x0100 in Data Segment register. The data will be displayed in Memory Window 1
B) Command to view data in memory window 2
Syntax: M2 Segment-Base-Address : Offset-Address
Example M2 DS : 0100
Explanation: The above example will display the contents of memory location at offset address 0x0100 in Data Segment register. The data will be displayed in Memory Window 2
Q3) Code to Swap two numbers:
[org 0x0100]
jmp Start
var1: dw 5 ; First Variable
var2: dw 10 ; Second variable
Start:
mov ax, [var1] ; AX=Var1
mov dx, [var2] ; BX= Var2
mov [var1],dx ; Interchanged value
mov [var2],ax
int 0x21
Explanation: in this code we used two variables Var1 and Var2 whose values were to be swapped we first moved the contents of first variable in AX and those of second register in DX and finally we swapped the variables by assigning the variables, the value of other variable (stored in register). We used to registers because we can't move data directly from one memory location to other.
Q4) Explain the instructions with example.
JNZ:
JNE:
Both of the above instructions are synonyms of each other and belong to set of instructions from conditional jump, both test the condition that ZF is set or not if ZF=0 (i.e. the last mathematical/logical operation did not produce zero result) a jump will occur to specified location.
Syntax: JNZ labelname
JNE labelname
Example JNZ Swap
Explanation: here JNZ will check the ZF and a jump will occur to accordingly depending on the value of CF and execution will start from the first instruction after labelname label.
CMP:
The cmp instruction is used to compare two operands. It subtracts the right operand from the left operand; however no register is modified except the CF and ZF flags, which are set.
Syntax: CMP destination, source
Example CMP Ax, 0x0100
Explanation: By comparing the contents of AX register with 0x0100 the target flags are modified accordingly:
Rules to Set Flags:
A < B CF = 1 ZF = 0
A = B CF = 0 ZF = 1
A > B CF = 0 ZF = 0
Q5) Explain in your own words different addressing modes with example:
Refer to Lecture and handouts for this question:
Note: Most of the students copied the same text from the handouts, which lies under cheating case. Students were actually required to study their handouts and attend lectures and finally document their own concept (Right or Wrong, no problem) about the addressing modes.
Q6) which instructions are legal. If illegal correct them.
i. mov [05], [ 24]
ii. mov [label1], 501
iii. mov bx, al
iv. mov bx,[bs+bp+200]
Solution:
mov [05], [ 24]
Memory to Memory referencing is not allowed. The correct instructions for this operation could be
mov ax, [24]
mov [05],ax
mov [label1], 50l
Here the size of data to be moved is ambiguous, so assembler will complain:
One option can be:
mov ax,501
mov [label1] ,ax
mov bx, al
Size Mismatch, BX is 16 bits where as AL is 8-bits: the desired result can be received as
mov bx, ax
or
mov bl, al
mov bx,[bs+bp+200]
Two base registers are involved which is illegal. We can only add index register with base.
mov ax, [bp+ si+100]
Q7) Calculating physical address.
1) Suppose CS register contains the value "1DDD" in hexadecimal and IP register contains the following value "0436" again in hexadecimal.
2) The binary value of CS will be "0001110111011101".
3) Append four binary zeros to the Least Significant Side, now it becomes: "00011101110111010000"
4) The binary value of IP register is "0000010000110110".
5) Append four binary bits to the Most Significant Side, now it becomes: "00000000010000110110"
6) Now the Segment Value is "00011101110111010000"
7) Offset Value is "00000000010000110110"
8) Add Both of these binary numbers and you get the actual physical address:
00011101110111010000+00000000010000110110= 00011110001000000110
9) So the actual physical address is "11110001000000110".
start>Run>cmd
after getting cmd prompt click on properties of cmd , click Font Tab
select font style as "consolas " and font size as "28"..after apply .,ok
you will see your cmd prompt full screen
Best Wishes,
Muhammd Ishfaq
MCS 2nd Semester (PakPattan)
--
Remember Me In Your Prayers
Best regard's
Muhammad Afaaq
MBA 4th (Final Semester) Finance Group
Afaaq_Tariq@yahoo.com
Islamabad
For latest assignments solved quizzes files gdb solve n unsolved past papers Come join us in http://vugoogle.com
http://www.alliswell.com.pk/
http://groups.google.com/group/vustudymania
0346-5329264
If u like me than raise your hand with me
If not then raise ur standard
That's about me … !
--
You received this message because you are subscribed to the Google
Groups "VU Students" group.
To post to this group, send email to vu-students@googlegroups.com
To unsubscribe from this group, send email to
vu-students+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vu-students?hl=en_PK?hl=en
Comments
Post a Comment