Eschaton GamesRPG Tsukuru Super Dante an English guide

How it works#

This page is for readers who want the internals: how the cartridge is built, where things are in the ROM and the save, and how the program runs a game. Everything here was read from the program and checked in emulators (the last section says how). Addresses are the console's, bank and offset ($80:8001); offsets into the save are written $0000–$7FFF. Where a point was read from the code but not seen running, it says so. Each section ends with the project's note and tool that hold the full detail; they are files in the project that made this guide, not pages of the site.

Super Dante is RPG Tsukuru 2's direct ancestor, built by the same developer with the same tool chain, and much of this page reads as "RT2's, in an earlier form". The RT2 guide's How it works describes the later machine; Compared with RPG Tsukuru 2 sets the two side by side.

The cartridge#

SHVC-ARDJ, header title DANTE SFC, maker code B1. Inside:

Just under the ROM header, at $80:FF80, sits the developer's tag in ASCII, KUSOU KAGAKU DEVELOPMENT SYSTEM VER 2.21, followed by B1ARDJ, the maker and game codes. RT2 has the same tag at the same place, as VER 2.28. The opening shows © 1995 ASCII CORPORATION and © 1995 空想科学 (Kuusou Kagaku), the developer.

Notes/Super Dante.md, Notes/Dumps.md.

The program's banks#

In LoROM each bank shows 32 KB of ROM at $8000–$FFFF, so the 1 MB are the 32 banks $80–$9F, bank $80 + n being the file's bytes from n × $8000. Code is in twelve of them: $80 shared by everything, $81 and $83–$85 the game being played and the battle, $82 the boot screens and the demo, $86 the Turbo File library, $87–$8A the front end and every editor, $9F the sound module. The rest is data.

$80core$81play runtime$82boot, demo$83play runtime$84play, field$85battle, font$86Turbo File$87front end$88editors$89editors$8Aeditors$8Bpacked gfx$8Csample game$8Denemies$8Edata$8Fdata$90sprites$91sprites$92magic$93magic$94battle bgs$95$96map sets$97map sets$98field 0$99field 1$9Afield 2$9Bfield 3$9Csound data$9Ddata$9Edata$9Fsound driver65816 code, with its data and scriptsgraphics and fontssoundthe factory save: the sampledata, use not settlednever read
The ROM by bank, eight to a row. Code sits in the first eleven banks and the last; "magic" is the spell animations, "map sets" the castle, dungeon and town parts and tiles, "field 0"–"field 3" the four fields' parts. Bank $95 was touched by none of the logged runs.

The map was made with a code/data log: Mesen marks each ROM byte as it is run or read. 112 headless runs (from power-on, and random presses from 57 saved states: every menu and editor page, play in the sample and the factory saves, test play, a battle) logged 69,329 bytes of code from 912 routine entries, and the Turbo File runs in MesenCE later added the library: 74,843 code bytes in all. RT2, in a ROM twice the size, logged 90,300. Landmarks:

AddressWhat
$80:8001Reset
$80:802BThe main loop; the mode table at $80:F000, the step dispatcher $80:8E4C
$80:86B2Queue a VRAM DMA for the next NMI
$80:8873The one pad reader
$80:8A84, $80:8A9AThe random number generator; the same, mod n
$80:8AC0The decompressor
$80:9140Create an object
$80:9CD6, $80:9D34Start a script; the script VM's run loop (tables from $80:BB1F)
$80:FF80The development tag, VER 2.21
$81:A5E3The move-script runner (people's movement)
$81:A6D2The event interpreter's step
$81:CD01The part decoder
$81:E7FDThe character routine
$82:DEA2, $82:DDA2The proportional font's pointers; the 8 × 8 font's code → tile table
$83:803FThe Mode 7 view
$83:A14APassability
$84:A298The page conditions
$85:8040The 8 × 8 font
$85:9060The encounter roll
$85:F5E8The escape roll
$86:FE16The Turbo File library's one entry
$87:A60EWrite a play save
$87:BB3F, $87:BCC7The power-on check; the format
$87:BAEBWrite the save's sums
$89:80D1A blank project's defaults
$8C:8000The factory save image: the sample game FATE
$9F:FFFA, $9F:FFFDThe sound interface; the sound start-up

What RT2 kept. A comparison of the two ROMs finds 412 runs of 32 bytes or more in both, about 47 KB: the reset, NMI and IRQ, the core library (objects, the DMA queue, HDMA, multiply and divide, the random numbers, the decompressor), the windows and the script VM, the event interpreter's step and the move-script runner, text drawing, the Mode 7 view and its 16 KB of perspective tables, pieces of the battle, the Turbo File library and the sound chip's pitch table. Most of bank $80 sits 6 bytes lower in Super Dante than in RT2. Not shared: the save check, the editors, the encounter check, RT2's tile packer and the sound driver's code.

Notes/Super Dante/Program.md; Tools/snes_dis.py (the disassembler), Tools/mesen_cover.py, Tools/snes_common.py rt2 dante.

The main loop and its modes#

The reset ($80:8001) sets the stack and the FastROM bit and clears the mode word $B9. The main loop ($80:802B) waits for each frame and runs the routine for the current mode through the table at $80:F000, an RTL address a mode. A mode with several steps starts with JSL $80:8E4C and keeps its step in $BB, moving on by adding 4. All of this is RT2's code at RT2's addresses.

ModeEntryWhat
$00$80:803EPower-on: the RAM cleared, but for the random seed
$3C$80:8061Cold or warm boot: a copy of the development tag in RAM tells a reset from a power-on
$40 / $44$82:8000Cold boot: the logos ($44 on a PAL console, the same code)
$48 / $4C$82:8061Warm boot, after a reset: the sound start-up, then straight to the demo (read from the code; never run)
$50$82:8E05The opening demo: the castle, the moon and the staff
$54$87:8234The front end and every editor; its second step runs the save check
$58$83:9175Setting up play: the game state built, the title card on a new game
$5C$84:968FPlaying a game, the user's, a test play or the sample: the field, the maps and the battle
$60$83:8A32The ending: nine cards, then back to the demo
$04–$38Unused, as in RT2; nothing sets them

One mode for the front end and the editors. RT2 gives editing a mode of its own ($78); Super Dante runs the title menu, the game menus, the edit menu and all ten editors as objects under mode $54's last step. The table ends at $60.

Objects. Every screen is a tree of objects, as in RT2: records in RAM, each with a routine that dispatches on its state, created by $80:9140. Video work is queued: $80:86B2 adds a DMA to a list that the NMI sends to VRAM.

Warm and cold boot. At power-on mode $3C compares the 48 bytes of the development tag with a copy in RAM ($7E:3A10). A power-on finds no copy, writes one and shows the logos ($40); a reset finds it and goes straight to the opening demo ($48), skipping the logos. That is read from the code; the warm boot was never run here. L + R + START + SELECT does much the same from inside a game: a hook in the frame-wait table ($87:BEB2) sends mode $54 back to its title-menu step, past the save check.

Notes/Super Dante/Program.md, Hidden Content.md, Game.md; Tools/rt2_modes.py --rom dante.

The SRAM image#

The 32 KB are one uncompressed image at fixed offsets: a signature, a total, the three play saves, one sum, the database, the maps and one event space. The program reads the image in place; the editors copy their part into RAM, work on it there, and write it back with the sums.

MapsEvent space, 17,772 bytesSignature, total, play saves, sum, titleThe databaseEnemy mapsNot used; the 4 KB copy$70$0000$1000$2000$3000$4000$5000$6000$7000$7FFFone 16-bit sum over $031C–$7FF7, kept at $031ATo scale. Gold: the save's own housekeeping; navy: the database; green: the maps and enemy maps; red: the events.
The save drawn to scale. The ticks are the 4 KB marks: the byte on each is copied to $7FF8–$7FFF at every save and copied back before the power-on check. Nearly all of the save is under the one main sum, so a stray bit anywhere in it fails the check.
OffsetBytesWhat
$000024The signature SHVC?? SUPER DANTE, padded with spaces (RT2's: SHVC????RPG TKOUL 2)
$00182The total: a record of the four sums below
$001A3 × 256The three play saves, each with its own sum
$031A2The main sum, over $031C–$7FF7
$031C1The save counter, +1 at every editor's save
$031D16 + 16The title; the author
$033D128 × 13Items
$09BD32 × 12Magic
$0B3D8The field enemies on land and at sea: two 32-bit masks, rewritten at every save
$0B4580 × 30Enemies: 0–31 the field's, 32–63 the dungeons', 64–79 the events'
$14A527The start: the first party, gold, the vehicles, the music slots, the start place
$14C08 × 40Heroes
$16001,024The field's enemy map: 16 × 16 field screens, a 32-bit mask each
$1A001,024The pool screens' enemy masks, 4 bytes a screen
$1E0010The map header: bits 0–1 of $1E00 choose the field; the rest not identified
$1E0A64A nibble a map: 0 unused, 9 castle, A dungeon, B town
$1E4A32The screen pool's bitmap, a bit a screen in use
$1E6A128 × 8The map names
$226A128 × 16The maps' grids: 4 × 4 screens, each a pool screen + 1, 0 none
$2A6A255 × 16The pool: 16 part numbers a screen, rows first
$3A5A17,772The event space
$7FC650Not identified (read in place of the start block in one case, test play by the look of it)
$7FF88A copy of the bytes at $0000, $1000 … $7000

The database is fixed records, packed where they could be. Several numbers are 14-bit fields sharing a word with two bits of something else: the value is the word shifted right by 2, the low two bits belong to another field, and the editors cap the value at 9,999. An item's kind, 0–13, is split between the low bits of its power and its price; an enemy's attack word carries where it appears (land, sea) in its low bits; its defence, speed, experience and gold are four 14-bit numbers packed into 7 bytes.

RecordBytesLayout
Item (128 at $033D)130–1 power (bits 2–15) and the kind's low 2 bits; 2–9 name; 10–11 price (bits 2–15) and the kind's high 2 bits; 12 who can equip, bit n = hero n
Spell (32 at $09BD)120–7 name; 8 MP cost; 9 the animation (1–13; 0 and $FF none); 10–11 power. The effect is the slot
Enemy (80 at $0B45)300–7 name; 8 graphic (bits 0–6; bit 7 set on every defined enemy); 9 battle methods 0–7; 10–13 the spells it casts, a 32-bit mask; 14 methods 8–15; 15–18 the spells that work on it; 19–20 HP (bits 2–15); 21–22 attack (bits 2–15) and where it appears (bits 0–1: 1 land, 2 sea); 23–29 defence, speed, experience and gold, four 14-bit numbers, low bits first
Hero (8 at $14C0)400–4 name; 5 graphic; 6 starting level; 7–11 the growth of strength, vitality, intelligence, agility and luck; 12–39 the level each spell is learned at, 32 × 7 bits (99 never)

Two parts of the save are rewritten from the rest at every save: the two 32-bit masks at $0B3D of which field enemies appear on land and at sea, a cache of the enemies' own "where it appears" bits. A hero's type in the editor (えいゆう, せんし …) is not stored at all: it only fills in the growth figures from a preset.

The start block ($14A5, 27 bytes) is copied into the play state in RAM ($7E:8100) when a new game begins, and its fields land at the same relative places as the play saves keep them: the first party as four 4-bit hero numbers ended by $F, 24-bit gold, the ship's and airship's graphics as two nibbles stored + 1 (0 for none), the seven music slots (battle, ship, airship, field, town, dungeon, castle), the start map and place (map $FF is the field), and the two vehicles' places. A blank project starts heroes 0–3 on the field at 1, 1; the sample starts hero 6 alone in the throne room of map 127.

The power-on check#

Each time the console is switched on, the front end's step at $87:8270 calls $87:BB3F as the title menu first appears, and keeps the result in $06EF:

  1. Restore the 4 KB marks. The 8 bytes at $7FF8–$7FFF are copied back to $0000, $1000, $2000 … $7000. Every save makes that copy first, so each byte on a 4 KB boundary comes back from its last save before anything is checked. What it guards against is not settled: a trace from power-on to the title shows nothing else writing them. RT2 has no such copy.
  2. The signature: 24 bytes, SHVC?? SUPER DANTE, against the template at $87:BBE9. A mismatch formats.
  3. The main sum ($87:BCAE): the 16-bit sum of $031C–$7FF7, against the word at $031A. A mismatch formats.
  4. Each play save ($87:BC3D): the 16-bit sum of its bytes 2–255 against its first word. A mismatch zeroes that slot alone and sets its bit in the result.
  5. The total ($87:BC88): over the four words main, slot 0, slot 1 and slot 2 (a failed slot counts 0), each word w adds w + its low byte + its high byte. If it differs it is rewritten without complaint: the total is a record, not a check.

The format ($87:BCC7) writes the signature, zeroes $001A–$7FF7, writes a blank project's few defaults ($89:80D1: the start block's party and places, and $FFFF in every enemy's "spells that work on it" mask), then the sums and the total. The title then shows バックアップのデータがきえました. $06EF is 0 for a good save and for a new cartridge (a bad signature), $A0 for a bad main sum, and $80 + the slot bits for a failed play save; any nonzero value also switches on a debug box on the Turbo File pages until a game is started (below).

So the check has RT2's shape (signature, sums, slots, a total, a format) but is written separately: one sum where RT2 has nine sections, a total repaired rather than checked, a message where RT2 is silent, and the boundary copy.

Play saves#

Three of 256 bytes, at $001A, $011A and $021A. An empty slot is all zeros. A slot is written by $87:A60E (Record and the save point, after $83:831C has put the party's place into the play state) and read back by $83:86E8 on Continue; its fields are copies of the play state's.

OffsetBytesWhat
+$002The sum of bytes +$02–$FF
+$022A stamp: the main sum when the slot was saved (written, never compared)
+$041The save counter + $80: never 0, so the list takes a nonzero byte as "in use"
+$051The kind of game: 0 the user's, 1 test play (テスト), 2 the sample (サンプル)
+$063Gold
+$092The party: four hero numbers in nibbles, $F ends it
+$0B25The 200 switches, a bit each
+$244The places visited, a 32-bit mask, for teleport
+$2828The rest of the teleport list as it stood (written, not read back)
+$4418Where the party is (map, x, y; map $FF the field), the two vehicles' places, what the party rides
+$568 × 19The heroes, in hero order, in the party or not
+$EE18Unused

Each hero's 19 bytes are: the level; HP and MP now, 2 bytes each; experience, 24 bits; ten carried items, each an item number with bit 7 set if equipped ($FF none); and one byte not yet identified. The heroes' names, growth and spells come from the game data, never the slot: from the save for a user or test game, from the ROM's factory image for the sample.

A hand-edited save shows the reading is right: the factory image written out as text, one slot's gold set to 12,345, a hero's HP to 150 and the party reversed, then built back with new sums, plays in the emulator with exactly those changes.

The cartridge's damaged save#

The save on the second-hand cartridge studied here fails the check: its main sum is off by $B6, and its first power-on in a console would erase it. Three dumps after cleaning the contacts came back identical, so the damage is in the SRAM, not the reading. The stored total matches the stored sums exactly, so the game wrote the save whole and the data changed afterwards. With the layout known, the difference is six lone set bits, each in a field the save's project leaves empty, adding to $B6 exactly:

OffsetBitWhereWhy it is damage
$0347$40Item 0's priceEvery item of this project is empty; this one alone would cost 16
$1A5F$20Screen 23's enemy maskNo screen is in use
$2197$40Map 101's nameNo map is named; $40 is ▼, which no name can hold
$2719$02The map screensAll zero but for this bit
$34CE$04The map screensThe same
$3BC7$10The event spaceZero past the events' end but for this bit

Clearing the six bits gives an image that passes the check as stored, with no sum rewritten, and the game keeps it. Set bits and nothing cleared, scattered, in a save the battery otherwise held, is what decaying cells look like. What the save holds is on Behind the scenes.

Notes/Super Dante/Save.md; Tools/dante_save.py (check, dump, json and build: every field out to text and back, byte for byte; repair, factory).

Text and the fonts#

One byte a character, the same code in the save and the program's strings, and no second page: RT2's 01 xx kanji are gone, and with them all but 16 kanji. 00 ends a string, and a line of a message; name fields are padded with 5E, the space.

CodesCharacters
00End of a string, or of a message's line
01, 02゛ and ゜ alone (in no string)
06, 07『 』
08–0F姫 王 城 塔 戦 死 黒 法
10▶, the cursor (8 × 8 font only)
11–1F。 、 ー, the two halves of a bracket (8 × 8 only), ○ × ・, a small E (8 × 8 only), . , … ? ! /
20–2AP–Z
2C–2F攻 撃 神 剣
30–3A0–9, :
3BA small raised P (8 × 8 only)
3C–3F街 魔 士 聖
40▼, more text (8 × 8 only)
41–4FA–O
5EThe space
5F–8Cあ … ん
8D–95ぁ ぃ ぅ ぇ ぉ ゃ ゅ ょ っ
96–C3ア … ン
C4–CCThe small katakana
CD–FFThe 51 voiced kana, が … ポ
03–05, 2B, 50–5DUnused

From 5F on the table is RT2's byte for byte, and so are the digits and A–O. P–Z moved from RT2's 50–5A to 20–2A, the space from 40 to 5E, 『 』 to 06–07. 50–5D are unused: the 8 × 8 font keeps its window frame pieces there.

Two fonts:

The character routine is $81:E7FD (RT2's $81:F6FA), with the text object's mode choosing the font. The program's strings are in the same code: 21 tables of long pointers hold 331 (hero types, item kinds, the 16 battle methods, the 32 magic effects, the 53 event commands in two forms, the keyboard's rows), and the screens' scripts print 985 more, 1,316 in all. The name keyboard draws its rows from one of these tables, so its three pages tie every typeable character's code to its glyph.

Notes/Super Dante/Text.md; Tools/dante_text.py (table, font, find, dump).

The event space and the bytecode#

All events live in one space of 17,772 bytes, $3A5A–$7FC5: a head of seven words, then the field's events, then every map's events in one run, each map event naming its map. RT2 has a directory and a block per map; here, finding a map's events means walking the whole run, and the sample's are in the order they were made, not by map. The head:

OffsetThe sampleWhat
$3A5A426The number of events
$3A5C7The bytes free: the event page's
$3A5E31The number of field events
$3A60426The number of events to the end of the maps'
$3A62$05A3The end of the field's events, from $3A68
$3A64$4557The end of the maps' events
$3A66$4557The end of all events
One map eventsize, pages2position2map1page 14 + commandspage 210 + commandspage 310 + …page 410 + …Only the pages present take space, page 1 first, each with its own commands. A field event has no map byte.The first wordpages 4 3 2 1size of the event, in bytes150The position on the fieldy ÷ 4x ÷ 4yx150x, y 0–255; on a map 4 bits each, 0–63A pagesize2graphic1move, start1conditions6, pages 2–4commandsto the page's size0start 6–40movement 2–0start: touch, talk, search, automatic, a key; movement: the six typesitempartyswitchgold at leastFF for none (gold FFFFFF, party 0); all set must hold
An event in the event space. The first word holds both the event's size and which of its four pages are present; the commands of each page run to the page's size, with no end marker.

The position is packed into a word. On the field (256 × 256 cells) the low two bits are x's low bits, the next two y's, then six bits of x ÷ 4 and six of y ÷ 4; on a map (64 × 64) four bits each, with the top four zero. The editor's cursor at 8, 1 on the field is $0024.

A page is its size word, a graphic byte (bit 7 set on people, clear on objects in every save: inferred to be the person / object flag, as RT2's flags byte has it), a byte with the movement type in bits 0–2 and the start condition in bits 4–6, then, on pages 2–4 only, six bytes of conditions: an item, a party mask (bit n = hero n), a switch and 24-bit gold, each $FF for "none" (gold $FFFFFF, party 0). A page 2–4 with no condition never holds. The commands follow, to the page's size, with no end marker. Pages are stored page 1 first, each header with its own commands; RT2 stores the headers highest first and the commands after them.

The commands are RPG Tsukuru 2's first 53, numbered differently. Super Dante stores the slot of each command in the editor's label tables, grouped by what it acts on; RT2 renumbered the same commands (the hero's moves first) and appended 22 more. The event editor's picker lists them in RT2's order, which shows the order the commands were designed in. Each command is an opcode byte and fixed operands; only the message, 01 nn then nn lines each ended by 00, carries text.

OpCommandBytesOperandsRT2
00End the event100
01Message2 + textLine count, then the lines01
02, 03Switch on, off2Switch02, 03
04, 05Item +, −2Item04, 05
06, 07Gold +, −424-bit amount06, 07
08–0BHP +, HP −, MP +, MP −316-bit amount09–0C
0C, 0DPoison, paralyse10D, 0E
0E, 0FA hero joins, leaves2Hero0F, 10
10Experience +424-bit amount08
11Battle5Four enemies, FF none; no music29 (music and four)
12Warp4Map (FF the field), x, y2A
13–16The event faces up, right, down, left119–1C
17–1AThe event steps11D–20
1B–1EThe hero faces111–14
1F–22The hero steps115–18
23Inn316-bit price2B
24Shop5Four items, FF none2C (eight)
25Flash the screen121
26–2AScreen brighter, darker, red, blue, monochrome122–26
2BColours back127
2CShake the screen128
2DWait2Tenths of a second2D
2EThe event vanishes12E
2F, 30Music, sound2Song, effect2F, 30
31, 32Yes, no (the branches of a question)131, 32
33Save point133
34The ending1No music34 (a song)

Questions work as RT2's: a message, then 31, the yes branch, 32, the no branch to the end of the page. The sample has six, none nested. Of the 53 commands the sample uses 45; the most used are the message (362 times), the warp (158), the sound (128), the wait (127) and switch on (122), and the hero's steps 295 times together.

The interpreter#

The step is RT2's code ($81:A6D2, RT2's $81:A393): a running event is an object with its command pointer at [$0C] and a flag byte at $0F. While bit 1 is clear the step calls the opcode's start handler (table at $83:C024); while it is set, the continue handler ($83:C0B4) once a frame; it loops within the frame until bit 0 (done) or bit 1 (waiting) is set. A run of switches, items and gold costs no frames; a message, a step or a wait holds the event. Advancing adds the command's size from the table at $83:FA4D, or for a message counts its lines' ends.

There are 72 handlers: the 53 commands and 19 of the runtime's own, $35–$47 (RT2 has 93). The handlers are not RT2's code: only the experience, inn, shake, wait and sound handlers begin with RT2's bytes, and the rest are written around Super Dante's operands. The runtime's own opcodes run its small scripts:

OpWhatRT2
$39Fade the screen in, to full brightness50
$3DGather the party
$3EJump through slots that hold JML $000000: unfinished
$3FBoard the ship
$40Board the airship54
$41Stop
$44End of the page57
$45A 3-frame wait58
$35–$38, $3A–$3C, $42, $43, $46, $47Not identified

Pseudo-events. The start of play and boarding a vehicle are 16-byte event scripts the runtime copies to $7F:F800 ($84:9FBC). The start of play is 12 mm xx yy 39 44, with map and place filled in from the start block or the save: a warp, a fade in, the end. RT2's is the same, 2A mm xx yy 50 57, in RT2's numbers. Boarding the ship is 3D 3F 41, the airship 3D 40 41.

Choosing a page. The highest of pages 2–4 whose conditions all hold is shown and run, else page 1 ($84:A298). An item condition holds when anyone in the party carries the item, equipped or not; a switch is bit n & 7 of byte $96 + (n >> 3) of the play state, the 200 flags the play save keeps.

Notes/Super Dante/Events.md, Game.md; Tools/dante_events.py (head, check, dump, table).

Maps, the part codec and Mode 7#

Maps are built in RT2's units, with one twist: the parts are packed in the ROM by a codec of their own, and the field is a picture in the ROM rather than something the user builds.

UnitSizeWhat it is
Tile8 × 8 pixelsMaps: 4 bits a pixel, mode 1. The field: 8 bits a pixel, Mode 7
Chip16 × 16 pixels, one cell4 tiles
Part4 × 4 chips16 chip numbers, packed in the ROM by the codec
Screen4 × 4 partsMaps only: 16 part numbers in the save's pool of 255 screens
Map4 × 4 screens: 64 × 64 cellsA grid of 16 pool screens, 0 for none (part 0 drawn there)
Field64 × 64 parts: 256 × 256 cellsOne of four in the ROM; nothing of it is in the save

A map is laid out by $84:9DB8: each of its 16 grid cells takes a pool screen's 16 part bytes ($2A6A + 16 n), or part 0 for an empty cell, into a part window at $7F:0000. The kind nibble chooses everything else: a load routine, a script, and the kind's own parts, chips, tiles and colours. The castle set animates four of its tiles.

KindLoadPartsGround chipsObject chipsTilesColours
Castle (9)$84:983F$96:B376$96:BBD7$96:C337$96:8000$96:C277
Dungeon (A)$84:98B1$96:F5CA$97:8000$97:8460$96:C54F$97:83A0
Town (B)$84:9923$97:B181$97:AA89$97:B8BD$97:85E8$97:B7FD
The field$84:9791$98:8000–$9B:8000$99:BD75 (239)$9A:C765 (19 objects)$99:C4ED$9A:C6A5

The part codec#

A part is 16 chip numbers, but the ROM doesn't store them as 32 bytes, as RT2 does. It stores one record per part, packed, and decodes it on demand ($81:CD01):

part pfrom a screenpointer p >> 33 bytes, one per 8 partsskip p & 7 recordseach length by its first bytethe first byteone of 128 handlersstored16 chip bytes or wordsfilledone chip for all 16masked2, 4 or 8 chips by masksderivedanother part, cells changed16 chip numbers at [$F4]a chip is 4 tiles, from the set's chip tablethe part window$7F:0000, then VRAMThe handlers: $81:CD95, 128 entries, 70 routines, 65 kinds used in the ROM. A "derived" part starts from an earlierpart (p − (256 − b)) or a second part decoded beside it. A part number with bit 15 set would read 32 bytes from RAM.
The part decoder, $81:CD01. Parts are not stored one by one: a pointer leads to a run of eight records of different lengths, and each record is a small program in one of 65 forms, many of them built on a neighbouring part.

Rather than re-implement 70 handlers, the project's map tool runs $81:CD01 itself in a small 65816 interpreter, about 600 instructions a part; the four fields' 16,384 parts take about a minute. RT2 dropped the codec for plain 32-byte parts.

The field and Mode 7#

The field is Mode 7: one 8-bit-colour layer that the console can rotate and scale, the tilemap kept as a 128 × 128 window that follows the view. Four fields are in the ROM, each 64 × 64 parts (256 × 256 cells, 4,096 pixels), and the save's header byte $1E00 bits 0–1 chooses one (the sample uses field 2). Each field's parts have a bank to themselves ($98–$9B), and the four share one chip table (239 chips, $99:BD75), one set of 256 tiles ($99:C4ED, packed by method $04) and one set of colours. The field wraps at its edges.

Field objects (an object event with graphic 1–19) are drawn into the field itself: the event loader ($84:A42F) writes up to four chips from a 19-entry table at $9A:C765 over the ground, so a castle or a town is part of the picture. People are sprites. The same Mode 7 engine draws the title card's field behind the game's title and the airship's view, with perspective tables shared with RT2 (16 KB from $82:9D49).

Layers on maps. In mode 1, BG2 is the ground (the parts) and BG1 the objects: an object event's graphic g is chip g of the kind's object chip table, on its cell. People and the party are sprites.

Passability is per edge ($83:A14A). Each chip has an attribute byte whose low four bits close its four sides (0 right, 1 up, 2 left, 3 down), from tables at $83:A770 (ground) and $83:AB70 (objects), 256 entries per kind: field, castle, dungeon, town. A step in direction d is blocked if the cell left closes side d or the cell entered closes the side facing it. On maps the object layer's chip replaces the ground's where there is one, and a person blocks. RT2 has one attribute per cell, open or closed.

Battle backgrounds follow the place: on a map by its kind (castle hall, cave, town street), on the field by the chip under the leader (grassland, desert, sea, forest, swamp, or the rocky canyon if any neighbour is one).

Notes/Super Dante/Maps.md, Game.md; Tools/dante_maps.py (render, check, sheet, list), Tools/snes_cpu.py, Tools/snes_ppu.py.

The decompressors and the graphics#

Every packed block begins with a method byte, and one routine, RT2's ($80:8AC0), dispatches on it. Super Dante uses only the two LZ methods: RT2's tile packer, method $10, is not there, and the characters' tiles are stored raw.

MethodRoutineWhatUsed for
$00$80:8AEAStored
$04$80:8B36LZ on bytesThe fields' tiles
$08$80:8BF7LZ on 16-bit wordsEverything else packed: map tiles, enemies, battle backgrounds, spell animations, the vehicles, the editors' graphics
$10RT2's tile packerNot in Super Dante

The LZ methods read eight tokens to a control byte: a literal, or a copy of 3–18 units from a position in a window that starts with zero units before the output.

WhatWhereHow
54 enemies$8D:8000 + 2 g (headers), $8D:8294 + 4 g (colours)Width, height, tiles and arrangement (method $08); one 16-colour palette each, no colour choice
9 battle backgrounds$94:8000Tiles, a 32 × 28 tilemap and 32 colours each
54 characters, the vehicles$91:8000 (tiles), $91:80F4 (frames), $90:8000 (colours)61 entries: 1 the air vehicle's shadow, 2–4 a dragon, an airship, a balloon, 5–6 a sailing ship, a small boat, 7–60 the characters
13 spell animations$92:8000, $92:8068Tiles, two sprite palettes, frames and a sequence of (frame, time) pairs; 1–32 steps
The fonts$82:DEA2, $85:8040The proportional font; the 8 × 8 font
Map sets, the fields$96–$97, $98–$9BAbove
The editors' graphics$8BMethod $08 streams

Characters and vehicles share one table: 61 entries, each a pointer to its sprite tiles and one to its frame table (a frame is a count, then per 8 × 8 piece its offsets, tile and attributes). Entries 1–6 are the vehicles and the air vehicle's shadow, packed; entries 7–60 are the 54 characters, raw, graphic g being entry g + 6. A character is 16 × 16 pixels in 8 frames, two each way, and stores only the tiles its frames use (24 to 32). Graphic 0 is turned into 54, a blank, when a game starts, so "no graphic" is invisible. RT2's characters are 16 × 24, in fixed blocks of 48 tiles, at resource g + 15.

Spells store their animation as graphic g, which plays animation g − 1; graphic 0 plays none. Each of the 13 animations has its own 32 colours, where RT2's 23 share one set.

Notes/Super Dante/Graphics.md; Tools/dante_gfx.py (enemies, battlebgs, sprites, magic, check).

The object-script VM#

Almost everything Super Dante shows is bytecode: the field's windows, the event commands' windows, the battle's flow and its messages, the front end, every editor page, the boot screens and the demo. RT2's virtual machine runs it, the same code moved 6 bytes lower in bank $80: the run loop is $80:9D34, a script is started by $80:9CD6, and the op lengths, handlers and continue handlers are tables from $80:BB1F. Bit 7 of an op turns its last operand into a variable; variables are reached through a base (absolute, the object's own record, a walk of the object tree); control flow is structured (if, else, loops, switch and case, no jump offsets).

Eight operations are swapped. The two programs have the same set of operations, but eight of them sit in opposite places: what is an op in one is a sub-op (after a 00 or 80 prefix) in the other.

Super DanteWhatRT2
Ops 70–75Print a variable in binary or hex, 8, 16 or 24 bitsSub-ops 10–15
Op 7CHave the NMI upload the colours every frameSub-op 17
Op 7FWait for a pad buttonSub-op 19
Sub-ops 10–15Push and pop a byte, word or 24-bit variable on the data stackOps 70–75
Sub-op 17Set the palette bits over a rectangle of the windowOp 7C
Sub-op 19Load through a pointerOp 7F
Sub-ops 1A, 1BAND and OR the palette bits over a rectangleStores through a pointer

The swap is consistent through every script: the push and pop that every script uses take 4 bytes in Super Dante and 3 in RT2, while the debug prints nothing uses take a full op. So the encoding changed between the programs and the scripts were recompiled; with the debug prints as ops, Super Dante's reads as the earlier layout. Sub-ops 1A and 1B are Super Dante's own: they AND and OR the palette bits over a rectangle of a window, and only the field's scripts use them (78 times).

Where the scripts are. Windows are found through tables of long pointers indexed by an object's +$6C: the field's 49 windows at $84:A65F, the battle's 16 scripts at $85:A705, the front end's and editors' 139 at $87:8008, and the event commands' windows, which here have a small table per command (the message, the inn, the shop, the full bag, the yes / no, the save point) where RT2 has one of 13. The editors also keep script addresses in variables and describe their lists by records of pointers, which the project's walker follows.

From these, 903 scripts and subroutines, 118,503 bytes, are reached in banks $82–$85 and $87–$8A, and no walked byte ever ran as code. RT2 has 1,634 and 202,130 bytes. Of 201 valid op bytes, 114 are used; goto, the exchanges, the 24-bit arithmetic and the plain number prints are never used, and the hex prints only by one debug box. Bank $8B, which RT2's layout suggested would hold the editors' scripts, holds packed graphics.

A message runs the same way: the message command compiles its lines into VM text ops in an 80-byte buffer (60 6E line 00 6C 6C a line) and runs them, four lines to a window, with a blinking ▼ at the end.

Notes/Super Dante/Scripts.md; Tools/dante_vm.py (dis, tree, windows, scan, check, listing).

The battle and the random numbers#

A battle has eight records of 256 bytes: the party in slots 0–3, the enemies in 4–7. A hero's record is the hero's play record ($7E:8200 + 256 × the hero) copied whole; an enemy's is built from its 30 bytes in the save, the 14-bit fields unpacked. The flow is scripts (the table at $85:A705) calling native routines for the rules, as in RT2, and the action codes, the turn order (by speed, a bubble sort that swaps only on strictly less), the enemy's choice (every method and spell it has equally likely) and the experience table are RT2's. The rules inside are not: damage is attack − defence ÷ 2 with 0 possible, confusion does nothing, an enemy that revives does so every turn, items are always used up. How battles work gives them all.

The action blocks. Each target of an action gets a block of $40 bytes from $7E:8B30, shared by all combatants and outliving a battle: the target, the amount, the kill and miss flags. A heal-all fills one block per living member but applies them to every member, stepping on for the fallen too, so the last living member reads a block nobody filled this time. That is the heal-all bug.

The random number generator#

$80:8A84: s = s × 5 + $3711, 16 bits at $00A7, returning the high byte; $80:8A9A takes a step and returns the high byte mod n. It is RT2's code. The start-up clears RAM but keeps $00A7, so the seed is whatever the RAM held at power-on. Unlike RT2, Super Dante doesn't draw numbers while it waits for a frame: runs in two emulators from the same cleared RAM and the same presses drew the same numbers in the same order, some a frame later (inferred from that).

Encounters ($85:9060) are one fixed curve, with no rate per place. A counter goes up by one each step on foot or by ship (and jumps from 16 to 24); a battle starts if a random byte is below the table at $85:90CF:

Steps since the last battle12–78–1213–1516 on
A battle's chance a step01 in 2562 in 2564 in 25632 in 256 (1 in 8)

Table entries 16–23 hold a gentler ramp (4, 8, 8, 12 … 28) that the jump to 24 skips: a curve someone meant to smooth, and didn't. The enemies come from the place's 32-bit mask (the field screen's at $1600, ANDed with the land or sea mask; a map screen's at $1A00), shuffled by 331 random swaps; the group size is a table of sixteen each of 1, 2, 3 and 4 indexed by a random number & 63, capped by the enemies available and the screen's width (32 tiles).

Notes/Super Dante/Battle.md, Game.md; Tools/dante_battle.py (record, check, show: a battle recorded in the emulator and replayed through a model of the rules), Tools/dante_xcheck.py.

The sound driver#

Super Dante has its own SPC700 driver, the earlier generation of the line that RT2 and the SFC Kanadeeru continue: RT2's command bytes, sequence bytes, tempo formula, pitch table and record layouts are all here, but the code is another build, sharing only about 190 bytes with RT2's beyond the 768-byte pitch table. At power-on ($9F:FFFD → $9F:B6B4) the program sends the sound chip everything in one list, through the chip's boot ROM, from bank $9C:

ToBytesWhat
$00F215 × 2DSP settings: the echo at $E000, 8 KB
$06C07Two entries: the cold start, the restart
$06CC$112EThe driver
$DF00$C8Its DSP set-up and the vibrato presets
$1840$10064 instruments
$1A00$84The sample directory, 33 entries
$1B00$A464The 33 samples (BRR)
$1940$C0The 24-note drum kit
$C000$16An empty song, block 0
$D000$D3CThe 60 sound effects
ADoes
$00Stop everything
$01–$1FSong 1–31 (its block uploaded first if needed)
$20–$5BEffect 0–59: the event command's sound 1–60
$5C–$7FNothing
$FF, $FEMono, stereo
$FD, $FCPause, resume
$FB, $FAFade the music out, in
$F9The next song fades in
$F8, $F7Fade speed, a level (the parameter in X)
$F6One extra tick

Notes/Super Dante/Sound.md; Tools/dante_sound.py (uploads, check, song, se, instruments, samples, rip, verify). Every song and effect is ripped as an .spc from the ROM alone (Music and sound).

The Turbo File#

Bank $86, from $86:F000 to $86:FFE7, holds the STF library that all four SFC Tsukuru titles carry, in an earlier build than RT2's. It has one entry, JSL $86:FE16 with a function number in A, and a table of 15 functions (RT2 has 17). It returns 0 for success; an error stores its code at $7F:E000 and restores the stack pointer saved at $7F:E002, a jump out of any depth. Its first $383 bytes (the wire routines, the block read, write and verify) are RT2's at the same offsets, so every block written is read back and compared here too; after that the code differs.

FunctionEntryUsed for
0$86:FE65Start: the device's status
1$86:FE81Mount: read the table, check FAT0
2$86:FE9DFormat (from the check, and from the delete page when everything is marked)
3, 4$86:FEB9, $86:FECEThe first and the next file matching a pattern
5$86:FEF5Select the first matching file
6$86:FF16Free space
7$86:FF37Delete
8, 9$86:FF58, $86:FF79Open for reading; create
10, 11$86:FF9A, $86:FFA9Close after reading; after writing
12, 13$86:FFB8, $86:FFC7Read, write n bytes
14$86:FFD6Status only (never seen called)

The Twin in STF mode is 128 KB: a 4 KB table of 124 four-byte entries (each a file's size on its first block, the next block, and the block's 8-bit sum), the mark FAT0, then 124 blocks of 1 KB.

Three Super Dante filesfile 000file 001file 00228 freeAn RPG Tsukuru 2 game and a Super Dante fileRT2 game, 62 blocksfile 00030 freeThe 4 KB table and FAT0124 blocks of 1 KB, to scaleOne file, 32 blocksSHVC ARDJ SUPER DANTE N001SRAM $0018–$7FFF: the sums, the play saves, the game24 bytes (not to scale)32,744 bytes
A Twin in STF mode, and what Super Dante puts on it. A file takes the first free blocks; its header stands where the save's signature was, so the file is the save, all but that.

The file is the SRAM after its signature, under a 24-byte header in place of the signature:

File offsetBytesWhat
$000020SHVC ARDJ SUPER DANTE, the pattern at $88:AF15
$00141The kind: always N
$00153The number, three ASCII digits
$001832,744SRAM $0018–$7FFF: the total, the play saves, the sum and the whole game

Super Dante's files are the ones whose header starts with its 20-byte pattern ($88:AF15); others appear only on the delete page. Save, load and delete round-trip byte for byte, and every Twin image the game wrote can be rebuilt from its contents by the project's tool.

Notes/Super Dante/Storage.md, Notes/Turbo File.md; Tools/dante_store.py (twin, list, srm, check), Tools/snes_turbofile.py.

Hidden in the ROM#

The program carries a little it never shows, all on Behind the scenes:

There is no debug menu: one pad reader ($80:8873), and no button code but L + R + START + SELECT and test play's B.

Notes/Super Dante/Hidden Content.md.

How this was checked#

Every format on this page was written back as well as read, or drawn and compared with the emulator's own screen, so that a reading that was nearly right would show:

WhatHowResult
The saveEvery field out to text and back, for the factory image, a blank project and the cartridge's save; a hand-edited save playedByte for byte; the edited save plays as edited
The power-on checkThe game's sums recomputed; saves good and bad run from power-onEvery sum as the game makes it; the damaged save erased, the repaired one kept
The eventsEvery event, page and command of both saves parsed to its sizeFactory 426 events, 603 pages, 1,808 commands and 7 bytes free: the 17,772 exactly
The mapsSeven views drawn from the save and the ROM (the part codec run as the game's own code), against the emulator's layersPixel for pixel
The graphicsA battle screen drawn from the ROM; every sprite in the seven viewsPixel for pixel; every frame as expected
The battleRecorded runs (16 in Mesen, 10 in bsnes) replayed turn by turn through a model of the rules517 turns and 76 escape rolls in Mesen, 276 and 47 in bsnes; none wrong
The soundEvery song and effect ripped from the ROM and played against the game playing itAll 91 match, every track's position on the same frame within one
The scriptsThe VM's length tables against its operands; every reachable script walkedNo mismatch in 201 ops and 41 sub-ops; 903 scripts, none ever run as code
The textThe keyboard's rows decoded through the tableExactly the keyboard's three pages
The Turbo FileSave, load and delete in MesenCE with a TwinBoth saves out and back byte for byte; every Twin image rebuilt

Notes/Super Dante/Analysis Plan.md; Tools/mesen.py, Tools/lr.py.

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.