@@ -166,6 +166,17 @@ endr |
| 166 |
rept 32 |
166 |
rept 32 |
| 167 |
dn 90, 00, $205 |
167 |
dn 90, 00, $205 |
| 168 |
endr |
168 |
endr |
|
|
169 |
volset: |
|
|
170 |
dn C5, 00, $000 |
|
|
171 |
rept 32 |
|
|
172 |
dn 90, 00, $C90 |
|
|
173 |
dn 90, 00, $CF0 |
|
|
174 |
endr |
|
|
175 |
notecut: |
|
|
176 |
rept 32 |
|
|
177 |
dn C5, 00, $E04 |
|
|
178 |
dn 90, 00, $000 |
|
|
179 |
endr |
| 169 |
|
180 |
|
| 170 |
SECTION "Playback variables", WRAM0 |
181 |
SECTION "Playback variables", WRAM0 |
| 171 |
pattern1: dw |
182 |
pattern1: dw |
@@ -190,7 +201,8 @@ channel_period1: dw |
| 190 |
toneporta_target1: dw |
201 |
toneporta_target1: dw |
| 191 |
channel_note1: db |
202 |
channel_note1: db |
| 192 |
vibrato_tremolo_phase1: db |
203 |
vibrato_tremolo_phase1: db |
| 193 |
ds 2 ;; Just padding at the moment but may contain more stuff later |
204 |
envelope1: db |
|
|
205 |
ds 1 |
| 194 |
|
206 |
|
| 195 |
;;;;;;;;;;; |
207 |
;;;;;;;;;;; |
| 196 |
;;Channel 2 |
208 |
;;Channel 2 |
@@ -200,7 +212,8 @@ channel_period2: dw |
| 200 |
toneporta_target2: dw |
212 |
toneporta_target2: dw |
| 201 |
channel_note2: db |
213 |
channel_note2: db |
| 202 |
vibrato_tremolo_phase2: db |
214 |
vibrato_tremolo_phase2: db |
| 203 |
ds 2 |
215 |
envelope2: db |
|
|
216 |
ds 1 |
| 204 |
|
217 |
|
| 205 |
;;;;;;;;;;; |
218 |
;;;;;;;;;;; |
| 206 |
;;Channel 3 |
219 |
;;Channel 3 |
@@ -210,7 +223,8 @@ channel_period3: dw |
| 210 |
toneporta_target3: dw |
223 |
toneporta_target3: dw |
| 211 |
channel_note3: db |
224 |
channel_note3: db |
| 212 |
vibrato_tremolo_phase3: db |
225 |
vibrato_tremolo_phase3: db |
| 213 |
ds 2 |
226 |
envelope3: db |
|
|
227 |
ds 1 |
| 214 |
|
228 |
|
| 215 |
;;;;;;;;;;; |
229 |
;;;;;;;;;;; |
| 216 |
;;Channel 4 |
230 |
;;Channel 4 |
@@ -220,7 +234,8 @@ channel_period4: dw |
| 220 |
toneporta_target4: dw |
234 |
toneporta_target4: dw |
| 221 |
channel_note4: db |
235 |
channel_note4: db |
| 222 |
vibrato_tremolo_phase4: db |
236 |
vibrato_tremolo_phase4: db |
| 223 |
ds 2 |
237 |
envelope4: db |
|
|
238 |
ds 1 |
| 224 |
|
239 |
|
| 225 |
row: ds 1 |
240 |
row: ds 1 |
| 226 |
tick: ds 1 |
241 |
tick: ds 1 |
@@ -366,14 +381,9 @@ _convert_note: |
| 366 |
|
381 |
|
| 367 |
ld hl, note_table |
382 |
ld hl, note_table |
| 368 |
add_a_to_hl |
383 |
add_a_to_hl |
| 369 |
; LD H, 0 |
384 |
ld a, [hl+] |
| 370 |
; LD L, A |
385 |
ld h, [hl] |
| 371 |
; LD DE, note_table |
386 |
ld l, a |
| 372 |
; ADD HL, DE |
|
|
| 373 |
LD A, [HL+] |
|
|
| 374 |
;; INC HL |
|
|
| 375 |
LD H, [HL] |
|
|
| 376 |
LD L, A |
|
|
| 377 |
|
387 |
|
| 378 |
ccf ;; uh....? |
388 |
ccf ;; uh....? |
| 379 |
ret |
389 |
ret |
@@ -579,9 +589,9 @@ _doeffect: |
| 579 |
jp fx_no_op ;fx_set_duty ;9xy |
589 |
jp fx_no_op ;fx_set_duty ;9xy |
| 580 |
jp fx_no_op ;fx_vol_slide ;Axy |
590 |
jp fx_no_op ;fx_vol_slide ;Axy |
| 581 |
jp fx_no_op ;fx_pos_jump ;Bxy |
591 |
jp fx_no_op ;fx_pos_jump ;Bxy |
| 582 |
jp fx_no_op ;fx_set_volume ;Cxy |
592 |
jp fx_set_volume ;Cxy |
| 583 |
jp fx_no_op ;fx_pattern_break ;Dxy |
593 |
jp fx_no_op ;fx_pattern_break ;Dxy |
| 584 |
jp fx_no_op ;fx_note_cut ;Exy |
594 |
jp fx_note_cut ;Exy |
| 585 |
jp fx_no_op ;fx_set_speed ;Fxy |
595 |
jp fx_no_op ;fx_set_speed ;Fxy |
| 586 |
|
596 |
|
| 587 |
setup_channel_pointer: |
597 |
setup_channel_pointer: |
@@ -602,13 +612,57 @@ setup_channel_pointer: |
| 602 |
fx_no_op: |
612 |
fx_no_op: |
| 603 |
ret |
613 |
ret |
| 604 |
|
614 |
|
|
|
615 |
fx_note_cut: |
|
|
616 |
;; B: channel |
|
|
617 |
;; C: effect parameters |
|
|
618 |
|
|
|
619 |
;; free registers: A, D, E, H, L |
|
|
620 |
ld a, [tick] |
|
|
621 |
cp c |
|
|
622 |
ret nz |
|
|
623 |
|
|
|
624 |
ld d, 0 |
|
|
625 |
jp set_channel_volume |
|
|
626 |
|
| 605 |
fx_set_volume: |
627 |
fx_set_volume: |
| 606 |
;; B: channel |
628 |
;; B: channel |
| 607 |
;; C: effect parameters |
629 |
;; C: effect parameters |
| 608 |
|
630 |
|
| 609 |
;; free registers: A, D, E, H, L |
631 |
;; free registers: A, D, E, H, L |
| 610 |
|
632 |
|
|
|
633 |
;; Arguments to this effect will be massaged to correct form for the channel |
|
|
634 |
;; in the editor so we don't have to AND and SWAP and stuff. |
|
|
635 |
|
|
|
636 |
ld d, 6 |
|
|
637 |
call setup_channel_pointer |
| 611 |
|
638 |
|
|
|
639 |
ld d, [hl] |
|
|
640 |
|
|
|
641 |
set_channel_volume: |
|
|
642 |
;; Call with: |
|
|
643 |
;; Correct volume value in D |
|
|
644 |
;; Channel number in B |
|
|
645 |
|
|
|
646 |
ld a, b |
|
|
647 |
cp 1 ; check if it's channel 2 |
|
|
648 |
jr c, set_chn_1_vol |
|
|
649 |
jr z, set_chn_2_vol |
|
|
650 |
set_chn_3_vol: |
|
|
651 |
ld a, d |
|
|
652 |
ld [rAUD3LEVEL], a |
|
|
653 |
ret |
|
|
654 |
set_chn_2_vol: |
|
|
655 |
ld a, d |
|
|
656 |
and %00001111 |
|
|
657 |
or c |
|
|
658 |
ld [rAUD2ENV], a |
|
|
659 |
ret |
|
|
660 |
set_chn_1_vol: |
|
|
661 |
ld a, d |
|
|
662 |
and %00001111 |
|
|
663 |
or c |
|
|
664 |
ld [rAUD1ENV], a |
|
|
665 |
ret |
| 612 |
|
666 |
|
| 613 |
fx_vibrato: |
667 |
fx_vibrato: |
| 614 |
;; B: channel |
668 |
;; B: channel |
@@ -636,7 +690,7 @@ fx_vibrato: |
| 636 |
ld a, [hl] |
690 |
ld a, [hl] |
| 637 |
jr z, .go_up |
691 |
jr z, .go_up |
| 638 |
.restore: |
692 |
.restore: |
| 639 |
call _convert_note |
693 |
call _convert_note ;; just grab the current period instead?? |
| 640 |
jr .finish_vibrato |
694 |
jr .finish_vibrato |
| 641 |
.go_up: |
695 |
.go_up: |
| 642 |
call _convert_note |
696 |
call _convert_note |