Eschaton GamesOngaku Tsukuru Kanadeeru an English guide

How it works#

This page is for readers who want the formats: how the cartridge is laid out, how the program runs, and every byte of a saved song, of the files Kanadeeru writes to its add-ons, and of the song it hands to RPG Tsukuru 2 (RT2). Everything here was read from the program and checked in emulators (How this was checked). Where the study only inferred a meaning, or left it open, the page says so.

Addresses are the console's, bank and offset ($80:A000). The program runs from the ROM's fast mirror: code in banks $80–$8F, data read through $C0–$CF; either way the file offset is (bank & $0F) × $10000 + the offset. Offsets into the save are written $0000–$7FFF, into a song block +$00. Each section ends with the project's note and tools that hold the full detail; they are files in the project that made this guide, not pages of the site.

The cartridge#

SHVC-ZMCJ, maker code B1, the header title in half-width katakana. Inside:

Through the second controller port it also talks to a Turbo File Twin, in its STF mode, with the same STF driver the other three Super Famicom Tsukuru cartridges carry (at file offset 0x008004).

Notes/Kanadeeru.md, Notes/Dumps.md.

The ROM#

Code fills banks $80–$83; the rest is graphics, the eight sample songs and, in the last bank, the whole sound system.

BankFile offsetWhat
$800x00000Code: the start-up, the main loop and the frame, the screen scripts, the title, the sound calls
$810x10000Code: the score, its drawing, the hotspot tables and the hit test
$820x20000Code: the dialogs and the actions (the score menu, Initial Settings, the panels, the mixer, the jukebox, Data), the compiler ($82:8069), the messages
$830x30000Code and data (the code ends near $83:A21E): saving and loading, the song loader ($83:97B6) and saver ($83:9286), the memory-pack writer ($83:8B1D), the file templates (MTTC at $83:90CD, the BS headers, the boot stub)
$C4–$CB0x40000–0xBFFFFCompressed graphics, the sources of the screen scripts; in $CB the messages' tilemaps and glyph sets
$CC, $CD0xC0000–0xDFFFFThe eight sample songs ($CC:0000, $3000, $6C00; $CD:0000, $0F00, $3C00, $48A0, $6EA0), then more data
$CE0xE0000Uncompressed tile graphics
$CF0xF0000The sound: the 44 samples from $CF:0000, the instrument table $CF:D040, the drum kit $CF:D100, the SPC700 driver $CF:D3E2, RT2's 65816 sound code from $CF:B000 and its jump table at $CF:FF01

The map comes from a code/data log: Mesen marks each ROM byte as it is run or read, and random clicks from saved states on every screen added up to 34,793 bytes of code, all in banks $80–$83 and the sound start-up in $CF. Which data the screens read, screen by screen, was not followed.

Notes/Kanadeeru/Program.md; Tools/kana_cover.py (the random clicks), Tools/snes_dis.py (the disassembler, which takes the CPU's register widths from the log).

The program#

Start-up and the main loop#

The reset ($00:FF00) sets native mode and the stack, turns on FastROM and calls $80:A000, which clears RAM, starts the sound ($CF:FF01: the whole sound system is sent to the sound chip once, here), sets the mode to 1 and enters the main loop at $80:A032. Each pass runs a few services, then the mode $1A00 & 3: 1 the title ($80:B89B), 0 the editor ($80:A9B5; 2 and 3 go there too). Start on the title sets the mode to 0; the editor's action $20 sets it back to 1. The NMI goes to $80:A31A; IRQ, BRK, COP and ABORT all go to a hang.

Screens are built by scripts. $80:AE64 takes a 24-bit pointer to a list of operations (six kinds), which decompress graphics from the data banks into video memory and load palettes and tilemaps. The editor's script is at $80:AFD6, the title's at $80:B1B9.

The editor and its actions#

The editor ($80:A9B5) sets up the score, puts the pointer at (128, 112), and loops: the input and the pointer ($80:A947, $AD87; inferred), a timer, then the action, $1C10 & $3F, through the table at $80:ADB3, then the hit test. Every screen and dialog is an action:

ActionHandlerWhat
0$81:D9ACThe score: note entry, the palette, the tools, the transport, the tabs. Its hotspot step 0 is the Kanadeeru button, whose handler ($81:D9F9) is a bare RTS
$10$81:D9ACThe score with a panel under it: $1C57 = 3 the tempo curve, 1 gate time, 2 dynamics
1$82:8B35The score menu, from the Score tab: its eight items open the dialogs below, which come back to it
2$82:9789Initial Settings: clef, key, time signature, 8 tracks or Chord, Automatic Rests
3, 4, 5$82:A745, $82:B9D4, $82:BCE9Tempo Settings, Gate Time Settings, Dynamics Settings: each panel's set-range dialog, opened from the panel's upper button
6$82:A681Left over: a dialog nothing opens (Behind the scenes)
7, 8, 9, $0A$82:A04D, $82:9D83, $82:A335, $82:A3B7Cut, Copy, Paste, Clear
$0B—An empty entry
$0C$82:AAB4The Mixer
$0D$82:DABDThe Jukebox
$0E$82:C0BDData, the menu
$0F$82:8F72Instrument Select, from the instrument name
$11, $12, $14$82:C3E4Data → Load, Save, Delete
$13$82:CE47Data → Convert
$15$82:CF91Data → Initialise
$16$82:C87CThe Data dialogs' second screen, the list of songs or saves on a medium (the action it came from kept in $1B85)
$17$82:DE73The Jukebox's song list
$18$82:E642The Jukebox's show: each slot's picture full screen while its song plays
$19$82:9726The question before Initial Settings, when a song is in the editor ($1FFA ≠ 0)
$1A—An empty entry
$20(in the loop)Back to the title: the editor sets the mode to 1 ($81:DB97)

Every action is set by a LDA #n : STA $1C10; a scan of the code banks finds at least one for each action above, and none for $0B or $1A.

Hotspots#

The pointer is $0908 (x) and $0909 (y), in screen pixels. Every control is a hotspot: $81:AD82 picks the current action's table ($81:AE36, a pointer for each action; in chord mode the score's table is $81:B137 instead of $AFFE), and $81:ADD1 takes the first 8-byte entry whose rectangle holds the pointer:

Bytes What
0–3 The rectangle: x0, y0, x1, y1
4 The step it starts, to $1C11
5 A snap flag, to $1C14
6, 7 An anchor point, to $1C12 and $1C13

The action's handler then runs the step from its own table (the score's is $81:D9FA: for each step a handler, a pad word and the buttons that must be pressed, inferred from the bits). The snap flag is why the pointer clings to buttons: while it is set, $81:E991 puts the anchor into the pointer every frame.

On the pad, in the score, L and R page a bar back and on, X and Y step a value by one ($81:ED1A), and START plays (inferred).

Messages#

All the program's own text is pictures: the menus, the instrument names and the 45 messages are drawn as graphics, not stored in a character code; the messages are tilemaps over glyph sets in bank $CB. A message is shown in a banner over the score by number, $1FF1 the group and $1FF0 the message, then JSL $82:E1E9; $82:E27F looks the pair up in the table at $82:E2E3 (three groups) and copies the tilemap and its glyph set into place. Group 1's first 19 are the Turbo File library's error codes, code n giving message 1-n. Every message in English: Limits and messages.

Notes/Kanadeeru/Program.md, Menus and Editors.md, Hidden Content.md; Tools/kana_hot.py (every hotspot table), Tools/kana_ui.py (clicks in the running game).

The save#

The 32 KB are a header page and then the songs, each on whole pages of 256 bytes, one after another with no gaps, and zeros after the last.

The save on the second-hand cartridge, to scale: 128 pages of 256 bytes $0000 $2900 $7FFF ムーン: 40 pages from $0100 free: 87 pages, zeros (the next song would start at $2900) the header page, $0000–$00FF: $0000 the signature, 32 bytes ASCII MUSIC TOOL1995.11.02 V1.0 $0020 sum of 32 KB $0022 songs: 1 rest of the page The header enlarged, not to scale. The sum counts every byte of the 32 KB but its own two.
The save as it came on the second-hand cartridge: the header page, then its one song, , on 40 pages. A song saved next goes in straight after it, as the study's test of did at $2900.
Offset What
$0000 ASCII MUSIC TOOL1995.11.02 V1.0 and $00: the signature, which dates the format
$0020 u16: the 16-bit sum of all 32 KB, with $0020–$0021 counted as 0
$0022 u16: the number of songs
$0100 The songs, each on whole 256-byte pages (its +$22 says how many), to $7FFF

So there are 127 pages, 32,512 bytes, for all the songs together. The nine songs the study had take 7 pages () to 60 (, 15,160 bytes); the smallest song the editor will save, one note, takes 3, so the space holds 42 songs at most and there is no limit on the count below that (Limits).

The power-on check. On the way into the editor ($83:A075) the signature and the sum are checked. If either is wrong, all 32 KB are cleared and a fresh header written, without a question: the study spoiled a save's sum and got back the bare header, with no songs.

In the console the SRAM is 8 KB in each of $30–$33:6000–$7FFF. A song is put in work RAM at $7E:8000 to be loaded (the loader $83:97B6) and is built there to be saved ($83:9286).

Notes/Kanadeeru/Song Format.md, Limits.md; Tools/kana_song.py save (a save from song blocks, renamed or retimed if asked, every sum made good: from the dump's one song it gives the dump byte for byte, and Kanadeeru loads a save it writes and saves it back unchanged).

The song block#

A saved song is one block, MUSIC DATA V1.0 to DATA END: a header of 144 bytes, the eight tracks, and three areas that belong to the bars rather than the tracks.

ムーン's block, to scale: 10,048 bytes the eight tracks, from +$90: 9,494 bytes header, 144 bytes (enlarged below) tempo curve, 136 lyrics, 128 signs and DATA END, 146 The header, enlarged: 4.4 units a byte magic title area table 8 track records of 8 bytes $C2 sum pages length settings, +$28–$2D pale: zeros One event: 6 bytes (8 on track 5) key length code gate time dynamics $20 (open) flags flags: bit 7 a slur, bit 2 a dot, $10 or $01 the stem. A rest has key $80. A track, bar by bar: 80 n: a bar of n events 81 n: n + 1 empty bars FF FF: the end
A song block, from the second-hand cartridge's song . The tracks are almost all of it; the three per-bar areas are 128 bytes and up each, which is why even a one-note song takes three pages.
OffsetSizeWhat
+$0015MUSIC DATA V1.0
+$0F1$C2 in all nine songs (meaning open)
+$108The title, in the title code (below); $46 a space
+$188Zeros
+$202The block's sum: the 16-bit sum of its bytes, with the title (+$10–$17) and the sum itself counted as zero, so renaming a song keeps it (written by $83:967C)
+$222The block's length in 256-byte pages, rounded up: the pages it takes in the save
+$244The block's length in bytes, header included
+$281The key: signed, 1, 2 … sharps; $FF one flat (more flats presumably $FE …)
+$291The time signature: base + numerator − 1, the bases 0, 2, 6 for /2, /4, /8 (4/4 is 5, 3/4 is 4, 2/2 is 1): 14 signatures in all
+$2A1The tempo, in beats a minute (ムーン 144)
+$2B18 tracks or Chord: 1 makes track 5 the chord track
+$2C1Automatic Rests: on or off
+$2D1The music volume, sent to the driver as RT2's volume command; set from the Mixer's master fader (inferred from the code)
+$3020The area table: five (offset, length) pairs, u16 each: the header's own table and records ($30, $60), the tracks (+$34), the tempo curve (+$38), the signs (+$3C), the lyrics (+$40). The areas lie tracks, tempo curve, lyrics, signs; the signs' length counts the DATA END after them
+$5064Eight track records of 8 bytes (below)
+$90The tracks, then the tempo curve, the lyrics and the signs
end − 88DATA END

The track records (+$50, 8 bytes for each track) hold what the Mixer and Instrument Select set. The compiler turns them into the commands at the head of each track:

ByteWhatIn the compiled song
0The instrument, 0–43; $FF the drum kitThe driver's instrument command, the byte unchanged
1The clef: 0 treble, 1 bass (Initial Settings)—
2Volume (the Mixer's fader)The byte − $80: $EA gives volume $6A
3Pan (the Mixer's knob): 0–$78, $3C the centreThe pan command, unchanged
4Echo (the Mixer's E): 1 on, 0 offEcho on or off
5–7Zero

That the Mixer's screen writes bytes 2–4 is inferred: the bytes and the screen's controls match, and the compiled song carries them, but a control was not moved and the save compared.

Notes/Kanadeeru/Song Format.md; Tools/kana_song.py (list, dump, check).

Tracks and events#

The eight tracks follow one another from +$90, each ending FF FF. A track is bars: 80 n opens a bar of n events, 81 n stands for n + 1 empty bars, so an empty track is just 81 7F FF FF. Every track has 128 bars, in all nine songs.

Events are 6 bytes, but track 5 keeps all 8 of the editor's (the loader's table of strides at $83:9998, 6 6 6 6 8 6 6 6). With Initial Settings' Chord chosen (header +$2B = 1) track 5 is the chord track; its two extra bytes are 00 00 in the samples, or 01 00 throughout 's, the one sample in chord mode. What they hold is open.

ByteA noteA rest
0The key, 0–$7F$80
1The length code, 1–6The length code, 11–16
2Gate time ($3F in nearly every event; the Gate Time panel writes it)$3F
3Dynamics, the velocity ($20 in nearly every event; the Dynamics panel writes it)$20
4$20 (other values in one sample; meaning open)$20
5Flags: $10 or $01 the stem up or down (inferred), bit 2 a dot, bit 7 a slur$00, or $04 a dot

Lengths are codes, not times: the score keeps note values, as notation does.

Note codeRest codeValueTicks (48 a quarter)Dotted
111Whole192288
212Half96144
313Quarter4872
414Eighth2436
51516th1218
61632nd6(refused by the editor)

With these, 1,593 of the 1,676 bars written in the nine songs add up to exactly a 4/4 bar. The second-hand cartridge's song has 28 of the other 83, the most of any, each a note or a rest short, so the editor lets a bar be left short. No triplet turns up in any song, so how the editor stores one is not known, and nor are the length codes 7–10 and 17 up.

A slur (flag bit 7) is drawn as an arc from the note to the next, and the compiler turns it into the sound driver's tie: the next note isn't struck again. As 257 of the 362 in the songs run to a different key, it acts as a slur more than a tie.

Bar repeats. A bar whose one event is 81 k n 00 00 00 plays bar n (from 0) of its track again; k is the sign, $27 a one-bar repeat, $28 two bars, $29 four. Of 495 in the songs, 486 point back exactly 1, 2 or 4 bars, and 9 name an earlier bar, as a copied bar would (inferred).

In the editor each track is an 8 KB buffer at $7F:0000 + $2000 × the track, 8 bytes for each event, with a marker FF b before bar b and FF 80 at the end: 1,024 slots, so 895 events a track once the 128 bar markers and the end take theirs. A new event moves the rest of the buffer up 8 bytes; when the last marker reaches the last slot but one, the track is full and the click is refused with the bar-full message.

Notes/Kanadeeru/Song Format.md, Limits.md.

The per-bar areas#

Three areas after the tracks hold what belongs to a bar rather than a track, each for all 128 bars. In the editor they are at $7E:2000 (16 bytes a bar: the signs, then the tempo curve) and $7E:2800 (32 a bar: the lyrics).

The tempo curve#

+$38. 128 bytes, one a bar, each an index (from 1) into the 8-byte entries that follow; each different entry is saved once. An entry is eight values, one for each eighth note of the bar. $20 is the song's own tempo, and each step is 2 beats a minute: tempo = song tempo + 2 × (value − $20). That rule comes from the one song that uses the curve, (♩=162), whose last two bars slow to ♩=100; the other eight songs have the one entry of $20s. The compiler gives the song's conductor track a tempo command for every eighth note.

The lyrics#

+$40. One line for the song, 32 cells a bar, one for each 32nd note: a character sits at the cell of the note it is sung on, and a word's further characters in the cells after. A bar is FF if it has none; otherwise $80 + the number of filled cells, two u16 masks (cells 0–15, bit 15 the first; then cells 16–31), and the filled cells' characters, in the lyric code below. 's bar 12 has at cells 0, 6, 12, 16, 22 and 28, under its notes. Four of the samples have lyrics.

The signs#

+$3C. A bar is 00, or 80 and 5 bytes: its barline, a sign above it, a sign at its end, and two zeros. Every code was measured by putting each sign of the palette on a one-note score and saving it:

ByteWhereCodes
0The barline$15 ‖: (repeat start), $16 :‖ (repeat end)
1Above the bar$17–$1A the endings 1.–4.; $1F 𝄋1, $20 𝄋2 (the segni); $23 ⊕1, $24 ⊕2 (the codas)
2At the bar's end$21 D.S.1, $22 D.S.2; $25 to ⊕1, $26 to ⊕2; $2A D.C.; $2B Fine
3, 4—Zero: the palette writes nothing there

The palette's 1-, 2- and 4-bar repeats are not here: they are track events (above). The compiler plays every sign out: repeats, endings, D.S., D.C. and codas become the bars in the order they are heard, so 's 57 bars become 75 in each compiled track.

Notes/Kanadeeru/Song Format.md.

Text codes#

A song's title and its lyrics are the only text the program stores, and they use two different codes.

Titles, and the name keyboard of Save, follow the keyboard's own order, row by row across its two halves. $46 is a space; a voiced kana is two codes ( = ), so a title of 8 codes may show fewer kana.

+0+1+2+3+4+5+6+7+8+9
$00
$0A
$14
$1E
$28
$32◀▶
$3C1234567890

Lyrics have a code of their own, with the voiced kana as single codes:

CodesWhat
$00An empty cell
$02–$31Hiragana in kana order: $02 … $1F, $20 … $24, $25–$27, $2A … $2E, $2F, $30, $31 ($28 and $29 unused)
$32–$3AThe small kana: $37–$39 (seen); – $32–$36 and $3A by the order
$3B–The voiced kana as single codes: $3B … $41 … $45 …
hiragana + $52Katakana, the same order: is 7D 83 60
$A6–A–Z (ラビリンス's FAKE … REALITY)
$CBFollows a word in the cells after it ( $CB $CB $CB): a space or a held-syllable mark, open
$CCDrawn as a small CLR mark at the end of a phrase: the line cleared, karaoke-style (inferred)

Notes/Kanadeeru/Song Format.md.

The compiler#

Kanadeeru never plays its score directly. Pressing play runs $82:8069, which compiles the whole song into RT2's song format: an 'SN' container at $7E:8000 (one entry: a length word, then the song). $CF:FF1C sends it to the sound chip at $D000 and $CF:FF73 starts it. Compiling takes a second or two before the first note (: 76 frames from the click to the start, and some 18 more before the driver takes it). The upload is skipped if the song is $2FFA bytes or more, the room from $D000 to the end of the sound chip's memory.

Convert uses the same compiler, for a song bound for RT2. One byte, $1FF6, picks the output: 0 for the editor's own playback, 1 for Convert.

The score 8 tracks, the curve, the signs The compiler $82:8069 signs played out Work RAM $7E:8000 an 'SN' container, one song Sound chip $D000 Kanadeeru's driver: once, the Mixer live play: $1FF6 = 0 Memory pack an MTTC file, songs looping RT2 its Data page, BGM 31 and up Sound chip $D000, RT2's driver Convert: $1FF6 = 1 Both drivers read the same 54 song events with the same code, and play them on the same 44 samples, instruments and drum kit.
One compiler, two outputs. Play sends the song straight to the sound chip; Convert writes it, in the same format, to a memory pack, where RT2 finds it and sends it to its own sound chip unchanged.

What the compiled song is: a song block exactly as RT2's driver takes it. One subsong, its tempo byte the song's beats a minute, eight tracks (one a voice) and a conductor. Each track is a list of calls, one subroutine a bar, with the signs played out: a bar heard twice is called twice. At its head come the instrument and, for RT2, echo, volume and pan; slurs become ties, and the conductor track carries the tempo curve. Text the driver never reads sits among it: the song's title, the mark OTOTUKU, and a marker at each track's end (#Track-End No 7#). compiled for RT2 is 8,353 bytes: 1,337 notes, 286 rests and 801 calls, read by RT2's own song reader without an unknown byte.

The two outputs of are the same length and differ in 84 bytes, all in three places:

WhereFor the editor ($1FF6 = 0)For RT2 ($1FF6 = 1)
After the song's header (8 bytes)SpacesThe song's title, in the title code, before the OTOTUKU mark
Each track's start, after its instrumentFive no-ops (C0)Echo (E0 or E1, from the Mixer's E), volume (CE: the fader − $80) and pan (DC)
Each track's endEcho off, an eighth-note rest and the end (E0, 00 0C, D1): the song plays onceA jump back to the track's start (C1): the song loops, as RT2's own do

So in the editor the Mixer acts live (the driver's overrides, below), and its faders can move while a song plays, which plays once; for RT2 the Mixer is written into the song, and every track loops.

The compiled songs are smaller than the scores they come from, except the three shortest:

No.Song♩Song block (bytes)Compiled (bytes)Listen
01 (the second-hand cartridge's)14410,0488,353
0211812,2787,967
0316215,1609,035
041008,7017,039
051193,6955,107
0612011,4058,840
071303,2224,622
08839,4996,811
091201,6464,391

Notes/Kanadeeru/Sound.md, Memory Pack.md; Tools/kana_sound.py rip (each song as the editor plays it, as an .spc).

The sound driver#

Kanadeeru's sound is RT2's. At power-on the program sends the sound chip everything but the song, from bank $CF, by the same start-up and loader as RT2's:

FromBytesTo (SPC RAM)WhatAgainst RT2
$CF:D229$1B9(the IPL)The DSP set-up (the echo: volume $1C, feedback $6D, a pass-through filter, its buffer at $C000, delay 2) and the loaderThe same
$CF:0000$92FD$2000The 44 samplesThe same, byte for byte
$CF:92FD$B0$1F00The sample directoryThe same
$CF:93AD$58$1EA0The samples' tuningThe same
$CF:D000$40$1FC016 vibrato presetsThe same
$CF:D040$C0$1CC048 instrumentsThe same
$CF:D100$120$1D80The 36-drum kitThe same
$CF:D3E2$16A5$05E0The driverRT2's ($168A) with 27 bytes more
$CF:D220$B300An 'SE' container (sound effects)Whether Kanadeeru plays any is open

The driver is RT2's with 27 bytes more (kana_sound.py driver compares the two, handler by handler, with the addresses masked):

Everything else is the shift: one more byte of the driver's variables, so RT2's are one higher here.

The main processor's side is RT2's sound code too, moved by about $38 bytes, from $CF:B000, with a jump table of 79 entries at $CF:FF01. Commands go through RT2's queue of 16. The entries the program calls:

EntryCalled fromDoes
FF01$80:A027The start-up: the uploads above, once at power-on
FF1C, FF73, FF76$80:B7F8, $80:B80B, $80:B79B and othersUpload a song (A the bank, X the address), start it, stop it
FF10, FF16 / FF19, FF2B$80:B7A5–B7EAThe Mixer's pans and faders to the driver; the overrides on and off; the relative fader (D6, D5)
FF34, FF37, FF3A, FF3D$80:B833The test note a click on the keyboard or the staff sounds
FF40$80:A358, the NMIEach frame: send the queue, then the tick (ED) and read the status back
FFBB$81:EB1DThe tempo, from the two icons beside ♩=
FF5E—The song's music volume (header +$2D), sent as RT2's volume command E7
FFC7$82:B9B7, $82:E7B4The driver's status (kept at $1F1B)
FF25, FF0A, FF13, FF4C–FF5B, FFAC, FFBE–FFC4, FFD3VariousNot yet named

The instruments, their names, and how each sounds: Instruments and the mixer.

Notes/Kanadeeru/Sound.md; Tools/kana_sound.py (uploads, driver, rip), Tools/snes_spc.py --patch kana, Tools/rt2_sound.py (instruments, samples: RT2's, the same bytes).

The memory pack files#

An 8 Mbit Satellaview pack is eight blocks of 128 KB. Kanadeeru writes one file to a block, with a Satellaview header at $7FB0 that names the file; its checksum is the 16-bit sum of every byte of the block but the header's 48 ($83:85F0), the same rule as RT2's. Kanadeeru writes two kinds.

MTTC: songs for RT2#

Convert's file, KANADERU CONVERT, holds songs compiled for RT2, in an 'SN' container:

Block offsetWhat
$0000MTTC, 4 zeros, ASCII TCOOL MEMP (the template at $83:90CD)
$0018The 'SN' container: S, N, the song count, then a 3-byte offset for each song from the container's start (E8 01 00 for the first: $0018 + $01E8 = $0200)
$001E–$01FF$FF (erased)
$0200Song 1: a length word, then the song in RT2's driver format; song 2 follows straight after it, with no padding
… – $7DFF$FF
$7E00A boot stub ($83:A41D), to $7FB0
$7FB0The BS header (template $83:8BF6): maker B1, title KANADERU CONVERT, the block mask, map $30, type $A0, version 2, the checksum and its complement
$7FE0The vectors ($83:A5FD)
$8000–$1FFFF$FF

The writer is $83:8B1D, putting bytes to the pack one at a time through the flash routine ($83:83CD). A second song converted onto a pack that already has the file joins the same container: the count goes to 2, and the second song starts straight after the first, with no padding. How the code adds it, step by step, was not traced; the layout is from the files, which the tool rebuilds byte for byte.

RT2's side. At power-on RT2 classes the block as sound data. Its Data page lists the file by its header title and records the title and checksum in RT2's save; from then on the BGM settings run past the 30 ROM songs, and song n of the file is BGM 30 + n. RT2 loads the song to its sound chip byte for byte and plays it on the same samples (Songs for RPG Tsukuru 2). Since RT2 needs nothing of Kanadeeru but the file, any song RT2's driver can play can reach it this way: what is still missing for music from outside is a writer of the driver's song format, from MIDI say.

MTSV: the whole cartridge#

Save and Load to the pack move the cartridge's whole 32 KB, not one song. The file is titled KANADERU SCORE and holds the SRAM in the block's third 32 KB:

Block offsetWhat
$0000MTSV, 4 zeros, ASCII TCOOL MEMP (the MTTC template with the name changed), 8 × $FF
$0020The save's name: 8 title codes, $46 filling ( is 21 16 22 3F 46 46 46 46)
$0028–$7DFF$FF
$7E00The boot stub, as in MTTC; its text at $7F00 reads ("can't be used with the BS-X cartridge")
$7FB0The BS header (template $83:8C26): as MTTC's, titled KANADERU SCORE
$7FE0The vectors
$8000–$FFFF$FF
$10000–$17FFFThe cartridge's 32 KB SRAM, byte for byte
$18000–$1FFFF$FF

The sum covers the SRAM copy too. RT2 sorts such a block among the pack's files by its first four bytes; what its menus would do with one was not tried.

Delete erases the block's first 64 KB sector: the header, the name, the stub and the Satellaview header are gone, and the SRAM copy in the second sector is left behind. The flash routine ($83:8265) picks its commands by the pack's flash type: a clear-status and a block erase for type 0, a JEDEC-style sequence for type 1.

Notes/Kanadeeru/Memory Pack.md, Storage.md; Tools/kana_mttc.py (list, extract, build, check), Tools/kana_store.py pack, Tools/snes_mempack.py.

The Turbo File file#

A Turbo File Twin in STF mode has 124 blocks of 1 KB after a 4 KB table that chains each file's blocks and keeps a sum for each. A Kanadeeru save is one file of 33 blocks, so a Twin holds three, and like the pack's it is the cartridge's whole SRAM:

File offsetWhat
$0000SHVC, then the code A7 (not the cartridge's game code ZMCJ)
$0008The name: the 8 title codes as 16 digits, each nibble written as '0' + the nibble, so $A–$F come out as :–? ( is 2116223?46464646)
$0018–$8017The cartridge's 32 KB SRAM, byte for byte
$8018–$83FFZeros, to the end of the 33rd block

The code A7 is not the cartridge's own; whether it is ASCII's code for the program, a wildcard or another title's is open, and so is whether Kanadeeru's list would show only A7 files on a Twin that holds other games'. Kanadeeru's own format writes $FF over the whole table area and the FAT0 mark and leaves the blocks as they were (RT2's writes only the 124 entries). Delete frees the file's 33 entries and leaves its blocks' bytes in place.

Notes/Kanadeeru/Storage.md, Notes/Turbo File.md; Tools/kana_store.py twin, Tools/snes_turbofile.py.

How this was checked#

Every format on this page was written back as well as read, so that a reading that was nearly right would show:

WhatHowResult
The song formatThe nine songs parsed into 8 tracks of 128 bars and packed againByte for byte, every sum and page count good; 1,593 of 1,676 written bars add up to a 4/4 bar
The saveSaves written by the tool from song blocks, renamed and retimed, loaded in the editor and saved backThe dump rebuilt byte for byte; a tool-made save loaded, and saved back over itself left all 32 KB as the tool wrote them
The signs, the panels, Initial SettingsEach control used alone on a one-note score in Mesen, then the save or RAM comparedEvery sign code, gate time, dynamics, the clef, key, time signature, chord mode and Automatic Rests tied to its byte
The compilerThe editor's compiled song read from RAM and from the sound chip, against Convert'sThe same length, 84 bytes apart in the three places above; the sound chip's copy byte for byte
The soundThe SPC image and the driver compared with RT2's, handler by handler; the nine songs ripped as .spc and run 300 frames beside the gameSamples, instruments and kit equal; every song's tempo the score's; ticks equal or one apart
The route to RT2Convert to a pack in Mesen, the pack taken to RT2 from power-on, through its Data page and BGM settingsRT2 lists KANADERU CONVERT, offers BGM 31, loads the song to the sound chip byte for byte and plays it on the same samples
MTTCThe game's one- and two-song files rebuilt by the tool; a tool-made file with a second song played in RT2All 128 KB byte for byte; the second song played
MTSV and the Turbo File fileSaves to each medium in Mesen and MesenCE, loaded back into a cartridge holding another song; the tool's files loaded by the gameSRAM back byte for byte both ways; whole pack and Twin images equal to the game's
The limitsSaves written to sit just under each limit, then one more note or song895 events a track, 128 bars, 42 songs; each refusal's message seen
The second emulatorThe playback repeated in bsnesThe compiled song and the sound chip's copy byte for byte; the same tick rate. The pack route can't run there (below)

The project's tools that read or write these formats:

ToolReads or writes
kana_song.pySong blocks and the save: list and dump the nine songs, check (every song packed again byte for byte), save (a cartridge save from song blocks, renamed or retimed, with every sum made good)
kana_mttc.pyThe MTTC file: list, extract its songs as RT2's driver takes them, build one from song blocks, check (Kanadeeru's own files rebuilt byte for byte)
kana_store.pyMTSV and the Turbo File file from any SRAM image: pack, twin, check
kana_sound.pyThe sound: uploads (the SPC image), driver (the comparison with RT2's, handler by handler), rip (the nine songs as .spc)
kana_hot.pyEvery hotspot table, action by action
kana_ui.pyClicks in the running game: the pointer written into RAM and A pressed, with screenshots; --rom a patched copy, --lr in bsnes
kana_cover.pyThe code/data log: random clicks from saved states on every screen
snes_mempack.py, snes_turbofile.pyPack and Twin images: list names the files (Kanadeeru's saves by name), srm gives a save's SRAM back
snes_spc.py, rt2_sound.py.spc files (--patch kana); RT2's song reader, instrument names and samples, which serve Kanadeeru unchanged
snes_dis.pyThe disassembler, with the register widths from the log
mesen.py, lr.pyMesen and MesenCE headless (--pack a memory pack, --ce the Twin), and bsnes through its libretro core

Notes/Kanadeeru/Analysis Plan.md, Second Emulator.md.

Fan-made reference material, one of the Eschaton Games Tsukuru guides. Not affiliated with the publishers of the titles it covers.