Turning the Speaker On and

The system board speaker is another relatively fixed feature of the standard PC. Its audio signal comes from a 1.19318 MHz square wave. To get control over the speaker's pitch, this signal is divided by the number stored in the two-byte register located at I/O address 42H. This register must be written to using two successive one-byte writes, most significant byte first. Whether the speaker is turned on or not is controlled by the bottom two bits of a very important one-byte register located at I/O address 61H. Some of the bits of this register indicate parity errors in memory. Reports of these errors cause the system to halt! Consequently, we don't want to flip one of them idly or accidentally. The and and or instructions are perfectly suited for changing some bits and leaving the others alone. For example, to turn the speaker on, the following three commands are needed:

To turn them off,

will do.

It should be noted that in Linux, access to I/O ports by users is, by default at least, prohibited. I/O permissions can be given to a process, however, by the system calls ioperm() and iopl(), which are specially adapted to the x86 architecture.

Was this article helpful?

0 0
The Ultimate Computer Repair Guide

The Ultimate Computer Repair Guide

Read how to maintain and repair any desktop and laptop computer. This Ebook has articles with photos and videos that show detailed step by step pc repair and maintenance procedures. There are many links to online videos that explain how you can build, maintain, speed up, clean, and repair your computer yourself. Put the money that you were going to pay the PC Tech in your own pocket.

Get My Free Ebook


Post a comment