@@ -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 7 |
39 |
TICKS EQU 4 |
| 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 unreal ;; unreal ;; unreal;, lunawaves, lunawaves, unreal |
125 |
order1: dw tfau_bass ;; unreal ;; unreal;, lunawaves, lunawaves, unreal |
| 126 |
order2: dw unreal_arps ;; empty, unreal, unreal, lunawaves |
126 |
order2: dw tfau_arps ;; empty, unreal, unreal, lunawaves |
| 127 |
order3: dw empty |
127 |
order3: dw empty |
| 128 |
order4: dw empty |
128 |
order4: dw empty |
| 129 |
|
129 |
|
@@ -382,17 +382,18 @@ _lookup_note: |
| 382 |
ld b, a |
382 |
ld b, a |
| 383 |
|
383 |
|
| 384 |
ld a, [hl] |
384 |
ld a, [hl] |
| 385 |
|
385 |
ld hl, 0 |
| 386 |
;; Store the loaded note value in channel_noteX |
|
|
| 387 |
ld h, d |
|
|
| 388 |
ld l, e |
|
|
| 389 |
ld [hl], a |
|
|
| 390 |
|
386 |
|
| 391 |
;; If the note we found is greater than LAST_NOTE, then it's not a valid note |
387 |
;; If the note we found is greater than LAST_NOTE, then it's not a valid note |
| 392 |
;; and nothing needs to be updated. |
388 |
;; and nothing needs to be updated. |
| 393 |
cp LAST_NOTE |
389 |
cp LAST_NOTE |
| 394 |
ret nc |
390 |
ret nc |
| 395 |
|
391 |
|
|
|
392 |
;; Store the loaded note value in channel_noteX |
|
|
393 |
ld h, d |
|
|
394 |
ld l, e |
|
|
395 |
ld [hl], a |
|
|
396 |
|
| 396 |
_convert_note: |
397 |
_convert_note: |
| 397 |
;; Call with: |
398 |
;; Call with: |
| 398 |
;; Note number in A |
399 |
;; Note number in A |
@@ -812,20 +813,17 @@ fx_toneporta: |
| 812 |
jr nz, .do_toneporta |
813 |
jr nz, .do_toneporta |
| 813 |
|
814 |
|
| 814 |
;; We're on tick zero, so just move the temp note value into the toneporta target. |
815 |
;; We're on tick zero, so just move the temp note value into the toneporta target. |
| 815 |
ld d, 4 |
816 |
ld d, 2 |
| 816 |
call setup_channel_pointer |
817 |
call setup_channel_pointer |
| 817 |
|
818 |
|
| 818 |
;; If the note is nonexistent, then just return |
819 |
;; If the note is nonexistent, then just return |
| 819 |
ld a, [hl-] |
|
|
| 820 |
cp LAST_NOTE |
|
|
| 821 |
jr nc, .return_skip |
|
|
| 822 |
|
|
|
| 823 |
ld a, [temp_note_value+1] |
820 |
ld a, [temp_note_value+1] |
| 824 |
ld c, a |
821 |
or a |
| 825 |
ld a, [temp_note_value] |
822 |
jr z, .return_skip |
| 826 |
|
823 |
|
| 827 |
ld [hl-], a |
824 |
ld [hl+], a |
| 828 |
ld [hl], c |
825 |
ld a, [temp_note_value] |
|
|
826 |
ld [hl], a |
| 829 |
|
827 |
|
| 830 |
;; Don't call _playnote. This is done by grabbing the return |
828 |
;; Don't call _playnote. This is done by grabbing the return |
| 831 |
;; address and manually skipping the next call instruction. |
829 |
;; address and manually skipping the next call instruction. |
@@ -931,11 +929,11 @@ _dosound: |
| 931 |
or a |
929 |
or a |
| 932 |
jp nz, .process_effects |
930 |
jp nz, .process_effects |
| 933 |
|
931 |
|
| 934 |
;; remove this |
|
|
| 935 |
ld a, %11110000 |
932 |
ld a, %11110000 |
| 936 |
ld [rAUD1ENV], a |
933 |
ld [rAUD1ENV], a |
| 937 |
|
934 |
|
| 938 |
loadShort pattern1, b, c |
935 |
loadShort pattern1, b, c |
|
|
936 |
ld de, channel_note1 |
| 939 |
call _lookup_note |
937 |
call _lookup_note |
| 940 |
|
938 |
|
| 941 |
ld a, h |
939 |
ld a, h |
@@ -965,6 +963,7 @@ _dosound: |
| 965 |
ld [rAUD2ENV], a |
963 |
ld [rAUD2ENV], a |
| 966 |
|
964 |
|
| 967 |
loadShort pattern2, b, c |
965 |
loadShort pattern2, b, c |
|
|
966 |
ld de, channel_note2 |
| 968 |
call _lookup_note |
967 |
call _lookup_note |
| 969 |
|
968 |
|
| 970 |
ld a, h |
969 |
ld a, h |
@@ -988,6 +987,9 @@ _dosound: |
| 988 |
|
987 |
|
| 989 |
call _playnote2 ; 3 bytes |
988 |
call _playnote2 ; 3 bytes |
| 990 |
|
989 |
|
|
|
990 |
|
|
|
991 |
|
|
|
992 |
|
| 991 |
; loadShort pattern2, b, c |
993 |
; loadShort pattern2, b, c |
| 992 |
; call _lookup_note |
994 |
; call _lookup_note |
| 993 |
; jr nc, .after_note2 |
995 |
; jr nc, .after_note2 |
@@ -1038,6 +1040,7 @@ _dosound: |
| 1038 |
;; Only do effects if not on tick zero |
1040 |
;; Only do effects if not on tick zero |
| 1039 |
|
1041 |
|
| 1040 |
loadShort pattern1, b, c |
1042 |
loadShort pattern1, b, c |
|
|
1043 |
ld de, channel_note1 |
| 1041 |
call _lookup_note |
1044 |
call _lookup_note |
| 1042 |
|
1045 |
|
| 1043 |
ld a, c |
1046 |
ld a, c |
@@ -1049,6 +1052,7 @@ _dosound: |
| 1049 |
|
1052 |
|
| 1050 |
.after_effect1: |
1053 |
.after_effect1: |
| 1051 |
loadShort pattern2, b, c |
1054 |
loadShort pattern2, b, c |
|
|
1055 |
ld de, channel_note2 |
| 1052 |
call _lookup_note |
1056 |
call _lookup_note |
| 1053 |
|
1057 |
|
| 1054 |
ld a, c |
1058 |
ld a, c |