-
Notifications
You must be signed in to change notification settings - Fork 57
/
JM_SB.ASM
1176 lines (1175 loc) · 20.8 KB
/
JM_SB.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; Hovertank 3-D Source Code
; Copyright (C) 1993-2014 Flat Rock Software
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License along
; with this program; if not, write to the Free Software Foundation, Inc.,
; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ifndef ??version
?debug macro
endm
publicdll macro name
public name
endm
$comm macro name,dist,size,count
comm dist name:BYTE:count*size
endm
else
$comm macro name,dist,size,count
comm dist name[size]:BYTE:count
endm
endif
?debug S "jm_sb.c"
?debug C E9573E9E16076A6D5F73622E63
?debug C E900104D1613433A5C42435C494E434C5544455C646F732E68
?debug C E9DB749D16076A6D5F73622E68
?debug C E978749D16046A6D2E68
_TEXT segment byte public 'CODE'
_TEXT ends
DGROUP group _DATA,_BSS
assume cs:_TEXT,ds:DGROUP
_DATA segment word public 'DATA'
d@ label byte
d@w label word
_DATA ends
_BSS segment word public 'BSS'
b@ label byte
b@w label word
_BSS ends
_DATA segment word public 'DATA'
sbSamplePlaying label word
db 0
db 0
sbOldIntMask label byte
db 255
sbLocation label word
db 255
db 255
sbInterrupt label word
db 7
db 0
sbIntVec label word
db 15
db 0
sbIntVectors label word
db 255
db 255
db 255
db 255
db 10
db 0
db 11
db 0
db 255
db 255
db 13
db 0
db 255
db 255
db 15
db 0
_DATA ends
_TEXT segment byte public 'CODE'
;
; static void
;
assume cs:_TEXT
jmDelay proc near
push bp
mov bp,sp
push si
push di
mov di,word ptr [bp+4]
jmp short @1@122
@1@50:
;
; jmDelay(int usec)
; {
; // DEBUG - use real timing routines
; int i;
;
; while (usec--)
;
xor si,si
jmp short @1@98
@1@74:
inc si
@1@98:
cmp si,1000
jl short @1@74
@1@122:
mov ax,di
dec di
or ax,ax
jne short @1@50
;
; for (i = 0;i < 1000;i++)
; ;
;
pop di
pop si
pop bp
ret
jmDelay endp
;
; static longword
;
assume cs:_TEXT
jmPlaySeg proc near
push bp
mov bp,sp
sub sp,10
;
; jmPlaySeg(byte huge *data,longword length)
; {
; unsigned datapage;
; longword dataofs,uselen;
;
;
mov ax,word ptr [bp+10]
mov dx,word ptr [bp+8]
mov word ptr [bp-8],ax
mov word ptr [bp-10],dx
;
; uselen = length;
;
mov ax,word ptr [bp+6]
mov cl,12
shr ax,cl
mov word ptr [bp-2],ax
;
; datapage = FP_SEG(data) >> 12;
;
mov ax,word ptr [bp+6]
and ax,4095
mov cl,4
shl ax,cl
add ax,word ptr [bp+4]
mov word ptr [bp-4],0
mov word ptr [bp-6],ax
;
; dataofs = ( (FP_SEG(data)&0xfff)<<4 ) + FP_OFF(data);
;
cmp word ptr [bp-4],1
jb short @2@122
jne short @2@98
cmp word ptr [bp-6],0
jb short @2@122
@2@98:
;
; if (dataofs>=0x10000)
; {
;
inc word ptr [bp-2]
;
; datapage++;
;
sub word ptr [bp-6],0
sbb word ptr [bp-4],1
@2@122:
;
; dataofs-=0x10000;
; }
;
;
mov ax,word ptr [bp-4]
mov dx,word ptr [bp-6]
add dx,word ptr [bp-10]
adc ax,word ptr [bp-8]
cmp ax,1
jb short @2@218
ja short @2@194
or dx,dx
jbe short @2@218
@2@194:
;
; if (dataofs + uselen > 0x10000)
;
mov ax,1
xor dx,dx
sub dx,word ptr [bp-6]
sbb ax,word ptr [bp-4]
mov word ptr [bp-8],ax
mov word ptr [bp-10],dx
@2@218:
;
; uselen = 0x10000 - dataofs;
;
;
sub word ptr [bp-10],1
sbb word ptr [bp-8],0
;
; uselen--; // DEBUG
;
; // Program the DMA controller
;
mov dx,10
mov al,5
out dx,al
;
; outportb(0x0a,5); // Mask off channel 1 DMA
;
mov dx,12
mov al,0
out dx,al
;
; outportb(0x0c,0); // Clear byte ptr F/F to lower byte
;
mov dx,11
mov al,73
out dx,al
;
; outportb(0x0b,0x49); // Set transfer mode for D/A conv
;
mov dx,2
mov al,byte ptr [bp-6]
out dx,al
;
; outportb(0x02,(byte)dataofs); // Give LSB of address
;
mov dx,word ptr [bp-4]
mov ax,word ptr [bp-6]
mov cl,8
call near ptr N_LXURSH@
mov dx,2
out dx,al
;
; outportb(0x02,(byte)(dataofs >> 8)); // Give MSB of address
;
mov dx,131
mov al,byte ptr [bp-2]
out dx,al
;
; outportb(0x83,(byte)datapage); // Give page of address
;
mov dx,3
mov al,byte ptr [bp-10]
out dx,al
;
; outportb(0x03,(byte)uselen); // Give LSB of length
;
mov dx,word ptr [bp-8]
mov ax,word ptr [bp-10]
mov cl,8
call near ptr N_LXURSH@
mov dx,3
out dx,al
;
; outportb(0x03,(byte)(uselen >> 8)); // Give MSB of length
;
mov dx,10
mov al,1
out dx,al
jmp short @2@242
@2@242:
;
; outportb(0x0a,1); // Turn on channel 1 DMA
;
; // Start playing the thing
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
in al,dx
mov ah,0
test ax,128
jne short @2@242
;
; sbWriteDelay();
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
mov al,20
out dx,al
jmp short @2@290
@2@290:
;
; sbOut(sbWriteCmd,0x14);
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
in al,dx
mov ah,0
test ax,128
jne short @2@290
;
; sbWriteDelay();
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
mov al,byte ptr [bp-10]
out dx,al
jmp short @2@338
@2@338:
;
; sbOut(sbWriteData,(byte)uselen);
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
in al,dx
mov ah,0
test ax,128
jne short @2@338
;
; sbWriteDelay();
;
mov dx,word ptr [bp-8]
mov ax,word ptr [bp-10]
mov cl,8
call near ptr N_LXURSH@
mov dx,word ptr DGROUP:sbLocation
add dx,524
out dx,al
;
; sbOut(sbWriteData,(byte)(uselen >> 8));
;
;
add word ptr [bp-10],1
mov ax,word ptr [bp-10]
adc word ptr [bp-8],0
mov dx,word ptr [bp-8]
jmp short @2@386
@2@386:
;
; return(++uselen);
;
mov sp,bp
pop bp
ret
jmPlaySeg endp
;
; void interrupt
;
assume cs:_TEXT
_jmSBService proc far
push ax
push bx
push cx
push dx
push es
push ds
push si
push di
push bp
mov bp,DGROUP
mov ds,bp
mov bp,sp
sub sp,4
;
; jmSBService(void)
; {
; longword used;
;
;
mov dx,word ptr DGROUP:sbLocation
add dx,526
in al,dx
;
; sbIn(sbDataAvail);
;
mov dx,32
mov al,32
out dx,al
;
; outportb(0x20,0x20);
;
;
xor cx,cx
xor bx,bx
mov dx,word ptr DGROUP:sbNextSegPtr+2
mov ax,word ptr DGROUP:sbNextSegPtr
call near ptr N_PCMP@
je short @3@194
;
; if (sbNextSegPtr)
; {
;
push word ptr DGROUP:sbNextSegLen+2
push word ptr DGROUP:sbNextSegLen
push word ptr DGROUP:sbNextSegPtr+2
push word ptr DGROUP:sbNextSegPtr
call near ptr jmPlaySeg
add sp,8
mov word ptr [bp-2],dx
mov word ptr [bp-4],ax
;
; used = jmPlaySeg(sbNextSegPtr,sbNextSegLen);
;
mov ax,word ptr DGROUP:sbNextSegLen+2
mov dx,word ptr DGROUP:sbNextSegLen
cmp ax,word ptr [bp-2]
ja short @3@146
jne short @3@122
cmp dx,word ptr [bp-4]
ja short @3@146
@3@122:
;
; if (sbNextSegLen <= used)
;
mov word ptr DGROUP:sbNextSegPtr+2,0
mov word ptr DGROUP:sbNextSegPtr,0
jmp short @3@170
@3@146:
;
; sbNextSegPtr = nil;
; else
; {
;
mov cx,word ptr [bp-2]
mov bx,word ptr [bp-4]
mov dx,ds
mov ax,offset DGROUP:sbNextSegPtr
call near ptr N_PADA@
;
; sbNextSegPtr += used;
;
mov ax,word ptr [bp-2]
mov dx,word ptr [bp-4]
sub word ptr DGROUP:sbNextSegLen,dx
sbb word ptr DGROUP:sbNextSegLen+2,ax
@3@170:
;
; sbNextSegLen -= used;
; }
;
jmp short @3@218
@3@194:
;
; }
; else
;
call near ptr _jmStopSample
@3@218:
;
; jmStopSample();
;
mov sp,bp
pop bp
pop di
pop si
pop ds
pop es
pop dx
pop cx
pop bx
pop ax
iret
_jmSBService endp
;
; void
;
assume cs:_TEXT
_jmPlaySample proc near
push bp
mov bp,sp
sub sp,24
push si
mov si,word ptr [bp+4]
;
; jmPlaySample(sound)
; int sound;
; {
; byte huge *data,
; timevalue;
; longword used;
; SampledSound sample;
;
;
call near ptr _jmStopSample
;
; jmStopSample();
;
;
dec si
lea ax,word ptr [bp-24]
push ss
push ax
mov ax,si
cwd
push ax
push dx
xor dx,dx
mov ax,14
pop cx
pop bx
call near ptr N_LXMUL@
push ax
push dx
mov dx,word ptr DGROUP:sbSamples+2
mov ax,word ptr DGROUP:sbSamples
pop cx
pop bx
call near ptr N_PADD@
push dx
push ax
mov cx,14
call near ptr N_SCOPY@
;
; sample = sbSamples[--sound];
;
;
mov dx,word ptr DGROUP:sbSamples+2
mov ax,word ptr DGROUP:sbSamples
mov cx,word ptr [bp-22]
mov bx,word ptr [bp-24]
call near ptr N_PADD@
mov word ptr [bp-2],dx
mov word ptr [bp-4],ax
;
; data = ((byte huge *)sbSamples) + sample.offset;
;
push word ptr [bp-14]
push word ptr [bp-16]
mov ax,15
mov dx,16960
push ax
push dx
call near ptr N_LUDIV@
mov dl,0
sub dl,al
mov byte ptr [bp-5],dl
jmp short @4@50
@4@50:
;
; timevalue = 256 - (1000000 / sample.hertz);
;
; // printf("sample #%d ",sound);
; // printf("%ld bytes, %ldHz, tc=%d\n",sample.length,sample.hertz,timevalue);
;
; // printf("setting time constant\n");
; // Set the SoundBlaster DAC time constant
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
in al,dx
mov ah,0
test ax,128
jne short @4@50
;
; sbWriteDelay();
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
mov al,64
out dx,al
jmp short @4@98
@4@98:
;
; sbOut(sbWriteCmd,0x40);
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
in al,dx
mov ah,0
test ax,128
jne short @4@98
;
; sbWriteDelay();
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
mov al,byte ptr [bp-5]
out dx,al
;
; sbOut(sbWriteData,timevalue);
;
;
push word ptr [bp-18]
push word ptr [bp-20]
push word ptr [bp-2]
push word ptr [bp-4]
call near ptr jmPlaySeg
add sp,8
mov word ptr [bp-8],dx
mov word ptr [bp-10],ax
;
; used = jmPlaySeg(data,sample.length);
;
mov ax,word ptr [bp-18]
mov dx,word ptr [bp-20]
cmp ax,word ptr [bp-8]
ja short @4@218
jne short @4@194
cmp dx,word ptr [bp-10]
ja short @4@218
@4@194:
;
; if (sample.length <= used)
;
mov word ptr DGROUP:sbNextSegPtr+2,0
mov word ptr DGROUP:sbNextSegPtr,0
jmp short @4@242
@4@218:
;
; sbNextSegPtr = nil;
; else
; {
;
mov dx,word ptr [bp-2]
mov ax,word ptr [bp-4]
mov cx,word ptr [bp-8]
mov bx,word ptr [bp-10]
call near ptr N_PADD@
mov word ptr DGROUP:sbNextSegPtr+2,dx
mov word ptr DGROUP:sbNextSegPtr,ax
;
; sbNextSegPtr = data + used;
;
mov ax,word ptr [bp-18]
mov dx,word ptr [bp-20]
sub dx,word ptr [bp-10]
sbb ax,word ptr [bp-8]
mov word ptr DGROUP:sbNextSegLen+2,ax
mov word ptr DGROUP:sbNextSegLen,dx
@4@242:
;
; sbNextSegLen = sample.length - used;
; }
;
; // printf("enabling SB irq #%d\n",sbInterrupt);
; // Save old interrupt status and unmask ours
;
mov dx,33
in al,dx
mov byte ptr DGROUP:sbOldIntMask,al
;
; sbOldIntMask = inportb(0x21);
;
mov al,1
mov cl,byte ptr DGROUP:sbInterrupt
shl al,cl
not al
push ax
mov al,byte ptr DGROUP:sbOldIntMask
pop dx
and al,dl
mov dx,33
out dx,al
jmp short @4@266
@4@266:
;
; outportb(0x21,sbOldIntMask & ~(1 << sbInterrupt));
;
; // printf("enabling DSP DMA request\n");
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
in al,dx
mov ah,0
test ax,128
jne short @4@266
;
; sbWriteDelay();
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
mov al,212
out dx,al
;
; sbOut(sbWriteCmd,0xd4); // Make sure DSP DMA is enabled
;
; // printf("sound should be playing\n");
;
mov word ptr DGROUP:sbSamplePlaying,1
;
; sbSamplePlaying = true;
;
pop si
mov sp,bp
pop bp
ret
_jmPlaySample endp
;
; void
;
assume cs:_TEXT
_jmStopSample proc near
push bp
mov bp,sp
;
; jmStopSample(void)
; {
; byte is;
;
;
cmp word ptr DGROUP:sbSamplePlaying,0
je short @5@194
jmp short @5@74
@5@74:
;
; if (sbSamplePlaying)
; {
; // printf("turning off DSP DMA\n");
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
in al,dx
mov ah,0
test ax,128
jne short @5@74
;
; sbWriteDelay();
;
mov dx,word ptr DGROUP:sbLocation
add dx,524
mov al,208
out dx,al
;
; sbOut(sbWriteCmd,0xd0); // Turn off DSP DMA
;
; // printf("restoring interrupt\n");
;
mov dx,33
in al,dx
mov bl,al
;
; is = inportb(0x21); // Restore interrupt mask bit
;
mov ax,1
mov cl,byte ptr DGROUP:sbInterrupt
shl ax,cl
mov dl,byte ptr DGROUP:sbOldIntMask
mov dh,0
test ax,dx
je short @5@146
;
; if (sbOldIntMask & (1 << sbInterrupt))
;
mov al,1
mov cl,byte ptr DGROUP:sbInterrupt
shl al,cl
or bl,al
jmp short @5@170
@5@146:
;
; is |= (1 << sbInterrupt);
; else
;
mov al,1
mov cl,byte ptr DGROUP:sbInterrupt
shl al,cl
not al
and bl,al
@5@170:
;
; is &= ~(1 << sbInterrupt);
;
mov dx,33
mov al,bl
out dx,al
;
; outportb(0x21,is);
;
;
;
mov word ptr DGROUP:sbSamplePlaying,0
@5@194:
;
; sbSamplePlaying = false;
; }
;
pop bp
ret
_jmStopSample endp
;
; static boolean
;
assume cs:_TEXT
jmCheckSB proc near
push bp
mov bp,sp
push si
;
; jmCheckSB(int port)
; {
; int i;
;
;
mov ax,word ptr [bp+4]
mov cl,4
shl ax,cl
mov word ptr DGROUP:sbLocation,ax
;
; sbLocation = port << 4; // Initialize stuff for later use
;
;
mov dx,word ptr DGROUP:sbLocation
add dx,518
mov al,1
out dx,al
;
; sbOut(sbReset,true); // Reset the SoundBlaster DSP
;
mov ax,4
push ax
call near ptr jmDelay
pop cx
;
; jmDelay(4); // Wait 4usec
;
mov dx,word ptr DGROUP:sbLocation
add dx,518
mov al,0
out dx,al
;
; sbOut(sbReset,false); // Turn off sb DSP reset
;
mov ax,100
push ax
call near ptr jmDelay
pop cx
;
; jmDelay(100); // Wait 100usec
;
xor si,si
jmp short @6@194
@6@50:
;
; for (i = 0;i < 100;i++)
; {
;
mov dx,word ptr DGROUP:sbLocation
add dx,526
in al,dx
test al,128
je short @6@170
;
; if (sbIn(sbDataAvail) & 0x80) // If data is available...
; {
;
mov dx,word ptr DGROUP:sbLocation
add dx,522
in al,dx
cmp al,170
jne short @6@146
;
; if (sbIn(sbReadData) == 0xaa) // If it matches correct value
;
mov ax,1
jmp short @6@242
jmp short @6@170
@6@146:
;
; return(true);
; else
; {
;
mov word ptr DGROUP:sbLocation,65535
;
; sbLocation = -1; // Otherwise not a SoundBlaster
;
xor ax,ax
jmp short @6@242
@6@170:
inc si
@6@194:
cmp si,100
jl short @6@50
;
; return(false);
; }
; }
; }
;
mov word ptr DGROUP:sbLocation,65535
;
; sbLocation = -1; // Retry count exceeded - fail
;
xor ax,ax
jmp short @6@242
@6@242:
;
; return(false);
;
pop si
pop bp
ret
jmCheckSB endp
;
; boolean
;
assume cs:_TEXT
_jmDetectSoundBlaster proc near
push bp
mov bp,sp
push si
push di
mov si,word ptr [bp+4]
;
; jmDetectSoundBlaster(int port)
; {
; int i;
;
;
or si,si
jne short @7@74
;
; if (port == 0) // If user specifies default address, use 2
;
mov si,2
@7@74:
;
; port = 2;
;
cmp si,65535
jne short @7@266
;
; if (port == -1)
; {
;
mov di,1
jmp short @7@194
@7@122:
;
; for (i = 1;i <= 6;i++) // Scan through possible SB locations
; {
;
push di
call near ptr jmCheckSB
pop cx
or ax,ax
je short @7@170
;
; if (jmCheckSB(i)) // If found at this address,
;
mov ax,1
jmp short @7@290
@7@170:
inc di
@7@194:
cmp di,6
jle short @7@122
;
; return(true); // return success
; }
;
xor ax,ax
jmp short @7@290
;
; return(false); // All addresses failed, return failure
;
jmp short @7@290
@7@266:
;
; }
; else
;
push si
call near ptr jmCheckSB
pop cx
jmp short @7@290
@7@290:
;
; return(jmCheckSB(port)); // User specified address or default
;
pop di
pop si
pop bp
ret
_jmDetectSoundBlaster endp
;
; void
;
assume cs:_TEXT
_jmSetSBInterrupt proc near
push bp
mov bp,sp
;
; jmSetSBInterrupt(int num)
; {
;
mov ax,word ptr [bp+4]
mov word ptr DGROUP:sbInterrupt,ax
;
; sbInterrupt = num;
;
mov bx,word ptr DGROUP:sbInterrupt
shl bx,1
mov ax,word ptr DGROUP:sbIntVectors[bx]
mov word ptr DGROUP:sbIntVec,ax
;
; sbIntVec = sbIntVectors[sbInterrupt];