Beep PC Speaker

Hi! Why won’t the PC speaker (connected to motherboard) beep without the Audio drivers? It works in VMWare with all the audio things disabled, but not on a native PC.
Is there a way to bypass the integrated audio shit? The BIOS does it…

Code:

#include <stdlib.h>
#include <stdio.h>
#include <x86/inout.h>
#include <sys/neutrino.h>
#include <unistd.h>
#include <stdint.h>
#include <qnx/mma.h>

int main()
{
int system_control=0;
unsigned long i;
unsigned long kbd, clk;

ThreadCtl(_NTO_TCTL_IO, 0);

kbd = mmap_device_io(4,0x60);
clk = mmap_device_io(4,0x40);

// turn on bits 0 & 1 of kbd 0x61
system_control=in8(kbd + 1);
out8(kbd + 1,system_control | 0x03);

// load control word for 8254

out8(clk + 3, 0xb7); // bcd count, square wave,
// r/w lsb then msb, channel 2

// load counts
// to get 440Hz tone, divide 8254 clock (1.1892 MHz) by 2702
out8(clk + 2,0x02); // lsb count
out8(clk + 2,0x27); // msb count - remember, we’re using BCD

// pause a bit…
sleep(1);

// shut it off
system_control=in8(kbd + 1);
out8(kbd + 1,system_control & 0xfc);
return(0);

}

If the speaker won’t beep, then it probably isn’t there. Maybe VMWare is virtualizing the beep through the Windows/Linux audio system.

It beeps on BIOS complete.

By not there, I mean the normal hardware might not be there. The BIOS might know where its non-standard location is.

If you press CTRL-G in a shell do you hear a beep? If you do then you’re code has something wrong in it. If you don’t then most probably the sound device isn’t a standard one ( but I doubt that).

No beep,. What do you mean sound system? I assume you don’t need the audio drivers installed to get the PC speaker to make noises.

I found a driver for my Audio card… Problem solved.