Title screen

From FF5 Hacking Wiki
Revision as of 10:42, 8 April 2019 by Noisecross (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The title screen code is stored at C3/7E4D - A06F. The code is compressed (type 02, 0x4800 bytes) and at the beginning of the game the code is decompressed on RAM at 7F/8000-7F/C800. That means, hacking the title screen requires decompressing the code, modifying it, compressing it again and if the compressed code still fits, injecting it back to C3/7E4D.

The title screen performs accesses to some other compressed data tables. Every table are stored at bank C3 and some of them are still undocumented:

Data Stored Accessed Size decompressed Compression type
???? C3/02B3 007F/A963 (0x0200 bytes) [LZSS]
???? C3/1D25 007F/A978 (0x0020 bytes) None
???? C3/331F 007F/A9E0 (0x0020 bytes) None
Dragon 4bpp8x8 C3/2D22 007F/B21D (0x1200 bytes) [LZSS]
Riders 4bpp8x8 C3/1E83 007F/B248 (0x1B00 bytes) [LZSS]
OAM data C3/3342 007F/B5A9 (0x0120 bytes) [LZSS]
???? C3/1DFE 007F/B5CA (0x0174 bytes) [LZSS]
FFV Title? C3/1243 007F/970E (0x1000 bytes) [LZSS]
???? C3/1C65 007F/9723 (0x____ bytes) [RLE]
???? C3/1C69 007F/986D (0x____ bytes) [RLE]
???? C3/1177 007F/C209 (0x041A bytes) [LZSS]
Staff text C3/362B 007F/BB86 (0x02EA bytes) [LZSS]
Chars 4bpp8x8 C3/33F6 007F/BB9B (0x0800 bytes) [LZSS]
???? C3/1D48 007F/B3FA (0x0231 bytes) [LZSS]
???? C3/383C 007F/BE34 (0x0151 bytes) [LZSS]

Dragon 4bpp8x8 C3/2D22 (LZSS)

The dragon picture and the "(C)SQUARE 1992" tiles are stored at C3/2D22 compressed with type 02. After decompress, the data is in format 4bpp 8x8 and written to the VRAM.

The number of bytes sent to VRAM is marked in the instruction:

$7F/B240 A2 00 12    LDX #$1200

If a hack increases the size of the graphic data there, the number of the bytes sent to VRAM must be edited in that LDX instruction.


OAM data C3/3342 (LZSS)

This table contains data to write on the OAM tables. The data is stored as packages of 7 bytes. The first of them index the action to take and the next 6 are arguments:

Byte 00  Action
Byte 01  X param
Byte 02  Y param
Byte 03  Tile number in VRAM
Byte 04  ???? First OAM table flags ???? (Vertical flip, horizontal flip, palette number and priority bits)
Byte 05  ???? Second OAM table bits to byte 01 ????
Byte 06  ???? Second OAM table bits to byte 02 ????

Action < 0x80

The OAM cell to edit is the number stored in the "Action" byte.
Set to this cell the values X, Y, TileId and Flags on the first OAM table.
Set to this cell the bits on the second OAM table (seems this bits are stored as masks to just apply a binary OR operation over the second OAM table)

Action 0x8F

The OAM cell to edit is just the next one to the previously edited.
Set the values to X and Y as the ones of the previously edited cell incremented on the new X and Y parameters.
Set to this cell the values TileId and Flags on the first OAM table.
Set to this cell the bits on the second OAM table (seems this bits are stored as masks to just apply a binary OR operation over the second OAM table)

Action 0x80

End of data.

C3/3342 decompressed dump:

Ac AX AY TI Fl B1 B2
40 58 B8 80 38 00 00 ; (C)
8F 10 00 81 38 00 00 ; S
8F 08 00 82 38 00 00 ; Q
8F 08 00 83 38 00 00 ; U
8F 08 00 84 38 00 00 ; A
8F 08 00 85 38 00 00 ; R
8F 08 00 86 38 00 00 ; E
8F 10 00 87 38 00 00 ; 19
8F 08 00 88 38 00 00 ; 92
49 20 00 00 0C 08 00 ; Dragon
8F 10 00 02 0C 20 00
8F 10 00 04 0C 80 00
8F 10 00 06 0C 00 02
8F 10 00 08 0C 00 08
8F 10 00 0A 0C 00 20
8F 10 00 0C 0C 00 80
8F A0 10 20 0C 02 00
8F 10 00 22 0C 08 00
8F 10 00 24 0C 20 00
8F 10 00 26 0C 80 00
8F 10 00 28 0C 00 02
8F 10 00 2A 0C 00 08
8F 10 00 2C 0C 00 20
8F 10 00 2E 0C 00 80
8F 90 10 40 0C 02 00
8F 10 00 42 0C 08 00
8F 10 00 44 0C 20 00
8F 10 00 46 0C 80 00
8F 10 00 48 0C 00 02
8F 10 00 4A 0C 00 08
8F 10 00 4C 0C 00 20
8F 10 00 4E 0C 00 80
8F 90 10 60 0C 02 00
8F 10 00 62 0C 08 00
8F 10 00 64 0C 20 00
8F 10 00 66 0C 80 00
8F 10 00 68 0C 00 02
8F 10 00 6A 0C 00 08
8F 10 00 6C 0C 00 20
8F 10 00 6E 0C 00 80
8F 10 E0 0E 0C 02 00
80  ; EOF

Staff text C3/362B (LZSS)

This table contains the text of the staff displayed at the credits and at the ending of the game.

The TLB of this table is:

0x00 = Blank
0x01 = A
0x02 = B
0x03 = C
[...]
0x80 = End of file
[...]
0x85 = Jump new line
0x86 = Wait, clear and continue in new window