ref: 6a9e929bf93badc306437104015d78b4bc339d25
parent: 5f0597e944144763fed4275db45a433a235c4448
author: Colton G. Rushton <[email protected]>
date: Fri Jun 17 19:29:09 EDT 2022
Remove rNR20/rNR40 and add rPCM12/rPCM34 (#947)
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -353,7 +353,7 @@
ldh a, [rNR52]
and %10001101 ; ch2 off
ldh [rNR52], a
- ld hl, rNR20
+ ld hl, rNR21 - 1 ; there is no rNR20
call ClearChannel
ret
@@ -491,7 +491,7 @@
ldh a, [rNR52]
and %10000111 ; ch4 off
ldh [rNR52], a
- ld hl, rNR40
+ ld hl, rNR41 - 1 ; there is no rNR40
call ClearChannel
ret
--- a/constants/hardware_constants.asm
+++ b/constants/hardware_constants.asm
@@ -82,7 +82,6 @@
DEF rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W)
DEF rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only)
DEF rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W)
-DEF rNR20 EQU $ff15 ; Channel 2 Sweep register (R/W)
DEF rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W)
DEF rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W)
DEF rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W)
@@ -92,7 +91,6 @@
DEF rNR32 EQU $ff1c ; Channel 3 Select output level (R/W)
DEF rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W)
DEF rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W)
-DEF rNR40 EQU $ff1f ; Channel 4 Sweep register (R/W)
DEF rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W)
DEF rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W)
DEF rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W)
@@ -163,6 +161,6 @@
DEF rUNKNOWN3 EQU $ff73 ; (00h) - Bit 0-7 (Read/Write)
DEF rUNKNOWN4 EQU $ff74 ; (00h) - Bit 0-7 (Read/Write) - CGB Mode Only
DEF rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write)
-DEF rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only)
-DEF rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only)
+DEF rPCM12 EQU $ff76 ; Channel 1 & 2 Amplitude (R)
+DEF rPCM34 EQU $ff77 ; Channel 3 & 4 Amplitude (R)
DEF rIE EQU $ffff ; Interrupt Enable (R/W)