CS401 - Computer Architecture and Assembly Language Programming New Lecture Wise Questions& Answers for Final Terms Prepared by “Virtualians.Pk”

CS401 - Computer Architecture and Assembly Language Programming New Lecture Wise Questions& Answers for Final Terms Prepared by “Virtualians.Pk”

CS401 - Computer Architecture and Assembly Language Programming New Lecture Wise Questions& Answers for final terms Prepared BY “Virtualians.pk” Lecture no 23: Q)what are the basic purposes/operations of the "BIOS vs DOS"? The BIOS software is built into the PC, and is the first code run by a PC when powered on ('boot firmware'). When the PC starts up, the first job for the BIOS is the power-on self-test, which initializes and identifies system devices such as the CPU, RAM, video display card, keyboard and mouse, hard disk drive, optical disc drive and other hardware. The BIOS then locates boot loader software held on a peripheral device (designated as a 'boot device'), such as a hard disk or a CD/DVD, and loads and executes that software, giving it control of the PC. This process is known as booting, or booting up, which is short for bootstrapping. DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems Q)what is firmware? In electronic systems and computing, firmware is the combination of persistent memory and program code and data stored in it. Typical examples of devices containing firmware are embedded systems (such as traffic lights, consumer appliances, and digital watches), computers, computer peripherals, mobile phones, and digital cameras. The firmware contained in these devices provides the control program for the device. Firmware is held in non-volatile memory devices such as ROM, EPROM, or flash memory. Q)What is effect of SP when we push something in stack? Please explain in detail with example. Pre Pared by:Irfan Khan(ChIef admIn) Page 1 For understanding, consider the stack in lower part of memory in green color as below. Stack pointer is always pointing to the top of the stack. Now anything you place (push) onto the stack it will grow upward which will result in the decrement of stack pointer by 2 as read and write (push and pop) can be done only in word form i.e. 2 bytes. So Push AX will decrement SP by two. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. ↑ 11. ←SP 12. 13. Growing 14. Upward 15. 16. Lecture no 24: Q)what is a buffer memory? Buffer is a region of a physical memory storage used to temporarily prevent data from continuing while it is being moved from one place to another. Typically, the data is stored in a buffer as it is retrieved from an input device (such as a mouse) or just before it is sent to an output device (such as speakers). PrePared by:Irfan Khan(ChIef admIn) Page 2 Q)Regarding execute any programme in debugger, What is difference in F1 and F2? For executing assembly commands both F1 and F2 keys can be used. There is one difference between them. F2 is used when we are executing simple assembly instructions and F1 is helpful when we want to execute a subroutine line by line otherwise if we execute a subroutine with F2 key, it will execute that subroutine as a whole in one step. Q)Difference between CS and DS? Can we use CS at the right or bottom in the debugger? CS means Code segment while DS stands for Data segment. These are two of the four segments that we have for every assembly program. Each segment is of size 64K. AFD debugger is used to see the step by step working of our program and it also provides us two memory windows M1 and M2 where we can load any segment whose content we want to see. There is no such hard association between these windows and segments. Lecture no 25: Q)What does segment over write mean? Segment override prefix makes us able to use and access memory location other than current segment. In instruction PrePared by:Irfan Khan(ChIef admIn) Page 3 Mov AX, [123] We are moving the content at an offset address 123 in current segment pointed by CS register and through following instruction we can access any part in the main memory. Mov AX, [4455:123] In above, we are moving the content at an offset address 123 in a segment having base address 4455. Thus segment override makes us able to avoid default association of registers with segments. Q)Main difference between CS and DS? CS means Code segment while DS stands for Data segment. These are two of the four segments that we have for every assembly program. Each segment is of size 64K. What are function of I/O ports I/O ports are used to communicate with external world, the data is stored in mostly accumulator register and size depends upon the architecture to architecture. The term real world means the world out side the system/processor/computer. PrePared by:Irfan Khan(ChIef admIn) Page 4 Lecture no 26: Q) What is PIC Ports All input and output on the PIC is performed via the I/O ports. I/O ports are like RAM locations with wires leading from the bits to the pins of the microchip. I/O ports on a PIC are memory mapped. This means that to read from or write to a port on a PIC the program must read from or write to a special RAM location. To access PORTA on the 16F84, 16F628, 16F88, 16F876 or 16F877 the program must access the RAM at address location 5. The I/O ports on the PIC can be used as either inputs or outputs. In order to use a port as an input it must be configured as an input. To use it as an output it must be configured as an output. Configuring a port for input or output is done by setting or clearing the data direction register for the port. On the PIC each bit of each port has a data direction bit. Therefore it is possible to set some bits within a port as inputs and others within the same port as outputs. The data direction bits can be thought of as flags that mark the direction in which the data moves between the outside world and the PIC (into the PIC or out of the PIC). A data direction register on the PIC is called a TRIS register Q)What is difference between I/O devices and Prepheral devices? There are many peripheral devices in computer and for communicating with these peripheral devices the processor uses I/O ports. Remember, port is the gateway used to read or write data for peripheral devices. For this purpose we write assembly programs in which we access I/O port of the device and then read / write data in to it. There are many assembly programs we have made to access keyboard, VGA, PIC etc. Lecture no 27: PrePared by:Irfan Khan(ChIef admIn) Page 5 Q)When we press a key then it run IRQ 1 and cause of this INT 9 invoke. Then when INT 16 invoke internally when we press a key?(as it's also inturrept of keyboard so when i invoke internally) Through INT 16 various BIOS keyboard services are accessed. Let say, you want to get an input a character from the user in your program then how you will read a character in your assembly program? This can be done using INT 16 with get a key service by setting AH to 0. So MOV AH, 0 INT 0x16 The above two lines we are accessing BIOS get a key service using INT 16 and this will halt the program until a key is pressed by the user and that will be returned in AL register. But whenever a key is pressed on keyboard then IRQ 1 is generated which invokes interrupt service routine INT 9 to handle this key press event. We can use this INT 9 to read the scan code of the pressed key from port 60 by hooking it with our own interrupt service routine. Lecture no 28: Q)Regarding INT 0x16, it's BIOS keyboard service, it's clear but INT 9 is not BIOS service? BIOS is not offereing INT 9? If yes then why we explicitly say with INT 0x16 but not with INT 9.?? INT 9 is also a BIOS interrupt call and its implementation is provided mainly by Manufacturer in the BIOS which is stored on ROM. We do not call it is a service because it does not offer various service like INT 16 or INT 10 does. INT 9 PrePared by:Irfan Khan(ChIef admIn) Page 6 performs its designated functions when invoked by IRQ 1 and we can hook our routine to do some desired operations. WHAT IS TSR? TSR programs are pop-ups or special device drivers. The TSR mechanism provides a convenient way for you to load your own routines to replace or augment BIOS routines. Your program loads into memory, patches the appropriate interrupt vector so that it points at an interrupt handler internal to your code and then terminates and stays resident,when the appropriate interrupt instruction is executed, your code will be called rather than BIOS. Lecture no 29: If we want a keystrok then we use the following instructions as you mentioned mov ah, 0 int 0x16 but the same work do with the following instruciton in al, 0x60 ; this instruction also for keystroke then what is difference between these two methods? Using mov ah, 0 int 0x16 We will get ASCII code in AL. But with in al, 0x60 We will get scan code in AL.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    22 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us