Skip to main content

[vu-students] CS401_Some_imp_FAQs(Must read once)



---------- Forwarded message ----------
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".



This TIP is useful for assembly language program in full screen for computers having Windows 7
for getting full screen mode in vista and 7 do as below 
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 
you can also use short keys  ,  alt+enter=Full Screen DOS Mode

Best Wishes,
"...SUBHANALLAHI WABI HAMDIHI...SUBHANALLAH IL AZEEM..."
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

Popular posts from this blog

Re: ::: vuaskari.com ::: CS408 - FINAL TERM SUBJECTIVE WITH REFERENCE SOLVED BY UMAIR SAULAT

GREAT WORK On Wed, Feb 20, 2013 at 11:30 PM, Umair Saulat < saulat.umair@gmail.com > wrote: CS408- Human Computer Interaction Solved Subjective Fall Semester 2012   QNo.1    it has been observed that most computer users use menu option for input instead of keyboard accelerator. What is the reason behind it? (2 Marks) Answer:- 1.        Menu options are easier to find. 2.        You don't have to memories the keys for menu option but for key board accelerators you have to memories them REF:: Handouts Page No. 127   QNo.2    Define active intervention.  (2 Marks) Answer:- Active intervention with the participant and actively probes the participant understands of whatever is being tested. REF:: Handouts Page No. 276 QNo.3    what is Ubiquitous Computing? (2 Marks) Answer:- The most profound technologies are those that disappear. They weave themselves into the fabric of everyday life until they are indi

Updating our Google Account inactivity policy

Every day Google works hard to keep you and your private information safe and secure by preventing unauthorized access to your Google Account with our built-in security protections. And keeping you safe means having strong privacy practices across our products that minimize how long we store your personal files and any data associated with them. We want to protect your private information and prevent any unauthorized access to your account even if you're no longer using our services. Therefore, we are updating the inactivity period for a Google Account to two years across all our products and services. This change starts rolling out today and will apply to any Google Account that's been inactive, meaning it has not been signed into or used within a two-year period. An inactive account and any content in it will be eligible for deletion from December 1, 2023. What this means for you: These changes do not impact you unless you h

Learn more about our updated Terms of Service

stargthb@gmail.com On January 5, 2022, we're making some changes to our Terms of Service. These changes won't affect the way you use Google services, but they'll make it easier for you to understand what to expect from Google — and what we expect from you — as you use our services. You can review the new terms here . At a glance, here's what this update means for you: More clarity on what you can expect from Google and what we expect from you : We're providing more examples to describe the mutually respectful conduct that we expect from all our users. Improved readability : While our terms remain a legal document, we've done our best to make them easier to understand, including reorganizing some topics so that they're easier to find. If you use Family Link to manage a Google Account for someone else, please take some time to talk to them about these changes. Thank you for using Google!