Anyone know how to make the internal PC speaker beep?
Thanks in advance,
K.J.
Making the PC internal speaker beep...
Re:Making the PC internal speaker beep...
look at one of the early versions of Linux
version 0.11 I think -- search for "wonder-kernel" :)
version 0.11 I think -- search for "wonder-kernel" :)
Re:Making the PC internal speaker beep...
i geuss you can poke the speaker with the interrupts from the timer.
Re:Making the PC internal speaker beep...
This is sound.c from the DJGPP library source:
Code: Select all
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <pc.h>
void
sound(int freq)
{
int scale;
if (freq == 0)
{
outportb(0x61, inportb(0x61) & ~3);
return;
}
scale = 1193046 / freq;
outportb(0x43, 0xb6);
outportb(0x42, scale & 0xff);
outportb(0x42, scale >> 8);
outportb(0x61, inportb(0x61) | 3);
}
Re:Making the PC internal speaker beep...
Sorry this isn't commented. I'd be happy to elaborate, if anyone cares. This COM program should generate a tone until you hit a key. It is assembled in NASM (see Refs. below).
;------------ CUT HERE ---------------
; nasmw beep.asm -o beep.com
org 0x0100
in al, 61h???
jmp $+2
or al, 03h
out 61h, al
???
mov al, 0b6h
out 43h, al
???
mov ax, 1193
out 42h, al
mov al, ah
out 42h, al
???
xor ah, ah
int 16h
???
in al, 61h
jmp $+2
and al, 0fdh
out 61h, al
mov ah,4Ch ???
int 21h ???
;Refs:
;nasm.2y.net
;www.ctyme.com/rbrown.htm
;------------ CUT HERE ---------------
;------------ CUT HERE ---------------
; nasmw beep.asm -o beep.com
org 0x0100
in al, 61h???
jmp $+2
or al, 03h
out 61h, al
???
mov al, 0b6h
out 43h, al
???
mov ax, 1193
out 42h, al
mov al, ah
out 42h, al
???
xor ah, ah
int 16h
???
in al, 61h
jmp $+2
and al, 0fdh
out 61h, al
mov ah,4Ch ???
int 21h ???
;Refs:
;nasm.2y.net
;www.ctyme.com/rbrown.htm
;------------ CUT HERE ---------------