-
Notifications
You must be signed in to change notification settings - Fork 1
/
MENU.PAS
1374 lines (1113 loc) · 35 KB
/
MENU.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
{$G-,N-,E-}
{**************************************************************
Menu.pas - Procedures for displaying the menus
- Control of additional options and configurations
Author: Jan Knipperts
Program: TNDY-Tracker
Version: 1.18a
- added misc configuration
- support for new TNDYLPT
- Updated message editor to new format
- improved screen buffering
- Some clean up
- Adopted code to latest version of textmode-unit
- Added better support of Monochrome graphics
- Removed swap tracks menu because of new copy/paste functions
- Removed misc config as it is no longer needed
- fixed a little bug in the message editor
- fixed some typos
*******************************************************************}
Unit Menu;
interface
uses global,PIT,tndy,keyboard,textmode;
Procedure Mark(x,y,l : byte);
Procedure UnMark(x,y,l,col : byte);
Procedure DrawMenu(mnr : byte);
Procedure Edit_Message;
Procedure Timing_Config;
Procedure Output_Config;
Procedure SND_Import_Config;
Procedure MOD_Import_Config;
Procedure Transpose_menu(tracknum : byte);
const
Menu_Title : array[1..6] of string =
('File',
'Play',
'Edit',
'Config',
'Help',
'Quit');
Menu_Text : array[1..6] of array[1..6] of string = (
('New Song',
'Load Song',
'Save Song',
'Import Amiga MOD patterns',
'Import AGI music resource',
''),
('Play Song',
'Stop',
'Play Pattern',
'Play from Cursor',
'Trace mode is ',
''),
('PC Speaker channel on/off',
'Edit song description',
'Change default timing',
'Add new Pattern',
'Delete current Pattern',
'Transpose'),
('Sound device',
'AGI music import',
'MOD import',
'',
'',
''),
('Keys',
'Effects',
'About',
'',
'',
''),
('Quit to DOS',
'',
'',
'',
'',
''));
Menu_Size : array[1..6] of byte =
(5,5,6,3,3,1);
Menu_Pos : array[1..6] of byte =
(17,25,33,41,51,59);
implementation
Procedure Mark(x,y,l : byte);
var c : byte;
begin
for c := x to x+(l-1) do
begin
if not Monochrome then
changeattr(c,y,Attr(palette.text_color2,palette.mark_color,false))
else
changeattr(c,y,AttrMDA(false,false,true));
end;
end;
Procedure UnMark(x,y,l,col : byte);
var c : byte;
begin
for c := x to x+(l-1) do
begin
if not Monochrome then
changeattr(c,y,Attr(col,palette.menu_color,false))
else
changeattr(c,y,AttrMDA(false,false,false));
end;
end;
{============ Drawing a menu page ==============}
Procedure DrawMenu(mnr : byte);
var i,s : byte;
begin
Mark(Menu_pos[mnr],1,length(menu_title[mnr]));
s := 0;
for i := 1 to Menu_size[mnr] do
if Length(menu_text[mnr][i]) > s then s := Length(menu_text[mnr][i]);
box(Menu_pos[mnr],2,Menu_pos[mnr]+s+3,3+Menu_size[mnr],palette.text_color1,palette.menu_color,true,true);
for i := 1 to Menu_size[mnr] do
begin
fastwrite(Menu_pos[mnr]+1,2+i,palette.text_color1,palette.menu_color,menu_text[mnr][i]);
if (mnr = 2) and (i = 5) then
begin
if ptn.tracemode then
fastwrite(Menu_pos[mnr]+length(menu_text[mnr][5])-2,7,palette.text_color1,palette.menu_color,'ON')
else
fastwrite(Menu_pos[mnr]+length(menu_text[mnr][5])-2,7,palette.text_color1,palette.menu_color,'OFF');
end;
end;
active_menu := mnr;
end;
{============ The editor for the song description ==============}
Procedure Edit_Message;
var
ox,oy,
x,y,
line_pos,line : byte; {cursor positons}
offset, cnt : word; {offset in message buffer, counter}
text : array[1..10] of string[40]; {buffer for message in string form}
const
min_x : byte = 20; {screen coordinate constants}
min_y : byte = 5;
max_x : byte = 59;
max_y : byte = 14;
Procedure Convert_buffer_to_text;
var lc,lp : byte;
begin
for lc:= 1 to 10 do
begin
offset := ((lc-1)*40)+1;
lp := 1;
text[lc] := '';
repeat
text[lc] := text[lc]+chr(msg_buffer[offset]);
inc(lp);
inc(offset);
until (lp = 41);
end;
dec(lp);
while text[10][lp] = #0 do
dec(lp);
delete(text[10],lp,40-lp);
end;
Procedure Convert_text_to_buffer;
var lc,lp : byte;
begin
for lc := 1 to 10 do
begin
for lp := 1 to 40 do
msg_buffer[((lc-1)*40)+lp] := ord(text[lc][lp]);
end;
end;
Procedure Print_Message;
var lc : byte;
begin
block(20,5,60,14,15,0);
for lc := 1 to 10 do
begin
fastwrite(min_x,(min_y-1)+lc,15,0,text[lc]);
end;
displaybuffer(buffer.screen2);
end;
Procedure Next_char_pos;
begin
if (x < max_x) then
begin
inc(x);
inc(line_pos);
end
else
begin
if (y < max_y) then
begin
inc(y);
inc(line);
x := min_x;
line_pos := 1;
end;
end;
gotoxy(x,y);
end;
Procedure Prev_char_pos;
begin
if (x > min_x) then
begin
dec(x);
dec(line_pos);
end
else
begin
if (y > min_y) then
begin
dec(y);
dec(line);
x := max_x;
line_pos := 40;
end;
end;
gotoxy(x,y);
end;
begin
ox := GetX;
oy := GetY;
CopyBuffer(buffer.blankscreen,buffer.screen2);
writeto(buffer.screen2);
box(18,4,61,15,15,1,true,true);
centeredtext(4,palette.text_color2,palette.menu_color,' Song description Editor: ');
centeredtext(15,palette.text_color2,palette.menu_color,' Press ESC to return to the tracker ');
x := min_x;
y := min_y;
line_pos := 1;
line := 1;
gotoxy(x,y);
cursor(true);
Change_cursor(6,7);
Convert_buffer_to_text;
Print_Message;
Clear_keypress;
repeat
if is_key_pressed then Get_Key;
if (ord(key_Ascii) > $20) then
begin
if length(text[line]) < 40 then
begin
if line_pos < length(text[line]) then
text[line][line_pos] := key_Ascii
else
text[line] := text[line]+key_Ascii;
end
else
text[line][line_pos] := key_Ascii;
Next_char_pos;
Print_Message;
Clear_keypress;
editor.saved := false;
end;
if key_code= 57 then {space}
begin
text[line][line_pos] := #0;
Next_char_pos;
Print_Message;
Clear_keypress;
editor.saved := false;
end;
if (key_code= 14) then {Backspace}
begin
if (line_pos > 1) then
delete(text[line],line_pos-1,1)
else
delete(text[line-1],40,1);
text[line][40] := ' ';
Prev_char_pos;
Print_Message;
Clear_keypress;
editor.saved := false;
end;
if (key_code= 83) then {Entf}
begin
delete(text[line],line_pos,1);
Print_Message;
Clear_keypress;
editor.saved := false;
end;
if (key_code= 77) then {Right}
begin
if (x < max_x) then
begin
inc(x);
inc(line_pos);
end
else
begin
if y < max_Y then
begin
x := min_X;
inc(y);
line_pos := 1;
inc(line);
end;
end;
gotoxy(x,y);
Clear_Keypress;
end;
if (key_code= 75) then {Left}
begin
if (x > min_X) then
begin
dec(x);
dec(line_pos);
end
else
begin
if y > min_Y then
begin
dec(y);
x := max_X;
line_pos := 40;
dec(line);
end;
end;
gotoxy(x,y);
Clear_Keypress;
end;
if (key_code= 72) then {Up}
begin
if (y > min_y) then
begin
dec(y);
dec(line);
end;
gotoxy(x,y);
Clear_Keypress;
end;
if (key_code= 80) then {Down}
begin
if (y < max_Y) then
begin
inc(y);
inc(line);
end;
gotoxy(x,y);
Clear_Keypress;
end;
if (key_code = 79) then {End}
begin
x := max_X;
gotoxy(x,y);
line_pos := 40;
Clear_Keypress;
end;
if (key_code = 71) then {Pos1}
begin
x := min_X;
gotoxy(x,y);
line_pos := 1;
Clear_Keypress;
end;
if key_code= 28 then {Enter}
begin
if (y < max_y) then
begin
x := min_x;
inc(y);
inc(line);
line_pos := 1;
gotoxy(x,y);
end;
Clear_Keypress;
end;
until (key_code= 1);
convert_text_to_buffer;
gotoxy(ox,oy);
cursor(false);
writeto(buffer.screen1);
displaybuffer(buffer.screen1);
Clear_Keypress;
end;
{============ The menu to change default timing ==============}
Procedure Timing_Config;
var
selected : byte;
bpm : real;
s : string;
begin
CopyBuffer(buffer.blankscreen,buffer.screen2);
writeto(buffer.screen2);
box(10,5,70,14,15,1,false,true);
centeredtext(5,palette.text_color2,palette.menu_color,' Song timing ');
centeredtext(7,palette.text_color1,palette.menu_color,'Default tempo (ticks per second):');
centeredtext(10,palette.text_color1,palette.menu_color,'Default speed (ticks per row):');
fastwrite(39,8,palette.text_color2,palette.mark_color,addspace(100,round(Player.Tempo)));
fastwrite(40,11,palette.text_color2,palette.menu_color,addspace(10,Player.Speed));
selected := 1;
Clear_Keypress;
displaybuffer(buffer.screen2);
repeat
if is_key_pressed then Get_Key;
case selected of
1:
begin
mark(38,8,5);
unmark(39,11,4,palette.text_color2);
end;
2:
begin
mark(39,11,4);
unmark(38,8,5,palette.text_color2);
end;
end;
if (Player.Tempo > 0) and (Player.Speed > 0) then
bpm := (60*Player.Tempo) / (4*Player.Speed)
else
bpm := 0;
{First find interrupts per minute: 60 seconds * 50 per second = 3000
Divide by interrupts per quarter note = 4 notes * speed
This gives: Tempo = 3000/(4*speed)
simplified: Tempo = 750/speed
For a normal song in speed 6 this formula gives: 750/6 = 125 BPM
From " The MOD file format" by Lars "ZAP" Hamre/Amiga Freelancers 1990}
str(bpm:3:0,s);
centeredtext(13,palette.text_color2,palette.menu_color,'= '+s+ ' BPM');
displaybuffer(buffer.screen2);
if (key_code= 80) then {down}
begin
inc(selected);
if selected > 2 then selected := 1;
Clear_Keypress;
end;
if (key_code= 72) then {up}
begin
dec(selected);
if selected < 1 then selected := 2;
Clear_Keypress;
end;
if (key_code= 78) or (key_code= 27) {+} or (key_code= 77) {right} then
begin
editor.saved := false;
case selected of
1: if Player.Tempo < $E0 then
begin
inc(Player.Tempo);
fastwrite(39,8,palette.text_color2,palette.mark_color,addspace(100,round(Player.Tempo)));
set_timer(Player.Tempo); {Reset timer to new tepo}
end;
2: if Player.Speed < $1F then
begin
inc(Player.Speed);
fastwrite(40,11,palette.text_color2,palette.mark_color,addspace(10,Player.Speed));
set_timer(Player.Tempo); {Reset timer to new tepo}
end;
end;
Clear_Keypress;
displaybuffer(buffer.screen2);
end;
if (key_code= 53) or (key_code= 74) {-} or (key_code= 75) {left} then
begin
editor.saved := false;
case selected of
1: if Player.Tempo > 18 then
begin
dec(Player.Tempo);
fastwrite(39,8,palette.text_color2,palette.mark_color,addspace(100,round(Player.Tempo)));
set_timer(Player.Tempo); {Reset timer to new tepo}
end;
2: if Player.Speed > 1 then
begin
dec(Player.Speed);
fastwrite(40,11,palette.text_color2,palette.mark_color,addspace(10,Player.Speed));
set_timer(Player.Tempo); {Reset timer to new tepo}
end;
end;
Clear_Keypress;
displaybuffer(buffer.screen2);
end;
until (key_code= 28) or (key_code= 1);
Editor.D_Tempo := Player.Tempo;
Editor.D_Speed := Player.Speed;
Editor.Playtime := Player.Tempo div 4;
Clear_Keypress;
writeto(buffer.screen1);
displaybuffer(buffer.screen1);
end;
{============ The output device configuration window ==============}
Procedure Output_Config;
begin
copybuffer(buffer.blankscreen,buffer.screen2);
writeto(buffer.screen2);
box(18,3,62,15,15,1,false,true);
centeredtext(4,palette.text_color2,palette.menu_color,'Configure Tandy 3 Voice:');
centeredtext(7,palette.text_color1,palette.menu_color,'I/O Port for soundchip:');
centeredtext(13,palette.text_color1,palette.menu_color,'Use arrow keys or +/- to select port.');
if TANDY.IOport > 3 then {I/O Port for TNDY card}
begin
HLine(19,9,40,palette.menu_color,palette.menu_color,#32);
centeredtext(8,palette.text_color2,palette.mark_color,hexw(TANDY.IOport)+'h');
centeredtext(10,palette.text_color1,palette.menu_color,'[ ] Use '+hexw(TANDY.IOport+1)+'h as second data port');
if TANDY.useC1 then
putchar(25,10,palette.text_color2,palette.menu_color,'x');
centeredtext(14,palette.text_color1,palette.menu_color,'Space to enable/disable data port option.');
end
else
begin {Parallel Port}
centeredtext(8,palette.text_color2,palette.mark_color,'LPT'+hexn(TANDY.IOport)+' ');
if not TLPT_Init(TANDY.IOport) then
begin
centeredtext(9,palette.text_color2,palette.menu_color,'Parallel port LPT'+hexn(TANDY.IOport)+' not found!');
end
else
begin
centeredtext(9,palette.menu_color,palette.menu_color,'Parallel port LPT'+hexn(TANDY.IOport)+' not found!');
end;
end;
mark(38,8,5);
displaybuffer(buffer.screen2);
Clear_Keypress;
repeat
if is_key_pressed then Get_Key;
if (key_code= 77) {right} or (key_code= 72) {up} or (key_code= 78) or (key_code= 27) {+} then
begin
case TANDY.IOport of
$0C0: TANDY.IOport := $0E0;
$0E0: TANDY.IOport := $1E0;
$1E0: TANDY.IOport := $2C0;
$2C0: TANDY.IOport := $2E0;
$2E0: TANDY.IOport := 1;
1: TANDY.IOport := 2;
2: TANDY.IOport := 3;
3: TANDY.IOport := $0C0;
end;
if TANDY.IOport > 3 then
begin
if TLPT.lpt then
begin
TLPT_Mute;
TLPT.lpt := false;
end;
TANDY_Mute_all;
HLine(19,9,43,palette.menu_color,palette.menu_color,#32);
centeredtext(8,palette.text_color2,palette.mark_color,hexw(TANDY.IOport)+'h');
centeredtext(10,palette.text_color1,palette.menu_color,'[ ] Use '+hexw(TANDY.IOport+1)+'h as second data port');
if TANDY.useC1 then
putchar(25,10,palette.text_color2,palette.menu_color,'x');
centeredtext(14,palette.text_color1,palette.menu_color,'Space to enable/disable data port option.');
end
else
begin
HLine(19,10,43,palette.menu_color,palette.menu_color,#32);
HLine(19,14,43,palette.menu_color,palette.menu_color,#32);
centeredtext(8,palette.text_color2,palette.mark_color,'LPT'+hexn(TANDY.IOport)+' ');
if not TLPT_Init(TANDY.IOport) then
begin
centeredtext(9,palette.text_color2,palette.menu_color,'Parallel port LPT'+hexn(TANDY.IOport)+' not found!');
end
else
begin
centeredtext(9,palette.menu_color,palette.menu_color,'Parallel port LPT'+hexn(TANDY.IOport)+' not found!');
end;
end;
Clear_Keypress;
mark(38,8,5);
TANDY_Mute_all;
displaybuffer(buffer.screen2);
end;
if (key_code= 75) {left} or (key_code= 80) {down} or (key_code= 53) or (key_code= 74) {-} then
begin
case TANDY.IOport of
3: TANDY.IOport := 2;
2: TANDY.IOport := 1;
1: TANDY.IOport := $2E0;
$2E0: TANDY.IOport := $2C0;
$2C0: TANDY.IOport := $1E0;
$1E0: TANDY.IOport := $0E0;
$0E0: TANDY.IOport := $0C0;
$0C0: TANDY.IOport := 3;
end;
if TANDY.IOport > 3 then
begin
HLine(19,9,43,palette.menu_color,palette.menu_color,#32);
centeredtext(8,palette.text_color2,palette.mark_color,hexw(TANDY.IOport)+'h');
centeredtext(10,palette.text_color1,palette.menu_color,'[ ] Use '+hexw(TANDY.IOport+1)+'h as second data port');
if TANDY.useC1 then
putchar(25,10,palette.text_color2,palette.menu_color,'x');
centeredtext(14,palette.text_color1,palette.menu_color,'Space to enable/disable data port option.');
end
else
begin
HLine(19,10,43,palette.menu_color,palette.menu_color,#32);
HLine(19,14,43,palette.menu_color,palette.menu_color,#32);
centeredtext(8,palette.text_color2,palette.mark_color,'LPT'+hexn(TANDY.IOport)+' ');
if not TLPT_Init(TANDY.IOport) then
begin
centeredtext(9,palette.text_color2,palette.menu_color,'Parallel port LPT'+hexn(TANDY.IOport)+' not found!');
end
else
begin
centeredtext(9,palette.menu_color,palette.menu_color,'Parallel port LPT'+hexn(TANDY.IOport)+' not found!');
end;
end;
Clear_Keypress;
mark(38,8,5);
TANDY_Mute_all;
displaybuffer(buffer.screen2);
end;
if (key_code = 57) and (TANDY.IOport > 3) then
begin
if TANDY.useC1 then
begin
TANDY.useC1 := false;
putchar(25,10,palette.text_color2,palette.menu_color,' ');
end
else
begin
TANDY.useC1 := true;
putchar(25,10,palette.text_color2,palette.menu_color,'x');
end;
Clear_Keypress;
displaybuffer(buffer.screen2);
end;
until (key_code= 28) or (key_code= 1);
Clear_Keypress;
writeto(buffer.screen1);
displaybuffer(buffer.screen1);
end;
{============ The options for the import of AGI files ==============}
Procedure SND_Import_Config;
var
selected : byte;
begin
CopyBuffer(buffer.blankscreen,buffer.screen2);
writeto(buffer.screen2);
box(10,5,70,16,15,1,false,true);
centeredtext(5,palette.text_color2,palette.menu_color,' Options for the import of AGI SND files ');
centeredtext(7,palette.text_color1,palette.menu_color,'Use "Finetune" effect to correct frequencies:');
centeredtext(9,palette.text_color1,palette.menu_color,'Default tempo (ticks per second):');
centeredtext(11,palette.text_color1,palette.menu_color,'Default speed (ticks per row):');
centeredtext(13,palette.text_color1,palette.menu_color,'Assumed clock frequency:');
selected := 1;
if SNDcfg.correct then
fastwrite(37,8,palette.text_color2,palette.mark_color,'ENABLED ')
else
fastwrite(37,8,palette.text_color2,palette.mark_color,'DISABLED');
centeredtext(10,palette.text_color2,palette.menu_color,addspace(100,SNDcfg.Tempo));
if SNDcfg.Speed > 0 then
fastwrite(39,12,palette.text_color2,palette.mark_color,addspace(100,SNDcfg.Speed))
else
fastwrite(39,12,palette.text_color2,palette.mark_color,'AUTO');
If SNDcfg.ClockFreq = 1 then
centeredtext(14,palette.text_color2,palette.menu_color,' 99320 Hz')
else
centeredtext(14,palette.text_color2,palette.menu_color,'111860 Hz');
Clear_Keypress;
displaybuffer(buffer.screen2);
repeat
if is_key_pressed then Get_Key;
case selected of
1:
begin
mark(36,8,10);
unmark(39,10,4,palette.text_color2);
unmark(39,12,4,palette.text_color2);
unmark(35,14,10,palette.text_color2);
end;
2:
begin
unmark(36,8,10,palette.text_color2);
mark(39,10,4);
unmark(39,12,4,palette.text_color2);
unmark(35,14,10,palette.text_color2);
end;
3:
begin
unmark(36,8,10,palette.text_color2);
unmark(39,10,4,palette.text_color2);
mark(39,12,4);
unmark(35,14,10,palette.text_color2);
end;
4:
begin
unmark(36,8,10,palette.text_color2);
unmark(39,10,4,palette.text_color2);
unmark(39,12,4,palette.text_color2);
mark(35,14,10);
end;
end;
if (key_code= 80) then {down}
begin
inc(selected);
if selected > 4 then selected := 1;
Clear_keypress;
end;
if (key_code= 72) then {up}
begin
dec(selected);
if selected < 1 then selected := 4;
Clear_keypress;
end;
if (key_code= 78) or (key_code= 27) {+} or (key_code= 77) {right} then
begin
Clear_keypress;
case selected of
1: begin
if SNDcfg.correct = false then
begin
SNDcfg.correct := true;
fastwrite(37,8,palette.text_color2,palette.mark_color,'ENABLED ');
end
else
begin
SNDcfg.correct := false;
fastwrite(37,8,palette.text_color2,palette.mark_color,'DISABLED');
end;
end;
2: begin
if SNDcfg.Tempo < 224 then inc(SNDcfg.Tempo);
centeredtext(10,palette.text_color2,palette.mark_color,addspace(100,SNDcfg.Tempo));
end;
3: begin
if SNDcfg.Speed < 31 then inc(SNDcfg.Speed);
if SNDcfg.Speed > 0 then
fastwrite(39,12,palette.text_color2,palette.mark_color,addspace(100,SNDcfg.Speed)+' ')
else
fastwrite(39,12,palette.text_color2,palette.mark_color,'AUTO')
end;
4: begin
if SNDcfg.ClockFreq = 0 then
begin
SNDcfg.ClockFreq := 1;
centeredtext(14,palette.text_color2,palette.menu_color,' 99320 Hz')
end
else
begin
SNDcfg.ClockFreq := 0;
centeredtext(14,palette.text_color2,palette.menu_color,'111860 Hz');
end;
end;
end;
end;
if (key_code= 53) or (key_code= 74) {-} or (key_code= 75) then
begin
Clear_keypress;
case selected of
1: begin
if SNDcfg.correct = false then
begin
SNDcfg.correct := true;
fastwrite(37,8,palette.text_color2,palette.mark_color,'ENABLED ');
end
else
begin
SNDcfg.correct := false;
fastwrite(37,8,palette.text_color2,palette.mark_color,'DISABLED');
end;
end;
2: begin
if SNDcfg.Tempo > 18 then dec(SNDcfg.Tempo);
centeredtext(10,palette.text_color2,palette.mark_color,addspace(100,SNDcfg.Tempo));
end;
3: begin
if SNDcfg.Speed > 0 then dec(SNDcfg.Speed);
if SNDcfg.Speed > 0 then
fastwrite(39,12,palette.text_color2,palette.mark_color,addspace(100,SNDcfg.Speed)+' ')
else
fastwrite(39,12,palette.text_color2,palette.mark_color,'AUTO')
end;
4: begin
if SNDcfg.ClockFreq = 0 then
begin
SNDcfg.ClockFreq := 1;
centeredtext(14,palette.text_color2,palette.mark_color,' 99320 Hz');
end
else
begin
SNDcfg.ClockFreq := 0;
centeredtext(14,palette.text_color2,palette.mark_color,'111860 Hz');
end;
end;
end;
end;
displaybuffer(buffer.screen2);
until (key_code= 1) or (key_code= 28);
Clear_Keypress;
writeto(buffer.screen1);
displaybuffer(buffer.screen1);
end;
{============ Options for the import of MOD files ==============}
Procedure MOD_Import_Config;
var
selected : byte;
begin
CopyBuffer(buffer.blankscreen,buffer.screen2);
writeto(buffer.screen2);
box(10,5,70,16,15,1,false,true);
centeredtext(5,palette.text_color2,palette.menu_color,' Options for the import of Amiga MOD files ');
centeredtext(7,palette.text_color1,palette.menu_color,'Import 4th channel as:');
centeredtext(9,palette.text_color1,palette.menu_color,'Default tempo (ticks per second):');
centeredtext(11,palette.text_color1,palette.menu_color,'Default speed (ticks per row):');
centeredtext(13,palette.text_color1,palette.menu_color,'Volume scaling:');
case MODcfg.ch4 of
1: fastwrite(36,8,palette.text_color2,palette.mark_color,' Noise ');
2: fastwrite(36,8,palette.text_color2,palette.mark_color,'PC-Speaker');
3: fastwrite(36,8,palette.text_color2,palette.mark_color,' OFF ');
end;
fastwrite(39,10,palette.text_color2,palette.menu_color,addspace(100,MODcfg.Tempo));
fastwrite(40,12,palette.text_color2,palette.menu_color,addspace(10,MODcfg.Speed));
case MODcfg.volscale of
1: fastwrite(36,14,palette.text_color2,palette.menu_color,' Direct ');
2: fastwrite(36,14,palette.text_color2,palette.menu_color,'Correct dB ');
end;
selected := 1;
Clear_Keypress;
displaybuffer(buffer.screen2);
repeat