|
Writing a character to the terminal output using Polling (Lab8) |
Writing a character to the terminal output using interrupt service routine (Lab9) |
|
Interrupt disabled. Look at ready bit. Write a character to the output. |
Enable the terminal output interrupt. Write a character into a buffer area. A terminal output interrupt is triggered. Interrupt service handler removes a character from the
buffer and write it to the terminal. |
In lab 9, the communication between user program and the interrupt service handler is done through memory.
There are three variables: buffer, nextIn and nextOut.
Buffer is 32 character wide space and is used for circular queue buffer.
When a character is inserted in the buffer, it is written in the location buffer[nextIn] and nextIn is decremented by one.
nextIn wraps around when it gets less than 0.
When termical output is ready, a character is removed from the location buffer[nextOut] and written to the terminal. Like nextIn, it is decremented by one and wraps around when it gets less than 0.