-
Notifications
You must be signed in to change notification settings - Fork 1
/
TESTTNDY.PAS
1691 lines (1464 loc) · 38.5 KB
/
TESTTNDY.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
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
uses misc,textmode;
const
title : string = 'TNDY / TNDLPT Test utility v0.6 (c) 2019-2020 by Jan Knipperts';
footer : string = 'F1 = Function Test, F2 = Play Melody, ESC = quit to DOS';
footer1 : string = '';
tandyFreq = 3579545;
tandyDivider = tandyFreq/32;
tandyIntDivider= round(tandyDivider);
minfreq = 110;
maxfreq = 11000;
delayval = 80;
{-------------------------------------------------------------------}
{Note frequencies}
R = 0; {Rest = frequency of 0 : silence}
C = 260; {Frequency of middle c }
CC = 277; {Double letter indicates a sharp}
D = 294;
DD = 311;
E = 330;
F = 349;
FF = 370;
G = 392;
GG = 415;
A = 440;
AA = 466;
B = 494;
type
square_generator = record
vol : byte;
freq : integer;
end;
noise_generator = record
vol : byte;
freq : integer;
ntype : byte;
end;
var
p : pointer;
lpt,
keyboardmode : boolean;
xp,yp,
select,
win,
ps,adjust : byte;
key : char;
t1,t2,t3 : square_generator;
t4 : noise_generator;
s,
fbutton,
mbutton : string;
tandyport : word;
data,
status,
ctrl : word;
z,i : word;
Procedure Button(x,y : byte; name : string; pressed : boolean);
var col,c : byte;
begin
if vidseg = $B800 then
begin
if pressed then col := 1 else col := 0;
fastwrite(x,y,0,7,name);
c := 1;
while (name[c] = ' ') and (c <= length(name)) do inc(c);
putchar(x+(c-1),y,name[c],4,7);
for c := x+1 to x+length(name) do fastwrite(c,y+1,col,1, 'ß');
fastwrite(x+length(name),y,col,1, 'Ü');
end
else
begin
fastwrite(x,y,0,7,name);
c := 1;
while (name[c] = ' ') and (c <= length(name)) do inc(c);
putchar(x+(c-1),y,name[c],0,0);
if pressed then
begin
for c := x to x+length(name) do AttrMDA(c,y,false,false,true);
end;
end;
end;
Procedure LPT_Send(b : byte);
assembler;
asm
mov al,b
mov dx,data
out dx,al
mov al,12
mov dx,ctrl
out dx,al
mov dx,status
mov cx,$18
@@1:
in al,dx
test al,$40
loopnz @@1
inc cx
@@2:
in al,dx
test al,$40
loopnz @@2
mov dx,ctrl
mov al,9
out dx,al
end;
procedure tandyLPTSound(voice:byte; tone:word; level:byte);
begin
if tone > 0 then tone := tandyIntDivider div tone;
LPT_Send($80 or (voice*$20) or (tone and $0F));
LPT_Send(tone shr 4);
LPT_Send($90 or (voice*$20) or (level and $0F));
end;
procedure tandyLPTNoise(divider, feedback, level:byte);
var noisebyte : byte;
begin
asm
xor al,al
mov al,11100000b
mov noisebyte,al
end;
if feedback > 0 then noisebyte := noisebyte or 4;
noisebyte := noisebyte or divider;
LPT_Send(noisebyte);
asm
xor al,al
mov al,11110000b
or al,level
mov noisebyte,al
end;
LPT_Send(noisebyte);
end;
Procedure MuteTandyLPT;
begin
LPT_Send($9F);
LPT_Send($BF);
LPT_Send($DF);
LPT_Send($FF);
end;
Procedure MuteTandy;
assembler;
asm
mov dx,TandyPort
mov al,$9F
out dx,al
mov al,$BF
out dx,al
mov al,$DF
out dx,al
mov al,$FF
out dx,al
end;
Procedure MuteVoice(voice : byte);
begin
if LPT then
begin
case voice of
0: LPT_Send($9F);
1: LPT_Send($BF);
2: LPT_Send($DF);
3: LPT_Send($FF);
end;
end
else
begin
case voice of
0: port[TandyPort] := $9F;
1: port[TandyPort] := $BF;
2: port[TandyPort] := $DF;
3: port[TandyPort] := $FF;
end;
end;
end;
Function Init_PP(LPTnum : byte) : Boolean;
begin
tandyport := LPTnum;
data := memw[$40:6+LPTnum*2];
{ECP code fehlt!}
if data = 0 then
begin
lpt := false;
status := 0;
ctrl := 0;
end
else
begin
lpt := true;
status := data + 1;
ctrl := data + 2;
asm {Unlock new version o LPT plug}
mov dx,ctrl
mov al,$E5
out dx,al
end;
xdelay(150);
end;
Init_PP := lpt;
end;
procedure tandySound(voice:byte; tone:word; level:byte);
begin
if tone > 0 then tone := tandyIntDivider div tone;
asm
mov dx,TandyPort
mov cl,voice
mov al,$10
shl al,cl
and al,$60
or al,$80
mov ch,al { save channel for level set }
mov bx,tone
mov ah,bl
and ah,$0F
or al,ah
out dx,al
mov cl,4
shr bx,cl
mov al,bl
out dx,al
mov al,level
and al,$0F
or al,ch
or al,$10
out dx,al
end;
end;
procedure tandyNoise(divider, feedback, level:byte); assembler;
asm
mov ax,bx
mov dx,TandyPort
xor al,al
mov al,11100000b
cmp feedback,0
je @SkipFeedback
or al,4
@SkipFeedback:
or al,divider
out dx,al
xor al,al
mov al,11110000b
or al,level
out dx,al
end;
Procedure PlaySound(voice:byte; tone:word; level:byte);
begin
if lpt then
tandyLPTSound(voice,tone,level)
else
tandySound(voice,tone,level);
end;
Procedure PlaySquarewaves;
begin
if lpt then
begin
if (t1.freq >= minfreq) then
begin
tandyLPTSound(0,t1.freq,t1.vol);
end
else
LPT_Send($9F);
if (t2.freq >= minfreq) then
begin
tandyLPTSound(1,t2.freq,t2.vol);
end
else
LPT_Send($BF);
if (t3.freq >= minfreq) then
begin
tandyLPTSound(2,t3.freq,t3.vol);
end
else
LPT_Send($DF);
end
else
begin
if (t1.freq >= minfreq) then
begin
tandySound(0,t1.freq,t1.vol);
end
else
port[TandyPort] := $9F;
if (t2.freq >= minfreq) then
begin
tandySound(1,t2.freq,t2.vol);
end
else
port[TandyPort] := $BF;
if (t3.freq >= minfreq) then
begin
tandySound(2,t3.freq,t3.vol);
end
else
port[TandyPort] := $DF;
end;
end;
Procedure PlayNoise;
begin
if lpt then
begin
tandyLPTNoise(t4.freq,t4.ntype,t4.vol);
end
else
begin
tandyNoise(t4.freq,t4.ntype,t4.vol);
end;
end;
Procedure Noise(divider, feedback, level:byte);
begin
if lpt then
begin
tandyLPTNoise(divider, feedback, level);
end
else
begin
tandyNoise(divider, feedback, level);
end;
end;
Procedure Mute;
begin
if lpt then
begin
MuteTandyLPT;
tandyLPTNoise(0,0,15);
end
else
begin
MuteTandy;
tandyNoise(0,0,15);
end;
end;
Procedure InitTandySound; {Reset the sound chip}
begin
if lpt then
begin
LPT_Send(1);
xdelay(10);
LPT_Send(9);
xdelay(10);
end
else
begin
port[TandyPort] := 1;
xdelay(10);
port[TandyPort] := 9;
xdelay(10);
end;
Mute;
xdelay(100);
Mute;
end;
Procedure DrawSelector(xp,yp : byte; s : string);
begin
if not keyboardmode then
begin
putchar(xp+9,yp,#24,0,7);
putchar(xp+10,yp,#25,0,7);
end;
fastwrite(xp,yp,15,1,' ');
fastwrite(xp+(4-(length(s) div 2)),yp,15,1,s);
end;
Procedure Mark(x,y,l : byte);
var c : byte;
begin
for c := x to x+(l-1) do
begin
if VidSeg = $B800 then changeattr(c,y,atr(14,4,false))
else
AttrMDA(c,y,true,true,true);
end;
end;
Procedure UnMark(x,y,l : byte);
var c : byte;
begin
for c := x to x+(l-1) do
begin
if VidSeg = $B800 then changeattr(c,y,atr(15,1,false))
else
AttrMDA(c,y,false,false,false);
end;
end;
Procedure Wait_for_Mousebutton;
begin
repeat
Mouse_Read;
while iskeypressed do getkey;
until mouse.b = 0;
key := #0;
{selectitem(select);}
end;
Procedure MarkOption(opt : byte);
begin
if keyboardmode then
begin
UnMark(40,4,4);
UnMark(21,11,8);
UnMark(21,12,8);
UnMark(21,15,8);
UnMark(21,16,8);
UnMark(21,19,8);
UnMark(21,20,8);
UnMark(57,10,8);
UnMark(57,11,8);
UnMark(57,12,8);
case opt of
0: Mark(40,4,4);
1: Mark(21,11,8);
2: Mark(21,12,8);
3: Mark(21,15,8);
4: Mark(21,16,8);
5: Mark(21,19,8);
6: Mark(21,20,8);
7: Mark(57,10,8);
8: Mark(57,11,8);
9: Mark(57,12,8);
end;
end;
end;
Procedure Function_Test;
begin
mouse_hide;
move(ptr(vidseg,0)^,p^,4000); {Move actual screen to buffer}
writeto(ptr(vidseg,0)); {write to video mem}
ShadowScreen; {makes the screen black and white}
window(10,3,70,22,14,1,true);
centeredtext(3,15,' SN76489 chip function test: ');
if tandyport > 3 then
begin
centeredtext(21,15,'Selected port: '+hexw(tandyport)+'h');
end
else
begin
case tandyport of
1: centeredtext(21,15,'Selected port: LPT1');
2: centeredtext(21,15,'Selected port: LPT1');
3: centeredtext(21,15,'Selected port: LPT1');
end;
end;
centeredtext(5,15,'1. Testing sound generators');
InitTandySound;
Mute;
centeredtext(6,14,'Tone generator 1: Playing C-4 (1040 Hz)');
PlaySound(0,C*4,0);
xdelay(500);
MuteVoice(0);
fastwrite(47,6,14,1,'D-4 (1176 Hz)');
PlaySound(0,D*4,0);
xdelay(500);
MuteVoice(0);
fastwrite(47,6,14,1,'E-4 (1320 Hz)');
PlaySound(0,E*4,0);
xdelay(500);
MuteVoice(0);
fastwrite(47,6,14,1,'F-4 (1396 Hz)');
PlaySound(0,F*4,0);
xdelay(500);
MuteVoice(0);
fastwrite(38,6,14,1,' OFF ');
centeredtext(7,14,'Tone generator 2: Playing C-3 (780 Hz)');
PlaySound(1,C*3,0);
xdelay(500);
MuteVoice(1);
fastwrite(47,7,14,1,'D-3 (882 Hz)');
PlaySound(1,D*3,0);
xdelay(500);
MuteVoice(1);
fastwrite(47,7,14,1,'E-3 (990 Hz)');
PlaySound(1,E*3,0);
xdelay(500);
MuteVoice(1);
fastwrite(47,7,14,1,'F-3 (1047 Hz)');
PlaySound(1,F*3,0);
xdelay(500);
MuteVoice(1);
fastwrite(38,7,14,1,' OFF ');
centeredtext(8,14,'Tone generator 3: Playing C-2 (330 Hz)');
PlaySound(2,C*2,0);
xdelay(500);
MuteVoice(2);
fastwrite(47,8,14,1,'D-2 (520 Hz)');
PlaySound(2,D*2,0);
xdelay(500);
MuteVoice(2);
fastwrite(47,8,14,1,'E-2 (588 Hz)');
PlaySound(2,E*2,0);
xdelay(500);
MuteVoice(2);
fastwrite(47,8,14,1,'F-2 (698 Hz)');
PlaySound(2,F*2,0);
xdelay(500);
MuteVoice(2);
fastwrite(38,8,14,1,' OFF ');
xdelay(600);
{ centeredtext(9,14,'Poyphony test (playig a C in different octaves)');}
PlaySound(0,C*3,0);
fastwrite(38,6,14,1,' Playing C-3 (294 Hz)');
xdelay(500);
PlaySound(1,C*4,0);
fastwrite(38,7,14,1,' Playing C-4 (1040 Hz)');
xdelay(500);
PlaySound(2,C*5,0);
fastwrite(38,8,14,1,' Playing C-5 (1300 Hz)');
xdelay(1000);
Mute;
fastwrite(38,6,14,1,' OFF ');
fastwrite(38,7,14,1,' OFF ');
fastwrite(38,8,14,1,' OFF ');
centeredtext(11,15,'2. Testing noise generator');
Mute;
centeredtext(12,14,'Playing white noise at 6991 Hz');
Noise(0, 1, 0);
xdelay(500);
Noise(0, 1, 15);
fastwrite(48,12,14,1,'3496 Hz');
Noise(1, 1, 0);
xdelay(500);
Noise(1, 1, 15);
fastwrite(48,12,14,1,'1748 Hz');
Noise(2, 1, 0);
xdelay(500);
Noise(2, 1, 15);
centeredtext(12,14,'Playing periodic noise at 6991 Hz');
Noise(0, 0, 0);
xdelay(500);
Noise(0, 0, 15);
fastwrite(50,12,14,1,'3496 Hz');
Noise(1, 0, 0);
xdelay(500);
Noise(1, 0, 15);
fastwrite(50,12,14,1,'1748 Hz');
Noise(2, 0, 0);
xdelay(500);
Noise(2, 0, 15);
centeredtext(17,15,'Press any key to continue...');
mouse_show;
while iskeypressed do getkey;
repeat
if keyboardmode = false then Mouse_Read;
until (iskeypressed = true) or
(mouse.b = 1);
while iskeypressed do getkey;
Mute;
key := #0;
mouse_hide;
ViewBuffer(p); {show buffer}
writeto(p);
if not keyboardmode then
begin
mouse_show;
mouse.b := 0;
end;
PlaySquarewaves;
PlayNoise;
end;
Procedure Play_Melody;
const
BeatNote = 4; {Bottom number in Time Signature}
{Handles cut time (2/2), 6/8 etc.}
Tempo = 160; {Number of beats per minute}
Beat = 60000/Tempo; {Duration of 1 beat in millisecs}
{Note durations}
Q = 1 * (BeatNote/4); {Quarter note}
I = 0.5 * (BeatNote/4); {Eighth note}
H = 2 * (BeatNote/4); {Half note}
W = 4 * (BeatNote/4); {Whole note}
S = 0.25 * (BeatNote/4); {Sixteenth note}
DQ = 1.5 * (BeatNote/4); {Dotted quarter}
DI = 0.75 * (BeatNote/4); {Dotted eighth}
DH = 3 * (BeatNote/4); {Dotted half}
DS = 0.375 * (BeatNote/4); {Dotted sixteenth}
Type
IValues = Array [1..9] of Integer;
RValues = Array [1..9] of Real;
Phrase = Record
Lyric : String;
Notes : IValues; {Array of note frequencies}
Octave : IValues; {Array of note octaves}
Rhythm : RValues; {Array of note durations}
end;
Song = Array [1..4] of Phrase;
{Sample song}
Const
RowRow : Song = (
(Lyric : 'Row Row Row Your Boat';
NOTES : (C,C,C,D,E,R,0,0,0);
OCTAVE : (1,1,1,1,1,1,0,0,0);
RHYTHM : (DQ,DQ,Q,I,Q,I,R,0,0)
),
(Lyric : 'Gently down the stream';
NOTES : (E,D,E,F,G,R,0,0,0);
OCTAVE : (1,1,1,1,1,1,0,0,0);
RHYTHM : (Q,I,Q,I,DQ,DQ,0,0,0)
),
(Lyric : 'Merrily merrily merrily merrily';
NOTES : (C,C,G,G,E,E,C,C,0 );
OCTAVE : (2,2,1,1,1,1,1,1,0 );
RHYTHM : (Q,I,Q,I,Q,I,Q,I,0 )
),
(Lyric : 'Life is but a dream.';
NOTES : (G,F,E,D,C,R,0,0,0 );
OCTAVE : (1,1,1,1,1,1,0,0,0 );
RHYTHM : (Q,I,Q,I,H,Q,0,0,0 )
));
var
Voice : byte;
Procedure PlayNote(note, oct : integer; duration : real);
begin
if note > 0 then
PlaySound(voice,note * oct,0) else PlaySound(voice,note * oct,15);
xDelay(Round(beat * duration));
PlaySound(voice,note * oct,15);
xDelay(15);
end;
Procedure PlayPhrase(Notes, Octave : IValues; Rythm : RValues);
Var
index : byte;
numberstr,voicestr : string;
begin
For index := 1 to 9 do
begin
str(round(notes[index] * octave[index]), numberstr);
str(voice, voicestr);
centeredtext(15,14,' ');
centeredtext(15,14,'Playing tone generator '+voicestr+': '+numberstr+' Hz');
PlayNote(notes[index], octave[index], rythm[index]);
end;
end;
Procedure PlaySong(Title : String; Tune : Song);
Var
PhraseCounter : byte;
begin
Voice := 0;
For PhraseCounter := 1 to 4 do
begin
centeredtext(8+PhraseCounter,15,Tune[PhraseCounter].Lyric);
PlayPhrase(Tune[PhraseCounter].Notes,
Tune[PhraseCounter].Octave, Tune[PhraseCounter].Rhythm);
inc(Voice);
if Voice = 3 then Voice := 0;
end;
end;
begin
mouse_hide;
move(ptr(vidseg,0)^,p^,4000); {Move actual screen to buffer}
writeto(ptr(vidseg,0)); {write to video mem}
ShadowScreen; {makes the screen black and white}
window(10,3,70,22,14,1,true);
centeredtext(3,15,' SN76489 chip function test 2: ');
centeredtext(5,14,'You should now hear the melody of');
centeredtext(6,14,'"Row, Row, Row Your Boat"');
centeredtext(7,14,'played on the different tone generators.');
InitTandySound;
Mute;
PlaySong('"Row Row Row Your Boat "', RowRow);
Mute;
centeredtext(18,15,'Press any key to continue...');
mouse_show;
while iskeypressed do getkey;
repeat
if keyboardmode = false then Mouse_Read;
until (iskeypressed = true) or (mouse.b = 1);
while iskeypressed do getkey;
key := #0;
mouse_hide;
ViewBuffer(p); {show buffer}
writeto(p);
if not keyboardmode then
begin
mouse_show;
mouse.b := 0;
end;
PlaySquarewaves;
PlayNoise;
end;
Procedure Control_Options;
begin
if key = #59 then
begin
Function_Test;
end;
if key = #60 then
begin
Play_Melody;
end;
if (keyboardmode = true) then
begin
if (key = #77) then
begin
if (win = 1) and (select < 7) then inc(select);
end;
if (key = #75) then
begin
if (win = 1) and (select > 0) then dec(select);
end;
if (key = #72) then
begin
if select = 0 then
begin
select := 9;
win := 3;
end
else
begin
dec(select);
if select > 6 then win := 3 else win := 2;
end;
MarkOption(select);
ViewBuffer(p);
while iskeypressed do getkey;
key := #0;
end;
if (key = #80) then
begin
if select = 9 then
begin
select := 0;
win := 1;
end
else
begin
inc(select);
if select >= 7 then win := 3 else win := 2;
end;
MarkOption(select);
ViewBuffer(p);
while iskeypressed do getkey;
key := #0;
end;
if key = #9 then
begin
if win = 3 then win := 1
else inc(win);
if win = 1 then
begin
select := 0;
end;
if win = 2 then
begin
select := 1;
end;
if win = 3 then
begin
select := 7;
end;
MarkOption(select);
ViewBuffer(p);
while iskeypressed do getkey;
key := #0;
end;
end;
{Ports}
{'0C0 0E0 1E0 2C0 2E0 LPT1 LPT2 LPT3'}
if ((mouse.b = 1) and ((xp = 47 ) and (yp = 4))) or
((keyboardmode = true) and (select = 0) and
((key = '+') or(key = #32) or (key = #13))) then
begin
fastwrite(26,5,12,1,' ');
Mute;
lpt := false;
if ps < 7 then inc(ps) else ps := 0;
case ps of
0: begin
tandyport := $0C0;
s := '0C0h';
end;
1: begin
tandyport := $0E0;
s := '0E0h';
end;
2: begin
tandyport := $1E0;
s := '1E0h';
end;
3: begin
tandyport := $2C0;
s := '2C0h';
end;
4: begin
tandyport := $2E0;
s := '2E0h';
end;
5: begin
tandyport := 1;
s := 'LPT1';
if not init_PP(1) then
begin
fastwrite(26,5,12,1,'Parallel port LPT1 not found!');
Tandyport := $0C0;
end;
end;
6: begin
tandyport := 2;
s := 'LPT2';
if not init_PP(2) then
begin
fastwrite(26,5,12,1,'Parallel port LPT2 not found!');
Tandyport := $0C0;
end;
end;
7: begin
tandyport := 3;
s := 'LPT3';
if not init_PP(3) then
begin
fastwrite(26,5,12,1,'Parallel port LPT3 not found!');
Tandyport := $0C0;
end;
end;
end;
mouse_hide;
DrawSelector(38,4,s);
MarkOption(select);
ViewBuffer(p);
if not keyboardmode then mouse_show;
InitTandySound;
PlaySquarewaves;
end;
if ((mouse.b = 1) and ((xp = 48 ) and (yp = 4)) or
((keyboardmode = true) and (select = 0) and
(key = '-'))) then
begin
fastwrite(26,5,12,1,' ');
Mute;
lpt := false;
if ps > 0 then dec(ps) else ps := 7;
case ps of
0: begin
tandyport := $0C0;
s := '0C0h';
end;
1: begin
tandyport := $0E0;
s := '0E0h';
end;
2: begin
tandyport := $1E0;
s := '1E0h';
end;
3: begin
tandyport := $2C0;
s := '2C0h';
end;
4: begin
tandyport := $2E0;
s := '2E0h';
end;
5: begin
tandyport := 1;
s := 'LPT1';
if not init_PP(1) then
begin
fastwrite(26,5,12,1,'Parallel port LPT1 not found!');
Tandyport := $0C0;
end;
end;
6: begin
tandyport := 2;
s := 'LPT2';
if not init_PP(2) then
begin
fastwrite(26,5,12,1,'Parallel port LPT2 not found!');
Tandyport := $0C0;
end;
end;
7: begin
tandyport := 3;
s := 'LPT3';
if not init_PP(3) then
begin
fastwrite(26,5,12,1,'Parallel port LPT3 not found!');
Tandyport := $0C0;
end;
end;