Getting ready for the midterm of CS609 (System Programming)? Here is everything in one place: solved MCQs, subjective questions with answers and short notes and key terms, gathered from past papers and files shared by students. No duplicates and all the answers are checked and verified. Use the tabs above to switch between Objective, Subjective and Short Notes & Key Terms, and tap Show answer only after you have tried the question yourself. Best of luck with your exam!
Part 1: Objective (MCQs)
Q1. DMA stands for______
- Direct Memory Access
- Distinct Memory Access
- Direct Module Access
- Direct Memory Allocation
Show answer
Answer: (a) Direct Memory Access
Q2. Standard PC operates in two modes in terms of memory which are
- Real mode and Extended Mode
- Base mode and Memory Mode
- None of the given
- Real mode and protected mode
Show answer
Answer: (d) Real mode and protected mode
Q3. UART stands for______
- Universal Asynchronous Receiver Transmitter
- Universal Adjustment and Realigning Tool
- Unconventional Assisted Recovery Team
- None of these
Show answer
Answer: (a) Universal Asynchronous Receiver Transmitter
Q4. Usually interrupt procedures are reentrant procedures especially those interrupt procedure compiled using C language compiler are reentrant.
- True
- False
Show answer
Answer: (a) True
Why: Source key kept (handout statement); not independently verifiable.
Q5. Interrupt Vector Table (IVT) in short is a ______ bytes sized table.
- 1024
- 2048
- 3072
- 4096
Show answer
Answer: (a) 1024
Q6. Hardware Interrupts are ______.
- Preemptive
- Non-Preemptive
- Both Preemptive and Non-Preemptive
- None of Given
Show answer
Answer: (b) Non-Preemptive
Why: Source key kept (VU handout wording, hardware ISRs run to completion once started); I could not confirm this wording independently.
Q7. Timer interrupt is a ______.
- Hardware Interrupt
- Software Interrupt
- Both of these
- None of These
Show answer
Answer: (a) Hardware Interrupt
Q8. Int 14H ______ can be used to set the line parameter of the UART or COM port.
- Service # 0
- Service # 1
- Service # 2
- None of the given options
Show answer
Answer: (a) Service # 0
Q9. The keyboard makes use of interrupt number ______ for its input operations.
- 9
- 10
- 11
- 12
Show answer
Answer: (a) 9
Q10. In self test mode the output of the UART is routed to its input.
- True
- False
Show answer
Answer: (a) True
Q11. In case of synchronous communication a timing signal is required to identify the start and end of a bit.
- True
- False
Show answer
Answer: (a) True
Q12. Register can be used to divide frequency is ______
- Counter Register
- Accumulator Register
- None of these
Show answer
Answer: (a) Counter Register
Why: The counter register of the interval timer divides the input clock, which is how a lower frequency is produced.
Q13. Only ______ ports are important from programming point of view.
- 70 and 71H
- 71 and 72H
- 70 and 72H
- 72 and 73H
Show answer
Answer: (a) 70 and 71H
Q14. Which port is known as Data Port______
- 60H
- 61H
- 64H
- 69H
Show answer
Answer: (a) 60H
Q15. LPTs can be swapped.
- True
- False
Show answer
Answer: (a) True
Q16. PPI is used to perform parallel communication
- True
- False
Show answer
Answer: (a) True
Q17. ______is used to control the printer via the BIOS
- Int 16H
- Int 17H
- Int 18H
- Int 19H
Show answer
Answer: (b) Int 17H
Q18. ______ bit is cleared to indicate the low nibble is being sent.
- D1
- D2
- D3
- D4
Show answer
Answer: (d) D4
Why: Source key kept (parallel-port nibble transfer: D4 low means the low nibble is on the lines).
Q19. DSR stands for ______ .
- Data set ready
- Data service ready
- Data stock ready
- None of the given
Show answer
Answer: (a) Data set ready
Q20. There are two main types of interrupts namely ______.
- PC based and Window based
- Hardware based and Kernal based
- Hardware interrupts and Software interrupts
- None of the given
Show answer
Answer: (c) Hardware interrupts and Software interrupts
Q21. To set the interrupt vector means is to change the double word sized interrupt vector within the IVT.
- True
- False
Show answer
Answer: (a) True
Q22. The service number is usually placed in the ______ register.
- AL
- CL
- AH
- AX
Show answer
Answer: (c) AH
Q23. The BIOS interrupt ______ can be used to configure RTC.
- 1AH
- 2AH
- 3AH
- 4AH
Show answer
Answer: (a) 1AH
Q24. The interval timer can operate in ______ modes.
- Five
- Seven
- Four
- Six
Show answer
Answer: (d) Six
Why: The 8253/8254 interval timer has six modes (0 to 5).
Q25. ______ is Disk interrupt.
- 10H
- 11H
- 13H
- 14H
Show answer
Answer: (c) 13H
Q26. PPI stands for ______.
- Parallel Programmable interface
- Peripheral Programmable interface
- Port Programmable interface
- None of the given
Show answer
Answer: (b) Peripheral Programmable interface
Why: The source option is worded 'Peripheral Programmable interface'. The correct expansion is Programmable Peripheral Interface (Intel 8255); it is the only option with the right words.
Q27. Counter register can be used to divide clock signal.
- True
- False
Show answer
Answer: (a) True
Q28. DCE stands for ______.
- Data communication equipment
- Distributed Computing Environment
- Data Carrier Equipment
Show answer
Answer: (a) Data communication equipment
Why: The source listed 'Data communication equipment' twice; the duplicate was merged.
Q29. ______ is used to identify the cause of interrupt.
- Interrupt ID Register
- PC Register
- AC Register
- None of All These
Show answer
Answer: (a) Interrupt ID Register
Q30. The bit number ______ of the coprocessor control word is the interrupt enable flag.
- 7
- 8
- 9
- 6
Show answer
Answer: (a) 7
Why: Bit 7 of the coprocessor control word is the interrupt enable (mask) flag, as stated in the lecture.
Q31. There are ______ kinds of serial communication.
- 2
- 3
- 4
- 5
Show answer
Answer: (a) 2
Q32. ______ store the base address for LPT1.
- 40:00H
- 40:02H
- 40:08H
- 40:1AH
Show answer
Answer: (c) 40:08H
Q33. The amount of memory above conventional memory (extended memory) can be determined using the service ______.
- 15H/88H
- 16H/88H
- 17H/88H
- 21H/88H
Show answer
Answer: (a) 15H/88H
Why: INT 15H, service AH=88H returns the extended memory size in KB.
Q34. The output on the monitor is controlled by a controller called ______within the PC.
- Video controller
- Bus controller
- Ram controller
- None of the given
Show answer
Answer: (a) Video controller
Q35. The keyboard input character scan code is received at ______ port.
- 60H
- 61H
- 62H
- 63H
Show answer
Answer: (a) 60H
Q36. ______ is LED control byte.
- 0xFD
- 0xED
- 0xFF
- 0xEE
Show answer
Answer: (b) 0xED
Q37. BPB stands for ______.
- BIOS parameter block
- BIOS processing block
- Base processing block
- BIOS partition block
Show answer
Answer: (a) BIOS parameter block
Q38. The Function of I/O controller is to provide ______.
- I/O control signals
- Buffering
- Error Correction and Detection
- All of given
Show answer
Answer: (d) All of given
Q39. IVT is a table containing ______ byte entries each of which is a far address of an interrupt service routine.
- 2
- 4
- 8
- 16
Show answer
Answer: (b) 4
Q40. Each paragraph in keep function is ______ bytes in size.
- 4
- 8
- 16
- 32
Show answer
Answer: (c) 16
Why: keep() works in paragraphs of 16 bytes.
Q41. Interrupt 9 usually reads the ______ from keyboard.
- ASCII code
- Scan code
- Both ASCII and Scan code
- None of the above
Show answer
Answer: (b) Scan code
Q42. A software interrupt does not require EOI (End of interrupt).
- True
- False
Show answer
Answer: (a) True
Why: A software interrupt is raised by an instruction, not by a device, so no EOI is sent to the PIC.
Q43. To store each character in keyboard buffer ______ bytes are required.
- 2
- 4
- 6
- 8
Show answer
Answer: (a) 2
Q44. Interrupt ______ is empty; we can use its vector as a flag.
- 9H
- 13H
- 15H
- 65H
Show answer
Answer: (d) 65H
Q45. Command register is an ______ bit register
- 4
- 8
- 16
- 32
Show answer
Answer: (b) 8
Q46. The following command "outportb (0x61,inportb(0x61) | 3);" will ______ .
- Turn on the speaker
- Turn off the speaker
- Toggle the speaker
- None of the above
Show answer
Answer: (a) Turn on the speaker
Why: Port 61H bits 0 and 1 gate the timer output to the speaker and enable the speaker. OR-ing with 3 sets both bits, so the speaker is turned on.
Q47. The PPI acts as an interface between the CPU and a parallel ______ .
- I/O device
- CPU
- BUS
- None of Given
Show answer
Answer: (a) I/O device
Q48. Interrupt ______ is used to get or set the time.
- 0AH
- 1AH
- 2AH
- 3AH
Show answer
Answer: (b) 1AH
Q49. ______ is used to set the time of the RTC.
- 1A/02H
- 1A/03H
- 1A/04H
- 1A/05H
Show answer
Answer: (b) 1A/03H
Q50. Communication between keyboard and keyboard controller is ______.
- Asynchronous serial
- Synchronous serial
- Parallel communication
- None of the given
Show answer
Answer: (b) Synchronous serial
Why: No key in the source (one copy was marked 'not sure'). The keyboard sends bits to the controller with its own clock line, so it is synchronous serial. Judgment call.
Q51. Following is not a method of I/O
- Programmed I/O
- Interrupt driven I/O
- Hardware Based I/O
- None of given
Show answer
Answer: (c) Hardware Based I/O
Q52. Which of the following are types of ISR ______.
- BIOS (Basic I/O service ) ISR
- DOS ISR
- ISR provided by third party device drivers
- All of the given
Show answer
Answer: (d) All of the given
Q53. NMI Stand for
- Non Maskable Interrupt
- Non Multitude Interrupt
- Non Maskable Instruction
- None of Given
Show answer
Answer: (a) Non Maskable Interrupt
Q54. A single interrupt controller can arbitrate among ______ different devices.
- 4
- 6
- 8
- 10
Show answer
Answer: (c) 8
Q55. The microprocessor package has many signals for data. Below are some in Correct priority order (Higher to Lower).
- Reset,Hold,NMI,INTR
- NMI, INTR,Hold,Reset
- INTR,NMI,Reset,Hold
- None of the Given
Show answer
Answer: (a) Reset,Hold,NMI,INTR
Q56. The following command "outportb (0x61,inportb(0x61) & 0xFC);" will
- Turn on the speaker
- Turn off the speaker
- Toggle the speaker
- None of the given
Show answer
Answer: (b) Turn off the speaker
Why: Corrected: the source key said 'Turn on the speaker'. AND-ing port 61H with 0xFC clears bits 0 and 1, so the speaker is turned OFF (the opposite of OR 3).
Q57. BIOS DO NOT support ______.
- LPT1
- LPT2
- LPT3
- LPT4
Show answer
Answer: (d) LPT4
Q58. The bit ______ of Line control register in UART, if cleared will indicate that DLL is the data register.
- 1
- 3
- 5
- 7
Show answer
Answer: (d) 7
Why: Bit 7 of the Line Control Register is DLAB. Cleared: base+0 is the data (receive/transmit) register. Set: base+0 and base+1 become the divisor latch (DLL/DLM).
Q59. ______ used to determine the amount of conventional memory interfaced with the processor in kilobytes.
- INT 10 H
- INT 11 H
- INT 12 H
- INT 13 H
Show answer
Answer: (c) INT 12 H
Q60. To distinguish 486 with Pentium CPUID Test is used.
- True
- False
Show answer
Answer: (a) True
Why: Source key kept. CPUID is available on Pentium and later processors and is tested through the ID flag.
Q61. The memory addresses of COM ports remain same for all computers
- True
- False
Show answer
Answer: (b) False
Why: No key in the source. The COM port base addresses are read from the BIOS data area (40:00H onwards) because they can differ between machines, so the statement is False.
Q62. Int______ service 0 can be used to set the line parameter of the UART or COM port.
- 14H
- 15H
- 13H
- None of the given option
Show answer
Answer: (a) 14H
Q63. BIOS support ______UARTS as COM ports.
- 6
- 4
- 3
- 2
Show answer
Answer: (b) 4
Why: BIOS supports four COM ports (COM1 to COM4).
Q64. The______ function uses the COM port number to receive a byte from the COM port using BIOS services.
- recievebyte()
- initialize ()
- receive()
- recievechar()
Show answer
Answer: (d) recievechar()
Q65. Int 14H______ can be used to send a byte
- Service#0
- Service#1
- Service#2
- None of the given option.
Show answer
Answer: (b) Service#1
Q66. The ______function initialize the COM port whose number is passed as parameter using BIOS services.
- Initializecom()
- Initialize()
- Recievechar()
- None of these option
Show answer
Answer: (b) Initialize()
Q67. ______whenever received indicates the start of communication and ______ whenever received indicates a temporary pause in the communication.
- XON & XOFF
- XOFF & XON
- XON & YOFF
- YON & XOFF
Show answer
Answer: (a) XON & XOFF
Q68. In ______each byte is needed to be encapsulated in start and end.
- Synchronous communication
- Asynchronous communication
- Both
- None of given
Show answer
Answer: (b) Asynchronous communication
Q69. ______ is a device incorporated into the PC to update time even if the computer is off.
- Clock counter
- ROM
- Clock
- Real time clock
Show answer
Answer: (d) Real time clock
Q70. There are two type of communication synchronous and Anti Synchronous
- True
- False
Show answer
Answer: (b) False
Q71. The ______ function simply enables the self test facility within the modem control register
- STOn()
- SelfTest()
- SelfTestOn()
- Non of these
Show answer
Answer: (c) SelfTestOn()
Q72. REGS is a Union
- True
- False
Show answer
Answer: (a) True
Why: No key in the source. REGS is declared with the union keyword in dos.h (union REGS).
Q73. Total No. of bytes that can be stored in Keyboard Buffer is______.
- 16
- 32
- 64
- 128
Show answer
Answer: (b) 32
Why: 16 characters x 2 bytes each = 32 bytes.
Q74. If printer is ______ then printer sends back the ACK signal to the printer interface
- idle
- busy
- Out of paper
- None of the given
Show answer
Answer: (a) idle
Q75. The baud rate is set in accordance with the divisor value loaded within the UART internal registers base +0 and base +1.
- TRUE
- FALSE
Show answer
Answer: (a) TRUE
Q76. Int 14H ______ can be used to receive a byte.
- Service # 0
- Service # 1
- Service # 2
- None of the given options
Show answer
Answer: (c) Service # 2
Q77. ______ is used to read the date from the RTC.
- 1A/02H
- 1A/03H
- 1A/04H
- 1A/05H
Show answer
Answer: (c) 1A/04H
Q78. ______ is used to read the time from the RTC.
- 1A/02H
- 1A/03H
- 1A/04H
- 1A/05H
Show answer
Answer: (a) 1A/02H
Q79. Software based flow control make use of ______ control characters
- Xon
- XOFF
- Both
- None
Show answer
Answer: (c) Both
Q80. What will be the value of DL register when we are accessing C drive using undocumented service 21H/32H?
- 0
- 1
- 2
- 3
Show answer
Answer: (d) 3
Why: DL: 0 = default drive, 1 = A, 2 = B, 3 = C.
Q81. If keyboard buffer is empty the head and tail points at the same location.
- True
- False
Show answer
Answer: (a) True
Q82. Standard PC can have ______ PPI.
- 1
- 4
- 8
- 16
Show answer
Answer: (b) 4
Why: Source key kept; I could not verify this number independently.
Q83. By cascading two DMAs ______ bits can be transferred.
- 4
- 8
- 16
- 32
Show answer
Answer: (c) 16
Q84. File can be______ viewed as collection of clusters or blocks.
- Physically
- Logically
- Both physically and logically
- None
Show answer
Answer: (a) Physically
Q85. Operating system name contains ______ bytes in boot block.
- 3
- 5
- 8
- 11
Show answer
Answer: (c) 8
Q86. File system used in CD's is______ file system
- Contiguous
- Chained
- Indexed
- None
Show answer
Answer: (a) Contiguous
Why: No key in the source. CD file systems (ISO 9660) store each file contiguously.
Q87. ______means typematic rate will be sent in next byte.
- 0xF3
- 0xF4
- 0xF5
- 0xF6
Show answer
Answer: (a) 0xF3
Q88. To access the block within cluster using BIOS services the cluster number should be converted into ______.
- CHS
- LBA
- LSN
- None of the given
Show answer
Answer: (c) LSN
Why: Source key kept (LSN). Cluster number is converted to a logical sector number first; INT 13H then needs the LSN converted to CHS. Judgment call between LSN and CHS.
Q89. Display device (Monitor) performs ______ I/O.
- memory mapped
- Isolated
- Both of above
- None of these
Show answer
Answer: (a) memory mapped
Q90. Timer interrupt occurs ______ times every second by means of hardware.
- 18.2
- 16.2
- 15.2
- 14.2
Show answer
Answer: (a) 18.2
Why: The PIT is programmed so IRQ0 fires about 18.2 times a second.
Q91. An I/O device cannot be directly connected to the busses so controller is placed between CPU and I/O.
- True
- False
Show answer
Answer: (a) True
Q92. Keyboard uses port ______ as status port.
- 64H
- 66H
- 67H
- 69H
Show answer
Answer: (a) 64H
Q93. Tail of keyboard should get to get the start of buffer.
- True
- False
Show answer
Answer: (a) True
Q94. Control information in files is maintained using
- BPB
- DPB
- FCB
- FPB
Show answer
Answer: (c) FCB
Q95. At IRQ 7 Interrupt # ______ is used.
- 0x0A
- 0x0B
- 0x0C
- 0x0F
Show answer
Answer: (d) 0x0F
Why: IRQ0 to IRQ7 map to INT 08H to 0FH, so IRQ7 uses INT 0FH.
Q96. We have set the bit No. 7 of IMR(Interrupt Mask Register) to unmask the Interrupt so that interrupt ______ can occur at ______ line.
- 0xf ,IRQ 7
- 0xa, IRQ 6
- 0x8, IRQ 5
- 0x6, IRQ 2
Show answer
Answer: (a) 0xf ,IRQ 7
Why: Bit 7 of the IMR belongs to IRQ7, and IRQ7 maps to interrupt 0FH.
Q97. If we want to produce the grave voice from speaker phone then we have to load the ______ divisor values at Port ______.
- high, 0x42
- low, 0x22
- high, 0x22
- low, 0x42
Show answer
Answer: (a) high, 0x42
Why: Low pitch (grave) means low frequency, which needs a HIGH divisor. The divisor goes to timer channel 2 data port 42H.
Q98. In order to produce the sound from PC internal Speaker we have to load the______bit divisor value at the ______port.
- 8, 0x21
- 16, 0x42
- 32, 0x22
- 64, 0x32
Show answer
Answer: (b) 16, 0x42
Why: A 16-bit divisor is loaded into port 42H (low byte first, then high byte).
Q99. In counter register bit no. 3 changes its value between 0 and 1 with in ______clock cycles
- 1
- 2
- 4
- 16
Show answer
Answer: (d) 16
Why: Source key kept. Bit 3 of a binary counter completes one 0/1 cycle every 16 clock pulses (bit 0 every 2, bit 1 every 4, bit 2 every 8).
Q100. In keyboard status byte bit no. 2 and 3 are used for ctrl and alt keys respectively. which of the following condition is used to check that Ctrl + Alt keys are pressed. Where: unsigned char far * scr = (unsigned char far *)(0x00400017);
- if (((*scr)&12)==12)
- if (((*scr)&8)==8)
- if (((*scr)&4)==4)
- if (((*scr)&2)==2)
Show answer
Answer: (a) if (((*scr)&12)==12)
Why: Ctrl is bit 2 (value 4) and Alt is bit 3 (value 8), so the mask is 4 + 8 = 12.
Q101. Maximum number of interrupts in a standard PC is
- 64
- 128
- 256
- 512
Show answer
Answer: (c) 256
Q102. Keyboard Status Byte is located at the address
- 0040:0000H
- 0040:0013H
- 0040:0015H
- 0040:0017H
Show answer
Answer: (d) 0040:0017H
Q103. Drive parameter block is derived from ______.
- FCB
- FAT
- BPB
- CPB
Show answer
Answer: (c) BPB
Why: The DPB is built by DOS from the BPB in the boot block.
Q104. What will be the value of the word located at 1Fh in DPB when number of free clusters on drive is not known?
- 0000H
- 1111H
- FFFFH
- None of the given.
Show answer
Answer: (c) FFFFH
Why: FFFFH means the free cluster count is unknown (DPB offset 1FH).
Q105. We can access Blocks for FAT using ______.
- BPB
- DPB
- FCB
- Both BPB and DPB
Show answer
Answer: (d) Both BPB and DPB
Why: No key in the source. The BPB gives the number of reserved sectors and sectors per FAT, and the DPB also stores the start of the FAT, so both can be used. Judgment call.
Q106. Jump code part contains ______ bytes in boot block.
- 3
- 5
- 8
- 11
Show answer
Answer: (a) 3
Why: Boot block layout: 3 bytes of jump code, then 8 bytes of OS name.
Q107. File can be ______ viewed as organization of data.
- Physically
- Logically
- Both logically and physically
- None of the give
Show answer
Answer: (b) Logically
Why: No key in the source. A file is viewed logically as organised data and physically as a collection of clusters (compare with the 'physically' question above).
Q108. ______ is used to read a block against its LSN.
- absread()
- abswrite()
- lsnread()
- None of the given
Show answer
Answer: (a) absread()
Q109. When we talk about FAT based file system, in user data area first cluster number is ______.
- 0
- 1
- 2
- None of the given
Show answer
Answer: (c) 2
Why: Cluster numbering of the user data area starts at 2.
Q110. Cluster number can also be referred as block number.
- True
- False
Show answer
Answer: (a) True
Why: No key in the source. The lectures use 'cluster' and 'block' interchangeably for the allocation unit.
Q111. If we know the cluster number, we can access the blocks within the cluster using BIOS services directly.
- True
- False
Show answer
Answer: (b) False
Why: No key in the source. A cluster number must first be converted to a sector address (LSN, then CHS) before BIOS can read it.
Q112. ______ is an internal data structure of DOS and resides in main memory.
- BPB
- DPB
- CPB
- None of the given.
Show answer
Answer: (b) DPB
Q113. The size of DPB data structure is ______ bytes.
- 16
- 32
- 64
- 128
Show answer
Answer: (b) 32
Why: No key in the source. 32 bytes is the nearest option (the DOS 4+ DPB is 33 bytes). Unverified.
Q114. The size of FCB data structure is ______ bytes.
- 16
- 32
- 64
- 128
Show answer
Answer: (b) 32
Why: No key in the source. 32 bytes is the nearest option (a standard FCB is 37 bytes; a directory entry is 32). Unverified.
Q115. The directory structure of DOS is like ______.
- Array
- Tree
- Linked list
- None of the given
Show answer
Answer: (b) Tree
Q116. Size of FS Info block is ______.
- 64 bytes
- 128 bytes
- 256 bytes
- 512 bytes
Show answer
Answer: (d) 512 bytes
Why: No key in the source. The FS Info structure occupies one 512-byte sector. Unverified against the lecture.
Q117. When we mark a file as deleted by placing 0xE5 then the chain of clusters in FAT is also replaced by ______.
- E5
- 1
- 0
- N
Show answer
Answer: (c) 0
Why: When a file is deleted its FAT chain entries are set to 0 (free).
Q118. Cluster size is reduced in ______.
- FAT12
- FAT16
- FAT32
- None of the given
Show answer
Answer: (c) FAT32
Q119. Maximum possible entries in FAT12 are ______.
- 1024
- 2048
- 4096
- 65536
Show answer
Answer: (c) 4096
Why: 12-bit entries give 2^12 = 4096 entries.
Q120. Disadvantage of FAT32 is ______.
- Large disk size can be managed in FAT32
- Cluster size is reduced
- Internal fragmentation is reduced
- Very large table
Show answer
Answer: (d) Very large table
Q121. In FAT32 ______ root directory entries are there.
- 128
- 256
- 512
- None of the given
Show answer
Answer: (d) None of the given
Why: No key in the source. FAT32 has no fixed root directory table (the root is an ordinary cluster chain), unlike FAT12/16 with 512 entries. Judgment call.
Q122. If a file is having more than one cluster then it will be managed by ______.
- FAT
- BPB
- DPB
- None of the above
Show answer
Answer: (a) FAT
Q123. Internal fragmentation is reduced in ______.
- FAT12
- FAT16
- FAT32
- None of the given
Show answer
Answer: (c) FAT32
Q124. For supporting long file names, ______ fragments can be supported.
- 12
- 20
- 26
- 32
Show answer
Answer: (b) 20
Why: Up to 20 long-name fragments of 13 characters each (about 255 characters).
Q125. To store a cluster in FAT 32 ______ is/are needed.
- Nibble
- Byte
- 2 Bytes
- 4 Bytes
Show answer
Answer: (d) 4 Bytes
Why: A FAT32 entry is 32 bits (4 bytes).
Q126. If a file size is 12K and the size of the cluster is 4K then ______ clusters are used for the file.
- 2
- 3
- 4
- 5
Show answer
Answer: (b) 3
Why: 12K / 4K = 3 clusters.
Q127. We can access the contents of File by using the root directory entry and ______.
- Reserved Blocks
- Number of FAT copies
- File Allocation Table (FAT)
- None of the given
Show answer
Answer: (c) File Allocation Table (FAT)
Q128. FAT based file system can store file name in ______ form.
- ASCII
- UNICODE
- Both ASCII and UNICODE
- None of the given
Show answer
Answer: (c) Both ASCII and UNICODE
Why: No key in the source. 8.3 names are ASCII, long names are stored as Unicode. Judgment call.
Q129. Select correct Top down approach sequence of layered approach followed for system programming.
- Hardware -> Bios -> DOS
- DOS -> Bios -> Hardware
- Bios -> DOS -> Hardware
Show answer
Answer: (b) DOS -> Bios -> Hardware
Why: Top down: DOS, then BIOS, then hardware.
Q130. Systems programming is the study of techniques that facilitates the acquisition of ______ from input devices.
- Data
- Information
- Power
- Control
Show answer
Answer: (a) Data
Why: No key in the source. Judgment call; the exact lecture wording could not be confirmed.
Q131. Maximum numbers of interrupts that are registered in IVT are;
- FF
- EF
- BF
- AE
Show answer
Answer: (a) FF
Why: FFH (255) is the highest interrupt number; the table holds 256 entries (0 to FF).
Q132. In interrupt vector table, if we are at address 0000:03FBH, this represent interrupt number;
- FE
- EF
- EE
- FF
Show answer
Answer: (a) FE
Why: 0x3FB / 4 falls inside the entry for interrupt FEH (addresses 3F8H to 3FBH).
Q133. Parameters in interrupts are passed through ______ .
- Stack
- Registers
- Array
- None of the given options
Show answer
Answer: (b) Registers
Q134. If we are at address F000:0000H, then we are supposed to invoke interrupt(s) for;
- BIOS
- COM4
- LPT3
- LPT1
Show answer
Answer: (a) BIOS
Why: F000H is the BIOS ROM segment.
Q135. What is output of the following program; #include<DOS.H> union REGS regs; void main (void ) { regs.h.al = 0x99; regs.h.ah = 0x00; printf ("%x",regs.x.ax); }
- 00
- 99
- 0099
- 9900
Show answer
Answer: (b) 99
Why: AX = 0x0099, and %x prints it without leading zeros, so the output is 99.
Q136. Int86() has ______ parameters.
- 0
- 1
- 2
- 3
Show answer
Answer: (d) 3
Why: int86(intno, &inregs, &outregs) takes three parameters.
Q137. Getting interrupt vector refers to the operation which is used to read the ______ address stored with in vector.
- Far
- Near
- High
- None of the given options
Show answer
Answer: (a) Far
Q138. keep() has ______ parameters while exit() has ______.
- 0, 2
- 1, 2
- 2, 0
- 2, 1
Show answer
Answer: (d) 2, 1
Why: keep(status, size_in_paragraphs) has 2 parameters; exit(status) has 1.
Q139. Interrupt number 8 is invoked by ______.
- DOS
- BIOS
- Hardware
- None of the given
Show answer
Answer: (c) Hardware
Why: INT 08H is the timer interrupt, raised by hardware.
Q140. In text mode, screen has limit to print ______ alphabets shown on screen simultaneously.
- 1500
- 1800
- 2000
- 2200
Show answer
Answer: (c) 2000
Why: 80 columns x 25 rows = 2000 characters.
Q141. The registers Flags, ______ are pushed on execution of INT instruction and executions branches to the interrupt procedure
- CS and IP
- CS and SP
- IP and DS
- DS and SP
Show answer
Answer: (a) CS and IP
Why: INT pushes Flags, CS and IP.
Q142. To access disk interrupt ______ and its service ______ are used
- 13H , 3H
- 13H, 12H
- 09H , 3H
- 12H , 3H
Show answer
Answer: (a) 13H , 3H
Why: INT 13H, with AH=03H for writing sectors (AH=02H reads).
Q143. The address of partition block on hard disk is ______.
- head # =1, track# = 0 and sector # = 1
- head # =0, track# = 0 and sector # = 0
- head # =1, track# = 1 and sector # = 1
- head # =0, track# = 0 and sector # = 1
Show answer
Answer: (d) head # =0, track# = 0 and sector # = 1
Why: The partition table (MBR) is at head 0, track 0, sector 1.
Q144. The service ______ is called the keyboard hook service
- 15H/4FH
- 15H/4EH
- 16H/4AH
- 15H/4FFH
Show answer
Answer: (a) 15H/4FH
Q145. Which of the following register is used, if you want to block access of any Hardware.
- ISR
- IMR
- IRR
- None of the given
Show answer
Answer: (b) IMR
Why: Masking a hardware interrupt is done through the Interrupt Mask Register (IMR).
Q146. NMI (Non maskable Interrupt) is used by ______ .
- ALU circuitry which performs division
- COM ports
- LPT ports
- Keyboard and timer
Show answer
Answer: (a) ALU circuitry which performs division
Why: No key in the source. Judgment call: the other options are maskable devices, so the first is the only plausible one. Unverified.
Q147. keep(1, 1000); is called in the TSR program, it means that ______ No. of bytes are reserved in the memory.
- 8000
- 16000
- 32000
- 64000
Show answer
Answer: (b) 16000
Why: 1000 paragraphs x 16 bytes = 16000 bytes.
Q148. If we want to produce the shrill voice from the speaker phone then we have to load the ______ divisor value at Port ______.
- high, 0x42
- low, 0x42
- high, 0x22
- low, 0x22
Show answer
Answer: (b) low, 0x42
Why: High pitch (shrill) means high frequency, which needs a LOW divisor, loaded at port 42H.
Q149. If we want to send printing on the printer then we have to perform following steps.
- Initialize printer
- Read Status
- Check Error
- All of the given
Show answer
Answer: (d) All of the given
Q150. In interrupt 17H. if DX register contains zero, then I/O will be performed on .
- LPT1
- LPT3
- LPT4
Show answer
Answer: (a) LPT1
Why: DX = 0 selects LPT1.
Q151. The speed of a microprocessor depends upon ______.
- Memory
- Frequency of clock signal
- Operating system
Show answer
Answer: (b) Frequency of clock signal
Why: One option was unreadable in the source and has been left out.
Q152. A UART device uses ______ for error detection.
- Checksum
- CRC Check
- Parity Bit
- LRC Check
Show answer
Answer: (c) Parity Bit
Why: Second option was partly unreadable in the source; the answer (parity bit) is not affected.
Q153. Which register is NOT available in the UART device?
- Receiver Buffer Register
- Interrupt Focus Register
- Line Status Register
- Interrupt ID Register
Show answer
Answer: (b) Interrupt Focus Register
Q154. A code 0xFA on port 60H (keyboard interface) indicates that the byte has been received ______.
- with errors
- with acknowledgment
- properly
- with duplicate values
Show answer
Answer: (c) properly
Why: The lecture says 0xFA is written to show the byte was received properly. Some option words were partly cut off in the source and were restored.
Q155. The logical view of organised data is called ______.
- Information
- Structure
- File
Show answer
Answer: (c) File
Q156. The segment address of the IVT is fixed at ______.
- 000FH
- 0001H
- 0000H
Show answer
Answer: (c) 0000H
Q157. The keyboard buffer works like a ______ data structure.
- Linked list
- Circular queue
- Stack
- Queue
Show answer
Answer: (b) Circular queue
Q158. In interrupt interception with software interrupts, the original interrupt can be invoked ______.
- in the middle of the ISR
- at the start of the ISR
- anywhere in the ISR
- at the end of the ISR
Show answer
Answer: (c) anywhere in the ISR
Q159. The capacity of the keyboard buffer is ______.
- 16 characters
- 32 characters
- 8 characters
Show answer
Answer: (a) 16 characters
Why: Each character takes 2 bytes, so 16 characters = 32 bytes. The source listed '32 characters' twice; the duplicate was merged.
Q160. IRQ1 is used by the ______ interface.
- Scanner
- Mouse
- Keyboard
- Camera
Show answer
Answer: (c) Keyboard
Q161. The lower two bytes of any far address contain the ______ address.
- NULL
- Segment
- Offset
- Both segment and offset
Show answer
Answer: (c) Offset
Q162. A graphic adapter is a(n) ______.
- I/O controller
- Memory
- Software
- Processor
Show answer
Answer: (a) I/O controller
Part 2: Subjective Questions
Q1. Write a C program that sends characters typed at the keyboard to a COM port and displays the characters received from it (a simple terminal / modem hook-up). The COM port number is passed as a parameter to the helper functions. (5 marks)
The program uses the BIOS serial services of INT 14H through four small helper functions: initialize() (service 0), sendchar() (service 1), receivechar() (service 2) and getcomstatus() (service 3). The status function returns an unsigned int: AH holds the line status and AL the modem status. In the line status, bit 5 (0x20) means the transmitter can accept a byte and bit 0 (0x01) means a byte has been received. The loop sends a key when the port is ready and a key was pressed, shows any received byte, and stops when Esc (27) is typed or received.
#include <dos.h>
#include <conio.h>
#include <stdio.h>
void initialize(int port, unsigned char param) /* INT 14H, service 0 */
{
_DX = port; /* 0 = COM1, 1 = COM2 ... */
_AL = param; /* baud rate, parity, stop bits, data bits */
_AH = 0;
geninterrupt(0x14);
}
void sendchar(char ch, int port) /* INT 14H, service 1 */
{
_DX = port;
_AL = ch;
_AH = 1;
geninterrupt(0x14);
}
char receivechar(int port) /* INT 14H, service 2 */
{
_DX = port;
_AH = 2;
geninterrupt(0x14);
return _AL; /* received byte */
}
unsigned int getcomstatus(int port) /* INT 14H, service 3 */
{
_DX = port;
_AH = 3;
geninterrupt(0x14);
return _AX; /* AH = line status, AL = modem status */
}
void main()
{
unsigned int status;
char ch1 = 0, ch2 = 0;
initialize(0, 0xE3); /* COM1: 9600 baud, 8 data bits, no parity, 1 stop bit */
while (1) {
status = getcomstatus(0);
if (((status >> 8) & 0x20) && kbhit()) { /* transmitter ready and key pressed */
ch1 = getche();
sendchar(ch1, 0);
}
if ((status >> 8) & 0x01) { /* data ready: byte received */
ch2 = receivechar(0);
putch(ch2);
}
if (ch1 == 27 || ch2 == 27) /* Esc ends the program */
break;
}
}Note: the shared answer used the variables i, ch1, ch2 without declaring them and had broken line breaks; this version declares everything and defines the helpers. It was syntax-checked against a stand-in for the DOS headers, not run on a real DOS compiler or modem.
Q2. How is the battery-powered RAM (CMOS) of the real time clock accessed? Show code that reads and writes a byte.
The 64-byte battery-powered RAM is accessed in two steps:
- Write the byte number (index) to port 70H.
- Read or write port 71H to get or set the value of that byte.
Byte 0 holds the seconds, byte 2 the minutes and byte 4 the hours (stored as BCD).
#include <dos.h>
void main()
{
unsigned char sec, hrs = 0x10; /* values in the RTC RAM are BCD */
outportb(0x70, 0); /* select byte 0 (seconds) */
sec = inportb(0x71); /* read the selected byte */
outportb(0x70, 4); /* select byte 4 (hours) */
outportb(0x71, hrs); /* write the selected byte */
}Q3. What will be the binary value of the LED status byte if Scroll Lock and Num Lock are on? (3 marks)
The LED control byte that is sent to the keyboard (after the command 0xED) uses one bit per LED:
| Bit | LED |
|---|---|
| 0 | Scroll Lock |
| 1 | Num Lock |
| 2 | Caps Lock |
Scroll Lock + Num Lock on: 0000 0011 (03H). For comparison, Caps Lock + Scroll Lock on gives 0000 0101 (05H).
Note: if the question means the keyboard status byte stored at 0040:0017H instead, Scroll Lock is bit 4 and Num Lock is bit 5, so the byte is 0011 0000 (30H). The source gave only the diagram, not the final value.
Q4. What is the value / code of the Caps Lock LED, and how is it set?
In the LED control byte Caps Lock is bit 2, so the value is 0000 0100 (04H). To switch the LED on, send the command 0xED to port 60H and then the byte 0x04, following the keyboard writing protocol.
#include <dos.h>
unsigned char sendkb(unsigned char value) /* keyboard writing protocol */
{
unsigned char ack;
do {
while (inportb(0x64) & 0x02); /* wait until input buffer is empty */
outportb(0x60, value); /* write the byte */
while (!(inportb(0x64) & 0x01)); /* wait until output buffer is full */
ack = inportb(0x60); /* 0xFA = received properly, 0xFE = resend */
} while (ack == 0xFE); /* repeat if the byte was not received */
return ack;
}
void main()
{
sendkb(0xED); /* LED control command */
sendkb(0x04); /* bit 2 set = Caps Lock LED on */
}Note: the shared answer said "status byte of caps lock is 2"; that is the value for Num Lock (bit 1). Caps Lock is 4 in the LED byte (and bit 6 of the status byte at 0040:0017H). Syntax-checked only, not run on hardware.
Q5. What are XON and XOFF in software flow control?
Software flow control uses two control characters. XON, when received, tells the sender to start (or resume) sending. XOFF, when received, tells the sender to pause the communication temporarily. No extra wires are needed, unlike hardware flow control (RTS/CTS).
Q6. Write a program that reads the time from the real time clock using INT 1AH service 02H and prints it as ASCII (BCD to ASCII conversion). (5 marks)
Service 02H returns the time as packed BCD: CH = hours, CL = minutes, DH = seconds. Each byte holds two decimal digits, one per nibble. To print a digit, shift or mask the nibble and add '0' (0x30) to get its ASCII code.
#include <dos.h>
#include <stdio.h>
#include <conio.h>
void main()
{
unsigned char hours, minutes, seconds;
_AH = 2; /* INT 1AH, service 02H: read time */
geninterrupt(0x1A);
hours = _CH; /* packed BCD */
minutes = _CL;
seconds = _DH;
clrscr();
printf("%c%c:%c%c:%c%c",
(hours >> 4) + '0', (hours & 0x0F) + '0', /* high nibble, low nibble */
(minutes >> 4) + '0', (minutes & 0x0F) + '0',
(seconds >> 4) + '0', (seconds & 0x0F) + '0');
getch();
}Note: the shared program used a variable called months instead of minutes and a long pointer-based conversion; this version does the same job directly. Syntax-checked only.
Q7. How is data (control information) sent to the keyboard?
The processor writes the byte to port 60H. The device driver checks the output buffer full (OBF) bit of the status port 64H, which stays set as long as the byte has not been received by the keyboard. When the keyboard has received the byte it writes the code 0xFA on port 60H to say the byte was received properly. Typical bytes sent are 0xED (set LEDs) and 0xF3 (set typematic rate).
Q8. Explain INT 14H and its services (in particular services 1, 2 and 3). (2 marks)
INT 14H is the BIOS service for COM ports. DX holds the port number (0 = COM1, 1 = COM2, ...) and the service number is placed in AH.
| Service | Purpose |
|---|---|
| 00H | Set communication parameters (initialize the port) |
| 01H | Output (send) a character |
| 02H | Read in (receive) a character |
| 03H | Get port status (AH = line status, AL = modem status) |
Q9. What do THR, DLL, DLM and RBR stand for?
| Abbreviation | Meaning |
|---|---|
| THR | Transmitter Holding Register |
| RBR | Receiver Buffer Register (holds the received data) |
| DLL | Divisor Latch Low (low byte of the baud rate divisor) |
| DLM | Divisor Latch Most significant byte (high byte of the baud rate divisor) |
Note: the shared answers wrote "Band Rate Divisor" and "Receiver Data"; the register names above are the standard ones. DLL and DLM are reached at base+0 and base+1 when bit 7 (DLAB) of the Line Control Register is set.
Q10. In parallel flow control between two computers, what is the role of bit D4?
A byte is sent in two halves. First the low nibble is placed on bits D0 to D3 of the data port, and the D4 bit is cleared to show that the low nibble is being sent. The receiver learns that the nibble has arrived when it checks the BUSY bit, which the interface sets on arrival. The high nibble is then sent in the same way with D4 set.
Q11. What are DTE and DCE? (2 marks)
RS-232C is a standard for the physical connector between a DTE (Data Terminal Equipment), such as a computer or terminal, and a DCE (Data Communication Equipment), such as a modem.
Q12. How are data transmission and reception done in RS-232C, and which lines are used? (flow control) (3 marks)
- Data is received through the RxD line and sent through the TxD line.
- DTR (Data Terminal Ready) says the data terminal is live.
- DSR (Data Set Ready) says the data set (modem) is live.
- When the sender wants to send, it raises RTS (Request To Send). If the receiver is free, it answers with CTS (Clear To Send), and the data transfer starts.
Q13. How is input taken from the keyboard?
The keyboard is a hardware device and uses interrupt number 9 for input. Whenever a key is pressed, INT 9 occurs. The interrupt service routine reads the scan code from the keyboard port (60H), converts it into the appropriate ASCII code, and places it in the keyboard buffer in the BIOS data area.
Q14. What is the FIFO queue of the UART?
Newer UARTs (the 16550 family) keep a queue (buffer) of input and output bytes inside the chip so that I/O is more efficient: the processor does not have to service every single byte. The queue size / trigger level is controlled through the FIFO control register.
Note: the shared answer called the chip "16500"; the standard FIFO UART is the 16550.
Q15. What are the steps to find out whether a coprocessor is available?
- Initialize the coprocessor.
- Read the high byte of its control word.
- If the value of the high byte is 3, the coprocessor is available; otherwise it is absent.
Q16. What is the Real Time Clock (RTC)? (3 marks)
The real time clock is a device incorporated into the PC that keeps updating the time even when the computer is switched off, because it runs from a battery. Its 64-byte battery-powered RAM holds the time, date and alarm values, and is accessed through ports 70H (index) and 71H (data). The BIOS can also configure it through INT 1AH.
Q17. What is the self-test mode of the UART and what happens in it?
When a developer has only one computer, the UART's self-test mode can be used to test the software. In this mode the output of the UART is routed back to its input, so whatever is sent is received again.
Q18. What is the function of the Interrupt ID register?
When a UART interrupt occurs, the cause may need to be identified (for example data received, transmitter empty, line status or modem status change). The Interrupt ID register is used to identify the cause of the interrupt.
Q19. Which is better, serial or parallel communication?
| Serial | Parallel | |
|---|---|---|
| Speed | Lower transfer rate | Faster, several bits at once |
| Cost | Cheaper (fewer wires) | More expensive (more wires) |
| Distance | Suitable for long distances | Reliable only for short distances |
Parallel communication is better when speed matters and the devices are close; serial is better for cost and distance.
Q20. State the function of INT 1AH services 06H, 07H and 09H. (2 marks)
| Service | Function |
|---|---|
| 1AH / 06H | Set alarm |
| 1AH / 07H | Disable (reset) alarm |
| 1AH / 09H | Read alarm |
Q21. What is the role of the coprocessor control word in coprocessor testing?
The control word holds control information about the coprocessor. Bit 7 is the interrupt enable flag, and bits 8 and 9 should contain 11 after initialization (so the high byte reads 3 when a coprocessor is present). The coprocessor status word, like the flags register of the microprocessor, can be used to read the result of a comparison.
Q22. Describe the Status Register A of the RTC.
| Bits | Meaning |
|---|---|
| 7 | Update in progress: set while the RTC is updating the time registers |
| 6 to 4 | Divider / time base: the frequency at which the time is sampled and updated |
| 3 to 0 | Rate selection: a code for the frequency of the periodic hardware interrupt of the RTC |
Q23. Draw the Status Register C of the RTC.
| Bit | 7 | 6 | 5 | 4 | 3 to 0 |
|---|---|---|---|---|---|
| Meaning | Interrupt request flag | 1 = periodic interrupt occurred | 1 = alarm time reached | 1 = time update complete | Not used (0) |
Note: the source had only a hand-drawn diagram; this table is a redraw of it using the standard RTC register layout.
Q24. How can the interrupt 0x0F be enabled for interrupt driven printer I/O, and how does the PIC handle it?
Three things are needed:
- Enable the interrupt in the printer control register.
- Unmask it (IRQ7) in the IMR of the PIC.
- Intercept the vector: set the vector of interrupt 0x0F to the address of the program's function
newint().
The PIC raises INT 0FH whenever the printer can accept output, so newint() runs. It writes the next byte of the buffer to the data register and sends a pulse on the strobe signal to tell the printer data has arrived. After the whole buffer is sent, the original vector of INT 0FH is restored, the interrupt is masked again and the program's memory is released. The routine also sends EOI to the PIC at the end.
Q25. In the condition <code>((inport(*lpt + 1)) & 0x80) == 0x80</code>, what is being checked?
The expression reads the printer status port (base address + 1) and tests bit 7, the BUSY line. The bit is set when the printer is not busy, so the condition checks whether the printer port is idle (ready to accept the next byte).
Q26. Which commands are used before changing the typematic rate and the LEDs of the keyboard?
| Command | Use |
|---|---|
| 0xF3 | Set the typematic rate (the rate byte follows) |
| 0xED | Set the LEDs (the LED byte follows) |
Q27. What is a null modem?
If data is to be transferred between two computers over a medium that can carry digital signals, the modems can be left out and a UART on each computer can be connected directly to the other. This arrangement is called a null modem.
Q28. Describe the keyboard writing protocol.
- Wait until the input buffer is empty (ready to accept a byte).
- Write the byte to the buffer (port 60H).
- Wait until the output buffer is full.
- Check the acknowledgement byte (0xFA means received properly).
- Repeat the process if it was not successful (0xFE asks for a resend).
Note: the shared answer said "wait till input buffer is full"; a byte can only be written when the input buffer is empty, so that wording was corrected.
Q29. How can LPT1 and LPT2 be swapped? Write the code.
The BIOS data area stores the base addresses of the printer ports starting at 0040:0008H (LPT1), then LPT2 at 0040:000AH. Exchanging these two words swaps the ports.
void main()
{
unsigned int far *lpt = (unsigned int far *) 0x00400008; /* 0040:0008 = LPT1 base address */
unsigned int temp;
temp = *lpt; /* save LPT1 base */
*lpt = *(lpt + 1); /* LPT1 now uses the old LPT2 base */
*(lpt + 1) = temp; /* LPT2 now uses the old LPT1 base */
}Note: uses the Turbo C far pointer keyword, so it needs a DOS compiler.
Q30. What is the purpose of interrupt 11H?
Interrupt 11H is used to determine the system's equipment information. On return the information is placed in the AX register.
Q31. The status byte of LPT1 has been obtained through INT 17H. Write the C conditions that check for time out, transfer error and out of paper.
INT 17H returns the printer status byte in AH. The relevant bits are: bit 0 = time out, bit 3 = I/O (transfer) error, bit 5 = out of paper (bit 6 = acknowledge, bit 7 = not busy).
#include <dos.h>
#include <stdio.h>
void main()
{
unsigned char status;
_DX = 0; /* LPT1 */
_AH = 2; /* INT 17H, service 2: get printer status */
geninterrupt(0x17);
status = _AH; /* status byte comes back in AH */
if (status & 0x01) printf("Time out\n");
if (status & 0x08) printf("I/O (transfer) error\n");
if (status & 0x20) printf("Out of paper\n");
}Q32. Explain the purpose of the UART.
The UART is a device used for asynchronous communication. It can encapsulate a byte that is 5, 6, 7 or 8 bits wide in start and stop bits, it can attach an extra parity bit for error detection, and the width of the stop bits can also vary.
Q33. Describe the purpose of INT 12H and service 88H.
INT 12H returns the amount of conventional memory interfaced with the processor, in kilobytes. The amount of extended memory (above conventional memory) is determined with service 15H / 88H.
Part 3: Short Notes & Key Terms
- DMA
- Direct Memory Access: an I/O device moves data to or from memory without the CPU copying each byte. Two 8-bit DMA controllers cascaded together give 16-bit transfers.
- Interrupt Vector Table (IVT)
- A table of 256 entries of 4 bytes each (1024 bytes) at segment 0000H. Each entry is the far address (offset and segment) of an interrupt service routine. The address of an entry is interrupt number x 4, and FFH (255) is the highest interrupt number.
- Interrupt service routine (ISR)
- The routine that runs when an interrupt occurs. There are BIOS ISRs, DOS ISRs and ISRs provided by third-party device drivers. Interrupt procedures written in C are usually treated as reentrant.
- Hardware and software interrupts
- The two main kinds of interrupt. Hardware interrupts come from devices (timer INT 8, keyboard INT 9) through the PIC. Software interrupts are raised by the INT instruction and need no EOI.
- INT instruction
- Pushes Flags, CS and IP, then branches to the interrupt procedure through the IVT. IRET returns. The service number is usually placed in AH and parameters are passed in registers.
- Getting and setting a vector
- Getting a vector reads the far address stored in the IVT entry. Setting a vector changes that double-word entry so it points to a new routine (Turbo C: getvect, setvect). Interrupt 65H is unused by DOS and BIOS, so its vector can serve as a flag.
- Interrupt interception
- A new ISR can call the original interrupt at the start, in the middle, at the end or anywhere in itself.
- 8259 PIC
- Programmable interrupt controller; one PIC arbitrates among 8 devices (IRQ0 to IRQ7). IMR (port 21H) masks lines, IRR holds requests and ISR holds the interrupts in service. A hardware ISR ends by sending EOI (0x20) to port 20H.
- IRQ to interrupt numbers
- IRQ0 to IRQ7 map to INT 08H to 0FH. IRQ0 is the timer (INT 8), IRQ1 the keyboard (INT 9) and IRQ7 (INT 0FH) is typically the printer.
- NMI
- Non-maskable interrupt: it cannot be masked in the IMR. The processor priority order in this course is Reset, Hold, NMI, INTR.
- System timer interrupt
- INT 8, raised by hardware about 18.2 times every second.
- Interval timer (8253/8254)
- Works in six modes (0 to 5). The counter register divides the clock frequency. The command register is 8 bits wide at port 43H; channel 2 data port is 42H.
- Speaker programming
- Load a 16-bit divisor at port 42H. A high divisor gives a low (grave) pitch, a low divisor a high (shrill) pitch. Port 61H bits 0 and 1 control the speaker: OR with 3 turns it on, AND with 0xFC turns it off.
- PPI (8255)
- Programmable Peripheral Interface: acts as the interface between the CPU and a parallel I/O device. Used for parallel communication.
- Keyboard ports
- Port 60H is the data port (scan code in, commands out). Port 64H is the status / command port. The OBF bit of 64H shows the output buffer is full.
- Keyboard buffer
- A circular queue in the BIOS data area: 32 bytes, i.e. 16 characters at 2 bytes each (ASCII and scan code). Head and tail point to the same place when it is empty.
- Keyboard status byte (0040:0017H)
- Bit 2 = Ctrl, bit 3 = Alt (test both with mask 12), bit 4 = Scroll Lock, bit 5 = Num Lock, bit 6 = Caps Lock.
- Keyboard commands
- 0xED = set LEDs (bit 0 Scroll, bit 1 Num, bit 2 Caps), 0xF3 = set typematic rate, 0xFA = acknowledge (byte received properly). Keyboard hook service: INT 15H / 4FH.
- INT 14H (serial BIOS)
- DX = port (0 = COM1). Services: 0 initialize, 1 send a character, 2 receive a character, 3 get status. BIOS supports four COM ports.
- UART
- Asynchronous device that wraps each byte (5 to 8 bits) in start and stop bits and may add a parity bit for error detection. Has a self-test mode in which its output is routed to its input.
- UART registers
- RBR (receive), THR (transmit), IER (interrupt enable), Interrupt ID register, FIFO control (16550), LCR (line control), MCR (modem control), LSR (line status), MSR (modem status), DLL and DLM (baud divisor).
- Baud rate divisor
- The baud rate is set by loading a divisor (1843200 / (16 x baud), i.e. 115200 / baud) in DLL (base+0) and DLM (base+1) after setting DLAB, bit 7 of the Line Control Register.
- COM and LPT addresses
- Base addresses of the ports are kept in the BIOS data area (COM from 0040:0000H, LPT1 at 0040:0008H) and may differ between computers. BIOS supports 4 COM ports and 3 LPT ports.
- INT 17H (printer BIOS)
- Controls the printer through the BIOS; DX = 0 selects LPT1. Status byte: bit 0 time out, bit 3 I/O error, bit 5 out of paper, bit 6 acknowledge, bit 7 not busy.
- Synchronous and asynchronous communication
- Two kinds of serial communication. Synchronous needs a timing signal to mark bits. Asynchronous wraps each byte in start and stop bits.
- RS-232C lines
- TxD (send), RxD (receive), DTR (Data Terminal Ready), DSR (Data Set Ready), RTS (Request To Send), CTS (Clear To Send). DTE = Data Terminal Equipment, DCE = Data Communication Equipment.
- Flow control
- Hardware flow control uses RTS/CTS lines. Software flow control uses the XON and XOFF characters.
- Null modem
- Two UARTs connected directly, without modems, so two computers can exchange digital data.
- Real time clock (RTC)
- Keeps time when the PC is off. Accessed through the 64-byte battery RAM: port 70H selects the byte, port 71H reads or writes it (byte 0 seconds, 2 minutes, 4 hours).
- INT 1AH services
- 02H read time, 03H set time, 04H read date, 05H set date, 06H set alarm, 07H disable alarm, 09H read alarm. Time and date come back as packed BCD.
- Memory size services
- INT 12H = conventional memory in KB. INT 15H / 88H = extended memory. INT 11H = equipment (system) information in AX.
- Coprocessor test
- After initialization read the high byte of the control word; if it is 3 the coprocessor is present. Bit 7 of the control word is the interrupt enable flag.
- Methods of I/O
- Programmed I/O, interrupt driven I/O and DMA. An I/O controller placed between the CPU and device provides control signals, buffering, and error detection and correction.
- Memory mapped and isolated I/O
- Memory mapped I/O uses memory addresses for devices (the monitor works this way). Isolated I/O uses a separate port address space.
- Layered approach
- Top down: application, DOS, BIOS, hardware.
- union REGS and int86()
- union REGS gives access to the CPU registers; int86(intno, &inregs, &outregs) takes three parameters. geninterrupt() raises an interrupt using the pseudo-registers.
- TSR programs
- keep(status, size) leaves the program resident, with size counted in paragraphs of 16 bytes (keep(1, 1000) reserves 16000 bytes). exit(status) takes one parameter.
- Far address
- Offset in the lower two bytes, segment in the upper two bytes. Text mode screen: 80 x 25 = 2000 characters.
- Boot block
- Starts with 3 bytes of jump code, then 8 bytes for the operating system name, followed by the BPB. The partition table (master boot record) is at head 0, track 0, sector 1.
- BPB, DPB and FCB
- BPB (BIOS parameter block) is in the boot block. DPB (drive parameter block) is an internal DOS structure in memory built from the BPB; the word at 1FH holds the free cluster count (FFFFH if unknown). FCB is used for control information about files.
- Cluster / block and LSN
- A file is seen logically as organised data and physically as a collection of clusters (blocks). Cluster numbering of the user data area starts at 2. A cluster is converted to a logical sector number (LSN) and then to CHS for BIOS (INT 13H, service 02H read, 03H write). absread() reads by LSN.
- FAT12, FAT16, FAT32
- FAT12 has 12-bit entries (4096). FAT32 has 4-byte entries, smaller clusters and less internal fragmentation, but a very large table. FAT32 has no fixed root directory table.
- Directory entries
- The directory structure of DOS is a tree. An entry is 32 bytes. Deleting a file puts 0xE5 in the entry and sets its FAT chain to 0. Long names use up to 20 fragments of 13 characters stored as Unicode; short 8.3 names are ASCII.
- CD file system
- Files on a CD are stored contiguously.
No comments:
Post a Comment
Please give us your feedback & help us to improve this site.