| 1 | ; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz | 
|---|
| 2 | ; | 
|---|
| 3 | ; This file is part of AiR-BOOT | 
|---|
| 4 | ; | 
|---|
| 5 | ; AiR-BOOT is free software: you can redistribute it and/or modify it under | 
|---|
| 6 | ;  the terms of the GNU General Public License as published by the Free | 
|---|
| 7 | ;  Software Foundation, either version 3 of the License, or (at your option) | 
|---|
| 8 | ;  any later version. | 
|---|
| 9 | ; | 
|---|
| 10 | ; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY | 
|---|
| 11 | ;  WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS | 
|---|
| 12 | ;  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 
|---|
| 13 | ;  details. | 
|---|
| 14 | ; | 
|---|
| 15 | ; You should have received a copy of the GNU General Public License along with | 
|---|
| 16 | ;  AiR-BOOT. If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 17 | ; | 
|---|
| 18 | ;--------------------------------------------------------------------------- | 
|---|
| 19 | ;                                                  AiR-BOOT / SOUND SUPPORT | 
|---|
| 20 | ;--------------------------------------------------------------------------- | 
|---|
| 21 |  | 
|---|
| 22 | IFDEF   MODULE_NAMES | 
|---|
| 23 | DB 'SOUND',0 | 
|---|
| 24 | ENDIF | 
|---|
| 25 |  | 
|---|
| 26 | ; Here is some sound code. Requested by Hex1753. | 
|---|
| 27 |  | 
|---|
| 28 | SOUND_PreBootMenu              Proc Near  Uses ax | 
|---|
| 29 | test    byte ptr [CFG_MakeSound], 1 | 
|---|
| 30 | jz      SOUND_PreBootMenu_SkipSound | 
|---|
| 31 | test    byte ptr [StartSoundPlayed], 1 | 
|---|
| 32 | jnz     SOUND_PreBootMenu_SkipSound | 
|---|
| 33 | mov     ax, 1500 | 
|---|
| 34 | call    SOUND_MakeSound | 
|---|
| 35 | mov     ax, 100 | 
|---|
| 36 | call    SOUND_WaitToSilence | 
|---|
| 37 | mov     ax, 2000 | 
|---|
| 38 | call    SOUND_MakeSound | 
|---|
| 39 | mov     ax, 200 | 
|---|
| 40 | call    SOUND_WaitToSilence | 
|---|
| 41 | mov     byte ptr [StartSoundPlayed], 1 | 
|---|
| 42 | SOUND_PreBootMenu_SkipSound: | 
|---|
| 43 | ret | 
|---|
| 44 | SOUND_PreBootMenu              EndP | 
|---|
| 45 |  | 
|---|
| 46 | SOUND_ExecuteBoot              Proc Near  Uses ax | 
|---|
| 47 | test    byte ptr [CFG_MakeSound], 1 | 
|---|
| 48 | jz      SOUND_ExecuteBoot_SkipSound | 
|---|
| 49 | mov     ax, 2000 | 
|---|
| 50 | call    SOUND_MakeSound | 
|---|
| 51 | mov     ax, 10 | 
|---|
| 52 | call    SOUND_WaitToSilence | 
|---|
| 53 | mov     ax, 1000 | 
|---|
| 54 | call    SOUND_MakeSound | 
|---|
| 55 | mov     ax, 20 | 
|---|
| 56 | call    SOUND_WaitToSilence | 
|---|
| 57 | mov     ax, 1500 | 
|---|
| 58 | call    SOUND_MakeSound | 
|---|
| 59 | mov     ax, 10 | 
|---|
| 60 | call    SOUND_WaitToSilence | 
|---|
| 61 | mov     ax, 1900 | 
|---|
| 62 | call    SOUND_MakeSound | 
|---|
| 63 | mov     ax, 20 | 
|---|
| 64 | call    SOUND_WaitToSilence | 
|---|
| 65 | mov     ax, 1000 | 
|---|
| 66 | call    SOUND_MakeSound | 
|---|
| 67 | mov     ax, 10 | 
|---|
| 68 | call    SOUND_WaitToSilence | 
|---|
| 69 | mov     ax, 1500 | 
|---|
| 70 | call    SOUND_MakeSound | 
|---|
| 71 | mov     ax, 30 | 
|---|
| 72 | call    SOUND_WaitToSilence | 
|---|
| 73 | SOUND_ExecuteBoot_SkipSound: | 
|---|
| 74 | ret | 
|---|
| 75 | SOUND_ExecuteBoot              EndP | 
|---|
| 76 |  | 
|---|
| 77 | SOUND_MakeSound                Proc Near  Uses bx dx | 
|---|
| 78 | mov    bx, ax | 
|---|
| 79 | mov    ax, 34DDh | 
|---|
| 80 | mov    dx, 0012h | 
|---|
| 81 | cmp    dx, bx                         ; Too small frequency | 
|---|
| 82 | jnb    SOUND_MakeSound_J1 | 
|---|
| 83 | div    bx | 
|---|
| 84 | mov    bx, ax | 
|---|
| 85 | in     al, 61h | 
|---|
| 86 | test   al, 03h                        ; Already playing (?) | 
|---|
| 87 | jnz    SOUND_MakeSound_J2 | 
|---|
| 88 | or     al, 03h | 
|---|
| 89 | out    61h, al | 
|---|
| 90 | mov    al, -4Ah | 
|---|
| 91 | out    43h, al | 
|---|
| 92 | SOUND_MakeSound_J2: | 
|---|
| 93 | mov    al, bl | 
|---|
| 94 | out    42h, al | 
|---|
| 95 | mov    al, bh | 
|---|
| 96 | out    42h, al | 
|---|
| 97 | SOUND_MakeSound_J1: | 
|---|
| 98 | ret | 
|---|
| 99 | SOUND_MakeSound                EndP | 
|---|
| 100 |  | 
|---|
| 101 | SOUND_WaitToSilence            Proc Near  Uses bx cx dx | 
|---|
| 102 | ; AX = MilliSeconds | 
|---|
| 103 | mov    bx, 03E8h | 
|---|
| 104 | mul    bx | 
|---|
| 105 | mov    cx, dx | 
|---|
| 106 | mov    dx, ax | 
|---|
| 107 | mov    ax, 8600h | 
|---|
| 108 | int    15h | 
|---|
| 109 | in     al, 61h | 
|---|
| 110 | and    al, 0FCh | 
|---|
| 111 | out    61h, al | 
|---|
| 112 | ret | 
|---|
| 113 | SOUND_WaitToSilence            EndP | 
|---|
| 114 |  | 
|---|
| 115 |  | 
|---|
| 116 |  | 
|---|
| 117 | ; Rousseau: added | 
|---|
| 118 | SOUND_Beep                     PROC Near | 
|---|
| 119 | pushf | 
|---|
| 120 | pusha | 
|---|
| 121 |  | 
|---|
| 122 | mov      al, 7 | 
|---|
| 123 | mov      bh, 0 | 
|---|
| 124 | mov      bl, 7 | 
|---|
| 125 | mov      ah, 0eh | 
|---|
| 126 | int      10h | 
|---|
| 127 |  | 
|---|
| 128 | popa | 
|---|
| 129 | popf | 
|---|
| 130 | ret | 
|---|
| 131 | SOUND_Beep                     ENDP | 
|---|