Difference between revisions of "UserWiki:SynaMax"

From Video Game Music Preservation Foundation Wiki
Jump to: navigation, search
(Fairlight CMI - Important Memory Maps)
(Header)
Line 117: Line 117:
 
| 0x0 || 0x2 || <center>'''Time Signature'''</center> || Overrides the global time signature in the header.
 
| 0x0 || 0x2 || <center>'''Time Signature'''</center> || Overrides the global time signature in the header.
 
|-
 
|-
| 0x5 || 0x8 || <center>''unknown''</center> || Something to do with time division.
+
| 0x2 || 0x2 || <center>''Speed?''</center> ||  
 
|-
 
|-
| 0xD || 0x5B || <center>''Padding''</center> ||  
+
| 0x4 || 0x2 || <center>''ubeats per count?''</center> ||
 +
|-
 +
| 0x6 || 0x1 || <center>''ubeats per division?''</center> ||
 +
|-
 +
| 0x7 || 0x1 || <center>''divisions per count?''</center> ||
 +
|-
 +
| 0x8 || 0x1 || <center>''divisions per pattern?''</center> ||
 +
|-
 +
| 0x9 || 0x1 || <center>''PPQ?''</center> ||
 +
|-
 +
| 0xA || 0x1 || <center>''unused''</center> ||
 +
|-
 +
| 0xB || 0x2 || <center>''pointer back to buffer table (2 bytes)?''</center> ||
 
|-
 
|-
 
| 0x68 || 0x10 || <center>'''Comment'''</center> || 16-character string used for comments
 
| 0x68 || 0x10 || <center>'''Comment'''</center> || 16-character string used for comments
Line 142: Line 154:
 
|-
 
|-
 
|}
 
|}
 
  
 
====Note Data====
 
====Note Data====

Revision as of 17:36, 6 October 2018

Fairlight CMI - Important Memory Maps

Page T

Page T's table is split up into three sections: Register, Stroke and Channel. Register starts at 0x7A80, Stroke starts at 0x7B00, and Channel starts at 0x7B80.

Offset Size Description Notes
0x7A80 0x10
Register File
Unknown; shows up in the Page T debug menu.
0x7B00 0x10
Stroke Key
Unknown; shows up in the Page T debug menu.
0x7B80 0x10
Channel G. IN
Unknown; shows up in the Page T debug menu.
0x7B90 0x10
Channel G. PT
Unknown; shows up in the Page T debug menu.
0x7BD0 0x10
Channel Mode (first byte) / Channel State (second byte)
Unknown; shows up in the Page T debug menu.


Page Status / Command Line

Offset Size Description Notes
0x7E10 0x38
Page Status
Displays the page name or any important messages
0x7E48 0x38
Command Line
Commands are typed in here. Always starts with the cursor character (0x1A). The very last byte is always a space (0x20), because that is the character limit.

Fairlight CMI *.IN File Structure

0x200: Voice Chunk

Offset Size Description Notes
0x0 0x1
Start of Voice
Always 0x31
0x2 0x8
Voice Filename
Always 0x8 long. If name is shorter than 8 characters, remaining characters are spaces (0x20)
0x9 0x2
Voice File Extention
Always "VC" (0x5643)


Fairlight CMI *.RS File Structure

Offset Size Description Notes
0x0 0x2
Version/Revision
Always 0x0102
0x2 0x2
Speed
0xA3A = 2618 = 120 BPM. To get the BPM, divide 314160 by the song's speed value (314160/2618 = 120). To get the speed value, divide 314160 by the song's BPM (314160/120 = 2618)
0x4 0x2
Global Time Signature
For example: 0x0404 = 4/4; 0x0608 = 6/8. This will be the time signature for any blank patterns. Any pattern that has data in it, will override this time signature
0x6 0x2
Sync Flag
0x0000 = INT; 0x0001 = EXT
0x80 0xFF
Patterns Used Index Chunk
Seems that any value (as long as it's not more than or equal to the patterns used total) will work.
0x17F 0x1
unknown
0x180 0xFF
unknown
This looks like a duplicate of the Patterns Used Index Chunk, except every value is a 1. When loaded in the CMI's memory, this area was zeroed out. Possibly unused?
0x27F 0x1
unknown
0x280 0x1FE
Song Step Index Chunk
Every word is a step, first byte is the pattern number, second byte is how many repeats. For example, 0x0106 = play pattern 1, 6 times. As soon as the sequencer sees the first zeroed byte in the index, all other bytes after that are ignored.
0x47E 0x2
Padding (unused)
An extra two bytes of 0x0001 pad out this chunk to make it 200-bytes long.
0x480 0x1D2
Section Step Index Chunk
Every word is a step, first byte is the pattern number, second byte is how many repeats. For example, 0x0106 = play pattern 1, 6 times. As soon as the sequencer sees the first zeroed byte in the index, all other bytes after that are ignored.
0x652 0x2E
Padding (unused)
An extra set 0x0001 words pad out this chunk to make it 200-bytes long.
0x680 0x80
"E5" Chunk?
For some reason at offset 0x680, there is a chunk that is usually filled with 0xE5, or just zeroed out.

Song Step Index Chunk

Every two bytes represent a step in in the emulator. The first byte is either the pattern number, or the section letter. The second byte has the value for how many times the pattern or section has to play but also contains a flag denoting if the first byte is a section letter or not.

The highest bit of the second byte determines if the previous byte is a pattern number or a section letter. For example, the value 0x4D can be either the decimal number "77", or the section letter "M". 0x4D01 means that pattern 77 will play once. 0x4D00 means the pattern 77 will play forever and 0x4D86 means that the sequencer will play section "M" 6 times. This is why we can't repeat patterns or sections more than 127 times.

As soon as the sequencer encounters a zero where a pattern number should be, then the sequencer ignores all the remaining bytes (even ones that have valid data in them) and places an end marker denoting that the song is finished.

Section Step Index Chunk

This chunk is very similar to the Step Index chunk. Every word contains the values for the pattern number or section letter, as well as the play count for the step and the section letter flag.

Pattern Chunk

The first pattern for the song is located at offset 0x700 in the file. Each pattern is 0x680 bytes long.

Header

Offset Size Description Notes
0x0 0x2
Time Signature
Overrides the global time signature in the header.
0x2 0x2
Speed?
0x4 0x2
ubeats per count?
0x6 0x1
ubeats per division?
0x7 0x1
divisions per count?
0x8 0x1
divisions per pattern?
0x9 0x1
PPQ?
0xA 0x1
unused
0xB 0x2
pointer back to buffer table (2 bytes)?
0x68 0x10
Comment
16-character string used for comments
0x78 0x08
Padding
0x80 0xC0
Note Data for Keyboard 1
0x140 0xC0
Note Data for Keyboard 2
0x200 0xC0
Note Data for Keyboard 3
0x2C0 0xC0
Note Data for Keyboard 4
0x380 0xC0
Note Data for Keyboard 5
0x440 0xC0
Note Data for Keyboard 6
0x500 0xC0
Note Data for Keyboard 7
0x5C0 0xC0
Note Data for Keyboard 8

Note Data

Notes are represented in two bytes. Specific bits are assigned to three different parameters, Key (Pitch), Vel (Velocity), and Dur (Duration).

The range of Key are from note F1 to F7. Duration goes from 0 to 48, and Velocity goes from 1 to 8.

D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Key Dur Vel

Velocity is different from the other two parameters as it's value is inverted. So 0x0 = 8, 0x1 = 7, etc.

The maximum amount of notes per keyboard per pattern is 48. The maximum amount of notes per pattern is 384 (48 notes x 8 keyboards). To pad out the pattern, between every 48th note is a zeroed out word. So, for example, we have several sequential 48th notes at Key C4, Vel 8, Dur 2 (0x5810). They appear in the code as this: 58 10 00 00 58 10 00 00 58 10 00 00 58 10 00 00, etc.

MegaRace HERAD "DFADP.HSQ" Driver

This is the driver that is used for Sound Blaster Pro. Provided that the sounds are turned off in the setup options, the driver is located in memory at 3B08:0100. The song currently loaded is located at 3BB6:0000. Note that since the driver is loaded at 3B08:0100, the offsets listed here are off by 0x100 since the reverse engineering process began by referencing the driver file rather than the driver loaded in RAM. As a result, to get the correct offset, just simply add 0x100 to the value and that will be the offset used by the driver. For example, 0xA2 is actually referenced in the driver as 0x1A2.

Offset Size Description Notes
0x00 0x15  ? The game uses these jumps to control the driver
0x15 0x2 Magic? (Always 0x0002) The driver uses this value to do several things, such as using this to add to the relative offsets from the music file so that they become absolute offsets.
0x17 0x2 Song Segment This is where the music file is located (for example, 3BB6:0000)
0x19 0x2 Song Length (first two bytes from music file)
0x1B 0x2 Song Segment
0x1D 0x2 Timer Timer based off of the song's speed value
0x1F 0x2 MIDI Measure Counter (this counts up after every 96 MIDI ticks and is used for the song loop)
0x21 0x2 MIDI Tick Measure Counter (Counts down from 0x60 aka 96 MIDI Ticks)
0x23 0x2 Song Repeat Counter (Counts down from 0xFFFF after passing beginning loop measure)
0x25 0x10 MIDI Event Subroutine Lookup Table Each word is an offset to a subroutine in the driver that handles a particular MIDI Event:

06CF = NoteOff (80)
065D = NoteOn (90)
08E5 = Polyphonic Aftertouch (A0)
08E5 = Control Mode Change (B0)
05D2 = Program Change (C0)
072E = Aftertouch (D0)
07DD = Pitch Bend (E0)
06F5 = End of Track (FF)

Note that Polyphonic Aftertouch and Control Mode Change share the same offset. That is because HERAD doesn't support those MIDI events so the sequencer uses this table to ignore the events and proceed with playing the event as a regular NoteOn. HERAD 2 also doesn't support Aftertouch Events, so they are parsed but ignored.

0x35 0x6  ? Table (00 03 01 04 02 05)
0x3B 0x6  ? Table (08 0B 09 0C 0A 0D)
0x41 0x6  ? Table (10 13 11 14 12 15)
0x47 0x18 Frequency Table These are the FNUM values that make up the 12 note Chromatic musical scale for HERAD. Basically, changing these values will modify the "tuning" of the scale.
0x5F 0x12 FNUM/Block Number Register Values These register values are sent directly to the OPL chip, however these values are missing the Key-On bit (bit 5, 0xB0-0xB8).
0x71 0x12 OPL Register Lookup Table Table (00 01 02 08 09 0A 10 11 12 03 04 05 0B 0C 0D 13 14 15). Some subroutines use this to write to all the OPL registers.
0x7A 0x16 Fine Pitch Bend Table
0x90 0xA Coarse Pitch Bend Table
0x9A 0x2 Song Flag Left over from Dune. When set to 0x80, this plays the song, but when this changes to 0x00, playback stops. The driver checks to see if the highest bit is set to 1 and if it is, the song plays, so any value between 0x80 and 0xBF will work. 0xC0, was used to fade out songs in Dune, but this feature has been removed. 0xC0 is still used to end songs when the game quits.
0x9C 0x3  ? (Always 0xEEEEEE) Changing this doesn't affect playback but it is used by several subroutines in the driver.
0x9F 0x2  ? Two byte timer that counts up by rotating (bit shifting) to the left by 1
0xA1 0x1 Padding (Always 0x90, changing this doesn't affect playback)
0xA2 0x12 Current Midi Delay Counter (counts down until next event)
0xB4 0x12 MIDI Track Position (counts up until reaching the track end)
0xC6 0x12 Start of MIDI Tracks (Absolute address in music file, rather than relative address in music file header)
0xD8 0x12 List of MIDI tracks using drum keymap instrument If MIDI track uses keymap instrument, the absolute offset of the instrument in the music file will be used. If the instrument changes back to a normal instrument, the value zeros out.
0xEA 0x12 Current Instrument (first byte) / MIDI Pitch (second byte) The pitch here is after any transpose macros have been applied. Also, if the keymap instrument is used, the first byte will display the instrument(s) that are actually being played. If no instrument or note data exist, the values will be 0xFF/0x00 respectively. NoteOffs are enabled by setting the highest bit to 1 in the pitch byte.
0xFC 0x12 Pitch Slide Range Flag (first byte) / Root Note Transpose (second byte) for each MIDI track
0x10E 0x12 Pitch Slide Duration Counter (first byte) / Pitch Slide Duration (second byte) for each MIDI track The Pitch Slide Counter starts at the value assigned by the second byte.
0x120 0x12 Pitch Slide Counter (first byte) / Pitch Slide Range (second byte) for each MIDI track The Pitch Slide Counter starts at 0x40 (unless it is transposed) and either goes up or down depending on Pitch Slide Range value.
0x132 0x12 Modulator Output Level Scaling (first byte) / Carrier Output Level Scaling (Second byte) These values are taken from the current instrument.
0x144 0x12 Modulator Output Level (first byte) / Carrier Output Level (Second byte) These values are taken from the current instrument.
0X156 0x12 Modulator Output Level Register (first byte) / Carrier Output Level Register (Second byte) These are the final register values that are sent to the OPL chip.
0x168 0x12 Panning/Feedback/Connector Register Value
0x17A 0x12 Loop MIDI Delay Values These are the values that the MIDI delay counters load when the song loops.
0x18C 0x12 Loop Start Absolute Address for each MIDI track (loads after the song passes the loop beginning measure)
0x19E 0x24  ? Seems to be just zeros
0x1C2 0x1 Terminator (flashes 0xFF during playback)
0x1C3 EOF Binary Data (starts with "HSQ" with 0x2002 at the end) (0x4853512002)

Dune HERAD "DUNEADL.HSQ" Driver (Floppy Version)

Offset Size Description Notes
0x00 0x21  ? Changing some values crash the game, while others don't
0x21 0x2  ? Something to do with the song speed (Always 0x0240)
0x17 0x2  ? (Always 0x00E0)
0x19 0x2 Song length + 0x0040 This value is the first two bytes from music file with 0x0040 added, for example WORMSUIT.HSQ's song length (0x3C7E) will show up as 0x3CBE
0x1B 0x2  ? (Always 0x00E0)
0x29 0x2  ? (OPL Timer?)
0x2B 0x2 MIDI Measure Counter This counts up after every 96 MIDI ticks and is used for the song loop
0x2D 0x2 MIDI Tick Measure Counter Counts down from 0x60 aka 96 MIDI Ticks
0x2F 0x12  ? Changing some values crash the game, while others don't
0x41 0x6  ? Table (00 03 01 04 02 05)
0x47 0x6  ? Table (08 0B 09 0C 0A 0D)
0x4D 0x6  ? Table (10 13 11 14 12 15)
0x53 0x18 Frequency Table These are the FNUM values that make up the 12 note Chromatic musical scale for HERAD. Basically, changing these values will modify the "tuning" of the scale.
0x6B 0x12 FNUM/Block Number Register Values These register values are sent directly to the OPL chip, however these values are missing the Key-On bit (bit 5, 0xB0-0xB8).
0x7D 0x9  ? Table (00 01 02 08 09 0A 10 11 12)
0x86 0x16 Fine Pitch Bend Table
0x9C 0xA Coarse Pitch Bend Table
0xA6 0x1 Song Reset/Fade Out Controls 0x80 = Play song. 0x00 = resets the song back to the beginning, then the value switches back to 0x80 to play the song. 0xC0 = Fades the song out and waits until the Fade Out MIDI Tick Timer at 0xA8 counts to zero before resetting the song from the beginning).
0xA7 0x1 Change Song Depending on which screen the game is in, this is set to 0x1 so when the current song is finished playing or fades out, a new song will play. In the Options menu of Dune, if "Music On (CD-Style)" is selected, this byte is always 0x1 when a song is playing.
0xA8 0x1 Fade Out MIDI Tick Timer Counts down from 0xFF with each MIDI tick. Once this reaches zero, the value at 0xA6 changes back to 0x0000.
0xA9 0x2  ? Something to do with the fade out timer. When not active, this is at 0x1111. Seems to count in only 0x11,0x22,0x44,0x88.
0xAB 0x1 Padding (Always 0x90, changing this doesn't affect playback)
0xAC 0x12 Current Event Midi Tick Counter (counts down until next event)
0xBE 0x12 MIDI Track Position + 0x0040 Absolute value with 0x0040 added (counts up until reaching the track end)
0xD0 0x12 Start of MIDI Tracks + 0x0040 Absolute value with 0x0040 added (Absolute address in music file, rather than relative address in music file header)
0xE2 0x12 Current Instrument (first byte) / MIDI Pitch (second byte) The pitch here is after any transpose macros have been applied. If no instrument or note data exist, the values will be 0xFF/0x00 respectively. NoteOffs are enabled by zeroing out the pitch byte.
0xF4 0x12 Pitch Slide Range Flag (first byte) / Root Note Transpose (second byte) for each MIDI track
0x106 0x12 Pitch Slide Duration Counter (first byte) / Pitch Slide Duration (second byte) for each MIDI track The Pitch Slide Counter starts at the value assigned by the second byte.
0x118 0x12 Pitch Slide Counter (first byte) / Pitch Slide Range (second byte) for each MIDI track The Pitch Slide Counter starts at 0x40 (unless it is transposed) and either goes up or down depending on Pitch Slide Range value.
0x12A 0x12 Modulator Output Level Scaling (first byte) / Carrier Output Level Scaling (Second byte) These values are taken from the current instrument.
0x13C 0x12 Modulator Output Level (first byte) / Carrier Output Level (Second byte) These values are taken from the current instrument data and also include the Key scaling level register values.
0X14E 0x12 Modulator Output Level Register (first byte) / Carrier Output Level Register (Second byte) These are the final register values that are sent to the OPL chip. These values also include the Key scaling level register values.
0x160 0x12 Feedback Scaling - Velocity (first byte) / Feedback/Connector (second byte) These values are taken from the current instrument data, however the second byte is the unmodified register value of the feedback and connector settings.
0x172 0x12 Modulator Output Level Aftertouch Scaling (first byte) / Carrier Output Level Aftertouch Scaling (second byte) These values are taken from the current instrument data
0x184 0x12 Feedback Scaling - Aftertouch / Feedback/Connector Register Value The first value is taken from the current instrument data, however the second byte is the final modified register value of the feedback and connector settings that will be sent to the OPL2 chip.
0x196 0x12 Loop Counter Values These are the values that the MIDI tick counters load when the song loops.
0x1A8 0x12 Loop Start Absolute Address for each MIDI track + 0x0040 (loads after the song passes the loop beginning measure)
0x1BA EOF Binary Data (always starts with "HSQ" string with 0x16 at the end) (0x48535116)

Dune HERAD "DUNEADL.HSQ" Driver (CD Version)

To be completed.

Dune HERAD "DUNEAGD.HSQ" Driver (Floppy Version)

Offset Size Description Notes
0x3E4 EOF Binary Data (always starts with "AGD" string with 0x16 at the end) (0x41474416)

Dune HERAD "DUNEAGD.HSQ" Driver (CD Version)

To be completed.

Dune HERAD "DUNEADL.SQZ" Driver (Demo Version)

To be completed.

Nintendo WSYS File Structure

Header Chunk

Offset Size Description Notes
0x0 0x4 "WSYS" Header
0x4 0x4 File Size File Size
0x8 0x8 unknown Just zeros?
0x10 0x4 "WINF" absolute offset Need more info on WINF chunk
0x14 0x4 "WBCT" absolute offset Need more info on WBCT chunk
0x18 0x8 unknown Just zeros?

Sample data Chunk

Each sample entry is 0x24 bytes long.

Offset Size Description Notes
0x0 0x2 "E700" Header?
0x2 0x2 MIDI Pitch MIDI Pitch
0x4 0x4 Sample Rate Represented as a floating point value
0x8 0x4 Sample Start Offset Absolute offset inside the AW file where the start of the ADPCM sample is located
0xC 0x4 Sample Size Size of the ADPCM sample
0x10 0x4 Loop flag 00000000 = off; FFFFFFFF = on
0x14 0x4 Loop start point Sample where loop starts
0x18 0x4 Loop end point Sample where loop ends
0x1C 0x4 unknown? Something to do with the loop point samples
0x20 0x4 unknown?

"WINF" Chunk

More work needs to be done here.

Offset Size Description Notes
0x0 0x4 "WINF" Header
0x4 0x4 unknown Number of AW files?
0x8 0x8 AW filename absolute offset Points to the name of the AW file. AW files contain all the ADPCM sample data.