Lab 9

10/24/02 Tue


Comparison with last week’s lab

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.

Loop until the ready bit is turned on.

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.

How does a buffer work?

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. 

Back to Top

Revised: 10/20/02.