Page 1 of 1

Bell sound (with floppy fix)

Posted: Tue Sep 01, 2020 1:04 am
by pgimeno
tldr: Grab the attachment, unzip it, rename it as boot0.rom and place it in the ao486 folder to get a system bell sound.

Updated to Floppy fix ROM

When I tried to test the PC Speaker sound, I first entered 'echo ^G'. I was disappointed when I noticed that it didn't work. So I tried some program that used the PC speaker, and that one worked. The conclusion: the system bell is broken!

So I began digging into the cause, and realized that the Tseng VGA BIOS passes responsibility to the system BIOS (via INT 42h) in case of beep, and the system BIOS assumes in turn that INT 10h is implemented by the VGA BIOS and therefore implements nothing. It's a classic case of mutual someone-else-will-do-it.

Well, the beeper is a system peripheral that is not related to video, so I thought its correct place is the system BIOS. And so I implemented it. Taking this file as a base: https://github.com/MiSTer-devel/ao486_M ... /boot0.rom I patched it to add the bell. It's attached below. Rename it to boot0.rom and place it in the ao486 folder.

I assembled it directly with symdeb, so I there aren't any sources. But since the license imposes releasing the source code, here's a disassembly of the fragment that I modified (in place of an iret at F065 followed by zeros):

Code: Select all

F065  3D070E            cmp ax,0e07
F068  7401              jz f06b
F06A  CF                iret
F06B  51                push cx
F06C  B0B6              mov al,b6
F06E  E643              out 43,al
F070  B005              mov al,05
F072  E642              out 42,al
F074  E642              out 42,al
F076  E461              in al,61
F078  88C4              mov ah,al
F07A  0C03              or al,03
F07C  E661              out 61,al
F07E  B9000E            mov cx,0e00
F081  E461              in al,61
F083  A810              test al,10
F085  75FA              jnz f081
F087  E461              in al,61
F089  A810              test al,10
F08B  74FA              jz f087
F08D  E2F2              loop f081
F08F  88E0              mov al,ah
F091  E661              out 61,al
F093  59                pop cx
F094  B8070E            mov ax,0e07
F097  CF                iret
This snippet is donated to the public domain.

The full BIOS is GPL, and since I'm distributing a binary, I also must point to the source. The source code of the BIOS prior to patching can be obtained from https://github.com/MiSTer-devel/ao486_M ... sw/sysbios

Edit: Note that if you're using the open source VGA BIOS instead of the Tseng one, it won't work, because it neither transfers back to the system BIOS nor implements beeping: https://github.com/MiSTer-devel/ao486_M ... os.c#L2086

Re: Bell sound

Posted: Tue Sep 01, 2020 1:35 am
by NML32
@pgimeno Nice, it worked.
I typed echo ctrl+g enter and got a beep. I also held down a key and filled the keyboard buffer and got beeps.

Re: Bell sound

Posted: Tue Sep 01, 2020 1:47 am
by flynnsbit
Such a small change but makes everything feel right. Good one!

Re: Bell sound

Posted: Tue Sep 01, 2020 3:43 am
by ZigZag
How I loved sitting at the computer, playing with my bell as a teenager! :lol: Brings back memories.

The beeper was vital, you could diagnose H/W issues by counting the amount of beeps it made when you turned the PC on & got a blank screen.

There was also a rather excellent "soundcard" emulator that used the beeper. I used it when watching gravis ultrasound only PC demos on the 486.

Re: Bell sound

Posted: Tue Sep 01, 2020 7:45 am
by Televicious
Some trackers like All Sound Tracker let you make PC speaker music. Can really push the limits of the bell.

Re: Bell sound

Posted: Tue Sep 01, 2020 10:12 am
by ZigZag
Also some older games used PC speaker only sound (I think "Mean Streets" might be an example).

Re: Bell sound

Posted: Tue Sep 01, 2020 1:24 pm
by pgimeno
To be clear, this patch only fixes the "standard bell", the bell that you get when character 7 (Ctrl-G) is printed. The keyboard buffer full indicator, and the PC Speaker sound in games, do not depend on this patch at all.

Yes, I believe Mean Streets used PWM techniques to reproduce PCM sound, and was quite innovative in that.

Re: Bell sound

Posted: Tue Sep 01, 2020 1:39 pm
by ZigZag
pgimeno wrote: Tue Sep 01, 2020 1:24 pm To be clear, this patch only fixes the "standard bell", the bell that you get when character 7 (Ctrl-G) is printed. The keyboard buffer full indicator, and the PC Speaker sound in games, do not depend on this patch at all.

Yes, I believe Mean Streets used PWM techniques to reproduce PCM sound, and was quite innovative in that.
For beep sake, it's still a beeping marvelous improvement anyway. Thank you.

Also, I guess we wouldn't hear the beeping thing if PC speaker wasn't already emulated.

Re: Bell sound

Posted: Tue Sep 01, 2020 2:54 pm
by rhester72
How do you test this? I'm booted with the new boot0.rom and echoing CTRL-G makes no sound.

Re: Bell sound

Posted: Tue Sep 01, 2020 3:09 pm
by pgimeno
rhester72 wrote: Tue Sep 01, 2020 2:54 pm How do you test this? I'm booted with the new boot0.rom and echoing CTRL-G makes no sound.
Maybe you're using the Bochs VGA ROM.

Try replacing BOOT1.ROM with this one:
https://github.com/MiSTer-devel/ao486_M ... /boot1.rom

Re: Bell sound

Posted: Tue Sep 01, 2020 4:21 pm
by rhester72
Operator error - clicked on the github link, not the attachment :P Sorry!

Re: Bell sound (with floppy fix)

Posted: Tue Sep 08, 2020 12:15 pm
by pgimeno
I've updated the OP to use the latest ROM that includes the floppy fixes.