Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
134 | diamond | 1 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
2 | * * |
||
3 | * Copyright 2003 VaStaNi * |
||
4 | * vastani@ukr.net * |
||
5 | * >>>- SIMPLY - QUICKLY - SHORTLY -<<< * |
||
6 | * * |
||
7 | * About Player Notes for Speaker PC. * |
||
8 | * ( PLAYNOTE.INC v.1.1 for MENUET OS ) * |
||
9 | * * |
||
10 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
||
11 | |||
12 | --- ATTACH --- |
||
13 | |||
14 | >>> Insert string: include "PLAYNOTE.INC" in list file KERNEL32.INC |
||
15 | ......... |
||
16 | ......... ......... ............................. |
||
17 | ......... ......... ............................. |
||
18 | ......... ......... ............................. |
||
19 | |||
20 | ; sound |
||
21 | |||
22 | include "SB16.INC" ; playback for Sound Blaster 16 |
||
23 | include "PLAYNOTE.INC" ; player Note for Speaker PC |
||
24 | |||
25 | ......... |
||
26 | ......... ......... ............................. |
||
27 | ......... ......... ............................. |
||
28 | |||
29 | |||
30 | |||
31 | >>> Insert line --->>> call playNote --->>> in procedure irq0 |
||
32 | |||
33 | ( listing file SYS32.INC for KERNEL.ASM ) |
||
34 | |||
35 | .... .... |
||
36 | .... .... |
||
37 | .... .... |
||
38 | |||
39 | no_error_in_previous_process: |
||
40 | |||
41 | mov edi,[0x3000] |
||
42 | imul edi,8 |
||
43 | mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b |
||
44 | |||
45 | inc dword [0xfdf0] |
||
46 | |||
47 | mov eax,[0xfdf0] |
||
48 | |||
49 | call playNote ; <<<--- INSERT THIS LINE !!!!!!!!!! |
||
50 | |||
51 | cmp eax,[next_usage_update] |
||
52 | jb nocounter |
||
53 | add eax,100 |
||
54 | mov [next_usage_update],eax |
||
55 | call updatecputimes |
||
56 | |||
57 | nocounter: |
||
58 | .... .... |
||
59 | .... .... |
||
60 | .... .... |
||
61 | |||
62 | |||
63 | |||
64 | >>> file SB16.INC have this label... |
||
65 | .... .... |
||
66 | .... .... |
||
67 | .... .... |
||
68 | |||
69 | no_SB16_data_format: |
||
70 | |||
71 | ret |
||
72 | |||
73 | >>> I suggest add this code for subfunction #55 function #55 OS (player notes) |
||
74 | .... .... |
||
75 | .... .... |
||
76 | .... .... |
||
77 | |||
78 | no_SB16_data_format: |
||
79 | cmp eax, edi ; this is subfunction #55 ? |
||
80 | jne retFunc55 ; if no then return. |
||
81 | movzx eax, byte [countDelayNote] |
||
82 | or al, al ; player is busy ? |
||
83 | jnz retFunc55 ; return counter delay Note |
||
84 | mov eax, [0x3010] |
||
85 | mov eax, [eax+0x10] ; address application im memory |
||
86 | add eax, edx ; add offset Delay-Note string |
||
87 | mov [memAdrNote], eax |
||
88 | xor eax, eax ; Ok! EAX = 0 |
||
89 | retFunc55: |
||
90 | mov [esp+36], eax ; return value EAX for application |
||
91 | ret |
||
92 | |||
93 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
||
94 | |||
95 | --- USE --- |
||
96 | |||
97 | >>> Example use in your programs: |
||
98 | .... .... |
||
99 | .... .... |
||
100 | .... .... |
||
101 | mov eax, 55 ; OS function #55 |
||
102 | mov ebx, eax ; EBX = 55 for subfunction Play Note |
||
103 | mov esi, MyMusic_1 ; ESI = head string Delay-Note code |
||
104 | int 0x40 ; start play |
||
105 | .... .... |
||
106 | .... .... |
||
107 | .... .... |
||
108 | |||
109 | |||
110 | >>> Very simply OS use. Only put dword adress head string in [memAdrNote] |
||
111 | |||
112 | .... .... |
||
113 | mov [memAdrNote], dword MyMusic_1 ; IRQ0 -> start play!!! |
||
114 | .... .... |
||
115 | |||
116 | !!! Example OS use for send: error tone, ring signal, disconnect hardware... |
||
117 | !!! Saund Card may be OFF, but Speaker PC always IS ON !!! |
||
118 | |||
119 | |||
120 | ..... .. .. |
||
121 | ..... .. .. |
||
122 | MyMusic_1 db .., .., .., .., .., 0 ; string Delay-Note code for MUSIC |
||
123 | ... .. .. |
||
124 | ...... .. .. |
||
125 | |||
126 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
||
127 | |||
128 | --- CODE DELAY & NOTEs --- |
||
129 | |||
130 | >>> Format Delay-Note string: |
||
131 | |||
132 | 1. Free style play Tone |
||
133 | |||
134 | db 1..0x80 ; !!! only (1..0x80) byte for Delay Tone |
||
135 | db 1..0xFF ; lower byte (counter for period oscillate) |
||
136 | db 1..0xFF ; upper byte (counter for period oscillate) |
||
137 | .. .. \ |
||
138 | .. .. > 3 bytes for 1 TONE !!! |
||
139 | .. .. / |
||
140 | db 0 ; THE END Play! |
||
141 | |||
142 | 2. Musical style play Note |
||
143 | |||
144 | db 0x81..0xFE ; !!! 0x80 + byte (1..0x7E) for Delay Note |
||
145 | db 1..0xFF ; PACK CODE (number Note & number Octave) |
||
146 | .. .. \ |
||
147 | .. .. / 2 bytes for 1 Note in 1 Octave !!! |
||
148 | db 0 ; THE END Play! |
||
149 | |||
150 | |||
151 | |||
152 | -= DELAY CODE =- |
||
153 | |||
154 | 1 ͻ 2 ͻ |
||
155 | ⥫쭮⨳ DELAY NOTE DELAY DELAY DELAY |
||
156 | mSec IRQ 0 CODE CODE |
||
157 | |
||
158 | 楫 2000 0xC8 absent |
||
159 | Ĵ ĶĶ |
||
160 | 1/2 1000 0x64 0xE4 |
||
161 | Ĵ ĶĶ |
||
162 | 1/4 500 0x32 0xB2 |
||
163 | Ĵ 10 ĶĶ |
||
164 | 1/8 250 mSec 0x19 0x99 |
||
165 | Ĵ ĶĶ |
||
166 | 1/16 125 0xC 0x8C |
||
167 | Ĵ ĶĶ |
||
168 | 1/32 62.5 6 0x86 |
||
169 | Ĵ ĶĶ |
||
170 | 1/64 31.25 3 0x83 |
||
171 | ͼͼ |
||
172 | |||
173 | |||
174 | -= PACK CODE =- |
||
175 | |||
176 | !!!!! IF PACK CODE = 0xFF THEN PAUSE = DELAY CODE !!!!! |
||
177 | |||
178 | ͻ ͻ |
||
179 | number code upper CODE typenumberlower CODE |
||
180 | OCTAVEnumberBit7..Bit4 NOTE NOTE Bit3..Bit0 |
||
181 | |
||
182 | ப⠢ -3 0 0000 C 1 0001 |
||
183 | Ķ Ķ |
||
184 | -2 1 0001 C# 2 0010 |
||
185 | Ķ Ķ |
||
186 | -1 2 0010 D 3 0011 |
||
187 | ĺĶ Ķ |
||
188 | ࢠ 1 3 0011 D# 4 0100 |
||
189 | Ķ Ķ |
||
190 | 2 4 0100 E 5 0101 |
||
191 | ĺĶ Ķ |
||
192 | 3 5 0101 F 6 0110 |
||
193 | Ķ Ķ |
||
194 | ⢥ 4 6 0110 F# 7 0111 |
||
195 | ͼ Ķ |
||
196 | G 8 1000 |
||
197 | Ķ |
||
198 | G# 9 1001 |
||
199 | Ķ |
||
200 | A 10 1010 |
||
201 | Ķ |
||
202 | A# 11 1011 |
||
203 | Ķ |
||
204 | B 12 1100 |
||
205 | ͼ |
||
206 | |||
207 | PACK CODE = (number Note) AND ((code number Octave) SHL 4) |
||
208 | or |
||
209 | PACK CODE = (number Note) AND ((code number Octave) * 16) |
||
210 | |||
211 | |||
212 | -= PERIOD OSCILLATE =- |
||
213 | |||
214 | counter = 1193180 / FREQUENCY; |
||
215 | (WORD) (sound Hz) |
||
216 | |||
217 | ͻ |
||
218 | number code typenumberfrequency PACK |
||
219 | OCTAVEnumber 1 NOTE NOTE sound Hz CODE |
||
220 | |
||
221 | C 1 523,251 -- 0x31 |
||
222 | | Ķ |
||
223 | C# 2 554,365 --|-- 0x32 |
||
224 | | | Ķ |
||
225 | D 3 587,33 | | 0x33 |
||
226 | | | Ķ |
||
227 | D# 4 622,254 | | 0x34 |
||
228 | | | Ķ |
||
229 | E 5 659,255 | | 0x35 |
||
230 | | | Ķ |
||
231 | F 6 698,456 | | 0x36 |
||
232 | ࢠ 1 3 | | Ķ |
||
233 | ( first F# 7 739,989 | | 0x37 |
||
234 | octave ) | | Ķ |
||
235 | G 8 783,991 0x38 |
||
236 | x 2 Ķ |
||
237 | G# 9 830,609 0x39 |
||
238 | | | Ķ |
||
239 | A 10 880 | | 0x3A |
||
240 | | | Ķ |
||
241 | A# 11 932,328 | | 0x3B |
||
242 | | | Ķ |
||
243 | B 12 987,767 | | 0x3C |
||
244 | | | |
||
245 | 2 4 1 1046,502 <- | 0x41 |
||
246 | ...... .. .. ... .. .. .... ... <---- |
||
247 | |||
248 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
||
249 | |||
250 | --- EXAMPLE MUSIC --- |
||
251 | |||
252 | ਬ 㧨 ⠬ . " 砣..." |
||
253 | 䨫 "᪨ " |
||
254 | MyMusic_1: |
||
255 | db 0xe4,0x35, 0x99,0x33, 0x99,0x31, 0x99,0x33, 0xe4,0x35, 0x99,0x35, 0x99,0x36 |
||
256 | db 0x99,0x38, 0x99,0x3a, 0xe4,0x36, 0xe4,0x36, 0xb2,0xff, 0xe4,0x33, 0x99,0x31 |
||
257 | db 0x99,0x2c, 0x99,0x31, 0xe4,0x33, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x35 |
||
258 | db 0xe4,0x35, 0xb2,0xff, 0x99,0x35, 0x99,0x36, 0xe4,0x33, 0x99,0x35, 0x99,0x36 |
||
259 | db 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x39 |
||
260 | db 0xe4,0x39, 0xb2,0xff, 0x99,0x35, 0x99,0x36, 0xe4,0x33, 0x99,0x35, 0x99,0x36 |
||
261 | db 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x35 |
||
262 | db 0xe4,0x35, 0 |
||
263 | |||
264 | |||
265 | MyMusic_2: |
||
266 | db 0x90,0x31, 0x90,0x33, 0x90,0x35, 0x90,0x36, 0xA0,0xFF, 0xA0,0x06, 0x90,0xFF |
||
267 | db 0xA0,0x06, 0x90,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37, 0x90,0x38, 0xA0,0xFF |
||
268 | db 0xA0,0x18, 0x90,0xFF, 0xA0,0x18, 0x90,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37 |
||
269 | db 0x90,0x38, 0xA0,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37, 0x90,0x38, 0xA0,0xFF |
||
270 | db 0x90,0x31, 0x90,0x33, 0x90,0x35, 0x90,0x36, 0xA0,0xFF, 0xA0,0x16, 0x90,0xFF |
||
271 | db 0xA0,0x16, 0 |
||
272 | |||
273 | |||
274 | MyMusic_3: |
||
275 | db 0x99,0x31, 0xB2,0x36, 0x99,0x3A, 0xB2,0x36, 0x99,0x33, 0xB2,0x28, 0xBC,0x38 |
||
276 | db 0 |
||
277 | |||
278 | <<<<<<< >>>>>>> |
||
279 | |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> !GOOD LUCK! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| |
||
280 | <<<<<<< >>>>>>>><><<><<<><<<<><<<<<><<<<<<>| |
||
281 | |||
282 | |||
283 | |||
284 | |||
285 | |||
286 | |||
287 | |||
288 | |||
289 | |||
290 | |||
291 | |||
292 | |||
293 |