08-26-2012, 09:50 PM
Here's another short example for the NGPC in C: Download
This one shows how you can play a stereo PCM stream through the audio DACs by combining a timer and an uDMA channel.
Note that the ROM doesn't work in Mednafen (as of 0.9.21) because Mednafen appears to run the timer too slow compared to a real NGPC, and more importantly it skips uDMA transfers with an initial transfer count (DMACn) of 0 instead of interpreting the 0 as 65536 like it should. The ROM works fine on a real NGPC though.
Compiles with Toshiba's compiler.
This one shows how you can play a stereo PCM stream through the audio DACs by combining a timer and an uDMA channel.
Note that the ROM doesn't work in Mednafen (as of 0.9.21) because Mednafen appears to run the timer too slow compared to a real NGPC, and more importantly it skips uDMA transfers with an initial transfer count (DMACn) of 0 instead of interpreting the 0 as 65536 like it should. The ROM works fine on a real NGPC though.
Compiles with Toshiba's compiler.