Notes:Galaxy Force II (Arcade)

Sound Notes
Only the main CPU can access the Z80, but the main game logic is on the suby CPU. This means the suby CPU has to tell the main CPU what to send to the Z80. However, some of the logic is handled on the main CPU, leading to the main CPU telling the suby CPU some of what to play, and suby sending both its own requests and the main CPU's back to the main CPU. The subx CPU does not appear to issue any sound requests.

Key routine and memory locations:
 * maincpu
 * Address of routine that actually sends sound codes: $1D9A
 * Address maincpu writes sound codes to: byte $82001 (equivalent to byte $F800 in the Z80 address space?)


 * suby
 * Routines that play a sound (sound code in d0): $1378E (most of game), $137B4 (sound test, insert coin sound, and jumped to by the other routine)
 * Routine that sends sound codes to the maincpu: $140D0 (this is also the routine that handles codes maincpu sends to suby)
 * Sound test routine start: $753C
 * Sound test sound code array start: $8C54 (one byte per code, in the order given on the sound test screen, with voice sample codes coming immediately after sound effect/music codes)
 * Shared RAM (all three 68000s map to $C0000)
 * Address suby writes sound codes to send to maincpu: byte $C00D0
 * Address suby writes a nonzero value to to tell maincpu that a sound has arrived: byte $C00D1
 * Address maincpu writes its own codes to send to suby: byte $C00D2

maincpu only seems to ask for sound codes $90, $99, $ED, and $EE; $90 is also requested by suby.

Text Encoding
When text is displayed, the game's text routines apply an index to each character, presumably to choose a sprite bank to take the character sprites from. Regardless of the chosen sprite bank, all the strings in the game seem to use the same character format:

Any higher byte value will show random sprites. Note that for strings, the byte value 0 will actually end the string — custom routines are used to print numbers intead.

The following Go program will read a ROM from standard input, producing an identical ROM on standard input with valid bytes converted to their character equivalents (without the 0 digit character) and all other bytes converted to null bytes (useful for the strings utility on Unix systems). // pietro gagliardi (andlabs) // 3 january 2013 package main

import (	"os"	"io" )

var chars [0x100][]byte

func init { // in reality the character at position 0 is the digit 0 but the string print routines cannot show this character (they stop on a 0 byte) const base = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz!/_.," for i := 1; i < len(base); i++ { chars[i] = []byte{base[i - 1]} } }

func main { b := make([]byte, 1) for { n, err := os.Stdin.Read(b) if err == io.EOF { break } else if err != nil { panic(err) } else if n != 1 { panic("short read without error") }		if chars[b[0]] != nil { os.Stdout.Write(chars[b[0]]) } else {		// fill the rest with blank space os.Stdout.Write([]byte{0}) }	} }