6

I was looking at a memory map of the DMG-CPU-03 soundchip in the original Game Boy and noticed the memory at registers FF27 through FF2F are unused:

Name Addr 7654 3210 Function
-----------------------------------------------------------------
       Square 1
NR10 FF10 -PPP NSSS Sweep period, negate, shift
NR11 FF11 DDLL LLLL Duty, Length load (64-L)
NR12 FF12 VVVV APPP Starting volume, Envelope add mode, period
NR13 FF13 FFFF FFFF Frequency LSB
NR14 FF14 TL-- -FFF Trigger, Length enable, Frequency MSB

       Square 2
     FF15 ---- ---- Not used
NR21 FF16 DDLL LLLL Duty, Length load (64-L)
NR22 FF17 VVVV APPP Starting volume, Envelope add mode, period
NR23 FF18 FFFF FFFF Frequency LSB
NR24 FF19 TL-- -FFF Trigger, Length enable, Frequency MSB

       Wave
NR30 FF1A E--- ---- DAC power
NR31 FF1B LLLL LLLL Length load (256-L)
NR32 FF1C -VV- ---- Volume code (00=0%, 01=100%, 10=50%, 11=25%)
NR33 FF1D FFFF FFFF Frequency LSB
NR34 FF1E TL-- -FFF Trigger, Length enable, Frequency MSB

       Noise
     FF1F ---- ---- Not used
NR41 FF20 --LL LLLL Length load (64-L)
NR42 FF21 VVVV APPP Starting volume, Envelope add mode, period
NR43 FF22 SSSS WDDD Clock shift, Width mode of LFSR, Divisor code
NR44 FF23 TL-- ---- Trigger, Length enable

       Control/Status
NR50 FF24 ALLL BRRR Vin L enable, Left vol, Vin R enable, Right vol
NR51 FF25 NW21 NW21 Left enables, Right enables
NR52 FF26 P--- NW21 Power control/status, Channel length statuses

       Not used
     FF27 ---- ----
     .... ---- ----
     FF2F ---- ----

       Wave Table
     FF30 0000 1111 Samples 0 and 1
     ....
     FF3F 0000 1111 Samples 30 and 31

Source

What are these memory locations used for if they are not holding samples?

5

According to the source you linked:

The value written to bits marked with '-' has no effect. Reference to the value in a register means the last value written to it.

However, it wouldn't surprise me if those registers are actually open bus -- instead of the last value written to that register, it could be the last value written to any register.

  • I think you were looking at the wrong bit in that document, about the "NRxx" registers, which the locations in question are not. The relevant line is, "$FF27-$FF2F always read back as $FF." As I explain in my answer, that's likely just generated by the sound device chip and not based on anything stored in it. – Curt J. Sampson Jul 24 at 15:16
4

Those "memory locations" are not used for anything; they don't exist.

The addresses exist, of course, becuase the CPU can generate them, but there's no RAM there.

Though you access these addresses as if you were talking to a RAM device, by reading and writing memory locations, remember that that's not actually what's happening. Instead you're talking to a completely different kind of device, the sound chip. It listens for requests to read or write data in that address range and, when it sees one of its addresses on the bus, it executes whatever commands it needs to based on the exact address, the contents of the data bus, and whether it's a read or write.

So when you generate a request to read FF27, the device that considers that one of its addresses says, "That doesn't mean anything to me, but I'll generate FF as a response." I'm not sure why the designers made it do that; perhaps it was easier than just ignoring it and not responding at all.

  • "I'm not sure why the designers made it do that" It's a complete guess, but with the wave table at FF3x it is probably easier to generate an (internal) "wave-table-select" line than if it were from FF27 to FF36 (or even FF28 to FF37 with just one unused location). (Of course – I assume – the actual number of address bits connected to the sound chip will be less than 16, so from the sound-chip's decoding POV, these address are more likely to be 27, 30 to 3F etc.). A "chip select" pin of some kind would ensure it only responds to the correct FFxx range). – TripeHound Jul 25 at 10:47
  • @TripeHound Yeah, it would very likely to be something to do with address decoding. My guess would be that it's not actually doing a "wave table select" for the unused addresses (I'd bet there's no RAM/latches/anything at all for them), but there's an overall "chip select" determining whether or not it responds that matches any address in $FF10-$FF3F, and they didn't want to add the extra logic to carve a hole in the middle of that, especially for an "odd" address like $FF27, which would require special decoding all of its own to differentiate it from $FF26. – Curt J. Sampson Jul 25 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.