@@ -122,8 +122,8 @@ 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 empty ;; unreal ;; unreal;, lunawaves, lunawaves, unreal |
125 |
order1: dw unreal ;; unreal ;; unreal;, lunawaves, lunawaves, unreal |
| 126 |
order2: dw arps ;; empty, unreal, unreal, lunawaves |
126 |
order2: dw unreal_arps ;; empty, unreal, unreal, lunawaves |
| 127 |
order3: dw empty, lunawaves, lunawaves, unreal |
127 |
order3: dw empty, lunawaves, lunawaves, unreal |
| 128 |
order4: dw empty, lunawaves, lunawaves, unreal |
128 |
order4: dw empty, lunawaves, lunawaves, unreal |
| 129 |
|
129 |
|
@@ -131,6 +131,8 @@ lunawaves: |
| 131 |
include "lunawaves.inc" |
131 |
include "lunawaves.inc" |
| 132 |
unreal: |
132 |
unreal: |
| 133 |
include "unreal.inc" |
133 |
include "unreal.inc" |
|
|
134 |
unreal_arps: |
|
|
135 |
include "unreal_arps.inc" |
| 134 |
empty: |
136 |
empty: |
| 135 |
rept 64 |
137 |
rept 64 |
| 136 |
db 90, 0, 0 |
138 |
db 90, 0, 0 |
@@ -416,7 +418,7 @@ _playnote1: |
| 416 |
;; Play a note on channel 1 (square wave) |
418 |
;; Play a note on channel 1 (square wave) |
| 417 |
strip_instrument |
419 |
strip_instrument |
| 418 |
|
420 |
|
| 419 |
jp nz, .no_toneporta |
421 |
jr nz, .no_toneporta |
| 420 |
ld a, h |
422 |
ld a, h |
| 421 |
ld [toneporta_target1+1], a |
423 |
ld [toneporta_target1+1], a |
| 422 |
ld a, l |
424 |
ld a, l |
@@ -449,7 +451,7 @@ _playnote2: |
| 449 |
;; Play a note on channel 2 (square wave) |
451 |
;; Play a note on channel 2 (square wave) |
| 450 |
strip_instrument |
452 |
strip_instrument |
| 451 |
|
453 |
|
| 452 |
jp nz, .no_toneporta |
454 |
jr nz, .no_toneporta |
| 453 |
ld a, h |
455 |
ld a, h |
| 454 |
ld [toneporta_target2+1], a |
456 |
ld [toneporta_target2+1], a |
| 455 |
ld a, l |
457 |
ld a, l |
@@ -479,7 +481,7 @@ _playnote3: |
| 479 |
;; Play a note on channel 3 (waveform) |
481 |
;; Play a note on channel 3 (waveform) |
| 480 |
strip_instrument |
482 |
strip_instrument |
| 481 |
|
483 |
|
| 482 |
jp nz, .no_toneporta |
484 |
jr nz, .no_toneporta |
| 483 |
ld a, h |
485 |
ld a, h |
| 484 |
ld [toneporta_target2+1], a |
486 |
ld [toneporta_target2+1], a |
| 485 |
ld a, l |
487 |
ld a, l |
@@ -600,10 +602,9 @@ fx_arpeggio: |
| 600 |
|
602 |
|
| 601 |
ld a, [tick] |
603 |
ld a, [tick] |
| 602 |
dec a |
604 |
dec a |
| 603 |
;; Multiply by 3 to get offset into table |
605 |
|
| 604 |
ld e, a |
606 |
;; Multiply by 2 to get offset into table |
| 605 |
add e |
607 |
add a |
| 606 |
add e |
|
|
| 607 |
|
608 |
|
| 608 |
ld d, [hl] |
609 |
ld d, [hl] |
| 609 |
|
610 |
|
@@ -612,23 +613,18 @@ fx_arpeggio: |
| 612 |
jp hl |
613 |
jp hl |
| 613 |
|
614 |
|
| 614 |
.arp_options: |
615 |
.arp_options: |
| 615 |
jp .set_arp1 |
616 |
jr .set_arp1 |
| 616 |
jp .set_arp2 |
617 |
jr .set_arp2 |
| 617 |
jp .reset_arp |
618 |
jr .reset_arp |
| 618 |
jp .set_arp1 |
619 |
jr .set_arp1 |
| 619 |
jp .set_arp2 |
620 |
jr .set_arp2 |
| 620 |
jp .set_arp1 |
|
|
| 621 |
jp .set_arp2 |
|
|
| 622 |
jp .reset_arp |
|
|
| 623 |
jp .set_arp1 |
|
|
| 624 |
jp .set_arp2 |
|
|
| 625 |
.reset_arp: |
621 |
.reset_arp: |
| 626 |
ld a, d |
622 |
ld a, d |
| 627 |
jp .finish_skip_add |
623 |
jr .finish_skip_add |
| 628 |
.set_arp2: |
624 |
.set_arp2: |
| 629 |
ld a, c |
625 |
ld a, c |
| 630 |
swap a |
626 |
swap a |
| 631 |
jp .finish_arp |
627 |
jr .finish_arp |
| 632 |
.set_arp1: |
628 |
.set_arp1: |
| 633 |
ld a, c |
629 |
ld a, c |
| 634 |
.finish_arp: |
630 |
.finish_arp: |
@@ -720,14 +716,14 @@ fx_toneporta: |
| 720 |
ld a, h |
716 |
ld a, h |
| 721 |
|
717 |
|
| 722 |
cp d |
718 |
cp d |
| 723 |
jp c, .subtract ; target is less than the current period |
719 |
jr c, .subtract ; target is less than the current period |
| 724 |
jp z, .high_byte_same |
720 |
jr z, .high_byte_same |
| 725 |
jp .add |
721 |
jr .add |
| 726 |
.high_byte_same: |
722 |
.high_byte_same: |
| 727 |
ld a, l |
723 |
ld a, l |
| 728 |
cp e |
724 |
cp e |
| 729 |
jp c, .subtract ; the target is less than the current period |
725 |
jr c, .subtract ; the target is less than the current period |
| 730 |
jp z, .done ; both nibbles are the same so no portamento |
726 |
jr z, .done ; both nibbles are the same so no portamento |
| 731 |
.add: |
727 |
.add: |
| 732 |
ld a, c |
728 |
ld a, c |
| 733 |
add a, e |
729 |
add a, e |
@@ -738,12 +734,12 @@ fx_toneporta: |
| 738 |
|
734 |
|
| 739 |
ld a, h |
735 |
ld a, h |
| 740 |
cp d |
736 |
cp d |
| 741 |
jp c, .set_exact |
737 |
jr c, .set_exact |
| 742 |
ld a, l |
738 |
ld a, l |
| 743 |
cp e |
739 |
cp e |
| 744 |
jp c, .set_exact |
740 |
jr c, .set_exact |
| 745 |
|
741 |
|
| 746 |
jp .done |
742 |
jr .done |
| 747 |
|
743 |
|
| 748 |
.subtract: |
744 |
.subtract: |
| 749 |
ld a, e |
745 |
ld a, e |
@@ -756,12 +752,12 @@ fx_toneporta: |
| 756 |
|
752 |
|
| 757 |
ld a, h |
753 |
ld a, h |
| 758 |
cp d |
754 |
cp d |
| 759 |
jp nc, .set_exact |
755 |
jr nc, .set_exact |
| 760 |
ld a, l |
756 |
ld a, l |
| 761 |
cp e |
757 |
cp e |
| 762 |
jp nc, .set_exact |
758 |
jr nc, .set_exact |
| 763 |
|
759 |
|
| 764 |
jp .done |
760 |
jr .done |
| 765 |
|
761 |
|
| 766 |
.set_exact: |
762 |
.set_exact: |
| 767 |
ld d, h |
763 |
ld d, h |
@@ -777,7 +773,7 @@ fx_toneporta: |
| 777 |
_dosound: |
773 |
_dosound: |
| 778 |
ld a, [tick] |
774 |
ld a, [tick] |
| 779 |
cp 0 |
775 |
cp 0 |
| 780 |
jp nz, .process_effects |
776 |
jr nz, .process_effects |
| 781 |
|
777 |
|
| 782 |
;; We're on tick zero, so lookup and play the notes, |
778 |
;; We're on tick zero, so lookup and play the notes, |
| 783 |
;; then return |
779 |
;; then return |
@@ -788,19 +784,19 @@ _dosound: |
| 788 |
|
784 |
|
| 789 |
loadShort pattern1, d, e |
785 |
loadShort pattern1, d, e |
| 790 |
call _lookup_note |
786 |
call _lookup_note |
| 791 |
jp nc, .after_note1 |
787 |
jr nc, .after_note1 |
| 792 |
call _playnote1 |
788 |
call _playnote1 |
| 793 |
|
789 |
|
| 794 |
.after_note1: |
790 |
.after_note1: |
| 795 |
loadShort pattern2, d, e |
791 |
loadShort pattern2, d, e |
| 796 |
call _lookup_note |
792 |
call _lookup_note |
| 797 |
jp nc, .after_note2 |
793 |
jr nc, .after_note2 |
| 798 |
call _playnote2 |
794 |
call _playnote2 |
| 799 |
|
795 |
|
| 800 |
.after_note2: |
796 |
.after_note2: |
| 801 |
loadShort pattern3, d, e |
797 |
loadShort pattern3, d, e |
| 802 |
call _lookup_note |
798 |
call _lookup_note |
| 803 |
jp nc, .after_note3 |
799 |
jr nc, .after_note3 |
| 804 |
call _playnote3 |
800 |
call _playnote3 |
| 805 |
|
801 |
|
| 806 |
.after_note3: |
802 |
.after_note3: |
@@ -868,7 +864,7 @@ _newrow: |
| 868 |
ld a, [row] |
864 |
ld a, [row] |
| 869 |
inc a |
865 |
inc a |
| 870 |
cp PATTERN_LENGTH |
866 |
cp PATTERN_LENGTH |
| 871 |
jp nz, .noreset |
867 |
jr nz, .noreset |
| 872 |
|
868 |
|
| 873 |
;; Increment order and change loaded patterns |
869 |
;; Increment order and change loaded patterns |
| 874 |
ld a, [order_cnt] |
870 |
ld a, [order_cnt] |
@@ -876,7 +872,7 @@ _newrow: |
| 876 |
ld a, [current_order] |
872 |
ld a, [current_order] |
| 877 |
add a, 2 |
873 |
add a, 2 |
| 878 |
cp b |
874 |
cp b |
| 879 |
jp nz, .update_current_order |
875 |
jr nz, .update_current_order |
| 880 |
ld a, 0 |
876 |
ld a, 0 |
| 881 |
.update_current_order: |
877 |
.update_current_order: |
| 882 |
ld [current_order], a |
878 |
ld [current_order], a |
@@ -897,7 +893,7 @@ _halt: |
| 897 |
; Do nothing, forever |
893 |
; Do nothing, forever |
| 898 |
halt |
894 |
halt |
| 899 |
nop |
895 |
nop |
| 900 |
jp _halt |
896 |
jr _halt |
| 901 |
|
897 |
|
| 902 |
SECTION "Wave stuff", ROM0 |
898 |
SECTION "Wave stuff", ROM0 |
| 903 |
|
899 |
|