Castlevania II: Belmont's Revenge/ROM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Castlevania II: Belmont's Revenge.

Format for PRG-ROM is Bank:RAM address.

(r:symbol) marks the start of a callable subroutine. (RSTxy:symbol) marks a callable subroutine which can be called with the special quick-access RST commands.

X:7FFF all swappable banks store list their bank number as the last byte of the bank.
0:0000 (RST00:jumptable_entity_state) jumptable (indirect jump by entry in table following call to RST00 according to current entity's state variable)
0:0003 (r:jumptable) jumptable by A.
0:0030 (RST30:entity_inc_state) increments the state variable (D:01) of the current entity.
0:0038 (RST38:entity_get_y) get Y position of current entity.
0:01D9 (r:longcall_2_438D) stores current bank (read from $7FFF) on stack, calls routine 2:438D, then returns to caller bank.
0:0D23 (r:entity_set_state_and_substate) entity state <- b, substate (attacking) <- c
0:35A9 (r:mbc_bankswap_1) loads swappable bank 1.
0:35AF (r:mbc_bankswap_2) loads swappable bank 2.
0:35B5 (r:mbc_bankswap_6) loads swappable bank 6.
0:35BB (r:mbc_bankswap_7) loads swappable bank 7.
0:35C1 (r:mbc_bankswap_3) loads swappable bank 3.
0:38E0 (r:entity_set_animation) Set animation (prop 0C,0B,0A) to (bc):0:(bc+1) (bc):0:(bc+1)
0:3DAC (r:entity_set_x_velocity_0) Entity x velocity <- 00.
0:3DAF (r:entity_set_x_velocity) Entity x velocity <- cb.
0:3DB4 (r:entity_set_y_velocity_0) Entity y velocity <- 00.
0:3DB7 (r:entity_set_y_velocity) Entity y velocity <- cb.
0:3DBA (r:write_word) (hl) <- cb
0:3DBE (r:entity_get_x_velocity) cb <- Entity x velocity.
0:3DC5 (r:entity_get_y_velocity) cb <- Entity x velocity.
0:3DC8 (r:read_word) cb <- (hl)
6:421D (r:entity_update) Belmont frame update routine. Called from 0:05FA.
6:4235-4241 Belmont update jumptable
6:427F Belmont state 0 (standing) routine
6:4289 Belmont state 2 (crouching) routine
6:42E9 Belmont state 1 (walking) routine
6:4293 Belmont state 3 (jumping) routine
6:42A1 Belmont state 4 (??) routine
6:44A6 Belmont state 5 (??) routine
6:44D2 Belmont state 6 (??) routine
6:4510 Belmont state 7 (??) routine
6:461B (r:input_A_pressed) A gets zero or 10 depending on if the A button was pressed this frame. Status flags set
6:4621 (r:input_up_down_held) A and status flags
6:4627 (r:input_left_right_held) A and status flags
6:462D (r:input_B_pressed) A and status flags
6:4633 (r:input_B_held) A and status flags
6:4639 (r:input_down_held) A and status flags
6:464B (r:input_up_held) A and status flags
6:4651 (r:input_any_held) A and status flags
6:4801 (r:belmont_set_walk) Read left/right input and set Belmont to be walking left or right accordingly.
6:4817 (r:entity_move_face_right) Entity moves and faces right at velocity  0x90
6:4817 (r:entity_move_face_left)  Entity moves and faces left at velocity -0x90

Bank swap routines:

- All are in bank 0, and all write to $2180 to change the bank. For some reason, bank 5 is always swapped inline rather than by function call.