LIJI32/SameBoy

Pocket Family (HuC-3) doesn’t do sound test

sfiera opened this issue · 3 comments

Pocket Family uses the HuC-3 mapper to support playing alarms while the Game Boy is off. SameBoy reports “Emulation of the integrated alarm in HuC-3 games” as a feature, and I was curious, so I went to try the alarm sound test.

On hardware, pressing start on the third item of the third menu here will do a sound test of the selected alarm tune:
Pocket Family GB: main menu Pocket Family GB: settings menu Pocket Family GB: alarm settings menu

I’ve selected きよし このよる, so it should play Silent Night through the cartridge speaker and block user input until the tune finishes playing. However, in SameBoy, nothing plays and it resumes accepting input immediately.

I’m not sure I’ve met all the prerequisites for HuC-3 emulation (or what prerequisites there are, if any). In the change notes, I see a reference to SameBoy requesting Notification permission, but it doesn’t seem that SameBoy has done so for me. The alarm settings don’t stick when I apply them either. Is there a way to confirm that HuC-3 emulation is actually active?

I’m using SameBoy 0.16.5 on Mac/Cocoa. I used a physical GBC and GBC in SameBoy. I checked with the following ROMs (both of which I dumped myself):

  • Pocket Family GB (SHA1 hash 162b0ab1fcfcf9b7ac888f137fedc41264219cf9)
  • Pocket Family GB 2 (SHA1 hash fc88fcf5aab548936cd6617c4e2ea07b77ee43c8)

I can provide a video of the expected behavior if requested. I’m familiar with SameBoy’s debugger, and could probably step through the mapper writes if needed.

By the way, poking around in the ROM, I see:

  • The string “きよし このよる” at $07:$64bd
  • The string’s address $64bd at $07:$6463
  • The song data is around $07:$5c59, excerpted below
  • I’m not sure of the pattern’s exact address, so it might be a few bytes off
0001dc50:                       01 f63c 4029 a748           ..<@).H
0001dc60: 1a38 6548 1a38 655f 3f6c 5d3d 685a 3a4d  .8eH.8e_?l]=hZ:M
0001dc70: 1c3a 481a 3865 5a3a 4d1c 3a48 1a38 65ad  .:H.8eZ:M.:H.8e.
0001dc80: 5333 4613 3061 65a7 3d38 3548 1633 3135  S3F.0ae.=85H.315
0001dc90: 387d b0                                  8}.

Specifically, that 48 1a 38 65 pattern is the “G₁₂₃ A₄ G₅₆ E₁₂₃₄₅₆” opening of Silent Night that repeats twice. Length in high nibble, pitch in low nibble.

Ah, and a7 / ad are setting the octave…

The debugger reports HuC-3 as it should; and no surprise that ROM bank 7 is mapped given the above.

>cartridge
Cartridge includes battery-backed RAM: $8000 bytes
HUC-3
Current mapped ROM bank: 7
Current mapped RAM bank: 3
RAM is currently enabled
Cart contains a real time clock