forked from cpcepower/CPCMix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPCMix_Menu.asm
2274 lines (1967 loc) · 44.7 KB
/
CPCMix_Menu.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
; big'o'full à revoir !
; ---------------------------------------------------------------------------------
; - CPC Mix Menu - $VER 2.0 - (c) 2008-2009-2012-2018 Megachur
; ---------------------------------------------------------------------------------
nolist
; ---------------------------
; @todo -
; ---------------------------
read "../include/macro/macro_ASM.asm"
; ---------------------------
begin_menu equ #4000
; USE_COMPACTER equ 1
; DEBUG equ 1
; TODO equ 1
SAVE_FILE equ 1
; ---------------------------
org begin_menu-#1c ; #1c = start_player-start_player_in_memory
IFDEF SAVE_FILE
;; write direct "a:CPCMIX.",start_player_in_memory
write "CPCMIX."
ELSE
run start_player_in_memory
ENDIF
; ---------------------------
;write direct -1,-1,#C5
; ---------------------------
; ---------------------------
start_player_in_memory:
; ---------------------------
di
ld hl,start_player
ld de,#0100
ld bc,end_player-start_player+1
ldir
ld bc,#7fc5
out (c),c
ld hl,#0100
ld de,start_player
ld bc,end_player-start_player+1
ldir
; ---------------------------
start_player
; ---------------------------
call vbl_wait
ld a,(#a700) ; get AMSDOS current drive number (0=A; 1=B)
and %00000011
call fdc_set_drive_number
add a,65
ld (music_insert_disk_drive_text),a
xor a
ld (current_music_end),a
ld (current_menu_item_idx),a
ld (psg_sound_reset_di),a ; disable lbca7 di/ei
ld (psg_sound_reset_ei),a
call fdc_set_drive_head_number ; a = 0
ld sp,#0000
next_music
di
ld hl,#0038
ld (hl),#c3
inc hl
ld (hl),z80_interruption
inc hl
ld (hl),z80_interruption/#100
call psg_sound_reset ; lbca7
ld bc,#7f00+%10011100+2 ; Set Interrupt and Upper/Lower rom area disable + mode 2
out (c),c
xor a
out (c),a
ld c,#54
out (c),c
inc a
out (c),a
out (c),c
ld a,#10
out (c),a
out (c),c
ld hl,crtc_regs_value+12
ld (hl),CRTC_SCREEN_ADDRESS/#100
inc hl
ld (hl),CRTC_SCREEN_ADDRESS
ld hl,crtc_regs_value
call set_crtc_regs
ld hl,draw_freq_spectrum_analyzer_first_address
ld (draw_spectrum_analyzer_call_draw),hl
ld hl,draw_spectrum_analyzer_first_address_table
ld (draw_spectrum_analyzer_address),hl
ld hl,SCREEN_FIRST_ADDRESS
ld (print_screen_address),hl
ld de,SCREEN_FIRST_ADDRESS+1
ld bc,#3fff
ld (hl),#00
ldir
call vbl_wait
call keyboard_init_scan
ld bc,#7f01
out (c),c
ld a,#4b
out (c),a
ei
;
; load next file !
;
call print_intro_text
load_current_music_index
call navigation_menu
current_music_end equ $+1
ld a,0
inc a
jr nz,load_current_music_index_next
call navigation_menu_down
jp load_current_music_selected_next
load_current_music_index_next
inc a
jr nz,navigation_menu_loop
call navigation_menu_up
jp load_current_music_selected_next
; ---------------------------
navigation_menu_loop
; ---------------------------
call vbl_wait
ld a,(keyboard_a_key_pressed)
or a
jr z,navigation_menu_loop ; no key pressed ?
first_loop_tempo equ $+1
ld a,5
dec a
ld (first_loop_tempo),a
jr nz,navigation_menu_loop
ld a,5
ld (first_loop_tempo),a
ld a,(keyboard_line_press+keyboard_line_0)
bit key_up,a
jr z,not_key_up
call navigation_menu_up
jr navigation_menu_loop
not_key_up
bit key_down,a
jr z,not_key_down
call navigation_menu_down
jr navigation_menu_loop
not_key_down
ld a,(keyboard_line_press+keyboard_line_5)
bit key_space,a
jr z,not_key_space
ld hl,(current_menu_item)
ld a,(hl)
or a
jr z,refresh_directory
jr load_current_music_selected_next
not_key_space
ld a,(keyboard_line_press+keyboard_line_2)
bit key_return,a
jr z,navigation_menu_loop
refresh_directory
ld hl,refresh_directory_loop_wait_count
ld (hl),#03
refresh_directory_loop
ld hl,musics_list_on_current_disk
ld (current_menu_item),hl
xor a
ld (current_menu_item_idx),a
call cpcmix_load_directory
or a
jr z,refresh_directory_ok
; cp 1 ; disk missing
call check_Load_Error
refresh_directory_loop_wait_count equ $+1
ld a,#00
dec a
jr nz,refresh_directory_loop
call PRINT_LINE_BLANK
jr navigation_menu_loop
refresh_directory_ok
call PRINT_LINE_BLANK
load_current_music_selected_next
xor a
ld (load_current_music_selected_wait_count),a
load_current_music_selected_ok
load_current_music_selected_wait_count equ $+1
ld a,#00
inc a
ld (load_current_music_selected_wait_count),a
cp #03
jr nz,load_current_music_selected_load_ok
jr refresh_directory
load_current_music_selected_load_ok
xor a
ld (current_music_end),a
current_menu_item equ $+1
ld hl,musics_list_on_current_disk
ld a,(hl)
or a ; end of file_list
jr nz,load_current_music_selected_valid
ld hl,musics_list_on_current_disk
ld (current_menu_item),hl
jp load_current_music_index
load_current_music_selected_valid
call load_current_music_selected
ld a,(load_error_value)
inc a ; cp #ff
jp z,load_current_music_index
dec a ; or a
jr nz,load_current_music_selected_ok
; print music name/year/publisher/author and additional commentary
; check if tag "Megachur" is at the right place to ensure that it's good music data after !
ld hl,MUSIC_LOAD+INDEX_MEGACHUR
ld de,text_Megachur
Megachur_check_continue
ld a,(de)
or a
jr z,Megachur_check_ok
cp (hl)
jr nz,Megachur_check_fails
inc hl
inc de
jr Megachur_check_continue
Megachur_check_fails
; rst 0
ld hl,text_not_musicfile
call print_text
ld hl,MUSICS_LIST_ON_CURRENT_DISK_END-FILENAME_LENGTH
ld bc,(current_menu_item)
and a ; reset carry
sbc hl,bc
ld b,h
ld c,l
ld hl,FILENAME_LENGTH
ld de,(current_menu_item)
add hl,de
ldir
ld b,100
Megachur_check_fails_wait
push bc
call vbl_wait
pop bc
djnz Megachur_check_fails_wait
jp next_music
Megachur_check_ok
di
ld hl,#c9fb
ld (#0038),hl
ld hl,l0000
ld de,#0000
ld bc,l0000_end-l0000
ldir
ei
; check that screen address = #c000 is free or disable writing char
ld a,(file_nbentry)
or a
jr z,file_loaded_is_not_to_long
ld c,0
ld hl,file_block_table
count_number_of_extended_block
ld a,(hl)
inc hl
or a
jr z,no_more_extended_block
inc c
jr count_number_of_extended_block
no_more_extended_block
ld a,c
and #0f ; only #3c00 long available !!!
ld (no_more_extended_block_restore_nb),a
ld hl,screen_first_address
push hl
push af
ld de,file_temp_memory_adr_save
;
; copy extended block to file_temp_memory_adr_save = #0400
;
move_memory
ld bc,#0400
ldir
dec a
jr nz,move_memory
pop af
pop hl
ld d,h
ld e,l
clear_move_memory
inc de
ld (hl),#00
ld bc,#0400-1
ldir
inc hl
dec a
jr nz,clear_move_memory
file_loaded_is_not_to_long
call PRINT_LINE_BLANK
ld hl,MUSIC_HEADER_LENGTH
ld bc,(MUSIC_LOAD)
add hl,bc
ld (music_address_begin),hl
ld hl,(MUSIC_LOAD+INDEX_MUSIC_INFO)
; ld bc,(MUSIC_LOAD)
and a ; reset carry
sbc hl,bc
ld bc,MUSIC_HEADER_LENGTH
and a ; reset carry
sbc hl,bc
ld (length_of_music_withoutcomment),hl
add hl,bc
ld a,(file_nbentry)
or a
jr z,find_information_in_first_16ko
ld de,file_temp_memory_adr_save-#4000 ; warning if comment is cut (first in #7fff then #0400)
jr find_information
find_information_in_first_16ko
ld de,MUSIC_LOAD
find_information
add hl,de
;
; music name (year) (publisher) (author)
;
call print_text
call print_text_CRx2
;
; additional commentary
;
ld a,(hl)
or a
jr nz,comments
ld hl,text_no_comments
comments
call print_text
call print_text_CRx2
;
; Date rip
;
ld hl,text_music_rip
call print_text
ld hl,text_music_date_rip
call print_text
ld a,(MUSIC_LOAD+INDEX_MUSIC_DATE_RIP_DAY)
call print_number_direct
ld a,"/"
call print_char
ld a,(MUSIC_LOAD+INDEX_MUSIC_DATE_RIP_MONTH)
call print_number_direct
ld a,"/"
call print_char
ld a,(MUSIC_LOAD+INDEX_MUSIC_DATE_RIP_YEAR)
call print_number_direct
ld a,(MUSIC_LOAD+INDEX_MUSIC_DATE_RIP_YEAR+1)
call print_number_direct
call print_text_CRx2
;
; music address (begin, play, init, stop, end, length)
;
ld hl,(MUSIC_LOAD+INDEX_MUSIC_REAL_ADR)
ld (Hexa_Number_To_Print),hl
ld hl,text_music_real_adr
call print_text
call print_hexa_number
ld hl,(MUSIC_LOAD+INDEX_INIT_MUSIC)
ld (call_init_music_adr),hl
ld hl,(MUSIC_LOAD+INDEX_REAL_INIT_MUSIC)
ld (Hexa_Number_To_Print),hl
ld hl,text_init_music
call print_text
call print_hexa_number
ld hl,(MUSIC_LOAD+INDEX_PLAY_MUSIC)
ld (call_play_music_adr),hl
ld hl,(MUSIC_LOAD+INDEX_REAL_PLAY_MUSIC)
ld (Hexa_Number_To_Print),hl
ld hl,text_play_music
call print_text
call print_hexa_number
ld hl,(MUSIC_LOAD+INDEX_STOP_MUSIC)
ld (Hexa_Number_To_Print),hl
ld hl,text_stop_music
call print_text
call print_hexa_number
ld hl,(MUSIC_LOAD+INDEX_MUSIC_END)
ld (Hexa_Number_To_Print),hl
ld hl,text_music_end
call print_text
call print_hexa_number
ld hl,(length_of_music_withoutcomment)
ld (Hexa_Number_To_Print),hl
ld hl,text_music_length
call print_text
call print_hexa_number
call print_text_CRx2
ld hl,(MUSIC_LOAD+INDEX_MUSIC_END)
ld (music_end_address),hl
ld a,(MUSIC_LOAD+INDEX_LAST_THEME)
ld (current_music_max_theme),a
ld a,(MUSIC_LOAD+INDEX_FIRST_THEME)
ld (current_music_first_theme),a
call display_current_theme
call print_intro_text
;
; copy screen to MEMORY_BANK3
;
ld de,#4000
ld hl,move_function_memory_adr
ld (hl),#01
inc hl
ld (hl),MEMORY_BANK3
inc hl
ld (hl),#7f
inc hl
ld (hl),#ed
inc hl
ld (hl),#49
inc hl
ld (hl),#21
inc hl
ld (hl),SCREEN_FIRST_ADDRESS
inc hl
ld (hl),SCREEN_FIRST_ADDRESS/#100
inc hl
ld (hl),#01
inc hl
ld (hl),#4000
inc hl
ld (hl),#4000/#100
inc hl
ld (hl),#ed
inc hl
ld (hl),#b0
inc hl
ld (hl),#c3
inc hl
ld (hl),l0000_bank_5
inc hl
ld (hl),l0000_bank_5/#100
call move_function_memory_adr
;
; check that screen address = #c000 is free
; move memory if necessary
;
ld a,(file_nbentry)
or a
jr z,file_loaded_is_not_to_long_restore
no_more_extended_block_restore_nb equ $+1
ld a,#00
ld hl,file_temp_memory_adr_save
ld de,screen_first_address
move_memory_restore
ld bc,#400
ldir
dec a
jr nz,move_memory_restore
file_loaded_is_not_to_long_restore
ld hl,(music_address_begin)
ld bc,SCREEN_FIRST_ADDRESS
and a ; reset carry
sbc hl,bc
jr nc,music_adrbegin_sup_c000
; begin < #c000
ld hl,(music_address_begin)
ld bc,(length_of_music_withoutcomment)
add hl,bc
ld bc,SCREEN_FIRST_ADDRESS
and a ; reset carry
sbc hl,bc
jr nc,music_adrend_sup_c000
; end < #c000
ld hl,SCREEN_FIRST_ADDRESS
jr copy_file_memory_to_right_place
music_adrend_sup_c000
ld hl,(music_address_begin)
ld bc,SCREEN_SECOND_ADDRESS
and a ; reset carry
sbc hl,bc
jr nc,music_adrbegin_sup_8000
music_adrbegin_sup_c000
; begin > #c000
ld hl,(music_address_begin)
ld bc,(length_of_music_withoutcomment)
add hl,bc
ld bc,SCREEN_FIRST_ADDRESS
and a ; reset carry
sbc hl,bc
jr c,music_adrend_sup_8000
; end < #8000
ld a,(print_screen_address+1)
add #c0
ld (print_screen_address+1),a
ld hl,crtc_regs_value+12
ld (hl),SCREEN_CRTC_2ND_ADDRESS/#100
inc hl
ld (hl),SCREEN_CRTC_2ND_ADDRESS
ld hl,draw_freq_spectrum_analyzer_second_address
ld (draw_spectrum_analyzer_call_draw),hl
ld hl,draw_spectrum_analyzer_second_address_table
ld (draw_spectrum_analyzer_address),hl
ld hl,screen_second_address
jr copy_file_memory_to_right_place
music_adrbegin_sup_8000
music_adrend_sup_8000
ld a,(print_screen_address+1)
add #40
ld (print_screen_address+1),a
ld hl,crtc_regs_value+12
ld (hl),SCREEN_CRTC_3RD_ADDRESS/#100
inc hl
ld (hl),SCREEN_CRTC_3RD_ADDRESS
ld hl,draw_freq_spectrum_analyzer_third_address
ld (draw_spectrum_analyzer_call_draw),hl
ld hl,draw_spectrum_analyzer_third_address_table
ld (draw_spectrum_analyzer_address),hl
ld a,#01
ld (screen_third_activate),a
ld hl,screen_third_address+MINIMUM_PRESERVE_MEMORY_LENGTH
copy_file_memory_to_right_place
ld (screen_address_selected),hl
music_address_begin equ $+1
ld hl,0 ;(MUSIC_LOAD)+MUSIC_HEADER_LENGTH
ld de,MUSIC_LOAD+MUSIC_HEADER_LENGTH
ld a,e ; MUSIC_LOAD+MUSIC_HEADER_LENGTH
cp l
jr nz,music_adr_ko
ld a,d ; MUSIC_LOAD+MUSIC_HEADER_LENGTH/#100
cp h
jp z,music_load_memory_last
music_adr_ko
ex de,hl
push hl
; ld hl,MUSIC_LOAD+MUSIC_HEADER_LENGTH
ld b,d
ld c,e ; (MUSIC_LOAD)
and a ; reset carry
sbc hl,bc
length_of_music_withoutcomment equ $+1
ld bc,0 ;(MUSIC_LOAD+index_EOF_LENGTH)
jr nc,music_load_memory_ldir
dec bc
pop hl
add hl,bc
ex de,hl
add hl,bc
ex de,hl
inc bc
call lddr_music
jr music_load_memory_last
music_load_memory_ldir
pop hl
call ldir_music
;
; check that screen address = #c000 is free
;
music_load_memory_last
screen_address_selected equ $+1
ld de,#0
ld hl,move_function_memory_adr
ld (hl),#01
inc hl
ld (hl),MEMORY_BANK3
inc hl
ld (hl),#7f
inc hl
ld (hl),#ed
inc hl
ld (hl),#49
inc hl
ld (hl),#21
inc hl
ld (hl),#4000
inc hl
ld (hl),#4000/#100
screen_third_activate equ $+1
ld a,0
dec a
jr nz,screen_third_not_activate
ld (screen_third_activate),a
dec hl
ld (hl),#4000+MINIMUM_PRESERVE_MEMORY_LENGTH
inc hl
ld (hl),#4000+MINIMUM_PRESERVE_MEMORY_LENGTH/#100
screen_third_not_activate
inc hl
ld (hl),#01
inc hl
ld (hl),#4000-MINIMUM_PRESERVE_MEMORY_LENGTH
inc hl
ld (hl),#4000-MINIMUM_PRESERVE_MEMORY_LENGTH/#100 ; preserve stack or before #0038
inc hl
ld (hl),#ed
inc hl
ld (hl),#b0
inc hl
ld (hl),#c3
inc hl
ld (hl),l0000_bank_5
inc hl
ld (hl),l0000_bank_5/#100
call move_function_memory_adr
;
; music_adr_ok and screen_ok
;
ld hl,crtc_regs_value
call set_crtc_regs
ld hl,text_music_timer_count_first
call print_text
ld hl,text_spectrum_analyzer
call print_text
ld a,(print_psg_values)
cp #21
jr nz,not_print_text_psg_values
ld hl,text_psg_values
call print_text
not_print_text_psg_values
current_music_first_theme equ $+1
ld a,0
call change_current_theme
ei
;-------------------------------------------------------------------------------
play_music_vbl_wait
;-------------------------------------------------------------------------------
call vbl_wait
call call_play_music
or a
jr nz,not_current_theme_end
call change_theme_inc
not_current_theme_end
call read_print_psg_values
call draw_spectrum_analyzer
call time_counter
ld hl,text_music_timer_count
call print_text
ld a,(time_counter_hour)
call print_number_direct
ld a,":"
call print_char
ld a,(time_counter_minute)
call print_number_direct
ld a,":"
call print_char
ld a,(time_counter_second)
call print_number_direct
ld bc,#f407 ; Joe Blade 3 player set the port A to output so we have to reset it here before keyboard_scan !
out (c),c
ld b,#f6
in a,(c)
or #c0
out (c),a
and #3f
out (c),a
inc b ; b = #f7
ld c,%10010010
out (c),c
dec b ; b = #f6
or #40
out (c),a
ld b,#f4
in a,(c)
res 6,a ; 0x40 - set ay.iOA to input !
ld bc,#f700+%10000010
out (c),c
ld bc,#f407
out (c),c
ld c,a
ld b,#f6
in a,(c)
or #c0
out (c),a
and #3f
out (c),a
ld b,#f4
out (c),c
ld b,#f6
ld c,a
or #80
out (c),a
out (c),c
call keyboard_scan
ld a,(keyboard_a_key_pressed)
or a
jp z,test_key_end ; no key pressed
tempo equ $+1
ld a,5
dec a
ld (tempo),a
jp nz,test_key_end
ld a,5
ld (tempo),a
ld a,(keyboard_line_press+keyboard_line_8)
bit key_esc,a
jp nz,next_music
test_key_space ; load and play next music
ld a,(keyboard_line_press+keyboard_line_5)
bit key_space,a
jr z,test_key_left
ld hl,current_music_end
ld (hl),#ff
test_key_left ; play the previous theme of the current music
ld a,(keyboard_line_press+keyboard_line_1)
bit key_left,a
jr z,test_key_right
call change_theme_dec
test_key_right
;
; play the next theme of the current music
; if it is the last theme of the current music
; and
; if the music loop is disable
; then load and play next music (same as press "space")
; else play first theme of the current music
;
ld a,(keyboard_line_press+keyboard_line_0)
bit key_right,a
jr z,test_key_r
call change_theme_inc
test_key_r
;
; en/disable music loop
;
ld a,(keyboard_line_press+keyboard_line_6)
bit key_r,a
jr z,test_key_f
ld a,(set_music_loop_test)
xor #ff
ld (set_music_loop_test),a
or a
jr z,clear_text_music_repeat
ld hl,text_music_repeat
jr print_text_music_repeat_end
clear_text_music_repeat
ld hl,text_music_repeat_clear
print_text_music_repeat_end
call print_text
test_key_f
;
; en/disable a duration of only three minutes of the theme of the music
;
ld a,(keyboard_line_press+keyboard_line_6)
bit key_f,a
jr z,test_key_p
ld a,(force_currentmusic_duration_active)
xor #01
ld (force_currentmusic_duration_active),a
or a
jr z,clear_text_music_force_end
ld hl,text_music_force_end
jr print_text_music_force_end_end
clear_text_music_force_end
ld hl,text_music_force_end_clear
print_text_music_force_end_end
call print_text
call set_force_currentmusic_duration_timer
test_key_p
;
; activate display of PSG registers
; disable the display of spectrum analyzer
;
ld a,(keyboard_line_press+keyboard_line_3)
bit key_p,a
jr z,test_key_s
ld hl,draw_spectrum_analyzer
ld (hl),#c9
ld hl,print_psg_values
ld (hl),#21
ld hl,text_psg_values
call print_text
test_key_s
;
; activate the display of spectrum analyzer
; disable display of PSG registers
;
ld a,(keyboard_line_press+keyboard_line_7)
bit key_s,a
jr z,test_key_end
ld hl,print_psg_values
ld (hl),#c9
ld hl,draw_spectrum_analyzer
ld (hl),#cd
test_key_end
force_currentmusic_duration_active equ $+1
ld a,0
or a
jr z,no_force_currentmusic_duration
ld hl,time_counter_frame+2
ld a,(hl)
force_currentmusic_duration_counter equ $+1
cp FORCE_CURRENTMUSIC_DURATION
jr nz,test_inactivity_of_music
dec hl
ld a,(hl)
force_currentmusic_duration_counter_secs equ $+1
cp 0
jr nz,test_inactivity_of_music
dec hl
ld a,(hl)
force_currentmusic_duration_counter_frame equ $+1
cp 0
call z,change_theme_inc
;
test_inactivity_of_music
;
; test inactivity of music every second !
;
ld hl,(read_psg_value+8)
last_psg_value8 equ $+1
ld de,0
ld (last_psg_value8),hl
ld a,h
cp d
jr nz,reset_psg_value_same_as_last_vbl
ld a,l
cp e
jr nz,reset_psg_value_same_as_last_vbl
ld a,(read_psg_value+10)
last_psg_value10 equ $+1
ld b,0
ld (last_psg_value10),a
cp b
jr nz,reset_psg_value_same_as_last_vbl
ld hl,(read_psg_value+0)
last_psg_value0 equ $+1
ld de,0
ld (last_psg_value0),hl
ld a,h
cp d
jr nz,reset_psg_value_same_as_last_vbl
ld a,l
cp e
jr nz,reset_psg_value_same_as_last_vbl
ld hl,(read_psg_value+2)
last_psg_value2 equ $+1
ld de,0
ld (last_psg_value2),hl
ld a,h
cp d
jr nz,reset_psg_value_same_as_last_vbl
ld a,l
cp e
jr nz,reset_psg_value_same_as_last_vbl