Advertisement

CS401 - Computer Architecture and Assembly Language Programming MDB Overview

[MC080406884]

Posted On:
October 18, 2009 08:48 PM

Replied On:
October 19, 2009 11:39 AM

Student's Message:Msg No. 402738
Subject: why AX is 0?
sir when we run program in bugger it shows ax or other register value 0, at that time, as you say that ax is only one register so sir other program which are using processor and registers same time are also using register so how can ax shows 0, hope you can understand what i m saying
Instructor's Reply:
It is due to multitasking in which we save the state of one program before executing the next task/program, the state includes registers, IP value etc. So, when the first program is given the chance to execute again, its state is restored.
That is why every task/program feels that there is no other program running.

You can read the details of multitasking from chapter_11 of the handouts.
[BC060200038]

Posted On:
October 18, 2009 06:07 PM

Replied On:
October 19, 2009 10:16 AM

Student's Message:Msg No. 402710
Subject: Afd

Dear Sir you said in the lecture if u dont understand anything about the debugger u can open the help file and can see things there. But i cant find the help file. would u plz guide me how to open a help file in the afd.

Thank you

Instructor's Reply:
Following AFD commands will be helpful for you.


CMD> M1 DS : 100

The above mentioned command will display the contents of memory location at offset address "0x0100" in memory window_1
Similarly to display data contents in memory window_2 use the following command:

CMD> M2 DS : 100


For help press F4 at CMD, the help window will be appeared at the bottom now either press PageUP/PageDown keys to move back and forth or type any command at command prompt, the command that you will type, its help will appear in the help window.


Use F2 to execute the program statement by statement. E.g. press F2 to execute first statement an then see the effect of this statement in registers, or memory window (by using command M1 or M2)


To navigate among different windows use F8 and F9 keys (you can write nop instruction once you are in the memory window).
[MC080408022]

Posted On:
October 18, 2009 04:49 PM

Replied On:
October 19, 2009 10:15 AM

Student's Message:Msg No. 402700
Subject: binary
respected sir , in the solution of Q2 of assignment I calculated the physical address in just hexadecimaland uploaded is it enough or i should also convert it to binary. I so plz tell me I will upload my updated solution
Instructor's Reply:
It is fine.

Kindly use these MDBs to post lecture-related questions, for other course related problems, send an e-mail at cs401@vu.edu.pk
[MC080200099]

Posted On:
October 18, 2009 09:59 AM

Replied On:
October 19, 2009 10:09 AM

Student's Message:Msg No. 402652
Subject: physical address calculation from origin 0x100

at origin we give address 0x100 that our program memory should start from this address

but when we write

mov ax,[num1]

num1 dw: 5

so we defined a word num1 , word is of 2bytes = 16bits ,

our origin is 0x100=16 in decimal

when we plus 16 with word 16+16=32

but you told that num1 offset start at 23, and num2 at 25, num3 at 27

how is this possible this should be 32,48,64 (multiples of 16)

please answer i am not understanding

Instructor's Reply:
First of all, 0x100 = 256

Now consider the following example:

[org 0x0100]

mov ax, [num1]

mov ax, 0x4c00
int 0x21

num1: dw 15

and it will be translated as:

A10801
B8004C
CD21
0F00


Now as we have mentioned, that first instruction must start from 0x0100 (256 in decimal),so
A1 will be loaded at 0100
08 will be loaded at 0101
01 will be loaded at 0102
That completes our first instruction (mov ax, [num1])

B8 will be loaded at 0103
00 will be loaded at 0104
4C will be loaded at 0105
That completes our second instruction (mov ax, 0x4c00)

CD will be loaded at 0106
21 will be loaded at 0107
That completes our third instruction (int 0x21)

0F will be loaded at 0108
00 will be loaded at 0109
That completes our fourth instruction (num1: dw 15)

So, 15 will be loaded at offset 0108 and 0109 (as it is of size word)

And this offset will be changed depending upon how many instruction are there in between.
Is there any confusion now ?
[MC090205765]

Posted On:
October 17, 2009 11:07 PM

Replied On:
October 19, 2009 09:41 AM

Student's Message:Msg No. 402616
Subject: Very Easy book

Respected sir,

Please recommended a very easy book for Assembly language programming,(cs401).

Instructor's Reply:
The list of recommended books is given in the Books section of this course on VU-LMS.
[MC090205511]

Posted On:
October 17, 2009 11:00 PM

Replied On:
October 19, 2009 09:38 AM

Student's Message:Msg No. 402611
Subject: Salam, is it fine that i solve

c. DAD1:2345

Effective Adrress = base + index + offset

0x0100 + 0xDAD1 + 0x2345

0xFF16

Physical Address = segment*0x10 + EA

0x0010 * 0x10 + 0xFF16

0xDAD1 + 0xFF16

0x1D9E7 (Memory Wrapped around )

Instructor's Reply:
Dear Student,
It is NOT allowed to discuss the assignment questions on MDB. However, if you have some confusion about the statement of the question, then you can send an e-mail at cs401@vu.edu.pk

[MC090205531]

Posted On:
October 17, 2009 10:47 PM

Replied On:
October 19, 2009 09:36 AM

Student's Message:Msg No. 402608
Subject: Help me
Dear sir, What does this error meaning? C:\AssmSoft>nasm ass.asm -o ass.com -l ass.asm:9: error: parser: expecting ] regards
Instructor's Reply:
Check the line_9 of your ass.asm file.
[BC070401293]

Posted On:
October 17, 2009 08:47 PM

Replied On:
October 19, 2009 09:34 AM

Student's Message:Msg No. 402579
Subject: what is label?

AOA

Sir i want to ask what is label? (discus about it in lec5)..

please explain it briefly.

thanx

Instructor's Reply:
A label is a sequence of characters that identifies a location within source code.
As we have labeled our data (5,10, 15 etc) with num1 so num1 is the data label.
Labels can be used on code as well. Just like data labels they remember the address at which they are used. The assembler does not differentiate between code labels and data labels. The programmer is responsible for using a data label as data and a code label as code.
[BC080200938]

Posted On:
October 17, 2009 08:25 PM

Replied On:
October 19, 2009 09:30 AM

Student's Message:Msg No. 402575
Subject: Salam

Sir when u teach in lectures I write the same program with you at the same time. But Some times IP values and M1, M2 etc vlues are different of mine if I match these from lecture window. Tell me does it really matter? or do I need to change them ?

Instructor's Reply:
If the program is same, then IP value must be same.

Kindly clearly mention, that in which program and at which instruction, you are getting different values of the same program.

[The segment register values can be changed which doesn't actually matters. ]
[MC080408436]

Posted On:
October 17, 2009 07:41 PM

Replied On:
October 19, 2009 09:22 AM

Student's Message:Msg No. 402566
Subject: salam

sir please explain the IRQ and EOI in easy wording?

Instructor's Reply:
An IRQ (Interrupt ReQuest) value is an assigned location where the computer can expect a particular device to interrupt it when the device sends the computer signals about its operation. The signal momentarily interrupts the computer so that it can decide what processing to do next. Since multiple signals to the computer on the same interrupt line might not be understood by the computer, a unique value must be specified for each device and its path to the computer.

EOI (End Of Interrupt) is a signal sent to a Programmable Interrupt Controller (PIC) to indicate the completion of interrupt processing for a given interrupt.

[MC090205531]

Posted On:
October 17, 2009 04:22 PM

Replied On:
October 19, 2009 09:15 AM

Student's Message:Msg No. 402513
Subject: need help
Sir in lectures the snapshot of the Dos it not clear can't see that what is inside it, so tell me that how i can be clear? i have not find these snap shots of dos or edit or debuger in the handouts so what i do? regards
Instructor's Reply:
The lecture videos are very much visible, however, if you are facing any difficulty in viewing anything, you can ask it here or through email.
[BC070401293]

Posted On:
October 17, 2009 02:42 PM

Replied On:
October 19, 2009 09:10 AM

Student's Message:Msg No. 402493
Subject: cs401

Asslam-O-Alikum

Sir i want to ask that we can access to 4 cells of memory by the

combination of two lines or two bits (00,01,11,10). similerly we can

access 8 cells of memory by the combination of 3 lines or three bits.

we can say that we can access to x memory cell by the combination of 2^y bits.

Now my question is that the combination of 16-bits can tackle the cell

of memory 65536 (2^16=65536) and the combination of 19 bits 524288

(2^19=524288bits=64kb). while in handouts tell us that we can access with 16

lines/bits to 64kb. there is confusion for me. i am too much confuse

or somewhere mistake to understanding, please guide me.

Instructor's Reply:
Wassalam,
There is a little mistake that you are making in calculation.

2^16 = 65536 bits
Now to represent it into Kb, we have to divide it with 1024 (as 1Kb = 1024bits)
So,
2^16 = 65536 bits = 65536/1024 = 64Kb

[BC080200915]

Posted On:
October 17, 2009 09:49 AM

Replied On:
October 17, 2009 11:01 AM

Student's Message:Msg No. 402413
Subject: cs401

Helo sir how r u please sir explian the calculating proceder

Instructor's Reply:
As already replied, it is your assignment question, so you have to solve it yourself. Kindly read the relevant topic from handouts, the procedure is straightforward.
Append zero at the end of segment address
Then add offset address into it.

It is hexadecimal addition, you can read about hexadecimal numbers from the following link:
http://vulms.vu.edu.pk/Courses/CS401/Downloads/Hexadecimal%20Numbers.pdf
[BC080200938]

Posted On:
October 16, 2009 11:14 PM

Replied On:
October 17, 2009 09:19 AM

Student's Message:Msg No. 402373
Subject: Salam

Sir in Lecture number 4 When U were teaching us Working in AFD Kindly Tell me from where u were writing nop instruction and change all that. Can we have any AFD helper?

Instructor's Reply:
Following AFD commands will be helpful for you.


CMD> M1 DS : 100

The above mentioned command will display the contents of memory location at offset address "0x0100" in memory window_1
Similarly to display data contents in memory window_2 use the following command:

CMD> M2 DS : 100


For help press F4 at CMD, the help window will be appeared at the bottom now either press PageUP/PageDown keys to move back and forth or type any command at command prompt, the command that you will type, its help will appear in the help window.


Use F2 to execute the program statement by statement. E.g. press F2 to execute first statement an then see the effect of this statement in registers, or memory window (by using command M1 or M2)


To navigate among different windows use F8 and F9 keys (you can write nop instruction once you are in the memory window).
[BC080200915]

Posted On:
October 16, 2009 07:37 PM

Replied On:
October 17, 2009 09:10 AM

Student's Message:Msg No. 402314
Subject: cs401

Helo sir how r u plz sir

  1. FFFF:5432

calculate the following address and explain its proceder

sory sir i cant understand the calculating preceder please sir

Instructor's Reply:
Dear Student,
It is your assignment question, you have to solve it yourself.

The method of calculating physical address is explained in chapter_1 of the handouts with the help of examples.

[BC070401789]

Posted On:
October 16, 2009 04:23 PM

Replied On:
October 17, 2009 09:06 AM

Student's Message:Msg No. 402248
Subject: debugger problem

A.A Sir

sir i have problem in debugger:

sir when i am writing the code in the notepad and save then

i opened the cmd and write the command:

nasm ex010.asm -o ex010.com -l ex010.lst

then sir the list is succesfully genrated but when i write the debugger command:

afd ex010.com

then the error is below as:

afd is not recognized as an internal or external command,operable program or batch file :

plz tell me the solution that error.thanks.

Instructor's Reply:
The error afd is not recognized as an internal or external command shows that:
either you are not in the assembly folder on command prompt, that is, command prompt is not displaying C:\assembly>
or the file afd.exe is not present in the assembly folder.
[MC090201578]

Posted On:
October 16, 2009 12:03 PM

Replied On:
October 16, 2009 01:32 PM

Student's Message:Msg No. 402168
Subject: CALCULATOR

AOA,

Sir, Can we use the scientific calculator to solve the assignment no. 1 or we have to do all the calculations manually.


Thanks,

Instructor's Reply:
It is better to solve it manually as in the exams, you will not be allowed to use calculators.

Kindly use the MBD for lecture related queries only, for other course-related issues send an email at cs401@vu.edu.pk

CS401 - Computer Architecture and Assembly Language Programming Reference books and grading scheme

Book Title:Assembly Language Step by Step
Author:Jeff Duntemann
Edition:2nd
ISBN:
Publisher:Wiley
URL:http://www.amazon.com/exec/obidos/ASIN/0471375233/jeffduntemann-20/102-4956345-0339323
Copyright:
Book Store:

Book Title:Assembly Language for Intel Based Computers
Author:KIP R Erwin
Edition:4th
ISBN:
Publisher:
URL:http://www.amazon.com/exec/obidos/ASIN/0471375233/jeffduntemann-20/102-4956345-0339323
Copyright:
Book Store:
Grading Scheme


CS401 - Computer Architecture and Assembly Language Programming Internet Links


URL: http://www.osdata.com/topic/language/asm/asmintro.htm
Description: This is a tutorial about Assembly Language.Read it.
URL: http://www.asciitable.com
Description: You can see Standard ASCII table and Extended ASCII table on this link with ASCII codes expressed in HEX,OCT and Decimal notations.
URL: http://courses.ece.uiuc.edu/ece291/books/artofasm/artofasm.html
Description: Very helpful book of Assembly Language.
URL: http://8bs.com/othrdnld/manuals/512/512tech/m512techa.htm
Description: This link contain the summary of most of the interrupt services.
URL: http://home.comcast.net/~fbkotler/nasmdoc0.html
Description: This link contain detailed help about our assembler NASM. I think it can be very much helpful to all student.

CS401 - Computer Architecture and Assembly Language Programming FAQ's 1

Question:WHAT IS MACHINE LANGUAGE?
Answer:Although programmers tend to use C or C++ or Pascal these days, the language closest to the PC hardware is machine language. Not one second during a PCS powered on lifetime passes where the computer is not executing machine language.

Question:WHEN TO USE ASSEMBLY LANGUAGE
Answer:I personally think that except as a learning exercise it is a waste of time writing something in ASM that can be written acceptably fast in a high-level language. Assembly language fits for the following: * Low level control. When you need to change the flags, or the control registers of the processor, as when entering protected mode. * Speed. Programs written in machine language execute fast! It can execute 10-100 times the speed of BASIC, and about twice as fast as a program written in C or Pascal. * Time Critical Code. Critical sections of programs written in higher level languages can be written in assembly to speed up sections. * Small program size. When you write a TSR for example this is very useful. Writing interrupt handlers is where assembly language shines. Assembly language is very flexible and powerful; anything that the hardware of the computer is capable of doing can be done in assembly.

Question:What are interrupts?
Answer:The hardware and software designed for original PC communicated with the CPU by means of a hierarchical and predetermined set of signals called interrupts. When a device or a program needed some action on the part of the CPU it would signal this by sending an interrupt signal. The CPU would sort out the priority of the incoming interrupt requests, with lower number interrupts being handled first (it is common for the CPU to be handling several interrupts concurrently) and then locate the code associated with the interrupt (the Interrupt Request Handler) by examining the Interrupt Vector Table. Each interrupt (starting with interrupt 00H) is allocated four bytes in the vector table. These four bytes serve as an address pointer to the actual software routine associated with the interrupt. These routines may be stored in the ROM BIOS or more commonly in system RAM (where copies of ROM BIOS routines are often uploaded to provide faster access). The interrupt vector table is first initialized by the Start-up ROM but changes are made to it's contents as first the ROM Extensions and later the operating system files are loaded. The ability to update the contents of the interrupt vector table provides a means to easily expand operating system services by making a standard interrupt point to a new Interrupt Handler.

Question:What are registers?
Answer:One of a small number of high-speed memory locations in a computer's CPU. Registers differ from ordinary random access memory in several respects: There are only a small number of registers (the "register set"), typically 32 in a modern processor though some, e.g. SPARC, have as many as 144. A register may be directly addressed with a few bits. In contrast, there are usually millions of words of main memory (RAM), requiring at least twenty bits to specify a memory location. Main memory locations are often specified indirectly, using an {indirect addressing} mode where the actual memory address is held in a register. Registers are fast; typically, two registers can be read and a third written -- all in a single cycle. Memory is slower; a single access can require several cycles.

Question:What is control bus and what function it performs?
Answer:The physical connections that carry control information between the CPU and other devices within the computer. Whereas the data bus carries actual data that is being processed, the control bus carries signals that report the status of various devices. For example, one line of the bus is used to indicate whether the CPU is currently reading from or writing to main memory.
Question:What do you mean by Peripherl devices?
Answer:Peripherals Any piece of hardware connected to a computer; any part of the computer outside the CPU and working memory; Any input or output device connected to a computer. Some examples of peripherals are keyboards, mice, monitors, printers, scanners, disk and tape drives, microphones, speakers, joysticks, plotters, and cameras.

Question:What is difference b/w physical and logical address?
Answer:The segment, offset pair is called a logical address, while the 20bit address is a physical address which is the real thing. Logical addressing is a mechanism to access the physical memory. However I recommend you to read topic 1.8 Segmented memory Model in handouts to get you understand well.

Question:What is difference between DATA LABEL and CODE LABEL?
Answer:Data Label is the label that we use to define data as we defined memory locations num1,num2 ....etc in our programs. Code Label is the label that we have on code as we see in case of conditional jump (Label l1) and is normally used for loop control statements.

Question:What is Segment Wrap Around?
Answer:

Dear Student

For the whole megabyte we need 20 bits while CS and IP are both 16bit registers. We need a mechanism to make a 20bit number out of the two 16bit numbers. Consider that the segment value is stored as a 20 bit number with the lower four bits zero and the offset value is stored as another 20 bit number with the upper four bits zeroed. The two are added to produce a 20bit absolute address. A carry if generated is dropped without being stored anywhere and the phenomenon is called address wraparound.


Question:What is BIOS and how it can be updated?
Answer:

Dear Student

One of the most common uses of Flash memory is for the basic input/output system of your computer, commonly known as the BIOS (pronounced "bye-ose"). On virtually every computer available, the BIOS makes sure all the other chips, hard drives, ports and CPU function together.

What BIOS Does?

The BIOS software has a number of different roles, but its most important role is to load the operating system. When you turn on your computer and the microprocessor tries to execute its first instruction, it has to get that instruction from somewhere. It cannot get it from the operating system because the operating system is located on a hard disk, and the microprocessor cannot get to it without some instructions that tell it how. The BIOS provides those instructions. Some of the other common tasks that the BIOS performs include:
A power-on self-test (POST) for all of the different hardware components in the system to make sure everything is working properly

Activating other BIOS chips on different cards installed in the computer - For example, SCSI and graphics cards often have their own BIOS chips.

Providing a set of low-level routines that the operating system uses to interface to different hardware devices - It is these routines that give the BIOS its name. They manage things like the keyboard, the screen, and the serial and parallel ports, especially when the computer is booting.

Managing a collection of settings for the hard disks, clock, etc.
The BIOS is special software that interfaces the major hardware components of your computer with the operating system. It is usually stored on a Flash memory chip on the motherboard, but sometimes the chip is another type of ROM.

When you turn on your computer, the BIOS does several things. This is its usual sequence:

  1. Check the CMOS Setup for custom settings
  2. Load the interrupt handlers and device drivers
  3. Initialize registers and power management
  4. Perform the power-on self-test (POST)
  5. Display system settings
  6. Determine which devices are bootable
  7. Initiate the bootstrap sequence

Updating BIOS

Occasionally, a computer will need to have its BIOS updated. This is especially true of older machines. As new devices and standards arise, the BIOS needs to change in order to understand the new hardware. Since the BIOS is stored in some form of ROM, changing it is a bit harder than upgrading most other types of software.
To change the BIOS itself, you'll probably need a special program from the computer or BIOS manufacturer. Look at the BIOS revision and date information displayed on system startup or check with your computer manufacturer to find out what type of BIOS you have. Then go to the BIOS manufacturer's Web site to see if an upgrade is available. Download the upgrade and the utility program needed to install it. Sometimes the utility and update are combined in a single file to download. Copy the program, along with the BIOS update, onto a floppy disk. Restart your computer with the floppy disk in the drive, and the program erases the old BIOS and writes the new one. You can find a BIOS Wizard that will check your BIOS at BIOS Upgrades.




Question: What is Interrupt vector Table?
Answer:
Dear Student

The correlation process from the interrupt number to the interrupt handler uses a table called interrupt vector table. Its location is fixed to physical memory address zero. Each entry of the table is four bytes long containing the segment and offset of the interrupt routine for the corresponding interrupt number. The first two bytes in the entry contain the offset and the next two bytes contain the segment. The little endian rule of putting the more significant part (segment) at a higher address is seen here as well. Mathematically offset of the interrupt n will be at nx4 while the segment will be at nx4+2. One entry in this table is called a vector. If the vector is changed for interrupt 0 then INT 0 will take execution to the new handler whose address is now placed at those four bytes. INT 1 vector occupies location 4, 5, 6, and 7 and similarly vector for INT 2 occupies locations 8, 9, 10, and 11. As the table is located in RAM it can be changed anytime. Immediately after changing it the interrupt mapping is changed and now the interrupt will result in execution of the new routine. This indirection gives the mechanism extreme flexibility.

Question: What are the terms ASCII CODE and SCAN CODE?
Answer:
Dear Student

Scan Code

Each key on the keyboard is assigned a unique number called a Scan Code; When a key is pressed, the keyboard circuit sends the corresponding scan code to the computer. Scan code table is given on MDB of Lecture#24.

ASCII Code

I/O devices such as the video monitor and printer are character oriented, and programs such as word processors deal with characters exclusively. Like all data, characters must be coded in binary in order to be processed by the computer. The most popular encoding scheme for characters is ASCII (American Standard Code for Information Interchange) code.

Question: What is Virtual Machine?
Answer:
Dear Student

Virtual machine is a term used by Sun Microsystems, developers of the Java programming language and runtime environment, to describe software that acts as an interface between compiler Java binary code and the microprocessor (or "hardware platform") that actually performs the program's instructions. Once a Java virtual machine has been provided for a platform, any Java program (which, after compilation, is called bytecode) can run on that platform. Java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform. Java's virtual machine makes this possible.
The Java virtual machine specification defines an abstract rather than a real "machine" (or processor) and specifies an instruction set, a set of registers, a stack, a "garbage heap," and a method area. The real implementation of this abstract or logically defined processor can be in other code that is recognized by the real processor or be built into the microchip processor itself.

The output of "compiling" a Java source program (a set of Java language statements) is called bytecode. A Java virtual machine can either interpret the bytecode one instruction at a time (mapping it to a real microprocessor instruction) or the bytecode can be compiled further for the real microprocessor using what is called a just-in-time compiler.

Question: What are Registers and why these are needed?
Answer: Registers are like a scratch pad ram inside the processor and their operation is very much like normal memory cells. They have precise locations and remember what is placed inside them. They are used when we need more than one data element inside the processor at one time.
Question: What is Big-Endian and Little-Endian?
Answer:
Big-endian and little-endian are terms that describe the order in which a sequence of bytes are stored in computer memory. Big-endian is an order in which the "big end" (most significant value in the sequence) is stored first (at the lowest storage address). Little-endian is an order in which the "little end" (least significant value in the sequence) is stored first. For example, in a big-endian computer, the two bytes required for the hexadecimal number 4F52 would be stored as 4F52 in storage (if 4F is stored at storage address 1000, for example, 52 will be at address 1001). In a little-endian system, it would be stored as 524F (52 at address 1000, 4F at 1001).

IBM's 370 computers, most RISC-based computers, and Motorola microprocessors use the big-endian approach.On the other hand, Intel processors (CPUs) and DEC Alphas and at least some programs that run on them are little-endian.
Question:How we calculate Physical Address?
Answer:

for the whole megabyte we need 20 bits while CS and IP are both 16bit registers. We need a mechanism to make a 20bit number out of the two 16bit numbers. Consider that the segment value is stored as a 20 bit number with the lower four bits zero and the offset value is stored as another 20 bit number with the upper four bits zeroed. The two are added to produce a 20bit absolute address. A carry if generated is dropped without being stored anywhere and the phenomenon is called address wraparound. The process is explained with the help of the following diagram.

Therefore memory is determined by a segment-offset pair and not alone by any one register which will be an ambiguous reference. Every offset register is assigned a default segment register to resolve such ambiguity. For example the program we wrote when loaded into memory had a value of 0100 in IP register and some value say 1DDD in the CS register. Making both 20 bit numbers, the segment base is 1DDD0 and the offset is 00100 and adding them we get the physical memory address of 1DED0 where the opcode B80500 is placed.


Question:What is a Stack?
Answer:

Stack is a data structure that behaves in a first in last out manner. It can contain many elements and there is only one way in and out of the container. When an element is inserted it sits on top of all other elements and when an element is removed the one sitting at top of all others is removed first. To visualize the structure consider a test tube and put some balls in it. The second ball will come above the first and the third will come above the second. When a ball is taken out only the one at the top can be removed. The operation of placing an element on top of the stack is called pushing the element and the operation of removing an element from the top of the stack is called popping the element. The last thing pushed is popped out first; the last in first out behavior.


CS401 - Computer Architecture and Assembly Language Programming FAQ's

Question:

What is Computer Architecture

Answer:

Computer Architecture is the science and art of selecting and interconnecting hardware components to create computers that meet functional, performance and cost goals. Computer architecture is not about using computers to design buildings. OR
The set of layers and protocols (including formats and standards that different hardware/software must comply with to achieve stated objectives) which define a computer system. Computer architecture features can be available to application programs and system programmers in several modes, including a protected mode. For example, the system-level features of computer architecture may include: (1) memory management, (2) protection, (3) multitasking, (4) input/output, (5) exceptions and multiprocessing, (6) initialization, (7) co processing and multiprocessing, (8) debugging, and (9) cache management


Question:

Explain Segment Override prefix?

Answer:

To override the association for one instruction of one of the registers BX, BP, SI or DI, we use the segment override prefix. For example “mov ax, [cs:bx]” associates BX with CS for this one instruction. The processor places a special byte before the instruction called a prefix.No prefix is needed or placed for default association. Opcode has not changed, but the prefix byte has modified the default association to association with the desired segment register for this one instruction


Question:

What is offset?

Answer:

A distance from a given paragraph boundary in memory. The offset usually is given as a number of bytes


Question:

What is Subroutine?

Answer:

A self-contained coding segment designed to do a specific task, sometimes referred to as procedure


Question:

Explain Segmented memory model?

Answer:

The segmented memory model allows multiple functional windows into the main memory, a code window, a data window etc. The processor sees code from the code window and data from the data window. The size of one window is restricted to 64K. However the maximum memory iAPX88 can access is 1MB which can be accessed with 20 bits.

Question:

What is Address wraparound?

Answer:

In physical address calculation a carry if generated is dropped without being stored anywhere, for example BX=0100, DS=FFF0 and the access under consideration is [bx+0x0100]. The effective address will be 0200 and the physical address will be 100100. This is a 21bit answer and cannot be sent on the address bus which is 20 bits wide. The carry is dropped and just like the segment wraparound our physical memory has wrapped around at its very top.


Question:

Explain Linear memory model?

Answer:

In linear memory model the whole memory appears like a single array of data. 8080 and 8085 could access a total memory of 64K using the 16 lines of their address bus.


Question:

What's the difference between .COM and .EXE formats?

Answer:

To oversimplify: a .COM file is a direct image of how the program will look in main memory, and a .EXE file will undergo
some further relocation when it is run (and so it begins with a relocation header). A .COM file is limited to 64K for all
segments combined, but a .EXE file can have as many segments as your linker will handle and be as large as RAM
can take. The actual file extension doesn't matter. DOS knows that a file being loaded is in .EXE format if its first two
bytes are MZ or ZM; otherwise it is assumed to be in .COM format. Actually they must be less than 0xFF00 bytes long,
since the PSP, which isn't included in the COM file but is within those 64K, is 256 bytes long. Then CAN use many
segments, but they don't have to. In particular, any .COM file can be converted to an .EXE file by adding an appropriate
header to it. There are some other differences between a .COM file and a single segment .EXE file (both of which must
be smaller than 64K).The entry point of the .COM file is _always_ 0x100, while the entry point of the .EXE file can be at
any address. The stack size of the .COM file is the remainder of those 64K which isn't used by the code image, while the
stack size if the single segment .EXE file can be set at any size as long as it fits within those 64K.Thus the stack can be
smaller in the .EXE file.


Question:

Is MS-DOS Dead?

Answer:

No. Though Microsoft may not be actively developing MS-DOS there are still many computers that are not capable of running Microsoft Windows. The current versions of Microsoft Windows will also run most MS-DOS programs; therefore, MS-DOS is not dead, and will most- likely never die just as Commodore-64s and Amigas have not completely died.
Indeed, DOS has found a new life in embedded systems. Other parties continue to develop MS-DOS compatible operating systems.
Windows NT, 2000, and XP all have a "Command Prompt" which is similar to the orignal MS-DOS command prompt.


Question:

How can I read a character without echoing it to the screen, and without waiting for the user to press the Enter key?

Answer:

In Assembly language, execute INT 21 AH=8; AL is returned with the character from standard input (possibly redirected). If you don't want to allow redirection, or you want to capture Ctrl-C and other special keys, use INT 16 AH=10; this will return the scan code in AH and ASCII code (if possible) in AL, but AL=E0 with AH nonzero indicates that one of the gray "extended" keys was pressed. (If your BIOS doesn't support the extended keyboard, use INT 16 AH=0 not 10.)

Question:

What is NASM?

Answer:

NASM, the Netwide Assembler, is a free assembler for Intel 80x86 series of microprocessors. Not only is the assembler compatible with MS-DOS, but it will also work under Windows 95, Linux, and OS/2.


Question:

How can my program tell if it's running under Windows?

Answer:

Execute INT 2F AX=4680. If AX returns 0, you're in Windows real mode or standard mode (or under the DOS shell). Otherwise, call INT 2F AX=1600. If AL returns something other than 0 or 80, you're in Windows 386 enhanced mode.


Question:What is Term CACHE?
Answer:Cache A small fast memory holding recently accessed data, designed to speed up subsequent access to the same data. Most often applied to processor-memory access but also used for a local copy of data accessible over a network etc. When data is read from, or written to, main memory a copy is also saved in the cache, along with the associated main memory address. The cache monitors addresses of subsequent reads to see if the required data is already in the cache. If it is (a cache hit) then it is returned immediately and the main memory read is aborted (or not started). If the data is not cached (a cache miss) then it is fetched from main memory and also saved in the cache. The cache is built from faster memory chips than main memory so a cache hit takes much less time to complete than a normal memory access. The cache may be located on the same integrated circuit as the CPU, in order to further reduce the access time. In this case it is often known as {primary cache} since there may be a larger, slower secondary cache outside the CPU chip. The most important characteristic of a cache is its hit rate - the fraction of all memory accesses which are satisfied from the cache. This in turn depends on the cache design but mostly on its size relative to the main memory. The size is limited by the cost of fast memory chips. The hit rate also depends on the access pattern of the particular program being run (the sequence of addresses being read and written). Caches rely on two properties of the access patterns of most programs: temporal locality - if something is accessed once, it is likely to be accessed again soon, and spatial locality - if one memory location is accessed then nearby memory locations are also likely to be accessed. In order to exploit spatial locality, caches often operate on several words at a time, a "cache line" or "cache block". Main memory reads and writes are whole cache lines. When the processor wants to write to main memory, the data is first written to the cache on the assumption that the processor will probably read it again soon. Various different policies are used. In a write-through cache, data is written to main memory at the same time as it is cached. In a write-back cache it is only written to main memory when it is forced out of the cache. If all accesses were writes then, with a write-through policy, every write to the cache would necessitate a main memory write, thus slowing the system down to main memory speed. However, statistically, most accesses are reads and most of these will be satisfied from the cache. Write-through is simpler than write-back because an entry that is to be replaced can just be overwritten in the cache as it will already have been copied to main memory whereas write-back requires the cache to initiate a main memory write of the flushed entry followed (for a processor read) by a main memory read. However, write-back is more efficient because an entry may be written many times in the cache without a main memory access.

Question:What is difference b/w assembler and disassembler?
Answer:Assembler An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer's processor can use to perform its basic operations. Some people call these instructions assembler language and others use the term assembly language. In programming terminology, to disassemble is to convert a program in its executable (ready-to-run) form (sometimes called object code) into a representation in some form of assembler language so that it is readable by a human. A program used to accomplish this is called a disassembler, because it performs the inverse of the task that an assembler does. Disassembly is a type of reverse engineering. Another such program, called a decompiler, converts object code back into the code of a higher-level language.

Question:What are the functions of Parity and Sign flag?
Answer:

Dear Student

P

Parity

Parity is the number of “one” bits in a binary number. Parity is either odd or even. This information is normally used in communications to verify the integrity of data sent from the sender to the receiver.

S

Sign Flag

A signed number is represented in its two’s complement form in the computer. The most significant bit (MSB) of a negative number in this representation is 1 and for a positive number it is zero. The sign bit of the last mathematical or logical operation’s destination is copied into the sign flag.

Thanks