Commit 2a05bc1

Nick committed on
Implemented note delay
commit 2a05bc10c81b51d30275aa89605b2b8d1e870122 parent d707e50
1 changed files +64−5
Modifieddriver.z80 +64−5
@@ -121,9 +121,9 @@ DB "NF"
121 121
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 6 124 order_cnt: db 2
125 order1: dw tfau_bass, unreal, unreal ;; unreal ;; unreal;, lunawaves, lunawaves, unreal 125 order1: dw notedelay, tfau_bass, unreal, unreal
126 order2: dw tfau_arps, unreal_arps, unreal_arps ;; empty, unreal, unreal, lunawaves 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
129 129
@@ -181,6 +181,11 @@ rept 32
181 dn C5, 00, $E04 181 dn C5, 00, $E04
182 dn 90, 00, $000 182 dn 90, 00, $000
183 endr 183 endr
184 notedelay:
185 rept 32
186 dn C5, 00, 00
187 dn D#5, 00, $704
188 endr
184 189
185 SECTION "Playback variables", WRAM0 190 SECTION "Playback variables", WRAM0
186 pattern1: dw 191 pattern1: dw
@@ -306,7 +311,7 @@ _addr = _addr + 1
306 ld [envelope2], a 311 ld [envelope2], a
307 312
308 ;; Load starting speed (7 ticks per row) 313 ;; Load starting speed (7 ticks per row)
309 ld a, 4 314 ld a, 7
310 ld [ticks_per_row], a 315 ld [ticks_per_row], a
311 316
312 ; Enable sound globally 317 ; Enable sound globally
@@ -572,7 +577,7 @@ _doeffect:
572 jp fx_vibrato ;4xy 577 jp fx_vibrato ;4xy
573 jp fx_no_op ;fx_toneporta_volslide ;5xy 578 jp fx_no_op ;fx_toneporta_volslide ;5xy
574 jp fx_no_op ;fx_vibrato_volslide ;6xy 579 jp fx_no_op ;fx_vibrato_volslide ;6xy
575 jp fx_no_op ;fx_tremolo ;7xy 580 jp fx_note_delay ;7xy
576 jp fx_no_op ;fx_set_pan ;8xy 581 jp fx_no_op ;fx_set_pan ;8xy
577 jp fx_no_op ;fx_set_duty ;9xy 582 jp fx_no_op ;fx_set_duty ;9xy
578 jp fx_no_op ;fx_vol_slide ;Axy 583 jp fx_no_op ;fx_vol_slide ;Axy
@@ -604,6 +609,60 @@ ENDM
604 fx_no_op: 609 fx_no_op:
605 ret 610 ret
606 611
612 fx_note_delay:
613 ;; B: channel
614 ;; C: effect parameters
615
616 ;; free registers: A, D, E, H, L
617
618 jp nz, .play_note
619
620 ;; Just store the note into the channel period, and don't play a note.
621 ld d, 0
622 call setup_channel_pointer
623
624 ld a, [temp_note_value]
625 ld [hl+], a
626 ld a, [temp_note_value+1]
627 ld [hl], a
628
629 ;; Don't call _playnote. This is done by grabbing the return
630 ;; address and manually skipping the next call instruction.
631 pop hl
632 pop af
633 ld a, 6
634 add_a_to_hl
635 jp hl
636
637 .play_note:
638 ld a, [tick]
639 cp c
640 ret nz ; wait until the correct tick to play the note
641
642 ld d, 0
643 call setup_channel_pointer
644
645 ;; TODO: Change this to accept HL instead?
646 ld a, [hl+]
647 ld [temp_note_value], a
648 ld a, [hl]
649 ld [temp_note_value+1], a
650
651 ;; Generalize this somehow?
652
653 ld hl, .play_note_routines
654 ld a, b
655 add b
656 add b
657 add_a_to_hl
658 jp hl
659
660 .play_note_routines:
661 jp _playnote1
662 jp _playnote2
663 jp _playnote3
664 jp _playnote4
665
607 fx_set_speed: 666 fx_set_speed:
608 ret nz 667 ret nz
609 668