• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Make a speaker beep in Assembly

heymrdj

Diamond Member
Need to write a small program, that I've got almost done. Just need to add a section so that when I jump to it because the preceding value was false, it make a BEEP (via board speaker or attached speakers doesn't really matter). My book just says to echo a beep character (ASCII 7). But if I do this:

Code:
mov AX, 7
_PutCh

I've also tried int 21h with no luck either. Also int 07h.
I get no beeps. I'm sure I'm missing something really silly, any enlightenment?
 
Nope didn't work. Problem is, I have sound setup in VMWare, but I dunno if it will pass audio through. I have to use and XP Pro VM because I have Vista Ultimate 64 bit which obviously does not support 16bit. Any ideas?
 
Alright it was indeed just _PutCh 7, which is a BIOS beep. apparently XP in VMWare can't pass that command along, it worked fine when I put it on a real XP computer (one of our in apartment computer labs).

Thanks for the help though!
 
What kind of computer? Many main boards have built in piezo buzzers now and don't actually have the DOS style PC speaker connected. If you are running a modern OS, and then running in other emulators or layers of abstraction, it's not going to work quite the same. The audio system like a sound card and the legacy PC speaker "beep" are two totally different things.

Do you get a POST beep or beeping in the BIOS when you run out of menu or anything like that?

The speaker itself doesn't actually beep, you have to set up an oscillating square wave with the also legacy 8253 hardware timer to get a tone. This is what DOS/BIOS does for you when you print the "beep" ASCII.
 
Last edited by a moderator:
If you are using windows, I would use something like
Code:
push Frequency
push Duration
call Beep
 
It's the problem with the HAL in Windows (Hardware Abstraction Layer) and also with VMware why the following will NOT toggle the numlock key in DOS, Windows 95/98/SE/Bloat Code edition.

C:>debug
-a100
xxxx:0100 pop DS ;pop the data segment on from the stack (remember CP/M?)
xxxx:0103 xor byte ptr[0417],20 ;xor the bios data segment with toggle bit
xxxx:0108 int 20 ;exit program
^c
-rcx0108
-nx.com
-w
bland but true you cant talk directly to it (hardware) unless calling the windows system beep function
 
Back
Top