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

[vu-students] Urdu Love Letters ............ ahahahahahhahahah

  The One & Only .......... IRFAN. Italy. http://groups.yahoo.com/group/p_se_poetry   -- 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

Re: ::: vuaskari.com ::: Fwd: Cancer treatment- Shocking news.

plz send me the soloution of Assignment MGT-603 and MKT-624 plzzzzzzzzz today last day i need urgent 2011/4/23 ∂υα ωαqαя < dua4566@gmail.com > ---------- Forwarded message ---------- From: Virtual Brain < mc090400181@gmail.com > Date: Sat, Apr 23, 2011 at 10:30 AM Subject: Cancer treatment- Shocking news. AS  one of my friend tell me all this PLEASE FORWARD THIS MAIL.  Dear All, One of my cousin got   lung cancer   few months back. That was really shocking to all his family members. Cancer diagnosed was of stage three. Immediately treatment was started from Pakistan most of the art hospital for cancer i.e. Shoukat Khanum Hospital in Lahore. But there were little chances to reverse the disease as it's already reached to stage 3. Than one day somebody told us about a person in Distt Nowshera who is treating cancer by herbs. We went there and he gave us some   herbal medicines   for ten days. It was really amazing when we saw an improvement in the condition of my...

Re: ::: vuaskari.com ::: MCS Students Group

please send me solution of mth 202 quiz 1 On Sun, May 11, 2014 at 8:51 PM, Muhammad Asif < itsvividmirror@gmail.com > wrote: cs 604 605 607 610 catring stock On Thu, May 8, 2014 at 4:32 PM, Malik Aslam < malik693012@gmail.com > wrote: I am also student of MCS.  On Wed, May 7, 2014 at 3:50 PM, Zadee Ali < abdullah.313.27@gmail.com > wrote: i have also these subjects. On Tue, May 6, 2014 at 1:26 PM, Shahzad Ali < saim2.vti@gmail.com > wrote: i am mcs student 3rd semester On Tue, Apr 29, 2014 at 12:02 PM, Jasmine Khan < jasmine.khan3939@gmail.com > wrote: I can help. On Apr 29, 2014 9:36 AM, "Nadeem Abbas (BP/Acc)" < nadeem.abbas@haleebfoods.com > wrote: > > Is there any or more students of the following subjects of MCS and want to do combine study and help each others? > >   > > CS304-OOP > > CS401-Assembly > > CS607-AI > > CS614-Data W/H > > ...