#!/bin/sh

# Note: the bank select register actually contains two
# partial "beep enable" bits!

# read the contents of the bank select bits (just curious
echo "Original contents of the bank select register:"
outb 0xA15 0x4E
inb 0xA16

# select bank 0
outb 0xA15 0x4E
outb 0xA16 0x00

echo "Original contents of the beep control 1 (bank 0, reg 0x56)"
outb 0xA15 0x56
inb 0xA16

echo "Original contents of the beep control 2 (bank 0, reg 0x57)"
echo "  Note: bit 7 == global beep enable!"
outb 0xA15 0x57
inb 0xA16

# select bank 4
outb 0xA15 0x4E
outb 0xA16 0x04

echo "Original contents of the beep control 3 (bank 4, reg 0x53)"
outb 0xA15 0x53
inb 0xA16

if false; then
 echo "Disabling the beep function globally:"
 # select bank 0
 outb 0xA15 0x4E
 outb 0xA16 0x00
 # disable bit 7 in beep control 2 ... and all the other bits as well :-)
 outb 0xA15 0x57
 outb 0xA16 0x00
fi

echo "Done."
