RAW Format (Adlib)
From ModdingWiki
The Rdos Raw OPL Capture format is used for storing captured OPL data from a game. The data was originally produced by the RAC utility, which ran as a TSR behind the game having its music captured.
File format
The file can be described in the following structure:
| Data type | Name | Description |
|---|---|---|
| BYTE[8] | cSignature | "RAWADATA" (not NULL-terminated) |
| UINT16LE | iClock | Initial clock speed (can be changed during playback) |
| BYTE[] | cOPLData | Song data (see below) |
| UINT16LE | iEOF | 0xFFFF to indicate end of song |
The first byte in the song data will be the register data, followed by the OPL register where the data should be sent (i.e. in the opposite order to IMF and DRO.) The OPL register can also be one of these control values:
| Register value | Purpose |
|---|---|
| 0x00 | Delay. The data byte is the number of cycles to delay by. |
| 0x02 | Control data (see below) |
If the register is 0x02, the data byte is the "control type" as shown below.
| Control type | Purpose |
|---|---|
| 0x00 | Clock change. The following UINT16LE is the new clock speed. |
| 0x01 | Switch to "low" OPL chip (#0) (docs say "OPL3 port A" - is this the same?) |
| 0x02 | Switch to "high" OPL chip (#1) (docs say "OPL3 port B" - is this the same?) |
To convert the clock speed to a Hertz measurement (Hertz is cycles per second, and the delays are in units of one cycle), use this formula:
iHertz = 1193180.0 / iClockSpeed
Tools
- RAC - The original DOS TSR used for capturing game music
Similar formats
- The DOSBox DRO Format has pretty much replaced the RAW format (apparently the DOSBox OPL capture interface was implemented by Rdos too.)
- The id Software Music Format (IMF) stores Adlib data in a similar manner in order to provide background music in many Apogee games.
