Bell sound (with floppy fix)

User avatar
pgimeno
Top Contributor
Posts: 710
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Bell sound (with floppy fix)

Unread post 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
Attachments
boot0-bochs-2020-floppy-bell.zip
(19.23 KiB) Downloaded 202 times
User avatar
NML32
Posts: 298
Joined: Sun May 24, 2020 6:57 pm
Has thanked: 301 times
Been thanked: 51 times

Re: Bell sound

Unread post 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.
flynnsbit
Top Contributor
Posts: 552
Joined: Sun May 24, 2020 8:07 pm
Has thanked: 185 times
Been thanked: 310 times
Contact:

Re: Bell sound

Unread post by flynnsbit »

Such a small change but makes everything feel right. Good one!
ZigZag
Posts: 99
Joined: Sun Jun 28, 2020 7:05 am
Has thanked: 1 time
Been thanked: 6 times

Re: Bell sound

Unread post 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.
Televicious
Posts: 93
Joined: Mon May 25, 2020 8:23 pm
Been thanked: 4 times

Re: Bell sound

Unread post by Televicious »

Some trackers like All Sound Tracker let you make PC speaker music. Can really push the limits of the bell.
ZigZag
Posts: 99
Joined: Sun Jun 28, 2020 7:05 am
Has thanked: 1 time
Been thanked: 6 times

Re: Bell sound

Unread post by ZigZag »

Also some older games used PC speaker only sound (I think "Mean Streets" might be an example).
User avatar
pgimeno
Top Contributor
Posts: 710
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Re: Bell sound

Unread post 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.
ZigZag
Posts: 99
Joined: Sun Jun 28, 2020 7:05 am
Has thanked: 1 time
Been thanked: 6 times

Re: Bell sound

Unread post 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.
rhester72
Top Contributor
Posts: 1323
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 15 times
Been thanked: 213 times

Re: Bell sound

Unread post by rhester72 »

How do you test this? I'm booted with the new boot0.rom and echoing CTRL-G makes no sound.
User avatar
pgimeno
Top Contributor
Posts: 710
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Re: Bell sound

Unread post 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
rhester72
Top Contributor
Posts: 1323
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 15 times
Been thanked: 213 times

Re: Bell sound

Unread post by rhester72 »

Operator error - clicked on the github link, not the attachment :P Sorry!
User avatar
pgimeno
Top Contributor
Posts: 710
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Re: Bell sound (with floppy fix)

Unread post by pgimeno »

I've updated the OP to use the latest ROM that includes the floppy fixes.
Post Reply