I thought this deserved it's own topic.
Take this driver and compress it in the S1 ROM anywhere you like (Kosinski), and make sure to read the notes below. It's much smaller than the other driver because the PCm samples formerly found in the z80 ram are no longer there
http://www.cgi101.co...050/z80_new.bin
New S1 Music Driver notes:
PCM playing is controlled by a table located at offset $200 of the uncompressed sound driver. The table's format is as follows.
Bytes 1/2 - The location of the PCM sample in the bank of the ROM pointed to by bytes 6/7. $8000-based, little-endian
Bytes 3/4 - The size of the PCM sample in words (bytes/2)
Byte 5 - Sample rate/Pitch
Bytes 6/7 - Rom Bank. Format is upper 9-bits of a 16-bit word, little endian (for easy conversion, take the start of the bank in ROM for example, offset $88000, and divide it by $100).
Byte 8 - unused
There are 14 slots of 8 bytes each for PCM definitions. To play them, just write $81 + the slot number (0-based) to $1FFF of the Z80 RAM area.
Writing $90 to $1FFFwill play the sega sound. The bank location of this is still hardcoded, so instead, make a new definition for the Sega sound in an open PCM definition slot. This method of playing the Sega sound is depreciated.
Writing $8F to $1FFF will play the multi-bank PCM (since we're playing slot $E, and $E + $81 is $8F). This is controlled by the 15th and final slot of the PCM table (slot $E). The format for the multi-bank PCM is a bit different.
Bytes 1/2 - Same
Bytes 3/4 - Size of the FIRST SECTION of the PCM sample in BYTES. Not WORDS.
Byte 5 - Same
Byte 6/7 - Same, with one note: The lower 7 bits MUST be zero for the bank switching to work properly
byte 8 - Number of banks to span when playing the file.
The rom bank is the starting bank of the PCM. The size refers to the number of bytes the PCm takes up in the FIRST bank. NOT the total size of the sample. This is because after this initial size when used as a counter is exhausted, it switches to the ROm bank and assumes a start position of $8000 and a size of $8000. Because of this, the routine will always end playing at the end of a bank. For this reason, make sure to position your PCM samples so that the very end of it coincides with the very end of a ROM bank.
NOTE ON CHANGING THE NUMBER OF PCM SLOTS.
The default behavior of the driver is 14 PCM slots and 1 multi-bank PCM slot for a total of 15 slots. However, this can easily be changed. First, you have to change when the sega sound is played. To do that, go to offset $3D of the uncompressed file. The default is $0F. Change this to the number of slots you want (so if you want 18 slots, change it to $12). Do note that this will change the value you need to put into $1FFF in your game code in order to play the sega sound. This is the value of offset $3D + $81 (so in the previous example, you'd need to play $93 ($12+$81) into $1FFF). Then just apped the extra PCM data to the end of the table. There's plenty of RAM in the z80, so you can have an endless amount of PCM samples.
You can also change the number of multi-bank PCM slots. Note that these will always be at te end of the PCM table, no matter how long it is. To do this, go to offset $96. The default is $E. This desribes which slot number to begin defining multi-bank PCM samples. So if you, for example, change it to $C, then every slot in the table from $C onward will be a multi-bank PCM definition. Combined with the change of the number of slots above, this would give you 12 normal PCM slots and 6 multi-bank PCm slots (lots 0-$B and slots $C-$11 respectively.
And now, finally, the default behavior of this sound driver. These are my settings to test the driver with the uncompressed drum DAC samples from S1, as well as a custom PCM sample I played across multiple banks. Change them to whatever you need. Note that not every slot need be filled. As long as you don't attempt to play a slot with bad data, nothing bad should happen.
Also, don't ask how to make these samples work in music files. You'll have to write your own game code for that, and I don't know the music format for S1. Ask Tweaker
Slot 0
Location: $9000
Size: $352
Sample rate: $19
Bank: $800
Slot 1
Location: $A000
Size: $770
Sample rate: 1
Bank $800
Slots 2-D
Location: $B000
Size: $1016
Sample rate: $1B
Bank $800
Slot E (multi-bank)
Location: $A250
Initial Size: $5DB0
Sample rate: $B
Bank: $880
Banks to span: 8
If you have any questions or comments please post them
Take this driver and compress it in the S1 ROM anywhere you like (Kosinski), and make sure to read the notes below. It's much smaller than the other driver because the PCm samples formerly found in the z80 ram are no longer there
http://www.cgi101.co...050/z80_new.bin
New S1 Music Driver notes:
PCM playing is controlled by a table located at offset $200 of the uncompressed sound driver. The table's format is as follows.
Bytes 1/2 - The location of the PCM sample in the bank of the ROM pointed to by bytes 6/7. $8000-based, little-endian
Bytes 3/4 - The size of the PCM sample in words (bytes/2)
Byte 5 - Sample rate/Pitch
Bytes 6/7 - Rom Bank. Format is upper 9-bits of a 16-bit word, little endian (for easy conversion, take the start of the bank in ROM for example, offset $88000, and divide it by $100).
Byte 8 - unused
There are 14 slots of 8 bytes each for PCM definitions. To play them, just write $81 + the slot number (0-based) to $1FFF of the Z80 RAM area.
Writing $90 to $1FFFwill play the sega sound. The bank location of this is still hardcoded, so instead, make a new definition for the Sega sound in an open PCM definition slot. This method of playing the Sega sound is depreciated.
Writing $8F to $1FFF will play the multi-bank PCM (since we're playing slot $E, and $E + $81 is $8F). This is controlled by the 15th and final slot of the PCM table (slot $E). The format for the multi-bank PCM is a bit different.
Bytes 1/2 - Same
Bytes 3/4 - Size of the FIRST SECTION of the PCM sample in BYTES. Not WORDS.
Byte 5 - Same
Byte 6/7 - Same, with one note: The lower 7 bits MUST be zero for the bank switching to work properly
byte 8 - Number of banks to span when playing the file.
The rom bank is the starting bank of the PCM. The size refers to the number of bytes the PCm takes up in the FIRST bank. NOT the total size of the sample. This is because after this initial size when used as a counter is exhausted, it switches to the ROm bank and assumes a start position of $8000 and a size of $8000. Because of this, the routine will always end playing at the end of a bank. For this reason, make sure to position your PCM samples so that the very end of it coincides with the very end of a ROM bank.
NOTE ON CHANGING THE NUMBER OF PCM SLOTS.
The default behavior of the driver is 14 PCM slots and 1 multi-bank PCM slot for a total of 15 slots. However, this can easily be changed. First, you have to change when the sega sound is played. To do that, go to offset $3D of the uncompressed file. The default is $0F. Change this to the number of slots you want (so if you want 18 slots, change it to $12). Do note that this will change the value you need to put into $1FFF in your game code in order to play the sega sound. This is the value of offset $3D + $81 (so in the previous example, you'd need to play $93 ($12+$81) into $1FFF). Then just apped the extra PCM data to the end of the table. There's plenty of RAM in the z80, so you can have an endless amount of PCM samples.
You can also change the number of multi-bank PCM slots. Note that these will always be at te end of the PCM table, no matter how long it is. To do this, go to offset $96. The default is $E. This desribes which slot number to begin defining multi-bank PCM samples. So if you, for example, change it to $C, then every slot in the table from $C onward will be a multi-bank PCM definition. Combined with the change of the number of slots above, this would give you 12 normal PCM slots and 6 multi-bank PCm slots (lots 0-$B and slots $C-$11 respectively.
And now, finally, the default behavior of this sound driver. These are my settings to test the driver with the uncompressed drum DAC samples from S1, as well as a custom PCM sample I played across multiple banks. Change them to whatever you need. Note that not every slot need be filled. As long as you don't attempt to play a slot with bad data, nothing bad should happen.
Also, don't ask how to make these samples work in music files. You'll have to write your own game code for that, and I don't know the music format for S1. Ask Tweaker
Slot 0
Location: $9000
Size: $352
Sample rate: $19
Bank: $800
Slot 1
Location: $A000
Size: $770
Sample rate: 1
Bank $800
Slots 2-D
Location: $B000
Size: $1016
Sample rate: $1B
Bank $800
Slot E (multi-bank)
Location: $A250
Initial Size: $5DB0
Sample rate: $B
Bank: $880
Banks to span: 8
If you have any questions or comments please post them


00
