OSDev.org https://forum.osdev.org/ |
|
Speaker boot frequency for 8088/386 boot https://forum.osdev.org/viewtopic.php?f=1&t=33724 |
Page 1 of 1 |
Author: | ~ [ Sat Jun 01, 2019 5:36 pm ] |
Post subject: | Speaker boot frequency for 8088/386 boot |
What are the speaker frequencies used for booting sounds in 8088/386 machines? I want to implement them in my kernel functions. Code: ;http://www.edaboard.com/showthread.php?182595-how-to-produce-beep-using-assembly-in-8086
;; sound: STARTSOUND: ;CX=FREQUENCY IN HERTZ. DESTROYS AX & DX pushfwide pushawide CMP CX, 014H JB STARTSOUND_DONE ;CALL STOPSOUND IN AL, 061H ;AND AL, 0FEH ;OR AL, 002H OR AL, 003H DEC AX OUT 061H, AL ;TURN AND GATE ON; TURN TIMER OFF MOV DX, 00012H ;HIGH WORD OF 1193180 MOV AX, 034DCH ;LOW WORD OF 1193180 DIV CX MOV DX, AX MOV AL, 0B6H PUSHF CLI ;!!! OUT 043H, AL MOV AL, DL OUT 042H, AL MOV AL, DH OUT 042H, AL POPF IN AL, 061H OR AL, 003H OUT 061H, AL STARTSOUND_DONE: popawide popfwide RET STOPSOUND: ;DESTROYS AL IN AL, 061H AND AL, 0FCH OUT 061H, AL popawide popfwide RET nosound: pushfwide push wideax IN AL, 061H AND AL, 0FCH OUT 061H, AL pop wideax popfwide retwide |
Author: | Octocontrabass [ Sun Jun 02, 2019 9:51 am ] |
Post subject: | Re: Speaker boot frequency for 8088/386 boot |
~ wrote: What are the speaker frequencies used for booting sounds in 8088/386 machines? Whatever the BIOS developer felt like using. There's no standard. |
Author: | bzt [ Wed Jun 05, 2019 10:37 am ] |
Post subject: | Re: Speaker boot frequency for 8088/386 boot |
Octocontrabass wrote: Whatever the BIOS developer felt like using. There's no standard. That's right. Only the durations were somewhat standardized (1 long 2 short = video card error for example).http://www.bioscentral.com/beepcodes/amibeep.htm http://www.bioscentral.com/beepcodes/astbeep.htm http://www.bioscentral.com/beepcodes/awardbeep.htm ...etc. I haven't heard any beeps for some time, but I believe it was a high C note (but correct me). Cheers, bzt |
Author: | nullplan [ Wed Jun 05, 2019 12:35 pm ] |
Post subject: | Re: Speaker boot frequency for 8088/386 boot |
I generally use 1000 Hz, which is also the censorship sound on TV, so people already know it is bad news. |
Author: | eekee [ Tue Jun 11, 2019 10:08 am ] |
Post subject: | Re: Speaker boot frequency for 8088/386 boot |
nullplan wrote: I generally use 1000 Hz, which is also the censorship sound on TV, so people already know it is bad news. Now you mention it, I think every post-90s PC I've had beeped around that frequency. Thinkpads do, and they're loud. Older machines could be the same or lower. |
Author: | ~ [ Tue Jun 18, 2019 5:04 pm ] |
Post subject: | Re: Speaker boot frequency for 8088/386 boot |
These seem to be the standard sound frequencies, set for the high and low byte of the speaker counter: 8088, 7 for boot and 4 maybe for error (I also use 6 as it sound very similar in my machines) 386, 5 for boot I've come to find this function for NASM: Code: ;Inputs: ; AH -- Uniform beep value ; CX -- Low word wait counter ; DI -- High word wait counter ; ;; OPCODE__speaker_bootbeep: pusha pushf ;mov ah,5 mov al,0xB6 out 43h,al mov al,ah out 42h,al out 42h,al in al,61h or al,3 out 61h,al .wait: push ecx ;mov cx,0xFF loop $ pop ecx dec di jnz .wait and al,-3 out 61h,al popf popa ret Code: ;Inputs: ; AH -- Uniform beep value ; CX -- Low word wait counter ; DI -- High word wait counter ; ;; OPCODE__speaker_bootbeep: pushawide pushfwide ;mov ah,5 mov al,0xB6 out 43h,al mov al,ah out 42h,al out 42h,al in al,61h or al,3 out 61h,al .wait: push widecx ;mov cx,0xFF loop $ pop widecx dec di jnz .wait and al,-3 out 61h,al popfwide popawide retwide Wait 0x5FFFF in a loop for 8088 boot sound with 6: Code: mov widedi,0x5 mov widecx,0xFFFF mov ah,6 call OPCODE__speaker_bootbeep Wait 0x3FFFF in a loop for 386 boot sound with 5: Code: mov widedi,0x3 mov widecx,0xFFFF mov ah,5 call OPCODE__speaker_bootbeep Wait 0xFFFFF in a loop for 8088 slow turn on sound with 7: Code: mov edi,0xf
mov ecx,0xFFFF mov ah,7 call OPCODE__speaker_bootbeep |
Author: | nullplan [ Tue Jun 18, 2019 10:34 pm ] |
Post subject: | Re: Speaker boot frequency for 8088/386 boot |
Wow, this required a bit of deciphering. So what ~ means by "frequency 5" and the other numbers, is that they load 257 times that number into the PIT as reset counter. This effectively divides the input frequency of ca. 1.2MHz by the reset counter, leading to the frequencies: 4 --> 1160 Hz 5 --> 928 Hz 6 --> 773 Hz 7 --> 663 Hz Since the input is a divisor, the pitch actually gets lower the higher the input is. But your "tone 4" is pretty close to my 1000 Hz. Also, the duration is set by how long it takes the CPU to count ECX down to zero. Wouldn't it be better/more consistent to use the PIT for that as well? I'm using an interrupt handler for interrupt 1C, which gets called with about 18 Hz. This way I don't need to meddle with PIT channel 0, since the BIOS will have already set it up. But do note that in my case, all error tones are fatal, so no program is running anymore. Maybe I should elaborate. My MBR has two possible error tones: Continuous and intermittent, for the two possible errors ("no active partition" and "BIOS load error", respectively). In either case, I set up PIT channel 2 with a reset count of 1193 and enable tone generation in port 0x61. But, if I want the intermittent tone, I also register an int 1C handler, which counts a static variable down from 18. Once 0 is reached, the variable is reset to 18, and the LSB in port 0x61 is flipped. Also, I of course jump to the previous int 1C handler instead of returning. In the meantime, the main program is sitting in a HLT loop (with STI before it, of course). |
Author: | drunkenfox [ Sat Jun 22, 2019 7:09 am ] |
Post subject: | Re: Speaker boot frequency for 8088/386 boot |
I've found it goes pretty low when it does the triple beep RAM death error. I don't know if that's an artifact of RAM not being present or they chose such a low frequency. But most normal single shot post success beeps sound like 1khz but post failures appear to have a slightly lower tone. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |