Commit 40eb501

Nick committed on
Fixing bug with channel 4 update, channel 3 volume stuff
commit 40eb5019f0a29a8ab0f6152d357a8ec9538683f7 parent 556ec6a
1 changed files +53−10
Modifieddriver.z80 +53−10
@@ -119,13 +119,19 @@ DS 1
119 ; $0144 - $0145: "New" Licensee Code, a two character name. 119 ; $0144 - $0145: "New" Licensee Code, a two character name.
120 DB "NF" 120 DB "NF"
121 121
122 dn: MACRO ;; (note, instr, effect)
123 db \1
124 db ((\2 << 4) | (\3 >> 8))
125 db LOW(\3)
126 ENDM
127
122 SECTION "Song Data", ROM0 128 SECTION "Song Data", ROM0
123 ;; order_cnt is the number of orders times 2 129 ;; order_cnt is the number of orders times 2
124 order_cnt: db 2 130 order_cnt: db 2
125 order1: dw unreal, tfau_bass, unreal, unreal 131 order1: dw unreal, unreal, unreal
126 order2: dw unreal_arps, tfau_arps, unreal_arps, unreal_arps 132 order2: dw empty, unreal_arps, unreal_arps
127 order3: dw empty 133 order3: dw empty
128 order4: dw drums 134 order4: dw empty
129 135
130 lunawaves: 136 lunawaves:
131 include "lunawaves.inc" 137 include "lunawaves.inc"
@@ -143,13 +149,19 @@ rept 64
143 endr 149 endr
144 drums: 150 drums:
145 rept 16 151 rept 16
146 db 44, 0, 0 152 db C4, 0, 0
147 db 90, 0, 0 153 db 90, 0, 0
148 db 90, 0, 0 154 db 90, 0, 0
149 db 90, 0, 0 155 db 90, 0, 0
150 endr 156 endr
157 walkup:
158 _ASDF = C3
159 rept 64
160 dn _ASDF, 0, 0
161 _ASDF = _ASDF + 1
162 endr
151 slideup: 163 slideup:
152 dn C4, 00, $000 164 dn C3, 00, $000
153 rept 63 165 rept 63
154 dn 90, 00, $101 166 dn 90, 00, $101
155 endr 167 endr
@@ -488,7 +500,10 @@ _update_channel3:
488 ld [rAUD3HIGH], a 500 ld [rAUD3HIGH], a
489 ret 501 ret
490 _update_channel4: 502 _update_channel4:
491 503 call _quantize_channel4_note
504 ld [rAUD4POLY], a
505 ld a, %00000000
506 ld [rAUD4GO], a
492 ret 507 ret
493 508
494 strip_instrument: MACRO 509 strip_instrument: MACRO
@@ -550,17 +565,40 @@ _playnote4:
550 565
551 ;; Play a "note" on channel 4 (noise) 566 ;; Play a "note" on channel 4 (noise)
552 567
553 ld a, %00011111 568 ; ld a, %11110001
554 ld [rAUD4LEN], a 569 ; ld [rAUD4ENV], a
555 ld a, %11110001 570
556 ld [rAUD4ENV], a
557 ld a, [temp_note_value+1] 571 ld a, [temp_note_value+1]
572 ld [channel_period4], a
573 ld e, a
574
575 ld a, [temp_note_value]
576 ld [channel_period4+1], a
577 ld d, a
578
579 call _quantize_channel4_note
580
558 ld [rAUD4POLY], a 581 ld [rAUD4POLY], a
559 ld a, %10000000 582 ld a, %10000000
560 ld [rAUD4GO], a 583 ld [rAUD4GO], a
561 584
562 ret 585 ret
563 586
587 _quantize_channel4_note:
588 ;; Shift the "note value" right by 7 to get a spread from 0 to 15.
589 ;; Keep just the upmost bit of the lower byte
590 ld a, e
591 and %10000000
592 rla
593 ld c, a
594
595 ;; Keep the entire upper byte (but it's never the full 8 bits)
596 ld a, d
597 rla
598 or c
599 swap a
600 ret
601
564 _doeffect: 602 _doeffect:
565 ;; Call with: 603 ;; Call with:
566 ;; B: instrument nibble + effect type nibble 604 ;; B: instrument nibble + effect type nibble
@@ -1246,6 +1284,11 @@ _dosound:
1246 ld de, channel_note3 1284 ld de, channel_note3
1247 call _lookup_note 1285 call _lookup_note
1248 1286
1287 jr nc, .do_setvol3
1288 ld a, %00100000
1289 ld [rAUD3LEVEL], a
1290
1291 .do_setvol3:
1249 ld a, h 1292 ld a, h
1250 ld [temp_note_value], a 1293 ld [temp_note_value], a
1251 ld a, l 1294 ld a, l