-
Notifications
You must be signed in to change notification settings - Fork 4
/
929INIT.PAS
827 lines (668 loc) · 20.6 KB
/
929INIT.PAS
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
{
******************************************************************************
Low Level Initialization for Sound Cards with OPTi 82C929 and AD1848K Chipsets
******************************************************************************
Version: 1.21
Date : 20.02.2019
Author : Jan Knipperts
******************************************************************************}
Program OPTI929_AD1848_Driver;
uses opti929,mpu,oplfm,opl4,sbpro,ad1848,
dos,textmode,misc;
type
codecvolumes = record
DACL,
DACR,
AUX1L,
AUX1R,
AUX2L,
AUX2R,
inp,
micgain,
gain : byte;
dmix : boolean;
end;
Freqconfig = record
freq,
bits,
chan : byte;
end;
const
Title : string = 'Optimized MAD16 PRO soundcard initialization Version 1.21';
Copyright : string = ' (c) 2019 by Jan Knipperts';
error : array[1..11] of string =
('ERROR: Timeout. Codec is not responding!',
'ERROR: Configuration file not found! Please run Setup.',
'ERROR: An I/O error occured while reading the configuration file!',
'ERROR: Unsupported WSS I/O address. Please run Setup.',
'ERROR: Invalid IRQ address! Please run Setup.',
'ERROR: Failed to initialize the MPU-401 interface. Please run Setup.',
'ERROR: Faild to initialize the Sound Blaster DSP. Please run Setup.',
'ERROR: Invalid volumes in the configuration file. Please run the Mixer to correct them.',
'ERROR: No compatible CODEC found on your soundcard!',
'ERROR: No compatible Soundcontroller found!',
'ERROR: Faild to initialize the Windows Sound System. Please run setup.');
DSPver : array[1..4] of string = ('1.5','2.1','3.2','4.4');
NumInits = 5;
var
cfg : OPTi929config;
SBFreq,
WSSFreq : Freqconfig;
Volumes : codecvolumes;
v1,v2,d,cmd,fmt,filter : byte;
init,sb,wss,info,forcestereo,
forcemono : boolean;
f : file;
num,z,freq : word;
quiet,mode : boolean;
s,dir,cfgfile : string;
serror : integer;
{=================== Drawing stuff ======================= }
Procedure PrintTitle;
var xc : word;
begin
textcolor(7);
textbackground(0);
writeln('');
write('Ú');
for xc := 2 to 79 do
begin
gotoxy(xc,gety);
write('Ä');
end;
write('¿');
write('³');
gotoxy(40-(length(title) div 2),gety);
write(title);
gotoxy(80,gety);
write('³');
write('³');
gotoxy(40-(length(copyright) div 2),gety);
write(copyright);
gotoxy(80,gety);
write('³');
write('À');
for xc := 2 to 79 do
begin
gotoxy(xc,gety);
write('Ä');
end;
write('Ù');
end;
{====================================== Setup AD1848 ===============}
Procedure SetVolumes;
{Writes the userdefined volumes to the codec}
begin
AD1848_SetVolume(DAC,Left,volumes.dacl);
waitforcodec;
AD1848_SetVolume(DAC,Right,volumes.dacr);
waitforcodec;
AD1848_SetVolume(AUX1,Left,volumes.aux1l);
waitforcodec;
AD1848_SetVolume(AUX1,Right,volumes.aux1r);
waitforcodec;
AD1848_SetVolume(AUX2,Left,volumes.aux2l);
waitforcodec;
AD1848_SetVolume(AUX2,Right,volumes.aux2r);
waitforcodec;
if (AD1848_GetVolume(DAC,Left) <> volumes.dacl) or
(AD1848_GetVolume(AUX1,Right) <> volumes.aux1r) or
(AD1848_GetVolume(AUX2,Left) <> volumes.aux2l) then
begin
writeln('');
writeln(error[8]);
writeln(' ');
halt(1);
end;
if (volumes.inp = LINE) then
begin
SetInput(LINE,LEFTANDRIGHT,volumes.gain,false);
end;
if (volumes.inp = AUX1i) then
begin
SetInput(AUX1i,LEFTANDRIGHT,volumes.gain,false);
end;
if (volumes.inp = POSTMX) then
begin
SetInput(POSTMX,LEFTANDRIGHT,volumes.gain,false);
end;
if (volumes.inp = MIC) then
begin
if volumes.micgain = 1 then
begin
SetInput(MIC,LEFTANDRIGHT,volumes.gain,true);
end
else
begin
SetInput(MIC,LEFTANDRIGHT,volumes.gain,false);
end;
end;
SetDigitalMix(volumes.dmix,volumes.gain);
end;
Procedure Prepare_AD1848_for_SB;
{Configure the codec to a propper format and frequency for Sound Blaster compatibility}
var dummy : byte;
begin
asm
cli
end;
WaitForCodec; {Just to be sure the codec is ready}
case sbfreq.bits of
0: dummy := PCM_U_8BIT;
1: dummy := PCM_COMPL_16BIT;
end;
AD1848_SetOutputFormat(codec_rates[SBFreq.freq+1].freq,
dummy,boolean(sbfreq.chan)); {Set format and frequency}
Setvolumes;
Calibrate_AD1848; {Recalibrate codec o new samplerate}
WaitForCodec; {Wait for the codec to be ready again}
asm
sti
end;
end;
Procedure Prepare_AD1848_for_WSS;
{Sets the codec to a propper format and frequency for WSS output and
performs a full autocalibration of the codec}
var dummy : byte;
begin
asm
cli
end;
WaitForCodec; {Just to be sure the codec is ready}
case wssfreq.bits of {8 or 16 bit sound?}
0: dummy := PCM_U_8BIT;
1: dummy := PCM_COMPL_16BIT;
end;
AD1848_SetOutputFormat(codec_rates[SBFreq.freq+1].freq,
dummy,boolean(wssfreq.chan)); {Set format and frequency}
Setvolumes;
Calibrate_AD1848; {Recalibrate codec o new samplerate}
WaitForCodec; {Wait for the codec to be ready again}
asm
sti
end;
end;
{================================ Configuration Stuff ======================}
Procedure Setcfg;
{Reads the config file, checks settings and set up of some variables}
begin
if not fileexist(cfgfile) then {File not found!}
begin
writeln('');
writeln(error[2]);
writeln('');
halt(1);
end;
fillchar(cfg,sizeof(cfg),0);
assign(f,cfgfile);
reset(f,1);
{$I-}
blockread(f,cfg,sizeof(cfg));
blockread(f,sbfreq,sizeof(freqconfig));
blockread(f,wssfreq,sizeof(freqconfig));
blockread(f,filter,sizeof(filter));
blockread(f,volumes,sizeof(codecvolumes));
{$I+}
if IOResult <> 0 then {Diskerror?}
begin
writeln('');
writeln(error[3]);
close(f);
writeln('');
halt(1);
end;
close(f);
if (cfg.WSSBase <> $530) and
(cfg.WSSBase <> $E80) and
(cfg.WSSBase <> $F40) and
(cfg.WSSBase <> $604) then {Unsupported WS-Port in config file?}
begin
writeln('');
writeln(error[4]);
writeln('');
halt(1);
end;
if (cfg.WSSIRQ <> 7) and
(cfg.WSSIRQ <> 9) and
(cfg.WSSIRQ <> 10) and
(cfg.WSSIRQ <> 11) and
(cfg.WSSIRQ <> $FF) then {Unsupported WSS-IRQ in config file?}
begin
writeln('');
writeln(error[5]);
writeln('');
halt(1);
end;
SBPort := cfg.SBBase;
CODEC.WSSPort := cfg.WSSBase;
CODEC.ADDR := cfg.WSSBase+4;
CODEC.DATA := cfg.WSSBase+5;
CODEC.STATUS := cfg.WSSBase+6;
CODEC.PIO := cfg.WSSBase+7;
end;
{==================================== Main chip detection ==========================}
Procedure DetectCodec;
var sb : boolean;
begin
sb := SBmode;
SetWSSMode(cfg); {set controller to WSS Mode}
Protect_Shadowregs(false); {Enable full access to the codec}
CODEC.WSSPort := cfg.WSSBase;
CODEC.ADDR := cfg.WSSBase+4;
CODEC.DATA := cfg.WSSBase+5;
CODEC.STATUS := cfg.WSSBase+6;
CODEC.PIO := cfg.WSSBase+7;
if not detectAD1848 then
begin
setinitvalues; {if detection failes, try to set default configuration}
if not detectAD1848 then {..and try again}
begin
writeln(error[9]);
writeln('');
halt(1);
end;
end;
if SB then
begin
SetSBMode(cfg); {set controller back to SB Mode}
end;
Protect_Shadowregs(boolean(cfg.shprotect)); {protect shadwregs accordig to config}
end;
Procedure DetectController;
begin
if not detect929 then
begin
writeln(error[10]);
writeln('');
halt(1);
end;
end;
{==================================== Initialization ==========================}
Procedure InitSoundcard;
var x,y,i : byte;
begin
if not quiet then writeln('Sound card initialization:');
{Init OPTi 82C929}
if not quiet then
write('1. Initialize Controller - ');
SetWSSMode(cfg); {...in WSS Mode}
Protect_Shadowregs(false); {Enable full access to the codec}
CODEC.WSSPort := cfg.WSSBase;
CODEC.ADDR := cfg.WSSBase+4;
CODEC.DATA := cfg.WSSBase+5;
CODEC.STATUS := cfg.WSSBase+6;
CODEC.PIO := cfg.WSSBase+7;
if not quiet then writeln('OK');
{Ok, and now let's init the codec...}
if not quiet then write('2. Initialize Codec ');
begin
x := getx;
y := gety;
end;
Waitforcodec; {Wait for codec to be ready...}
if not Init_AD1848 then {Codec initialization failed!}
begin
if not quiet then writeln('- FAILED!');
writeln('');
writeln(error[1]);
writeln('');
halt(1);
end;
MuteDAC(LeftAndRight,true);
for z := 1 to num do {Errata....}
begin
Waitforcodec;
Init_AD1848;
MuteDAC(LeftAndRight,true); {Mute DAC again}
Waitforcodec;
if (quiet = false) and (num <> numinits) then
begin
gotoxy(x,y);
write('(Init. run '+addzero(z)+')');
end;
end;
if (detectWSS) and not timeout then
begin
if not quiet then
begin
gotoxy(x,y);
for i := 1 to 15 do write(' ');
gotoxy(x,y);
writeln('- OK');
end;
end
else
begin
if not quiet then writeln('- FAILED!');
writeln('');
writeln(error[1]);
writeln('');
halt(1);
end;
{Init OPL3/OPL4}
if cfg.opl = 4 then {Do we assume an OPL4?}
begin
if not OPL4_detect then {Yes, but we don't find one...}
begin
cfg.opl := 3; {Set OPL3 instead}
SetWSSMode(cfg); {Reset controller}
end
else
begin
opl4_pcm(false); {Init OPL4 in FM mode}
end;
end;
if DetectOPL3 then {if OPL3 is present..}
begin
InitOPL; {Initialize it..}
ClearOPL; {and mute all channels, clear registers}
end;
if cfg.initmode = 0 then
begin
SB := TRUE;
WSS := FALSE;
end
else
begin
WSS := TRUE;
SB := FALSE;
end;
end;
{========================== Finding our files =================}
Procedure GetPath;
begin
{Looks up its own directory to find the config file}
cfgfile := paramstr(0);
while (cfgfile[Length(cfgfile)] <> '\') and (Length(cfgfile) <> 0) do
Delete(cfgfile,Length(cfgfile),1);
if cfgfile = '' then
cfgfile := FExpand('');
cfgfile := cfgfile+'SOUND.CFG';
end;
{================= Handle command line options ========================}
Function FindOption(lookup : string) : boolean;
var cnt : byte;
s : string;
begin
FindOption := false;
for cnt := 1 to paramcount do
begin
if length(paramstr(cnt)) > length(lookup) then
s := copy(uppercase(paramstr(cnt)),1,length(lookup))
else
s := uppercase(paramstr(cnt));
if s = uppercase(lookup) then
begin
FindOption := true;
cmd := cnt;
break;
end;
end;
end;
{============================= Main program ============================}
begin
GetPath; {Get path to config file}
{Handle commandline:}
if FindOption('/INIT') then INIT := true;
if FindOption('/SB') then SB := true;
if FindOption('/WSS') then WSS := true;
if FindOption('/INFO') then INFO := true;
if FindOption('/Q') then quiet := true;
if FindOption('/S') then forcestereo := true;
if FindOption('/M') then forcemono := true;
num := numinits;
if FindOption('/N') then
begin
s := uppercase(paramstr(cmd));
if s[3] in ['1'..'9'] then
begin
s := copy(uppercase(paramstr(cmd)),3,length(uppercase(paramstr(cmd))));
val(s,num,serror);
if (serror <> 0) or (num > 255) then
begin
num := numinits;
end;
end;
end;
if not quiet then
begin
asm
mov ax,03h {Set 80x25 Textmode}
int 10h
end;
end;
PrintTitle;
if (init = false) and (wss = false) and
(sb = false) and (info = false) and
(forcestereo = false) and (forcemono = false) then
begin
writeln(' This program needs some parameter: 929INIT.EXE <Parameter> {Option} ');
writeln('');
writeln(' Parameters: ');
writeln(' /INIT Initializes the soundcard ');
writeln(' /SB Sets the soundcard to Sound Blaster mode');
writeln(' /WSS Sets the soundcard to Windows Sound System mode ');
writeln(' /INFO Shows the actual configuration of the soundcard');
writeln(' /S, /M Switches between stereo and mono output');
writeln('');
writeln(' Additional options: ');
writeln(' /Q Quiet mode with reduced textoutput');
writeln(' /N[xxx] Number of codec initialization runs (1-255)');
writeln(' (some codecs need more than one run to work properly...)');
writeln('');
writeln(' All options can be combined. For example:');
writeln(' 929INIT.EXE /INIT /INFO /Q /N3');
writeln('');
halt(0);
end;
SetCFG;
if (wss = false) and (sb = false) and (init = false) and (info = false) and
((forcestereo = true) or (forcemono = true)) then
begin
quiet := true;
if sbmode then
begin
sb := true;
if (forcestereo) then sbfreq.freq := 7;
if (forcemono) then sbfreq.freq := 12;
write('Switching Sound Blaster Pro to ');
end
else
begin
wss := true;
write('Switching Windows Sound System to ');
end;
if forcestereo then writeln('Stereo output.');
if forcemono then writeln('Mono output.');
end;
if not quiet then writeln('');
if init then
begin
DetectController;
InitSoundcard;
end
else
begin
DetectController;
DetectCodec;
end;
if wss then
begin
{Override stereo configuration if commandline option says other}
if forcestereo then wssfreq.chan := 1;
if forcemono then wssfreq.chan := 0;
if not quiet then write('Configure controller for WSS mode - ');
SetWSSMode(cfg); {Set OPTi 929 to WSS Mode}
Prepare_AD1848_for_WSS; {Set AD1848 up for WSS}
if detectWSS then {Perform WSS detection}
begin
if not quiet then writeln('OK');
end
else
begin
writeln('');
writeln(error[11]); {Something went wrong...}
writeln('');
halt(1);
end;
if cfg.mpu401 = 1 then {Set up MPU401 when it's enabled}
begin
DATAPORT := cfg.mpubase;
COMDPORT := cfg.mpubase+1;
STATPORT := cfg.mpubase+1;
ResetMPU(0); {First reset MPU to default mode }
xdelay(50); {Wait a bit}
if not ResetMPU(1) then {Try to reset MPU to UART}
begin
writeln('');
writeln(error[6]);
writeln('');
halt(1);
end;
end;
if (quiet=true) and (forcestereo = false) and (forcemono=false) then
writeln('Sound card successfully initialized (WSS mode).');
end;
if sb then
begin
{Override stereo configuration if commandline option says other}
if forcestereo then sbfreq.chan := 1;
if forcemono then sbfreq.chan := 0;
if not quiet then
write('Configure controller for Sound Blaster mode - ');
SetWSSMode(cfg);
SetupWSSPort(cfg);
Prepare_AD1848_for_SB;
Protect_Shadowregs(true);
SetSBMode(cfg); {Set OPTi Controller to SB Mode}
{check for success}
if (DSP_Reset(cfg.SBbase) = true) and (hi(SB_GetDSPVersion) = cfg.SBver) then
begin
if not quiet then writeln('OK');
end
else
begin
writeln('');
writeln(error[7]);
writeln('');
halt(1);
end;
{Cleanup: Reset DSP and set output}
DSP_Reset(cfg.SBBase);
SB_Speaker(false);
SB_ResetMixer;
SB_Setvolume(DAC,left,round((volumes.dacl / 4.28))); {Set volumes again in the emulated SB Mixer}
SB_Setvolume(DAC,right,round((volumes.dacr / 4.28))); {Just to be sure the controler knows about them...}
SB_Setvolume(CD,left,round((volumes.aux1l / 4.28)));
SB_Setvolume(CD,right,round((volumes.aux1r / 4.28)));
SB_Setvolume(FM,left,round((volumes.aux2l / 4.28)));
SB_Setvolume(FM,right,round((volumes.aux2r / 4.28)));
case sbfreq.chan of
0: SB_SetOutput(false,boolean(filter)); {Set Mono output}
1: SB_SetOutput(true,boolean(filter)); {Set Stereo output}
end;
If cfg.sbmix = 0 then SBMixer(false);
if cfg.mpu401 = 1 then {Set up MPU401 if it's enabled in the config}
begin
DATAPORT := cfg.mpubase;
COMDPORT := cfg.mpubase+1;
STATPORT := cfg.mpubase+1;
ResetMPU(0); {First reset MPU to default mode }
xdelay(50); {Wait a bit}
if not ResetMPU(1) then {Try to reset MPU to UART}
begin
writeln('');
writeln(error[6]);
writeln('');
halt(1);
end;
end;
DSP_Reset(cfg.SBBase);
if (quiet=true) and (forcestereo = false) and (forcemono=false) then
writeln('Sound card successfully initialized (Sound Blaster mode).');
end;
if info then
begin
{Get Controller info}
Getcfg(cfg);
if SBMode = false then {Are we in SB or WSS Mode?}
begin
writeln('Controller is in WSS mode:');
writeln('');
writeln('Port : '+hexw(cfg.WSSbase)+'h');
if cfg.WSSirq < $FF then
writeln('IRQ : '+addspace(cfg.WSSirq))
else
writeln('IRQ : Auto');
if cfg.WSSdma < $FF then
writeln('DMA : '+addspace(cfg.WSSdma))
else
writeln('DMA : Disabled');
writeln('');
AD1848_GetOutputFormat(freq,fmt,mode);
writeln('Actual audio output format: ');
str(freq,s);
write(s+' Hz, ');
case fmt of
COMP_U_LAW: write('8 Bit U-law companded');
COMP_A_LAW: write('8 Bit A-law companded');
PCM_U_8BIT: write('8 Bit unsigned PCM');
PCM_COMPL_16BIT: write('16 Bit Twos-Complement PCM');
end;
if mode = true then writeln(', Stereo') else writeln(', Mono');
writeln('');
write('FM : ');
case cfg.opl of
3: writeln('Yamaha OPL3 FM synthesis');
4: writeln('Yamaha OPL4 FM and wavetable synthesis');
end;
write('MPU 401 : ');
if cfg.mpu401 = 1 then writeln('Enabled, Port: '+hexw(cfg.MPUbase)+'h ') else writeln('Disabled');
write('Gameport: ');
if cfg.gpen = 1 then writeln('Enabled') else writeln('Disabled');
writeln('');
end
else
begin
SetWSSMode(cfg); {Switch to WSS Mode for full access to the codec}
writeln('Controller is in Sound Blaster mode.');
writeln('');
writeln('Port : '+hexw(cfg.SBbase)+'h ');
if cfg.SBirq < $FF then
writeln('IRQ : '+addspace(cfg.SBirq))
else
writeln('IRQ : Disabled');
if cfg.SBdma < $FF then
writeln('DMA : '+addspace(cfg.SBdma))
else
writeln('DMA : Disabled');
writeln('DSP : '+dspver[cfg.SBver]);
writeln('');
writeln('Actual audio output format: ');
AD1848_GetOutputFormat(freq,fmt,mode);
str(freq,s);
write(s+' Hz, ');
case fmt of
COMP_U_LAW: write('8 Bit U-law companded');
COMP_A_LAW: write('8 Bit A-law companded');
PCM_U_8BIT: write('8 Bit unsigned PCM');
PCM_COMPL_16BIT: write('16 Bit Twos-Complement PCM');
end;
if mode = true then writeln(', Stereo') else writeln(', Mono');
writeln('');
write('FM : ');
case cfg.opl of
3: writeln('Yamaha OPL3 FM synthesis');
4: writeln('Yamaha OPL4 FM and wavetable synthesis');
end;
write('MPU 401 : ');
if cfg.mpu401 = 1 then writeln('Enabled, Port: '+hexw(cfg.MPUbase)+'h ') else writeln('Disabled');
write('Gameport: ');
if cfg.gpen = 1 then writeln('Enabled') else writeln('Disbaled');
writeln('');
SetSBMode(cfg); {Switch Back to SB}
DSP_Reset(cfg.SBBase); {Reset DSP to be ready}
end;
end;
writeln('');
end.