@@ -36,7 +36,7 @@ STACK_SIZE EQU 20 |
| 36 |
;; Stack starts at $FFFE |
36 |
;; Stack starts at $FFFE |
| 37 |
|
37 |
|
| 38 |
PATTERN_LENGTH EQU 64 |
38 |
PATTERN_LENGTH EQU 64 |
| 39 |
TICKS EQU 4 |
39 |
TICKS EQU 7 |
| 40 |
|
40 |
|
| 41 |
; $0000 - $003F: RST handlers. |
41 |
; $0000 - $003F: RST handlers. |
| 42 |
|
42 |
|
@@ -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 tfau_bass ;; unreal ;; unreal;, lunawaves, lunawaves, unreal |
125 |
order1: dw unreal ;; unreal ;; unreal;, lunawaves, lunawaves, unreal |
| 126 |
order2: dw empty ;; empty, unreal, unreal, lunawaves |
126 |
order2: dw unreal_arps ;; empty, unreal, unreal, lunawaves |
| 127 |
order3: dw empty |
127 |
order3: dw empty |
| 128 |
order4: dw empty |
128 |
order4: dw empty |
| 129 |
|
129 |
|
@@ -629,7 +629,6 @@ fx_note_cut: |
| 629 |
jp set_channel_volume |
629 |
jp set_channel_volume |
| 630 |
|
630 |
|
| 631 |
fx_set_volume: |
631 |
fx_set_volume: |
| 632 |
ret |
|
|
| 633 |
ret nz ;; Return if we're not on tick zero. |
632 |
ret nz ;; Return if we're not on tick zero. |
| 634 |
|
633 |
|
| 635 |
;; B: channel |
634 |
;; B: channel |
@@ -640,9 +639,6 @@ fx_set_volume: |
| 640 |
;; Arguments to this effect will be massaged to correct form for the channel |
639 |
;; Arguments to this effect will be massaged to correct form for the channel |
| 641 |
;; in the editor so we don't have to AND and SWAP and stuff. |
640 |
;; in the editor so we don't have to AND and SWAP and stuff. |
| 642 |
|
641 |
|
| 643 |
ld d, 6 |
|
|
| 644 |
call setup_channel_pointer |
|
|
| 645 |
|
|
|
| 646 |
set_channel_volume: |
642 |
set_channel_volume: |
| 647 |
;; Call with: |
643 |
;; Call with: |
| 648 |
;; Correct volume value in D |
644 |
;; Correct volume value in D |
@@ -656,25 +652,14 @@ set_chn_3_vol: |
| 656 |
ld a, d |
652 |
ld a, d |
| 657 |
ld [rAUD3LEVEL], a |
653 |
ld [rAUD3LEVEL], a |
| 658 |
|
654 |
|
| 659 |
; ld a, [temp_note_value] |
|
|
| 660 |
; ld h, a |
|
|
| 661 |
; ld a, [temp_note_value+1] |
|
|
| 662 |
; ld l, a |
|
|
| 663 |
; call playnote3 |
|
|
| 664 |
|
|
|
| 665 |
ret |
655 |
ret |
| 666 |
set_chn_2_vol: |
656 |
set_chn_2_vol: |
| 667 |
ld a, d |
657 |
; ld a, d |
| 668 |
and %00001111 |
658 |
; and %00001111 |
| 669 |
or c |
659 |
; or c |
|
|
660 |
ld a, c |
| 670 |
ld [rAUD2ENV], a |
661 |
ld [rAUD2ENV], a |
| 671 |
|
662 |
|
| 672 |
ld a, [temp_note_value] |
|
|
| 673 |
ld h, a |
|
|
| 674 |
ld a, [temp_note_value+1] |
|
|
| 675 |
ld l, a |
|
|
| 676 |
call _playnote2 |
|
|
| 677 |
|
|
|
| 678 |
ret |
663 |
ret |
| 679 |
set_chn_1_vol: |
664 |
set_chn_1_vol: |
| 680 |
ld a, d |
665 |
ld a, d |
@@ -682,18 +667,7 @@ set_chn_1_vol: |
| 682 |
or c |
667 |
or c |
| 683 |
ld [rAUD1ENV], a |
668 |
ld [rAUD1ENV], a |
| 684 |
|
669 |
|
| 685 |
ld a, [temp_note_value] |
670 |
ret |
| 686 |
ld h, a |
|
|
| 687 |
ld a, [temp_note_value+1] |
|
|
| 688 |
ld l, a |
|
|
| 689 |
call _playnote1 |
|
|
| 690 |
|
|
|
| 691 |
;; Don't call _playnote. This is done by grabbing the return |
|
|
| 692 |
;; address and manually skipping the next call instruction. |
|
|
| 693 |
pop hl |
|
|
| 694 |
ld a, 3 |
|
|
| 695 |
add_a_to_hl |
|
|
| 696 |
jp hl |
|
|
| 697 |
|
671 |
|
| 698 |
fx_vibrato: |
672 |
fx_vibrato: |
| 699 |
return_if_tick_zero |
673 |
return_if_tick_zero |
@@ -833,8 +807,9 @@ fx_porta_down: |
| 833 |
|
807 |
|
| 834 |
jp _update_channel |
808 |
jp _update_channel |
| 835 |
|
809 |
|
|
|
810 |
;; TODO: Figure out why this is not toneporta-ing as much as it used to. so bizarre... |
| 836 |
fx_toneporta: |
811 |
fx_toneporta: |
| 837 |
jp nz, .do_toneporta |
812 |
jr nz, .do_toneporta |
| 838 |
|
813 |
|
| 839 |
;; We're on tick zero, so just move the temp note value into the toneporta target. |
814 |
;; We're on tick zero, so just move the temp note value into the toneporta target. |
| 840 |
ld d, 4 |
815 |
ld d, 4 |
@@ -843,7 +818,7 @@ fx_toneporta: |
| 843 |
;; If the note is nonexistent, then just return |
818 |
;; If the note is nonexistent, then just return |
| 844 |
ld a, [hl-] |
819 |
ld a, [hl-] |
| 845 |
cp LAST_NOTE |
820 |
cp LAST_NOTE |
| 846 |
ret nc |
821 |
jr nc, .return_skip |
| 847 |
|
822 |
|
| 848 |
ld a, [temp_note_value+1] |
823 |
ld a, [temp_note_value+1] |
| 849 |
ld c, a |
824 |
ld c, a |
@@ -854,6 +829,7 @@ fx_toneporta: |
| 854 |
|
829 |
|
| 855 |
;; Don't call _playnote. This is done by grabbing the return |
830 |
;; Don't call _playnote. This is done by grabbing the return |
| 856 |
;; address and manually skipping the next call instruction. |
831 |
;; address and manually skipping the next call instruction. |
|
|
832 |
.return_skip: |
| 857 |
pop hl |
833 |
pop hl |
| 858 |
pop af |
834 |
pop af |
| 859 |
ld a, 14 |
835 |
ld a, 14 |
@@ -866,7 +842,7 @@ fx_toneporta: |
| 866 |
|
842 |
|
| 867 |
;; free registers: A, D, E, H, L |
843 |
;; free registers: A, D, E, H, L |
| 868 |
|
844 |
|
| 869 |
;; TOOD: Optimize. This usage of the stack isn't great but IMO it's |
845 |
;; TODO: Optimize. This usage of the stack isn't great but IMO it's |
| 870 |
;; better than using the stack hack which forces all effects to screw with |
846 |
;; better than using the stack hack which forces all effects to screw with |
| 871 |
;; pushing and popping. Most effects won't need to do this. |
847 |
;; pushing and popping. Most effects won't need to do this. |
| 872 |
ld d, 0 |
848 |
ld d, 0 |
@@ -984,6 +960,34 @@ _dosound: |
| 984 |
call _playnote1 ; 3 bytes |
960 |
call _playnote1 ; 3 bytes |
| 985 |
|
961 |
|
| 986 |
.after_note1: |
962 |
.after_note1: |
|
|
963 |
;; remove this |
|
|
964 |
ld a, %11110000 |
|
|
965 |
ld [rAUD2ENV], a |
|
|
966 |
|
|
|
967 |
loadShort pattern2, b, c |
|
|
968 |
call _lookup_note |
|
|
969 |
|
|
|
970 |
ld a, h |
|
|
971 |
ld [temp_note_value], a |
|
|
972 |
ld a, l |
|
|
973 |
ld [temp_note_value+1], a |
|
|
974 |
|
|
|
975 |
push af |
|
|
976 |
|
|
|
977 |
ld e, 1 |
|
|
978 |
call _doeffect |
|
|
979 |
|
|
|
980 |
pop af |
|
|
981 |
|
|
|
982 |
jr nc, .after_note2 |
|
|
983 |
|
|
|
984 |
ld a, [temp_note_value] |
|
|
985 |
ld h, a |
|
|
986 |
ld a, [temp_note_value+1] |
|
|
987 |
ld l, a |
|
|
988 |
|
|
|
989 |
call _playnote2 ; 3 bytes |
|
|
990 |
|
| 987 |
; loadShort pattern2, b, c |
991 |
; loadShort pattern2, b, c |
| 988 |
; call _lookup_note |
992 |
; call _lookup_note |
| 989 |
; jr nc, .after_note2 |
993 |
; jr nc, .after_note2 |
@@ -1044,15 +1048,15 @@ _dosound: |
| 1044 |
call _doeffect |
1048 |
call _doeffect |
| 1045 |
|
1049 |
|
| 1046 |
.after_effect1: |
1050 |
.after_effect1: |
| 1047 |
; loadShort pattern2, b, c |
1051 |
loadShort pattern2, b, c |
| 1048 |
; call _lookup_note |
1052 |
call _lookup_note |
| 1049 |
|
1053 |
|
| 1050 |
; ld a, c |
1054 |
ld a, c |
| 1051 |
; cp 0 |
1055 |
cp 0 |
| 1052 |
; jr z, .after_effect2 |
1056 |
jr z, .after_effect2 |
| 1053 |
|
1057 |
|
| 1054 |
; ld e, 1 |
1058 |
ld e, 1 |
| 1055 |
; call _doeffect |
1059 |
call _doeffect |
| 1056 |
|
1060 |
|
| 1057 |
.after_effect2: |
1061 |
.after_effect2: |
| 1058 |
; loadShort pattern3, b, c |
1062 |
; loadShort pattern3, b, c |