Arcana/ROM map

From Data Crystal
< Arcana
Revision as of 23:15, 27 June 2023 by Sarah Shinespark (talk | contribs) (Added way too much information, gave descriptions for each bank. (Understanding the opcodes is key to reading most of the game's code.))
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Arcana.

(Back to Main page)

==Bank $00: Common functions, ASM lookup tables (which run half the game)==
$00/89F1	Sub: RNG, can take a value ("5") and roll a range ("0-4"), or can provide a random 2 byte number through $1E0A.
$00/902B	Sub: Reads the current ASM opcode from $1E10. (Very important line! Uses a jump table to run opcodes as code.)
$00/90FA	ASM: Opcode 01 (Loops a number of times: 1 byte)
$00/911E	ASM: Opcode 02 (Loop end: jumps back to opcode 01)
$00/9140	ASM: Opcode 1A (Jump always: 2 bytes)
$00/9148	ASM: Opcode 03 (Jump long: 3 bytes)
$00/915A	ASM: Opcode 1B (Call opcode subroutine: 2 bytes)
$00/9177	ASM: Opcode 1C (Return from 1B)
$00/918D	ASM: Opcode 04 (Call opcode subroutine: 3 bytes)
$00/91BB	ASM: Opcode 05 (Return from 04)
$00/91DA	ASM: Opcode 06 (Delay x frames: 1 byte)
$00/9527	ASM: Opcode 07 (Call subroutine: 3 bytes) (Returns with RTL)
$00/954D	ASM: Opcode 0B (Jump if false: 2 bytes)
$00/9562	ASM: Opcode 0C (Jump if true: 2 bytes)
$00/9577	ASM: Opcode 11 (Switch-case: jump based on return value)
$00/974A	ASM: Opcode 13 (Set RAM address (2 bytes) to value (1 byte))
$00/975F	ASM: Opcode 16 (Set RAM address (2 bytes) to value (2 bytes))
$00/97B6	ASM: Opcode 1E (Load value: 2 bytes)
$00/97C5	ASM: Opcode 1F (Load value at address: 2 bytes)
$00/9C3C	Sub: Set/Get Music (1 byte)
$00/9C44	Sub: Set/Get SFX (1 byte)
$00/9B07	Sub: Main event handler
$00/A00F	Sub: Check $31 for button press (2 bytes: button)
$00/A022	Sub: Check $21 for button press (2 bytes: button)
$00/A0AC	Sub: Load text to be read (3 byte location)
$00/A0BD	Sub: Call RNG (1 byte), something with screen
$00/A0CB	Sub: Unfade from black
$00/A0DB	Sub: Fade to black
$00/A858	ASM: Text Opcode 00 (Null terminator/stop reading)
$00/A881	ASM: Text Opcode 01 (Move cursor to X,Y position)
$00/A902	ASM: Text Opcode 0D (Newline)
$00/A919	ASM: Text Opcode 14 (Writes text in RAM to the screen)(2 byte address)
$00/A943	ASM: Text Opcode 10 (Writes text in RAM/ROM to the screen)(3 byte address)
$00/A969	ASM: Text Opcode 11 (Converts number to text)(3 byte address)
$00/A9CD	ASM: Text Opcode 7F (Wait for A press)
$00/AA04	ASM: Text Opcode 08 (Move cursor to X position)
$00/BE07	Sub: Clears the screen of text
$00/C055	Sub: Hit calculation start
$00/C07C	Sub: Unknown mod; probably adds 0 to $00
$00/C0B9	Sub: Miss check/crit check
$00/C132	Sub: No-element handling
$00/C2D4	Sub: Check if damage is over 999
$00/C30C	Sub: Load attacking Element
$00/C3CA	Sub: More element handling
$00/C431	Sub: Attack vs. Defense
$00/C585	Sub: Load stat boost modifier
$00/C5B1	Sub: Check for dead/removed actors, more
$00/C658	Sub: Load Strength modifier
$00/C66A	Sub: Load Endurance modifier
$00/C676	Sub: Load Alertness modifier
$00/C68A	Sub: Load Intelligence
$00/C6A7	Sub: Load Intelligence
$00/C6C4	Sub: Load Intelligence
$00/C6DC	Sub: Lots of branching. Returns crit chance or other variables
$00/C781	Sub: Load Armor defense
$00/C856	Sub: Loads spell power/element
$00/C88B	Sub: Multiplication (A * X)
$00/C8A1	Sub: Multiplication (AA * X)
$00/C8C2	Sub: Division (Returns A remainder, X result)
$00/D137	Sub: Checks if loaded music is $33 (must be SPC commands)
$00/D1AA	Sub: Loads HAL Logo theme

==Bank $01: Game setup, gameplay, ending ==
$01/8001	Game start
$01/8053	A bunch of initialization/zeroing functions
$01/8913	Game over
$01/8C85	ASM: Handle dungeon movement
$01/9584	ASM: Item handling outside of battle
$01/9BB6	Pointer: Draw status screen ($08/C93E)

==Bank $02: Battles ==
$02/8CF3	ASM: Status handling
$02/8FC9	Tbl: Boss animations
$02/913D	Sub: Initializes a character/monster's stats from ROM at battle start

==Bank $03: Event handling, towns==
$03/A457	Sub: Load current tile's encounter value
$03/A499	Sub: Update dungeon progress?
$03/A52A	Dungeon BGM (See Music tab for ID list)
$03/D5BF	Item inventory limit (shops). Default $60 = $30 slots (48 items @ 8 per page) (see $07/AA28)
$03/DDD6	Item slots -1 x2, used after selling an item in town to check when to stop rearranging. (see $07/AA28)(should be $5E?)
$03/DF27	Bar prices (you know, the Alchemist guy)
		(NOTE: His prices are also plaintext in his dialogue and need to be edited separately)
$03/DFA2	Bar option 2 HP gain
$03/DFA4	Bar option 3 HP gain
$03/DFA6	Bar option 4 HP gain
$03/DFA8	Bar option 2 MP gain
$03/DFAA	Bar option 3 MP gain
$03/DFAC	Bar option 4 MP gain
$03/E052	Card prices (see Inventory)

==Bank $04: Graphics==

==Bank $05: Battles==
$05/9F7B	Names, Characters ($0A bytes per entry + 00 delimeter)
$05/9FE9	Names, Enemies ($10 bytes per entry + 00 delimeter)
$05/A539	Enemy postfixes A-H (I forget what 81 40 means though)
$05/A554	Classes, Characters ($10 bytes per entry + 00 delimeter) NOTE: Using too long a name will result in a blank line.
$05/A5FE	Names, Areas ($10 bytes per entry + 00 delimeter)
$05/A895	Names, Elements ($06 bytes per entry + 00 delimeter)
$05/A8BF	Names, Status effects ($0C bytes per entry + 00 delimeter)
$05/A91A	EXP to next level, Rooks?
$05/A992	EXP to next level, Sylph?
$05/AA0A	EXP to next level, Dao?
$05/AA82	EXP to next level, Marid?
$05/AAFA	EXP to next level, Efrite?
$05/AB72	EXP to next level, Teefa
$05/ABEA	EXP to next level, Salah?
$05/AC62	EXP to next level, Darwin?
$05/ACDA	EXP to next level, Axs? (60 entries x 2 bytes)
$05/AD6A	Level-up stats, Rooks (HP, MP, Str, End, Int, Alt) (2 bytes per entry)
$05/B03A	Level-up stats, Sylph
$05/B2FD	Level-up stats, Dao
$05/B5CE	Level-up stats, Marid
$05/B89E	Level-up stats, Efrite
$05/BB7A	Level-up stats, Teefa
$05/BE4A	Level-up stats, Salah
$05/C11A	Level-up stats, Darwin
$05/C3EA	Level-up stats, Axs
$05/C6A3	A bunch of 0's and 1's
$05/C8D4	Level-up spells, Rooks
$05/C8E2	Level-up spells, Sylph
$05/C8F2	Level-up spells, Dao
$05/C8F2	Level-up spells, Marid
$05/C8FB	Level-up spells, Efrite
$05/C904	Level-up spells, Teefa
$05/C911	Level-up spells, Salah
$05/C91F	Level-up spells, Darwin
$05/C929	Level-up spells, Axs
$05/C92D	Monster race/element (2 bytes per entry) (ends at 2C9CB)
$05/C9CD	Monster Equipment stats, several unknown (start)
$05/CE54	Monster Equipment stats (end)
$05/CE55	Monster HP
$05/CEF5	Monster EXP
$05/CF95	Monster GP
$05/D035	Monster Lvl
$05/D0D5	Monster ?? stat - $20 entries of 00 through 05. No idea what this is.
$05/D195	Monster boss music (00 none, 01 Boss1, 03 Boss2, 02 Rimsala)
$05/D1E5	Monster boss flag (00-0F are bosses, FF are not bosses)
$05/D235	Monster spell. (If nonzero, there's a random chance they'll use that spell instead of attacking.) (see Spells page)
$05/D285	Monster ?? stat
$05/D405	Monster Armor Def table (bugged?): offset = Armor * 2
$05/D445	Monster Accessory Def table: offset = Accessory * 2
$05/D4A5	Possible monster stat
$05/D565	Possible monster stat
$05/DE88	Equipment prices (see Equipment tab)
$05/DF79	Equipment "can be equipped by" data (see Equipment tab)
$05/DFF3	Equipment power/defense
$05/E0E3	Equipment race bonus/element (2 bytes per item)
$05/E1D5	Equipment: weapon crit rate
$05/E226	Equipment: shield mag def ($05/E1D5)
$05/E24E	Equipment: weapon damage penalty
$05/E2C8	Equipment - spell cast in battle
$05/E356	Spells' names
$05/EA4D	Spells’ “battle only flag” (01: out of battle only, 02: battle only, 03: either)
$05/EA9F	Spells’ “single/multi target flag” (00: single, 01: multi); Change Attribute is broken as ST
$05/EAF1	Spells’ accuracy
$05/EB4D	Spells' power
$05/EC04	Spells' element (paired with an unknown byte, so skip a byte for each entry) (see Magic tab)
$05/ECA6	Spells' MP cost
$05/ECF8	Spells' color palette (see Magic tab)
$05/ED57	Spells’ sfx
$05/EE9A	Item names (look for LDA $05/EE9A,x or "BF 9A EE 05")
$05/F038	Card names (look for LDA $05/F038,x or "BF 38 F0 05")
$05/F17E	Sleeping Bag HP heal amount (200 HP) (Heals everyone but the spirits)
$05/F180	Sleeping Bag MP heal amount (25 MP)
$05/F194	Tent HP heal amount (999 MP) (Heals everyone but the spirits)
$05/F196	Tent MP heal amount (999 MP)
$05/F20A	Herbs heal amount (70 HP)
$05/F21F	Medicine heal amount (200 HP)
$05/F234	Silver Flask heal amount (15 MP)
$05/F249	Gold Flask heal amount (40 MP)

==Bank $06: Stage select==
$06/DDBD	Stage select: Chapter 2
$06/E2BD	Stage select: Chapter 3
$06/E7BD	Stage select: Chapter 4
$06/ECBD	Stage select: Chapter 5

==Bank $07: Dungeons and gameplay==
$07/80F2	Tbl: Levelup spells
$07/8CC4	Sub: Deducts HP from target
$07/8EDF	FINIS (tile bytes) (appears 2x for some reason)
$07/8F6E	SLEEP (appears 3x for some reason)
$07/8FEC	ROOKS
$07/9020	EFRITE
$07/903A	SALAH
$07/906A	End of names' sprite values
$07/A83D	Sub: Branches based on treasure chest contents
$07/A866	Sub: Card treasure type
$07/A932	Sub: Loads a card name from ROM
$07/A9D4	Sub: Adds a card to the inventory
$07/A872	Sub: Item treasure type
$07/A95C	Sub: Loads an item name from ROM
$07/AA18	Sub: Adds an item to the inventory
$07/AA27	Item inventory limit (chests). Default $60 = $30 slots (48 items @ 8 per page)
$07/A87E	Sub: Equipment treasure type
$07/A986	Sub: Loads an equipment name from ROM
$07/AA3D	Sub: Adds a weapon to the inventory
$07/AA4D	Equipment inventory limit (chests). Default $40 = $20 slots (32 items @ 8 per page)
$07/A88A	Sub: GP treasure type
$07/A896	Sub: Monster treasure type (unused)
$07/A8AF	Sub: FFFF treasure type (unused???) (returns failure)
$07/A8BB	Sub: Empty treasure type (returns failure)
$07/AA65	Sub: Adds GP to total
$07/AA6B	Max GP (FFFF)
$07/B234	Sub: Levelup check
$07/B2DB	Sub: When Teefa/Axs join, assigns them Rooks' LV
$07/B2E2	Sub: When Salah joins, assigns her Rooks' LV-3
$07/B2F5	Sub: When Darwin joins, assigns him Rooks' LV+3
$07/BBEA	Pointer table for character stats in RAM
$07/BBF6	Honey stat boost amounts (Str, Int, End, Alt, HP, MP)
$07/BC7C	Sub: Recovers MP, sets to full MP if more than max
$07/BCF1	Sub: Loop for full party healing; ends when X=08
$07/BF3A	Sub: Related to running
$07/BF54	Sub: Deducts MP from a spell
$07/C355	Pointer table for spell effects
$07/C8DE	SFX for Healing (See Music tab for values)
$07/C8E5	SFX for Change Attribute
$07/C8E4	SFX for Buffs

==Bank $08: Small scripts==
$08/8000	Script, Battle/Towns/Items/Magic
$08/9650	Spell descriptions
$08/C93E	Status screen (184 bytes)
$08/C9F6	Status screen, current spirit (161 bytes)
$08/D3C3	Alchemist conversations

==Bank $0C: Main script==
$0C/A010	The days passed peacefully for Rooks...

==Bank $0D: Compressed data==

==Bank $0E==
$0E/95A3	Sylph gfx
$0E/A12C	Marid gfx
$0E/AC91	Dao gfx
$0E/B715	Efrite gfx
$0E/C292	Teefa gfx
$0E/D25E	Salah gfx

==Bank $0F: Battle animations?==

==Bank $13: Maps==
$13/EBF7	Balnea Temple 1F map (These are all preceded by FF E4. Read break on $7FFC42 or similar and follow the DMA address given.)
$13/ECFF	Balnea Temple 2F map
$13/F764	Bintel Castle map

==Bank $17: Initialization==
$17/8130	Intro script ("This is an historic land")
$17/840E	Sound test
$17/9285	HAL logo gfx header

==Bank $18: Treasures, encounters, events==
$18/802E	Sub: Random encounter logic
$18/8044	Encounter rate (higher = fewer encounters) (Default $0C)
$18/8056	Sub: Random encounter
$18/80DB	Sub: Normal (returns 3)/back attack (returns 2)?
$18/8210	Sub: Formations
$18/826A	Snip: Loads the proper battle music ID
$18/82B6	Snip: Loads monster ID from formation
$18/82E2	Table: Battle music IDs (normal, boss, goddess, final)
$18/85AB	Sub: Returns treasure data (A: item type, X: value)
$18/85D2	Sub: Updates treasure tracker ($18E3) after opening a chest
$18/8A99	Table: Pointers for chapter treasures tables
$18/8AA3	Table: Treasure data Ch1 (12 bytes per entry)
$18/8B1D	Table: Treasure data Ch2 (12 bytes per entry)
$18/8CB7	Table: Treasure data Ch3 (12 bytes per entry)
$18/8EBD	Table: Treasure data Ch4 (12 bytes per entry)
$18/8FEB	Table: Treasure data Ch5 (12 bytes per entry)
Ch5 examples:
$18/9001	Location of Robe of Valor in Bintel Castle first room
$18/900D	Location of Gold Flask in Bintel Castle first room ^_^
$18/9079	Location of Grand Shield
$18/9023	Desiree data (02 0C = Equipment id 0C)
$18/9047	Return Ring data in "A Tunnel".
$18/9101	Table: Pointers to boss locations by chapter (Ch1: +0, Ch2: +2 etc)
$18/910B	Table: Ch1 boss fights (8 bytes/entry): 00 01-> Map 00 Balnea 1F; 0F00 0600 -> (0F, 06); 0600 -> Encounter #6)
$18/911D	Table: Ch2 boss fights (8 bytes/entry)
$18/912F	Table: Ch3 boss fights (8 bytes/entry)
$18/9139	Table: Ch4 boss fights (8 bytes/entry) empty, needs research
$18/913B	Table: Ch5 boss fights (8 bytes/entry) empty, needs research
$18/913D	Table: Pointers to encounters by chapter (Ch1: +2, Ch2: +4 etc)
$18/9147	Table: Ch1 encounters
$18/9177	Table: Ch2 encounters
$18/91AA	Table: Ch3 encounters
Ch3 example:
$18/91B3	Encounter data (1C 1D 1E 1A 1B -> 5 monsters in Ice Cave)
$18/91DD	Table: Ch4 encounters
$18/9229	Table: Ch5 encounters
$18/9270	Table: Pointers to RNG seeds
$18/947C	RNG seed "10" from offset 0A
$18/947D	Entry size
$18/94D9	RNG seed "01" from offset 0B (Chapter 2?)
$18/C551	Red and Blue Guardian event
$18/C6D1	Tiamat event

==Bank $1E, 1F: Sound and Music==