The cartridge

32 KB with no mapper, in pages 1 and 2 (0x4000-0xBFFF), and the digital-to-analogue converter: the DAC is any write to 0x4000, 8 bits unsigned with rest at 0x80. The cartridge has no RAM: the sample lives in the computer's RAM, at 0x8000-0xBFFF, and the program switches that page between the RAM (0x4105) and the cartridge (0x410D) with ENASLT, depending on whether it has to play or to draw.

Start-up

0x4000: "AB" and INIT at 0x4054. INIT notes the slots of pages 1 and 2 (0x40D4) and copies to H.STKE an rst 0x30 to 0x406E: the program starts when BASIC has finished starting. Then it clears the variables, sets H.KEYI and, before letting interrupts in, fills the sample with silence.

The first interrupt routine (0x4118) does nothing but raise the DAC from 0 to 0x80, one step per interrupt, 129 times; then it hands the hook to the per-frame routine (0x4015). That way the speaker does not give the power-on thump.

The ROM map

fromtowhat
0x40120x4D04start-up, the intro, the screens, the keyboard, the PSG effects
0x4D040x55E8FILE: the tape, the disk code and the printer
0x55E80x5D3ASYN: the synthesizer
0x5D3A0x7135PLAY: the 39 routines that play the sample
0x72000x8000the fourteen oscillator waves, 256 bytes each
0x80000xA3AAthe graphics of every screen, in RLE
0xA3AA0xA5AAthe sixteen factory tones, 32 bytes each
0xA5AA0xBB6DTONE EDIT, WAVE EDIT, the copy, the list and FILE
0xBB6D0xBEA6LAYOUT and the intro's demo
0xBEA60xBF62the PSG effects and their lists
0xBF620xC000RC741 86 5 31, padding and Konami's hidden mark

The whole split, byte by byte, is in src/synth.notes: the code is 16,229 bytes and the data 16,539, and none is left unexplained.

The RAM

addresswhat
0x8000-0xBFFFthe sample: 16 KB of 8-bit samples, silence at 0x80
0xC000-0xCFFFthe sixteen user waves, 256 bytes each
0xD000-0xD1FFthe sixteen tones, 32 bytes each
0xD200-0xD22Fthe LAYOUT: the note of each of the 48 keys
0xD230-0xD2AFper key, the PLAY routine and its delay
0xD800-0xDEFFthe variables: the phase, the keys, the screen, the sprite copy
0xD854 / 0xD855the slots of the RAM and of the cartridge in page 2
0xDB00the current tone
0xDC00-0xDC18the tone SYN is synthesizing
0xDC19SYN's write pointer
0xDCFD / 0xDCFEthe loop page and the length of the sample
0xDD00-0xDDFFthe user wave prepared for listening
0xDF00the stack, downwards

The VRAM

SCREEN 2, with the registers at 0x4295: colours at 0x0000, patterns at 0x2000, names at 0x3800, sprite attributes at 0x3B00 and sprite patterns at 0x1800. Tiles 0 to 15 are flat squares of the sixteen colours, the font runs from 0x10 (the digits) and from 0x21 (the letters), and every screen brings its patterns, colours and names in RLE from page 2 of the cartridge (0x4358): a control byte below 0x80 repeats the next one, 0x80 + n copies n bytes, 0x80 brings another address and 0 ends.

The PSG

Only for the effects: three channels (0xD810, five bytes each) with note lists at 0xBEFE. The cursor makes effect 1, a finished operation 2, a screen change 5 and the intro 8 (0xBEBF).