Eschaton GamesSound Novel Tsukuru an English guide

How it works#

This page is for readers who want the formats: how the cartridge is laid out, how its little file system keeps a novel, every byte of a card, a text, the item file and the saved reading, how the player runs a novel, and how the text, the pictures, the sound and the memory-pack and Turbo File files are stored. 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 ($00:D800). The program runs its code in banks $00–$3F, the slow mirror of the ROM; the file offset of $bb:aaaa is bb × $8000 + aaaa − $8000. Offsets into a drive (the save, or a novel in the ROM) are written $0000–$FFFF, into a file or a record +0. 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-ZSNJ, maker code B1 (the header's B1ZSNJ at $00:FFB0); the title screen shows ©1996 ASCII CORPORATION and ©1996 SUCCESS, the developer. Inside:

The program is its own, not RT2's or Kanadeeru's: only 2–3 % of its bytes are in runs shared with either, most of them in the sound system. What it shares is listed at Compared with Sound Novel Tsukuru 2.

Notes/Sound Novel Tsukuru.md, Program.md.

The ROM#

BanksFileWhat
$000x000000the core: start-up, interrupts, the frame wait, the picture loader, text drawing, the file system ($00:D75C–$00:E5B0), the flash-pack routines, the Turbo File driver
$010x008000the main loop and the menus, the front end, the memory-pack and Turbo File pages
$020x010000editor tabs, cards and files; the BGM and SE name lists ($02:EB39, $02:ED25); the sound steps' routines
$030x018000editor tabs; the editor's two message tables ($03:B020, $03:B3EC); the ASCII mosaic logo ($03:E60E, packed)
$040x020000the menus' maps, the Data page's windows, the run-length decoder ($04:EF63)
$050x028000the power-on check and the format prompt, the opening, the Continue question, the name entry in play, an editor tab ($05:8000)
$060x030000the 8 × 8 menu font ($06:809C)
$070x038000interrupt handlers, the pack check, the menus' graphics ($07:808C), the window font ($07:B110) and the pack and Turbo File windows
$080x040000the novel player: the step interpreter and the 29 step routines
$090x048000an editor tab, play-side code, the effect and tempo name tables
$0A0x050000not described by the study's map
$0B0x058000drive 11: the staff roll, a novel of 40 files
$0C–$0F0x060000the text font: 1,799 glyphs of 16 × 16
$10–$370x080000the pictures: 91, uncompressed, behind a directory at $10:8000
$38–$390x1C0000drive 1: sample part one
$3A–$3B0x1D0000drive 2: sample part two
$3C–$3E0x1E0000sound data: the samples' first part, the 60 songs ('SN'), the sample directory, tuning, instruments, vibrato, drum kit
$3F0x1F8000the sound module (65816): its entry table, the queue, the effect scripts and their interpreter, the menus' sounds
$80–$9F0x200000the third megabyte: the 'SP' container of 125 recordings; in the bank tails the sound driver ($80–$8B) and the samples' second part ($90–$99); the 'SA' container at $9F:C400

The third megabyte is one container. File 0x200000–0x2FFFFF is an RT2-style 'SP' container of 125 recorded sounds. RT2's container reader takes $7E00 bytes a bank and skips each bank's last 512, and the build used those skipped tails for fixed uploads: the sound driver sits in the tails of banks $80–$8B and the samples' second part in those of $90–$99 (The sound). Other tails hold pieces of RT2's sound data, left as the build tool's buffer held them (inferred).

The map comes from a code/data log of Mesen's: 63,939 bytes of code, 571 routine entries and 90 indirect jumps from 39 runs from power-on and from saved states on every page, and from which instructions read which bank. A Mesen log files memory-pack reads under ROM offsets past 0x200000, so its flags there are ignored.

Notes/Sound Novel Tsukuru/Program.md; Tools/snes_dis.py snt (the disassembler), Tools/snt_nav.py (keys from a saved state).

The program#

Start-up. The reset ($00:8000) sets native mode and the stack at $1F8F. A power-on clears the work RAM; a warm boot, when $006C holds PO (the program writes it once start-up is done), keeps it and skips the logo, the drive check and the opening, so RESET goes straight to the title. $00:E5B4 puts the interrupt vectors in RAM: the NMI and IRQ vectors point at $0074 and $0078, and each screen swaps in its own handler. Then the video, DMA and the sound start ($3F:FF01, the sound module's entry table), and $01:CE51 runs: the file system's start ($00:D96E) with drive 0 selected, the memory-pack check ($07:FB1E, RT2's flash detection $00:A35B), the logo and the drive check ($05:DB0C), the opening and the title ($05:E532). The title takes A, not START.

The main loop ($01:CECE) runs the main menu ($01:8020), which returns a choice in $0020; Data and Config are handled inside it. The choice indexes a table at $01:CEDF: 0 Game ($01:D0C7: drive 0, or the ROM drives 1 and 2), 1 Edit ($01:CF4F), 2 Turbo File ($01:EA4C), 3 Memory Pack ($01:D34B). There is no mode word as in RT2: each screen is a routine that runs its own loop and returns.

The editor dispatches on its current tab, $0FCF, through $01:CF79: tabs 1–6 go to $03:8000, $03:9A58, $02:8000, $09:8000, $02:9830 and $05:8000. Each returns a code in $0020; $0505 and $05A5 leave the editor.

Parameters pass in fixed direct-page words, $0020–$002E, with long pointers at $0040, $0044 and $0048; results come back in $0020. The most-called routines are the frame wait $00:C09C (134 callers), a menu sound $3F:FF82 (104), the string drawer $00:B776 (71) and the map copier $00:839F (32).

Notes/Sound Novel Tsukuru/Program.md.

The drive#

The program's file system names itself in the first bytes of every drive: ADV TUKOOL ROM/RAMDISK SYSTEM. A drive is 64 KB in 512 clusters of 128 bytes, cluster n at offset n × $80: a header, a directory, a table of clusters, the files' data, and outside it all the configuration. The SRAM is one drive, and so is each sample in the ROM.

A drive, to scale: 64 KB in 512 clusters of 128 bytes $0000 $FFFF header and directory file data: clusters $48–$1F8 (433), $2400–$FC7F the cluster table, $2000–$23FF the reading and Config, $FC80–$FFFF Cluster 0, enlarged: 5 units a byte ADV TUKOOL ROM/RAMDISK SYSTEM S-RAM DRIVE (48 bytes) entry 0 entry 1 entry 2 … 508 data sum $3C header sum $3E 16 bytes: name, type, cluster, size The last 896 bytes, enlarged: outside both sums the reading: the 30 items as they stand, $FC80–$FF7F the reading's card, step, picture and music, from $FF80 (VS) the configuration, $FFE0 (TS)
A drive. The two sums guard the name and everything from $0040 to $FC7F; the last 896 bytes, where the save point and the settings write, are outside both, so playing never has to remake a sum.
OffsetClustersWhat
$0000–$002F0the name: ADV TUKOOL ROM/RAMDISK SYSTEM S-RAM DRIVE (48 bytes; the ROM drives say S-RAM too)
$0030–$003B0zero after a format; the ROM drives hold other bytes here, which nothing seen reads (a Turbo File copy uses three of these words, below)
$003C0the data sum: the little-endian words of $0040–$FC7F, plus one
$003E0the header sum: the words of $0000–$002F, plus one
$0040–$1FFF0–$3Fthe directory: 508 entries of 16 bytes
$2000–$23FF$40–$47the cluster table: one word for each of the 512 clusters
$2400–$FC7F$48–$1F8file data: 433 clusters, 55,424 bytes
$FC80–$FFBF$1F9–$1FFoutside both sums: the saved reading (below)
$FFC0–$FFDFoutside both sums: $FFC0–$FFCF zeroed by a format, $FFD0–$FFDF never seen written
$FFE0–$FFFFthe configuration, from TS

The directory and the cluster table#

The directory is 508 entries of 16 bytes from $0040:

BytesWhat
+0–7the name: 8 bytes of the menu code (JIS X 0201 kana and ASCII, and the game's five one-byte voiced kana), padded with spaces: SC02ー01, 001Aー1, START. A first word of $0000 marks a free entry
+8–9the type, two ASCII digits: 01 a card, 02 a text, 03 the item file, 11 START and END
+10the first cluster
+12, +14the size in bytes, 32 bits as two words

A file is found by its 10-byte key, name and type together ($00:DC9C, five word compares over every entry). A first word of $0000 marks a free entry: delete ($00:E0AC) and format clear only that word, so a deleted entry stays readable but for its first two characters. The lists ($00:DD1F) take every entry whose first word is not zero and whose type matches.

The cluster table has a word for each cluster: $FFFF reserved, $0000 free, a value with bit 15 set the end of a chain (the program writes $FF00), anything else the distance to the file's next cluster ($00:E180: next = this + word). The allocator takes the first free cluster, then the first free one after the last ($00:E112, $00:E141), so chains only run forward. Freeing a file zeroes its chain ($00:E1A5); the free count the editor shows is the number of $0000 words ($00:E0EC).

The two sums are each the sum of little-endian words plus one: the header sum over $0000–$002F at $003E, the data sum over $0040–$FC7F at $003C. The power-on check ($00:D800) returns 0 good, 1 header wrong, 2 data wrong; $00:D8F8 makes the data sum again after every write.

Format and free space#

The format ($00:DA00, drive 0 only, then $01:926C) writes the name, zeroes $0030–$003D, makes the header sum, zeroes the first word of each of the 508 entries, sets table words 0–$47 to $FFFF and $48–$1F8 to $0000, then writes 14 words of $FFFF from $70:23F2 for clusters $1F9–$1FF, and 7 of them past the table's end, over the first 14 bytes of cluster $48. That overrun is harmless: the cluster is free, and the first file written there overwrites it. Last come the data sum, $FD00–$FFCF zeroed and the configuration. Everything else on the drive is left as it was.

The editor's first files. Opening the editor on an empty drive makes ITEMFILE (720 bytes, clusters $48–$4D), END ($4E) and START ($4F), and a text at $50 that it deletes again at once: 8 clusters, so the free count goes from 433 to 425.

The drives the program knows#

A table at $00:D75C holds eight drives of 8 bytes each (a 24-bit pointer, padding, a type word); the current one is $0C0F.

DriveWhereTypeWhat
0SRAM $70:0000–$71:7FFF0the cartridge's novel; the only drive the format writes
1ROM $38:8000, file 0x1C00001sample part one: 267 files, 419 clusters used, 13 free
2ROM $3A:8000, file 0x1D00001sample part two: 256 files, 431 used, 1 free
3–7pack $C1:8000, $C5, $C9, $CD, $D12the memory pack's blocks 0–4, each from the block's second bank, when the block is marked as a novel
11ROM $0B:8000, file 0x58000(set by the opening)the staff roll: 40 files; its data sum runs on into the font and doesn't match, and it plays all the same

Both ROM drives carry the SRAM's header, S-RAM DRIVE included, and pass the same sums. Their slots 316–507 are not entries: the same bytes on both, left by the tool that built them, which no type matches. The deleted entries below slot 316 look like the samples' own history, files removed while they were written (inferred). The cartridge's own save passes the check and holds no novel.

Notes/Sound Novel Tsukuru/Disk.md, Save.md; Tools/snt_disk.py (list, check, extract, format, build: the format and every save the study made rebuild byte for byte).

The novel's files#

A novel is four kinds of file on a drive:

TypeWhatPart onePart two
01cards: lists of steps46 files, 4,426 bytes25, 4,799
02texts218, 32,082228, 36,234
03ITEMFILE, the items1, 7441, 744
11START (16 bytes) and END (6)2, 222, 22

Cards and steps#

A card is a word, the number of steps; a word, the card's type for the editor's list (0 NORMAL, 4 a two-way text choice, 8 a three-way one, + 32 when one of its cards is END, 1 an Item Branch 2; END itself is 1); then the steps; then $FFFF. The type is set when a branch step is added, and nothing in play reads it (inferred: the interpreter takes only the steps).

A step begins with a word whose low byte is an argument and whose high byte is the op, group × 16 + command; the step's fields follow. The interpreter ($08:D3F1) keeps the argument at $1C1C, dispatches on the group through $08:D477, then on the command through each group's own table.

SC02ー01, the first card of sample part one: its first 24 bytes and its last 12, of 120 1D 00 00 00 00 61 00 63 00 12 00 14 00 16 00 02 00 13 30 00 00 11 03 05 … 00 40 SC02ー02, 8 bytes FF FF 1 2 3 4 5 6 7 8 9 10 11 12 13 1 the step count: 29 2 the list's type: 0, NORMAL 3 $61 Stop BGM, argument 0: at once 4 $63 Stop SE 5 $12 Fade Out 6 $14 Clear Graphic: background 7 $16 Clear Graphic: frame, silhouette 8 $02 Clear Text 9 $13 Set Graphic: background $0030, colour A 10 $11 Fade In 11 $05 Text Speed, argument 3 (shown as 04) … 19 steps more … 12 $40 Jump, to the card named SC02ー02 13 $FFFF, the card's end One step taken apart: the card's later background step, 02 13 30 00 02 13 30 00 02: the argument, here colour variant C (sepia) 13: the op, group 1 (Graphics) × 16 + command 3 30 00: its field, picture $0030 (タイボク) grey: an argument · navy: an op · green: a field · gold: the card's header · red: the end
A card is little-endian words: the step word is stored argument first, op second. Most steps are the word alone; a step that names a picture, a text or a card carries its field after it, a name in the 8 bytes of the directory's code.

The 29 ops. The editor's 30 commands map onto 29 ops: the two text choices are one op (the argument gives the count), as are the two item branches and the two Choice to Item commands; Set Graphic and Clear Graphic are two ops each (background, or frame and silhouette); and Set Item is $20 or $21 by the item's type. Groups 8–14 go to $08:E5CA, error 1.

OpScriptBytesCommandThe argument and the fieldsRoutine
$00text_area6Text Areafour bytes: left, top, right, bottom$08:D4CC
$01text10Show Texta text's name; the argument's low nibble is the colour (0–7)$08:D509
$02text_clear2Clear Text$08:D5B2
$03text_pos4Text Positioncolumn, row$08:D5BF
$04newline2New Line$08:D5E4
$05text_speed2Text Speedthe argument, one less than the speed shown$08:D611
$06key_wait2Wait for Key$08:D623
$10fade_colour2Fade Colourthe argument: the colour (0 black … 7 white)$08:D696
$11fade_in2Fade In$08:D6AC
$12fade_out2Fade Out$08:D6CF
$13background4Set Graphic: backgrounda picture word; the argument is the colour variant, 0–5 for A–F$08:D6F2
$14background_clear2Clear Graphic: background$08:D781
$15sprite4Set Graphic: window frame, silhouettea picture word; the argument is the colour variant$08:D7B6
$16sprite_clear2Clear Graphic: window frame, silhouette$08:D824
$17colour_change2Background Colourthe argument's low nibble the colour, $F the picture's own$08:D853
$18bg_effect2Background Effectthe argument's high nibble the effect, its low nibble the setting$08:D871
$19staging2Stagingthe same split$08:D8BC
$20item_set14Set Item (Yes/No, Number)an item's name and two value words, copied over the item's first two if the types match (else error 3); 1001 0000 Yes, 1000 0000 No; for a number 2000 + the operator (0 −, 1 =, 2 +) and the number. The copy ignores the operator$08:D916
$21item_input10Set Item (Name)an item's name: in play, the name entry opens on its value and writes back what the reader types$08:D972
$22item_show10Show Iteman item's name; the argument picks a Yes/No item's wording, 0 アリ/ナシ, 1 オン/オフ$08:DAB5
$30text_branch12 + 8nTwo-way / Three-way Choicen in the argument's low 2 bits; two colour bytes (base, chosen); the choice text's name; n card names$08:DD46
$31item_branch2 + 20nItem Branch / Item Branch 2n conditions, each an item's name, two words and a card: 1000 or 1001 and 0000 for Yes/No; 2000 + the comparison (0 less, 1 equal, 2 more) and the number$08:DDD2
$32text_item_choice12 + 12nTwo-way / Three-way Choice to Itemn, the two colours, the choice text, then for each choice an item's name and its value words, as $20$08:DE0E
$40jump10Jumpa card's name (END is looked up as type 11)$08:E22E
$50wait4Waitseconds, a word (× 60 for frames)$08:E34E
$60bgm3Start BGMthe argument: the tempo (high nibble) and fade-in (low nibble 1); then a byte, the song (60 and up a memory pack's)$08:E38D
$61bgm_stop2Stop BGM0 at once, 1 fade out$08:E44A
$62se2Start SEthe argument: the effect, its number in the SE list$08:E46B
$63se_stop2Stop SE$08:E59E
$70save_point2Save Pointwrites the reading, not in a test$08:E5B2
$FF(the end)2the card's end$08:E5BE

Neither sample uses $21 or $32; both were made in the editor, saved and read back. The colours in the argument of $01 and in the two bytes of $30 and $32 run white, red, orange, yellow, green, blue, purple, black (0–7); the fade colours of $10 run black, blue, red, yellow, green, purple, orange, white, in the editor's order.

Texts#

A text is little-endian words, each a character code, an index into the text font (Text and fonts), ended by $FFFF. Three controls are words of their own:

WordIn a scriptWhat
$FFFC{k}wait for a key, ♡ on screen (the same wait as the Wait for Key step)
$FFFE{n}a new line
$FFFD{p}a new page: the text window cleared, as by the Clear Text step
$FFFFthe text's end

A choice text is a text like any other, shown by a branch step: its first line is the question, each further line a choice. The player labels them with the glyphs ($6EE–$6F0) and lays them out itself ($08:DF12: the question wrapped at 14 characters, a blank line, each choice wrapped at 12, 12 lines and $401 bytes at most, else error 4). Ruby is not a feature: the sample's over is a text of its own put above the line with a Text Position step.

START and END#

The item file#

ITEMFILE (type 03) is records of 24 bytes: an 8-byte name, in the directory's code, and 16 bytes of value. A name whose first word is zero is a deleted record. The editor makes 30 records (720 bytes); both samples have 31 (744). The value's first word carries the type in its top nibble:

Top nibbleTypeThe value
1Yes/No the flag in bit 0: $1000 No, $1001 Yes; the words after it are left from earlier values
2Number the number in the second word, sign and magnitude (bit 15 the minus): 2000 3039 is 12345
0Name up to eight character codes of the text font, the first of them the first word: 0066 0081 0059 is
3, 4none3 stops the editor with FATAL ERROR, 4 lists garbage

The editor lists records only up to the first empty one, and stops with FATAL ERROR on type 3. In play the item steps work on a copy at $7F:FC00 (30 records, found by name by $08:DC38); a name not found is error 2, a type that doesn't match error 3. Set Item copies its two value words over the item's first two if the type nibbles match, whatever the operator ($08:D916), which is the bug on Limits. Part two's items 000–004 hold its title for Show Item, and its – the special thanks the staff roll shows (Behind the scenes).

A novel as a script#

The study's snt_novel.py writes a drive as a script and builds a save from one; every file of both samples, the staff roll and every save the runs made comes back byte for byte. A step is its name from the table above, the argument in hex, then its fields (names in brackets):

start [OPEN] 00 0000
card [OPEN] 4
  background 00 0030
  fade_in 00
  bgm 11 0D
  text 00 [T1]
  text_branch 02 00 01 [Q] [LEFT] [RIGHT]
card [END] 1 11
items 30
text [Q] どちらへ行きますか?{n}左の道{n}右の道

A novel written so, built into a save, plays in the game: the guide's own example novel for the screenshots was made that way.

Notes/Sound Novel Tsukuru/Novel Format.md; Tools/snt_novel.py (dump, check, build).

The save slot#

A save point writes one reading, for the whole cartridge, into the drive's last bytes, outside both sums ($08:E5B2 → $08:ED75); in a test ($1CAC ≠ 0) it does nothing.

OffsetWhat
$FC80–$FF7Fthe items as they stand: the 30 records of 24 bytes the player keeps at $7F:FC00
$FF80VS
$FF82the word sum of $FF84–$FFCF
$FF84–$FF92the display state, among it the text window's area (00 00 0D 0B by default; inferred from the values)
$FF94–$FFA5the steps that set what is on screen and playing: the background step and its picture, the frame or silhouette, the effects, the BGM step and its song, the endless effect ($FFFF none)
$FFA6–$FFAFSTART's bytes 6–15: the start card's name and the stamp
$FFB0–$FFB7the card the reading is in (the last one jumped to)
$FFB8, $FFBAthe step after the save point: a pointer into the card's copy at $7F:0000
$FFBC, $FFBEtwo more words of state ($0B7B, $0B7D)

Continuing ($05:D27B, $08:EEDE): when a game starts, the slot must hold VS, its ten bytes must match the drive's START (the start card's name and the stamp), and its sum must be right. Then the game offers (a glyph box at $05:D371), and Continue ($08:EF7F) loads the card, restores the items, the background with its colour variant, the frame or silhouette, the effects, the music and an endless effect, and goes on from the step after the save point. A drive identical but for the stamp starts from the beginning, the reading left in place. The save point was checked in Mesen and in bsnes, with the same bytes written by both.

The configuration is the 32 bytes from $FFE0: TS, then the settings, written by $01:926C (a fresh one is TS 03 01 03 00 00 00 00 01 and zeros). Byte $FFE9 bit 1 is the pack sound, and the chosen file's title follows at $FFEA; the power-on pack check writes $FFE3 and $FFE9. Config's and the editor's System settings live here too; which byte holds each was not mapped.

Notes/Sound Novel Tsukuru/Play.md, Second Emulator.md.

The player#

The novel player is bank $08. Starting a game selects a drive and runs START's jump. The card loader ($08:E320) finds the card by name, copies it to $7F:0000, and in a test checks it against the stopper ($1C0A). The interpreter ($08:D3F1) then reads step after step; the current card's name is kept at $1CA2, the step pointer at $0058, and the steps that set what is on screen and playing (the background, the frame or silhouette, the effects, the BGM, an endless effect) at $1C90–$1CA0, which is what a save point copies.

The reader has one button because the player reads the pad in two places only: the key wait ($08:E5D9, a 120-frame state with ♡ on screen) and the choice ($08:E6EF–$08:E727). The text drawer reads none, so nothing can skip or speed up the text.

Errors ($08:ECE6) show one of seven messages from the editor's message table at $03:B020, then end the play (the main menu, or the editor in a test). The list is on Limits. A game with no START stops earlier, at $05:D253.

The test menu (X, $05:DDD1) opens unless a background effect or a staging effect is running ($1CB0, $1CB2).

The staff roll is a novel too. The opening and the staff roll ($05:E57B) point the drive at file 0x58000 (bank $0B), drive 11, and run the same player on its 40 files: cards and –, 30 texts, and an item file of five test items the script never uses (Behind the scenes).

Notes/Sound Novel Tsukuru/Play.md, Novel Format.md, Hidden Content.md.

Text and fonts#

The program has two text codes and three fonts.

The text font is 1,799 glyphs of 16 × 16 at $0C:8000 (file 0x60000–0x7C1BF), glyph n at + n × $40, four 2bpp tiles each (colour 2 the stroke, 1 its shadow), copied to video memory by the DMA queue at $00:BF3E. A novel's texts are words of this code.

CodesWhat
$000the space (full width)
$001–$056hiragana: the 46 in あいうえお order, the voiced and half-voiced ones, ゐ ゑ ー 、 。, then the small ones
$057–$0ABkatakana, in the same order, with ヴ and ヵ
$0AC–$0EFsymbols: & * @ … ♪ ± × ÷ =, shapes, 「」『』【】, ≠
$0F0–$12Dthe digits, then the full-width Latin letters
$12E–$5631,035 kanji in reading order, a selection of the 常用漢字表 in its order, with 43 shaded heading glyphs among them, one before each reading: they open each reading's group on the text editor's keyboard, and never appear in a text
$564, $565↵, and the editor's end-of-text mark
$566–$585Ⅰ–Ⅹ, 壱 弐 参 四 … 九 零, ( ), ~, ”, the eight arrows
$586–$5B6extra kanji for horror stories: 超 鬼 闇 怨 呪 魔 謎 妖 霊 …
$5B7–$5BA・ … ♡ 々
$5BB–$6BFmore extra kanji, in reading order
$6C0–$706additions: kanji for names (秦 … 篤), /, the choice labels A. B. C. ($6EE–$6F0), ~, 〝, and 17 more kanji (敦 … 烈)

21 characters have two glyphs (( ) ← → ~, seven kanji numerals and nine kanji drawn again later); a text takes the first. 49 codes have no character: the 43 headings, the end mark and five marks never seen in use. The table was made by matching every glyph against the same characters drawn in four Windows fonts and aligning the main kanji block, by dynamic programming, against the 常用漢字表 in its order; every sheet of 256 was then looked over, and all 446 sample texts decode to plain Japanese.

Part of the text font, as the ROM holds it.
Part of the text font, as the ROM holds it.

The menu code is a byte a character, for everything the menus and editors write, and for the names of a drive's files. A table of 256 tilemap words at $00:B936 (and a highlighted copy at $00:BB36) gives each byte its tile in an 8 × 8 menu font at $06:809C; the string drawer $00:B776 writes the words into a copy of the BG3 map at $7E:E800. It has ASCII digits and capitals, the JIS X 0201 kana and marks, and 17 characters of the game's own at $80–$90: 分 岐 作 成 上 下 移 元 行 太 小 同, the kanji of the editor's labels, and the five voiced kana ド ベ ジ バ ゲ in one byte each. The name grid writes those five as single bytes, which is why 30 of part two's names begin with the byte $88: … . The long-vowel mark ー shows the tile of -.

The 8 × 8 menu font.
The 8 × 8 menu font.

Ready-made windows. The Turbo File and memory-pack messages, the Data page's questions and a few pickers are not strings but finished BG3 tilemaps (a width, a height, then the words, frame included): 37 of them, at $04:9C46–$04:A0BE and $07:C110–$07:E462. They use a second 8 × 8 font, the window font at $07:B110, the menu font with its last tiles changed: ゛ and ゜ drawn small at the foot of a cell, to sit on the row above the kana they voice, and 、 。. The big headings of the main menu and its pages (, …) are none of these: they are 4bpp pictures on BG1.

The power-on lines and the Continue question are glyph boxes in the text font (a width, a row count, then glyph words), drawn by $00:CEE5.

Notes/Sound Novel Tsukuru/Text.md; Tools/snt_charset.txt (every glyph code), Tools/snt_text.py (fonts, menu, strings: 1,298 strings dumped, 93 of 95 read off the screens found).

The pictures#

91 pictures, uncompressed, at file 0x805C0–0x1BB7A2 (banks $10–$37), behind a directory at $10:8000 of 16-byte records ended by $FFFF: the picture's number (the word a step holds), its type (0 background, 1 window frame, 2 silhouette), an offset from $10:8000, and its name in the menu code. Numbers run $00–$41 for the 61 backgrounds, $64–$65 for the frames and $66–$81 for the 28 silhouettes; five are missing from the run ($10, $29, $2E, $31, $40), and a scan of the ROM for the header's fixed words finds exactly these 91, so nothing is hidden.

OffsetWhat
+0the picture's number again (a frame's with $4000 set)
+2, +4, +6offsets from the picture's start to the palette ($10), the tilemap ($210) and the tiles ($914): the same in all 91
+8its name again, 8 bytes
+$10the palette: 256 colours, of which 192 are used: six colour variants of 32 colours (two sub-palettes) each
+$210the tilemap: a width (32), a height (28), then 32 × 28 words
+$914the tiles: their byte count, then 4bpp tiles, as many as the map uses (1 for the flat colour , up to 879 for )

Loading ($00:84BB walks the directory, $00:84E5 turns the offset into an address): the tiles go through the DMA queue in $1000-byte pieces, to tile $90 of its layer for a background and to tile 0 for the others; the map through $00:839F; and $00:862B takes the variant's 64 bytes at +$10 + variant × 64 into palette 2 (a background) or palette 4 (a frame or silhouette). A background's map numbers its tiles from $90 and uses palettes 2 and 3; the others' from 0 with palette 4.

The six colour variants are the steps' argument, A–F: a background in full colour, a darker night version, sepia, red, grey and negative; a silhouette in navy, green, olive, red, grey and light grey (The pictures).

A silhouette is light, not paint. The background is on BG2 and the frame or silhouette on BG1, and colour math adds BG2 to BG1, unhalved ($2130/$2131): the silhouette is the background lit by its colour, so the house shows through the figure. Checked to the pixel: a screen drawn from the ROM alone matches Mesen's frame in all 54,774 pixels outside the text.

A silhouette added over a background, as the game draws it.
A silhouette added over a background, as the game draws it.

The editor dims its wallpaper: the same picture, with each colour channel passed through a fixed table, about 5/8 (the routine was not traced).

The menus' own graphics are raw too: tiles at $07:808C, palettes from $07:8008, maps in bank $04. A run-length code, unpacked by $04:EF63, packs eight blocks of maps loaded just before the title, among them the ASCII mosaic logo at $03:E60E (6,469 bytes, Kanadeeru's byte for byte):

CodeWhat
01 n bn copies of the byte b
02 n wn copies of the word w
FE n and n bytesthe bytes as they are
c n and c bytes (any other c)the c bytes, n times
FFthe end

Notes/Sound Novel Tsukuru/Graphics.md; Tools/snt_gfx.py (list, draw, check against Mesen's video memory: tiles byte for byte, maps word for word, palettes the variant named).

The sound#

The music is RT2's sound system: its 44 samples, 48 instruments, 36-drum kit, vibrato and tuning byte for byte, its song format, and a later build of its driver. That build adds what RT2's music never used: recorded sound. Every one of the 256 sound effects is a short script the 65816 runs each frame, which either streams one of 125 recordings into a ring buffer on voice 7, or uploads one of 28 small synthesised effects.

The sound chip's memory#

The start-up ($3F:DDAF) takes a base bank, its own bank − 3 = $3C, and loads these, each checked against the sound chip's memory in play:

FromBytesToWhatAgainst RT2
$3C:8000, a whole bank$8000$2000the samples, first partthe same
the last 512 bytes of banks $90–$99$12FD$A000the samples, the restthe same
$3D:FE00$B0$1F00the sample directorythe same, 4 bytes repointed in play (sample 1, the stream)
$3D:FEC0$58$1EA0the samples' tuningthe same
$3D:FF20$C0$1CC048 instrumentsthe same
$3E:FE00$40$1FC016 vibrato presetsthe same
$3E:FE40$120$1D80the 36-drum kitthe same
the last 512 bytes of banks $80–$8B$16E0$05E0the drivera later build

The containers are RT2's: 'S', a letter, a count, then 3-byte offsets, reading $7E00 bytes a bank.

ContainerWhereEntriesWhat
'SN'$3D:800060the songs, one per BGM number
'SE'$3F:C8EE1one block of 5 effects, uploaded to $B300: the menus' sounds
(no tag)$3F:C989256the effect scripts, as offsets from $3F:C989
'SP'$80:8000125the recordings, streamed
'SA'$9F:C40028the uploaded effects

From a step to the speaker#

the novel the player sound module, bank $3F sound chip: driver out Start BGM $60: tempo, fade in; the song n $08:E38D, $02:EA21 C5 the tempo divisor F6 to fade in load and play n below 60: 00 n, the ROM 60 up: 02 n − 60, the pack the song at $D000, voices 0–7 $02:EA81 command 0A n Start SE $62: effect n of the 256 effect script n run each frame ($3F:EA66) 230: stream a recording 26: upload an 'SA' effect voice 7 ring at $B400: blocks fed (D9), or a block run (D3) DSP 8 voices speaker Each call joins a queue of 16 in bank $3F. Once a frame, in the NMI, the frame service ($3F:E28E) sends the queue, feeds the stream, runs the effect script, then ED, the tick. Recordings: the 'SP' container, the ROM's third megabyte (125, 7.5–11.2 kHz). Uploaded effects: the 'SA' container (28), each with its own waveform.
Two routes to the speaker. A song goes whole to the sound chip and plays on the music's eight voices; an effect is a script on the main processor that borrows voice 7 from the music and feeds it, block by block, while it lasts.

The sound module (bank $3F) is rewritten around RT2's: a jump table of 79 entries at $3F:FF01, as in RT2 and Kanadeeru, but only some 1,600 bytes in runs shared with Kanadeeru's and 1,350 with RT2's. A call puts a command and a parameter in a queue of 16 ($1FC0); the frame service $3F:E28E, from the NMI, sends it. Commands $80 and up go to the driver as they are; those below are the module's own:

CommandDoes
00 nload ROM song n (the 'SN' entry, to the sound chip's $D000) and start it
02 nload song n of a memory pack's 'SN' container (its pointer set by $3F:FF1C)
04 n, 06 n, 08 nwith the effect voice reset: play recording n, a memory pack's recording n, uploaded effect n
0A nplay effect n of the SE list: start its script
0Cstop the effect
0E, 10pause, resume: the music, the stream and the script together
12, 14stop everything; stop the stream

The steps. Start BGM ($08:E38D → $02:EA21): the step's argument is the tempo in its high nibble, an index into $02:EA62 (150, 100, 200, 60, 240) sent as C5, the driver's tempo divisor, so the song plays at ×1, ×1.5, ×0.75, ×2.5 or ×0.625; its low nibble 1 sends F6, a fade-in. The byte after is the song: below 60 command 00, from 60 a memory pack's song, 60 less (command 02), if the pack's songs were found at power-on. Stop BGM sends EB (at once) or F8 (fade out). Start SE sends 0A with the SE list's number, $00–$FF; Stop SE sends 0C. The menus' five sounds go through $3F:FF82 (FE n): 0 the cursor, 1 A, 3 B, 2 a thing done or a button ignored, 4 a refusal.

The BGM step's two bytes are kept at $1C9C/$1C9E, and the effect at $1CA0 when the table at $08:E49E flags it as continuing (the 87 endless effects and four long runs of footsteps), else $FFFF: that is what a save point keeps, so a continued reading restarts its music and its endless sound.

The driver#

A later build of RT2's driver, at the same place ($05E0, at most $16E0 bytes), reassembled around new variables: one tick per ED, once a frame; 17 channels (0–7 the music, 8–15 the effects, $10 the conductor); one table at $18D6 of the port commands FF down to C4, then the song events C0–F6. There is no play-time counter as in RT2.

CommandDoes
DC pstart a stream: take voice 7, at pitch p
C4point sample 1 at the ring
D9BRR blocks from the ports into the ring, $B400–$BFFC (341 blocks of 9 bytes)
DBkey on voice 7: sample 1, ADSR $8F $E0
DAmark the ring's last block as the end, and loop
D8give voice 7 back to the music
C6key off voice 7 and end the ring at its current block
D3start the uploaded effect at $B400
D4key off voice 7
C8stop every effect channel that is sounding
CA p, D1 v, D2 v, C9 wthe effect voice's pan, its two volume bytes, a word
CB, CC mclear, set bits of the effect flags
CF, D0, C7; CD v, CE sthe effect voice's own fade, beside the music's: in, out, off; its level; its two speeds
C5 nthe tempo divisor (150 at the start): the Start BGM step's tempo goes here

The effects#

Each of the 256 effects is a script at $3F:C989 + its offset, run by $3F:EA66 one opcode after another until one waits: even opcode bytes through a table at $3F:EABB, little-endian words, jumps relative to the next opcode.

OpDoes
00, 02nothing; the end
04 n; 36 a mplay recording n; recording a + (random & m)
06 n; 38 a mthe same from a memory pack's 'SP' (no script in the ROM uses them)
3C nupload effect n of 'SA' and start it
34end when the stream has played out
28 w; 42 w mwait w frames; w + (random & m)
2A r; 3E r; 40jump; call (one deep); return
2C n; 44 a m; 2E rset a count; a random one; loop back while it lasts
32 x; 3A a mthe stream's rate index + x (signed); + a random amount
30 wstart the next stream from block w
0A–26, 46–4Athe effect voice's port commands: pan (4 settings), level, volumes, flags, fades, stream off, effects off

Almost every script first calls a shared preamble (+$200): C6, a frame's wait, uploaded effect 22 (a lone F6 and a rest, which clears voice 7), and the default pan, volume and fade. Then it plays its sound: 230 effects stream a recording, 26 upload an effect. Some use the random ops for variety: picks one of two thunderclaps at a random rate, (cicadas) chirps a random number of times between pauses. Of the 87 endless effects, 51 loop in their script and 36 through their sound. One recording, 104, is played by no script.

The 60 songs are RT2-format songs of one subsong each, a tempo in beats a minute, up to eight tracks and a conductor: 14,954 notes, 46 that loop and 14 that end (the jingles). and are wind and rain made with the music's own instruments (Music and sound). Every song was ripped to an .spc and played against the game: at equal ticks, every track's read pointer is the game's.

Notes/Sound Novel Tsukuru/Sound.md; Tools/snt_sound.py (uploads, list, song, se, check, wav, rip), Tools/snes_spc.py --patch snt.

The memory pack and Turbo File files#

The memory pack#

The pack is RT2's: eight blocks of 128 KB, block b at banks $C0 + 4b to $C0 + 4b + 3, a Satellaview header at +$7FB0 of the block. The flash routines are RT2's too (detection $00:A35B, the byte writer $00:A722). A save is one block ($00:A8DC and the routines before it), in the first free one; the slot's number names the file and nothing else:

Offset in the blockWhat
+$0000ADSV, four zeros, ASCII TCOOL MEMP (24 bytes)
+$0018–$7DFF$FF
+$7E00a boot stub, $126 bytes of 65816 code that copies a routine to $7F:0000 and jumps there, as RT2's and Kanadeeru's files carry
+$7FB0the Satellaview header and vectors (80 bytes): maker 0, the title, the block mask, the date 10 08, map $20, type $A0, $33, version 2, the sum and its complement
+$7FC0the title: the slot's name, SOUND NOVEL n, padded to 16
+$7FD0the block mask, 1 << b
+$7FDC, +$7FDEthe sum's complement and the sum: 16 bits of every byte of the block but +$7FB0–$7FDF
+$8000–$17C7Fthe drive's first $FC80 bytes, byte for byte: header, directory, cluster table, every cluster. Not the reading or the configuration
the rest$FF

Load copies the $FC80 bytes back over SRAM $0000–$FC7F; the configuration and the saved reading stay the cartridge's. Delete erases the block's first 64 KB (the flash's erase size): the marks, the stub, the header and the drive's first half become $FF, and the second half is left.

What the program reads at power-on ($00:D8AF): the first word of each block. A block whose first four bytes are a novel's mark becomes a drive of its own, from the block's second bank (drives 3–7 are the first five blocks, so at most five, inferred from the table), and its type goes to $0C21:

First bytesKindWhat the program does with it
ADSV—the program's own save: listed by the Memory Pack page; not a drive
ADDM1a novel on the pack: a drive, listed by Game → Sample Game and by Sample Load (checked with a save whose mark was changed and its sum made again)
ADRD2a novel to read only: a drive, listed by Sample Game, not by Sample Load (checked the same way)
TC4a drive, which no page lists: what it would hold is open
MTTC—Kanadeeru's songs (its Convert file): listed by Data → Memory Pack Sound by its title

The list builder $01:8F18 has three modes: 0 the ROM samples and kinds 1 and 2 (Game → Sample Game), 1 the samples and kind 1 (Sample Load), 2 kind 4 alone, which only $01:8EF2 asks for, and nothing calls that. The pack sound: choosing an MTTC file stores 3 at $FFE9 and its title at $FFEA; at power-on $01:9210 finds the block again and sets the sound module's pack pointer ($3F:FF1C) to its 'SN' container at $C0 + 4b:8018, keeping the song count in $0C5D. Command 02 n then loads song n exactly as Kanadeeru wrote it, and nothing past the count.

The Turbo File Twin#

The STF driver and its file table are the ones all four Super Famicom Tsukuru cartridges share: 124 blocks of 1 KB after a 4 KB table, FAT0 at its end. The file header template is at $01:FE40. The game code in the file is ADTK, not the cartridge's ZSNJ, as its pack files start AD.

PartWhat
the header, 24 bytesSHVC, ADTK, and the slot's name, SOUND NOVEL 1–3 padded to 16
the drivefrom $0000 up to the end of its last used cluster ($F580 for sample part one), the last 1 KB block filled with the SRAM's next bytes
the drive header's $30in this copy only (0 on the cartridge): the end of the copy ($F580 for the sample)
$32the blocks the page asks for: 63 for the sample, whose file takes 62 (an empty drive asks 10)
$3Athe word sum of $0040 up to the end, which the load checks
the size10 blocks for an empty drive, 62 for sample part one, 64 for a full drive

Load ($00:DBF1) reads the file into $7F:0000 and checks the word sum from $0040 to the end at $30 against $3A; if it fails, nothing is copied. Then $0000–$23FF (the header, the directory and the cluster table) goes into SRAM, then each cluster the table marks used, 128 bytes at a time ($00:DC81), and the drive's sums are made again. Free clusters keep whatever the cartridge had, and the reading and the configuration are never touched. The format writes $FF over the table area $000–$FFB and FAT0, and leaves the blocks, as Super Dante's and Kanadeeru's do; Delete sets the file's table entries to $FFFFFFFF and leaves its blocks.

Notes/Sound Novel Tsukuru/Storage.md, Notes/Turbo File.md; Tools/snes_mempack.py snt, Tools/snes_turbofile.py snt (each writes the game's file byte for byte from a drive, and srm gives a drive back).

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:

FormatWritten back byChecked against
The drive and its formatsnt_disk.pythe format's result on four images; both ROM drives and all 131 saves the runs made, deleted and rewritten file by file as the game does, byte for byte; sample part one built into a save plays as User Game, page for page with the ROM's
The novel's filessnt_novel.pyevery file of both samples and the staff roll, and the editor's saves, back byte for byte; a novel written as a script plays (a picture, music, text, a choice, two cards, the end), and each step command was made in the editor, saved and read back
The saved readingsnt_novel.py build savesa save point written, then continued, in Mesen and in bsnes: the same bytes in both
The text fontsnt_charset.txtall 446 sample texts decode to plain Japanese; 93 of 95 strings read off the screens are found in the dump (the other two are slips of the check)
The picturessnt_gfx.pyMesen's video memory on five screens: tiles byte for byte, maps word for word, palettes the variant named; the frame buffer to the pixel outside the text
The soundsnt_sound.pyevery upload against the sound chip's memory; all 60 songs ripped and played against the game, the track pointers the same at equal ticks; a recording and an uploaded effect caught playing on voice 7
The memory packsnes_mempack.py sntsave, a second save, load, delete in Mesen; the tool's blocks byte for byte as the game wrote them; a pack novel and a pack song played
The Turbo Filesnes_turbofile.py sntformat, save, load, delete in MesenCE; the tool's file table and blocks byte for byte as the game wrote them

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

ToolWhat it does
snt_disk.pya drive's files: list, check, extract, format, build a save from files
snt_novel.pya novel as a script and back: dump, check, build (also the staff roll, --drive 11)
snt_text.py, snt_charset.txtthe fonts drawn, a menu string decoded, every string dumped; every glyph code
snt_gfx.pythe 91 pictures listed, drawn and checked
snt_sound.pythe uploads, a song's events, an effect's script, the recordings as WAV, the songs as .spc
snes_mempack.py snt, snes_turbofile.py snta drive as the game's pack or Turbo File file, and back
snes_dis.py snt, snt_nav.py, mesen.py, lr.pythe disassembler; keys from saved states; Mesen run headless; bsnes through libretro

Notes/Sound Novel Tsukuru/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. Corrections and questions: contact@eschaton.games.