CS609- System Programming midterm past papers

CS609- System Programming Midterm Solved Past Papers

Q. XON and OFF in software flow contol

Answer:- XON whenever received indicates the start of communication and XOFF whenever received indicates a temporary pause in the communication.

Q. what type of information send to keyboard.

Answer:- Some data (as control information) can be send to the keyboard. The processor will write on the port 60H. The device driver will check the OBF( output buffer full bit of port 64H which remains set as long as the byte is not received by the keyboard.

Q. Step to access battery powered ram. 

Answer:-  Battery Powered RAM is accessed in two steps

• Specify the Byte no. in 70H port.

• Read/write port 71H to get/set the value of specified byte.

Following slide shown a fragment of code that can be used to read or write onto any byte within the 64 byte battery powered RAM.

outport (0x70, 0);

outport (0x70, 4);

sec = inport (0x71);

outport (0x71,hrs);

Q. A function that will send com port. com port number will be accessed as parameter.

Answer:- The sendchar() function sends a character to the COM port using BIOS service whose number is passed as parameter. And the getcomstatus() function retrieves the status of the COM port whose number has been specified and returns the modem and line status in an unsigned int.

void main()


while(1) {

i = getcomstatus (0);

if (((*(((char*)(&i)) + 1)&0x20) == 0x20) && (kbhit()))


ch1 = getche(); sendchar (ch1, 0);


i f ((*(((char*)(&i)) +1) & 0x01) == 0x01){

ch2 = receivechar (0);

putch (ch2);


i f ((ch1 == 27) || (ch2 ==27)) break;

} }


Answer:-  Band Rate Divisor (Low Byte)


Answer:-  Receiver Data

Q. programe BCD to ASCII.


void main ()


unsigned int hours, months, seconds;

_AH =2; geninterrupt(0x1a);

hours = _CH;

minutes = _CL;

seconds = _DH;

hours = hours <<4;

*((unsigned char *)(& hours)) = (*((unsigned char *) (& hours))) >>4;

hours = hours + 0x3030; seconds = seconds <<4;

*((unsigned char *)(& seconds)) = (*((unsigned char *)(& seconds))) >>4;

seconds = seconds + 0x3030; minutes = minutes <<4;

*((unsigned char *)(& minutes)) = (*((unsigned char *)(& minutes))) >>4;

minutes = minutes + 0x3030; clrscr();


*(((unsigned char*)(&hours))+1), *((unsigned char*)(&hours)),

*(((unsigned char*)(&minutes))+1),

*((unsigned char*)(&minutes)),

*(((unsigned char*)(&seconds))+1),

*((unsigned char*)(&seconds)),



The above program uses the service int 1Ah/02H to read the time from the real time clock. It reads the time and converts the packed BCD values into unpacked BCD values. These values are then converted into ASCII and displayed using the printf() statement.

Q. Steps of coprocessor available.



• Read Hi – Byte of Control register.

• If value in Hi – Byte is 3, then coprocessor is available, otherwise its absent.

Q. int 14h explain service#2,service#3

Answer:-  Service #02 = Read in characters Service #03 = Get port status


Answer:- Band Rate Divisor (High Byte)


Answer:-  Transmitter Holding Register.

Q. In flow control what is the working of D4?

Answer:-  D4 bit is cleared to indicate the low nibble is being sent. The receiver will know the arrival of the low nibble when its checks BUSY bit which should be set (by the interface) on arrival.

Q. How to get input from keyboard

Answer:-  Keyboard is a hardware device and it makes use of interrupt number 9 for its input operations. Whenever a key is pressed interrupt number 9 occurs. The operating system processes this interrupt in order to process the key pressed. This interrupt usually reads the scan code from the keyboard port and converts it into the appropriate ASCII code and places the ASCII code in the keyboard buffer in BIOS data area

Q. FIFO UART queue.

Answer:-  This feature is available in the newer version of the UART numbered 16500. A queue or a buffer of the input or output bytes is maintained within the UART in order to facilitate more efficient I/O. The size of the queue can be controlled through this register.

Q. What is the function of Interrupt ID Register?

Answer:- Once an interrupt occurs it may be required to identify the case of the interrupt. This register is used to identify the cause of the interrupt.

Q. int 14 h and its services?

Answer:-  INT # 14H

DX = Port # 0 for COM1

DX = Port # 1 for COM2 etc.

Service #0 = Set communication parameters

Service #01 = Output characters

Service #02 = Read in characters

Service #03 = Get port status

Q.How can we enable the 0x0f to perform interrupt driven I/O? and how PIC will handle this interrupt?

Answer:- ) To enable the interrupt 0x0f three things are required to be done. The interrupt should be enabled in the printer control register; secondly it should also be unmasked in the IMR in PIC. The program can then intercept or set the vector of interrupt 0x0f by placing the address of its function newint(); The newint() will now be called whenever the printer can perform output. This newint() function writes the next byte in buffer to the data registers and then send a pulse on the strobe signal to tell the printer that data has been sent to it. When whole of the buffer has been sent the int 0x0f vector is restored, interrupt is masked and the memory for the program is de-allocated.

Q. What is Real Time clock?

Answer:- Real time clock is a device incorporated into the PC to update time even if the computer is off. It has the characteristics shown in the slide above which enables it to update time even if the computer is off.

Q.What do you understand by Self test mode of UART what happens in this situation?

Answer:-  If a single computer is available to a developer the UART contains a self test mode which can be used by the programmer to self test the software. In self test mode the output of the UART is routed to its input. So you receive what you send.

Q. Which one is better Serial or parallel communication?

Answer:-  Cost is reduced in serial communication but transfer rate is low so parallel communication is better because it is faster than serial in terms of speed and it is valuable for short distances only.

Q. 1A/06 , 1A/07, 1A/09 function of these services.

Answer:-  Set Alarm 1AH/06

Disable Alarm 1AH/07

Read Alarm 1AH/09

Q. in RS232 flow control which line used to send and receive data.

Answer:-  Data is received through the RxD line. Data is send through the TxD line.

Q. Role of co-processor control world in co-processor testing? 

Answer:-  The co-processor control word contains some control information about the co-processor. The bit number 7 of coprocessor control word is the Interrupt Enable Flag and bit number 8 & 9 should contain 11 on initialization.

Q. Draw/describe status register A of RTC? 

Answer:-The lower 4 bits of this register stores a code indicating the frequency with which the RTC hardware interrupt can interrupt the processor. The next field is used to specify the time frequency i.e. the frequency with the time is sampled and hence updated. The most significant bit indicates that after time sampling if the time has been updated in to the 64 byte RAM or not.