Skip to content

TG100 sample ROMS

Technical discussion which is not directly related to VGM files. Talk about Hardware and Software.

Moderator: Staff

TG100 sample ROMS

Post by vampirefrog »

I've managed to extract the sample ROM data from a Yamaha TG100.

I breadboarded the 42 pin, 16Mbit ROM and connected it to the MiniPro as if it were a 27C080 8Mbit, then tied A-1 to ground, then Vcc and read it twice. I believe the bytes are interleaved between the two roms.

Importing them in Audacity gives similar sounding patterns for both files.

I've heard that the samples are 12 bit, so that might be the case.

It would be nice to extract the samples in this ROM and stick them into a sound font.

(1.85 MiB) Downloaded 675 times
The device I've used.
The device I've used.

Post by Kaminari »

Neat. Is this the first GM synth by Yamaha?

Post by vampirefrog »

Here's the program ROM as well, might contain the sample offsets and lenghts. It contains their names for sure.
(128 KiB) Downloaded 579 times

Post by vampirefrog »

Here is the single file ROM.

To listen to it, I used:

Code: Select all

sox -t raw -e signed-integer -b 24 -c 1 -r 8000 tg100smpl.bin tg100smpl.wav
(2 MiB) Downloaded 584 times
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

I submitted these to MAMEdev, with a skeleton driver. Won't really matter for us as the hardware won't be emulated in a long time, but now the ROMs will be preserved for future generations, I suppose.

The sample offsets and lengths are in the wave rom, the format is identical to the MultiPCM and probably OPL4 as well. 0xC0.... in the start offset indicates a 12 bit sample (this is not emulated by the current multipcm core)

Post by vampirefrog »

It seems the ROM starts with 0x1800 bytes containing sample info. First 3 bytes is offset, ROM starts at 0xc00000, so subtract that from the values. Each sample info entry seems to have 12 bytes of data. I don't know what the other 9 bytes mean. I also don't know how samples are related to an instrument, because it seems like some instruments, like piano and bass, have multiple samples, for different note ranges, so that means there are multiple samples for one instrument, but also the sample info might have some sort of note range info.

So for now, the sample info is as such:

- offset: 3 bytes
- filler: 9 bytes
total: 12 bytes

Edit: 0x1800 = 6144 = 512 x 12, so there's room for 512 samples, but some samples have zero bytes, so they seem to be unused.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

As I said, the sample header format is very similar to the OPL4.


The "Data bit" is 3 (1,1) for these samples though. On the OPL4 this value is prohibited but on the YMW258/MultiPCM this appear to signify a 12-bit sample.

The sample length is calculated by 0x10000 - "end address". The "loop address" is just an offset from the beginning of the sample. Keep in mind that the offsets (apart from the start address) are all in samples, not in bytes.

Post by vampirefrog »


Post by vampirefrog »

0x10000 - end_address seems to be size in bytes it's in samples
first sample is at 0x1800 and second sample at 0x183f. First sample size is therefore 0x3f, 63 decimal.
63 bytes contain 63 * 8 / 12 = 63 * 2 / 3 = 42 samples.

Post by vampirefrog »

I've managed to extract all the samples, now to figure out how to convert from 12 bit to 16 bit.

Edit: algorithm I've found is:

Code: Select all

#include <stdio.h>
#include <stdint.h>

int main(int argc, char **argv) {
	for(int i = 1; i < argc; i++) {
		FILE *f = fopen(argv[i], "rb");
		char buf[256];
		snprintf(buf, sizeof(buf), "%s.16", argv[i]);
		FILE *o = fopen(buf, "wb");
		uint8_t b[3];
		uint16_t c[4] = { 0, 0 };
		while(!feof(f)) {
			int r = fread(b, 1, 3, f);
			if(r == 0) break;
			c[0] = (b[0] << 8) | (b[1] & 0xf0);
			c[1] = (b[2] << 8) | ((b[1] & 0x0f) << 4);
			fwrite(c, 2, r > 2 ? 2 : 1, o);
	return 0;

Post by vampirefrog »

Here are the samples. Now to figure out that stupid YM specific envelope section and stick these into a SF2 file or something.

Sample 0 looks like a plain sine wave, and sample 2 is the longest.
(6 MiB) Downloaded 596 times

Post by vampirefrog »

I'm now looking at the program ROM for clues on how the samples are stitched together into instruments.

Code: Select all

000103c8: 0f0f0f0f 0f0f0f0f 0f0f0f0f 0f0f0f0f 0f0f0f0f 0f0f0f0f  ........................
000103e0: 0f0f0f0f 0f0f0f0f 0f0f0f0f 0f0f0f0f 0f0f0f0f 0f0f0f0f  ........................
000103f8: 0f0f0f0f 0f0f0f0f 23303036 38202056 45523d31 2e313020  ........#0068  VER=1.10 
00010410: 00647f40 403f0a00 0a00003c 4040003c 4772616e 64506e6f  .d.@@?.....<@@.<GrandPno
00010428: 00014040 2f404d5c 08000800 07090703 00040000 00000001  ..@@/@M\................
00010440: 00003f3f 3f3f4040 40404000 00014040 2f404d5c 08000800  ..????@@@@@...@@/@M\....
00010458: 07090703 00040000 00000001 00003f3f 3f3f4040 40404000  ..............????@@@@@.
00010470: 00647f40 40410a00 0a00003c 4040003c 42726974 65506e6f  .d.@@A.....<@@.<BritePno
00010488: 00024040 303c5460 060c0800 0706060c 00040000 00000001  ..@@0<T`................
000104a0: 01002322 201e4040 40404000 00014040 2f404d5c 08000800  ..#" .@@@@@...@@/@M\....
000104b8: 07090703 00040000 00000001 00003f3f 3f3f4040 40404000  ..............????@@@@@.
000104d0: 01575642 403e0a00 0a00003c 4040002e 456c2e47 72616e64  .WVB@>.....<@@..El.Grand
000104e8: 0002403f 40404069 08000800 08000309 01040000 00000001  ..@?@@@i................
00010500: 01001d1e 121b4040 40404000 00054040 40404069 08000800  ......@@@@@...@@@@@i....
00010518: 0800040f 0f050000 00000001 01003f3f 3f3f4040 40404000  ..............????@@@@@.
00010530: 015a5a40 40400a00 0a00003c 4040003c 486e6b79 546f6e6b  .ZZ@@@.....<@@.<HnkyTonk
00010548: 00014f40 40404040 08000800 08000800 00040000 00000001  ..O@@@@@................
00010560: 01003f3f 3f3f4040 40404000 00034f40 40404040 08000800  ..????@@@@@...O@@@@@....
00010578: 08000800 00040000 00000001 01003f3f 3f3f4040 40404000  ..............????@@@@@.
00010590: 01144e40 40400800 0800003c 5840003c 456c5069 616e6f31  ..N@@@.....<X@.<ElPiano1
000105a8: 060d4043 1d354853 07030800 08000703 00070000 00000001  ..@C.5HS................
000105c0: 01003f3f 3f3f4040 40404000 00054041 40404c5c 08000800  ..????@@@@@...@A@@L\....
000105d8: 070d0609 00043d00 04000001 01003f3f 3f3f4040 40404000  ......=.......????@@@@@.
000105f0: 01515142 3e3f0600 0600003c 40400068 456c5069 616e6f32  .QQB>?.....<@@.hElPiano2
00010608: 00014040 4040576c 08000800 060f040f 0003000d 07000001  ..@@@@Wl................
00010620: 01003f3f 3f3f4040 40404000 00024040 40404040 08000800  ..????@@@@@...@@@@@@....
00010638: 08000800 00030000 00000001 01003f3f 3f3f4040 40404000  ..............????@@@@@.
00010650: 00597f40 40410d00 0d00003c 4040003c 48617270 73696368  .Y.@@A.....<@@.<Harpsich
00010668: 00064040 40404a6b 08000800 070b0601 00040000 00000001  ..@@@@Jk................
00010680: 01003f3f 3f3f4040 40404000 00014040 2f404d5c 08000800  ..????@@@@@...@@/@M\....
00010698: 07090703 00040000 00000001 00003f3f 3f3f4040 40404000  ..............????@@@@@.
000106b0: 00697f40 40420b00 0b00003c 4040003c 436c6176 696e6574  .i.@@B.....<@@.<Clavinet
000106c8: 00074042 1c405a6b 06010800 06050308 00050000 00000001  ..@B.@Zk................
000106e0: 01003f3f 3f3f4040 40404000 00014040 2f404d5c 08000800  ..????@@@@@...@@/@M\....
000106f8: 07090703 00040000 00000001 00003f3f 3f3f4040 40404000  ..............????@@@@@.
  • User avatar
  • ValleyBell Offline
  • Posts: 4810
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

In case someone is interested, I ripped the TG100 demo song from the program ROM. (I did that right after vampi released the ROM, but you know me... I always forget to post that stuff anywhere but in IRC.)

Anyway, you can grab the MIDI or the source code of the C program I wrote that dumps it from the ROM.
The format the song is stored in is pretty much MIDI with a few additional events (F2 = song end, F3 dd = 8-bit delay dd, F4 dd ee = 16-bit delay eedd) and that's it. And they omitted the velocity from the Note Off event. (no one needs that anyway)
There is no tempo information and I don't know the exact tick timing, so the tempo of the conversion might be a bit off.

Post by vampirefrog »

It looks from the schematic that I can do a "VGM" dump of the data sent to the YMW258-F with only a 16 channel logic probe, or a very plainly programmed microcontroller. I just need to figure out what all the pins mean. Probably one of the pins is the write clock. There are D0-D7, A0-A3, /CS, /RD, /WR and /TC. I am not sure what /TC does. It is connected directly to the CPU.

Edit: /TC seems to stay on logic 1 all the time, so it's probably useless. It's the /CS that probably decides when a register is written or read.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

There is a pin description here, it should be in the TG100 service manual too but i don't know if bmos ever scanned that page.

Also, it's /IC not /TC. IC stands for Initial Clear, It's an active low pin, so a low voltage resets the chip.

It would be really useful if you could probe the address lines and the chip select signals from the gate array IC21 (A0, A12-A19 and /GEW8, /ROM, /PSRAM, /PSRAM2, /PSRAM3) That would make reverse engineering the program ROM much easier.

edit: /PSRAM2 and /PSRAM3 probably don't affect the CPU program flow, it seems to only affect the DSP. and I don't really know how that works anyway...
Post Reply