For a few months now, it's been on my mind to find some way of playing non-Delta sampled sound while also being able to run a game. I have arrived at a couple possible obstacles, some of them being easier to overcome than others:
You absolutely need:
- A cycle-based IRQ counter
- Lots of space
- An NMI handler that doesn't need to do much
Of course the last of these severely limits the kind of genres worth considering.
The best option for my test was the FME-7 because it met the two mapper-related criteria. I find it interesting that this is far from eating all the available CPU time, yet still manages to produce tolerable results. Worst-case scenario, the game would have to deliberately play at 30FPS. The different cycle costs in all the different cases are following (with approx. 183 IRQs per frame to give a rate of 11kHz):
- Regular IRQ: 96 cycles
- On every 256th IRQ: 103 cycles
- On every 8 192nd IRQ (when the next 8k bank is needed): 114 cycles
- Jumping back to the loop point: 92 cycles
In a game, extra cycles should be added in order to return to the original bank, unless it is ok to lose 8k of the ROM window (which if I'm not mistaken, the FME-7 can also extend to $6000-$7FFF instead of having PRG-RAM there). Using other mappers might result in lower cycle counts though because the FME-7 requires 4 instructions to do any operation (selecting the internal address, sending data to it), and the IRQ counter has to be reloaded manually.
No matter what though, none of the available mappers have both a cycle-based IRQ and sufficient amount of PRG compatibility. The VRC3 would be one of the best options, if it had all 8 bits to select a 16k bank at $8000-$BFFF. So a custom extended version of the VRC3 could definitely work, or an UNROM setup with discrete logic and an extra IC for the IRQ functionality. The point is, there should be at least 2MB of space available.
Another issue, which I though would ruin the sound regardless, was OAM DMA. However, if you listen to the ROM with OAM DMA occurring every frame, it's difficult to notice the distortion. The DMA doesn't delay the streaming for too long, only for the time it would take to output 3 samples. Still, IRQs have to be enabled in the NMI, and a lot of VBlank time is lost.
The space issue could be mitigated by introducing some kind of other format. The time won by having easier mapper control with the "VRC3" could be traded in for things such as 4-bit DPCM, or 4-bit "ADPCM" where the 4 bits correspond to an entry in a 16-entry table which would hold what actually gets added to the current $4011 level.
Maybe you have come up with better ways of doing this already, but I wanted to give it a go anyway. I also realize that this is something crazy to build a game around, but it's not like games have never made huge sacrifices before to really push a certain aspect.
The song in the ROMs is the main theme of Crash Bandicoot: Warped for PlayStation.
You absolutely need:
- A cycle-based IRQ counter
- Lots of space
- An NMI handler that doesn't need to do much
Of course the last of these severely limits the kind of genres worth considering.
The best option for my test was the FME-7 because it met the two mapper-related criteria. I find it interesting that this is far from eating all the available CPU time, yet still manages to produce tolerable results. Worst-case scenario, the game would have to deliberately play at 30FPS. The different cycle costs in all the different cases are following (with approx. 183 IRQs per frame to give a rate of 11kHz):
- Regular IRQ: 96 cycles
- On every 256th IRQ: 103 cycles
- On every 8 192nd IRQ (when the next 8k bank is needed): 114 cycles
- Jumping back to the loop point: 92 cycles
In a game, extra cycles should be added in order to return to the original bank, unless it is ok to lose 8k of the ROM window (which if I'm not mistaken, the FME-7 can also extend to $6000-$7FFF instead of having PRG-RAM there). Using other mappers might result in lower cycle counts though because the FME-7 requires 4 instructions to do any operation (selecting the internal address, sending data to it), and the IRQ counter has to be reloaded manually.
No matter what though, none of the available mappers have both a cycle-based IRQ and sufficient amount of PRG compatibility. The VRC3 would be one of the best options, if it had all 8 bits to select a 16k bank at $8000-$BFFF. So a custom extended version of the VRC3 could definitely work, or an UNROM setup with discrete logic and an extra IC for the IRQ functionality. The point is, there should be at least 2MB of space available.
Another issue, which I though would ruin the sound regardless, was OAM DMA. However, if you listen to the ROM with OAM DMA occurring every frame, it's difficult to notice the distortion. The DMA doesn't delay the streaming for too long, only for the time it would take to output 3 samples. Still, IRQs have to be enabled in the NMI, and a lot of VBlank time is lost.
The space issue could be mitigated by introducing some kind of other format. The time won by having easier mapper control with the "VRC3" could be traded in for things such as 4-bit DPCM, or 4-bit "ADPCM" where the 4 bits correspond to an entry in a 16-entry table which would hold what actually gets added to the current $4011 level.
Maybe you have come up with better ways of doing this already, but I wanted to give it a go anyway. I also realize that this is something crazy to build a game around, but it's not like games have never made huge sacrifices before to really push a certain aspect.
The song in the ROMs is the main theme of Crash Bandicoot: Warped for PlayStation.