Commit fa71bd2

Nick committed on
Added 9xx - set duty
commit fa71bd25db52a50a16fb202fb763d5aa3a55ca11 parent 2a05bc1
1 changed files +96−14
Modifieddriver.z80 +96−14
@@ -122,7 +122,7 @@ DB "NF"
122 SECTION "Song Data", ROM0 122 SECTION "Song Data", ROM0
123 ;; order_cnt is the number of orders times 2 123 ;; order_cnt is the number of orders times 2
124 order_cnt: db 2 124 order_cnt: db 2
125 order1: dw notedelay, tfau_bass, unreal, unreal 125 order1: dw setduty, tfau_bass, unreal, unreal
126 order2: dw empty, tfau_arps, unreal_arps, unreal_arps 126 order2: dw empty, tfau_arps, unreal_arps, unreal_arps
127 order3: dw empty 127 order3: dw empty
128 order4: dw empty 128 order4: dw empty
@@ -186,6 +186,19 @@ rept 32
186 dn C5, 00, 00 186 dn C5, 00, 00
187 dn D#5, 00, $704 187 dn D#5, 00, $704
188 endr 188 endr
189 volslide:
190 dn C5, 00, 00
191 rept 64
192 dn 90, 00, $A01
193 endr
194 setduty:
195 dn C5, 00, $F04
196 rept 21
197 dn 90, 00, $900
198 dn 90, 00, $940
199 dn 90, 00, $980
200 dn 90, 00, $9C0
201 endr
189 202
190 SECTION "Playback variables", WRAM0 203 SECTION "Playback variables", WRAM0
191 pattern1: dw 204 pattern1: dw
@@ -579,8 +592,8 @@ _doeffect:
579 jp fx_no_op ;fx_vibrato_volslide ;6xy 592 jp fx_no_op ;fx_vibrato_volslide ;6xy
580 jp fx_note_delay ;7xy 593 jp fx_note_delay ;7xy
581 jp fx_no_op ;fx_set_pan ;8xy 594 jp fx_no_op ;fx_set_pan ;8xy
582 jp fx_no_op ;fx_set_duty ;9xy 595 jp fx_set_duty ;9xy
583 jp fx_no_op ;fx_vol_slide ;Axy 596 jp fx_vol_slide ;Axy
584 jp fx_pos_jump ;Bxy 597 jp fx_pos_jump ;Bxy
585 jp fx_set_volume ;Cxy 598 jp fx_set_volume ;Cxy
586 jp fx_pattern_break ;Dxy 599 jp fx_pattern_break ;Dxy
@@ -602,13 +615,80 @@ setup_channel_pointer:
602 add_a_to_hl 615 add_a_to_hl
603 ret 616 ret
604 617
605 return_if_tick_zero: MACRO
606 ret z
607 ENDM
608
609 fx_no_op: 618 fx_no_op:
610 ret 619 ret
611 620
621 fx_set_duty:
622 ret nz
623
624 ;; B: channel
625 ;; C: effect parameters
626
627 ;; free registers: A, D, E, H, L
628
629 ;; $900 = 12.5%
630 ;; $940 = 25%
631 ;; $980 = 50%
632 ;; $9C0 = 75%
633
634 ld a, b
635 or a ; cp 0
636 jp z, .chan1
637 .chan2:
638 ld a, c
639 ld [rAUD2LEN], a
640 ret
641 .chan1:
642 ld a, c
643 ld [rAUD1LEN], a
644 ret
645
646 fx_vol_slide:
647 ret nz
648
649 ;; This is really more of a "retrigger note with lower volume" effect and thus
650 ;; isn't really that useful. Instrument envelopes should be used instead.
651
652 ;; B: channel
653 ;; C: effect parameters
654
655 ;; free registers: A, D, E, H, L
656
657 ld d, 0
658 call setup_channel_pointer
659 ld a, [hl+]
660 ld e, [hl]
661 ld d, a
662
663 ld a, b
664 add a
665 ld hl, .envelope_registers
666 add_a_to_hl
667 ld a, [hl+]
668 ld h, [hl]
669 ld l, a
670
671 ld a, [hl]
672 and %11110000
673 swap a
674 sub c
675 swap a
676 ld [hl+], a
677
678 ld [hl], d
679 inc hl
680 ld a, e
681 or %10000000
682 ld [hl], a
683
684 ret
685
686 .envelope_registers:
687 dw rAUD1ENV
688 dw rAUD2ENV
689 dw rAUD4ENV
690 dw rAUD4ENV
691
612 fx_note_delay: 692 fx_note_delay:
613 ;; B: channel 693 ;; B: channel
614 ;; C: effect parameters 694 ;; C: effect parameters
@@ -768,7 +848,7 @@ set_chn_1_vol:
768 ret 848 ret
769 849
770 fx_vibrato: 850 fx_vibrato:
771 return_if_tick_zero 851 ret z
772 ;; B: channel 852 ;; B: channel
773 ;; C: effect parameters 853 ;; C: effect parameters
774 854
@@ -811,7 +891,7 @@ fx_vibrato:
811 jp _update_channel 891 jp _update_channel
812 892
813 fx_arpeggio: 893 fx_arpeggio:
814 return_if_tick_zero 894 ret z
815 ;; B: channel 895 ;; B: channel
816 ;; C: effect parameters 896 ;; C: effect parameters
817 897
@@ -858,7 +938,7 @@ fx_arpeggio:
858 jp _update_channel 938 jp _update_channel
859 939
860 fx_porta_up: 940 fx_porta_up:
861 return_if_tick_zero 941 ret z
862 ;; B: channel 942 ;; B: channel
863 ;; C: effect parameters 943 ;; C: effect parameters
864 944
@@ -883,7 +963,7 @@ fx_porta_up:
883 ;; TODO: Maybe merge with fx_porta_up, since they're so similar? Would need 963 ;; TODO: Maybe merge with fx_porta_up, since they're so similar? Would need
884 ;; to find a way to compare against effect code. 964 ;; to find a way to compare against effect code.
885 fx_porta_down: 965 fx_porta_down:
886 return_if_tick_zero 966 ret z
887 ;; B: channel 967 ;; B: channel
888 ;; C: effect parameters 968 ;; C: effect parameters
889 969
@@ -1026,13 +1106,15 @@ _dosound:
1026 or a 1106 or a
1027 jp nz, .process_effects 1107 jp nz, .process_effects
1028 1108
1029 ld a, %11110000
1030 ld [rAUD1ENV], a
1031
1032 loadShort pattern1, b, c 1109 loadShort pattern1, b, c
1033 ld de, channel_note1 1110 ld de, channel_note1
1034 call _lookup_note 1111 call _lookup_note
1035 1112
1113 jr nc, .continue
1114 ld a, %11110000
1115 ld [rAUD1ENV], a
1116
1117 .continue:
1036 ld a, h 1118 ld a, h
1037 ld [temp_note_value], a 1119 ld [temp_note_value], a
1038 ld a, l 1120 ld a, l