Difference between revisions of "Andlabs/Time Trax"
From Sega Retro
Line 15: | Line 15: | ||
*$A word - third sample length BIG ENDIAN | *$A word - third sample length BIG ENDIAN | ||
and so on until the first PCM data byte | and so on until the first PCM data byte | ||
+ | |||
+ | ==PCM Sample Playback== | ||
+ | PCM samples are played back through a buffer: the game reads $80 bytes of sample data, then plays back one byte of ample data every so often. Buffer filling is done all at once and in groups of 8 bytes, with another PCM data write after each group of 8 bytes. | ||
+ | |||
+ | There appears to be a bug in the buffer loading code: | ||
+ | ROM:0B18 ld hl, (PCMSampleLength) | ||
+ | ROM:0B1B ld bc, 80h ; 'Ç' | ||
+ | ROM:0B1E sbc hl, bc | ||
+ | ROM:0B20 jp m, loc_C67 ; stops sample playback | ||
+ | ROM:0B23 ld (PCMSampleLength), hl | ||
+ | if I am reading this correctly, the game will stop playing samples if it cannot fill a buffer completely, leaving the tail end of samples unplayed |
Revision as of 01:57, 14 July 2013
There are only two sound banks.
- $F0000 - PCM samples
- $F8000 - music and SFX
everything fits neatly into its bank
PCM Sample Bank
The top of this bank contains pointer-length pairs for PCM samples. Pointers are relative to the Z80 memory map (so they are bank pointers). Pointers and lengths are big endian (this is NOT how things usually are done!)
Or in other words
- $0 word - first sample pointer BIG ENDIAN
- $2 word - first sample length BIG ENDIAN
- $4 word - second sample pointer BIG ENDIAN
- $6 word - second sample length BIG ENDIAN
- $8 word - third sample pointer BIG ENDIAN
- $A word - third sample length BIG ENDIAN
and so on until the first PCM data byte
PCM Sample Playback
PCM samples are played back through a buffer: the game reads $80 bytes of sample data, then plays back one byte of ample data every so often. Buffer filling is done all at once and in groups of 8 bytes, with another PCM data write after each group of 8 bytes.
There appears to be a bug in the buffer loading code:
ROM:0B18 ld hl, (PCMSampleLength) ROM:0B1B ld bc, 80h ; 'Ç' ROM:0B1E sbc hl, bc ROM:0B20 jp m, loc_C67 ; stops sample playback ROM:0B23 ld (PCMSampleLength), hl
if I am reading this correctly, the game will stop playing samples if it cannot fill a buffer completely, leaving the tail end of samples unplayed