# The Simpsons (MAME set 'simpsons', 4 Players World, set 1) - 053248 program symbols
#
# Addresses and names only: no game data lives in this file.
# Format:  ADDRESS  KIND  NAME  [LAYOUT]   [# comment]
#   KIND: func = function entry, code = code label, data = data label
# Addresses are places of the program: offsets in its 512 KB region (tools/simpsons_rom.py), as kref's traces
# give them: a bank's code at bank x 2000 plus its address in the window (6000-7FFF), the fixed program (8000-FFFF)
# at 078000-07FFFF.
#
# LAYOUT, for data tables that hold code addresses the analysis cannot see the length of
# (tools/core/konami_cpu/analysis.py reads record=, code= and count=):
#   record=N        the table is an array of N-byte records
#   count=N         ... of N records
#   code=A          every record holds a 16-bit code address (a CPU address, in the table's bank) at offset A
# Sizes, offsets and counts are decimal.
#
# The analysis starts at the vectors (the reset at 86CE, the IRQ at 8F43, the FIRQ at 91B2) and finds the code
# without traces, following what the registers and the bank hold into the tables of handlers; the lines here are
# what it cannot work out, each with how it was found (kref --jumps: where a jump through a register went).

# ======== tables of code addresses ========
# two pairs of handler tables by an object's state (its field 2E), each followed by another table of code addresses
# that the code names (LDY #$7A3A, LDY #$7F7C, handed to a routine as data): the analysis stops a table where the
# code names data, but the state runs into the next table, whose first entry is the last state's
# bank 1D's: 629A "LDY #$7A00", 6292 "JMP [A,Y]" (kref --jumps: 03A292 -> 03A5DF, entry 29, which is 7A3A's first)
03BA00  data  bank_1d_states  record=2 count=30 code=0
# bank 1E's: 76FD "LDY #$7F62", 7700 "JMP [A,Y]" (kref --jumps: 03D700 -> 03D88C, entry 13, which is 7F7C's first)
03DF62  data  bank_1e_states  record=2 count=14 code=0

# ======== the sprite engine's data (tools/data_walk.py walks what these lead to) ========
# An object's animations (data_walk.py: animation sets): the bank they are in and the offset of the set's entry in
# that bank's set index, the words at 6000 (079B08-079B1B: "LDB ,U+; STB <$0E; SETLN <$0E; LDB ,U", then 079B3E
# "LDU #$6000; CLRA; LDU D,U")
struct animation_set 02 rom
field animation_set 00 bank u8
field animation_set 01 index u8
# by an object's kind (its field 04; 079B02): 00-7F here, 80-FF in animation_sets_high (bit 7 dropped): 079B08
# "LDU #$E591", 079B21 "LDU #$E5BB"; the reads stop at 07E5B9 (kref --rom-reads, 079B11), and 07E66B, right after the
# high ones, is the table 079E7F jumps through
07E591  table  animation_sets[21]  animation_set
07E5BB  table  animation_sets_high[88]  animation_set
# the sprite under a player in the air (079DFE, a sprite of its own after the object's: field 5B's low 4 bits the
# record, 079E0D "LDU #$E585", "ASLA; ASLA; LEAU A,U"): its attributes (079E19 "LDA ,U+") and its code (079E2B
# "LDD ,U"); byte 3 nothing reads
struct shadow_sprite 04 rom
field shadow_sprite 00 attributes u8
field shadow_sprite 01 code u16
07E585  table  shadow_sprites[3]  shadow_sprite
# a zoomed object's sprites (079CD4): their x and y from the object times a step by the object's zoom (its field 0A,
# from 10: 079CE1-079CED; 079D06 "LDB #$1D; STB <$0E; SETLN <$0E", 079D10 "LDX $602A", 079D17 "LDX D,X", then LMUL):
# the address of the steps in bank 1D's header, after its jumps, and the 240 steps (kref --rom-reads: 079D17 reads
# 03BDE7-03BFC6)
03A02A  table  zoom_steps_address[1]  u16
03BDE7  table  zoom_steps[240]  u16

# ======== the background maps (tools/data_walk.py: scene tables) ========
# A tile layer of the K052109 the map engine draws (07C618 "LDX #$EC9D; ASLA; LDX A,X": layer A's, layer B's): where
# its tiles are, the addresses of the variables its scroll is in, and its scene tables
struct layer_map 12 rom
# the layer's tile codes in the K052109 (07C621 "LDU ,X"; its colours 2000 below: 07C6C8 "STB #$-2000,U")
field layer_map 00 tiles u16
# the work RAM's variables, by address: its scroll (07C623 "LDD [#$02,X]", 07C633 "LDD [#$04,X]") and what the engine
# adds to it (07C5A5 "ADDD [#$0A,X]", 07C636 "ADDD [#$0C,X]", 07C6A4 "ADDD [#$0E,X]")
field layer_map 02 scroll_x u16
field layer_map 04 scroll_y u16
# (with its type, in the section of the program's data by name below: layer_map.maps, layer_map.unk_08)
field layer_map 0A offset_x u16
field layer_map 0C offset_y u16
field layer_map 0E offset_y2 u16
# (with its type, in the section of the program's data by name below: layer_map.maps_high, layer_maps)
07ECA1  table  layers[2]  layer_map
# by scene (direct page 75: 00-7F the first table, 80-FF the high one, bit 7 dropped), the address of a list of
# 4-byte records by the scene's area (direct page 76): an address and its bank. Layer A's maps from its descriptor
# (07C5B2 "LDY #$06,X", 07C5BA "LDY #$10,X", the descriptor ECA1 by 07C618 "LDX #$EC9D"), its tile blocks from
# 07C8BD "LDY #$ECC9" / 07C8C5 "LDY #$ED29"; layer B's from ECB3 and 07C8F7 "LDY #$ECE9" / 07C8FF "LDY #$EDBB".
# Each table ends where the first of its lists starts
# (with its type, in the section of the program's data by name below: block_scenes_a, block_scenes_b, map_scenes_a,
# map_scenes_b, block_scenes_a_high, block_scenes_b_high, map_scenes_a_high, map_scenes_b_high)
# the K052109's registers 1D80 and 1F00 by scene and area (07C931 "LDY #$EF55" / 07C939 "LDY #$EF63": 2-byte records)
# (with its type, in the section of the program's data by name below: layer_modes, layer_modes_high)
# 16 bytes by a tile block's second byte (07C6FA "LDX #$F67C"), copied a column at a time (07C70F)
07F67C  table  block_tile_flags[1]  u8

# ======== the palettes (tools/data_walk.py: palette sets, palette effects) ========
# a load of palettes from bank 2D into the palette RAM (07BCEA "LDU ,Y", "LDX #$02,Y", "LDA #$04,Y", then 07BF51)
struct palette_load 05 rom
field palette_load 00 source u16
field palette_load 02 destination u16
field palette_load 04 palettes u8
# the sets of 4 loads by a request's byte 2 (07BCCE "LDX #$E9CB", from 80 07BCD6 "LDX #$EAEB"; its byte 1 says which
# loads): each table ends where its first set starts
# (with its type, in the section of the program's data by name below: palette_sets, palette_sets_high)

# ======== the stages' objects (tools/data_walk.py: spawn lists) ========
# an object a stage puts in when its scroll reaches it (07C9B2-07CA4D, the list's place kept in direct page 73)
struct spawn 08 rom
# where along the stage (07C9DE "CMPD #$00,X" against the scroll plus 150); a record whose first byte is FF ends the
# list
field spawn 00 x u16
# its height, 8 pixels a step up from the floor line (07CA21 "LDB #$02,X; SEX; ASLDI #$03; NEGD")
field spawn 02 y s8
field spawn 03 depth u8
# bits 2-3 the object list it goes into (07CA50, by object_list_sizes and object_lists), bit 7 from the right
field spawn 04 flags u8
# the state the object starts in (07C9FE "LDA #$05,X; STA #$30,U": its field 30)
field spawn 05 state u8
# the stage's difficulty it takes (07C9E3 "CMPA <$6B": not put in above it)
field spawn 06 level u8
# the object's kind (07C9F5 "LDA #$07,X; STA #$01,U")
field spawn 07 kind u8
# by scene (07C96B "LDX #$EFBC; LDA <$67; ASLA; LDX [A,X]"): where in bank 1B the scene's list's address is
07EFBC  table  spawn_list_places[12]  u16
036000  table  spawn_lists[12]  u16
# by direct page 61 (07C985 "LDU #$EFD4; LDB <$61; LDB B,U"), times 2 into 1886
07EFD4  table  enemy_speeds_by_rank[32]  u8
# the object lists a spawn goes into, by its flags' bits 2-3 (07CA54 "LDU #$EFF4; LDA B,U", "LDU #$EFF8; LDU B,U"): how
# many objects each holds and where it is
07EFF4  table  object_list_sizes[4]  u8
07EFF8  table  object_lists[4]  u16

# ======== pictures of tiles (tools/data_walk.py: tile pictures) ========
# where a picture of tiles goes (07C51C "LDU #$EFB5", "LDU A,U"; bit 7 of the number draws it blank): its bank
# (07C52C "LDB ,U+"), the place in the tile RAM it starts at (07C536 "LDX ,U++"), the picture (07C538 "LDU ,U")
struct tile_picture_place 05 rom
field tile_picture_place 00 bank u8
field tile_picture_place 01 tiles u16
# (with its type, in the section of the program's data by name below: tile_picture_place.picture, tile_pictures)

# a line of a test mode page's menu (data_walk.py: test mode page), after the page's text and its 3 bytes
struct test_menu_line 03 rom
# where its cursor goes in the tile RAM (05E539 "LDX ,X"), what the line does (05E577 "LDA A,X"; 20 nothing)
field test_menu_line 00 cursor u16
field test_menu_line 02 action u8

# ======== texts (tools/data_walk.py: test mode texts) ========
# the test mode's texts by number (05E62E "LDU #$75BE", 05E632 "LDU A,U": "MANUAL TEST MENU"...) and the words they
# put in, by their code less C7 (05E6E8 "LDU #$78F7"), in bank 2F; each table ends where its first text starts
05F5BE  table  test_mode_texts[24]  u16
05F8F7  table  test_mode_words[55]  u16

# ======== bank 1A's flying object (tools/data_walk.py: object paths) ========
# its handler by its field 02 (0352F3 "LDU #$7300; ASLB; JSR [B,U]"); its paths: 2-byte steps up to FFFF (035367)
struct path_step 02 rom
# the direction (made negative facing the other way, plus 40: 035382-035393) and the speed (035382 "STB <$F1")
field path_step 00 direction s8
field path_step 01 speed u8
0359F3  data  object_1a_path        # 03532B "LDY #$79F3; STY #$2C,X"
035D72  data  object_1a_dive_path   # 035434 "LDD #$7D72; STD #$2C,X"
# by object_1a_path_choices (0353A7 "LDU #$79DC", by its field 50's low 3 bits): a path and the two counts it keeps
# in fields 3B and 3A (0353B9 "LDU #$79E4", "LEAU A,U" 4 bytes a record), and by the same index a time (0353CC "LDU
# #$79F0" into field 4F)
struct path_start 04 rom
field path_start 00 path u16
field path_start 02 count_3b u8
field path_start 03 count_3a u8
0359DC  table  object_1a_path_choices[8]  u8
0359E4  table  object_1a_path_starts[3]  path_start
0359F0  table  object_1a_path_times[3]  u8

# ======== the attract mode's demos (tools/data_walk.py: demo, demo inputs) ========
# by direct page 5E (07A0A4 "LDX #$E6A1; LDA <$5E; ASLA; LDX A,X")
# (with its type, in the section of the program's data by name below: struct demo)
# the players who play it, a bit each (07A0AD "LDA ,X+; STA <$50")
# (with its type, in the section of the program's data by name below: demo.players)
# the frames it lasts (07A0B2 "LDD ,X++; STD $5800", counted down at 07A14C)
# (with its type, in the section of the program's data by name below: demo.frames, demo.step)
# the 4 players' inputs, in bank 2C (07A0F2 "LDU ,X++")
# (with its type, in the section of the program's data by name below: demo.inputs, demos)
# a step of a player's inputs: the controls and the frames they are held (07A17C, 07A192; 0 is 256)
struct demo_input 02 rom
field demo_input 00 controls u8
field demo_input 01 frames u8

# ======== the stories (tools/data_walk.py: story scripts) ========
# the script an actor of the stories runs, by its field 30 (03E09D "LDY #$7078; LDY D,Y; STY #$2E,X"), in bank 1F; the
# table ends where the scripts start (7150, the one most actors that do nothing share)
03F078  table  story_scripts[108]  u16

# ======== bank 15's object that puts in others (tools/data_walk.py: spawn lists) ========
# by its kind (field 30: 02AD8F-02ADB4): a time (02AD8F "LDY #$79F1", into field 3D), its list of objects to put in
# (02AD9A "LDY #$79FE"), and 4 next kinds by the players' number (02ADA3 "LDY #$7A18", "LDA A,Y" by direct page 57)
# (with its type, in the section of the program's data by name below: object_15_spawn_lists)

# ======== the test mode (bank 2F) ========
# its palettes (05E05B-05E066: 8 times "LDX ,Y++" and BMOVE of 32 bytes from Y, from 05E05D "LDY #$7B6C")
struct test_palette 22 rom
field test_palette 00 destination u16
field test_palette 02 colours u16[16]
05FB6C  table  test_mode_palettes[8]  test_palette
# the sound test's two lists, by the page's number, of the words 078680 queues for the Z80 (05E728 "SUBA #$30; LEAX
# A,X; LEAX A,X; LDD ,X", X 30 entries past the list's start): the effects' (05E2A0 "LDA $5916; LDX #$6799", the
# number 0-AA: 05E290 wraps it past AA) and the music's (05E23E "LDA $5915; LDX #$68EF", 0-30: 05E22E wraps it past
# 30; the first, 0000, stops it). kref --rom-reads: 05E72E reads 05E739-05E798 and the music's
05E739  table  sound_test_effects[171]  u16
05E88F  table  sound_test_music[49]  u16

# ======== code nothing reaches ========
# runs nothing calls, jumps or points at that decode as instructions to a return or a jump (the coverage: unknown
# runs that decode to their end); each is code the game never runs, kept as it is

# the empty slots of jump tables (an LBRA to 0000: no routine), at a bank's start or in the fixed program's (0785xx
# on): nothing jumps through them
struct vector 03 rom
field vector 00 opcode u8
field vector 01 offset s16
0280BD  table  goon_actions_jump_table_spare_slot[1]  vector
02C030  table  scenery_jump_table_spare_slots[2]  vector
02C057  table  scenery_jump_table_spare_slot[1]  vector
032024  table  stage_7_objects_jump_table_spare_slot[1]  vector
07865F  table  fixed_jump_table_spare_slot_2[1]  vector
078665  table  fixed_jump_table_spare_slot_3[1]  vector
034000  table  dreamland_jump_table_spare_slots[2]  vector    # the first two slots of bank 1A's jump table
# a slot of the fixed program's jump table nothing jumps through, to a routine (07D47E) that dispatches by its object's
# field 28 like the objects' dispatchers (07D484 "LDU #$F661; LDB A,U; STB <$0E; SETLN <$0E", 07D496 "LDU #$F65F;
# ASLA; JMP [A,U]"), through tables that hold no code addresses there: F65F-F661 end a table of bytes, F662 starts
# one of code addresses (DDC3, DDF3...). Left from the game's making: its jump goes nowhere
0785D8  table  vector_to_dead_dispatch[1]  vector
07D49A  code  unused_enemy_run_action_jump  calls=unused_object_handlers
07F65F  data  unused_object_handlers  record=2 count=0 code=0
# a list of spawns no table leads to, in bank 1A: 67 records like a stage's (x from 0148 to 0540), no end record
0354C5  table  unused_dreamland_spawn_list[67]  spawn

# ======== the enemies (tools/data_walk.py: enemy behaviour) ========
# an enemy's behaviour, 88 bytes: what the fixed program's enemy routines (07D3D7-07D662) read from the object's field
# 2A: by its state (field 30) 8 bytes a state, 3 on (07D604-07D624: thresholds against a random number and the next
# states), and from 28 on 4 ranges of 12 bytes (07D3E7-07D3FD: how far, the least and the most of field 2D)
struct enemy_behaviour 58 rom
field enemy_behaviour 00 states u8[40]
field enemy_behaviour 28 ranges u8[48]
# bank 18's enemy, by its state (field 30: 030137 "LDU #$79DA; LDA #$30,X; ASLA; ASLA; LEAU A,U"): its next state and
# its flags (030141 "LDD ,U"), and its behaviour (030154 "LDD #$02,U; STD #$2A,X")
struct behaviour_choice 04 rom
field behaviour_choice 00 state u8
field behaviour_choice 01 flags u8
field behaviour_choice 02 behaviour u16 enemy_behaviour
0319DA  table  object_18_behaviours[5]  behaviour_choice

# ======== the players ========
# a player's record (07A0DE "LDU #$E819; LDA <$F0; ASLA; LDU A,U", by the player's number): the addresses of its
# variables in the work RAM, which the code goes through ([#$15,U], [#$17,U], [#$04,U]: 07A0E7-07A10F), its bit
# (06) and its initials (0B: MRG, HMR, BRT, LSA, the high score's)
# (with its type, in the section of the program's data by name below: struct player, player.variables_00,
# player.variables_02, player.lives, player.bit, player.variables_07, player.variables_09, player.initials,
# player.number, player.variables_0f)
07E819  table  player_records[4]  u16 player
07E821  table  player_variable_records[4]  player

# ======== the players' gauges (bank 20) ========
# a player's record for the gauges (040909 "LDX #$7294; ASLA; LDX A,X", by the player): the addresses of its
# variables, read through ([#$12,X], [#$16,X], [#$02,X]), and places in the tile RAM
struct gauge_player 18 rom
041294  table  gauge_player_records[4]  u16 gauge_player
04129C  table  gauge_players[4]  gauge_player
# the two tiles, one above the other, of a gauge's step 1-8 (040A4C "LDY #$72FC; ASLA; LEAY A,Y": 0 draws 8D)
# (with its type, in the section of the program's data by name below: gauge_step_tiles)
# the game's rank, direct page 61 (040C40, at most 1F): the sum of a base (040C65 "LDX #$7782; LDA <$14; LDA A,X",
# entry 1 while direct page 11 is set), a term by the players in the game (040C7D "LDX #$7786; LDA <$57; DECA"),
# one by scene (040CB7 "LDX #$778A; LDA <$67"), and a step that grows by one, up to 5, each time the frame count in
# direct page 63 reaches the scene's time (040C8D "LDX #$7796": scene 11's is rank_frame_limits' first)
041782  table  rank_base[4]  u8
041786  table  rank_by_players[4]  u8
04178A  table  rank_by_scene[12]  u8
041796  table  rank_step_times[11]  u16
# by scene, a count direct page 65 is compared with (040CC6), whose result nothing takes (BCS to the RTS that comes
# next anyway). Scene 11's, stage 8's, is past the table's 11: 0417C2-041FFF are bank 21's 0437C2-043FFF, the
# assembler's leftovers, and the game reads their first two bytes as it
0417AC  table  rank_frame_limits[12]  u16
# the characters' profiles in the attract, typed out one character a frame (04082C "LDX #$7106; ASLA; LDX A,X"):
# Bart's, El Barto's, Homer's, Lisa's... the last one (726B) a picture of tiles 71-91; data_walk.py's profile_texts
041106  table  profile_texts[9]  u16
# the test mode's characters, one a player (05EEB6 "LDU #$7D88", by the player): the address of the player's lives
# (00), a kind and an animation (02), a place (04), a depth (06), its shadow's kind (08) and place (0A), the bit of its
# start button (11)
struct test_player 12 rom
field test_player 00 lives u16
field test_player 02 kind u8
field test_player 03 animation u8
field test_player 04 x u16
field test_player 06 z u16
field test_player 08 shadow_kind u16
field test_player 0A shadow_x u16
# (with its type, in the section of the program's data by name below: test_player.unk_0c)
field test_player 11 button u8
05FD88  table  test_player_records[4]  u16 test_player
05FD90  table  test_players[4]  test_player

# ======== small tables of the stages' objects ========
# bank 12's object puts others where these say, by number (02538A "LDU #$77BA", 8 bytes a record, 025398-0253BD): the
# object's address in the work RAM (FFFF: the caller's), its kind and animation, its x and z (FFFF: as they are);
# kref --rom-reads: 0257BA-025951, 51 records
struct placement 08 rom
field placement 00 object u16
field placement 02 kind u16
field placement 04 x u16
field placement 06 z u16
0257BA  table  object_12_placements[51]  placement
# after them, 4 records nothing reads (no code names 7952-7961, no scenario reads them): a player's bit (1, 2, 4, 8)
# and a kind and animation, none for the first (FFFF) and 3F15, 3F16, 3F17 (03E614 handles 3F14-3F17 apart)
struct player_kind 04 rom
field player_kind 00 bit u8
field player_kind 01 kind u16
# 03: a 00 in every record (a record is four bytes)
field player_kind 03 filler u8
025952  table  unused_player_kind_list[4]  player_kind
# bank 13's stage records, a slot each after the bank's jumps (6000-600B), 3 bytes like them: the record (into direct
# page A4) and a 00. Each step's start in the fixed program reads its own (07A555 "LDX $600C", 07A794 "LDX $600F",
# 07A8DF $6015... 07B08F $6021); the third, 6012, the second's 7AA9 again, none reads
struct stage_slot 03 rom
field stage_slot 00 record u16
# 02: the 00 after the record, the third byte a slot has like the bank's jumps
field stage_slot 02 filler u8
02600C  table  stage_slots[10]  stage_slot
# bank 1A: 4 words after the object setup at 792E (0000, 0100, 0200, 0400) that nothing reads (no code names 7934, no
# table holds it, no scenario reads it); shaped like 7926's just before, 4 entries of 2 bytes by direct page 58's low
# 2 bits (034E55: a speed's high byte, into 0F, and field 3B)
035934  table  unused_speed_words[4]  u16
# a hit box no object setup points to, after bank 18's 7 (7EA0-7ED7, which 07D1B7 reads into an object's fields 1C,
# 1F, 21 and 23): no code names 7ED8 and no scenario reads it
struct hit_box 08 rom
031ED8  table  unused_figure_hit_box[1]  hit_box
# bank 1D's object's parts, by number (03B530 "LDY #$7D21", 8 bytes a record, 03B535-03B553): a speed, its y and z
# from the object, its kind, its animation; kref --rom-reads: 03BD21-03BD96, 15 records
struct part 08 rom
# (with its type, in the section of the program's data by name below: part.speed, part.dy, part.dz, part.kind,
# part.animation, part.unk_06)
03BD21  table  object_1d_parts[15]  part
# bank 1C's object's moves: the next by step (0388D4 "LDX #$7DEB; LDA B,X", negative goes back to 0), and 4 of 4 bytes
# (0388E2 "LDX #$7DF7", 0388E7 "LDD ,X++; LDY ,X")
039DEB  table  object_1c_move_steps[12]  u8
# (with its type, in the section of the program's data by name below: object_1c_moves)
# bank 16's object, by its kind (02D1C9 "LDU #$7E39", into field 47; 02D1D1 "LDU #$7E3F", 4 bytes a record: its pattern
# into field 3E, its kind and animation), and the patterns, 5 steps each (02D326 "LDB A,Y" by field 3C, which 02D209
# sets to 5 and 02D319 counts down to 0); the child objects at 7E75 and 7E7D follow
02DE39  table  object_16_flags[6]  u8
struct pattern_start 04 rom
field pattern_start 00 pattern u16
field pattern_start 02 kind u8
field pattern_start 03 animation u8
02DE3F  table  object_16_kinds[6]  pattern_start
02DE57  table  object_16_patterns[30]  u8
# bank 1E's object's 11 parts (03C8F6), each born at an offset from it (03C925 through 07862C, a child object): the 3
# bytes added to its x, y and z, one part after the other (03C8F6 "LDD #$7E2C; STD <$F8", 03C933 "LDY <$F8; LDB ,Y+":
# a pointer kept in the direct page, which the walk does not follow); kref --rom-reads: 03DE2C-03DE4C. 12 of them:
# the last (08 08 40, the pattern going on) no part reaches, 03C925 making 11 at most
struct part_offset 03 rom
field part_offset 00 dx s8
field part_offset 01 dy s8
field part_offset 02 dz s8
03DE2C  table  object_1e_part_offsets[12]  part_offset

# in bank 10, after the players' input records (7BD0-7BEB, 7 bytes each, by the table at 7BC8) and before the table
# at 7C00: 10 words nothing reads (no code names 7BEC-7BFF, and no scenario reads them), shaped like the sound
# commands 078680 queues at 4904 (a command and its byte, as 0209ED's 3F30 and 3F31 at 7BC4): effect 78 with 08, 09,
# 0C, 0D, 18, then with 0A, 0B, 0E, 0F, 1A
021BEC  table  unused_effect_78_commands[10]  u16

# ======== the game's texts ========
# by number (079311: bit 7 clears it instead, 079346), in bank 12 (07932D "LDX $6021": the table's address, which the
# bank keeps at 6021; 079331 "LDU B,X"), printed by 07936D (an address in the tile RAM, the characters, '/' and the
# next address, '#' the end): "INSERT COIN", the copyright... The table ends where its first text starts
# (with its type, in the section of the program's data by name below: game_texts_address)
0259E4  table  game_texts[19]  u16

# code nothing the analysis follows reaches (runs that decode to a return or a jump at their end, or into code)
02807E  table  goon_jump_table_spare_slots[2]  vector
0280B1  table  goon_jump_table_spare_slot[1]  vector
0785F6  table  fixed_jump_table_spare_slot[1]  vector
# bank 1A's flying object's next state by its field 31 (034089 "LDU #$77BC", 0340B2 "LDU #$77C1"), and its levels: a row
# of 5 by field 31 (03409B "LDU #$77C6; ASLA; LDU A,U"), a byte by direct page 57 (0340A7 "LDA A,U", into 188C)
0357BC  table  object_1a_next_states[5]  u8
0357C1  table  object_1a_states_after[5]  u8
# (with its type, in the section of the program's data by name below: object_1a_level_rows)
035754  table  object_1a_levels[20]  u8
# after the spawn list nothing leads to, a record more like its (0356DD), places in the tile RAM (0356E5) and two texts
# in the fixed printer's form (0356FE: spaces over two lines; 035744: T F V O), which nothing prints
0356FE  table  unused_blank_lines_text[70]  u8
035744  table  unused_tfvo_text[16]  u8

# ======== the decompiled program's files ========
# where the C of the 053248's functions goes (tools/decompile.py: src/PATH.c): a file line takes the functions from
# its place up to the next file line. Provisional, but for the boot and the interrupts: a file a bank, and the fixed
# program a file each 2000 bytes, until the functions are sorted by subject
0786CE  file  system/boot    # the reset: the board set up, the RAM and ROM checks, the main loop that runs the jobs
078F43  file  system/interrupts    # the IRQ's handler (the K052109's, at VBLANK: the inputs, the coin counters, the jobs) and the FIRQ's (the sprite DMA's)

# ======== functions the board puts its own in place of ========
# (runtime/replaced.txt, runtime/src/board_game.c)
# 078E5B (a bank in the window) and 078E63 (the fixed program) run into it: "LDD <$FA; ADDB ,X+; ADCA #$00; STD <$FA;
# LEAU -1,U; CMPU #$0000; BNE": the boot's RAM ROM CHECK adds up the program's chips, which the game does not have
078E68  func  add_rom_bytes

# ======== the program's data by name: the tables the C reads, and what it reads through pointers ========
# every table the decompiled 053248 program reads, by what it is, with its element type and count, and the records and
# values it reads through pointers (struct, elements, and the local and param lines that type the pointers); the
# evidence
# above each: the instructions that read it (as the listing has them) and what the value goes to. kref: what kref
# --rom-reads saw an instruction read in the scenarios

# ======== banks 10, 11, 12, 13 ========
# Places are offsets of the program region; "(cpu XXXX)" is the address the code names. Evidence quotes are the
# listing's (build\listing\simpsons.s); "kref" is build\reads\<scenario>\rom_reads.txt.
#
# Who is who (evidence for the subjects used below):
# - bank 10 holds the two bonus stages and the wrestler. Bonus 1: scene 83 (07A689 sets direct page 75 to 83), its
#   steps 020009 (from 07A6CC) and 020000 (from 07A748); bonus 2: scene 8B (07AF5A), 02000C (from 07AF97) and 020003
#   (from 07B00F); both end with the results at 020F39 (020207 "LBSR $6F39", 020BF0 "LBSR $6F39"). The bonus objects
#   are 4A40 + C0 x player (the player's slot: 0 Marge, 1 Homer, 2 Bart, 3 Lisa) with partners at +60 and +840.
#   (kind_0E.png shows the texts "Hey, wake up and find Maggie!" and "Blow up your balloon and go after Maggie!":
#   bonus 1's object grows as the player presses (its zoom, below), bonus 2 raises a level; the names keep
#   bonus_1 / bonus_2.)
# - the wrestler: object type 1F (the 4F80 list's handlers F2EC, entry 1F -> 020006 -> 0212F8), its kind 94 (021768 "LDU
#   #$7E79; ASLA; LDD A,U; ORB #$80; STD #$04,X", values 94xx; SET_NAMES 0x94 "wrestler"); stage 1's spawn list
#   (spawn_lists[0], 03659D) holds a type-1F spawn, stage 4's two, stage 8's one.
# - the krusty balloon: object type 05 (entry 05 -> 026000 -> 026509), its kind 9D (02696B "LDU #$7CB6", values
#   9Dxx; SET_NAMES 0x9D "krusty_balloon"); stage 2's spawn list (03685D) holds a type-05 spawn.
# - stage 7's boss: object type 37 (entry 37 -> 022009 -> 022A4C), kind A3 (022EA0 "LDU #$7A55", values A3xx;
#   no SET_NAMES name); the only type-37 spawn is in spawn_lists[9] (037A1D), scene 9 = step 13, stage 7. Its 4
#   helpers are type 37 of the second object list (5280; 07CB9F's handlers F40D, entry 37 -> 02200C -> 023171), kind 12.
# - the three bosses share one plan: health in field 1B (07C274 "LDA #$1B,X", 07C277 "SUBA #$1C,U": the attacker's
#   field 1C is the damage), a 5-piece gauge drawn by 0786BF (07E496: "STD <$E8" the health one piece stands for,
#   07E4AF "LDB #$05; MUL", 07E4B5 "LDB #$56,X" the health at the start, 07E4CD "CMPA <$EE" counting the pieces up to
#   5), and their target player in field 2B.

# ======== bank 10: the bonus stages ========

# bonus 1's players, one record each (7 bytes): the presses the bonus reads (18E8 + player: 020362 "LDA [,U]", 020364
# "ANDA
# #$30", the attack/jump bits; 020816 "LDA [#$03,U]; STA [,U]" copies the player's, 02088C "LDA #$10; STA [,U]"
# presses for a player not in the game), the player's bit (01 02 04 08: nothing reads it), the player's newly
# pressed controls (4842 + 4 x player, which 079248 keeps: "LDA #$01,X; COMA; ANDA ,X; STA #$02,X"), and the
# player's bonus object (4A40 + C0 x player: 0200C1 / 02083C "LDX #$05,U")
struct bonus_player 07 rom
field bonus_player 00 presses u16
field bonus_player 02 bit u8
field bonus_player 03 controls_pressed u16
field bonus_player 05 object u16
# by player: 0200BB "LDU #$7BC8; ASLA; LDU A,U" (A from 18EE, the player), 02027A/020330/02080E/020834/
# 02087F the same in loops over the 4 players, 0208B8 "LDX #$7BC8; LDU ,X" (any press: sound 2900). Only bonus 1's
# code reads it (callers 0200D9, 02012E, 02016F, 020172, 0202D8, 020324)
021BC8  table  bonus_1_player_records[4]  u16 bonus_player
# the 4 records (7BD0-7BEB; asset pieces 021BD0 ... 021BE5, one record each)
021BD0  table  bonus_1_players[4]  bonus_player

# the bonuses' shared start (0209C0 by 18F1): after C0 frames (0209CA "LDD #$00C0; STD $18EF", 0209D6 "DECW $18EF")
# it puts placement 1A + the bonus (0209DE "ADDA #$1A; LBSR $67C7": 4EC0, kind 0E, animation 41 / 40) and queues its
# sound for the Z80 (0209E9 "LDX #$7BC4", 0209EC "ASLA", 0209ED "LDD A,X", 0209EF "LBSR $8680": 3F30, 3F31). A is
# the bonus: 020012 "CLRA; LBSR $69C0" (bonus 1), 020A47 / 020AB4 "LDA #$01; LBSR $69C0" (bonus 2)
021BC4  table  bonus_intro_sounds[2]  u16

# the bonuses' placements, by number (0207C7: "LDU #$7C00; ASLA; LDU A,U", then the record: 0207CF "LDY ,U++" the
# object (0207D1 "CMPY #$FFFF", 0207D6 "TFR X,Y": FFFF the caller's), 0207E0 "LDD ,U++; ORB #$80; STD #$04,Y" its
# kind and animation, 0207E7 "LDD ,U++" x (FFFF: as it is), 0207F1 "LDD #$00B0; STD #$11,Y", 0207F7 "LDD ,U++" z):
# the shape of object_12_placements' records (025388), so the same struct. 28 addresses (7C38-7D10, one record each
# after the table); both bonuses use it (bonus 1: 02072E-0207A1, the shared start 0209DE, 0209AE from 02002A and
# 020A51). 0209AE "LDX [$7C32]" reads entry 25 (021C32, kref 0209AE 021C32-021C33 then 021D00-021D01): the
# object of placement 25 (4E60), and puts placement 25 (0209B6 "LDA #$19; LBSR $67C7") when that object is off
021C00  table  bonus_placements[28]  u16 placement
# the 28 records themselves (pieces 021C38 ... 021D10, 8 bytes each); optional: the
# u16 table above already types the reads
021C38  table  bonus_placement_records[28]  placement

# ---- bonus 2: a level per player that each press raises (020E0D "LDD #$01,U; ADDD #$0180; STD #$01,U") and that
# falls 8 a frame (020DFA "LDD #$01,U; SUBD #$0008"); the object at +60 (kind 0A + player, 020B4B "STA #$64,U") shows
# it (020DCE-020DD9: animation 91 + level/16, "ADDA #$91; STA #$65,U"); the kind-0E object at +840 (list 5280,
# 020B69 "LDA #$0E; STA #$0844,U") stands beside the player (animation 88 in the game, C5 out of it: 020B89-020B96;
# +1 while the player reacts, 020E38; +2 at the end, 020CF6). While the player presses with the level low, a reaction
# of 16 frames at random (020E24 "LDA <$58; ROLA; ROLA; ROLA; ANDA #$03; ADDA #$08; LDB #$10; STD #$30,U": states 8-11
# by the table 7D2C, counted down in field 31). The reactions read their tables by field 31 / 2 (31 is 10 when set and
# decremented before the read: indexes 7 down to 0)

# the player's x by player (020E72 "LDB <$F0; ASLB; LDX #$7D7D; LDD B,X", <$F0 the player; 020E6E "LDX #$00A8"
# instead while direct page.. 1840 is 2). kref 020E79 021D7D-021D84; the next 8 bytes are the entries 10-13 of
# bonus_2_level_object_offsets (below)
021D7D  table  bonus_2_player_x[8]  u16
# the +840 object's x from the player's (020B6F "LDA <$F0", 020B72 "LDY #$7D28", 020B75 "LDA A,Y", 020B77 "LEAX A,X",
# 020B79 "STX #$084C,U"), by player
021D28  table  bonus_2_side_object_x_offsets[4]  s8
# reaction 8 (020D14): the player's x plus these, a wave (020D1D "LDA #$31,U; LSRA", 020D21 "LDY #$7D44", 020D24
# "LDA A,Y", 020D26 "LEAX A,X", 020D28 "STX #$0C,U"). kref 020D24 021D44-021D4B: the 9th byte (FA, the wave's last
# step) nothing reads
021D44  table  bonus_2_shake_x_offsets[9]  s8
# reaction 9 (020D36): squash and stretch, the zooms of the object and of its +60 partner (020D4B "LDA #$31,U;
# LSRA", 020D4F "LDY #$7D55; LDB A,Y" the vertical, 020D54 "LEAY #$-08,Y; LDA A,Y" the horizontal, 020D59 "STD
# #$0A,U", 020D5C "STD #$6A,U": field 0A the horizontal zoom, 0B the vertical, as 079CE1 / 079D61 take them; 40 the
# normal size)
021D4D  table  bonus_2_squash_zooms_x[8]  u8
021D55  table  bonus_2_squash_zooms_y[8]  u8
# reaction 10 (020D62): the +60 object's x moves, 8 steps by player (020D6F "LDA #$31,U; LSRA", 020D73 "LDX #$7D5D;
# LEAX A,X", 020D78 "LDB <$F0; ASLB; ASLB; ASLB; LDB B,X; STB <$F2", added in 020E8E "LDA <$F2; LEAX A,X"). kref
# 020D7E 021D5D-021D7C: 32 bytes, so the table takes the 12 bytes of the piece 021D71 (Lisa's row: 7F
# moves her level object off the screen)
021D5D  table  bonus_2_level_object_x_moves[20]  s8
# the +60 object's place from the player's object, by the player's kind (020E80 "LDX #$7D71; LDA #$04,U; ASLA; LDD
# A,X": the kind is 0A + player, so entries 10-13; 020E89 "LDX #$0C,U; LEAX A,X" x, 020E9F "LDY #$16,U; LEAY B,Y" z,
# both signed). kref 020E87 021D85-021D8C only. The table starts where the code names it (7D71), so its entries 0-9
# are the bytes of the two tables before (bonus_2_level_object_x_moves' last 12, bonus_2_player_x): the tables
# overlap there, and each is counted as far as the next one starts
struct xz_offset 02 rom
field xz_offset 00 dx s8
field xz_offset 01 dz s8
021D71  table  bonus_2_level_object_offsets[6]  xz_offset

# the bonuses' results (020F39, from both): a player put in the ranking (0210A5-021157) gets 1F in its field 47
# (021127 "LDA #$1F; STA #$47,U"), and each frame (020FF6 "LDA #$47,U; BEQ", 020FFB "DEC #$47,U", A still the value
# before) 020FFE "LDX #$7D9C", 021001 "LDA A,X", 021003 "STA #$19,U", 021006 "STA #$79,U": the y speeds (field 19,
# positive up: 07D16E's gravity subtracts) of a hop, for it and its +60 partner. kref 021001 021D9D-021DBB: entries
# 1-31; entry 0 is the last byte of the jump table 7D8D before (its 8th entry, 7017)
021D9C  table  bonus_results_hop_speeds[32]  s8

# ======== bank 10: the wrestler (object type 1F, kind 94) ========
# its kind and animation by number (021766: 021768 "LDU #$7E79; ASLA; LDD A,U", 02176E "ORB #$80", 021770 "STD
# #$04,X"); called with 00-0F; kref 02176C 021E79-021E98
021E79  table  wrestler_animations[16]  u16
# its hit boxes by number (021775: "LDU #$7E99; ASLA; ASLA; ASLA; LEAU A,U", then 02177D "LDD ,U++; STA #$1C,X; STB
# #$1D,X", 021785 "STD #$1F,X", 02178A "STD #$21,X", 02178F "STD #$23,X": the hit_box struct); called with 0-3 (021826
# "CLRA", 0215BA "LDA #$01", 0215F9 "LDA #$02", 02163F "LDA #$03"); kref 02177D-02178F 021E99-021EB8. The table spans
# the 16 pieces 021E99 ... 021EB7
021E99  table  wrestler_hit_boxes[4]  hit_box
# the health one of the 5 pieces of its gauge stands for, by players (021307 "LDU #$7E75", 02130A "LDA <$57", 02130D
# "DECA", 02130E "LDA A,U", 021310 "CLRB", 021311 "LBSR $86BF" -> 07E496 "STD <$E8"); 5 pieces from its 1B at the
# start (C0: 02142C "LDA #$C0; STA #$1B,X") end at about wrestler_beaten_health (C0 - 5 x 19 = 43, C0 - 5 x 20 = 20...)
021E75  table  wrestler_gauge_piece_health_by_players[4]  u8
# the health at or below which, landing, it is beaten (021385: 021391 "LDU #$7E71", 021394 "LDA <$57; DECA",
# 021398 "LDB #$1B,X", 02139B "CMPB A,U", 02139D "LBLS $7835": 021835 clears field 1B and sets state FD)
021E71  table  wrestler_beaten_health_by_players[4]  u8
# its walking speed toward its target, by rank (021565 state 1: 02157C "LDA #$2D,X" the direction, 02157F "LDY
# #$7ED1", 021582 "LDB <$61", 021585 "LSRB", 021586 "LDB B,Y", 021588 "LBSR $8617": 07CC8E sets the speeds 14 and 0F)
021ED1  table  wrestler_speeds_by_rank[16]  u8
# next to its target (0216E4 -> 021700 "LBSR $77C9; LBCS $7920"): 021936 "LDU #$7EC9", 021939 "LDA <$57; DECA",
# 02193D "LDA A,U", 02193F "CMPA <$58", 021942 "BHI $795D": below this chance it acts at once (02195D: guard, jump or
# punch with field 29 cleared); else, unless it lost 0C or more health since the last time (021944 "LDA #$2F,X; SUBA
# #$1B,X; CMPA #$0C"), it punches after 20 frames (02194E "LDA #$02; STA #$02,X", 021956 "LDA #$20; STA #$29,X")
021EC9  table  wrestler_quick_attack_chances_by_players[4]  u8
# with one player in the game or two or more next to it (021963 "LBSR $77E5"): 021968 "LDU #$7ECD", 02196B "LDA <$57;
# DECA", 02196F "LDA A,U", 021971 "CMPA <$58", 021974 "BHI $7997": it guards (021997: flag 04 on field 00, no damage
# in 07C26D; animation 8, state 3 for 40 frames)
021ECD  table  wrestler_guard_chances_by_players[4]  u8
# else 021976 "LDU #$7EB9", 021979 "LDA <$61", 02197C "LSRA", 02197D "LDA A,U", 02197F "LDB <$58; ADDB <$16", 021988
# "CMPA <$F0", 02198B "BHI $79B4": it jumps at the player (0219B4: state 4, animation 7, x speed +-0180, y speed 0700),
# otherwise it punches at once (02198D state 2)
021EB9  table  wrestler_jump_chances_by_rank[16]  u8

# ======== bank 11: the name entry and the high scores ========
# a player's record in the name entry (25 bytes), by player (02203D / 022079 "LDY #$7532", 022279 / 0222D9 "LDU
# #$7532", "ASLA; LDY A,Y"):
# - 00 where its letters go in the sprite RAM (2000 + 100 x player: 022085 "LDU ,Y" handed to 022730, which writes a
#   sprite of 10 bytes at U with the sprite RAM on, 022757-02278C; 0223FA "LDU ,U; LEAU #$0080,U" its initials')
# - 02 4980 + 8 x player, an entry of the high score table (079718 "LDX #$4983" walks it 8 bytes an entry): nothing
#   reads it
# - 04 the player's newly pressed controls (4842 + 4 x player: 02236F "LDA [#$04,U]; ANDA #$02", 02239F "ANDA #$01",
#   0223CF "ANDA #$30")
# - 06 its initials (3852 + 3 x player, set to "A@@" at 0221B5: 022390 "LDY #$06,U; INC A,Y", 0222E4 "LDY #$06,U")
# - 08 the player's score (49D4 + 8 x player: 022048 / 022087 "LDD [#$08,Y]", 0222F1 "LDD [#$08,U]")
# - 0A the controls the player holds (4843 + 4 x player, 079248 "STA #$03,X": 02237B "LDA [#$0A,U]; ANDA #$02")
# - 0C a place in the tile RAM, 2 rows above its box's (224E + 9 x player): nothing reads it
# - 0E the address of its repeat countdown (3868 + player: 022367 "LDA [#$0E,U]; DEC [#$0E,U]", 022382 "LDA #$0F; STA
#   [#$0E,U]")
# - 10/12 where its place ("1ST"...) is printed (0220A4 "LDD #$10,Y; STD <$F8", 0220AA "LDD #$12,Y; STD <$FA"),
#   14/16 its score (022114 "LDD #$14,Y", 02211A "LDD #$16,Y"), 18 its letters' colour (02240E "LDB #$18,U; ADDB #$0A")
struct name_entry_player 19 rom
field name_entry_player 00 sprites u16
field name_entry_player 02 high_score_entry u16
field name_entry_player 04 controls_pressed u16
field name_entry_player 06 initials u16
field name_entry_player 08 score u16
field name_entry_player 0A controls_held u16
field name_entry_player 0C tiles u16
field name_entry_player 0E repeat_wait u16
field name_entry_player 10 place_x u16
field name_entry_player 12 place_y u16
field name_entry_player 14 score_x u16
field name_entry_player 16 score_y u16
field name_entry_player 18 colour u8
023532  table  name_entry_player_records[4]  u16 name_entry_player
# the 4 records (pieces 02353A ... 023585)
02353A  table  name_entry_players[4]  name_entry_player

# the players' scores' addresses (49D4 49DC 49E4 49EC), which 022307 sorts the players by: 02231D "LDX #$7516" once,
# then 022331 "LDA ,Y; ASLA; LDD [A,X]" and 022339 "LDA ,U; ASLA; LDD [A,X]" (the two DATA16 reads)
023516  table  player_score_addresses[4]  u16
elements score_address u16

# the two letters after a place, by place 0-9 (0220E9 "LDY #$751E", 0220EC "LDA ,X" the place, 0220EE "ASLA", 0220EF
# "LEAY A,Y", 0220F1 "LDA ,Y+" and 022104 "LDA ,Y", each printed by 022730): "ST" "ND" "RD" "TH" x 7
struct place_suffix 02 rom
field place_suffix 00 first u8
field place_suffix 01 second u8
02351E  table  place_suffixes[10]  place_suffix

# the letter at the cursor pulses: its sprite's vertical zoom by the frame (022437 "LDX #$759E", 02243A "LDB <$16;
# ANDB #$1F; LSRB", 022441 "LDB B,X", 022443 "STB #$-07,U": byte 09 of the sprite 022730 just wrote, the vertical
# zoom; 40 the normal size)
02359E  table  name_entry_cursor_zooms[16]  u8

# 022491 draws a picture of tiles in a player's column: by its B (0-3 the player's box, 4-7 the player's face; 02209C
# "LDB #$04; ADDB <$F0") 0224B0 "LDX #$75AE; LDB #$07,S; ASLB; LDX B,X"; a picture is blocks of: 0224B9 "LDU ,X++" the
# place in the tile RAM, 0224C0 "LDA ,X+" the width, 0224C5 "LDA ,X+" the height, 0224CA "LDA ,X+; ORA #$03,S" the
# colour, then a tile a byte by rows (0224E5 "LDA ,X+; STA ,U+"), and 0224FA "LDA ,X+; BEQ $64B9": 00 another block,
# else the end. The 8 addresses are followed by the 8 pictures (0235BE-023679, in the same piece)
struct name_entry_block 05 rom
field name_entry_block 00 tiles u16
field name_entry_block 02 width u8
field name_entry_block 03 height u8
field name_entry_block 04 colour u8
0235AE  table  name_entry_pictures[8]  u16 name_entry_block
# the 8 pictures those addresses lead to, one after another (0235BE-023679): their blocks and tiles
0235BE  table  name_entry_picture_blocks[188]  u8
# a player's column (0224A1 "LDX #$767B; LDA #$06,S; ASLA; LDD A,X", A the player): 0224AA "STA #$05,S" the tiles it
# moves the picture right (0224BB "LDB #$05,S; LEAU B,U": 00 09 12 1B), 0224AD "STB #$03,S" the bits it puts in the
# colour (00 40 80 C0: the palette bits of the K052109's colour byte)
struct name_entry_column 02 rom
field name_entry_column 00 column u8
field name_entry_column 01 palette u8
02367B  table  name_entry_columns[4]  name_entry_column

# 022730 prints a letter as a sprite (code, x, y, colour in the sprite RAM: 022757-02278C): 022734 "LDX #$7695",
# 022737 "SUBA #$30", 022739 "LDB A,X" the code's low byte, 02273B "LDA #$-01,X" its high byte (78). Letters 30-80
# (kref 022739 023695-0236E5). 023694 is the last byte of the piece 023683 (the state table 7683's 8
# entries and 00 78)
023694  table  sprite_font_code_high[1]  u8
023695  table  sprite_font_codes[81]  u8

# the high score table's little animated faces: 02263C prints an entry (place, 3 initials, score) and then its
# character (the entry's byte 5, 0222DC "LDA ,X; STA <$F5" saved with it): 0226E7 "LDA ,X++; PUSHS A", 0226EB "LDY
# #$76E6", 022704 "ADDB A,Y" (B the frame, 0-3), handed to 022730 as a letter (71 75 79 7D: the first of 4 letters
# each, codes 7868... in sprite_font_codes)
0236E6  table  high_score_icons[4]  u8
elements high_score_icon u8

# ======== bank 11: the ending (scene 8E: 022809 "LDA #$8E; STA <$75") ========
# the family's placements (022A1C: 022A1E "LDU #$7706", 022A21-022A29 A x 8, 022A2A "LEAU D,U", 022A2C "LDY ,U++",
# 022A33 "LDD ,U++; ORB #$80; STD #$04,Y", 022A3A "LDD ,U++; STD #$0C,Y", 022A3F "LDD #$0080; STD #$11,Y", 022A45
# "LDD ,U++; STD #$16,Y"): placement's shape (y fixed, no FFFF); kind 14 (family) and 0F; called with 0, 1, 2, 4, 5
# (kref 022A2C 023706 ... 02372E)
023706  table  ending_placements[6]  placement
# frames between the family's animations (02298F: "LDX #$76F8; LDA $18E9; ASLA; LDD A,X", 022999 "CMPD #$FFFF",
# 02299E "CMPD $18E7", 0229BB "INCW $18E7"; when they have passed and 4D40's animation is over, 0229AC "LDA #$02;
# LBSR $6A1C" puts ending_placements[2] again and 0229B6 "INC $18E9"). kref 022997 0236F8-0236FF: 4 of the 7 read
0236F8  table  ending_family_waits[7]  u16
# the staff roll, every A0 frames (022940): 02294F "LDX #$78B2; ASLA; LDU A,X; CLRA; LBSR $86CB" erases the name
# (0793D1, the big letters), 02295D "LDX #$7736 ... LBSR $86B6" erases the title (079384), then the next: 022975 "LDA
# #$40;
# LBSR $86C8" prints the name in big letters (07939B), 022984 "CLRA; LBSR $85A5" the title in small ones (07936D).
# Titles: "MAIN PAROGRAM", "SOFTWARE DESIGN"...; names: "THE SIMPSONS / STAFF", "A.SUZUKI"... kref 022953
# 0238B2-0238DB and 022961 023736-02375F: 21 of the 24 (the last three repeat the 21st's text)
023736  table  staff_roll_titles[24]  u16
0238B2  table  staff_roll_names[24]  u16

# ======== bank 11: stage 7's boss (object type 37, kind A3) ========
# its kind and animation by number (022E9E: "LDU #$7A55; ASLA; LDD A,U; ORB #$80; STD #$04,X"); kref 022EA4
# 023A55-023A70
023A55  table  stage_7_boss_animations[14]  u16
# its hit boxes (022EAD: "LDU #$7A71; ASLA; ASLA; ASLA; LEAU A,U", then 022EB5 "LDD ,U++; STA #$1C,X; STB #$1D,X" ...
# 022EC9 "STD #$23,X"); called with 0-2 (022D07 "CLRA", 022CD9 "LDA #$01", 022D29 "LDA #$02"); kref 022EB5-022EC7
# 023A71-023A88. Spans the pieces 023A71 ... and the first 2 bytes of 023A87; its other
# 16 bytes (all 80, 023A89-023A98: two more boxes' worth) nothing reads as boxes
023A71  table  stage_7_boss_hit_boxes[5]  hit_box
# the health one gauge piece stands for (022A61 "LDU #$7A51; LDA <$57; DECA; LDA A,U", 022A6A "LDB #$04", 022A6C
# "LBSR $86BF"; its health at the start E0, 022BB6)
023A51  table  stage_7_boss_gauge_piece_health_by_players[4]  u8
# landing, beaten at or below (022AE1 "LDU #$7A4D; LDA <$57; DECA", 022AE8 "LDB #$1B,X", 022AEB "CMPB A,U", 022AED
# "LBLS $6FCB": 022FCB clears 1B, state FD)
023A4D  table  stage_7_boss_beaten_health_by_players[4]  u8
# its speed toward its target (022C97 "LDA #$2D,X", 022C9A "LDY #$7AA9; LDB <$61; LSRB; LDB B,Y", 022CA3 "LBSR $8617")
023AA9  table  stage_7_boss_speeds_by_rank[16]  u8
# the frames it walks without reaching its target (022E3B "INCW #$3D,X") before it charges: 022E29 "LDU #$7A99",
# 022E2C "LDA <$57; DECA; ASLA", 022E31 "LEAU A,U", 022E33 "LDD #$3D,X", 022E36 "CMPD ,U", 022E38 "LBGE $70FD" (0230FD:
# state 3, animation 3, hit box 2, at speed 40 toward the target, for A0 frames: 023127 "LDD #$00A0; STD #$3F,X")
023A99  table  stage_7_boss_charge_waits_by_players[4]  u16
elements charge_wait u16
# reaching its target (0230B3, state 2: an attack after field 29's frames, 022CB3): 0230D6 "LDU #$7AA1", 0230D9 "LDA
# <$57; DECA", 0230DD "LDA A,U", 0230DF "CMPA <$58", 0230E2 "BHI $70F5": below this chance it attacks at once; else,
# unless it lost 14 or more health since the last time (0230E4 "LDA #$2F,X; SUBA #$1B,X; CMPA #$14"), it waits 20
# frames first (0230EE "LDA #$20; STA #$29,X")
023AA1  table  stage_7_boss_quick_attack_chances_by_players[4]  u8
# knocked (a hit of kind 13, or its third hit: 02304D "CMPA #$13", 023054 "CMPA #$02"): 023077 "LDU #$7AA5", 02307A
# "LDA <$57; DECA", 02307E "LDA A,U", 023080 "CMPA <$58", 023083 "LBCC $712F": it jumps away to the middle (02312F:
# state 4, animation 9, y speed 0900, x speed +-0300), else it falls (023086: state FE)
023AA5  table  stage_7_boss_jump_away_chances_by_players[4]  u8
# its 4 helpers (022B43: 022B46 "LDB #$01; LBSR $867D" an object of list 5280, 022B4F "LDA #$12; STA #$04,U" kind 12,
# 022B82 "LDA #$37; STA #$01,U" type 37): 022B54 "LDY #$7AD9", 022B57 "LDA <$F0; ASLA; ASLA", 022B5C "LEAY A,Y",
# 022B5E "LDA ,Y+; STA #$05,U" its animation, 022B68 "LDD ,Y++; ADDD #$091F; SUBD <$AC; STD #$0C,U" its x, 022B87
# "LDA ,Y; STU A,X" the boss's field that keeps it (35 37 33 39: 022BD3 "LDU #$35,X" ...)
struct helper_start 04 rom
field helper_start 00 animation u8
field helper_start 01 x u16
field helper_start 03 slot u8
023AD9  table  stage_7_boss_helper_starts[4]  helper_start
# the frames between the helpers' attacks (022F3A: 022F44 "LDD #$3B,X; ADDD #$0001; STD #$3B,X", 022F4D "LDU #$7AB9",
# 022F50 "LDA <$61; ANDA #$FE", 022F55 "LDD A,U", 022F57 "CMPD #$3B,X"; then 022F86-022FA7: idle helpers get a child
# object (022F9D "LDY #$7AE9; LBSR $862C") and state 7). kref 022F55 023AD3-023AD6
023AB9  table  stage_7_boss_helper_attack_times_by_rank[16]  u16
# a helper's moves by its state 1-6 (the boss sets them: 022C39-022C56): its x speed (023184: "LDU #$7B09; LDA
# #$02,X; DECA; ASLA; LDD A,U; STD #$0F,X") and how far it goes (02319C: "LDY #$7B15; LDA #$02,X; DECA; ASLA", 0231A4
# "LEAY A,Y", 0231A6-0231B6 field 29-2A adding the speed, 0231B9 "LDD #$29,X; ABSD; CMPD ,Y": then state 0)
023B09  table  stage_7_boss_helper_speeds[6]  u16
023B15  table  stage_7_boss_helper_distances[6]  u16
elements helper_distance u16

# ======== bank 12 ========
# the game's texts' table, whose address the bank keeps at 6021 (07932D "LDX $6021", 079331 "LDU B,X"): the address
# of game_texts, whose entries are each the address of a text
elements game_text_entry u16
024021  table  game_texts_address[1]  u16 game_text_entry

# the ends of stage 2 (024003 from 07A876, scene 84 area 2: 0241A3) and of stage 5 (024006 from 07AD8F, scene 89),
# whose state tables (770A, 7726) both run 0241E2: each player in the game (0241F7 "LDA <$85; ANDA <$F0") is put
# (024202 "LBSR $7388", object_12_placements 0-3) and leaves after a wait by its order among them (024213 "LDX
# #$7962", 024216 "LDA <$F2; STA #$30,Y", 02421C "LDA A,X", 02421E "STA #$31,Y"; 02427E "LDA #$31,X; BEQ; DEC #$31,X")
025962  table  stage_end_exit_waits[4]  u8
# then (024294 "LDU #$7966", 024297 "LDA #$30,X; ASLA; ASLA", 02429C "LEAU A,U", 02429E "LDD ,U++; STD #$0F,X" its x
# speed, 0242A3 "LDD ,U; STD #$19,X" its y speed), shrinking (0242D0 "LDA #$0A,X; ADDA #$02") as it goes; by field 30,
# its order, 4 for placement 0D (0241D0 "LDA #$04; STA #$30,Y"). kref 02429E/0242A3: the 5 records
struct exit_speed 04 rom
field exit_speed 00 x_speed u16
field exit_speed 02 y_speed u16
025966  table  stage_end_exit_speeds[5]  exit_speed
# object_12_placements read by number (025388: 02538A "LDU #$77BA", 02538D-025395 A x 8, 025396 "LEAU D,U", 025398
# "LDY ,U++" ...): the record's pointer, so the reads go by field

# the area of a player not in the game, filled with one tile (0253C9: 0253CE "LDU #$797A; ASLB; LDU B,U", 0253D4 "LDA
# ,U+" the width, 0253D9 "LDA ,U+" the height, 0253DE "LDA ,U+" the tile (10, the blank the printers erase with),
# 0253E0 "LDB ,U+" its colour (0253F6 "STB #$-2000,X; STA ,X+"), 0253E4 "LDA <$EB; ASLA; LDX A,U" the place by the
# player); 0244F3-0244F7 (stage 5's end) "CLRB; LBSR $73C9" for each player out of <$85, 024692-024697 (scene 8B's,
# 024668) "LDB #$01". The places are by player slot: 0 Marge, 1 Homer, 2 Bart, 3 Lisa. Records 797E, 798A
struct player_blank 0C rom
field player_blank 00 width u8
field player_blank 01 height u8
field player_blank 02 tile u8
field player_blank 03 colour u8
field player_blank 04 marge_place u16
field player_blank 06 homer_place u16
field player_blank 08 bart_place u16
field player_blank 0A lisa_place u16
02597A  table  absent_player_blanks[2]  u16 player_blank

# a quarter of a cosine (80 down to 00 in 64 steps): 0254F4 makes a sine of it times B (025501 "LDU #$79A4", 025504
# "LDA <$E8; BITA #$40", 02550B "LDA <$EA; LDA A,U; MUL" and 025513 "LDA #$3F; SUBA <$EA; LDA A,U" then 02551D "MUL";
# 025524 "BITA #$80" ... "NEGW <$EC" the sign), which 0254BF adds to 0196 for each line's x scroll (0254C7 "LDX
# #$1A00", 0254DA "ADDD #$0196", 0254E1 "STD ,X++": a wave over the layer). kref 02550E / 025518: all 64
0259A4  table  wave_cosines[64]  u8
elements wave_cosine u8

# ======== bank 13 ========
# the stages' title cards (026E1D by scene, 7D42): 026E97 "LDU #$7D8C; CLRA; LBSR $85A5" prints "STAGE 1 /
# DOWNTOWN SPRINGFIELD" (027D8C), then 026E9E "CLRA; LBSR $719A" and 026EA8 "LDA #$09; LBSR $719A" put records (0-8:
# 4D40, kind C2, animation = the record's number, one a stage; 9: 4DA0, kind 0F). 02719A: 02719C "LDU #$7E81",
# 02719F-0271A7 A x 8, 0271A8 "LEAU D,U", 0271AA "LDY ,U++", 0271B1 "LDD ,U++; ORB #$80; STD #$04,Y", 0271B8 "LDD
# ,U++; STD #$0C,Y", 0271BD "LDD #$0080; STD #$11,Y", 0271C3 "LDD ,U++; STD #$16,Y": placement's shape; kref 0271AA
# reads records 0-6, 8, 9
027E81  table  stage_title_placements[10]  placement

# a screen shake (direct page 97 set: 02150E the wrestler landing, 02658E the krusty balloon's): every other frame
# (0261D4 "LDA <$95; CMPA #$01") 0261DE "LDX #$7A00", 0261E1 "LDA <$96; ANDA #$07; ASLA", 0261E7 "LEAX A,X", then
# 0261E9 "LDD <$BF; ADDD ,X" and 0261F1 "LDB ,X; SEX; ADCA <$BE" (layer A's x scroll), 0261FA-026208 the same on layer
# B's (CF, CE), 02620B "LDB ,X; NEGB; SEX; ADDD <$86; STD <$86", 026215 "STD $1FA0" (the sprites' offset, the other
# way): +-3 pixels a step
struct shake_step 02 rom
field shake_step 00 pixels s8
field shake_step 01 fraction u8
027A00  table  screen_shake_steps[8]  shake_step
# its steps by its kind (direct page 98, 0-2: 02621F "LDU #$7A10", 026222 "LDB <$98", 026225 "CMPA B,U", 026227 "BNE":
# then 026229-02622F clear 96, 97, 98)
027A10  table  screen_shake_lengths[3]  u8

# a stage record's layer (026413: "LDA ,U+; STA <$A6", 026418 "LDX #$7A37", 02641B "ASLA", 02641C "LDX A,X";
# 02642C-026436 the other one): the addresses of the layer's x and y scroll (48BE 48C5, 48CE 48D5: layers' scroll_x
# and scroll_y), which 026483 moves (026483 "LDY ,X" ... 026496 "LDY #$02,X")
struct layer_scroll 04 rom
field layer_scroll 00 x u16
field layer_scroll 02 y u16
027A37  table  layer_scroll_records[2]  u16 layer_scroll
# the 2 records (pieces 027A3B, 027A3F)
027A3B  table  layer_scrolls[2]  layer_scroll

# stage 3's second part (step 7: 027908's 8th entry, 604D) scrolls up (026123: layer A's y scroll, C5-C6, grows by
# E2): layer A's offset_y (direct page CA, layers[0]'s field 0C) by the y scroll: 026123 "LDX #$7A5B", 026126 "LDA
# <$8E; ASLA; ASLA", 02612B "LEAX A,X", 02612D "LDD ,X++; CMPD <$C5", 026132 "BGT $613A" (02613A "LDD ,X; STD <$CA"),
# else 026134 "INC <$8E", 026137 "LEAX #$02,X", 02613A (for that frame CA gets the next record's limit). kref 02612D
# reads the records 0-2 (limits 0320, 0420, 1000; the scroll stops at 0500, 0260B3), 02613A their offsets. The next 5
# records (027A67-027A7A, limits 0400-0800) have the same shape and nothing reaches them; then the stage records
# (027A7B, read by 02625A / 02633E). The piece 027A5B (521 bytes) holds all of it
struct layer_offset_step 04 rom
field layer_offset_step 00 until u16
field layer_offset_step 02 offset_y u16
027A5B  table  stage_3_part_2_layer_offsets[8]  layer_offset_step
# what 02613A "LDD ,X" reads: past the step's limit (02612D "LDD ,X++"), its offset; or, the limit passed (026137
# "LEAX #$02,X"), the next step's limit, which CA takes for that frame
elements layer_step_word u16
# after them, up to the next table: the stages' records stage_slots point at (lists of 4-byte entries the stage's step
# walks through direct page A4: 026257 "LDX <$A4; LDU #$02,X", 0262BE "LEAX #$04,X; STX <$A4") and what their entries
# lead to (read by 02625A, 02629D-0262B1, 0262EC, 02633E, 0263AB, 0264B1); no struct describes them yet
027A7B  table  stage_records[489]  u8

# ---- the krusty balloon (object type 05, kind 9D) ----
# its kind and animation by number (026969: 02696B "LDU #$7CB6", 02696E "ASLA", 02696F "LDD A,U", 026971 "ORB #$80",
# 026973 "STD #$04,X"): kinds 9D, 9C and 04 (hit sparks)
027CB6  table  krusty_balloon_animations[13]  u16
# its hit boxes (026978: 02697A "LDU #$7CD0; ASLA; ASLA; ASLA", 026980 "LEAU A,U", 026982 "LDD ,U++; STA #$1C,X; STB
# #$1D,X" ... 026996 "STD #$23,X"); called with 0-5 (026CB0 "LDA #$05"); spans the 24 pieces 027CD0 ...
# 027CFE
027CD0  table  krusty_balloon_hit_boxes[6]  hit_box
# the health one gauge piece stands for (026523 "LDU #$7CB2; LDA <$57; DECA; LDA A,U", 02652C "LDB #$01", 02652E "LBSR
# $86BF"; its health at the start A0, 02665F)
027CB2  table  krusty_balloon_gauge_piece_health_by_players[4]  u8
# beaten at or below: landing (0265D6 "LDU #$7CAE; LDA <$57; DECA; LDB #$1B,X; CMPB A,U; LBLS $6B55": 026B55 clears 1B,
# state FD) and hit (026B9B "LDU #$7CAE" ... 026BA5 "CMPB A,U", 026BA7 "BLS $6BF1": knocked down)
027CAE  table  krusty_balloon_beaten_health_by_players[4]  u8
# its speed toward its target (026741 "LDA #$2D,X", 026744 "LDY #$7D18; LDB <$61; LSRB; LDB B,Y", 02674D "LBSR $8617")
027D18  table  krusty_balloon_speeds_by_rank[16]  u8
# hit: 026BBB "INC #$30,X", 026BBE "LDU #$7D00", 026BC1 "LDA <$57; DECA", 026BC5 "LDA A,U", 026BC7 "CMPA #$30,X",
# 026BCA "BLS $6BDF": below the count it only flinches (state FF); at it (or with a hit of kind 13) it reacts
027D00  table  krusty_balloon_hit_limits_by_players[4]  u8
# reacting (026BDF "CLR #$30,X"): 026BE2 "LDY #$7D08", 026BE5 "LDA <$61; LSRA; LDA A,Y", 026BEB "CMPA <$58", 026BEE
# "LBCC $6C7C": it flies off (026C7C: state 3, x, z and y speeds 0600), else it is knocked away (026BF1: state FE)
027D08  table  krusty_balloon_fly_off_chances_by_rank[16]  u8
# over its target (026C1C, from 026964): it lets out an object of type 04 (026C29) and attacks (state 2): 026C55
# "LDU #$7D04", 026C58 "LDA <$57; DECA", 026C5C "LDA A,U", 026C5E "CMPA <$58", 026C61 "BHI $6C74": below this chance at
# once; else, unless it lost 0C or more health since the last time (026C63-026C6B), after 20 frames (026C6D)
027D04  table  krusty_balloon_quick_attack_chances_by_players[4]  u8
# what it throws (0269E0: an object of type 31 or 10, its animation 8, hit box 2, y speed 0280; 026A45 / 026A4D its x
# speed +-0280, 026A55 plus a random one): its z speed, 026A61 "LDY #$7D28", 026A64 "LDB <$58; ANDB #$07; ASLB",
# 026A6A "LDD B,Y", 026A6C "LDB <$58", 026A6F "NEGD", 026A70 "STD #$14,U": minus (the entry's high byte, 0-3, with a
# random low byte). The piece's last 2 bytes (027D38, 6D A8) nothing reads as this table
027D28  table  krusty_balloon_throw_z_speeds[8]  u16

# ======== already named, unchanged ========
# 02600C stage_slots: read by field already (unk_48A4 = stage_slots[n].record); its record (a list of 4-byte
# entries the stage step walks through direct page A4: 026257 "LDX <$A4; LDU #$02,X", 0262BE "LEAX #$04,X; STX
# <$A4") has no struct yet
# 024021 game_texts_address: only its type changes (above).

# ======== banks 14, 15, 16, 17: the stages' goons, fat goons and scenery objects ========
#
# How the objects were told apart (evidence common to the entries below):
# - An object's type is its field 01; the dispatcher of list 0 (07CB6C "LDU #$F387; LDD #$01,X; LDB A,U; STB <$0E;
#   SETLN <$0E", 07CB7E "LDU #$F2EC; ASLA; JSR [A,U]") and those of lists 1-3 (07CBAD/07CBBF F4B0/F40D, 07CBE0/07CBF2
#   F54C/F4F4, 07CC0F/07CC21 F581/F577) pick the bank and the handler; "list N type T" below is that. The scenes a type
#   is put in come from the stages' spawn lists (spawn_lists by <$67: scene 0 stage 1, 1 stage 2, 3/4 stage 3
#   forest/cemetery, 5 stage 4, 6 stage 5, 8 stage 6, 9 stage 7, 11 stage 8; E88D[step]) with the list in the spawn's
#   flags bits 2-3 (07CA50 "ANDB #$0C; LSRB; LSRB").
# - Kinds (field 04, the sprite set, tools/extract_assets.py SET_NAMES) come from the object setups the handlers load
#   (07D132: "LDD ,U; ORB #$80; STD #$04,X"): 0785F9 -> 07D416 "LDU #$F1A8" (setup 8001: goon), bank 14's 7E5D (8401:
#   goon_with_hat), 7E6F (8201: goon_with_umbrella), 7E81 (8301: goon_with_shovel), bank 15's 764C/77C6 (8101/8100:
#   fat_goon). Kinds SET_NAMES leaves as kind_XX are named kind_XX here too.
# - Object fields used as evidence (checked in the listing): 0C x (and 0E its fraction), 0F x speed, 11 y, 14 y speed,
#   16 z (height: 07D16E's gravity "SUBD #$0060" from 19 brings it down to the floor in 5C), 19 z speed (the mover
#   0799A7-079A2A adds 0F to 0C-0E, 14 to 11-13, 19 to 16-18); 09 sprite attributes (bit 6 facing, 07D249; bits 4-5 the
#   priority 078638 returns with the floor); 3B/3C countdowns; 3E a word the handlers compare the object's x with
#   (028982 "LDD #$0C,X; CMPD #$3E,X") or a direction and speed (028672 "LDD #$3E,X; LBSR $8617": 07CC8E speeds from
#   A = direction, B = speed); 5C-5D the floor height (078638 -> 079495: the floor map cell at the object, low nibble x8
#   into 5D, bits 4-5 the priority, bit 7 no floor); 1874 the players present (07D301 skips the nearest-player search
#   when it is 0); 1884 set by the police car when it stops (02B489 "STA $1884").
# - An enemy's action is its field 28: 07D62C "LDD #$28,X; LDU #$F586" (fixed) and 07D64C "LDU #$F620" (bank) /
#   07D65E "LDU #$F5A2" (handler) dispatch it; enemy_behaviour's ranges name the action by the x distance to the
#   player (field 2D, 07D35B), e.g. goon_with_shovel's (029DE7): 01-23 action 33, 26-3A action 14, 3C-64 action 15.

# ---- bank 14: the goons' entrances (list 0 types) ----

# type 26 (list 0; scenes 1, 5, 9): a goon (0283FF -> 02840B "LBSR $85F9") that comes from the back of the stage: its x
# by field 30 (028437 "LDU #$7A72", 02843A "LDA #$30,X; ASLA", 02843E "LDD A,U", 028440 "STD #$0C,X"), its y 0050
# (028443-028446) moving down 1 a frame (028449 "LDD #$0100; STD #$14,X") until 078638 finds floor under it (028456)
# and it waits 40 frames (02846D-02846F). kref --rom-reads: 02843E reads entries 0-2
029A72  table  goon_from_back_xs[4]  u16

# a goon's entrance pose: the frames it waits (into 3C) and its sprite attributes (into 09), by field 30, shared by
# type 1B (028692: 0286A7 "LDU #$7B16", 0286AE "LDD A,U", 0286B0 "STA #$3C,X", 0286B3 "STB #$09,X"; it then counts 3C
# down 0286DF, moves 0080/FF80 and turns into goon_with_shovel, 0286FD "LDA #$83; STA #$04,X"), type 16 (028733 "LBSR
# $85F9" goon) and type 3C (028722 "LBSR $6FC1" goon_with_hat), both 028740-02874C, then 028796 "DEC #$3C,X" before
# animation B1. kref --rom-reads: 028747 reads entries 0-3, 8, 9; 0286AE entry 11
struct goon_entrance 02 rom
field goon_entrance 00 wait u8
field goon_entrance 01 attributes u8
029B16  table  goon_entrances[13]  goon_entrance

# type 1E (list 0, put in by other objects): a goon (028A12 "LBSR $85F9") set on the floor (028A16 "LBSR $8638" into
# 5C), that waits until the scroll brings its x under this (028A2B "LDU #$7BC8", 028A32 "LDD A,U", 028A34 "STD
# #$3E,X"; step 0 is 02897F "LDD #$0C,X; CMPD #$3E,X; BCC") and then drops with gravity (0289F5 "LBSR $85B1")
029BC8  table  goon_drop_xs[2]  u16

# type 08 (list 0; scenes 3, 6, 9): goon_with_umbrella (028A62 "LBSR $7012": setup 7E6F, 8201) with animation A1, its x
# by field 30 (028A74 "LDU #$7BE0", 028A7B "LDD A,U", 028A7D "STD #$0C,X"), which floats down: 028AC5 "LDD #$19,X;
# SUBD #$0010" (a sixth of 07D16E's gravity, 0060) until it lands (028ACE "LBSR $8662", animation A2). kref: entries 0-3
# read
029BE0  table  umbrella_goon_xs[4]  u16

# type ED (list 0; scene 4 only, stage 3's cemetery): goon_with_umbrella too (02956B "LDU #$7FC3; LDA #$30,X; ASLA",
# 029572 "LDD A,U", 029574 "STD #$0C,X", 029577 "LBSR $7012", animation A1). 5 entries, A0 to 0120 by 20 (field 30 is
# 00-03, 81, 82 in the spawn list: indexes 0-3; kref --rom-reads: 029572 reads 029FC5-029FCA). COUNT 5, not the
# piece's 30: the rest of the piece, 029FCD-029FFE (50 bytes), is the assembler's leftovers, equal byte for byte to
# banks 10, 11, 12, 15 and 16 at the same offsets (1FCD-1FFE), and only fill (029FFF) follows to the bank's end
029FC3  table  cemetery_umbrella_goon_xs[30]  u16

# types F3 and EE (list 0; scene 4, the cemetery): a goon that jumps in from a side: 02940A "LDU #$7F9B; LDA #$30,X;
# ASLA", 029411 "LDD A,U", 029413 "STD #$0C,X" (0040 or 0180), then 02943D "LDD #$0200; STD #$0F,X" (negated from
# 00E0 on, 029443-02944B) and z speed <$E2 (029454), landing at 029464. kref: 029411 reads both
029F9B  table  goon_jump_in_xs[2]  u16

# type F1 (list 0; scene 4, the cemetery): a goon that comes up from below the floor: 0294B9 "LDU #$7FAF", 0294C0 "LDD
# A,U", 0294C2 "STD #$0C,X", 0294C8 "LDD #$FF80; STD #$16,X" (z under the floor), z speed <$E2 (0294F4) until z is
# back over 0 (029507), then a jump (02951B "LDD #$0400; STD #$19,X")
029FAF  table  goon_from_below_xs[2]  u16

# type 2B (list 0; scene 1): a goon that comes down (028216 "LBSR $85F9") under a child object it carries (028219
# "LDY #$79EC; LBSR $862C": child type 0D of list 1, 028197: setup 79D6, the goon set's animation 36, kept 3C over
# it), falling at FE00 (028257) for 68 frames (028235, 02827C), after which the child flies up (028281 "LDU #$40,X;
# LDA #$02; STA #$02,U" -> 0281EB/0281F5, gone over F0) and the goon falls to the floor (028294 "LBSR $85B1"). Its x
# and x speed by field 30: 02823A "LDU #$79F4", 028240 "ASLA; ASLA; LEAU A,U", 028244 "LDD ,U; STD #$0C,X", 028249
# "LDD #$02,U; STD #$0F,X". kref: records 0, 1, 3-6 read.
struct descent_start 04 rom
field descent_start 00 x u16
field descent_start 02 x_speed s16
0299F4  table  goon_descent_starts[8]  descent_start

# type 06 (list 0; scene 5): goon_with_hat (02849C "LBSR $6FC1"), animation B7, by field 30 (0284A4 "LDU #$7A86",
# 0284A7-0284AC "ASLA; ASLA; LEAU A,U"): the x the scroll brings it under before it moves (0284AE "LDD ,U", 0284B0
# "STD #$3E,X"; 0284FE "LDD #$0C,X; CMPD #$3E,X; BCC"), its attributes (0284B3 "LDA #$02,U; STA #$09,X") and flags
# (0284BE "ORA #$03,U; STA #$3D,X"; 0284D4: bit 7 shows it at once, "LDB #$80; STB #$00,X"; bit 0 clear sets hit box
# 79BE and animation A2, 0284DE "LSRA; BCS"). kref: records 0-2.
struct waiting_hat_goon_start 04 rom
field waiting_hat_goon_start 00 trigger_x u16
field waiting_hat_goon_start 02 attributes u8
field waiting_hat_goon_start 03 flags u8
029A86  table  waiting_hat_goon_starts[3]  waiting_hat_goon_start

# type 15 (list 0, put in by other objects): a goon (02854D "LDU #$7AA8; LBSR $85AB": setup 8002) that shows when the
# scroll brings it under its x, waits, walks up diagonally to the floor and waits again. By field 30 (02855D "LDU
# #$7AAE", 028563-028565 "ASLA; ASLA; LEAU A,U"): flags (028567 "LDA ,U; ANDA #$30" into 09's priority; 028579 "LDD
# ,U; ANDA #$80; STA #$3A,X": bit 7 walks direction E0 rather than 20, 0285CF-0285DC), the x/16 (028580 "CLRA; ASLDI
# #$04; STD #$3E,X"; faces left from 0100, 028586; 0285B3 "CMPD #$3E,X"), the wait before it walks (02859A "LDD
# #$02,U; STA #$3C,X", 0285C4 "DEC #$3C,X") and the one on the floor (0285A0 "STB #$3B,X", 028613 "DEC #$3B,X").
struct goon_walk_in_start 04 rom
field goon_walk_in_start 00 flags u8
field goon_walk_in_start 01 trigger_x u8
field goon_walk_in_start 02 wait u8
field goon_walk_in_start 03 floor_wait u8
029AAE  table  goon_walk_in_starts[4]  goon_walk_in_start

# an entrance on a timer, shared by bank 14's type 1D (028633 "LBSR $85F9", goon) and bank 15's type 2C (02A64F "LBSR
# $6133", fat_goon): hidden (028648 "LDA #$08; STA #$00,X") for a wait (028657 "LDD ,U; STA #$3C,X"; 028672 "DEC
# #$3C,X"), then shown and moving by a direction and a speed (02865F "LDD #$02,U; STD #$3E,X", 02867C "LDD #$3E,X;
# LBSR $8617": 07CC8E takes A the direction, B the speed) to the floor (0285E3), where it waits again (02865C "STB
# #$3B,X", 028613). Bank 15: 02A669 "LDU #$78C0"... 02A67B, the same. kref: 028657 reads records 1, 2; 02A673 record
# 0.
struct delayed_start 04 rom
field delayed_start 00 wait u8
field delayed_start 01 floor_wait u8
field delayed_start 02 direction u8
field delayed_start 03 speed u8
029AD2  table  delayed_goon_starts[4]  delayed_start
02B8C0  table  delayed_fat_goon_starts[4]  delayed_start

# types 3F and F4 (list 0; 3F in scenes 1, 5, 9): a goon (028836 "LBSR $85F9"; F4 028825 "LBSR $6144") that walks in
# to the right (028877 "LDD #$0100; STD #$0F,X", animation 81) onto the floor (02890B) and waits there (028925 "DEC
# #$3B,X"). By field 30 (028841 "LDU #$7B68", 028847 "ASLA; LEAU A,U"): its attributes (02884A "LDA #$09,X; ANDA #$8F;
# ORA ,U") and that wait (028854 "LDB #$01,U; STB #$3B,X").
struct goon_side_entry 02 rom
field goon_side_entry 00 attributes u8
field goon_side_entry 01 floor_wait u8
029B68  table  goon_side_entries[2]  goon_side_entry

# type 17 (list 0; scene 5, field 30 0-3): a goon hidden (028898 "LDA #$04; STA #$00,X") until the scroll brings it
# under its x (0288E4 "LDD #$0C,X; CMPD #$3E,X; BCC"), then running in (0288FC "LDD #$0200; STD #$0F,X", animation 82)
# onto the floor (02890B) where it waits (028925 "DEC #$3B,X"). By field 30 (0288AB "LDU #$7B7E", 0288B1 "ASLA; LEAU
# A,U"): the x/16 (0288B5 "LDB ,U; ASLDI #$04; STD #$3E,X") and the wait (0288BC "LDA #$01,U; STA #$3B,X"). kref: all
# 4 read.
struct goon_run_in_start 02 rom
field goon_run_in_start 00 trigger_x u8
field goon_run_in_start 01 floor_wait u8
029B7E  table  goon_run_in_starts[4]  goon_run_in_start

# type 18 (list 0; scene 5): goon_with_hat (02893D "LBSR $6FC1") that waits for the scroll (02897F "CMPD #$3E,X"),
# then for 3C (02898B), then jumps in (0289A7 "LDD #$0900; STD #$19,X", 0289BC "LDD #$FE00; STD #$14,X"). By field 30
# (02895A "LDU #$7B98", 028960-028962): the x (028964 "LDD ,U; STD #$3E,X") and the wait (028969 "LDD #$02,U; STA
# #$3C,X"; byte 3 goes into B and nothing takes it). kref: records 0-2.
struct hat_goon_jump_in_start 04 rom
field hat_goon_jump_in_start 00 trigger_x u16
field hat_goon_jump_in_start 02 wait u8
field hat_goon_jump_in_start 03 unused u8
029B98  table  hat_goon_jump_in_starts[6]  hat_goon_jump_in_start

# ---- bank 14: the goons' actions (enemy actions 00, 04, 05, 0F, 15, 33 in bank 14: F620/F5A2) ----

# action 00 (028003 -> 028C61 "LDU #$7C70"), in the goons' and goon_with_hat's close ranges (029D37: "04 01 1F 9A 00 00
# 00 02"): with the target player (field 38) on the floor, animation 86 and this wait by the players in the game
# (028C77 "LDU #$7C7A", 028C7A "LDA <$57", 028C7D "LDA A,U", 028C7F "STA #$3B,X"), then animation A4 (028C93) and the
# hit box 7BEE (028CAB). Entries 1-4 (04 02 01 01); kref reads 1-3
029C7A  table  goon_strike_waits_by_players[5]  u8

# action 04 (02800F -> 028D34 "LDU #$7C99") and 05 (028012 -> 7CC3), step 0 028D43: a jump attack (animation A6,
# 028D7E A7 with "LDD #$0400; STD #$19,X") when this entry by the game's rank is at least the random byte (028D43 "LDU
# #$7CA3", 028D46 "LDA <$61", 028D49 "LDA A,U", 028D4B "CMPA <$58", 028D4E "BCC $6D73"), else a short run (028D50
# animation 90, "LDD #$0180; STD #$0F,X"). 00 up to rank 03, FF from rank 11 (hex). kref reads ranks 04-1B
029CA3  table  goon_jump_attack_chances_by_rank[32]  u8

# action 0F (028042 -> 028E05 "LDU #$7CCB"): a goon grabbing the player it touches (028E85-028E9A: the player's 4B,
# 3D, 00 and 1E) shows the animation holding that player's character, by the held player's field 5B high nibble
# (028ED3 "LDY #$7CD3", 028ED6 "LDA #$5B,U; LSRA x4", 028EDD "LDA A,Y", "ORA #$80; STA #$05,X"), and the next one
# for the squeeze (028F1A-028F26 "LDA A,Y; INCA"). 4 entries (40 42 44 46), one a player; kref reads all 4
029CD3  table  goon_hold_animations[4]  u8

# action 33 (028033 -> 0290CC "LDU #$7EDB"), goon_with_shovel's close range (029DE7 range 01-23): animation 80 and this
# wait by the players in the game (0290E2 "LDU #$7EE5", 0290E5 "LDA <$57", 0290E8 "LDA A,U", 0290EA "STA #$3B,X"),
# then animation 92 and the hit box 7E8F (02910F). Entries 1-4
029EE5  table  shovel_goon_close_strike_waits_by_players[5]  u8

# action 15 (028093 -> 029120 "LDU #$7EEA"), goon_with_shovel's far ranges (029DE7 ranges 3C-50 and 58-64): animation
# 80 and this wait by the players in the game (02912B "LDU #$7EF4", 02912E "LDA <$57", 029131 "LDA A,U", 029133 "STA
# #$3B,X"), then animation 91 and the hit box 7E9F (02914A). Entries 1-4
029EF4  table  shovel_goon_far_strike_waits_by_players[5]  u8

# read only by unused_goon_wait_by_rank (nothing calls it): a wait by the game's rank (028AE0 "LDU #$7C2E", 028AE3 "LDA <$61",
# 028AE6 "LDA A,U", 028AE8 "STA #$3B,X") before animation 86; 10, 0C, 08, 04 eight ranks each
029C2E  table  unused_goon_waits_by_rank[32]  u8

# ---- bank 15: the fat goons (setups 764C 8101 and 77C6 8100: fat_goon) ----

# type 36 (list 0): the fat goon's entrance poses, as goon_entrances (02A334 "LBSR $6093", 02A341 "LDU #$784A", 02A348
# "LDD A,U", 02A34A "STA #$3C,X", 02A34D "STB #$09,X"; 02A376 "DEC #$3C,X"). The same first 12 entries as
# goon_entrances. kref: 02A348 reads entries 0, 1, 8
02B84A  table  fat_goon_entrances[12]  goon_entrance

# type 2D (list 0; scenes 1, 5): the fat goon from the back of the stage, as goon_from_back_xs (02A45D "LDU #$7890",
# 02A469 "LDD A,U", 02A46B "STD #$0C,X", 02A46E "LDD #$0040; STD #$11,X", 02A474 "LDD #$0100; STD #$14,X")
02B890  table  fat_goon_from_back_xs[4]  u16

# type EF (list 0; scene 4): the fat goon jumping in from a side, as goon_jump_in_xs (02ABCC "LDU #$79A5", 02ABD3 "LDD
# A,U", 02ABD5 "STD #$0C,X", 02ABF7 "LDD #$0200; STD #$0F,X")
02B9A5  table  fat_goon_jump_in_xs[2]  u16

# type F0 (list 0; scene 4): the fat goon coming up from below, as goon_from_below_xs (02AC7C "LDU #$79B9", 02AC83 "LDD
# A,U", 02AC85 "STD #$0C,X", 02AC8B "LDD #$FF80; STD #$16,X"; 02ACC9 waits for z over 0)
02B9B9  table  fat_goon_from_below_xs[2]  u16

# type 35 (list 0; scene 1): the fat goon coming down from far (02A6E7 "LDD #$00E0; STD #$16,X", zoom 1010 growing to
# 4040, 02A702/02A72A) under the same carried child as goon_descent_starts (02A6B1 "LDY #$78E6; LBSR $862C", released
# at 02A745 "LDA #$02; STA #$02,U"): x and x speed by field 30 (02A6D2 "LDU #$78EE", 02A6D8-02A6DA, 02A6DC "LDD ,U;
# STD #$0C,X", 02A6ED "LDD #$02,U; STD #$0F,X"). kref: record 0.
02B8EE  table  fat_goon_descent_starts[2]  descent_start

# type 13 (list 0): a fat goon (02A205 "LBSR $6093", animation B3) that falls 60 frames at FF00 (02A225), then takes
# by field 30 (02A23C "LDU #$7822", 02A242-02A244): the step of its handler it goes on with (02A246 "LDD ,U; STA
# #$29,X": 2 walks up-left, 4 walks right then falls again), the floor height it walks to (02A24B "STB #$3D,X; STB
# #$5D,X"; 02A273 "CMPA #$3D,X" against 078638's height x8) and a wait after which it turns to priority 10 (02A251
# "LDA #$02,U; STA #$3C,X", 02A283 "DEC #$3C,X"). Byte 3 nothing reads. kref: both records.
struct fat_goon_drop_route 04 rom
field fat_goon_drop_route 00 next_step u8
field fat_goon_drop_route 01 floor u8
field fat_goon_drop_route 02 wait u8
field fat_goon_drop_route 03 unused u8
02B822  table  fat_goon_drop_routes[2]  fat_goon_drop_route

# actions 09 (02A009 -> 02A881) and 0B (02A00F -> 02A9AA), in fat_goon's behaviours (02B5E8: "08 01 1F 9A 0B 29 0C 0B",
# "04 20 28 4D 0C 0C 09 0C"): with the target on the floor, animation AA and this wait by the players in the game
# (02A8CF / 02A9C0 "LDU #$7974", "LDA <$57", 02A8D5 / 02A9C6 "LDA A,U", "STA #$3B,X"), then the strike (A4 / AB and
# hit boxes 7914 / 7924). Entries 1-4
02B974  table  fat_goon_strike_waits_by_players[5]  u8

# the fat goon's grab (02AA94, as goon_hold_animations): the animation holding each player's character (02AB20 "LDY
# #$7995", 02AB23 "LDA #$5B,U; LSRA x4", 02AB2A "LDA A,Y; ORA #$80; STA #$05,X"): 34-37
02B995  table  fat_goon_hold_animations[4]  u8

# bank 15's object that puts in others (its tables, enemy_waves_end_enemies and enemy_waves_next_wave_enemies), but the
# lists object_15_spawn_lists points at are not records of the stages' `spawn` (assets/data/spawns.txt writes them
# so): 02ADB8-02AE1E reads byte 0 against the object's clock (02ADC9 "LDA #$0000,Y; CMPA #$28,X", FF ends), byte 1
# x8 the x (02ADF9 "LDB #$0001,Y; ASLDI #$03; STD #$0C,U"), byte 2 x8 plus <$B2 the y (02AE03-02AE0C), byte 3 the z
# (02AE10 "LDB #$0003,Y; STD #$16,U; STD #$5C,U"), byte 4 the fewest players present (02ADD9 "LDA #$0004,Y; CMPA $1874;
# LBCC"), byte 5 the flags whose bits 2-3 are the object list (02ADE4 "LDB #$0005,Y; LBSR $86AA" -> 07CA50), bytes 6
# and 7 its field 30 and type (02ADEE "LDD #$0006,Y; STA #$30,U; STB #$01,U"). STRUCT fix: type its entries
struct timed_spawn 08 rom
field timed_spawn 00 time u8
field timed_spawn 01 x u8
field timed_spawn 02 y u8
field timed_spawn 03 z u8
field timed_spawn 04 players u8
field timed_spawn 05 flags u8
field timed_spawn 06 state u8
field timed_spawn 07 type u8
02B9FE  table  object_15_spawn_lists[13]  u16 timed_spawn

# ---- bank 15: the stages' scenery objects ----

# list 1 type FD (scene 1 only, stage 2 Krustyland): doors (02AF36 "LDU #$7DBC; LBSR $85AB": setup 0F25, kind 0F
# police_car_and_doors, animation 25) that open once the camera is at 04E0 (02AF6E) and, by the players present, let
# out objects of list 0 type 07 (02EF03; 02EF0F "LDU #$7E27", setup 9800: kind 98): by field 30 (02AF46 "LDU #$7DC2",
# 02AF49-02AF4E): a wait (02AF50 "LDD ,U; STA #$3B,X"; 02AF7A "DEC #$3B,X"), an x/16 into 3E (02AF55 "CLRA; ASLDI
# #$04; STD #$3E,X", which nothing of this object compares) and its list of releases (02AF5B "LDY #$02,U; STY
# #$2A,X"), the address of the child object it lets out just before the list (02AF61 "LDD #$-02,Y; STD #$38,X"). Each
# release (02AF98 "LDY #$2A,X; LDD ,Y; BMI" ends): put the child in when more players are present than its byte 0
# (02AFA8 "CMPA <$57; BCC", 02AFAD "LDY #$38,X; LBSR $862C"), then wait its byte 1 (02AF9F "STB #$3B,X"). kref:
# records 0-2.
struct door_release 02 rom
field door_release 00 players u8
field door_release 01 wait u8
struct krustyland_door 04 rom
field krustyland_door 00 wait u8
field krustyland_door 01 trigger_x u8
field krustyland_door 02 releases u16 door_release
02BDC2  table  krustyland_doors[3]  krustyland_door
# the rest of the piece 02BDC2 (COUNT of 02BDC2 is 3, not its 59 bytes): the three release lists, each
# after its child object's address (02BDCE 7DE5 then 00 10 03 20 FF; 02BDD5 7DED then 01 40 0F 40 02 20 FF; 02BDDE
# 7DF5 then 00 80 0F E0 FF; kref: 02AF61 reads 02BDCE, 02BDD5, 02BDDE), and the three child objects (02BDE5, 02BDED,
# 02BDF5: 07CA8A's 8-byte records, y offset 0002, list 0, field 30 01, 02, 03, type 07)
02BDCE  table  krustyland_door_releases[47]  u8

# list 1 type 3D (scenes 1, 5, 6, 8): a prop standing in the stage (02B0AF "LDU #$7E1D; LBSR $85AB", setup 0500) with
# its kind and animation by field 30 (02B0BA "LDU #$7E23", 02B0C0-02B0C2, 02B0C4 "LDD ,U; STD #$04,X": AB/AC/AA/12/
# 11/A2/D7 and their animations), its attributes (02B0C9 "LDD #$02,U; STA #$09,X") and the x/16 it goes away under
# (02B0CF "CLRA; ASLDI #$04; STD #$3E,X"; 02B0D9 "LDD #$0C,X; CMPD #$3E,X; BCC; CLR #$00,X"). kref: records 2-4, 7-11.
struct prop 04 rom
field prop 00 kind u8
field prop 01 animation u8
field prop 02 attributes u8
field prop 03 leave_x u8
02BE23  table  props[12]  prop

# list 2 type 27: kind D1 (02B1A4 "LDU #$7E83; LBSR $85AB", setup D107) flung off: by field 30's low 2 bits (02B1BA
# "LDU #$7E89", 02B1BD-02B1C4 "ANDA #$03; ASLA; ASLA; LEAU A,U") its x speed (02B1C6 "LDD ,U; STD #$0F,X") and z speed
# (02B1CB "LDD #$02,U; STD #$19,X"), shrinking (02B1DF "SUBD #$0101" from 6060) for 40 frames, then gone with sound
# 2000 (02B1F2-02B1F8). kref: records 1-3.
struct dream_ball_fling 04 rom
field dream_ball_fling 00 x_speed s16
field dream_ball_fling 02 z_speed s16
02BE89  table  dream_ball_flings[4]  dream_ball_fling

# list 1 type F0 (scene 4 only, the cemetery): kind C6 pieces (02B211 "LDU #$7ED1; LBSR $85AB", setup C600) at x 009A
# (02B217) with a z and an animation by field 30 (02B21D "LDU #$7EA5", 02B223-02B225, 02B227 "LDD ,U; STD #$16,X",
# 02B22C "LDA #$02,U; STA #$05,X"), moving up and down with <$E2 (02B23A "LDD <$E2; STD #$19,X") and gone out of
# -80..A0 (02B202-02B20D). Byte 3 nothing reads. kref: records 0-5 (02BEA5-02BEBB). The piece the layout gives these
# bytes, 02BEA1 (48 bytes), starts with the step table 7EA1 (02B1FC "LDU #$7EA1; ASLB; JSR [B,U]": 7211, 723A) and
# holds no hit box.
struct cemetery_piece 04 rom
field cemetery_piece 00 z s16
field cemetery_piece 02 animation u8
field cemetery_piece 03 unused u8
02BEA5  table  cemetery_pieces[11]  cemetery_piece

# list 0 type E9 (scene 0, stage 1, field 30 0 and 1): kinds C3 and C4 (02B44E "LDU #$7F63; LBSR $85AB", setup C301)
# coming in from the right: by field 30 (02B459 "LDU #$7F69", 02B45C-02B461) the x speed (02B463 "LDD ,U; STD
# #$0F,X"), the frames it moves (02B468 "LDD #$02,U; STA #$3B,X"; 02B47F "DEC #$3B,X") and its kind (02B46E "STB
# #$04,X"); when they run out it stops and sets 1884 (02B484-02B489 "LDA #$C0; STA #$00,X; STA $1884"), which the
# police car's doors (02C442, kind 0F) and the bystanders (02E673) wait for: named the police car by that.
struct police_car_arrival 04 rom
field police_car_arrival 00 x_speed s16
field police_car_arrival 02 frames u8
field police_car_arrival 03 kind u8
02BF69  table  police_car_arrivals[2]  police_car_arrival

# ---- bank 16 ----

# list 1 type 1A (scene 0, stage 1): the police car's doors (02C3FF "LDU #$7C28; LBSR $85AB": setup 0F14, kind 0F
# police_car_and_doors): by field 30 (02C414 "LDU #$7C2E", 02C417-02C41C): the fewest players present for the door
# (02C41E "LDA ,U; CMPA $1874; BHI" skips it), an x/16 into 3E (02C427 "LDB #$01,U; ASLDI #$04; STD #$3E,X", which
# these steps do not compare), a wait after the car stops (02C42F "LDD #$02,U; STA #$3B,X"; 02C442 "LDA $1884", 02C44C
# "DEC #$3B,X", animation 95) and its release list's number (02C435 "STB #$30,X"). kref: records 0-2.
struct police_car_door 04 rom
field police_car_door 00 players u8
field police_car_door 01 trigger_x u8
field police_car_door 02 wait u8
field police_car_door 03 releases u8
02DC2E  table  police_car_doors[4]  police_car_door
# what a door lets out, by its release number (02C45C "LDU #$7C3E", 02C45F "LDA #$30,X; ASLA", 02C463 "LDY A,U"): a
# list of the fewest players present (02C465 "LDA ,Y+; CMPA #$7F; BEQ", 02C46B "CMPA $1874; BCC") each followed by the
# child object it puts in (02C471 "LBSR $862C", 02C474 "LEAY #$08,Y"; 07CA8A-07CAE5: x and y offsets, z, the list
# flags, field 30, the type), up to 7F. COUNT 4, not the piece's 25: the lists follow (police_car_door_releases)
struct car_door_release 09 rom
field car_door_release 00 players u8
field car_door_release 01 dx s16
field car_door_release 03 dy s16
field car_door_release 05 dz u8
field car_door_release 06 flags u8
field car_door_release 07 state u8
field car_door_release 08 type u8
02DC3E  table  police_car_door_lists[4]  u16 car_door_release
# the three lists 02DC46, 02DC50, 02DC5A (kref: 02C465 reads 02DC46-02DC6C, 07CA8A-07CAD2 their children): goons of
# list 0 type 16 (bank 14's 028727, field 30 80), the last with a second one (field 30 01) for more than 3 players.
# 02DC6D-02DC6F, the end of the
# piece 02DC3E, are not these: they are the step table 7C71's entries -2 and -1 (02C48A "LDU #$7C71;
# ASLB; JSR [B,U]" with field 02 FE/FF, 02C4AA "LDD #$FF00; STA #$02,X"; kref: 02C48E reads 02DC6D-02DC7E)
02DC46  table  police_car_door_releases[39]  u8

# list 1 type DF (scene 4 only, the cemetery): kind 05 obstacles (02C0C9 "LDU #$7BA8; LBSR $85AB", setup 0506): x by
# field 30 (02C0FF "LDU #$7B58", 02C102-02C105, 02C106 "LDD A,U", 02C108 "STD #$0C,X"), raising the floor under them
# by 2 once in view (02C10F "CMPD #$0160", 02C117 "LDA #$02; LBSR $6C4A")
02DB58  table  cemetery_obstacle_xs[8]  u16
# whether each obstacle (by field 30) drops food when broken, in a row of 8 by the sum of the players' scores' last
# BCD byte (02C0DD "LDU #$7B68", 02C0E0-02C0EC "LDA $49D5; ADDA $49DD; ADDA $49E5; ADDA $49ED", 02C0F0 "ANDA #$07;
# ASLA x3; LEAU A,U", 02C0F7 "LDA #$30,X; LDA A,U; STA #$44,X"; 49D4+8n is the score 0796FD adds to with DAA): broken
# (02C078), 44 non-zero turns it into kind 09 food jumping out (02C095 "LDD #$0800; STD #$19,X; LDA #$09; STA #$04,X"),
# 0 makes it vanish (02C08C). FF drops, 00 not
02DB68  table  cemetery_obstacle_food[64]  u8

# kind 05 obstacles (02CB7D "LDU #$7DCD; LBSR $85AB", setup 0502) with the animation of field 30 (02CB94 "ORA #$80;
# STA #$05,X"): the height, in floor steps of 8, the obstacle raises the floor map under it by, by its animation / 2
# (02CB88 "LDU #$7DB1", 02CB8B "LDA #$30,X; LSRA", 02CB8F "LDA A,U", 02CB91 "STA #$47,X"; 02CBC3 "LDA #$47,X; LBSR
# $6C4A": 02CC4A stores it in 188B and adds it to the low nibble, the floor height 078638 reads, of the 3 cells under
# the object, 02CCA1-02CCB5)
02DDB1  table  obstacle_heights[28]  u8

# list 1 type 1F (scene 5): kind 10 (02C2DF "LDU #$7BEC", setup 1001) that comes down (02C350 "LDD
# #$FF80; STD #$19,X" for 40 frames) and then rewrites the floor map over 32 columns of 6 cells from its place
# (02C37E: 02C393 "LDU #$2A,X" = 07948C's floor-map address, 02C3B1-02C3D4 the six cells 40 apart). Which column gets
# the edge cells: by the count of columns left, 32 (20 hex) down to 1 (02C38E "LDA #$20; STA <$F4", 02C39F "LDU #$7BF2",
# 02C3A2 "LDA <$F4", 02C3A5 "LDA
# A,U", 02C3A7 "BNE": non-zero 02C3AE "LDY #$7C12", else 02C3A9 "LDY #$7C18"). Entries 1-32 are read (kref: 02C3A5
# reads 02DBF3-02DC12): entry 0 nothing reads, entry 32 is the first byte of the edge cells (FF)
02DBF2  table  moes_street_scenery_floor_edge_flags[32]  u8
# the 6 cells of a floor-map column (top to bottom, 02C3B8 "LDA ,Y; STA #$00,U" ... 02C3D4 "LDA #$05,Y; STA
# #$0140,U"): FF no floor (bit 7: 078638's "no floor"), 00 floor at height 0
struct floor_column 06 rom
field floor_column 00 row_0 u8
field floor_column 01 row_1 u8
field floor_column 02 row_2 u8
field floor_column 03 row_3 u8
field floor_column 04 row_4 u8
field floor_column 05 row_5 u8
02DC12  table  moes_street_scenery_edge_floor_cells[1]  floor_column
02DC18  table  moes_street_scenery_floor_cells[1]  floor_column
# 02C37E reads through Y one of the two columns, by the two paths it takes

# the four players' objects in the work RAM (4A40, 4B00, 4BC0, 4C80; 4A40 + C0 each, as 07D30C's search "LDU #$4A40",
# "LEAU #$00C0,U"): 02CA45 picks one at random that is in play (02CA47 "LDA <$16", 02CA4A "LDU #$7D83", 02CA4D "ANDA
# #$03; ASLA", 02CA50 "LDU A,U", 02CA52 "LDA #$00,U; BNE"; tries the next up to 4 times)
02DD83  table  player_objects[4]  u16

# list 1 type 2C (scene 6, stage 5's gorge): the boulder (02CE6F "LDU #$7DEF; LBSR $85AB", setup AF03: boulder) by
# field 30 (02CE7F "LDU #$7DF5", 02CE82-02CE8A): whether it bounces back into the distance after landing (02CE8C "LDD
# ,U; STA #$30,X"; 02CF18 "LDA #$30,X; BEQ": else "LDD #$FD00; STD #$14,X; LDD #$0400; STD #$19,X", 02CF65 shrinking
# to 2020), the floor height it lands on (02CE91 "STB #$5D,X") and a wait before it falls (02CE94 "LDA #$02,U; STA
# #$3B,X"; 02CEB3). Byte 3 nothing reads. kref: records 0-3.
struct boulder_drop 04 rom
field boulder_drop 00 bounces u8
field boulder_drop 01 floor u8
field boulder_drop 02 wait u8
field boulder_drop 03 unused u8
02DDF5  table  boulder_drops[4]  boulder_drop

# bank 16's object (object_16_flags, object_16_kinds, object_16_patterns as symbols.txt has them; object_16_flags
# stays). Its first record (02D1D1 "LDU #$7E3F", 02D1D4-02D1D6 "ASLA; ASLA; LEAU
# A,U", 02D1D8 "LDD ,U"), is a record of the existing object_16_kinds[6] pattern_start: nothing to add. The second
# (02D1EC "LDU #$7E95", 02D1EF-02D1F4 by field 30, 02D1F6 "LDD ,U; STA #$50,X; STB #$51,X", 02D1FE "LDD #$02,U; STA
# #$52,X; STB #$53,X"): the four animations it plays one after the other, each when the last ends (02D27B "LDA #$50,X;
# STA #$05,X" with sound 4800, 02D28B #$51, 02D2A9 #$52, 02D2B9 #$53, each after "LDA #$06,X; LSRA; BCC"): A7-AA for
# the kind 0F ones, 93-96 for the kind 12 ones. kref: records 1, 2, 4, 5.
struct object_16_animation_run 04 rom
field object_16_animation_run 00 first u8
field object_16_animation_run 01 second u8
field object_16_animation_run 02 third u8
field object_16_animation_run 03 fourth u8
02DE95  table  object_16_animation_runs[6]  object_16_animation_run

# animals that run across (02D437 "LDU #$7F0B; LBSR $85AB", setup 8600: dog): by field 30 (02D43D "LDU #$7EF9",
# 02D440-02D445): their kind (02D447 "LDD ,U; STD #$2C,X; STA #$04,X": 86 dog, 89 squirrel, C5 dog_2) and the
# animation it starts again with (2D: 02D4F9 "LDA #$2D,X; STA #$05,X", 02D51E "INCA"), their attributes (02D44F "LDD
# #$02,U; STA #$09,X") and whether they run quiet (02D452 "STB #$44,X"; 02D503 "LDA #$44,X; BNE" skips sound 5F00).
# kref: records 0-2.
struct running_animal 04 rom
field running_animal 00 kind u8
field running_animal 01 animation u8
field running_animal 02 attributes u8
field running_animal 03 quiet u8
02DEF9  table  running_animals[3]  running_animal
# and by the same field 30 (02D458 "LDU #$7F05", 02D45B "LDA #$30,X; ASLA", 02D45F "LDD A,U"): the frames it stops
# for (02D461 "STA #$50,X"; 02D499 "LDA #$50,X; STA #$3B,X") and whether it runs at full speed (02D464 "STB #$51,X";
# 02D50E "LDA #$51,X; BNE", else "ASRW #$0F,X" halves it). kref: all 3
struct running_animal_timing 02 rom
field running_animal_timing 00 wait u8
field running_animal_timing 01 fast u8
02DF05  table  running_animal_timings[3]  running_animal_timing

# list 1 type F2 (scene 8 only, stage 6 Dreamland): kind 05 obstacles (02D5E2 "LDU #$7F41; LBSR $85AB", setup 0500)
# hidden (02D5E8 "LDA #$04; STA #$00,X") until a wait runs out, then thrown in (02D623: sound 0301, "LDD #$0300; STD
# #$0F,X; LDD #$FF00; STD #$19,X"), landing with gravity (02D643) and staying as solid ones (02D674 hit box 7A98). By
# field 30 (02D5F5 "LDU #$7F47", 02D5F8-02D5FD): animation (02D5FF "LDD ,U; STA #$05,X; STA #$32,X"), wait (02D60A
# "STB #$3B,X") and x (02D60D "LDD #$02,U; STD #$0C,X"). kref: records 0-7.
struct obstacle_drop 04 rom
field obstacle_drop 00 animation u8
field obstacle_drop 01 wait u8
field obstacle_drop 02 x u16
02DF47  table  dreamland_obstacle_drops[8]  obstacle_drop

# list 1 type 16 (scene 0 field 30 0; scene 5 field 30 1): kind 0F animation 17 (02D728 "LDU #$7FA5", setup 0F17), or
# for field 30 non-zero kind 10 animation 07 (02D746 "LDD #$1007; STD #$04,X"), that waits for the camera to reach
# this x (02D75E "LDU #$7FA1", 02D761 "LDA #$30,X; ASLA", 02D765 "LDD A,U", 02D767 "STD #$3E,X"; 02D76E "LDD <$AC;
# CMPD #$3E,X; BCS") and then rises out (02D781 "LDD #$0200; STD #$19,X") for 40 frames holding the scroll (02D790
# "DEC <$A7"). kref: 02D765 reads 02DFA1-02DFA4. Its 2 entries are the last 2 bytes of the piece 02DF9B (the setup
# 02DFA5 points its hit box at 7F9B, which is the step table 02D71F "LDU #$7F9B" uses: 7728, 776E, 7790, then this
# table's 03D0) and the piece 02DFA3 (0430) (a data label, no table: its first word is the last of the hit box piece
# at 02DF9B)
02DFA1  data  rising_scenery_camera_xs

# ---- bank 17 ----

# list 1 type 25 (scene 0, stage 1, field 30 0-3): kind 0F scenery (02E07B "LDU #$7A0C; LBSR $85AB", setup 0F00) set
# at x 01A0 (02E086) moving left by field 30 (02E08C "LDU #$7A12", 02E08F-02E094, 02E096 "LDD ,U; STD #$0F,X") with an
# animation and attributes (02E09B "LDD #$02,U; ORA #$80; STA #$05,X; STB #$09,X"), its x kept in 0000-01FF so it
# comes round again (02E0AA "LDA #$0C,X; ANDA #$01; STA #$0C,X") until the camera passes 06B0 (02E0B9). Animations
# 18-1D. kref: records 0-4, 7.
struct looping_scenery_move 04 rom
field looping_scenery_move 00 x_speed s16
field looping_scenery_move 02 animation u8
field looping_scenery_move 03 attributes u8
02FA12  table  looping_scenery_moves[10]  looping_scenery_move

# list 1 type FC (scenes 3, 5, 9): an object lying in the stage until something takes it (steps 7A68: 61FA, 6209
# twice, 620A "CLR #$00,X"), set up by field 30 (02E1FA "LDU #$7A70", 02E1FD "LDA #$30,X; ASLA", 02E201 "LDU A,U",
# 02E203 "LBSR $85AB"): the setups 7A76, 7A7C, 7A82 (kinds 06, 07 hammer, 08: the kinds the item carriers put down,
# carried_item_kinds)
02FA70  table  item_setups[3]  u16

# list 1 type 30 (scene 0 field 30 0, scene 1 field 30 1): kind A5 (02E39E "LDU #$7AFA", setup A500) walking in from
# the right (02E3E2 "LDD #$FF00; STD #$0F,X"), which puts in a second one when more than 2 players are present
# (02E3BC "LDA #$30,X; BMI", 02E3C1 "LDB $1874; CMPB #$02; BLS", 02E3C9 "ANDA #$03", 02E3CB "LDY #$7B00", 02E3CF "LDY
# A,Y", 02E3D1 "LBSR $862C": the child objects 7B08-7B20, type 30 of list 1 with field 30 80-83) and later drops food
# (02E406: 02E412 "LDY #$7B28", 02E419 "LDY A,Y", 02E41B "LBSR $862C": the child objects 7B30-7B48, type 12 of list 2
# with field 30 00, 02, 04, 06 = 02E367 "LDU #$7ADE" kind 09 food with that animation). Both point at 07CA8A's 8-byte
# child objects
02FB00  table  girl_with_food_partners[4]  u16
02FB28  table  girl_with_food_food_drops[4]  u16

# food (kind 09) jumping out: by field 30's low 2 bits (02E217 "LDU #$7A96; LBSR $85AB" setup 0900; 02E222 "LDU
# #$7A9C", 02E225-02E22A, 02E22B "LDU A,U"): its animation and the hit kind it gives what touches it (02E22D "LDD ,U;
# ORA #$80; STA #$05,X; STB #$1D,X"; 07C344 "LDA #$1D,U; STA #$1E,X"), the gravity taken from its z speed each frame
# (02E237 "LDD #$02,U; STD #$3E,X"; 02E279 "LDD #$19,X; SUBD #$3E,X"), its x speed (02E23D "LDD #$04,U; STD #$0F,X")
# and z speed (02E24C "LDD #$06,U; STD #$19,X")
struct food_move 08 rom
field food_move 00 animation u8
field food_move 01 hit_kind u8
field food_move 02 gravity u16
field food_move 04 x_speed s16
field food_move 06 z_speed s16
02FA9C  table  food_move_choices[4]  u16 food_move
02FAA4  table  food_moves[4]  food_move
# food's hit kind by its animation / 2 (02E2F7 "LDU #$7ACE", 02E2FA "LDA #$30,X; ANDA #$7F; LSRA", 02E300 "LDA A,U",
# 02E302 "STA #$1D,X"; the collision 07C344 copies 1D into what it touches' 1E): FA for 0-6 and 9, 00 for the rest
02FACE  table  food_hit_kinds[16]  u8

# list 1 type F9 (scenes 1, 6): item carriers, kinds A8, A7, A6 by field 30 (02E533 "LDU #$7B7A", 02E536 "LDA #$30,X;
# ASLA", 02E53A "LDU A,U", 02E53C "LBSR $85AB": setups A801, A701, A601), walking in from the right for 40 frames
# (02E542-02E54A) and putting down what they carry (02E564 "LDY #$7B92", 02E56B "LDY A,Y", 02E56D "LBSR $862C": child
# objects 7B98-7BA8, type 1A of list 2 with field 30 0-2) before leaving (02E583 "LDD #$FE80; STD #$0F,X")
02FB7A  table  item_carrier_setups[3]  u16
02FB92  table  item_carrier_items[3]  u16
# the kind of what a carrier puts down (list 2 type 1A, 02E5D3: setup 7B80, then 02E5DE "LDU #$7BB8", 02E5E1 "LDA
# #$30,X", 02E5E4 "LDA A,U", 02E5E6 "STA #$04,X"): 06, 07 (hammer), 08
02FBB8  table  carried_item_kinds[3]  u8

# list 1 type 29 (scene 0, stage 1): bystanders (02E635 "LDU #$7BD9; LBSR $85AB", setup A803) by field 30 (02E640 "LDU
# #$7BCB", 02E643-02E648): their kind (02E64A "LDD ,U; STA #$04,X": A8, B5), facing and x/16 (02E64F "TSTB; BPL", "LDA
# #$40; STA #$09,X", 02E657 "ANDB #$7F", 02E659 "ASLDI #$04; STD #$3E,X") and their three animations (02E65F "LDY
# #$02,U; STY #$2A,X"): waiting (02E665 "LDA ,Y; STA #$05,X"), when the police car stops (02E673 "LDA $1884", 02E679
# "LDU #$2A,X; LDA #$01,U") and running off (02E686: 02E68C "LDD #$FE00; STD #$0F,X", 02E695 "LDA #$02,U"). kref: both
# records and both animation sets. The piece 02FBC3 (16 bytes) the layout gives 02FBC3-02FBD2 holds the step table
# 7BC3 (02E62C "LDU #$7BC3": 6635, 6673, 6686, 66A1) and these 2 records, no hit box.
struct bystander_animation_set 03 rom
field bystander_animation_set 00 waiting u8
field bystander_animation_set 01 startled u8
field bystander_animation_set 02 fleeing u8
struct bystander 04 rom
field bystander 00 kind u8
field bystander 01 place u8
field bystander 02 animations u16 bystander_animation_set
02FBCB  table  bystanders[2]  bystander
02FBD3  table  bystander_animation_sets[2]  bystander_animation_set
# the same pointer where the later steps read it back from field 2A

# list 0 type 02 (scene 0, stage 1, field 30 0-2): kind 90, an enemy (02E6AE "LDU #$7C53; LBSR $85AB", setup 9000;
# 02E6DE "LDU #$7BEF; STU #$2A,X" its behaviour) hidden until the camera is at 03D0 (02E725), then after a wait
# walking out (02E744 "DEC #$3B,X", "LDD #$E040; LBSR $8617"). By field 30 (02E6E9 "LDU #$7C59", 02E6EC-02E6F1): an x
# into 3E that sets its facing (02E6F3 "LDD ,U; STD #$3E,X; CMPD #$0100"), the wait (02E70C "LDD #$02,U; STA #$3B,X")
# and a count its throwing action takes down (02E712 "STB #$3C,X"; 02E7A0 "DEC #$3C,X; LDA #$3C,X; BITA #$03", the
# throw 02E7C1 "LDY #$7C73; LBSR $862F"). kref: records 0-2.
struct fireman_goon_start 04 rom
field fireman_goon_start 00 x u16
field fireman_goon_start 02 wait u8
field fireman_goon_start 03 throws u8
02FC59  table  fireman_goon_starts[3]  fireman_goon_start

# list 1 type 32 (scene 9, stage 7): kind B3 (02E834 "LDU #$7C99", setup B300) that takes 6 hits (02E844 "LDA #$06;
# STA #$3C,X"): on each (02E84D "LDA #$00,X; BITA #$20") 3C goes down and the animation is this entry by the hits left
# (02E864 "LDU #$7C9F", 02E867 "LDA #$3C,X", 02E86A "LDA A,U", 02E86C "STA #$05,X"); at 0 animation 83 (02E859).
# Entries 1-6 (82 82 82 82 81 81), entry 0 the 83 the last hit shows anyway
02FC9F  table  kent_brockman_damage_animations[7]  u8

# list 1 type 0F (scene 1, Krustyland): an unseen kind 04 object (02E8D8 "LDU #$7DBF", setup 0402; "LDA #$04; STA
# #$00,X") that puts in 3 objects round it (02E90F-02E942: 02E918 "LDY #$7DA7; LBSR $862F", angles 55 apart in their
# 3E) whose children count themselves out of its field 31 (02EB39 "LDU #$2A,X; DEC #$31,U"). Each frame it sets 3D
# when that count is over this entry by the players present (02E8BB "LDU #$7DA2", 02E8BE "LDA $1874", 02E8C2 "LDA
# A,U", 02E8C4 "CMPA #$31,X; BCC", 02E8C9 "INC #$3D,X"). Entries 1-4 (02 03 04 05). Evidence thin: named by the use
02FDA2  table  krustyland_child_limits_by_players[5]  u8

# kind 88 (02EC09 "LDU #$7E01; LBSR $85AB", setup 8800; list 0 type 1A, 02E036 -> 02EB0D): its colour by its health
# (02EB67 "LDU #$7DFF", 02EB6A "LDA #$1B,X; CMPA #$07; BCC": 0 under 7, else 1; 02EB76 "LDB #$09,X; ANDB #$30; ORB
# A,U; STB #$09,X"; field 1B the life 07C274 takes hits from): 8E when weak, 00 else.: U holds the table (02EB67 "LDU
# #$7DFF"), A the entry
02FDFF  table  teacup_goon_attributes_by_health[2]  u8
elements teacup_goon_attributes u8

# enemy action 20 (02E042 -> 02F1D8 "LDU #$7E83"), clown_on_ball's far range (behaviour 02FD3E: "08 40 48 1A 20 20 20
# 20"): animation 86 or 87 (02F1DE-02F1EF, by <$58's bit 0) held for this wait by the game's rank / 8 (02F1F2 "LDU
# #$7E87", 02F1F5 "LDA <$61; LSRA; LSRA; LSRA", 02F1FB "LDA A,U", 02F1FD "STA #$3B,X"; 02F204 "DEC #$3B,X; LBEQ $8635")
02FE87  table  clown_on_ball_pause_waits_by_rank[4]  u8

# a quarter wave of cosines, 80 = 1 at angle 0 down to 00 at 3F (02F257: 02F261 "LDU #$7E8F", 02F264 "LDA A,U; MUL"
# with A the angle's low 6 bits and B the radius, then 02F26A "LDA #$3F; SUBA <$EF", 02F26F "LDA A,U" for the sine;
# bits 6-7 of the angle swap and negate them). 02EA64 and 02ECBB call it to put an object round its parent (field 38)
# at the angle in 3E: "LDD #$0C,U; ADDD <$E8; SUBD #$0C,X"
02FE8F  table  orbit_cosines[64]  u8

# list 1 type 3C (scene 1): kind B2 (02F33E "LDU #$7F35; LBSR $85AB", setup B201) switching between these two
# animations every 128 frames (02F381-02F3A0: "DEC #$3B,X; BITA #$7F", 02F390 "LDU #$7F3B", "INC #$3D,X; ANDA #$01",
# then "LDA A,U; STA #$05,X"), 85 when hit (02F375)
02FF3B  table  caged_gorilla_idle_animations[2]  u8

# clown_on_ball (02F08C "LDU #$7E65; LBSR $85AB", setup 9610; 02F09A "LDU #$7D3E; STU #$2A,X" its behaviour): put in
# with field 30's bit 7 it stands in a pose by field 30 (02F0A5 "LDU #$7E6B", 02F0AB "BPL", 02F0AD "ASLA; LEAU A,U",
# 02F0B0 "LDA ,U; STA #$05,X", 02F0B5-02F0BD "LDA #$09,X; ANDA #$CF; ORA #$01,U; STA #$09,X") until x is under 00E0
# (02F0D8). No scenario reads them.
struct clown_pose 02 rom
field clown_pose 00 animation u8
field clown_pose 01 attributes u8
02FE6B  table  clown_on_ball_poses[4]  clown_pose

# list 1 type 1C (scene 0 field 30 80): kind A0 (02F507 "LDU #$7F65; LBSR $85AB", setup A002). With field 30 under 80
# it comes in by field 30 (02F549 "LDU #$7F6B", 02F54C-02F552 "ASLA x3; LEAU A,U"): z speed (02F554 "LDD ,U; STD
# #$19,X"), x speed (02F559 "LDD #$02,U; STD #$0F,X"), x (02F55F "LDD #$04,U; STD #$0C,X") and the frames it moves
# (02F565 "LDA #$06,U; STA #$3B,X"; 02F573 "DEC #$3B,X"); byte 7 nothing reads. No scenario reads them.
struct bluebird_entry 08 rom
field bluebird_entry 00 z_speed s16
field bluebird_entry 02 x_speed s16
field bluebird_entry 04 x u16
field bluebird_entry 06 frames u8
field bluebird_entry 07 unused u8
02FF6B  table  bluebird_entries[4]  bluebird_entry
# with field 30 81-83 (02F521 "ANDA #$7F; DECA") it waits hidden until its parent's x is under 0160 (02F657 "LDU
# #$40,X; LDD #$0C,U; CMPD #$0160"), then is launched by field 30 (02F667 "LDU #$7F8B", 02F66A-02F670): x, y and z
# speeds (02F672 "LDD ,U; STD #$0F,X", 02F677 "LDD #$02,U; STD #$14,X", 02F67D "LDD #$04,U; STD #$19,X") and the
# parent's x it then waits for (02F683 "LDD #$06,U; STD #$3E,X"; 02F72B "LDD #$0C,U; CMPD #$3E,X"). kref: records 0-2.
struct bluebird_launch 08 rom
field bluebird_launch 00 x_speed s16
field bluebird_launch 02 y_speed s16
field bluebird_launch 04 z_speed s16
field bluebird_launch 06 parent_x u16
02FF8B  table  bluebird_launches[3]  bluebird_launch

# list 1 type 15 (scene 0, field 30 0): a figure (02F75C "LDU #$7FA7; LBSR $85AB", setup 8600) by field 30 (02F767
# "LDU #$7FAD", 02F76A-02F76F): its kind (02F771 "LDD ,U; STA #$04,X": 0F, 95, 01 homer), attributes (02F776 "STB
# #$09,X") and its 4 poses (02F779 "LDD #$02,U; STD #$2A,X"), one shown at random (02F78C "LDU #$2A,X", 02F78F "LDA
# <$58; ADDA #$0D,X; ANDA #$03", 02F797 "LDA A,U; ORA #$80; STA #$05,X"). kref: record 0, its poses 02FFB9-02FFBC.
struct random_pose_figure 04 rom
field random_pose_figure 00 kind u8
field random_pose_figure 01 attributes u8
field random_pose_figure 02 poses u16
02FFAD  table  random_pose_figures[3]  random_pose_figure
# the three figures' 4 poses each (26 x4; 00 01 06 08; 17 1F 2F 3B). The rest of the piece 02FFAD,
# 02FFC5-02FFC8 (77B5, 77AB), is the step table 7FC9's entries -2 and -1 (02F79F "LDU #$7FC9; ASLB; JSR [B,U]")
02FFB9  table  random_figure_poses[12]  u8

# ======== banks 18, 19, 1A, 1B, 1C ========
# How the objects of these banks were told apart: the object lists' dispatchers (07CB6C "LDU #$F387" / 07CB7E "LDU
# #$F2EC" for 4F80, 07CBAD/07CBBF F4B0/F40D for 5280, 07CBE0/07CBF2 F54C/F4F4 for 4D40) give each type (field 01) a
# bank and a handler, and the enemies' actions (field 28) go through 07D64C "LDU #$F620" / 07D65E "LDU #$F5A2" the
# same way. Bank 18: 4F80 types 10, 11, 14, 21, 22, 23, 24, 2F, 31, F2, F5; 5280 types 18, 19, 1D, 20, 22; actions 19,
# 1A, 1D, 21, 22, 26, 2C, 31, 35, 3C. Bank 19: 4F80 types 30, 32, 33, 3D, FC, FD; 5280 types 33, 39, 3A, DE, F3, F5, F6,
# FB; 4D40 17, 19; actions 23-25, 28, 2A, 2B, 2D-30, 32, 37, 39-3B. Bank 1A: 4F80 F7, F8, FE, FF; 5280 E3, EA, FE, FF;
# 4D40 20, FE, FF. Bank 1B: 5280 types 0B, 0C, 12, 2A, 38. Bank 1C: the players (038003: the objects 4A40, 4B00, 4BC0,
# 4C80 with their records 49D0-49E8, the inputs from direct page 40-4E).
# Who each object is: its kind (field 04, the sprite set) from its setup (07D132 "LDD ,U; ORB #$80; STD #$04,X"), named
# as tools/extract_assets.py's SET_NAMES names the set (lumberjack 8D, gorilla 9F, knight BC-C1, robot 8F, hit_sparks
# 04); a set SET_NAMES does not name is called kind_XX, as extract_assets names its sheet. Its stage from the spawn
# lists (spawn_lists by scene, E88D: scene 0 stage 1, 1 stage 2, 3/4 stage 3, 5 stage 4, 6 stage 5, 8 stage 6, 9 stage
# 7, 11 stage 8). Object fields used below, checked in the listing: 05 animation, 06 bit 0 animation ended (079B90), 07
# the animation's frame (079B3B "INC #$07,X", 079B6D), 09 flags (bit 6 faces left), 0A/0B zoom, 0C x, 11 y, 16 height,
# 0F/14/19 the x, y and height speeds (07D16E "SUBD #$0060" on 19: gravity; 07CCDD sets 14 and 0F from a direction),
# 1F/20/21 the hit box's sizes and 22/23/24 its offsets (07C13A-07C1D7), 1B vitality, 30 the state a spawn gives it
# (07C9FE "LDA #$05,X; STA #$30,U"), 3B a countdown.

# ---- shared shapes ----
# a child object, the record 07862C/07CA8A puts in at an offset from the object in X (by Y): its x offset, negated
# when X faces left (07CAB1-07CAC6), its y and height offsets (07CAD2 "ADDD #$11,X", 07CADC "LDB #$04,Y; ADDD
# #$16,X"), the object list (07CA8A "LDB #$05,Y; LBSR $CA54"), its state and type (07CA92 "LDD #$06,Y; STA #$30,U;
# STB #$01,U").
struct child_object 08 rom
field child_object 00 dx s16
field child_object 02 dy s16
field child_object 04 dz u8
field child_object 05 list u8
field child_object 06 state u8
field child_object 07 type u8
# an x speed and a y speed (fields 0F and 14), read as a pair (0311C2 "LDD ,U; STD #$0F,X", 0311C7 "LDD #$02,U; STD
# #$14,X"; 039894 "LDD ,Y++; STD #$0F,U")
struct velocity 04 rom
field velocity 00 x_speed s16
field velocity 02 y_speed s16
# a height of a bobbing wave, read by a pointer the code points at one of two tables (031184/0335E1: "LDB B,U; SEX")
elements bob_height s8

# ======== bank 18 ========

# ---- type 23, kind 97 (born from bank 16's object: 02D2F9 "LDY #$7EC1" / 02D2FF "LDY #$7EC9", children of type 23 in
# state 0 or 1) ----
# by its state: 030081 "LDU #$7988; LDA #$30,X; ASLA; ASLA; LEAU A,U", 030096 "LDD ,U; STA #$3C,X; STB #$3B,X",
# 03009E "LDD #$02,U; STA #$3E,X; STB #$30,X ... STB #$05,X". 0300B0 counts 3C down, then it shows (00 80); when that
# animation ends 0300DD "LDA #$3E,X; LBSR $866B" sets its speeds from the direction in 3E (07CCDD); 0300F0 counts 3B
# down and stops it (CLRW 0F, 14); its animation is 30, then 30+1, then 30+2. Records: wait 20, 40 or 80 frames, the
# directions 00/40/80/C0 (animation 00) or 8 directions 20 apart (animation 03)
struct timed_move 04 rom
field timed_move 00 delay u8
field timed_move 01 travel u8
field timed_move 02 direction u8
field timed_move 03 animation u8
031988  table  kind_97_timed_moves[16]  timed_move

# ---- type 10, kind 91: object_18_behaviours stays; its read through U ----
# 030137 "LDU #$79DA; LDA #$30,X; ASLA; ASLA", 03013F "LEAU A,U", 030141 "LDD ,U" (state, flags), 030154 "LDD #$02,U;
# STD #$2A,X" (the behaviour)

# ---- type 11, kind 9A (stage 1 and stage 3's forest): it drops on a player from above ----
# by its state (0 or 1 in the spawn lists): 03047F "LDU #$7A30; LDA #$30,X; ASLA; ASLA; LEAU A,U", 030489 "LDD ,U; STD
# #$3E,X", 03048E "LDD #$02,U; STA #$3D,X; STB #$30,X". 3E is added to its x when it drops and then negated (0304E2
# "LDD #$2A,X; SUBD <$AC; ADDD #$3E,X; STD #$0C,X", 0304EE "NEGW #$3E,X"); none of its routines (7A1A: 645F-654E, and
# 8620/8626/85C9 they call) reads 3D; 30: 0 waits for a player within 40 in x and z (0304BB-0304D6, then 19 = FE00:
# it falls), 1 waits for its x to come below 0100 and goes to step FE (0304A4-0304B3: 030432)
struct drop_start 04 rom
field drop_start 00 x_offset s16
field drop_start 02 unused u8
field drop_start 03 mode u8
031A30  table  ghost_on_rope_drop_starts[2]  drop_start

# ---- 5280 type 18, kind 91 ----
# by its state: 030577 "LDU #$7A56; LDA #$30,X; ASLA; ASLA; LEAU A,U", 030581 "LDD ,U; STA #$3B,X; STB #$09,X",
# 030589 "LDD #$02,U; STA #$02,X" (B dropped: byte 3, 00 in all, nothing reads). 3B: the frames before it pops in
# (030590 "DEC #$3B,X", then 00 80, animation 92, sound 7B); 02: the step of 7A38 it starts at (01 or 0A, both 6590)
struct appearance 04 rom
field appearance 00 wait u8
field appearance 01 flags u8
field appearance 02 step u8
field appearance 03 unused u8
031A56  table  kind_91_appearances[7]  appearance

# ---- type 14, kind 97 (stage 3's forest; its behaviour 7A88: 030684 "LDU #$7A88; STU #$2A,X") ----
# its way in, by its state 1-4 (state 0 skips it: 03068F "LDA #$30,X; BEQ" to 03069D, entry 0 unread): 0306B4 "LDU
# #$7AF8; LDA #$30,X; ASLA; LDD A,U; STA #$3B,X; CLRA; ASLDI #$04; STD #$0C,X": it shows animation 90 at x = the low
# byte x 16 for the frames of the high byte (0306CF "DEC #$3B,X"), then animation 91 and sound 48
struct timed_spot 02 rom
field timed_spot 00 wait u8
field timed_spot 01 x u8
031AF8  table  kind_97_entrances[5]  timed_spot
# action 31 (bank 18's 66F5; only kind 97's behaviour 031A88 lists it): it takes hold of a player (030721-0307A8:
# within 8 in x and 4 in z it sets the player's 4B to itself, 3D to 0C, 00 |= 20, 1E to 3), and shows the animation by
# the held player's field 5B >> 4: 0307AB "LDY #$7B0A; LDA #$5B,U; LSRA x4; LDA A,Y; ORA #$80; STA #$05,X" (5B's
# high bits hold a character, field 04 x 16: 039216-03921A in bank 1C; 4 entries, one a character)
031B0A  table  kind_97_hold_animations[4]  u8

# ---- type 2F, the lumberjack (setup 7BF2: 8D00; behaviour 7B36) ----
# action 22 (bank 18's 68EA; only the lumberjack's behaviour 031B36 lists it): after its swings (hit boxes 7B16/7B0E,
# sound 6A) it shows animation 86 again and again: 03094D "LDU #$7C0C; LDA <$57; LDA A,U; STA #$3C,X", 03095C each
# time the animation ends "DEC #$3C,X", at 0 the action ends (8635). By the players in the game (1-4: 4, 2, 1, 1;
# entry 0 unread)
031C0C  table  lumberjack_pause_loops_by_players[5]  u8

# ---- type 31, the gorilla (setup 7C1D: 9F00; behaviour 7B8E) ----
# its way in, by its state (1-4 in the spawn lists): 0309BB "LDU #$7C3B; LDA #$30,X; ASLA; ASLA", 0309C3 "LEAU A,U",
# 0309C5 "LDD ,U; STA #$09,X; CLRA; ASLDI #$04; STD #$3E,X" (flags; the x it walks to, x 16: 0309E6 "CMPD #$3E,X"),
# 0309D0 "LDA #$02,U" (the step of 7C23 it starts at; bit 7 also hides it: 0309D5-0309D9 "LDB #$04; STB #$00,X"),
# 0309DF "LDA #$03,U; STA #$05,X" (its animation)
struct gorilla_entrance 04 rom
field gorilla_entrance 00 flags u8
field gorilla_entrance 01 x u8
field gorilla_entrance 02 step u8
field gorilla_entrance 03 animation u8
031C3B  table  gorilla_entrances[5]  gorilla_entrance
# action 2C (bank 18's 6AE7; only the gorilla's behaviour 031B8E lists it): a leap, x speed 0200 and the height speed
# by the stage's difficulty: 030AFD "LDU #$7C5D; LDA <$6B; ASLA; LDD A,U; STD #$19,X" (03E0 up to 0500), pulled down
# 30 a frame (030B1D)
031C5D  table  gorilla_leap_speeds[7]  u16

# ---- type F5, the knight (stage 6; setup 7CF1: BC00, behaviour 7C7F) ----
# its way in, by its state 80-8F (030C26 "LDU #$7CF7; LDA #$30,X; BPL"; 030C33 "LDA #$30,X; ASLA; ASLA", 030C38
# "LEAU A,U": the shift drops bit 7), 030C3A "LDD ,U; STA #$3B,X; STB #$04,X" (a wait; the kind it comes in as: BC,
# BE, C0), 030C42 "LDD #$02,U; STA #$50,X; CLRA; ASLDI #$04; STD #$0C,X" (the kind it fights as, put in 04 when the
# entrance's animation ends: 030BE7 "LDA #$50,X; STA #$04,X"; its x, x 16). A state 00-7F reads only byte 2 (030C52-
# 030C59 "LEAU A,U; LDA #$02,U; STA #$50,X")
struct knight_entrance 04 rom
field knight_entrance 00 wait u8
field knight_entrance 01 entrance_kind u8
field knight_entrance 02 kind u8
field knight_entrance 03 x u8
031CF7  table  knight_entrances[16]  knight_entrance
# by the same state, how it comes in: 030C6E "LDU #$7D51; LDA #$30,X; ASLA; LEAU A,U; LDD ,U; STA #$29,X; CLRA; STD
# #$3E,X": the step of its table 7D37 (01: it jumps in from the front, zoom 8080 shrinking to 4040, 030C84-030CF6; 04:
# it walks in from the right, 030D0E; 07: as 01 at another speed, 030D4E; 0A: it jumps in at x speed 0400, slowed each
# frame by 3E: 030DCD "LDD #$0F,X; SUBD #$3E,X")
struct knight_entrance_style 02 rom
field knight_entrance_style 00 step u8
field knight_entrance_style 01 slowdown u8
031D51  table  knight_entrance_styles[16]  knight_entrance_style

# ---- type F2, kind C7 (stage 6): it flies around a player and shoots ----
# by its state, at 030E8F: 030E9A "LDU #$7DA1; LDA #$30,X; LDB A,U; STB #$3D,X", 030EA5 "LDU #$7DA8; LDB A,U; STB
# #$2E,X", 030EAD "LDU #$7DAF; LDB A,U; STB #$3A,X", 030EB5 "LDU #$7DB6; LDA #$30,X; ASLA; LDD A,U; STD #$0C,X". Its
# heading (2E, of 16; a word, the low byte its fraction) sweeps between 4 and C (031092-031102): 3A added each frame
# ("CLRA; LDB #$3A,X; ADDD #$2E,X"), 3D the way it goes now (FF back, 00 on; "COM #$3D,X" at the ends). kref
# --rom-reads: 030EA0 reads 031DA1-031DA6 and 030EBC 031DB6-031DC1 (states 0-5); the spawn lists give F2 states 0-7,
# and 6-7 would read past each table (into the next one; for the x, into the setup at 7DC2)
031DA1  table  kind_c7_sweep_ways[7]  u8
031DA8  table  kind_c7_headings[7]  u8
031DAF  table  kind_c7_sweep_rates[7]  u8
031DB6  table  kind_c7_start_x[6]  u16
# when hit (030FBF: 00 88, sound 63, animation 85, 1E frames) its height shakes: 03107A "LDU #$7DD8; CLRA; LDB
# #$3B,X; ANDB #$03; LDB B,U; ADDD #$50,X; SUBD #$16,X; TFR B,A" (only the low byte is kept: FA acts as -6)
031DD8  table  kind_c7_hurt_shakes[4]  u8
# its bobbing: the height speed that brings it to 0040 plus a wave, by its counter 37: 031165 "LDU #$7DDC; CLRA; LDB
# #$37,X; LDB B,U; ADDD #$0040" (37 kept to 0-1F), and 031184 "LDB #$37,X; BITB #$E0; BNE" -> "LDU #$7DFC" while 37 is
# below 20, else "LDU #$7DDC"; "ANDB #$1F; LDB B,U; SEX; ADDD #$0040". 7DDC rises 00-20 and back, 7DFC falls 00 to E0
# and back (kref --rom-reads: 031195 reads 031DDC-031E1B)
031DDC  table  kind_c7_bob_up[32]  u8
031DFC  table  kind_c7_bob_down[32]  s8
# the frames before its next shot, one of 4 at random: 0311CE "LBSR $8623; ANDA #$03; LDU #$7E1C; LDA A,U; STA
# #$3B,X"; 030F57 counts 3B down, then 030F87 "LDY #$6FAE; LBSR $862C" (a child of type 28)
031E1C  table  kind_c7_shot_waits[4]  u8
# its x and y speeds by its heading: 0311AC "LDA #$02,X; CMPA #$02; BNE": "LDU #$7E20" while it circles (step 2,
# 030F3D), else "LDU #$7E60"; 0311BB "LDA #$2E,X; ASLA; ASLA", 0311C0 "LEAU A,U", 0311C2 "LDD ,U; STD #$0F,X", 0311C7
# "LDD #$02,U; STD #$14,X". The 7E60 ones are 3 times as fast (05FA against 01FE)
031E20  table  kind_c7_slow_velocities[16]  velocity
031E60  table  kind_c7_fast_velocities[16]  velocity

# ---- 5280 type 20, kind 8E (stages 4 and 5) ----
# by its state (0-2): 0314ED "LDU #$7F52; LDA #$30,X; ASLA", 0314F4 "LEAU A,U", 0314F6 "LDD ,U; STA #$09,X; STB
# #$05,X"
struct pose 02 rom
field pose 00 flags u8
field pose 01 animation u8
031F52  table  belly_dancer_poses[3]  pose

# ---- type 22, kind 8C (stage 4; setup 7F74: 8C00) ----
# every 128 frames the next of 4 animations, until the scroll reaches 0270: 0315B3 "LDA <$16; BITA #$7F; BNE",
# 0315BA "LDU #$7F7A; INC #$3C,X; LDA #$3C,X; ANDA #$03; LDA A,U; STA #$05,X". Only 4: 7F7E-7F81 (75ED 75ED) are the
# handlers of type 21's steps FE and FF, its table 7F82 read backwards (0315E1 "LDU #$7F82; ASLB; JSR [B,U]"; kref
# --rom-reads stage4: 0315C5 reads 031F7A-031F7D, 0315E5 reads 031F7E-031F7F)
031F7A  table  barney_animations[8]  u8

# ======== bank 19 ========

# ---- types 32, 33, 3D, kind A1 (stage 2 and stage 7; setup 7A32: A100; behaviours 7958, 7900, 79B0) ----
# its way in, by its state: 032342 "LDU #$7A72; LDA #$30,X; LDA A,U; STA #$29,X; CLR #$30,X": the step of its table
# 7A38 it starts at (01, 03, 05, 08, 0C, 11, 15, 16, 19, 1B)
033A72  table  kind_a1_entrance_steps[11]  u8
# action 37 (bank 19's 669A; its behaviours 033900 and 0339B0 list it): 0326A0 "LDA #$A7; STA #$05,X; LDU #$7AB5; LDA
# <$57; LDA A,U; STA #$3B,X", 0326B4 "DEC #$3B,X", then animation A4 and its hit box 78F8 (0326CE). By the players in
# the game (1-4: 8, 6, 3, 1; kref --rom-reads: 0326AB reads 033AB9)
033AB5  table  kind_a1_attack_delays_by_players[5]  u8

# ---- 5280 type 33: the robot's pieces (kind 8F, the robot: 032A4A "LDA #$8F; STA #$04,X") ----
# by its state (0-7): 032A4F "LDU #$7B10; LDA #$30,X; ASLA; ASLA", 032A57 "LEAU A,U", 032A59 "LDD ,U; STA #$19,X; STB
# #$3B,X" (the height speed's high byte; the frames before it shows: 032A75), 032A61 "LDA #$02,U; ORA #$80; STA
# #$05,X", 032A69 "LDA #$03,U; LDB #$20; LBSR $8617" (its direction, at speed 20: 8 directions 20 apart). Then it falls
# (40 a frame), bounces once (032A91 "LDD #$0200; STD #$19,X") and turns into sparks (kind 04, animation 80)
struct robot_piece 04 rom
field robot_piece 00 rise u8
field robot_piece 01 wait u8
field robot_piece 02 animation u8
field robot_piece 03 direction u8
033B10  table  robot_pieces[8]  robot_piece

# ---- 5280 type F6: a hit spark (setup 7BD0: 0402, kind 04 hit_sparks) ----
# how long it lasts by its state (0-3, the child objects 7C50-7CA2): 032B02 "LDU #$7BCC; LDA #$30,X; LDA A,U; STA
# #$3B,X", 032B11 "DEC #$3B,X; BNE; CLR #$00,X"
033BCC  table  hit_spark_times[4]  u8

# ---- type 30, the robot (setup 7BE2: 8F00; behaviour 7B70) ----
# the hit spark (a child of type F6, FFFF none) it puts in at each frame (field 07) of an attack's animation: action 39
# (032C8C animation 9D) 032CBD "LDY #$7C16; LDA #$07,X; ASLA; LDY A,Y; BMI; LBSR $862C"; action 23 (animation 92)
# 032CFB "LDY #$7C3C"; action 24 (animation 91) 032D39 "LDY #$7C76" (sound 23 at frames 6 and 0E). The 7C50-7C68
# sparks start at x -8, the 7C8A-7CA2 ones at +8 (kref --rom-reads: 032CC4 033C20-033C25, 032D02 033C40-033C4D, 032D40
# 033C7A-033C87)
033C16  table  robot_sparks_by_frame_9d[16]  u16 child_object
033C3C  table  robot_sparks_by_frame_92[10]  u16 child_object
033C76  table  robot_sparks_by_frame_91[10]  u16 child_object
# after it is hit (its step 4, 6D51) and that animation ends, the next action and status of a fixed round by its
# field 3D counting down: 032DC3 "LDU #$7CB8; DEC #$3D,X; LDA #$3D,X; ANDA #$07; LDB A,U; STB #$28,X" (2A, 25, 23,
# 25, 28, 25, 24, 25), 032DD6 "LDU #$7CC0; LDB A,U; STB #$00,X" (C4 or C0)
033CB8  table  robot_actions_after_hit[8]  u8
033CC0  table  robot_status_after_hit[8]  u8
# action 2A (032E33) sends off a part (032E5A "LDY #$7D10; LBRA $862F": type 17, kind 8F animation 18, 4D40 list)
# that goes away into the back (14 = FF80) and shrinks: 032EBD "LDA #$3B,X; ... LDU #$7D22; LDA #$3B,X; LDA A,U; STA
# #$0A,X; STA #$0B,X" (its zoom by the frames left, 3B from 2F down to 1: kref --rom-reads 032ED2 reads 033D23-033D51;
# entry 0 unread: at 0 it is gone, 032EB4 "DEC #$3B,X; BNE; CLR #$00,X")
033D22  table  robot_part_zooms[48]  u8

# ---- 5280 types 39 and 3A, kind 12 (stage 7): type 3A the two parts type 39 puts in (032EF7 "LDY #$7D68", 032EFD
# "LDY #$7D70": children of type 3A, states 0 and 1) ----
# 032FAA "LDU #$7D96; LDA #$30,X; ASLA; ASLA", 032FB2 "LEAU A,U", 032FB4 "LDD ,U; STA #$3D,X; STB #$3C,X", 032FBD
# "LDB #$03,U; STD #$16,X" (byte 2 unread; kref --rom-reads: 032FB4 033D96-97 and 033D9A-9B, 032FBD 033D99 and 033D9D).
# 3D: the step of its parent (field 40) at which it shows animation 82 (032FC7 "LDU #$40,X; LDA #$02,U; CMPA #$3D,X");
# 3C: the frames after that before animation 8F (032FDB "DEC #$3C,X")
struct channel_6_scenery_part 04 rom
field channel_6_scenery_part 00 parent_step u8
field channel_6_scenery_part 01 wait u8
field channel_6_scenery_part 02 unused u8
field channel_6_scenery_part 03 height u8
033D96  table  channel_6_scenery_parts[2]  channel_6_scenery_part

# ---- type FD, kind B7 (stage 6; setup 7E1A: B700, behaviour 7DB6) ----
# its way in, by its state 80-8B (033011 "LDA #$30,X; BPL": 00-7F come in at once): 033031 "LDU #$7E32; LDA #$30,X;
# ASLA; LDD A,U; STA #$3B,X; STB #$29,X": a wait and the step of its table 7E20 (01: it falls in at x E0 with zoom
# 6060, 033044; 04: it leaps in from x 0180, 0330BF; 07: it walks in from x 0180, 03311B). kref --rom-reads: 033038
# reads 033E32-033E3B and 033E40-033E49
struct timed_step 02 rom
field timed_step 00 wait u8
field timed_step 01 step u8
033E32  table  kind_b7_entrances[12]  timed_step

# ---- type FC, kind B8 (stages 6 and 7; setup 7EB7: B800): it leaps in, flies around a player and throws ----
# by its state, at 033226 (as kind C7's in bank 18): 03323A "LDU #$7E86; LDA #$30,X; LDB A,U; STB #$3D,X", 033245
# "LDU #$7E8D ... STB #$2E,X", 03324D "LDU #$7E94 ... STB #$3A,X", 033255 "LDU #$7E9B; ASLA; LDD A,U; STD #$3E,X",
# 03325E "LDU #$7EA9; LDA #$30,X; ASLA; LDD A,U; STD #$52,X". It leaps in from the front (x 00E0, x speed 0300, zoom
# 8080); while it comes down 3E slows its x speed each frame (033305 "LDD #$0F,X; SUBD #$3E,X") and 52 is its y speed
# (0332C5 "LDD #$52,X; STD #$14,X"); 3D/2E/3A sweep its heading (0334EF-03355F). kref --rom-reads: the states 0, 2, 4, 6
033E86  table  flying_saxophone_sweep_ways[7]  u8
033E8D  table  flying_saxophone_headings[7]  u8
033E94  table  flying_saxophone_sweep_rates[7]  u8
033E9B  table  flying_saxophone_descent_slowdowns[7]  u16
033EA9  table  flying_saxophone_descent_y_speeds[7]  s16
# what it throws (children of type F3): three in a row, animation 95, 7 frames apart: 0333D0 "LDY #$7EC7; LDA #$3C,X;
# ANDA #$03; ASLA; LDY A,Y; LBSR $862C" (3C from 3 down to 1: 0333D9 reads 033EC9-033ECE); one of two in turn,
# animation 90: 03340C "LDY #$7EEF; LDA #$3C,X; ANDA #$01; ASLA; LDY A,Y; LBSR $862C"
033EC7  table  flying_saxophone_volley_shots[4]  u16 child_object
033EEF  table  flying_saxophone_single_shots[2]  u16 child_object
# its height when hit shakes (0334D7 "LDU #$7F0D; CLRA; LDB #$3B,X; ANDB #$03; LDB B,U; ADDD #$50,X"), its bobbing
# (0335C2 "LDU #$7F11 ... LDB B,U; ADDD #$0040"; 0335E1 "BITB #$E0; BNE" -> "LDU #$7F31" / "LDU #$7F11", "LDB B,U;
# SEX"), its wait before throwing (03361F "LBSR $8623; ANDA #$03; LDU #$7F51; LDA A,U; STA #$3B,X"): bank 18's kind C7
# tables, the same bytes
033F0D  table  flying_saxophone_hurt_shakes[4]  u8
033F11  table  flying_saxophone_bob_up[32]  u8
033F31  table  flying_saxophone_bob_down[32]  s8
033F51  table  flying_saxophone_shot_waits[4]  u8
# its x and y speeds by its heading: 033609 "LDU #$7F55; LDA #$2E,X; ASLA; ASLA", 033611 "LEAU A,U", 033613 "LDD ,U;
# STD #$0F,X", 033618 "LDD #$02,U; STD #$14,X". 2E's high byte is kept to 0-F (033540 "ANDA #$0F"): the code reads the
# first 16 (kref --rom-reads: 033F55-033F94); the other 16 (033F95-033FD4: a round circle, the y speeds twice as big)
# nothing reads
033F55  table  flying_saxophone_velocities[32]  velocity
# what it throws (5280 type F3, setup 7FDD: B800): its animation by its state (0-3 the volley's, 4-5 the single ones:
# 03363E "LDU #$7FE3; LDA #$30,X; LDA A,U; STA #$05,X"), thrown up at 0400 with an x speed of 4 at random: 03364F "LDU
# #$7FE9; LDA <$58; ANDA #$03; ASLA; LDD A,U; STD #$0F,X" (kref --rom-reads: 033658 reads 033FE9-033FF0; entries 4-10
# are FFFF up to the bank's end, which nothing reads)
033FE3  table  flying_saxophone_shot_animations[6]  u8
033FE9  table  flying_saxophone_shot_speeds[11]  u16

# ======== bank 1A ========

# ---- object_1a_level_rows: its type (the rows point into object_1a_levels) ----
# 03409B "LDU #$77C6; LDA #$31,X; ASLA; LDU A,U", 0340A4 "LDA <$57; LDA A,U; STA $188C", 0340AD "CMPA #$1B,X": each row
# is a place in object_1a_levels, read by the players in the game: the vitality (1B, FF at 0340DE) below which it goes
# to its next state. Today `u16`; with the elements the byte read reads by name
elements object_1a_level u8
0357C6  table  object_1a_level_rows[5]  u16 object_1a_level

# ---- type F8 (the stage 6 boss: the last record of its spawn list; setup 77D0: BA00), its routines by field 52 ----
# it runs at a player in legs, turning toward the player at the start of each (03429E "LBSR $8620", 0342B5 "LBSR $861D;
# LDB #$30; LBSR $8617"): 0342BD "DEC #$3C,X; BEQ", 0342C2 "LDU #$77FE; LDA #$3C,X; LDA A,U; STA #$3B,X" (3C from 7
# down to 1, set to 8 at 034296; entry 0 unread), 0342D7 counts 3B down
0357FE  table  object_1a_chase_leg_times[8]  u8
# it bounces: each time it lands, the next of 4 animations: 034564 "LDU #$782A; DEC #$3A,X; LDA #$3A,X; ANDA #$03; LDA
# A,U; STA #$05,X" (then 19 = 0400, sound 64)
03582A  table  object_1a_bounce_animations[4]  u8
# a round of poses by its field 3A counting down: 0345F9 "LDU #$7832; DEC #$3A,X; LDA #$3A,X; ANDA #$07; LDA A,U; BMI;
# STA #$3B,X" (the frames it holds it; FF ends the round, 034621), 03460B "LDU #$783A ... LDA A,U; STA #$05,X" (its
# animation)
035832  table  object_1a_pose_times[8]  u8
03583A  table  object_1a_pose_animations[8]  u8
# a leap at a player, by how far it is (field 44 = the x distance 2C / 16: 03467F "LDD #$2C,X; LSRDI #$04; ANDB #$0F;
# STB #$44,X"): 03468F "LDU #$784E; LDB #$44,X; LDB B,U; LBSR $8617" (its speed toward the player), 03469A "LDU #$785E;
# LDB #$44,X; LDA B,U; CLRB; STD #$19,X" (its height speed). Only 16 of the second: 786E-786F (672F) is the handler of
# step FF of the table 7870 read backwards (034719 "LDU #$7870; LDB #$29,X; ASLB; JSR [B,U]", 034767 "LDA #$FF; STA
# #$29,X")
03584E  table  object_1a_leap_speeds[16]  u8
03585E  table  object_1a_leap_heights[18]  u8
# each time an animation of its routine 7896 ends, the next of 4 by field 3A counting down: 034A3C "LDU #$78A0; DEC
# #$3A,X; LDA #$3A,X; ANDA #$03; LDA A,U; STA #$05,X" (that routine starts with the flash and sound 66 its other hit
# reactions have: 0349DA-0349E8, as 0344E0)
0358A0  table  object_1a_repeat_animations[4]  u8
# it walks at a player (034C0A "LBSR $8620; LBSR $861D; LDB #$20; LBSR $8617") for the frames by its counter 4F:
# 034C15 "LDU #$78C8; DEC #$4F,X; LDA #$4F,X; ANDA #$0F; LDA A,U; STA #$3B,X"
0358C8  table  object_1a_approach_times[16]  u8
# as kind D1 it lets out 4 objects (children of type 27), one each 20 frames: 034D41 "DEC #$3C,X; LDA #$3C,X; ANDA
# #$03; ASLA; LDY #$78EC; LDY A,Y; LBSR $862C"
0358EC  table  object_1a_released_objects[4]  u16 child_object

# ---- 4D40 type 20, kind D1 (setup 792E: D103) ----
# its start, one of 4 at random: 034E55 "LDU #$7926; LDA <$58; ANDA #$03; ASLA", 034E5E "LEAU A,U", 034E60 "LDA ,U;
# CLRB; STD #$0F,X" (its x speed, negated facing left: 034E76), 034E66 "LDA #$01,U; STA #$3B,X" (the frames before it
# turns toward the player: 034E8B-034E96)
struct launch 02 rom
field launch 00 speed u8
field launch 01 time u8
035926  table  object_1a_launches[4]  launch

# ---- types FE and FF, kind D1: a chain; FF's links follow the object in their field 2E (035285-0352C1) ----
# by its state (0-23): 035266 "LDU #$79A6; LDA #$30,X; ASLA; LEAU A,U; LDD ,U; STA #$05,X; STB #$23,X" (type FF,
# 03524C), 035331 "LDU #$79A6 ... LEAU A,U; LDB #$01,U; STB #$23,X" (type FE, 03530C). 23 is its hit box's y offset
# (07C13A "LDB #$23,X; SEX; ADDD #$11,X"): 00-07 for the 8 links of animation 8D, 08 for those of 8B and 89
struct chain_link 02 rom
field chain_link 00 animation u8
field chain_link 01 box_y_offset s8
0359A6  table  object_1a_chain_links[24]  chain_link
# the path type FE takes (object_1a_path_starts, the struct path_start): 0353A7 "LDU #$79DC ... LDA A,U; STA <$F0;
# ASLA; ASLA", 0353B9 "LDU #$79E4", 0353BC "LEAU A,U", 0353BE "LDD ,U; STD #$2C,X", 0353C3 "LDD #$02,U; STA #$3B,X; STB
# #$3A,X"
# a quarter of a sine, 80 down to 00: 035472 (called by the chain's head, 035199, with A its direction 37 and B a
# distance) 03547C "LDU #$7FA3; LDA A,U; MUL" (A = the direction's low 6 bits), 035485 "LDA #$3F; SUBA <$EF; LDA A,U;
# ... MUL" (the other side): the offsets of the next link (into 50 and 52). 64 read; 035FE3-035FFF (29 bytes) are FF
# up to the bank's end, which nothing reads
035FA3  table  object_1a_sines[93]  u8

# ======== bank 1B ========

# ---- 5280 type 12, kind 0F (setup 644E: 0F09; extract_assets names the set police_car_and_doors) ----
# when it opens (animations 8A-8D, sound 60), it lets out the objects of a list by its state: 0361BC "LDU #$6454; LDA
# #$30,X; ASLA; LDY A,U", then 0361C5 "LDA ,Y+; CMPA #$7F; BEQ" (7F ends the list), 0361CB "CMPA $1874; BCC" (1874 is a
# copy of the players in the game, 07C994 "LDA <$57; STA $1874": the object comes out only when there are more players
# than this byte), 0361D4 "LBSR $862C" (the child object after it), 0361D7 "LEAY #$08,Y". kref --rom-reads: 0361C3
# reads 036454-036455, 0361C5 reads 036458, 036461, 03646A, 036473. The piece holds the 2 addresses (both 6458), the
# list and its end
struct door_spawn 09 rom
field door_spawn 00 players u8
field door_spawn 01 dx s16
field door_spawn 03 dy s16
field door_spawn 05 dz u8
field door_spawn 06 list u8
field door_spawn 07 state u8
field door_spawn 08 type u8
036454  table  door_spawn_lists[2]  u16 door_spawn
036458  table  door_spawns[3]  door_spawn
036473  table  door_spawns_end[1]  u8
# the other doors of bank 1B: they open when their x comes below a place (036344 "LDD #$0C,X; CMPD #$3E,X; BCC; INC
# #$02,X") and let out the list their field 30 picks (03637E "LDA #$30,X; ASLA; LDY A,U", the same loop as 0361C5).
# 5280 type 38, kind 12 (setup 6482: 1209): 036259 "LDU #$6488; LDA #$30,X; ASLA; ASLA", 036261 "LEAU A,U", 036263
# "LDD ,U; STD #$3E,X", 036268 "LDD #$02,U; STB #$30,X" (byte 2 dropped); 5280 type 0B, kind 10 (setup 64F8: 1008;
# later kind 0F, 0362ED "LDD #$0F95; STD #$04,X"): 0362B9 "LDU #$64FE", 0362C1 "LEAU A,U", 0362C8 "LDD #$02,U; STA
# #$3B,X; STB #$30,X" (a wait before it opens: 0362D8 "DEC #$3B,X"); 5280 type 0C, kind 0F (setup 6547: 0F0E): 036328
# "LDU #$654D", 036330 "LEAU A,U", 036337 "LDD #$02,U; STB #$30,X" (byte 2 dropped)
struct door_opening 04 rom
field door_opening 00 x u16
field door_opening 02 wait u8
field door_opening 03 list u8
036488  table  channel_6_scenery_door_openings[4]  door_opening
0364FE  table  moes_street_scenery_door_openings[3]  door_opening
03654D  table  kind_0f_door_openings[4]  door_opening

# ======== bank 1C: the players ========
# (the existing object_1c_* names call them "bank 1C's object"; bank 1C runs the 4 players' objects: 038003-038073
# "LDU #$4A40; LDX #$49D0 ... LDU #$4B00; LDX #$49D8 ...", their inputs from direct page 40-4E into field 2E, 0380F1
# "STY #$2E,U": 2E the joystick, 2F the buttons)

# ---- object_1c_moves: its type and count (4 records of 4 bytes, not 8 words) ----
# 0388D4 "LDX #$7DEB; LDA B,X" (object_1c_move_steps: the next, 0-3), 0388E0 "ASLA; ASLA", 0388E2 "LDX #$7DF7", 0388E5
# "LEAX A,X", 0388E7 "LDD ,X++" (the state and animation: 03899D "STB #$05,U; CLRB; STD #$30,U"), 0388E9 "LDY ,X" (into
# 42: 038985/038995 "STY #$42,U", copied to the hit box at the attack's frame, 038BB8 "LDX #$42,U; STX #$1C,U"; kref
# --rom-reads: 0388E7 reads 039DF7-8, 039DFB-C, 039DFF-0, 039E03-4)
struct player_move 04 rom
field player_move 00 state u8
field player_move 01 animation u8
field player_move 02 hit u16
039DF7  table  object_1c_moves[4]  player_move

# ---- the players' walk ----
# by the joystick's bits (field 2E: 1 left, 2 right, 4 down, 8 up): 038B37 "LDA #$2E,U; ANDA #$0F; ASLA; ASLA; LDX
# #$7F21; LDD A,X; ASRDI #$03; STD #$0F,U", and 03988B (A = 2E: 03868A "LDA #$2E,U; LBSR $788B") "ANDA #$0F; ASLA;
# ASLA; LDY #$7F21", 039892 "LEAY A,Y", 039894 "LDD ,Y++; STD #$0F,U" (its sign gives the facing: 03989B "ANDA #$40")
# and the y speed after it (039931 "LDD ,Y; STD #$14,U"). 15 (entry 15 would be the next piece, 039F5D,
# the same 60 bytes again)
039F21  table  player_walk_velocities[15]  velocity
# its attack's hit box by its state (field 30, 06-0C) and character (field 04): 038BC5 "LDX #$7F99; SUBA #$06; ASLA;
# ASLA; ADDA #$04,U; ASLA; LDD A,X; STA #$1F,U; STB #$22,U" (state 38 has its own: 038BDF "LDA #$12; STA #$1F,U"). 1F
# is the hit box's x size (07C1A7 "LDB #$1F,X; ADDB #$1F,U"), 22 its x offset (07C162 "LDB #$22,X; SEX")
struct attack_box 02 rom
field attack_box 00 width u8
field attack_box 01 x_offset s8
039F99  table  player_attack_boxes[28]  attack_box

# ---- what a player picks up (field 1E, F9-FC) ----
# the vitality it gains, at most 28: 0393F5 "PULLS A; SUBA #$F9", 0393F9 "LDX #$7EAD", 0393FC "LDB #$1B,U; ADDB A,X;
# CMPB #$28; BLS; LDB #$28; STB #$1B,U" (1E F9-FC jump there through the table at 7E8D: 039330 "LDX #$7E8D; JMP
# [D,X]", 7E7F-7E85 all 73B6). kref --rom-reads: 0393FF reads 039EAD, 039EAE, 039EB0. 4: the next bytes are the first
# team move's (below); the piece 039EAD is these 4 and the team moves
039EAD  table  pickup_vitality[4]  u8

# ---- the team moves (two players together: 0396B2-039781) ----
# by the two characters: 039700 "LDB #$04,U; ASLB; ASLB; ADDB #$04,X; ASLB; ASLB; ASLB; LDY #$7EA9; CLRA", 03970F "LEAY
# D,Y": record n = 4 x the first's character + the second's, from 7EA9, so record 1 is at 7EB1; one character with
# itself never comes (records 5 and 10 are zeros, 0 and 15 lie in the next tables). 039711 "LDB ,Y+; STB #$35,U; STB
# #$35,X" (the move, 0-3, into both), 039727 "LDD #$03,Y; LBSR $8680" (bytes 4-5: its sound), 03972D "LDB ,Y+; CLRA;
# ASLDI #$02; LDX #$4A40; LEAX D,X" (the object, 4A40 + 4 x this, that plays the first part: 00 Marge's, 30 Homer's, 60
# Bart's, 90 Lisa's), 039737 "LDA ,Y+; STA #$36,X" (its direction), 03974B "LDB ,Y" (the second part's object), 039755
# "LDB ,-Y; DECB; STB #$36,X", 03976A-03977F (byte 6 when the second is right of the first, 7 when left: "ORA ,Y" into
# the first's 09). kref --rom-reads: 039711 reads 039EB1, 039EB9, 039ED9, 039F01 (records 1, 2, 6, 11)
struct team_move 08 rom
field team_move 00 move u8
field team_move 01 first_object u8
field team_move 02 direction u8
field team_move 03 second_object u8
field team_move 04 sound u16
field team_move 06 facing_second_right u8
field team_move 07 facing_second_left u8
039EB1  table  team_moves[14]  team_move
# the second object's facing the move gives (03976F "LEAY #$04,Y" from its direction: facing_second_right; 039777
# "LEAY #$01,Y" when the second object stands left of the first, 039772 "CMPD #$0C,X": facing_second_left), put into
# its field 09 (03977F "ORA ,Y")
elements second_object_facing u8
# the team move's hit box width, by the move: 0396DA "LDB #$35,U; LDY #$7FD1; LDA B,Y; STA #$1F,U; STA #$1F,X" (kref
# --rom-reads: 0396E0 reads 039FD1-039FD2; 4 moves, the rest FF up to the bank's end, which nothing reads)
039FD1  table  team_move_box_widths[47]  u8
# by the move, into field 3C when its attack starts: 0386E1 "LDA #$35,U; LDX #$7DD5; LDA A,X; STA #$3C,U" (then
# 0386EF "LDY #$0C13; STY #$1C,U": its hit box); the move's routines test it (03851C, 03863C, 038690 "TST #$3C,U;
# BNE"); nothing in bank 1C counts it down, so taken as the attack's length by what it holds (32, 32, 35, 38)
# an animation by the move and the character, added to a base (<$F2: E4 at 0391BD, EC at 0391E9; FF none): 0391EE "LDY
# #$7E3D; LDA #$35,U; ASLA; ASLA; TFR A,B; ADDA #$04,U; LDA A,Y; BMI; ADDA <$F2; STA #$05,U". The index reaches 15
# (kref --rom-reads: 0391FB reads 039E4B, move 3 Bart's), past these 8: the next table's first 8 bytes (FF FF 02 02
# FF FF 03 03, moves 2 and 3) are entries 8-15 as well
039E3D  table  team_move_animation_offsets[8]  u8

# ======== banks 1D, 1E, 1F, 20, 2F ========
#
# Who is who (evidence used by many entries below):
# - The 4F80 list's dispatcher (07CB3C: "LDU #$F387; LDB A,U; SETLN; LDU #$F2EC; ASLA; JSR [A,U]") sends type F6 to bank
#   1D 6000 (03A271), type EC to 1D 6009 (03A99E), EA to 1D 6024 (03B8D8), and in bank 1E type 19 to 6000 (03C348), 20
#   to 6009 (03C8BC), 0B to 600C (03CE4D), 3E to 6018 (03D1B3), F9 to 601B (03D6ED), E8 to 6015 (03DB61).
#   (07EFF4/07EFF8: a spawn's flags bits 2-3 pick the list: 0 4F80, 1 5280, 2 4D40, 3 5640; each list has its own
#   dispatcher and type tables, so a type number means an object only within its list.)
# - spawn_lists by scene (E88D[step]: scene 05 = step 8 stage 4, 06 = step 9 stage 5, 08 = step 11 stage 6, 0B = step
#   15 stage 8): scene 0B's list puts in F6 and EC (both x 03E0, flags 00), scene 05's a 19 at 0870, scene 06's a 20 at
#   0828, scene 08's eight F9 (0290-02E0).
# - "stage_8_boss" = type F6 (bank 1D 03A271): kind 9C (03A2AA "LDA #$9C; STA #$04,X"; set 9C is unnamed), health in
#   field 1B (80, refilled while field 2D > 0: 03A277-03A288), three phases by field 2D (03A37A "LDY #$7A9C; JMP
#   [A,Y]"), and its defeat advances the step's sub-step (03A794 "INC <$04"); 07B333-07B354 then runs a story and sets
#   <$81, which type EC waits for (03AD6B "LDA <$81"). It is the boss before Mr. Burns' robot.
# - "burns_robot" = type EC (bank 1D 03A99E): kinds CC-D4 (burns_robot..burns_robot_5 in SET_NAMES: 03AA88 "LDD
#   #$D489", the table 03BBF9), its parts object_1d_parts include kind D3 (mr_burns). Field 30 + field 34 is its form
#   (0-4: 03AAE5 "LDA #$30,X; ADDA #$34,X").
# - "football_player" (type 19, kind 92: 03C35C), "bear" (type 20, kind A2: 03C8CD): SET_NAMES names; both end their
#   stage's step ("INC <$04": the football player's at 03C79F, the bear's at 03CD59), stage 4 and stage 5 (kref
#   --rom-reads: only the stage4 / stage5 scenarios read their tables).
# - "stage_3_boss" = type 3E (bank 1E 03D1B3): two of them, kind C4 (field 30 = 0) and C3 (field 30 = 1: the first puts
#   in the second, 03D1C5 "LDY #$7F08; LBSR $862C", child record type 3E), field 41 links them; when both are gone
#   03D509-03D50E "STA <$7D; INC <$04"; only the stage3 scenario reads their tables. Bank 13 puts the first in
#   (0260FD "LDA #$3E; STA #$01,U").
# - Object field 00 bit 04 = can not be hurt: 07C26D "LDA #$00,X; ANDA #$04; BNE" skips "SUBA #$1C,U" (the health
#   loss) and "ORA #$20" (hit). Field 1B the health, 1C the damage an object deals, 1D the strength it hits with (into
#   the victim's 1E).
# - Tables by the players in the game read "LDA <$57; LDA A,Y" (no DECA) have entries 1-4: their entry 4 is the next
#   table's first byte (the game's own tables share it); counts kept at the piece's length where a piece starts there.


# ======== stage 8's first boss (bank 1D, type F6) ========

# its states' starts (03A29A "LDY #$7A3A; LBRA $6065", 03A065 "STB #$2E,X; ASLB; LDD B,Y; STA #$2F,X; STB #$05,X"):
# the frames field 2F counts down and the animation (field 05), by state 0-30 (03A736 "LDB #$1E" the highest). Entries
# 0 and 1 are bank_1d_states' entries 29 and 30 (65DF, 66F3): states 0 and 1 are never started through it (03A2B9 "LDA
# #$01; STA #$2E,X"); kref --rom-reads: 03A069 reads 03BA3E-03BA77 (entries 2-30).); the same struct serves bank 1E's
# 03DF7C
struct state_start 02 rom
field state_start 00 wait u8
field state_start 01 animation u8
03BA3A  table  stage_8_boss_state_starts[31]  state_start
# (if the record table alone does not fold the read, also: local sub_03A29A 03A29A y starts state_start)

# phase 1 (field 2D = 2, 03A37F), after a throw (states 0B/0C): 03A3FC "LDA <$57", 03A3FF "LDY #$7AA5", 03A402 "LDA
# A,Y", 03A404 "CMPA <$58", 03A407 "LBGE $6626": at or above the random number (signed compare) it goes back to looking
# for a player to hit; below it "INC #$33,X", and while 33 <= 3 "LDA #$01; STA #$32,X" ends its walk next frame to throw
# again. Entries 1-4 by players: 60 70 80 90 (80 and 90 are negative to the signed compare)
03BAA5  table  stage_8_boss_stop_throwing_chances_by_players[4]  u8
# the bombs it throws at once: 03A429 "LDA <$57", 03A42C "LDY #$7AA9", 03A42F "LDA A,Y", 03A431 "STA <$F0", 03A434
# "LBSR $6925" (6925: <$F0 times a child object from the record 7A7E, type 1D: 03A7DC kind 9C animation 89 thrown at a
# player, which on the floor turns into animation 8A with a hit box and sound 6F00, 03A8E2-03A90D). By players: 4 6 8 10
03BAA9  table  stage_8_boss_bombs_by_players[4]  u8
# phase 2 (field 2D = 1, 03A441): 03A449 "LDY #$7AAD", 03A44C "LDA <$57", 03A450 "LDA A,Y", (negated by the random
# number's sign and when 863B finds a wall) 03A463 "STD #$0F,X" (x speed, whole pixels: 2-5) and 03A466 "STA #$36,X"
03BAAD  table  stage_8_boss_run_speeds_by_players[4]  u8
# phase 2, when a hit has put it down (state 21, 03A6F3): 03A709 "INC #$33,X; LDB #$33,X", 03A70F "LDY $7AB1" (extended,
# not immediate: Y is the word at 7AB1, 050A), 03A716 "CMPB A,Y": the game compares its hit count with the K052109's RAM
# at 050B-050E. A bug: the table meant is the bytes after 7AB1 (0A 05 03 01 by players, never read). The word is read
# as an address, so name it as one
03BAB1  table  stage_8_boss_hit_limits_address[1]  u16
# then (more hits than that) 03A71B "CLR #$33,X", 03A71E "LDY #$7AB5", 03A721 "LDA A,Y", 03A723 "STA #$32,X", 03A726
# "LBSR $6177" (sets bit 04 of field 00: it can not be hurt); its run (03A46E) counts 32 down and at 0 03A478 "LBSR
# $6180" clears the bit: frames it can not be hurt. By players: 14 1C 1E 26
03BAB5  table  stage_8_boss_invulnerable_times_by_players[4]  u8
# phase 2's run (03A4CD): "LDA <$58; LDB <$57", 03A4D3 "LDY #$7AB9", 03A4D6 "CMPA B,Y", 03A4D8 "LBCS $6683": a random
# number below the entry skips this frame's look for a player within 30x10 to hit (6626, state 1D). By players: E0 F0
# F8 FF (more players, fewer close attacks)
03BAB9  table  stage_8_boss_run_skip_attack_chances_by_players[4]  u8
# phase 3 (field 2D = 0, 03A4FA): it picks a player (60E7, into field 3A) and moves away from it: 03A537 "LBSR $861D"
# (direction to it), "ADDA #$80", 03A53C "LDY #$7AC1", 03A542 "LDB B,Y", 03A544 "LBSR $8617" (speed in a direction)
03BAC1  table  stage_8_boss_retreat_speeds_by_players[4]  u8
# its walk: phase 1 (03A3B7 "LDY #$7AC5", 03A3BD "LDB A,Y", 03A3C1 "LBSR $8617", toward the nearest player or a random
# way) and after phase 2's run, toward a player while it drops bombs (03A4B7, 03A4BD, 03A4BF "LBSR $8617", state 0E)
03BAC5  table  stage_8_boss_walk_speeds_by_players[4]  u8
# phase 3's jump at a player (03A54D: state 10, 03A552 "LDD #$0900; STD #$19,X" up speed), 03A561 "LDU #$7AC9", 03A567
# "LDB B,U", 03A569 "LBSR $8617"
03BAC9  table  stage_8_boss_jump_speeds_by_players[4]  u8
# phase 3, every 64 frames field 34 runs out: a dash at a player (03A57B: state 14, which ends at 00C0 of speed), 03A583
# "LDY #$7ACD", 03A589 "LDB B,Y", 03A58B "LBSR $8617"
03BACD  table  stage_8_boss_dash_speeds_by_players[4]  u8
# phase 3's jump (state 10, 03A59E): 03A5A4 "INC #$32,X; LDA #$32,X", 03A5AA "LDY #$7AD1", 03A5AD "LDB <$57", 03A5B0
# "CMPB A,Y", 03A5B2 "LBLE $6683": while the players in the game are at most the entry for the frames in the air
# (field 32 from 1) no bomb; above it 03A5B5 "CLR #$32,X", 03A5BA "LBSR $6925" drops one. Entries 1-4: 01 01 02 08
# (2-4 players: a bomb every frame; 1 player: at count 6, from the next table's byte DC, negative). Entry 0 is the
# dash speeds' last byte (80)
03BAD1  table  stage_8_boss_jump_bomb_player_limits[5]  u8
# (read through the Y it hands 6189, sub_03A189's mem_read8(y + b)): 03A683 "LDY #$7ABD",
# 03A686 "LBSR $6189": 03A1B2 "LDA #$1B,X; LDB <$57", 03A1C0 "CMPA B,Y", "BLS $61CD": at or below the entry its last
# health bar is gone (61CD "CLR #$1B,X", returns FF); each earlier bar ends at 48 (03A27F). By players: 44 20 10 00
03BABD  table  stage_8_boss_beaten_healths_by_players[4]  u8


# ======== Mr. Burns' robot (bank 1D, type EC) ========

# form 1's second attack (handler 9, 03AF47 -> 7B52): each shot (03AF50: part 5, type 25 kind CD animation 84, x speed
# 0500, sound 1D00), then 03AFA7 "LDU #$7B5A", 03AFAA "LDA <$57; DECA", 03AFAE "INC #$40,X; LDB #$40,X", 03AFB4 "CMPB
# A,U", "BCS" -> animation 8E and 03AFC6 "DEC #$28,X" (another shot): the shots in a row. By players-1: 2 2 3 3
03BB5A  table  burns_robot_volleys_by_players[4]  u8
# its shots (handler 12, 03B0A7: part 9 + form, type 26 kind CC animation 88, x speed 0200): 03B0DF "LDY #$7B76", 03B0E2
# "LDA #$3D,X; ASLA", 03B0E6 "LDD A,Y", 03B0E8 "STD #$14,U" (the shot's y speed); form 4 fires three, field 3D counting
# them (03B117-03B11F). 0000, FF00, 0100
03BB76  table  burns_robot_shot_y_speeds[3]  s16
# the health each form starts with: 03AAE5 "LDU #$7B80", "LDA #$30,X; ADDA #$34,X", 03AAEE "LDA A,U", 03AAF0 "STA
# #$1B,X", 03AAF3 "STA #$2F,X" (the same at 03AB67, 03ACC4). A0 A0 80 80 E0
03BB80  table  burns_robot_healths[5]  u8
# by form, the health at which the form is beaten, by players-1: 03B422 "LDU #$7B85", 03B42B "ASLA", 03B42C "LDU A,U",
# 03B42E "LDA <$57; DECA", 03B432 "LDB #$1B,X", 03B435 "CMPB A,U", 03B437 "LBLS $73B8" (73B8: field 02 = FE - form,
# the beaten form's handler). Each entry points at 4 bytes (40 20 10 00 in all five): elements, read
# beaten_health(p)[players - 1]
elements beaten_health u8
03BB85  table  burns_robot_beaten_healths[5]  u16 beaten_health
# form 0's walk (03B176): 03B197 "LDU #$7BA3", 03B19A "LDA <$57; DECA", 03B19E "LDA A,U", 03B1A0 "CMPA <$58", 03B1A3
# "BHI $71AB" (<$F0 = 1: field 35 = 1, its second attack, handler 7, 03B443) else <$F0 = 0. By players-1: 40 60 80 80
03BBA3  table  burns_robot_second_attack_chances_by_players[4]  u8
# frames field 3B (counted up each frame, 03A99E) must pass before it fires its shots (handler 12): 03B577 "LDY #$7BA7",
# 03B57A "LDA <$61; ADDA #$30,X; ADDA #$34,X; ANDA #$1E", 03B585 "LDD A,Y", 03B587 "CMPD #$3B,X" (then 03B180 "LBSR
# $7566": x 40-180, 74E1: handler 12). By rank plus form; all 0280
03BBA7  table  burns_robot_shot_times[16]  u16
# form 2's (03B1FF): frames field 41 (counted up, 03A9B0) must reach before handler 11 (74C4), which holds part 14
# (type EA, kind CE animation 88; 03B8D8 keeps it 30 in front of the robot while field 43 is set) for 40 frames:
# 03B22C "LDY #$7BC7", 03B22F "LDA #$34,X; ASLA; ASLA; ADDA <$61; ANDA #$1E", 03B239 "LDD A,Y", 03B23B "CMPD #$41,X".
# All 0200
03BBC7  table  burns_robot_held_part_times[16]  u16
# by form, the chance it attacks at once (03B443, after choosing an attack): 03B46D "LDU #$7BE7", 03B470 "LDA
# #$34,X; ADDA #$30,X; ASLA", 03B477 "LDU A,U", 03B479 "LDA <$57; DECA", 03B47D "LDA A,U", 03B47F "CMPA <$58", 03B482
# "BHI $7495" (attack now); otherwise, unless it lost more than 0C of health since (field 2F), 03B48E "LDA #$20; STA
# #$29,X" (a 32-frame wait the attack handler counts down, 03AEF6). Points at 7BF1 (forms 0-3) and 7BF5 (form 4)
elements quick_attack_chance u8
03BBE7  table  burns_robot_quick_attack_chances[5]  u16 quick_attack_chance
# its looks by number: 03B2F0 "LDU #$7BF9; ASLA; LDD A,U; ORB #$80; STD #$04,X": each its kind (CC-D4) and animation.
# Numbers up to 34 (03AE15 "LDA #$34"); kref --rom-reads: 03B2F6 reads 03BBF9-03BC62; entry 53 nothing reads
03BBF9  table  burns_robot_animations[54]  u16
# its hit boxes by number: 03B2FF "LDU #$7C65; ASLA; LDU A,U", then "LDD ,U++; STA #$1C,X; STB #$1D,X", "LDD ,U++; STD
# #$1F,X", "LDD ,U++; STD #$21,X", "LDD ,U++; STD #$23,X" (hit_box's layout); numbers 0-10 (03AF97 "LDA #$0F",
# 03B051 "LDA #$10"); kref --rom-reads: 03B303 reads 03BC65-03BC86
03BC65  table  burns_robot_hit_boxes[17]  u16 hit_box
# by form, its walking speed by rank/2: 03B263 "LDA #$31,X" (the direction), 03B266 "LDY #$7CD7", 03B269 "LDB #$30,X;
# ADDB #$34,X; ASLB", 03B270 "LDY B,Y", 03B272 "LDB <$61; LSRB", 03B276 "LDB B,Y", 03B278 "LBSR $8617". Points at 7CE1
# (18s), 7CF1 (20s), 7D01 (30s, forms 2 and 3), 7D11 (50s)
elements walk_speed u8
03BCD7  table  burns_robot_walk_speeds[5]  u16 walk_speed
# the tables those pointers lead to
03BB8F  table  burns_robot_form_0_beaten_healths[4]  u8
03BB93  table  burns_robot_form_1_beaten_healths[4]  u8
03BB97  table  burns_robot_form_2_beaten_healths[4]  u8
03BB9B  table  burns_robot_form_3_beaten_healths[4]  u8
03BB9F  table  burns_robot_form_4_beaten_healths[4]  u8
03BBF1  table  burns_robot_quick_attack_chances_forms_0_to_3[4]  u8
03BBF5  table  burns_robot_quick_attack_chances_form_4[4]  u8
03BC87  table  burns_robot_boxes[10]  hit_box
03BCE1  table  burns_robot_walk_speeds_form_0[16]  u8
03BCF1  table  burns_robot_walk_speeds_form_1[16]  u8
03BD01  table  burns_robot_walk_speeds_forms_2_3[16]  u8
03BD11  table  burns_robot_walk_speeds_form_4[16]  u8

# the robot's parts (object_1d_parts, read by 03B51E): 03B530 "LDY #$7D21", 03B533 "LEAY A,Y", 03B535
# "LDA ,Y+; STA <$EB" (<$EA cleared: 03B556 "LDD <$EA", "NEGD" when the part faces the other way, 03B55F "ADDD
# #$0C,X; STD #$0C,U": an x offset, not a speed), 03B53A "LDB ,Y+; SEX; ADDD #$11,X", 03B543 "LDB ,Y+; SEX; ADDD
# #$16,X", 03B54C "LDA ,Y+; STA #$01,U" (the new object's type), 03B551 "LDD ,Y; STD #$04,U" (its kind and animation);
# bytes 6-7 (0000 in all 15) nothing reads. Replacement field lines for struct part (fixes 00, 03, 04; unk_06 named):
field part 00 dx u8
field part 01 dy s8
field part 02 dz s8
field part 03 type u8
field part 04 kind u8
field part 05 animation u8
field part 06 unused u16


# ======== bank 1E ========

# --- the scripted object (type E8, 03DB61; also list 1's E9 and list 2's 2A) ---
# its script by field 30 (the spawn record's byte 5, 07C9FE): 03DB77 "LDA #$30,X; ASLA", 03DB7B "LDY #$78B5", 03DB7E
# "LDY A,Y", 03DB80 "STY #$32,X"; 03DC1B "LDA ,Y+; ASLA; LDU #$7FAA; JMP [A,U]" runs the commands (00 flags, 01 wait,
# 02 end, 03 kind and animation, 04 animation, 05 place, 06 speeds, 07 accelerations, 0B sound, 0C/0D zoom, 0F wait
# for x...). 10 scripts: the table ends where the first starts (78C9); kref --rom-reads: 03DB7E reads 03D8B5-03D8C8.
# The rest of the piece (03D8C9-03DB60, 664 bytes) is the ten scripts
03D8B5  table  scripted_object_scripts[10]  u16
# the ten scripts those addresses lead to, one after another (03D8C9-03DB60), their commands a byte at a time
03D8C9  table  scripted_object_script_bytes[664]  u8

# --- the football player (stage 4's boss, type 19, kind 92) ---
# a player within 3C x 0C (03C615-03C626): unless it lost 0C or more health since field 46 (then a wait of 1, 03C63C
# "LDD #$1401"), 03C641 "LDU #$7DA5", 03C644 "LDB <$57", 03C647 "LDB B,U", 03C649 "LDA #$14", 03C64B "STD #$2E,X":
# state 14 (03C654: its attack, animation 84 with a hit box) after that many frames. Entries 1-4 by players: 1C 14 10
# 0E (the piece 03DDA6); entry 0 is the last byte of the hit box at 03DDA2 (03C3F1 "LDY #$7DA2; LBSR
# $62E5" reads 03DDA2-03DDA5). The code's base, 7DA5, is one before the table: its index counts from 1
03DDA6  table  football_player_attack_delays_by_players[4]  u8
# its run speed (field 36, the speed 8617 is handed at 03C4EE): 03C51F "LDA #$FF; SUBA #$1B,X; LSRA" (half the health
# it has lost), 03C525 "LDY #$7DAA", 03C528 "LDB <$61; LSRB", 03C52C "ADDA B,Y", 03C52E "LDB <$58; MUL", 03C532 "ADDA
# #$10", 03C534 "STA #$36,X": the range of a random speed, by rank/2. D6 to 2A by 6 (signed). Rank 1E-1F reads entry 15,
# the next table's first byte
03DDAA  table  football_player_speed_ranges_by_rank[15]  s8
# the 8 objects of its line (type 06 in list 2: the first from 03C72D "LDY #$7DC8; LBSR $862F", each next one from the
# one before, 03C8AF "INC $184A", 03C8B3 "LDY #$7DE6; LBSR $862F"; $184A counts them): 03C86D "LDB $184A; ASLB",
# 03C872 "LDY #$7DD6", 03C875 "LEAY B,Y", 03C877 "LDA #$92; LDB ,Y+; STD #$04,X" (kind 92's animation), 03C87E "LDB
# ,Y", "NEGB" facing left, 03C888 "SEX; ADDD #$0C,X; STD #$0C,X" (its x from the one before). The 1st, 4th and 7th get
# a hit box (03C847-03C857).
struct line_piece 02 rom
field line_piece 00 animation u8
field line_piece 01 dx s8
03DDD6  table  football_player_line_pieces[8]  line_piece

# --- the bear (stage 5's boss, type 20, kind A2) ---
# a player within 30 x 08 (03CAE4-03CAF0): unless it lost more than 10 of health since field 47 (03CB34: a wait of 1),
# 03CB1E "LDU #$7E63", 03CB21 "LDB <$57", 03CB24 "LDB B,U", 03CB26 "LDA #$11", 03CB2E "LBSR $604C" (604C: "STY #$2E,X":
# state 11 and its wait; state 11 at 03CC1B waits, then attacks, animation 81). Entries 1-4 by players: 28 28 1E 1C
# (the piece 03DE64 and 03DE67's first byte); entry 0 is the last byte of the child record 03DE5C (type
# 35). The code's base, 7E63, is one before the table: its index counts from 1; the 4th entry is the first byte of
# the table after
03DE64  table  bear_attack_delays_by_players[3]  u8
# its charge (03CB96, animation 8C, state 0A, hit box 03DE90): 03CBAA "LDY #$7E80", 03CBAD "LDA <$61; LSRA; ANDA #$FE",
# 03CBB3 "LDD A,Y", "NEGD" facing left, 03CBC1 "STD #$0F,X" (x speed). By rank/4: 03C0-0430
03DE80  table  bear_charge_speeds_by_rank[8]  u16
# its 11 parts (the existing object_1e_part_offsets are theirs: 03C8F6 in the bear's start), type 0B/0E/01 by list,
# all handled by 03CE4D (kind 10 animation 91): when $184A (the bear's phase) is 2 or more each flies off by its
# number (field 2D, 03C968): 03CE8C "LDA #$2D,X; ASLA; ASLA", 03CE91 "LDY #$7E9C", 03CE94 "LEAY A,Y", 03CE96 "LDD
# ,Y++; STD #$0F,X", 03CE9B "LDA ,Y+; STA #$14,X", 03CEA0 "LDA ,Y; STA #$19,X" (high bytes of the y speed and the up
# speed; 03CEAB then pulls it down 0060 a frame and bounces it). kref --rom-reads: 03DE9C-03DEC7 (11); the 12th (0000
# FE 03) nothing reads.
struct part_flight 04 rom
field part_flight 00 speed_x s16
field part_flight 02 speed_y s8
field part_flight 03 speed_z u8
03DE9C  table  bear_part_flights[12]  part_flight

# --- stage 3's bosses (type 3E, kinds C4 and C3) ---
# a player near (03D30E-03D331): 03D35C "LDB <$57", 03D35F "LDY #$7F35", 03D362 "LDA <$58; EORA #$30,X; ANDA #$0F",
# 03D36A "CMPA B,Y", 03D36C "BHI $7377": at or below the entry 03D36E "LDY #$060E; STY #$2E,X" (state 6, its attack
# 03D3DE, after 0E frames), else 03D377 "LDY #$0601" (after 1). Out of 16; entries 1-4 by players: 10 0A 02 01 (the
# piece 03DF36 and 03DF39's first byte); the code's base, 7F35, is one before the table: its index counts from 1; the
# 4th entry is the first byte of
# the table after
03DF36  table  stage_3_boss_slow_attack_chances_by_players[3]  u8
# after an attack (03D44D): 03D46C "LDY #$7F39", 03D46F "LDB <$57", 03D472 "LDA <$58", 03D475 "CMPA B,Y", 03D477 "LBHI
# $7285" (back to walking); at or below the entry 03D47A another attack (hit box 7F32, animation 84, state 08).
# Entries 1-4 by players: 10 80 C0 F0
03DF39  table  stage_3_boss_follow_up_chances_by_players[4]  u8

# --- the objects of type F9 (03D6ED, kind B9, unnamed set; stage 6's list puts in eight, only stage6 reads these) ---
# their states' starts: 03D702 "LDY #$7F7C; LBRA $6059", 03C059 "STB #$2E,X; ASLB; LDD B,Y; STA #$2F,X; STB #$05,X":
# states 2-14 (03D743 "LDB #$02"... 03D8B0 "LDB #$0E"); entries 0 and 1 are bank_1e_states' entries 13 and 14 (788C,
# 7748). kref --rom-reads: 03C05D reads 03DF80-03DF97. Merges 03DF7C (4) and 03DF80 (26).
03DF7C  table  marge_cloud_state_starts[15]  state_start
# (if needed: local sub_03D702 03D702 y starts state_start)


# ======== bank 1F: the players' second sprite (fields 60-BF of a player, handlers by field 90: 03EAB3 "LDX #$7E5B") ========

# state 12 (03EAEF; bank 1C 039B0C sets it with the player's own kind and animation 87, 3E = 120 frames, field 00 = C4
# can not be hurt): 03EAFE "LDX #$16,U", 03EB01 "LDA #$04,U" (the player's character: 0 Marge 1 Homer 2 Bart 3 Lisa),
# 03EB04 "LDY #$7E77", 03EB07 "LDA A,Y", 03EB09 "LEAX A,X", "LEAX #$007F,X", 03EB0F "STX #$76,U" (its height above
# the player's). 50 40 30 30
03FE77  table  player_overhead_heights[4]  u8
# states 8 and 10 (03EB18/03EB25: a thrown thing, x speed 0A00 or 0300, e.g. 038AF8 kind 08 animation 82, 0385F3 the
# player's field 40 with animation 80): 03EB68 "LDA #$04,U", 03EB6B "LDY #$7E7B", 03EB6E "LDB A,Y", 03EB70 "LDY #$16,U;
# LEAY B,Y", 03EB75 "STY #$76,U": the height it starts at, by character. 28 28 20 20
03FE7B  table  player_throw_heights[4]  u8
# state 2 (03EC60: the speech balloon, kind B1 = speech_balloons_2): 03EC67 "LDA #$00A0,U", 03EC6B "LDY #$7E7F", 03EC6E
# "LDB A,Y", 03EC90 "LDA #$B1; STD #$64,U": its animation by the balloon's number (field A0, set by 039C29). Read 0-3;
# entry 4 (94) nothing reads
03FE7F  table  player_balloon_animations[5]  u8
# number 3, a pair's balloon (the other player in field 32): 03EC7E "LDA #$04,Y; ASLA; ASLA; ADDA #$04,U", 03EC86 "LDY
# #$7E84", 03EC89 "ADDB A,Y" (added to animation 90), and 03ECC6 "LDX #$7E84; LDA A,X; LDB #$C0; MUL; ADDD #$4A40": the
# player whose object the balloon follows. By the other's character x 4 + this one's: the one of the pair (Marge-Homer:
# Homer, Marge-Bart: Marge, Marge-Lisa: Marge, Homer-Bart: Bart, Homer-Lisa: Lisa, Bart-Lisa: Bart)
03FE84  table  pair_balloon_players[16]  u8
# every frame for each player (03ED16): 03ED25 "LDA #$30,U", 03ED28 "LDX #$7E94", 03ED2B "LDA A,X", 03ED2D "STA
# #$02,U": what the player's state (field 30) says to the others in its field 02: 00, 01, FF, FE. The enemies test it:
# 03B44C "LDA #$02,U; LBMI $73D8" (the robot), 03D406 "LDA #$02,U; CMPA #$01" (stage 3's bosses)
03FE94  table  player_state_classes[72]  s8


# ======== bank 20 ========

# the attract's profile scenes: the character's moves (04078D, by A, 0-4): 04078D "LDU #$705A", 040790 "LDY #$70E3",
# "TFR A,B; ASLB", 040796 "LDY B,Y" (then 04079E/0407EC through Y): "LDD ,Y++; STD #$0F,X; STD #$6F,X" (x speed),
# "LDD ,Y++; STD #$14,X; STD #$74,X" (y speed), "LDA ,Y+; STA #$28,X" (frames, counted down at 0407CA), 0407EC the same
# negated (back). kref --rom-reads: 0407A5-0407C1 read 0410ED-041105
struct profile_move 05 rom
field profile_move 00 speed_x s16
field profile_move 02 speed_y s16
field profile_move 04 frames u8
0410E3  table  profile_moves[5]  u16 profile_move
# extra: the moves themselves (five pieces of 5 bytes), and what types the reads through Y (mem_read16(y) now)
0410ED  table  profile_move_records[5]  profile_move

# a player's quarter of the top line, by its number: 040AAE "LDY #$730E", 040AB1 "LDA #$01,X; ASLA; INCA", 040AB6 "LDA
# A,Y" (the colour bits ORed into its digits' colour RAM, 040ACF), 040BDE "LDX #$730E", 040BE4 "ASLA", 040BE5 "LDD
# A,X", 040BE7 "STA #$05,S" (the column: 040BFB "LEAU B,U"), 040BEA "STB #$03,S" (ORed into the pictures' colour,
# 040C09). 00/00 09/40 12/80 1B/C0
struct gauge_column 02 rom
field gauge_column 00 column u8
field gauge_column 01 colour u8
04130E  table  gauge_player_columns[4]  gauge_column
# the pictures 040BCE draws in a player's quarter, by number (B): 040BED "LDX #$7316", 040BF0 "LDB #$07,S; ASLB",
# 040BF4 "LDX B,X", then blocks of a tile address, width, height, colour and tiles, a 00 after one if another follows
# (040BF6-040C39). Numbers: 0 playing, 2 the continue count, 4 status 4, 5 status 1 and 5, 3 others, 1 and 0A before
# them (040953-0409CC), 6-9 the four players' own (040B0C "ADDB #$06")
041316  table  gauge_pictures[11]  u16
# the continue countdown ($4A1C, BCD, counted down from 20 at 07B946-07B955) in big digits: 040B44 "LDA $4A1C", the
# high digit 040B50 "LDX #$73F1; ASLA; LDU A,X" at 2418 (a 0 drawn blank, 040B5E "LDA #$80"), the low 040B66 "LDX
# #$73F1", 040B6A "LDU A,X" at 2420; each a picture of 8 x 8 tiles for 040B88 (width, height, colour, tiles)
0413F1  table  continue_digit_pictures[10]  u16

# the big two-row digits a player's counts are printed with (040AA8, a BCD byte: lives, the continue count): 040ABB "LDY
# #$774E", (high digit, 0 drawn as entry 10, blank: 040AC5 "LDA #$A0") 040ACB "LEAY A,Y",
# 040ACD "LDA ,Y+; ORA #$01,S; STA #$-2000,U; STA #$-1FC0,U" (colour RAM of both rows, with the player's colour),
# 040ADA "LDB ,Y+; STB ,U" (top tile), 040ADE "LDB ,Y; STB #$40,U" (bottom tile); the low digit the same from
# 040AE6/040AF0. Byte 3 (00) nothing reads. 11 records = the piece 04174E
struct big_digit 04 rom
field big_digit 00 attribute u8
field big_digit 01 top u8
field big_digit 02 bottom u8
field big_digit 03 unused u8
04174E  table  big_digits[11]  big_digit

# gauge_step_tiles, read by 0409F2 as pairs: 040A4C "LDY #$72FC", 040A4F "ASLA", 040A52 "LEAY A,Y",
# 040A54 "LDA ,Y+; STA ,U" (top), 040A5C "LDA ,Y; STA #$40,U" (the row below), by the gauge tile's step 1-8; step 0
# is drawn by 040A69 itself (8D/9D, the table's entry 0). 9 records of 2 bytes
struct gauge_step 02 rom
field gauge_step 00 top u8
field gauge_step 01 bottom u8
0412FC  table  gauge_step_tiles[9]  gauge_step

# gauge_player (gauge_player_records, read in sub_040003, sub_04000F, sub_040953): 24 bytes, one byte, one byte, then
# eleven words (0408EB "LDY #$02,X" reads the word at 02). Values from 04129C; which code reads each:
#   00 01/02/04/08, nothing reads it; 01 0-3, 040960 "LDA #$01,X; LDB #$0A; LBSR $6BCE" (the player's quarter);
#   02 4A00 + 7n (also the player record's 07): 04099E "LDA [#$02,X]" (the continue count, BCD) and 0409F2 "LDU
#      #$02,X" with "CMPB #$02,U", "TST #$03,U", 0408EB "LDA #$03,Y; DECA" (the gauge's shown step and its delay);
#   04 4819 + 8n, nothing reads it; 06 49D0 + 8n: 0409AF "LDD [#$06,X]" (lives, printed less one at 08: 0409AC "LDU
#      #$08,X"); 0A: 04099B "LDU #$0A,X" (where the continue count goes); 0C 49D2 + 8n: 0409F7 "LDB [#$0C,X]" (health,
#      x 1F / 28 the gauge's steps); 0E: 040A3C "LDU #$0E,X" (the gauge's 4 tiles); 10/11 (13 23 ...) nothing reads;
#   12 49D4 + 8n: 040948 "LDD [#$12,X]" (the score, printed at 14 by 07941B); 16 49D7 + 8n: 040959 "LDA [#$16,X];
#      CMPA #$02" (the player's status: 2 playing, 3 continue count, 4 game over at 07B9E6).
# Replacement field lines:
field gauge_player 00 bit u8
field gauge_player 01 number u8
field gauge_player 04 unused_04 u16
field gauge_player 06 lives u16
field gauge_player 08 lives_tiles u16
field gauge_player 0A continue_tiles u16
field gauge_player 0C health u16
field gauge_player 0E gauge_tiles u16
field gauge_player 10 unused_10 u8
field gauge_player 11 unused_11 u8
field gauge_player 12 score u16
field gauge_player 14 score_tiles u16
field gauge_player 16 status u16

# the rank's base, read by 040C65 through X with its index from two paths, <$14 or 1: 040C65 "LDX #$7782", 040C6D "LDA
# <$14" / 040C72 "LDA #$01", 040C74 "LDA A,X", 040C76 "ADDA <$61". The table is rank_base; the read through X
# is typed with
elements rank_amount u8


# ======== bank 2F ========

# the test mode menu's cursor (a multiple of 3, a test_menu_line each; $590A the menu's length, 05E638): 05E50C "LDA
# $1F90; ANDA #$0C", 05E51A "LDX #$6502", 05E51F "LSRA; LSRA", 05E521 "LDA A,X", 05E523 "ADDA [,Y]" (wrapping at both
# ends, 05E525-05E533). By the 1P joystick's bits 2-3: 0, +3, -3, 0
05E502  table  test_menu_cursor_steps[4]  s8
# a byte as two hex digits: 05E713 "LDY #$75AE", "LSRA" x4, 05E71A "LDA A,Y; STA ,X+", 05E720 "ANDA #$0F", 05E722 "LDA
# A,Y". Tile codes of 0-9 and A-F (00-09, 11-16)
05F5AE  table  test_mode_hex_digit_tiles[16]  u8
# the coin options page (05E2D6): the coin slot's setting 0-15 (05E2D6 "LDY #$5A59; LBSR $660A") picks 05E2DC "LDY
# #$7A5D", 05E2DF "LDA B,Y", 05E2E3 "SUBA #$30" (the coins), and 05E309 "LDY #$7A6F", 05E30C "LDA A,Y", 05E30E "SUBA
# #$30" (the credits), printed with "COIN" (7A9B) and "CREDIT" (7AA0). Each is 18 bytes in the test mode printer's
# form (C6 new line, the 16 digits, C0 end), though nothing prints them: the reads at 7A5D/7A6F are entries 1-16 of
# them (05FA5D, 05FA6F become coin_setting_coin_digits[1 + b] and coin_setting_credit_digits[1 + a]).
# Moves the pieces test_mode_text_05FA5C/05FA6E from texts to tables
05FA5C  table  coin_setting_coin_digits[18]  u8
05FA6E  table  coin_setting_credit_digits[18]  u8
# the EEPROM (ER5911) writes and reads (05E8F1, 05E915), the values put in 1FC2 (bit 3 CS, bit 4 CLK, bit 7 DI): the
# 7 address bits from $5A00 (05E93E "LDX #$7CA7; LDA ,X+", 05E947 "BITB #$40; ... ORA #$80; STA $1FC2", 05E954 "ORA
# ,X+; STA $1FC2", up to FF: 7 pairs 08/18 and FF)
05FCA7  table  eeprom_address_signals[15]  u8
# the 8 data bits from $5A01 (05E965 "LDX #$7CB6", the same with "BITB #$80": 8 pairs and FF)
05FCB6  table  eeprom_data_signals[17]  u8
# after a write: 05E98F "LDX #$7CCB; LDA ,X+; STA $1FC2" (00), until 05E998 "LDA $1F81; ANDA #$20" (ready)
05FCCB  table  eeprom_wait_signal[1]  u8
# the RAM ROM CHECK's graphics ROMs (05EAB0, $5A1A the chip 0-5: two tile ROMs, 05EB19, then four sprite ROMs,
# 05EB48): 05ECFE "LDY #$7D5C", 05ED04 "LDA $5A1A; ASLA", 05ED0B "CMPX A,Y" (the sum it got, then OK 05ED0F or BAD
# 05ED28): E71A CE24 B079 9852 A940 62A8
05FD5C  table  graphics_rom_sums[6]  u16
# 05ED01 "LDU #$7D68", 05ED09 "LDU A,U": where each chip's OK/BAD and sum are printed (221F-249F)
05FD68  table  graphics_rom_result_places[6]  u16
# 05EB5E "LDU #$7D74", 05EB61 "LDA $5A11" (the sprite ROM 0-3), 05EB65 "LDA A,U", 05EB67 "STA <$F6" (into 1FA4, the
# K053246's ROM read address, 05ECA8). 00 01 02 03
05FD74  table  sprite_rom_read_banks[4]  u8

# the game start's four portraits (05EE08, from 05E015, which 07A460/07A4A5 run: kref reads it in every game scenario
# and in no test one): each player's 9 x 20 tiles coloured: 05EE49 "LDX #$7DD8", 05EE4C "LDA <$F0; ASLA; ASLA", 05EE51
# "LEAX A,X", 05EE53 "LDU ,X++" (top left in the tile RAM), 05EE5F "LDB ,X; STB #$-2000,U" (its colour RAM); byte 3
# (00) nothing reads. 4 records (05EE93 "CMPA #$04"); kref --rom-reads: 05FDD8-05FDE7. The rest of the piece 05FDD8
# (05FDE8-05FFFF, 536 bytes) is FF to the bank's end.
struct portrait_area 04 rom
field portrait_area 00 tiles u16
field portrait_area 02 colour u8
field portrait_area 03 unused u8
05FDD8  table  portrait_areas[4]  portrait_area

# test_player (test_player_records, read in sub_05EEAB): the same portraits, not the test mode's (05EEAB "LDU #$7D88",
# from 05E015 above; kinds 0A-0D are marge_portrait..lisa_portrait). Its 5 unnamed bytes (unk_0c u8[5]): 05EF61
# "LDA #$06; LDB #$0C,U; LBSR $8677" with <$7E = 1 (07BAC7 -> 07BAEC: a palette set request), 05EF6B "LDA #$02; STA
# <$7E", 05EF70 "LDD #$0D,U; LBSR $8677" (07BB1F: a palette effect of bank 2E), 05EF78 "LDD #$0F,U; LBSR $869E" (0797ED:
# a sound command, 3F18-3F1B) - when its start button (11, 05EF1B "ANDA <$5B") has been pressed. Replacement for the
# line "field test_player 0C unk_0c u8[5]":
field test_player 0C palette_set u8
field test_player 0D palette_effect u16
field test_player 0F sound u16

# the sound test's two lists, read by 05E23E and 05E2A0: 05E242 "LDX #$68EF" (music) / 05E2A4 "LDX
# #$6799" (effects), then 05E728 "SUBA #$30; LEAX A,X; LEAX A,X; LDD ,X; LBRA $8680": X is 30 entries past the start of
# sound_test_music / sound_test_effects, the reads through X are typed with
elements sound_test_command u16


# ======== already named, staying ========
# zoom_steps_address (079D10 "LDX $602A": the address of zoom_steps), story_scripts (03E05A by field 30; 03E59F "LDU
# #$70F8; LDU A,U" by <$58 & 6 is entries 64-67, four scripts one is picked from at random), profile_texts,
# gauge_player_records (struct fixed above), rank_by_players, rank_by_scene, rank_step_times (scene 11 reads
# rank_frame_limits' first, as symbols.txt says), test_mode_texts, test_mode_words (05E350 "LDY #$7935" is entry 31 on:
# the difficulty's words), test_player_records (struct fixed above): their types and counts are right.

# ======== the fixed program (078000-07FFFF) ========
# Proposed symbols.txt lines, grouped by subject. Places are the program's offsets; the quotes are the listing's
# (build\listing\simpsons.s) instructions; kref --rom-reads ranges are over the 25 scenarios (build\reads).
# Lines that REPLACE existing ones: struct player and its fields (all of them), struct demo and its fields, and the
# table lines demos, palette_sets, palette_sets_high, layer_maps, the 8 block_/map_scenes tables, layer_modes,
# layer_modes_high, tile_pictures (a STRUCT added), field layer_map 08 (unk_08), 06 and 10 (a STRUCT added), field
# tile_picture_place 03 (a STRUCT added). Everything else is new.

# ======== the boot: the coins and the RAM ROM CHECK ========

# the coinage settings: by the coin setting the work RAM keeps at 59F1 (the EEPROM's settings' copy: 078A1A "LDX
# #$59F1", 078A1D "LDU #$E3EB", 078A20 "LDA ,X", 078A22 "LDA A,U"), a byte whose high nibble is the coins a credit
# takes (078A30-078A34 "LSRA" x4, "STA <$1C"; 07921E "LDA <$1C", 079229 "CMPA #$02,U" against the coins counted) and
# whose low nibble the credits they give (078A26 "ANDA #$0F; STA <$1D"; 079239 "LDB <$1D; ADDD #$00,U"): 11 12 13 ...
# 41 43 45 (1 coin 1 credit ... 4 coins 5 credits)
07E3EB  table  coinages[16]  u8

# the sums the RAM ROM CHECK expects of the program's four chips (MAME's ROM_START( simpsons ): 13c at 040000, 15c at
# 060000, 16c at 000000, 17c at 020000), each compared with the sum of 078E5B/078E63 (direct page FA) and printed OK
# or BAD (078C4F "LDB #$03"): banks 20-2F (078C22 "LDA #$20", 078C3D "CMPA #$30", 078C46 "CMPD $E423"); the fixed
# program and banks 30-3B (078C61 "LDX #$8000; LDU #$8000; LBSR $8E63", 078C6A "LDA #$30", 078C85 "CMPA #$3C",
# 078C8E "CMPD $E425"); banks 00-0F (078CA9 "LDA #$00", 078CC4 "CMPA #$10", 078CCD "CMPD $E427"); banks 10-1F
# (078CE8 "LDA #$10", 078D03 "CMPA #$20", 078D0C "CMPD $E429"). Each is read on its own (no index): a table of one
07E423  table  rom_13c_sum[1]  u16
07E425  table  rom_15c_sum[1]  u16
07E427  table  rom_16c_sum[1]  u16
07E429  table  rom_17c_sum[1]  u16

# the restart: bank 2F's test mode leaves through the reset vector (05E3AA "LDX $FFFE", 05E3AE "JMP ,X"; also 078A16
# and 078DB9 "JMP [$FFFE]"): 86CE, the reset's routine. It is the last word of the CPU's vectors (FFF6 FIRQ 91B2,
# FFF8 IRQ 8F43, FFFA SWI and FFFC NMI 89EC, FFFE RESET 86CE; FFF0-FFF5 FF), which today sit at the end of the
# block_tile_flags piece (07F67C, 2436 bytes up to 07FFFF): a data label names it, no table
# (a data label, no table: the vectors are at the end of the block_tile_flags piece)
07FFFE  data  reset_vector

# ======== the tile RAM's digits ========
# the tile of each hex digit, the character less 30 (00-09 for 0-9, 11-16 for A-F): 07945E "LDU #$E435", 079461-079467
# "ANDA #$F0; LSRA x4; LDA A,U" (the high digit), 079471 "ANDA #$0F; LDA A,U" (the low one), 07946D "STA ,X+" into the
# tile RAM (07947D prints D as four digits); kref: 079467/079473 read 07E435-07E443
07E435  table  hex_digit_tiles[16]  u8

# ======== the players ========

# a player's record (07A0DE "LDU #$E819; LDA <$F0; ASLA; LDU A,U", 07B713 "LDX #$E819 ... LDX A,X", by the player's
# number): the addresses of its variables in the work RAM, read through ([#$NN,X]) by the players' routines
# 07B731-07B8B0 (by its state, 07B71B "LDY #$E803", 07B71E "LDA [#$17,X]; ASLA; JSR [A,Y]") and by the attract's demo
# (07A0E7-07A114). Marge's record: 4842 481E 49D1 01 4A00 49D4 "MRG" 00 49D2 4840 4A5B 4A44 49D7 49F0; each next player
# 4 on
# for 00 and 11, 8 on for 02 04 09 0F 17, 7 on for 07, C0 on for 13 and 15 (its object), 1 on for 19
struct player 1B rom
# its newly pressed controls (4842 + 4 x player: 07924D-079265 keep each player's controls at 4840 + 4n, last frame's
# at +1, the newly pressed at +2, the held at +3): 07B75C "LDA [,X]; ANDA #$B0" (start and the two buttons: it joins)
field player 00 pressed u16
# the flag its coin slot's record keeps once the slot has given it a credit (481E = the record 4817 + 8n's byte 7:
# 079242 "LDA #$01; STA #$07,U"; while it is clear a credit takes direct page 3A's coins more, 079221 "LDB #$07,U; BNE;
# ADDA <$3A"), cleared when the player leaves the game (07B88B and 07B9E3 "CLR [#$02,X]")
field player 02 credit_given u16
field player 04 lives u16
field player 06 bit u8
# its continue countdown: BCD seconds then frames (07B82D "LDA #$20; STA [#$07,X]"; 07B86E "LDY #$07,X; INC #$01,Y;
# CMPA #$3C" a second, "LDA #$99; ADDA ,Y; DAA" down by one), and the game-over wait's frames (07B89D "INC [#$07,X];
# LDA [#$07,X]; CMPA #$C0")
# its score, a BCD word (49D4 + 8n): the score jobs 03-06 add to it (079828 "LDX #$49D4; LBRA $96FD" ... 07983A "LDX
# #$49EC"), 07B7B6 "LDD [#$09,X]" checks it against the high scores (079718: the 10 records at 4983) when it leaves
field player 09 score u16
# its initials for the high score table: MRG, HMR, BRT, LSA (07B7C6 "LDD #$0B,X; STD <$F0", 07B7CC "LDA #$0D,X; STA
# <$F2", copied into the high score record by 079743-079779)
field player 0B initial_1 u8
field player 0C initial_2 u8
field player 0D initial_3 u8
field player 0E number u8
# its life the game keeps between stages (49D2 + 8n): 07B7A5 "LDA #$28; STA [#$0F,X]" when it joins, 07B6B6-07B6C3
# "LDA #$28; STA ,U" for each player playing at a stage's start, 020A17-020A21 "ADDA #$14 ... CMPA #$28" a refill
field player 0F life u16
# its controls block (4840 + 4n: this frame, last frame, newly pressed, held: 07924D-079265); nothing reads it through
# the record
field player 11 controls u16
# its object's hit points (the player object 4A40 + C0 x player's field 1B, which 07C2E0 "LDA #$1B,X; SUBA #$1C,U"
# lowers by the hitter's power): 07B7A8 "STA [#$13,X]" (28) when it joins
field player 13 object_life u16
# its object's kind (field 04, the sprite set): 07A0EC "LDA <$F0", 07A0EF "STA [#$15,U]" (07A174-07A177 likewise
# through X): the player's number (00 marge, 01 homer, 02 bart, 03 lisa)
field player 15 object_kind u16
# its state (49D7 + 8n), by which 07B71E "LDA [#$17,X]; ASLA; JSR [A,Y]" runs the routines at E803: 0 out (07B731:
# credits make it 1), 1 may join (07B74F: start with a credit, lives from direct page 5A, then 2), 2 playing (07B7E8:
# no lives left makes it 3, 07B83F), 3 the continue countdown (07B843: a credit makes it 5, the countdown's end 4),
# 4 game over (07B897: C0 frames, then 0), 5 joining again (07B74F)
field player 17 state u16
# whether it plays (49F0 + n): 2 playing (07B7DF, 07B7EA), 1 while its continue countdown runs (07B83A, 07B845),
# 0 neither (07B731 "CLR [#$19,X]"); 07B8BA-07B8D8 and 07B901-07B922 "LDA $49F0; CMPA #$02" (anyone playing),
# 07B6BB "LDA ,X; CMPA #$02" (the life refilled at a stage's start)
field player 19 play_status u16

# the addresses of the players' newly pressed controls (4842, 4846, 484A, 484E: the same as each player record's
# field 00): 07979A "LDX #$E449", 07979D "LDA <$F0; ASLA", 0797A1 "LDA [A,X]; ANDA #$30" (the two buttons) for each
# player whose bit is in direct page 50 (07978C "LDB <$50", 4 of them: 079792 "CMPA #$04"): any of them skips (a story);
# kref: 0797A1 reads 07E449-07E450
07E449  table  player_presses[4]  u16

# what the score jobs add to a player's score (by the job's argument B): 0796FF "LDU #$E445", 079702 "ASLB", 079703
# "LEAU B,U", 079705 "LDA #$01,U; ADDA #$01,X; DAA; STA #$01,X", 07970F "LDA ,U; ADCA ,X; DAA; STA ,X": a BCD word
# (0000, 0001) added to the score at X (the jobs 03-06 of the main loop's job table E3FB: 0789E4 "LDX #$E3FB; ASLA;
# JSR [A,X]", entries 079828-07983A).
struct score_addition 02 rom
field score_addition 00 high u8
field score_addition 01 low u8
07E445  table  score_additions[2]  score_addition

# ======== the attract's demos ========
# demos holds the demos' addresses (07A0A4 "LDX #$E6A1; LDA <$5E; ASLA; LDX A,X") each a demo record; the
# players' inputs are a field a player (07A0D2 "LDY #$5810", 07A0F2 "LDU ,X++" once for each of the 4 players, 07A0F4
# "STU ,Y", Y 10 on a
# player: 07A117), each the address in bank 2C (07A0C8 "LDB #$2C; STB <$0E; SETLN <$0E") of that player's inputs
07E6A1  table  demos[3]  u16 demo
struct demo 0C rom
field demo 00 players u8
field demo 01 frames u16
field demo 03 step u8
field demo 04 marge_inputs u16 demo_input
field demo 06 homer_inputs u16 demo_input
field demo 08 bart_inputs u16 demo_input
field demo 0A lisa_inputs u16 demo_input
# (in the same function) the input step 07A0F2 loads, read 07A0F6 "LDA #$01,U" (its frames) and
# 07A0FC "LDA ,U" (its controls); and the player record 07A101 "PULLS U" brings
# back (07A103 "CLR [#$04,U]", 07A114 "STA [#$17,U]")

# ======== the steps and scenes ========

# the scene of each step of the game: 07BA87 "LDX #$E88D", 07BA8A "LDA <$03", 07BA8D "LDA A,X", 07BA8F "STA <$67"
# (steps 2 and 3, stage 1 and its bonus, scene 0; 4 stage 2 scene 1; 6-7 stage 3 scenes 3-4; 8 4 scene 5... 15 stage 8
# scene 0B; 12, bonus 2, scene 0); kref: 07BA8D reads 07E88F-07E89C (steps 2-15)
07E88D  table  step_scenes[16]  u8

# the objects' sprites' priority against the tile layers, by the step (all 05): 079ADD "LDX #$E574", 079AE0 "LDA
# <$03", 079AE3 "LDA A,X", 079AE5 "STA <$FA"; an object without its own (field 09 bits 4-5 clear: 079DE2-079DE7) takes
# it (079DF7 "LDA <$FA; STA <$FB"), into its sprites' colour word's high byte (079C18 "LDA <$FB", 079C29 "STD #$0C,Y"),
# which the K053246's callback in simpsons.cpp takes as the priority ((color & 0x0f80) >> 6); kref: 07E574-07E584
07E574  table  step_sprite_priorities[17]  u8

# a routine in bank 1F each scene runs while its stage plays: by the scene (07B5B6 "LDX #$E7D3", 07B5B9 "LDA <$67",
# 07B5BC "ASLA; ASLA; LEAX A,X"), its bank (07B5C2 "LDB ,X+; STB <$0E; SETLN <$0E") and the routine (07B5CC "JSR
# [,X]"), in the steps' playing substep (07A5E0 "LBRA $B5A9", substep 3 of step 2's table E707). Bank 1F's put the
# actor at 5640 to a story script (03E804 "LDX #$5640; LDA #$38; STA #$30,X; LBRA $605A"; 03E05A starts it when the
# actor is free); scenes 2, 7 and 0A (the stories') have 07B6A4 ("CLRA; RTS"); byte 3 is 00 in all and nothing reads
# it. kref: 07B5C2 reads 07E7D3-07E7FF.
struct scene_routine 04 rom
field scene_routine 00 bank u8
field scene_routine 01 routine u16
field scene_routine 03 spare u8
07E7D3  table  scene_routines[12]  scene_routine

# ======== the palette jobs ========

# what a palette request starts, by its kind in direct page 7E (07BAC9 "LDX #$BADA", 07BACE "LDA <$7E", 07BAD1 "ASLA",
# 07BAD2 "LDX A,X", 07BAD6 "JSR ,X"): each takes a free slot of the jobs at 3C00 (07BF39: 40 of 8 bytes, run each frame
# by 07BC8B "LDX #$BCAA; ASLA; JSR [A,X]") and writes its job: 0 and 1 a load of palette sets (BAEC: job 1), 2 a
# palette effect from bank 2E (BB1F: job 2), 3 the background colour (BB71: job 3, which 07BDF6 "LDD #$01,U; STD
# $0C00" sets), 4 and 5 a fade of the ranges the request's bits name (BB85: job 4 darkens, 5 brightens), 6 the palette
# RAM's 0C00-0DFF filled with FFFF (BBF6: job 6), 7 a clear of palette ranges (BC78: job 7), 8 the effect again in
# the caller's slot when it runs one (BB12 "LDA ,U; CMPA #$02; BNE $BB1F"); kref: 07BAD2 reads 07BADC-07BAEB
07BADA  table  palette_request_handlers[9]  u16

# a palette effect's start, in bank 2E (07BB35 "LDB #$2E", 07BB37 "STB <$0E", 07BB3A "SETLN <$0E"), by the request's
# number D (07BB45 "LDX #$6000", 07BB48 "LDD <$E8; ASLB; ROLA", 07BB4D "LDX D,X"): after 2 bytes (07BB4F "LEAX
# #$02,X") the colours a step sets less one (07BB52 "LDA ,X+; STA #$06,U": 07BD51-07BD62 count it down to 0) and the
# frames between steps (07BB57 "LDA ,X+; STA #$04,U; STA #$05,U": 07BD0D "LDA #$04,U; CMPA #$05,U"), then the steps
# (07BB5F "STX #$02,U": address and colour, 4 bytes a colour). Byte 0 is 80, where a run backwards stops (07BD85 "LEAX
# #$-08,X; LDA ,X; BPL"); byte 1 nothing reads. The table at bank 2E's 6000: 146 bytes (kref: 07BB4D reads
# 05C000-05C091).
struct palette_effect 04 rom
field palette_effect 00 stop u8
field palette_effect 01 spare u8
field palette_effect 02 extra_colours u8
field palette_effect 03 delay u8
05C000  table  palette_effects[73]  u16 palette_effect
# a step of a palette effect's script, after its header: a colour's place in the palette RAM and the colour (07BD57
# "LDY ,X++; LDD ,X++; STD ,Y", the job's byte 6 more colours a step: 07BD51 "LDA #$06,U"), X the script's place, which
# the job keeps at its byte 2 (07BD67 "STX #$02,U"); 07BD6C the same, then back two steps to run them again
struct palette_effect_step 04 rom
field palette_effect_step 00 address u16
field palette_effect_step 02 colour u16

# the palette sets (already named) point at their loads (07BCDC "LDY B,X", 07BCEA "LDU ,Y", 07BCEC "LDX #$02,Y",
# 07BCEF "LDA #$04,Y", 07BCF5 "LEAY #$05,Y"): the tables get the struct
07E9CB  table  palette_sets[14]  u16 palette_load
07EAEB  table  palette_sets_high[19]  u16 palette_load
# 07BCBA keeps either table in X (07BCCE "LDX #$E9CB", or from 80 07BCD6 "LDX #$EAEB; ANDB #$7F") and reads 07BCDC
# "LDY B,X"
elements palette_set u16 palette_load

# the palette ranges a fade works on, one a step of the fade (the job's byte 7, 0-15: 07BE24 "CMPA #$10" starts it
# again): 07BE4D "LDX #$E97F", 07BE50 "LDA #$07,U; ASLA; ASLA; LEAX A,X", 07BE57 "LDA ,X+; STA <$F1" the colours,
# 07BE5C "LDU ,X" the first one's address in the palette RAM, each darkened or brightened (07BE5E "LDY #$E97B; LDA
# <$F0; ASLA; JSR [A,Y]": 07BF94 takes a step off each component, 07BFD1 adds one) a colour at a time (07BE67 "LEAU
# #$02,U; DEC <$F1"), when the job's mask has the step's bit (07BE34 "LDA #$06,U; ANDA #$01", 07BE71 "LSRW #$05,U";
# the mask from the request's bits, 07BB85-07BBF2: bit 0 steps 0-1, 1 steps 2-3, 2 steps 4-5, 3 steps 6-13, 4 step
# 14). 15 records: 32 colours at 0400 0440 0800 0840 0A00 0A40 0000 0040... 01C0, and 1 at 0C00; byte 3 is 00 in all,
# nothing reads it. kref: 07BE57/07BE5C read 07E987-07E9B9.
struct fade_range 04 rom
field fade_range 00 colours u8
field fade_range 01 address u16
field fade_range 03 spare u8
07E97F  table  fade_ranges[15]  fade_range

# the palette ranges job 7 clears, one a bit of the request (07BEFB "LDA #$01,U; STA <$F1", 07BF04 "ANDA #$01", 4 of
# them: 07BF24 "CMPA #$04"): 07BF08 "LDX #$E9BB", 07BF0B "LDA <$F0; ASLA; ASLA; LEAX A,X", 07BF12 "LDU ,X++" the bytes
# after the first, 07BF14 "LDX ,X" where, 07BF16 "LEAY ,X; CLR ,X+; BMOVE Y,X,U" (007F 0400, 007F 0800, 007F 0A00,
# 01FF 0000).
struct palette_clear 04 rom
field palette_clear 00 extra_bytes u16
field palette_clear 02 address u16
07E9BB  table  palette_clears[4]  palette_clear

# the palette effects an object's colours take as it loses its hit points (0786BF "LBRA $E496"): by the caller's B
# (07E4F1 "LDY #$E526", 07E4F4 "LDA <$E9; ASLA; LDY A,Y"; at the start 07E515 "LDU #$E526", 07E51C "LDD [A,U]", a new
# effect, 07E510 "LDA #$02; STA <$7E", its slot kept in field 54: 07E521 "STU #$54,X"), a row of 6 effect numbers by
# a level (07E4FA "LDA <$EA; ASLA; LDD A,Y", 07E500 "LBSR $BAC7" with 07E4EC "LDA #$08; STA <$7E": the effect again in
# its slot). The level is 0 when its hit points (field 1B, which 07C274 "LDA #$1B,X; SUBA #$1C,U" lowers by the
# hitter's power) are gone (07E49E "TST #$1B,X"), else 1-5 by how much of the last 5 x A of them is left (07E4AF-
# 07E4DD, A the caller's step by the players in the game, e.g. 021307 "LDU #$7E75; LDA <$57; DECA; LDA A,U"); 5 changes
# nothing (07E4DB "CMPB #$05; BNE"), and a level counts only below the last one (07E4E4 "CMPA #$53,X; BCC").
# Callers: bank 10's object B=0 (021310 "CLRB"), bank 13's B=1 (02652C), bank 1E's two B=2 (03C348) and B=3 (03C8BC),
# bank 11's B=4 (022A6A). kref: 07E4FE reads the first 5 words of each row, never the sixth
struct hurt_effect_row 0C rom
# at the start, and again when its hit points are gone
field hurt_effect_row 00 normal u16
field hurt_effect_row 02 fifth_left u16
field hurt_effect_row 04 two_fifths_left u16
field hurt_effect_row 06 three_fifths_left u16
field hurt_effect_row 08 four_fifths_left u16
# level 5, which changes nothing: never read
field hurt_effect_row 0A all_left u16
07E526  table  hurt_effect_rows[5]  u16 hurt_effect_row

# ======== the sprites' animations ========
# 079AE9 picks an object's animation set by its kind (field 04, 079B03 "LDB #$04,X"): 079B08 "LDU #$E591; ASLB; ROLA;
# LEAU D,U" (from 80, 079B21 "LDU #$E5BB"), the set's bank (079B11 / 079B2A "LDB ,U+; STB <$0E; SETLN <$0E") and its
# index's offset (079B1B / 079B34 "LDB ,U")
# then the set's table of animations from the index at the start of that bank (079B3E "LDU #$6000; CLRA", 079B42 "LDU
# D,U": data_walk.py's set index), and the animation by field 05 (079B69 "ASLB;
# ROLA", 079B6B "LDU D,U"), then the frame by field 07 (079B6D "LDA #$07,X; ASLA; ASLA; LEAU A,U"). The bank is
# whichever animation_sets gave, so the index is no table of its own: a pointer typed by the instruction that loads it
elements animation_set_index u16 animation_table
elements animation_table u16

# ======== the background ========

# the tile layers' records: layer_maps holds their addresses (07C618 "LDX #$EC9D; ASLA; LDX A,X") each a layer_map
# record.
# Its field 08: the address (48C8, 48D8) of the copy of the scroll y the IRQ keeps (0790FA "LDD <$C5; STD <$C8",
# 079106 "LDD <$D5; STD <$D8"; 07C399 "LDD <$C8" checks it against the scroll); nothing reads it through the record
07EC9D  table  layer_maps[2]  u16 layer_map
field layer_map 08 last_scroll_y u16

# an area of a scene: where its tile blocks (block_scenes) or its map (map_scenes) are and the bank (07C8D6 "LDB
# #$02,Y; STB <$0E; SETLN <$0E", 07C8E1 "LDY ,Y"; 07C5C9 "LDA #$02,Y; STA <$9E", 07C5DC "LDY ,Y"); byte 3 is 00 in all
# 125 (assets maps.txt "area REF BANK 00") and nothing reads it
struct scene_area 04 rom
field scene_area 00 address u16
field scene_area 02 bank u8
field scene_area 03 spare u8
# the scene tables (already named) hold each scene's list of areas (07C8CB "LDY A,Y", then 07C8CD "LDA <$76; ASLA;
# ASLA; LEAY A,Y" by the area): they get the struct
07ECC9  table  block_scenes_a[4]  u16 scene_area
07ECE9  table  block_scenes_b[4]  u16 scene_area
07ECF9  table  map_scenes_a[4]  u16 scene_area
07ED19  table  map_scenes_b[4]  u16 scene_area
07ED29  table  block_scenes_a_high[15]  u16 scene_area
07EDBB  table  block_scenes_b_high[15]  u16 scene_area
07EE41  table  map_scenes_a_high[15]  u16 scene_area
07EED3  table  map_scenes_b_high[15]  u16 scene_area
# 07C8BD and 07C8F7 keep one of two tables in Y by the scene's bit 7 (07C8BD "LDY #$ECC9", 07C8C5 "LDY #$ED29";
# 07C8F7 "LDY #$ECE9", 07C8FF "LDY #$EDBB") and read 07C8CB / 07C905 "LDY A,Y"
elements scene_area_list u16 scene_area
# (optional, same reads through the layer's record: 07C5B2 "LDY #$06,X", 07C5BA "LDY #$10,X", 07C5C0 "LDY A,Y")
field layer_map 06 maps u16 scene_area_list
field layer_map 10 maps_high u16 scene_area_list

# the K052109's tile ROM banks of an area: 07C947 "LDA ,Y+; STA $1D80" (MAME k052109.cpp: banks 0 and 1), 07C94D
# "LDA ,Y+; STA $1F00" (banks 2 and 3)
struct layer_mode 02 rom
field layer_mode 00 tile_banks_01 u8
field layer_mode 01 tile_banks_23 u8
07EF55  table  layer_modes[4]  u16 layer_mode
07EF63  table  layer_modes_high[15]  u16 layer_mode
# 07C931 "LDY #$EF55" / 07C939 "LDY #$EF63", 07C93F "LDY A,Y", 07C941 "LDA <$76; ASLA; LEAY A,Y"
elements layer_mode_list u16 layer_mode

# a picture of tiles (tile_picture_place's field 03, 07C538 "LDU ,U"): its width (07C53A "LDA ,U+; STA <$F0": the tiles
# of a row, 07C566 "LDA #$40; SUBA <$F0; LEAX A,X" to the next), its height (07C53F "LDA ,U+; STA <$F2", the rows) and
# the colour its tiles take (07C544 "LDA ,U+; STA <$F3", 07C552 "STB #$-2000,X"), then a tile a byte (07C556 "LDA ,U+")
struct tile_picture 03 rom
field tile_picture 00 width u8
field tile_picture 01 height u8
field tile_picture 02 colour u8
field tile_picture_place 03 picture u16 tile_picture
07EFB5  table  tile_pictures[1]  u16 tile_picture_place
# 07C51C "LDU #$EFB5" then a branch (bit 7 of the number draws it blank: 07C522-07C524), 07C528 "LDU A,U"
elements tile_picture_entry u16 tile_picture_place

# ======== the stage's enemies ========

# the most enemies a stage has in before it puts in no more: direct page 6B's (the stage's difficulty) (07CB06 "LDU
# #$F000", 07CB09 "LDA <$6B", 07CB0C "LDA A,U", 07CB0E "STA $1885") plus the scene's (07CB12 "LDU #$F008", 07CB15 "LDA
# <$67", 07CB18 "LDA A,U", 07CB1A "ADDA $1885"); in the cemetery (direct page 8D, set only at 07AABF after 07AAA5 "LDA
# #$87; STA <$75": stage_3_cemetery) by the players in the game instead (07CAFC "LDU #$F014", 07CAFF "LDA <$57",
# 07CB02 "LDA A,U"; entry 0 unused). Compared with the enemies (07CB2C "CMPA $1876"; 07CB89 "INC $1876": the objects of
# the list at 4F80 whose field 42 has bit 7 clear): over it, 07C9A0 "LBSR $CAEA; BCC" skips the spawns of the frame
# (in the cemetery 07C9D0, each spawn of that list). kref: 07CB0C reads 07F000-07F004, 07CB18 all, 07CB02 07F018
07F000  table  enemy_limits_by_difficulty[8]  u8
07F008  table  extra_enemies_by_scene[12]  u8
07F014  table  cemetery_enemy_limits_by_players[5]  u8
# the most enemies that go after one player (1877, 07D4BA "LDA #$45,U; CMPA $1877": over it, 07CC38 picks the player
# the fewest go after, by its field 45): the enemies (1876, up to 15: 07CC5A "CMPA #$10" gives 4 from 16) shared out
# between the players in the game, rounded up, a row of 16 for 2, 3 and 4 players (07CC7B "LDU #$F031", 07CC7E
# "DECA; ASLA x4; LEAU A,U", 07CC85 "LDA B,U; STA $1877"; one player takes the count itself, 07CC76); kref:
# 07F031-07F059
07F031  table  attackers_per_player[48]  u8

# ======== the objects' dispatchers: the bank of each type's handler ========
# Each list of objects runs its objects' handlers by their type (field 01, signed: types run below 0): "LDD #$01,X",
# the bank "LDB A,U; STB <$0E; SETLN <$0E", the handler "ASLA; JSR [A,U]" from the table after. The handler tables
# (F2EC, F40D, F4F4, F577, F5A2) and the bank tables share the bytes: each bank table's negative types are the end of
# the handler table before it, and the bytes after its type 3F are the start of the next list's handler table for its
# negative types. Counts: the asset pieces' (each bank table and the handler words that follow it, up to the next table)
# the list at 4F80 (8 objects; spawn list 0, object_lists' first), the enemies: 07CB62 "LDX #$4F80", 07CB6C "LDU
# #$F387", 07CB74 "LDB A,U", 07CB7E "LDU #$F2EC; ASLA; JSR [A,U]", and each counted unless its field 42 has bit 7
# (07CB84-07CB89 "INC $1876", the count the enemy limits above hold the stage to); kref: 07CB74 reads 07F36D-07F3C6
# (types -26 to 3F); 07F3C7-07F40C are the next list's handlers for its types -35 to -1 (07CBC3 reads 07F3C7-07F48C)
07F387  table  enemy_banks[134]  u8
# the list at 5280 (10 objects; spawn list 1): 07CBA3 "LDX #$5280", 07CBAD "LDU #$F4B0", 07CBB5 "LDB A,U", 07CBBF "LDU
# #$F40D; ASLA; JSR [A,U]", counted at 07CBC5 "INC $1879" (which nothing reads); kref: 07CBB5 reads 07F48D-07F4EF
# (types -35 to 3F); 07F4F0-07F4F3 are the next list's handlers for its types -2 and -1 (07CBF6 reads 07F4F0-07F549).
# Named by its place in object_lists: what the list holds is not established (its types 00 and 01 are bank 16's
# object, whose kinds are 0F police_car_and_doors and 12: 02DE3F)
07F4B0  table  object_list_1_banks[68]  u8
# the list at 4D40 (6 objects; spawn list 2), where the child objects go (07CA9E "LDB #$02; LBSR $CA54", from 07862F:
# an object born at an offset from its parent's place): 07CBD6 "LDX #$4D40", 07CBE0 "LDU #$F54C", 07CBE8 "LDB A,U",
# 07CBF2 "LDU #$F4F4; ASLA; JSR [A,U]"; kref: 07CBE8 reads 07F54A-07F576 (types -2 to 2A)
07F54C  table  child_object_banks[43]  u8
# the list at 5640 (1 object; spawn list 3, 66 of its 78 spawns type 00): the stage's events: its types 00 and 01 are
# bank 15's object (02A05A "LBRA $6D6B", 02A05D "LBRA $6D85"; one of its steps waits until no enemy is left, 02AD47
# "LDA $1876; BNE", then a sound, 02AD52 "LDD #$9300; LBSR $8680", and two child objects, 02AD5B-02AD64; its tables
# object_15_* at 02AD8F), its type 03 bank 1F's (03E015 "LBRA $6888"), whose code works on the object at 5640 (03E804-
# 03E9E4), the actor the scenes' routines start on a story script (scene_routines); 07CC05 "LDX #$5640", 07CC0F "LDU
# #$F581", 07CC17 "LDB A,U", 07CC21 "LDU #$F577; ASLA; JSR [A,U]"; kref: 07CC17 reads 07F581-07F585
07F581  table  stage_event_banks[5]  u8
# by the object's field 28, the action the fixed program's routines run (07D604-07D626 pick it from the enemy's
# behaviour: "LDA B,U; STA #$28,X"; 07D62F "LDU #$F586; ASLA; JSR [A,U]" the fixed program's own): the bank of an
# action's handler in the banks (07D63B, the jump vector 0785DE: 07D64C "LDU #$F620", 07D64F "LDD #$28,X", 07D654 "LDB
# A,U", 07D65E "LDU #$F5A2; ASLA; JSR [A,U]"); kref: 07D654 reads 07F620-07F65E
07F620  table  action_banks[63]  u8
# the like for the unused dispatcher 07D47E (07D484 "LDU #$F661; LDB A,U"), next to unused_object_handlers
07F661  table  unused_object_banks[1]  u8

# the animation an object shows in the fixed program's shared hit reaction (07865C "LBRA $E1D3": by field 29, 07E1D3
# "LDU #$F29E; LDA #$29,X; ASLA; JSR [A,U]"), by its field 28 (07E1FB "LDU #$F2AC", 07E1FE "LDA #$28,X", 07E205 / 07E239
# "LDA A,U; ORA #$80; STA #$05,X": field 05, started again); 0-1 stand (07E240 "CLRW #$0F,X"), 2 on are thrown back
# (07E20F "LDD #$0400; STD #$19,X", 07E215 "LDD #$FE00; STD #$0F,X"). kref: 07E239 reads 07F2AC-07F2AD, 07E205
# 07F2AE-07F2B5 (field 28 0-9). Count 10, not the piece's 64: 07F2B8 on is the enemies' handler table for their types
# -26 to -1 (F2EC less 2 x 26; 07CB82 reads 07F2B8-07F36B), and 07F2B6-07F2B7 (60 6F) look like one more handler word
# (type -27, whose bank byte 07F36C is 17) that no scenario reaches
07F2AC  table  hit_animations[64]  u8
# U holds the table's address (07E1FB) and, later, field 25's object (07E21B "LDU #$25,X"): the table's, typed
elements hit_animation u8

# ======== moving: the sines, the angle, the jumps ========
# a quarter of a sine wave, 0-90 degrees in 64 steps, 128 at 90 (sin x 128: 0, 3, 6 ... 5B at 32 ... 80 at 64):
# 07CCA0 "LDU #$F061", 07CCA3-07CCB0 fold the angle (0-FF, 40 = 90 degrees) to 0-40, 07CCB1 "LDA A,U", 07CCB6 "MUL"
# by the speed, 07CCB7 "LSRDI #$04", negated past 80 (07CCBE "NEGD"); 07CC8E puts the two (sine and, 40 on, cosine)
# into the speeds 14 and 0F; kref: 07CCB1 reads 07F061-07F0A1. (Read through U; its piece neighbours
# the next two)
07F061  table  sines[65]  u8
# the same quarter at 20 (sin x 20: 0 ... 0E at 32 ... 14 at 64), times 16 as a speed: 07CCC0 "LDU #$F0A2", 07CCD1 "LDB
# A,U; CLRA; ASLDI #$04" (07CCDD: fields 14 and 0F); kref: 07CCD1 reads 07F0A2-07F0E2
07F0A2  table  sines_20[65]  u8
# the arctangent, in 256ths of a turn, of 0-64 sixty-fourths (0 ... 20 at 64, 45 degrees): the direction from X's object
# to U's (07CCFD "LDD #$0C,U", 07CD00 "SUBD #$0C,X"; 07CD0A "LDD #$11,U", 07CD0D "SUBD #$11,X"): the shorter distance
# over the longer,
# both shifted so the longer fits in a byte (07CD1C-07CD3A), divided (07CD42 "DIV X,B"), the quotient the index (07CD43
# "LDD #$F0E3", 07CD46 "LDA D,X"; the other way 07CD71-07CD78 "LDA D,X; SUBA #$40; NEGA"), then the quadrant by the
# signs (07CD79-07CD8D); kref: 07CD46 reads 07F0E3-07F123. It is the second half of the piece 07F0A2
# (130 bytes): with sines_20 at 65 the piece's two tables are 65 and 65
07F0E3  table  arctangents[65]  u8
# the speed up (into field 19, 16 times this: 07CDE0 "LDB A,U; CLRA; ASLDI #$04", 07CDE5 "STD #$19,X"; 079A18-079A2A
# add it to the height in 16) an object jumps with to a floor N steps of 8 pixels above the one it is on: N = field 45
# (the floor the block flags give: 07CEB1 "ANDA #$0F; STA #$45,X"; 07CF0E "LDB #$45,X; ASLDI #$03; CMPD #$16,X") less
# field 5D / 8 (07CDD6 "LDB #$5D,X; LSRB x3"; 07CE13-07CE18 the floor x 8): 07CDD3 "LDU #$F124", 07CDDE "SUBA ,S+";
# from 07D6D6, 07D70F, 07D739, 07D763 (the actions 07D6C4-07D751, each with "LDA #$45,X" first). Entry 1 (90) is out
# of line with 2-15 (7A up by 2);
# kref: 07CDE0 reads 07F126-07F130
07F124  table  climb_speeds[16]  u8

# ======== the work RAM's structures ========
# An object: 0x60 bytes, 33 of them from 4A40 (the profile's STRUCT_ARRAYS): the 4 players' objects and their partners
# (4A40 + C0 x player, + 60), then the lists object_lists gives (4D40 x 6, 4F80 x 8, 5280 x 10, 5640 x 1). A field
# nothing names here is unk_XX in the C, at the width the code uses it most
struct object 60
# a free slot where 0 (the free-slot search 07CA5F "LDB #$00,U; BNE"); the dispatchers run the object where above 1
# (07CB65 "LDA #$00,X; CMPA #$01; BLS")
field object 00 flags u8
# the type the list's dispatcher runs it by: its handler's bank and address by the type, signed (07CB6F "LDD
# #$01,X", 07CB74 "LDB A,U": types below 0 run too)
field object 01 type s8

# ======== the engine ========
# Names for the fixed program's engine: 078000-079FFF (the jump table, the boot, the interrupts, the main loop's jobs,
# the text printers, the floor map, the sprite engine, the attract's first scenes) and 07E000-07FFFF (the enemies'
# shared reactions), and the common fields of struct object.
# symbols.txt syntax. Evidence: build/listing/simpsons.s (quoted as PLACE "INSTRUCTION"), the C of src/, the data in
# assets/data/ (texts.txt, tables.txt, objects.txt) and the existing notes of symbols.txt.
#
# Conventions of this part:
# - an object's place: 0C x, 11 y, 16 z (its height), as symbols.txt's child_object (dx dy dz), part (dx dy dz),
#   bluebird_launch (x_speed y_speed z_speed: 0F 14 19), test_player (x 0C, z 16) and velocity (x_speed, y_speed) have
#   them. y is the place on the floor (the sprites' y is y + z: 079C50-079C59), z the height above it.
# - the fixed program's jump table (078593-0786CB, an "LBRA" each, which the banks call): an entry that only jumps is
#   named vector_ + what its routine does (the routine itself, in 07A000-07DFFF, is named elsewhere; the names here
#   follow what the routine does). An entry the decompiler folded its
#   routine into (the routine has no other caller: its code is in the entry's C function) gets the routine's own name.
# - the enemies' shared reactions (field 28 the action, 29 its step) are named enemy_<reaction>_<step>, so each
#   reaction is a family.

# ======== the objects' common fields (struct object) ========
# What the engine reads the same way in every object: the dispatchers (07CB62-07CC2E), the free-slot search (07CA54),
# the spawn (07C9B2-07CA4D) and child spawn (07CA8A-07CAE9), the setup (07D132), the sprite engine (079841-079E38),
# the mover (0798F5), the depth sort (079A37), the hit checks (07C13A-07C366), the landing (07D16E-07D1B6) and the
# enemies' shared routines (07CFEC-07E2D6). Each line's evidence is above it. Offsets the engine uses one way for the
# players and another for the enemies (45, 46, 49) are left to the families (see the report).

# the state the type's handler runs: the dispatchers load "LDD #$01,X" (07CB6F, 07CBB0, 07CBE3, 07CC12) and hand B to
# the handler, which switches on it (bank 18's "ASLB; JSR [B,U]"); the free-slot search and the spawns start it at 0
# (07CA6C-07CA72 clears the slot, 07C9FB "CLRW #$02,U", 07CAAE "CLRW #$02,U"); the hit routines set FE/FF (07CFDD
# "LDA #$FE", 07CFE1 "LDA #$FF"), the enemies' hit check 4 (07D019 "LDD #$8004", 07D01F "STB #$02,X"), the climbs 5
# (07CF91 "LDA #$05; STA #$02,X")
field object 02 state u8
# its sprite set: the sprite engine picks the bank and the set of animations by it (079B03 "LDB #$04,X; BMI", 079B08
# "LDU #$E591" animation_sets, 079B21 "LDU #$E5BB" animation_sets_high); the setup gives it (07D13B "STD #$04,X" with
# its animation); 00-03 are the players (07CFB5 "LDA #$04,U; CMPA #$03; BHI": a hit by a player)
field object 04 kind u8
# its animation in the set: bit 7 starts it again (079B59 "LDB #$05,X; BPL", 079B5E "CLR #$08,X; CLR #$07,X; ANDB
# #$7F; STB #$05,X"); an animation's end may give the next one (079BA1 "STA #$05,X")
field object 05 animation u8
# what the animation did, cleared each time the sprite engine draws it (079AFF "CLR #$06,X"): bit 0 the animation ran
# to its end (079B90 "LDB #$06,X; ORB #$01"), bit 1 the frame is a marked one (079BCA "ORB #$02": the frame's byte
# 0 bit 4); set by others: bit 7 draws it again at once (0798C2 "LDA #$06,X; BMI"; 07D1A7 "ORA #$80" at a landing), bit
# 6 skips its drawing (0798C7 "ANDA #$40; BNE" then "CLR #$06,X")
field object 06 animation_flags u8
# the frame of the animation it shows: 079B3B "INC #$07,X" when the frame's time is out, 079B6D "LDA #$07,X; ASLA;
# ASLA; LEAU A,U" (4 bytes a frame), 079BAA "STA #$07,X" (a jump back)
field object 07 frame u8
# the frames the frame stays: 079B36 "LDA #$08,X; BNE" (none left: the next frame), 079BBF "STA #$08,X" from the
# frame's byte 1, 0798DE "DEC #$08,X"
field object 08 frame_time u8
# its sprites' attributes: bit 6 faces left (the sprites flipped: 079B49 "LDA #$09,X; ANDA #$40", 079B50 "LDA #$10;
# ORA <$F4"; the hit box's x offset the other way: 07C13A-07C1CE; 07D249 sets it from field 36), bits 4-5 the priority
# against the layers (079DE2 "LDA #$09,X; ANDA #$30"; from the floor map's cell: 07CDC2-07CDCF), bit 7 the colour in
# bits 0-3 instead of the frame's (079C1B "LDB #$09,X; BMI", 079C27 "ANDB #$0F")
field object 09 attributes u8
# the zoom of its sprites, from 10 (normal) up, when flags bit 4 is set (079C3A "BITA #$10; LBNE $9CD4"): 079CE1
# "LDB #$0A,X" into the sprite's horizontal zoom (and the steps its x offsets take: zoom_steps), 0B its vertical one
# (the defeated enemy's 07E118 "LDD #$0A,X; ADDD #$0101; STD #$0A,X" as it goes into the distance)
field object 0A zoom_x u8
field object 0B zoom_y u8
# where it is on the screen across: the mover adds field 0F (079978 "LDD #$0D,X; ADDD #$0F,X; STD #$0D,X", 079985
# "ADCA #$0C,X") and the camera's move (07998E "ADDD #$0C,X"); the sprites' x is it plus the frame's offset (079C4A "ADDD #$0C,X; STD
# #$06,Y"); a spawn sets it from its x less the camera (07CA04 "LDD #$00,X; SUBD <$AC; ADDD #$0040; STD #$0C,U")
field object 0C x u16
# its fraction (07CA1E "CLR #$0E,U")
field object 0E x_fraction u8
# its speed across, 8.8 (the mover; 07CC8E-07CC9E "STD #$0F,X" from a direction, the cosine)
field object 0F x_speed s16
# where it is on the floor, the screen's y: the mover adds field 14 (0799FC "LDD #$12,X; ADDD #$14,X", 079A09 "ADCA
# #$11,X") and the camera's move (079A12 "ADDD #$11,X"); the sprites' y is it plus z (079C53 "ADDD #$11,X", 079C56
# "ADDD #$16,X"); the depth sort orders the objects by it (079A44 "LDD #$11,X"); a spawn: 07CA21-07CA2E
field object 11 y u16
field object 13 y_fraction u8
# its speed on the floor, 8.8 (07CC92 "STD #$14,X" from a direction, the sine)
field object 14 y_speed s16
# its height: the mover adds field 19 (079A18 "LDD #$19,X; BEQ", 079A1D "ADDD #$17,X"); the landing puts it on the
# floor under it once it is no more than 7 above it (07D182 "LDD #$5C,X; ADDD #$0007", 07D18E "CMPD <$E8; BHI",
# 07D196 "LDD #$5C,X; STD #$16,X")
field object 16 z u16
field object 18 z_fraction u8
# its speed up, 8.8: gravity takes 0060 a frame off it (07D16E "LDD #$19,X; SUBD #$0060; STD #$19,X"), at most F800
# down (07D179 "CMPA #$F8"); 0 on landing (07D193 "CLRW #$19,X")
field object 19 z_speed s16
# its vitality: the setup gives it (07D147 "LDA #$04,U; STA #$1B,X"), a hit takes the hitter's damage off it
# (07C274 "LDA #$1B,X; SUBA #$1C,U; BCC; CLRA; STA #$1B,X"); at 0 the hit defeats it (0786B9's 07D0BE "LDA #$1B,X;
# BEQ")
field object 1B vitality u8
# its attack, the hit box's first word (07D1B7 "LDD ,Y; STD #$1C,X"): the damage it does (07C277 "SUBA #$1C,U") and
# the kind of hit it gives, which the victim keeps when it beats what hit it already this frame (07C2F1 "CMPA #$1D,U;
# BGT", 07C2F6 "LDA #$1D,U; STA #$1E,X")
field object 1C damage u8
field object 1D attack u8
# the strongest attack that hit it this frame (flags bit 5 set with it: 07C302 "ORA #$20"), cleared by the hit check
# of the enemies (07C115 "CLR #$1E,X"); 11-14 are the attacks the enemies' shared reactions answer (07CFF4 "LDA
# #$1E,X; SUBA #$11; CMPA #$03": 11 and 12 a flinch or a knock-down, 13 a spin, 14 a knock-back: 07D05C-07D0B0)
field object 1E hit u8
# its hit box, from the setup's hit box record (07D1B7-07D1CE: words 1F, 21, 23): the hit check (07C13A-07C1D7) takes
# two boxes as touching when, in each of y, x and z, the distance between the places plus the offsets is within the
# sum of the two sizes: 07C13A "LDB #$23,X" (y offset, signed) and 07C155 "LDB #$20,X; ADDB #$20,U" (depth); 07C162
# "LDB #$22,X" (x offset, the other way when it faces left) and 07C1A7 "LDB #$1F,X; ADDB #$1F,U" (width); 07C1B5
# "LDB #$24,X" (z offset) and 07C1CF "LDB #$21,X; ADDB #$21,U" (height)
field object 1F box_width u8
field object 20 box_depth u8
field object 21 box_height u8
field object 22 box_dx s8
field object 23 box_dy s8
field object 24 box_dz u8
# the object whose attack hit it (07C290 "STU #$25,X", 07C2C6 "STX #$25,U"); the shared hit routines read its kind,
# place and speed (07D004 "LDU #$25,X", 07D02A "LDU #$25,X; LDD #$0F,U", 07E21B "LDU #$25,X; LDD #$0F,U")
field object 25 hit_by u16 object
# the points it is worth (the setup's byte 5, 07D14D "LDA #$05,U; ANDA #$7F; STA #$27,X"): bits 0-3 the score to
# add, bits 4-5 the player who gets them (07CFC2 "LDA #$5B,U; ANDA #$70" from the hitter), bit 6 none; bit 7 set when
# it goes (07D0E0 "ORA #$80"), which 07BA50 turns into the score job of that player (07BA5D-07BA7B, then "CLR #$27,X")
field object 27 points u8
# what it does: the enemies' action, by which their states run a routine (07D62C "LDD #$28,X" with the banks' tables
# F620/F5A2; the shared reactions 0785FC/078602/07D667 "LDD #$28,X" 00-0C), and the action's step (29: each action
# switches on it, "INC #$29,X" to the next); the hit routines pick the reaction (07D090 "STA #$28,X", 07D093 "CLR
# #$29,X")
field object 28 action u8
field object 29 action_step u8
# its behaviour, the record of the actions it picks by the distance to its player (enemy_behaviour: 07D3D7-07D3FD
# reads its ranges, 07D604-07D624 its states); 07D42F "LDU #$F144", 07D432 "STU #$2A,X" the goon's
# (behaviour_choice gives the others': 030154 "LDD #$02,U; STD #$2A,X")
field object 2A behaviour u16
# the distance across and on the floor to the player it goes after (07D35B: 07D361 "LDD #$0C,U; SUBD #$0C,X", made
# positive, 07D36A/07D377 "STD #$2C,X"; 07D37A "LDD #$11,U; SUBD #$11,X", 07D383/07D390 "STD #$2E,X"); the
# behaviour's ranges are by them (07D3D7-07D3FD)
field object 2C target_dx u16
field object 2E target_dy u16
# what the record that puts it in gives it: a spawn's state byte (07C9FE "LDA #$05,X; STA #$30,U") or a child
# object's (07CA92 "LDD #$06,Y; STA #$30,U"); each type reads it as it starts (the story actors' script, 03E09D; bank
# 15's object's kind); the goons' shared routines then keep in it their place by their player (07D49C: 0 coming, 1 at
# its side, 2 waiting, 3 attacking)
field object 30 parameter u8
# what stops its walk (07CDE9-07CF5E, cleared at a spawn: 07CA44 "CLR #$31,U"): bit 7 a wall, bits 0-1 which way (80
# and 81 moving on the floor with a negative or positive y speed, 82 and 83 across: 07CEBB-07CEFC, then 07CEFE "ORA
# #$31,X; STA #$31,X"), bit 3 nowhere to go (07CE95 "ORA #$88"), bit 4 kept from the last frame (07CDE9 "ANDA #$10"),
# bit 5 a floor at another height, bit 6 in the air (07CDFC "ORA #$40" when z is not the floor's); 07CF5F turns it
# into the action that climbs (07CF86 "LDA #$31,X; ANDA #$07; STA #$28,X")
field object 31 blocked u8
# whether the hit came from behind: the hit check takes its facing (07D022 "LDA #$09,X; ANDA #$40; STA #$33,X") and
# turns it when the hitter pushes it the way it faces (07D030-07D041 by the hitter's x speed or place); the shared
# reactions pick the forward or backward one by it (07D071-07D0B0, 0786B9)
field object 33 hit_from_behind u8
# the way to the player it goes after (07D35B: 07D35E "CLR #$36,X", 40 when the player is to the left, turned by C0
# when it is lower, 20 when farther on the floor than across); 07D249 faces it that way (bit 6 of attributes when 36
# - 40 is not negative); 07D268 picks the walk's animation by it
field object 36 target_direction u8
# the player it goes after (07D301: the nearest one, by |dx| + |dy|, "STU #$38,X"; 07D4CA "STU #$38,X" the least
# chased one when that one has enough attackers); the enemies' routines measure the way to it (07D49C "LDU #$38,X",
# 07D49F "LBSR $D35B")
field object 38 target u16 object
# the frames until it looks for the nearest player again (07D4A2 "DEC #$3A,X; BNE", 07D4A7 "LDA #$10; STA #$3A,X");
# the goon's setup starts it at 10 (07D435 "LDA #$10; STA #$3A,X")
field object 3A retarget_time u8
# a countdown, of frames: the shared reactions (07DF3B "DEC #$3B,X; BNE", 07E0FC and 07E155 "DEC #$3B,X") and nearly
# every handler of the banks (227 of its writes in the C are a decrement) count it down
field object 3B timer u8
# the object it was born from (07CAAB "STX #$40,U": a child object put in at an offset from it)
field object 40 parent u16 object
# the hit box record the setup gave it (07D141 "STY #$48,X"), which the reactions put back when it gets up (07DDE9,
# 07E252, 07E2C5 "LDY #$48,X; LBSR $85B4"): a hit_box record's address in its bank
field object 48 hit_box u16
# where its sprites are in the sprite RAM: 8 entries of 0x10 bytes from 2000 + 80 x its number (07955F "LDU #$2000", 079572
# "STU #$-07,X" past the object, 079575 "LEAU #$0080,U"), kept when the slot is cleared (07CA64 "LDD #$59,U", 07CA78 "STD
# #$59,U"); the sprite engine writes them (07988E "LDU #$59,X", 079A91 "LDU #$59,X")
# bits 0-3 the shadow sprite drawn under it (079E10 "LDA #$5B,X; ANDA #$0F", shadow_sprites), bits 4-6 the player it
# belongs to (the players and what they throw: 03812D-038134 "ASLB" x4, "ORB #$5B,U; STB #$5B,U", 039216-03921A
# "ASLA" x4, "STA #$5B,U"), which a hit passes to the victim's points (07CFC2/07D044 "LDA #$5B,U; ANDA #$70")
field object 5B shadow_player u8
# the height of the floor under it, from the floor map (07CDBC "STA #$5D,X": the cell's low 4 bits x 8); a spawn
# sets it with z (07CA3E "STD #$5C,U"); its shadow is drawn there (079DFE "LDD #$5C,X; ADDD #$11,X"); it lands on it
# (07D182 "LDD #$5C,X")
field object 5C floor_z u16
# the next object in the same row of the depth sort (079A37: 079A68 "LDD #$5E,Y" to the row's last, 079A6D "STX
# #$5E,Y"; 079ACA "LDU #$5E,X", 079AD0 "STD #$5E,X" cleared as it is walked)
field object 5E draw_next u16 object

# ---- the families of this part ----
# the enemy spun away (actions 7 and 8): the x speed it is thrown with, kept to start it again after a wall (07E057
# "STD #$3E,X" here, 07DFE0 in action 7's start; 07E009 "LDD #$3E,X" into 0F in the shared step 07DFE7)
scoped object enemy_spin 3E spin_x_speed s16
# the enemies with their own hit animations (07865C, the step routines 07E1E8-07E2D6): whether the defeated one
# blinks out (not 0) or gets up again as a plain goon (0: 07E276 "LDA #$43,X; BNE"); the banks' setups set it (18
# times "LDA #$01; STA #$43,X", 10 times 0)
scoped object enemy_hurt 43 vanishes u8
# the sound queued on the marked frame of the defeated one's animation (07E289 "LDA #$06,X; ANDA #$02", 07E290
# "LDD #$4C,X; LBSR $97D3")
scoped object enemy_hurt 4C frame_sound u16
# the bosses' colours as they lose vitality (0786BF, the routine at 07E496): the palette effect's level, 5 unhurt
# (07E505 "LDA #$05", 07E507 "STA #$53,X" at the start, 07E4E4 "CMPA #$53,X; BCC": only a lower one counts), the
# palette job's slot (07E521 "STU #$54,X"; 0 none yet: 07E4A3 "LDU #$54,X"), the vitality it started with (07E50A
# "LDA #$1B,X", 07E50D "STA #$56,X")
scoped object boss_shade 53 shade_level u8
scoped object boss_shade 54 shade_job u16
scoped object boss_shade 56 full_vitality u8

# ======== files ========
# Replace the provisional lines 078000 unsorted/fixed_3C, 0791D8 unsorted/fixed_3C and 07E000 unsorted/fixed_3F
# (0786CE system/boot and 078F43 system/interrupts stay). The jump table's entries come first in the fixed program,
# each a routine or a jump to one: they stay together, as the original's table of entry points for the banks.
078000  file  system/jump_table    # the fixed program's entry points for the banks (an LBRA each) and the routines the decompiler folded into them
0791D8  file  system/inputs    # the coin slots, the credits and the players' controls, read at each IRQ
079269  file  video/clear    # clearing the K052109's three tile layers and the sprite RAM
079311  file  video/text    # the text printers: the game's texts, texts at an address, hex digits
079495  file  engine/floor    # the floor map (work RAM 4000): the cell under an object or where its speeds take it
079548  file  system/random    # the random number
07955F  file  engine/objects    # clearing the objects' slots, all of them or a list's
07960F  file  system/reset    # clearing the variables of a stage, of a game, and the scores
0796FD  file  game/score    # the players' scores and the high score table
079784  file  game/skip    # whether a player's button skips what is on (a story)
0797B7  file  system/jobs    # the queues: the main loop's jobs and the sound commands for the Z80, and the jobs themselves
079841  file  video/sprites    # the sprite engine: the objects' animations, their moves, the depth sort and their sprites
079E39  file  attract/sequence    # the attract mode: its scenes until a credit starts the game
07E010  file  enemies/reactions    # the enemies' shared reactions: spun away, defeated and knocked into the distance, fallen into a pit
07E18F  file  objects/fireman_goon_effect    # an object that shows kind 90's animation 11 once
07E1AE  file  enemies/hurt    # the hit reaction of the enemies with their own hit animations, and the plain goon they turn into

# ======== the jump table (078593-0786CB) ========
# Entries that only jump: vector_ and their routine's name (the routine is in fixed_3D/3E, named elsewhere, unless the
# comment names one of this file). The entries nothing calls keep their names (unused_vector_enemy_leave_side ...).

# 07CF97, folded here: 07CF97 "LDA #$00,X; BITA #$20" (hit this frame), 07CF9E "LDA #$1E,X" (11-15), the state not
# negative, 07CFBC "INC #$2A,U; STX #$49,U" on a player who hit an enemy, 07CFC2 the points' player, then flags 80,
# 07CFDD "LDA #$FE" (no vitality left) or 07CFE1 "LDA #$FF" into the state, 07CFE6 "CLRW #$28,X". Called by list 1
# and 2 objects' handlers (02C006, 02C00F, 02A075...)
078593  func  object_take_special_hit
comment object_take_special_hit When the object was hit this frame by an attack of kind 11 to 15 and is not reacting already: counts the hit for the player who hit an enemy, gives the hitter's player its points, and sends it to its state FF, or FE when its vitality is gone, with its action cleared and its flags 80 (shown, not hit again).
# 07D056 "LBSR $CFEC", then by field hit less 11 (07D056-07D06F)
078596  func  vector_enemy_take_special_hit
comment vector_enemy_take_special_hit Jumps to the enemies' hit check: an attack of kind 11 to 14 starts the reaction it calls for (a flinch, a knock-down, a spin or a knock-back).
# 07D0E0 "LDA #$27,X; ORA #$80; STA #$27,X", then 07D0E8 (its player one attacker less, its side freed)
078599  func  vector_enemy_score_and_release
comment vector_enemy_score_and_release Jumps to the routine that marks a gone enemy's points to be scored and frees its place by the player it went after.
# 07D0FC, folded here: 07D0FC "LDB #$09,X; ANDB #$BF", "LDA #$36,X; SUBA #$40", then "ORB #$40" unless negative, "STB
# #$09,X"; the same as 07D249 (0785C9)
07859C  func  face_target
comment face_target Turns the object to face the way field target_direction points (left when it is 40 to BF).
# 07D10E "LDA #$30,X; CMPA #$01; BNE", then 07D115
07859F  func  vector_enemy_leave_side
comment vector_enemy_leave_side Jumps to the routine that frees the enemy's place at its player's side when it holds one (parameter 1).
# 07936D (in this file)
0785A5  func  vector_print_text
comment vector_print_text Jumps to print_text.
# 07D132
0785AB  func  vector_object_setup
comment vector_object_setup Jumps to the object setup: kind and animation, hit box, vitality and points from the record at U, and its priority from the floor under it.
# 07D16E
0785B1  func  vector_apply_gravity
comment vector_apply_gravity Jumps to the routine that takes gravity off the object's z speed and lands it on the floor (carry when it lands).
# 07D1B7
0785B4  func  vector_set_hit_box
comment vector_set_hit_box Jumps to the routine that copies the hit box record at Y into the object's attack and box fields.
# 07D1F7
0785B7  func  vector_remove_past_right_edge
comment vector_remove_past_right_edge Jumps to the routine that removes the object once its x is past 01C0, scoring or releasing an enemy.
# 07D1CF
0785BA  func  vector_stop_at_screen_edges
comment vector_stop_at_screen_edges Jumps to the routine that stops the object's x speed when its x is outside 0010-01AF.
# 079311 (in this file)
0785C0  func  vector_print_game_text
comment vector_print_game_text Jumps to print_game_text.
# 0795AF (in this file)
0785C3  func  vector_clear_list_1_objects
comment vector_clear_list_1_objects Jumps to clear_list_1_objects.
# 07D232, folded here: 07D232 "LDD #$0F,X; BEQ" (not moving: nothing), the sign of the x speed into bit 6 of field
# attributes
0785C6  func  face_movement
comment face_movement Turns the object to face the way it moves across, when it moves.
# 07D249
0785C9  func  vector_face_direction
comment vector_face_direction Jumps to the routine that turns the object to face the way field target_direction points.
# 07D268
0785CC  func  vector_choose_walk_animation
comment vector_choose_walk_animation Jumps to the routine that picks the enemy's walk animation by the way to its player.
# 07D43B
0785D5  func  vector_goon_start
comment vector_goon_start Jumps to the plain goon's start: its setup, its vitality 1 when its parameter is set, then its state 2.
# 07D49C
0785DB  func  vector_enemy_think
comment vector_enemy_think Jumps to the enemies' state 2: they go after a player, take a place by it and pick an action by their behaviour.
# 07D63B
0785DE  func  vector_enemy_act
comment vector_enemy_act Jumps to the enemies' state 3: they run the action in field action.
# 07D667
0785E1  func  vector_enemy_react
comment vector_enemy_react Jumps to the enemies' state 4: they run the shared hit reaction in field action.
# 07D6B2
0785E4  func  vector_enemy_climb
comment vector_enemy_climb Jumps to the enemies' state 5: they climb or jump to the floor field blocked found.
# 079400, folded here: 079400 "PUSHS A; LSRA" x4, "BNE; LDA #$10" (a blank for a leading 0), 07940A "STB #$-2000,X;
# STA ,X+", 079412 "ANDA #$0F", the second digit. Called by bank 20's 040003
0785EA  func  print_bcd_byte
comment print_bcd_byte Prints the BCD byte in A as two digits at the tile RAM's X in colour B, a blank for a leading 0.
# 07E1CD, folded here: "LDY #$F296; LBRA $CA8A": the child record fireman_goon_effect_child (list 1, type 04, which runs
# 07E18F)
0785F0  func  spawn_kind_90_effect
comment spawn_kind_90_effect Puts in a fireman_goon_effect object at the object's place.
# 07E1AE (in this file)
0785F3  func  vector_enemy_hurt_become_goon
comment vector_enemy_hurt_become_goon Jumps to enemy_hurt_become_goon.
# 07D416
0785F9  func  vector_goon_setup
comment vector_goon_setup Jumps to the plain goon's setup (object_setup_07F1A8, kind 80): facing left, after the nearest player, the goon's behaviour and its retarget time.
# 07D68B, folded here: 07D68B "LDD #$28,X; LDU #$F662; ASLA; JSR [A,U]" (the shared reactions 00-0C), then, unless the
# object left, 07D694 "LDD <$B8; CMPD #$0500; LBCC $CDE9" (the walls), else for an action other than 0C the floor
# under it (07D6A5 "LBSR $9495; TSTA; BPL"): none makes it action 0C (07D6AB "LDD #$0C00; STD #$28,X")
0785FC  func  enemy_react_with_pits
comment enemy_react_with_pits Runs the enemy's shared hit reaction by field action; then, while work RAM 48B8 is under 0500, sends it into the pit reaction when there is no floor under it, else stops it at the walls.
# 0795DF, folded here: 0795DF "LDX #$4D40", "LDA #$06", as clear_enemy_objects
0785FF  func  clear_child_objects
comment clear_child_objects Clears the 6 objects of list 2 (4D40), all but the ones lending their sprites (flags 1), keeping their sprite slots.
# 07D679, folded here: as enemy_react_with_pits without the pit, the walls (07CDE9) only for the actions under 0A
078602  func  enemy_react_with_walls
comment enemy_react_with_walls Runs the enemy's shared hit reaction by field action; then, for the actions under 0A, stops it at the walls.
# 078EB0 (in this file)
078605  func  vector_ask_sound_cpu_check
comment vector_ask_sound_cpu_check Jumps to ask_sound_cpu_check.
# 078F11, folded here: "LDD #$FE88; STD $1FC6; TST $1FC4". Called by the test mode's second ROM page (05EABA)
078608  func  start_sample_rom_check
comment start_sample_rom_check Asks the Z80 to check the K053260's sample ROMs (command FE88), without waiting.
# 078EE7, folded here: "LDD #$F585; JSR $8F30", "LDD #$F484; JSR $8F30"; the test mode prints the result by 1F
# (05EB83 "LDU #$251F" with bit 2 of the answer; texts.txt text_025BB2: 1F)
07860B  func  check_sample_rom_1f
comment check_sample_rom_1f Asks the Z80 for the check of the sample ROM 1F (commands F585 and F484), waiting for each answer.
# 078EFC, folded here: "LDD #$F787", "LDD #$F686" (05EBBF "LDU #$259F", bit 3: the ROM 1D)
07860E  func  check_sample_rom_1d
comment check_sample_rom_1d Asks the Z80 for the check of the sample ROM 1D (commands F787 and F686), waiting for each answer.
# 078F1D, folded here: "LDA $1FC7; CMPA #$88" (the answer to start_sample_rom_check)
078611  func  sample_rom_check_answered
comment sample_rom_check_answered Sets Z when the Z80 has answered start_sample_rom_check (88 in 1FC7).
# 07CC8E
078617  func  vector_set_speed_by_direction
comment vector_set_speed_by_direction Jumps to the routine that sets the object's x and y speeds from a direction (A) and a speed (B).
# 07CCFB
07861D  func  vector_direction_to
comment vector_direction_to Jumps to the routine that gives the direction, in 256ths of a turn, from the object at X to the one at U.
# 07D301
078620  func  vector_choose_nearest_player
comment vector_choose_nearest_player Jumps to the routine that makes the nearest player the enemy's target.
# 07D34F "LDA $189E; ADDA <$58; STA $189E"
078623  func  vector_next_random_byte
comment vector_next_random_byte Jumps to the routine that adds the random number to work RAM 189E and returns it in A.
# 07D35B
078626  func  vector_measure_target
comment vector_measure_target Jumps to the routine that measures the distance and the way to the object at U into target_dx, target_dy and target_direction.
# 07CA8A
07862C  func  vector_spawn_child
comment vector_spawn_child Jumps to the routine that puts in a child object by the record at Y, at an offset from the object at X.
# 07CA9E, folded here: 07CA9E "LDB #$02; LBSR $CA54" (list 2), 07CAA5 "LDA #$05,Y; STA #$01,U" (its type), then 07CAAB
07862F  func  spawn_list_2_child
comment spawn_list_2_child Puts in an object of list 2 (4D40) with the type of the record at Y (its byte 5), at the record's offset from the object at X; carry when there was a free slot.
# 0794A7, folded here: "LDD <$F8; STD <$E9", "LDD <$FA; STD <$ED", then 0794EB (called by bank 1D's 03A009)
078632  func  floor_at_scratch_offset
comment floor_at_scratch_offset The floor map's cell at the object's place moved by the 8.8 offsets in work RAM 48F8 (across) and 48FA (on the floor).
# 079495 (in this file)
078638  func  vector_floor_at_offset
comment vector_floor_at_offset Jumps to floor_at_offset.
# 0794D9 (in this file)
07863B  func  vector_floor_ahead
comment vector_floor_ahead Jumps to floor_ahead.
# 0794B9 (in this file)
078644  func  vector_floor_ahead_x
comment vector_floor_ahead_x Jumps to floor_ahead_x.
# 0794C9 (in this file)
078647  func  vector_floor_ahead_y
comment vector_floor_ahead_y Jumps to floor_ahead_y.
# 07D229, folded here: "LDA #$00,X; EORA #$84; STA #$00,X" (shown and not hurt, turned over each call)
07864A  func  blink
comment blink Turns the object's flags 80 (shown) and 04 over: called each frame, it blinks.
# 07948C, folded here: the offsets cleared, then 0794EB: U the cell's address (bank 16's obstacles raise the floor in
# the cells under them)
078650  func  floor_cell_under
comment floor_cell_under The floor map's cell under the object: its address in U and its value in A.
# 079784 (in this file)
078653  func  vector_check_skip
comment vector_check_skip Jumps to check_skip.
# 0797B7 (in this file)
078656  func  vector_queue_job
comment vector_queue_job Jumps to queue_job.
# 078F24 (in this file)
078659  func  vector_reset_sound
comment vector_reset_sound Jumps to reset_sound.
# 07E1D3, folded here: "LDU #$F29E" (loaded_table_07F29E: 07E1E8 ... 07E2C0), by field action_step; then, while the
# object is on, 07D1CF and 07CDE9 (the screen's sides and the walls)
07865C  func  enemy_hurt
comment enemy_hurt The hit reaction of the enemies with their own hit animations, by its step: a flinch or a knock-down by field action and getting up, or when defeated lying down and then becoming a plain goon or blinking out; it keeps them inside the screen and stops them at the walls.
# 07D1B0
078662  func  vector_check_landing
comment vector_check_landing Jumps to the routine that, while the object falls, lands it on the floor under it (carry when it lands).
# 07CCDD
07866B  func  vector_set_walk_speed_by_direction
comment vector_set_walk_speed_by_direction Jumps to the routine that sets the object's x and y speeds from a direction (A) at the walk's speed (sines_20).
# 07CCF0
078671  func  vector_direction_to_offset
comment vector_direction_to_offset Jumps to the routine that gives the direction from the object at X to the place B pixels across from the object at U.
# 07C0E0, folded here: flags bit 5 and field hit cleared, then 07C0EC "LDU #$4F80", 8 of them that can be hit (flags
# bit 6): 07C13A (the boxes touch) then 07C2D9 (each takes the other's damage)
078674  func  check_hits_with_enemies
comment check_hits_with_enemies Checks the object's hit box against the 8 enemies' (list 0) that can be hit; each pair that touches takes the other's damage and attack.
# 07BAC7
078677  func  vector_palette_request
comment vector_palette_request Jumps to the routine that starts the palette job work RAM 487E asks for, with D.
# 07CA54
07867D  func  vector_find_free_slot
comment vector_find_free_slot Jumps to the routine that finds and clears a free object of the list in B (carry and U when found).
# 0797D3 (in this file)
078680  func  vector_queue_sound
comment vector_queue_sound Jumps to queue_sound.
# 07D1E3, folded here: "LDA #$00,X; BEQ", "LDD #$0C,X; SUBD #$0040; CMPD #$0180", outside: "CLR #$00,X"
078683  func  remove_off_screen
comment remove_off_screen Removes the object when its x is outside 0040-01BF; carry while it is inside.
# 07D2AB, folded here: "TST $1874" (no players: nothing), then the 4 players (4A40, C0 apart, on, state not negative)
# by |dx| + |dy|, the nearest kept in 1872
078686  func  find_nearest_player
comment find_nearest_player Finds the nearest player in play to the object (U, and A the distance's high byte; carry when one was found).
# 0797E3 (in this file)
078689  func  vector_queue_sound_unless_attract
comment vector_queue_sound_unless_attract Jumps to queue_sound_unless_attract.
# 07955F (in this file)
07868C  func  vector_clear_objects
comment vector_clear_objects Jumps to clear_objects.
# 0792DD (in this file)
07868F  func  vector_clear_sprites
comment vector_clear_sprites Jumps to clear_sprites.
# 07947D (in this file)
078692  func  vector_print_hex_word
comment vector_print_hex_word Jumps to print_hex_word.
# 079270 (in this file)
078695  func  vector_clear_layer_a
comment vector_clear_layer_a Jumps to clear_layer_a.
# 079275 (in this file)
078698  func  vector_clear_layer_b
comment vector_clear_layer_b Jumps to clear_layer_b.
# 07927A (in this file)
07869B  func  vector_clear_text_layer
comment vector_clear_text_layer Jumps to clear_text_layer.
# 0797ED (in this file)
07869E  func  vector_queue_sound_always
comment vector_queue_sound_always Jumps to queue_sound_always.
# 079743 (in this file)
0786A1  func  vector_insert_high_score
comment vector_insert_high_score Jumps to insert_high_score.
# 079718 (in this file)
0786A4  func  vector_high_score_rank
comment vector_high_score_rank Jumps to high_score_rank.
# 07941B, folded here: 07941B "PUSHS A; LSRA" x4, "BNE", 079423 "LDA #$10" ... four digits, blanks (10) for the leading
# zeros, the colour 0. Called by bank 20's 040946
0786A7  func  print_bcd_word
comment print_bcd_word Prints the BCD word in D as four digits at the tile RAM's X, blanks for the leading zeros.
# 07CA50
0786AA  func  vector_find_free_slot_by_flags
comment vector_find_free_slot_by_flags Jumps to the routine that finds a free object in the list bits 2-3 of B name (a spawn record's flags).
# 07C4A3
0786AD  func  vector_draw_layer_strips
comment vector_draw_layer_strips Jumps to the routine that draws B strips of 8 pixels of the layer A names, from its scroll on.
# 07C931
0786B0  func  vector_set_layer_modes
comment vector_set_layer_modes Jumps to the routine that sets the K052109's tile banks (1D80, 1F00) by the map's scene and area.
# 07E451, folded here: the sprite RAM in view (07E453-07E45F "ORA #$02"), for A objects from X (022029 "LDX #$4A40;
# LDA #$08"), 07E465 "LDU #$59,X", 8 sprites each: flags 1 and the sprite's byte 1 (its order) from FF down
0786B3  func  reserve_objects_for_sprites
comment reserve_objects_for_sprites Takes A objects from X out of the game (flags 1) and gives their sprites fixed orders from FF down, so a screen can draw with them.
# 079384 (in this file)
0786B6  func  vector_erase_text
comment vector_erase_text Jumps to erase_text.
# 07D0BB, folded here: "LBSR $CFEC" (no attack 11-14: nothing), then 07D0BE "LDA #$1B,X; BEQ": the vitality gone,
# action 0A when hit from behind, 0B from the front (07D0CE-07D0D7), else 07D0C3 "LDU #$F134" by field hit as 07D056.
# Called by bank 14's 028021
0786B9  func  enemy_take_special_hit_or_fall
comment enemy_take_special_hit_or_fall The enemies' hit check: an attack of kind 11 to 14 starts the reaction it calls for, or the defeat when the enemy's vitality is gone.
# 07BA93
0786BC  func  vector_play_scene_music
comment vector_play_scene_music Jumps to the routine that queues the scene's music.
# 07E496, folded here: see the scoped fields of boss_shade; callers bank 10's 020006, bank 11's 022009, bank 13's
# 026000, bank 1E's 03C340
0786BF  func  boss_shade_by_vitality
comment boss_shade_by_vitality Turns the boss's colours by how much of its vitality is left, in 5 steps of A, with the palette effects of row B of hurt_effect_rows; the first call starts the row's normal effect and keeps its job.
# 07B632
0786C2  func  vector_set_scroll_x
comment vector_set_scroll_x Jumps to the routine that puts the camera and both layers at x D.
# 07B64C
0786C5  func  vector_set_scroll_y
comment vector_set_scroll_y Jumps to the routine that puts the camera and both layers at y D.
# 07939B, folded here: 07939B "ADDA #$02" (the colour), 0793A9 "SUBB #$30; ASLB; ASLB" (4 tiles a character),
# 0793AD-0793C8 the 2 x 2 tiles. Called by bank 11's 022940 (the name entry)
0786C8  func  print_big_text
comment print_big_text Prints the text at U (an address, its characters, '/' a new address, '#' the end) in characters of 2 x 2 tiles, in colour A + 2.
# 0793D1, folded here: the same, each character's 4 tiles blank (10)
0786CB  func  erase_big_text
comment erase_big_text Blanks a text that print_big_text printed, 2 x 2 tiles a character.

# ======== the boot (system/boot) ========
# the reset vector's routine (07FFFE reset_vector: 86CE; the test mode leaves through it, 05E3AA "LDX $FFFE; JMP ,X"):
# 0786D2 "LDA #$13; STA $7C00", the chips set up (1D00, 1FC2, 1FA4, 1FC0, 1D80/1F00, 1FB0-1FBC the K053251), 07870B
# "LDS #$5E00", the stack's RAM 5D00-5FFF tested with 00 55 AA FF (078760-078789; bad: 0789ED prints "11F BAD" three
# times, ram_check_bad_texts, waits and restarts), the work RAM (078798 "LBSR $8B11"), the RAMs cleared (07879E-0787F0),
# the FIRQ waited for (078814 "LDA <$56; BNE"), with the test switch held (078819 "LDA $1F81; ANDA #$01") the EEPROM
# test (game texts 6 EEP ROM TEST, 7 OK, 8 BAD, 9 RECOMMAND SET, A COMPLETE; bank 2F's 6000 and 6006), the flip
# setting (078892 "LBSR $6012"), the RAM ROM CHECK (0788A4 "LBSR $8B1C"), the palettes (0788C1-0788EA four 07BF51), the
# queues (078914-07893C), the high scores from default_high_scores (07893E-07894B: BAT HOM LIS MAR MAG INC SIM MAT FOX
# KON), the settings (078963 "LBSR $8A1A"), game state 1 (078966 "LDA #$01; STA <$00"), the interrupts on, then the
# main loop: 0789BC-0789C8 bank 20's 6003 each turn, 0789CB "LDX $4942; LDD ,X; BMI" a job waiting, 0789E4 "LDX #$E3FB;
# ASLA; JSR [A,X]" runs it by its number with B
0786CE  func  boot
comment boot The reset: sets the chips up, tests and clears the RAMs, runs the EEPROM test when the test switch is held, then the RAM ROM CHECK, loads the first palettes, sets the queues, the high score table and the settings, turns the interrupts on and runs the main loop: bank 20's background work and the jobs the queue holds, one at a time.
# the SWI and NMI vectors (FFFA, FFFC: 89EC), an "RTI": nothing raises them
0789EC  func  ignore_interrupt
comment ignore_interrupt Unused: the SWI and NMI vectors' routine; it returns at once and nothing raises them.
# 078A1A "LDX #$59F1; LDU #$E3EB; LDA ,X; LDA A,U" coinages by the coin setting (low nibble into <$1D/<$25, high into
# <$1C/<$24), 078A3A "LDA #$07,X" (59F8: 0 sets <$3B and <$39), 078A4F "LDA #$04,X; INCA" lives into <$5A, 078A56
# "LDA #$03,X" into <$14, 078A5C "LDA #$05,X" into <$13, 078A62 "LDA #$06,X" (the flip: 1E80, 1FA5 bits 0-1, the
# K053246's offsets 1FA0/1FA2 kept in <$86/<$89), 078ACD "LDB #$08,X" bit 2 of <$10, "LDA #$09,X" into <$3A
078A1A  func  apply_settings
comment apply_settings Takes the settings the test mode keeps at 59F1 into the game's variables: the coinage, the coin slots' mode, the lives, the difficulty, the sound in the attract, the screen flipped or not (the tile and sprite chips set for it), the coin counters' port bit and the first credit's extra coins.
# 078AEE "LDX #$200E; LDB #$10", rows of 12 words 2F2E then 12 words 2D2C, 40 apart (the text layer's codes)
078ADE  func  draw_boot_pattern
comment draw_boot_pattern Fills the text layer's middle, 36 tiles by 32 rows, with a pattern of tiles 2E 2F over 2C 2D.
# 078B11 "LDU #$4000; LDY #$0E80; LBSR $8DCF; TSTB"
078B11  func  check_work_ram
comment check_work_ram Tests the work RAM 4000-5CFF word by word; Z when it is good.
# the screen RAM ROM CHECK (game text B: 11F 1J 16G 16F 9G 8G 12C 13C 15C 16C 17C 6G 7G): 078B24 "LDA <$56; BNE"
# (the FIRQ), the RAMs by 1FC2 (078B29 "LDA #$06; STA $1FC2", 078B2F-078B84 LBSR $8DCF each, into 5D04-5D06; 5D07-5D08 by 078E19), the EEPROM by bank 2F's 600C (5D09), each printed OK or
# BAD (078BDC-078C1B, LBSR $8E7F each), the sums of the program's chips against rom_13c_sum ... rom_17c_sum (078C22-
# 078D0C), the Z80's check (078D23 "LBSR $8EB0": its ROM 6G with its sum, its RAM 7G), a wait (078D6D-078D80), then a
# restart when anything was bad (078D82 "TST $5D02")
078B1C  func  ram_rom_check
comment ram_rom_check The RAM ROM CHECK screen: tests the sprite, tile and palette RAMs and the EEPROM, adds up the program's four chips and checks them against their sums, asks the Z80 to check its ROM and RAM, prints OK or BAD by each chip and each sum, waits a while and restarts the game when anything was bad.
# 078D8C "LDA #$05; STA $1FC2" (the palette RAM in view), 078D92 "LDX #$0400" 15 x FFFF and 0000, 0420 16 x 001F
078D8C  func  set_check_colours
comment set_check_colours Sets the texts' colours for the RAM checks' screens: white (FFFF) at 0400, and red (001F) at 0420 for BAD.
# 078DBD "CLR <$F0; TSTB; BEQ; LDB #$40; STB <$F0", 078DC8 "LDD <$FA; LBSR $947D"
078DBD  func  print_rom_sum
comment print_rom_sum Prints the sum the check added up (48FA) as four hex digits at X, in red when B is not 0.
# 078DCF "LDX #$FFFF; STU $5D00", Y words written with X and read back (078DDE "STX ,U++", 078E02 "CMPX ,U++; BNE"), X
# less 5555 a pass: FFFF, AAAA, 5555, 0000 (078E0B "LEAX #$-5555,X", 078E0F "CMPX #$AAAB"); B 3 when a word differs
078DCF  func  test_ram_words
comment test_ram_words Tests Y words of RAM from U with the patterns FFFF, AAAA, 5555 and 0000: B 3 when one does not read back, else 0.
# 078E19 "LDA #$FF; STU $5D00", "STA ,U++" every other byte (one chip of a 16-bit RAM), FF, AA, 55, 00
078E19  func  test_ram_bytes
comment test_ram_bytes Tests Y bytes of RAM from U, every other one (one chip of the palette RAM), with the patterns FF, AA, 55 and 00: B 3 when one does not read back.
# 078E5B "LDX #$6000; LDU #$2000", into add_rom_bytes
078E5B  func  add_bank_bytes
comment add_bank_bytes Adds the bytes of the bank in the window (6000-7FFF) to the check's sum.
# 078E63 "CLRD; STD <$FA", into add_rom_bytes
078E63  func  add_fixed_bytes
comment add_fixed_bytes Starts the check's sum and adds U bytes from X (the fixed program, 8000-FFFF).
# 078E7F "ORB $5D02; STB $5D02", 078E8B "LDA #$04; STA $1FC2", 078E91 "LDX #$E41B" ("OK@" or, from 3 on, "BAD"), the
# colour 40 (red) for BAD, 3 characters at U
078E7F  func  print_check_result
comment print_check_result Prints OK, or BAD in red when B is not 0 (and marks the check as failed), at the tile RAM's U.
# 078EB0 "LDD #$F181; STD $1FC6; TST $1FC4", up to 2000 reads of 1FC7 until it echoes 81 (078EC3 "CMPB $1FC7"), then
# "LDD $1FC6"; none: 8F00 (bit 7: no answer). The RAM ROM CHECK: bit 1 the ROM 6G bad, bit 0 the RAM 7G; the test
# mode: bits 2 and 3 the sample ROMs
078EB0  func  ask_sound_cpu_check
comment ask_sound_cpu_check Asks the Z80 for its checks (command F181) and returns its answer in D, or 8F00 when it does not answer.
# 078ED2 "LDD #$F383; JSR $8F30", "LDD #$F282; JSR $8F30": two answers, the sum's high and low bytes
078ED2  func  read_sound_rom_sum
comment read_sound_rom_sum Asks the Z80 for the sum of its ROM (commands F383 and F282) and returns it in D.
# 078F24 "LDD #$FF00; STD $1FC6; TST $1FC4" (before the boot's restart, and bank 2F's 05E3A7 as the test mode leaves)
078F24  func  reset_sound
comment reset_sound Sends the Z80 the command FF00, without waiting.
# 078F30 "STD $1FC6; TST $1FC4" (the Z80's IRQ), 078F38 "CMPB $1FC7; BNE" until it echoes B, "LDD $1FC6"
078F30  func  send_sound_command_and_wait
comment send_sound_command_and_wait Sends the Z80 the command in D and waits until it echoes the command's low byte; returns its answer in D.

# ======== the interrupts (system/interrupts) ========
# the IRQ vector (FFF8: 8F43), at each VBLANK: 078F63-078F74 the coins' inputs of the last three frames, the coin
# counters' pulses (078F7D-078FFB), the coin slots (078FFE-079034), the test switch (079037 "LDA $1F81; ANDA #$01":
# test mode), one sound command for the Z80 (079054-079070), then, unless the last IRQ's work is still running (079074
# "LDA <$12"), the frame count (079083 "INCW <$15"), the palette jobs (07908F "LBSR $BC8B"), the controls (079092-0790B3),
# the K052109's scrolls (0790B6-0790F0) and their copies (0790F4-07912D), the wait for the sprite DMA (079130 "LDA
# <$56; BNE"), the game state's routine (07913A "LDA <$00; ASLA; LDX #$E42B; JSR [A,X]": 0 the test mode, 1 the
# attract, 2 the game), 079143 "LBSR $C367" and 079146 "LBSR $9841" (the sprites)
078F43  func  irq_handler
comment irq_handler The IRQ's routine, at each frame: counts the coins and pulses the coin counters, enters the test mode when its switch is pressed, sends the Z80 one queued sound command, then reads the controls, sets the tile layers' scrolls, runs the palette jobs and the routine of the game's state (test mode, attract or game) and updates the sprites for the DMA.
# game state 0 (E42B's first): 079184 "LDX #$E431; LDA <$01; ASLA; JMP [A,X]": 0 07918D, 1 0791A2
079184  func  test_mode
comment test_mode The test mode's routine at each frame, by game_scene: its start, then bank 2F's test mode.
# 07918D "LBSR $9269; LBSR $9692", 079193-07919D the test mode's variables 5900-59EF cleared, 07919E "INC <$01"
07918D  func  test_mode_start
comment test_mode_start Starts the test mode: clears the tile layers, the scores and the game's variables, and the test mode's variables at 5900-59EF.
# 0791A2-0791AE "LDB #$2F; STB <$0E; SETLN <$0E", "LBSR $6009"
0791A2  func  test_mode_run
comment test_mode_run Runs a frame of bank 2F's test mode.
# the FIRQ vector (FFF6: 91B2), after the sprite DMA: 0791B2 "ORCC #$40", 0791B6-0791BE bit 2 of 1FC2 off (no more
# FIRQ), 0791C6-0791CE bit 4 of the K053246's register 5 off, 0791D4 "CLR <$56"
0791B2  func  firq_handler
comment firq_handler The FIRQ's routine, once the sprite DMA is over: turns the FIRQ and the K053246's interrupt off and clears dma_pending, which lets the next frame's sprites be written.

# ======== the coins and the controls (system/inputs) ========
# 0791D8 "LDB <$3D; ORB <$3E; COMB; ANDB <$3F; ANDB ,S" (the slot's bit A: in the input two frames ago, out in the
# last two), then 0791E8 "LDD #$4002; LBSR $97ED" (the coin's sound), 0791EE "INC <$51"
0791D8  func  coin_inserted
comment coin_inserted Whether a coin went through the coin slot whose bit is in A (released after being held): queues the coin's sound and counts it in coins_inserted; carry when it did.
# U the slot's record (4817 + 8 a slot): 0791F7 "INC #$02,U"; with <$3B clear (shared credits) 0791FF "INC #$03,U"
# (the counter's pulse) and 079202-079219 a credit each #$05,U coins, #$06,U credits into <$37; else 07921B-079244 the
# coins of 481C (and 483A more for the slot's first credit, "LDB #$07,U"), 481D credits into the slot's own word
0791F7  func  add_coin
comment add_coin Counts a coin in the coin slot's record at U and gives the credits it is worth when enough coins are in: into the shared credits, or into the slot's own when each slot has its credits (the first credit of a slot may take more coins).
# 079248 "LDA <$11; BNE" (the attract plays the demo's inputs instead)
079248  func  read_controls
comment read_controls Reads a player's controls from the port at U into its block at X, unless the attract runs.
# 07924D "LDA ,X; STA #$01,X" (last frame's), 079252 "LDA ,U; COMA; STA ,X" (this frame's), "LDA #$01,X; ANDA ,X;
# STA #$03,X" (held), "LDA #$01,X; COMA; ANDA ,X; STA #$02,X" (newly pressed)
07924D  func  update_controls
comment update_controls Updates a player's controls block at X from the port at U: this frame's, last frame's, the ones newly pressed and the ones held.

# ======== the tile layers (video/clear) ========
# 079269 "BSR $9270; BSR $9275; BSR $927A"
079269  func  clear_tile_layers
comment clear_tile_layers Clears the K052109's three layers.
# 079270 "LDX #$0800; BRA $92CB": 400 words, the codes (2800-2FFF) 1010 (blank), the colours 0
079270  func  clear_layer_a
comment clear_layer_a Clears layer A: its tiles blank (10) and its colours 0.
# 079275 "LDX #$1000; BRA $92CB" (3000-37FF)
079275  func  clear_layer_b
comment clear_layer_b Clears layer B: its tiles blank (10) and its colours 0.
# 07927A "LDX #$200E; LDA #$20", 20 rows of 12 words 1010 (the visible part), then 07929E-0792C5 the two columns at each
# side ("LDX #$200C", "LDD #$3F3F", "STD ,X; STD #$26,X") to tile 3F
07927A  func  clear_text_layer
comment clear_text_layer Clears the text layer's 36 visible columns of its 32 rows and puts tile 3F in the two columns at each side of them.
# 0792DD-0792E7 "LDA <$0F; ORA #$02; STA $1FC2" (the sprite RAM at 2000), 0792ED "LDX #$2000; LDY #$1000", cleared
0792DD  func  clear_sprites
comment clear_sprites Clears the sprite RAM (2000-2FFF).

# ======== the texts (video/text) ========
# 079311 "STA <$E8" (the colour), "LDA <$0E; PUSHS A" (the bank kept), 07931C "ASLB; BCS $9346" (bit 7: erase),
# 07932D "LDX $6021" (game_texts_address in bank 12), 079331 "LDU B,X", then 07936D or 079384
079311  func  print_game_text
comment print_game_text Prints the game's text number B in colour A, or erases it when B's bit 7 is set (game_texts in bank 12: INSERT COIN, the copyright, the RAM ROM CHECK's...).
# 07936D "LDX ,U++" (the place in the tile RAM), "LDB ,U+; CMPB #$23" ('#' the end), "CMPB #$2F" ('/' a new place),
# "SUBB #$30; STA #$-2000,X; STB ,X+" (the colour and the tile)
07936D  func  print_text
comment print_text Prints the text at U in colour A: an address in the tile RAM, the characters (each a tile, the character less 30), '/' and another address, '#' the end.
# 079384, the same with "CLR #$-2000,X; LDB #$10; STB ,X+"
079384  func  erase_text
comment erase_text Blanks the text at U where print_text put it.
# 07945C "LDU #$E435" hex_digit_tiles, 079461 "ANDA #$F0" ... the high digit, the low one, the colour B
07945C  func  print_hex_byte
comment print_hex_byte Prints A as two hex digits at the tile RAM's X in colour B.
# 07947D "PUSHS B; LDB <$F0; BSR $945C; PULLS A; LDB <$F0; BSR $945C"
07947D  func  print_hex_word
comment print_hex_word Prints D as four hex digits at the tile RAM's X in the colour at 48F0.

# ======== the floor map (engine/floor) ========
# 079495 "STA <$E9; CLR <$EA; STB <$ED; CLR <$EE", then 0794EB
079495  func  floor_at_offset
comment floor_at_offset The floor map's cell at the object's place moved A pixels across and B on the floor: bits 0-3 the floor's height in steps of 8, bits 4-5 the sprites' priority there, bit 7 no floor.
# 0794B9 "LDD #$0F,X; STD <$E9", no y offset
0794B9  func  floor_ahead_x
comment floor_ahead_x The floor map's cell where the object's x speed takes it next.
# 0794C9 "LDD #$14,X; STD <$ED", no x offset
0794C9  func  floor_ahead_y
comment floor_ahead_y The floor map's cell where the object's y speed takes it next.
# 0794D9 "LDD #$0F,X; STD <$E9", "LDD #$14,X; STD <$ED"
0794D9  func  floor_ahead
comment floor_ahead The floor map's cell where the object's x and y speeds take it next.
# 0794EB: x plus the offset (8.8, "ADDD #$0D,X") plus the camera's x less 40, by 8; y plus its offset, from 70 under
# it, plus the camera's y, by 8, times 40 (a row); 4000 + that ("LDU #$4000"); A the cell
0794EB  func  floor_cell_at
comment floor_cell_at The floor map's cell (work RAM 4000: 40 cells of 8 pixels a row) at the object's place moved by the 8.8 offsets at 48E9 (across) and 48ED (on the floor): its address in U, its value in A (negative: no floor).

# ======== the random number (system/random) ========
# 079548 "LDD <$58; PUSHS D; ADDD <$58; STD <$58; ADDD <$58; ADDD ,S++; ADDD #$3711; STD <$58" (x 5 + 3711), called by
# the game's routine each frame (07A396)
079548  func  next_random
comment next_random Steps the random number on: five times it plus 3711.

# ======== the objects' slots (engine/objects) ========
# 07955F "LDX #$4A40; LDU #$2000", 30 words cleared each, 079572 "STU #$-07,X" (its sprites' place), up to 56A0
07955F  func  clear_objects
comment clear_objects Clears the 33 objects, giving each its 8 sprites' place in the sprite RAM (2000 + 80 each).
# 07957F "LDX #$4F80; LDA #$08", 079587 "LDA ,X; CMPA #$01; BNE" (flags 1: lending its sprites, left as it is),
# 079597 "LDD #$59,X" kept
07957F  func  clear_enemy_objects
comment clear_enemy_objects Clears the 8 objects of list 0, the enemies (4F80), all but the ones lending their sprites, keeping their sprite slots.
# 0795AF "LDX #$5280; LDA #$0A", the same
0795AF  func  clear_list_1_objects
comment clear_list_1_objects Clears the 10 objects of list 1 (5280), all but the ones lending their sprites, keeping their sprite slots.

# ======== the variables (system/reset) ========
# 07960F "LDX #$4870", 90 bytes cleared, into 07961A
07960F  func  reset_for_stage
comment reset_for_stage Clears the stage's variables (4870-48FF), then the objects and the tile chip's variables.
# 07961A "LDA <$5F" (flipped or not: the K053246's offsets 1FA0/1FA2 and their copies), 07955F twice, the variables in
# the tile chip's RAM (18E0-18FF, 1860-18DF, 1840-185F) and 3C00-3DFF (the palette jobs) cleared, 49D3 49DB 49E3 49EB
07961A  func  reset_sprites_and_objects
comment reset_sprites_and_objects Sets the sprite chip's offsets for the flip setting, clears the objects, the variables the game keeps in the tile chip's RAM (1840-18FF) and the palette jobs (3C00-3DFF), and a byte of each player's record.
# 079692 "CLRD; STD $49D4; STD $49DC; STD $49E4; STD $49EC" (the scores), into 0796A3
079692  func  reset_for_game
comment reset_for_game Clears the four players' scores, then the game's variables.
# 0796A3 "LDX #$4860" A0 bytes, 3840-386F, the players' records' bytes 6 (49D6 ...) and their continue countdowns (4A02-
# 4A1B), into 07961A
0796A3  func  reset_for_play
comment reset_for_play Clears the game's variables (4860-48FF, 3840-386F, the players' countdowns), then the objects and the tile chip's variables.

# ======== the scores (game/score) ========
# 0796FF "LDU #$E445; ASLB; LEAU B,U" (score_additions), 079705 "LDA #$01,U; ADDA #$01,X; DAA; STA #$01,X", 07970F "LDA
# ,U; ADCA ,X; DAA; STA ,X"
0796FD  func  add_score
comment add_score Adds score_additions' entry B (BCD) to the score at X.
# 07971A "STD <$E8", 07971D "LDX #$4983" (the high score table's scores), 079726 "CMPD ,X", 8 apart, 10 of them
079718  func  high_score_rank
comment high_score_rank Finds the place of the score D in the high score table (A, 0-9; carry when it gets in).
# 079743 "STA <$E8" (the place), 07974D "LDX #$49C8" the records below it moved down (8 bytes each), then 07976C "LDU
# #$48F0" its initials and score copied in (3 words)
079743  func  insert_high_score
comment insert_high_score Puts the initials and score at 48F0 into the high score table at place A, moving the lower ones down.

# ======== the skip (game/skip) ========
# 079784 "CMPA <$78; BCC" (a wait: <$78 counts up to A), 07978C "LDB <$50" (the players in the game), 07979A "LDX
# #$E449" player_presses, 0797A1 "LDA [A,X]; ANDA #$30" (the attack and jump buttons)
079784  func  check_skip
comment check_skip After waiting A frames, whether a player in the game newly presses attack or jump (carry), which skips a story.

# ======== the queues and the jobs (system/jobs) ========
# 0797B7 "TSTA; BNE; INC <$5D" (a clear of the screen pending), 0797BF "LDX $4940; STD ,X++", 4944-497F round
0797B7  func  queue_job
comment queue_job Puts the job A with its argument B in the main loop's queue (job 0, a screen clear, is counted until done).
# 0797D3 "CMPD #$FFFF; BEQ", "TST <$11; BEQ $97ED; TST <$13; BNE $97ED" (in the attract only with the sound setting on)
0797D3  func  queue_sound
comment queue_sound Queues the sound command D for the Z80, unless it is FFFF or the attract runs with its sound off.
# 0797E3 "TST <$11; BNE" (never in the attract)
0797E3  func  queue_sound_unless_attract
comment queue_sound_unless_attract Queues the sound command D for the Z80, unless it is FFFF or the attract runs.
# 0797ED "CMPD #$FFFF; BEQ", 0797F4 "LDX $4900; STD ,X++", 4904-493F round; the IRQ sends one a frame (079054)
0797ED  func  queue_sound_always
comment queue_sound_always Queues the sound command D for the Z80 unless it is FFFF.
# job 0 (the job table E3FB's first): 079808 "LDX #$E56C; ASLB; JSR [B,X]", 07980E "CLR <$5D"
079808  func  job_clear_screen
comment job_clear_screen Job 0: clears the tile layers B names (0 all, 1 the text layer, 2 layer A, 3 layer B) and marks the clears done.
# E56C's entries: 079812 "LBRA $9269", 079815 "LBRA $927A", 079818 "LBRA $9270", 07981B "LBRA $9275"
079812  func  job_clear_all_layers
comment job_clear_all_layers Clears the three tile layers (job 0 with B 0).
079815  func  job_clear_text_layer
comment job_clear_text_layer Clears the text layer (job 0 with B 1).
079818  func  job_clear_layer_a
comment job_clear_layer_a Clears layer A (job 0 with B 2).
07981B  func  job_clear_layer_b
comment job_clear_layer_b Clears layer B (job 0 with B 3).
# job 1: 07981E "LDA <$71; LBRA $9311"
07981E  func  job_print_game_text
comment job_print_game_text Job 1: prints the game's text B in the colour job 2 set.
# job 2: 079824 "STB <$71"
079824  func  job_set_text_colour
comment job_set_text_colour Job 2: sets the colour job 1 prints in.
# jobs 3-6: 079828 "LDX #$49D4; LBRA $96FD", 07982E "LDX #$49DC", 079834 "LDX #$49E4", 07983A "LDX #$49EC" (the
# players' records by player_records: Marge, Homer, Bart, Lisa)
079828  func  job_add_marge_score
comment job_add_marge_score Job 3: adds score_additions' entry B to Marge's score (player 1).
07982E  func  job_add_homer_score
comment job_add_homer_score Job 4: adds score_additions' entry B to Homer's score (player 2).
079834  func  job_add_bart_score
comment job_add_bart_score Job 5: adds score_additions' entry B to Bart's score (player 3).
07983A  func  job_add_lisa_score
comment job_add_lisa_score Job 6: adds score_additions' entry B to Lisa's score (player 4).
# jobs 7-15: 079840 "RTS"
079840  func  job_none
comment job_none Jobs 7 to 15: nothing.

# ======== the sprite engine (video/sprites) ========
# 079841 "LDA <$79; BNE" (frozen), 079846 "LBSR $9ADD", the sprite RAM in view (07984B-07984E "ORA #$02"), then
# 079873, 0798F5, 079A37
079841  func  update_sprites
comment update_sprites At each IRQ, unless the sprites are frozen: sets the step's sprite priority, then with the sprite RAM in view animates every object, moves them and their sprites and orders their sprites by depth.
# 079873 "LDX #$4A40", 32 objects: flags 0 079883 (its sprites cleared), 1 left alone, else 07987F "BSR $98BD"
079873  func  animate_objects
comment animate_objects Runs the animation of each object that is on and clears the sprites of those that are off.
# 07988E "LDU #$59,X", 8 sprites "STD ,U" while on, 0798A5 "LDY #$-02,U" the object that lends more (cleared, its
# flags 0) and its sprites
07988E  func  clear_object_sprites
comment clear_object_sprites Clears the object's sprites in the sprite RAM, and those of the objects that lent it more.
# 0798BD "LDA #$05,X; BMI" (a new animation), "LDA #$06,X; BMI" (drawn at once), "ANDA #$40; BNE" (held), flags bit 4
# (zoomed: every frame), "LDA #$08,X" the frame's time ("DEC #$08,X")
0798BD  func  animate_object
comment animate_object Draws the object's animation when its frame changes, a new animation starts, it is zoomed or asked to; otherwise counts its frame's time down.
# 0798F5 "LDD <$DE; BMI" (the camera's x speed), the camera's moves into <$F0/<$F2, then for each object on: its
# sprites moved by its moves (07994C-07996E, 0799C7-0799F2 "ADDD #$0006,U", "#$0004,U"), 079978-079991 x, 0799FC-
# 079A15 y, 079A18-079A2B z
0798F5  func  move_objects
comment move_objects Moves every object that is on by its x, y and z speeds and by the camera's move, and moves its sprites with it without drawing them again.
# 079A37 "LDX #$4A40; LDU #$3000", each object by its y (0-017F, "ANDB #$FE") into a word of 3000 or after the row's
# last (079A68 "LDD #$5E,Y", 079A6D "STX #$5E,Y"); then 079A7C-079AD7 the rows in order, each sprite's byte 1 a
# count from 1 (0 for the objects whose flags are not negative)
079A37  func  sort_objects_by_depth
comment sort_objects_by_depth Orders the objects by their y, a row of the table at 3000 a line, and numbers their sprites in that order for the sprite chip.
# 079ADD "LDX #$E574; LDA <$03; LDA A,X; STA <$FA" (step_sprite_priorities)
079ADD  func  set_step_sprite_priority
comment set_step_sprite_priority Sets the sprites' default priority for the story's step.
# 079AE9: <$F7 1 when flags bit 3 (a shadow), <$F6 field 06, 079B03 the kind's set and bank (animation_sets), the
# frame's time (079B36), 079B3E "LDU #$6000" the set's index, attributes bit 6 (flipped), 079B59 the animation (bit 7
# again), 079B6D the frame (4 bytes: its sprites' count and flags, time, list), 079B90 the end (a jump to a frame or
# another animation), 079BD5 "LBSR $9DE2", 079BDB-079BEC an object lent when it needs more than 8 sprites (079CBD)
079AE9  func  draw_object
comment draw_object Steps the object's animation and writes its frame's sprites (and its shadow's) in the sprite RAM at Y, borrowing another object's sprites when it needs more than 8.
# 079C02: for each sprite of the list at U: its code (bit 15: flipped the other way), the colour (from the list or
# attributes' low nibble), its attributes, then its place from the object's (079C49-079C59), or zoomed (079CD4: the
# zoom from 0A/0B, its offsets by zoom_steps of bank 1D); 8 a slot, then the next lent object's (#$-02,Y); the rest of
# the slots cleared
079C02  func  write_object_sprites
comment write_object_sprites Writes the sprites of the frame's list at U for the object into its slots from Y: code, colour, attributes and place, zoomed when its flags say, then its shadow, and clears the slots left over.
# 079CBD "LDX #$55E0", down to 4D40: the first free (flags 0) taken with flags 1
079CBD  func  borrow_object_for_sprites
comment borrow_object_for_sprites Takes the last free object of the lists (from 55E0 down) to lend its sprites (flags 1); carry and X when there was one.
# 079DE2 "LDA #$09,X; ANDA #$30; BEQ", "LSRA; LSRA; STA <$FB" ...; else "LDA <$FA; STA <$FB"
079DE2  func  set_object_priority
comment set_object_priority Sets the priority the object's sprites get against the layers: its attributes' bits 4-5, or the step's default.
# 079DFE "LDD #$5C,X; ADDD #$11,X; STD #$04,Y", "LDD #$0C,X; STD #$06,Y", 079E0D "LDU #$E585" (shadow_sprites by 5B)
079DFE  func  write_shadow_sprite
comment write_shadow_sprite Writes the object's shadow as a sprite at Y: the shadow_sprites entry its field shadow_player names, on the floor under it.

# ======== the attract (game/attract) ========
# game state 1 (E42B's second): 079E39 "LDA #$01; STA <$11", 079E41 "LDA <$3B" (each slot its credits: 4817, 481F,
# 4827, 482F) or 079E46 "LDD <$37" (shared): none, the attract's scene by <$01 (a coin this frame, <$51, jumps to scene
# 5); some, game state 2 with its variables cleared (079E89-079ECB)
079E39  func  attract
comment attract The game's state 1, at each frame: with no credits runs the attract's scene (a coin skips to its scene 5), with credits starts the game (state 2).
# scene 0 (E44F's first): by <$02, 079EE3, 079EF6, 079F08, 079F17
079EDA  func  attract_opening_scene
comment attract_opening_scene The attract's scene 0 by its step: the screens cleared, then bank 20's opening run step by step, then the next scene.
# 079EE3 "LDD #$0000; LBSR $97B7" (job 0: all the layers), 079EE9 "LDD #$FFF0; STD <$BE; STD <$CE", "INC <$02"
079EE3  func  attract_clear_screen
comment attract_clear_screen Queues the clearing of the three layers and scrolls both layers to FFF0.
# 079EF6 "LDA <$5D; BNE", 079EFB "LDA #$00; CLRB; STD <$75; LBSR $C931"
079EF6  func  attract_wait_clear
comment attract_wait_clear Waits until the screen is cleared, then sets the tile banks for the map's scene 0, area 0.
# 079F08 "LDB #$20; STB <$0E; SETLN <$0E", "LBRA $6000" (bank 20's attract by the step 4803)
079F08  func  attract_opening_run
comment attract_opening_run Runs bank 20's opening for its step.
# 079F17 "CLRD; STD <$BE; STD <$CE", "LDD #$0000; LBSR $97D3", "INC <$01", 4802-4806 cleared
079F17  func  attract_next_scene
comment attract_next_scene Puts the layers back at 0, silences the sound and goes on to the attract's next scene.
# scene 2: by <$02, 079F3F, 079F52, then fixed_3D's 07A007 (the copyright erased, Binky's and Bongo's texts) and 07A024
079F36  func  attract_title
comment attract_title The attract's scene 2 by its step: the title screen with the copyright, then the Life in Hell characters' credits.
# 079F3F "LDD #$0000; LBSR $97D3", "LBSR $955F", "LDD #$0000; LBSR $97B7"
079F3F  func  attract_title_clear
comment attract_title_clear Silences the sound, clears the objects and queues the clearing of the layers.
# 079F52 "LDA <$5D; LBNE"
079F52  func  attract_title_wait
comment attract_title_wait Waits until the screen is cleared, then draws the title.
# 079F58 scrolls (10, 0), palette requests 7A53 and 0F07, 079F7A-079F80 the map's scene and area 0, 079F94/079F9B
# "LDB #$26; LBSR $C4A3" (26 strips of each layer), 079FB9-079FCD object 4F80 shown: kind 0E, animation 1F, at D0 128; game
# texts 0 (the logo's tiles), 5 (MATT GROENING), 2 (the copyright), 3 and 4, then the palette request 1640 (a fade in)
079F58  func  attract_title_draw
comment attract_title_draw Draws the title screen: both layers' picture, the title object (kind 0E), the logo's tiles, MATT GROENING and the copyright, and fades the colours in.

# ======== the enemies' shared reactions (enemies/reactions) ========
# the step of actions 7 and 8 (loaded_table_07F268/07F26E's third): 07E010 "LDD #$19,X; SUBD #$0020; STD #$19,X;
# LBSR $8662", landed: 07E01E "CLRW #$0F,X" ..., 07DE7C (lying, then up; or dying with no vitality)
07E010  func  enemy_spin_land
comment enemy_spin_land Lets the spinning enemy fall; once it lands it stops and lies down (it gets up, or dies with no vitality left).
# action 8 (07F586 by field action / 0785FC's F662): 07E028 "LDU #$F26E" steps 07E031, 07DFE7, 07E010
07E028  func  enemy_spin_backward
comment enemy_spin_backward Action 8: the enemy hit from the front by an attack of kind 13 spins away backwards, by its step.
# 07E031 "LDA #$20; STA #$3B,X", 07E036 "LDD #$6300; LBSR $8680" (the hit's sound), "LDA #$97; STA #$05,X", "LDD
# #$FE00; STD #$0F,X" (backwards, turned when it faces left), 07E054 "LDD #$0F,X; STD #$3E,X"
07E031  func  enemy_spin_backward_start
comment enemy_spin_backward_start Starts the backward spin: the hit's sound, the spin animation (97), x speed 2 backwards (kept to start it again after a wall) and a time of 20 frames.
# action 0A: 07E05E "LDU #$F274" steps 07E064, 07E0AC, 07E0EC
07E05E  func  enemy_defeated_forward
comment enemy_defeated_forward Action 0A: the enemy defeated from behind is knocked forwards and away, by its step.
# 07E064 "LDA #$8E; STA #$05,X", "LDD #$0080; STD #$0F,X", into 07E06F
07E064  func  enemy_defeated_forward_start
comment enemy_defeated_forward_start Starts the forward knock: animation 8E and x speed 0080 forwards.
# 07E06F "LDA #$88; STA #$00,X", sound 6300, 07E07A "LDD #$0200; STD #$19,X", y speed 0100, time 68 (48 and the y
# speed the other way when its y is under 00A0 from the camera's), the x speed turned when it faces left, "INC #$29,X"
07E06F  func  enemy_defeated_launch
comment enemy_defeated_launch Launches the defeated enemy: shown with its shadow and not hit any more, the hit's sound, up at z speed 0200, along the floor at y speed 0100 (the other way, and for less time, when its y is less than 00A0 from the camera's), across the way it was knocked.
# 07E0AC "SUBD #$0020" gravity, landed: action 5 (it blinks out); 078638 the floor under it: none, flags 80, zoom
# 40/40, priority 20 when its y speed is not negative, the next step
07E0AC  func  enemy_defeated_fly
comment enemy_defeated_fly Flies the defeated enemy: when it lands it blinks out; when it is over a place with no floor it starts going into the distance, without its shadow, at the sprites' priority 20 when its y speed is not negative.
# 07E0EC z speed down to FC00 at most, 07E0FC "DEC #$3B,X; BNE" (the end: "CLR #$00,X; LBSR $8599"), under 18
# frames y speed 0, flags 90 (zoomed), 07E118 "ADDD #$0101" to the zoom; 07E124 "CMPA #$40" the sound 0301
07E0EC  func  enemy_defeated_shrink
comment enemy_defeated_shrink Lets the defeated enemy fall into the distance, smaller each frame for its last 18 frames, with the falling sound at 40; at the end it is gone and its points scored.
# action 0B: 07E12F "LDU #$F27A" steps 07E135, 07E0AC, 07E0EC
07E12F  func  enemy_defeated_backward
comment enemy_defeated_backward Action 0B: the enemy defeated from the front is knocked backwards and away, by its step.
# 07E135 "LDA #$8C; STA #$05,X", "LDD #$FF80; STD #$0F,X", "LBRA $E06F"
07E135  func  enemy_defeated_backward_start
comment enemy_defeated_backward_start Starts the backward knock: animation 8C and x speed 0080 backwards.
# action 0C (0785FC: no floor under it): 07E143 "LDU #$F280" steps 07E149, 07E155
07E143  func  enemy_pit
comment enemy_pit Action 0C: the enemy over a place with no floor falls into the pit, by its step.
# 07E149 "LDA #$40; STA #$3B,X; CLR #$1B,X; INC #$29,X"
07E149  func  enemy_pit_start
comment enemy_pit_start Starts the fall into the pit: no vitality left, a time of 40 frames.
# 07E155 "DEC #$3B,X; BNE" (the end: gone and scored, 07E15D "LBSR $8599"), at 38 the sound 0301, z speed down 0040 a
# frame to FC00 at most, below the floor (z negative) priority 20
07E155  func  enemy_pit_fall
comment enemy_pit_fall Drops the enemy into the pit, with the falling sound, at the sprites' priority 20 once below the floor; at the end it is gone and its points scored.

# ======== kind 90's effect (objects/fireman_goon_effect) ========
# list 1 type 04 (F40D) and list 2 type 13 (F4F4): 07E18F "LDU #$F28C; ASLB; JMP [B,U]" (07E195, 07E1A4); put in by
# 0785F0 (the child record fireman_goon_effect_child)
07E18F  func  fireman_goon_effect
comment fireman_goon_effect The object that shows kind 90's animation 11 once, by its state.
# 07E195 "LDU #$F290; LBSR $D132" (fireman_goon_effect_setup: kind 90, animation 11, an empty hit box), "LDA #$80; STA
# #$00,X", "INC #$02,X"
07E195  func  fireman_goon_effect_start
comment fireman_goon_effect_start Sets it up (kind 90, animation 11) and shows it.
# 07E1A4 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
07E1A4  func  fireman_goon_effect_wait
comment fireman_goon_effect_wait Removes it once its animation has run to its end.

# ======== the enemies' own hit reaction (enemies/hurt) ========
# 07E1AE "LDA #$09,X; STA #$47,X", 07E1B4 "LBSR $D450" (object_setup_07F1A8: kind 80, the goon), animation 8D, time 18,
# state 4, action 4 (lying, then up: 07DF4C)
07E1AE  func  enemy_hurt_become_goon
comment enemy_hurt_become_goon Turns the enemy into a plain goon (kind 80, the goon's behaviour) lying on the ground, which then gets up and fights on.
# step 0 (loaded_table_07F29E's first): 07E1E8 "LDD #$6300; LBSR $97D3", "LDA #$1B,X; BNE" (none: step 2), the hit's
# animation 07E1FB "LDU #$F2AC" by field action (hit_animations), actions 0-1 a flinch (step 1), else z speed 0400,
# x speed 2 away from the hitter (by its x speed, or its place: 07E21B-07E240), step 5
07E1E8  func  enemy_hurt_start
comment enemy_hurt_start Starts the reaction to a hit: the hit's sound and the hit animation of its action; a flinch for actions 0 and 1, else knocked up and away from the hitter; with no vitality left, the defeat.
# step 1: 07E247 "LDA #$06,X; LSRA; BCC", "LDA #$C0; STA #$00,X", "LDY #$48,X" its hit box again, state 2
07E247  func  enemy_hurt_recover
comment enemy_hurt_recover Once the hit animation has run, gives the enemy its hit box back and sends it back to its state 2.
# step 2: 07E25C "LBSR $D16E; BCC" (landed: stops, animation 88 lying, the next step)
07E25C  func  enemy_hurt_fall_defeated
comment enemy_hurt_fall_defeated Lets the defeated enemy fall; once it lands it lies down.
# step 3: 07E270 "LDA #$06,X; LSRA" (the animation over: 07E276 "LDA #$43,X; BNE", 0 07E1AE, else time 10 and the next
# step), 07E289 "ANDA #$02" its marked frame: 07E290 "LDD #$4C,X; LBSR $97D3"
07E270  func  enemy_hurt_lie_defeated
comment enemy_hurt_lie_defeated Keeps the defeated enemy lying until its animation is over, with its sound on the marked frame; then it gets up as a plain goon, or (field vanishes) it starts to blink out.
# step 4: 07E299 "DEC #$3B,X; BNE" (the end: "CLR #$00,X; LBRA $D0E0"), 07E2A4 "LDA #$00,X; EORA #$80" ... "ORA #$04"
07E299  func  enemy_hurt_vanish
comment enemy_hurt_vanish Blinks the defeated enemy out; at the end it is gone and its points scored.
# step 5: 07E2AF "LBSR $D16E; BCC", "CLRW #$0F,X; LDA #$10; STA #$3B,X; INC #$29,X"
07E2AF  func  enemy_hurt_fall
comment enemy_hurt_fall Lets the knocked enemy fall; once it lands it stays down for 10 frames.
# step 6: 07E2C0 "DEC #$3B,X; BNE", "LDY #$48,X; LBSR $D1B7", "LDA #$C0; STA #$00,X", animation 8F, step 1
07E2C0  func  enemy_hurt_get_up
comment enemy_hurt_get_up After its time down, the knocked enemy gets up (animation 8F) with its hit box back.

# ======== the work RAM's variables ========
# Direct page 48 throughout ("<$NN" is 48NN). Those of the system, the coins, the queues, the camera and the scrolls,
# the sprites and the RAM checks.

# the game's state, by which the IRQ runs a routine (07913A "LDA <$00; ASLA; LDX #$E42B; JSR [A,X]"): 0 the test mode
# (07904E "STD <$00" when the test switch is pressed), 1 the attract (078966 "LDA #$01; STA <$00" at the boot's end), 2
# the game (079EC3 "LDA #$02; STA <$00" when a credit starts it)
4800  var  game_mode  u8
# the state's scene: the test mode's start and run (079187 "LDA <$01; ASLA; JMP [A,X]"), the attract's scenes (079E39
# by it; 079F24 "INC <$01" the next one)
4801  var  mode_step  u8
# the scene's step (079EF2 "INC <$02"; the attract's scenes and the game's routine 07A396 switch on it)
4802  var  mode_phase  u8
# the step of the story (1 story, 2 stage 1, 3 bonus 1 ... 16 the ending): 079ADD "LDA <$03; LDA A,X" (step_sprite_
# priorities), 07BA87 "LDA <$03" (step_scenes), 07A75E "INC <$03" the next step; in the attract the opening's step
# (079F08: bank 20's 6000 by it)
4803  var  game_step  u8
# the step's state: the routines of each step switch on it (bank 20's 040021 "LDA <$04; ASLA; JMP [A,X]"), cleared with
# the next step (07A764 "STA <$04")
4804  var  step_phase  u8
# the attract's scenes' wait (07A009 and 07A026 "DEC <$09"; 079F58 clears it: 256 frames)
4809  var  attract_timer  u8
# the bank in the window, for the interrupts to put back (every "STB <$0E; SETLN <$0E", the profile's BANK_SHADOW)
480E  var  window_bank  u8
# the copy of the board's register 1FC2 (bit 0 the palette RAM at 0000, bit 1 the sprite RAM at 2000, bit 2 the
# FIRQ, bits 3/4/7 the EEPROM): 0787FF "STA <$0F" with each "STA $1FC2"
480F  var  board_control  u8
# the copy of 1FC0 (bits 0-1 the coin counters: 078FAB "ORA #$01", 078FD4 "ANDA #$FD"; bit 2 from the setting 59F9:
# 078ACD; 30 the rest: 078AD4 "STA <$10")
4810  var  board_output  u8
# 1 while the attract runs (079E39 "LDA #$01; STA <$11", 079EAD "CLR <$11" as the game starts): the controls are the
# demo's (079248 "LDA <$11; BNE"), the sounds only with the setting (0797D8 "TST <$11"), the test switch clears it
# (07904B "STA <$11")
4811  var  in_attract  u8
# set while an IRQ's work runs (079088 "STA <$12" ... 079180 "CLR <$12"): another IRQ meanwhile only sends a sound
# command (079074 "LDA <$12; BEQ")
4812  var  irq_busy  u8
# the setting "sound in attract mode" (078A5C "LDA #$05,X; STA <$13"; 0797DD "TST <$13")
4813  var  attract_sound  u8
# the setting of the difficulty (078A56 "LDA #$03,X; STA <$14"; bank 20's rank_base by it: 040C65 "LDA <$14")
4814  var  difficulty_setting  u8
# the frames since the boot (079083 "INCW <$15")
4815  var  frame_count  u16
# the coin slots' records, 8 bytes from 4817 (0791F7 by U: 079005 "LDU #$4817", 079012 "LDU #$481F", 079024 "LDU
# #$4827", 079031 "LDU #$482F"): the slot's credits (when each slot has its own: 079239 "ADDD #$00,U", 079E39), the
# coins towards a credit (+2), the coin counter's pulses to give (+3: the IRQ's 078F9E "TST <$1A", 078FA3 "DEC <$1A"), the
# pulse's time (+4: 078F7D "TST <$1B", 8 frames a pulse), the coins a credit takes (+5) and the credits they give (+6,
# 078A26-078A34 from coinages for slots 1 and 2), whether the slot gave a credit already (+7: 079244 "STA #$07,U")
4817  var  slot_credits  u16
4819  var  slot_1_coins  u8
481A  var  slot_1_counter_pulses  u8
481B  var  slot_1_counter_time  u8
481C  var  slot_1_coins_per_credit  u8
481D  var  slot_1_credits_per_coins  u8
481E  var  slot_1_credit_given  u8
481F  var  slot_2_credits  u16
4822  var  slot_2_counter_pulses  u8
4823  var  slot_2_counter_time  u8
4824  var  slot_2_coins_per_credit  u8
4825  var  slot_2_credits_per_coins  u8
4827  var  slot_3_credits  u16
482F  var  slot_4_credits  u16
# the credits shared by the players when the slots are not each the player's (079214 "ADDD <$37; STD <$37"; 079E46
# "LDD <$37"; 07B739 "LDD <$37")
4837  var  credits  u16
# the setting 59F8 at 0 (078A42-078A4C): four coin slots, each a player's with its own credits (the IRQ reads slots 3
# and 4: 079018 "LDA <$39; BEQ"; 0791FA "LDA <$3B" the slot's own credits; 079E41 "LDA <$3B"), and a single coin
# counter (078FBB "LDA <$39; BNE": the second counter only without)
4839  var  four_coin_slots  u8
483B  var  separate_coin_slots  u8
# the setting 59FA: coins more for a slot's first credit (078ADA "STA <$3A"; 079226 "ADDA <$3A" while +7 is clear)
483A  var  first_credit_extra_coins  u8
# the coin inputs (1F80 inverted, a bit a slot: 078F6F "LDA $1F80; COMA; STA <$3D"), last frame's (078F69 "LDA <$3D;
# STA <$3E") and the frame's before (078F63 "LDA <$3E; STA <$3F"): a coin is counted once released (0791DA-0791E4)
483D  var  coin_inputs  u8
483E  var  coin_inputs_last  u8
483F  var  coin_inputs_before  u8
# the players' controls, 4 bytes a player (079095 "LDX #$4840", 07909E "LDX #$4844" ...): this frame's, last frame's,
# the newly pressed, the held (07924D-079265)
4840  var  player_controls[16]  u8
# the players in the game, a bit each (07978C "LDB <$50"; the demo's 07A0AF "STA <$50"; 079EB0 "CLR <$50")
4850  var  players_playing  u8
# the coins that went through the slots this frame (078F60 "CLR <$51", 0791EE "INC <$51"; 079E64 "LDA <$51": the
# attract jumps to its scene 5)
4851  var  coins_inserted  u8
# the copy of the K053246's register 5 (1FA5: bit 4 its IRQ, which starts the sprite DMA; bits 0-1 flipped): 078808
# "STA <$55" with each "STA $1FA5"
4855  var  sprite_chip_control  u8
# set when the frame's sprites are written (079135 "LDA #$01; STA <$56"), cleared by the FIRQ once the DMA took them
# (0791D4 "CLR <$56"); the IRQ waits for it (079130 "LDA <$56; BNE"), the boot too (078814)
4856  var  dma_pending  u8
# the random number (079548 "LDD <$58" ... "ADDD #$3711; STD <$58"; read as a byte by the banks: "LDA <$58")
4858  var  random_number  u8
# the lives a player starts with: the setting 59F5 plus one (078A4F "LDA #$04,X; INCA; STA <$5A"; 07B76F "ADDA <$5A")
485A  var  lives_per_credit  u8
# the screen clears queued and not done yet (0797BA "INC <$5D" for job 0, 07980E "CLR <$5D" when it ran; 079EF6 "LDA
# <$5D; BNE" waits)
485D  var  layer_clear_pending  u8
# the setting "video screen flip" (078AAC "STA <$5F"; 07961A "LDA <$5F": the sprite chip's offsets)
485F  var  flip_screen  u8
# the colour job 1 prints in (079824 "STB <$71", 07981E "LDA <$71")
4871  var  text_colour  u8
# the map's scene and its area (079EFE "STD <$75", 07C931 by them: the tile banks; symbols.txt's scene tables by
# direct page 75 and 76)
4875  var  map_scene  u8
4876  var  map_area  u8
# the frames counted before a button may skip (079784 "CMPA <$78", 0797AD "INC <$78", 0797B2 "CLR <$78")
4878  var  skip_wait  u8
# when set, the sprites are left as they are (079841 "LDA <$79; BNE"; 07B45A "STA <$79")
4879  var  objects_frozen  u8
# the kind of palette job 07BAC7 starts (079041 "STA <$7E"; symbols.txt's palette_request_handlers by direct page 7E)
487E  var  palette_request_kind  u8
# the K053246's scroll registers' copies (1FA0, 1FA2: 078A87 "STD <$86", 078A91 "STD <$89"), by the flip setting
4886  var  sprite_scroll_x  u16
4889  var  sprite_scroll_y  u16
# the camera's place in the stage, across and on the floor (16.8): a spawn's x less it (07CA07 "SUBD <$AC"), its y
# with it (07CA28 "ADDD <$B2"); the floor map by it (079501 "ADDD <$AC", 079532 "ADDD <$B2"); the IRQ keeps last
# frame's (07910C-07911E)
48AC  var  camera_x  u16
48B2  var  camera_y  u16
# the camera's speeds (bank 13: "LDD <$DE" ... added to 48AC; 0798F5 "LDD <$DE; BMI", 07990E "LDD <$E0")
48DE  var  camera_x_speed  s16
48E0  var  camera_y_speed  s16
# the tile layers' scrolls (layers' layer_map records: 2800 48BE 48C5 ... and 3000 48CE 48D5): the IRQ writes them to
# the K052109 (0790B6 "LDD <$BE; SUBD #$005A" into 1A00, 0790C4 "LDB <$C6" into 180C, 0790DD "LDD <$CE" into 3A00,
# 0790EB "LDB <$D6" into 380C) and keeps them as last frame's (0790F4-079109 "STD <$C1", "STD <$C8", "STD <$D1", "STD
# <$D8"; layer_map's last_scroll_y names 48C8 and 48D8)
48BE  var  layer_a_scroll_x  u16
48C1  var  layer_a_last_scroll_x  u16
48C5  var  layer_a_scroll_y  u16
48C8  var  layer_a_last_scroll_y  u16
48CE  var  layer_b_scroll_x  u16
48D1  var  layer_b_last_scroll_x  u16
48D5  var  layer_b_scroll_y  u16
48D8  var  layer_b_last_scroll_y  u16
# the queue of sound commands for the Z80 (0797ED "LDX $4900; STD ,X++", 4904-493F round; the IRQ sends one a frame:
# 079054 "LDX $4902; CMPX $4900; BEQ", "LDD ,X++; STD $1FC6")
4900  var  sound_queue_write  u16
4902  var  sound_queue_read  u16
4904  var  sound_queue[30]  u16
# the main loop's jobs (0797B7 "LDX $4940; STD ,X++", 4944-497F round; 0789CB "LDX $4942; LDD ,X; BMI": FFFF none)
4940  var  job_queue_write  u16
4942  var  job_queue_read  u16
4944  var  job_queue[30]  u16
# the high score table, 10 records of 8 bytes (07893E "LDU #$4980", 50 bytes from default_high_scores; 07971D "LDX
# #$4983" their scores)
4980  var  high_scores[80]  u8
# the players' scores, BCD words (the score jobs: 079828 "LDX #$49D4", 07982E "LDX #$49DC", 079834 "LDX #$49E4",
# 07983A "LDX #$49EC"; player_records' field 09)
49D4  var  marge_score  u16
49DC  var  homer_score  u16
49E4  var  bart_score  u16
49EC  var  lisa_score  u16
# the RAM test's start (078DD2 "STU $5D00"), whether a check failed (078E81 "ORB $5D02; STB $5D02"; the restart at
# 078D82), and each chip's result for the screen (078B38 "STB $5D04" ... the EEPROM's 5D09; 5D03 the work RAM's, which
# the boot tested already)
5D00  var  ram_test_start  u16
5D02  var  check_failed  u8
5D03  var  check_11f  u8
5D04  var  check_1j  u8
5D05  var  check_16g  u8
5D06  var  check_16f  u8
5D07  var  check_9g  u8
5D08  var  check_8g  u8
5D09  var  check_12c  u8
# the settings the test mode keeps (copied from the EEPROM): the coin setting first (078A1A "LDX #$59F1; LDA ,X";
# coinages by it), the coin slots' 59F8 (078A3A "LDA #$07,X")
59F1  var  coin_setting  u8
59F8  var  coin_slots_setting  u8

# ======== params and locals ========
param print_text d colour
param print_text u text
param erase_text u text
param print_big_text u text
param erase_big_text u text
param print_hex_byte x place
param print_hex_word x place
param print_hex_word d value
param print_bcd_byte x place
param print_bcd_word x place
param print_bcd_word d value
param print_check_result u place
param print_check_result d bad
param print_rom_sum x place
param print_rom_sum d bad
param test_ram_words y count
param test_ram_words u start
param test_ram_bytes y count
param test_ram_bytes u start
param add_fixed_bytes x start
param add_fixed_bytes u count
param send_sound_command_and_wait d command
param queue_sound d command
param queue_sound_unless_attract d command
param queue_sound_always d command
param queue_job d job
param add_score x score
param add_score d addition
param high_score_rank d score
param insert_high_score d place
param check_skip d wait
param read_controls u port
param update_controls u port
param floor_at_offset d offsets
# the hitter, read through field hit_by (07CFAD "LDU #$25,X"; 07E21B "LDU #$25,X")
local object_take_special_hit 07CFAD u hitter object
local enemy_hurt_start 07E21B u hitter object
# these replace the lines symbols.txt has on the functions' old names (sub_079AE9, sub_07E1E8)
local draw_object 079B0D,079B26 u kind_set animation_set
local draw_object 079B3E u set_index animation_set_index
local enemy_hurt_start 07E1FB u animations hit_animation

# ======== the fixed program, 07A000-07BFFF ========
# ======== the fixed program 07A000-07BFFF: the attract's screens, the game's phases and steps, the players, the
# palette jobs (proposals for symbols.txt; fixed_3D.c) ========
# Evidence quotes are the listing's (build\listing\simpsons.s); the tables of handlers were read from the ROM:
# - game_mode's handlers E42B: 9184 (0, the test mode: bank 2F's 6009), 9E39 (1, the attract), A396 (2, the game)
#   (07913A "LDA <$00; ASLA; LDX #$E42B; JSR [A,X]")
# - the attract's steps E66B by attract_step (079E7F "LDX #$E66B; LDA <$01"): 9EDA profiles, A075 demo, 9F36 title,
#   A209 high scores, A2CD warning, A34E the title after a coin; each step's phases by mode_phase: E677, E687 (A07E
#   A12B), E67F (9F3F 9F52 A007 A024), E68B (A212 A240 A28C A29B), E693 (A2D6 A2EB A314 A329), E69B (A357 A35F A384)
# - the game's phases E6CB by mode_phase (07A3B0 "LDX #$E6CB; LDA <$02"): A3C0 start, A415 the steps, B458 continue,
#   B464 game over, B4F5 name entry
# - the game's steps E6D9 by game_step (07A415 "LDX #$E6D9; LDA <$03"): A41E (0 portraits), A4CE (1 story 1), A52E (2
#   stage 1), A656 (3 bonus 1), A76D (4 stage 2), A8AE (5 story 2), A8B8 (6 stage 3 forest), AA0C (7 stage 3
#   cemetery), AB4F (8 stage 4), AC74 (9 stage 5), ADC4 (10 story 3), ADD2 (11 stage 6), AF20 (12 bonus 2), B068 (13
#   stage 7), B1D4 (14 story 4), B1DE (15 stage 8), B40A (16 the ending); each step's phases by step_phase: E6FB, E701,
#   E707, E717, E721, E731, E743, E751, E761, E773, E785, E791, E7A3, E7C1 (in that order)
# - the map scenes each stage sets (direct page 75): 82 stage 1, 83 bonus 1, 84 stage 2, 86 forest, 87 cemetery, 88
#   stage 4, 89 stage 5, 8A stage 6, 8B bonus 2, 8C stage 7, 8D stage 8, 03 the name entry, 02 the high scores
# - songs (assets/sound_data/music/music.txt): 87 bonus_start, 90 name_entry, 92 game_over, 94 stage_3_part_1_end,
#   A1 continue; command 00 stops the sound
# Sound commands go through 0797ED (always), 0797E3 (not in the attract) or 0797D3 (in the attract only with its demo
# sounds); 0797B7 queues a job of the main loop (A = 0: job 0, the tile layers' clear, which layer_clear_pending
# counts: 0797BA "INC <$5D", 07980E "CLR <$5D"); 079784 waits A frames, then a press of a button skips (carry set)

# ======== files ========
07A007  file  attract/title    # the attract's title screen (its end) and the title shown after a coin
07A075  file  attract/demo    # the attract's demo: the recorded inputs played through the game
07A209  file  attract/high_scores    # (the high score table's start)
07A2CD  file  attract/warning    # the attract's export warning (skipped in this set)
07A34E  file  attract/title    # (the title after a coin, short of a credit)
07A396  file  game/game    # the game mode's frame and its first phase
07A41E  file  game/start    # the game's start: the four portraits the players join on
07A4CE  file  stages/story_steps    # the story steps
07A52E  file  stages/stage_1    # stage 1, downtown Springfield
07A656  file  stages/bonus_1    # bonus stage 1
07A76D  file  stages/stage_2    # stage 2, Krustyland
07A8AE  file  stages/story_steps
07A8B8  file  stages/stage_3    # stage 3: the forest, then the Springfield Discount Cemetery
07AB4F  file  stages/stage_4    # stage 4, Moe's Tavern
07AC74  file  stages/stage_5    # stage 5, Springfield Butte
07ADC4  file  stages/story_steps
07ADD2  file  stages/stage_6    # stage 6, Dreamland
07AF20  file  stages/bonus_2    # bonus stage 2
07B068  file  stages/stage_7    # stage 7, Channel 6
07B1D4  file  stages/story_steps
07B1DE  file  stages/stage_8    # stage 8, the Springfield Nuclear Power Plant
07B40A  file  scenes/ending    # the ending
07B458  file  game/continue    # the continue
07B464  file  game/game_over    # GAME OVER and the high score check
07B4F5  file  game/name_entry    # the name entry for a high score
07B5A9  file  stages/stage    # what every stage shares: its opening, its frame, its end
07B6A6  file  game/game    # (the game's end)
07B70D  file  players/players    # the players: joining, playing, the continue's countdown, game over
07B8B0  file  game/continue    # (the check that every player is out, the continue screen)
07BA34  file  players/players    # (the count of the players in the game, the points for beaten enemies)
07BA87  file  stages/stage    # (the step's scene, the stages' music)
07BAC6  file  video/palette    # the palette requests and the palette jobs that run them a frame at a time

# ======== the attract: the title ========
# 07A007 "BSR $A052" (title_scroll_layers), "DEC <$09; BNE", then 07A00F "LDB #$82; LBSR $9311" (bit 7: game text 02,
# the copyright, erased), 07A015 "LDB #$10", 07A01B "LDB #$11" (texts 10 and 11: "BINKY IS A LIFE IN HELL CHARACTER",
# "BONGO IS ..."), 07A020 "INC <$02"; phase 2 of the title step (table E67F)
07A007  func  title_show_notices
comment title_show_notices The title's second phase: the layers keep sliding; when attract_timer runs out the copyright gives way to the Binky and Bongo notices
# 07A024 "BSR $A052; DEC <$09; BNE", 07A02B "CLRD; STD <$C5; STD <$D5" (both layers' scroll y), 07A032 "LBSR $955F"
# (the objects cleared), 07A035 "LDA #$03; STA <$7E; LDD #$0000; LBSR $BAC7" (background colour 0), 07A040 "INC <$01"
# and 4802-4806 cleared: the attract's next step (the high scores)
07A024  func  title_end
comment title_end The title's last phase: when attract_timer runs out again, the scroll, the objects and the background colour are reset and the attract moves to its next step
# 07A052 "LDD <$BF; SUBD #$0040; STD <$BF; LDA <$BE; SBCA #$00; STA <$BE" (layer A's scroll x, 3 bytes, a quarter of
# a pixel less), 07A063-07A071 the same added to layer B's (CE-D0)
07A052  func  title_scroll_layers
comment title_scroll_layers Slides the title's two tile layers a quarter of a pixel a frame, layer A one way and layer B the other

# ======== the attract: the demo ========
# 07A075 "LDX #$E687; LDA <$02; ASLA; JMP [A,X]": A07E, A12B
07A075  func  attract_demo
comment attract_demo The attract's demo step: its start, then its frames, by mode_phase
# 07A07E "LBSR $9269" (the tile layers), "LBSR $96A3" (the game's variables), "LBSR $955F" (the objects), 07A08C "LDD
# #$0880" (palette sets), 07A092 "CLRD; STD <$58; STD <$15" (the random seed, the frame count), 07A099-07A0A3 5800-58FF
# cleared, 07A0A4 "LDX #$E6A1; LDA <$5E; ASLA; LDX A,X" (demos[demo_number]): its players (07A0AF "STA <$50"), frames
# (07A0B4 "STD $5800"), step (07A0BA "STA <$03"), bank 2C (07A0C8), each player's first input step at 5810 + 10 x
# player (07A0F4 "STU ,Y"), its lives 2 and state 2 when it plays (07A10D-07A114)
07A07E  func  demo_start
comment demo_start Starts the attract's demo: clears the screen, the objects and the game's variables, then from the demo's record sets the players who play, its frames, the step it plays and each player's recorded inputs
# 07A12B "LDA <$04; CMPA #$02; BNE": at the demo stage's phase 2, bank 20's 600C (040B37: GAME OVER in big letters,
# 0416F4) and 07A141 "LDA #$02; STA <$7E; LDD #$000B; LBSR $BAC7" (palette effect 0B); 07A14C "DECW $5800; LBEQ" (the
# end: 07A1E7 "INC <$5E" the next demo of 3, 07A1F7 "INC <$01"); each player's input step (07A17A "LDU ,Y; LDA ,U;
# STA #$03,Y", 07A181 "DEC #$02,Y", 07A186 "LEAU #$02,U" the next), 07A1AA "COM $5813; LDU #$5813; LDX #$4840; LBSR
# $924D" (the controls made from them, for each player), 07A1DE "LBSR $A396" (the game's frame), 07A1E1 "LDA #$01;
# STA <$11"
07A12B  func  demo_play
comment demo_play A frame of the attract's demo: the recorded inputs become the players' controls and the game's frame runs; GAME OVER is shown over it once its stage starts, and when demo_frames runs out the next demo is chosen and the attract moves on

# ======== the attract: the high scores ========
# 07A209 "LDX #$E68B; LDA <$02; ASLA; JMP [A,X]": A212, A240, A28C, A29B
07A209  func  attract_high_scores
comment attract_high_scores The attract's high score step, by mode_phase
# 07A212 "LDD #$0000; LBSR $97B7" (the layers' clear queued), 07A218 background colour 0, 07A223 "LDD #$FFF0; STD <$BE;
# STD <$CE", 07A22C "LDD #$0F01" (palette sets), 07A237 "LDA #$40; STA <$09"
07A212  func  high_scores_start
comment high_scores_start Starts the high score screen: queues the tile layers' clear, sets the background colour, the scroll and the palettes
# 07A240 "LDA <$5D; BNE" (the clear not done yet), 07A245 "LDA #$02; STA <$75; CLR <$76; LBSR $C931" (map scene 02's
# tile banks), 07A252-07A27B the K053251's colour bases (1FB9/1FBA, its registers 9 and 10: 3F 36, then 13 2C) around 07A263/07A26A "LBSR $C4A3"
# (both layers drawn, 26 columns), 07A282 "LDD #$7A53" (background colour)
07A240  func  high_scores_draw_background
comment high_scores_draw_background Once the layers are clear, draws map scene 02 on both tile layers as the high score screen's background
# 07A28C "LDB #$11; STB <$0E; SETLN <$0E", 07A298 "LBRA $6000" (bank 11: the name entry and the high scores)
07A28C  func  high_scores_show
comment high_scores_show Runs bank 11's high score table for the frame
# 07A29B background colour 0, 07A2A6 "LBSR $92DD" (the sprites), 07A2AE "LDD #$0F00", 07A2B4 "CLRD; STD <$BE; STD
# <$CE", 07A2BB "INC <$01" and 4802-4806 cleared
07A29B  func  high_scores_close
comment high_scores_close Ends the high score screen: the background colour, the sprites, the palettes and the scroll reset, and the attract's next step

# ======== the attract: the export warning ========
# 07A2CD "LDX #$E693; LDA <$02; ASLA; JMP [A,X]": A2D6, A2EB, A314, A329
07A2CD  func  attract_warning
comment attract_warning The attract's export warning step, by mode_phase
# 07A2D6 "BRA $A32E": the step's first phase goes straight to its end, over the phase that starts the warning
# (07A2D8, which nothing reaches)
07A2D6  func  warning_skip
comment warning_skip Skips the export warning: the step ends at once and the attract starts over
# 07A2D8 "LDD #$0F07" (palette sets), 07A2E3 "CLRD; LBSR $97B7" (the layers' clear queued), "INC <$02": the warning's
# first phase, which warning_skip took the place of
07A2D8  func  warning_start
comment warning_start Unused: would start the export warning, with its palettes and the tile layers' clear
# 07A2EB "LDA <$5D; BNE", 07A2F0 "CLRA; CLRB; LBSR $9311" (game text 00, the logo's tiles), 07A2F5 "LDA #$80; LDB
# #$0D" (text 0D "WARNING"), 07A2FC "LDB #$0E" (text 0E "THIS GAME IS FOR USE ONLY IN ASIA..."), 07A307 "LDD #$6D6B"
# (background colour), 07A30D "CLR <$09" (256 frames); no scenario runs it (warning_skip)
07A2EB  func  warning_first_page
comment warning_first_page Never reached: prints WARNING and the first page of the export warning once the layers are clear
# 07A314 "DEC <$09; BNE", 07A31A "LDB #$8E" (text 0E erased), 07A320 "LDB #$0F" (text 0F "DEFECTS. FURTHERMORE...")
07A314  func  warning_second_page
comment warning_second_page Never reached: after attract_timer's frames, the export warning's second page in place of the first
# 07A329 "DEC <$09; BNE $A34D", then into 07A32E
07A329  func  warning_end
comment warning_end Never reached: after attract_timer's frames, the warning ends and the attract starts over
# 07A32E background colour 0 (07A333 "LDD #$0000; LBSR $BAC7"), 07A339 "INC <$01", 4802-4806 cleared, 07A34A "CLR
# <$01": the attract's step 0 (the characters' profiles) again
07A32E  func  attract_restart
comment attract_restart Starts the attract over from its first step, the characters' profiles

# ======== the attract: the title after a coin ========
# step 5 (079E64 "LDA <$51; BEQ ... LDA #$05; STA <$01": a coin inserted this frame, 0791EE "INC <$51", short of a
# credit, which would start the game: 079E46 "LDD <$37; BEQ"); 07A34E "LDX #$E69B; LDA <$02; ASLA; JMP [A,X]": A357,
# A35F, A384
07A34E  func  attract_coin_title
comment attract_coin_title The attract's step after a coin that gave no credit yet: the title with INSERT COIN, by mode_phase
# 07A357 "CLRD; LBSR $97B7; INC <$02"
07A357  func  coin_title_start
comment coin_title_start Queues the tile layers' clear for the title after a coin
# 07A35F "LDA <$5D; BNE", 07A364 "LBSR $9692" (the scores), "CLR $1C80", 07A36B "LDD #$0000; LBSR $97D3" (the sound
# stopped), 07A371 "LBSR $955F" (the objects), 07A374 "LBSR $9F58" (the title screen's drawing), 07A377 "LDD #$FF80;
# STD <$BE", 07A37D "LDD #$0080; STD <$CE"
07A35F  func  coin_title_draw
comment coin_title_draw Once the layers are clear, clears the scores, the sound and the objects and draws the title with its two halves apart
# 07A384 "CLRB; LDA <$16; ANDA #$20; BEQ; LDB #$80", 07A38E "ADDB #$12", 07A390 "LDA #$80; LBSR $9311": game text 12
# "INSERT COIN", printed or (bit 7) erased by bit 5 of the frame count
07A384  func  coin_title_blink
comment coin_title_blink Makes INSERT COIN blink: printed or erased every 32 frames by frame_count

# ======== the game mode ========
# game_mode 2's handler (table E42B), also run by demo_play (07A1DE): 07A396 "LBSR $9548" (the random number),
# 07A399 "LDA #$01; STA <$6A", 07A3A0-07A3AA bank 20's 600F (0408E2: each gauge's byte 3 counted down), 07A3AD "LBSR
# $BA34", 07A3B0 "LDX #$E6CB; LDA <$02; ASLA; JSR [A,X]", 07A3B9 "LBSR $BA50", 07A3BC "CLR <$11"
07A396  func  game_mode_frame
comment game_mode_frame The game mode's frame: the random number, the gauges shown, the players counted, the game's phase by mode_phase, the points of the beaten enemies; in_attract cleared
# 07A3C0 "CLR <$6A; LDX #$E6D5; LDA <$03; ASLA; JMP [A,X]": A3CC, A3EB
07A3C0  func  game_start_phase
comment game_start_phase The game's first phase, by game_step: the screen cleared, then the palettes
# 07A3CC "LDA <$5D; BNE", "CLR $1C80", 07A3D5 "LDD #$0000; LBSR $97B7", 07A3DB "LBSR $92DD" (the sprites), "LBSR
# $9692" (the scores), 07A3E1 "LDD #$0000; LBSR $97ED" (the sound stopped), "INC <$03"
07A3CC  func  game_start_clear
comment game_start_clear Clears the sprites, the scores and the sound and queues the tile layers' clear as a game starts
# 07A3EB "LDA <$5D; BNE", background colour 0, 07A400 "LDD #$0F00" (palette sets), 07A406 "INC <$02" and 4803-4806
# cleared: the steps from step 0
07A3EB  func  game_start_palettes
comment game_start_palettes Once the layers are clear, sets the background colour and the palettes and moves the game on to its steps, from the portraits
# 07A415 "LDX #$E6D9; LDA <$03; ASLA; JMP [A,X]" (the 17 steps)
07A415  func  game_run_step
comment game_run_step Runs the game's step, by game_step: the portraits, the stories, the stages, the bonus stages and the ending

# ======== the game's start: the portraits ========
# 07A41E "LDX #$E6FB; LDA <$04; ASLA; JMP [A,X]": A427, A460, A4A5
07A41E  func  step_portraits
comment step_portraits Step 0, the game's start on the four portraits, by step_phase
# 07A427 "LBSR $92DD", 07A42A "LDD #$0000; LBSR $97B7", 07A430 "LDA #$07; STA <$7E; LDD #$0200" (a palette clear),
# 07A43B-07A447 bank 13's 602A (027200: palette effects 7-A), 07A44A "LDD #$FFF0; LBSR $B632", 07A450 "LBSR $B64C",
# 07A456 "LDD #$0780; STD <$0B" (1920 frames)
07A427  func  portraits_start
comment portraits_start Starts the portraits: the sprites and the tile layers cleared, their palettes, the scroll and step_timer set to 32 seconds
# 07A460 "LDA <$5D; BNE", 07A465 "DECW <$0B; BNE": at 0, 07A46A "LDA #$A0; STA <$42; STA <$46; STA <$4A; STA <$4E"
# (every player's newly pressed controls: start and a button) and the players' handling, then 07A4B9; else 07A47D
# "CLR <$72", bank 2F's 6015 (05ED56: the four portraits, symbols.txt portrait_areas; a press of a player in the game
# counts in <$72), 07A48F "LDA <$72; BEQ", 07A494 "LDA <$3B; BNE $A4B9", 07A499 "LDA #$40; STA <$0B" (64 frames)
07A460  func  portraits_run
comment portraits_run A frame of the portraits: the players join; when one has pressed, a short wait follows (none with separate coin slots), and when step_timer runs out everyone with a credit is made to join
# 07A4A5 bank 2F's 6015, 07A4B4 "DEC <$0B; BNE"
07A4A5  func  portraits_wait
comment portraits_wait The portraits' last 64 frames after a player has pressed
# 07A4B9 "CLRD; STD <$0B; INC <$03", 4804-4806 cleared, 07A4CB "LBRA $B70D"
07A4B9  func  portraits_end
comment portraits_end Ends the portraits: step_timer cleared and the game's next step (story 1), with the players' handling

# ======== the stories ========
# 07A4CE "CLR <$6A; LDX #$E701; LDA <$04; ASLA; JMP [A,X]": A4DA, A4EA, A4F4
07A4CE  func  step_story_1
comment step_story_1 Step 1, the first story (Smithers takes the diamond and Maggie), by step_phase, the gauges hidden
# 07A4DA "LBSR $92DD; LBSR $960F" (the scene's variables), 07A4E0 "LDD #$0000; LBSR $97B7", "INC <$04"
07A4DA  func  story_1_start
comment story_1_start Clears the sprites and the scene's variables and queues the tile layers' clear for the first story
# 07A4EA "LDA <$5D; LBNE; INC <$04"
07A4EA  func  story_1_wait_layers
comment story_1_wait_layers Waits for the tile layers' clear
# 07A4F4 "LDA #$01; STA <$72", bank 13's 6009 (026036, the stage's frame work) and 602D (02722D: the story's script by
# 18E0, table 7ED1), 07A517 "LDA <$72; BNE", 07A51C "INC <$03"; 07A52A "LBSR $B70D"
07A4F4  func  story_1_run
comment story_1_run A frame of the first story, run by bank 13 until it clears scene_running; then the game's next step (stage 1)
# 07A8AE "CLR <$6A; LBSR $BA87; INC <$03": the story itself plays as the next stage's opening (stage_opening, the
# scene_routines table, bank 1F's actor scripts)
07A8AE  func  step_story_2
comment step_story_2 Step 5, the second story: only sets the step's scene and moves on; the story plays in the next stage's opening
# 07ADC4 "CLR $1C80; CLR <$6A; LBSR $BA87; INC <$03"
07ADC4  func  step_story_3
comment step_story_3 Step 10, the third story: only sets the step's scene and moves on
# 07B1D4 "CLR <$6A; LBSR $BA87; INC <$03"
07B1D4  func  step_story_4
comment step_story_4 Step 14, the fourth story: only sets the step's scene and moves on

# ======== the stages: what each one shares ========
# Each stage's phases (tables E707, E721, E731, E743, E751, E761, E773, E791, E7A3): setup (07A537: "CLR <$6A", "LBSR
# $92DD", "LBSR $960F", the sound stopped, "LBSR $9269", 07A549-07A559 "LDB #$13 ... LDX $600C; STX <$A4"
# (stage_slots[n].record), "LBSR $BA87"); title (07A563: bank 13's 6006 = 026E1D, symbols.txt's "stages' title
# cards"); start (07A572: palette sets, 07A57D-07A586 B632/B64C the scroll, "LBSR $BA93" the music, 07A58C-07A59A the
# K053251's priorities, 07A59C "LDA #$82; STA <$75; CLR <$76; LBSR $C931", 07A5A7 "LBSR $C4A3" layer A, 07A5B1 "LBSR
# $C4E1" layer B, 07A5B4 "LBSR $C954" (the scene's spawn list started, the objects run once), bank 1F's 6057
# (03ED31: the scene's 8 bytes at 1840, the stage's flags 184B 184E 1850 185A cleared), 07A5D6 "LDA <$50; STA <$85");
# opening (07A5E0 "LBRA $B5A9"); play (07A5E3 "LBSR $B5DD; LDA <$7C; BEQ; CLR <$7C; INC <$80; LBSR $BA93"); over
# (07A5F5 "LBRA $B666"); exit (07A5F8 "LBRA $B676"); end (07A5FB: the stage's closing scene until scene_running is cleared,
# 07A629 "LDD #$0000; LBSR $97ED", "LBSR $92DD", 07A632 "INC <$03")
# 07B5A9 "LDA <$11; BNE $B5D3", 07B5AE "LDA #$01; STA <$72", "LBSR $CBD2", 07B5B6 "LDX #$E7D3; LDA <$67; ASLA;
# ASLA; LEAX A,X", the bank, 07B5CC "JSR [,X]" (scene_routines), 07B5CE "LDA <$72; BNE", 07B5D3 "INC <$04", 07B5D6
# "LBSR $C016" (the hits), "LBSR $B70D"
07B5A9  func  stage_opening
comment stage_opening A frame of a stage's opening: its scene's routine from scene_routines (a story script for the actor) runs until it clears scene_running, then the stage plays; in the attract's demo it is skipped at once
# 07B5DD bank 20's 6012 (040C40: the game's rank), "LBSR $C016" (the hits), "LBSR $C985" (the spawns), "LBSR $CB9F",
# "LBSR $CB3C", "LBSR $CBD2", "LBSR $CC05" (the four object lists), bank 1C's 6000 (the players' objects), bank 1F's
# 603F, bank 13's 6009, "LBSR $B70D", 07B62E "LBSR $B8B0"
07B5DD  func  stage_play_frame
comment stage_play_frame A frame of a stage's play: the rank, the hits, the spawns, every object list, the players' objects, the players' handling and the check that someone still plays
# 07B632 "STD <$BE; STD <$CE; STD <$C1; STD <$D1; STD <$AC; STD <$AF", "CLRD; STD <$C3; STD <$D3"
07B632  func  set_scroll_x
comment set_scroll_x Sets the stage's and both tile layers' scroll x (and their last frame's copies) and clears the layers' x offsets
# 07B64C "STD <$C5; STD <$D5; STD <$C8; STD <$D8; STD <$B2; STD <$B5", "CLRD; STD <$CA; STD <$DA"
07B64C  func  set_scroll_y
comment set_scroll_y Sets the stage's and both tile layers' scroll y (and their last frame's copies) and clears the layers' y offsets
# 07B666 "LDA #$01; STA $184B" (the stage over: the players' code tests it, 03807A "TST $184B"), "LBSR $957F" (the
# enemies' list cleared), "INC <$04", "LBSR $B70D"
07B666  func  stage_over
comment stage_over Marks the stage over for the players' objects, clears the enemies and moves to the next phase
# 07B676 "LDA #$01; STA <$72", "LBSR $CB9F; LBSR $CBD2", bank 1C's 6000 (the players' objects), "LBSR $B70D", 07B693
# "LDA $184E; BEQ $B6A4" (set by the players' code, 038088 "STA $184E"), 07B699 "LDA <$50; STA <$85; INC <$04;
# COMA" (carry set)
07B676  func  stage_players_exit
comment stage_players_exit A frame of the players leaving the stage: when they are all out the stage's players are noted again, the next phase starts and it returns done (carry)
# 07B6A4 "CLRA; RTS": the end of stage_players_exit while the players are still in, and the routine of scenes 2, 7 and
# 0A in scene_routines (the stories' scenes, which no stage runs)
07B6A4  func  scene_routine_nothing
comment scene_routine_nothing Does nothing and returns not done: the story scenes' routine, and the players not all out yet
# 07BA87 "LDX #$E88D; LDA <$03; LDA A,X; STA <$67"
07BA87  func  set_step_scene
comment set_step_scene Sets current_scene from step_scenes by game_step
# 07BA93 "LDX #$E89D; BRA $BA9B"
07BA93  func  play_stage_music
comment play_stage_music Plays the music of the scene's current part (stage_part)
# 07BA98 "LDX #$E8B5" (from continue_screen, 07BA24 "LBSR $BA98"): the same records but scene 6's, 7's and 11's
07BA98  func  resume_stage_music
comment resume_stage_music Plays the scene's music again after a continue, from its own table
# 07BA9B "LDA <$7D; BNE" (nothing while boss_beaten), 07BAA0 "LDA <$67; ASLA; LDX A,X" (the scene's list), 07BAA6 "LDA
# <$80; ASLA" (x 4 in scene 6: 07BAAA "CMPB #$06"), 07BAB4 "LDD ,X++; LBSR $97E3" (a second command in scene 6)
07BA9B  func  play_scene_music
comment play_scene_music Sends the sound commands of the scene's music part from the given table (two in scene 6), unless boss_beaten

# ======== stage 1 (step 2) ========
# 07A52E "LDX #$E707; LDA <$04; ASLA; JMP [A,X]": A537 A563 A572 A5E0 A5E3 A5F5 A5F8 A5FB
07A52E  func  step_stage_1
comment step_stage_1 Step 2, stage 1 (downtown Springfield), by step_phase
# 07A537 (above; 07A555 "LDX $600C", stage_slots[0])
07A537  func  stage_1_setup
comment stage_1_setup Stage 1's setup: the gauges hidden, the sprites, the scene's variables and the tile layers cleared, the sound stopped, its stage entry and the step's scene
# 07A563 "LDB #$13 ... LBRA $6006"
07A563  func  stage_1_title
comment stage_1_title Stage 1's title card (STAGE 1 DOWNTOWN SPRINGFIELD), run by bank 13
# 07A572 "LDD #$0F81", 07A59C "LDA #$82; STA <$75"
07A572  func  stage_1_begin
comment stage_1_begin Stage 1's start: its palettes, scroll and music, map scene 82 on both layers, its spawns and objects, stage_players
07A5E0  func  stage_1_opening
comment stage_1_opening Stage 1's opening, its scene's routine
# 07A5E3 "LBSR $B5DD; LDA <$7C; BEQ; CLR <$7C; INC <$80; LBSR $BA93"
07A5E3  func  stage_1_play
comment stage_1_play A frame of stage 1's play; when boss_arrived is set the music moves to the stage's next part
07A5F5  func  stage_1_over
comment stage_1_over Stage 1 over: the enemies cleared
07A5F8  func  stage_1_exit
comment stage_1_exit Stage 1's players leaving
# 07A5FB "LBSR $CB9F; LBSR $CBD2", bank 1F's 6000 (03E80F: the actor at 5640 on story script 10), 07A610 "LDA #$01;
# STA <$72", bank 12's 6000 (024024), 07A624 "LDA <$72; BNE", the sound stopped, the sprites, "INC <$03"
07A5FB  func  stage_1_end_phase
comment stage_1_end_phase Stage 1's closing scene (bank 1F's actor script and bank 12's) until scene_running is cleared, then the sound stopped, the sprites cleared and the next step

# ======== bonus stage 1 (step 3) ========
# 07A656 "CLR <$6A; LDX #$E717; LDA <$04; ASLA; JMP [A,X]": A662 A689 A6CC A748 A75B
07A656  func  step_bonus_1
comment step_bonus_1 Step 3, bonus stage 1, by step_phase, the gauges hidden
# 07A662 "LBSR $92DD", "LDD #$0000; LBSR $97B7", "LBSR $960F", 07A673 "LDD #$0F82", 07A679 "LDD #$FFF0; LBSR $B632"
07A662  func  bonus_1_setup
comment bonus_1_setup Bonus stage 1's setup: the sprites, the scene's variables, the palettes and the scroll, the tile layers' clear queued
# 07A689 "LDA <$5D; BNE", 07A68E "LDD #$8700; LBSR $97E3" (song 87 bonus_start), 07A694 "LDA #$83; STA <$75", 07A6BC
# "LDD #$FF30; STD <$C5", 07A6C2 "LDD #$0180; STD <$0A"
07A689  func  bonus_1_draw
comment bonus_1_draw Once the layers are clear: the bonus start's music, map scene 83 on both layers and scene_timer set to 384 frames
# 07A6CC "LDA #$D0; LBSR $9784; BCS" (a button after D0 frames skips), 07A6E3 "DECW <$0A; BEQ", bank 10's 6009 (020009),
# "LBRA $B70D"; at the end 07A6FA "LBSR $955F", 07A70D "LBSR $9275" (a tile layer cleared), the scroll, 07A71C "LDA
# #$01; STA <$76; LBSR $C931", layer A drawn, 07A73A "CLR $18E0", the sound stopped, "INC <$04"
07A6CC  func  bonus_1_intro_phase
comment bonus_1_intro_phase A frame of bonus stage 1's instructions (bank 10); when scene_timer runs out or a button skips them, the objects are cleared and the bonus stage's area 1 is drawn
# 07A748 bank 10's 6000 (020000), "LBSR $B70D"
07A748  func  bonus_1_run
comment bonus_1_run A frame of bonus stage 1's game, run by bank 10
# 07A75B "LBSR $92DD; INC <$03", 4804-4806 cleared
07A75B  func  bonus_1_end_phase
comment bonus_1_end_phase Ends bonus stage 1: the sprites cleared and the next step

# ======== stage 2 (step 4) ========
# 07A76D "LDX #$E721; LDA <$04; ASLA; JMP [A,X]": A776 A7A2 A7B1 A81F A822 A834 A851 A876
07A76D  func  step_stage_2
comment step_stage_2 Step 4, stage 2 (Krustyland), by step_phase
# 07A794 "LDX $600F" (stage_slots[1])
07A776  func  stage_2_setup
comment stage_2_setup Stage 2's setup: the gauges hidden, the screen and the scene's variables cleared, the sound stopped, its stage entry and the step's scene
07A7A2  func  stage_2_title
comment stage_2_title Stage 2's title card, run by bank 13
# 07A7C2 "LDD #$0F83", 07A7DB "LDA #$84; STA <$75"
07A7B1  func  stage_2_begin
comment stage_2_begin Stage 2's start: its palettes, scroll and music, map scene 84 on both layers, its spawns and objects, stage_players
07A81F  func  stage_2_opening
comment stage_2_opening Stage 2's opening, its scene's routine
07A822  func  stage_2_play
comment stage_2_play A frame of stage 2's play; when boss_arrived is set the music moves to the stage's next part
# 07A834 "LDD <$AC; SUBD #$0680; NEGD; STD <$D3" (layer B's offset x), 07A83E "LDA #$01; STA <$76; LDB #$3C; LBSR
# $C4A3" (area 1 drawn, 3C columns), 07A848 "LDD #$4F00; LBSR $97D3" (sound 4F), 07A84E "LBRA $B666"
07A834  func  stage_2_after_boss
comment stage_2_after_boss Stage 2 after its boss: the background's area 1 drawn on the second layer, a sound, and the stage over
# 07A851 "LDA #$01; STA <$72", bank 1F's 6009 (03E872: the actor on story script 2C), 07A865 "LDA <$72; BNE",
# "INC <$04", "LBSR $B70D"
07A851  func  stage_2_closing_scene
comment stage_2_closing_scene Stage 2's closing story script for the actor (bank 1F) until it clears scene_running
# 07A876 "LDA #$F0; LBSR $9784; BCS" (skipped), bank 12's 6003 (024003, symbols.txt: stage 2's end, the players put
# and leaving), 07A891 "LDA <$72; BNE", the sound stopped, the sprites, "INC <$03"
07A876  func  stage_2_end_phase
comment stage_2_end_phase Stage 2's end, the players walking off (bank 12), which a button skips after F0 frames; then the next step

# ======== stage 3 (steps 6 and 7) ========
# 07A8B8 "LDX #$E731; LDA <$04; ASLA; JMP [A,X]": A8C1 A8ED A8FC A975 A978 A99B A9C2 A9D2 A9DB
07A8B8  func  step_stage_3_forest
comment step_stage_3_forest Step 6, stage 3's first part (the forest, map scene 86), by step_phase
# 07A8DF "LDX $6015"
07A8C1  func  stage_3_forest_setup
comment stage_3_forest_setup The forest's setup: the gauges hidden, the screen and the scene's variables cleared, the sound stopped, its stage entry and the step's scene
07A8ED  func  stage_3_forest_title
comment stage_3_forest_title Stage 3's title card, run by bank 13
# 07A90D "LDD #$0F85", 07A913 "LDA #$02; STA <$7E; LDD #$0000" (palette effect 0), 07A931 "LDA #$86; STA <$75"
07A8FC  func  stage_3_forest_begin
comment stage_3_forest_begin The forest's start: its palettes and palette effect, scroll and music, map scene 86 on both layers, its spawns and objects, stage_players
07A975  func  stage_3_forest_opening
comment stage_3_forest_opening The forest's opening, its scene's routine
# 07A978 "LBSR $B5DD", 07A97B "LDA <$81; BEQ", 07A980 "LDA #$08; STA <$82", 07A985 "LDA #$06; STA <$7E; LDD #$0E08;
# LBSR $BAC7" (a white flash), 07A990 "CLRA; LBSR $C51C" (tile picture 0), 07A994 "LBSR $95AF" (the list at 5280
# cleared), "INC <$04"
07A978  func  stage_3_forest_play
comment stage_3_forest_play A frame of the forest's play; on stage_cue a white flash with a tile picture, the second object list cleared and the next phase
# 07A99B "LBSR $B5DD", 07A99E "LDA <$81; BEQ; DEC <$82; BNE; LDA #$80; LBSR $C51C; CLR <$81" (the picture erased),
# 07A9B0 "LDA <$7D; BEQ", 07A9B5 "LDA #$01; STA $184B; INC <$04" (bank 1A's flying object sets boss_beaten as it moves
# the phase on: 034DD6 "STA <$7D", 034DD9 "INC <$04")
07A99B  func  stage_3_forest_cleared
comment stage_3_forest_cleared A frame of the forest's play after the flash: the picture erased after stage_cue_timer's frames; with boss_beaten the stage is over and the next phase starts
# 07A9C2 "LDD #$9400; LBSR $97E3" (song 94 stage_3_part_1_end), "LBSR $957F", "INC <$04"
07A9C2  func  stage_3_forest_over
comment stage_3_forest_over The forest over: its end music, the enemies cleared
# 07A9D2 "LBSR $B676; LBSR $C016; LBRA $B70D"
07A9D2  func  stage_3_forest_exit
comment stage_3_forest_exit The forest's players leaving, with the hits
# 07A9DB "LDA #$01; STA <$72", "LBSR $CB9F; LBSR $CBD2; LBSR $CC05", 07A9E9 "LDA <$72; BNE", the sound stopped, the
# sprites, "INC <$03", 4804 cleared, then into 07AA00
07A9DB  func  stage_3_forest_end_phase
comment stage_3_forest_end_phase The forest's end: three object lists run until one of their objects clears scene_running; then the sound stopped, the sprites cleared and the next step (the cemetery)
# 07AA00 "STD <$05; PULLS D; LBSR $C016; LBSR $B70D": the end of stage_3_forest_end_phase, reached by falling into it
07AA00  func  stage_3_forest_end_phase_tail
comment stage_3_forest_end_phase_tail The end of stage_3_forest_end_phase: step_subphase cleared, the hits and the players' handling
# 07AA0C "LDX #$E743; LDA <$04; ASLA; JMP [A,X]": AA15 AA3E AAEE AAF1 AB03 AB06 AB09
07AA0C  func  step_stage_3_cemetery
comment step_stage_3_cemetery Step 7, stage 3's second part (the Springfield Discount Cemetery, map scene 87), by step_phase
# 07AA30 "LDX $6018"
07AA15  func  stage_3_cemetery_setup
comment stage_3_cemetery_setup The cemetery's setup: the screen and the scene's variables cleared, the sound stopped, its stage entry and the step's scene (no title card)
# 07AA4F "LDD #$0880", 07AA5A "LDD #$0F86", palette effects 15 and 3B, bank 13's 602A (027200), 07AA88-07AA94 "LDX
# #$4000 ... LDA #$FF ... BMOVE" (4000-47FF filled with FF), 07AAA5 "LDA #$87; STA <$75", 07AABD "LDA #$01; STA <$8D"
07AA3E  func  stage_3_cemetery_begin
comment stage_3_cemetery_begin The cemetery's start: its palettes and effects, scroll and music, 4000-47FF filled with FF, map scene 87 on both layers, in_cemetery set, its spawns and objects, stage_players
07AAEE  func  stage_3_cemetery_opening
comment stage_3_cemetery_opening The cemetery's opening, its scene's routine
07AAF1  func  stage_3_cemetery_play
comment stage_3_cemetery_play A frame of the cemetery's play; when boss_arrived is set the music moves to the stage's next part
07AB03  func  stage_3_cemetery_over
comment stage_3_cemetery_over The cemetery over: the enemies cleared
07AB06  func  stage_3_cemetery_exit
comment stage_3_cemetery_exit The cemetery's players leaving
# 07AB09 "LDA #$01; STA <$72", "LBSR $CB9F; LBSR $CBD2", bank 1F's 604B, 07AB23 "LDA <$72; BNE", the sound stopped,
# "INC <$03"; bank 13's 6009, "LBSR $B70D"
07AB09  func  stage_3_cemetery_end_phase
comment stage_3_cemetery_end_phase Stage 3's closing story script for the actor (bank 1F) until it clears scene_running; then the sound stopped and the next step

# ======== stage 4 (step 8) ========
# 07AB4F "LDX #$E751; LDA <$04; ASLA; JMP [A,X]": AB58 AB84 AB93 AC0C AC0F AC21 AC24 AC27
07AB4F  func  step_stage_4
comment step_stage_4 Step 8, stage 4 (Moe's Tavern), by step_phase
# 07AB76 "LDX $601B"
07AB58  func  stage_4_setup
comment stage_4_setup Stage 4's setup: the gauges hidden, the screen and the scene's variables cleared, the sound stopped, its stage entry and the step's scene
07AB84  func  stage_4_title
comment stage_4_title Stage 4's title card, run by bank 13
# 07ABA4 "LDD #$0E87", palette effect 3C, 07ABC8 "LDA #$88; STA <$75"
07AB93  func  stage_4_begin
comment stage_4_begin Stage 4's start: its palettes and palette effect, scroll and music, map scene 88 on both layers, its spawns and objects, stage_players
07AC0C  func  stage_4_opening
comment stage_4_opening Stage 4's opening, its scene's routine
07AC0F  func  stage_4_play
comment stage_4_play A frame of stage 4's play; when boss_arrived is set the music moves to the stage's next part
07AC21  func  stage_4_over
comment stage_4_over Stage 4 over: the enemies cleared
07AC24  func  stage_4_exit
comment stage_4_exit Stage 4's players leaving
# 07AC27 "LDA #$01; STA <$72", "LBSR $CB9F; LBSR $CBD2", bank 1F's 601E, "LBSR $C016", 07AC44 "LDA <$72; BNE", the sound
# stopped, the sprites, "INC <$03"
07AC27  func  stage_4_end_phase
comment stage_4_end_phase Stage 4's closing story script for the actor (bank 1F) until it clears scene_running; then the sound stopped, the sprites cleared and the next step

# ======== stage 5 (step 9) ========
# 07AC74 "LDX #$E761; LDA <$04; ASLA; JMP [A,X]": AC7D ACA9 ACB8 AD31 AD34 AD46 AD49 AD5B AD8F
07AC74  func  step_stage_5
comment step_stage_5 Step 9, stage 5 (Springfield Butte), by step_phase
# 07AC9B "LDX $601E"
07AC7D  func  stage_5_setup
comment stage_5_setup Stage 5's setup: the gauges hidden, the screen and the scene's variables cleared, the sound stopped, its stage entry and the step's scene
07ACA9  func  stage_5_title
comment stage_5_title Stage 5's title card, run by bank 13
# 07ACC9 "LDD #$0F88", palette effect 0F, 07ACED "LDA #$89; STA <$75"
07ACB8  func  stage_5_begin
comment stage_5_begin Stage 5's start: its palettes and palette effect, scroll and music, map scene 89 on both layers, its spawns and objects, stage_players
07AD31  func  stage_5_opening
comment stage_5_opening Stage 5's opening, its scene's routine
07AD34  func  stage_5_play
comment stage_5_play A frame of stage 5's play; when boss_arrived is set the music moves to the stage's next part
07AD46  func  stage_5_over
comment stage_5_over Stage 5 over: the enemies cleared
# 07AD49 "LBSR $B676; BCC; LDX <$A4; LEAX #$04,X; STX <$A4"
07AD49  func  stage_5_exit
comment stage_5_exit Stage 5's players leaving; when they are out, stage_record_entry moves to its next entry
# 07AD5B "LDA #$01; STA <$72", bank 1F's 6036, 07AD6F "LDA <$72; BNE; INC <$04"
07AD5B  func  stage_5_closing_scene
comment stage_5_closing_scene Stage 5's closing story script for the actor (bank 1F) until it clears scene_running
# 07AD8F "LDA #$F0; LBSR $9784; BCS", bank 12's 6006 (024006, symbols.txt: stage 5's end), 07ADAA "LDA <$72; BNE",
# the sound stopped, "INC <$03"
07AD8F  func  stage_5_end_phase
comment stage_5_end_phase Stage 5's end, the players walking off (bank 12), which a button skips after F0 frames; then the next step

# ======== stage 6 (step 11) ========
# 07ADD2 "LDX #$E773; LDA <$04; ASLA; JMP [A,X]": ADDB AE0B AE1A AE9D AEA2 AEB4 AEB9 AEBE AEEE
07ADD2  func  step_stage_6
comment step_stage_6 Step 11, stage 6 (Dreamland), by step_phase
# 07ADF9 "LDX $6027"
07ADDB  func  stage_6_setup
comment stage_6_setup Stage 6's setup: the gauges hidden, the screen and the scene's variables cleared, the sound stopped, its stage entry and the step's scene
07AE0B  func  stage_6_title
comment stage_6_title Stage 6's title card, run by bank 13
# 07AE2B "LDD #$0F8B", 07AE44 "LDA #$8A; STA <$75", 07AE6E "LDA #$03; STA $1C80", bank 12's 6015
07AE1A  func  stage_6_begin
comment stage_6_begin Stage 6's start: its palettes, scroll and music, map scene 8A on both layers, the K052109's 1C80 set to 3, bank 12's start, its spawns and objects, stage_players
# 07AE9D "LBSR $B5A9; BRA $AEDE" (bank 13's 6009)
07AE9D  func  stage_6_opening
comment stage_6_opening Stage 6's opening, its scene's routine, with bank 13's frame work
07AEA2  func  stage_6_play
comment stage_6_play A frame of stage 6's play; when boss_arrived is set the music moves to the stage's next part
07AEB4  func  stage_6_over
comment stage_6_over Stage 6 over: the enemies cleared
07AEB9  func  stage_6_exit
comment stage_6_exit Stage 6's players leaving
# 07AEBE "LDA #$01; STA <$72", bank 12's 601B, "LBSR $B70D", 07AED5 "LDA <$72; BNE; INC <$04"
07AEBE  func  stage_6_closing_scene
comment stage_6_closing_scene Stage 6's closing scene (bank 12) until it clears scene_running
# 07AEEE "LDA #$01; STA <$72", bank 12's 601E, 07AF02 "LDA <$72; BNE", "CLR $1C80", the sound stopped, "INC <$03"
07AEEE  func  stage_6_end_phase
comment stage_6_end_phase Stage 6's end (bank 12) until it clears scene_running; then the K052109's 1C80 cleared, the sound stopped and the next step

# ======== bonus stage 2 (step 12) ========
# 07AF20 "CLR <$6A; LDX #$E785; LDA <$04; ASLA; JMP [A,X]": AF2C AF5A AF97 B00F B022 B039
07AF20  func  step_bonus_2
comment step_bonus_2 Step 12, bonus stage 2, by step_phase, the gauges hidden
# 07AF2C "CLR $1C80", "LBSR $92DD", "LDD #$0000; LBSR $97B7", "LBSR $960F", 07AF41 "LDD #$0F82", the scroll, "LBSR
# $BA87"
07AF2C  func  bonus_2_setup
comment bonus_2_setup Bonus stage 2's setup: the sprites, the scene's variables, the palettes, the scroll and the step's scene, the tile layers' clear queued
# 07AF5A "LDA <$5D; BNE", 07AF5F "LDA #$8B; STA <$75", 07AF87 "LDD #$FF30; STD <$C5", 07AF8D "LDD #$0180; STD <$0A"
07AF5A  func  bonus_2_draw
comment bonus_2_draw Once the layers are clear: map scene 8B on both layers and scene_timer set to 384 frames
# 07AF97 "LDA #$D0; LBSR $9784", 07AFAE "DECW <$0A", bank 10's 600C (02000C); at the end the same as bonus_1_intro_phase's
07AF97  func  bonus_2_intro_phase
comment bonus_2_intro_phase A frame of bonus stage 2's instructions (bank 10); when scene_timer runs out or a button skips them, the objects are cleared and the bonus stage's area 1 is drawn
# 07B00F bank 10's 6003 (020003), "LBSR $B70D"
07B00F  func  bonus_2_run
comment bonus_2_run A frame of bonus stage 2's game, run by bank 10
# 07B022 "INC <$0B; LDA <$0B; CMPA #$40; BNE", "LDA <$50; STA <$85", "CLR <$0B; INC <$04"
07B022  func  bonus_2_wait
comment bonus_2_wait Waits 64 frames after bonus stage 2's game, then notes stage_players
# 07B039 "LDA #$C0; LBSR $9784; BCS", bank 12's 6009, 07B054 "LDA <$72; BNE", "INC <$03"
07B039  func  bonus_2_end_phase
comment bonus_2_end_phase Bonus stage 2's end (bank 12), which a button skips after C0 frames; then the next step

# ======== stage 7 (step 13) ========
# 07B068 "LDX #$E791; LDA <$04; ASLA; JMP [A,X]": B071 B09D B0AC B125 B128 B13A B13D B14C B19B
07B068  func  step_stage_7
comment step_stage_7 Step 13, stage 7 (Channel 6), by step_phase
# 07B08F "LDX $6021"
07B071  func  stage_7_setup
comment stage_7_setup Stage 7's setup: the gauges hidden, the screen and the scene's variables cleared, the sound stopped, its stage entry and the step's scene
07B09D  func  stage_7_title
comment stage_7_title Stage 7's title card, run by bank 13
# 07B0AC "LDD #$0000; LBSR $B632; LDD #$0000; LBSR $B64C", then into 07B0B8
07B0AC  func  stage_7_begin
comment stage_7_begin Stage 7's start: the scroll, then the rest of it in stage_7_begin_scene
# 07B0BD "LDD #$0F8D", 07B0C8 palette effect 29, 07B0E1 "LDA #$8C; STA <$75"
07B0B8  func  stage_7_begin_scene
comment stage_7_begin_scene The rest of stage 7's start: its palettes and palette effect, music, map scene 8C on both layers, its spawns and objects, stage_players
07B125  func  stage_7_opening
comment stage_7_opening Stage 7's opening, its scene's routine
07B128  func  stage_7_play
comment stage_7_play A frame of stage 7's play; when boss_arrived is set the music moves to the stage's next part
07B13A  func  stage_7_over
comment stage_7_over Stage 7 over: the enemies cleared
# 07B13D "LBSR $B676; BCC; LDX <$A4; LEAX #$04,X; STX <$A4"
07B13D  func  stage_7_exit
comment stage_7_exit Stage 7's players leaving; when they are out, stage_record_entry moves to its next entry
# 07B14C "LDA #$01; STA <$72", bank 12's 600C, bank 1F's 603C, "LBSR $CB9F; LBSR $CBD2", 07B175 "LDA <$72; BNE",
# 07B17A-07B184 "LDX #$18E0 ... BMOVE" (18E0-18FF cleared), "INC <$04"
07B14C  func  stage_7_closing_scene
comment stage_7_closing_scene Stage 7's closing scene (bank 12 and the actor's story script) until it clears scene_running; then 18E0-18FF cleared
# 07B19B "LDA #$01; STA <$72", bank 12's 600F, the object lists, 07B1B5 "LDA <$72; BNE", "INC <$03", background colour 0
07B19B  func  stage_7_end_phase
comment stage_7_end_phase Stage 7's end (bank 12) until it clears scene_running; then the next step and the background colour reset

# ======== stage 8 (step 15) ========
# 07B1DE "LDX #$E7A3; LDA <$04; ASLA; JMP [A,X]": B1E7 B219 B228 B245 B2DB B318 B32A B333 B36F B389 B39B B39E B3A1
# B3D5 B3DC
07B1DE  func  step_stage_8
comment step_stage_8 Step 15, stage 8 (the Springfield Nuclear Power Plant), by step_phase
# 07B205 "LDX $6024", 07B20F "LDA <$50; STA <$85"
07B1E7  func  stage_8_setup
comment stage_8_setup Stage 8's setup: the gauges hidden, the screen and the scene's variables cleared, the sound stopped, its stage entry, the step's scene and stage_players
07B219  func  stage_8_title
comment stage_8_title Stage 8's title card, run by bank 13
# 07B228 "LDA #$01; STA <$72", bank 12's 6018, 07B23C "LDA <$72; BNE; INC <$04"
07B228  func  stage_8_entrance
comment stage_8_entrance Stage 8's first scene (bank 12) until it clears scene_running
# 07B245 the scroll, palette sets 0880 0F8E 0892, palette effects 3D 3E, 07B29B "LDA #$8D; STA <$75", 07B2A0 "LDA #$01;
# STA <$76"
07B245  func  stage_8_begin
comment stage_8_begin Stage 8's start: its palettes and palette effects, scroll and music, map scene 8D's area 1 on both layers, its spawns and objects
# 07B2DB "LBSR $C985" (the spawns), "LBSR $B5A9", 07B2E1 "LDA <$72; BNE", 07B2E6 "INC <$80; LBSR $BA93", 07B2EC "CLRD;
# STD <$C3; STD <$D3; STD <$CA; STD <$DA", 07B2F9 "LDB #$40; LBSR $C4A3", 07B301 "LBSR $C4E1"
07B2DB  func  stage_8_opening
comment stage_8_opening Stage 8's opening, its scene's routine with the spawns running; when it is done the music's next part and both layers drawn again without their offsets
07B318  func  stage_8_play
comment stage_8_play A frame of stage 8's first part; when boss_arrived is set the music moves to the stage's next part
# 07B32A "LDA #$01; STA $184B; LBRA $B676"
07B32A  func  stage_8_first_part_exit
comment stage_8_first_part_exit Marks the first part over for the players' objects and runs their leaving
# 07B333 "CLR <$7D", "LDA #$01; STA <$72", bank 1F's 6054, 07B34A "LDA <$72; BNE", 07B34F "LDA #$01; STA <$81" (Burns'
# robot waits for it: 03AD6B "LDA <$81"), "INC <$04"; the object lists
07B333  func  stage_8_story
comment stage_8_story Stage 8's story after its first boss (bank 1F's actor script) until it clears scene_running; then stage_cue lets Mr. Burns' robot come in
# 07B36F "LDA <$7C; BEQ; CLR <$7C; INC <$80; LBSR $BA93", 07B37D "LBSR $CB9F; LBSR $CB3C; LBSR $CBD2" (no spawns, hits
# or players' objects), "LBRA $B70D"; the robot moves the phase on (03AE1D "INC <$04")
07B36F  func  stage_8_robot_entrance
comment stage_8_robot_entrance Stage 8 while Mr. Burns' robot comes in: only three object lists run (boss_arrived moves the music on) until it moves the phase on
07B389  func  stage_8_final_fight
comment stage_8_final_fight A frame of stage 8's fight with Mr. Burns' robot; boss_arrived moves the music to the next part
07B39B  func  stage_8_over
comment stage_8_over Stage 8 over: the enemies cleared
07B39E  func  stage_8_exit
comment stage_8_exit Stage 8's players leaving
# 07B3A1 "LDA #$01; STA <$72", bank 1F's 6051, the object lists, 07B3BB "LDA <$72; BNE; INC <$04"
07B3A1  func  stage_8_closing_scene
comment stage_8_closing_scene Stage 8's closing story script for the actor (bank 1F) until it clears scene_running
# 07B3D5 "LBSR $CB9F; LBSR $CBD2; RTS"
07B3D5  func  stage_8_objects_wait
comment stage_8_objects_wait Only two object lists run, until one of their objects moves the phase on
# 07B3DC "LDA #$01; STA <$72", bank 12's 6012, the object lists, 07B3F6 "LDA <$72; BNE", "INC <$03"
07B3DC  func  stage_8_end_phase
comment stage_8_end_phase Stage 8's end (bank 12) until it clears scene_running; then the next step, the ending

# ======== the ending (step 16) ========
# 07B40A "CLR <$6A; LDX #$E7C1; LDA <$04; ASLA; JMP [A,X]": B416 B423 B449
07B40A  func  step_ending
comment step_ending Step 16, the ending, by step_phase, the gauges hidden
# 07B416 "LBSR $92DD; LBSR $9269; LBSR $960F; INC <$04"
07B416  func  ending_setup
comment ending_setup Clears the sprites, the tile layers and the scene's variables for the ending
# 07B423 "LDA #$01; STA <$72", bank 11's 6006 (the ending: symbols.txt's "bank 11: the ending"), 07B437 "LDA <$72;
# BNE", "CLR <$6A; LDD #$0000; LBSR $97B7; INC <$04"
07B423  func  ending_run
comment ending_run A frame of the ending (the family, the staff roll), run by bank 11 until it clears scene_running; then the tile layers' clear queued
# 07B449 "CLR <$6A; LDA <$5D; BNE", "LBSR $955F; LBRA $B4C4"
07B449  func  ending_end
comment ending_end Once the layers are clear, clears the objects and ends the game as after GAME OVER: the high scores checked

# ======== the game's other phases: continue, game over, name entry ========
# mode_phase 2 (table E6CB): 07B458 "LDA #$01; STA <$79; LBSR $B70D; LBSR $B8B0"
07B458  func  game_continue_phase
comment game_continue_phase The game's continue phase: the objects frozen, the players' handling and the continue screen
# 07B8B0 "LDX #$E80F; LDA <$02; ASLA; JMP [A,X]": B8B9, B8BA (mode_phase 1), B901 (2), B8B9, B8B9; also run by
# stage_play_frame (07B62E)
07B8B0  func  game_phase_check
comment game_phase_check By mode_phase: while the stages play, the check that someone still plays; in the continue phase, the continue screen
# 07B8B9 "RTS"
07B8B9  func  game_phase_check_none
comment game_phase_check_none Nothing to check in this phase
# 07B8BA "LDA $49F0; CMPA #$02; BEQ" for the 4 players (07B8C2, 07B8CA, 07B8D2), the sound stopped, 07B8E0 "LDD #$A100"
# (song A1 continue), 07B8E6 "LDA <$8F; BEQ; CLR <$8F; CLR [$4890]", 07B8F2 "CLRD; STD <$93", 07B8F6 "LDA #$01; STA
# <$79", 07B8FB "LDA #$02; STA <$02"
07B8BA  func  check_players_out
comment check_players_out When no player is playing any more: the continue's music, the stall object freed, the objects frozen and the game's continue phase
# 07B901 a player playing again (07B901-07B922 "CMPA #$02") goes to 07BA15: bank 20's 6009 (040B26: CONTINUE erased),
# "LBSR $BA98", 07BA27 "LDA #$01; STA <$02; CLR <$79", "LBSR $927A". Else bank 20's 6006 (040B16: CONTINUE in big
# letters, 0416A3, and the count), 07B93E "INC $4A22; CMPA #$3C" a second (07B94A "LDA #$99; ADDA $4A1C; DAA"),
# 07B95D "LDA <$42; ORA <$46; ORA <$4A; ORA <$4E; ANDA #$10" (a press takes a second off), 07B985-07B9B0 each player
# counting down (state 3) no higher than it, 07B9BC "LDD #$0501" (a tick when it changes); at 0, 07B9CB-07B9F3 each
# such player's state 4, the sounds 00 7F 92 (song 92 game_over), 07BA0C "LDA #$03; STA <$02; CLR <$03"
07B901  func  continue_screen
comment continue_screen A frame of the continue screen: CONTINUE and its count, a second each 60 frames or each press; a player who joins resumes the game and its music; at 0 the waiting players are out and the game over phase starts
# mode_phase 3 (table E6CB): 07B464 "CLR <$6A; LDX #$E7C7; LDA <$03; ASLA; JMP [A,X]": B470 B4A1 B4BF
07B464  func  game_over_phase
comment game_over_phase The game over phase, by game_step, the gauges hidden
# 07B470 "CLRA; INCA; CMPA #$04; BNE" (a count that does nothing), 07B476 "LDD #$0001; LBSR $97B7" (job 0's second
# clear: 927A, the fixed layer's middle), 07B47C-07B486 3C00-3DFF cleared (the palette jobs), 07B487 palette effect 0B,
# 07B492 "LDA #$04; STA <$7E; LDD #$1E80" (a fade), "INC <$03"
07B470  func  game_over_start
comment game_over_start Starts GAME OVER: the fixed layer's texts cleared, every palette job stopped, a palette effect and the screen darkened
# 07B4A1 "LDA <$5D; BNE", bank 20's 600C (040B37: GAME OVER in big letters, 0416F4), 07B4B5 "LDD #$0180; STD <$0A"
07B4A1  func  game_over_show
comment game_over_show Once the fixed layer is clear, shows GAME OVER for scene_timer's 384 frames
# 07B4BF "DECW <$0A; BNE", then into 07B4C4
07B4BF  func  game_over_wait
comment game_over_wait Waits for scene_timer, then the game's end
# 07B4C4 "CLR $1C80; LBSR $92DD; LBSR $9269", 07B4CE "LDX #$49D4", "LDD ,X; LBSR $9718; BCS" (a high score) for each
# player 8 bytes on, else 07B4E5 "LBSR $B6A6"; a high score: 07B4E9 "LBSR $960F; LDA #$04; STA <$02; CLR <$03"; also
# from ending_end (07B454 "LBRA $B4C4")
07B4C4  func  game_finish
comment game_finish Clears the screen and checks each player's score against the high scores: the name entry when one gets in, else the game's end
# mode_phase 4: 07B4F5 "CLR <$6A; LDX #$E7CD; LDA <$03; ASLA; JMP [A,X]": B501 B577 B58C
07B4F5  func  name_entry_phase
comment name_entry_phase The name entry phase, by game_step, the gauges hidden
# 07B501 "LDD #$9000; LBSR $97ED" (song 90), "CLR <$79", the scroll, palette sets 070D 0880 0886, 07B53C "LDD #$3E36"
# (background colour), 07B542 "LDA #$03; STA <$75; CLR <$76; LBSR $C931", layer A drawn
07B501  func  name_entry_start
comment name_entry_start Starts the name entry: its music, the objects running again, its palettes and background, map scene 03 drawn
# 07B577 bank 11's 6003 (the name entry: symbols.txt's "bank 11: the name entry"), 07B586 "BCC; INC <$03"
07B577  func  name_entry_run
comment name_entry_run A frame of the name entry, run by bank 11 until it is done
# 07B58C "LBSR $92DD", the sound stopped, "LBSR $B6A6", background colour 0, 07B5A3 "LDA #$03; STA <$01" (the attract's
# high score step)
07B58C  func  name_entry_end
comment name_entry_end Ends the name entry: the sprites and the sound stopped, the game's end, and the attract set to show the high scores
# 07B6A6 4801-4806 cleared, 07B6B3 "LDX #$49F0; LDU #$49D2" each player playing (07B6BD "CMPA #$02") gets its life
# 28 (07B6C1 "LDA #$28; STA ,U") and is counted; none: 07B6D6 "LBSR $96A3", 07B6D9 "LDA #$01; STA <$00" (the attract),
# 07B6DE-07B6EA every player's state 0; some: 07B6EF "LBSR $9692" (the scores), palette sets 0F00, 07B6FD "LDA #$02;
# STA <$00; LDA #$01; STA <$02; STA <$03" (the game again, from step 1)
07B6A6  func  end_game
comment end_game The game's end: back to the attract, or a new game from the first story for the players who joined meanwhile

# ======== the players ========
# 07B70D "LDU #$4817" (each player's coin slot record, 8 bytes on: 07B724 "LEAU #$08,U"), 07B713 "LDX #$E819; LDA
# ,S; ASLA; LDX A,X" (player_records), 07B71B "LDY #$E803; LDA [#$17,X]; ASLA; JSR [A,Y]" (by the player's state: B731
# B74F B7E8 B843 B897 B74F), 4 players
07B70D  func  update_players
comment update_players Runs each player's state: out, joining, playing, the continue's countdown, game over
# state 0, 07B731 "CLR [#$19,X]", 07B734 "LDA <$3B; BNE", 07B739 "LDD <$37; BEQ; LDA #$01; STA [#$17,X]"; with
# separate slots 07B744 "LDD #$00,U; BEQ"
07B731  func  player_out
comment player_out A player out of the game: not playing; a credit (its slot's own with separate coin slots) lets it join
# states 1 and 5, 07B74F: shared credits 07B757 "LDD <$37", 07B75C "LDA [,X]; ANDA #$B0" (start or a button),
# 07B763 "SUBD #$0001; STD <$37", 07B76C "LDA [#$04,X]; ADDA <$5A"; separate slots 07B77B-07B797 lives_per_credit for
# each of its slot's credits; then 07B79A "LDA #$06,X; ORA <$50; STA <$50", 07B7A3 "LDA #$28; STA [#$0F,X]; STA
# [#$13,X]", 07B7AB "CLRD; STD [#$07,X]"; a new player (state 1): 07B7B6 "LDD [#$09,X]; STD <$F3; CLRW [#$09,X];
# LBSR $9718" (its last score against the high scores), 07B7C6-07B7DA its initials and number, "LBSR $9743" (put in
# the table); 07B7DD "LDA #$02; STA [#$19,X]; STA [#$17,X]"
07B74F  func  player_join
comment player_join A player who may join: start or a button with a credit gives it its lives, its place in players_in_game and a full life; a new player's last score goes into the high scores first; then it plays
# state 2, 07B7E8 "LDA #$02; STA [#$19,X]", 07B7ED "LDA [#$04,X]; BEQ $B816": no lives, 07B816 "LDA #$06,X; COMA; ANDA
# <$50; STA <$50", 07B820 "LDA #$0E,X; STA $4A1D", 07B82B "LDA #$20; STA [#$07,X]; STA $4A1C; CLR $4A22", state 3;
# with separate slots a coin in its slot adds lives (07B7F2-07B812)
07B7E8  func  player_playing
comment player_playing A player playing: when its lives run out it leaves players_in_game and its continue's countdown starts at 20 seconds, which the continue screen shows; with separate coin slots its slot's coins add lives
# state 3, 07B843 "LDA #$01; STA [#$19,X]"; a credit: 07B852 "CLR [#$19,X]; LDA #$05; STA [#$17,X]"; else 07B869
# "LDA <$6A; BEQ", 07B86E "LDY #$07,X; INC #$01,Y; CMPA #$3C" (60 frames), 07B87E "LDA #$99; ADDA ,Y; DAA" (a second
# less), 07B885 "CMPA #$99": at 0, 07B88B "CLR [#$02,X]", state 4
07B843  func  player_continue_countdown
comment player_continue_countdown A player whose lives ran out: a credit lets it join again; else its countdown loses a second each 60 frames while the gauges are shown, and at 0 it is game over
# state 4, 07B897 "CLR [#$19,X]; CLR #$07,U" (its slot's credit given), 07B89D "INC [#$07,X]; CMPA #$C0; LBCS $B731",
# then 07B8A8 "CLRD; STD [#$07,X]; CLR [#$17,X]"
07B897  func  player_game_over
comment player_game_over A player's game over: C0 frames during which a credit still lets it in, then out of the game
# 07BA34 "CLR <$57; LDA <$50; LDB #$04", "BITA #$01; BEQ; INC <$57; LSRA" for the 4 bits, 07BA47 "LDA <$57; BNE; INC
# <$57"
07BA34  func  count_players_in_game
comment count_players_in_game Counts the players in players_in_game into player_count, at least 1
# 07BA50 "LDA <$11; BNE", 07BA55 "LDX #$4F80; LDA #$08" (the enemies' list), 07BA5D "LDA #$27,X; BPL; BITA #$40; BNE",
# 07BA69 "ANDA #$0F; TFR A,B", 07BA6D "ANDA #$30; LSRA x4; ADDA #$03; LBSR $97B7" (score jobs 3-6, a player each: the
# main loop's job table E3FB, 079828-07983A), 07BA7B "CLR #$27,X"
07BA50  func  award_enemy_points
comment award_enemy_points Outside the attract, gives the points of each beaten enemy to the player who beat it, through the score jobs

# ======== the palette requests and jobs ========
# 07BAC7 "LDX #$BADA; LDA <$7E; ASLA; LDX A,X; JSR ,X" (palette_request_handlers)
07BAC7  func  palette_request
comment palette_request Starts a palette request of the kind palette_request_kind says, with its argument
# kinds 0 and 1: 07BAEC "STD <$E8; LBSR $BF39; BCS" (no free job), "LDA #$01; STA ,U; LDD <$E8; STD #$01,U"
07BAEC  func  request_palette_sets
comment request_palette_sets Takes a free palette job for a load of palette sets: which of the set's loads and the set
# kind 8: 07BB12 "LDA ,U; CMPA #$02; BNE $BB1F" (the slot runs an effect: it gets the new one), else a new job
07BB12  func  request_palette_effect_in_slot
comment request_palette_effect_in_slot Starts a palette effect again in the caller's job when that job runs one, else in a new job
# kind 2: 07BB1F "LBSR $BF39", "LDA #$02; STA ,U", bank 2E, 07BB45 "LDX #$6000; LDD <$E8; ASLB; ROLA; LDX D,X"
# (palette_effects), 07BB52-07BB5F its colours a step, delay and first step
07BB1F  func  request_palette_effect
comment request_palette_effect Takes a free palette job for a palette effect of bank 2E: its colours a step, its delay and its first step
# kind 3: 07BB71 "LBSR $BF39", "LDA #$03; STA ,U; LDD <$E8; STD #$01,U"
07BB71  func  request_background_colour
comment request_background_colour Takes a free palette job to set the background colour
# kinds 4 and 5: 07BB85 "LBSR $BF39", "CLR #$03,U; LDA <$E9; STA #$04,U" (the frames), "LDA <$7E; STA ,U", the mask
# of the fade's steps from the request's bits (07BB9F-07BBE9), 07BBEF "STD #$01,U; STD #$05,U"
07BB85  func  request_palette_fade
comment request_palette_fade Takes a free palette job to darken (kind 4) or brighten (kind 5) the palette ranges the request's bits name
# kind 6: 07BBF6 "LBSR $BF39", palette RAM on, 07BC0E "LDX #$0C00; LDY #$0100; LDD #$FFFF" (0C00-0DFF white), the
# K053251's priorities from the request's bits (07BC2E-07BC64), 07BC67 "LDA #$06; STA ,U", its frames at byte 2
07BBF6  func  request_white_flash
comment request_white_flash Takes a free palette job for a white flash: a palette bank turned white and the K053251's priorities that show it on the layers the request's bits name
# kind 7: 07BC78 "STA <$E8; LBSR $BF39; BCS; LDA <$E8; STA #$01,U; LDA #$07; STA ,U"
07BC78  func  request_palette_clear
comment request_palette_clear Takes a free palette job to clear the palette ranges the request's bits name
# 07BC8B "LDU #$3C00; LDA #$40; STA <$7F", 07BC93 "LDA ,U; BEQ", 07BC99 "LDX #$BCAA; ASLA; JSR [A,X]", 07BCA1 "LEAU
# #$08,U; DEC <$7F"
07BC8B  func  run_palette_jobs
comment run_palette_jobs Runs each of the 64 palette jobs that is in use, by its kind
# job 1: 07BCBA bank 2D, "CLR ,U", 07BCC8 "LDA #$01,U; STA <$F0", 07BCCE "LDX #$E9CB" (or 07BCD6 "LDX #$EAEB"), 07BCDC
# "LDY B,X", 4 loads (07BCE3 "LDA <$F0; ANDA #$01", 07BCF2 "LBSR $BF51")
07BCBA  func  palette_job_load_sets
comment palette_job_load_sets Palette job 1: loads the set's palettes whose bits the job holds, and frees the job
# job 2: 07BD01 bank 2E, 07BD0D "LDA #$04,U; CMPA #$05,U; BNE $BD4D" (its delay), 07BD28 "LDX #$02,U; LDA ,X; BPL"
# (a command: 07BD2F "BSR $BDA8"), 07BD33 "LDY #$E971; LDA #$01,U; ASLA; JSR [A,Y]" (forward or backward)
07BD01  func  palette_job_effect
comment palette_job_effect Palette job 2: after the effect's delay runs its next step, forward or backward, or the command the step holds
# 07BD51 "LDA #$06,U; STA <$F0", 07BD57 "LDY ,X++; LDD ,X++; STD ,Y", 07BD67 "STX #$02,U"
07BD51  func  palette_effect_forward
comment palette_effect_forward Sets the colours of the effect's step and moves to the next step
# 07BD6C the same, 07BD7D "LEAX #$-08,X", 07BD85 "LEAX #$-08,X; LDA ,X; BPL; CLR #$01,U" (at the start: forward again)
07BD6C  func  palette_effect_backward
comment palette_effect_backward Sets the colours of the effect's step and moves to the one before; at its first step the effect runs forward again
# 07BDA8 "LDY #$E975; ANDA #$7F; ASLA; JMP [A,Y]": BDB0, BDB4, BDC1
07BDA8  func  palette_effect_command
comment palette_effect_command Runs the command of an effect's step: stop, reverse or repeat
# command 80: 07BDB0 "CLR ,U; COMA"
07BDB0  func  palette_effect_stop
comment palette_effect_stop An effect's command 80: the effect ends and its job is freed
# command 81: 07BDB4 "LDA #$01; STA #$01,U; LEAX #$-04,X; STX #$02,U"
07BDB4  func  palette_effect_reverse
comment palette_effect_reverse An effect's command 81: the effect runs backward from its last step
# command 82: 07BDC1 "LDA #$01,X; CMPA #$FF; BEQ" (for ever), 07BDC8 "CMPA #$07,U; BEQ" (its count), "INC #$07,U",
# 07BDD0 "LDX #$02,X; LEAX #$04,X; STX #$02,U" (back to the step it names); done: 07BDDB "CLR #$07,U; LEAX #$04,X"
07BDC1  func  palette_effect_repeat
comment palette_effect_repeat An effect's command 82: goes back to the step it names, the number of times it says (FF for ever), then on
# job 3: 07BDF6 "LDD #$01,U; STD $0C00; CLR ,U"
07BDE6  func  palette_job_background_colour
comment palette_job_background_colour Palette job 3: sets the background colour and frees the job
# job 4: 07BE10 "CLR <$F0; BRA $BE1C"
07BE10  func  palette_job_darken
comment palette_job_darken Palette job 4: a step of a fade to dark
# job 5: 07BE15 "LDA #$01; STA <$F0; BRA $BE21"
07BE15  func  palette_job_brighten
comment palette_job_brighten Palette job 5: a step of a fade to bright
# 07BE1C "LDD #$03,U; BEQ $BE88" (done: "CLR ,U"), 07BE21 "DECW #$03,U", 07BE24 "LDA #$07,U; CMPA #$10" (the 16
# steps again: "LDD #$01,U; STD #$05,U; CLR #$07,U"), 07BE34 "LDA #$06,U; ANDA #$01" (the step's bit), 07BE4D "LDX
# #$E97F" (fade_ranges), 07BE5E "LDY #$E97B; LDA <$F0; ASLA; JSR [A,Y]" each colour, 07BE71 "LSRW #$05,U; INC #$07,U"
07BE21  func  palette_job_fade
comment palette_job_fade A step of a fade: each colour of the step's palette range darkened or brightened by one when the job's mask names it; the job ends when its frames run out
# job 6: 07BE8B "DEC #$02,U; BEQ", 07BE90 "LDA <$16; ANDA #$01" (every other frame the K053251's normal priorities,
# 07BE97 "LDA #$13; STA $1FB9; LDA #$2C; STA $1FBA", else the job's: 07BEA5 "LDA #$03,U ... LDA #$04,U"); at the end
# 07BEC4-07BED0 0C00-0DFF cleared, "CLR ,U"
07BE8B  func  palette_job_white_flash
comment palette_job_white_flash Palette job 6: the white flash every other frame for its frames, then the white palette bank cleared and the job freed
# job 7: 07BEE6 "CLR ,U", 07BEFB "LDA #$01,U; STA <$F1", 07BF08 "LDX #$E9BB" (palette_clears), 07BF16 "LEAY ,X; CLR
# ,X+; BMOVE Y,X,U", 4 ranges
07BEE6  func  palette_job_clear
comment palette_job_clear Palette job 7: clears the palette ranges whose bits the job holds, and frees the job
# 07BF39 "LDU #$3C00; LDA #$40; STA <$7F", 07BF41 "LDA ,U; BEQ $BF4F" (CLRA: found), 07BF45 "LEAU #$08,U; DEC <$7F;
# BNE", 07BF4D "COMA" (none)
07BF39  func  find_free_palette_job
comment find_free_palette_job Finds a free palette job among the 64; carry when there is none
# 07BF51 palette RAM on, bank 2D, 07BF6D "STA <$E8", 07BF70 "LDB #$10", 07BF75 "LDD ,U++; STD ,X++" (16 colours a
# palette), "DEC <$E8"
07BF51  func  load_palettes
comment load_palettes Copies palettes of 16 colours from bank 2D into the palette RAM
# 07BF94 "LDD ,U; STD <$EA", a step off each of the colour's components still above 0 (07BF9D "ANDA #$F8" blue 08,
# 07BFA6-07BFB6 green 40 (0x20 x 2 bits), 07BFB9 "ANDA #$1E" red 02 in E9), 07BFC8 "LDD <$EA; SUBD <$E8; STD ,U"
07BF94  func  darken_colour
comment darken_colour Takes one step off each component of a colour that is not at 0
# 07BFD1 the same up: 07BFDA "ANDA #$78; CMPA #$78" (blue 04), 07BFE5-07BFF5 green 20, 07BFFC "ANDA #$1E; CMPA #$1E" (red
# 01), 07C00D "LDD <$EA; ADDD <$E8; STD ,U"
07BFD1  func  brighten_colour
comment brighten_colour Adds one step to each component of a colour that is not at its top

# ======== parameters and locals ========
# the player's record (player_records) and its coin slot's record (4817 + 8 x player: 07B70D "LDU #$4817", 07B724
# "LEAU #$08,U") that update_players hands each state's routine (07B713 "LDX A,X", 07B722 "JSR [A,Y]")
param player_out x player player
param player_join x player player
param player_playing x player player
param player_continue_countdown x player player
param player_game_over x player player
# a player's input step in the demo (07A17A "LDU ,Y", 07A186 "LEAU #$02,U"; 07A17C "LDA ,U" its controls, 07A192 "LDA
# #$01,U" its frames)
local demo_play 07A17A,07A186 u input_step demo_input
# the lines symbols.txt has under the old names (they move to the new ones):
# local sub_07A07E 07A0F2 u inputs demo_input / local sub_07A07E 07A101 u record player
local demo_start 07A0F2 u inputs demo_input
local demo_start 07A101 u record player
# param sub_07BD51 x step palette_effect_step / param sub_07BD6C x step palette_effect_step
param palette_effect_forward x step palette_effect_step
param palette_effect_backward x step palette_effect_step
# local sub_07BCBA 07BCCE,07BCD6 x set_table palette_set
local palette_job_load_sets 07BCCE,07BCD6 x set_table palette_set

# under step_phase, cleared with it (07A4C6 "STD <$05"); bank 2F's portraits run by it (05ED5E "LDA <$05; ASLA; JSR
# [A,X]")
4805  var  step_subphase  u8
# frames of a screen: the bonus stages' instructions (07A6C2 "LDD #$0180; STD <$0A", 07A6E3 "DECW <$0A"), GAME OVER's
# (07B4B5, 07B4BF "DECW <$0A")
480A  var  scene_timer  u16
# frames of a step: the portraits' 1920 (07A456 "LDD #$0780; STD <$0B", 07A465 "DECW <$0B") then 64 counted in its
# high byte (07A499 "STA <$0B", 07A4B4 "DEC <$0B"); bonus stage 2's wait (07B022 "INC <$0B; CMPA #$40")
480B  var  step_timer  u16
# how many players are in the game, at least 1 (07BA34-07BA4C), by which the enemies' tables are read
4857  var  player_count  u8
# the demo the attract plays next, 0-2 (07A0A4 "LDX #$E6A1; LDA <$5E", 07A1E7 "INC <$5E; CMPA #$03; ... CLR <$5E")
485E  var  demo_number  u8
# the scene, step_scenes' by game_step (07BA8F "STA <$67"): scene_routines (07B5B9), the music (07BAA0), the spawn lists
# (07C96E)
4867  var  scene  u8
# 1 in the game's frames (07A399 "LDA #$01; STA <$6A"), cleared by the steps without gauges (07A4CE, 07A656 ... "CLR
# <$6A"): bank 20 draws the gauges while it is set (040901 "LDA <$6A; BEQ"), and the continue's countdown runs
# (07B869)
486A  var  gauges_shown  u8
# 1 while a scene the step runs is not done: the step sets it (07A4F4 "LDA #$01; STA <$72"), the scene clears it as it
# ends (bank 12's 024144 "CLR <$72"), the step moves on at 0 (07A517 "LDA <$72; BNE")
4872  var  scene_running  u8
# set by a boss as it comes in (021434, 022BD0, 02668B "INC <$7C"; Mr. Burns' robot 03AE12 "STA <$7C"): the stage's
# music moves to its next part, the boss's (07A5E6 "LDA <$7C; BEQ; CLR <$7C; INC <$80; LBSR $BA93")
487C  var  boss_arrived  u8
# set as a stage's boss is beaten (03D50B "STA <$7D", 03D50E "INC <$04"; 034DD6): no music changes (07BA9B "LDA <$7D; BNE"),
# the forest's end (07A9B0); cleared in stage 8 (07B333 "CLR <$7D")
487D  var  boss_beaten  u8
# the palette jobs left to look at (07BC8E "LDA #$40; STA <$7F", 07BCA4 "DEC <$7F"; 07BF3C, 07BF48)
487F  var  palette_jobs_left  u8
# the stage's part, whose music plays (07BAA6 "LDA <$80; ASLA"): one more at each boss_arrived (07A5EE "INC <$80"),
# and as bank 13 moves the stage on (026067, 02617C, 026191 "INC <$80")
4880  var  stage_part  u8
# set when stage 8's story after its first boss is done (07B34F "LDA #$01; STA <$81"): Mr. Burns' robot comes in
# (03AD6B "LDA <$81"); the forest flashes on it (07A97B)
4881  var  stage_cue  u8
# the frames of the forest's flash picture (07A980 "LDA #$08; STA <$82", 07A9A3 "DEC <$82")
4882  var  stage_cue_timer  u8
# the players in the game as a stage starts or they leave it (07A5D6 "LDA <$50; STA <$85", 07B699): the stage's end puts
# them (0241F7 "LDA <$85; ANDA <$F0")
4885  var  players_present  u8
# 1 in the cemetery (07AABD "LDA #$01; STA <$8D"): the enemies' limit by the players there (07CAFC)
488D  var  in_cemetery  u8
# 1 while the object bank 20 puts in after 256 frames of stall_frames is out (040D24 "STU <$90", 040D27 "LDA #$01; STA
# <$8F"); check_players_out frees it (07B8EB "CLR <$8F; CLR [$4890]")
488F  var  hurry_up_out  u8
4890  var  hurry_up_object  u16
# the frames counted by bank 20 (040CD7 "LDD <$93; ADDD #$0001"), cleared while that object is out or other things go
# on (040CE6-040D14); at 0100 it puts the object in; check_players_out clears it (07B8F3 "STD <$93")
4893  var  hurry_up_frames  u16
# the stage's record of 4-byte entries (stage_slots[n].record: 07A555 "LDX $600C; STX <$A4"; bank 13 walks it: 026257
# "LDX <$A4"), moved an entry on as the players leave some stages (07AD4E "LDX <$A4; LEAX #$04,X; STX <$A4")
48A4  var  stage_record_entry  u16
48AF  var  last_stage_scroll_x  u16
48B5  var  last_stage_scroll_y  u16
48C3  var  layer_a_offset_x  u16
48CA  var  layer_a_offset_y  u16
48D3  var  layer_b_offset_x  u16
48DA  var  layer_b_offset_y  u16
# the players' variables, 8 bytes each (the player records point into them): continue_screen walks them (07B985 "LDY
# #$49D0; LDB #$07,Y; CMPB #$03", "LEAY #$08,Y")
49D0  var  player_variables  u8
# each player's state (the player records' field 17): end_game clears them (07B6DE "CLR $49D7; CLR $49DF; CLR $49E7;
# CLR $49EF")
49D7  var  marge_state  u8
49DF  var  homer_state  u8
49E7  var  bart_state  u8
49EF  var  lisa_state  u8
# whether each player plays (the player records' field 19): 07B8BA "LDA $49F0; CMPA #$02" ... "LDA $49F3"
49F0  var  marge_play_status  u8
49F1  var  homer_play_status  u8
49F2  var  bart_play_status  u8
49F3  var  lisa_play_status  u8
# the continue screen's count, BCD seconds (07B82D "STA $4A1C" 20 as a player's lives run out, 07B94A "LDA #$99; ADDA
# $4A1C; DAA"), the player it counts with (07B823 "STA $4A1D", 07B934 "LDA $4A1D"), the last second it sounded (07B9B2
# "CMPA $4A21", 07B9C6 "STA $4A21"), its frames (07B93E "INC $4A22; CMPA #$3C")
4A1C  var  continue_seconds  u8
4A1D  var  continue_player  u8
4A21  var  continue_seconds_heard  u8
4A22  var  continue_frames  u8
# the demo's frames left (07A0B4 "STD $5800", 07A14C "DECW $5800")
5800  var  demo_frames  u16
# each player's controls in the demo, from its input step (07A17E "STA #$03,Y"), complemented and handed as the
# controls (07A1AA "COM $5813; LDU #$5813; LDX #$4840; LBSR $924D")
5813  var  marge_demo_controls  u8
5823  var  homer_demo_controls  u8
5833  var  bart_demo_controls  u8
5843  var  lisa_demo_controls  u8

# ======== the fixed program, 07C000-07DFFF ========
# ======== fixed_3E.c (the fixed program 07C000-07DFFF): names proposed by this part ========
# Evidence: build\listing\simpsons.s (quoted instructions), build\decompile\index.txt (callers), the ROM's tables
# (dumped with simpsons_rom.build_program). Object fields are written by offset (field 1B and so on) where the common
# `field object` lines are named elsewhere; the report lists what this file shows about the common fields.
#
# Common object fields this file establishes (the `field object` lines declare them):
# 02 the object's state (each list's dispatcher passes it to the handler: 07CB6F "LDD #$01,X" type and state, the goon's
# 07D40A "LDU #$F19C; ASLB; JSR [B,U]"); 06 bit 0 the animation ended (07DDDE "LDA #$06,X; LSRA; BCC"), bit 7 set on
# landing (07D1A4); 09 bit 6 faces left, bits 4-5 the priority from the floor map; 0C x, 11 y (bigger is further back:
# higher on the screen, 079C53 sprite y = 11 + 16 + offset, drawn upside down by the K053247), 16 z (height), 0F/14/19
# their speeds; 1B life; 1C the power its hit box takes off (07C277 "SUBA #$1C,U"); 1D the kind of hit it gives (07C28A
# "LDA #$1D,U; STA #$1E,X"); 1E the strongest kind of hit it took this frame; 1F/20/21 the box's half width (x), depth
# (y) and height (z) (07C155, 07C1A7, 07C1CF); 22 the box's x offset, mirrored when it faces left (07C162-07C176); 23
# its y offset (07C13A "LDB #$23,X; SEX; ADDD #$11,X"); 24 its z offset (07C1B5); 25 the object that hit it (07C290 "STU
# #$25,X"); 27 the score: bits 0-3 its points (from its setup), bits 4-5 the player who hit it last (07CFC2 "LDA #$5B,U;
# ANDA #$70"), bit 7 defeated (07D0E0), read by 07BA5D-07BA7B; 30 the state a spawn gives it (07C9FE); 31 the floor
# contact bits (check_floor, below); 40 the parent of a child object (07CAAB "STX #$40,U"); 42 bit 7 not counted as an
# enemy (07CB84), non-zero: has the walk animations by direction (07D7DA); 45 the floor level of the step ahead
# (07CEB3); 46 the floor map's cell under it (07CE10); 47 the cell where it is going (07CE3E); 48 its hit box's address
# (07D141 "STY #$48,X"); 57 (07CB8D, counted into 1883 when 0); 59-5A the object's sprite RAM place, kept when its slot
# is cleared (07CA64 "LDD #$59,U" ... "STD #$59,U"; 079572 "STU #$-07,X" sets it); 5C-5D its floor's height (07CA3E
# "STD #$5C,U", 07CE18 "STA #$5D,X").
#
# Flags (field 00) bits seen here: 80 on, 40 in the hit checks (07C045 "BITA #$40"), 20 hit this frame (07C296), 08 in
# the air (07CE04), 04 takes no damage (07C270 "ANDA #$04"), 02 a player attacking (07C2D5; bank 1C 03889A "ORA #$02"
# with its attack box); 07CA7B "LDB #$04; STB #$00,U" marks a slot just taken.

# ======== files ========
# (the existing line 07C000 file unsorted/fixed_3E covers no function once these are in: 07C000-07C015 is the end of
# a function of fixed_3D)
07C016  file  objects/collisions    # the hit checks: the players against the enemies, the child objects, list 1's objects and each other
07C367  file  video/background_maps    # the tile layers' maps: the edges drawn as they scroll, whole layers, the floor map, tile pictures, the tile banks
07C954  file  objects/spawning    # the stage's spawns by the scroll, the free-slot search, child objects, the enemy limit
07CB3C  file  objects/object_lists    # the four object lists' dispatchers and the share of attackers per player
07CC8E  file  engine/directions    # speeds from a direction, the sine tables, the direction from one object to another
07CD90  file  engine/floor    # the floor map under and ahead of an object: steps, gaps, climbing
07CFEC  file  enemies/enemy_hits    # an enemy taking a hit, the reaction it starts, letting go of its target
07D132  file  objects/object_setup    # an object's setup and hit box, gravity and landing, the screen's edges
07D249  file  enemies/enemy_facing    # an enemy facing its target and its walk animation by direction
07D301  file  enemies/enemy_targets    # the nearest player, the direction and distance to it, the attack ranges, the random number
07D40A  file  enemies/goon    # the plain goon (enemy type 0, kind 80) of the fixed program
07D47E  file  enemies/enemy_states    # an enemy's states: thinking, attacking, the hit reactions, climbing
07D6BE  file  enemies/enemy_climbing    # climbing up and hopping down the floor's steps
07D7D1  file  enemies/enemy_moves    # the moves an enemy's behaviour picks while it thinks
07DDBD  file  enemies/enemy_hit_reactions    # flinching, knocked down, getting up, dying

# ======== the hit checks ========

# called by the stage's playing substeps (07A5FB, 07A9D2, 07AA00, 07AC27, 07B5A9, 07B5DD): 07C016 "BSR $C023; BSR $C03A;
# BSR $C071; LBSR $C0A9; LBSR $C1E0"
07C016  func  check_collisions
comment check_collisions Each frame of play: clears last frame's hits, then checks the players and their partners against the enemies, the players against the child objects, the players and partners against list 1's objects, and the players against each other.
# 07C023 "LDX #$4A40; LDA #$20", 07C028-07C030 "LDB #$00,X; ANDB #$DF; STB #$00,X; CLR #$1E,X", "LEAX #$60,X"
07C023  func  clear_hits
comment clear_hits Clears the hit flag and the kind of hit taken of the 32 objects from the players' on (all but the stage's event object).
# 07C03A "LDX #$4A40" 8 objects (the players and their partners), 07C049 "LDU #$4F80" the 8 enemies, both in the hit
# checks (flags bit 6), 07C058 "LBSR $C13A; BCC", 07C05D "LBSR $C26D"
07C03A  func  collide_players_with_enemies
comment collide_players_with_enemies Every player and partner in the hit checks against every enemy in them: where their boxes overlap, they trade hits.
# 07C071 "LDX #$4A40" 4 objects 0xC0 apart (the players only: 07C09F "LEAX #$00C0,X"), 07C080 "LDU #$4D40" the 6 child
# objects, 07C094 "LBSR $C2D2"
07C071  func  collide_players_with_child_objects
comment collide_players_with_child_objects Every player in the hit checks against every child object in them: where their boxes overlap, they trade hits unless the player is attacking.
# 07C0A9 "LDX #$4A40" 8 objects, 07C0B8 "LDU #$5280" the 10 objects of list 1, 07C0CC "LBSR $C2D2"
07C0A9  func  collide_players_with_list_1_objects
comment collide_players_with_list_1_objects Every player and partner in the hit checks against every object of list 1 in them: where their boxes overlap, they trade hits unless the player is attacking.
# 07C13A-07C160: |(U's 23 + y) - (X's 23 + y)| against the two 20s (depth); 07C162-07C1B2: x plus the 22 offset, minus
# it when the object faces left (09 bit 6), against the two 1Fs (width); 07C1B4-07C1DA: z plus 24 against the two 21s
# (height); 07C1DE "COMA; RTS" overlap, 07C1DC "CLRA; RTS" not
07C13A  func  boxes_overlap
comment boxes_overlap Whether two objects' hit boxes overlap (carry set): in depth, in x (the box's x offset mirrored by the facing) and in height, each the distance between the boxes' centres against their two half sizes.
param boxes_overlap u other object
# 07C1E0 "LDX #$4A40; LDU #$4B00" (player 1 against 2 and 3), 07C20A "LDX #$4B00; LDU #$4BC0" (2 against 3 and 4),
# 07C234 (3 against 4), 07C250 "LDX #$4C80; LDU #$4A40" (4 against 1), 07C1FE "LBSR $C336"
07C1E0  func  collide_players_with_players
comment collide_players_with_players Every pair of the four players in the hit checks: where their boxes overlap, they touch (what bank 1C's team moves start from).
# 07C26D "LDA #$00,X; ANDA #$04; BNE" (X takes no damage), 07C274 "LDA #$1B,X; SUBA #$1C,U" (down to 0), 07C280-07C290
# the strongest kind of hit (field 1E, signed) and who gave it (25), 07C293 "ORA #$20"; then falls into 07C29B
07C26D  func  trade_hits_with_enemy
comment trade_hits_with_enemy The object and the one it overlaps hit each other: each loses the other's power from its life unless it takes no damage, keeps the strongest kind of hit and who gave it, and is marked hit.
param trade_hits_with_enemy u other object
# 07C29B "LDA #$00,U; ANDA #$04; BNE" (U takes no damage), 07C2A2 "LDA #$1C,X; BEQ" (no power), 07C2AA "LDA #$1B,U;
# SUBA <$E8", 07C2B6-07C2C6 "LDA #$1E,U ... CMPA #$1D,X; BGT ... STA #$1E,U; STX #$25,U", 07C2CE "ORA #$20; STA #$00,U"
07C29B  func  give_hit
comment give_hit The object's box hits the other: unless the other takes no damage, it loses the object's power from its life, keeps the stronger of its kind of hit and the object's, with the object as the one that hit it, and is marked hit.
param give_hit x hitter object
param give_hit u target object
# 07C2D2 "LDA #$00,X; ANDA #$02; BNE $C29B" (flags bit 1: bank 1C sets it with a player's attack box, 03889A/03895F
# "ORA #$02"), else 07C2D9
07C2D2  func  trade_hits_unless_attacking
comment trade_hits_unless_attacking A player against an object of list 1 or a child object: while the player is attacking only its hit lands, otherwise they trade hits.
param trade_hits_unless_attacking u other object
# 07C2D9-07C335: the two halves of trade_hits_with_enemy, the second without the zero-power test; also reached from
# the vector 078674 (an object against the enemies)
07C2D9  func  trade_hits
comment trade_hits The object and the one it overlaps hit each other: each loses the other's power from its life unless it takes no damage, keeps the strongest kind of hit and who gave it, and is marked hit.
param trade_hits u other object
# 07C336 "LDA #$00,X; ANDA #$20; BNE" / "LDA #$00,U; ANDA #$20; BNE" (either hit already), 07C344 "LDA #$1D,U; STA #$1E,X;
# STU #$25,X", 07C355 the same the other way; bank 1C's team move reads them (0396B7 "LDX #$25,U", 0396CF "LDA #$1E,X")
07C336  func  players_touch
comment players_touch Two players whose boxes overlap, unless either was hit this frame: each takes the other's kind of hit and the other as the one that touched it, with no damage, and both are marked hit (what the team moves start from).
param players_touch u other object

# ======== the background maps ========
# The map's layout (data_walk.py's map walk): a scene's area points at strips of 256 pixels, each a list of rows of 16
# bytes (8 cells of a 10-bit block number); a block is 18 bytes: its colour, its floor pattern (16 bytes in
# block_tile_flags, 4 x 4 cells) and its 4 x 4 tiles. The floor map is 64 cells a row at 4000, one byte a cell of 8
# pixels: the floor's height in steps of 8 (low nibble), the sprites' priority (bits 4-5), no floor (bit 7): 079540
# "LDU #$4000; LEAU D,U; LDA ,U" (078638 reads it under an object).

# from the IRQ (079143 "LBSR $C367", after the mode's job moved the scroll and 0790F4-079109 kept last frame's): layer A
# (07C367 "LDA <$A9") and layer B (07C3BC "LDA <$AA"), columns when 489C is set (07C36C) and the scroll x crossed 8
# pixels (07C37B "LDA <$BF; EORA <$C2; BITA #$08") or left 0 (07C371-07C379), rows likewise (07C394 "LDA <$9D", 07C3A3
# "LDA <$C6; EORA <$C9"); 489A/489B bit 1 layer A, bit 0 layer B, bit 2 the floor map (07C38A "LDB <$A6; BNE; ORA
# #$04"); then 07C421 "LDX #$EC8D; ASLA; JSR [A,X]" and 07C44F "LDX #$EC95" (EC8D: C46D C489 C481 C46D, EC95: C477 C49A
# C492 C477), each loop stops after one unless 4899 (07C431 "LDA <$99; BEQ")
07C367  func  draw_scrolled_layer_edges
comment draw_scrolled_layer_edges In the IRQ: marks a column of each tile layer to draw when its scroll x crossed 8 pixels since last frame, a row when its scroll y did (and the floor map's, from the floor layer), then draws the marked ones, one column and one row a frame unless draw_all_layer_edges is set.
# 07C46D "LDA <$A6; LBSR $C573; LBSR $C789"
07C46D  func  draw_floor_map_column
comment draw_floor_map_column Fills the floor map's column at the floor layer's scroll x from its map's blocks.
# 07C477 "LDA <$A6; LBSR $C618; LBSR $C840"
07C477  func  draw_floor_map_row
comment draw_floor_map_row Fills the floor map's row at the floor layer's scroll y from its map's blocks.
# 07C481 "CLRA; LBSR $C573; LBSR $C744"
07C481  func  draw_layer_a_column
comment draw_layer_a_column Draws layer A's column of tiles at its scroll x from its map.
# 07C489 "LDA #$01; LBSR $C573; LBSR $C744"
07C489  func  draw_layer_b_column
comment draw_layer_b_column Draws layer B's column of tiles at its scroll x from its map.
# 07C492 "CLRA; LBSR $C618; LBSR $C7F2"
07C492  func  draw_layer_a_row
comment draw_layer_a_row Draws layer A's row of tiles at its scroll y from its map.
# 07C49A "LDA #$01; LBSR $C618; LBSR $C7F2"
07C49A  func  draw_layer_b_row
comment draw_layer_b_row Draws layer B's row of tiles at its scroll y from its map.
# from the vector 0786AD (scenes and stages: 022814 "CLRA; LDB #$26; LBSR $86AD"): 07C4A5 "LDX #$EC9D; ASLA; LDX A,X",
# 07C4B5 "LBSR $C573; LBSR $C744", 07C4BD "LDD [#$0A,X]; ADDD #$0008; STD [#$0A,X]" B times, 07C4CB "CLRD; STD
# [#$0A,X]", 07C4CF-07C4D7 the bank back
07C4A3  func  draw_layer_columns
comment draw_layer_columns Draws a number of columns of a tile layer (0 A, 1 B) from its scroll x on, 8 pixels apart (38 for the whole screen), then puts its x offset back to 0 and the bank as it was.
# the stages' starts (07A572, 07A7B1, 07A8FC ...): 07C4E9 "CLRD; STD [#$0A,X]; STD [#$0C,X]", 07C4F4 "LBSR $C573; LBSR
# $C744" and 07C500 "LBSR $C573; LBSR $C789" a column, 07C508 x offset + 8
07C4E1  func  draw_layer_columns_with_floor_map
comment draw_layer_columns_with_floor_map Draws a number of columns of a tile layer from its scroll x on and fills the floor map's same columns from its map, then puts its x offset back to 0.
# 07C51C "LDU #$EFB5" (tile_pictures), 07C520 "BPL" / 07C522 "ANDA #$7F; INC <$F4" (bit 7: blank), 07C52C-07C531 its
# bank, 07C536 "LDX ,U++" the place, 07C53A-07C546 width, height, colour, 07C552 "STB #$-2000,X", 07C55D "LDA #$01"
# (blank tile), 07C566 "LDA #$40; SUBA <$F0; LEAX A,X" the next row; callers 07A978, 07A99B ("LDA #$80; LBSR $C51C")
07C51C  func  draw_tile_picture
comment draw_tile_picture Draws a picture of tiles (tile_pictures) into the tile RAM in its colour, or, with bit 7 of the number, blank tiles over its place.
# 07C576 "LDX #$EC9D; ASLA; LDX A,X" (layer_maps), 07C57C-07C59D U = tiles + row of the scroll y x 64 + column of
# scroll x + x offset, 07C59F-07C5AF "LDY #$4000 ... STY <$FA" (the floor map's column), 07C5B2-07C5D7 the scene's area
# (map_scenes by <$75, <$76) and its bank kept in 489E, 07C5E5 "LDY A,Y" the strip of the x, 07C5F5 "STY <$FC", 07C60A
# the row of the y + offset_y2, 07C612-07C615 B = the tile column in the block (0-3)
07C573  func  find_layer_column
comment find_layer_column For a tile layer's column at its scroll x: its place in the tile RAM, the floor map's column, the map's cell at that x and the scroll y (the area's bank switched in and kept), and the tile's column in the block.
# 07C618 the same for a row: 07C623-07C642 U = tiles + row of scroll y + offset_y x 64 + column of the scroll x, 07C67E
# "LDX A,Y; STX <$FC; ADDA #$02; LDD A,Y; SUBD <$FC; SUBD #$0010; STD <$FC" (from the end of a strip's row to the next
# strip's), 07C6B0-07C6BA B = the row in the block x 4
07C618  func  find_layer_row
comment find_layer_row For a tile layer's row at its scroll y: its place in the tile RAM, the floor map's row, the map's cell at that y and the scroll x (the area's bank switched in and kept), the step to the next strip, and the tile's row in the block.
# 07C6C2 "LDB ,X++" (the block's colour, past its floor pattern), 07C6C4 "LEAX A,X", 4 x 07C6C6 "LDA ,X; STB
# #$-2000,U; STA ,U; LEAX #$04,X; LEAU #$40,U"
07C6BD  func  draw_block_column
comment draw_block_column Draws a column of a map block's 4 x 4 tiles down the tile RAM, with the block's colour.
# 07C6DF "LDB ,X++; LEAX A,X", 4 x 07C6E3 "LDA ,X+; STB #$-2000,U; STA ,U+"
07C6DA  func  draw_block_row
comment draw_block_row Draws a row of a map block's 4 x 4 tiles across the tile RAM, with the block's colour.
# 07C6F1 "STA <$A1", 07C6F4 "LDB #$01,X; STB <$A2" (the block's floor pattern), 07C6FA "LDX #$F67C" + pattern x 16 + A,
# 4 x 07C70F "LDB ,X; STB ,Y; LEAX #$04,X; LEAY #$40,Y"
07C6F1  func  copy_block_floor_column
comment copy_block_floor_column Copies a column of a map block's floor pattern (block_tile_flags) down the floor map, keeping the column in floor_pattern_offset.
# 07C71F: 07C6F1 without its first instruction: 07C730 "LDA <$A1; LEAX A,X" reads the offset the last column left (the
# A its caller passes, 07C86E "LDA <$F0", goes unused), 4 x 07C73A "LDB ,X+; STB ,Y+"
07C71F  func  copy_block_floor_row
comment copy_block_floor_row Copies 4 cells of a map block's floor pattern across the floor map, from the offset the last column copy left in floor_pattern_offset (not the row its caller asks for).
# 07C744 8 blocks: 07C74E "LDB <$9E; STB <$0E; SETLN <$0E", 07C759 "LDD ,Y; ANDA #$03", 07C760 "LBSR $C8B1", 07C766
# "LBSR $C6BD", 07C769-07C776 "LDD <$F8; ADDD #$0020; EORA <$F8; BITA #$01; BEQ; LEAU #$-0800,U" (the tile RAM's 32
# rows), 07C780 "LEAY #$10,Y" (the map's next row)
07C744  func  draw_map_column
comment draw_map_column Draws a column of 8 map blocks (256 pixels) of tiles down the tile RAM from the map's cells, wrapping at the tile RAM's bottom.
# 07C789 "LDA <$0F; ORA #$02; STA <$0F; STA $1FC2" (the sprite RAM's view on) ... 07C7E3 "ANDA #$FC", 8 blocks:
# 07C7B6 "LDY <$FA; LDA <$F1; LBSR $C6F1", 07C7CC "LEAY #$-0800,Y"
07C789  func  fill_floor_map_column
comment fill_floor_map_column Fills a column of the floor map from 8 map blocks' floor patterns (256 pixels), wrapping at its 32nd row, with the board's sprite RAM view switched in meanwhile.
# 07C7F2 12 blocks: 07C807 "LDD ,Y++; ANDA #$03", 07C813 "LBSR $C6DA", 07C81F-07C826 "EORA <$F8; BITA #$02; BEQ;
# LEAU #$-40,U" (the tile RAM's 64 columns), 07C82B-07C832 "BITA #$01; BEQ; LDD <$FC; LEAY D,Y" (the next strip)
07C7F2  func  draw_map_row
comment draw_map_row Draws a row of 12 map blocks of tiles across the tile RAM from the map's cells, wrapping at its right edge and going on into the next strip of the map.
# 07C840 the sprite RAM's view on, 11 blocks: 07C86B "LDY <$FA; LDA <$F0; LBSR $C71F", 07C884 "LEAY #$-40,Y", 07C890
# "LDD <$FC; LEAY D,Y"
07C840  func  fill_floor_map_row
comment fill_floor_map_row Fills a row of the floor map from 11 map blocks' floor patterns, wrapping at its right edge and going on into the next strip of the map.
# 07C8B1 "STD <$FE; LDY #$ECC5; LDA <$E8; ASLA; JMP [A,Y]" (ECC5: C8BD layer A, C8F7 layer B)
07C8B1  func  find_map_block
comment find_map_block The address of a map block by its number, in the block array of the layer the map is being drawn for (its bank switched in).
# 07C8BD "LDY #$ECC9" (block_scenes_a; from 80 07C8C5 "LDY #$ED29"), 07C8CB "LDY A,Y", 07C8CD "LDA <$76; ASLA; ASLA;
# LEAY A,Y", 07C8D6-07C8DC its bank, 07C8E3-07C8F4 number x 18 ("ASLB; ROLA; STD <$FE" x 2, x 8, "ADDD <$FE")
07C8BD  func  find_layer_a_block
comment find_layer_a_block The address of one of layer A's map blocks (18 bytes each) in the scene's area's block array (block_scenes_a), its bank switched in.
# 07C8F7 "LDY #$ECE9" (block_scenes_b; from 80 07C8FF "LDY #$EDBB")
07C8F7  func  find_layer_b_block
comment find_layer_b_block The address of one of layer B's map blocks (18 bytes each) in the scene's area's block array (block_scenes_b), its bank switched in.
# 07C931 "LDY #$EF55" (layer_modes; from 80 "LDY #$EF63"), 07C947 "LDA ,Y+; STA $1D80", 07C94D "LDA ,Y+; STA $1F00"; also
# from the vector 0786B0 and the stages' starts
07C931  func  set_area_tile_banks
comment set_area_tile_banks Sets the K052109's tile ROM banks for the map's scene and area (layer_modes).

# ======== the spawns ========

# the stages' starts (07A572, 07A7B1 ...): 07C954 "LDU #$4A40; STU $1872; CLR $1876", 07C95F-07C966 bank 1B, 07C96B
# "LDX #$EFBC; LDA <$67; ASLA; LDX [A,X]; STX <$73" (spawn_list_places), 07C977 "BSR $C985", then the 4 lists
07C954  func  start_stage_objects
comment start_stage_objects At a stage's start: points the spawns at the scene's spawn list, puts in the spawns already due, and runs the four object lists once.
# 07C985 "LDU #$EFD4; CLRA; LDB <$61; LDB B,U; ASLDI #$01; STD $1886" (the enemies' speed by the rank: 07DA35 "LDD
# $1886; STD #$14,X"), 07C994 "LDA <$57; STA $1874", 07C99B "LDA <$8D; BNE" / 07C9A0 "LBSR $CAEA; BCC", 07C9B2 "LDX
# <$73; LDA #$00,X; CMPA #$FF", 07C9D8 "LDD <$AC; ADDD #$0150; CMPD #$00,X; BCS" (the cemetery: 07C9C1 "LDD <$B8"),
# 07C9E3 "LDA #$06,X; CMPA <$6B; LBHI", 07C9EF "LBSR $CA50", 07C9F5-07CA44 its type, state, x, y, z and floor,
# 07CA47 "LEAX #$08,X; STX <$73"
07C985  func  spawn_stage_objects
comment spawn_stage_objects Puts in every spawn of the scene's list the camera has reached (its x within 336 pixels past the camera's, in the cemetery by the climb), unless the stage holds too many enemies: each in a free slot of its list, with its type, starting state, place (just off the right edge, or the left with bit 7 of its flags), height and floor; spawns above the stage's difficulty are skipped.
# 07CA50 "ANDB #$0C; LSRB; LSRB" then 07CA54; also the vector 0786AA
07CA50  func  take_free_object_for_spawn
comment take_free_object_for_spawn Takes a free object in the list a spawn's flags name (bits 2-3).
# 07CA54 "LDU #$EFF4; LDA B,U" (object_list_sizes), "LDU #$EFF8; LDU B,U" (object_lists), 07CA5F "LDB #$00,U; BNE",
# 07CA64-07CA78 the object cleared (0x30 words, "BSETW D,X,U") but its sprite RAM place (59-5A), 07CA7B "LDB #$04; STB
# #$00,U; COMB"; 07CA88 "CLRB" none free; also the vectors 07867D and 07862F
07CA54  func  take_free_object
comment take_free_object Finds the first free object of an object list (0 enemies, 1, 2 child objects, 3 the stage's event), clears it but for its sprite RAM place and marks it taken (carry set); carry clear when the list is full.
param take_free_object u slot object
# from the vector 07862C (70 callers in the banks) and 07E1CD: 07CA8A "LDB #$05,Y; LBSR $CA54; BCC", 07CA92 "LDD #$06,Y;
# STA #$30,U; STB #$01,U" (child_object's list, state, type)
07CA8A  func  spawn_child_object
comment spawn_child_object Puts in a child object a record describes (child_object: its list, state and type) at an offset from the object.
param spawn_child_object y record child_object
# 07CAAB "STX #$40,U" (its parent), 07CAAE "CLRW #$02,U", 07CAB1-07CAC6 the x offset, negated and the child turned when the
# parent faces left, 07CAC9-07CAE2 x, y, z from the parent's plus the record's, 07CAE5 "CLR #$3D,U; COMA"
07CAAB  func  place_child_object
comment place_child_object Places a new child object at the record's offset from its parent (the x offset mirrored, and the child turned, when the parent faces left), keeping the parent in it.
param place_child_object y record child_object
param place_child_object u child object
# 07CAEA "LDA <$8D; BNE" (the cemetery: 07CAFC "LDU #$F014; LDA <$57; LDA A,U"), 07CAEF "LDA $189C; BEQ; LDD #$0101; STD
# <$A7" (no instruction writes 189C), 07CB06-07CB1A the limit (enemy_limits_by_difficulty + extra_enemies_by_scene) into 1885, 07CB22 "LDB <$67;
# ASLB; LDU #$F019; JMP [B,U]" (scenes 2, 4, 7, 0A: CB37, the others CB2B)
07CAEA  func  check_enemy_limit
comment check_enemy_limit Works out how many enemies the stage holds at most (by the difficulty and the scene, in the cemetery by the players) and whether there are more (carry set); in most scenes holding the camera's x scroll while there are; with a hold flag set (one nothing writes), holds both scrolls instead.
# 07CB2B "CLRB; CMPA $1876; BCC; DECB; STB <$A7" (26237 "LDA <$A7; BEQ; CLRD; STD <$E4": no x scroll)
07CB2B  func  hold_scroll_over_enemy_limit
comment hold_scroll_over_enemy_limit Holds the camera's x scroll while there are more enemies than the limit (carry set), lets it go otherwise.
# 07CB37 "CMPA $1876; RTS" (scenes 2, 4, 7, 0A)
07CB37  func  compare_enemy_limit
comment compare_enemy_limit Whether there are more enemies than the limit (carry set), without touching the scroll.

# ======== the object lists ========

# 07CB3C bank 1A, 07CB48 "LBSR $6009" (034009 "LBRA $6022", an RTS: the debug display at 034023 is cut off), 07CB4B
# "LBSR $CC5A", 07CB4E "LDA $1876; STA $1880; CLR $1876; CLR $1883; CLR $1878", 07CB62 "LDX #$4F80", 07CB65 "CMPA
# #$01; BLS", 07CB6C-07CB82 enemy_banks and the handlers at F2EC, 07CB84 "LDA #$42,X; BMI; INC $1876", 07CB8D "LDA
# #$57,X; BNE; INC $1883"
07CB3C  func  run_enemies
# 07CB8D "LDA #$57,X; BNE", 07CB92 "INC $1883": the enemies whose field 57 is clear
comment run_enemies Runs the enemies' list by type through enemy_banks and their handlers, after sharing out the attackers per player, counting the enemies again (last frame's count kept) and those of them in play (no entrance still to come), the count that holds off the HURRY UP.
# 07CB9F "CLR $1879; LDX #$5280", 07CBAD "LDU #$F4B0" (object_list_1_banks), 07CBBF "LDU #$F40D; ASLA; JSR [A,U]",
# 07CBC5 "INC $1879"
07CB9F  func  run_list_1_objects
comment run_list_1_objects Runs list 1's objects by type through object_list_1_banks and their handlers, counting them.
# 07CBD2 "CLR $187A; LDX #$4D40", 07CBE0 "LDU #$F54C" (child_object_banks), 07CBF2 "LDU #$F4F4", 07CBF8 "INC $187A"
07CBD2  func  run_child_objects
comment run_child_objects Runs the child objects' list by type through child_object_banks and their handlers, counting them.
# 07CC05 "LDX #$5640", 07CC0F "LDU #$F581" (stage_event_banks), 07CC21 "LDU #$F577; ASLA; JSR [A,U]"
07CC05  func  run_stage_event
comment run_stage_event Runs the stage's event object by type through stage_event_banks and its handlers.
# from enemy_think (07D4C3): 07CC38 "LDD #$7F04; PUSHS A; LDU #$4A40", 07CC40 "LDA #$00,U; BEQ", 07CC45 "LDA #$45,U; CMPA
# ,S; BCC; STA ,S; STU $1870", 07CC52 "LEAU #$00C0,U; DBJNZ"
07CC38  func  find_least_attacked_player
comment find_least_attacked_player Finds the player in play the fewest enemies go after (its attackers' count) and keeps it for enemy_think.
# from run_enemies: 07CC5A "LDA $1876; CMPA #$10; BCS", 07CC62 "LDA #$04; STA $1877", 07CC6D "LDA $1874" (players),
# 07CC76 "STB $1877" (one player), 07CC7B "LDU #$F031; DECA; ASLA x 4; LEAU A,U; LDA B,U; STA $1877"
07CC5A  func  share_out_attackers
comment share_out_attackers Works out how many enemies may go after one player: by the enemies in play shared out between the players in the game (attackers_per_player), all of them with one player, 4 from 16 enemies.
# 07CC8C "RTS": the handler of the types that do nothing (07F2F2, list 0's type 3, bank byte FF), called from the
# three lists' dispatchers
07CC8C  func  object_does_nothing
comment object_does_nothing The handler of an object type that does nothing.

# ======== directions and speeds ========

# from the vector 078617 (73 callers) and 07DB95: 07CC8E "PUSHS U,D; BSR $CCA0; STD #$14,X", 07CC95 "LDD ,S; ADDA #$40;
# BSR $CCA3; STD #$0F,X"
07CC8E  func  set_speeds_from_direction
comment set_speeds_from_direction Sets the object's y and x speeds from a direction (in 256ths of a turn, 40 a quarter: 0 is +x, 40 +y) and a speed: the speed times the sine and the cosine, over 16.
# 07CCA0 "LDU #$F061" (sines) into 07CCA3
07CCA0  func  scaled_sine
comment scaled_sine The sine of a direction (sines) times a factor, over 16, signed.
# 07CCA3 "STA <$EC; ANDA #$7F; BITA #$40; BEQ; ANDA #$3F; SUBA #$40; NEGA" (the angle folded into a quarter), 07CCB1
# "LDA A,U; TSTB; BEQ; MUL", 07CCB7 "LSRDI #$04", 07CCB9 "TST <$EC; BPL; NEGD"
07CCA3  func  scaled_sine_from_table
comment scaled_sine_from_table The sine of a direction times a factor, over 16, signed, from the quarter-wave table given.
# 07CCC0 "LDU #$F0A2" (sines_20) into 07CCC3
07CCC0  func  walk_sine
comment walk_sine The sine of a direction at the walking speed (sines_20 times 16: 0140 at a quarter), signed.
# 07CCC3 the angle folded as in 07CCA3, 07CCD1 "LDB A,U; CLRA; ASLDI #$04", 07CCD6 "TST <$EC; BPL; NEGD"
07CCC3  func  walk_sine_from_table
comment walk_sine_from_table The sine of a direction from the quarter-wave table given, times 16, signed.
# from the vector 07866B and the enemies' moves: 07CCDD "PUSHS U,D; BSR $CCC0; STD #$14,X", 07CCE4 "LDA ,S; ADDA #$40;
# BSR $CCC3; STD #$0F,X"
07CCDD  func  set_walk_speeds_from_direction
comment set_walk_speeds_from_direction Sets the object's y and x speeds to walk in a direction (in 256ths of a turn) at the walking speed.
# from the vector 078671 and 07D8CE: 07CCF0 "PUSHS X,B; SEX; ADDD #$0C,U; SUBD #$0C,X; BRA $CD03"
07CCF0  func  direction_to_beside
comment direction_to_beside The direction from the object to a point beside the other one, a signed number of pixels away from it in x.
param direction_to_beside u other object
# from the vector 07861D (46 callers): 07CCFD "LDD #$0C,U; SUBD #$0C,X", 07CD0A "LDD #$11,U; SUBD #$11,X", 07CD17 the
# shorter over the longer, both shifted to fit a byte (07CD1C-07CD3A), 07CD42 "DIV X,B", 07CD43 "LDD #$F0E3; LDA D,X"
# (arctangents; the other way 07CD76 "SUBA #$40; NEGA"), 07CD79-07CD8D the quadrant by the signs
07CCFB  func  direction_to
comment direction_to The direction from the object to the other one, in 256ths of a turn (0 is +x, 40 +y), from the arctangent of the shorter distance over the longer.
param direction_to u other object

# ======== the floor ========

# from enemy_climb_up's actions: 07CDD3 "LDU #$F124; LDB #$5D,X; LSRB x 3; PUSHS B; SUBA ,S+", 07CDE0 "LDB A,U; CLRA;
# ASLDI #$04; STD #$19,X"
07CDD3  func  set_climb_speed
comment set_climb_speed Sets the object's speed up to jump onto a floor the given level (in steps of 8 pixels) by how many steps it is above the one it is on (climb_speeds).
# from the enemies' states and the vectors 07863E, 0785FC, 078602, 07865C, bank 19's 032D51: 07CDE9 "LDA #$31,X; ANDA
# #$10" (all but bit 4 cleared), 07CDF1 "LDD #$16,X; CMPD #$5C,X; BEQ" else "ORA #$40" (31) and "ORA #$08" (flags: in
# the air), 07CE09 "CLRD; LBSR $9495; STA #$46,X", 07CE13 "ANDA #$0F; ASLA x 3; STA #$5D,X", 07CE1E "ANDA #$30" into
# 09, 07CE2E "LDD #$0F,X; BNE / LDD #$14,X; BEQ", 07CE38 "LBSR $94D9; STA #$47,X; CMPA <$F0; BNE $CE88"
07CDE9  func  check_floor
comment check_floor Reads the floor map under the object (its cell, its floor's height, its priority) and, while it moves, where its speeds take it: on another floor or no floor there, checks the way ahead.
# 07CE88 "LDB <$F1; BPL" (floor ahead): 07CEA1 "LBSR $94C9" (ahead in y only) / 07CEC3 "LBSR $94B9" (in x only), a
# different level: 07CEB1 "ANDA #$0F; STA #$45,X" and 07CEB6-07CEFC 80/81 by the y speed's sign, 82/83 by the x's,
# 07CEFE "ORA #$31,X; STA #$31,X"; no floor: 07CE95 "ORA #$88; STA #$31,X; CLRW #$0F,X; CLRW #$14,X" (with bit 4, the
# slide along one way first: 07CE4F, 07CE69); 07CF04-07CF18 in the air, stopped when the step is above it; 07CF1A "LDU
# #$38,X; LDD #$5C,U; CMPD #$5C,X" (its target on the same floor: bit 4, else bit 5 "ORA #$20"); also bank 1D's object
# calls it (03A00F-03A027)
07CE88  func  check_floor_ahead
comment check_floor_ahead Checks the floor where the object is going: before a step it notes the step's level and the way it met it (front, back, left, right) and stops, and notes whether its target is beyond it; before a gap or a wall it stops (sliding along one way first when it was already looking for a way round).
# from enemy_think's end (07D638) and the vector 078641: 07CF5F "LDA #$31,X; BITA #$40; BNE" (in the air), "BPL" (no
# step), "BITA #$08; BNE" (a gap), "BITA #$20; BEQ", 07CF73 "LDB #$45,X; ASLDI #$03; CMPD #$5C,X; BHI" else "ORA
# #$04" (down), 07CF86 "ANDA #$07; STA #$28,X; CLR #$29,X; LDA #$05; STA #$02,X"
07CF5F  func  enemy_start_climbing
comment enemy_start_climbing When the floor check stopped the enemy on the ground at a step it means to take (its target is on another floor, or it met the step twice): starts climbing it (state 5), up when the step is higher than its floor, hopping down otherwise, the way it met it.

# ======== an enemy taking a hit ========

# from enemy_check_hit and the vector 0786B9: 07CFEC "LDA #$00,X; BITA #$20; LBEQ $CFEA" (CFEA "PULLS D,PC": back past
# its caller), 07CFF4 "LDA #$1E,X; SUBA #$11; CMPA #$03; LBHI", 07CFFE "LDA #$02,X; LBMI", 07D004-07D016 an enemy (kind
# from 80) hit by a player (kind 0-3): "INC #$2A,U; STX #$49,U", 07D019 "LDD #$8004; STA #$00,X; STB #$02,X", 07D022
# "LDA #$09,X; ANDA #$40; STA #$33,X", 07D02A "LDU #$25,X; LDD #$0F,U" into 07D030
07CFEC  func  enemy_take_hit
comment enemy_take_hit When the enemy was hit by an attack (kinds 11-14) and is not going down: credits the player that hit it, takes it out of the hit checks into its hit reactions (state 4) and notes which way the hit pushes it and who gets its score; otherwise its caller returns at once.
# 07D030 "BMI" (the hitter moving left), "BNE" (moving right: 07D03C "LDA #$33,X; EORA #$40"), 07D034 "LDD #$0C,U; CMPD
# #$0C,X; BCC" (standing: by the side it stands), 07D044 "LDA #$5B,U; ANDA #$70", 07D04B "LDA #$27,X; ANDA #$8F; ORA
# ,S+; STA #$27,X"; banks 14 and 15 call it with their own hitter (02802D, 028669, 02A685)
07D030  func  enemy_set_knock_direction
comment enemy_set_knock_direction Notes whether the hit pushes the enemy the way it faces (by the hitter's x speed, or by the side the hitter stands when it does not move) and takes the hitter's player number for its score.
param enemy_set_knock_direction u hitter object
# from the vector 078596 (66 callers in the banks) and enemy_goon_run: 07D056 "LBSR $CFEC; LDU #$F134; LDA #$1E,X; SUBA #$11;
# ASLA; JMP [A,U]" (F134: D071 D071 D097 D0A9)
07D056  func  enemy_check_hit
comment enemy_check_hit When the enemy was hit by an attack: takes the hit and starts the hit reaction its kind gives (kinds 11 and 12 a flinch or a fall, 13 sent flying, 14 knocked down).
# 07D071 "LDA #$1B,X; BEQ $D064" (no life left) / "LDD #$19,X; BNE $D064" (in the air): 07D064 "DEC $187B; LDA $187B;
# LSRA; BCC $D0A9" else D097; 07D07B "LDA #$33,X; BEQ" else 07D080 "CLRA" (reaction 0), 07D083 "LDA #$1E,X; CMPA #$11;
# BEQ $D08E" (kind 11: 07D08E "LDA #$09") else 07D08A "LDA #$01" (kind 12), 07D090 "STA #$28,X; CLR #$29,X"
07D071  func  enemy_react_to_hit
comment enemy_react_to_hit Picks the reaction to a hit of kind 11 or 12: with no life left or in the air, knocked down or sent flying by turns; pushed the way it faces, the flinch from behind; else the flinch of its kind.
# 07D097 "LDA #$33,X; BEQ; LDA #$07" / "LDA #$08", 07D0A2 "STA #$28,X; CLR #$29,X"
07D097  func  enemy_react_sent_flying
comment enemy_react_sent_flying Starts the hit reaction of being sent flying, forward or backward by which way the hit pushes it.
# 07D0A9 "LDA #$33,X; BEQ; LDA #$02" / "LDA #$03", 07D0B4 "STA #$28,X; CLR #$29,X"
07D0A9  func  enemy_react_knocked_down
comment enemy_react_knocked_down Starts the hit reaction of being knocked down, forward or backward by which way the hit pushes it.
# from the vector 078599, enemy_remove_off_screen and 07E299: 07D0E0 "LDA #$27,X; ORA #$80; STA #$27,X" (07BA5D-07BA78
# gives its score), into 07D0E8
07D0E0  func  enemy_mark_defeated
comment enemy_mark_defeated Marks the enemy defeated (its score is given) and lets go of its target.
# 07D0E8 "LDA #$42,X; BMI" (not counted), 07D0ED "LDU #$38,X; DEC #$45,U; BPL; CLR #$45,U", 07D0F8 "LBSR $D115"
07D0E8  func  enemy_release_target
comment enemy_release_target An enemy that counts as one goes off its target: one attacker fewer on that player, and the side it took given back.
# from the vector 07859F, enemy_become_goon, enemy_think, enemy_get_around_step: 07D10E "LDA #$30,X; CMPA #$01; BNE"
07D10E  func  enemy_leave_side_if_holding
comment enemy_leave_side_if_holding Gives the target's side back when the enemy holds one.
param enemy_leave_side_if_holding u target object
# 07D115 "LDB #$46,U; LDA #$37,X; BPL" (bit 7 clear: the target's bit 7, "ANDB #$7F"), else "ANDA #$7F; STA #$37,X; ANDB
# #$BF", 07D128 "STB #$46,U; CLR #$30,X; CLR #$3B,X"; claimed at 07D527-07D54C
07D115  func  enemy_leave_side
comment enemy_leave_side Gives back the side of its target the enemy took (one of the player's two attack slots) and goes back to coming at it.

# ======== an object's setup, gravity and the screen's edges ========

# from the vector 0785AB (126 callers), enemy_goon_set_up, enemy_become_goon, 07E195: 07D132 "LDA #$C0; STA #$00,X", 07D137 "LDD
# ,U; ORB #$80; STD #$04,X", 07D13E "LDY #$02,U; STY #$48,X; LBSR $D1B7", 07D147 "LDA #$04,U; STA #$1B,X", 07D14D "LDA
# #$05,U; ANDA #$7F; STA #$27,X", 07D155-07D169 the priority (bits 4-5) from the floor map, its cell into 47
07D132  func  start_object_from_setup
comment start_object_from_setup Starts the object from a setup record: on and in the hit checks, its kind and animation (started again), its hit box, its life and its points, and its sprites' priority from the floor map where it stands.
param start_object_from_setup u setup object_setup
# from the vector 0785B1 (69 callers), enemy_think, the climbs: 07D16E "LDD #$19,X; SUBD #$0060; STD #$19,X; BPL $D1AE"
# (rising: carry clear), into 07D179
07D16E  func  apply_gravity
comment apply_gravity Pulls the object's height speed down by gravity and, once it falls, caps its fall and lands it on its floor (carry set when it lands).
# 07D179 "CMPA #$F8; BCC; LDA #$F8; STA #$19,X", 07D182 "LDD #$5C,X; ADDD #$0007" (7 pixels above the floor), 07D193
# "CLRW #$19,X; LDD #$5C,X; STD #$16,X", 07D19C "ANDA #$F7" (flags: not in the air), 07D1A4 "LDA #$06,X; ORA #$80",
# 07D1AC "COMA"
07D179  func  cap_fall_and_land
comment cap_fall_and_land Caps the object's fall at 8 pixels a frame and, once it is within 7 pixels of its floor, lands it there (carry set): its height speed stopped, no longer in the air.
# from the vector 078662 (36 callers) and enemy_attack: 07D1B0 "LDA #$19,X; BPL $D1AE; BRA $D179"
07D1B0  func  land_if_falling
comment land_if_falling While the object falls (its height speed below 0), caps its fall and lands it on its floor (carry set when it lands).
# from the vector 0785B4 (139 callers), start_object_from_setup, enemy_back_to_thinking_after_animation: 07D1B7 "LDD ,Y;
# STD #$1C,X; LDD #$02,Y; STD #$1F,X; LDD #$04,Y; STD #$21,X; LDD #$06,Y; STD #$23,X"
07D1B7  func  set_hit_box
comment set_hit_box Copies a hit box record into the object: its power and kind of hit, its half sizes and its offsets.
param set_hit_box y box hit_box
# from the vector 0785BA and 07865C: 07D1CF "LDA #$00,X; BEQ", 07D1D4 "LDD #$0C,X; SUBD #$0010; CMPD #$01A0; BCS",
# 07D1DF "CLRW #$0F,X"
07D1CF  func  stop_beyond_screen_edge
comment stop_beyond_screen_edge Stops the object's x speed when it is more than 48 pixels off either side of the screen (objects' x runs 40-17F across it).
# from the vector 0785B7 (73 callers) and enemy_goon_run: 07D1F7 "LDA #$00,X; BEQ", 07D1FC "LDD #$0C,X; CMPD #$01C0; BCS",
# 07D204 "CLR #$00,X", 07D207 "CMPX #$5280; BCC" (the enemies' list), 07D20C "LDA #$1B,X; LBEQ $D0E0; LBRA $D0E8"
07D1F7  func  enemy_remove_off_screen
comment enemy_remove_off_screen Removes the object once it is more than 64 pixels off either side of the screen; an enemy also lets go of its target, and one with no life left is marked defeated.
# from enemy_think (07D5A1 "LBSR $D216; LBCC") and the vector 0785BD: 07D216 "LDD #$0C,X; SUBD #$0050; CMPD #$0120"
07D216  func  enemy_on_screen
comment enemy_on_screen Whether the enemy is on the screen, 16 pixels in from its edges (carry set).

# ======== an enemy facing its target ========

# from the vector 0785C9 and the moves: 07D249 "LDB #$09,X; LDA #$36,X; CMPA #$40; BPL $D257" ("ORB #$40": left) else
# "ANDB #$BF"
07D249  func  enemy_face_target
comment enemy_face_target Turns the enemy to face its target, by the direction to it.
# from the vector 0785CF and the moves' starts: 07D25D "BSR $D291; LDA #$05,X; ORA #$80; STA #$05,X"
07D25D  func  enemy_restart_walk_animation
comment enemy_restart_walk_animation Sets the enemy's walk animation toward the front or the back by where its target is, faces it, and starts the animation again.
# from the vector 0785CC: 07D268 "LDD #$2E,X; CMPD #$0010; BCC" (level with its target: 07D270 "LDA #$36,X; ANDA #$C0;
# STA #$34,X; LDA #$01" the sideways walk), 07D27C "ANDA #$C0; CMPA #$34,X; BNE" (a new quarter), 07D286 "LDA #$05,X;
# CMPA #$01; BEQ $D291"
07D268  func  enemy_pick_walk_animation
comment enemy_pick_walk_animation Picks the enemy's walk animation by where its target is: sideways when level with it in depth, toward the front or the back otherwise (changed only when the target moves into another quarter), and faces it.
# 07D291 "LDA #$36,X; BPL" (the target further back: 3) else "LDA #$02", 07D29C "STA #$05,X; LBRA $D249"
07D291  func  enemy_walk_animation_by_depth
comment enemy_walk_animation_by_depth Sets the enemy's walk animation toward the front or the back by where its target is, and faces it.
# from the vector 0785D2 and enemy_face_noting_direction: 07D2A2 "LDA #$36,X; STA #$35,X; LBRA $D268"
07D2A2  func  enemy_pick_walk_animation_noting_direction
comment enemy_pick_walk_animation_noting_direction Keeps the direction to the target (what the moves compare with to aim again) and picks the walk animation.

# ======== an enemy's target ========

# from the vector 078620 (72 callers), enemy_goon_set_up, enemy_think: 07D301 "LDA $1874; LBEQ", 07D30C "LDU #$4A40; LDD
# #$7FFF; STD <$EC", 07D31A-07D32E |dx| + |dy|, 07D330 "CMPD <$EC; BCC; STD <$EC; STU $1872", 07D33C "LEAU
# #$00C0,U", 07D347 "LDU $1872; STU #$38,X"
07D301  func  enemy_target_nearest_player
comment enemy_target_nearest_player Makes the nearest player in play (by the x and the y distance added) the enemy's target; with no players, the last one found.
# from the vector 078623 and enemy_think: 07D34F "LDA $189E; ADDA <$58; STA $189E"
07D34F  func  enemy_random
comment enemy_random A random number for the enemies' choices: the frame's random number added to the last one.
# from the vector 078626 (50 callers), enemy_goon_set_up, enemy_think, enemy_attack: 07D35B "CLR <$F0; CLR #$36,X", 07D361
# "LDD #$0C,U; SUBD #$0C,X" (|dx| into 2C, left: "LDA #$40; STA #$36,X"), 07D37A "LDD #$11,U; SUBD #$11,X" (|dy| into
# 2E, in front: "EORA #$C0"), 07D393-07D3B1 the octant ("ORA #$20"), 07D3B4 "LDA <$F0; EORA #$09,U; ASLA; BMI" (the
# target faces it), 07D3BD "CMPD #$0008" / 07D3C5 "CMPD #$0040", 07D3CD "CLR #$32,X" else "LDA #$80; STA #$32,X"
07D35B  func  enemy_look_at_target
comment enemy_look_at_target Measures the enemy's distance to its target in x and in depth, the direction to it in eighths of a turn, and whether it stands close behind a target that faces away.
param enemy_look_at_target u target object
# from enemy_think (07D5C0 "LDU #$2A,X; LEAU #$28,U; LBSR $D3D7") and the vector 078629: 07D3D7 "LDD #$2C,X; CMPD
# #$0100; BCC", 07D3DF the same in depth, 4 records of 12: 07D3E9 "LDB #$2F,X; CMPB ,U; BHI", 07D3F0 "LDB #$2D,X; CMPB
# #$01,U; BCS; CMPB #$02,U; BLS $D405", 07D3FD "LEAU #$0C,U", 07D405 "COMB; LDA #$03,U"
07D3D7  func  enemy_find_attack_range
comment enemy_find_attack_range Finds the first of its behaviour's 4 attack ranges its target is in (within the range's depth and between its least and most x distance): carry set, with the range's chance to attack.

# ======== the goon ========

# the handler of list 0's type 0 (07F2EC: D40A, bank byte 07F387 FF): 07D40A "LDU #$F19C; ASLB; JSR [B,U]" (F19C: D43B,
# 0000, D49C, D63B, D667, D6B2 by the state), 07D410 "LBSR $D056; LBRA $D1F7"
07D40A  func  enemy_goon_run
comment enemy_goon_run The plain goon's handler (enemy type 0): runs its state (starting, thinking, attacking, its hit reactions, climbing), then takes any hit and leaves when it walks off the screen.
# from the vector 0785F9 (bank 14's goons: 02840B "LBSR $85F9") and enemy_goon_enter: 07D416 "LDU #$F1A8; LBSR $D132" (the
# setup 8001: kind 80, goon; its box F13C), 07D41C "ORA #$40" (faces left), 07D424 "LDA #$01; STA #$42,X", 07D429
# "LBSR $D301; LBSR $D35B", 07D42F "LDU #$F144; STU #$2A,X", 07D435 "LDA #$10; STA #$3A,X"
07D416  func  enemy_goon_set_up
comment enemy_goon_set_up Sets the object up as a goon: its setup, facing left, with walk animations by direction, the nearest player as its target, the goon's behaviour, and a new target looked for every 16 frames.
# the goon's state 0 and the vector 0785D5: 07D43B "BSR $D416", 07D43D "LDA #$30,X; BEQ; LDA #$01; STA #$1B,X" (a spawn
# with a state: 1 life), 07D447 "CLR #$30,X; LDA #$02; STA #$02,X"
07D43B  func  enemy_goon_enter
comment enemy_goon_enter A goon's first frame: sets it up (with 1 life when its spawn gave it a starting state) and starts it thinking.
# from 07E1AE (07E1B4 "LBSR $D450"): 07D450 "LDU #$F1A8; LBSR $D132", 07D456 "LDA #$42,X; BMI; LDU #$38,X; LBSR $D10E",
# 07D461-07D46E 42, behaviour, 3A, 07D471 "CLR #$30,X; CLR #$3B,X", 07D477 "LDD #$0002; STD #$01,X" (type 0, thinking)
07D450  func  enemy_become_goon
comment enemy_become_goon Turns the object into a plain goon: the goon's setup and behaviour, its old target's side given back, run from now on as enemy type 0, thinking.

# ======== an enemy's states ========

# the goon's state 2 and the vector 0785DB (95 callers): 07D49C "LDU #$38,X; LBSR $D35B", 07D4A2 "DEC #$3A,X; BNE" (every
# 16 frames: off the old target, 07D4B7 "LBSR $D301", 07D4BA "LDA #$45,U; CMPA $1877; BCS" else "LBSR $CC38; LDU
# $1870; STU #$38,X", 07D4CD "INC #$45,U"), 07D4DE "LDA <$7D; BEQ; CLR #$00,X" (a boss beaten), 07D4E7 gravity in the
# air, 07D4F2-07D57E the approach (field 30: 0 coming, 1 at a side "STA #$30,X" with the target's slot, 2 both sides
# taken, 3 the target went down), 07D59B-07D5FE an attack (on screen, on the target's floor, in a range: 07D5CD "LBSR
# $D34F; CMPA ,S+" the chance, 07D5DC the weights, 07D5E5 "LDA B,U; STA #$28,X; LDA #$03; STA #$02,X"), 07D604-07D626
# a move by the approach's 4 weights, 07D62C "LDD #$28,X; LDU #$F586; ASLA; JSR [A,U]", 07D635 "LBSR $CDE9; LBRA $CF5F"
07D49C  func  enemy_think
comment enemy_think An enemy's thinking state: looks at its target (every 16 frames the nearest player again, or the one the fewest go after when the nearest has its share), takes or gives back a side of it, and, on the screen with the target in one of its behaviour's ranges, may start an attack by the range's chance; otherwise runs a move its behaviour picks by chance, then checks the floor and any step to climb.
# the goon's state 3 and the vector 0785DE (95 callers): 07D63B "LDD #$16,X; CMPD #$5C,X; BEQ; LBSR $D1B0", 07D646 "LDU
# #$38,X; LBSR $D35B", 07D64C "LDU #$F620; LDD #$28,X" (action_banks), 07D65E "LDU #$F5A2; ASLA; JSR [A,U]", 07D664
# "LBRA $CDE9"
07D63B  func  enemy_attack
comment enemy_attack An enemy's attacking state: lands it if it falls, looks at its target, runs the attack in its bank (action_banks and the handlers after them) and checks the floor.
# the goon's state 4 and the vector 0785E1 (70 callers): 07D667 "LDD #$28,X; LDU #$F662; ASLA; JSR [A,U]" (F662: DDC3
# DDF3 DE29 DEB1 DF4C DF60 DF9B DFB1 E028 DE0E E05E E12F E143), 07D670 "LDA #$00,X; BEQ; LBRA $CDE9"
07D667  func  enemy_hit_reaction
comment enemy_hit_reaction An enemy's hit reaction state: runs the reaction it is in (flinching, knocked down, getting up, dying...) and, unless it is gone, checks the floor.
# the goon's state 5 and the vector 0785E4 (95 callers): 07D6B2 "LDU #$F1AE; LDD #$28,X; ASLA; JSR [A,U]" (F1AE: D6BE
# D6F7 D721 D74B D787 D7A6 D7C5 D7CB), 07D6BB "LBRA $CDE9"
07D6B2  func  enemy_climb
comment enemy_climb An enemy's climbing state: runs the climb up or the hop down a step the floor check started, the way it met the step, and checks the floor.

# ======== climbing up and hopping down ========
# each by its step (field 29) through its table: "LDU #$F1BE; ASLB; JMP [B,U]" ... (F1BE D6C4 D6E0 D6E9, F1C4 D6FD D719
# D6E9, F1CA D727 D743 D6E9, F1D0 D751 D76D D6E9, F1D6 D78D D6E0 D6E9, F1DC D7AC D719 D6E9, F1E2 D78D D743 D6E9, F1E8 D78D
# D76D D6E9). The front is less y (the screen's bottom: the K053247 draws y upward, 079C53 sprite y = 11 + 16).

# action 0 (07CEB6 "LDA #$14,X; BPL" else "LDA #$80": met moving toward the front): 07D6BE "LDU #$F1BE; ASLB; JMP [B,U]"
07D6BE  func  enemy_climb_up_front
comment enemy_climb_up_front Climbs a step toward the front: jumps up to it, moves forward until it lands, waits and thinks again.
# 07D6C4 "LDA #$80; STA #$00,X" (out of the hit checks), 07D6C9 "LDA #$42,X; BEQ; LDA #$84; STA #$05,X", 07D6D3 "LDA
# #$45,X; LBSR $CDD3", 07D6D9 "CLRW #$0F,X; INC #$29,X"
07D6C4  func  enemy_climb_up_front_start
comment enemy_climb_up_front_start Out of the hit checks, the jump animation, the speed up to reach the step's floor, the x speed stopped.
# 07D6E0 "LDD #$FFC0; STD #$14,X; LBRA $D773"
07D6E0  func  enemy_move_front_until_landed
comment enemy_move_front_until_landed Moves toward the front while it falls until it lands.
# 07D6E9 "DEC #$3B,X; BNE", 07D6EE "LDA #$C0; STA #$00,X; LBRA $D220" (07D220 "LDA #$02; STA #$02,X; CLR #$3B,X")
07D6E9  func  enemy_back_to_thinking_after_wait
comment enemy_back_to_thinking_after_wait Once its timer runs out, back in the hit checks and thinking.
# action 1 (07CEBF "LDA #$81": met moving toward the back): 07D6F7 "LDU #$F1C4; ASLB; JMP [B,U]"
07D6F7  func  enemy_climb_up_back
comment enemy_climb_up_back Climbs a step toward the back: jumps up to it, moves back until it lands, waits and thinks again.
# 07D6FD as 07D6C4 with "LDA #$85; STA #$05,X"
07D6FD  func  enemy_climb_up_back_start
comment enemy_climb_up_back_start Out of the hit checks, the jump animation facing the back, the speed up to reach the step's floor, the x speed stopped.
# 07D719 "LDD #$0040; STD #$14,X; BRA $D773"
07D719  func  enemy_move_back_until_landed
comment enemy_move_back_until_landed Moves toward the back while it falls until it lands.
# action 2 (07CEF8 "LDA #$82": met moving left): 07D721 "LDU #$F1CA; ASLB; JMP [B,U]"
07D721  func  enemy_climb_up_left
comment enemy_climb_up_left Climbs a step to the left: jumps up to it, moves left until it lands, waits and thinks again.
# 07D727 as 07D6C4 but 07D73C "CLRW #$14,X" (the y speed stopped)
07D727  func  enemy_climb_up_left_start
comment enemy_climb_up_left_start Out of the hit checks, the jump animation, the speed up to reach the step's floor, the y speed stopped.
# 07D743 "LDD #$FF80; STD #$0F,X; BRA $D773"
07D743  func  enemy_move_left_until_landed
comment enemy_move_left_until_landed Moves left while it falls until it lands.
# action 3 (07CEFC "LDA #$83": met moving right): 07D74B "LDU #$F1D0; ASLB; JMP [B,U]"
07D74B  func  enemy_climb_up_right
comment enemy_climb_up_right Climbs a step to the right: jumps up to it, moves right until it lands, waits and thinks again.
# 07D751: the same instructions as 07D727
07D751  func  enemy_climb_up_right_start
comment enemy_climb_up_right_start Out of the hit checks, the jump animation, the speed up to reach the step's floor, the y speed stopped (the same as the left climb's start).
# 07D76D "LDD #$0080; STD #$0F,X", 07D773 next
07D76D  func  enemy_move_right_until_landed
comment enemy_move_right_until_landed Moves right while it falls until it lands.
# 07D773 "LBSR $D16E; BCC", 07D778 "CLRW #$0F,X; CLRW #$14,X; LDA #$04; STA #$3B,X; INC #$29,X"
07D773  func  enemy_fall_until_landed
comment enemy_fall_until_landed Falls with gravity; once it lands, stops and waits 4 frames.
# action 4 (action 0 with 07CF81 "ORA #$04": the step not above its floor): 07D787 "LDU #$F1D6; ASLB; JMP [B,U]"
07D787  func  enemy_hop_down_front
comment enemy_hop_down_front Hops down a step toward the front: a hop, forward until it lands, waits and thinks again.
# 07D78D "LDA #$80; STA #$00,X", 07D792 "LDA #$42,X; BEQ; LDA #$84; STA #$05,X", 07D79C "LDD #$0600; STD #$19,X; INC
# #$29,X"
07D78D  func  enemy_hop_start
comment enemy_hop_start Out of the hit checks, the jump animation and a hop up.
# action 5: 07D7A6 "LDU #$F1DC; ASLB; JMP [B,U]"
07D7A6  func  enemy_hop_down_back
comment enemy_hop_down_back Hops down a step toward the back: a hop, back until it lands, waits and thinks again.
# 07D7AC as 07D78D with "LDA #$85"
07D7AC  func  enemy_hop_back_start
comment enemy_hop_back_start Out of the hit checks, the jump animation facing the back and a hop up.
# action 6: 07D7C5 "LDU #$F1E2; ASLB; JMP [B,U]"
07D7C5  func  enemy_hop_down_left
comment enemy_hop_down_left Hops down a step to the left: a hop, left until it lands, waits and thinks again.
# action 7: 07D7CB "LDU #$F1E8; ASLB; JMP [B,U]"
07D7CB  func  enemy_hop_down_right
comment enemy_hop_down_right Hops down a step to the right: a hop, right until it lands, waits and thinks again.

# ======== the moves an enemy's behaviour picks (field 28, 0-13, by the table at F586) ========
# F586: D994 DA09 DABE DB7A DC02 DC03 DC3E DD0B DD77 DB71 D8E2 DC9C D880 D7FA; each move runs by its step (field 29)
# through its table (F1EE.. F236) and lasts while its timer (3B) runs: at 0 enemy_think picks another (07D59B "LDA
# #$3B,X; LBEQ $D604"). 07D8D4 "LDA #$31,X; BITA #$08; BEQ; LDD #$0D00; STD #$28,X": a gap ahead turns the walks into
# move 13.

# 07D7D1 "LDA #$42,X; LBNE $D2A2; LBRA $D249"
07D7D1  func  enemy_face_noting_direction
comment enemy_face_noting_direction Faces the target; an enemy with walk animations by direction also keeps the direction and picks its walk animation.
# 07D7DA "LDA #$42,X; LBNE $D268; LBRA $D249"
07D7DA  func  enemy_face_with_animation
comment enemy_face_with_animation Faces the target; an enemy with walk animations by direction also picks its walk animation.
# move 13: 07D7FA "LDU #$F1EE; ASLB; JSR [B,U]" (D806 D833 D87C), 07D800 "LDA #$29,X; BNE $D7D1"
07D7FA  func  enemy_get_around
comment enemy_get_around Move 13, taken before ground it cannot walk on: walks at an angle to its target, the other way round each time it is stopped, then a stretch straight on.
# 07D806 the walk animation, 07D815 "LDD #$6003; STA #$3B,X; STB #$3C,X", 07D81E "LDA <$58; BPL; CLR #$3D,X" else FF,
# 07D82D "INC #$29,X; LBRA $DC71"
07D806  func  enemy_get_around_start
comment enemy_get_around_start Walks for 96 frames, 3 tries, at an angle to its target to a random side.
# 07D833 "DEC #$3B,X; BNE" (out of time: 07D838 "LDU #$38,X; LBRA $D10E"), 07D83E "LDA #$31,X; BPL" (stopped: 07D843
# "DEC #$3C,X; BEQ $D858" else "COM #$3D,X; LBRA $DC71"), 07D84E "LDA #$36,X; CMPA #$35,X; LBNE $DC71", 07D858-07D875
# 16 frames straight right or toward the front by the way it was stopped
07D833  func  enemy_get_around_step
comment enemy_get_around_step Aims again at the angle when the direction to its target changes, the other way round when stopped; after 3 stops goes straight for 16 frames; out of time, gives the target's side back.
local enemy_get_around_step 07D838 u target object
# 07D87C "DEC #$3B,X; RTS"
07D87C  func  enemy_go_straight
comment enemy_go_straight Goes on as it is while its timer runs.
# move 12: 07D880 "LDU #$F1F4; ASLB; JMP [B,U]" (D99A D886)
07D880  func  enemy_walk_to_target_side
comment enemy_walk_to_target_side Move 12: walks to a point 80 pixels to the side of its target, then at it once level with it in depth.
# 07D886 "LBSR $D7DA", 07D889 "LDU #$38,X; LDD #$5C,X; CMPD #$5C,U; BEQ" (else "ORA #$10" and walk its way), 07D8A1
# "LDD #$2E,X; CMPD #$0008; BCC", every 8 frames 07D8B3 "LBSR $CCFB; LBRA $CCDD" / 07D8C4 "LDB #$50 ... LBSR $CCF0"
07D886  func  enemy_walk_to_target_side_step
comment enemy_walk_to_target_side_step Every 8 frames aims at the point 80 pixels to the side of its target (at the target itself once level with it in depth); on another floor, walks its way and looks for a way up.
# move 10: 07D8E2 "LDU #$F1F8" (D8E8 D8F3 D948)
07D8E2  func  enemy_line_up_near_target
comment enemy_line_up_near_target Move 10: walks level with its target in depth, then toward it in x, stopping 32 pixels short, at 1 pixel a frame.
# 07D8E8 "LDA #$FF; STA #$3B,X; INC #$29,X; LBRA $D25D"
07D8E8  func  enemy_line_up_near_start
comment enemy_line_up_near_start A long timer, the next step, and the walk animation.
# 07D8F3 "LBSR $D7DA; DEC #$3B,X", 07D8F9 "LDD #$2C,X; CMPD #$0040", 07D90B-07D919 "LDD #$0100; STD #$14,X" (in depth),
# 07D91E-07D92C "LDD #$0100; STD #$0F,X" (in x, by its side), 07D92F "LDD #$2E,X; CMPD #$0003; BCC; INC #$29,X"
07D8F3  func  enemy_line_up_near_in_depth
comment enemy_line_up_near_in_depth Walks to its target's depth at 1 pixel a frame (sideways first when close in x), on to the next step once within 3.
# 07D948 "LDD #$2C,X; CMPD #$0020; BCC" (stop in x), 07D95E "LDD #$0100; STD #$0F,X" toward it, 07D96E "CMPD #$0003;
# BCS; DEC #$29,X", 07D97A-07D990 close but on another floor: "LDD #$0000; STD #$28,X" (move 0)
07D948  func  enemy_line_up_near_in_x
comment enemy_line_up_near_in_x Walks toward its target in x at 1 pixel a frame until 32 pixels short, back a step when out of line in depth; close but on another floor, it walks at the target instead.
# move 0: 07D994 "LDU #$F1FE" (D99A D9B9)
07D994  func  enemy_walk_to_target
comment enemy_walk_to_target Move 0: walks straight at its target, aiming again every 8 frames, after a delay each enemy gets in turn.
# 07D99A "INC $1878; LDA $1878; STA #$3B,X" (the delays in turn), 07D9A5 "LDA #$81; STA #$05,X; INC #$29,X", 07D9AD
# "LDA #$42,X; LBNE $D25D"
07D99A  func  enemy_walk_start_in_turn
comment enemy_walk_start_in_turn Takes the next of the delays the enemies take in turn this frame and starts the walk animation.
# 07D9B9 "LBSR $D7DA", 07D9BC on another floor "ORA #$10" and walk its way, 07D9D4 "CMPD #$0020" both: stop, 07D9EB
# "DEC #$3B,X; BNE; LDA #$08; STA #$3B,X; LBSR $CCFB", 07D9F8 "LBSR $CCDD"
07D9B9  func  enemy_walk_to_target_step
comment enemy_walk_to_target_step Every 8 frames aims at its target and walks that way, stopping within 32 pixels of it; on another floor, walks its way and looks for a way up.
# move 1: 07DA09 "LDU #$F202" (DA0F DA1A DA71)
07DA09  func  enemy_line_up_with_target
comment enemy_line_up_with_target Move 1: walks level with its target in depth, then toward it in x until 16 pixels short, at the enemies' speed.
# 07DA0F: the same instructions as 07D8E8 (also step 0 of move 8)
07DA0F  func  enemy_line_up_start
comment enemy_line_up_start A long timer, the next step, and the walk animation.
# 07DA1A as 07D8F3 with 07DA35 "LDD $1886; STD #$14,X" (the enemies' speed by the rank) and 07DA23 "CMPD #$0020"
07DA1A  func  enemy_line_up_in_depth
comment enemy_line_up_in_depth Walks to its target's depth at the enemies' speed (sideways first when close in x), on to the next step once within 3.
# 07DA71 as 07D948 with "LDD $1886; STD #$0F,X" and 07DA7A "CMPD #$0010"
07DA71  func  enemy_line_up_in_x
comment enemy_line_up_in_x Walks toward its target in x at the enemies' speed until 16 pixels short, back a step when out of line in depth; close but on another floor, it walks at the target instead.
# move 2: 07DABE "LDU #$F208" (DAC4 DAD8 DB35 DB4C)
07DABE  func  enemy_keep_distance
comment enemy_keep_distance Move 2: keeps its distance from its target: backs off when it is too close, comes closer when it is far, and stands facing it in between.
# 07DAC4 "LDA #$FF; STA #$3B,X; INC #$29,X", 07DACC "LDA #$42,X; LBNE $D25D", 07DAD2 "LDA #$81; STA #$05,X"
07DAC4  func  enemy_keep_distance_start
comment enemy_keep_distance_start A long timer, the next step, and the walk animation.
# 07DAD8 "LDD #$2C,X; CMPD #$0050" / "LDD #$2E,X; CMPD #$0020" (too close: 07DAEE "LDA #$36,X; ADDA #$80" away), 07DAF5
# "CMPD #$0070" / "CMPD #$0040" (in between: stand, 07DB0A "LDB #$87" or 86/94 by the side), 07DB23 far: toward it
07DAD8  func  enemy_keep_distance_step
comment enemy_keep_distance_step Within 80 pixels in x and 32 in depth of its target, walks away from it; beyond 112 and 64, walks at it; in between, stands facing it.
# 07DB35 "LBSR $D7DA", "CMPD #$0050" / "CMPD #$0020", 07DB48 "CLR #$29,X"
07DB35  func  enemy_keep_distance_back_off
comment enemy_keep_distance_back_off Walks away from its target until it is no longer too close, then looks again.
# 07DB4C "CMPD #$0070" / "CMPD #$0040; BCC; CLR #$29,X", 07DB63 "LDA <$16; BITA #$0F; BNE" (every 16 frames: 07DB6A
# "LDA #$36,X; LBSR $CCDD")
07DB4C  func  enemy_keep_distance_close_in
comment enemy_keep_distance_close_in Walks at its target, aiming again every 16 frames, until it is no longer far, then looks again.
# move 9: 07DB71 "LDU #$F210" (DBD8 DBF3), 07DB77 "LBRA $DB83" (07DB83 "LDD #$0C,X; SUBD #$0040; CMPD #$0140; BCS"
# else stop)
07DB71  func  enemy_wait_while_target_down
comment enemy_wait_while_target_down Move 9: stands still while its target is down, stopped when off the screen.
# move 3: 07DB7A "LDU #$F214" (DB95 DBB3 DBF3), then 07DB83 the same stop off the screen
07DB7A  func  enemy_back_off
comment enemy_back_off Move 3: backs away from its target for 32 frames, then stands while its target is down, stopped when off the screen.
# 07DB95 "LDA #$20; STA #$3B,X", 07DB9A "LDA #$36,X; ADDA #$80; LDB #$20; LBSR $CC8E" (away at 1 pixel a frame), the
# walk animation
07DB95  func  enemy_back_off_start
comment enemy_back_off_start Walks away from its target at 1 pixel a frame for 32 frames, with the walk animation.
# 07DBB3 "DEC #$3B,X; BNE", 07DBB8 "LDU #$38,X; LDA #$1B,U; BEQ" (the target has life: 07DBC0 "LDA #$80"), 07DBC7-07DBDF
# 87 or 93 at random, 07DBE4 "CLRW #$0F,X; CLRW #$14,X; LDA #$40; STA #$3B,X; INC #$29,X"
07DBB3  func  enemy_back_off_step
comment enemy_back_off_step When the 32 frames are up: stops and stands for 64 frames, in a pose by whether its target has life left.
local enemy_back_off_step 07DBB8 u target object
# 07DBD8 "LDA #$87; STA #$05,X", then the same stop as 07DBE4
07DBD8  func  enemy_wait_start
comment enemy_wait_start Stops and stands for 64 frames.
# 07DBF3 "LDU #$38,X; LDA #$02,U; BMI", 07DBFB "CLR #$30,X; CLR #$3B,X"
07DBF3  func  enemy_wait_for_target_to_stand
comment enemy_wait_for_target_to_stand Once its target is no longer down, comes at it again and ends the move.
local enemy_wait_for_target_to_stand 07DBF3 u target object
# move 4: 07DC02 "RTS"
07DC02  func  enemy_stand_still
comment enemy_stand_still Move 4: does nothing while its timer runs.
# move 5: 07DC03 "LDU #$F21A" (DC09 DC35)
07DC03  func  enemy_step_toward_target
comment enemy_step_toward_target Move 5: walks toward its target in x for 64 frames.
# 07DC09 "LDA #$87; STA #$05,X; LDA #$40; STA #$3B,X", 07DC13 "LDD #$00C0; STD #$0F,X" (negated with the target left),
# 07DC23 "CLRW #$14,X; INC #$29,X", the walk animation
07DC09  func  enemy_step_toward_target_start
comment enemy_step_toward_target_start Walks toward its target in x at 3/4 of a pixel a frame for 64 frames, with the walk animation.
# 07DC35 "DEC #$3B,X; BNE; CLRW #$0F,X"
07DC35  func  enemy_step_toward_target_step
comment enemy_step_toward_target_step Stops when the 64 frames are up.
# move 6: 07DC3E "LDU #$F21E; ASLB; JSR [B,U]" (DC4B DC86), 07DC44 "LDA #$29,X; LBNE $D7D1"
07DC3E  func  enemy_circle_target
comment enemy_circle_target Move 6: walks round its target at an angle to it, to a random side, turning the other way when stopped.
# 07DC4B the walk animation, 07DC5A "LDA #$FF; STA #$3B,X", 07DC5F "LDA <$58; BPL; CLR #$3D,X" else FF, 07DC6E "INC
# #$29,X", into 07DC71
07DC4B  func  enemy_circle_target_start
comment enemy_circle_target_start A long timer, a random side, the walk animation, and the walk at an angle to its target.
# 07DC71 "LDA #$36,X; LDB #$3D,X; BNE; SUBA #$30" else "ADDA #$50", 07DC7F "LBSR $CCDD; ASRW #$14,X"
07DC71  func  enemy_aim_beside_target
comment enemy_aim_beside_target Walks at an angle to its target, to one side or the other, at half speed in depth.
# 07DC86 "DEC #$3B,X; LDA #$31,X; BPL" (stopped: "COM #$3D,X; BRA $DC71"), 07DC93 "LDA #$36,X; CMPA #$35,X; BNE $DC71"
07DC86  func  enemy_circle_target_step
comment enemy_circle_target_step Aims again when the direction to its target changes, the other way round when stopped.
# move 11: 07DC9C "LDU #$F222" (DCA2 DCD8 DCFB); no scenario runs it
07DC9C  func  enemy_wander
comment enemy_wander Move 11: walks in short turning stretches, a random way round, resting a while after each run of them.
# 07DCA2 "LDA #$07; STA #$3B,X; LDA #$36,X; STA #$3E,X", 07DCAD a random way, 07DCBC "INC #$29,X", into 07DCBF
07DCA2  func  enemy_wander_start
comment enemy_wander_start Starts from the direction to its target, a random way round, 7 frames a stretch.
# 07DCBF "LDA #$81; STA #$05,X; LDA #$3E,X; LDB #$3D,X; BNE; SUBA #$30" else "ADDA #$50", 07DCD2 "STA #$3E,X; LBRA $CCDD"
07DCBF  func  enemy_wander_turn
comment enemy_wander_turn Turns its heading one way or the other and walks that way.
# 07DCD8 "LDA #$31,X; BPL" (stopped: "COM #$3D,X"), 07DCE2 "DEC #$3B,X; BNE; LDA #$48; STA #$3B,X", "CLRW #$0F,X; CLRW
# #$14,X; LDA #$86; STA #$05,X; INC #$29,X"
07DCD8  func  enemy_wander_walk
comment enemy_wander_walk Walks its stretch (turning the other way when stopped), then stands for 72 frames.
# 07DCFB "DEC #$3B,X; BNE; LDA #$07; STA #$3B,X; DEC #$29,X; BRA $DCBF"
07DCFB  func  enemy_wander_rest
comment enemy_wander_rest Stands until its timer runs out, then turns and walks again.
# move 7: 07DD0B "LDU #$F228" (DD11 DD3E DD63)
07DD0B  func  enemy_rush_at_target
comment enemy_rush_at_target Move 7: runs at its target in x and slows down to a stop near it.
# 07DD11 "LDA #$90; STA #$05,X; LDA #$40; STA #$3B,X", 07DD1E "LDD #$0200; STD #$0F,X; LDD #$FFE0; STD #$3E,X" (both
# negated with the target left), 07DD37 "LBSR $D249; INC #$29,X"
07DD11  func  enemy_rush_start
comment enemy_rush_start The run animation, 2 pixels a frame toward its target in x, and the slowing down kept for later, facing it.
# 07DD3E "DEC #$3B,X; LDD #$2C,X; CMPD #$0040; BHI", 07DD49 "LDD #$2E,X; CMPD #$0010; BCS" / 07DD51 "LDA <$16; BPL",
# 07DD56 "LDA #$28" else 07DD5A "LDA #$08", "STA #$3B,X; INC #$29,X"
07DD3E  func  enemy_rush_step
comment enemy_rush_step Once within 64 pixels of its target in x, slows down over 8 frames (40 at times when out of line in depth).
# 07DD63 "DEC #$3B,X; LDA #$3B,X; CMPA #$08; BCC; LDD #$0F,X; ADDD #$3E,X; STD #$0F,X"
07DD63  func  enemy_rush_slow_down
comment enemy_rush_slow_down Slows down in its last 8 frames.
# move 8: 07DD77 "LDU #$F22E" (DA0F DA1A DD7D DDA0 DDB9)
07DD77  func  enemy_line_up_and_pace
comment enemy_line_up_and_pace Move 8: walks level with its target in depth, then paces back and forth 4 times in front of it.
# 07DD7D "LBSR $D7DA; LDD #$2004; STA #$3B,X; STB #$3C,X", 07DD89 "CLRW #$14,X; LDD #$0100; STD #$0F,X" (toward it)
07DD7D  func  enemy_pace_start
comment enemy_pace_start Walks toward its target in x at 1 pixel a frame, 32 frames a way, 4 ways.
# 07DDA0 "LBSR $D7DA; DEC #$3B,X; BNE; LDA #$20; STA #$3B,X; NEGW #$0F,X; DEC #$3C,X; BNE; INC #$29,X"
07DDA0  func  enemy_pace_step
comment enemy_pace_step Turns round every 32 frames, 4 times.
# 07DDB9 "CLR #$3B,X; RTS"
07DDB9  func  enemy_pace_end
comment enemy_pace_end Ends the move.

# ======== an enemy's hit reactions (field 28, by the table at F662) ========
# F662: DDC3 DDF3 DE29 DEB1 DF4C DF60 DF9B DFB1, then E028 DE0E E05E E12F E143 (reactions 8, 10-12 in fixed_3F); each by
# its step through its table (F248 DDC9 DDDE, F24C DDF9 DDDE, F250 DE14 DDDE, F254 DE32 DE68, F258 DEBA DEF0 DF3B, F25E
# DF52 DDDE, F262 DF66 DF83, F266 DFA1, F268 DFBA DFE7 E010). 07DDC9 "LDD #$6300; LBSR $8680": sound 63 (0797D3).

# reaction 0: 07DDC3 "LDU #$F248"
07DDC3  func  enemy_flinch_from_behind
comment enemy_flinch_from_behind Reaction 0, a hit from behind: a hit sound and its flinch, then back to thinking.
# 07DDC9 "LDD #$6300; LBSR $8680; CLRW #$0F,X; CLRW #$14,X; LDA #$8B; STA #$05,X; INC #$29,X"
07DDC9  func  enemy_flinch_from_behind_start
comment enemy_flinch_from_behind_start The hit sound, stopped, the flinch animation from behind.
# 07DDDE "LDA #$06,X; LSRA; BCC" (the animation ended), 07DDE4 "LDA #$C0; STA #$00,X; LDY #$48,X; LBSR $85B4; LBRA
# $8635" (state 2)
07DDDE  func  enemy_back_to_thinking_after_animation
comment enemy_back_to_thinking_after_animation Once its animation has ended: back in the hit checks with its hit box, thinking.
# reaction 1 (07D08A, a hit of kind 12 from the front; kind 12 is a player's third move, object_1c_moves 039DFF "0B B7
# 04 12"): 07DDF3 "LDU #$F24C"
07DDF3  func  enemy_flinch_kind_12
comment enemy_flinch_kind_12 Reaction 1, a hit of kind 12 from the front: a hit sound and its flinch, then back to thinking.
# 07DDF9 the same with "LDA #$8A"
07DDF9  func  enemy_flinch_kind_12_start
comment enemy_flinch_kind_12_start The hit sound, stopped, the flinch animation of a kind 12 hit.
# reaction 9 (07D08E, a hit of kind 11 from the front; kind 11 is a player's first and fourth moves, object_1c_moves
# 039DF7 "09 B5 04 11", 039E03 "0C B8 04 11"): 07DE0E "LDU #$F250"
07DE0E  func  enemy_flinch_kind_11
comment enemy_flinch_kind_11 Reaction 9, a hit of kind 11 from the front: a hit sound and its flinch, then back to thinking.
# 07DE14 the same with "LDA #$89"
07DE14  func  enemy_flinch_kind_11_start
comment enemy_flinch_kind_11_start The hit sound, stopped, the flinch animation of a kind 11 hit.
# reaction 2: 07DE29 "LDU #$F254; ASLB; JSR [B,U]; LBRA $85BA"
07DE29  func  enemy_knocked_forward
comment enemy_knocked_forward Reaction 2: knocked down forward, flying the way it faces; on landing it dies or lies to get up.
# 07DE32 the hit sound, 07DE3B "LDA #$8E; STA #$05,X", 07DE40 "LDD #$0200; STD #$0F,X; CLRW #$14,X", 07DE49 "LDD
# #$16,X; SUBD #$5C,X; CMPD #$0020; BCC; LDD #$0200; STD #$19,X", 07DE5A "BITA #$40; BEQ; NEGW #$0F,X"
07DE32  func  enemy_knocked_forward_start
comment enemy_knocked_forward_start The hit sound, the knocked-down animation, 2 pixels a frame the way it faces, thrown up when near its floor.
# 07DE68 "LDD #$19,X; SUBD #$0020; STD #$19,X; LBSR $8662; BCC" (landed: stop and 07DE7C), 07DE94 "LDD #$0F,X; BNE"
# (stopped in the air: 07DE9E "LDA #$85" / "LDA #$95", 07DEAA "LDD #$0600; STD #$28,X")
07DE68  func  enemy_knocked_fall
comment enemy_knocked_fall Falls with gravity; landed, it dies or lies to get up; stopped by a wall in the air, it drops.
# 07DE7C "LDA #$1B,X; BNE", 07DE81 "LDD #$0500; STD #$28,X", 07DE88 "LDD #$0400; STD #$28,X; LDA #$20; STA #$3B,X"
07DE7C  func  enemy_die_or_get_up
comment enemy_die_or_get_up With no life left, dies; otherwise lies 32 frames and gets up.
# reaction 3: 07DEB1 "LDU #$F258; ASLB; JSR [B,U]; LBRA $85BA"
07DEB1  func  enemy_knocked_back
comment enemy_knocked_back Reaction 3: knocked down backward; on landing it lies on its back, then dies or gets up.
# 07DEBA the hit sound, "LDA #$8C; STA #$05,X", 07DEC8 "LDD #$FE00; STD #$0F,X" (negated when it faces left), thrown up
# when near its floor
07DEBA  func  enemy_knocked_back_start
comment enemy_knocked_back_start The hit sound, the knocked-back animation, 2 pixels a frame backward, thrown up when near its floor.
# 07DEF0 gravity, 07DEF9 "LBSR $8662; BCC", 07DF04 "LDA #$8D; STA #$05,X", 07DF09 "LDA #$1B,X; BNE" (07DF0E "LDD
# #$0500; STD #$28,X") / 07DF15 "LDA #$04; STA #$3B,X; INC #$29,X"; stopped in the air: 84/96 and reaction 6
07DEF0  func  enemy_knocked_back_fall
comment enemy_knocked_back_fall Falls with gravity; landed on its back, it dies with no life left or lies 4 frames; stopped by a wall in the air, it drops.
# 07DF3B "DEC #$3B,X; BNE; LDA #$10; STA #$3B,X; LDD #$0400; STD #$28,X"
07DF3B  func  enemy_lie_then_get_up
comment enemy_lie_then_get_up Lies until its timer runs out, then gets up after 16 frames more.
# reaction 4: 07DF4C "LDU #$F25E" (DF52 DDDE)
07DF4C  func  enemy_get_up
comment enemy_get_up Reaction 4: lies until its timer runs out, gets up, and thinks again.
# 07DF52 "DEC #$3B,X; BNE; LDA #$8F; STA #$05,X; INC #$29,X"
07DF52  func  enemy_get_up_start
comment enemy_get_up_start Lies until its timer runs out, then the getting-up animation.
# reaction 5: 07DF60 "LDU #$F262" (DF66 DF83)
07DF60  func  enemy_die
comment enemy_die Reaction 5: lies blinking, then is gone, defeated.
# 07DF66 "LDA #$05,X; CMPA #$0E; BEQ; LDA #$88; STA #$05,X", 07DF72 "ANDA #$FB; STA #$00,X", 07DF7A "LDA #$20; STA #$3B,X"
07DF66  func  enemy_die_start
comment enemy_die_start The dying animation (unless it is already on animation 0E), no longer kept from damage, 32 frames to go.
# 07DF83 "LDA #$3B,X; CMPA #$10; BCC; LBSR $864A" (07D229 "EORB #$84": on and off), 07DF8D "DEC #$3B,X; BNE; CLR #$00,X;
# LBSR $8599; PULLS D,PC"
07DF83  func  enemy_die_blink
comment enemy_die_blink Blinks in its last 16 frames, then is removed and marked defeated, and its handler stops there.
# reaction 6: 07DF9B "LDU #$F266" (DFA1)
07DF9B  func  enemy_drop
comment enemy_drop Reaction 6: drops to its floor, then dies or lies to get up.
# 07DFA1 "LDD #$19,X; SUBD #$0010; STD #$19,X; LBSR $8662; LBCS $DE7C"
07DFA1  func  enemy_drop_fall
comment enemy_drop_fall Falls with a lighter pull than the knock-downs' (16 a frame against 32); landed, it dies or lies to get up.
# reaction 7: 07DFB1 "LDU #$F268; ASLB; JSR [B,U]; LBRA $85BA" (DFBA DFE7 E010)
07DFB1  func  enemy_sent_flying
comment enemy_sent_flying Reaction 7: sent flying the way it faces, nudged up when it hits a wall, then dies or lies to get up.
# 07DFBA "LDA #$20; STA #$3B,X", the hit sound, 07DFC5 "LDA #$98; STA #$05,X", 07DFCA "LDD #$0200; STD #$0F,X"
# (negated when it faces left), 07DFDD "LDD #$0F,X; STD #$3E,X"
07DFBA  func  enemy_sent_flying_start
comment enemy_sent_flying_start The hit sound, the flying animation, 2 pixels a frame the way it faces for 32 frames, its speed kept.
# 07DFE7 "DEC #$3B,X; BNE; INC #$29,X", 07DFEF gravity "LBSR $8662", 07DFFB "LDA #$31,X; BITA #$80; BEQ; BITA #$08;
# BNE", 07E006 "INC #$17,X; LDD #$3E,X; STD #$0F,X"
07DFE7  func  enemy_sent_flying_step
comment enemy_sent_flying_step Flies with gravity for its 32 frames; when a step stops it, it is lifted a pixel and keeps its speed.

# ======== work RAM variables ========

# the floor map: 64 cells a row (079540 "LDU #$4000; LEAU D,U"; 07C59F "LDY #$4000"), filled from the map blocks'
# floor patterns (07C6F1, 07C71F)
4000  var  floor_map  u8
# the next spawn of the scene's list: 07C974 "STX <$73" (spawn_list_places), 07C9B2 "LDX <$73", 07CA4A "STX <$73"
4873  var  spawn_next  u16 spawn
# when set, all the marked layer edges are drawn in one frame (07C431 "LDA <$99; BEQ" stops after one); banks 12, 13, 20
# set it (0246D7, 027409, 0401CE)
4899  var  draw_all_layer_edges  u8
# the columns and rows to draw: bit 1 layer A, bit 0 layer B, bit 2 the floor map (07C385-07C391, 07C42B "COMA; ANDA
# <$9A; STA <$9A")
489A  var  layer_columns_to_draw  u8
489B  var  layer_rows_to_draw  u8
# whether the layers' columns (horizontal scrolling) and rows (vertical) are drawn as they scroll: 07C36C "LDA <$9C",
# 07C394 "LDA <$9D"; a stage's scroll record sets them (0262A9 "LDA ,U+; STA <$9C; LDA ,U+; STA <$9D")
489C  var  layer_columns_on  u8
489D  var  layer_rows_on  u8
# the bank of the area's map, switched in before each block (07C5CC "LDA #$02,Y; STA <$9E", 07C74E "LDB <$9E; STB <$0E;
# SETLN <$0E")
489E  var  map_bank  u8
# the floor pattern's column a column copy keeps (07C6F1 "STA <$A1", read by 07C730 too), the block's floor pattern
# (07C6F4 "LDB #$01,X; STB <$A2"), and the 4 tiles or cells a block's row or column takes (07C6BD "LDB #$04; STB <$A3")
48A1  var  floor_pattern_offset  u8
48A2  var  floor_pattern  u8
48A3  var  block_cells_left  u8
# the layer whose map fills the floor map: 0 A, 1 B (07C38A "LDB <$A6; BNE; ORA #$04"; 07C46D "LDA <$A6"; set by bank 13
# 026413 "LDA ,U+; STA <$A6", 02605E)
48A6  var  camera_main_layer  u8
# the camera's x and y scrolls held (026237 "LDA <$A7; BEQ; CLRD; STD <$E4", 026240 "LDA <$A8; BEQ; CLRD; STD <$E6"):
# 07CB33 "STB <$A7" (too many enemies), 07CAF5 "LDD #$0101; STD <$A7", and the stages' objects (02AD67 "DEC <$A7")
48A7  var  camera_x_held  u8
48A8  var  camera_y_held  u8
# whether layer A's and B's edges are drawn as they scroll (07C367 "LDA <$A9; BEQ", 07C3BC "LDA <$AA; BEQ"; 0262A2)
48A9  var  layer_a_edges_on  u8
48AA  var  layer_b_edges_on  u8
48B8  var  cemetery_scroll  u16
48CC  var  layer_a_offset_y2  u16

# ======== the program's data this file reads ========

# an object's setup (data_walk.py ARGUMENT_RECORDS "object setup", 6 bytes): 07D137 "LDD ,U; ORB #$80; STD #$04,X" its
# kind and animation, 07D13E "LDY #$02,U; STY #$48,X; LBSR $D1B7" its hit box, 07D147 "LDA #$04,U; STA #$1B,X" its life,
# 07D14D "LDA #$05,U; ANDA #$7F; STA #$27,X" its points (07BA69 "ANDA #$0F" the score it gives)
struct object_setup 06 rom
# the kind (high byte, the sprite set) and the animation (low byte), read as one word
field object_setup 00 kind_and_animation u16
field object_setup 02 box u16 hit_box
field object_setup 04 life u8
field object_setup 05 points u8
# the goon's: 07D416 / 07D450 "LDU #$F1A8" (80 01 F13C 08 01), its box (10 04 20 00 00 20 00 00) and its behaviour
# (07D42F "LDU #$F144; STU #$2A,X": 88 bytes up to F19B, where its state table starts)
07F1A8  table  goon_setup[1]  object_setup
07F13C  table  goon_hit_box[1]  hit_box
07F144  table  goon_behaviour[1]  enemy_behaviour

# 0 when close behind a target that faces away, 80 otherwise (07D3CD "CLR #$32,X", 07D3D1 "LDA #$80; STA #$32,X")
scoped object enemy 32 not_behind_target u8
# the quarter its walk animation was picked for (07D270 "ANDA #$C0; STA #$34,X")
scoped object enemy 34 walk_quarter u8
# the direction to the target the moves aimed by (07D2A5 "STA #$35,X", 07D84E "CMPA #$35,X")
scoped object enemy 35 aimed_direction u8
# bit 7: which of its target's two attack slots it holds (07D547 "ORA #$80; STA #$37,X", 07D118 "LDA #$37,X; BPL")
scoped object enemy 37 side u8
# 07D815 "STB #$3C,X" (3 tries round), 07DD86 "STB #$3C,X" (4 paces)
scoped object enemy 3C count u8
# the way round its target: 07D81E-07D82A "LDA <$58; BPL; CLR #$3D,X" / "LDA #$FF; STA #$3D,X", 07DC74 "LDB #$3D,X; BNE"
scoped object enemy 3D way_round u8

# ======== the vectors in fixed_3C whose code lives in this file's range ========
# (078580-0786CB: the decompiler folds each one's code into the vector's function, so these are named there; the
# the fixed program's names may cover them too)


# ======== the K052109's spare RAM this file uses as variables (VIDEO_18xx in the C; `io` lines, or a
# var area, if the tools take them) ========
# 1870 the least attacked player (07CC4E "STU $1870"); 1872 the nearest player found (07D338 "STU $1872", 07C957 "STU
# $1872" reset to player 1); 1874 the players in the game (07C994 "LDA <$57; STA $1874"); 1876 the enemies in play
# (07CB89 "INC $1876"); 1877 the most enemies one player draws (07CC87); 1878 the walk delays in turn (07D99A "INC
# $1878", cleared by run_enemies); 1879 list 1's objects (07CBC5); 187A the child objects (07CBF8); 187B the knock-down
# turns (07D064 "DEC $187B"); 1880 last frame's enemies (07CB52); 1883 the enemies with field 57 clear (07CB92); 1885
# the enemy limit (07CB1E "STA $1885"); 1886 the enemies' speed (07C990 "STD $1886"); 189C hold both scrolls (07CAEF);
# 189E the enemies' random number (07D356 "STA $189E")

# ======== banks 10-12 ========
# Names for banks 10, 11, 12 (places 020000-025FFF): the two bonus stages and their results, stage 1's boss (the
# wrestler), the speech balloon, the high score table and the name entry, the ending, stage 7's boss and its helpers,
# and the scripted scenes that end the stages. symbols.txt syntax.
#
# Evidence used throughout (checked in build/listing/simpsons.s and the ROM):
# - Which scenario runs what: build/scenarios/<scenario>/executed.txt. Bonus 1 runs in stage1 and bonus1 (the step
#   after stage 1), bonus 2 in stage6 and bonus2 (the step after stage 6), the wrestler in stage1 and buy_in, stage 7's
#   boss in stage7 only, the ending's code in stage8, the high score table in attract (its first five lines also at
#   the end of stage8), the name entry in none (no scenario makes a high score).
# - The scene each scripted scene shows: the background scene (direct page 75) it sets: 82 stage 1 Downtown, 83 bonus 1,
#   84 stage 2 Krustyland, 89 stage 5 the gorge, 8A stage 6 Dreamland, 8B bonus 2, 8C stage 7 Channel 6, 8D stage 8
#   the power plant, 8E the ending (tools/extract_assets.py SCENE_NAMES), and the step code that calls each entry of
#   bank 12 (07A5FB stage 1's step, 07A876 stage 2's, 07AD8F stage 5's, 07AE1A / 07AEBE / 07AEEE stage 6's, 07B039 the
#   bonus 2 step's, 07B14C / 07B19B stage 7's, 07B228 / 07B3DC stage 8's).
# - The fixed program's routines these banks call, by what they do: 078680 (0797D3) and 078689 (0797E3) queue a sound
#   command for the Z80 (4900 ring; 078689 not during the demo, direct page 11), 07869E (0797ED) queues it always;
#   078656 (0797B7) queues a job (4940 ring); 078677 (07BAC7) a palette request of the kind in direct page 7E; 07868C
#   (07955F) clears all the objects; 07868F (0792DD) clears the sprite RAM; 0786C2 / 0786C5 (07B632 / 07B64C) set the
#   layers' x / y scroll; 0786AD (07C4A3) draws a layer's map; 0786B0 (07C931) sets the K052109's layer modes by the
#   scene and area; 07867D (07CA54) takes a free object of the given list; 07862C (07CA8A) puts a child object; 0785B1
#   (07D16E) applies gravity down to the floor (carry: landed); 078617 (07CC8E) sets the speeds from a direction and a
#   speed; 07861D (07CCFB) the direction from X's object to U's; 078671 (07CCF0) the same to a point beside U's;
#   078686 (07D2AB) the nearest player present (carry: one); 0786BF (07E496) draws a boss's 5-piece health gauge.
# - Object fields read the same way as the other banks (the common fields): 00 flags (bit 4: drawn zoomed by
#   fields 0A/0B: 079C37 "LDA #$00,X; BITA #$10; LBNE $9CD4", the zoomed sprites), 02 state (signed), 04 kind, 05
#   animation, 06 bit 0 animation ended / bit 1 a marked frame, 09 attributes (bit 6 facing), 0A/0B zoom, 0C x, 11 y,
#   16 height, 0F/14/19 their speeds, 1B health, 1C-23 the hit box, 1E the hit's kind, 25 the attacker, 27 the
#   scoring player's bits, 28 sub-step, 29 a countdown, 2B the target.

# ============================================================================================== bank 10

# the bank's jump table (020000-020011, an LBRA each): bonus 1's contest (07A748) and intro (07A6CC), bonus 2's contest
# (07B00F) and intro (07AF97), the wrestler (type 1F of the 4F80 list: F387/F2EC entry 1F -> 020006) and the speech
# balloon (type 29 of the 4D40 list: F54C/F4F4 entry 29 -> 02000F); then bonus 1 (the balloon bonus: each player's
# balloon grows with its presses, 02034A, zoom fields 29/2B into 0A/0B; kind_0E.png's "Blow up your balloon and go
# after Maggie!")
020000  file  bonus/balloon    # the bank's jump table, then bonus 1: blow up the balloon (the step after stage 1)

# 07A748 (bonus 1's step, after 020009) "LBSR $6000"; 0200E6: the players' portraits row (021189 with F8 7C, FA 98),
# the players drawn zoomed (020904), then "LDX #$7B86; LDA $18E0; JMP [A,X]": the contest's states
020000  func  bonus_1_contest
comment bonus_1_contest Runs bonus 1's contest by the scene's state: the players' portraits along the bottom, then the start, the blowing, the result and the flight of the balloons.
# 07B00F (bonus 2's step) "LBSR $6003"; 020ACF: state 1840, at least 3, "LDX #$7D18; JMP [A,X]"
020003  func  bonus_2_contest
comment bonus_2_contest Runs bonus 2's contest by its state (from 3 on): the players' set up, the countdown, the yelling, the results and the end.
# 07CB3C's list 4F80 type 1F (F387 = 10, F2EC -> 020006 -> 0212F8): 0216D2 hits, "LDU #$7E2F; LDA #$02,X; JSR [A,U]"
# the state, 021795 the walls, 0786BF the gauge by wrestler_gauge_piece_health_by_players
020006  func  wrestler_update
comment wrestler_update Runs stage 1's boss, the wrestler, each frame: reacts to a hit, runs its state, keeps it inside its fighting area and draws its health gauge.
# 07A6CC (bonus 1's step, the substate after 07A689 sets the scene 83) "LBSR $6009": 020012 "CLRA; LBSR $69C0" (the
# title), "LDX #$7B80; LDA $18E0; JMP [A,X]"
020009  func  bonus_1_intro
comment bonus_1_intro Runs bonus 1's introduction: the title, the camera's pan and a character showing how to blow up the balloon.
# 07AF97 (bonus 2's step) "LBSR $600C": 020A32 "LDA $1840; LDX #$7D18; JMP [A,X]" (states 0-2)
02000C  func  bonus_2_intro
comment bonus_2_intro Runs bonus 2's introduction by its state (0 to 2): the music, the title and the camera's pan, then the first player in the game trying it out.
# list 4D40 type 29 (F54C = 10, F4F4 -> 02000F -> 0219EC "LDU #$7EE1; LDA #$02,X; JMP [A,U]"); put in by bank 1D
# 03ADA9 (Mr. Burns' robot): "LDA #$29; STA #$01,U; LDD #$B083; STD #$04,U" (kind B0, speech_balloons, animation
# 83), "LDA #$80; STA #$28,U; STX #$29,U"
02000F  func  speech_balloon_update
comment speech_balloon_update Runs a speech balloon (kind B0) by its state: put beside its speaker, then carried along with it until its time runs out.

# 020020 "LBSR $6919; BCC; INC $18E0": the pan of 020919 (state 0 of 7B80)
020020  func  bonus_1_intro_pan
comment bonus_1_intro_pan Bonus 1's introduction, first state: waits for the camera's pan to end.
# 02002A (state 1 of 7B80): placement 25 (0209AE), the players in the game (0208E9), their objects (02072E); then the
# first player shown (02005B "STA $18EE") at 9C/E8/28 with its partners 37 and 35 beside it, the others cleared
02002A  func  bonus_1_intro_set_up
comment bonus_1_intro_set_up Bonus 1's introduction: puts the players' bonus objects and shows the first player in the game alone in the middle, the others hidden.
# 0200B4 (state 2 of 7B80): the hints blinking (020967), the shown player (18EE: "LDU #$7BC8; ASLA; LDU A,U") gets a
# press every 4 frames (0200D3 "LDA #$10; STA [,U]"), 0208AB the press sound, 02034A its balloon
0200B4  func  bonus_1_intro_show_how
comment bonus_1_intro_show_how Bonus 1's introduction: the shown player blows its balloon by itself, a press every 4 frames, while the button hints blink.
# 020107 (state 3 of 7B80, the contest's first): "LDA #$10; STA <$F0; LDX #$7B8C; LDA $18E1; JMP [A,X]"
020107  func  bonus_1_contest_start
comment bonus_1_contest_start Bonus 1's contest, first state: runs its start by the sub-state.
# 020116: 18E8-18EB cleared, "LDA #$10; STA <$7A" (10 seconds), 0208E9, 020829, 02072E, "LDA #$60; STA $18E2"
020116  func  bonus_1_contest_set_up
comment bonus_1_contest_set_up Bonus 1's contest: sets the timer to 10 seconds, marks the players in the game, gives the absent players their press rates and puts everyone's balloon and its parts.
# 02013F: 020ED3 (the READY sign), 020324 (the balloons), "DEC $18E2" 60 frames, then "INC $18E0"
02013F  func  bonus_1_contest_ready
comment bonus_1_contest_ready Bonus 1's contest: shows the READY sign for 96 frames while the balloons stay as they are.
# 02016F (state 4): 020803 the players' presses, 020874 the absent players', 020324 the balloons, then "LDX #$7B90;
# LDA $18E1; JMP [A,X]"
02016F  func  bonus_1_contest_play
comment bonus_1_contest_play Bonus 1's contest, while it lasts: takes everyone's presses (the absent players' by their rates), blows the balloons and runs the sub-state.
# 020182 "LDD #$8900; LBSR $8689"
020182  func  bonus_1_start_music
comment bonus_1_start_music Bonus 1's contest: starts its music (sound 8900).
# 02018D: 020F01 (the GO sign), 02062D (a balloon full), 02064A (the timer), then 0201B6: each player's partner 37
# animation 81 / A9, 35 animation 81, "LDD #$30,X; SUBD #$00A0; LSRDI #$02; STB #$01,X" (the score for the results)
02018D  func  bonus_1_blow_until_done
comment bonus_1_blow_until_done Bonus 1's contest: shows GO and counts the time down; when a balloon is full or the time is up, stops the balloons and keeps each player's result (from its balloon's size) for the ranking.
# 0201F2 (state 5): "LDX #$7B94; LDA $18E1; JMP [A,X]"
0201F2  func  bonus_1_finish
comment bonus_1_finish Bonus 1's end: runs it by the sub-state: the music, the results, the small balloons topped up and the flight.
# 0201FC "LDD #$8800; LBSR $8689"
0201FC  func  bonus_1_finish_music
comment bonus_1_finish_music Bonus 1's end: starts the results' music (sound 8800).
# 020207: 020F39 (the results); then each player whose balloon is not past 160 ("LDD #$30,X; CMPD #$0160; BHI") gets
# field 3F set and animations 82 / AA, and each its flight's wait (18E4 + player = 0F times its place, F0-F3 from
# 021081)
020207  func  bonus_1_results
comment bonus_1_results Bonus 1's end: shows the results; when they are done, marks the players whose balloon is too small and gives each a wait before its flight by its place.
# 020264: the marked players blow on (a press every other frame, 02034A) until field 30 passes 160 ("CLR #$3F,X",
# animations 81 / A9); when none is left "LDD #$AD00; LBSR $8680"
020264  func  bonus_1_top_up_balloons
comment bonus_1_top_up_balloons Bonus 1's end: the balloons too small blow up by themselves until big enough to fly, then a sound (AD00).
# 0202DD: each player's wait (18E4 + player) then 020510; "CMPA #$04" on 18EC (the players gone)
0202DD  func  bonus_1_fly_away
comment bonus_1_fly_away Bonus 1's end: after each player's wait, runs its balloon's flight; goes on when all four are gone.
# 020316: 0209F8, "INC <$04", "STD <$05" (the step's next substate)
020316  func  bonus_1_end
comment bonus_1_end Bonus 1's last state: gives the winner its health and goes on to the step's next part.
# 020324: for each player "LDU #$7BC8; ASLA; LDU A,U; BSR $634A"
020324  func  bonus_1_blow_all
comment bonus_1_blow_all Bonus 1: blows each player's balloon by its presses.
# 02034A: "LDA [,U]; ANDA #$30" (attack or jump pressed): the blowing animation (2 / 2A on 37), "LDD #$1C00; STD
# #$2D,X" for 16 frames ("LDA #$10; STA #$32,X"), else "LDD #$E800" (it shrinks); 020494 / 04D2 change 29 / 2B, which
# go to the zoom 0A / 0B (a smaller zoom draws larger); field 30 = 200 less both zooms' high bytes (larger as it
# grows); both at B0, the smallest: animation 85 at zoom 40 (empty)
02034A  func  bonus_1_blow
comment bonus_1_blow Bonus 1: one player's balloon: a press makes it grow for 16 frames, else it shrinks; its zoom follows its size, and at the smallest it shows empty.
# 020494: "LDY #$2D,X; LDX #$29,X; LMUL; LMUL", "CMPD #$B000", "CMPD #$4000" (carry: at a limit)
020494  func  bonus_1_stretch_width
comment bonus_1_stretch_width Bonus 1: grows or shrinks the balloon's width by its speed, between 4000 and B000 (carry: at a limit).
# 0204D2: the same on field 2B, between 2000 and B000
0204D2  func  bonus_1_stretch_height
comment bonus_1_stretch_height Bonus 1: grows or shrinks the balloon's height by its speed, between 2000 and B000 (carry: at a limit).
# 020510 "LDU #$7B9E; LDA #$43,X; ASLA; JMP [A,U]": 020519 (flying) or 0205C0 (popped)
020510  func  bonus_1_flight
comment bonus_1_flight Bonus 1: runs a player's balloon by its flight (field 43): flying off, or popped.
# 020519 "LDU #$7BA2; LDA #$44,X; ASLA; JMP [A,U]"
020519  func  bonus_1_fly
comment bonus_1_fly Bonus 1: runs a flying balloon by its step (field 44).
# 020522: the flyer (33) on, animations 83 / AB and 83, the blower (37) kind 0A, animation 8F, 20 frames
020522  func  bonus_1_take_off
comment bonus_1_take_off Bonus 1: a balloon's flight starts: the player holds on to it.
# 020553: "LDD #$00A0; STD #$19,X" for 20 frames, then the flyer (33) the same
020553  func  bonus_1_lift_off
comment bonus_1_lift_off Bonus 1: the player and its balloon start rising.
# 02056B / 020584: "ADDD #$0008" to both height speeds; an absent player's pops above 80 ("STA #$43,X" = 1); gone
# above 180 ("CLR ,X", "INC $18EC")
02056B  func  bonus_1_speed_up
comment bonus_1_speed_up Bonus 1: the flying player and balloon rise faster.
020584  func  bonus_1_rise
comment bonus_1_rise Bonus 1: the flying player and balloon rise faster; an absent player's balloon pops on the way up, and one past the top is gone.
# 0205C0 "LDU #$7BAA; LDA #$44,X; ASLA; JSR [A,U]", freed when its animation ends
0205C0  func  bonus_1_popped
comment bonus_1_popped Bonus 1: runs a popped balloon by its step (field 44); never seen in the scenarios.
# 0205D3 "LDD #$6C00; LBSR $8680", the balloon kind 90 animation 93, the flyer (33) kind 80, animation 8D, flipped
0205D3  func  bonus_1_pop
comment bonus_1_pop Bonus 1: the balloon pops (sound 6C00) and the player falls.
# 020600: 0785B1 on 33 (gravity); landed: animation 8E, "LDA #$60; STA #$40,X"
020600  func  bonus_1_fall
comment bonus_1_fall Bonus 1: the popped balloon's player falls to the floor and lands.
# 02061F "DEC #$40,X"; 020628 "INC $18EC"
02061F  func  bonus_1_lie
comment bonus_1_lie Bonus 1: the fallen player lies for 96 frames.
020628  func  bonus_1_fall_done
comment bonus_1_fall_done Bonus 1: counts the fallen player as gone.
# 02062D: "LDD #$30,X; CMPD #$01A0; BCC" (carry: one is)
02062D  func  bonus_1_any_balloon_full
comment bonus_1_any_balloon_full Bonus 1: whether a player's balloon has grown past its limit (carry).
# 02064A: <$7B> by 2 a frame in BCD ("ADDA #$99; DAA" twice), then <$7A> ("ADDA #$99; DAA", "LDA #$98; STA <$7B");
# both 0: carry; from 02018D and 020BB6
02064A  func  bonus_timer_tick
comment bonus_timer_tick The bonuses' timer: counts a frame down (carry when the time is up).
# 020685 is a bare RTS, called with the timer's place in F8/FA; the code right after it (unused_020686) would draw the
# timer's digits (4DA0 x 4, kind 0E, animation B0 + digit)
020685  func  bonus_draw_timer
comment bonus_draw_timer Does nothing: the bonuses' timer is not drawn (the drawing after it, unused_bonus_draw_timer_digits, nothing calls).
020686  func  unused_bonus_draw_timer_digits
comment unused_bonus_draw_timer_digits Unused: would draw the bonus timer's 4 digits as sprites (kind 0E, animations B0-B9).
# 020706 is a bare RTS (from 02013F, 02018D); unused_020707 after it would put 4D40 kind 0E animation 8F
020706  func  bonus_1_draw_sign
comment bonus_1_draw_sign Does nothing: the sign that would go with bonus 1 (unused_bonus_1_put_sign, right after it) is not put.
020707  func  unused_bonus_1_put_sign
comment unused_bonus_1_put_sign Unused: would put a kind 0E sign (animation 8F) at the given place.
# 02072E: for each player 0207C7 (placement player, its kind 0A + player), the absent ones placement 10; zoom 40 or
# B0 (absent); then 3 more each (placements 4 + 4 x part + player, absent 11 +) into fields 33, 35, 37
02072E  func  bonus_1_put_players
comment bonus_1_put_players Bonus 1: puts each player's balloon and its three parts (the character blowing, the part between and the one that flies with it), the absent players' in their own look.
# 0207C7: "LDU #$7C00; ASLA; LDU A,U", "LDY ,U++; CMPY #$FFFF", "ORB #$80; STD #$04,Y", "LDD #$00B0; STD #$11,Y"
0207C7  func  bonus_put_placement
comment bonus_put_placement The bonuses: puts the given record of bonus_placements (its object, or the caller's where it says FFFF; its kind, animation, x and height, FFFF keeping the old one) and hands back the object.
# 020803: for players in the game "LDA [#$03,U]; STA [,U]"
020803  func  bonus_1_take_presses
comment bonus_1_take_presses Bonus 1: copies each player in the game's newly pressed controls into its bonus record.
# 020829: field 42 of each absent player's object: 5 more each ("ADDA #$05") from a random start (<$58> & 3)
020829  func  bonus_1_set_absent_rates
comment bonus_1_set_absent_rates Bonus 1: gives each absent player a press rate (frames between presses) for its balloon to blow by itself.
# 020874: absent players "LDA #$41,X; BNE": a press each field-42 frames
020874  func  bonus_1_absent_presses
comment bonus_1_absent_presses Bonus 1: the absent players press by themselves, one press each so many frames.
# 0208AB: any press of the players in the game ("ORA [,U]; ANDA #$3F") and more than 20 frames since the last (18ED):
# "LDD #$2900; LBSR $8680"
0208AB  func  bonus_1_press_sound
comment bonus_1_press_sound Bonus 1: plays the press sound (2900) when a player in the game presses, at most once each 32 frames.
# 0208E9: "CLR #$3E,X; BITA <$50; BEQ; INC #$3E,X" for the 4
0208E9  func  bonus_mark_players_in_game
comment bonus_mark_players_in_game Bonus 1: marks each player's object with whether the player is in the game.
# 020904: "LDA #$00,X; ORA #$10" on the 4 players' objects (drawn zoomed)
020904  func  bonus_1_zoom_players
comment bonus_1_zoom_players Bonus 1: has the 4 players' objects drawn zoomed (by their balloon's size).
# 020919 "LDX #$7BB2; LDA <$05; ASLA; JMP [A,X]": 020922, 020937
020919  func  bonus_pan
comment bonus_pan The bonuses' introduction: runs the camera's pan by its step; carry when it is over.
# 020922: the object in Y on, y 70, attributes 20, "INC <$05"
020922  func  bonus_pan_start
comment bonus_pan_start The bonuses' introduction: shows the title's object and starts the camera's pan.
# 020937: "LDA #$03; CLRB; STD #$19,X" on 4D40, "LDD <$C5; ADDD #$0003" (layer A's y scroll) until it wraps; then 4D40
# at height CF
020937  func  bonus_pan_up
comment bonus_pan_up The bonuses' introduction: pans the view up 3 a frame, the backdrop rising with it, until it has gone round (carry).
# 020967: by the frame ("LDB <$16; ANDB #$60"), "LDX #$7BB6; JMP [B,X]": 020975 / 02097E / 020975 / 020996
020967  func  bonus_blink_hints
comment bonus_blink_hints The bonuses' introduction: shows the press hints in turn, one pair after the other with a gap between.
020975  func  bonus_hide_hints
comment bonus_hide_hints The bonuses' introduction: hides the press hints.
# 02097E: placements 15 and 16 (kind 0E animations 3B, 3C)
02097E  func  bonus_show_hints_1
comment bonus_show_hints_1 The bonuses' introduction: shows the first pair of press hints.
# 020996: placements 17 and 18
020996  func  bonus_show_hints_2
comment bonus_show_hints_2 The bonuses' introduction: shows the second pair of press hints.
# 0209AE "LDX [$7C32]; LDA ,X; BNE", "LDA #$19; LBSR $67C7"
0209AE  func  bonus_keep_backdrop
comment bonus_keep_backdrop The bonuses: puts bonus_placements' record 25 (kind 0E animation 48) back when its object is off.
# 0209C0 "LDX #$7BBE; LDB $18F1; ASLB; JMP [B,X]": 0209CA, 0209D6, 0209F7; A the bonus (020012 0, 020A47 / 020AB4 1)
0209C0  func  bonus_title
comment bonus_title The bonuses' introduction: shows the bonus' title by its step: a wait, then the title and its sound.
0209CA  func  bonus_title_wait
comment bonus_title_wait The bonuses' introduction: waits 192 frames before the title.
# 0209D6: placement 1A + bonus (kind 0E, animation 41 / 40), bonus_intro_sounds (3F30 / 3F31)
0209D6  func  bonus_title_show
comment bonus_title_show The bonuses' introduction: puts the given bonus' title and plays its voice.
0209F7  func  bonus_title_done
comment bonus_title_done The bonuses' introduction: the title is up (nothing more to do).
# 0209F8: the 4F80 list's result objects "LDA #$2F,X; CMPA #$03", "LDA #$45,X; CMPA #$01" (first place), "LDA
# #$48,X": the player's 49D2 + 8 x player ("ADDA #$14; CMPA #$28"; 07B6C1 sets it to 28 at the start: its health)
0209F8  func  bonus_reward_winners
comment bonus_reward_winners The bonuses' end: each player in first place gets 20 health, up to the full 40.

# bonus 2: "Hey, wake up and find Maggie!" (kind_0E.png; the step after stage 6, Dreamland): each press raises the
# player's level (field 01-02, +0180), which falls 8 a frame; the portrait (kind 0A + player) and its meter (+60,
# animation 91 + level / 16) show it; the kind 0E object at +840 stands beside
020A3C  file  bonus/wake_up    # bonus 2: wake up (the step after stage 6), yelling to fill a level
# 020A3C "LDD #$8700; LBSR $8680; INC $1840"
020A3C  func  bonus_2_start_music
comment bonus_2_start_music Bonus 2's introduction: starts its music (sound 8700).
# 020A47: 0209C0 (title 1), 020919 (pan); then 02128C the first player in the game, 020B37 its objects moved to the
# middle (020A90 "SUBD $4A4C" on 0C, and 0028 on 16), "LDA #$30; STA #$09,U"
020A47  func  bonus_2_intro_set_up
comment bonus_2_intro_set_up Bonus 2's introduction: the title and the camera's pan, then the first player in the game is put in the middle to show how it goes.
# 020A90: "LEAU D,U; LDD ,U; ADDD <$F8; STD ,U", the same at +60 and +840
020A90  func  bonus_2_move_player
comment bonus_2_move_player Bonus 2: adds an amount to a field of a player's object and of its two partners.
# 020AB4: 020967 hints, the title, 020C8E on player 0 with <$42> (the first player's presses)
020AB4  func  bonus_2_intro_try
comment bonus_2_intro_try Bonus 2's introduction: the shown player reacts to the first player's presses while the hints blink.
# 020AE3: 020B37 for each player, 49D3/49DB/49E3/49EB cleared, 020C3F, "LDY #$0464; STY $1840" (state 4, 100 frames),
# 020ED3 READY, "LDA #$10; STA <$7A" (10 seconds)
020AE3  func  bonus_2_set_up
comment bonus_2_set_up Bonus 2's contest: puts the four players, shows READY and sets the timer to 10 seconds.
# 020B37: kind 0A + player (portrait) animation 88, +60 animation 91 (the meter), +840 kind 0E animation 88 (in the
# game) or C5 (absent: "LSR <$F1; BCS")
020B37  func  bonus_2_put_player
comment bonus_2_put_player Bonus 2: puts a player's portrait, its level meter and the sign beside it (another one for an absent player).
# 020B9B: 020C3F; "DEC $1841" (100 frames); then "LDD #$8A00; LBSR $8680", 1840 = 5
020B9B  func  bonus_2_countdown
comment bonus_2_countdown Bonus 2's contest: waits 100 frames with the players reacting, then starts the music (8A00) and the yelling.
# 020BB6: 020F01 GO, 020C3F (carry: a level full), 02064A the timer; then "LDD #$8800", 1840/1841 = 06/28
020BB6  func  bonus_2_yell
comment bonus_2_yell Bonus 2's contest: the players yell to fill their levels while the time runs; when a level is full or the time is up, the results' music.
# 020BE3: 020C3F, 020F39 the results; done: 1840/1841 = 07/0A, the players' field 30 = 6
020BE3  func  bonus_2_results
comment bonus_2_results Bonus 2's end: shows the results; when they are done, the players take their end pose.
# 020C14: "DEC $1841", 0209F8, "INC <$04"
020C14  func  bonus_2_end
comment bonus_2_end Bonus 2's last state: after a wait, gives the winner its health and goes on to the step's next part.
# 020C2A: the portraits row (021189 with F8 78, FA A8, F0 90)
020C2A  func  bonus_2_show_portraits
comment bonus_2_show_portraits Bonus 2: shows the players' portraits along the bottom.
# 020C3F: 020C8E for the 4 players with their presses (<$42>, <$46>, <$4A>, <$4E>), bits, records (49D0 + 8n)
020C3F  func  bonus_2_all_players
comment bonus_2_all_players Bonus 2: runs each player's reactions with its presses (carry: one has filled its level).
# 020C8E: field 2F the presses (an absent player's at random: "EORA <$58; ANDA #$0F; CMPA #$02"), +840's marked frame
# "LDD #$4900", "LDA #$30,U; LDX #$7D2C; JMP [A,X]"
020C8E  func  bonus_2_player
comment bonus_2_player Bonus 2: one player: takes its presses (an absent player presses at random), plays the sign's sound on its marked frame and runs the player's state (field 30).
# 020CD1 (state 0): "LDA $1840; CMPA #$05": state 1
020CD1  func  bonus_2_wait_start
comment bonus_2_wait_start Bonus 2: a player waits for the yelling to start.
# 020CE0 (state 6): "LDA #$5C; STA #$01,U" (the level), animation 8A, the sign's +2
020CE0  func  bonus_2_end_pose
comment bonus_2_end_pose Bonus 2: a player's end pose.
# 020D03 (state 7): the meter's animation 8B at random
020D03  func  bonus_2_full
comment bonus_2_full Bonus 2: a player whose level is full: its meter shows it.
# 020D14 (state 8): bonus_2_shake_x_offsets
020D14  func  bonus_2_shake
comment bonus_2_shake Bonus 2: a reaction to yelling: the player shakes from side to side.
# 020D36 (state 9): bonus_2_squash_zooms_x / _y, "ORA #$90" (drawn zoomed)
020D36  func  bonus_2_squash
comment bonus_2_squash Bonus 2: a reaction to yelling: the player squashes and stretches.
# 020D62 (state 10): bonus_2_level_object_x_moves; animation 89
020D62  func  bonus_2_meter_jumps
comment bonus_2_meter_jumps Bonus 2: a reaction to yelling: the level meter moves aside.
# 020D90 (state 11): "LDX #$00C0", +-4 on 11
020D90  func  bonus_2_bounce
comment bonus_2_bounce Bonus 2: a reaction to yelling: the player bounces up and down.
# 020DCB (state 1): the meter's animation; full ("CMPB #$14"): state 7, carry; the level falls 8 a frame, a press adds
# 0180 and sometimes a reaction ("LDA <$58; ROLA x3; ANDA #$03; ADDA #$08; LDB #$10; STD #$30,U"); 15 frames without a
# press take B0 off
020DCB  func  bonus_2_level
comment bonus_2_level Bonus 2: a player's level: shows it on the meter; it falls each frame, a press raises it and sometimes starts a reaction, and a long silence drops it; carry when full.
# 020E64 "CLRA; RTS"
020E64  func  bonus_2_not_full
comment bonus_2_not_full Bonus 2: a player's state that only says its level is not full.
# 020E66: "LDX #$00A8" while 1840 is 2, else bonus_2_player_x
020E66  func  bonus_2_portrait_x
comment bonus_2_portrait_x Bonus 2: the x of the current player's portrait (the middle while it shows how it goes).
# 020E80: bonus_2_level_object_offsets by the kind, plus <$F2>: the +60 object's x, y and height
020E80  func  bonus_2_place_meter
comment bonus_2_place_meter Bonus 2: places a player's level meter beside its portrait.
# 020EA8 is a bare RTS; unused_020EA9 after it would put 55E0 (kind 0E animation 8F) by F8/FA
020EA8  func  bonus_2_draw_sign
comment bonus_2_draw_sign Does nothing: the sign that would go with bonus 2 (unused_bonus_2_put_sign, right after it) is not put.
020EA9  func  unused_bonus_2_put_sign
comment unused_bonus_2_put_sign Unused: would put a kind 0E sign (animation 8F) at the given place.
020ECD  func  unused_bonus_rts
comment unused_bonus_rts Unused: a bare return.
020ECE  func  unreached_bonus_clear_sign
comment unreached_bonus_clear_sign Unreached: would take the sign of unused_bonus_2_put_sign off.

# the bonuses' READY and GO signs, the results' ranking and the players' portraits row, both bonuses' (020ED3 from
# 02013F / 020AE3, 020F39 from 020207 / 020BE3, 021189 from 020000 / 020C2A)
020ED3  file  bonus/results    # the bonuses' READY and GO signs, the ranking of the results and the portraits row
# 020ED3: 5580 kind 0E animation 86 at E8/11C, field 01-02 = A0 frames, "LDD #$3F32; LBSR $8680"
020ED3  func  bonus_show_ready
comment bonus_show_ready The bonuses: shows the READY sign for 160 frames, with its voice (3F32).
# 020F01: the voice 3F33 at A0, animation 87 until field 01-02 runs out
020F01  func  bonus_show_go
comment bonus_show_go The bonuses: when READY's time runs out, shows GO with its voice (3F33); carry once it is gone.
# 020F39 "LDA $1842; ASLA; LDX #$7D8D; JMP [A,X]"
020F39  func  bonus_results
comment bonus_results The bonuses' results by their state: the places one after the other, then the points counted up; carry when done.
# 020F43: 1842 = 1, 1844 = FF, the 4 result objects (4F80 + C0n) "STX #$40,U" (2310 + 9n, their text), 42 FF
020F43  func  bonus_results_start
comment bonus_results_start The bonuses' results: prepares the four result boxes, then ranks the winners.
# 020F7F: "LDX #$0E8B; LBSR $70A5" (kind 0E animation 8B: WINNER)
020F7F  func  bonus_results_first
comment bonus_results_first The bonuses' results: puts the winners (first place sign).
# 020F87 / 020F99 / 020FAB: 0E8C / 0E8D / 0E8E (2ND, 3RD, 4TH) after the wait 1843
020F87  func  bonus_results_second
comment bonus_results_second The bonuses' results: after a wait, puts the players in second place.
020F99  func  bonus_results_third
comment bonus_results_third The bonuses' results: after a wait, puts the players in third place.
020FAB  func  bonus_results_fourth
comment bonus_results_fourth The bonuses' results: after a wait, puts the players in fourth place.
# 020FBD "LDD #$063C; STD $1842"; 020FCC "LDD #$0704"
020FBD  func  bonus_results_wait
comment bonus_results_wait The bonuses' results: waits before counting the points.
020FCC  func  bonus_results_wait_count
comment bonus_results_wait_count The bonuses' results: a last short wait before the points.
# 020FD9: the result objects' 31 wait, 021213 their text, bonus_results_hop_speeds by field 47 (into 19 and +60's 19),
# 021081
020FD9  func  bonus_results_animate
comment bonus_results_animate The bonuses' results: types each box's text, makes the newly placed ones hop and reads the places.
# 021017: each 4 frames field 46 + 1 up to the player's result (field 01 of 4A40 + C0n: "CMPA #$-053F,U"), 02125F
# prints it; finished: "LDD #$0A01"; each tick "LDD #$0801"; all 4: 1842 = 0, carry
021017  func  bonus_results_count_points
comment bonus_results_count_points The bonuses' results: counts each player's points up on its box with a tick sound, a sound when it is done; carry when all are.
# 021081: 4FC5 5085 5145 5205 (the result objects' field 45) into F0-F3
021081  func  bonus_results_read_places
comment bonus_results_read_places The bonuses' results: keeps the four players' places (for bonus 1's flight waits).
# 0210A5: the best result left below 1844 ("LDB #$01,U; CMPB $1844"); every player with it: its box (+0 and +60) at
# 78 + 48n, the place's kind and animation (X), 47 = 1F (a hop), its text (7DBC in the game, 7DCF absent, 7DE3 no
# points: "STA #$48,U"), 0212A9 the box's frame, 45 the place (1846)
0210A5  func  bonus_results_place_next
comment bonus_results_place_next The bonuses' results: finds the best result not placed yet and puts every player who has it in that place: its sign hops in and its box and text appear.
# 021189: the 4F80 objects by field 2F: 0 set up (kind 0A + player animation F0, or kind 0E animation AE / C2 for
# absent players) at F8 + 48n, FA; 3 counts 02 down
021189  func  bonus_show_player_portraits
comment bonus_show_player_portraits The bonuses: keeps the row of the players' portraits (an absent player's sign instead) at the given place.
# 021213: field 42's wait, then the text at 43: 00 the end, '$' (24) moves the tile cursor (40) by the next word, '%' (25)
# prints the number in A (02125F), else a letter (- 30) at the cursor
021213  func  bonus_results_type_text
comment bonus_results_type_text The bonuses' results: types a box's text one letter every 4 frames into the tile RAM ('$' moves, '%' prints the points).
# 02125F: up to 3 digits ("CMPA #$64", "CMPA #$0A") at F8 + 1
02125F  func  bonus_results_print_number
comment bonus_results_print_number The bonuses' results: writes the given number as up to three digits.
# 02128C: "LDB <$50; LSRB; BCS" over the 4 players
02128C  func  bonus_first_player_in_game
comment bonus_first_player_in_game The bonuses: the number of the first player in the game.
# 0212A9: "LDY #$7DF1", BMOVE 8 bytes a row into the tile RAM at 22C0 + (x - A0) / 8, rows of 38; the colours below
# by BSET (B2 / F2)
0212A9  func  bonus_results_draw_box
comment bonus_results_draw_box The bonuses' results: draws a player's box of tiles under its sign (taller for a player in the game).

# the wrestler (type 1F of the 4F80 list, kind 94; spawn_lists' stage 1): its states by field 02 (7E2F), each by
# field 28
021315  file  bosses/wrestler    # stage 1's boss, the wrestler
# 021315 "LDU #$7E3F; LDA #$28,X; JMP [A,U]" (state FD, set by 021835)
021315  func  wrestler_beaten
comment wrestler_beaten The wrestler beaten (state FD), by its step: a wait, then it blinks out.
# 02131E: field 29, then palette request 02 0020, "LDD #$6700"
02131E  func  wrestler_beaten_wait
comment wrestler_beaten_wait The wrestler beaten: waits, then a palette flash and a sound (6700).
# 021338: blinks (bit 7 of 00 by the frame); after 40 frames field 27 |= 81, it and its partner (33) off, "LDA #$01;
# STA <$7D", "INC <$04"
021338  func  wrestler_blink_out
comment wrestler_blink_out The wrestler beaten: blinks for 64 frames, then it and its partner are gone, the boss counts as beaten and the step goes on.
# 02137C "LDU #$7E43" (state FE)
02137C  func  wrestler_knocked_down
comment wrestler_knocked_down The wrestler knocked down (state FE), by its step: falls, lies, gets up.
# 021385: landed (0785B1): health at or below wrestler_beaten_health_by_players -> 021835; else animation 0D, 40 frames
021385  func  wrestler_fall
comment wrestler_fall The wrestler knocked down: falls; landing with too little health it is beaten, else it lies.
# 0213AE: after 40 frames animation 5
0213AE  func  wrestler_lie
comment wrestler_lie The wrestler knocked down: lies for 64 frames, then starts getting up.
# 0213BC: the animation done: 021816, 021708
0213BC  func  wrestler_get_up
comment wrestler_get_up The wrestler knocked down: once up, stands and picks its target again.
# 0213CA "LDU #$7E49" (state FF)
0213CA  func  wrestler_flinch
comment wrestler_flinch The wrestler hit (state FF), by its step.
0213D3  func  wrestler_flinch_wait
comment wrestler_flinch_wait The wrestler hit: waits for its flinch's animation to end.
0213DE  func  wrestler_flinch_land
comment wrestler_flinch_land The wrestler hit: once back on the floor, stands and picks its target again.
# 0213EA "LDU #$7E4D" (state 0)
0213EA  func  wrestler_entrance
comment wrestler_entrance The wrestler's entrance (state 0), by its step.
# 0213F3: waits for <$92>; then x E0, height 100 - <$B2>, falling (FF00), health C0, "INC <$7C"; its partner (list 4D40:
# kind 0F animation 91) above it, falling too, kept in 33; palette requests 02 0016 and 0017
0213F3  func  wrestler_put_in
comment wrestler_put_in The wrestler's entrance: once the camera's flag from the stage record clears, drops it in from above with its partner object, sets its health and says a boss is in.
# 021488: the partner at 130 ("CMPD #$0130"): both stop, 20 frames
021488  func  wrestler_entrance_drop
comment wrestler_entrance_drop The wrestler's entrance: the two fall until the partner is down, then hold.
# 0214B5: palette request 02 000C, "LDD #$6700", animation 0F, 40 frames
0214B5  func  wrestler_entrance_pose
comment wrestler_entrance_pose The wrestler's entrance: a palette flash, a sound (6700) and a pose.
# 0214DD: animation 4, "LDD #$0100; STD #$14,X"
0214DD  func  wrestler_entrance_step_out
comment wrestler_entrance_step_out The wrestler's entrance: after the pose, steps out.
# 0214F1: landed: palette requests 0021, 0026, "STA <$97" (shake), "LDD #$6400", animation 0B
0214F1  func  wrestler_entrance_land
comment wrestler_entrance_land The wrestler's entrance: lands shaking the screen, with a thud (6400).
# 021529: after 40 frames animation 5
021529  func  wrestler_entrance_stand
comment wrestler_entrance_stand The wrestler's entrance: stands up.
# 021537: "LDD #$3F2D; LBSR $8680", "LDA #$C0; STA #$00,X", animation 0A
021537  func  wrestler_entrance_shout
comment wrestler_entrance_shout The wrestler's entrance: shouts (3F2D) with its taunt.
# 021557: 40 frames, then state 1
021557  func  wrestler_entrance_end
comment wrestler_entrance_end The wrestler's entrance: after the taunt, starts walking.
# 021565 (state 1): 0216E4, 021708, walking animation, 02172D, wrestler_speeds_by_rank, 078617, 02174B
021565  func  wrestler_walk
comment wrestler_walk The wrestler walks toward its target at its speed by rank, until it reaches it.
# 02158F "LDU #$7E5D" (state 2)
02158F  func  wrestler_punch
comment wrestler_punch The wrestler punches (state 2), by its step.
# 021598: field 29, then animation 2, "ORA #$04" (can not be hurt)
021598  func  wrestler_punch_wind_up
comment wrestler_punch_wind_up The wrestler punches: after a wait, winds up, not to be hurt meanwhile.
# 0215B2: hit box 1 on the marked frame; done: animation 0, box 0, 10 frames
0215B2  func  wrestler_punch_strike
comment wrestler_punch_strike The wrestler punches: hits on the animation's marked frame.
0215D7  func  wrestler_punch_recover
comment wrestler_punch_recover The wrestler punches: after 16 frames, stands and picks its target again.
# 0215E3 "LDU #$7E63" (state 3, set by 021997: flag 04, animation 8, 40 frames)
0215E3  func  wrestler_guard
comment wrestler_guard The wrestler guards (state 3).
# 0215EC: hit box 2 on the marked frame, 40 frames
0215EC  func  wrestler_guarding
comment wrestler_guarding The wrestler guards for 64 frames, hitting back on the marked frame, then stands.
# 021605 "LDU #$7E65" (states 4 and 5, set by 0219B4: animation 7, x speed +-0180, height speed 0700)
021605  func  wrestler_jump
comment wrestler_jump The wrestler jumps at a player (states 4 and 5), by its step.
# 02160E: gravity; at the top ("LDA #$19,X; BNE") animation 9
02160E  func  wrestler_jump_rise
comment wrestler_jump_rise The wrestler jumps: rises; at the top, turns to come down.
# 02161F: landed: flag 40, "STA <$97" (shake), "LDD #$6400", hit box 3
02161F  func  wrestler_jump_land
comment wrestler_jump_land The wrestler jumps: lands shaking the screen (6400), hitting around it.
# 02164C: box 0, 30 frames, animation 0C (when hit, flag 20) or 0B
02164C  func  wrestler_jump_recover
comment wrestler_jump_recover The wrestler jumps: after landing, recovers.
021673  func  wrestler_jump_end
comment wrestler_jump_end The wrestler jumps: after 48 frames, walks again.
# 02168C "LDU #$7E6D" (state 6, set by 02186F)
02168C  func  wrestler_idle
comment wrestler_idle The wrestler with no target (state 6), by its step.
# 021695: 078686 (a player present): flag 40, 60 frames, animation 0A
021695  func  wrestler_idle_look
comment wrestler_idle_look The wrestler with no target: waits for a player; one there, taunts.
0216B7  func  wrestler_idle_end
comment wrestler_idle_end The wrestler with no target: after the taunt, walks again.
# 0216C8 (state 7): the target's state ("LDA #$02,Y; LBPL $7816"); no scenario runs it
0216C8  func  wrestler_wait_target_up
comment wrestler_wait_target_up The wrestler waits while its target is down, then stands (no scenario reaches it).
# 0216D2: "LDA #$00,X; BITA #$20" (hit), field 1E above 0: 02188B
0216D2  func  wrestler_check_hit
comment wrestler_check_hit The wrestler: when hit, takes the hit.
# 0216E4: facing the target ("LDA #$09,X; ANDA #$40" against the x's), 0217C9 near: 021920 (decides the attack)
0216E4  func  wrestler_approach
comment wrestler_approach The wrestler walking: when facing its target and within reach, decides how to attack (carry: it did).
# 021708: 078686 (none: 02186F); the target (2B) kept 40 frames while up, else the nearest
021708  func  wrestler_pick_target
comment wrestler_pick_target The wrestler: keeps its target a while, then takes the nearest player; with none present, goes idle.
# 02172D: 078671 (beside the target, -20 / +20) into 2D, 07861D into 2E
02172D  func  wrestler_aim
comment wrestler_aim The wrestler: the direction to the side of its target (field 2D) and to the target itself (2E).
# 02174B: "LDA #$2E,X; ADDA #$40; CMPA #$80": bit 6 of 09
02174B  func  wrestler_face_target
comment wrestler_face_target The wrestler: turns to face its target.
# 021766: wrestler_animations[A] into 04-05
021766  func  wrestler_set_animation
comment wrestler_set_animation The wrestler: sets the given animation (wrestler_animations).
# 021775: wrestler_hit_boxes[A] into 1C-23
021775  func  wrestler_set_hit_box
comment wrestler_set_hit_box The wrestler: sets the given hit box (wrestler_hit_boxes).
# 021795: the x in the stage (+ <$AC>) outside 057F-069F: "CLRD; STD #$0F,X"
021795  func  wrestler_keep_in_area
comment wrestler_keep_in_area The wrestler: stops it at the edges of its fighting area.
# 0217C9: "CMPD #$0040" on the x's, "CMPD #$0004" on the y's
0217C9  func  wrestler_within_reach
comment wrestler_within_reach The wrestler: whether the given object is within its reach (carry).
# 0217E5: one player in the game, or two or more players within reach
0217E5  func  wrestler_surrounded
comment wrestler_surrounded The wrestler: whether it should guard: alone with one player, or with two or more players within reach (carry).
# 021816: animation 1, flag 40, not flag 04, box 0, state 1
021816  func  wrestler_stand
comment wrestler_stand The wrestler stands and goes back to walking.
# 02186F: "LDD #$6800", state 6, animation 1
02186F  func  wrestler_go_idle
comment wrestler_go_idle The wrestler has no target left: laughs (6800) and waits.
# 02188B: the attacker (25) told ("STA #$2A,U; STX #$49,U"), palette request 02 0002, "LDD #$6600"; no health: knocked
# down; a hit of kind 13 or the 5th: knocked down ("LDD #$6900", state FE, thrown back); else state FF
02188B  func  wrestler_take_hit
comment wrestler_take_hit The wrestler takes a hit: flashes; with no health left or on a heavy hit (or every fifth) it is knocked down, else it flinches.

# the speech balloon (list 4D40 type 29, from bank 1D 03ADA9)
0219F5  file  objects/speech_balloon    # a speech balloon that follows its speaker
# 0219F5 (state 0): at the speaker's (29) x - 20, y - 2, height + 6C, "INC #$02,X"
0219F5  func  speech_balloon_start
comment speech_balloon_start A speech balloon: puts it above its speaker and goes along with it.
# 021A1C (state 1): "DEC #$28,X; BNE", "CLR ,X"; its speeds the speaker's
021A1C  func  speech_balloon_follow
comment speech_balloon_follow A speech balloon: moves with its speaker until its time (field 28) runs out.

# the wrestler's own fields
# 02171B "LDA #$2A,X; BEQ; DEC #$2A,X" / 021724 "LDA #$40; STA #$2A,X; STU #$2B,X": frames before it picks its target
# again
scoped object wrestler 2A target_wait u8
# 02172D: 078671 (toward a point 20 to the side of the target) "STA #$2D,X", 07861D (toward the target) "STA #$2E,X";
# 02157C "LDA #$2D,X" the walking direction, 02174B "LDA #$2E,X; ADDA #$40" the facing
scoped object wrestler 2D side_direction u8
scoped object wrestler 2E direction u8
# 02142C "STA #$1B,X; STA #$2F,X" (its health at the start), 021944 "LDA #$2F,X; SUBA #$1B,X; CMPA #$0C" (the health
# lost since), 02195D "LDA #$1B,X; STA #$2F,X"
scoped object wrestler 2F last_health u8
# 0218C9 "LDA #$30,X; CMPA #$04; BEQ" (the fifth hit knocks it down), 0218D0 "INC #$30,X", 0218EF "CLR #$30,X"
scoped object wrestler 30 hits u8
# 021468 "STU #$33,X" (the object put in with it), 021362 "LDU #$33,X; CLR #$00,U", 021488 "LDU #$33,X"
scoped object wrestler 33 partner u16 object

# the speech balloon's: 03ADC2 "LDA #$80; STA #$28,U", 021A1F "DEC #$28,X; BNE; CLR ,X" (its time); 03ADC5 "STX
# #$29,U" (who speaks), 0219F9 / 021A1C "LDU #$29,X"
scoped object speech_balloon 28 time u8
scoped object speech_balloon 29 speaker u16 object

# bonus 1's fields on the players' objects (4A40 + C0n: 02034A, 020494, 020510...)
# 020494 "LDX #$29,X ... ADDD #$29,X; CMPD #$B000 ... CMPD #$4000; STD #$29,X", 020406 "LDA #$29,X; STA #$0A,X": the
# balloon's width as a 16-bit zoom (smaller is wider); 0204D2 the same on 2B, 02040C "LDA #$2B,X; STA #$0B,X"
scoped object bonus_1 29 width_zoom u16
scoped object bonus_1 2B height_zoom u16
# 020394 "LDD #$1C00; STD #$2D,X" (a press), 0203CF "LDD #$E800; STD #$2D,X" (none), 0203D8 "LDD #$2D,X; BPL; NEGW
# #$2D,X"
scoped object bonus_1 2D growth s16
# 020420 "STD #$30,X" (200 less the two zooms' high bytes: larger as the balloon grows), 020224 "CMPD #$0160", 02062D
# "CMPD #$01A0" (full), 0201D4 "LDD #$30,X; SUBD #$00A0; LSRDI #$02; STB #$01,X" (the result)
scoped object bonus_1 30 size u16
# 02039C "LDA #$10; STA #$32,X" (16 frames of growth after a press), 0203A1 "LDA #$32,X; BEQ; DEC #$32,X"
scoped object bonus_1 32 growing u8
# the player's own object is the balloon (zoomed by 29 / 2B); its three parts: 0207A3-0207A9 "LDB <$F1; ASLB; ADDB
# #$33; STY B,X" (bonus_placements 4 + 4 x part + player); 33 kept off until the flight, 020522 "LDY #$33,X; LDA
# #$80; STA ,Y" (the character hanging on, which falls when the balloon pops: 0205E7 "LDU #$33,X", 020600); 37 the
# character blowing (02036E "LDY #$37,X; LDA #$02 ... STA #$05,Y" on a press); 35 the kind 0E part between
# (0203C7 "LDY #$35,X; LDA #$81; STA #$05,Y")
scoped object bonus_1 33 flyer u16 object
scoped object bonus_1 35 middle_part u16 object
scoped object bonus_1 37 blower u16 object
# 0208F0 "CLR #$3E,X; BITA <$50; BEQ; INC #$3E,X"
scoped object bonus_1 3E in_game u8
# 020221-020229 "LDD #$30,X; CMPD #$0160; BHI; INC #$3F,X" (a balloon not big enough), 020264 blows those on until
# past 160 ("CLR #$3F,X")
scoped object bonus_1 3F too_small u8
# 020887 "LDA #$41,X; BNE; ... LDA #$42,X; STA #$41,X" / "DEC #$41,X" (an absent player's wait between presses),
# 020849 "STA #$42,X" (its rate)
scoped object bonus_1 41 press_wait u8
scoped object bonus_1 42 press_rate u8
# 020510 "LDA #$43,X; ASLA; JMP [A,U]" (0 flying, 1 popped: 0205A8 "LDA #$01; STA #$43,X"), 020519 / 0205C0 "LDA
# #$44,X" (its step)
scoped object bonus_1 43 flight u8
scoped object bonus_1 44 flight_step u8
# 02054A "LDA #$20; STA #$3D,X", 020559 "DEC #$3D,X" (the lift-off's frames); 020616 "LDA #$60; STA #$40,X", 02061F
# "DEC #$40,X" (the fall's)
scoped object bonus_1 3D lift_time u8
scoped object bonus_1 40 lie_time u8
param bonus_1_blow u record bonus_player

# bonus 2's fields on the players' objects (in U: 4A40 + C0n)
# 020DFA "LDD #$01,U; SUBD #$0008; STD #$01,U", 020E0D "ADDD #$0180", 020DCE "LDA #$01,U; LSRA; LSRA" (a word over the
# type: the players' objects are not run by a list's dispatcher)
scoped object bonus_2 01 level u16
# 020CC8 "LDA #$30,U; ASLA; LDX #$7D2C; JMP [A,X]" (its state), 020E30 "STD #$30,U" (a reaction and its 16 frames),
# 020D14 "DEC #$31,U"
scoped object bonus_2 30 reaction u8
scoped object bonus_2 31 reaction_time u8
# 020E49 "LDA #$3F,U; CMPA #$0F; BEQ; INC #$3F,U" (frames without a press), 020E16 "CLR #$3F,U"
scoped object bonus_2 3F quiet_frames u8
# (field 2F, the presses, 020C91 "STA #$2F,U", is left out: 020C9A "LDA #$056F,U" reads the result box's 2F through the
# same pointer.) The functions that get the player's object in U (020C3F "LDU #$4A40; ... BSR $6C8E", 020AE3 "LDU
# #$4A40; ... LBSR $6B37")
param bonus_2_player u player object.bonus_2
param bonus_2_wait_start u player object.bonus_2
param bonus_2_end_pose u player object.bonus_2
param bonus_2_full u player object.bonus_2
param bonus_2_shake u player object.bonus_2
param bonus_2_squash u player object.bonus_2
param bonus_2_meter_jumps u player object.bonus_2
param bonus_2_bounce u player object.bonus_2
param bonus_2_level u player object.bonus_2
param bonus_2_place_meter u player object.bonus_2
param bonus_2_put_player u player object.bonus_2
param bonus_2_move_player u player object.bonus_2

# the results' boxes: the 4F80 list's objects 4F80 + C0n (020F54 "LDU #$4F80"), one a player
# 021194 "LDB #$2F,U; BNE" (0 not set up yet), 0211BE "STA #$2F,U" (3 a player in the game, 2 / 1 not), 0209F8 "LDA
# #$2F,X; CMPA #$03"
scoped object bonus_results 2F look u8
# 020F61 "STX #$40,U" (2310 + 9n: the box's text in the tile RAM), 021231 "LDY #$40,U; STA ,Y+; STY #$40,U"
scoped object bonus_results 40 text_cursor u16
# 020F69 "STA #$42,U", 021213 "TST #$42,U; BMI; DEC #$42,U" (frames to the next letter, FF stopped)
scoped object bonus_results 42 text_wait u8
# 021151 "STY #$43,U" (7DBC / 7DCF / 7DE3), 02121D "LDY #$43,U; LDA ,Y+"
scoped object bonus_results 43 text u16
# 021154 "STA #$45,U" (1846, the place; 4 for no points), 0209FD "LDA #$45,X; CMPA #$01" (first)
scoped object bonus_results 45 place u8
# 021034 "LDA #$46,U; INCA; CMPA #$-053F,U; BEQ; STA #$46,U" (the points shown, counted up to the player's result)
scoped object bonus_results 46 points_shown u8
# 021127 "LDA #$1F; STA #$47,U", 020FF6 "LDA #$47,U; BEQ; DEC #$47,U" (its hop: bonus_results_hop_speeds)
scoped object bonus_results 47 hop u8
# 02114A "LDA #$01; STA #$48,U" (the "no points" text), 0209F8 "LDA #$48,X; BNE"
scoped object bonus_results 48 no_points u8
param bonus_results_type_text u box object.bonus_results
param bonus_results_draw_box u box object.bonus_results

# ============================================================================================== bank 11

# the bank's jump table (022000-02200E): the high score table in the attract (022000 -> 022503, its steps reached by
# the fixed program through 7683), the name entry (022003, 07B577), the ending (022006, 07B423), stage 7's boss (022009:
# 4F80 list type 37) and its helpers (02200C: 5280 list type 37); then the name entry and the high score table
022003  file  game/name_entry    # the name entry for a high score
# 07B577 (the step after a game) "LBSR $6003"; 02200F: the sprite RAM's view off, "LDX #$7510; LDA $3840; JMP [A,X]"
022003  func  name_entry
comment name_entry Runs the name entry of the high scores by its state (3840): set up, the players typing their initials, a last wait, then the scores saved (carry when done).
# 07B423 (the ending's step) "LBSR $6006"; 0227A0: "LDA #$C0; LBSR $8653; LBCS $6917" (078653 = 079784: once direct
# page 78 has counted A frames, an attack or jump of a player in the game: carry), "LDX #$76EA; LDA $18E0; JMP [A,X]"
022006  file  scenes/ending    # the ending
022006  func  ending
comment ending Runs the ending by the scene's state: the family, the staff roll and the last fade; after 192 frames a player's button skips it.
# 07CB3C's list 4F80 type 37 (F387 = 11, F2EC -> 022009 -> 022A4C): 022DE0 hits, "LDU #$7A13; LDA #$02,X; JSR
# [A,U]", 022ECD / 022F01 the edges, 022F3A the helpers, 0786BF the gauge
022009  file  bosses/stage_7_boss    # stage 7's boss (Channel 6)
022009  func  stage_7_boss_update
comment stage_7_boss_update Runs stage 7's boss each frame: reacts to a hit, runs its state, keeps it inside its area, sends its helpers and draws its health gauge.
# 07CB9F's list 5280 type 37 (F4B0 = 11, F40D -> 02200C -> 023171 "LDU #$7AF1; LDA #$02,X; JMP [A,U]")
02200C  file  bosses/stage_7_boss_helper    # the four helpers of stage 7's boss
02200C  func  stage_7_boss_helper_update
comment stage_7_boss_helper_update Runs one of stage 7's boss' four helpers by its state: waits, moves as the boss says, or throws.
# 022029 (state 0): 0786B3 (the players' sprites), 022307 ranks them; each one's place (0786A4 against the table:
# "ADDA <$F4; CMPA #$09"), its column (022491: box and face), its place ("1ST"...) and score in sprite letters,
# initials "A@@" ("LDA #$41; LDD #$4040"), 7 Maggies (4D40 x 7: kind 11, animation 1) walking from 30
022029  file  game/name_entry    # (the name entry)
022029  func  name_entry_set_up
comment name_entry_set_up The name entry: ranks the players by score, draws each one who made the table a column with its face, place and score, starts its initials at the letter A, and sets Maggies walking along the bottom.
# 022212 (state 1): "LDD $385E; ADDD #$0001" up to 0700 (at 06C0 "LDD #$FD00; LBSR $869E"), the Maggies wrapped back
# below 0580; each player still typing (bit 7 of 3842 + 4n clear) 022367
022212  func  name_entry_type_initials
comment name_entry_type_initials The name entry: the players type their initials until all are done or the time (1792 frames) runs out, the sound stopped near the end.
# 0222B0 (state 2): 0100 frames ("LDD #$FD00" at C0)
0222B0  func  name_entry_linger
comment name_entry_linger The name entry: everyone done, waits 256 frames before saving.
# 0222CD: for each place made (3860 + 2n), its initials and score into the table (0786A1)
0222CD  func  name_entry_save
comment name_entry_save The name entry: puts each player who made the table into it with its initials and score (carry: done).
# 022307: 3860 ordered by player_score_addresses (a bubble sort, "CMPD <$EA; BHI")
022307  func  name_entry_rank_players
comment name_entry_rank_players The name entry: orders the four players by their scores, best first.
# 022367: the repeat wait ([#$0E,U]), right (02) / left (01) change the letter (+-1 between 40 and 62, sound 4500; machine.h:
# SIMPSONS_LEFT 01, SIMPSONS_RIGHT 02),
# attack or jump ("ANDA #$30") the next letter (sound 4400), the third ends ("LDA #$FF; STA ,X"); then the letters
# drawn, the cursor's letter pulsing (name_entry_cursor_zooms, the sprite RAM on)
022367  func  name_entry_edit_initials
comment name_entry_edit_initials The name entry: one player's initials: right and left change the letter (held, they repeat), a button takes it and moves on; draws them with the current letter pulsing.
# 022467: 022730, then "LDD #$0030; STD #$-08,U" (the sprite's vertical zoom: 022757 writes it at 08, 40 the normal
# size, smaller is larger), the sprite RAM on
022467  func  name_entry_print_tall_letter
comment name_entry_print_tall_letter The name entry: prints a letter as a taller sprite (the scores' digits).
# 022491: name_entry_pictures[B] in the player's column (name_entry_columns): blocks of tiles, bit 7 of A blank
022491  func  name_entry_draw_picture
comment name_entry_draw_picture The name entry: draws one of the pictures of tiles (a box or a player's face) in a player's column, or blanks it.
# 022503's steps (7683 by direct page 03, from 07A28C): 02250C, 02253C, 022564, 02252B, 0225E1, 022564, 022608,
# 02261F
# 02250C: 4F80 kind 0F animation 9F at 138/98, attributes 40
02250C  file  attract/high_scores    # the attract's high score table
02250C  func  high_scores_set_up
comment high_scores_set_up The attract's high score table: puts its heading, then clears the objects' sprites and sets the page's time (192 frames).
# 02252B: 0786B3 on 4A40 (8), "LDA #$C0; STA <$0A", "INC <$03"
02252B  func  high_scores_clear_sprites
comment high_scores_clear_sprites The attract's high score table: clears the objects' sprites and sets the page's time (192 frames).
# 02253C: 02263C on 4980 (entries 1-5); time up: line scroll on ("STA $1C80"), 80 frames, "LDD #$0700"
02253C  func  high_scores_show_first
comment high_scores_show_first The attract's high score table: shows places 1 to 5; when its time is up, starts the wavy exit with its sound (0700).
# 022564: each line's x scroll from 13 x the frame ("LDX #$1A00", "SUBD #$7001; STD ,X++"), every sprite's zoom; time up:
# sound 0000, line scroll off, sprites cleared
022564  func  high_scores_wave_out
comment high_scores_wave_out The attract's high score table: waves the page line by line and wobbles its sprites' height, then clears them.
# 0225E1: 02263C on 49A8 (entries 6-10)
0225E1  func  high_scores_show_second
comment high_scores_show_second The attract's high score table: shows places 6 to 10; when its time is up, starts the wavy exit.
# 022608: palette request 03 0000, 078695, 40 frames
022608  func  high_scores_fade_out
comment high_scores_fade_out The attract's high score table: fades the colours out.
# 02261F: then 07868C, "INC <$02", direct page 03-06 cleared
02261F  func  high_scores_end
comment high_scores_end The attract's high score table: after the fade, clears the objects and goes on to the attract's next part.
# 02263C: 5 entries of 8 bytes from X: the place (BCD, from A), 3 initials, the score (4 digits, leading zeros blank),
# the face (high_score_icons by byte 5, its frame by the time), 18 lower each
02263C  func  high_scores_print_entries
comment high_scores_print_entries The high score table: prints five entries, numbered from the given place: place, initials, score and the player's little animated face.
# 022730: sprite_font_codes[A - 30] (high byte 78), then 022757
022730  func  print_sprite_letter
comment print_sprite_letter Puts a letter as a sprite of the given colour at the current place, into the next sprite of the sprite RAM.
022748  func  unused_print_sprite_code
comment unused_print_sprite_code Unused: would put a sprite code taken from a table, colour 0F, into the next sprite.
# 022757: the sprite RAM on, "ORA #$80; STA ,U", code, x, y, zoom 40 / 40, "LEAU #$10,U"
022757  func  put_sprite
comment put_sprite Writes a sprite straight into the sprite RAM: the code, the current place, the given colour, at normal size; then moves on to the next sprite.

# the ending (scene 8E: 022809 "LDA #$8E; STA <$75"), its states by 18E0 through 76EA
0227B5  file  scenes/ending    # the ending: the family, the staff roll and the fade
# 0227B5: job 0, palette requests 01 0F90 and 02 003A, the scrolls, 07868C, 07868F, 0786B3
0227B5  func  ending_set_up
comment ending_set_up The ending: clears the screen and loads its colours.
# 0227F4: scene 8E area 0, both layers drawn, ending_placements 0 and 1
0227F4  func  ending_show_family
comment ending_show_family The ending: draws its background and puts the family.
# 022847: 022940 the staff roll, 02298F the family's animations, 02291E the scroll; when it is done ending_placements 4
022847  func  ending_roll_credits
comment ending_roll_credits The ending: rolls the staff and moves the family through its animations while the view rises; then the next pose.
# 02285C: on the marked frame of 4D40's animation "LDD #$0101", ending_placements 5 (4E00) jumping (19 = 01E0)
02285C  func  ending_toss
comment ending_toss The ending: on the family's cue something is tossed up, with a sound (0101).
# 02289A: 0229C0; 4D40's animation over: next
02289A  func  ending_catch
comment ending_catch The ending: the tossed object rises while the family's pose plays out.
# 0228B4: 0229C0 / 0229FF; then palette requests 04 0440, 0840, 0220 and 180 frames
0228B4  func  ending_fade_start
comment ending_fade_start The ending: when the tossed object is gone, the family floats away and the colours start to fade.
# 0228F3: 0229FF, at 80 palette request 02 0048, at 0 07868C, <$72> clear
0228F3  func  ending_fade
comment ending_fade The ending: the family floats away while the colours fade; then the ending is over.
# 02291E: every 68 frames ("CMPA #$68") layer A's y scroll +1 up to 1B (carry)
02291E  func  ending_scroll_up
comment ending_scroll_up The ending: raises the view a pixel every 104 frames, up to 27 (carry: there).
# 022940: every A0 frames: the old name (0786CB) and title (0786B6) erased, the next name in big letters (0786C8) and
# title (0785A5)
022940  func  ending_staff_roll
comment ending_staff_roll The ending: every 160 frames, replaces the staff roll's title and name with the next ones.
# 02298F: ending_family_waits[18E9]; past it and 4D40's animation over: ending_placements 2 again
02298F  func  ending_family_animations
comment ending_family_animations The ending: after each wait of ending_family_waits, starts the family's next animation.
# 0229C0: 4E00's height speed "SUBD #$0004" a frame, every 3 frames its zoom - 1 (larger) down to 30, then its
# animation + 1 and zoom 60, up to animation 7: gone (carry)
0229C0  func  ending_tossed_rise
comment ending_tossed_rise The ending: the tossed object flies up and comes closer, growing, through its animations until gone (carry).
# 0229FF: 4D40 drawn zoomed, height speed 4, every 16 frames its zoom + 1 (smaller)
0229FF  func  ending_family_float
comment ending_family_float The ending: the family floats up, slowly getting smaller.
# 022A1C: ending_placements[A]
022A1C  func  ending_put_placement
comment ending_put_placement The ending: puts the given record of ending_placements and hands back its object.

# stage 7's boss (4F80 list type 37, kind A3; spawn_lists' stage 7): its states by field 02 (7A13), each by field 28;
# its four helpers (5280 list type 37, kind 12) in fields 33, 35, 37, 39
022A70  file  bosses/stage_7_boss    # stage 7's boss (Channel 6)
# 022A70 "LDU #$7A21; LDA #$28,X; JMP [A,U]" (state FD, set by 022FCB: "LDA #$FD; STA #$02,X")
022A70  func  stage_7_boss_beaten
comment stage_7_boss_beaten Stage 7's boss beaten (state FD), by its step.
# 022A79: field 29, then "LDD #$3F3B"
022A79  func  stage_7_boss_beaten_wait
comment stage_7_boss_beaten_wait Stage 7's boss beaten: waits, then cries out (3F3B).
# 022A88: blinks; after C0 frames "LDD #$9600", field 27 |= 81, gone, <$7D>, "INC <$04"
022A88  func  stage_7_boss_blink_out
comment stage_7_boss_blink_out Stage 7's boss beaten: blinks for 192 frames, then it is gone (sound 9600), the boss counts as beaten and the step goes on.
022ACC  func  stage_7_boss_knocked_down
comment stage_7_boss_knocked_down Stage 7's boss knocked down (state FE), by its step.
# 022AD5: landed; health at or below stage_7_boss_beaten_health_by_players: 022FCB; else animation 0B, 40 frames
022AD5  func  stage_7_boss_fall
comment stage_7_boss_fall Stage 7's boss knocked down: falls; landing with too little health it is beaten, else it lies.
022AFE  func  stage_7_boss_lie
comment stage_7_boss_lie Stage 7's boss knocked down: lies for 64 frames, then starts getting up.
022B0C  func  stage_7_boss_get_up
comment stage_7_boss_get_up Stage 7's boss knocked down: once up, stands and picks its target again.
022B1A  func  stage_7_boss_flinch
comment stage_7_boss_flinch Stage 7's boss hit (state FF), by its step.
022B23  func  stage_7_boss_flinch_wait
comment stage_7_boss_flinch_wait Stage 7's boss hit: waits for its flinch's animation to end.
022B2E  func  stage_7_boss_flinch_land
comment stage_7_boss_flinch_land Stage 7's boss hit: once back on the floor, stands and picks its target again.
022B3A  func  stage_7_boss_entrance
comment stage_7_boss_entrance Stage 7's boss' entrance (state 0), by its step.
# 022B43: 4 helpers (07867D list 1, kind 12, type 37, stage_7_boss_helper_starts: animation, x, the boss' field), then
# itself at 096F - <$AC>, health E0, animation 1
022B43  func  stage_7_boss_put_in
comment stage_7_boss_put_in Stage 7's boss' entrance: puts its four helpers in their places and itself, with its health.
# 022BC8: <$92> clear: "INC <$7C", helpers 35 state 3 and 37 state 1
022BC8  func  stage_7_boss_start_entrance
comment stage_7_boss_start_entrance Stage 7's boss' entrance: once the camera's flag from the stage record clears, says a boss is in and sets two helpers moving.
# 022BE7: helper 35 back to 0: 35 and 33 state 3, 37 and 39 state 1
022BE7  func  stage_7_boss_move_helpers
comment stage_7_boss_move_helpers Stage 7's boss' entrance: when the first helper is done, sets all four moving.
# 022C10: helper 35 done: "LDD #$FFC0; STD #$14,X"
022C10  func  stage_7_boss_step_forward
comment stage_7_boss_step_forward Stage 7's boss' entrance: when the helpers are done, comes forward.
# 022C22: at C8 from the top: stops, animation 0D, the helpers states 6, 5, 4, 2
022C22  func  stage_7_boss_arrive
comment stage_7_boss_arrive Stage 7's boss' entrance: stops in its place, poses and sends the helpers to theirs.
022C5D  func  stage_7_boss_entrance_pose
comment stage_7_boss_entrance_pose Stage 7's boss' entrance: waits for its pose to end.
# 022C6D: 40 frames, then flags C0, state 1
022C6D  func  stage_7_boss_entrance_end
comment stage_7_boss_entrance_end Stage 7's boss' entrance: after 64 frames, starts fighting.
# 022C80 (state 1): 022DF2, 022E40, animation 1, 022E65, stage_7_boss_speeds_by_rank, 078617, 022E83
022C80  func  stage_7_boss_walk
comment stage_7_boss_walk Stage 7's boss walks toward its target at its speed by rank.
022CAA  func  stage_7_boss_attack
comment stage_7_boss_attack Stage 7's boss attacks (state 2), by its step.
# 022CB3: field 29, then "LDD #$6A00", animation 2, flag 04
022CB3  func  stage_7_boss_wind_up
comment stage_7_boss_wind_up Stage 7's boss attacks: after a wait, winds up (sound 6A00), not to be hurt meanwhile.
022CD1  func  stage_7_boss_strike
comment stage_7_boss_strike Stage 7's boss attacks: hits on the animation's marked frame.
022CF2  func  stage_7_boss_recover
comment stage_7_boss_recover Stage 7's boss attacks: after 16 frames, stands and picks its target again.
022CFE  func  stage_7_boss_charge
comment stage_7_boss_charge Stage 7's boss charges (state 3), by its step.
# 022D07: "LDD #$7600" every 64 frames; field 3F's A0 frames; the direction (32) turned 1 a frame toward the target
# (07861D), speed 40
022D07  func  stage_7_boss_charging
comment stage_7_boss_charging Stage 7's boss charges at its target, turning toward it a little each frame, with a sound every 64 frames, until its time runs out.
022D6D  func  stage_7_boss_charge_end
comment stage_7_boss_charge_end Stage 7's boss charges: after a short stop, stands and picks its target again.
022D79  func  stage_7_boss_jump_away
comment stage_7_boss_jump_away Stage 7's boss jumps away (state 4), by its step.
022D82  func  stage_7_boss_jump_rise
comment stage_7_boss_jump_rise Stage 7's boss jumps away: in the air until its animation ends.
022D95  func  stage_7_boss_jump_land
comment stage_7_boss_jump_land Stage 7's boss jumps away: lands.
022DAD  func  stage_7_boss_jump_end
comment stage_7_boss_jump_end Stage 7's boss jumps away: when the landing's animation ends, stands.
# 022DB6 (state 5, set by 023000): 078686
022DB6  func  stage_7_boss_idle
comment stage_7_boss_idle Stage 7's boss with no target (state 5): waits for a player.
# 022DD6 (state 6): "LDY #$2B,Y; LDA #$02,Y; LBPL $6FAC"; no scenario runs it
022DD6  func  stage_7_boss_wait_target_up
comment stage_7_boss_wait_target_up Stage 7's boss waits while its target is down, then stands (no scenario reaches it).
022DE0  func  stage_7_boss_check_hit
comment stage_7_boss_check_hit Stage 7's boss: when hit, takes the hit.
# 022DF2: facing the target and within 40 / 8: 0230B3; walking longer than stage_7_boss_charge_waits_by_players
# (field 3D): 0230FD (charge)
022DF2  func  stage_7_boss_approach
comment stage_7_boss_approach Stage 7's boss walking: at its target, decides how to attack; after walking too long without reaching it, charges (carry: it did either).
022E40  func  stage_7_boss_pick_target
comment stage_7_boss_pick_target Stage 7's boss: keeps its target a while, then takes the nearest player; with none present, goes idle.
022E65  func  stage_7_boss_aim
comment stage_7_boss_aim Stage 7's boss: the direction to the side of its target (field 2D) and to the target itself (2E).
022E83  func  stage_7_boss_face_target
comment stage_7_boss_face_target Stage 7's boss: turns to face its target.
022E9E  func  stage_7_boss_set_animation
comment stage_7_boss_set_animation Stage 7's boss: sets the given animation (stage_7_boss_animations).
022EAD  func  stage_7_boss_set_hit_box
comment stage_7_boss_set_hit_box Stage 7's boss: sets the given hit box (stage_7_boss_hit_boxes).
# 022ECD: x in the stage outside 08B0-0A0F: x speed 0
022ECD  func  stage_7_boss_keep_in_x
comment stage_7_boss_keep_in_x Stage 7's boss: stops it at the left and right edges of its area.
# 022F01: y outside 78-C8 from the top: y speed 0
022F01  func  stage_7_boss_keep_in_y
comment stage_7_boss_keep_in_y Stage 7's boss: stops it at the front and back edges of its area.
# 022F3A: field 3B counts to stage_7_boss_helper_attack_times_by_rank; then some helpers from a random one (by the
# players, less 1880) 022F91
022F3A  func  stage_7_boss_order_throws
comment stage_7_boss_order_throws Stage 7's boss: every so often by the rank, sends some of its idle helpers to throw.
# 022F91: helper A (33 + 2A) idle: child object 7AE9 (07862C), state 7
022F91  func  stage_7_boss_order_throw
comment stage_7_boss_order_throw Stage 7's boss: the given helper, if idle, gets its missile and starts throwing.
# 022FAC: animation 1, box 0, flag 40, not 04, state 1
022FAC  func  stage_7_boss_stand
comment stage_7_boss_stand Stage 7's boss stands and goes back to walking.
# 023000: state 5, animation 0A
023000  func  stage_7_boss_go_idle
comment stage_7_boss_go_idle Stage 7's boss has no target left: waits.
# 023016: like 02188B; a hit of kind 13 or the third: stage_7_boss_jump_away_chances_by_players (02312F) or knocked
# down
023016  func  stage_7_boss_take_hit
comment stage_7_boss_take_hit Stage 7's boss takes a hit: flashes; with no health left it is knocked down; on a heavy hit (or every third) it jumps away to the middle or is knocked down, else it flinches.

# its helpers (5280 list type 37): 7AF1 by field 02: 0 nothing, 1-6 a move, 7 a throw
02317A  file  bosses/stage_7_boss_helper    # the four helpers of stage 7's boss
# 02317A "RTS" (7AF1's entry 0)
02317A  func  stage_7_boss_helper_idle
comment stage_7_boss_helper_idle Stage 7's boss' helper waiting (state 0): does nothing.
# 02317B "LDU #$7B01; LDA #$28,X; JMP [A,U]"
02317B  func  stage_7_boss_helper_move
comment stage_7_boss_helper_move Stage 7's boss' helper moving (states 1 to 6), by its step.
# 023184: stage_7_boss_helper_speeds[state - 1]
023184  func  stage_7_boss_helper_start_move
comment stage_7_boss_helper_start_move Stage 7's boss' helper: starts its move at the state's speed.
# 02319C: field 29-2A adds the speed until stage_7_boss_helper_distances[state - 1]: state 0
02319C  func  stage_7_boss_helper_moving
comment stage_7_boss_helper_moving Stage 7's boss' helper: moves until it has gone the state's distance, then waits.
# 0231CC "LDU #$7B05" (state 7)
0231CC  func  stage_7_boss_helper_attack
comment stage_7_boss_helper_attack Stage 7's boss' helper throwing (state 7), by its step.
# 0231D5: "LDD #$6000", animation - 3
0231D5  func  stage_7_boss_helper_throw_start
comment stage_7_boss_helper_throw_start Stage 7's boss' helper: throws (sound 6000).
# 0231E9: the animation over: animation + 83, state 0
0231E9  func  stage_7_boss_helper_throw_end
comment stage_7_boss_helper_throw_end Stage 7's boss' helper: when the throw's animation ends, goes back to waiting.

# stage 7's boss' own fields
# 022E53 "LDA #$2A,X; BEQ; DEC #$2A,X" / 022E5C "LDA #$40; STA #$2A,X; STU #$2B,X": frames before it picks its target
# again
scoped object stage_7_boss 2A target_wait u8
# 022E65: 078671 "STA #$2D,X" (toward the side of its target), 07861D "STA #$2E,X" (toward the target); 022C97 "LDA
# #$2D,X" the walking direction, 022E83 "LDA #$2E,X; ADDA #$40" the facing
scoped object stage_7_boss 2D side_direction u8
scoped object stage_7_boss 2E direction u8
# 022BBB "STA #$2F,X" (its health at the start), 0230E4 "LDA #$2F,X; SUBA #$1B,X; CMPA #$14", 0230F5 "LDA #$1B,X; STA
# #$2F,X"
scoped object stage_7_boss 2F last_health u8
# 023054 "LDA #$30,X; CMPA #$02; BEQ" (the third hit), 02305B "INC #$30,X", 023074 "CLR #$30,X"
scoped object stage_7_boss 30 hits u8
# 02311F "STA #$32,X" (the charge's direction), 022D2E-022D43 "SUBA #$32,X" then "INC / DEC #$32,X", "LDA #$32,X; LDB
# #$40; LBSR $8617"
scoped object stage_7_boss 32 charge_direction u8
# 022B54-022B89 "LDY #$7AD9 ... LDA ,Y; STU A,X" (stage_7_boss_helper_starts' slots 35 37 33 39, the helpers put in
# that order), 022BD3 "LDU #$35,X", 022BDB "LDU #$37,X", 022BFC "LDU #$33,X", 022C04 "LDU #$39,X", 022F91 "ADDA
# #$33; LDX A,X"
scoped object stage_7_boss 33 helper_3 u16 object
scoped object stage_7_boss 35 helper_1 u16 object
scoped object stage_7_boss 37 helper_2 u16 object
scoped object stage_7_boss 39 helper_4 u16 object
# 022F44 "LDD #$3B,X; ADDD #$0001; STD #$3B,X", 022F57 "CMPD #$3B,X" (frames since the helpers last threw), 022F5D
# "STD #$3B,X"
scoped object stage_7_boss 3B throw_wait u16
# 022E3B "INCW #$3D,X" (frames walking without reaching the target), 022E33 "LDD #$3D,X; CMPD ,U", 023104 "STD
# #$3D,X"
scoped object stage_7_boss 3D walk_time u16
# 023127 "LDD #$00A0; STD #$3F,X", 022D18 "DECW #$3F,X; BEQ" (the charge's frames)
scoped object stage_7_boss 3F charge_time u16
# its helpers': 023192 "CLRD; STD #$29,X; STA #$2B,X", 0231A6-0231B9 "LDD #$2A,X; ADDD #$0F,X; STD #$2A,X ... LDD
# #$29,X; ABSD; CMPD ,Y" (the distance gone, 16.8: 29-2B)
scoped object stage_7_boss_helper 29 distance u16

# ============================================================================================== bank 12

# the bank's jump table (024000-024020, then game_texts_address at 6021): the scripted scenes the stages' steps run
# (each by 18E0 through its own stretch of the table at 7700, and the step waits while direct page 72 is set: 07B5A9
# "LDA #$01; STA <$72" ... "LDA <$72; BNE"): stage 1's end (024000, 07A5FB), stage 2's (024003, 07A876), stage 5's
# (024006, 07AD8F), after bonus 2 (024009, 07B039), stage 7's two (02400C, 07B14C; 02400F, 07B19B), stage 8's end
# (024012, 07B3DC), stage 6's dream wave (024015, 07AE1A), stage 8's start (024018, 07B228), stage 6's end (02401B,
# 07AEBE; 02401E, 07AEEE)
024000  file  scenes/stage_ends    # the bank's jump table, then the scripted scenes at the ends of stages 1, 2, 5 and 6 and after bonus 2
# 024000 -> 024024 "LDX #$7700; LDA $18E0; JMP [A,X]" (stage1 only)
024000  func  stage_1_end
comment stage_1_end Runs stage 1's closing scene by its state: the police car comes in (Downtown).
# 024003 -> 024148 "CLR <$6A; LDX #$770A" (stage2 only; scene 84 area 2)
024003  func  stage_2_end
comment stage_2_end Runs stage 2's closing scene by its state: the players jump off after the kind-9C character (who runs off at the stages' ends and is stage 8's first boss), then Krustyland's area 3.
# 024006 -> 02440F "LDX #$7726" (stage5 only; scene 89)
024006  func  stage_5_end
comment stage_5_end Runs stage 5's closing scene by its state, in the gorge.
# 024009 -> 024609 "LDX #$7740" (bonus2 and stage6; scene 8B area 2)
024009  func  post_bonus_2_scene
comment post_bonus_2_scene Runs the scene after bonus 2 by its state: the view pans up and the step goes on.
# 02400C -> 02472D: "LDX #$774A; LDA $18E0; JSR [A,X]" and "LDX #$7752; LDA $18E1; JMP [A,X]" (stage7)
02400C  func  stage_7_scene
comment stage_7_scene Runs stage 7's scripted scene: two tracks at once, by the scene's state and sub-state.
# 02400F -> 024924 "LDA #$80; LBSR $8653; LBCS", "LDX #$775A" (stage7; scene 8C)
02400F  func  stage_7_end
comment stage_7_end Runs stage 7's closing scene by its state: the family leaves Channel 6 aboard the kind-A4 object; after 128 frames a player's button skips it.
# 024012 -> 024DCA "LDX #$7780" (stage8; scene 8D)
024012  func  stage_8_end
comment stage_8_end Runs the scene after stage 8's last boss by its state: the family gets Maggie back.
# 024015 -> 025533: each line's x scroll 0196 + the wave (0254F4 with B = 40)
024015  func  dream_wave_draw
comment dream_wave_draw Draws the dream's wave once: each line of layer A's x scroll swung by a sine of 64.
# 024018 -> 024B2A "LDA #$80; LBSR $8653; LBCS", "LDX #$7766" (stage7, stage8; scene 8D area 0)
024018  func  stage_8_start
comment stage_8_start Runs stage 8's opening scene by its state: the family comes down into the power plant; after 128 frames a player's button skips it.
# 02401B -> 024567 "LDX #$7732" (stage6)
02401B  func  stage_6_end
comment stage_6_end Runs the first part of stage 6's closing scene by its state: a long palette effect.
# 02401E -> 0245BC "LDA #$60; LBSR $8653; LBCS", "LDX #$7738" (stage6; scene 89 area 1)
02401E  func  stage_6_wake
comment stage_6_wake Runs the second part of stage 6's closing scene by its state: back in the gorge, the dream's wave fades away; after 96 frames a player's button skips it.
# 02402E: "LDD #$0080; STD $18E7; INC $18E0"
02402E  func  stage_1_end_start
comment stage_1_end_start Stage 1's closing scene: sets a 128-frame wait.
# 02403A: after it "LDD #$9600; LBSR $8689", three 4D40 objects (kind 0F: animations 93, 92, A1) at E0 / 100 / below
# the floor (18E1, 18E3, 18E5), E0 frames
02403A  func  stage_1_end_put_police_car
comment stage_1_end_put_police_car Stage 1's closing scene: after the wait, the music (9600) and the police car with its two doors.
# 0240E3: "LDD #$9500; LBSR $8689", the three rising ("LDD #$0100; STD #$19,X"), 100 frames
0240E3  func  stage_1_end_move_police_car
comment stage_1_end_move_police_car Stage 1's closing scene: a sound (9500), and the police car and its doors start moving up the screen.
024113  func  stage_1_end_wait
comment stage_1_end_wait Stage 1's closing scene: waits 192 frames.
# 024125: every 16 frames while the car's height is at most B0 "LDD #$4A00"; the wait over: <$72> clear
024125  func  stage_1_end_car_sound
comment stage_1_end_car_sound Stage 1's closing scene: the car's sound (4A00) every 16 frames while it is low on the screen; when the time is up the scene is over.
# 024155: palette requests 01 0880 and 01 0E89, job 0, the scrolls (FFF0 / 0), 07868C, 07868F
024155  func  scene_clear
comment scene_clear A scripted scene: loads its colours and clears the screen, the objects and the sprites.
# 024188: when the jobs are done: "LDD #$9E00; LBSR $8689", scene 84 area 2, layer A drawn, placement 0D (kind 9C) far
# off (zoom 30), order 4
024188  func  stage_2_end_set_up
comment stage_2_end_set_up Stage 2's closing scene: the music (9E00), Krustyland's area 2 and the kind-9C character close up.
# 0241E2 "LDX #$771A; LDA $18E1; JMP [A,X]": 0241EC, 02424B
0241E2  func  stage_end_jump_away
comment stage_end_jump_away A stage's closing scene: the players jump off after the kind-9C character, by the sub-state.
# 0241EC: each player in the stage (<$85>): object_12_placements[player] close up (zoom 30: a smaller
# zoom draws larger), its order among them (30)
# and its wait (stage_end_exit_waits); B0 frames (140 in scene 6)
0241EC  func  stage_end_put_jumpers
comment stage_end_put_jumpers A stage's closing scene: puts each player who played the stage close up, each with a wait by its order.
# 02424B: the 4D40 list's objects by their type ("LDU #$771E; LDA #$01,X; ASLA; JSR [A,U]"); time up: 078698,
# 07868C
02424B  func  stage_end_run_jumpers
comment stage_end_run_jumpers A stage's closing scene: runs the jumping objects until the time is up, then clears them.
# 02427E (type 0): field 31's wait; then a voice ("ADDD #$3F28", not for order 4), stage_end_exit_speeds by order,
# type 1
02427E  func  stage_end_jumper_wait
comment stage_end_jumper_wait A stage's closing scene: a jumper waits its turn, then jumps with a shout.
# 0242D0 (type 1): zoom + 2 a frame (smaller); past FF: animation 98 + player (8E for order 4), zoom 40, field 33 + 1
# (scene 6: type 2); x speed down 8 a frame, height speed up 16 (to FFF0)
0242D0  func  stage_end_jumper_fly
comment stage_end_jumper_fly A stage's closing scene: a jumper flies off into the distance, shrinking; at the smallest it shows again at normal size with its next animation.
# 0242AC (type 2, only in stage 5's: 0242F9 "LDA <$67; CMPA #$06; BNE; INC #$01,X"): field 33 set and zoom 80 or
# more: "LDD #$4E00", animation 9C, zoom 40, type 3
0242AC  func  stage_end_jumper_last_leg
comment stage_end_jumper_last_leg A stage's closing scene (stage 5's): on its second leg, once small enough, a jumper plays a sound (4E00) and its last animation.
# 024329 (type 3): "LDA #$06,X; ANDA #$01; BEQ; CLR ,X"
024329  func  stage_end_jumper_vanish
comment stage_end_jumper_vanish A stage's closing scene: a jumper is gone when its animation ends.
# 024333: area 3, layer A drawn
024333  func  stage_2_end_show_area_3
comment stage_2_end_show_area_3 Stage 2's closing scene: draws Krustyland's area 3.
# 024363: object_12_placements[4 + player] for each player in the stage, a voice each ("ADDD #$3F28"), 80 frames
024363  func  stage_2_end_put_players
comment stage_2_end_put_players Stage 2's closing scene: puts the players, each with its voice.
# 02439E: layer A's y scroll + 10 a frame, the players' x speed +-80 by 64 frames; time up: step 9 clears, else
# palette request 04 1EE0, 100 frames
02439E  func  stage_2_end_players_look_around
comment stage_2_end_players_look_around Stage 2's closing scene: the view rises while the players wander from side to side; then the colours fade (in stage 5's step the objects are cleared instead).
# 024409: <$72> clear, 07868C (no scenario reaches it)
024409  func  scene_end
comment scene_end A scripted scene: is over, and the objects are cleared.
# 02441C: "LDD #$7E00", "LDD #$9A00", palette requests 02 0010 / 0011 (their records in 18E4 / 18E6), scene 89 area 1,
# both layers, object_12_placements 8
02441C  func  stage_5_end_set_up
comment stage_5_end_set_up Stage 5's closing scene: its sounds (7E00, 9A00), two palette effects, the gorge's area 1 and a kind-10 object (object_12_placements 8).
# 02448F: the two palette effects off ("CLR [$18E4]"), then 024497
02448F  func  stage_5_end_show_players
comment stage_5_end_show_players Stage 5's closing scene: stops its palette effects and shows the players (no scenario reaches it).
# 024497: palette requests 02 0012 / 0013, area 3, scrolls, layers; absent players' areas blanked (0253C9 B 0),
# object_12_placements[9 + player] for the others; 40 frames
024497  func  stage_end_show_players
comment stage_end_show_players A stage's closing scene: two palette effects, the gorge's area 3 and the players who played, the absent players' places blanked.
# 024532: the effects off, palette request 04 1EE0, E0 frames
024532  func  stage_5_end_fade
comment stage_5_end_fade Stage 5's closing scene: stops the palette effects and fades the colours.
# 024557: <$72> clear, 07868C, 07868F
024557  func  stage_5_end_finish
comment stage_5_end_finish Stage 5's closing scene: after the fade, it is over and the objects and sprites are cleared.
# 024571: "LDA #$80; STA $18E2"
024571  func  stage_6_end_start
comment stage_6_end_start Stage 6's closing scene: sets a 128-frame wait.
# 02457C: palette request 05 0EFF (into 18E4), "LDD #$AB00", 200 frames
02457C  func  stage_6_end_effect
comment stage_6_end_effect Stage 6's closing scene: after the wait, a palette effect and a sound (AB00) for 512 frames.
# 0245A3: the effect off, 18E0-18FF cleared, <$72> clear
0245A3  func  stage_6_end_finish
comment stage_6_end_finish Stage 6's closing scene, first part: stops the effect and is over.
# 0245D1: scene 89 area 1, layer modes, then 024155
0245D1  func  stage_6_wake_set_up
comment stage_6_wake_set_up Stage 6's closing scene, second part: back to the gorge's area 1, the screen cleared.
# 0245E1: when the jobs are done, 024497
0245E1  func  stage_6_wake_show_players
comment stage_6_wake_show_players Stage 6's closing scene: once the screen is clear, shows the players in the gorge.
0245E8  func  stage_6_wake_start
comment stage_6_wake_start Stage 6's closing scene: sets 192 frames for the wave.
# 0245F4: 02546C; time up: <$72> clear; a delay loop ("LDX #$2000; LEAX -1,X; BNE")
0245F4  func  stage_6_wake_wave
comment stage_6_wake_wave Stage 6's closing scene: runs the dream's wave for 192 frames, then it is over.
# 024616: palette request 01 0E8C, job 0, layer scrolls (BE 10, CE FFF0, C5 0120, D5 0), 07868C, 07868F
024616  func  post_bonus_2_scene_set_up
comment post_bonus_2_scene_set_up The scene after bonus 2: its colours and the layers' places, the screen cleared.
# 024648: "LDD #$A000; LBSR $8689", object_12_placements 13 (kind A4), scene 8B area 2, absent players blanked (B 1),
# 80 frames
024648  func  post_bonus_2_scene_show
comment post_bonus_2_scene_show The scene after bonus 2: the music (A000), bonus 2's area 2 with the kind-A4 object, the absent players' places blanked.
# 0246C3: then <$CA> = 0, <$9D>, <$A9>, <$99> = 1
0246C3  func  post_bonus_2_scene_wait
comment post_bonus_2_scene_wait The scene after bonus 2: waits 128 frames and lets the layers move.
# 0246DF: layer A's y scroll - 80 a frame, layer B's + 40, 4D40's y speed FF80; until layer B's reaches 20
0246DF  func  post_bonus_2_scene_pan
comment post_bonus_2_scene_pan The scene after bonus 2: the two layers part as the view moves, the kind-A4 object going with it.
024723  func  post_bonus_2_scene_finish
comment post_bonus_2_scene_finish The scene after bonus 2: after 96 frames, it is over.

# stage 7's scripted scenes (scene 8C, Channel 6)
024741  file  scenes/stage_7_scenes    # stage 7's two scripted scenes
# 024741 (02400C's first state): 0785FF, object_12_placements 14-17 (kind A4) at their stage places (08CF - <$AC>)
024741  func  stage_7_scene_set_up
comment stage_7_scene_set_up Stage 7's scene: puts the four kind-A4 objects at their places in the stage.
# 024779: <$AC> at 09B0 or more: "LDD #$7A00"
024779  func  stage_7_scene_wait_scroll
comment stage_7_scene_wait_scroll Stage 7's scene: waits for the scroll to reach them, then a sound (7A00).
# 02478C: <$AC> at 0A4F (nothing calls it)
02478C  func  unused_stage_7_scene_wait_far
comment unused_stage_7_scene_wait_far Unused: would wait for the scroll to reach 0A4F.
# 024799: <$81> set: 18E2 = FFFF
024799  func  stage_7_scene_wait_signal
comment stage_7_scene_wait_signal Stage 7's scene: waits for the stage's signal to go on.
# 0247AA: layer B's y scroll and the 4D40 list's height speed by a growing speed (18EB + 2); 4E16 at 8F: 4E5B = 1; a
# row of blank tiles (10) at 3000 by the scroll
0247AA  func  stage_7_scene_lift
comment stage_7_scene_lift Stage 7's scene: the view and the objects rise faster and faster, a row of tiles blanked as it goes; when the time is up, the scene's variables are cleared and it is over.
# 02482F: <$82> set: "INC $18E1"
02482F  func  stage_7_scene_wait_train
comment stage_7_scene_wait_train Stage 7's scene, second track: waits for its signal from the stage.
# 024839: 6 pairs of placement A / 29 linked (fields 28, 2A), "LDD #$8300"
024839  func  stage_7_scene_put_chain
comment stage_7_scene_put_chain Stage 7's scene, second track: puts a chain of six linked pairs of objects and plays a sound (8300).
# 02488C: the chain moves at 0200 until its end reaches 09E8, one more pair each 60
02488C  func  stage_7_scene_move_chain
comment stage_7_scene_move_chain Stage 7's scene, second track: moves the chain along until it is in place, then stops it.
0248F4  func  stage_7_scene_chain_done
comment stage_7_scene_chain_done Stage 7's scene, second track: clears its signal.
# 0248F8: 025388, type F4, at 0808 - <$AC> + 40, y 90 + <$B2>
0248F8  func  stage_7_scene_put_link
comment stage_7_scene_put_link Stage 7's scene: puts the given record of object_12_placements as a link of the chain at the chain's start.
# 024918: 07867D list 0, else list 1
024918  func  stage_7_scene_new_object
comment stage_7_scene_new_object Stage 7's scene: takes a free object from the first list, or else the second.
# 024939: job 0, sounds 0000 and 7A00, palette request 01 0C8C, scrolls, 07868C, 07868F
024939  func  stage_7_end_set_up
comment stage_7_end_set_up Stage 7's closing scene: stops the sound, loads its colours and clears the screen.
# 02496D: scene 8C area 1, layer B, palette request 03 7A53
02496D  func  stage_7_end_show
comment stage_7_end_show Stage 7's closing scene: Channel 6's area 1 with its colours.
# 0249B6: object_12_placements 18 (kind A4) moving right (0200), placements 19 + player for the players in the stage
0249B6  func  stage_7_end_board
comment stage_7_end_board Stage 7's closing scene: puts the kind-A4 object moving off and the players who played aboard it.
# 024A0B: past E0, rising, its zoom + 1 every 4 frames (smaller); 024AEB; after F0 frames object_12_placements 1D and
# 1E + player crossing back (x speed FF80), zoom C0 (small)
024A0B  func  stage_7_end_take_off
comment stage_7_end_take_off Stage 7's closing scene: the kind-A4 object flies up into the distance with the players aboard, then crosses back far off, small.
# 024AB0 / 024AD3: 4D40's height speed down; past 130 (or the time) 07868C, <$72> clear
024AB0  func  stage_7_end_slow_down
comment stage_7_end_slow_down Stage 7's closing scene: the kind-A4 object slows down until it is in place (no scenario reaches it).
024AD3  func  stage_7_end_finish
comment stage_7_end_finish Stage 7's closing scene: after its time, it is over and the objects are cleared.
# 024AEB: the 4D40 list zoomed; 024B01: 4DA0-4EA0 take 4D40's speeds and zoom
024AEB  func  stage_7_end_zoom_riders
comment stage_7_end_zoom_riders Stage 7's closing scene: the kind-A4 object and its riders drawn zoomed, the riders moving with it.
024B01  func  stage_7_end_move_riders
comment stage_7_end_move_riders Stage 7's closing scene: the riders take the kind-A4 object's speeds and size.

# stage 8's scripted scenes (scene 8D, the power plant)
024B3F  file  scenes/stage_8_scenes    # stage 8's opening and the scene after its last boss
# 024B3F: job 0, sound 0000, palette request 01 0E91, layer B's y 0100, <$AA>, <$9D>
024B3F  func  stage_8_start_set_up
comment stage_8_start_set_up Stage 8's opening: stops the sound, loads its colours and clears the screen.
# 024B7E: scene 8D area 0, both layers, object_12_placements 2E-32 (kind A4 x 4, kind 13), 2A + player for each
# player in the stage (field 28 a delay), "LDD #$9600", 18EB 0400
024B7E  func  stage_8_start_show
comment stage_8_start_show Stage 8's opening: the power plant's area 0, the kind-A4 objects, the kind-13 object and the players who played, then the music (9600).
# 024C30: layer B's y scroll down by 18EB (less 9 a frame); at 20: 5400 becomes kind 9C animation 83 jumping (0300,
# 0200), 80 frames
024C30  func  stage_8_start_descend
comment stage_8_start_descend Stage 8's opening: the view goes down, slowing, the players with it; at the bottom one of the kind-A4 objects turns into the kind-9C character and jumps out.
# 024CA6: the 5460 objects' height speed 0, 024D26
024CA6  func  stage_8_start_stop
comment stage_8_start_stop Stage 8's opening: the descent is over.
# 024CC2: 5400 lands (0785B1 and 38): animation 81, "LDD #$6000", 5580 off
024CC2  func  stage_8_start_landing
comment stage_8_start_landing Stage 8's opening: the kind-9C character lands (sound 6000) and runs.
# 024CED: 5400 past 150: off, 80 frames
024CED  func  stage_8_start_run_off
comment stage_8_start_run_off Stage 8's opening: the kind-9C character runs off the screen.
# 024D08: "DECW $18E2; BNE $6D26" (024D26 while it waits)
024D08  func  stage_8_start_wait_end
comment stage_8_start_wait_end Stage 8's opening: runs the players for the last 128 frames, then ends the scene (no scenario reaches its end here).
# 024D0E: 18E0-18FF cleared ("LDX #$18E0 ... BMOVE"), "LDD #$0000; LBSR $8680", 07868C, "CLR <$72"; also 024B2F
# "LBCS $6D0E" (the scene skipped)
024D0E  func  stage_8_start_finish
comment stage_8_start_finish Stage 8's opening is over: the scene's variables, the sound and the objects cleared.
# 024D26: the 5280 list's objects in use, "LDU #$7774; LDA #$02,X; ASLA; JSR [A,U]"
024D26  func  stage_8_start_run_players
comment stage_8_start_run_players Stage 8's opening: runs the players' objects by their state.
# 024D43 (0): height down to BF with the view; animation 97
024D43  func  stage_8_start_player_ride
comment stage_8_start_player_ride Stage 8's opening: a player comes down with the view.
# 024D61 (1): gravity; landed: animation D4, a voice ("ADDD #$3F24" by its kind)
024D61  func  stage_8_start_player_drop
comment stage_8_start_player_drop Stage 8's opening: a player drops to the floor and says something.
# 024D83 (2): "LDA #$07,X; CMPA #$03" (its animation's frame): animation DF, 60 frames
024D83  func  stage_8_start_player_look
comment stage_8_start_player_look Stage 8's opening: a player looks around.
024D98  func  stage_8_start_player_turn
comment stage_8_start_player_turn Stage 8's opening: a player turns after 96 frames.
# 024DA6 (4): animation done: animation 81, x speed 0300
024DA6  func  stage_8_start_player_run
comment stage_8_start_player_run Stage 8's opening: a player runs off to the right (no scenario reaches it).
# 024DBF (5): past 150: off
024DBF  func  stage_8_start_player_gone
comment stage_8_start_player_gone Stage 8's opening: a player past the right edge is gone (no scenario reaches it).
# 024DD7: job 0, sound 0000, 3C00-3DFF cleared, palette request 01 0E8F, scrolls
024DD7  func  stage_8_end_set_up
comment stage_8_end_set_up The scene after stage 8's last boss: stops the sound, clears the tiles, loads its colours and clears the screen.
# 024E10: scene 8D area 2, object_12_placements 23 (kind 13), "LDD #$9600", 30 frames
024E10  func  stage_8_end_show
comment stage_8_end_show The scene after stage 8's last boss: the power plant's area 2 with the kind-13 object and the music (9600).
# 024E6B: "LDA $4D46; ORA #$40" (its animation held), 30 then 60 frames
024E6B  func  stage_8_end_hold
comment stage_8_end_hold The scene after stage 8's last boss: holds the kind-13 object's picture.
# 024E87: layer B at x 0120, drawn, 07868C, 0785FF, 60 frames
024E87  func  stage_8_end_switch_view
comment stage_8_end_switch_view The scene after stage 8's last boss: moves layer B and clears the objects.
# 024EBD: layer B back at FFF0, object_12_placements 24, 25, 26 (kind 13), 100 frames
024EBD  func  stage_8_end_show_kind_13
comment stage_8_end_show_kind_13 The scene after stage 8's last boss: back to the scene, the kind-13 objects in it.
# 024F15: the view back where the fight ended (18F8 / 18FA), palette requests 01 0880, 01 0F8E, scene 8D area 1; one
# player of the stage at random (18FC); each player's object in the 5280 list (type F4) by state 0-2, two kind C9 and
# a CA when all four played; Maggie (5520: kind 11 animation 86) and 5580 (kind D3, mr_burns, animation 83) at the
# place in 18F4 / 18F6; 1C0 frames
024F15  func  stage_8_end_reunion
comment stage_8_end_reunion The scene after stage 8's last boss: back where the fight ended, Maggie, Mr. Burns and the family: one player who played picked at random to get Maggie, the others walking in.
# 0251C9: the 5280 list (7) by field 02 ("LDU #$7790"); time up: 0785C3 then 0252DC: palette request 01 0E8F, scene
# 8D area 3, object_12_placements 27, palette request 02 0039, "LDD #$8B00", 140 frames
0251C9  func  stage_8_end_run_family
comment stage_8_end_run_family The scene after stage 8's last boss: runs each actor by its state; when the time is up, moves to the power plant's area 3 with its music (8B00).
0251F5  func  stage_8_end_actor_rest
comment stage_8_end_actor_rest The scene after stage 8's last boss: an actor that does nothing.
# 0251F6 (1) "LDU #$779A; LDA #$28,X; JMP [A,U]": 0251FF, 025208, 02521C, 025244
0251F6  func  stage_8_end_walker
comment stage_8_end_walker The scene after stage 8's last boss: a player walking in, by its step.
0251FF  func  stage_8_end_actor_start
comment stage_8_end_actor_start The scene after stage 8's last boss: an actor's 32-frame wait.
# 025208: x speed 0300, animation 81
025208  func  stage_8_end_walker_go
comment stage_8_end_walker_go The scene after stage 8's last boss: after the wait, the player runs in.
# 02521C: near Maggie (x + 2B - 18F4 below 20): a voice ("ADDD #$3F08" by field 2D), stops, animation 9E
02521C  func  stage_8_end_walker_arrive
comment stage_8_end_walker_arrive The scene after stage 8's last boss: the player stops by Maggie with a shout.
025244  func  stage_8_end_actor_done
comment stage_8_end_actor_done The scene after stage 8's last boss: an actor that has finished.
# 025245 (3) "LDU #$77A2": 0251FF, 02524E, 02525D, 025244
025245  func  stage_8_end_extra
comment stage_8_end_extra The scene after stage 8's last boss: an extra character walking in, by its step.
# 02524E: x speed 0200
02524E  func  stage_8_end_extra_go
comment stage_8_end_extra_go The scene after stage 8's last boss: after the wait, the extra walks in.
# 02525D: there: stops, its animation - 1
02525D  func  stage_8_end_extra_arrive
comment stage_8_end_extra_arrive The scene after stage 8's last boss: the extra stops by Maggie.
# 02527F (4) "LDU #$77AA": 0251FF, 025288 (x speed 0100), 02525D, 025244
02527F  func  stage_8_end_slow_extra
comment stage_8_end_slow_extra The scene after stage 8's last boss: the slow extra walking in, by its step.
025288  func  stage_8_end_slow_extra_go
comment stage_8_end_slow_extra_go The scene after stage 8's last boss: after the wait, the slow extra walks in.
# 025297 (2) "LDU #$77B2": 0252A0, 0252A9, 0252B9, 0252DB
025297  func  stage_8_end_maggie_taker
comment stage_8_end_maggie_taker The scene after stage 8's last boss: the player picked to get Maggie, by its step.
0252A0  func  stage_8_end_taker_wait
comment stage_8_end_taker_wait The scene after stage 8's last boss: the picked player waits 128 frames.
# 0252A9: animation AE
0252A9  func  stage_8_end_take_maggie
comment stage_8_end_take_maggie The scene after stage 8's last boss: the picked player takes Maggie.
# 0252B9: the animation done: all four played ("LDA <$85; CMPA #$0F"): "LDD #$3F09", "LDD #$3F0A"; Maggie (5520) off
0252B9  func  stage_8_end_holding_maggie
comment stage_8_end_holding_maggie The scene after stage 8's last boss: Maggie is in the player's arms (with two voices when all four played).
0252DB  func  stage_8_end_taker_done
comment stage_8_end_taker_done The scene after stage 8's last boss: the picked player has finished.
# 025349: 140 frames (025373: "LDD #$4500" every 32 frames); then 07868C, <$72> clear
025349  func  stage_8_end_finish
comment stage_8_end_finish The scene after stage 8's last boss: waits in area 3, then it is over.
025361  func  unused_stage_8_end_blink
comment unused_stage_8_end_blink Unused: would blink an object by the frame and play a sound (4500) every 32 frames.

# shared by the scripted scenes
025388  file  scenes/scene_objects    # the scripted scenes' placements and the blanked places of absent players
# 025388: object_12_placements[A] (FFFF: X's object; kind, animation, x, height; FFFF keeps the old)
025388  func  scene_put_placement
comment scene_put_placement A scripted scene: puts the given record of object_12_placements and hands back its object.
# 0253C9: absent_player_blanks[B]: a block of one tile at player A's place
0253C9  func  blank_absent_player
comment blank_absent_player A scripted scene: covers a player's place with blank tiles (the given record of absent_player_blanks).

# the dream's wave: layer A's line scroll (1A00, one word a line) swung by a sine (stage 6)
02541D  file  video/dream_wave    # the dream's wave over layer A's line scroll (stage 6's start and end)
# 02541D: "LDD #$9601; LDU #$0100; LDX #$1A00; BSETW" (every line at 0196)
02541D  func  dream_wave_straighten
comment dream_wave_straighten The dream's wave: sets every line's x scroll back to straight.
# 025428 / 025446 / 025464: 7996 by 18EC (025413, unreached from the scenarios)
025428  func  dream_wave_start
comment dream_wave_start The dream's wave: straight lines, line scroll on, the wave's size 0 (no scenario reaches it).
025446  func  dream_wave_grow
comment dream_wave_grow The dream's wave: draws it growing 8 a frame up to C0 (no scenario reaches it).
025464  func  dream_wave_keep
comment dream_wave_keep The dream's wave: draws it at its size (no scenario reaches it).
# 02546C "LDU #$799C; LDA $18EC; ASLA; JMP [A,U]": 025476, 025491, 0254A3, 0254BE
02546C  func  dream_wave_fade_out
comment dream_wave_fade_out The dream's wave going away, by its step: full, held, shrinking, done.
# 025476: size C0, line scroll on (1C80 = 3), 40 frames
025476  func  dream_wave_start_full
comment dream_wave_start_full The dream's wave: starts it at full size, line scroll on.
025491  func  dream_wave_hold
comment dream_wave_hold The dream's wave: draws it at full size for 64 frames.
# 0254A3: size - 2 a frame; at 0 line scroll off
0254A3  func  dream_wave_shrink
comment dream_wave_shrink The dream's wave: draws it 2 smaller each frame; at nothing, line scroll off.
0254BE  func  dream_wave_done
comment dream_wave_done The dream's wave: gone (nothing more to do).
# 0254BF: each line "ADDD #$0196", 0254F4 with the line + phase (18EB, 2 less a frame)
0254BF  func  dream_wave_draw_lines
comment dream_wave_draw_lines The dream's wave: sets each line's x scroll to straight plus the sine of its line and the phase, of the given size; the wave moves 2 a frame.
# 0254F4: wave_cosines by the angle (A, a quarter by bit 6), times B, the sign by bit 7
0254F4  func  wave_sine
comment wave_sine The sine of an angle (256 to a turn) times a size (wave_cosines).

# ============================================================================================== work RAM
# (the other variables these banks use, 4850 4857 4858 4872 4875 4876 487C 487D 487E 4885 4897 48AC 48B2 48BE 48C5
# 48CE 48D5, are named in fixed_3d.txt / fixed_3e.txt / banks_13_14.txt; see the report)

# 040C40 sets it (at most 1F: symbols' rank_base, rank_by_players...), the tables "by_rank" read it halved: 021582 "LDB
# <$61; LSRB; LDB B,Y" (wrestler_speeds_by_rank), 022C9D (stage_7_boss_speeds_by_rank), 022F50 "LDA <$61; ANDA #$FE"
4861  var  rank  u8
# the bonuses' timer in BCD: 020116 / 020B1D "LDA #$10; STA <$7A" (10 seconds), 02064A "LDA <$7B; ... ADDA #$99; DAA"
# twice a frame, then "LDA <$7A; ADDA #$99; DAA; STA <$7A; LDA #$98; STA <$7B" on each second (only bank 10's code
# uses them)
487A  var  bonus_seconds  u8
487B  var  bonus_frames  u8

# the K052109's RAM the scripted scenes keep their state in (not work RAM: these would be io lines, see the report):
# 18E0 the scene's state (every scene's "LDA $18E0; ASLA; JMP [A,X]": 024024, 0227AE, 020016, 07B5B6's scenes), 18E1
# its sub-state (020107 "LDA $18E1", 0241E2, 02472D)
18E0  io  scene_state  u8
18E1  io  scene_substate  u8

# ============================================================================================== renamed locals
# symbols.txt's local lines on functions named here (the same lines with the new function names):
local wrestler_set_hit_box 02177B u box hit_box
local name_entry_rank_players 02231D x score_addresses score_address
local name_entry_set_up 0220EF y suffix place_suffix
local high_scores_print_entries 0226EB y icons high_score_icon
local ending_put_placement 022A2A u place placement
local stage_7_boss_set_hit_box 022EB3 u box hit_box
local stage_7_boss_put_in 022B5C y start helper_start
local stage_7_boss_helper_moving 0231A4 y distance helper_distance
local stage_end_jumper_wait 02429C u speed exit_speed
local scene_put_placement 025396 u place placement
local wave_sine 025501 u cosines wave_cosine

# ======== banks 13-14 ========
# ======== names for banks 13 and 14 (026000-029FFF): proposal for symbols.txt ========
# Places are offsets of the program region; quotes are the listing's (build\listing\simpsons.s) instructions, by place.
# "ran" / "never ran": build\decompile\index.txt's count of instructions the 25 scenarios run.
#
# Who is who (evidence used below):
# - Bank 13's jump table: 026000 list 0 type 05 (07CB3C, the krusty balloon, stage 2's boss: kind 9D, SET_NAMES
#   krusty_balloon); 026003 list 1 type 31 and list 2 type 10 (what the balloon throws: 0269E0 puts one in list 1 with
#   type 31, 0269F4 "LDA #$31", else list 2 with type 10, 0269F0 "LDA #$10"); 026006 the steps' starts (07A563,
#   07A7A2 ... 07B219: substep 0 of each stage's step): the title cards; 026009 every playing step's frame (07A4F4,
#   07A5FB ...): the screen shake and the scrolling; 02602A steps 1 and 7's starts (07A427, 07AA3E); 02602D step 1
#   (07A4F4: runs it until it clears direct page 72, then "INC <$03"): story 1, the opening; 026030 list 1 type ED and
#   026033 list 2 type 1F: the door stage 3's boss comes out of (below).
# - Bank 14: the goons (kinds 80 goon, 84 goon_with_hat, 82 goon_with_umbrella, 83 goon_with_shovel, B6), by their
#   type in list 0 (07CB6C "LDU #$F387" banks, 07CB7E "LDU #$F2EC" handlers), and the enemy actions (field 28) whose
#   bank byte (action_banks, 07F620) is 14. Each type's handler: "LDU #table; ASLB; JSR [B,U]" by its state (field 02),
#   then 0785B7 (off the screen) and 078596 (the hit reaction); states 2-5 are the fixed program's enemy states
#   (0785DB choose, 0785DE run the action, 0785E1 hurt, 0785E4), state 0 the type's set-up and state 1 its entrance (by
#   field 29). Each action's handler: "LDU #table; ASLB; JMP [B,U]" by field 29, B from 07D64F "LDD #$28,X".
# - Which actions a goon picks: its behaviour (field 2A, enemy_behaviour: 4 ranges of 12 bytes from 28, by the x
#   distance in field 2D: the 2F limit, the 2D range, a chance, 4 actions and their weights; 07D3D7, 07D5C0-07D5EA).
#   Bank 14's behaviours: 029808 (type 03: close 02/0F, mid 00/01, far 18/03/04), 029860 (types 0C, 34, F4, EE: close
#   02,
#   mid 03, far 18/27/04: no grab), 0298B8 (type EB: close 02/0F, mid 00/18, far 01/18/04), 029910 (type E7: close
#   00/02, mid 03/3D, far 27), 029CDF (type 3B: close 00/02, mid 03/04, far 04/1B/27), 029D37 (goon_with_hat: 00 02 01
#   04 06), 029D8F (goon_with_umbrella: 16 11 13 12), 029DE7 (goon_with_shovel: 33 14 15).
# - Kind 9C is Smithers': the set of stage 8's first boss (type F6, 03A2AA "LDA #$9C; STA #$04,X"), and in story 1 it
#   runs in, stops by the family and runs off with two goons (027689 below). Its set also holds a crash (animation 8A
#   with sound 6F00: 02933A, 0277B8).

# ======== files ========
026000  file  bosses/krusty_balloon    # the krusty balloon (stage 2's boss) and what it throws
026006  file  stages/title_cards    # the stages' title cards
026009  file  stages/scroll    # the camera, the stages' scrolling and the screen shake
02602A  file  stages/title_cards    # (the colour cycles' entry for the steps without a title card)
02602D  file  scenes/story_1    # story 1: the opening
026030  file  objects/boss_door    # the door stage 3's boss comes out of
026049  file  stages/scroll    # (the camera, the stages' scrolling and the screen shake)
026532  file  bosses/krusty_balloon    # (the krusty balloon's states)
026E2F  file  stages/title_cards    # (the title cards' steps)
02724D  file  scenes/story_1    # (story 1's parts and characters)
027805  file  objects/boss_door    # (the door's states)
027968  file  stages/scroll    # (stage 6's and stage 7's scrolling)

48AE  var  camera_x_fraction  u8
48B4  var  camera_y_fraction  u8
# the players' push on the camera: bank 1C's player puts its x speed in (039928 "LDX #$0F,U; STX <$E4") and adds its y
# speed (0399BB "LDD #$14,U; ADDD <$E6; STD <$E6"); 026237 adds them to the move and clears them (0262DC-0262E0)
48E4  var  players_push_x  s16
48E6  var  players_push_y  s16
# frames the camera has not been pushed on: counted in the records' "next entry at x" checks (026325 "INCW <$65"),
# cleared
# while the players push right (026249 "LDD <$E4; BEQ; BMI; CLRD; STD <$65"); the rank compares it (040CC6 "LDD <$65")
4865  var  camera_wait_frames  u16
# the substep of the special scrolls: the cemetery's (02604D "LDX #$792A; LDA <$AB"), stage 5's (02615E "LDX #$7936"),
# stage 7's (0279E9 "LDX #$79F2"); stage 6 counts its frames in it (0279CD "INCA; STA <$AB")
48AB  var  stage_scroll_step  u8
48BA  var  cemetery_scroll_fraction  u8
# its speed, up to 0090 (026079-026084), down to 0 (0260A5-0260B9); the cemetery's goons coming in ride it as their z
# speed (029454 "LDD <$E2; STD #$19,X", 0294F4, 02953F)
48E2  var  cemetery_scroll_speed  u16
# the step of stage_3_part_2_layer_offsets the cemetery's scroll is at (026126 "LDA <$8E; ASLA; ASLA", 026134 "INC
# <$8E")
488E  var  cemetery_layer_offset_step  u8
# the screen shake: set by an object to start one (0261C4 "LDA <$97; ASLA; JMP [A,X]"; 02658C "LDA #$01; STA <$97", the
# krusty balloon landing, 02150E the wrestler's), its kind (screen_shake_lengths: 0261CE "LDA <$98", 026222 "LDB <$98"),
# the step (0261E1 "LDA <$96; ANDA #$07", 026219 "INC <$96") and the frame toggle (0261D4 "LDA <$95; CMPA #$01")
4897  var  screen_shake_on  u8
4898  var  screen_shake_kind  u8
4896  var  screen_shake_step  u8
4895  var  screen_shake_frame  u8
# the title card's step (026E45 "LDX #$7D5A; LDA <$77; ASLA; JMP [A,X]", 026E88 "INC <$77")
4877  var  title_card_step  u8

# ======== bank 13: the krusty balloon (list 0 type 05, kind 9D) ========
# 026000 "LBRA $6509": 026514 "LDU #$7C64; LDA #$02,X; ASLA; JSR [A,U]" by its state (field 02, -3 to 5), then 02651D,
# 026520 and the gauge (026523 "LDU #$7CB2" ... 02652E "LBSR $86BF")
026000  func  krusty_balloon
comment krusty_balloon The krusty balloon, stage 2's boss: checks its hits (krusty_balloon_check_hit), runs its state (field 02: -3 beaten, -2 knocked up, -1 flinching, 0 coming in, 1 chasing, 2 attacking, 3 throwing, 4 stomping, 5 waiting for a target), keeps itself inside the arena and draws its 5-piece health gauge.
# state FD (026B55 "LDA #$FD; STA #$02,X"): 026532 "LDU #$7C70; LDA #$28,X; ASLA; JSR [A,U]", then 0265AC "LDD #$0400;
# STD #$0F,X" (negated past x D0)
026532  func  krusty_balloon_beaten
comment krusty_balloon_beaten Beaten (state -3): runs its step (field 28) while it drifts toward the middle of the screen at 4 pixels a frame.
# 02653D "LDA #$0A,X; CMPA #$20; BCS", 026544 "DEC #$0A,X; DEC #$0B,X"
02653D  func  krusty_balloon_deflate
comment krusty_balloon_deflate Beaten, step 0: shrinks a step a frame (its zoom, fields 0A-0B) down to 20, then waits 20 frames.
# 026554 "DEC #$29,X", 026559 "LDA #$01; STA $184B"
026554  func  krusty_balloon_beaten_wait
comment krusty_balloon_beaten_wait Beaten, step 1: after its wait sets 184B and goes on.
# 026563 "LDA $184E; BEQ", 026569 "LDA <$50; STA <$85"
026563  func  krusty_balloon_wait_for_players
comment krusty_balloon_wait_for_players Beaten, step 2: waits until every player stands idle, then keeps the players present (direct page 50) in direct page 85 and goes on.
# 026573 "LBSR $85B1; BCC", 026580 "LDD #$0000; LBSR $8680" (the music stops), 026586 "LDD #$6C00", 02658C "STA <$97",
# 026594 "STX $1852", 02659C "STA <$7D", 02659F "INC <$04"
026573  func  krusty_balloon_fall_and_land
comment krusty_balloon_fall_and_land Beaten, step 3: falls with gravity; landing, stops the music, plays sound 6C00, shakes the screen, keeps itself in 1852 and ends the stage step's substep (the stage is cleared).
# state FE (026BF1-026C10: thrown up with z speed 0300 and x speed +-0600): 0265BE "LDU #$7C78; LDA #$28,X; JMP [A,U]"
0265BE  func  krusty_balloon_knocked_up
comment krusty_balloon_knocked_up Knocked up (state -2): runs its step (field 28).
# 0265C7 "LDD #$16,X; CMPD #$0080; BLT", 0265D6 "LDU #$7CAE ... CMPB A,U; LBLS $6B55", 0265E8-0265FA bounces off x 0040
# and 017F
0265C7  func  krusty_balloon_fly_up
comment krusty_balloon_fly_up Knocked up, step 0: bounces off the screen's sides until it is 80 high; there it stops and is beaten when its health is at krusty_balloon_beaten_health_by_players or below, else goes on.
# 0265FE "LBRA $6CAA"
0265FE  func  krusty_balloon_knocked_up_stomp
comment krusty_balloon_knocked_up_stomp Knocked up, step 1: drops onto its target (krusty_balloon_stomp).
# state FF (026BD3 "LDA #$FF; STA #$02,X"): 026601 "LBSR $6A74; LBCS $6B33"
026601  func  krusty_balloon_flinch
comment krusty_balloon_flinch Flinching (state -1): wobbles through its four squash steps, then goes back to chasing.
# state 0: 026608 "LDU #$7C7C; LDA #$28,X; JMP [A,U]"
026608  func  krusty_balloon_come_in
comment krusty_balloon_come_in Coming in (state 0): runs its step (field 28).
# 026616 "LDA <$92; BNE", 02661B "LDA #$98; STA #$00,X", 02662D "LDD #$00C0; STD #$0C,X", 026642 "LDD #$0100; STD
# #$19,X",
# 026648 "LDA #$60; STA #$0A,X", 02665F "LDA #$A0; STA #$1B,X; STA #$2F,X", 02666A-026688 palette effects 18, 19, 1A,
# 02668B "INC <$7C"
026611  func  krusty_balloon_appear
comment krusty_balloon_appear Coming in, step 0: once direct page 92 is clear, appears below the floor at x C0 rising, zoomed to 60, with health A0, starts palette effects 18-1A and sets direct page 7C.
# 026692 "DEC #$29,X", 026697 "LDD #$7900; LBSR $8689", 02669D "LDD #$FF80; STD #$14,X"
026692  func  krusty_balloon_rise
comment krusty_balloon_rise Coming in, step 1: rises for 80 frames, then plays sound 7900 and starts drifting back (y speed FF80) for C0 frames.
# 0266B3 "DEC #$29,X", 0266B8 "LDA <$16; ANDA #$03", 0266BF "LDA #$0A,X; SUBA #$01"
0266B3  func  krusty_balloon_drift_away
comment krusty_balloon_drift_away Coming in, step 2: shrinks a step every 4 frames as it goes back; then comes forward (y speed 0080) for 50 frames.
# 0266DA ... 0266E6 "LDA #$0A,X; ADDA #$01", 0266F2 "LDA #$40; STA #$0A,X"
0266DA  func  krusty_balloon_drift_back
comment krusty_balloon_drift_back Coming in, step 3: grows a step every 4 frames as it comes forward; then stops at zoom 40.
# 026702 "LBSR $85B1; BCC", 026707 "LDD #$6500", 02670F "STA <$97", 026714 "ORA #$48", 02671A "LBSR $6978"
026702  func  krusty_balloon_land
comment krusty_balloon_land Coming in, step 4: falls with gravity; landing, plays sound 6500, shakes the screen and takes its body's hit box.
# 026721 "ANDA #$BF; STA ,X", 026727 "LBRA $6AF7"
026721  func  krusty_balloon_bounce_up
comment krusty_balloon_bounce_up Coming in, step 5: bounces up off the floor (krusty_balloon_rebound), and from there chases.
# state 1: 02672A "LBSR $693A; BCS", 02672F "LBSR $69B9", 02673E "LBSR $699B", 026741 "LDA #$2D,X", 026744 "LDY #$7D18;
# LDB
# <$61; LSRB; LDB B,Y", 02674D "LBSR $8617"
02672A  func  krusty_balloon_chase
comment krusty_balloon_chase Chasing (state 1): attacks when over its target, else keeps its target, faces it and flies toward it at the speed the game's rank gives.
# state 2: 026751 "LDU #$7C88; LDA #$28,X; JMP [A,U]"
026751  func  krusty_balloon_attack
comment krusty_balloon_attack Attacking (state 2): runs its step (field 28).
# 02675A "LDA #$29,X; BNE", 02675F "LDA #$02; LBSR $6969", 026764 "ORA #$04"
02675A  func  krusty_balloon_attack_start
comment krusty_balloon_attack_start Attacking, step 0: after its wait shows animation 2 and can not be hurt (flags bit 2).
# 026772 "LDU #$38,X" (the object 026C1C put in), 02677C "LDB #$06,X; ANDB #$02" (the animation's event), 026783 "ORA
# #$40; STA ,U", 02678D "LDA #$04; LBSR $6978" (on U), 02679C "BITB #$01" (its end), 0267A4 "LDA #$20; STA #$29,X"
026772  func  krusty_balloon_attack_hit
comment krusty_balloon_attack_hit Attacking, step 1: at the animation's event gives its attack object (field 38, list 0 type 04, which has no handler) hit box 4; at its end takes back its body's hit box and waits 20 frames.
# 0267AD "DEC #$29,X", 0267B2 "CLR [#$38,X]", 0267B9 "LBSR $6B33", 0267BC "LBSR $69B9"
0267AD  func  krusty_balloon_attack_end
comment krusty_balloon_attack_end Attacking, step 2: after its wait removes the attack object and goes back to chasing.
# state 3 (026C9D "LDA #$03; STA #$02,X", from the hit reaction): 0267C0 "LDU #$7C8E; LDA #$28,X; JMP [A,U]"
0267C0  func  krusty_balloon_volley
comment krusty_balloon_volley Throwing (state 3): runs its step (field 28).
# 0267CC "LDD #$0C,X; SUBD #$00E0; ABSD; CMPD #$0010", 0267DC "LDD #$0100; ADDD <$B2; CMPD #$11,X", 0267EB "CMPD
# #$0038",
# 0267F7 "CMPA #$60; BHI; INCA", 02681B "LDD #$7900; LBSR $8680", 026829 "CLR #$31,X", 02682C "LDA #$04; STA #$29,X"
0267C9  func  krusty_balloon_volley_take_position
comment krusty_balloon_volley_take_position Throwing, step 0: flies to x E0, y 100 below the camera, 38 high, growing to zoom 60; there plays sound 7900 and readies its throws.
# 026838 "DEC #$29,X", 02683D "INC #$31,X; CMPA #$0C", 026847 "LDA #$32,X; LBSR $69E0", 02684F "LDA #$04; ADDA #$32,X;
# LBSR $6969", 026863 "LDA <$58; ANDA #$07; ADDA #$04; STA #$29,X"
026838  func  krusty_balloon_volley_throw
comment krusty_balloon_volley_throw Throwing, step 1: every 4 to 11 frames throws a shot, right, at random and left in turn (field 32), with that throw's animation; after 12 throws, or when there is no room for a shot, goes on.
# 02687B "DEC #$29,X", 026880 "LDA #$40; STA #$29,X", 026885 "INC #$36,X"
02687B  func  krusty_balloon_volley_pause
comment krusty_balloon_volley_pause Throwing, step 2: after a frame waits 40 more and counts the volley in field 36.
# 02688C "DEC #$29,X; BNE; INC #$28,X"
02688C  func  krusty_balloon_volley_wait
comment krusty_balloon_volley_wait Throwing, step 3: waits.
# 026895 "LDA #$0A,X; DECA; CMPA #$40; BHI", 02689D "LDD #$00FF; SUBD <$B2; STD #$11,X", 0268AE "LBRA $6CAA"
026895  func  krusty_balloon_volley_shrink
comment krusty_balloon_volley_shrink Throwing, step 4: shrinks a step a frame back to zoom 40, then drops onto its target.
# state 4 (026CC6 "LDA #$04; STA #$02,X"): 0268B8 "LDU #$7C98; LDA #$28,X; JMP [A,U]"
0268B8  func  krusty_balloon_stomping
comment krusty_balloon_stomping Stomping (state 4): runs its step (field 28).
# 0268C1 "LBSR $85B1; BCC", 0268C6 "LDD #$6500", 0268D5 "STA <$97", 0268E6 "LDD #$11,X; CMPD #$0090; BGE"
0268C1  func  krusty_balloon_stomp_land
comment krusty_balloon_stomp_land Stomping, step 0: falls with gravity, not above y 90; landing, plays sound 6500, shakes the screen and takes its body's hit box.
# 0268F5 "LBRA $6AF7"
0268F5  func  krusty_balloon_stomp_bounce
comment krusty_balloon_stomp_bounce Stomping, step 1: bounces up off the floor (krusty_balloon_rebound), and from there chases.
# state 5 (026CED "LDA #$05; STA #$02,X"): 0268F8 "LDU #$2B,X; LDA #$00,U; BEQ", 026900 "LDA #$02,U; BMI", 026905 "LDA
# #$33,X; CMPA #$04", 02690C "STA #$02,X; LDA #$34,X; STA #$28,X", 026916 "LBSR $6B33; LBRA $69B9"
0268F8  func  krusty_balloon_wait_for_target
comment krusty_balloon_wait_for_target Without a target (state 5): while its target is in play and not down, waits; else goes back to the stomp it was in (fields 33-34) or to chasing.
# 02691C "LDA #$00,X; BITA #$20" (hit), 026923 "LDB #$1E,X; BEQ; BMI", 02692F "CLR [#$38,X]", 026936 "LBSR $6B79"
02691C  func  krusty_balloon_check_hit
comment krusty_balloon_check_hit Hit by a player's strike (flags bit 5 and a hit kind in field 1E): removes its attack object and reacts (krusty_balloon_hit).
# 02693A "LDU #$2B,X", 026948 "LDD #$11,X; SUBD #$11,U; BMI; CMPD #$0010", 026955 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD
# #$0040", 026961 "CMPD #$0010; LBGE $6C1C"
02693A  func  krusty_balloon_check_over_target
comment krusty_balloon_check_over_target Starts an attack when its target is just in front of it (up to 10 in y) and 10 to 40 away in x; without a target in play waits for one.
# 026969 "LDU #$7CB6; ASLA; LDD A,U; ORB #$80; STD #$04,X"
026969  func  krusty_balloon_set_animation
comment krusty_balloon_set_animation Starts animation A of krusty_balloon_animations (its kind and animation) on X's object.
# 026978 "LDU #$7CD0; ASLA; ASLA; ASLA; LEAU A,U", 026982-026996 into fields 1C-23
026978  func  krusty_balloon_set_hit_box
comment krusty_balloon_set_hit_box Gives X's object hit box A of krusty_balloon_hit_boxes.
# 02699B "LDU #$2B,X", 0269A1 "CMPD #$0C,U" (B C0 or 40), 0269AC "LBSR $8671; STA #$2D,X", 0269B2 "LBSR $861D; STA
# #$2E,X"
02699B  func  krusty_balloon_aim
comment krusty_balloon_aim Takes the direction toward its target into fields 2D and 2E.
# 0269B9 "LBSR $8686; LBCC $6CD8", 0269BF "LDY #$2B,X", 0269CC "LDA #$2A,X; BEQ; DEC #$2A,X", 0269D6 "LDA #$40; STA
# #$2A,X;
# STU #$2B,X"
0269B9  func  krusty_balloon_keep_target
comment krusty_balloon_keep_target Keeps its target (field 2B) for 40 frames, then takes the one the search gives; without one in play waits for one.
# 0269E0 "LDB #$01; LBSR $867D" (list 1, type 31) else "LDB #$02" (list 2, type 10), 0269F9 "LDA #$C8; STA #$00,U",
# 0269FE-
# 026A0D its place, 026A10 "STX #$29,U", 026A1C "LDA #$08; LBSR $6969", 026A21 "LDA #$02; LBSR $6978", 026A2C "LDD
# #$0280; STD #$19,U", 026A32 "LDY #$7C9C; ASLA; JSR [A,Y]", 026A3A "LDD #$2600; LBSR $8689"
0269E0  func  krusty_balloon_throw
comment krusty_balloon_throw Throws a shot (list 1 type 31, or list 2 type 10 when list 1 is full) from its place, rising, with animation 8 and hit box 2, sideways by A (0 right, 1 at random, 2 left), and plays sound 2600; carry set when there was no room.
# 026A45 "LDD #$0280; STD #$0F,U"
026A45  func  krusty_balloon_throw_right
comment krusty_balloon_throw_right The shot's x speed 0280 plus a random part and its y speed (krusty_balloon_throw_spread).
# 026A4D "LDD #$FD80; STD #$0F,U"
026A4D  func  krusty_balloon_throw_left
comment krusty_balloon_throw_left The shot's x speed -0280 plus a random part and its y speed (krusty_balloon_throw_spread).
# 026A55 "LDB <$58; SEX; ROLB; ASLA; ADDD #$0F,U", 026A61 "LDY #$7D28; LDB <$58; ANDB #$07; ASLB; LDD B,Y", 026A6F
# "NEGD;
# STD #$14,U"
026A55  func  krusty_balloon_throw_spread
comment krusty_balloon_throw_spread Adds a random part to the shot's x speed and gives it a random y speed toward the back (field 14, from krusty_balloon_throw_z_speeds).
# 026A74 "LDU #$7CA2; LDA #$35,X; ASLA; JSR [A,U]", 026A7F "CMPA #$04; BNE; CLR #$35,X; COMA"
026A74  func  krusty_balloon_wobble
comment krusty_balloon_wobble Runs its squash step (field 35); carry set once the four steps are done.
# 026A8F "CMPA #$60; BCC", 026A96 "ADDA #$04; STA #$0A,X"
026A8F  func  krusty_balloon_wobble_widen
comment krusty_balloon_wobble_widen Squash step 0: widens (field 0A) by 4 a frame up to 60.
# 026AA3 "CMPA #$40; BLS", 026AAA "SUBA #$04; STA #$0A,X"
026AA3  func  krusty_balloon_wobble_narrow
comment krusty_balloon_wobble_narrow Squash step 1: narrows back by 4 a frame to 40.
# 026AB7 "CMPA #$20; BLS", 026ABE "SUBA #$04; STA #$0A,X", 026AC6 "ADDA #$04; STA #$0B,X"
026AB7  func  krusty_balloon_wobble_stretch
comment krusty_balloon_wobble_stretch Squash step 2: narrows to 20 while it grows taller (field 0B).
# 026AD3 "CMPA #$40; BCC", 026ADA-026AE7 the other way, 026AEB "LDA #$40; STA #$0A,X; STA #$0B,X"
026AD3  func  krusty_balloon_wobble_restore
comment krusty_balloon_wobble_restore Squash step 3: back to zoom 40 both ways.
# 026AF7 "LDU #$7CAA; LDA #$35,X; JMP [A,U]"; 026B00 "ANDA #$BB", 026B06 "CLRA; LBSR $6978", 026B0A "LDD #$0080; STD
# #$19,X"
026B00  func  krusty_balloon_rebound
comment krusty_balloon_rebound Rebound step 0: can be hurt again, takes its body's hit box and rises.
# 026B14 "LDD #$16,X; CMPD #$0020; BLT", 026B1C "CLRD; STD #$19,X", 026B2C "LBSR $69B9; LBRA $6B33"
026B14  func  krusty_balloon_rebound_end
comment krusty_balloon_rebound_end Rebound step 1: at 20 high stops, keeps its target and goes back to chasing.
# 026B33 "LDA #$01; LBSR $6969", 026B38 "CLRA; LBSR $6978", 026B3F "ORA #$40; ANDA #$FB", 026B46 "LDA #$01; STA #$02,X"
026B33  func  krusty_balloon_start_chase
comment krusty_balloon_start_chase Back to chasing (state 1) with animation 1 and its body's hit box.
# 026B79 "LDU #$25,X; LDA #$01; STA #$2A,U; STX #$49,U", 026B84 "LDD #$6501", 026B92 "LDA #$07; LBSR $6969", 026B9B
# "LDU #$7CAE ... BLS $6BF1", 026BA9 "LDA #$02; STA <$7E; LDD #$000D; LBSR $8677", 026BB4 "LDA #$1E,X; CMPA #$13",
# 026BBB "INC #$30,X; LDU #$7D00", 026BDF "LDY #$7D08 ... CMPA <$58; LBCC $6C7C"
026B79  func  krusty_balloon_hit
comment krusty_balloon_hit Its reaction to a strike: tells the striker (fields 2A, 49), plays sound 6501 and animation 7; at low health it is knocked up, else it flashes (palette effect 0D) and flinches until it has taken krusty_balloon_hit_limits_by_players hits (or one of kind 13), then flies off to throw (by krusty_balloon_fly_off_chances_by_rank) or is knocked up.
# 026CAA "ORA #$4C", 026CB0 "LDA #$05; LBSR $6978", 026CB5 "LBSR $8686; LBSR $861D; LDB #$C0; LBSR $8617", 026CC0 "LDD
# #$FC00; STD #$19,X", 026CC6 "LDA #$04; STA #$02,X"
026CAA  func  krusty_balloon_stomp
comment krusty_balloon_stomp Drops onto its target (state 4): can not be hurt, hit box 5, flies toward the target falling fast with animation 1.
# 026CD8 "LDA #$02,X; STA #$33,X; LDA #$28,X; STA #$34,X", 026CEB "LDA #$05; STA #$02,X"
026CD8  func  krusty_balloon_lose_target
comment krusty_balloon_lose_target Keeps its state and step (fields 33-34), stops and waits for a target (state 5).
# 026D01 "LDD #$0D,X; ADDD #$0F,X" ... 026D14 "ADDD <$AD", 026D26 "CMPD #$076F; BLE", 026D2B "CMPD #$08E0; BLT", 026D30
# "CLRD;
# STD #$0F,X"
026D01  func  krusty_balloon_keep_in_arena_x
comment krusty_balloon_keep_in_arena_x Stops its x speed when its next place in the stage would leave 076F-08E0.
# 026D35 "LDA #$02,X; BEQ; CMPA #$03; BEQ", 026D51 "SUBD <$B3", 026D63 "CMPD #$0060; BLE", 026D68 "CMPD #$0100; BLT",
# 026D6D "CLRD; STD #$14,X"
026D35  func  krusty_balloon_keep_in_arena_y
comment krusty_balloon_keep_in_arena_y Out of states 0 and 3, stops its y speed when its next place from the camera's would leave 0060-0100.

# ---- what the krusty balloon throws (list 1 type 31, list 2 type 10) ----
# 026003 "LBRA $6D72": 026D72 "LDA #$00,X; ANDA #$20; BEQ" (hit) ... 026D83 "LBSR $6D8F", 026D86 "LDU #$7D3A; LDA
# #$02,X;
# ASLA; JMP [A,U]" (states -1 to 3: 7D38 6DA8, 7D3A 6DB8 6DD3 6DFA 6E16)
026003  func  krusty_balloon_shot
comment krusty_balloon_shot What the krusty balloon throws: when hit stops and bursts; runs its state (field 02: -1 burst, 0 flying, 1 drifting, 2 opening, 3 falling).
# 026D8F "LDD #$6F00; LBSR $8680", 026D95 "LDA #$0B; LDB #$02,X; CMPB #$03; BCS; INCA", 026D9F "LBSR $6969", 026DA2 "LDA
# #$FF; STA #$02,X"
026D8F  func  krusty_balloon_shot_burst
comment krusty_balloon_shot_burst Bursts: plays sound 6F00 and the burst's animation (hit sparks, or krusty_balloon_animations' entry 12 once it has fallen), state -1.
# 026DA8 "ANDA #$BF; STA ,X", 026DAE "LDA #$06,X; ANDA #$01; BEQ; CLR ,X"
026DA8  func  krusty_balloon_shot_vanish
comment krusty_balloon_shot_vanish Burst (state -1): gone at its animation's end.
# 026DB8 "LDA #$06,X; ANDA #$01; BEQ", 026DBF "LDA #$09; LBSR $6969", 026DCB "LDA #$20; STA #$28,X", 026DD0 "INC #$02,X"
026DB8  func  krusty_balloon_shot_fly
comment krusty_balloon_shot_fly Flying (state 0): at its animation's end stops, shows animation 9 and drifts for 20 frames.
# 026DD3 "LDD #$0080; STD #$0F,X; PUSHS X; PULLS D; ADDB <$16; ANDB #$20; BNE; NEGW #$0F,X", 026DE7 "LDD #$FFC0; STD
# #$19,X", 026DED "DEC #$28,X", 026DF2 "BSR $6D8F; LDA #$02; STA #$02,X"
026DD3  func  krusty_balloon_shot_drift
comment krusty_balloon_shot_drift Drifting (state 1): sways sideways every 32 frames as it sinks; after its time bursts open (state 2).
# 026DFA "LDA #$06,X; ANDA #$01; BEQ", 026E08 "LDA #$03; LBSR $6978", 026E0D "LDA #$0A; LBSR $6969", 026E12 "INC #$02,X"
026DFA  func  krusty_balloon_shot_open
comment krusty_balloon_shot_open Opening (state 2): at the burst's end stops, takes hit box 3 and animation 0A, and falls.
# 026E16 "LBSR $85B1; LBCS $6D8F"
026E16  func  krusty_balloon_shot_fall
comment krusty_balloon_shot_fall Falling (state 3): falls with gravity and bursts on landing.

# ======== bank 13: the stages' title cards ========
# 026006 "LBRA $6E1D": 026E1D "CLR <$6A", 026E20 "LDA <$11; LBNE $7190" (no card in the attract's demo), 026E26 "LDX
# #$7D42;
# LDA <$67; ASLA; JMP [A,X]" by the scene (7D42: scenes 0 1 3 5 6 8 9 B a card, 2 4 7 A none)
026006  func  stage_title_card
comment stage_title_card A stage step's first substep: the title card of the scene's stage, or none for the stories' scenes, the cemetery and the attract's demo.
# 02602A "LBRA $7200", from steps 1's and 7's starts (07A427, 07AA3E), which have no title card
02602A  func  stage_start_colour_cycles
comment stage_start_colour_cycles The bank's entry for the steps without a title card: starts the players' colour cycles.
# 026E2F "LBRA $7190": 027190 "LBSR $7200; CLR <$05; INC <$04"
026E2F  func  title_card_none
comment title_card_none No title card: starts the players' colour cycles and ends the substep.
# 026E32 "INC <$05; CMPA #$C0; LBEQ $716F", 026E3D "LDA #$40; LBSR $8653; LBCS $716F" (after 40 frames a player's attack
# or
# jump), 026E45 "LDX #$7D5A; LDA <$77; ASLA; JMP [A,X]" (7D5A 6E4E 6E8C 6EE4)
026E32  func  stage_1_title_card
comment stage_1_title_card Stage 1's title card for C0 frames, or until a player presses a button after 40: runs its step (title_card_step).
# 026E4E "LDD #$5400; LBSR $8680; BRA $6E76"
026E4E  func  stage_1_title_sound
comment stage_1_title_sound Stage 1's card, step 0: queues sound 5400 and readies the screen.
# 026E56 "LDD #$5800" (7D86, stage 8's card)
026E56  func  stage_8_title_sound
comment stage_8_title_sound Stage 8's card, step 0: queues sound 5800 and readies the screen.
# 026E5E "LDD #$5700" (7D7E, stage 7's card)
026E5E  func  stage_7_title_sound
comment stage_7_title_sound Stage 7's card, step 0: queues sound 5700 and readies the screen.
# 026E66 "LDD #$5600" (from 027014, stage 5's card)
026E66  func  stage_5_title_sound
comment stage_5_title_sound Queues sound 5600 (stage 5's card) and readies the screen.
# 026E6E "LDD #$3003" (7D78, stage 6's card)
026E6E  func  stage_6_title_sound
comment stage_6_title_sound Stage 6's card, step 0: queues sound 3003 and readies the screen.
# 026E76 "LDD #$FFF0; LBSR $86C2" (both layers' and the camera's x), 026E7C "LDD #$0000; LBSR $86C5" (their y), 026E82
# "LDD
# #$0001; LBSR $8656" (a job of the 4940 queue, counted in direct page 5D), 026E88 "INC <$77"
026E76  func  title_card_ready_screen
comment title_card_ready_screen Puts the layers and the camera at x FFF0, y 0, queues job 1 (counted in direct page 5D, which the next step waits for) and goes on.
# 026E8C "LDA <$5D; BNE", 026E91 "LBSR $71F5; LBSR $71CF", 026E97 "LDU #$7D8C; CLRA; LBSR $85A5" ("STAGE 1 / DOWNTOWN
# SPRINGFIELD"), 026E9E "CLRA; LBSR $719A", 026EA2 "LDD #$FE00; STD #$0F,Y", 026EA8 "LDA #$09; LBSR $719A"
026E8C  func  stage_1_title_show
comment stage_1_title_show Stage 1's card, step 1: once the screen job is done, sets up the card's screen, prints "STAGE 1 / DOWNTOWN SPRINGFIELD" and puts in its picture (sliding left) and the card's object of kind 0F (4DA0).
# 026EB4 "LDA $4D46; ANDA #$02; BEQ" (the picture's animation event), 026EBC "LDD #$5500; LBSR $8680"
026EB4  func  stage_3_title_picture_sound
comment stage_3_title_picture_sound Stage 3's card, step 2: queues sound 5500 at its picture's animation event, then counts the card's frames (title_card_count_frames).
# 026EC4 "LDD #$2C02"
026EC4  func  stage_4_title_picture_sound
comment stage_4_title_picture_sound Stage 4's card, step 2: queues sound 2C02 at its picture's animation event, then counts the card's frames (title_card_count_frames).
# 026ED4 "LDD #$0F00"
026ED4  func  stage_2_title_picture_sound
comment stage_2_title_picture_sound Stage 2's card, step 2: queues sound 0F00 at its picture's animation event, then counts the card's frames (title_card_count_frames).
# 026EE6 "LDA #$13; STA $1FB9; LDA #$2C; STA $1FBA" (the K053251), 026EF4 "LDX #$4DA0; LDA #$28,X; CMPA #$40", 026F04
# "INC
# #$28,X; ... ORA #$40; STA #$06,X", 026F14 "INC #$28,X; LDD #$0700; LBRA $8680"
026EE4  func  title_card_count_frames
comment title_card_count_frames The cards' last step: sets the layers' priorities and counts the frames in the 4DA0 object's field 28 in its field 28: past 40 sets its field 06 bit 6, at A0 queues sound 0700.
# 026F1E ... 026F31 "LDX #$7D60" (7D60 6E76 6F3A 6ED4)
026F1E  func  stage_2_title_card
comment stage_2_title_card Stage 2's title card for C0 frames, or until a player presses a button after 40: runs its step.
# 026F45 "LDU #$7DAD; CLRA; LBSR $85A5", 026F4C "LDA #$01; LBSR $719A"
026F3A  func  stage_2_title_show
comment stage_2_title_show Stage 2's card, step 1: sets up the card's screen, prints "STAGE 2 / KRUSTYLAND" and puts in its picture and the card's object of kind 0F (4DA0).
# 026F70 "LDX #$7D66" (7D66 6F79 6F83 6EB4)
026F5D  func  stage_3_title_card
comment stage_3_title_card Stage 3's title card for C0 frames, or until a player presses a button after 40: runs its step.
# 026F79 "LBSR $6E76; LDD #$0020; STD <$C5"
026F79  func  stage_3_title_ready_screen
comment stage_3_title_ready_screen Stage 3's card, step 0: readies the screen with layer A's y scroll at 20.
# 026F8E "LDA #$86; STA <$75; LDA #$01; STA <$76; LBSR $86B0", 026F9B "CLRA; LDB #$2C; LBSR $86AD", 026FA1 "LDU #$7DC4",
# 026FA8 "LDA #$02; LBSR $719A"
026F83  func  stage_3_title_show
comment stage_3_title_show Stage 3's card, step 1: sets up the card's screen over the forest's area 1 (scene 86) drawn on layer A, prints "STAGE 3 / SPRINGFIELD / DISCOUNT CEMETERY" and puts in its picture and the card's object of kind 0F (4DA0).
# 026FCC "LDX #$7D6C" (7D6C 6E76 6FD5 6EC4)
026FB9  func  stage_4_title_card
comment stage_4_title_card Stage 4's title card for C0 frames, or until a player presses a button after 40: runs its step.
# 026FE0 "LDU #$7DF0", 026FE7 "LDA #$03; LBSR $719A"
026FD5  func  stage_4_title_show
comment stage_4_title_show Stage 4's card, step 1: sets up the card's screen, prints "STAGE 4 / MOE'S TAVERN" and puts in its picture and the card's object of kind 0F (4DA0).
# 02700B "LDX #$7D72" (7D72 7014 701E 6EE4)
026FF8  func  stage_5_title_card
comment stage_5_title_card Stage 5's title card for C0 frames, or until a player presses a button after 40: runs its step.
# 027014 "LBSR $6E66; LDD #$0028; STD <$C5"
027014  func  stage_5_title_ready_screen
comment stage_5_title_ready_screen Stage 5's card, step 0: queues its sound and readies the screen with layer A's y scroll at 28.
# 027029 "LDA #$89; STA <$75; LDA #$02; STA <$76; LBSR $86B0", 027036 "LDA #$04; STA <$76", 02703B "CLRA; LDB #$2C; LBSR
# $86AD", 027041 "LDU #$7E09", 027048 "LDA #$04; LBSR $719A"
02701E  func  stage_5_title_show
comment stage_5_title_show Stage 5's card, step 1: sets up the card's screen over the gorge (scene 89, area 2's tiles, area 4 drawn on layer A), prints "STAGE 5 / SPRINGFIELD BUTTE" and puts in its picture and the card's object of kind 0F (4DA0).
# 02706C "LDX #$7D78" (7D78 6E6E 7075 6EE4)
027059  func  stage_6_title_card
comment stage_6_title_card Stage 6's title card for C0 frames, or until a player presses a button after 40: runs its step.
# 027080 "LDU #$7E27", 027087 "LDA #$05; LBSR $719A"
027075  func  stage_6_title_show
comment stage_6_title_show Stage 6's card, step 1: sets up the card's screen, prints "STAGE 6 / DREAMLAND" and puts in its picture and the card's object of kind 0F (4DA0).
# 0270AB "LDX #$7D7E" (7D7E 6E5E 70B4 70E9 6EE4)
027098  func  stage_7_title_card
comment stage_7_title_card Stage 7's title card for C0 frames, or until a player presses a button after 40: runs its step.
# 0270BA "LDU #$7E3D", 0270C1 "LDA #$06; LBSR $719A", 0270C6-0270D5 its y 0082, x speed FF00, z speed 0100, 0270E0 "LDA
# #$80;
# STA <$06"
0270B4  func  stage_7_title_show
comment stage_7_title_show Stage 7's card, step 1: sets up the card's screen, prints "STAGE 7 / CHANNEL 6" and puts in its first picture (sliding left and up) and the card's object of kind 0F (4DA0).
# 0270E9 "LDX #$4DA0 ... ORA #$40; STA #$06,X", 027104 "LDX #$4D40; LDD #$0C,X; CMPD #$00E0", 027113 "CMPD #$0046",
# 02711F
# "DEC <$06", 027124 "LDA #$07; LBSR $719A", 027132 "LBRA $6EE4"
0270E9  func  stage_7_title_second_picture
comment stage_7_title_second_picture Stage 7's card, step 2: stops its first picture at x E0 and 46 high; after 80 frames puts in the second picture.
# 027148 "LDX #$7D86" (7D86 6E56 7151 6EE4)
027135  func  stage_8_title_card
comment stage_8_title_card Stage 8's title card for C0 frames, or until a player presses a button after 40: runs its step.
# 027157 "LDU #$7E53", 02715E "LDA #$08; LBSR $719A"
027151  func  stage_8_title_show
comment stage_8_title_show Stage 8's card, step 1: sets up the card's screen, prints "STAGE 8 / SPRINGFIELD / NUCLEAR POWER PLANT" and puts in its picture and the card's object of kind 0F (4DA0).
# 02716F "LDD #$0000; LBSR $8680", 027175 "LDA #$01; STA <$7E; LDD #$0880; LBSR $8677", 027180 "LBSR $869B; LBSR $8695;
# LBSR
# $868C", 027189 "CLR <$05; INC <$04"
02716F  func  title_card_end
comment title_card_end The card's end: stops the sound, loads palette sets 0880, clears the screen's layers and all the objects, and ends the substep.
# 02719C "LDU #$7E81", 0271A0-0271A8 A x 8 (stage_title_placements), 0271AA "LDY ,U++; LDA #$80; STA #$00,Y",
# 0271B1-0271C5
# kind, animation, x, y 0080, z, 0271C8 "LDA #$20; STA #$09,Y"
02719A  func  title_card_put_picture
comment title_card_put_picture Puts in record A of stage_title_placements (0-8 a stage's picture at 4D40, kind C2 with the stage's animation; 9 an object of kind 0F, animation 1F, at 4DA0) and leaves its object in Y.
# 0271CF "LBSR $869B" (the fixed layer cleared), 0271D2 "LDA #$02; STA <$75; CLR <$76; LBSR $86B0", 0271DF-0271E7
# 1FB9/1FBA,
# 0271ED "LDA #$01; LDB #$2C; LBSR $86AD"
0271CF  func  title_card_set_up_screen
comment title_card_set_up_screen Clears the text layer, takes scene 2's area 0 (its tile banks) and draws it on layer B, with the card's layer priorities.
# 0271F5 "LDA #$01; STA <$7E; LDD #$0F0C; LBSR $8677", then into 027200
0271F5  func  title_card_load_palettes
comment title_card_load_palettes Loads palette sets 0F0C and starts the players' colour cycles.
# 027200-02722C: four palette requests of kind 2 (palette effects, 07BB1F), effects 07, 08, 09 and 0A: palette_effects'
# 05C233, 05C248, 05C25D, 05C272 cycle colour 5 of palettes 20, 21, 22, 23 (colours 040A, 042A, 044A, 046A: the sprites'
# palettes from 32, one a player) through 7FFF, 7C1F, 5C17, 380E
027200  func  start_player_colour_cycles
comment start_player_colour_cycles Starts palette effects 7-10, which cycle colour 5 of each player's sprite palette (32-35) through white and pinks.

# ======== bank 13: the scrolling, the camera and the screen shake ========
# 026009 "LBRA $6036": 026036 "CLRD; STD <$DE; STD <$E0", 02603D "LBSR $61C1", 026040 "LDX #$7908; LDA <$03; ASLA; JMP
# [A,X]"
# (7908: steps 2 4 6 8 15 026049, 7 02604D, 9 02615E, 11 027968, 13 0279E6, 1 02619A, the others 026199)
026009  func  stage_scroll
comment stage_scroll Each frame of a step: clears the camera's move, runs the screen shake and the step's scrolling (the camera for stages 1-4 and 8, the special scrolls of the cemetery and stages 5-7, story 1's).
# 026049 "LBSR $6237; RTS"
026049  func  stage_follow_camera
comment stage_follow_camera Stages 1, 2, 3's forest, 4 and 8: the camera follows the stage's record.
# 02604D "LDX #$792A; LDA <$AB; ASLA; JMP [A,X]" (792A: 6056 6071 6096 60A5 60F1 6110)
02604D  func  cemetery_scroll_update
comment cemetery_scroll_update Stage 3's cemetery (step 7): runs its scroll's step (stage_scroll_step).
# 026056 "LDA #$01; STA <$A9; STA <$9D; STA <$A6", 026061 "LDD #$5A00; LBSR $8680", 026067 "INC <$80; LBSR $86BC"
026056  func  cemetery_scroll_start
comment cemetery_scroll_start The cemetery's step 0: makes layer B the camera's main layer, queues sound 5A00 and the next part's music, and goes on.
# 026071 "LDA <$16; ANDA #$01; LBNE $6123", 026079 "LDD <$E2; ADDD #$0001; CMPD #$0090; BGE", 026090 "INC <$AB"
026071  func  cemetery_scroll_speed_up
comment cemetery_scroll_speed_up The cemetery's step 1: scrolls up, the speed growing every other frame up to 0090.
# 026096 "LBSR $6123", 026099 "LDD <$B8; CMPD #$04E0; BLE"
026096  func  cemetery_scroll_cruise
comment cemetery_scroll_cruise The cemetery's step 2: scrolls up until past 04E0.
# 0260A5 "LDD <$E2; SUBD #$0001", 0260B0 "LDD <$B8; CMPD #$0500; BLT", 0260B8-0260C2 speed 0, scroll 0500, 0260C5 "LDX
# #$4460" 6 rows (0260C8) of 9 cells (0260CD) set to 10 ("LDB #$10; STB ,X+", 40 apart: the floor map), 0260E7 "LDD
# #$5B00"
0260A5  func  cemetery_scroll_slow_down
comment cemetery_scroll_slow_down The cemetery's step 3: slows down; at 0500 stops there, lays 6 rows of 9 cells of floor in the floor map and queues sound 5B00.
# 0260F1 "LDA $1876; CMPA #$02; BHI", 0260F9 "CLRB; LBSR $867D; LDA #$3E; STA #$01,U", 026102 "LDB #$01; LBSR $867D; LDA
# #$ED"
0260F1  func  cemetery_put_in_boss
comment cemetery_put_in_boss The cemetery's step 4: once 2 enemies or fewer are left, puts in stage 3's boss (list 0 type 3E) and its door (list 1 type ED).
# 026110 "LBSR $6237", 026113 "LDD #$0130; STD <$C3; STD <$D3", 02611C "LDD #$FF00; STD <$CC"
026110  func  cemetery_follow_camera
comment cemetery_follow_camera The cemetery's step 5: the camera follows the stage's record, with both layers' x offset at 0130 and layer A's second y offset at FF00.
# 026123 "LDX #$7A5B; LDA <$8E; ASLA; ASLA; LEAX A,X", 02612D "LDD ,X++; CMPD <$C5; BGT", 02613A "LDD ,X; STD <$CA",
# 02613F
# "LDD <$B9; ADDD <$E2; STD <$C6; STD <$B9", 02614B-026153 "<$B8", 026156 "CLRD; STD <$E4; STD <$E6"
026123  func  cemetery_scroll_up
comment cemetery_scroll_up Moves the cemetery's scroll up by its speed into layer A's y scroll, with layer A's y offset by stage_3_part_2_layer_offsets; the players can not push the camera meanwhile.
# 02615E "LBSR $6237", 026161 "LDX #$7936; LDU #$7948; LDA <$AB; ASLA; ...; LEAU B,U; JMP [A,X]" (7936: 6172 x 8, 6185)
02615E  func  stage_5_scroll
comment stage_5_scroll Stage 5 (step 9): the camera follows the stage's record and, by stage_scroll_step, the stage moves on to its next part at each of 8 places.
# 026172 "LDD <$AC; CMPD ,U++; BLT", 026179 "INC <$AB; INC <$80", 02617F "LDD ,U; LBSR $8680" (7948: 0370 7F01, 03C5
# 7F02 ...
# 05A0 7F00)
026172  func  stage_5_next_part
comment stage_5_next_part When the camera's x reaches the part's place (0370, 03C5, 041A, 0470, 04B0, 0500, 0550, 05A0), moves to the stage's next part and queues its sound command (7F01-7F07, then 7F00).
# 026185 "RTS" (7936's last entry)
026185  func  stage_5_scroll_end
comment stage_5_scroll_end Stage 5 past its last part: nothing more.
# 026186 "LDD <$AC; CMPD #$0610; BLT", 02618E "INC <$AB; INC <$80; LBSR $86BC" (79F2's entry 0)
026186  func  stage_7_next_part
comment stage_7_next_part Stage 7, step 0: when the camera's x reaches 0610, moves to the stage's next part and its music.
# 026198 "RTS" (79F2's entry 1)
026198  func  stage_7_scroll_end
comment stage_7_scroll_end Stage 7 past its part: nothing more.
# 026199 "RTS" (7908's entries for the steps without scrolling)
026199  func  stage_scroll_none
comment stage_scroll_none Steps without scrolling (the bonus stages, the stories but the first, the ending).
# 02619A "LDD <$BF; ADDD <$DE; STD <$BF" ... 0261AD "LDD <$C6; ADDD <$E0; STD <$C6" ... (step 1 only)
02619A  func  story_1_scroll
comment story_1_scroll Story 1 (step 1): adds the camera's move to layer A's x and y scroll.
# 0261C1 "LDX #$79F6; LDA <$97; ASLA; JMP [A,X]" (79F6: 61CA, 61CB)
0261C1  func  screen_shake
comment screen_shake Runs the screen shake while one is on (screen_shake_on).
# 0261CA "RTS"
0261CA  func  screen_shake_none
comment screen_shake_none No screen shake.
# 0261CB "LDX #$79FA; LDA <$98; ASLA; JMP [A,X]" (79FA: 61D4 x 3)
0261CB  func  screen_shake_by_kind
comment screen_shake_by_kind Runs the screen shake of its kind (screen_shake_kind).
# 0261D4 "LDA <$95; CMPA #$01; BNE" (every other frame), 0261DE "LDX #$7A00; LDA <$96; ANDA #$07; ASLA; LEAX A,X",
# 0261E9-
# 026208 layers A's and B's x scroll, 02620B "LDB ,X; NEGB; SEX; ADDD <$86; STD <$86; STD $1FA0", 02621F "LDU #$7A10;
# LDB
# <$98; CMPA B,U", 026229-02622F "CLR <$96; CLR <$97; CLR <$98"
0261D4  func  screen_shake_advance
comment screen_shake_advance Every other frame moves both layers by the shake's next step (screen_shake_steps) and the sprites the other way, until the kind's length (screen_shake_lengths), then ends the shake.
# 026237 "LDA <$A7; BEQ; CLRD; STD <$E4", 026240 "<$A8", 026249 "<$65", 026257 "LDX <$A4; LDU #$02,X", 02625D-02626C the
# push into
# the move, 02626F "BSR $62E4; LBSR $63A3", 026274-026297 the camera moved, 02629A "LBSR $6413", 02629D-0262B1 "<$A9
# <$AA <$9C
# <$9D <$92", 0262B6 "LDA <$FE; BEQ; ... LEAX #$04,X; STX <$A4", 0262C4-0262D9 the move capped at 0300 with direct page
# 9C
# set and 99 clear
026237  func  camera_update
comment camera_update Moves the camera: takes the players' push into the move (unless held), applies the stage record entry's x and y limits, moves the camera and the layers, takes the entry's flags (direct page A9, AA, 9C, 9D, 92), moves to the next entry when a check says so, and caps the x move at 0300.
# 0262E4 "LDD <$DE; BMI", 0262E9 "LDY #$7A13; LDA ,U; ASLA; JSR [A,Y]" (forward), 0262F8 "LDY #$7A1D; LDA ,U; JSR [A,Y]"
# (backward); 7A13: 6304 6399 6325 6346 635E, 7A1D: 6378 6399 6377 6346 635E
0262E4  func  camera_check_x
comment camera_check_x Runs the entry's x check for the way the camera moves (its first record for right, its second for left).
# 026304 "LDD <$DE; ADDD <$AD ... ADCA <$AC", 026315 "CMPD #$01,U; BLT", 02631A "LDA #$02,U; CLRB; SUBD <$AD; STD <$DE"
026304  func  camera_stop_at_x
comment camera_stop_at_x Moving right: the move is cut so that the camera stops at the check's x.
# 026325 "LDA <$A7; BNE; INCW <$65", 02633E "CMPD ,X; BCS", 026342 "LBSR $64AB"
026325  func  camera_next_entry_at_x
comment camera_next_entry_at_x Moving right: counts the frames the camera waits (unless held) and moves to the record's next entry once the camera passes the entry's x.
# 026346 "BSR $6399", 026348 "LDD <$E0; LBMI $6409", 026351 "STD <$F0; LDA #$01,U; LBSR $64E1; STD <$DE"
026346  func  camera_x_follows_y_down
comment camera_x_follows_y_down The x move follows the y move going down, scaled by the check's ratio (the players' x push dropped).
# 026360 "LDD <$E0; LBPL $6409", 026369 "NEGD"
02635E  func  camera_x_follows_y_up
comment camera_x_follows_y_up The x move follows the y move going up, scaled by the check's ratio (the players' x push dropped).
# 026377 "RTS" (7A1D's entry 2)
026377  func  camera_x_free_left
comment camera_x_free_left Moving left: no check.
# 026389 "CMPD #$01,U; BGT", 02638E "LDA #$02,U; CLRB; SUBD <$AD; STD <$DE"
026378  func  camera_stop_at_x_left
comment camera_stop_at_x_left Moving left: the move is cut so that the camera stops at the check's x.
# 026399 "LDD <$DE; SUBD <$E4; STD <$DE"
026399  func  camera_drop_push_x
comment camera_drop_push_x Takes the players' x push back out of the x move: the camera does not move in x.
# 0263A3 "LDD <$E0; BMI", 0263A8 "LDY #$7A27" (down), 0263B7 "LDY #$7A2F" (up); 7A27: 63C3 63C6 6409 63E7, 7A2F: 63C4
# 63E8 6409 63E7
0263A3  func  camera_check_y
comment camera_check_y Runs the entry's y check for the way the camera moves (its first record for down, its second for up).
# 0263C3 "RTS"
0263C3  func  camera_y_free_down
comment camera_y_free_down Moving down: no check.
# 0263C4 "RTS"
0263C4  func  camera_y_free_up
comment camera_y_free_up Moving up: no check.
# 0263C6 "LDD <$E0; ADDD <$B3 ... ADCA <$B2", 0263D7 "CMPD #$01,U; BLT", 0263DC "LDA #$02,U; CLRB; SUBD <$B3; STD <$E0"
0263C6  func  camera_stop_at_y
comment camera_stop_at_y Moving down: the move is cut so that the camera stops at the check's y.
# 0263E7 "RTS"
0263E7  func  camera_y_free
comment camera_y_free No y check.
# 0263F9 "CMPD #$01,U; BGT", 0263FE "LDA #$02,U; CLRB; SUBD <$B3; STD <$E0"
0263E8  func  camera_stop_at_y_up
comment camera_stop_at_y_up Moving up: the move is cut so that the camera stops at the check's y.
# 026409 "LDD <$E0; ADDD <$E6; STD <$E0"
026409  func  camera_drop_push_y
comment camera_drop_push_y Takes the players' y push back out of the y move: the camera does not move in y.
# 026413 "LDA ,U+; STA <$A6; LDX #$7A37; ASLA; LDX A,X", 02641E-02642A the main layer moved by the camera's move,
# 02642C-026456 the
# other by the entry's ratios ("LDA ,U+; LBSR $64E1" for x and y), 026458-026482 x offsets 0160 (moving right) or 0, y
# offsets
# 00E0 (moving down) or 0 (<$C3 <$D3 <$CA <$DA)
026413  func  camera_scroll_layers
comment camera_scroll_layers Moves the camera's main layer by the camera's move and the other layer by the entry's x and y ratios, and sets the layers' offsets to the side the new tiles come in from.
# 026483 "LDY ,X; LDD <$F2; ADDD #$01,Y; STD #$01,Y; LDB <$F2; SEX; ADCA ,Y; STA ,Y", 026496 "LDY #$02,X" the same with
# <$F4
026483  func  layer_scroll_move
comment layer_scroll_move Adds F2 to the layer's x scroll and F4 to its y scroll, through the addresses of its layer_scroll record.
# 0264AB "LEAX #$04,X; STX <$A4; LDU #$02,X", 0264B4 "LDY #$7A43; LDA ,U; ASLA; JMP [A,Y]" (7A43: 64BC 64D5 64BC 64BD
# 64C7)
0264AB  func  camera_next_entry
comment camera_next_entry Moves to the stage record's next entry and runs its start (by its first byte).
# 0264BC "RTS"
0264BC  func  camera_entry_start_none
comment camera_entry_start_none An entry with nothing to do at its start.
# 0264BD "LDD <$E0; BPL; LBSR $6409", 0264CF "LDD <$B3; STD <$9F"
0264BD  func  camera_entry_start_going_up
comment camera_entry_start_going_up An entry's start: going up, the y move dropped; keeps the camera's y in direct page 9F and sets the x move onto the last entry's x.
# 0264C7 "LDD <$E0; BMI; LBSR $6409"
0264C7  func  camera_entry_start_going_down
comment camera_entry_start_going_down An entry's start: going down, the y move dropped; keeps the camera's y in direct page 9F and sets the x move onto the last entry's x.
# 0264D5 "LDA #$-03,X; CLRB; SUBD <$AD; INCA; STD <$DE"
0264D5  func  camera_move_to_last_entry_x
comment camera_move_to_last_entry_x Sets the x move so that the camera goes just past the last entry's x.
# 0264E1 "LDY #$7A53; ASLA; JMP [A,Y]" (A signed: FD quarter, FE half, FF and 01 the same, 00 none, 02 double, 03 four
# times)
0264E1  func  camera_scale_move
comment camera_scale_move Scales the move in F0 by the ratio A: -3 a quarter, -2 a half, -1 and 1 as it is, 0 none, 2 double, 3 four times.
# 0264E7 "LDD <$F0; ASRA; RORB; ASRA; RORB"
0264E7  func  camera_scale_quarter
comment camera_scale_quarter The move in F0 divided by 4.
# 0264EF "LDD <$F0; ASRA; RORB"
0264EF  func  camera_scale_half
comment camera_scale_half The move in F0 divided by 2.
# 0264F5 "LDD <$F0"
0264F5  func  camera_scale_same
comment camera_scale_same The move in F0 as it is.
# 0264F9 "CLRD"
0264F9  func  camera_scale_none
comment camera_scale_none No move.
# 0264FB "LDD <$F0; ASLB; ROLA"
0264FB  func  camera_scale_double
comment camera_scale_double The move in F0 times 2.
# 026501 "LDD <$F0; ASLB; ROLA; ASLB; ROLA"
026501  func  camera_scale_quadruple
comment camera_scale_quadruple The move in F0 times 4.
# 027968 "LDD <$C6; ADDD #$0100; STD <$C6", 027971-027978 "ANDA #$01; STA <$C5" (512 lines), 02797B "LDA <$AB; BITA
# #$20" and
# "ANDA #$07": every 8 frames layer B's y scroll (<$D5) one up or down by AB's bit 5, the sprites' y offset (<$89, 1FA2)
# the same with the phase turned by direct page 5F (0279A1 "LDB <$5F; BEQ; COMA"), 0279CD "INC <$AB", 0279E2 "LBSR
# $6237"
027968  func  dreamland_scroll
comment dreamland_scroll Stage 6, Dreamland (step 11): layer A scrolls down a line a frame without end, layer B and the sprites bob a pixel every 8 frames, turning every 32 frames, and the camera follows the stage's record.
# 0279E6 "LBSR $6237", 0279E9 "LDX #$79F2; LDA <$AB; ASLA; JMP [A,X]"
0279E6  func  stage_7_scroll
comment stage_7_scroll Stage 7 (step 13): the camera follows the stage's record and, by stage_scroll_step, the stage moves on to its next part at 0610.

# ======== bank 13: story 1, the opening (step 1) ========
# Its parts by 18E0 (02722D "LDX #$7ED1; LDA $18E0; ASLA; JSR [A,X]": 724D 72CA 7369 73DB 748A 7523), each ending by
# setting
# 18E2 (027237-027245 "CLR $18E2; INC $18E0; CLR $18E1"); 18E1 the part's step, 18E3 its timer, 18E5 a scroll speed. A
# player's button after 40 frames skips (0272CA "LDA #$40; LBSR $8653; BCS"); the story ends clearing direct page 72
# (0275A0), which step 1 (07A517 "LDA <$72; BNE") waits for.
02602D  func  story_1
comment story_1 Story 1, the opening: runs its part; carry set when a part has ended and the next one starts.
# 02724D "LDD #$0000; LBSR $86C2", 027253 "LDD #$0010; LBSR $86C5", 027259-02726C palette sets 0E81 and 0805, 02726F
# "LDD
# #$9100", 027275 "LDD #$4600", 02728B "LDA #$82; STA <$75; CLR <$76; LBSR $86B0", 027296-0272A0 both layers drawn,
# 0272B3
# "LDU #$7F9D; LBSR $77D6" (51C0, kind 04 animation 08), 0272B9 "LDU #$7FB1" (5280, kind 0F animation 16), 0272BF "LDA
# #$B0;
# STA $18E3"
02724D  func  story_1_set_up_street
comment story_1_set_up_street Story 1's first part: the stage 1 street (scene 82) drawn, its palettes, sounds 9100 and 4600, and two objects (kind 04 animation 08, kind 0F animation 16); B0 frames.
# 0272D1 "DEC $18E3; BEQ", 0272D7 "LBSR $75AB; LBSR $7656; LBSR $7767; LBSR $77A7"; 0272E4-027364: palette sets 0F05,
# layers
# at FFF0, scene 81 (0272FF-027313), 02731C "LBSR $8698", 027332 palette effect 3 (its slot kept in 18E7), 027341 "LDD
# #$3F25", 027347 "LBSR $868C", 02734A "LDU #$7FBB; LBSR $77D6" (4F80, kind 0E animation 25), 027350 "LDD #$0180; STD
# #$14,X", 027356-02735B screen shake, 02735E "LDA #$50; STA $18E3"
0272CA  func  story_1_street
comment story_1_street Story 1's street: the family walks in from the right, Smithers runs in, stops, lets something fall and runs off to the right with his two goons, and a text shows; after B0 frames (or a button) the story's scene 81 is drawn with palette effect 3, sound 3F25, a text (kind 0E animation 25) and a screen shake, for 50 frames.
# 027369 "DEC $18E3", 027376 "CLR [$18E7]" (the palette effect stopped), 02737A-0273A0 layer B drawn at FFF0 and moved
# to 00F0,
# 0273A6-0273BA layer A at 0010, 0200 and drawn, 0273CD "LBSR $868C", 0273D0 "LDU #$7FC5; LBSR $77D6"
027369  func  story_1_redraw
comment story_1_redraw Story 1, after 50 frames (or a button): stops the palette effect, draws both layers at their new places and shows the text again.
# 0273DB "LDA #$40; LBSR $8653; LBCS $73ED", 0273E3 "LDX #$7EDD; LDA $18E1; ASLA; JMP [A,X]" (73F4 7417 7448), 0273ED
# "INC
# $18E0; LBRA $74CF"
0273DB  func  story_1_rise
comment story_1_rise Story 1's rising part: runs its step (18E1); a button skips to the last part.
# 0273F4 "LDD #$0000; STD <$CA", 0273FA "LDD #$FA00; STD $18E5", 027401-027409 "<$A9 <$9D <$99" set, 02740C "LDD #$0101;
# LBSR $8680"
0273F4  func  story_1_rise_start
comment story_1_rise_start Its step 0: layer A's y offset 0, a scroll speed of FA00, queues sound 0101.
# 027417 "LDD #$0070; STD $4F99" (the text's z speed), 02741E "LDD $18E5; ADDD #$000A", 02742C-027434 palette effect 4,
# 027437 "LDA #$98; STA $18E3", 02743D "LDD #$00E0; STD <$CA"
027417  func  story_1_rise_slow_down
comment story_1_rise_slow_down Its step 1: layer A scrolls with the speed slowing down while the text rises; when the speed has run out, palette effect 4 and 98 frames more.
# 027448 "DEC $18E3; BEQ", 02744E "ADDD #$000A", 027459 "LDD #$FFA0; STD $4F99", 027476-027485 "CLR <$A9; CLR <$9D; CLR
# <$99"
027448  func  story_1_rise_coast
comment story_1_rise_coast Its step 2: for 98 frames layer A scrolls the other way, the text sinking; then the part ends.
# 027460 "LDD <$C6; ADDD $18E5; STD <$C6", 02746A-027472 "<$C5"
027460  func  story_1_scroll_layer_a
comment story_1_scroll_layer_a Moves layer A's y scroll by the story's scroll speed (18E5).
# 02748A "LDX #$7EE3; LDA $18E1; ASLA; JMP [A,X]" (7494 74C8)
02748A  func  story_1_pan
comment story_1_pan Story 1's panning part: runs its step (18E1).
# 027494 "DEC $18E3", 02749A "LDD <$CF; ADDD #$0A00; STD <$CF" (layer B's x), 0274AD "LDU #$7FCF; LBSR $77D6", 0274B7
# "LDD
# #$4400", 0274BD "LDA #$40; STA $18E3"
027494  func  story_1_pan_right
comment story_1_pan_right Its step 0: layer B scrolls 10 pixels a frame; then a text (kind 0E animation 26) with sound 4400, for 40 frames.
# 0274C8 "DEC $18E3; BEQ $74CF; RTS"
0274C8  func  story_1_pan_wait
comment story_1_pan_wait Its step 1: waits, then redraws for the last part.
# 0274CF-0274E2 both layers at 0110, 0; 0274F5-027502 both drawn; 027515 "LBSR $868C"; 027518 "LDU #$7FD9; LBSR $77D6"
# (4F80,
# kind 0E animation 27)
0274CF  func  story_1_last_view
comment story_1_last_view Draws both layers at x 0110 and shows the last text (kind 0E animation 27); the part ends.
# 027523 "LDA #$40; LBSR $8653; BCS $75A0", 02752A "LDX #$7EE7; LDA $18E1; ASLA; JMP [A,X]" (7534 753F, then 755C/7573
# four
# times, 759A)
027523  func  story_1_end
comment story_1_end Story 1's last part: runs its step (18E1); a button ends the story.
# 027534 "LDA #$20; STA $18E3"
027534  func  story_1_end_start
comment story_1_end_start Its first step: a wait of 20 frames.
# 02753F "LDA #$38; STA $18E3", 027545-027551 sounds 3F09, 3F0A, 3F0B
02753F  func  story_1_end_sounds
comment story_1_end_sounds Its second step: queues sounds 3F09-3F0B and waits 38 frames.
# 02755C "DEC $18E3", 027562 "LDA #$04; STA $4F80" (hidden), 027568 "LDA #$08; STA $18E3"
02755C  func  story_1_hide_text
comment story_1_hide_text Hides the text after its wait, for 8 frames.
# 027573 "DEC $18E3", 027579 "LDD #$4A00", 02757F "LDA #$80; STA $4F80", 027585-027591 the wait 8, or 80 after the last
027573  func  story_1_show_text
comment story_1_show_text Shows the text again with sound 4A00 after its wait, for 8 frames (80 the last time): the text blinks four times.
# 02759A "DEC $18E3", 0275A0 "CLR <$72; LBSR $868C; INC $18E2"
02759A  func  story_1_finish
comment story_1_finish After the last wait the story ends: the objects cleared, direct page 72 cleared.
# 0275AB "LDX #$4A40", 0275B1 "LDU #$7EFD; LDA ,S; ASLA; JSR [A,U]", 0275B9 "LEAX #$00C0,X", 0275C1 "CMPA #$04"
0275AB  func  story_1_family
comment story_1_family Runs the script of each of the four players' objects (their field 01 the step).
# 0275C7 "LDU #$7F05; LDA #$01,X; ASLA; JMP [A,U]"
0275C7  func  story_1_marge
comment story_1_marge Marge's slot (4A40), shown with kind 11 (the maggie set): runs its step.
# 0275D0 "LDU #$7F43; LBSR $77D6" (4A40 kind 11 animation 02 at 01C0, 00A0), 0275D6 "LDA #$40; STA #$09,X", 0275DB "LDD
# #$FF00;
# STD #$0F,X"
0275D0  func  story_1_marge_walks_in
comment story_1_marge_walks_in Puts her in at the right, walking left.
# 0275E5 "LDU #$7F09; LDA #$01,X; ASLA; JMP [A,U]"
0275E5  func  story_1_homer
comment story_1_homer Homer (4B00): runs his step.
# 0275EE "LDU #$7F4D; LBSR $77D6" (4B00 kind 01), 0275F9 "LDD #$FF00", 0275FF "LDA #$A8; STA #$28,X"
0275EE  func  story_1_homer_walks_in
comment story_1_homer_walks_in Puts him in at the right, walking left for A8 frames.
# 027608 "DEC #$28,X", 02760D "LDA #$D1; STA #$05,X", 027612 "CLRW #$0F,X"
027608  func  story_1_homer_stops
comment story_1_homer_stops After his walk stops with animation D1.
# 027619 "LDU #$7F0F"
027619  func  story_1_bart
comment story_1_bart Bart (4BC0): runs his step.
# 027622 "LDU #$7F57; LBSR $77D6" (4BC0 kind 02), 02762D "LDD #$FF00"
027622  func  story_1_bart_walks_in
comment story_1_bart_walks_in Puts him in at the right, walking left.
# 027637 "LDU #$7F13"
027637  func  story_1_lisa
comment story_1_lisa Lisa (4C80): runs her step.
# 027640 "LDU #$7F61; LBSR $77D6" (4C80 kind 03), 02764B "LDD #$FF00"
027640  func  story_1_lisa_walks_in
comment story_1_lisa_walks_in Puts her in at the right, walking left.
# 027655 "RTS" (the scripts' last steps)
027655  func  story_1_character_done
comment story_1_character_done A story character's script has ended: nothing more.
# 027656 "LDX #$4FE0", 02765C "LDU #$7F17; LDA ,S; ASLA; JSR [A,U]" (7680 7701 771E), 027664-027670 facing by the x
# speed,
# 027673 "LEAX #$60,X", 02767A "CMPA #$03"
027656  func  story_1_runners
comment story_1_runners Runs Smithers' and his two goons' scripts (4FE0, 5040, 50A0), each facing the way it moves.
# 027680 "LDU #$7F1D; LDA #$01,X; ASLA; JMP [A,U]" (7689 76A3 76C6 76E3 7700)
027680  func  story_1_smithers
comment story_1_smithers Smithers (kind 9C): runs his step.
# 027689 "LDU #$7F75; LBSR $77D6" (4FE0 kind 9C animation 00 at 0100, 00F8), 02768F "LDD #$FE00; STD #$0F,X", 027695
# "LDA #$A0;
# STA #$29,X"
027689  func  story_1_smithers_runs_in
comment story_1_smithers_runs_in Puts him in running left fast.
# 0276A3 "LDD #$0C,X; CMPD #$00A0; BGT", 0276AB "LDA #$8D; STA #$05,X", 0276B5 "CLRD; STD #$0F,X", 0276B9-0276BF "SUBD
# #$0008"
0276A3  func  story_1_smithers_collide
comment story_1_smithers_collide At x A0 stops with animation 8D, a little further back.
# 0276C6 "LDA #$06,X; ANDA #$01; BEQ", 0276D0 "LDU #$7FE3; LBSR $77D6" (4D40 kind 9C animation 09), 0276DA "LDA #$80;
# STA #$05,X"
0276C6  func  story_1_smithers_drop
comment story_1_smithers_drop At the animation's end lets go of an object (kind 9C animation 09) and shows animation 80.
# 0276E3 "LDA #$29,X; ADDA #$02; STA #$29,X; BCS", 0276ED "LDB #$40; LBRA $8617", 0276F2 "LDD #$0200; STD #$0F,X"
0276E3  func  story_1_smithers_run_off
comment story_1_smithers_run_off Runs off along a curve (his direction, field 29, turning by 2 a frame), then straight right.
# 027700 "RTS"
027700  func  story_1_smithers_gone
comment story_1_smithers_gone Smithers' script has ended: nothing more.
# 027701 "LDU #$7F27; LDA #$01,X; ASLA; JMP [A,U]" (770A 773B 7749 7766)
027701  func  story_1_first_goon
comment story_1_first_goon The first of Smithers' goons (5040): runs its step.
# 02770A "LDU #$7F7F; LBSR $77D6" (5040 kind 80 animation 37 at 00C0, 00F0), 027710 "LDA #$60; STA #$28,X", 027715 "LDA
# #$A0;
# STA #$29,X"
02770A  func  story_1_first_goon_appears
comment story_1_first_goon_appears Puts it in standing, to wait 60 frames and set off to the direction A0.
# 02771E "LDU #$7F2F"
02771E  func  story_1_second_goon
comment story_1_second_goon The second of Smithers' goons (50A0): runs its step.
# 027727 "LDU #$7F89; LBSR $77D6" (50A0 kind 80 animation 37 at 0080, 00F0), 02772D "LDA #$60", 027732 "LDA #$80; STA
# #$29,X"
027727  func  story_1_second_goon_appears
comment story_1_second_goon_appears Puts it in standing, to wait 60 frames and set off to the direction 80.
# 02773B "DEC #$28,X", 027740 "LDA #$90; STA #$05,X"
02773B  func  story_1_goon_start_running
comment story_1_goon_start_running After its wait starts running (animation 90).
# 027749 "LDA #$29,X; ADDA #$02; STA #$29,X; BCS", 027753 "LDB #$20; LBRA $8617", 027758 "LDD #$0200; STD #$0F,X"
027749  func  story_1_goon_run_off
comment story_1_goon_run_off Runs off along a curve (its direction turning by 2 a frame), then straight right.
# 027766 "RTS"
027766  func  story_1_goon_gone
comment story_1_goon_gone A goon's script has ended: nothing more.
# 027767 "LDU #$7F37; LDX #$4F80; LDA #$01,X; ASLA; JMP [A,U]" (7773 7782 7799 77A6)
027767  func  story_1_text
comment story_1_text The story's text (4F80): runs its step.
# 027773 "LDU #$7F6B; LBSR $77D6" (4F80 kind 0E animation 28 at 00A0, 00F8), 027779 "LDA #$20; STA #$28,X"
027773  func  story_1_text_appears
comment story_1_text_appears Puts in a text (kind 0E animation 28) for 20 frames.
# 027782 "LDA #$06,X; ORA #$40; STA #$06,X", 02778A "DEC #$28,X", 02778F "LDD #$5900; LBSR $8680"
027782  func  story_1_text_sound
comment story_1_text_sound Sets its field 06 bit 6; after 20 frames queues sound 5900.
# 027799 "LDA #$06,X; ANDA #$01; BEQ; CLR ,X"
027799  func  story_1_text_goes
comment story_1_text_goes The text is gone at its animation's end.
# 0277A6 "RTS"
0277A6  func  story_1_text_gone
comment story_1_text_gone The text's script has ended: nothing more.
# 0277A7 "LDX #$4D40; LDA ,X; BEQ", 0277AE "LDU #$7F3F; LDA #$01,X; ASLA; JMP [A,U]" (77B8 77CC)
0277A7  func  story_1_dropped_object
comment story_1_dropped_object What Smithers lets go of (4D40), while it is there: runs its step.
# 0277B8 "LBSR $85B1; BCC", 0277BD "LDD #$6F00; LBSR $8680", 0277C3 "LDA #$8A; STA #$05,X"
0277B8  func  story_1_dropped_object_fall
comment story_1_dropped_object_fall Falls with gravity; landing, crashes (animation 8A, sound 6F00).
# 0277CC "LDA #$06,X; ANDA #$01; BEQ; CLR ,X"
0277CC  func  story_1_dropped_object_gone
comment story_1_dropped_object_gone Gone at its animation's end.
# 0277D6 "LDX ,U++; LDA #$80; STA #$06,X; STA #$00,X", 0277E0 "LDA ,U+; STA #$04,X", 0277E5 "LDA ,U+; ORA #$80; STA
# #$05,X",
# 0277EC-0277F8 x, y, z
0277D6  func  story_put_object
comment story_put_object Puts in an object from a story record at U: its address, kind, animation, x, y and z; leaves it in X.

# ======== bank 13: the door stage 3's boss comes out of ========
# put in with the boss by the cemetery's scroll (0260F1); its object is kept in 1852 (027805 "STX $1852"), through which
# the boss opens it (03D230 "LDY $1852; LDA #$01; STA #$2A,Y" and sound 6000 as it comes out) and closes it (03D24D "CLR
# #$2A,Y"); open, its front half shows (animations 86 and 87), closed only its back (85)
# 026030 "LBRA $77FC": 0277FC "LDU #$7FED; LDA #$02,X; ASLA; JMP [A,U]" (7805 7865 787F)
026030  func  boss_door
comment boss_door The door stage 3's boss comes out of in the cemetery (list 1 type ED): runs its state (field 02: 0 set up, 1 closed, 2 open).
# 026033 "LBRA $7894": 027894 "LDU #$7FF3; ... JSR [A,U]" (78A8 7865 787F), 02789D "LDD <$AC; CMPD #$0320; BLT; CLR ,X"
026033  func  boss_door_stage_8
comment boss_door_stage_8 The same door at the start of stage 8 (list 2 type 1F, scene 0B's spawn list): runs its state and goes once the camera's x reaches 0320.
# 027805 "STX $1852", 027809 "LDB #$01; LBSR $867D; LDA #$F4; STA #$01,U" (type F4 of list 1: no handler), 027815 "STU
# #$28,X",
# 02781C-02784A x 02E0 / 02E8 and y 0108 / 00C8 from the camera, z -20 / 20, 02784C "LDA #$13; STA #$04,X; STA #$04,U",
# 027854 "LDA #$85; STA #$05,X"
027805  func  boss_door_set_up
comment boss_door_set_up Keeps itself in 1852 and puts in its other half (list 1 type F4, which has no handler) in front of it, both kind 13, closed (animation 85).
# 027865 "LDA #$2A,X; BEQ", 02786A "LDA #$86; STA #$05,X", 02786F "LDU #$28,X; LDA #$80; STA ,U; LDA #$87; STA #$05,U"
027865  func  boss_door_closed
comment boss_door_closed Closed (state 1): once its field 2A is set opens: animation 86 and its other half shown with animation 87.
# 02787F "LDA #$2A,X; BNE", 027884 "LDA #$85", 027889 "LDU #$28,X; LDA #$04; STA ,U", 027890 "DEC #$02,X"
02787F  func  boss_door_open
comment boss_door_open Open (state 2): once its field 2A is clear closes: animation 85 and its other half hidden.
# 0278A8 "STX $1852", 0278AC "LDB #$02; LBSR $867D", 0278B3 "STU #$28,X", 0278BA-0278E7 x 0330 / 0328 from the camera, y
# 00D0 /
# 0090, z -20 / 20, kind 13, 0278F2 "LDA #$85"
0278A8  func  boss_door_stage_8_set_up
comment boss_door_stage_8_set_up Stage 8's door: keeps itself in 1852 and puts in its other half in list 2, both kind 13, closed.
scoped object boss_door 28 other_half u16 object
scoped object boss_door 2A open u8

# ======== the krusty balloon's fields ========
# its state's step (026535 "LDA #$28,X; ASLA; JSR [A,U]"), a timer (026554 "DEC #$29,X", 026692, 0267AD, 02687B)
scoped object krusty_balloon 28 step u8
scoped object krusty_balloon 29 balloon_timer u8
# its target: frames until it takes the search's again (0269CC "LDA #$2A,X; BEQ; DEC #$2A,X", 0269D6 "LDA #$40; STA
# #$2A,X") and the target (0269DB "STU #$2B,X", 02693A "LDU #$2B,X")
scoped object krusty_balloon 2A target_time u8
scoped object krusty_balloon 2B target u16 object
# the direction it flies (0269AF "STA #$2D,X", 026741 "LDA #$2D,X; ... LBSR $8617")
scoped object krusty_balloon 2D direction u8
# its health at its last quick attack (026664 "STA #$2F,X", 026C63 "LDA #$2F,X; SUBA #$1B,X; CMPA #$0C", 026C74)
scoped object krusty_balloon 2F last_attack_health u8
# the hits it has taken since its last reaction (026BBB "INC #$30,X", 026BC7 "CMPA #$30,X", 026BDF "CLR #$30,X")
scoped object krusty_balloon 30 hits u8
# a volley's throws (02683D "INC #$31,X; LDA #$31,X; CMPA #$0C") and the side of the next one (026847 "LDA #$32,X; LBSR
# $69E0", 026857-026860 "INCA; CMPA #$03")
scoped object krusty_balloon 31 throws u8
scoped object krusty_balloon 32 throw_side u8
# the state and step it waits to go back to (026CD8 "LDA #$02,X; STA #$33,X; LDA #$28,X; STA #$34,X", 026905-026912)
scoped object krusty_balloon 33 saved_state u8
scoped object krusty_balloon 34 saved_step u8
# its squash step (026A79 "LDA #$35,X; ASLA; JSR [A,U]", 026A9F "INC #$35,X") and its volleys (026885 "INC #$36,X")
scoped object krusty_balloon 35 squash_step u8
scoped object krusty_balloon 36 volleys u8
# the object its attack hits with (026C40 "STU #$38,X", 026772 "LDU #$38,X", 0267B2 "CLR [#$38,X]")
scoped object krusty_balloon 38 attack_object u16 object
# the shot's drift time (026DCB "LDA #$20; STA #$28,X", 026DED "DEC #$28,X")
scoped object krusty_balloon_shot 28 shot_timer u8
# the shot and the attack object it puts in (0269E4/0269EB "LBSR $867D", 026C24 "LBSR $867D": U)
local krusty_balloon_throw 0269E4,0269EB u shot object
local krusty_balloon_attack_hit 026772 u attack object
local boss_door_set_up 02780B u other_half object
local boss_door_stage_8_set_up 0278AE u other_half object

# ======== bank 14: the files ========
# the jump table at 028000-0280BA holds the types' handlers (goons) and the actions' (goon_actions) in turn
028000  file  enemies/goons    # the goons: their set-ups and their entrances by type
028003  file  enemies/goon_actions    # the goons' strikes, jumps, grabs and throws
028015  file  enemies/goons
028018  file  enemies/goon_bomb    # the bomb the goons throw
02801B  file  enemies/goons
028030  file  enemies/goon_actions
028036  file  enemies/goons
028042  file  enemies/goon_actions
028045  file  enemies/goons
02805D  file  enemies/goon_actions
028060  file  enemies/goons
028084  file  enemies/goon_actions
028096  file  enemies/goons
0280AB  file  enemies/goon_actions
0280C0  file  enemies/goons
028AE0  file  enemies/goon_actions
028F7B  file  enemies/goons
02909D  file  enemies/goon_actions
0292EF  file  enemies/goon_bomb
02937B  file  enemies/goons

# ======== bank 14: the goons' types (list 0 unless said) ========
# each: "LDU #table; ASLB; JSR [B,U]" by its state, "LBSR $8596" (the hit reaction), "LBRA $85B7" (gone off the screen)
# type 3B (028000 "LBRA $6F6F", 7E3F: 6FA0, then the fixed states; scenes 1, 3, 5); its set-up 7E4B: kind B6, behaviour
# 029CDF whose far range throws (action 1B)
028000  func  bomb_goon
comment bomb_goon A goon of kind B6 that throws bombs (type 3B; stages 2, 3 and 4): set up, then the enemies' states.
# 028015 "LBRA $736F" (7F5B: 737B 73AD; scene 3)
028015  func  goon_bomb_run_in
comment goon_bomb_run_in A goon that runs in, throws one bomb and then fights (type 2E; stage 3's forest).
# 028018 "LBRA $72E3" (7F49: 7312 733A 735D 7365 72F8 7308, and 7F47 72EF for state -1), 0292E9 "LBSR $8593" (the hit
# reaction of the objects that are not enemies, 07CF97)
028018  func  goon_bomb
comment goon_bomb The bomb a goon throws (list 2 type 16): runs its state; a strike breaks it.
# 02801B "LBRA $616F" (79A4: 6184, the fixed states)
02801B  func  goon_close_grabber
comment goon_close_grabber A goon whose behaviour (029808) grabs at close range most of the time (type 03; stages 1-3 and 5).
# 02801E "LBRA $6138" (7998: 6157)
02801E  func  goon_striker
comment goon_striker A goon whose behaviour (029860) never grabs: strikes close, jumps or walks up to strike from afar (type 0C; most stages, and bank 15's timed lists).
# 028021 "LBRA $60E6" (7980: 85D5 the fixed goon's set-up, 8602 for state 4), 0280EC "LBSR $86B9" (07D0BB: out of health
# it
# takes action 0A or 0B at once); only bank 15's timed list 6 puts it in
028021  func  goon_from_timed_list
comment goon_from_timed_list A plain goon with its own hit reaction (type 1C), which only bank 15's timed spawn lists put in.
# 028024 "LBRA $620A" (79DC: 6216 6264; scene 1)
028024  func  goon_descent
comment goon_descent A goon that comes down hanging from a balloon (type 2B; stage 2, and bank 15's timed lists): set up, comes down, then fights.
# 028027 "LBRA $63A4" (7A50: 63B0 63C0; scenes 0, 1, 3, 5, 6, 9)
028027  func  goon_rush_in
comment goon_rush_in A goon that runs in toward its target for the frames its spawn gives (type 25), then fights.
# 02802A "LBRA $63FF" (7A60: 640B 642E; scenes 1, 5, 9)
02802A  func  goon_from_back
comment goon_from_back A goon that comes from the back of the stage down to the floor (type 26).
# 02802D "LBRA $6716" (7AFE: 6722 677E)
02802D  func  hat_goon_step_out
comment hat_goon_step_out A goon with a hat that strikes its entrance pose and walks up onto the floor (type 3C).
# 028036 "LBRA $73FE" (7F8F: 7424 745B, state 4 85FC; scene 4)
028036  func  goon_jump_in
comment goon_jump_in A goon that runs in from a side of the cemetery's moving ground and jumps up (type F3; stage 3's cemetery).
# 028039 "LBRA $74AD" (7FA3: 74B9 74FE; scene 4)
028039  func  goon_from_below
comment goon_from_below A goon that comes up from below the cemetery's floor and jumps out (type F1; stage 3's cemetery).
# 02803C "LBRA $73EB" (7F83: 73F7 745B; scene 4)
02803C  func  goon_striker_jump_in
comment goon_striker_jump_in A striker goon (no grabs) that runs in from a side of the cemetery's moving ground and jumps up (type EE).
# 02803F "LBRA $67CA" (7B3C: 6733 67D6)
02803F  func  goon_walk_up
comment goon_walk_up A goon that walks up onto the floor (type 39).
# 028045 "LBRA $6541" (7A9C: 654D 65AA); never ran
028045  func  goon_walk_in
comment goon_walk_in A goon that shows when the scroll brings it in, then walks in at a slant onto the floor (type 15; no scenario puts it in).
# 028048 "LBRA $6727" (7B0A: 6733 677E); the police car's doors let these out (02DC46, field 30 80)
028048  func  goon_step_out
comment goon_step_out A goon that strikes its entrance pose (getting out of the police car when its spawn's bit 7 is set) and walks up onto the floor (type 16).
# 02804B "LBRA $6191" (79CE: 6197 61DD 61EB 61F5, by field 02)
02804B  func  goon_balloon
comment goon_balloon The balloon a descending goon hangs from (list 1 type 0D): runs its state (0 set up, 1 carried, 2 let go, 3 rising).
# 02804E "LBRA $6889" (7B72: 6895 68DB; scene 5)
02804E  func  goon_run_in
comment goon_run_in A goon hidden until the scroll brings it in, that then runs in onto the floor (type 17; stage 4).
# 028051 "LBRA $6931" (7B8C: 693D 6976; scene 5)
028051  func  hat_goon_jump_in
comment hat_goon_jump_in A goon with a hat that waits for the scroll and jumps in (type 18; stage 4).
# 028054 "LBRA $6490" (7A7A: 649C 64CB; scene 5)
028054  func  hat_goon_waiting
comment hat_goon_waiting A goon with a hat waiting where the scroll brings it in, that then steps forward (type 06; stage 4).
# 028057 "LBRA $6627" (7AC6: 6633 6669)
028057  func  goon_delayed
comment goon_delayed A goon hidden for a while that then comes in by a direction and a speed onto the floor (type 1D).
# 02805A "LBRA $6A06" (7BBC: 6A12 6A3E); never ran
02805A  func  goon_drop
comment goon_drop A goon that waits for the scroll and drops down (type 1E; no scenario puts it in).
# 028060 "LBRA $755F" (7FB7: 756B 75A5, state 4 85FC; scene 4)
028060  func  cemetery_umbrella_goon
comment cemetery_umbrella_goon A goon with an umbrella floating down into the cemetery (type ED; stage 3's cemetery).
# 028063 "LBRA $60F2" (798C: 612B)
028063  func  goon_keeps_away
comment goon_keeps_away A goon whose behaviour (0298B8) grabs close but mostly keeps its distance further off (type EB; most stages).
# 028066 "LBRA $6A56" (7BD4: 6A62 6AAA; scenes 3, 6, 9)
028066  func  umbrella_goon_float_down
comment umbrella_goon_float_down A goon with an umbrella floating down from above (type 08).
# 028069 "LBRA $62AC" (7A14: 62B8 62C7); never ran
028069  func  hat_goon_run_across
comment hat_goon_run_across A goon with a hat that runs across the screen once the scroll brings it in (type 27; no scenario puts it in).
# 02806C "LBRA $6686" (7AE8: 6692 66C2)
02806C  func  shovel_goon_step_out
comment shovel_goon_step_out A goon that strikes its entrance pose, steps onto the floor and takes up a shovel (type 1B).
# 02806F "LBRA $6388" (7A44: 6394 63C0; scenes 1, 3, 6, 9)
02806F  func  goon_striker_rush_in
comment goon_striker_rush_in A striker goon (no grabs) that runs in toward its target for the frames its spawn gives (type 34), then fights.
# 028072 "LBRA $6FB5" (7E51: 6FE6)
028072  func  hat_goon
comment hat_goon A goon with a hat (type 01): set up, then the enemies' states.
# 028075 "LBRA $6FFB" (7E63: 7039)
028075  func  umbrella_goon
comment umbrella_goon A goon with an umbrella (type 0A): set up, then the enemies' states.
# 028078 "LBRA $704E" (7E75: 7082)
028078  func  shovel_goon
comment shovel_goon A goon with a shovel (type 0D): set up, then the enemies' states.
# 02807B "LBRA $7968" (7974: 60D8; scenes 3, 9)
02807B  func  hat_goon_brawler
comment hat_goon_brawler A goon with a hat whose behaviour (029910) never throws the hat: backs off at mid range and walks up to strike from afar (type E7; stages 3 and 7).
# 028096 "LBRA $6FC1", 028099 "LBRA $7012", 02809C "LBRA $705A": unused slots to the set-ups (already unused_ /
# unreached_)
# 02809F "LBRA $682A" (7B5C: 6836 686E; scenes 1, 5, 9)
02809F  func  goon_from_side
comment goon_from_side A goon that walks in from the left onto the floor and waits there (type 3F).
# 0280A2 "LBRA $6324" (7A34: 6330 6345)
0280A2  func  shovel_goon_rush_in
comment shovel_goon_rush_in A goon with a shovel that charges in swinging it for the frames its spawn gives (type 29), then fights.
# 0280A5 "LBRA $6308" (7A28: 6314 63C0; scenes 1, 3)
0280A5  func  umbrella_goon_rush_in
comment umbrella_goon_rush_in A goon with an umbrella that runs in toward its target for the frames its spawn gives (type 2A), then fights.
# 0280A8 "LBRA $6819" (7B50: 6825 686E); never ran
0280A8  func  goon_striker_from_side
comment goon_striker_from_side A striker goon (no grabs) that walks in from the left onto the floor (type F4; no scenario puts it in).

# ---- the goons' set-ups ----
# 0280C0 "BSR $60FE; LDA #$84; STA #$04,X", 0280C7 "LDU #$7910; STU #$2A,X", 0280CD-0280D4 "ORA #$86"
0280C0  func  hat_goon_brawler_set_up
comment hat_goon_brawler_set_up Sets up a goon in the hat goon's set (kind 84) with behaviour 029910.
# 0280D8 "BSR $60C0; LBSR $6164; CLR #$30,X; LDA #$02; STA #$02,X"
0280D8  func  hat_goon_brawler_start
comment hat_goon_brawler_start Its state 0: set up, weakened when its spawn says so, straight to choosing (state 2).
# 0280FE "LDU #$79B0; LBSR $85AB" (setup 8000), 028104 "LDA #$10; STA #$3A,X", 028109 "ORA #$40", 028111 "LDA #$01; STA
# #$42,X",
# 028116 "LBSR $8620; LBSR $8626"
0280FE  func  goon_base_set_up
comment goon_base_set_up Sets up a goon (kind 80, setup 79B0): its retarget time, facing, counted among the stage's enemies (field 42), its nearest player and the distances to it.
# 02811D "BSR $60FE", 02811F "LDU #$78B8; STU #$2A,X", 028125 "LDA #$86; STA #$05,X"
02811D  func  goon_keeps_away_set_up
comment goon_keeps_away_set_up Sets up a goon with behaviour 0298B8, standing (animation 86).
# 02812B "BSR $611D; BSR $6164 ... STA #$02,X"
02812B  func  goon_keeps_away_start
comment goon_keeps_away_start Its state 0: set up, weakened when its spawn says so, straight to choosing.
# 028144 "BSR $60FE", 028146 "LDU #$7860; STU #$2A,X", 02814C-028153 "ORA #$86"
028144  func  goon_striker_set_up
comment goon_striker_set_up Sets up a goon with behaviour 029860 (no grabs).
# 028157 "BSR $6144; BSR $6164 ... STA #$02,X"
028157  func  goon_striker_start
comment goon_striker_start Its state 0: set up, weakened when its spawn says so, straight to choosing.
# 028164 "LDA #$30,X; BEQ; LDA #$01; STA #$1B,X"
028164  func  goon_weaken_if_marked
comment goon_weaken_if_marked A goon whose spawn gave it a field 30 has 1 health.
# 02817B "BSR $60FE; LDU #$7808; STU #$2A,X"
02817B  func  goon_close_grabber_set_up
comment goon_close_grabber_set_up Sets up a goon with behaviour 029808.
# 028184 "BSR $617B; BSR $6164 ... STA #$02,X"
028184  func  goon_close_grabber_start
comment goon_close_grabber_start Its state 0: set up, weakened when its spawn says so, straight to choosing.
# 028F7B "LDU #$7E4B; LBSR $85AB" (setup B601), 028F94 "LDU #$7CDF; STU #$2A,X", 028F9A "LDA #$10; STA #$3A,X"
028F7B  func  bomb_goon_set_up
comment bomb_goon_set_up Sets up a goon of kind B6 with behaviour 029CDF, its nearest player and the distances to it.
# 028FA0 "BSR $6F7B", 028FA2-028FA9 "LDA #$30,X; BEQ; LDA #$01; STA #$1B,X", 028FAF "LDA #$02; STA #$02,X"
028FA0  func  bomb_goon_start
comment bomb_goon_start Its state 0: set up, weakened when its spawn says so, straight to choosing.
# 028FC1 "LDU #$7E5D; LBSR $85AB" (setup 8401), 028FDA "LDU #$7D37; STU #$2A,X"
028FC1  func  hat_goon_set_up
comment hat_goon_set_up Sets up a goon with a hat (kind 84, behaviour 029D37: it throws its hat from afar).
# 028FE6 "BSR $6FC1" ... 028FF5 "LDA #$02; STA #$02,X"
028FE6  func  hat_goon_start
comment hat_goon_start Its state 0: set up, weakened when its spawn says so, straight to choosing.
# 029007 "LDA #$09,X; ANDA #$70; ORA #$86; STA #$09,X"
029007  func  goon_set_armed_attributes
comment goon_set_armed_attributes Sets the sprite attributes of the goons with an umbrella or a shovel: bit 7 and 6 in the low nibble, its priority and facing kept.
# 029012 "LDU #$7E6F; LBSR $85AB" (setup 8201), 02902D "LDU #$7D8F; STU #$2A,X"
029012  func  umbrella_goon_set_up
comment umbrella_goon_set_up Sets up a goon with an umbrella (kind 82, behaviour 029D8F).
# 029039 "BSR $7012" ... 029048 "LDA #$02; STA #$02,X"
029039  func  umbrella_goon_start
comment umbrella_goon_start Its state 0: set up, weakened when its spawn says so, straight to choosing.
# 02905A "LDU #$7E81; LBSR $85AB" (setup 8301), 029076 "LDU #$7DE7; STU #$2A,X"
02905A  func  shovel_goon_set_up
comment shovel_goon_set_up Sets up a goon with a shovel (kind 83, behaviour 029DE7).
# 029082 "BSR $705A" ... 029091 "LDA #$02; STA #$02,X"
029082  func  shovel_goon_start
comment shovel_goon_start Its state 0: set up, weakened when its spawn says so, straight to choosing.

# ---- the goons' entrances ----
# the balloon: 028197 "LDU #$79D6; LBSR $85AB" (setup 8036: the goon's set, animation 36), 0281A2 "LDU #$40,X" (its
# goon,
# 07CAAB "STX #$40,U"), 0281A5-0281B5 its priority, 0281B8-0281D3 its speeds and place, 3C over it
028197  func  goon_balloon_set_up
comment goon_balloon_set_up Its state 0: shown with the goon's set's animation 36, at its goon's place 3C higher, moving with it.
# 0281DD "LDU #$40,X; LDA #$02,U; CMPA #$04; BNE; INC #$02,X"
0281DD  func  goon_balloon_carried
comment goon_balloon_carried Carried (state 1): lets go when its goon is hurt (state 4); the goon also lets go of it on its own.
# 0281EB "LDD #$0100; STD #$19,X; INC #$02,X"
0281EB  func  goon_balloon_let_go
comment goon_balloon_let_go Let go (state 2): starts rising.
# 0281F5 "LDD #$19,X; ADDD #$0004", 0281FE "LDD #$16,X; CMPD #$00F0; BCS; CLR #$00,X"
0281F5  func  goon_balloon_rise
comment goon_balloon_rise Rising (state 3), faster and faster, until gone at F0 high.
# 028216 "LBSR $85F9", 028219 "LDY #$79EC; LBSR $862C" (list 1 type 0D), 02821F "BCS" (none: 028221-02822C to choosing),
# 02822D "STU #$40,X", 028230 "LDA #$B0; STA #$05,X", 028235 "LDA #$68; STA #$3B,X", 02823A "LDU #$79F4", 028252 "LDA
# #$C8;
# STA #$00,X", 028257 "LDD #$FE00; STD #$19,X"
028216  func  goon_descent_set_up
comment goon_descent_set_up Its state 0: a goon with its balloon (straight to choosing when there is no room for one), animation B0, at the x and x speed goon_descent_starts gives, coming down for 68 frames.
# 028264 "LDU #$79E8; LDB #$29,X; ASLB; JSR [B,U]", 02826D "LBRA $85C9"
028264  func  goon_descent_step
comment goon_descent_step Its entrance (state 1): runs its step (field 29) and faces the way it moves.
# 028270 "CLRD; LBSR $8638; ANDA #$0F; ... STA #$5D,X", 02827C "DEC #$3B,X", 028281 "LDU #$40,X; LDA #$02; STA #$02,U",
# 028289
# "LDA #$A8; STA #$05,X", 028291 "LBRA $8662"
028270  func  goon_descent_float
comment goon_descent_float Comes down with the floor's height under it kept; after its time lets go of the balloon (animation A8).
# 028294 "LBSR $85B1; BCC", 028299-0282A8 its target, facing, "LBRA $8635"
028294  func  goon_descent_land
comment goon_descent_land Falls with gravity; landing, takes its nearest player and goes to choosing.
# 0282B8 "LBSR $6FC1; CLR #$30,X; INC #$02,X", 0282C1 "LDY #$79BE; LBRA $85B4"
0282B8  func  hat_goon_run_across_set_up
comment hat_goon_run_across_set_up Its state 0: a goon with a hat with hit box 79BE.
# 0282C7 "LDU #$7A20; LDB #$29,X; ASLB; JSR [B,U]", 0282D0 "LBRA $6758"
0282C7  func  hat_goon_run_across_step
comment hat_goon_run_across_step Its entrance (state 1): runs its step and takes the floor's priority and height under it.
# 0282D3 "LDA #$A2; STA #$05,X"
0282D3  func  hat_goon_run_across_pose
comment hat_goon_run_across_pose Step 0: animation A2.
# 0282DC "ORA #$80; STA #$05,X", 0282E4 "LDD #$0C,X; CMPD #$0100; BCC"
0282DC  func  hat_goon_run_across_wait
comment hat_goon_run_across_wait Step 1: keeps its animation going until it is left of x 0100.
# 0282F0 "LDA #$06,X; LSRA; BCC", 0282F6 "LDD #$0200; STD #$0F,X", 0282FC "LDA #$90; STA #$05,X"
0282F0  func  hat_goon_run_across_run
comment hat_goon_run_across_run Step 2: at the animation's end runs right (animation 90).
# 028307 "RTS"
028307  func  hat_goon_run_across_running
comment hat_goon_run_across_running Step 3: keeps running until it leaves the screen.
# 028314 "LBSR $7012; LDA #$30,X; STA #$3B,X; CLR #$30,X; INC #$02,X"
028314  func  umbrella_goon_rush_in_set_up
comment umbrella_goon_rush_in_set_up Its state 0: a goon with an umbrella that will run the frames its spawn gives.
# 028330 "LBSR $705A", 028333 "LDA #$A4; STA #$05,X", 028338 "LDA #$30,X; STA #$3B,X"
028330  func  shovel_goon_rush_in_set_up
comment shovel_goon_rush_in_set_up Its state 0: a goon with a shovel (animation A4) that will charge the frames its spawn gives.
# 028345 "LDU #$7A40; LDB #$29,X; ASLB; JSR [B,U]", 02834E "LBRA $6758"
028345  func  shovel_goon_rush_in_step
comment shovel_goon_rush_in_step Its entrance (state 1): runs its step and takes the floor's priority and height under it.
# 028351 "LDD #$0200; STD #$0F,X", 028357 "LDA #$36,X; CMPA #$40; BMI; NEGW #$0F,X", 028364 "LBRA $85C9"
028351  func  shovel_goon_rush_in_start
comment shovel_goon_rush_in_start Step 0: runs toward its target.
# 028367 "DEC #$3B,X; BNE", 02836C "LDY #$79B6; LBSR $85B4; LBRA $8635", 028375 "LDA #$3B,X; BITA #$03", 02837C "LDY
# #$79C6"
028367  func  shovel_goon_rush_in_swing
comment shovel_goon_rush_in_swing Step 1: runs with its shovel's hit box (79C6) on one frame in four; after its time takes its body's hit box and goes to choosing.
# 028394 "LBSR $6144; LDA #$30,X; STA #$3B,X ... INC #$02,X"
028394  func  goon_striker_rush_in_set_up
comment goon_striker_rush_in_set_up Its state 0: a striker goon that will run the frames its spawn gives.
# 0283B0 "LBSR $85F9; LDA #$30,X; STA #$3B,X ... INC #$02,X"
0283B0  func  goon_rush_in_set_up
comment goon_rush_in_set_up Its state 0: a goon that will run the frames its spawn gives.
# 0283C0 "LDU #$7A5C; LDB #$29,X; ASLB; JSR [B,U]", 0283C9 "LBRA $6758"
0283C0  func  goon_rush_in_step
comment goon_rush_in_step The rush in (state 1): runs its step and takes the floor's priority and height under it.
# 0283CC "LDA #$90; STA #$05,X", 0283D1 "LDD #$0200; STD #$0F,X", 0283D7 "LDA #$36,X; CMPA #$40; BMI; NEGW #$0F,X"
0283CC  func  goon_rush_in_start
comment goon_rush_in_start Step 0: runs (animation 90) toward its target.
# 0283E7 "DEC #$3B,X; BNE", 0283EC-0283FB its target, facing, "LBRA $8635"
0283E7  func  goon_rush_in_run
comment goon_rush_in_run Step 1: after its time takes its nearest player and goes to choosing.
# 02840B "LBSR $85F9; INC #$02,X", 028411 "LDA #$83; STA #$05,X", 028416 "LDA #$80; STA #$00,X", 02841B-028422 priority
# 10
02840B  func  goon_from_back_set_up
comment goon_from_back_set_up Its state 0: a goon (animation 83), shown but not to be hit, behind the layers' front (priority 10), facing its nearest player.
# 02842E "LDU #$7A6C; LDB #$29,X; ASLB; JMP [B,U]"
02842E  func  goon_from_back_step
comment goon_from_back_step Its entrance (state 1): runs its step.
# 028437 "LDU #$7A72; LDA #$30,X; ASLA; LDD A,U; STD #$0C,X", 028443 "LDD #$0050; STD #$11,X", 028449 "LDD #$0100; STD
# #$14,X"
028437  func  goon_from_back_place
comment goon_from_back_place Step 0: at the x goon_from_back_xs gives, at the back (y 50), coming forward.
# 028456 "CLRD; LBSR $8638; TSTA; BMI", 02845D "STA #$47,X", 028465 "STA #$5D,X", 028468 "LDA #$C0; STA #$00,X", 02846D
# "LDA
# #$40; STA #$3B,X"
028456  func  goon_from_back_reach_floor
comment goon_from_back_reach_floor Step 1: once there is floor under it, takes its height and can be hit; waits 40 frames.
# 028477 "DEC #$3B,X; BNE; INC #$02,X", 028480 "LDA <$16; BITA #$07" (every 8 frames 028487 "LDU #$38,X; LBSR $8626;
# LBRA $85C9")
028477  func  goon_from_back_wait
comment goon_from_back_wait Step 2: waits facing its target (checked every 8 frames), then goes to choosing.
# 02849C "LBSR $6FC1", 02849F "LDA #$B7; STA #$05,X", 0284A4 "LDU #$7A86" (waiting_hat_goon_starts), 0284B9-0284C1 "ANDA
# #$80;
# ORA #$03,U; STA #$3D,X"
02849C  func  hat_goon_waiting_set_up
comment hat_goon_waiting_set_up Its state 0: a goon with a hat (animation B7) with the x the scroll must bring it in at, its attributes and its flags from waiting_hat_goon_starts.
# 0284CB "LDU #$7A92; LDA #$29,X; ASLA; JMP [A,U]"
0284CB  func  hat_goon_waiting_step
comment hat_goon_waiting_step Its entrance (state 1): runs its step.
# 0284D4 "LDA #$3D,X; BPL; LDB #$80; STB #$00,X", 0284DE "LSRA; BCS", 0284E1 "LDY #$79BE; LBSR $85B4", 0284E7 "LDA #$A2"
0284D4  func  hat_goon_waiting_show
comment hat_goon_waiting_show Step 0: shown at once when its flags' bit 7 says so; without bit 0, hit box 79BE and animation A2.
# 0284F0 "LDA #$3D,X; LSRA; BCS", 0284F6 "ORA #$80; STA #$05,X", 0284FE "LDD #$0C,X; CMPD #$3E,X; BCC", 028509 "BITA
# #$20"
# (hit), 028510 "LDA #$A0; STA #$05,X; LDA #$02; STA #$29,X"
0284F0  func  hat_goon_waiting_for_scroll
comment hat_goon_waiting_for_scroll Step 1: waits until the scroll brings it left of its x; hit meanwhile, takes animation A0 and steps forward.
# 02851B "LDA #$06,X; LSRA; BCC", 028521 "LDY #$79B6; LBSR $85B4", 028527 "LDA #$91", 02852C-028535 x speed 0100, y
# speed FF00,
# 028538 "LDA #$08; STA #$3B,X"
02851B  func  hat_goon_waiting_step_forward
comment hat_goon_waiting_step_forward Step 2: at the animation's end takes its body's hit box and walks (animation 91) right and up toward the floor.
# 02854D "LDU #$7AA8; LBSR $85AB" (setup 8002), 028553 "LDA #$08; STA #$00,X", 02855D "LDU #$7AAE"
# (goon_walk_in_starts),
# 028567-028576 priority, 028579 "ANDA #$80; STA #$3A,X", 028580 "CLRA; ASLDI #$04; STD #$3E,X", 028586-028597 facing,
# 02859A "LDD #$02,U; STA #$3C,X; STB #$3B,X"
02854D  func  goon_walk_in_set_up
comment goon_walk_in_set_up Its state 0: a hidden goon (animation 02) with its priority, the way it will walk, the x the scroll must bring it in at and its two waits from goon_walk_in_starts.
# 0285AA "LDU #$7ABE; LDA #$29,X; ASLA; JMP [A,U]"
0285AA  func  goon_walk_in_step
comment goon_walk_in_step Its entrance (state 1): runs its step.
# 0285B3 "LDD #$0C,X; CMPD #$3E,X; BCC", 0285BB "LDA #$80; STA #$00,X"
0285B3  func  goon_walk_in_wait_for_scroll
comment goon_walk_in_wait_for_scroll Step 0: shown once the scroll brings it left of its x.
# 0285C4 "DEC #$3C,X; BNE", 0285C9 "LBSR $8620; LBSR $8626", 0285CF "LDA #$3A,X; BPL; LDA #$E0" / "LDA #$20", 0285DA
# "LDB #$40;
# LBSR $8617"
0285C4  func  goon_walk_in_go
comment goon_walk_in_go Step 1: after its wait takes its nearest player and walks at a slant (direction 20, or E0 when its start's bit 7 says so).
# 0285E3 "CLRD; LBSR $8638; TSTA; BMI; BITA #$0F; BNE", 0285EE-028601 "STA #$47,X", priority, 028604-02860C "STB #$5D,X"
0285E3  func  goon_reach_floor_level
comment goon_reach_floor_level An entrance's step: once over floor at height 0, takes its floor cell, priority and height and goes on.
# 028613 "DEC #$3B,X; BNE", 028618 "LDA #$C0; STA #$00,X", 02861D "CLRW #$0F,X; CLRW #$14,X", 028623 "INC #$02,X"
028613  func  goon_entrance_end
comment goon_entrance_end An entrance's last step: after its wait can be hit, stops and goes to choosing (state 2).
# 028633 "LBSR $85F9; INC #$02,X", 028639 "LDA #$82", 02863E-028645 priority 20, 028648 "LDA #$08; STA #$00,X", 02864D
# "LDU
# #$7AD2" (delayed_goon_starts), 028657 "LDD ,U; STA #$3C,X; STB #$3B,X", 02865F "LDD #$02,U; STD #$3E,X"
028633  func  goon_delayed_set_up
comment goon_delayed_set_up Its state 0: a hidden goon (animation 82) with its wait, its wait on the floor, and the direction and speed it will come in by from delayed_goon_starts.
# 028669 "LDU #$7AE2; LDA #$29,X; ASLA; JMP [A,U]" (6672 65E3 6613)
028669  func  goon_delayed_step
comment goon_delayed_step Its entrance (state 1): runs its step.
# 028672 "DEC #$3C,X; BNE", 028677 "LDA #$80; STA #$00,X", 02867C "LDD #$3E,X; LBSR $8617"
028672  func  goon_delayed_start
comment goon_delayed_start Step 0: after its wait shown, moving by its direction and speed.
# 028692 "LBSR $705A" then 028695 "LDA #$80; STA #$04,X" (the goon's set), 02869A "LDA #$A2", 02869F "LDA #$08; STA
# #$00,X",
# 0286A4 "INC #$42,X", 0286A7 "LDU #$7B16" (goon_entrances: 0286B0 "STA #$3C,X", 0286B3 "STB #$09,X"), 0286B6 "LDA #$08;
# STA #$3B,X"
028692  func  shovel_goon_step_out_set_up
comment shovel_goon_step_out_set_up Its state 0: set up as a goon with a shovel but shown in the plain goon's set (animation A2), hidden, with its entrance pose's wait and attributes from goon_entrances.
# 0286C2 "LDU #$7AF4; LDA #$29,X; ASLA; JMP [A,U]" (66CB 66DF 65E3 66F4 66FD)
0286C2  func  shovel_goon_step_out_step
comment shovel_goon_step_out_step Its entrance (state 1): runs its step.
# 0286CB "LBSR $8620", 0286CE "LDA #$80; STA #$00,X", 0286D3 "ORA #$80; STA #$05,X"
0286CB  func  shovel_goon_step_out_show
comment shovel_goon_step_out_show Step 0: takes its nearest player and is shown, its animation started again.
# 0286DF "DEC #$3C,X; BNE", 0286E4 "LDD #$0080; STD #$0F,X", 0286EA "LDD #$FF80; STD #$14,X"
0286DF  func  shovel_goon_step_out_walk
comment shovel_goon_step_out_walk Step 1: after its wait walks right and up.
# 0286F4 "LDA #$04; STA #$3B,X"
0286F4  func  shovel_goon_step_out_pause
comment shovel_goon_step_out_pause Step 3: a wait of 4 frames once on the floor.
# 0286FD "DEC #$3B,X; BNE", 028702 "LDA #$83; STA #$04,X" (goon_with_shovel), 028707 "LDA #$C0; STA #$00,X", 028712 "INC
# #$02,X"
0286FD  func  shovel_goon_step_out_arm
comment shovel_goon_step_out_arm Step 4: after its wait takes the shovel goon's set (kind 83), can be hit, stops and goes to choosing.
# 028722 "LBSR $6FC1; BRA $6736"
028722  func  hat_goon_step_out_set_up
comment hat_goon_step_out_set_up Its state 0: a goon with a hat in its entrance pose.
# 028733 "LBSR $85F9" then 028736
028733  func  goon_step_out_set_up
comment goon_step_out_set_up Its state 0: a goon in its entrance pose.
# 028736 "LDA #$80; STA #$00,X", 02873B "LDA #$91", 028740 "LDU #$7B16; LDA #$30,X; ASLA; LDD A,U; STA #$3C,X; STB
# #$09,X",
# 02874F "LDA #$08; STA #$3B,X", 028754 "INC #$02,X"
028736  func  goon_take_entrance_pose
comment goon_take_entrance_pose Shown (animation 91) with the wait and sprite attributes goon_entrances gives by its spawn's field 30, then its entrance (state 1).
# 028758 "CLRD; LBSR $8638; TSTA; BMI", 02875F-028770 priority, 028772-02877A "STB #$5D,X"
028758  func  goon_follow_floor
comment goon_follow_floor Takes the priority and the height of the floor under it, where there is floor.
# 02877E "LDU #$7B30; LDA #$29,X; ASLA; JMP [A,U]" (6787 6796 67A4 67B8 65E3 6613)
02877E  func  goon_step_out_step
comment goon_step_out_step Its entrance (state 1): runs its step.
# 028787 "LDA #$30,X; BPL", 02878C "INC #$29,X", 028790 "LDA #$03; STA #$29,X"
028787  func  goon_step_out_check
comment goon_step_out_check Step 0: with its spawn's bit 7 (the police car's doors) it strikes the pose, else it walks up at once.
# 028796 "DEC #$3C,X; BNE", 02879B "LDA #$B1; STA #$05,X"
028796  func  goon_step_out_pose
comment goon_step_out_pose Step 1: after its wait shows animation B1.
# 0287A4 "LDA #$06,X; LSRA; BCC", 0287AA "LDA #$01; STA #$3C,X", 0287AF "LDA #$91"
0287A4  func  goon_step_out_pose_end
comment goon_step_out_pose_end Step 2: at the animation's end back to animation 91.
# 0287B8 "DEC #$3C,X; BNE", 0287BD "CLR #$30,X", 0287C0 "LDD #$FF00; STD #$14,X"
0287B8  func  goon_walk_up_start
comment goon_walk_up_start After its wait walks up the screen.
# 0287D6 "LDU #$7B48; LDA #$29,X; ASLA; JMP [A,U]" (67DF 67B8 67ED 6613)
0287D6  func  goon_walk_up_step
comment goon_walk_up_step Its entrance (state 1): runs its step.
# 0287DF "LDA #$80; STA #$00,X", 0287E4 "LDA #$10; STA #$09,X"
0287DF  func  goon_walk_up_show
comment goon_walk_up_show Step 0: shown, behind the layers' front (priority 10).
# 0287ED "CLRD; LBSR $8638; TSTA; BMI", 0287F7 "STA #$47,X", 0287FA-028807 priority, 02880A-028812 "STB #$5D,X"
0287ED  func  goon_walk_up_reach_floor
comment goon_walk_up_reach_floor Step 2: once over floor, takes its floor cell, priority and height and goes on.
# 028825 "LBSR $6144; BRA $6839"
028825  func  goon_striker_from_side_set_up
comment goon_striker_from_side_set_up Its state 0: a striker goon entering from the side.
# 028836 "LBSR $85F9" then 028839
028836  func  goon_from_side_set_up
comment goon_from_side_set_up Its state 0: a goon entering from the side.
# 028839 "LDA #$80; STA #$00,X", 02883E "CLRW #$5C,X", 028841 "LDU #$7B68" (goon_side_entries: 02884A "ORA ,U", 028854
# "LDB
# #$01,U; STB #$3B,X"), 02885A "LDA #$30,X; BPL; LDA #$01; STA #$1B,X", 028864 "LBSR $8620", 02886A "INC #$02,X"
028839  func  goon_from_side_place
comment goon_from_side_place Shown with the attributes and the wait on the floor goon_side_entries gives, 1 health with its spawn's bit 7, facing its nearest player; then its entrance.
# 02886E "LDU #$7B6C; LDA #$29,X; ASLA; JMP [A,U]" (6877 690B 6925)
02886E  func  goon_from_side_step
comment goon_from_side_step Its entrance (state 1): runs its step.
# 028877 "LBSR $8620", 02887A "LDD #$0100; STD #$0F,X", 028880 "LDA #$81; STA #$05,X"
028877  func  goon_from_side_walk
comment goon_from_side_walk Step 0: walks right (animation 81).
# 028895 "LBSR $85F9", 028898 "LDA #$04; STA #$00,X", 02889D "CLRW #$5C,X", 0288A0-0288A8 1 health without its spawn's
# bit 0,
# 0288AB "LDU #$7B7E" (goon_run_in_starts: 0288B4-0288B9 "LDB ,U; ASLDI #$04; STD #$3E,X", 0288BC "LDA #$01,U; STA
# #$3B,X"),
# 0288C2-0288C9 priority 20, 0288CC "LDA #$FF; STA #$42,X; STA #$57,X"
028895  func  goon_run_in_set_up
comment goon_run_in_set_up Its state 0: a hidden goon, not counted among the stage's enemies yet, with the x the scroll must bring it in at and its wait on the floor from goon_run_in_starts.
# 0288DB "LDU #$7B86; LDA #$29,X; ASLA; JMP [A,U]" (68E4 690B 6925)
0288DB  func  goon_run_in_step
comment goon_run_in_step Its entrance (state 1): runs its step.
# 0288E4 "LDD #$0C,X; CMPD #$3E,X; BCC", 0288EC "LDA #$01; STA #$42,X", 0288F1 "CLR #$57,X", 0288F4 "LDA #$80; STA
# #$00,X",
# 0288FC "LDD #$0200; STD #$0F,X", 028902 "LDA #$82"
0288E4  func  goon_run_in_go
comment goon_run_in_go Step 0: once the scroll brings it left of its x, counted among the enemies, shown and running right (animation 82).
# 02890B "CLRD; LBSR $8638; TSTA; BMI", 028912 "LDA #$C0; STA #$00,X", 028917-02891E priority 10
02890B  func  goon_reach_floor
comment goon_reach_floor An entrance's step: once over floor, can be hit, behind the layers' front (priority 10), and goes on.
# 028925 "DEC #$3B,X; BNE", 02892A "CLRW #$0F,X", 02892D "INC #$02,X"
028925  func  goon_wait_on_floor
comment goon_wait_on_floor An entrance's last step: stops after its wait on the floor and goes to choosing.
# 02893D "LBSR $6FC1", 028940 "LDA #$A2", 028945-02894C priority 20, 02894F "LDA #$08; STA #$00,X", 028954 "INC #$57,X;
# INC #$42,X",
# 02895A "LDU #$7B98" (hat_goon_jump_in_starts: 028964 "LDD ,U; STD #$3E,X", 028969 "LDD #$02,U; STA #$3C,X")
02893D  func  hat_goon_jump_in_set_up
comment hat_goon_jump_in_set_up Its state 0: a hidden goon with a hat (animation A2) with the x the scroll must bring it in at and its wait from hat_goon_jump_in_starts.
# 028976 "LDU #$7BB0; LDA #$29,X; ASLA; JMP [A,U]" (697F 698B 69A1 69BC 69F2 69F5)
028976  func  hat_goon_jump_in_step
comment hat_goon_jump_in_step Its entrance (state 1): runs its step.
# 02897F "LDD #$0C,X; CMPD #$3E,X; BCC; INC #$29,X"
02897F  func  goon_wait_for_scroll
comment goon_wait_for_scroll An entrance's step: waits until the scroll brings it left of its x.
# 02898B "DEC #$3C,X; BNE", 028990 "CLR #$57,X", 028993 "LDA #$A2", 028998 "LDA #$88; STA #$00,X"
02898B  func  hat_goon_jump_in_show
comment hat_goon_jump_in_show Step 1: after its wait shown with animation A2.
# 0289A1 "LDA #$06,X; LSRA; BCC", 0289A7 "LDD #$0900; STD #$19,X", 0289AD "LDA #$84", 0289B2 "LBSR $8620; LBSR $8626"
0289A1  func  hat_goon_jump_in_leap
comment hat_goon_jump_in_leap Step 2: at the animation's end leaps high (animation 84) toward its nearest player.
# 0289BC "LDD #$FE00; STD #$14,X", 0289C2 "LBSR $863B; STA <$F0; BMI", 0289CA-0289D6 "CMPD #$16,X; BCC", 0289D8 "STB
# #$5D,X", 0289DB-
# 0289EB priority
0289BC  func  hat_goon_jump_in_fly
comment hat_goon_jump_in_fly Step 3: flies up the screen until it is over floor lower than itself, then takes that floor's height and priority.
# 0289F2 "CLRW #$14,X" then 0289F5
0289F2  func  goon_stop_and_fall
comment goon_stop_and_fall Stops moving up or down the screen and falls (goon_fall_to_floor).
# 0289F5 "LBSR $85B1; BCC", 0289FA "CLRW #$0F,X", 0289FD "LDA #$C0; STA #$00,X", 028A02 "INC #$02,X"
0289F5  func  goon_fall_to_floor
comment goon_fall_to_floor Falls with gravity; landing, stops, can be hit and goes to choosing.
# 028A12 "LBSR $85F9", 028A15-028A20 "LBSR $8638 ... STD #$5C,X", 028A23 "LDA #$80; STA #$00,X", 028A28 "INC #$42,X",
# 028A2B
# "LDU #$7BC8; LDA #$30,X; ASLA; LDD A,U; STD #$3E,X"
028A12  func  goon_drop_set_up
comment goon_drop_set_up Its state 0: a goon with the floor's height under it and the x the scroll must bring it in at from goon_drop_xs.
# 028A3E "LDU #$7BCC; LDA #$29,X; ASLA; JMP [A,U]" (697F 6A47 69F2 69F5)
028A3E  func  goon_drop_step
comment goon_drop_step Its entrance (state 1): runs its step.
# 028A47 "LDA #$C8; STA #$00,X", 028A4C "LBSR $8620; LBSR $8626"
028A47  func  goon_drop_show
comment goon_drop_show Step 1: shown, facing its nearest player, then falls.
# 028A62 "LBSR $7012", 028A65 "LDA #$A1", 028A6A "LDA #$C8; STA #$00,X", 028A74 "LDU #$7BE0; LDA #$30,X; ASLA; LDD A,U;
# STD
# #$0C,X" (umbrella_goon_xs), 028A80-028A9B floor height and priority, 028A9E "LDA #$01; STA #$3B,X"
028A62  func  umbrella_goon_float_down_set_up
comment umbrella_goon_float_down_set_up Its state 0: a goon with an umbrella (animation A1) at the x umbrella_goon_xs gives, with the floor's height and priority under it.
# 028AAA "LDU #$7BE8; LDA #$29,X; ASLA; JMP [A,U]" (6AB3 6AC5 6ADC)
028AAA  func  umbrella_goon_float_down_step
comment umbrella_goon_float_down_step Its entrance (state 1): runs its step.
# 028AB3 "DEC #$3B,X; BEQ", 028AB9-028AC2 its nearest player, facing
028AB3  func  umbrella_goon_float_down_face
comment umbrella_goon_float_down_face Step 0: after a frame faces its nearest player.
# 028AC5 "LDD #$19,X; SUBD #$0010; STD #$19,X", 028ACE "LBSR $8662; BCC", 028AD3 "LDA #$A2"
028AC5  func  umbrella_goon_float_down_fall
comment umbrella_goon_float_down_fall Step 1: floats down (a sixth of the gravity); landing, animation A2.
# 028ADC "INC #$02,X"
028ADC  func  umbrella_goon_float_down_land
comment umbrella_goon_float_down_land Step 2: goes to choosing.
# 02937B "LBSR $85F9", 02937E "LDA #$01; STA #$1B,X", 029383 "LDA #$B3", 029388 "LDA #$30,X; STA #$3B,X", 02938E "LDA
# #$10; STA
# #$3A,X", 029399-0293A7 x speed 0200 toward the middle, 0293AA "LBRA $85C6"
02937B  func  goon_bomb_run_in_set_up
comment goon_bomb_run_in_set_up Its state 0: a goon with 1 health (animation B3) running in toward the middle for the frames its spawn gives.
# 0293AD "LDU #$7F67; LDA #$29,X; ASLA; JMP [A,U]" (73B6 73D0 73E1)
0293AD  func  goon_bomb_run_in_step
comment goon_bomb_run_in_step Its entrance (state 1): runs its step.
# 0293B6 "DEC #$3B,X; BNE", 0293BB "CLRW #$0F,X", 0293BE "LDA #$A9", 0293C6-0293CC its nearest player, facing
0293B6  func  goon_bomb_run_in_stop
comment goon_bomb_run_in_stop Step 0: after its run stops (animation A9) facing its nearest player.
# 0293D0 "LDA #$06,X; BITA #$02; BEQ", 0293D7 "LDY #$7F6D; LBSR $862F" (list 2 type 16)
0293D0  func  goon_bomb_run_in_throw
comment goon_bomb_run_in_throw Step 1: at the animation's event throws a bomb.
# 0293E1 "LDA #$06,X; LSRA; BCC; INC #$02,X"
0293E1  func  goon_bomb_run_in_end
comment goon_bomb_run_in_end Step 2: at the animation's end goes to choosing.
# 0293F7 "BSR $740A; LBSR $6144; BRA $7429"
0293F7  func  goon_striker_jump_in_set_up
comment goon_striker_jump_in_set_up Its state 0: a striker goon at its place, running in.
# 02940A "LDU #$7F9B; LDA #$30,X; ASLA; LDD A,U; STD #$0C,X" (goon_jump_in_xs), 029416 "LDA #$30,X; BPL; LDA #$01; STA
# #$1B,X"
02940A  func  goon_jump_in_place
comment goon_jump_in_place Puts it at the x goon_jump_in_xs gives (by its spawn's field 30), with 1 health when its bit 7 is set.
# 029424 "BSR $740A; LBSR $85F9" then 029429
029424  func  goon_jump_in_set_up
comment goon_jump_in_set_up Its state 0: a goon at its place, running in.
# 029429 "LDA #$80; STA #$00,X", 02942E-029435 priority 20, 029438 "LDA #$90", 02943D "LDD #$0200; STD #$0F,X",
# 029443-02944B toward
# the middle, 02944E "INC #$02,X", 029454 "LDD <$E2; STD #$19,X"
029429  func  goon_jump_in_run
comment goon_jump_in_run Shown running (animation 90) toward the middle, riding the cemetery's ground (z speed the scroll's speed); then its entrance.
# 02945B "LDU #$7F9F; LDB #$29,X; ASLB; JMP [B,U]" (7464 749A)
02945B  func  goon_jump_in_step
comment goon_jump_in_step Its entrance (state 1): runs its step.
# 029464 "LBSR $8644; STA #$46,X; TSTA; BMI", 02946D-029472 "STA #$5D,X", 029475-02947C priority 10, 02947F "LDD #$0400;
# STD #$19,X",
# 029485 "LDA #$88; STA #$00,X", 02948A "LDA #$84", 029493 "LDD <$E2; STD #$19,X"
029464  func  goon_jump_in_leap
comment goon_jump_in_leap Step 0: rides the ground until there is floor in front of it, then leaps up (animation 84) onto it.
# 02949A "LBSR $85B1; BCC", 02949F "LDA #$C0; STA #$00,X", 0294A4 "LBSR $8620", 0294A7 "LDA #$02; STA #$02,X"
02949A  func  goon_jump_in_land
comment goon_jump_in_land Step 1: falls with gravity; landing, can be hit, takes its nearest player and goes to choosing.
# 0294B9 "LDU #$7FAF; LDA #$30,X; ASLA; LDD A,U; STD #$0C,X" (goon_from_below_xs), 0294C8 "LDD #$FF80; STD #$16,X",
# 0294CE "LBSR
# $85F9", 0294D1 "LDY #$7F7B; LBSR $85B4", 0294D7 "LDA #$20; STA #$09,X", 0294DC "LDA #$86", 0294E4-0294F1 facing left
# from E0,
# 0294F4 "LDD <$E2; STD #$19,X"
0294B9  func  goon_from_below_set_up
comment goon_from_below_set_up Its state 0: a goon (hit box 7F7B, animation 86) at the x goon_from_below_xs gives, 80 under the floor, riding the cemetery's ground.
# 0294FE "LDU #$7FB3; LDB #$29,X; ASLB; JMP [B,U]" (7507 7546)
0294FE  func  goon_from_below_step
comment goon_from_below_step Its entrance (state 1): runs its step.
# 029507 "LDD #$16,X; BMI", 029511-029518 priority 10, 02951B "LDD #$0400; STD #$19,X", 029521-02952E x speed 0200 the
# way it faces,
# 029531 "LDA #$88; STA #$00,X", 029536 "LDA #$84", 02953F "LDD <$E2; STD #$19,X"
029507  func  goon_from_below_leap
comment goon_from_below_leap Step 0: rides the ground until it is up through the floor, then leaps out (animation 84) forward.
# 029546 "LBSR $85B1; BCC", 02954B "LDA #$C0; STA #$00,X", 029550 "LDY #$7F73; LBSR $85B4", 029556 "LBSR $8620", 029559
# "LDA #$02;
# STA #$02,X"
029546  func  goon_from_below_land
comment goon_from_below_land Step 1: falls with gravity; landing, can be hit with its body's hit box, takes its nearest player and goes to choosing.
# 02956B "LDU #$7FC3; LDA #$30,X; ASLA; LDD A,U; STD #$0C,X" (cemetery_umbrella_goon_xs), 029577 "LBSR $7012", 02957A
# "LDA #$88;
# STA #$00,X", 029582 "LDA #$A1", 029587 "LDA #$01; STA #$3B,X", 02958C-029593 1 health with bit 7, 029599 "INC #$02,X"
02956B  func  cemetery_umbrella_goon_set_up
comment cemetery_umbrella_goon_set_up Its state 0: a goon with an umbrella (animation A1) at the x cemetery_umbrella_goon_xs gives, 1 health with its spawn's bit 7, facing its target.
# 0295A5 "LDD #$19,X; SUBD #$0010; STD #$19,X", 0295AE "LBSR $8662; BCC", 0295B3 "LDA #$C0; STA #$00,X", 0295B8 "LDA
# #$A2", 0295BD
# "INC #$02,X"
0295A5  func  cemetery_umbrella_goon_float_down
comment cemetery_umbrella_goon_float_down Its entrance (state 1): floats down (a sixth of the gravity); landing, can be hit, animation A2, and goes to choosing.

# ---- the goons' entrance fields ----
# the entrance's wait (028672 "DEC #$3C,X", 028796, 0287B8, 02898B, 0285C4; set from goon_entrances 028749,
# hat_goon_jump_in_starts
# 02896C) and the x the scroll must bring it in at (0284FE, 0285B3, 0288E4, 02897F "LDD #$0C,X; CMPD #$3E,X")
scoped object goon 3C entrance_wait u8
scoped object goon 3E trigger_x u16
scoped object hat_goon 3C entrance_wait u8
scoped object hat_goon 3E trigger_x u16
scoped object shovel_goon 3C entrance_wait u8
scoped object hat_goon_waiting 3E trigger_x u16
# its start's flags (0284BE "ORA #$03,U; STA #$3D,X"; 0284D4 "LDA #$3D,X; BPL", 0284DE "LSRA; BCS")
scoped object hat_goon_waiting 3D start_flags u8
# the delayed goon keeps a direction (high byte) and a speed (low) there (028662 "STD #$3E,X", 02867C "LDD #$3E,X; LBSR
# $8617")
scoped object goon_delayed 3C entrance_wait u8
scoped object goon_delayed 3E heading u16
# the descending goon's balloon (02822D "STU #$40,X", 028281 "LDU #$40,X; LDA #$02; STA #$02,U")
scoped object goon_descent 40 balloon u16 object
local goon_descent_set_up 02821C u balloon object

# ======== bank 14: the enemy actions (field 28; their steps by field 29) ========
# each "LDU #table; ASLB; JMP [B,U]" (B the step, from 07D64F "LDD #$28,X"); "done" below is 078635 (07D220: state 2,
# choosing again)
# action 00 (028003 "LBRA $6C61", 7C70: 6C67 6C93 6CA4 6CB5 6CBE): the goons' close and mid ranges
028003  func  goon_wait_then_strike
comment goon_wait_then_strike Action 00: waits facing its target (longer with fewer players), then strikes (animation A4, hit box 7BEE).
# action 01 (028006 "LBRA $6CC8", 7C7F: 6C67 6CCE 6CA4 6CB5 6CBE)
028006  func  goon_wait_then_strike_2
comment goon_wait_then_strike_2 Action 01: waits facing its target, then strikes the other way (animation B2, hit box 7BEE).
# action 02 (028009 "LBRA $6CDF", 7C89: 6CF5 6D00 6CB5 6CBE): every goon behaviour's close range
028009  func  goon_quick_strike
comment goon_quick_strike Action 02: strikes at once (animation A5, hit box 7BFE).
# action 03 (02800C "LBRA $6D11", 7C91: 6D17 6D23 6CB5 6CBE)
02800C  func  goon_quick_strike_2
comment goon_quick_strike_2 Action 03: strikes at once the other way (animation A3, hit box 7C06).
# action 04 (02800F "LBRA $6D34", 7C99: 6D43 6D7E 6DA3 6DD3 6D3A)
02800F  func  goon_jump_attack
comment goon_jump_attack Action 04: by a chance the game's rank gives, jumps at its target and comes down striking; else runs a little.
# action 05 (028012 "LBRA $6DEA", 7CC3: 6D43 6DF0 6DA3 6DD3 6E14 6E4C 6F00); no behaviour picks it and it never ran
028012  func  goon_jump_up_or_grab
comment goon_jump_up_or_grab Action 05: by the rank's chance jumps straight up and comes down striking; else goes for a grab (no behaviour picks it).
# action 06 (028084 "LBRA $7296", 7F27: 729C 72A7 72C3 72DA): goon_with_hat's far range
028084  func  hat_goon_throw_hat
comment hat_goon_throw_hat Action 06: throws its hat (animation AB), waits while it flies and catches it (animation AC).
# action 07 (0280AE "LBRA $7270", 7F21: 7276 7287 7261); no behaviour picks it and it never ran
0280AE  func  goon_strike_and_run
comment goon_strike_and_run Action 07: strikes (animation A4, hit box 7EA7) and runs on through (no behaviour picks it).
# action 0F (028042 "LBRA $6E05", 7CCB: 6E14 6E4C 6F00 6F5F): the goons' close range
028042  func  goon_grab
comment goon_grab Action 0F: walks up to its target and grabs it, holding and squeezing the player until it breaks free or is beaten.
# action 11 (028087 "LBRA $71F8", 7F13: 71FE 720A 715B 7164): goon_with_umbrella's
028087  func  umbrella_goon_strike
comment umbrella_goon_strike Action 11: strikes with the umbrella (animation A0, hit box 7EAF).
# action 12 (02808A "LBRA $721B", 7F1B: 7221 7232 7261): goon_with_umbrella's far range
02808A  func  umbrella_goon_charge
comment umbrella_goon_charge Action 12: runs at its target with the umbrella out (hit box 7EB7) for a time by the distance.
# action 13 (02808D "LBRA $71B9", 7F0B: 71BF 71CB 71E1 71F5)
02808D  func  umbrella_goon_long_strike
comment umbrella_goon_long_strike Action 13: a long strike with the umbrella (animation 92, hit box 7EC7, held 10 frames), then animation A5.
# action 14 (028090 "LBRA $716E", 7EF9: 70D2 7174 7185 715B 7164): goon_with_shovel's mid range
028090  func  shovel_goon_strike
comment shovel_goon_strike Action 14: waits facing its target, then strikes with the shovel (animation A0, hit box 7E97).
# action 15 (028093 "LBRA $7120", 7EEA: 7126 713C 714A 715B 7164): goon_with_shovel's far ranges
028093  func  shovel_goon_far_strike
comment shovel_goon_far_strike Action 15: waits facing its target (shovel_goon_far_strike_waits_by_players), then the long shovel strike (animation 91, hit box 7E9F).
# action 16 (0280B4 "LBRA $7196", 7F03: 719C 71A8 715B 7164): goon_with_umbrella's close and mid ranges
0280B4  func  umbrella_goon_quick_strike
comment umbrella_goon_quick_strike Action 16: strikes at once with the umbrella (animation 91, hit box 7EBF).
# action 17 (0280B7 "LBRA $6B7A", 7C5E: 6B80 6BA4 6BC6 6CB5 6CBE): the fixed goon's mid range
0280B7  func  goon_dash_strike
comment goon_dash_strike Action 17: dashes at its target and, when close in line with it, strikes (animation B8, hit box 7C16).
# action 18 (02805D "LBRA $6BD7", 7C68: 6BE0 6BFA 6C39 6C4D), 028BDD "LBRA $85C9"
02805D  func  goon_keep_distance
comment goon_keep_distance Action 18: with fewer than 3 players present keeps 30 to 50 away from its target for 40 frames, facing the way it moves.
# action 1B (028030 "LBRA $7097", 7ECF: 709D 70A9 7164): the bomb goon's far range
028030  func  bomb_goon_throw
comment bomb_goon_throw Action 1B: throws a bomb (animation 91).
# action 27 (0280BA "LBRA $6AF6", 7C4E: 6B80 6AFC 6B26 6B37 6CB5 6CBE): the striker's and the brawler's far ranges
0280BA  func  goon_approach_strike
comment goon_approach_strike Action 27: runs up to its target and, when close in line with it, strikes (animation B9, sound 4800, hit box 7C1E), then recovers (animation BA).
# action 33 (028033 "LBRA $70CC", 7EDB: 70D2 70FE 710F 715B 7164): goon_with_shovel's close range
028033  func  shovel_goon_close_strike
comment shovel_goon_close_strike Action 33: waits facing its target (shovel_goon_close_strike_waits_by_players), then strikes with the shovel (animation 92, hit box 7E8F).
# action 3D (0280AB "LBRA $6B48", 7C5A: 6B4E 6B71): the brawler's mid range
0280AB  func  goon_back_off
comment goon_back_off Action 3D: walks away from its target for 20 frames.

# ---- the actions' steps ----
# 028AFC "LDD #$2C,X; CMPD #$0040; BCS", 028B04 "DEC #$3B,X", 028B09 "LDD #$2E,X; CMPD #$0008; LBCC $8635", 028B12 "LDA
# #$B9",
# 028B17 "LDD #$4800; LBSR $8680", 028B1D "LDA #$20; STA #$3B,X"
028AFC  func  goon_approach_until_close
comment goon_approach_until_close Action 27, step 1: runs on until within 40 of its target in x (or its time is up); out of line (8 or more in y) gives up, else strikes with sound 4800.
# 028B26 "LDA #$06,X; BITA #$02; BEQ", 028B2D "LDY #$7C1E; LBSR $85B4"
028B26  func  goon_approach_strike_hit
comment goon_approach_strike_hit Action 27, step 2: at the animation's event its strike's hit box.
# 028B37 "DEC #$3B,X", 028B3C "CLRW #$0F,X", 028B3F "LDA #$BA"
028B37  func  goon_approach_strike_recover
comment goon_approach_strike_recover Action 27, step 3: after its time stops (animation BA).
# 028B4E "LBSR $859C", 028B51 "LDA #$86", 028B56 "LDD #$0100; STD #$0F,X", 028B5C-028B63 away from its target, 028B66
# "LDA #$20; STA
# #$3B,X", 028B6E "LBRA $85C9"
028B4E  func  goon_back_off_start
comment goon_back_off_start Action 3D, step 0: faces its target and walks away from it (animation 86) for 20 frames.
# 028B71 "DEC #$3B,X; BNE; LBRA $8635"
028B71  func  goon_back_off_walk
comment goon_back_off_walk Action 3D, step 1: done after its time.
# 028B80 "LBSR $859C", 028B83 "LDA #$90", 028B88 "LDD #$0200; STD #$0F,X", 028B8E-028B95 toward its target, 028B98 "LDA
# #$40; STA
# #$3B,X", 028BA0 "LBRA $85C6"
028B80  func  goon_dash_start
comment goon_dash_start Actions 17 and 27, step 0: runs at its target (animation 90) for up to 40 frames.
# 028BA4 "LDD #$2C,X; CMPD #$0020; BCS", 028BAC "DEC #$3B,X", 028BB1 "CLRW #$0F,X", 028BB4 "LDD #$2E,X; CMPD #$0008;
# LBCC $8635",
# 028BBD "LDA #$B8"
028BA4  func  goon_dash_until_close
comment goon_dash_until_close Action 17, step 1: runs on until within 20 of its target in x (or its time is up), stops; out of line gives up, else strikes (animation B8).
# 028BC6 "LDA #$06,X; BITA #$02; BEQ", 028BCD "LDY #$7C16; LBSR $85B4"
028BC6  func  goon_dash_strike_hit
comment goon_dash_strike_hit Action 17, step 2: at the animation's event its strike's hit box.
# 028BE0 "LDA $1874; CMPA #$03; LBCC $8635", 028BE9 "LDA #$86", 028BEE "LBSR $859C", 028BF1 "LDA #$40; STA #$3B,X"
028BE0  func  goon_keep_distance_start
comment goon_keep_distance_start Action 18, step 0: with 3 players or more present done at once; else faces its target, standing, for up to 40 frames.
# 028BFA "DEC #$3B,X; LBEQ $8635", 028C00 "LDD #$2C,X; CMPD #$0030; BCC", 028C14 "CMPD #$0050; BCC" (028C1C stands),
# 028C23-028C32
# "LDD #$0080" or "#$FF80" toward or away
028BFA  func  goon_keep_distance_check
comment goon_keep_distance_check Action 18, step 1: within 30 of its target steps away, beyond 50 steps closer, between them stands.
# 028C39 "DEC #$3B,X; LBEQ $8635", 028C3F "LDD #$2C,X; CMPD #$0030; BCC", 028C47 "LDA #$01; STA #$29,X"
028C39  func  goon_keep_distance_closing
comment goon_keep_distance_closing Action 18, step 2: stepping closer until within 30.
# 028C4D "DEC #$3B,X; LBEQ $8635", 028C53 "LDD #$2C,X; CMPD #$0050; BCS", 028C5B "LDA #$01; STA #$29,X"
028C4D  func  goon_keep_distance_backing
comment goon_keep_distance_backing Action 18, step 3: stepping away until 50 off.
# 028C67 "LDU #$38,X; LDD #$16,U; CMPD #$5C,U; BNE", 028C72 "LDA #$86", 028C77 "LDU #$7C7A; LDA <$57; LDA A,U; STA
# #$3B,X",
# 028C88 "LDA #$01; STA #$3B,X", 028C85/028C90 "LBRA $859C"
028C67  func  goon_wait_for_target_on_floor
comment goon_wait_for_target_on_floor Actions 00 and 01, step 0: facing its target; with the target on the floor stands for goon_strike_waits_by_players' wait, else for a frame.
# 028C93 "DEC #$3B,X; BNE", 028C98 "LDA #$A4", 028CA0 "LBRA $859C"
028C93  func  goon_wait_then_strike_swing
comment goon_wait_then_strike_swing Action 00, step 1: after its wait strikes (animation A4) facing its target.
# 028CA4 "LDA #$06,X; BITA #$02; BEQ", 028CAB "LDY #$7BEE; LBSR $85B4"
028CA4  func  goon_strike_hit
comment goon_strike_hit Actions 00 and 01, step 2: at the animation's event its strike's hit box (7BEE).
# 028CB5 "LDY #$7BF6; LBSR $85B4; INC #$29,X" then 028CBE
028CB5  func  goon_strike_recover
comment goon_strike_recover A strike's end: back to its body's hit box (7BF6), done at the animation's end.
# 028CBE "LDA #$06,X; LSRA; BCC; LBRA $8635"
028CBE  func  goon_action_end
comment goon_action_end Done at the animation's end.
# 028CCE "DEC #$3B,X; BNE", 028CD3 "LDA #$B2", 028CDB "LBRA $859C"
028CCE  func  goon_wait_then_strike_2_swing
comment goon_wait_then_strike_2_swing Action 01, step 1: after its wait strikes (animation B2) facing its target.
# 028CF5 "LDA #$A5; STA #$05,X; INC #$29,X; LBRA $859C"
028CF5  func  goon_quick_strike_swing
comment goon_quick_strike_swing Action 02, step 0: strikes (animation A5) facing its target.
# 028D00 "LDA #$06,X; BITA #$02; BEQ", 028D07 "LDY #$7BFE; LBSR $85B4"
028D00  func  goon_quick_strike_hit
comment goon_quick_strike_hit Action 02, step 1: at the animation's event its strike's hit box (7BFE).
# 028D17 "LDA #$A3; STA #$05,X; LBSR $859C"
028D17  func  goon_quick_strike_2_swing
comment goon_quick_strike_2_swing Action 03, step 0: strikes (animation A3) facing its target.
# 028D23 "LDA #$06,X; BITA #$02; BEQ", 028D2A "LDY #$7C06; LBSR $85B4"
028D23  func  goon_quick_strike_2_hit
comment goon_quick_strike_2_hit Action 03, step 1: at the animation's event its strike's hit box (7C06).
# 028D3A "DEC #$3B,X; BNE; LBRA $8635"
028D3A  func  goon_jump_attack_run_end
comment goon_jump_attack_run_end Action 04, step 4: its short run done after its time.
# 028D43 "LDU #$7CA3; LDA <$61; LDA A,U; CMPA <$58; BCC" (goon_jump_attack_chances_by_rank), 028D50 "LDA #$90" ...
# 028D58 "LDD #$0180;
# STD #$0F,X", 028D68 "LDA #$10; STA #$3B,X; LDA #$04; STA #$29,X", 028D73 "LDA #$A6"
028D43  func  goon_jump_or_run
comment goon_jump_or_run Actions 04 and 05, step 0: when goon_jump_attack_chances_by_rank's chance comes up crouches to jump (animation A6); else runs the way it faces for 10 frames (animation 90).
# 028D7E "LDA #$06,X; LSRA; BCC", 028D84 "LDA #$A7", 028D89-028D96 x speed 0200 the way it faces, 028D99 "LDD #$0400;
# STD #$19,X"
028D7E  func  goon_jump_attack_leap
comment goon_jump_attack_leap Action 04, step 1: at the animation's end leaps forward (animation A7).
# 028DA3 "LDD #$16,X; SUBD #$5C,X; CMPD #$0004; BCC", 028DAE "LDA #$A8", 028DB3 "LDY #$7BF6; LBSR $85B4", 028DBE "BITA
# #$02",
# 028DC5 "LDY #$7C0E; LBSR $85B4", 028DCB "LDD #$19,X; SUBD #$0040"
028DA3  func  goon_jump_attack_fall
comment goon_jump_attack_fall Actions 04 and 05, step 2: falls (gravity 40) with its strike's hit box (7C0E) from the animation's event; near the floor lands (animation A8) with its body's.
# 028DD3 "LDD #$19,X; SUBD #$0010" then 028DD9
028DD3  func  goon_jump_attack_land
comment goon_jump_attack_land Actions 04 and 05, step 3: comes down the rest of the way (gravity 10).
# 028DD9 "STD #$19,X; LBSR $8662; BCC", 028DE1 "LDA #$A8", 028DE6 "LBRA $8635"
028DD9  func  goon_jump_attack_settle
comment goon_jump_attack_settle Takes the new z speed and moves; on the floor, animation A8 and done.
# 028DF0 "LDA #$06,X; LSRA; BCC", 028DF6 "LDA #$A7", 028DFB "LDD #$0400; STD #$19,X"
028DF0  func  goon_jump_up_leap
comment goon_jump_up_leap Action 05, step 1: at the animation's end leaps straight up (animation A7).
# 028E14 "LDA #$32,X; BMI $6E0B" (028E0B "LDD #$0200; STD #$28,X; LBRA $6CF5": action 02 instead), 028E19 "LDU #$38,X;
# LDA #$02,U;
# BMI", 028E21 "LDA #$3D,U; BEQ", 028E29 "LBSR $859C", 028E2C "LDA #$40; STA #$3B,X", 028E31 "LBSR $861D; LDB #$30; LBSR
# $8617",
# 028E3C "LBRA $85CF"
028E14  func  goon_grab_approach
comment goon_grab_approach Action 0F, step 0: when its field 32 has bit 7 strikes at once instead (action 02); with its target down or already held gives up; else walks at it for up to 40 frames.
# 028E4C "LDU #$38,X", 028E4F "LDA #$00,X; BITA #$20; LBEQ $6EE8" (touching), 028E57 "LDA #$3E,U; BNE", 028E5C "LDA
# #$3D,U; BNE",
# 028E61 "CMPU #$25,X", 028E67-028E83 within 8 in x and 4 in y, both on the floor, 028E85 "LBSR $859F", 028E88 "STX
# #$4B,U", 028E8B
# "LDA #$0C; STA #$3D,U", 028E90-028E95 "ORA #$20; STA #$00,U", 028E98 "LDA #$03; STA #$1E,U", 028E9D-028ECF to the
# player's place,
# its facing and colour, 028ED3 "LDY #$7CD3 ... LDA #$5B,U; LSRA x4; LDA A,Y; ORA #$80; STA #$05,X", 028EE8-028EFD else
# on toward it
028E4C  func  goon_grab_try
comment goon_grab_try Action 0F, step 1: touching its target, close and both on the floor: grabs the player (its fields 4B, 3D, 1E and the hit flag), takes its place and shows the animation of holding that player's character (goon_hold_animations); else keeps walking at it until its time is up.
# 028F00 "CLR #$1D,X", 028F03 "LDU #$38,X; LDA #$3D,U; BEQ $6F32" (broke free), 028F0B "LDA #$1B,U; BEQ $6F5C", 028F10
# "LDA #$58,X;
# CMPA #$02", 028F1A-028F29 the next animation ("LDA A,Y; INCA"), 028F32-028F59 "SUBA #$02" health, state 4, action 2 or
# 3 by
# chance, "LBRA $85E1"
028F00  func  goon_grab_hold
comment goon_grab_hold Action 0F, step 2: holds the player; the player breaking free leaves the goon 2 health less and hurt (reaction 2 or 3 by chance); the player beaten, done; on its turn squeezes (the next animation).
# 028F5F "LDA #$06,X; LSRA; BCC", 028F65 "LDA #$01; STA #$58,X", 028F6A "DEC #$29,X", 028F6D "BRA $6F00"
028F5F  func  goon_grab_squeeze
comment goon_grab_squeeze Action 0F, step 3: at the squeeze's end goes back to holding.
# 02909D "LDA #$91", 0290A2 "LBSR $859C"
02909D  func  bomb_goon_throw_start
comment bomb_goon_throw_start Action 1B, step 0: winds up (animation 91) facing its target.
# 0290A9 "LDA #$06,X; BITA #$02; BEQ", 0290B3 "LDY #$7ED5; LBSR $862F" (list 2 type 16), 0290BB "LDD #$0300; STD
# #$0F,U", 0290C1-0290C8
# "NEGW #$0F,U" by its facing
0290A9  func  bomb_goon_throw_release
comment bomb_goon_throw_release Action 1B, step 1: at the animation's event throws a bomb forward.
# 0290D2 "LDU #$38,X; LDD #$16,U; CMPD #$5C,U; BNE", 0290DD "LDA #$80", 0290E2 "LDU #$7EE5; LDA <$57; LDA A,U; STA
# #$3B,X", 0290F3
# "LDA #$01; STA #$3B,X"
0290D2  func  shovel_goon_wait_for_target
comment shovel_goon_wait_for_target Actions 14 and 33, step 0: facing its target; with the target on the floor stands (animation 80) for shovel_goon_close_strike_waits_by_players' wait, else a frame.
# 0290FE "DEC #$3B,X; BNE", 029103 "LDA #$92"
0290FE  func  shovel_goon_close_swing
comment shovel_goon_close_swing Action 33, step 1: after its wait strikes (animation 92).
# 02910F "LDA #$06,X; BITA #$02; BEQ", 029116 "LDY #$7E8F; LBSR $85B4"
02910F  func  shovel_goon_close_hit
comment shovel_goon_close_hit Action 33, step 2: at the animation's event the shovel's hit box (7E8F).
# 029126 "LDA #$80", 02912B "LDU #$7EF4; LDA <$57; LDA A,U; STA #$3B,X"
029126  func  shovel_goon_far_wait
comment shovel_goon_far_wait Action 15, step 0: stands (animation 80) facing its target for shovel_goon_far_strike_waits_by_players' wait.
# 02913C "DEC #$3B,X; BNE", 029141 "LDA #$91"
02913C  func  shovel_goon_far_swing
comment shovel_goon_far_swing Action 15, step 1: after its wait strikes (animation 91).
# 02914A "LDA #$06,X; BITA #$02; BEQ", 029151 "LDY #$7E9F; LBSR $85B4"
02914A  func  shovel_goon_far_hit
comment shovel_goon_far_hit Action 15, step 2: at the animation's event the long shovel's hit box (7E9F).
# 02915B "LDY #$7E87; LBSR $85B4; INC #$29,X" then 029164
02915B  func  armed_goon_strike_recover
comment armed_goon_strike_recover An armed goon's strike's end: back to its body's hit box (7E87), done at the animation's end.
# 029164 "LDA #$06,X; LSRA; BCC; LBRA $8635"
029164  func  armed_goon_action_end
comment armed_goon_action_end Done at the animation's end.
# 029174 "DEC #$3B,X; BNE", 029179 "LDA #$A0"
029174  func  shovel_goon_swing
comment shovel_goon_swing Action 14, step 1: after its wait strikes (animation A0).
# 029185 "LDA #$06,X; BITA #$02; BEQ", 02918C "LDY #$7E97; LBSR $85B4"
029185  func  shovel_goon_hit
comment shovel_goon_hit Action 14, step 2: at the animation's event the shovel's hit box (7E97).
# 02919C "LDA #$91", 0291A1 "LBSR $859C"
02919C  func  umbrella_goon_quick_swing
comment umbrella_goon_quick_swing Action 16, step 0: strikes (animation 91) facing its target.
# 0291A8 "LDA #$06,X; BITA #$02; BEQ", 0291AF "LDY #$7EBF; LBSR $85B4"
0291A8  func  umbrella_goon_quick_hit
comment umbrella_goon_quick_hit Action 16, step 1: at the animation's event the umbrella's hit box (7EBF).
# 0291BF "LDA #$92", 0291C4 "LBSR $859C"
0291BF  func  umbrella_goon_long_swing
comment umbrella_goon_long_swing Action 13, step 0: strikes (animation 92) facing its target.
# 0291CB "LDA #$06,X; BITA #$02; BEQ", 0291D2 "LDY #$7EC7; LBSR $85B4", 0291D8 "LDA #$10; STA #$3B,X"
0291CB  func  umbrella_goon_long_hit
comment umbrella_goon_long_hit Action 13, step 1: at the animation's event the umbrella's hit box (7EC7), held for 10 frames.
# 0291E1 "DEC #$3B,X; BNE", 0291E6 "LDY #$7E87; LBSR $85B4", 0291EC "LDA #$A5"
0291E1  func  umbrella_goon_long_recover
comment umbrella_goon_long_recover Action 13, step 2: after its time back to its body's hit box, animation A5.
# 0291F5 "LBRA $8635"
0291F5  func  umbrella_goon_long_end
comment umbrella_goon_long_end Action 13, step 3: done.
# 0291FE "LDA #$A0", 029203 "LBSR $859C"
0291FE  func  umbrella_goon_swing
comment umbrella_goon_swing Action 11, step 0: strikes (animation A0) facing its target.
# 02920A "LDA #$06,X; BITA #$02; BEQ", 029211 "LDY #$7EAF; LBSR $85B4"
02920A  func  umbrella_goon_hit
comment umbrella_goon_hit Action 11, step 1: at the animation's event the umbrella's hit box (7EAF).
# 029221 "LBSR $859C", 029224 "LDA #$90", 029229 "LDA #$08; STA #$3B,X"
029221  func  umbrella_goon_charge_start
comment umbrella_goon_charge_start Action 12, step 0: faces its target and starts running (animation 90) for 8 frames.
# 029232 "DEC #$3B,X; BNE", 029237 "LDY #$7EB7; LBSR $85B4" then 02923D
029232  func  umbrella_goon_charge_hit
comment umbrella_goon_charge_hit Action 12, step 1: after 8 frames puts the umbrella's hit box (7EB7) out and runs through.
# 02923D "LDA #$2D,X; LSRA x3; ANDA #$1F; ADDA #$08; STA #$3B,X", 02924A "CLRW #$14,X", 02924D "LDD #$0200; STD #$0F,X",
# 029253-02925A
# the way it faces
02923D  func  goon_run_through
comment goon_run_through Runs on the way it faces for 8 frames plus an eighth of the x distance to its target.
# 029261 "DEC #$3B,X; BNE", 029266 "LDY #$7E87; LBSR $85B4", 02926C "LBRA $8635"
029261  func  goon_run_through_end
comment goon_run_through_end After its run back to its body's hit box, done.
# 029276 "LBSR $859C", 029279 "LDA #$A4", 02927E "LDA #$08; STA #$3B,X"
029276  func  goon_strike_and_run_swing
comment goon_strike_and_run_swing Action 07, step 0: strikes (animation A4) facing its target.
# 029287 "DEC #$3B,X; BNE", 02928C "LDY #$7EA7; LBSR $85B4", 029292 "LBRA $723D"
029287  func  goon_strike_and_run_hit
comment goon_strike_and_run_hit Action 07, step 1: after 8 frames its strike's hit box (7EA7), and runs through.
# 02929C "LDA #$AB", 0292A4 "LBRA $859C"
02929C  func  hat_goon_throw_start
comment hat_goon_throw_start Action 06, step 0: winds up (animation AB) facing its target.
# 0292A7 "LDA #$06,X; BITA #$02; BEQ", 0292AE "LDY #$7F2F; LBSR $862F" (list 2 type 02, bank 15's 02A075), 0292B4 "LBCC
# $8635",
# 0292B7 "STU #$40,X", 0292BA "LDA #$30; STA #$3B,X"
0292A7  func  hat_goon_throw_release
comment hat_goon_throw_release Action 06, step 1: at the animation's event throws its hat (list 2 type 02) and keeps it in field 40; no room, done.
# 0292C3 "LDU #$40,X; LDA #$00,U; LBEQ $8635", 0292CC "DEC #$3B,X", 0292D1 "LDA #$AC"
0292C3  func  hat_goon_throw_wait
comment hat_goon_throw_wait Action 06, step 2: done once the hat is gone; after 30 frames catches it (animation AC).
# 0292DA "LDA #$06,X; LSRA; BCC; LBRA $8635"
0292DA  func  hat_goon_throw_end
comment hat_goon_throw_end Action 06, step 3: done at the animation's end.
# the thrown hat (0292B7 "STU #$40,X", 0292C3 "LDU #$40,X")
scoped object hat_goon_throw 40 hat u16 object
local hat_goon_throw_release 0292B1 u hat object
local bomb_goon_throw_release 0290B6 u bomb object

# ======== bank 14: the goons' bomb (list 2 type 16) ========
# 0292EF "LDU #$7F51; LDB #$29,X; ASLB; JMP [B,U]" (72F8 7308): its state -1, from 07CF97's hit reaction (state FF)
0292EF  func  goon_bomb_broken
comment goon_bomb_broken Struck (state -1): runs its step.
# 0292F8 "CLRW #$0F,X; CLRW #$19,X", 0292FE "LDD #$0480; STD #$04,X" (kind 04 hit sparks, animation 80)
0292F8  func  goon_bomb_break
comment goon_bomb_break Stops and shows hit sparks.
# 029308 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
029308  func  goon_bomb_break_end
comment goon_bomb_break_end Gone at the sparks' end.
# 029312 "LDU #$7F55; LBSR $85AB" (setup 8034: the goon set's animation 34), 029318 "LDD #$0200; STD #$19,X", 02931E
# "LDD #$0200;
# STD #$0F,X", 029324-02932E the way its thrower (field 40) faces, 029331 "LDA #$C8; STA #$00,X"
029312  func  goon_bomb_set_up
comment goon_bomb_set_up Its state 0: a bomb (the goon set's animation 34) thrown up and forward the way its thrower faces.
# 02933A "LBSR $85B1; BCC", 02933F "CLRW #$0F,X", 029342 "LDD #$9C8A; STD #$04,X", 029348 "LDA #$C0; STA #$00,X", 02934D
# "LDY #$7F3D;
# LBSR $85B4", 029356 "LDD #$6F00; LBRA $8680"
02933A  func  goon_bomb_fly
comment goon_bomb_fly Flying (state 1): falls with gravity; landing, explodes (kind 9C animation 8A) with a hit box and sound 6F00.
# 02935D "LDA #$80; STA #$00,X; INC #$02,X" then 029365
02935D  func  goon_bomb_explode
comment goon_bomb_explode Exploding (state 2): its flags back to 80, then waits for the explosion's end.
# 029365 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
029365  func  goon_bomb_explosion_end
comment goon_bomb_explosion_end Gone at the explosion's end.

# ======== banks 15-17 ========
# ======== banks 15, 16, 17: names of the functions, files, families' fields and work RAM variables ========
# Places are offsets of the program region; evidence quotes are the
# listing's (build\listing\simpsons.s) or the C's (src\unsorted\bank_1X.c, OBJECT(x)->unk_NN written @NN here).
#
# How each handler was told apart (common evidence for everything below):
# - The object lists' dispatchers pick a bank and a handler by the object's type (field 01): list 0 = 4F80 (07CB6C
#   "LDU #$F387" / 07CB7E "LDU #$F2EC"), list 1 = 5280 (07CBAD "LDU #$F4B0" / 07CBBF "LDU #$F40D"), list 2 = 4D40
#   (07CBE0 "LDU #$F54C" / 07CBF2 "LDU #$F4F4"), list 3 = 5640 (07CC0F "LDU #$F581" / 07CC21 "LDU #$F577"), and the
#   enemies' actions by field 28 (07D64C "LDU #$F620" / 07D65E "LDU #$F5A2"). A small script over the ROM image read
#   those tables: e.g. list 0 type FB -> bank 15 6000 = 02A000; each "list N type T" below is that.
# - The stages a type is put in: assets/data/spawns.txt (spawn_lists[scene], the list in the spawn's flags bits 2-3),
#   "sN" = scene N (0 stage 1, 1 stage 2, 3/4 stage 3 forest/cemetery, 5 stage 4, 6 stage 5, 8 stage 6, 9 stage 7,
#   B stage 8).
# - The kind (field 04, the sprite set) from the setup each start step loads ("LDU #$xxxx; LBSR $85AB" -> 07D132
#   "LDD ,U; ORB #$80; STD #$04,X"), named as tools/extract_assets.py SET_NAMES names it (kind_XX where it does not).
# - Each type's handler (the LBRA at the bank's start, with the code it jumps to) switches on the object's step
#   (field 02: the dispatcher's "LDD #$01,X" leaves it in B, "ASLB; JSR [B,U]"); a step's own substeps go by field
#   29 (or 28, or 37). An enemy's steps 2-5 are the fixed program's shared fight (sub_0785DB -> 07D49C picks an
#   action, sub_0785DE -> 07D63B runs it, sub_0785E1 / sub_0785E4 / sub_07865C the reactions), then sub_078596
#   (07D056, the hit reaction) and sub_0785B7 (07D1F7, gone past x 01C0).
# - Fixed-program helpers the steps call, as the listing shows them: sub_0785AB (07D132: the object setup), sub_0785B4
#   (07D1B7: a hit box into fields 1C-24), sub_0785B1 (07D16E: gravity, carry when it lands), sub_078662 (07D1B0:
#   landing while falling), sub_0785C6 (07D232: face the x speed's way), sub_0785C9 (07D249: face the target by field
#   36), sub_07859C (07D0FC: face by field 36), sub_078620 (07D301: the nearest player into 38), sub_078626 (07D35B: the
#   distance and angle to it, fields 2C 2E 36), sub_078617 (07CC8E: speeds from a direction and a speed), sub_07861D
#   (07CCFB: the angle to another object), sub_078638 (079495: the floor cell under the object), sub_07863B / 078644 /
#   078647 (0794D9 / 0794B9 / 0794C9: the floor cell ahead), sub_078650 (07948C: the floor map cell's address),
#   sub_07862C (07CA8A: a child object from an 8-byte child_object record), sub_07862F (07CA9E: a child in list 2),
#   sub_078680 (0797D3: queue a sound), sub_078683 (07D1E3: gone off screen), sub_078674 (07C0E0: hurts the enemies
#   it touches), sub_078593 (07CF97: what a player's hit does to it).

# ======== bank 15 ========

# the jump vectors at the bank's start, each a type's handler: one file for the bank's dispatch entries
02A000  file  objects/bank_entries    # each object bank's jump table: the handlers the object lists' dispatchers and the enemies' actions reach

# ---- the fat goons' handlers (list 0, kind 81 fat_goon; behaviours by their enemy_behaviour's actions) ----
# list 0 type FB (s5, s6): step 0 sub_02A110 (behaviour 02B65A: close range actions 38 38 0C 38, the grab), 2-5 the
# shared fight, then 0785B7/078596 like every enemy
02A000  func  fat_goon_grabber_update
comment fat_goon_grabber_update Runs a fat goon that grabs: its start, then the enemies' shared fight by its step.
# list 0 type 0F (s1, s5, s9, and object 15's list 6): step 0 sub_02A1B1 (kind 85, behaviour 02B762)
02A003  func  kind_85_update
comment kind_85_update Runs the kind 85 fighter (set up like a fat goon): its start, then the enemies' shared fight by its step.
# list 0 type E9 (s0) and list 1 type EC (s1): steps 02B44E (setup 7F63, kind C3) ... (police_car_arrivals)
02A006  func  police_car_update
comment police_car_update Runs the police car by its step: drives in, stops, then reacts to the players' hits.
# action 09 (07D65E's table F5A2 entry 09 -> 6009): "u = 0x7950" the action's steps, starting at sub_02A887
02A009  func  fat_goon_walk_up_strike_update
comment fat_goon_walk_up_strike_update Runs enemy action 09: the fat goon walks up to its target and strikes.
# action 0A: steps from 795C, the first sub_02A91F (animation AA, then the jump)
02A00C  func  fat_goon_body_slam_update
comment fat_goon_body_slam_update Runs enemy action 0A: the fat goon jumps and lands on its target.
# action 0B: steps from 796A: sub_02A9B0, sub_02A9DC (animation AB), sub_02A9ED (hit box 7924)
02A00F  func  fat_goon_strike_update
comment fat_goon_strike_update Runs enemy action 0B: the fat goon winds up and strikes (animation AB).
# action 0C: steps from 7979: sub_02A9B0, sub_02AA04 (animation A3), sub_02AA15 (hit box 792C)
02A012  func  fat_goon_reach_strike_update
comment fat_goon_reach_strike_update Runs enemy action 0C: the fat goon winds up and strikes further out (animation A3).
# list 0 type 12 (s1, s5, s6, s9): steps sub_02A4D6, sub_02A4F2 (the thrower)
02A015  func  fat_goon_thrower_update
comment fat_goon_thrower_update Runs the fat goon that carries an obstacle in and throws it, then fights.
# list 0 type 35 (s1): steps sub_02A6AE, sub_02A70F (the descent under a balloon)
02A018  func  fat_goon_descent_update
comment fat_goon_descent_update Runs the fat goon that comes down from far away under a balloon, then fights.
# list 1 type 34: steps sub_02A77B ... sub_02A7C4 (setup 78FE: the goon set's animation 36)
02A01B  func  descent_balloon_update
comment descent_balloon_update Runs the balloon a descending fat goon lets go of, by its step.
# list 0 type 28 (s5, s6, s9): steps sub_02A3B3, sub_02A3C3 (field 30 the frames it walks in)
02A01E  func  fat_goon_walk_in_update
comment fat_goon_walk_in_update Runs the fat goon that walks in for a time and then fights.
# list 0 type 2C: steps sub_02A64F, sub_02A685 (delayed_fat_goon_starts)
02A021  func  fat_goon_delayed_update
comment fat_goon_delayed_update Runs the fat goon that shows after a wait and moves onto the floor, then fights.
# list 0 type 2D (s1, s5, object 15's lists 3, 4): steps sub_02A431, sub_02A454 (fat_goon_from_back_xs)
02A024  func  fat_goon_from_back_update
comment fat_goon_from_back_update Runs the fat goon that comes from the back of the stage, then fights.
# action 29: steps from 7948: sub_02A811 (animation B2), sub_02A824 (sound 7600, hit box 790C)
02A027  func  fat_goon_bump_update
comment fat_goon_bump_update Runs enemy action 29: the fat goon backs into its target.
# action 0E: steps from 7985 (7979 + 0C): sub_02AA33 (animation A3), sub_02AA3F (hit box 7934, sound 2000)
02A02A  func  fat_goon_heavy_strike_update
comment fat_goon_heavy_strike_update Runs enemy action 0E: the strongest strike (hit box 7934), with sound 2000.
# action 0D: steps from 7983, the first sub_02AA2C (an RTS): no scenario runs it (0/4)
02A02D  func  fat_goon_idle_action_update
comment fat_goon_idle_action_update Runs enemy action 0D, whose first step does nothing, so the action never ends.
# list 0 type 36: steps sub_02A334, sub_02A359 (fat_goon_entrances)
02A030  func  fat_goon_entrance_update
comment fat_goon_entrance_update Runs the fat goon that walks up the screen into the stage, onto the ground, then fights.
# list 0 type 13: steps sub_02A205, sub_02A21B (fat_goon_drop_routes)
02A033  func  fat_goon_drop_update
comment fat_goon_drop_update Runs the fat goon that drops in and walks a route to its floor, then fights.
# list 1 type 3D (s1, s5, s6, s8): steps sub_02B0AF, sub_02B0D9 (props)
02A036  func  prop_update
comment prop_update Runs a prop standing in the stage until the scroll takes it away.
# list 1 type 3E (s1): steps sub_02AFF8 ... sub_02B098 (setup 7E13, kind B2)
02A039  func  caged_gorilla_leaper_update
comment caged_gorilla_leaper_update Runs the kind B2 object that leaps off when its bear starts, by its step.
# list 1 type FD (s1, Krustyland): steps sub_02AF36 ... sub_02AFE3 (krustyland_doors)
02A03C  func  krustyland_door_update
comment krustyland_door_update Runs a Krustyland door that opens to let out objects, by its step.
# list 0 type 38: steps sub_02A334, sub_02A2E5
02A03F  func  fat_goon_entrance_to_floor_update
comment fat_goon_entrance_to_floor_update Runs the fat goon that walks up the screen into the stage, onto any floor, then fights.
# list 1 type F8 (s1): steps sub_02AEA5 ... sub_02AF2C (setup 7DA2, kind AB)
02A042  func  drink_vendor_update
comment drink_vendor_update Runs the kind AB object that lets out an object each time it is hit, three times.
# list 1 type F7 (s1): steps sub_02AE76 ... sub_02AE9B (setup 7D88, kind AC)
02A045  func  burger_eater_update
comment burger_eater_update Runs the kind AC object that drops food, by its step.
# list 0 type 3A (s5, s6): steps sub_02A1CA, sub_02A1E3, then the drop's
02A048  func  fat_goon_waiting_update
comment fat_goon_waiting_update Runs the fat goon that stands out of play until it comes on screen or is hit, then fights.
# action 38: steps from 798D (7979 + 14): sub_02AA5C, sub_02AA94 (the hold), sub_02AB52
02A04B  func  fat_goon_grab_update
comment fat_goon_grab_update Runs enemy action 38: the fat goon goes for its target, grabs it and squeezes.
# list 0 type FA (s9): step 0 sub_02A13C (behaviour 02B6B2: close range actions 0B 0B 0C 0B)
02A04E  func  fat_goon_puncher_update
comment fat_goon_puncher_update Runs a fat goon that strikes: its start, then the enemies' shared fight.
# list 0 type 0E (s1, s5, s9): step 0 sub_02A0B8 (setup 764C, behaviour 02B5E8)
02A051  func  fat_goon_update
comment fat_goon_update Runs the plain fat goon: its start, then the enemies' shared fight.
# list 0 type EF (s4, the cemetery): steps sub_02ABCC, sub_02AC15 (fat_goon_jump_in_xs)
02A054  func  fat_goon_jump_in_update
comment fat_goon_jump_in_update Runs the fat goon that jumps in from a side of the cemetery, then fights.
# list 0 type F0 (s4): steps sub_02AC7C, sub_02ACC0 (fat_goon_from_below_xs)
02A057  func  fat_goon_from_below_update
comment fat_goon_from_below_update Runs the fat goon that comes up from below the cemetery's floor, then fights.
# list 3 type 00 (5640, every stage): steps sub_02AD71, sub_02AD74 (field 30 the enemies it waits for)
02A05A  func  scroll_lock_update
comment scroll_lock_update Runs the stage event that holds the scroll while there are more enemies than its count.
# list 3 type 01 (s1, s3, s6, s9): steps sub_02AD8F ... sub_02AE31 (object_15_spawn_lists); "unk_48A7--" each frame
02A05D  func  enemy_waves_update
comment enemy_waves_update Runs the stage event that holds the scroll and puts in waves of enemies, by its step.
# list 3 type 04 (s9, stage 7): steps sub_02AD21, sub_02AD47
02A060  func  cleared_wave_update
comment cleared_wave_update Runs the stage event that puts in objects and, once no enemy is left, two more goons.
# list 1 type F0 (s4): steps sub_02B211, sub_02B23A; "if ((uint16_t)(t1 + 0x80u) >= 0x120u) @flags = 0u"
02A063  func  cemetery_piece_update
comment cemetery_piece_update Runs a cemetery piece bobbing with the stage, gone out of its height range.
# list 1 type EF (sB, stage 8): steps sub_02B0EB, sub_02B0FE (setup 7E57, kind AA animation 05)
02A066  func  poster_update
comment poster_update Runs the kind AA object that stands still in stage 8.
# list 1 type EE (s9, stage 7): steps sub_02B105, sub_02B131 (setup 7E61, kind AA animation 03)
02A069  func  poster_pair_update
comment poster_pair_update Runs the kind AA objects of stage 7 that come in pairs, gone near the left edge.
# list 1 type EB (s5, stage 4): steps sub_02B146 ... sub_02B18E (setup 7E79, kind CB)
02A06C  func  bleeding_gums_murphy_update
comment bleeding_gums_murphy_update Runs the kind CB object that reacts to three hits, by its step.
# list 2 type 27 (no spawn list holds one: the spawns of type 27 are list 1's, bank 17's food): steps sub_02B1A4,
# sub_02B1DA (dream_ball_flings)
02A06F  func  dream_ball_fling_update
comment dream_ball_fling_update Runs the kind D1 piece flung off, shrinking until it vanishes.
# list 1 type 07: steps sub_02B24A, sub_02B283; no spawn list holds a list 1 type 07 and no scenario runs it (0/5)
02A072  func  floor_blocker_update
comment floor_blocker_update Runs the kind 0F scenery that writes its shape into the floor map as the scroll brings it in; nothing puts one in.
# list 2 type 02: steps sub_02B392 ... (setup 7F3F: kind 84 goon_with_hat, animation 2A), the hit check after
02A075  func  goon_hat_update
comment goon_hat_update Runs the hat a goon with a hat throws: it flies out and back, hurting what it touches.
# list 2 types 03 and 04: "02A078 LBRA $7413", "02A07B LBRA $7414", both an RTS; nothing puts in one
02A078  func  empty_child_type_03_handler
comment empty_child_type_03_handler Unused: the handler of list 2's type 03, which does nothing; no object of that type is put in.
# "02A07B LBRA $7414": an RTS
02A07B  func  empty_child_type_04_handler
comment empty_child_type_04_handler Unused: the handler of list 2's type 04, which does nothing; no object of that type is put in.
# list 0 type E6 (s6, s9): step 0 sub_02A188 (behaviour 02B70A: actions 38 close, 0A at range 3)
02A07E  func  fat_goon_jumper_update
comment fat_goon_jumper_update Runs a fat goon that grabs and body-slams: its start, then the enemies' shared fight.
# action 3E: steps from 7944: sub_02A7DF (animation 86, walking away from the target), sub_02A802
02A081  func  fat_goon_back_off_update
comment fat_goon_back_off_update Runs enemy action 3E: the fat goon walks away from its target for a while.
# list 1 type DD (s5, stage 4): steps sub_02AE47, sub_02AE5B (setup 7D72, kind 9E)
02A084  func  moe_spawner_update
comment moe_spawner_update Runs the kind 9E object that puts in another object once the camera gets there.

# ---- the fat goons ----
02A093  file  objects/fat_goon    # the fat goons (kind 81): their setups, entrances and starts
# "u = object_setup_02B64C_ADDRESS; y = sub_0785AB(x, u)" (kind 81 animation 01), "@unk_42 = 2u", sub_078620,
# "@unk_2A = enemy_behaviour_02B5E8_ADDRESS", "@unk_3A = 0x10u"; called by every entrance below
02A093  func  fat_goon_setup
comment fat_goon_setup Sets a fat goon up: its sprite, hit box and life, facing the nearest player, the plain fat goon's behaviour.
# type 0E's step 0: "sub_02A093(x...)", "if (t1 != 0u) @unk_1B = 8u", "@unk_02 = 2u"
02A0B8  func  fat_goon_start
comment fat_goon_start Sets up the plain fat goon (with less life when its spawn's state is set) and lets it fight at once.
# "y = sub_02A149(x); @unk_2A = enemy_behaviour_02B65A_ADDRESS"
02A107  func  fat_goon_grabber_setup
comment fat_goon_grabber_setup Sets a fat goon up with the grabbing behaviour.
# type FB's step 0: sub_02A107, sub_02A168, "@unk_30 = 0u; @unk_02 = 2u"
02A110  func  fat_goon_grabber_start
comment fat_goon_grabber_start Sets up the grabbing fat goon and lets it fight at once.
# "y = sub_02A149(x); @unk_2A = enemy_behaviour_02B6B2_ADDRESS"
02A133  func  fat_goon_puncher_setup
comment fat_goon_puncher_setup Sets a fat goon up with the striking behaviour.
# type FA's step 0
02A13C  func  fat_goon_puncher_start
comment fat_goon_puncher_start Sets up the striking fat goon and lets it fight at once.
# "u = object_setup_02B7C6_ADDRESS" (kind 81 animation 00), "@unk_3A = 0x10u", "@unk_42 = 2u", sub_078620, sub_078626;
# no behaviour: its callers give one
02A149  func  fat_goon_base_setup
comment fat_goon_base_setup Sets a fat goon up without a behaviour: its sprite, hit box and life, facing the nearest player.
# "t1 = @unk_30; if (t1 != 0u) @unk_1B = 8u" (field 1B the life the hits take: 07C274)
02A168  func  fat_goon_weaken
comment fat_goon_weaken Gives the fat goon less life when its spawn's state is set.
# "y = sub_02A149(x); @unk_2A = enemy_behaviour_02B70A_ADDRESS"
02A17F  func  fat_goon_jumper_setup
comment fat_goon_jumper_setup Sets a fat goon up with the grabbing and body-slamming behaviour.
# type E6's step 0
02A188  func  fat_goon_jumper_start
comment fat_goon_jumper_start Sets up the grabbing and body-slamming fat goon and lets it fight at once.
# "y = sub_02A149(x); sub_02A168(x); @unk_04 = 0x85u; @unk_2A = enemy_behaviour_02B762_ADDRESS" (its ranges all
# action 0E)
02A1A1  func  kind_85_setup
comment kind_85_setup Sets the kind 85 fighter up on a fat goon's setup: its own sprites and a behaviour of heavy strikes only.
# type 0F's step 0
02A1B1  func  kind_85_start
comment kind_85_start Sets up the kind 85 fighter and lets it fight at once.
# type 3A's step 0: sub_02A093, "@unk_05 = 0xB3u; @unk_57 = 1u"
02A1CA  func  fat_goon_waiting_start
comment fat_goon_waiting_start Sets up the fat goon that stands still (animation B3) out of play.
# type 3A's step 1: "if ((@flags & 0x20u) == 0u) { if (t1 < 0x100u) { @unk_57 = 0u; step + 1 } } else { ... }"
02A1E3  func  fat_goon_waiting
comment fat_goon_waiting Keeps the standing fat goon out of play until it is hit or comes past x 0100, then lets it fight.
# type 13's step 0: sub_02A093, "@flags = 0x80u; @unk_09 = 0x20u; @unk_05 = 0xB3u"
02A205  func  fat_goon_drop_start
comment fat_goon_drop_start Sets up the dropping fat goon, shown at once.
# type 13's step 1: switch on field 29 into the drop's substeps
02A21B  func  fat_goon_drop_route_update
comment fat_goon_drop_route_update Runs the dropping fat goon's route by its substep.
# "@unk_19 = 0xFF00u; @unk_3B = 0x60u"
02A225  func  fat_goon_drop_fall
comment fat_goon_drop_fall Starts the fat goon falling for 96 frames.
# "fat_goon_drop_route = fat_goon_drop_routes_ADDRESS + ...", "@unk_29 = next_step >> 8; @unk_3D = d; @unk_3C = wait"
02A234  func  fat_goon_drop_take_route
comment fat_goon_drop_take_route When the fall ends, takes its route by its spawn's state: the substep to go on with, the floor to walk to, the wait.
# "@unk_0F = 0xFF80u; @unk_14 = 0xFF80u; @unk_05 = 0x91u"
02A258  func  fat_goon_drop_walk_up_left
comment fat_goon_drop_walk_up_left Starts the fat goon walking up and to the left.
# sub_078638, "if ((uint8_t)((a & 0xFu) << 3) != t1)" against field 3D; "@unk_09 = 0x10u" when 3C runs out; then
# "@flags = 0xC0u; @unk_02 = 2u"
02A26A  func  fat_goon_drop_walk_to_floor
comment fat_goon_drop_walk_to_floor Walks until the floor under it is the route's floor, then lets the fat goon fight.
# "@unk_0F = 0x80u; @unk_3B = 0x20u"
02A28E  func  fat_goon_drop_walk_right
comment fat_goon_drop_walk_right Starts the fat goon walking right for 32 frames.
# "if (t1 == 1u) { @unk_0F = 0u; @unk_3B = 0x60u; ... }"
02A29D  func  fat_goon_drop_stop
comment fat_goon_drop_stop Stops the fat goon after its walk and waits 96 frames.
# "if (t1 == 1u) { @unk_19 = 0xFF00u; @unk_3B = 0x60u; ... }"
02A2AE  func  fat_goon_drop_fall_again
comment fat_goon_drop_fall_again After the wait, starts the fat goon falling again.
# "if (t1 == 1u) { @unk_14 = 0xFF80u; @unk_19 = 0u; @unk_05 = 0x91u; ... }"
02A2C2  func  fat_goon_drop_walk_up
comment fat_goon_drop_walk_up After the second fall, starts the fat goon walking up.
# type 38's step 1: switch on field 29: sub_02A2EE, sub_02A398, sub_02A2FC, sub_02A62C
02A2E5  func  fat_goon_entrance_to_floor_steps
comment fat_goon_entrance_to_floor_steps Runs the steps of the fat goon that walks up onto any floor, by its substep.
# "@flags = 0x80u; @unk_09 = 0x10u"
02A2EE  func  fat_goon_entrance_show
comment fat_goon_entrance_show Shows the fat goon with sprite priority 1 (field 09 bits 4-5).
# sub_078638, "if ((int8_t)a >= 0)" (07948C's bit 7: no floor), then priority and "@unk_5C" from the cell
02A2FC  func  fat_goon_reach_any_floor
comment fat_goon_reach_any_floor Waits until there is floor under the fat goon, then takes that floor's height and priority.
# "sub_02A093", "@unk_05 = 0x91u", "wait = ... GOON_ENTRANCE(fat_goon_entrances_ADDRESS + ...)", "@unk_3B = 8u"
02A334  func  fat_goon_entrance_start
comment fat_goon_entrance_start Sets up the entering fat goon: its wait and attributes by its spawn's state.
# type 36's step 1: switch on field 29
02A359  func  fat_goon_entrance_steps
comment fat_goon_entrance_steps Runs the steps of the fat goon stepping out onto the ground, by its substep.
# "@flags = 0x80u; if ((int8_t)t1 >= 0) @unk_29 = 3u" (state bit 7 clear skips the pose)
02A362  func  fat_goon_entrance_appear
comment fat_goon_entrance_appear Shows the fat goon; without a pose in its spawn's state it goes straight to walking out.
# "if (t1 == 1u) { @unk_05 = 0xB1u; ... }"
02A376  func  fat_goon_entrance_pose
comment fat_goon_entrance_pose After its wait, starts the fat goon's pose (animation B1).
# "if (t1 & 1u) { @unk_3C = 1u; @unk_05 = 0x91u; ... }" (field 06 bit 0: the animation ended)
02A384  func  fat_goon_entrance_pose_end
comment fat_goon_entrance_pose_end When the pose ends, starts the walking animation.
# "if (t1 == 1u) { @unk_14 = 0xFF00u; ... }"
02A398  func  fat_goon_entrance_walk_out
comment fat_goon_entrance_walk_out After its wait, starts the fat goon walking up the screen.
# type 28's step 0: sub_02A093, "@unk_3B = t1" (field 30)
02A3B3  func  fat_goon_walk_in_start
comment fat_goon_walk_in_start Sets up the fat goon that walks in for as many frames as its spawn's state says.
# type 28's step 1: switch on field 29, then the floor's priority each frame
02A3C3  func  fat_goon_walk_in_steps
comment fat_goon_walk_in_steps Runs the steps of the walking-in fat goon by its substep, keeping its priority by the floor.
# "@unk_05 = 0x90u; @unk_0F = 0x200u", negated by field 36, sub_0785C9
02A3F2  func  fat_goon_walk_in_go
comment fat_goon_walk_in_go Starts the fat goon walking towards its target.
# "if (t1 != 1u) return u;" then sub_078620, sub_078626, sub_07866B, "@unk_02 = 2u"
02A40D  func  fat_goon_walk_in_end
comment fat_goon_walk_in_end When the walk's frames run out, faces the nearest player and lets the fat goon fight.
# type 2D's step 0: sub_02A093, "@unk_05 = 0x83u", priority 10, sub_078620, sub_0785C9
02A431  func  fat_goon_from_back_start
comment fat_goon_from_back_start Sets up the fat goon coming from the back of the stage, facing the nearest player.
# type 2D's step 1: switch on field 29
02A454  func  fat_goon_from_back_steps
comment fat_goon_from_back_steps Runs the steps of the fat goon coming from the back, by its substep.
# "@unk_0C = fat_goon_from_back_xs[...]; @unk_11 = 0x40u; @unk_14 = 0x100u"
02A45D  func  fat_goon_from_back_place
comment fat_goon_from_back_place Puts the fat goon at the back of the stage, at the x its spawn's state picks, walking down.
# sub_078638, "if ((int8_t)a >= 0) { ... @flags = 0xC0u; @unk_3B = 0x20u; ... }", "if ((unk_4815 & 7u) != 0u)"
02A47E  func  fat_goon_from_back_walk
comment fat_goon_from_back_walk Walks down until there is floor under it, facing its target every 8 frames.
# "if (t1 != 1u) { ... face the target every 8 frames } else step + 1"
02A4A2  func  fat_goon_from_back_wait
comment fat_goon_from_back_wait Waits 32 frames on the floor facing its target, then lets the fat goon fight.
# type 12's step 0: "@unk_3C = t1" (field 30), sub_02A093, "@unk_05 = 0xA6u", the floor height into 45
02A4D6  func  fat_goon_thrower_start
comment fat_goon_thrower_start Sets up the fat goon that carries an obstacle, walking for as many steps as its spawn's state says.
# type 12's step 1: switch on field 29; sub_07863B, "if (a != t2) { @unk_0F = 0u; @unk_14 = 0u; }"
02A4F2  func  fat_goon_thrower_steps
comment fat_goon_thrower_steps Runs the thrower's steps by its substep, stopping where the floor ahead changes.
# "y = child_object_02B8AC_ADDRESS; sub_07862C(...)" (list 1 type 28: bank 16's carried obstacle, setup 7C91 kind 05),
# "@unk_40 = u", "mem_write8(u + 0x3Du, 1u)"; no free slot: "@unk_02 = 2u"
02A4FE  func  fat_goon_thrower_pick_up
comment fat_goon_thrower_pick_up Puts in the obstacle the fat goon carries on its head and starts it walking; without a free slot it fights at once.
# "mem_write16(u + 0xCu, t10) ... mem_write16(u + 0x16u, t13)" (z + 44), "@unk_05 = 0xA7u" when 3C runs out or the
# target is close ("if (t14 >= 0x10u)", "if (t15 >= 0x60u)")
02A535  func  fat_goon_thrower_carry
comment fat_goon_thrower_carry Walks with the obstacle on its head, and starts the throw when its steps run out or the target is near.
# "if ((t1 & 2u) == 0u) return u;" then "mem_write8(u + 2u, 2u); mem_write16(u + 0xFu, 0x380u); mem_write16(u + 0x19u, 0x100u)"
02A5C5  func  fat_goon_thrower_throw
comment fat_goon_thrower_throw At the throw's frame, sends the carried obstacle flying the way the fat goon faces.
# "if (t1 != 1u) return; @unk_02 = 2u"
02A5F3  func  fat_goon_thrower_end
comment fat_goon_thrower_end After the throw, waits 32 frames and lets the fat goon fight.
# sub_078638, "if ((int8_t)a >= 0 && (a & 0xFu) == 0u)" (the floor at height 0), priority and "@unk_5C"
02A5FC  func  fat_goon_reach_ground
comment fat_goon_reach_ground Waits until the fat goon is over the ground floor, then takes its priority and height.
# "if (t1 == 1u) { @unk_30 = 0u; @flags = 0xC0u; @unk_0F = 0u; @unk_14 = 0u; step + 1 }"
02A62C  func  fat_goon_entrance_end
comment fat_goon_entrance_end After its last wait, stops the fat goon and lets it fight.
# type 2C's step 0: sub_02A133, "@unk_05 = 0x82u", "@flags = 8u" (hidden), "delayed_start = delayed_fat_goon_starts..."
02A64F  func  fat_goon_delayed_start
comment fat_goon_delayed_start Sets up the hidden fat goon: its wait, its floor wait and the direction and speed it comes in by.
# type 2C's step 1: switch on field 29
02A685  func  fat_goon_delayed_steps
comment fat_goon_delayed_steps Runs the delayed fat goon's steps by its substep.
# "if (t1 != 1u) return; @flags = 0x80u; ... sub_078617(x, d)" (fields 3E-3F: direction and speed)
02A68E  func  fat_goon_delayed_appear
comment fat_goon_delayed_appear When its wait runs out, shows the fat goon and starts it moving by its direction and speed.
# type 35's step 0: "y = child_object_02B8E6_ADDRESS; sub_07862C" (list 1 type 34, the balloon), "@unk_05 = 0xAFu",
# "@unk_3B = 0x68u", "x_2 = DESCENT_START(...)->x", "@unk_16 = 0xE0u", "@unk_0A = 0x10u"
02A6AE  func  fat_goon_descent_start
comment fat_goon_descent_start Sets up the fat goon coming down from far away, small and high, with the balloon it will let go of.
# type 35's step 1: switch on field 29, then sub_0785C9
02A70F  func  fat_goon_descent_steps
comment fat_goon_descent_steps Runs the descending fat goon's steps by its substep, facing its target.
# zoom "t2 = t1 + 0x101u; if (... <= 0x4040u)", "if (t3 == 1u) { ... mem_write8(u + 2u, 2u); ... @unk_05 = 0xA8u }"
02A71B  func  fat_goon_descent_fall
comment fat_goon_descent_fall Grows the fat goon as it comes nearer, and after its time lets the balloon go.
# "sub_0785B1(x, &d, &carry); if (carry == 0u) return u;" then sub_078620, sub_07866B, "@unk_02 = 2u"
02A75D  func  fat_goon_descent_land
comment fat_goon_descent_land Falls to the floor, then faces the nearest player and lets the fat goon fight.

# ---- the balloon a descending fat goon hangs from ----
02A77B  file  objects/descent_balloon    # the balloon a descending fat goon lets go of
# "u = object_setup_02B8FE_ADDRESS" (kind 80 goon, animation 36), "@flags = 4u" (hidden)
02A77B  func  descent_balloon_start
comment descent_balloon_start Sets up the balloon, hidden until the fat goon lets it go.
# step 1: an RTS
02A789  func  descent_balloon_wait
comment descent_balloon_wait Does nothing while the fat goon holds the balloon.
# step 2 (the fat goon sets it: 02A71B "mem_write8(u + 2u, 2u)"): parent's place, "t7 = t6 + VIDEO_003C", "@unk_19 = 0x100u"
02A78A  func  descent_balloon_release
comment descent_balloon_release Shows the balloon over the fat goon's place and starts it rising.
# "@unk_19 = t1 + 4u; if (t2 >= 0xF0u) @flags = 0u"
02A7C4  func  descent_balloon_fly_away
comment descent_balloon_fly_away Rises ever faster, gone once high enough.

# ---- the fat goons' actions (enemy actions 09, 0A, 0B, 0C, 0D, 0E, 29, 38, 3E) ----
02A7DF  file  objects/fat_goon_actions    # the fat goons' attacks
# action 3E's step 0: sub_07859C, "@unk_05 = 0x86u; @unk_0F = 0x100u", negated when field 36 is under 40
02A7DF  func  fat_goon_back_off
comment fat_goon_back_off Starts the fat goon walking away from its target for 32 frames.
# "if (t1 != 1u) return; @unk_02 = 2u"
02A802  func  fat_goon_back_off_end
comment fat_goon_back_off_end When the walk away ends, goes back to the fight.
# action 29's step 0: "@unk_05 = 0xB2u; @unk_3B = 0x40u + unk_4861" (the rank)
02A811  func  fat_goon_bump_wind_up
comment fat_goon_bump_wind_up Starts the bump's wind-up (animation B2), longer the higher the game's rank.
# "if ((t1 & 2u) == 0u) return y;" "@unk_0F = 0x80u", sub_0785C6, "@unk_09 = t5 ^ 0x40u", "d = 0x7600u", hit box 790C
02A824  func  fat_goon_bump_move
comment fat_goon_bump_move At the animation's mark, backs the fat goon into its target with the bump's hit box and sound 7600.
# "@unk_0F = 0u; @unk_09 = t2 ^ 0x40u; @unk_05 = 0x93u; @unk_3B = 0x20u", hit box 7904
02A856  func  fat_goon_bump_stop
comment fat_goon_bump_stop When the bump's time runs out, stops and turns the fat goon round.
# "if (t1 == 1u) { @unk_02 = 2u; @unk_3B = 0u; }"
02A87A  func  fat_goon_bump_end
comment fat_goon_bump_end After 32 frames goes back to the fight.
# action 09's step 0: "@unk_05 = 0x90u", sub_07859C, "@unk_0F = 0x180u", towards the target, "@unk_3B = 0x40u"
02A887  func  fat_goon_walk_up
comment fat_goon_walk_up Starts the fat goon walking towards its target for up to 64 frames.
# "if (t3 >= 0x20u) return" (field 2C), target off the floor: "@unk_3B = 1u; step + 1", else "@unk_05 = 0xAAu;
# @unk_3B = fat_goon_strike_waits_by_players[unk_4857]"
02A8AB  func  fat_goon_walk_up_to_target
comment fat_goon_walk_up_to_target Walks until near the target, then winds up for a time by the players in the game.
# "if (t1 == 1u) { @unk_05 = 0xA4u; ... }"
02A8E7  func  fat_goon_walk_up_swing
comment fat_goon_walk_up_swing When the wind-up ends, swings (animation A4).
# "if ((t1 & 2u) == 0u) return y;" hit box 7914
02A8F5  func  fat_goon_walk_up_hit
comment fat_goon_walk_up_hit At the swing's mark, puts out the strike's hit box.
# "y = hit_box_02B904_ADDRESS; sub_0785B4(x, y)", substep + 1, sub_02A90F
02A906  func  fat_goon_strike_recover
comment fat_goon_strike_recover Takes the strike's hit box back to the body's, then waits for the animation's end.
# "if ((t1 & 1u) == 0u) return; @unk_02 = 2u"
02A90F  func  fat_goon_strike_end
comment fat_goon_strike_end When the animation ends, goes back to the fight.
# action 0A's step 0: "@unk_05 = 0xAAu", sub_07859C
02A91F  func  fat_goon_body_slam_wind_up
comment fat_goon_body_slam_wind_up Starts the body slam's wind-up (animation AA) facing the target.
# "@unk_0F = 0x200u", "@unk_3E = t4", "@unk_19 = 0x600u; @unk_05 = 0xA8u; @unk_3B = 0x20u"
02A92A  func  fat_goon_body_slam_jump
comment fat_goon_body_slam_jump When the wind-up ends, jumps forward (animation A8), keeping the jump's direction.
# "@unk_19 = t1 - 0x40u; carry = sub_078662(x)", hit box 791C after 3B, hit box 7904 and "@unk_3B = 4u" on landing
02A95A  func  fat_goon_body_slam_fall
comment fat_goon_body_slam_fall Falls with the body slam's hit box once the jump has risen; on landing takes the body's hit box.
# "@unk_05 = 0xA9u; if ((int8_t)t2 >= 0) @unk_0F = 0u - t3; @unk_3B = 8u"
02A986  func  fat_goon_body_slam_bounce
comment fat_goon_body_slam_bounce After landing, bounces back the other way (animation A9).
# "if (t1 != 1u) return; @unk_02 = 2u"
02A9A1  func  fat_goon_body_slam_end
comment fat_goon_body_slam_end After 8 frames goes back to the fight.
# actions 0B and 0C's step 0: target off the floor ("t2 != t3": its 16 against its 5C): "@unk_3B = 1u"; else
# "@unk_05 = 0xAAu; @unk_3B = fat_goon_strike_waits_by_players[...]"
02A9B0  func  fat_goon_strike_wind_up
comment fat_goon_strike_wind_up Winds up (animation AA) for a time by the players in the game, at once if the target is in the air.
# "if (t1 != 1u) return; @unk_05 = 0xABu"
02A9DC  func  fat_goon_strike_swing
comment fat_goon_strike_swing When the wind-up ends, swings (animation AB).
# "if ((t1 & 2u) == 0u) return y; y = hit_box_02B924_ADDRESS"
02A9ED  func  fat_goon_strike_hit
comment fat_goon_strike_hit At the swing's mark, puts out the strike's hit box.
# "if (t1 != 1u) return; @unk_05 = 0xA3u"
02AA04  func  fat_goon_reach_strike_swing
comment fat_goon_reach_strike_swing When the wind-up ends, swings further out (animation A3).
# "y = hit_box_02B92C_ADDRESS"
02AA15  func  fat_goon_reach_strike_hit
comment fat_goon_reach_strike_hit At the swing's mark, puts out the longer strike's hit box.
# an RTS: action 0D's first step and the step after 0C's strike
02AA2C  func  fat_goon_action_wait
comment fat_goon_action_wait Does nothing: action 0D starts here and never leaves.
# action 0E's step 0: "@unk_05 = 0xA3u", sub_07859C
02AA33  func  fat_goon_heavy_strike_swing
comment fat_goon_heavy_strike_swing Starts the heavy strike's swing (animation A3) facing the target.
# "y_2 = hit_box_02B934_ADDRESS" (power 0C, kind 07), "d = VIDEO_2000" (sound 2000)
02AA3F  func  fat_goon_heavy_strike_hit
comment fat_goon_heavy_strike_hit At the swing's mark, puts out the heavy strike's hit box with sound 2000.
# action 38's step 0: target leaving or already held ("mem_read8(u + 0x3Du)") ends it; "d = sub_07861D(x, u)",
# "sub_078617(x, d)" at speed 30, sub_07D25D
02AA5C  func  fat_goon_grab_approach
comment fat_goon_grab_approach Heads for its target to grab it, unless the target is gone or already held.
# "mem_write16(u + 0x4Bu, x); mem_write8(u + 0x3Du, 0xCu); ... @unk_05 = fat_goon_hold_animations[...] | 0x80u"; a hit
# or the target's 3E/3D send it to actions 0B/0C ("a = 0xBu", "a = 0xCu")
02AA94  func  fat_goon_grab
comment fat_goon_grab Closes in on the target and, when level with it on the floor, holds it (the animation by the held character).
# "if ((t2 & 0xFu) == 0u) sound 2000"; the held player's 3D gone: "@unk_1B = a - 3", "@unk_28 = (unk_4858 & 1u) + 2u";
# the held player's life gone: "@unk_02 = 2u"
02AB52  func  fat_goon_squeeze
comment fat_goon_squeeze Squeezes the held player (sound 2000 every 16 frames) until it breaks free, which costs the fat goon life, or is beaten.
# "if (t1 & 1u) { @unk_58 = 1u; @unk_29 = t2 - 1u; } return sub_02AB52(x)"
02ABB0  func  fat_goon_squeeze_again
comment fat_goon_squeeze_again When the squeeze's animation ends, starts it again, and squeezes.

# ---- the fat goons that come in from the cemetery's sides and from below ----
02ABCC  file  objects/fat_goon    # (the cemetery's fat goons)
# type EF's step 0: "@unk_0C = fat_goon_jump_in_xs[...]", sub_02A133, "@unk_05 = 0x90u; @unk_0F = 0x200u" (negated from
# 00E0), "t7 = unk_48E2; @unk_19 = t7"
02ABCC  func  fat_goon_jump_in_start
comment fat_goon_jump_in_start Sets up the fat goon coming in from a side of the cemetery, walking in.
# type EF's step 1: switch on field 29
02AC15  func  fat_goon_jump_in_steps
comment fat_goon_jump_in_steps Runs the steps of the fat goon jumping in, by its substep.
# sub_078644 (the floor ahead), no floor: "@unk_19 = unk_48E2"; floor: "@unk_19 = 0x400u; @unk_05 = 0x84u"
02AC1E  func  fat_goon_jump_in_jump
comment fat_goon_jump_in_jump Walks in until there is floor ahead, then jumps onto it.
# "sub_0785B1 ... if (carry == 0u) return; @flags = 0xC0u; sub_078620(x); @unk_02 = 2u"
02AC5D  func  fat_goon_jump_in_land
comment fat_goon_jump_in_land Lands, then finds the nearest player and fights.
# type F0's step 0: "@unk_0C = fat_goon_from_below_xs[...]", "@unk_16 = 0xFF80u", sub_02A107, "@unk_05 = 0x86u"
02AC7C  func  fat_goon_from_below_start
comment fat_goon_from_below_start Sets up the fat goon under the cemetery's floor, at the x its spawn's state picks.
# type F0's step 1: switch on field 29 (its substeps 2 and 3 are list 3 type 04's steps; it never reaches them)
02ACC0  func  fat_goon_from_below_steps
comment fat_goon_from_below_steps Runs the steps of the fat goon coming up from below, by its substep.
# "if ((int16_t)t1 < 0 ...) { @unk_19 = unk_48E2; return; }" then "@unk_19 = 0x400u; @unk_0F = 0x200u; @unk_05 = 0x84u"
02ACC9  func  fat_goon_from_below_rise
comment fat_goon_from_below_rise Rises until out of the floor, then jumps out forward.
# like sub_02AC5D
02AD08  func  fat_goon_from_below_land
comment fat_goon_from_below_land Lands, then finds the nearest player and fights.

# ---- the stage events (list 3, the object at 5640) ----
02AD21  file  stages/stage_events    # the stage events: holding the scroll, the waves of enemies
# list 3 type 04's step 0: "@unk_0C = 0xE0u", "y = child_object_02B9C5_ADDRESS" (list 1 type FB: bank 19), its
# "mem_write16(u + 0x2Au, x)", a second (02B9CD) when "unk_486B" (the difficulty) is 3 or more
02AD21  func  cleared_wave_start
comment cleared_wave_start Puts in one or two of bank 19's list 1 type FB objects (two from difficulty 3), then waits.
# "t1 = io_read8(VIDEO_1876); if (t1 != 0u) { unk_48A7--; return y; }", "unk_4880 = 2u", "d = 0x9300u", the children
# 02B9D5 (list 0 type EB) and 02B9DD (list 0 type 00: the fixed program's goon)
02AD47  func  cleared_wave_wait
comment cleared_wave_wait Holds the scroll until no enemy is left, then changes the palette, plays sound 9300 and puts in two goons.
# "@unk_02 = t1 + 1u; sub_02AD74(x)"
02AD71  func  scroll_lock_start
comment scroll_lock_start Starts holding the scroll.
# "if (t2 < t1) { unk_48A7--; return; } @flags = 0u" (field 30 against the enemy count 1876)
02AD74  func  scroll_lock
comment scroll_lock Holds the scroll while there are more enemies than its count, then goes away.
# "@unk_3D = enemy_waves_end_enemies[a]; @unk_2A = TABLE16(object_15_spawn_lists, ...); @unk_30 = TABLE8(enemy_waves_next_wave_enemies,
# ... + ((unk_4857 - 1u) & 3u))"
02AD8F  func  enemy_waves_start
comment enemy_waves_start Takes its spawn list and its counts by its spawn's state: the enemies left for the next wave (by the players) and for its end.
# "if (mem_read8(y) != t2)" against field 28; "if (t3 < t4)" byte 4 against 1874; sub_0786AA; the object's 30, type,
# x, y and z from the record
02ADB8  func  enemy_waves_spawn
comment enemy_waves_spawn Puts in the spawns of the current wave for which enough players are present.
# "if (t1 <= t2) { @unk_28 = t3 + 1u; @unk_02 = t4 - 1u; }"
02AE21  func  enemy_waves_next
comment enemy_waves_next Waits until the enemies are down to the wave's count, then goes on to the next wave.
# "if (t1 <= t2) @flags = 0u" (1876 against 3D)
02AE31  func  enemy_waves_end
comment enemy_waves_end Once the list has ended, waits until the enemies are down to its last count and goes away.

# ---- bank 15's scenery objects ----
02AE47  file  objects/stage_props    # Krustyland's doors and booths, props, the cemetery's pieces
# list 1 type DD's step 0: "u = object_setup_02BD72_ADDRESS" (kind 9E), "@unk_09 = 0x50u"
02AE47  func  moe_spawner_start
comment moe_spawner_start Sets up the kind 9E object.
# an RTS (the step after the child is put in)
02AE5A  func  moe_spawner_wait
comment moe_spawner_wait Does nothing once the object has been put in.
# "if (unk_48AC < 0x190u) return;" "y_2 = child_object_02BD78_ADDRESS" (list 1 type 22: bank 18's kind 8C)
02AE5B  func  moe_spawner_put_in_object
comment moe_spawner_put_in_object Once the camera reaches 0190, puts in bank 18's list 1 type 22 object beside it.
# list 1 type F7's step 0: "u = object_setup_02BD88_ADDRESS" (kind AC)
02AE76  func  burger_eater_start
comment burger_eater_start Sets up the kind AC object.
# an RTS: step 1 waits
02AE85  func  burger_eater_wait
comment burger_eater_wait Does nothing until something moves the object to its next step.
# "y = child_object_02BD8E_ADDRESS; sub_07862C" (list 2 type 12, state 12: food), "@unk_05 = 0x82u"
02AE86  func  burger_eater_drop_food
comment burger_eater_drop_food Drops a piece of food and shows its next animation.
# an RTS
02AE9B  func  burger_eater_done
comment burger_eater_done Does nothing after the food is dropped.
# list 1 type F8's step 0: "u = object_setup_02BDA2_ADDRESS" (kind AB), "@unk_3C = 3u"
02AEA5  func  drink_vendor_start
comment drink_vendor_start Sets up the kind AB object, good for three hits.
# "if ((@flags & 0x20u) != 0u) { @flags = 0x80u; @unk_05 = 0x82u; step + 1 }"
02AEB9  func  drink_vendor_wait_hit
comment drink_vendor_wait_hit Waits until a player hits it, then shows its hit animation.
# "y = child_object_02BDA8_ADDRESS" (list 1 type 01, state 1E: bank 16), "@unk_3B = 0x40u; @unk_05 = 0x81u",
# "@unk_3C = t3 - 1u" (the last: "@unk_05 = 0x80u; @unk_02 = 5u")
02AECE  func  drink_vendor_let_out
comment drink_vendor_let_out When the hit animation ends, lets out bank 16's list 1 type 01 object; after the third it stays still.
# "if (t1 == 0u) step + 1" (no child), "if (t4 == 2u) { step + 1; @unk_3D = 0u }" (the child's step)
02AF03  func  drink_vendor_wait_child
comment drink_vendor_wait_child Waits until the object it let out reaches its second step.
# "if (t1 != 1u) ...; @flags = 0xC0u; @unk_02 = 1u"
02AF1D  func  drink_vendor_rest
comment drink_vendor_rest Rests 64 frames, then waits for the next hit.
# an RTS
02AF2C  func  drink_vendor_done
comment drink_vendor_done Does nothing (the step after its last hit).
# list 1 type FD's step 0: "u = object_setup_02BDBC_ADDRESS", "krustyland_door = krustyland_doors_ADDRESS + ...",
# "@unk_2A = door_release", "@unk_38 = players" (the child record before the list)
02AF36  func  krustyland_door_start
comment krustyland_door_start Sets up a Krustyland door: its wait, its list of releases and the object it lets out.
# "if (unk_48AC >= 0x4E0u) step + 1"
02AF6E  func  krustyland_door_wait_camera
comment krustyland_door_wait_camera Waits until the camera reaches 04E0.
# "if (t2 <= 4u) { d = 0x1400u; ... @unk_05 = 0xA3u; ... if (a < unk_4857) sub_07862C(x, y...) }", "else @unk_3B = 1u"
02AF7A  func  krustyland_door_open
comment krustyland_door_open After its wait, with at most 4 enemies about, opens (sound 1400) and lets out its object if enough players play.
# "if (t1 & 1u) { step + 1; @unk_3C = 0x60u; if (t3 != 0u) @flags = 0u; }"
02AFBE  func  krustyland_door_opened
comment krustyland_door_opened When the door has opened, waits 96 frames; after its last release it goes away.
# "if (t1 == 1u) { @unk_05 = 0xA4u; step + 1 }"
02AFD5  func  krustyland_door_close
comment krustyland_door_close After the wait, closes the door (animation A4).
# "if (t1 & 1u) @unk_02 = 2u"
02AFE3  func  krustyland_door_closed
comment krustyland_door_closed When the door has closed, waits for the next release.
# list 1 type 3E's step 0: "u = object_setup_02BE13_ADDRESS" (kind B2), "y = child_object_02BE0B_ADDRESS" (list 1
# type 3F: bank 17's kind A2 bear), "@unk_40 = u"; no slot: "@unk_02 = 6u"
02AFF8  func  caged_gorilla_leaper_start
comment caged_gorilla_leaper_start Sets up the kind B2 object with the bear (bank 17's kind A2) beside it.
# an RTS: step 6
02B021  func  caged_gorilla_leaper_idle
comment caged_gorilla_leaper_idle Does nothing (when there was no slot for its bear).
# "if (t2 != 3u) return u;" (the bear's step) then "d = 0x5C00u", "@unk_0F = 0x80u; @unk_14 = 0xFF00u; @unk_19 = 0x600u"
02B022  func  caged_gorilla_leaper_jump
comment caged_gorilla_leaper_jump When its bear starts off, leaps away with sound 5C00.
# "sub_0785B1", in the air "@unk_05 = 0x84u" after 3B; landing "d = unk_5D00_ADDRESS" (sound 5D00), "@unk_3B = 0x20u"
02B050  func  caged_gorilla_leaper_fall
comment caged_gorilla_leaper_fall Falls; on landing plays sound 5D00 and stops.
# "@flags = 0x80u; @unk_1C = ... | 0x14u; ... sub_078674(x)"
02B07A  func  caged_gorilla_leaper_crash
comment caged_gorilla_leaper_crash Hurts the enemies it lands on for a frame.
# "if (t1 == 1u) { @unk_3B = 0x10u; step + 1 }"
02B08A  func  caged_gorilla_leaper_wait
comment caged_gorilla_leaper_wait Waits 32 frames after landing.
# "@flags ^= 0x84u" (shown and hidden in turn), "if (t1 == 1u) @flags = 0u"
02B098  func  caged_gorilla_leaper_vanish
comment caged_gorilla_leaper_vanish Blinks for 16 frames and goes away.
# list 1 type 3D's step 0: "u = object_setup_02BE1D_ADDRESS", "prop = props_ADDRESS + ...", kind, animation,
# attributes, "@unk_3E ... (leave_x << 4)"
02B0AF  func  prop_start
comment prop_start Sets a prop up by its spawn's state: its kind, animation, attributes and the x it goes away at.
# "if (t1 < t2) @flags = 0u"
02B0D9  func  prop_leave
comment prop_leave Takes the prop away once the scroll brings it left of its x.
# list 1 type EF's step 0: "u = object_setup_02BE57_ADDRESS" (kind AA animation 05)
02B0EB  func  poster_start
comment poster_start Sets up the kind AA object of stage 8.
# an RTS
02B0FE  func  poster_idle
comment poster_idle Does nothing.
# list 1 type EE's step 0: "u = object_setup_02BE61_ADDRESS" (kind AA animation 03); state 0: "y =
# child_object_02BE67_ADDRESS" (list 1 type EE state 1: its pair); state 1: "@unk_05 = 0x84u; @unk_16 = 0u"
02B105  func  poster_pair_start
comment poster_pair_start Sets up the kind AA object of stage 7; the first puts in its pair ahead of it.
# "if (t1 < 0x20u) @flags = 0u"
02B131  func  poster_pair_leave
comment poster_pair_leave Takes the object away near the screen's left edge.
# list 1 type EB's step 0: "u = object_setup_02BE79_ADDRESS" (kind CB), "@unk_3C = 3u"
02B146  func  bleeding_gums_murphy_start
comment bleeding_gums_murphy_start Sets up the kind CB object, good for three hits.
# an RTS: step 4, after the third hit
02B159  func  bleeding_gums_murphy_done
comment bleeding_gums_murphy_done Does nothing after its third hit.
# "if ((@flags & 0x20u) != 0u) { @flags = 0x80u; @unk_05 = 0x81u; step + 1 }"
02B15A  func  bleeding_gums_murphy_wait_hit
comment bleeding_gums_murphy_wait_hit Waits until a player hits it, then shows its hit animation.
# "@unk_3B = 0x80u; @unk_05 = 0x80u; @unk_3C = t2 - 1u", the last: "@unk_02 = 4u"
02B16F  func  bleeding_gums_murphy_hit_end
comment bleeding_gums_murphy_hit_end When the hit animation ends, rests; after the third hit it stays as it is.
# "if (t1 == 1u) { @flags = 0xC0u; @unk_02 = 1u; }"
02B18E  func  bleeding_gums_murphy_rest
comment bleeding_gums_murphy_rest Rests 128 frames, then waits for the next hit.
# list 2 type 27's step 0: "u = object_setup_02BE83_ADDRESS" (kind D1), zoom 6060, "dream_ball_fling = dream_ball_flings_ADDRESS
# + ((t1 & 3u) << 2)", "@unk_3B = 0x40u"
02B1A4  func  dream_ball_fling_start
comment dream_ball_fling_start Sets up the flung kind D1 piece: its x and height speeds by its spawn's state.
# "d = t1 - 0x101u; if (d >= 0x1010u)" (zoom), "d = VIDEO_2000; ... @flags = 0u" after 64 frames
02B1DA  func  dream_ball_fling_shrink
comment dream_ball_fling_shrink Shrinks the piece as it flies; after 64 frames it vanishes with sound 2000.
# list 1 type F0's step 0: "u = object_setup_02BED1_ADDRESS" (kind C6), "@unk_0C = 0x9Au", "z = CEMETERY_PIECE(...)->z"
02B211  func  cemetery_piece_start
comment cemetery_piece_start Sets a cemetery piece up at x 009A, with the height and animation its spawn's state picks.
# "@unk_19 = unk_48E2"
02B23A  func  cemetery_piece_bob
comment cemetery_piece_bob Moves the piece up and down with the stage's vertical speed (48E2).
02B24A  file  objects/floor_scenery    # the scenery that writes its shape into the floor map
# list 1 type 07's step 0: "u = object_setup_02BEE5_ADDRESS" (kind 0F animation 03), "@unk_0C = 0x180u",
# sub_078650 (the floor map cell), "@unk_2A = u", "@unk_38 = stack & ~0x3Fu"
02B24A  func  floor_blocker_start
comment floor_blocker_start Sets up the kind 0F scenery at x 0180 and takes the floor map's row and column under it.
# an RTS
02B282  func  floor_blocker_wait
comment floor_blocker_wait Does nothing once all its floor cells are written.
# step 1: switch on field 37
02B283  func  floor_blocker_steps
comment floor_blocker_steps Writes the next part of its floor shape as the scroll brings it in, by field 37.
# "if (t1 >= 0x180u) return; y_2 = loaded_table_02BEF3_ADDRESS; sub_02B2C2"
02B28C  func  floor_blocker_first_part
comment floor_blocker_first_part Writes the first part of its shape into the floor map once the scroll brings it left of 0180.
# "if (t1 >= 0x160u) return; y_2 = loaded_table_02BEFF_ADDRESS"
02B29E  func  floor_blocker_second_part
comment floor_blocker_second_part Writes the second part once left of 0160.
# "if (t1 >= 0x140u) ...; y = loaded_table_02BF0B_ADDRESS", step + 1
02B2B0  func  floor_blocker_last_part
comment floor_blocker_last_part Writes the last part once left of 0140.
# an RTS
02B2C1  func  floor_blocker_part_wait
comment floor_blocker_part_wait Does nothing until the scroll brings the next part in.
# "a = unk_480F | 2u; io_write8(IO_1FC2, a)" (the RAM at 2000-3FFF in view), 4 columns of 3 rows: "mem_write8(u -
# 0x40u, ...)", "mem_write8(u, t4)", "mem_write8(u + 0x40u, t5)", then the copy of 1FC2 back
02B2C2  func  floor_blocker_write_cells
comment floor_blocker_write_cells Writes 4 columns of 3 floor cells from the table in Y into the floor map at the object's column.

# ---- the goon's thrown hat (list 2 type 02) ----
02B31B  file  objects/goon_hat    # the hat a goon with a hat throws
# step -3: "if (t1 & 1u) @flags = 0u"
02B31B  func  goon_hat_burst_end
comment goon_hat_burst_end When the burst's animation ends, the hat goes away.
# steps -2 and -1: switch on field 29
02B325  func  goon_hat_burst_steps
comment goon_hat_burst_steps Runs the hat's burst after a hit, by its substep.
# "@unk_04 = 4u; @unk_05 = 0x80u; @unk_0F = 0u" (kind 04 hit_sparks)
02B32E  func  goon_hat_burst
comment goon_hat_burst Turns the hat into a burst of hit sparks and stops it.
# sub_078638, the floor's priority into 09 and its height into 5C's high byte
02B33B  func  goon_hat_floor_priority
comment goon_hat_floor_priority Gives the hat the priority of the floor under it.
# step 0: "u = object_setup_02BF3F_ADDRESS" (kind 84 goon_with_hat, animation 2A), "@unk_3B = 0x20u; @unk_31 = 0x20u",
# the thrower's 5C, "@unk_0F = 0x480u" its way
02B392  func  goon_hat_throw_start
comment goon_hat_throw_start Sets the hat flying fast the way its thrower faces, at the thrower's floor.
# an RTS: step 3
02B3C4  func  goon_hat_done
comment goon_hat_done Does nothing once the hat's flight has ended.
# "if (t1 != 1u) return; @unk_3B = 0x20u; if (t2 == 0u) { @unk_02 = 3u; ... } @unk_0F = 0u - t3"
02B3C5  func  goon_hat_turn_back
comment goon_hat_turn_back After 32 frames turns the hat back towards its thrower.
# "if (t1 == 0u) { @unk_02 = 3u; ...}", "if (t4 != 4u) @flags = 0u" (the thrower's step)
02B3E4  func  goon_hat_return
comment goon_hat_return Flies back; when its time runs out it goes away unless its thrower still throws.
# "if (t3 == 4u) @unk_31 = 0u"
02B400  func  goon_hat_check_thrower
comment goon_hat_check_thrower Ends the hat's flight once its thrower is back at its throwing step.

# ---- the police car (list 0 type E9, list 1 type EC) ----
02B41E  file  objects/police_car    # the police car that drives into stage 1 and stage 2
# steps -2 and -1: switch on field 29
02B41E  func  police_car_hit_steps
comment police_car_hit_steps Runs the police car's reaction to a hit, by its substep.
# "d = 0x6300u; ... @unk_05 = 0x85u"
02B427  func  police_car_hit
comment police_car_hit Plays sound 6300 and the car's hit animation.
# an RTS
02B435  func  police_car_hit_wait
comment police_car_hit_wait Does nothing (the step after the hit).
# "if ((t1 & 1u) == 0u) return; @unk_05 = 0x81u; @unk_0F = 0x200u"
02B436  func  police_car_drive_off
comment police_car_drive_off When the hit animation ends, drives away to the right.
# step 0: "u = object_setup_02BF63_ADDRESS" (kind C3), "police_car_arrival = police_car_arrivals_ADDRESS + ..."
02B44E  func  police_car_start
comment police_car_start Sets the police car up by its spawn's state: its speed, the frames it drives and its kind.
# "if (unk_4867 == 0u) unk_48A7--;" ... "io_write8(VIDEO_1884, 0xC0u); @unk_0F = 0u; @unk_05 = 0x89u"
02B477  func  police_car_drive_in
comment police_car_drive_in Drives in (holding the scroll in stage 1), then stops and tells the doors and bystanders (1884).
# "if (t1 & 1u) { @unk_05 = 0x80u; @unk_3B = 0x80u; step + 1 }", sub_02B4B7, sub_078674 outside stage 1
02B499  func  police_car_stopped
comment police_car_stopped After stopping, waits for the animation's end, taking hits (and hurting enemies outside stage 1).
# "if ((@flags & 0x20u) == 0u) return u; if (t1 < 1 || t1 > 0x15) return u;" (a player's attack), the hitter's 2A
# counted for kinds 0-3, "@unk_02 = 0xFFu"
02B4B7  func  police_car_check_hit
comment police_car_check_hit When a player's attack hits the car, counts it for that player and starts the car's hit reaction.
# "if (t1 == 1u) step + 1", sub_02B4B7
02B4F0  func  police_car_wait
comment police_car_wait Waits 128 frames, taking hits.
# "if ((t1 & 1u) == 0u) return sub_02B516(x, u); @flags = 0x80u; @unk_05 = 0x81u; @unk_0F = 0x200u"
02B4FA  func  police_car_leave
comment police_car_leave When its animation ends, drives away to the right.
# sub_02B4B7 (and sub_078674 outside stage 1)
02B516  func  police_car_driving_off
comment police_car_driving_off Drives away, taking hits.

# ======== bank 16 ========

02C000  file  objects/bank_entries    # (bank 16's entries)
# list 1 type 11 (s0 at x 00E8, 01C8, 0538, 0670): steps sub_02CE41, sub_02CE65; "if (t1 >= 0x1F0u) @flags = 0u"
02C000  func  solid_scenery_update
comment solid_scenery_update Runs a piece of stage 1's scenery that no one can walk into, gone once off screen.
# list 1 type 1A (s0): steps sub_02C3FF ... sub_02C47A (police_car_doors)
02C003  func  police_car_door_update
comment police_car_door_update Runs a door of the police car, which lets goons out once the car has stopped.
# list 1 type 28 (fat_goon_thrower's child 02B8AC): steps sub_02C553 ..., then sub_078593, sub_02C4D6, gone off screen
02C006  func  carried_obstacle_update
comment carried_obstacle_update Runs the obstacle a fat goon carries and throws: carried, thrown, bouncing and breaking.
# list 1 type 1B (s1): steps sub_02C9E7 ..., then its floor shape's parts by field 37
02C009  func  charging_scenery_update
comment charging_scenery_update Runs the kind 0F scenery of stage 2 that sets its shape in the floor, then charges with two goons.
# list 2 type 0D (sub_02C8FC's children 02DD23, 02DD29): steps sub_02C955 ... sub_02C987; no scenario runs it (0/5)
02C00C  func  scenery_debris_update
comment scenery_debris_update Runs a piece flying off the platform scenery when it crashes.
# list 1 type 00 (s0, s1, s5, s6): steps sub_02CB7D ... (setup 7DCD kind 05, obstacle_heights), sub_078593, sub_02CB0C
02C00F  func  obstacle_update
comment obstacle_update Runs an obstacle that raises the floor under it and can be picked up, thrown and broken.
# list 1 type 01 (s0, s1, s3, s5, s6, s9; kind AB's child): steps sub_02C6C5 ... (setup 7CB9 kind 04)
02C012  func  throwable_update
comment throwable_update Runs a small object lying in the stage that a player can pick up and throw at the enemies.
# list 1 type 05 (s0 at x 03A0): steps sub_02C820 ..., then its floor shape's parts by field 37
02C015  func  platform_scenery_update
comment platform_scenery_update Runs the kind 0F scenery of stage 1 that sets its shape in the floor as it scrolls in.
# list 1 type 23 (sub_02D2E3's children 02DEC1, 02DEC9): steps sub_02D098, sub_02D0CB (setup 7E15 kind 09 animation 0E)
02C018  func  shaken_bit_update
comment shaken_bit_update Runs a small piece that falls off the shaking scenery when it is hit from above.
# list 1 type 06 (s0, s1, s6, s9): steps sub_02D183 ... (object_16_kinds, object_16_animation_runs, object_16_patterns)
02C01B  func  shaking_scenery_update
comment shaking_scenery_update Runs the scenery that shakes when a player hits it, dropping food five times.
# list 1 type E0: steps sub_02C16A ... (setup 7DCD kind 05); no spawn list holds one and no scenario runs it (0/26)
02C01E  func  heavy_obstacle_update
comment heavy_obstacle_update Runs an obstacle that raises the floor by 4 steps; nothing puts one in.
# list 1 type 08 (s0 at x 0160): steps sub_02D86A ... (setup 7FD9 kind 87); gone past x 01C0, turned round 0034 from home
02C021  func  woman_in_apron_update
comment woman_in_apron_update Runs the kind 87 character that wanders near its device and runs to it when the device is hit.
# list 1 type 09 (s1): steps sub_02DA0A ... (setup 7FED kind 95, life 4), sub_078593, gone off screen
02C024  func  rabbit_update
comment rabbit_update Runs the kind 95 character of stage 2 that flinches when hit and runs off when beaten.
# list 1 type 26 (woman_in_apron's child 02DFD1): steps sub_02D7B0 ... (setup 7FBB kind 0F animation 06)
02C027  func  woman_in_apron_device_update
comment woman_in_apron_device_update Runs the kind 87 character's device, which strikes when its keeper works it.
# list 1 type E1: from sub_02C6C5 (kind 04), then sub_02C1DF ...
02C02A  func  timed_throwable_update
comment timed_throwable_update Runs a throwable that smashes when it lands.
# list 1 type DF (s4, the cemetery): steps sub_02C0C9 ... (cemetery_obstacle_xs, cemetery_obstacle_food), sub_078593
02C02D  func  cemetery_obstacle_update
comment cemetery_obstacle_update Runs a cemetery obstacle that raises the floor and breaks when hit, some into food.
# list 1 types 13 and 14: "02C036 LBRA $665F", "02C039 LBRA $665E", both an RTS; nothing puts one in
02C036  func  empty_object_type_13_handler
comment empty_object_type_13_handler Unused: the handler of list 1's type 13, which does nothing; no object of that type is put in.
# "02C039 LBRA $665E": an RTS
02C039  func  empty_object_type_14_handler
comment empty_object_type_14_handler Unused: the handler of list 1's type 14, which does nothing; no object of that type is put in.
# list 1 type 2E (object 15's list 6): steps sub_02D69B ... (setup 7F7D kind 8B bird)
02C03C  func  bird_item_update
comment bird_item_update Runs the bird that rises, flutters and comes down as an object to pick up.
# list 1 type 16 (s0, s5): steps sub_02D728 ... (rising_scenery_camera_xs)
02C03F  func  rising_scenery_update
comment rising_scenery_update Runs the scenery that rises out of the stage once the camera reaches it.
# list 1 type 17: from sub_02C553, then sub_02C5BF, sub_02C5D1 (the carried obstacle's steps)
02C042  func  tossed_obstacle_update
comment tossed_obstacle_update Runs an obstacle held by another object, dropped when the holder is hit or tossed after a moment.
# list 1 type 1F (s5): steps sub_02C2DF ... (setup 7BEC kind 10)
02C045  func  moes_street_scenery_dropper_update
comment moes_street_scenery_dropper_update Runs the kind 10 scenery of stage 4 that comes down and rewrites the floor under it.
# list 1 type 21 (s5): steps sub_02C23F ... (setup 7BDC kind 10)
02C048  func  moes_street_scenery_riser_update
comment moes_street_scenery_riser_update Runs the kind 10 scenery of stage 4 that rises away once the boss is beaten.
# list 1 type 03 (s1, s6): steps sub_02D437 ... (running_animals); off its steps it faces its way
02C04B  func  running_animal_update
comment running_animal_update Runs an animal that runs across the stage, which a player can pick up and throw.
# list 1 type 2B (s6): steps sub_02D043 ... (setup 7E0B kind AF boulder, animation 02)
02C04E  func  gorge_rock_update
comment gorge_rock_update Runs a rock of stage 5's gorge that breaks when hit.
# list 1 type 2C (s6, object 15's list 6): steps sub_02CE6F ... (boulder_drops)
02C051  func  boulder_update
comment boulder_update Runs a boulder of stage 5's gorge that falls and bounces through the stage.
# list 1 type 2D (s0, s9): steps sub_02D55C ... (setup 7F25 kind 04 animation 1A)
02C054  func  bouncing_throwable_update
comment bouncing_throwable_update Runs a throwable that bounces once when it lands.
# list 1 type 2F (shaking_scenery's child 02DE8D): steps sub_02D0E5 ... (setup 7E23 kind 10 animation 1F)
02C05A  func  shaken_object_update
comment shaken_object_update Runs the object on the shaking scenery that falls off it when shaken and lets out a chaser.
# list 1 type F2 (s8, Dreamland): steps sub_02D5E2 ... (dreamland_obstacle_drops); gone outside x 0040-01FF
02C05D  func  dreamland_obstacle_update
comment dreamland_obstacle_update Runs an obstacle thrown into Dreamland that then lies as an obstacle to pick up.

# ---- the cemetery's obstacles ----
02C06F  file  objects/obstacles    # the obstacles: raising the floor, picked up, thrown and broken
# steps -2 and -1: switch on field 29
02C06F  func  cemetery_obstacle_broken_steps
comment cemetery_obstacle_broken_steps Runs the cemetery obstacle's breaking by its substep.
# "y = child_object_02DB52_ADDRESS; sub_07862F" (list 2 type 13: the fixed program's E18F), "d = 0x6C00u", sub_02CCE8;
# "if (t1 != 0u) { @unk_19 = 0x800u; @unk_04 = 9u; ... }" (field 44 from cemetery_obstacle_food)
02C078  func  cemetery_obstacle_break
comment cemetery_obstacle_break Breaks the obstacle (sound 6C00), gives the floor back, and either jumps out as food or vanishes.
# "if (t1 == 1u) @flags = 0u"
02C0B4  func  cemetery_obstacle_vanish
comment cemetery_obstacle_vanish Takes the broken obstacle away after 16 frames.
# "if (carry) { @type = 0x27; @unk_02 = 0u; }" (list 1 type 27: bank 17's food)
02C0BD  func  cemetery_obstacle_food_fall
comment cemetery_obstacle_food_fall Lets the food fall and, on landing, turns the object into food lying on the floor.
# step 0: "u = object_setup_02DBA8_ADDRESS" (kind 05), "@unk_44 = TABLE8(cemetery_obstacle_food, ...)", "@unk_0C =
# cemetery_obstacle_xs[...]"
02C0C9  func  cemetery_obstacle_start
comment cemetery_obstacle_start Sets a cemetery obstacle up at the x its spawn's state picks, deciding by the players' scores whether it holds food.
# "if (d < 0x160u) { d = ... | 0x200u; sub_02CC4A(...) }"
02C10F  func  cemetery_obstacle_raise_floor
comment cemetery_obstacle_raise_floor Once on screen, raises the floor under it by 2 steps.
# "if (unk_487D == 0u) ...; u_2 = sub_02CCE8(x)"
02C120  func  cemetery_obstacle_wait_boss
comment cemetery_obstacle_wait_boss Gives the floor back once the stage's boss is beaten.
# an RTS
02C12B  func  cemetery_obstacle_idle
comment cemetery_obstacle_idle Does nothing.

# ---- obstacles and throwables ----
# type E0's step 0: "u = object_setup_02DDCD_ADDRESS" (kind 05 animation 02), "d_2 = ... | 0x400u; sub_02CC4A"
02C16A  func  heavy_obstacle_start
comment heavy_obstacle_start Unused: sets up the obstacle (animation by its spawn's state) and raises the floor under it by 4 steps.
# an RTS
02C190  func  heavy_obstacle_idle
comment heavy_obstacle_idle Unused: does nothing while the obstacle stands.
# steps 2 and 3: switch on field 28
02C1AC  func  heavy_obstacle_hit_steps
comment heavy_obstacle_hit_steps Unused: runs the obstacle's smashing by field 28.
# "d = 0x6C00u", "@unk_04 = 0x9Cu; @unk_05 = 0xA2u", hit box 7AD8, sub_078674
02C1B5  func  obstacle_smash
comment obstacle_smash Turns the object into a smash (kind 9C, animation A2) with sound 6C00, hurting the enemies it touches.
# "if (t1 & 1u) @flags = 0u"
02C1D5  func  obstacle_smash_end
comment obstacle_smash_end When the smash's animation ends, takes the object away.
# type E1's step 1: "if (t1 != 1u) ...; @unk_02 = 7u"
02C1DF  func  timed_throwable_wait
comment timed_throwable_wait Waits out field 3B, then starts falling.
# an RTS
02C1E9  func  timed_throwable_idle
comment timed_throwable_idle Does nothing while it lies.
# "@flags = 0x80u; @unk_3D = 0u; @unk_05 = (t1 + 1u) | 0x80u", hit box 7AD0, sub_078674
02C1EA  func  timed_throwable_throw
comment timed_throwable_throw Thrown: shows its flying animation and hurts the enemies it touches.
# "sub_0785B1 ... d = 0x6C00u; ... @unk_04 = 0x9Cu; @unk_05 = 0x8Au"
02C207  func  timed_throwable_fall
comment timed_throwable_fall Falls and, on landing, smashes (kind 9C, animation 8A) with sound 6C00.
# "@flags = 0x80u; if (t1 & 1u) @flags = 0u"
02C22A  func  timed_throwable_smash_end
comment timed_throwable_smash_end Takes the smash away when its animation ends.

# ---- stage 4's kind 10 scenery ----
02C23F  file  objects/moes_street_scenery    # stage 4's kind 10 scenery: what rises at the end and what comes down
# type 21's step 0: "u = object_setup_02DBDC_ADDRESS" (kind 10 animation 02), "@unk_0C = t1 + 0x10u", the next animation
# for state 1
02C23F  func  moes_street_scenery_riser_start
comment moes_street_scenery_riser_start Sets up the kind 10 scenery that will rise, behind the players.
# "if (unk_487D == 0u) return;" "if (t1 != 0u) d = 0x1500u", "@unk_19 = 0x40u; @unk_3B = 4u; @unk_3C = 8u"
02C277  func  moes_street_scenery_riser_wait_boss
comment moes_street_scenery_riser_wait_boss Waits until the stage's boss is beaten, then starts rising (sound 1500 for the second one).
# "@unk_3B = 4u; @unk_3C = t2 - 1u", then "@unk_3B = 0x40u; @unk_19 = 0x40u"
02C29A  func  moes_street_scenery_riser_rise_slowly
comment moes_street_scenery_riser_rise_slowly Rises slowly for 32 frames.
# "@unk_19 = t1 + 4u" for 64 frames
02C2B8  func  moes_street_scenery_riser_rise_faster
comment moes_street_scenery_riser_rise_faster Rises faster and faster for 64 frames.
# "if (t1 < 0x80u) ...; @unk_19 = 0u"
02C2CA  func  moes_street_scenery_riser_stop
comment moes_street_scenery_riser_stop Stops rising once high enough.
# an RTS
02C2D8  func  moes_street_scenery_riser_idle
comment moes_street_scenery_riser_idle Does nothing once it has risen.
# type 1F's step 0: "u = object_setup_02DBEC_ADDRESS" (kind 10 animation 01), state 0: the floor map cell under it
# (sub_078650 into 2A, 33, 38)
02C2DF  func  moes_street_scenery_dropper_start
comment moes_street_scenery_dropper_start Sets up the kind 10 scenery that comes down, taking the floor map's row and column under it.
# "if (unk_4892 == 0u) { @unk_3B = 0x20u; step + 1 }"
02C332  func  moes_street_scenery_dropper_wait
comment moes_street_scenery_dropper_wait Waits until direct page 92 is clear, then 32 frames more.
# "if (t2 == 0u) d = 0x1300u", "@unk_3B = 0x40u; @unk_19 = 0xFF80u"
02C340  func  moes_street_scenery_dropper_come_down
comment moes_street_scenery_dropper_come_down Starts coming down for 64 frames (sound 1300 for the first).
# "@unk_19 = 0u; if (t2 == 0u) { ... io_write8(VIDEO_184A, t4 + 1u); sub_02C37E(x, &y, &u); }"
02C35F  func  moes_street_scenery_dropper_land
comment moes_street_scenery_dropper_land Stops when down; the first counts itself in 184A and rewrites the floor.
# an RTS
02C37D  func  moes_street_scenery_dropper_idle
comment moes_street_scenery_dropper_idle Does nothing once down.
# (symbols.txt: moes_street_scenery_floor_edge_flags, moes_street_scenery_floor_cells) "unk_48F4 = 0x20u", six cells a column
02C37E  func  moes_street_scenery_dropper_write_floor
comment moes_street_scenery_dropper_write_floor Rewrites 32 columns of the floor map from its place, six cells each, the last columns as edges.
# (symbols.txt's "local sub_02C37E 02C3A9,02C3AE y column floor_column" names this function by its old name: with the
# function renamed, that line must take the new name, as here)
local moes_street_scenery_dropper_write_floor 02C3A9,02C3AE y column floor_column

# ---- the police car's doors ----
02C3FF  file  objects/police_car    # (the police car's doors)
# list 1 type 1A's step 0: "u = object_setup_02DC28_ADDRESS" (kind 0F animation 14), "police_car_door =
# police_car_doors_ADDRESS + ...", too few players: "@unk_02 = 4u"
02C3FF  func  police_car_door_start
comment police_car_door_start Sets up a door of the police car: its wait and release list, or nothing if too few players are present.
# an RTS
02C43B  func  police_car_door_idle
comment police_car_door_idle Does nothing (a door too few players are present for).
# "t1 = io_read8(VIDEO_1884); if (t1 != 0u) step + 1"
02C442  func  police_car_door_wait_car
comment police_car_door_wait_car Waits until the police car has stopped.
# "@unk_05 = 0x95u", "y_2 = police_car_door_lists[...]", "if (players == 0x7Fu) ...", "sub_07862C(x, y_2, ...)"
02C44C  func  police_car_door_open
comment police_car_door_open After its wait, opens and lets out the goons its list holds for the players present.
# "if ((t1 & 1u) == 0u) return; @flags = 0u; d = 0x2200u"
02C47A  func  police_car_door_vanish
comment police_car_door_vanish When the door's animation ends, takes it away with sound 2200.

# ---- the carried obstacle (list 1 type 28) and the tossed one (type 17) ----
02C4AA  file  objects/obstacles    # (the carried and tossed obstacles)
# step 1: "if (t2 == 4u) { @unk_02 = 0xFFu; @unk_28 = 0u; }" (the carrier's step)
02C4AA  func  carried_obstacle_held
comment carried_obstacle_held While carried, drops when the carrier is knocked down.
# step 2 (the thrower sets it: 02A5C5 "mem_write8(u + 2u, 2u)"): "@flags = 0xC8u"
02C4BE  func  carried_obstacle_thrown
comment carried_obstacle_thrown Starts the obstacle's flight when thrown.
# sub_078638 and sub_07863B: no floor or a wall ahead: "@unk_02 = 0xFEu; ... d = 0x6500u"; else priority by the floor
02C4D6  func  carried_obstacle_check_floor
comment carried_obstacle_check_floor Breaks the flying obstacle (sound 6500) at a wall or a missing floor, else gives it the floor's priority.
# step 0: "u = object_setup_02DC91_ADDRESS" (kind 05 animation 06), its parent's facing, "@unk_3B = 8u"
02C553  func  carried_obstacle_start
comment carried_obstacle_start Sets up the obstacle with the animation its spawn's state gives, facing as its carrier.
# steps -2 / 7: switch on field 28
02C585  func  carried_obstacle_break_steps
comment carried_obstacle_break_steps Runs the obstacle's breaking by field 28.
# "@unk_0F = 0u; @unk_19 = 0u; @unk_05 = 0x80u"
02C58E  func  obstacle_break
comment obstacle_break Stops the object and starts its breaking animation.
# "if (t1 & 1u) @flags = 0u"
02C59D  func  obstacle_break_end
comment obstacle_break_end Takes the object away when its breaking animation ends.
# steps -1 / 8: switch on field 28
02C5A7  func  carried_obstacle_drop_steps
comment carried_obstacle_drop_steps Runs the dropped obstacle's fall and breaking by field 28.
# "sub_0785B1 ... d = 0x6500u; @unk_28 = t1 + 1u"
02C5B0  func  obstacle_fall_and_break
comment obstacle_fall_and_break Falls and, on landing, plays sound 6500 and goes on to break.
# type 17's step 1: "if ((int8_t)t2 < 0) { @unk_02 = 0xFFu; @unk_28 = 0u; }" (its holder's step)
02C5BF  func  tossed_obstacle_held
comment tossed_obstacle_held While held, drops when the holder is hit.
# "if (t1 == 1u) { @flags = 0xC8u; @unk_0F = 0xFD00u; @unk_19 = 0x300u; ... }"
02C5D1  func  tossed_obstacle_toss
comment tossed_obstacle_toss After 8 frames, is tossed to the left.
# hit box 7AA8 ("if (unk_4857 >= 3u) @unk_1C = ... | 0x1000u"), "@unk_05 = t1 | 0x80u", sub_0785C6
02C5EB  func  carried_obstacle_fly
comment carried_obstacle_fly Puts out the flying obstacle's hit box (stronger with 3 or more players) and its flying animation.
# "sub_0785B1 ... @unk_19 = 0x500u; @flags |= 8u; d = 0x6500u"
02C60B  func  carried_obstacle_bounce
comment carried_obstacle_bounce Falls and, on landing, bounces up again with sound 6500.
# "sub_0785B1 ... d = 0x6500u"
02C628  func  carried_obstacle_land
comment carried_obstacle_land Falls and lands again with sound 6500.
# "if (t1 != t2) { step - 1; @flags |= 8u; }", "if (t4 == 0u) { @unk_02 = 0xFEu; ... }"
02C637  func  carried_obstacle_slide
comment carried_obstacle_slide Slides along the floor, falling again off an edge, and breaks once it stops.
# "if (t1 == 5u && (@flags & 0x20u) != 0u) { @unk_02 = 0xFFu; @unk_28 = 0u; }"
02C683  func  throwable_check_hit
comment throwable_check_hit Stops a thrown object in flight when something hits it.
# steps -2 and -1: switch on field 28
02C69B  func  throwable_stop_steps
comment throwable_stop_steps Runs a throwable's end by field 28.
# "@flags = 0x80u; @unk_0F = 0u; @unk_19 = 0x80u; @unk_05 = 0x80u"
02C6A4  func  throwable_stop
comment throwable_stop Stops the throwable with a little hop and starts its end animation.
# "if (t1 & 1u) @flags = 0u"
02C6BB  func  throwable_stop_end
comment throwable_stop_end Takes the throwable away when its end animation ends.
# step 0: "u = object_setup_02DCB9_ADDRESS" (kind 04), "@unk_5B = 2u; @unk_05 = t1 | 0x80u; @unk_31 = t2 + 1u"
02C6C5  func  throwable_start
comment throwable_start Sets up a throwable with the animation its spawn's state gives.
# an RTS: steps 1 and 2
02C6DF  func  throwable_lie
comment throwable_lie Does nothing while the throwable lies or is carried.
# step 3: "@unk_31 = 0u; @unk_3D = 1u; @flags = 0x80u; step - 1"
02C6E0  func  throwable_pick_up
comment throwable_pick_up Picked up: marks it carried.
# step 4: "@unk_3D = 0u; @unk_05 = (t1 + 1u) | 0x80u", hit box 7AB8, sub_0785C6, sub_02C70D
02C6F0  func  throwable_throw
comment throwable_throw Thrown: shows its flying animation with its hit box, facing its way.
# "sub_078674(x)"
02C70D  func  throwable_hurt_enemies
comment throwable_hurt_enemies Hurts the enemies the flying throwable touches.
# "@flags = 0x88u", hit box 7AC0, "@unk_19 = 0x600u; @unk_0F = 0x100u" against its parent's facing, the floor under it
02C710  func  throwable_rebound
comment throwable_rebound Bounces the throwable up and back after it hits something.
# "sub_0785B1 ... @unk_02 = 0xFFu; @unk_28 = 0u", rising: sub_078674
02C74D  func  throwable_fall
comment throwable_fall Falls back to the floor, hurting enemies on the way up, then ends.

# ---- stage 1's platform scenery (list 1 type 05) and stage 2's charging scenery (list 1 type 1B) ----
02C775  file  objects/floor_scenery    # (the floor scenery)
# "y = loaded_table_02DCE1_ADDRESS; sub_02C7C7", "@unk_37 = t1 + 1u"
02C775  func  platform_scenery_first_part
comment platform_scenery_first_part Writes the first part of its shape into the floor map.
# "if (t1 >= 0x1B0u) return;" table 02DCED
02C77E  func  platform_scenery_second_part
comment platform_scenery_second_part Writes the second part once the scroll brings it left of 01B0.
# "if (t1 >= 0x190u) return;" table 02DCF9
02C78F  func  platform_scenery_third_part
comment platform_scenery_third_part Writes the third part once left of 0190.
# "if (t1 >= 0x170u) return;" table 02DD05
02C7A0  func  platform_scenery_fourth_part
comment platform_scenery_fourth_part Writes the fourth part once left of 0170.
# "if (t1 >= 0x150u) ...; y = loaded_table_02DD11_ADDRESS", "@unk_02 = 2u"
02C7B1  func  platform_scenery_last_part
comment platform_scenery_last_part Writes the last part once left of 0150, and settles.
# an RTS
02C7C6  func  platform_scenery_part_wait
comment platform_scenery_part_wait Does nothing until the scroll brings the next part in.
# like sub_02B2C2: 4 columns of 3 cells from Y, with 2000-3FFF switched to RAM through 480F/1FC2
02C7C7  func  platform_scenery_write_cells
comment platform_scenery_write_cells Writes 4 columns of 3 floor cells from the table in Y into the floor map at the object's column.
# step 0: "u = object_setup_02DCDB_ADDRESS" (kind 0F animation 00), "@unk_0C = 0x1BFu", the floor map cell, "@unk_37 = 0xFFu"
02C820  func  platform_scenery_start
comment platform_scenery_start Sets up the platform scenery at the screen's right edge, taking the floor map's row and column there.
# step 3: "if (t1 == 0u) { @unk_02 = 5u; ... }" else 20 columns of 3 cells set to field 33
02C86F  func  platform_scenery_clear_floor
comment platform_scenery_clear_floor Gives its 20 columns of floor back to the cell it stood on (or, not held, crashes down).
# "u = sub_02C8B1(x)"
02C8AE  func  platform_scenery_react
comment platform_scenery_react Runs the platform's reaction by field 28.
# switch on field 28: sub_02C8C8, sub_02C8BA, sub_02C8C9
02C8B1  func  platform_scenery_react_steps
comment platform_scenery_react_steps Settles the platform or presses it down by field 28.
# "@unk_16 = t1 (5C); @unk_06 = 0x80u; @unk_28 = t2 - 1u"
02C8BA  func  platform_scenery_settle
comment platform_scenery_settle Puts the platform back on its floor and starts its animation again.
# an RTS
02C8C8  func  platform_scenery_idle
comment platform_scenery_idle Does nothing.
# "t3 = (uint8_t)((uint32_t)t1 << 1) + t2; @unk_16 = t3" (1874: the players present)
02C8C9  func  platform_scenery_press
comment platform_scenery_press Moves the platform by twice the players present and starts its animation again.
# step 4: "@unk_3D = 0u; @unk_0F = 0x400u; @unk_19 = 0x400u", hit box 7B10
02C8DE  func  platform_scenery_launch
comment platform_scenery_launch Sends the platform flying with its hit box.
# "sub_0785B1 ...; d = 0x6E00u; @unk_05 = 0x81u; @unk_3B = 4u", children 02DD23 and 02DD29 (list 2 type 0D)
02C8FC  func  platform_scenery_crash
comment platform_scenery_crash Lands with a crash (sound 6E00), throwing off two pieces, hurting the enemies it touches.
# "if (t1 == 1u) { @flags = 0x84u; @unk_0F = 0u; @unk_3B = 0x10u; ... }"
02C923  func  platform_scenery_crash_wait
comment platform_scenery_crash_wait Waits 4 frames after the crash, then stops.
# "@flags ^= 0x84u", "if (t1 == 1u) @flags = 0u"
02C93B  func  platform_scenery_vanish
comment platform_scenery_vanish Blinks for 16 frames and goes away.
# list 2 type 0D's step 0: "u = object_setup_02DD37_ADDRESS" (kind 0F animation 02), "@unk_0F = 0xFE00u; @unk_19 = 0x400u"
02C955  func  scenery_debris_start
comment scenery_debris_start Sends a piece of the crashed platform flying.
# "if (carry) { @unk_19 = 0x200u; ... }"
02C970  func  scenery_debris_bounce
comment scenery_debris_bounce Bounces the piece once on landing.
# "if (carry == 0u) ...; step + 1"
02C97F  func  scenery_debris_land
comment scenery_debris_land Lands the piece for good.
# an RTS
02C987  func  scenery_debris_idle
comment scenery_debris_idle Does nothing once the piece lies.
# "@unk_37 = 0u", three times "y = loaded_table_02DD71_ADDRESS; sub_02C7C7"
02C991  func  charging_scenery_clear_floor
comment charging_scenery_clear_floor Writes its three floor parts back to plain floor as it leaves.
# "y = loaded_table_02DD4D_ADDRESS; sub_02C7C7"
02C9B9  func  charging_scenery_first_part
comment charging_scenery_first_part Writes the first part of its shape into the floor map.
# "if (t1 >= 0x180u) return;" table 02DD59
02C9C3  func  charging_scenery_second_part
comment charging_scenery_second_part Writes the second part once the scroll brings it left of 0180.
# "if (t1 >= 0x1A0u) ...;" table 02DD65
02C9D5  func  charging_scenery_last_part
comment charging_scenery_last_part Writes the last part once left of 01A0.
# an RTS
02C9E6  func  charging_scenery_part_wait
comment charging_scenery_part_wait Does nothing until the scroll brings the next part in.
# step 0: "u = object_setup_02DD7D_ADDRESS" (kind 0F animation 20), "@unk_5B = 0x40u", the floor map cell, "@unk_37 = 0u"
02C9E7  func  charging_scenery_start
comment charging_scenery_start Sets up the charging scenery behind the players, taking the floor map's row and column under it.
# "if (t1 == 3u) step + 1" (field 37)
02CA3A  func  charging_scenery_wait_shape
comment charging_scenery_wait_shape Waits until its three floor parts are written.
# "u = player_objects[a & 3u]; t1 = mem_read8(u); ... if (t1 != 0u) break" up to 4 tries from the frame count's low byte
02CA45  func  pick_random_player
comment pick_random_player Picks a player object in play, starting from a random one (the frame count's low byte).
# "if (t1 < 0x128u) { u = sub_02CA45(); sub_078626; if (t2 == 0xA0u) { ... @unk_0F = 0xFE00u; @unk_14 = 0xFC00u;
# sub_02C991; charging_scenery_goon_left, and 02DD93 for more than 2 players } }" (list 0 type 06: goon_with_hat)
02CA5B  func  charging_scenery_wait_target
comment charging_scenery_wait_target Once on screen with a player at the right angle, charges up and left, letting out one or two goons with hats.
# "if (t1 < 0x40u) { @flags = 0u; ... }", "flags ^ 0x40u", hit power 02 / 14 in turn, sub_078674
02CA9A  func  charging_scenery_charge
comment charging_scenery_charge Charges, hurting the players and the enemies in turn, until it leaves at the top.

# ---- the obstacles that raise the floor (list 1 type 00) ----
02CB0C  file  objects/obstacles    # (the obstacles that raise the floor)
# "if (t2 != 0u) { ... the carrier's priority }" (3D: carried), else sub_078638 / sub_07863B: off an edge "@unk_02 = 0xFEu"
02CB0C  func  throwable_follow_floor
comment throwable_follow_floor Keeps a throwable on its floor (or its carrier's priority while carried), ending it when it goes off an edge.
# list 1 type 00's step 0: "u_2 = object_setup_02DDCD_ADDRESS", "@unk_47 = obstacle_heights[t7 >> 1]", then
# "sub_02CC4A(x, d_2, ...)" once 28 is set
02CB7D  func  obstacle_start
comment obstacle_start Sets an obstacle up by its spawn's state and, once on screen, raises the floor under it by its height.
# steps -2: switch on field 29
02CBCD  func  obstacle_smashed_steps
comment obstacle_smashed_steps Runs the obstacle's smashing by its substep.
# "d = 0x6C00u", stops, "if (t1 != 0u) u = sub_02CCE8(x)", "@unk_05 = 0x80u"
02CBD6  func  obstacle_smashed
comment obstacle_smashed Smashes the obstacle (sound 6C00), giving the floor back, and starts its breaking animation.
# "if (t1 & 1u) @flags = 0u"
02CBF6  func  obstacle_smashed_end
comment obstacle_smashed_end Takes the smashed obstacle away when its animation ends.
# steps -1: switch on field 28
02CC00  func  obstacle_knocked_steps
comment obstacle_knocked_steps Runs the knocked obstacle by field 28, hurting the enemies it touches.
# hit box 7AA0, "@unk_0F = 0x400u" away from the hitter (field 25's x), "@unk_29 = 0u"
02CC0C  func  obstacle_knocked
comment obstacle_knocked Sends the obstacle sliding away from what hit it, with its hit box.
# "sub_0785B1(...); sub_078674(x)"
02CC42  func  obstacle_knocked_fall
comment obstacle_knocked_fall Falls while sliding, hurting the enemies it touches.
# "io_write8(VIDEO_188B, d >> 8)", sub_078650, the 3 cells: a different cell or "a >= 0x10u" fails ("@unk_02 = 0xFEu"),
# else "mem_write8(u, a)" with the height added, "@unk_31 = t11 + 1u"
02CC4A  func  obstacle_raise_floor
comment obstacle_raise_floor Raises the 3 floor cells under the object by A steps; if they differ or would overflow, the object breaks instead.
# "mem_write8(u, a)" with field 33 for the 3 cells, "@unk_31 = 0u"
02CCE8  func  obstacle_restore_floor
comment obstacle_restore_floor Gives the 3 floor cells under the object their old value back.
# step 1: "y = hit_box_02DA98_ADDRESS", raising by 4 first when neither carried nor 28 set
02CD2B  func  obstacle_settle
comment obstacle_settle Gives the obstacle its standing hit box, raising the floor first if needed.
# an RTS
02CD43  func  obstacle_lie
comment obstacle_lie Does nothing while the obstacle stands.
# step 3: "@flags = 0x80u; u = sub_02CCE8(x); step - 1"
02CD44  func  obstacle_pick_up
comment obstacle_pick_up Picked up: gives the floor under it back.
# step 4: under its floor "@unk_02 = 0xFEu", else hit box 7AA0, "@unk_3D = 0u", sub_078674
02CD50  func  obstacle_throw
comment obstacle_throw Thrown: puts out its hit box (or, already on the floor, smashes).
# "if (carry) { @unk_19 = 0x400u; @unk_05 = t1 | 0x80u; @unk_02 = 0xFFu; @unk_28 = 1u; }", sub_078674
02CD7B  func  obstacle_fly
comment obstacle_fly Flies until it lands, then bounces once more.
# step 6: "@unk_19 = 0x600u; @unk_0F = 0x100u" against the parent's facing
02CD9A  func  obstacle_rebound
comment obstacle_rebound Bounces the thrown obstacle up and back after it hits something.
# "if ((int16_t)t1 >= 0) return y;" then hit box 7AA0, sub_078674
02CDBF  func  obstacle_rebound_rise
comment obstacle_rebound_rise Rises after the rebound; when it starts falling, puts its hit box back out.
# "@unk_0F = 0x400u" by the way it went, "@unk_19 = 0x400u", "@unk_02 = 0xFFu; @unk_28 = 1u"
02CDD4  func  obstacle_rebound_fall
comment obstacle_rebound_fall Falls and, on landing, bounces on the way it was going.

# ---- stage 1's solid scenery (list 1 type 11) ----
02CE41  file  objects/floor_scenery    # (stage 1's solid scenery)
# step 0: "u = object_setup_02DDDF_ADDRESS" (kind 0F animation 16), "@unk_16 = t2 + 0x4Cu", "u = sub_02D218(x)"
02CE41  func  solid_scenery_start
comment solid_scenery_start Sets up the solid scenery raised off the floor and blocks the floor cells under it.
# an RTS
02CE65  func  solid_scenery_idle
comment solid_scenery_idle Does nothing.

# ---- stage 5's boulders and rocks ----
02CE6F  file  objects/boulder    # stage 5's gorge: the falling boulders and the rocks
# step 0: "u = object_setup_02DDEF_ADDRESS" (kind AF boulder animation 03), "@flags = 4u", "@unk_3D = a",
# "boulder_drop = boulder_drops_ADDRESS + ...", zoom 4040
02CE6F  func  boulder_start
comment boulder_start Sets a boulder up, hidden: whether it bounces away, its floor height and its wait, by its spawn's state.
# "if (t1 != 1u) { ... if (t3 == 0x10u) { @flags = 0x88u; @unk_06 = 0x80u; } return; }", state bit 7: "@unk_02 = 4u"
02CEB3  func  boulder_wait
comment boulder_wait Waits, showing the boulder 16 frames before it falls; a boulder with state bit 7 falls in front.
# "@unk_19 = t1 - 0x30u; carry = sub_078662(x)", landing "d = 0x6500u", "@unk_14 = 0xFD00u; @unk_19 = 0x400u" or a
# short bounce
02CF01  func  boulder_fall
comment boulder_fall Falls; on landing (sound 6500) bounces, far into the distance or a little.
# "if (((uint8_t)unk_4815 & 1u) == 0u) { @flags |= 0x40u; @unk_1C = ... | 0xAu; } else { ... | 0x14u; sub_078674 }"
02CF41  func  boulder_hurt
comment boulder_hurt Hurts the players and the enemies it touches on alternate frames.
# zoom down to 2020 while bouncing away, sub_078638: no floor "@unk_14 = 0u", else bounce "d = 0x6500u"
02CF65  func  boulder_bounce
comment boulder_bounce Bounces along (shrinking into the distance for one that bounces away) until it falls off the floor.
# "if ((int16_t)t1 < 0 && d < 0xFF80u) { d = 0x6500u; ...; @flags = 0u; }", zoom "d = t4 + 0x202u; if (d < 0x8080u)"
02CFF4  func  boulder_fall_in_front
comment boulder_fall_in_front Falls past the floor growing bigger, as if towards the screen, and goes away with sound 6500.
# list 1 type 2B's step 0: "u = object_setup_02DE0B_ADDRESS" (kind AF animation 02); state 0:
# "OBJECT(OBJECT_ADDRESS(0))->unk_44 = 0x97u" for the 4 players
02D043  func  gorge_rock_start
comment gorge_rock_start Sets a rock up; the first also sets the four players' field 44 to 97.
# "if ((@flags & 0x20u) != 0u) { @flags = 0x80u; @unk_05 = 0x81u; @unk_3B = 0x40u; ... }"
02D06E  func  gorge_rock_wait_hit
comment gorge_rock_wait_hit Waits until something hits the rock, then starts its breaking animation.
# "if (t1 & 1u) @flags = 0u"
02D088  func  gorge_rock_break_end
comment gorge_rock_break_end Takes the rock away when its breaking animation ends.

# ---- the shaking scenery (list 1 type 06) and what falls off it ----
02D098  file  objects/shaking_scenery    # the scenery that shakes when hit, and what falls off it
# list 1 type 23's step 0: "u = object_setup_02DE15_ADDRESS" (kind 09 animation 0E), "@unk_3B = 0x20u; @unk_0F = 0x20u;
# @unk_19 = 0xFF00u", state 1 "@unk_05 = 0x90u"
02D098  func  shaken_bit_start
comment shaken_bit_start Sets up a small piece falling off the shaking scenery.
# "if (t1 != 1u) { if (t2 < 0x10u) @flags = 0u; return; } @flags = 0u"
02D0CB  func  shaken_bit_fall
comment shaken_bit_fall Falls for 32 frames or until near the floor, then goes away.
# list 1 type 2F's step 0: "u = object_setup_02DE23_ADDRESS" (kind 10 animation 1F), "@unk_30 = 0x1Cu"
02D0E5  func  shaken_object_start
comment shaken_object_start Sets up the object sitting on the shaking scenery.
# "if ((mem_read8(u) & 0x40u) == 0u) { @flags = 0x88u; step + 1 }" (its parent's flags)
02D103  func  shaken_object_wait
comment shaken_object_wait Waits until the scenery under it shakes, then starts falling.
# "if (carry) { @flags = 0x88u; @unk_0F = 0x200u; @unk_19 = 0x200u; step + 1 }"
02D116  func  shaken_object_fall
comment shaken_object_fall Falls and bounces off the floor.
# landing: no floor "@flags = 0u", else "@type = 1; @unk_02 = 0u; y = child_object_02DE29_ADDRESS; sub_07862F" (list 2
# type 18: the chaser)
02D12D  func  shaken_object_land
comment shaken_object_land Lands for good: becomes a throwable (list 1 type 01) and lets out a buzzing chaser.
# "if ((int8_t)t1 >= 0 && (@flags & 0x20u) != 0u) { ... if (t5 >= 0x50u) { @flags = 0x80u; @unk_02 = 0xFDu; ... } }"
02D15A  func  shaking_scenery_check_hit_from_above
comment shaking_scenery_check_hit_from_above When hit by something 0050 or more over its floor, starts the reaction to a hit from above.
# an RTS
02D182  func  shaking_scenery_idle
comment shaking_scenery_idle Does nothing between hits.
# step 0: "u = object_setup_02DEAD_ADDRESS"; state 81: the three children 02DE75, 02DE7D, 02DE85 (list 1 type 1C, kind
# A0); other states: 02DE8D (list 1 type 2F); then object_16_flags, object_16_kinds, object_16_animation_runs, "@unk_3C = 5u"
02D183  func  shaking_scenery_start
comment shaking_scenery_start Sets the scenery up by its spawn's state: its kind, food pattern and shake animations, and what sits in it.
# sub_078650, "@unk_33 = stack; @unk_2A = u", the 3 cells "mem_write8(u, a)" with "a = 0xFFu"
02D218  func  scenery_block_floor
comment scenery_block_floor Marks the 3 floor cells under the object as no floor, keeping the cell's old value and place.
# steps -4: switch on field 29
02D26C  func  shaking_scenery_shake_steps
comment shaking_scenery_shake_steps Runs the scenery's shake by its substep.
# "d = unk_4800_ADDRESS" (sound 4800), "@unk_05 = t1" (field 50)
02D275  func  shaking_scenery_shake
comment shaking_scenery_shake Plays sound 4800 and the shake's first animation.
# "if (t1 & 1u) { @unk_05 = t2 (51); ... }", "if ((t4 & 2u) == 0u) return; d = 0xC01u"
02D285  func  shaking_scenery_shake_second
comment shaking_scenery_shake_second After the first animation, the second; at its mark, sound 0C01.
# "if (t1 & 1u) { @unk_05 = t2 (52); ... }"
02D2A3  func  shaking_scenery_shake_third
comment shaking_scenery_shake_third After the second animation, the third.
# "if (t1 & 1u) { @unk_05 = t2 (53); ... }"
02D2B3  func  shaking_scenery_shake_fourth
comment shaking_scenery_shake_fourth After the third animation, the fourth.
# "if (t1 & 1u) { @flags = 0xC0u; @unk_05 = (uint8_t)(@unk_54 >> 8u); @unk_02 = 1u; }"
02D2C3  func  shaking_scenery_shake_end
comment shaking_scenery_shake_end After the fourth animation, goes back to standing.
# steps -3: switch on field 28
02D2DA  func  shaking_scenery_hit_from_above_steps
comment shaking_scenery_hit_from_above_steps Runs the reaction to a hit from above by field 28.
# "@unk_05 = t1 + 1u; @unk_3B = 0x20u", "y = child_object_02DEC9_ADDRESS" or 02DEC1 for kind 0F (list 1 type 23)
02D2E3  func  shaking_scenery_drop_bit
comment shaking_scenery_drop_bit Shows its hit animation and drops a small piece.
# steps -2: switch on field 28
02D305  func  shaking_scenery_hit_steps
comment shaking_scenery_hit_steps Runs the reaction to a hit by field 28.
# "y = child_object_02DED5_ADDRESS" (list 2 type 0E: food jumping out), its state from the pattern "mem_read8(y + (t3 &
# 0xFu))" or field 47 by the players in the game, "@unk_3C = t2 - 1u" ("@unk_1B = 0u" at the last), "d = 0x1C00u"
02D30E  func  shaking_scenery_drop_food
comment shaking_scenery_drop_food Lets out the next food of its pattern (sound 1C00); after the fifth it can take no more.
# "if (t1 == 1u) { @unk_05 = t2 (3D); @unk_02 = 1u; @flags = 0xC0u; @unk_28 = 0u; }"
02D359  func  shaking_scenery_recover
comment shaking_scenery_recover After 32 frames, goes back to standing.

# ---- the running animals (list 1 type 03) ----
02D385  file  objects/running_animal    # the dogs and squirrels running across the stages
# steps -2 and -1: switch on field 29
02D385  func  running_animal_hit_steps
comment running_animal_hit_steps Runs the animal's knock-away by its substep.
# "@unk_04 = 4u; @unk_05 = t1 + 1u" (field 2C's low byte), "@unk_14 = 0xFD00u; @unk_19 = 0x80u", zoom 4040
02D38E  func  running_animal_knocked
comment running_animal_knocked Knocked away: shows its knocked look and flies up the screen.
# zoom down to 2020, "sub_078647(x, &d_2, &negative); if ((int8_t)a >= 0) return;" then the floor, "@unk_19 = 0xFF80u"
02D3B4  func  running_animal_knocked_away
comment running_animal_knocked_away Flies away shrinking until there is no floor ahead, then drops.
# zoom back up to 4040, landing: "@unk_04 = t4 (2C's high byte); @unk_05 = 0x80u; @unk_0F = 0x200u"
02D3E6  func  running_animal_knocked_back
comment running_animal_knocked_back Grows back and, on landing at full size, runs off again.
# an RTS
02D436  func  running_animal_gone
comment running_animal_gone Does nothing (after it ran off).
# step 0: "u = object_setup_02DF0B_ADDRESS", "running_animal = running_animals_ADDRESS + ...", "@unk_2C = kind and
# animation", "@unk_50/51 = running_animal_timings[...]", "@unk_3B = 0x40u; @unk_3C = 2u; @unk_0F = 0x100u"
02D437  func  running_animal_start
comment running_animal_start Sets an animal up by its spawn's state: its kind, look, timings, and runs it in from its side.
# "if (t1 == 1u) { @unk_3B = t2 (50); @flags = 0xC0u; ... @unk_0F = 0u; @unk_05 = 0x81u; }"
02D494  func  running_animal_run
comment running_animal_run Runs for 64 frames, then stops for its stop time.
# "if (t1 != 0u) ...", "@unk_0F = t4 (3E-3F)", "@unk_3C = t5 - 1u" (last: "@unk_02 = 7u")
02D4B5  func  running_animal_stop
comment running_animal_stop After its stop, runs again; after its second run it runs off for good.
# an RTS
02D4EA  func  running_animal_idle
comment running_animal_idle Does nothing.
# step 3: "@unk_3D = 1u; @flags = 0x80u; @unk_04 = 4u; @unk_05 = t1" (field 2C's low byte), step - 1
02D4EB  func  running_animal_picked_up
comment running_animal_picked_up Picked up: marked carried, with its carried look.
# step 4: "if (t1 == 0u) d = 0x5F00u" (field 44: quiet), "if (t2 == 0u) @unk_0F = (int16_t)t3 >> 1" (field 51: fast),
# hit box 7B20
02D503  func  running_animal_thrown
comment running_animal_thrown Thrown: yelps (sound 5F00) unless quiet, at half speed unless fast, with its hit box.
# "sub_078674(x)"
02D52E  func  running_animal_hurt_enemies
comment running_animal_hurt_enemies Hurts the enemies the thrown animal touches.
# "@unk_04 = t1 (2C's high byte); @unk_05 = 0x80u; @unk_02 = 0xFEu; @unk_11 = t2 + 2u; @unk_06 = 0x80u"
02D531  func  running_animal_land
comment running_animal_land Lands from the throw back in its own look, and is knocked away.

# ---- small throwables and Dreamland's obstacles ----
02D55C  file  objects/obstacles    # (the bouncing throwable and Dreamland's obstacles)
# list 1 type 2D's step 0: "u = object_setup_02DF25_ADDRESS" (kind 04 animation 1A), "@unk_3C = 1u"
02D55C  func  bouncing_throwable_start
comment bouncing_throwable_start Sets up the throwable that bounces once.
# an RTS
02D56D  func  bouncing_throwable_lie
comment bouncing_throwable_lie Does nothing while it lies or is carried.
# step 3: "@unk_31 = 0u; @unk_3D = 1u; @flags = 0x80u; if (t1 == 2u) @flags = 4u" (field 58)
02D56E  func  bouncing_throwable_pick_up
comment bouncing_throwable_pick_up Picked up: marks it carried (hidden for field 58's 2).
# step 4: "@unk_05 = (t1 + 1u) | 0x80u", hit box 7B30, sub_0785C6, sub_078674
02D58A  func  bouncing_throwable_throw
comment bouncing_throwable_throw Thrown: shows its flying animation with its hit box.
# "if (carry) { if (t1 != 0u) { @unk_3C = t2 - 1u; @unk_19 = 0x200u; @flags = 0x88u; } }", sub_078674
02D5AA  func  bouncing_throwable_fly
comment bouncing_throwable_fly Flies, bouncing once on landing, hurting the enemies it touches.
# list 1 type F2's step 0: "u = object_setup_02DF41_ADDRESS" (kind 05), "@flags = 4u", "obstacle_drop =
# dreamland_obstacle_drops_ADDRESS + ...", "@unk_32 = a"
02D5E2  func  dreamland_obstacle_start
comment dreamland_obstacle_start Sets up a hidden Dreamland obstacle: its animation, its wait and its x.
# an RTS
02D619  func  dreamland_obstacle_idle
comment dreamland_obstacle_idle Does nothing while it lies.
# step 1: switch on field 29
02D61A  func  dreamland_obstacle_drop_steps
comment dreamland_obstacle_drop_steps Runs the obstacle's throw-in by its substep.
# "if (t1 != 1u) return; d = 0x301u; @flags = 0xC8u; @unk_0F = 0x300u; @unk_19 = 0xFF00u"
02D623  func  dreamland_obstacle_throw_in
comment dreamland_obstacle_throw_in After its wait, is thrown in with sound 0301.
# "sub_0785B1 ... @unk_05 = t1 + 1u; d = VIDEO_2000; @unk_0F = 0u"
02D643  func  dreamland_obstacle_land
comment dreamland_obstacle_land Lands with sound 2000 and stops.
# "if ((t1 & 1u) == 0u) return y; @unk_05 = t2 + 2u; @flags = 0xC0u", hit box 7A98, "@unk_02 = 2u"
02D65C  func  dreamland_obstacle_settle
comment dreamland_obstacle_settle When its landing animation ends, stands as an obstacle to pick up.
# step 3: "@flags = 0x80u; @unk_05 = t1 (32); step - 1"
02D683  func  dreamland_obstacle_pick_up
comment dreamland_obstacle_pick_up Picked up: shows its first animation again.

# ---- the bird that comes down as an object (list 1 type 2E) ----
02D69B  file  objects/bird_item    # the bird that rises, flutters and turns into an object to pick up
# step 0: "u = object_setup_02DF7D_ADDRESS" (kind 8B bird), "@unk_16 = 0xFF80u", "@unk_19 = VIDEO_00C0"
02D69B  func  bird_item_start
comment bird_item_start Sets the bird up under the floor, rising.
# "if ((int16_t)t1 >= 0 && d >= 0x70u) { @unk_19 = 0xFF00u; @unk_3B = 0x30u; ... }"
02D6BB  func  bird_item_rise
comment bird_item_rise Rises until 0070 over the floor.
# "if (t1 != 1u) { @unk_19 = 0u - t2; return; }", "@unk_14 = 0xFF00u; @unk_19 = 0x200u; @unk_5C = 0x50u; @unk_05 = 0x81u"
02D6D4  func  bird_item_flutter
comment bird_item_flutter Flutters in place for 48 frames, then flies up the screen.
# "if (carry) { ... @unk_04 = 5u; @unk_05 = 0x8Cu; @type = 1; @unk_02 = 2u; ... }"
02D6FD  func  bird_item_land
comment bird_item_land Comes down as a kind 05 object (animation 8C) lying as a throwable (list 1 type 01).

# ---- the rising scenery (list 1 type 16) ----
02D728  file  objects/floor_scenery    # (the rising scenery)
# step 0: "u = object_setup_02DFA5_ADDRESS" (kind 0F animation 17); state set: "io_write8(VIDEO_187F, 0u); @unk_04 =
# 0x10u; @unk_05 = 7u"; "rising_scenery_camera_xs[...]" into 3E-3F
02D728  func  rising_scenery_start
comment rising_scenery_start Sets the rising scenery up (kind 10 for the second) and the camera x it waits for.
# "if (t1 < t2) return; if (t3 == 0u) d = 0x4600u; @unk_19 = 0x200u; @unk_3B = 0x40u"
02D76E  func  rising_scenery_wait_camera
comment rising_scenery_wait_camera Waits for the camera, then starts rising (sound 4600 for the first).
# "unk_48A7--", "if (t1 == 1u) @flags = 0u", "if (a == 0x20u) io_write8(VIDEO_187F, a)"
02D790  func  rising_scenery_rise
comment rising_scenery_rise Rises out of the stage for 64 frames holding the scroll, then goes away.

# ---- the kind 87 character and its device (list 1 types 08 and 26) ----
02D7B0  file  objects/woman_in_apron    # the kind 87 character of stage 1 and its device
# list 1 type 26's step 0: "u = object_setup_02DFBB_ADDRESS" (kind 0F animation 06)
02D7B0  func  woman_in_apron_device_start
comment woman_in_apron_device_start Sets up the device.
# "if ((unk_4815 & 0xFu) != 0u || (@flags & 0x20u) == 0u) ...; mem_write8(u_2 + 2u, 3u)" (its parent's step)
02D7BD  func  woman_in_apron_device_wait_hit
comment woman_in_apron_device_wait_hit Checks every 16 frames whether a player hit the device, and then calls its keeper over.
# an RTS
02D7D6  func  woman_in_apron_device_idle
comment woman_in_apron_device_idle Does nothing.
# step 3 (the keeper sets it: 02D935): hit box 7F8B, "@unk_3C = t1 - 1u", power 8 on odd counts, "d = 0x6000u;
# @unk_05 = 0x87u"
02D7D7  func  woman_in_apron_device_strike
comment woman_in_apron_device_strike Worked by its keeper: strikes (sound 6000), harder every other time.
# "if ((t1 & 1u) == 0u) return y; y = hit_box_02DF83_ADDRESS; @unk_3B = 0x20u"
02D7FA  func  woman_in_apron_device_strike_end
comment woman_in_apron_device_strike_end When the strike's animation ends, takes its standing hit box back.
# "if (t1 == 1u) { @unk_05 = 0x88u; ... }"
02D80F  func  woman_in_apron_device_reset
comment woman_in_apron_device_reset After 32 frames, starts its reset animation.
# "if (t1 & 1u) { @unk_3B = 0x40u; ... }"
02D81D  func  woman_in_apron_device_reset_end
comment woman_in_apron_device_reset_end When the reset ends, waits 64 frames.
# "if (t1 == 1u) @unk_02 = 1u"
02D82C  func  woman_in_apron_device_rest
comment woman_in_apron_device_rest After its rest, waits for the next hit.
# list 1 type 08's step 0: "u = object_setup_02DFD9_ADDRESS" (kind 87), "@unk_3E ... = x + camera - 0x30",
# "y = child_object_02DFD1_ADDRESS" (list 1 type 26, its device), "@unk_40 = u", "@unk_0C = 0x18Eu", "@unk_0F = 0xFF00u"
02D86A  func  woman_in_apron_start
comment woman_in_apron_start Sets up the kind 87 character with its device, walking in from the right edge.
# "if (t1 == 1u) { @unk_3B = 0x20u; @unk_0F = 0u; @unk_05 = 0x80u; ... }"
02D8B4  func  woman_in_apron_stop
comment woman_in_apron_stop After 64 frames stops.
# "@unk_3B = (unk_4858 & 0x3Fu) + 0x10u", a random way, or back towards 3E-3F, "@unk_05 = 0x81u", step - 1
02D8CA  func  woman_in_apron_wander
comment woman_in_apron_wander After a random wait, walks a random way, or back towards its home.
# step 3 (its device sets it): "@unk_0F = 0x400u" towards the device, "@unk_31 = t5 + 1u"
02D913  func  woman_in_apron_run_to_device
comment woman_in_apron_run_to_device Runs to its device.
# "if (t6 < 4u) { @unk_0F = 0u; @unk_14 = 0xFF00u; @unk_3B = 8u; mem_write8(u + 2u, 3u); ... }"
02D935  func  woman_in_apron_reach_device
comment woman_in_apron_reach_device At the device, steps behind it and works it.
# "if (t1 == 1u) { @unk_14 = 0u; @unk_3B = 0x20u; @unk_05 = 0x80u; ... }"
02D96D  func  woman_in_apron_behind_device
comment woman_in_apron_behind_device Stands behind the device for 32 frames.
# "if (t1 == 1u) { ... @unk_14 = 0x100u; @unk_3B = 8u; @unk_05 = 0x81u; ... }"
02D983  func  woman_in_apron_come_back
comment woman_in_apron_come_back Steps back out from behind the device.
# "if (t1 == 1u) { @unk_14 = 0u; @unk_02 = 1u; @unk_3B = 1u; }"
02D9A9  func  woman_in_apron_back
comment woman_in_apron_back Back in front of the device: wanders again.

# ---- the kind 95 character (list 1 type 09) ----
02D9C6  file  objects/rabbit    # the kind 95 character of stage 2
# step -3: "d = 0x6300u; @unk_0F = 0xFE00u; @unk_05 = 0x81u; @unk_02 = 0xFDu"
02D9C6  func  rabbit_beaten
comment rabbit_beaten Beaten: cries out (sound 6300) and runs off to the left.
# steps -1: switch on field 29
02D9DF  func  rabbit_hit_steps
comment rabbit_hit_steps Runs its reaction to a hit by its substep.
# "@unk_05 = 0x82u; @unk_3B = 0x40u"
02D9E8  func  rabbit_hit
comment rabbit_hit Shows its hit animation for 64 frames.
# an RTS
02D9F5  func  rabbit_wait
comment rabbit_wait Does nothing.
# "if (t1 == 1u) { @flags = 0xC0u; @unk_02 = 1u; @unk_05 = 0x80u; }"
02D9F6  func  rabbit_hit_end
comment rabbit_hit_end After its hit animation, stands again.
# step 0: "u = object_setup_02DFED_ADDRESS" (kind 95, life 4)
02DA0A  func  rabbit_start
comment rabbit_start Sets up the kind 95 character.
# an RTS
02DA13  func  rabbit_stand
comment rabbit_stand Does nothing while it stands.

# ======== bank 17 ========

02E000  file  objects/bank_entries    # (bank 17's entries)
# list 1 type 25 (s0): steps sub_02E07B, sub_02E0AA (looping_scenery_moves)
02E000  func  looping_scenery_update
comment looping_scenery_update Runs stage 1's scenery that moves across the screen and comes round again.
# list 1 type 27 (s5, s9; the cemetery obstacles' food 02C0BD "@type = 0x27"): steps sub_02E2DD ... sub_02E353
02E003  func  food_update
comment food_update Runs a piece of food lying in the stage until a player eats it.
# list 2 type 0E (shaking_scenery's child 02DED5): steps sub_02E217 ... (food_move_choices, food_moves)
02E006  func  food_jump_out_update
comment food_jump_out_update Runs food jumping out of the shaking scenery, then lying until eaten or gone.
# list 0 type 02 (s0): steps sub_02E6AE, sub_02E71C (setup 7C53 kind 90, behaviour 02FBEF: action 08 only)
02E009  func  fireman_goon_update
comment fireman_goon_update Runs the kind 90 enemy of stage 1 that throws things: its entrance, then the enemies' shared fight.
# action 08 (kind 90's behaviour 02FBEF, all ranges 08): steps from 7C6D: sub_02E78A, sub_02E793, sub_02E7B9
02E00C  func  fireman_goon_throw_update
comment fireman_goon_throw_update Runs enemy action 08: the kind 90 enemy throws at its target.
# list 2 type 0A (kind 90's child 02FC73): steps sub_02E7E4 ... (setup 7C81 kind 90 animation 13)
02E00F  func  fireman_goon_missile_update
comment fireman_goon_missile_update Runs what the kind 90 enemy throws, gone when its animation ends.
# list 1 type 24: "02E012 LBRA $785D", an RTS; nothing puts one in
02E012  func  empty_object_type_24_handler
comment empty_object_type_24_handler Unused: the handler of list 1's type 24, which does nothing; no object of that type is put in.
# list 0 type 07 (let out by the Krustyland doors, 02BDE5-02BDF5): steps sub_02EF0F, sub_02EF44 (setup 7E27 kind 98,
# behaviour 02FCE6: actions 10 and 36)
02E015  func  one_eared_rabbit_update
comment one_eared_rabbit_update Runs the kind 98 enemy of Krustyland: its walk out of a door, then the enemies' shared fight.
# list 1 type 29 (s0): steps sub_02E635 ... (bystanders)
02E018  func  bystander_update
comment bystander_update Runs a bystander of stage 1 who flees when the police car stops.
# list 1 type 3B (07F4B0 + 3B = 17, 07F40D + 2 x 3B = 601B); no spawn list holds a list 1 type 3B (the spawns of type 3B
# are list 0's, bank 14's) and no scenario runs it (0/6): step 0 sub_0785D5 (07D43B, the goon's setup), then kind 98's steps
02E01B  func  unused_goon_update
comment unused_goon_update Unused: would run a goon (the fixed program's setup) with the kind 98 enemy's steps; no list 1 type 3B is put in.
# action 10 (kind 98's ranges: 10 10 10 10): steps from 7E3B: sub_02EFD5, sub_02EFE1, sub_02EFF2, sub_02EFFB
02E01E  func  one_eared_rabbit_strike_update
comment one_eared_rabbit_strike_update Runs enemy action 10: the kind 98 enemy strikes.
# list 0 type 09 (s1): steps sub_02F08C, sub_02F0D8 (clown_on_ball_poses); "if (t1 != 4u) ... else { @unk_42 = 0u;
# @unk_57 = 0u; }"
02E021  func  clown_on_ball_update
comment clown_on_ball_update Runs the clown on a ball: its pose until it comes on screen, then the enemies' shared fight.
# action 1C (clown_on_ball's ranges: 34 34 1C 34): steps from 7E73: sub_02F0F0, sub_02F0F9 (no scenario runs it: 0/4)
02E024  func  clown_on_ball_strike_update
comment clown_on_ball_strike_update Runs enemy action 1C: the clown on a ball strikes.
# list 2 type 09: steps sub_02F02C, sub_02F055, sub_02F068, then the burst's (setup 7E53 kind 96 animation 11)
02E027  func  clown_ball_update
comment clown_ball_update Runs a ball thrown off by a clown, which bursts on landing.
# list 1 type 02: steps sub_02F7B6 ... (setup 7FD5 kind 01 homer); no spawn list holds one and no scenario runs it (0/6)
02E02A  func  unused_homer_object_update
comment unused_homer_object_update Unused: runs an object with Homer's sprites that holds the player who hits it; nothing puts one in.
# action 1E (clown_on_ball's range 30-38: 34 34 1E 34): steps from 7E77: sub_02F111, sub_02F13E
02E02D  func  clown_on_ball_jump_update
comment clown_on_ball_jump_update Runs enemy action 1E: the clown on a ball jumps at its target.
# list 1 type 15 (s0): steps sub_02F75C, sub_02F787 (random_pose_figures)
02E030  func  random_pose_figure_update
comment random_pose_figure_update Runs a figure of stage 1 that strikes a pose picked at random.
# list 1 type 0A: "02E033 LBRA $785E", an RTS; nothing puts one in
02E033  func  empty_object_type_0a_handler
comment empty_object_type_0a_handler Unused: the handler of list 1's type 0A, which does nothing; no object of that type is put in.
# list 0 type 1A (teacup_goon_ride_arm's children 02FDC5): steps sub_02EC09 ... (setup 7E01 kind 88); its ride gone: "@unk_02 =
# 0xFFu"
02E036  func  teacup_goon_update
comment teacup_goon_update Runs the kind 88 enemy of Krustyland: riding round, leaping off, then fighting.
# list 1 type 0F (s1): steps sub_02E8D8 ... (krustyland_child_limits_by_players); holds the scroll while left of 00E0
02E039  func  teacup_goon_ride_update
comment teacup_goon_ride_update Runs the unseen hub of the Krustyland ride whose arms carry kind 88 enemies.
# list 2 type 1E (teacup_goon_ride's children 02FDA7): steps sub_02E983 ... sub_02EA3E
02E03C  func  teacup_goon_ride_arm_update
comment teacup_goon_ride_arm_update Runs an arm of the ride, turning round the hub with two kind 88 enemies.
# action 1F: steps from 7E7B: sub_02F16D ...; "if (t1 < 0x60 || t1 > 0x15F) @unk_0F = 0u"; no scenario runs it (0/10)
02E03F  func  clown_on_ball_charge_update
comment clown_on_ball_charge_update Runs enemy action 1F: the clown on a ball rolls at its target and back, within the screen.
# action 20 (clown_on_ball's range 40-48: 20 20 20 20): steps from 7E83: sub_02F1DE, sub_02F204
02E042  func  clown_on_ball_pause_update
comment clown_on_ball_pause_update Runs enemy action 20: the clown on a ball pauses for a time by the game's rank.
# list 2 type 0B (kind 88's child 02FDF3): steps sub_02EA8F ... (setup 7DD3 kind 81 animation 17)
02E045  func  teacup_goon_piece_update
comment teacup_goon_piece_update Runs the piece a beaten kind 88 enemy sheds, which bounces and blinks away.
# list 1 type 1C (s0; shaking_scenery's children 02DE75-02DE85): steps sub_02F507 ... (bluebird_entries, bluebird_launches)
02E048  func  bluebird_update
comment bluebird_update Runs the small kind A0 creature that comes in or is launched from the shaking scenery and runs off.
# list 2 type 18 (shaken_object's child 02DE29): steps sub_02F3ED ... (setup 7F49 kind 10 animation 1D)
02E04B  func  buzzing_chaser_update
comment buzzing_chaser_update Runs the buzzing thing that spirals out and chases a player for a while.
# list 2 type 12 (girl_with_food's, sideshow_bob's and burger_eater's food): step 0 sub_02E367, then the eaten food's steps
02E04E  func  dropped_food_update
comment dropped_food_update Runs food dropped by a character, lying until eaten.
# list 1 type 30 (s0, s1): steps sub_02E39E ... (girl_with_food_partners, girl_with_food_food_drops); gone outside x 0040-01CF
02E051  func  girl_with_food_update
comment girl_with_food_update Runs the kind A5 character that walks in, maybe with a partner, and drops food.
# list 1 type 3C (s1): steps sub_02F33E ... (caged_gorilla_idle_animations)
02E054  func  caged_gorilla_update
comment caged_gorilla_update Runs the kind B2 object of Krustyland that idles, makes a sound when near and reacts to hits.
# list 1 type 3F (caged_gorilla_leaper's child 02BE0B; no spawn list holds a list 1 type 3F: the spawns of type 3F are list 0's,
# bank 14's goons): steps sub_02F2B3 ... (setup 7F23 kind A2 bear)
02E057  func  krustyland_bear_update
comment krustyland_bear_update Runs the bear that wakes when the camera comes and rides across the stage.
# list 1 type FC (s3, s5, s9): steps sub_02E1FA, sub_02E209, sub_02E20A (item_setups)
02E05A  func  item_update
comment item_update Runs an item lying in the stage until a player takes it.
# list 1 type FA (s6): steps sub_02E4B6 ... (setup 7B5E kind A9); gone outside x 0010-01BF
02E05D  func  sideshow_bob_update
comment sideshow_bob_update Runs the kind A9 character of stage 5 that walks in, drops food and walks off.
# list 1 type F9 (s1, s6): steps sub_02E533 ... (item_carrier_setups, item_carrier_items)
02E060  func  item_carrier_update
comment item_carrier_update Runs a character that walks in, puts down an item and walks off.
# list 2 type 1A (item_carrier's children 02FB98-02FBA8): steps sub_02E5D3, sub_02E5F8, then the eaten food's
02E063  func  carried_item_update
comment carried_item_update Runs the item a carrier puts down, which pops up and vanishes.
# action 34 (clown_on_ball's ranges: 34 34 1C 34): steps from 7E8B: sub_02F211, sub_02F235
02E066  func  clown_on_ball_hop_update
comment clown_on_ball_hop_update Runs enemy action 34: the clown on a ball hops away four times.
# action 36 (kind 98's ranges: 10 10 36 10): steps from 7E37: sub_02EFA5, sub_02EFC6 (no scenario runs it: 0/4)
02E069  func  one_eared_rabbit_step_back_update
comment one_eared_rabbit_step_back_update Runs enemy action 36: the kind 98 enemy steps back from its target.
# list 1 type E8 (s3, the forest): steps sub_02E07B, sub_02E0B9, sub_02E0CD
02E06C  func  looping_scenery_leaving_update
comment looping_scenery_leaving_update Runs the forest's looping scenery, which leaves once the camera passes 06B0.
# list 0 type E5 (-27: the handler word 07F2B6 "60 6F" and the bank byte 07F36C 17, past the 26 negative types kref saw
# read); no spawn list holds one and no scenario runs it (0/5): steps sub_02E0EA ... (setup 7A50 kind B7)
02E06F  func  unused_kind_b7_update
comment unused_kind_b7_update Unused: runs a kind B7 object that bounces in from the right; no list 0 type E5 is put in.
# list 1 type 32 (s9): steps sub_02E834 ... (kent_brockman_damage_animations)
02E072  func  kent_brockman_update
comment kent_brockman_update Runs the kind B3 object of stage 7 that takes six hits.

# ---- the looping scenery (list 1 types 25 and E8) ----
02E07B  file  objects/floor_scenery    # (the looping scenery)
# step 0: "u = object_setup_02FA0C_ADDRESS" (kind 0F animation 00), "@unk_0C = 0x1A0u", "looping_scenery_move =
# looping_scenery_moves_ADDRESS + ..."
02E07B  func  looping_scenery_start
comment looping_scenery_start Sets the scenery up at x 01A0 with the speed, animation and attributes its spawn's state picks.
# "@unk_0C = (@unk_0C & 0xFFu) | ((t1 & 1u) << 8u)"
02E0AA  func  looping_scenery_wrap
comment looping_scenery_wrap Keeps the scenery's x within 0000-01FF so it comes round again.
# the same, then "if (t2 >= 0x6B0u) step + 1" (the camera)
02E0B9  func  looping_scenery_wrap_until_camera
comment looping_scenery_wrap_until_camera Keeps the scenery coming round until the camera passes 06B0.
# the same, then "if (t2 >= 0x1C0u) @flags = 0u"
02E0CD  func  looping_scenery_leave
comment looping_scenery_leave Lets the scenery move off, gone past x 01C0.

# ---- the unused kind B7 object and the unused obstacle ----
02E0EA  file  objects/unused_objects    # objects nothing puts in
# "u = object_setup_02FA50_ADDRESS" (kind B7 animation 14), "@flags = 0xC8u; @unk_0F = 0xFE00u", state 0: "@unk_02 = 3u"
02E0EA  func  unused_kind_b7_start
comment unused_kind_b7_start Unused: sets the kind B7 object moving left; state 0 only slides.
# "@unk_19 = t1 - 0x40u; carry = sub_078662(x)", landing "@unk_19 = 0x600u; d = VIDEO_2000"
02E10D  func  unused_kind_b7_bounce
comment unused_kind_b7_bounce Unused: falls and bounces high with sound 2000.
# landing: "d = VIDEO_2000", step + 1
02E130  func  unused_kind_b7_land
comment unused_kind_b7_land Unused: falls and lands with sound 2000.
# "@unk_0F = t1 - 0x10u"
02E147  func  unused_kind_b7_speed_up
comment unused_kind_b7_speed_up Unused: speeds the object up to the left.
# (called only from unused_obstacle_update) switch on field 29
02E1B3  func  unused_obstacle_break_steps
comment unused_obstacle_break_steps Unused: runs the obstacle's breaking by its substep.
# "mem_write8(x + 5u, 0x80u); d = 0x6C00u"
02E1BC  func  unused_obstacle_break
comment unused_obstacle_break Unused: breaks the obstacle with sound 6C00.
# "if (t1 & 1u) mem_write8(x, 0u)"
02E1CB  func  unused_obstacle_break_end
comment unused_obstacle_break_end Unused: takes the obstacle away when its breaking animation ends.
# "u = object_setup_02FA62_ADDRESS" (kind 05 animation 06), "mem_write16(x + 0xCu, 0x200u)", "d = 0x6700u"
02E1D5  func  unused_obstacle_start
comment unused_obstacle_start Unused: sets up an obstacle at x 0200 with sound 6700.
# an RTS
02E1F0  func  unused_obstacle_idle
comment unused_obstacle_idle Unused: does nothing.

# ---- items and food ----
02E1FA  file  objects/items    # the items and the food lying in the stages, and who brings them
# list 1 type FC's step 0: "u = item_setups[...]; y = sub_0785AB(x, u)"
02E1FA  func  item_start
comment item_start Sets up the item its spawn's state picks.
# an RTS: steps 1 and 2
02E209  func  item_lie
comment item_lie Does nothing while the item lies.
# step 3: "@flags = 0u"
02E20A  func  item_taken
comment item_taken Taken: the item goes away.
# list 2 type 0E's step 0: "u = object_setup_02FA96_ADDRESS" (kind 09 food), "FOOD_MOVE(food_moves_ADDRESS + ...)",
# a random x speed's low byte, "@unk_3C = 3u", away from field 2A's object
02E217  func  food_jump_out_start
comment food_jump_out_start Sets food jumping out: its animation, hit kind, gravity and speeds by its spawn's state, away from where it came from.
# "@unk_19 = t1 - t2" (gravity 3E-3F), landing: state under 2 "@flags = 0u"; "@unk_3C = t5 - 1u", the last: "@unk_3B =
# 0x40u; @unk_02 = 5u"
02E279  func  food_jump_out_bounce
comment food_jump_out_bounce Falls and bounces three times, lower each time, then lies for 64 frames (states 0 and 1 vanish on landing).
# "if (t1 == 1u) { @unk_04 = 4u; @unk_05 = 0x80u; @flags = 0x80u; ... }"
02E2B2  func  food_jump_out_expire
comment food_jump_out_expire When its time runs out uneaten, turns into a puff.
# "if (t1 & 1u) @flags = 0u"
02E2CA  func  food_jump_out_vanish
comment food_jump_out_vanish Takes the puff away when its animation ends.
# list 1 type 27's step 0: "u = object_setup_02FADE_ADDRESS" (kind 09 food), sub_02E2F7, zoom 4040, "@unk_05 = t1 | 0x80u"
02E2DD  func  food_start
comment food_start Sets up a piece of food: its animation and hit kind by its spawn's state.
# an RTS
02E2F6  func  food_lie
comment food_lie Does nothing while the food lies.
# "@unk_1C = ... | food_hit_kinds[(t1 & 0x7Fu) >> 1]"
02E2F7  func  food_set_hit_kind
comment food_set_hit_kind Gives the food the hit kind of its animation (what touching it does).
# "@unk_09 = t1 & 0xBFu; @flags = 0x80u; d = 0x2401u; ... @unk_14 = 0xFF80u; @unk_19 = 0x300u; @unk_3B = 0x20u"
02E306  func  food_eaten
comment food_eaten Eaten: pops up with sound 2401.
# zoom "t2 = t1 - 0x101u", "if (t3 == 1u) { @unk_3B = 0x10u; @unk_14 = 0u; @unk_19 = 0u; ... }"
02E331  func  food_eaten_shrink
comment food_eaten_shrink Shrinks for 32 frames, then stops.
# "@flags = 0x90u; if (t1 == 1u) @flags = 0u"
02E353  func  food_eaten_vanish
comment food_eaten_vanish Vanishes after 16 frames.
# list 2 type 12's step 0: "u = object_setup_02FADE_ADDRESS", "@unk_09 = 0x10u", zoom 4040, "@unk_05 = t1 | 0x80u"
02E367  func  dropped_food_start
comment dropped_food_start Sets up dropped food with the animation its spawn's state gives.
# list 1 type 30's step 0: "u = object_setup_02FAFA_ADDRESS" (kind A5), sub_02E2F7, "io_write8(VIDEO_187C, 0u);
# io_write8(VIDEO_187D, 0u)", state 0-7F with more than 2 players present: "y = girl_with_food_partners[a & 3u]; sub_07862C",
# "@unk_3B = 0x40u; @unk_0F = 0xFF00u"
02E39E  func  girl_with_food_start
comment girl_with_food_start Sets up the kind A5 character walking in from the right, with a partner when more than 2 players are present.
# "if (t1 == 1u) { @unk_0F = 0u; @unk_02 = 5u; return; } if (io_read8(VIDEO_187C) != 0u) step + 1"
02E3EE  func  girl_with_food_walk_in
comment girl_with_food_walk_in Walks in for 64 frames and stops, or stops at once when another one has dropped food.
# "if (t1 == 0u) { @unk_02 = 5u; return; } io_write8(VIDEO_187C, t2 + 1u); y_2 = girl_with_food_food_drops[...]", "@unk_05 = 0x8Au"
02E406  func  girl_with_food_drop_food
comment girl_with_food_drop_food Drops its food (counted in 187C) and shows its dropping animation.
# "if ((t1 & 1u) == 0u) ...; if (t2 != 0u) { step + 1; @unk_05 = 0x88u; sub_02E44E(x); } else @unk_02 = 6u"
02E435  func  girl_with_food_after_drop
comment girl_with_food_after_drop When the dropping animation ends, walks off, or waits.
# "@unk_0F = 0x180u; io_write8(VIDEO_187D, t1 + 1u)": the first to leave goes one way, the others the other, by state bit 7
02E44E  func  girl_with_food_walk_off
comment girl_with_food_walk_off Walks off (counted in 187D), the first one and the partner going opposite ways.
# an RTS
02E46C  func  girl_with_food_walking
comment girl_with_food_walking Does nothing while it walks.
# "@unk_05 = (t1 + 1u) | 0x80u; step + 1"
02E479  func  girl_with_food_turn
comment girl_with_food_turn Shows its next animation.
# "if (t1 != 1u) return; @unk_05 = (t2 << 1) | 0x80u; @unk_02 = 4u; sub_02E44E(x)"
02E486  func  girl_with_food_wait
comment girl_with_food_wait After its wait, walks off.
# list 1 type FA's step 0: "u = object_setup_02FB5E_ADDRESS" (kind A9), "@unk_0F = 0xFF00u; @unk_3B = 0x40u"
02E4B6  func  sideshow_bob_start
comment sideshow_bob_start Sets up the kind A9 character walking in from the right.
# "if (t1 == 1u) { @unk_0F = 0u; @unk_02 = 5u; }"
02E4CD  func  sideshow_bob_walk_in
comment sideshow_bob_walk_in Walks in for 64 frames and stops.
# step 2: "if (t1 == 0u) return; y_2 = child_object_02FB64_ADDRESS" (list 2 type 12, state 08), "@unk_05 = 0x82u"
02E4DB  func  sideshow_bob_drop_food
comment sideshow_bob_drop_food Once told to (field 3D), drops its food and shows its dropping animation.
# "if (t1 != 1u) ...; @unk_0F = 0xFE00u; @unk_05 = 0x80u; step + 1"
02E4F7  func  sideshow_bob_leave
comment sideshow_bob_leave After the drop, walks off to the left.
# an RTS
02E50A  func  sideshow_bob_walking
comment sideshow_bob_walking Does nothing while it walks.
# "@unk_05 = 0x83u; step + 1"
02E50B  func  sideshow_bob_pause
comment sideshow_bob_pause Stops and shows its waiting animation.
# "if (t1 == 1u) { @unk_05 = 0x81u; @unk_0F = 0xFF00u; @unk_02 = 4u; }"
02E514  func  sideshow_bob_pause_end
comment sideshow_bob_pause_end After its wait, walks on to the left.
# list 1 type F9's step 0: "u = item_carrier_setups[...]", "@unk_3D = 0u; @unk_3B = 0x40u; @unk_0F = 0xFF00u"
02E533  func  item_carrier_start
comment item_carrier_start Sets up the item carrier its spawn's state picks, walking in from the right.
# "if (t1 == 1u) { @unk_0F = 0u; @unk_02 = 5u; }"
02E553  func  item_carrier_walk_in
comment item_carrier_walk_in Walks in for 64 frames and stops.
# "y = item_carrier_items[...]; sub_07862C(x, y, &u, ...)", no slot: "@unk_38 = 0xFFFFu; @unk_0F = 0xFE80u; @unk_02 = 4u",
# else "@unk_38 = u; @unk_05 = 0x84u"
02E561  func  item_carrier_put_down
comment item_carrier_put_down Puts down its item and shows its putting-down animation (without a free slot it just walks off).
# "if ((t1 & 1u) == 0u) ...; @unk_05 = 0x80u; @unk_0F = 0xFE80u; step + 1"
02E595  func  item_carrier_leave
comment item_carrier_leave When the putting-down animation ends, walks off to the left.
# an RTS
02E5A9  func  item_carrier_walking
comment item_carrier_walking Does nothing while it walks.
# "@unk_05 = (t1 + 1u) | 0x80u; step + 1"
02E5AA  func  item_carrier_pause
comment item_carrier_pause Shows its next animation.
# "if (t1 == 1u) { @unk_05 = 0x81u; @unk_0F = 0xFF00u; @unk_02 = 4u; }"
02E5B7  func  item_carrier_pause_end
comment item_carrier_pause_end After its wait, walks on to the left.
# list 2 type 1A's step 0: "u = object_setup_02FB80_ADDRESS", "@unk_04 = carried_item_kinds[...]", zoom 4040
02E5D3  func  carried_item_start
comment carried_item_start Sets up the item a carrier puts down, with the kind its spawn's state picks.
# "@unk_05 = (t1 + 1u) | 0x80u; @unk_09 = t2 & 0xBFu; ... d = 0x2401u; ... @unk_19 = 0x100u; @unk_3B = 0x20u"
02E5F8  func  carried_item_pop
comment carried_item_pop Pops up with sound 2401, then shrinks and vanishes like eaten food.

# ---- stage 1's bystanders (list 1 type 29) ----
02E635  file  objects/bystander    # stage 1's bystanders
# step 0: "u = object_setup_02FBD9_ADDRESS", "bystander = bystanders_ADDRESS + ...", facing by "place" bit 7, "@unk_2A =
# bystander_animation_set", "@unk_05 = ...->waiting"
02E635  func  bystander_start
comment bystander_start Sets a bystander up by its spawn's state: its kind, facing, place and animations, waiting.
# "t1 = io_read8(VIDEO_1884); if (t1 != 0u) { @unk_05 = startled; step + 1 }"
02E673  func  bystander_wait_car
comment bystander_wait_car Waits until the police car stops, then is startled.
# "if ((t1 & 1u) == 0u) ...; @unk_0F = 0xFE00u; @unk_05 = fleeing", sub_0785C6
02E686  func  bystander_flee
comment bystander_flee When the startled animation ends, runs off to the left.
# an RTS
02E6A1  func  bystander_gone
comment bystander_gone Does nothing while it runs off.
# (sub_02E673 and sub_02E686 were named by their local lines: renamed here, so the lines must take the new names)
local bystander_wait_car 02E679 u animations bystander_animation_set
local bystander_flee 02E692 u animations bystander_animation_set

# ---- the kind 90 enemy and what it throws ----
02E6AE  file  objects/fireman_goon    # stage 1's kind 90 enemy that throws, and what it throws
# list 0 type 02's step 0: "u = object_setup_02FC53_ADDRESS" (kind 90), "@unk_57 = 0xFFu; @flags = 4u; @unk_42 = 0xFFu",
# "@unk_2A = enemy_behaviour_02FBEF_ADDRESS", "fireman_goon_start = fireman_goon_starts_ADDRESS + ..."
02E6AE  func  fireman_goon_setup
comment fireman_goon_setup Sets up the hidden kind 90 enemy, out of play: its x and facing, its wait and its throws by its spawn's state.
# step 1: switch on field 29
02E71C  func  fireman_goon_entrance_steps
comment fireman_goon_entrance_steps Runs the kind 90 enemy's entrance by its substep.
# "if (t1 < 0x3D0u) return u; @flags = 0x80u; @unk_57 = 0u", sub_078620, "@unk_05 = 0x86u"
02E725  func  fireman_goon_wait_camera
comment fireman_goon_wait_camera Waits for the camera to reach 03D0, then shows the enemy in play facing the nearest player.
# "if (t1 != 1u) return; @unk_42 = 0u; d = rom_07E040_ADDRESS; sub_078617(x, d)" (direction E0, speed 40), "@unk_05 = 0x82u"
02E744  func  fireman_goon_walk_out
comment fireman_goon_walk_out After its wait, walks out diagonally (direction E0, speed 40).
# "sub_078638 ... if ((int8_t)(d >> 8) >= 0) step + 1"
02E765  func  fireman_goon_find_floor
comment fireman_goon_find_floor Walks until there is floor under it.
# "sub_0785B1 ... @flags = 0xC0u; ... @unk_02 = 2u"
02E770  func  fireman_goon_land
comment fireman_goon_land Lands on the floor and starts fighting.
# action 08's step 0: "@unk_05 = 0x90u"
02E78A  func  fireman_goon_throw_wind_up
comment fireman_goon_throw_wind_up Starts the throwing animation.
# "if (t1 & 1u) { if (unk_486B >= 3u) sub_02E7C1 ... else { @unk_3C = t3 - 1u; if ((t4 & 3u) == 0u) ... } }", "d = 0x6100u"
02E793  func  fireman_goon_throw
comment fireman_goon_throw When the animation ends, throws (sound 6100): always from difficulty 3, else three times out of four.
# "@unk_05 = 0x81u; @unk_02 = 2u; @unk_3B = 0u"
02E7B9  func  fireman_goon_throw_end
comment fireman_goon_throw_end Ends the throw and goes back to the fight.
# "y = child_object_02FC73_ADDRESS; sub_07862F" (list 2 type 0A), its priority to the parent's
02E7C1  func  fireman_goon_put_in_missile
comment fireman_goon_put_in_missile Puts in what the kind 90 enemy throws.
# list 2 type 0A's step 0: "u = object_setup_02FC81_ADDRESS" (kind 90 animation 13), the parent's priority
02E7E4  func  fireman_goon_missile_start
comment fireman_goon_missile_start Sets up the thrown thing at its thrower's priority.
# "if ((t1 & 2u) != 0u) { @flags = 0xC0u; ... }"
02E809  func  fireman_goon_missile_fly
comment fireman_goon_missile_fly At its animation's mark, starts hitting.
# "@flags = 0x80u; step + 1; sub_02E821"
02E819  func  fireman_goon_missile_spent
comment fireman_goon_missile_spent Stops hitting and waits for its animation's end.
# "if (t1 & 1u) @flags = 0u"
02E821  func  fireman_goon_missile_end
comment fireman_goon_missile_end Goes away when its animation ends.

# ---- stage 7's kind B3 object (list 1 type 32) ----
02E834  file  objects/kent_brockman    # stage 7's kind B3 object that takes six hits
# "u = object_setup_02FC99_ADDRESS" (kind B3), "@unk_3C = 6u"
02E834  func  kent_brockman_start
comment kent_brockman_start Sets up the kind B3 object, good for six hits.
# "if ((@flags & 0x20u) == 0u) return u; @unk_3C = t1 - 1u", the last "@unk_05 = 0x83u; @unk_02 = 4u", else
# "@unk_05 = kent_brockman_damage_animations[...]; @unk_3B = 0x20u"
02E84D  func  kent_brockman_wait_hit
comment kent_brockman_wait_hit Takes a hit, showing the animation of the hits left; the sixth breaks it for good.
# "if (t1 == 1u) { @unk_05 = 0x80u; @unk_3B = 0x40u; ... }"
02E87D  func  kent_brockman_hit_end
comment kent_brockman_hit_end After 32 frames goes back to its standing animation.
# "if (t1 != 1u) ...; @flags = 0xC0u; @unk_02 = 1u"
02E890  func  kent_brockman_rest
comment kent_brockman_rest After 64 frames waits for the next hit.
# an RTS
02E89F  func  kent_brockman_broken
comment kent_brockman_broken Does nothing once broken.

# ---- Krustyland's ride with the kind 88 enemies ----
02E8D8  file  objects/teacup_goon_ride    # Krustyland's ride: its hub, its arms, the kind 88 enemies riding it
# list 1 type 0F's step 0: "u = object_setup_02FDBF_ADDRESS" (kind 04 animation 02), "@flags = 4u" (hidden),
# "io_write8(VIDEO_1881, 0u)", "@unk_0C = t3 + 0x40u"
02E8D8  func  teacup_goon_ride_start
comment teacup_goon_ride_start Sets up the ride's hub, unseen.
# "unk_48A7--; if (t1 < 2u) { ... do { y = child_object_02FDA7_ADDRESS; sub_07862F(x, y, &u, &carry); mem_write16(u +
# 0x38u, x); ... mem_write8(u + 0x3Eu, a); unk_48F1 = a + 0x55u; ... } while (...) }" (3 arms)
02E8FE  func  teacup_goon_ride_put_in_arms
comment teacup_goon_ride_put_in_arms Holds the scroll until fewer than 2 enemies are left, then puts in its three arms a third of a turn apart.
# "t1 = io_read8(VIDEO_1884); if (t1 != 0u) { @unk_3B = 0x40u; step + 1 }"
02E945  func  teacup_goon_ride_wait_signal
comment teacup_goon_ride_wait_signal Waits until 1884 is set.
# "if (t1 == 1u) step + 1"
02E954  func  teacup_goon_ride_wait
comment teacup_goon_ride_wait Waits 64 frames.
# "if (t1 < 2u) step + 1" (1876)
02E95D  func  teacup_goon_ride_wait_enemies
comment teacup_goon_ride_wait_enemies Waits until fewer than 2 enemies are left.
# "if (t1 != 0u) return; if (t2 != 0u) return; @flags = 0u; y_2 = child_object_02FDAD_ADDRESS; sub_07862C" (list 0
# type 00: a goon)
02E969  func  teacup_goon_ride_end
comment teacup_goon_ride_end Once its arms and riders are gone, goes away, putting in a last goon.
# list 2 type 1E's step 0: "u = object_setup_02FDBF_ADDRESS", "@flags = 4u", "@unk_3B = 1u; u = sub_02EA59(x)"
02E983  func  teacup_goon_ride_arm_start
comment teacup_goon_ride_arm_start Sets up an arm of the ride, unseen, at its place round the hub.
# "y = child_object_02FDC5_ADDRESS; sub_07862C" twice (list 0 type 1A: kind 88), "mem_write8(u + 0x3Fu, 0x40u); ...
# mem_write8(u + 0x3Eu, a); unk_48F1 = a - 0x80u; ... mem_write8(u + 0x3Du, a)"
02E9A7  func  teacup_goon_ride_arm_put_in_riders
comment teacup_goon_ride_arm_put_in_riders Puts in the arm's two kind 88 riders, half a turn apart, counting them in field 3A.
# "if (t1 != 0u) { @unk_28 = 0u; sub_02E9A7(x); }", "if (t3 == 2u) { @unk_3B = 1u; step + 1 }" (the hub's step)
02E9E8  func  teacup_goon_ride_arm_wait_start
comment teacup_goon_ride_arm_wait_start Puts in its riders, then waits until the hub starts the ride.
# "if (t1 == 1u) { @unk_3B = 1u; sub_02EA59(x); }", "if (t3 == 3u) { ...; @unk_3C = 0x40u; step + 1 }"
02EA06  func  teacup_goon_ride_arm_turn
comment teacup_goon_ride_arm_turn Turns round the hub until the hub's next step.
# "if (t1 != 1u) return u; @unk_3B = 1u; u = sub_02EA59(x); @unk_3C = t2 - 1u"
02EA29  func  teacup_goon_ride_arm_turn_for_time
comment teacup_goon_ride_arm_turn_for_time Turns round the hub for 64 frames more.
# "if (t2 == 0u) { ... mem_write8(u + 0x3Au, t4 - 1u); @flags = 0u; }"
02EA3E  func  teacup_goon_ride_arm_turn_until_empty
comment teacup_goon_ride_arm_turn_until_empty Turns until both its riders are gone, then goes away, counted off the hub's arms.
# "d = (t2 & 0xFFu) | ((t2 >> 8) - 1u) << 8; sub_02F257(d)", the speeds towards the hub's place plus the orbit offset
02EA59  func  teacup_goon_ride_arm_orbit
comment teacup_goon_ride_arm_orbit Moves the arm one step round the hub (its angle in field 3E, its radius in 3F).
# list 2 type 0B's step 0: "u = object_setup_02FDD3_ADDRESS" (kind 81 animation 17), its parent's priority, "@unk_19 =
# 0x400u; b = unk_4858; @unk_0F = 0x100u | b", odd: "@unk_05 = 0xB9u"
02EA8F  func  teacup_goon_piece_start
comment teacup_goon_piece_start Sends the piece flying up and away at a random speed, with one of two looks.
# "@unk_19 = t1 - 0x18u; carry = sub_078662(x)", landing "@unk_05 = 0xBBu" or 0xBA, "@unk_3B = 0x20u"
02EACF  func  teacup_goon_piece_fall
comment teacup_goon_piece_fall Falls and lands, lying with its landed look.
# "@flags = (@flags ^ 0x80u) | 4u; if (t1 == 1u) @flags = 0u"
02EAFA  func  teacup_goon_piece_blink
comment teacup_goon_piece_blink Blinks for 32 frames and goes away.
# step -2: "d = 0x6C00u", the hub's 31 down by one, "@flags = 0u", "y = child_object_02FDF3_ADDRESS; sub_07862F" (list 2
# type 0B), "return sub_0785F0(x)"
02EB33  func  teacup_goon_beaten
comment teacup_goon_beaten Beaten: goes away with sound 6C00, counted off the hub, shedding its piece.
# step -1: switch on field 29, then sub_02EDA9
02EB5B  func  teacup_goon_hit_steps
comment teacup_goon_hit_steps Runs the enemy's knock-back by its substep, keeping it on screen.
# (symbols.txt: teacup_goon_attributes_by_health) "if (t1 >= 7u) a = 1u; else a = 0u", field 09's priority kept
02EB67  func  teacup_goon_colour_by_health
comment teacup_goon_colour_by_health Gives the enemy its weak colour once its life is under 7.
# (sub_02EB67 was named by its local line: renamed here, so the line must take the new name)
local teacup_goon_colour_by_health 02EB67 u attributes teacup_goon_attributes
# "@unk_05 = 0x84u; ... @unk_0F = 0x200u" away (or random), "@unk_19 = 0x200u", "d = 0x6300u"
02EB81  func  teacup_goon_knocked
comment teacup_goon_knocked Knocked back: flies up and away with sound 6300.
# blinking for the last 16 frames, "carry = sub_078662(x)", landing "d = 0x6B00u; @unk_05 = 0x83u"
02EBCA  func  teacup_goon_knocked_fall
comment teacup_goon_knocked_fall Falls back (blinking at the end) and lands with sound 6B00.
# an RTS
02EC08  func  teacup_goon_knocked_wait
comment teacup_goon_knocked_wait Does nothing after landing.
# list 0 type 1A's step 0: "u = object_setup_02FE01_ADDRESS" (kind 88), "@unk_2A = mem_read16(t1 + 0x38u)" (the hub), "@flags
# = 4u", sub_02EC9C
02EC09  func  teacup_goon_start
comment teacup_goon_start Sets up a kind 88 rider, hidden, on its arm.
# "if (t1 != 0u) { @unk_08 = t2 (32); ... }", "if (t4 != 2u) return;" (the arm's step)
02EC3B  func  teacup_goon_wait_ride
comment teacup_goon_wait_ride Waits on its arm until the ride starts.
# "if (t1 == 1u) { @flags = 0x80u; ... sub_02EC9C }", the arm's step 3: "@unk_04 = 0x88u; @unk_05 = 0x82u"
02EC59  func  teacup_goon_shown_on_ride
comment teacup_goon_shown_on_ride Shows the rider and follows its arm until the arm's next step.
# "if (t1 == 1u) { ... sub_02EC9C(x); }", "if (t3 == 4u) step + 1"
02EC82  func  teacup_goon_riding
comment teacup_goon_riding Rides round with its arm until the arm turns for good.
# "@unk_3E = a" (+2, +4 for state 1), "sub_02F257(d)", the speeds towards the arm's place plus the orbit offset
02EC9C  func  teacup_goon_follow_arm
comment teacup_goon_follow_arm Moves the rider one step round its arm.
# "if (t2 <= t3 && ...)": its turn and the arm in the right quarter: "mem_write8(u + 0x30u, t8 - 1u); ...; @unk_14 = 0xFE00u;
# @unk_19 = 0x400u; @flags = 0xCCu; @unk_57 = 0u", hit box 7CD6
02ECE3  func  teacup_goon_leap_off
comment teacup_goon_leap_off Rides round until its turn comes with the arm at the front, then leaps off towards the players.
# "carry = sub_078662(x)", landing "d = 0x6B00u; ... mem_write8(u + 0x3Au, t4 - 1u); @unk_05 = 0x80u; @unk_42 = 0u"
02ED4F  func  teacup_goon_leap_land
comment teacup_goon_leap_land Lands with sound 6B00, counted off its arm, and is in play.
# "y = hit_box_02FCCE_ADDRESS; step + 1"
02ED8A  func  teacup_goon_ready
comment teacup_goon_ready Takes its standing hit box.
# "if (t1 != 1u) return ...; @unk_05 = 0x81u", sub_078620, sub_078626, "@unk_29 = 0u"
02ED93  func  teacup_goon_ready_wait
comment teacup_goon_ready_wait After 64 frames faces the nearest player and starts fighting.
# x outside 0040-017F: "@unk_0F = (int16_t)t5 >> 1; @unk_0F = 0u - t6; @unk_31 = 1u; ... @unk_02 = 9u"; sub_078647 bounce
02EDA9  func  teacup_goon_keep_on_screen
comment teacup_goon_keep_on_screen Turns the enemy back with a hop when it goes off the screen's sides, and off walls up and down.
# step 8: switch on field 29 (its own approach, then the shared fight), every 16 frames sub_078620, sub_078626, sub_02EDA9
02EDFC  func  teacup_goon_fight_steps
comment teacup_goon_fight_steps Runs the kind 88 enemy's fight by its substep, keeping track of the nearest player.
# "@unk_37 = t1 ^ 0x80u"
02EE18  func  teacup_goon_switch_side
comment teacup_goon_switch_side Switches the side it comes at its target from.
# distance (2C, 2E) and angle (36) to the target: "@unk_0F = 0x100u" or "@unk_14 = 0x100u", near: "@unk_3B = 0x10u;
# @unk_05 = 0x82u"
02EE24  func  teacup_goon_approach
comment teacup_goon_approach Walks towards its target, first across then up or down, and stops when close.
# "@unk_0F = 0x300u", towards the target or across the screen, sub_0785C6, "@unk_09 = t8 ^ 0x40u"
02EE76  func  teacup_goon_charge
comment teacup_goon_charge After a moment, charges at its target.
# "if ((t2 & 7u) != 0u) y = hit_box_02FCCE_ADDRESS; else y = hit_box_02FCD6_ADDRESS"
02EEB1  func  teacup_goon_charge_hit
comment teacup_goon_charge_hit Puts out the charging hit box one frame in eight.
# "sub_0785B1 ...; sub_02EB67; d = 0x6B00u; @unk_3B = 0x40u; @flags = 0xC0u"
02EEC7  func  teacup_goon_hop_land
comment teacup_goon_hop_land Lands from its hop with sound 6B00.
# "if (t1 == 1u) { @unk_3B = 0x10u; @unk_02 = 7u; }"
02EEE5  func  teacup_goon_hop_wait
comment teacup_goon_hop_wait After 64 frames, gets ready to fight again.

# ---- the kind 98 enemy (list 0 type 07) ----
02EF0F  file  objects/one_eared_rabbit    # Krustyland's kind 98 enemy, let out by the doors
# step 0: "u = object_setup_02FE27_ADDRESS" (kind 98), "@unk_43 = 1u; @unk_44 = t1 + 1u; @unk_2A =
# enemy_behaviour_02FCE6_ADDRESS"; state 0: "@unk_02 = 2u"
02EF0F  func  one_eared_rabbit_start
comment one_eared_rabbit_start Sets up the kind 98 enemy: state 0 fights at once, the others walk out of a door first.
# step 1: switch on field 29
02EF44  func  one_eared_rabbit_entrance_steps
comment one_eared_rabbit_entrance_steps Runs the kind 98 enemy's walk out of the door by its substep.
# "@unk_3B = 0x40u; @unk_16 = 4u; @unk_05 = 0x86u; @unk_5C = 0u; @unk_30 = 0u"
02EF4D  func  one_eared_rabbit_entrance_show
comment one_eared_rabbit_entrance_show Shows the enemy in the doorway.
# "@unk_29 = t1 + 1u"
02EF67  func  one_eared_rabbit_entrance_next
comment one_eared_rabbit_entrance_next Goes on to the next substep.
# "if (t1 == 1u) { @unk_3B = 0x20u; ... }"
02EF6B  func  one_eared_rabbit_entrance_wait
comment one_eared_rabbit_entrance_wait Waits 64 frames in the doorway.
# "if (t1 == 1u) { @unk_14 = 0xFF00u; @unk_05 = 0x81u; ... }"
02EF79  func  one_eared_rabbit_entrance_walk
comment one_eared_rabbit_entrance_walk After 32 frames more, walks out.
# sub_078638, "if ((int8_t)a >= 0) { @flags = 0xC0u; @unk_02 = 2u; }"
02EF8D  func  one_eared_rabbit_entrance_reach_floor
comment one_eared_rabbit_entrance_reach_floor Walks until there is floor under it, then fights.
# action 36's step 0: "@unk_05 = 0x87u", sub_07859C, "@unk_3B = 0x20u; @unk_0F = 0x80u" backwards
02EFA5  func  one_eared_rabbit_step_back
comment one_eared_rabbit_step_back Steps back from its target for 32 frames.
# "if (t1 != 1u) return; @unk_02 = 2u"
02EFC6  func  one_eared_rabbit_step_back_end
comment one_eared_rabbit_step_back_end Goes back to the fight.
# action 10's step 0: "@unk_05 = 0x90u", sub_07859C
02EFD5  func  one_eared_rabbit_strike_swing
comment one_eared_rabbit_strike_swing Starts its strike facing the target.
# "if ((t1 & 2u) == 0u) return y; y = hit_box_02FCB6_ADDRESS"
02EFE1  func  one_eared_rabbit_strike_hit
comment one_eared_rabbit_strike_hit At the strike's mark, puts out its hit box.
# "y = hit_box_02FCA6_ADDRESS", step + 1, sub_02EFFB
02EFF2  func  one_eared_rabbit_strike_recover
comment one_eared_rabbit_strike_recover Takes its body's hit box back and waits for the animation's end.
# "if (t1 & 1u) { @unk_02 = 2u; @unk_3B = 0u; }"
02EFFB  func  one_eared_rabbit_strike_end
comment one_eared_rabbit_strike_end When the animation ends, goes back to the fight.

# ---- the clown on a ball (list 0 type 09) and its ball ----
02F00F  file  objects/clown_on_ball    # Krustyland's clown on a ball, its attacks, and its ball
# switch on field 28 (list 2 type 09's steps -2 and -1, the ball's burst)
02F00F  func  clown_ball_burst_steps
comment clown_ball_burst_steps Runs the ball's burst by field 28.
# "@unk_04 = 4u; @unk_05 = 0x80u" (hit sparks)
02F018  func  clown_ball_burst
comment clown_ball_burst Turns the ball into a burst.
# "if (t1 & 1u) @flags = 0u"
02F022  func  clown_ball_burst_end
comment clown_ball_burst_end Takes the burst away when its animation ends.
# list 2 type 09's step 0: "u = object_setup_02FE53_ADDRESS" (kind 96 animation 11; even states kind C0 animation 91),
# "@unk_14 = rom_07FFC0_ADDRESS; @unk_19 = 0x400u; @unk_02 = 2u"
02F02C  func  clown_ball_start
comment clown_ball_start Sends the ball flying up the screen.
# "if (carry) { @unk_04 = 4u; @unk_05 = 0x80u; step + 1 }"
02F055  func  clown_ball_fall
comment clown_ball_fall Falls and bursts on landing.
# "if (t1 & 1u) @flags = 0u"
02F068  func  clown_ball_vanish
comment clown_ball_vanish Takes the burst away when its animation ends.
# step 0: "u = object_setup_02FE65_ADDRESS" (kind 96), "@unk_2A = enemy_behaviour_02FD3E_ADDRESS"; state bit 7: a pose from
# clown_on_ball_poses, "@unk_57 = 0xFFu; @unk_42 = 0xFFu"
02F08C  func  clown_on_ball_start
comment clown_on_ball_start Sets up the clown on a ball: fighting at once, or posing out of play by its spawn's state.
# "if (t1 < 0xE0u) { @unk_42 = 0u; @unk_57 = 0u; step + 1 }"
02F0D8  func  clown_on_ball_pose
comment clown_on_ball_pose Poses until it comes left of x 00E0, then fights.
# action 1C's step 0: "@unk_05 = 0x90u"
02F0F0  func  clown_on_ball_strike_swing
comment clown_on_ball_strike_swing Starts its strike.
# hit box 7CBE, or 7CC6 at the animation's mark; the end: "@unk_02 = 2u"
02F0F9  func  clown_on_ball_strike
comment clown_on_ball_strike Puts out the strike's hit box at its mark and goes back to the fight when the animation ends.
# action 1E's step 0: "@unk_05 = 0x90u; @unk_19 = 0x600u", far ("t1 >= 0x20u"): "@unk_19 = 0x400u; @unk_0F = 0x180u"
02F111  func  clown_on_ball_jump
comment clown_on_ball_jump Jumps: straight up when near its target, towards it when far.
# "@unk_19 = t1 - 0x20u; carry = sub_078662(x)", hit boxes 7CBE / 7CC6, landing "@unk_02 = 2u"
02F13E  func  clown_on_ball_jump_fall
comment clown_on_ball_jump_fall Falls with its hit box and goes back to the fight on landing.
# action 1F's step 0: "@unk_05 = 0x90u; @unk_3B = 0x20u"
02F16D  func  clown_on_ball_charge_wind_up
comment clown_on_ball_charge_wind_up Winds up for 32 frames.
# "@unk_3B = 0x20u; @unk_0F = 0x200u" towards the target
02F17C  func  clown_on_ball_charge
comment clown_on_ball_charge Rolls at its target for 32 frames.
# "if (unk_4858 & 1u) @unk_0F = 0u - t3; @unk_3B = 0x28u"
02F19B  func  clown_on_ball_charge_turn
comment clown_on_ball_charge_turn Turns round half the time and rolls on for 40 frames.
# "@unk_0F = 0u", hit box 7CBE, "@unk_02 = 2u"
02F1B3  func  clown_on_ball_charge_end
comment clown_on_ball_charge_end Stops and goes back to the fight.
# action 20's step 0: "@unk_05 = 0x86u" (or 87 by the random byte), "@unk_3B =
# clown_on_ball_pause_waits_by_rank[unk_4861 >> 3]"
02F1DE  func  clown_on_ball_pause
comment clown_on_ball_pause Pauses (one of two animations) for a time by the game's rank.
# "if (t1 == 1u) { @unk_02 = 2u; ... }"
02F204  func  clown_on_ball_pause_end
comment clown_on_ball_pause_end Goes back to the fight.
# action 34's step 0: "@unk_05 = 0x90u; @unk_3C = 4u; @unk_19 = 0x600u; @unk_0F = 0xFF80u" away from the target
02F211  func  clown_on_ball_hop_away
comment clown_on_ball_hop_away Starts hopping away from its target, four hops.
# landing: "@unk_3C = t2 - 1u", the last "@unk_02 = 2u", else "@unk_19 = 0x400u"; stopped outside x 0040-017F
02F235  func  clown_on_ball_hop
comment clown_on_ball_hop Hops on until the fourth landing, staying within the screen, then goes back to the fight.
# "unk_48E9 = orbit_cosines[a] * b >> 8; unk_48EB = orbit_cosines[0x3F - a] * b >> 8", the quarter by bits 6-7
02F257  func  orbit_offset
comment orbit_offset Works out the x and y offsets (48E8-48E9, 48EA-48EB) of a point at angle A and radius B round a centre.

# ---- the bear and the kind B2 object of Krustyland ----
02F2B3  file  objects/krustyland_bear    # Krustyland's bear and its kind B2 companions
# step 0: "u = object_setup_02FF23_ADDRESS" (kind A2 bear), "@unk_09 = 0xADu"
02F2B3  func  krustyland_bear_start
comment krustyland_bear_start Sets up the bear.
# "if (t1 >= 0x420u) { @unk_3B = 0x20u; step + 1 }"
02F2C2  func  krustyland_bear_wait_camera
comment krustyland_bear_wait_camera Waits for the camera to reach 0420.
# "d = 0x7400u; @unk_05 = 0x81u; @unk_3B = 0x40u"
02F2D3  func  krustyland_bear_wake
comment krustyland_bear_wake After 32 frames wakes with sound 7400.
# "d = 0x7300u; @unk_14 = 0xFF00u; @unk_3B = 0x20u; @unk_05 = 0x80u; @unk_09 = 0x9Du"
02F2EC  func  krustyland_bear_start_off
comment krustyland_bear_start_off After 64 frames starts off up the screen with sound 7300 (its kind B2 companion leaps off now).
# "@unk_0F = 0x200u; @unk_14 = 0u; @unk_16 = 0u; @unk_05 = 0x8Du; @unk_5B = 1u; @flags = 0xC8u"
02F310  func  krustyland_bear_ride
comment krustyland_bear_ride After 32 frames rides across the stage.
# an RTS
02F334  func  krustyland_bear_idle
comment krustyland_bear_idle Does nothing while it rides.
# list 1 type 3C's step 0: "u = object_setup_02FF35_ADDRESS" (kind B2), "@unk_09 = 0x10u; @unk_44 = 0x10u"
02F33E  func  caged_gorilla_start
comment caged_gorilla_start Sets up the kind B2 object.
# near ("t2 < 0x130u", "t3 < 0x120u"): "d = 0x6800u" once; hit: "@unk_05 = 0x85u"; every 128 frames
# "caged_gorilla_idle_animations[t9 & 1u]"
02F350  func  caged_gorilla_idle
comment caged_gorilla_idle Calls out (sound 6800) once on screen, switches between its two idle animations, until hit.
# "y = hit_box_02FEDF_ADDRESS; step + 1"
02F3A1  func  caged_gorilla_hit
comment caged_gorilla_hit Hit: takes its hit hit box.
# "y = hit_box_02FED7_ADDRESS; @unk_3B = 0x80u"
02F3AB  func  caged_gorilla_hit_wait
comment caged_gorilla_hit_wait Takes its standing hit box back and waits 128 frames.
# "d = 0x6800u; @unk_05 = 0x81u; @unk_3B = 0x60u"
02F3BA  func  caged_gorilla_recover
comment caged_gorilla_recover Calls out again (sound 6800) and gets up.
# "@unk_02 = 1u; @unk_3B = 1u; @unk_3D = 1u"
02F3D3  func  caged_gorilla_recover_end
comment caged_gorilla_recover_end After 96 frames goes back to idling.

# ---- the buzzing chaser (list 2 type 18) ----
02F3ED  file  objects/buzzing_chaser    # the buzzing thing let out by the object falling off the shaking scenery
# step 0: "u = object_setup_02FF49_ADDRESS" (kind 10 animation 1D), "@unk_19 = 0x40u; @unk_3B = 0x20u; @unk_3F = 1u;
# @unk_3D = 0x40u; @unk_3C = 4u; d = 0x7200u"
02F3ED  func  buzzing_chaser_start
comment buzzing_chaser_start Sets the chaser rising out with sound 7200, ready to spiral out four times.
# "if (t1 != 1u) sub_02F43A ...; @unk_19 = 0u; @unk_05 = 0x9Eu; @unk_3B = 0x20u"
02F425  func  buzzing_chaser_rise
comment buzzing_chaser_rise Rises for 32 frames while spiralling, then flies level.
# every other frame: "@unk_3F = t2 + 1u; @unk_3D = t3 - 1u; a = t4 + t5; @unk_3E = a; sub_078617(x, (a << 8) | t6)"
02F43A  func  buzzing_chaser_spiral
comment buzzing_chaser_spiral Moves along a widening spiral: its direction turning faster, its speed falling.
# "if (t1 != 1u) sub_02F43A ...; @unk_3B = 1u; step + 1; @flags = 0xC0u"
02F456  func  buzzing_chaser_spiral_end
comment buzzing_chaser_spiral_end After 32 frames more of spiralling, starts hitting and chasing.
# towards the target (field 38: "d = sub_07861D(x, u)"), its height towards it every 16 frames, the target down: circling;
# every 64 frames "d = 0x7200u", sub_078620, "@unk_3C = t10 - 1u", the last "@unk_3B = 0x20u; step + 1"
02F469  func  buzzing_chaser_chase
comment buzzing_chaser_chase Chases its target (circling while it is down), buzzing and picking the nearest player every 64 frames, four times.
# an RTS
02F4D6  func  buzzing_chaser_idle
comment buzzing_chaser_idle Does nothing.
# "if (t1 == 1u) { @unk_0F = 0xFC00u; @unk_14 = 0u; ... }" else circling
02F4D7  func  buzzing_chaser_fly_off
comment buzzing_chaser_fly_off Circles for 32 frames more, then flies off to the left.

# ---- the kind A0 creature (list 1 type 1C) ----
02F507  file  objects/bluebird    # the small kind A0 creature that comes in or is launched from the shaking scenery
# step 0: "bluebird_entry = object_setup_02FF65_ADDRESS" (kind A0), state under 80: "bluebird_entry = bluebird_entries_ADDRESS +
# ..."; state 80: "@unk_05 = 0x83u; @unk_02 = 3u"; 81-83: "@unk_30 = a - 1u; @flags = 4u; @unk_05 = 0x82u; @unk_02 = 8u"
02F507  func  bluebird_start
comment bluebird_start Sets the creature up by its spawn's state: coming in, sitting still, or hidden on the shaking scenery.
# "if (t1 != 1u) ...; @unk_0F = 0u"
02F573  func  bluebird_enter
comment bluebird_enter Moves in for its frames, then stops moving across.
# sub_078638, "if (negative == 0u) @unk_5C = ..."
02F57E  func  bluebird_take_floor
comment bluebird_take_floor Takes the height of the floor under it.
# "@unk_19 = t1 - 0x20u; carry = sub_078662(x)", landing "@unk_05 = 0x81u; @flags = 0xC0u; @unk_3B = 0x80u; @unk_02 = 4u"
02F58D  func  bluebird_land
comment bluebird_land Falls and, on landing, sits.
# not hit: on screen every 64 frames turns round; hit: "@unk_05 = 0x82u; @unk_19 = 0x200u; @unk_3B = 0x10u; @unk_02 = 5u"
02F5B0  func  bluebird_sit
comment bluebird_sit Sits, looking round, until it is hit; then jumps.
# not hit: after 3B the same jump
02F5F7  func  bluebird_sit_for_time
comment bluebird_sit_for_time Sits for its time, or until hit, then jumps.
# "if (t1 == 1u) { @unk_19 = 0u; @unk_3B = 0x20u; ... }"
02F61C  func  bluebird_jump
comment bluebird_jump After its jump's 16 frames, levels off.
# "@unk_0F = 0x100u; @unk_19 = 0x80u", sub_0785C6
02F62D  func  bluebird_run_off
comment bluebird_run_off After 32 frames runs off to the right with a hop.
# "d = t1 + 8u; if (d >= 0x200u) ...; @unk_0F = d"
02F645  func  bluebird_speed_up
comment bluebird_speed_up Runs faster each frame up to 0200.
# "if (t2 >= 0x160u) return u;" (its parent's x), "bluebird_launch = bluebird_launches_ADDRESS + ...", state 2 small
02F657  func  bluebird_wait_launch
comment bluebird_wait_launch Waits hidden until the shaking scenery comes left of x 0160, then is launched by its state.
# "if (t1 == 1u) { ... mem_write8(u_2 + 2u, 0xFDu); ... }", state 2 grows "t8 = t7 + 0x303u"
02F6A7  func  bluebird_launch_fly
comment bluebird_launch_fly Flies out of the scenery (the third growing as it comes out), then lands on it, setting it shaking from above.
# turns every 64 frames; its parent's flags bit 6 clear, or hit, or the parent left of 3E-3F: "@unk_02 = 6u" (the jump)
02F6FE  func  bluebird_sit_on_scenery
comment bluebird_sit_on_scenery Sits on the scenery, looking round, until it stops shaking, is hit, or comes left of its x; then jumps off.

# ---- stage 1's random pose figure (list 1 type 15) ----
02F75C  file  objects/posing_figure    # the posing figure and the unused Homer object
# step 0: "u = object_setup_02FFA7_ADDRESS", "random_pose_figure = random_pose_figures_ADDRESS + ...", "@unk_2A = poses"
02F75C  func  random_pose_figure_start
comment random_pose_figure_start Sets a figure up by its spawn's state: its kind, attributes and four poses.
# "if (t1 == 1u) { ... @unk_05 = mem_read8(u + ((unk_4858 + t3) & 3u)) | 0x80u; }"
02F787  func  random_pose_figure_pose
comment random_pose_figure_pose Strikes one of its four poses at random.
# step -1: "@unk_05 = 0x81u; @unk_02 = 0xFEu"
02F7AB  func  unused_homer_object_let_go
comment unused_homer_object_let_go Unused: lets go and stays.
# an RTS
02F7B5  func  unused_homer_object_idle
comment unused_homer_object_idle Unused: does nothing.
# step 0: "u = object_setup_02FFD5_ADDRESS" (kind 01 homer), "@unk_3B = 1u"
02F7B6  func  unused_homer_object_start
comment unused_homer_object_start Unused: sets up the object with Homer's sprites.
# every 16 frames sub_078620; "if (t5 < 0x40u) { @flags = 0xC0u; @unk_05 = 0xAFu; step + 1 }" (fields 2E + 2C)
02F7C5  func  unused_homer_object_wait_near
comment unused_homer_object_wait_near Unused: waits until the nearest player is close, then gets ready.
# hit by a player's object ("if (u >= OBJECT_ADDRESS(14))" is not): "@unk_38 = u; @unk_05 = 0xB8u; mem_write8(u + VIDEO_0031,
# 0x10u); mem_write8(u + 0x3Du, 6u); @unk_02 = 5u"
02F7F1  func  unused_homer_object_wait_hit
comment unused_homer_object_wait_hit Unused: when a player hits it, holds that player.
# "if (t2 != 0u) { if (t3 == 0u) { @unk_05 = 0xAFu; @unk_02 = 3u; } }" (the player's life and 3D)
02F826  func  unused_homer_object_hold
comment unused_homer_object_hold Unused: holds the player until it breaks free or is beaten.
# "if (t1 & 1u) { @unk_05 = 0x80u; @unk_3B = 0x40u; step + 1 }"
02F83E  func  unused_homer_object_release
comment unused_homer_object_release Unused: when its animation ends, stands for 64 frames.
# "if (t1 == 1u) @unk_02 = 1u"
02F852  func  unused_homer_object_rest
comment unused_homer_object_rest Unused: after its rest, waits for a player again.

# ======== banks 15-17: the families' own object fields ========
# Fields only one family of objects uses this way (scoped object FAMILY OFF NAME TYPE); a function belongs to the family
# whose name starts its own, the longest winning.

# ---- fat_goon (every fat_goon_* function) ----
# the object it carries: the obstacle on its head (02A4FE "@unk_40 = u", 02A535 / 02A5C5 "t1 = @unk_40; u = t1") or the
# balloon of the descent (02A6AE "@unk_40 = descent_start", 02A71B "t4 = @unk_40")
scoped object fat_goon 40 carried_object u16 object
# the floor height its drop route walks to (02A234 "@unk_3D = d", 02A26A "if (... != t1)" with "t1 = @unk_3D")
scoped object fat_goon 3D route_floor u8
# the direction and speed it moves in by (02A64F "@unk_3E = (uint8_t)(direction >> 8u); @unk_3F = (uint8_t)direction",
# 02A68E "sub_078617(x, d)" with them; 02A92A "@unk_3E = t4" the jump's way, 02A986 "if ((int8_t)t2 >= 0)")
scoped object fat_goon 3E direction u8
scoped object fat_goon 3F speed u8

# ---- krustyland_door ----
# its place in its release list (02AF36 "@unk_2A = door_release"; 02AF7A "y = t3 (@unk_2A); mem_read16(y)", "@unk_2A = y")
scoped object krustyland_door 2A release u16 door_release
# the child object it lets out (02AF36 "@unk_38 = players" = the word before the list; 02AF7A "y = t7 (@unk_38); sub_07862C")
scoped object krustyland_door 38 released_object u16 child_object
# set once the list has ended (02AF7A "@unk_3D = t5 + 1u"; 02AFBE "if (t3 != 0u) @flags = 0u")
scoped object krustyland_door 3D list_ended u8

# ---- bystander ----
# its three animations (02E635 "@unk_2A = bystander_animation_set"; 02E673 / 02E686 "t2 = @unk_2A")
scoped object bystander 2A animations u16 bystander_animation_set

# ---- running_animal ----
# its kind and animation, kept to come back to (02D437 "@unk_2C = ((uint32_t)a << 8) | (kind & 0xFFu)"; 02D38E
# "(uint8_t)@unk_2C", 02D3E6 / 02D4B5 / 02D531 "(uint8_t)(@unk_2C >> 8u)")
scoped object running_animal 2C look u16
# whether it is carried (02D4EB "@unk_3D = 1u", 02D503 "@unk_3D = 0u", 02D4B5 "if (t1 != 0u)")
scoped object running_animal 3D carried u8
# its running speed, kept (02D437 "@unk_3E ... @unk_3F" from 0F; 02D4B5 "@unk_0F = t4")
scoped object running_animal 3E run_speed u16
# whether it runs quiet (02D437 "@unk_44 = attributes"; 02D503 "if (t1 == 0u) d = 0x5F00u")
scoped object running_animal 44 quiet u8
# the frames it stops for and whether it runs fast (02D437 "@unk_50 / @unk_51" from running_animal_timings; 02D494 "t2 =
# @unk_50", 02D503 "t2 = @unk_51")
scoped object running_animal 50 stop_frames u8
scoped object running_animal 51 fast u8

# ---- shaking_scenery ----
# the food it has left (02D183 "@unk_3C = 5u"; 02D30E "@unk_3C = t2 - 1u", "if (t2 == 1u) @unk_1B = 0u")
scoped object shaking_scenery 3C food_left u8
# its standing animation (02D183 "@unk_3D = b"; 02D2E3 / 02D30E "@unk_05 = t1 + 1u", 02D359 "@unk_05 = t2")
scoped object shaking_scenery 3D standing_animation u8
# its food pattern (02D183 "@unk_3E = (uint8_t)(pattern >> 8u); @unk_3F = (uint8_t)pattern"; 02D30E "y = t1")
scoped object shaking_scenery 3E pattern u16
# the four animations of its shake (02D183 from object_16_animation_runs; 02D275, 02D285, 02D2A3, 02D2B3)
scoped object shaking_scenery 50 shake_animation_1 u8
scoped object shaking_scenery 51 shake_animation_2 u8
scoped object shaking_scenery 52 shake_animation_3 u8
scoped object shaking_scenery 53 shake_animation_4 u8

# ---- the objects that write into the floor map ----
# The floor map cell under the object (sub_078650 = 07948C: U the cell's address, A the cell): its old value (33), its
# column in the 64-cell row (34, the address's low byte), the row (38, "& 0xC0"), and the cell its shape starts at (2A);
# the shape's part written so far (37). 02CC4A "@unk_33 = stack; ... @unk_34 = b; @unk_38 = ... (b & 0xC0u)", 02CCE8
# "t2 = @unk_33 ... t3 = @unk_38", 02C7C7 / 02B2C2 "t1 = @unk_2A; t2 = @unk_37; ... t3 = @unk_38", 02D218 "@unk_2A = u"
scoped object obstacle 33 floor_cell u8
scoped object obstacle 34 floor_column u8
scoped object obstacle 38 floor_row u16
# the steps the obstacle raises the floor by (02CB7D "@unk_47 = obstacle_heights[t7 >> 1]", then "t5 = @unk_47; d_2 = ...
# | (t5 << 8); sub_02CC4A")
scoped object obstacle 47 height u8
# set while it has raised the floor (02CC4A "@unk_31 = t11 + 1u", 02CCE8 "@unk_31 = 0u", 02CBD6 "if (t1 != 0u) sub_02CCE8")
scoped object obstacle 31 floor_raised u8
# set while carried (02CD2B / 02CB7D "t9 = @unk_3D")
scoped object obstacle 3D carried u8
scoped object cemetery_obstacle 33 floor_cell u8
scoped object cemetery_obstacle 34 floor_column u8
scoped object cemetery_obstacle 38 floor_row u16
# whether it holds food (02C0C9 "@unk_44 = TABLE8(cemetery_obstacle_food, ...)", 02C078 "t1 = @unk_44; if (t1 != 0u)")
scoped object cemetery_obstacle 44 holds_food u8
scoped object heavy_obstacle 33 floor_cell u8
scoped object heavy_obstacle 34 floor_column u8
scoped object heavy_obstacle 38 floor_row u16
scoped object platform_scenery 2A floor_start u16
scoped object platform_scenery 33 floor_cell u8
scoped object platform_scenery 34 floor_column u8
scoped object platform_scenery 37 part u8
scoped object platform_scenery 38 floor_row u16
scoped object charging_scenery 2A floor_start u16
scoped object charging_scenery 33 floor_cell u8
scoped object charging_scenery 34 floor_column u8
scoped object charging_scenery 37 part u8
scoped object charging_scenery 38 floor_row u16
scoped object floor_blocker 2A floor_start u16
scoped object floor_blocker 33 floor_cell u8
scoped object floor_blocker 34 floor_column u8
scoped object floor_blocker 37 part u8
scoped object floor_blocker 38 floor_row u16
scoped object moes_street_scenery_dropper 2A floor_start u16
scoped object moes_street_scenery_dropper 33 floor_cell u8
scoped object moes_street_scenery_dropper 34 floor_column u8
scoped object moes_street_scenery_dropper 38 floor_row u16
scoped object scenery 2A floor_start u16
scoped object scenery 33 floor_cell u8
scoped object scenery 34 floor_column u8
scoped object scenery 38 floor_row u16

# ---- throwable ----
# set while carried (02C6E0 "@unk_3D = 1u", 02C6F0 "@unk_3D = 0u", 02CB0C "t2 = @unk_3D; if (t2 != 0u)")
scoped object throwable 3D carried u8
scoped object bouncing_throwable 3D carried u8
scoped object carried_obstacle 3D carried u8

# ---- the stage events ----
# the enemies the scroll lock waits for (02AD74 "t2 = @unk_30; if (t2 < t1)" against 1876)
scoped object scroll_lock 30 enemies_left u8
# the wave it is at (02ADB8 "if (mem_read8(y) != t2)" with "t2 = @unk_28"; 02AE21 "@unk_28 = t3 + 1u"), its place in its
# list (02AD8F "@unk_2A = TABLE16(object_15_spawn_lists, ...)", 02ADB8 "@unk_2A = y"), the enemies left that bring the next
# wave (02AD8F "@unk_30 = TABLE8(enemy_waves_next_wave_enemies, ...)", 02AE21 "if (t1 <= t2)"), and those that end it (02AD8F
# "@unk_3D = enemy_waves_end_enemies[a]", 02AE31)
scoped object enemy_waves 28 wave u8
scoped object enemy_waves 2A spawns u16 timed_spawn
scoped object enemy_waves 30 next_wave_enemies u8
scoped object enemy_waves 3D end_enemies u8

# ---- goon_hat ----
# the frames of its flight left, 0 once it is over (02B392 "@unk_31 = 0x20u"; 02B3C5 / 02B3E4 "if (t2 == 0u) @unk_02 = 3u";
# 02B400 "@unk_31 = 0u")
scoped object goon_hat 31 flight u8

# ---- woman_in_apron ----
# its device (02D86A "@unk_40 = u"; 02D913 / 02D935 "t1 = @unk_40") and its home's stage x (02D86A "@unk_3E ... = x +
# camera - 0x30"; 02D8CA, the handler "t3 = (((uint32_t)@unk_3E << 8u) | @unk_3F)")
scoped object woman_in_apron 40 device u16 object
scoped object woman_in_apron 3E home_x u16
# the device's own 40 is its keeper, the parent 07CAAB gave it (02D7BD "t1 = @unk_40; u_2 = t1; mem_write8(u_2 + 2u, 3u)")
scoped object woman_in_apron_device 40 keeper u16 object

# ---- the ride's hub, its arms and its riders ----
# the hub: its arms (02E8FE "@unk_3A = t3 + 1u", 02EA3E "mem_write8(u + 0x3Au, t4 - 1u)", 02E969 "if (t1 != 0u) return"),
# the riders that left it (02ECE3 "mem_write8(y + VIDEO_0031, t9 + 1u)", 02EB33 "mem_write8(u + VIDEO_0031, t2 - 1u)"), and
# whether too many are out (the handler "@unk_3D = 0u; ... if (krustyland_child_limits_by_players[...] < t3) @unk_3D++",
# 02ECE3 "t5 = mem_read8(y + 0x3Du); if (t5 == 0u)")
scoped object teacup_goon_ride 3A arms u8
scoped object teacup_goon_ride 31 riders_out u8
scoped object teacup_goon_ride 3D too_many_out u8
# an arm: its hub (02E8FE "mem_write16(u + 0x38u, x)", 02EA59 "t1 = @unk_38"), its riders on it and alive (02E9A7 "@unk_30
# = t2 + 1u; @unk_3A = t1 + 1u"; 02ECE3 "mem_write8(u + 0x30u, t8 - 1u)", 02ED4F "mem_write8(u + 0x3Au, t4 - 1u)"), its
# angle and radius round the hub (02E8FE "mem_write8(u + 0x3Eu, a)", "mem_write8(u + 0x3Fu, 0x80u)"; 02EA59 "t2 =
# (@unk_3E << 8) | @unk_3F")
scoped object teacup_goon_ride_arm 38 ride_hub u16 object
scoped object teacup_goon_ride_arm 30 riders_on u8
scoped object teacup_goon_ride_arm 3A riders u8
scoped object teacup_goon_ride_arm 3E angle u8
scoped object teacup_goon_ride_arm 3F radius u8
# a rider: the hub (02EC09 "@unk_2A = t2" = its arm's 38), its turn to leave (02E9A7 "mem_write8(u + 0x3Du, a)"; 02ECE3
# "if (t2 <= t3)" with "t3 = @unk_3D"), its angle and radius round its arm (02E9A7 "mem_write8(u + 0x3Eu, a)",
# "mem_write8(u + 0x3Fu, 0x40u)"; 02EC9C "@unk_3E = a"), the side it comes at its target from (02EE18 "@unk_37 = t1 ^
# 0x80u", 02EE24 "if ((int8_t)t2 < 0)")
scoped object teacup_goon 2A hub u16 object
scoped object teacup_goon 3D leave_turn u8
scoped object teacup_goon 3E angle u8
scoped object teacup_goon 3F radius u8
scoped object teacup_goon 37 approach_side u8
# the piece a beaten rider sheds: which of its two looks it has (02EA8F "if (b & 1u) { @unk_3D = t3 + 1u; @unk_05 = 0xB9u; }",
# 02EACF "if (t3 == 0u) @unk_05 = 0xBBu; else @unk_05 = 0xBAu")
scoped object teacup_goon_piece 3D second_look u8

# ---- buzzing_chaser ----
# its spiral: the direction (02F43A "@unk_3E = a"), how fast it turns (02F3ED "@unk_3F = 1u", 02F43A "@unk_3F = t2 + 1u"),
# its speed (02F3ED "@unk_3D = 0x40u", 02F43A "@unk_3D = t3 - 1u"); the chases left (02F3ED "@unk_3C = 4u", 02F469
# "@unk_3C = t10 - 1u")
scoped object buzzing_chaser 3E direction u8
scoped object buzzing_chaser 3F turn u8
scoped object buzzing_chaser 3D speed u8
scoped object buzzing_chaser 3C chases_left u8

# ---- bluebird ----
# the shaking scenery's x it waits for before jumping off it (02F657 "@unk_3E = (uint8_t)(parent_x >> 8u); @unk_3F =
# (uint8_t)parent_x"; 02F6FE "t6 = (((uint32_t)@unk_3E << 8u) | @unk_3F); if (t6 <= t5)")
scoped object bluebird 3E parent_x u16

# ======== banks 15-17: pointers to other objects, by the instruction that loads them ========
# "LDU #$38,X" (the target player, 07D301's), "LDU #$40,X" (the parent 07CAAB sets, or a child the object keeps), "LDU
# #$25,X" (what hit it), "LDY #$2A,X"
local unused_become_fat_goon 02A0D8 u target object
local fat_goon_from_back_wait 02A4B2 u target object
local fat_goon_thrower_carry 02A535,02A574 u carried object.carried_obstacle
local fat_goon_thrower_throw 02A5CC u carried object.carried_obstacle
local fat_goon_descent_fall 02A745 u balloon object.descent_balloon
local descent_balloon_release 02A78F u carrier object
local fat_goon_walk_up_to_target 02A8B1 u target object
local fat_goon_strike_wind_up 02A9B0 u target object
local enemy_waves_spawn 02ADB8 y spawn timed_spawn
local drink_vendor_wait_child 02AF0C u child object.throwable
local krustyland_door_open 02AF98 y release door_release
local krustyland_door_open 02AFAD y released child_object
local caged_gorilla_leaper_jump 02B022 u bear object.bear
local goon_hat_throw_start 02B3A5 u thrower object
local goon_hat_return 02B3EE u thrower object
local goon_hat_check_thrower 02B405 u thrower object
local police_car_check_hit 02B4CD u hitter object
local carried_obstacle_held 02C4AA u carrier object
local carried_obstacle_start 02C56A u carrier object
local tossed_obstacle_held 02C5BF u holder object
local throwable_rebound 02C727 u thrower object
local throwable_follow_floor 02CAF5 u carrier object
local obstacle_knocked 02CC2D u hitter object
local obstacle_rebound 02CDAE u thrower object
local shaken_object_wait 02D103 u scenery object.shaking_scenery
local shaking_scenery_check_hit_from_above 02D166 u hitter object
local woman_in_apron_device_wait_hit 02D7CB u keeper object.woman_in_apron
local woman_in_apron_run_to_device 02D919 u device object.woman_in_apron_device
local woman_in_apron_reach_device 02D935,02D952 u device object.woman_in_apron_device
local food_jump_out_start 02E262 u source object
local fireman_goon_missile_start 02E7EF u thrower object.fireman_goon
local teacup_goon_ride_arm_wait_start 02E9F3 u hub object.teacup_goon_ride
local teacup_goon_ride_arm_turn 02EA12 u hub object.teacup_goon_ride
local teacup_goon_ride_arm_turn_until_empty 02EA4F u hub object.teacup_goon_ride
local teacup_goon_ride_arm_orbit 02EA59 u hub object.teacup_goon_ride
local teacup_goon_piece_start 02EA95 u rider object.teacup_goon
# (02EB1F is the handler's own code, 02E036 "LBRA $6B0D": "LDU #$40,X; LDA #$00,U; BNE")
local teacup_goon_update 02EB1F u arm object.teacup_goon_ride_arm
local teacup_goon_beaten 02EB39 u hub object.teacup_goon_ride
local teacup_goon_start 02EC0F u arm object.teacup_goon_ride_arm
local teacup_goon_wait_ride 02EC49 u arm object.teacup_goon_ride_arm
local teacup_goon_shown_on_ride 02EC6A u arm object.teacup_goon_ride_arm
local teacup_goon_riding 02EC8E u arm object.teacup_goon_ride_arm
local teacup_goon_follow_arm 02EC9C u arm object.teacup_goon_ride_arm
local teacup_goon_leap_off 02ECE5 u arm object.teacup_goon_ride_arm
local teacup_goon_leap_off 02ECF0 y hub object.teacup_goon_ride
local teacup_goon_leap_land 02ED63 u arm object.teacup_goon_ride_arm
local teacup_goon_fight_steps 02EE0F u target object
local buzzing_chaser_chase 02F469 u target object
local bluebird_wait_launch 02F657 u scenery object.shaking_scenery
local bluebird_launch_fly 02F6BA u scenery object.shaking_scenery
local bluebird_sit_on_scenery 02F71A u scenery object.shaking_scenery
local unused_homer_object_wait_near 02F7D2 u target object

# the stage's difficulty (07CB09 "LDA <$6B" by enemy_limits_by_difficulty; 07C9E3 "CMPA <$6B" against a spawn's level):
# 02AD21 "if (unk_486B < 3u)", 02E793 "if (unk_486B >= 3u)"
486B  var  difficulty  u8

# ======== banks 18-1A ========
# Names for banks 18, 19, 1A (places 030000-035FFF): the object handlers by type, the enemies' actions, bosses.
# symbols.txt syntax. Evidence: the listing (build/listing/simpsons.s), the dispatcher tables of the fixed program
# (read from the ROM: 07CB6C/07CB7E "LDU #$F387 / #$F2EC" for 4F80, 07CBAD/07CBBF F4B0/F40D for 5280, 07CBE0/07CBF2
# F54C/F4F4 for 4D40, 07CC0F/07CC21 F581/F577 for 5640, 07D64C/07D65E F620/F5A2 for the actions by field 28), the
# setups (07D132 "LDD ,U; ORB #$80; STD #$04,X": the first byte of the record is the kind, the sprite set), the spawn
# lists (assets/data/spawns.txt; the scenes by step_scenes E88D: scene 0 stage 1, 1 stage 2, 3 stage 3 forest, 4
# cemetery, 5 stage 4, 6 stage 5, 8 stage 6, 9 stage 7, 11 stage 8), the behaviours (assets/data/objects.txt
# enemy_behaviour_*: the actions each enemy picks, bytes 28-57) and the sprite sheets (assets/sprites/).
#
# How a handler of these banks works (checked on each): the bank's jump table at 6000 (LBRA), one entry a type or an
# action; a type's handler runs a step routine by field 02 ("ASLB; JSR [B,U]" with D = "LDD #$01,X" from the
# dispatcher: B = field 02, signed: steps FE and FF are the ones the fixed program's hit routines set, 07CFDD "LDA
# #$FE" when the vitality (1B) is 0, 07CFE1 "LDA #$FF" otherwise), an action's handler (07D64F "LDD #$28,X") by field
# 29. The enemies' type handlers share one shape: step 0 their setup, 1 their way in, 2 the fixed program's 0785DB
# (07D49C: picks the player to go after, field 38, and the action by the behaviour in field 2A), 3 0785DE (07D63B: runs
# the action in field 28), 4 07865C (07E1D3: the shared hit reaction), 5 0785E4 (07D6B2), then 078596 (07D056: the
# enemy's hit check) and 0785B7 (07D1F7: removed past the screen's edge).
# Words in the comments: an object's field 05 is its animation (bit 7 starts it again), 06 bit 0 its animation ended
# and bit 1 a marked frame of it (the frame an attack hits on), 0C/11/16 its x, y and height, 0F/14/19 their speeds,
# 3B a countdown, 38 the player an enemy goes after, 2A its behaviour, 28/29 its action and the action's step.

# ======== bank 18 ========

# the bank's jump table (030000-030053, "LBRA" each): the handlers by type and by action; each type's handler is the
# step switch itself (the LBRA's target runs into it)
030000  file  objects/bank_entries    # (bank 18's entries)

# 4F80 type 22 (F387/F2EC: bank 18, 6000 -> 7541): setup 7F74 = 8C00 (kind 8C), spawned only in scene 5 (stage 4,
# 4F80:22 state 00); table 7F64: 759C setup, 75B3 pose; FD/FE/FF by field 28
030000  func  barney_bystander_update
comment barney_bystander_update Runs stage 4's kind 8C bystander by its step: it stands changing poses, walks off when the scroll gets far enough or when hit; it can be hit and is removed off screen.
# action 19 (F620/F5A2: bank 18, 6003 -> 75E0 "RTS"): no enemy behaviour of the banks lists it
030003  func  empty_action_19
comment empty_action_19 Action 19 of the enemies: does nothing.
# 4F80 type 21 (6006 -> 75E1): setup 7F92 = 8A01 (kind 8A), spawned only in scene 5 (stage 4, 4F80:21); table 7F82
030006  func  woman_in_green_carrier_update
comment woman_in_green_carrier_update Runs stage 4's kind 8A object by its step: it brings in a goon on its back, sets it down and runs off; it can be hit and is removed off screen.
# 4F80 type 10 (6009 -> 6116 "LDU #$79C8"): setup 79D4 = 9100 (kind 91), scene 3 (4F80:10 state 80), its behaviour
# 0318C0 or 031918 (actions 1A, 21, 1D); kind 91's sheet (assets/sprites/kind_91.png) shows green-skinned, red-eyed
# figures in rags with wild hair: zombies
030009  func  zombie_update
comment zombie_update Runs a zombie (stage 3) by its step: its setup, its way out of the ground, then the shared enemy steps (choosing and running an action, the hit reaction); checks its hits and removes it off screen.
# 4F80 type 11 (600C -> 63DD "LDU #$7A1A"): setup 7A2A = 9A01 (kind 9A), scene 3 (4F80:11 states 0, 1); it hangs above
# and drops on a player (ghost_on_rope_drop_starts)
03000C  func  ghost_on_rope_update
comment ghost_on_rope_update Runs stage 3's kind 9A object by its step: it hangs out of sight, drops on a player who comes near and climbs back up; when hit it falls; removed off screen.
# 5280 type 18 (600F -> 655F "LDU #$7A38"): setup 7A72 = 9101 (kind 91, the zombies' set); no scenario runs it
03000F  func  rising_zombie_update
comment rising_zombie_update Runs a zombie of the list at 5280 by its step: it waits, rises out of the ground and drifts in the direction of the object kept at work RAM 1854.
# 5280 type 19 (6012 -> 6660 "RTS")
030012  func  empty_object_type_19
comment empty_object_type_19 The handler of type 19 in the list at 5280: does nothing.
# action 1A (6015 -> 6373 "LDU #$7A0C"): listed only by the zombies' behaviours (0318C0, 031918: "1A 1A 1A 1A")
030015  func  zombie_swipe_action
comment zombie_swipe_action The zombies' close attack (action 1A) by its step: a swipe at the player, then a step back.
# 5280 type 1D (6018 -> 72EF "LDU #$7F1C"): setup 7F2A = 8700 (kind 87), scene 5 (stage 4, 5280:1D)
030018  func  walking_kind_87_update
comment walking_kind_87_update Runs stage 4's kind 87 figure by its step: it waits for the scroll, walks up into the street, turns and walks off; removed off screen.
# 5280 type 20 (601B -> 74D9 "LDU #$7F4A"): setup 7F58 = 8E01 (kind 8E), scenes 5 and 6 (5280:20 states 0-2)
03001B  func  belly_dancer_watcher_update
comment belly_dancer_watcher_update Runs the kind 8E figure of stages 4 and 5 that stands in a pose by its step; the one of state 0 can be hit once work RAM 187F is set; removed off screen.
# 5280 type 22 (601E -> 7383 "LDU #$7F30"): setup 7F44 = 9E01 (kind 9E); put in by bank 15's object (02AE66 "LDY
# #$7D78; LBSR $862C": 5280 type 22)
03001E  func  moe_update
comment moe_update Runs the kind 9E figure bank 15's object lets out (stage 4) by its step: it walks in, hides the object that let it out while it stands, shows it again, walks to and fro until the scroll moves on and leaves; removed off screen.
# 4F80 type 23 (6021 -> 6054 "LDU #$7974"): setup 7982 = 9700 (kind 97, the zombies' set: assets/sprites/kind_97.png);
# no spawn list nor child record puts it in (bank 16's 02D2F9/02D2FF children are 5280 type 23, bank 16's own), and no
# scenario runs it
030021  func  wandering_zombie_update
comment wandering_zombie_update Runs a kind 97 zombie that rises after a wait, walks one way for a while and sinks back, by its step; when hit it sinks at once.
# action 1D (6024 -> 6241 "LDU #$79F8"): listed only by the zombie behaviour 031918 ("1D 1D 1D 1D")
030024  func  zombie_burrow_action
comment zombie_burrow_action The zombies' action 1D by its step: it sinks into the ground, moves under it and comes up again elsewhere.
# 4F80 type 24 (6027 -> 7238 "LDU #$7EFC"): setup 7F10 = 8E01 (kind 8E); throws 4D40 type 11 (0312CB "LDY #$7F16;
# LBSR $862F": 0010 0000 20 11); no spawn list puts it in, no scenario runs it
030027  func  belly_dancer_thrower_update
comment belly_dancer_thrower_update Runs a kind 8E figure that waits for the screen, throws a shot again and again and runs off when hit, by its step; removed off screen.
# 4D40 type 11 (602A -> 71DC "LDU #$7EEC"): setup 7EF4 = 0403 (hit_sparks, animation 03); the shot belly_dancer_thrower
# throws (above)
03002A  func  spark_shot_update
comment spark_shot_update Runs the shot a kind 8E figure throws by its step: it flies left; when it hits something it bursts and goes; removed off screen.
# action 21 (602D -> 62C8 "LDU #$7A00"): listed only by the zombie behaviour 0318C0 ("21 21 21 21", its farthest range)
03002D  func  zombie_leap_action
comment zombie_leap_action The zombies' far attack (action 21) by its step: a leap at the player.
# 4F80 type 2F (6030 -> 6836 "LDU #$7BE6"): setup 7BF2 = 8D00 (lumberjack), scene 6 (stage 5, 4F80:2F)
030030  func  lumberjack_update
comment lumberjack_update Runs a lumberjack (stage 5) by its step: its setup, its jump in, then the shared enemy steps; checks its hits and removes it off screen.
# action 22 (6033 -> 68EA "LDU #$7BFE"): listed only by the lumberjack's behaviour 031B36
030033  func  lumberjack_axe_action
comment lumberjack_axe_action The lumberjack's attack (action 22) by its step: swings of the axe, then a pause.
# 4F80 type 31 (6036 -> 696B "LDU #$7C11"): setup 7C1D = 9F00 (gorilla), scene 6 (stage 5, 4F80:31 states 1-4)
030036  func  gorilla_update
comment gorilla_update Runs a gorilla (stage 5) by its step: its setup, its way in, then the shared enemy steps; checks its hits and removes it off screen.
# action 26 (6039 -> 6AB2 "LDU #$7C4F"): listed only by the gorilla's behaviour 031B8E ("26 26 26 26")
030039  func  gorilla_punch_action
comment gorilla_punch_action The gorilla's close attack (action 26) by its step: a blow on the animation's marked frame.
# 4F80 type 14 (603C -> 6661 "LDU #$7AE0"): setup 7AEC = 9700 (kind 97, zombies), scene 3 (4F80:14 states 0, 4), its
# behaviour 031A88 lists only action 31 (it takes hold of a player)
03003C  func  grabbing_zombie_update
comment grabbing_zombie_update Runs a zombie that comes out of the ground and takes hold of the players (stage 3) by its step; checks its hits and removes it off screen.
# action 31 (603F -> 66F5 "LDU #$7B02"): listed only by 031A88 (the grabbing zombie's)
03003F  func  zombie_grab_action
comment zombie_grab_action The grabbing zombie's action 31 by its step: it walks at its player, takes hold of him and holds on until he shakes it off.
# action 2C (6042 -> 6AE7 "LDU #$7C57"): listed only by the gorilla's 031B8E (its farthest range)
030042  func  gorilla_leap_action
comment gorilla_leap_action The gorilla's action 2C by its step: a leap at the player (gorilla_leap_speeds by the stage's difficulty).
# action 35 (6045 -> 6B52 "LDU #$7C6B"): listed only by the gorilla's 031B8E
030045  func  gorilla_back_off_action
comment gorilla_back_off_action The gorilla's action 35 by its step: it backs away from the player for 32 frames.
# 4F80 type F5 (6048 -> 6B82 "LDU #$7CD9"): setup 7CF1 = BC00 (knight), scene 8 (stage 6, 4F80:F5)
030048  func  knight_update
comment knight_update Runs a knight (stage 6) by its step: its setup, its way in, the shared enemy steps, its fall from the first form; beaten in its first form (field 44 set) it falls instead of dying.
# action 3C (604B -> 6DFF "LDU #$7D71"): listed only by the knight's behaviour 031C7F ("3C 3C 3C 3C")
03004B  func  knight_strike_action
comment knight_strike_action The knight's attack (action 3C) by its step: a blow on the animation's marked frame.
# 4F80 type F2 (604E -> 6E66 "LDU #$7D95"): setup 7DC2 = C701 (kind C7), scene 8 (stage 6, 4F80:F2 states 0-5);
# assets/sprites/kind_C7.png: a small red devil with a trident on a cloud, and lightning
03004E  func  cloud_devil_update
comment cloud_devil_update Runs the devil on a cloud (stage 6) by its step: it comes down, circles a player, stops to drop lightning and flies off when its time is up; checks its hits.
# 4D40 type 28 (6051 -> 6E33 "LDU #$7D87"): setup 7D8B = C709 (kind C7, animation 09), the child the devil puts in
# (030F8C "LDY #$6FAE; LBSR $862C": 0018 0000 00 02 00 28)
030051  func  lightning_bolt_update
comment lightning_bolt_update Runs the devil's lightning bolt by its step: it strikes below the cloud with a sound and goes when its animation ends.

# ---- 4F80 type 23: a zombie that rises, wanders and sinks (030054-030121) ----
030060  file  enemies/zombies    # the zombies of stage 3 and their actions: kinds 91 and 97 (types 10, 14, 23, 5280 18)
# step FE/FF (7974 entries -2, -1: 6060): by field 28, 7974's entries again: 0 6069, 1 6077
030060  func  wandering_zombie_hit
comment wandering_zombie_hit When a wandering zombie is hit: by field 28 it starts sinking, then goes when that ends.
# 030069 "LDA #$30,X; ADDA #$02; ORA #$80; STA #$05,X; INC #$28,X"
030069  func  wandering_zombie_start_sinking
comment wandering_zombie_start_sinking Starts the wandering zombie's sinking animation (its base animation in field 30, plus 2).
# 030077 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
030077  func  wandering_zombie_remove_when_sunk
comment wandering_zombie_remove_when_sunk Frees the wandering zombie's slot when its sinking animation ends.
# 030081 "LDU #$7982; LBSR $85AB", "LDU #$7988 ... LDA #$30,X; ASLA; ASLA" (kind_97_timed_moves by its state)
030081  func  wandering_zombie_setup
comment wandering_zombie_setup Sets the wandering zombie up, hidden, with its wait, how long it walks, its direction and its animation from kind_97_timed_moves by its state.
# 0300B0 "DEC #$3C,X; BNE", "LBSR $8620; LBSR $8626", "LDA #$80; STA #$00,X"
0300B0  func  wandering_zombie_wait
comment wandering_zombie_wait Counts the wandering zombie's wait down, then shows it rising, turned to the nearest player.
# 0300CF "LDA #$06,X; LSRA", "LDA #$3E,X; ... LBSR $866B" (07CCDD: the speeds by a direction)
0300CF  func  wandering_zombie_set_off
comment wandering_zombie_set_off When the rising animation ends, sets the wandering zombie walking in its direction (field 3E), facing the way it goes.
# 0300F0 "DEC #$3B,X", "CLRW #$0F,X; CLRW #$14,X", animation 30 + 2
0300F0  func  wandering_zombie_walk
comment wandering_zombie_walk Counts the wandering zombie's walk down, then stops it and starts it sinking.
# 03010C "LDA #$06,X; LSRA; BCC; CLR #$00,X"
03010C  func  wandering_zombie_remove_when_gone
comment wandering_zombie_remove_when_gone Frees the wandering zombie's slot when its sinking animation ends.

# ---- 4F80 type 10: the zombie (030122-0303CE) and its actions 1A, 1D, 21 ----
# 030122 "LDU #$79D4; LBSR $85AB"; state 80 and up: 03015E "LDU #$78C0; STU #$2A,X", straight to step 2; else
# object_18_behaviours by its state
030122  func  zombie_setup
comment zombie_setup Sets a zombie up: with field 30 bit 7 it comes in at once with the behaviour zombie_behaviour, turned to its player; otherwise it stays hidden and takes its next state, flags and behaviour from object_18_behaviours.
# 030173 "LDU #$79EE; LDA #$28,X; ASLA; JMP [A,U]" (79EE: 617C 61D9 61F4 6219 6223)
030173  func  zombie_come_out
comment zombie_come_out The zombie's way in, by field 28: rising out of the ground (or walking in as kind 97) until it joins the fight.
# 03017C: state 3 gives vitality 8 ("LDA #$08; STA #$1B,X"); state bit 7: "LDA #$97; STA #$04,X; LDA #$90; STA #$05,X;
# LDD #$0100; STD #$0F,X" (walks in as kind 97, 28 = 4); else animation 92 and sound 7B00 (28 = 1)
03017C  func  zombie_start_coming_out
comment zombie_start_coming_out Starts the zombie's way in: either walking in from the side's edge with kind 97's walk, or rising out of the ground with its sound.
# 0301D9 "LDA #$06,X; LSRA; BCC", "LDA #$C0; STA #$00,X", state below 2: "LDA #$87; STA #$05,X"
0301D9  func  zombie_finish_rising
comment zombie_finish_rising When the zombie's rising animation ends, makes it hittable and, for states 0-1, plays its climbing-out animation; others join the fight at once.
# 0301F4 "LDA #$30,X; BNE", 03020D "LDA #$10; STA #$3A,X; CLR #$30,X; INC #$02,X"
0301F4  func  zombie_finish_climbing
comment zombie_finish_climbing When the climbing-out animation ends, a zombie of state 1 joins the fight (step 2); one of state 0 sinks back into the ground (animation 93), out of reach.
# 030219 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
030219  func  zombie_remove_when_sunk
comment zombie_remove_when_sunk Frees the zombie's slot when its sinking animation ends.
# 030223 "DEC #$3B,X", "LDA #$91; STA #$04,X; LDA #$92; STA #$05,X; LDA #$01; STA #$28,X; LDD #$7B00; LBRA $8680"
030223  func  zombie_walk_in
comment zombie_walk_in Walks the zombie in for a while (field 3B), then turns it back into kind 91 rising out of the ground, with its sound.
# action 1D's steps (table 79F8: 6247 6250 6295 62B7)
# 030247 "LDA #$93; STA #$05,X; INC #$29,X"
030247  func  zombie_burrow_start
comment zombie_burrow_start Starts the zombie sinking into the ground (animation 93).
# 030250: under it, near (2C below 0040): y speed +-0080 for 20 frames; else x speed +-0180 for 50 frames (toward
# the player by field 36)
030250  func  zombie_burrow_move
comment zombie_burrow_move When the zombie has sunk, moves it under the ground toward its player: across if it is far, along the depth if it is near.
# 030295 "DEC #$3B,X", "CLRW #$0F,X; CLRW #$14,X; LDA #$92 ... LDD #$7B00; LBSR $8680; LBRA $85C9"
030295  func  zombie_burrow_surface
comment zombie_burrow_surface When the zombie's move under the ground is over, stops it and brings it up again with its sound, facing its player.
# 0302B7 "LDA #$06,X; BITA #$02", "LDB #$C0; STB #$00,X", "LSRA; LBCS $8635" (07D220: back to step 2)
0302B7  func  zombie_burrow_end
comment zombie_burrow_end Makes the zombie hittable on the rising animation's marked frame and ends the action when it ends.
# action 21's steps (table 7A00: 62CE 62DA 630B 6326 634C 6367)
# 0302CE "LBSR $859C; LDA #$91; STA #$05,X"
0302CE  func  zombie_leap_start
comment zombie_leap_start Turns the zombie to its player and starts its crouch before the leap.
# 0302DA "LDD #$0301; LBSR $8680", "LDD #$0100; STD #$0F,X; LDD #$0400; STD #$19,X", "LDA #$C8; STA #$00,X"
0302DA  func  zombie_leap_take_off
comment zombie_leap_take_off On the crouch's marked frame, sends the zombie leaping toward its player with a sound.
# 03030B: rising, "SUBD #$0010"; once falling "LDY #$78A0; LBSR $85B4" (its attack box)
03030B  func  zombie_leap_rise
comment zombie_leap_rise Slows the zombie's leap as it rises; once it falls, gives it its attacking hit box.
# 030326 "SUBD #$0040" then into 03032F
030326  func  zombie_leap_fall
comment zombie_leap_fall Pulls the zombie down faster as it falls, then checks its landing.
# 03032F (also the end of 03030B): "LBSR $8662; BCC", "LDY #$7890; LBSR $85B4", "CLRW #$0F,X", "LDD #$2000; LBSR $8680",
# "LDA #$20; STA #$3B,X"
03032F  func  zombie_leap_land
comment zombie_leap_land When the leaping zombie lands, gives it back its plain hit box and stops it with the landing sound and a wait.
# 03034C "LDA #$90; STA #$05,X; DEC #$3B,X", "LDA #$09,X; EORA #$40"
03034C  func  zombie_leap_turn
comment zombie_leap_turn Holds the zombie still after landing, then turns it round.
# 030367 "LDA #$90; STA #$05,X; DEC #$3B,X; LBEQ $8635"
030367  func  zombie_leap_end
comment zombie_leap_end Holds the zombie still a moment more and ends the action.
# action 1A's steps (table 7A0C: 6379 6384 6395 639E 63C2)
# 030379 "LDA #$90; STA #$05,X; INC #$29,X; LBRA $859C"
030379  func  zombie_swipe_start
comment zombie_swipe_start Starts the zombie's swipe, turned to its player.
# 030384 "LDA #$06,X; BITA #$02", "LDY #$7898; LBRA $85B4"
030384  func  zombie_swipe_hit
comment zombie_swipe_hit On the swipe's marked frame, gives the zombie its attacking hit box.
# 030395 "LDY #$7890; LBSR $85B4" then into 03039E
030395  func  zombie_swipe_recover
comment zombie_swipe_recover Gives the zombie back its plain hit box and goes on to its step back.
# 03039E "LDA #$81; STA #$05,X; LDD #$FF00; STD #$0F,X" (negated when it faces left), "LDA #$20; STA #$3B,X"
03039E  func  zombie_swipe_step_back
comment zombie_swipe_step_back When the swipe ends, walks the zombie backwards for 32 frames.
# 0303C2 "DEC #$3B,X; BNE; CLRW #$0F,X; LBRA $8635"
0303C2  func  zombie_swipe_end
comment zombie_swipe_end Stops the zombie's step back when its time is up and ends the action.

# ---- 4F80 type 11, kind 9A: hangs above and drops on a player (0303E9-03054E) ----
0303E9  file  enemies/ghost_on_rope    # stage 3's kind 9A object that hangs above and drops on the players
# step FF (7A1A entry -1: 63E9 "LDU #$7A26; LDA #$29,X; ASLA; JMP [A,U]": 63F2, 6408)
0303E9  func  ghost_on_rope_hurt
comment ghost_on_rope_hurt The kind 9A object's hit (step FF) by field 29: it shakes, then falls.
# 0303F2 "CLRW #$19,X; LDA #$88; STA #$00,X; LDA #$08; STA #$3B,X", "LDD #$6300; LBRA $8680"
0303F2  func  ghost_on_rope_hurt_start
comment ghost_on_rope_hurt_start Stops the hit object with the hit sound and a short wait.
# 030408 "DEC #$3B,X", "LDD #$FE01; STA #$02,X; STB #$3B,X" (step FE), else "EORA #$80" on field 09
030408  func  ghost_on_rope_hurt_flash
comment ghost_on_rope_hurt_flash Flashes the hit object for 8 frames, then lets it fall (step FE).
# step FE (7A1A entry -2: 6432): "LBSR $85B1; LBCC", on landing "LDD #$6C00; LBSR $8680", "LBSR $85F0; LBSR $85F3",
# "LDA #$01; STA #$1B,X"
030432  func  ghost_on_rope_fall
comment ghost_on_rope_fall Pulls the beaten object down; when it lands, with a thud, it is knocked out like a beaten enemy (stars and the knocked-down animation), left one vitality point.
# 03045F "LDU #$7A2A; LBSR $85AB", "LDA #$C8; STA #$00,X", "DEC #$42,X", ghost_on_rope_drop_starts by its state, "LDD #$0C,X;
# ADDD <$AC; STD #$2A,X"
03045F  func  ghost_on_rope_setup
comment ghost_on_rope_setup Sets the kind 9A object up out of the enemy count, with its x offset and its mode from ghost_on_rope_drop_starts, keeping its place along the stage in field 2A.
# 0304A4 "LDA #$30,X; BEQ", "CMPD #$0100; BCC", "LDA #$FE; STA #$02,X"
0304A4  func  ghost_on_rope_wait_mode
comment ghost_on_rope_wait_mode In mode 0 starts watching for players; in mode 1 lets it fall (step FE) once it comes onto the screen's left part.
# 0304BB "LDA <$16; BITA #$03", "CMPD #$0040" on 2C and 2E, "LDD #$FE00; STD #$19,X", "LDD #$5000; LBSR $8680"
0304BB  func  ghost_on_rope_watch
comment ghost_on_rope_watch Every 4 frames looks for the nearest player; within 64 pixels across and in depth, drops toward him from its place, with a sound.
# 030504 "CMPD #$0010" on 16, "LDA <$58; ANDA #$1F; ADDA #$08; STA #$3B,X", "LDY #$78B0; LBSR $85B4"
030504  func  ghost_on_rope_drop
comment ghost_on_rope_drop When it has dropped near the ground, stops it there for a random 8 to 39 frames with its attacking hit box, facing the player.
# 030531 "DEC #$3B,X", "LDY #$78A8; LBSR $85B4", "LDA #$81; STA #$05,X", "LDD #$0200; STD #$19,X"
030531  func  ghost_on_rope_hang
comment ghost_on_rope_hang Counts its time down at the bottom, then sends it climbing back up with its plain hit box.
# 03054E "CMPD #$0080" on 16, "CLRW #$19,X; LDA #$02; STA #$02,X"
03054E  func  ghost_on_rope_climb
comment ghost_on_rope_climb Stops it at the top and makes it watch for players again.

# ---- 5280 type 18: a zombie that rises and drifts (030565-03064A) ----
030565  file  enemies/rising_zombie    # the zombie of the list at 5280 (type 18) that rises and drifts toward an object
# 030565 "LDU #$7A72; LBSR $85AB", "LDU $1854; STU #$40,X", kind_91_appearances by its state
030565  func  rising_zombie_setup
comment rising_zombie_setup Sets the rising zombie up, hidden, with its wait, flags and the step it starts at from kind_91_appearances, and the object at work RAM 1854 to drift toward.
# 030590 "DEC #$3B,X", "LDA #$80; STA #$00,X; LDA #$92 ... LDD #$7B00; LBRA $8680"
030590  func  rising_zombie_wait
comment rising_zombie_wait Counts the zombie's wait down, then shows it rising out of the ground with its sound.
# 0305A9 "LDA #$06,X; LSRA; BCC; LDA #$87; STA #$05,X"
0305A9  func  rising_zombie_climb_out
comment rising_zombie_climb_out When the rising animation ends, plays the climbing-out one.
# 0305B8 "LDU #$40,X; LBSR $861D; STA #$3E,X; LDA #$40; STA #$3B,X"
0305B8  func  rising_zombie_aim
comment rising_zombie_aim When the climbing-out animation ends, takes the direction toward its object (field 40) and waits 64 frames.
# 0305D0 "DEC #$3B,X", "LDA #$80; STA #$3B,X; LDA #$94; STA #$05,X"
0305D0  func  rising_zombie_stand
comment rising_zombie_stand Counts the wait down, then plays animation 94.
# 0305E3 "LDA #$06,X; LSRA; BCC; LDA #$99; STA #$05,X"
0305E3  func  rising_zombie_rise_up
comment rising_zombie_rise_up When that animation ends, plays animation 99.
# 0305F2 "DEC #$3B,X", "LDA #$3E,X; LDB #$0C; LBSR $8617", "LDA #$9A; STA #$05,X"
0305F2  func  rising_zombie_set_off
comment rising_zombie_set_off Counts down, then sets it drifting slowly in its direction (animation 9A) for 128 frames.
# 03060D "DEC #$3B,X; BNE; CLRW #$14,X"
03060D  func  rising_zombie_drift
comment rising_zombie_drift Counts the drift down, then stops its move in depth.
# 030619 "DEC #$3B,X; BNE; INC #$02,X"
030619  func  rising_zombie_count_down
comment rising_zombie_count_down Counts field 3B down, then goes on to the next step.
# 030622 "LDD #$0F,X; SUBD #$0001; STD #$0F,X"
030622  func  rising_zombie_slow_down
comment rising_zombie_slow_down Takes a little off its x speed each frame.
# 03062C "LDA #$06,X; LSRA; BCC; LDA #$87; STA #$05,X"
03062C  func  rising_zombie_climb_out_again
comment rising_zombie_climb_out_again The second way in: when the rising animation ends, plays the climbing-out one.
# 03063B "LDA #$06,X; LSRA; BCC; LDA #$94; STA #$05,X"
03063B  func  rising_zombie_stand_again
comment rising_zombie_stand_again When the climbing-out animation ends, plays animation 94.
# 03064A "DEC #$3B,X", "LDD #$0080; STD #$0F,X; LDA #$9A; STA #$05,X; LDA #$09; STA #$02,X"
03064A  func  rising_zombie_walk_off
comment rising_zombie_walk_off Counts down, then sets it walking slowly right (animation 9A) and drifting (step 9).

# ---- 4F80 type 14: a zombie that comes out of the ground and takes hold of the players (03066D-030835) ----
03066D  file  enemies/grabbing_zombie    # stage 3's zombie that takes hold of the players (type 14, action 31)
# 03066D "LDU #$7AEC; LBSR $85AB", "LDD #$5100; STD #$4C,X", "LDU #$7A88; STU #$2A,X"; state 0: "CLR #$30,X; LDA #$02;
# STA #$02,X"
03066D  func  grabbing_zombie_setup
comment grabbing_zombie_setup Sets the grabbing zombie up with its behaviour grabbing_zombie_behaviour, turned to its player: state 0 joins the fight at once, the others stay hidden for their way out.
# 0306A6 "LDU #$7AF2; LDA #$29,X; ASLA; JMP [A,U]" (66AF 66CF 66E3)
0306A6  func  grabbing_zombie_come_out
comment grabbing_zombie_come_out The grabbing zombie's way out of the ground, by field 29.
# 0306AF kind_97_entrances by its state (wait, x / 16), "LDA #$90; STA #$05,X"
0306AF  func  grabbing_zombie_place
comment grabbing_zombie_place Shows the zombie's hand coming out at its place from kind_97_entrances, for its wait.
# 0306CF "DEC #$3B,X", "LDA #$91; STA #$05,X", "LDD #$4800; LBRA $8680"
0306CF  func  grabbing_zombie_rise
comment grabbing_zombie_rise Counts the wait down, then plays the zombie climbing out, with a sound.
# 0306E3 "LDA #$06,X; LSRA; BCC; LDA #$C0; STA #$00,X; CLR #$30,X; INC #$02,X"
0306E3  func  grabbing_zombie_join_fight
comment grabbing_zombie_join_fight When the climbing-out animation ends, makes the zombie hittable and lets it join the fight.
# action 31's steps (table 7B02: 66FB 6721 67D8 6826)
# 0306FB "LDU #$38,X; LDA #$02,U; BMI; LDA #$3D,U; BEQ" (else LBRA $8635), "LDA #$40; STA #$3B,X", "LBSR $861D; LDB
# #$30; LBSR $8617; INC #$29,X; LBRA $85CF"
0306FB  func  zombie_grab_start
comment zombie_grab_start Starts the grab when its player is free (not hurt, not held): walks at him for 64 frames; otherwise ends the action.
# 030721: hit by the player ("BITA #$20"), within 8 across and 4 in depth, both on the ground: "STX #$4B,U; LDA #$0C; STA
# #$3D,U", "ORA #$20; STA #$00,U", "LDA #$03; STA #$1E,U"; its animation by the player's character (kind_97_hold_
# animations); else 0307C0 counts 3B down, steering at the player
030721  func  zombie_grab_reach
comment zombie_grab_reach Walks the zombie at its player; when it touches him on the ground, takes hold of him (the player's field 4B points to it), puts itself on his place and plays the hold for his character; gives up after its time.
# 0307D8: while held ("LDA #$3D,U; BEQ"): field 58 counts the shakes; let go: "LDA #$1B,X; SUBA #$03", "LDA #$04; STA
# #$02,X", "LDA <$58; ANDA #$01; ADDA #$02; STA #$28,X" (thrown off: the hit reaction 2 or 3)
0307D8  func  zombie_grab_hold
comment zombie_grab_hold Holds the player while he is held; when he breaks free the zombie loses 3 vitality and is thrown off into the hit reaction; if the player is beaten, it ends the action.
# 030826 "LDA #$06,X; LSRA; BCC; LDA #$01; STA #$58,X; DEC #$29,X; BRA $67D8"
030826  func  zombie_grab_hold_loop
comment zombie_grab_hold_loop Plays the hold again when it ends, then goes on holding.

# ---- 4F80 type 2F: the lumberjack (030842-03096A) ----
030842  file  enemies/lumberjack    # stage 5's lumberjack (type 2F) and its axe (action 22)
# 030842 "LDU #$7BF2; LBSR $85AB", "LDU #$7B36; STU #$2A,X"; state 0 straight to step 2, else "LDA #$80; STA #$00,X"
030842  func  lumberjack_setup
comment lumberjack_setup Sets the lumberjack up with its behaviour lumberjack_behaviour, turned to its player: state 0 joins the fight at once, the others jump in first.
# 03087F "LDU #$7BF8; LDA #$29,X; ASLA; JMP [A,U]" (6888 68A4 68C1)
03087F  func  lumberjack_jump_in
comment lumberjack_jump_in The lumberjack's way in, by field 29: a walk, then a jump down into the stage.
# 030888 "LDD #$0100; STD #$0F,X; LDA #$60; STA #$3B,X"
030888  func  lumberjack_walk_in
comment lumberjack_walk_in Walks the lumberjack in toward its player for 96 frames.
# 0308A4 "DEC #$3B,X", "LDD #$FF80; STD #$14,X; LDD #$0400; STD #$19,X"
0308A4  func  lumberjack_jump_down
comment lumberjack_jump_down When the walk is over, jumps the lumberjack down toward the front.
# 0308C1 "SUBD #$0030", "LBSR $8662; BCC", "LDA #$C0; STA #$00,X; LBRA $8635"
0308C1  func  lumberjack_land
comment lumberjack_land Pulls the lumberjack down until it lands, then makes it hittable and lets it fight.
# action 22's steps (table 7BFE: 68F0 6901 6926 692F 6939 6942 695C)
# 0308F0 "LDA #$90; STA #$05,X", "LDD #$6A00; LBSR $8680; LBRA $859C"
0308F0  func  lumberjack_axe_start
comment lumberjack_axe_start Starts the lumberjack's swing with its sound, turned to its player.
# 030901 "BITA #$02", "LDD #$6A00; LBSR $8680; LDY #$7B16; LBSR $85B4", "DEC #$3D,X ... LDA #$04; STA #$29,X"
030901  func  lumberjack_axe_swing
comment lumberjack_axe_swing On the swing's marked frame gives it the axe's hit box with the sound; every other swing goes on to the pause.
# 030926 "LDY #$7B0E; LBSR $85B4" then into 03092F
030926  func  lumberjack_axe_recover
comment lumberjack_axe_recover Gives the lumberjack back its plain hit box and ends the action when the swing ends.
# 03092F "LDA #$06,X; LSRA; BCC; LBRA $8635" (also step 3 of the gorilla's action 26: 7C4F)
03092F  func  enemy_end_action_with_animation
comment enemy_end_action_with_animation Ends the enemy's action when its animation ends (shared by the lumberjack's and the gorilla's attacks).
# 030939 "LDY #$7B0E; LBSR $85B4" then 030942 "LDA #$86; STA #$05,X; LDU #$7C0C; LDA <$57; LDA A,U; STA #$3C,X"
030939  func  lumberjack_axe_rest
comment lumberjack_axe_rest Gives the lumberjack back its plain hit box and goes on to its pause.
030942  func  lumberjack_axe_pause
comment lumberjack_axe_pause When the swing ends, starts the pause animation for as many times as lumberjack_pause_loops_by_players gives.
# 03095C "LDA #$06,X; LSRA; BCC; DEC #$3C,X; BNE; LBRA $8635"
03095C  func  lumberjack_axe_wait
comment lumberjack_axe_wait Counts the pause's loops down and ends the action.

# ---- 4F80 type 31: the gorilla (030977-030B81) ----
030977  file  enemies/gorilla    # stage 5's gorilla (type 31) and its actions 26, 2C, 35
# 030977 "LDU #$7C1D; LBSR $85AB", "LDU #$7B8E; STU #$2A,X", state 0 to step 2, else "LDA #$FF; STA #$42,X"
030977  func  gorilla_setup
comment gorilla_setup Sets the gorilla up with its behaviour gorilla_behaviour, turned to its player: state 0 joins the fight at once, the others come in first, out of the enemy count.
# 0309AA "LDU #$7C23; LDA #$29,X; ASLA; JMP [A,U]" (69B3 69E6 69FC 6A10 6A3F 6A63 6A74 6A10 6A8E 6A63 6A74 6A10)
0309AA  func  gorilla_come_in
comment gorilla_come_in The gorilla's way in, by field 29: the steps its entrance (gorilla_entrances) starts it at.
# 0309B3 "LDA #$80; STA #$00,X; STA #$57,X", gorilla_entrances by its state
0309B3  func  gorilla_entrance_setup
comment gorilla_entrance_setup Takes the gorilla's flags, the x it comes to, the step it starts at (hidden with bit 7) and its animation from gorilla_entrances.
# 0309E6 "LDD #$0C,X; CMPD #$3E,X; BCC", "LDA #$93; STA #$05,X; LDA #$10; STA #$3B,X"
0309E6  func  gorilla_wait_for_place
comment gorilla_wait_for_place Waits for the scroll to bring the gorilla to its x, then plays animation 93 for 16 frames.
# 0309FC "DEC #$3B,X", "LDD #$FF00; STD #$14,X; LDA #$04; STA #$3B,X"
0309FC  func  gorilla_step_forward
comment gorilla_step_forward Counts down, then moves the gorilla toward the front.
# 030A10 "CLRD; LBSR $8638; ANDA #$0F; ASLA x3; CMPA #$5D,X" (the floor under it), "LDA #$C0; STA #$00,X; CLR #$57,X; CLR
# #$42,X; INC #$02,X"
030A10  func  gorilla_reach_floor
comment gorilla_reach_floor Moves the gorilla toward the front until it is on the floor it walks on, then makes it hittable, counts it as an enemy and lets it fight.
# 030A3F "CMPD #$3E,X", "LDA #$81; STA #$05,X; LDD #$0100; STD #$0F,X; LDA #$40; STA #$3B,X; LBRA $85C6"
030A3F  func  gorilla_walk_right_in
comment gorilla_walk_right_in When the scroll brings the gorilla to its x, walks it right for 64 frames.
# 030A63 "DEC #$3B,X", "CLRW #$0F,X; LDA #$86; STA #$05,X"
030A63  func  gorilla_stop
comment gorilla_stop Counts the walk down, then stops the gorilla with animation 86.
# 030A74 "LDA #$06,X; LSRA; BCC; LDA #$81 ... LDD #$FF00; STD #$14,X; LDA #$04; STA #$3B,X"
030A74  func  gorilla_turn_to_front
comment gorilla_turn_to_front When that animation ends, walks the gorilla toward the front.
# 030A8E "CMPD #$3E,X", "LDA #$81; STA #$05,X; LDD #$FF00; STD #$0F,X; LDA #$40; STA #$3B,X; LBRA $85C6"
030A8E  func  gorilla_walk_left_in
comment gorilla_walk_left_in When the scroll brings the gorilla to its x, walks it left for 64 frames.
# action 26's steps (table 7C4F: 6AB8 6AC3 6AD4 692F)
# 030AB8 "LDA #$90; STA #$05,X; INC #$29,X; LBRA $859C"
030AB8  func  gorilla_punch_start
comment gorilla_punch_start Starts the gorilla's blow, turned to its player.
# 030AC3 "BITA #$02", "LDY #$7B26; LBRA $85B4"
030AC3  func  gorilla_punch_hit
comment gorilla_punch_hit On the blow's marked frame, gives the gorilla its attacking hit box.
# 030AD4 "LDY #$7B1E; LBSR $85B4", "LSRA; BCC; LBRA $8635"
030AD4  func  gorilla_punch_end
comment gorilla_punch_end Gives the gorilla back its plain hit box and ends the action when the blow ends.
# action 2C's steps (table 7C57: 6AED 6B1A 6B37)
# 030AED "LDA #$91; STA #$05,X; LDA #$08; STA #$3B,X; LDD #$0200; STD #$0F,X", gorilla_leap_speeds by <$6B
030AED  func  gorilla_leap_take_off
comment gorilla_leap_take_off Sends the gorilla leaping at its player, as high as gorilla_leap_speeds gives for the stage's difficulty.
# 030B1A "SUBD #$0030", "LBSR $8662; BCS", "DEC #$3B,X", "LDY #$7B2E; LBRA $85B4"
030B1A  func  gorilla_leap_rise
comment gorilla_leap_rise Pulls the gorilla down; 8 frames into the leap gives it its attacking hit box.
# 030B37 "SUBD #$0030", "LBSR $8662; BCC" into 030B45
030B37  func  gorilla_leap_fall
comment gorilla_leap_fall Pulls the gorilla down until it lands.
# 030B45 (also from 030B26 "BCS $6B45"): "CLRW #$0F,X; LDY #$7B1E; LBSR $85B4; LBRA $8635"
030B45  func  gorilla_leap_land
comment gorilla_leap_land Stops the landed gorilla with its plain hit box and ends the action.
# action 35's steps (table 7C6B: 6B58 6B79)
# 030B58 "LDA #$81; STA #$05,X; LDA #$20; STA #$3B,X; LDD #$FE80; STD #$0F,X", negated when it faces left
030B58  func  gorilla_back_off_start
comment gorilla_back_off_start Walks the gorilla away from its player for 32 frames.
# 030B79 "DEC #$3B,X; BNE; LBRA $8635"
030B79  func  gorilla_back_off_end
comment gorilla_back_off_end Ends the action when the walk's time is up.

# ---- 4F80 type F5: the knight (030BB8-030E32) ----
030BB8  file  enemies/knight    # stage 6's knight (type F5) and its action 3C
# step FF of its table (7CD9 entry -1: 6BB8 "LDU #$7CE5; LDA #$29,X"): 6BC1 6BE1; 030B9D sets it when its first form
# (field 44) is beaten: "LDY #$7C6F; LBSR $85B4", "LDD #$6300; LBSR $8680", "LDD #$80FF"
030BB8  func  knight_lose_first_form
comment knight_lose_first_form The knight beaten in its first form, by field 29: it falls and comes back as its fighting kind.
# 030BC1 "LBSR $85B1; BCC", "LDY #$7CE9; LBSR $862C" (a child: 0000 0000 30 02 80 09, 4D40 type 09), "LDA #$88; STA
# #$05,X", "LDU #$38,X; LBRA $859F"
030BC1  func  knight_fall
comment knight_fall Pulls the beaten knight down; when it lands, puts in what it leaves behind (4D40 type 09) and plays animation 88.
# 030BE1 "LDA #$50,X; STA #$04,X; LDA #$80; STA #$05,X; LDA #$C0; STA #$00,X; LDD #$0201; STA #$02,X; STB #$1B,X"
030BE1  func  knight_get_up
comment knight_get_up When that animation ends, the knight takes its fighting kind (field 50) with one vitality point and fights again.
# 030C0A "LDU #$7CF1; LBSR $85AB", "INC #$44,X", "LDU #$7C7F; STU #$2A,X", knight_entrances by its state
030C0A  func  knight_setup
comment knight_setup Sets the knight up with its behaviour knight_behaviour in its first form: with state bit 7 hidden, with the entrance kind, wait, fighting kind and x from knight_entrances; otherwise fighting at once.
# 030C65 "LDU #$7D37; LDB #$29,X; ASLB; JMP [B,U]"
030C65  func  knight_come_in
comment knight_come_in The knight's way in, by field 29 (knight_entrance_styles gives where it starts).
# 030C6E knight_entrance_styles by its state: "STA #$29,X; CLRA; STD #$3E,X; CLR #$30,X"
030C6E  func  knight_choose_entrance
comment knight_choose_entrance Takes the step the knight's way in starts at and its slowdown from knight_entrance_styles.
# 030C84 "DEC #$3B,X", "LDD #$0301; LBSR $8680", "LDD #$8080; STD #$0A,X", "LDD #$0080; STD #$0F,X; LDD #$0300;
# STD #$19,X"
030C84  func  knight_jump_in
comment knight_jump_in After its wait, the knight jumps in from the front, big (zoom 8080), with a sound.
# 030CAF "BSR $6CF6", "SUBD #$0010" on 19, once falling "LDD #$FF80; STD #$14,X"
030CAF  func  knight_jump_rise
comment knight_jump_rise Shrinks the jumping knight and slows its rise; once it falls, moves it toward the front.
# 030CCB "BSR $6CF6", "SUBD #$0020", "LBSR $8662; BCC", "LDD #$2000; LBSR $8680", "LDA #$C0; STA #$00,X", "INC #$02,X"
030CCB  func  knight_jump_land
comment knight_jump_land Shrinks the knight and pulls it down until it lands with a sound, then makes it hittable and lets it fight.
# 030CF6 "LDD #$0A,X; SUBD #$0101; CMPD #$4040; BCS", "LDA #$98" / "LDA #$88" into field 00
030CF6  func  knight_shrink
comment knight_shrink Shrinks the jumping knight a step until its zoom is back to 4040.
# 030D0E "LDA #$80; STA #$00,X; LDA #$50; STA #$09,X"
030D0E  func  knight_walk_in_start
comment knight_walk_in_start Shows the knight that walks in from the right.
# 030D1C "CMPD #$0160", "LDD #$FFC0; STD #$0F,X; LDD #$FF80; STD #$14,X; LDA #$81; STA #$05,X; LDA #$20; STA #$3B,X"
030D1C  func  knight_walk_in
comment knight_walk_in When the scroll brings the knight on, walks it in from the right toward the front for 32 frames.
# 030D3E "DEC #$3B,X; BNE; LDA #$C0; STA #$00,X; LDA #$02; STA #$02,X"
030D3E  func  knight_walk_in_end
comment knight_walk_in_end Counts the walk down, then makes the knight hittable and lets it fight.
# 030D4E as 030C84 at another height speed ("LDD #$0300; STD #$19,X", no x speed)
030D4E  func  knight_jump_in_straight
comment knight_jump_in_straight After its wait, the knight jumps in from the front straight up, big, with a sound.
# 030D73 "LDD #$0400; STD #$0F,X; LDD #$0200; STD #$19,X"
030D73  func  knight_leap_in
comment knight_leap_in After its wait, the knight leaps in from the front fast across, big, with a sound.
# 030D9E "LBSR $6CF6", "SUBD #$0010" on 0F and 19, once falling "LDD #$2000; LBSR $8680"
030D9E  func  knight_leap_rise
comment knight_leap_rise Shrinks the leaping knight and slows it; once it falls, moves it toward the front with a sound.
# 030DCA "LBSR $6CF6", "LDD #$0F,X; SUBD #$3E,X", "SUBD #$0020", "LBSR $8662; BCC" ... "INC #$02,X"
030DCA  func  knight_leap_land
comment knight_leap_land Shrinks the knight, slows it by its slowdown (field 3E) and pulls it down until it lands with a sound, then lets it fight.
# action 3C's steps (table 7D71: 6E05 6E10 6E23)
# 030E05 "LDA #$90; STA #$05,X; INC #$29,X; LBRA $859C"
030E05  func  knight_strike_start
comment knight_strike_start Starts the knight's blow, turned to its player.
# 030E10 "BITA #$02", "LDY #$7C77; LBSR $85B4"
030E10  func  knight_strike_hit
comment knight_strike_hit On the blow's marked frame, gives the knight its attacking hit box.
# 030E23 "LDA #$06,X; LSRA; BCC", "LDY #$7C6F; LBSR $85B4; LBRA $8635"
030E23  func  knight_strike_end
comment knight_strike_end When the blow ends, gives the knight back its plain hit box and ends the action.

# ---- 4D40 type 28: the devil's lightning bolt (030E39-030E65) ----
030E39  file  enemies/cloud_devil    # stage 6's devil on a cloud (type F2) and its lightning bolt (4D40 type 28)
# 030E39 "LDU #$7D8B; LBSR $85AB", "SUBD #$0030" on 16, "LDD #$4C00; LBSR $8680"
030E39  func  lightning_bolt_setup
comment lightning_bolt_setup Sets the lightning bolt up below the cloud with its sound.
# 030E5C "LDA #$06,X; LSRA; BCC; CLR #$00,X"
030E5C  func  lightning_bolt_end
comment lightning_bolt_end Frees the bolt's slot when its animation ends.

# ---- 4F80 type F2: the devil on a cloud (030E8F-0311DB) ----
# 030E8F "LDU #$7DC2; LBSR $85AB", kind_c7_sweep_ways/headings/sweep_rates/start_x by its state, "LDD #$0040; STD
# #$16,X", "LDD #$0258; STD #$2C,X" (600 frames)
030E8F  func  cloud_devil_setup
comment cloud_devil_setup Sets the devil up, hidden, at its height, with its x, heading and sweep from the kind_c7 tables by its state and 600 frames to stay.
# 030ED9 "LDU #$7DC8; LDB #$29,X" (6EE2 6EF9 6F14)
030ED9  func  cloud_devil_come_in
comment cloud_devil_come_in The devil's way in, by field 29.
# 030EE2 "LBSR $7165", "LDA #$88; STA #$00,X", "LDD #$6C00; LBSR $8680", "LDA #$84; STA #$05,X"
030EE2  func  cloud_devil_appear
comment cloud_devil_appear Shows the devil appearing, bobbing, with a sound.
# 030EF9: when the animation ends "LDA #$81"; state 3 waits 8 frames; state 2 "LDD #$4B00; LBSR $8680"; "LDA #$C8;
# STA #$00,X; LBSR $8620; LBSR $71CE; LBSR $71AC; INC #$02,X"
030EF9  func  cloud_devil_start_flying
comment cloud_devil_start_flying When it has appeared, sets the devil flying at the nearest player with a wait before its first bolt.
# 030F14 "DEC #$3B,X; BNE; BRA $6F28"
030F14  func  cloud_devil_wait_to_fly
comment cloud_devil_wait_to_fly Counts a short wait down before the devil flies.
# 030F28 (the end of 030EF9 and 030F14): "LDA #$C8; STA #$00,X; LBSR $8620; LBSR $71CE; LBSR $71AC; INC #$02,X; CLRW
# #$28,X"
030F28  func  cloud_devil_take_off
comment cloud_devil_take_off Makes the devil hittable and sends it flying at the nearest player, with its first wait before a bolt and its speeds.
# 030F3D: 2C (frames left) at 0: "LBSR $7092; LDD #$0100; STD #$19,X", gone above height 0100; else "DECW #$2C,X; LBSR
# $7184; LBSR $7092; DEC #$3B,X", at 0 "INC #$02,X; LBRA $6E6F" (030E6F: turns it to its player's side, "LDD #$0C,X;
# CMPD #$0C,U", field 09 bit 6)
030F3D  func  cloud_devil_fly
comment cloud_devil_fly Flies the devil around its player, bobbing, until its next bolt is due, then turns it to face him; when its stay (field 2C) is over, it rises off the screen and goes.
# 030F70 "CLRW #$0F,X; CLRW #$14,X; CLRW #$19,X; LDA #$83; STA #$05,X; LDA #$40; STA #$3B,X"
030F70  func  cloud_devil_stop_to_shoot
comment cloud_devil_stop_to_shoot Stops the devil and plays its lightning animation for 64 frames.
# 030F87 "DEC #$3B,X", "LDY #$6FAE; LBSR $862C" (4D40 type 28), "LDA #$20; STA #$3B,X"
030F87  func  cloud_devil_drop_bolt
comment cloud_devil_drop_bolt Counts down, then puts in a lightning bolt under the cloud.
# 030F9B "DEC #$3B,X", "LDA #$02; STA #$02,X; LDA #$81; STA #$05,X; LBSR $71CE"
030F9B  func  cloud_devil_resume
comment cloud_devil_resume Counts down, then sends the devil flying again with a new wait before its next bolt.
# step FF (7D95 entry -1: 6FB6 "LDU #$7DCE": 6FBF 6FE7)
030FB6  func  cloud_devil_hurt
comment cloud_devil_hurt The devil's hit (step FF), by field 29.
# 030FBF "LDA #$88; STA #$00,X", speeds cleared, "LDD #$16,X; STD #$50,X; LDA #$1E; STA #$3B,X; LDD #$6300; LBSR
# $8680; LDA #$85; STA #$05,X"
030FBF  func  cloud_devil_hurt_start
comment cloud_devil_hurt_start Stops the hit devil, keeps its height and plays its hurt animation for 30 frames, with the hit sound.
# 030FE7 "LBSR $707A; DEC #$3B,X", flashing by field 09; at 0 "LDA #$02; STA #$02,X; LDA #$C8; STA #$00,X"
030FE7  func  cloud_devil_hurt_shake
comment cloud_devil_hurt_shake Shakes and flashes the hit devil, then sends it flying again.
# step FE (7D95 entry -2: 702E "LDU #$7DD2": 7037 7054 7070)
03102E  func  cloud_devil_die
comment cloud_devil_die The beaten devil (step FE), by field 29.
# 031037 "LDA #$88; STA #$00,X", speeds cleared, "LDD #$6300; LBSR $8680; LDA #$86; STA #$05,X"
031037  func  cloud_devil_die_start
comment cloud_devil_die_start Stops the beaten devil with the hit sound and its falling animation.
# 031054 "LBSR $85B1; BCC", "LDA #$27,X; ORA #$80", "LDD #$4800; LBSR $8680; LDA #$88; STA #$05,X"
031054  func  cloud_devil_die_fall
comment cloud_devil_die_fall Pulls the beaten devil down; when it lands, with a sound, plays its last animation.
# 031070 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
031070  func  cloud_devil_die_end
comment cloud_devil_die_end Frees the devil's slot when its last animation ends.
# 03107A kind_c7_hurt_shakes (see symbols.txt)
03107A  func  cloud_devil_shake_height
comment cloud_devil_shake_height Sets the hit devil's height speed toward its kept height plus a shake from kind_c7_hurt_shakes.
# 031092: "LDA <$15; ANDA #$7F; BNE; LBSR $8620" (a new player each 128 frames), the heading 2E swept by 3A between 4 and
# C ("COM #$3D,X"), "LBSR $71AC", y speed toward the player's y, x kept to 0060-015F and y to 0090-00FF
031092  func  cloud_devil_steer
comment cloud_devil_steer Steers the devil around its player: sweeps its heading back and forth on its side of him, follows his depth and keeps it on the screen.
# 031165 kind_c7_bob_up by field 37 ("ADDD #$0040; SUBD #$16,X"), 37 kept to 0-1F
031165  func  cloud_devil_bob_in
comment cloud_devil_bob_in Bobs the appearing devil's height by kind_c7_bob_up.
# 031184 kind_c7_bob_down / kind_c7_bob_up by field 37's bits
031184  func  cloud_devil_bob
comment cloud_devil_bob Bobs the flying devil's height up and down by kind_c7_bob_down and kind_c7_bob_up.
# 0311AC kind_c7_slow_velocities while it circles (step 2), else kind_c7_fast_velocities, by its heading
0311AC  func  cloud_devil_set_speeds
comment cloud_devil_set_speeds Sets the devil's x and y speeds by its heading, slow while it circles its player, fast otherwise.
# 0311CE "LBSR $8623; ANDA #$03; LDU #$7E1C; LDA A,U; STA #$3B,X"
0311CE  func  cloud_devil_choose_shot_wait
comment cloud_devil_choose_shot_wait Picks the frames before the devil's next bolt at random from kind_c7_shot_waits.

# ---- 4D40 type 11: the shot kind 8E throws (0311F5-031237) ----
0311F5  file  objects/belly_dancer    # the kind 8E figures (types 24, 5280 20) and the shot type 24 throws (4D40 type 11)
# steps FE and FF (7EEC entries -2, -1: 71F5 "LDU #$7EF0; LDA #$29,X": 71FE 720A)
0311F5  func  spark_shot_burst
comment spark_shot_burst The shot that has hit (steps FE, FF), by field 29: it stops, bursts and goes.
# 0311FE "CLRW #$0F,X; LDA #$80; STA #$05,X"
0311FE  func  spark_shot_burst_start
comment spark_shot_burst_start Stops the shot and plays its burst.
# 03120A "LDA #$06,X; LSRA; BCC; CLR #$00,X"
03120A  func  spark_shot_remove
comment spark_shot_remove Frees the shot's slot when its burst ends.
# 031214 "LDU #$7EF4; LBSR $85AB; LDA #$01; STA #$1D,X; LDA #$C8; STA #$00,X", "LDD #$FD00; STD #$0F,X"
031214  func  spark_shot_setup
comment spark_shot_setup Sets the shot up flying left fast, able to hurt.
# 031237 "RTS"
031237  func  spark_shot_fly
comment spark_shot_fly The shot's flight: nothing to do, it moves by its speed.

# ---- 4F80 type 24, kind 8E: throws the shot (031243-0312E3) ----
# 031243 "LDA #$02,X; BMI", "LDA #$00,X; BITA #$20", "LDA #$FF; STA #$02,X"
031243  func  belly_dancer_thrower_check_hit
comment belly_dancer_thrower_check_hit Sends the thrower into its hit step (FF) when it is hit.
# step FF (7EFC entry -1: 7255 "LDU #$7F08; LDA #$29,X": 725E 7279 7283 728C)
031255  func  belly_dancer_thrower_hurt
comment belly_dancer_thrower_hurt The thrower when hit (step FF), by field 29: it runs off.
# 03125E "LDD #$0100; STD #$0F,X; LDA #$82; STA #$05,X; INC #$29,X; LBRA $85C6"
03125E  func  belly_dancer_thrower_run_off
comment belly_dancer_thrower_run_off Sends the hit thrower running off to the right.
# 031279 "RTS"
031279  func  belly_dancer_thrower_running
comment belly_dancer_thrower_running The thrower running off: nothing to do until it leaves the screen.
# 031283 "LDA #$84; STA #$05,X; INC #$29,X"
031283  func  belly_dancer_thrower_stagger
comment belly_dancer_thrower_stagger Plays the thrower's animation 84.
# 03128C "LDA #$06,X; LSRA; BCC; LDA #$C0; STA #$00,X; LDA #$02; STA #$02,X"
03128C  func  belly_dancer_thrower_recover
comment belly_dancer_thrower_recover When that animation ends, makes the thrower hittable and starts it throwing again.
# 03129D "LDU #$7F10; LBSR $85AB; LDA #$09,X; ORA #$40"
03129D  func  belly_dancer_thrower_setup
comment belly_dancer_thrower_setup Sets the thrower up facing left.
# 0312AF "CMPD #$0150; BCC; INC #$02,X"
0312AF  func  belly_dancer_thrower_wait
comment belly_dancer_thrower_wait Waits for the scroll to bring the thrower on the screen.
# 0312BB "LDA #$83; STA #$05,X"
0312BB  func  belly_dancer_thrower_wind_up
comment belly_dancer_thrower_wind_up Starts the thrower's throw.
# 0312C4 "BITA #$02", "LDY #$7F16; LBSR $862F" (4D40 type 11)
0312C4  func  belly_dancer_thrower_throw
comment belly_dancer_thrower_throw On the throw's marked frame, puts in the shot.
# 0312D4 "LDA #$06,X; LSRA; BCC; LDA #$81; STA #$05,X"
0312D4  func  belly_dancer_thrower_follow_through
comment belly_dancer_thrower_follow_through When the throw ends, plays the thrower's animation 81.
# 0312E3 "LDA #$06,X; LSRA; BCC; LDA #$02; STA #$02,X"
0312E3  func  belly_dancer_thrower_repeat
comment belly_dancer_thrower_repeat When that animation ends, starts another throw.

# ---- 5280 type 1D, kind 87 (0312F8-031382) ----
0312F8  file  objects/stage_4_figures    # the figures of stages 4 and 5: kinds 87, 9E, 8E (5280 types 1D, 22, 20), 8C, 8A (4F80 22, 21)
# 0312F8 "LDU #$7F2A; LBSR $85AB; LDA #$80; STA #$00,X", field 09 "ORA #$A9"
0312F8  func  walking_kind_87_setup
comment walking_kind_87_setup Sets the kind 87 figure up, shown.
# 031311 "CMPD #$0120; BCC", "LDA #$20; STA #$3B,X"
031311  func  walking_kind_87_wait
comment walking_kind_87_wait Waits for the scroll to bring the figure on, then waits 32 frames more.
# 031322 "DEC #$3B,X", "LDD #$FF00; STD #$14,X; LDA #$10; STA #$3B,X"
031322  func  walking_kind_87_step_out
comment walking_kind_87_step_out Counts down, then moves the figure toward the front for 16 frames.
# 031336 "DEC #$3B,X", field 09 "ORA #$10", "CLRW #$14,X; LDA #$81; STA #$05,X"
031336  func  walking_kind_87_stop
comment walking_kind_87_stop Counts down, then stops the figure and plays animation 81.
# 031351 "LDA #$06,X; LSRA; BCC", "LDD #$0100; STD #$0F,X; LDD #$FF00; STD #$14,X; LDA #$40; STA #$3B,X; LDA #$80"
031351  func  walking_kind_87_walk_off
comment walking_kind_87_walk_off When that animation ends, walks the figure right and toward the front for 64 frames.
# 031371 "DEC #$3B,X", "LDD #$0200; STD #$0F,X; CLRW #$14,X"
031371  func  walking_kind_87_run_off
comment walking_kind_87_run_off Counts down, then sends the figure right at a run.
# 031382 "RTS"
031382  func  walking_kind_87_running
comment walking_kind_87_running The figure running off: nothing to do until it leaves the screen.

# ---- 5280 type 22, kind 9E (03138C-0314D8) ----
# 03138C "LDU #$7F44; LBSR $85AB", "LDD #$0010; STD #$16,X", "LDD #$FF00; STD #$0F,X; LDA #$48; STA #$3B,X; LBRA $85C6"
03138C  func  moe_setup
comment moe_setup Sets the kind 9E figure up a little above the ground, walking left for 72 frames.
# 0313B8 "DEC #$3B,X", "LDA #$01; STA #$3D,X; LDU #$40,X; LDA #$04; STA #$00,U; LDA #$80; STA #$06,U; LDA #$82"
0313B8  func  moe_stop
comment moe_stop Counts the walk down, then stops the figure, hides its parent (field 40) and plays animation 82.
# 0313DB "LDA #$06,X; LSRA; BCC; LDA #$83; STA #$05,X"
0313DB  func  moe_wait_pose
comment moe_wait_pose When that animation ends, plays animation 83.
# 0313EA "LDD <$AC; CMPD #$0238; BCS; LDA #$84"
0313EA  func  moe_wait_for_scroll
comment moe_wait_for_scroll Waits for the scroll to reach 0238, then plays animation 84.
# 0313FB "LDA #$06,X; LSRA; BCC", "LDU #$40,X; LDA #$80; STA #$00,U; STA #$06,U", "LDD #$0100; STD #$0F,X; LBRA $85C6"
0313FB  func  moe_show_parent
comment moe_show_parent When that animation ends, shows its parent again and walks the figure right.
# 03141E "CMPD #$0100" on 0C, "LDD <$AC; CMPD #$0340" (then "LDA #$08; STA #$02,X")
03141E  func  moe_walk_right
comment moe_walk_right Walks the figure right up to x 0100 and stops it; once the scroll reaches 0340, it stands and waits to leave.
# 03144C "LDA #$06,X; LSRA; BCC", "LDD #$0100; STD #$0F,X; LDA <$58; BPL; NEGW #$0F,X"
03144C  func  moe_wander
comment moe_wander When its animation ends, walks the figure one way at random for 32 frames.
# 031471 "LDD <$AC; CMPD #$0340", "DEC #$3B,X; ... DEC #$02,X", 03149B "CMPD #$00E0" / "CMPD #$0100" on 0C
031471  func  moe_pace
comment moe_pace Keeps the figure pacing between x 00E0 and 0100 until the scroll reaches 0340, then makes it stand and wait.
# 0314B6 "DEC #$3B,X", "LDA #$81; STA #$05,X; LDD #$FF00; STD #$0F,X; LBRA $85C6"
0314B6  func  moe_leave
comment moe_leave Counts the wait down, then walks the figure off to the left.
# 0314CD "CMPD #$0030; BCC; CLR #$00,X"
0314CD  func  moe_remove_at_edge
comment moe_remove_at_edge Frees the figure's slot when it reaches the screen's left edge.

# ---- 5280 type 20, kind 8E (0314E2-031540) ----
# 0314E2 "LDU #$7F58; LBSR $85AB", belly_dancer_poses by its state; state 0 to step 2
0314E2  func  belly_dancer_watcher_setup
comment belly_dancer_watcher_setup Sets the kind 8E figure up in its pose from belly_dancer_poses; state 0 waits for work RAM 187F, the others just stand.
# 03150C "RTS" (step 1)
03150C  func  belly_dancer_watcher_stand
comment belly_dancer_watcher_stand The figure standing: nothing to do.
# 03150D "LDA $187F; BEQ", "LDA #$9F; STA $4A84; STA $4B44; STA $4C04; STA $4CC4" (the players' objects' field 44),
# "LDA #$C0; STA #$00,X"
03150D  func  belly_dancer_watcher_wait_signal
comment belly_dancer_watcher_wait_signal When work RAM 187F is set, sets field 44 of the four players' objects to 9F and makes the figure hittable.
# 03152E "BITA #$20", "LDA #$80; STA #$00,X; LDA #$01; STA #$02,X"
03152E  func  belly_dancer_watcher_wait_hit
comment belly_dancer_watcher_wait_hit When the figure is hit, makes it unhittable and leaves it standing.

# ---- 4F80 type 22, kind 8C (03154D-0315E0) ----
# step FD (7F64 entry -3: 754D "LDU #$7F68; LDA #$28,X": 7556 7583 759B)
03154D  func  barney_bystander_leave
comment barney_bystander_leave The bystander leaving (step FD), by field 28.
# 031556 "CLRW #$0F,X; CLRW #$14,X; LDA #$90; STA #$05,X"
031556  func  barney_bystander_turn_away
comment barney_bystander_turn_away Stops the bystander and plays its turning animation.
# steps FE and FF (7F64 entries -2, -1: 7565 "LDU #$7F6E; LDA #$28,X": 756E 7583 759B)
031565  func  barney_bystander_hurt
comment barney_bystander_hurt The bystander when hit (steps FE, FF), by field 28: it reels and walks off.
# 03156E "LDD #$6300; LBSR $8680", speeds cleared, "LDA #$89; STA #$05,X"
03156E  func  barney_bystander_reel
comment barney_bystander_reel Stops the hit bystander with the hit sound and its hurt animation.
# 031583 "LDA #$06,X; LSRA; BCC", "LDD #$FE80; STD #$0F,X; LDA #$81; STA #$05,X; LBRA $85C6"
031583  func  barney_bystander_walk_off
comment barney_bystander_walk_off When its animation ends, walks the bystander off to the left.
# 03159B "RTS"
03159B  func  barney_bystander_walking
comment barney_bystander_walking The bystander walking off: nothing to do until it leaves the screen.
# 03159C "LDU #$7F74; LBSR $85AB; LDA #$40; STA #$09,X; LDA #$FF; STA #$42,X; STA #$57,X"
03159C  func  barney_bystander_setup
comment barney_bystander_setup Sets the bystander up facing left, out of the enemy count.
# 0315B3 "LDA <$16; BITA #$7F", barney_animations, "LDD <$AC; CMPD #$0270", "LDA #$FD; STA #$02,X"
0315B3  func  barney_bystander_pose
comment barney_bystander_pose Every 128 frames shows the bystander's next pose from barney_animations; when the scroll reaches 0270 it leaves (step FD).
# action 19's handler is 0315E0 "RTS" (030003)

# ---- 4F80 type 21, kind 8A (0315ED-0316BF) ----
# steps FE and FF (7F82 entries -2, -1: 75ED "LDU #$7F8E; LDA #$28,X": 75F6 7607)
0315ED  func  woman_in_green_carrier_hurt
comment woman_in_green_carrier_hurt The carrier when hit or when it has set its goon down (steps FE, FF), by field 28: it runs off.
# 0315F6 "LDA #$82; STA #$05,X; LDD #$0200; STD #$0F,X; LBRA $85C6"
0315F6  func  woman_in_green_carrier_run_off
comment woman_in_green_carrier_run_off Sends the carrier running off to the right.
# 031607 "RTS"
031607  func  woman_in_green_carrier_running
comment woman_in_green_carrier_running The carrier running off: nothing to do until it leaves the screen.
# 031608 "LDU #$7F92; LBSR $85AB; DEC #$42,X; LDD #$FE00; STD #$0F,X"
031608  func  woman_in_green_carrier_setup
comment woman_in_green_carrier_setup Sets the carrier up out of the enemy count, coming in from the right.
# 03161B "LDY #$7F98; LBSR $862C" (0000 0000 30 01 06 17: 5280 type 17 in state 06), "STU #$40,X", failing "LDD #$FE00;
# STA #$02,X; STB #$28,X"
03161B  func  woman_in_green_carrier_pick_up
comment woman_in_green_carrier_pick_up Puts in the goon it carries (5280 type 17) and walks in with it; with no free slot it runs off.
# 03164B "LDU #$40,X; LDA #$02,U; BPL" (else "LDA #$05; STA #$02,X"), the goon on it: "STD #$0C,U", "SUBD #$0004; STD
# #$11,U", "ADDD #$0040; STD #$16,U"
03164B  func  woman_in_green_carrier_carry
comment woman_in_green_carrier_carry Keeps the goon on the carrier's back while it walks in; when its walk is over it stops; if the goon is hit the carrier lets it go.
# 031690 "LDA #$84; STA #$05,X; LDU #$40,X; LDA #$02; STA #$02,U"
031690  func  woman_in_green_carrier_set_down
comment woman_in_green_carrier_set_down Plays the carrier setting the goon down and lets the goon fight (its step 2).
# 0316A1 "LDA #$06,X; LSRA; BCC; LDA #$83; STA #$05,X"
0316A1  func  woman_in_green_carrier_straighten
comment woman_in_green_carrier_straighten When that animation ends, plays animation 83.
# 0316B0 "LDA #$06,X; LSRA; BCC", "LDD #$80FE; STA #$00,X; STB #$02,X; CLR #$28,X"
0316B0  func  woman_in_green_carrier_done
comment woman_in_green_carrier_done When that animation ends, sends the carrier off (step FE).

# ======== bank 19 ========

032000  file  objects/bank_entries    # (bank 19's entries)
# 4F80 type 30 (F387/F2EC: bank 19, 6000 -> 6B1A "LDU #$7BD6"): setup 7BE2 = 8F00 (robot), scene 9 (stage 7,
# 4F80:30); its behaviour 033B70 (actions 25, 23, 28, 24, 39); after the step, 032B26-032B48: in step 2, state 3,
# animations 87 and 80 "LDD #$2700; LBRA $8680"
032000  func  robot_update
comment robot_update Runs the robot (stage 7) by its step: its setup, the shared enemy steps and its own hit reaction; checks its hits, removes it off screen and plays its footsteps while it walks.
# action 23 (6003 -> 6CD5 "LDU #$7C36"): only the robot's behaviour 033B70 lists it
032003  func  robot_shock_92_action
comment robot_shock_92_action The robot's action 23 by its step: turned to its player, a shock (animation 92) that puts in sparks by robot_sparks_by_frame_92.
# action 24 (6006 -> 6D13 "LDU #$7C70"): 033B70
032006  func  robot_shock_91_action
comment robot_shock_91_action The robot's action 24 by its step: turned to its player, a shock (animation 91) that puts in sparks by robot_sparks_by_frame_91.
# action 25 (6009 -> 6BFF "LDU #$7C04"): 033B70; while field 43 is set it flashes (032C05 "LDA #$43,X; BNE $6C6D")
032009  func  robot_punch_action
comment robot_punch_action The robot's action 25 by its step: two blows on the animation's marked frames, flashing while it cannot be hurt.
# action 28 (600C -> 6B95 "LDU #$7BE8"): 033B70 (its ranges' "28")
03200C  func  robot_combo_action
comment robot_combo_action The robot's action 28 by its step: a pause, two shocks, another pause, a turn and two more shocks.
# action 2A (600F -> 6E33 "LDU #$7D08"): only robot_actions_after_hit leads to it
03200F  func  robot_launch_part_action
comment robot_launch_part_action The robot's action 2A by its step: it sends off one of its parts into the back of the screen.
# 4F80 type 32 (6012 -> 62B0 "LDU #$7A20"): setup 7A32 = A100 (kind A1: assets/sprites/kind_A1.png, hooded figures
# with swords and nunchaku who appear in a puff of smoke: ninjas), scene 9 (stage 7) and bank 15's timed spawns (18
# records); behaviour 033958 (actions 30, 2B, 2E, 32, 2F, 2D); 0322BC "LDA $187E; BEQ", "LDA #$06; STA #$02,X"
032012  func  ninja_update
comment ninja_update Runs a ninja (stage 7) by its step: its setup, its way in, the shared enemy steps; when work RAM 187E is set it vanishes in smoke; checks its hits and removes it off screen.
# action 37 (6015 -> 669A "LDU #$7AAB"): the ninjas' behaviours 033900 and 0339B0
032015  func  ninja_crouch_strike_action
comment ninja_crouch_strike_action The ninjas' action 37 by its step: it crouches for a wait (kind_a1_attack_delays_by_players), then strikes.
# 4D40 type 17 (6018 -> 6E70 "LDU #$7D16"): setup 7D1C = 8F18 (the robot's set, animation 18); the robot's action 2A
# puts it in (032E5A "LDY #$7D10; LBRA $862F": 0000 0000 5C 17)
032018  func  robot_part_update
comment robot_part_update Runs the part the robot sends off by its step: it flies into the back of the screen, shrinking, and goes.
# action 2B (601B -> 6678 "LDU #$7AA3"): the three ninja behaviours; also the follow-up of action 2F (03281B "LDD
# #$2B00; STD #$28,X")
03201B  func  ninja_slash_action
comment ninja_slash_action The ninjas' action 2B by its step: a slash on the animation's marked frame.
# action 2D (601E -> 6608 "LDU #$7A8D"): 033958, 0339B0
03201E  func  ninja_throw_action
comment ninja_throw_action The ninjas' action 2D by its step: it throws a star (4D40 type 19) on the animation's marked frame.
# 4D40 type 19 (6021 -> 662A "LDU #$7A99"): setup 7A9D = A11F (the ninjas' set, animation 1F); the star 032619 throws
# ("LDY #$7A93; LBRA $862F": 0028 0000 18 19)
032021  func  ninja_star_update
comment ninja_star_update Runs a ninja's thrown star by its step; it goes when it hits something, leaves its floor or the screen.
# 5280 type 33 (6027 -> 6A39 "LDU #$7B06"): the robot's 8 pieces (robot_pieces), put in when it is beaten (032E22 "LDY
# #$7CC8" ... "LEAY #$08,Y")
032027  func  robot_piece_update
comment robot_piece_update Runs a piece of the beaten robot by its step: it flies up, falls, bounces once and bursts into sparks.
# action 2E (602A -> 66E8 "LDU #$7ABA"): 033900, 033958
03202A  func  ninja_jump_attack_action
comment ninja_jump_attack_action The ninjas' action 2E by its step: a high jump at the player that strikes on the way down.
# action 2F (602D -> 6790 "LDU #$7AC4"): the three ninja behaviours
03202D  func  ninja_rush_action
comment ninja_rush_action The ninjas' action 2F by its step: it runs at the player and leaps into a slash, bouncing off the screen's edge.
# action 30 (6030 -> 65D6 "LDU #$7A85"): the three ninja behaviours
032030  func  ninja_hop_strike_action
comment ninja_hop_strike_action The ninjas' action 30 by its step: a strike while it hops back.
# 4F80 type 33 (6033 -> 628B "LDU #$7A14"): the ninjas' setup 7A32, behaviour 033900 (actions 30, 2B, 37, 2E, 2F: no
# throws, no vanishing)
032033  func  ninja_fighter_update
comment ninja_fighter_update Runs a ninja that only fights hand to hand (stage 7) by its step; checks its hits and removes it off screen.
# 5280 type 39 (6036 -> 6EDB "LDU #$7D52"): setup 7D62 = 120C (kind 12: assets/sprites/channel_6_scenery.png, pieces of walls,
# doors and floors), scene 9 (stage 7, 5280:39); it moves down (19 = FF00) bringing two goons (4F80 type 13: 032F1E
# "LDY #$7D78", 032F24 "LDY #$7D80"), then back up
032036  func  goon_lift_update
comment goon_lift_update Runs stage 7's lift that brings two goons down by its step; removed off screen.
# 5280 type 3A (6039 -> 6F91 "LDU #$7D88"): setup 7D90 = 1201 (kind 12); the two parts the lift puts in (032EF7 "LDY
# #$7D68", 032EFD "LDY #$7D70")
032039  func  goon_lift_part_update
comment goon_lift_part_update Runs a part of stage 7's lift by its step: it changes its look at the lift's steps; removed off screen.
# action 32 (603C -> 685C "LDU #$7ACC"): only 033958 (type 32's)
03203C  func  ninja_vanish_action
comment ninja_vanish_action The ninjas' action 32 by its step: it vanishes in a puff of smoke, moves hidden toward the player and appears again.
# 5280 type FB (603F -> 6060 "LDU #$78B8"): setup 78CE = 0512 (kind 05, the props' set); bank 15's stage event puts in
# two (02AD2A "LDY #$79C5", 02AD3C "LDY #$79CD": 5280 type FB, states 40 and C0)
03203F  func  bouncing_prop_update
comment bouncing_prop_update Runs a kind 05 prop a stage event drops in by its step: it moves at the players, bounces away when hit and goes after its third landing; removed off screen.
# 5280 type F6 (6042 -> 6AF1 "LDU #$7BC8"): setup 7BD0 = 0402 (hit_sparks), the robot's sparks (robot_sparks_by_frame_*)
032042  func  robot_spark_update
comment robot_spark_update Runs a spark of the robot's shock by its step: it lasts the frames hit_spark_times gives by its state.
# 5280 type F5 (6045 -> 68DB "LDU #$7AEC"): setup 7B00 = 0400 (hit_sparks' set); what robot piece 0 turns into when it
# bursts (032ADF "LDD #$F500; STD #$01,X; LDD #$0420; STD #$04,X")
032045  func  robot_scrap_update
comment robot_scrap_update Runs the scrap the beaten robot leaves on the floor by its step: it lies there, can be carried, thrown or dropped, and bursts when it hits something or lands; removed off screen.
# 4F80 type 3D (6048 -> 6266 "LDU #$7A08"): the ninjas' setup 7A32, behaviour 0339B0 (actions 30, 2B, 37, 2F, 2D:
# throws stars, no vanishing)
032048  func  ninja_thrower_update
comment ninja_thrower_update Runs a ninja that throws stars (stage 7) by its step; checks its hits and removes it off screen.
# 4F80 type FD (604B -> 6FE9 "LDU #$7E0E"): setup 7E1A = B700 (kind B7: assets/sprites/kind_B7.png, a donut with arms
# and legs), scene 8 (stage 6, 4F80:FD); behaviour 033DB6 (actions 3A, 3B)
03204B  func  donut_update
comment donut_update Runs a walking donut (stage 6) by its step: its setup, its way in, the shared enemy steps; checks its hits and removes it off screen.
# 4F80 type FC (604E -> 71FD "LDU #$7E7C"): setup 7EB7 = B800 (kind B8), scene 8 only (stage 6, 4F80:FC states 0, 2, 4, 6;
# scene 9's FC is 5280's, bank 17's);
# it leaps in, flies around a player and throws (5280 type F3)
03204E  func  flying_saxophone_update
comment flying_saxophone_update Runs the flying kind B8 thrower (stage 6) by its step; checks its hits.
# action 39 (6051 -> 6C83 "LDU #$7C10"): 033B70 (the robot's)
032051  func  robot_advance_shock_action
comment robot_advance_shock_action The robot's action 39 by its step: it steps forward with a shock (animation 9D) that puts in sparks by robot_sparks_by_frame_9d.
# action 3A (6054 -> 7157 "LDU #$7E4A"): only the donut's behaviour 033DB6
032054  func  donut_roll_action
comment donut_roll_action The donut's action 3A by its step: it rolls at the player fast for 32 frames.
# action 3B (6057 -> 71A4 "LDU #$7E50"): 033DB6
032057  func  donut_throw_action
comment donut_throw_action The donut's action 3B by its step: it throws a small donut (5280 type DE) on the animation's marked frame.
# 5280 type DE (605A -> 71CF "LDU #$7E5E"): setup 7E62 = B712 (kind B7, animation 12); 0331BF "LDY #$7E56; LBRA $862C"
# (0008 0000 18 01 00 DE)
03205A  func  donut_shot_update
comment donut_shot_update Runs what the donut throws by its step: it flies straight, fast; removed off screen.
# 5280 type F3 (605D -> 762D "LDU #$7FD5"): setup 7FDD = B800 (kind B8); flying_saxophone_volley_shots and flying_saxophone_single_shots
# (5280 type F3, states 0-5)
03205D  func  flying_saxophone_shot_update
comment flying_saxophone_shot_update Runs what the kind B8 flyer throws by its step: thrown up, it falls and bursts where it lands.

# ---- 5280 type FB: the bouncing prop (03206B-032242) ----
03206B  file  objects/bouncing_prop    # the kind 05 prop a stage event drops in (5280 type FB)
# 03206B "LDA #$37,X; BNE", "LDU #$2A,X; LDA #$00,U; BNE", "INC #$37,X"
03206B  func  bouncing_prop_check_owner
comment bouncing_prop_check_owner Marks the prop done (field 37) once the object in field 2A has gone.
# step FE (78B8 entry -2: 607C "LDU #$78C6; LDB #$29,X": 6085 609A 60C9 60EA)
03207C  func  bouncing_prop_leave
comment bouncing_prop_leave The prop leaving (step FE), by field 29: it flies off into the distance.
# 032085 "LDD #$4040; STD #$0A,X", speeds cleared, "LDD #$0200; STD #$19,X", into 03209A
032085  func  bouncing_prop_leave_start
comment bouncing_prop_leave_start Stops the prop at its plain size and throws it up.
# 03209A "CMPD #$0040" on 16, "LDD <$AC; CMPD #$03A2; BHI", "LDA #$94", "LDD #$0100; STD #$14,X; LDA #$40; STA #$3B,X";
# else "LDA #$95; LDA #$03; STA #$29,X"
03209A  func  bouncing_prop_fly_away
comment bouncing_prop_fly_away Once high enough, sends the prop flying into the back for 64 frames; past scroll 03A2 it just rises out of the screen.
# 0320C9 "SUBD #$0010" on 19, "DEC #$3B,X; BNE; CLR #$00,X", "ADDD #$0303" on 0A
0320C9  func  bouncing_prop_shrink_away
comment bouncing_prop_shrink_away Slows the prop's rise and grows its zoom as it goes away, then frees its slot.
# 0320EA "CMPD #$00F0; BCS; CLR #$00,X"
0320EA  func  bouncing_prop_rise_out
comment bouncing_prop_rise_out Frees the prop's slot once it has risen out of the screen.
# 0320F6 "CLRW #$0F,X; CLRW #$14,X; LDA #$80; STA #$00,X; LDA #$02; STA #$02,X"
0320F6  func  bouncing_prop_stop
comment bouncing_prop_stop Stops the prop, unhittable, and sends it back to moving at the players.
# 032107 "LDD #$0200; STD #$0F,X" (one way at random), into 032115
032107  func  bouncing_prop_knocked
comment bouncing_prop_knocked Sends the hit prop off one way at random.
# 032115 "LDD <$AC; CMPD #$03A2; BHI", "LDA #$93", "LDY #$78AC; LBSR $85B4", "LDD #$FF00; STD #$19,X; LDA #$05; STA
# #$02,X"; past 03A2 "LDA #$FE; STA #$02,X"
032115  func  bouncing_prop_bounce_start
comment bouncing_prop_bounce_start Starts the prop's bounce (step 5) with its bouncing hit box; past scroll 03A2 it leaves instead.
# 032148 "LDU #$78CE; LBSR $85AB", "LDA #$03; STA #$3C,X", "LDD #$0200; STD #$19,X; LDD #$FFFF; STD #$0A,X", "LDA
# #$FF; STA #$02,X"
032148  func  bouncing_prop_setup
comment bouncing_prop_setup Sets the prop up with three bounces, thrown up big from the back, falling in (step FF).
# step FF (78B8 entry -1: 6178): "SUBD #$0010", "LBSR $8662; BCC", "LDA #$C0; STA #$00,X; LDA #$01; STA #$02,X"; 032194
# "SUBD #$0808; CMPD #$4040"
032178  func  bouncing_prop_fall_in
comment bouncing_prop_fall_in Pulls the prop down, shrinking it to its plain size, until it lands; then it can be hit and moves at the players.
# 0321A8 "LDA #$58,X; BNE", "LDA <$16; BITA #$3F", "LBSR $8620", "CMPD #$0040", "LDB #$30,X; LBSR $8671; LDB #$10;
# LBSR $8617", "LBSR $863B"; "LDA #$37,X; BEQ", "LDA #$FE; STA #$02,X"
0321A8  func  bouncing_prop_follow
comment bouncing_prop_follow Every 64 frames sets the prop moving slowly at the nearest player unless it is close; stops it at the floor's edge; once done (field 37) it leaves.
# step 5 (78B8 entry 5: 6203 "LDU #$78D4; LDB #$29,X": 620C 6242)
032203  func  bouncing_prop_bounce
comment bouncing_prop_bounce The prop's bounce (step 5), by field 29.
# 03220C "SUBD #$0060; CMPD #$0100", "NEGW #$0F,X; LDD #$0180; STD #$19,X", "LDA #$95", "LDY #$78A4; LBRA $85B4"; else
# "ADDD #$0018" on 19, "LBRA $8674"
03220C  func  bouncing_prop_bounce_off_edge
comment bouncing_prop_bounce_off_edge Moves the knocked prop; at the screen's edge it bounces back up with its hit box.
# 032242 "LBSR $85B1; BCC", "DEC #$3C,X; BNE", "LDA #$01; STA #$37,X", "LDA #$92", "LDA #$02; STA #$02,X"
032242  func  bouncing_prop_land
comment bouncing_prop_land Pulls the prop down; when it lands, counts a bounce: after the third it is done, otherwise it can be hit again and moves at the players.

# ---- the ninjas: 4F80 types 32, 33, 3D (032272-0326DE) and their star ----
032272  file  enemies/ninja    # stage 7's ninjas (types 32, 33, 3D), their way in, their actions and their star
# 032272 "LDU #$7A32; LBSR $85AB; LDU #$79B0; STU #$2A,X", "ORA #$86" on 09, "LBRA $630D"
032272  func  ninja_thrower_setup
comment ninja_thrower_setup Sets a star-throwing ninja up with its behaviour ninja_thrower_behaviour.
# 032297 "LDU #$7A32; LBSR $85AB; LDU #$7900; STU #$2A,X", "LBRA $630D"
032297  func  ninja_fighter_setup
comment ninja_fighter_setup Sets a hand-to-hand ninja up with its behaviour ninja_fighter_behaviour.
# step 6 (7A20 entry 6: 62E5 "LDU #$7A2E; LDA #$29,X": 62EE 62F7)
0322E5  func  ninja_leave
comment ninja_leave The ninja called away (step 6), by field 29: it vanishes in smoke.
# 0322EE "LDA #$95; STA #$05,X; INC #$29,X"
0322EE  func  ninja_leave_start
comment ninja_leave_start Plays the ninja vanishing in a puff of smoke.
# 0322F7 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
0322F7  func  ninja_leave_end
comment ninja_leave_end Frees the ninja's slot when the smoke ends.
# 032301 "LDU #$7A32; LBSR $85AB; LDU #$7958; STU #$2A,X", into 03230D
032301  func  ninja_setup
comment ninja_setup Sets a ninja of type 32 up with its behaviour ninja_behaviour.
# 03230D "LDA #$01; STA #$42,X", "LBSR $8620; LBSR $8626", "LDA #$01; STA #$43,X; LDA #$10; STA #$3A,X", state 0: "CLR
# #$30,X; LDA #$02; STA #$02,X"
03230D  func  ninja_setup_common
comment ninja_setup_common The ninjas' common setup: turned to the nearest player; state 0 fights at once, the others stay hidden for their way in.
# step 1 (7A08/7A14/7A20 entry 1: 6339 "LDU #$7A38; LDA #$29,X")
032339  func  ninja_come_in
comment ninja_come_in The ninja's way in, by field 29 (kind_a1_entrance_steps gives the step it starts at).
# 032342 "LDU #$7A72; LDA #$30,X; LDA A,U; STA #$29,X; CLR #$30,X"
032342  func  ninja_choose_entrance
comment ninja_choose_entrance Takes the step the ninja's way in starts at from kind_a1_entrance_steps by its state.
# 032351 "LDA #$C0; STA #$00,X; LDA #$30; STA #$3B,X; LDA #$90", "LDD #$0200; STD #$0F,X" toward its player
032351  func  ninja_run_in
comment ninja_run_in Shows the ninja running in at its player for 48 frames.
# 032376 "DEC #$3B,X; BNE; INC #$02,X"
032376  func  ninja_run_in_end
comment ninja_run_in_end Counts the run down, then lets the ninja fight.
# 03237F "LDA #$80; STA #$00,X; LDA #$96", "LDD #$6C00; LBRA $8680"
03237F  func  ninja_appear
comment ninja_appear Shows the ninja appearing in a puff of smoke, with its sound.
# 032392 "LDA #$06,X; LSRA; BCC; LDA #$C0; STA #$00,X; INC #$02,X"
032392  func  ninja_appear_end
comment ninja_appear_end When the smoke ends, makes the ninja hittable and lets it fight.
# 0323A1 "LDA #$A6", "LDD #$0100; STD #$19,X; LDA #$80; STA #$3B,X"
0323A1  func  ninja_drop_in
comment ninja_drop_in Shows the ninja coming down from the top, slowly, for 128 frames.
# 0323C4 "DEC #$3B,X", "LDD #$FE00; STD #$14,X; LDD #$0100; STD #$19,X; LDA #$84"
0323C4  func  ninja_drop_forward
comment ninja_drop_forward Counts down, then moves the dropping ninja toward the front.
# 0323E8 "SUBD #$0020", "LBSR $8662; BCC", "LDA #$C0; STA #$00,X; CLRW #$14,X; INC #$02,X"; 032402 the floor under it
# ("LBSR $8638 ... STA #$5D,X")
0323E8  func  ninja_drop_land
comment ninja_drop_land Pulls the ninja down onto the floor under it; when it lands it can be hit and fights.
# 03241A "LDA #$84", "LDD #$0600; STD #$19,X"
03241A  func  ninja_leap_in
comment ninja_leap_in Shows the ninja leaping in high from behind.
# 032438 "LDD #$FE00; STD #$14,X", into 03243E
032438  func  ninja_leap_forward
comment ninja_leap_forward Moves the leaping ninja toward the front.
# 03243E "LBSR $8638", "CMPA #$17,X; BCC", "STA #$5D,X; LDA #$88; STA #$00,X"
03243E  func  ninja_leap_find_floor
comment ninja_leap_find_floor Takes the floor under the leaping ninja once it is below its height.
# 032465 "CLRW #$14,X", into 032468
032465  func  ninja_leap_stop_forward
comment ninja_leap_stop_forward Stops the ninja's move toward the front and lets it fall.
# 032468 "SUBD #$0020", "LBSR $8662; BCC", "LDA #$9E; STA #$05,X; LDA #$C0; STA #$00,X; INC #$02,X"
032468  func  ninja_leap_land
comment ninja_leap_land Pulls the ninja down until it lands crouching, then lets it fight.
# 032484 "LDA #$20; STA #$3B,X; LDA #$90", "LDD #$0200; STD #$0F,X" from the side it is on
032484  func  ninja_run_and_jump_in
comment ninja_run_and_jump_in Shows the ninja running in from the side for 32 frames.
# 0324B4 "DEC #$3B,X", "LDD #$0400; STD #$19,X; LDA #$98", "LDD #$0020; STD #$5C,X"
0324B4  func  ninja_jump_onto_ledge
comment ninja_jump_onto_ledge Counts the run down, then jumps the ninja up toward a floor 32 high.
# 0324D1 "CMPD #$0028; LBCS $643E", "LDD #$0400; STD #$14,X"
0324D1  func  ninja_jump_back
comment ninja_jump_back Moves the jumping ninja toward the back once it is high enough.
# 0324E3 "LDA #$06,X; LSRA; BCC", "LDY #$7A7D; LBSR $862C" (0000 0000 00 00 07 32: 4F80 type 32, state 7)
0324E3  func  ninja_split
comment ninja_split When its animation ends, puts in another ninja (type 32, state 7) at its place; with no free slot it fights at once.
# 0324F5 "LDD #$2800; LBSR $8680", "LDA #$40; STA #$3B,X; LDD #$0100; STD #$0F,X"
0324F5  func  ninja_split_move
comment ninja_split_move Moves the ninja right for 64 frames with a sound.
# 03250A "EORA #$84" on 00, "DEC #$3B,X", "LDA #$C0; STA #$00,X; INC #$02,X"
03250A  func  ninja_split_flicker
comment ninja_split_flicker Flickers the ninja in and out of sight, then makes it hittable and lets it fight.
# 032520 "LDA #$80; STA #$00,X; LDA #$97", "LDA #$40; STA #$3B,X; LDD #$FF00; STD #$0F,X; DEC #$29,X"
032520  func  ninja_split_copy
comment ninja_split_copy The ninja put in by another: shows it leaving the first one, moving left, flickering.
# 032539 "LDA #$08; STA #$3B,X"
032539  func  ninja_wait_to_step_out
comment ninja_wait_to_step_out Waits 8 frames.
# 032542 "DEC #$3B,X", "LDA #$80; STA #$00,X; LDA #$81", "LDD #$FF00; STD #$14,X"
032542  func  ninja_step_out
comment ninja_step_out Counts down, then shows the ninja walking toward the front.
# 03255B "LBSR $8638; TSTA; BMI", "LDA #$C0; STA #$00,X; INC #$02,X"
03255B  func  ninja_step_out_end
comment ninja_step_out_end Once the ninja is on a floor, makes it hittable and lets it fight.
# 03256B "LDA #$C0; STA #$00,X; LDA #$03; STA #$3C,X; LDA #$A2", "LDD #$0200; STD #$0F,X" toward its player
03256B  func  ninja_dash_in
comment ninja_dash_in Shows the ninja dashing in at its player for three runs of its animation.
# 032590 "LDA #$06,X; LSRA; BCC; DEC #$3C,X; BNE; CLRW #$0F,X; INC #$02,X"
032590  func  ninja_dash_in_end
comment ninja_dash_in_end Counts the dash's runs down, then stops the ninja and lets it fight.
# 0325A2 "LDA #$C8; STA #$00,X; LDA #$84", "LBSR $8620; LBSR $8626", "LBSR $8638 ... STA #$5D,X", "LBRA $85C9"
0325A2  func  ninja_fall_in
comment ninja_fall_in Shows the ninja falling in, facing the nearest player, onto the floor under it.
# 0325C4 "SUBD #$0020", "LBSR $8662; BCC; INC #$02,X"
0325C4  func  ninja_fall_in_land
comment ninja_fall_in_land Pulls the ninja down until it lands, then lets it fight.
# action 30's steps (table 7A85: 65DC 65E7 66D5 66DE)
# 0325DC "LDA #$99; STA #$05,X; INC #$29,X; LBRA $859C"
0325DC  func  ninja_hop_strike_start
comment ninja_hop_strike_start Starts the ninja's strike, turned to its player.
# 0325E7 "BITA #$02", "LDD #$0200; STD #$0F,X" away from where it faces, "LDY #$78E8; LBRA $85B4"
0325E7  func  ninja_hop_strike_hit
comment ninja_hop_strike_hit On the marked frame, hops the ninja back with its attacking hit box.
# action 2D's steps (table 7A8D: 660E 6619 66DE)
# 03260E "LDA #$92; STA #$05,X; INC #$29,X; LBRA $859C"
03260E  func  ninja_throw_start
comment ninja_throw_start Starts the ninja's throw, turned to its player.
# 032619 "BITA #$02", "LDY #$7A93; LBRA $862F"
032619  func  ninja_throw_release
comment ninja_throw_release On the marked frame, puts in the star (4D40 type 19).
# 032651 "LDU #$7A9D; LBSR $85AB", "LDA #$47,X; BMI; ANDA #$0F; ASLA x3; STA #$5D,X", "LDD #$0400; STD #$0F,X"
032651  func  ninja_star_setup
comment ninja_star_setup Sets the star up on its thrower's floor, flying fast the way it faces.
# 032677 "RTS"
032677  func  ninja_star_fly
comment ninja_star_fly The star's flight: nothing to do, it moves by its speed.
# action 2B's steps (table 7AA3: 667E 6689 66D5 66DE)
# 03267E "LDA #$91; STA #$05,X; INC #$29,X; LBRA $859C"
03267E  func  ninja_slash_start
comment ninja_slash_start Starts the ninja's slash, turned to its player.
# 032689 "BITA #$02", "LDY #$78E8; LBRA $85B4"
032689  func  ninja_slash_hit
comment ninja_slash_hit On the marked frame, gives the ninja its attacking hit box.
# action 37's steps (table 7AAB: 66A0 66B4 66C4 66D5 66DE)
# 0326A0 "LDA #$A7", kind_a1_attack_delays_by_players
0326A0  func  ninja_crouch
comment ninja_crouch Shows the ninja crouching for the wait kind_a1_attack_delays_by_players gives.
# 0326B4 "DEC #$3B,X", "LDA #$A4; STA #$05,X; INC #$29,X; LBRA $859C"
0326B4  func  ninja_crouch_strike_start
comment ninja_crouch_strike_start Counts the crouch down, then starts the strike, turned to its player.
# 0326C4 "BITA #$02", "LDY #$78F8; LBRA $85B4"
0326C4  func  ninja_crouch_strike_hit
comment ninja_crouch_strike_hit On the marked frame, gives the ninja its low attacking hit box.
# 0326D5 "LDY #$78D8; LBSR $85B4", into 0326DE (the end of actions 30, 2B, 2D, 37)
0326D5  func  ninja_attack_recover
comment ninja_attack_recover Gives the ninja back its plain hit box and ends the action when the attack ends.
# 0326DE "LDA #$06,X; LSRA; BCC; LBRA $8635"
0326DE  func  ninja_attack_end
comment ninja_attack_end Ends the ninja's action when its animation ends.
# action 2E's steps (table 7ABA: 66EE 670B 6730 6743 6773)
# 0326EE "LDA #$9A", "LBSR $859C; LDU #$38,X; LBSR $8626; LDA #$36,X; STA #$35,X; LDA #$02; STA #$3C,X"
0326EE  func  ninja_jump_attack_start
comment ninja_jump_attack_start Crouches the ninja, turned to its player, keeping the direction to jump in.
# 03270B "LDA #$06,X; LSRA; BCC", "LDA #$98", "LDD #$0100; STD #$0F,X", "LDD #$0600; STD #$19,X"
03270B  func  ninja_jump_attack_take_off
comment ninja_jump_attack_take_off When the crouch ends, jumps the ninja high toward its player.
# 032730 "DEC #$3C,X" on each end of the animation, then "LDA #$9C"; into 032743
032730  func  ninja_jump_attack_spin
comment ninja_jump_attack_spin Plays the jump's somersault twice, then the dive.
# 032743 "SUBD #$5C,X; CMPD #$0004", "LDA #$9D", "LDY #$78D8"; "BITA #$02", "LDY #$78F0; LBSR $85B4"; "SUBD #$0020"
032743  func  ninja_jump_attack_dive
comment ninja_jump_attack_dive Pulls the diving ninja down, with its attacking hit box on the marked frame; near the floor it lands.
# 032773 "SUBD #$0010", into 032779
032773  func  ninja_jump_attack_fall
comment ninja_jump_attack_fall Pulls the ninja down slowly.
# 032779 "LBSR $8662; BCC", "LDY #$78D8; LBSR $85B4; LDA #$9D; STA #$05,X; LBRA $8635"
032779  func  ninja_jump_attack_land
comment ninja_jump_attack_land When the ninja lands, gives it back its plain hit box and ends the action.
# action 2F's steps (table 7AC4: 6796 67E2 680A 6852)
# 032796 "SUBD #$0040; CMPD #$0140" (3D: near the screen's edge), "CMPD #$0080" on 2C: "LDA #$98 ... LDD #$0500; STD
# #$19,X; LDA #$02; STA #$29,X" else "LDA #$A2"; "LDD #$0200; STD #$0F,X"; "LDA #$03; STA #$3B,X"
032796  func  ninja_rush_start
comment ninja_rush_start Near its player leaps at him at once; otherwise starts running at him.
# 0327E2 "LDA #$06,X; LSRA; BCC", "CMPD #$0080" on 2C, "LDD #$0500; STD #$19,X; LDA #$98"; "DEC #$3B,X; ... LDA #$03;
# STA #$29,X"
0327E2  func  ninja_rush_run
comment ninja_rush_run Runs the ninja at its player; once near, leaps at him; after three runs of the animation gives up.
# 03280A "SUBD #$0020", "LBSR $8662", "LDD #$2B00; STD #$28,X"; near the edge "NEGW #$0F,X; LDD #$0200; STD #$19,X; LDA
# #$84", "LDY #$78F0; LBSR $85B4", "INC #$3D,X"
03280A  func  ninja_rush_leap
comment ninja_rush_leap Pulls the leaping ninja down; it bounces once off the screen's edge, and when it lands it goes on with a slash (action 2B).
# 032852 "LDA #$06,X; LSRA; BCC; LBRA $8635"
032852  func  ninja_rush_end
comment ninja_rush_end Ends the ninja's action when its animation ends.
# action 32's steps (table 7ACC: 6862 686B 6881 68A5 68C1 68D1)
# 032862 "LDA #$95; STA #$05,X; INC #$29,X"
032862  func  ninja_vanish_start
comment ninja_vanish_start Starts the ninja vanishing in smoke.
# 03286B "BITA #$02", "LDA #$80; STA #$00,X", "LDD #$6C00; LBRA $8680"
03286B  func  ninja_vanish_puff
comment ninja_vanish_puff On the marked frame, makes the ninja unhittable with the smoke's sound.
# 032881 "LDA #$04; STA #$00,X", "LDD #$0200; STD #$0F,X" toward its player, "LDA #$40; STA #$3B,X"
032881  func  ninja_vanish_move
comment ninja_vanish_move When the smoke ends, hides the ninja and moves it toward its player for 64 frames.
# 0328A5 "DEC #$3B,X", "CLRW #$0F,X; LDA #$80; STA #$00,X; LDA #$96", "LDD #$6C00; LBRA $8680"
0328A5  func  ninja_vanish_reappear
comment ninja_vanish_reappear Counts the move down, then shows the ninja appearing in smoke, with its sound.
# 0328C1 "BITA #$02", "LDA #$C0; STA #$00,X"
0328C1  func  ninja_vanish_solid
comment ninja_vanish_solid On the marked frame, makes the ninja hittable again.
# 0328D1 "LDA #$06,X; LSRA; BCC; LBRA $8635"
0328D1  func  ninja_vanish_end
comment ninja_vanish_end Ends the action when the appearing animation ends.

# ---- 5280 type F5: the robot's scrap (0328F8-032A38) ----
0328F8  file  objects/robot_scrap    # what the beaten robot leaves on the floor (5280 type F5)
# 0328F8 "LDA #$02,X; CMPA #$05", "BITA #$20", "LDD #$FF00; STA #$02,X; STB #$28,X"
0328F8  func  robot_scrap_check_hit
comment robot_scrap_check_hit While the scrap flies (step 5), sends it into its burst (step FF) when it hits something.
# steps FE and FF (7AEC entries -2, -1: 6910 "LDU #$7AFC; LDA #$28,X": 6919 6930)
032910  func  robot_scrap_burst
comment robot_scrap_burst The scrap's burst (steps FE, FF), by field 28.
# 032919 "LDA #$80; STA #$00,X; CLRW #$0F,X; LDD #$0080; STD #$19,X; LDA #$80; STA #$05,X"
032919  func  robot_scrap_burst_start
comment robot_scrap_burst_start Stops the scrap, pops it up a little and plays its burst.
# 032930 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
032930  func  robot_scrap_remove
comment robot_scrap_remove Frees the scrap's slot when its burst ends.
# 03293A "LDU #$7B00; LBSR $85AB", "LDA #$30,X; ORA #$80; STA #$05,X", "INC #$31,X"
03293A  func  robot_scrap_setup
comment robot_scrap_setup Sets the scrap up with its animation from its state, held where it lies (field 31).
# 03294F "RTS" (steps 1 and 2)
03294F  func  robot_scrap_lie
comment robot_scrap_lie The scrap lying or carried: nothing to do here.
# 032950 "CLR #$31,X; LDD #$0180; STA #$3D,X; STB #$00,X; DEC #$02,X"
032950  func  robot_scrap_pick_up
comment robot_scrap_pick_up Marks the scrap carried by its holder (field 3D), unhittable.
# 032960 "LDA #$80; STA #$00,X; CLR #$3D,X", next animation, "LDY #$7AE0; LBSR $85B4", "LBSR $85C6; LBRA $8674"
032960  func  robot_scrap_throw
comment robot_scrap_throw Lets the thrown scrap fly with its hit box, facing the way it goes.
# 03297D "RTS" (step 5)
03297D  func  robot_scrap_fly
comment robot_scrap_fly The scrap flying: nothing to do, it moves by its speed.
# 032980 "LDA #$88; STA #$00,X; LDD #$0800; STD #$19,X", the floor under it, next animation
032980  func  robot_scrap_drop
comment robot_scrap_drop Pops the dropped scrap up toward the floor under it.
# 0329A4 "LBSR $85B1; BCC; LDD #$FF00; STA #$02,X; STB #$28,X"
0329A4  func  robot_scrap_drop_land
comment robot_scrap_drop_land Pulls the dropped scrap down; it bursts when it lands.
# 0329CA "LDA #$31,X; BNE", "LDA #$3D,X; BNE $69B3" (0329B3 "LDU #$40,X; LDA #$09,U; ANDA #$30" into field 09), floor checks ("LBSR $8638", "LBSR $863B"), "LDA #$FE; STA #$02,X"
0329CA  func  robot_scrap_keep_on_floor
comment robot_scrap_keep_on_floor Keeps the scrap on the floor under it (or with its holder's priority while carried); off any floor, or under a higher one, it bursts.

# ---- 5280 type 33: the robot's pieces, sparks, and the robot itself (032A3F-032EB4) ----
032A3F  file  enemies/robot    # stage 7's robot (type 30), its actions, its pieces, sparks and launched part
# 032A3F "LDU #$7B00; LBSR $85AB", "LDA #$8F; STA #$04,X", robot_pieces by its state, "LDB #$20; LBSR $8617"
032A3F  func  robot_piece_setup
comment robot_piece_setup Sets a robot piece up, hidden, with its rise, wait, animation and direction from robot_pieces.
# 032A75 "DEC #$3B,X; BNE; LDA #$88; STA #$00,X"
032A75  func  robot_piece_wait
comment robot_piece_wait Counts the piece's wait down, then shows it.
# 032A83 "SUBD #$0040", "LBSR $8662", "LDD #$0200; STD #$19,X", "BRA $6ABD"
032A83  func  robot_piece_fall
comment robot_piece_fall Pulls the piece down; when it lands it bounces once.
# 032A9C "SUBD #$0030", "LBSR $8662", "LDA #$04; STA #$04,X; LDA #$80; STA #$05,X"
032A9C  func  robot_piece_bounce
comment robot_piece_bounce Pulls the bouncing piece down; when it lands it stops and turns into sparks.
# 032ABD "LBSR $8644; TSTA; BPL; NEGW #$0F,X", "LBSR $8647; TSTA; BPL; NEGW #$14,X"
032ABD  func  robot_piece_bounce_off_walls
comment robot_piece_bounce_off_walls Turns the piece's speeds back where it meets the stage's edges.
# 032AD0 "LDA #$06,X; LSRA; BCC", "LDA #$30,X; BEQ", "CLR #$00,X"; state 0: "LDD #$F500; STD #$01,X; LDD #$0420; STD #$04,X"
032AD0  func  robot_piece_burst
comment robot_piece_burst When the sparks end, frees the piece's slot; piece 0 becomes the scrap the robot leaves (type F5).
# 032AF7 "LDU #$7BD0; LBSR $85AB; LDA #$40; STA #$00,X", hit_spark_times by its state
032AF7  func  robot_spark_setup
comment robot_spark_setup Sets the spark up with the time it lasts from hit_spark_times.
# 032B11 "DEC #$3B,X; BNE; CLR #$00,X"
032B11  func  robot_spark_fade
comment robot_spark_fade Counts the spark's time down and frees its slot.
# 032B4C "LDU #$7BE2; LBSR $85AB", "LDA <$57; LSRA; BCC; LDA #$30; STA #$1B,X", "LDU #$7B70; STU #$2A,X", "LDA #$01;
# STA <$80", "LDD #$9B00; LBRA $8689"
032B4C  func  robot_setup
comment robot_setup Sets the robot up with its behaviour robot_behaviour (less vitality with 1 or 3 players), turned to its player, fighting at once; sets direct page 80 and starts its music.
# action 28's steps (table 7BE8: 6B9B 6BAE 6CDE 6CE7 6D1C 6D25 6BBC 6BAE 6BCF 6CDE 6CE7 6D1C 6D25 6C4B)
# 032B9B "LDA #$8B; STA #$05,X; LDA #$40; STA #$3B,X", "LDD #$2700; LBRA $8680"
032B9B  func  robot_combo_wind_up
comment robot_combo_wind_up Plays the robot's wind-up for 64 frames, with a sound.
# 032BAE "DEC #$3B,X; BNE; LDA #$C0; STA #$00,X; INC #$29,X"
032BAE  func  robot_combo_ready
comment robot_combo_ready Counts the wind-up down, then makes the robot hittable.
# 032BBC "LDA #$8B; STA #$05,X; LDA #$20; STA #$3B,X", "LDD #$2700; LBRA $8680"
032BBC  func  robot_combo_pause
comment robot_combo_pause Plays the robot's wind-up again for 32 frames, with a sound.
# 032BCF "LDA #$09,X; ANDA #$7F; EORA #$40", "LDA #$06,X; ORA #$80"
032BCF  func  robot_combo_turn
comment robot_combo_turn Turns the robot round.
# action 25's steps (table 7C04: 6C0B 6C17 6C28 6C31 6C42 6C4B)
# 032C0B "LBSR $859C; LDA #$90; STA #$05,X"
032C0B  func  robot_punch_start
comment robot_punch_start Starts the robot's blows, turned to its player.
# 032C17 "BITA #$02", "LDY #$7B40; LBRA $85B4"
032C17  func  robot_punch_first_hit
comment robot_punch_first_hit On the first marked frame, gives the robot its first attacking hit box.
# 032C28 "LDY #$7B38; LBSR $85B4", into 032C31
032C28  func  robot_punch_recover
comment robot_punch_recover Gives the robot back its plain hit box.
# 032C31 "BITA #$02", "LDY #$7B48; LBRA $85B4"
032C31  func  robot_punch_second_hit
comment robot_punch_second_hit On the next marked frame, gives the robot its second attacking hit box.
# 032C42 "LDY #$7B38; LBSR $85B4", into 032C4B
032C42  func  robot_punch_recover_again
comment robot_punch_recover_again Gives the robot back its plain hit box again.
# 032C4B "LDA #$06,X; LSRA; BCC", into 032C51 (the end of actions 23, 24, 25, 28, 2A, 39)
032C4B  func  robot_attack_end_with_animation
comment robot_attack_end_with_animation Ends the robot's action when its animation ends.
# 032C51 "CLR #$43,X; LDA #$C0; STA #$00,X", field 09 "ANDA #$7F", "LBRA $8635"
032C51  func  robot_attack_end
comment robot_attack_end Ends the robot's action: hittable again, no longer flashing.
# 032C6D "EORA #$80" on 09, "ORA #$80" on 06, "LDA #$C4; STA #$00,X"
032C6D  func  robot_flash
comment robot_flash Flashes the robot a frame, out of the hits' reach.
# action 39's steps (table 7C10: 6C89 6CA5 6C51)
# 032C89 "LBSR $859C; LDA #$9D; STA #$05,X; LDD #$0080; STD #$0F,X"
032C89  func  robot_advance_shock_start
comment robot_advance_shock_start Starts the robot's shock, turned to its player, stepping forward.
# 032CA5 "LDA #$07,X; CMPA #$06 / #$0E", "LDD #$2300; LBSR $8680", "LDY #$7C16; LDA #$07,X; ASLA; LDY A,Y; BMI; LBSR $862C"
032CA5  func  robot_advance_shock_sparks
comment robot_advance_shock_sparks On the shock's marked frames puts in its sparks by robot_sparks_by_frame_9d, with the sound at frames 6 and 0E.
# action 23's steps (table 7C36: 6CDB 6CE7 6C51)
# 032CDB "LBSR $859C", into 032CDE
032CDB  func  robot_shock_92_start
comment robot_shock_92_start Turns the robot to its player and starts the shock.
# 032CDE "LDA #$92; STA #$05,X; INC #$29,X"
032CDE  func  robot_shock_92_begin
comment robot_shock_92_begin Starts the robot's shock (animation 92).
# 032CE7 "LDA #$07,X; CMPA #$06", "LDD #$2300; LBSR $8680", "LDY #$7C3C"
032CE7  func  robot_shock_92_sparks
comment robot_shock_92_sparks On the shock's marked frames puts in its sparks by robot_sparks_by_frame_92.
# action 24's steps (table 7C70: 6D19 6D25 6C51)
# 032D19 "LBSR $859C", into 032D1C
032D19  func  robot_shock_91_start
comment robot_shock_91_start Turns the robot to its player and starts the shock.
# 032D1C "LDA #$91; STA #$05,X; INC #$29,X"
032D1C  func  robot_shock_91_begin
comment robot_shock_91_begin Starts the robot's shock (animation 91).
# 032D25 "LDY #$7C76"
032D25  func  robot_shock_91_sparks
comment robot_shock_91_sparks On the shock's marked frames puts in its sparks by robot_sparks_by_frame_91.
# step 4 (7BD6 entry 4: 6D51 "LDU #$7CAA; LDA #$29,X": 6D60 6D93 6D99 6D9C 6D9F 6DE4 6E06), then "LBSR $85BA; LBRA
# $863E"
032D51  func  robot_hit_reaction
comment robot_hit_reaction The robot's own hit reaction (step 4), by field 29.
# 032D60 "LBSR $6C6D; LDY #$48,X; LBSR $85B4; LDD #$6300; LBSR $8680", "LBSR $85B1", vitality 0: "LDA #$88; ... LDA #$05;
# STA #$29,X", else "LDA #$90"
032D60  func  robot_hit_land
comment robot_hit_land Flashes the hit robot with the hit sound until it lands; beaten, it plays its breaking down, otherwise it strikes back.
# 032D93 "LBSR $6C6D; LBRA $6C17"
032D93  func  robot_hit_strike_back
comment robot_hit_strike_back Flashes the robot while its strike back reaches the first blow.
# 032D99 "LBRA $6C28"
032D99  func  robot_hit_strike_back_recover
comment robot_hit_strike_back_recover The robot's strike back: back to its plain hit box.
# 032D9C "LBRA $6C31"
032D9C  func  robot_hit_strike_back_second
comment robot_hit_strike_back_second The robot's strike back: the second blow.
# 032D9F "LDY #$48,X; LBSR $85B4", "LDA #$C4; STA #$00,X; STA #$43,X", robot_actions_after_hit / robot_status_after_hit
# by "DEC #$3D,X", "LDA #$03; STA #$02,X"
032D9F  func  robot_hit_choose_action
comment robot_hit_choose_action When the strike back ends, takes the robot's next action and status from robot_actions_after_hit and robot_status_after_hit, flashing until it acts.
# 032DE4 "LBSR $6C6D", "LDA #$40; STA #$3B,X"
032DE4  func  robot_break_down
comment robot_break_down Flashes the beaten robot until its breaking down ends, then waits 64 frames.
# 032E06 "LBSR $6C6D; DEC #$3B,X", "BSR $6E17; CLR #$00,X; LBRA $8599"
032E06  func  robot_explode
comment robot_explode Flashes the beaten robot for its wait, then bursts it into pieces and counts it beaten.
# 032E17 "LDD #$6E00; LBSR $8680", "LDA #$08; STA <$F4", "LDY #$7CC8; LBSR $862C", "LEAY #$08,Y"
032E17  func  robot_put_in_pieces
comment robot_put_in_pieces Puts in the robot's 8 pieces (5280 type 33, states 0-7) with the explosion's sound.
# action 2A's steps (table 7D08: 6E39 6E47 6E61 6C4B)
# 032E39 "LDA #$97; STA #$05,X", "LDD #$2700; LBRA $8680"
032E39  func  robot_launch_part_start
comment robot_launch_part_start Starts the robot's launch with a sound.
# 032E47 "LDA #$06,X; LSRA; BCC", "LDA #$C0; STA #$00,X", "LDA #$80; STA #$3B,X", "LDY #$7D10; LBRA $862F"
032E47  func  robot_launch_part_release
comment robot_launch_part_release When that animation ends, makes the robot hittable and sends off its part (4D40 type 17), then waits 128 frames.
# 032E61 "DEC #$3B,X; BNE; INC #$29,X; LDD #$2700; LBRA $8680"
032E61  func  robot_launch_part_wait
comment robot_launch_part_wait Counts the wait down and goes on with a sound.
# 4D40 type 17's steps (table 7D16: 6E76 6E90 6EB4)
# 032E76 "LDU #$7D1C; LBSR $85AB", "LDD #$C0C0; STD #$0A,X; LDA #$20; STA #$3B,X"
032E76  func  robot_part_setup
comment robot_part_setup Sets the launched part up, big, for 32 frames.
# 032E90 "DEC #$3B,X", "LDA #$99", "LDD #$FF80; STD #$14,X; LDA #$30; STA #$3B,X", "LDD #$2300; LBRA $8680"
032E90  func  robot_part_launch
comment robot_part_launch Counts down, then sends the part off into the back with a sound.
# 032EB4 "DEC #$3B,X", "CMPA #$1A; CLRW #$14,X", robot_part_zooms by 3B
032EB4  func  robot_part_fly_away
comment robot_part_fly_away Shrinks the part by robot_part_zooms as it goes, stops it, and frees its slot at the end.

# ---- 5280 types 39, 3A: stage 7's lift (032EE4-032FE8) ----
032EE4  file  objects/goon_lift    # stage 7's lift that brings goons down (5280 types 39 and 3A)
# 032EE4 "LDU #$7D62; LBSR $85AB; LDA #$04; STA #$00,X", "LDY #$7D68; LBSR $862C; LDY #$7D70; LBRA $862C"
032EE4  func  goon_lift_setup
comment goon_lift_setup Sets the lift up hidden and puts in its two parts (type 3A).
# 032F03 "CMPD #$0140; BCC", "LDD #$FF00; STD #$19,X; LDA #$60; STA #$3B,X", "LDY #$7D78; LBSR $862C; LDY #$7D80"
032F03  func  goon_lift_arrive
comment goon_lift_arrive When the scroll brings it on, shows the lift coming down with its two goons (4F80 type 13).
# 032F2B "DEC #$3B,X; BNE; CLRW #$19,X; LDA #$80; STA #$3B,X"
032F2B  func  goon_lift_stop
comment goon_lift_stop Counts the descent down, then stops the lift for 128 frames.
# 032F3C "DEC #$3B,X", "LDD #$FF00; STD #$19,X; LDA #$60; STA #$3B,X"
032F3C  func  goon_lift_descend
comment goon_lift_descend Counts down, then moves the lift down again for 96 frames.
# 032F50 "DEC #$3B,X", "CLRW #$19,X; LDA #$20; STA #$3B,X"
032F50  func  goon_lift_settle
comment goon_lift_settle Counts down, then stops the lift for 32 frames.
# 032F61 "DEC #$3B,X", "LDA #$C0; STA #$00,X; LDA #$60; STA #$3B,X"
032F61  func  goon_lift_open
comment goon_lift_open Counts down, then makes the lift hittable for 96 frames.
# 032F74 "DEC #$3B,X", "LDA #$80; STA #$00,X; LDD #$0100; STD #$19,X"
032F74  func  goon_lift_rise
comment goon_lift_rise Counts down, then sends the lift back up, unhittable.
# 032F88 "DEC #$3B,X; BNE; CLR #$00,X"
032F88  func  goon_lift_remove
comment goon_lift_remove Counts the rise down and frees the lift's slot.
# 032F9A "LDU #$7D90; LBSR $85AB", channel_6_scenery_parts by its state (parent_step, wait, height)
032F9A  func  goon_lift_part_setup
comment goon_lift_part_setup Sets the lift's part up with the lift's step it changes at, its wait and its height from channel_6_scenery_parts.
# 032FC7 "LDU #$40,X; LDA #$02,U; CMPA #$3D,X", "LDA #$82"
032FC7  func  goon_lift_part_wait_for_lift
comment goon_lift_part_wait_for_lift Waits for the lift (field 40) to reach its step, then plays animation 82.
# 032FDB "DEC #$3C,X; BNE; LDA #$8F"
032FDB  func  goon_lift_part_change
comment goon_lift_part_change Counts its wait down, then plays animation 8F.
# 032FE8 "RTS"
032FE8  func  goon_lift_part_idle
comment goon_lift_part_idle The part after its change: nothing to do.

# ---- 4F80 type FD: the donut (032FF5-0331FC) ----
032FF5  file  enemies/donut    # stage 6's walking donut (type FD), its actions 3A and 3B and what it throws
# 032FF5 "LDU #$7E1A; LBSR $85AB", "LDU #$7DB6; STU #$2A,X", state bit 7: "LDA #$04; STA #$00,X; INC #$02,X"
032FF5  func  donut_setup
comment donut_setup Sets the donut up with its behaviour donut_behaviour, turned to its player: with state bit 7 it stays hidden for its way in, otherwise it fights at once.
# 033028 "LDU #$7E20; LDA #$29,X"
033028  func  donut_come_in
comment donut_come_in The donut's way in, by field 29 (kind_b7_entrances gives where it starts).
# 033031 kind_b7_entrances by its state: "STA #$3B,X; STB #$29,X; CLR #$30,X"
033031  func  donut_choose_entrance
comment donut_choose_entrance Takes the donut's wait and the step its way in starts at from kind_b7_entrances.
# 033044 "LDD #$00E0; STD #$0C,X; LDA #$92; LDD #$6060; STD #$0A,X"
033044  func  donut_fall_in_start
comment donut_fall_in_start Places the donut, big (zoom 6060), at x 00E0 for its way in.
# 033059 "DEC #$3B,X", "LDA #$90; STA #$00,X; LDD #$0400; STD #$0F,X; LDA #$30; STA #$3B,X", "LDD #$2600; LBSR $8680"
033059  func  donut_fly_across
comment donut_fly_across Counts its wait down, then sends the donut flying across with a sound.
# 03307D "ADDD #$0020" on 19, "SUBD #$0101; CMPD #$1010" on 0A, "LDD #$0180; STD #$0C,X; LDD #$00A0; STD #$11,X; LDD
# #$00C0; STD #$16,X"
03307D  func  donut_fly_into_distance
comment donut_fly_into_distance Shrinks the donut as it rises away, then puts it high over the middle of the screen.
# 0330BF "DEC #$3B,X", "LDA #$88; STA #$00,X", "LDA #$84", "LDD #$FA00; STD #$19,X; LDD #$0180; STD #$0F,X"
0330BF  func  donut_drop_down
comment donut_drop_down Drops the donut down fast toward the middle of the screen.
# 0330F3 "DEC #$3B,X", "LDA #$91"; else "ADDD #$0020" on 19
0330F3  func  donut_drop_slow
comment donut_drop_slow Slows the donut's drop, then plays its landing animation.
# 03310B "LBSR $85B1; BCC; LDA #$C0; STA #$00,X; LDA #$02; STA #$02,X"
03310B  func  donut_land
comment donut_land Pulls the donut down until it lands, then lets it fight.
# 03311B "DEC #$3B,X", "LDD #$0180; STD #$0C,X; LDA #$C0; STA #$00,X; LDA #$81", "LDD #$0180; STD #$0F,X" toward the middle
03311B  func  donut_walk_in
comment donut_walk_in Counts its wait down, then walks the donut in from the right for 64 frames.
# 03314C "DEC #$3B,X; BNE; LDA #$02; STA #$02,X"
03314C  func  donut_walk_in_end
comment donut_walk_in_end Counts the walk down and lets the donut fight.
# action 3A's steps (table 7E4A: 715D 7168 7192)
# 03315D "LDA #$93; STA #$05,X; INC #$29,X; LBRA $859C"
03315D  func  donut_roll_start
comment donut_roll_start Starts the donut's roll, turned to its player.
# 033168 "LDA #$94", "LDD #$0300; STD #$0F,X", "LDA #$20; STA #$3B,X", "LDY #$7DA6; LBRA $85B4"
033168  func  donut_roll_go
comment donut_roll_go When the wind-up ends, rolls the donut fast with its attacking hit box for 32 frames.
# 033192 "DEC #$3B,X", "CLRW #$0F,X; LDY #$7D9E; LBSR $85B4; LBRA $8635"
033192  func  donut_roll_end
comment donut_roll_end Counts the roll down, then stops the donut with its plain hit box and ends the action.
# action 3B's steps (table 7E50: 71AA 71B5 71C5)
# 0331AA "LDA #$90; STA #$05,X; INC #$29,X; LBRA $859C"
0331AA  func  donut_throw_start
comment donut_throw_start Starts the donut's throw, turned to its player.
# 0331B5 "BITA #$02", "LDY #$7E56; LBRA $862C"
0331B5  func  donut_throw_release
comment donut_throw_release On the marked frame, puts in the small donut (5280 type DE).
# 0331C5 "LDA #$06,X; LSRA; BCC; LBRA $8635"
0331C5  func  donut_throw_end
comment donut_throw_end Ends the action when the throw ends.
# 0331D8 "LDU #$7E62; LBSR $85AB; LDA #$C8; STA #$00,X; LDD #$0400; STD #$0F,X", "LDD #$2600; LBSR $8680"
0331D8  func  donut_shot_setup
comment donut_shot_setup Sets the thrown small donut up flying fast the way it faces, with a sound.
# 0331FC "RTS"
0331FC  func  donut_shot_fly
comment donut_shot_fly The thrown donut's flight: nothing to do, it moves by its speed.

# ---- 4F80 type FC, kind B8, and what it throws (033206-0336B1) ----
033206  file  enemies/flying_saxophone    # stage 6's flying kind B8 thrower (type FC) and its shots (5280 type F3)
# 033206 (0333A2/0333AA/0333E5 "LBRA $7206"): "LDA #$00,X; BEQ", "LDU #$38,X; LDD #$0C,X; CMPD #$0C,U", field 09 bit 6
033206  func  flying_saxophone_face_player
comment flying_saxophone_face_player Turns the flyer toward its player by which side of him it is.
# 033226 "LDU #$7EB7; LBSR $85AB", "LDD #$8080; STD #$0A,X", the flying_saxophone tables by its state, "LDD #$00E0; STD #$0C,X",
# "LDD #$0301; LBSR $8680", "LDD #$0300; STD #$0F,X; LDD #$FF80; STD #$14,X; LDD #$0200; STD #$19,X", "LDD #$04B0; STD
# #$2C,X"
033226  func  flying_saxophone_setup
comment flying_saxophone_setup Sets the flyer up leaping in big from the front with a sound, with its heading, sweep and descent from the flying_saxophone tables and 1200 frames to stay.
# 03329A "LDU #$7EBD; LDB #$29,X" (72A3 72D4 7318 7334 734F)
03329A  func  flying_saxophone_come_in
comment flying_saxophone_come_in The flyer's way in, by field 29.
# 0332A3 "SUBD #$0101" on 0A, "SUBD #$0010" on 0F and 19, once falling "LDD #$52,X; STD #$14,X"
0332A3  func  flying_saxophone_leap_in
comment flying_saxophone_leap_in Shrinks the leaping flyer and slows it; once it falls, gives it its y speed (flying_saxophone_descent_y_speeds).
# 0332D4 "SUBD #$0202; CMPD #$4040", "CMPD #$0040" on 16, "LDD #$0F,X; SUBD #$3E,X", "SUBD #$0020"
0332D4  func  flying_saxophone_descend
comment flying_saxophone_descend Shrinks the flyer to its plain size and slows it as it comes down to its flying height, then stops it for 32 frames.
# 033318 "LBSR $75C2", "DEC #$3B,X", "LDA #$88; STA #$00,X; LDA #$12; STA #$3B,X; LDD #$0100; STD #$19,X"
033318  func  flying_saxophone_hover
comment flying_saxophone_hover Bobs the flyer for its wait, then lifts it a little.
# 033334 "LBSR $7609", "DEC #$3B,X", "CMPD #$0040" on 16: "CLRW #$19,X"
033334  func  flying_saxophone_rise
comment flying_saxophone_rise Moves the flyer by its heading while it rises to its flying height.
# 03334F "LDA #$C8; STA #$00,X; LBSR $8620; LBSR $761F; INC #$02,X; CLRW #$28,X"
03334F  func  flying_saxophone_take_off
comment flying_saxophone_take_off Makes the flyer hittable and sends it flying at the nearest player with a wait before its first throw.
# 033361: 2C at 0: "LBSR $74EF; LDD #$0100; STD #$19,X", gone above 0100; else "DECW #$2C,X; LBSR $75E1; LBSR $74EF; DEC
# #$3B,X", "DEC #$48,X; LDA #$48,X; BITA #$03" (single throws one time in four, else a volley)
033361  func  flying_saxophone_fly
comment flying_saxophone_fly Flies the flyer around its player, bobbing, until its next throw (a volley three times in four, else single shots); when its stay is over it rises off the screen and goes.
# 0333AD volley: "LDD #$0F00; LBSR $8680" at the first, "LDA #$95", flying_saxophone_volley_shots by 3C, "LDA #$07; STA #$3B,X"
0333AD  func  flying_saxophone_volley
comment flying_saxophone_volley Throws three shots in a row, 7 frames apart, with a sound at the first, still flying.
# 0333E0 (the end of the volley and of the single throws): "LDA #$07; STA #$3B,X; LBRA $7206"
0333E0  func  flying_saxophone_next_throw_wait
comment flying_saxophone_next_throw_wait Waits 7 frames before the next shot and turns the flyer to its player.
# 0333F6 "DEC #$3C,X", "LDA #$90", flying_saxophone_single_shots by 3C; at the end 0333E8 "LDA #$02; STA #$02,X; LDA #$80; STA
# #$05,X; LBSR $761F"
0333F6  func  flying_saxophone_single_throw
comment flying_saxophone_single_throw Throws its single shots one after the other, still flying, then sends it flying again with a new wait.
# step FF (7E7C entry -1: 741C "LDU #$7F03": 7425 744D)
03341C  func  flying_saxophone_hurt
comment flying_saxophone_hurt The flyer's hit (step FF), by field 29.
# 033425 "LDA #$88; STA #$00,X", speeds cleared, "LDD #$16,X; STD #$50,X; LDA #$1E; STA #$3B,X; LDD #$5300; LBSR $8680;
# LDA #$89"
033425  func  flying_saxophone_hurt_start
comment flying_saxophone_hurt_start Stops the hit flyer, keeps its height and plays its hurt animation for 30 frames with its sound.
# 03344D "LBSR $74D7; DEC #$3B,X", flashing by field 09; at 0 "LDA #$02; STA #$02,X; LDA #$C8; STA #$00,X"
03344D  func  flying_saxophone_hurt_shake
comment flying_saxophone_hurt_shake Shakes and flashes the hit flyer, then sends it flying again.
# step FE (7E7C entry -2: 7494 "LDU #$7F07": 749D 74B7)
033494  func  flying_saxophone_die
comment flying_saxophone_die The beaten flyer (step FE), by field 29.
# 03349D "LDD #$5300; LBSR $8680", speeds cleared, "LDA #$88; STA #$00,X; LDA #$88; STA #$05,X"
03349D  func  flying_saxophone_die_start
comment flying_saxophone_die_start Stops the beaten flyer with its sound and its falling animation.
# 0334B7 "LBSR $85B1; BCC", "LDD #$7700; LBSR $8680", into 0334C5
0334B7  func  flying_saxophone_die_fall
comment flying_saxophone_die_fall Pulls the beaten flyer down; when it lands, plays a sound.
# 0334C5 "LDA #$06,X; LSRA; BCC", "LDA #$27,X; ORA #$80", "CLR #$00,X"
0334C5  func  flying_saxophone_die_end
comment flying_saxophone_die_end Frees the flyer's slot when its animation ends.
# 0334D7 flying_saxophone_hurt_shakes
0334D7  func  flying_saxophone_shake_height
comment flying_saxophone_shake_height Sets the hit flyer's height speed toward its kept height plus a shake from flying_saxophone_hurt_shakes.
# 0334EF as cloud_devil_steer: "LDA <$15; ANDA #$7F; BNE; LBSR $8620", the heading 2E swept by 3A ("COM #$3D,X"), "LBSR
# $7609", y toward its player's, x kept to 0040-017F and y to 0090-00FF
0334EF  func  flying_saxophone_steer
comment flying_saxophone_steer Steers the flyer around its player: sweeps its heading back and forth on its side of him, follows his depth and keeps it on the screen.
# 0335C2 flying_saxophone_bob_up by field 37
0335C2  func  flying_saxophone_bob_in
comment flying_saxophone_bob_in Bobs the arriving flyer's height by flying_saxophone_bob_up.
# 0335E1 flying_saxophone_bob_down / flying_saxophone_bob_up by field 37's bits
0335E1  func  flying_saxophone_bob
comment flying_saxophone_bob Bobs the flying flyer's height up and down by flying_saxophone_bob_down and flying_saxophone_bob_up.
# 033609 flying_saxophone_velocities by its heading
033609  func  flying_saxophone_set_speeds
comment flying_saxophone_set_speeds Sets the flyer's x and y speeds by its heading from flying_saxophone_velocities.
# 03361F "LBSR $8623; ANDA #$03; LDU #$7F51; LDA A,U; STA #$3B,X"
03361F  func  flying_saxophone_choose_throw_wait
comment flying_saxophone_choose_throw_wait Picks the frames before the flyer's next throw at random from flying_saxophone_shot_waits.
# 033633 "LDU #$7FDD; LBSR $85AB", flying_saxophone_shot_animations by its state, "LDD #$0400; STD #$19,X", flying_saxophone_shot_speeds
# by "<$58 ANDA #$03"
033633  func  flying_saxophone_shot_setup
comment flying_saxophone_shot_setup Sets the shot up with its animation by its state, thrown up with one of four x speeds at random.
# 033678 "LBSR $85B1; BCC", "LDD #$0100; STD #$19,X; LDA #$C0; STA #$00,X; LDD #$0480; STD #$04,X; LDA #$02; STA #$3B,X"
033678  func  flying_saxophone_shot_fall
comment flying_saxophone_shot_fall Pulls the shot down; where it lands it bursts (hit sparks), able to hurt for 2 frames.
# 03369A "DEC #$3B,X; BNE", "LDA #$80; STA #$00,X", into 0336A7
03369A  func  flying_saxophone_shot_burst
comment flying_saxophone_shot_burst Counts the 2 frames down and makes the burst harmless.
# 0336A7 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
0336A7  func  flying_saxophone_shot_remove
comment flying_saxophone_shot_remove Frees the shot's slot when its burst ends.

# ======== bank 1A ========
# The stage 6 (Dreamland) boss: 4F80 type F8, the last record of scene 8's spawn list (spawn_list_0377F5: 4F80:F8),
# setup 77D0 = BA00 (the set extract_assets calls bubbles); it changes its kind as it goes (BB, D0, BA, D1: 034445
# "LDA #$BB; STA #$04,X", 0347E6 "LDA #$BA", 034801 "LDA #$D0", 034D13 "LDA #$D1"), its forms by field 31 (the phase:
# object_1a_level_rows gives, by the players, the vitality at which a form ends), and its routines by its step from
# table 7794 (6083 6095 | 60BE 6103 6242 6281 6327 6495 6408 65C9 663D 6719 679C 6858 692B 698F 6A6C 6AFA 6BF8 6C46
# 6242 6C83); its death ends the stage (034DD4 "LDA #$01; STA <$7D; INC <$04"). Its other objects: a chain of kind D1
# balls (types FE/FF) it puts out (034BC0 "LDY #$78BC; LBSR $862C": 4F80 type FF), the balls it spits (4D40 type 20:
# 03495B "LDY #$788C; LBRA $862F"), their trail (5280 EA), its shadow (5280 E3: 03444F "LDY #$7812")
034000  file  objects/bank_entries    # (bank 1A's entries)
# 5640 type 02 (F581/F577: bank 1A, 6006 -> 6021 "RTS")
034006  func  empty_stage_event_02
comment empty_stage_event_02 The handler of the stage events' type 02: does nothing.
# 6009 -> 6022 "RTS": the list at 4F80 reaches it (07CB3C; it runs in the scenarios), no type of the bank tables gives it
034009  func  empty_object_handler_1a
comment empty_object_handler_1a An object handler of bank 1A that does nothing.
# 5280 type E3 (600C -> 6FA1 "LDU #$794E"): setup 7952 = D100 (kind D1, animation 00: a dark ellipse in
# assets/sprites/kind_D1.png); put in by the boss's change to its second form (034452 "LBSR $862C", 7812: 5280 type E3)
03400C  func  dreamland_boss_shadow_update
comment dreamland_boss_shadow_update Runs the Dreamland boss's shadow by its step.
# 4F80 type F8 (600F -> 6077)
03400F  func  dreamland_boss_update
comment dreamland_boss_update Runs the Dreamland boss (stage 6) by its step.
# 4F80/5280/4D40 type FF (6012 -> 7032 "LDU #$7978", then 7038)
034012  func  dreamland_boss_chain_update
comment dreamland_boss_chain_update Runs a piece of the boss's chain of balls by its step (the base, a link), then keeps it facing as its holder does.
# type FE (6015 -> 72F3 "LDU #$7300", then "LBRA $7038")
034015  func  dreamland_boss_chain_head_update
comment dreamland_boss_chain_head_update Runs the head of the boss's chain by its step: it follows its paths and lashes out.
# 4F80 type F7 (6018 -> 6FE2 "LDU #$7960"): setup 796E = BB01 (bubbles_2); no spawn list puts it in, no scenario runs it
034018  func  chain_holder_update
comment chain_holder_update Runs a kind BB object that puts out a chain of balls and keeps facing the nearest player, by its step.
# 4D40 type 20 (601B -> 6DF4 "LDU #$7914"): setup 792E = D103 (kind D1); after the step: hit ("BITA #$20") -> step 6;
# "LDD #$14,X; ABSD; LSRDI #$03; ADDB #$40; STB #$0A,X"
03401B  func  boss_ball_update
comment boss_ball_update Runs a ball the Dreamland boss spits by its step; it bursts when it hits something, and stretches with its speed in depth.
# 5280 type EA (601E -> 6F7D "LDU #$7944"): setup 7948 = D104; put in by the spat ball (034EB9 "LDY #$793C; LBSR $862C")
03401E  func  boss_ball_trail_update
comment boss_ball_trail_update Runs a puff of the trail the boss's balls leave, by its step.

034077  file  bosses/dreamland_boss    # the stage 6 (Dreamland) boss (type F8): its forms, routines, hits and death
# 034077 "LDU #$7794; ASLB; JSR [B,U]; LBSR $8593; LBRA $638C" (reached again with B = field 45: 03424E "LDB #$45,X;
# JMP $6077")
034077  func  dreamland_boss_run_step
comment dreamland_boss_run_step Runs the step routine given, then checks the boss's hits and turns it back at the stage's edges.
# step FE (7794 entry -2): "LDY #$48,X; LBSR $85B4", "LDU #$77BC; LDA #$31,X; LDA A,U; STA #$02,X"
034083  func  dreamland_boss_beaten
comment dreamland_boss_beaten Its vitality gone, the boss takes its plain hit box and goes to its form's end (the step 77BC gives by its phase).
# step FF (7794 entry -1): object_1a_level_rows by the phase and <$57, "STA $188C; CMPA #$1B,X; BCC", else "LDU #$77C1"
034095  func  dreamland_boss_hit
comment dreamland_boss_hit When the boss is hit: below its form's level for the players in the game it goes to its form's end, otherwise to its form's hit reaction.
# step 0: "LDU #$77D0; LBSR $85AB", hidden, "LDA #$FF; STA #$1B,X", "LDD #$6700; LBSR $8680", phase 0, out of the enemy
# count, "LDA #$01; STA #$02,X; STA #$45,X"
0340BE  func  dreamland_boss_setup
comment dreamland_boss_setup Sets the boss up hidden, unbeatable (vitality FF) and out of the enemy count, with its sound, for its entrance.
# step 1: "LDU #$77D6; LDB #$52,X" (610C 6148 6170 618C 61A2 61D0 61E7 61FD)
034103  func  dreamland_boss_entrance
comment dreamland_boss_entrance The boss's entrance, by field 52.
# 03410C "LDA <$92; BNE", "LDA #$98", "LDD #$1010; STD #$0A,X", "LDD #$FD00; LBSR $8680", "LDD #$0120; STD #$0C,X; LDD
# #$0160; STD #$16,X"
03410C  func  dreamland_boss_appear
comment dreamland_boss_appear When direct page 92 is clear, shows the boss tiny, high over the stage, with a sound.
# 034148 "LBSR $63D1", "LDA #$DC; STA #$00,X", "LDY #$7770; LBSR $85B4", "LDD #$0200; STD #$19,X", "LDD #$6400; LBSR $8680"
034148  func  dreamland_boss_drop_in
comment dreamland_boss_drop_in Drops the boss; when it lands it bounces with a thud and its attacking hit box.
# 034170 "LBSR $85B1", "LDY #$7768; LBSR $85B4", "LDA #$40; STA #$3B,X"
034170  func  dreamland_boss_bounce_in
comment dreamland_boss_bounce_in Pulls the bouncing boss down; when it lands it takes its plain hit box and waits 64 frames.
# 03418C "DEC #$3B,X; BNE; LDA #$80; STA #$3B,X"
03418C  func  dreamland_boss_settle
comment dreamland_boss_settle Counts the wait down, then waits 128 frames more.
# 0341A2 "ADDD #$0101; CMPD #$4040" on 0A, "DEC #$3B,X", "LDA #$C8; STA #$00,X; LDA #$81", "LDA #$01; STA <$7C"
0341A2  func  dreamland_boss_grow
comment dreamland_boss_grow Grows the boss to its full size; after the wait makes it hittable and sets direct page 7C.
# 0341D0 "LDA #$06,X; LSRA; BCC; LDA #$82 ... LDA #$40; STA #$3B,X"
0341D0  func  dreamland_boss_entrance_pose
comment dreamland_boss_entrance_pose When that animation ends, plays animation 82 for 64 frames.
# 0341E7 "DEC #$3B,X", "LDA #$83 ... LDA #$80; STA #$3B,X"
0341E7  func  dreamland_boss_entrance_pose_end
comment dreamland_boss_entrance_pose_end Counts down, then plays animation 83 for 128 frames.
# 0341FD "DEC #$3B,X", "LDA #$01; STA #$31,X; LDA #$FF; STA #$1B,X", "LDA #$03; STA #$02,X; STA #$45,X"
0341FD  func  dreamland_boss_start_fight
comment dreamland_boss_start_fight Counts down, then starts the boss's first form: it chases the players (step 3).
# 034218 "LDA #$09,X; ORA #$80", "LDA #$80; STA #$06,X"
034218  func  dreamland_boss_flash_on
comment dreamland_boss_flash_on Turns the boss's flash on.
# 034226 "ANDA #$7F"
034226  func  dreamland_boss_flash_off
comment dreamland_boss_flash_off Turns the boss's flash off.
# 034234 "EORA #$80"
034234  func  dreamland_boss_flash_toggle
comment dreamland_boss_flash_toggle Turns the boss's flash over.
# steps 2 and 12 (7794 entries 2, 12: 6242 "LDU #$77E6; LDB #$29,X": 6252 6268), then "LDB #$45,X; JMP $6077"
034242  func  dreamland_boss_flinch
comment dreamland_boss_flinch The boss's flinch when hit while it cannot be beaten, by field 29; it goes on with its routine (field 45) meanwhile.
# 034252 "LDA #$88; STA #$00,X; BSR $6218; LDD #$6600; LBSR $8680; LDA #$08; STA #$53,X"
034252  func  dreamland_boss_flinch_start
comment dreamland_boss_flinch_start Flashes the boss for 8 frames with the hit sound.
# 034268 "DEC #$53,X", "LDA #$C8", "LDY #$7768; LBSR $85B4", "LDB #$45,X; STB #$02,X"
034268  func  dreamland_boss_flinch_end
comment dreamland_boss_flinch_end Counts the flash down, then the boss goes back to its routine (field 45).
# step 3: "LDU #$77EA; LDB #$52,X" (628A 629E 62D7 62E0 62E7 6302)
034281  func  dreamland_boss_chase
comment dreamland_boss_chase The first form's chase, by field 52: legs at the nearest player, a rest, until it is in line with its player.
# 03428A "LDA #$86", "LDA #$08; STA #$3C,X", into 03429E
03428A  func  dreamland_boss_chase_start
comment dreamland_boss_chase_start Starts the chase with 8 legs.
# 03429E "LBSR $8620", "CMPD #$0004" on y, "LBSR $861D; LDB #$30; LBSR $8617", object_1a_chase_leg_times by 3C
03429E  func  dreamland_boss_chase_leg
comment dreamland_boss_chase_leg Turns the boss toward the nearest player and runs it at him for the leg's time (object_1a_chase_leg_times); after 8 legs it charges.
# 0342D7 "DEC #$3B,X; BNE; INC #$52,X"
0342D7  func  dreamland_boss_chase_run
comment dreamland_boss_chase_run Counts the leg's time down.
# 0342E0 "LDA #$01; STA #$52,X; BRA $630C"
0342E0  func  dreamland_boss_chase_next_leg
comment dreamland_boss_chase_next_leg Goes on to the next leg, unless in line with its player.
# 0342E7 "LDA #$06,X; LSRA; BCC; LDA #$82", stopped, "LDA #$40; STA #$3B,X"
0342E7  func  dreamland_boss_chase_rest
comment dreamland_boss_chase_rest When its animation ends, stops the boss for 64 frames.
# 034302 "DEC #$3B,X; BNE; LDA #$00; STA #$52,X"
034302  func  dreamland_boss_chase_rest_end
comment dreamland_boss_chase_rest_end Counts the rest down and starts the chase again.
# 03430C "LDU #$38,X; LDD #$11,U; SUBD #$11,X; ABSD; CMPD #$0004", "LDA #$04; STA #$02,X; STA #$45,X"
03430C  func  dreamland_boss_check_in_line
comment dreamland_boss_check_in_line When the boss is in line with its player (less than 4 apart in depth), sends it charging (step 4).
# step 4: "LDU #$7806; LDB #$52,X" (6330 6349 6371)
034327  func  dreamland_boss_charge
comment dreamland_boss_charge The first form's charge across the screen, by field 52.
# 034330 "LDA #$86", stopped, "LDA #$40; STA #$3B,X"
034330  func  dreamland_boss_charge_wind_up
comment dreamland_boss_charge_wind_up Stops the boss for 64 frames before its charge.
# 034349 "DEC #$3B,X", "LDD #$0800; STD #$0F,X" toward its player, "LDY #$7770; LBSR $85B4", "LDA #$30; STA #$3B,X"
034349  func  dreamland_boss_charge_dash
comment dreamland_boss_charge_dash Counts down, then dashes the boss across at its player with its attacking hit box for 48 frames.
# 034371 "DEC #$3B,X", "LDY #$7768; LBSR $85B4", "LDA #$03; STA #$02,X; STA #$45,X"
034371  func  dreamland_boss_charge_end
comment dreamland_boss_charge_end Counts the dash down, gives back the plain hit box and goes back to the chase.
# 03438C "LBSR $863B; TSTA; BPL $6388" (034388 "CLRW #$50,X"), "LBSR $8647", "LBSR $8644", "EORA #$80" on 37, "NEGW #$14,X" / "NEGW #$0F,X"
03438C  func  dreamland_boss_bounce_off_edges
comment dreamland_boss_bounce_off_edges Turns the boss's speeds back once where it meets the stage's edges, across or in depth (fields 50 and 51 keep that it did, cleared again while it is away from the edges).
# 0343D1 "SUBD #$00C0" on 19, "CMPA #$F0", "LDD #$5C,X; ADDD #$0010", "CMPD <$E8", "COMA" when landed
0343D1  func  dreamland_boss_fall
comment dreamland_boss_fall Pulls the boss down hard; returns true when it has landed on its floor.
# step 6: "LDU #$780C; LDB #$4E,X" (6411 6437 6463)
034408  func  dreamland_boss_change_to_second_form
comment dreamland_boss_change_to_second_form The end of the first form (step 6), by field 4E: it changes into its second form.
# 034411 "LDA #$06; STA #$45,X; LDA #$00; STA #$31,X; LDA #$81", stopped, "LDA #$80; STA #$3B,X"
034411  func  dreamland_boss_second_change_start
comment dreamland_boss_second_change_start Stops the boss, unbeatable, for 128 frames.
# 034437 "LBSR $6234; DEC #$3B,X", "LDD #$2000; LBSR $8680; LDA #$BB; STA #$04,X; LDA #$84", "LDY #$7812; LBSR $862C"
034437  func  dreamland_boss_second_change_flash
comment dreamland_boss_second_change_flash Flashes the boss; after the wait it turns into kind BB with a sound and puts in its shadow (5280 type E3).
# 034463 "LBSR $6234; DEC #$3B,X", "LDA #$02; STA #$31,X; LDA #$FF; STA #$1B,X", "LDA #$07; STA #$02,X; STA #$45,X"
034463  func  dreamland_boss_second_form_start
comment dreamland_boss_second_form_start Flashes the boss; after the wait starts its second form (phase 2, step 7).
# step 5: "LDU #$781E; LDB #$29,X" (64E0 6540 6546 655F 6597 65B0; -2 64AB, -1 64C4), "LDA #$43,X; BEQ; LDB #$45,X;
# JMP $6077"
034495  func  dreamland_boss_first_form_hit
comment dreamland_boss_first_form_hit The first form's hit reaction, by field 29; while it only flashes it goes on with its routine (field 45).
# 0344AB "DEC #$53,X", "LDA #$04; STA #$02,X; STA #$45,X; CLR #$29,X"
0344AB  func  dreamland_boss_first_form_flash_end
comment dreamland_boss_first_form_flash_end Counts the flash down and goes on with the charge.
# 0344C4 as 0344AB, "CLR #$52,X"
0344C4  func  dreamland_boss_first_form_flash_end_charge
comment dreamland_boss_first_form_flash_end_charge Counts the flash down and starts the charge again.
# 0344E0 "LDD #$6600; LBSR $8680", "DEC #$4F,X; LDA #$4F,X; ANDA #$07; BEQ", "LDA #$01; STA #$43,X; LDA #$08; STA #$53,X",
# else "LDA #$85", "LDD #$0100; STD #$0F,X; LDD #$0D00; STD #$19,X"
0344E0  func  dreamland_boss_first_form_hit_start
comment dreamland_boss_first_form_hit_start Flashes the hit boss with the hit sound; every eighth hit knocks it high into the air away from its player.
# 034540 "LBSR $6226; INC #$29,X", into 034546
034540  func  dreamland_boss_knocked_up
comment dreamland_boss_knocked_up Turns the flash off for the knocked boss.
# 034546 "INC #$29,X; LDD #$19,X; BPL", "LDA #$CC; STA #$00,X; LDY #$7770; LBRA $85B4"; else "LBSR $85B1"
034546  func  dreamland_boss_knocked_rise
comment dreamland_boss_knocked_rise Pulls the knocked boss down; once it falls it takes its attacking hit box.
# 03455F "LBSR $63D1", 034564 object_1a_bounce_animations, "LDD #$0400; STD #$19,X; LDD #$6400; LBSR $8680"
03455F  func  dreamland_boss_knocked_fall
comment dreamland_boss_knocked_fall Pulls the knocked boss down hard; when it lands it bounces with a thud.
# 034564 (also from 03455C "BCS $6564"): "LDU #$782A; DEC #$3A,X ... STA #$05,X", "LDD #$0400; STD #$19,X", "LDA #$04;
# STA #$29,X"
034564  func  dreamland_boss_knocked_bounce
comment dreamland_boss_knocked_bounce Bounces the landed boss up again with the next of object_1a_bounce_animations and a thud.
# 034597 "LBSR $63D1", "LDA #$88; STA #$00,X; LDA #$20; STA #$3B,X; LDD #$6400; LBSR $8680"
034597  func  dreamland_boss_knocked_land
comment dreamland_boss_knocked_land Pulls the boss down hard; when it lands, a thud and a 32 frames' wait.
# 0345B0 "DEC #$3B,X", "LDA #$03; STA #$02,X; STA #$45,X"
0345B0  func  dreamland_boss_knocked_get_up
comment dreamland_boss_knocked_get_up Counts the wait down and sends the boss back to its chase.
# step 7: "LDU #$782E; LDB #$52,X" (65DB 661C), "LDU #$38,X; LBSR $8626; LBRA $638C"
0345C9  func  dreamland_boss_pose_round
comment dreamland_boss_pose_round The second form's round of poses, by field 52, measuring its player and turning back at the edges.
# 0345DB "LDA #$C0", "LDY #$7768", "DEC #$4F,X ... ANDA #$03", object_1a_pose_times / object_1a_pose_animations by 3A
0345DB  func  dreamland_boss_next_pose
comment dreamland_boss_next_pose Takes the next pose of the round (object_1a_pose_times, object_1a_pose_animations); FF ends the round.
# 03461C "DEC #$3B,X; BNE", into 034621
03461C  func  dreamland_boss_hold_pose
comment dreamland_boss_hold_pose Holds the pose for its time.
# 034621 "CLR #$52,X; LDA #$08; STA #$02,X; STA #$45,X", "LDY #$7768", "LBRA $85C9"
034621  func  dreamland_boss_end_poses
comment dreamland_boss_end_poses Ends the round of poses and sends the boss leaping (step 8), facing its player.
# step 8: "LDU #$7842; LDB #$52,X" (6649 6673 66B2 66C5 66EC 66F4), "LBRA $638C"
03463D  func  dreamland_boss_leap
comment dreamland_boss_leap The second form's leap at its player, by field 52.
# 034649 "LDA #$01; STA #$43,X", stopped, "LBSR $8620; LBSR $8626", "LDA #$8B", "LBRA $85C9"
034649  func  dreamland_boss_leap_crouch
comment dreamland_boss_leap_crouch Crouches the boss, turned to the nearest player.
# 034673 "LDD #$3800; LBSR $8680", 44 = 2C / 16, object_1a_leap_speeds, object_1a_leap_heights
034673  func  dreamland_boss_leap_take_off
comment dreamland_boss_leap_take_off When the crouch ends, leaps the boss at its player, as far and high as its distance asks, with a sound.
# 0346B2 "LDA #$80; STA #$00,X", "LDD #$19,X; BPL; INC #$52,X", "LBSR $85B1; BCS $66CA"
0346B2  func  dreamland_boss_leap_rise
comment dreamland_boss_leap_rise Pulls the leaping boss down; lands it if it comes down.
# 0346C5 "LBSR $63D1; BCC", into 0346CA
0346C5  func  dreamland_boss_leap_fall
comment dreamland_boss_leap_fall Pulls the falling boss down hard until it lands.
# 0346CA "LDA #$C4", "LDY #$7770", "LDD #$6400; LBSR $8680", "LDA #$84", "LDD #$0400; STD #$19,X", "LDA #$04; STA #$52,X"
0346CA  func  dreamland_boss_leap_bounce
comment dreamland_boss_leap_bounce The landed boss bounces up again with its attacking hit box and a thud.
# 0346EC "LDA #$80; STA #$00,X; INC #$52,X", into 0346F4
0346EC  func  dreamland_boss_leap_rebound
comment dreamland_boss_leap_rebound Makes the bouncing boss unhittable while it comes down.
# 0346F4 "LBSR $85B1; BCC", "LDA #$07; STA #$02,X; STA #$45,X", "LDA #$C0", "LDY #$7768"
0346F4  func  dreamland_boss_leap_land
comment dreamland_boss_leap_land When the boss lands, stops it with its plain hit box and starts another round of poses.
# step 9: "LDU #$7870; LDB #$29,X" (6749 6776 677C; -1 672F), "LDA #$43,X; BEQ; LDB #$45,X; JMP $6077"
034719  func  dreamland_boss_second_form_hit
comment dreamland_boss_second_form_hit The second form's hit reaction, by field 29; while it only flashes it goes on with its routine (field 45).
# 03472F "DEC #$53,X", "LDA #$C0", "LDY #$7768", "LDB #$45,X; STB #$02,X"
03472F  func  dreamland_boss_second_form_flash_end
comment dreamland_boss_second_form_flash_end Counts the flash down and sends the boss back to its routine.
# 034749 "LBSR $6218", stopped, "LDD #$6600; LBSR $8680", "LDA #$43,X; BEQ", "LDA #$08; STA #$53,X; LDA #$FF; STA #$29,X";
# else "LDA #$89"
034749  func  dreamland_boss_second_form_hit_start
comment dreamland_boss_second_form_hit_start Flashes the hit boss with the hit sound: while it acts (field 43) it only flashes, otherwise it reels.
# 034776 "LBSR $6226; INC #$29,X", into 03477C
034776  func  dreamland_boss_second_form_reel
comment dreamland_boss_second_form_reel Turns the reeling boss's flash off.
# 03477C "LDA #$06,X; LSRA; BCC", "LDA #$07; STA #$02,X; STA #$45,X"
03477C  func  dreamland_boss_second_form_recover
comment dreamland_boss_second_form_recover When the reel ends, gives back the plain hit box and starts another round of poses.
# step 0A: "LDU #$7876; LDB #$4E,X" (67A5 67BD 67DE 67F9 6814)
03479C  func  dreamland_boss_change_to_third_form
comment dreamland_boss_change_to_third_form The end of the second form (step 0A), by field 4E: it falls and changes into its third form.
# 0347A5 "LDA #$0A; STA #$45,X; LDA #$00; STA #$31,X", "LDD #$6600; LBSR $8680", into 0347BD
0347A5  func  dreamland_boss_third_change_start
comment dreamland_boss_third_change_start Makes the boss unbeatable with the hit sound.
# 0347BD "LBSR $85B1; BCC", "LDA #$85", stopped, "LDA #$80; STA #$3B,X"
0347BD  func  dreamland_boss_third_change_land
comment dreamland_boss_third_change_land Pulls the boss down; when it lands, plays animation 85 for 128 frames.
# 0347DE "LBSR $6234; DEC #$3B,X", "LDA #$BA; STA #$04,X; LDA #$81", "LDA #$40; STA #$3B,X"
0347DE  func  dreamland_boss_third_change_flash
comment dreamland_boss_third_change_flash Flashes the boss; after the wait it turns back into kind BA.
# 0347F9 "LBSR $6234; DEC #$3B,X", "LDA #$D0; STA #$04,X; LDA #$85"
0347F9  func  dreamland_boss_third_change_kind
comment dreamland_boss_third_change_kind Flashes the boss; after the wait it turns into kind D0.
# 034814 "LDA #$03; STA #$31,X; LDA #$FF; STA #$1B,X", "LDA #$0B; STA #$02,X; STA #$45,X"
034814  func  dreamland_boss_third_form_start
comment dreamland_boss_third_form_start Flashes the boss; after the wait starts its third form (phase 3, step 0B).
# 034846 "LDA #$06,X; LSRA; BCC; LDA #$0C; STA #$02,X; STA #$45,X; CLR #$52,X"
034846  func  dreamland_boss_check_spit
comment dreamland_boss_check_spit When the boss's animation ends, sends it spitting (step 0C).
# step 0B: "LDU #$7880; LDB #$52,X" (686C 6892 68F0), "BSR $6846", "LDU #$38,X; LBSR $8626; LBRA $638C"
034858  func  dreamland_boss_third_form_walk
comment dreamland_boss_third_form_walk The third form's walk at its player, by field 52, until it spits.
# 03486C "LDA #$01; STA #$43,X; LDA #$86", "LBSR $8620", "EORA #$80" on 37, "LDA #$FF; STA #$3B,X"
03486C  func  dreamland_boss_third_form_walk_start
comment dreamland_boss_third_form_walk_start Starts the walk at the nearest player.
# 034892 "CMPD #$0100" on 2C, "LDD #$0100; STD #$14,X" / "STD #$0F,X", "CMPD #$0003" on 2E, "BITA #$1F; LBSR $8620"
034892  func  dreamland_boss_third_form_approach
comment dreamland_boss_third_form_approach Walks the boss toward its player across or in depth until it is in line with him, picking the nearest player every 32 frames.
# 0348F0 "CMPD #$00E0" on 2C, "LDD #$0100; STD #$0F,X", "CMPD #$0003" on 2E: "DEC #$52,X"
0348F0  func  dreamland_boss_third_form_close_in
comment dreamland_boss_third_form_close_in Walks the boss across toward its player while it stays in line with him; out of line it goes back to approaching.
# step 0C: "LDU #$7886; LDB #$52,X" (6937 695B 696B), "LBRA $638C"
03492B  func  dreamland_boss_spit
comment dreamland_boss_spit The third form's spit, by field 52.
# 034937 stopped, "LDA #$01; STA #$43,X; LDA #$87", "LBSR $8620; LBSR $8626; LBRA $85C9"
034937  func  dreamland_boss_spit_start
comment dreamland_boss_spit_start Stops the boss and starts its spit, turned to the nearest player.
# 03495B "BITA #$02", "LDY #$788C; LBRA $862F" (002C FFFE 50 20: 4D40 type 20)
03495B  func  dreamland_boss_spit_ball
comment dreamland_boss_spit_ball On the marked frame, spits a ball (4D40 type 20).
# 03496B "LDA #$06,X; LSRA; BCC", "LDA #$0B; STA #$02,X; STA #$45,X"
03496B  func  dreamland_boss_spit_end
comment dreamland_boss_spit_end When the spit ends, sends the boss walking again.
# step 0D: "LDU #$7896; LDB #$29,X" (69DA 6A21 6A27 6A36 6A50; -2 69A5, -1 69BE)
03498F  func  dreamland_boss_third_form_hit
comment dreamland_boss_third_form_hit The third form's hit reaction, by field 29; while it only flashes it goes on with its routine (field 45).
# 0349A5 "DEC #$53,X", "LDA #$0C; STA #$02,X; STA #$45,X; CLR #$29,X"
0349A5  func  dreamland_boss_third_form_flash_end
comment dreamland_boss_third_form_flash_end Counts the flash down and goes on with the spit.
# 0349BE as 0349A5, "CLR #$52,X"
0349BE  func  dreamland_boss_third_form_flash_end_spit
comment dreamland_boss_third_form_flash_end_spit Counts the flash down and starts the spit again.
# 0349DA "LDD #$6600; LBSR $8680", "DEC #$4F,X; ... ANDA #$07", "LDA #$0C" -> 29 FE or FF; else "LDA #$83"
0349DA  func  dreamland_boss_third_form_hit_start
comment dreamland_boss_third_form_hit_start Flashes the hit boss with the hit sound; every eighth hit makes it reel.
# 034A21 "LBSR $6226; INC #$29,X", into 034A27
034A21  func  dreamland_boss_third_form_reel
comment dreamland_boss_third_form_reel Turns the reeling boss's flash off.
# 034A27 "LDA #$06,X; LSRA; BCC; LDA #$84"
034A27  func  dreamland_boss_third_form_reel_on
comment dreamland_boss_third_form_reel_on When that animation ends, plays animation 84.
# 034A36 object_1a_repeat_animations by 3A
034A36  func  dreamland_boss_third_form_reel_more
comment dreamland_boss_third_form_reel_more When that animation ends, plays the next of object_1a_repeat_animations.
# 034A50 "LDA #$06,X; LSRA; BCC; LDA #$86", "LDA #$0B; STA #$02,X; STA #$45,X"
034A50  func  dreamland_boss_third_form_recover
comment dreamland_boss_third_form_recover When that animation ends, sends the boss walking again.
# step 0E: "LDU #$78A4; LDB #$4E,X" (6A75 6A9B 6AB1 6ACC)
034A6C  func  dreamland_boss_change_to_last_form
comment dreamland_boss_change_to_last_form The end of the third form (step 0E), by field 4E: it changes into its last form.
# 034A75 "LDA #$0E; STA #$45,X; LDA #$00; STA #$31,X; LDA #$83", stopped, "LDA #$80; STA #$3B,X"
034A75  func  dreamland_boss_last_change_start
comment dreamland_boss_last_change_start Stops the boss, unbeatable, for 128 frames.
# 034A9B "LBSR $6234; DEC #$3B,X", "LDA #$8A"
034A9B  func  dreamland_boss_last_change_pose
comment dreamland_boss_last_change_pose Flashes the boss; after the wait plays animation 8A.
# 034AB1 "LBSR $6234; DEC #$3B,X", "LDA #$BA; STA #$04,X; LDA #$81"
034AB1  func  dreamland_boss_last_change_kind
comment dreamland_boss_last_change_kind Flashes the boss; after the wait it turns back into kind BA.
# 034ACC "LBSR $6234; DEC #$3B,X", "LDA #$82", "LDA #$FF; STA #$1B,X", "LDA #$0F; STA #$02,X; STA #$45,X"
034ACC  func  dreamland_boss_last_form_start
comment dreamland_boss_last_form_start Flashes the boss; after the wait it starts its wobble (step 0F), unbeatable.
# step 0F: "LDU #$78AC; LDB #$52,X" (6B03 6B21 6B40 6B5F 6B7E 6BB7 6BC0 6BDD)
034AFA  func  dreamland_boss_wobble
comment dreamland_boss_wobble The boss's wobble before it puts out its chain, by field 52.
# 034B03 "LDD #$4040; STD #$0A,X; LDA #$02; STA #$3B,X; LDA #$04; STA #$3C,X; LDA #$04; STA #$3A,X"
034B03  func  dreamland_boss_wobble_start
comment dreamland_boss_wobble_start Starts the wobble at its plain size: 4 rounds of 4 squeezes.
# 034B21 "ORA #$D8" on 00, "LDA #$0B,X; ADDA #$3C,X; STA #$0B,X"
034B21  func  dreamland_boss_stretch_tall
comment dreamland_boss_stretch_tall Stretches the boss taller for 2 frames.
# 034B40 "SUBA #$3C,X" on 0B
034B40  func  dreamland_boss_squash_short
comment dreamland_boss_squash_short Squashes the boss back down for 2 frames.
# 034B5F "ADDA #$3C,X" on 0A
034B5F  func  dreamland_boss_stretch_wide
comment dreamland_boss_stretch_wide Stretches the boss wider for 2 frames.
# 034B7E "SUBA #$3C,X" on 0A, "DEC #$3C,X", "DEC #$3A,X", "LDA #$80; STA #$3B,X"
034B7E  func  dreamland_boss_squash_narrow
comment dreamland_boss_squash_narrow Squashes the boss back narrower; after the squeezes and rounds, waits 128 frames.
# 034BB7 "DEC #$3B,X; BNE; INC #$52,X"
034BB7  func  dreamland_boss_wobble_wait
comment dreamland_boss_wobble_wait Counts the wait down.
# 034BC0 "LDY #$78BC; LBSR $862C", "STX #$38,U; STU #$40,X", "LDA #$01; STA $185A", "LDA #$80; STA #$3B,X"
034BC0  func  dreamland_boss_put_out_chain
comment dreamland_boss_put_out_chain Puts out the boss's chain of balls (4F80 type FF), held by the boss, and sets work RAM 185A.
# 034BDD "DEC #$3B,X", "LDA #$FF; STA #$1B,X; LDA #$04; STA #$31,X; LDA #$10; STA #$02,X; STA #$45,X"
034BDD  func  dreamland_boss_last_form_fight
comment dreamland_boss_last_form_fight Counts down, then starts the last form (phase 4): it creeps at the players and lashes its chain.
# step 10: "LDU #$78C4; LDB #$52,X" (6C02 6C29)
034BF8  func  dreamland_boss_creep
comment dreamland_boss_creep The last form's creep at the players, by field 52.
# 034C02 "LBSR $8620; LBSR $861D; LDB #$20; LBSR $8617", object_1a_approach_times by "DEC #$4F,X"
034C02  func  dreamland_boss_creep_start
comment dreamland_boss_creep_start Sends the boss slowly at the nearest player for the time object_1a_approach_times gives.
# 034C29 "DEC #$3B,X", "LDD #$6700; LBSR $8680", stopped, "LDA #$11; STA #$02,X; STA #$45,X"
034C29  func  dreamland_boss_creep_end
comment dreamland_boss_creep_end Counts down, then stops the boss with a sound and sends it lashing (step 11).
# step 11: "LDU #$78D8; LDB #$52,X" (6C4F 6C71)
034C46  func  dreamland_boss_lash
comment dreamland_boss_lash The last form's lash, by field 52.
# 034C4F "LDU #$40,X; LDU #$40,U; LDA #$02; STA #$02,U", "LBSR $8620; LBSR $8626; LBSR $85C9", "LDA #$80; STA #$3B,X"
034C4F  func  dreamland_boss_lash_start
comment dreamland_boss_lash_start Sends the chain's head out (its step 2) and turns the boss to the nearest player for 128 frames.
# 034C71 "DEC #$3B,X; BNE; LDA #$10; STA #$02,X; STA #$45,X"
034C71  func  dreamland_boss_lash_end
comment dreamland_boss_lash_end Counts down and sends the boss creeping again.
# step 13: "LDU #$78DC; LDB #$29,X" (6C90 6CBE 6CDD 6CF6 6D31 6D88 6DA2 6DBB), "DEC <$A7"
034C83  func  dreamland_boss_defeat
comment dreamland_boss_defeat The beaten boss (step 13), by field 29: it pulls its chain back, bursts, lets out what it held and goes, which ends the stage.
# 034C90 "LDU #$40,X; LDU #$40,U; LDA #$05; STA #$02,U", "LDD #$FD00; LBSR $8680", "LDD #$0100; STD #$0F,X" to the middle
034C90  func  dreamland_boss_defeat_start
comment dreamland_boss_defeat_start Pulls the chain's head back (its step 5), with a sound, and walks the boss to the middle of the screen.
# 034CBE "SUBD #$00C0; CMPD #$0040", "LDA #$81", stopped, "LDA #$40; STA #$3B,X"
034CBE  func  dreamland_boss_defeat_reach_middle
comment dreamland_boss_defeat_reach_middle When the boss reaches the middle, stops it with animation 81 for 64 frames.
# 034CDD "DEC #$3B,X", "LDU #$40,X; LDU #$40,U; LDA #$FE; STA #$02,U", "LDA #$80; STA #$3B,X"
034CDD  func  dreamland_boss_defeat_pop_chain
comment dreamland_boss_defeat_pop_chain Counts down, then bursts the chain from its head (its step FE) and waits 128 frames.
# 034CF6 "DEC #$3B,X", "LDD #$9800; LBSR $8680; LDD #$7100; LBSR $8680", "LDA #$D1; STA #$04,X; LDA #$88", "LDY #$7778"
034CF6  func  dreamland_boss_defeat_burst
comment dreamland_boss_defeat_burst Counts down, then bursts the boss (kind D1) with its sounds, for 128 frames.
# 034D31 "CMPA #$40; BCS; BITA #$1F", object_1a_released_objects by "DEC #$3C,X", "LDA #$81", "LDD #$0400; STD #$19,X",
# "LDA #$27,X; ORA #$80"
034D31  func  dreamland_boss_defeat_release
comment dreamland_boss_defeat_release Lets out one of object_1a_released_objects (4D40 type 27) every 32 frames, then makes what is left of the boss jump.
# 034D88 "LBSR $85B1; BCC", "LDD #$2000; LBSR $8680", "LDD #$0400; STD #$19,X"
034D88  func  dreamland_boss_defeat_bounce
comment dreamland_boss_defeat_bounce When it lands, bounces it again with a thud.
# 034DA2 "LBSR $85B1; BCC", "LDD #$2000; LBSR $8680", "LDA #$80; STA #$3B,X"
034DA2  func  dreamland_boss_defeat_land
comment dreamland_boss_defeat_land When it lands again, a thud and a 128 frames' wait.
# 034DBB "EORA #$84" on 00 below 40, "DEC #$3B,X", "CLR #$00,X", "LDA #$01; STA <$7D; INC <$04", "LDD #$9600; LBSR $8680"
034DBB  func  dreamland_boss_defeat_vanish
comment dreamland_boss_defeat_vanish Flickers what is left of the boss away and frees its slot: the stage is cleared (direct page 7D) and the step goes on (4804).

034E1C  file  bosses/dreamland_boss_objects    # the Dreamland boss's balls, their trail, its shadow, its chain and the kind BB chain holder
# 4D40 type 20's step 6 (7914 entry 6: 6E1C): "LDA #$80; STA #$00,X", stopped, "LDD #$6C00; LBSR $8680", "LDD #$0480;
# STD #$04,X"
034E1C  func  boss_ball_burst
comment boss_ball_burst Stops the ball that has hit something and bursts it with a sound.
# 034E3A "LDU #$792E; LBSR $85AB", "LDD #$4040; STD #$0A,X", object_1a_launches by "<$58 ANDA #$03", "LDD #$1D00; LBSR $8680"
034E3A  func  boss_ball_setup
comment boss_ball_setup Sets the spat ball up with its speed and time from object_1a_launches, the way the boss faces, with a sound, aimed at the nearest player.
# 034E8B "DEC #$3B,X", "LBSR $861D; STA #$36,X; SUBA #$3E,X; ASRA x3; STA #$3F,X", "LDY #$793C; LBSR $862C", "ADDD #$0040" on 19
034E8B  func  boss_ball_fly_out
comment boss_ball_fly_out Flies the ball out, leaving a trail and rising unless near its player; then takes the turn toward him.
# 034ED8 "DEC #$3B,X", "LDA #$36,X; LDB #$80; LBSR $8617", "SUBD #$0080" on 19, "LDA #$3E,X; ADDA #$3F,X", "LDB #$40; LBSR $8617"
034ED8  func  boss_ball_home_in
comment boss_ball_home_in Turns the ball toward its player a little each frame and brings it down, leaving a trail, until it lands.
# 034F24 "SUBD #$0020", "LBSR $8662", "LBSR $8638", "DEC #$3B,X", "LDY #$7788; LBSR $85B4", "LDD #$6C00; LBSR $8680", "LDD
# #$0480; STD #$04,X"
034F24  func  boss_ball_land
comment boss_ball_land Pulls the ball down; where it lands, or when its time is up, it bursts with its hit box and a sound.
# 034F6B "LDA #$80; STA #$00,X; INC #$02,X", into 034F73
034F6B  func  boss_ball_burst_out
comment boss_ball_burst_out Makes the ball's burst harmless.
# 034F73 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
034F73  func  boss_ball_remove
comment boss_ball_remove Frees the ball's slot when its burst ends.
# 034F83 "LDU #$7948; LBSR $85AB; LDA #$80; STA #$00,X; LDA #$10; STA #$09,X"
034F83  func  boss_ball_trail_setup
comment boss_ball_trail_setup Sets the trail's puff up.
# 034F97 "LDA #$06,X; LSRA; BCC; CLR #$00,X"
034F97  func  boss_ball_trail_fade
comment boss_ball_trail_fade Frees the puff's slot when its animation ends.
# 034FA7 "LDU #$7952; LBSR $85AB; LDA #$80; STA #$00,X; LDA #$10; STA #$09,X"
034FA7  func  dreamland_boss_shadow_setup
comment dreamland_boss_shadow_setup Sets the boss's shadow up.
# 034FBB "LDU #$40,X; LDA #$02,U; CMPA #$0A; BNE; CLR #$00,X", "SUBD #$0C,X" / "SUBD #$11,X" into the speeds
034FBB  func  dreamland_boss_shadow_follow
comment dreamland_boss_shadow_follow Keeps the shadow under the boss (field 40); it goes when the boss's second form ends (its step 0A).
# 034FE8 "LDU #$796E; LBSR $85AB; LDA #$80; STA #$3B,X"
034FE8  func  chain_holder_setup
comment chain_holder_setup Sets the kind BB chain holder up with a 128 frames' wait.
# 034FF7 "DEC #$3B,X", "LDA #$01; STA <$7C", "LDY #$7966; LBSR $862C" (4F80 type FF), "STX #$38,U"
034FF7  func  chain_holder_put_out_chain
comment chain_holder_put_out_chain Counts the wait down, then sets direct page 7C and puts out its chain of balls (4F80 type FF), held by it.
# 035010 "LDA <$16; BNE", "ORA #$80" on 05, "LBSR $8620", "LDA #$00" / "LDA #$40" into 09
035010  func  chain_holder_watch
comment chain_holder_watch Every 256 frames starts its animation again and faces the nearest player.
# 035038 (after every step of types FE and FF): "LDU #$38,X; LDA #$09,U; CMPA #$44,X", "ORB #$83" / "ANDB #$7F" on 09
035038  func  dreamland_boss_chain_follow_facing
comment dreamland_boss_chain_follow_facing Turns the chain's piece over when its holder (field 38) turns.
# steps FE and FF of type FF (7978 entries -2, -1): "LDU #$7982; LDB #$29,X" (706E 7088 709F), speeds cleared
03505B  func  dreamland_boss_chain_pop
comment dreamland_boss_chain_pop The chain's piece bursting, by field 29.
# 03506E "LDD #$6C00; LBSR $8680", "LDA #$80; STA #$00,X", "LDD #$D185; STD #$04,X", "LDA #$04; STA #$3B,X"
03506E  func  dreamland_boss_chain_pop_start
comment dreamland_boss_chain_pop_start Bursts the piece with a sound.
# 035088 "DEC #$3B,X", "LDY #$002E,X; LDA #$FE; STA #$02,Y", "LDA #$04; STA #$3B,X"
035088  func  dreamland_boss_chain_pop_next
comment dreamland_boss_chain_pop_next Four frames later bursts the piece next to it (field 2E).
# 03509F "DEC #$3B,X; BNE; CLR #$00,X"
03509F  func  dreamland_boss_chain_pop_end
comment dreamland_boss_chain_pop_end Frees the piece's slot four frames later.
# 0350A8 "LDU #$7988; LBSR $85AB", hidden, "LDA #$FF; STA #$42,X"; 0350C8 22 pieces ("LDA #$16; STA <$F4"): "LDB #$02;
# LBSR $867D" (the head, in 4D40), "LBSR $7442" for each link, "LDD #$FF02; STD #$01,U" (links), "LDD #$FE00" (the
# head), 2A the base, 2C the next, 2E the one before, 38 the holder, 32 the index, 40 the head; states from 798E
0350A8  func  dreamland_boss_chain_setup
comment dreamland_boss_chain_setup Sets the chain's base up and builds the chain: its links (type FF, step 2) and its head (type FE), each tied to the next and the one before, held by the base's holder; with no room for the head the chain is not made.
# step 1 of type FF: "LDU #$38,X; LDA #$09,X; STA #$34,X; LDY #$2C,X", "LDA #$37,X; LBSR $7472", "STD #$50,X"/"#$52,X",
# the next piece's speeds, "BSR $7218"
035184  func  dreamland_boss_chain_lead
comment dreamland_boss_chain_lead Keeps the chain's base at its holder and draws the next piece after it, at the offset its direction and distance give.
# 0351E4 "LDD $1888; SUBD #$FFF0", "LDA #$09,U; BITA #$40", "SUBD #$0001" / "ADDD #$0001; CMPD #$0020", "STD $1888"
0351E4  func  dreamland_boss_chain_shift_offset
comment dreamland_boss_chain_shift_offset Moves the chain's x offset from its holder (work RAM 1888, from -16 to 15) a step toward the side the holder faces.
# 035218 "LDU #$38,X; BSR $71E4", "LDD #$0C,U; ADDD $1888; SUBD #$0C,X", "SUBD #$0002", "ADDD #$0030" into the speeds
035218  func  dreamland_boss_chain_stay_at_holder
comment dreamland_boss_chain_stay_at_holder Sets the base's speeds to bring it to its holder's mouth: the holder's place plus the x offset, 48 up.
# step 2 of type FF: "LDU #$7988; LBSR $85AB", "LDA #$FF; STA #$42,X", object_1a_chain_links by its state ("STA #$05,X;
# STB #$23,X"), into 035285
03524C  func  dreamland_boss_chain_link_setup
comment dreamland_boss_chain_link_setup Sets a link of the chain up with its animation and its hit box's height from object_1a_chain_links.
# step 3 of type FF: "LDA #$32,X; STA #$08,X; INC #$02,X", into 035285
03527C  func  dreamland_boss_chain_link_order
comment dreamland_boss_chain_link_order Sets the link's drawing order (field 08) from its place in the chain (field 32).
# step 4 of type FF: "LDU #$2E,X; LDY #$2C,X", the next piece's speeds toward this one's place plus its offsets, "LDD #$50,U;
# STD #$50,X", "LDD #$52,U; STD #$52,X", "LDA #$34,U; STA #$09,X", "LDU #$40,X; LDA #$00,U; BPL; STA #$00,X"
035285  func  dreamland_boss_chain_link_follow
comment dreamland_boss_chain_link_follow Draws the next piece after this link at its offsets, passes the offsets and direction down the chain and takes the head's state.
# step 0 of type FE: "LDU #$79D6; LBSR $85AB", "LDA #$02; STA #$33,X", "LDY #$79F3; STY #$2C,X" (object_1a_path), the hit
# box's height from object_1a_chain_links, "LDU #$38,X; LDA #$09,U; STA #$47,X"
03530C  func  dreamland_boss_chain_head_setup
comment dreamland_boss_chain_head_setup Sets the chain's head up on its idle path (object_1a_path), out of the enemy count.
# step 1 of type FE: "LDU #$38,X; LDA #$36,U", "DEC #$3C,X", "LDD ,Y++; CMPD #$FFFF", "DEC #$33,X", "LDU #$2A,X; STD
# #$3E,U; STA #$35,U"
035352  func  dreamland_boss_chain_head_follow_path
comment dreamland_boss_chain_head_follow_path Moves the head along its path: each record a direction and a distance (mirrored as its holder faces) given to the chain's base; FFFF goes back to the path's loop as many times as it says.
# step 2 of type FE: object_1a_path_starts by "DEC #$50,X", "STD #$2C,X", "STA #$3B,X; STB #$3A,X", "LDU #$79F0 ... STA
# #$4F,X"
0353A2  func  dreamland_boss_chain_head_choose_lash
comment dreamland_boss_chain_head_choose_lash Picks the head's next lash from object_1a_path_starts: its path, its wait, its time and when it sounds.
# step 3 of type FE: "DEC #$3B,X", "LDA #$C0; STA #$00,X", "ORA #$83" on 09, "LDD #$6700; LBSR $8680"
0353DD  func  dreamland_boss_chain_head_lash
comment dreamland_boss_chain_head_lash Counts the wait down, then makes the head able to hit and hurt, with a sound.
# step 4 of type FE: "CMPA #$4F,X; LDD #$6A00; LBSR $8680", "DEC #$3A,X", "LDA #$80; STA #$00,X", "LDA #$01; STA #$02,X"
035401  func  dreamland_boss_chain_head_withdraw
comment dreamland_boss_chain_head_withdraw Sounds at its moment and, when the lash's time is up, makes the head harmless and puts it back on its path.
# step 5 of type FE: "LDA #$FF; STA #$33,X; LDD #$7D72; STD #$2C,X" (object_1a_dive_path), "LDA #$01; STA #$02,X"
03542F  func  dreamland_boss_chain_head_retract
comment dreamland_boss_chain_head_retract Puts the head on the path that pulls it back in (object_1a_dive_path).
# 035442 "LDU #$4D40; LDA #$18", "LDB #$00,U; BNE", "LDU #$0030; BSETW D,X,U" (cleared, field 59 kept), "LDB #$04; STB
# #$00,U", "LEAU #$60,U"
035442  func  find_free_object_from_4d40
comment find_free_object_from_4d40 Finds a free object among the 24 from 4D40 (the lists at 4D40, 4F80 and 5280), clears it but for field 59 and marks it hidden; returns true with it in U.
# 035472 object_1a_sines: "ANDA #$3F", "LDA A,U; MUL", "LDA #$3F; SUBA <$EF", the quadrant by bits 6 and 7, into <$E8 / <$EA
035472  func  chain_link_offset
comment chain_link_offset Gives the x and height offsets of a chain's link at a direction (A) and a distance (B), by object_1a_sines.

# ======== the families' own fields (scoped) ========

# ---- ghost_on_rope ----
# 030497 "LDD #$0C,X; ADDD <$AC; STD #$2A,X", 0304E2 "LDD #$2A,X; SUBD <$AC; ADDD #$3E,X; STD #$0C,X": its place along
# the stage
scoped object ghost_on_rope 2A stage_x u16
# 03048B "LDD ,U; STD #$3E,X" (ghost_on_rope_drop_starts.x_offset), 0304EE "NEGW #$3E,X"
scoped object ghost_on_rope 3E drop_x_offset s16

# ---- wandering_zombie ----
# 030096 "STA #$3C,X" (kind_97_timed_moves.delay), 0300B0 "DEC #$3C,X"
scoped object wandering_zombie 3C wait u8
# 03009E "STA #$3E,X" (kind_97_timed_moves.direction), 0300DD "LDA #$3E,X; LBSR $866B"
scoped object wandering_zombie 3E direction u8

# ---- rising_zombie ----
# 030570 "LDU $1854; STU #$40,X", 0305BE "LDU #$40,X; LBSR $861D"
scoped object rising_zombie 40 drift_target u16 object
# 0305C4 "STA #$3E,X", 0305F7 "LDA #$3E,X; LDB #$0C; LBSR $8617"
scoped object rising_zombie 3E direction u8

# ---- lumberjack ----
# 030917 "DEC #$3D,X; LDA #$3D,X; LSRA; BCC" (every other swing goes on to the pause)
scoped object lumberjack 3D swings u8
# 030955 "STA #$3C,X" (lumberjack_pause_loops_by_players), 030962 "DEC #$3C,X"
scoped object lumberjack 3C pause_loops u8

# ---- gorilla ----
# 0309CD "STD #$3E,X" (gorilla_entrance.x x 16), 0309E6 "CMPD #$3E,X"
scoped object gorilla 3E entrance_x u16

# ---- knight ----
# 030C15 "INC #$44,X" (setup), 030B88 "LDA #$44,X; BEQ" (beaten in it, it falls instead), 030C06 "CLR #$44,X"
scoped object knight 44 first_form u8
# 030C45 "STA #$50,X" (knight_entrance.kind), 030BE7 "LDA #$50,X; STA #$04,X"
scoped object knight 50 fighting_kind u8
# 030C7D "STD #$3E,X" (knight_entrance_style.slowdown), 030DCD "LDD #$0F,X; SUBD #$3E,X"
scoped object knight 3E entrance_slowdown u16

# ---- cloud_devil and flying_saxophone (the same flying code) ----
# 030ECF "LDD #$0258; STD #$2C,X", 030F57 "DECW #$2C,X"; 03328D "LDD #$04B0; STD #$2C,X", 03337B "DECW #$2C,X"
scoped object cloud_devil 2C stay_time u16
scoped object flying_saxophone 2C stay_time u16
# 030EAA "STB #$2E,X" (kind_c7_headings), 0310AC "LDB #$3A,X; ADDD #$2E,X; ANDA #$0F; STD #$2E,X", 0311BB "LDA #$2E,X;
# ASLA; ASLA" (the velocity table's index); 03324A, 033509 the same
scoped object cloud_devil 2E heading u16
scoped object flying_saxophone 2E heading u16
# 030EB2 "STB #$3A,X" (kind_c7_sweep_rates), 0310AD "LDB #$3A,X"; 033252, 03350A
scoped object cloud_devil 3A sweep_rate u8
scoped object flying_saxophone 3A sweep_rate u8
# 030EA2 "STB #$3D,X" (kind_c7_sweep_ways), 0310A7 "LDA #$3D,X; BNE", "COM #$3D,X"; 033242, 033504
scoped object cloud_devil 3D sweep_way u8
scoped object flying_saxophone 3D sweep_way u8
# 031169 "LDB #$37,X; LDB B,U", 03117A "LDA #$37,X; INCA; ANDA #$1F; STA #$37,X"; 0335C6, 0335D7
scoped object cloud_devil 37 bob_phase u8
scoped object flying_saxophone 37 bob_phase u8
# 030FCD "LDD #$16,X; STD #$50,X", 031085 "ADDD #$50,X"; 033433, 0334E2
scoped object cloud_devil 50 kept_height u16
scoped object flying_saxophone 50 kept_height u16
# 03325B "STD #$3E,X" (flying_saxophone_descent_slowdowns), 033305 "LDD #$0F,X; SUBD #$3E,X"
scoped object flying_saxophone 3E descent_slowdown u16
# 033267 "STD #$52,X" (flying_saxophone_descent_y_speeds), 0332C5 "LDD #$52,X; STD #$14,X"
scoped object flying_saxophone 52 descent_y_speed s16
# 033389 "LDA #$04; STA #$3C,X", 0333C6 "DEC #$3C,X", 0333D3 "LDA #$3C,X; ANDA #$03" (flying_saxophone_volley_shots), 033402
scoped object flying_saxophone 3C shots_left u8

# ---- barney_bystander ----
# 0315BD "INC #$3C,X; LDA #$3C,X; ANDA #$03; LDA A,U" (barney_animations)
scoped object barney_bystander 3C pose u8

# ---- woman_in_green_carrier ----
# 031623 "STU #$40,X" (the goon it put in), 03164B "LDU #$40,X; LDA #$02,U", 031695 "LDU #$40,X; LDA #$02; STA #$02,U"
scoped object woman_in_green_carrier 40 carried_goon u16 object

# ---- robot ----
# 032DC6 "DEC #$3D,X; LDA #$3D,X; ANDA #$07" (robot_actions_after_hit, robot_status_after_hit)
scoped object robot 3D hit_round u8
# 032DB0 "STA #$43,X" (C4), 032C05 "LDA #$43,X; BNE $6C6D" (it flashes), 032C51 "CLR #$43,X"
scoped object robot 43 flashing u8

# ---- robot_scrap ----
# 032948 "INC #$31,X" (setup), 032950 "CLR #$31,X", 0329CA "LDA #$31,X; BNE" (lying, not kept on the floor)
scoped object robot_scrap 31 lying u8
# 032953 "LDD #$0180; STA #$3D,X", 0329CF "LDA #$3D,X; BNE $69B3" (carried: its holder's priority), 032965 "CLR #$3D,X"
scoped object robot_scrap 3D carried u8

# ---- bouncing_prop ----
# 032070 "LDU #$2A,X; LDA #$00,U; BNE" (gone: done)
scoped object bouncing_prop 2A owner u16 object
# 03214E "LDA #$03; STA #$3C,X", 03224A "DEC #$3C,X"
scoped object bouncing_prop 3C bounces_left u8
# 032078 "INC #$37,X", 032251 "LDA #$01; STA #$37,X", 0321F0 "LDA #$37,X; BEQ" (then it leaves)
scoped object bouncing_prop 37 done u8

# ---- ninja ----
# 0326FC "LDA #$36,X; STA #$35,X", 03271C "LDA #$35,X; CMPA #$40" (the side it jumps toward)
scoped object ninja 35 jump_direction u8
# 032796 "CLR #$3D,X", 0327A4 "INC #$3D,X", 032827 "LDA #$3D,X; BNE", 03284B "INC #$3D,X" (bounced off the edge)
scoped object ninja 3D bounced u8
# 032702 "LDA #$02; STA #$3C,X", 032736 "DEC #$3C,X"; 032570 "LDA #$03; STA #$3C,X", 032596 "DEC #$3C,X"
scoped object ninja 3C loops u8

# ---- goon_lift_part ----
# 032FB6 "STA #$3D,X" (channel_6_scenery_part.parent_step), 032FCD "CMPA #$3D,X"
scoped object goon_lift_part 3D lift_step u8
# 032FB9 "STB #$3C,X" (channel_6_scenery_part.wait), 032FDB "DEC #$3C,X"
scoped object goon_lift_part 3C wait u8

# ---- dreamland_boss ----
# 0340E9 "STA #$31,X", 03409E "LDA #$31,X; ASLA; LDU A,U" (object_1a_level_rows), 03408C "LDA #$31,X; LDA A,U" (77BC)
scoped object dreamland_boss 31 phase u8
# 0340F9 "STA #$45,X", 03424B "LDB #$45,X; JMP $6077", 03427A "LDB #$45,X; STB #$02,X"
scoped object dreamland_boss 45 resume_step u8
# 034106 "LDB #$52,X; ASLB; JMP [B,U]", "INC #$52,X"
scoped object dreamland_boss 52 routine_step u8
# 034408 "LDB #$4E,X; ASLB; JMP [B,U]", "INC #$4E,X"
scoped object dreamland_boss 4E change_step u8
# 0344EE "DEC #$4F,X; LDA #$4F,X; ANDA #$07" (every eighth hit), 034C18 "DEC #$4F,X; ... ANDA #$0F"
scoped object dreamland_boss 4F hit_count u8
# 034261 "LDA #$08; STA #$53,X", 034268 "DEC #$53,X"
scoped object dreamland_boss 53 flash_time u8
# 0343BE "INC #$50,X", 0343AB "LDA #$50,X; BNE"; 0343A5 "INC #$51,X", 034392 "LDA #$51,X; BNE"; 034388 "CLRW #$50,X"
scoped object dreamland_boss 50 bounced_across u8
scoped object dreamland_boss 51 bounced_in_depth u8
# 034296 "LDA #$08; STA #$3C,X", 0342BD "DEC #$3C,X" (the chase's legs)
scoped object dreamland_boss 3C legs_left u8
# 034686 "STB #$44,X" (2C / 16), 034692 "LDB #$44,X; LDB B,U" (object_1a_leap_speeds, object_1a_leap_heights)
scoped object dreamland_boss 44 leap_distance u8
# 034BCB "STU #$40,X" (its chain's base), 034C54 "LDU #$40,X; LDU #$40,U"
scoped object dreamland_boss 40 chain u16 object
# 0344FA "LDA #$01; STA #$43,X", 0344A1 "LDA #$43,X; BEQ; LDB #$45,X; JMP $6077" (it goes on with its routine while it
# flashes)
scoped object dreamland_boss 43 keeps_acting u8

# ---- dreamland_boss_chain (type FF) ----
# 0350E4 "STY #$2E,X" (the base's: its holder), 035146 "STY #$2E,U" (a link's: the piece before), 035088 "LDY #$002E,X;
# LDA #$FE; STA #$02,Y"
scoped object dreamland_boss_chain 2E previous_link u16 object
# 035149 "STU #$2C,Y", 03518D "LDY #$2C,X", 035288 "LDY #$2C,X"
scoped object dreamland_boss_chain 2C next_link u16 object
# 0350E7 "STX #$2A,X", 035143 "STX #$2A,U" (the chain's base)
scoped object dreamland_boss_chain 2A chain_base u16 object
# 035155 "LDA <$F4; STA #$32,U" (its place in the chain), 03527C "LDA #$32,X; STA #$08,X"
scoped object dreamland_boss_chain 32 link_index u8
# 035168 "STD #$40,Y" (the head), 0352E7 "LDU #$40,X; LDA #$00,U"
scoped object dreamland_boss_chain 40 chain_head u16 object
# 03519C "LDD <$E8; STD #$50,X", 0351A2 "LDD <$EA; STD #$52,X", 03528E "ADDD #$50,X", 0352B2 "ADDD #$52,X"
scoped object dreamland_boss_chain 50 next_dx s16
scoped object dreamland_boss_chain 52 next_dz s16
# 035196 "LDA #$37,X; LBSR $7472" (the direction of the next piece), 0351D5 "LDA #$3E,X; STA #$37,X", 0351DB "LDA #$35,X;
# STA #$3E,X" (the directions pass down, a frame each)
scoped object dreamland_boss_chain 37 direction u8
scoped object dreamland_boss_chain 3E next_direction u8
scoped object dreamland_boss_chain 35 queued_direction u8

# ---- dreamland_boss_chain_head (type FE) ----
# 03532B "LDY #$79F3; STY #$2C,X" (object_1a_path), 035364 "LDY #$2C,X; LDD ,Y++", 03539E "STY #$2C,X"
scoped object dreamland_boss_chain_head 2C path u16
# 035326 "LDA #$02; STA #$33,X", 03536E "DEC #$33,X", 035376 "STA #$33,X"
scoped object dreamland_boss_chain_head 33 path_loops u8
# 0353AA "DEC #$50,X; LDA #$50,X; ANDA #$07" (object_1a_path_starts)
scoped object dreamland_boss_chain_head 50 lash_index u8
# 0353C9 "STB #$3A,X", 03540F "DEC #$3A,X"
scoped object dreamland_boss_chain_head 3A lash_time u8
# 0353D4 "STA #$4F,X", 035401 "LDA #$3A,X; CMPA #$4F,X" (its sound's moment)
scoped object dreamland_boss_chain_head 4F sound_time u8
# 035395 "LDU #$2A,X; STD #$3E,U"
scoped object dreamland_boss_chain_head 2A chain_base u16 object

# ---- boss_ball ----
# 034E96 "STA #$36,X; SUBA #$3E,X; ASRA x3; STA #$3F,X", 034F15 "LDA #$3E,X; ADDA #$3F,X; STA #$3E,X; LDB #$40; LBSR
# $8617"
scoped object boss_ball 3E heading u8
scoped object boss_ball 3F turn u8


# ======== locals: the objects the registers hold ========
# 0305BE "LDU #$40,X": the object it drifts toward (field 40, from work RAM 1854)
local rising_zombie_aim 0305BE u drift_target object
# 0306FB "LDU #$38,X": the player it goes after (field 38)
# 030721 "LDU #$38,X": the player it goes after (field 38)
# 0307DB "LDU #$38,X": the player it holds (field 38)
# 030BDA "LDU #$38,X": the player it goes after (field 38)
local knight_fall 030BDA u target_player object
# 031092 "LDU #$38,X": the player it circles (field 38)
# 031108 "LDU #$38,X": the player it circles (field 38)
# 0313C5 "LDU #$40,X": the object that let it out (field 40)
local moe_stop 0313C5 u parent object
# 031401 "LDU #$40,X": the object that let it out (field 40)
local moe_show_parent 031401 u parent object
# 03164B "LDU #$40,X": the goon it carries (field 40, 031623 "STU #$40,X")
local woman_in_green_carrier_carry 03164B u carried_goon object
# 031659 "LDU #$40,X": the goon it carries (field 40)
local woman_in_green_carrier_carry 031659 u carried_goon object
# 031695 "LDU #$40,X": the goon it carries (field 40)
local woman_in_green_carrier_set_down 031695 u carried_goon object
# 032070 "LDU #$2A,X": the object in field 2A
local bouncing_prop_check_owner 032070 u owner object
# 0326F6 "LDU #$38,X": the player it goes after (field 38)
local ninja_jump_attack_start 0326F6 u target_player object
# 032FC7 "LDU #$40,X": the lift that put it in (field 40)
local goon_lift_part_wait_for_lift 032FC7 u lift object
# 03320B "LDU #$38,X": the player it circles (field 38)
local flying_saxophone_face_player 03320B u target_player object
# 0334EF "LDU #$38,X": the player it circles (field 38)
# 033565 "LDU #$38,X": the player it circles (field 38)
# 03430C "LDU #$38,X": the player it goes after (field 38)
local dreamland_boss_check_in_line 03430C u target_player object
# 034354 "LDU #$38,X": the player it charges at (field 38)
local dreamland_boss_charge_dash 034354 u target_player object
# 034529 "LDU #$38,X": the player it goes after (field 38)
local dreamland_boss_first_form_hit_start 034529 u target_player object
# 034689 "LDU #$38,X": the player it leaps at (field 38)
local dreamland_boss_leap_take_off 034689 u target_player object
# 034C54 "LDU #$40,X": its chain's base (field 40, 034BCB "STU #$40,X")
local dreamland_boss_lash_start 034C54 u chain object
# 034C57 "LDU #$40,U": the chain's head (the base's field 40)
local dreamland_boss_lash_start 034C57 u chain_head object
# 034C95 "LDU #$40,X": its chain's base (field 40)
local dreamland_boss_defeat_start 034C95 u chain object
# 034C98 "LDU #$40,U": the chain's head (the base's field 40)
local dreamland_boss_defeat_start 034C98 u chain_head object
# 034CE2 "LDU #$40,X": its chain's base (field 40)
local dreamland_boss_defeat_pop_chain 034CE2 u chain object
# 034CE5 "LDU #$40,U": the chain's head (the base's field 40)
local dreamland_boss_defeat_pop_chain 034CE5 u chain_head object
# 034E90 "LDU #$38,X": the player it homes in on (field 38)
local boss_ball_fly_out 034E90 u target_player object
# 034EBF "LDU #$38,X": the player it homes in on (field 38)
local boss_ball_fly_out 034EBF u target_player object
# 034EE2 "LDU #$38,X": the player it homes in on (field 38)
local boss_ball_home_in 034EE2 u target_player object
# 034FBB "LDU #$40,X": the boss it is the shadow of (field 40)
local dreamland_boss_shadow_follow 034FBB u boss object
# 035038 "LDU #$38,X": the object holding the chain (field 38: 034BC8 "STX #$38,U")
local dreamland_boss_chain_follow_facing 035038 u holder object
# 0350E1 "LDY #$38,X": the object holding the chain (field 38)
local dreamland_boss_chain_setup 0350E1 y holder object
# 035184 "LDU #$38,X": the object holding the chain (field 38)
local dreamland_boss_chain_lead 035184 u holder object
# 03518D "LDY #$2C,X": the next piece of the chain (field 2C: 035149 "STU #$2C,Y")
# 035218 "LDU #$38,X": the object holding the chain (field 38)
local dreamland_boss_chain_stay_at_holder 035218 u holder object
# 035285 "LDU #$2E,X": the piece before (field 2E: 035146 "STY #$2E,U")
# 035288 "LDY #$2C,X": the next piece of the chain (field 2C)
local dreamland_boss_chain_link_follow 035288 y next_link object
# 0352C4 "LDU #$2E,X": the piece before (field 2E)
# 0352E7 "LDU #$40,X": the chain's head (field 40: 035168 "STD #$40,Y")
local dreamland_boss_chain_link_follow 0352E7 u chain_head object
# 035345 "LDU #$38,X": the object holding the chain (field 38)
local dreamland_boss_chain_head_setup 035345 u holder object
# 035352 "LDU #$38,X": the object holding the chain (field 38)
local dreamland_boss_chain_head_follow_path 035352 u holder object
# 035385 "LDU #$38,X": the object holding the chain (field 38)
local dreamland_boss_chain_head_follow_path 035385 u holder object
# 035395 "LDU #$2A,X": the chain's base (field 2A: 035143 "STX #$2A,U")

# ======== banks 1B-1D ========
# ======== banks 1B, 1C, 1D: names ========
# Places are the program's offsets; quotes are build/listing/simpsons.s's instructions. Who each object is comes from
# the list dispatchers' type tables (07CB6C/07CB7E 4F80, 07CBAD/07CBBF 5280, 07CBE0/07CBF2 4D40, read from the ROM):
# bank 1B: 5280 types 0C (6018), 0B (601B), 38 (601E), 2A (6021), 12 (6024); bank 1D: 4F80 F6 (6000), EC (6009), EA
# (6024); 5280 E2 (6027), E4 (6012), E5 (6015), E6 (6018), E7 (601B), F1 (6006); 4D40 1C (6003), 1D (6006), 21 (600F),
# 25 (6021), 26 (601E). Where each comes in: bank 1B's spawn_lists by scene (scene 0 stage 1, 5 stage 4, 9 stage 7,
# 11 stage 8), the list in a spawn's flags bits 2-3.

# ======== bank 1B: the doors that let enemies out, the car with doors, kind 93 ========

# ---- the files ----
# 036018-036024 are bank 1B's jump table (types 0C, 0B, 38, 2A, 12 of the 5280 list: 07F4B0/07F40D); 036027-036121
# kind 93's steps; 036121-036233 the car with doors; 03624E-0363C5 the doors
# (replaces symbols.txt's "036000  file  unsorted/bank_1B": 036000-036017 is spawn_lists)
036000  file  objects/doors    # the doors that open when the stage reaches them and let out enemies (kinds 0F, 10, 12), the car whose doors let enemies out, the kind-93 passer-by

# ---- the jump table: each type's handler, by the object's step (field 02) ----
# 036018 "LBRA $6314" (6314: "LDU #$6539; ASLB; JSR [B,U]", then 078683 "LBRA $D1E3": gone when off the screen's
# left): 5280 type 0C (the kind-0F door: its setup 03631D "LDU #$6547", kind 0F animation 0E)
036018  func  door_kind_0f_run
comment door_kind_0f_run The kind-0F door (5280 type 0C, stage 1 and stage 4): runs its step and leaves the screen with it.
# 03601B "LBRA $62A5" (62A5: "LDU #$64EC; ASLB; JSR [B,U]"): 5280 type 0B, kind 10 (setup 0362AE "LDU #$64F8"), stage
# 4's
# doors (spawn_lists scene 5, x 05E7, 0617, 0647)
03601B  func  door_kind_10_run
comment door_kind_10_run The kind-10 door (5280 type 0B, stage 4's shop fronts): runs its step and leaves the screen with it.
# 03601E "LBRA $6234" (6234 "LDU #$6474; ASLB; JSR [B,U]", then "LDD #$0C,X; SUBD #$0030; CMPD #$0190; BCS; CLR
# #$00,X"): 5280 type 38, kind 12 (setup 03624E "LDU #$6482"), stage 7's (spawn_lists scene 9, x 0227 0297 0307 0557)
03601E  func  door_kind_12_run
comment door_kind_12_run The kind-12 door (5280 type 38, stage 7's glass doors): runs its step and is gone once its x leaves 30-1C0.
# 036021 "LBRA $6027" (036027 "LDU #$6418; ASLB; JSR [B,U]; LBRA $8683"): 5280 type 2A, kind 93 (setup 036030 "LDU
# #$6430": 93 01), stage 1 (spawn_lists scene 0, x 01B8)
036021  func  kid_in_sunglasses_run
comment kid_in_sunglasses_run The kind-93 passer-by of stage 1 (5280 type 2A): runs its step and leaves the screen with it.
# 036024 "LBRA $6121" (036121 "LDU #$6436; ASLB; JSR [B,U]", then "LDD #$0C,X; CMPD #$0030; BCC; CLR #$00,X"): 5280
# type 12, kind 0F police_car_and_doors (setup 036133 "LDU #$644E": 0F09), stage 1 (spawn_lists scene 0, x 0228)
036024  func  car_doors_run
comment car_doors_run The car whose doors open and let enemies out (5280 type 12, kind 0F police_car_and_doors, stage 1): runs its step and is gone once its x is below 30.

# ---- kind 93 ----
# 036030 "LDU #$6430; LBSR $85AB" (07D132: the object's setup record), "LDA #$80; STA #$00,X", 09's priority bits 20,
# "INC #$02,X"
036030  func  kid_in_sunglasses_start
comment kid_in_sunglasses_start Sets kind 93 up from its setup record, shown, at its first priority, and goes on to wait for the scroll.
# 036049 "LDD <$AC; CMPD #$0120; BCS": the stage's x scroll (48AC) at 120 or more
036049  func  kid_in_sunglasses_wait_for_scroll
comment kid_in_sunglasses_wait_for_scroll Waits until the stage has scrolled to 120.
# 036055 "LDD #$0200; STD #$0F,X", "LDA #$82; STA #$05,X", "LDA #$2C; STA #$3B,X", then 0785C6 (07D232: faces its x
# speed)
036055  func  kid_in_sunglasses_run_in
comment kid_in_sunglasses_run_in Runs right (x speed 0200, animation 82) for 44 frames.
# 03606B "DEC #$3B,X", "LDD #$E830; LBSR $8617" (07CC8E: speed 30 in direction E8), "LDA #$81; STA #$05,X"
03606B  func  kid_in_sunglasses_turn_away
comment kid_in_sunglasses_turn_away When its frames run out, heads off at speed 30 in direction E8 with animation 81.
# 03607F "CLRD; LBSR $8638" (079495: the block flags where it stands), "TSTA; BMI; BITA #$0F; BNE": a floor of height 0;
# then 09's priority bits 10
03607F  func  kid_in_sunglasses_wait_for_floor
comment kid_in_sunglasses_wait_for_floor Waits until it stands on a floor of height 0, then takes the second priority.
# 036098 "LDD #$0080; STD #$14,X", "LDD #$0140; STD #$0F,X", "LDA #$82", "LDA #$0C; STA #$3B,X"
036098  func  kid_in_sunglasses_walk_down
comment kid_in_sunglasses_walk_down Walks right and down (x speed 0140, y speed 0080, animation 82) for 12 frames.
# 0360B5 "DEC #$3B,X", "CLRW #$0F,X; CLRW #$14,X", "LDA #$83", "ORA #$40" (faces left), "LDA #$40; STA #$3B,X"
0360B5  func  kid_in_sunglasses_stop
comment kid_in_sunglasses_stop When its frames run out, stops facing left (animation 83) for 64 frames.
# 0360D6 "DEC #$3B,X", "LDA #$83", "CLRW #$0F,X", "LDA #$40; STA #$3B,X"
0360D6  func  kid_in_sunglasses_stand
comment kid_in_sunglasses_stand When its frames run out, stops (animation 83) for 64 frames, after its dash.
# 0360EC "DEC #$3B,X", "LDA #$82", "LDD #$FE00; STD #$0F,X", "LDA #$10; STA #$3B,X"
0360EC  func  kid_in_sunglasses_walk_left
comment kid_in_sunglasses_walk_left When its frames run out, walks left (x speed FE00, animation 82) for 16 frames (after each stop).
# 036107 "RTS" (the last step's)
036107  func  kid_in_sunglasses_idle
comment kid_in_sunglasses_idle Its last step: nothing (it walks on at its speed until it leaves the screen).
# 036108 "DEC #$3B,X", "LDA #$84", "LDA #$18; STA #$3B,X", "LDD #$FB00; STD #$0F,X"
036108  func  kid_in_sunglasses_dash_left
comment kid_in_sunglasses_dash_left When its frames run out, dashes left (x speed FB00, animation 84) for 24 frames.

# ---- the car with doors (5280 type 12; bank 15's police car, kind C3, is another object) ----
# 036133 "LDU #$644E; LBSR $85AB" (setup 0F09: kind 0F, animation 09), "LDA #$80; STA #$00,X"
036133  func  car_doors_start
comment car_doors_start Sets the car up from its setup record and shows it.
# 036142 "LDD <$AC; CMPD #$0120", "LDA #$2C; STA #$3B,X"
036142  func  car_doors_wait_for_scroll
comment car_doors_wait_for_scroll Waits until the stage has scrolled to 120, then 44 frames more.
# 036153 "DEC #$3B,X; BNE"
036153  func  car_doors_wait
comment car_doors_wait Counts its frames down.
# 03615C "LDA #$C0; STA #$00,X", "LDD #$6000; LBSR $8680" (sound 60), "LDA #$8A; STA #$05,X", "LDA #$10; STA #$3B,X"
03615C  func  car_doors_open
comment car_doors_open Opens its doors (animation 8A, sound 60) and can be hit while they open, for 16 frames.
# 036175 "DEC #$3B,X", "LDA #$80; STA #$00,X", "LDA #$8B"
036175  func  car_doors_hold_open
comment car_doors_hold_open When its frames run out, holds its doors open (animation 8B).
# 036188 "LDA #$06,X; BITA #$01" (its animation ended), "LDA #$20; STA #$3B,X"
036188  func  car_doors_wait_for_animation
comment car_doors_wait_for_animation When its animation ends, waits 32 frames more.
# 036197 "LDA #$3B,X; CMPA #$18; BCS" then "EORA #$17,X" (the height's low byte by the count's bit 0: it shakes),
# "DEC #$3B,X", "LBSR $61B9", "LDA #$36; STA #$3B,X"
036197  func  car_doors_shake_and_unload
comment car_doors_shake_and_unload Shakes up and down for 8 frames, then lets its enemies out and waits 54 frames.
# 0361B9 (symbols.txt: door_spawn_lists) "LDU #$6454; LDA #$30,X; ASLA; LDY A,U", "LDA ,Y+; CMPA #$7F" (the end),
# "CMPA $1874" (the players in the game), "INC #$3A,X", "LBSR $862C" (07CA8A: the child object), "LEAY #$08,Y",
# then "ASLA x4" into 3A
0361B9  func  car_doors_let_out_enemies
comment car_doors_let_out_enemies Puts in the enemies of its door_spawns list (by spawn_list) that the players in the game call for, counting them in spawned (then 16 frames each).
# 0361E7 "DEC #$3B,X", "LDA #$C0", "LDA #$3A,X; STA #$3B,X", sound 60, "LDA #$8C"
0361E7  func  car_doors_close
comment car_doors_close When its frames run out, waits 16 frames for each enemy it let out while it closes its doors (animation 8C, sound 60).
# 036206 "DEC #$3B,X", "LDA #$8D", "LDA #$80; STA #$00,X"
036206  func  car_doors_closed
comment car_doors_closed When its frames run out, shows its doors closed (animation 8D); it can not be hit.
# 036219: 036197's shake without the enemies
036219  func  car_doors_shake
comment car_doors_shake Shakes up and down for 8 frames.
# 036233 "RTS"
036233  func  car_doors_idle
comment car_doors_idle Its last step: nothing.

# ---- the doors ----
# 03624E "LDU #$6482; LBSR $85AB" (kind 12 animation 09), channel_6_scenery_door_openings by field 30 (symbols.txt), "STD
# #$3E,X", "STB #$30,X", "CLR #$09,X"
03624E  func  door_kind_12_start
comment door_kind_12_start Sets the kind-12 door up from its setup record and its channel_6_scenery_door_openings record (by its spawn state): where it opens and which list it lets out.
# 036275 "LDA #$C0; STA #$00,X", "LDA #$08; STA #$1D,X" (the strength it hits with: a player hit by 08 is knocked
# down, 039523), sound 60, "LDA #$8A"
036275  func  door_kind_12_open
comment door_kind_12_open Opens (animation 8A, sound 60), hitting what it touches with strength 08 (a player is knocked down).
# 03628E "CLR #$3A,X", "LDU #$6498", then 03637E
03628E  func  door_kind_12_let_out_enemies
comment door_kind_12_let_out_enemies Lets out its list of enemies (the kind-12 doors' lists).
# 036297 "DEC #$3B,X", "LDA #$8B"
036297  func  door_kind_12_close
comment door_kind_12_close When its frames run out, closes (animation 8B).
# 0362AE "LDU #$64F8; LBSR $85AB" (kind 10), moes_street_scenery_door_openings, "STA #$3B,X; STB #$30,X" (the wait as well)
0362AE  func  door_kind_10_start
comment door_kind_10_start Sets the kind-10 door up from its setup record and its moes_street_scenery_door_openings record: where it opens, how long it waits and which list it lets out.
# 0362D8 "DEC #$3B,X", "LDA #$C0", sound 60, "LDD #$0F95; STD #$04,X" (kind 0F animation 95), 09 "ANDA #$30; ORA #$83"
0362D8  func  door_kind_10_open
comment door_kind_10_open When its wait runs out, opens (kind 0F, animation 95, sound 60), hitting what it touches with strength 08.
# 036301 "LDA #$06,X; BITA #$01; BEQ; CLR #$00,X"
036301  func  door_kind_10_finish
comment door_kind_10_finish When its animation ends, it is gone.
# 03630B "CLR #$3A,X", "LDU #$650A", then 03637E
03630B  func  door_kind_10_let_out_enemies
comment door_kind_10_let_out_enemies Lets out its list of enemies (the kind-10 doors' lists).
# 03631D "LDU #$6547; LBSR $85AB" (kind 0F animation 0E), kind_0f_door_openings
03631D  func  door_kind_0f_start
comment door_kind_0f_start Sets the kind-0F door up from its setup record and its kind_0f_door_openings record: where it opens and which list it lets out.
# 036344 "LDD #$0C,X; CMPD #$3E,X; BCC; INC #$02,X" (the doors of the three kinds)
036344  func  door_wait_for_place
comment door_wait_for_place Waits until the door's x on the screen comes below the place it opens at.
# 036350 "LDA #$C0", "LDA #$08; STA #$1D,X", sound 60, "LDA #$8F"; the steps of the kinds: 036539 (0F), 0364EC (10),
# 036474 (12), each the place-wait 036344 second
036350  func  door_kind_0f_open
comment door_kind_0f_open Opens (animation 8F, sound 60), hitting what it touches with strength 08.
# 036369 "LDA #$06,X; BITA #$01", "LDA #$80; STA #$00,X"
036369  func  door_wait_for_animation
comment door_wait_for_animation Goes on when its animation ends; it can not be hit any more.
# 036378 "CLR #$3A,X", "LDU #$655D", then 03637E
036378  func  door_kind_0f_let_out_enemies
comment door_kind_0f_let_out_enemies Lets out its list of enemies (the kind-0F doors' lists).
# 03637E "LDA #$30,X; ASLA; LDY A,U" (U: the kind's lists), "LDA ,Y+; CMPA #$7F" (the end), "CMPA $1874" (players in
# the game), "INC #$3A,X; LBSR $862C" (07CA8A), "LEAY #$08,Y", then 3B = 3A x 16, or 18 when the list is empty
03637E  func  door_let_out_list
comment door_let_out_list Puts in the enemies of the door's list (U, by spawn_list) that the players in the game call for, and waits 16 frames for each (24 if none).
# 0363B8 "DEC #$3B,X", "LDA #$90"
0363B8  func  door_kind_0f_close
comment door_kind_0f_close When its frames run out, closes (animation 90).
# 0363C5 "RTS"
0363C5  func  door_idle
comment door_idle A door's last step: nothing.

# ---- their fields ----
# the doors' (door_ functions; the door_kind_XX families extend it): 03624E/0362AE/03631D "STB #$30,X" (the list
# number from the opening record; before it, 30 is the spawn's state, 07C9FE, which picks the opening record),
# 03637E "LDA #$30,X; ASLA; LDY A,U"
scoped object door 30 spawn_list u8
# 03628E "CLR #$3A,X", 03637E "INC #$3A,X" (each enemy let out), "LDA #$3A,X; ASLA x4; STA #$3B,X"
scoped object door 3A spawned u8
# 0362C8 "STA #$3B,X" (the opening's wait), 0362D8 "DEC #$3B,X", 0363B8 "DEC #$3B,X"
scoped object door 3B timer u8
# 036263 "LDD ,U; STD #$3E,X" (door_opening x), 036344 "CMPD #$3E,X"
scoped object door 3E open_x u16
# the car's: 0361BC "LDA #$30,X; ASLA; LDY A,U" (door_spawn_lists), 0361C8 "INC #$3A,X", 036142 "STA #$3B,X"
scoped object car_doors 30 spawn_list u8
scoped object car_doors 3A spawned u8
scoped object car_doors 3B timer u8
# kind 93's: 036062 "STA #$3B,X", 03606B "DEC #$3B,X"
scoped object kid_in_sunglasses 3B timer u8
# the doors' list pointer (03637E's U: the kind's table of lists, 0361BC's door_spawn_lists)
param door_let_out_list u lists

# ======== bank 1C: the players ========
# Bank 1C runs the 4 players' objects (4A40 + C0 x player, each with its second sprite at +60, bank 1F's). Every
# function gets the player's object in U (038003-038073 "LDU #$4A40 ... LDU #$4B00 ..."), not in X: the param lines
# below type it object.player so the C reads the player's fields by the scoped lines at the end of this section.
# A player's state is field 30, run through the table at 039D51 (038290 "LDB #$30,U; CLRA; ASLB; LDY #$7D51; JMP
# [D,Y]"; 64 entries, 7D51-7DD0, then states 40 and 41 at 7DD1/7DD3, the unreached_ handlers). States: 00 standing,
# 02 jump, 03 fall, 04/05 throwing what it carries, 06/07 swinging weapon 6/7, 08 throwing weapon 8, 09-0C the attack
# moves, 0D the jump kick, 0F/3C/3D/3E flung to the back, 0E/17/28 dropping after a crash, 11 squashed, 14 knocked
# flying, 15/16 knocked down, 18/19 knocked up, 1A/1B stunned, 1C grabbed, 1F losing a life, 20-22 the last life's
# end, 26/27 joining, 29 an attack's start, 2A a 32-frame pose, 2B throwing a weapon away, 2C working at a heavy object,
# 2D heaving it with another player, 2F lifting, 30-34 a team move, 35-38 team attacks, 3A/3B grabbed and hit,
# escaping; 01, 25, 2E, 39 (the team's passenger), 3F do nothing but keep the life in the record. Animations are the
# character's (field 04: 0 Marge, 1 Homer, 2 Bart, 3 Lisa) set's: 80 standing, 01/02 walking, B5-B8 the attacks, D0-DF
# the hit reactions.

# ---- the files ----
# (the line at 038000 replaces symbols.txt's "038000  file  unsorted/bank_1C")
038000  file  players/players    # the four players run each frame with their controls, and how a player joins the stage
0382B9  file  players/states    # the players' states: standing, walking, jumping, attacks, weapons, carrying, team moves, hit reactions, losing a life
0392F0  file  players/reactions    # what touches a player each frame: pickups, weapons, blows by their strength, another player's team-up
03978A  file  players/motion    # a player's motion against walls, floors, the screen's edges and the scroll, and helpers on its speeds and partner
039B0C  file  players/effects    # a player's blinking, hit sparks, balloons and voices: the second sprite at +60 and the sounds by character

# ---- running the players ----
# 038000 "LBRA $6003" (07B5DD, 07B676 call bank 1C's 6000): 038003 "CLR $184C; CLR $184D; CLRW <$E6", then for each
# player "LDA <$40; LDB <$42; PUSHS D; PULLS Y" (its controls and newly pressed ones), "LDU #$4A40; LDX #$49D0; STX
# $1848; LDD #$0100; LBSR $60AB" ... (4B00/49D8/0201, 4BC0/49E0/0402, 4C80/49E8/0803), then 038076 "CLR $184E; TST
# $184B" (a stage's end) "LDA $184C; CMPA #$04" (all four idle) "STA $184E", 038091-0380A0 "LDU #$3F,X ... CLR #$00,U"
038000  func  player_run_all
comment player_run_all Runs the four players' objects with their controls and records, adding their y scroll requests; at a stage's end, once all four stand idle, says so in 184E and removes the objects they carry.
local player_run_all 03808C,0380A3 x player object.player
# 0380AB "BITA <$50" (the player's bit in the players in the game), "TST #$03,X" (its record's: entered), 0380F7 the
# entry ("LDB #$34,U; LDA #$80; STA #$05,U", "LEAX #$1C,X; LDU #$003D; CLRA; BSET" clears 1C-58, "LDA #$28; STA
# #$1B,U", "STB #$5B,U; STB #$00BB,U" the player's number in both sprites, "LDB #$01; STB #$03,X"), by scene:
# 038151 "CMPA #$04 / #$0B" drops in from above (state 27, animation BB, 0381AB), else jumps in from the left (state 26,
# animation BA, 03822B "LDX #$0E00; STX #$0F,U"); 0380F1 "STY #$2E,U" (controls), 0380BB "TST $184B" (none at a
# stage's end), 038286 "INC #$4F,U" (up to 0E), 038290 the state table
0380AB  func  player_run
comment player_run Runs one player: when its record says it has not entered yet, sets it up afresh (full life unless it rejoins) and brings it in, jumping in from the left or dropping from above in scenes 4 and 0B, or blinking in place when it rejoins; then takes its controls (none at a stage's end, where its team-up is undone) and runs its state.
param player_run y controls
param player_run u player object.player
param player_run d bit_and_number
# 038200 "LDX #$0040; STX #$0C,U; CLR <$F3; LDA #$08", "LBSR $786D; BCS" (a wall), "CMPB <$F3; BLE; STB <$F3" (the
# highest floor), "LEAX #$08,X", "CLRA": the place it jumps in at (0381C3-0381FD try depths B8, B0 ... then C0 on)
038200  func  player_find_entry_floor
comment player_find_entry_floor Checks the 8 places 8 pixels apart from x 40 at the player's depth for a way in: carry when one is a wall; the highest floor met in F3.
param player_find_entry_floor u player object.player

# ---- standing, walking, jumping ----
# state 32 (039D51 entry 32): 0382B9 "LDX #$32,U" (the partner), "LDA #$2F,U; ORA #$2F,X; BITA #$20" (either's jump:
# 0384F4, state 33), "BITA #$10" (attack: 0386E1 for moves 2-3, 038314 "LDD #$0413; STD #$1C,U; LDY #$7F5D" the faster
# walk with a hit for moves 0-1; move 1's 038309/03830E voices 3F2B/3F2A), 038326 "LDA <$16; BITA #$0F; LDD #$0411;
# STD #$1C,U" (a hit every 16 frames), 03834F/038374 the joystick of the leader or both (0383D4)
0382B9  func  player_team_move
comment player_team_move Two players teamed up, moving together: either one's jump starts the team jump, attack the team attack (moves 2 and 3) or a faster run that hits (moves 0 and 1); otherwise they walk by their joysticks, hitting what they touch every 16 frames.
param player_team_move u player object.player
# state 00: 03839C "LDD #$16,U; CMPD #$5C,U; BGT" (in the air: state 03), "LDB #$2F,U; BITB #$20" (jump: 0385D5),
# "BITB #$10" (attack: 038715), "BITB #$0F" (a new direction: 4F/50 count the quick presses), 0383C9 "LDA #$2E,U;
# ANDA #$0F" (walk: 0383D4), 038471 standing ("INC $184C"; 38 counts the idle frames: at A0 voice 3F10, balloon 2,
# animation AF; 39 counts to 20, then 0384B5 "ADDA #$80; STA #$1D,U": it offers a team move, strength 80 + its
# character); 0385D5 both buttons at once: the jump kick (038844) or throwing a held weapon away (state 2B); 03861B
# the jump (19 = 0780, state 02); 038715 the attack: pick up what it touches (1E FF, an object whose 1D is FF: kinds
# 06-08 into 40 as a weapon, others held in 3F, state 2F animation BD), work at a heavy object (1E FE: state 2C), use
# what it
# holds (0387D2) or attack (03886D)
03839C  func  player_stand
comment player_stand The player standing: jumps, attacks, picks up or uses what it touches, walks by its joystick, gets bored after 160 idle frames and, after 32 still frames, offers a team move to a player that touches it.
param player_stand u player object.player
# 0383D4 (A = the joystick, Y = player_walk_velocities or 7F5D, the faster half): "LEAY A,Y; LDD ,Y++; STD #$0F,U",
# "ANDA #$40" (facing), "TST #$39,U; BPL" (teamed: the partner faces the same way), "LBSR $78A9" (the scroll and y
# speed), "TST #$38,U" (the walk animation once: 01, 02 when going down, 81/82 again), 038413 "LBRA $7205" (teamed)
0383D4  func  player_walk
comment player_walk Walks the player by its joystick: its x and y speeds from the velocities Y points at, its facing (and its partner's), the scroll request, and the walking animation, or the team's when teamed up.
param player_walk u player object.player
param player_walk y velocities velocity
# state 33: 038510 "LDA #$2E,U; ORA #$2E,X; LBSR $788B" (both joysticks), "TST #$3C,U" / "CMPA #$02" (team attack in
# the air for moves 2-3: 0386E1), "INC #$31,U; SUBD #$0040" (gravity), "BITA #$20" (jump held) "CMPA #$03" (3 frames)
038510  func  player_team_jump
comment player_team_jump A team going up in its jump, steered by both joysticks; the jump goes higher while either holds jump; moves 2 and 3 can attack in the air.
param player_team_jump u player object.player
# 038556 "LDA #$34; STA #$30,U; LDB #$F4; LBRA $71EB" (animation F4 by move and character)
038556  func  player_team_start_fall
comment player_team_start_fall Starts the team's fall (state 34) with its falling animation.
param player_team_start_fall u player object.player
# state 34: 038560 like 038510, "LBSR $7B38; BLE" (landed), "SUBD #$0040 ... #$0080" (falls faster, to FD00), 03859C
# both on the floor, "TST #$04,U; BEQ $65BF" (Marge leading: 0385BF "ASRDI #$01; NEGD", a bounce while it is big)
038560  func  player_team_fall
comment player_team_fall A team falling: lands both on the floor, back to moving together; a team Marge leads bounces first.
param player_team_fall u player object.player
# state 2B (set at 0385FA after 0385F3 "LDA #$0A; LBSR $7C2F": the weapon thrown as the second sprite, kind 40,
# animation 80): 038604 "BITA #$02; LDD #$1900; LBSR $8680" (sound 19 at the throw), "LSRA; LBCC" (animation end:
# 038C36)
038604  func  player_throw_weapon_away
comment player_throw_weapon_away Throwing its weapon away (both buttons with a weapon in hand): sound 19 at the throw, back to standing when the animation ends.
param player_throw_weapon_away u player object.player
# state 02: 038636 "LDA #$2E,U; LBSR $788B" (steered), "TST #$3C,U; ... CMPD #$0018; ... BITB #$10" (attack 18 above
# the floor: 0387C4), "INC #$31,U; SUBD #$0040; BMI" (falling: 038670), "BITA #$20" (jump held), "CMPA #$03" (or the
# first 3 frames), 038678 "LDB #$83 ... CMPX #$0480; LBGT; INCB" (animation 83 or 84)
038636  func  player_jump
comment player_jump The player going up in its jump, steered by its joystick: higher while jump is held, an attack once 24 above the floor, the fall once it stops rising.
param player_jump u player object.player
# 038670 "LDA #$03; STA #$30,U"
038670  func  player_start_fall
comment player_start_fall Puts the player in its falling state (03).
param player_start_fall u player object.player
# state 03: 03868A "LBSR $788B", the attack as in the jump, "LBSR $7B38; BLE" (landed: 0386B8), "SUBD #$0040 ...
# #$0080" (gravity), "LDB #$85" (animation 85)
03868A  func  player_fall
comment player_fall The player falling, steered by its joystick and able to attack, until it lands.
param player_fall u player object.player
# 0386B8 "LBSR $7BA4" (on the floor), "LDY #$5C,U; STY #$16,U", "CLRW #$19,U; CLRW #$0F,U", then 0386CA
0386B8  func  player_land
comment player_land Puts the player on the floor at a stop and standing.
param player_land u player object.player
# 0386CA "CLRW #$14,U; CLRW #$3B,U; LDD #$0100; STD #$38,U; CLR #$30,U; LDB #$80; LDY #$7E55; LBRA $7242"
0386CA  func  player_set_standing
comment player_set_standing Stops the player's y speed and sets it standing (state 00, animation 80 by what it holds).
param player_set_standing u player object.player

# ---- attacks ----
# 0387C4 "LDA #$09,U; ANDA #$40; STA #$2D,U" (the facing it attacks with), "LDX #$3F,U; LBEQ $686D" (nothing held: an
# attack, 03886D) else 0387D2
0387C4  func  player_attack_in_air
comment player_attack_in_air Attack pressed in a jump or fall: uses what the player holds, or starts an attack.
param player_attack_in_air u player object.player
# 0387D2 "LDD #$0040; STD #$53,U", "LDA #$40,U" (the weapon's kind) or "LDA #$04,X" (the carried object's), "SUBA
# #$04; TFR A,B; ASLA; LDY #$7DE1; JMP [A,Y]": kinds 4-8
0387D2  func  player_use_held
comment player_use_held Uses what the player holds by its kind (4-8): throws a carried object, swings or throws a weapon.
param player_use_held u player object.player
# kind 4 (039DE1 entry 0): 0387ED "LDA #$04,U; CMPA #$01" (Homer) "LDD #$04,X; ANDB #$7E; CMPD #$041A" (carrying a
# kind-04 object with animation 1A/1B): state 4 with animation E0; else 03880C
0387ED  func  player_start_throw_kind_4
comment player_start_throw_kind_4 Starts throwing a carried kind-4 object (state 04), with Homer's own animation E0 for the kind-04 object showing animation 1A.
param player_start_throw_kind_4 u player object.player
# kind 5: 03880C "CLR #$31,U; TFR B,A; ADDA #$04; ADDB #$B0; LBRA $6988" (state = the kind, animation B0 + kind - 4)
03880C  func  player_start_throw
comment player_start_throw Starts throwing what it carries: the state its kind gives (04 or 05) with animation B0 plus the kind less 4.
param player_start_throw u player object.player
# kind 6: 038818 "LDD #$6A00; LBSR $8680" (sound 6A), then 038822
038818  func  player_start_swing_6
comment player_start_swing_6 Starts swinging weapon 6, with its sound (6A).
param player_start_swing_6 u player object.player
# kind 7: 038822 "LDA #$3C; STA #$31,U", "TFR B,A; ADDA #$04; ADDB #$B0", "LDY #$0813" (its hit), "LBRA $6985"
038822  func  player_start_swing
comment player_start_swing Starts swinging its weapon (6 or 7): the state and animation by its kind, hit 0813.
param player_start_swing u player object.player
# kind 8: 038833 "TST #$60,U; LBNE" (the second sprite free), "LDB #$3C; STB #$31,U", "LDD #$08B4" (state 08,
# animation B4)
038833  func  player_start_throw_weapon_8
comment player_start_throw_weapon_8 Starts throwing weapon 8 (state 08, animation B4) when its second sprite is free.
param player_start_throw_weapon_8 u player object.player
# 03886D "LDA #$01; STA #$4E,U; STA #$3C,U", "CMPX #$5C,U; LBGT $6902" (in the air), "LDA #$4F,U; CMPA #$08" / "LDA
# #$50,U; CMPA #$04" (4 quick presses: 0388ED, moves 0B/0C alternating by 2B), else 03888C "LDX #$2010; STX #$1F,U;
# LDA #$29; STA #$30,U; ORA #$02" (state 29, the box out)
03886D  func  player_start_attack
comment player_start_attack Starts an attack: in the air a jump attack; after 4 quick presses of the joystick a dash attack (move 0B, every eighth one 0C); else state 29, which picks the move.
param player_start_attack u player object.player
# state 29: 0388A2 "LDD #$3F20; LBSR $7C50" (its shout), "LDA #$00,U; ANDA #$20" (the box touched something), "CMPX
# #$4F80 ... #$5280" (an enemy of the 4F80 list), faces it, 0388D1 "LDB #$4D,U; LDX #$7DEB; LDA B,X" (object_1c_move_
# steps), 0388E2 "LDX #$7DF7 ... LDD ,X++; LDY ,X" (object_1c_moves); else 038902
0388A2  func  player_choose_attack
comment player_choose_attack With its shout, plays the combo's next move (object_1c_move_steps, object_1c_moves) when the swing touches an enemy, turned to it; else a plain swing.
param player_choose_attack u player object.player
# 038902 "BITA #$03" (left or right held), "INC #$2B,U; CMPA #$03" (every third), "LDY #$0411; LDD #$09B5" (move 09,
# animation B5) / "LDY #$0412; LDD #$0AB6" (move 0A)
038902  func  player_plain_attack
comment player_plain_attack A swing that touched no enemy: move 09, every third one (or with left or right held) move 0A.
param player_plain_attack u player object.player
# 03892F "LDX #$16,U; CMPX #$5C,U; BLE $6985" (on the floor), else "BSR $693B; BRA $6995" (the air version)
03892F  func  player_start_move
comment player_start_move Starts the attack move in D (state and animation) with the hit in Y: in the air its jump version.
param player_start_move u player object.player
# 03893B "LDD #$3F20; LBSR $7C50", "SUBD #$5C,U; LDX #$7E07; CMPD #$0040; BGE; LEAX #$0A,X" (high or low), "LDY
# ,X++" (the hit), "STD #$53,U" (its gravity), "ORA #$02" (box out), "STD #$19,U", "LDX ,X; STX #$0F,U" (x speed by
# facing), "LDX #$0804; STX #$1F,U; LDA #$08; STA #$22,U"
03893B  func  player_start_jump_attack
comment player_start_jump_attack Sets up a jump attack by its height above the floor: its hit, gravity, up and x speeds and box, with the player's shout.
param player_start_jump_attack u player object.player
# 038985 "STY #$42,U", then 038988
038985  func  player_set_move_with_hit
comment player_set_move_with_hit Keeps the move's hit (Y) and sets the move.
param player_set_move_with_hit u player object.player
# 038988 "CMPX #$5C,U; BGT $6995", "CLRW #$0F,U", then 03899A
038988  func  player_set_move_on_floor
comment player_set_move_on_floor Sets the move: on the floor stopped, in the air its jump version.
param player_set_move_on_floor u player object.player
# 038995 "STY #$42,U; ADDB #$10" (the animation's air version)
038995  func  player_set_air_move
comment player_set_air_move Keeps the move's hit and takes the air version of its animation (16 on).
param player_set_air_move u player object.player
# 03899A "CLRW #$14,U"
03899A  func  player_set_move_stopped
comment player_set_move_stopped Stops the player's y speed and sets the move.
param player_set_move_stopped u player object.player
# 03899D "STB #$05,U; CLRB; STD #$30,U; STB #$39,U; LDB #$01; STB #$38,U; CLR #$06,U; LBRA $6BF9"
03899D  func  player_set_move
comment player_set_move Sets the player's state and animation (A, B), its timer and team flag cleared, and runs the move's first frame.
param player_set_move u player object.player
# state 37 (the thrown kid, 038CA2 "LDD #$3703; STD #$30,U"): 0389B2 "LBSR $7B9B" (in the air), "TST #$2A,U" (spark),
# "LDD #$0F,U; LBNE" (still flying), "DEC #$31,U", "EORB #$40; STB #$09,U" (turns), "STA #$0F,U" (8 either way),
# 0389E0 "CLR #$30,U; LDA #$80; STA #$05,U"
0389B2  func  player_team_thrown
comment player_team_thrown The kid of a Marge team attack, thrown: flies on while it has speed, then turns three times and stands.
param player_team_thrown u player object.player
# state 0D (038867 "LDD #$0DB9": both buttons): 0389EE the joystick's facing, "LEAX #$-60,X; STX #$19,U" (gravity),
# "CMPX #$0240" (the kick's frame: 1C = 0C13, box 10/08, out), "TST #$2A,U" (spark), "LBSR $7B38" (landed: 038C36)
0389EE  func  player_jump_kick
comment player_jump_kick The jump kick (both buttons): faces by the joystick, kicks with hit 0C13 at the top of the jump, lands and stands.
param player_jump_kick u player object.player
# state 2D (bank 1F 03EA76 "LDX #$2D0F; STX #$30,U" for each player in state 2C once two have worked the heavy object,
# whose step it makes 03 and height 20, the players' animation CB): 038A55 "DEC #$31,U; LBNE", "LDX #$3F,U; CLRW #$3F,U;
# LDA #$04; STA #$02,X"
038A55  func  player_heave_heavy_object
comment player_heave_heavy_object Holding the heavy object up with another player for 15 frames, then letting it fly (its step 04) and standing.
param player_heave_heavy_object u player object.player
# state 04: 038A69 "LDX #$3F,U", "TST $0031" (extended: the tile RAM's byte 0031, where #$31,U was meant), "LDY #$7E1B"
# (where it holds it, by character: 0399CA), "LDA #$06,U; BITA #$02" (the
# throw frame: 038AA1 with 7E23)
038A69  func  player_throw_carried_4
comment player_throw_carried_4 Throwing a carried kind-4 object: holds it by character, lets it fly at the animation's throw frame.
param player_throw_carried_4 u player object.player
# state 05: 038A86, the same code as 038A69
038A86  func  player_throw_carried_5
comment player_throw_carried_5 Throwing a carried kind-5 object: the same as for kind 4.
param player_throw_carried_5 u player object.player
# 038AA1 "LDD #$1900; LBSR $8680", "LBSR $79CA", "LDD #$11,U; STD #$11,X", "LDA #$04; STA #$02,X" (its step 04),
# "CLRW #$3F,U", "LDY #$0400 / #$FC00; STY #$0F,X"
038AA1  func  player_release_throw
comment player_release_throw Lets the carried object fly: sound 19, placed in front, its step 04 and x speed 0400 the way the player faces; the player holds nothing.
param player_release_throw u player object.player
param player_release_throw x held
# state 08: 038ADA "BITA #$02" (the throw frame: sound 19, 038AF8 "LDY #$0882; LDA #$08; LBSR $7C2F": the second
# sprite as the thrown weapon, kind 08 animation 82), "LSRA; LBCC" (animation end) "DEC #$009F,U" (its uses left,
# 20 from the pickup), "CLRW #$3F,U"
038ADA  func  player_throw_weapon_8
comment player_throw_weapon_8 Throwing weapon 8: at the throw frame sound 19 and the weapon flies as the second sprite; at the end one use less, and none left drops it.
param player_throw_weapon_8 u player object.player
# state 06: 038B03 "LDY #$7E3B; BRA $6B53"
038B03  func  player_swing_6
comment player_swing_6 Swinging weapon 6.
param player_swing_6 u player object.player
# state 07: 038B08 "ANDA #$02; LDD #$1E00; LBSR $8680" (sound 1E at the hit frame)
038B08  func  player_swing_7
comment player_swing_7 Swinging weapon 7, with sound 1E at its hit frame.
param player_swing_7 u player object.player
# state 38 (039DD5: Homer's team attack): 038B1A "TST $184B; LBNE $7188" (a stage's end breaks the team up)
038B1A  func  player_team_attack_homer
comment player_team_attack_homer The team attack of Homer and a kid (state 38), undone at a stage's end.
param player_team_attack_homer u player object.player
# state 09: 038B26 "LDY #$7E3B; BRA $6B2E"
038B26  func  player_attack_1
comment player_attack_1 The first attack move (09, animation B5).
param player_attack_1 u player object.player
# state 0A: 038B2B
038B2B  func  player_attack_2
comment player_attack_2 The second attack move (0A, animation B6).
param player_attack_2 u player object.player
# 038B2E "ANDB #$7F; CMPB #$40; BGE $6B60" (air animations), "LDA #$2E,U; ANDA #$0F; ... LDX #$7F21; LDD A,X; ASRDI
# #$03; STD #$0F,U" (an eighth of the walk speed)
038B2E  func  player_attack_walking
comment player_attack_walking Moves 09 and 0A on the floor: the player creeps at an eighth of its walk speed by its joystick.
param player_attack_walking u player object.player
# state 0B: 038B4B
038B4B  func  player_attack_3
comment player_attack_3 The third attack move (0B, animation B7), also the dash attack.
param player_attack_3 u player object.player
# state 0C: 038B50
038B50  func  player_attack_finish
comment player_attack_finish The combo's last move (0C, animation B8).
param player_attack_finish u player object.player
# 038B53 "ANDB #$7F; CMPB #$40; BLT $6BA9" (on the floor), "CMPB #$7B; BEQ" else 038B60
038B53  func  player_attack_move
comment player_attack_move Runs an attack move, on the floor or as a jump attack by its animation.
param player_attack_move u player object.player
# 038B60 "TST #$4E,U", "TST #$2A,U" (spark), "LEAX #$1E,X; CMPX #$16,U" (30 above the floor), "LDA <$16; ANDA #$07"
# (every 8 frames) "LDX #$42,U; STX #$1C,U", 038B8F "SUBD #$53,U" (its gravity), landed: "STA #$06,U; CLR #$4E,U"
038B60  func  player_jump_attack
comment player_jump_attack A jump attack: falls with its gravity, hitting every 8 frames while 30 above the floor, until it lands.
param player_jump_attack u player object.player
# 038BA9 "TST #$2A,U" (spark), "LDA #$06,U; ANDA #$02" (the hit frame) "LDX #$42,U; STX #$1C,U", 038BC5
# player_attack_boxes by state and character ("CMPA #$38": state 38's own 12/10), "ORB #$02"
038BA9  func  player_ground_attack
comment player_ground_attack An attack on the floor: at the animation's hit frame its hit and the box of player_attack_boxes (state 38 its own); otherwise no box.
param player_ground_attack u player object.player
# 038BF9 "LBSR $7B38; BEQ; BLE $6C0B" (landed), "SUBD #$0060" (gravity); state 35 and 36's handler too
038BF9  func  player_attack_fall
comment player_attack_fall Lets an attacking player fall to the floor, then ends the move when its animation does.
param player_attack_fall u player object.player
# 038C0B "LBSR $7BA4; LDD #$5C,U; STD #$16,U; CLR #$18,U; LBSR $7881; CLR #$3B,U"
038C0B  func  player_attack_land
comment player_attack_land Puts an attacking player on the floor at a stop.
param player_attack_land u player object.player
# 038C1D "TST #$39,U; BMI $6C68" (teamed: 038C68), else 038C22
038C1D  func  player_attack_end
comment player_attack_end Ends an attack move when its animation does, a team's its own way.
param player_attack_end u player object.player
# state 2F (lifting, 0387A8 "LDD #$2FBD"): 038C22 "LDA #$06,U; LSRA; LBCC" (animation end), "ORA #$2D,U" (the attack's
# facing), then 038C3C
038C22  func  player_end_on_animation
comment player_end_on_animation When the animation ends (an attack, lifting something), faces the way it attacked and goes back to standing or falling.
param player_end_on_animation u player object.player
# 038C36 "TST #$1B,U; LBEQ $6FAE" (no life: dies)
038C36  func  player_end_state
comment player_end_state Ends the state: the player dies with no life left, else stands or falls.
param player_end_state u player object.player
# 038C3C "TST #$34,U; BPL; EORA #$40" (turned round), "ANDA #$FD; ORA #$40" (no box, can be hit), "CLR #$22,U; CLRW
# #$1C,U", "CMPD #$5C,U; LBLE $66B8" (on the floor: stands) "LBRA $6670" (falls)
038C3C  func  player_back_to_stand
comment player_back_to_stand Back to standing or falling, its attack box off, turned round when its reaction flipped it.
param player_back_to_stand u player object.player
# state 0F (039454 "LDY #$0F40", blow 07): 038CF1 "LDD #$0100; STD #$0F,U; LDD #$0500; STD #$19,U", "LBSR $7A93",
# "LDD #$FA00; STD #$14,U" (toward the back), "CMPX #$0098" (the back's line), "LDD #$3F00" (voice), "LDD #$1B00"
# (sound 1B), "LDX #$3C10; STX #$30,U"
038CF1  func  player_flung_back
comment player_flung_back Flung toward the back of the stage (blow 07): flies up and back until it hits the back line, with a thud and its voice.
param player_flung_back u player object.player
# state 3C: 038D2A "DEC #$31,U", "LDD #$FF80; STD #$19,U", "LDY #$3D10; STY #$30,U"
038D2A  func  player_stuck_on_back
comment player_stuck_on_back Hangs against the back for 16 frames, then starts sliding down.
param player_stuck_on_back u player object.player
# state 3D: 038D3C "DEC #$31,U", "CLRW #$19,U", "LDY #$3E10"
038D3C  func  player_slide_down_back
comment player_slide_down_back Slides down the back for 16 frames, then stops.
param player_slide_down_back u player object.player
# state 3E: 038D4B "DEC #$31,U", "LDB #$DE; LDY #$0E10; LBRA $6F8D" (state 0E, animation DE)
038D4B  func  player_peel_off_back
comment player_peel_off_back After 16 frames more, drops off the back (state 0E, animation DE).
param player_peel_off_back u player object.player
# state 11 (0394DC: squashed): 038D59 "CMPX #$16,U; LBLT" (lands), "LDB #$06,U; LSRB" (animation end: 038FA1)
038D59  func  player_squashed
comment player_squashed Squashed flat: waits on the floor until its animation ends, then lies down (state 16).
param player_squashed u player object.player
# state 14 (039533: knocked flying, animation D3): 038D75 "LBSR $7B38" (in the air: "SUBD #$0060", "LBSR $7A93" the
# screen's edge: 038F0E), on the floor "DEC #$31,U" / "LDD #$0F,U" (stopped) -> 038FA1, sliding with 039A93
038D75  func  player_knocked_flying
comment player_knocked_flying Knocked flying: falls (crashing into the screen's edge), then slides along the floor until its timer or speed runs out and lies down.
param player_knocked_flying u player object.player
# states 10, 12, 13, 1D, 1E, 23, 24: 038DB3 "LDA #$06,U; LSRA; LBCC $7861; LBRA $6C36"
038DB3  func  player_wait_for_animation
comment player_wait_for_animation Waits for the reaction's animation to end, then ends the state (picking up, a blow from the front, getting up).
param player_wait_for_animation u player object.player
# state 15: 038DBD (animation end) "LDA #$1B,U; LBEQ $6FAE", "LDB #$DC; LDY #$2300"
038DBD  func  player_knocked_down
comment player_knocked_down Knocked down (animation D4): when the animation ends, dies with no life left, else gets up (state 23, animation DC).
param player_knocked_down u player object.player
# state 16: 038DD2 the same, "LDB #$DD; LDY #$2400"
038DD2  func  player_lying_down
comment player_lying_down Lying down (animation D5): when the animation ends, dies with no life left, else gets up (state 24, animation DD).
param player_lying_down u player object.player
# states 0E, 17, 28: 038DE7 "LDA #$31,U; SUBA #$10; BEQ" (at 10 it waits to land: "LDD #$FD00; STD #$19,U" in the air,
# "CMPA #$28; LBEQ $7108" the entry's), "DEC #$31,U; LBEQ $6C36"
038DE7  func  player_drop_after_crash
comment player_drop_after_crash After a crash (into the back, the screen's edge, or a wall when joining): drops to the floor, waits, and stands (blinking, when it was joining).
param player_drop_after_crash u player object.player
# states 1A, 1B (0395D9 and 0395EC, blows 03/04 with sound 5E): 038E1F "LBSR $7B38", "SUBD #$0060", "DEC #$31,U; LBEQ
# $6C36"
038E1F  func  player_stunned
comment player_stunned After a blow of strength 03 or 04 (sound 5E and its voice): falls to the floor and stands when its 60 frames run out.
param player_stunned u player object.player
# state 1C (0395AD, blow 02): 038E45 "LDX #$4B,U" (who holds it), hit while held (1E 01-0F): "LDA #$02; STA #$58,X",
# voice 3F24, spark, 039B89, state 3A; "DEC #$31,U" every 3C frames "SUBA #$04" of its life
038E45  func  player_grabbed
comment player_grabbed Held by an enemy: a blow frees it (state 3A); every 60 frames it loses 4 of its life.
param player_grabbed u player object.player
# 038E90 "TST #$1B,U; LBEQ $6EC7" (no life), "TST $184B" / "LDA #$02,X; CMPA #$04" (the stage ends, or its holder is
# thrown), "LDA #$2F,U; LBEQ; DEC #$3D,U" (presses), 038EAF "LDA #$0D; LBSR $7C2F" (the balloon off), "CLR #$58,X",
# "LDA #$3B; STA #$30,U"
038E90  func  player_struggle
comment player_struggle While held: escapes (state 3B) at the stage's end, when its holder is thrown, or after enough presses; with no life left falls (state 15).
param player_struggle u player object.player
# state 3A: 038ED5 "LDX #$4B,U; LDB #$06,X; LSRB" (the holder's animation ended), "LDA #$C0; STA #$00,U; LDA #$1C"
038ED5  func  player_grabbed_and_hit
comment player_grabbed_and_hit Held and hit: waits for its holder's animation to end, then is held again.
param player_grabbed_and_hit u player object.player
# state 3B: 038EEA "LDA #$C0; STA #$00,U; LDA #$80; STA #$05,U; CLR #$30,U"
038EEA  func  player_escape
comment player_escape Freed from a hold: standing again.
param player_escape u player object.player
# states 18, 19 (0394F0, 039573): 038EFA "SUBD #$0060", "LBSR $7A93" (the screen's edge: 038F0E), landed: "CMPA #$18 ...
# CMPX #$0140 ... #$0070 ... BITA #$01" (lands on its feet), "BITA #$02" (a bounce: x speed 0400, state 14 timer
# 20/08, animation D3) else 038F79
038EFA  func  player_knocked_up
comment player_knocked_up Knocked up into the air: crashes into the screen's edge, or lands on its feet, bounces away, or falls down.
param player_knocked_up u player object.player
# 038F0E "LDD #$1B00; LBSR $8680", "LDB #$D6; LDY #$1720", "CLRW #$19,U"
038F0E  func  player_crash_into_edge
comment player_crash_into_edge Crashes into the screen's edge: sound 1B, state 17 (animation D6).
param player_crash_into_edge u player object.player
# 038F79 "CLRW #$0F,U; LDB #$D4; LDY #$1500"
038F79  func  player_fall_down
comment player_fall_down Falls down where it is (state 15, animation D4).
param player_fall_down u player object.player
# 038F81 "LBSR $7BA4; LDX #$5C,U; STX #$16,U; CLR #$18,U"
038F81  func  player_set_floor_state
comment player_set_floor_state Puts the player on the floor and sets the state in Y with animation B.
param player_set_floor_state u player object.player
# 038F8D "STB #$05,U; STY #$30,U; CLRD; STD #$19,U; INCA; STD #$38,U; LBSR $7BAD; LBRA $778A"
038F8D  func  player_set_state
comment player_set_state Sets the player's state and timer (Y) and animation (B), no height speed, its box back to its body, and moves it.
param player_set_state u player object.player
# 038FA1 "CLRW #$0F,U; CLR #$2C,U; LDB #$D5; LDY #$1600"
038FA1  func  player_lie_down
comment player_lie_down Lies down where it is (state 16, animation D5), its count of blows cleared.
param player_lie_down u player object.player
# 038FAE "LDX #$3F,U" (drops what it carries: "LDA #$06; STA #$02,X"), "LDD #$1A00; LBSR $8680", "CLR <$62", "LDD
# [$1848]; CMPD #$0001" (its last life: 038FF0), "LDA #$DF; LDY #$1F78" (state 1F, 120 frames); 038FF0 "CLR #$06,X",
# "LDA #$CE", "LDA #$0B; LDY #$02E0; LBSR $7C2F" (the second sprite: kind 02 animation E0), "LEAX #$-50,X ... STX
# #$71,U", "LDY #$2052"
038FAE  func  player_die
comment player_die The player's life is gone: drops what it carries, sound 1A, the rank's step back to 0; it loses a life (state 1F), or on its last life starts the game-over sprite rising above it (state 20).
param player_die u player object.player
# state 1F: 03902E "DEC #$31,U", "CMPA #$1E" (gone: "CLR #$00,U"), "CMPA #$50" (blinking: 039B51), 03904E "CLRW
# <$65; CLRW <$63", "CLR #$03,X" (its record: to enter again), "CLR #$34,U", "DECW [$1848]" (a life less)
03902E  func  player_lose_life
comment player_lose_life Losing a life: blinks, vanishes, then takes a life off its record, clears the rank's counts and has it join again.
param player_lose_life u player object.player
# state 20: 039065 "LDA #$66,U; LSRA" (the second sprite's animation ended), "LDY #$02E4; STY #$64,U; INC #$30,U"
039065  func  player_game_over_start
comment player_game_over_start On its last life: when the second sprite's animation ends, gives it animation E4 (state 21).
param player_game_over_start u player object.player
# state 21: 039070 "DEC #$31,U", "LDY #$02E8"
039070  func  player_game_over_rise
comment player_game_over_rise When its timer runs out, gives the second sprite animation E8 (state 22).
param player_game_over_rise u player object.player
# state 22: 039084 "LDA #$66,U; LSRA", "CLR #$03,X; CLR #$60,U; CLR #$00,U", then 03904E
039084  func  player_game_over_end
comment player_game_over_end When the second sprite's animation ends, the player and the sprite are gone and its last life is taken off.
param player_game_over_end u player object.player
# state 26 (0380AB's jump in from the left): 03909B "ADDD #$0008" (up), "SUBD #$0070" (x speed down), "INC #$30,U;
# LDA #$BB" (state 27, facing left), "CMPX #$0072"
03909B  func  player_jump_in
comment player_jump_in Joining with a leap in from the left: rises while its x speed falls off, then falls (state 27); a wall on the way crashes it.
param player_jump_in u player object.player
# state 27: 0390CF "LBSR $7B38; BLE $7108" (landed), "SUBD #$0060", "CMPD #$FD00; SUBD #$0060" (x speed)
0390CF  func  player_drop_in
comment player_drop_in Joining, falling to the floor (from the leap, or from above in scenes 4 and 0B).
param player_drop_in u player object.player
# 0390EE "LBSR $7A93; LBCC" (a wall), "LDD #$1B00; LBSR $8680", "LDB #$D6; LDY #$2820" (state 28)
0390EE  func  player_entry_crash
comment player_entry_crash A joining player that meets a wall crashes into it (sound 1B, state 28, animation D6).
param player_entry_crash u player object.player
# 039108 "LDD #$5C,U; STD #$16,U", "LBSR $7B0C" (blinking), "CLR #$30,U", "LDA #$80; STA #$05,U"
039108  func  player_entry_land
comment player_entry_land A joining player lands: standing, blinking and safe for 120 frames.
param player_entry_land u player object.player
# state 25: 039128 "LBRA $7861"
039128  func  player_idle
comment player_idle State 25: nothing but keeping its life in the record.
param player_idle u player object.player
# state 2A (0393..: blow 0C): 03912B "DEC #$31,U; LBNE; LBRA $6C36"
03912B  func  player_hold_pose
comment player_hold_pose Holds the pose a blow of strength 0C gave it until its timer runs out.
param player_hold_pose u player object.player
# state 2C (0387AE: attack on a heavy object, strength FE): 039134 "ANDA #$2F" (a direction or jump: lets go), "LDA
# #$41,U; CMPA #$03; INC $184D" (done 3 times: counted), "ANDA #$10" (attack) "LDX #$3F,U; LDA #$02; STA #$28,X; LDB
# #$C9; LBSR $7B5C; INC #$41,U"
039134  func  player_work_heavy_object
comment player_work_heavy_object At a heavy object that takes two (strength FE): each attack works at it (its field 28 to 2), and after 3 the player counts in 184D, where bank 1F lifts it once two have (state 2D); a direction or jump lets go.
param player_work_heavy_object u player object.player

# ---- team moves ----
# state 30 (039744 "LDA #$30; STA #$30,X": the first of the pair): 03916D "TST $184B" / in the air / "BITA #$20" (jump:
# 039188 "LBSR $7A1A; LDA #$C0; STA #$00,X" undone), "BITA #$1F" (any input), "TST <$67" (scene 0) "LDA #$03; LDY
# #$B180; LBSR $7C2F" (the pair's balloon), "LDA #$31; STA #$30,U; LDB #$E4"
03916D  func  player_team_ready
comment player_team_ready A pair just teamed up waits for either's input to start (state 31, the pair's balloon in scene 0); a jump or a stage's end undoes it.
param player_team_ready u player object.player
# state 31: 0391C1 "LDY #$01E0; STY #$28,U; STY #$28,X" (480 frames), then 0391D0
0391C1  func  player_team_start
comment player_team_start Starts the team move: 480 frames for both, then moving together.
param player_team_start u player object.player
# 0391CD "LDX #$32,U"
0391CD  func  player_team_resume
comment player_team_resume Back to moving together with its partner.
param player_team_resume u player object.player
# 0391D0 "STY #$16,U" (on the floor), "LDA #$32; STA #$30,U", "LDB #$EC" (animation), 039205 "LBSR $7A6E" (the
# partner follows), "STA #$5B,U" (the shadow by a random one of the two), "DECW #$28,U" (time up: move 2's last
# attack 0386E1, else undone: 039A1A, both stopped)
0391D0  func  player_team_together
comment player_team_together Moving together (state 32) on the floor: the partner follows; when the 480 frames run out the pair splits (a Marge-and-kid pair attacks first).
param player_team_together u player object.player
# 039242 (B: the animation) "LDX #$3F,U; BNE" (holding nothing: as it is), "LDA #$40,U; SUBA #$03; ASLA x3; ADDB" (a
# weapon's animations), 03926B Homer with the kind-04 object (B + 61), 039292 "LDA #$04,X; SUBA #$03" (a carried
# object's), 0392BA "LEAY A,Y; LDB ,Y+" (where it holds it, by character), "EORB #$34,U" (it bobs), "LBSR $79E3"
039242  func  player_set_animation
comment player_set_animation Sets the player's walking or standing animation by what it holds (a weapon's or a carried object's set of animations) and carries the object above it, bobbing; at a stage's end what it carries is removed.
param player_set_animation u player object.player

# ---- what touches a player ----
# 0392F0 (every state's end): "LDA #$3E,U; BEQ; DEC #$3E,U" (blinking: 039B51; at 0 "LDA #$C0; STA #$00,U", its record's
# byte 3 = 2, "LDA #$0D; LBSR $7C2F" the mark off), 039316 "LDA #$00,U; BITA #$20" (touched), "LDB #$1E,U" (by what),
# "CMPB #$F0; LBLT $76B2" (80-83: another player's team-up, 0396B2-039787: team_moves by the two characters), "ASLB;
# SEX; LDX #$7E8D; JMP [D,X]" (F4-0F: pickups and blows), then 03978A
0392F0  func  player_take_touches
comment player_take_touches Every state's end: counts the blinking down after joining, takes what touched the player by its strength (a pickup, a weapon, a blow, or another player's offer of a team move, which teams the two up by their characters), and moves it.
param player_take_touches u player object.player
local player_take_touches 0396B7 x other object.player
# strength 0C (039E8D + 2 x 0C): 039335 on the floor "LDB #$44,U; STB #$05,U" (the animation its hitter gave), "CMPB
# #$97; LDD #$3F28" (voice), "LDY #$2A20; STY #$30,U" (state 2A, 32 frames)
039335  func  player_take_pose_blow
comment player_take_pose_blow A blow of strength 0C on the floor: holds the animation the hitter left in its field 44 for 32 frames (state 2A).
param player_take_pose_blow u player object.player
# strengths F4, F5 (7E75, 7E77): 039360 "BITA #$10" (attack pressed), "LDY #$3F,U; LBNE" (nothing held), "TST #$39,U"
# (not teamed), "LDY #$25,U; LDB #$02,Y; CMPB #$02" (the thing not taken yet), then 03940A
039360  func  player_pick_up_item
comment player_pick_up_item Attack pressed on an item of strength F4 or F5: picks it up.
param player_pick_up_item u player object.player
# strengths F6-F8: 039384 the same, "LDA #$14; STA #$009F,U" (20 uses), "LDB #$1E,U; SUBB #$F0; CLRA; STD #$3F,U"
# (weapon kinds 6-8)
039384  func  player_pick_up_weapon
comment player_pick_up_weapon Attack pressed on a weapon (strength F6-F8): takes it as weapon kind 6, 7 or 8 with 20 uses.
param player_pick_up_weapon u player object.player
# strengths F9-FC (7E7F-7E85): 0393B6 (teamed: the one of the pair with less life, 0393D9 "CMPA #$1B,X"), "LDD #$3F0C;
# LBSR $7C50", "LDA #$01; LBSR $7C29" (balloon 1), 0393F7 "SUBA #$F9; LDX #$7EAD; LDB #$1B,U; ADDB A,X; CMPB #$28"
# (pickup_vitality, at most 28), 03940A "LDB #$1D; STB #$30,U; LDB #$BE" (state 1D), "LDB #$02; STB #$02,Y" (the
# thing's step 02: taken)
0393B6  func  player_eat_food
comment player_eat_food Food (strength F9-FC): its life goes up by pickup_vitality (at most 28), to the partner with less life when teamed, with its voice and a balloon; it picks it up (state 1D).
param player_eat_food u player object.player
local player_eat_food 0393CD x partner object.player
# strength 07: 039454 "LBSR $7B9B; LDB #$DB; LDY #$0F40"
039454  func  player_take_fling_blow
comment player_take_fling_blow A blow of strength 07: flung toward the back of the stage (state 0F, animation DB).
param player_take_fling_blow u player object.player
# strength 00: 03945F in the air: 0394F0; no life: 039528; "INC #$2C,U" (blows in a row), "LDY #$25,U" (the hitter)
# "ADDD #$0010; CMPD #$16,Y; LDD #$19,Y; LBMI $74CC" (landing on it from above: squashed at the third, 0394DC),
# "EORA #$09,U; BITA #$40" (facing the same way: hit from behind), "CMPA #$03" (the third: 039523 or 15/D4), else
# 1E/D1, 1E/D2 or 16/D5 by its x's bit 1
03945F  func  player_take_blow
comment player_take_blow A normal blow (strength 00): reels from the front or behind, falls at the third in a row, is squashed by a third stomp from above; in the air it is knocked up, with no life left knocked down.
param player_take_blow u player object.player
# strength 06 (7E8D + 2 x 06 is 74DC), and 0394D9 (a third stomp): 0394DC "LDD #$3F00; LBSR $7C50", "LDX #$FA00; STX
# #$19,U", "LDB #$D0; LDY #$1100"
0394DC  func  player_squash
comment player_squash A blow of strength 06, or a third stomp from above: squashed flat (state 11, animation D0), with its voice.
param player_squash u player object.player
# strength 09 (and blows 00/01 in the air): 0394F0 "TST #$1B,U; LBEQ $7573", "LDX #$25,X; LDA #$09,X", "LDY #$0680;
# STY #$19,U", "LDY #$01C0 / #$FE40; STY #$0F,U" (the hitter's way), "LDY #$1800; LDB #$D7"
0394F0  func  player_knock_up
comment player_knock_up Knocked up into the air the way its hitter faces, turned to it (state 18, animation D7); with no life left bounced away instead.
param player_knock_up u player object.player
# strength 08: 039523 "TST #$1B,U" (life left: 03952D "LDY #$1408; CLR #$2C,U")
039523  func  player_take_knockdown_blow
comment player_take_knockdown_blow A blow of strength 08: knocked flying a short way (8 frames), or far with no life left.
param player_take_knockdown_blow u player object.player
# strength 05: 039528 "LDY #$1420"
039528  func  player_take_knockaway_blow
comment player_take_knockaway_blow A blow of strength 05: knocked flying (state 14 for 32 frames).
param player_take_knockaway_blow u player object.player
# 039533 "ORA #$80; STA #$34,U" (turn round after), "LDX #$25,U; LDA #$09,X; LDX #$0400 / #$FC00; STX #$0F,U", "LDB
# #$D3" (state in Y)
039533  func  player_knock_flying
comment player_knock_flying Knocks the player flying the way its hitter faces (x speed 0400), turned to it, in the state Y gives (14, animation D3).
param player_knock_flying u player object.player
# strength 01: 03955F in the air: 0394F0; "LDB #$0D,U; BITB #$02; LBNE $7528" (by its x's bit 1)
03955F  func  player_take_heavy_blow
comment player_take_heavy_blow A blow of strength 01: in the air knocked up; on the floor knocked flying or bounced away, by chance.
param player_take_heavy_blow u player object.player
# strength 0D: 039573 "LBSR $7B9B", "LDD #$0400 / #$FC00" x, "STD #$19,U" (up 0400), "ORA #$80; STA #$34,U", "LDY
# #$1900; LDB #$D2"
039573  func  player_bounce_away
comment player_bounce_away Bounced away up and back the way its hitter faces (state 19, animation D2), to turn round after.
param player_bounce_away u player object.player
# strength 02: 0395AD "LDX #$4B,U; LDA #$01; STA #$58,X" (its holder), "LDY $1848; LDA #$06,Y; CMPA #$05; INC #$06,Y;
# LDA #$05; LBSR $7C2F" (the first 5 times: the blinking balloon B180/B181, bank 1F 03EBF0), "LDB #$BF; LDY #$1C01" or
# "#$1C3C" (life 4)
0395AD  func  player_get_grabbed
comment player_get_grabbed Grabbed by an enemy (strength 02): held (state 1C, animation BF), with a blinking balloon the first 5 times in its record.
param player_get_grabbed u player object.player
# strength 03: 0395D9 "LDD #$5E00; LBSR $8680", "LDD #$3F28", "LDB #$D9; LDY #$1B3C"
0395D9  func  player_take_stun_blow
comment player_take_stun_blow A blow of strength 03: sound 5E, its voice, stunned for 60 frames (state 1B, animation D9).
param player_take_stun_blow u player object.player
# strength 04: 0395EC "LDD #$5E00", "LDA #$00; LBSR $7C29" (balloon 0), "LDD #$3F04", "LDB #$D8; LDY #$1A3C"
0395EC  func  player_take_stun_blow_2
comment player_take_stun_blow_2 A blow of strength 04: sound 5E, balloon 0, its voice, stunned for 60 frames (state 1A, animation D8).
param player_take_stun_blow_2 u player object.player
# 039602 "LDA #$00,U; ANDA #$88; STA #$00,U", then 03960A "STY #$30,U; STB #$05,U; LBSR $7881"
039602  func  player_set_hurt_state
comment player_set_hurt_state Takes the player's flags back to visible and in the air only, then 03960A.
param player_set_hurt_state u player object.player
03960A  func  player_set_hurt_stopped
comment player_set_hurt_stopped Sets the reaction's state and timer (Y) and animation (B), stopped, then flashes its palette and drops what it holds.
param player_set_hurt_stopped u player object.player
# 039615 "CLRW #$0F,U", 039618 "CLRW #$14,U", 03961B "ANDA #$88", "STY #$30,U; STB #$05,U", "LBSR $7B80" (voice and
# spark)
039615  func  player_hurt_stop
comment player_hurt_stop Stops the player's x and y speeds and sets the reaction (039618).
param player_hurt_stop u player object.player
039618  func  player_hurt_stop_y
comment player_hurt_stop_y Stops the player's y speed and sets the reaction (03961B).
param player_hurt_stop_y u player object.player
03961B  func  player_hurt
comment player_hurt Sets the reaction's state and timer (Y) and animation (B), with its hurt voice and a spark, its palette's flash, and drops what it holds.
param player_hurt u player object.player
# 03962C "LBSR $7B89" (the palette's flash)
03962C  func  player_hurt_flash
comment player_hurt_flash Flashes the player's palette, then 03962F.
param player_hurt_flash u player object.player
# 03962F "CLRW #$1C,U; LDA #$01; STA #$38,U; CLR #$41,U; LDX #$3F,U"
03962F  func  player_hurt_end
comment player_hurt_end Its hit off, drops what it holds and undoes a team-up it is in.
param player_hurt_end u player object.player
# 03963F "TST #$3F,U" (an object), "CLRW #$3F,U", "LDA #$1D,X; CMPA #$FE" (not the heavy object), "CLRW #$0F,X; CLRW
# #$14,X; LDA
# #$06; STA #$02,X" (its step 06: dropped), "LBSR $7BAD"
03963F  func  player_drop_held
comment player_drop_held Drops the object it carries (its step 06, stopped) unless it is a heavy object (strength FE), and its box back to its body.
param player_drop_held u player object.player
param player_drop_held x held
# 03965F "LDA #$39,U; CLR #$39,U; TSTA; LBPL" (teamed), "LDX #$32,U; LBSR $7A28", "LDD #$30,U; CMPA #$1C" (the partner
# takes its state, or stands if it was grabbed), "LBSR $7A6E", "LBSR $7A93" (for the partner), "LDA #$1B,U; SUBA
# #$52,U; ... ADDA #$1B,X" (the partner loses as much life)
03965F  func  player_break_team
comment player_break_team A teamed player hit: the team-up is undone, the partner takes the same reaction (or stands, when this one was grabbed) and loses as much life.
param player_break_team u player object.player
local player_break_team 039669 x partner object.player

# ---- moving ----
# 03978A "TST #$39,U; LDY #$32,U" (teamed: the partner too), 0397A7 the next y "CMPD #$0098" (the back line), 0397C3
# the next x against 0070/005A ... 0140 (0150 in scene 4, +26 with no life) , 039810 "LBSR $863B" / "$8644" / "$8647"
# (the floor where it goes: 039794), "STD #$5C,U" (its floor), "ORA <$F2; STA #$09,U" (the block's priority bits),
# "STD #$0F,Y" (the partner's x speed), then 039861
03978A  func  player_check_motion
comment player_check_motion Stops the player's (and its partner's) x or y speed where the next place is past the back line, the screen's edge, a wall or a floor too high, takes the floor it stands on and its priority, and keeps its life in its record.
param player_check_motion u player object.player
# 039794 "ANDA #$30; STA <$F2", "ANDB #$0F; ASLB x3; SEX; CMPD #$16,U"
039794  func  player_floor_against_height
comment player_floor_against_height The floor height (8 a step) of the block flags in A against the player's height; their priority bits in F2.
param player_floor_against_height u player object.player
# 039861 "NOP; LDB #$1B,U; LDX $1848; STB #$02,X" (49D2 + 8n: its record's life); states 01, 25, 2E, 39, 3F
039861  func  player_keep_life
comment player_keep_life Keeps the player's life in its record (the state of states 01, 2E, 39 and 3F, which do nothing else).
param player_keep_life u player object.player
# 03986D "TFR U,X; LBSR $863B; CMPA #$FF" (a wall: carry), "ANDA #$0F; ... ASLB x3"
03986D  func  player_floor_at_next_place
comment player_floor_at_next_place The floor's height at the player's next place (carry when it is a wall).
param player_floor_at_next_place u player object.player
# 039881 "CLRW #$0F,U; CLRW #$14,U; CLRW #$19,U"
039881  func  player_stop
comment player_stop Stops the player: no x, y or height speed.
param player_stop u player object.player
# 03988B "ANDA #$0F; ASLA; ASLA; LDY #$7F21; LEAY A,Y; LDD ,Y++; STD #$0F,U" (player_walk_velocities), "ANDA #$40"
# (facing), then 0398A9
03988B  func  player_steer
comment player_steer Steers the player by the joystick in A: its x speed and facing from player_walk_velocities, then its y speed and the scroll.
param player_steer u player object.player
# 0398A9 "CMPX #$0100" facing right / "CMPX #$00C0" left, "CMPX $4A4C ... $4C8C" (every player in play past 98 / 118),
# "STX <$E4" (the x scroll's step), "LDD ,Y; STD #$14,U" (y speed), "CMPX $1840 / $1842", "$4A51 ... $4C91", "ADDD
# <$E6; STD <$E6" (the y scroll's)
0398A9  func  player_request_scroll
comment player_request_scroll Sets the player's y speed from Y and asks the screen to scroll with it: x when it walks past the scroll line with no player behind, y likewise past 1840/1842.
param player_request_scroll u player object.player
# 0399CA "LDA #$04,U; ASLA; LEAY A,Y; LDB ,Y+" (by character), "NEGB" facing left, "ADDD #$0C,U; STD #$0C,X", "LDB ,Y"
0399CA  func  player_place_carried
comment player_place_carried Places the object in X at the offsets Y gives for the player's character (x turned by its facing, then its height).
param player_place_carried u player object.player
param player_place_carried x carried
param player_place_carried y offsets
# 0399E3 "SEX; ADDD #$16,U; STD #$16,X", "SUBD #$0002; STD #$11,X" (just in front), x and y fractions, speeds, "ORA
# #$80; STA #$06,X"
0399E3  func  player_place_carried_above
comment player_place_carried_above Puts the carried object B above the player's height, just in front of it, with the player's speeds.
param player_place_carried_above u player object.player
param player_place_carried_above x carried
# 039A1A "CLR #$30,U; CLR #$30,X; LDA #$80; STA #$05,U; STA #$05,X", then 039A28
039A1A  func  player_team_split
comment player_team_split Undoes a team-up: both players standing (state 00, animation 80).
param player_team_split u player object.player
param player_team_split x partner object.player
# 039A28 both "ORA #$80" (shown), "CLRW #$3B", "LDD #$0100; STD #$38" (no longer teamed), "CLR #$3D; CLR #$37", "LDD
# #$5C,U; STD #$5C,X", their shadows by their own characters (5B)
039A28  func  player_team_release
comment player_team_release Lets the two players of a team-up go: shown, no longer teamed, the partner on the same floor, each with its own shadow.
param player_team_release u player object.player
param player_team_release x partner object.player
# 039A6E "LDD #$0F,U; STD #$0F,X" ... the speeds and place
039A6E  func  player_team_follow
comment player_team_follow The partner takes the player's speeds and place.
param player_team_follow u player object.player
param player_team_follow x partner object.player
# 039A93 "LDX #$0070; LDY #$0140" (no life and in the air: 005A, 0166), "LBSR $8644" (the floor ahead), "STA <$F0 ...
# ORA <$F0" (priority), "CMPD #$16,U; BGT" (too high), the next x "CMPD <$F8 ... <$FA", "STX #$5C,U", else "CLRW #$0F,U;
# CLRW #$14,U" with carry
039A93  func  player_check_screen_edges
comment player_check_screen_edges Checks the player's next x against the screen's edges and the floor ahead: stops it with carry where it can not go, else takes that floor.
param player_check_screen_edges u player object.player

# ---- blinking, sparks, balloons, voices ----
# 039B0C "ANDA #$4F; STA #$09,U", "LDA #$78; STA #$3E,U" (120 frames), "LDA #$0C; STA #$0090,U" (the second sprite's
# state 0C, bank 1F's overhead mark), "LDA #$80; STA #$60,U", "LDA #$04,U; STA #$64,U; LDA #$87; STA #$65,U" (its kind,
# animation 87), "LDA #$C4; STA #$00,U" (can not be hurt)
039B0C  func  player_start_blinking
comment player_start_blinking Makes the player safe and blinking for 120 frames after it joins, with its mark (its own kind, animation 87) above it.
param player_start_blinking u player object.player
# 039B38 "LDB #$19,U; SEX; ... ADDD #$19,U ... ADCA <$F2; CMPD #$5C,U"
039B38  func  player_next_height_against_floor
comment player_next_height_against_floor Compares the player's height after its height speed with its floor (above, at or below).
param player_next_height_against_floor u player object.player
# 039B51 "LDB #$00,U; ORB #$04; EORB #$80; STB #$00,U"
039B51  func  player_blink
comment player_blink Shows or hides the player every other call, safe meanwhile.
param player_blink u player object.player
# 039B5C "LDX #$3F,U; LDY #$0C,X; LEAY #$-18,Y; CMPY #$0C,U; BGE", "LEAX #$0090,Y" (LEAX where LEAY was meant: the
# second compare is the first's again), "ORA #$40; STA #$09,U", "INCB; STB #$05,U"
039B5C  func  player_face_heavy_object
comment player_face_heavy_object Faces the heavy object it works at (turned left when right of it) with animation B plus 1: the in-between case the code meant, animation B itself, never comes (LEAX for LEAY).
param player_face_heavy_object u player object.player
# 039B80 "LDD #$3F24; LBSR $7C50; LBRA $7BBA"
039B80  func  player_hurt_voice
comment player_hurt_voice The player's hurt voice and a spark where it was hit.
param player_hurt_voice u player object.player
# 039B89 "LDA #$02; STA <$7E; LDD #$0022; ADDB #$04,U; LBSR $8677" (palette request 2: the effect 22 + character)
039B89  func  player_flash_palette
comment player_flash_palette Flashes the player's palette (palette effect 22 plus its character).
param player_flash_palette u player object.player
# 039B9B "ORA #$08" (07D19C clears it on landing)
039B9B  func  player_set_in_air
comment player_set_in_air Marks the player in the air.
param player_set_in_air u player object.player
# 039BA4 "ANDA #$F7"
039BA4  func  player_set_on_floor
comment player_set_on_floor Marks the player on the floor.
param player_set_on_floor u player object.player
# 039BAD "CLRW #$1C,U; CLR #$22,U; LDY #$0E06; STY #$1F,U"
039BAD  func  player_reset_box
comment player_reset_box No hit, and the player's box back to its body's (0E by 06).
param player_reset_box u player object.player
# 039BBA "LDA #$06; LDY #$0EBF; LBSR $7C2F" (the second sprite's state 06: kind 0E, animation BF), "LDX #$25,U" (the
# hitter: 10 toward it), "LDB #$24,U; SEX; ADDD #$11,U; SUBD #$0040", "ADDD #$0040"
039BBA  func  player_show_hurt_spark
comment player_show_hurt_spark A spark (kind 0E, animation BF) on the player's side toward its hitter.
param player_show_hurt_spark u player object.player
# 039BF9 "CLR #$2A,U", the spark, "LDB ,Y; CLRA; ADDD #$16,U; ADDD #$0020" (height + Y), "LDY #$49,U; LDD #$0C,Y; STD
# #$6C,U" (the x of what it hit)
039BF9  func  player_show_hit_spark
comment player_show_hit_spark A spark where the player's blow landed: at the x of the object it hit, at its height plus the byte Y points at.
param player_show_hit_spark u player object.player
# 039C29 "STA #$00A0,U; LDA #$02" (the second sprite's state 02: the balloon, bank 1F 03EC60)
039C29  func  player_show_balloon
comment player_show_balloon Shows speech balloon A above the player.
param player_show_balloon u player object.player
# 039C2F "CMPA #$0090,U; BLT" (carry: one that matters more is running), "STA #$0090,U; STY #$64,U; LDA #$80; STA
# #$60,U", clears its speeds
039C2F  func  player_start_effect
comment player_start_effect Starts the player's second sprite as effect A (its state in bank 1F) with kind and animation Y, unless an effect of a higher number runs (carry).
param player_start_effect u player object.player
# 039C50 "ADDB #$04,U; LBRA $8680"
039C50  func  player_play_voice
comment player_play_voice Plays the sound in D for the player's character (its number added to B).
param player_play_voice u player object.player

# ---- the players' fields (the player family: bank 1C's functions, through their U typed object.player) ----
# 02188B "LDU #$25,X; LDA #$01; STA #$2A,U; STX #$49,U" (an object a player's blow lands on), 03A1A7, 03B3FB the same;
# 039BF9 "CLR #$2A,U", 038333 "TST #$2A,U"
scoped object player 2A blow_landed u8
# 038909 "INC #$2B,U; CMPA #$03" (the plain swings), 0388F3 "INC #$2B,U; CMPA #$08" (the dash attacks)
scoped object player 2B swings u8
# 039474 "INC #$2C,U", 039496 "CMPA #$03" (the third blow in a row), 038FA4 "CLR #$2C,U"
scoped object player 2C blows_taken u8
# 03871B "LDA #$09,U; ANDA #$40; STA #$2D,U", 038C2E "ORA #$2D,U"
scoped object player 2D attack_facing u8
# 0380F1 "STY #$2E,U" (Y = direct page 40 + 4n and 42 + 4n: this frame's controls, the newly pressed: 07924D)
scoped object player 2E controls u8
scoped object player 2F controls_pressed u8
# 038290 "LDB #$30,U; ... LDY #$7D51; JMP [D,Y]"; 31 its timer (03902E "DEC #$31,U", 038F90 "STY #$30,U")
scoped object player 30 player_state u8
scoped object player 31 state_timer u8
# 0396FA "STX #$32,U; STU #$32,X" (the two of a team-up), 0382B9 "LDX #$32,U"
scoped object player 32 partner u16 object.player
# 0380FE-038116 kept through the entry ("BITB #$02": rejoining), 039533 "ORA #$80" (turn round after the reaction:
# 038C3C "TST #$34,U; BPL; EORA #$40"), 0392E5 "EORB #$34,U" (bit 0: the carried object's bob)
scoped object player 34 status u8
# 039713 "STB #$35,U; STB #$35,X" (team_moves' move), 0386E4 "LDA #$35,U; LDX #$7DD5", 0391F1
scoped object player 35 team_move_number u8
# 039739 "STA #$36,X" (team_moves' direction), 038342 "TST #$36,U; BPL"
scoped object player 36 team_direction u8
# 03899D "LDB #$01; STB #$38,U" (a state's start), 038475 "LDB #$38,U; ... INCB; CMPB #$A0" (standing: frames idle)
scoped object player 38 state_frames u8
# 039719 "LDB #$FF; STB #$39,U" (teamed), 038412 "LDA #$39,U; BPL"; 0384AE "LDA #$39,U; CMPA #$20; ... INC #$39,U"
# (standing still: frames to offering a team move)
scoped object player 39 teamed u8
# 03886D "STA #$3C,U" (an attack started), 0386EC "STA #$3C,U" (the team attack's state), 03851C "TST #$3C,U"
scoped object player 3C attack_started u8
# 039B14 "LDA #$78; STA #$3E,U", 0392F5 "DEC #$3E,U"
scoped object player 3E blink_frames u8
# 038766 "STD #$3F,U" (a weapon: 00 and its kind 06-08), 03876B "STX #$3F,U" (an object carried), 0387CC "LDX #$3F,U"
scoped object player 3F held u16 object
# 039167 "INC #$41,U", 039144 "LDA #$41,U; CMPA #$03"
scoped object player 41 heavy_object_presses u8
# 038985 "STY #$42,U" (the move's hit), 038BB8 "LDX #$42,U; STX #$1C,U"
scoped object player 42 move_hit u16
# 03933E "LDB #$44,U; STB #$05,U" (the animation its hitter left)
scoped object player 44 pose_animation u8
# 039C1F "LDY #$49,U; LDD #$0C,Y" (see 2A)
scoped object player 49 object_hit u16 object
# 0395AD "LDX #$4B,U; STA #$58,X", 038E45 "LDX #$4B,U" (the enemy holding it)
# 0388D1 "LDB #$4D,U; ... INCB; STB #$4D,U" (object_1c_move_steps)
scoped object player 4D combo_step u8
# 03886F "STA #$4E,U", 038B60 "TST #$4E,U", 038BA3 "CLR #$4E,U"
scoped object player 4E jump_attack u8
# 038286 "LDA #$4F,U; CMPA #$0E; INC #$4F,U", 0383C6 "CLR #$4F,U" (a new direction)
scoped object player 4F frames_since_press u8
# 0383BC "LDA #$50,U; CMPA #$04; INC #$50,U", 0388ED "CLR #$50,U"
scoped object player 50 quick_presses u8
# bank 1F 03ED1F "LDA #$1B,U; STA #$52,U" (each frame), 03969D "SUBA #$52,U" (the life lost this frame)
scoped object player 52 last_life u8
# 038959 "STD #$53,U" (the jump attack's gravity), 038B92 "SUBD #$53,U", 0387D2 "LDD #$0040; STD #$53,U"
scoped object player 53 attack_gravity u16
# 0391B2 "LDA #$03; STA #$55,U", 0382F1 "DEC #$55,U" (move 1's voices every 3 frames)
scoped object player 55 voice_timer u8

# ======== bank 1D: stage 8's first boss (type F6), Mr. Burns' robot (type EC) and their objects ========
# (symbols.txt's section "banks 1D, 1E ..." says who is who.) Every handler gets its object in X.

# ---- the files ----
# (the line at 03A000 replaces symbols.txt's "03A000  file  unsorted/bank_1D"; a file may take several stretches, its
# first line's comment its description)
03A000  file  bosses/stage_8_boss    # stage 8's first boss (4F80 type F6, kind 9C): its states and phases, the bombs it throws, its speech balloon
03A009  file  bosses/burns_robot    # Mr. Burns' robot (4F80 type EC, kinds CC-D4): its entrance, its forms and attacks, how each form breaks
03A00F  file  bosses/burns_robot_parts    # the robot's objects: the wall it breaks out of, the part it tosses, its debris, shots, bombs and held part, Mr. Burns and Maggie at the end
03A02D  file  bosses/stage_8_boss    # (stage 8's first boss)
03A9D3  file  bosses/burns_robot    # (the robot's code)
03B5A4  file  bosses/burns_robot_parts    # (the robot's objects' code)

# ---- bank 1D's jump table (the list dispatchers' handlers) ----
# 03A000 "LBRA $6271" (4F80 type F6): 03A271 "LEAY #$38,X; LBSR $695C" (its random number), 03A277 "LDA #$2D,X ... CMPB
# #$48; BHI; DEC #$2D,X; LDA #$80; STA #$1B,X" (a phase's health gone), 03A28B "LDA #$2E,X; ASLA; LDY #$7A00; JMP [A,Y]"
03A000  func  stage_8_boss_run
comment stage_8_boss_run Stage 8's first boss (type F6, kind 9C): steps its random number, starts its next phase with its health back to 80 when it falls to 48, and runs its state (bank_1d_states).
param stage_8_boss_run x boss
# 03A003 "LBRA $67A1" (4D40 type 1C, the boss's child 7A78): 03A7A1 "LDA #$00,X; CMPA #$04" (new), "LDU #$B084" (kind B0
# speech_balloons, animation 84; scene 4: "LDU #$B082", 09 = 80), "LDA #$60; STA #$2F,X", "DEC #$2F,X; CLR #$00,X"
03A003  func  boss_speech_balloon_run
comment boss_speech_balloon_run The speech balloon the stage 8 boss puts above itself when it speaks (type 1C of the 4D40 list): shows kind B0's animation 84 (82, turned, in scene 4) for 96 frames.
param boss_speech_balloon_run x balloon
# 03A006 "LBRA $67D3" (4D40 type 1D, the child 7A7E; 5280 type F1, the child 7A84 when 4D40 is full): 03A7D3 "LDA
# #$2E,X; ASLA; LDY #$7AD6; JMP [A,Y]" (03A7DC, 03A877, 03A910, 03A871)
03A006  func  stage_8_boss_bomb_run
comment stage_8_boss_bomb_run A bomb the stage 8 boss throws (4D40 type 1D, or 5280 type F1): runs its state (thrown, flying, blast, bouncing).
param stage_8_boss_bomb_run x bomb
# 03A009 "LBRA $699E" (4F80 type EC): 03A99E "LDD #$3B,X; ADDD #$0001 ..." (its three counters), "LDA #$02,X; CMPA #$F9;
# BEQ; LBSR $7161" (its hits), "LDU #$7AEE; LDA #$02,X; ASLA; JSR [A,U]" (by its handler number; FA-FF its forms'
# breaking, FF hurt, F9 none), "LDA #$02,X; LBNE $731D" (031D: turned round at a wall)
03A009  func  burns_robot_run
comment burns_robot_run Mr. Burns' robot (type EC): counts its timers up, takes the players' blows, runs its handler by its handler number (field 02), and while it walks turns round at walls.
param burns_robot_run x robot
# 03A00F "LBRA $759B" (4D40 type 21): 03B59B "LDU #$7D99; LDA #$02,X; ASLA; JMP [A,U]"
03A00F  func  burns_breakout_run
comment burns_breakout_run The robot's shape in stage 8's wall (4D40 type 21, kind CC): runs its step.
param burns_breakout_run x shape
# 03A012 "LBRA $7645" (5280 type E4, object_1d_parts 8: kind CC animation 82): 03B645 "ORA #$10; STA ,X", "LDU #$7DA1"
03A012  func  burns_tossed_part_run
comment burns_tossed_part_run The part the robot tosses away before its fight (5280 type E4, kind CC animation 82): runs its step.
param burns_tossed_part_run x part
# 03A015 / 03A018 "LBRA $7685" (5280 types E5 and E6; object_1d_parts 0-4 are E5: kinds CC-D2): 03B685 "LDU #$7DA5"
03A015  func  burns_debris_run
comment burns_debris_run A piece of the robot breaking off (5280 type E5): runs its step (bouncing, then blinking out).
param burns_debris_run x debris
03A018  func  burns_debris_run_e6
comment burns_debris_run_e6 The same for 5280 type E6.
param burns_debris_run_e6 x debris
# 03A01B "LBRA $76F5" (5280 type E7, put in by 03A9DC): 03B6F5 "LDU #$7DAD; LDA #$02,X; ASLA; JMP [A,U]"
03A01B  func  rescued_maggie_run
comment rescued_maggie_run What falls from the beaten robot and turns into Maggie (5280 type E7): runs its step.
param rescued_maggie_run x maggie
# 03A01E "LBRA $7814" (4D40 type 26, object_1d_parts 9-13: kind CC animation 88): 03B814 "LBSR $8644; ... NEGW #$0F,X",
# "LBSR $8647; ... NEGW #$14,X" (bounces off walls), "LDU #$7DCF"
03A01E  func  burns_bomb_run
comment burns_bomb_run A bomb the robot throws (4D40 type 26): turned back by walls, runs its step.
param burns_bomb_run x bomb
# 03A021 "LBRA $7893" (4D40 type 25, object_1d_parts 5: kind CD animation 84): 03B893 "LDU #$7DD7 ... JSR [A,U]",
# "LBSR $863B; TSTA; BMI $78C3" (a wall: it bursts)
03A021  func  burns_shot_run
comment burns_shot_run A shot the robot fires (4D40 type 25): runs its step and bursts on a wall.
param burns_shot_run x shot
# 03A024 "LBRA $78D8" (4F80 type EA, object_1d_parts 14: kind CE animation 88): 03B8D8 "LDU #$29,X; LDA #$43,U; BEQ"
# (the robot holds it out), "LDD #$0030" in front, its place and speeds; "CLR ,X"
03A024  func  burns_held_part_run
comment burns_held_part_run The part the robot holds out in front of it (4F80 type EA): kept 48 in front of the robot while it holds it, gone after.
param burns_held_part_run x part
# 03A027 "LBRA $791A" (5280 type E2, object_1d_parts 7: kind D3 mr_burns animation 80): 03B91A "LDU #$7DDB"
03A027  func  mr_burns_run
comment mr_burns_run Mr. Burns out of his beaten robot (5280 type E2, kind D3): runs his step.
param mr_burns_run x burns

# ---- stage 8's first boss: helpers ----
# 03A02D "LDB <$50; LSRB; BCC; TST $4A42; BMI" ... (each player in the game: field 02, player_state_classes: down)
03A02D  func  stage_8_boss_player_down
comment stage_8_boss_player_down Carry when a player in the game is reeling or down (its field 02, which bank 1F sets from its state by player_state_classes, negative).
# 03A058 "STA #$05,X; CLRW #$0F,X; CLRW #$14,X; STY #$2E,X"
03A058  func  stage_8_boss_bomb_set_state
comment stage_8_boss_bomb_set_state Stops the bomb and sets its animation (A), state and timer (Y).
param stage_8_boss_bomb_set_state x bomb
# 03A072 "ORA #$08", 03A07B "ANDA #$F7" (field 00 bit 3: in the air, 07D19C)
03A072  func  stage_8_boss_set_in_air
comment stage_8_boss_set_in_air Marks the object in the air.
param stage_8_boss_set_in_air x self
03A07B  func  stage_8_boss_set_on_floor
comment stage_8_boss_set_on_floor Marks the object on the floor.
param stage_8_boss_set_on_floor x self
# 03A084 "LBSR $863B" / "$8644" / "$8647" (the floor where it goes: walls stop x or y), "STD #$5C,X", "SUBD #$0060"
# (gravity, CLRA), landed "COMA"
03A084  func  stage_8_boss_move
comment stage_8_boss_move Stops the object's x or y speed at walls, takes the floor under it, and lets it fall: carry once it is on the floor.
param stage_8_boss_move x boss
# 03A0E7 "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40" (a random player), "LBSR $6109" up to 4 times
03A0E7  func  stage_8_boss_pick_player
comment stage_8_boss_pick_player A random player in play, in U.
# 03A109 "LEAU #$00C0,U; CMPU #$4D40; LDU #$4A40; TST #$00,U"
03A109  func  stage_8_boss_next_player
comment stage_8_boss_next_player The next player's object after U (from the first after the fourth); Z when it is not in play.
# 03A119 "LDU #$25,X; LDA #$5B,U; ANDA #$F0; STA #$27,X" (the player who hit it: who scores)
03A119  func  stage_8_boss_credit_hitter
comment stage_8_boss_credit_hitter Notes the player who hit it (its number from the player's field 5B) for the score.
param stage_8_boss_credit_hitter x boss
# 03A125 "LDA #$27,X; ORA #$81; STA #$27,X"
03A125  func  stage_8_boss_give_score
comment stage_8_boss_give_score Marks its score for the player who beat it.
param stage_8_boss_give_score x boss
# 03A12E "LDB <$50; LDU #$4A40; LBSR $6150" ... (each player in the game)
03A12E  func  stage_8_boss_find_close_player
comment stage_8_boss_find_close_player Carry when a player in the game is within F8 of it across and FA in depth, that player in U.
param stage_8_boss_find_close_player x boss
# 03A150 "LSRB; BCC" (the player's bit), "SUBD #$0C,U; ABSD; CMPD <$F8", "SUBD #$11,U; ABSD; CMPD <$FA"
03A150  func  stage_8_boss_player_is_close
comment stage_8_boss_player_is_close Carry when the player U, in the game by the bit in B, is within F8 across and FA in depth.
param stage_8_boss_player_is_close x boss
# 03A177 "ORA #$04" / 03A180 "ANDA #$FB" (field 00 bit 2: 07C26D, no harm)
03A177  func  stage_8_boss_make_invulnerable
comment stage_8_boss_make_invulnerable The boss can not be hurt.
param stage_8_boss_make_invulnerable x boss
03A180  func  stage_8_boss_make_vulnerable
comment stage_8_boss_make_vulnerable The boss can be hurt again.
param stage_8_boss_make_vulnerable x boss
# 03A189 "BITA #$20" (hit), "LDA #$1E,X; CMPA #$11; BLT" (a player's blow, 11 or more), "CMPU #$4A40 ... #$4D40; STA
# #$2A,U; STX #$49,U" (the player's spark), "LDA #$1B,X; LDB <$57; CMPA B,Y" (Y: the health it is beaten at, by
# players), "LDD #$6600; LBSR $8680", 03A1CD "CLR #$1B,X; LBSR $6119", A 1 or FF
03A189  func  stage_8_boss_take_hit
comment stage_8_boss_take_hit Takes a player's blow (strength 11 or more): sound 66, its spark on the player; 1 when it holds on, FF when its health is at or below the limit Y gives for the players in the game (beaten, the hitter noted), 0 when not hit.
param stage_8_boss_take_hit x boss
# 03A1DE "EORA #$80; ORA #$04; STA #$00,X" (blinks), "DEC #$2F,X; CLR #$00,X; LBSR $6125"
03A1DE  func  stage_8_boss_blink_out
comment stage_8_boss_blink_out Blinks, safe, until its timer runs out, then is gone with its score given (carry).
param stage_8_boss_blink_out x boss
# 03A1F7 "BITA #$02" (the animation's hit frame: hit Y, 03A180), "STY #$1C,X", "LSRA" (carry: the animation ended)
03A1F7  func  stage_8_boss_hit_on_frame
comment stage_8_boss_hit_on_frame At its animation's hit frames hits with Y and can be hurt, else no hit; carry when the animation has ended.
param stage_8_boss_hit_on_frame x boss
# 03A20E "LDD ,Y++; STD #$1F,X; LDD ,Y; STD #$21,X; STA #$24,X" (7A94, 7A98, 7ADE)
03A20E  func  stage_8_boss_set_box
comment stage_8_boss_set_box Sets the object's box from the 4 bytes Y points at.
param stage_8_boss_set_box x self
# 03A21C "LDY #$0F,X; BPL; LDA #$40", "EORA #$09,X; ANDA #$40" (facing another way: turns, its animation again)
03A21C  func  stage_8_boss_face_motion
comment stage_8_boss_face_motion Faces the way it moves, starting its animation again when it turns.
param stage_8_boss_face_motion x boss
# 03A23C "LBSR $8620" (07D301: the nearest player into its field 38), "CMPY #$0C,U"
03A23C  func  stage_8_boss_face_nearest_player
comment stage_8_boss_face_nearest_player Faces the nearest player.
param stage_8_boss_face_nearest_player x boss
# 03A25B "LDD #$0F,X; BNE; LDD #$14,X; BNE; COMA"
03A25B  func  stage_8_boss_is_still
comment stage_8_boss_is_still Carry when it has no x or y speed.
param stage_8_boss_is_still x boss
# 03A294 "CLRW #$0F,X; CLRW #$14,X", then 03A29A "LDY #$7A3A; LBRA $6065" (03A065 "STB #$2E,X; ASLB; LDD B,Y; STA
# #$2F,X; STB #$05,X": stage_8_boss_state_starts)
03A294  func  stage_8_boss_stop_and_start_state
comment stage_8_boss_stop_and_start_state Stops it and starts state B.
param stage_8_boss_stop_and_start_state x boss
03A29A  func  stage_8_boss_start_state
comment stage_8_boss_start_state Starts state B with its timer and animation from stage_8_boss_state_starts.
param stage_8_boss_start_state x boss

# ---- stage 8's first boss: its states (bank_1d_states, by field 2E) ----
# state 00: 03A2AA "LDA #$9C; STA #$04,X", "LDA #$80; STA #$1B,X; STA #$3D,X", "LDA #$01; STA #$2E,X", "LDA #$02; STA
# #$36,X", "LDD <$58; STD $1852" (the bombs' random number), "LDA #$02; STA #$2D,X", "LDD #$01A0; STD #$0C,X"
03A2AA  func  stage_8_boss_start
comment stage_8_boss_start Sets the boss up: kind 9C, health 80 with 3 phases to go, at x 1A0, the bombs' random number from the game's.
param stage_8_boss_start x boss
# state 01: 03A2D4 "TST <$92; BEQ; RTS", "LDD #$FE00; STD #$0F,X", "LDA #$80; STA #$00,X", "ORA #$40", "LDB #$02"
03A2D4  func  stage_8_boss_wait_to_enter
comment stage_8_boss_wait_to_enter Waits while direct page 92 is set, then shows itself walking in from the right (state 02).
param stage_8_boss_wait_to_enter x boss
# states 02, 06, 08, 17, 18: 03A2F2 "LDB #$01; STB <$A7; STB <$A8" (the scroll held), "LBSR $6084", "DEC #$2F,X"
03A2F2  func  stage_8_boss_timed_state
comment stage_8_boss_timed_state A timed state (walking in, poses before and after the fight, its defeat): holds the scroll, moves, and at the end of its time goes to the next state.
param stage_8_boss_timed_state x boss
# 03A303 "LDB #$2E,X; CMPB #$17; LDD #$4700; LBSR $8680" (after state 17), "INCB; LBRA $6294"
03A303  func  stage_8_boss_next_state
comment stage_8_boss_next_state Starts its next state (sound 47 after state 17).
param stage_8_boss_next_state x boss
# state 05: 03A317 "DEC #$2F,X", "LDA #$01; STA <$7C" (the scene's next music)
03A317  func  stage_8_boss_start_music
comment stage_8_boss_start_music After its pose, asks for the scene's next music (the boss's) and goes on.
param stage_8_boss_start_music x boss
# states 03, 04: 03A329 "DEC #$2F,X", "CMPA #$04", 03A338 "LDY #$7A78; LBSR $862F" (the balloon, type 1C), "LDD #$3F34;
# LBSR $8680" (its voice)
03A329  func  stage_8_boss_speak
comment stage_8_boss_speak Speaks: its speech balloon above it and its voice (3F34), then the next state.
param stage_8_boss_speak x boss
# state 07: 03A346 "BITA #$02; LDA <$57; ASLA; LBSR $6925" (two bombs a player at the throw), "LSRA; BCC" (animation
# end) "LDA #$C0; STA #$00,X", "LDY #$7A94; LBSR $620E", "LDA #$56; STA #$32,X"
03A346  func  stage_8_boss_opening_throw
comment stage_8_boss_opening_throw Its first throw: two bombs for each player in the game; when the animation ends it can be hit and the fight goes on.
param stage_8_boss_opening_throw x boss
# state 09: 03A370 "CLR <$A7; CLR <$A8" (the scroll free), "LDA #$2D,X; ASLA; LDY #$7A9C; JMP [A,Y]" (2D = 2: 637F, 1:
# 6441, 0: 64FA)
03A370  func  stage_8_boss_fight
comment stage_8_boss_fight The fight: frees the scroll and runs its phase (first, second or third by its phases to go).
param stage_8_boss_fight x boss
# 03A37F (phase 1): "DEC #$32,X", "LBSR $6991; CMPD #$00C0" (fast), "LDA #$38,X; BITA #$01" (to the nearest player:
# 8620, 861D, or a random way), stage_8_boss_walk_speeds_by_players, "LBSR $8617", "LBSR $696E", "DEC #$2F,X; LBEQ
# $6672"
# (laughs), 03A660 every 120 frames "LBSR $602D" (a player down: laughs), 03A3D9 the throw (state 0B, or 0C when
# running), stage_8_boss_stop_throwing_chances_by_players
03A37F  func  stage_8_boss_phase_1
comment stage_8_boss_phase_1 Its first phase: walks toward the nearest player or a random way, laughs now and then or when a player is down, and stops to throw bombs, again and again by chance.
param stage_8_boss_phase_1 x boss
# states 0B, 0C: 03A422 "BITA #$02; ... LDY #$7AA9; LDA A,Y; STA <$F0; LBSR $6925" (stage_8_boss_bombs_by_players),
# "LSRA; LBCC $6626" (animation end: 03A5D1)
03A422  func  stage_8_boss_throw
comment stage_8_boss_throw Throws its bombs (as many as stage_8_boss_bombs_by_players gives) at the throw frame, and goes back to fighting when the animation ends.
param stage_8_boss_throw x boss
# 03A441 (phase 2): "LDB #$0D; LBSR $629A", stage_8_boss_run_speeds_by_players "TST <$58; BPL; NEGA" (a random way),
# "LBSR $863B" (a wall ahead: the other way), "STD #$0F,X; STA #$36,X", "LDA #$80; STA #$34,X"
03A441  func  stage_8_boss_phase_2
comment stage_8_boss_phase_2 Starts its second phase: runs a random way (state 0D) at its run speed, for 128 steps.
param stage_8_boss_phase_2 x boss
# state 0D: 03A46E "DEC #$32,X; LBSR $6180" (can be hurt again), "LBSR $863B" (a wall: "NEGA; STA #$36,X"), "INC
# #$3E,X; BITA #$06; LDA <$57; ASLA; LBSR $6925" (bombs on the way), "DEC #$34,X" (03A4AF: to a random player at
# walk speed, state 0E), stage_8_boss_run_skip_attack_chances_by_players
03A46E  func  stage_8_boss_run_around
comment stage_8_boss_run_around Its run: turns back at walls, drops bombs as it goes, and after 128 steps walks at a random player dropping bombs (state 0E).
param stage_8_boss_run_around x boss
# state 0E: 03A4DE "LDA #$3E,X; ANDA #$03; ... LDA <$16; ANDA #$03; LDA #$01; LBSR $6925", "DEC #$2F,X; LBNE"
03A4DE  func  stage_8_boss_walk_and_bomb
comment stage_8_boss_walk_and_bomb Walks at its player dropping a bomb every 4 frames until its timer runs out, then fights on.
param stage_8_boss_walk_and_bomb x boss
# 03A4FA (phase 3): "LBSR $60E7; STU #$3A,X", "LDB #$0F; LBSR $629A", "LDD #$0001; STD #$0F,X", "INC #$33,X; LDA #$01;
# STA #$34,X", "LBSR $607B"
03A4FA  func  stage_8_boss_phase_3
comment stage_8_boss_phase_3 Starts its third phase: picks a random player to keep away from (state 0F).
param stage_8_boss_phase_3 x boss
# state 0F: 03A516 "LDA <$16; ANDA #$3F" (every 64 frames: "DEC #$34,X; BEQ $657B" the dash, another player), "LBSR
# $625B" (still) or "CMPA #$05" (6 times): 03A54D the jump at a player (state 10, 19 = 0900, jump speeds), else
# "LBSR $861D; ADDA #$80" (away from it) stage_8_boss_retreat_speeds_by_players; 03A57B the dash (state 14,
# stage_8_boss_dash_speeds_by_players)
03A516  func  stage_8_boss_keep_away
comment stage_8_boss_keep_away Its third phase: backs away from its player, jumps at a player when it stops or every sixth time, and dashes at one every 64 frames when its count runs out.
param stage_8_boss_keep_away x boss
# state 10: 03A59E "LBSR $6084; LBCS $65D1" (landed), "INC #$32,X; LDY #$7AD1; LDB <$57; CMPB A,Y; LBLE" (stage_8_boss_
# jump_bomb_player_limits), "LDA #$01; LBSR $6925"
03A59E  func  stage_8_boss_jump
comment stage_8_boss_jump In its jump: drops bombs (every frame with 2 or more players), and fights on when it lands.
param stage_8_boss_jump x boss
# state 14: 03A5C0 "LBSR $6072", "LBSR $6991; CMPD #$00C0; BLE $65D1" (slowed), "DEC #$2F,X"
03A5C0  func  stage_8_boss_dash
comment stage_8_boss_dash Its dash: goes on while it is fast and its timer lasts, then fights on.
param stage_8_boss_dash x boss
# 03A5D1 "LDB #$09; LBSR $6294", "LDY #$7A94; LBSR $620E"
03A5D1  func  stage_8_boss_resume
comment stage_8_boss_resume Back to fighting (state 09) with its usual box.
param stage_8_boss_resume x boss
# state 1D: 03A5DF "LBSR $6180", "DEC #$2F,X", "LDY #$7A98" (box), "LBSR $623C; LBSR $6177; LDB #$11"
03A5DF  func  stage_8_boss_attack_wind_up
comment stage_8_boss_attack_wind_up A close player: winds up, then turns to the nearest player and attacks (state 11), safe meanwhile.
param stage_8_boss_attack_wind_up x boss
# state 11: 03A5FC "LDY #$040A; LBSR $61F7" (its hit), "LBSR $6177; LDB #$12"
03A5FC  func  stage_8_boss_attack
comment stage_8_boss_attack Its close attack, hitting with 040A at its frames, then its second part (state 12).
param stage_8_boss_attack x boss
# state 12: 03A610 "LDY #$040A; LBSR $61F7; LBCC; LBRA $65D1"
03A610  func  stage_8_boss_attack_2
comment stage_8_boss_attack_2 The close attack's second part, hitting with 040A, then fights on.
param stage_8_boss_attack_2 x boss
# state 13: 03A61C "DEC #$2F,X; LBNE; LBRA $65D1" (03A672 "LDD #$7900; LBSR $8680; LDB #$13": its laugh, sound 79)
03A61C  func  stage_8_boss_laugh
comment stage_8_boss_laugh Laughing (sound 79) until its timer runs out, then fights on.
param stage_8_boss_laugh x boss
# state 0A: 03A625 "RTS"
03A625  func  stage_8_boss_idle
comment stage_8_boss_idle State 0A: nothing.
# 03A626 "LDD #$0030; STD <$F8; LDD #$0010; STD <$FA; LBSR $612E" (a player close), "LDB #$1D", "LDA #$3D,X; SUBA
# #$1B,X; CMPA #$10" (16 health lost since the last: "LDA #$14; STA #$2F,X", a short wind-up)
03A626  func  stage_8_boss_check_close_player
comment stage_8_boss_check_close_player With a player within 48 across and 16 in depth, starts its close attack (a short wind-up when it lost 16 health since the last), then moves and takes hits.
param stage_8_boss_check_close_player x boss
# 03A680 "LBSR $6084", then 03A683
03A680  func  stage_8_boss_move_and_take_hits
comment stage_8_boss_move_and_take_hits Moves it, then takes the players' blows.
param stage_8_boss_move_and_take_hits x boss
# 03A683 "LDY #$7ABD; LBSR $6189" (stage_8_boss_beaten_healths_by_players), "LDA #$02; STA <$7E; LDD #$0040 / #$0041;
# LBSR $8677" (its palette's flash by phase), turns to its hitter, "LDA #$1E,X; CMPA #$13" (a strong blow: state 16),
# "CMPD #$0400" (height speed at most), "LDD #$16,X; BNE" (on the floor: state 15), beaten: "LDD #$7900; LDB #$17"
03A683  func  stage_8_boss_take_hits
comment stage_8_boss_take_hits Takes a player's blow: flashes, turns to the hitter and reels (state 15) or falls (state 16, a strong blow or in the air); beaten, it cries out and starts its defeat (state 17).
param stage_8_boss_take_hits x boss
# states 15, 1E: 03A6F3 "LSRA; BCC" (animation end), "LDA #$C0; STA #$00,X", "CMPA #$01" (phase 2), "INC #$33,X; LDB
# #$33,X; LDY $7AB1; CMPB A,Y" (symbols.txt: the wrong table), "LDY #$7AB5; LDA A,Y; STA #$32,X; LBSR $6177"
03A6F3  func  stage_8_boss_reel
comment stage_8_boss_reel Reeling or getting up: when the animation ends fights on; in its second phase, after enough blows, it can not be hurt for a while.
param stage_8_boss_reel x boss
# state 16: 03A72D "LBSR $6084; LDA #$06,X; LSRA; BCC; LDB #$1E"
03A72D  func  stage_8_boss_fall_down
comment stage_8_boss_fall_down Knocked down: when the animation ends, gets up (state 1E).
param stage_8_boss_fall_down x boss
# states 19, 1A: 03A73B "STB <$A7; STB <$A8", "CLRW #$1C,X; LDA #$80; STA #$00,X", "BITA #$01; LBNE $6303" (next),
# "BITA #$02; LDD #$6F00; LBSR $8680; LDD #$0005; STD #$1C,X; LDA #$C0" (its own bomb's blast, hitting with 05)
03A73B  func  stage_8_boss_defeat_blast
comment stage_8_boss_defeat_blast Its defeat: holds the scroll; at the animation's frame a blast (the bombs' sound 6F) hitting around it with strength 05; then the next state.
param stage_8_boss_defeat_blast x boss
# state 1B: 03A769 "STB <$A7; STB <$A8", "LBSR $6084", "DEC #$2F,X", "LDD #$FD00; LBSR $8680"
03A769  func  stage_8_boss_defeat_wait
comment stage_8_boss_defeat_wait Lies beaten until its timer runs out, then sends sound FD and goes on.
param stage_8_boss_defeat_wait x boss
# state 1C: 03A782 "LBSR $61DE; BCC" (blinked out), "CLR <$A7; CLR <$A8", "LDA #$01; STA <$7D", "INC <$04"
03A782  func  stage_8_boss_vanish
comment stage_8_boss_vanish Blinks out; then frees the scroll, says a boss is beaten (direct page 7D) and moves the step on (07B333 then plays the story before the robot).
param stage_8_boss_vanish x boss

# ---- stage 8's first boss: its bombs ----
# the bomb's state 00: 03A7DC "LDD #$9C89; STD #$04,X", "LBSR $6072", "LDA #$02; STA #$5B,X", "LDA $1852; ANDA #$07;
# SUBA #$03" (spread), "LBSR $60E7; TST #$02,U; BPL" (at a player, or a random way when it is down), "ADDB #$1A;
# LBSR $8617" (speed), "STD #$19,X" (up, by the distance), "LDD #$0301; LBSR $8680" (far), "LDY #$40,X; LDA #$2E,Y;
# CMPA #$0E" (the boss walking and bombing: just dropped, 03A86A "LDD #$03A0; STD #$2E,X"), "LDY #$1852; LBSR $695C"
03A7DC  func  stage_8_boss_bomb_throw
comment stage_8_boss_bomb_throw Throws the bomb (kind 9C animation 89) at a random player, spread and sped by the bombs' random number, high enough for the distance; a bomb dropped while the boss walks just bounces about.
param stage_8_boss_bomb_throw x bomb
# its state 03: 03A871 "DEC #$2F,X; LBEQ $68E2" (the time runs out: blast), then 03A877
03A871  func  stage_8_boss_bomb_bounce
comment stage_8_boss_bomb_bounce A dropped bomb bouncing until its timer runs out, then it blows up.
param stage_8_boss_bomb_bounce x bomb
# its state 01: 03A877 "LDU #$16,X; BMI" (landed), "LEAU #$-18,U; STU #$19,X" (gravity), "LBSR $863B; INCA; BNE;
# CLRW #$0F,X; CLRW #$14,X" (a wall), 03A892 "LBSR $602D; BCS $68E2", "LDY #$40,X; TST #$1B,Y" (the boss beaten),
# "CMPA #$0E" / "CMPA #$01" (phase 2) "LBSR $695C; LDA $1852; BPL" (by chance), 03A8B9 three quarters of its
# speeds, half its height speed back up
03A877  func  stage_8_boss_bomb_fly
comment stage_8_boss_bomb_fly A flying bomb: falls, stopped by walls; on the floor it blows up (at once when a player is down or the boss beaten), or bounces on when the boss is bombing on the run, and by chance in its second phase.
param stage_8_boss_bomb_fly x bomb
# 03A8E2 "CLRW ...", "LDA #$C0; STA #$00,X", "LDD #$6F00; LBSR $8680", "LDY #$0200; LDA #$8A; LBSR $6058"
# (stage_8_boss_bomb_set_state: state 02),
# "LDD #$0405; STD #$1C,X", "LDY #$7ADE; LBRA $620E"
03A8E2  func  stage_8_boss_bomb_explode
comment stage_8_boss_bomb_explode Blows the bomb up: stopped on the floor, sound 6F, its blast (animation 8A) hitting with 0405 in its box.
param stage_8_boss_bomb_explode x bomb
# its state 02: 03A910 "BITA #$02; LDB #$80; STB #$00,X" (one frame of harm), "LSRA; BCS; CLR #$00,X"
03A910  func  stage_8_boss_bomb_blast
comment stage_8_boss_bomb_blast The blast: harms only until its hit frame, gone when the animation ends.
param stage_8_boss_bomb_blast x bomb
# 03A925 "STA <$F0", "LDY #$7A7E; LBSR $862F" (a bomb, type 1D in the 4D40 list), "LDY #$7A84; LBRA $862C" (the list
# full: type F1 in 5280), "DEC <$F0", then 03A93B (on the floor, x 30-1A0, depth over 90) "LDY #$7A8C; LBSR $862C"
03A925  func  stage_8_boss_throw_bombs
comment stage_8_boss_throw_bombs Puts in A bombs (the last in the 5280 list when the 4D40 list is full); on the floor within the play area also puts in the child 7A8C (type E1, state 26) under it.
param stage_8_boss_throw_bombs x boss
# 03A95C "LDD ,Y; PUSHS D; ADDD ,Y x3; ADDD ,S++; ADDD #$3711; STD ,Y"
03A95C  func  stage_8_boss_next_random
comment stage_8_boss_next_random Steps the random number Y points at: times 5 plus 3711.
param stage_8_boss_next_random y seed
# 03A96E "LDD #$0F,X; BMI", "BITA #$40", "EORA #$40; STA #$09,X; ORA #$80; STA #$05,X"
03A96E  func  stage_8_boss_turn_to_motion
comment stage_8_boss_turn_to_motion Turns it to the way it moves, starting its animation again (as stage_8_boss_face_motion).
param stage_8_boss_turn_to_motion x boss
# 03A991 "LDD #$0F,X; ABSD; ... LDD #$14,X; ABSD; ADDD ,S++"
03A991  func  stage_8_boss_speed
comment stage_8_boss_speed Its speed: its x and y speeds' sizes added.
param stage_8_boss_speed x boss

# ---- Mr. Burns' robot ----
# its handler (field 02) by 03A9C3 "LDU #$7AEE; LDA #$02,X; ASLA; JSR [A,U]": 00 03AD3B its entrance, 01 03AE41 / 02
# 03AE74
# / 03-05 03AEB4 walking by form, 06-08 03AEEA a swing, 09 03AF47 a volley, 0A 03AFD8 a lunge, 0B 03AFE8 the held part,
# 0C 03B084 lobbed bombs, 0D 03B12C gloating, FF 03AD07 hurt, FE-FA its forms 0-4 broken (03B3B8 "LDA #$FE; SUBA
# #$30,X; SUBA #$34,X; STA #$02,X"); each runs its steps by field 28. Its form is field 30 plus field 34 (03AAE5): 30
# goes 0-2 as forms 0 and 1 break (03AC9F "INC #$30,X"), 34 goes 0-2 as forms 2 and 3 do (03AAE2 "INC #$34,X")
# form 4 broken (FA): 03A9D3 "LDU #$7B0A; LDA #$28,X; ASLA; JMP [A,U]"
03A9D3  func  burns_robot_final_defeat
comment burns_robot_final_defeat Its last form broken: drops Maggie's object, walks to it, stops and lets Mr. Burns out, then is gone.
param burns_robot_final_defeat x robot
# 03A9DC "LDA #$84; STA #$05,X", "LDB #$01; LBSR $867D" (the 5280 list), "LDA #$E7; STA #$01,U", "LDD #$0420; SUBD <$AC"
# (stage x 420), "LDD #$00A8; ADDD <$B2", "STU #$38,X", "LDA #$C0; STA #$29,X", "LDD #$0100; STD #$46,X"
03A9DC  func  burns_robot_drop_maggie
comment burns_robot_drop_maggie Puts in Maggie's object (5280 type E7) at the stage's x 420 and keeps it; walks 192 frames, then up to 256 more until there.
param burns_robot_drop_maggie x robot
# 03AA0F "LDU #$38,X", "DEC #$29,X" (walks: 03AA41 "LBSR $861D; STA #$2D,X; LBSR $6ED3", x speed 0300 either way by the
# frame), "DECW #$46,X" / "CMPD #$0020" across and in depth: "LDD #$6E00; LBSR $8680; INC #$28,X"
03AA0F  func  burns_robot_walk_to_maggie
comment burns_robot_walk_to_maggie Walks to Maggie's object, staggering; once there (or out of time) sound 6E and the next step.
param burns_robot_walk_to_maggie x robot
# 03AA64 "LBSR $6B20; LBRA $74FE"
03AA64  func  burns_robot_stop_at_maggie
comment burns_robot_stop_at_maggie Starts breaking down (sound 6E, its look) and stops.
param burns_robot_stop_at_maggie x robot
# 03AA6A "ANDA #$01" (animation end), "LDB #$01; LBSR $867D; LDA #$07; LBSR $751E" (object_1d_parts 7: Mr. Burns, type
# E2), "LDY #$38,X; STU #$2A,Y; STY #$29,U" (linked to Maggie's object), "LDD #$D489; STD #$04,X" (burns_robot_5)
03AA6A  func  burns_robot_let_burns_out
comment burns_robot_let_burns_out When its animation ends, Mr. Burns comes out of it (5280 type E2), he and Maggie's object linked; the robot shows kind D4.
param burns_robot_let_burns_out x robot
# 03AA92 "ANDA #$01", "LDA #$27,X; ORA #$81; STA #$27,X" (its score), "CLR ,X"
03AA92  func  burns_robot_leave
comment burns_robot_leave When its animation ends, gives its score and is gone.
param burns_robot_leave x robot
# form 3 broken (FB): 03AAA4 "LDU #$7B14" (03AB20, 03AAAD)
03AAA4  func  burns_robot_form_3_broken
comment burns_robot_form_3_broken Form 3 broken: slows, sheds its pieces and goes on as form 4.
param burns_robot_form_3_broken x robot
# 03AAAD "ANDA #$02" (the frame), "INC <$7C" (the next music), "LDA #$03; BSR $6B00 ... #$83 ... #$04 ... #$84" (pieces
# 3
# and 4 both ways), "INC #$34,X", "LDU #$7B80 ... STA #$1B,X; STA #$2F,X" (burns_robot_healths), "LBSR $7590; LBSR
# $739A; LBRA $727F"
03AAAD  func  burns_robot_shed_form_3
comment burns_robot_shed_form_3 At its frame: the next music, pieces 3 and 4 fly off both ways, and it goes on as the next form with that form's health, walking at a target.
param burns_robot_shed_form_3 x robot
# 03AB00 "LDB #$01; LBSR $867D", "LBSR $751E" (object_1d_parts A), "LDA #$88; STA ,U", "LDD #$0500; STD #$19,U"
03AB00  func  burns_robot_throw_piece
comment burns_robot_throw_piece Throws off piece A of object_1d_parts (in the 5280 list), up at 0500.
param burns_robot_throw_piece x robot
# form 2 broken (FC): 03AB17 "LDU #$7B18" (03AB20, 03AB38)
03AB17  func  burns_robot_form_2_broken
comment burns_robot_form_2_broken Form 2 broken: slows, sheds its pieces and goes on as form 3.
param burns_robot_form_2_broken x robot
# 03AB20 "LDA #$0A; ADDA #$30,X; ADDA #$34,X; LBSR $72F0" (its look), "LDD #$6E00; LBSR $8680", "LBSR $7509"
03AB20  func  burns_robot_start_breaking
comment burns_robot_start_breaking Starts breaking: its breaking look for its form, sound 6E, slowed to a quarter.
param burns_robot_start_breaking x robot
# 03AB38 "ANDA #$02", piece 2 at x + 20, piece 82, piece 2 again, "INC #$34,X", health, walk, target
03AB38  func  burns_robot_shed_form_2
comment burns_robot_shed_form_2 At its frame: pieces 2 fly off, and it goes on as the next form with that form's health, walking at a target.
param burns_robot_shed_form_2 x robot
# 03AB82: 03AB00's code again
03AB82  func  burns_robot_throw_piece_2
comment burns_robot_throw_piece_2 Throws off piece A, up at 0500 (as burns_robot_throw_piece).
param burns_robot_throw_piece_2 x robot
# form 1 broken (FD): 03AB99 "LDU #$7B1C" (03AC06, 03AC1B, 03ABA2, 03AC73, 03AC81, 03AC9F, 03ACBF)
03AB99  func  burns_robot_form_1_broken
comment burns_robot_form_1_broken Form 1 broken: shakes, sheds its pieces, falls, lies, and gets up as form 2.
param burns_robot_form_1_broken x robot
# 03ABA2 "ANDA #$02", "CLRD; STD #$0F,X", "ADDD #$0020; STD #$16,X", "LDA #$81; BSR $6BEC" (x 0100, y FFC0, up 0500),
# "LDA #$01" (x FF00, y FFE0, up 0300), "LDA #$14; LBSR $72F0"
03ABA2  func  burns_robot_shed_form_1
comment burns_robot_shed_form_1 At its frame: stops, rises 32, throws off pieces 1 both ways, and takes its falling look.
param burns_robot_shed_form_1 x robot
# 03ABEC "LBSR $751E; LDA #$80; STA ,U"
03ABEC  func  burns_robot_throw_piece_3
comment burns_robot_throw_piece_3 Puts in piece A, shown.
param burns_robot_throw_piece_3 x robot
# form 0 broken (FE): 03ABFD "LDU #$7B2A" (03AC06, 03AC1B, 03AC40, 03AC73 ...)
03ABFD  func  burns_robot_form_0_broken
comment burns_robot_form_0_broken Form 0 broken: shakes, sheds its pieces, falls, lies, and gets up as form 1.
param burns_robot_form_0_broken x robot
# 03AC06 "CLRA; ADDA #$30,X; ADDA #$34,X; LBSR $72F0", "LDA #$40; STA #$29,X", 03ACDF "LDD #$0300; ... NEGW #$0F,X" (a
# shake every frame)
03AC06  func  burns_robot_broken_shake
comment burns_robot_broken_shake Shakes in its form's look for 64 frames.
param burns_robot_broken_shake x robot
# 03AC1B "DEC #$29,X", "LDA #$30,X; CMPA #$01; BEQ; INC <$7C", "LDD #$6E00", "LDA #$0A; ADDA #$30,X ..."
03AC1B  func  burns_robot_broken_cry
comment burns_robot_broken_cry After the shaking: the next music (but in form 1), sound 6E, its breaking look.
param burns_robot_broken_cry x robot
# 03AC40 "ANDA #$02", stops, rises 32, "CLRA; LBSR $6CF0" / "LDA #$80" (pieces 0 both ways), "LDA #$14"
03AC40  func  burns_robot_shed_form_0
comment burns_robot_shed_form_0 At its frame: stops, rises 32, throws off pieces 0 both ways, and takes its falling look.
param burns_robot_shed_form_0 x robot
# 03AC73 "LBSR $85B1; BCC" (07D16E: falls, carry on the floor), "LDA #$80; STA #$29,X"
03AC73  func  burns_robot_fall_down
comment burns_robot_fall_down Falls to the floor, then lies 128 frames.
param burns_robot_fall_down x robot
# 03AC81 "DEC #$29,X", "INC <$7C" (but in form 1), "LDA #$15; ADDA #$30,X ..."
03AC81  func  burns_robot_lie_broken
comment burns_robot_lie_broken Lying broken: the next music (but in form 1), then its lying look.
param burns_robot_lie_broken x robot
# 03AC9F "ANDA #$01" (animation end), "INC #$30,X", "LDD #$3F35; LBSR $8680", "LDA #$40; STA #$29,X"
03AC9F  func  burns_robot_rise_as_next_form
comment burns_robot_rise_as_next_form When its animation ends, rises as its next form (field 30 one more), with Mr. Burns' voice (3F35).
param burns_robot_rise_as_next_form x robot
# 03ACBF "DEC #$29,X", burns_robot_healths "STA #$1B,X; STA #$2F,X", "LBSR $7590; LBSR $739A; LBRA $727F"
03ACBF  func  burns_robot_start_form
comment burns_robot_start_form After 64 frames: its new form's health, its timers back to 0, walking at a target.
param burns_robot_start_form x robot
# 03ACF0: 03AB00's code again
03ACF0  func  burns_robot_throw_piece_4
comment burns_robot_throw_piece_4 Throws off piece A, up at 0500 (as burns_robot_throw_piece).
param burns_robot_throw_piece_4 x robot
# hurt (FF, 03B43A): 03AD07 "LDU #$7B38" (03AD10, 03AD2F)
03AD07  func  burns_robot_hurt
comment burns_robot_hurt Hurt by a blow: flashes and reels for 16 frames.
param burns_robot_hurt x robot
# 03AD10 "LDA #$02; STA <$7E; LDD #$003F; LBSR $8677" (palette effect 3F), "LDA #$17; ADDA #$30,X ...", "LDA #$10; STA
# #$29,X"
03AD10  func  burns_robot_hurt_flash
comment burns_robot_hurt_flash Flashes its palette and takes its hurt look for 16 frames.
param burns_robot_hurt_flash x robot
# 03AD2F "DEC #$29,X; LBSR $739A; LBSR $727F"
03AD2F  func  burns_robot_hurt_end
comment burns_robot_hurt_end When the 16 frames are up, walks at a target again.
param burns_robot_hurt_end x robot
# its entrance (00): 03AD3B "LDU #$7B3C" (03AD44 ... 03AE28)
03AD3B  func  burns_robot_entrance
comment burns_robot_entrance Its entrance, step by step until it can be fought.
param burns_robot_entrance x robot
# 03AD44 "STX $1854", "LDA #$01; STA #$5B,X", "LDD #$0420; SUBD <$AC", "LDD #$00E8; ADDD <$B2", "LDA #$A0; STA #$1B,X;
# STA #$2F,X"
03AD44  func  burns_robot_place
comment burns_robot_place Puts the robot at the stage's x 420 with health A0, and keeps it in 1854.
param burns_robot_place x robot
# 03AD6B "LDA <$81; BEQ" (07B351: the story after the first boss has run), "LDA #$20; STA #$29,X"
03AD6B  func  burns_robot_wait_for_story
comment burns_robot_wait_for_story Waits until the story after stage 8's first boss is over (direct page 81).
param burns_robot_wait_for_story x robot
# 03AD79 "DEC #$29,X", "LDA #$80; STA #$00,X", "LDA #$32; LBSR $72F0", "CLRA; LBSR $72FF"
03AD79  func  burns_robot_appear
comment burns_robot_appear After 32 frames shows itself (look 32), harmless.
param burns_robot_appear x robot
# 03AD90 "ANDA #$01; BNE" (while its animation runs), "SUBD #$0010; STD #$11,X", "LDA #$40; STA #$29,X"
03AD90  func  burns_robot_step_up
comment burns_robot_step_up Steps 16 up the screen and waits 64 frames.
param burns_robot_step_up x robot
# 03ADA9 "DEC #$29,X", "LDB #$02; LBSR $867D; LDA #$29; STA #$01,U; LDD #$B083; STD #$04,U" (a speech balloon, kind B0,
# in
# the 4D40 list), "LDA #$80; STA #$28,U; STX #$29,U", "LDD #$3F36; LBSR $8680", "LDA #$33"
03ADA9  func  burns_robot_speak
comment burns_robot_speak Mr. Burns speaks: a speech balloon (4D40 type 29, kind B0 animation 83) on the robot and his voice (3F36).
param burns_robot_speak x robot
# 03ADD7 "ANDA #$02" (the frame), "LDB #$01; LBSR $867D; LDA #$08; LBSR $751E" (object_1d_parts 8: type E4), "LDA #$40;
# STA #$0A,U; STA #$0B,U" (full size), "LDA #$40; STA #$29,X", "LDD #$0301; LBSR $8680"
03ADD7  func  burns_robot_toss_part
comment burns_robot_toss_part At its frame tosses away a part (object_1d_parts 8, 5280 type E4) at full size, with sound 0301.
param burns_robot_toss_part x robot
# 03AE05 "DEC #$29,X", "LDD #$1400; LBSR $8680", "LDA #$01; STA <$7C", "LDA #$34; LBSR $72F0", "INC <$04"
03AE05  func  burns_robot_start_fight
comment burns_robot_start_fight After 64 frames: sound 14, the scene's next music, its fighting look, and the step moves on.
param burns_robot_start_fight x robot
# 03AE28 "ANDA #$01" (animation end), "LBSR $7590", "ORA #$40; STA ,X" (it can be hit), "CLR #$28,X; LDA #$01; STA
# #$02,X"
03AE28  func  burns_robot_ready
comment burns_robot_ready When its animation ends it can be hit and starts walking (handler 01).
param burns_robot_ready x robot
# handler 01: 03AE41 "LBSR $7176; BCS" (an attack), "LBSR $727F; BCS" (no target), "LDA #$05; ADDA #$30,X; LBSR $72F0"
# (its walking look), "LBSR $72A6; LDA #$2D,X; STA #$31,X; LBSR $7263" (straight at it), "LDD #$5A00" (steps)
03AE41  func  burns_robot_walk_form_0
comment burns_robot_walk_form_0 Form 0 walking straight at its target with heavy steps (sound 5A), attacking when it can.
param burns_robot_walk_form_0 x robot
# handler 02: 03AE74 "LBSR $71B5", "LDA <$16; ANDA #$3F; LDD #$1300" (sound 13 every 64 frames), "LDA #$2D,X; SUBA
# #$31,X" (turns by 1)
03AE74  func  burns_robot_walk_form_1
comment burns_robot_walk_form_1 Form 1 walking at its target, turning a step at a time, sound 13 every 64 frames, attacking when it can.
param burns_robot_walk_form_1 x robot
# handlers 03-05: 03AEB4 "LBSR $71FF", "LDA #$05; ADDA #$30,X; ADDA #$34,X", then 03AED3
03AEB4  func  burns_robot_walk_late_forms
comment burns_robot_walk_late_forms Forms 2-4 walking at their target, turning 3 steps at a time, attacking when they can.
param burns_robot_walk_late_forms x robot
# 03AED3 "LDA #$03; LDB #$2D,X; SUBB #$31,X ... ADDA #$31,X; STA #$31,X", "LBSR $7263"
03AED3  func  burns_robot_steer
comment burns_robot_steer Turns its walking direction up to 3 steps toward its aim and walks that way.
param burns_robot_steer x robot
# handlers 06-08: 03AEEA "LDU #$7B4C" (03AEF3, 03AF1E, 03AF41)
03AEEA  func  burns_robot_swing
comment burns_robot_swing A swing (forms 0 and 1, and form 2's other attack): stops, winds up, hits at its frames, walks on.
param burns_robot_swing x robot
# 03AEF3 "LBSR $74FE", then 03AEF6
03AEF3  func  burns_robot_stop_and_wind_up
comment burns_robot_stop_and_wind_up Stops and winds up.
param burns_robot_stop_and_wind_up x robot
# 03AEF6 "LDA #$29,X; BEQ; DEC #$29,X", "LDD #$7D00; LBSR $8680", "ORA #$04" (no harm), "LDA #$30,X; ADDA #$34,X; ASLA;
# ADDA #$26; ADDA #$35,X; LBSR $72F0"
03AEF6  func  burns_robot_wind_up
comment burns_robot_wind_up Waits out its wait (32 frames after a quick decision), then sound 7D and its attack's look for its form and attack; it can not be hurt.
param burns_robot_wind_up x robot
# 03AF1E "ANDA #$01" (animation end: next), "ANDB #$02" (the frames: "LDA #$30,X ... ADDA #$35,X; ADDA #$03"), "LBSR
# $72FF" (its box, burns_robot_hit_boxes)
03AF1E  func  burns_robot_swing_hit
comment burns_robot_swing_hit Hits with its attack's box at the animation's hit frames, none between; the next step when the animation ends.
param burns_robot_swing_hit x robot
# 03AF41 "LBSR $739A; LBRA $727F"
03AF41  func  burns_robot_walk_on
comment burns_robot_walk_on Walks at a target again.
param burns_robot_walk_on x robot
# handler 09: 03AF47 "LDU #$7B52" (03AEF3, 03AF50, 03AFA0, 03AFCA)
03AF47  func  burns_robot_volley
comment burns_robot_volley A volley of shots (form 1's second attack): winds up, fires shot after shot, walks on.
param burns_robot_volley x robot
# 03AF50 "ANDA #$02", "LDB #$02; LBSR $867D" (4D40), "LDA #$88; STA ,U", "LDA #$10; STA #$29,U", "LDD #$0500" (by its
# facing), "LDA #$05 ... ORA #$05; LBSR $751E" (object_1d_parts 5, type 25), "LDD #$1D00; LBSR $8680", "LDA #$0F;
# LBSR $72FF" (the shot's box)
03AF50  func  burns_robot_fire_shot
comment burns_robot_fire_shot At its frame fires a shot (4D40 type 25) at x speed 0500 the way it faces, sound 1D.
param burns_robot_fire_shot x robot
# 03AFA0 "ANDA #$01", "LDU #$7B5A; LDA <$57; DECA; INC #$40,X; LDB #$40,X; CMPB A,U" (burns_robot_volleys_by_players),
# "LDA #$8E; DEC #$28,X" (another) / "LDA #$8C; INC #$28,X"
03AFA0  func  burns_robot_volley_next
comment burns_robot_volley_next When the animation ends: another shot until burns_robot_volleys_by_players are fired, then the volley's end.
param burns_robot_volley_next x robot
# 03AFCA "ANDA #$01; LBSR $739A; LBRA $727F"
03AFCA  func  burns_robot_volley_end
comment burns_robot_volley_end When the animation ends, walks at a target again.
param burns_robot_volley_end x robot
# handler 0A: 03AFD8 "LDU #$7B5E" (03AFE1, 03AEF6, 03AF1E, 03AF41)
03AFD8  func  burns_robot_lunge
comment burns_robot_lunge A lunge (form 2's first attack): slows, winds up, hits, walks on.
param burns_robot_lunge x robot
# 03AFE1 "LBSR $7509; INC #$28,X"
03AFE1  func  burns_robot_slow_down_step
comment burns_robot_slow_down_step Slows to a quarter of its speed, then the next step.
param burns_robot_slow_down_step x robot
# handler 0B (03B4C4): 03AFE8 "LDU #$7B66; ... JSR [A,U]; LBRA $6ED0" (03AFF4, 03B009, 03B022, 03B066; then it steers)
03AFE8  func  burns_robot_part_attack
comment burns_robot_part_attack Its held part (forms 2 and 3): raises it, holds it out in front for 64 frames while it walks, then walks on.
param burns_robot_part_attack x robot
# 03AFF4 "LDA #$30,X; ADDA #$34,X; ASLA; ADDA #$27; LBSR $72F0", "LDA #$20; STA #$29,X"
03AFF4  func  burns_robot_part_attack_start
comment burns_robot_part_attack_start Takes its look for the held part's attack by form.
param burns_robot_part_attack_start x robot
# 03B009 "ANDA #$01", "LDD #$1100; LBSR $8680", "LDA #$30; ADDA #$34,X; LBSR $72F0"
03B009  func  burns_robot_part_attack_raise
comment burns_robot_part_attack_raise When its animation ends, sound 11 and its holding look.
param burns_robot_part_attack_raise x robot
# 03B022 "ANDA #$02", "ANDA #$FB" (can be hurt), "CLRB; LBSR $867D" (4F80), "LDA #$0E ... LBSR $751E" (object_1d_parts
# 14, type EA, by its facing), "LDA #$C0; STA ,U; STX #$29,U; STU #$44,X", "LDA #$10; LBSR $72FF" (the part's box),
# "LDA #$40; STA #$29,X; LDA #$01; STA #$43,X"
03B022  func  burns_robot_part_attack_hold
comment burns_robot_part_attack_hold At its frame holds out its part (4F80 type EA) in front of it, harmful, for 64 frames.
param burns_robot_part_attack_hold x robot
# 03B066 "LDU #$44,X; LDD #$0F,X; STD #$0F,U; LDD #$14,X; STD #$14,U", "DEC #$29,X", "CLR #$43,X", walk on
03B066  func  burns_robot_part_attack_carry
comment burns_robot_part_attack_carry Carries the held part along with its speeds; when the 64 frames are up lets go of it and walks at a target.
param burns_robot_part_attack_carry x robot
# handler 0C (03B4E1): 03B084 "LDU #$7B6E" (03B08D, 03B0A7, 03B0EF, 03B106)
03B084  func  burns_robot_lob_bombs
comment burns_robot_lob_bombs Lobs bombs (the tables' shots: 4D40 type 26): aims, throws, recovers; form 4 throws three.
param burns_robot_lob_bombs x robot
# 03B08D "LDA #$30,X; ADDA #$34,X; ASLA; ADDA #$1C; LBSR $72F0", "CMPA #$02; LBEQ $7509" (form base 2 slows) "LBRA
# $74FE" (else stops)
03B08D  func  burns_robot_lob_aim
comment burns_robot_lob_aim Takes its throwing look by form, slowing (forms 2-4) or stopping.
param burns_robot_lob_aim x robot
# 03B0A7 "ANDA #$02", "LDB #$02; LBSR $867D", "LDA #$C8; STA ,U", "LDD #$0200" (by facing), "LDA #$09 ... ADDA #$30,X;
# ADDA #$34,X; LBSR $751E" (object_1d_parts 9 + form, type 26), "LDY #$7B76; LDA #$3D,X; ASLA; LDD A,Y; STD #$14,U"
# (burns_robot_shot_y_speeds)
03B0A7  func  burns_robot_lob_throw
comment burns_robot_lob_throw At its frame throws a bomb (4D40 type 26) at x speed 0200 the way it faces, its y speed by the count of bombs thrown.
param burns_robot_lob_throw x robot
# 03B0EF "ANDA #$01", "LDA #$30,X; ADDA #$34,X; ASLA; ADDA #$1D; LBSR $72F0"
03B0EF  func  burns_robot_lob_recover
comment burns_robot_lob_recover When its animation ends, its look after the throw.
param burns_robot_lob_recover x robot
# 03B106 "ANDA #$01", "CMPA #$04" (form 4: "INC #$3D,X; CMPA #$03; BLT; CLR #$28,X" again), "LBSR $739A; LBRA $727F"
03B106  func  burns_robot_lob_end
comment burns_robot_lob_end When its animation ends, form 4 throws again up to three bombs; then walks at a target.
param burns_robot_lob_end x robot
# handler 0D (03B3D8): 03B12C "LDU #$7B7C" (03B135, 03B155)
03B12C  func  burns_robot_gloat
comment burns_robot_gloat Gloating with no target (a player down or none to go for): waits for a player, then walks on.
param burns_robot_gloat x robot
# 03B135 "CMPA #$02; BEQ; LBSR $74FE" (stops but in form base 2), "LBSR $8686; BCC" (07D2AB: a player to go for), "ORA
# #$40" (can be hit), "LDA #$20; STA #$29,X"
03B135  func  burns_robot_gloat_until_player
comment burns_robot_gloat_until_player Stands (but in forms 2-4) until there is a player to go for, then can be hit again and waits 32 frames.
param burns_robot_gloat_until_player x robot
# 03B155 "DEC #$29,X; LBSR $739A; LBSR $727F"
03B155  func  burns_robot_gloat_end
comment burns_robot_gloat_end After 32 frames walks at a target.
param burns_robot_gloat_end x robot
# 03B161 "BITA #$20" (hit), "LDB #$1E,X; BEQ; BMI", "CLR #$43,X; LBSR $73FB"
03B161  func  burns_robot_check_hit
comment burns_robot_check_hit When a player's blow hits it, lets go of its held part and takes the blow.
param burns_robot_check_hit x robot
# 03B176 "LBSR $7243" (facing the target), "LBSR $7577; LBSR $7566; LBCS $74E1" (bombs when due and in the middle),
# "LDD #$0058; STD <$F8; LDD #$0012; STD <$FA; LBSR $7371" (in reach), "LDU #$7BA3 ... CMPA <$58" (burns_robot_second_
# attack_chances_by_players) "STA <$F0; LBRA $7443"
03B176  func  burns_robot_decide_form_0
comment burns_robot_decide_form_0 Form 0: facing its target, lobs bombs when they are due and it is in the middle, else attacks a target in reach (its second attack by chance); carry when it does.
param burns_robot_decide_form_0 x robot
# 03B1B5 likewise, and "LDD #$3E,X; CMPD #$0080", "LDD #$0022; STD <$FA; LBSR $737B", "LBSR $7566; LBCS $749D" (the
# volley)
03B1B5  func  burns_robot_decide_form_1
comment burns_robot_decide_form_1 Form 1: as form 0, and fires a volley at a target in line across but further back once 128 frames have passed since the last.
param burns_robot_decide_form_1 x robot
# 03B1FF likewise, and "LDA #$34,X; CMPA #$02; BEQ" (not form 4), "LDY #$7BC7 ... CMPD #$41,X; LBLE $74C4" (the held
# part)
03B1FF  func  burns_robot_decide_late_forms
comment burns_robot_decide_late_forms Forms 2-4: as form 0, and holds out its part when burns_robot_held_part_times have passed (not form 4).
param burns_robot_decide_late_forms x robot
# 03B243 "LDU #$2B,X; LDD #$0C,X; CMPD #$0C,U", "ANDA #$40" (facing)
03B243  func  burns_robot_facing_target
comment burns_robot_facing_target Carry when it faces its target.
param burns_robot_facing_target x robot
# 03B263 "LDA #$31,X", burns_robot_walk_speeds by form and rank "LBSR $8617", "LBSR $72D5"
03B263  func  burns_robot_walk
comment burns_robot_walk Walks in its walking direction at its form's speed for the rank, facing it.
param burns_robot_walk x robot
# 03B27F "LBSR $8686; LBCC $73D8" (none: gloats), "LDY #$2B,X; LDA #$00,Y; ... LDA #$02,Y; BMI" (gone or down), "DEC
# #$2A,X", "LDA #$40; STA #$2A,X; STU #$2B,X"
03B27F  func  burns_robot_choose_target
comment burns_robot_choose_target Keeps its target for 64 frames, taking the player 07D2AB finds when the target is gone or down; with none it gloats (carry).
param burns_robot_choose_target x robot
# 03B2A6 "LDU #$2B,X", "LDB #$C0 / #$40", "LBSR $8638" (a wall there: the other side), "LBSR $8671; STA #$2D,X", "LBSR
# $861D; STA #$2E,X"
03B2A6  func  burns_robot_aim_at_target
comment burns_robot_aim_at_target Aims at the place beside its target on its own side (the other side when that is a wall), and notes the direction to the target.
param burns_robot_aim_at_target x robot
# 03B2D5 "LDA #$2E,X; ADDA #$40; CMPA #$80"
03B2D5  func  burns_robot_face_target
comment burns_robot_face_target Faces left or right by the direction to its target.
param burns_robot_face_target x robot
# 03B2F0 "LDU #$7BF9; ASLA; LDD A,U; ORB #$80; STD #$04,X"
03B2F0  func  burns_robot_set_look
comment burns_robot_set_look Takes look A of burns_robot_animations: its kind and animation.
param burns_robot_set_look x robot
# 03B2FF "LDU #$7C65; ASLA; LDU A,U", "STA #$1C,X; STB #$1D,X", "STD #$1F,X", "STD #$21,X", "STD #$23,X"
03B2FF  func  burns_robot_set_box
comment burns_robot_set_box Takes box A of burns_robot_hit_boxes: its hit, sizes and offsets.
param burns_robot_set_box x self
# 03B371 "LDU #$2B,X; BSR $738A; BSR $737B"
03B371  func  burns_robot_target_in_reach
comment burns_robot_target_in_reach Carry when its target is within F8 across and up to FA further down the screen.
param burns_robot_target_in_reach x robot
# 03B37B "LDD #$11,U; SUBD #$11,X; BMI; CMPD <$FA"
03B37B  func  burns_robot_target_in_depth
comment burns_robot_target_in_depth Carry when U is up to FA further down the screen than it.
param burns_robot_target_in_depth x robot
# 03B38A "SUBD #$0C,U; ABSD; CMPD <$F8"
03B38A  func  burns_robot_target_across
comment burns_robot_target_across Carry when U is within F8 across.
param burns_robot_target_across x robot
# 03B39A "ORA #$40; ANDA #$FB" (can be hit and hurt), "CLRA; ADDA #$30,X; LBSR $72FF", "LDA #$01; ADDA #$30,X; STA
# #$02,X"
03B39A  func  burns_robot_start_walking
comment burns_robot_start_walking Back to walking: can be hit and hurt, its body's box, its form's walking handler.
param burns_robot_start_walking x robot
# 03B3D8 "LDD #$3F38; LBSR $8680", "LDA #$0D; STA #$02,X", "LDA #$0F; ADDA #$30,X ...", "ANDA #$BF", "COMA"
03B3D8  func  burns_robot_start_gloating
comment burns_robot_start_gloating Mr. Burns gloats (voice 3F38): handler 0D with its gloating look; it can not be hit meanwhile.
param burns_robot_start_gloating x robot
# 03B3FB "LDU #$25,X; STA #$2A,U; STX #$49,U" (the player's spark), "ANDA #$BB", "LDD #$6600", "CLRA; LBSR $72FF",
# 03B422
# burns_robot_beaten_healths "LBLS $73B8" (beaten: 03B3B8 its broken handler FE - form, its score's player), "LDA #$FF;
# STA #$02,X" (hurt)
03B3FB  func  burns_robot_take_hit
comment burns_robot_take_hit Takes a blow: a spark on the player, sound 66, no box; at or below its form's beaten health for the players in the game its form breaks, else it is hurt.
param burns_robot_take_hit x robot
# 03B443 "LDA <$F0; STA #$35,X", "LDU #$2B,X; LDA #$02,U; LBMI $73D8" (the target down: gloats), "LDA #$30,X; ASLA; ADDA
# #$35,X; ADDA #$06; STA #$02,X", burns_robot_quick_attack_chances, "LDA #$2F,X; SUBA #$1B,X; CMPA #$0C", "LDA #$20; STA
# #$29,X"; 03B49D the volley (02 = 09), 03B4C4 the held part (02 = 0B)
03B443  func  burns_robot_start_attack
comment burns_robot_start_attack Starts attack F0 of its form (handler 6 + 2 x form base + it), at once by chance or after hurt, else after a 32-frame wait; gloats when its target is down.
param burns_robot_start_attack x robot
# 03B4E1 "CLRD; STD #$3B,X; CLR #$3D,X", "LBSR $72D5", "ORA #$04", "LDA #$0C; STA #$02,X"
03B4E1  func  burns_robot_start_lob
comment burns_robot_start_lob Starts lobbing bombs (handler 0C), facing its target, safe meanwhile.
param burns_robot_start_lob x robot
# 03B4FE "CLRD; STD #$0F,X; STD #$14,X; STD #$19,X"
03B4FE  func  burns_robot_stop
comment burns_robot_stop Stops: no x, y or height speed.
param burns_robot_stop x self
# 03B509 "ASRA; RORB" twice on 0F and 14
03B509  func  burns_robot_slow_down
comment burns_robot_slow_down Slows to a quarter of its x and y speeds.
param burns_robot_slow_down x robot
# 03B51E (symbols.txt: struct part, object_1d_parts) "LDY #$7D21; LEAY A,Y", bit 7 of A turned (09 = 40, x offset
# negated)
03B51E  func  burns_robot_place_part
comment burns_robot_place_part Sets up the new object U as part A of object_1d_parts at the robot's place (turned round when A has bit 7): its offsets, type, kind and animation.
param burns_robot_place_part x self
param burns_robot_place_part u part object
# 03B566 "CMPD #$0040 ... #$0180"
03B566  func  burns_robot_in_middle
comment burns_robot_in_middle Carry when its x is within 40-180.
param burns_robot_in_middle x robot
# 03B577 "LDY #$7BA7; LDA <$61; ADDA #$30,X; ADDA #$34,X; ANDA #$1E; LDD A,Y; CMPD #$3B,X"
03B577  func  burns_robot_lob_due
comment burns_robot_lob_due Carry when the frames since its last bombs pass burns_robot_shot_times for the rank and form.
param burns_robot_lob_due x robot
# 03B590 "CLRD; STD #$3B,X; STD #$3E,X; STD #$41,X"
03B590  func  burns_robot_reset_timers
comment burns_robot_reset_timers Its three attack timers back to 0.
param burns_robot_reset_timers x robot

# ---- the robot's objects ----
# 4D40 type 21 (7D99): 03B5A4 "LDA #$80; STA ,X; LDD #$CC91; STD #$04,X"
03B5A4  func  burns_breakout_start
comment burns_breakout_start Shows the robot's shape in the wall (kind CC, animation 91).
param burns_breakout_start x shape
# 03B5B2 "LDA <$81; BEQ" (waiting: "LDA <$16" 00 animation 91, 80 animation 93), "LDB #$02; LBSR $867D; LDA #$06; LBSR
# $751E" (object_1d_parts 6: type 00, kind 13 animation 89), "STU #$28,X"
03B5B2  func  burns_breakout_wait
comment burns_breakout_wait Flickers between two animations until the story after the first boss is over, then puts in the breaking piece (kind 13).
param burns_breakout_wait x shape
# 03B5EC "LDU #$28,X; LDA #$06,U; ANDA #$02" (its frame), "SUBD #$0010; STD #$11,U", "LDU #$30AC; LDA #$10 ... CLR
# #$-2000,U; STA ,U+" (16 rows of 32 tiles of layer A: tile 10, colour 0), "LDA #$04; STA ,X", "LDD #$4F00; LBSR $8680"
03B5EC  func  burns_breakout_break_wall
comment burns_breakout_break_wall At the piece's frame knocks a hole in the wall's tiles (16 rows of 32), hides the shape, sound 4F.
param burns_breakout_break_wall x shape
# 03B633 "LDU #$28,X; LDA #$06,U; ANDA #$01; CLR ,X; CLR ,U"
03B633  func  burns_breakout_end
comment burns_breakout_end When the piece's animation ends, both are gone.
param burns_breakout_end x shape
# 5280 type E4 (7DA1): 03B654 "LDD #$FF00; STD #$0F,X; LDD #$0100; STD #$19,X; LDD #$FFC0; STD #$14,X; LDA #$80; STA
# #$28,X"
03B654  func  burns_tossed_part_launch
comment burns_tossed_part_launch Sends the tossed part off left, up and back, for 128 frames.
param burns_tossed_part_launch x part
# 03B66F "DEC #$28,X; CLR ,X", "LDA <$16; ANDA #$03; DEC #$0A,X; DEC #$0B,X"
03B66F  func  burns_tossed_part_fly
comment burns_tossed_part_fly The tossed part flies off, shrinking every 4 frames, gone after 128.
param burns_tossed_part_fly x part
# 5280 types E5, E6 (7DA5): state 3, 03B68E "DEC #$28,X; CLR ,X", "LDB <$16; ANDB #$01" (blinks), then 03B6A5
03B68E  func  burns_debris_blink
comment burns_debris_blink A piece's last bounces, blinking, gone after 64 frames.
param burns_debris_blink x debris
# states 0-2: 03B6A5 "LBSR $863B; BPL; NEG #$0F,X" (a wall: back), "LBSR $76CA" (lands: "NEGA; ASRA; STA #$19,X" half
# back up, the next state; at state 3 "LDA #$40; STA #$28,X")
03B6A5  func  burns_debris_bounce
comment burns_debris_bounce A piece bouncing: turned back by walls, half its height speed back up at each landing; after 3 it starts blinking.
param burns_debris_bounce x debris
# 03B6CA "SUBD #$0060; STD #$19,X; ADDD #$17,X ... ADCA #$16,X", "BMI" (at the floor: height 0, carry)
03B6CA  func  burns_part_fall
comment burns_part_fall Moves the object by its height speed with gravity: carry when it is at the floor (height 0).
param burns_part_fall x part
# 5280 type E7 (7DAD), state 0: 03B6FE "RTS" (Mr. Burns' 03B99C starts it)
03B6FE  func  rescued_maggie_wait
comment rescued_maggie_wait Waits until Mr. Burns is out.
# state 1: 03B6FF "LDU #$2A,X" (Mr. Burns), "ADDD #$0020; STD #$0C,X", "LDD #$0100; STD #$16,X", "LDD #$CC82; STD
# #$04,X"
03B6FF  func  rescued_maggie_drop
comment rescued_maggie_drop Appears beside Mr. Burns, high up (a piece of the robot, kind CC animation 82).
param rescued_maggie_drop x maggie
# state 2: 03B725 "LBSR $76CA; CMPD #$0010" (near the floor), "LDU #$2A,X; INC #$3A,U" (tells Mr. Burns), half back up,
# "LDD #$0300; STD #$0F,X; LDD #$FF80; STD #$14,X"
03B725  func  rescued_maggie_fall
comment rescued_maggie_fall Falls; near the floor tells Mr. Burns and bounces off right and back.
param rescued_maggie_fall x maggie
# states 3-6: 03B74F "LBSR $76CA; BCC", "NEGD; ASRA; RORB; STD #$19,X"
03B74F  func  rescued_maggie_bounce
comment rescued_maggie_bounce Bounces, half as high each time.
param rescued_maggie_bounce x maggie
# state 0B: 03B761 "LBSR $7806", then 03B764
03B761  func  rescued_maggie_sound_then_stop
comment rescued_maggie_sound_then_stop Its sound, then stops (03B764).
param rescued_maggie_sound_then_stop x maggie
# state 7: 03B764 "LDA #$29,X; BNE" (waits), "LDD #$4800; LBSR $8680", stops, "LDD #$1188; STD #$04,X" (kind 11 maggie),
# "LDA #$20; STA #$29,X"
03B764  func  rescued_maggie_stop
comment rescued_maggie_stop Stops as Maggie (kind 11, animation 88) with sound 48, for 32 frames.
param rescued_maggie_stop x maggie
# states 8, 0C: 03B78C "DEC #$29,X; LDA #$89; LDA #$20; STA #$29,X"
03B78C  func  rescued_maggie_pose
comment rescued_maggie_pose After 32 frames, animation 89 for 32 frames.
param rescued_maggie_pose x maggie
# states 9, 0D: 03B79F "DEC #$29,X; LDA #$87; LDA #$40; STA #$29,X"
03B79F  func  rescued_maggie_pose_2
comment rescued_maggie_pose_2 After 32 frames, animation 87 for 64 frames.
param rescued_maggie_pose_2 x maggie
# states 0A, 0E: 03B7B2 "BSR $7806", "DEC #$29,X", "LDA #$81", "LDD #$FF80; STD #$0F,X", "LDA #$40; STA #$09,X", "LDA
# #$28; STA #$29,X"
03B7B2  func  rescued_maggie_crawl
comment rescued_maggie_crawl With its sound every 16 frames; after its wait crawls left (animation 81) for 40 frames.
param rescued_maggie_crawl x maggie
# state 0F: 03B7D2 "BSR $7806", "LDU #$2A,X; LDD #$0C,X; SUBD #$0C,U; CMPD #$0060", "LDA #$86", stops, "LDA #$80; STA
# #$29,X"
03B7D2  func  rescued_maggie_crawl_to_burns
comment rescued_maggie_crawl_to_burns Crawls on until within 96 of Mr. Burns, then stops (animation 86) for 128 frames.
param rescued_maggie_crawl_to_burns x maggie
# state 10: 03B7F4 "BSR $7806; DEC #$29,X; INC <$04"
03B7F4  func  rescued_maggie_finish
comment rescued_maggie_finish After its 128 frames the step moves on (the game's end).
param rescued_maggie_finish x maggie
# 03B806 "LDA <$16; ANDA #$0F; LDD #$4500; LBSR $8680"
03B806  func  rescued_maggie_sound
comment rescued_maggie_sound Sound 45 every 16 frames.
# 4D40 type 26 (7DCF), state 0: 03B82F "LBSR $85B1; BCC" (07D16E: falls), "LDD #$5200; LBSR $8680", "LDA #$87", "LDA
# #$20;
# STA #$3B,X"
03B82F  func  burns_bomb_fall
comment burns_bomb_fall A lobbed bomb falls; landing, sound 52 and its fuse (animation 87, 32 frames).
param burns_bomb_fall x bomb
# state 1: 03B848 "ANDA #$20; BNE" (touched) / "DEC #$3B,X", "LDA #$01; STA <$97; CLR <$98" (a screen shake), "LDD
# #$4C00", "LDA #$06; STA <$7E; LDD #$0E20; LBSR $8677" (palette request 6), "LDA #$89", stops
03B848  func  burns_bomb_fuse
comment burns_bomb_fuse Burns its fuse; touched or out of time it blows up: the screen shakes, sound 4C, a flash, its blast (animation 89).
param burns_bomb_fuse x bomb
# state 2: 03B87C "ANDB #$02; LDA #$0E" (box 0E at the frames, burns_robot_hit_boxes), "ANDB #$01; CLR ,X"
03B87C  func  burns_bomb_blast
comment burns_bomb_blast The blast hits with box 0E at its frames; gone when it ends.
param burns_bomb_blast x bomb
# 4D40 type 26's state 3 and type 25's FF: 03B8A3 "ANDA #$01; CLR ,X"
03B8A3  func  burns_part_vanish
comment burns_part_vanish Gone when its animation ends (a shot's burst).
param burns_part_vanish x part
# 4D40 type 25 (7DD7), state 0: 03B8AD "DEC #$29,X", "ORA #$40" (can hit)
03B8AD  func  burns_shot_arm
comment burns_shot_arm A shot becomes harmful after its first 16 frames.
param burns_shot_arm x shot
# state 1: 03B8BC "ANDA #$20; BNE $78C3"
03B8BC  func  burns_shot_fly
comment burns_shot_fly A shot flies on until it touches something.
param burns_shot_fly x shot
# 03B8C3 "LBSR $74FE", "ANDA #$BF", "LDD #$9093; STD #$04,X" (kind 90 animation 93), "LDA #$FF; STA #$02,X"
03B8C3  func  burns_shot_burst
comment burns_shot_burst The shot bursts (kind 90, animation 93), stopped and harmless.
param burns_shot_burst x shot
# 5280 type E2 (7DDB), state 0: 03B923 "ORA #$40" (can be hit), "LDA #$0D; LBSR $72FF", "LDA #$C0; STA #$2B,X"
03B923  func  mr_burns_appear
comment mr_burns_appear Mr. Burns out of the robot: can be hit (box 0D), for 192 frames.
param mr_burns_appear x burns
# state 1: 03B937 "CLR $18FC; DEC #$2B,X", "ANDA #$20; LDA #$1E,X" (hit), "LDA #$5B,U; ANDA #$F0; STA $18FC" (who), "LDD
# #$6300", 03B95D "LDD #$9800; LBSR $8680", "LDD #$3F39", "LDA #$40; STA #$09,X; LDA #$81", "LDA #$20; STA #$2B,X"
03B937  func  mr_burns_wait_for_blow
comment mr_burns_wait_for_blow Waits for a player's blow (noting who in 18FC, sound 63) or the end of its 192 frames; then sound 98, his voice (3F39), turned left (animation 81).
param mr_burns_wait_for_blow x burns
# state 2: 03B97C "DEC #$2B,X", "STX $1852", "LDA #$01; STA <$7D; INC <$04"
03B97C  func  mr_burns_beaten
comment mr_burns_beaten After 32 frames: keeps him in 1852, a boss beaten (direct page 7D), and the step moves on.
param mr_burns_beaten x burns
# state 3: 03B99C "ANDA #$01", "LDU #$29,X; INC #$02,U" (Maggie's object starts)
03B99C  func  mr_burns_release_maggie
comment mr_burns_release_maggie When his animation ends, Maggie's object starts falling.
param mr_burns_release_maggie x burns
# state 4: 03B9AD "LDA #$3A,X; BEQ" (Maggie landed), "LDD #$3F2C", "LDD #$0C,X; STD $18F4; LDD #$11,X; STD $18F6; LDD
# <$AC;
# STD $18F8; LDD <$B2; STD $18FA", "LDA #$82", "LDA #$40; STA #$2B,X"
03B9AD  func  mr_burns_see_maggie
comment mr_burns_see_maggie When Maggie lands: his voice (3F2C), his place and the scroll kept in 18F4-18FA, animation 82.
param mr_burns_see_maggie x burns
# state 5: 03B9E2 "RTS"
03B9E2  func  mr_burns_done
comment mr_burns_done His last state: nothing.

# ---- their fields ----
# stage 8's first boss (stage_8_boss; its bomb's family extends it): 03A28B "LDA #$2E,X; ASLA; LDY #$7A00", 03A065 "STB
# #$2E,X ... STA #$2F,X"
scoped object stage_8_boss 2E phase u8
scoped object stage_8_boss 2F state_timer u8
# 03A2C8 "LDA #$02; STA #$2D,X", 03A283 "DEC #$2D,X", 03A376 "LDA #$2D,X; ASLA; LDY #$7A9C"
scoped object stage_8_boss 2D phases_left u8
# 03A3F9 "LDA #$56; STA #$32,X", 03A384 "DEC #$32,X"; 03A5A4 "INC #$32,X" (in a jump)
scoped object stage_8_boss 32 count_down u8
# 03A40A "INC #$33,X; CMPA #$03" (throws), 03A709 "INC #$33,X" (blows in phase 2), 03A52D "CMPA #$05" (phase 3's runs)
scoped object stage_8_boss 33 count u8
# 03A46B "LDA #$80; STA #$34,X", 03A4AA "DEC #$34,X", 03A510 "STA #$34,X"
scoped object stage_8_boss 34 steps_left u8
# 03A466 "STA #$36,X", 03A481 "LDA #$36,X; NEGA" (its run's x speed, whole pixels)
scoped object stage_8_boss 36 run_speed u8
# 03A271 "LEAY #$38,X; LBSR $695C" (stepped each frame), 03A3A4 "LDA #$38,X; BITA #$01"
scoped object stage_8_boss 38 random u16
# 03A4FD "STU #$3A,X", 03A534 "LDU #$3A,X"
scoped object stage_8_boss 3A marked_player u16 object
# 03A660 "INC #$3C,X; CMPA #$78"
scoped object stage_8_boss 3C laugh_frames u8
# 03A64F "LDA #$1B,X; STA #$3D,X", 03A63D "LDA #$3D,X; SUBA #$1B,X" (health at its last close attack)
scoped object stage_8_boss 3D health_mark u8
# 03A493 "INC #$3E,X; BITA #$06", 03A4DE "LDA #$3E,X; ANDA #$03"
scoped object stage_8_boss 3E steps u8
# the bomb's thrower (07CAAB "STX #$40,U": the child's parent), 03A823 "LDY #$40,X; LDA #$2E,Y"
scoped object stage_8_boss_bomb 40 thrower u16 object.stage_8_boss
# the boss's speech balloon: 03A7C7 "STA #$2F,X", 03A7CA "DEC #$2F,X"
scoped object boss_speech_balloon 2F frames_left u8
# Mr. Burns' robot: 03A9D6 "LDA #$28,X; ASLA; JMP [A,U]" (each handler's steps), 03A9DC "INC #$28,X"
scoped object burns_robot 28 step u8
# 03AEF6 "LDA #$29,X; BEQ; DEC #$29,X", 03AC10 "STA #$29,X"
scoped object burns_robot 29 wait_frames u8
# 03B29C "LDA #$40; STA #$2A,X", 03B297 "DEC #$2A,X"
scoped object burns_robot 2A target_frames u8
# 03B2A1 "STU #$2B,X", 03B243 "LDU #$2B,X"
scoped object burns_robot 2B target_player u16 object
# 03B2CB "STA #$2D,X", 03AED5 "LDB #$2D,X"
scoped object burns_robot 2D aim u8
# 03B2D1 "STA #$2E,X", 03B2D5 "LDA #$2E,X"
scoped object burns_robot 2E target_heading u8
# 03AAF3 "STA #$2F,X" (its form's health), 03B484 "LDA #$2F,X; SUBA #$1B,X; CMPA #$0C", 03B498 "STA #$2F,X"
scoped object burns_robot 2F health_mark u8
# 03AC9F "INC #$30,X", 03AAAD "INC #$34,X"; 03AAE5 "LDA #$30,X; ADDA #$34,X" (its form)
scoped object burns_robot 30 form_base u8
scoped object burns_robot 34 form_extra u8
# 03AE60 "STA #$31,X", 03B263 "LDA #$31,X; ... LBSR $8617"
scoped object burns_robot 31 walk_direction u8
# 03B446 "STA #$35,X" (which of its form's two attacks), 03AF14 "ADDA #$35,X"
scoped object burns_robot 35 attack_choice u8
# 03A9FD "STU #$38,X", 03AA0F "LDU #$38,X"
scoped object burns_robot 38 maggie u16 object
# 03A99E "LDD #$3B,X; ADDD #$0001; STD #$3B,X", 03B587 "CMPD #$3B,X", 03B4E2 "STD #$3B,X"
scoped object burns_robot 3B lob_frames u16
# 03B117 "INC #$3D,X", 03B0E2 "LDA #$3D,X; ASLA"
scoped object burns_robot 3D bombs_lobbed u8
# 03A9A7 "LDD #$3E,X; ADDD #$0001", 03B1E4 "CMPD #$0080"
scoped object burns_robot 3E volley_frames u16
# 03AFAE "INC #$40,X", 03B4B2 "CLR #$40,X"
scoped object burns_robot 40 shots_fired u8
# 03A9B0 "LDD #$41,X; ADDD #$0001", 03B23B "CMPD #$41,X", 03B4C5 "STD #$41,X"
scoped object burns_robot 41 part_frames u16
# 03B05F "STA #$43,X", 03B8DB "LDA #$43,U"
scoped object burns_robot 43 holding_part u8
# 03B04A "STU #$44,X", 03B066 "LDU #$44,X"
scoped object burns_robot 44 held_part u16 object
# 03AA08 "STD #$46,X", 03AA17 "DECW #$46,X"
scoped object burns_robot 46 walk_frames u16
# its objects: 03B047 "STX #$29,U" (the held part's robot), 03B8D8 "LDU #$29,X"
scoped object burns_held_part 29 robot u16 object.burns_robot
# 03B5CF "STU #$28,X", 03B5EC "LDU #$28,X"
scoped object burns_breakout 28 piece u16 object
# 03B668 "STA #$28,X", 03B66F "DEC #$28,X"
scoped object burns_tossed_part 28 flight_frames u8
# 03B6C6 "STA #$28,X", 03B68E "DEC #$28,X"
scoped object burns_debris 28 blink_frames u8
# 03B841 "STA #$3B,X", 03B84E "DEC #$3B,X"
scoped object burns_bomb 3B fuse u8
# 03AF66 "STA #$29,U", 03B8AD "DEC #$29,X"
scoped object burns_shot 29 arm_frames u8
# 03AA82 "STU #$2A,Y" (Maggie's Mr. Burns), 03B6FF "LDU #$2A,X"; 03B781 "STA #$29,X", 03B78C "DEC #$29,X"
scoped object rescued_maggie 2A burns u16 object.mr_burns
scoped object rescued_maggie 29 wait_frames u8
# 03AA85 "STY #$29,U" (Mr. Burns' Maggie), 03B99C "LDU #$29,X; INC #$02,U"; 03B92E "STA #$2B,X", 03B93B "DEC #$2B,X";
# 03B733 "INC #$3A,U", 03B9AD "LDA #$3A,X"
scoped object mr_burns 29 maggie u16 object.rescued_maggie
scoped object mr_burns 2B wait_frames u8
scoped object mr_burns 3A maggie_landed u8

# ======== symbols.txt's local lines on these banks' functions, under their new names ========
# (they replace "local sub_03624E 036261 ...", "local sub_0362AE ...", "local sub_03631D ...", "local sub_0388A2 ...",
# "local sub_03988B ...", the two "local sub_0392F0 ..." and "local sub_03B51E ...": a local line names its function)
local door_kind_12_start 036261 u opening door_opening
local door_kind_10_start 0362C1 u opening door_opening
local door_kind_0f_start 036330 u opening door_opening
local player_choose_attack 0388E5 x move player_move
local player_steer 039892 y speeds velocity
local player_take_touches 03970F y move team_move
local player_take_touches 03976F,039777 y facing second_object_facing
local burns_robot_place_part 03B533 y setup part

# the rank's step, up to 5 (040C9D "INC <$62"), back to 0 when a player dies (038FD6 "CLR <$62")
4862  var  rank_time_step  u8
# the frames toward the rank's next step (040C61 "INCW <$63"), and the frames the camera has not moved on (026249 "LDD
# <$E4; BEQ; BMI; CLRD; STD <$65", 02632A "INCW <$65"), compared with rank_frame_limits: both cleared when a player
# loses a life (03904E "CLRW <$65; CLRW <$63")
4863  var  rank_frames  u16

# ======== banks 1E-2F ========
# ======== names for banks 1E, 1F, 20 and 2F (proposals for symbols.txt) ========
# Places 03C000-041FFF and 05E000-05FFFF. Evidence: build/listing/simpsons.s (quoted as PLACE "INSTRUCTION"),
# src/unsorted/bank_1E.c, bank_1F.c, bank_20.c, bank_2F.c, symbols.txt's tables, assets/ (texts, sprite sets, music).
# Who is who (evidence used by many entries below):
# - list dispatchers (07F387/07F2EC list 0 at 4F80, 07F4B0/07F40D list 1 at 5280, 07F54C/07F4F4 list 2 at 4D40,
#   07F581/07F577 list 3 at 5640), the bank byte then the handler word by the object's type: bank 1E's 6000 is list 0
#   type 19, 6003 list 2 type 05, 6006 list 2 type 06, 6009 list 0 type 20, 600C list 2 type 01 / list 0 type 0B /
#   list 1 type 0E, 600F list 2 type 08, 6012 list 1 type 35, 6015 list 0 E8 / list 1 E9 / list 2 2A, 6018 list 0 type
#   3E, 601B list 0 type F9, 601E list 1 type 36; bank 1F's 6006 list 2 type 0F, 6015 list 3 type 03, 6018 list 2 type
#   0C, 6021 list 1 type 1E, 6024 list 2 type 07, 6030 list 2 type 14, 6033 list 2 type 15.
# - child objects (07862C "LBRA $CA8A": 8-byte records dx, dy, dz, list, field 30, type; 07862F "LBRA $CA9E": 6 bytes,
#   list 2, type at byte 5); both store the parent in the child's field 40 (07CAAB "STX #$40,U").
# - songs (assets/sound_data/music/music.txt): 8000 attract, 9600 area_clear, 9800 boss_defeated.
# - the bosses' state is field 2E with its wait in 2F (03C04C "STY #$2E,X", 03C059 "STB #$2E,X; ASLB; LDD B,Y; STA
#   #$2F,X; STB #$05,X"), their tables of state handlers by 2E (football 7D70, bear 7DEC, stage 3's 7EDC, F9's 7F62).

# ======== the decompiled program's files ========
# (replace the four 'unsorted/bank_1E/1F/20/2F' file lines; the same DIR/NAME may start again later, as
# unsorted/fixed_3C does)
03C000  file  bosses/football_player    # stage 4's boss (type 19, kind 92), its football and its charge's line
03C009  file  bosses/bear    # stage 5's boss (type 20, kind A2) and its cage's parts
03C00F  file  objects/hurry_up    # the HURRY UP that comes for idle players
03C012  file  bosses/bear    # the boulders the bear's stomps bring down
03C015  file  objects/scripted_object    # the object that runs a script of commands (types E8, E9, 2A)
03C018  file  bosses/stage_3_boss    # stage 3's two bosses (type 3E, kinds C4 and C3)
03C01B  file  objects/marge_cloud    # stage 6's objects of type F9 (kind B9)
03C01E  file  bosses/bear    # the effect of the bear's change
03C021  file  bosses/stage_bosses    # what the bosses of stages 3, 4 and 5 share: states, hit checks, the floor, targets
03C359  file  bosses/football_player    # the football player's states
03C8CD  file  bosses/bear    # the bear's states
03D033  file  objects/hurry_up    # the HURRY UP's states
03D1C0  file  bosses/stage_3_boss    # stage 3's bosses' states
03D702  file  objects/marge_cloud    # the F9 objects' states
03DC23  file  objects/scripted_object    # the scripted object's commands
03E000  file  scenes/story_scenes    # the stages' story scenes and events, the story actors' types
03E03F  file  players/second_sprite    # each player's second sprite (balloons, thrown things)
03E042  file  scenes/story_scenes    # (the story scenes)
03E05A  file  scenes/story_actor    # the story actor and its script's operations
03EAB3  file  players/second_sprite    # the second sprite's states
040003  file  players/gauges    # the top line: scores, lives, health gauges, credits, CONTINUE?, GAME OVER
040012  file  stages/rank    # the game's rank (direct page 61) and the HURRY UP's timer
04001E  file  attract/intro    # the attract's opening and the family's profiles
040946  file  players/gauges    # (the gauges' drawing)
040C61  file  stages/rank    # (the rank's terms)
05E000  file  system/eeprom    # the EEPROM's test and reset
05E009  file  test_mode/menu    # the test mode's page runner
05E00C  file  system/eeprom    # (the EEPROM's checksum, load and read entries)
05E015  file  scenes/game_start_portraits    # the game start's four portraits
05E042  file  test_mode/menu    # the main menu page
05E09B  file  test_mode/checks    # ROM, screen, colour and I/O checks
05E215  file  test_mode/sound_test    # the music and sound checks
05E2AA  file  test_mode/options    # start buttons and the coin/game options
05E506  file  test_mode/menu    # the menu's cursor, the settings in the EEPROM, the printer
05E8F1  file  system/eeprom    # the ER5911's serial protocol
05EAB0  file  test_mode/rom_check    # the ROM check page
05EDB4  file  scenes/game_start_portraits    # (the portraits)

# ======================================================================================================
# ======== bank 1E ========
# ======================================================================================================

# ---- shared by bank 1E's bosses (football player, bear, stage 3's bosses; stage 6's F9 objects use some) ----
# 03C021 "LDB <$50; LSRB; BCC; TST $4A42; BMI" over the four players' objects: a player in play whose field 02 (the class
# its state gives it, player_state_classes) is negative; callers taunt then (03C5EF animation 90, 03CD66 animation 8A,
# 03D51B animation 80)
03C021  func  stage_boss_any_player_down
comment stage_boss_any_player_down True when a player in play is in a state its class marks negative (down or hurt): the bosses taunt then
# 03C04C "STA #$05,X; CLRW #$0F,X; CLRW #$14,X; STY #$2E,X"
03C04C  func  stage_boss_set_state
comment stage_boss_set_state Stops the boss and gives it an animation, a state and that state's wait
# 03C066 "LDA #$00,X; ORA #$08": set when it is knocked into the air (03C0BC), cleared on landing (03C174); the
# object mover keeps its sprites' heights apart while it is set (0799BB "ANDA #$08")
03C066  func  stage_boss_set_airborne
comment stage_boss_set_airborne Marks the boss as in the air (bit 3 of its flags)
03C06F  func  stage_boss_clear_airborne
comment stage_boss_clear_airborne Clears the in-the-air mark of the boss's flags as it lands
# 03C078 "STU #$19,X" (up speed), x speed Y away from the one that hit it (field 25) or from the screen's edges
# (00E0, 0078, 0138), 03C0BC "LBSR $6066"
03C078  func  stage_boss_knock_away
comment stage_boss_knock_away Throws the boss up and away from its attacker or the screen's edge, and marks it in the air
# 03C0E0 "LDA #$09,U; LDB #$18; BITA #$40; BEQ; NEGB"
03C0E0  func  stage_boss_offset_ahead_of
comment stage_boss_offset_ahead_of 18 pixels in front of the object in U, by the way it faces
# 03C0EB: next x (0C + 0F) kept between 0070 and 0140 (03C0FC, 03C108), then the floor (6114)
03C0EB  func  stage_boss_move_on_screen
comment stage_boss_move_on_screen Stops the boss at the screen's sides and keeps it on the floor
# 03C114 "LBSR $863B" (the floor under it), 8644, 8647 (ahead), its priority bits into 09, its floor height into 5C
03C114  func  stage_boss_follow_floor
comment stage_boss_follow_floor Stops the boss where there is no floor, takes the floor's priority and height, and falls to it
# 03C153 "CLRW #$0F,X; LDD #$5C,X" then 6159
03C153  func  stage_boss_stop_on_floor
comment stage_boss_stop_on_floor Stops the boss's x speed and settles it on its floor height
# 03C159 "CMPD #$16,X", gravity "SUBD #$0060" (19), landing: "STD #$16,X", "CLRW #$19,X", 03C174 "LBSR $606F"
03C159  func  stage_boss_settle
comment stage_boss_settle Pulls the boss down to its floor; on landing stops it and clears its in-the-air mark
# 03C179 "LDA #$C0; STA #$00,X"
03C179  func  stage_boss_activate
comment stage_boss_activate Sets the object active and shown (flags C0)
# 03C17F "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40" then 61A1 up to four times
03C17F  func  stage_boss_pick_random_player
comment stage_boss_pick_random_player A player's object in U, from a random slot on to the first one in use
# 03C1A1 "LEAU #$00C0,U; CMPU #$4D40; BNE; LDU #$4A40; TST #$00,U"
03C1A1  func  stage_boss_next_player_slot
comment stage_boss_next_player_slot The next player's slot after U, wrapping from Lisa's to Marge's, and whether it is in use
# 03C1B1 "LBSR $8671" (the direction to U), "CMPA <$F0", B added or taken from <$F0
03C1B1  func  stage_boss_turn_toward
comment stage_boss_turn_toward Turns the direction in the scratch byte by B toward the object in U
# 03C1C7 "LDU #$25,X; LDA #$5B,U; ANDA #$F0; STA #$27,X": field 27's high bits the player who scores it (07BA5D-07BA78
# give the score to player (27 & 30) >> 4)
03C1C7  func  stage_boss_note_beater
comment stage_boss_note_beater Notes in field 27 which player's attack beat the boss, for the score
# 03C1D3 "LDA #$27,X; ORA #$81; STA #$27,X": bit 7 makes 07BA5D award it, the low nibble the amount
03C1D3  func  stage_boss_award_score
comment stage_boss_award_score Asks the score routine to award the beater one score step
# 03C1DC: the four players in play (<$50 bits) through 61FE, distance in x under <$F8 and in y under <$FA
03C1DC  func  stage_boss_find_near_player
comment stage_boss_find_near_player The first player in play within the ranges in the scratch words, in U, carry set if one is
03C1FE  func  stage_boss_player_is_near
comment stage_boss_player_is_near Whether the player in U is in play and within the ranges in the scratch words
# 03C225 four times 6240: "TST #$00,U; BEQ; LDU #$16,U; BEQ; COMA"
03C225  func  stage_boss_any_player_off_floor
comment stage_boss_any_player_off_floor True when a player's object is in the air (its height not 0)
03C240  func  stage_boss_player_off_floor
comment stage_boss_player_off_floor Whether the player in U is in use and off the floor
# 03C24E "ORA #$04" / 03C257 "ANDA #$FB" on field 00: bit 2 is can not be hurt (07C26D)
03C24E  func  stage_boss_shield
comment stage_boss_shield Makes the boss unhurtable (bit 2 of its flags)
03C257  func  stage_boss_unshield
comment stage_boss_unshield Makes the boss hurtable again
# 03C260: hit (flags 20) with a strength 11 or more (1E): 03C28C "LDB <$57", "CMPA B,Y" (its health against the table
# by players), sound 6600; returns 0, 1 (hurt) or FF (beaten: health cleared, 61C7)
03C260  func  stage_boss_check_hit
comment stage_boss_check_hit Whether the boss was hit this frame: 0 no, 1 hurt, FF beaten (its health at or below its limit for the players)
# 03C2B5 "EORA #$80; ORA #$04" (blinks), "DEC #$2F,X", at 0 "CLR #$00,X; LBSR $61D3; COMA"
03C2B5  func  stage_boss_blink_out
comment stage_boss_blink_out Blinks the beaten boss for its wait, then removes it and awards its score (carry set when gone)
# 03C2CE "LDA #$06,X; BITA #$02" (the animation's attack frame): "STY #$1C,X" (damage and strength) and 6257, else 0;
# "LSRA" hands back bit 0 (the animation over)
03C2CE  func  stage_boss_attack_frame
comment stage_boss_attack_frame Gives the boss its attack's damage on the animation's attack frames, and says whether the animation ended
# 03C2E5 "LDD ,Y++; STD #$1F,X; LDD ,Y; STD #$21,X; STA #$24,X"
03C2E5  func  stage_boss_set_hit_box
comment stage_boss_set_hit_box Copies a hit box record into the boss's fields 1F-24
# 03C313 "LBSR $8620" (the nearest player), faces it (09 bit 6)
03C313  func  stage_boss_face_nearest_player
comment stage_boss_face_nearest_player Turns the boss toward the nearest player (in U)
# 03C329 "LDB <$61; LSRB; LDB B,Y; LBRA $8617"
03C329  func  stage_boss_walk_by_rank
comment stage_boss_walk_by_rank Sets the boss's speeds in direction A at the speed the table in Y gives for the rank
# 03C340 "LDA <$57; LDA A,Y; LBRA $86BF" (07E496: the boss gauge, the health a piece stands for)
03C340  func  stage_boss_set_gauge
comment stage_boss_set_gauge Shows the boss's health gauge B, a piece standing for the table's health by the players in play

# ---- the football player (stage 4's boss: list 0 type 19, kind 92) ----
# its state (2E) and wait (2F), as stage_boss_set_state writes them; 32 the direction it runs (03C428 "STA #$32,X"), 33 its
# turn (03C49E), 34 its target (03C41F "STU #$34,X"), 36 its speed (03C42D, 03C534), 37 frames facing the wrong way
# (03C505), 3C the runs before it rests (03C40A "DEC #$3C,X"), 3E the hurt pose still to show (03C5A5), 3F the frames
# to its charge (03C40F, 03C462), 41 the frames to its throw (03C5BF), 45/46 its health at the last flinch / attack
# (03C7C3, 03C62C)
scoped object football_player 2E phase u8
scoped object football_player 2F wait u8
scoped object football_player 32 direction u8
scoped object football_player 33 turn s8
scoped object football_player 34 chase_target u16 object
scoped object football_player 36 speed u8
scoped object football_player 37 wrong_way u8
scoped object football_player 3C runs_to_rest u8
scoped object football_player 3E hurt_pose u8
scoped object football_player 3F charge_wait u8
scoped object football_player 41 throw_wait u8
scoped object football_player 45 flinch_health u8
scoped object football_player 46 attack_health u8
# 03C000 "LBRA $6348": 03C34A "LDY #$7DBD; LBSR $6340" (gauge 2), "LDY #$7D70; JMP [A,Y]" by 2E
03C000  func  football_player
comment football_player Runs the football player, stage 4's boss: shows its gauge and runs its state
# list 2 type 05, put in by its throw (03C6B8 "LDY #$7DC2; LBSR $862F", record type 05): 03C81A "LDD #$9288" (kind 92
# animation 88), hit box 7DCE, damage 080A, 15 frames ("LDA #$15; STA #$3F,X", "DEC #$3F,X"); named outside the
# football_player family on purpose: its field 3F is its life, not the player's charge wait
03C003  func  football_thrown
comment football_thrown The football it throws: a hit box with damage for 15 frames
# list 2 type 06 (football_player_line_pieces): each puts the next (03C8B3 "LDY #$7DE6; LBSR $862F") up to 8, $184A
# counting them; the 1st, 4th and 7th hurt (03C849-03C857); 13 frames each (03C88F "LDA #$13; STA #$3F,X"); outside the
# football_player family for the same reason
03C006  func  football_line_piece
comment football_line_piece One of the 8 pieces of the line its charge puts in, each from the one before; the 1st, 4th and 7th hurt
# state 0 (03C359): kind 92, health A0, animation 82, state 1, a marker object kept in 1852 (03C397 "LDY #$7D9A")
03C359  func  football_player_start
comment football_player_start Sets the football player up: kind, health, its first state, and the marker the story uses
# state 1 (03C3A2 "LDA $184A; BEQ")
03C3A2  func  football_player_wait_cue
comment football_player_wait_cue Waits for the story to set the cue in 184A, then drops to the floor
# state 5 (03C3C1): "STA <$7C", 3F by rank, animation 83 state 6
03C3C1  func  football_player_appear
comment football_player_appear After its wait, marks the boss entering and starts its entrance animation
# state 6 (03C3DF): on the animation's end "CLR <$7C", animation 80, state 2, hit box 7DA2, flags C0
03C3DF  func  football_player_ready
comment football_player_ready At its entrance's end takes its stance, hit box and flags and looks for a player to tackle
# states 2 and 19 (03C404): "DEC #$2F,X", "DEC #$3C,X" (rest), "DEC #$3F,X" (charge), else 6414
03C404  func  football_player_stand
comment football_player_stand Waits, then rests, charges or runs at the nearest player
# 03C414: animation 81 state 3, the nearest player its target, direction, speed 10
03C414  func  football_player_start_run
comment football_player_start_run Runs at the nearest player
# 03C433 "LDA #$1E; STA $003C" (extended: the K052109's RAM, where field 3C was meant), animation 85 state 8
03C433  func  football_player_start_rest
comment football_player_start_rest Starts a rest (animation 85); its count of 1E goes to 003C instead of its own field 3C
# state 3 (03C444): "DEC #$3F,X" then 6449, else 647B turning toward its target by 7 or 1C; at random state 4
03C444  func  football_player_run_at_target
comment football_player_run_at_target Runs turning toward its target until its charge is due, now and then wandering
# 03C449: unhurtable with three or more players, 3F again, animation 89 state 0B
03C449  func  football_player_start_charge
comment football_player_start_charge Winds up its charge (unhurtable with three or more players)
# state 4 (03C4C1): its turn's sign flips at random (03C4DA), state 3 again after its wait
03C4C1  func  football_player_wander
comment football_player_wander Runs turning at random for its wait, then at its target again
# 03C4F4: facing, its speed by its health and rank (football_player_speed_ranges_by_rank), the screen's limits,
# the hurt pose under 60 health (03C59E), the throw (03C5BF), the taunt (03C5EF), the tackle check (03C615)
03C4F4  func  football_player_run
comment football_player_run Moves it on its run, bounces off the screen's sides and decides to pose, throw, taunt or tackle
# state 20 (03C654): animation 84 state 7, hit box 1C1C, unhurtable, faces the nearest player
03C654  func  football_player_start_tackle
comment football_player_start_tackle After its wait, tackles: attack animation, hit box, unhurtable
# state 7 (03C677 "LDY #$0C0A; LBSR $62CE")
03C677  func  football_player_tackle
comment football_player_tackle Its tackle's damage on the attack frames, back to standing when done
# state 8 (03C69B): on the animation's end 6414
03C69B  func  football_player_rest
comment football_player_rest Rests until its animation ends, then runs again
# state 9 (03C6AB): animation 87, "LDY #$7DC2; LBSR $862F" (the football), sound 6D00
03C6AB  func  football_player_throw
comment football_player_throw After its wait, throws a football
# 03C6C7 "LDA <$57; CMPA #$02; LBLE; LBSR $624E"
03C6C7  func  football_player_shield_if_crowded
comment football_player_shield_if_crowded Makes it unhurtable when three or four play
# state 10 (03C6D5): damage 040A on attack frames, standing at the animation's end
03C6D5  func  football_player_throwing
comment football_player_throwing Its throw's animation, hurting on the attack frames
# state 11 (03C6F9): animation 8A state 0C
03C6F9  func  football_player_charge_windup
comment football_player_charge_windup Waits out the charge's wind-up, then charges
# state 12 (03C718): on the attack frame "LDY #$7DC8; LBSR $862F" (the line), "CLR $184A", sound 6200
03C718  func  football_player_charge
comment football_player_charge Charges, leaving its line of pictures behind
# state 13 (03C740, from 03C5B4 under 60 health): animation 82 state 0E
03C740  func  football_player_hurt_pose
comment football_player_hurt_pose The pose it strikes once when its health falls under 60
# state 14 (03C753): "DEC #$2F,X; LBEQ $63CB"
03C753  func  football_player_hurt_pose_wait
comment football_player_hurt_pose_wait Waits after the pose, then takes its stance again
# state 15 (03C75C): flinch over, state 2
03C75C  func  football_player_flinch
comment football_player_flinch Flinches until its animation ends
# state 16 (03C76A "LBSR $60EB; BCC")
03C76A  func  football_player_knocked_back
comment football_player_knocked_back Knocked back; stands up when it lands
# state 17 (03C772): landed and waited, state 12 (18) wait 78, sound 3F3A
03C772  func  football_player_knocked_out
comment football_player_knocked_out Beaten and thrown; after landing goes to its last state with a cry
# state 18 (03C789 "LBSR $62B5"): "LDD #$9600; LBSR $8689", "STA <$7D", "INC <$04"
03C789  func  football_player_defeated
comment football_player_defeated Blinks out; then plays area_clear, marks the boss beaten and moves the stage on
# 03C7AC "LDY #$7DB9; LBSR $6260": flinch (animation 8D) or knock back (8E); beaten: sound 9800, animation 8F
03C7AC  func  football_player_check_hit
comment football_player_check_hit Its hits: a flinch, a knock back, or beaten (boss_defeated) and thrown

# ---- the bear (stage 5's boss: list 0 type 20, kind A2) and its cage's parts ----
# 2E state, 2F wait; 34 its target (03CA70 "STU #$34,X"), 36 set once it charged (03CD70), 3A frames since its last
# charge (03CDE2 "INC #$3A,X", 03CD9F "CMPA #$3A,X"), 3F its bounces (03CCBF), 46/47 health at the last flinch / attack
scoped object bear 2E phase u8
scoped object bear 2F wait u8
scoped object bear 34 chase_target u16 object
scoped object bear 36 charged u8
scoped object bear 3A charge_timer u8
scoped object bear 3F bounces u8
scoped object bear 46 flinch_health u8
scoped object bear 47 attack_health u8
# a part: its number (03C968 "STA #$2D,U"), its phase (03CE89 "STA #$2E,X"), its height at rest (03C957 "STD #$54,U")
scoped object bear_part 2D number u8
scoped object bear_part 2E phase u8
scoped object bear_part 54 rest_height u16
# a boulder: set once landed (03CFAB "INC #$2E,X")
scoped object bear_boulder 2E landed u8
# 03C009 "LBRA $68BC": 03C8BE "LDY #$7E6B; LBSR $6340" (gauge 3), "LDY #$7DEC; JMP [A,Y]"
03C009  func  bear
comment bear Runs the bear, stage 5's boss: shows its gauge and runs its state
# list 2 type 01, list 0 type 0B, list 1 type 0E (child records 7E14, 7E1C, 7E24), kind 10 animation 91: with $184A 1 it
# shakes (03CE70), 2 or more it flies off by bear_part_flights (03CE89-03CEA7) and falls bouncing
03C00C  func  bear_part
comment bear_part A part of the bear's cage: shakes while the bear stirs, flies off as it breaks out
# list 1 type 35 (child records 7E54/7E5C from the bear's stomps 03CAE1 and 03CC69), kind AF (boulder) animation 83,
# a random x, from above the camera (03CF0D "LDD #$00F0; ADDD <$B2"), bounce sound 6500
03C012  func  bear_boulder
comment bear_boulder A boulder the bear's stomp brings down: falls, bounces and hurts while the bear stands
# list 1 type 36 (child record 7E94, from 03CD13): kind 90 animation 91, sound 6C00, gone at its animation's end
03C01E  func  bear_change_effect
comment bear_change_effect The effect shown as the beaten bear changes
# state 0 (03C8CD): kind A2, health E0, attributes 40, the 11 parts (6925 with 7E1C, 7E24, 7E14)
03C8CD  func  bear_start
comment bear_start Sets the bear up and puts in the parts of its cage
# 03C925 "LBSR $862C", place by object_1e_part_offsets (<$F8), number in 2D, at most 11
03C925  func  bear_put_parts
comment bear_put_parts Puts in up to 11 cage parts from a child record, each at its offset
# state 1 (03C976 "TST <$92; BEQ"): sound FD00, animation 8A state 2
03C976  func  bear_wait_entrance
comment bear_wait_entrance Waits for the stage to let it in, then stirs
# state 2 (03C990): "LDA #$01; STA $184A", state 3 wait FA
03C990  func  bear_stir
comment bear_stir Shakes its cage, then starts breaking out
# state 3 (03C9A4): <$7C at DC, at 4B a cleared area of the tiles (03C9E0 "BSET", through "ANDB $00C0", extended) and
# sound 7000, "STB $184A" (2: the parts fly)
03C9A4  func  bear_break_out
comment bear_break_out Breaks out of its cage: the parts shake, then fly; its tiles are cleared
# state 4 (03CA2B): "CLR <$7C", sound 3F37 at 26, hit box 7E50, sound 7400, animation 89 state 5
03CA2B  func  bear_step_out
comment bear_step_out Steps out with a roar and takes its hit box
# state 5 (03CA55)
03CA55  func  bear_roar
comment bear_roar Waits out its roar, then turns to a player
# 03CA5B "LDY #$0610"
03CA5B  func  bear_turn_to_player
comment bear_turn_to_player Takes state 6 facing the nearest player
# 03CA5E: hit box 7E50, animation 89, "LBSR $8620; STU #$34,X; LBSR $6257"
03CA5E  func  bear_face_player
comment bear_face_player Takes the state in Y facing the nearest player, hurtable
# state 6 (03CA79): a random player in use or the nearest, animation 80 state 7
03CA79  func  bear_choose_target
comment bear_choose_target Picks its target, at random or the nearest player, and walks
# state 7 (03CAA8): on its stomp "STA <$97" (screen shake), sound 7500, boulders by rank (03CACD "LDY #$7E54"); a
# player within 30 x 08: sound 6A00 and an attack (bear_attack_delays_by_players)
03CAA8  func  bear_walk
comment bear_walk Walks at its target, shaking the screen and dropping boulders, and swipes at a player in reach
# state 9 (03CB96, set by bear_think with animation 8B): at the animation's end animation 8C, state 0A, x speed
# bear_charge_speeds_by_rank, hit box 7E90
03CB96  func  bear_start_charge
comment bear_start_charge After its wind-up, charges across the screen
# 03CBCA "LDY #$7E67; LBSR $6260"
03CBCA  func  bear_charge_check_hit
comment bear_charge_check_hit Its hits while charging: flashes, or beaten
# state 10 (03CBEA): damage 0809 while moving, animation 88 state 10 (hex) when stopped
03CBEA  func  bear_charge
comment bear_charge Hurts while it charges; stops into a pose, then gets up
# state 16 (03CC0A): unhurtable, state 6 at its animation's end
03CC0A  func  bear_get_up
comment bear_get_up Gets up unhurtable, then turns to a player
# state 17 (03CC1B): animation 81 state 8, unhurtable
03CC1B  func  bear_attack_wait
comment bear_attack_wait Waits before its swipe, then swipes
# state 8 (03CC2C "LDY #$080A; LBSR $62CE")
03CC2C  func  bear_swipe
comment bear_swipe Its swipe's damage on the attack frames
# states 11 and 18 (03CC38): state 6 wait 1 at the animation's end
03CC38  func  bear_recover
comment bear_recover Moves until its animation ends, then turns to a player
# state 12 (03CC47): landing shakes the screen and drops boulders by rank, bounces at random
03CC47  func  bear_knocked_down
comment bear_knocked_down Knocked down: lands shaking the screen, maybe bringing boulders down
# 03CCBA: "INC #$3F,X", over 3: animation 84 state 0F; else animation 88 state 12 (hex) at the animation's end; health
# 0: animation 86 state 0D, zoom 4040
03CCBA  func  bear_land
comment bear_land Its landing after a knock-down: recovers (a longer animation every fourth time), or, beaten, starts its change
# state 15 (03CCE5)
03CCE5  func  bear_long_get_up
comment bear_long_get_up Every fourth knock-down's longer animation, then it recovers
# state 13 (03CD05 "DEC $002F", extended): at 11 the effect (7E94), from 28 its zoom grows a step a frame, then kind 81
# (the fat_goon set) animation BB, state 0E
03CD05  func  bear_change
comment bear_change Beaten, swells and changes into kind 81 (the fat goon's set)
# state 14 (03CD3A): state 13 (hex) wait 5A
03CD3A  func  bear_changed
comment bear_changed Waits as its new self, then blinks out
# state 19 (03CD47): "LDD #$9600; LBSR $8689", "STA <$7D", "INC <$04"
03CD47  func  bear_defeated
comment bear_defeated Blinks out; then plays area_clear, marks the boss beaten and moves the stage on
# 03CD84 "LBSR $60EB; CLR #$36,X"
03CD84  func  bear_move
comment bear_move Moves it on the screen, then decides whether to charge
# 03CD8A: every 96 - 16 x players frames (3A): sound 7400, faces away from the near side, animation 8B state 9
03CD8A  func  bear_think
comment bear_think Charges now and then (more often with more players), unless a lone player is down
# 03CDD8 "LDY #$7E67; LBSR $6260": animation 82/83 state 0B, palette flash 0027
03CDD8  func  bear_check_hit
comment bear_check_hit Its hits: flinches with a flash, is knocked down or beaten
# 03CE21 "LDD #$0000; LBSR $8680; LDD #$9800; LBSR $8689"
03CE21  func  bear_beaten
comment bear_beaten Stops the sounds, plays boss_defeated and knocks it away
# 03CE2D animation 85 state 0C, shake, "LDU #$0500; LDY #$0380; LBRA $6078"
03CE2D  func  bear_knocked_away
comment bear_knocked_away Knocked away, shaking the screen

# ---- the HURRY UP (list 2 type 08, kind AE hurry_up) ----
# its step (03CFE3 "CLRW #$2D,X", 03D02A "LDA #$2D,X; ASLA; LDY #$7ECC"), its time (03D059 "DECW #$2E,X"), players
# tried (03D07B "INC #$28,X"), the scroll it saw (03D024 "STD #$29,X"), its player (03D01E "STD #$2B,X"), the player's
# y and height (03D130 "STD #$32,X", 03D13F "STD #$34,X")
scoped object hurry_up 2D step u8
scoped object hurry_up 2E time u16
scoped object hurry_up 28 tries u8
scoped object hurry_up 29 scroll_x u16
scoped object hurry_up 2B player u16 object
scoped object hurry_up 32 player_y u16
scoped object hurry_up 34 player_height u16
# put in by hurry_up_timer (040D21 "LBSR $867D", "LDA #$08; STA #$01,U"); 03CFEB "LDD #$AE80"
03C00F  func  hurry_up
comment hurry_up Runs the HURRY UP: set up on its first frame, then by its step
# steps 0-2 (03D033): x 0148, y speed against the camera's, sound 1F00, its next animation after its time
03D033  func  hurry_up_enter
comment hurry_up_enter Comes in with its sound, keeping pace with the camera
# steps 3-4 (03D073): the next player's slot in use, at most 5 tries (then 7188)
03D073  func  hurry_up_next_player
comment hurry_up_next_player Picks the next player in use to go to; leaves after 5
# step 5 (03D0A0): flies at the player (8671, speed 80); over it: animation 84, its hit box 1406
03D0A0  func  hurry_up_go_to_player
comment hurry_up_go_to_player Flies to its player and hits it on reaching it
# step 6 (03D155)
03D155  func  hurry_up_hit
comment hurry_up_hit Waits for its hit's animation to end
# 03D15D: flags 80, step 4, its y and height back
03D15D  func  hurry_up_after_hit
comment hurry_up_after_hit After its hit, goes back to its place and on to the next player
# 03D180 "LDD <$AC; CMPD #$29,X": the scroll moved, "LDD #$0480; STD #$04,X", step 7
03D180  func  hurry_up_check_scroll
comment hurry_up_check_scroll Vanishes in a puff when the camera moves on
# step 7 (03D198): "CLR #$00,X; CLR <$8F" at the animation's end
03D198  func  hurry_up_vanish
comment hurry_up_vanish Gone at its puff's end, letting the timer start again

# ---- the scripted object (list 0 type E8, list 1 E9, list 2 2A: scripted_object_scripts by field 30) ----
# its script's place (03DB80 "STY #$32,X"), its wait (03DC2D "STA #$34,X"), accelerations (03DC71-03DC7B), the floor
# it waits to land on (03DC96 "STA #$3C,X", FF none), its zoom's growing (03DCBB "STA #$3D,X") and step (03DCC3), the
# x it waits for (03DCE0 "STD #$42,X")
scoped object scripted_object 32 script u16
scoped object scripted_object 34 wait u8
scoped object scripted_object 36 acceleration_x s16
scoped object scripted_object 38 acceleration_y s16
scoped object scripted_object 3A acceleration_z s16
scoped object scripted_object 3C landing_floor s8
scoped object scripted_object 3D zoom_flags u8
scoped object scripted_object 3E zoom_step s8
scoped object scripted_object 42 wait_x u16
# 03C015 "LBRA $7B61": off screen (x over 01A0 or under 0020) removed; its script started (03DB7B "LDY #$78B5"); its
# accelerations, zoom and floor each frame; 03DC1B "LDA ,Y+; ASLA; LDU #$7FAA; JMP [A,U]"
03C015  func  scripted_object
comment scripted_object Runs a scripted object: moves it, then runs its script's commands until one waits
# command 00 (03DC23 "STA #$09,X")
03DC23  func  scripted_object_set_attributes
comment scripted_object_set_attributes Command 00: its sprite attributes (field 09)
# 01 (03DC2B "STA #$34,X; STY #$32,X; RTS")
03DC2B  func  scripted_object_wait
comment scripted_object_wait Command 01: waits that many frames
# 02 (03DC34 "CLR #$00,X")
03DC34  func  scripted_object_end
comment scripted_object_end Command 02: removes the object
# 03 (03DC38 "STD #$04,X")
03DC38  func  scripted_object_set_kind
comment scripted_object_set_kind Command 03: its kind and animation
# 04 (03DC40 "STA #$05,X")
03DC40  func  scripted_object_set_animation
comment scripted_object_set_animation Command 04: its animation
# 05 (03DC48: x, y plus the camera's, height)
03DC48  func  scripted_object_set_place
comment scripted_object_set_place Command 05: its place, y from the camera's
# 06 (03DC5D: 0F, 14, 19)
03DC5D  func  scripted_object_set_speeds
comment scripted_object_set_speeds Command 06: its three speeds
# 07 (03DC6F: 36, 38, 3A)
03DC6F  func  scripted_object_set_accelerations
comment scripted_object_set_accelerations Command 07: what is added to its speeds each frame
# 08 (03DC81 "EORA #$08" on field 00)
03DC81  func  scripted_object_toggle_airborne
comment scripted_object_toggle_airborne Command 08: flips the in-the-air bit of its flags
# 09 (03DC8C "STA #$5B,X": the low nibble picks its shadow sprite, 079DFE)
03DC8C  func  scripted_object_set_shadow
comment scripted_object_set_shadow Command 09: its field 5B (the shadow it shows)
# 0A (03DC94 "STA #$3C,X; STY #$32,X; RTS")
03DC94  func  scripted_object_wait_landing
comment scripted_object_wait_landing Command 0A: waits until it falls to that floor height
# 0B (03DC9D "LBSR $8680" unless field 30 is negative)
03DC9D  func  scripted_object_play_sound
comment scripted_object_play_sound Command 0B: queues a sound command, unless its field 30 is negative
# 0C (03DCAE: 0A, 0B, "EORA #$10" on 3D)
03DCAE  func  scripted_object_set_zoom
comment scripted_object_set_zoom Command 0C: its zoom, and starts or stops it growing
# 0D (03DCC1 "STA #$3E,X")
03DCC1  func  scripted_object_set_zoom_step
comment scripted_object_set_zoom_step Command 0D: what its zoom grows by each frame
# 0E (03DCC9: speeds and accelerations cleared)
03DCC9  func  scripted_object_stop
comment scripted_object_stop Command 0E: stops it
# 0F (03DCDE "STD #$42,X; STY #$32,X; RTS"; 03DBD9 "CMPD #$0C,X")
03DCDE  func  scripted_object_wait_x
comment scripted_object_wait_x Command 0F: waits until its x reaches that place

# ---- stage 3's bosses (list 0 type 3E: the first kind C4 field 30 = 0, it puts in the second, kind C3, field 30 = 1) ----
# 2E state, 2F wait; 30 which one (03D1D4 "TST #$30,X"), 32 its direction (03D2B8), 34 its target (03D2B2), 36 its walk's
# frames (03D2FE "DEC #$36,X"), 3A frames since they parted (03D592 "INC #$3A,X"), 40 frames before it may join its
# partner again (03D59E "LDA #$10; STA #$40,X", 03D53A "DEC #$40,X"; in the second it first holds its parent, as every
# child's 40), 41 the partner (03D1CB "STU #$41,X; STX #$41,U"), 43 set while one carries the other (03D6A0)
scoped object stage_3_boss 2E phase u8
scoped object stage_3_boss 2F wait u8
scoped object stage_3_boss 30 second u8
scoped object stage_3_boss 32 direction u8
scoped object stage_3_boss 34 chase_target u16 object
scoped object stage_3_boss 36 walk_time u8
scoped object stage_3_boss 3A apart_time u8
scoped object stage_3_boss 40 join_wait u8
scoped object stage_3_boss 43 together u8
# 03C018 "LBRA $71B3": "CLRW #$1C,X; LDA #$2E,X; ASLA; LDY #$7EDC; JMP [A,Y]"
03C018  func  stage_3_boss
comment stage_3_boss Runs one of stage 3's two bosses by its state
# state 0 (03D1C0): the first puts in the second (03D1C5 "LDY #$7F08; LBSR $862C"), kind C4 / C3 and health 80 / C0
03D1C0  func  stage_3_boss_start
comment stage_3_boss_start Sets a boss up; the first puts in the second and links them
# state 1 (03D1F0 "TST <$92"): "STA <$7C", place 01A0/00E8, animation 81, "STA #$2A,Y" on 1852's object, sound 6000
03D1F0  func  stage_3_boss_enter
comment stage_3_boss_enter When the stage lets it, comes in from the right and tells the story's object
# state 2 (03D240): at 14 clears 1852's 2A, sound 6000; animation 89 state 3; the first: sound 3F35, child 7F10
03D240  func  stage_3_boss_arrive
comment stage_3_boss_arrive Arrives, with its cry, and waits
# state 3 (03D275)
03D275  func  stage_3_boss_wait
comment stage_3_boss_wait Waits, then walks
# 03D27B "LDY #$0D00; LDA #$87"
03D27B  func  stage_3_boss_start_together
comment stage_3_boss_start_together Takes the carrying state (13) and picks a target
# 03D285: animation 81 state 4
03D285  func  stage_3_boss_start_walk
comment stage_3_boss_start_walk Starts walking and picks a target
# 03D295 "LDY #$7F16; LBSR $76C9", flags C0, the first the nearest player (8620), the second a random one (617F)
03D295  func  stage_3_boss_pick_target
comment stage_3_boss_pick_target Its hit box, then its target: the nearest player for the first, a random one for the second
# state 13 (03D2BE): the first carries the second (03D2D4 "BMOVE": its place copied), attacks a near player at random
03D2BE  func  stage_3_boss_together
comment stage_3_boss_together Walks carrying its partner, and attacks a player in reach at random
# state 4 (03D2FE): 36 runs out: animation 83 state 15 (hex), else near its target an attack at random
03D2FE  func  stage_3_boss_walk
comment stage_3_boss_walk Walks at its target, stopping after a while, and attacks it in reach
# 03D333 "LDY #$7F22; LBSR $76C9", faces, stage_3_boss_slow_attack_chances_by_players: state 6 wait 0E or 1
03D333  func  stage_3_boss_attack_or_wait
comment stage_3_boss_attack_or_wait Faces its target and attacks now or after a pause
# 03D380: facing, 61B1 by 5 toward its target, 76DC its speed, x speed doubled
03D380  func  stage_3_boss_move
comment stage_3_boss_move Turns toward its target and moves on
# state 6 (03D3DE): unhurtable; carrying: animation 88 state 0E; else by the target's class: animation 83 state 7, or the
# second leaps (animation 82 state 5, "LDU #$0580; LDY #$0400; LBSR $6078")
03D3DE  func  stage_3_boss_attack
comment stage_3_boss_attack Picks its attack: a strike, a leap (the second, at a player down) or the carried one's
# state 21 (03D440 "LDY #$0011")
03D440  func  stage_3_boss_push
comment stage_3_boss_push A strike that pushes without damage
# state 8 (03D445 "LDY #$0401")
03D445  func  stage_3_boss_follow_up
comment stage_3_boss_follow_up Its follow-up strike (damage 4)
# states 7 and 14 (03D44A "LDY #$0801")
03D44A  func  stage_3_boss_strike
comment stage_3_boss_strike Its strike (damage 8)
# 03D44D "LBSR $62CE", then stage_3_boss_follow_up_chances_by_players: hit box 7F32 animation 84 state 8
03D44D  func  stage_3_boss_strike_frames
comment stage_3_boss_strike_frames A strike's damage on its attack frames, then walking or a follow-up
# state 16 (03D488)
03D488  func  stage_3_boss_pause
comment stage_3_boss_pause Waits, then walks (or carries)
# state 5 (03D497 "LBSR $60EB; LBCS $7285")
03D497  func  stage_3_boss_leap
comment stage_3_boss_leap In the air on its leap; walks on landing
# state 17 (03D49E)
03D49E  func  stage_3_boss_flinch
comment stage_3_boss_flinch Flinches until its animation ends
# state 18 (03D4A7): landed, beaten: animation 86 state 13 (hex); boss_defeated when its partner is beaten too
03D4A7  func  stage_3_boss_knocked
comment stage_3_boss_knocked Knocked away; walks on landing, or lies beaten
# state 19 (03D4DA): state 14 (hex) wait 3C
03D4DA  func  stage_3_boss_down
comment stage_3_boss_down Lies beaten, then blinks out
# state 20 (03D4E7 "LBSR $62B5"): with its partner gone, sound 6000, 1852's 2A, "STA <$7D", "INC <$04"
03D4E7  func  stage_3_boss_defeated
comment stage_3_boss_defeated Blinks out; the last of the two marks the bosses beaten and moves the stage on
# 03D51B "LBSR $6021": animation 80 (alone) or 8B (carrying) state 10 (hex) wait 28
03D51B  func  stage_3_boss_taunt
comment stage_3_boss_taunt Taunts when a player is down
# 03D537: the floor (6114), the join (03D54A "LBSR $76AF" and both on the floor: animation 81 for both), its hits
# ("LDY #$7F3D; LBSR $6260"): flinch, knocked, or carried and separated
03D537  func  stage_3_boss_update
comment stage_3_boss_update Each frame: its floor, joining its partner again, and its hits
# state 10 (03D60F)
03D60F  func  stage_3_boss_follow_partner
comment stage_3_boss_follow_partner Walks to its partner
# state 9 (03D612): within 0A of the partner: animation 80 state 0B, the partner jumps (z speed 0700, state 0C)
03D612  func  stage_3_boss_reach_partner
comment stage_3_boss_reach_partner Walks to its partner; reaching it, the partner jumps onto it
# 03D63F "LDU #$41,X; LBSR $861D; LBSR $76DC"
03D63F  func  stage_3_boss_head_to_partner
comment stage_3_boss_head_to_partner Turns and moves toward its partner
# state 12 (03D679 "LBRA $60EB")
03D679  func  stage_3_boss_jump_on
comment stage_3_boss_jump_on In the air jumping onto its partner
# state 11 (03D67C): the partner state 0D animation 87, both 43 set, hit box 7F2E
03D67C  func  stage_3_boss_join
comment stage_3_boss_join After its wait the two are one: the partner carried, a shared hit box
# 03D6AF "CMPA #$3E" (type), alive, state under 13 (hex)
03D6AF  func  stage_3_boss_partner_ready
comment stage_3_boss_partner_ready Whether its partner is still a boss standing (carry set)
# 03D6C9 "LEAY #$04,Y" for the first, again while carrying
03D6C9  func  stage_3_boss_set_hit_box
comment stage_3_boss_set_hit_box Its hit box from the record in Y, the next ones for the first and the carrying one
# 03D6DC "LDY #$7F52" / "LDY #$7F42; LBRA $6329"
03D6DC  func  stage_3_boss_walk_speed
comment stage_3_boss_walk_speed Its speed by the rank, one table for each of the two

# ---- stage 6's F9 objects (list 0 type F9, kind B9; stage 6's spawn list puts in eight) ----
# 2E state, 2F wait; 32 its actions (03D7C4 "INC #$32,X", 03D855 "CMPA #$03"), 33 the x it wanders to (03D723 "STD
# #$33,X": the camera plus 60 plus its x)
scoped object marge_cloud 2E phase u8
scoped object marge_cloud 2F wait u8
scoped object marge_cloud 32 actions u8
scoped object marge_cloud 33 wander_x u16
# 03C01B "LBRA $76ED": removed under x 0040, else "LDY #$7F62; JMP [A,Y]" (bank_1e_states)
03C01B  func  marge_cloud
comment marge_cloud Runs an F9 object by its state, removing it off the screen's left
# 03D702 "LDY #$7F7C; LBRA $6059" (marge_cloud_state_starts)
03D702  func  marge_cloud_set_state
comment marge_cloud_set_state Its state B with that state's wait and animation
# state 0 (03D708): kind B9, health 08
03D708  func  marge_cloud_start
comment marge_cloud_start Sets it up: kind, health, where it wanders to
# state 1 (03D72C): a player within 30 x 10: "LDA #$80; STA #$00,X", state 2
03D72C  func  marge_cloud_wait_for_player
comment marge_cloud_wait_for_player Waits hidden for a player to come near, then shows itself
# states 2 and 14 (03D748): random moves, not past its x (33), sound 0E00 and state 3 after its wait
03D748  func  marge_cloud_wander
comment marge_cloud_wander Moves about, then with a sound starts its appearance
# state 3 (03D781): flags 40, state 4, hit box 7F9A
03D781  func  marge_cloud_appear
comment marge_cloud_appear At its animation's end takes its hit box
# state 9 (03D79B): on its turn of the frame count, state 0A, sound 2A01
03D79B  func  marge_cloud_idle
comment marge_cloud_idle Waits for its turn (by its x and the frame count), then acts with a sound
# state 10 (03D7CA)
03D7CA  func  marge_cloud_act
comment marge_cloud_act Its action's animation, then it looks for a player
# states 4 and 5 (03D7D3)
03D7D3  func  marge_cloud_wait
comment marge_cloud_wait Waits, then looks for a player
# 03D7D9 "LDB #$06"
03D7D9  func  marge_cloud_start_look
comment marge_cloud_start_look Takes the looking state
# state 6 (03D7E9): a player within 40 x 10: state 7 (sometimes at once); else after its wait state 9
03D7E9  func  marge_cloud_look
comment marge_cloud_look Looks for a player in reach to attack, else idles
# 03D800 "LDB #$09"
03D800  func  marge_cloud_start_idle
comment marge_cloud_start_idle Takes the idle state
# state 7 (03D81C): sound 1C00, unhurtable, state 8, hit box 7F9E, faces the nearest player
03D81C  func  marge_cloud_windup
comment marge_cloud_windup Winds up its attack at the nearest player
# state 8 (03D83F "LDY #$0401; LBSR $62CE")
03D83F  func  marge_cloud_attack
comment marge_cloud_attack Its attack's damage on the attack frames
# 03D850 "LBSR $6021", more than 3 actions: sound 1900, state 0B
03D850  func  marge_cloud_check_leave
comment marge_cloud_check_leave Idles when a player is down; leaves after 3 actions
# 03D86A "LDY #$7FA1; LBSR $6260": state 0C, or sound 1000 and state 0D
03D86A  func  marge_cloud_check_hit
comment marge_cloud_check_hit Its hits: a flinch, or beaten
# state 12 (03D884)
03D884  func  marge_cloud_flinch
comment marge_cloud_flinch Flinches, then looks for a player
# state 13 (03D88C "CLR #$00,X; LBSR $61D3")
03D88C  func  marge_cloud_vanish
comment marge_cloud_vanish Beaten: gone at its animation's end, its score awarded
# state 11 (03D899): a random player, toward it at speed 60, flags 04, state 0E
03D899  func  marge_cloud_leave
comment marge_cloud_leave Leaves toward a random player, unhurtable

# ======================================================================================================
# ======== bank 1F ========
# ======================================================================================================

# ---- the stories' entries (bank 1F's jump table; callers by step: E6D9 by <$03, each step's substep table) ----
# 03E000 "LBRA $680F": 5640 script 10, "STX $1852"; from 07A5FB, stage 1's (step 2's) last substep (E707)
03E000  func  story_stage_1_end
comment story_stage_1_end Runs stage 1's closing story on the actor at 5640
# 03E003 "LBRA $681F": scene 1's routine (scene_routines): 5640 script 14
03E003  func  stage_2_events
comment stage_2_events Stage 2's events while it plays: the actor at 5640 on its script
# list 2 type 0F, "LBRA $6855": its kind from its parent's, 40 higher
03E006  func  story_follower
comment story_follower A story actor that takes its parent's kind and starts 40 higher than its own place
# 03E009 "LBRA $6872": script 2C; from 07A851, stage 2's (step 4's) substep 6
03E009  func  story_stage_2_end
comment story_stage_2_end Runs stage 2's closing story on the actor at 5640
# 03E012 "LBRA $687D": scene 3's routine: script 1C
03E012  func  stage_3_forest_events
comment stage_3_forest_events Stage 3's forest events: the actor at 5640 on its script
# list 3 type 03, "LBRA $6888": "STX $1852", script 20
03E015  func  stage_event_actor
comment stage_event_actor The stage's event object at 5640 as a story actor on its script
# list 2 type 0C, "LBRA $6895": "STX $1854"
03E018  func  story_noted_actor
comment story_noted_actor A story actor noted in 1854 for the stories
# 03E01B "LBRA $69BB": scene 5's routine: script 30
03E01B  func  stage_4_events
comment stage_4_events Stage 4's events: the actor at 5640 on its script
# 03E01E "LBRA $6937": 5640, "STX $1854", script 0C, "STY #$45,X" (1852's object); from 07AC27, step 8's substep 7
03E01E  func  story_stage_4_end
comment story_stage_4_end Runs stage 4's closing story on the actor at 5640
# list 1 type 1E, "LBRA $694D" (an RTS); the football player puts one in (child record 7D9A) and keeps it in 1852
03E021  func  story_marker
comment story_marker Does nothing: an object the stories keep in 1852 to refer to
# list 2 type 07, "LBRA $6899" (runs the actor)
03E024  func  story_extra_actor
comment story_extra_actor A story actor of list 2 (type 07)
# 03E027 "LBRA $694E": scene 6's routine: "LDY #$4AA0; STY $1852"
03E027  func  stage_5_events
comment stage_5_events Stage 5's events: the actor at 5640, with Marge's partner object noted in 1852
# 03E02A "LBRA $6804": scene 0's routine: script 38
03E02A  func  stage_1_events
comment stage_1_events Stage 1's events: the actor at 5640 on its script
# list 2 types 14 and 15, "LBRA $695B"
03E030  func  story_extra_actor_2
comment story_extra_actor_2 A story actor of list 2 (type 14)
03E033  func  story_extra_actor_3
comment story_extra_actor_3 A story actor of list 2 (type 15)
# 03E036 "LBRA $695E": "STX $1854", script 24; from 07AD5B, step 9's substep 7
03E036  func  story_stage_5_end
comment story_stage_5_end Runs stage 5's closing story on the actor at 5640
# 03E039 "LBRA $69BB": scene 9's routine (the same as scene 5's)
03E039  func  stage_7_events
comment stage_7_events Stage 7's events: the actor at 5640 on stage 4's script
# 03E03C "LBRA $7BCB": "STX $1852", script 34; from 07B14C, step 13's substep 7
03E03C  func  story_stage_7_end
comment story_stage_7_end Runs stage 7's closing story on the actor at 5640
# 03E03F "LBRA $6A46": 03EAB3 for the four players, and at the end (184D 2 or more) the players in state 2C taken on
03E03F  func  players_update_second_sprites
comment players_update_second_sprites Runs each player's second sprite; in the last story moves the players in state 2C on
# 03E042 "LBRA $696D": scene 8's routine: script 4C
03E042  func  stage_6_events
comment stage_6_events Stage 6's events: the actor at 5640 on its script
# 03E048 "LBRA $689C": scene 4's routine: script 54
03E048  func  stage_3_cemetery_events
comment stage_3_cemetery_events Stage 3's cemetery events: the actor at 5640 on its script
# 03E04B "LBRA $68D9": script 58; from 07AB09, step 7's substep 6
03E04B  func  story_stage_3_end
comment story_stage_3_end Runs stage 3's closing story on the actor at 5640
# 03E04E "LBRA $69C6": scene 0B's routine: script 5C, the object noted in 1854 told (1852's 2A)
03E04E  func  stage_8_events
comment stage_8_events Stage 8's events: the actor at 5640 on its script
# 03E051 "LBRA $69E4": script 60, the players' second sprites placed by 1852's object; from 07B3A1, step 15's substep 12
# (after Mr. Burns' robot)
03E051  func  story_stage_8_end
comment story_stage_8_end Runs the story after Mr. Burns' robot, the players' second sprites lined up by the object in 1852
# 03E054 "LBRA $7DC7": script 64, the players placed; from 07B333, step 15's substep 7 (after the first boss), which then
# sets <$81 for the robot (03AD6B)
03E054  func  story_burns_robot_entrance
comment story_burns_robot_entrance Runs the story before Mr. Burns' robot, each player's second sprite put at its character's place on the screen
# 03E057 "LBRA $6D31": "LDA <$67; ASLA x3; LDY #$7EDC; LEAY A,Y; LDX #$1840; LDU #$0008; BMOVE"; each step's start
03E057  func  scene_load_story_settings
comment scene_load_story_settings Copies the scene's 8 bytes of settings to 1840-1847 and clears the stories' flags

# ---- the story actor (story_scripts by field 30; its script's operations by 03E27B "LDU #$7000; JMP [A,U]") ----
# 2D its wait (03E3B2 "STA #$2D,X", 03E267 "DEC #$2D,X"), 2E its script's place (03E0A2), 30 the script's number
# (03E09B), 31/33/35 what it adds to its speeds (03E157-03E16F), 37 the object it walks to (03E2ED "STD #$37,X"), 39 how
# far before it (03E2F2), 3A its speed (03E2F5), 3B the height it waits for (03E50E), 3C the camera x it waits for
# (03E52A), 3E the x it waits for (03E553), 42 its script's flags (bit 0 do not turn, 1 repeat sound 4A00, 2 halted,
# 4 wait shortened by presses: 03E141, 03E175, 03E189, 03E1E5)
scoped object story_actor 2D wait u8
scoped object story_actor 2E script u16
scoped object story_actor 30 script_number u8
scoped object story_actor 31 acceleration_x s16
scoped object story_actor 33 acceleration_y s16
scoped object story_actor 35 acceleration_z s16
scoped object story_actor 37 script_target u16 object
scoped object story_actor 39 target_margin u8
scoped object story_actor 3A walk_speed u8
scoped object story_actor 3B landing_height u8
scoped object story_actor 3C camera_wait u16
scoped object story_actor 3E x_wait u16
scoped object story_actor 42 script_flags u8
# 03E05A: a new actor (flags 04, or 5640 free) cleared and given story_scripts[30]; then its walk to its target, its
# waits (2A, 29, 3C, 42 bit 4, 3B, 3E, 0A, 2D), then its operations (03E273)
03E05A  func  story_actor_run
comment story_actor_run Runs a story actor: starts its script, walks it, and when its wait is over runs its operations
# 03E1CB "CLRD; LDU #$002F; BSET A,X,U" (from 03E1B2 "LDX #$4A68" ...: the players' fields 28-56)
03E1CB  func  story_clear_player
comment story_clear_player Clears a player's fields from 28 on, as a story hands the players back
# 03E273 "LDA ,Y+; CMPA #$FF; LBEQ $6711; ASLA; LDU #$7000; JMP [A,U]"
03E273  func  story_actor_next_operation
comment story_actor_next_operation Runs its script's next operation; FF ends it
# operation 00 (03E280 "STD #$04,X")
03E280  func  story_actor_set_kind
comment story_actor_set_kind Operation 00: its kind and animation
# 01 (03E288 "STA #$05,X")
03E288  func  story_actor_set_animation
comment story_actor_set_animation Operation 01: its animation
# 02 (03E290: 0C, 11, 16)
03E290  func  story_actor_set_place
comment story_actor_set_place Operation 02: its place
# 03 (03E2AA: 0F, 14, 19)
03E2AA  func  story_actor_set_speeds
comment story_actor_set_speeds Operation 03: its speeds
# 04 (03E2BC: 31, 33, 35)
03E2BC  func  story_actor_set_accelerations
comment story_actor_set_accelerations Operation 04: what it adds to its speeds each frame
# 1A (03E2CE "ORA #$01" on 42, then 62E9)
03E2CE  func  story_actor_walk_to_without_turning
comment story_actor_walk_to_without_turning Operation 1A: walks to an object without turning to face its way
# 0F (03E2D8: X + 60, then 62ED)
03E2D8  func  story_actor_walk_to_partner
comment story_actor_walk_to_partner Operation 0F: walks to its partner object (60 after it)
# 05 (03E2E1 "ANDA #$FE" on 42, then 62E9)
03E2E1  func  story_actor_walk_to
comment story_actor_walk_to Operation 05: walks to an object, facing its way
# 03E2E9 "LDU ,Y++; LDD ,U"
03E2E9  func  story_actor_walk_to_object_in
comment story_actor_walk_to_object_in Takes as its target the object a variable named in the script holds
# 03E2ED "STD #$37,X; LDD ,Y++; STA #$39,X; STB #$3A,X"
03E2ED  func  story_actor_set_target
comment story_actor_set_target Its target, how far before it to stop, and its speed
# 06 (03E2FB): byte 5 of the record 04 the players present, 05 the players' partners, else 03E37D "LBSR $862C" kept
# in its children (43-58)
03E2FB  func  story_actor_put_in
comment story_actor_put_in Operation 06: puts in the players, their partners, or a child actor it keeps
# 07 (03E3B0 "STA #$2D,X; STY #$2E,X")
03E3B0  func  story_actor_wait
comment story_actor_wait Operation 07: waits that many frames
# 08 (03E3BB: 31, 33)
03E3BB  func  story_actor_set_accelerations_xy
comment story_actor_set_accelerations_xy Operation 08: what it adds to its x and y speeds
# 09 (03E3C8 "LDA <$58; ANDA #$0C; LDU #$704C"): the players at steps from a place, in a random order
03E3C8  func  story_actor_line_up_players
comment story_actor_line_up_players Operation 09: lines the four players up in a random order
# 0A (03E40B "ORA #$40", 1F, 21)
03E40B  func  story_actor_set_hit_box
comment story_actor_set_hit_box Operation 0A: a hit box
# 20 (03E420: "LDA #$C0; MUL; ADDD #$4A40", "TST ,X", "LBSR $8680")
03E420  func  story_actor_play_sound_if_player
comment story_actor_play_sound_if_player Operation 20: a sound, if that player's object is in use
# 1E (03E441 "LDB #$04,X; ADDD ,Y++; LBSR $8680")
03E441  func  story_actor_play_kind_sound
comment story_actor_play_kind_sound Operation 1E: a sound command plus its kind (a character's voice)
# 0B (03E44D)
03E44D  func  story_actor_play_sound
comment story_actor_play_sound Operation 0B: a sound command
# 0C (03E455 "ORA #$04" on 42)
03E455  func  story_actor_halt
comment story_actor_halt Operation 0C: stops its script for good
# 0D (03E463 "STA #$09,X", 06 bit 7)
03E463  func  story_actor_set_attributes
comment story_actor_set_attributes Operation 0D: its sprite attributes, its animation restarted
# 0E (03E473 "EORA #$08" on 00)
03E473  func  story_actor_toggle_airborne
comment story_actor_toggle_airborne Operation 0E: flips the in-the-air bit of its flags
# 10 (03E47E "STD #$2A,X"; 03E193 "LDA #$2D,Y; CMPA #$01")
03E47E  func  story_actor_wait_for_object
comment story_actor_wait_for_object Operation 10: waits until the object a variable holds has its own wait (field 2D) down to 1
# 11 (03E48B "STA #$29,X; STA $184B"; 03E1A6 "TST $184E")
03E48B  func  story_actor_wait_for_players
comment story_actor_wait_for_players Operation 11: asks for the players and waits for them, then clears their fields
# 12 (03E4A1 "LBSR $67BA", "STA #$05,X", faces [U])
03E4A1  func  story_actor_random_player_faces
comment story_actor_random_player_faces Operation 12: a random player present takes an animation facing an object
# 13 (03E4C6)
03E4C6  func  story_actor_set_players_animation
comment story_actor_set_players_animation Operation 13: the players not in one animation take another
# 14 (03E4EA)
03E4EA  func  story_actor_face_object
comment story_actor_face_object Operation 14: faces the object a variable holds
# 15 (03E50B "STA #$3B,X; STA $184B")
03E50B  func  story_actor_wait_for_height
comment story_actor_wait_for_height Operation 15: waits until it is down to a height
# 16 (03E51B "LBSR $862C")
03E51B  func  story_actor_put_in_child
comment story_actor_put_in_child Operation 16: puts in a child actor it does not keep
# 17 (03E528 "STD #$3C,X"; 03E1D6 "CMPD <$AC")
03E528  func  story_actor_wait_for_camera
comment story_actor_wait_for_camera Operation 17: waits for the camera to reach an x
# 18 (03E533 "LDU ,Y++; LDA ,Y+; STA ,U")
03E533  func  story_actor_set_variable
comment story_actor_set_variable Operation 18: writes a byte to a variable
# 1B (03E550 "INCD; STD #$3E,X"; 03E23D "SUBD <$AC; CMPD #$0C,X")
03E550  func  story_actor_wait_for_x
comment story_actor_wait_for_x Operation 1B: waits until it reaches an x on the screen
# 1C (03E55C "LDU #$705C"), "STA $4A40" ... with the record's last byte
03E55C  func  story_actor_place_players
comment story_actor_place_players Operation 1C: puts the four players at steps from a place, and maybe shows them
# 1D (03E59F "LDU #$70F8; LDU A,U", "LDB <$50")
03E59F  func  story_actor_start_absent_players
comment story_actor_start_absent_players Operation 1D: the players not playing take one of four scripts at random
# 1F (03E5C6 "STA #$0B,X; STA #$0A,X"; 03E257 "LBSR $863B; ANDA #$0F; CMPA #$0B,X")
03E5C6  func  story_actor_wait_for_floor
comment story_actor_wait_for_floor Operation 1F: waits until the floor under it is a given one
# 21 (03E5D6 "LBSR $67BA", sounds 3F08-3F0B and 3F14-3F17, partner state 33 or 13)
03E5D6  func  story_actor_player_speaks
comment story_actor_player_speaks Operation 21: a random player present speaks the line, its balloon over it
# 22 (03E63E "EORA #$02" on 42; 03E180 "LDD #$4A00")
03E63E  func  story_actor_toggle_repeat_sound
comment story_actor_toggle_repeat_sound Operation 22: starts or stops sound 4A00 every 16 frames
# 24 (03E654 "ORA #$10" on 42, "STD #$1C,X"; 03E1E9 the player's presses at 4842 + 4 x its kind)
03E654  func  story_actor_wait_or_presses
comment story_actor_wait_or_presses Operation 24: waits, its player's presses shortening the wait
# 25 (03E667)
03E667  func  story_actor_stop
comment story_actor_stop Operation 25: stops it (speeds and accelerations cleared)
# 03E67C "LBRA $6273"
03E67C  func  story_actor_continue
comment story_actor_continue Goes on to the next operation
# 03E67F: its children (43-58) run (605A), the players too while 184E is set (5640's), then the screen's limits
03E67F  func  story_actor_finish_frame
comment story_actor_finish_frame Runs its children (and the players during a story), and removes it off the screen
# 03E711: unlinked from its parent's children; for 5640 (03E733) the story's end: "CLR <$72", 184B 184E 1852-1859, the
# players freed
03E711  func  story_actor_remove
comment story_actor_remove Removes the actor; the one at 5640 ends the story and hands the players back
# 03E7A3 recursive "CLR #$00,U; BSR $67A3"
03E7A3  func  story_actor_remove_children
comment story_actor_remove_children Removes an actor's children and theirs
# 03E7BA "LDA <$85", "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40"
03E7BA  func  story_random_player
comment story_random_player A random player present (in X), or the first present after it
# 03E7F3 "LDA #$04; STA <$F0; LDX #$4A40"
03E7F3  func  story_first_player
comment story_first_player Marge's object in X and a count of four
# 03E7FC "LEAX #$00C0,X; DEC <$F0"
03E7FC  func  story_next_player
comment story_next_player The next player's object, counting down

# ---- a player's second sprite (its partner object at +60; its state field 90 = the partner's 30; 03EAB3 "LDX #$7E5B")
# 03EAB3 "TST #$60,U; LBEQ $6D16", "LDA #$0090,U; ASLA; LDX #$7E5B; JMP [A,X]"
03EAB3  func  player_second_sprite_run
comment player_second_sprite_run Runs the second sprite of the player in U by its state
# 03EAC3: 6C = 0C, 71 = 11 - 40, 76 = 16 + 80
03EAC3  func  player_second_sprite_follow
comment player_second_sprite_follow Puts the second sprite over the player's head
# 03EADC: 6F 74 79 from 0F 14 19
03EADC  func  player_second_sprite_match_speeds
comment player_second_sprite_match_speeds Gives the second sprite the player's speeds
# state 12 (03EAEF "LDY #$7E77", player_overhead_heights)
03EAEF  func  player_second_sprite_overhead
comment player_second_sprite_overhead Holds the second sprite above the player at its character's height
# state 8 (03EB18 "LDY #$0A00") and 10 (03EB25 "LDY #$0300")
03EB18  func  player_second_sprite_throw_fast
comment player_second_sprite_throw_fast Throws the second sprite fast (x speed 0A00)
03EB25  func  player_second_sprite_throw_slow
comment player_second_sprite_throw_slow Throws the second sprite slowly (x speed 0300)
# 03EB30: facing, player_throw_heights, its hit box
03EB30  func  player_second_sprite_throw
comment player_second_sprite_throw Starts the thrown thing from the player's side at its character's height
# state 7 (03EB8A "BITA #$20")
03EB8A  func  player_second_sprite_fly
comment player_second_sprite_fly The thrown thing flies until it hits something
# 03EB91: state 6, "LDY #$0EBF; STY #$64,U"
03EB91  func  player_second_sprite_land
comment player_second_sprite_land The thrown thing lands (kind 0E animation BF) and waits for its animation
# state 9 (03EBBB): off the screen (0044, 017C) or below its floor (8644)
03EBBB  func  player_second_sprite_fall
comment player_second_sprite_fall The thrown thing falls until it leaves the screen or reaches the floor
# state 6 (03EBE5 "LDA #$66,U; BITA #$01")
03EBE5  func  player_second_sprite_wait_animation
comment player_second_sprite_wait_animation Off when its animation ends
# state 5 (03EBF0): state 4, 9D = 1
03EBF0  func  player_second_sprite_start_prompt
comment player_second_sprite_start_prompt Starts the two-picture prompt over the player
# state 4 (03EC08): "LDD #$B181" at 1E, "LDD #$B180" at 0 (3C again): speech_balloons_2's first two pictures (Hit
# Buttons!, Wiggle Joystick!)
03EC08  func  player_second_sprite_prompt
comment player_second_sprite_prompt Alternates the balloon's first two pictures over the player every 30 frames
# state 3 (03EC36): 9E counted down, hidden and shown every 40 frames
03EC36  func  player_second_sprite_blink
comment player_second_sprite_blink Follows the player blinking until its time runs out
# state 2 (03EC60 "TST $185A", player_balloon_animations, pair_balloon_players, "LDA #$B1; STD #$64,U", A1 = 50)
03EC60  func  player_second_sprite_start_balloon
comment player_second_sprite_start_balloon Shows a speech balloon over the player (or over the pair's speaker)
# state 1 (03ECAA "DEC #$00A1,U")
03ECAA  func  player_second_sprite_balloon
comment player_second_sprite_balloon Keeps the balloon over its speaker until its time runs out
# state 13 (03ED0B "CLR #$60,U; STA #$0090,U")
03ED0B  func  player_second_sprite_off
comment player_second_sprite_off Turns the second sprite off
# 03ED16 "ANDA #$30; STA #$00BB,U", "STA #$52,U", "LDX #$7E94; LDA A,X; STA #$02,U"
03ED16  func  player_update_class
comment player_update_class Each frame: the player's class by its state (player_state_classes) into its field 02

# ======================================================================================================
# ======== bank 20 ========
# ======================================================================================================

# ---- the top line ----
# 040003 "LBRA $6901": "LDA <$6A; BEQ", 6946 and 6953 for the four, "LDA <$3B; BNE" then 7745 at 2766 and the credits
040003  func  gauges_draw
comment gauges_draw Draws the top line while it is on: each player's score and quarter, and the credits unless free play
# 040006 "LBRA $6B16": 76A3 ("CONTINUE?") at 2213, then 6B44
040006  func  continue_draw
comment continue_draw Draws CONTINUE? and the continue's countdown
# 040009 "LBRA $6B26": 76A3 blank (A = 80), 6B73, then on into 6B37
040009  func  continue_end
comment continue_end Erases CONTINUE? and its countdown, then draws GAME OVER
# 04000C "LBRA $6B37": 76F4 ("GAME OVER") at 2394
04000C  func  game_over_draw
comment game_over_draw Draws GAME OVER
# 04000F "LBRA $68E2": "LDY #$02,X; LDA #$03,Y; BEQ; DECA" for the four
04000F  func  gauges_count_delays
comment gauges_count_delays Counts down each player's health gauge's step delay
# 040946 "LDD [#$12,X]; LDX #$14,X; LBSR $86A7"
040946  func  gauge_print_score
comment gauge_print_score Prints a player's score in its quarter
# 040953 by "LDA [#$16,X]" (status): 2 lives, health gauge and picture 0; 3 the continue's count; 4 picture 4; 1 and 5
# picture 5; else 3
040953  func  gauge_draw_player
comment gauge_draw_player Draws a player's quarter by its status: playing, continue count, game over or waiting
# 0409CF "LDU #$777A; LDA #$08", "BITB #$01; ADDA ,U; DAA"
0409CF  func  gauges_byte_to_bcd
comment gauges_byte_to_bcd B in BCD in A (carry set past 99)
# 0409F2 "LDA #$1F; LDB [#$0C,X]; MUL; LDB #$28; DIV X,B" toward the shown step, gauge_step_tiles
0409F2  func  gauge_draw_health
comment gauge_draw_health Moves the health gauge one step toward the player's health and draws its four tiles
# 040AA8 "LDY #$774E" (big_digits), "LDY #$730E" (the player's colour)
040AA8  func  gauge_print_count
comment gauge_print_count Prints a BCD count in two big two-row digits in the player's colour (a 0 first is blank)
# 040B0C "ADDB #$06; LBRA $6BCE"
040B0C  func  gauge_draw_player_picture
comment gauge_draw_player_picture Draws the player's own picture (6 on) in its quarter
# 040B44 "LDA $4A1C", "LDX #$73F1" at 2418 and 2420
040B44  func  continue_draw_count
comment continue_draw_count Draws the continue's countdown in big digits (a 0 first is blank)
# 040B73 "LDU #$7405; LDA #$80" at 2418 and 2420
040B73  func  continue_erase_count
comment continue_erase_count Blanks the continue's countdown
# 040B88 "LDD ,U++" (width, height), "LDA ,U+" (colour), "BMI" (A bit 7: blank tiles 10)
040B88  func  gauges_put_picture
comment gauges_put_picture Draws a picture of tiles at X (blank with A bit 7 set)
param gauges_put_picture u picture
param gauges_put_picture x tiles
# 040BCE "LDX #$730E" (gauge_player_columns), "LDX #$7316" (gauge_pictures), blocks up to a non-zero byte
040BCE  func  gauge_draw_picture
comment gauge_draw_picture Draws picture B in player A's quarter, in its colour (blank with A bit 7 set)

# ---- the rank ----
# 040012 "LBRA $6C40": "CLR <$61" then the terms, at most 1F
040012  func  rank_update
comment rank_update Works out the game's rank (at most 1F) from its terms, each frame of play
# 040C61 "INCW <$63"
040C61  func  rank_count_frame
comment rank_count_frame Counts the frames toward the rank's next time step
# 040C65 rank_base by <$14 (1 in the attract)
040C65  func  rank_add_base
comment rank_add_base Adds the difficulty's base (the attract's is 1)
# 040C7D rank_by_players
040C7D  func  rank_add_players
comment rank_add_players Adds the term for the players in the game
# 040C8D rank_step_times, "INC <$62" up to 5, "CLRW <$63"
040C8D  func  rank_add_time_step
comment rank_add_time_step Raises the time step (up to 5) each time the scene's time passes, and adds it
# 040CB7 rank_by_scene
040CB7  func  rank_add_scene
comment rank_add_scene Adds the scene's term
# 040CC6 rank_frame_limits, "BCS $6CD6" to the RTS
040CC6  func  rank_check_frame_limit
comment rank_check_frame_limit Compares a count with the scene's limit; the result is not used
# 040CD7 "LDD <$93; ADDD #$0001", reset by <$8F, 1883, <$92 clear, <$A7, <$A8, <$DE; at 0100 "LDB #$02; LBSR $867D",
# "STU <$90", "STA <$8F", "LDA #$08; STA #$01,U"
040CD7  func  hurry_up_timer
comment hurry_up_timer Counts idle frames; after 256 puts in the HURRY UP
# 040D36 "LDA <$57; DECA; ANDA #$03", "ADDA <$14" or 1, "STA <$6B"
040D36  func  set_spawn_level
comment set_spawn_level The level of the spawns the stage puts in: the players less one, plus the difficulty (1 in the attract)

# ---- the attract's opening and the family's profiles (bank 20 6000 by <$03: 7000's steps, each by <$04) ----
# the profile objects' move step (0407C6 "INC #$01,X") and frames (0407C3 "STA #$28,X"); the opening's zoom (04008B
# "STD #$28,X", 0400B5 "SUBD #$00C0")
scoped object attract_profile 01 move_step u8
scoped object attract_profile 28 move_frames u8
scoped object attract_opening 28 zoom u16
# step 0 (7000's first: 601E "LDX #$7010; LDA <$04")
04001E  func  attract_opening
comment attract_opening The attract's opening, by its substep
# 040027: palettes 7A53 and 0F02, the layers cleared to tile 10, 686B, "LDD #$8000; LBSR $8680" (the attract song), the
# object 7066 (animation 1F) at full zoom
040027  func  attract_opening_start
comment attract_opening_start Sets the opening up: palettes, the layers, the attract song and the big picture at full zoom
# 0400AA "SUBD #$00C0" zoom, the layers pulled apart ("SUBD #$0080" BF, "ADDD #$0080" CF)
0400AA  func  attract_opening_zoom
comment attract_opening_zoom Shrinks the picture while the two layers slide apart, then the next step
# step 1 (60FF "LDX #$7014")
0400FF  func  attract_opening_end
comment attract_opening_end The opening's second part, by its substep
# 040108: scrolls 0170/0150, 686B, <$D5 20, palette effect 0000
040108  func  attract_opening_end_start
comment attract_opening_end_start Draws the next layers while the picture keeps shrinking
# 04014B: zoom down to 10 (868C clears the objects), C5 up by 18, D5 down by 30 a frame
04014B  func  attract_opening_end_scroll
comment attract_opening_end_scroll The layers scroll up and down apart, the picture shrinks away
# 04019F "LBSR $8698; INC <$03"
04019F  func  attract_opening_end_wait
comment attract_opening_end_wait Clears the layers and goes on to Bart's part
# step 2 (61AE "LDX #$701A"): Bart's (profile texts 0 and 1)
0401AE  func  attract_bart
comment attract_bart Bart's part of the attract, by its substep
# 0401B7: scroll 04D0, the object 706B (animation 16) moving left and up
0401B7  func  attract_bart_scene_start
comment attract_bart_scene_start Starts Bart's scene: its layer and its object moving
# 040215 "SUBD #$000C" (19), "SUBD #$0600" (BF): the layer races by
040215  func  attract_bart_scene_move
comment attract_bart_scene_move Its object rises and falls while the layer races by, then speeds off
040247  func  attract_bart_scene_wait
comment attract_bart_scene_wait Waits a frame, then Bart's profile
# 040250: 6870, 676D with 70B1, E0 frames, <$83 <$84 cleared
040250  func  attract_bart_profile_start
comment attract_bart_profile_start Starts Bart's profile: its layer and his two pictures
# 040274 "CLRA; LBSR $682C; LDA #$01; LBSR $682C" (texts 0 and 1), "CLRA; LBSR $678D"
040274  func  attract_bart_profile_type
comment attract_bart_profile_type Types Bart's profile texts while his picture moves
# 04028D palette 0203, 868C, 869B, "INC <$03"
04028D  func  attract_bart_profile_end
comment attract_bart_profile_end Ends Bart's profile: palette, objects and texts cleared
# step 3 (62A5 "LDX #$7026"): Homer's (texts 2 and 3)
0402A5  func  attract_homer
comment attract_homer Homer's part of the attract, by its substep
# 0402AE: both layers drawn, the object 7070 (animation 17) held
0402AE  func  attract_homer_scene_start
comment attract_homer_scene_start Starts Homer's scene: its layers and its object
0402EC  func  attract_homer_scene_wait
comment attract_homer_scene_wait Holds the scene for its frames
# 040300 "LBSR $868C; LBSR $8698"
040300  func  attract_homer_scene_end
comment attract_homer_scene_end Clears the scene's objects and layer
040330  func  attract_homer_profile_type
comment attract_homer_profile_type Types Homer's profile texts while his picture moves
# 04030F "LDU #$70BB; LBSR $676D"
04030F  func  attract_homer_profile_start
comment attract_homer_profile_start Starts Homer's profile: its layer and his two pictures
04034B  func  attract_homer_profile_end
comment attract_homer_profile_end Ends Homer's profile: objects and texts cleared
# step 4 (6358 "LDX #$7032"): Lisa's (texts 4 and 5)
040358  func  attract_lisa
comment attract_lisa Lisa's part of the attract, by its substep
# 040361: two objects (7075 animation 1A, 707A animation 1C)
040361  func  attract_lisa_scene_start
comment attract_lisa_scene_start Starts Lisa's scene: its layers and two objects
# 0403B1 "LDD #$0080; STD #$0F,X; STD #$6F,X"
0403B1  func  attract_lisa_scene_walk
comment attract_lisa_scene_walk Its two objects walk in while the layer scrolls
# 0403E4 "LBSR $6447"
0403E4  func  attract_lisa_scene_play
comment attract_lisa_scene_play Its objects change pictures at random for the scene's frames
0403F3  func  attract_lisa_profile_start
comment attract_lisa_profile_start Starts Lisa's profile: its layer and her two pictures
040414  func  attract_lisa_profile_type
comment attract_lisa_profile_type Types Lisa's profile texts while her picture moves
04042F  func  attract_lisa_profile_end
comment attract_lisa_profile_end Ends Lisa's profile: palette, objects and texts cleared
# 040447 every 16 frames "LDB #$0D; MUL; ADDB #$07" (28), animations 1A/1B and 1C/1D
040447  func  attract_lisa_scene_animate
comment attract_lisa_scene_animate Every 16 frames picks the two objects' next pictures at random
# step 5 (6471 "LDX #$703E"): Marge and Maggie's (texts 6 and 7)
040471  func  attract_marge
comment attract_marge Marge and Maggie's part of the attract, by its substep
# 04047A: five objects (708E, 7089, 709D, 70A2, 7093 moving left at 5100), palette 7A53
04047A  func  attract_marge_scene_start
comment attract_marge_scene_start Starts Marge's scene: its layers and objects
040500  func  attract_marge_scene_wait
comment attract_marge_scene_wait Runs the scene for its frames
# 040517 animation A4 at 010F/0098
040517  func  attract_marge_scene_pose
comment attract_marge_scene_pose Puts its first object in its pose, then runs the scene
# 040547 "LBSR $8698; LBSR $868C", palette effect 0000
040547  func  attract_marge_scene_end
comment attract_marge_scene_end Ends Marge's scene: layer and objects cleared
# 040567 "INC #$28,X": at 0F animation 99 and sound 4300, at 1E animation A4
040567  func  attract_marge_scene_animate
comment attract_marge_scene_animate Its first object's two pictures in turn, with a sound
0405A3  func  attract_marge_profile_start
comment attract_marge_profile_start Starts Marge and Maggie's profiles: the layer and their pictures
# 0405E4 texts 6 and 7, moves 3 and 4, "LDD #$4500" every 16 frames
0405E4  func  attract_marge_profile_type
comment attract_marge_profile_type Types Marge's and Maggie's profiles while their pictures move, with a sound
040618  func  attract_marge_profile_end
comment attract_marge_profile_end Ends their profiles: objects and texts cleared
# 040625 "LDX #$5100", x 0 or less: 01A0
040625  func  attract_marge_scene_wrap
comment attract_marge_scene_wrap Brings the moving object back in at the right when it leaves at the left
# step 6 (663D "LDX #$704C")
04063D  func  attract_leap
comment attract_leap The attract's leap scene, by its substep
# 040646: sound 4400, objects 70A7 (up speed 0C00), 7098, 70AC
040646  func  attract_leap_start
comment attract_leap_start Starts the scene: its layer, a sound and three objects, one leaping up
040687  func  attract_leap_rise
comment attract_leap_rise The leap rises, then stops
# 0406A2 "LDD #$F400; STD #$19,X"
0406A2  func  attract_leap_fall
comment attract_leap_fall After a pause the leaping object comes down at 00D8
0406CA  func  attract_leap_land
comment attract_leap_land The object lands and is removed
0406EB  func  attract_leap_end
comment attract_leap_end Waits, then clears the objects and goes on
# step 7 (6700 "LDX #$7056")
040700  func  attract_last_screen
comment attract_last_screen The attract's last screen of this part, by its substep
# 040709: palettes 0D01 and 020C, scene 00 area 3 and scene 02 area 0 drawn, palette effect 7FFF
040709  func  attract_last_screen_start
comment attract_last_screen_start Draws the two layers of the last screen and its palettes
# 040758: palette effect 0000, "INC <$02"
040758  func  attract_last_screen_wait
comment attract_last_screen_wait Waits, fades, and hands over to the attract's next part
# 04076D: no speeds, "LDA #$60; STA #$28,X", 680D twice
04076D  func  attract_profile_place
comment attract_profile_place Puts a profile's two pictures in, still
# 04078D "LDU #$705A; LDY #$70E3" (profile_moves), "LDB #$01,X; ASLB; JMP [B,U]"
04078D  func  attract_profile_move
comment attract_profile_move Runs move A of the profile picture in X by its step
# 04079E "LDD ,Y++; STD #$0F,X; STD #$6F,X", "LDA ,Y+; STA #$28,X"
04079E  func  attract_profile_move_out
comment attract_profile_move_out After its wait, moves the picture and its partner by the move's speeds
# 0407CA
0407CA  func  attract_profile_move_stop
comment attract_profile_move_stop Stops the picture after the move's frames
# 0407E0 "TSTA; BNE", "LDA #$40; STA #$28,X"
0407E0  func  attract_profile_move_pause
comment attract_profile_move_pause Move 0 pauses 40 frames and goes on to move back; the others stop here
# 0407EC "NEGD" on both speeds
0407EC  func  attract_profile_move_back
comment attract_profile_move_back Moves the picture back the way it came
04080C  func  attract_profile_move_done
comment attract_profile_move_done The move's last step: nothing more
# 04080D "LDA #$80; STA #$00,X; LDA #$0E; STA #$04,X; LDA ,U+; ORA #$80; STA #$05,X", x, y, "LEAX #$60,X"
04080D  func  attract_put_picture
comment attract_put_picture Puts in a kind 0E object from a record (animation, x, y) and moves on to the next slot
# 04082C "LDX #$7106" (profile_texts), "CMPA [$48F3]", "INC [$48F3]": FE a new place, FF the end
04082C  func  attract_type_profile_text
comment attract_type_profile_text Types the next letter of profile text A, its count kept where the text says
# 04086B
04086B  func  attract_draw_layers
comment attract_draw_layers Draws both layers of the scene
# 040870 "CLRA; LDB #$26; LBSR $86AD" with the K053251's 1FB9/1FBA set around it
040870  func  attract_draw_layer_a
comment attract_draw_layer_a Draws layer A of the scene
040897  func  attract_draw_layer_b
comment attract_draw_layer_b Draws layer B of the scene
# 0408BF: BE CE C5 D5 C3 D3 CA DA cleared, 9C A9 99 cleared
0408BF  func  attract_reset_layers
comment attract_reset_layers Zeroes both layers' scrolls and offsets

# ======================================================================================================
# ======== bank 2F ========
# ======================================================================================================

# ---- the bank's entries: the EEPROM and the test mode, from the fixed program ----
# 05E000 "LBRA $6A21": writes 00-7F at each address (6A23 "ADDD #$0101"), reads them back (0786CE: the boot)
05E000  func  eeprom_test
comment eeprom_test Writes every EEPROM address with its own number and reads it back: 0 good, 1 bad
# 05E006 "LBRA $6A46" (0786CE)
05E006  func  eeprom_reset_settings
comment eeprom_reset_settings Writes the factory settings into the EEPROM
# 05E009 "ORCC #$10", "LDA #$FB; STA $1D00", "LDX #$7580; LDA $5908; ASLA; JSR [A,X]" (0791A2)
05E009  func  test_run_page
comment test_run_page Runs the test mode's page with the FIRQ and the K052109's IRQ off
# 05E00C "LBRA $6A68": the sum (6A91) against EEPROM 7E-7F (078B1C)
05E00C  func  eeprom_verify
comment eeprom_verify Checks the settings' sum against the one stored: B 0 good, 3 bad
# 05E00F "LBRA $6A81": "LDU #$59F0; LDA #$68", up to 7E
05E00F  func  eeprom_load_settings
comment eeprom_load_settings Copies the EEPROM's settings (68-7D) into the work RAM at 59F0
05E012  func  eeprom_read_byte
comment eeprom_read_byte Reads EEPROM address A into B (for the fixed program)
# 05E015 "LBRA $6D56" (07A460, 07A4A5: the game start): "LDX #$7D78; LDA <$05; ASLA; JSR [A,X]", <$78 idle frames,
# presses (B0) count in <$72
05E015  func  game_start_portraits
comment game_start_portraits Runs the game start's portraits screen and counts the players' presses

# ---- the pages (05E018 "LDX #$7580; LDA $5908": a page each, its steps by $5909 through 603B) ----
# page 0 (05E042 "LDX #$6047")
05E042  func  test_menu_page
comment test_menu_page The MANUAL TEST MENU page, by its step
# 05E04B: test_mode_palettes (8 x BMOVE of 32 bytes), sounds off, page 0, WITH/WITHOUT START BUTTONS at 255B
05E04B  func  test_menu_open
comment test_menu_open Loads the test mode's palettes and prints the main menu and the start buttons' setting
# page 1 (05E09B "LDX #$60A1")
05E09B  func  test_rom_check_page
comment test_rom_check_page The 1 ROM CHECK page, by its step
05E0A5  func  test_rom_check_open
comment test_rom_check_open Starts the ROM check and prints its page
# 05E0B3 "LBSR $6AB0; LBRA $6506"
05E0B3  func  test_rom_check_run
comment test_rom_check_run Runs the ROM check's next step and the page's menu
# page 2 (05E0C3)
05E0C3  func  test_screen_check_page
comment test_screen_check_page The 2 SCREEN CHECK page, by its step
# 05E0CD "LDU #$2F2E; LDY #$2D2C; LDX #$2800" 14 rows of 20
05E0CD  func  test_screen_check_draw
comment test_screen_check_draw Fills the screen with the crosshatch tiles and prints the page
# page 3 (05E0EC)
05E0EC  func  test_color_check_page
comment test_color_check_page The 3 COLOR CHECK page, by its step
# 05E0F6 colour blocks at 2190, then four ramps (614F) at 3344-3584 with palettes 00 40 80 C0
05E0F6  func  test_color_check_draw
comment test_color_check_draw Draws the colour blocks and the four colour ramps and prints the page
05E14F  func  test_color_check_draw_ramp
comment test_color_check_draw_ramp Draws one ramp of 16 colours, two tiles by two each
# page 4 (05E177)
05E177  func  test_io_check_page
comment test_io_check_page The 4 IO CHECK page, by its step
# 05E181 "LDY #$5A60; LBSR $660A": page 0x17 (with START) or 4
05E181  func  test_io_check_open
comment test_io_check_open Prints the I/O page, with the start buttons' row when the game has them
# 05E1A5 "LDY #$1F90": each player's six bits, then <$3D's
05E1A5  func  test_io_check_run
comment test_io_check_run Shows each input bit as 0 or 1 and runs the page's menu
# 05E204 "STB #$40,X", "STB #$-1FC0,X"
05E204  func  test_io_check_draw_bit
comment test_io_check_draw_bit Prints one input's 0 or 1 with its colour, a row down
# page 5 (05E215 "LDX #$621B")
05E215  func  test_music_page
comment test_music_page The 5 MUSIC CHECK page, by its step
05E223  func  test_music_first_choice
comment test_music_first_choice Waits for the first choice, then plays the music number
# 05E229 "LDX #$5915; LDA #$30; BSR $6248"
05E229  func  test_music_choice
comment test_music_choice NEXT MUSIC steps the number (wrapping past 30), REPLAY MUSIC replays it
05E235  func  test_music_open
comment test_music_open Prints the music page
05E23A  func  test_music_replay
comment test_music_replay Plays the music number again after the page is printed
# 05E23E "LDA $5915; LDX #$68EF; LBRA $6728" (sound_test_music)
05E23E  func  test_music_play
comment test_music_play Plays music number 5915 from the music list
# 05E248 "LDA ,X; INCA; CMPA ,S+; BLS; CLRA", "LDA #$FA; STA $5917", 6733
05E248  func  test_sound_test_next
comment test_sound_test_next On the first line steps the number at X (wrapping past A); stops the sound and restarts the timer
# 05E261 "LBSR $6506", "LDA #$FA; STA $5917", "INC $5909"
05E261  func  test_sound_test_first_press
comment test_sound_test_first_press On a choice in the menu, restarts the timer and goes to the page's next step
# page 6 (05E271 "LDX #$6277")
05E271  func  test_sound_page
comment test_sound_page The 6 SOUND CHECK page, by its step
05E27F  func  test_sound_first_choice
comment test_sound_first_choice Waits for the first choice, then plays the sound number
# 05E285 "DEC $5917; BEQ $6290"
05E285  func  test_sound_choice
comment test_sound_choice NEXT SOUND or REPLAY SOUND; the timer running out steps to the next sound by itself
05E297  func  test_sound_open
comment test_sound_open Prints the sound page
05E29C  func  test_sound_replay
comment test_sound_replay Plays the sound number again after the page is printed
# 05E2A0 "LDA $5916; LDX #$6799; LBRA $6728" (sound_test_effects)
05E2A0  func  test_sound_play
comment test_sound_play Plays sound number 5916 from the effects' list
# page 7 (05E2AA "LDY #$5A60; LDB #$07; LBSR $6425"; with them on, 5A62 and 591B cleared)
05E2AA  func  test_start_buttons_page
comment test_start_buttons_page The 7 START BUTTON page: with or without start buttons (which turns the premium start off)
# page 8 (05E2C3 "LDX #$62C9")
05E2C3  func  test_options_page
comment test_options_page The 8 COIN/GAME OPTIONS page, by its step
# 05E2CD "DECA; BEQ; LDA #$23; LBRA $66FD"
05E2CD  func  test_print_plural
comment test_print_plural Prints an S unless the count was 1
# 05E2D6 "LDY #$5A59", "LDY #$7A5D" (coin_setting_coin_digits), "LDY #$7A6F" (coin_setting_credit_digits), COIN, CREDIT
05E2D6  func  test_print_coinage
comment test_print_coinage Prints the coin setting as n COIN(S) n CREDIT(S), the continue's with the extra coins
# 05E31B: coinage at 219F and 21DF, players (5A5D), difficulty (5A5C, words from 7935), attract sound (5A5E), flip
# (5A5F), output (5A61), page 8
05E31B  func  test_options_open
comment test_options_open Prints the options page with every setting's value
# 05E399 "LDU #$7B68" (OFF) / "LDU #$7B65" (ON)
05E399  func  test_print_off_on
comment test_print_off_on Prints OFF or ON for B
# page 9 (05E3A7 "LBSR $8659; LDX $FFFE; JMP ,X")
05E3A7  func  test_exit
comment test_exit Leaves the test mode: tells the sound CPU, then restarts at the reset vector
# page 10 (05E3B0): with start buttons 5A59 on page 0A; else the premium start's pages 14/15 or 13, then page 12
05E3B0  func  test_coin_setting_page
comment test_coin_setting_page The 8-1 COIN SETTING page: plain, or with the premium start's settings
# 05E3E9 "LDY #$5A59; LBSR $660A"
05E3E9  func  test_open_coinage_page
comment test_open_coinage_page Opens page A with the coin setting's line marked
# 05E3EF "STA $5908; LBSR $662A; LDA #$40; LBRA $65A7"
05E3EF  func  test_open_page_marked
comment test_open_page_marked Makes page A the current one, prints it and marks line B
# pages 11-12 (05E3FB "LDY #$5A5D; LDB #$0C")
05E3FB  func  test_players_page
comment test_players_page The 8-2 NUMBER OF PLAYERS page
# page 13 (05E403 "LDY #$5A5C; LDB #$0D")
05E403  func  test_difficulty_page
comment test_difficulty_page The 8-3 DIFFICULTY page
# page 14 (05E40B "LDY #$5A5E; LDB #$0E")
05E40B  func  test_attract_sound_page
comment test_attract_sound_page The 8-4 SOUND IN ATTRACT MODE page
# page 15 (05E413 "LDY #$5A5F; LDB #$0F", "STB $1E80")
05E413  func  test_screen_flip_page
comment test_screen_flip_page The 8-5 VIDEO SCREEN FLIP page, flipping the K052109 as it is chosen
# page 16 (05E420 "LDY #$5A61; LDB #$10")
05E420  func  test_sound_output_page
comment test_sound_output_page The 8-6 SOUND OUTPUT page (monaural or stereo)
# 05E425 "LDX #$642B; LBRA $603B"
05E425  func  test_choose_setting
comment test_choose_setting A page that chooses the setting at Y among its lines (page B), by its step
# 05E42F "TFR B,A; LBSR $662A", "LDA #$40; BSR $6461"
05E42F  func  test_choose_setting_open
comment test_choose_setting_open Prints the setting's page and marks its value's line
# 05E43C "LBSR $6506", "LBSR $65E8"
05E43C  func  test_choose_setting_run
comment test_choose_setting_run Runs the menu; a chosen line becomes the setting (carry set)
# 05E461 "LBSR $660A; LBRA $65A7"
05E461  func  test_mark_setting
comment test_mark_setting Colours the line of the setting at Y's value with A
# page 17 (05E467 "LDX #$646D")
05E467  func  test_factory_setting_page
comment test_factory_setting_page The 8-7 FACTORY SETTING page, by its step
# 05E471 "LDU #$7AEE", "LBSR $6A46", page 0x11 ("COMPLETE.")
05E471  func  test_factory_setting_apply
comment test_factory_setting_apply Writes the factory settings and prints COMPLETE.
05E481  func  test_factory_setting_wait
comment test_factory_setting_wait Runs the page's menu
# page 18 (05E484 "LDY #$591B; LDB #$12")
05E484  func  test_premium_start_page
comment test_premium_start_page The premium start's OFF/ON choice, then the coin settings that go with it
# page 19 (05E4D6 "LDB #$13; LDY #$5A59")
05E4D6  func  test_coinage_page
comment test_coinage_page The coin settings' page without the premium start
# page 20 (05E4DE "LDY #$591C; LDB #$14", "ADDB #$02; LDY #$5A62; LBSR $65E8")
05E4DE  func  test_premium_coins_page
comment test_premium_coins_page The extra coins for the premium start (1-5), stored as the setting less 2
# page 21 (05E4F5 "LDB #$15")
05E4F5  func  test_premium_coinage_page
comment test_premium_coinage_page The coin settings' page with the premium start
# page 22 (05E4F9 "CLR $5909; CLR $5908")
05E4F9  func  test_back_to_menu
comment test_back_to_menu Goes back to the main menu

# ---- the menu, the settings and the printer ----
# 05E506 "LDA $1F90; ANDA #$0C" (1P up/down), test_menu_cursor_steps, 5914 repeat, "LDA <$42; ANDA #$10" (SHOOT1), the
# line's action (05E577 "LDA A,X"): 20 returns the line with carry, else that page
05E506  func  test_menu_update
comment test_menu_update Moves the cursor with the 1P joystick, and on SHOOT1 goes to the line's page or hands back its line
# 05E5A7 "LDX $590D; LDA #$03; MUL; LEAX B,X; LDX ,X"
05E5A7  func  test_mark_line
comment test_mark_line Colours menu line B's row with A
05E5BD  func  test_unmark_row
comment test_unmark_row Clears the colour of the row at X
# 05E5BE "ADDD #$E000; ANDB #$C0; ADDB #$0F", "BSET A,X,U" over 24 (12 from page 14 on)
05E5BE  func  test_colour_row
comment test_colour_row Colours the row at X with A
# 05E5E8 "CMPY #$5A58", "CMPY #$5A67", "LEAY #$-59F0,Y", 68F1 and 6A57; else "STB ,Y"
05E5E8  func  test_write_setting
comment test_write_setting Writes setting Y (5A58-5A67 stand for EEPROM 68-77) and the EEPROM's sum; else the variable
# 05E60A the same, "LBSR $6915"; else "LDB ,Y"
05E60A  func  test_read_setting
comment test_read_setting Reads setting Y from the EEPROM (5A58-5A67), else the variable, into B
# 05E62A "LDU #$75BE; ASLA; LDU A,U; BSR $6650", "STA $590A", "STD $590B", "STU $590D", "INC $5909"
05E62A  func  test_open_page
comment test_open_page Prints test_mode_texts[A] and takes its menu: its length, cursor variable and lines
# 05E650: 30-BF a letter (tile less 30), under 30 a place (208C + 64a + b), C0 end, C1-C6 by 6691, C7 on a word
05E650  func  test_print
comment test_print The test mode's printer: letters, places, new lines, hex bytes and words, up to C0
param test_print u text
param test_print x tiles
# 05E6FD "STB #$-2000,X; STA ,X+"
05E6FD  func  test_put_tile
comment test_put_tile Puts tile A with colour B at X and steps X
# 05E711 "LDY #$75AE" (test_mode_hex_digit_tiles)
05E711  func  test_print_hex
comment test_print_hex Prints A as two hex digits at X
# 05E733 "LDD #$0000; LBRA $8680"
05E733  func  test_silence
comment test_silence Queues sound command 0000 (all sounds off)

# ---- the EEPROM (ER5911: 1FC2 bit 3 CS, 4 CLK, 7 DI; 1F81 bit 4 data, 5 ready) ----
# 05E8F1 "STA $5A00; STB $5A01", 6932 6938 693E 6965 698A 698F 69A1
05E8F1  func  eeprom_write
comment eeprom_write Writes byte B at EEPROM address A: unlock, write, address, data, end, wait, lock
# 05E915 "STA $5A00", 69A6 693E 69AB 698A, "LDB $5A02"
05E915  func  eeprom_read
comment eeprom_read Reads the EEPROM at address A into B
# 05E932 "LDX #$7C7C": 1 00 11 (unlock: erase and write enable)
05E932  func  eeprom_send_unlock
comment eeprom_send_unlock Sends the unlock command
# 05E938 "LDX #$7C9A": 1 11 (write)
05E938  func  eeprom_send_write
comment eeprom_send_write Sends the start of a write command
# 05E93E "LDX #$7CA7" (eeprom_address_signals), "BITB #$40" from 5A00
05E93E  func  eeprom_send_address
comment eeprom_send_address Clocks out the 7 address bits of 5A00
# 05E965 "LDX #$7CB6" (eeprom_data_signals), "BITB #$80" from 5A01
05E965  func  eeprom_send_data
comment eeprom_send_data Clocks out the 8 data bits of 5A01
# 05E98A "LDX #$7CC7" (00 10 00)
05E98A  func  eeprom_deselect
comment eeprom_deselect Ends a command (chip select off)
# 05E98F "LDX #$7CCB", "LDA $1F81; ANDA #$20; BEQ"
05E98F  func  eeprom_wait_ready
comment eeprom_wait_ready Waits for the EEPROM to finish writing
# 05E9A1 "LDX #$7CCC": 1 00 00 (lock)
05E9A1  func  eeprom_send_lock
comment eeprom_send_lock Sends the lock command
# 05E9A6 "LDX #$7D08": 1 10 (read)
05E9A6  func  eeprom_send_read
comment eeprom_send_read Sends the start of a read command
# 05E9AB "LDX #$7D23", 8 x "LDA $1F81; ANDA #$10" rolled into 5A02
05E9AB  func  eeprom_receive_data
comment eeprom_receive_data Clocks in 8 data bits into 5A02
# 05E9F2 "TST $1FCA" (the watchdog) and 42 NOPs
05E9F2  func  eeprom_delay
comment eeprom_delay Kicks the watchdog and waits between the EEPROM's signals
# 05EA46 "LDU #$7D36; LDA #$68", up to FF, then 6A57
05EA46  func  eeprom_write_defaults
comment eeprom_write_defaults Writes the factory settings from 68 on, then the sum
# 05EA57 "BSR $6A91; LDA #$7E", <$F0 and <$F1
05EA57  func  eeprom_write_sum
comment eeprom_write_sum Writes the sum of EEPROM 00-7D at 7E-7F
# 05EA91 "CLRD; STD <$F0", up to 7E
05EA91  func  eeprom_sum
comment eeprom_sum Adds up EEPROM 00-7D into the scratch word

# ---- the ROM check (5A10 its step through 7D42) ----
# 05EAB0 "LDX #$7D42; LDA $5A10; ASLA; JMP [A,X]"
05EAB0  func  test_rom_check_step
comment test_rom_check_step Runs the ROM check's step
# 05EABA: 5A10-5A1F cleared, "LBSR $8605" (the sound CPU's answer, bit 7 in 5A1B), "LBSR $8608" (its ROM's sum)
05EABA  func  test_rom_check_start
comment test_rom_check_start Clears the check's variables and asks the sound CPU to sum its ROM
# 05EADE: 1D80 10 and 1F00 32, then 54 and 76, "LBSR $6BE7" each, "STX A,U" at 5A12
05EADE  func  test_rom_check_sum_tiles
comment test_rom_check_sum_tiles Sums a quarter of the tile ROMs (both banks of the K052109)
# 05EB19: 5A12+5A14 and 5A16+5A18 through 6CFE
05EB19  func  test_rom_check_tiles_result
comment test_rom_check_tiles_result Checks the two tile ROMs' sums and prints them
# 05EB48: "LDU #$7D74" (sprite_rom_read_banks), 8 x 6C6D, 6CFE
05EB48  func  test_rom_check_sum_sprites
comment test_rom_check_sum_sprites Sums one sprite ROM through the K053246 and checks it
# 05EB83 "LBSR $8611" (done?), "LBSR $860B" (6G's sum), "LDU #$251F", "ANDA #$04"
05EB83  func  test_rom_check_6g
comment test_rom_check_6g Prints the sound board's 6G result and sum the sound CPU reports
# 05EBBF "LBSR $860E" (7G's sum), "LDU #$259F", "ANDA #$08"
05EBBF  func  test_rom_check_7g
comment test_rom_check_7g Prints the sound board's 7G result and sum the sound CPU reports
05EBE6  func  test_rom_check_done
comment test_rom_check_done The check's last step: nothing more
# 05EBE7: 1FC0 bit 3 (the tile ROM readable), 40 banks (1E00) of 0800 reads at 2000 + 5A11
05EBE7  func  test_sum_tile_rom
comment test_sum_tile_rom Adds up the tile ROM's bytes through the K052109, interrupts off
# 05EC6D: 1FA6/1FA7/1FA4 the address, "LDB $1FC8; ABX; LDB $1FC9; ABX", 1FC0 bit 5
05EC6D  func  test_sum_sprite_rom
comment test_sum_sprite_rom Adds up 10000 words of a sprite ROM through the K053246, interrupts off
# 05ECFE "LDY #$7D5C" (graphics_rom_sums), "LDU #$7D68", "CMPX A,Y"
05ECFE  func  test_check_rom_sum
comment test_check_rom_sum Compares a graphics ROM's sum with the right one and prints OK or BAD
# 05ED0F tiles 1F 1B ("OK"), 05ED28 12 11 14 ("BAD"), then "LBSR $8692" the sum, "INC $5A1A"
05ED0F  func  test_print_rom_ok
comment test_print_rom_ok Prints OK and the sum, and moves to the next result's line
05ED28  func  test_print_rom_bad
comment test_print_rom_bad Prints BAD (in colour 40) and the sum, and moves to the next result's line

# ---- the game start's portraits (05E015; the four objects at 4F80 + C0 x player, test_player_records) ----
# their step (05EF17 "INC #$01,X"), frame wait and frame (05EF33-05EF4C), wait (05EF25 "STA #$30,X")
scoped object portrait 01 step u8
scoped object portrait 28 frame_wait u8
scoped object portrait 29 portrait_frame u8
scoped object portrait 30 wait u8
# 05EDB4: free play (<$3B) the players with 4817 + 8n set, else with credits (<$37) the players pressing (B0)
05EDB4  func  game_start_join_players
comment game_start_join_players Marks in 485B the players who join (pressing, or with free play set up)
# 05EE08: K053251 1FB9/1FBA, palettes 0408 and 001B, scene 80, the layers, portrait_areas' colours, "INC <$05"
05EE08  func  game_start_draw_portraits
comment game_start_draw_portraits Draws the portraits' screen: palettes, scene 80 and each portrait's colours
# 05EEAB "LDX #$4F80", "LDU #$7D88; LDU A,U; BSR $6ED1"
05EEAB  func  game_start_run_portraits
comment game_start_run_portraits Runs the four portrait objects
# 05EED1 "LDY #$7D7C; LDA #$01,X; ASLA; JMP [A,Y]"
05EED1  func  portrait_run
comment portrait_run Runs a portrait by its step
# 05EEDA: kind and animation, x, z, its partner (+60) the shadow
05EEDA  func  portrait_start
comment portrait_start Sets the portrait and its shadow up from its record
# 05EF1B "LDA #$11,U; ANDA <$5B"
05EF1B  func  portrait_wait_join
comment portrait_wait_join Waits for its player to join
05EF2C  func  portrait_wait
comment portrait_wait Waits 20 frames after its player joins
# 05EF3F frames 11-16 every 3 frames; at 16 the shadow on, palette set (0C), palette effect (0D), sound (0F)
05EF3F  func  portrait_come_alive
comment portrait_come_alive Animates the portrait coming alive, then its colours and its voice
# 05EF89 "ADDB <$58; ANDB #$F7", animation 8B
05EF89  func  portrait_blink_now_and_then
comment portrait_blink_now_and_then Now and then (at random) plays its idle animation
# 05EF9D "LDA #$06,X; ANDA #$01", "DEC #$01,X"
05EF9D  func  portrait_wait_animation
comment portrait_wait_animation Waits for the idle animation's end, then waits for the next

# 05EDCE "ORB <$F0; STB <$5B", 05EF1E "ANDA <$5B"
485B  var  players_joined  u8
# 04082C "LDD ,X++; STD <$F3" (the text's first word, 4883 / 4884), "INC [$48F3]"; cleared at 04026A
4883  var  profile_typed  u8
4884  var  profile_alias_typed  u8
# the test mode
# 05E027 "LDA $5908" (the page), 05E03B "LDA $5909" (its step)
5908  var  test_page  u8
5909  var  test_page_step  u8
# 05E638 "STA $590A", 05E63E "STD $590B", 05E646 "STU $590D"
590A  var  test_menu_length  u8
590B  var  test_menu_cursor_variable  u16
590D  var  test_menu_lines  u16
# the pages' cursor (test_mode_texts' menus name 5913: "Y\x13")
5913  var  test_cursor  u8
# 05E542 "LDA #$07; STA $5914" (the cursor's repeat)
5914  var  test_cursor_repeat  u8
5915  var  test_music_number  u8
5916  var  test_sound_number  u8
# 05E266 "LDA #$FA; STA $5917", 05E285 "DEC $5917"
5917  var  test_sound_timer  u8
# 05E6DF "INC $591A" (the printer writes down a column), 05E663
591A  var  test_print_down  u8
591B  var  test_premium_start  u8
591C  var  test_premium_coins  u8
# the EEPROM's
5A00  var  eeprom_address  u8
5A01  var  eeprom_data  u8
5A02  var  eeprom_read_data  u8
# the ROM check's
5A10  var  rom_check_step  u8
5A11  var  rom_check_chip  u8
5A12  var  rom_check_tile_sums[4]  u16
5A1A  var  rom_check_line  u8
5A1B  var  rom_check_no_sound_cpu  u8

# ======== the typed registers of the data read by name, under the functions' new names ========
local title_card_put_picture 0271A8 u place placement
local screen_shake_advance 0261E7 x shake shake_step
param layer_scroll_move x scroll layer_scroll
local cemetery_scroll_up 02612B x step layer_offset_step
local cemetery_scroll_up 02612D,026137 x step_word layer_step_word
local krusty_balloon_set_hit_box 026980 u box hit_box
local wandering_zombie_setup 030094 u move timed_move
# ---- type 10, kind 91: object_18_behaviours stays; its read through U ----
# 030137 "LDU #$79DA; LDA #$30,X; ASLA; ASLA", 03013F "LEAU A,U", 030141 "LDD ,U" (state, flags), 030154 "LDD #$02,U;
# STD #$2A,X" (the behaviour)
local zombie_setup 03013F u choice behaviour_choice
local ghost_on_rope_setup 030487 u start drop_start
local rising_zombie_setup 03057F u start appearance
local gorilla_entrance_setup 0309C3 u entrance gorilla_entrance
local knight_setup 030C38,030C54 u entrance knight_entrance
local cloud_devil_bob 03118B,031190 u heights bob_height
local cloud_devil_set_speeds 0311C0 u speeds velocity
local belly_dancer_watcher_setup 0314F4 u look pose
local robot_piece_setup 032A57 u piece robot_piece
local goon_lift_part_setup 032FB2 u part channel_6_scenery_part
local flying_saxophone_bob 0335E8,0335ED u heights bob_height
local flying_saxophone_set_speeds 033611 u speeds velocity
local boss_ball_setup 034E5E u start launch
# the path type FE takes (object_1a_path_starts, the struct path_start): 0353A7 "LDU #$79DC ... LDA A,U; STA <$F0;
# ASLA; ASLA", 0353B9 "LDU #$79E4", 0353BC "LEAU A,U", 0353BE "LDD ,U; STD #$2C,X", 0353C3 "LDD #$02,U; STA #$3B,X; STB
# #$3A,X"
local dreamland_boss_chain_head_choose_lash 0353BC u start path_start
local football_line_piece 03C875 y piece line_piece
local bear_part 03CE94 y flight part_flight
param attract_profile_move_out y move profile_move
param attract_profile_move_back y move profile_move
local gauge_print_count 040ACB,040AF0 y digit big_digit
local gauge_draw_health 040A52 y step gauge_step
local rank_add_base 040C65 x amounts rank_amount
local game_start_draw_portraits 05EE51 x area portrait_area
local test_music_play 05E242 x commands sound_test_command
local test_sound_play 05E2A4 x commands sound_test_command
local find_layer_a_block 07C8BD,07C8C5 y scene_lists scene_area_list
local find_layer_b_block 07C8F7,07C8FF y scene_lists scene_area_list
local set_area_tile_banks 07C931,07C939 y mode_lists layer_mode_list
local draw_tile_picture 07C51C u places tile_picture_entry

# ======== the enemies' step tables and the robot's pieces ========
# ======== the enemies' step tables, by name ========
# Each move, reaction or climb runs by its step (field 29) through its own table: "LDU #$Fxxx; ASLB; JMP [B,U]"
# (or JSR) at its dispatcher. The tables lie one after another from F1BE to F2AB, and a routine's steps run on into
# the next table's on purpose: the enemy walking to its target (F1FE, 2 steps of its own) goes on at its step 2 with
# the steps of lining up with it (F202), stage 5 at frame 4925 ("LDU #$F1FE; ASLB; JMP [B,U]" with B = 3: 07DA1A).
# So no table here has a length (with one, that step did nothing): each switch keeps the next tables' entries as
# cases, which the game can reach. These lines name them only.
# 07D6B2 "LDU #$F1AE; LDD #$28,X; ASLA; JSR [A,U]": the climb or hop by the action (field 28), 8 of them up to F1BE
07F1AE  data  enemy_climb_actions
# 07D6BE "LDU #$F1BE; ASLB; JMP [B,U]" (enemy_climb_up_front's steps)
07F1BE  data  enemy_climb_up_front_steps
# 07D6F7 "LDU #$F1C4; ASLB; JMP [B,U]" (enemy_climb_up_back's steps)
07F1C4  data  enemy_climb_up_back_steps
# 07D721 "LDU #$F1CA; ASLB; JMP [B,U]" (enemy_climb_up_left's steps)
07F1CA  data  enemy_climb_up_left_steps
# 07D74B "LDU #$F1D0; ASLB; JMP [B,U]" (enemy_climb_up_right's steps)
07F1D0  data  enemy_climb_up_right_steps
# 07D787 "LDU #$F1D6; ASLB; JMP [B,U]" (enemy_hop_down_front's steps)
07F1D6  data  enemy_hop_down_front_steps
# 07D7A6 "LDU #$F1DC; ASLB; JMP [B,U]" (enemy_hop_down_back's steps)
07F1DC  data  enemy_hop_down_back_steps
# 07D7C5 "LDU #$F1E2; ASLB; JMP [B,U]" (enemy_hop_down_left's steps)
07F1E2  data  enemy_hop_down_left_steps
# 07D7CB "LDU #$F1E8; ASLB; JMP [B,U]" (enemy_hop_down_right's steps)
07F1E8  data  enemy_hop_down_right_steps
# 07D7FA "LDU #$F1EE; ASLB; JMP [B,U]" (enemy_get_around's steps)
07F1EE  data  enemy_get_around_steps
# 07D880 "LDU #$F1F4; ASLB; JMP [B,U]" (enemy_walk_to_target_side's steps)
07F1F4  data  enemy_walk_to_target_side_steps
# 07D8E2 "LDU #$F1F8; ASLB; JMP [B,U]" (enemy_line_up_near_target's steps)
07F1F8  data  enemy_line_up_near_target_steps
# 07D994 "LDU #$F1FE; ASLB; JMP [B,U]" (enemy_walk_to_target's steps)
07F1FE  data  enemy_walk_to_target_steps
# 07DA09 "LDU #$F202; ASLB; JMP [B,U]" (enemy_line_up_with_target's steps)
07F202  data  enemy_line_up_with_target_steps
# 07DABE "LDU #$F208; ASLB; JMP [B,U]" (enemy_keep_distance's steps)
07F208  data  enemy_keep_distance_steps
# 07DB71 "LDU #$F210; ASLB; JMP [B,U]" (enemy_wait_while_target_down's steps)
07F210  data  enemy_wait_while_target_down_steps
# 07DB7A "LDU #$F214; ASLB; JMP [B,U]" (enemy_back_off's steps)
07F214  data  enemy_back_off_steps
# 07DC03 "LDU #$F21A; ASLB; JMP [B,U]" (enemy_step_toward_target's steps)
07F21A  data  enemy_step_toward_target_steps
# 07DC3E "LDU #$F21E; ASLB; JMP [B,U]" (enemy_circle_target's steps)
07F21E  data  enemy_circle_target_steps
# 07DC9C "LDU #$F222; ASLB; JMP [B,U]" (enemy_wander's steps)
07F222  data  enemy_wander_steps
# 07DD0B "LDU #$F228; ASLB; JMP [B,U]" (enemy_rush_at_target's steps)
07F228  data  enemy_rush_at_target_steps
# 07DD77 "LDU #$F22E; ASLB; JMP [B,U]" (enemy_line_up_and_pace's steps)
07F22E  data  enemy_line_up_and_pace_steps
# 07DDC3 "LDU #$F248; ASLB; JMP [B,U]" (enemy_flinch_from_behind's steps)
07F248  data  enemy_flinch_from_behind_steps
# 07DDF3 "LDU #$F24C; ASLB; JMP [B,U]" (enemy_flinch_kind_12's steps)
07F24C  data  enemy_flinch_kind_12_steps
# 07DE0E "LDU #$F250; ASLB; JMP [B,U]" (enemy_flinch_kind_11's steps)
07F250  data  enemy_flinch_kind_11_steps
# 07DE29 "LDU #$F254; ASLB; JMP [B,U]" (enemy_knocked_forward's steps)
07F254  data  enemy_knocked_forward_steps
# 07DEB1 "LDU #$F258; ASLB; JMP [B,U]" (enemy_knocked_back's steps)
07F258  data  enemy_knocked_back_steps
# 07DF4C "LDU #$F25E; ASLB; JMP [B,U]" (enemy_get_up's steps)
07F25E  data  enemy_get_up_steps
# 07DF60 "LDU #$F262; ASLB; JMP [B,U]" (enemy_die's steps)
07F262  data  enemy_die_steps
# 07DF9B "LDU #$F266; ASLB; JMP [B,U]" (enemy_drop's steps)
07F266  data  enemy_drop_steps
# 07DFB1 "LDU #$F268; ASLB; JMP [B,U]" (enemy_sent_flying's steps)
07F268  data  enemy_sent_flying_steps
# 07E028 "LDU #$F26E; ASLB; JMP [B,U]" (enemy_spin_backward's steps)
07F26E  data  enemy_spin_backward_steps
# 07E05E "LDU #$F274; ASLB; JMP [B,U]" (enemy_defeated_forward's steps)
07F274  data  enemy_defeated_forward_steps
# 07E12F "LDU #$F27A; ASLB; JMP [B,U]" (enemy_defeated_backward's steps)
07F27A  data  enemy_defeated_backward_steps
# 07E143 "LDU #$F280; ASLB; JMP [B,U]" (enemy_pit's steps)
07F280  data  enemy_pit_steps
# 07E18F "LDU #$F28C; ASLB; JMP [B,U]" (fireman_goon_effect's steps)
07F28C  data  fireman_goon_effect_steps
# 07E1D3 "LDU #$F29E; LDA #$29,X; ASLA; JSR [A,U]" (in enemy_hurt_become_goon: the hurt enemy's steps)
07F29E  data  enemy_hurt_steps

# ======== the robot's eight pieces ========
# 032E17 robot_put_in_pieces: "LDA #$08; STA <$F4", "LDY #$7CC8", then "LBSR $862C" (a child object), "LEAY #$08,Y",
# "DEC <$F4; BNE": eight child objects' records, 033CC8-033D07; the table 7D08 that follows (032E33 "LDU #$7D08; ASLB;
# JMP [B,U]") was read backwards over them until its entries had to start code that uses no stack it did not push
033CC8  table  robot_piece_children[8]  child_object

# ======== code and data still named after their address ========
# (merged without the lengths this part gave the tables of code addresses, record=2 count=N: a routine's steps run
# on into the next table's on purpose, see the enemies' step tables above; the analysis reads them as before)
# ======== the 053248's code and data still named after their place ========
# How each name reaches the C:
# - a data line (PLACE data NAME) names the piece the data walk starts there: extract_assets takes symbols.txt's names
#   for its pieces (analysis.symbols), so assets/data/layout.txt then holds NAME, and the decompiler names the data by
#   layout.txt (konami_cpu/decompile.py piece_names, which overrides symbols.txt's data names): extract_assets has to
#   run again after the merge, before decompile.py, or the C keeps the old names from the old layout.txt. A plain data
#   line changes nothing the walk or the analysis does (no length: analysis.layout_of is None).
# - a data line with record=2 count=N code=0 (the tables of code addresses) also gives the analysis the table's
#   length: it reads N entries, and no more the tables before and after it (their entries were cases of its switch:
#   wrestler_beaten's switch had the flinch's and the entrance's handlers). The piece is the same (the walk's loaded
#   table). Tables with entries before their address (negative states: the bosses' FD-FF) or past the next table get a
#   plain line, so the analysis still reads them both ways.
# - func lines replace symbols.txt's func line at the same place (unused_XXXXXX, unreached_XXXXXX); sub_ ones are new.
# Lines elsewhere that use an old name (symbols.txt's 11 comments with enemy_behaviour_XXXXXX and object_setup_07F1A8,
# its "local unused_02A0CD 02A0D8 u target object", and the other param/local/scoped lines on unused_ and
# unreached_ functions) need the new name: the map below, one "# rename OLD NEW" a line.


# ======== the tables of code addresses the code loads into a register and jumps through ========

# 020016 "LDX #$7B80", 02001E "JMP [A,X]" (index LDA $18E0): bonus_1_intro_pan bonus_1_intro_set_up bonus_1_intro_show_how; the scenarios jump to 3 of its 3 (was loaded_table_021B80)
021B80  data  bonus_1_intro_states
# 0200FD "LDX #$7B86", 020105 "JMP [A,X]" (index LDA $18E0): bonus_1_contest_start bonus_1_contest_play bonus_1_finish; the scenarios jump to 3 of its 3; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_021B86)
021B86  data  bonus_1_contest_states
# 02010C "LDX #$7B8C", 020114 "JMP [A,X]" (index LDA $18E1): bonus_1_contest_set_up bonus_1_contest_ready; the scenarios jump to 2 of its 2; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_021B8C)
021B8C  data  bonus_1_contest_start_steps
# 020178 "LDX #$7B90", 020180 "JMP [A,X]" (index LDA $18E1): bonus_1_start_music bonus_1_blow_until_done; the scenarios jump to 2 of its 2; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_021B90)
021B90  data  bonus_1_contest_play_steps
# 0201F2 "LDX #$7B94", 0201FA "JMP [A,X]" (index LDA $18E1): bonus_1_finish_music bonus_1_results bonus_1_top_up_balloons bonus_1_fly_away bonus_1_end; the scenarios jump to 5 of its 5; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_021B94)
021B94  data  bonus_1_finish_steps
# 020919 "LDX #$7BB2", 020920 "JMP [A,X]" (index LDA <$05): bonus_pan_start bonus_pan_up; the scenarios jump to 2 of its 2; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_021BB2)
021BB2  data  bonus_pan_steps
# 02096F "LDX #$7BB6", 020973 "JMP [B,X]" (index LDB <$16): bonus_hide_hints bonus_show_hints_1 bonus_hide_hints bonus_show_hints_2; the scenarios jump to 3 of its 4; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_021BB6)
021BB6  data  bonus_hint_blink_steps
# 0209C0 "LDX #$7BBE", 0209C8 "JMP [B,X]" (index LDB $18F1): bonus_title_wait bonus_title_show bonus_title_done; the scenarios jump to 3 of its 3; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_021BBE)
021BBE  data  bonus_title_steps
# 0212FB "LDU #$7E2F", 021302 "JSR [A,U]" (index LDA #$02,X): wrestler_entrance wrestler_walk wrestler_punch wrestler_guard wrestler_jump wrestler_jump wrestler_idle wrestler_wait_target_up; the scenarios jump to 6 of its 8; and to entries before it (a negative index): wrestler_beaten (-3), wrestler_knocked_down (-2), wrestler_flinch (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_021E2F)
021E2F  data  wrestler_states
# 021315 "LDU #$7E3F", 02131C "JMP [A,U]" (index LDA #$28,X): wrestler_beaten_wait wrestler_blink_out; the scenarios jump to 2 of its 2; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_021E3F)
021E3F  data  wrestler_beaten_actions
# 02137C "LDU #$7E43", 021383 "JMP [A,U]" (index LDA #$28,X): wrestler_fall wrestler_lie wrestler_get_up; the scenarios jump to 3 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_021E43)
021E43  data  wrestler_knocked_down_actions
# 0213CA "LDU #$7E49", 0213D1 "JMP [A,U]" (index LDA #$28,X): wrestler_flinch_wait wrestler_flinch_land; the scenarios jump to 2 of its 2; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_021E49)
021E49  data  wrestler_flinch_actions
# 0213EA "LDU #$7E4D", 0213F1 "JMP [A,U]" (index LDA #$28,X): wrestler_put_in wrestler_entrance_drop wrestler_entrance_pose wrestler_entrance_step_out wrestler_entrance_land wrestler_entrance_stand wrestler_entrance_shout wrestler_entrance_end; the scenarios jump to 8 of its 8; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_021E4D)
021E4D  data  wrestler_entrance_actions
# 02158F "LDU #$7E5D", 021596 "JMP [A,U]" (index LDA #$28,X): wrestler_punch_wind_up wrestler_punch_strike wrestler_punch_recover; the scenarios jump to 3 of its 3; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_021E5D)
021E5D  data  wrestler_punch_actions
# 0215E3 "LDU #$7E63", 0215EA "JMP [A,U]" (index LDA #$28,X): wrestler_guarding; the scenarios jump to 1 of its 1; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_021E63)
021E63  data  wrestler_guard_actions
# 021605 "LDU #$7E65", 02160C "JMP [A,U]" (index LDA #$28,X): wrestler_jump_rise wrestler_jump_land wrestler_jump_recover wrestler_jump_end; the scenarios jump to 4 of its 4 (was loaded_table_021E65)
021E65  data  wrestler_jump_actions
# 02168C "LDU #$7E6D", 021693 "JMP [A,U]" (index LDA #$28,X): wrestler_idle_look wrestler_idle_end; the scenarios jump to 2 of its 2; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_021E6D)
021E6D  data  wrestler_idle_actions
# 022A4F "LDU #$7A13", 022A56 "JSR [A,U]" (index LDA #$02,X): stage_7_boss_entrance stage_7_boss_walk stage_7_boss_attack stage_7_boss_charge stage_7_boss_jump_away stage_7_boss_idle stage_7_boss_wait_target_up; the scenarios jump to 6 of its 7; and to entries before it (a negative index): stage_7_boss_beaten (-3), stage_7_boss_knocked_down (-2), stage_7_boss_flinch (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_023A13)
023A13  data  stage_7_boss_states
# 022A70 "LDU #$7A21", 022A77 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_beaten_wait stage_7_boss_blink_out; the scenarios jump to 2 of its 2; without its length the analysis reads 6 before it (its neighbours' entries) (was loaded_table_023A21)
023A21  data  stage_7_boss_beaten_actions
# 022ACC "LDU #$7A25", 022AD3 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_fall stage_7_boss_lie stage_7_boss_get_up; the scenarios jump to 3 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_023A25)
023A25  data  stage_7_boss_knocked_down_actions
# 022B1A "LDU #$7A2B", 022B21 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_flinch_wait stage_7_boss_flinch_land; the scenarios jump to 2 of its 2; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_023A2B)
023A2B  data  stage_7_boss_flinch_actions
# 022B3A "LDU #$7A2F", 022B41 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_put_in stage_7_boss_start_entrance stage_7_boss_move_helpers stage_7_boss_step_forward stage_7_boss_arrive stage_7_boss_entrance_pose stage_7_boss_entrance_end; the scenarios jump to 7 of its 7; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_023A2F)
023A2F  data  stage_7_boss_entrance_actions
# 022CAA "LDU #$7A3D", 022CB1 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_wind_up stage_7_boss_strike stage_7_boss_recover; the scenarios jump to 3 of its 3; without its length the analysis reads 6 before it (its neighbours' entries) (was loaded_table_023A3D)
023A3D  data  stage_7_boss_attack_actions
# 022CFE "LDU #$7A43", 022D05 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_charging stage_7_boss_charge_end; the scenarios jump to 2 of its 2; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_023A43)
023A43  data  stage_7_boss_charge_actions
# 022D79 "LDU #$7A47", 022D80 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_jump_rise stage_7_boss_jump_land stage_7_boss_jump_end; the scenarios jump to 3 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_023A47)
023A47  data  stage_7_boss_jump_away_actions
# 023171 "LDU #$7AF1", 023178 "JMP [A,U]" (index LDA #$02,X): stage_7_boss_helper_idle stage_7_boss_helper_move stage_7_boss_helper_move stage_7_boss_helper_move stage_7_boss_helper_move stage_7_boss_helper_move stage_7_boss_helper_move stage_7_boss_helper_attack; the scenarios jump to 3 of its 8 (was loaded_table_023AF1)
023AF1  data  stage_7_boss_helper_states
# 02317B "LDU #$7B01", 023182 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_helper_start_move stage_7_boss_helper_moving; the scenarios jump to 2 of its 2; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_023B01)
023B01  data  stage_7_boss_helper_move_actions
# 0231CC "LDU #$7B05", 0231D3 "JMP [A,U]" (index LDA #$28,X): stage_7_boss_helper_throw_start stage_7_boss_helper_throw_end; the scenarios jump to 2 of its 2; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_023B05)
023B05  data  stage_7_boss_helper_attack_actions
# 024024 "LDX #$7700", 02402C "JMP [A,X]" (index LDA $18E0): stage_1_end_start stage_1_end_put_police_car stage_1_end_move_police_car stage_1_end_wait stage_1_end_car_sound; the scenarios jump to 5 of its 5 (was loaded_table_025700)
025700  data  stage_1_end_states
# 02414B "LDX #$770A", 024153 "JMP [A,X]" (index LDA $18E0): scene_clear stage_2_end_set_up stage_end_jump_away stage_2_end_show_area_3 stage_2_end_put_players stage_2_end_players_look_around stage_2_end_players_look_around scene_end; the scenarios jump to 6 of its 8; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_02570A)
02570A  data  stage_2_end_states
# 0241E2 "LDX #$771A", 0241EA "JMP [A,X]" (index LDA $18E1): stage_end_put_jumpers stage_end_run_jumpers; the scenarios jump to 2 of its 2; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_02571A)
02571A  data  stage_end_jump_away_steps
# 024258 "LDU #$771E", 024264 "JSR [A,U]" (index LDA #$01,X): stage_end_jumper_wait stage_end_jumper_fly stage_end_jumper_last_leg stage_end_jumper_vanish; the scenarios jump to 4 of its 4; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02571E)
02571E  data  stage_end_jumper_steps
# 024412 "LDX #$7726", 02441A "JMP [A,X]" (index LDA $18E0): scene_clear stage_5_end_set_up stage_end_jump_away stage_5_end_show_players stage_5_end_fade stage_5_end_finish; the scenarios jump to 3 of its 6; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_025726)
025726  data  stage_5_end_states
# 024567 "LDX #$7732", 02456F "JMP [A,X]" (index LDA $18E0): stage_6_end_start stage_6_end_effect stage_6_end_finish; the scenarios jump to 3 of its 3; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_025732)
025732  data  stage_6_end_states
# 0245C7 "LDX #$7738", 0245CF "JMP [A,X]" (index LDA $18E0): stage_6_wake_set_up stage_6_wake_show_players stage_6_wake_start stage_6_wake_wave; the scenarios jump to 4 of its 4; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_025738)
025738  data  stage_6_wake_states
# 02460C "LDX #$7740", 024614 "JMP [A,X]" (index LDA $18E0): post_bonus_2_scene_set_up post_bonus_2_scene_show post_bonus_2_scene_wait post_bonus_2_scene_pan post_bonus_2_scene_finish; the scenarios jump to 4 of its 5; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_025740)
025740  data  post_bonus_2_scene_states
# 02472D "LDX #$774A", 024735 "JSR [A,X]" (index LDA $18E0): stage_7_scene_set_up stage_7_scene_wait_scroll stage_7_scene_wait_signal stage_7_scene_lift; the scenarios jump to 4 of its 4; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_02574A)
02574A  data  stage_7_scene_states
# 024737 "LDX #$7752", 02473F "JMP [A,X]" (index LDA $18E1): stage_7_scene_wait_train stage_7_scene_put_chain stage_7_scene_move_chain stage_7_scene_chain_done; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_025752)
025752  data  stage_7_scene_steps
# 02492F "LDX #$775A", 024937 "JMP [A,X]" (index LDA $18E0): stage_7_end_set_up stage_7_end_show stage_7_end_board stage_7_end_take_off stage_7_end_slow_down stage_7_end_finish; the scenarios jump to 4 of its 6; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02575A)
02575A  data  stage_7_end_states
# 024B35 "LDX #$7766", 024B3D "JMP [A,X]" (index LDA $18E0): stage_8_start_set_up stage_8_start_show stage_8_start_descend stage_8_start_stop stage_8_start_landing stage_8_start_run_off stage_8_start_wait_end; the scenarios jump to 6 of its 7; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_025766)
025766  data  stage_8_start_states
# 024D31 "LDU #$7774", 024D38 "JSR [A,U]" (index LDA #$02,X): stage_8_start_player_ride stage_8_start_player_drop stage_8_start_player_look stage_8_start_player_turn stage_8_start_player_run stage_8_start_player_gone; the scenarios jump to 4 of its 6; without its length the analysis reads 6 before it (its neighbours' entries) (was loaded_table_025774)
025774  data  stage_8_start_run_players_states
# 024DCD "LDX #$7780", 024DD5 "JMP [A,X]" (index LDA $18E0): stage_8_end_set_up stage_8_end_show stage_8_end_hold stage_8_end_switch_view stage_8_end_show_kind_13 stage_8_end_reunion stage_8_end_run_family stage_8_end_finish; the scenarios jump to 8 of its 8; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_025780)
025780  data  stage_8_end_states
# 0251D6 "LDU #$7790", 0251DD "JSR [A,U]" (index LDA #$02,X): stage_8_end_actor_rest stage_8_end_walker stage_8_end_maggie_taker stage_8_end_extra stage_8_end_slow_extra; the scenarios jump to 4 of its 5; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_025790)
025790  data  stage_8_end_run_family_states
# 0251F6 "LDU #$779A", 0251FD "JMP [A,U]" (index LDA #$28,X): stage_8_end_actor_start stage_8_end_walker_go stage_8_end_walker_arrive stage_8_end_actor_done; the scenarios jump to 0 of its 4; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_02579A)
02579A  data  stage_8_end_walker_actions
# 025245 "LDU #$77A2", 02524C "JMP [A,U]" (index LDA #$28,X): stage_8_end_actor_start stage_8_end_extra_go stage_8_end_extra_arrive stage_8_end_actor_done; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_0257A2)
0257A2  data  stage_8_end_extra_actions
# 02527F "LDU #$77AA", 025286 "JMP [A,U]" (index LDA #$28,X): stage_8_end_actor_start stage_8_end_slow_extra_go stage_8_end_extra_arrive stage_8_end_actor_done; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_0257AA)
0257AA  data  stage_8_end_slow_extra_actions
# 025297 "LDU #$77B2", 02529E "JMP [A,U]" (index LDA #$28,X): stage_8_end_taker_wait stage_8_end_take_maggie stage_8_end_holding_maggie stage_8_end_taker_done; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_0257B2)
0257B2  data  stage_8_end_maggie_taker_actions
# 025413 "LDU #$7996", 02541B "JMP [A,U]" (index LDA $18EC): dream_wave_start dream_wave_grow dream_wave_keep; the scenarios jump to 0 of its 3 (was loaded_table_025996)
025996  data  dream_wave_grow_steps
# 02546C "LDU #$799C", 025474 "JMP [A,U]" (index LDA $18EC): dream_wave_start_full dream_wave_hold dream_wave_shrink dream_wave_done; the scenarios jump to 3 of its 4; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_02599C)
02599C  data  dream_wave_fade_out_steps
# 026514 "LDU #$7C64", 02651B "JSR [A,U]" (index LDA #$02,X): krusty_balloon_come_in krusty_balloon_chase krusty_balloon_attack krusty_balloon_volley krusty_balloon_stomping krusty_balloon_wait_for_target; the scenarios jump to 5 of its 6; and to entries before it (a negative index): krusty_balloon_beaten (-3), krusty_balloon_knocked_up (-2), krusty_balloon_flinch (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_027C64)
027C64  data  krusty_balloon_states
# 026532 "LDU #$7C70", 026539 "JSR [A,U]" (index LDA #$28,X): krusty_balloon_deflate krusty_balloon_beaten_wait krusty_balloon_wait_for_players krusty_balloon_fall_and_land; the scenarios jump to 4 of its 4; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_027C70)
027C70  data  krusty_balloon_beaten_actions
# 0265BE "LDU #$7C78", 0265C5 "JMP [A,U]" (index LDA #$28,X): krusty_balloon_fly_up krusty_balloon_knocked_up_stomp; the scenarios jump to 2 of its 2; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_027C78)
027C78  data  krusty_balloon_knocked_up_actions
# 026608 "LDU #$7C7C", 02660F "JMP [A,U]" (index LDA #$28,X): krusty_balloon_appear krusty_balloon_rise krusty_balloon_drift_away krusty_balloon_drift_back krusty_balloon_land krusty_balloon_bounce_up; the scenarios jump to 6 of its 6; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_027C7C)
027C7C  data  krusty_balloon_come_in_actions
# 026751 "LDU #$7C88", 026758 "JMP [A,U]" (index LDA #$28,X): krusty_balloon_attack_start krusty_balloon_attack_hit krusty_balloon_attack_end; the scenarios jump to 3 of its 3; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_027C88)
027C88  data  krusty_balloon_attack_actions
# 0267C0 "LDU #$7C8E", 0267C7 "JMP [A,U]" (index LDA #$28,X): krusty_balloon_volley_take_position krusty_balloon_volley_throw krusty_balloon_volley_pause krusty_balloon_volley_wait krusty_balloon_volley_shrink; the scenarios jump to 0 of its 5; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027C8E)
027C8E  data  krusty_balloon_volley_actions
# 0268B8 "LDU #$7C98", 0268BF "JMP [A,U]" (index LDA #$28,X): krusty_balloon_stomp_land krusty_balloon_stomp_bounce; the scenarios jump to 2 of its 2; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_027C98)
027C98  data  krusty_balloon_stomping_actions
# 026A32 "LDY #$7C9C", 026A38 "JSR [A,Y]": krusty_balloon_throw_right krusty_balloon_throw_spread krusty_balloon_throw_left; the scenarios jump to 0 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_027C9C)
027C9C  data  krusty_balloon_throw_directions
# 026A76 "LDU #$7CA2", 026A7D "JSR [A,U]" (index LDA #$35,X): krusty_balloon_wobble_widen krusty_balloon_wobble_narrow krusty_balloon_wobble_stretch krusty_balloon_wobble_restore; the scenarios jump to 4 of its 4; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027CA2)
027CA2  data  krusty_balloon_wobble_steps
# 026AF7 "LDU #$7CAA", 026AFE "JMP [A,U]" (index LDA #$35,X): krusty_balloon_rebound krusty_balloon_rebound_end; the scenarios jump to 2 of its 2; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_027CAA)
027CAA  data  krusty_balloon_rebound_steps
# 026D86 "LDU #$7D3A", 026D8D "JMP [A,U]" (index LDA #$02,X): krusty_balloon_shot_fly krusty_balloon_shot_drift krusty_balloon_shot_open krusty_balloon_shot_fall; the scenarios jump to 0 of its 4; no length: the bytes right before it (described_027D38) are its entries for negative states, which the analysis reads (was loaded_table_027D3A)
027D3A  data  krusty_balloon_shot_states
# 026E26 "LDX #$7D42", 026E2D "JMP [A,X]" (index LDA <$67): stage_1_title_card stage_2_title_card title_card_none stage_3_title_card title_card_none stage_4_title_card stage_5_title_card title_card_none stage_6_title_card stage_7_title_card title_card_none stage_8_title_card; the scenarios jump to 8 of its 12; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_027D42)
027D42  data  title_cards_by_scene
# 026E45 "LDX #$7D5A", 026E4C "JMP [A,X]" (index LDA <$77): stage_1_title_sound stage_1_title_show title_card_count_frames; the scenarios jump to 3 of its 3; without its length the analysis reads 11 before it (its neighbours' entries) (was loaded_table_027D5A)
027D5A  data  stage_1_title_card_steps
# 026F31 "LDX #$7D60", 026F38 "JMP [A,X]" (index LDA <$77): title_card_ready_screen stage_2_title_show stage_2_title_picture_sound; the scenarios jump to 3 of its 3; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027D60)
027D60  data  stage_2_title_card_steps
# 026F70 "LDX #$7D66", 026F77 "JMP [A,X]" (index LDA <$77): stage_3_title_ready_screen stage_3_title_show stage_3_title_picture_sound; the scenarios jump to 3 of its 3; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027D66)
027D66  data  stage_3_title_card_steps
# 026FCC "LDX #$7D6C", 026FD3 "JMP [A,X]" (index LDA <$77): title_card_ready_screen stage_4_title_show stage_4_title_picture_sound; the scenarios jump to 3 of its 3; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027D6C)
027D6C  data  stage_4_title_card_steps
# 02700B "LDX #$7D72", 027012 "JMP [A,X]" (index LDA <$77): stage_5_title_ready_screen stage_5_title_show title_card_count_frames; the scenarios jump to 3 of its 3; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027D72)
027D72  data  stage_5_title_card_steps
# 02706C "LDX #$7D78", 027073 "JMP [A,X]" (index LDA <$77): stage_6_title_sound stage_6_title_show title_card_count_frames; the scenarios jump to 3 of its 3; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027D78)
027D78  data  stage_6_title_card_steps
# 0270AB "LDX #$7D7E", 0270B2 "JMP [A,X]" (index LDA <$77): stage_7_title_sound stage_7_title_show stage_7_title_second_picture title_card_count_frames; the scenarios jump to 3 of its 4; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027D7E)
027D7E  data  stage_7_title_card_steps
# 027148 "LDX #$7D86", 02714F "JMP [A,X]" (index LDA <$77): stage_8_title_sound stage_8_title_show title_card_count_frames; the scenarios jump to 3 of its 3; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_027D86)
027D86  data  stage_8_title_card_steps
# 02722D "LDX #$7ED1", 027235 "JSR [A,X]" (index LDA $18E0): story_1_set_up_street story_1_street story_1_redraw story_1_rise story_1_pan story_1_end; the scenarios jump to 6 of its 6 (was loaded_table_027ED1)
027ED1  data  story_1_states
# 0273E3 "LDX #$7EDD", 0273EB "JMP [A,X]" (index LDA $18E1): story_1_rise_start story_1_rise_slow_down story_1_rise_coast; the scenarios jump to 3 of its 3; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_027EDD)
027EDD  data  story_1_rise_steps
# 02748A "LDX #$7EE3", 027492 "JMP [A,X]" (index LDA $18E1): story_1_pan_right story_1_pan_wait; the scenarios jump to 2 of its 2; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_027EE3)
027EE3  data  story_1_pan_steps
# 02752A "LDX #$7EE7", 027532 "JMP [A,X]" (index LDA $18E1): story_1_end_start story_1_end_sounds story_1_hide_text story_1_show_text story_1_hide_text story_1_show_text story_1_hide_text story_1_show_text story_1_hide_text story_1_show_text story_1_finish; the scenarios jump to 5 of its 11; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_027EE7)
027EE7  data  story_1_end_steps
# 0275B1 "LDU #$7EFD", 0275B7 "JSR [A,U]" (index LDA ,S): story_1_marge story_1_homer story_1_bart story_1_lisa; the scenarios jump to 4 of its 4; without its length the analysis reads 10 before it (its neighbours' entries) (was loaded_table_027EFD)
027EFD  data  story_1_family_scripts
# 0275C7 "LDU #$7F05", 0275CE "JMP [A,U]" (index LDA #$01,X): story_1_marge_walks_in story_1_character_done; the scenarios jump to 2 of its 2; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_027F05)
027F05  data  story_1_marge_steps
# 0275E5 "LDU #$7F09", 0275EC "JMP [A,U]" (index LDA #$01,X): story_1_homer_walks_in story_1_homer_stops story_1_character_done; the scenarios jump to 3 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_027F09)
027F09  data  story_1_homer_steps
# 027619 "LDU #$7F0F", 027620 "JMP [A,U]" (index LDA #$01,X): story_1_bart_walks_in; the scenarios jump to 1 of its 1; and to entries past the next place the code names: story_1_character_done (entry 1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_027F0F)
027F0F  data  story_1_bart_steps
# 027701 "LDU #$7F27", 027708 "JMP [A,U]" (index LDA #$01,X): story_1_first_goon_appears; the scenarios jump to 1 of its 1; and to entries past the next place the code names: story_1_goon_start_running (entry 1), story_1_goon_run_off (entry 2), story_1_goon_gone (entry 3); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_027F27)
027F27  data  story_1_first_goon_steps
# 0277AE "LDU #$7F3F", 0277B5 "JMP [A,U]" (index LDA #$01,X): story_1_dropped_object_fall; the scenarios jump to 1 of its 1; and to entries past the next place the code names: story_1_dropped_object_gone (entry 1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_027F3F)
027F3F  data  story_1_dropped_object_steps
# 0277FC "LDU #$7FED", 027803 "JMP [A,U]" (index LDA #$02,X): boss_door_set_up boss_door_closed boss_door_open; the scenarios jump to 3 of its 3 (was loaded_table_027FED)
027FED  data  boss_door_states
# 028264 "LDU #$79E8", 02826B "JSR [B,U]" (index LDB #$29,X): goon_descent_float goon_descent_land; the scenarios jump to 2 of its 2; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_0299E8)
0299E8  data  goon_descent_steps
# 0282C7 "LDU #$7A20", 0282CE "JSR [B,U]" (index LDB #$29,X): hat_goon_run_across_pose hat_goon_run_across_wait hat_goon_run_across_run hat_goon_run_across_running; the scenarios jump to 0 of its 4; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_029A20)
029A20  data  hat_goon_run_across_steps
# 028345 "LDU #$7A40", 02834C "JSR [B,U]" (index LDB #$29,X): shovel_goon_rush_in_start shovel_goon_rush_in_swing; the scenarios jump to 2 of its 2; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_029A40)
029A40  data  shovel_goon_rush_in_steps
# 0283C0 "LDU #$7A5C", 0283C7 "JSR [B,U]" (index LDB #$29,X): goon_rush_in_start goon_rush_in_run; the scenarios jump to 2 of its 2; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_029A5C)
029A5C  data  goon_rush_in_steps
# 02842E "LDU #$7A6C", 028435 "JMP [B,U]" (index LDB #$29,X): goon_from_back_place goon_from_back_reach_floor goon_from_back_wait; the scenarios jump to 3 of its 3; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_029A6C)
029A6C  data  goon_from_back_steps
# 028669 "LDU #$7AE2", 028670 "JMP [A,U]" (index LDA #$29,X): goon_delayed_start goon_reach_floor_level goon_entrance_end; the scenarios jump to 3 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_029AE2)
029AE2  data  goon_delayed_steps
# 028686 "LDU #$7AE8", 02868A "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): shovel_goon_step_out_set_up shovel_goon_step_out_step vector_enemy_think vector_enemy_act vector_enemy_react vector_enemy_climb; the scenarios jump to 5 of its 6; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_029AE8)
029AE8  data  shovel_goon_step_out_states
# 0286C2 "LDU #$7AF4", 0286C9 "JMP [A,U]" (index LDA #$29,X): shovel_goon_step_out_show shovel_goon_step_out_walk goon_reach_floor_level shovel_goon_step_out_pause shovel_goon_step_out_arm; the scenarios jump to 5 of its 5; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_029AF4)
029AF4  data  shovel_goon_step_out_steps
# 028716 "LDU #$7AFE", 02871A "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): hat_goon_step_out_set_up goon_step_out_step vector_enemy_think vector_enemy_act vector_enemy_react vector_enemy_climb; the scenarios jump to 6 of its 6; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_029AFE)
029AFE  data  hat_goon_step_out_states
# 028727 "LDU #$7B0A", 02872B "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): goon_step_out_set_up goon_step_out_step vector_enemy_think vector_enemy_act vector_enemy_react vector_enemy_climb; the scenarios jump to 6 of its 6; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_029B0A)
029B0A  data  goon_step_out_states
# 028AF6 "LDU #$7C4E", 028AFA "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_dash_start goon_approach_until_close goon_approach_strike_hit goon_approach_strike_recover goon_strike_recover goon_action_end; the scenarios jump to 6 of its 6 (was loaded_table_029C4E)
029C4E  data  goon_approach_strike_steps
# 028B48 "LDU #$7C5A", 028B4C "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_back_off_start goon_back_off_walk; the scenarios jump to 2 of its 2; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_029C5A)
029C5A  data  goon_back_off_steps
# 028B7A "LDU #$7C5E", 028B7E "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_dash_start goon_dash_until_close goon_dash_strike_hit goon_strike_recover goon_action_end; the scenarios jump to 5 of its 5; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_029C5E)
029C5E  data  goon_dash_strike_steps
# 028BD7 "LDU #$7C68", 028BDB "JSR [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_keep_distance_start goon_keep_distance_check goon_keep_distance_closing goon_keep_distance_backing; the scenarios jump to 4 of its 4; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_029C68)
029C68  data  goon_keep_distance_steps
# 028C61 "LDU #$7C70", 028C65 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_wait_for_target_on_floor goon_wait_then_strike_swing goon_strike_hit goon_strike_recover goon_action_end; the scenarios jump to 5 of its 5; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_029C70)
029C70  data  goon_wait_then_strike_steps
# 028CC8 "LDU #$7C7F", 028CCC "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_wait_for_target_on_floor goon_wait_then_strike_2_swing goon_strike_hit goon_strike_recover goon_action_end; the scenarios jump to 5 of its 5 (was loaded_table_029C7F)
029C7F  data  goon_wait_then_strike_2_steps
# 028CDF "LDU #$7C89", 028CE3 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_quick_strike_swing goon_quick_strike_hit goon_strike_recover goon_action_end; the scenarios jump to 4 of its 4; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_029C89)
029C89  data  goon_quick_strike_steps
# 028D11 "LDU #$7C91", 028D15 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_quick_strike_2_swing goon_quick_strike_2_hit goon_strike_recover goon_action_end; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_029C91)
029C91  data  goon_quick_strike_2_steps
# 028D34 "LDU #$7C99", 028D38 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_jump_or_run goon_jump_attack_leap goon_jump_attack_fall goon_jump_attack_land goon_jump_attack_run_end; the scenarios jump to 4 of its 5; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_029C99)
029C99  data  goon_jump_attack_steps
# 028DEA "LDU #$7CC3", 028DEE "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_jump_or_run goon_jump_up_leap goon_jump_attack_fall goon_jump_attack_land; the scenarios jump to 0 of its 4 (was loaded_table_029CC3)
029CC3  data  goon_jump_up_or_grab_steps
# 028E05 "LDU #$7CCB", 028E09 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_grab_approach goon_grab_try goon_grab_hold goon_grab_squeeze; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_029CCB)
029CCB  data  goon_grab_steps
# 029097 "LDU #$7ECF", 02909B "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): bomb_goon_throw_start bomb_goon_throw_release armed_goon_action_end; the scenarios jump to 3 of its 3 (was loaded_table_029ECF)
029ECF  data  bomb_goon_throw_steps
# 0290CC "LDU #$7EDB", 0290D0 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): shovel_goon_wait_for_target shovel_goon_close_swing shovel_goon_close_hit armed_goon_strike_recover armed_goon_action_end; the scenarios jump to 5 of its 5 (was loaded_table_029EDB)
029EDB  data  shovel_goon_close_strike_steps
# 029120 "LDU #$7EEA", 029124 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): shovel_goon_far_wait shovel_goon_far_swing shovel_goon_far_hit armed_goon_strike_recover armed_goon_action_end; the scenarios jump to 5 of its 5 (was loaded_table_029EEA)
029EEA  data  shovel_goon_far_strike_steps
# 02916E "LDU #$7EF9", 029172 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): shovel_goon_wait_for_target shovel_goon_swing shovel_goon_hit armed_goon_strike_recover armed_goon_action_end; the scenarios jump to 5 of its 5 (was loaded_table_029EF9)
029EF9  data  shovel_goon_strike_steps
# 029196 "LDU #$7F03", 02919A "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): umbrella_goon_quick_swing umbrella_goon_quick_hit armed_goon_strike_recover armed_goon_action_end; the scenarios jump to 4 of its 4; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_029F03)
029F03  data  umbrella_goon_quick_strike_steps
# 0291B9 "LDU #$7F0B", 0291BD "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): umbrella_goon_long_swing umbrella_goon_long_hit umbrella_goon_long_recover umbrella_goon_long_end; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_029F0B)
029F0B  data  umbrella_goon_long_strike_steps
# 0291F8 "LDU #$7F13", 0291FC "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): umbrella_goon_swing umbrella_goon_hit armed_goon_strike_recover armed_goon_action_end; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_029F13)
029F13  data  umbrella_goon_strike_steps
# 02921B "LDU #$7F1B", 02921F "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): umbrella_goon_charge_start umbrella_goon_charge_hit goon_run_through_end; the scenarios jump to 3 of its 3; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_029F1B)
029F1B  data  umbrella_goon_charge_steps
# 029270 "LDU #$7F21", 029274 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): goon_strike_and_run_swing goon_strike_and_run_hit goon_run_through_end; the scenarios jump to 0 of its 3; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_029F21)
029F21  data  goon_strike_and_run_steps
# 029296 "LDU #$7F27", 02929A "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): hat_goon_throw_start hat_goon_throw_release hat_goon_throw_wait hat_goon_throw_end; the scenarios jump to 4 of its 4; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_029F27)
029F27  data  hat_goon_throw_hat_steps
# 02A3C3 "LDU #$787A", 02A3CA "JSR [B,U]" (index LDB #$29,X): fat_goon_walk_in_go fat_goon_walk_in_end; the scenarios jump to 2 of its 2; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_02B87A)
02B87A  data  fat_goon_walk_in_step_handlers
# 02A454 "LDU #$788A", 02A45B "JMP [B,U]" (index LDB #$29,X): fat_goon_from_back_place fat_goon_from_back_walk fat_goon_from_back_wait; the scenarios jump to 3 of its 3; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_02B88A)
02B88A  data  fat_goon_from_back_step_handlers
# 02A4F2 "LDU #$78A4", 02A4F9 "JSR [A,U]" (index LDA #$29,X): fat_goon_thrower_pick_up fat_goon_thrower_carry fat_goon_thrower_throw fat_goon_thrower_end; the scenarios jump to 4 of its 4; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_02B8A4)
02B8A4  data  fat_goon_thrower_step_handlers
# 02A685 "LDU #$78D0", 02A68C "JMP [A,U]" (index LDA #$29,X): fat_goon_delayed_appear fat_goon_reach_ground fat_goon_entrance_end; the scenarios jump to 3 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02B8D0)
02B8D0  data  fat_goon_delayed_step_handlers
# 02A6A2 "LDU #$78D6", 02A6A6 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): fat_goon_descent_start fat_goon_descent_steps vector_enemy_think vector_enemy_act vector_enemy_react vector_enemy_climb; the scenarios jump to 5 of its 6; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_02B8D6)
02B8D6  data  fat_goon_descent_states
# 02A70F "LDU #$78E2", 02A716 "JSR [B,U]" (index LDB #$29,X): fat_goon_descent_fall fat_goon_descent_land; the scenarios jump to 2 of its 2; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_02B8E2)
02B8E2  data  fat_goon_descent_step_handlers
# 02A775 "LDU #$78F6", 02A779 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): descent_balloon_start descent_balloon_wait descent_balloon_release descent_balloon_fly_away; the scenarios jump to 4 of its 4 (was loaded_table_02B8F6)
02B8F6  data  descent_balloon_states
# 02A9FE "LDU #$7979", 02AA02 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): fat_goon_strike_wind_up fat_goon_reach_strike_swing fat_goon_reach_strike_hit fat_goon_strike_recover fat_goon_strike_end; the scenarios jump to 5 of its 5 (was loaded_table_02B979)
02B979  data  fat_goon_reach_strike_steps
# 02AA26 "LDU #$7983", 02AA2A "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): fat_goon_action_wait; the scenarios jump to 0 of its 1; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_02B983)
02B983  data  fat_goon_idle_action_steps
# 02AA2D "LDU #$7985", 02AA31 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): fat_goon_heavy_strike_swing fat_goon_heavy_strike_hit fat_goon_strike_recover fat_goon_strike_end; the scenarios jump to 4 of its 4 (was loaded_table_02B985)
02B985  data  fat_goon_heavy_strike_steps
# 02AA56 "LDU #$798D", 02AA5A "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): fat_goon_grab_approach fat_goon_grab fat_goon_squeeze fat_goon_squeeze_again; the scenarios jump to 3 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02B98D)
02B98D  data  fat_goon_grab_steps
# 02AE3E "LDU #$7D6C", 02AE42 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): moe_spawner_start moe_spawner_put_in_object moe_spawner_wait; the scenarios jump to 3 of its 3 (was loaded_table_02BD6C)
02BD6C  data  moe_spawner_states
# 02AE6D "LDU #$7D80", 02AE71 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): burger_eater_start burger_eater_wait burger_eater_drop_food burger_eater_done; the scenarios jump to 2 of its 4 (was loaded_table_02BD80)
02BD80  data  burger_eater_states
# 02AE9C "LDU #$7D96", 02AEA0 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): drink_vendor_start drink_vendor_wait_hit drink_vendor_let_out drink_vendor_wait_child drink_vendor_rest drink_vendor_done; the scenarios jump to 4 of its 6 (was loaded_table_02BD96)
02BD96  data  drink_vendor_states
# 02AF2D "LDU #$7DB0", 02AF31 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): krustyland_door_start krustyland_door_wait_camera krustyland_door_open krustyland_door_opened krustyland_door_close krustyland_door_closed; the scenarios jump to 6 of its 6 (was loaded_table_02BDB0)
02BDB0  data  krustyland_door_states
# 02AFEF "LDU #$7DFD", 02AFF3 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): caged_gorilla_leaper_start caged_gorilla_leaper_jump caged_gorilla_leaper_fall caged_gorilla_leaper_crash caged_gorilla_leaper_wait caged_gorilla_leaper_vanish caged_gorilla_leaper_idle; the scenarios jump to 6 of its 7 (was loaded_table_02BDFD)
02BDFD  data  caged_gorilla_leaper_states
# 02B0A9 "LDU #$7E19", 02B0AD "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): prop_start prop_leave; the scenarios jump to 2 of its 2 (was loaded_table_02BE19)
02BE19  data  prop_states
# 02B0E5 "LDU #$7E53", 02B0E9 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): poster_start poster_idle; the scenarios jump to 2 of its 2 (was loaded_table_02BE53)
02BE53  data  poster_states
# 02B0FF "LDU #$7E5D", 02B103 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): poster_pair_start poster_pair_leave; the scenarios jump to 2 of its 2 (was loaded_table_02BE5D)
02BE5D  data  poster_pair_states
# 02B13D "LDU #$7E6F", 02B141 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): bleeding_gums_murphy_start bleeding_gums_murphy_wait_hit bleeding_gums_murphy_hit_end bleeding_gums_murphy_rest bleeding_gums_murphy_done; the scenarios jump to 2 of its 5 (was loaded_table_02BE6F)
02BE6F  data  bleeding_gums_murphy_states
# 02B19E "LDU #$7E7F", 02B1A2 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): dream_ball_fling_start dream_ball_fling_shrink; the scenarios jump to 2 of its 2 (was loaded_table_02BE7F)
02BE7F  data  dream_ball_fling_states
# 02B1FC "LDU #$7EA1", 02B200 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): cemetery_piece_start cemetery_piece_bob; the scenarios jump to 2 of its 2 (was loaded_table_02BEA1)
02BEA1  data  cemetery_piece_states
# 02B241 "LDU #$7EDF", 02B245 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): floor_blocker_start floor_blocker_steps floor_blocker_wait; the scenarios jump to 0 of its 3 (was loaded_table_02BEDF)
02BEDF  data  floor_blocker_states
# 02B283 "LDU #$7EEB", 02B28A "JMP [B,U]" (index LDB #$37,X): floor_blocker_first_part floor_blocker_second_part floor_blocker_last_part floor_blocker_part_wait; the scenarios jump to 0 of its 4 (was loaded_table_02BEEB)
02BEEB  data  floor_blocker_parts
# 02B415 "LDU #$7F51", 02B419 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): police_car_start police_car_drive_in police_car_stopped police_car_wait police_car_leave police_car_driving_off; the scenarios jump to 6 of its 6; no length: the bytes right before it (described_02BF4D) are its entries for negative states, which the analysis reads (was loaded_table_02BF51)
02BF51  data  police_car_states
# 02B41E "LDU #$7F5D", 02B425 "JMP [B,U]" (index LDB #$29,X): police_car_hit police_car_drive_off police_car_hit_wait; the scenarios jump to 0 of its 3; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_02BF5D)
02BF5D  data  police_car_hit_step_handlers
# 02C060 "LDU #$7B44", 02C064 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): cemetery_obstacle_start cemetery_obstacle_raise_floor cemetery_obstacle_wait_boss cemetery_obstacle_idle; the scenarios jump to 4 of its 4; and to entries before it (a negative index): cemetery_obstacle_broken_steps (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DB44)
02DB44  data  cemetery_obstacle_states
# 02C06F "LDU #$7B4C", 02C076 "JMP [B,U]" (index LDB #$29,X): cemetery_obstacle_break cemetery_obstacle_vanish cemetery_obstacle_food_fall; the scenarios jump to 2 of its 3; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02DB4C)
02DB4C  data  cemetery_obstacle_broken_step_handlers
# 02C132 "LDU #$7BB2", 02C139 "JSR [B,U]" (index LDB #$02,X): heavy_obstacle_start heavy_obstacle_idle heavy_obstacle_hit_steps heavy_obstacle_hit_steps; the scenarios jump to 0 of its 4; no length: the bytes right before it (described_02DBAE) are its entries for negative states, which the analysis reads (was loaded_table_02DBB2)
02DBB2  data  heavy_obstacle_states
# 02C191 "LDU #$7BBA", 02C195 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): throwable_start timed_throwable_wait timed_throwable_idle throwable_pick_up timed_throwable_throw throwable_hurt_enemies throwable_rebound timed_throwable_fall timed_throwable_smash_end; the scenarios jump to 4 of its 9; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02DBBA)
02DBBA  data  timed_throwable_states
# 02C1AC "LDU #$7BCC", 02C1B3 "JMP [A,U]" (index LDA #$28,X): obstacle_smash obstacle_smash_end; the scenarios jump to 0 of its 2; without its length the analysis reads 8 before it (its neighbours' entries) (was loaded_table_02DBCC)
02DBCC  data  heavy_obstacle_hit_actions
# 02C239 "LDU #$7BD0", 02C23D "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): moes_street_scenery_riser_start moes_street_scenery_riser_wait_boss moes_street_scenery_riser_rise_slowly moes_street_scenery_riser_rise_faster moes_street_scenery_riser_stop moes_street_scenery_riser_idle; the scenarios jump to 6 of its 6; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02DBD0)
02DBD0  data  moes_street_scenery_riser_states
# 02C2D9 "LDU #$7BE2", 02C2DD "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): moes_street_scenery_dropper_start moes_street_scenery_dropper_wait moes_street_scenery_dropper_come_down moes_street_scenery_dropper_land moes_street_scenery_dropper_idle; the scenarios jump to 5 of its 5 (was loaded_table_02DBE2)
02DBE2  data  moes_street_scenery_dropper_states
# 02C3F6 "LDU #$7C1E", 02C3FA "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): police_car_door_start police_car_door_wait_car police_car_door_open police_car_door_vanish police_car_door_idle; the scenarios jump to 5 of its 5 (was loaded_table_02DC1E)
02DC1E  data  police_car_door_states
# 02C48A "LDU #$7C71", 02C48E "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): carried_obstacle_start carried_obstacle_held carried_obstacle_thrown carried_obstacle_fly carried_obstacle_bounce carried_obstacle_land carried_obstacle_slide carried_obstacle_break_steps carried_obstacle_drop_steps; the scenarios jump to 9 of its 9; no length: the bytes right before it (described_02DC6D) are its entries for negative states, which the analysis reads (was loaded_table_02DC71)
02DC71  data  carried_obstacle_states
# 02C4C7 "LDU #$7C83", 02C4CB "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): carried_obstacle_start tossed_obstacle_held tossed_obstacle_toss carried_obstacle_fly carried_obstacle_bounce carried_obstacle_land carried_obstacle_slide; the scenarios jump to 7 of its 7; and to entries before it (a negative index): carried_obstacle_drop_steps (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DC83)
02DC83  data  tossed_obstacle_states
# 02C585 "LDU #$7C97", 02C58C "JMP [A,U]" (index LDA #$28,X): obstacle_break obstacle_break_end; the scenarios jump to 2 of its 2 (was loaded_table_02DC97)
02DC97  data  carried_obstacle_break_actions
# 02C5A7 "LDU #$7C9B", 02C5AE "JMP [A,U]" (index LDA #$28,X): obstacle_fall_and_break obstacle_break obstacle_break_end throwable_stop_steps throwable_stop_steps; the scenarios jump to 3 of its 5; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02DC9B)
02DC9B  data  carried_obstacle_drop_actions
# 02C666 "LDU #$7CA5", 02C66D "JSR [B,U]" (index LDB #$02,X): throwable_start throwable_lie throwable_lie throwable_pick_up throwable_throw throwable_hurt_enemies throwable_rebound throwable_fall; the scenarios jump to 7 of its 8; and to entries before it (a negative index): throwable_stop_steps (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DCA5)
02DCA5  data  throwable_states
# 02C69B "LDU #$7CB5", 02C6A2 "JMP [A,U]" (index LDA #$28,X): throwable_stop throwable_stop_end; the scenarios jump to 2 of its 2; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_02DCB5)
02DCB5  data  throwable_stop_actions
# 02C76C "LDU #$7CD1", 02C773 "JMP [B,U]" (index LDB #$37,X): platform_scenery_second_part platform_scenery_third_part platform_scenery_fourth_part platform_scenery_last_part platform_scenery_part_wait; the scenarios jump to 5 of its 5; and to entries before it (a negative index): platform_scenery_first_part (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DCD1)
02DCD1  data  platform_scenery_parts
# 02C8B1 "LDU #$7D1D", 02C8B8 "JMP [A,U]" (index LDA #$28,X): platform_scenery_idle platform_scenery_settle platform_scenery_press; the scenarios jump to 1 of its 3 (was loaded_table_02DD1D)
02DD1D  data  platform_scenery_react_actions
# 02C94C "LDU #$7D2F", 02C950 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): scenery_debris_start scenery_debris_bounce scenery_debris_land scenery_debris_idle; the scenarios jump to 0 of its 4 (was loaded_table_02DD2F)
02DD2F  data  scenery_debris_states
# 02C9B0 "LDU #$7D45", 02C9B7 "JMP [B,U]" (index LDB #$37,X): charging_scenery_first_part charging_scenery_second_part charging_scenery_last_part charging_scenery_part_wait; the scenarios jump to 4 of its 4; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02DD45)
02DD45  data  charging_scenery_parts
# 02CAC5 "LDU #$7D9F", 02CACC "JSR [B,U]" (index LDB #$02,X): obstacle_start obstacle_settle obstacle_lie obstacle_pick_up obstacle_throw obstacle_fly obstacle_rebound obstacle_rebound_rise obstacle_rebound_fall; the scenarios jump to 6 of its 9; and to entries before it (a negative index): obstacle_smashed_steps (-2), obstacle_knocked_steps (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DD9F)
02DD9F  data  obstacle_states
# 02CBCD "LDU #$7DD3", 02CBD4 "JMP [A,U]" (index LDA #$29,X): obstacle_smashed obstacle_smashed_end; the scenarios jump to 2 of its 2 (was loaded_table_02DDD3)
02DDD3  data  obstacle_smashed_step_handlers
# 02CC00 "LDU #$7DD7", 02CC07 "JSR [A,U]" (index LDA #$28,X): obstacle_knocked obstacle_knocked_fall; the scenarios jump to 2 of its 2; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02DDD7)
02DDD7  data  obstacle_knocked_actions
# 02CE2F "LDU #$7DDB", 02CE33 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): solid_scenery_start solid_scenery_idle; the scenarios jump to 2 of its 2; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02DDDB)
02DDDB  data  solid_scenery_states
# 02CE66 "LDU #$7DE5", 02CE6A "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): boulder_start boulder_wait boulder_fall boulder_bounce boulder_fall_in_front; the scenarios jump to 4 of its 5 (was loaded_table_02DDE5)
02DDE5  data  boulder_states
# 02D03A "LDU #$7E05", 02D03E "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): gorge_rock_start gorge_rock_wait_hit gorge_rock_break_end; the scenarios jump to 3 of its 3 (was loaded_table_02DE05)
02DE05  data  gorge_rock_states
# 02D092 "LDU #$7E11", 02D096 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): shaken_bit_start shaken_bit_fall; the scenarios jump to 2 of its 2 (was loaded_table_02DE11)
02DE11  data  shaken_bit_states
# 02D0DC "LDU #$7E1B", 02D0E0 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): shaken_object_start shaken_object_wait shaken_object_fall shaken_object_land; the scenarios jump to 4 of its 4 (was loaded_table_02DE1B)
02DE1B  data  shaken_object_states
# 02D14C "LDU #$7E35", 02D150 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): shaking_scenery_start shaking_scenery_idle; the scenarios jump to 2 of its 2; and to entries before it (a negative index): shaking_scenery_hit_from_above_steps (-3), shaking_scenery_shake_steps (-2), shaking_scenery_hit_steps (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DE35)
02DE35  data  shaking_scenery_states
# 02D26C "LDU #$7EB3", 02D273 "JMP [B,U]" (index LDB #$29,X): shaking_scenery_shake shaking_scenery_shake_second shaking_scenery_shake_third shaking_scenery_shake_fourth shaking_scenery_shake_end; the scenarios jump to 5 of its 5 (was loaded_table_02DEB3)
02DEB3  data  shaking_scenery_shake_step_handlers
# 02D2DA "LDU #$7EBD", 02D2E1 "JMP [A,U]" (index LDA #$28,X): shaking_scenery_drop_bit shaking_scenery_recover; the scenarios jump to 2 of its 2; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_02DEBD)
02DEBD  data  shaking_scenery_hit_from_above_actions
# 02D305 "LDU #$7ED1", 02D30C "JMP [A,U]" (index LDA #$28,X): shaking_scenery_drop_food shaking_scenery_recover; the scenarios jump to 2 of its 2 (was loaded_table_02DED1)
02DED1  data  shaking_scenery_hit_actions
# 02D371 "LDU #$7EE1", 02D375 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): running_animal_start running_animal_run running_animal_stop running_animal_picked_up running_animal_thrown running_animal_hurt_enemies running_animal_land running_animal_idle; the scenarios jump to 7 of its 8; and to entries before it (a negative index): running_animal_hit_steps (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DEE1)
02DEE1  data  running_animal_states
# 02D385 "LDU #$7EF1", 02D38C "JMP [A,U]" (index LDA #$29,X): running_animal_knocked running_animal_knocked_away running_animal_knocked_back running_animal_gone; the scenarios jump to 4 of its 4; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_02DEF1)
02DEF1  data  running_animal_hit_step_handlers
# 02D550 "LDU #$7F15", 02D554 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): bouncing_throwable_start bouncing_throwable_lie bouncing_throwable_lie bouncing_throwable_pick_up bouncing_throwable_throw bouncing_throwable_fly throwable_rebound throwable_fall; the scenarios jump to 5 of its 8; no length: the bytes right before it (described_02DF11) are its entries for negative states, which the analysis reads (was loaded_table_02DF15)
02DF15  data  bouncing_throwable_states
# 02D5C5 "LDU #$7F2F", 02D5C9 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): dreamland_obstacle_start dreamland_obstacle_drop_steps dreamland_obstacle_idle dreamland_obstacle_pick_up obstacle_throw obstacle_fly obstacle_rebound obstacle_rebound_rise obstacle_rebound_fall; the scenarios jump to 6 of its 9; and to entries before it (a negative index): obstacle_knocked_steps (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DF2F)
02DF2F  data  dreamland_obstacle_states
# 02D61A "LDU #$7F67", 02D621 "JMP [B,U]" (index LDB #$29,X): dreamland_obstacle_throw_in dreamland_obstacle_land dreamland_obstacle_settle; the scenarios jump to 3 of its 3 (was loaded_table_02DF67)
02DF67  data  dreamland_obstacle_drop_step_handlers
# 02D7A7 "LDU #$7FAB", 02D7AB "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): woman_in_apron_device_start woman_in_apron_device_wait_hit woman_in_apron_device_idle woman_in_apron_device_strike woman_in_apron_device_strike_end woman_in_apron_device_reset woman_in_apron_device_reset_end woman_in_apron_device_rest; the scenarios jump to 2 of its 8 (was loaded_table_02DFAB)
02DFAB  data  woman_in_apron_device_states
# 02D837 "LDU #$7FC1", 02D83B "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): woman_in_apron_start woman_in_apron_stop woman_in_apron_wander woman_in_apron_run_to_device woman_in_apron_reach_device woman_in_apron_behind_device; the scenarios jump to 3 of its 6; no length: the bytes right after it (described_02DFCD, code addresses no other table loads) are more of its entries, which the analysis reads (was loaded_table_02DFC1)
02DFC1  data  woman_in_apron_states
# 02D9BA "LDU #$7FE5", 02D9BE "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): rabbit_start rabbit_stand; the scenarios jump to 2 of its 2; and to entries before it (a negative index): rabbit_wait (-3), rabbit_beaten (-2); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_02DFE5)
02DFE5  data  rabbit_states
# 02D9DF "LDU #$7FE9", 02D9E6 "JMP [A,U]" (index LDA #$29,X): rabbit_hit rabbit_hit_end; the scenarios jump to 0 of its 2; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02DFE9)
02DFE9  data  rabbit_hit_step_handlers
# 02E075 "LDU #$7A08", 02E079 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): looping_scenery_start looping_scenery_wrap; the scenarios jump to 2 of its 2 (was loaded_table_02FA08)
02FA08  data  looping_scenery_states
# 02E0B3 "LDU #$7A3A", 02E0B7 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): looping_scenery_start looping_scenery_wrap_until_camera looping_scenery_leave; the scenarios jump to 3 of its 3 (was loaded_table_02FA3A)
02FA3A  data  looping_scenery_leaving_states
# 02E1F1 "LDU #$7A68", 02E1F5 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): item_start item_lie item_lie item_taken; the scenarios jump to 3 of its 4 (was loaded_table_02FA68)
02FA68  data  item_states
# 02E20E "LDU #$7A88", 02E212 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): food_jump_out_start food_jump_out_bounce food_eaten food_eaten_shrink food_eaten_vanish food_jump_out_expire food_jump_out_vanish; the scenarios jump to 7 of its 7 (was loaded_table_02FA88)
02FA88  data  food_jump_out_states
# 02E2D4 "LDU #$7AC4", 02E2D8 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): food_start food_lie food_eaten food_eaten_shrink food_eaten_vanish; the scenarios jump to 5 of its 5 (was loaded_table_02FAC4)
02FAC4  data  food_states
# 02E361 "LDU #$7AE4", 02E365 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): dropped_food_start food_eaten food_eaten_shrink food_eaten_vanish; the scenarios jump to 4 of its 4 (was loaded_table_02FAE4)
02FAE4  data  dropped_food_states
# 02E389 "LDU #$7AEC", 02E38D "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): girl_with_food_start girl_with_food_walk_in girl_with_food_drop_food girl_with_food_after_drop girl_with_food_walking girl_with_food_turn girl_with_food_wait; the scenarios jump to 7 of its 7; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02FAEC)
02FAEC  data  girl_with_food_states
# 02E49C "LDU #$7B50", 02E4A0 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): sideshow_bob_start sideshow_bob_walk_in sideshow_bob_drop_food sideshow_bob_leave sideshow_bob_walking sideshow_bob_pause sideshow_bob_pause_end; the scenarios jump to 7 of its 7 (was loaded_table_02FB50)
02FB50  data  sideshow_bob_states
# 02E52A "LDU #$7B6C", 02E52E "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): item_carrier_start item_carrier_walk_in item_carrier_put_down item_carrier_leave item_carrier_walking item_carrier_pause item_carrier_pause_end; the scenarios jump to 7 of its 7 (was loaded_table_02FB6C)
02FB6C  data  item_carrier_states
# 02E5CD "LDU #$7BB0", 02E5D1 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): carried_item_start carried_item_pop food_eaten_shrink food_eaten_vanish; the scenarios jump to 4 of its 4 (was loaded_table_02FBB0)
02FBB0  data  carried_item_states
# 02E784 "LDU #$7C6D", 02E788 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): fireman_goon_throw_wind_up fireman_goon_throw fireman_goon_throw_end; the scenarios jump to 3 of its 3; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02FC6D)
02FC6D  data  fireman_goon_throw_steps
# 02E7DE "LDU #$7C79", 02E7E2 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): fireman_goon_missile_start fireman_goon_missile_fly fireman_goon_missile_spent fireman_goon_missile_end; the scenarios jump to 4 of its 4 (was loaded_table_02FC79)
02FC79  data  fireman_goon_missile_states
# 02E82B "LDU #$7C8F", 02E82F "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): kent_brockman_start kent_brockman_wait_hit kent_brockman_hit_end kent_brockman_rest kent_brockman_broken; the scenarios jump to 5 of its 5 (was loaded_table_02FC8F)
02FC8F  data  kent_brockman_states
# 02E8A0 "LDU #$7D96", 02E8A4 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): teacup_goon_ride_start teacup_goon_ride_put_in_arms teacup_goon_ride_wait_signal teacup_goon_ride_wait teacup_goon_ride_wait_enemies teacup_goon_ride_end; the scenarios jump to 6 of its 6 (was loaded_table_02FD96)
02FD96  data  teacup_goon_ride_states
# 02E97D "LDU #$7DB5", 02E981 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): teacup_goon_ride_arm_start teacup_goon_ride_arm_wait_start teacup_goon_ride_arm_turn teacup_goon_ride_arm_turn_for_time teacup_goon_ride_arm_turn_until_empty; the scenarios jump to 5 of its 5 (was loaded_table_02FDB5)
02FDB5  data  teacup_goon_ride_arm_states
# 02EA89 "LDU #$7DCD", 02EA8D "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): teacup_goon_piece_start teacup_goon_piece_fall teacup_goon_piece_blink; the scenarios jump to 3 of its 3 (was loaded_table_02FDCD)
02FDCD  data  teacup_goon_piece_states
# 02EF44 "LDU #$7E2D", 02EF4B "JMP [A,U]" (index LDA #$29,X): one_eared_rabbit_entrance_show one_eared_rabbit_entrance_next one_eared_rabbit_entrance_wait one_eared_rabbit_entrance_walk one_eared_rabbit_entrance_reach_floor; the scenarios jump to 5 of its 5 (was loaded_table_02FE2D)
02FE2D  data  one_eared_rabbit_entrance_step_handlers
# 02EF9F "LDU #$7E37", 02EFA3 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): one_eared_rabbit_step_back one_eared_rabbit_step_back_end; the scenarios jump to 2 of its 2; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_02FE37)
02FE37  data  one_eared_rabbit_step_back_steps
# 02EFCF "LDU #$7E3B", 02EFD3 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): one_eared_rabbit_strike_swing one_eared_rabbit_strike_hit one_eared_rabbit_strike_recover one_eared_rabbit_strike_end; the scenarios jump to 4 of its 4; without its length the analysis reads 1 before it and 2 past it (its neighbours' entries) (was loaded_table_02FE3B)
02FE3B  data  one_eared_rabbit_strike_steps
# 02F003 "LDU #$7E47", 02F007 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): clown_ball_start clown_ball_fall clown_ball_fall clown_ball_vanish; the scenarios jump to 3 of its 4; no length: the two words before it are its states -2 and -1 (FE, FF: the burst, clown_ball_burst_steps), which the analysis reads (was loaded_table_02FE47)
02FE47  data  clown_ball_states
# 02F00F "LDU #$7E4F", 02F016 "JMP [A,U]" (index LDA #$28,X): clown_ball_burst clown_ball_burst_end; the scenarios jump to 0 of its 2; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02FE4F)
02FE4F  data  clown_ball_burst_actions
# 02F0EA "LDU #$7E73", 02F0EE "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): clown_on_ball_strike_swing clown_on_ball_strike; the scenarios jump to 0 of its 2 (was loaded_table_02FE73)
02FE73  data  clown_on_ball_strike_steps
# 02F10B "LDU #$7E77", 02F10F "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): clown_on_ball_jump clown_on_ball_jump_fall; the scenarios jump to 0 of its 2; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02FE77)
02FE77  data  clown_on_ball_jump_steps
# 02F158 "LDU #$7E7B", 02F15C "JSR [B,U]" (index B: its step, field 29, as enemy_attack passes it): clown_on_ball_charge_wind_up clown_on_ball_charge clown_on_ball_charge_turn clown_on_ball_charge_end; the scenarios jump to 0 of its 4; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_02FE7B)
02FE7B  data  clown_on_ball_charge_steps
# 02F1D8 "LDU #$7E83", 02F1DC "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): clown_on_ball_pause clown_on_ball_pause_end; the scenarios jump to 2 of its 2; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_02FE83)
02FE83  data  clown_on_ball_pause_steps
# 02F20B "LDU #$7E8B", 02F20F "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): clown_on_ball_hop_away clown_on_ball_hop; the scenarios jump to 2 of its 2 (was loaded_table_02FE8B)
02FE8B  data  clown_on_ball_hop_steps
# 02F2AA "LDU #$7F17", 02F2AE "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): krustyland_bear_start krustyland_bear_wait_camera krustyland_bear_wake krustyland_bear_start_off krustyland_bear_ride krustyland_bear_idle; the scenarios jump to 6 of its 6 (was loaded_table_02FF17)
02FF17  data  krustyland_bear_states
# 02F335 "LDU #$7F29", 02F339 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): caged_gorilla_start caged_gorilla_idle caged_gorilla_hit caged_gorilla_hit_wait caged_gorilla_recover caged_gorilla_recover_end; the scenarios jump to 6 of its 6 (was loaded_table_02FF29)
02FF29  data  caged_gorilla_states
# 02F3E4 "LDU #$7F3D", 02F3E8 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): buzzing_chaser_start buzzing_chaser_rise buzzing_chaser_spiral_end buzzing_chaser_chase buzzing_chaser_fly_off buzzing_chaser_idle; the scenarios jump to 6 of its 6 (was loaded_table_02FF3D)
02FF3D  data  buzzing_chaser_states
# 02F4E9 "LDU #$7F4F", 02F4ED "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): bluebird_start bluebird_enter bluebird_land bluebird_sit bluebird_sit_for_time bluebird_jump bluebird_run_off bluebird_speed_up bluebird_wait_launch bluebird_launch_fly bluebird_sit_on_scenery; the scenarios jump to 8 of its 11 (was loaded_table_02FF4F)
02FF4F  data  bluebird_states
# 02F753 "LDU #$7FA3", 02F757 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): random_pose_figure_start random_pose_figure_pose; the scenarios jump to 2 of its 2 (was loaded_table_02FFA3)
02FFA3  data  random_pose_figure_states
# 02F79F "LDU #$7FC9", 02F7A3 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): unused_homer_object_start unused_homer_object_wait_near unused_homer_object_wait_hit unused_homer_object_release unused_homer_object_rest unused_homer_object_hold; the scenarios jump to 0 of its 6; no length: the bytes right before it (described_02FFC5) are its entries for negative states, which the analysis reads (was loaded_table_02FFC9)
02FFC9  data  unused_homer_object_states
# 030241 "LDU #$79F8", 030245 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): zombie_burrow_start zombie_burrow_move zombie_burrow_surface zombie_burrow_end; the scenarios jump to 4 of its 4; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_0319F8)
0319F8  data  zombie_burrow_steps
# 0302C8 "LDU #$7A00", 0302CC "JMP [B,U]" (index LDB #$C0): zombie_leap_start zombie_leap_take_off zombie_leap_rise zombie_leap_fall zombie_leap_turn zombie_leap_end; the scenarios jump to 6 of its 6; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_031A00)
031A00  data  zombie_leap_steps
# 030373 "LDU #$7A0C", 030377 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): zombie_swipe_start zombie_swipe_hit zombie_swipe_recover zombie_swipe_step_back zombie_swipe_end ghost_on_rope_fall ghost_on_rope_hurt; the scenarios jump to 5 of its 7; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_031A0C)
031A0C  data  zombie_swipe_steps
# 0303E9 "LDU #$7A26", 0303F0 "JMP [A,U]" (index LDA #$29,X): ghost_on_rope_hurt_start ghost_on_rope_hurt_flash; the scenarios jump to 2 of its 2; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_031A26)
031A26  data  ghost_on_rope_hurt_steps
# 03055F "LDU #$7A38", 030563 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): rising_zombie_setup rising_zombie_wait rising_zombie_climb_out rising_zombie_aim rising_zombie_stand rising_zombie_rise_up rising_zombie_set_off rising_zombie_drift rising_zombie_count_down rising_zombie_slow_down rising_zombie_wait rising_zombie_climb_out rising_zombie_climb_out_again rising_zombie_stand_again rising_zombie_walk_off; the scenarios jump to 0 of its 15 (was loaded_table_031A38)
031A38  data  rising_zombie_states
# 0308EA "LDU #$7BFE", 0308EE "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): lumberjack_axe_start lumberjack_axe_swing lumberjack_axe_recover enemy_end_action_with_animation lumberjack_axe_rest lumberjack_axe_pause lumberjack_axe_wait; the scenarios jump to 7 of its 7; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_031BFE)
031BFE  data  lumberjack_axe_steps
# 030AB2 "LDU #$7C4F", 030AB6 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): gorilla_punch_start gorilla_punch_hit gorilla_punch_end enemy_end_action_with_animation; the scenarios jump to 4 of its 4 (was loaded_table_031C4F)
031C4F  data  gorilla_punch_steps
# 030AE7 "LDU #$7C57", 030AEB "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): gorilla_leap_take_off gorilla_leap_rise gorilla_leap_fall; the scenarios jump to 0 of its 3; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_031C57)
031C57  data  gorilla_leap_steps
# 030B52 "LDU #$7C6B", 030B56 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): gorilla_back_off_start gorilla_back_off_end; the scenarios jump to 2 of its 2 (was loaded_table_031C6B)
031C6B  data  gorilla_back_off_steps
# 030DFF "LDU #$7D71", 030E03 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): knight_strike_start knight_strike_hit knight_strike_end; the scenarios jump to 3 of its 3 (was loaded_table_031D71)
031D71  data  knight_strike_steps
# 030E33 "LDU #$7D87", 030E37 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): lightning_bolt_setup lightning_bolt_end; the scenarios jump to 2 of its 2 (was loaded_table_031D87)
031D87  data  lightning_bolt_states
# 0311DC "LDU #$7EEC", 0311E0 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): spark_shot_setup spark_shot_fly; the scenarios jump to 0 of its 2; no length: the bytes right before it (described_031EE8) are its entries for negative states, which the analysis reads (was loaded_table_031EEC)
031EEC  data  spark_shot_states
# 0311F5 "LDU #$7EF0", 0311FC "JMP [A,U]" (index LDA #$29,X): spark_shot_burst_start spark_shot_remove; the scenarios jump to 0 of its 2; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_031EF0)
031EF0  data  spark_shot_burst_steps
# 0312EF "LDU #$7F1C", 0312F3 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): walking_kind_87_setup walking_kind_87_wait walking_kind_87_step_out walking_kind_87_stop walking_kind_87_walk_off walking_kind_87_run_off walking_kind_87_running; the scenarios jump to 7 of its 7 (was loaded_table_031F1C)
031F1C  data  walking_kind_87_states
# 031383 "LDU #$7F30", 031387 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): moe_setup moe_stop moe_wait_pose moe_wait_for_scroll moe_show_parent moe_walk_right moe_wander moe_pace moe_leave moe_remove_at_edge; the scenarios jump to 10 of its 10 (was loaded_table_031F30)
031F30  data  moe_states
# 0314D9 "LDU #$7F4A", 0314DD "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): belly_dancer_watcher_setup belly_dancer_watcher_stand belly_dancer_watcher_wait_signal belly_dancer_watcher_wait_hit; the scenarios jump to 4 of its 4 (was loaded_table_031F4A)
031F4A  data  belly_dancer_watcher_states
# 032060 "LDU #$78B8", 032064 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): bouncing_prop_setup bouncing_prop_follow bouncing_prop_follow bouncing_prop_stop bouncing_prop_bounce_start bouncing_prop_bounce bouncing_prop_knocked; the scenarios jump to 6 of its 7; and to entries before it (a negative index): bouncing_prop_leave (-2), bouncing_prop_fall_in (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_0338B8)
0338B8  data  bouncing_prop_states
# 03207C "LDU #$78C6", 032083 "JMP [B,U]" (index LDB #$29,X): bouncing_prop_leave_start bouncing_prop_fly_away bouncing_prop_shrink_away bouncing_prop_rise_out; the scenarios jump to 3 of its 4; without its length the analysis reads 6 before it (its neighbours' entries) (was loaded_table_0338C6)
0338C6  data  bouncing_prop_leave_steps
# 032203 "LDU #$78D4", 03220A "JMP [B,U]" (index LDB #$29,X): bouncing_prop_bounce_off_edge bouncing_prop_land; the scenarios jump to 2 of its 2 (was loaded_table_0338D4)
0338D4  data  bouncing_prop_bounce_steps
# 0325D6 "LDU #$7A85", 0325DA "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): ninja_hop_strike_start ninja_hop_strike_hit ninja_attack_recover ninja_attack_end; the scenarios jump to 4 of its 4 (was loaded_table_033A85)
033A85  data  ninja_hop_strike_steps
# 032608 "LDU #$7A8D", 03260C "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): ninja_throw_start ninja_throw_release ninja_attack_end; the scenarios jump to 3 of its 3; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_033A8D)
033A8D  data  ninja_throw_steps
# 03262A "LDU #$7A99", 03262E "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): ninja_star_setup ninja_star_fly; the scenarios jump to 2 of its 2 (was loaded_table_033A99)
033A99  data  ninja_star_states
# 032678 "LDU #$7AA3", 03267C "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): ninja_slash_start ninja_slash_hit ninja_attack_recover ninja_attack_end; the scenarios jump to 4 of its 4 (was loaded_table_033AA3)
033AA3  data  ninja_slash_steps
# 03269A "LDU #$7AAB", 03269E "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): ninja_crouch ninja_crouch_strike_start ninja_crouch_strike_hit ninja_attack_recover ninja_attack_end; the scenarios jump to 5 of its 5; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_033AAB)
033AAB  data  ninja_crouch_strike_steps
# 0326E8 "LDU #$7ABA", 0326EC "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): ninja_jump_attack_start ninja_jump_attack_take_off ninja_jump_attack_spin ninja_jump_attack_dive ninja_jump_attack_fall; the scenarios jump to 4 of its 5 (was loaded_table_033ABA)
033ABA  data  ninja_jump_attack_steps
# 032790 "LDU #$7AC4", 032794 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): ninja_rush_start ninja_rush_run ninja_rush_leap ninja_rush_end; the scenarios jump to 3 of its 4; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_033AC4)
033AC4  data  ninja_rush_steps
# 03285C "LDU #$7ACC", 032860 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): ninja_vanish_start ninja_vanish_puff ninja_vanish_move ninja_vanish_reappear ninja_vanish_solid ninja_vanish_end; the scenarios jump to 0 of its 6; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_033ACC)
033ACC  data  ninja_vanish_steps
# 032A39 "LDU #$7B06", 032A3D "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): robot_piece_setup robot_piece_wait robot_piece_fall robot_piece_bounce robot_piece_burst; the scenarios jump to 5 of its 5 (was loaded_table_033B06)
033B06  data  robot_piece_states
# 032AF1 "LDU #$7BC8", 032AF5 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): robot_spark_setup robot_spark_fade; the scenarios jump to 2 of its 2 (was loaded_table_033BC8)
033BC8  data  robot_spark_states
# 032B95 "LDU #$7BE8", 032B99 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): robot_combo_wind_up robot_combo_ready robot_shock_92_begin robot_shock_92_sparks robot_shock_91_begin robot_shock_91_sparks robot_combo_pause robot_combo_ready robot_combo_turn robot_shock_92_begin robot_shock_92_sparks robot_shock_91_begin robot_shock_91_sparks robot_attack_end_with_animation; the scenarios jump to 7 of its 14 (was loaded_table_033BE8)
033BE8  data  robot_combo_steps
# 032BFF "LDU #$7C04", 032C03 "JSR [B,U]" (index B: its step, field 29, as enemy_attack passes it): robot_punch_start robot_punch_first_hit robot_punch_recover robot_punch_second_hit robot_punch_recover_again robot_attack_end_with_animation; the scenarios jump to 6 of its 6; without its length the analysis reads 13 before it (its neighbours' entries) (was loaded_table_033C04)
033C04  data  robot_punch_steps
# 032C83 "LDU #$7C10", 032C87 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): robot_advance_shock_start robot_advance_shock_sparks robot_attack_end; the scenarios jump to 2 of its 3; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_033C10)
033C10  data  robot_advance_shock_steps
# 032CD5 "LDU #$7C36", 032CD9 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): robot_shock_92_start robot_shock_92_sparks robot_attack_end; the scenarios jump to 3 of its 3 (was loaded_table_033C36)
033C36  data  robot_shock_92_steps
# 032D13 "LDU #$7C70", 032D17 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): robot_shock_91_start robot_shock_91_sparks robot_attack_end; the scenarios jump to 3 of its 3 (was loaded_table_033C70)
033C70  data  robot_shock_91_steps
# 032E33 "LDU #$7D08", 032E37 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): robot_launch_part_start robot_launch_part_release robot_launch_part_wait robot_attack_end_with_animation; the scenarios jump to 3 of its 4 (was loaded_table_033D08)
033D08  data  robot_launch_part_steps
# 032E70 "LDU #$7D16", 032E74 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): robot_part_setup robot_part_launch robot_part_fly_away; the scenarios jump to 3 of its 3 (was loaded_table_033D16)
033D16  data  robot_part_states
# 032EDB "LDU #$7D52", 032EDF "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): goon_lift_setup goon_lift_arrive goon_lift_stop goon_lift_descend goon_lift_settle goon_lift_open goon_lift_rise goon_lift_remove; the scenarios jump to 8 of its 8; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_033D52)
033D52  data  goon_lift_states
# 032F91 "LDU #$7D88", 032F95 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): goon_lift_part_setup goon_lift_part_wait_for_lift goon_lift_part_change goon_lift_part_idle; the scenarios jump to 4 of its 4 (was loaded_table_033D88)
033D88  data  goon_lift_part_states
# 033157 "LDU #$7E4A", 03315B "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): donut_roll_start donut_roll_go donut_roll_end; the scenarios jump to 2 of its 3 (was loaded_table_033E4A)
033E4A  data  donut_roll_steps
# 0331A4 "LDU #$7E50", 0331A8 "JMP [B,U]" (index B: its step, field 29, as enemy_attack passes it): donut_throw_start donut_throw_release donut_throw_end; the scenarios jump to 3 of its 3; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_033E50)
033E50  data  donut_throw_steps
# 0331CF "LDU #$7E5E", 0331D3 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): donut_shot_setup donut_shot_fly; the scenarios jump to 2 of its 2 (was loaded_table_033E5E)
033E5E  data  donut_shot_states
# 03362D "LDU #$7FD5", 033631 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): flying_saxophone_shot_setup flying_saxophone_shot_fall flying_saxophone_shot_burst flying_saxophone_shot_remove; the scenarios jump to 4 of its 4 (was loaded_table_033FD5)
033FD5  data  flying_saxophone_shot_states
# 034DF4 "LDU #$7914", 034DF8 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): boss_ball_setup boss_ball_fly_out boss_ball_home_in boss_ball_land boss_ball_burst_out boss_ball_remove boss_ball_burst boss_ball_burst_out boss_ball_remove; the scenarios jump to 7 of its 9 (was loaded_table_035914)
035914  data  boss_ball_states
# 034F7D "LDU #$7944", 034F81 "JMP [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): boss_ball_trail_setup boss_ball_trail_fade; the scenarios jump to 2 of its 2 (was loaded_table_035944)
035944  data  boss_ball_trail_states
# 036121 "LDU #$6436", 036125 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): car_doors_start car_doors_wait_for_scroll car_doors_wait car_doors_open car_doors_hold_open car_doors_wait_for_animation car_doors_shake_and_unload car_doors_close car_doors_closed car_doors_wait_for_animation car_doors_shake car_doors_idle; the scenarios jump to 11 of its 12 (was loaded_table_036436)
036436  data  car_doors_states
# 036234 "LDU #$6474", 036238 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): door_kind_12_start door_wait_for_place door_kind_12_open door_kind_12_let_out_enemies door_wait_for_animation door_kind_12_close door_idle; the scenarios jump to 7 of its 7 (was loaded_table_036474)
036474  data  door_kind_12_states
# 0362A5 "LDU #$64EC", 0362A9 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): door_kind_10_start door_wait_for_place door_kind_10_open door_kind_10_let_out_enemies door_kind_10_finish door_idle; the scenarios jump to 5 of its 6 (was loaded_table_0364EC)
0364EC  data  door_kind_10_states
# 036314 "LDU #$6539", 036318 "JSR [B,U]" (index B: its state, as the object lists' dispatchers pass it: 07CB6F "LDD #$01,X"): door_kind_0f_start door_wait_for_place door_kind_0f_open door_kind_0f_let_out_enemies door_wait_for_animation door_kind_0f_close door_idle; the scenarios jump to 7 of its 7 (was loaded_table_036539)
036539  data  door_kind_0f_states
# 038295 "LDY #$7D51", 038298 "JMP [D,Y]": player_stand player_keep_life player_jump player_fall player_throw_carried_4 player_throw_carried_5 player_swing_6 player_swing_7 player_throw_weapon_8 player_attack_1 player_attack_2 player_attack_3 player_attack_finish player_jump_kick player_drop_after_crash player_flung_back player_wait_for_animation player_squashed player_wait_for_animation player_wait_for_animation player_knocked_flying player_knocked_down player_lying_down player_drop_after_crash player_knocked_up player_knocked_up player_stunned player_stunned player_grabbed player_wait_for_animation player_wait_for_animation player_lose_life player_game_over_start player_game_over_rise player_game_over_end player_wait_for_animation player_wait_for_animation player_idle player_jump_in player_drop_in player_drop_after_crash player_choose_attack player_hold_pose player_throw_weapon_away player_work_heavy_object player_heave_heavy_object player_keep_life player_end_on_animation player_team_ready player_team_start player_team_move player_team_jump player_team_fall player_attack_fall player_attack_fall player_team_thrown player_team_attack_homer player_keep_life player_grabbed_and_hit player_escape player_stuck_on_back player_slide_down_back player_peel_off_back player_keep_life unreached_03829A unreached_0382AF; the scenarios jump to 42 of its 66; the analysis reads 64 of them without a length (its limit for a table read without one): entries 64 and 65 (player states 40 and 41, 039DD1-039DD4) are the two functions it left unreached, player_next_state_at_animation_end and player_land_at_animation_end (was loaded_table_039D51)
# (64: entries 64 and 65 follow the JMP [D,Y] inside player_run itself, which the switch cannot take as cases; the
# two stay functions of their own nothing calls)
039D51  data  player_state_handlers
# 0387E8 "LDY #$7DE1", 0387EB "JMP [A,Y]": player_start_throw_kind_4 player_start_throw player_start_swing_6 player_start_swing player_start_throw_weapon_8; the scenarios jump to 3 of its 5 (was loaded_table_039DE1)
039DE1  data  player_use_held_by_kind
# 03A7D7 "LDY #$7AD6", 03A7DA "JMP [A,Y]" (index LDA #$2E,X): stage_8_boss_bomb_throw stage_8_boss_bomb_fly stage_8_boss_bomb_blast stage_8_boss_bomb_bounce; the scenarios jump to 4 of its 4 (was loaded_table_03BAD6)
03BAD6  data  stage_8_boss_bomb_states
# 03A9C3 "LDU #$7AEE", 03A9CA "JSR [A,U]" (index LDA #$02,X): burns_robot_entrance burns_robot_walk_form_0 burns_robot_walk_form_1 burns_robot_walk_late_forms burns_robot_walk_late_forms burns_robot_walk_late_forms burns_robot_swing burns_robot_swing burns_robot_swing burns_robot_volley burns_robot_lunge burns_robot_part_attack burns_robot_lob_bombs burns_robot_gloat; the scenarios jump to 10 of its 14; and to entries before it (a negative index): burns_robot_final_defeat (-6), burns_robot_form_3_broken (-5), burns_robot_form_2_broken (-4), burns_robot_form_1_broken (-3), burns_robot_form_0_broken (-2), burns_robot_hurt (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_03BAEE)
03BAEE  data  burns_robot_states
# 03A9D3 "LDU #$7B0A", 03A9DA "JMP [A,U]" (index LDA #$28,X): burns_robot_drop_maggie burns_robot_walk_to_maggie burns_robot_stop_at_maggie burns_robot_let_burns_out burns_robot_leave; the scenarios jump to 5 of its 5; without its length the analysis reads 13 before it (its neighbours' entries) (was loaded_table_03BB0A)
03BB0A  data  burns_robot_final_defeat_actions
# 03AAA4 "LDU #$7B14", 03AAAB "JMP [A,U]" (index LDA #$28,X): burns_robot_start_breaking burns_robot_shed_form_3; the scenarios jump to 2 of its 2; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_03BB14)
03BB14  data  burns_robot_form_3_broken_actions
# 03AB17 "LDU #$7B18", 03AB1E "JMP [A,U]" (index LDA #$28,X): burns_robot_start_breaking burns_robot_shed_form_2; the scenarios jump to 2 of its 2; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_03BB18)
03BB18  data  burns_robot_form_2_broken_actions
# 03AB99 "LDU #$7B1C", 03ABA0 "JMP [A,U]" (index LDA #$28,X): burns_robot_broken_shake burns_robot_broken_cry burns_robot_shed_form_1 burns_robot_fall_down burns_robot_lie_broken burns_robot_rise_as_next_form burns_robot_start_form; the scenarios jump to 7 of its 7; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_03BB1C)
03BB1C  data  burns_robot_form_1_broken_actions
# 03ABFD "LDU #$7B2A", 03AC04 "JMP [A,U]" (index LDA #$28,X): burns_robot_broken_shake burns_robot_broken_cry burns_robot_shed_form_0 burns_robot_fall_down burns_robot_lie_broken burns_robot_rise_as_next_form burns_robot_start_form; the scenarios jump to 7 of its 7; without its length the analysis reads 6 before it (its neighbours' entries) (was loaded_table_03BB2A)
03BB2A  data  burns_robot_form_0_broken_actions
# 03AD07 "LDU #$7B38", 03AD0E "JMP [A,U]" (index LDA #$28,X): burns_robot_hurt_flash burns_robot_hurt_end; the scenarios jump to 2 of its 2; without its length the analysis reads 6 before it (its neighbours' entries) (was loaded_table_03BB38)
03BB38  data  burns_robot_hurt_actions
# 03AD3B "LDU #$7B3C", 03AD42 "JMP [A,U]" (index LDA #$28,X): burns_robot_place burns_robot_wait_for_story burns_robot_appear burns_robot_step_up burns_robot_speak burns_robot_toss_part burns_robot_start_fight burns_robot_ready; the scenarios jump to 8 of its 8; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_03BB3C)
03BB3C  data  burns_robot_entrance_actions
# 03AEEA "LDU #$7B4C", 03AEF1 "JMP [A,U]" (index LDA #$28,X): burns_robot_stop_and_wind_up burns_robot_swing_hit burns_robot_walk_on; the scenarios jump to 3 of its 3; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_03BB4C)
03BB4C  data  burns_robot_swing_actions
# 03AF47 "LDU #$7B52", 03AF4E "JMP [A,U]" (index LDA #$28,X): burns_robot_stop_and_wind_up burns_robot_fire_shot burns_robot_volley_next burns_robot_volley_end; the scenarios jump to 4 of its 4; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_03BB52)
03BB52  data  burns_robot_volley_actions
# 03B59B "LDU #$7D99", 03B5A2 "JMP [A,U]" (index LDA #$02,X): burns_breakout_start burns_breakout_wait burns_breakout_break_wall burns_breakout_end; the scenarios jump to 4 of its 4; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_03BD99)
03BD99  data  burns_breakout_states
# 03B64B "LDU #$7DA1", 03B652 "JMP [A,U]" (index LDA #$02,X): burns_tossed_part_launch burns_tossed_part_fly; the scenarios jump to 2 of its 2; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_03BDA1)
03BDA1  data  burns_tossed_part_states
# 03B685 "LDU #$7DA5", 03B68C "JMP [A,U]" (index LDA #$02,X): burns_debris_bounce burns_debris_bounce burns_debris_bounce burns_debris_blink; the scenarios jump to 2 of its 4; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_03BDA5)
03BDA5  data  burns_debris_steps
# 03B6F5 "LDU #$7DAD", 03B6FC "JMP [A,U]" (index LDA #$02,X): rescued_maggie_wait rescued_maggie_drop rescued_maggie_fall rescued_maggie_bounce rescued_maggie_bounce rescued_maggie_bounce rescued_maggie_bounce rescued_maggie_stop rescued_maggie_pose rescued_maggie_pose_2 rescued_maggie_crawl rescued_maggie_sound_then_stop rescued_maggie_pose rescued_maggie_pose_2 rescued_maggie_crawl rescued_maggie_crawl_to_burns rescued_maggie_finish; the scenarios jump to 11 of its 17; without its length the analysis reads 3 before it (its neighbours' entries) (was loaded_table_03BDAD)
03BDAD  data  rescued_maggie_states
# 03B826 "LDU #$7DCF", 03B82D "JMP [A,U]" (index LDA #$02,X): burns_bomb_fall burns_bomb_fuse burns_bomb_blast burns_part_vanish; the scenarios jump to 3 of its 4; without its length the analysis reads 16 before it (its neighbours' entries) (was loaded_table_03BDCF)
03BDCF  data  burns_bomb_states
# 03B893 "LDU #$7DD7", 03B89A "JSR [A,U]" (index LDA #$02,X): burns_shot_arm burns_shot_fly; the scenarios jump to 2 of its 2; and to entries before it (a negative index): burns_part_vanish (-1); no length: the analysis reads it both ways, as the scenarios do (was loaded_table_03BDD7)
03BDD7  data  burns_shot_states
# 03B91A "LDU #$7DDB", 03B921 "JMP [A,U]" (index LDA #$02,X): mr_burns_appear mr_burns_wait_for_blow mr_burns_beaten mr_burns_release_maggie mr_burns_see_maggie mr_burns_done; the scenarios jump to 6 of its 6; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_03BDDB)
03BDDB  data  mr_burns_states
# 03C354 "LDY #$7D70", 03C357 "JMP [A,Y]" (index LDA #$2E,X): football_player_start football_player_wait_cue football_player_stand football_player_run_at_target football_player_wander football_player_appear football_player_ready football_player_tackle football_player_rest football_player_throw football_player_throwing football_player_charge_windup football_player_charge football_player_hurt_pose football_player_hurt_pose_wait football_player_flinch football_player_knocked_back football_player_knocked_out football_player_defeated football_player_stand football_player_start_tackle; the scenarios jump to 18 of its 21 (was loaded_table_03DD70)
03DD70  data  football_player_states
# 03C8C8 "LDY #$7DEC", 03C8CB "JMP [A,Y]" (index LDA #$2E,X): bear_start bear_wait_entrance bear_stir bear_break_out bear_step_out bear_roar bear_choose_target bear_walk bear_swipe bear_start_charge bear_charge bear_recover bear_knocked_down bear_change bear_changed bear_long_get_up bear_get_up bear_attack_wait bear_recover bear_defeated; the scenarios jump to 19 of its 20 (was loaded_table_03DDEC)
03DDEC  data  bear_states
# 03D1BA "LDY #$7EDC", 03D1BD "JMP [A,Y]" (index LDA #$2E,X): stage_3_boss_start stage_3_boss_enter stage_3_boss_arrive stage_3_boss_wait stage_3_boss_walk stage_3_boss_leap stage_3_boss_attack stage_3_boss_strike stage_3_boss_follow_up stage_3_boss_reach_partner stage_3_boss_follow_partner stage_3_boss_join stage_3_boss_jump_on stage_3_boss_together stage_3_boss_strike stage_3_boss_partner_ready stage_3_boss_pause stage_3_boss_flinch stage_3_boss_knocked stage_3_boss_down stage_3_boss_defeated stage_3_boss_push; the scenarios jump to 20 of its 22; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_03DEDC)
03DEDC  data  stage_3_boss_states
# 03E27B "LDU #$7000", 03E27E "JMP [A,U]" (index LDA ,Y+): story_actor_set_kind story_actor_set_animation story_actor_set_place story_actor_set_speeds story_actor_set_accelerations story_actor_walk_to story_actor_put_in story_actor_wait story_actor_set_accelerations_xy story_actor_line_up_players story_actor_set_hit_box story_actor_play_sound story_actor_halt story_actor_set_attributes story_actor_toggle_airborne story_actor_walk_to_partner story_actor_wait_for_object story_actor_wait_for_players story_actor_random_player_faces story_actor_set_players_animation story_actor_face_object story_actor_wait_for_height story_actor_put_in_child story_actor_wait_for_camera story_actor_set_variable sub_03E53C story_actor_walk_to_without_turning story_actor_wait_for_x story_actor_place_players story_actor_start_absent_players story_actor_play_kind_sound story_actor_wait_for_floor story_actor_play_sound_if_player story_actor_player_speaks story_actor_toggle_repeat_sound sub_03E649 story_actor_wait_or_presses story_actor_stop; the scenarios jump to 36 of its 38 (was loaded_table_03F000)
03F000  data  story_actor_operations
# 040015 "LDX #$7000", 04001C "JMP [A,X]" (index LDA <$03): attract_opening attract_opening_end attract_bart attract_homer attract_lisa attract_marge attract_leap attract_last_screen; the scenarios jump to 8 of its 8 (was loaded_table_041000)
041000  data  attract_opening_scenes
# 04001E "LDX #$7010", 040025 "JMP [A,X]" (index LDA <$04): attract_opening_start attract_opening_zoom; the scenarios jump to 2 of its 2; without its length the analysis reads 7 before it (its neighbours' entries) (was loaded_table_041010)
041010  data  attract_opening_phases
# 0400FF "LDX #$7014", 040106 "JMP [A,X]" (index LDA <$04): attract_opening_end_start attract_opening_end_scroll attract_opening_end_wait; the scenarios jump to 3 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_041014)
041014  data  attract_opening_end_phases
# 0401AE "LDX #$701A", 0401B5 "JMP [A,X]" (index LDA <$04): attract_bart_scene_start attract_bart_scene_move attract_bart_scene_wait attract_bart_profile_start attract_bart_profile_type attract_bart_profile_end; the scenarios jump to 6 of its 6; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_04101A)
04101A  data  attract_bart_phases
# 0402A5 "LDX #$7026", 0402AC "JMP [A,X]" (index LDA <$04): attract_homer_scene_start attract_homer_scene_wait attract_homer_scene_end attract_homer_profile_start attract_homer_profile_type attract_homer_profile_end; the scenarios jump to 6 of its 6; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_041026)
041026  data  attract_homer_phases
# 040358 "LDX #$7032", 04035F "JMP [A,X]" (index LDA <$04): attract_lisa_scene_start attract_lisa_scene_walk attract_lisa_scene_play attract_lisa_profile_start attract_lisa_profile_type attract_lisa_profile_end; the scenarios jump to 6 of its 6; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_041032)
041032  data  attract_lisa_phases
# 040471 "LDX #$703E", 040478 "JMP [A,X]" (index LDA <$04): attract_marge_scene_start attract_marge_scene_wait attract_marge_scene_pose attract_marge_scene_end attract_marge_profile_start attract_marge_profile_type attract_marge_profile_end; the scenarios jump to 7 of its 7; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_04103E)
04103E  data  attract_marge_phases
# 04063D "LDX #$704C", 040644 "JMP [A,X]" (index LDA <$04): attract_leap_start attract_leap_rise attract_leap_fall attract_leap_land attract_leap_end; the scenarios jump to 5 of its 5; without its length the analysis reads 6 before it (its neighbours' entries) (was loaded_table_04104C)
04104C  data  attract_leap_phases
# 040700 "LDX #$7056", 040707 "JMP [A,X]" (index LDA <$04): attract_last_screen_start attract_last_screen_wait; the scenarios jump to 2 of its 2; without its length the analysis reads 4 before it (its neighbours' entries) (was loaded_table_041056)
041056  data  attract_last_screen_phases
# 04078D "LDU #$705A", 04079C "JMP [B,U]" (index LDB #$01,X): attract_profile_move_out attract_profile_move_stop attract_profile_move_pause attract_profile_move_back attract_profile_move_stop attract_profile_move_done; the scenarios jump to 5 of its 6; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_04105A)
04105A  data  attract_profile_move_steps
# 05E042 "LDX #$6047", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_menu_open test_menu_update; the scenarios jump to 2 of its 2; no length: the page's code right after it ends it (was loaded_table_05E047)
05E047  data  test_menu_page_steps
# 05E09B "LDX #$60A1", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_rom_check_open test_rom_check_run; the scenarios jump to 2 of its 2; no length: the page's code right after it ends it (was loaded_table_05E0A1)
05E0A1  data  test_rom_check_page_steps
# 05E0C3 "LDX #$60C9", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_screen_check_draw test_menu_update; the scenarios jump to 2 of its 2; no length: the page's code right after it ends it (was loaded_table_05E0C9)
05E0C9  data  test_screen_check_page_steps
# 05E0EC "LDX #$60F2", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_color_check_draw test_menu_update; the scenarios jump to 2 of its 2; no length: the page's code right after it ends it (was loaded_table_05E0F2)
05E0F2  data  test_color_check_page_steps
# 05E177 "LDX #$617D", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_io_check_open test_io_check_run; the scenarios jump to 2 of its 2; no length: the page's code right after it ends it (was loaded_table_05E17D)
05E17D  data  test_io_check_page_steps
# 05E215 "LDX #$621B", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_music_open test_music_first_choice test_music_choice test_music_replay; the scenarios jump to 4 of its 4; no length: the page's code right after it ends it (was loaded_table_05E21B)
05E21B  data  test_music_page_steps
# 05E271 "LDX #$6277", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_sound_open test_sound_first_choice test_sound_choice test_sound_replay; the scenarios jump to 4 of its 4; no length: the page's code right after it ends it (was loaded_table_05E277)
05E277  data  test_sound_page_steps
# 05E2C3 "LDX #$62C9", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_options_open test_menu_update; the scenarios jump to 2 of its 2; no length: the page's code right after it ends it (was loaded_table_05E2C9)
05E2C9  data  test_options_page_steps
# 05E425 "LDX #$642B", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_choose_setting_open test_choose_setting_run; the scenarios jump to 2 of its 2; no length: the page's code right after it ends it (was loaded_table_05E42B)
05E42B  data  test_choose_setting_steps
# 05E467 "LDX #$646D", 05E03B "LDA $5909; ASLA; JMP [A,X]" (the page's step): test_factory_setting_apply test_factory_setting_wait; the scenarios jump to 0 of its 2; no length: the page's code right after it ends it (was loaded_table_05E46D)
05E46D  data  test_factory_setting_page_steps
# 05E024 "LDX #$7580", 05E02C "JSR [A,X]" (index LDA $5908): test_menu_page test_rom_check_page test_screen_check_page test_color_check_page test_io_check_page test_music_page test_sound_page test_start_buttons_page test_options_page test_exit test_coin_setting_page test_players_page test_players_page test_difficulty_page test_attract_sound_page test_screen_flip_page test_sound_output_page test_factory_setting_page test_premium_start_page test_coinage_page test_premium_coins_page test_premium_coinage_page test_back_to_menu; the scenarios jump to 9 of its 23 (was loaded_table_05F580)
05F580  data  test_pages
# 05ED5B "LDX #$7D78", 05ED62 "JSR [A,X]" (index LDA <$05): game_start_draw_portraits game_start_run_portraits; the scenarios jump to 2 of its 2; the analysis reads only its first entry without a length (was loaded_table_05FD78)
05FD78  data  game_start_portraits_steps
# 07B71B "LDY #$E803", 07B722 "JSR [A,Y]" (index LDA [#$17,X]): player_out player_join player_playing player_continue_countdown player_game_over player_join; the scenarios jump to 5 of its 6 (was loaded_table_07E803)
07E803  data  player_status_handlers
# 07B8B0 "LDX #$E80F", 07B8B7 "JMP [A,X]" (index LDA <$02): game_phase_check_none check_players_out continue_screen game_phase_check_none game_phase_check_none; the scenarios jump to 2 of its 5; without its length the analysis reads 5 before it (its neighbours' entries) (was loaded_table_07E80F)
07E80F  data  game_phase_checks
# 07BD33 "LDY #$E971", 07BD3A "JSR [A,Y]" (index LDA #$01,U): palette_effect_forward palette_effect_backward; the scenarios jump to 2 of its 2; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_07E971)
07E971  data  palette_effect_directions
# 07BDA8 "LDY #$E975", 07BDAE "JMP [A,Y]" (index LDA <$0F): palette_effect_stop palette_effect_reverse palette_effect_repeat; the scenarios jump to 3 of its 3; without its length the analysis reads 1 before it (its neighbours' entries) (was loaded_table_07E975)
07E975  data  palette_effect_commands
# 07BE5E "LDY #$E97B", 07BE65 "JSR [A,Y]" (index LDA <$F0): darken_colour brighten_colour; the scenarios jump to 2 of its 2; without its length the analysis reads 2 before it (its neighbours' entries) (was loaded_table_07E97B)
07E97B  data  palette_fade_directions
# 07D059 "LDU #$F134"; 07D0C3 "LDU #$F134", 07D062 "JMP [A,U]" (index LDA #$1E,X); 07D0CC "JMP [A,U]" (index LDA #$1E,X): enemy_react_to_hit enemy_react_to_hit enemy_react_sent_flying enemy_react_knocked_down; the scenarios jump to 3 of its 4 (was loaded_table_07F134)
07F134  data  enemy_hit_kind_reactions
# 07D62F "LDU #$F586", 07D633 "JSR [A,U]": enemy_walk_to_target enemy_line_up_with_target enemy_keep_distance enemy_back_off enemy_stand_still enemy_step_toward_target enemy_circle_target enemy_rush_at_target enemy_line_up_and_pace enemy_wait_while_target_down enemy_line_up_near_target enemy_wander enemy_walk_to_target_side enemy_get_around; the scenarios jump to 12 of its 14 (was loaded_table_07F586)
07F586  data  enemy_think_actions

# ---- the bonuses' results (bank 10) ----
# 020F3E "LDX #$7D8D; JMP [A,X]": bonus_results by its state, 6F43 6F7F 6F87 6F99 6FAB 6FBD 6FCC and a last entry
# whose low byte is the first of bonus_results_hop_speeds (021D9C), so no length (was loaded_table_021D8D)
021D8D  data  bonus_results_states
# 021139 "LDY #$7DBC" in bonus_results_place_next: the text a result's box shows for places 1-3 ("...POINTS"), its
# address into the sign object's fields 43-44 (021151 "STY #$43,U") (was loaded_table_021DBC)
021DBC  data  bonus_result_text
# 02113E "LDY #$7DCF": the same for b = 3, "PLAYER$ ... POINTS" (was loaded_table_021DCF)
021DCF  data  bonus_result_player_text
# 021147 "LDY #$7DE3": the same when that player is not in the game (its object's type 0), "NO$ ... POINTS", with
# hit_box 1 and colour 4 (was loaded_table_021DE3)
021DE3  data  bonus_result_absent_text
# 0212D6 "LDY #$7DF1; ... LDU #$0008; BMOVE Y,X,U; LEAX #$38,X" in bonus_results_draw_box: the box's tiles, 8 a row, 4
# rows for a player in the game (30 31..34 / 40 41..44 / 40..44 / 50 62..54), then 3 narrower rows; its last 6 bytes
# (7315 737C 73CA) are wrestler_states' entries -3 to -1 (was indexed_table_021DF1)
021DF1  data  bonus_result_box_tiles

# ---- stage 5's scroll (bank 13) ----
# 026164 "LDU #$7948; LDA <$AB; ASLA; ..." in stage_5_scroll: 8 records of 4 bytes by stage_scroll_step, the camera x
# where the stage moves on (0370, 03C5, 041A ...) and the part it moves on to (7F 01 ... 7F 00) (was loaded_table_027948)
027948  data  stage_5_scroll_parts

# ---- the first story's actors (bank 13): their steps (field 01) ----
# 027637 "LDU #$7F13; LDA #$01,X; ASLA; JMP [A,U]" in story_1_lisa: 7640 (her walk in), 7655 (story_1_character_done);
# the walk took it as a 1-byte indexed table, so no length (was indexed_table_027F13)
027F13  data  story_1_lisa_steps
# 02765C "LDU #$7F17; LDA ,S; ASLA; JSR [A,U]" in story_1_runners: the scripts of Smithers and his two goons (4FE0,
# 5040, 50A0) by their index (was indexed_table_027F17)
027F17  data  story_1_runner_scripts
# 027680 "LDU #$7F1D; LDA #$01,X; ASLA; JMP [A,U]" in story_1_smithers (was indexed_table_027F1D)
027F1D  data  story_1_smithers_steps
# 02771E "LDU #$7F2F; LDA #$01,X; ASLA; JMP [A,U]" in story_1_second_goon (was indexed_table_027F2F)
027F2F  data  story_1_second_goon_steps
# 027767 "LDU #$7F37; LDX #$4F80; LDA #$01,X; ASLA; JMP [A,U]" in story_1_text (4F80) (was indexed_table_027F37)
027F37  data  story_1_text_steps
# 027894 "LDU #$7FF3; LDA #$02,X; ASLA; JSR [A,U]" in boss_door_stage_8: 78A8 7865 787F by its state, then FF fill
# (was loaded_table_027FF3)
027FF3  data  boss_door_stage_8_states

# ---- floor shapes: 4 columns of 3 floor cells each, written into the floor map (floor_blocker_write_cells,
# platform_scenery_write_cells: "Writes 4 columns of 3 floor cells from the table in Y") ----
# 02B294 "LDY #$7EF3; LBSR $72C2" in floor_blocker_first_part (was loaded_table_02BEF3)
02BEF3  data  floor_blocker_shape_1
# 02B2A6 "LDY #$7EFF; LBSR $72C2" in floor_blocker_second_part (was loaded_table_02BEFF)
02BEFF  data  floor_blocker_shape_2
# 02B2B8 "LDY #$7F0B; LBSR $72C2" in floor_blocker_last_part (was loaded_table_02BF0B)
02BF0B  data  floor_blocker_shape_3
# 02C775 "LDY #$7CE1; BSR $67C7" in platform_scenery_first_part (was loaded_table_02DCE1)
02DCE1  data  platform_scenery_shape_1
# 02C786 "LDY #$7CED" in platform_scenery_second_part (was loaded_table_02DCED)
02DCED  data  platform_scenery_shape_2
# 02C797 "LDY #$7CF9" in platform_scenery_third_part (was loaded_table_02DCF9)
02DCF9  data  platform_scenery_shape_3
# 02C7A8 "LDY #$7D05" in platform_scenery_fourth_part (was loaded_table_02DD05)
02DD05  data  platform_scenery_shape_4
# 02C7B9 "LDY #$7D11" in platform_scenery_last_part (was loaded_table_02DD11)
02DD11  data  platform_scenery_shape_5
# 02C9B9 "LDY #$7D4D; LBSR $67C7" in charging_scenery_first_part (was loaded_table_02DD4D)
02DD4D  data  charging_scenery_shape_1
# 02C9CB "LDY #$7D59" in charging_scenery_second_part (was loaded_table_02DD59)
02DD59  data  charging_scenery_shape_2
# 02C9DD "LDY #$7D65" in charging_scenery_last_part (was loaded_table_02DD65)
02DD65  data  charging_scenery_shape_3
# 02C994, 02C99D, 02C9A6 "LDY #$7D71; LBSR $67C7" in charging_scenery_clear_floor: 12 zeros, plain floor written back
# over its three parts as it leaves (was loaded_table_02DD71)
02DD71  data  plain_floor_shape

# ---- bank 17 ----
# 02EEF7 "LDU #$7E0F; ASLB; JSR [B,U]" in unused_goon_update: the fixed program's goon handlers by state (85D5, 0000,
# 85DB, 85DE, 865C, 85E4) (was loaded_table_02FE0F)
02FE0F  data  unused_goon_states

# ---- bank 1A: Dreamland's boss ----
# 035160 "LDU #$798E; ... LDA ,U+; STA #$30,Y" in dreamland_boss_chain_setup: each link's field 30 (parameter) as the
# chain is built, 80 81 82 ... (was loaded_table_03598E)
03598E  data  dreamland_boss_chain_link_parameters

# ---- bank 1B: the doors' enemy lists, by the door's field 30 (03637B "LDU #$655D; LDA #$30,X; ASLA; LDY A,U") ----
# 036291 "LDU #$6498" in door_kind_12_let_out_enemies (was indexed_table_036498)
036498  data  door_kind_12_enemy_lists
# 03630E "LDU #$650A" in door_kind_10_let_out_enemies (was indexed_table_03650A)
03650A  data  door_kind_10_enemy_lists
# 03637B "LDU #$655D" in door_kind_0f_let_out_enemies (was indexed_table_03655D)
03655D  data  door_kind_0f_enemy_lists

# ---- bank 1C: the players ----
# 0387A2 "LDY #$7DD9; LBSR $79CA" in player_stand: player_place_carried's offsets ("the offsets Y gives for the
# player's character": x, then height) for an object being picked up, 14 02 14 02 12 05 10 02 (was loaded_table_039DD9)
039DD9  data  carry_offsets_picking_up
# 03894A "LDX #$7E07; CMPD #$0040; BGE; LEAX #$0A,X; LDY ,X++" in player_start_jump_attack: two records of 10 bytes
# (its hit, gravity, z speed, x speed, box), the second for a jump attack below 40 above the floor; the walk cut them
# into 2-byte pieces (was indexed_table_039E07)
039E07  data  player_jump_attack_settings
# 038A73, 038A90 "LDY #$7E1B" in player_throw_carried_4/5, for player_place_carried: the carried object's offsets
# while throwing, by character (was loaded_table_039E1B)
039E1B  data  carry_offsets_throwing
# 038A81, 038A9E "LDY #$7E23" in player_throw_carried_4/5: the offsets player_release_throw puts the thrown object
# at (was loaded_table_039E23)
039E23  data  throw_release_offsets
# 03833A, 038A34, 038B03... "LDY #$7E3B; LBSR $7BF9" in the attacks (player_attack_1-3, finish, swings, jump kick, team
# moves): the height player_show_hit_spark adds ("at its height plus the byte Y points at"), 10 (was loaded_table_039E3B)
039E3B  data  hit_spark_height
# 0389BA, 038B6A "LDY #$7E3C; LBSR $7BF9" in player_jump_attack and player_team_thrown: the same, 00 (was
# loaded_table_039E3C)
039E3C  data  hit_spark_height_in_air
# 038485, 03867A, 0386B2 "LDY #$7E45" in player_stand, player_jump, player_fall, for player_set_animation: the offsets
# a carried object takes above the player standing or in the air (F6 39, F3 31, F4 25, F5 28: x and height by
# character) (was loaded_table_039E45)
039E45  data  carry_offsets_still
# 03841E, 03843D, 0386DB "LDY #$7E55" in player_walk and player_set_standing: the same while walking, three frames of
# 4 characters (FA 3A, FD 3D, F9 35, FB 29 ...); its last 32 bytes (778A ... 73B6) are the entries before the touch
# table at 7E8D (039330 "LDX #$7E8D; JMP [D,X]") (was loaded_table_039E55)
039E55  data  carry_offsets_walking
# 03831A "LDY #$7F5D" in player_team_move: two players' walking velocities, 15 of 4 bytes like player_walk_velocities
# (039F21, whose entry 15 would be this table) (was loaded_table_039F5D)
039F5D  data  team_walk_velocities
# 039700-03970F "LDB #$04,U; ASLB; ASLB; ADDB #$04,X; ASLB; ASLB; ASLB; LDY #$7EA9; CLRA; LEAY D,Y" in the team-up:
# team_moves' records by 4 x the first character + the second, from here (record 0 never comes: its bytes are the touch
# table's last entries and pickup_vitality); not a table of its own (was loaded_table_039EA9)
039EA9  data  team_moves_by_characters

# ---- the stage bosses' boxes (stage_boss_set_hit_box, stage_8_boss_set_box) and limits ----
# 03A362, 03A5D6 "LDY #$7A94; LBSR $620E" in stage_8_boss_opening_throw and stage_8_boss_resume: its usual box
# (stage_8_boss_set_box: "the 4 bytes Y points at") (was indexed_table_03BA94)
03BA94  data  stage_8_boss_box
# 03A5E8 "LDY #$7A98; LBSR $620E" in stage_8_boss_attack_wind_up (was indexed_table_03BA98)
03BA98  data  stage_8_boss_wind_up_box
# 03A90A "LDY #$7ADE; LBRA $620E" in stage_8_boss_bomb_explode: the blast's box (was indexed_table_03BADE)
03BADE  data  stage_8_boss_bomb_blast_box
# 03C3F1 "LDY #$7DA2; LBSR $62E5" (stage_boss_set_hit_box) in football_player_ready, tackle, throwing, charge, flinch
# (was indexed_table_03DDA2)
03DDA2  data  football_player_box
# 03C7AC "LDY #$7DB9; LBSR $6260" in football_player_check_hit: stage_boss_check_hit's vitality limits by
# player_count ("a <= Y[players]": beaten at or below), 30 30 20 10 (was indexed_table_03DDB9)
03DDB9  data  football_player_beaten_vitality
# 03C34A "LDY #$7DBD; LBSR $6340" in football_player: stage_boss_set_gauge's healths (00 16 19 1C 20) (was
# indexed_table_03DDBD)
03DDBD  data  football_player_gauge_healths
# 03C820 "LDY #$7DCE; LBSR $62E5" in football_thrown: the thrown football's box (was indexed_table_03DDCE)
03DDCE  data  football_box
# 03C857 "LDY #$7DD2; LBSR $62E5" in football_line_piece (was indexed_table_03DDD2)
03DDD2  data  football_line_piece_box
# 03CA40, 03CA60 "LDY #$7E50; LBSR $62E5" in bear_step_out and bear_face_player (was indexed_table_03DE50)
03DE50  data  bear_box
# 03CBCA, 03CDE5 "LDY #$7E67; LBSR $6260" in bear_charge_check_hit and bear_check_hit: its beaten vitality by
# players, 1C 40 20 10 (was indexed_table_03DE67)
03DE67  data  bear_beaten_vitality
# 03C8BE "LDY #$7E6B; LBSR $6340" in bear: its gauge's healths (00 20 26 29 2C) (was indexed_table_03DE6B)
03DE6B  data  bear_gauge_healths
# 03CB8D "LDY #$7E70; LBSR $6329" (stage_boss_walk_by_rank) in bear_walk: its walking speeds by rank, 28-37 (was
# indexed_table_03DE70)
03DE70  data  bear_walk_speeds
# 03CBC4 "LDY #$7E90; LBSR $62E5" in bear_start_charge: its charging box (was indexed_table_03DE90)
03DE90  data  bear_charge_box
# 03D295 "LDY #$7F16" in stage_3_boss_pick_target ("Its hit box, then its target") (was indexed_table_03DF16)
03DF16  data  stage_3_boss_box
# 03D333 "LDY #$7F22" in stage_3_boss_attack_or_wait (was indexed_table_03DF22)
03DF22  data  stage_3_boss_attack_box
# 03D6A6 "LDY #$7F2E; LBSR $62E5" in stage_3_boss_join ("a shared hit box") (was indexed_table_03DF2E)
03DF2E  data  stage_3_bosses_joined_box
# 03D47A "LDY #$7F32; LBSR $62E5" in stage_3_boss_attack and stage_3_boss_strike_frames (was indexed_table_03DF32)
03DF32  data  stage_3_boss_strike_box
# 03D595 "LDY #$7F3D; LBSR $6260" in stage_3_boss_update: its beaten vitality by players, F0 40 18 04 (was
# indexed_table_03DF3D)
03DF3D  data  stage_3_boss_beaten_vitality
# 03D6E7 "LDY #$7F42; LBRA $6329" in stage_3_boss_walk_speed ("one table for each of the two"), the first boss's
# (its field second 0): 0E-19 by rank (was indexed_table_03DF42)
03DF42  data  stage_3_boss_walk_speeds_1
# 03D6E1 "LDY #$7F52; LBRA $6329" in stage_3_boss_walk_speed, the second boss's: 28-37 by rank (was
# indexed_table_03DF52)
03DF52  data  stage_3_boss_walk_speeds_2
# 03D795 "LDY #$7F9A; LBRA $62E5" in marge_cloud_appear and marge_cloud_attack (was indexed_table_03DF9A)
03DF9A  data  marge_cloud_box
# 03D830 "LDY #$7F9E; LBSR $62E5" in marge_cloud_windup (was indexed_table_03DF9E)
03DF9E  data  marge_cloud_windup_box
# 03DC1E "LDU #$7FAA; JMP [A,U]" in scripted_object and each of its commands (they go back to the loop with U at it):
# the commands 00-0F (7C23 ... 7CDE), then FF fill (was loaded_table_03DFAA)
03DFAA  data  scripted_object_commands

# ---- bank 1F: the stories ----
# 03E3CD "LDU #$704C; LEAU A,U" in story_actor_line_up_players ("lines the four players up in a random order"): 4
# orders of the 4 players by the random number (00 03 01 02, 01 00 02 03 ...) (was loaded_table_03F04C)
03F04C  data  player_line_up_orders
# 03E568 "LDU #$705C; ... LDD ,U++; ADDD <$F8; STD #$0C,X" in story_actor_place_players: the four players' x and y
# offsets from the place (was loaded_table_03F05C)
03F05C  data  story_player_place_offsets
# 03ED37 "LDY #$7EDC; LEAY A,Y; LDX #$1840; LDU #$0008; BMOVE Y,X,U" in scene_load_story_settings: 8 bytes of
# settings a scene (00C0 00A8 0140 00A8 ...), then FF fill (was loaded_table_03FEDC)
03FEDC  data  story_scene_settings

# ---- bank 20: the attract's pictures, records (animation, x, y) for attract_put_picture ("a kind 0E object from a
# record") and attract_profile_place (two records) ----
# 040085 "LDU #$7066" in attract_opening_start: the big picture (1F at 00E0, 0120) (was loaded_table_041066)
041066  data  attract_opening_picture
# 0401FA "LDU #$706B" in attract_bart_scene_start (was loaded_table_04106B)
04106B  data  attract_bart_scene_picture
# 0402D3 "LDU #$7070" in attract_homer_scene_start (was loaded_table_041070)
041070  data  attract_homer_scene_picture
# 04039C "LDU #$7075" in attract_lisa_scene_start, the first of its two (was loaded_table_041075)
041075  data  attract_lisa_scene_picture_1
# 0403A2 "LDU #$707A" in attract_lisa_scene_start, the second; the two records after it (1B, 1D) no code takes (was
# loaded_table_04107A)
04107A  data  attract_lisa_scene_picture_2
# 0404A5 "LDU #$7089" in attract_marge_scene_start, the second it puts in (was loaded_table_041089)
041089  data  attract_marge_scene_picture_2
# 04049A "LDU #$708E" in attract_marge_scene_start, the first (object 14) (was loaded_table_04108E)
04108E  data  attract_marge_scene_picture_1
# 0404D0 "LDU #$7093" in attract_marge_scene_start: the one that moves (object 18, speeds FA00 and 01C0) (was
# loaded_table_041093)
041093  data  attract_marge_scene_moving_picture
# 04066A "LDU #$7098" in attract_leap_start, the second (was loaded_table_041098)
041098  data  attract_leap_picture_2
# 0404B5 "LDU #$709D" in attract_marge_scene_start, the third (was loaded_table_04109D)
04109D  data  attract_marge_scene_picture_3
# 0404C1 "LDU #$70A2" in attract_marge_scene_start, the fourth (was loaded_table_0410A2)
0410A2  data  attract_marge_scene_picture_4
# 04065E "LDU #$70A7" in attract_leap_start, the first, the one that leaps (z speed 0C00) (was loaded_table_0410A7)
0410A7  data  attract_leap_picture_1
# 040675 "LDU #$70AC" in attract_leap_start, the third (was loaded_table_0410AC)
0410AC  data  attract_leap_picture_3
# 04025F "LDU #$70B1; LBSR $676D" in attract_bart_profile_start: his two pictures (was loaded_table_0410B1)
0410B1  data  attract_bart_profile_pictures
# 04031B "LDU #$70BB" in attract_homer_profile_start (was loaded_table_0410BB)
0410BB  data  attract_homer_profile_pictures
# 0403FF "LDU #$70C5" in attract_lisa_profile_start (was loaded_table_0410C5)
0410C5  data  attract_lisa_profile_pictures
# 0405C9 "LDU #$70CF" in attract_marge_profile_start, Marge's (was loaded_table_0410CF)
0410CF  data  attract_marge_profile_pictures
# 0405CF "LDU #$70D9" in attract_marge_profile_start, Maggie's (animation 22) (was loaded_table_0410D9)
0410D9  data  attract_maggie_profile_pictures

# ---- bank 20: the top line's tile pictures (width, height, colour, a tile each: tile = character - 30) ----
# 040B76, 040B80 "LDU #$7405; LDA #$80; BSR $6B88" in continue_erase_count: 8 x 8 tiles over the count (was
# indexed_table_041405)
041405  data  continue_count_blank_picture
# 040B1B, 040B2B "LDU #$76A3" in continue_draw and continue_end: CONTINUE? (1A x 3) (was indexed_table_0416A3)
0416A3  data  continue_picture
# 040B3C "LDU #$76F4" in continue_end and game_over_draw: GAME OVER (1A x 3) (was indexed_table_0416F4)
0416F4  data  game_over_picture
# 040926 "LDU #$7745; CLRA; LBSR $6B88" in gauges_draw: 6 x 1, tiles 13 22 15 14 19 24 = CREDIT (was
# indexed_table_041745)
041745  data  credit_picture
# 0409D1 "LDU #$777A" in gauges_byte_to_bcd ("B in BCD in A"): each bit's value in BCD, 01 02 04 08 16 32 64 99 (was
# loaded_table_04177A)
04177A  data  bcd_bit_values

# ---- bank 2F: the test mode and the EEPROM ----
# 05E39F "LDU #$7B65" in test_print_off_on: "ON" and C0 (the test mode text's end) (was loaded_table_05FB65)
05FB65  data  test_text_on
# 05E399 "LDU #$7B68" in test_print_off_on: "OFF" (was loaded_table_05FB68)
05FB68  data  test_text_off
# 05E932 "LDX #$7C7C; LBRA $69E5" in eeprom_send_unlock: the values written to 1FC2 one after another (bit 3 CS, bit
# 4 CLK, bit 7 DI: 08 18 a 0, 88 98 a 1), up to FF (was indexed_table_05FC7C)
05FC7C  data  eeprom_unlock_bits
# 05E938 "LDX #$7C9A" in eeprom_send_write (was indexed_table_05FC9A)
05FC9A  data  eeprom_write_bits
# 05E98A "LDX #$7CC7" in eeprom_deselect: 00 10 00 FF (was indexed_table_05FCC7)
05FCC7  data  eeprom_deselect_bits
# 05E9A1 "LDX #$7CCC" in eeprom_send_lock (was indexed_table_05FCCC)
05FCCC  data  eeprom_lock_bits
# 05E9E0 "LDX #$7CF7" in unused_eeprom_send_ones: eight 1 bits (88 98 eight times), FF (was indexed_table_05FCF7)
05FCF7  data  eeprom_ones_bits
# 05E9A6 "LDX #$7D08" in eeprom_send_read (was indexed_table_05FD08)
05FD08  data  eeprom_read_bits
# 05E9AB "LDX #$7D23; LDB #$08; ...; LDA ,X+" in eeprom_receive_data: the values written to 1FC2 to clock the 8 bits
# of a byte in (08 18 eight times), then 00 10 00 (was loaded_table_05FD23 in the C, indexed_table_05FD23 in today's
# walk)
05FD23  data  eeprom_receive_bits
# 05EA46 "LDU #$7D36; LDA #$68; LDB ,U+; CMPB #$FF" in eeprom_write_defaults ("Writes the factory settings from 68
# on"): 00 00 00 00 01 01 01 00 00 01 00, FF its end (was loaded_table_05FD36 in the C, indexed_table_05FD36 today)
05FD36  data  eeprom_factory_settings

# ---- the fixed program ----
# 078C61 "LDX #$8000; LDU #$8000; LBSR $8E63" (the ROM check sums the fixed program from its start): 8000-8592, FF
# fill up to the jump table at 8593. The C also gives this name to the number 8000 loaded into D (sound command 80 00
# and others: "d = loaded_table_078000_ADDRESS"), which is no address (was loaded_table_078000)
078000  data  fixed_program_start
# 078941 "LDX #$E380; LDB #$50; LDA ,X+; STA ,U+" in boot: the high score table as it starts, 10 records of 8 (BAT,
# HOM, LIS, MAR, MAG, INC, SIM, MAT, FOX, KON and their scores) (was loaded_table_07E380)
07E380  data  default_high_scores
# 0789EF "LDU #$E3D0; LDX #$2313; ...; LDA ,U+; SUBA #$30" in boot: "@11F@BAD@" three times, the RAM chips' BAD
# texts of the RAM ROM CHECK (was loaded_table_07E3D0)
07E3D0  data  ram_check_bad_texts
# 078E91 "LDX #$E41B; TSTB; BEQ; ABX" in print_check_result ("Prints OK, or BAD"): "OK@" and "BAD" (was
# loaded_table_07E41B)
07E41B  data  check_result_texts
# 07BA93 "LDX #$E89D" in play_stage_music: the music lists by scene (E8CD, E8D1 ...) (was indexed_table_07E89D)
07E89D  data  stage_music_lists
# 07BA98 "LDX #$E8B5" in resume_stage_music ("from its own table"): the lists by scene after a continue, then the
# lists' records (was indexed_table_07E8B5)
07E8B5  data  resumed_stage_music_lists
# 07E1CD "LDY #$F296; LBRA $CA8A" in spawn_kind_90_effect: the child object record 07CA8A takes (x, y, z offsets 0,
# list 1, state 0, type 04) (was loaded_table_07F296)
07F296  data  fireman_goon_effect_child
# 07CB7E "LDU #$F2EC; ASLA; JSR [A,U]" in run_enemies: the enemies' handlers by type, with enemy_banks (07F387) after
# them; its first words are the negative types' (was loaded_table_07F2EC)
07F2EC  data  enemy_type_handlers
# 07CBBF "LDU #$F40D; ASLA; JSR [A,U]" in run_list_1_objects, with object_list_1_banks (07F4B0) (was
# loaded_table_07F40D)
07F40D  data  object_list_1_type_handlers
# 07CBF2 "LDU #$F4F4; ASLA; JSR [A,U]" in run_child_objects, with child_object_banks (was loaded_table_07F4F4)
07F4F4  data  child_object_type_handlers
# 07D65E "LDU #$F5A2; ASLA; JSR [A,U]" in enemy_attack: the enemies' actions by field 28, with action_banks (was
# loaded_table_07F5A2)
07F5A2  data  enemy_action_handlers

# ======== the records the walk found by the routines that take them ========

# 022F9D "LDY #$7AE9" in stage_7_boss_order_throw: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 00 08 32 (was child_object_023AE9)
023AE9  data  stage_7_boss_order_throw_child
# 0275D0 "LDU #$7F43" in story_1_marge_walks_in: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4A 40 11 02 01 C0 00 A0 00 00 (was object_start_027F43)
027F43  data  story_1_marge_start
# 0275EE "LDU #$7F4D" in story_1_homer_walks_in: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4B 00 01 01 01 A0 00 B0 00 00 (was object_start_027F4D)
027F4D  data  story_1_homer_start
# 027622 "LDU #$7F57" in story_1_bart_walks_in: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4B C0 02 01 01 D0 00 C0 00 00 (was object_start_027F57)
027F57  data  story_1_bart_start
# 027640 "LDU #$7F61" in story_1_lisa_walks_in: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4C 80 03 01 01 B0 00 D0 00 00 (was object_start_027F61)
027F61  data  story_1_lisa_start
# 027773 "LDU #$7F6B" in story_1_text_appears: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4F 80 0E 28 00 A0 00 F8 00 00 (was object_start_027F6B)
027F6B  data  story_1_text_start
# 027689 "LDU #$7F75" in story_1_smithers_runs_in: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4F E0 9C 00 01 00 00 F8 00 00 (was object_start_027F75)
027F75  data  story_1_smithers_start
# 02770A "LDU #$7F7F" in story_1_first_goon_appears: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 50 40 80 37 00 C0 00 F0 00 00 (was object_start_027F7F)
027F7F  data  story_1_first_goon_start
# 027727 "LDU #$7F89" in story_1_second_goon_appears: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 50 A0 80 37 00 80 00 F0 00 00 (was object_start_027F89)
027F89  data  story_1_second_goon_start
# 0272B3 "LDU #$7F9D" in story_1_set_up_street: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 51 C0 04 08 01 58 00 E8 00 18 (was object_start_027F9D)
027F9D  data  story_1_street_object_start_1
# 0272B9 "LDU #$7FB1" in story_1_set_up_street: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 52 80 0F 16 01 38 00 88 00 40 (was object_start_027FB1)
027FB1  data  story_1_street_object_start_2
# 02734A "LDU #$7FBB" in story_1_street: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4F 80 0E 25 00 E0 01 00 00 00 (was object_start_027FBB)
027FBB  data  story_1_street_text_start
# 0273D0 "LDU #$7FC5" in story_1_redraw: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4F 80 0E 25 00 E0 01 00 00 00 (was object_start_027FC5)
027FC5  data  story_1_redraw_text_start
# 0274AD "LDU #$7FCF" in story_1_pan_right: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4F 80 0E 26 00 DA 01 08 00 00 (was object_start_027FCF)
027FCF  data  story_1_pan_text_start
# 027518 "LDU #$7FD9" in story_1_last_view: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4F 80 0E 27 01 51 00 FE 00 00 (was object_start_027FD9)
027FD9  data  story_1_last_view_text_start
# 0276D0 "LDU #$7FE3" in story_1_smithers_drop: an object to start (its place in RAM, kind and animation, x, y, z) that 0277D6 takes in U; u8 4D 40 9C 09 00 D0 00 F0 00 00 (was object_start_027FE3)
027FE3  data  story_1_smithers_drop_start
# 0280FE "LDU #$79B0" in goon_base_set_up: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8000 hit_box_029800 08 01 (was object_setup_0299B0)
0299B0  data  goon_base_object_setup
# 02836C "LDY #$79B6", 028382 "LDY #$79B6", 028521 "LDY #$79B6" in shovel_goon_rush_in_swing, hat_goon_waiting_step_forward: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_0299B6)
0299B6  data  goon_entrance_body_box
# 0282C1 "LDY #$79BE", 0284E1 "LDY #$79BE" in hat_goon_run_across_set_up, hat_goon_waiting_show: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 0800 0008 (was hit_box_0299BE)
0299BE  data  hat_goon_entrance_box
# 02837C "LDY #$79C6" in shovel_goon_rush_in_swing: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0406 0804 0420 0004 (was hit_box_0299C6)
0299C6  data  shovel_goon_rush_in_swing_box
# 028191 "LDU #$79CE" in goon_balloon: a jump table of the object's handlers by its state (code addresses), which the walk's 'more hit boxes' took for hit boxes; record hit_box 6197 61DD 61EB 61F5 (was hit_box_0299CE)
0299CE  data  goon_balloon_states
# 028197 "LDU #$79D6" in goon_balloon_set_up: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8036 hit_box_0299B6 3C 00 (was object_setup_0299D6)
0299D6  data  goon_balloon_setup
# 028219 "LDY #$79EC" in goon_descent_set_up: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 40 01 00 0D (was child_object_0299EC)
0299EC  data  goon_descent_child
# 02854D "LDU #$7AA8" in goon_walk_in_set_up: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8002 hit_box_0299B6 08 01 (was object_setup_029AA8)
029AA8  data  goon_walk_in_setup
# 028CAB "LDY #$7BEE" in goon_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 1004 0810 0020 (was hit_box_029BEE)
029BEE  data  goon_strike_hit_box
# 028CB5 "LDY #$7BF6", 028DB3 "LDY #$7BF6" in goon_strike_recover, goon_jump_attack_fall: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_029BF6)
029BF6  data  goon_action_body_box
# 028D07 "LDY #$7BFE" in goon_quick_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 1004 0C10 0028 (was hit_box_029BFE)
029BFE  data  goon_quick_strike_hit_box
# 028D2A "LDY #$7C06" in goon_quick_strike_2_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0804 0820 0018 (was hit_box_029C06)
029C06  data  goon_quick_strike_2_hit_box
# 028DC5 "LDY #$7C0E" in goon_jump_attack_fall: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0801 0804 0808 0018 (was hit_box_029C0E)
029C0E  data  goon_jump_attack_fall_box
# 028BCD "LDY #$7C16" in goon_dash_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0804 0418 0020 (was hit_box_029C16)
029C16  data  goon_dash_strike_hit_box
# 028B2D "LDY #$7C1E" in goon_approach_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0407 0404 0420 0004 (was hit_box_029C1E)
029C1E  data  goon_approach_strike_hit_box
# 028F7B "LDU #$7E4B" in bomb_goon_set_up: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B601 hit_box_029CD7 08 01 (was object_setup_029E4B)
029E4B  data  bomb_goon_setup
# 028FC1 "LDU #$7E5D" in hat_goon_set_up: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8401 hit_box_029CD7 08 01 (was object_setup_029E5D)
029E5D  data  hat_goon_setup
# 029012 "LDU #$7E6F" in umbrella_goon_set_up: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8201 hit_box_029CD7 08 01 (was object_setup_029E6F)
029E6F  data  umbrella_goon_setup
# 02905A "LDU #$7E81" in shovel_goon_set_up: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8301 hit_box_029CD7 08 01 (was object_setup_029E81)
029E81  data  shovel_goon_setup
# 02915B "LDY #$7E87", 0291E6 "LDY #$7E87", 029266 "LDY #$7E87" in armed_goon_strike_recover, umbrella_goon_long_recover, goon_run_through_end: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_029E87)
029E87  data  armed_goon_body_box
# 029116 "LDY #$7E8F" in shovel_goon_close_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0804 101C 0028 (was hit_box_029E8F)
029E8F  data  shovel_goon_close_hit_box
# 02918C "LDY #$7E97" in shovel_goon_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0804 1020 0018 (was hit_box_029E97)
029E97  data  shovel_goon_hit_box
# 029151 "LDY #$7E9F" in shovel_goon_far_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 1004 0848 0018 (was hit_box_029E9F)
029E9F  data  shovel_goon_far_hit_box
# 02928C "LDY #$7EA7" in goon_strike_and_run_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 080A 0804 0420 0004 (was hit_box_029EA7)
029EA7  data  goon_strike_and_run_hit_box
# 029211 "LDY #$7EAF" in umbrella_goon_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 1004 1020 0018 (was hit_box_029EAF)
029EAF  data  umbrella_goon_hit_box
# 029237 "LDY #$7EB7" in umbrella_goon_charge_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0804 0808 0018 (was hit_box_029EB7)
029EB7  data  umbrella_goon_charge_hit_box
# 0291AF "LDY #$7EBF" in umbrella_goon_quick_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0804 0828 0018 (was hit_box_029EBF)
029EBF  data  umbrella_goon_quick_hit_box
# 0291D2 "LDY #$7EC7" in umbrella_goon_long_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 080A 1004 102C 0018 (was hit_box_029EC7)
029EC7  data  umbrella_goon_long_hit_box
# 0290B3 "LDY #$7ED5" in bomb_goon_throw_release: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 18 00 00 28 16 (was child_object_029ED5)
029ED5  data  bomb_goon_throw_release_child
# 0292AE "LDY #$7F2F" in hat_goon_throw_release: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 18 FF FF 20 02 (was child_object_029F2F)
029F2F  data  hat_goon_throw_release_child
# 02934D "LDY #$7F3D" in goon_bomb_fly: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C05 1004 0800 0008 (was hit_box_029F3D)
029F3D  data  goon_bomb_fly_box
# 029312 "LDU #$7F55" in goon_bomb_set_up: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8034 hit_box_029F35 3C 00 (was object_setup_029F55)
029F55  data  goon_bomb_setup
# 0293D7 "LDY #$7F6D" in goon_bomb_run_in_throw: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 18 00 00 28 16 (was child_object_029F6D)
029F6D  data  goon_bomb_run_in_throw_child
# 029550 "LDY #$7F73" in goon_from_below_land: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_029F73)
029F73  data  goon_from_below_body_box
# 0294D1 "LDY #$7F7B" in goon_from_below_set_up: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1804 1000 0010 (was hit_box_029F7B)
029F7B  data  goon_from_below_entrance_box
# 02A0AC "LDU #$75E8", 02A0E3 "LDU #$75E8" in fat_goon_setup and unused_become_fat_goon (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 07 00 00 00 1A E6 01 08 06 01 00 33 33 9A (was enemy_behaviour_02B5E8)
02B5E8  data  fat_goon_behaviour
# 02A093 "LDU #$764C", 02A0CD "LDU #$764C" in fat_goon_setup, unused_02A0CD: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8101 hit_box_02B5E0 0C 01 (was object_setup_02B64C)
02B64C  data  fat_goon_object_setup
# 02A149 "LDU #$77C6" in fat_goon_base_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8100 hit_box_02B652 0C 01 (was object_setup_02B7C6)
02B7C6  data  fat_goon_base_object_setup
# 02A515 "LDY #$78AC" in fat_goon_thrower_pick_up: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 08 00 00 44 01 06 28 (was child_object_02B8AC)
02B8AC  data  fat_goon_thrower_pick_up_child
# 02A6B1 "LDY #$78E6" in fat_goon_descent_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 40 01 00 34 (was child_object_02B8E6)
02B8E6  data  fat_goon_descent_child
# 02A77B "LDU #$78FE" in descent_balloon_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8036 hit_box_02B7F0 3C 00 (was object_setup_02B8FE)
02B8FE  data  descent_balloon_setup
# 02A873 "LDY #$7904", 02A906 "LDY #$7904", 02A96B "LDY #$7904" in fat_goon_bump_stop, fat_goon_strike_recover, fat_goon_body_slam_fall: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_02B904)
02B904  data  fat_goon_body_box
# 02A84F "LDY #$790C" in fat_goon_bump_move: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 080A 2008 0800 0028 (was hit_box_02B90C)
02B90C  data  fat_goon_bump_move_box
# 02A8FF "LDY #$7914" in fat_goon_walk_up_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0801 0804 0808 0018 (was hit_box_02B914)
02B914  data  fat_goon_walk_up_hit_box
# 02A97F "LDY #$791C" in fat_goon_body_slam_fall: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0807 1008 0808 0008 (was hit_box_02B91C)
02B91C  data  fat_goon_body_slam_fall_box
# 02A9F4 "LDY #$7924" in fat_goon_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0801 0804 0818 0028 (was hit_box_02B924)
02B924  data  fat_goon_strike_hit_box
# 02AA1C "LDY #$792C" in fat_goon_reach_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0801 0804 1018 0020 (was hit_box_02B92C)
02B92C  data  fat_goon_reach_strike_hit_box
# 02AA46 "LDY #$7934" in fat_goon_heavy_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C07 1804 1820 0018 (was hit_box_02B934)
02B934  data  fat_goon_heavy_strike_hit_box
# 02AD27 "LDY #$79C5" in cleared_wave_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF C0 00 00 40 01 40 FB (was child_object_02B9C5)
02B9C5  data  cleared_wave_child_1
# 02AD39 "LDY #$79CD" in cleared_wave_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 40 01 C0 FB (was child_object_02B9CD)
02B9CD  data  cleared_wave_child_2
# 02AD5B "LDY #$79D5" in cleared_wave_wait: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 A0 FF D0 00 00 01 EB (was child_object_02B9D5)
02B9D5  data  cleared_wave_child_3
# 02AD61 "LDY #$79DD" in cleared_wave_wait: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF 60 FF D0 00 00 01 00 (was child_object_02B9DD)
02B9DD  data  cleared_wave_child_4
# 02AE47 "LDU #$7D72" in moe_spawner_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9E06 hit_box_02BD4C 3C 00 (was object_setup_02BD72)
02BD72  data  moe_spawner_setup
# 02AE63 "LDY #$7D78" in moe_spawner_put_in_object: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF 9A 00 00 00 01 00 22 (was child_object_02BD78)
02BD78  data  moe_spawner_object_child
# 02AE76 "LDU #$7D88" in burger_eater_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup AC00 hit_box_02BD54 3C 00 (was object_setup_02BD88)
02BD88  data  burger_eater_setup
# 02AE8B "LDY #$7D8E" in burger_eater_drop_food: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF E8 FF F8 00 02 12 12 (was child_object_02BD8E)
02BD8E  data  burger_eater_drop_food_child
# 02AEA5 "LDU #$7DA2" in drink_vendor_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup AB01 hit_box_02BD4C 3C 00 (was object_setup_02BDA2)
02BDA2  data  drink_vendor_setup
# 02AED7 "LDY #$7DA8" in drink_vendor_let_out: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF EC FF EC 00 01 1E 01 (was child_object_02BDA8)
02BDA8  data  drink_vendor_let_out_child
# 02AF36 "LDU #$7DBC" in krustyland_door_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F25 hit_box_02BD4C 3C 00 (was object_setup_02BDBC)
02BDBC  data  krustyland_door_setup
# 02B00D "LDY #$7E0B" in caged_gorilla_leaper_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF F0 00 08 00 01 00 3F (was child_object_02BE0B)
02BE0B  data  caged_gorilla_leaper_child
# 02AFF8 "LDU #$7E13" in caged_gorilla_leaper_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B203 hit_box_02BD64 3C 00 (was object_setup_02BE13)
02BE13  data  caged_gorilla_leaper_setup
# 02B0AF "LDU #$7E1D" in prop_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0500 hit_box_02BD4C 3C 00 (was object_setup_02BE1D)
02BE1D  data  prop_setup
# 02B0EB "LDU #$7E57" in poster_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup AA05 hit_box_02BD4C 3C 00 (was object_setup_02BE57)
02BE57  data  poster_setup
# 02B105 "LDU #$7E61" in poster_pair_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup AA03 hit_box_02BD4C 3C 00 (was object_setup_02BE61)
02BE61  data  poster_pair_setup
# 02B11D "LDY #$7E67" in poster_pair_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 78 FF F0 00 01 01 EE (was child_object_02BE67)
02BE67  data  poster_pair_child
# 02B146 "LDU #$7E79" in bleeding_gums_murphy_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup CB00 hit_box_02BD5C 3C 00 (was object_setup_02BE79)
02BE79  data  bleeding_gums_murphy_setup
# 02B1A4 "LDU #$7E83" in dream_ball_fling_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup D107 hit_box_02BD4C 3C 00 (was object_setup_02BE83)
02BE83  data  dream_ball_fling_setup
# 02B211 "LDU #$7ED1" in cemetery_piece_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup C600 hit_box_02BE99 3C 00 (was object_setup_02BED1)
02BED1  data  cemetery_piece_setup
# 02B24A "LDU #$7EE5" in floor_blocker_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F03 hit_box_02BED7 3C 00 (was object_setup_02BEE5)
02BEE5  data  floor_blocker_setup
# 02B392 "LDU #$7F3F" in goon_hat_throw_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 842A hit_box_02BF17 04 00 (was object_setup_02BF3F)
02BF3F  data  goon_hat_throw_setup
# 02B44E "LDU #$7F63" in police_car_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup C301 hit_box_02BF45 3C 01 (was object_setup_02BF63)
02BF63  data  police_car_setup
# 02CD3A "LDY #$7A98", 02D674 "LDY #$7A98" in obstacle_settle, dreamland_obstacle_settle: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 00FF 1008 1C00 FC0C (was hit_box_02DA98)
02DA98  data  obstacle_settle_box
# 02CC19 "LDY #$7AA0", 02CD6C "LDY #$7AA0", 02CDC7 "LDY #$7AA0" in obstacle_knocked, obstacle_throw, obstacle_rebound_rise: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C14 0808 0800 0008 (was hit_box_02DAA0)
02DAA0  data  obstacle_knocked_box
# 02C5EB "LDY #$7AA8" in carried_obstacle_fly: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C0A 0808 0800 0008 (was hit_box_02DAA8)
02DAA8  data  carried_obstacle_fly_box
# 02C701 "LDY #$7AB8" in throwable_throw: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0813 0808 0800 0008 (was hit_box_02DAB8)
02DAB8  data  throwable_throw_box
# 02C715 "LDY #$7AC0" in throwable_rebound: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0011 0404 0400 0004 (was hit_box_02DAC0)
02DAC0  data  throwable_rebound_box
# 02C1FB "LDY #$7AD0" in timed_throwable_throw: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0811 0808 0800 0008 (was hit_box_02DAD0)
02DAD0  data  timed_throwable_throw_box
# 02C1C3 "LDY #$7AD8", 02C21A "LDY #$7AD8" in obstacle_smash, timed_throwable_fall: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0805 0808 0800 0008 (was hit_box_02DAD8)
02DAD8  data  obstacle_smash_box
# 02C8F2 "LDY #$7B10" in platform_scenery_launch: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 1413 2010 1020 0010 (was hit_box_02DB10)
02DB10  data  platform_scenery_launch_box
# 02D525 "LDY #$7B20" in running_animal_thrown: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0813 0410 1000 0008 (was hit_box_02DB20)
02DB20  data  running_animal_thrown_box
# 02D59B "LDY #$7B30" in bouncing_throwable_throw: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C14 1010 0800 0008 (was hit_box_02DB30)
02DB30  data  bouncing_throwable_throw_box
# 02C078 "LDY #$7B52" in cemetery_obstacle_break: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 FF F8 00 13 (was child_object_02DB52)
02DB52  data  cemetery_obstacle_break_child
# 02C0C9 "LDU #$7BA8" in cemetery_obstacle_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0506 hit_box_02DAC8 04 00 (was object_setup_02DBA8)
02DBA8  data  cemetery_obstacle_setup
# 02C23F "LDU #$7BDC" in moes_street_scenery_riser_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 1002 hit_box_02DB18 3C 00 (was object_setup_02DBDC)
02DBDC  data  moes_street_scenery_riser_setup
# 02C2DF "LDU #$7BEC" in moes_street_scenery_dropper_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 1001 hit_box_02DB18 3C 00 (was object_setup_02DBEC)
02DBEC  data  moes_street_scenery_dropper_setup
# 02C3FF "LDU #$7C28" in police_car_door_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F14 hit_box_02DB18 3C 00 (was object_setup_02DC28)
02DC28  data  police_car_door_setup
# 02C553 "LDU #$7C91" in carried_obstacle_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0506 hit_box_02DA98 3C 00 (was object_setup_02DC91)
02DC91  data  carried_obstacle_setup
# 02C6C5 "LDU #$7CB9" in throwable_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0400 hit_box_02DAB0 08 00 (was object_setup_02DCB9)
02DCB9  data  throwable_setup
# 02C820 "LDU #$7CDB" in platform_scenery_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F00 hit_box_02DB08 3C 00 (was object_setup_02DCDB)
02DCDB  data  platform_scenery_setup
# 02C911 "LDY #$7D23" in platform_scenery_crash: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 50 FF F8 00 0D (was child_object_02DD23)
02DD23  data  platform_scenery_crash_debris_1
# 02C917 "LDY #$7D29" in platform_scenery_crash: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF F0 FF F8 00 0D (was child_object_02DD29)
02DD29  data  platform_scenery_crash_debris_2
# 02C955 "LDU #$7D37" in scenery_debris_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F02 hit_box_02DB08 3C 00 (was object_setup_02DD37)
02DD37  data  scenery_debris_setup
# 02C9E7 "LDU #$7D7D" in charging_scenery_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F20 hit_box_02DB00 3C 00 (was object_setup_02DD7D)
02DD7D  data  charging_scenery_setup
# 02CA86 "LDY #$7D8B" in charging_scenery_wait_target: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF F0 00 08 00 00 02 06 (was child_object_02DD8B)
02DD8B  data  charging_scenery_goon_left
# 02CA93 "LDY #$7D93" in charging_scenery_wait_target: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 10 00 08 00 00 02 06 (was child_object_02DD93)
02DD93  data  charging_scenery_goon_right
# 02C16A "LDU #$7DCD", 02CB82 "LDU #$7DCD" in heavy_obstacle_start, obstacle_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0502 hit_box_02DA98 3C 00 (was object_setup_02DDCD)
02DDCD  data  heavy_obstacle_setup
# 02CE41 "LDU #$7DDF" in solid_scenery_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F16 hit_box_02DB08 3C 00 (was object_setup_02DDDF)
02DDDF  data  solid_scenery_setup
# 02CE6F "LDU #$7DEF" in boulder_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup AF03 hit_box_02DAF0 3C 00 (was object_setup_02DDEF)
02DDEF  data  boulder_setup
# 02D043 "LDU #$7E0B" in gorge_rock_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup AF02 hit_box_02DAF8 3C 00 (was object_setup_02DE0B)
02DE0B  data  gorge_rock_setup
# 02D098 "LDU #$7E15" in shaken_bit_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 090E hit_box_02DB00 3C 00 (was object_setup_02DE15)
02DE15  data  shaken_bit_setup
# 02D0E5 "LDU #$7E23" in shaken_object_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 101F hit_box_02DB00 3C 00 (was object_setup_02DE23)
02DE23  data  shaken_object_setup
# 02D142 "LDY #$7E29" in shaken_object_land: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 10 18 (was child_object_02DE29)
02DE29  data  shaken_object_land_child
# 02D199 "LDY #$7E75" in shaking_scenery_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF 80 FF FD B8 01 81 1C (was child_object_02DE75)
02DE75  data  shaking_scenery_child_1
# 02D19F "LDY #$7E7D" in shaking_scenery_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 50 FF FD A0 01 82 1C (was child_object_02DE7D)
02DE7D  data  shaking_scenery_child_2
# 02D1A5 "LDY #$7E85" in shaking_scenery_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FE F0 FF BD 20 01 83 1C (was child_object_02DE85)
02DE85  data  shaking_scenery_child_3
# 02D1AF "LDY #$7E8D" in shaking_scenery_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 10 00 01 28 01 02 2F (was child_object_02DE8D)
02DE8D  data  shaking_scenery_child_4
# 02D183 "LDU #$7EAD" in shaking_scenery_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F04 hit_box_02DAE8 3C 00 (was object_setup_02DEAD)
02DEAD  data  shaking_scenery_setup
# 02D2F9 "LDY #$7EC1" in shaking_scenery_drop_bit: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 FF FE 50 01 00 23 (was child_object_02DEC1)
02DEC1  data  shaking_scenery_bit_1
# 02D2FF "LDY #$7EC9" in shaking_scenery_drop_bit: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 FF FE 50 01 01 23 (was child_object_02DEC9)
02DEC9  data  shaking_scenery_bit_2
# 02D30E "LDY #$7ED5" in shaking_scenery_drop_food: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 60 02 00 0E (was child_object_02DED5)
02DED5  data  shaking_scenery_drop_food_child
# 02D437 "LDU #$7F0B" in running_animal_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8600 hit_box_02DB18 3C 01 (was object_setup_02DF0B)
02DF0B  data  running_animal_setup
# 02D55C "LDU #$7F25" in bouncing_throwable_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 041A hit_box_02DB28 3C 00 (was object_setup_02DF25)
02DF25  data  bouncing_throwable_setup
# 02D5E2 "LDU #$7F41" in dreamland_obstacle_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0500 hit_box_02DB38 3C 00 (was object_setup_02DF41)
02DF41  data  dreamland_obstacle_setup
# 02D692 "LDU #$7F75" in bird_item_update: a jump table of the object's handlers by its state (code addresses), which the walk's 'more hit boxes' took for hit boxes; record hit_box 769B 76BB 76D4 76FD (was hit_box_02DF75)
02DF75  data  bird_item_states
# 02D69B "LDU #$7F7D" in bird_item_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8B00 hit_box_02DF6D 7F 00 (was object_setup_02DF7D)
02DF7D  data  bird_item_setup
# 02D800 "LDY #$7F83" in woman_in_apron_device_strike_end: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1008 2000 F820 (was hit_box_02DF83)
02DF83  data  woman_in_apron_body_box
# 02D7D7 "LDY #$7F8B" in woman_in_apron_device_strike: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0402 1808 2000 F820 (was hit_box_02DF8B)
02DF8B  data  woman_in_apron_device_strike_box
# 02D71F "LDU #$7F9B" in rising_scenery_update: a jump table of the object's handlers by its state (code addresses), which the walk's 'more hit boxes' took for hit boxes; record hit_box 7728 776E 7790 03D0 (was hit_box_02DF9B)
02DF9B  data  rising_scenery_steps
# 02D728 "LDU #$7FA5" in rising_scenery_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F17 hit_box_02DF9B 3C 00 (was object_setup_02DFA5)
02DFA5  data  rising_scenery_setup
# 02D7B0 "LDU #$7FBB" in woman_in_apron_device_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F06 hit_box_02DF83 00 00 (was object_setup_02DFBB)
02DFBB  data  woman_in_apron_device_setup
# 02D88B "LDY #$7FD1" in woman_in_apron_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 FF F8 00 01 00 26 (was child_object_02DFD1)
02DFD1  data  woman_in_apron_child
# 02D86A "LDU #$7FD9" in woman_in_apron_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8701 hit_box_02DF83 00 00 (was object_setup_02DFD9)
02DFD9  data  woman_in_apron_setup
# 02DA0A "LDU #$7FED" in rabbit_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9500 hit_box_02DF83 04 00 (was object_setup_02DFED)
02DFED  data  rabbit_setup
# 02E07B "LDU #$7A0C" in looping_scenery_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F00 hit_box_02FA00 3C 00 (was object_setup_02FA0C)
02FA0C  data  looping_scenery_setup
# 02E0EA "LDU #$7A50" in unused_kind_b7_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B714 hit_box_02FA40 3C 00 (was object_setup_02FA50)
02FA50  data  unused_kind_b7_setup
# 02E1D5 "LDU #$7A62" in unused_obstacle_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0506 hit_box_02E151 04 00 (was object_setup_02FA62)
02FA62  data  unused_obstacle_setup
# 02E217 "LDU #$7A96" in food_jump_out_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0900 hit_box_02E189 3C 00 (was object_setup_02FA96)
02FA96  data  food_jump_out_setup
# 02E2DD "LDU #$7ADE", 02E367 "LDU #$7ADE" in food_start, dropped_food_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0900 hit_box_02E181 3C 00 (was object_setup_02FADE)
02FADE  data  food_setup
# 02E39E "LDU #$7AFA" in girl_with_food_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup A500 hit_box_02E179 3C 00 (was object_setup_02FAFA)
02FAFA  data  girl_with_food_setup
# 02E4B6 "LDU #$7B5E" in sideshow_bob_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup A901 hit_box_02E171 3C 00 (was object_setup_02FB5E)
02FB5E  data  sideshow_bob_setup
# 02E4E3 "LDY #$7B64" in sideshow_bob_drop_food: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF D0 00 00 20 02 08 12 (was child_object_02FB64)
02FB64  data  sideshow_bob_drop_food_child
# 02E5D3 "LDU #$7B80" in carried_item_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup A801 hit_box_02E191 3C 00 (was object_setup_02FB80)
02FB80  data  carried_item_setup
# 02E62C "LDU #$7BC3" in bystander_update: a jump table of the object's handlers by its state (code addresses), which the walk's 'more hit boxes' took for hit boxes; record hit_box 6635 6673 6686 66A1 (was hit_box_02FBC3)
02FBC3  data  bystander_states
# 02E635 "LDU #$7BD9" in bystander_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup A803 hit_box_02FBBB 3C 00 (was object_setup_02FBD9)
02FBD9  data  bystander_setup
# 02E6AE "LDU #$7C53" in fireman_goon_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9000 hit_box_02FBDF 14 01 (was object_setup_02FC53)
02FC53  data  fireman_goon_object_setup
# 02E7C1 "LDY #$7C73" in fireman_goon_put_in_missile: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 40 00 00 10 0A (was child_object_02FC73)
02FC73  data  fireman_goon_put_in_missile_child
# 02E7E4 "LDU #$7C81" in fireman_goon_missile_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9013 hit_box_02FBE7 00 00 (was object_setup_02FC81)
02FC81  data  fireman_goon_missile_setup
# 02E834 "LDU #$7C99" in kent_brockman_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B300 hit_box_02FC87 3C 00 (was object_setup_02FC99)
02FC99  data  kent_brockman_setup
# 02EFF2 "LDY #$7CA6" in one_eared_rabbit_strike_recover: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_02FCA6)
02FCA6  data  one_eared_rabbit_body_box
# 02EFE8 "LDY #$7CB6" in one_eared_rabbit_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0801 1004 0430 0018 (was hit_box_02FCB6)
02FCB6  data  one_eared_rabbit_strike_hit_box
# 02F0FF "LDY #$7CBE", 02F14C "LDY #$7CBE", 02F1BB "LDY #$7CBE" in clown_on_ball_strike, clown_on_ball_jump_fall, clown_on_ball_charge_wind_up, clown_on_ball_charge: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 3000 0030 (was hit_box_02FCBE)
02FCBE  data  clown_on_ball_body_box
# 02F1CC "LDY #$7CC6" in clown_on_ball_strike, clown_on_ball_jump_fall, clown_on_ball_charge_wind_up, clown_on_ball_charge: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 040A 2004 0800 0018 (was hit_box_02FCC6)
02FCC6  data  clown_on_ball_strike_box
# 02ED8A "LDY #$7CCE", 02EDE2 "LDY #$7CCE", 02EEC1 "LDY #$7CCE" in teacup_goon_ready, teacup_goon_keep_on_screen, teacup_goon_charge_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1C18 2000 0020 (was hit_box_02FCCE)
02FCCE  data  teacup_goon_body_box
# 02ED43 "LDY #$7CD6", 02EEBB "LDY #$7CD6" in teacup_goon_leap_off, teacup_goon_charge_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C0A 1004 1000 0010 (was hit_box_02FCD6)
02FCD6  data  teacup_goon_leap_off_box
# 02E918 "LDY #$7DA7" in teacup_goon_ride_put_in_arms: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 1E (was child_object_02FDA7)
02FDA7  data  teacup_goon_ride_put_in_arms_child
# 02E976 "LDY #$7DAD" in teacup_goon_ride_end: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 A0 FF A0 00 00 01 00 (was child_object_02FDAD)
02FDAD  data  teacup_goon_ride_end_child
# 02E8D8 "LDU #$7DBF", 02E983 "LDU #$7DBF" in teacup_goon_ride_start, teacup_goon_ride_arm_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0402 hit_box_02FCCE 3C 00 (was object_setup_02FDBF)
02FDBF  data  teacup_goon_ride_setup
# 02E9B3 "LDY #$7DC5" in teacup_goon_ride_arm_put_in_riders: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 00 00 1A (was child_object_02FDC5)
02FDC5  data  teacup_goon_ride_arm_put_in_riders_child
# 02EA8F "LDU #$7DD3" in teacup_goon_piece_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8117 hit_box_02FCDE 3C 00 (was object_setup_02FDD3)
02FDD3  data  teacup_goon_piece_setup
# 02EB52 "LDY #$7DF3" in teacup_goon_beaten: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 10 0B (was child_object_02FDF3)
02FDF3  data  teacup_goon_beaten_child
# 02EC09 "LDU #$7E01" in teacup_goon_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8800 hit_box_02FCCE 08 01 (was object_setup_02FE01)
02FE01  data  teacup_goon_setup
# 02EF0F "LDU #$7E27" in one_eared_rabbit_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9800 hit_box_02FCA6 0C 01 (was object_setup_02FE27)
02FE27  data  one_eared_rabbit_setup
# 02F02C "LDU #$7E53" in clown_ball_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9611 hit_box_02FCAE 3C 00 (was object_setup_02FE53)
02FE53  data  clown_ball_setup
# 02F08C "LDU #$7E65" in clown_on_ball_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9610 hit_box_02FCBE 08 01 (was object_setup_02FE65)
02FE65  data  clown_on_ball_setup
# 02F3AB "LDY #$7ED7" in caged_gorilla_hit_wait: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 0820 1000 F820 (was hit_box_02FED7)
02FED7  data  caged_gorilla_body_box
# 02F3A1 "LDY #$7EDF" in caged_gorilla_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0408 0420 10FC F820 (was hit_box_02FEDF)
02FEDF  data  caged_gorilla_hit_box
# 02F2B3 "LDU #$7F23" in krustyland_bear_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup A200 hit_box_02FECF 3C 00 (was object_setup_02FF23)
02FF23  data  krustyland_bear_setup
# 02F33E "LDU #$7F35" in caged_gorilla_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B201 hit_box_02FED7 3C 00 (was object_setup_02FF35)
02FF35  data  caged_gorilla_setup
# 02F3ED "LDU #$7F49" in buzzing_chaser_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 101D hit_box_02FEE7 3C 00 (was object_setup_02FF49)
02FF49  data  buzzing_chaser_setup
# 02F507 "LDU #$7F65" in bluebird_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup A002 hit_box_02FEEF 3C 00 (was object_setup_02FF65)
02FF65  data  bluebird_setup
# 02F75C "LDU #$7FA7" in random_pose_figure_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8600 hit_box_02FEF7 3C 00 (was object_setup_02FFA7)
02FFA7  data  random_pose_figure_setup
# 02F7B6 "LDU #$7FD5" in unused_homer_object_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0100 hit_box_02FF0F 3C 01 (was object_setup_02FFD5)
02FFD5  data  unused_homer_object_setup
# 030F8C "LDY #$6FAE" in cloud_devil_drop_bolt: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 18 00 00 00 02 00 28 (was child_object_030FAE)
030FAE  data  cloud_devil_drop_bolt_child
# 030334 "LDY #$7890", 030395 "LDY #$7890" in zombie_leap_land, zombie_swipe_recover: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_031890)
031890  data  zombie_body_box
# 03038E "LDY #$7898" in zombie_swipe_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0801 0804 0818 0020 (was hit_box_031898)
031898  data  zombie_swipe_hit_box
# 030310 "LDY #$78A0" in zombie_leap_rise: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C09 0804 0800 0008 (was hit_box_0318A0)
0318A0  data  zombie_leap_rise_box
# 030536 "LDY #$78A8" in ghost_on_rope_hang: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1818 1000 0018 (was hit_box_0318A8)
0318A8  data  ghost_on_rope_body_box
# 03051E "LDY #$78B0" in ghost_on_rope_drop: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0804 0818 0018 (was hit_box_0318B0)
0318B0  data  ghost_on_rope_drop_box
# 03015E "LDU #$78C0" in zombie_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 07 00 00 00 1A E6 01 01 01 01 00 00 00 FF (was enemy_behaviour_0318C0)
0318C0  data  zombie_behaviour
# 030081 "LDU #$7982" in wandering_zombie_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9700 hit_box_0318B8 04 01 (was object_setup_031982)
031982  data  wandering_zombie_object_setup
# 030122 "LDU #$79D4" in zombie_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9100 hit_box_031890 0C 01 (was object_setup_0319D4)
0319D4  data  zombie_object_setup
# 03045F "LDU #$7A2A" in ghost_on_rope_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9A01 hit_box_0318A8 3C 01 (was object_setup_031A2A)
031A2A  data  ghost_on_rope_object_setup
# 030565 "LDU #$7A72" in rising_zombie_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9101 hit_box_031880 3C 00 (was object_setup_031A72)
031A72  data  rising_zombie_object_setup
# 030684 "LDU #$7A88" in grabbing_zombie_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 00 00 00 00 00 FF 01 01 01 01 00 00 00 FF (was enemy_behaviour_031A88)
031A88  data  grabbing_zombie_behaviour
# 03066D "LDU #$7AEC" in grabbing_zombie_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9700 hit_box_031A78 08 01 (was object_setup_031AEC)
031AEC  data  grabbing_zombie_object_setup
# 030926 "LDY #$7B0E", 030939 "LDY #$7B0E" in lumberjack_axe_recover, lumberjack_axe_rest: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_031B0E)
031B0E  data  lumberjack_body_box
# 030911 "LDY #$7B16" in lumberjack_axe_swing: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0809 200C 0820 0018 (was hit_box_031B16)
031B16  data  lumberjack_axe_swing_box
# 030AD4 "LDY #$7B1E", 030B48 "LDY #$7B1E" in gorilla_punch_end, gorilla_leap_land: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_031B1E)
031B1E  data  gorilla_body_box
# 030ACD "LDY #$7B26" in gorilla_punch_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 1004 0810 0008 (was hit_box_031B26)
031B26  data  gorilla_punch_hit_box
# 030B30 "LDY #$7B2E" in gorilla_leap_rise: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C01 1004 0808 0008 (was hit_box_031B2E)
031B2E  data  gorilla_leap_rise_box
# 030853 "LDU #$7B36" in lumberjack_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 00 00 00 00 00 FF 01 01 01 01 00 00 00 FF (was enemy_behaviour_031B36)
031B36  data  lumberjack_behaviour
# 030988 "LDU #$7B8E" in gorilla_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 00 00 00 00 00 FF 01 01 01 01 00 00 00 FF (was enemy_behaviour_031B8E)
031B8E  data  gorilla_behaviour
# 030842 "LDU #$7BF2" in lumberjack_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8D00 hit_box_031B0E 0C 01 (was object_setup_031BF2)
031BF2  data  lumberjack_object_setup
# 030977 "LDU #$7C1D" in gorilla_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9F00 hit_box_031B1E 0C 01 (was object_setup_031C1D)
031C1D  data  gorilla_object_setup
# 030B9D "LDY #$7C6F", 030E29 "LDY #$7C6F" in knight_strike_end, knight_update: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_031C6F)
031C6F  data  knight_body_box
# 030E17 "LDY #$7C77" in knight_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0404 0424 0028 (was hit_box_031C77)
031C77  data  knight_strike_hit_box
# 030C18 "LDU #$7C7F" in knight_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 00 00 00 00 00 FF 01 01 01 01 00 00 1A E6 (was enemy_behaviour_031C7F)
031C7F  data  knight_behaviour
# 030BCC "LDY #$7CE9" in knight_fall: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 30 02 80 09 (was child_object_031CE9)
031CE9  data  knight_fall_child
# 030C0A "LDU #$7CF1" in knight_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup BC00 hit_box_031C6F 0C 01 (was object_setup_031CF1)
031CF1  data  knight_object_setup
# 030E39 "LDU #$7D8B" in lightning_bolt_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup C709 hit_box_031D7F 3C 00 (was object_setup_031D8B)
031D8B  data  lightning_bolt_object_setup
# 030E8F "LDU #$7DC2" in cloud_devil_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup C701 hit_box_031D77 1C 01 (was object_setup_031DC2)
031DC2  data  cloud_devil_object_setup
# 031214 "LDU #$7EF4" in spark_shot_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0403 hit_box_031EC8 04 01 (was object_setup_031EF4)
031EF4  data  spark_shot_object_setup
# 03129D "LDU #$7F10" in belly_dancer_thrower_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8E01 hit_box_031EC0 10 01 (was object_setup_031F10)
031F10  data  belly_dancer_thrower_object_setup
# 0312CB "LDY #$7F16" in belly_dancer_thrower_throw: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 10 00 00 20 11 (was child_object_031F16)
031F16  data  belly_dancer_thrower_throw_child
# 0312F8 "LDU #$7F2A" in walking_kind_87_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8700 hit_box_031EB8 3C 01 (was object_setup_031F2A)
031F2A  data  walking_kind_87_object_setup
# 03138C "LDU #$7F44" in moe_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9E01 hit_box_031EB0 3C 01 (was object_setup_031F44)
031F44  data  moe_object_setup
# 0314E2 "LDU #$7F58" in belly_dancer_watcher_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8E01 hit_box_031EA8 3C 01 (was object_setup_031F58)
031F58  data  belly_dancer_watcher_object_setup
# 03159C "LDU #$7F74" in barney_bystander_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8C00 hit_box_031ED0 00 01 (was object_setup_031F74)
031F74  data  barney_bystander_object_setup
# 031608 "LDU #$7F92" in woman_in_green_carrier_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8A01 hit_box_031EA0 04 01 (was object_setup_031F92)
031F92  data  woman_in_green_carrier_object_setup
# 03161B "LDY #$7F98" in woman_in_green_carrier_pick_up: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 30 01 06 17 (was child_object_031F98)
031F98  data  woman_in_green_carrier_pick_up_child
# 032230 "LDY #$78A4" in bouncing_prop_bounce_off_edge: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 00FF 0C08 1800 0018 (was hit_box_0338A4)
0338A4  data  bouncing_prop_bounce_off_edge_box
# 032127 "LDY #$78AC" in bouncing_prop_bounce_start: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0411 0C08 1800 0018 (was hit_box_0338AC)
0338AC  data  bouncing_prop_bounce_start_box
# 032148 "LDU #$78CE" in bouncing_prop_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0512 hit_box_0338A4 3C 00 (was object_setup_0338CE)
0338CE  data  bouncing_prop_object_setup
# 0326D5 "LDY #$78D8", 032753 "LDY #$78D8", 032781 "LDY #$78D8" in ninja_attack_recover, ninja_jump_attack_dive, ninja_jump_attack_land, ninja_rush_leap: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_0338D8)
0338D8  data  ninja_body_box
# 032601 "LDY #$78E8", 032693 "LDY #$78E8" in ninja_hop_strike_hit, ninja_slash_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0401 0804 0810 0018 (was hit_box_0338E8)
0338E8  data  ninja_hop_strike_hit_box
# 032765 "LDY #$78F0", 032845 "LDY #$78F0" in ninja_jump_attack_dive, ninja_rush_leap: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0801 0804 0810 0018 (was hit_box_0338F0)
0338F0  data  ninja_jump_attack_dive_box
# 0326CE "LDY #$78F8" in ninja_crouch_strike_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0801 0804 0438 0020 (was hit_box_0338F8)
0338F8  data  ninja_crouch_strike_hit_box
# 03229D "LDU #$7900" in ninja_fighter_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 07 00 00 00 4D B3 01 01 01 01 00 00 00 FF (was enemy_behaviour_033900)
033900  data  ninja_fighter_behaviour
# 032307 "LDU #$7958" in ninja_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 07 00 00 00 4D B3 01 01 01 01 00 00 00 FF (was enemy_behaviour_033958)
033958  data  ninja_behaviour
# 032278 "LDU #$79B0" in ninja_thrower_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 07 00 00 00 4D B3 01 01 01 01 00 00 00 FF (was enemy_behaviour_0339B0)
0339B0  data  ninja_thrower_behaviour
# 032272 "LDU #$7A32", 032297 "LDU #$7A32", 032301 "LDU #$7A32" in ninja_thrower_setup, ninja_fighter_setup, ninja_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup A100 hit_box_0338D8 0C 01 (was object_setup_033A32)
033A32  data  ninja_object_setup
# 0324E9 "LDY #$7A7D" in ninja_split: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 00 07 32 (was child_object_033A7D)
033A7D  data  ninja_split_child
# 032623 "LDY #$7A93" in ninja_throw_release: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 28 00 00 18 19 (was child_object_033A93)
033A93  data  ninja_throw_release_child
# 032651 "LDU #$7A9D" in ninja_star_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup A11F hit_box_0338E0 3C 00 (was object_setup_033A9D)
033A9D  data  ninja_star_object_setup
# 032971 "LDY #$7AE0" in robot_scrap_throw: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0413 0808 0800 0008 (was hit_box_033AE0)
033AE0  data  robot_scrap_throw_box
# 03293A "LDU #$7B00", 032A3F "LDU #$7B00" in robot_piece_setup, robot_scrap_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0400 hit_box_033AD8 08 00 (was object_setup_033B00)
033B00  data  robot_piece_object_setup
# 032C28 "LDY #$7B38", 032C42 "LDY #$7B38" in robot_punch_recover, robot_punch_recover_again: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1808 3000 0030 (was hit_box_033B38)
033B38  data  robot_body_box
# 032C21 "LDY #$7B40" in robot_punch_first_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0809 1008 1010 0020 (was hit_box_033B40)
033B40  data  robot_punch_first_hit_box
# 032C3B "LDY #$7B48" in robot_punch_second_hit: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 080A 1008 10F8 0020 (was hit_box_033B48)
033B48  data  robot_punch_second_hit_box
# 032B6D "LDU #$7B70" in robot_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 00 00 00 00 00 FF 01 01 01 01 00 00 00 FF (was enemy_behaviour_033B70)
033B70  data  robot_behaviour
# 032AF7 "LDU #$7BD0" in robot_spark_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0402 hit_box_033B30 3C 00 (was object_setup_033BD0)
033BD0  data  robot_spark_object_setup
# 032B4C "LDU #$7BE2" in robot_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8F00 hit_box_033B38 40 01 (was object_setup_033BE2)
033BE2  data  robot_object_setup
# 032E5A "LDY #$7D10" in robot_launch_part_release: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 5C 17 (was child_object_033D10)
033D10  data  robot_launch_part_release_child
# 032E76 "LDU #$7D1C" in robot_part_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 8F18 hit_box_033B38 3C 00 (was object_setup_033D1C)
033D1C  data  robot_part_object_setup
# 032EE4 "LDU #$7D62" in goon_lift_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 120C hit_box_033B60 3C 00 (was object_setup_033D62)
033D62  data  goon_lift_object_setup
# 032EF7 "LDY #$7D68" in goon_lift_setup: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 FF FE 00 01 00 3A (was child_object_033D68)
033D68  data  goon_lift_part_child_1
# 032EFD "LDY #$7D70" in goon_lift_setup: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 FF F0 00 01 01 3A (was child_object_033D70)
033D70  data  goon_lift_part_child_2
# 032F1E "LDY #$7D78" in goon_lift_arrive: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 10 00 00 00 00 00 13 (was child_object_033D78)
033D78  data  goon_lift_goon_1
# 032F24 "LDY #$7D80" in goon_lift_arrive: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF F0 00 00 00 00 01 13 (was child_object_033D80)
033D80  data  goon_lift_goon_2
# 032F9A "LDU #$7D90" in goon_lift_part_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 1201 hit_box_033B68 3C 00 (was object_setup_033D90)
033D90  data  goon_lift_part_object_setup
# 03319A "LDY #$7D9E" in donut_roll_end: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 1004 2000 0020 (was hit_box_033D9E)
033D9E  data  donut_body_box
# 03318B "LDY #$7DA6" in donut_roll_go: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0807 1004 1000 0018 (was hit_box_033DA6)
033DA6  data  donut_roll_go_box
# 033006 "LDU #$7DB6" in donut_setup (its comment names it): an enemy's behaviour (88 bytes: 8 a state, 4 ranges of 12) stored in field 2A; u8 00 00 00 00 00 00 00 FF 01 01 01 01 00 00 00 FF (was enemy_behaviour_033DB6)
033DB6  data  donut_behaviour
# 032FF5 "LDU #$7E1A" in donut_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B700 hit_box_033D9E 08 01 (was object_setup_033E1A)
033E1A  data  donut_object_setup
# 0331BF "LDY #$7E56" in donut_throw_release: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 08 00 00 18 01 00 DE (was child_object_033E56)
033E56  data  donut_throw_release_child
# 0331D8 "LDU #$7E62" in donut_shot_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B712 hit_box_033DAE 3C 00 (was object_setup_033E62)
033E62  data  donut_shot_object_setup
# 033226 "LDU #$7EB7" in flying_saxophone_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B800 hit_box_033E68 18 01 (was object_setup_033EB7)
033EB7  data  flying_saxophone_object_setup
# 033633 "LDU #$7FDD" in flying_saxophone_shot_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup B800 hit_box_033E70 1C 01 (was object_setup_033FDD)
033FDD  data  flying_saxophone_shot_object_setup
# 034175 "LDY #$7768", 034272 "LDY #$7768", 034376 "LDY #$7768" in dreamland_boss_bounce_in, dreamland_boss_flinch_end, dreamland_boss_charge_end, dreamland_boss_second_form_start: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0000 3020 3000 0030 (was hit_box_035768)
035768  data  dreamland_boss_body_box
# 034157 "LDY #$7770", 034362 "LDY #$7770", 034553 "LDY #$7770" in dreamland_boss_drop_in, dreamland_boss_charge_dash, dreamland_boss_knocked_rise, dreamland_boss_leap_bounce: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0C07 2010 0800 0008 (was hit_box_035770)
035770  data  dreamland_boss_attack_box
# 034D1D "LDY #$7778" in dreamland_boss_defeat_burst: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 0008 80FF 8000 0000 (was hit_box_035778)
035778  data  dreamland_boss_defeat_burst_box
# 034F3E "LDY #$7788" in boss_ball_land: a hit box (4 words into fields 1C, 1F, 21, 23) that 07D1B7 takes in Y; record hit_box 080A 1010 1000 0010 (was hit_box_035788)
035788  data  boss_ball_land_box
# 0340BE "LDU #$77D0" in dreamland_boss_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup BA00 hit_box_035768 40 00 (was object_setup_0357D0)
0357D0  data  dreamland_boss_object_setup
# 03444F "LDY #$7812" in dreamland_boss_second_change_flash: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 01 00 E3 (was child_object_035812)
035812  data  dreamland_boss_second_change_flash_child
# 034965 "LDY #$788C" in dreamland_boss_spit_ball: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 2C FF FE 50 20 (was child_object_03588C)
03588C  data  dreamland_boss_spit_ball_child
# 034BC0 "LDY #$78BC" in dreamland_boss_put_out_chain: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF F0 00 00 30 00 00 FF (was child_object_0358BC)
0358BC  data  dreamland_boss_put_out_chain_child
# 034E3A "LDU #$792E" in boss_ball_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup D103 hit_box_035780 3C 00 (was object_setup_03592E)
03592E  data  boss_ball_object_setup
# 034EB9 "LDY #$793C", 034EF9 "LDY #$793C", 034F64 "LDY #$793C" in boss_ball_fly_out, boss_ball_home_in, boss_ball_land: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF F0 00 00 00 01 00 EA (was child_object_03593C)
03593C  data  boss_ball_fly_out_child
# 034F83 "LDU #$7948" in boss_ball_trail_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup D104 hit_box_035780 3C 00 (was object_setup_035948)
035948  data  boss_ball_trail_object_setup
# 034FA7 "LDU #$7952" in dreamland_boss_shadow_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup D100 hit_box_035780 3C 00 (was object_setup_035952)
035952  data  dreamland_boss_shadow_object_setup
# 035001 "LDY #$7966" in chain_holder_put_out_chain: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 40 00 00 FF (was child_object_035966)
035966  data  chain_holder_put_out_chain_child
# 034FE8 "LDU #$796E" in chain_holder_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup BB01 hit_box_035958 3C 00 (was object_setup_03596E)
03596E  data  chain_holder_object_setup
# 0350A8 "LDU #$7988", 03524C "LDU #$7988" in dreamland_boss_chain_setup, dreamland_boss_chain_link_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup D109 hit_box_035958 3C 00 (was object_setup_035988)
035988  data  dreamland_boss_chain_object_setup
# 03530C "LDU #$79D6" in dreamland_boss_chain_head_setup: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup D10D hit_box_035958 3C 00 (was object_setup_0359D6)
0359D6  data  dreamland_boss_chain_head_object_setup
# 036027 "LDU #$6418" in kid_in_sunglasses_run: a jump table of the object's handlers by its state (code addresses), which the walk's 'more hit boxes' took for hit boxes; record hit_box 6030 6049 6055 606B (was hit_box_036418)
036418  data  kid_in_sunglasses_states
# 036030 "LDU #$6430" in kid_in_sunglasses_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9301 hit_box_036400 04 00 (was object_setup_036430)
036430  data  kid_in_sunglasses_setup
# 036133 "LDU #$644E" in car_doors_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F09 hit_box_036400 3C 00 (was object_setup_03644E)
03644E  data  car_doors_setup
# 03624E "LDU #$6482" in door_kind_12_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 1209 hit_box_036410 00 00 (was object_setup_036482)
036482  data  door_kind_12_setup
# 0362AE "LDU #$64F8" in door_kind_10_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 1008 hit_box_036410 00 00 (was object_setup_0364F8)
0364F8  data  door_kind_10_setup
# 03631D "LDU #$6547" in door_kind_0f_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 0F0E hit_box_036410 00 00 (was object_setup_036547)
036547  data  door_kind_0f_setup
# 03A338 "LDY #$7A78" in stage_8_boss_speak: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 50 1C (was child_object_03BA78)
03BA78  data  stage_8_boss_speak_child
# 03A928 "LDY #$7A7E" in stage_8_boss_throw_bombs: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 20 1D (was child_object_03BA7E)
03BA7E  data  stage_8_boss_throw_child_1
# 03A930 "LDY #$7A84" in stage_8_boss_throw_bombs: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 20 01 00 F1 (was child_object_03BA84)
03BA84  data  stage_8_boss_throw_child_2
# 03A955 "LDY #$7A8C" in stage_8_boss_throw_bombs: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 01 26 E1 (was child_object_03BA8C)
03BA8C  data  stage_8_boss_throw_child_3
# 03C397 "LDY #$7D9A" in football_player_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 17 30 01 0D 1E (was child_object_03DD9A)
03DD9A  data  football_player_child
# 03C6B8 "LDY #$7DC2" in football_player_throw: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 30 00 00 10 05 (was child_object_03DDC2)
03DDC2  data  football_player_throw_child
# 03C72D "LDY #$7DC8" in football_player_charge: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 30 00 00 35 06 (was child_object_03DDC8)
03DDC8  data  football_player_charge_child
# 03C8B3 "LDY #$7DE6" in football_line_piece: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 FF FE 02 06 (was child_object_03DDE6)
03DDE6  data  football_line_piece_child
# 03C918 "LDY #$7E14" in bear_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 02 00 01 (was child_object_03DE14)
03DE14  data  bear_start_child_1
# 03C904 "LDY #$7E1C" in bear_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 00 00 0B (was child_object_03DE1C)
03DE1C  data  bear_start_child_2
# 03C90E "LDY #$7E24" in bear_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 01 00 0E (was child_object_03DE24)
03DE24  data  bear_start_child_3
# 03CACD "LDY #$7E54", 03CC66 "LDY #$7E54", 03CC73 "LDY #$7E54" in bear_walk, bear_knocked_down: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 01 00 35 (was child_object_03DE54)
03DE54  data  bear_boulder_child_1
# 03CADE "LDY #$7E5C" in bear_walk: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 00 01 01 35 (was child_object_03DE5C)
03DE5C  data  bear_boulder_child_2
# 03CD13 "LDY #$7E94" in bear_change: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 FF F8 FF F0 02 01 00 36 (was child_object_03DE94)
03DE94  data  bear_change_child
# 03D1C5 "LDY #$7F08" in stage_3_boss_start: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 20 00 00 00 00 01 3E (was child_object_03DF08)
03DF08  data  stage_3_boss_child
# 03D26E "LDY #$7F10" in stage_3_boss_arrive: a child object (x, y, z offsets, then list, state, type) that 07CA8A/07CA9E take in Y; u8 00 00 00 00 5C 1C (was child_object_03DF10)
03DF10  data  stage_3_boss_arrive_child
# 07E195 "LDU #$F290" in fireman_goon_effect_start: an object's setup (kind and animation, hit box, fields 1B and 27) that 07D132 takes in U; setup 9011 hit_box_07F284 00 00 (was object_setup_07F290)
07F290  data  fireman_goon_effect_setup

# ---- the stages' title cards (bank 13): the texts the fixed printer takes in U (0785A5) ----
# 026E97 "LDU #$7D8C; CLRA; LBSR $85A5" in stage_1_title_show: "STAGE 1 / DOWNTOWN SPRINGFIELD" (was text_027D8C)
027D8C  data  stage_1_title_text
# 026F45 "LDU #$7DAD" in stage_2_title_show: "STAGE 2 / KRUSTYLAND" (was text_027DAD)
027DAD  data  stage_2_title_text
# 026FA1 "LDU #$7DC4" in stage_3_title_show: "STAGE 3 / SPRINGFIELD / DISCOUNT CEMETERY" (was text_027DC4)
027DC4  data  stage_3_title_text
# 026FE0 "LDU #$7DF0" in stage_4_title_show: "STAGE 4 / MOE'S TAVERN" (was text_027DF0)
027DF0  data  stage_4_title_text
# 027041 "LDU #$7E09" in stage_5_title_show: "STAGE 5 / SPRINGFIELD BUTTE" (was text_027E09)
027E09  data  stage_5_title_text
# 027080 "LDU #$7E27" in stage_6_title_show: "STAGE 6 / DREAMLAND" (was text_027E27)
027E27  data  stage_6_title_text
# 0270BA "LDU #$7E3D" in stage_7_title_show: "STAGE 7 / CHANNEL 6" (was text_027E3D)
027E3D  data  stage_7_title_text
# 027157 "LDU #$7E53" in stage_8_title_show: "STAGE 8 / SPRINGFIELD / NUCLEAR POWER PLANT" (was text_027E53)
027E53  data  stage_8_title_text

# ---- the test mode's texts (bank 2F), printed by 05E650 (LBSR $6650 with U) ----
# 05E33F "LDU #$7984" in test_options_open: " PLAYER" (was test_mode_text_05F984)
05F984  data  test_text_player
# 05E2FC "LDU #$7A9B" in test_print_coinage: "COIN" (was test_mode_text_05FA9B)
05FA9B  data  test_text_coin
# 05E313 "LDU #$7AA0" in test_print_coinage: " CREDIT" (was test_mode_text_05FAA0)
05FAA0  data  test_text_credit
# 05E36F "LDU #$7ABA" in test_options_open (screen flip off): "NORMAL" (was test_mode_text_05FABA)
05FABA  data  test_text_normal
# 05E386 "LDU #$7ADE" in test_options_open (sound output): "MONAURAL" (was test_mode_text_05FADE)
05FADE  data  test_text_monaural
# 05E38C "LDU #$7AE7" in test_options_open: "STEREO" (was test_mode_text_05FAE7)
05FAE7  data  test_text_stereo
# 05E471 "LDU #$7AEE; LDB #$00; LBSR $6650" in test_factory_setting_apply: a place (02 0B) and word DC of
# test_mode_words, the factory setting's message (was test_mode_text_05FAEE)
05FAEE  data  test_text_factory_setting
# 05E375 "LDU #$7B3D" in test_options_open (screen flip on): "UPSIDE DOWN" (was test_mode_text_05FB3D)
05FB3D  data  test_text_upside_down
# 05E092 "LDU #$7B52" in test_menu_open: "WITH " and word FB, then S (was test_mode_text_05FB52)
05FB52  data  test_text_with
# 05E08C "LDU #$7B5A; TSTB; BEQ" in test_menu_open: "WITHOUT " and word FB, then S (was test_mode_text_05FB5A)
05FB5A  data  test_text_without

# ======== functions still named after their place (each line replaces symbols.txt's func line at the same place) ========

# ---- story actors (bank 1F) ----
# story_actor_operations entry 19 (03F032 = 653C): clears field 3F-40 of the four players' objects (4A40, 4B00, 4BC0,
# 4C80: "scoped object player 3F held u16 object") and goes on with the next operation (was sub_03E53C)
03E53C  func  story_actor_drop_players_held
comment story_actor_drop_players_held Operation 19: the four players hold nothing any more, then the next operation.
# story_actor_operations entry 23 (03F046 = 6649): 03E649 "LDA #$42,X; EORA #$08; STA #$42,X", then the next operation;
# no scenario runs it (was sub_03E649)
03E649  func  story_actor_toggle_flag_08
comment story_actor_toggle_flag_08 Operation 23: flips bit 3 of the actor's field 42, then the next operation.
# 03E02D: the object at 5640 (list 3's, the stage's events: 1854 = it) with field 30 24, run as a story actor, like
# stage_5_events; nothing calls it
# (was unused_03E02D)
03E02D  func  unused_events_actor_24
comment unused_events_actor_24 Unused: runs the stage's events object (list 3's) as a story actor on script 24, noting it in 1854.
# 03E045: the same with field 30 50, without noting it (was unused_03E045)
03E045  func  unused_events_actor_50
comment unused_events_actor_50 Unused: runs the stage's events object (list 3's) as a story actor on script 50.
# 03E00C "LBRA $681E" and 03E00F "LBRA $681E": slots of bank 1F's jump table that lead to an RTS (was unused_03E00C,
# unused_03E00F)
03E00C  func  unused_story_vector_no_op_1
comment unused_story_vector_no_op_1 Unused: a slot of the stories' bank that does nothing.
03E00F  func  unused_story_vector_no_op_2
comment unused_story_vector_no_op_2 Unused: a slot of the stories' bank that does nothing.

# ---- bank 14: the goons ----
# 028096 "LBRA $705A"... the bank's jump table at 028000-0280BA: slots no type uses, to the goons' setups (was
# unused_028096, unused_028099, unreached_02809C)
028096  func  unused_vector_hat_goon_set_up
comment unused_vector_hat_goon_set_up Unused: a slot of the goons' bank that jumps to hat_goon_set_up.
028099  func  unused_vector_umbrella_goon_set_up
comment unused_vector_umbrella_goon_set_up Unused: a slot of the goons' bank that jumps to umbrella_goon_set_up.
02809C  func  unused_vector_shovel_goon_set_up
comment unused_vector_shovel_goon_set_up Unused: a slot of the goons' bank that jumps to shovel_goon_set_up.
# 028AE0: field 3B from unused_goon_waits_by_rank, animation 86, the next step, faces its target; between the goons'
# actions (was unused_028AE0)
028AE0  func  unused_goon_wait_by_rank
comment unused_goon_wait_by_rank Unused: a goon's action step that waits by the rank (unused_goon_waits_by_rank) with animation 86, facing its target.
# 028BA3: an RTS between goon_back_off_walk and goon_dash_start (was unused_028BA3)
028BA3  func  unused_goon_action_no_op
comment unused_goon_action_no_op Unused: does nothing.
# 028CE5: animation 86, field 3B 4, the next step, faces its target (was unused_028CE5)
028CE5  func  unused_goon_short_wait
comment unused_goon_short_wait Unused: a goon's action step that waits 4 with animation 86, facing its target.

# ---- bank 15: the fat goons ----
# 02A0CD: object_setup_02B64C (fat_goon_object_setup), leaves its target's side unless field 42 is negative, field 42
# 2, the behaviour fat_goon_behaviour, retarget 10, fields 30 and 3B cleared, type 0E state 02 (like enemy_become_goon
# for the goon); nothing calls it (was unused_02A0CD)
02A0CD  func  unused_become_fat_goon
comment unused_become_fat_goon Unused: turns the object into a fat goon: its setup and behaviour, its old target's side given back, thinking as enemy type 0E.

# ---- bank 16: the obstacles ----
# 02CE07-02CE2D: handlers no table leads to, between obstacle_rebound_fall and solid_scenery_start (was
# unreached_02CE07, unreached_02CE13, unreached_02CE1C, unreached_02CE25)
02CE07  func  unused_obstacle_fall
comment unused_obstacle_fall Unused: clears field 3D and falls; the next state once it lands.
02CE13  func  unused_obstacle_keep_falling
comment unused_obstacle_keep_falling Unused: falls; the next state once it lands.
02CE1C  func  unused_obstacle_show_animation_80
comment unused_obstacle_show_animation_80 Unused: takes animation 80 and the next state.
02CE25  func  unused_obstacle_vanish_at_animation_end
comment unused_obstacle_vanish_at_animation_end Unused: removes the object when its animation ends.

# ---- bank 17 ----
# 02E1A9: runs the unused obstacle by its state (unused_obstacle_start, idle, break, break_end; states FE and FF its
# break steps), then object_take_special_hit; nothing calls it (was unused_02E1A9)
02E1A9  func  unused_obstacle_update
comment unused_obstacle_update Unused: runs the unused obstacle by its state, then takes a special hit.

# ---- bank 18: the zombies ----
# 0301D8: an RTS between zombie_start_coming_out and zombie_finish_rising (was unused_0301D8)
0301D8  func  unused_zombie_no_op
comment unused_zombie_no_op Unused: does nothing.
# 0303CE: when its animation ends (field 06 bit 0), field 3B 1 and state 1 (was unused_0303CE)
0303CE  func  unused_zombie_restart_at_animation_end
comment unused_zombie_restart_at_animation_end Unused: when its animation ends, its timer at 1 and back to state 1.
# 03127A "LDA #$29,X; ASLA; JMP [A,U]" over the kind 8E thrower's handlers (steps 0-1, and backwards from FF its other
# handlers) (was unused_03127A)
03127A  func  unused_kind_8e_thrower_run_step
comment unused_kind_8e_thrower_run_step Unused: runs the kind 8E thrower by its step: stagger or recover, the negative steps its other handlers.
# 031540: an RTS between the kind 8E watcher's and the kind 8C bystander's handlers (was unused_031540)
031540  func  unused_kind_8e_watcher_no_op
comment unused_kind_8e_watcher_no_op Unused: does nothing.

# ---- bank 19: the robot ----
# 032BE5: at its animation's end clears attributes bit 7, sets animation flags bit 7, state 2, timer 0 (was
# unused_032BE5)
032BE5  func  unused_robot_fight_at_animation_end
comment unused_robot_fight_at_animation_end Unused: when its animation ends the robot shows again and starts thinking (state 2).

# ---- bank 1A ----
# 034023: print_hex_byte (through unused_vector_print_hex_byte) of the vitality of object 14 (4F80, the enemies' first),
# 188C, the camera's x plus 150 and cemetery_scroll, at the tile places of unused_spawn_0356DD and unused_tile_places:
# a debug display no path reaches (was unreached_034023)
034023  func  unused_show_debug_values
comment unused_show_debug_values Unused: prints in hex the first enemy's vitality, a scene variable, the camera's x and the cemetery's scroll (a debug display).
# 0350C7: an RTS between dreamland_boss_chain_setup and dreamland_boss_chain_lead (was unused_0350C7)
0350C7  func  unused_dreamland_boss_chain_no_op
comment unused_dreamland_boss_chain_no_op Unused: does nothing.

# ---- bank 1C: the players ----
# player_state_handlers' entries 64 and 65 (039DD1 = 629A, 039DD3 = 62AF: player states 40 and 41), which the analysis
# missed (it reads at most 64 entries of a table without a length) (was unreached_03829A)
03829A  func  player_next_state_at_animation_end
comment player_next_state_at_animation_end Player state 40: when its animation ends, the next state with bit 2 of its flags off; then takes its touches.
# (was unreached_0382AF)
0382AF  func  player_land_at_animation_end
comment player_land_at_animation_end Player state 41: lands the player when its animation ends; until then takes its touches.
# 039C56: queues the sound in D with the player's kind (field 04) added to its high byte (was unused_039C56)
039C56  func  unused_player_play_character_sound
comment unused_player_play_character_sound Unused: queues a sound command plus the player's character.

# ---- bank 1D: stage 8's boss ----
# 03A252: vector_set_speed_by_direction with the speed the table in Y gives for half the rank (was unused_03A252)
03A252  func  unused_stage_8_boss_set_speed_by_rank
comment unused_stage_8_boss_set_speed_by_rank Unused: sets its speeds from a direction and the speed a table gives for the rank.
# 03A269: boss_shade_by_vitality with the step the table in Y gives for the players (was unused_03A269)
03A269  func  unused_stage_8_boss_shade_by_players
comment unused_stage_8_boss_shade_by_players Unused: shades the boss by its vitality, in steps a table gives for the players in the game.
# 03A2A0: field 38 1234, then stage_8_boss_set_on_floor (was unreached_03A2A0)
03A2A0  func  unused_stage_8_boss_mark_on_floor
comment unused_stage_8_boss_mark_on_floor Unused: writes 1234 into its target field and marks it on the floor.
# 03A337: an RTS between stage_8_boss_speak and stage_8_boss_opening_throw (was unused_03A337)
03A337  func  unused_stage_8_boss_no_op
comment unused_stage_8_boss_no_op Unused: does nothing.
# 03A658: stage_8_boss_stop_and_start_state with 1D, then stage_8_boss_move_and_take_hits (was unreached_03A658)
03A658  func  unused_stage_8_boss_start_state_1d
comment unused_stage_8_boss_start_state_1d Unused: stops it and starts state 1D, then moves it and takes its hits.

# ---- bank 1E: the stage bosses ----
# 03C0C0: hit 10 or more and FF: the object that hit it (field 25) of kind 5 gets field 42 = 1 (was unused_03C0C0)
03C0C0  func  unused_stage_boss_mark_kind_5_hitter
comment unused_stage_boss_mark_kind_5_hitter Unused: when the boss is beaten by a kind 5 object, marks that object.
# 03C2F3: attributes bit 6 by the sign of its x speed, its animation restarted when that turns it (was unused_03C2F3)
03C2F3  func  unused_stage_boss_face_motion
comment unused_stage_boss_face_motion Unused: faces the way it moves in x, restarting its animation when it turns.
# 03C332: tests its x and y speeds (fields 0F, 14) for zero and returns either way (was unreached_03C332)
03C332  func  unused_stage_boss_is_still
comment unused_stage_boss_is_still Unused: tests whether the boss stands still (both speeds zero).
# 03CCAA: its x (field 0C) against 70 and 140, the x speed cleared outside, then bear_land (was unreached_03CCAA)
03CCAA  func  unused_bear_land_in_area
comment unused_bear_land_in_area Unused: lands the bear, stopping its x speed when it is outside the area it keeps to.
# 03D1BF: an RTS between hurry_up_vanish and stage_3_boss_start (was unused_03D1BF)
03D1BF  func  unused_hurry_up_no_op
comment unused_hurry_up_no_op Unused: does nothing.

# ---- bank 2F: the test mode and the EEPROM ----
# 05E003 "LBRA $6A57": a slot of bank 2F's jump table to eeprom_write_sum (was unused_05E003)
05E003  func  unused_vector_eeprom_write_sum
comment unused_vector_eeprom_write_sum Unused: a slot of the test mode's bank that jumps to eeprom_write_sum.
# 05E0AE "INC $5909; RTS" (test_page_step) between test_rom_check_open and test_rom_check_run (was unreached_05E0AE)
05E0AE  func  unused_test_rom_check_next_step
comment unused_test_rom_check_next_step Unused: the ROM check page's next step.
# 05E704: test_print_hex of U's two bytes (was unused_05E704)
05E704  func  unused_test_print_hex_word
comment unused_test_print_hex_word Unused: prints a word as four hex digits.
# 05E9E0 "LDX #$7CF7" (eeprom_ones_bits), the EEPROM sequence loop (was unreached_05E9E0)
05E9E0  func  unused_eeprom_send_ones
comment unused_eeprom_send_ones Unused: clocks eight 1 bits into the EEPROM.

# ---- the fixed program's jump table (0785xx): slots nothing calls ----
# 0785A2 "LBRA $D115" (was unused_0785A2)
0785A2  func  unused_vector_enemy_leave_side
comment unused_vector_enemy_leave_side Unused: jumps to enemy_leave_side.
# 0785A8 "LBRA $945C"; only unused_show_debug_values calls it (was unused_0785A8)
0785A8  func  unused_vector_print_hex_byte
comment unused_vector_print_hex_byte Unused: jumps to print_hex_byte (only an unused debug display calls it).
# 0785AE "LBRA $D16D", 078614 "LBRA $CC8D", 07866E "LBRA $CCEF": each to an RTS (was unused_0785AE, unused_078614,
# unused_07866E)
0785AE  func  unused_vector_no_op_1
comment unused_vector_no_op_1 Unused: does nothing.
078614  func  unused_vector_no_op_2
comment unused_vector_no_op_2 Unused: does nothing.
07866E  func  unused_vector_no_op_3
comment unused_vector_no_op_3 Unused: does nothing.
# 0785BD "LBRA $D216" (was unreached_0785BD)
0785BD  func  unused_vector_enemy_on_screen
comment unused_vector_enemy_on_screen Unused: jumps to enemy_on_screen.
# 0785D2 "LBRA $D2A2" (was unused_0785D2)
0785D2  func  unused_vector_enemy_pick_walk_animation
comment unused_vector_enemy_pick_walk_animation Unused: jumps to enemy_pick_walk_animation_noting_direction.
# 0785E7 "LBRA $D450" (was unused_0785E7)
0785E7  func  unused_vector_enemy_become_goon
comment unused_vector_enemy_become_goon Unused: jumps to enemy_become_goon.
# 0785ED "LBRA $E18F" (was unused_0785ED)
0785ED  func  unused_vector_kind_90_effect
comment unused_vector_kind_90_effect Unused: jumps to fireman_goon_effect.
# 07861A "LBRA $CCA0" (was unused_07861A)
07861A  func  unused_vector_scaled_sine
comment unused_vector_scaled_sine Unused: jumps to scaled_sine.
# 078629 "LBRA $D3D7" (was unused_078629)
078629  func  unused_vector_enemy_find_attack_range
comment unused_vector_enemy_find_attack_range Unused: jumps to enemy_find_attack_range.
# 078641 "LBRA $CF5F" (was unused_078641)
078641  func  unused_vector_enemy_start_climbing
comment unused_vector_enemy_start_climbing Unused: jumps to enemy_start_climbing.
# 07864D "LBRA $CDAD": floor_at_offset under the object; on a floor, 48E8 the cell, field 5D its height times 8,
# attributes bits 4-5 its priority (07CDAD, which only this slot reaches) (was unused_07864D)
07864D  func  unused_take_floor_height_and_priority
comment unused_take_floor_height_and_priority Unused: on a floor, takes the floor cell's height and sprite priority under the object.
# 078668 "LBRA $CD90" (was unused_078668)
078668  func  unused_vector_take_floor_priority
comment unused_vector_take_floor_priority Unused: jumps to unused_take_floor_priority.
# 07867A "LBRA $C10D" (was unused_07867A)
07867A  func  unused_vector_collide_with_list_1_objects
comment unused_vector_collide_with_list_1_objects Unused: jumps to unused_collide_with_list_1_objects.

# ---- the fixed program ----
# 07BAC6: an RTS between play_scene_music and palette_request (was unused_07BAC6)
07BAC6  func  unused_palette_no_op
comment unused_palette_no_op Unused: does nothing.
# 07C10D: clears its flags bit 5 and its hit, then boxes_overlap and trade_hits_unless_attacking against each of list
# 1's 10 objects (5280) with flags bit 6, like collide_players_with_list_1_objects (was unused_07C10D)
07C10D  func  unused_collide_with_list_1_objects
comment unused_collide_with_list_1_objects Unused: checks the object's box against list 1's objects, trading hits with each it touches.
# 07CC30: 1874 = player_count (was unused_07CC30)
07CC30  func  unused_note_player_count
comment unused_note_player_count Unused: notes the number of players in a scene variable.
# 07CD90: floor_at_offset under the object; on a floor, attributes bits 4-5 its priority and flags C0 (was unused_07CD90)
07CD90  func  unused_take_floor_priority
comment unused_take_floor_priority Unused: on a floor, takes the floor cell's sprite priority under the object and marks it active.
# 07D47E: looks at its target and runs its action (field 28) in its bank through unused_object_banks and
# unused_object_handlers, which hold no code; only the unused slot 0785D8 leads to it (was unused_07D47E)
07D47E  func  unused_enemy_run_action
comment unused_enemy_run_action Unused: an enemy's action run through tables that hold no code.
# 07D7E3: speeds at 30 in the direction of field 36 plus 60 (field 3D set) or minus 20, the y speed halved; no path
# reaches it (was unreached_07D7E3)
07D7E3  func  unused_enemy_move_aside
comment unused_enemy_move_aside Unused: moves the enemy at an angle to its target's direction, slower in depth.
# 07DDBD: queues sound 6300 (was unused_07DDBD)
07DDBD  func  unused_enemy_hit_sound
comment unused_enemy_hit_sound Unused: queues sound command 6300.

# ======== work RAM and object fields still named after their address ========
# ======== memory ========
# The 053248's work RAM variables and object fields still named after their address. Evidence: build/listing/simpsons.s
# (quoted as PLACE "INSTRUCTION"), the C of src/, assets/data/.

# ---- ordinary variables ----

# the mode's fifth level, under step_subphase: cleared with it whenever a step ends (079EB5-079EBE "STD <$01; STD
# <$03; STD <$05"; 07A0C3 "CLR <$06"); only stage 7's title card counts frames in it (0270E0 "LDA #$80; STA <$06",
# 02711F "DEC <$06; BNE": the second picture after 80 frames)
4806  var  step_countdown  u8
# cleared with the mode's variables when a game starts (079ECA "CLRD; STD <$07; STD <$09; STD <$0B; CLR <$0D"); nothing
# reads them
4807  var  unused_mode_word  u16
480D  var  unused_mode_byte  u8
# the first of the variables a game's start clears (0796A3 "LDX #$4860; LEAY ,X; CLR ,X+; LDU #$009F; BMOVE Y,X,U":
# 4860-48FF) and of those a stage's start clears (07960F "LDX #$4870", "LDU #$008F": 4870-48FF); neither byte is read
# on its own
4860  var  play_variables  u8
4870  var  stage_variables  u8
# the byte after each of the K053246's scroll copies (sprite_scroll_x 4886, sprite_scroll_y 4889), cleared with them
# (078AC5 "CLR <$88; CLR <$8B", 079649 "CLR <$88; CLR <$8B"); nothing reads them
4888  var  sprite_scroll_x_pad  u8
488B  var  sprite_scroll_y_pad  u8
# the scroll record's fifth byte (026257 "LDX <$A4; LDU #$02,X", 0262B1 "LDA ,U; STA <$92", after layer_a_edges_on,
# layer_b_edges_on, layer_columns_on, layer_rows_on): set while the stage still scrolls on, 0 where it stops for a
# fight; the bosses wait for 0 to come in (0213F8 "LDA <$92; LBNE" wrestler_put_in, 02C332 bear_wait_entrance,
# 03410C, 03A2D4 "TST <$92; BEQ", 03C976, 03D1F0) and the HURRY UP counts only while it is set (040CF3 "LDA <$92; BNE;
# CLRD; STD <$93")
4892  var  stage_scrolls_on  u8
# the camera's y (its low byte and fraction) when an entry going up or down starts (0264CF "LDD <$B3; STD <$9F");
# nothing reads it
489F  var  entry_start_camera_y  u16
# the cemetery's scroll as it was last frame, a 16.8 value the IRQ keeps as it keeps the camera's (last_stage_scroll_x):
# its high byte (079124 "LDA <$B8; STA <$BB"), then its low byte and fraction (07912A "LDD <$B9; STD <$BC"), as the IRQ
# writes them
48BB  var  last_cemetery_scroll_high  u8
48BC  var  last_cemetery_scroll_low  u16
# layer B's y scroll's fraction, under layer_b_scroll_y (48D5): the scenes that scroll layer B by 8.8 steps (024C46
# "LDD <$D6; SUBD $18EB; STD <$D6", 024C50 "LDA <$D5; SBCA #$00"; 0246F1, 0247BB, 040184 "LDD <$D6"), stage 8's
# opening starting it at 0 (024C80 "LDD #$0020; STD <$D5; CLR <$D7")
48D7  var  layer_b_scroll_y_fraction  u8
# each player's lives as a word: the high byte of the lives the player records point at (player_variable_records'
# lives: 49D1, 49D9, 49E1, 49E9); bank 1C reads and counts down the word (038FD9 "LDD [$1848]; CMPD #$0001", 03905E
# "DECW [$1848]" with 1848 = 49D0 + 8 x player: 03801B-03806C); a game's start clears them (079E8D "CLRD; STD $49D0;
# STD $49D8; STD $49E0; STD $49E8"). (49D0 is player_variables; marge_lives would be its 16-bit name)
49D8  var  homer_lives  u16
49E0  var  bart_lives  u16
49E8  var  lisa_lives  u16
# where each player's object is (byte 3 of the player's variables, 49D0 + 8n): 0 it is put in again (bank 1C 0380B5
# "TST #$03,X; LBEQ $60F7": its object set up, then 038141 "LDB #$01; STB #$03,X"), 1 coming in, 2 in play
# (player_take_touches 039305 "LDX $1848; LDA #$02; STA #$03,X" when its blinking ends); losing a life clears it
# (player_lose_life 039054 "LDX $1848; CLR #$03,X"), as do a stage's start (079681 "CLR $49D3; CLR $49DB; CLR $49E3;
# CLR $49EB") and bonus 2's (020B00)
49D3  var  marge_entry_status  u8
49DB  var  homer_entry_status  u8
49E3  var  bart_entry_status  u8
49EB  var  lisa_entry_status  u8
# the times the player has been grabbed with the help balloon shown (byte 6 of the player's variables):
# player_get_grabbed 0395B5 "LDY $1848; LDA #$06,Y; CMPA #$05; BGE; INC #$06,Y" (the balloon the first 5 times);
# cleared on its last life (player_die 038FF0 "LDX $1848; CLR #$06,X") and at a game's start (0796BA "STA $49D6 ...
# $49EE")
49D6  var  marge_grab_hints  u8
49DE  var  homer_grab_hints  u8
49E6  var  bart_grab_hints  u8
49EE  var  lisa_grab_hints  u8
# the 5 bytes after each player's continue countdown (the player records' countdown: 4A00 + 7 x player, 2 bytes),
# cleared at a game's start (0796CA "STD $4A02; STD $4A04; CLR $4A06" ... "CLR $4A1B"); 02 and 03 of each player's
# are its health gauge's step and delay (040A0D, 040A20), 04-06 nothing reads
4A04  var  unused_marge_word_2  u16
4A06  var  unused_marge_byte  u8
4A0B  var  unused_homer_word_2  u16
4A0D  var  unused_homer_byte  u8
4A12  var  unused_bart_word_2  u16
4A14  var  unused_bart_byte  u8
4A19  var  unused_lisa_word_2  u16
4A1B  var  unused_lisa_byte  u8
# the first of the test mode's variables, which its start clears (079193 "LDX #$5900; LEAY ,X; CLR ,X+; LDU #$00EF;
# BMOVE Y,X,U": 5900-59EF); not read on its own
5900  var  test_mode_variables  u8
# the cursor of the four check pages (ROM, screen, colour, I/O: test_mode_page_05F634/05F640/05F64C/05F658, each a
# menu of one line whose cursor variable is 5912: "... C7 03 59 12"), cleared as each page opens (05E642 "CLR $5912")
5912  var  test_check_cursor  u8

# ---- the direct page's scratch bytes 48E8-48FF, by routine (scoped global FAMILY ADDRESS NAME TYPE) ----
# Each routine uses 48E8-48FF as its own temporaries; the names hold in the functions of the family only.

# ======== video/palette ========
# the palette requests (request_*): D, the request, kept while a free job is found (07BAEC/07BB12/07BB21/07BB71/07BB85/
# 07BBF6 "STD <$E8"; request_palette_clear 07BC78 "STA <$E8", its range bits only), then copied into the job (07BAFE,
# 07BB48, 07BB7D, 07BC6B "LDD <$E8"); its first byte the bits (which loads, ranges or layers: 07BB9F "LDA <$E8; BITA
# #$10"), its second the argument (the set, the frames: 07BB90 "LDA <$E9; STA #$04,U"); the window's bank kept while
# bank 2D or 2E is in (07BAF7 "LDA <$0E; STA <$EA", 07BB06 "LDB <$EA; STB <$0E")
scoped global request 48E8 palette_request_word u16
scoped global request 48E8 palette_request_bits u8
scoped global request 48E9 palette_request_argument u8
scoped global request 48EA palette_request_saved_bank u8
# a fade's palette ranges, built from the request's bits (07BB9C "STD <$EA" 0, 07BBA8 "STA <$EA" 40, 07BBB4 "ORA <$EA"
# 3F, 07BBBC "STA <$EB" C0, 07BBC8 "ORA <$EB" 30 ...) and stored twice into the job (07BBEC "LDD <$EA")
scoped global request_palette_fade 48E8 palette_request_word u16
scoped global request_palette_fade 48E8 palette_request_bits u8
scoped global request_palette_fade 48E9 palette_request_argument u8
scoped global request_palette_fade 48EA palette_fade_ranges u16
scoped global request_palette_fade 48EA palette_fade_ranges_high u8
scoped global request_palette_fade 48EB palette_fade_ranges_low u8
# a white flash's K053251 priorities, built from the request's bits (07BC2F "STD <$EA", 07BC3D "STB <$EA" 10 or 30,
# 07BC48 "ORB <$EA" 0C, 07BC56 "STB <$EB" 28 or 30, 07BC61 "ORB <$EB" 04 or 06) into the job's bytes 3-4 (07BC71 "LDD
# <$EA")
scoped global request_white_flash 48E8 palette_request_word u16
scoped global request_white_flash 48E8 palette_request_bits u8
scoped global request_white_flash 48E9 palette_request_argument u8
scoped global request_white_flash 48EA white_flash_priorities u16
scoped global request_white_flash 48EA white_flash_priorities_high u8
scoped global request_white_flash 48EB white_flash_priorities_low u8
# palette job 1: the job's bits of the set's 4 loads, shifted out a load at a time (07BCCB "STA <$F0", 07BCE3 "LDA <$F0;
# BITA #$01", 07BCF8 "LSR <$F0"), and the loads left (07BCE0 "LDA #$04; STA <$F1", 07BCFB "DEC <$F1")
scoped global palette_job_load_sets 48F0 palette_loads_wanted u8
scoped global palette_job_load_sets 48F1 palette_loads_left u8
# a palette effect's step: the colours it sets less one, from the job's byte 6 (07BD54/07BD6F "LDA #$06,U; STA <$F0",
# 07BD5D "LDA <$F0; BEQ", 07BD62 "DEC <$F0")
scoped global palette_effect 48F0 palette_effect_colours_left u8
# palette jobs 4 and 5: 0 darkens, 1 brightens (palette_job_darken 07BE10 "CLR <$F0", palette_job_brighten 07BE17
# "STA <$F0" 1), which palette_job_fade picks the routine by (07BE61 "LDA <$F0; ASLA"); the colours of the range left
# (07BE59 "STA <$F1", 07BE6A "DEC <$F1")
scoped global palette_job 48F0 palette_fade_brightens u8
scoped global palette_job 48F1 palette_fade_colours_left u8
# palette job 7: the range it is at, 0-3 (07BEF8 "CLR <$F0", 07BF1E "INC <$F0; LDA <$F0; CMPA #$04"), and the job's
# bits of the ranges to clear, shifted out a range at a time (07BEFE "STA <$F1", 07BF1B "LSR <$F1")
scoped global palette_job_clear 48F0 palette_clear_range u8
scoped global palette_job_clear 48F1 palette_clear_bits u8
# the palettes left to copy (07BF6D "STA <$E8", 07BF7E "DEC <$E8") and the colours of the palette left (07BF72 "LDB
# #$10; STB <$E9", 07BF79 "DEC <$E9")
scoped global load_palettes 48E8 palettes_to_load u8
scoped global load_palettes 48E9 palette_colours_left u8
# a colour stepped one step darker or brighter: the step for each component not at its end (07BF95 "STD <$E8" 0,
# 07BFA3 "STA <$E8" 08, 07BFB6/07BFC5 "STA <$E9" 40 and 02; brighten_colour 07BFE2 04, 07BFF9 20, 07C00A 01) and the
# colour (07BF9A "STD <$EA", 07BFA6 "LDA <$EA", 07BFAD "LDA <$EB"), the step taken off or added (07BFC8 "LDD <$EA; SUBD
# <$E8", 07C00D "LDD <$EA; ADDD <$E8")
scoped global darken_colour 48E8 fade_steps u16
scoped global darken_colour 48E8 fade_steps_high u8
scoped global darken_colour 48E9 fade_steps_low u8
scoped global darken_colour 48EA fade_colour u16
scoped global darken_colour 48EA fade_colour_high u8
scoped global darken_colour 48EB fade_colour_low u8
scoped global brighten_colour 48E8 fade_steps u16
scoped global brighten_colour 48E8 fade_steps_high u8
scoped global brighten_colour 48E9 fade_steps_low u8
scoped global brighten_colour 48EA fade_colour u16
scoped global brighten_colour 48EA fade_colour_high u8
scoped global brighten_colour 48EB fade_colour_low u8

# ======== video/sprites ========
# an object's 8 sprite slots cleared (079893 "LDA #$08; STA <$E8", 0798A0 "DEC <$E8"; again for the object that lent
# it more, 0798AD)
scoped global clear_object_sprites 48E8 clear_slots_left u8
# the camera's move this frame in whole pixels, across and on the floor (07990B "STD <$F0" from 48AD less last frame's,
# 079924 "STD <$F2" from 48B3's), added to each object's x and y (07998B "LDD <$F0; ADDD #$0C,X", 079A0F "LDD <$F2;
# ADDD #$11,X") and, with its own speeds' whole pixels, to its sprites' (079932 "LDA <$F1", 079994 "LDA <$F3"); the
# move of the object's sprites, across (079944 "STD <$FC") then down the screen by its y and z (0799B6 "ADDD <$FE; STD
# <$FC"), the y alone for its shadow (0799A4 "STD <$FE", 0799D9 "LDD <$FE" when the sprite's 0C is negative); the 8
# slots of each block of sprites (079947 "LDA #$08; STA <$F6", 079963 "DEC <$F6")
scoped global move_objects 48F0 camera_move_x s16
scoped global move_objects 48F2 camera_move_y s16
scoped global move_objects 48F6 move_slots_left u8
scoped global move_objects 48FC sprite_move s16
scoped global move_objects 48FE shadow_move_y s16
# the depth table at 3000 walked a row of y at a time (079A84 "LDA #$C0; STA <$F0", 079AD7 "DEC <$F0"), the sprites
# numbered in that order for the sprite chip (079A7F "LDA #$01; STA <$F1", 079A9F "LDA <$F1; STA #$01,U", 079AAB "INC
# <$F1"), the 8 slots of each block (079A94 "LDA #$08; STA <$F2", 079AB1 "DEC <$F2")
scoped global sort_objects_by_depth 48F0 depth_rows_left u8
scoped global sort_objects_by_depth 48F1 next_sprite_number u8
scoped global sort_objects_by_depth 48F2 sort_slots_left u8
# the sprites' priority against the layers: the step's default (set_step_sprite_priority 079AE5 "LDA A,X; STA <$FA"
# from step_sprite_priorities), the object's own when its attributes give one (set_object_priority 079DEB "STA <$FB",
# 079DF0 "ORA <$FB", 079DF7 "LDA <$FA; STA <$FB"), which its sprites (write_object_sprites 079C18 "LDA <$FB") and its
# shadow (write_shadow_sprite 079E22 "LDA <$FB") take
scoped global set_step_sprite_priority 48FA step_sprite_priority u8
scoped global set_object_priority 48FA step_sprite_priority u8
scoped global set_object_priority 48FB object_sprite_priority u8
scoped global write_shadow_sprite 48FB object_sprite_priority u8
# an object's frame drawn: the frame's byte 0, its bit 4 (a marked frame: 079B7A "ANDA #$10; STA <$F1", 079BC2 "LDA
# <$F1; BEQ" else animation_flags bit 1) and its low 4 bits, the sprites less one (079B7F "ANDB #$0F; STB <$F2"), counted
# down by write_object_sprites (079C7B "DEC <$F2; BPL"); the slot of the object's block of 8 the next sprite takes
# (079AEC/079BD8 "CLR <$F3"; 079C64 "INC <$F3; LDA <$F3; CMPA #$08": the next block, 079C78 "CLR <$F3"); the sprites'
# attributes, C0 and 10 when it faces left (079B44 "LDA #$C0; STA <$F4", 079B52 "ORA <$F4"; 079C2C "LDA <$F4; EORA
# <$F5"); its animation flags as they were before the drawing cleared them (079AF9 "LDA #$06,X; STA <$F6; CLR #$06,X");
# 1 when it is in the air and its shadow takes a sprite (079AE9 "CLR <$F7", 079AF6 "INC <$F7" on flags bit 3; 079BDB
# "LDA <$F2; ADDA <$F7; CMPA #$08": more than 8 borrow another object's slots; 079C88 "LDA <$F7; BEQ; LBSR $9DFE")
scoped global draw_object 48F1 frame_marked u8
scoped global draw_object 48F2 frame_sprites_left u8
scoped global draw_object 48F3 sprite_slot u8
scoped global draw_object 48F4 frame_attributes u8
scoped global draw_object 48F6 drawn_animation_flags u8
scoped global draw_object 48F7 draw_shadow_sprite u8
# the same, and: a sprite's flip from its list's word, bit 15 (079C02 "CLR <$F5", 079C0E "LDA #$10; STA <$F5"; 079C2F
# "EORA <$F5"); a zoomed object's sprite offsets (079CD4-079DE1): negative (079CEF "CLR <$F0", 079CF9 "DEC <$F0"; 079D31
# "LDA <$F4; EORA <$F0"), their size (079CFC "STA <$EB", 079D1A "LDB <$EB" times the zoom's step by LMUL) and the
# result (079D27 "STD <$FE", 079D3E "ADDD <$FE"), the object kept meanwhile (079CFF "STX <$E9", 079D2E "LDX <$E9")
scoped global write_object_sprites 48E9 zoomed_object u16
scoped global write_object_sprites 48EB zoom_offset u8
scoped global write_object_sprites 48F0 zoom_offset_negative u8
scoped global write_object_sprites 48F2 frame_sprites_left u8
scoped global write_object_sprites 48F3 sprite_slot u8
scoped global write_object_sprites 48F4 frame_attributes u8
scoped global write_object_sprites 48F5 sprite_flipped u8
scoped global write_object_sprites 48F7 draw_shadow_sprite u8
scoped global write_object_sprites 48FB object_sprite_priority u8
scoped global write_object_sprites 48FE zoomed_offset u16

# ======== video/text, video/dream_wave ========
# the text's colour kept while bank 12 is switched in (079311 "STA <$E8", 079319 "LDA <$E8")
scoped global print_game_text 48E8 game_text_colour u8
# the colour of the hex digits, which the callers set (07947F/079486 "LDB <$F0"; print_rom_sum, test_print_rom_ok,
# test_print_rom_bad)
scoped global print_hex_word 48F0 hex_colour u8
# a sine: the angle (0254F6 "STA <$E8", 025504 "LDA <$E8; BITA #$40", 025524 "BITA #$80"), the size (0254F9 "STB <$E9",
# 02551A "LDB <$E9"), the angle in its quarter (0254FE "ANDA #$3F; STA <$EA"), the result (02551E "STA <$ED", 025521
# "CLR <$EC", 02552B "NEGW <$EC", 02552E "LDD <$EC")
scoped global wave_sine 48E8 wave_sine_angle u8
scoped global wave_sine 48E9 wave_sine_size u8
scoped global wave_sine 48EA wave_sine_quarter u8
scoped global wave_sine 48EC wave_sine_value s16
scoped global wave_sine 48EC wave_sine_high u8
scoped global wave_sine 48ED wave_sine_low u8

# ======== video/background_maps ========
# a picture of tiles: blank tiles instead of its own when the number's bit 7 is set (07C524 "INC <$F4", 07C558 "TST
# <$F4; BEQ; LDA #$01"); its width (07C53C "STA <$F0"; 07C566 "LDA #$40; SUBA <$F0" to the next row), height (07C541
# "STA <$F2", 07C56D "DEC <$F2") and colour (07C546 "STA <$F3", 07C54F "LDB <$F3; STB #$-2000,X"); the tiles of the
# row left (07C549 "LDA <$F0; STA <$F1", 07C561 "DEC <$F1")
scoped global draw_tile_picture 48F0 picture_width u8
scoped global draw_tile_picture 48F1 picture_columns_left u8
scoped global draw_tile_picture 48F2 picture_rows_left u8
scoped global draw_tile_picture 48F3 picture_colour u8
scoped global draw_tile_picture 48F4 picture_blank u8
# a layer's column or row to draw: the layer, 0 A or 1 B (07C573/07C618 "STA <$E8"), which find_map_block picks the
# block array by (07C8B7 "LDA <$E8; ASLA; JMP [A,Y]"); an offset added twice: the column's or row's place in the tile
# RAM (07C589 "STD <$F0", 07C59A "ADDD <$F0"; 07C630, 07C63F), then the cell's in the map's strip (07C5EE "STD <$F0",
# 07C607 "ADDD <$F0"; 07C69B, 07C6AB); the scroll the drawing steps from, y for a column (07C58F/07C5FD "LDD [#$04,X];
# STD <$F8") and x for a row (07C626 "LDD [#$02,X]; STD <$F8"); the floor map's place (07C5AF/07C649 "STY <$FA"); a
# row's step from a strip's cell to the next strip's (07C680 "STX <$FC", 07C687 "SUBD <$FC; SUBD #$0010; STD <$FC"),
# a column's first cell (07C5F5 "STY <$FC", which nothing reads)
scoped global find_layer_column 48E8 map_layer u8
scoped global find_layer_column 48F0 map_place_offset u16
scoped global find_layer_column 48F8 map_draw_scroll u16
scoped global find_layer_column 48FA floor_map_place u16
scoped global find_layer_column 48FC map_column_cell u16
scoped global find_layer_row 48E8 map_layer u8
scoped global find_layer_row 48F0 map_place_offset u16
scoped global find_layer_row 48F8 map_draw_scroll u16
scoped global find_layer_row 48FA floor_map_place u16
scoped global find_layer_row 48FC map_strip_step u16
# a column of 8 blocks (07C747/07C79C "LDA #$08; STA <$F0", 07C783/07C7DC "DEC <$F0"): the tile's or cell's column in
# each block (07C744/07C799 "STB <$F1", 07C763 "LDA <$F1; LBSR $C6BD"), the map's cell, 16 bytes a strip on (07C75D/07C7B0
# "STY <$F2", 07C77D "LDY <$F2; LEAY #$10,Y"); the scroll 20 a block on, the tile RAM or floor map going round at 256
# (07C769 "LDD <$F8; ADDD #$0020; EORA <$F8; BITA #$01", 07C77A "STD <$F8"); the floor map's place (07C7B6 "LDY <$FA",
# 07C7D3 "STY <$FA")
scoped global draw_map_column 48F0 map_column_blocks_left u8
scoped global draw_map_column 48F1 block_tile_column u8
scoped global draw_map_column 48F2 column_map_cell u16
scoped global draw_map_column 48F8 map_draw_scroll u16
scoped global fill_floor_map_column 48F0 map_column_blocks_left u8
scoped global fill_floor_map_column 48F1 block_tile_column u8
scoped global fill_floor_map_column 48F2 column_map_cell u16
scoped global fill_floor_map_column 48F8 map_draw_scroll u16
scoped global fill_floor_map_column 48FA floor_map_place u16
# a row of 12 blocks (11 for the floor map: 07C7F5 "LDA #$0C; STA <$F1", 07C853 "LDA #$0B", 07C83A "DEC <$F1"): the
# tile's or cell's row in each block (07C7F2/07C850 "STB <$F0", 07C810 "LDA <$F0"); the scroll 20 a block on (07C816
# "LDD <$F8; ADDD #$0020; STD <$F4; EORA <$F8", 07C834 "LDD <$F4; STD <$F8"), past 256 the next strip (07C82F "LDD <$FC;
# LEAY D,Y"); the floor map's place (07C86B "LDY <$FA", 07C887 "STY <$FA")
scoped global draw_map_row 48F0 block_tile_row u8
scoped global draw_map_row 48F1 map_row_blocks_left u8
scoped global draw_map_row 48F4 map_next_scroll u16
scoped global draw_map_row 48F8 map_draw_scroll u16
scoped global draw_map_row 48FC map_strip_step u16
scoped global fill_floor_map_row 48F0 block_tile_row u8
scoped global fill_floor_map_row 48F1 map_row_blocks_left u8
scoped global fill_floor_map_row 48F4 map_next_scroll u16
scoped global fill_floor_map_row 48F8 map_draw_scroll u16
scoped global fill_floor_map_row 48FA floor_map_place u16
scoped global fill_floor_map_row 48FC map_strip_step u16
# the map block's number (07C8B1 "STD <$FE"), then twice it, 18 bytes a block (07C8E3 "LDD <$FE; ASLB; ROLA; STD <$FE",
# 07C8F1 "ADDD <$FE"; layer B's 07C91D-07C92B); the layer it is for (07C8B7 "LDA <$E8")
scoped global find_map_block 48E8 map_layer u8
scoped global find_map_block 48FE map_block u16
scoped global find_layer_a_block 48FE map_block u16
scoped global find_layer_b_block 48FE map_block u16

# ======== engine/floor ========
# the offset from the object's place the floor map is read at, 8.8, across and on the floor (floor_cell_at 0794EE "LDD
# <$E9", 079516 "LDD <$ED"): whole pixels (floor_at_offset 079495 "STA <$E9; CLR <$EA; STB <$ED; CLR <$EE"), the speeds
# (floor_ahead_x 0794BC "STD <$E9", floor_ahead_y 0794CA "STD <$ED"), 0 (floor_cell_under), or the offsets its caller
# (burns_robot_run) leaves at 48F8/48FA (floor_at_scratch_offset 0794A7 "LDD <$F8; STD <$E9; LDD <$FA; STD <$ED")
scoped global floor 48E9 floor_offset_x s16
scoped global floor 48E9 floor_offset_x_pixels s8
scoped global floor 48EA floor_offset_x_fraction u8
scoped global floor 48ED floor_offset_y s16
scoped global floor 48ED floor_offset_y_pixels s8
scoped global floor 48EE floor_offset_y_fraction u8
scoped global floor 48F8 floor_probe_dx s16
scoped global floor 48FA floor_probe_dy s16
# the cell: the x offset's sign, FF when negative, the high byte of the sum (0794EB "CLR <$E8", 0794F3 "COM <$E8", 0794FE
# "ADCA <$E8"), then the cell's column (07950D "CLR <$E8; STB <$E9", 07953D "ADDD <$E8"); the y offset's sign likewise
# (079513 "CLR <$EC", 07951B "COM <$EC", 079526 "ADCA <$EC"), then the place's y (079529 "STD <$EC", 07952F "SUBD <$EC")
scoped global floor_cell_at 48E8 floor_cell_column u16
scoped global floor_cell_at 48E8 floor_offset_x_sign u8
scoped global floor_cell_at 48E9 floor_offset_x s16
scoped global floor_cell_at 48E9 floor_cell_column_low u8
scoped global floor_cell_at 48EC floor_place_y u16
scoped global floor_cell_at 48EC floor_offset_y_sign u8
scoped global floor_cell_at 48ED floor_offset_y s16
# the cell's sprite priority bits, put into the object's attributes (07CD97 "ANDA #$30; STA <$E8", 07CDA1 "ORA <$E8";
# 07CDB4-07CDCC)
scoped global unused_take_floor_priority 48E8 floor_priority_bits u8
# the floor map's cell under the object (07CE0D "STA <$F0"), where its speeds take it (07CE3B "STA <$F1; STA #$47,X;
# CMPA <$F0"), and first the cell's priority bits (07CE1E "ANDA #$30; STA <$F2", 07CE28 "ORA <$F2"), then where its x
# speed or its y speed alone takes it (07CE52 "STA <$F2", 07CE6C "STA <$F2"; check_floor_ahead 07CEA4 "STA <$F2; EORA
# <$F0", 07CEAE "LDA <$F2; ANDA #$0F; STA #$45,X")
scoped global check_floor 48F0 floor_cell_here u8
scoped global check_floor 48F1 floor_cell_ahead u8
scoped global check_floor 48F2 floor_cell_probe u8

# ======== engine/objects, engine/directions ========
# the 30 words of each object cleared (079565 "LDA #$30; STA <$E8", 07956D "DEC <$E8")
scoped global clear_objects 48E8 cleared_words_left u8
# a list's objects (07957F "LDA #$08; STA <$E8", 0795A9 "DEC <$E8"; list 1's 0A, the children's 06) and the 30 words of
# each cleared (079592 "LDA #$30; STA <$E9", 07959F "DEC <$E9")
scoped global clear_enemy_objects 48E8 cleared_objects_left u8
scoped global clear_enemy_objects 48E9 cleared_object_words_left u8
scoped global clear_list_1_objects 48E8 cleared_objects_left u8
scoped global clear_list_1_objects 48E9 cleared_object_words_left u8
scoped global clear_child_objects 48E8 cleared_objects_left u8
scoped global clear_child_objects 48E9 cleared_object_words_left u8
# the direction whose sine it takes, its bit 7 the sign (07CCA3 "STA <$EC", 07CCB9 "TST <$EC; BPL; NEGD"; 07CCC3,
# 07CCD6)
scoped global scaled_sine_from_table 48EC sine_direction u8
scoped global walk_sine_from_table 48EC sine_direction u8
# the distances to the other object, across (07CD03 "STA <$EC" the sign, 07CD06 "ABSD; STD <$E8") and on the floor
# (07CD10 "STA <$ED", 07CD14 "STD <$EA"), scaled to fit a byte (07CD1E "LDB <$E8", 07CD23 "LSRW <$E8", 07CD2E "LSRW
# <$EA", 07CD36 "ASLW <$EA"), the shorter over the longer (07CD3C "LDX <$EA; LDB <$E9; DIV X,B") into the arctangent;
# the signs give the quarter (07CD79 "LDB <$EC; BPL", 07CD80 "LDB <$ED")
scoped global direction_to 48E8 direction_dx u16
scoped global direction_to 48E8 direction_dx_high u8
scoped global direction_to 48E9 direction_dx_low u8
scoped global direction_to 48EA direction_dy u16
scoped global direction_to 48EA direction_dy_high u8
scoped global direction_to 48EB direction_dy_low u8
scoped global direction_to 48EC direction_dx_sign s8
scoped global direction_to 48ED direction_dy_sign s8

# ======== system/boot, system/eeprom, system/jump_table ========
# the sum of a ROM chip's bytes, a word (add_fixed_bytes 078E63 "CLRA; CLRB; STD <$FA"; add_rom_bytes 078E68 "LDD <$FA;
# ADDB ,X+; ADCA #$00; STD <$FA"), checked against the chip's (ram_rom_check 078C43 "LDD <$FA", 078C1F "STD <$FA") and
# printed (print_rom_sum 078DC8 "LDD <$FA; LBSR $947D"); the restart's wait after a bad check, 16 long loops (078D6D
# "LDA #$10; STA <$F2", 078D7D "DEC <$F2")
scoped global add_fixed_bytes 48FA rom_sum u16
scoped global add_rom_bytes 48FA rom_sum u16
scoped global ram_rom_check 48FA rom_sum u16
scoped global ram_rom_check 48F2 check_wait_loops u8
# the sum printed in red (40) when it is bad (078DBD "CLR <$F0", 078DC3 "LDB #$40", 078DC5 "STB <$F0"), print_hex_word's
# colour
scoped global print_rom_sum 48F0 hex_colour u8
scoped global print_rom_sum 48FA rom_sum u16
# the 3 letters of OK or BAD (078E9A "LDA #$03; STA <$F0", 078EA9 "DEC <$F0")
scoped global print_check_result 48F0 result_letters_left u8
# the EEPROM's address the test reads back, whose value has to be that address (05EA2D "CLR <$F0", 05EA34 "CMPB <$F0",
# 05EA3A "INC <$F0")
scoped global eeprom_test 48F0 eeprom_test_address u8
# the sum of the EEPROM's bytes 00-7D (eeprom_sum 05EA92 "STD <$F0", 05EA9F "ADDD <$F0; STD <$F0"), written at 7E-7F
# (eeprom_write_sum 05EA5B "LDB <$F0", 05EA62 "LDB <$F1") or checked against them (eeprom_verify 05EA77 "CMPD <$F0");
# the address it is at (05EA95 "STA <$F2", 05EAA5 "INC <$F2; LDA <$F2; CMPA #$7E")
scoped global eeprom 48F0 eeprom_total u16
scoped global eeprom 48F0 eeprom_total_high u8
scoped global eeprom 48F1 eeprom_total_low u8
scoped global eeprom 48F2 eeprom_sum_address u8
# the enemies' list's 8 objects (07C0F0 "LDA #$08; STA <$F1", 07C106 "DEC <$F1")
scoped global check_hits_with_enemies 48F1 hit_check_enemies_left u8
# the distance (|dx| + |dy|) to the nearest player found yet (07D2BA "LDD #$7FFF; STD <$EC", 07D2E0 "CMPD <$EC; BCC",
# 07D2E5 "STD <$EC"), its high byte for the caller (07D2FB "LDA <$EC; CMPA #$7F")
scoped global find_nearest_player 48EC nearest_player_distance u16
scoped global find_nearest_player 48EC nearest_player_distance_high u8
# the floor map cell's sprite priority bits (unused_take_floor_height_and_priority, the jump table's copy of unused_take_floor_priority)
scoped global unused_take_floor_height_and_priority 48E8 floor_priority_bits u8
# the arguments (07E498 "STD <$E8"): the vitality a shade takes (A: 07E4C7 "LDA <$E8", 07E4D2 "ADDA <$E8") and the row
# of hurt_effect_rows (B: 07E4F4 "LDA <$E9; ASLA; LDY A,Y"); the shade the vitality left is at, 0-5 (07E49B "CLR <$EA",
# 07E4D5 "INC <$EA; LDB <$EA; CMPB #$05", 07E4E1 "LDA <$EA; CMPA #$53,X"); the vitality left over the 5 steps (07E4B2
# "STB <$EE" A x 5, 07E4B8 "LDB #$56,X; SUBB <$EE", 07E4C1 "LDB #$1B,X; SUBB <$EE", 07E4CD "CMPA <$EE")
scoped global boss_shade_by_vitality 48E8 shade_arguments u16
scoped global boss_shade_by_vitality 48E8 shade_vitality_step u8
scoped global boss_shade_by_vitality 48E9 shade_effect_row u8
scoped global boss_shade_by_vitality 48EA shade_new_level u8
scoped global boss_shade_by_vitality 48EE shade_vitality_over u8

# ======== test_mode ========
# the colour check's 8 blocks of colours (05E0FB "LDB #$08; STB <$F0", 05E121 "DEC <$F0"), 6 rows each (05E100 "LDB
# #$06; STB <$F1", 05E117 "DEC <$F1"), 4 tiles a row (05E105 "LDB #$04; STB <$F2", 05E10F "DEC <$F2")
scoped global test_color_check_draw 48F0 colour_blocks_left u8
scoped global test_color_check_draw 48F1 colour_block_rows_left u8
scoped global test_color_check_draw 48F2 colour_block_tiles_left u8
# a ramp's 16 colours (05E151 "LDB #$10; STB <$F0", 05E170 "DEC <$F0"), 2 rows of tiles each (05E156 "LDB #$02; STB
# <$F1", 05E166 "DEC <$F1")
scoped global test_color_check_draw_ramp 48F0 ramp_colours_left u8
scoped global test_color_check_draw_ramp 48F1 ramp_rows_left u8
# the coin inputs (direct page 3D), a bit shown at a time beside each player's (05E1AD "LDA <$3D; STA <$F0", 05E1E2
# "LSR <$F0; BCC")
scoped global test_io_check_run 48F0 test_coin_bits u8
# which of the two coinage lines is printed: 0 the first, with the first credit's extra coins (test_print_coinage
# 05E2E5 "TST <$F0; BNE", 05E2EA "LDY #$5A62"), 1 the second (test_options_open 05E31E "CLR <$F0", 05E327 "INC <$F0")
scoped global test_options_open 48F0 test_coinage_line u8
scoped global test_print_coinage 48F0 test_coinage_line u8
# the tile ROM's address, whose high byte is the page the K052109 reads (test_rom_check_sum_tiles 05EAE1 "STX <$F8",
# 05EAF4 "STD <$F8"; test_sum_tile_rom 05EC0A "LDA <$F8; STA $1E00", 05EC46 "INC <$F8"), 40 pages (05EC05 "LDA #$40;
# STA <$E8", 05EC49 "DEC <$E8")
scoped global test_rom_check_sum_tiles 48F8 tile_rom_address u16
scoped global test_sum_tile_rom 48F8 tile_rom_address u16
scoped global test_sum_tile_rom 48F8 tile_rom_page u8
scoped global test_sum_tile_rom 48E8 tile_rom_pages_left u8
# the sprite ROM's address, three bytes into the K053246's 1FA6, 1FA7 and 1FA4 (test_sum_sprite_rom 05EC9A "LDA <$F4;
# STA $1FA6", 05ECA1 "LDA <$F5; STA $1FA7", 05ECA8 "LDA <$F6; STA $1FA4"), 4 on a read (05ECB9 "LDD <$F5; ADDD #$0004;
# STD <$F5", 05ECC2 "LDA <$F4; ADCA #$00"); the check starts it (test_rom_check_sum_sprites 05EB5B "STX <$F4", 05EB67
# "LDA A,U; STA <$F6") and runs 8 reads of 10000 words (05EB6A "LDA #$08; STA <$F0", 05EB72 "DEC <$F0")
scoped global test_rom_check_sum_sprites 48F0 sprite_rom_passes_left u8
scoped global test_rom_check_sum_sprites 48F4 sprite_rom_address u16
scoped global test_rom_check_sum_sprites 48F6 sprite_rom_address_bottom u8
scoped global test_sum_sprite_rom 48F4 sprite_rom_address u16
scoped global test_sum_sprite_rom 48F4 sprite_rom_address_high u8
scoped global test_sum_sprite_rom 48F5 sprite_rom_address_low u16
scoped global test_sum_sprite_rom 48F5 sprite_rom_address_middle u8
scoped global test_sum_sprite_rom 48F6 sprite_rom_address_bottom u8
# the sum's colour for print_hex_word (05ED20 "CLR <$F0"; BAD's 05ED28 "LDA #$40", 05ED42 "STA <$F0")
scoped global test_print_rom 48F0 hex_colour u8

# ======== game, attract ========
# the score looked for (07971A "STD <$E8", 079723 "LDD <$E8; CMPD ,X") and the place it gets (079720 "CLR <$EA", 07972D
# "INC <$EA; LDA <$EA; CMPA #$0A", 079738 "LDA <$EA")
scoped global high_score_rank 48E8 ranked_score u16
scoped global high_score_rank 48EA high_score_place_found u8
# the new record's place (079745 "STA <$E8", 079750 "LDA <$E8; CMPA <$E9"), the place moved down to make room, from
# the last (079748 "LDA #$09; STA <$E9", 079758 "DEC <$E9"), the words of a record moved (07975D "LDA #$04; STA <$EA",
# 079767 "DEC <$EA") or copied from the new record (079771 "LDA #$03; STA <$EA", 07977D "DEC <$EA"); the new record,
# its initials, score and player (079776 "LDU #$48F0; LDD ,U++"), which player_join fills (07B7C9 "STD <$F0", 07B7CF
# "STA <$F2", 07B7B9 "STD <$F3", 07B7D5 "STA <$F5") and the name entry
scoped global insert_high_score 48E8 new_high_score_place u8
scoped global insert_high_score 48E9 high_score_moved_place u8
scoped global insert_high_score 48EA high_score_words_left u8
scoped global insert_high_score 48F0 new_high_score u16
scoped global player_join 48F0 new_high_score u16
scoped global player_join 48F0 new_high_score_initial_1 u8
scoped global player_join 48F1 new_high_score_initial_2 u8
scoped global player_join 48F2 new_high_score_initial_3 u8
scoped global player_join 48F3 new_high_score_points u16
scoped global player_join 48F5 new_high_score_player u8
# the player whose controls are looked at (079789 "CLR <$F0", 07979D "LDA <$F0; ASLA; LDA [A,X]", 0797A8 "INC <$F0")
scoped global check_skip 48F0 skip_player u8
# the demo's players: the player's number (demo_start 07A0D5 "CLR <$F0", 07A0E1 "LDA <$F0; ASLA", 07A11D "INC <$F0";
# demo_play 07A162, 07A1A0) and players_playing's bits, one a player (07A0DB "STA <$F1", 07A106 "LDA <$F1; BITA #$01",
# 07A11A "LSR <$F1"; 07A168, 07A19D)
scoped global demo 48F0 demo_player u8
scoped global demo 48F1 demo_player_bits u8
# the 4 players' scores checked against the high scores (07B4D1 "LDA #$04; STA <$F0", 07B4E0 "DEC <$F0")
scoped global game_finish 48F0 finish_scores_left u8
# the players playing on, each given a full life (07B6B0 "CLR <$F0", 07B6C5 "INC <$F0"); none goes back to the attract
# (07B6D1 "LDA <$F0; BNE")
scoped global end_game 48F0 players_going_on u8
# a profile's typing: the address of its count of letters typed, the text's first word (040834 "STD <$F3", 04084F "CMPA
# [$48F3]", 040866 "INC [$48F3]"); the place of the next letter in the tile RAM (040838 "INCW <$F1", 040847 "STU <$F1"
# after an FE, 04085A "LDX <$F1"); its colour, 0 after an FE (04084A "CLR <$F0", 04085F "LDB <$F0; STB #$-2000,X")
scoped global attract_type_profile_text 48F0 profile_letter_colour u8
scoped global attract_type_profile_text 48F1 profile_letter_place u16
scoped global attract_type_profile_text 48F3 profile_count_address u16

# ======== scenes/high_scores, scenes/scene_objects, scenes/game_start_portraits ========
# a sprite written straight into the sprite RAM: its code (print_sprite_letter 02273E "STD <$E8" from
# sprite_font_codes; unused_print_sprite_code 02274E, by 48EA's entry: 022748 "LDA <$EA"; put_sprite 022771 "LDD <$E8;
# STD #$02,U") at the place the caller keeps across and down the screen (022777 "LDD <$F8; STD #$06,U", 02277D "LDD
# <$FA; STD #$04,U")
scoped global print_sprite_letter 48E8 sprite_text_code u16
scoped global unused_print_sprite_code 48E8 sprite_text_code u16
scoped global unused_print_sprite_code 48EA sprite_code_index u8
scoped global put_sprite 48E8 sprite_text_code u16
scoped global put_sprite 48F8 sprite_text_x u16
scoped global put_sprite 48FA sprite_text_y u16
# the high score table: the first place printed, BCD, one more each entry (02263F "STA <$F0", 022656 "LDA <$F0",
# 02271B "LDA <$F0; ADDA #$01; DAA; STA <$F0"), the 5 entries (022644 "LDB #$05; STB <$F1", 022729 "DEC <$F1"), the
# letters or digits of the entry left (02267B "STA <$F2", 022693 "DEC <$F2"; 0226A0), whether a digit other than a
# leading 0 came yet (0226A7 "CLR <$F3", 0226AA "LDA <$F3", 0226C8 "INC <$F3"); the sprites' place (02264A "STD
# <$F8", 022650 "STD <$FA", 022665 "LDD <$F8; ADDD; STD <$F8", 022712 "LDD <$FA")
scoped global high_scores_print_entries 48F0 table_place u8
scoped global high_scores_print_entries 48F1 table_entries_left u8
scoped global high_scores_print_entries 48F2 table_characters_left u8
scoped global high_scores_print_entries 48F3 table_digit_shown u8
scoped global high_scores_print_entries 48F8 sprite_text_x u16
scoped global high_scores_print_entries 48FA sprite_text_y u16
# the table waved out: 256 lines of the layer's scroll (02256C "CLR <$F0", 022586 "DEC <$F0"), each 13 times the last
# one's (022571 "LDB <$16; MUL; STB <$F1", 02257A "LDB <$F1; MUL", 022583 "STB <$F1"), the sprites' heights likewise
# (022591, 0225AD)
scoped global high_scores_wave_out 48F0 wave_lines_left u8
scoped global high_scores_wave_out 48F1 table_wave_offset u8
# the name entry: the player whose column it is (name_entry_set_up 022076 "CLR <$F0", 02207C "LDA <$F0", 0221A2 "INC
# <$F0"; name_entry_type_initials 02226A "CLR <$F0", 02227C "LDA <$F0; ASLA; LDU A,U", 022299 "INC <$F0"), which also
# counts the 4 initials records (0221B2 "STA <$F0" 4, 0221BE "DEC <$F0") and the 7 Maggies (0221C5 "STA <$F0" 7, 022203;
# 02223C, 022250); the players ranked so far, added to each one's place (022034 "CLR <$F4", 02204E "ADDA <$F4", 022069
# "INC <$F4"); the place drawn, BCD (0220B5 "STA <$F1", 0220D1 "LDA <$F1"), then whether a digit other than a leading 0
# came yet (02210E "CLR <$F1", 022120 "INC <$F1", 02212C "DEC <$F1"); the Maggies' x, 30 apart (0221C9 "STD <$F2",
# 0221E5 "ADDD <$F2"); the player's record (022082 "STY <$FC", 022111 "LDY <$FC") and score (02208A "STD <$FE", 022123
# "LDA <$FE", 02216D "LDA <$FF"); the sprites' place (0220A7 "STD <$F8", 0220AD "STD <$FA", 0220C8 "LDD <$F8")
scoped global name_entry_set_up 48F0 entry_player u8
scoped global name_entry_set_up 48F1 entry_digit_state u8
scoped global name_entry_set_up 48F2 maggie_x_offset u16
scoped global name_entry_set_up 48F4 players_ranked u8
scoped global name_entry_set_up 48F8 sprite_text_x u16
scoped global name_entry_set_up 48FA sprite_text_y u16
scoped global name_entry_set_up 48FC entry_player_record u16
scoped global name_entry_set_up 48FE entry_score u16
scoped global name_entry_type_initials 48F0 entry_player u8
scoped global name_entry_type_initials 48F8 sprite_text_x u16
scoped global name_entry_type_initials 48FA sprite_text_y u16
# a player's initials: its record (0223F4 "STU <$FC", 02240B "LDU <$FC; LDB #$18,U"), the letters left to draw, the one
# being typed pulsing when it is the last (022404 "STA <$F1", 02241E "LDA <$F1; CMPA #$01", 022461 "DEC <$F1"), their
# place (022458 "LDD <$F8; ADDD #$0010; STD <$F8")
scoped global name_entry_edit_initials 48F1 initials_left u8
scoped global name_entry_edit_initials 48F8 sprite_text_x u16
scoped global name_entry_edit_initials 48FC entry_player_record u16
# each player's high score record for insert_high_score: initials (0222E9 "LDD ,Y++; STD <$F0", 0222EE "STA <$F2"),
# score (0222F4 "LDD [#$08,U]; STD <$F3"), player (0222DE "STA <$F5")
scoped global name_entry_save 48F0 new_high_score u16
scoped global name_entry_save 48F0 new_high_score_initial_1 u8
scoped global name_entry_save 48F1 new_high_score_initial_2 u8
scoped global name_entry_save 48F2 new_high_score_initial_3 u8
scoped global name_entry_save 48F3 new_high_score_points u16
scoped global name_entry_save 48F5 new_high_score_player u8
# the players ordered by score: the place filled (022320 "CLR <$E8", 022326 "LDA <$E8; INCA", 02235B "INC <$E8") and
# the place compared with it (02232E "STA <$E9", 02234E "INC <$E9"), whose score is kept (022336 "LDD [A,X]; STD <$EA",
# 02233E "CMPD <$EA")
scoped global name_entry_rank_players 48E8 rank_place u8
scoped global name_entry_rank_players 48E9 rank_other_place u8
scoped global name_entry_rank_players 48EA rank_other_score u16
# an absent player's blank: the player (0253C9 "STA <$EB", 0253E4 "LDA <$EB"), the blank's width (0253D6 "STA <$E8",
# 025405 "SUBB <$E8") and height (0253DB "STA <$EA", 02540C "DEC <$EA"), the tiles of the row left (0253EE "LDA <$E8;
# STA <$E9", 0253FC "DEC <$E9")
scoped global blank_absent_player 48E8 blank_width u8
scoped global blank_absent_player 48E9 blank_columns_left u8
scoped global blank_absent_player 48EA blank_rows_left u8
scoped global blank_absent_player 48EB blank_player u8
# the portraits' screen: each player's bit in players_joined (05ED79 "LDA #$01; STA <$F0", 05ED84 "ANDA <$F0", 05EDAB
# "ASL <$F0") and the players left (05ED7C "LDB #$04; STB <$F1", 05EDAE "DEC <$F1"); run_portraits' bit (05EEAE "LDA
# #$01; STA <$F0", 05EEC4 "ASL <$F0")
scoped global game_start_portraits 48F0 portrait_player_bit u8
scoped global game_start_portraits 48F1 portrait_players_left u8
scoped global game_start_run_portraits 48F0 portrait_player_bit u8
# the players who join: with free play, each player's bit (05EDC3 "LDB #$01; STB <$F0", 05EDD1 "ORB <$F0", 05EDDA "ASL
# <$F0"); else the 4 coin slots (05EDE4 "LDA #$04; STA <$F0", 05EE02 "DEC <$F0") and each slot's player's bit (05EDE9
# "LDB #$01; STB <$F1", 05EDF6 "ORA <$F1", 05EDFF "ASL <$F1")
scoped global game_start_join_players 48F1 join_slot_bit u8
# each portrait's colours: the portrait (05EE46 "CLR <$F0", 05EE4C "LDA <$F0; ASLA; ASLA", 05EE8D "INC <$F0"), its 14
# rows (05EE55 "LDA #$14; STA <$F2", 05EE88 "DEC <$F2") of 9 tiles (05EE5A "LDA #$09; STA <$F1", 05EE74 "DEC <$F1")
scoped global game_start_draw_portraits 48F0 portrait_number u8
scoped global game_start_draw_portraits 48F1 portrait_columns_left u8
scoped global game_start_draw_portraits 48F2 portrait_rows_left u8

# ======== scenes: the stages' closing and opening scenes, the story actors ========
# each player's bit in players_present (stage_end_put_jumpers 0241EC "LDA #$01; STA <$F0", 0241FA "ANDA <$F0", 024224
# "ASL <$F0"; stage_2_end_put_players 024365, 02436E, 024385; stage_2_end_players_look_around 0243B2, 0243BB, 0243DC)
# and its number (0241F1 "CLR <$F1", 0241FF "LDA <$F1", 024227 "INC <$F1; LDA <$F1; CMPA #$04"; 024368, 024373,
# 024388; 0243B5, 0243DF); the jumpers' order, which picks each one's wait (0241F4 "CLR <$F2", 024216 "LDA <$F2; STA
# #$30,Y; LDA A,X", 024221 "INC <$F2")
scoped global stage_end_put_jumpers 48F0 scene_player_bit u8
scoped global stage_end_put_jumpers 48F1 scene_player u8
scoped global stage_end_put_jumpers 48F2 jumper_order u8
scoped global stage_2_end_put_players 48F0 scene_player_bit u8
scoped global stage_2_end_put_players 48F1 scene_player u8
scoped global stage_2_end_players_look_around 48F0 scene_player_bit u8
scoped global stage_2_end_players_look_around 48F1 scene_player u8
# each player shown, or its place blanked when it did not play: its number (stage_end_show_players 0244E3 "CLR <$F0",
# 0244F3 "LDA <$F0", 02450C "INC <$F0"; post_bonus_2_scene_show 024682, 024692, 02469D) and its bit in players_present
# (0244E8 "STA <$F1", 0244EE "ANDA <$F1", 024509 "ASL <$F1"; 024687, 02468D, 02469A)
scoped global stage_end_show_players 48F0 shown_player u8
scoped global stage_end_show_players 48F1 shown_player_bit u8
scoped global post_bonus_2_scene_show 48F0 shown_player u8
scoped global post_bonus_2_scene_show 48F1 shown_player_bit u8
# where the scene's objects go, 08CF in the stage less the camera's x (024744 "LDD #$08CF; SUBD <$AC; STD <$F0", 024759
# "LDD #$0C,Y; ADDD <$F0")
scoped global stage_7_scene_set_up 48F0 scene_x_offset s16
# the 4 objects given the view's rise (0247D5 "STA <$F0" 4, 0247E2 "DEC <$F0"), then the 40 tiles of the row blanked
# (02480A "STA <$F0" 40, 024817 "DEC <$F0")
scoped global stage_7_scene_lift 48F0 lift_items_left u8
# the chain's 6 links (024850 "STA <$F0", 024875 "DEC <$F0"; stage_7_scene_move_chain 0248DA, 0248EA), each new one
# given to the last one's field 2A (02484B "STU <$FA", 02485A "LDX <$FA", 024860 "STY <$FA")
scoped global stage_7_scene_put_chain 48F0 chain_links_left u8
scoped global stage_7_scene_put_chain 48FA chain_last_link u16
scoped global stage_7_scene_move_chain 48F0 chain_links_left u8
# the riders: the 4 players (stage_7_end_board 0249D0 "STA <$F0", 0249FA "DEC <$F0"; stage_7_end_take_off 024A60,
# 024A8E) by players_present's bits (0249D6 "STA <$F1", 0249DB "LDB <$F1", 0249F7 "LSR <$F1"; 024A66, 024A6B, 024A8B);
# the objects of the scene moved together (stage_7_end_zoom_riders 024AF0 "STA <$F0" 5, 024AFC; stage_7_end_move_riders
# 024B06 4, 024B24; stage_8_start_descend 024C92 4, 024CA0; stage_8_start_stop 024CAB 3, 024CB5 "DEC <$F0")
scoped global stage_7_end_board 48F0 scene_riders_left u8
scoped global stage_7_end_board 48F1 rider_bits u8
scoped global stage_7_end_take_off 48F0 scene_riders_left u8
scoped global stage_7_end_take_off 48F1 rider_bits u8
scoped global stage_7_end_zoom_riders 48F0 scene_objects_left u8
scoped global stage_7_end_move_riders 48F0 scene_objects_left u8
scoped global stage_8_start_descend 48F0 scene_objects_left u8
scoped global stage_8_start_stop 48F0 scene_objects_left u8
# stage 8's opening: the 4 players (024BE7 "STA <$F0", 024C19 "DEC <$F0") by players_present's bits (024BED "STA <$F1",
# 024BF5 "LDA <$F1", 024C13 "LSR <$F1"), each player's object kind, 2A on (024BF2 "STA <$F2", 024BFC "LDA <$F2", 024C16
# "INC <$F2")
scoped global stage_8_start_show 48F0 scene_riders_left u8
scoped global stage_8_start_show 48F1 rider_bits u8
scoped global stage_8_start_show 48F2 rider_kind u8
# the reunion: first the bit of the player who gets Maggie (024F9E "STB <$F0", 024FA3 "BITA <$F0", 024FA8 "ASL <$F0"),
# then each player's number (024FC4 "CLR <$F0", 024FF5 "LDA <$F0", 0250AF "INC <$F0") by players_present's bits (024FCA
# "STA <$F1", 024FE2 "LDA <$F1", 0250AC "LSR <$F1"), then the partners' animation, 81 on by 2 (0250C6 "STA <$F0", 0250E4
# "INC <$F0; INC <$F0") and their count (0250CB "STA <$F1", 025121 "DEC <$F1"); the x of the players standing, 60 on by
# -20 (024FD0 "STD <$F8", 025001 "ADDD <$F8", 025011-025017), of those walking in, from -180 (024FD6 "STD <$FA", 025039
# "ADDD <$FA", 025049-02504F; 0250D5) and their waits, 20 more each (024FDC "STD <$FC", 025052-025058; 0250CF, 025144)
scoped global stage_8_end_reunion 48F0 reunion_player u8
scoped global stage_8_end_reunion 48F1 reunion_player_bits u8
scoped global stage_8_end_reunion 48F8 reunion_standing_x u16
scoped global stage_8_end_reunion 48FA reunion_walker_x u16
# the stories: the players left in a loop over the four (story_first_player 03E7F5 "STA <$F0" 4, story_next_player
# 03E800 "DEC <$F0"; story_actor_line_up_players 03E3D7 "LDB #$04; SUBB <$F0": the player's number; story_actor_put_in
# 03E320 "LDA #$04; SUBA <$F0"), which also counts the partners (03E33C "LDA #$04; STA <$F0", 03E373 "DEC <$F0") and the
# actor's 11 child places (03E391 "LDA #$0B; STA <$F0", 03E3A6 "DEC <$F0"; story_actor_remove 03E721, 03E72D);
# players_present's bits (story_actor_put_in 03E302 "LDB <$85; STB <$F1", 03E310 "LSR <$F1"; story_random_player 03E7BD
# "STA <$F1", 03E7D4 "LSR <$F1")
scoped global story 48F0 story_players_left u8
scoped global story 48F1 story_player_bits u8
# an actor walking to its target stops when the target is within its reach: the half width (03E0C5 "LDB #$1F,X; CLRA;
# STD <$F8") then the half depth of its box (03E0ED "LDB #$20,X; CLRA; STD <$F8") either side of its centre across
# (03E0CC "LDB #$39,X; NEGB; SEX; ADDD #$0C,X; STD <$FA", 03E0D7 "LDD <$FA; SUBD <$F8", 03E0E2 "LDD <$FA; ADDD <$F8")
scoped global story_actor_run 48F8 actor_reach u16
scoped global story_actor_run 48FA actor_reach_centre_x u16
# the place the four players are put at steps from (03E55E "STU <$F8", 03E563 "STU <$FA", 03E570 "ADDD <$F8", 03E578
# "ADDD <$FA")
scoped global story_actor_place_players 48F8 place_players_x u16
scoped global story_actor_place_players 48FA place_players_y u16

# ======== stages/scroll ========
# the cemetery's floor laid when its scroll stops: 6 rows (0260CA "STA <$F0", 0260E2 "DEC <$F0") of 9 cells (0260CF "STA
# <$F1", 0260D8 "DEC <$F1")
scoped global cemetery_scroll_slow_down 48F0 cemetery_floor_rows_left u8
scoped global cemetery_scroll_slow_down 48F1 cemetery_floor_cells_left u8
# the camera: a move scaled by a record's ratio (camera_x_follows_y_down 026351 "STD <$F0", camera_scroll_layers
# 02643B/02644B "STD <$F0"; camera_scale_quarter 0264E7 "LDD <$F0; ASRA; RORB ..."); the other layer's move across and
# up (026421 "STD <$F2", 026427 "STD <$F4", 026445 "STD <$F2", 026453 "STD <$F4"), which layer_scroll_move adds to its
# scrolls; a flag to go on to the stage record's next entry, cleared each frame and never set (camera_update 026254
# "CLR <$FE", 0262B6 "LDA <$FE; BEQ")
scoped global camera 48F0 camera_scaled_move s16
scoped global camera 48F2 layer_move_x s16
scoped global camera 48F4 layer_move_y s16
scoped global camera 48FE camera_entry_advance u8
# a layer's scroll moved, a 16.8 value through its layer_scroll record's addresses (026485 "LDD <$F2; ADDD #$01,Y",
# 02648E "LDB <$F2; SEX; ADCA ,Y": the move's sign; 026499 "LDD <$F4", 0264A2 "LDB <$F4")
scoped global layer_scroll_move 48F2 layer_move_x s16
scoped global layer_scroll_move 48F2 layer_move_x_high s8
scoped global layer_scroll_move 48F4 layer_move_y s16
scoped global layer_scroll_move 48F4 layer_move_y_high s8

# ======== players ========
# a player coming in: the tries at places 16 apart across (03817A "STA <$F1" 8, 03818E "DEC <$F1") or 8 apart on the
# floor (0381CB "STA <$F1" 4, 0381DB; 0381E2 9, 0381F8 "DEC <$F1"); the highest floor met at the way in, which
# player_find_entry_floor finds over 8 places (038206 "CLR <$F3", 038213 "CMPB <$F3", 038218 "STB <$F3", 03822C "LDB
# <$F3"; 03820B "STA <$F2" 8, 038224 "DEC <$F2")
scoped global player_run 48F1 entry_tries_left u8
scoped global player_run 48F3 entry_floor_height s8
scoped global player_find_entry_floor 48F2 entry_places_left u8
scoped global player_find_entry_floor 48F3 entry_floor_height s8
# a team's animation: the base EC added to the team's entry (0391E9 "LDB #$EC; STB <$F2", 0391FF "ADDA <$F2; STA
# #$05,U"; the routine every team state runs); the team's attack, either player's attack press (038352 "ORA #$2F,X; ANDA
# #$10; STA <$F0", 038367 "ORA <$F0")
scoped global player_team 48F2 team_animation_base u8
scoped global player_team_move 48F2 team_animation_base u8
scoped global player_team_move 48F0 team_attack_pressed u8
scoped global player_attack_end 48F2 team_animation_base u8
# the player's facing from its velocity (0383E0 "ANDA #$40; STA <$F3", 0383EA "ORA <$F3; STA #$09,U", its partner's
# 0383FD), and the team's animation
scoped global player_walk 48F2 team_animation_base u8
scoped global player_walk 48F3 walk_facing u8
# the priority bits of the floor the player is checked against (player_floor_against_height 039798 "ANDA #$30; STA
# <$F2"), which player_check_motion puts in its attributes (039853 "ORA <$F2; STA #$09,U"); the farthest x the player
# may go to the right (039805 "STX <$F8", 039808 "CMPD <$F8")
scoped global player_floor_against_height 48F2 player_floor_priority u8
scoped global player_check_motion 48F2 player_floor_priority u8
scoped global player_check_motion 48F8 player_x_limit u16
# the screen's edges the player stays within (039A93 "LDX #$0070", 039AA9 "STX <$F8", 039AAC "STY <$FA", 039AE9 "CMPD
# <$F8", 039AF0 "CMPD <$FA") and the floor's priority bits (039ABB "STA <$F0", 039AC3 "ORA <$F0")
scoped global player_check_screen_edges 48F0 edge_floor_priority u8
scoped global player_check_screen_edges 48F8 screen_left_edge u16
scoped global player_check_screen_edges 48FA screen_right_edge u16
# the height speed's sign, the high byte of the 16.8 sum (039B38 "LDB #$19,U; SEX; STA <$F2", 039B4A "ADCA <$F2")
scoped global player_next_height_against_floor 48F2 z_speed_sign s8
# the 4 players' second sprites (03EA69 "STA <$F0", 03EA9B "DEC <$F0")
scoped global players_update_second_sprites 48F0 second_sprites_left u8
# the enemies' list's 8 objects (07BA58 "LDA #$08; STA <$F0", 07BA81 "DEC <$F0") and a beaten one's points (07BA66
# "STA <$F1", 07BA6D "LDA <$F1; ANDA #$30": its player)
scoped global award_enemy_points 48F0 points_objects_left u8
scoped global award_enemy_points 48F1 enemy_points u8

# ======== bonus ========
# where the bonuses draw what they show next: the players' portraits (bonus_show_player_portraits 0211CF "ADDD <$F8",
# 0211D5 "LDD <$FA", from bonus_1_contest's 7C, 98 and bonus_2_show_portraits' 020C2D "STD <$F8" 78, 020C33 "STD
# <$FA" A8), the signs and the timer (bonus_1_contest_ready 020148 "STD <$F8", 02014E "STD <$FA" B8, 020154 "LDD <$F8;
# ADDD #$0028; STD <$F8"; bonus_timer_tick 020678/02067E E0, B8; bonus_2_yell 020BC6 "STX <$F8", 020BCC "STY <$FA";
# unused_bonus_draw_timer_digits 020698 "LDD <$F8", 0206AA "LDD <$FA"); the portraits' animation (bonus_1_contest_start
# 020107 "LDA #$10; STA <$F0", bonus_2_show_portraits 020C38 "STA <$F0" 90; bonus_show_player_portraits 0211B5 "LDB
# <$F0") and the player whose portrait it is (021189 "CLR <$F1", 0211C9 "LDA <$F1", 021208 "INC <$F1; LDB <$F1")
scoped global bonus_1_contest 48F0 portrait_animation u8
scoped global bonus_1_contest 48F8 bonus_draw_x u16
scoped global bonus_1_contest 48FA bonus_draw_y u16
scoped global bonus_1_blow_until_done 48F8 bonus_draw_x u16
scoped global bonus_1_blow_until_done 48FA bonus_draw_y u16
scoped global bonus_timer_tick 48F8 bonus_draw_x u16
scoped global bonus_timer_tick 48FA bonus_draw_y u16
scoped global unused_bonus 48F8 bonus_draw_x u16
scoped global unused_bonus 48FA bonus_draw_y u16
scoped global bonus_2_show_portraits 48F0 portrait_animation u8
scoped global bonus_2_show_portraits 48F8 bonus_draw_x u16
scoped global bonus_2_show_portraits 48FA bonus_draw_y u16
scoped global bonus_show_player_portraits 48F0 portrait_animation u8
scoped global bonus_show_player_portraits 48F1 bonus_portrait_player u8
scoped global bonus_show_player_portraits 48F8 bonus_draw_x u16
scoped global bonus_show_player_portraits 48FA bonus_draw_y u16
# bonus 1's introduction: the player (020036 "CLR <$F1", 020058 "LDA <$F1; STA $18EE", 0200A5 "INC <$F1"), whether the
# first player in the game is shown yet (020039 "CLR <$F2", 020041 "LDA <$F2", 02005F "INC <$F2")
scoped global bonus_1_intro_set_up 48F1 intro_player_number u8
scoped global bonus_1_intro_set_up 48F2 intro_player_shown u8
# the balloons still too small and blowing up by themselves, the players' field 3F ORed (020264 "CLR <$F0", 0202B7 "ORA
# <$F0; STA <$F0", 0202C9 "LDA <$F0; BNE")
scoped global bonus_1_top_up_balloons 48F0 balloons_growing u8
# the player whose balloon is blown (02032A "CLR <$F1", 02032D "LDA <$F1", 02033F "INC <$F1")
scoped global bonus_1_blow_all 48F1 blowing_player_number u8
# one balloon: its player (02034A "STA <$F3"); whether it grows or shrinks, which the stretches go by (0203D5 "CLR
# <$F2", 0203E0 "INC <$F2"; bonus_1_stretch_width 0204AA "TST <$F2", bonus_1_stretch_height 0204E8 "TST <$F2")
scoped global bonus_1_blow 48F2 balloon_growing u8
scoped global bonus_1_blow 48F3 blowing_player u8
scoped global bonus_1_stretch 48F2 balloon_growing u8
# each player's balloon (02077E "CLR <$F0", 020789 "ADDA <$F0", 0207BC "INC <$F0") and its 3 parts (020781 "CLR <$F1",
# 020784 "LDA <$F1; ASLA; ASLA", 0207AB "INC <$F1; LDA <$F1; CMPA #$03")
scoped global bonus_1_put_players 48F0 balloon_player_number u8
scoped global bonus_1_put_players 48F1 balloon_part u8
# whether an absent player was met yet: the first gets no press rate of its own (020829 "CLR <$F0", 020844 "LDA <$F0;
# BEQ", 020853 "INC <$F0")
scoped global bonus_1_set_absent_rates 48F0 absent_player_seen u8
# the 4 players' places kept by bonus_results_read_places (021085 "STA <$F0" ... 02109A "STA <$F3" from the boxes'
# field 45), which bonus 1's end turns into the flights' waits (02020F "LDU #$48F0", 020249 "LDB ,U+; MUL")
scoped global bonus_1_results 48F0 results_places u8
scoped global bonus_results_read_places 48F0 results_marge_place u8
scoped global bonus_results_read_places 48F1 results_homer_place u8
scoped global bonus_results_read_places 48F2 results_bart_place u8
scoped global bonus_results_read_places 48F3 results_lisa_place u8
# bonus 2: the player (bonus_2_all_players 020C41 "STA <$F0" 0-3; bonus_2_intro_set_up 020A59 "STA <$F0"; bonus_2_set_up
# 020AE6 "CLR <$F0", 020AF6 "INC <$F0"; bonus_2_put_player 020B43 "LDA <$F0"; bonus_2_portrait_x 020E72 "LDB <$F0";
# bonus_2_meter_jumps 020D78 "LDB <$F0"), the players' bits, the current one's first (020A5E "STB <$F1" 0F; 020AEC
# "STB <$F1" players_playing; 020B8B "LSR <$F1"), the level meter's move aside (020B63 "CLR <$F2", 020D80 "STB <$F2",
# bonus_2_place_meter 020E8E "LDA <$F2"); where the sign and the timer go (020B25 "STD <$F8" E0, 020B2B "STD <$FA" B8)
scoped global bonus_2 48F0 bonus_2_player_number u8
scoped global bonus_2 48F1 bonus_2_player_bits u8
scoped global bonus_2 48F2 bonus_2_meter_offset s8
scoped global bonus_2 48F8 bonus_draw_x u16
scoped global bonus_2 48FA bonus_draw_y u16
# one player of bonus 2: its bit (020C94 "STB <$F1"), its variables in the work RAM (020C97 "STX <$F8": 49D0 + 8 x
# player), the meter's move (020C8E "CLR <$F2")
scoped global bonus_2_player 48F0 bonus_2_player_number u8
scoped global bonus_2_player 48F1 bonus_2_player_bit u8
scoped global bonus_2_player 48F2 bonus_2_meter_offset s8
scoped global bonus_2_player 48F8 bonus_2_player_variables u16
# the amount added to the field of a player's object and its two partners (020A90 "STX <$F8", 020A99 "ADDD <$F8")
scoped global bonus_2_move_player 48F8 bonus_2_move_amount u16
# the players' 4 slots counted down to the first in the game (02128F "LDA #$04; STA <$F0", 02129E "DEC <$F0", 0212A3
# "LDA #$04; SUBA <$F0")
scoped global bonus_first_player_in_game 48F0 first_player_slots_left u8
# the results' 4 boxes (bonus_results_start 020F4F "LDA #$04; STA <$F0", 020F70 "DEC <$F0"; bonus_results_count_points
# 021023, 02106B) and the box's place in the tile RAM, 9 on each (020F57 "LDX #$2310; STX <$F8"; 02102B "LDX #$2411;
# STX <$F8", 02105E "LDX <$F8; LEAX #$09,X; STX <$F8"), where a box's text prints its number (bonus_results_type_text
# 02124F "LDY #$40,U; STY <$F8", bonus_results_print_number 02125F "LDY <$F8"); the number a box's text prints at its
# percent sign (02124C "LDA <$F0"; 0 while typing: bonus_results_animate 020FF0 "CLR <$F0"); the players whose points
# are all counted (021031 "CLR <$F1", 02104D "INC <$F1", 021076 "LDB <$F1")
scoped global bonus_results_start 48F0 results_boxes_left u8
scoped global bonus_results_start 48F8 results_print_place u16
scoped global bonus_results_count_points 48F0 results_boxes_left u8
scoped global bonus_results_count_points 48F1 results_counts_done u8
scoped global bonus_results_count_points 48F8 results_print_place u16
scoped global bonus_results_type_text 48F0 results_number u8
scoped global bonus_results_type_text 48F8 results_print_place u16
scoped global bonus_results_print_number 48F8 results_print_place u16
# the boxes typed and hopping (020FDB "STA <$F1" 4, 02100D "DEC <$F1"), the number their texts print
scoped global bonus_results_animate 48F0 results_number u8
scoped global bonus_results_animate 48F1 results_typed_boxes_left u8
# the next place: the sign's kind and animation (0210A5 "STX <$F8", 02111B "LDY <$F8"); the players found with the best
# result left (0210A9 "STD <$F0", 0210C3 "INC <$F0", 0210D0 "TST <$F0"), then the boxes counted again (0210DD "CLR <$F0",
# 0210EE "INC <$F0", 021173 "CMPA <$F0"); that best result (0210BE "CMPB <$F1", 0210C6 "STB <$F1", 0210D6 "LDB <$F1"),
# then the 4 boxes left (0210E2 "STB <$F1", 021169 "DEC <$F1")
scoped global bonus_results_place_next 48F0 placed_count u8
scoped global bonus_results_place_next 48F1 placed_result u8
scoped global bonus_results_place_next 48F8 placed_sign u16

# ======== objects, enemies, bosses ========
# the floor map cell an object comes over (A from the floor map) and that cell's priority bits, put into its attributes
# and its floor's height: fat_goon_reach_any_floor 02A303 "STA <$F1", 02A30B "ANDA #$30; STA <$F0", 02A313 "ORA <$F0",
# 02A319 "LDB <$F1; ANDB #$0F" (fat_goon_walk_in_steps 02A3D3-02A3E6, fat_goon_reach_ground 02A607-02A61D,
# goon_reach_floor_level 0285EE-028604, goon_follow_floor 02875F-028772, goon_walk_up_reach_floor 0287F4-02880A)
scoped global fat_goon_reach 48F0 priority_bits u8
scoped global fat_goon_reach 48F1 cell_seen u8
scoped global fat_goon_walk_in_steps 48F0 priority_bits u8
scoped global fat_goon_walk_in_steps 48F1 cell_seen u8
scoped global goon_reach_floor_level 48F0 priority_bits u8
scoped global goon_reach_floor_level 48F1 cell_seen u8
scoped global goon_follow_floor 48F0 priority_bits u8
scoped global goon_follow_floor 48F1 cell_seen u8
scoped global goon_walk_up_reach_floor 48F0 priority_bits u8
scoped global goon_walk_up_reach_floor 48F1 cell_seen u8
# priority bits taken from a floor cell or another object's attributes into the object's (fat_goon_jump_in_jump 02AC21
# "STA <$F0", 02AC37 "ANDA #$30; STA <$F0"; goon_hat_floor_priority 02B342, 02B352, 02B35A "ORA <$F0"; hat_goon_jump_in_fly
# 0289C5, 0289E0, 0289E8; descent_balloon_release 02A797, 02A79F; goon_balloon_set_up 0281AA, 0281B2;
# goon_walk_in_set_up 02856B, 028573; umbrella_goon_float_down_set_up 028A88, 028A98; zombie_setup 03014B "STA <$F0;
# ORB <$F0"; fireman_goon_put_in_missile 02E7CF, 02E7D7; fireman_goon_missile_start 02E7F7, 02E7FF; stage_boss_follow_floor
# 03C132, 03C13A; stage_8_boss_move 03A0A0, 03A0A8; start_object_from_setup 07D15A "STA <$F0", 07D166 "ORA <$F0": its
# attributes without them)
scoped global fat_goon_jump_in_jump 48F0 priority_bits u8
scoped global goon_hat_floor_priority 48F0 priority_bits u8
scoped global hat_goon_jump_in_fly 48F0 priority_bits u8
scoped global descent_balloon_release 48F0 priority_bits u8
scoped global goon_balloon_set_up 48F0 priority_bits u8
scoped global goon_walk_in_set_up 48F0 priority_bits u8
scoped global umbrella_goon_float_down_set_up 48F0 priority_bits u8
scoped global zombie_setup 48F0 priority_bits u8
scoped global fireman_goon 48F0 priority_bits u8
scoped global stage_boss_follow_floor 48F0 priority_bits u8
scoped global stage_8_boss_move 48F0 priority_bits u8
scoped global start_object_from_setup 48F0 setup_attributes u8
# a grabber turned to face its victim, its attributes' facing bit (fat_goon_grab 02AB01 "STA <$F0", 02AB09 "ORA <$F0";
# goon_grab_try 028EB4, 028EBC; zombie_grab_reach 03078C, 030794)
scoped global fat_goon_grab 48F0 grab_facing u8
scoped global goon_grab_try 48F0 grab_facing u8
scoped global zombie_grab_reach 48F0 grab_facing u8
# the player bits of the points (field 27) copied into field 5B (obstacle_update, heavy_obstacle_update: C "unk_48F0 =
# points & 0x30u; OBJECT(x)->shadow_player = (shadow_player & 0xCFu) | unk_48F0")
scoped global obstacle_update 48F0 points_player_bits u8
scoped global heavy_obstacle_update 48F0 points_player_bits u8
# a thrown thing's floor: the cell under it, first its holder's priority bits while carried (carried_obstacle_check_floor
# 02C4E6 "STA <$F0"; throwable_follow_floor 02CB1F, robot_scrap_keep_on_floor 0329D8), the cell its speeds take it to
# (02C50E "STA <$F1; CMPA <$F0", 02C533 "LDB <$F1"; 02CB47; 032A00) and that cell's priority bits (02C544 "STA <$F2",
# 02C54C "ORA <$F2"; 02CB6E, 02CB76; 032A2A, 032A32)
scoped global carried_obstacle_check_floor 48F0 thrown_cell_here u8
scoped global carried_obstacle_check_floor 48F1 thrown_cell_ahead u8
scoped global carried_obstacle_check_floor 48F2 thrown_cell_priority u8
scoped global throwable_follow_floor 48F0 thrown_cell_here u8
scoped global throwable_follow_floor 48F1 thrown_cell_ahead u8
scoped global throwable_follow_floor 48F2 thrown_cell_priority u8
scoped global robot_scrap_keep_on_floor 48F0 thrown_cell_here u8
scoped global robot_scrap_keep_on_floor 48F1 thrown_cell_ahead u8
scoped global robot_scrap_keep_on_floor 48F2 thrown_cell_priority u8
# the floor map's columns (or cells) an object writes, raises or gives back (floor_blocker_write_cells 02B2E7 "STA
# <$F4" 4, 02B305 "DEC <$F4"; platform_scenery_write_cells 02C7EC, 02C80A; platform_scenery_clear_floor 02C893 14,
# 02C8A9; moes_street_scenery_dropper_write_floor 02C390 20, 02C3A2 "LDA <$F4", 02C3E0; obstacle_raise_floor 02CC72 3, 02CC94,
# 02CC9B, 02CCB8; obstacle_restore_floor 02CD02, 02CD12; scenery_block_floor 02D242, 02D256); the steps an obstacle raises
# the floor by (02CC7A "STB <$F5", 02CC9E "LDB <$F5")
scoped global floor_blocker_write_cells 48F4 floor_columns_left u8
scoped global platform_scenery 48F4 floor_columns_left u8
scoped global moes_street_scenery_dropper_write_floor 48F4 floor_columns_left u8
scoped global obstacle_raise_floor 48F4 floor_columns_left u8
scoped global obstacle_raise_floor 48F5 floor_raise_steps u8
scoped global obstacle_restore_floor 48F4 floor_columns_left u8
scoped global scenery_block_floor 48F4 floor_columns_left u8
# the robot's 8 pieces (032E1F "STA <$F4", 032E2D "DEC <$F4")
scoped global robot_put_in_pieces 48F4 robot_pieces_left u8
# the floor map's column a scenery object starts at, two left of the one under it (platform_scenery_start 02C847 "STB
# <$F0", 02C84F "LDB <$F0", 02C856 "STB <$F0", 02C85C "ORB <$F0"; charging_scenery_start 02CA14-02CA29;
# moes_street_scenery_dropper_start 02C316 "STB <$F0")
scoped global platform_scenery 48F0 scenery_floor_column u8
scoped global charging_scenery_start 48F0 scenery_floor_column u8
scoped global moes_street_scenery_dropper_start 48F0 scenery_floor_column u8
# the x speed's high byte, whose sign the bounce goes by (02CDDC "STA <$F0", 02CDE5 "TST <$F0")
scoped global obstacle_rebound_fall 48F0 rebound_x_speed_high s8
# the next food's byte of the pattern, its state unless there are too few players for it (02D328 "STB <$F0", 02D332
# "LDA <$F0")
scoped global shaking_scenery_drop_food 48F0 food_state u8
# where the next place in the stage is, a 16.8 value: its high byte (wrestler_keep_in_area 0217A5 "STA <$F0", 0217B4
# "ADCA <$F0"; stage_7_boss_keep_in_x 022EDD, 022EEC; krusty_balloon_keep_in_arena_x 026D11, 026D20) and the rest
# (02179B "STD <$F1", 0217A8 "LDD <$F1", 0217AE "STD <$F1", 0217B7 "LDB <$F1"; 022ED3-022EEF; 026D07-026D23); on the
# floor likewise (stage_7_boss_keep_in_y 022F0C "STD <$F1", 022F16 "STA <$F0", 022F25 "ADCA <$F0"; krusty_balloon_keep_
# in_arena_y 026D44, 026D4E, 026D5A "LDA <$F0")
scoped global wrestler_keep_in_area 48F0 area_next_x_high u8
scoped global wrestler_keep_in_area 48F1 area_next_x u16
scoped global wrestler_keep_in_area 48F1 area_next_x_pixels u8
scoped global stage_7_boss_keep_in_x 48F0 area_next_x_high u8
scoped global stage_7_boss_keep_in_x 48F1 area_next_x u16
scoped global stage_7_boss_keep_in_x 48F1 area_next_x_pixels u8
scoped global krusty_balloon_keep_in_arena_x 48F0 area_next_x_high u8
scoped global krusty_balloon_keep_in_arena_x 48F1 area_next_x u16
scoped global krusty_balloon_keep_in_arena_x 48F1 area_next_x_pixels u8
scoped global stage_7_boss_keep_in_y 48F0 area_next_y_high u8
scoped global stage_7_boss_keep_in_y 48F1 area_next_y u16
scoped global stage_7_boss_keep_in_y 48F1 area_next_y_pixels u8
scoped global krusty_balloon_keep_in_arena_y 48F0 area_next_y_high u8
scoped global krusty_balloon_keep_in_arena_y 48F1 area_next_y u16
scoped global krusty_balloon_keep_in_arena_y 48F1 area_next_y_pixels u8
# a random number the jump's chance by the rank is compared with (021982 "LDB <$58; ADDB <$16; STB <$F0", 021988 "CMPA
# <$F0")
scoped global wrestler_approach 48F0 attack_roll u8
# the boss' 4 helpers put in (022B43 "CLR <$F0", 022B57 "LDA <$F0", 022B8B "INC <$F0")
scoped global stage_7_boss_put_in 48F0 boss_helper_number u8
# the helpers sent to throw: from a random one (022F60 "LDA <$58; ANDA #$03; STA <$F0", 022F81 "LDA <$F0", 022F88 "INC
# <$F0"), as many as the players allow (022F7E "STA <$F1", 022F8B "DEC <$F1")
scoped global stage_7_boss_order_throws 48F0 throw_helper u8
scoped global stage_7_boss_order_throws 48F1 helper_throws_left u8
# the ride's parts put in a turn apart: 3 arms a third of a turn apart (teacup_goon_ride_put_in_arms 02E915 "STD <$F0" 03
# and 40, 02E92B "LDA <$F1; ADDA #$55", 02E93F "DEC <$F0"), 2 riders half a turn apart (teacup_goon_ride_arm_put_in_riders
# 02E9B0 "STD <$F0", 02E9C6 "LDA <$F1; SUBA #$80", 02E9E2 "DEC <$F0"); the offsets of the point orbit_offset works out
# (teacup_goon_ride_arm_orbit 02EA6A "ADDD <$E8", 02EA76 "ASRW <$EA", 02EA7C "ADDD <$EA"; teacup_goon_follow_arm 02ECC1, 02ECCD
# "ASRW <$EA; ASRW <$EA", 02ECD6)
scoped global teacup_goon 48E8 orbit_x_offset s16
scoped global teacup_goon 48EA orbit_y_offset s16
scoped global teacup_goon 48F0 ride_parts_left u8
scoped global teacup_goon 48F1 ride_part_angle u8
# a point at an angle and a radius round a centre: the angle and the radius (02F259 "STD <$EC", 02F27E "LDA <$EC; BITA
# #$40", 02F271 "LDB <$ED"), the angle in its quarter (02F25E "ANDA #$3F; STA <$EF", 02F26C "SUBA <$EF"), the offsets
# across and on the floor, high bytes cleared, low bytes the products, swapped in the odd quarters (02F267 "STA <$E9",
# 02F275 "STA <$EB", 02F278 "CLR <$E8; CLR <$EA", 02F285-02F28E) and negated (02F296 "NEGW <$EA", 02F2A4 "NEGW <$E8")
scoped global orbit_offset 48E8 orbit_x_offset s16
scoped global orbit_offset 48E8 orbit_x_offset_high u8
scoped global orbit_offset 48E9 orbit_x_offset_low u8
scoped global orbit_offset 48EA orbit_y_offset s16
scoped global orbit_offset 48EA orbit_y_offset_high u8
scoped global orbit_offset 48EB orbit_y_offset_low u8
scoped global orbit_offset 48EC orbit_angle_and_radius u16
scoped global orbit_offset 48EC orbit_angle u8
scoped global orbit_offset 48ED orbit_radius u8
scoped global orbit_offset 48EF orbit_quarter_angle u8
# the same for a chain's link by a direction and a distance (chain_link_offset 035474 "STD <$EC", 035479 "STA <$EF",
# 035482 "STA <$E9", 035490 "STA <$EB", 035493 "CLR <$E8; CLR <$EA", 0354B1 "NEGW <$EA", 0354BF "NEGW <$E8"), which the
# chain's base gives the next piece (dreamland_boss_chain_lead 03519C "LDD <$E8", 0351A2 "LDD <$EA", 0351AB "ADDD <$E8",
# 0351C9 "ADDD <$EA")
scoped global chain_link_offset 48E8 chain_link_dx s16
scoped global chain_link_offset 48E8 chain_link_dx_high u8
scoped global chain_link_offset 48E9 chain_link_dx_low u8
scoped global chain_link_offset 48EA chain_link_dz s16
scoped global chain_link_offset 48EA chain_link_dz_high u8
scoped global chain_link_offset 48EB chain_link_dz_low u8
scoped global chain_link_offset 48EC chain_direction_and_distance u16
scoped global chain_link_offset 48EC chain_direction u8
scoped global chain_link_offset 48ED chain_distance u8
scoped global chain_link_offset 48EF chain_quarter_direction u8
scoped global dreamland_boss_chain_lead 48E8 chain_link_dx s16
scoped global dreamland_boss_chain_lead 48EA chain_link_dz s16
# the chain's 22 pieces built, each numbered in its field 32 (C "unk_48F4 = 0x16u", "mem_write8(u + 0x32u, unk_48F4)"),
# the head they lead to (C "unk_48F2 = (uint8_t)(u >> 8u)", "u = (((uint32_t)unk_48F2 << 8u) | unk_48F3)")
scoped global dreamland_boss_chain_setup 48F2 chain_head_link u16
scoped global dreamland_boss_chain_setup 48F4 chain_pieces_left u8
# the chain's x offset from its holder plus 16, kept between -16 and 15 (0351EB "STD <$F0", 0351F5 "LDD <$F0", 035205
# "LDD <$F0")
scoped global dreamland_boss_chain_shift_offset 48F0 chain_offset_biased u16
# a path record's distance, mirrored as the holder faces (035382 "STB <$F1", 035390 "LDB <$F1")
scoped global dreamland_boss_chain_head_follow_path 48F1 path_distance u8
# the lash picked (0353B4 "STA <$F0", 0353CF "LDA <$F0")
scoped global dreamland_boss_chain_head_choose_lash 48F0 lash_number u8
# the height an object lands at: its floor's plus a margin (cap_fall_and_land 07D188 "LDD #$5C,X; ADDD #$0007; STD
# <$E8", 07D18E "CMPD <$E8"; dreamland_boss_fall 0343EB "STD <$E8", 0343F1 "CMPD <$E8", 10 above)
scoped global cap_fall_and_land 48E8 land_at_height u16
scoped global dreamland_boss_fall 48E8 land_at_height u16
# a taken slot's place in the sprite RAM, kept while the slot is cleared (take_free_object 07CA64 "LDD #$59,U; STD <$E8",
# 07CA75 "LDD <$E8; STD #$59,U"; find_free_object_from_4d40 03544F, 03545D)
scoped global take_free_object 48E8 free_slot_sprites u16
scoped global find_free_object_from_4d40 48E8 free_slot_sprites u16
# the child's x offset from its parent, negated when the parent faces left (07CAB4 "STD <$E8", 07CAC6 "NEGW <$E8", 07CAC9
# "LDD <$E8")
scoped global place_child_object 48E8 child_dx s16
# the damage the hit takes off (07C2A7 "STA <$E8", 07C2AD "SUBA <$E8")
scoped global give_hit 48E8 hit_damage u8
# the hit checks' loops: the players and their partners (collide_players_with_enemies 07C03F "STA <$F0" 8, 07C06B "DEC
# <$F0"; collide_players_with_list_1_objects 07C0AE, 07C0DA; collide_players_with_child_objects 07C076 4, 07C0A3;
# collide_players_with_players 07C1EF 2, 07C205, 07C219, 07C22F), the enemies (07C04E "STA <$F1" 8, 07C063 "DEC <$F1";
# check_hits_with_enemies 07C0F2, 07C106), list 1's objects (07C0BD "STA <$F2" 0A, 07C0D2; unused_collide_with_list_1_objects 07C11F, 07C133)
# and the child objects (07C085 "STA <$F3" 6, 07C09A)
scoped global collide_players_with_enemies 48F0 hit_check_players_left u8
scoped global collide_players_with_enemies 48F1 hit_check_enemies_left u8
scoped global collide_players_with_list_1_objects 48F0 hit_check_players_left u8
scoped global collide_players_with_list_1_objects 48F2 hit_check_list_1_left u8
scoped global collide_players_with_child_objects 48F0 hit_check_players_left u8
scoped global collide_players_with_child_objects 48F3 hit_check_children_left u8
scoped global collide_players_with_players 48F0 hit_check_players_left u8
scoped global unused_collide_with_list_1_objects 48F2 hit_check_list_1_left u8
# two boxes: a box's x offset, mirrored when it faces left (07C162 "LDB #$22,X; SEX; STD <$F4", 07C173 "SUBD <$F4", 07C17B
# "ADDD <$F4"), and the distance of the boxes in y, then x, then z (07C141 "STD <$F6", 07C14B "SUBD <$F6", 07C151 "STD
# <$F6", 07C15D "CMPD <$F6"; 07C17E, 07C19D, 07C1A3, 07C1AF; 07C1BB, 07C1C5, 07C1CB, 07C1D7)
scoped global boxes_overlap 48F4 box_x_offset s16
scoped global boxes_overlap 48F6 box_distance u16
# the reaches a player is looked for within, across and in depth (stage_boss_player_is_near 03C20A "CMPD <$F8", 03C21A
# "CMPD <$FA"; stage_8_boss_player_is_close 03A15C, 03A16C; burns_robot_target_across 03B391 "CMPD <$F8",
# burns_robot_target_in_depth 03B383 "CMPD <$FA"), set by their callers (bear_walk 03CAE7 "STD <$F8" 30, 03CAED "STD
# <$FA" 08; marge_cloud_wait_for_player 03D72F, 03D735; marge_cloud_look 03D7EC, 03D7F2; stage_8_boss_check_close_player
# 03A629, 03A62F; the football player's states, C "unk_48FA = 0xCu"; burns_robot_decide_form_0 03B189, 03B18F 58 and 12)
scoped global stage_boss_player_is_near 48F8 reach_x s16
scoped global stage_boss_player_is_near 48FA reach_y s16
scoped global stage_8_boss_player_is_close 48F8 reach_x s16
scoped global stage_8_boss_player_is_close 48FA reach_y s16
scoped global stage_8_boss_check_close_player 48F8 reach_x s16
scoped global stage_8_boss_check_close_player 48FA reach_y s16
scoped global burns_robot_target 48F8 reach_x s16
scoped global burns_robot_target 48FA reach_y s16
scoped global bear_walk 48F8 reach_x s16
scoped global bear_walk 48FA reach_y s16
scoped global marge_cloud 48F8 reach_x s16
scoped global marge_cloud 48FA reach_y s16
scoped global football_player 48F8 reach_x s16
scoped global football_player 48FA reach_y s16
# the robot's forms: the reaches, and its attack, the second by chance (burns_robot_decide_form_0 03B1A5 "CLR <$F0",
# 03B1AD "STA <$F0"; burns_robot_decide_form_1 03B1DE; burns_robot_decide_late_forms 03B21F), which burns_robot_start_attack
# keeps in its field (03B443 "LDA <$F0")
scoped global burns_robot_decide 48F0 chosen_attack u8
scoped global burns_robot_decide 48F8 reach_x s16
scoped global burns_robot_decide 48FA reach_y s16
scoped global burns_robot_start_attack 48F0 chosen_attack u8
# the walls looked for 20 ahead with floor_at_scratch_offset: across (03B32A "STD <$F8", 03B32D "STD <$F0", 03B330 "CLRD;
# STD <$FA"), then across and by its y speed (03B340 "LDD <$F0; STD <$F8", 03B346 "LDD #$14,X; STD <$FA")
scoped global burns_robot_run 48F0 wall_probe_dx s16
scoped global burns_robot_run 48F8 floor_probe_dx s16
scoped global burns_robot_run 48FA floor_probe_dy s16
# speeds by the way it faces: its stagger (burns_robot_walk_to_maggie 03AA4D "STD <$F0" 0300, 03AA57 "NEGW <$F0", 03AA5D
# "ADDD <$F0"), the shot's (burns_robot_fire_shot 03AF6C 0500, 03AF7D, 03AF8B "LDD <$F0"), the bomb's (burns_robot_lob_throw
# 03B0BC "STD <$F2" 0200, 03B0CD, 03B0D9); the held part's offset (burns_held_part_run, C "unk_48F1 = 0x30u", "unk_48F0_
# halfword = 0u - ...")
scoped global burns_robot_walk_to_maggie 48F0 stagger_speed s16
scoped global burns_robot_fire_shot 48F0 shot_speed s16
scoped global burns_robot_lob_throw 48F2 lob_speed s16
scoped global burns_held_part_run 48F0 held_part_dx s16
# a part: its number, bit 7 turned (03B521 "STA <$E8", 03B559 "TST <$E8"), and its x offset (03B51E "CLR <$EA", 03B537
# "STA <$EB", 03B556 "LDD <$EA")
scoped global burns_robot_place_part 48E8 placed_part_number u8
scoped global burns_robot_place_part 48EA part_dx s16
scoped global burns_robot_place_part 48EB part_dx_low u8
# the wall's hole: 16 rows (03B604 "STA <$F0", 03B620 "DEC <$F0") of 32 tiles (03B609 "STA <$F1", 03B616 "DEC <$F1")
scoped global burns_breakout_break_wall 48F0 wall_rows_left u8
scoped global burns_breakout_break_wall 48F1 wall_tiles_left u8
# the bombs to throw (stage_8_boss_throw 03A431 "STA <$F0" by the players; stage_8_boss_run_around 03A4A1; stage_8_boss_
# throw_bombs 03A925 "STA <$F0", 03A936 "DEC <$F0")
scoped global stage_8_boss_throw 48F0 bombs_left u8
scoped global stage_8_boss_run_around 48F0 bombs_left u8
# a bomb's spread, -3 to 4 (03A7F5 "SUBA #$03; STA <$F0", 03A80A "ADDA <$F0"), and the distance it goes, |dx| + 2 |dy|,
# from which its height speed comes (03A834 "STD <$F8", 03A83E "ADDD <$F8", 03A844 "STD <$F8", 03A847 "ADDD <$F8")
scoped global stage_8_boss_bomb_throw 48F0 bomb_spread s8
scoped global stage_8_boss_bomb_throw 48F8 bomb_distance u16
# the direction the stage 3 boss turns toward its target (stage_3_boss_move 03D3BE "STA <$F0", 03D3C6 "LDA <$F0";
# stage_boss_turn_toward 03C1B4 "CMPA <$F0", 03C1C0 "ADDB <$F0; STB <$F0")
scoped global stage_3_boss_move 48F0 turning_direction u8
scoped global stage_boss_turn_toward 48F0 turning_direction u8
# the bounce's speed, the fall's turned up, three times over four (03CF44 "STD <$F3", 03CF47 "ADDD <$F3", 03CF4A "ADDD
# <$F3")
scoped global bear_boulder 48F3 boulder_bounce_speed s16
# the cage's parts: the offsets record walked (bear_start 03C8F9 "STD <$F8"; bear_put_parts 03C933 "LDY <$F8", 03C95A
# "STY <$F8"), each part's number, up to 0B (03C8FC "CLR <$F1", 03C925 "LDA <$F1", 03C96B "INC <$F1"), the parts of a
# record left (03C901 "STA <$F0" 8, 0A, 6; 03C970 "DEC <$F0")
scoped global bear_start 48F0 cage_parts_left u8
scoped global bear_start 48F1 cage_part_number u8
scoped global bear_start 48F8 cage_part_offsets u16
scoped global bear_put_parts 48F0 cage_parts_left u8
scoped global bear_put_parts 48F1 cage_part_number u8
scoped global bear_put_parts 48F8 cage_part_offsets u16
# the wait before its charge and its throw, less by the players (football_player_start_charge 03C457 "STA <$F0", 03C45C
# "SUBA <$F0; SUBA <$F0"; football_player_run 03C5C8, 03C5CD-03C5DE); first in its run the high byte of its x and y
# speeds' sums (03C542 "STA <$F0", 03C550 "ADCA <$F0", 03C56C, 03C57A)
scoped global football_player_start_charge 48F0 players_share u8
scoped global football_player_run 48F0 players_share u8
scoped global football_player_run 48F8 reach_x s16
scoped global football_player_run 48FA reach_y s16
# the steering's side: the y distance's high byte, its sign (cloud_devil_steer 031111 "STA <$F0", 031120 "TST <$F0";
# flying_saxophone_steer 03356E, 03357D)
scoped global cloud_devil_steer 48F0 steer_dy_high s8
scoped global flying_saxophone_steer 48F0 steer_dy_high s8
# the nearest player's distance (07D312 "STD <$EC", 07D330 "CMPD <$EC", 07D335 "STD <$EC"), as find_nearest_player's
scoped global enemy_target_nearest_player 48EC nearest_player_distance u16
# 40 when the target is to the left (07D35B "CLR <$F0", 07D372 "STA <$F0"), against the target's facing (07D3B4 "LDA <$F0;
# EORA #$09,U")
scoped global enemy_look_at_target 48F0 target_left_bit u8
# the target before the enemy looked again (07D4AC "STU <$F0", 07D4D0 "CMPU <$F0", 07D4D5 "LDU <$F0": its count of
# attackers given back)
scoped global enemy_think 48F0 previous_target u16 object
# the debug display's value, printed as two bytes (034041 "STD <$F0", 034044 "LDA <$F0", 03404F "LDA <$F1"; 03405D)
scoped global unused_show_debug_values 48F0 debug_value u16
scoped global unused_show_debug_values 48F0 debug_value_high u8
scoped global unused_show_debug_values 48F1 debug_value_low u8

# ---- struct object: the fields still unk_XX ----

# ======== common fields ========
# what kind of enemy it is to the engine: bit 7 (FF) not counted among the stage's enemies (07CB84 "LDA #$42,X; BMI;
# INC $1876") nor sharing out a player as its target (07D0E8 "LDA #$42,X; BMI" before "DEC #$45,U" on its target;
# enemy_release_target's first test); not 0, it has the goons' shared animations, the climbs' jumps 84 and 85 (07D6C9
# "LDA #$42,X; BEQ; LDA #$84; STA #$05,X"; 07D702, 07D7B1) and the walks by direction (07D7D1 "LDA #$42,X; LBNE $D2A2");
# the setups give it: 1 the goons (goon_base_set_up, hat_goon_set_up...), 2 the fat goons, FF the bosses and the props
# (bear_start, dreamland_boss_setup, fireman_goon_setup, marge_cloud_start), 0 when one comes in (bear_wait_entrance,
# fireman_goon_walk_out)
field object 42 enemy_class s8
# not 0 while the object has not come in yet (hidden, or waiting for the scroll or its cue): the enemies' list counts
# those at 0 (07CB8D "LDA #$57,X; BNE; INC $1883"), and while any is in the HURRY UP's frames stay at 0 (040CE9 "LDA
# $1883; BEQ; CLRD; STD <$93"); set at a setup (goon_run_in_set_up FF, ghost_on_rope_setup 1, gorilla_entrance_setup
# 80, football_player_start 14) and cleared as it comes in (goon_run_in_go, hat_goon_jump_in_show, wrestler_put_in,
# stage_7_boss_start_entrance, krusty_balloon_appear)
field object 57 entrance_pending u8
# the floor map's cell under it (check_floor 07CE10 "STA #$46,X"; a jump's floor ahead in x: goon_jump_in_leap,
# fat_goon_jump_in_jump C "OBJECT(object)->unk_46 = a" after vector_floor_ahead_x)
field object 46 floor_cell u8
# the cell where it is going (check_floor 07CE3E "STA #$47,X; CMPA <$F0", 07CE82 "LDB #$47,X" when it stands); the cell
# under it at its setup (start_object_from_setup 07D161 "STA #$47,X") or where it lands (goon_reach_floor_level,
# fat_goon_reach_ground C "OBJECT(object)->unk_47 = a")
field object 47 next_floor_cell u8
# the level of the step an enemy met ahead, the cell's low 4 bits (check_floor_ahead 07CEAE "LDA <$F2; ANDA #$0F; STA
# #$45,X", 07CEF0), which the climbs start from (enemy_climb_up_front_start ... C "t1 = OBJECT(object)->unk_45"); not
# common: the players keep their attackers there, the result boxes their place
scoped object enemy 45 step_level u8
# the object check_floor_ahead runs on: an enemy (it is reached through the enemies' climb vector 0785E4 and check_floor)
param check_floor_ahead x object object.enemy

# ======== the players ========
# the enemies going after the player: one more as one takes it as its target, one fewer as it leaves it (enemy_think
# 07D4AF "DEC #$45,U", 07D4CD "INC #$45,U"; 07D0F0 "DEC #$45,U" when one goes; find_least_attacked_player 07CC45 "LDA
# #$45,U")
scoped object player 45 attackers u8
# the sides of the player the enemies attacking it took, a bit each (enemy_leave_side 07D115 "LDB #$46,U", 07D128
# "STB #$46,U"; 07D4F7-07D574)
scoped object player 46 sides_taken u8
# how it is held: the presses left to break free of a grab, 0C as an enemy grabs it (goon_grab_try C
# "OBJECT(object_3)->unk_3D = 0xCu", with its holder in 4B), one off a press (player_struggle C "t3 =
# OBJECT(player)->unk_3D; OBJECT(player)->unk_3D = t3 - 1u"), FF while teamed up (player_take_touches C
# "OBJECT(player)->unk_3D = 0xFFu"), 0 free (player_team_release); the grabbers wait for it to be 0 (zombie_grab_start
# C "t1 = OBJECT(target_player)->unk_3D")
scoped object player 3D hold_presses u8
# cleared with teamed when a team splits (039A4D "CLR #$37,U", 039A50 "CLR #$37,X"); nothing else writes or reads it
scoped object player 37 team_spare u8
# the players' objects in loops (find_least_attacked_player 07CC3D "LDU #$4A40", 07CC52 "LEAU #$00C0,U";
# players_update_second_sprites 03EA6C "LDU #$4A40", 03EA97 "LEAU #$00C0,U": its field 3F, held)
local find_least_attacked_player 07CC3D,07CC52 u player object.player
local players_update_second_sprites 03EA6C,03EA97 u player object.player
# an enemy's target, a player (07D0ED "LDU #$38,X" before "DEC #$45,U"; enemy_think 07D49C "LDU #$38,X", 07D4C6 "LDU
# $1870" the least chased one, 07D4DB "LDU #$38,X"; enemy_leave_side's U)
# the player a grabber goes for or holds, its target (028E19 "LDU #$38,X"; goon_grab_try 028E4C, goon_grab_hold
# 028F03; fat_goon_grab_approach 02AA5C, fat_goon_grab 02AA94, fat_goon_squeeze 02AB65; zombie_grab_start 0306FB,
# zombie_grab_reach 030721, zombie_grab_hold 0307DB; unused_homer_object_hold 02F826): its hold_presses, blink_frames
# and holder
local goon_grab_approach 028E19 u target_player object.player
local goon_grab_try 028E4C u target_player object.player
local goon_grab_hold 028F03 u target_player object.player
param unused_homer_object_wait_hit u hitter object.player

# ======== what the players pick up and carry ========
# a carried thing: 1 while carried (the families' carried), and the kind of its carrier plus one, which the
# throwables' own routines read (player_stand C "OBJECT(object)->unk_3D = 1u; OBJECT(object)->parent = player;
# OBJECT(object)->unk_58 = kind_3 + 1u", 03879A "STA #$58,X"; bouncing_throwable_pick_up C "t1 = OBJECT(object)->unk_58";
# bouncing_prop_follow C "t1 = OBJECT(object)->unk_58", bouncing_prop_bounce_off_edge C "OBJECT(object)->unk_58 = 0u")
scoped object throwable 58 carrier_kind u8
scoped object bouncing_throwable 58 carrier_kind u8
scoped object bouncing_prop 58 carrier_kind u8
# what the player picks up, the object that touched it (player_stand 038749 "LDX #$25,U"; player_pick_up_item 039374
# "LDY #$25,U", player_pick_up_weapon 039398, player_eat_food 0393B6), carried from then on
local player_stand 038749 x picked_up object.throwable
local player_pick_up_item 039374 y picked_up object.throwable
local player_pick_up_weapon 039398 y picked_up object.throwable
local player_eat_food 0393B6 y picked_up object.throwable

# ======== the grabbers ========
# the squeezes of a hold: 1 as the hold's animation loops (goon_grab_squeeze, fat_goon_squeeze_again,
# zombie_grab_hold_loop C "OBJECT(object)->unk_58 = 1u"), one more at 2 (goon_grab_hold C "if (t2 == 2u) ...
# OBJECT(object)->unk_58 = t3 + 1u")
scoped object goon 58 squeeze_step u8
scoped object fat_goon 58 squeeze_step u8
scoped object zombie_grab 58 squeeze_step u8
# whether the goon stands behind a target facing away, as enemy_look_at_target leaves it for any enemy (the enemy
# family's not_behind_target; goon_grab_approach C "t1 = OBJECT(object)->unk_32")
scoped object goon 32 not_behind_target u8
# the grabbing zombie's setup: the sound its beaten animation's marked frame queues, enemy_hurt's frame_sound
# (03067C "LDD #$5100; STD #$4C,X"), and whether it vanishes when beaten (03067F "LDA #$01; STA #$43,X", enemy_hurt's
# vanishes)
scoped object grabbing_zombie 4C frame_sound u16
scoped object grabbing_zombie 43 vanishes u8

# ======== whether a beaten enemy vanishes (enemy_hurt's vanishes, 07E276 "LDA #$43,X; BNE"), set by their setups ========
# C "OBJECT(object)->unk_43 = 1u" after vector_object_setup in each
scoped object donut 43 vanishes u8
scoped object gorilla 43 vanishes u8
scoped object knight 43 vanishes u8
scoped object lumberjack 43 vanishes u8
scoped object ninja 43 vanishes u8
scoped object zombie 43 vanishes u8
scoped object clown_on_ball 43 vanishes u8
scoped object one_eared_rabbit 43 vanishes u8
scoped object fireman_goon 43 vanishes u8
# the beaten enemy that gets up again as a goon keeps its attributes (07E1B1 "STA #$47,X"; enemy_hurt_become_goon C
# "OBJECT(object)->unk_47 = attributes")
scoped object enemy_hurt 47 kept_attributes u8
# the burns robot's part: its action step 40 and 43 = 1 while it holds its attack (C "OBJECT(object)->unk_43 = 1u" on
# the part, object = stack), the robot family's holding_part
# (no line: the part is reached through the stack; left)

# ======== the enemies' moves (nested in the enemy family) ========
# the x speed it is sent flying with, kept to start it again after a step stops it (enemy_sent_flying_start C
# "OBJECT(object)->unk_3E = (uint8_t)(x_speed_2 >> 8u)", enemy_sent_flying_step C "OBJECT(object)->x_speed = t2")
scoped object enemy_sent_flying 3E flight_x_speed s16
# the rush's slowing, FFE0 (negated by the way it goes) added to its x speed in its last 8 frames (enemy_rush_start C
# "OBJECT(object)->unk_3E = 0xFFu; OBJECT(object)->unk_3F = 0xE0u", enemy_rush_slow_down C "x_speed + t1")
scoped object enemy_rush 3E slow_down s16
# the direction it wanders in, from target_direction, turned by 50 or -30 (enemy_wander_start, enemy_wander_turn)
scoped object enemy_wander 3E wander_direction u8

# ======== trigger x's: the stage x its scroll must reach, 16 x a byte of its record (C "t1 = (uint32_t)b << 4") ========
scoped object bystander 3E trigger_x u16
scoped object police_car_door 3E trigger_x u16
scoped object krustyland_door 3E trigger_x u16
# rising_scenery_start C "t6 = rising_scenery_camera_xs[...]", rising_scenery_wait_camera C "t1 = camera_x; t2 = 3E-3F"
scoped object rising_scenery 3E trigger_x u16
# the x it leaves at (prop_start C "t1 = (attributes & 0xFFu) << 4" from PROP leave_x; prop_leave C "t1 =
# OBJECT(object)->x; t2 = 3E-3F")
scoped object prop 3E leave_x u16

# ======== countdowns of the objects' own (field 3C) ========
# fat goons: the route's wait (fat_goon_drop_take_route C "OBJECT(object)->unk_3C = wait", fat_goon_drop_walk_to_floor
# decrements), the entrance's (fat_goon_entrance_start, _pose, _pose_end, _walk_out), the delayed one's
# (fat_goon_delayed_start, _appear), the thrower's: its spawn byte, then 8 frames carrying (fat_goon_thrower_start C
# "OBJECT(object)->unk_3C = parameter", fat_goon_thrower_pick_up "= 8u", fat_goon_thrower_carry decrements); the
# thrower's floor cell where it starts, against the one ahead (fat_goon_thrower_start C "vector_floor_at_offset ...
# OBJECT(object)->unk_45 = a", fat_goon_thrower_steps C "t1 = OBJECT(object)->unk_45")
scoped object fat_goon_drop 3C route_wait u8
scoped object fat_goon_entrance 3C entrance_wait u8
scoped object fat_goon_delayed 3C appear_wait u8
scoped object fat_goon_thrower 3C carry_time u8
scoped object fat_goon_thrower 45 start_cell u8
# the clown's hops (clown_on_ball_hop_away C "= 4u", clown_on_ball_hop decrements); its 44, one more after its setup
# (clown_on_ball_start C "t1 = OBJECT(object)->unk_44; OBJECT(object)->unk_44 = t1 + 1u")
scoped object clown_on_ball 3C hops_left u8
scoped object clown_on_ball 44 setup_count u8
scoped object one_eared_rabbit 44 setup_count u8
# the food's bounces (food_jump_out_start C "= 3u", food_jump_out_bounce decrements) and its bounce's height speed,
# the word after its animation (food_jump_out_start C "t2 = io_read16(animation + 2u)", food_jump_out_bounce C "t1 =
# 3E-3F" with z_speed)
scoped object food_jump_out 3C bounces_left u8
scoped object food_jump_out 3E bounce_speed u16
# kind 10's rise (moes_street_scenery_riser_wait_boss C "= 8u", moes_street_scenery_riser_rise_slowly decrements)
scoped object moes_street_scenery_riser 3C rise_steps u8
# the device's strike frames (woman_in_apron_device_strike C "t1 = OBJECT(object)->unk_3C; ... = t1 - 1u")
scoped object woman_in_apron_device 3C strike_frames u8
# an arm's turn (teacup_goon_ride_arm_turn C "= 0x40u", teacup_goon_ride_arm_turn_for_time decrements); its number times 8,
# and a rider's, the arm's plus its own, the frame time it starts with (teacup_goon_ride_put_in_arms C "mem_write8(u +
# 0x32u, 48F0 x 8)", teacup_goon_ride_arm_put_in_riders C "t1 = OBJECT(object)->unk_32; mem_write8(u + 0x32u, a + t1)",
# teacup_goon_wait_ride C "OBJECT(object)->frame_time = t1")
scoped object teacup_goon_ride_arm 3C turn_time u8
scoped object teacup_goon_ride_arm 32 frame_offset u8
scoped object teacup_goon 32 frame_offset u8
# kind 90: its throws (fireman_goon_setup C "wait = ...->wait << 8 | ...->throws; OBJECT(object)->unk_3C = (uint8_t)wait",
# fireman_goon_throw decrements) and the x it starts at (fireman_goon_setup C "t3 = KIND_90_START(fireman_goon_start)->x")
scoped object fireman_goon 3C throws_left u8
scoped object fireman_goon 3E start_x u16
# kind B3 (kent_brockman_start C "= 6u", kent_brockman_wait_hit decrements)
scoped object kent_brockman 3C hits_left u8
# the bouncing throwable's flight (bouncing_throwable_start C "= 1u", bouncing_throwable_fly decrements)
scoped object bouncing_throwable 3C flight_count u8
# the running animal's stop (running_animal_start C "= 2u", running_animal_stop decrements)
scoped object running_animal 3C stops_left u8
# kind AB: what it lets out (drink_vendor_start C "= 3u", drink_vendor_let_out decrements) and whether one is out
# (drink_vendor_let_out C "OBJECT(object)->unk_3D = t1 + 1u", drink_vendor_wait_child C "OBJECT(object)->unk_3D = 0u")
scoped object drink_vendor 3C let_outs_left u8
scoped object drink_vendor 3D child_out u8
# the door's open time (krustyland_door_opened C "= 0x60u", krustyland_door_close decrements)
scoped object krustyland_door 3C open_time u8
# kind CB (bleeding_gums_murphy_start C "= 3u", bleeding_gums_murphy_hit_end decrements)
scoped object bleeding_gums_murphy 3C hits_left u8
# set to 4 at the robot's setup (robot_setup 032B65 "STA #$3C,X"); nothing of the robot's reads it
scoped object robot 3C spare_count u8

# ======== field 3D of the objects' own ========
# the dropper's unused byte of its drop record (ghost_on_rope_setup C "unused = DROP_START(start)->unused << 8 ...;
# OBJECT(object)->unk_3D = unused >> 8")
scoped object ghost_on_rope 3D drop_unused u8
# not 0 while the platform is held up (platform_scenery_start C "= 0x40u", platform_scenery_launch "= 0u";
# platform_scenery_clear_floor C "t1 = OBJECT(object)->unk_3D; if (t1 == 0u)" crashes down)
scoped object platform_scenery 3D held_up u8
# the boulder's wait, from its spawn byte (boulder_start C "OBJECT(object)->unk_3D = a" from parameter, boulder_wait)
scoped object boulder 3D wait_count u8
# the items' carriers: whether the food was dropped (girl_with_food_start "= 0u", girl_with_food_drop_food, girl_with_food_after_drop,
# sideshow_bob_drop_food C "t1 = OBJECT(object)->unk_3D", item_carrier_start "= 0u")
scoped object girl_with_food 3D food_dropped u8
scoped object sideshow_bob 3D food_dropped u8
scoped object item_carrier 3D food_dropped u8
# the bird's item landed (bird_item_land C "OBJECT(object)->unk_3D = 0u") and the timed throwable thrown
# (timed_throwable_throw C "= 0u"): carried no longer
scoped object bird_item 3D carried u8
scoped object timed_throwable 3D carried u8
# the Krustyland bear: its idle animation's number (caged_gorilla_idle C "t5 = OBJECT(object)->unk_3D; ... = t5 + 1u",
# caged_gorilla_recover_end "= 1u") and its idle frames (caged_gorilla_start C "= 0x10u", caged_gorilla_idle)
scoped object caged_gorilla 3D idle_number u8
scoped object caged_gorilla 44 idle_frames u8
# kind 9E stopped (moe_stop C "OBJECT(object)->x_speed = 0; OBJECT(object)->unk_3D = 1u")
scoped object moe 3D stopped u8

# ======== the dreamland boss and its chain ========
# 0 or 80, which way it turns (dreamland_boss_bounce_off_edges C "OBJECT(object)->unk_37 = t1 ^ 0x80u" at an edge,
# dreamland_boss_third_form_approach C "if ((int8_t)(target_direction - 0x40u - t2) < 0)")
scoped object dreamland_boss 37 side_flip u8
# the chain: the base's attributes, which the links follow (dreamland_boss_chain_lead C "OBJECT(object)->unk_34 =
# attributes", dreamland_boss_chain_link_follow C "t7 = OBJECT(previous_link)->unk_34"); the distance to the next
# piece with next_direction (chain_lead C "t1 = next_direction << 8 | unk_3F" into chain_link_offset;
# dreamland_boss_chain_head_follow_path C "unk_3E_halfword = a << 8 | 48F1")
scoped object dreamland_boss_chain 34 lead_attributes u8
scoped object dreamland_boss_chain 3F next_distance u8
# the head's holder's attributes (dreamland_boss_chain_head_setup C "OBJECT(object)->unk_47 = attributes_2")
scoped object dreamland_boss_chain_head 47 holder_attributes u8
# the chain's pieces reached through the links (chain_lead 03518D "LDY #$2C,X"; chain_link_follow 035285/0352C4 "LDU
# #$2E,X"; chain_head_follow_path 035395 "LDU #$2A,X")

# ======== the bonuses' objects ========
# bonus 1's balloons, the players' objects (4A40 + C0 n): bonus_1_intro_set_up 020033 "LDX #$4A40", 0200A1 "LEAX
# #$00C0,X"; bonus_1_blow_until_done 0201B6, 0201DF; bonus_1_results 02020C, 020251; bonus_1_top_up_balloons 020267,
# 0202BD; bonus_1_put_players 02072E, 020770; bonus_1_take_presses 020803, 02081B; bonus_1_absent_presses 020874,
# 02089D; bonus_mark_players_in_game 0208E9, 0208FC; bonus_1_blow 020436/020451 "PULLS X"; bonus_1_fall 02060A "PULLS X"
local bonus_1_intro_set_up 020033,0200A1 x balloon object.bonus_1
local bonus_1_blow_until_done 0201B6,0201DF x balloon object.bonus_1
local bonus_1_results 02020C,020251 x balloon object.bonus_1
local bonus_1_top_up_balloons 020267,0202BD x balloon object.bonus_1
local bonus_1_put_players 02072E,020770 x balloon object.bonus_1
local bonus_1_take_presses 020803,02081B x balloon object.bonus_1
local bonus_1_absent_presses 020874,02089D x balloon object.bonus_1
local bonus_mark_players_in_game 0208E9,0208FC x balloon object.bonus_1
local bonus_1_blow 020436,020451 x balloon object.bonus_1
local bonus_1_fall 02060A x balloon object.bonus_1
# the results' boxes (4F80 + C0 n): bonus_reward_winners 0209FA "LDX #$4F80", 020A23; bonus_results_animate 020FDE,
# 021009; bonus_results_count_points 021028 "LDU #$4F80", 021067; bonus_results_place_next 0210E5 "LDU #$4F80", 021162
local bonus_reward_winners 0209FA,020A23 x box object.bonus_results
local bonus_results_animate 020FDE,021009 u box object.bonus_results
local bonus_results_count_points 021028,021067 u box object.bonus_results
local bonus_results_place_next 0210E5,021162 u box object.bonus_results

# ======== the story actors (5640) ========
# its 11 child actors' places (story_actor_put_in 03E398 "LEAX #$43,X; LDD ,X; BNE; STU ,X", 03E3A6 "DEC <$F0" from
# 0B), read back by the stories (stage_2_events C "t1 = 47-48", "t4 = 43-44", "t5 = 45-46")
# the actor itself where a story reaches it (stage_2_events 03E81F "LDX #$5640", 03E827 "LBSR $605A"; story_stage_8_end
# 03E9E4 "LDX #$5640", 03EA3C "PULLS X"; story_burns_robot_entrance 03FDC7, 03FE19): its accelerations (STD #$31,X,
# STD #$33,X: C "blocked/unk_32", "hit_from_behind/unk_34") and children
local stage_2_events 03E81F,03E827 x actor object.story_actor
local story_stage_8_end 03E9E4,03EA3C x actor object.story_actor
local story_burns_robot_entrance 03FDC7,03FE19 x actor object.story_actor

# ======== others ========
# the boss reached again from the stack (stage_3_boss_together 03D2D5 "PULLS X": its chase_target; stage_3_boss_update
# 03D589, 03D5F0 "PULLS X": together, partner)
local stage_3_boss_together 03D2D5 x boss object.stage_3_boss
local stage_3_boss_update 03D589,03D5F0 x boss object.stage_3_boss
# the balloon after its animation's call (krusty_balloon_volley_throw 02684A "LBSR $69E0": throw_side)
local krusty_balloon_volley_throw 02684A x balloon object.krusty_balloon
# the stage 8 boss's hits counted in its phase 1 (stage_8_boss_phase_1 C "t3 = OBJECT(boss)->unk_35; ... = t3 + 1u"
# after a sound 7900)
scoped object stage_8_boss 35 phase_1_hits u8
# the jumper's player number, its animation 98 on (stage_end_jumper_fly C "animation = 0x98u + t2"; set by
# stage_end_put_jumpers 024208 "LDA <$F1; STA #$32,Y")
scoped object stage_end_jumper 32 jumper_player u8
# the obstacle's animation, kept from its drop record (dreamland_obstacle_start C "OBJECT(object)->animation = a;
# OBJECT(object)->unk_32 = a"; _land, _settle, _pick_up read it)
scoped object dreamland_obstacle 32 drop_animation u8
# the shaking scenery's food flags (shaking_scenery_start C "OBJECT(object)->unk_47 = object_16_flags[...]",
# shaking_scenery_drop_food C "t1 = OBJECT(object)->unk_47") and its kind and animation kept (shaking_scenery_start C
# "unk_54 = ... | (b << 8)", shaking_scenery_shake_end C "t1 = (uint8_t)(unk_54 >> 8u)")
scoped object shaking_scenery 47 food_flags u8
scoped object shaking_scenery 54 kept_animation u8
# the child's 3D cleared as it is placed (place_child_object C "OBJECT(child)->unk_3D = 0u"): any kind; left unnamed

# ---- REFINEMENTS: these lines refine lines symbols.txt has already (same name, the pointer now typed by its family).
# ---- Appended after symbols.txt they override it (the loader keeps the last struct for a place); the old line,
# ---- quoted after each, can go when merged ----
# an enemy's target is a player: its attackers count and sides (see the player family above)
# replaces symbols.txt "local enemy_release_target 07D0ED u target object"
local enemy_release_target 07D0ED u target object.player
# replaces symbols.txt "param enemy_leave_side u target object"
param enemy_leave_side u target object.player
# the player the grabbers hold: its hold_presses, blink_frames, holder
# replaces symbols.txt "local fat_goon_grab_approach 02AA5C u target object"
local fat_goon_grab_approach 02AA5C u target object.player
# replaces symbols.txt "local fat_goon_grab 02AA94 u target object"
local fat_goon_grab 02AA94 u target object.player
# replaces symbols.txt "local fat_goon_squeeze 02AB65 u target object"
local fat_goon_squeeze 02AB65 u target object.player
# replaces symbols.txt "local zombie_grab_start 0306FB u target_player object"
local zombie_grab_start 0306FB u target_player object.player
# replaces symbols.txt "local zombie_grab_reach 030721 u target_player object"
local zombie_grab_reach 030721 u target_player object.player
# replaces symbols.txt "local zombie_grab_hold 0307DB u held_player object"
local zombie_grab_hold 0307DB u held_player object.player
# replaces symbols.txt "local unused_homer_object_hold 02F826 u held object"
local unused_homer_object_hold 02F826 u held object.player
# the chain's pieces: their lead_attributes, next_dx, next_dz, next_direction, next_distance, queued_direction
# replaces symbols.txt "local dreamland_boss_chain_lead 03518D y next_link object"
local dreamland_boss_chain_lead 03518D y next_link object.dreamland_boss_chain
# replaces symbols.txt "local dreamland_boss_chain_link_follow 035285 u previous_link object" and the one at 0352C4
local dreamland_boss_chain_link_follow 035285 u previous_link object.dreamland_boss_chain
local dreamland_boss_chain_link_follow 0352C4 u previous_link object.dreamland_boss_chain
# replaces symbols.txt "local dreamland_boss_chain_head_follow_path 035395 u chain_base object"
local dreamland_boss_chain_head_follow_path 035395 u chain_base object.dreamland_boss_chain
# ======== the football player's throws (their own families) ========
# the thrown football's flight frames (football_thrown C "OBJECT(object)->unk_3F = 0x15u", "t1 = ...->unk_3F; ... = t1
# - 1u") and a piece of the line the charge leaves behind, its frames (football_line_piece C "= 0x13u", decremented)
scoped object football_thrown 3F flight_frames u8
scoped object football_line_piece 3F life_frames u8
# the player the second sprite routines get in U (03EC.. "player_second_sprite_..." called with the player's object):
# its last_life (player_update_class C "OBJECT(object)->unk_52 = vitality") and partner (the balloons' C "t2 =
# ((uint32_t)OBJECT(object)->unk_32 << 8u) | OBJECT(object)->hit_from_behind": LDD #$32)
param player_update_class u player object.player
param player_second_sprite_start_balloon u player object.player
param player_second_sprite_balloon u player object.player

# ======== parameters and locals: objects a-j ========
# ======== the parameters and locals of objects/a* to j* ========
# Evidence: build/listing/simpsons.s (PLACE "INSTRUCTION") and the C of the Cobjects/. Left to the callees'
# parameters: the values only handed to stage_boss_set_state (Y state and wait, D animation),
# stage_boss_set_gauge, stage_boss_set_hit_box, stage_boss_walk_by_rank (Y tables, D direction), vector_palette_request
# (D) and vector_queue_sound; and the list dispatchers' U (each list's handler table, run_enemies & co.) and B (the
# state), which every type's handler is handed.

# ---- objects/bear.c ----
# the bear's state table, which the dispatcher jumps through and hands each state's handler, and which they hand back
# when they do not take a state (03C8C8 "LDY #$7DEC", 03C8CB "JMP [A,Y]")
local bear 03C8C8 y states
# the damage and strength the boulder hurts with while the bear stands, none when it is beaten (03CF8A "LDU #$0401",
# 03CF94 "LDU #$0000"; "OBJECT(object)->damage = (uint8_t)(u >> 8u); OBJECT(object)->attack = (uint8_t)u"); what it
# is handed in U is only handed back
param bear_boulder u damage
# the cage parts' child records bear_put_parts puts in (03C904 "LDY #$7E1C", 03C90E "LDY #$7E24", 03C918 "LDY #$7E14";
# 03C92E "LBSR $862C" spawns from Y)
local bear_start 03C904,03C90E,03C918 y record child_object
# the part each spawn puts in (03C92E "LBSR $862C": U), placed at its offset (03C939 "ADDD #$0C,U; STD #$0C,U; STD
# #$50,U") and numbered (03C968 "STA #$2D,U": bear_part.number); its rest height 54 (03C957 "STD #$54,U")
local bear_put_parts 03C92E u part object.bear_part
# the board control byte with the floor map's bit set and cleared around the clearing (03C9C3 "ORA #$02", 03C9E8
# "ANDA #$FC"; "STA <$0F; STA $1FC2")
local bear_break_out 03C9C3,03C9E8 a control
# the floor map's cell under the bear (03C9BB "LBSR $8650": floor_cell_under hands back its place in U), from whose row
# it clears 256 bytes, the floor map seen with the board control's bit 1 (03C9CE-03C9DA "PUSHS U; PULLS D; ANDB $00C0;
# PUSHS D; PULLS X"; 03C9DC "LDU #$0100", 03C9DF "CLRA", 03C9E0 "BSET A,X,U")
local bear_break_out 03C9BB u cell_place
local bear_break_out 03C9DC,03C9E0 u count
local bear_break_out 03C9DA,03C9E0 x floor_row
local bear_break_out 03C9DF a fill
# what the cage parts do, through 184A (bear_part reads it as its phase): 0/1 shake while the wait counts (03CA0B
# "CLRB", 03CA0C "ANDA #$10", 03CA10 "INCB"), 2 fly off (03CA07 "LDB #$02"); 03CA11 "STB $184A"
local bear_break_out 03CA07,03CA0B,03CA10 b parts_phase
# the state and its wait to take facing the nearest player (03CA5E "PUSHS Y" ... "PULLS Y; LDA #$89; LBSR $604C"): 0610,
# 0603, 0601 from its callers (03CA5B, 03CC15, 03CC3B "LDY #$06xx")
param bear_face_player y state_wait
# a random number: bit 3 clear picks a player at random by its bits 0-1 (03CA7F "LDA <$58; BITA #$08", 03CA85 "ANDA
# #$03; LDB #$C0; MUL")
local bear_choose_target 03CA7F a roll
# the way it faces (03CB52 "ANDA #$40": attributes bit 6) and the offset beside its target it walks to: 26 or DA pixels
# by the side it is on (03CB5C "LDB #$26", 03CB73 "LDB #$DA"; 03CB8A "LBSR $8671" the direction to B pixels beside U)
local bear_walk 03CB52 a facing
local bear_walk 03CAF0,03CB5C,03CB73 b offset
# its chase target (03CB45 "LDU #$34,X": bear.chase_target), compared with its x (03CB57 "CMPY #$0C,U")
local bear_walk 03CB45 u target object
# the nearest player, which it faces (03CB04 "LBSR $6313": stage_boss_face_nearest_player hands it back in U)
local bear_walk 03CB04 u player object
# its wait as it swells (03CD0B "LDA $002F": the program reads and counts 002F, 03CD05 "DEC $002F", where field 2F, its
# wait, is meant), compared with 11 to spawn the change effect (03CD13 "LDY #$7E94; LBSR $862C") and 28 to grow; then
# its zoom, one larger each frame (03CD22 "LDA #$0A,X; ADDA #$01; STA #$0A,X; STA #$0B,X")
local bear_change 03CD0B,03CD16 a wait
local bear_change 03CD25 a zoom
# the bear's x (03CDB9 "LDY #$0C,X"): near the screen's sides it turns to face inward (03CDBC "CMPY #$0058", 03CDC6
# "CMPY #$0162")
local bear_think 03CDB9 y bear_x
# animation 82 or 83 by whether it faces the one that hit it (03CDEE "LDA #$09,X; EORA #$09,U"; 03CDFA "LDA #$82",
# 03CE01 "LDA #$83")
local bear_check_hit 03CDFA,03CE01 a flinch_animation
# done: objects/bear.c

# ---- objects/bird_item.c ----
# the bird's setup record (02D69B "LDU #$7F7D", 02D69E "LBSR $85AB": vector_object_setup reads it at U) and the hit box
# the setup leaves in Y (07D13E "LDY #$02,U" of the record)
local bird_item_start 02D69B u setup object_setup
local bird_item_start 02D69E y box
# its height (02D6BB "LDD #$16,X"; "CMPD #$0070")
local bird_item_rise 02D6BB d height
# done: objects/bird_item.c

# ---- objects/boss_door.c ----
# the doors' state tables, which the dispatchers jump through and hand the states (0277FC "LDU #$7FED", 027894 "LDU
# #$7FF3"; "LDB #$02,X; ASLB; JMP [B,U]")
local boss_door 0277FC u states
local boss_door_stage_8 027894 u states
# the list the other half is taken from (02780B / 0278AE "LBSR $867D" with B 1 or 2: vector_find_free_slot)
local boss_door_set_up 02780B d list
local boss_door_stage_8_set_up 0278AE d list
# the door's other half, which the states show and hide through U ("LDU #$2C,X" then "STA ,U", "STA #$05,U": its flags
# and animation) and hand back; what they are handed in U is only handed back
param boss_door_closed u half object
param boss_door_open u half object
# done: objects/boss_door.c

# ---- objects/boulder.c ----
# its parameter (02CE82 "LDA #$30,X"), kept in 3D and picking its drop record (boulder_drops + 4 x parameter)
local boulder_start 02CE82 a drop_number
# the floor map's cell under it (02CEA1 / 02CF81 "LBSR $8638", floor_at_offset with D 0: A the cell, bit 7 no floor,
# bits 0-3 the floor's height in 8s)
local boulder_start 02CEA1 a cell
local boulder_start 02CEA1 d floor_cell
local boulder_bounce 02CF81 a cell
local boulder_bounce 02CF81 d floor_cell
# the zoom of one bouncing away, one smaller each frame down to 2020 (02CF72 "LDD #$0A,X", 02CF75 "SUBD #$0101")
local boulder_bounce 02CF75 a new_zoom_x
local boulder_bounce 02CF75 d new_zoom_y
# its up speed as it falls past the floor (02CFE2 "SUBD #$0020", kept at FC00 or more)
local boulder_bounce 02CFE2 a z_speed_high
# its height (02CFF4 "LDD #$16,X"; "CMPD #$FF80")
local boulder_fall_in_front 02CFF4 d height
# the rock's setup record (02D043 "LDU #$7E0B", 02D046 "LBSR $85AB") and the hit box the setup leaves in Y
local gorge_rock_start 02D043 u setup object_setup
local gorge_rock_start 02D046 y box
# done: objects/boulder.c

# ---- objects/bouncing_prop.c ----
# the step tables the prop's steps run through by field 29 (03207C "LDU #$78C6", 032203 "LDU #$78D4"; "LDB #$29,X;
# ASLB; JMP [B,U]")
local bouncing_prop_leave 03207C u steps
local bouncing_prop_bounce 032203 u steps
# the hit box it bounces with (032127 "LDY #$78AC", 03212B "LBSR $85B4": vector_set_hit_box)
local bouncing_prop_bounce_start 032127 y box hit_box
# the prop's setup record (032148 "LDU #$78CE", 03214B "LBSR $85AB") and the hit box the setup leaves in Y
local bouncing_prop_setup 032148 u setup object_setup
local bouncing_prop_setup 03214B y box
# the nearest player it moves at (0321B4 "LBSR $8620": vector_choose_nearest_player; "LDD #$0C,X; SUBD #$0C,U", "LDD
# #$11,X; SUBD #$11,U"); what it is handed in U is only handed back
param bouncing_prop_follow u player object
# the direction to the place beside the player (0321D2 "LBSR $8671": A), and the floor's cell ahead (0321E4 "LBSR
# $863B": A, bit 7 no floor)
local bouncing_prop_follow 0321D2 a direction
local bouncing_prop_follow 0321E4 a cell
# done: objects/bouncing_prop.c

# ---- objects/burns_robot.c ----
# the robot's handlers by its handler number (03A9C3 "LDU #$7AEE", 03A9C6 "LDA #$02,X; ASLA; JSR [A,U]")
local burns_robot_run 03A9C3 u handlers
# the floor's cell where its speeds take it (03B334 / 03B34C "LBSR $8632", 03B33A "LBSR $8647": A, bit 7 no floor:
# 03B337 "TSTA; BMI")
local burns_robot_run 03B334,03B33A,03B34C a cell
local burns_robot_run 03B334,03B33A,03B34C d floor_cell
# the step tables its handlers run through by its step (field 28: "LDA #$28,X; ASLA; JMP [A,U]"): 03A9D3 "LDU #$7B0A",
# 03AAA4 "LDU #$7B14", 03AB17 "LDU #$7B18", 03AB99 "LDU #$7B1C", 03ABFD "LDU #$7B2A", 03AD07 "LDU #$7B38", 03AD3B "LDU
# #$7B3C", 03AEEA "LDU #$7B4C", 03AF47 "LDU #$7B52"
local burns_robot_final_defeat 03A9D3 u steps
local burns_robot_form_3_broken 03AAA4 u steps
local burns_robot_form_2_broken 03AB17 u steps
local burns_robot_form_1_broken 03AB99 u steps
local burns_robot_form_0_broken 03ABFD u steps
local burns_robot_hurt 03AD07 u steps
local burns_robot_entrance 03AD3B u steps
local burns_robot_swing 03AEEA u steps
local burns_robot_volley 03AF47 u steps
# the list a new object is taken from (B before "LBSR $867D", vector_find_free_slot): 1 for Maggie, Mr. Burns and the
# pieces and parts (03A9E3, 03AA73, 03AB04, 03AB86, 03ABF0, 03ACF4, 03ADE0), 2 for the speech balloon, the shots and the
# bombs (03ADB0, 03AF5A, 03B0B0), 0 for the held part (03B030)
local burns_robot_drop_maggie 03A9E3 d list
local burns_robot_let_burns_out 03AA73 d list
local burns_robot_throw_piece 03AB04 d list
local burns_robot_throw_piece_2 03AB86 d list
local burns_robot_throw_piece_3 03ABF0 d list
local burns_robot_throw_piece_4 03ACF4 d list
local burns_robot_speak 03ADB0 d list
local burns_robot_toss_part 03ADE0 d list
local burns_robot_fire_shot 03AF5A d list
local burns_robot_part_attack_hold 03B030 d list
local burns_robot_lob_throw 03B0B0 d list
# the piece a throw puts in (the free slot vector_find_free_slot hands back in U: 03AB04 / 03AB86 / 03ABF0 / 03ACF4
# "LBSR $867D"; 03AB0C "LDA #$88; STA ,U", 03AB10 "LDD #$0500; STD #$19,U"), and the piece number of object_1d_parts
# the throws are handed in A (03AB00 "PUSHS A" ... "PULLS A; LBSR $751E")
local burns_robot_throw_piece 03AB04 u piece object
local burns_robot_throw_piece_2 03AB86 u piece object
local burns_robot_throw_piece_3 03ABF0 u piece object
local burns_robot_throw_piece_4 03ACF4 u piece object
param burns_robot_throw_piece d piece_number
param burns_robot_throw_piece_2 d piece_number
param burns_robot_throw_piece_3 d piece_number
param burns_robot_throw_piece_4 d piece_number
# the pieces a form sheds, which the throws hand back in U and the sheds send off ("STD #$0F,U" their x speeds: 03AABE,
# 03AAC8, 03AAD5, 03AADF ...)
local burns_robot_shed_form_3 03AAB9,03AAC3,03AACD,03AADA u piece object
local burns_robot_shed_form_2 03AB3F,03AB52,03AB5C u piece object
local burns_robot_shed_form_1 03ABB9,03ABCF u piece object
local burns_robot_shed_form_0 03AC56,03AC61 u piece object
# the new form's health (03AAEE / 03AB70 / 03ACCD "LDA A,U" of burns_robot_healths by form; "STA #$1B,X; STA #$2F,X")
local burns_robot_shed_form_3 03AAEE a health
local burns_robot_shed_form_2 03AB70 a health
local burns_robot_start_form 03ACCD a health
# the look burns_robot_set_look gives the robot: A, an entry of burns_robot_animations (its kind and animation)
param burns_robot_set_look d look
# the hit box burns_robot_set_box gives an object: A, an entry of burns_robot_hit_boxes
param burns_robot_set_box d box_number
# the part burns_robot_place_part sets up: A, the record of object_1d_parts (bit 7: turned round, 03B523 "BPL"), and
# that number without the bit (03B52B "ANDA #$7F")
param burns_robot_place_part d part_code
local burns_robot_place_part 03B51E,03B52B a part_number
# how far Maggie's object is across and down (03AA1F "SUBD #$0C,U", 03AA2B "SUBD #$11,U"; "CMPD #$0020" after taking
# the size) and the direction to it (03AA41 "LBSR $861D": vector_direction_to, its A into field 3D)
local burns_robot_walk_to_maggie 03AA1F,03AA2B d distance
local burns_robot_walk_to_maggie 03AA41 d direction
# Mr. Burns' speech balloon (03ADB0 "LBSR $867D": U; "LDA #$29; STA #$01,U", "LDD #$B083; STD #$04,U", "STX #$29,U")
local burns_robot_speak 03ADB0 u balloon object
# the part it tosses away (03ADE0 "LBSR $867D": U; "LBSR $751E" places it as part 8)
local burns_robot_toss_part 03ADE0 u part object
# the step it turns its walking direction by toward its aim: 1 (03AE9D "LDA #$01") or 3 (03AED3 "LDA #$03"), the other
# way when the aim is behind (03AEA9 / 03AEDF "NEGA")
local burns_robot_walk_form_1 03AE9D,03AEA9 a turn
local burns_robot_steer 03AED3,03AEDF a turn
# its attack's box at the animation's hit frames, none between (03AF25 "CLRA", 03AF37 "ADDA #$03": 3 + 2 x form +
# attack; "LBSR $72F6" with A)
local burns_robot_swing_hit 03AF25,03AF37 a box
# the shot and the bomb (03AF5A / 03B0B0 "LBSR $867D": U; "STA ,U"), the way the robot faces (03AF74 / 03B0C4 "ANDB #$40",
# kept in the new object's 09), and the part number it is placed as, bit 7 when turned round (03AF6F "LDA #$05", 03B0BF
# "LDA #$09", 03B035 "LDA #$0E"; 03AF7B / 03B0CB / 03B03E "ADDA #$80")
local burns_robot_fire_shot 03AF5A u shot object
local burns_robot_lob_throw 03B0B0 u bomb object
local burns_robot_fire_shot 03AF74 b facing
local burns_robot_lob_throw 03B0C4 b facing
local burns_robot_fire_shot 03AF6F,03AF7B a turned_part
local burns_robot_lob_throw 03B0BF,03B0CB a turned_part
local burns_robot_part_attack_hold 03B035,03B03E a turned_part
# the players in the game less one, the index of burns_robot_volleys_by_players (03AFAA "LDA <$57", 03AFAD "DECA")
local burns_robot_volley_next 03AFAD a players_index
# the part it holds out (03B066 "LDU #$44,X": burns_robot.held_part), carried along with its speeds ("STD #$0F,U", "STD
# #$14,U")
local burns_robot_part_attack_carry 03B066 u part object
# its target player (field 2B, burns_robot.target_player: 03B243 / 03B285 / 03B2A6 / 03B371 / 03B449 / 03B1BA "LDU
# #$2B,X"), whose place the robot measures ("SUBD #$0C,U", "LDA #$02,U") and which the deciding routines hand back in U
local burns_robot_facing_target 03B243 u target object
local burns_robot_aim_at_target 03B2A6 u target object
local burns_robot_target_in_reach 03B371 u target object
local burns_robot_start_attack 03B449 u target object
local burns_robot_decide_form_0 03B176,03B192,03B1A8,03B1B0 u target object
local burns_robot_decide_form_1 03B1B5,03B1BA,03B1D9,03B1E1 u target object
local burns_robot_decide_late_forms 03B1FF,03B21A,03B222 u target object
param burns_robot_target_in_depth u target object
param burns_robot_target_across u target object
# the robot's current target, checked before it keeps it (03B285 "LDY #$2B,X; TST ,Y", "LDA #$02,Y; BMI"); what it is
# handed in Y is only handed back
param burns_robot_choose_target y current_target object
# how far down and across its target is (03B37E "SUBD #$11,X": compared with FA; 03B38D "SUBD #$0C,U": with F8)
local burns_robot_target_in_depth 03B37E d depth
local burns_robot_target_across 03B38D d across
# its form's chance of a quick attack, by the players (03B477 "LDU A,U" of burns_robot_quick_attack_chances; "CMPA B,U")
local burns_robot_start_attack 03B477 u chances
# the side of its target it aims at: 40 or C0 (03B2B1 "LDB #$C0", 03B2B5 "LDB #$40"), the other where that is no floor
# (03B2BE "LBSR $8638": A, bit 7 no floor), the direction to that place (03B2C8 "LBSR $8671") and to the target (03B2CE
# "LBSR $861D")
local burns_robot_aim_at_target 03B2B1,03B2B5 b side
local burns_robot_aim_at_target 03B2BE a cell
local burns_robot_aim_at_target 03B2C8 a direction
local burns_robot_aim_at_target 03B2CE d direction_to_target
# its form's walking speeds by the rank (03B270 "LDY B,Y" of burns_robot_walk_speeds; "LDB <$61; LSRB; LDB B,Y")
local burns_robot_walk 03B270 y speeds
# the bombs' times by rank and form (03B577 "LDY #$7BA7": burns_robot_shot_times)
local burns_robot_lob_due 03B577 y shot_times
# done: objects/burns_robot.c

# ---- objects/burns_robot_parts.c ----
# the state tables the robot's objects run through by their state (field 02: "LDA #$02,X; ASLA; JMP [A,U]"): 03B59B
# "LDU #$7D99", 03B64B "LDU #$7DA1", 03B685 "LDU #$7DA5" (types E5 and E6), 03B6F5 "LDU #$7DAD", 03B826 "LDU #$7DCF",
# 03B893 "LDU #$7DD7", 03B91A "LDU #$7DDB"
local burns_breakout_run 03B59B u states
local burns_tossed_part_run 03B64B u states
local burns_debris_run 03B685 u states
local burns_debris_run_e6 03B685 u states
local rescued_maggie_run 03B6F5 u states
local burns_bomb_run 03B826 u states
local burns_shot_run 03B893 u states
local mr_burns_run 03B91A u states
# the floor's cell ahead of the bomb and the shot (03B814 "LBSR $8644", 03B81D "LBSR $8647", 03B89C "LBSR $863B": A,
# bit 7 no floor: they turn back or burst)
local burns_bomb_run 03B814,03B81D a cell
local burns_bomb_run 03B814,03B81D d floor_cell
local burns_shot_run 03B89C a cell
local burns_shot_run 03B89C d floor_cell
# the robot that holds the part (03B8D8 "LDU #$29,X"), whose place, speeds and way it faces the part follows
local burns_held_part_run 03B8D8 u holder object.burns_robot
# the wall piece the shape puts in (03B5B9 "LBSR $867D" with B 2: U; "LDA #$80; STA ,U", "LDD #$1389; STD #$04,U",
# "STU #$28,X"); what it is handed in U is only handed back
param burns_breakout_wait u piece object
local burns_breakout_wait 03B5B9 d list
# the frame counter (03B5D6 "LDA <$16"), the time it waits for
local burns_breakout_wait 03B5D6 a frame
# the wall piece (03B5EC / 03B633 "LDU #$28,X": burns_breakout.piece), whose frame knocks the hole
local burns_breakout_break_wall 03B5EC u piece object
local burns_breakout_end 03B633 u piece object
# the hole's tiles: 16 rows of 32 from 30AC (03B5FF "LDU #$30AC", 03B614 "STA ,U+", 03B61D "LEAU #$40,U"), each code 10
# with the byte 2000 below cleared (03B60C "LDA #$10")
local burns_breakout_break_wall 03B5FF,03B614,03B61D u tile
local burns_breakout_break_wall 03B60C a fill
# Mr. Burns' object (03B6FF / 03B7D4 "LDU #$2A,X": rescued_maggie.burns; rescued_maggie_fall "LDU #$2A,X; INC #$3A,U"); what
# rescued_maggie_fall is handed in U is only handed back
local rescued_maggie_drop 03B6FF u mr_burns object.mr_burns
local rescued_maggie_crawl_to_burns 03B7D4 u mr_burns object.mr_burns
param rescued_maggie_fall u mr_burns object.mr_burns
# its bounce: the up speed turned round and halved (03B739 / 03B757 "NEGD", 03B73A / 03B758 "ASRA; RORB")
local rescued_maggie_fall 03B739,03B73A d bounce_speed
local rescued_maggie_bounce 03B757,03B758 d bounce_speed
# the blast's box: 0E at the animation's hit frames, none between (03B87C "CLRA", 03B884 "LDA #$0E")
local burns_bomb_blast 03B87C,03B884 a box
# Maggie's object, which starts falling (its state counted on: mr_burns.maggie, "LDU #$29,X; INC #$02,U"); what it is handed in U is
# only handed back
param mr_burns_release_maggie u rescued object.rescued_maggie
# done: objects/burns_robot_parts.c

# ---- objects/buzzing_chaser.c ----
# the chaser's setup record (02F3ED "LDU #$7F49", 02F3F0 "LBSR $85AB") and the hit box the setup leaves in Y
local buzzing_chaser_start 02F3ED u setup object_setup
local buzzing_chaser_start 02F3F0 y box
# done: objects/buzzing_chaser.c

# ---- objects/bystander.c ----
# the bystander record's place byte (02E64A "LDD ,U": A kind, B place), bit 7 facing left (02E657 "ANDB #$7F"), the rest
# x 16 into 3E-3F
local bystander_start 02E64A,02E657 b place
# done: objects/bystander.c

# ---- objects/clown_on_ball.c ----
# the ball's burst steps by field 28 (02F00F "LDU #$7E4F"; "LDA #$28,X; ASLA; JMP [A,U]")
local clown_ball_burst_steps 02F00F u steps
# the ball's setup record (02F02C "LDU #$7E53", 02F02F "LBSR $85AB") and the hit boxes the setups leave in Y (02F02F,
# 02F08F "LBSR $85AB")
local clown_ball_start 02F02C u setup object_setup
local clown_ball_start 02F02F y box
local clown_on_ball_start 02F08F y box
# its pose out of play, by its parameter (02F0A8 "LDA #$30,X"; clown_pose + 2 x it)
local clown_on_ball_start 02F0A8 a pose_number
# the strike's and the fight's hit box (02F0FF / 02F14C / 02F1BB "LDY #$7CBE", then "LBSR $85B4": vector_set_hit_box)
local clown_on_ball_strike 02F0FF y box hit_box
local clown_on_ball_jump_fall 02F14C y box hit_box
local clown_on_ball_charge_end 02F1BB y box hit_box
# its pauses by the rank (02F1F2 "LDU #$7E87": clown_on_ball_pause_waits_by_rank)
local clown_on_ball_pause 02F1F2 u waits
# orbit_offset is handed an angle in A and a radius in B (02F257 "PUSHS U,D; STD <$EC"): the angle within its quarter
# (02F25C "ANDA #$3F"; "LDA A,U" of orbit_cosines, "MUL" by the radius), its quarter (02F29C "ANDA #$C0"), and the two
# offsets swapped through B (02F288 "LDB <$EB")
param orbit_offset d angle_and_radius
local orbit_offset 02F257,02F25C a angle
local orbit_offset 02F257 b radius
local orbit_offset 02F29C a quarter
local orbit_offset 02F288 b swap
# done: objects/clown_on_ball.c

# ---- objects/collisions.c ----
# the objects' count (07C026 "LDA #$20", 07C036 "DECA; BNE")
local clear_hits 07C026,07C036 a count
# the flags of the two objects, whether they are in the hit checks (07C042 "LDA #$00,X; BITA #$40", 07C051 "LDA
# #$00,U; BITA #$40"; 07C079/07C088, 07C0B1/07C0C0, 07C256/07C25D the same)
local collide_players_with_enemies 07C042,07C051 a flags
local collide_players_with_child_objects 07C079,07C088 a flags
local collide_players_with_list_1_objects 07C0B1,07C0C0 a flags
local collide_players_with_players 07C256,07C25D a flags
# done: objects/collisions.c

# ---- objects/descent_balloon.c ----
# the balloon's setup record (02A77B "LDU #$78FE", 02A77E "LBSR $85AB") and the hit box the setup leaves in Y
local descent_balloon_start 02A77B u setup object_setup
local descent_balloon_start 02A77E y box
# done: objects/descent_balloon.c

# ---- objects/doors.c ----
# the state the list's dispatcher hands bank 1B's handlers in B (036018-036024, the bank's jump table "LBRA"; then
# "ASLB; JSR [B,U]") and their state tables (036314 "LDU #$6539", 0362A5 "LDU #$64EC", 036234 "LDU #$6474", 036027
# "LDU #$6418", 036121 "LDU #$6436")
local door_kind_0f_run 036018 b state
local door_kind_10_run 03601B b state
local door_kind_12_run 03601E b state
local kid_in_sunglasses_run 036021 b state
local car_doors_run 036024 b state
local door_kind_0f_run 036314 u states
local door_kind_10_run 0362A5 u states
local door_kind_12_run 036234 u states
local kid_in_sunglasses_run 036027 u states
local car_doors_run 036121 u states
# the setup records (036030 "LDU #$6430", 036133 "LDU #$644E"; "LBSR $85AB") and the hit boxes the setups leave in Y
# (036033, 036136, 036251, 0362B1, 036320 "LBSR $85AB")
local kid_in_sunglasses_start 036030 u setup object_setup
local kid_in_sunglasses_start 036033 y box
local car_doors_start 036133 u setup object_setup
local car_doors_start 036136 y box
local door_kind_12_start 036251 y box
local door_kind_10_start 0362B1 y box
local door_kind_0f_start 036320 y box
# the floor's cell under it (03607F "CLRD", 036080 "LBSR $8638": A, bit 7 no floor, bits 0-3 its height)
local kid_in_sunglasses_wait_for_floor 036080 a cell
local kid_in_sunglasses_wait_for_floor 036080 d floor_cell
# the car's spawn list (0361BC "LDU #$6454": door_spawn_lists; 0361C3 "LDY A,U" by car_doors.spawn_list), walked a
# spawn at a time (0361C5 "LDA ,Y+": the fewest players present it needs, 7F the end, "CMPA $1874"; 0361D4 "LBSR
# $862C" the child record after it; 0361D7 "LEAY #$08,Y"); the same in door_let_out_list (036384 / 036393 "LDA ,Y+",
# 0363A5 "LEAY #$08,Y")
local car_doors_let_out_enemies 0361BC u lists
local car_doors_let_out_enemies 0361C3,0361C5,0361D7 y spawn door_spawn
local door_let_out_list 036384,036393,0363A5 y spawn door_spawn
local door_let_out_list 036384,036393 a fewest_players
# done: objects/doors.c

# ---- objects/fat_goon.c ----
# the hit box the object setup leaves in Y (02A096 / 02A14C "LBSR $85AB"), which the fat goons' setups hand back to
# their starts (02A0B8 / 02A1CA / 02A205 / 02A334 / 02A3B3 / 02A431 / 02A4DC "LBSR $6093", 02A107 / 02A133 / 02A17F /
# 02A1A1 "BSR $6149", 02A110 / 02A13C / 02A188 / 02A1B1 / 02A64F / 02ABE5 / 02AC91 the setups' callers)
local fat_goon_setup 02A096 y box
local fat_goon_base_setup 02A14C y box
local fat_goon_start 02A0B8 y box
local fat_goon_grabber_setup 02A107 y box
local fat_goon_grabber_start 02A110 y box
local fat_goon_puncher_setup 02A133 y box
local fat_goon_puncher_start 02A13C y box
local fat_goon_jumper_setup 02A17F y box
local fat_goon_jumper_start 02A188 y box
local kind_85_setup 02A1A1 y box
local kind_85_start 02A1B1 y box
local fat_goon_waiting_start 02A1CA y box
local fat_goon_drop_start 02A205 y box
local fat_goon_entrance_start 02A334 y box
local fat_goon_walk_in_start 02A3B3 y box
local fat_goon_from_back_start 02A431 y box
local fat_goon_thrower_start 02A4DC y box
local fat_goon_delayed_start 02A64F y box
local fat_goon_jump_in_start 02ABE5 y box
local fat_goon_from_below_start 02AC91 y box
# the nearest player, which the fat goon measures and faces (02A0A6 / 02A161 / 02A44B / 02A412 / 02A762 "LBSR $8620":
# vector_choose_nearest_player, then "LBSR $8626" vector_measure_target)
local fat_goon_setup 02A0A6 u player object
local fat_goon_base_setup 02A161 u player object
local fat_goon_from_back_start 02A44B u player object
local fat_goon_walk_in_end 02A412 u player object
local fat_goon_descent_land 02A762 u player object
# its enemy behaviour (02A0AC "LDU #$75E8", 02A109 "LDU #$765A", 02A135 "LDU #$76B2", 02A181 "LDU #$770A", 02A1AA "LDU
# #$7762"; "STU #$2A,X"), which the setups hand back in U (02A3B3 / 02A4DC "LBSR $6093")
local fat_goon_setup 02A0AC u behaviour
local fat_goon_grabber_setup 02A109 u behaviour
local fat_goon_puncher_setup 02A135 u behaviour
local fat_goon_jumper_setup 02A181 u behaviour
local kind_85_setup 02A1AA u behaviour
local fat_goon_walk_in_start 02A3B3 u behaviour
local fat_goon_thrower_start 02A4DC u behaviour
# the substeps their entrances run through by field 29 (02A3C3 "LDU #$787A", 02A454 "LDU #$788A", 02A4F2 "LDU #$78A4",
# 02A685 "LDU #$78D0", 02A70F "LDU #$78E2"; "LDB #$29,X; ASLB; JSR [B,U]" or "LDA #$29,X; ASLA; JMP [A,U]")
local fat_goon_walk_in_steps 02A3C3 u steps
local fat_goon_from_back_steps 02A454 u steps
local fat_goon_thrower_steps 02A4F2 u steps
local fat_goon_delayed_steps 02A685 u steps
local fat_goon_descent_steps 02A70F u steps
# the route's floor (02A246 "LDD ,U": A the substep to go on with, "STA #$29,X", B the floor its route walks to)
local fat_goon_drop_take_route 02A246 d floor
# the floor's cell under it or ahead (02A26B / 02A2FD / 02A3CD / 02A47F / 02A4E5 / 02A5FD / 02A71C "LBSR $8638",
# 02A4C7 "LBSR $863B", 02AC1E "LBSR $8644": A, bit 7 no floor, bits 0-3 its height in 8s)
local fat_goon_drop_walk_to_floor 02A26B a cell
local fat_goon_drop_walk_to_floor 02A26B d floor_cell
local fat_goon_reach_any_floor 02A2FD a cell
local fat_goon_reach_any_floor 02A2FD d floor_cell
local fat_goon_walk_in_steps 02A3CD a cell
local fat_goon_walk_in_steps 02A3CD d floor_cell
local fat_goon_from_back_walk 02A47F a cell
local fat_goon_from_back_walk 02A47F d floor_cell
local fat_goon_thrower_start 02A4E5 a cell
local fat_goon_thrower_start 02A4E5 d floor_cell
local fat_goon_thrower_steps 02A4C7 a cell
local fat_goon_thrower_steps 02A4C7 d floor_cell
local fat_goon_reach_ground 02A5FD a cell
local fat_goon_reach_ground 02A5FD d floor_cell
local fat_goon_descent_fall 02A71C a cell
local fat_goon_descent_fall 02A71C d floor_cell
local fat_goon_jump_in_jump 02AC1E a cell
local fat_goon_jump_in_jump 02AC1E d floor_cell
# its zoom as it comes nearer, one larger each frame up to 4040 (02A72A "LDD #$0A,X", 02A72D "ADDD #$0101")
local fat_goon_descent_fall 02A72D a new_zoom_x
local fat_goon_descent_fall 02A72D d new_zoom_y
# the x places it enters at from the back (02A462 "LDU #$7890": fat_goon_from_back_xs)
local fat_goon_from_back_place 02A462 u xs
# the child records of the obstacle it carries and of its balloon (02A515 "LDY #$78AC", 02A6B1 "LDY #$78E6"; "LBSR
# $862C")
local fat_goon_thrower_pick_up 02A515 y record child_object
local fat_goon_descent_start 02A6B1 y record child_object
# done: objects/fat_goon.c

# ---- objects/fat_goon_actions.c ----
# the hit boxes it takes (02A906 / 02A96B "LDY #$7904" the body's, 02AA46 "LDY #$7934" the heavy strike's; "LBSR
# $85B4": vector_set_hit_box)
local fat_goon_strike_recover 02A906 y box hit_box
local fat_goon_body_slam_fall 02A96B y box hit_box
local fat_goon_heavy_strike_hit 02AA46 y box hit_box
# its wind-up waits by the players in the game (02A9C0 "LDU #$7974": fat_goon_strike_waits_by_players)
local fat_goon_strike_wind_up 02A9C0 u waits
# the direction to its target (02AA74 / 02AB47 "LBSR $861D": vector_direction_to, A), which it heads in
local fat_goon_grab_approach 02AA74 a direction
local fat_goon_grab 02AB47 a direction
# done: objects/fat_goon_actions.c

# ---- objects/goon_hat.c ----
# the hat's burst steps by field 29 (02B325 "LDU #$7F2F"; "LDA #$29,X; ASLA; JMP [A,U]")
local goon_hat_burst_steps 02B325 u steps
# the floor's cell under the hat (02B33C "LBSR $8638": A, bit 7 no floor)
local goon_hat_floor_priority 02B33C a cell
local goon_hat_floor_priority 02B33C d floor_cell
# the hit box the object setup leaves in Y (02B395 "LBSR $85AB")
local goon_hat_throw_start 02B395 y box
# done: objects/goon_hat.c

# ---- objects/goon_lift.c ----
# the lift's second part and second goon, the children the last spawn puts in and hands back in U (032F00 "LDY #$7D70;
# LBRA $862C", 032F27 "LDY #$7D80; LBRA $862C")
local goon_lift_setup 032F00 u part object
local goon_lift_arrive 032F27 u goon object
# the hit box the object setup leaves in Y (032F9D "LBSR $85AB")
local goon_lift_part_setup 032F9D y box
# done: objects/goon_lift.c

# ---- objects/floor_scenery.c ----
# the hit boxes the object setup leaves in Y (02B24D / 02C823 / 02C958 / 02C9EA / 02CE44 / 02D72B / 02E07E "LBSR $85AB")
# and the debris' setup record (02C955 "LDU #$7D37")
local floor_blocker_start 02B24D y box
local platform_scenery_start 02C823 y box
local scenery_debris_start 02C955 u setup object_setup
local scenery_debris_start 02C958 y box
local charging_scenery_start 02C9EA y box
local solid_scenery_start 02CE44 y box
local rising_scenery_start 02D72B y box
local looping_scenery_start 02E07E y box
# the floor map's cell under the object (02B267 / 02C83D / 02CA0A "LBSR $8650", floor_cell_under: U its place in the
# floor map, A its value; "STA #$3A,X", "STU #$3B,X")
local floor_blocker_start 02B267 d cell_value
local platform_scenery_start 02C83D u cell_place
local platform_scenery_start 02C83D d cell_value
local charging_scenery_start 02CA0A u cell_place
local charging_scenery_start 02CA0A d cell_value
# the floor blocker's parts by field 37 (02B283 "LDU #$7EEB"; "LDB #$37,X; ASLB; JMP [B,U]")
local floor_blocker_steps 02B283 u steps
# the floor cells each part writes into the floor map, 4 columns of 3 (02B294 "LDY #$7EF3", 02B2A6 "LDY #$7EFF", 02B2B8
# "LDY #$7F0B"; 02C775 "LDY #$7CE1", 02C786 "LDY #$7CED", 02C797 "LDY #$7CF9", 02C7A8 "LDY #$7D05", 02C7B9 "LDY
# #$7D11"; 02C9B9 "LDY #$7D4D", 02C9CB "LDY #$7D59", 02C9DD "LDY #$7D65"; 02C994 / 02C99D / 02C9A6 "LDY #$7D71" the plain
# floor's), which the writers read a column at a time ("LDA ,Y", "LDA #$04,Y", "LDA #$08,Y"; 02B302 / 02C807 "LEAY
# #$01,Y") and hand back
local floor_blocker_first_part 02B294,02B297 y cells
local floor_blocker_second_part 02B2A6,02B2A9 y cells
local floor_blocker_last_part 02B2B8,02B2BB y cells
local platform_scenery_first_part 02C775,02C778 y cells
local platform_scenery_second_part 02C786,02C789 y cells
local platform_scenery_third_part 02C797,02C79A y cells
local platform_scenery_fourth_part 02C7A8,02C7AB y cells
local platform_scenery_last_part 02C7B9,02C7BC y cells
local charging_scenery_first_part 02C9B9,02C9BC y cells
local charging_scenery_second_part 02C9CB,02C9CE y cells
local charging_scenery_last_part 02C9DD,02C9E0 y cells
local charging_scenery_clear_floor 02C994,02C997,02C99D,02C9A0,02C9A6,02C9A9 y cells
# the board control byte with the floor map's bit set and cleared around the writes (02B2C7 / 02C7CC "ORA #$02",
# 02B30F / 02C814 "ANDA #$FC"; "STA <$0F; STA $1FC2"), and the place in the floor map each column is written at (02B2EF
# / 02C7F4 / 02C89E "LEAU B,U": the row + the column)
local floor_blocker_write_cells 02B2C7,02B30F a control
local platform_scenery_write_cells 02C7CC,02C814 a control
local floor_blocker_write_cells 02B2EF u place
local platform_scenery_write_cells 02C7F4 u place
local platform_scenery_clear_floor 02C89E u place
# the platform's reactions by field 28 (02C8B1 "LDU #$7D1D"; "LDA #$28,X; ASLA; JMP [A,U]"), which
# platform_scenery_react hands back
local platform_scenery_react_steps 02C8B1 u steps
local platform_scenery_react 02C8AE u steps
# the hit box it flies with (02C8F2 "LDY #$7B10"; "LBSR $85B4")
local platform_scenery_launch 02C8F2 y box hit_box
# the child records of the two pieces it throws off (02C911 "LDY #$7D23", 02C917 "LDY #$7D29"; "LBSR $862F") and the
# second piece (02C91A: U)
local platform_scenery_crash 02C911,02C917 y record child_object
local platform_scenery_crash 02C91A u piece object
# a player's object in play from a random one on (02CA4A "LDU #$7D83": player_objects, 02CA50 "LDU A,U", 02CA52 "LDA
# #$00,U; BNE"), the slot (02CA47 "LDA <$16", 02CA4D "ANDA #$03", 02CA57 "INCA": "LDA #$00,U" has put the player's flags
# into A by then, so after a miss the search goes on at slot 1) and the four tries (02CA45 "LDB #$04", 02CA58 "DBJNZ")
local pick_random_player 02CA50 u player object
local pick_random_player 02CA47,02CA52,02CA57 a slot
local pick_random_player 02CA45,02CA58 b tries
# the camera x places the rising scenery waits for (02D75E "LDU #$7FA1": rising_scenery_camera_xs)
local rising_scenery_start 02D75E u camera_xs
# done: objects/floor_scenery.c

# ---- objects/football_player.c ----
# the football player's state table, which the dispatcher jumps through and hands each state's handler (03C354 "LDY
# #$7D70", 03C357 "JMP [A,Y]")
local football_player 03C354 y states
# the child record of the object the story waits for (03C397 "LDY #$7D9A", 03C39A "LBSR $862C"), and that object, kept
# in 1852 (03C39D "STU $1852")
local football_player_start 03C397 y record child_object
local football_player_start 03C39A u marker object
# the piece the line has reached (03C849 "LDB $184A": 0, 3 and 6 hurt), and its x offset from the record, the other way
# when turned round (03C87E "LDB ,Y", 03C887 "NEGB")
local football_line_piece 03C849 b piece_number
local football_line_piece 03C87E,03C887 b dx
# its step (03C895 "LDA #$2F,X"; "CMPA #$04")
local football_line_piece 03C895 a step
# the state and wait it takes next, into 2E-2F (03C64B "STD #$2E,X"): state 14 with a wait of 1 (03C63C "LDD #$1401"),
# or with the attack delay for the players (03C649 "LDA #$14", 03C647 "LDB B,U" of
# football_player_attack_delays_by_players, 03C641 "LDU #$7DA5"); the code is shared by the states that look for a player to tackle
local football_player_ready 03C63C,03C649 a next_state
local football_player_ready 03C63C,03C647 b next_wait
local football_player_ready 03C641 u delays
local football_player_run 03C63C,03C649 a next_state
local football_player_run 03C63C,03C647 b next_wait
local football_player_run 03C641 u delays
local football_player_tackle 03C63C,03C649 a next_state
local football_player_tackle 03C63C,03C647 b next_wait
local football_player_throwing 03C63C,03C649 a next_state
local football_player_throwing 03C63C,03C647 b next_wait
local football_player_throwing 03C641 u delays
local football_player_charge 03C63C,03C649 a next_state
local football_player_charge 03C63C,03C647 b next_wait
local football_player_flinch 03C63C,03C649 a next_state
local football_player_flinch 03C63C,03C647 b next_wait
local football_player_flinch 03C641 u delays
# the player stage_boss_find_near_player finds within the ranges (03C626 "LBSR $61DC": U)
local football_player_ready 03C626 u player object
local football_player_run 03C626 u player object
local football_player_throwing 03C626 u player object
local football_player_flinch 03C626 u player object
# its chase target (03C480 "LDU #$34,X"), the place ahead of which it runs to (03C483 "LBSR $60E0", 03C486 "LBSR
# $8671"), and the turn it takes toward it: 1C straight on, 07 or F9 (03C492 "LDA #$07", 03C498 "LDA #$F9", 03C49C "LDA
# #$1C"; 03C49E "STA #$33,X", 03C4A1 "ADDA #$32,X")
local football_player_run_at_target 03C480 u target object
local football_player_run_at_target 03C492,03C498,03C49C,03C4A1 a turn
# its turn as it wanders, turned round now and then (03C4D7 "LDB #$33,X")
local football_player_wander 03C4D7 b turn
# the floor's cell ahead (03C537 "LBSR $863B": A, the floor's height in bits 0-3)
local football_player_run 03C537 a cell
local football_player_run 03C537 d floor_cell
# the screen's bounds it is held to: x 0030-0180 (03C553 "LDY #$0030", 03C55B "LDY #$0180"), y 0058-0170 (03C57D "LDY
# #$0058", 03C585 "LDY #$0170"; "STY #$0C,X" / "STY #$11,X")
local football_player_run 03C553,03C55B,03C57D,03C585 y limit
# the football it throws and the first piece of its charge's line (03C6B8 "LDY #$7DC2", 03C72D "LDY #$7DC8"; "LBSR
# $862F": the child in U)
local football_player_throw 03C6B8 y record child_object
local football_player_throw 03C6BB u ball object
local football_player_charge 03C72D y record child_object
local football_player_charge 03C730 u piece object
# its next state and wait when knocked out (03C77C "LDY #$1278", 03C77F "STY #$2E,X")
local football_player_knocked_out 03C77C y state_wait
# done: objects/football_player.c

# ---- objects/handlers_bank_1a.c ----
# the state the list's dispatcher hands bank 1A's handlers in B (03400C-03401E, the bank's jump table "LBRA"; then
# "ASLB; JSR [B,U]" or a switch on it), and the state tables of the boss's balls and their trail (034DF4 "LDU #$7914",
# 034F7D "LDU #$7944")
local dreamland_boss_shadow_update 03400C b state
local dreamland_boss_chain_update 034012 b state
local dreamland_boss_chain_head_update 034015 b state
local chain_holder_update 034018 b state
local boss_ball_update 03401B b state
local boss_ball_trail_update 03401E b state
local boss_ball_update 034DF4 u states
local boss_ball_trail_update 034F7D u states
# done: objects/handlers_bank_1a.c

# ---- objects/hurry_up.c ----
# the player it flies to (03D0A0 / 03D0F6 / 03D12A "LDU #$2B,X"), which it lifts as it reaches it ("LDD #$11,U; ADDD
# #$16,U", "STD #$11,U") and marks ("STA #$06,U")
local hurry_up_go_to_player 03D0A0,03D0F6,03D12A u target object
# done: objects/hurry_up.c

# ---- objects/items.c ----
# the setup records (02E201 "LDU A,U" of item_setups, 02E367 "LDU #$7ADE", 02E4B6 "LDU #$7B5E", 02E53A "LDU A,U" of
# item_carrier_setups; then "LBSR $85AB") and the hit boxes the setups leave in Y (02E203 / 02E21A / 02E2E0 / 02E36A /
# 02E3A1 / 02E4B9 / 02E53C "LBSR $85AB")
local item_start 02E201 u setup object_setup
local item_start 02E203 y box
local food_jump_out_start 02E21A y box
local food_start 02E2E0 y box
local dropped_food_start 02E367 u setup object_setup
local dropped_food_start 02E36A y box
local girl_with_food_start 02E3A1 y box
local sideshow_bob_start 02E4B6 u setup object_setup
local sideshow_bob_start 02E4B9 y box
local item_carrier_start 02E53A u setup object_setup
local item_carrier_start 02E53C y box
# the food's hit kinds by animation (02E2F7 "LDU #$7ACE": food_hit_kinds), which food_set_hit_kind hands back (02E2E3
# "BSR $62F7", 02E3A4 "LBSR $62F7")
local food_set_hit_kind 02E2F7 u hit_kinds
local food_start 02E2E3 u hit_kinds
local girl_with_food_start 02E3A4 u hit_kinds
# its partner by its parameter (02E3BC "LDA #$30,X"; 02E3CF "LDY A,Y" of girl_with_food_partners, 02E3D1 "LBSR $862C": the
# partner in U)
local girl_with_food_start 02E3BC a partner_number
local girl_with_food_start 02E3CF y record child_object
local girl_with_food_start 02E3D1 u partner object
# the food it drops and its child record (02E419 "LDY A,Y" of girl_with_food_food_drops, 02E4E3 "LDY #$7B64"; 02E41B / 02E4E6
# "LBSR $862C": the food in U), and the item a carrier puts down (02E56B "LDY A,Y" of item_carrier_items)
local girl_with_food_drop_food 02E419 y record child_object
local girl_with_food_drop_food 02E41B u food object
local sideshow_bob_drop_food 02E4E3 y record child_object
local sideshow_bob_drop_food 02E4E6 u food object
local item_carrier_put_down 02E56B y record child_object
# the carried items' kinds (02E5DE "LDU #$7BB8": carried_item_kinds)
local carried_item_start 02E5DE u kinds
# done: objects/items.c

# ---- objects/handlers_bank_15.c ----
# bank 15's handlers (fat goons, balloons, props, doors, the stage's events): the state the list's dispatcher hands each type's handler in B, where the bank's jump table
# goes on to it (the jump table's "LBRA" is where the C's "b = (uint8_t)d" is), and the state tables the handlers
# jump through by it ("LDU #$xxxx; ASLB; JSR [B,U]", or "LDB #$02,X; ASLB"); a table jumped through by another field
# (37) is the object's steps. The enemies' actions (enemy_attack: 07D64F "LDD #$28,X", 07D65E "LDU #$F5A2; ASLA; JSR
# [A,U]") are handed the action's step (field 29) in B instead, and jump through their steps by it
# 02A000 "LBRA $60FB" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_grabber_update 02A000 b state
# 02A003 "LBRA $6195" (the bank's jump table: B the state the dispatcher hands in)
local kind_85_update 02A003 b state
# 02A006 "LBRA $7415" (the bank's jump table: B the state the dispatcher hands in)
local police_car_update 02A006 b state
# 02B415 "LDU #$7F51" ... 02B419 "JSR [B,U]"
local police_car_update 02B415 u states
# 02A009 "LBRA $6881" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_walk_up_strike_update 02A009 b step
# 02A881 "LDU #$7950" ... 02A885 "JMP [B,U]"
local fat_goon_walk_up_strike_update 02A881 u steps
# 02A00C "LBRA $6919" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_body_slam_update 02A00C b step
# 02A919 "LDU #$795C" ... 02A91D "JMP [B,U]"
local fat_goon_body_slam_update 02A919 u steps
# 02A00F "LBRA $69AA" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_strike_update 02A00F b step
# 02A9AA "LDU #$796A" ... 02A9AE "JMP [B,U]"
local fat_goon_strike_update 02A9AA u steps
# 02A012 "LBRA $69FE" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_reach_strike_update 02A012 b step
# 02A9FE "LDU #$7979" ... 02AA02 "JMP [B,U]"
local fat_goon_reach_strike_update 02A9FE u steps
# 02A015 "LBRA $64BB" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_thrower_update 02A015 b state
# 02A018 "LBRA $66A2" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_descent_update 02A018 b state
# 02A6A2 "LDU #$78D6" ... 02A6A6 "JSR [B,U]"
local fat_goon_descent_update 02A6A2 u states
# 02A01B "LBRA $6775" (the bank's jump table: B the state the dispatcher hands in)
local descent_balloon_update 02A01B b state
# 02A775 "LDU #$78F6" ... 02A779 "JMP [B,U]"
local descent_balloon_update 02A775 u states
# 02A01E "LBRA $63A7" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_walk_in_update 02A01E b state
# 02A021 "LBRA $6643" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_delayed_update 02A021 b state
# 02A024 "LBRA $6425" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_from_back_update 02A024 b state
# 02A027 "LBRA $680B" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_bump_update 02A027 b step
# 02A80B "LDU #$7948" ... 02A80F "JMP [B,U]"
local fat_goon_bump_update 02A80B u steps
# 02A02A "LBRA $6A2D" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_heavy_strike_update 02A02A b step
# 02AA2D "LDU #$7985" ... 02AA31 "JMP [B,U]"
local fat_goon_heavy_strike_update 02AA2D u steps
# 02A02D "LBRA $6A26" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_idle_action_update 02A02D b step
# 02AA26 "LDU #$7983" ... 02AA2A "JMP [B,U]"
local fat_goon_idle_action_update 02AA26 u steps
# 02A030 "LBRA $6328" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_entrance_update 02A030 b state
# 02A033 "LBRA $61F9" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_drop_update 02A033 b state
# 02A036 "LBRA $70A9" (the bank's jump table: B the state the dispatcher hands in)
local prop_update 02A036 b state
# 02B0A9 "LDU #$7E19" ... 02B0AD "JMP [B,U]"
local prop_update 02B0A9 u states
# 02A039 "LBRA $6FEF" (the bank's jump table: B the state the dispatcher hands in)
local caged_gorilla_leaper_update 02A039 b state
# 02AFEF "LDU #$7DFD" ... 02AFF3 "JSR [B,U]"
local caged_gorilla_leaper_update 02AFEF u states
# 02A03C "LBRA $6F2D" (the bank's jump table: B the state the dispatcher hands in)
local krustyland_door_update 02A03C b state
# 02AF2D "LDU #$7DB0" ... 02AF31 "JSR [B,U]"
local krustyland_door_update 02AF2D u states
# 02A03F "LBRA $62D9" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_entrance_to_floor_update 02A03F b state
# 02A042 "LBRA $6E9C" (the bank's jump table: B the state the dispatcher hands in)
local drink_vendor_update 02A042 b state
# 02AE9C "LDU #$7D96" ... 02AEA0 "JSR [B,U]"
local drink_vendor_update 02AE9C u states
# 02A045 "LBRA $6E6D" (the bank's jump table: B the state the dispatcher hands in)
local burger_eater_update 02A045 b state
# 02AE6D "LDU #$7D80" ... 02AE71 "JSR [B,U]"
local burger_eater_update 02AE6D u states
# 02A048 "LBRA $61BE" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_waiting_update 02A048 b state
# 02A04B "LBRA $6A56" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_grab_update 02A04B b step
# 02AA56 "LDU #$798D" ... 02AA5A "JMP [B,U]"
local fat_goon_grab_update 02AA56 u steps
# 02A04E "LBRA $6127" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_puncher_update 02A04E b state
# 02A051 "LBRA $6087" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_update 02A051 b state
# 02A054 "LBRA $6BC0" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_jump_in_update 02A054 b state
# 02A057 "LBRA $6C70" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_from_below_update 02A057 b state
# 02A05A "LBRA $6D6B" (the bank's jump table: B the state the dispatcher hands in)
local scroll_lock_update 02A05A b state
# 02A05D "LBRA $6D85" (the bank's jump table: B the state the dispatcher hands in)
local enemy_waves_update 02A05D b state
# 02A060 "LBRA $6D1B" (the bank's jump table: B the state the dispatcher hands in)
local cleared_wave_update 02A060 b state
# 02B1FC "LDU #$7EA1" ... 02B200 "JSR [B,U]"
local cemetery_piece_update 02B1FC u states
# 02A066 "LBRA $70E5" (the bank's jump table: B the state the dispatcher hands in)
local poster_update 02A066 b state
# 02B0E5 "LDU #$7E53" ... 02B0E9 "JMP [B,U]"
local poster_update 02B0E5 u states
# 02A069 "LBRA $70FF" (the bank's jump table: B the state the dispatcher hands in)
local poster_pair_update 02A069 b state
# 02B0FF "LDU #$7E5D" ... 02B103 "JMP [B,U]"
local poster_pair_update 02B0FF u states
# 02A06C "LBRA $713D" (the bank's jump table: B the state the dispatcher hands in)
local bleeding_gums_murphy_update 02A06C b state
# 02B13D "LDU #$7E6F" ... 02B141 "JSR [B,U]"
local bleeding_gums_murphy_update 02B13D u states
# 02A06F "LBRA $719E" (the bank's jump table: B the state the dispatcher hands in)
local dream_ball_fling_update 02A06F b state
# 02B19E "LDU #$7E7F" ... 02B1A2 "JMP [B,U]"
local dream_ball_fling_update 02B19E u states
# 02A072 "LBRA $7241" (the bank's jump table: B the state the dispatcher hands in)
local floor_blocker_update 02A072 b state
# 02B241 "LDU #$7EDF" ... 02B245 "JSR [B,U]"
local floor_blocker_update 02B241 u states
# 02A075 "LBRA $7361" (the bank's jump table: B the state the dispatcher hands in)
local goon_hat_update 02A075 b state
# 02B361 "LDU #$7F37" ... 02B365 "JSR [B,U]"
local goon_hat_update 02B361 u states
# 02A07E "LBRA $6173" (the bank's jump table: B the state the dispatcher hands in)
local fat_goon_jumper_update 02A07E b state
# 02A081 "LBRA $67D9" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fat_goon_back_off_update 02A081 b step
# 02A7D9 "LDU #$7944" ... 02A7DD "JMP [B,U]"
local fat_goon_back_off_update 02A7D9 u steps
# 02A084 "LBRA $6E3E" (the bank's jump table: B the state the dispatcher hands in)
local moe_spawner_update 02A084 b state
# 02AE3E "LDU #$7D6C" ... 02AE42 "JSR [B,U]"
local moe_spawner_update 02AE3E u states
# done: objects/handlers_bank_15.c

# ---- objects/handlers_bank_16.c ----
# bank 16's handlers (obstacles, throwables, scenery, items, animals): the state the list's dispatcher hands each type's handler in B, where the bank's jump table
# goes on to it (the jump table's "LBRA" is where the C's "b = (uint8_t)d" is), and the state tables the handlers
# jump through by it ("LDU #$xxxx; ASLB; JSR [B,U]", or "LDB #$02,X; ASLB"); a table jumped through by another field
# (37) is the object's steps. The enemies' actions (enemy_attack: 07D64F "LDD #$28,X", 07D65E "LDU #$F5A2; ASLA; JSR
# [A,U]") are handed the action's step (field 29) in B instead, and jump through their steps by it
# 02C000 "LBRA $6E2F" (the bank's jump table: B the state the dispatcher hands in)
local solid_scenery_update 02C000 b state
# 02CE2F "LDU #$7DDB" ... 02CE33 "JSR [B,U]"
local solid_scenery_update 02CE2F u states
# 02C003 "LBRA $63F6" (the bank's jump table: B the state the dispatcher hands in)
local police_car_door_update 02C003 b state
# 02C3F6 "LDU #$7C1E" ... 02C3FA "JSR [B,U]"
local police_car_door_update 02C3F6 u states
# 02C006 "LBRA $648A" (the bank's jump table: B the state the dispatcher hands in)
local carried_obstacle_update 02C006 b state
# 02C48A "LDU #$7C71" ... 02C48E "JSR [B,U]"
local carried_obstacle_update 02C48A u states
# 02C009 "LBRA $6988" (the bank's jump table: B the state the dispatcher hands in)
local charging_scenery_update 02C009 b state
# 02C9B0 "LDU #$7D45" ... 02C9B7 "JMP [B,U]"
local charging_scenery_update 02C9B0 u steps
# 02C00C "LBRA $694C" (the bank's jump table: B the state the dispatcher hands in)
local scenery_debris_update 02C00C b state
# 02C94C "LDU #$7D2F" ... 02C950 "JSR [B,U]"
local scenery_debris_update 02C94C u states
# 02CAC5 "LDU #$7D9F" ... 02CACC "JSR [B,U]"
local obstacle_update 02CAC5 u states
# 02C666 "LDU #$7CA5" ... 02C66D "JSR [B,U]"
local throwable_update 02C666 u states
# 02C015 "LBRA $6763" (the bank's jump table: B the state the dispatcher hands in)
local platform_scenery_update 02C015 b state
# 02C76C "LDU #$7CD1" ... 02C773 "JMP [B,U]"
local platform_scenery_update 02C76C u steps
# 02C018 "LBRA $7092" (the bank's jump table: B the state the dispatcher hands in)
local shaken_bit_update 02C018 b state
# 02D092 "LDU #$7E11" ... 02D096 "JMP [B,U]"
local shaken_bit_update 02D092 u states
# 02C01B "LBRA $714C" (the bank's jump table: B the state the dispatcher hands in)
local shaking_scenery_update 02C01B b state
# 02D14C "LDU #$7E35" ... 02D150 "JSR [B,U]"
local shaking_scenery_update 02D14C u states
# 02C132 "LDU #$7BB2" ... 02C139 "JSR [B,U]"
local heavy_obstacle_update 02C132 u states
# 02D837 "LDU #$7FC1" ... 02D83B "JSR [B,U]"
local woman_in_apron_update 02D837 u states
# 02C024 "LBRA $79BA" (the bank's jump table: B the state the dispatcher hands in)
local rabbit_update 02C024 b state
# 02D9BA "LDU #$7FE5" ... 02D9BE "JSR [B,U]"
local rabbit_update 02D9BA u states
# 02C027 "LBRA $77A7" (the bank's jump table: B the state the dispatcher hands in)
local woman_in_apron_device_update 02C027 b state
# 02D7A7 "LDU #$7FAB" ... 02D7AB "JSR [B,U]"
local woman_in_apron_device_update 02D7A7 u states
# 02C02A "LBRA $6191" (the bank's jump table: B the state the dispatcher hands in)
local timed_throwable_update 02C02A b state
# 02C191 "LDU #$7BBA" ... 02C195 "JSR [B,U]"
local timed_throwable_update 02C191 u states
# 02C02D "LBRA $6060" (the bank's jump table: B the state the dispatcher hands in)
local cemetery_obstacle_update 02C02D b state
# 02C060 "LDU #$7B44" ... 02C064 "JSR [B,U]"
local cemetery_obstacle_update 02C060 u states
# 02C03C "LBRA $7692" (the bank's jump table: B the state the dispatcher hands in)
local bird_item_update 02C03C b state
# 02D692 "LDU #$7F75" ... 02D696 "JSR [B,U]"
local bird_item_update 02D692 u states
# 02C03F "LBRA $771F" (the bank's jump table: B the state the dispatcher hands in)
local rising_scenery_update 02C03F b state
# 02D71F "LDU #$7F9B" ... 02D723 "JSR [B,U]"
local rising_scenery_update 02D71F u states
# 02C042 "LBRA $64C7" (the bank's jump table: B the state the dispatcher hands in)
local tossed_obstacle_update 02C042 b state
# 02C4C7 "LDU #$7C83" ... 02C4CB "JSR [B,U]"
local tossed_obstacle_update 02C4C7 u states
# 02C045 "LBRA $62D9" (the bank's jump table: B the state the dispatcher hands in)
local moes_street_scenery_dropper_update 02C045 b state
# 02C2D9 "LDU #$7BE2" ... 02C2DD "JMP [B,U]"
local moes_street_scenery_dropper_update 02C2D9 u states
# 02C048 "LBRA $6239" (the bank's jump table: B the state the dispatcher hands in)
local moes_street_scenery_riser_update 02C048 b state
# 02C239 "LDU #$7BD0" ... 02C23D "JMP [B,U]"
local moes_street_scenery_riser_update 02C239 u states
# 02C04B "LBRA $7371" (the bank's jump table: B the state the dispatcher hands in)
local running_animal_update 02C04B b state
# 02D371 "LDU #$7EE1" ... 02D375 "JSR [B,U]"
local running_animal_update 02D371 u states
# 02C04E "LBRA $703A" (the bank's jump table: B the state the dispatcher hands in)
local gorge_rock_update 02C04E b state
# 02D03A "LDU #$7E05" ... 02D03E "JSR [B,U]"
local gorge_rock_update 02D03A u states
# 02C051 "LBRA $6E66" (the bank's jump table: B the state the dispatcher hands in)
local boulder_update 02C051 b state
# 02CE66 "LDU #$7DE5" ... 02CE6A "JSR [B,U]"
local boulder_update 02CE66 u states
# 02C054 "LBRA $7550" (the bank's jump table: B the state the dispatcher hands in)
local bouncing_throwable_update 02C054 b state
# 02D550 "LDU #$7F15" ... 02D554 "JSR [B,U]"
local bouncing_throwable_update 02D550 u states
# 02C05A "LBRA $70DC" (the bank's jump table: B the state the dispatcher hands in)
local shaken_object_update 02C05A b state
# 02D0DC "LDU #$7E1B" ... 02D0E0 "JSR [B,U]"
local shaken_object_update 02D0DC u states
# 02C05D "LBRA $75C5" (the bank's jump table: B the state the dispatcher hands in)
local dreamland_obstacle_update 02C05D b state
# 02D5C5 "LDU #$7F2F" ... 02D5C9 "JSR [B,U]"
local dreamland_obstacle_update 02D5C5 u states
# done: objects/handlers_bank_16.c

# ---- objects/handlers_bank_17.c ----
# bank 17's handlers (bystanders, kinds 87-A9, the clown on a ball, the buzzing chaser): the state the list's dispatcher hands each type's handler in B, where the bank's jump table
# goes on to it (the jump table's "LBRA" is where the C's "b = (uint8_t)d" is), and the state tables the handlers
# jump through by it ("LDU #$xxxx; ASLB; JSR [B,U]", or "LDB #$02,X; ASLB"); a table jumped through by another field
# (37) is the object's steps. The enemies' actions (enemy_attack: 07D64F "LDD #$28,X", 07D65E "LDU #$F5A2; ASLA; JSR
# [A,U]") are handed the action's step (field 29) in B instead, and jump through their steps by it
# 02E000 "LBRA $6075" (the bank's jump table: B the state the dispatcher hands in)
local looping_scenery_update 02E000 b state
# 02E075 "LDU #$7A08" ... 02E079 "JMP [B,U]"
local looping_scenery_update 02E075 u states
# 02E003 "LBRA $62D4" (the bank's jump table: B the state the dispatcher hands in)
local food_update 02E003 b state
# 02E2D4 "LDU #$7AC4" ... 02E2D8 "JSR [B,U]"
local food_update 02E2D4 u states
# 02E006 "LBRA $620E" (the bank's jump table: B the state the dispatcher hands in)
local food_jump_out_update 02E006 b state
# 02E20E "LDU #$7A88" ... 02E212 "JSR [B,U]"
local food_jump_out_update 02E20E u states
# 02E009 "LBRA $66A2" (the bank's jump table: B the state the dispatcher hands in)
local fireman_goon_update 02E009 b state
# 02E00C "LBRA $6784" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local fireman_goon_throw_update 02E00C b step
# 02E784 "LDU #$7C6D" ... 02E788 "JMP [B,U]"
local fireman_goon_throw_update 02E784 u steps
# 02E00F "LBRA $67DE" (the bank's jump table: B the state the dispatcher hands in)
local fireman_goon_missile_update 02E00F b state
# 02E7DE "LDU #$7C79" ... 02E7E2 "JMP [B,U]"
local fireman_goon_missile_update 02E7DE u states
# 02E015 "LBRA $6F03" (the bank's jump table: B the state the dispatcher hands in)
local one_eared_rabbit_update 02E015 b state
# 02E018 "LBRA $662C" (the bank's jump table: B the state the dispatcher hands in)
local bystander_update 02E018 b state
# 02E62C "LDU #$7BC3" ... 02E630 "JSR [B,U]"
local bystander_update 02E62C u states
# 02E01B "LBRA $6EF7" (the bank's jump table: B the state the dispatcher hands in)
local unused_goon_update 02E01B b state
# 02EEF7 "LDU #$7E0F" ... 02EEFB "JSR [B,U]"
local unused_goon_update 02EEF7 u states
# 02E01E "LBRA $6FCF" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local one_eared_rabbit_strike_update 02E01E b step
# 02EFCF "LDU #$7E3B" ... 02EFD3 "JMP [B,U]"
local one_eared_rabbit_strike_update 02EFCF u steps
# 02E021 "LBRA $7072" (the bank's jump table: B the state the dispatcher hands in)
local clown_on_ball_update 02E021 b state
# 02E024 "LBRA $70EA" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local clown_on_ball_strike_update 02E024 b step
# 02F0EA "LDU #$7E73" ... 02F0EE "JMP [B,U]"
local clown_on_ball_strike_update 02F0EA u steps
# 02E027 "LBRA $7003" (the bank's jump table: B the state the dispatcher hands in)
local clown_ball_update 02E027 b state
# 02F003 "LDU #$7E47" ... 02F007 "JSR [B,U]"
local clown_ball_update 02F003 u states
# 02E02A "LBRA $779F" (the bank's jump table: B the state the dispatcher hands in)
local unused_homer_object_update 02E02A b state
# 02F79F "LDU #$7FC9" ... 02F7A3 "JSR [B,U]"
local unused_homer_object_update 02F79F u states
# 02E02D "LBRA $710B" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local clown_on_ball_jump_update 02E02D b step
# 02F10B "LDU #$7E77" ... 02F10F "JMP [B,U]"
local clown_on_ball_jump_update 02F10B u steps
# 02E030 "LBRA $7753" (the bank's jump table: B the state the dispatcher hands in)
local random_pose_figure_update 02E030 b state
# 02F753 "LDU #$7FA3" ... 02F757 "JSR [B,U]"
local random_pose_figure_update 02F753 u states
# 02E036 "LBRA $6B0D" (the bank's jump table: B the state the dispatcher hands in)
local teacup_goon_update 02E036 b state
# 02E039 "LBRA $68A0" (the bank's jump table: B the state the dispatcher hands in)
local teacup_goon_ride_update 02E039 b state
# 02E8A0 "LDU #$7D96" ... 02E8A4 "JSR [B,U]"
local teacup_goon_ride_update 02E8A0 u states
# 02E03C "LBRA $697D" (the bank's jump table: B the state the dispatcher hands in)
local teacup_goon_ride_arm_update 02E03C b state
# 02E97D "LDU #$7DB5" ... 02E981 "JMP [B,U]"
local teacup_goon_ride_arm_update 02E97D u states
# 02F158 "LDU #$7E7B" ... 02F15C "JSR [B,U]"
local clown_on_ball_charge_update 02F158 u steps
# 02E042 "LBRA $71D8" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local clown_on_ball_pause_update 02E042 b step
# 02F1D8 "LDU #$7E83" ... 02F1DC "JMP [B,U]"
local clown_on_ball_pause_update 02F1D8 u steps
# 02E045 "LBRA $6A89" (the bank's jump table: B the state the dispatcher hands in)
local teacup_goon_piece_update 02E045 b state
# 02EA89 "LDU #$7DCD" ... 02EA8D "JMP [B,U]"
local teacup_goon_piece_update 02EA89 u states
# 02E048 "LBRA $74E9" (the bank's jump table: B the state the dispatcher hands in)
local bluebird_update 02E048 b state
# 02F4E9 "LDU #$7F4F" ... 02F4ED "JSR [B,U]"
local bluebird_update 02F4E9 u states
# 02E04B "LBRA $73E4" (the bank's jump table: B the state the dispatcher hands in)
local buzzing_chaser_update 02E04B b state
# 02F3E4 "LDU #$7F3D" ... 02F3E8 "JSR [B,U]"
local buzzing_chaser_update 02F3E4 u states
# 02E04E "LBRA $6361" (the bank's jump table: B the state the dispatcher hands in)
local dropped_food_update 02E04E b state
# 02E361 "LDU #$7AE4" ... 02E365 "JMP [B,U]"
local dropped_food_update 02E361 u states
# 02E389 "LDU #$7AEC" ... 02E38D "JSR [B,U]"
local girl_with_food_update 02E389 u states
# 02E054 "LBRA $7335" (the bank's jump table: B the state the dispatcher hands in)
local caged_gorilla_update 02E054 b state
# 02F335 "LDU #$7F29" ... 02F339 "JSR [B,U]"
local caged_gorilla_update 02F335 u states
# 02E057 "LBRA $72AA" (the bank's jump table: B the state the dispatcher hands in)
local krustyland_bear_update 02E057 b state
# 02F2AA "LDU #$7F17" ... 02F2AE "JSR [B,U]"
local krustyland_bear_update 02F2AA u states
# 02E05A "LBRA $61F1" (the bank's jump table: B the state the dispatcher hands in)
local item_update 02E05A b state
# 02E1F1 "LDU #$7A68" ... 02E1F5 "JSR [B,U]"
local item_update 02E1F1 u states
# 02E05D "LBRA $649C" (the bank's jump table: B the state the dispatcher hands in)
local sideshow_bob_update 02E05D b state
# 02E49C "LDU #$7B50" ... 02E4A0 "JSR [B,U]"
local sideshow_bob_update 02E49C u states
# 02E060 "LBRA $652A" (the bank's jump table: B the state the dispatcher hands in)
local item_carrier_update 02E060 b state
# 02E52A "LDU #$7B6C" ... 02E52E "JSR [B,U]"
local item_carrier_update 02E52A u states
# 02E063 "LBRA $65CD" (the bank's jump table: B the state the dispatcher hands in)
local carried_item_update 02E063 b state
# 02E5CD "LDU #$7BB0" ... 02E5D1 "JMP [B,U]"
local carried_item_update 02E5CD u states
# 02E066 "LBRA $720B" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local clown_on_ball_hop_update 02E066 b step
# 02F20B "LDU #$7E8B" ... 02F20F "JMP [B,U]"
local clown_on_ball_hop_update 02F20B u steps
# 02E069 "LBRA $6F9F" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local one_eared_rabbit_step_back_update 02E069 b step
# 02EF9F "LDU #$7E37" ... 02EFA3 "JMP [B,U]"
local one_eared_rabbit_step_back_update 02EF9F u steps
# 02E06C "LBRA $60B3" (the bank's jump table: B the state the dispatcher hands in)
local looping_scenery_leaving_update 02E06C b state
# 02E0B3 "LDU #$7A3A" ... 02E0B7 "JMP [B,U]"
local looping_scenery_leaving_update 02E0B3 u states
# 02E06F "LBRA $60E1" (the bank's jump table: B the state the dispatcher hands in)
local unused_kind_b7_update 02E06F b state
# 02E072 "LBRA $682B" (the bank's jump table: B the state the dispatcher hands in)
local kent_brockman_update 02E072 b state
# 02E82B "LDU #$7C8F" ... 02E82F "JSR [B,U]"
local kent_brockman_update 02E82B u states
# done: objects/handlers_bank_17.c

# ---- objects/handlers_bank_18.c ----
# bank 18's handlers: the state the list's dispatcher hands each type's handler in B, where the bank's jump table
# goes on to it (the jump table's "LBRA" is where the C's "b = (uint8_t)d" is), and the state tables the handlers
# jump through by it ("LDU #$xxxx; ASLB; JSR [B,U]", or "LDB #$02,X; ASLB"); a table jumped through by another field
# (37) is the object's steps. The enemies' actions (enemy_attack: 07D64F "LDD #$28,X", 07D65E "LDU #$F5A2; ASLA; JSR
# [A,U]") are handed the action's step (field 29) in B instead, and jump through their steps by it
# 030000 "LBRA $7541" (the bank's jump table: B the state the dispatcher hands in)
local barney_bystander_update 030000 b state
# 030006 "LBRA $75E1" (the bank's jump table: B the state the dispatcher hands in)
local woman_in_green_carrier_update 030006 b state
# 030009 "LBRA $6116" (the bank's jump table: B the state the dispatcher hands in)
local zombie_update 030009 b state
# 03000C "LBRA $63DD" (the bank's jump table: B the state the dispatcher hands in)
local ghost_on_rope_update 03000C b state
# 03000F "LBRA $655F" (the bank's jump table: B the state the dispatcher hands in)
local rising_zombie_update 03000F b state
# 03055F "LDU #$7A38" ... 030563 "JMP [B,U]"
local rising_zombie_update 03055F u states
# 030015 "LBRA $6373" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local zombie_swipe_action 030015 b step
# 030373 "LDU #$7A0C" ... 030377 "JMP [B,U]"
local zombie_swipe_action 030373 u steps
# 030018 "LBRA $72EF" (the bank's jump table: B the state the dispatcher hands in)
local walking_kind_87_update 030018 b state
# 0312EF "LDU #$7F1C" ... 0312F3 "JSR [B,U]"
local walking_kind_87_update 0312EF u states
# 03001B "LBRA $74D9" (the bank's jump table: B the state the dispatcher hands in)
local belly_dancer_watcher_update 03001B b state
# 0314D9 "LDU #$7F4A" ... 0314DD "JSR [B,U]"
local belly_dancer_watcher_update 0314D9 u states
# 03001E "LBRA $7383" (the bank's jump table: B the state the dispatcher hands in)
local moe_update 03001E b state
# 031383 "LDU #$7F30" ... 031387 "JSR [B,U]"
local moe_update 031383 u states
# 030021 "LBRA $6054" (the bank's jump table: B the state the dispatcher hands in)
local wandering_zombie_update 030021 b state
# 030024 "LBRA $6241" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local zombie_burrow_action 030024 b step
# 030241 "LDU #$79F8" ... 030245 "JMP [B,U]"
local zombie_burrow_action 030241 u steps
# 030027 "LBRA $7238" (the bank's jump table: B the state the dispatcher hands in)
local belly_dancer_thrower_update 030027 b state
# 03002A "LBRA $71DC" (the bank's jump table: B the state the dispatcher hands in)
local spark_shot_update 03002A b state
# 0311DC "LDU #$7EEC" ... 0311E0 "JSR [B,U]"
local spark_shot_update 0311DC u states
# 03002D "LBRA $62C8" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local zombie_leap_action 03002D b step
# 0302C8 "LDU #$7A00" ... 0302CC "JMP [B,U]"
local zombie_leap_action 0302C8 u steps
# 030030 "LBRA $6836" (the bank's jump table: B the state the dispatcher hands in)
local lumberjack_update 030030 b state
# 030033 "LBRA $68EA" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local lumberjack_axe_action 030033 b step
# 0308EA "LDU #$7BFE" ... 0308EE "JMP [B,U]"
local lumberjack_axe_action 0308EA u steps
# 030036 "LBRA $696B" (the bank's jump table: B the state the dispatcher hands in)
local gorilla_update 030036 b state
# 030039 "LBRA $6AB2" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local gorilla_punch_action 030039 b step
# 030AB2 "LDU #$7C4F" ... 030AB6 "JMP [B,U]"
local gorilla_punch_action 030AB2 u steps
# 03003C "LBRA $6661" (the bank's jump table: B the state the dispatcher hands in)
local grabbing_zombie_update 03003C b state
# 03003F "LBRA $66F5" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local zombie_grab_action 03003F b step
# 030042 "LBRA $6AE7" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local gorilla_leap_action 030042 b step
# 030AE7 "LDU #$7C57" ... 030AEB "JMP [B,U]"
local gorilla_leap_action 030AE7 u steps
# 030045 "LBRA $6B52" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local gorilla_back_off_action 030045 b step
# 030B52 "LDU #$7C6B" ... 030B56 "JMP [B,U]"
local gorilla_back_off_action 030B52 u steps
# 030B9D "LDY #$7C6F" ... 030BA0 "LBSR $85B4"
local knight_update 030B9D y box hit_box
# 030048 "LBRA $6B82" (the bank's jump table: B the state the dispatcher hands in)
local knight_update 030048 b state
# 03004B "LBRA $6DFF" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local knight_strike_action 03004B b step
# 030DFF "LDU #$7D71" ... 030E03 "JMP [B,U]"
local knight_strike_action 030DFF u steps
# 03004E "LBRA $6E66" (the bank's jump table: B the state the dispatcher hands in)
local cloud_devil_update 03004E b state
# 030051 "LBRA $6E33" (the bank's jump table: B the state the dispatcher hands in)
local lightning_bolt_update 030051 b state
# 030E33 "LDU #$7D87" ... 030E37 "JMP [B,U]"
local lightning_bolt_update 030E33 u states
# done: objects/handlers_bank_18.c

# ---- objects/handlers_bank_19.c ----
# bank 19's handlers: the state the list's dispatcher hands each type's handler in B, where the bank's jump table
# goes on to it (the jump table's "LBRA" is where the C's "b = (uint8_t)d" is), and the state tables the handlers
# jump through by it ("LDU #$xxxx; ASLB; JSR [B,U]", or "LDB #$02,X; ASLB"); a table jumped through by another field
# (37) is the object's steps. The enemies' actions (enemy_attack: 07D64F "LDD #$28,X", 07D65E "LDU #$F5A2; ASLA; JSR
# [A,U]") are handed the action's step (field 29) in B instead, and jump through their steps by it
# 032000 "LBRA $6B1A" (the bank's jump table: B the state the dispatcher hands in)
local robot_update 032000 b state
# 032003 "LBRA $6CD5" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local robot_shock_92_action 032003 b step
# 032CD5 "LDU #$7C36" ... 032CD9 "JMP [B,U]"
local robot_shock_92_action 032CD5 u steps
# 032006 "LBRA $6D13" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local robot_shock_91_action 032006 b step
# 032D13 "LDU #$7C70" ... 032D17 "JMP [B,U]"
local robot_shock_91_action 032D13 u steps
# 032009 "LBRA $6BFF" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local robot_punch_action 032009 b step
# 032BFF "LDU #$7C04" ... 032C03 "JSR [B,U]"
local robot_punch_action 032BFF u steps
# 03200C "LBRA $6B95" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local robot_combo_action 03200C b step
# 032B95 "LDU #$7BE8" ... 032B99 "JMP [B,U]"
local robot_combo_action 032B95 u steps
# 03200F "LBRA $6E33" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local robot_launch_part_action 03200F b step
# 032E33 "LDU #$7D08" ... 032E37 "JMP [B,U]"
local robot_launch_part_action 032E33 u steps
# 032012 "LBRA $62B0" (the bank's jump table: B the state the dispatcher hands in)
local ninja_update 032012 b state
# 032015 "LBRA $669A" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local ninja_crouch_strike_action 032015 b step
# 03269A "LDU #$7AAB" ... 03269E "JMP [B,U]"
local ninja_crouch_strike_action 03269A u steps
# 032018 "LBRA $6E70" (the bank's jump table: B the state the dispatcher hands in)
local robot_part_update 032018 b state
# 032E70 "LDU #$7D16" ... 032E74 "JMP [B,U]"
local robot_part_update 032E70 u states
# 03201B "LBRA $6678" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local ninja_slash_action 03201B b step
# 032678 "LDU #$7AA3" ... 03267C "JMP [B,U]"
local ninja_slash_action 032678 u steps
# 03201E "LBRA $6608" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local ninja_throw_action 03201E b step
# 032608 "LDU #$7A8D" ... 03260C "JMP [B,U]"
local ninja_throw_action 032608 u steps
# 03263D "LBSR $8638"
local ninja_star_update 03263D a cell
# 032021 "LBRA $662A" (the bank's jump table: B the state the dispatcher hands in)
local ninja_star_update 032021 b state
# 03263D "LBSR $8638"
local ninja_star_update 03263D d floor_cell
# 03262A "LDU #$7A99" ... 03262E "JSR [B,U]"
local ninja_star_update 03262A u states
# 032027 "LBRA $6A39" (the bank's jump table: B the state the dispatcher hands in)
local robot_piece_update 032027 b state
# 032A39 "LDU #$7B06" ... 032A3D "JMP [B,U]"
local robot_piece_update 032A39 u states
# 03202A "LBRA $66E8" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local ninja_jump_attack_action 03202A b step
# 0326E8 "LDU #$7ABA" ... 0326EC "JMP [B,U]"
local ninja_jump_attack_action 0326E8 u steps
# 03202D "LBRA $6790" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local ninja_rush_action 03202D b step
# 032790 "LDU #$7AC4" ... 032794 "JMP [B,U]"
local ninja_rush_action 032790 u steps
# 032030 "LBRA $65D6" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local ninja_hop_strike_action 032030 b step
# 0325D6 "LDU #$7A85" ... 0325DA "JMP [B,U]"
local ninja_hop_strike_action 0325D6 u steps
# 032033 "LBRA $628B" (the bank's jump table: B the state the dispatcher hands in)
local ninja_fighter_update 032033 b state
# 032036 "LBRA $6EDB" (the bank's jump table: B the state the dispatcher hands in)
local goon_lift_update 032036 b state
# 032EDB "LDU #$7D52" ... 032EDF "JSR [B,U]"
local goon_lift_update 032EDB u states
# 032039 "LBRA $6F91" (the bank's jump table: B the state the dispatcher hands in)
local goon_lift_part_update 032039 b state
# 032F91 "LDU #$7D88" ... 032F95 "JSR [B,U]"
local goon_lift_part_update 032F91 u states
# 03203C "LBRA $685C" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local ninja_vanish_action 03203C b step
# 03285C "LDU #$7ACC" ... 032860 "JMP [B,U]"
local ninja_vanish_action 03285C u steps
# 03203F "LBRA $6060" (the bank's jump table: B the state the dispatcher hands in)
local bouncing_prop_update 03203F b state
# 032060 "LDU #$78B8" ... 032064 "JSR [B,U]"
local bouncing_prop_update 032060 u states
# 032042 "LBRA $6AF1" (the bank's jump table: B the state the dispatcher hands in)
local robot_spark_update 032042 b state
# 032AF1 "LDU #$7BC8" ... 032AF5 "JMP [B,U]"
local robot_spark_update 032AF1 u states
# 032045 "LBRA $68DB" (the bank's jump table: B the state the dispatcher hands in)
local robot_scrap_update 032045 b state
# 0328DB "LDU #$7AEC" ... 0328DF "JSR [B,U]"
local robot_scrap_update 0328DB u states
# 032048 "LBRA $6266" (the bank's jump table: B the state the dispatcher hands in)
local ninja_thrower_update 032048 b state
# 03204B "LBRA $6FE9" (the bank's jump table: B the state the dispatcher hands in)
local donut_update 03204B b state
# 03204E "LBRA $71FD" (the bank's jump table: B the state the dispatcher hands in)
local flying_saxophone_update 03204E b state
# 032051 "LBRA $6C83" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local robot_advance_shock_action 032051 b step
# 032C83 "LDU #$7C10" ... 032C87 "JMP [B,U]"
local robot_advance_shock_action 032C83 u steps
# 032054 "LBRA $7157" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local donut_roll_action 032054 b step
# 033157 "LDU #$7E4A" ... 03315B "JMP [B,U]"
local donut_roll_action 033157 u steps
# 032057 "LBRA $71A4" (the bank's jump table: B the action's step, field 29, enemy_attack hands in)
local donut_throw_action 032057 b step
# 0331A4 "LDU #$7E50" ... 0331A8 "JMP [B,U]"
local donut_throw_action 0331A4 u steps
# 03205A "LBRA $71CF" (the bank's jump table: B the state the dispatcher hands in)
local donut_shot_update 03205A b state
# 0331CF "LDU #$7E5E" ... 0331D3 "JSR [B,U]"
local donut_shot_update 0331CF u states
# 03205D "LBRA $762D" (the bank's jump table: B the state the dispatcher hands in)
local flying_saxophone_shot_update 03205D b state
# 03362D "LDU #$7FD5" ... 033631 "JMP [B,U]"
local flying_saxophone_shot_update 03362D u states
# done: objects/handlers_bank_19.c

# ---- additions to the files above ----
# the hit box the boulder's setup leaves in Y (02CE72 "LBSR $85AB")
local boulder_start 02CE72 y box
# the floor's cell ahead of the prop (0321E4 "LBSR $863B": D, A the cell)
local bouncing_prop_follow 0321E4 d floor_cell
# each enemy a car lets out (0361D4 "LBSR $862C": the child in U)
local car_doors_let_out_enemies 0361D4 u enemy object
# how far kind 87 is from its home (02D849 "LDD #$0C,X; ADDD <$AC", 02D84F "SUBD #$3E,X; ABSD; CMPD #$0034")
local woman_in_apron_update 02D84F d home_distance
# a table by the players present (02E8BB "LDU #$7DA2", 02E8BE "LDA $1874; LDA A,U; CMPA #$31,X")
local teacup_goon_ride_update 02E8BB u by_players
# the bytes the unused routine prints, each in A with B clear (03402C ... 034073 "LBSR $85A8": unused_vector_print_hex_byte, which
# goes on to print_hex_byte at X)
local unused_show_debug_values 03402C,034038,03404C,034057,034068,034073 d value
# done: additions

# ---- more additions ----
# the look's kind and animation, started again (03B2F6 "LDD A,U" of burns_robot_animations, 03B2F8 "ORB #$80"; "STD
# #$04,X")
local burns_robot_set_look 03B2F6 a look_kind
local burns_robot_set_look 03B2F6,03B2F8 b look_animation
# its next state and wait, into 2E-2F at once (03C3A8 "LDY #$0514", 03C3AB "STY #$2E,X")
local football_player_wait_cue 03C3A8 y state_wait
# the object's x (03CCAA "LDY #$0C,X"), compared with 0070 and 0140
local unused_bear_land_in_area 03CCAA y place_x
# done: more additions

# ======== parameters and locals: objects k-z ========
# objects_b: names of the parameters and locals still named after a register (objects/k* to z*, object_lists.c)
# Proposals in symbols.txt syntax; each with its evidence above it.

# ======== objects/object_lists.c ========
# 07CB6C-07CB82 "LDU #$F387; LDD #$01,X; PUSHS B,CC; LDB A,U; SETLN <$0E; PULLS CC,B; LDU #$F2EC; ASLA; JSR [A,U]":
# A is the object's type (field 01), B its state (field 02), U the enemies' handler table each handler is entered with
# 07CB6F "LDD #$01,X": window_bank = enemy_banks[(int8_t)a]
local run_enemies 07CB6F a object_type
# 07CB81 "ASLA": the handler's offset in the table, switch ((int8_t)a)
local run_enemies 07CB81 a handler_offset
# 07CB72/07CB7C "PUSHS B,CC ... PULLS CC,B": B, the object's state (field 02), handed to the handler (d = stack)
local run_enemies 07CB82 d state
# 07CB7E "LDU #$F2EC": the enemies' handler table, what every enemy handler finds in U (football_player, bear,
# stage_8_boss_run take it)
local run_enemies 07CB7E u enemy_handlers
# 07CBB0 "LDD #$01,X" (type, state), 07CBB5 "LDB A,U" (object_list_1_banks)
local run_list_1_objects 07CBB0 a object_type
# 07CBC2 "ASLA": the handler's offset in the F40D table
local run_list_1_objects 07CBC2 a handler_offset
# 07CBB3/07CBBD "PUSHS B,CC ... PULLS CC,B": the object's state handed to the handler
local run_list_1_objects 07CBC3 d state
# 07CBBF "LDU #$F40D; ASLA; JSR [A,U]": list 1's handler table, what each of its handlers finds in U
local run_list_1_objects 07CBBF u list_1_handlers
# 07CBE3 "LDD #$01,X", 07CBE8 "LDB A,U" (child_object_banks)
local run_child_objects 07CBE3 a object_type
# 07CBF5 "ASLA" before 07CBF6 "JSR [A,U]"
local run_child_objects 07CBF5 a handler_offset
# 07CBE6/07CBF0 "PUSHS B,CC ... PULLS CC,B": the object's state handed to the handler
local run_child_objects 07CBF6 d state
# 07CBF2 "LDU #$F4F4; ASLA; JSR [A,U]": the child objects' handler table, what each child's handler finds in U
local run_child_objects 07CBF2 u child_handlers
# 07CC12 "LDD #$01,X", 07CC17 "LDB A,U" (stage_event_banks)
local run_stage_event 07CC12 a object_type
# 07CC24 "ASLA" before 07CC25 "JSR [A,U]"
local run_stage_event 07CC24 a handler_offset
# 07CC15/07CC1F "PUSHS B,CC ... PULLS CC,B": the event object's state handed to its handler
local run_stage_event 07CC25 d state
# 07CC45 "LDA #$45,U; CMPA ,S": the player's count of enemies after it (the fewest kept on the stack)
local find_least_attacked_player 07CC45 a attackers
# 07CC38 "LDD #$7F04" (B = 4 players), 07CC56 "DBJNZ $CC40": the players left to look at
local find_least_attacked_player 07CC38,07CC56 b players_left
# 07CC69 "LDB $1876": the enemies counted last frame, the column of attackers_per_player (07CC85 "LDA B,U")
local share_out_attackers 07CC69 b enemies
# 07CC6D "LDA $1874": the players in the game (07CC71 "BEQ": none)
local share_out_attackers 07CC6D a players
# 07CC73 "DECA; BNE": the players besides one (07CC7E "DECA; ASLA x4": the row of 16 for 2 players and more)
local share_out_attackers 07CC73 a other_players
# done: objects/object_lists.c

# ======== objects/moes_street_scenery.c ========
# 02C23F "LDU #$7BDC; LBSR $85AB": the object's setup record handed to vector_object_setup
local moes_street_scenery_riser_start 02C23F u setup object_setup
# 02C242 "LBSR $85AB": start_object_from_setup hands back the setup's hit box record in Y (07D13D "LDY #$04,U")
local moes_street_scenery_riser_start 02C242 y box
# 02C2E2 "LBSR $85AB": the setup's hit box record
local moes_street_scenery_dropper_start 02C2E2 y box
# 02C309 "LBSR $8650" (floor_cell_under: the cell's value in A), 02C30F "STA #$33,X" (floor_cell = d >> 8)
local moes_street_scenery_dropper_start 02C309 d floor_cell
# 02C312 "PUSHS U; PULLS D", 02C316 "STB <$F0", 02C319 "ANDB #$C0": the floor place's low byte (its column in the row)
local moes_street_scenery_dropper_start 02C314 b floor_place_low
# 02C380 "LDA <$0F; ORA #$02; STA <$0F; STA $1FC2" and 02C3E7 "LDA <$0F; ANDA #$FC": the board control bits written
local moes_street_scenery_dropper_write_floor 02C383,02C3EA a control
# 02C3B1 "LDU #$38,X; ANDB #$3F; LEAU B,U": the floor map's place of the column's top cell, written down 6 rows
local moes_street_scenery_dropper_write_floor 02C3B6 u floor_place
# done: objects/moes_street_scenery.c

# ======== objects/woman_in_apron.c ========
# 02D7B0 "LDU #$7FBB; LBSR $85AB": the device's setup record for vector_object_setup
local woman_in_apron_device_start 02D7B0 u setup object_setup
# 02D7B3 "LBSR $85AB": start_object_from_setup hands back the setup's hit box record in Y
local woman_in_apron_device_start 02D7B3 y box
# 02D7D7 "LDY #$7F8B; LBSR $85B4": the striking hit box record handed to vector_set_hit_box
local woman_in_apron_device_strike 02D7D7 y box
# 02D800 "LDY #$7F83; LBSR $85B4": the standing hit box record taken back (else Y as it came)
local woman_in_apron_device_strike_end 02D800 y box
# 02D88B "LDY #$7FD1; LBSR $862C": the child object record its device is put in by (vector_spawn_child)
local woman_in_apron_start 02D88B y child_record
# done: objects/woman_in_apron.c

# ======== objects/teacup_goon_ride.c ========
# 02E8D8 "LDU #$7DBF; LBSR $85AB": the hub's setup record
local teacup_goon_ride_start 02E8D8 u setup object_setup
# 02E8DB "LBSR $85AB": the setup's hit box record handed back in Y
local teacup_goon_ride_start 02E8DB y box
# 02E918 "LDY #$7DA7; LBSR $862F": the child object record of an arm (spawn_list_2_child)
local teacup_goon_ride_put_in_arms 02E918 y arm_record
# 02E91B "LBSR $862F" hands back the new arm in U: 02E920 "STX #$38,U" (its ride_hub), 02E928 "STA #$3F,U" (radius),
# 02E92E "STA #$3E,U" (angle)
local teacup_goon_ride_put_in_arms 02E91B u arm object.teacup_goon_ride_arm
# 02E92B "LDA <$F1; STA #$3E,U; ADDA #$55": the arm's angle round the hub, a third of a turn on for the next
local teacup_goon_ride_put_in_arms 02E92B a angle
# 02E99D "LBSR $6A59" (teacup_goon_ride_arm_orbit, which hands back the hub in U: 02EA59 "LDU #$38,X")
local teacup_goon_ride_arm_start 02E99D u hub object.teacup_goon_ride
# 02E9B3 "LDY #$7DC5; LBSR $862C": the child object record of a rider
local teacup_goon_ride_arm_put_in_riders 02E9B3 y rider_record
# 02E9B6 "LBSR $862C" hands back the new rider in U: 02E9C3 "STA #$3F,U" (radius), 02E9C9 "STA #$3E,U" (angle),
# 02E9D4 "STA #$3D,U" (leave_turn)
local teacup_goon_ride_arm_put_in_riders 02E9B6 u rider object.teacup_goon
# 02E9C6 "LDA <$F1; STA #$3E,U; ADDA #$80": the rider's angle round its arm, half a turn on for the next
local teacup_goon_ride_arm_put_in_riders 02E9C6 a angle
# 02E9D1 "LDA <$F0; STA #$3D,U": the riders still to put in (2, 1), the rider's turn to leave
local teacup_goon_ride_arm_put_in_riders 02E9D1 a riders_left
# 02EA5C "LDD #$3E,X; SUBA #$01; STA #$3E,X; LBSR $7257": the arm's angle (one step on) and radius for orbit_offset
local teacup_goon_ride_arm_orbit 02EA5F d angle_and_radius
# 02EAAD "LDB <$58; STD #$0F,X; LSRB; BCC": the random number, the x speed's low byte and bit 0 the second look
local teacup_goon_piece_start 02EAAD b random
# 02EB52 "LDY #$7DF3; LBSR $862F": the child object record of the piece the rider sheds
local teacup_goon_beaten 02EB52 y piece_record
# 02EB71 "CLRA" / 02EB74 "LDA #$01" by 02EB6A "LDA #$1B,X; CMPA #$07": 1 with 7 of life or more, the attribute's index
local teacup_goon_colour_by_health 02EB71,02EB74 a healthy
# 02EC0C "LBSR $85AB": the setup's hit box record handed back in Y
local teacup_goon_start 02EC0C y box
# 02ECB2 "STA #$3E,X; LDB #$3F,X; ... LBSR $7257": the rider's angle and radius for orbit_offset
local teacup_goon_follow_arm 02ECBB d angle_and_radius
# 02ED8A "LDY #$7CCE; LBSR $85B4": the standing hit box record
local teacup_goon_ready 02ED8A y box
# 02ED9D "LBSR $8620" (vector_choose_nearest_player) hands back the target player in U, 02EDA0 "LBSR $8626"
local teacup_goon_ready_wait 02ED9D u target object
# 02EDC6 "LDB <$58; STD #$14,X; TSTB; BMI": the random number, the y speed's low byte and its sign
local teacup_goon_keep_on_screen 02EDC6 b random
# 02EDE2 "LDY #$7CCE; LBSR $85B4": the standing hit box record taken when it turns back (else Y as it came)
local teacup_goon_keep_on_screen 02EDE2 y box
# 02EDF2 "LBSR $8647; TSTA; BPL": floor_ahead_y's cell ahead in A (D as it hands it back)
local teacup_goon_keep_on_screen 02EDF2 d floor_cell
local teacup_goon_keep_on_screen 02EDF2 a floor_value
# done: objects/teacup_goon_ride.c

# ======== objects/belly_dancer.c ========
# 0311F5 "LDU #$7EF0; LDA #$29,X; ASLA; JMP [A,U]": the shot's step handlers by field 29, what each step finds in U
local spark_shot_burst 0311F5 u step_handlers
# 031214 "LDU #$7EF4; LBSR $85AB": the shot's setup record
local spark_shot_setup 031214 u setup object_setup
# 031217 "LBSR $85AB": the setup's hit box record handed back in Y
local spark_shot_setup 031217 y box
# nothing calls it: its object in X, "t1 = mem_read8(x + 0x29u)" (the action step it switches on)
param unused_kind_8e_thrower_run_step x object object
# 0312A0 "LBSR $85AB": the setup's hit box record handed back in Y
local belly_dancer_thrower_setup 0312A0 y box
# 0312CB "LDY #$7F16; LBSR $862F": the child object record of the shot it throws
local belly_dancer_thrower_throw 0312CB y shot_record
# done: objects/belly_dancer.c

# ======== objects/fireman_goon.c ========
# 02E6B1 "LBSR $85AB": the setup's hit box record handed back in Y
local fireman_goon_setup 02E6B1 y box
# 02E6E9-02E6F3 "LDU #$7C59; LDA #$30,X; ASLA; ASLA; LEAU A,U; LDD ,U; STD #$3E,X; CMPD #$0100": the start's x, kept in
# field 3E, facing by whether it is past 0100 (D, its high byte in A)
local fireman_goon_setup 02E6F3 d start_x_low
local fireman_goon_setup 02E6F3 a start_x_high
# 02E735 "LBSR $8620" (vector_choose_nearest_player) hands back the target player in U, 02E738 "LBSR $8626"
local fireman_goon_wait_camera 02E735 u target object
# 02E765 "CLRD; LBSR $8638; TSTA; BMI": floor_at_offset's offsets (none) in, the floor's cell under it (in A) out
local fireman_goon_find_floor 02E765,02E766 d floor_cell
# 02E7C1 "LDY #$7C73; LBSR $862F": the child object record of what it throws
local fireman_goon_put_in_missile 02E7C1 y missile_record
# done: objects/fireman_goon.c

# ======== objects/fireman_goon_effect.c ========
# 07E18F "LDU #$F28C; ASLB; JMP [B,U]": the effect's state handlers, what each state finds in U
local fireman_goon_effect 07E18F u state_handlers
# 07E195 "LDU #$F290; LBSR $D132": the effect's setup record for start_object_from_setup
local fireman_goon_effect_start 07E195 u setup object_setup
# 07E198 "LBSR $D132": the setup's hit box record handed back in Y
local fireman_goon_effect_start 07E198 y box
# done: objects/fireman_goon_effect.c

# ======== objects/rabbit.c ========
# 02D9DF "LDU #$7FE9; LDA #$29,X; ASLA; JMP [A,U]": its hit steps' handlers by field 29
local rabbit_hit_steps 02D9DF u step_handlers
# 02DA0A "LDU #$7FED; LBSR $85AB": its setup record
local rabbit_start 02DA0A u setup object_setup
# 02DA0D "LBSR $85AB": the setup's hit box record handed back in Y
local rabbit_start 02DA0D y box
# done: objects/rabbit.c

# ======== objects/one_eared_rabbit.c ========
# 02EF12 "LBSR $85AB": the setup's hit box record handed back in Y
local one_eared_rabbit_start 02EF12 y box
# 02EF1D "LDU #$7CE6; STU #$2A,X": the enemy's behaviour record (field 2A, behaviour)
local one_eared_rabbit_start 02EF1D u behaviour enemy_behaviour
# 02EF44 "LDU #$7E2D; LDA #$29,X; ASLA; JMP [A,U]": its entrance's step handlers by field 29
local one_eared_rabbit_entrance_steps 02EF44 u step_handlers
# 02EF8D "CLRD; LBSR $8638; TSTA; BMI": floor_at_offset's offsets (none) in, the floor's cell under it (in A) out
local one_eared_rabbit_entrance_reach_floor 02EF8D,02EF8E d floor_cell
local one_eared_rabbit_entrance_reach_floor 02EF8E a floor_value
# 02EFF2 "LDY #$7CA6; LBSR $85B4": the hit box record it takes back after the strike
local one_eared_rabbit_strike_recover 02EFF2 y box
# done: objects/one_eared_rabbit.c

# ======== objects/bluebird.c ========
# 02F50A "LBSR $85AB": the setup's hit box record handed back in Y
local bluebird_start 02F50A y box
# 02F51C "LDA #$30,X; BPL": its spawn's parameter (bit 7: hidden on the shaking scenery)
local bluebird_start 02F51C a spawn_parameter
# 02F521 "ANDA #$7F; BEQ; DECA; STA #$30,X": the parameter's low 7 bits (0: sits still, else hidden, one less kept)
local bluebird_start 02F521 a parameter_low
# 02F57E "CLRD; LBSR $8638; BMI; ANDA #$0F": floor_at_offset's offsets (none) in, the floor's cell under it out
local bluebird_take_floor 02F57E,02F57F d floor_cell
local bluebird_take_floor 02F57F a floor_value
# done: objects/bluebird.c

# ======== objects/kent_brockman.c ========
# 02E834 "LDU #$7C99; LBSR $85AB": its setup record
local kent_brockman_start 02E834 u setup object_setup
# 02E837 "LBSR $85AB": the setup's hit box record handed back in Y
local kent_brockman_start 02E837 y box
# done: objects/kent_brockman.c

# ======== objects/krusty_balloon.c ========
# 026969 "PUSHS U; LDU #$7CB6; ASLA; LDD A,U; ORB #$80; STD #$04,X": A is the number of the animation in
# krusty_balloon_animations its callers ask for ("LDA #$01; LBSR $6969", 026C51 "CLRA; LBSR $6969")
param krusty_balloon_set_animation d animation_number
# 026978 "PUSHS U; LDU #$7CD0; ASLA; ASLA; ASLA": A is the number of the hit box in krusty_balloon_hit_boxes (026B97
# "CLRA; LBSR $6978", 026CB0 "LDA #$05; LBSR $6978")
param krusty_balloon_set_hit_box d box_number
# 0269E0, by its callers: 026847 "LDA #$32,X; LBSR $69E0" (throw_side: 0 right, 1 at random, 2 left), 026A35 "PULLS A;
# ASLA; JSR [A,Y]" (the side picks the shot's speed)
param krusty_balloon_throw d side
# 026514 "LDU #$7C64; LDA #$02,X; ASLA; JSR [A,U]": the balloon's state handlers by field 02
local krusty_balloon 026514 u state_handlers
# 026517 "LDA #$02,X": the state it switches on (signed: -3 beaten ... 5 waiting)
local krusty_balloon 026517 a state_index
# 026523-02652E "LDU #$7CB2; LDA <$57; DECA; LDA A,U; LDB #$01; LBSR $86BF": boss_shade_by_vitality's A (the vitality
# a shade step is worth, by the players) and B (the row of hurt effects)
local krusty_balloon 02652E d shade_step_and_row
# 026D86 "LDU #$7D3A": the shot's state handlers by field 02 (the stages' title cards share the table)
local krusty_balloon_shot 026D86 u state_handlers
# 026532 "LDU #$7C70; LDA #$28,X; ASLA; JSR [A,U]": the beaten balloon's step handlers by field 28
local krusty_balloon_beaten 026532 u step_handlers
local krusty_balloon_beaten 026535 a step_index
# 0265BE "LDU #$7C78; LDA #$28,X; ASLA; JSR [A,U]": the knocked up balloon's step handlers by field 28
local krusty_balloon_knocked_up 0265BE u step_handlers
local krusty_balloon_knocked_up 0265C1 a step_index
# 0265E8 "LDD #$0C,X; CMPD #$0040 ... #$017F": its x, kept between the screen's sides (A high byte, B low)
local krusty_balloon_fly_up 0265E8 a x_high
local krusty_balloon_fly_up 0265E8 b x_low
# 026608 "LDU #$7C7C; LDA #$28,X; ASLA; JSR [A,U]": the coming in balloon's step handlers by field 28
local krusty_balloon_come_in 026608 u step_handlers
local krusty_balloon_come_in 02660B a step_index
# 02666F / 02667A / 026685 "LDD #$0018" / "#$0019" / "#$001A; LBSR $8677": the palette effects asked for (with <$7E = 2)
local krusty_balloon_appear 02666F,02667A,026685 d palette_effect_number
# 0266BF "LDA #$0A,X; SUBA #$01; STA #$0A,X; STA #$0B,X": its zoom, a step smaller
local krusty_balloon_drift_away 0266C2 a zoom
# 0266E6 "LDA #$0A,X; ADDA #$01; STA #$0A,X; STA #$0B,X": its zoom, a step larger
local krusty_balloon_drift_back 0266E9 a zoom
# 026AF7 "LDU #$7CAA; LDA #$35,X; ASLA; JMP [A,U]": the rebound's handlers by its squash step (field 35)
local krusty_balloon_bounce_up 026AF7 u squash_handlers
local krusty_balloon_bounce_up 026AFA a squash_index
local krusty_balloon_stomp_bounce 026AF7 u squash_handlers
local krusty_balloon_stomp_bounce 026AFA a squash_index
# 02672A "LBSR $693A" (krusty_balloon_check_over_target) hands back the target in U, 02672F "LBSR $69B9"
# (krusty_balloon_keep_target's target)
local krusty_balloon_chase 02672A u target object
# 026751 "LDU #$7C88; LDA #$28,X; ASLA; JMP [A,U]": the attack's step handlers by field 28
local krusty_balloon_attack 026751 u step_handlers
local krusty_balloon_attack 026754 a step_index
# 02677B "CLRA" / 026794 "LDA #$01" then 026796 "LBSR $6978": its own hit box, 1 at the animation's event, else 0
local krusty_balloon_attack_hit 02677B,026794 a own_box
# 0267C0 "LDU #$7C94; LDA #$28,X; ASLA; JMP [A,U]": the volley's step handlers by field 28
local krusty_balloon_volley 0267C0 u step_handlers
local krusty_balloon_volley 0267C3 a step_index
# 0267F7 "LDA #$0A,X; CMPA #$60; BHI; INCA; STA #$0A,X": its zoom, grown to 60
local krusty_balloon_volley_take_position 0267F7,0267FE a zoom
# 026857-026860 "LDA #$32,X; INCA; CMPA #$03; BNE; CLRA; STA #$32,X": the next throw's side (0, 1, 2 in turn)
local krusty_balloon_volley_throw 02685A,02685F a next_throw_side
# 026895 "LDA #$0A,X; DECA; CMPA #$40": its zoom, a step smaller
local krusty_balloon_volley_shrink 026898 a zoom
# 0268B8 "LDU #$7C98; LDA #$28,X; ASLA; JMP [A,U]": the stomp's step handlers by field 28
local krusty_balloon_stomping 0268B8 u step_handlers
local krusty_balloon_stomping 0268BB a step_index
# 0268F8 "LDU #$2B,X; LDA #$00,U": its target (field 2B), a player
local krusty_balloon_wait_for_target 0268F8 u target_player object
# 02694B "SUBD #$11,U" (its y less the target's) and 02695B "ABSD" (how far across): the distance it checks
local krusty_balloon_check_over_target 02694B,02695B a distance_high
local krusty_balloon_check_over_target 02694B,02695B b distance_low
# 026C23 "CLRB; LBSR $867D": the list find_free_slot takes its attack object from (0)
local krusty_balloon_check_over_target 026C24 d slot_list
# 02699B "LDU #$2B,X; LDD #$0C,X; CMPD #$0C,U": its target (field 2B)
local krusty_balloon_aim 02699B u target_player object
# 0269A6 "LDB #$C0" / 0269AA "LDB #$40": the offset beside the target it aims at (direction_to_offset's B)
local krusty_balloon_aim 0269A6,0269AA b side_offset
# 0269AC "LBSR $8671; STA #$2D,X": the direction to the place beside the target (direction, field 2D)
local krusty_balloon_aim 0269AC d aim_direction
# 0269B2 "LBSR $861D; STA #$2E,X": the direction straight to the target
local krusty_balloon_aim 0269B2 d direction
# 0269BF "LDY #$2B,X; LDA #$00,Y": its target (field 2B), kept for 40 frames
local krusty_balloon_keep_target 0269BF y target_player object
# 0269E4 "LDB #$01" / 0269EB "LDB #$02" before "LBSR $867D": the list find_free_slot takes the shot from
local krusty_balloon_throw 0269E4,0269EB d slot_list
# 026A26 "PULLS X,U": the balloon back in X, handed to the throw handlers
local krusty_balloon_throw 026A26 x balloon object.krusty_balloon
# 026A32 "LDY #$7C9C; PULLS A; ASLA; JSR [A,Y]": the throw handlers by side
local krusty_balloon_throw 026A32 y throw_handlers
# 026A35 "PULLS A": the side the shot goes (pushed from its D)
local krusty_balloon_throw 026A35 a side_index
# 026A61 "LDY #$7D28; LDB <$58; ANDB #$07": krusty_balloon_throw_z_speeds, left in Y
local krusty_balloon_throw_spread 026A61 y z_speed_table
# 026A76 "LDU #$7CA2; LDA #$35,X; ASLA; JSR [A,U]": the wobble's handlers by its squash step (field 35)
local krusty_balloon_wobble 026A76 u squash_handlers
local krusty_balloon_wobble 026A79 a squash_index
# 026BAE "LDD #$000D; LBSR $8677": the palette effect it flashes with (<$7E = 2)
local krusty_balloon_hit 026BB1 d palette_effect_number
# 026CB8 "LBSR $861D" (vector_direction_to the nearest player): the direction to it in A
local krusty_balloon_stomp 026CB8 d direction
local krusty_balloon_stomp 026CB8 a angle
# 026CBB "LDB #$C0; LBSR $8617": the direction (A) and speed (B) vector_set_speed_by_direction takes
local krusty_balloon_stomp 026CBD d direction_and_speed
# 026CE4 "CLRD; STD #$0F,X; STD #$14,X": no speed across or along
local krusty_balloon_lose_target 026CE4 d zero_speed
# 026D01 "LDD #$0D,X; ADDD #$0F,X": its x's low byte and fraction moved by its x speed
local krusty_balloon_keep_in_arena_x 026D01 d x_and_fraction
# 026D14 "LDD <$F1; ADDD <$AD": that next place's low byte and fraction plus the camera's
local krusty_balloon_keep_in_arena_x 026D14 d next_x_and_fraction
# 026D23 "LDB <$F1; CMPD #$076F ... #$08E0": its next place in the stage
local krusty_balloon_keep_in_arena_x 026D23 d next_stage_x
# 026D35 "LDA #$02,X; BEQ; CMPA #$03; BEQ": its state (0 and 3 are not held)
local krusty_balloon_keep_in_arena_y 026D35 a current_state
# 026D5A "LDA <$F0; SBCA <$B2; LDB <$F1; CMPD #$0060 ... #$0100": its next y from the camera's
local krusty_balloon_keep_in_arena_y 026D5D a next_y_high
local krusty_balloon_keep_in_arena_y 026D60 b next_y_low
# 026D95 "LDA #$0B; LDB #$02,X; CMPB #$03; BCS; INCA; LBSR $6969": the burst's animation (0B, 0C once fallen)
local krusty_balloon_shot_burst 026D95,026D9E a burst_animation
# done: objects/krusty_balloon.c

# ======== objects/krustyland_bear.c ========
# 02F2B3 "LDU #$7F23; LBSR $85AB": the bear's setup record
local krustyland_bear_start 02F2B3 u setup object_setup
# 02F2B6 "LBSR $85AB": the setup's hit box record handed back in Y
local krustyland_bear_start 02F2B6 y box
# 02F33E "LDU #$7F35; LBSR $85AB": the kind B2 object's setup record
local caged_gorilla_start 02F33E u setup object_setup
# 02F341 "LBSR $85AB": the setup's hit box record handed back in Y
local caged_gorilla_start 02F341 y box
# 02F3A1 "LDY #$7EDF; LBSR $85B4": its hit hit box record
local caged_gorilla_hit 02F3A1 y box
# 02F3AB "LDY #$7ED7; LBSR $85B4": its standing hit box record
local caged_gorilla_hit_wait 02F3AB y box
# done: objects/krustyland_bear.c

# ======== objects/stage_bosses.c ========
# 03C04C "STA #$05,X; CLRW #$0F,X; CLRW #$14,X; STY #$2E,X": A the animation (the D its callers load, "LDD #$8100")
param stage_boss_set_state d animation_number
# 03C04C "STY #$2E,X": the boss's state and that state's wait (fields 2E, 2F: the football player's state and wait)
param stage_boss_set_state y state_wait
# 03C021 "LDB <$50; LSRB; BCC; TST $4A42" and three more "LSRB": the players in play's bits, one shifted out a player
local stage_boss_any_player_down 03C024,03C02D,03C036 b playing_bits
# 03C07B "LBSR $8644; TSTA; BEQ" (vector_floor_ahead_x: the cell ahead in A)
local stage_boss_knock_away 03C07B d floor_cell
# 03C081 / 03C08B "LDD #$0C,X; CMPD #$00E0 ... #$0078": its x on the screen
local stage_boss_knock_away 03C081,03C08B d x_place
# nothing calls it: "t1 = mem_read8(x + 0x1Eu)" (the hit's strength), "mem_read16(x + 0x25u)" (what hit it)
param unused_stage_boss_mark_kind_5_hitter x object object
# 03C0C0 "LDA #$1E,X": the hit it took (FF, the strongest, tells what hit it)
local unused_stage_boss_mark_kind_5_hitter 03C0C0 a hit
# 03C0CB "LDU #$25,X": what hit it (field 25), told by field 42 when it is a kind 05
local unused_stage_boss_mark_kind_5_hitter 03C0CB u hitter object
# 03C0E0 "LDA #$09,U; LDB #$18; BITA #$40": the object 18 pixels in front of which (stage_boss_offset_ahead_of)
param stage_boss_offset_ahead_of u other object
# 03C0E0 "LDA #$09,U": the other object's attributes (bit 6 its facing)
local stage_boss_offset_ahead_of 03C0E0 a other_attributes
# 03C0E3 "LDB #$18" / 03C0E9 "NEGB": 18 pixels ahead, the other way when it faces left
local stage_boss_offset_ahead_of 03C0E3,03C0E9 b offset
# 03C0EA "RTS": D handed back, the offset in B
local stage_boss_offset_ahead_of 03C0EA d offset_ahead
# 03C0EB "LDD #$0D,X; ADDD #$0F,X": its x's low byte and fraction moved by its x speed
local stage_boss_move_on_screen 03C0EB d x_and_fraction
# 03C0FA "CMPD #$0070 ... #$0140": its next x on the screen
local stage_boss_move_on_screen 03C0FA d next_x
# 03C114 "LBSR $863B", 03C11A "LBSR $8644", 03C123 "LBSR $8647" (the floor under it, ahead across, ahead along): the
# floor's cell in A ("BMI": none)
local stage_boss_follow_floor 03C114,03C11A,03C123 d floor_cell
local stage_boss_follow_floor 03C114,03C11A,03C123 a floor_value
# 03C145 "ANDA #$0F; LSLA x3" (as D): the floor's height, eight pixels a step
local stage_boss_follow_floor 03C145 a floor_height_high
local stage_boss_follow_floor 03C145 b floor_height_low
# 03C16C "LDY #$19,X; BEQ": its height speed when it lands (only cleared when not 0)
local stage_boss_settle 03C16C y landing_speed
# 03C17F "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40": a random player's slot, then the next ones in use
local stage_boss_pick_random_player 03C18C u player object
# 03C1A1 "LEAU #$00C0,U; CMPU #$4D40; BNE; LDU #$4A40; TST #$00,U": the player's slot, the next one
param stage_boss_next_player_slot u player object
local stage_boss_next_player_slot 03C1A1,03C1AA u player object
# 03C1B1 "LBSR $8671" (direction_to_offset: B pixels across), 03C1BF "NEGB; ADDB <$F0; STB <$F0": B is the turn's step
param stage_boss_turn_toward d turn_step
local stage_boss_turn_toward 03C1B1,03C1BF b turn
# 03C1DC "LDB <$50" then 03C1FE "LSRB; BCC" for each player: the players in play's bits, one shifted out a player
local stage_boss_find_near_player 03C1E2,03C1EA,03C1F2,03C1FA d playing_bits
# 03C1DF / 03C1E7 / 03C1EF / 03C1F7 "LDU #$4A40" / "#$4B00" / "#$4BC0" / "#$4C80": each player's object
local stage_boss_find_near_player 03C1DF,03C1E7,03C1EF,03C1F7 u player object
# 03C1FE "LSRB; BCC": B, the players in play's bits, the player's shifted out
param stage_boss_player_is_near d playing_bits
local stage_boss_player_is_near 03C1FE,03C20D,03C21D,03C221,03C223 d playing_bits_left
# 03C203-03C209 "LDD #$0C,X; SUBD #$0C,U; ABSD", 03C213-03C219 "LDD #$11,X; SUBD #$11,U; ABSD": how far across and along
local stage_boss_player_is_near 03C206,03C216,03C219 d distance
# 03C225 "LDU #$4A40; LBSR $6240" and the other three players' objects
local stage_boss_any_player_off_floor 03C225,03C22C,03C233,03C23A u player object
# 03C28C "LDB <$57; CMPA B,Y": the boss's health against the limits by the players in play in the table at Y
# 03C289 / 03C294 "LDA #$1B,X": the boss's health
local stage_boss_check_hit 03C289,03C294 a health
# 03C28C "LDB <$57": the players in the game
local stage_boss_check_hit 03C28C b players
# 03C2E5 "LDD ,Y++; STD #$1F,X; LDD ,Y; STD #$21,X; STA #$24,X": the hit box record it copies
# 03C2E5 "LDD ,Y++": the record past its first word (left in Y)
local stage_boss_set_hit_box 03C2E5 y box_rest
# nothing calls it: "mem_read16(x + 0xFu)" (x speed), "mem_read8(x + 9u)" (attributes), "mem_read8(x + 5u)" (animation)
param unused_stage_boss_face_motion x object object
# 03C2F3 "CLRA" / 03C2F9 "LDA #$40": the facing its x speed gives (bit 6, left when moving left)
local unused_stage_boss_face_motion 03C2F3,03C2F9 a facing
# 03C313 "LBSR $8620" (vector_choose_nearest_player) hands back the nearest player in U, handed back again
local stage_boss_face_nearest_player 03C313 u target_player object
# 03C329 "LDB <$61; LSRB; LDB B,Y; LBRA $8617": the table of speeds by rank at Y, the direction in A
param stage_boss_walk_by_rank d direction
# nothing reaches it: "mem_read16(x + 0xFu)", "mem_read16(x + 0x14u)" (its speeds)
param unused_stage_boss_is_still x object object
# 03C340 "LDA <$57; LDA A,Y; LBRA $86BF": the health a gauge piece stands for, by the players in play, at Y; the gauge in B
param stage_boss_set_gauge d gauge_number
# done: objects/stage_bosses.c

# ======== objects/marge_cloud.c ========
# 03D6FD "LDY #$7F62" (bank_1e_states), the handlers by its phase: what each one finds in Y
local marge_cloud 03D6FD y states
# 03D702 marge_cloud_set_state "LDY #$7F7C; LBRA $6059", 03C059 "STB #$2E,X; ASLB; LDD B,Y; STA #$2F,X; STB #$05,X": B
# its new phase (the callers' "LDB #$04; LBSR $7702" ...)
param marge_cloud_set_state d new_phase
# 03D756 "LBSR $863B" (vector_floor_ahead: the cell ahead in A), "INCA; BNE"
local marge_cloud_wander 03D756 d floor_cell
local marge_cloud_wander 03D756 a floor_value
# 03D795 "LDY #$7F9A; LBSR $62E5": the hit box record it takes (stage_boss_set_hit_box)
local marge_cloud_appear 03D795 y box
# 03D84B "LDB #$05": the phase it goes to after its attack (marge_cloud_set_state's B)
local marge_cloud_attack 03D84B b new_phase
local marge_cloud_attack 03D795 y box
# 03D830 "LDY #$7F9E; LBSR $62E5": its attack's hit box record
local marge_cloud_windup 03D830 y box
# 03D86A "LDY #$7FA1; LBSR $6260": the health limits by players stage_boss_check_hit compares with
local marge_cloud_check_hit 03D86A y health_limits
# 03D8A0 "LBSR $617F" (stage_boss_pick_random_player) hands back a player in U
local marge_cloud_leave 03D8A0 u target_player object
# 03D8A3 "LBSR $861D" (vector_direction_to the player): the direction in A
local marge_cloud_leave 03D8A3 d direction
local marge_cloud_leave 03D8A3 a angle
# done: objects/marge_cloud.c

# ======== objects/object_setup.c ========
# 07D15D "CLRD; LBSR $9495" (floor_at_offset, no offsets): the floor's cell under the object in A, 07D161 "STA #$47,X;
# ANDA #$30"
local start_object_from_setup 07D15E d floor_cell
local start_object_from_setup 07D15E a floor_value
# 07D16E "LDD #$19,X; SUBD #$0060; STD #$19,X; BPL", 07D179 "CMPA #$F8": the height speed (D) gravity leaves
param apply_gravity d z_speed
# 07D179 "CMPA #$F8; BCC; LDA #$F8; STA #$19,X": its callers' D is the height speed (07D1B0 "LDA #$19,X")
param cap_fall_and_land d z_speed
# 07D18B "LDD #$16,X; CMPD <$E8": its height against its floor's plus 7
local cap_fall_and_land 07D18B d height
# 07D196 "LDD #$5C,X; STD #$16,X": its floor's height, where it lands (the low byte kept in B)
local cap_fall_and_land 07D196 d floor_z_low
# 07D1B0 "LDA #$19,X; BPL": the height speed's high byte
local land_if_falling 07D1B0 a z_speed_high
# done: objects/object_setup.c

# ======== objects/obstacles.c ========
# 02CC4A "STA $188B" (the steps the floor rises, its callers' "LDA #$02" / "LDA #$04" / 02CBC3 "LDA #$47,X")
param obstacle_raise_floor d raise_steps
# 02C06F "LDU #$7B4C; LDB #$29,X; ASLB; JMP [B,U]": the broken obstacle's step handlers by field 29
local cemetery_obstacle_broken_steps 02C06F u step_handlers
# 02C078 "LDY #$7B52; LBSR $862F": the child object record put in as it breaks
local cemetery_obstacle_break 02C078 y child_record
# 02C0CC "LBSR $85AB": the setup's hit box record handed back in Y
local cemetery_obstacle_start 02C0CC y box
# 02C0FF "LDU #$7B58; LDA #$30,X; ASLA; LDD A,U; STD #$0C,X": cemetery_obstacle_xs, left in U
local cemetery_obstacle_start 02C0FF u x_table
# 02C10F "LDD #$0C,X; CMPD #$0160": its x on the screen (on it from 0160)
local cemetery_obstacle_raise_floor 02C10F d screen_x
# 02C16D "LBSR $85AB": the setup's hit box record handed back in Y
local heavy_obstacle_start 02C16D y box
# 02C17F "LDD #$11,X; SUBD #$0002; STD #$11,X": its y two pixels up (B kept for obstacle_raise_floor)
local heavy_obstacle_start 02C182 d new_y
# 02C1AC "LDU #$7BCC; LDA #$28,X; ASLA; JMP [A,U]": its smashing's handlers by its action (field 28)
local heavy_obstacle_hit_steps 02C1AC u action_handlers
# 02C1C3 "LDY #$7AD8; LBSR $85B4": the smashing hit box record
local obstacle_smash 02C1C3 y box
# 02C1FB "LDY #$7AD0; LBSR $85B4": the thrown hit box record
local timed_throwable_throw 02C1FB y box
# 02C4E3 "CLRD; LBSR $8638" (the cell under it) and 02C50B "LBSR $863B" (the cell ahead): floor_at_offset's offsets in,
# the cell in A out
local carried_obstacle_check_floor 02C4E3,02C50B d floor_cell
local carried_obstacle_check_floor 02C4E3 a floor_value
local carried_obstacle_check_floor 02C50B a value_ahead
# 02C556 "LBSR $85AB": the setup's hit box record handed back in Y
local carried_obstacle_start 02C556 y box
# 02C585 "LDU #$7C97; LDA #$28,X; ASLA; JMP [A,U]": its breaking's handlers by its action (field 28)
local carried_obstacle_break_steps 02C585 u action_handlers
# 02C5A7 "LDU #$7C9B; LDA #$28,X; ASLA; JMP [A,U]": its drop's handlers by its action (field 28)
local carried_obstacle_drop_steps 02C5A7 u action_handlers
# 02C5EB "LDY #$7AA8; LBSR $85B4": its flying hit box record
local carried_obstacle_fly 02C5EB y box
# 02C69B "LDU #$7CB5; LDA #$28,X; ASLA; JMP [A,U]": its stop's handlers by its action (field 28)
local throwable_stop_steps 02C69B u action_handlers
# 02C6C5 "LDU #$7CB9; LBSR $85AB": its setup record
local throwable_start 02C6C5 u setup object_setup
# 02C6C8 "LBSR $85AB": the setup's hit box record handed back in Y
local throwable_start 02C6C8 y box
# 02C701 "LDY #$7AB8; LBSR $85B4": its thrown hit box record
local throwable_throw 02C701 y box
# 02C715 "LDY #$7AC0; LBSR $85B4": its rebounding hit box record
local throwable_rebound 02C715 y box
# 02C734 "CLRD; LBSR $8638; ANDA #$0F; ASLA x3": floor_at_offset's offsets in, the floor's cell under it out (A)
local throwable_rebound 02C734,02C735 d floor_cell
local throwable_rebound 02C735 a floor_value
# 02CB1C "CLRD; LBSR $8638" (the cell under it) and 02CB44 "LBSR $863B" (the cell ahead): the cell in A
local throwable_follow_floor 02CB1C,02CB44 d floor_cell
local throwable_follow_floor 02CB1C a floor_value
local throwable_follow_floor 02CB44 a value_ahead
# 02CB85 "LBSR $85AB": the setup's hit box record handed back in Y
local obstacle_start 02CB85 y box
# 02CBB5 "LDD #$11,X; SUBD #$0002; STD #$11,X": its y two pixels up (B kept for obstacle_raise_floor)
local obstacle_start 02CBB8 d new_y
# 02CBCD "LDU #$7DD3; LDA #$29,X; ASLA; JMP [A,U]": its smashing's step handlers by field 29
local obstacle_smashed_steps 02CBCD u step_handlers
# 02CC00 "LDU #$7DD7; LDA #$28,X; ASLA; JSR [A,U]": its knock's handlers by its action (field 28)
local obstacle_knocked_steps 02CC00 u action_handlers
# 02CC19 "LDY #$7AA0; LBSR $85B4": its knocked hit box record
local obstacle_knocked 02CC19 y box
# 02CC4E "LBSR $8650" (floor_cell_under: its place in U, its value in A): the cell kept (02CC61 "STA #$33,X")
local obstacle_raise_floor 02CC4E d floor_cell
local obstacle_raise_floor 02CC4E a old_cell
# 02CC53 "LDA <$0F; ORA #$02; STA <$0F; STA $1FC2", 02CCBF / 02CCD8 "LDA <$0F; ANDA #$FC": the board control bits
local obstacle_raise_floor 02CC56,02CCC2,02CCDB a control
# 02CCA1-02CCA6 "LDA #$33,X; ANDA #$0F; ADDA $188B; CMPA #$10": the raised cell (its height plus the steps)
local obstacle_raise_floor 02CCA6 a raised_cell
# 02CC75-02CC93 "LDB #$34,X; SUBB #$01; ... ANDB #$3F; LEAU B,U; ... INCB", 02CC9E "LDB <$F5": the floor map's column
local obstacle_raise_floor 02CC78,02CC80,02CC93,02CC9E,02CCB1,02CCB7 b column
# 02CC4E (floor_cell_under's U), 02CC7D / 02CCAE "LDU #$38,X; ANDB #$3F; LEAU B,U": a cell's place in the floor map
local obstacle_raise_floor 02CC4E,02CC82,02CCB3 u floor_place
# 02CCEA "LDA <$0F; ORA #$02" and 02CD1C "LDA <$0F; ANDA #$FC": the board control bits
local obstacle_restore_floor 02CCED,02CD1F a control
# 02CD05 "LDA #$33,X; ... STA ,U": the cell it kept, written back
local obstacle_restore_floor 02CD05 a old_cell
# 02CCFB "LDB #$34,X; SUBB #$01", 02CD0B "ANDB #$3F", 02CD11 "INCB": the floor map's column
local obstacle_restore_floor 02CCFE,02CD0B,02CD11 b column
# 02CD08 "LDU #$38,X; ANDB #$3F; LEAU B,U; STA ,U": a cell's place in the floor map
local obstacle_restore_floor 02CD0D u floor_place
# 02CD3A "LDY #$7A98; LBSR $85B4": its standing hit box record (else Y as it came)
local obstacle_settle 02CD3A y box
# 02CD55 "CLRD; LBSR $8638; ANDA #$0F; ASLA x3; CMPA #$17,X": floor_at_offset's offsets in, the cell under it out (A)
local obstacle_throw 02CD55,02CD56 d floor_cell
local obstacle_throw 02CD56 a floor_value
# 02CD6C "LDY #$7AA0; LBSR $85B4": its thrown hit box record
local obstacle_throw 02CD6C y box
# 02CDC7 "LDY #$7AA0; LBSR $85B4": its hit box record put back out
local obstacle_rebound_rise 02CDC7 y box
# nothing reaches these four: their object in X ("CLR #$3D,X", "INC #$02,X", "STA #$05,X", "LDA #$06,X")
param unused_obstacle_keep_falling x object object
param unused_obstacle_show_animation_80 x object object
param unused_obstacle_vanish_at_animation_end x object object
# 02D55C "LDU #$7F25; LBSR $85AB": its setup record
local bouncing_throwable_start 02D55C u setup object_setup
# 02D55F "LBSR $85AB": the setup's hit box record handed back in Y
local bouncing_throwable_start 02D55F y box
# 02D59B "LDY #$7B30; LBSR $85B4": its thrown hit box record
local bouncing_throwable_throw 02D59B y box
# 02D5E5 "LBSR $85AB": the setup's hit box record handed back in Y
local dreamland_obstacle_start 02D5E5 y box
# 02D5FF "LDD ,U; STA #$05,X" (dreamland_obstacle_drops: animation, wait): the drop's animation, also kept in 30 and 32
local dreamland_obstacle_start 02D5FF a drop_animation
# 02D61A "LDU #$7F67; LDB #$29,X; ASLB; JMP [B,U]": its throw-in's step handlers by field 29
local dreamland_obstacle_drop_steps 02D61A u step_handlers
# done: objects/obstacles.c

# ======== objects/police_car.c ========
# 02B41E "LDU #$7F5D; LDB #$29,X; ASLB; JMP [B,U]": the car's hit steps' handlers by field 29
local police_car_hit_steps 02B41E u step_handlers
# 02B451 "LBSR $85AB": the setup's hit box record handed back in Y
local police_car_start 02B451 y box
# 02C402 "LBSR $85AB": the setup's hit box record handed back in Y
local police_car_door_start 02C402 y box
# 02C463 "LDY A,U" (police_car_door_lists by its spawn's state), 02C465 "LDA ,Y+; CMPA #$7F" (the players it needs),
# 02C474 "LEAY #$08,Y": a release record of the door's list, its child object record after the players byte
local police_car_door_open 02C463,02C465,02C474 y release
# 02C471 "LBSR $862C" (vector_spawn_child) hands back the object it lets out in U
local police_car_door_open 02C471 u released object
# done: objects/police_car.c

# ======== objects/robot_scrap.c ========
# 032910 "LDU #$7AFC; LDA #$28,X; ASLA; JMP [A,U]": the scrap's handlers by its action (field 28)
local robot_scrap_burst 032910 u action_handlers
# 03293A "LDU #$7B00; LBSR $85AB": its setup record
local robot_scrap_setup 03293A u setup object_setup
# 03293D "LBSR $85AB": the setup's hit box record handed back in Y
local robot_scrap_setup 03293D y box
# 032971 "LDY #$7AE0; LBSR $85B4": its thrown hit box record
local robot_scrap_throw 032971 y box
# 03298B "CLRD; LBSR $8638; ANDA #$0F": floor_at_offset's offsets in, the floor's cell under it out (A)
local robot_scrap_drop 03298B,03298C d floor_cell
local robot_scrap_drop 03298C a floor_value
# 0329D4 "CLRD; LBSR $8638; STA <$F0" (the cell under it) and 0329FD "LBSR $863B; STA <$F1" (the cell ahead)
local robot_scrap_keep_on_floor 0329D5,0329FD d floor_cell
local robot_scrap_keep_on_floor 0329D5 a floor_value
local robot_scrap_keep_on_floor 0329FD a value_ahead
# done: objects/robot_scrap.c

# ======== objects/running_animal.c ========
# 02D385 "LDU #$7EF1; LDA #$29,X; ASLA; JMP [A,U]": its hit steps' handlers by field 29
local running_animal_hit_steps 02D385 u step_handlers
# 02D3B9 "LDD #$0A,X; SUBD #$0101; CMPD #$2020; BCS; STD #$0A,X": its zoom (x in A, y in B) a step smaller
local running_animal_knocked_away 02D3BC a smaller_zoom_x
local running_animal_knocked_away 02D3BC d smaller_zoom_y
# 02D3C7 "LBSR $8647; TSTA; BPL" (the cell ahead along y), 02D3CD "CLRD; LBSR $8638; ANDA #$0F" (the cell under it)
local running_animal_knocked_away 02D3C7,02D3CD,02D3CE d floor_cell
local running_animal_knocked_away 02D3C7 a value_ahead
local running_animal_knocked_away 02D3CE a floor_value
# 02D43A "LBSR $85AB": the setup's hit box record handed back in Y
local running_animal_start 02D43A y box
# 02D458 "LDU #$7F05; LDA #$30,X" (running_animal_timings by its spawn's state), left in U
local running_animal_start 02D458 u timing_table
# 02D525 "LDY #$7B20; LBSR $85B4": its thrown hit box record
local running_animal_thrown 02D525 y box
# done: objects/running_animal.c

# ======== objects/scenery_bank_15.c ========
# 02AE47 "LDU #$7D72; LBSR $85AB": its setup record
local moe_spawner_start 02AE47 u setup object_setup
# 02AE4A "LBSR $85AB": the setup's hit box record handed back in Y
local moe_spawner_start 02AE4A y box
# 02AE63 "LDY #$7D78; LBSR $862C": the child object record of what it puts in
local moe_spawner_put_in_object 02AE63 y child_record
# 02AE66 "LBSR $862C" (vector_spawn_child) hands back the object it put in, in U
local moe_spawner_put_in_object 02AE66 u child object
# 02AE76 "LDU #$7D88; LBSR $85AB": its setup record
local burger_eater_start 02AE76 u setup object_setup
# 02AE79 "LBSR $85AB": the setup's hit box record handed back in Y
local burger_eater_start 02AE79 y box
# 02AE8B "LDY #$7D8E; LBSR $862C": the child object record of the food it drops
local burger_eater_drop_food 02AE8B y child_record
# 02AE8E "LBSR $862C; BCC" (vector_spawn_child) hands back the food in U
local burger_eater_drop_food 02AE8E u food object
# 02AEA5 "LDU #$7DA2; LBSR $85AB": its setup record
local drink_vendor_start 02AEA5 u setup object_setup
# 02AEA8 "LBSR $85AB": the setup's hit box record handed back in Y
local drink_vendor_start 02AEA8 y box
# 02AED7 "LDY #$7DA8; LBSR $862C": the child object record of what it lets out
local drink_vendor_let_out 02AED7 y child_record
# 02AEDA "LBSR $862C; BCC" hands back the child in U (drink_vendor_wait_child's child, 02AF0C "LDU #$40,X")
local drink_vendor_let_out 02AEDA u child object.throwable
# 02AF9B "LDD ,Y; BMI; STB #$3B,X; ... CMPA <$57": the players a release needs (A), its frames (B)
local krustyland_door_open 02AF9B a players_needed
# 02AFB0 "LBSR $862C" (vector_spawn_child by the release's child object record) hands back what it lets out in U
local krustyland_door_open 02AFB0 u released_child object
# 02B00D "LDY #$7E0B; LBSR $862C": the child object record it puts in
local caged_gorilla_leaper_start 02B00D y child_record
# 02B0B2 "LBSR $85AB": the setup's hit box record handed back in Y
local prop_start 02B0B2 y box
# 02B0EB "LDU #$7E57; LBSR $85AB": its setup record
local poster_start 02B0EB u setup object_setup
# 02B0EE "LBSR $85AB": the setup's hit box record handed back in Y
local poster_start 02B0EE y box
# 02B108 "LBSR $85AB" (the setup's hit box record) and 02B11D "LDY #$7E67; LBRA $862C" (the child object record of its
# pair): one variable, the record left in Y
local poster_pair_start 02B108,02B11D y record
# 02B146 "LDU #$7E79; LBSR $85AB": its setup record
local bleeding_gums_murphy_start 02B146 u setup object_setup
# 02B149 "LBSR $85AB": the setup's hit box record handed back in Y
local bleeding_gums_murphy_start 02B149 y box
# 02B214 "LBSR $85AB": the setup's hit box record handed back in Y
local cemetery_piece_start 02B214 y box
# done: objects/scenery_bank_15.c

# ======== objects/scenery_bank_17.c ========
# 02F75F "LBSR $85AB": the setup's hit box record handed back in Y
local random_pose_figure_start 02F75F y box
# 02F7B6 "LDU #$7FD5; LBSR $85AB": its setup record
local unused_homer_object_start 02F7B6 u setup object_setup
# 02F7B9 "LBSR $85AB": the setup's hit box record handed back in Y
local unused_homer_object_start 02F7B9 y box
# done: objects/scenery_bank_17.c

# ======== objects/scripted_object.c ========
# 03DB61 "LDD #$0C,X; CMPD #$01A0 ... #$0020": its x on the screen (removed past either side)
local scripted_object 03DB61 a x_high
local scripted_object 03DB61 b x_low
# 03DBAB "LDA #$3D,X; BEQ; ORA #$00,X; STA #$00,X": its zoom flags, put into its flags
local scripted_object 03DBAB a zoom_bits
# 03DBB6 "LDA #$3E,X; ADDA #$0A,X; STA #$0A,X; STA #$0B,X": its zoom, one zoom step on
local scripted_object 03DBB9 a zoom
# 03DBC2 "LBSR $863B; CLRB; TSTA; BMI" (vector_floor_ahead): the floor's cell ahead in A
local scripted_object 03DBC2 d floor_cell
local scripted_object 03DBC2 a floor_value
# 03DBC5 "CLRB" / 03DBCE "TFR A,B" then 03DBD0 "SEX; STD #$5C,X": the floor's height (0 where there is none)
local scripted_object 03DBC5,03DBCE b floor_height
# 03DBD4 "LDD #$42,X; BEQ; CMPD #$0C,X": the x it waits for (wait_x)
local scripted_object 03DBD4 a wait_x_high
local scripted_object 03DBD4 b wait_x_low
# 03DBE3 "LDB #$3C,X; BMI": the floor height it waits to land on (landing_floor; negative: none)
local scripted_object 03DBE3 b landing_height
# 03DBE8 "LDU #$19,X; CMPU #$0000; BGT": its height speed, still rising while above 0
local scripted_object 03DBE8 u rise_speed
# 03DBF0 "SEX; CMPD #$16,X; BLT; STD #$16,X": that landing height as a word, its new height
local scripted_object 03DBF0 a landing_z_high
local scripted_object 03DBF0 b landing_z_low
# 03DC18 "LDY #$32,X", 03DC1B "LDA ,Y+; ASLA; LDU #$7FAA; JMP [A,U]": the script's cursor, the next command's byte,
# and the commands' handlers (each command ends in the same three instructions, 03DC28 "LBRA $7C1B")
local scripted_object 03DC1B,03DC21 y script_cursor
local scripted_object 03DC1E,03DC21 u command_handlers
# the commands: each reads its operands at the cursor ("LDA ,Y+", "LDD ,Y++") and runs the next command
local scripted_object_set_attributes 03DC1B,03DC21,03DC23 y script_cursor
local scripted_object_set_attributes 03DC1E,03DC21 u command_handlers
local scripted_object_set_kind 03DC1B,03DC21,03DC38 y script_cursor
local scripted_object_set_kind 03DC1E,03DC21 u command_handlers
local scripted_object_set_animation 03DC1B,03DC21,03DC40 y script_cursor
local scripted_object_set_animation 03DC1E,03DC21 u command_handlers
local scripted_object_set_place 03DC1B,03DC21,03DC55 y script_cursor
local scripted_object_set_place 03DC1E,03DC21 u command_handlers
local scripted_object_set_speeds 03DC1B,03DC21,03DC67 y script_cursor
local scripted_object_set_speeds 03DC1E,03DC21 u command_handlers
local scripted_object_set_accelerations 03DC1B,03DC21,03DC79 y script_cursor
local scripted_object_set_accelerations 03DC1E,03DC21 u command_handlers
local scripted_object_toggle_airborne 03DC1B,03DC21 y script_cursor
local scripted_object_toggle_airborne 03DC1E,03DC21 u command_handlers
local scripted_object_set_shadow 03DC1B,03DC21,03DC8C y script_cursor
local scripted_object_set_shadow 03DC1E,03DC21 u command_handlers
local scripted_object_play_sound 03DC1B,03DC21,03DC9D,03DCA9 y script_cursor
local scripted_object_play_sound 03DC1E,03DC21 u command_handlers
local scripted_object_set_zoom 03DC1B,03DC21,03DCAE y script_cursor
local scripted_object_set_zoom 03DC1E,03DC21 u command_handlers
local scripted_object_set_zoom_step 03DC1B,03DC21,03DCC1 y script_cursor
local scripted_object_set_zoom_step 03DC1E,03DC21 u command_handlers
local scripted_object_stop 03DC1B,03DC21 y script_cursor
local scripted_object_stop 03DC1E,03DC21 u command_handlers
# 03DC9D "LDD ,Y++; TST #$30,X; BMI; PUSHS Y; LBSR $8680": the sound command (A the sound, B its argument)
local scripted_object_play_sound 03DC9D a sound
local scripted_object_play_sound 03DC9D d sound_argument
# 03DCAE "LDA ,Y+; STA #$0A,X; STA #$0B,X": its zoom
local scripted_object_set_zoom 03DCAE a zoom
# done: objects/scripted_object.c

# ======== objects/shaking_scenery.c ========
# 02D098 "LDU #$7E15; LBSR $85AB": its setup record
local shaken_bit_start 02D098 u setup object_setup
# 02D09B "LBSR $85AB": the setup's hit box record handed back in Y
local shaken_bit_start 02D09B y box
# 02D0E5 "LDU #$7E23; LBSR $85AB": its setup record
local shaken_object_start 02D0E5 u setup object_setup
# 02D0E8 "LBSR $85AB": the setup's hit box record handed back in Y
local shaken_object_start 02D0E8 y box
# 02D135 "CLRD; LBSR $8638; TSTA; BMI": floor_at_offset's offsets in, the floor's cell under it out (A)
local shaken_object_land 02D135,02D136 d floor_cell
# 02D142 "LDY #$7E29; LBRA $862F": the child object record of the buzzing chaser it lets out
local shaken_object_land 02D142 y child_record
# 02D145 "LBRA $862F" (spawn_list_2_child) hands back the chaser in U
local shaken_object_land 02D145 u chaser object
# 02D183 "LDU #$7EAD; LBSR $85AB": its setup record
local shaking_scenery_start 02D183 u setup object_setup
# 02D186 "LBSR $85AB" (the setup's hit box record), 02D1A5 "LDY #$7E85" and 02D1AF "LDY #$7E8D" (child object records,
# "LBSR $862C"): one variable, the record left in Y
local shaking_scenery_start 02D186,02D1A5,02D1AF y record
# 02D189 "LDA #$30,X; BPL" (its spawn's state), 02D1AB "LDA #$00" / 02D1B5 "LDA #$02", then 02D1C9 "LDU #$7E39; LDB A,U;
# STB #$47,X; LDU #$7E3F; ASLA; ASLA; LEAU A,U": which of the scenery's variants (object_16_flags, object_16_kinds)
local shaking_scenery_start 02D189,02D1AB,02D1B5 a variant
# 02D1DD "LDD #$02,U; STA #$04,X": the variant's kind (A) and starting animation (B)
local shaking_scenery_start 02D1DD b start_animation
# 02D21B "LBSR $8650" (floor_cell_under: the place in U, the value in A), 02D22E "STA #$33,X": the cell kept
local scenery_block_floor 02D21B d floor_cell
local scenery_block_floor 02D21B a old_cell
# 02D220 "LDA <$0F; ORA #$02; STA <$0F; STA $1FC2", 02D25D "LDA <$0F; ANDA #$FC": the board control bits
local scenery_block_floor 02D223,02D260 a control
# 02D24A "LDA #$FF; ... STA ,U": the cell written, no floor
local scenery_block_floor 02D24A a no_floor
# 02D245 "LDB #$34,X; SUBB #$02", 02D24F "ANDB #$3F", 02D255 "INCB": the floor map's column
local scenery_block_floor 02D248,02D24F,02D255 b column
# 02D24C "LDU #$38,X; ANDB #$3F; LEAU B,U; STA ,U": a cell's place in the floor map (handed back)
local scenery_block_floor 02D251 u floor_place
# 02D26C "LDU #$7EB3; LDB #$29,X; ASLB; JMP [B,U]": its shake's step handlers by field 29
local shaking_scenery_shake_steps 02D26C u step_handlers
# 02D2DA "LDU #$7EBD; LDA #$28,X; ASLA; JMP [A,U]": the handlers by its action (field 28)
local shaking_scenery_hit_from_above_steps 02D2DA u action_handlers
# 02D2F9 "LDY #$7EC1" / 02D2FF "LDY #$7EC9" then "LBRA $862C": the child object record of the bit it drops
local shaking_scenery_drop_bit 02D2F9,02D2FF y child_record
# 02D2FC / 02D302 "LBRA $862C" (vector_spawn_child) hands back the bit in U
local shaking_scenery_drop_bit 02D2FC,02D302 u dropped_bit object
# 02D305 "LDU #$7ED1; LDA #$28,X; ASLA; JMP [A,U]": the handlers by its action (field 28)
local shaking_scenery_hit_steps 02D305 u action_handlers
# 02D311 "LBSR $862C; BCC" hands back the food in U, 02D33A "STA #$30,U"
local shaking_scenery_drop_food 02D311 u food object
# 02D326 "LDB A,Y; STB <$F0; LSRB; LSRB; CMPB <$57": the pattern's byte for this food (the players it needs in bits 2-7)
local shaking_scenery_drop_food 02D326 b pattern_byte
# 02D332 "LDA <$F0" / 02D337 "LDA #$47,X" then 02D33A "STA #$30,U": the food's spawn state (field 30)
local shaking_scenery_drop_food 02D332,02D337 a food_parameter
# done: objects/shaking_scenery.c

# ======== objects/speech_balloon.c ========
# 0219F9 "LDU #$29,X; LDD #$0C,U": its speaker (field 29)
local speech_balloon_start 0219F9 u speaker object
# 021A1C "LDU #$29,X; DEC #$28,X": its speaker (field 29)
local speech_balloon_follow 021A1C u speaker object
# done: objects/speech_balloon.c

# ======== objects/spawning.c ========
# 07CA50 "ANDB #$0C; LSRB; LSRB" then take_free_object: B the spawn's flags (07C9EC "LDB #$04,X"), bits 2-3 its list
param take_free_object_for_spawn d spawn_flags
# 07CA53 "LSRB" falls into take_free_object, which hands back the free object in U
param take_free_object_for_spawn u slot object
local take_free_object_for_spawn 07CA53 u slot object
# 07CA54 "LDU #$EFF4; LDA B,U; ASLB; LDU #$EFF8; LDU B,U": B the object list (0 enemies, 1, 2 child objects, 3 the
# stage's event): 07CA8A "LDB #$05,Y" (a child object record's list), 07CA9E "LDB #$02"
param take_free_object d list_number
# 07CA54 (B as it comes): the list, its index in object_list_sizes and object_lists
local take_free_object 07CA54 b list_index
# 07CA57 "LDA B,U" (object_list_sizes), 07CA85 "DECA; BNE": the slots left to look at
local take_free_object 07CA57,07CA85 a slots_left
# 07CA6C "CLRD; TFR U,X; LDU #$0030; BSETW D,X,U": the zero word the object is cleared with
local take_free_object 07CA6C a fill
local take_free_object 07CA6C b fill
# 07CA6D "TFR U,X": the place being cleared, a word at a time
local take_free_object 07CA6D,07CA72 x clear_place
# 07CA6F "LDU #$0030": the words left to clear (the object's 0x60 bytes)
local take_free_object 07CA6F,07CA72 u words_left
# 07CA75 "LDD <$E8; STD #$59,U": the object's sprite RAM place, kept over the clearing
local take_free_object 07CA75 a sprite_place_high
# 07C985-07C98C "LDU #$EFD4; CLRA; LDB <$61; LDB B,U; ASLDI #$01; STD $1886": the enemies' speed by the rank
local spawn_stage_objects 07C98C b enemy_speed
# 07C9EC "LDB #$04,X; LBSR $CA50": the spawn's flags
local spawn_stage_objects 07C9EF d spawn_flags
# 07C9EF "LBSR $CA50; LBCC": the free object the spawn goes into (07C9F6 on: "STA #$01,U", "STD #$0C,U"...)
local spawn_stage_objects 07C9EF u spawned object
# 07CA34 "CLRA; LDB #$03,X; STD #$16,U" (and 5C): the spawn's height, its z and floor height
local spawn_stage_objects 07CA35 b spawn_height
# 07CA8D "LBSR $CA54; BCC" (take_free_object) hands back the child in U, 07CA95 "STA #$30,U; STB #$01,U"
local spawn_child_object 07CA8D u child object
# 07CA92 "LDD #$06,Y; STA #$30,U; STB #$01,U": the record's state (A) and type (B)
local spawn_child_object 07CA92 b child_type
# 07CADB-07CAE2 "CLRA; LDB #$04,Y; ADDD #$16,X; STD #$16,U": the child's height, the parent's plus the record's
local place_child_object 07CADF a child_z_high
local place_child_object 07CADF b child_z_low
# 07CB1E "STA $1885" then 07CB29 "JMP [B,U]" by the scene: A the most enemies the stage holds
param hold_scroll_over_enemy_limit d enemy_limit
param compare_enemy_limit d enemy_limit
# 07CB02 "LDA A,U" (cemetery_enemy_limits_by_players) / 07CB1A "ADDA $1885" (by the difficulty, plus the scene's)
local check_enemy_limit 07CB02,07CB1A a limit
# 07CB2B "CLRB; CMPA $1876; BCC; DECB; STB <$A7": FF while there are more enemies than the limit, else 0
local hold_scroll_over_enemy_limit 07CB2B,07CB32 b held
# done: objects/spawning.c

# ======== objects/stage_3_boss.c ========
# 03D1BA "LDY #$7EDC; JMP [A,Y]": the boss's state table, which the dispatcher jumps through by field 2E and hands
# each state's handler (as objects_a names bear's and football_player's: states)
local stage_3_boss 03D1BA y states
# 03D1C5 "LDY #$7F08; LBSR $862C": the child object record of its partner (put in by the first)
local stage_3_boss_start 03D1C5 y child_record
# 03D230 "LDY $1852; LDA #$01; STA #$2A,Y": the story's object kept in 1852, told the boss arrived
local stage_3_boss_enter 03D230 y marker object
# 03D26E "LDY #$7F10; LBSR $862F" (spawn_list_2_child) hands back the child in U
local stage_3_boss_arrive 03D271 u child object
# 03D295 "LDY #$7F16; LBSR $76C9": the first of its hit box records (stage_3_boss_set_hit_box picks one on from it)
local stage_3_boss_pick_target 03D295 y boxes
# 03D2B5 "LBSR $861D; STA #$32,X" (vector_direction_to its target): the direction in A
local stage_3_boss_pick_target 03D2B5 d direction
# 03D2C6-03D2D4 "TFR X,Y; LEAY #$0C,Y; LDX #$41,X; LEAX #$0C,X; LDU #$000F; BMOVE Y,X,U": its place and speeds copied
# onto the partner it carries (fifteen bytes from field 0C)
local stage_3_boss_together 03D2CE,03D2D4 x partner_place
local stage_3_boss_together 03D2D1,03D2D4 u bytes_left
# 03D2D7 "LDU #$34,X": its chase target
local stage_3_boss_together 03D2D7 u target object
# 03D2DA-03D2EE "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$004A" and "LDD #$11,X; SUBD #$11,U; ABSD; CMPD #$0012": how far
# its target is across and along
local stage_3_boss_together 03D2DD,03D2EA d distance
# 03D30E "LDU #$34,X": its chase target, handed to stage_3_boss_attack_or_wait / stage_3_boss_move
local stage_3_boss_walk 03D30E u target object
# 03D311-03D327 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$003A" and the same along: how far its target is
local stage_3_boss_walk 03D314,03D320 d distance
# 03D333 "LDY #$7F22; LBSR $76C9": the first of its attack's hit box records
local stage_3_boss_attack_or_wait 03D333 y boxes
# its callers hand it their target in U (03D30E / 03D2D7 "LDU #$34,X"), whose x it faces ("mem_read16(u + 0xCu)")
param stage_3_boss_attack_or_wait u target object
# 03D380 "LDA #$09,X; ANDA #$40": the way it faces (bit 6)
local stage_3_boss_move 03D383 a facing
# 03D3C3 "LBSR $61B1" (stage_boss_turn_toward the object in U)
param stage_3_boss_move u target object
# 03D3C6 "LDA <$F0; STA #$32,X; LBSR $76DC": the direction it turned to, for its walking speed
local stage_3_boss_move 03D3CC d direction
# 03D440 "LDY #$0011" / 03D445 "LDY #$0401" / 03D44A "LDY #$0801" then 03D44D "LBSR $62CE" (stage_boss_attack_frame's
# damage and strength in Y)
param stage_3_boss_strike_frames y damage
local stage_3_boss_push 03D440 y damage
local stage_3_boss_follow_up 03D445 y damage
local stage_3_boss_strike 03D44A y damage
# 03D4E0 "LDY #$143C; STY #$2E,X": its next state and wait
local stage_3_boss_down 03D4E0 y state_wait
# 03D576 "LDX #$41,X; LDB #$80; STB #$00,X", 03D5C5 "LDX #$41,X; STU #$0C,X": its partner (field 41), set going too
# 03D615 "LDU #$41,X; LDD #$0C,X; SUBD #$000A; CMPD #$0C,U": its partner
local stage_3_boss_reach_partner 03D615 u partner object
# 03D618-03D63C: its x less 10 (and plus 10) and its y less 10 (and plus 10), the box the partner has to be in
local stage_3_boss_reach_partner 03D61B d low_x
local stage_3_boss_reach_partner 03D62E d low_y
local stage_3_boss_reach_partner 03D636 d high_y
# 03D663 "LDX #$41,X; LDD #$0700; STD #$19,X": the partner, sent jumping onto it
local stage_3_boss_reach_partner 03D663 x partner object
# 03D63F "LDU #$41,X; LBSR $861D": its partner
local stage_3_boss_head_to_partner 03D63F u partner object
# 03D642 "LBSR $861D; LBSR $76DC": the direction to its partner, for its walking speed
local stage_3_boss_head_to_partner 03D642 d direction
# 03D64D "LDY #$0F,X; BPL; ORA #$40": its x speed, facing left when negative
local stage_3_boss_head_to_partner 03D64D y speed_x
# 03D682 "LDU #$41,X; LDY #$0D00; STY #$2E,U": its partner, made the carried one
# 03D6A6 "LDY #$7F2E; LBSR $62E5": the shared hit box record
local stage_3_boss_join 03D6A6 y boxes
# 03D6AF "LDU #$41,X; LDA #$01,U; CMPA #$3E": its partner
# 03D6C9 stage_3_boss_set_hit_box: "LEAY #$04,Y" past the first record for the first boss (and again carrying)
param stage_3_boss_set_hit_box y boxes
# 03D6DC "TST #$30,X; BEQ" then "LDY #$7F52" / "LDY #$7F42; LBRA $6329" (stage_boss_walk_by_rank: A the direction)
param stage_3_boss_walk_speed d direction
local stage_3_boss_walk_speed 03D6E1,03D6E7 y speeds_by_rank
# done: objects/stage_3_boss.c

# ======== objects/stage_4_figures.c ========
# 0312F8 "LDU #$7F2A; LBSR $85AB": its setup record
local walking_kind_87_setup 0312F8 u setup object_setup
# 0312FB "LBSR $85AB": the setup's hit box record handed back in Y
local walking_kind_87_setup 0312FB y box
# 03138C "LDU #$7F44; LBSR $85AB": its setup record
local moe_setup 03138C u setup object_setup
# 03138F "LBSR $85AB": the setup's hit box record handed back in Y
local moe_setup 03138F y box
# 03149B "LDD #$0C,X; CMPD #$00E0": its x (A high byte, B low)
local moe_pace 03149B a x_high
local moe_pace 03149B d x_low
# 0314E5 "LBSR $85AB": the setup's hit box record handed back in Y
local belly_dancer_watcher_setup 0314E5 y box
# 03159F "LBSR $85AB": the setup's hit box record handed back in Y
local barney_bystander_setup 03159F y box
# 03160B "LBSR $85AB": the setup's hit box record handed back in Y
local woman_in_green_carrier_setup 03160B y box
# 03161B "LDY #$7F98; LBSR $862C": the child object record of what it picks up
local woman_in_green_carrier_pick_up 03161B y child_record
# done: objects/stage_4_figures.c

# ======== objects/stage_7_boss_helper.c ========
# 02317B "LDU #$7B01; LDA #$28,X; ASLA; JMP [A,U]": the handlers by its action (field 28)
local stage_7_boss_helper_move 02317B u action_handlers
# 023184 "LDU #$7B09; LDA #$02,X; DECA; ASLA; LDD A,U; STD #$0F,X": stage_7_boss_helper_speeds, left in U
local stage_7_boss_helper_start_move 023184 u speed_table
# 0231CC "LDU #$7B05; LDA #$28,X; ASLA; JMP [A,U]": the handlers by its action (field 28)
local stage_7_boss_helper_attack 0231CC u action_handlers
# done: objects/stage_7_boss_helper.c

# ======== objects/unused_objects.c ========
# 02E0ED "LBSR $85AB": the setup's hit box record handed back in Y
local unused_kind_b7_start 02E0ED y box
# nothing calls it: its object in X (handed to the obstacle's steps, "object_take_special_hit(x, 0u)") and its state in
# B (02E1A9 "ASLB; JMP [B,U]")
param unused_obstacle_update x object object
param unused_obstacle_update d state
# reached only from unused_obstacle_update: the object in X ("mem_read8(x + 0x29u)", "mem_write8(x + 5u, 0x80u)", "mem_read8(x +
# 6u)", "vector_object_setup(x, setup)")
param unused_obstacle_break_steps x object object
param unused_obstacle_break x object object
param unused_obstacle_break_end x object object
param unused_obstacle_start x object object
# done: objects/unused_objects.c

# ======== objects/wrestler.c ========
# 021766 "PUSHS U; LDU #$7E79; ASLA; LDD A,U; ORB #$80; STD #$04,X": A the number of the animation in wrestler_animations
# its callers ask for ("LDA #$06; LBSR $7766"), bit 7 shifted out to the carry
param wrestler_set_animation d animation_number
# 02176C "LDD A,U" / 02176E "ORB #$80; STD #$04,X": the animation's kind (A) and animation, started again (B)
local wrestler_set_animation 02176C a new_kind
local wrestler_set_animation 02176E b new_animation
local wrestler_set_animation 021773 d kind_and_animation
# 021775 "LDU #$7E99; ASLA; ASLA; ASLA; LEAU A,U": A the number of the hit box in wrestler_hit_boxes ("CLRA; LBSR $7775")
param wrestler_set_hit_box d box_number
# 02178F "LDD ,U++": the record's end, left in U
local wrestler_set_hit_box 02178F u box_end
# the wrestler's dispatchers by its action (field 28): "LDU #$7Exx; LDA #$28,X; ASLA; JMP [A,U]" (021315 "LDU
# #$7E3F", 02137C "#$7E43", 0213CA "#$7E49", 0213EA "#$7E4D", 02158F "#$7E5D", 0215E3 "#$7E63", 021605
# "#$7E65", 02168C "#$7E6D"): the table, left in U for the handlers, and the action it switches on
local wrestler_beaten 021315 u action_handlers
local wrestler_beaten 021318 a action_index
local wrestler_knocked_down 02137C u action_handlers
local wrestler_knocked_down 02137F a action_index
local wrestler_flinch 0213CA u action_handlers
local wrestler_flinch 0213CD a action_index
local wrestler_entrance 0213EA u action_handlers
local wrestler_entrance 0213ED a action_index
local wrestler_punch 02158F u action_handlers
local wrestler_punch 021592 a action_index
local wrestler_guard 0215E3 u action_handlers
local wrestler_guard 0215E6 a action_index
local wrestler_jump 021605 u action_handlers
local wrestler_jump 021608 a action_index
local wrestler_idle 02168C u action_handlers
local wrestler_idle 02168F a action_index
# 021340 "LDA <$16; ANDA #$01; RORA; RORA": the frame count's bit 0, the blink
local wrestler_blink_out 021343 a frame_bit
# 021328 "LDD #$0020; LBSR $8677": the palette effect asked for (<$7E = 2)
local wrestler_beaten_wait 021328 d palette_effect_number
# 021437 "LDB #$02; LBSR $867D": the list find_free_slot takes its partner from
local wrestler_put_in 021439 d slot_list
# 021473 "LDD #$0016" / 02147E "LDD #$0017" then "LBSR $8677": the palette effects asked for
local wrestler_put_in 021476,021481 d palette_effect_number
# 0214C1 "LDD #$000C; LBSR $8677": the palette effect asked for
local wrestler_entrance_pose 0214C1 d palette_effect_number
# 0214FB "LDD #$0021" / 021506 "LDD #$0026" then "LBSR $8677": the palette effects asked for
local wrestler_entrance_land 0214FB,021506 d palette_effect_number
# 0215B2 "CLRA" / 0215BA "LDA #$01" then 0215BC "LBSR $7775": its own hit box, 1 on the punch's attack frames
local wrestler_punch_strike 0215B2,0215BA a own_box
# 0215F1 "CLRA" / 0215F9 "LDA #$02" then 0215FB "LBSR $7775": its own hit box, 2 on the guard's frames
local wrestler_guarding 0215F1,0215F9 a own_box
# 0216C8 "LDY #$2B,Y; LDA #$02,Y; LBPL": its target (field 2B), up again or not
local wrestler_wait_target_up 0216C8 y target_player object
# 0216E4 / 021920 "LDU #$2B,X": its target (field 2B)
local wrestler_approach 0216E4,021920 u target object
# 021936 "LDU #$7EC9", 021968 "LDU #$7ECD", 021976 "LDU #$7EB9" then "LDA A,U": the chance tables (quick attack, guard,
# jump), left in U
local wrestler_approach 021936,021968,021976 u chance_table
# 021976 "LDU #$7EB9; LDA <$61; LSRA; LDA A,U; LDB <$58": the jump's chance by the rank
local wrestler_approach 02197D a jump_chance
# 0219CB "LDD #$FE80" / 0219D0 "LDD #$0180" then 0219D3 "STD #$0F,X": the leap's x speed
local wrestler_approach 0219CB,0219D0 a leap_speed_high
local wrestler_approach 0219CB,0219D0 b leap_speed_low
# 021708 "LBSR $8686" (find_nearest_player: the nearest in U), then 021726 "STA #$2A,X; STU #$2B,X": its new target
param wrestler_pick_target u nearest object
# 02170E "LDY #$2B,X; LDA #$00,Y": its target (field 2B), kept for 40 frames
local wrestler_pick_target 02170E y target_player object
# 02172D "LDU #$2B,X; LDD #$0C,X; CMPD #$0C,U": its target
local wrestler_aim 02172D u target_player object
# 021738 "LDB #$E0" / 02173C "LDB #$20": the offset beside the target it aims at (direction_to_offset's B)
local wrestler_aim 021738,02173C b side_offset
# 02173E "LBSR $8671; STA #$2D,X": the direction to the place beside its target
local wrestler_aim 02173E d aim_direction
# 021744 "LBSR $861D; STA #$2E,X": the direction straight to its target
local wrestler_aim 021744 d direction
# 021795 "LDD #$0D,X; ADDD #$0F,X": its x's low byte and fraction moved by its x speed
local wrestler_keep_in_area 021795 d x_and_fraction
# 0217A8 "LDD <$F1; ADDD <$AD": that place's low byte and fraction plus the camera's
local wrestler_keep_in_area 0217A8 d next_x_and_fraction
# 0217B7 "LDB <$F1; CMPD #$057F ... #$069F": its next place in the stage
local wrestler_keep_in_area 0217B7 d next_stage_x
# 0217C9-0217DF "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$0040" and the same along (#$0004): how far the other is
local wrestler_within_reach 0217CC,0217D8 d distance
# 0218AD "LDD #$0002; LBSR $8677": the palette effect it flashes with
local wrestler_take_hit 0218AD d palette_effect_number
# done: objects/wrestler.c

# ======== objects/stage_7_boss.c ========
# 022E9E "PUSHS U; LDU #$7A55; ... LDD A,U": A the number of the animation in stage_7_boss_animations its callers ask for
# ("LDA #$05; LBSR $6E9E"), bit 7 to the carry
param stage_7_boss_set_animation d animation_number
local stage_7_boss_set_animation 022E9E a animation_index
# 022EAD "LDU #$7A71; ASLA; ASLA; ASLA; LEAU A,U": A the number of the hit box in stage_7_boss_hit_boxes (023044 "CLRA; LBSR $6EAD")
param stage_7_boss_set_hit_box d box_number
# 022EC7 "LDD ,U++": the record's end, left in U
local stage_7_boss_set_hit_box 022EC7 u box_end
# the boss's dispatchers by its action (field 28): 022A70 "LDU #$7A21", 022ACC "#$7A25", 022B1A "#$7A2B", 022B3A "#$7A2F",
# 022CAA "#$7A3D", 022CFE "#$7A43", 022D79 "#$7A47", then "LDA #$28,X; ASLA; JMP [A,U]"
local stage_7_boss_beaten 022A70 u action_handlers
local stage_7_boss_beaten 022A73 a action_index
local stage_7_boss_knocked_down 022ACC u action_handlers
local stage_7_boss_knocked_down 022ACF a action_index
local stage_7_boss_flinch 022B1A u action_handlers
local stage_7_boss_flinch 022B1D a action_index
local stage_7_boss_entrance 022B3A u action_handlers
local stage_7_boss_entrance 022B3D a action_index
local stage_7_boss_attack 022CAA u action_handlers
local stage_7_boss_attack 022CAD a action_index
local stage_7_boss_charge 022CFE u action_handlers
local stage_7_boss_charge 022D01 a action_index
local stage_7_boss_jump_away 022D79 u action_handlers
local stage_7_boss_jump_away 022D7C a action_index
# 022A90 "LDA <$16; ANDA #$01; RORA; RORA": the frame count's bit 0, the blink
local stage_7_boss_blink_out 022A93 a frame_bit
# 022B46 "LDB #$01; LBSR $867D": the list find_free_slot takes each helper from
local stage_7_boss_put_in 022B48 d slot_list
# 022B48 "LBSR $867D" hands back the free object in U: a helper (022B4B "LDA #$80; STA #$00,U")
local stage_7_boss_put_in 022B48 u helper object
# 022BE7 "LDU #$35,X; LDA #$02,U": its first helper
local stage_7_boss_move_helpers 022BE7 u helper object
# 022CD1 "CLRA" / 022CD9 "LDA #$01" then 022CDB "LBSR $6EAD": its own hit box, 1 on the strike's attack frames
local stage_7_boss_strike 022CD1,022CD9 a own_box
# 022DD6 "LDY #$2B,Y; LDA #$02,Y": its target (field 2B)
local stage_7_boss_wait_target_up 022DD6 y target_player object
# 022E3F "LBSR $8686" (find_nearest_player: the nearest in U), 022E61 "STU #$2B,X": its new target
param stage_7_boss_pick_target u nearest object
# 022E46 "LDY #$2B,X; LDA #$00,Y": its target, kept for 40 frames
local stage_7_boss_pick_target 022E46 y target_player object
# 022E65 "LDU #$2B,X; LDD #$0C,X; CMPD #$0C,U": its target
local stage_7_boss_aim 022E65 u target_player object
# 022E70 "LDB #$E0" / 022E74 "LDB #$20": the offset beside its target (direction_to_offset's B)
local stage_7_boss_aim 022E70,022E74 b side_offset
# 022E76 "LBSR $8671; STA #$2D,X": the direction to the place beside its target
local stage_7_boss_aim 022E76 d aim_direction
# 022E7C "LBSR $861D; STA #$2E,X": the direction straight to its target
local stage_7_boss_aim 022E7C d direction
# 0230B3 "LDU #$2B,X; LDA #$02,U; LBMI": its target, down or not
local stage_7_boss_approach 0230B3 u target object
# 02311C "LBSR $8671; STA #$32,X": the direction it charges in (to the place beside the nearest player)
local stage_7_boss_approach 02311C d direction
# 022ECD "LDD #$0D,X; ADDD #$0F,X", 022EE0 "LDD <$F1; ADDD <$AD", 022EEF "LDB <$F1; CMPD": its x moved by its speed, then
# with the camera's, its next place in the stage
local stage_7_boss_keep_in_x 022ECD d x_and_fraction
local stage_7_boss_keep_in_x 022EE0 d next_x_and_fraction
local stage_7_boss_keep_in_x 022EEF d next_stage_x
# 022F22-022F28 "LDA <$B2; ADCA <$F0; LDB <$F1", then "CMPD #$0078 ... #$00C8": its next y from the camera's
local stage_7_boss_keep_in_y 022F25 a next_y_high
local stage_7_boss_keep_in_y 022F28 b next_y_low
# 022F6E "LDB $1880; DECB" (the enemies counted last frame, the boss left out), kept in B round the loop (022F86)
local stage_7_boss_order_throws 022F72,022F86 b other_enemies
# 022F75 "SUBA ,S; BEQ; BMI; STA <$F1": the throws to order, the helpers wanted less the enemies in play
local stage_7_boss_order_throws 022F75 a throws
# 022F91 "PUSHS X,A; ASLA; ADDA #$33; LDX A,X": A the helper's number (its slot from field 33)
param stage_7_boss_order_throw d helper_number
local stage_7_boss_order_throw 022F96 x helper object
# 023038 "LDD #$0028; LBSR $8677": the palette effect it flashes with
local stage_7_boss_take_hit 023038 d palette_effect_number
# done: objects/stage_7_boss.c

# ======== objects/stage_8_boss.c ========
# 03A28F "LDY #$7A00; JMP [A,Y]" (bank_1d_states): the boss's state table, which it jumps through by field 2E and hands
# each state's handler
local stage_8_boss_run 03A28F y states
# 03A271 "LEAY #$38,X; LBSR $695C" (stage_8_boss_next_random on its seed at field 38): the new random word
local stage_8_boss_run 03A274 d random
# 03A7D7 "LDY #$7AD6; JMP [A,Y]": the bomb's state table
local stage_8_boss_bomb_run 03A7D7 y states
# 03A02D "LDB <$50; LSRB; BCC; TST $4A42" and two more "LSRB": the players in play's bits, one shifted out a player
local stage_8_boss_player_down 03A030,03A039,03A042 b playing_bits
# 03A058 "STA #$05,X; CLRW #$0F,X; CLRW #$14,X; STY #$2E,X": A the animation, Y the state and its wait (fields 2E, 2F)
param stage_8_boss_bomb_set_state d animation_number
param stage_8_boss_bomb_set_state y state_wait
# 03A084 "LBSR $863B", 03A08A "LBSR $8644", 03A092 "LBSR $8647" (the floor ahead, ahead across, ahead along): the cell
# in A
local stage_8_boss_move 03A084,03A08A,03A092 d floor_cell
local stage_8_boss_move 03A084,03A08A,03A092 a floor_value
# 03A0AE-03A0B3 "ANDB #$0F; ASLB x3; SEX" (the floor height) and 03A0C4 "LDD #$5C,X" (the floor height kept): the height
# it settles at
local stage_8_boss_move 03A0B3,03A0C4 a floor_height_high
local stage_8_boss_move 03A0B3,03A0C4 b floor_height_low
# 03A0DA "LDY #$19,X; BEQ": its height speed when it lands
local stage_8_boss_move 03A0DA y landing_speed
# 03A0E7-03A0F4 "ANDA #$03; LDB #$C0; MUL; ADDD #$4A40; PUSHS D; PULLS U": a random player slot
local stage_8_boss_pick_player 03A0EF a slot_high
local stage_8_boss_pick_player 03A0EF b slot_low
# 03A108 "RTS": D, the slot it started from
local stage_8_boss_pick_player 03A108 d first_slot
# 03A0F4 "PULLS U" then 03A0F6 "LBSR $6109" up to four times: the player slot, the next one in use
local stage_8_boss_pick_player 03A0F4 u player object
# 03A109 "LEAU #$00C0,U; CMPU #$4D40; BNE; LDU #$4A40; TST #$00,U": the player slot, the next one
param stage_8_boss_next_player u player object
local stage_8_boss_next_player 03A109,03A112 u player object
# 03A12E "LDB <$50" then 03A150 "LSRB; BCC" for each player: the players in play, a bit each
local stage_8_boss_find_close_player 03A134,03A13C,03A144,03A14C d playing_bits
# 03A131 / 03A139 / 03A141 / 03A149 "LDU #$4A40" / "#$4B00" / "#$4BC0" / "#$4C80": each player object
local stage_8_boss_find_close_player 03A131,03A139,03A141,03A149 u player object
# 03A150 "LSRB; BCC": B, the players in play, a bit each, this player shifted out
param stage_8_boss_player_is_close d playing_bits
local stage_8_boss_player_is_close 03A150,03A15F,03A16F,03A173,03A175 d playing_bits_left
# 03A155-03A15B "LDD #$0C,X; SUBD #$0C,U; ABSD", 03A165-03A16B the same along: how far the player is
local stage_8_boss_player_is_close 03A158,03A168,03A16B d distance
# 03A1B2 / 03A1BD "LDA #$1B,X; CMPA B,Y": its health against its limit for the players
local stage_8_boss_take_hit 03A1B2,03A1BD a health
# 03A1B5 "LDB <$57": the players in the game
local stage_8_boss_take_hit 03A1B5 b players
# 03A20E "LDD ,Y++; STD #$1F,X; LDD ,Y; STD #$21,X; STA #$24,X": the hit box record it copies
local stage_8_boss_set_box 03A20E y box_rest
# 03A21C "CLRA; LDY #$0F,X; BPL; LDA #$40; EORA #$09,X": the facing its x speed gives (bit 6)
local stage_8_boss_face_motion 03A21C,03A222 a facing
# 03A23C "LBSR $8620" (vector_choose_nearest_player): the nearest player in U, handed back
local stage_8_boss_face_nearest_player 03A23C u target_player object
# nothing calls them: the same as stage_boss_walk_by_rank ("LDB B,Y" by the rank) and stage_boss_set_gauge (03A269 "LDA
# <$57; LDA A,Y; LBRA $86BF")
param unused_stage_8_boss_set_speed_by_rank d direction
param unused_stage_8_boss_shade_by_players d gauge_number
local unused_stage_8_boss_shade_by_players 03A26E d shade_step_and_row
# 03A29A "LDY #$7A3A; LBRA $6065", 03A065 "STB #$2E,X; ASLB; LDD B,Y; STA #$2F,X; STB #$05,X": B its new phase (its
# callers "LDB #$02; LBRA $629A"); stage_8_boss_state_starts left in Y
param stage_8_boss_start_state d new_phase
local stage_8_boss_start_state 03A29A y state_start_table
# nothing reaches it: "mem_write16(x + 0x38u, 0x1234u)", stage_8_boss_set_on_floor(x)
# 03A338 "LDY #$7A78; LBSR $862F": the child object record of its speech balloon
local stage_8_boss_speak 03A338 y balloon_record
# 03A925 "STA <$F0" (the loop count, 03A936 "DEC <$F0"): A the bombs to throw (03A34D "LDA <$57; ASLA; LBSR $6925")
param stage_8_boss_throw_bombs d bomb_count
# 03A362 "LDY #$7A94; LBSR $620E": its hit box record
local stage_8_boss_opening_throw 03A362 y box
# 03A3AB "LBSR $8620" / 03A3F4 "LBSR $623C": the nearest player, which it walks at or faces
local stage_8_boss_phase_1 03A3AB,03A3F4 u target_player object
# 03A395 / 03A3E0 "LBSR $6991; CMPD #$00C0": its speed (stage_8_boss_speed)
local stage_8_boss_phase_1 03A395,03A3E0 d speed
local stage_8_boss_phase_1 03A395,03A3E0 a speed_high
local stage_8_boss_phase_1 03A395,03A3E0 b speed_low
# 03A3A4 "LDA #$38,X" (its random byte), 03A3AE "LBSR $861D" (the direction to the nearest player), 03A3B3 "ANDA #$FC";
# 03A3B5 "PUSHS A" ... 03A3C1 "LBSR $8617": the direction it walks in
local stage_8_boss_phase_1 03A3A4,03A3AE,03A3B3 a angle
local stage_8_boss_phase_1 03A3AE d direction
# 03A422 "LDA #$06,X; BITA #$02; ... LSRA": its animation flags (bit 1 the throw frame, bit 0 its end)
local stage_8_boss_throw 03A422 a animation_bits
# 03A429-03A431 "LDA <$57; LDY #$7AA9; LDA A,Y; STA <$F0": the bombs it throws, by the players
local stage_8_boss_throw 03A42F a bombs
# 03A449-03A457 "LDY #$7AAD; LDA <$57; CLRB; LDA A,Y; TST <$58; BPL; NEGA": its running speed, either way
local stage_8_boss_phase_2 03A450,03A457 a chosen_speed
# 03A45A "LBSR $863B" (vector_floor_ahead): the cell ahead (its sign turns it round)
local stage_8_boss_phase_2 03A45A d floor_cell
local stage_8_boss_phase_2 03A45A b floor_low
# 03A47B "LBSR $863B; TSTA; BPL": the floor cell ahead
local stage_8_boss_run_around 03A47B d floor_cell
local stage_8_boss_run_around 03A47B a floor_value
# 03A49D-03A4A4 "LDA <$57; ASLA; STA <$F0; LBSR $6925": the bombs it throws, twice the players
local stage_8_boss_run_around 03A4A0 a bombs
# 03A4AF "LBSR $60E7" (stage_8_boss_pick_player): a player in U
local stage_8_boss_run_around 03A4AF u target_player object
# 03A4B2 "LDA #$20; LBSR $8671": the direction to the place beside that player
local stage_8_boss_run_around 03A4B4 d direction
local stage_8_boss_run_around 03A4B4 a angle
# 03A55B "LBSR $60E7" (stage_8_boss_pick_player) then 03A55E "LBSR $861D": the player it jumps at
local stage_8_boss_keep_away 03A55B u target_player object
# 03A537 / 03A55E "LBSR $861D", 03A580 "LBSR $8671": the direction (to its marked player, away from it with 03A53A "ADDA
# #$80"; to the player it jumps or dashes at)
local stage_8_boss_keep_away 03A537,03A55E,03A580 d direction
local stage_8_boss_keep_away 03A537,03A55E,03A580 a angle
# 03A5D6 "LDY #$7A94; LBSR $620E": its hit box record
local stage_8_boss_resume 03A5D6 y box
# 03A5E8 "LDY #$7A98; LBSR $620E": its attack hit box record
local stage_8_boss_attack_wind_up 03A5E8 y box
# 03A5EE "LBSR $623C" (stage_8_boss_face_nearest_player): the nearest player, which it faces
local stage_8_boss_attack_wind_up 03A5EE u target_player object
# 03A632 "LBSR $612E; LBCC" (stage_8_boss_find_close_player): the player close to it in U
local stage_8_boss_check_close_player 03A632 u close_player object
# 03A683 "LDY #$7ABD; LBSR $6189": its health limits by the players (stage_8_boss_take_hit: limits)
local stage_8_boss_take_hits 03A683 y limits
# 03A699 "LDD #$0040" / 03A6A6 "LDD #$0041" then "LBSR $8677": the palette effect it flashes with
local stage_8_boss_take_hits 03A69C,03A6A9 d palette_effect_number
# 03A713 "LDA <$57; CMPB A,Y": the players in the game
local stage_8_boss_reel 03A713 a players
# 03A74B "LDA #$06,X; BITA #$01": its animation flags (bit 0 its end, bit 1 the blast frame)
local stage_8_boss_defeat_blast 03A74B a animation_bits
# 03A7FA "LBSR $60E7; TST #$02,U" (stage_8_boss_pick_player): the player it is thrown at
local stage_8_boss_bomb_throw 03A7FA u target_player object
# 03A802 "LDA <$58" (at random when that player is down) / 03A807 "LBSR $861D" (the direction to the player), then
# 03A80A "ADDA <$F0": the direction it flies in
local stage_8_boss_bomb_throw 03A802,03A807 a angle
local stage_8_boss_bomb_throw 03A807 d direction
# 03A82D-03A844 "SUBD #$0C,U; ABSD; STD <$F8; ... ABSD; ADDD <$F8; ADDD <$F8; STD <$F8": how far the player is
local stage_8_boss_bomb_throw 03A841 a reach_high
local stage_8_boss_bomb_throw 03A841 b reach_low
# 03A847 "ADDD <$F8; STD #$19,X; CMPD #$02C0": the height speed it is thrown with
local stage_8_boss_bomb_throw 03A847 a throw_speed_high
local stage_8_boss_bomb_throw 03A847 b throw_speed_low
# 03A885 "LBSR $863B; INCA": the floor cell ahead
local stage_8_boss_bomb_fly 03A885 d floor_cell
# 03A90A "LDY #$7ADE; LBRA $620E": the blast hit box record
local stage_8_boss_bomb_explode 03A90A y box
# 03A910 "LDA #$06,X": its animation flags (bit 1 the blast frame, bit 0 its end)
local stage_8_boss_bomb_blast 03A910 a animation_bits
# 03A928 "LDY #$7A7E; LBSR $862F" (a bomb) and 03A955 "LDY #$7A8C; LBSR $862C": child object records
local stage_8_boss_throw_bombs 03A928,03A955 y child_record
# 03A92B "LBSR $862F", 03A933 "LBRA $862C", 03A958 "LBSR $862C": the child put in, in U
local stage_8_boss_throw_bombs 03A92B,03A933,03A958 u child object
# 03A940 "LDD #$0C,X; CMPD #$0030 ... #$01A0": its x on the screen
local stage_8_boss_throw_bombs 03A940 d x_place
# 03A95C "LDD ,Y; PUSHS D; ADDD ,Y x3; ADDD ,S++; ADDD #$3711; STD ,Y": the seed word, then the next one (five times
# it plus 3711)
local stage_8_boss_next_random 03A95C d previous
local stage_8_boss_next_random 03A968 d random
# 03A973 / 03A97C "LDA #$09,X; BITA #$40", 03A983 "EORA #$40; STA #$09,X": its attributes, turned
local stage_8_boss_turn_to_motion 03A973,03A97C a old_attributes
# 03A991-03A99B "LDD #$0F,X; ABSD; PUSHS D; LDD #$14,X; ABSD; ADDD ,S++": how fast it moves, both speeds
local stage_8_boss_speed 03A99B d speed
# done: objects/stage_8_boss.c

# ======== parameters and locals: enemies, bosses, players ========
# Names for the
# variables still named after a register. Every line with its evidence above it.
#
# Conventions of this part:
#   box           a hit box record (LDY #$xxxx; LBSR set_hit_box), struct hit_box where the variable is the
#                 function's own (not the register a caller hands over)
#   child_record  a child object's record handed to spawn_child (LDY #$xxxx), struct child_object likewise
#   direction     what direction_to hands back in D; angle its high byte (A), the direction in 256ths of a turn
#   floor_cell    what floor_ahead / floor_ahead_x / floor_ahead_y hand back in D; floor_value its A (the cell's
#                 value: negative, no floor)
#   step_handlers the table of code addresses a dispatcher loads in U (LDU #$xxxx; JMP [B,U]) and leaves there for
#                 the steps it runs
#   step          the step a dispatcher's caller hands in B (the object's action_step, field 29, or its state)
#   step_offset   that step doubled (ASLB), the offset in the dispatcher's table

# ======== bosses/dreamland_boss.c ========
# dreamland_boss_update (bank 1A) hands it the object's state (LDD 1,X: B = field 02) and dreamland_boss_flinch /
# _first_form_hit / _second_form_hit / _third_form_hit their field 45 (034249 "LDB #$45,X; JMP $6077"): the step to run
param dreamland_boss_run_step d step
# 03424E/0344A6/03472A/0349A0 "JMP $6077" after "LDB #$45,X": the routine's step (field 45) run again
local dreamland_boss_flinch 03424E d step
local dreamland_boss_first_form_hit 0344A6 d step
local dreamland_boss_second_form_hit 03472A d step
local dreamland_boss_third_form_hit 0349A0 d step
# 034083/034095 "LDY #$48,X; LBSR $85B4": the boss's own hit box (field 48) set again
local dreamland_boss_beaten 034083 y box hit_box
local dreamland_boss_hit 034095 y box hit_box
# "LDY #$7770 / #$7768 / #$7778; LBSR $85B4" (vector_set_hit_box): the boss's attacking or plain hit box; the
# register goes on to the next step
local dreamland_boss_drop_in 034157 y box
local dreamland_boss_bounce_in 034175 y box
local dreamland_boss_flinch_end 034272 y box
local dreamland_boss_charge_dash 034362 y box
local dreamland_boss_charge_end 034376 y box
local dreamland_boss_second_form_start 03447D y box
local dreamland_boss_second_form_flash_end 034739 y box
local dreamland_boss_second_form_recover 034787 y box
local dreamland_boss_third_form_start 03482E y box
local dreamland_boss_defeat_burst 034D1D y box
local dreamland_boss_next_pose 0345E0 y box hit_box
local dreamland_boss_end_poses 034634 y box hit_box
local dreamland_boss_leap_crouch 034651 y box hit_box
local dreamland_boss_leap_bounce 0346CF y box hit_box
# 0341A2 "LDD #$0A,X; ADDD #$0101; CMPD #$4040": the zoom grown by one in x (A) and y (B)
local dreamland_boss_grow 0341A5 a grown_zoom_x
local dreamland_boss_grow 0341A5 d grown_zoom_y
# 03429E "LBSR $8620" (vector_choose_nearest_player) hands the nearest player in U; 0342B5 "LBSR $861D"
# (vector_direction_to) the direction to it in D
local dreamland_boss_chase_leg 03429E u nearest_player object
local dreamland_boss_chase_leg 0342B5 d direction
local dreamland_boss_chase_leg 0342B5 a angle
# 03430F "LDD #$11,U; SUBD #$11,X": the player's y less the boss's (in line when less than 4)
local dreamland_boss_check_in_line 034312 d dy
# 03438C/034397/0343B0 vector_floor_ahead / _y / _x: the floor cell where the speeds take the boss, A negative where
# there is no floor
local dreamland_boss_bounce_off_edges 03438C,034397,0343B0 d floor_cell
local dreamland_boss_bounce_off_edges 03438C,034397,0343B0 a floor_value
# "LDY #$7812 / #$788C / #$78BC" then spawn_child: the record of the child the boss puts out
local dreamland_boss_second_change_flash 03444F y child_record
local dreamland_boss_spit_ball 034965 y child_record child_object
local dreamland_boss_put_out_chain 034BC0 y child_record child_object
local dreamland_boss_defeat_release 034D4D y child_record
# 03468C/034C0D "LBSR $861D" (vector_direction_to): the direction to the boss's player in D, A the angle
local dreamland_boss_leap_take_off 03468C d direction
local dreamland_boss_leap_take_off 03468C a angle
local dreamland_boss_creep_start 034C0D d direction
local dreamland_boss_creep_start 034C0D a angle
# 034C47 "LDB #$52,X; ASLB; JMP [B,U]" / 034C86 "LDB #$29,X; ASLB; JSR [B,U]": the step doubled, the table's offset
local dreamland_boss_lash 034C4C b step_offset
local dreamland_boss_defeat 034C89 b step_offset
# 034D36 "LDA #$3B,X": the boss's timer, a child let out every 32 frames from 40
local dreamland_boss_defeat_release 034D36 a time_left
# dreamland_boss_lash / _defeat jump to it with B = their step doubled (034C4D "JMP [B,U]"), which it writes in 4806
param dreamland_boss_defeat_vanish d step_offset
# done: bosses/dreamland_boss.c

# ======== bosses/dreamland_boss_objects.c ========
# 034E93 "LBSR $861D" (vector_direction_to): the direction to the ball's player in D; A the angle, kept as its
# target direction, then (034E9E "ASRA" x3) an eighth of the way from its heading
local boss_ball_fly_out 034E93 d direction
local boss_ball_fly_out 034E93,034E9E a angle
# 034EB9 / 034EF9 / 034F64 "LDY #$793C" then spawn_child: the trail's puff
local boss_ball_fly_out 034EB9 y child_record
local boss_ball_home_in 034EF9 y child_record
# boss_ball_land: Y is the trail puff's child record (034F64 "LDY #$793C") or the burst's hit box (034F3E
# "LDY #$7788"), each handed on to spawn_child or set_hit_box
local boss_ball_land 034F3E,034F64 y record
# 034F32 "CLRD; LBSR $8638" (vector_floor_at_offset): no offset in, the floor cell under the ball out (A negative:
# no floor, it bursts)
local boss_ball_land 034F32,034F33 d floor_cell
# 034F83 "LDU #$7948" / 034FA7 "LDU #$7952" then "LBSR object_setup": the puff's and the shadow's set-up records
local boss_ball_trail_setup 034F83 u setup object_setup
local dreamland_boss_shadow_setup 034FA7 u setup object_setup
# 035001 "LDY #$7966; LBSR spawn_child": the chain's record; 035004 the chain put out, in U, whose field 38 (target)
# the holder becomes ("STX #$38,U")
local chain_holder_put_out_chain 035001 y child_record child_object
local chain_holder_put_out_chain 035004 u chain object
# 03501D "LBSR $8620" (vector_choose_nearest_player): the nearest player, whose x (field 0C) it faces
local chain_holder_watch 03501D u nearest_player object
# 03508D "LDY #$002E,X; LDA #$FE; STA #$02,Y": the link before this one (field 2E), sent to its burst (state FE)
local dreamland_boss_chain_pop_next 03508D y link object
# 0350EA "LDB #$02; LBSR find_free_slot": the object list (B) a free slot is taken from
local dreamland_boss_chain_setup 0350EC d list
# 03510C "LDD #$FE00" / 035111 "LDD #$FF02; STD #$01,U": the type and state of the piece made (head FE, link FF 2)
local dreamland_boss_chain_setup 03510C,035111 a piece_type
local dreamland_boss_chain_setup 03510C,035111 b piece_state
# U: the piece taken (find_free_slot, find_free_object_from_4d40, 035109 "LDU <$F2"), then 035160 "LDU #$798E" the
# links' parameters read with "LDA ,U+"
# Y: the piece the new one is tied to (0350F8 "LEAY ,X", 035158 "LEAY ,U"), then the walk down the chain (035170
# "LDY #$2C,Y": each piece's next)
# 035190 "LDD #$3E,X; STA #$35,U; LDA #$37,X; LBSR chain_link_offset": a direction (A) and a distance (B), the
# offset of the next piece
local dreamland_boss_chain_lead 035190,035196 d direction_and_distance
# chain_link_offset: its comment says A is a direction and B a distance (035477 "ANDA #$3F", the quarter's angle;
# 0354B7 "ANDA #$C0", the quarter); 0354A3 "LDB <$EB" swaps the two offsets through B
local chain_link_offset 035472,035477,0354B7 a direction
local chain_link_offset 035472,0354A3 b distance
# 0351F5 "LDD $1888; ADDD #$0010; SUBD/ADDD #$0001": the chain's x offset from its holder, moved a step, kept from
# 00 to 1F before "SUBD #$0010; STD $1888"
local dreamland_boss_chain_shift_offset 0351F8,035208 d offset
# 03532B "LDY #$79F3; STY #$2E,X": the head's idle path, left in Y for its next step (the path it follows)
local dreamland_boss_chain_head_setup 03532B y path
# 035367/035380 "LDD ,Y++": a path record's direction (A, mirrored by 03538F "NEGA" as the holder faces, 035393
# "ADDA #$40") and distance (B, kept at 48F1)
local dreamland_boss_chain_head_follow_path 035367,035380,03538F,035393 a direction
local dreamland_boss_chain_head_follow_path 035367,035380 b distance
# after FFFF: 03537E "LDY ,Y" the path's loop again, or 035379 "LDY #$02,Y" the path after it when the loops are done
local dreamland_boss_chain_head_follow_path 035379,03537E y loop_path
# 0353B2 "LDU #$...; LDA A,U; STA <$F0": the lash chosen from object_1a_path_choices
local dreamland_boss_chain_head_choose_lash 0353B2 a path_choice
# 035455 "TFR U,X; LDU #$0030; BSETW D,X,U": the 48 words of the free object cleared, X running over them
local find_free_object_from_4d40 035455,03545A x cursor
local find_free_object_from_4d40 035457,03545A u words_left
# done: bosses/dreamland_boss_objects.c

# ======== enemies/enemy_states.c ========
# unused_enemy_run_action: X is an object (07D47E "LDU #$38,X" its target, 07D487 "LDD #$28,X" its action)
param unused_enemy_run_action x object object
# 07D487 "LDD #$28,X": the object's action (A), its bank from unused_object_banks; 07D496 "LDU #$F65F" the
# handlers by action; 07D499 "ASLA" the action doubled, their offset (A of D)
local unused_enemy_run_action 07D487 a action
local unused_enemy_run_action 07D496 u action_handlers
local unused_enemy_run_action 07D499 d action_offset
# 07D5D7/07D612 "LDB #$04 ... DECB": the behaviour's choice (4 down to 0) the random number falls on
local enemy_think 07D5D7,07D5E0,07D612,07D61B,07D620 b choice
# 07D62B "LDD #$28,X; LDU #$F586; ASLA; JSR [A,U]": B, the move's step (field 29), handed to the move
local enemy_think 07D633 d step
# 07D64F "LDD #$28,X": the attack (field 28) by which action_banks gives the bank and 07D661 "ASLA" the handler's
# offset; B its step (field 29) handed to the attack; 07D65E "LDU #$F5A2" the attacks' handlers
local enemy_attack 07D64F,07D661 a attack
local enemy_attack 07D662 d step
local enemy_attack 07D65E u attack_handlers
# 07D667 "LDD #$28,X; ... JSR [A,U]": B, the reaction's step (field 29)
local enemy_hit_reaction 07D667 d step
# 07D6B2 "LDU #$F1AE; LDD #$28,X; ASLA; JSR [A,U]": the climbs' handlers (named as the steps' tables, which hand U on to the same step routines) and the climb's step (B, field 29)
local enemy_climb 07D6B2 u step_handlers
local enemy_climb 07D6B5 d step
# done: enemies/enemy_states.c

# ======== enemies/enemy_climbing.c ========
# each climb or hop runs its step (B, field 29, from enemy_climb; "ASLB; JMP [B,U]") through its table of steps
# (LDU #$F1xx); X is the enemy (every step routine takes it as its object)
# 07D6BE "LDU #$F1BE", 07D6C1 "ASLB"
param enemy_climb_up_front x object object
param enemy_climb_up_front d step
local enemy_climb_up_front 07D6BE u step_handlers
local enemy_climb_up_front 07D6C1 b step_offset
# 07D6F7 "LDU #$F1C4", 07D6FA "ASLB"
param enemy_climb_up_back x object object
param enemy_climb_up_back d step
local enemy_climb_up_back 07D6F7 u step_handlers
local enemy_climb_up_back 07D6FA b step_offset
# 07D721 "LDU #$F1CA", 07D724 "ASLB"
param enemy_climb_up_left x object object
param enemy_climb_up_left d step
local enemy_climb_up_left 07D721 u step_handlers
local enemy_climb_up_left 07D724 b step_offset
# 07D74B "LDU #$F1D0", 07D74E "ASLB"
param enemy_climb_up_right x object object
param enemy_climb_up_right d step
local enemy_climb_up_right 07D74B u step_handlers
local enemy_climb_up_right 07D74E b step_offset
# 07D787 "LDU #$F1D6", 07D78A "ASLB"
param enemy_hop_down_front x object object
param enemy_hop_down_front d step
local enemy_hop_down_front 07D787 u step_handlers
local enemy_hop_down_front 07D78A b step_offset
# 07D7A6 "LDU #$F1DC", 07D7A9 "ASLB"
param enemy_hop_down_back x object object
param enemy_hop_down_back d step
local enemy_hop_down_back 07D7A6 u step_handlers
local enemy_hop_down_back 07D7A9 b step_offset
# 07D7C5 "LDU #$F1E2", 07D7C8 "ASLB"
param enemy_hop_down_left x object object
param enemy_hop_down_left d step
local enemy_hop_down_left 07D7C5 u step_handlers
local enemy_hop_down_left 07D7C8 b step_offset
# 07D7CB "LDU #$F1E8", 07D7CE "ASLB"
param enemy_hop_down_right x object object
param enemy_hop_down_right d step
local enemy_hop_down_right 07D7CB u step_handlers
local enemy_hop_down_right 07D7CE b step_offset
# "LDB #$45,X ... LBSR set_climb_speed": the floor level (field 45, in steps of 8 pixels) to climb to, in A
local enemy_climb_up_front_start 07D6D6 d floor_level
local enemy_climb_up_back_start 07D70F d floor_level
local enemy_climb_up_left_start 07D739 d floor_level
local enemy_climb_up_right_start 07D763 d floor_level
# done: enemies/enemy_climbing.c

# ======== enemies/enemy_moves.c ========
# each move runs its step (B, field 29, from enemy_think "LDD #$28,X; JSR [A,U]") through its table of steps
# ("LDU #$F2xx; ASLB; JSR [B,U]"); enemy_wait_while_target_down and enemy_back_off double B in place (07DB74,
# 07DB7D "ASLB")
# 07D7FA "LDU #$F1EE", 07D7FD "ASLB"
param enemy_get_around d step
local enemy_get_around 07D7FA u step_handlers
local enemy_get_around 07D7FD b step_offset
# 07D880 "LDU #$F1F4", 07D883 "ASLB"
param enemy_walk_to_target_side d step
local enemy_walk_to_target_side 07D880 u step_handlers
local enemy_walk_to_target_side 07D883 b step_offset
# 07D8E2 "LDU #$F1F8", 07D8E5 "ASLB"
param enemy_line_up_near_target d step
local enemy_line_up_near_target 07D8E2 u step_handlers
local enemy_line_up_near_target 07D8E5 b step_offset
# 07D994 "LDU #$F1FE", 07D997 "ASLB"
param enemy_walk_to_target d step
local enemy_walk_to_target 07D994 u step_handlers
local enemy_walk_to_target 07D997 b step_offset
# 07DA09 "LDU #$F202", 07DA0C "ASLB"
param enemy_line_up_with_target d step
local enemy_line_up_with_target 07DA09 u step_handlers
local enemy_line_up_with_target 07DA0C b step_offset
# 07DABE "LDU #$F208", 07DAC1 "ASLB"
param enemy_keep_distance d step
local enemy_keep_distance 07DABE u step_handlers
local enemy_keep_distance 07DAC1 b step_offset
# 07DB71 "LDU #$F210"
param enemy_wait_while_target_down d step
local enemy_wait_while_target_down 07DB71 u step_handlers
# 07DB7A "LDU #$F214"
param enemy_back_off d step
local enemy_back_off 07DB7A u step_handlers
# 07DC03 "LDU #$F21A", 07DC06 "ASLB"
param enemy_step_toward_target d step
local enemy_step_toward_target 07DC03 u step_handlers
local enemy_step_toward_target 07DC06 b step_offset
# 07DC3E "LDU #$F21E", 07DC41 "ASLB"
param enemy_circle_target d step
local enemy_circle_target 07DC3E u step_handlers
local enemy_circle_target 07DC41 b step_offset
# 07DC9C "LDU #$F222", 07DC9F "ASLB"
param enemy_wander d step
local enemy_wander 07DC9C u step_handlers
local enemy_wander 07DC9F b step_offset
# 07DD0B "LDU #$F228", 07DD0E "ASLB"
param enemy_rush_at_target d step
local enemy_rush_at_target 07DD0B u step_handlers
local enemy_rush_at_target 07DD0E b step_offset
# 07DD77 "LDU #$F22E", 07DD7A "ASLB"
param enemy_line_up_and_pace d step
local enemy_line_up_and_pace 07DD77 u step_handlers
local enemy_line_up_and_pace 07DD7A b step_offset
# unused_enemy_move_aside: X is an enemy (07D7E3 "LDA #$36,X": its target direction, 07D7FA "STD #$14,X")
local unused_enemy_move_aside 07D7E3,07D7EB,07D7EF a angle
# 07D8C4 "LDB #$50; ... NEGB": 80 pixels to the target's side, the side it faces; then direction_to_beside /
# direction_to hand the direction in D (A the angle) to set_walk_speeds_from_direction
local enemy_walk_to_target_side_step 07D8C4,07D8CD b side_offset
local enemy_walk_to_target_side_step 07D8B3,07D8CE,07D8D1 d direction
local enemy_walk_to_target_side_step 07D89C,07D8CE a angle
# 07D9F5 "LBSR direction_to" or 07D9CF "LDA #$36,X" (target direction): the direction walked
# (07D9F8 "LBSR set_walk_speeds_from_direction")
local enemy_walk_to_target_step 07D9BF,07D9F5,07D9F8 d direction
local enemy_walk_to_target_step 07D9CF,07D9F5 a angle
# 07DAF1 "LDA #$36,X; ADDA #$80" away from the target, or 07DB26 "LDA #$36,X" at it; 07DB29 "LBSR
# set_walk_speeds_from_direction"
local enemy_keep_distance_step 07DAF1,07DB26 a angle
local enemy_keep_distance_step 07DB29 d direction
# 07DB6D "LDA #$36,X; LBSR set_walk_speeds_from_direction": at the target
local enemy_keep_distance_close_in 07DB6D d direction
# 07DC71 "LDA #$36,X; SUBA #$30 / ADDA #$50": the target's direction turned aside, the way field 3D says
local enemy_aim_beside_target 07DC71,07DC79,07DC7D a angle
local enemy_aim_beside_target 07DC7F d direction
# 07DCC4 "LDA #$3E,X; SUBA #$30 / ADDA #$50; STA #$3E,X": the wander's heading turned
local enemy_wander_turn 07DCC4,07DCCC,07DCD0 a angle
local enemy_wander_turn 07DCD5 d direction
# done: enemies/enemy_moves.c

# ======== enemies/enemy_hit_reactions.c ========
# each reaction runs its step (B, field 29, from enemy_hit_reaction "LDD #$28,X; JSR [A,U]") through its table of
# steps ("LDU #$F2xx; ASLB; JSR [B,U]")
# 07DDC3 "LDU #$F248"
param enemy_flinch_from_behind d step
local enemy_flinch_from_behind 07DDC3 u step_handlers
# 07DDF3 "LDU #$F24C"
param enemy_flinch_kind_12 d step
local enemy_flinch_kind_12 07DDF3 u step_handlers
# 07DE0E "LDU #$F250"
param enemy_flinch_kind_11 d step
local enemy_flinch_kind_11 07DE0E u step_handlers
# 07DE29 "LDU #$F254"
param enemy_knocked_forward d step
local enemy_knocked_forward 07DE29 u step_handlers
# 07DEB1 "LDU #$F258"
param enemy_knocked_back d step
local enemy_knocked_back 07DEB1 u step_handlers
# 07DF4C "LDU #$F25E"
param enemy_get_up d step
local enemy_get_up 07DF4C u step_handlers
# 07DF60 "LDU #$F262"
param enemy_die d step
local enemy_die 07DF60 u step_handlers
# 07DF9B "LDU #$F266"
param enemy_drop d step
local enemy_drop 07DF9B u step_handlers
# 07DFB1 "LDU #$F268"
param enemy_sent_flying d step
local enemy_sent_flying 07DFB1 u step_handlers
# 07DDE9 "LDY #$48,X; LBSR set_hit_box": the enemy's own hit box (field 48) set again
local enemy_back_to_thinking_after_animation 07DDE9 y box hit_box
# 07DFFB "LDA #$31,X": the walls met (field 31, blocked): bit 7 one met, bit 3 the one that keeps it
local enemy_sent_flying_step 07DFFB d blocked_flags
# done: enemies/enemy_hit_reactions.c

# ======== enemies/reactions.c ========
# 07E028 "LDU #$F26E; ASLB; JSR [B,U]": the reaction's steps, B its step (field 29)
param enemy_spin_backward d step
local enemy_spin_backward 07E028 u step_handlers
# 07E05E "LDU #$F274; ASLB; JSR [B,U]": the reaction's steps, B its step (field 29)
param enemy_defeated_forward d step
local enemy_defeated_forward 07E05E u step_handlers
# 07E12F "LDU #$F27A; ASLB; JSR [B,U]": the reaction's steps, B its step (field 29)
param enemy_defeated_backward d step
local enemy_defeated_backward 07E12F u step_handlers
# 07E143 "LDU #$F280; ASLB; JSR [B,U]": the reaction's steps, B its step (field 29)
param enemy_pit d step
local enemy_pit 07E143 u step_handlers
# 07E0C7 "CLRD; LBSR $8638" (vector_floor_at_offset): the floor cell under the enemy, A negative where none
local enemy_defeated_fly 07E0C7,07E0C8 d floor_cell
local enemy_defeated_fly 07E0C8 a floor_value
# done: enemies/reactions.c

# ======== enemies/enemy_hits.c ========
# 07D059 "LDU #$F134; LDA #$1E,X; SUBA #$11; ASLA; JSR [A,U]": the hit reactions' starts by the hit's kind (11-14)
local enemy_check_hit 07D059 u reaction_handlers
# 07D118 "LDA #$37,X; ANDA #$7F": the enemy's side of its target (field 37, bit 7 the left one)
local enemy_leave_side 07D118 a side_flags
# 07D115 "LDB #$46,U; ANDB #$BF/#$7F; STB #$46,U": the target's sides taken (its field 46: bit 6 and bit 7)
local enemy_leave_side 07D115,07D122,07D126 b target_sides
# done: enemies/enemy_hits.c

# ======== enemies/enemy_targets.c ========
# 07D31A-07D32E "LDD #$0C,X; SUBD #$0C,U; NEGD; ... SUBD #$11,U; NEGD; ADDD ,S++": the x and depth distances to a
# player added, the one with the least taken
local enemy_target_nearest_player 07D31D,07D322,07D328,07D32D,07D32E d distance
# 07D350 "LDA $189E; ADDA <$58; STA $189E": the frame's random number added to the last one, handed back in A
local enemy_random 07D353 a value
local enemy_random 07D35A d roll
# 07D361 "LDD #$0C,U; SUBD #$0C,X" / 07D37A "LDD #$11,U; SUBD #$11,X": the target's x (then depth) less the enemy's,
# made positive before "STD #$2C,X" / "STD #$2E,X"
local enemy_look_at_target 07D364,07D37D a distance_high
local enemy_look_at_target 07D364,07D37D d distance_low
# U: the behaviour's attack ranges, 12 bytes each (07D3FD "LEAU #$0C,U"): the least depth, the least and most x
# distance, the chance; D handed back: the range's chance in A (07D406 "LDA #$03,U"), none 0
local enemy_find_attack_range 07D404,07D409 d chance
# 07D3F0 "LDB #$2D,X": the x distance to the target (field 2C's low byte, the high one 0)
local enemy_find_attack_range 07D3F0 b x_distance
# done: enemies/enemy_targets.c

# ======== enemies/hurt.c ========
# 07E1FE "LDA #$28,X": the reaction (field 28), an index in the kind's hit animations (U)
local enemy_hurt_start 07E1FE a reaction
# 07E252 / 07E2C5 "LDY #$48,X; LBSR set_hit_box": the enemy's own hit box set again
local enemy_hurt_recover 07E252 y box hit_box
local enemy_hurt_get_up 07E2C5 y box
# done: enemies/hurt.c

# ======== enemies/goon_actions.c ========
# each attack runs its step (B, field 29, which enemy_attack hands over) through its table of steps ("LDU #$7Cxx /
# #$7Exx / #$7Fxx; ASLB; JMP [B,U]"); the step itself comes named from enemy_attack, the only caller
local goon_wait_then_strike 028C61 u step_handlers
local goon_wait_then_strike_2 028CC8 u step_handlers
local goon_quick_strike 028CDF u step_handlers
local goon_quick_strike_2 028D11 u step_handlers
local goon_jump_attack 028D34 u step_handlers
local goon_jump_up_or_grab 028DEA u step_handlers
local bomb_goon_throw 029097 u step_handlers
local shovel_goon_close_strike 0290CC u step_handlers
local goon_grab 028E05 u step_handlers
local goon_keep_distance 028BD7 u step_handlers
local hat_goon_throw_hat 029296 u step_handlers
local umbrella_goon_strike 0291F8 u step_handlers
local umbrella_goon_charge 02921B u step_handlers
local umbrella_goon_long_strike 0291B9 u step_handlers
local shovel_goon_strike 02916E u step_handlers
local shovel_goon_far_strike 029120 u step_handlers
local goon_back_off 028B48 u step_handlers
local goon_strike_and_run 029270 u step_handlers
local umbrella_goon_quick_strike 029196 u step_handlers
local goon_dash_strike 028B7A u step_handlers
local goon_approach_strike 028AF6 u step_handlers
# unused_goon_wait_by_rank / unused_goon_short_wait: X is a goon (fields 3B timer, 05 animation, 29 action step)
param unused_goon_wait_by_rank x object object
param unused_goon_short_wait x object object
# "LDY #$7xxx; LBSR $85B4" (vector_set_hit_box): the goon's strike or plain hit box; the register goes on to the
# next step
local goon_approach_strike_hit 028B2D y box
local goon_dash_strike_hit 028BCD y box
local goon_strike_hit 028CAB y box
local goon_quick_strike_hit 028D07 y box
local goon_quick_strike_2_hit 028D2A y box
local goon_jump_attack_fall 028DB3,028DC5 y box
local shovel_goon_close_hit 029116 y box
local shovel_goon_far_hit 029151 y box
local shovel_goon_hit 02918C y box
local umbrella_goon_quick_hit 0291AF y box
local umbrella_goon_long_hit 0291D2 y box
local umbrella_goon_long_recover 0291E6 y box
local umbrella_goon_hit 029211 y box
local goon_strike_recover 028CB5 y box hit_box
local armed_goon_strike_recover 02915B y box hit_box
local umbrella_goon_charge_hit 029237 y box hit_box
local goon_run_through_end 029266 y box hit_box
local goon_strike_and_run_hit 02928C y box hit_box
# 028C77 "LDU #$7C7A" / 0290E2 "LDU #$7EE5" / 02912B "LDU #$7EF4": the waits before the strike by the players in
# the game
local goon_wait_for_target_on_floor 028C77 u strike_waits
local shovel_goon_wait_for_target 0290E2 u strike_waits
local shovel_goon_far_wait 02912B u strike_waits
# 028D43 "LDU #$7CA3": the chances of a jump attack by the game's rank
local goon_jump_or_run 028D43 u jump_chances
# 028E31 / 028EF5 "LBSR $861D" (vector_direction_to): the direction to the target in D, A the angle walked
local goon_grab_approach 028E31 d direction
local goon_grab_approach 028E31 a angle
local goon_grab_try 028EF5 d direction
# 028ED3 / 028F1A "LDY #$7CD3": the goon's hold animations (goon_hold_animations), left in Y
local goon_grab_try 028ED3 y hold_animations
local goon_grab_hold 028F1A y hold_animations
# 0290B3 "LDY #$7ED5" / 0292AE "LDY #$7F2F" then spawn_child: the bomb's and the hat's records
local bomb_goon_throw_release 0290B3 y child_record
local hat_goon_throw_release 0292AE y child_record
# each attack's entry (0280xx "LBRA") keeps B, the step enemy_attack hands over ("ASLB; JMP [B,U]" after it)
local goon_wait_then_strike 028003 b step
local goon_wait_then_strike_2 028006 b step
local goon_quick_strike 028009 b step
local goon_quick_strike_2 02800C b step
local goon_jump_attack 02800F b step
local goon_jump_up_or_grab 028012 b step
local bomb_goon_throw 028030 b step
local shovel_goon_close_strike 028033 b step
local goon_grab 028042 b step
local goon_keep_distance 02805D b step
local hat_goon_throw_hat 028084 b step
local umbrella_goon_strike 028087 b step
local umbrella_goon_charge 02808A b step
local umbrella_goon_long_strike 02808D b step
local shovel_goon_strike 028090 b step
local shovel_goon_far_strike 028093 b step
local goon_back_off 0280AB b step
local goon_strike_and_run 0280AE b step
local umbrella_goon_quick_strike 0280B4 b step
local goon_dash_strike 0280B7 b step
local goon_approach_strike 0280BA b step
# done: enemies/goon_actions.c

# ======== enemies/goons.c ========
# the goons' type handlers: run_enemies (or run_list_1_objects, for goon_balloon) loads "LDD #$01,X" and hands
# them B, the object's state (field 02), which each copies at its entry (0280xx "LBRA", B kept) and runs
# ("ASLB; JMP [B,U]")
param bomb_goon d state
local bomb_goon 028000 b state
param goon_bomb_run_in d state
local goon_bomb_run_in 028015 b state
param goon_close_grabber d state
local goon_close_grabber 02801B b state
param goon_striker d state
local goon_striker 02801E b state
param goon_from_timed_list d state
local goon_from_timed_list 028021 b state
param goon_descent d state
local goon_descent 028024 b state
param goon_rush_in d state
local goon_rush_in 028027 b state
param goon_from_back d state
local goon_from_back 02802A b state
param hat_goon_step_out d state
local hat_goon_step_out 02802D b state
param goon_jump_in d state
local goon_jump_in 028036 b state
param goon_from_below d state
local goon_from_below 028039 b state
param goon_striker_jump_in d state
local goon_striker_jump_in 02803C b state
param goon_walk_up d state
local goon_walk_up 02803F b state
param goon_walk_in d state
local goon_walk_in 028045 b state
param goon_step_out d state
local goon_step_out 028048 b state
param goon_balloon d state
local goon_balloon 02804B b state
param goon_run_in d state
local goon_run_in 02804E b state
param hat_goon_jump_in d state
local hat_goon_jump_in 028051 b state
param hat_goon_waiting d state
local hat_goon_waiting 028054 b state
param goon_delayed d state
local goon_delayed 028057 b state
param goon_drop d state
local goon_drop 02805A b state
param cemetery_umbrella_goon d state
local cemetery_umbrella_goon 028060 b state
param goon_keeps_away d state
local goon_keeps_away 028063 b state
param umbrella_goon_float_down d state
local umbrella_goon_float_down 028066 b state
param hat_goon_run_across d state
local hat_goon_run_across 028069 b state
param shovel_goon_step_out d state
local shovel_goon_step_out 02806C b state
param goon_striker_rush_in d state
local goon_striker_rush_in 02806F b state
param hat_goon d state
local hat_goon 028072 b state
param umbrella_goon d state
local umbrella_goon 028075 b state
param shovel_goon d state
local shovel_goon 028078 b state
param hat_goon_brawler d state
local hat_goon_brawler 02807B b state
param goon_from_side d state
local goon_from_side 02809F b state
param shovel_goon_rush_in d state
local shovel_goon_rush_in 0280A2 b state
param umbrella_goon_rush_in d state
local umbrella_goon_rush_in 0280A5 b state
param goon_striker_from_side d state
local goon_striker_from_side 0280A8 b state
# goon_balloon: 028191 "LDU #$79CE; ASLB; JMP [B,U]": its states' handlers
local goon_balloon 028191 u state_handlers
# 028716 "LDU #$7AFE" / 028727 "LDU #$7B0A" / 028686 "LDU #$7AE8": the states' handlers ("JMP [B,U]")
local hat_goon_step_out 028716 u state_handlers
local goon_step_out 028727 u state_handlers
local shovel_goon_step_out 028686 u state_handlers
# "LDU #$7910 / #$78B8 / #$7860 / #$7808; STU #$2A,X": the goon's behaviour (field 2A), left in U
local hat_goon_brawler_set_up 0280C7 u behaviour
local goon_keeps_away_set_up 02811F u behaviour
local goon_striker_set_up 028146 u behaviour
local goon_close_grabber_set_up 02817D u behaviour
# 028219 "LDY #$79EC" then spawn_child: the balloon the goon hangs from
local goon_descent_set_up 028219 y child_record child_object
# the entrances' steps: "LDU #$79E8 / #$7A20 / #$7A40 / #$7A5C / #$7A6C; JMP [B,U]"
local goon_descent_step 028264 u step_handlers
local hat_goon_run_across_step 0282C7 u step_handlers
local shovel_goon_rush_in_step 028345 u step_handlers
local goon_rush_in_step 0283C0 u step_handlers
local goon_from_back_step 02842E u step_handlers
# "CLRD; LBSR $8638" (vector_floor_at_offset), "LBSR $863B" (vector_floor_ahead), "LBSR $8644" (vector_floor_ahead_x):
# the floor cell under the goon or ahead of it, A its value (negative: no floor; its low 4 bits the floor's level)
local goon_descent_float 028270,028271 d floor_cell
local goon_descent_float 028271 a floor_value
local goon_from_back_reach_floor 028456,028457 d floor_cell
local goon_from_back_reach_floor 028457 a floor_value
local goon_reach_floor_level 0285E4 d floor_cell
local goon_reach_floor_level 0285E4 a floor_value
local goon_follow_floor 028759 d floor_cell
local goon_follow_floor 028759 a floor_value
local goon_walk_up_reach_floor 0287EE d floor_cell
local goon_walk_up_reach_floor 0287EE a floor_value
local goon_reach_floor 02890B,02890C d floor_cell
local goon_reach_floor 02890C a floor_value
local hat_goon_jump_in_fly 0289C2 d floor_cell
local hat_goon_jump_in_fly 0289C2 a floor_value
local goon_drop_set_up 028A16 d floor_cell
local goon_drop_set_up 028A16 a floor_value
local umbrella_goon_float_down_set_up 028A81 d floor_cell
local umbrella_goon_float_down_set_up 028A81 a floor_value
local goon_jump_in_leap 029464 d floor_cell
local goon_jump_in_leap 029464 a floor_value
# 028299 / 0283EC / 0285C9 "LBSR $8620" (vector_choose_nearest_player): the goon's new target, measured
local goon_descent_land 028299,0282A2 u nearest_player object
local goon_rush_in_run 0283EC,0283F5 u nearest_player object
local goon_walk_in_go 0285C9 u nearest_player object
# 0282A2 / 0283F5 "LDA #$36,X; LBSR $866B" (vector_set_walk_speed_by_direction): the direction to the target, in A
local goon_descent_land 028294,0282A2 d direction
local goon_rush_in_run 0283F5 d direction
# 0285D4 "LDA #$E0" / 0285D8 "LDA #$20": the slant it walks in at, as its start's bit 7 says
local goon_walk_in_go 0285D4,0285D8 a angle
# 028437 "LDU #$7A72": goon_from_back_xs, by the goon's parameter
local goon_from_back_place 028437 u start_xs
# 028487 "LDU #$38,X": the goon's target, measured and faced
local goon_from_back_reach_floor 028487 u target object
local goon_from_back_wait 028487 u target object
# 0284D4 "LDA #$3D,X": the goon's start flags (field 3D), bit 0 for the way it shows
local hat_goon_waiting_show 0284D4 a entrance_flags
# "LDY #$79BE / #$79B6 / #$7F73 / #$7F7B; LBSR $85B4" (vector_set_hit_box)
local hat_goon_waiting_show 0284E1 y box
local hat_goon_waiting_step_forward 028521 y box
local goon_from_below_land 029550 y box
local shovel_goon_rush_in_swing 02836C y box hit_box
local goon_from_below_set_up 0294D1 y box hit_box
# 028579 "LDD ,U; ...; CLRA; ASLDI #$04; STD #$3E,X": the start's trigger x (its byte 1) times 16, A the high byte, B the low
local goon_walk_in_set_up 028581 a trigger_x_high
local goon_walk_in_set_up 028581 d trigger_x_low
# 0293D7 "LDY #$7F6D" then spawn_child: the bomb thrown
local goon_bomb_run_in_throw 0293D7 y child_record
# done: enemies/goons.c

# ======== enemies/cloud_devil.c ========
# 030E39 "LDU #$7D8B; LBSR object_setup": the bolt's set-up record
local lightning_bolt_setup 030E39 u setup object_setup
# 030E9D "LDA #$30,X": the devil's parameter (field 30), the index of its sweep way, heading and rate
local cloud_devil_setup 030E9D a variant
# 030F8C "LDY #$6FAE" then spawn_child: the lightning bolt dropped
local cloud_devil_drop_bolt 030F8C y child_record
# 031184 "LDB #$37,X": the devil's bob phase (field 37): bits 5-7 the bob's end, 0-4 the height's index
local cloud_devil_bob 031184 b phase
# 0311CE "LBSR $8623" (vector_next_random_byte): a random number in A, the wait's index
local cloud_devil_choose_shot_wait 0311CE d roll
local cloud_devil_choose_shot_wait 0311CE a random_byte
# done: enemies/cloud_devil.c

# ======== enemies/donut.c ========
# 03319A "LDY #$7D9E; LBSR set_hit_box": the donut thrower's plain hit box
local donut_roll_end 03319A y box hit_box
# 0331D8 "LDU #$7E62; LBSR object_setup": the donut's set-up record
local donut_shot_setup 0331D8 u setup object_setup
# done: enemies/donut.c

# ======== enemies/goon.c ========
# run_enemies hands it B, the object's state (field 02, "LDD #$01,X")
param enemy_goon_run d state
# 07D466 "LDU #$F144; STU #$2A,X": the plain goon's behaviour (field 2A)
local enemy_become_goon 07D466 u behaviour
# done: enemies/goon.c

# ======== enemies/goon_bomb.c ========
# run_enemies hands it B, its state (field 02), copied at its entry (028018 "LBRA") and run through 0292E3
# "LDU #$7F49; ASLB; JMP [B,U]"
param goon_bomb d state
local goon_bomb 028018 b state
local goon_bomb 0292E3 u state_handlers
# 0292EF "LDU #$7F51; LDB #$29,X; ASLB; JMP [B,U]": the broken bomb's steps
local goon_bomb_broken 0292EF u step_handlers
# 02934D "LDY #$7F3D; LBSR set_hit_box": the bomb's hit box in flight
local goon_bomb_fly 02934D y box hit_box
# done: enemies/goon_bomb.c

# ======== enemies/gorilla.c ========
# 030A10 "CLRD; LBSR $8638" (vector_floor_at_offset): the floor cell under the gorilla, A its value
local gorilla_reach_floor 030A10,030A11 d floor_cell
local gorilla_reach_floor 030A11 a floor_value
# 030AD4 / 030B48 "LDY #$7B1E; LBSR set_hit_box": the gorilla's plain hit box
local gorilla_punch_end 030AD4 y box hit_box
local gorilla_leap_land 030B48 y box hit_box
# 030AFD "LDU #$7C5D": gorilla_leap_speeds
local gorilla_leap_take_off 030AFD u leap_speeds
# done: enemies/gorilla.c

# ======== enemies/grabbing_zombie.c ========
# 030713 / 0307CD "LBSR $861D" (vector_direction_to): the direction to the target in D, A the angle walked
local zombie_grab_start 030713 d direction
local zombie_grab_start 030713 a angle
local zombie_grab_reach 0307CD d direction
# 0307AB "LDY #$7B0A": the zombie's hold animations (kind_97_hold_animations), left in Y
local zombie_grab_reach 0307AB y hold_animations
# done: enemies/grabbing_zombie.c

# ======== enemies/ghost_on_rope.c ========
# 0303E9 "LDU #$7A26; LDA #$29,X; ASLA; JMP [A,U]": the dropper's steps
local ghost_on_rope_hurt 0303E9 u step_handlers
# 03051E / 030536 "LDY #$78B0 / #$78A8; LBSR set_hit_box": the dropper's hit boxes
local ghost_on_rope_drop 03051E y box hit_box
local ghost_on_rope_hang 030536 y box
# 030527 "LBSR $8620" (vector_choose_nearest_player): the target taken when it lets go
local ghost_on_rope_drop 030527 u nearest_player object
# done: enemies/ghost_on_rope.c

# ======== enemies/flying_saxophone.c ========
# 03323D "LDA #$30,X": the flyer's parameter (field 30), the index of its sweep way, heading, rate and slowdown
local flying_saxophone_setup 03323D a variant
# 0332E2 "LDA #$98" / 0332E6 "LDA #$88"; "STA ,X": its flags (field 00) by the frame
local flying_saxophone_descend 0332E2,0332E6 d new_flags
# 0333D9 / 033415 "LDY A,Y" (flying_saxophone_volley_shots, flying_saxophone_single_shots) then spawn_child: the shot thrown
local flying_saxophone_volley 0333D9 y child_record child_object
local flying_saxophone_single_throw 033415 y child_record child_object
# 0335E1 "LDB #$37,X": the bob phase (field 37): bits 5-7 the bob's end, 0-4 the height's index
local flying_saxophone_bob 0335E1 b phase
# 03361F "LBSR $8623" (vector_next_random_byte): a random number in A, the wait's index
local flying_saxophone_choose_throw_wait 03361F d roll
local flying_saxophone_choose_throw_wait 03361F a random_byte
# 03364F "LDU #$7FE9": flying_saxophone_shot_speeds
local flying_saxophone_shot_setup 03364F u shot_speeds
# done: enemies/flying_saxophone.c

# ======== enemies/knight.c ========
# 030BCC "LDY #$7CE9" then spawn_child: what the falling knight lets out
local knight_fall 030BCC y child_record child_object
# 030C29 "LDA #$30,X": the knight's parameter (field 30), its entrance's index (4 bytes each)
local knight_setup 030C29 a variant
# 030D04 "LDA #$98" / 030D08 "LDA #$88"; "STA ,X": its flags (field 00) by the frame
local knight_shrink 030D04,030D08 d new_flags
# "LDY #$7C77 / #$7C6F; LBSR set_hit_box": the knight's strike and plain hit boxes
local knight_strike_hit 030E17,030E20 y box
local knight_strike_end 030E29 y box hit_box
# done: enemies/knight.c

# ======== enemies/lumberjack.c ========
# "LDY #$7B16 / #$7B0E; LBSR set_hit_box": the lumberjack's swing and plain hit boxes
local lumberjack_axe_swing 030911 y box
local lumberjack_axe_recover 030926 y box hit_box
local lumberjack_axe_rest 030939 y box hit_box
# 03094D "LDU #$7C0C": lumberjack_pause_loops_by_players
local lumberjack_axe_pause 03094D u pause_loops
# done: enemies/lumberjack.c

# ======== enemies/rising_zombie.c ========
# 0305C1 "LBSR $861D" (vector_direction_to): the direction to the drift target in D (A kept as the zombie's)
local rising_zombie_aim 0305C1 d aim
# done: enemies/rising_zombie.c

# ======== enemies/zombies.c ========
# 03009E "LDD #$02,U": the timed move's direction (A) and animation (B); B is its parameter and animation
local wandering_zombie_setup 03009E d start_animation
# 0300DD "LDA #$xx,X; LBSR $866B" (vector_set_walk_speed_by_direction): its direction, in A
local wandering_zombie_set_off 0300DD d direction
# 030100 "LDA #$30,X; ADDA #$02; ORA #$80; STA #$05,X; STA ,X": its walking animation, also its flags
local wandering_zombie_walk 030100 a walk_animation
# 030190 "LDA #$30,X; ANDA #$7F; STA #$30,X": its parameter, bit 7 dropped
local zombie_start_coming_out 030190 a start_parameter
# 030250 / 0302B7 "LDA #$06,X": the animation's flags (field 06): bit 1 a marked frame, bit 0 its end
local zombie_burrow_move 030250 a frame_flags
local zombie_burrow_end 0302B7 a frame_flags
# "LDY #$78A0 / #$7890; LBSR set_hit_box": the zombie's leap and plain hit boxes
local zombie_leap_rise 030310,030319 y box
local zombie_leap_land 030334 y box
local zombie_swipe_recover 030395 y box hit_box
# unused_zombie_restart_at_animation_end: X is a zombie (06 animation flags, 3B timer, 02 state)
param unused_zombie_restart_at_animation_end x object object
# done: enemies/zombies.c

# ======== enemies/ninja.c ========
# "CLRD; LBSR $8638" (vector_floor_at_offset): the floor cell under the ninja, A its value (negative: none; the low
# 4 bits the floor's level, 032449 "ASLA" x3 its height)
local ninja_drop_land 032407,032408 d floor_cell
local ninja_drop_land 032408 a floor_value
local ninja_leap_find_floor 03243E,03243F d floor_cell
local ninja_leap_find_floor 03243F,032449 a floor_value
local ninja_step_out_end 03255B,03255C d floor_cell
local ninja_step_out_end 03255C a floor_value
local ninja_fall_in 0325B2,0325B3 d floor_cell
local ninja_fall_in 0325B3 a floor_value
# 0324E9 "LDY #$7A7D" / 032623 "LDY #$7A93" then spawn_child: the ninja's double, its throwing star
local ninja_split 0324E9 y child_record
local ninja_throw_release 032623 y child_record child_object
# 032651 "LDU #$7A9D; LBSR object_setup": the star's set-up record
local ninja_star_setup 032651 u setup object_setup
# 032657 "LDA #$47,X": the floor level (field 47) the star keeps, times 8 its floor height
local ninja_star_setup 032657 a floor_level
# 0326A5 "LDU #$7AB5": kind_a1_attack_delays_by_players
local ninja_crouch 0326A5 u attack_delays
# "LDY #$78D8 / #$78F0; LBSR set_hit_box": the ninja's plain and attacking hit boxes
local ninja_attack_recover 0326D5 y box hit_box
local ninja_jump_attack_dive 032753,032765,032771 y box
local ninja_jump_attack_land 032781 y box hit_box
local ninja_rush_leap 032845 y box hit_box
# done: enemies/ninja.c

# ======== enemies/robot.c ========
# 032ABD "LBSR $8644" / 032AC6 "LBSR $8647" (vector_floor_ahead_x / _y): the floor cell ahead, A negative at a wall
local robot_piece_bounce_off_walls 032ABD,032AC6 d floor_cell
# 032B02 "LDU #$7BCC": hit_spark_times
local robot_spark_setup 032B02 u spark_times
# unused_robot_fight_at_animation_end: X is an object (06 animation flags, 09 attributes)
param unused_robot_fight_at_animation_end x object object
# "LDY #$7B38 / LDY #$48,X; LBSR set_hit_box": the robot's plain hit box, its own
local robot_punch_recover 032C28,032C2E y box hit_box
local robot_punch_recover_again 032C42 y box hit_box
local robot_hit_land 032D63 y box hit_box
local robot_hit_choose_action 032D9F y box hit_box
# 032CAC "LDA #$07,X": the animation's frame (field 07), a sound at frames 6 and 0E
local robot_advance_shock_sparks 032CAC a animation_frame
# 032CC4 / 032D02 / 032D40 "LDY A,Y" (robot_sparks_by_frame_...) then spawn_child: the spark of the frame
local robot_advance_shock_sparks 032CC4 y child_record
local robot_shock_92_sparks 032D02 y child_record
local robot_shock_91_sparks 032D40 y child_record
# 032DCC "LDA #$xx,X; ANDA #$07": the hit's round, the index of the action and the flags after it; 032DD6
# "LDU #$7CC0" robot_status_after_hit
local robot_hit_choose_action 032DCC a hit_index
local robot_hit_choose_action 032DD6 u statuses
# 032E22 "LDY #$7CC8; ... LBSR spawn_child; LEAY #$08,Y" eight times (48F4 = 8): the robot's pieces' records
local robot_put_in_pieces 032E22,032E2A y child_record child_object
# 032E5A "LDY #$7D10" then spawn_child: the part launched
local robot_launch_part_release 032E5A y child_record child_object
# 032E76 "LDU #$7D1C; LBSR object_setup": the part's set-up record
local robot_part_setup 032E76 u setup object_setup
# 032ECC "LDU #$7D22; LDA A,U": robot_part_zooms, the zoom by the time left, in x and y
local robot_part_fly_away 032ECC u zooms
local robot_part_fly_away 032ED2 a zoom
# done: enemies/robot.c

# ======== players/effects.c ========
# player_face_heavy_object: B is the first of the two facing animations (STB #$05,U after "INCB" or not)
param player_face_heavy_object d first_animation
# 039B5C "LDX #$3F,U; LDY #$0C,X; LEAY #$-18,Y": 24 pixels left of the held object's x, compared with the player's
local player_face_heavy_object 039B62 y left_of_held
# 039B80 "LDD #$3F24; LBSR queue_sound": the hurt voice
local player_hurt_voice 039B80 d command
# 039B90 "LDD #$0022; ADDB #$04,U; LBSR $8677" (vector_palette_request): the player's flash palette
local player_flash_palette 039B96 d palette
# 039BB3 "LDY #$0E06; STY #$1F,U": the hit box's width (0E) and depth (06)
local player_reset_box 039BB3 y box_size
# 039BBC "LDY #$0EBF" (039C00 the same for the hit spark): the spark's kind (0E) and animation (BF) handed to player_start_effect
local player_show_hurt_spark 039BBC y effect
# player_start_effect: A of D is the effect's player state (field 30 of the second sprite), kept unless lower
param player_start_effect d effect_state
local player_show_hit_spark 039BFE d effect_state
local player_show_balloon 039C2D d effect_state
# player_play_voice / unused_player_play_character_sound: D is the sound command, the player's kind added (to B, or to A for the latter)
param player_play_voice d command
param unused_player_play_character_sound d command
param unused_player_play_character_sound u object object
# done: players/effects.c

# ======== players/motion.c ========
# 03978F "LDY #$32,U" (the partner, when teamed) or 0397A5 "TFR U,Y" (the player): the object whose speeds are
# stopped with the player's
local player_check_motion 03978F,0397A5 y mover object
# 0397EA "LDX #$0140" / 039802 "LDX #$0150" (scene 4), 0397F2 "LEAX #$26,X": the x the player may not pass (48F8)
local player_check_motion 0397EA,0397F2,039802 x right_limit
# 039812/039820/039838 vector_floor_ahead / _x / _y, then 039818/039826/03983E player_floor_against_height
local player_check_motion 039812,039818,039820,039826,039838,03983E d floor_cell
# player_floor_against_height: D the floor cell in (A its value: bits 4-5 the priority, 0-3 the level), the
# floor's height (level times 8) out (0397A4)
param player_floor_against_height d floor_cell
local player_floor_against_height 0397A4 d floor_height
# 03986F "LBSR $863B" (vector_floor_ahead): the cell where the player's speeds take it; handed back as its
# height (03987E) or the cell with A complemented (039880)
local player_floor_at_next_place 03986F,03987E,039880 d floor_cell
local player_floor_at_next_place 03986F a floor_value
# player_steer: "Steers the player by the joystick in A" (its callers: "LDA #$xx,U(controls); LBSR player_steer")
param player_steer d joystick
# 039894 "LDD ,Y++" (player_walk_velocities): the x speed for the joystick, A also its facing (bit 6)
local player_steer 039894 a x_speed_high
local player_steer 039894 d x_speed_low
# player_place_carried_above: B the height above the player's (added to its z)
param player_place_carried_above d height
# 039A93 "LDX #$0070; LEAX #$-16,X" (48F8) and 039A96 "LDY #$0140; LEAY #$26,Y" (48FA): the x limits a player stays
# within
local player_check_screen_edges 039A93,039AA3 x left_limit
local player_check_screen_edges 039A96,039AA6 y right_limit
# 039AB1 "LBSR $8644" (vector_floor_ahead_x): the floor cell ahead in x
local player_check_screen_edges 039AB1 d floor_cell
# done: players/motion.c

# ======== players/second_sprite.c ========
# 03EA7C "LDY #$3F,U": the object the player held (field 3F), let go (state 3, z 20)
local players_update_second_sprites 03EA7C y held_object object
# 03EAA7 "LDX #$FE00" / 03EAAC "LDX #$0200; STX $...": the push in y of the players (players_push_y)
local players_update_second_sprites 03EAA7,03EAAC x push_speed
# 03EB33 "LDB #$04; ... NEGB": 4 pixels to the side the thrown sprite goes
local player_second_sprite_throw 03EB33,03EB47 b dx
# 03EBBB "LDX #$6C,U": the second sprite's x (its object, 60 after the player's), within 44-17C
local player_second_sprite_fall 03EBBB x sprite_x
# 03EBCF "LBSR $8644" (vector_floor_ahead_x): the floor cell ahead, A its value (negative: none)
local player_second_sprite_fall 03EBCF d floor_cell
local player_second_sprite_fall 03EBCF a floor_value
# 03EC1A "LDD #$B181" / 03EC25 "LDD #$B180": the prompt's kind (A) and animation (B)
local player_second_sprite_prompt 03EC1A,03EC25 a prompt_kind
local player_second_sprite_prompt 03EC1A,03EC25 d prompt_animation
# 03EC47 "ANDA #$3F": the blink's time (field 3E) within its 64 frames: off at 10, on at 0
local player_second_sprite_blink 03EC47 a blink_time
# 03EC67 "LDA #$00A0,U": the balloon's number (the second sprite's field 40), the index of player_balloon_animations;
# 03EC6E "LDB A,Y" / 03EC89 "ADDB A,Y" / 03EC8D "ADDB #$04,U": its animation, by the player's kind or the pair's
local player_second_sprite_start_balloon 03EC67 a balloon
local player_second_sprite_start_balloon 03EC6E,03EC89,03EC8D b balloon_animation
# 03EC74 "LDY #$32,U": the partner (field 32), its second sprite cleared
local player_second_sprite_start_balloon 03EC74 y partner object
# 03ECD3 "PULLS X": the partner's object (OBJECT_ADDRESS(0) + C0 x its number, 03ECCB "LDB #$C0; MUL")
local player_second_sprite_balloon 03ECD3 x partner object
# done: players/second_sprite.c

# ======== players/gauges.c ========
# 0408EB "LDY #$02,X" (gauge_player's counters) for each of the 4 players, the step delay at +3 counted down: the
# last one's is what Y holds after it, the Y game_mode_frame hands on to the object lists' runners
# 04092D "LDD <$37" (credits), 040935 "LDB #$FF" (past FF): the credits shown, as a byte
local gauges_draw 04092D,040935 b credits_shown
# gauges_put_picture: "Draws a picture of tiles at X (blank with A bit 7 set)": D's A is the blank flag
param gauges_put_picture d blank
local continue_draw 040B1F d blank
local continue_end 040B30,040B40 d blank
local game_over_draw 040B40 d blank
local continue_erase_count 040B7B,040B85 d blank
local continue_draw_count 040B60,040B70 d blank
# 040BAF "LDA #$10" / 040B9D "LDB #$00,S" / 040BB1 "CLRB": the blank tile (10, colour 0) or the picture's colour
local gauges_put_picture 040BAF a blank_tile
local gauges_put_picture 040B9D,040BB1 b colour
# 040B8E / 040BA4 "LDA ,U+": the picture's tiles, read in turn
local gauges_put_picture 040B8E,040BA4 u cursor
# gauge_draw_picture: "Draws picture B in player A's quarter, in its colour (blank with A bit 7 set)"
param gauge_draw_picture d quarter_and_picture
local gauge_draw_player_picture 040B13 d quarter_and_picture
# 040C1B "LDB #$08,S": the colour attribute written below each tile ("STB #$-2000,U")
local gauge_draw_picture 040C1B b colour
# 040BFB "LDU ,X; LEAU B,U", 040C24 "STA ,U+", 040C30 "LEAU A,U": the tile address drawn at
local gauge_draw_picture 040BFB,040C24,040C30 u tile
# 040BF4 "LDX B,X" (gauge_pictures), then "LDA ,X+": the picture's pieces read in turn
local gauge_draw_picture 040BF4,040C07,040C22,040C37 x cursor
# gauge_draw_player: A of D the player's number (gauges_draw: "LDA ,S; ... LBSR gauge_draw_player")
param gauge_draw_player d player_number
# 0409AF "LDD [#$06,X]" (the lives), 0409B7 "LDB #$FF" past FF: the lives shown, less one
local gauge_draw_player 0409AF,0409B7 b lives_shown
# 04099B "LDU #$0A,X" (continue_tiles) / 0409AC "LDU #$08,X" (lives_tiles): where the count is printed
local gauge_draw_player 04099B,0409AC,0409BA u tiles
# gauges_byte_to_bcd: "B in BCD in A (carry set past 99)"
param gauges_byte_to_bcd d value
local gauges_byte_to_bcd 0409D8,0409DD,0409DF a bcd
local gauges_byte_to_bcd 0409CF,0409E5 b bits
local gauges_byte_to_bcd 0409F0 d bcd_word
# 0409D1 "LDU #$777A" (the BCD values of B's bits, 1 to 128), 0409E2 "LEAU #$01,U"
local gauges_byte_to_bcd 0409D1,0409E2,0409F0 u bcd_powers
# gauge_print_count: U the count's tiles, A of D the count in BCD (two big digits)
param gauge_print_count u tiles
param gauge_print_count d count
# 040ABB "LDY #$774E": big_digits
local gauge_print_count 040ABB y digits
# done: players/gauges.c

# ======== players/players.c ========
# 038096 "LDU #$3F,X": the object the player holds (field 3F)
local player_run_all 038096 u held_object object
# 03810C "LEAX #$1C,X; LDU #$003D; CLRA; BSET A,X,U": the player's fields from 1C cleared, 3D bytes
local player_run 03810C,038113 x cursor
local player_run 03810F,038113 u bytes_left
# 03817F / 0381A5 "LBSR $863B" (vector_floor_ahead): the floor cell where the player's speeds take it
local player_run 03817F,0381A5 d floor_cell
# 038295 "LDY #$7D51; ... JSR [A,Y]": the player states' handlers, by its state (field 30 of the second sprite)
local player_run 038295 y state_handlers
# 03820E "LBSR player_floor_at_next_place": the floor's height there, the highest kept in 48F3
local player_find_entry_floor 03820E d floor_height
# player_next_state_at_animation_end / player_land_at_animation_end: U is an object (06 animation flags, 30 parameter, 00 flags)
param player_next_state_at_animation_end u object object
param player_land_at_animation_end u object object
# 07B71B "LDY #$E803; ... JSR [A,Y]": the handlers of a player slot's status (out, join, playing, continue, game
# over)
local update_players 07B71B,07B722 y status_handlers
# 07B784 / 07B7FF "LDY #$00,U" (the coin slot's count), 07B78E / 07B809 "LEAY #$-01,Y": the coins, each worth
# lives_per_credit lives
local player_join 07B784,07B78E y coins
local player_playing 07B7FF,07B809 y coins
# 07B86E "LDY #$07,X": the player's continue countdown (BCD seconds, then frames to 3C)
# 07BA37 "LDA <$50; ... LSRA": the players in the game, a bit each; 07BA3A "LDB #$04; ... DECB" the four of them
local count_players_in_game 07BA37,07BA43 a playing_bits
local count_players_in_game 07BA3A,07BA44 b players_left
# 07BA5D "LDA #$27,X": the beaten enemy's points (field 27): bit 7 owed, bit 6 paid, 4-5 the scale, 0-3 the digit
local award_enemy_points 07BA5D a points_code
# done: players/players.c

# ======== players/reactions.c ========
# 03931E "LDB #$1E,U": the touch's kind (field 1E, hit): F0-83 a partner's team-up, 10 and up a blow
local player_take_touches 03931E b hit_kind
# 039735 / 039753 "LEAX D,X" (OBJECT_ADDRESS(0) plus the team move's first and second objects), 03976D "PULLS X":
# the two players of the team move, set going
local player_take_touches 039735,039753,03976D x team_member object
# "LDD #$3F28 / #$3F00; LBSR $7C50" (player_play_voice): the voice played
local player_take_pose_blow 03934B d command
local player_squash 0394DC d command
local player_take_stun_blow 0395DF d command
# 03943C "LDY #$3F,U": the object the player holds (field 3F), its speeds stopped
local player_pick_up_item 03943C y held_object object
local player_pick_up_weapon 03943C y held_object object
local player_eat_food 03943C y held_object object
# player_set_hurt_stopped / player_hurt: Y's high byte is the player's state (field 30 of its second sprite), the
# low one its time (field 31): "LDY #$1600; ... LBRA $7615"
param player_set_hurt_stopped y state_and_time
param player_hurt y state_and_time
local player_take_fling_blow 039459 y state_and_time
local player_take_blow 03949F,0394A7,0394BE,0394C6 y state_and_time
local player_squash 0394EA y state_and_time
local player_knock_up 03951B y state_and_time
local player_take_knockdown_blow 03952D y state_and_time
local player_take_knockaway_blow 039528 y state_and_time
local player_bounce_away 03959D y state_and_time
local player_take_stun_blow 0395E7 y state_and_time
local player_take_stun_blow_2 0395FF y state_and_time
# 0395C5 "LDA #$05; LBSR $7C2F" (player_start_effect): the effect's state
local player_get_grabbed 0395C5 d effect_state
# 0395C8 "LDB #$BF": the grabbed animation
local player_get_grabbed 0395C8 b grab_animation
# done: players/reactions.c

# ======== players/states.c ========
# "LDX #$32,U": the player's partner in a team move (field 32), whose speeds and facing follow it (039205 is the
# end the team states share)
# "LDA #$xx,U(controls) ... LBSR $788B" (player_steer, "the joystick in A")
local player_team_jump 038519 d joystick
local player_team_fall 038569 d joystick
local player_jump 038639 d joystick
local player_fall 03868D d joystick
# player_walk: A of D the joystick (player_walk_velocities by its 4 bits: "LDA ...; LSLA x2; LDD A,Y")
param player_walk d joystick
# player_set_animation: B the animation before the held object's offset is added ("STB #$05,U" plus 8 x the held
# kind less 3); its callers: "LDB #$81 / #$01 / #$83; LBRA $7242"
param player_set_animation d base_animation
local player_walk 038426,03842A,038449 d base_animation
local player_jump 038683,038687 d base_animation
local player_fall 0386B5 d base_animation
local player_set_standing 0386DE d base_animation
local player_stand 038488,0387B9 d base_animation
# 039242 "LDX #$3F,U": the object the player holds (field 3F)
local player_set_animation 039242 x held_object object
# 0392C2 "LDB ,Y+; ... NEGB": the held object's x offset, the other way when the player faces left
local player_set_animation 0392C2,0392CB b dx
# 038604 / 038ADA "LDA #$06,U": the animation's flags (field 06), bit 0 its end
local player_throw_weapon_away 038604 a frame_flags
local player_throw_weapon_8 038ADA a frame_flags
# 0387E8 "LDY #$7DE1; ... JMP [A,Y]": what using the held object does, by its kind less 4
local player_use_held 0387E8 y use_handlers
# "LDD #$3F20 / #$3F00 / #$3F24; LBSR $7C50" (player_play_voice)
local player_start_jump_attack 03893D d command
local player_flung_back 038D0F d command
local player_grabbed 038E5D d command
# 038A69 / 038A86 "LDX #$3F,U": the carried object thrown; 038A73 / 038A90 "LDY #$7E1B; LBSR player_place_carried":
# its offsets from the player
local player_throw_carried_4 038A69 x held_object object
local player_throw_carried_5 038A86 x held_object object
local player_throw_carried_4 038A73,038AD4 y offsets
local player_throw_carried_5 038A90,038AD4 y offsets
# 038ABB "LDY #$0400" / 038AC5 "LDY #$FC00" (facing left); "STY #$0F,X": the thrown object's x speed
local player_release_throw 038ABB,038AC5 y throw_speed
# 038AF8 "LDY #$0882" and "LDA #$08; LBSR $7C2F" (player_start_effect): the effect's kind and animation, its state
local player_throw_weapon_8 038AF8 y effect
local player_throw_weapon_8 038AFD d effect_state
local player_struggle 038EB1,038EC9 d effect_state
local player_die 039001 d effect_state
local player_team_ready 0391AD d effect_state
# player_set_state: Y's high byte the player's state, its low byte the state's time (fields 30 and 31 of the
# second sprite); its callers and player_set_floor_state's: "LDY #$2300; LDB #$DC; ..."
param player_set_state y state_and_time
local player_peel_off_back 038D53 y state_and_time
local player_knocked_down 038DCC y state_and_time
local player_lying_down 038DE1 y state_and_time
local player_knocked_up 038F68,038F74 y state_and_time
local player_fall_down 038F7E y state_and_time
local player_lie_down 038FA9 y state_and_time
local player_entry_crash 039102 y state_and_time
# 038E4F "LDA #$1E,U": the touch's kind (field 1E, hit)
local player_grabbed 038E4F a hit_kind
# 038E45 / 038ED5 "LDX #$4B,U": the object holding the player (field 4B)
local player_grabbed 038E45,038E68 x grabber object.grabber
local player_grabbed_and_hit 038ED5 x grabber object.grabber
# 039164 "LBSR $7B5C" (player_face_heavy_object): the first of its two facing animations
local player_work_heavy_object 039164 d first_animation
# player_set_animation: Y the carrying offsets (0392C0 "LEAY A,Y; LDB ,Y+", A 8 x the held kind less 3 plus 2 x the player's kind: the
# held object's x offset, then its height above), as player_place_carried's offsets; 0392ED the height handed to
# player_place_carried_above
param player_set_animation y carry_offsets
local player_set_animation 0392ED d height
local player_set_standing 0386DB y carry_offsets
# 03894A "LDX #$7E07; LEAX #$0A,X ... LDD ,X++": the jump attack's records read in turn
local player_start_jump_attack 03894A,038952,038964,038970 x cursor
# done: players/states.c

# ======== parameters and locals: scenes, stages, attract ========
# ======== the parameters and locals of src/scenes, src/stages, src/attract ========
# (the C read is the C; evidence by place in build/listing/simpsons.s)

# ---- attract/demo.c ----
# 07A099 "LDX #$5800; LEAY ,X; CLR ,X+; LDU #$00FF; BMOVE Y,X,U": 5800-58FF cleared by copying each byte onto the next
local demo_start 07A09C y clear_from
local demo_start 07A09E x clear_to
local demo_start 07A0A0 u count
# 07A0AB "LDX A,X" (the demo's record), 07A0B8 "LDA ,X+" (its step), 07A0F2 "LDU ,X++" (each player's inputs): the
# cursor through the demo's record
local demo_start 07A0B8,07A0F2 x demo_cursor
# 07A0D2 "LDY #$5810", 07A0F4 "STU ,Y", 07A0F9 "STA #$02,Y", 07A0FE "STA #$03,Y", 07A117 "LEAY #$10,Y": each player's
# demo playback at 5810 + 10 x player (its input step, the frames left of it, its controls)
# 07A15F "LDY #$5810", 07A17A "LDU ,Y", 07A181 "DEC #$02,Y", 07A19A "LEAY #$10,Y": the same playbacks
# 07A1D5 "LDU #$5843; LDX #$484C; LBSR $924D": Lisa's demo controls, update_controls's port (the other three players'
# are named port already)
local demo_play 07A1D5 u port

# ---- attract/title.c ----
# 07A384 "CLRB", 07A38C "LDB #$80", 07A38E "ADDB #$12": print_game_text erases its text when B's bit 7 is set
local coin_title_blink 07A384,07A38C b erase

# ---- attract/intro.c ----
# the attract scenes' dispatchers by step_phase: 040021 "LDA <$04; ASLA; JMP [A,X]"
local attract_opening 040024 a phase_offset
local attract_opening_end 040105 a phase_offset
local attract_bart 0401B4 a phase_offset
local attract_homer 0402AB a phase_offset
local attract_lisa 04035E a phase_offset
local attract_marge 040477 a phase_offset
local attract_leap 040643 a phase_offset
local attract_last_screen 040706 a phase_offset
# 040059 "LDX #$2800; LDB #$10; CLR #$-2000,X; STB ,X+; CMPX #$3000", then 3000-37FF: the tile layers' codes (tile 10)
# and colours (2000 below)
local attract_opening_start 040059,040062,040069,040072 x tile
local attract_opening_start 04005C,04006C b tile_code
# 040085 "LDU #$7066; LBSR $680D": the picture's record attract_put_picture reads (its animation, x and y)
local attract_opening_start 040085 u picture
# 040817 "LDA ,U+; ORA #$80; STA #$05,X", 04081E "LDD ,U++; STD #$0C,X", 040823 "LDD ,U++; STD #$11,X": a picture's
# record (animation, x, y), handed back past it
local attract_put_picture 040823 u picture
# 0400B2 "LDD #$28,X; SUBD #$00C0; STD #$28,X; STA #$0A,X; STA #$0B,X": the zoom (high byte) the picture shrinks by
local attract_opening_zoom 0400B5 a zoom
local attract_opening_end_start 040113 a zoom
local attract_opening_end_scroll 04015B a zoom
# 040226 "LDD <$BF; SUBD #$0600; STD <$BF" (then the borrow into <$BE): layer A's scroll x's low byte and fraction
local attract_bart_scene_move 040226 d scroll_x_low
local attract_lisa_scene_walk 0403C2 d scroll_x_low
# 04045C "ANDA #$01; ADDA #$1A; ORA #$80; STA #$05,X": one of two poses, from the pseudo-random action
local attract_lisa_scene_animate 04045C a pose
# 04078D "LDY #$70E3; TFR A,B; ASLB; LDY B,Y" (profile_moves by A): the move's record, handed to the move's steps
# (attract_profile_move_out and attract_profile_move_back call it move)
param attract_profile_move d move_number
local attract_profile_move 040796 y move profile_move
# 0407B5 "PULLS A; CMPA #$04" (move 4's partner goes the other way), 0407E0 "TSTA; BNE" (only move 0 pauses)
param attract_profile_move_out d move_number
param attract_profile_move_pause d move_number
# 040803 "LDA ,Y+; STA #$28,X": the move's frames
local attract_profile_move_back 040803 d frames
# 04082C "LDX #$7106; ASLA; LDX A,X" (profile_texts by A), 040832 "LDD ,X++" (where its count is), 04083B "LDB ,X+"
# (a letter; FF the end, FE a new place), 04084F "CMPA [$48F3]; BEQ; INCA" (letters up to the count), 040858 "SUBB
# #$30; LDX <$F1; STB ,X" (typed at the place)
param attract_type_profile_text d text_number
local attract_type_profile_text 040837,040855 a letter_index
local attract_type_profile_text 04083B,04084D b letter
local attract_type_profile_text 040832,04083B,04084D x text
local attract_type_profile_text 04085A x place
# done: attract/demo.c attract/high_scores.c attract/intro.c attract/title.c attract/warning.c

# ---- stages/scroll.c (the setters every stage calls) ----
# 07B632 "STD <$C0" ... (set_scroll_x: the stage's and both layers' scroll x); 07B64C (set_scroll_y)
param set_scroll_x d scroll_x
param set_scroll_y d scroll_y

# ---- scenes/ending.c ----
# 022A1C "LDU #$7706; CLRB; EXG A,B; ASLB; ROLA (x3); LEAU D,U": ending_placements by A; 022A2C "LDY ,U++; LDA #$80;
# STA #$00,Y" (the record's object, put in)
param ending_put_placement d record_number
local ending_put_placement 022A2C y object object
# what ending_put_placement hands back (022837 "LBSR $6A1C"; 02283A "STA #$0A,Y; STA #$0B,Y": its zoom)
local ending_show_family 022837 y object object
local ending_toss 022875 y object object
# 02297E "LDX #$7736; ASLA; LDU A,X; CLRA; LBSR $85A5" (staff_roll_titles): a title of the staff roll, printed
local ending_staff_roll 022982 u title
# 022997 "LDD A,X; CMPD #$FFFF" (ending_family_waits: the frames before the next of the family appears)
local ending_family_animations 022997 d wait_low
local ending_family_animations 022997 a wait_high
# 02292A "LDD <$C5; CMPD #$001B; ADDD #$0001; STD <$C5": layer A's scroll y
local ending_scroll_up 02292A d scroll_y_low
local ending_scroll_up 02292A a scroll_y_high
# 0229DF "LDA #$0A,X; DECA; CMPA #$30; STA #$0A,X; STA #$0B,X", 0229F1 "LDA #$60": the tossed one's zoom
local ending_tossed_rise 0229E2,0229F1 a zoom
# done: scenes/ending.c

# ---- scenes/scene_objects.c ----
# 025388 "LDU #$77BA; CLRB; EXG A,B; ASLB; ROLA (x3); LEAU D,U": object_12_placements by A; 025398 "LDY ,U++; CMPY
# #$FFFF; BNE; TFR X,Y": the record's object, or the one X gives; 0253A1 "LDA #$80; STA #$00,Y"; handed back in Y
param scene_put_placement d record_number
param scene_put_placement x default_object object
local scene_put_placement 025398,02539F y object object
# 0253C9: A the player (0253CB "STA <$EB"), B the record of absent_player_blanks; 0253E0 "LDB ,U+" (its colour),
# "LDA ,U+" (its tile, pushed), 0253E8 "LDX A,U" (the player's place), 0253F6 "STB #$-2000,X; STA ,X+"
param blank_absent_player d player_and_blank
local blank_absent_player 0253E0,02540A b colour
local blank_absent_player 0253EA,0253F4 a tile
local blank_absent_player 0253E8,0253FA,025408 x place
# done: scenes/scene_objects.c

# ---- scenes/game_start_portraits.c ----
# 05ED64 "LDA <$78; ADDA #$01; BCC; LDA #$FF; STA <$78; CMPA #$20": skip_wait counted up to FF
local game_start_portraits 05ED67,05ED6B a wait
# 05ED74 "LDX #$4842", 05EDA8 "LEAX #$04,X": each player's controls (4842 + 4 x player)
local game_start_portraits 05ED74,05EDA8 x controls
# 05EDBE "LDX #$4842; LDA #$04", 05EDD7 "LEAX #$04,X", 05EDDD "DECA": each player's controls, four of them
local game_start_join_players 05EDBE,05EDD7 x controls
local game_start_join_players 05EDC1,05EDDD a count
# 05EDE1 "LDX #$4817", 05EDFC "LEAX #$08,X": each coin slot's credits (4817 + 8 x slot)
local game_start_join_players 05EDE1,05EDFC x slot_credit
# 05EE53 "LDU ,X++" (a portrait area's tiles), 05EE61 "STB #$-2000,U; LEAU #$01,U", "ANDA #$07; ORA #$28" (kept in 2800-2FFF)
local game_start_draw_portraits 05EE53,05EE65,05EE72,05EE79,05EE86 u tile
# 05EEAB "LDX #$4F80", 05EEB8 "LDU #$7F14 ...; LDU A,U" (test_player_records), 05EEBE "BSR $6ED1", 05EEC0 "LEAX
# #$00C0,X": each portrait's object and its record
local game_start_run_portraits 05EEAB,05EEBE,05EEC0 x object object
local game_start_run_portraits 05EEBC u test_player test_player
param portrait_run u test_player test_player
# 05EEDF "LDD #$02,U; STA #$04,X; ORB #$80; STB #$05,X": the record's kind and animation
local portrait_start 05EEDF d kind_and_animation
# 05EF4C "LDA #$29,X; CMPA #$16" (the portrait's frame), 05EF7E "PULLS A; ... STA #$05,X"
local portrait_come_alive 05EF4C,05EF7E a frame
# done: scenes/game_start_portraits.c

# ---- scenes/high_scores.c (the name entry and the high score table) ----
# 022011 "LDA <$0F; ANDA #$FC; STA <$0F; STA $1FC2": the board's control (sprite RAM out of 2000 again)
local name_entry 022014 a control
local name_entry_print_tall_letter 02246F,022485 a control
local high_scores_wave_out 022599,0225C4 a control
local put_sprite 02275C,022794 a control
local name_entry_edit_initials 02242A,02244D a control
# 022A4F "LDU #$7A13; LDA #$02,X; ASLA; JSR [A,U]": the boss's state
local stage_7_boss_update 022A52 a state
# 022037 "LDX #$3860", 022040 "LDA ,X+" (a player, best first: name_entry_rank_players), 022055/022061 "STA ,X+" (its
# place, FF out of the table)
local name_entry_set_up 022037,022040,022055,022061 x ranked
# 022042 "ASLA" (the player times 2: name_entry_player_records), 022046 "LEAU A,U" (its entry, 3842 + 4 x player)
local name_entry_set_up 022042 a player_offset
local name_entry_set_up 022046 u entry
# 02204B "LBSR $86A4" (high_score_rank: A the place), 02204E "ADDA <$F4" (one more for each player ranked before)
local name_entry_set_up 02204B,02204E a place
# 0220B0 "LDA ,X; ADDA #$01; DAA" (the place from 1, in decimal), 0220BB "LSRA" x4 (its tens)
local name_entry_set_up 0220B0,0220B4 a place_number
local name_entry_set_up 0220BB a tens
# 022129/02214C/022173: the score's digits, 10 (a blank) for the leading zeros (022131 "LDA #$10")
local name_entry_set_up 022129,022131,02214C,022155,022173,02217B a digit
# 022073 "LDX #$3842", 02219F "LEAX #$04,X": each player's entry (its place, bit 7 out of the table)
local name_entry_set_up 022073,02219F x entry
# 0221AD "LDX #$3852; LDA #$41; STA ,X+; LDD #$4040; STD ,X++": each player's initials, A then blanks
local name_entry_set_up 0221AD,0221BC x initials
# 022085 "LDU ,Y" (the player's sprites), then print_sprite_letter's and name_entry_print_tall_letter's
local name_entry_set_up 022085,0220C5,0220DD,0220F8,02210B,02213A,02215E,022184,02219C u sprite
# 022111 "LDY <$FC" (name_entry_player, saved at 02207C "STY <$FC"), 022114 "LDD #$14,Y" (its place_x)
local name_entry_set_up 022111 y name_entry_player name_entry_player
# 022212 "LDD $385E; ADDD #$0001; STD $385E; CMPD #$0700": the name entry's timer
local name_entry_type_initials 022216,022230 a timer_high
local name_entry_type_initials 022216,022230 b timer_low
local name_entry_linger 0222B4 d timer
# 022255 "LDX #$3842; LDA #$80; LDB #$04; ANDA ,X; LEAX #$04,X; DECB": whether every entry is done (bit 7)
local name_entry_type_initials 022258,02225C a all_done
local name_entry_type_initials 02225A,022261 b count
local name_entry_type_initials 022255,02225E,022267,02228B,022296 x entry
# 0222CD "LDX #$3860", 0222DC "LDA ,X" (a player of the ranking), 0222FD "LEAX #$02,X"
local name_entry_save 0222CD,0222FD x ranked
local name_entry_save 0222DC a player
# 022309 "LDU #$3860", 022323 "LEAY #$02,U": the ranking sorted by swapping each player with a better one after it
local name_entry_rank_players 022309,022358 u ranked
local name_entry_rank_players 022323,02234B y other
local name_entry_rank_players 022343 a player
# name_entry_type_initials hands its entry (3842 + 4 x player); 02238D "LDA #$03,X" (the initial being typed),
# 022390 "LDY #$06,U" (where the player's initials are), 022395 "LDB A,Y; CMPB #$62; LDB #$40" (the letter, wrapped)
param name_entry_edit_initials x entry
local name_entry_edit_initials 02238D,0223BD,0223DC,0223E3 a initial
local name_entry_edit_initials 022395,02239B,0223C5,0223CB b letter
local name_entry_edit_initials 022390,0223C0,0223F7,022409 y initials
local name_entry_edit_initials 0223FC,022413,022415 u sprite
# 022491 "PUSHS U,X,D": A the column (bit 7: blank it), B the picture (name_entry_pictures); 0224B7 "LDX B,X";
# 0224BE "LEAU B,U" (the place in the tile layer), 0224CA "LDA ,X+; ORA #$03,S" (the colour), 0224E5 "LDA ,X+; STA ,U+"
param name_entry_draw_picture d column_and_picture
local name_entry_draw_picture 022491 a column
local name_entry_draw_picture 0224CC,0224D4 a colour
local name_entry_draw_picture 0224DE b colour
local name_entry_draw_picture 0224BE,0224E7,0224F3 u tile
local name_entry_draw_picture 0224B7,0224CA,0224E5,0224FA x picture
# 022569 "LDX #$1A00; ... STD ,X++": the layer's line scrolls, waved; 0225A4 "LDX #$2000", 0225B7 "STB #$0B,X; LEAX
# #$10,X": each sprite's height
local high_scores_wave_out 022569,022581 x line_scroll
local high_scores_wave_out 0225A4,0225BA x sprite
local high_scores_wave_out 02257E b wave
local high_scores_wave_out 0225B0,0225B5 b height
# 02263C "LDU #$2000" (the sprite RAM, filled by print_sprite_letter), 02263F "STA <$F0" (the first place, counted
# up in decimal: 02271B "LDA <$F0; ADDA #$01; DAA"), X the entries (initials, score, icon, 8 bytes each)
param high_scores_print_entries x entry
param high_scores_print_entries d first_place
local high_scores_print_entries 02263C,022662,022676,022687,0226C5,022709 u sprite
local high_scores_print_entries 02265C a tens
local high_scores_print_entries 02271B a place
local high_scores_print_entries 0226FA,0226FF b icon_frame
local high_scores_print_entries 0226A3 x entry_icon
# 022730 "SUBA #$30; LDB A,X" (the letter, by sprite_font_codes), "PULLS B; CLRA; BSR $6757" (B the colour)
param print_sprite_letter u sprite
param print_sprite_letter d letter_and_colour
local print_sprite_letter 022744 d colour
param name_entry_print_tall_letter u sprite
# 022757 "PUSHS A ... STA ,U" (the sprite's first byte), "STD #$0C,U" (its colour), "LEAU #$10,U" (the next)
param put_sprite u sprite
param put_sprite d colour
# done: scenes/high_scores.c

# ---- scenes/stage_7_scenes.c ----
# 02474D "LDA #$14; LDB #$04; PUSHS D; LBSR $7388" (records 14-17 of object_12_placements), 024770 "INCA; DECB"
local stage_7_scene_set_up 02474F,024770,024771 d record_and_count
# what scene_put_placement hands back: the object it put (024756 "LDD #$0C,Y; ADDD <$F0; STD #$0C,Y": its x)
local stage_7_scene_set_up 024753 y object object
local stage_7_end_board 0249B8,0249E4 y object object
local stage_7_end_take_off 024A38,024A74 y object object
# 0249D9 "LDA #$19", 0249E2 "PUSHS A; LBSR $7388", 0249F6 "INCA": the next record of object_12_placements
local stage_7_end_board 0249D9,0249F4,0249F6 a record
local stage_7_end_take_off 024A69,024A88,024A8A a record
# 02481D "LDX #$18E0; LEAY ,X; CLR ,X+; LDU #$001F; BMOVE Y,X,U": the scene's variables cleared
local stage_7_scene_lift 024820,024827 y clear_from
local stage_7_scene_lift 024822,024827 x clear_to
local stage_7_scene_lift 024824,024827 u count
# 0247F6 "LDX #$3000; LDA <$D6; LSRA (x3); ADDA #$1C; ANDA #$1F; LDB #$40; MUL; LEAX D,X", 024811 "STB #$-2000,X;
# STA ,X+": a row of layer B blanked (tile 10) above the lift
local stage_7_scene_lift 024806,024815 x tile
# 024918 "CLRB; LBSR $867D; BCS; LDB #$01; LBSR $867D": a free object of list 0 or 1 (in U)
local stage_7_scene_put_chain 024840,024863,024870 u new_object object
# 0248F8 "TFR U,X; LBSR $7388; LDA #$F4; STA #$01,Y": the chain's link put in the free object
param stage_7_scene_put_link u new_object object
local stage_7_scene_put_link 0248FA y link object
# 024853 "LDA #$28; LBSR $68F8; PUSHS Y; LDX <$FA; STY #$2A,X" (each link the next of the one before),
# 024866 "LDA #$29; LBSR $68F8; ... STY #$28,X" (its pair), 024873 "PULLS X" (the last link: 02487A "STD #$2A,X",
# back to the first)
local stage_7_scene_put_chain 024855,024868 y link object
# 02489E "LDX $18F0" (the first link), 0248CD "LDU #$28,X" (its pair), 0248C0 "LDX #$2A,X" (the next)
local stage_7_scene_move_chain 0248CD,0248E1 u pair object
# done: scenes/stage_7_scenes.c

# ---- scenes/story_actor.c ----
# The script's operations: story_actor_next_operation (03E270 "LDY #$2E,X; LDA ,Y+; CMPA #$FF; ... LDU #$7000; ASLA;
# JMP [A,U]") runs each with the actor's object in X (03E280 "LDD ,Y++; STD #$04,X": its kind) and the script's next
# byte in Y (an operation's arguments, read with ,Y+ and ,Y++ or skipped with LEAY); each goes on with
# story_actor_continue (03E67C "LBRA $6273", the next operation) or stops for the frame with Y saved (03E3B5 "STY
# #$2E,X; LBRA $667F": story_actor_finish_frame)
param story_actor_next_operation x object object
param story_actor_next_operation y script
local story_actor_next_operation 03E273 y script
param story_actor_set_kind x object object
param story_actor_set_kind y script
local story_actor_set_kind 03E280 y script
param story_actor_set_animation x object object
param story_actor_set_animation y script
local story_actor_set_animation 03E288 y script
param story_actor_set_place x object object
param story_actor_set_place y script
local story_actor_set_place 03E29A y script
param story_actor_set_speeds x object object
param story_actor_set_speeds y script
local story_actor_set_speeds 03E2B4 y script
param story_actor_set_accelerations x object object
param story_actor_set_accelerations y script
local story_actor_set_accelerations 03E2C6 y script
param story_actor_walk_to_without_turning x object object
param story_actor_walk_to_without_turning y script
param story_actor_walk_to_partner x object object
param story_actor_walk_to_partner y script
param story_actor_walk_to x object object
param story_actor_walk_to y script
param story_actor_walk_to_object_in x object object
param story_actor_walk_to_object_in y script
local story_actor_walk_to_object_in 03E2E9 y script
param story_actor_set_target x object object
param story_actor_set_target y script
local story_actor_set_target 03E2F0 y script
param story_actor_put_in x actor object
local story_actor_put_in 03E332,03E367,03E378,03E384 y script
param story_actor_wait x object object
param story_actor_wait y script
local story_actor_wait 03E3B0 y script
param story_actor_set_accelerations_xy x object object
param story_actor_set_accelerations_xy y script
local story_actor_set_accelerations_xy 03E3C0 y script
param story_actor_line_up_players x object object
param story_actor_line_up_players y script
local story_actor_line_up_players 03E405 y script
param story_actor_set_hit_box x object object
param story_actor_set_hit_box y script
local story_actor_set_hit_box 03E418 y script
param story_actor_play_sound_if_player x object object
param story_actor_play_sound_if_player y script
local story_actor_play_sound_if_player 03E422 y script
param story_actor_play_kind_sound x object object
param story_actor_play_kind_sound y script
local story_actor_play_kind_sound 03E445 y script
param story_actor_play_sound x object object
param story_actor_play_sound y script
local story_actor_play_sound 03E44D y script
param story_actor_halt x object object
param story_actor_halt y script
param story_actor_set_attributes x object object
param story_actor_set_attributes y script
local story_actor_set_attributes 03E463 y script
param story_actor_toggle_airborne x object object
param story_actor_toggle_airborne y script
param story_actor_wait_for_object x object object
param story_actor_wait_for_object y script
local story_actor_wait_for_object 03E47E y script
param story_actor_wait_for_players x object object
param story_actor_wait_for_players y script
param story_actor_random_player_faces x object object
param story_actor_random_player_faces y script
local story_actor_random_player_faces 03E4B0 y script
param story_actor_set_players_animation x object object
param story_actor_set_players_animation y script
local story_actor_set_players_animation 03E4E4 y script
param story_actor_face_object x object object
param story_actor_face_object y script
local story_actor_face_object 03E4EF y script
param story_actor_wait_for_height x object object
param story_actor_wait_for_height y script
local story_actor_wait_for_height 03E50B y script
param story_actor_put_in_child x object object
param story_actor_put_in_child y script
local story_actor_put_in_child 03E522 y script
param story_actor_wait_for_camera x object object
param story_actor_wait_for_camera y script
local story_actor_wait_for_camera 03E528 y script
param story_actor_set_variable x object object
param story_actor_set_variable y script
local story_actor_set_variable 03E535 y script
param story_actor_wait_for_x x object object
param story_actor_wait_for_x y script
local story_actor_wait_for_x 03E550 y script
param story_actor_place_players x object object
param story_actor_place_players y script
local story_actor_place_players 03E561,03E585 y script
param story_actor_start_absent_players x object object
param story_actor_start_absent_players y script
param story_actor_wait_for_floor x object object
param story_actor_wait_for_floor y script
local story_actor_wait_for_floor 03E5C6 y script
param story_actor_player_speaks x object object
param story_actor_player_speaks y script
local story_actor_player_speaks 03E636 y script
param story_actor_toggle_repeat_sound x object object
param story_actor_toggle_repeat_sound y script
param story_actor_wait_or_presses x object object
param story_actor_wait_or_presses y script
local story_actor_wait_or_presses 03E65C y script
param story_actor_stop x object object
param story_actor_stop y script
param story_actor_continue x object object
param story_actor_continue y script
param story_actor_finish_frame x object object
param story_actor_finish_frame y script
param story_actor_remove x object object
# 03E2D8 "PUSHS X; PULLS D; ADDD #$0060" (the actor's partner, 60 on), 03E2E9 "LDU ,Y++; LDD ,U" (the object kept at
# an address the script gives): the object story_actor_set_target puts in script_target (03E2ED "STD #$37,X")
param story_actor_set_target d target object
local story_actor_walk_to_object_in 03E2E9 u target_address
# 03E420 "LDU ,Y++" (the sound), 03E422 "LDB ,Y+" (the player), 03E432 "PULLS X" (the actor back), 03E43B "TFR U,D;
# LBSR $8680" (queue_sound)
local story_actor_play_sound_if_player 03E420 u sound
local story_actor_play_sound_if_player 03E432 x object object
# 03E4EA "LDA #$09,X; ANDA #$BF; LDU ,Y++; LDU ,U; LDU #$0C,U; CMPU #$0C,X; BGE; ORA #$40; STA #$09,X": the actor's
# attributes, flipped to face the object (its x)
local story_actor_face_object 03E4ED,03E4FB a attributes
local story_actor_face_object 03E4F3 u target_x
local story_actor_random_player_faces 03E4AE,03E4BC a attributes
local story_actor_random_player_faces 03E4B4 u target_x
# 03E7F3 "LDA #$04; STA <$F0; LDX #$4A40" (the first player's object), 03E7FC "LEAX #$00C0,X; DEC <$F0" (the next)
local story_first_player 03E7F8 x player object
param story_next_player x player object
local story_next_player 03E7FC x player object
# the players' objects these walk (03E3D4 "LBSR $67F3", 03E3FE "LBSR $67FC"), and the actor back (03E403 "PULLS X")
local story_actor_line_up_players 03E3D4,03E3FE x player object
local story_actor_line_up_players 03E403 x object object
local story_actor_set_players_animation 03E4C8,03E4DD x player object
local story_actor_set_players_animation 03E4E2 x object object
local story_actor_place_players 03E56B,03E57E x player object
local story_actor_place_players 03E583 x object object
local story_actor_start_absent_players 03E5AE,03E5BC x player object
local story_actor_start_absent_players 03E5C1 x object object
local story_actor_put_in 03E30A,03E32B x player object
# story_random_player (03E7C5 "MUL; ADDD #$4A40; PUSHS D; PULLS X"): a player's object
local story_actor_random_player_faces 03E4A3 x player object
local story_actor_random_player_faces 03E4C1 x object object
local story_actor_player_speaks 03E5D8 x player object
local story_actor_player_speaks 03E639 x object object
local story_random_player 03E7CD,03E7E5,03E7ED x player object
# 03E3CD "LDU #$704C; LEAU A,U", 03E3F2 "LDB ,U+": the players' places in the line, by the frame count
local story_actor_line_up_players 03E3D0,03E3F2 u line_offsets
# 03E55E "STU <$F8", 03E568 "LDU #$705C", 03E576 "LDD ,U++; STD #$0C,X": each player's place
local story_actor_place_players 03E568,03E576 u places
# 03E5A4 "LDU #$70F8; LDU A,U" (a script by the number of players), 03E5B9 "STU #$2E,X" (each absent player's),
# 03E5A9 "LDB <$50" (the players playing), 03E5B1 "LSRB" (one bit each)
local story_actor_start_absent_players 03E5A7 u absent_script
local story_actor_start_absent_players 03E5A9,03E5B1 b playing
# 03E396 "PUSHS X; LEAX #$43,X; LDD ,X; BNE; STU ,X; ... LEAX #$02,X": the actor's 11 child slots (43-58), the new
# child kept in the first free one; 03E330/03E3AB "PULLS X" (the actor back)
local story_actor_put_in 03E398,03E3A3 x child_slot
local story_actor_put_in 03E330,03E3AB x actor object
# 03E689 "LDA #$0B; PUSHS X; LEAX #$43,X; TFR X,Y; ... LDX ,Y++; BEQ; PUSHS Y; LBSR $605A": each child run
local story_actor_finish_frame 03E690,03E694,03E69D y child_slot
local story_actor_finish_frame 03E689,03E6A1 a count
# 03E719 "LDY #$40,X; LEAY #$43,Y; ... CMPX ,Y++": the parent's child slots, this one's cleared
local story_actor_remove 03E71C,03E724 y child_slot
# 03E777 "PUSHS X; LEAX #$1C,X; LDU #$003D; CLRA; BSET A,X,U; PULLS X": the actor's fields from 1C cleared
local story_actor_remove 03E779,03E780 x fields
local story_actor_remove 03E77C,03E780 u count
# 03E7A3 "TFR U,X; LDA #$0B; LEAX #$43,X; LDU ,X++; ... CLR #$00,U; BSR $67A3" (each child removed, and its own)
param story_actor_remove_children u parent object
local story_actor_remove_children 03E7A9,03E7AC x child_slot
local story_actor_remove_children 03E7AC u child object
local story_actor_remove_children 03E7A7,03E7B5 a count
# 03E1CB "CLRD; LDU #$002F; BSET A,X,U": a player's fields from 28 cleared (03E1B2 "LDX #$4A68" ... "LDX #$4CA8")
param story_clear_player x fields
local story_clear_player 03E1CC,03E1CF u count
local story_actor_run 03E1B2,03E1B7,03E1BC,03E1C1 x player_fields
# 03E09B "ASLB; CLRA; LDY #$7078; LDY D,Y; STY #$2E,X" (story_scripts by script_number): the actor's script
local story_actor_run 03E0A0 y script
local story_actor_run 03E270 y script
# 03E07E "LDY #$40,X; ... STY #$40,X" (the parent kept over the clearing: 03E083 "CLRD; LEAX #$28,X; LDU #$0018;
# BSETW D,X,U")
local story_actor_run 03E07E y parent
local story_actor_run 03E087,03E08A u count
# 03E0BF "LDU #$37,X; LBEQ" (script_target), 03E0DD "CMPD #$0C,U" (its x)
local story_actor_run 03E0BF u target object
# 03E18E "LDY #$2A,X; BEQ; LDA #$2D,Y; CMPA #$01": an actor this one waits for, until its wait is 1
local story_actor_run 03E18E y awaited object
# 03E148 "LDA #$09,X; ANDA #$BF; LDU #$0F,X; BPL; ORA #$40; STA #$09,X": facing the way its x_speed goes
local story_actor_run 03E14B,03E152 a attributes
local story_actor_run 03E14D u x_speed
# 03E27B "LDU #$7000; JMP [A,U]": the operations' table, what every operation is handed in U and passes on
local story_actor_next_operation 03E27B u operations
# 03E50B "LDA ,Y+; INCA; STA #$3B,X" (landing_height): the height the actor waits for
local story_actor_wait_for_height 03E50D a landing_height
# 03E2FB "LDA #$05,Y; CMPA #$04; ... CMPA #$05": what the operation puts in (4 the players, 5 a free player slot, else
# a child)
local story_actor_put_in 03E2FB a put_kind
# 03E7CF "LDA #$04,X; BEQ; LSR <$F1; DECA": the random player's kind, as a count of shifts of the players present
local story_random_player 03E7CF,03E7D7 a kind
# 03E1CB "CLRD; LDU #$002F; BSET A,X,U"
local story_clear_player 03E1CB d fill
# 03E122 "LDB #$39,X" (target_margin), 03E136 "SUBB ,S+" (less half of it, for the players)
local story_actor_run 03E122,03E136 b margin
# done: scenes/story_actor.c

# ---- scenes/stage_ends.c ----
# (the scenes' steps get and hand back X, Y and U as the dispatchers leave them: nothing reads them as a value, so
# their p_x, p_y, p_u stay)
# 025537 "LDX #$1A00", 02554F "STD ,X++": each line's x scroll of layer A
local dream_wave_draw 025537,02554F x line_scroll
# 0245FD/024600 "LDX #$2000; LEAX #$-01,X; BNE": a delay of 2000 turns
local stage_6_wake 024600,024603 x delay
local stage_6_wake_wave 024600,024603 x delay
# 024047 "LDB #$02; LBSR $867D": a free object of list 2, the police car (02404C "STA #$00,U")
local stage_1_end_put_police_car 024049,024079 u car object
# what scene_put_placement hands back: the object it put
local stage_5_end_set_up 024487 y object object
local stage_end_show_players 024501 y object object
# 0241FF "LDA <$F1; LBSR $7388" (a player's jumper, by the player), 024205 "STA #$32,Y" (its player), 024216 "LDA
# <$F2; STA #$30,Y" (the jumpers counted so far: the wait and speed of stage_end_exit_waits, stage_end_exit_speeds)
local stage_end_put_jumpers 024216 a jumper_number
# 024251 "LDX #$4D40" (the jumpers' list), 024256 "LDU #$771E; ... JSR [A,U]" (their steps by type), 024266
# "LEAX #$60,X"
local stage_end_run_jumpers 024251,024264,024266 x object object
local stage_end_run_jumpers 024258 u steps
# 02427E "LDA #$31,X" (its wait: blocked), 024287 "LDB #$32,X; CMPB #$04; ADDD #$3F28; LBSR $8680" (its player's yell)
local stage_end_jumper_wait 024287 b player
# 0242D0 "LDA #$0A,X; ADDA #$02; STA #$0A,X; STA #$0B,X": the jumper's zoom
local stage_end_jumper_fly 0242D3 a zoom
# 0245AD "LDX #$18E0; LEAY ,X; CLR ,X+; LDU #$001F; BMOVE Y,X,U": the scene's variables cleared
local stage_6_end_finish 0245B0,0245B7 y clear_from
local stage_6_end_finish 0245B2,0245B7 x clear_to
local stage_6_end_finish 0245B4,0245B7 u count
# 0246DF "LDD <$C6; SUBD #$0080; STD <$C6" (layer A's scroll y's low byte and fraction), 0246F1 "LDD <$D6; ADDD
# #$0040; STD <$D6" (layer B's)
local post_bonus_2_scene_pan 0246DF d layer_a_scroll_y_low
local post_bonus_2_scene_pan 0246F1 d layer_b_scroll_y_low
# done: scenes/stage_ends.c

# ---- scenes/stage_8_scenes.c ----
# what scene_put_placement hands back: the object it put (024BCB "LDA ,Y; ORA #$08; STA ,Y")
local stage_8_start_show 024BC8,024BDD,024BFF y object object
local stage_8_end_show 024E41 y object object
local stage_8_end_show_kind_13 024F06 y object object
# 024C33 "LDD $18EB; SUBD #$0009; CMPD #$0009; BGT; LDD #$0009; STD $18EB": the descent's speed, down to 9
local stage_8_start_descend 024C37,024C3F d descent_speed
# 024C46 "LDD <$D6; SUBD $18EB; STD <$D6": layer B's scroll y's low byte and fraction
local stage_8_start_descend 024C46 d scroll_y_low
# 024D0E "LDX #$18E0; LEAY ,X; CLR ,X+; LDU #$001F; BMOVE Y,X,U": the scene's variables cleared
local stage_8_start_finish 024D11,024D18 y clear_from
local stage_8_start_finish 024D13,024D18 x clear_to
local stage_8_start_finish 024D15,024D18 u count
# 024DE3 "LDX #$3C00; LEAY ,X; CLR ,X+; LDU #$01FF; BMOVE Y,X,U": 3C00-3DFF cleared
local stage_8_end_set_up 024DE6,024DED y clear_from
local stage_8_end_set_up 024DE8,024DED x clear_to
local stage_8_end_set_up 024DEA,024DED u count
# 024D2A / 0251CF "LDX #$5280; ... JSR [A,U]; LEAX #$60,X": each object of list 2 run by its type (0251D6 "LDU #$7790")
local stage_8_start_run_players 024D2A,024D38,024D3A x object object
local stage_8_end_run_family 0251CF,0251DD,0251DF x object object
local stage_8_end_run_family 0251D6 u steps
# 024F2F "LDD $18F8; STD <$BE; STD <$CE" (both layers' scroll x), 024F39 "LDD $18FA; STD <$C5; STD <$D5" (scroll y)
local stage_8_end_reunion 024F2F a scroll_x_high
local stage_8_end_reunion 024F2F b scroll_x_low
local stage_8_end_reunion 024F39 a scroll_y_high
local stage_8_end_reunion 024F39 b scroll_y_low
# 024F8F "LDA $18FC; LSRA (x4); BNE" (a player number + 1 in the high nibble), 024FB7 "LDB #$01; TSTA; BEQ; ASLB;
# DECA" (its bit); else 024F99 "LDA <$85; LDB #$01; STB <$F0; LDB #$04; BITA <$F0; ... ASL <$F0; DECB" (the first
# player present)
local stage_8_end_reunion 024F96,024FBD a shifts
local stage_8_end_reunion 024FB7,024FBC b bit
local stage_8_end_reunion 024F99 a present
local stage_8_end_reunion 024FA1,024FAB b count
# 0251B4 "CLRB; LDA <$16; ANDA #$20; BEQ; LDB #$80; STB $4DA0; STB $4DA6": blinking every 32 frames
local stage_8_end_reunion 0251B4,0251BC b blink_flags
# 02521C "LDD #$0C,X; ADDD #$2B,X; SUBD $18F4; BMI; CMPD #$0020": how far past the meeting place it is
local stage_8_end_walker_arrive 025222 d distance
local stage_8_end_extra_arrive 025263 d distance
# done: scenes/stage_8_scenes.c

# ---- scenes/stories.c ----
# 03E82A "LDY #$47,X", 03E842 "LDY #$43,X", 03E84B "LDY #$45,X": the actor's children (its slots 43-48);
# 03E83A "LDA #$06,Y; ORA #$80; STA #$06,Y" (their animation_flags)
local stage_2_events 03E82A,03E842,03E84B y child object
local stage_2_events 03E83D a animation_flags
# 03E9CE "LDA $1854; LBEQ; LDY $1852; DECA; STA #$2A,Y": a wait handed to the noted actor (03E812 "STX $1852")
local stage_8_events 03E9CE a wait
# 03E9EA/03EA24 "LDU $1852": the noted actor (03E9EE "LDD #$0C,U; CMPD #$00AF": its x)
local story_stage_8_end 03E9EA,03EA24 u noted_actor object
local story_stage_8_end 03E9EE a noted_x_high
local story_stage_8_end 03E9EE b noted_x_low
# 03E9FB "LDD #$0200", 03EA00 "LDD #$FE00", 03EA03 "STD #$31,X": the speed it is given
local story_stage_8_end 03E9FB,03EA00 a speed_high
local story_stage_8_end 03E9FB,03EA00 b speed_low
# 03EA0E "LBSR $67F3" (story_first_player), 03EA11 "LDA #$00,X; BEQ; ORA #$40; STA #$00,X" (its flags), 03EA37
# "LBSR $67FC" (story_next_player)
local story_stage_8_end 03EA0E,03EA37 x player object
local story_stage_8_end 03EA11 a flags
# 03FDD2 "LDD <$AC; CMPD #$033C" (camera_x), 03FDDF "LDD #$FE00", 03FDE4 "LDD #$0200" (the speed), 03FDEC/03FE14
# the players
local story_burns_robot_entrance 03FDD2 a camera_x_high
local story_burns_robot_entrance 03FDD2 b camera_x_low
local story_burns_robot_entrance 03FDDF,03FDE4 a speed_high
local story_burns_robot_entrance 03FDDF,03FDE4 b speed_low
local story_burns_robot_entrance 03FDEC,03FE14 x player object
local story_burns_robot_entrance 03FDEF a flags
# 03ED37 "LDY #$7EDC; LEAY A,Y" (8 bytes by scene), 03ED3C "LDX #$1840; LDU #$0008; BMOVE Y,X,U"
local scene_load_story_settings 03ED3A,03ED42 y settings
local scene_load_story_settings 03ED3C,03ED42 x copy_to
local scene_load_story_settings 03ED3F,03ED42 u count
# done: scenes/stories.c

# ---- scenes/story_1.c ----
# 0277D6 "LDX ,U++; LDA #$80; STA #$06,X; STA #$00,X; LDA ,U+; STA #$04,X; ... LDD ,U; STD #$16,X": a record (the
# object, its kind, animation, x, y, z) put in, its object handed back in X
local story_put_object 0277D6 x object object
# what story_put_object hands back (0275D6 "LDA #$40; STA #$09,X": its attributes)
local story_1_street 02734D x object object
local story_1_pan_right 0274B0 x object object
local story_1_marge_walks_in 0275D3 x object object
local story_1_homer_walks_in 0275F1 x object object
local story_1_bart_walks_in 027625 x object object
local story_1_lisa_walks_in 027643 x object object
local story_1_smithers_runs_in 02768C x object object
local story_1_first_goon_appears 02770D x object object
local story_1_second_goon_appears 02772A x object object
local story_1_text_appears 027776 x object object
# 0275C7 "LDU #$7F05; LDA #$01,X; ASLA; JMP [A,U]": the character's steps by its type
local story_1_marge 0275C7 u steps
local story_1_homer 0275E5 u steps
local story_1_bart 027619 u steps
local story_1_lisa 027637 u steps
local story_1_smithers 027680 u steps
local story_1_first_goon 027701 u steps
local story_1_second_goon 02771E u steps
local story_1_dropped_object 0277AE u steps
# 0273E3 "LDX #$7EDD; LDA $18E1; ASLA; JMP [A,X]": the scene's steps by its sub-step
local story_1_rise 0273E3 x steps
local story_1_pan 02748A x steps
local story_1_end 02752A x steps
# 0275AB "LDX #$4A40; ... JSR [A,U]; LEAX #$00C0,X": the four players' objects; 027656 "LDX #$4FE0 ... LEAX #$60,X"
local story_1_family 0275AB,0275B7,0275B9 x object object
local story_1_runners 027656,027662,027673 x object object
# 027664 "LDA #$09,X; ANDA #$BF; BPL; ORA #$40; STA #$09,X": facing the way it goes
local story_1_runners 027667,02766E a attributes
# 02741E "LDD $18E5; ADDD #$000A; STD $18E5; TSTA": the rise's speed slowing to 0
local story_1_rise_slow_down 027422 a speed_high
# done: scenes/story_1.c

# ---- stages/rank.c, stages/stage.c, stages/stage_events.c ----
# 040C56 "LDA #$1F; STA <$61": the rank a game starts at
local rank_update 040C56 a start_rank
# 040C65 "LDX #$7782; LDA <$11; BNE; LDA <$14; BRA; LDA #$01; LDA A,X": the difficulty setting (1 in the attract)
local rank_add_base 040C6D,040C72 a setting
# 040CA0 "LDA #$05; STA <$62": the first of the rank's time steps
local rank_add_time_step 040CA0 a time_step
# 040D1F "LDB #$02; LBSR $867D" (a free object of list 2), 040D26 "STU <$A2" (hurry_up_object)
local hurry_up_timer 040D21 u hurry_object object
# 040D36 "LDA <$57; DECA; ANDA #$03; ... ADDA <$14; ... ADDA #$01; STA <$xx": the spawning level by players and difficulty
local set_spawn_level 040D3A,040D41,040D46 a level
# 07BAA0 "LDA <$67; ASLA; LDX A,X" (the scene's music by stage part), 07BAA6 "LDA <$80; ASLA" (the part, twice as far
# in scene 6, which has two), 07BAB4 "LDD ,X++; LBSR $97E3"
param play_scene_music x music_by_scene
local play_scene_music 07BAA4,07BAB4 x scene_music
local play_scene_music 07BAA9,07BAB1 a part_offset
# 02AD2A/02AD3C "LBSR $862C" (spawn_child: the new child in U), 02AD41 "STX #$2A,U" (this object its parent)
local cleared_wave_start 02AD2A,02AD3C u child object
# 02AD8F "LDY #$79F1; LDA #$30,X; LDB A,Y" (enemy_waves_end_enemies by the next wave), 02AD9D "ASLA; LDY A,Y" (its spawns)
local enemy_waves_start 02AD92 a wave
local enemy_waves_start 02AD9D a wave_offset
# 02ADE4 "LDB #$0005,Y; LBSR $86AA" (find_free_slot_by_flags): the enemy the wave spawns
local enemy_waves_spawn 02ADE8 u enemy object
# done: stages/ending.c stages/rank.c stages/stage.c stages/stage_1.c stages/stage_2.c stages/stage_events.c stages/stories.c

# ---- stages/scroll.c ----
# 026079 "LDD <$E2; ADDD #$0001; CMPD #$0090; STD <$E2": the cemetery's scroll speed
local cemetery_scroll_speed_up 02607C d speed
# 0260C5 "LDX #$4460", 0260D2 "LDB #$10" (tile 10), 0260D6 "STB ,X+", 0260DF "LEAX #$40,X": 6 rows of 9 tiles blanked
local cemetery_scroll_slow_down 0260C5,0260D6,0260DF x tile
local cemetery_scroll_slow_down 0260D2 d tile_code
# 0260F9 "CLRB; LBSR $867D" (a free object of list 0), 0260FD "LDA #$3E; STA #$01,U" (its type)
local cemetery_put_in_boss 0260FA u new_object object
# 02613F "LDD <$B9; ADDD <$E2; STD <$B9; LDA <$B8; ADCA #$00": the cemetery's scroll (cemetery_scroll) moved up
local cemetery_scroll_up 026142 a scroll_high
local cemetery_scroll_up 026142 d scroll_low
local cemetery_scroll_up 02614E a scroll_high
# 026167 "LDA <$AB; ASLA; ... LDU #$7948; LEAU B,U; JMP [A,X]": stage 5's scroll step and its place's record
local stage_5_scroll 02616A a step_offset
local stage_5_scroll 02616E u part
param stage_5_next_part u part
# 026172 "LDD <$AC; CMPD ,U++" (the part's place), then its sound command
local stage_5_next_part 026175 u part
# 02620E "SEX; ADDD <$86; STD <$86; STD $1FA0": the sprites' scroll x, shaken
local screen_shake_advance 02620F a sprite_scroll_x_high
local screen_shake_advance 02620F b sprite_scroll_x_low
# 026257 "LDX <$A4" (stage_record_entry), 02625A "LDU #$02,X" (the entry's data: its x check, its y check, the layers'
# ratios, its flags, read on by camera_check_x, camera_check_y, camera_scroll_layers, 0262AC "LDA ,U+")
local camera_update 02625A,02626F,026271,02629A,0262AC u entry_data
param camera_check_x x entry
param camera_check_x u entry_data
local camera_check_x 0262EF,0262F1,0262F5,0262FE,026300 u entry_data
param camera_check_y x entry
param camera_check_y u entry_data
param camera_scroll_layers u entry_data
local camera_scroll_layers 026413,02643E u entry_data
# each check's handler gets the check (its kind, then 0262F8 "LDD #$01,U": its x, or 026354 "LDA #$01,U": its ratio)
param camera_next_entry_at_x u check
# 02634E "LDD <$E0" (the y move), 026357 "LBSR $64E1" (camera_scale_move: the x move it makes)
local camera_x_follows_y_down 02634E d y_move
local camera_x_follows_y_down 026357 d x_move
local camera_x_follows_y_up 026369 d y_move
local camera_x_follows_y_up 026370 d x_move
# 026413 "LDA ,U+; STA <$94" (the camera's main layer), 02641C/026436 "LDX A,X" (a layer's scroll record:
# layer_scroll_move), 026438 "LDD <$DE" (the x move), 02643E "LDA ,U+" (the other layer's ratio), 026448 "LDD <$E0"
local camera_scroll_layers 026413 d main_layer
local camera_scroll_layers 02641C,026436 x scroll
local camera_scroll_layers 026438 d x_move
local camera_scroll_layers 02643E d ratio
local camera_scroll_layers 026442 d layer_x_move
local camera_scroll_layers 026448 d y_move
local camera_scroll_layers 026450 d layer_y_move
# 026483 "LDY ,X" (where the layer's scroll x is), 026496 "LDY #$02,X" (its scroll y)
local layer_scroll_move 026483,026496 y scroll_variable
# 0264AB "LEAX #$04,X; STX <$A4; LDU #$02,X": the stage record's next entry
local camera_next_entry 0264B1 u entry_data
param camera_entry_start_going_up x entry
param camera_entry_start_going_down x entry
# 0264D8 "CLRB; SUBD <$AD; INCA; STD <$DE": the x move to just past the last entry's x
local camera_move_to_last_entry_x 0264E0 d x_move
# 0264E1 "LDY #$7A53; ASLA; JMP [A,Y]": the move in F0 scaled by the ratio A
param camera_scale_move x entry
param camera_scale_move d ratio
local camera_scale_move 0264E4 a ratio_offset
local camera_scale_quarter 0264EE d scaled_move
local camera_scale_half 0264F4 d scaled_move
local camera_scale_same 0264F5 d scaled_move
local camera_scale_double 026500 d scaled_move
local camera_scale_quadruple 026508 d scaled_move
local camera_scale_quarter 0264E7,0264EA a move_high
local camera_scale_quarter 0264EB b move_low
local camera_scale_half 0264EF a move_high
local camera_scale_double 0264FB b move_low
local camera_scale_quadruple 026505 a move_high
local camera_scale_quadruple 026501,026504 b move_low
# 02797B "LDA <$AB; BITA #$20; ... ANDA #$07" (the dream's scroll step as a frame count)
local dreamland_scroll 02797B,02799E,0279A6 a scroll_step
# done: stages/scroll.c

# ---- stages/stage_3.c ... stage_8.c ----
# 07AA88 "LDX #$4000; LEAY ,X; LDA #$FF; STA ,X+; LDU #$07FF; BMOVE Y,X,U": the floor map 4000-47FF filled with FF
local stage_3_cemetery_begin 07AA8B,07AA94 y fill_from
local stage_3_cemetery_begin 07AA8F,07AA94 x fill_to
local stage_3_cemetery_begin 07AA91,07AA94 u count
# 07B17A "LDX #$18E0; LEAY ,X; CLR ,X+; LDU #$001F; BMOVE Y,X,U": the scene's variables cleared
local stage_7_closing_scene 07B17D,07B184 y clear_from
local stage_7_closing_scene 07B17F,07B184 x clear_to
# done: stages/bonus_1.c stages/bonus_2.c stages/stage_3.c stages/stage_4.c stages/stage_5.c stages/stage_6.c stages/stage_7.c stages/stage_8.c

# ---- stages/title_cards.c ----
# 02719A "LDU #$7E81; CLRB; EXG A,B; ASLB; ROLA (x3); LEAU D,U; LDY ,U++; LDA #$80; STA ,Y": the title card's picture
# number A of stage_title_placements put in, its object handed back in Y
param title_card_put_picture d record_number
local title_card_put_picture 0271AA y object object
# what title_card_put_picture hands back (026EA1 "STD #$11,Y" ...)
local stage_1_title_show 026E9F,026EAA y object object
local stage_2_title_show 026F53 y object object
local stage_3_title_show 026FAF y object object
local stage_4_title_show 026FEE y object object
local stage_5_title_show 02704F y object object
local stage_6_title_show 02708E y object object
local stage_7_title_show 0270C3,0270DA y object object
local stage_8_title_show 027165 y object object
local stage_7_title_second_picture 027126 y object object
# 026E97 "LDU #$7D8C; CLRA; LBSR $85A5" (print_text): the stage's title
local stage_1_title_show 026E97,026E9B u text
local stage_2_title_show 026F45,026F49 u text
local stage_3_title_show 026FA1,026FA5 u text
local stage_4_title_show 026FE0,026FE4 u text
local stage_5_title_show 027041,027045 u text
local stage_6_title_show 027080,027084 u text
local stage_7_title_show 0270BA,0270BE u text
local stage_8_title_show 027157,02715B u text
# 027113 "LDD #$16,X; CMPD #$0046": the picture's z
local stage_7_title_second_picture 027113 d z_low
# done: stages/title_cards.c

# ======== parameters and locals: bonus, test mode, video, system, game, engine ========
# ======== parameters and locals named after a register ========
# Evidence: build/listing/simpsons.s as PLACE "INSTRUCTION", the C of the C.

# ---- video/text.c (and the printers folded into system/jump_table.c) ----
# print_game_text's D: A the colour (079311 "STA <$E8", 079319 "LDA <$E8"), B the text's number in game_texts, bit 7
# set to erase it (07931C "ASLB; BCS $9346", 079331/079358 "LDU B,X" with X = game_texts' address); its callers load
# it as "CLRA; LDB #$06" (boot 07883B) or from a job (job_print_game_text)
param print_game_text d text_number
local print_game_text 079319 a colour_byte
local print_game_text 07931C b text_offset
# the text's address from game_texts (079331/079358 "LDU B,X"), handed to print_text / erase_text, which leave U past it
local print_game_text 079331,079358,079333,07935A u text
# print_text / erase_text: X the tile RAM place the text starts at (07936D/079384 "LDX ,U++"), moved one tile at a
# time (07937F "STB ,X+"); B each character (07936F "LDB ,U+"; '#' the end, '/' a new place) and its tile (079379
# "SUBB #$30"); print_text leaves X past the last tile
local print_text 07936D,07937F x place
local print_text 07936F b character
local print_text 079379 b tile
local erase_text 079384,079396 x place
local erase_text 079386 b character
# print_hex_byte / print_bcd_byte: A the byte printed, B the colour (07945C "PUSHS U,A", 079469 "STB #$-2000,X" the
# colour under each tile; 07940A "STB #$-2000,X"); print_hex_word hands them its value's bytes with the colour of
# 48F0 (07947F "LDB <$F0; BSR $945C")
param print_hex_byte d value
param print_bcd_byte d value
local print_hex_byte 07945C a printed_byte
# each hex digit's tile (079467/079473 "LDA A,U" with U = hex_digit_tiles, 07945E "LDU #$E435")
local print_hex_byte 079467,079473 a digit_tile
local print_hex_byte 07946D x place
local print_hex_word 079486 b colour
# print_bcd_byte: the high digit (079402-079405 "LSRA" x 4), a blank tile 10 for a leading 0 (079408 "LDA #$10")
local print_bcd_byte 079405,079408 a high_digit
local print_bcd_byte 07940E x place
# print_bcd_word: the four digits from the top (079420 "LSRA"/079423 "LDA #$10", 07942D "ANDA #$0F"/079431 "LDA #$10",
# 079440 "LSRA"/079448 "LDA #$10"; the last at 079452), the low byte (079439 "TFR B,A")
local print_bcd_word 0786A7 a high_byte
local print_bcd_word 079420,079423 a digit_1
local print_bcd_word 07942D,079431 a digit_2
local print_bcd_word 079439 a low_byte
local print_bcd_word 079440,079448 a digit_3
local print_bcd_word 079429,079437,07944E x place
# print_big_text: A the colour (its callers' D: "LDA #$..; LDU #text"), 2 added for the big letters' tile bank (07939B
# "ADDA #$02"), written under each of a character's 2 x 2 tiles (0793AD "STA #$-2000,X"); B the character (07939F
# "LDB ,U+") and its first tile, 4 per character (0793A9 "SUBB #$30; ASLB; ASLB"), the next ones (0793B3/0793BB
# "INCB"); X the place (07939D "LDX ,U++"), 2 tiles on per character (0793CB "LEAX #$02,X")
param print_big_text d colour
local print_big_text 0786C8,07939B a attribute
local print_big_text 07939F b character
local print_big_text 0793AC,0793B3,0793BB b tile
local print_big_text 07939D,0793CB x place
local erase_big_text 0793D1,0793FA x place
local erase_big_text 0793D3 b character
# done: video/text.c

# ---- video/palette.c ----
# palette_request's D is the request's argument, which it hands each kind's routine (07BAC7 "PUSHS D" ... 07BAD6 "JSR
# ,X"; request_palette_sets 07BAEC "STD <$E8", request_palette_clear 07BC78 "STA <$E8", ...): a set, an effect's
# number, a colour or the bits of the palette ranges with the frames; U is a palette job's slot: the one kind 8 starts
# the effect again in (07BB12 "LDA ,U; CMPA #$02"), and on the way back the job each kind took (find_free_palette_job)
param palette_request d request
param palette_request u palette_job
local palette_request 07BAD6 d request
param request_palette_sets d request
param request_palette_effect_in_slot d request
param request_palette_effect d request
param request_background_colour d request
param request_palette_fade d request
param request_white_flash d request
param request_palette_clear d request
# find_free_palette_job: the jobs' slots, 8 bytes each from 3C00 (07BF39 "LDU #$3C00", 07BF45 "LEAU #$08,U"), the
# free one handed back (07BF41 "LDA ,U; BEQ")
# kind 8: the slot's kind (07BB15 "LDA ,U; CMPA #$02; BNE $BB1F"), the request handed on to a new job (07BB19 "BNE
# $BB1F": D as it came)
local request_palette_effect_in_slot 07BB15 a job_kind
local request_palette_effect_in_slot 07BB19 d request
# the effect's frames between steps (07BB57 "LDA ,X+; STA #$04,U; STA #$05,U")
local request_palette_effect_in_slot 07BB57 a delay
local request_palette_effect 07BB57 a delay
# the mask of the fade's steps built from the request's bits (07BBEC "LDD <$EA; STD #$01,U; STD #$05,U")
local request_palette_fade 07BBEC a fade_mask_high
local request_palette_fade 07BBEC d fade_mask
# the white flash: palette RAM 0C00-0DFF filled with FFFF, a word at a time (07BC0E "LDX #$0C00", 07BC11 "LDY #$0100",
# 07BC17 "STD ,X++", 07BC19 "LEAY #$-01,Y"); the board's control byte with the palette RAM shown (07BC03 "ORA #$01")
# and hidden (07BC23 "ANDA #$FC"); the request's bits (07BC34 "LDA <$E8"), the K053251 priorities they give (07BC32
# "LDB #$10" ... 07BC5F "LDB #$06", stored at 07BC3D "STB <$EA", 07BC61 "ORB <$EB")
local request_white_flash 07BC0E,07BC17 x colour_place
local request_white_flash 07BC11,07BC19 y words_left
local request_white_flash 07BC03,07BC23 a control
local request_white_flash 07BC34 a layer_bits
local request_white_flash 07BC32,07BC3B,07BC40,07BC46,07BC4E,07BC54,07BC59,07BC5F b priority
# run_palette_jobs: each of the 64 slots (07BC8B "LDU #$3C00", 07BCA1 "LEAU #$08,U", kept round the job: 07BC97 "PUSHS
# U",
# 07BC9F "PULLS U"), its kind (07BC93 "LDA ,U; BEQ"), which picks the job's routine (07BC99 "JSR [A,X]"), each handed U
local run_palette_jobs 07BC93 a job_kind
# each job's routine and the effect's steps take the job's slot in U and keep their state in its bytes (07BCC6 "CLR ,U",
# 07BD0D "LDA #$04,U", 07BD67 "STX #$02,U", 07BDB0 "CLR ,U", 07BDB4 "STA #$01,U", 07BDC8 "CMPA #$07,U", 07BDF6 "LDD
# #$01,U", 07BE1C "LDD #$03,U", 07BEF6 "CLR ,U"...); named here as well since palette_job_fade's table hands
# palette_effect_* other values
# job 1: the set's number (07BCD1 "LDB #$02,U", bit 7 the high sets: 07BCD9 "ANDB #$7F") and its offset (07BCDB "ASLB"),
# the bit of each of the 4 loads (07BCE6 "ANDA #$01"), the load's place in the palette RAM (07BCEC "LDX #$02,Y")
local palette_job_load_sets 07BCD1,07BCD9 b set_number
local palette_job_load_sets 07BCDB b set_offset
local palette_job_load_sets 07BCE6 a load_bit
local palette_job_load_sets 07BCEC x destination
# job 2: the frames waited (07BD0D "LDA #$04,U; CMPA #$05,U"), the step's place in the effect's script (07BD28 "LDX
# #$02,U"; palette_effect_forward and _backward take it as step) and its first byte, 80 and up a command (07BD2B "LDA
# ,X; BPL")
local palette_job_effect 07BD0D a frames_waited
local palette_job_effect 07BD28 x step palette_effect_step
local palette_job_effect 07BD2B a step_mark
# the colours of a step left to set (07BD51 "LDA #$06,U; STA <$F0", 07BD5D "LDA <$F0; BEQ")
local palette_effect_forward 07BD5D a colours_left
# the first byte of the step before, negative at the script's start (07BD85 "LEAX #$-08,X; LDA ,X; BPL")
local palette_effect_backward 07BD88 a step_mark
# the command's number (07BDAB "ANDA #$7F"; 07BDAD "ASLA; JMP [A,Y]")
local palette_effect_command 07BDAB a command
# command 81: back a step from the command (07BDB9 "LEAX #$-04,X; STX #$02,U")
param palette_effect_reverse x step
# command 82: X the command's step (07BDC1 "LDA #$01,X": the times to go back, FF for ever; 07BDD0 "LDX #$02,X": the
# step it goes back to)
param palette_effect_repeat x step
local palette_effect_repeat 07BDC1 a repeat_count
# the board's control byte with the palette RAM shown (07BDEB "ORA #$01") and hidden (07BE04 "ANDA #$FC"); the colour
# from the job (07BDF6 "LDD #$01,U; STD $0C00")
local palette_job_background_colour 07BDEB,07BE04 a control
local palette_job_background_colour 07BDF6 a colour_high
local palette_job_background_colour 07BDF6 d colour_low
# jobs 4 and 5: the frames left (07BE1C "LDD #$03,U; BEQ $BE88")
local palette_job_darken 07BE1C d frames_left
# the fade: the job's mask copied again every 16 steps (07BE2B "LDD #$01,U; STD #$05,U"), the step's bit (07BE37 "ANDA
# #$01"), the board's control byte (07BE42 "ORA #$01", 07BE7C "ANDA #$FC"), each colour of the step's range (07BE5C
# "LDU ,X" fade_range's address, 07BE67 "LEAU #$02,U"), handed to darken_colour / brighten_colour (07BE65 "JSR [A,Y]")
local palette_job_fade 07BE2B d fade_mask
local palette_job_fade 07BE37 a step_bit
local palette_job_fade 07BE42,07BE7C a control
local palette_job_fade 07BE5C,07BE65,07BE67 u colour_place
param darken_colour u colour_place
param brighten_colour u colour_place
# the colour read (07BF98 / 07BFD5 "LDD ,U; STD <$EA") and the new one (07BFCB "SUBD <$E8", 07C010 "ADDD <$E8"; "STD
# ,U")
local darken_colour 07BF98 a colour_high
local darken_colour 07BFCB d colour
local brighten_colour 07BFD5 a colour_high
local brighten_colour 07C010 d colour
# job 6: palette RAM 0C00-0DFF cleared a word at a time (07BEC4 "LDX #$0C00", 07BEC7 "LDY #$0100", 07BECB "STD ,X++",
# 07BECD "LEAY #$-01,Y"); the K053251 priorities (07BEAC "LDA #$04,U; STA $1FBA", 07BE9D "LDA #$2C; STA $1FBA"); the
# board's control byte (07BEB9 "ORA #$01", 07BED7 "ANDA #$FC")
local palette_job_white_flash 07BEC4,07BECB x colour_place
local palette_job_white_flash 07BEC7,07BECD y words_left
local palette_job_white_flash 07BEAC,07BE9D a priority
local palette_job_white_flash 07BEB9,07BED7 a control
# job 7: the bytes of each range cleared (07BF12 "LDU ,X++", palette_clear's extra_bytes; 07BF16 "LEAY ,X; CLR ,X+;
# BMOVE Y,X,U"); the board's control byte (07BEEB "ORA #$01", 07BF2D "ANDA #$FC")
local palette_job_clear 07BF12,07BF1A u count
local palette_job_clear 07BF18,07BF1A x clear_to
local palette_job_clear 07BEEB,07BF2D a control
# load_palettes: X the palette RAM's place (07BF75 "LDD ,U++; STD ,X++"; boot 0788C1 "LDX #$0000"..., job 1 07BCEC "LDX
# #$02,Y"), A the number of palettes of 16 colours (07BF6D "STA <$E8", 07BF70 "LDB #$10"; boot 0788C7 "LDA #$0F")
param load_palettes x destination
param load_palettes d palette_count
local load_palettes 07BF56,07BF88 a control
local load_palettes 07BF75 a colour_high
local load_palettes 07BF75 b colour_low
# done: video/palette.c

# ---- system/interrupts.c ----
# the coin counters' outputs, a bit each (078F91 "ANDA #$FE", 078FAB "ORA #$01", 078FD4 "ANDA #$FD", 078FEE "ORA #$02";
# each "STA <$10; STA $1FC0")
local irq_handler 078F91,078FAB,078FD4,078FEE a output
# the coin slots' records counted into (079005 "LDU #$4817", 079012 "LDU #$481F", 079024 "LDU #$4827", 079031 "LDU
# #$482F"; add_coin's slot)
# the sound queue's place read (079054 "LDX $4902; CMPX $4900", 07905E "LDD ,X++; STD $1FC6", 07906D "LDX #$4904" back
# to its start, 079070 "STX $4902")
local irq_handler 079054,07905E,07906D x queue_place
# the board's control byte, kept on the stack at the start (078F5B "LDA <$0F; PUSHS A") and put back (079079/079149
# "PULLS A; STA <$0F; STA $1FC2"), with the tile ROM read and the palette RAM off (0790D2 "ANDA #$FC") and the FIRQ
# on (079159 "ORA #$04"); the K053246's control with its interrupt on (079169 "ORA #$10; STA <$55; STA $1FA5")
local irq_handler 079079,079149,0790D2,079159 a control
local irq_handler 079169 a sprite_control
# the high bit of each layer's x scroll less 5A (0790B9 "SUBD #$005A", 0790BC "ANDA #$01", 0790BE "EXG A,B; STD
# $1A00"; 0790E3 for layer B, "STD $3A00")
local irq_handler 0790BC,0790E3 a scroll_x_high
# U as the IRQ leaves it for the routine of the game's state (079141 "JSR [A,X]"): the last controls' port read
# (0790AD "LDU #$1F93", player 4's, 0790B3 "LBSR $9248" read_controls), which nothing after changes; the routines
# hand it on, and a palette request swaps it for its palette job
local irq_handler 0790AD u controls_port
# the FIRQ: the board's control byte with the FIRQ off (0791B9 "ANDA #$FB; STA <$0F; STA $1FC2") and the K053246's with
# its interrupt off (0791C9 "ANDA #$EF; STA <$55; STA $1FA5")
local firq_handler 0791B9 a control
local firq_handler 0791C9 a sprite_control
# test_mode_start clears the test mode's variables 5900-59EF (079193 "LDX #$5900; LEAY ,X; CLR ,X+; LDU #$00EF; BMOVE
# Y,X,U": each byte copied from the one before)
local test_mode_start 079196,07919D y clear_from
local test_mode_start 079198,07919D x clear_to
local test_mode_start 07919A,07919D u count
# done: system/interrupts.c

# ---- system/inputs.c ----
# coin_inserted: A the coin slot's bit in the coin inputs (the IRQ's 078FFE "LDA #$01", 07900B "LDA #$02", 07901D "LDA
# #$04", 07902A "LDA #$08"; 0791D8 "PUSHS A", 0791E4 "ANDB ,S"); B the slot's bit when its coin went in (0791DA-0791E4
# "LDB <$3D; ORB <$3E; COMB; ANDB <$3F; ANDB ,S": released after being held)
param coin_inserted d coin_bit
local coin_inserted 0791E4 b inserted
# add_coin: the slot's coins (079202 "LDA #$02,U; CMPA #$05,U"), the coins a credit takes (07921E "LDA <$1C", 079226
# "ADDA <$3A" first_credit_extra_coins when the slot has had no credit yet), whether it has (079221 "LDB #$07,U";
# 079242 "LDA #$01; STA #$07,U")
local add_coin 079202 a coins
local add_coin 07921E,079226 a coins_needed
local add_coin 079221 b first_credit_given
# done: system/inputs.c

# ---- game/game.c ----
# what gauges_count_delays leaves in Y: the counters of the last player's gauge, Lisa's (0408E5 "LDX #$7294; ASLA; LDX
# A,X", 0408EB "LDY #$02,X" each player's, the loop ends at the fourth: 0408FB "CMPA #$04"); game_mode_frame hands it
# on to the routine of the game's phase (07A3AA "LBSR $600F", 07A3B7 "JSR [A,X]"), whose step routines hand it to the
# stages' runs
local game_mode_frame 07A3AA y gauge_counters
# end_game: each player's play status (07B6B3 "LDX #$49F0; LDA ,X; CMPA #$02", 07B6C8 "LEAX #$01,X") and the life it
# keeps between stages (07B6B6 "LDU #$49D2; LDA #$28; STA ,U", 07B6CB "LEAU #$08,U"), the 4 players (07B6B9 "LDB
# #$04", 07B6CE "DECB")
local end_game 07B6B3,07B6C8 x play_status
local end_game 07B6B6,07B6CB u health_address
local end_game 07B6B9,07B6CE b players_left
# done: game/game.c

# ---- game/continue.c ----
# whether any player still plays (07B8BA "LDA $49F0; CMPA #$02" ... 07B8D2 "LDA $49F3")
local check_players_out 07B8BA,07B8C2,07B8CA,07B8D2 a play_status
# continue_screen: the seconds counted down in BCD (07B94E/07B974 "ADDA #$99; DAA"; 07B99B/07B9C2 "LDA $4A1C"), each
# player's variables (07B985/07B9CB "LDY #$49D0", 07B9AA/07B9ED "LEAY #$08,Y"; byte 7 its state: 07B989 "LDB #$07,Y;
# CMPB #$03"), the player's number in the loops (07B988/07B9CE "CLRA", 07B9A8/07B9EB "PULLS A", 07B9AD/07B9F0
# "INCA; CMPA #$04"), the address of its continue countdown (07B96D/07B998/07B9DE "LDU #$07,X", player's countdown)
local continue_screen 07B950,07B976,07B99B,07B9C2 a seconds
local continue_screen 07B989 b state
local continue_screen 07B988,07B9CE,07B9A8,07B9EB,07B9AD,07B9F0 a player_number
# done: game/continue.c

# ---- game/game_over.c ----
# a short delay (07B470 "CLRA", 07B471 "INCA; CMPA #$04; BNE")
local game_over_start 07B470,07B471 a delay
# the palette jobs 3C00-3DFF cleared (07B47C "LDX #$3C00; LEAY ,X; CLR ,X+; LDU #$01FF; BMOVE Y,X,U")
local game_over_start 07B47F,07B486 y clear_from
local game_over_start 07B481,07B486 x clear_to
local game_over_start 07B483,07B486 u count
# each player's score (07B4CE "LDX #$49D4", 07B4D1 "LDD ,X; LBSR $971A", 07B4DD "LEAX #$08,X")
local game_finish 07B4CE,07B4DD x score_address
# done: game/game_over.c

# ---- game/score.c ----
# the addition's low byte (079705 "LDA #$01,U") and the score's low byte with it (079708 "ADDA #$01,X; DAA")
local add_score 079705 a addition_low
local add_score 079708 a low_sum
# each high score's score (07971D "LDX #$4983": the table's first record's score, 07972A "LEAX #$08,X")
local high_score_rank 07971D,07972A x high_score_address
# insert_high_score: the place the new score goes (079750 "LDA <$E8; CMPA <$E9"), the records moved down a place
# (07974D "LDX #$49C8", 07975E "LDD #$-08,X; STD ,X++", 07976C "LEAX #$-10,X"), then the new one written (07977B "STD
# ,X++") from the initials and score at 48F0 (079776 "LDU #$48F0", 079779 "LDD ,U++")
local insert_high_score 079750 a insert_place
local insert_high_score 07974D,079765,07976C,07977B x record_place
local insert_high_score 079776,079779 u new_entry
# done: game/score.c

# ---- game/skip.c ----
# the players in the game, a bit each (07978C "LDB <$50", 0797A7 "LSRB")
local check_skip 07978C,0797A7 b player_bits
# done: game/skip.c
# done: game/attract.c (left: the credits' high bytes the checks load, the step's offsets)
# done: game/name_entry.c (its D are the arguments of calls whose parameters are named: palette_request, set_scroll_x)
# done: game/start.c

# ---- system/boot.c ----
# a short wait at the reset (0786CE "CLRA", 0786CF "INCA; BNE"), and the waits of 3 and 8 x 65536 loops (078903 "LDA
# #$03", 078911 "DECA"; 078A02 "LDA #$08", 078A10 "DECA"; 078905/078A04 "LDX #$0000", 078908/078A07 "LEAX #$-01,X")
local boot 0786CE,0786CF,078903,078911,078A02,078A10 a delay
local boot 078905,078908,078A04,078A07 x wait_left
# the RAM 5D00-5FFF tested with 00, 55, AA, FF (07875F "CLRA", 078785 "ADDA #$55; CMPA #$54"), 300 bytes (078760/078771/
# 07878B "LDU #$5D00", 078763/078774/07878E "LDX #$0300"; 078766 "STA ,U+", 078777 "CMPA ,U+", 078791 "CLR ,U+";
# 078768/07877C/078793 "LEAX #$-01,X")
local boot 07875F,078785 a pattern
local boot 078760,078766,078771,078777,07878B,078791 u test_place
local boot 078763,078768,078774,07877C,07878E,078793 x bytes_left
# the RAMs cleared (07879E-0787F0, each "LDX #start; LEAY ,X; CLR ,X+; LDU #count; BMOVE Y,X,U": 4000, 1840, 3840,
# 3C00, 2000, 0000)
local boot 0787A1,0787A8,0787AC,0787B3,0787BC,0787C3,0787C7,0787CE,0787D8,0787DF,0787E9,0787F0 y clear_from
local boot 0787A3,0787A8,0787AE,0787B3,0787BE,0787C3,0787C9,0787CE,0787DA,0787DF,0787EB,0787F0 x clear_to
local boot 0787A5,0787A8,0787B0,0787B3,0787C0,0787C3,0787CB,0787CE,0787DC,0787DF,0787ED,0787F0 u count
# the board's control byte (078829 "ANDA #$FC", 078983 "ANDA #$FC", 078995 "ORA #$04"; "STA <$0F; STA $1FC2") and the
# K053246's (0789A5 "ORA #$10; STA <$55; STA $1FA5")
local boot 078829,078983,078995 a control
local boot 0789A5 a sprite_control
# the EEPROM's screen flip setting (078884 "LDA #$6F", 078892 "LBSR $6012" eeprom_read_byte, 078895 "TSTB; BNE";
# 07889E "LDA #$01; STA $1E80")
local boot 078892 b screen_flip
# the job and sound queues filled with FFFF (078914 "LDX #$4944", 078929 "LDX #$4904"; 078922/078937 "STD ,X++")
local boot 078914,078922,078929,078937 x queue_place
# the high scores copied from default_high_scores (07893E "LDU #$4980", 078941 "LDX #$E380", 078944 "LDB #$50",
# 078946 "LDA ,X+; STA ,U+", 07894A "DECB")
local boot 07893E,078948 u high_score_place
local boot 078941,078946 x default_entries
local boot 078944,07894A b table_bytes_left
# the main loop: the job queue's read place (0789CB "LDX $4942", 0789D6 "STU ,X++", 0789DD "LDX #$4944"), the job's
# kind and argument (0789CF "LDD ,X; BMI"), the argument handed to the job's routine (0789E8 "JSR [A,X]" with
# 0789E4 "LDX #$E3FB")
local boot 0789CB,0789D6,0789DD x job_place
local boot 0789CF a job_kind
local boot 0789CF b job_argument
local boot 0789E8 d job_argument
# the RAM error's text (0789ED "LDB #$1B", 0789EF "LDU #$E3D0", 0789F2 "LDX #$2313", 0789F9 "LDA ,U+; SUBA #$30; STA
# ,X+", 0789FF "DECB")
local boot 0789EF,0789F9 u letters
local boot 0789F2,0789FD x place
local boot 0789ED,0789FF b letters_left
# apply_settings: the settings at 59F1 (078A1A "LDX #$59F1"), the coinage's byte (078A1D "LDU #$E3EB" coinages, 078A20
# "LDA ,X", 078A22 "LDA A,U"), its credits (078A26 "ANDA #$0F") and coins (078A33 "LSRA" x 4); the K053246's control
# with the flip
# bits (078A72 "ANDA #$FC", 078AA1 "ORA #$03"); the coin counters' output byte (078ACB "LDA #$30", 078AD2 "ORA #$04")
local apply_settings 078A1A x settings
local apply_settings 078A22 a coinage
local apply_settings 078A26 a coinage_credits
local apply_settings 078A33 a coinage_coins
local apply_settings 078A72,078AA1 a sprite_control
local apply_settings 078ACB,078AD2 a output
# draw_boot_pattern: the board's control byte (078AE3 "ANDA #$FC"), the tile RAM's place (078AEE "LDX #$200E", 078AF8
# "STU ,X++", 078AFD "LEAX #$1C,X"), 16 rows of two lines (078AF1 "LDB #$10", 078B0D "DECB"), 18 pairs of tiles a line
# (078AF3 "LDA #$12", 078AFA "DECA"), the pair (078AF5 "LDU #$2F2E", 078B02 "LDU #$2D2C")
local draw_boot_pattern 078AE3 a control
local draw_boot_pattern 078AEE,078AF8,078AFD,078B05,078B0A x place
local draw_boot_pattern 078AF1,078B0D b rows_left
local draw_boot_pattern 078AF3,078AFA,078B00,078B07 a pairs_left
local draw_boot_pattern 078AF5,078B02 u tile_pair
# test_ram_words: the pattern (078DCF "LDX #$FFFF", 078E0B "LEAX #$-5555,X": FFFF, AAAA, 5555, 0000), each word (078DDA
# "LDU $5D00", 078DDE "STX ,U++", 078DFA "LDU $5D00", 078E02 "CMPX ,U++"), the words left (078DD8/078DF8 "PULLS D"
# the count, 078DE5/078E06 "SUBD #$0001"), a wait (078DEA "LDD #$1000", 078DF1 "SUBD #$0001"); B 3 when one word does
# not read back (078E16 "LDB #$03"), else 0 (078E14 "CLRB")
local test_ram_words 078DCF,078E0B x pattern
local test_ram_words 078DDA,078DDE,078DFA,078E02 u word_place
local test_ram_words 078DD8,078DE5,078DF8,078E06 d words_left
local test_ram_words 078DEA,078DF1 d wait_left
local test_ram_words 078E14,078E16 d bad
# test_ram_bytes: the same a byte at a time (078E19 "LDA #$FF", 078E50 "SUBA #$55"; 078E21/078E3F "LDU $5D00", 078E25
# "STA ,U++", 078E47 "CMPA ,U++"; 078E1F/078E3D "TFR Y,X", 078E2C/078E4B "LEAX #$-01,X"; 078E31 "LDX #$1000", 078E38
# "LEAX #$-01,X"), B 3 when bad (078E57/078E5A "RTS")
local test_ram_bytes 078E19,078E50 a pattern
local test_ram_bytes 078E21,078E25,078E3F,078E47 u byte_place
local test_ram_bytes 078E1F,078E2C,078E3D,078E4B x bytes_left
local test_ram_bytes 078E31,078E38 x wait_left
local test_ram_bytes 078E57,078E5A d bad
# ram_rom_check: each test's B, 3 bad or 0 (078B35 "LBSR $8DCF" ... 078BAE "LBSR $8E19", 078BC1 "LBSR $600C"
# eeprom_verify; "STB <$..."), and each sum's (078C4C "CLRB", 078C4F "LDB #$03" ...; 078D4A/078D60 "CLRB", 078D4F/078D65
# "LDB #$03" for the Z80's answer's bits); the Z80's ROM sum (078D41 "LBSR $8ED2; STD <$FA") and its answers (078D23,
# 078D47, 078D5D "LBSR $8EB0; TSTA" / "BITA #$02" / "BITA #$01"); the last wait (078D72 "CLRA", 078D73 "CLRB", 078D74
# "SUBD #$0001")
local ram_rom_check 078B35,078B48,078B55,078B66,078B73,078B84,078B9B,078BAE,078BC1 b check_result
local ram_rom_check 078C4C,078C4F,078C94,078C97,078CD3,078CD6,078D12,078D15,078D4A,078D4F,078D60,078D65 b check_result
local ram_rom_check 078D23,078D47,078D5D a answer_bits
local ram_rom_check 078D41 a sum_high
local ram_rom_check 078D41 b sum_low
local ram_rom_check 078D72,078D74 a wait_high
local ram_rom_check 078D73,078D74 b wait_low
# set_check_colours: the palette RAM's place (078D92 "LDX #$0400", 078DA7 "LDX #$0420", 078D9C/078DB1 "STD ,X++"), the
# colour (078D99 "LDD #$FFFF" white, 078DAE "LDD #$001F" red)
local set_check_colours 078D92,078D9C,078DA7,078DB1 x colour_place
local set_check_colours 078D99,078DAE a colour_high
local set_check_colours 078D99,078DAE d colour_low
# print_rom_sum / print_check_result: the colour, 40 red when bad (078DC3 "LDB #$40; STB <$F0", 078E98 "LDB #$40"); the
# text OK or BAD (078E91 "LDX #$E41B", 078E97 "ABX" by the result, 078EA3 "LDA ,X+") and its tiles (078EA5 "SUBA #$30")
local print_rom_sum 078DC3 b colour
local print_check_result 078E98 b colour
local print_check_result 078E91,078E97,078EA3 x letters
local print_check_result 078EA5 a tile
# ask_sound_cpu_check: the command F181 (078EB0 "LDD #$F181; STD $1FC6"), whose 81 the Z80 sends back with its answer
# (078EC3 "CMPB $1FC7"), the wait (078EBB "LDX #$2000", 078EBE "LEAX #$-01,X"), the answer (078EC9 "LDD $1FC6"; 8F00
# when none: 078ECE "LDD #$8F00")
local ask_sound_cpu_check 078EB0 d command
local ask_sound_cpu_check 078EBB,078EBE x wait_left
local ask_sound_cpu_check 078EC9,078ECE d answer
# read_sound_rom_sum: the sum's high byte from command F383 (078ED5 "JSR $8F30"; "PUSHS A") and its low byte from F282
# (078EDE "JSR $8F30"), handed back in D (078EE6 "RTS")
local read_sound_rom_sum 078ED5 a sum_high
local read_sound_rom_sum 078EDE a sum_low
local read_sound_rom_sum 078EE6 d sum
# done: system/boot.c

# ---- system/eeprom.c ----
# the EEPROM's routines take and give D as A the address (0-7F) and B its byte (eeprom_write 05E8F3 "STA $5A00", 05E8F7
# "STB $5A01"; eeprom_read 05E915 "PUSHS U,A; STA $5A00", 05E925 "LDB $5A02", 05E930 "PULLS A,U,PC")
param eeprom_read d cell
param eeprom_write d cell
param eeprom_read_byte d cell
local eeprom_read 05E915 a address
local eeprom_read 05E925 b data
local eeprom_read 05E930 d cell
# eeprom_test: every address written with its own number (05EA21 "CLRA", 05EA22 "CLRB", 05EA26 "ADDD #$0101; CMPA
# #$80") and read back (05EA30 "CLRA", 05EA31 "LBSR $6915; CMPB <$F0", 05EA39 "INCA"); A 1 when one does not read back
# (05EA42), else 0 (05EA45 "RTS")
local eeprom_test 05EA21,05EA26,05EA30,05EA31,05EA39 a address
local eeprom_test 05EA22,05EA26,05EA31 b data
local eeprom_test 05EA42,05EA45 d bad
# eeprom_verify: the sum stored at 7E-7F (05EA6A "LDA #$7E", 05EA6C "LBSR $6915", 05EA6F "PUSHS B", 05EA71 "INCA",
# 05EA72 "LBSR $6915", 05EA75 "PULLS A", 05EA77 "CMPD <$F0"), B 3 bad (05EA7C "LDB #$03") or 0 (05EA7F "CLRB")
local eeprom_verify 05EA6C a address
local eeprom_verify 05EA6C b stored_high
local eeprom_verify 05EA72 b stored_low
local eeprom_verify 05EA75 a stored_high
local eeprom_verify 05EA7E,05EA80 d bad
# eeprom_load_settings: addresses 68-7D (05EA84 "LDA #$68", 05EA8B "INCA; CMPA #$7E") into 59F0 on (05EA81 "LDU
# #$59F0", 05EA89 "STB ,U+")
local eeprom_load_settings 05EA84,05EA86,05EA8B a address
local eeprom_load_settings 05EA81,05EA89 u setting_place
# the EEPROM's commands: lists of the control lines' values written to 1FC2 one at a time until FF (05E932 "LDX #$7C7C",
# 05E938, 05E98A, 05E9A1, 05E9A6, 05E9E0 "LDX #$7CF7"; 05E9E5 "LDA ,X+; STA $1FC2; ... CMPA #$FF")
local eeprom_send_unlock 05E932,05E9E5 x signals
local eeprom_send_write 05E938 x signals
local eeprom_deselect 05E98A x signals
local eeprom_send_lock 05E9A1 x signals
local eeprom_send_read 05E9A6 x signals
local unused_eeprom_send_ones 05E9E0 x signals
local eeprom_send_unlock 05E9E5 a signal
# the address's 7 bits and the data's 8 sent from the top (05E943 "LDB $5A00", 05E95D "ASLB"; 05E96A "LDB $5A01",
# 05E982 "ASLB"), each a value of the lines with the data bit (05E941/05E968 "LDA ,X+", 05E94B/05E972 "ORA #$80") and
# the clock's (05E954/05E97A "ORA ,X+")
local eeprom_send_address 05E941,05E954,05E95E x signals
local eeprom_send_address 05E941,05E94B,05E95E a signal
local eeprom_send_address 05E943,05E95D b address_bits
local eeprom_send_data 05E968,05E97A,05E983 x signals
local eeprom_send_data 05E968,05E972,05E983 a signal
local eeprom_send_data 05E96A,05E982 b data_bits
# the 8 bits received (05E9AB "LDX #$7D23", 05E9AE "LDB #$08", 05E9DC "DECB"; 05E9C6 "LDA $1F81; ANDA #$10", 05E9CE
# "LDA #$01": the bit read)
local eeprom_receive_data 05E9AB,05E9B4,05E9BD x signals
local eeprom_receive_data 05E9AE,05E9DC b bits_left
local eeprom_receive_data 05E9CA,05E9CE a data_bit
# eeprom_write_defaults: the factory settings from eeprom_factory_settings until FF (05EA46 "LDU #$7D36", 05EA4B "LDB ,U+;
# CMPB #$FF") at 68 on (05EA49 "LDA #$68", 05EA54 "INCA")
local eeprom_write_defaults 05EA46,05EA4B u defaults
local eeprom_write_defaults 05EA49,05EA54 a address
local eeprom_write_defaults 05EA4B b data
local eeprom_write_sum 05EA59 a address
# done: system/eeprom.c

# ---- system/jobs.c ----
# the queues' write places (0797C3 "STD ,X++", 0797CA "LDX #$4944"; 0797F8 "STD ,X++", 0797FF "LDX #$4904")
local queue_job 0797C3,0797CA x queue_place
local queue_sound_always 0797F8,0797FF x queue_place
# the jobs' B (the main loop's 0789CF "LDD ,X", 0789E8 "JSR [A,X]"): job 0 the layers to clear (0 all, 1 the text layer,
# 2 layer A, 3 layer B: 079808 "LDX #$E56C; ASLB; JSR [B,X]"), job 1 the game text's number (07981E "LDA <$71; LBRA
# $9311"), job 2
# the colour (079824 "STB <$71")
param job_clear_screen d layers_to_clear
param job_print_game_text d game_text
param job_set_text_colour d colour
# done: system/jobs.c

# ---- system/random.c ----
# 079548 "LDD <$58; PUSHS D", 07954D "ADDD <$58; STD <$58; ADDD <$58; ADDD ,S++; ADDD #$3711": five times it, plus 3711
local next_random 079548 d old_random
local next_random 07954D d doubled
# done: system/random.c

# ---- system/reset.c ----
# the variables cleared, each "LDX #start; LEAY ,X; CLR ,X+; LDU #count; BMOVE Y,X,U": a stage's (07960F 4870-48FF), the
# tile chip's RAM (079652 18E0, 07965D 1860, 079668 1840) and the palette jobs (079676 3C00), a game's (0796A3 4860)
# and 3840 (0796AE)
local reset_for_stage 079612,079619 y clear_from
local reset_for_stage 079614,079619 x clear_to
local reset_for_stage 079616,079619 u count
local reset_sprites_and_objects 079655,07965C,079660,079667,07966B,079672,079679,079680 y clear_from
local reset_sprites_and_objects 079657,07965C,079662,079667,07966D,079672,07967B,079680 x clear_to
local reset_sprites_and_objects 079659,07965C,079664,079667,07966F,079672,07967D,079680 u count
local reset_for_play 0796A6,0796AD,0796B1,0796B8 y clear_from
local reset_for_play 0796A8,0796AD,0796B3,0796B8 x clear_to
local reset_for_play 0796AA,0796AD,0796B5,0796B8 u count
# done: system/reset.c

# ---- video/background_maps.c ----
# the layers marked to draw, a bit each (07C388 "ORA #$02" layer A, 07C3DD "ORA #$01" layer B, 07C38F/07C3E4 "ORA #$04"
# the floor map with the camera's layer; "STA <$E0" columns, "STA <$E1" rows)
local draw_scrolled_layer_edges 07C388,07C38F,07C3B0,07C3B7,07C3DD,07C3E4,07C405,07C40C a layers_to_draw
local find_layer_column 07C57C,07C59D u tile_place
local find_layer_row 07C621,07C642 u tile_place
local find_layer_column 07C5E5,07C60A y map_cell
local find_layer_row 07C692,07C6AE y map_cell
# the layer (07C573/07C618 "STA <$E8"), the map's scene (07C5B5/07C64F "LDA <$75", 07C5BD/07C657 "ANDA #$7F" the high
# scenes), the lists of the scene's areas (07C5B2/07C64C "LDY #$06,X", 07C5BA/07C654 "LDY #$10,X" for the high scenes),
# the layer's map record kept round the reads (07C690 "PULLS D,X")
local find_layer_column 07C573 a layer
local find_layer_row 07C618 a layer
local find_layer_column 07C5B5,07C5BD a scene_number
local find_layer_row 07C64F,07C657 a scene_number
local find_layer_column 07C5B2,07C5BA y area_lists
local find_layer_row 07C64C,07C654 y area_lists
local find_layer_row 07C690 x layer_map layer_map
# draw_map_column / draw_map_row / fill_floor_map_column / fill_floor_map_row: Y the map's cell, 16 bytes a block on
# (07C780 "LEAY #$10,Y"; 07C807/07C865 "LDD ,Y++"), U the tile RAM's place (07C766 "LBSR $C6BD"), B (A for the block
# routines) the tile's column or row in the block (07C744 "STB <$F1", 07C763 "LDA <$F1"; 07C7F2 "STB <$F0", 07C810
# "LDA <$F0")
param draw_map_column y map_cell
param draw_map_column u tile_place
param draw_map_column d block_column
param draw_map_row y map_cell
param draw_map_row u tile_place
param draw_map_row d block_row
param fill_floor_map_column y map_cell
param fill_floor_map_column d block_column
param fill_floor_map_row y map_cell
param fill_floor_map_row d block_row
local draw_map_column 07C780 y map_cell
local draw_map_column 07C766,07C776 u tile_place
local draw_map_row 07C807 y map_cell
local fill_floor_map_row 07C865 y map_cell
# the block's number from the map's cell, 10 bits (07C75B "ANDA #$03"; 07C760 "LBSR $C8B1" find_map_block) and the
# block's column or row handed to the block's routine (07C766 "LBSR $C6BD", 07C7BC "LBSR $C6F1", 07C813 "LBSR $C6DA")
local draw_map_column 07C760 d block_number
local draw_map_row 07C80D d block_number
local fill_floor_map_column 07C7B3 d block_number
local fill_floor_map_row 07C869 d block_number
param find_map_block d block_number
# the tile RAM's wrap: the place's row bit that changed (07C76F/07C7C5/07C81F/07C87D "EORA <$F8"; "LEAU #$-0800,U")
local draw_map_column 07C76F a wrapped
local fill_floor_map_column 07C7C5 a wrapped
local draw_map_row 07C81F a wrapped
local fill_floor_map_row 07C87D a wrapped
# the floor map's place (07C7B6/07C86B "LDY <$FA", 07C7CC "LEAY #$-0800,Y", 07C884 "LEAY #$-40,Y"), handed to
# copy_block_floor_column / _row (07C7BC "LBSR $C6F1", 07C871 "LBSR $C71F")
local fill_floor_map_column 07C7B6,07C7BC,07C7CC y floor_place
local fill_floor_map_row 07C86B,07C871,07C884 y floor_place
param copy_block_floor_column y floor_place
param copy_block_floor_row y floor_place
# the board's control byte with the sprite RAM view on (07C78E/07C845 "ORA #$02") and off (07C7E6/07C8A5 "ANDA #$FC")
local fill_floor_map_column 07C78E,07C7E6 a control
local fill_floor_map_row 07C845,07C8A5 a control
local find_layer_a_block 07C8F4 x block
local find_layer_b_block 07C92E x block
local find_layer_a_block 07C8C0,07C8C8 a scene_number
local find_layer_b_block 07C8FA,07C902 a scene_number
param draw_block_column x block
param draw_block_column u tile_place
param draw_block_column d block_column
param draw_block_row x block
param draw_block_row u tile_place
param draw_block_row d block_row
param copy_block_floor_column x block
param copy_block_floor_column d block_column
param copy_block_floor_row x block
# the block's colour (07C6C2/07C6DF "LDB ,X++"), its tiles down the column or along the row (07C6C4/07C6E1 "LEAX A,X",
# 07C6CE "LEAX #$04,X"; 07C6C6 "LDA ,X", 07C6E3 "LDA ,X+")
local draw_block_column 07C6C2 b colour
local draw_block_row 07C6DF b colour
local draw_block_column 07C6C4,07C6CE x tile_cell
local draw_block_row 07C6E1,07C6E3 x tile_cell
local draw_block_column 07C6C6 a tile
local draw_block_row 07C6E3 a tile
# the floor pattern's cells (07C708/07C733 "LEAX A,X" in block_tile_flags, 07C713 "LEAX #$04,X", 07C73A "LDB ,X+")
local copy_block_floor_column 07C708,07C713 x pattern_cell
local copy_block_floor_row 07C733,07C73A x pattern_cell
# draw_layer_columns(_with_floor_map): A the layer (0 A, 1 B), B the columns to draw (attract_title_draw 079F96 "LDD
# #$0026", 079F9D "LDD #$0126"; 07C4A3 "PUSHS D"); the layer's map record (07C4A5 "LDX #$EC9D", 07C4A9 "LDX A,X",
# 07C4BB/07C4FA "PULLS X")
param draw_layer_columns d layer_and_columns
param draw_layer_columns_with_floor_map d layer_and_columns
local draw_layer_columns 07C4A3 a layer
local draw_layer_columns_with_floor_map 07C4E1 a layer
local draw_layer_columns 07C4A9,07C4BB x layer_map layer_map
# draw_tile_picture: A the picture's number, bit 7 to blank it (07C51C "LDU #$EFB5", 07C51F "BPL", 07C522 "ANDA #$7F"),
# its place in the tile RAM (07C536 "LDX ,U++", 07C55F "STA ,X+", 07C56B "LEAX A,X" to the next row), its colour
# (07C54F "LDB <$F3"), its tiles (07C544, 07C556 "LDA ,U+"; 07C55D "LDA #$01" a blank)
param draw_tile_picture d picture_number
local draw_tile_picture 07C51C,07C522 a number
local draw_tile_picture 07C556,07C55D a tile
local draw_tile_picture 07C54F b colour
local draw_tile_picture 07C544,07C556 u tile_bytes
local draw_tile_picture 07C536,07C55F,07C56B x place
# set_area_tile_banks: the map's scene (07C934 "LDA <$75", 07C93C "ANDA #$7F")
local set_area_tile_banks 07C934,07C93C a scene_number
# done: video/background_maps.c

# ---- engine/floor.c ----
# floor_cell_at hands back the floor map's cell: its address in U (079543 "LEAU D,U" from 4000) and in D its value in
# A (bits 0-3 the floor's height in steps of 8, 4-5 the priority, bit 7 no floor) with B the cell's column (079545 "LDA
# ,U", 079547 "RTS"); floor_ahead, floor_ahead_x and floor_ahead_y hand the same D on (0794C5/0794D5/0794E7 "BSR $94EB")
local floor_cell_at 079543 u cell_address
local floor_cell_at 079547 d cell
# the floor's cell under the object (07CE0A "LBSR $9495", "STA <$F0") and where its speeds take it (07CE38 "LBSR
# $94D9", "STA <$F1"); in check_floor_ahead the cells ahead in y (07CE4F/07CEC3 "LBSR $94B9") and in x (07CE69/07CEA1
# "LBSR $94C9"), and those noted before (07CEAE "LDA <$F2", 07CEE6 "LDA <$F1")
local check_floor 07CE0A,07CE38 a floor_cell
local check_floor_ahead 07CE4F,07CE69,07CEA1,07CEC3,07CEAE,07CEE6 a floor_cell
local unused_take_floor_priority 07CD91 a floor_cell
local unused_take_floor_height_and_priority 07CDAE a floor_cell
# the object's field blocked read for its bits (07CE8D / 07CF66 "LDA #$31,X")
local check_floor_ahead 07CE8D a blocked_bits
local enemy_start_climbing 07CF66 a blocked_bits
# set_climb_speed: A the floor's level to climb to, in steps of 8 (07CDDE "SUBA ,S+" less the object's floor_z / 8,
# 07CDE0 "LDB A,U" in climb_speeds)
param set_climb_speed d target_level
# done: engine/floor.c

# ---- engine/directions.c ----
# a direction (A, in 256ths of a turn) and a factor (B): scaled_sine_from_table (07CCA3 "STA <$EC", 07CCA6 "ANDA #$7F",
# 07CCB0 "NEGA" past the quarter, 07CCB1 "LDA A,U" the table's value, 07CCB4 "TSTB; BEQ", 07CCB6 "MUL"), walk_sine_from_
# table (07CCC3-07CCD4: 07CCD1 "LDB A,U", the value times 16); U the quarter wave's table (07CCA0 "LDU #$F061" sines,
# 07CCC0 the walk's)
param scaled_sine_from_table u quarter_wave
param scaled_sine_from_table d heading
param walk_sine_from_table u quarter_wave
param walk_sine_from_table d heading
param set_speeds_from_direction d heading
param set_walk_speeds_from_direction d heading
local scaled_sine 07CCA0 u quarter_wave
local walk_sine 07CCC0 u quarter_wave
local scaled_sine_from_table 07CCA3 a direction
local scaled_sine_from_table 07CCA6,07CCB0 a quarter_angle
local scaled_sine_from_table 07CCB1 a sine
local scaled_sine_from_table 07CCBF d scaled
local walk_sine_from_table 07CCC3 a direction
local walk_sine_from_table 07CCC6,07CCD0 a quarter_angle
local walk_sine_from_table 07CCDC d scaled
# direction_to_beside: B the signed x offset from the other object (07CCF0 "PUSHS X,B; SEX; ADDD #$0C,U"); the shifts
# that bring the larger distance under 256 (07CD1C/07CD4A "LDA #$06", 07CD26/07CD54 "DECA", 07CD31/07CD5F "INCA",
# 07CD39/07CD67 "DECA"), the angle (07CD46 "LDA D,X" in arctangents, 07CD78/07CD85/07CD8D "NEGA", 07CD7E "SUBA #$80"),
# handed back in A (07CD86/07CD8E "PULLS B,X,PC"); direction_to shares the code
param direction_to_beside d x_offset
local direction_to_beside 07CD1C,07CD26,07CD31,07CD39,07CD4A,07CD54,07CD5F,07CD67 a shifts
local direction_to_beside 07CD46,07CD78,07CD7E,07CD85,07CD8D a angle
local direction_to_beside 07CD86,07CD8E d direction
# done: engine/directions.c

# ---- engine/objects.c ----
# the objects cleared a word at a time (07955F "LDX #$4A40", 07956B "STD ,X++"; 07957F "LDX #$4F80", 07958D "LEAX
# #$60,X", 07959D "STD ,X++"; 0795AF/0795BD/0795CD; 0795DF/0795ED/0795FD), each given its sprites' place (079562 "LDU
# #$2000", 079575 "LEAU #$0080,U"; 079572 "STU #$-07,X")
local clear_objects 07955F,07956B x object_place
local clear_objects 079562,079575 u sprite_place
local clear_enemy_objects 07957F,07958D,07959D x object_place
local clear_list_1_objects 0795AF,0795BD,0795CD x object_place
local clear_child_objects 0795DF,0795ED,0795FD x object_place
# done: engine/objects.c

# ---- system/jump_table.c (the printers are under video/text.c above) ----
# the entry points that only jump on take what the routine they jump to takes (0785C0 "LBRA $9311" print_game_text,
# 0785A8 "LBRA $945C" print_hex_byte, 07861A "LBRA $CCA0" scaled_sine, 0786C2 "LBRA $B632" set_scroll_x, 0786C5 "LBRA
# $B64C" set_scroll_y, 078677 "LBRA $BAC7" palette_request, 07866B "LBRA $CCDD" set_walk_speeds_from_direction, 078671
# "LBRA $CCF0" direction_to_beside, 0786AD "LBRA $C4A3" draw_layer_columns)
param vector_print_game_text d text_number
param unused_vector_print_hex_byte d value
param unused_vector_scaled_sine d heading
param vector_set_scroll_x d scroll_x
param vector_set_scroll_y d scroll_y
param vector_palette_request d request
param vector_palette_request u palette_job
param vector_set_walk_speed_by_direction d heading
param vector_direction_to_offset d x_offset
param vector_draw_layer_strips d layer_and_columns
# the enemies' hit reactions: the step of the action (07D68B / 07D679 "LDD #$28,X": action and action_step, B handed
# to the action's routine); the floor's cell under it (07D6A4 "CLRD", 07D6A5 "LBSR $9495"; "BMI": no floor)
local enemy_react_with_pits 07D68B d action_step
local enemy_react_with_walls 07D679 d action_step
local enemy_react_with_pits 07D6A5 a floor_cell
# the Z80's command FE88 (078F11 "LDD #$FE88; STD $1FC6")
local start_sample_rom_check 078F11 d command
# the object of list 2 taken (07CA9E "LDB #$02", 07CAA0 "LBSR $CA54" take_free_object; 07CAA5 "LDA #$05,Y; STA
# #$01,U" its kind)
local spawn_list_2_child 07CAA0 u child object
# the object's x less 40, inside while under 180 (07D1E8 "LDD #$0C,X", 07D1EB "SUBD #$0040", 07D1EE "CMPD #$0180")
local remove_off_screen 07D1EB d window_x
# find_nearest_player: each player's distance, x and y apart (07D2CA "LDD #$0C,X", 07D2CD "SUBD #$0C,U", 07D2D2
# "NEGD"; 07D2D8 "SUBD #$11,U", 07D2DD "NEGD"; 07D2DE "ADDD ,S++"), the start (07D2BA "LDD #$7FFF"), the nearest kept
# at 1872 (07D2E8 "STU $1872", 07D2F7 "LDU $1872")
local find_nearest_player 07D2BA,07D2DE d distance
local find_nearest_player 07D2CD,07D2D2 d x_distance
local find_nearest_player 07D2D8,07D2DD d y_distance
local find_nearest_player 07D2F7 u nearest object
# reserve_objects_for_sprites: A the objects (07E451 "PUSHS A", 07E480 "DEC ,S"), the board's control byte (07E456 "ORA
# #$02", 07E489 "ANDA #$FC"), the sprites' orders from FF down (07E463 "LDA #$FF", 07E470 "STA #$01,U", 07E476
# "DECA"), each object's sprites (07E465 "LDU #$59,X", 07E473 "LEAU #$10,U")
param reserve_objects_for_sprites d object_count
local reserve_objects_for_sprites 07E456,07E489 a control
local reserve_objects_for_sprites 07E463,07E476 a order
# boss_shade_by_vitality: A the vitality a shade step takes and B the row of hurt_effect_rows (07E498 "STD <$E8"; 07E4AF
# "LDB #$05; MUL", 07E4C7 "LDA <$E8", 07E4D2 "ADDA <$E8": the thresholds; 07E4F4 "LDA <$E9; ASLA; LDY A,Y" the row
# of hurt_effect_rows, 07E4F1 "LDY #$E526"), the boss's
# palette job (07E4A3/07E4AA "LDU #$54,X", boss_shade's shade_job)
param boss_shade_by_vitality d step_and_row
local boss_shade_by_vitality 0786BF a vitality_step
local boss_shade_by_vitality 0786BF b effect_row
local boss_shade_by_vitality 07E4C7,07E4D2 a threshold
local boss_shade_by_vitality 07E4A3,07E4AA u palette_job
# done: system/jump_table.c (left: the vectors' registers that only pass through, which take the names of the
# routines they jump to)

# ---- video/clear.c ----
# layers A and B cleared: blank tiles (0792CB "LDD #$1010"), each place of the layer's colours (079270 "LDX #$0800",
# 079275 "LDX #$1000" for layer B; 0792D5 "CLRW ,X++") and its tile at +2000, 400 words (0792CE "LDY #$0400", 0792D7
# "LEAY #$-01,Y")
local clear_layer_a 079270,0792D5 x place
local clear_layer_b 079275 x place
local clear_layer_a 0792CE,0792D7 y words_left
local clear_layer_a 0792CB d blank_tiles
# the text layer's places (07927A "LDX #$200E", 07928D "STD ,X++", 079295 "LEAX #$40,X", 07929E "LDX #$200C", 0792BF
# "LEAX #$40,X")
local clear_text_layer 07927A,07928D,079295,07929E,0792BF x place
# the sprite RAM 2000-2FFF cleared: the board's control byte (0792E2 "ORA #$02", 079305 "ANDA #$FC"), the place
# (0792ED "LDX #$2000", 0792F6 "CLRW ,X++"), 8 words a sprite (0792F4 "LDB #$08", 0792F8 "DECB"), the bytes left
# (0792F0 "LDY #$1000", 0792FB "LEAY #$-10,Y")
local clear_sprites 0792E2,079305 a control
local clear_sprites 0792ED,0792F6 x place
local clear_sprites 0792F4,0792F8 b words_left
local clear_sprites 0792F0,0792FB y bytes_left
# done: video/clear.c

# ---- video/dream_wave.c ----
# each line's x scroll (02541D "LDD #$9601" straight, 025423 "LDX #$1A00", 025420 "LDU #$0100", 025426 "BSETW D,X,U";
# dream_wave_draw_lines 0254C7 "LDX #$1A00", 0254E1 "STD ,X++")
local dream_wave_straighten 02541D d straight
local dream_wave_straighten 025420,025426 u count
local dream_wave_straighten 025423,025426 x line_scroll
local dream_wave_draw_lines 0254C7,0254E1 x line_scroll
# the wave's size, in B (dream_wave_draw_lines 0254BF "STB $18EE"; dream_wave_grow 025446 "LDB $18ED"; dream_wave_shrink
# 0254AE "SUBA #$02" before it stores it back)
param dream_wave_draw_lines d size
local dream_wave_shrink 0254AE a size
# wave_sine: A the angle and B the size (0254F6 "STA <$E8", 0254F9 "STB <$E9"), the size times the cosine (025510/02551D
# "MUL"), handed back
# signed in D (025531 "PULLS U,PC"); dream_wave_draw_lines adds it to the straight scroll (0254D7 "LBSR $74F4", 0254DA
# "ADDD #$0196", 0254DD "ANDA #$01" its high bit)
param wave_sine d angle_and_size
local wave_sine 0254F4 a angle
local wave_sine 0254F4 b wave_size
local wave_sine 025510,02551D a offset
local wave_sine 025531 d wave_offset
local dream_wave_draw_lines 0254DD a scroll_high
# done: video/dream_wave.c

# ---- video/sprites.c ----
# the board's control byte with the sprite RAM in view (07984E "ORA #$02") and out (079867 "ANDA #$FC")
local update_sprites 07984E,079867 a control
# an object's sprites, 16 bytes each (07988E/07994C/0799C7 "LDU #$59,X", 07989D/079960/0799E4 "LEAU #$10,U"), and the
# object that lent it the next 8 (0798A5/079968/0799EC "LDY #$-0002,U"), whose own (0798B7/07996E/0799F2 "LDU #$59,Y")
# sort_objects_by_depth: the rows by y (079A3A "LDU #$3000"; 079A5C "LDY D,U" the row's first object, 079A62 "PULLS D",
# 079A66 "PULLS Y", 079A68 "LDD #$5E,Y" the next in its row), the rows read in order (079A7C "LDY #$3000", 079A89 "LDX
# ,Y++"), the row's objects (079A89, 079ACA "LDU #$5E,X", 079AD3 "TFR U,X"), their sprites (079A91 "LDU #$59,X",
# 079AAE "LEAU #$10,U", 079AC0 "LDU #$59,U"), each numbered (079A9F "LDA <$F1", 079AA7 "CLRA" for an object hidden
# behind: "STA #$01,U")
local sort_objects_by_depth 079A3A u rows
local sort_objects_by_depth 079A7C,079A89 y row_place
local sort_objects_by_depth 079A9F,079AA7 a sprite_order
# draw_object: the object's kind (079B03 "LDB #$04,X", 079B1F "ANDB #$7F" the high kinds), its set's animations
# (079B3E "LDU #$6000", 079B42 "LDU D,U"), the frame's record (079B74/079BAF "LDA ,U+" its flags and sprites' count,
# 079B84/079BBD "LDA ,U+" its time, 079BA4/079BAD "LDU ,U" the next animation's), the object lending more sprites
# (079BE7 "LDX #$7E,Y", 079BEC "LBSR $9CBD"), then the object back (079C00 "PULLS X")
local draw_object 079B03,079B1F b kind_number
local draw_object 079B74,079BAF a frame_flags
local draw_object 079C00 x object
# write_object_sprites: the frame's sprite list (U, its parameter list: 079C05 "LDD ,U++", 079C20/079C3F "LDB ,U+",
# 079C24 "LEAU #$01,U", 079C32 "ORA ,U+", 079CF2 "LDA ,U+", 079D5F "PULLS CC,B,U"), the object lending the next 8
# sprites (079C9A "LDU #$-02,Y", 079CA3 "TFR U,Y")
# set_object_priority: the object's priority bits (079DE5 "ANDA #$30", 079DEA "LSRA")
local set_object_priority 079DE5,079DEA a priority
# done: video/sprites.c

# ---- test_mode/menu.c ----
# the test mode's printer: B the colour (05E650 "PUSHS X,D", 05E6FD "STB #$-2000,X"), each byte of the text (05E656 "LDA
# ,U+; CMPA #$C0"), a letter's tile (05E65C "SUBA #$30"), a command C0-C6 (05E685 "SUBA #$C7", 05E689 "ADDA #$07")
param test_print d colour
local test_print 05E650,05E6DA,05E6F1 b colour_byte
local test_print 05E656 a character
local test_print 05E65C a tile
local test_print 05E685,05E689 a command
# test_put_tile: A the tile and B its colour at X, X stepped (05E6FD "STB #$-2000,X", 05E701 "STA ,X+")
param test_put_tile x tiles
param test_put_tile d tile_and_colour
local test_put_tile 05E701 x tiles
# test_print_hex: A the byte at X (05E711 "PUSHS D", 05E71C/05E724 "STA ,X+")
param test_print_hex x tiles
param test_print_hex d value
local test_print_hex 05E724 x tiles
# the byte printed (05E711 "PUSHS D", 05E716 "LSRA" x 4, 05E71E "LDA ,S") and D as it came back (05E726 "PULLS D,PC")
local test_print_hex 05E711 a printed_byte
local test_print_hex 05E726 d value
# test_open_page: A the page's text in test_mode_texts (05E62E "LDU #$75BE; ASLA; LDU A,U"), after it the menu's length,
# cursor variable and lines (05E636 "LDA ,U+", 05E63C "LDD ,U++", 05E646 "STU $590D")
param test_open_page d text_number
local test_open_page 05E632 u text
# the settings: Y the setting's variable, 5A58-5A67 the EEPROM's copies (05E5E8/05E60A "CMPY #$5A58", 05E5ED/05E60F
# "CMPY #$5A67", 05E5F4/05E616 "LEAY #$-59F0,Y" the EEPROM address); B the value (05E607 "STB ,Y", 05E627 "LDB ,Y",
# 05E621 "LBSR $6915")
param test_read_setting y setting
param test_write_setting y setting
param test_write_setting d value
param test_choose_setting y setting
param test_choose_setting_open y setting
param test_choose_setting_run y setting
param test_mark_setting y setting
local test_read_setting 05E621 b value_byte
# the value handed back in B with A as it came (05E625 "PULLS A,X,Y,U,PC" after 05E621 "LBSR $6915", 05E629 "RTS" after
# 05E627 "LDB ,Y")
param test_read_setting d value
local test_read_setting 05E625,05E629 d value
local test_write_setting 05E605 y setting
# test_colour_row: X the row's place in the tile RAM (05E5BE "PUSHS U,X,D"), A the colour (05E5D9 "LDA ,S") written over
# its 36 (05E5DB "LDU #$0024") or 18 (05E5E2 "LDU #$0012") tiles' colours (05E5C0-05E5CC, 05E5D6 "LEAX #$11,X";
# 05E5E5 "BSET A,X,U"), by the page (05E5CE "LDB $5908")
param test_colour_row x row
param test_colour_row d colour
param test_unmark_row x row
local test_colour_row 05E5CC,05E5D6,05E5E5 x colour_place
local test_colour_row 05E5DB,05E5E2,05E5E5 u count
local test_colour_row 05E5CE b page
local test_colour_row 05E5D9 a colour_byte
# test_mark_line: A the colour and B the menu's line (05E5A9 "INCB", 05E5B0 "LDA #$03; MUL", 05E5B3 "LEAX B,X", 05E5B5
# "LDX ,X" the line's row)
param test_mark_line d colour_and_line
local test_mark_line 05E5B2 b line_offset
local test_mark_line 05E5B5 x row
# test_menu_open: the board's control byte (05E050 "ORA #$01", 05E06D "ANDA #$FC"), the test mode's 8 palettes
# (05E05B "LDB #$08", 05E066 "DBJNZ") copied from test_mode_palettes (05E05D "LDY #$7B6C", 05E060 "LDX ,Y++", 05E062
# "LDU #$0020", 05E065 "BMOVE Y,X,U"), the start buttons' setting (05E083 "LDY #$5A60", 05E086 "LBSR $660A")
local test_menu_open 05E050,05E06D a control
local test_menu_open 05E05B,05E066 b palettes_left
local test_menu_open 05E05D,05E060,05E065 y palette_data
local test_menu_open 05E060,05E065 x colour_place
local test_menu_open 05E062,05E065 u count
local test_menu_open 05E086 b start_buttons
# test_menu_update: the cursor's variable (05E506 "LDY #$590B"), the menu's lines (05E509 "LDU #$590D"), the 1P
# joystick's up and down (05E50C "LDA $1F90", 05E510 "ANDA #$0C"), the cursor moved (05E51D "LDB [,Y]" before, 05E523
# "ADDA [,Y]", 05E52B "SUBA #$03" at the top, 05E533 "CLRA" past the end), the repeat's delay (05E542 "LDA #$07"), the
# cursor's place on its line (05E539/05E55B "LDX ,X", "LDA #$10"/"LDA #$A0; STA ,X"), the page the line opens (05E577
# "LDA A,X")
local test_menu_update 05E506 y cursor_variable
local test_menu_update 05E509 u menu_lines
local test_menu_update 05E510 a joystick
local test_menu_update 05E51D b old_cursor
local test_menu_update 05E523,05E52B,05E533 a cursor
local test_menu_update 05E539,05E55B x cursor_place
local test_menu_update 05E577 a page
# done: test_mode/menu.c

# ---- test_mode/checks.c ----
# the ROM check's row (05E0B3 "LDX #$26DD"), unmarked
local test_rom_check_run 05E0B3 x row
# the screen check's crosshatch: tiles 2E 2F over 2C 2D (05E0CD "LDU #$2F2E", 05E0D0 "LDY #$2D2C"), from 2800 (05E0D3
# "LDX #$2800", 05E0DD "STU ,X++", 05E0E1 "LEAX #$58,X"), 14 rows (05E0D6 "LDA #$0E", 05E0E4 "DECA") of 20 pairs (05E0D8
# "LDB #$14", 05E0DF "DBJNZ")
local test_screen_check_draw 05E0CD u upper_tiles
local test_screen_check_draw 05E0D0 y lower_tiles
local test_screen_check_draw 05E0D3,05E0DD,05E0E1 x tiles
local test_screen_check_draw 05E0D6,05E0E4 a rows_left
local test_screen_check_draw 05E0D8,05E0DF b pairs_left
# the colour check's blocks: the tile (05E0F6 "LDA #$31", 05E11C "INCA") in colour 80 (05E10A "LDB #$80"), from 2190
# (05E0F8 "LDX #$2190", 05E114 "LEAX #$3C,X", 05E11D "LEAX #$-017C,X"), then the four ramps' places (05E126 "LDX
# #$3344",
# 05E12F, 05E138, 05E141)
local test_color_check_draw 05E0F6,05E11C a tile
local test_color_check_draw 05E10A b colour
local test_color_check_draw 05E0F8,05E114,05E11D,05E126,05E12F,05E138,05E141 x tiles
# a ramp: X its place, A the first tile and B its colour (05E14F "PUSHS D"; 05E15B "LDD ,S", 05E15D/05E160 "LBSR $66FD")
param test_color_check_draw_ramp x tiles
param test_color_check_draw_ramp d tile_and_colour
local test_color_check_draw_ramp 05E163,05E16B x tiles
# the I/O check: the ports from 1F90 (05E1A5 "LDY #$1F90", 05E1B3 "LDA ,Y+"), each port's bits shifted out (05E1BF
# "LSRA"),
# 4 ports (05E1AB "LDB #$04", 05E1FF "DBJNZ") of 6 bits (05E1BA "LDB #$06", 05E1C7 "DBJNZ"), each bit's 0 or 1 (05E1BE
# "CLRB", 05E1C2 "INCB"; 05E1E1/05E1F4 "CLRB", 05E1E7/05E1F9 "INCB"), the tile RAM's place (05E1A8 "LDX #$22CC", 05E1B5
# "LEAX #$09,X", 05E1C9/05E1EC "LEAX #$40,X", 05E1FD "PULLS B,X")
local test_io_check_run 05E1A5,05E1B3,05E1D4 y port
local test_io_check_run 05E1B3,05E1BF a port_bits
local test_io_check_run 05E1AB,05E1FF b ports_left
local test_io_check_run 05E1BA,05E1C7 b bits_left
local test_io_check_run 05E1BE,05E1C2,05E1E1,05E1E7,05E1F4,05E1F9 b bit
local test_io_check_run 05E1A8,05E1B5,05E1C9,05E1EC,05E1FD x tiles
param test_io_check_draw_bit x tiles
param test_io_check_draw_bit d bit
local test_io_check_draw_bit 05E204,05E20A b bit_tile
# done: test_mode/checks.c

# ---- test_mode/options.c ----
# the line chosen on a setting's page (05E2AF/05E418/05E489/05E4E3 "LBSR $6425" test_choose_setting, B)
local test_start_buttons_page 05E2AF b choice
local test_screen_flip_page 05E418 b choice
local test_premium_start_page 05E489,05E49A b choice
local test_premium_coins_page 05E4E3 b choice
# the page opened next (05E4A1 "LDB #$13", 05E4B1 "LDB #$14", 05E4C7 "PULLS B"; 05E4F1/05E4F5 "LDB #$15"; 05E3D5 "LDA
# #$15", 05E3D9 "LDA #$13")
local test_premium_start_page 05E4A1,05E4B1,05E4C7 b next_page
local test_premium_coins_page 05E4F1 b next_page
local test_premium_coinage_page 05E4F5 b next_page
local test_coin_setting_page 05E3D5,05E3D9 a next_page
# the premium start's coins (05E4A5 "LBSR $660A" setting 5A62, 05E4AA "INCB"; 05E3C3 "LBSR $660A")
local test_premium_start_page 05E4A5,05E4AA b premium_coins
local test_coin_setting_page 05E3C3 b premium_coins
# the lines below blanked (05E4B3 "LDX #$22CC", 05E4B6 "LDA #$10", 05E4B8 "LDU #$0600", 05E4BB "BSET A,X,U")
local test_premium_start_page 05E4B3,05E4BB x clear_to
local test_premium_start_page 05E4B8,05E4BB u count
local test_premium_start_page 05E4B6 a blank_tile
# test_print_coinage: X the place, the coin setting (05E2D6 "LDY #$5A59", 05E2D9 "LBSR $660A"), its coins' digit
# (05E2E3 "SUBA #$30") with the premium start's extra coins (05E2EA "LDY #$5A62", 05E2F2 "ADDA ,S+"), its credits'
# digit (05E30E "SUBA #$30"), the colour 0 (05E2F4 "LDB #$00")
param test_print_coinage x tiles
local test_print_coinage 05E2D9 b coinage
local test_print_coinage 05E2ED b extra_coins
local test_print_coinage 05E2E3,05E2F2 a coins
local test_print_coinage 05E30E a credits_digit
local test_print_coinage 05E2F4 b colour
# test_print_plural: X the place, A the count (05E2CD "DECA; BEQ": no S for 1)
param test_print_plural x tiles
param test_print_plural d count
# test_print_off_on: B the setting (05E39C "TSTB")
param test_print_off_on d value
# test_open_page_marked: A the page and B its line to mark (05E3EF "STA $5908", 05E3F6 "LDA #$40", 05E3F8 "LBRA $65A7")
param test_open_page_marked d page_and_line
# done: test_mode/options.c

# ---- test_mode/rom_check.c ----
# the check's variables 5A10-5A1F cleared (05EABA "LDX #$5A10", 05EABD "LEAY ,X", 05EABF "CLR ,X+", 05EAC1 "LDU #$000F",
# 05EAC4 "BMOVE Y,X,U")
local test_rom_check_start 05EABD,05EAC4 y clear_from
local test_rom_check_start 05EABF,05EAC4 x clear_to
local test_rom_check_start 05EAC1,05EAC4 u count
# the Z80's answer, bit 7 set when it is not there (05EACB "LBSR $8605", 05EACE "ANDA #$80; STA $5A1B"; 05EB93/05EBBF
# "LDA $5A1B"), and its bits for the sample ROMs (05EBA5/05EBCC "LBSR $8605", "BITA #$04" / "BITA #$02")
local test_rom_check_start 05EACE a no_sound_cpu
local test_rom_check_6g 05EB93 a no_sound_cpu
local test_rom_check_7g 05EBBF a no_sound_cpu
local test_rom_check_6g 05EBA5 a answer_bits
local test_rom_check_7g 05EBCC a answer_bits
# the K053246's control (05EB4D "ANDA #$EF", 05EB88 "ORA #$10")
local test_rom_check_sum_sprites 05EB4D a sprite_control
local test_rom_check_6g 05EB88 a sprite_control
# the sums (05EADE "LDX #$0000", 05EB58 "LDX #$0000"; 05EC31 "ABX" each byte; 05EB21/05EB2E "LEAX D,X" two chips'),
# compared and printed (05ED09 "LDU A,U" the result's place, graphics_rom_result_places)
param test_sum_tile_rom x sum
param test_sum_sprite_rom x sum
param test_check_rom_sum x sum
param test_print_rom_ok x sum
param test_print_rom_ok u place
param test_print_rom_bad x sum
param test_print_rom_bad u place
local test_rom_check_sum_tiles 05EADE x sum
local test_rom_check_tiles_result 05EB21,05EB2E x sum
local test_rom_check_sum_sprites 05EB58 x sum
local test_sum_tile_rom 05EC31 x sum
local test_rom_check_sum_tiles 05EB0D a chip_offset
local test_check_rom_sum 05ED08 a line_offset
local test_print_rom_ok 05ED16,05ED23 u place
local test_print_rom_bad 05ED30,05ED38 u place
# test_sum_tile_rom: the board's control byte (05EBFA "ANDA #$FB", 05EC61 "ORA #$04") and output byte, the tile ROM
# read on (05EC20 "ORA #$08", 05EC3D "ANDA #$F7"), every 4th byte from 2000 (05EC18 "LEAU A,U", 05EC2F "LDB ,U", 05EC32
# "LEAU #$04,U"), 800 a bank (05EC1A "LDY #$0800", 05EC35 "LEAY #$-01,Y")
local test_sum_tile_rom 05EBFA,05EC61 a control
local test_sum_tile_rom 05EC20,05EC3D a output
local test_sum_tile_rom 05EC18,05EC32 u rom_place
local test_sum_tile_rom 05EC2F b rom_byte
local test_sum_tile_rom 05EC1A,05EC35 y bytes_left
# test_sum_sprite_rom: the same through the K053246 (05EC83 "ANDA #$FB", 05ECF2 "ORA #$04"; 05EC91 "ANDA #$DF",
# 05ECD6 "ORA #$20" OBJCHA), 10000 reads (05EC6D "LDY #$0000", 05ECCE "LEAY #$-01,Y")
local test_sum_sprite_rom 05EC83,05ECF2 a control
local test_sum_sprite_rom 05EC91,05ECD6 a output
local test_sum_sprite_rom 05EC6D,05ECCE y reads_left
# done: test_mode/rom_check.c

# ---- test_mode/sound_test.c ----
# test_sound_test_next: X the number's variable (05E22E "LDX #$5915"), A the last number, B the menu's line (05E248
# "TSTB; BNE": only the first steps it), the number stepped (05E24F "INCA", 05E254 "CLRA" past the last)
param test_sound_test_next x number_variable
param test_sound_test_next d last_and_line
local test_sound_test_next 05E24F,05E254 a number
# the number played, an entry of the sound test's list from 30 on (05E23E "LDA $5915", 05E2A0 "LDA $5916", 05E728 "SUBA
# #$30; LEAX A,X; LEAX A,X; LDD ,X")
local test_music_play 05E23E,05E728 a number
local test_sound_play 05E2A0 a number
# done: test_mode/sound_test.c

# ---- bonus/balloon.c ----
# the players' objects, 2 objects apart (020327 / 0202E1 / 02077B "LDX #$4A40", 02033B / 0202F9 / 0207B8 "LEAX
# #$00C0,X"; 0207A1 "PULLS X" after a placement), each blowing or flying (bonus_1_blow, bonus_1_flight take X)
local bonus_1_blow_all 020327,02033B x player_object object
local bonus_1_fly_away 0202E1,0202F9 x player_object object
# the player's number handed to bonus_1_blow (020342 "LDA <$F1"; 02034A "STA <$F3"), and bonus_1_blow's A
local bonus_1_blow_all 020342 a player_number
param bonus_1_blow d player_number
# the balloon's three parts (bonus_1's scoped fields): the one blowing (02036E / 0203AB / 020488 / 0201BD / 02022E /
# 02029D "LDY #$37,X"), the part between (020385 / 0201CC / 0202AC "LDY #$35,X") and the flyer (020522 / 02055E /
# 020574 / 02058D "LDY #$33,X", 0205E7 "LDU #$33,X")
local bonus_1_blow 02036E,0203AB,020488 y blower object
local bonus_1_blow 020385 y middle_part object
local bonus_1_blow_until_done 0201BD y blower object
local bonus_1_blow_until_done 0201CC y middle_part object
local bonus_1_results 02022E y blower object
local bonus_1_top_up_balloons 02029D y blower object
local bonus_1_top_up_balloons 0202AC y middle_part object
local bonus_1_take_off 020522 y flyer object
local bonus_1_take_off 02053D y blower object
local bonus_1_lift_off 02055E y flyer object
local bonus_1_speed_up 020574 y flyer object
local bonus_1_rise 02058D y flyer object
local bonus_1_pop 0205E7 u flyer object
# the parts' animations (020371 "LDA #$02", 020378 "LDA #$2A" for an absent player, 020388 "LDA #$02"; 0201C0 "LDB
# #$81", 0201C7 "LDB #$A9"; 020231 "LDA #$82", 020238 "LDA #$AA"; 0202A0 "LDA #$81", 0202A7 "LDA #$A9"; 020529 "LDA
# #$83", 020530 "LDA #$AB"; each "STA #$05,Y" or "STB #$05,Y")
local bonus_1_blow 020371,020378,020388 a animation
local bonus_1_blow_until_done 0201C0,0201C7 b animation
local bonus_1_results 020231,020238 a animation
local bonus_1_top_up_balloons 0202A0,0202A7 a animation
local bonus_1_take_off 020529,020530 a animation
# the bonus' state (02034D "LDB $18E0"); whether the player is in the game (02052B "LDB #$3E,X")
local bonus_1_blow 02034D b state
local bonus_1_take_off 02052B b in_game
# bonus_1_stretch_height: the growth scaled by the zoom (0204E4 "PULLS D", 0204ED "NEGD" when it shrinks) and the new
# height (0204EE "ADDD #$2B,X")
local bonus_1_stretch_height 0204E4,0204ED d change
local bonus_1_stretch_height 0204EE d new_height
# the flight: the flyer's z speed (020553 "LDD #$00A0", 020561 "LDD #$19,X"; 020577 "LDD #$19,Y", 02057A "ADDD #$0008"),
# its height (0205AE "LDD #$16,X; CMPD #$0180")
local bonus_1_lift_off 020553,020561 d z_speed
local bonus_1_speed_up 020577,02057A d z_speed
local bonus_1_rise 0205AE d height
# bonus_1_results: each player's wait before its flight, its place times 15 (02020F "LDU #$48F0", 020247 "LDA #$0F",
# 020249 "LDB ,U+", 02024B "MUL", 02024C "STB ,Y") at 18E4 (020212 "LDY #$18E4", 020245 "PULLS Y", 02024E "LEAY
# #$01,Y"); the player (020257 "LDA ,S; CMPA #$04")
local bonus_1_results 02020F,020249 u places
local bonus_1_results 02024B b wait
local bonus_1_results 020212,020245,02024E y wait_place
local bonus_1_results 020257 a player_number
# bonus_1_fly_away: the waits (0202E4 "LDU #$18E4", 0202F3 "PULLS U", 0202FD "LEAU #$01,U"), the balloons gone
# (020308 "LDA $18EC; CMPA #$04")
local bonus_1_fly_away 0202E4,0202F3,0202FD u wait_place
local bonus_1_fly_away 020308 a flown
# bonus_1_popped: the flyer's animation done (0205C9 "LDA #$06,X", 0205CC "ANDA #$01")
local bonus_1_popped 0205CC a animation_done
# bonus_1_fall: the frames it lies (020616 "LDA #$60; STA #$40,X")
local bonus_1_fall 020616 a lie_time
# the bonus timer: frames and seconds in BCD (02064A "LDA <$7B", 020651/020657 "DAA"; 020663 "LDA <$7A")
local bonus_timer_tick 02064A,020651,020657 a frames
local bonus_timer_tick 020663 a seconds
# bonus_put_placement: A the record of bonus_placements (0207C9 "LDU #$7C00", 0207CC "ASLA", 0207CD "LDU A,U"), X the
# object for a
# record that says FFFF (0207D6 "TFR X,Y"), the object put (0207CF "LDY ,U++"), handed back in Y
param bonus_put_placement d record_number
param bonus_put_placement x default_object object
local bonus_put_placement 0207CF,0207D6 y placed object
# bonus_1_put_players: the player's number (020731 "CLRA", 020776 "INCA; CMPA #$04"; 0207BF "LDA <$F0"), the part's
# field 33 + 2n (0207A7 "ADDB #$33")
local bonus_1_put_players 020731,020776,0207BF a player_number
local bonus_1_put_players 0207A7 b part_field
# bonus_1_press_sound: the players' records (0208B8 "LDX #$7BC8", 0208C4 "LEAX #$02,X"; 0208BB "LDU ,X"), their
# presses (0208B5 "CLRA", 0208C2 "ORA [,U]", 0208D2 "ANDA #$3F"), the frames since the last sound (0208D6 "LDA
# $18ED"), the player's number (0208C9 "LDB ,S")
local bonus_1_press_sound 0208B8,0208C4 x player_records_place
local bonus_1_press_sound 0208BB u record
local bonus_1_press_sound 0208B5,0208C2,0208D2 a presses
local bonus_1_press_sound 0208D6 a frames_since
local bonus_1_press_sound 0208C9 b player_number
# each player's bit in players_playing (0208EC "LDA #$01", 0208FB "ASLA"), 4 players (0208EE / 020907 "LDB #$04",
# 020900 / 020915 "DECB")
local bonus_mark_players_in_game 0208EC,0208FB a player_bit
local bonus_mark_players_in_game 0208EE,020900 b players_left
local bonus_1_zoom_players 020907,020915 b players_left
# bonus_pan_up: list 2's first object, the backdrop (020937 / 02094B "LDX #$4D40"); the scroll y's low byte (020943
# "ADDD #$0003")
local bonus_pan_up 020937,02094B x backdrop object
# bonus_keep_backdrop: the backdrop's object (0209AE "LDX [$7C32]", bonus_placements' record 25)
local bonus_keep_backdrop 0209AE x backdrop object
# bonus_title_show: the frames before the title (0209D6 "DECW $18EF"), the bonus' voice (0209E9 "LDX #$7BC4", 0209ED
# "LDD A,X" bonus_intro_sounds)
local bonus_title_show 0209ED d voice
# bonus_reward_winners: each player's life (0209FD "LDU #$49D2", 020A27 "LEAU #$08,U"), the results' look and place
# (020A04 "LDA #$2F,X; CMPA #$03", 020A0B "LDA #$45,X; CMPA #$01"), the life given (020A19 "ADDA #$14", 020A1F "LDA
# #$28" at most)
local bonus_reward_winners 0209FD,020A27 u health_address
local bonus_reward_winners 020A04 a look
local bonus_reward_winners 020A0B a place
local bonus_reward_winners 020A19,020A1F a health
# bonus_1_set_absent_rates: the player's object (02083C "LDX #$05,U", bonus_player's object)
# done: bonus/balloon.c (left: the registers the bonuses' dispatchers only hand on, from tables that the decompiler
# reads as switches of every entry)

# ---- bonus/results.c ----
# bonus_results_place_next: X the kind and animation of the place's sign (020F7F "LDX #$0E8B", 020F91 "LDX #$0E8C" ...;
# 0210A5 "STX <$F8"), then each box's x (0210E8 "LDX #$0078", 021166 "LEAX #$48,X"); the players left to look at
# (0210AC "LDA #$04", 0210CD "DECA"); each one's result (0210B5 "LDB #$01,U") and look (0210EB "LDB #$2F,U"); the box's
# text (021139 "LDY #$7DBC", 02113E "LDY #$7DCF", 021147 "LDY #$7DE3"); the players placed so far (02116F "LDA
# $1845", 021178 "ADDA #$01", 02117C "LDA #$05")
param bonus_results_place_next x sign_kind
local bonus_results_place_next 0210E8,021157,021166 x box_x
local bonus_results_place_next 0210AC,0210CD a players_left
local bonus_results_place_next 0210B5 b result
local bonus_results_place_next 0210EB b look
local bonus_results_place_next 021139,02113E,021147 y box_text
local bonus_results_place_next 02116F,021178,02117C a placed
# bonus_results_draw_box: X the box's x, B the player's look (3 in the game: 0212AB "LDA #$B2", 0212B1 "LDA #$F2" the
# colour); the tiles from bonus_result_box_tiles (0212D6 "LDY #$7DF1"), 7 rows, 4 for an absent player (0212C8 "LDB #$07",
# 0212D0 "LDB #$04"; 0212D4/0212EA "LDB ,S", 0212E2/0212F3 "DBJNZ"), 8 tiles a row (0212DB/0212EC "LDU #$0008"; 0212DE
# "BMOVE Y,X,U", 0212EF "BSET A,X,U"), the tile RAM's place (0212C4 "PULLS X", 0212DF/0212F0 "LEAX #$38,X", 0212E6 "LEAX
# #$-2000,X" its colours), the box's x back (0212F5 "PULLS D,X,Y,U")
param bonus_results_draw_box x box_x
param bonus_results_draw_box d look
local bonus_results_draw_box 0212AB,0212B1,0212C6 a colour
local bonus_results_draw_box 0212C8,0212D0 b rows
local bonus_results_draw_box 0212D4,0212E2,0212EA,0212F3 b rows_left
local bonus_results_draw_box 0212DB,0212DE,0212EC,0212EF u count
local bonus_results_draw_box 0212C4,0212DE,0212DF,0212E6,0212EF,0212F0 x tiles
local bonus_results_draw_box 0212F5 x box_x
# bonus_show_player_portraits: the players in the game, a bit each (02118F "LDA <$50", 021203 "LSRA"), the look given
# (0211A0 "LDA #$02", 0211A7 "LDA #$01", 0211BC "LDA #$03") and the one it had (021194 "LDB #$2F,U", 0211E0 "DECB")
local bonus_show_player_portraits 02118F,021203 a player_bits
local bonus_show_player_portraits 0211A0,0211A7,0211BC a look
local bonus_show_player_portraits 021194,0211E0 b old_look
# bonus_results_animate: the sign's hop (020FF6 "LDA #$47,U"; 020FFE "LDX #$7D9C", 021001 "LDA A,X")
local bonus_results_animate 020FF6 a hop
# bonus_results_count_points: the players whose points are all counted (021076 "LDB <$F1; CMPB #$04")
local bonus_results_count_points 021076 b players_done
# bonus_results_type_text: the text's byte (021220 "LDA ,Y+"; '$' a move: 02123D "LDD ,Y++", '%' the points: 02124C
# "LDA <$F0")
local bonus_results_type_text 021220 a character
local bonus_results_type_text 02123D d move
local bonus_results_type_text 02124C a points
# bonus_results_print_number: A the number (02125F "LDY <$F8"), its hundreds (02126D/021275 "SUBA #$64", 02126F "LDB
# #$01", 021277 "INCB") and tens (02127A "CLRB", 02127F "SUBA #$0A", 021281 "INCB"), each digit at the place after
# 48F8 (021262 "LEAY #$01,Y", 021278/021284 "STB ,Y+")
param bonus_results_print_number d number
local bonus_results_print_number 02125F,02126D,021275,02127F a number_left
local bonus_results_print_number 02126F,021277 b hundreds
local bonus_results_print_number 02127A,021281 b tens
local bonus_results_print_number 021262,021278,021284 y place
# bonus_first_player_in_game: the players in the game, a bit each (02128C "LDB <$50", 021297 "LSRB"), the number in A
# (0212A8 "RTS"; negative when there is none)
local bonus_first_player_in_game 02128C,021297 b player_bits
local bonus_first_player_in_game 0212A8 d first_player
# done: bonus/results.c (left: the registers the results' steps only hand on)

# ---- bonus/wake_up.c ----
# bonus_2_move_player: X the amount added to the field at offset D of the player's object and its two partners
# (020A90 "STX <$F8", 020A95 "LEAU D,U"; bonus_2_intro_set_up 020A6C "LDD #$00A8; SUBD $4A4C", 020A77 "LDD #$000C" x,
# 020A7D
# "LDX #$0028", 020A80 "LDD #$0016" z)
param bonus_2_move_player x amount
param bonus_2_move_player d field_offset
# the first player's number (020A54 "LBSR $728C" bonus_first_player_in_game, 020A57 "BMI": none)
local bonus_2_intro_set_up 020A54 a player_number
# the players' objects (020AE3 "LDU #$4A40", 020AF2 "LEAU #$00C0,U")
local bonus_2_set_up 020AE3,020AF2 u player_object object
# each player's variables (020C4C "LDX #$49D0" ... 020C88 "LDX #$49E8"), handed to bonus_2_player with A its controls
# and B its bit (020C47 "LDA <$42", 020C4A "LDB #$01" ...)
local bonus_2_all_players 020C4C,020C60,020C74,020C88 x player_vars
param bonus_2_player x player_vars
param bonus_2_player d controls_and_bit
# the portrait's x (020E6E "LDX #$00A8" while one shows how, 020E7D "PULLS X" bonus_2_player_x) and the meter's
# (020E91 "LEAX A,X; STX #$6C,U")
local bonus_2_portrait_x 020E6E,020E7D x portrait_x
local bonus_2_place_meter 020E91 x meter_x
# the sign's animation, another for an absent player (020B89 "LDA #$88", 020B90 "LDA #$C5")
local bonus_2_put_player 020B89,020B90 a sign_animation
# bonus_2_squash: the step of the squash (020D4E "LSRA"), the zooms (020D52 "LDB A,Y" bonus_2_squash_zooms_y, 020D57
# "LDA A,Y" bonus_2_squash_zooms_x)
local bonus_2_squash 020D4E a zoom_index
local bonus_2_squash 020D57 a zoom_x_value
local bonus_2_squash 020D52 b zoom_y_value
# done: bonus/wake_up.c

# ======== the last lines ========
# 05E207 "CLR <$F1": the scratch byte cleared where an input's bit is drawn, which nothing reads after
scoped global test_io_check_draw_bit 48F1 test_io_unread_byte u8
# 022E29 "LDU #$7A99", 022E2C "LDA <$57; DECA; ASLA", 022E31 "LEAU A,U": the wait before a charge by the players'
# number (stage_7_boss_charge_waits_by_players), read as a word (the variable holds the target and the nearest player
# at other places too, but the read needs its type)
local stage_7_boss_approach 022E31 u wait charge_wait
# 07D496 "LDU #$F65F; ASLA", 07D49A "JMP [A,U]": unused_enemy_run_action's jump through its table, which holds no code
comment unused_enemy_run_action_jump Unused: jumps to the action's handler through a table that holds no code, so it stops the game.
# Two entries of tables the analysis reads past their ends, which the game never takes: story_1_bart_steps (read both
# ways by the actor's type, 027619 "LDU #$7F0F; LDA #$01,X; ASLA; JMP [A,U]") past its end gives 9C00, inside the sprite writer's loop (079BFD
# "STX #$7E,Y", 079C00 "PULLS X": it pulls what 079BE5 "PUSHS X" pushed); the palette effects' tables (07E971, 07E975,
# 07E97B) past theirs give AC00, inside a stage 4 routine (07ABF2 "PUSHS A", 07AC00 "PULLS A"). Each pulls from a
# stack it did not push, which the C cannot follow (lost_stack)
079C00  func  story_1_bart_steps_overrun
comment story_1_bart_steps_overrun Not code of its own: where an entry past the end of story 1's actor steps would lead, the middle of the sprite writer's loop; the game never goes there.
07AC00  func  palette_effects_overrun
comment palette_effects_overrun Not code of its own: where an entry past the end of the palette effects' commands would lead, the middle of a stage 4 routine; the game never goes there.

# ======== what the registers carry from one routine to a later one (konami_cpu/decompile.py carry) ========
# Y: what a routine leaves in it and a later one, which no call links to it, reads before it sets it (the object
# lists' handlers each get the Y the handler before left; decompiler/carried.py finds the webs: a read no caller sets)
register y leftover_y
comment leftover_y What a routine left in Y that a later one reads before it sets it: the game's state the code carries in the register.

# ======== temporaries, typed pointers and locals: bonus, test mode, video, system, game, engine ========
# ======== temporaries, typed pointers and the last register names ========
#. Evidence: build/listing/simpsons.s as PLACE "INSTRUCTION", the C of
# the C. The work list is the work list: bonus/*, test_mode/*, video/*, system/*, game/*,
# engine/*.

# ======== new structures (the records the work list reached through untyped pointers) ========
# NOTE for the merge: palette_job lives at 3C00-3DFF and sprite_entry in the sprite RAM (2000-2FFF with 1FC2's bit 1):
# outside the work RAM, so ram() reaches them through the board's one shadow copy (simpsons_shadow_at). A statement
# that writes one of their fields with a value it reads from the bus in the same statement (mem_read8/io_read8 of a
# place the C does not name), or that touches two of them, depends on C's order of evaluation: see the report.

# A palette job: 8 bytes, 64 of them from 3C00 (find_free_palette_job 07BF39 "LDU #$3C00", 07BF3C "LDA #$40; STA
# <$7F", 07BF41 "LDA ,U; BEQ" a free one, 07BF45 "LEAU #$08,U"; run_palette_jobs 07BC8B-07BCA7 the same walk). Byte 0
# is the kind of job (0 free), the rest the kind's own (a family view each, by the request routines that fill them
# and the job routines that run them)
struct palette_job 08
# the kind of job (0 free): run_palette_jobs 07BC93 "LDA ,U; BEQ", 07BC99 "LDX #$BCAA; ASLA; JSR [A,X]" (1 the sets'
# loads, 2 an effect, 3 the background colour, 4 a darkening, 5 a brightening, 6 a white flash, 7 a clearing); the
# requests set it (07BAFA "LDA #$01; STA ,U", 07BB2F "LDA #$02", 07BB79 "LDA #$03", 07BB96 "LDA <$7E; STA ,U" 4 or 5,
# 07BC67 "LDA #$06", 07BC86 "LDA #$07") and the jobs that end clear it (07BCC6 "CLR ,U", 07BDFD, 07BEF6, 07BDB0)
field palette_job 00 kind u8
# kind 1, a palette set's loads (request_palette_sets 07BAFE "LDD <$E8; STD #$01,U": the request's A and B):
# palette_job_load_sets 07BCC8 "LDA #$01,U; STA <$F0" the loads wanted, a bit each of the set's 4 (07BCE6 "ANDA
# #$01", 07BCF8 "LSR <$F0"), 07BCD1 "LDB #$02,U; BPL" the set (bit 7: palette_sets_high, 07BCD6 "LDX #$EAEB; ANDB #$7F")
scoped palette_job sets 01 loads u8
scoped palette_job sets 02 set u8
# kind 2, a palette effect (request_palette_effect 07BB1F-07BB5F; palette_job_effect 07BD01): byte 1 the direction
# it runs its steps in (07BD36 "LDA #$01,U; ASLA; JSR [A,Y]" by palette_effect_directions: 0 forward, 1 backward;
# 07BB3F "CLR #$01,U", 07BDB4 "LDA #$01; STA #$01,U" turning back, 07BD8C "CLR #$01,U" at the start again)
scoped palette_job effect 01 direction u8
# the step it is at, in bank 2E (07BB5F "STX #$02,U" after the effect's header, 07BD28 "LDX #$02,U", 07BD67 / 07BD92 /
# 07BDBC / 07BDD6 "STX #$02,U")
scoped palette_job effect 02 step u16
# the frames waited since the last step (07BD0D "LDA #$04,U; CMPA #$05,U; BNE", 07BD4D "INC #$04,U", 07BD25 "CLR
# #$04,U"), the effect's frames between steps (07BB57 "LDA ,X+; STA #$04,U; STA #$05,U")
scoped palette_job effect 04 frames_waited u8
scoped palette_job effect 05 delay u8
# the colours a step sets, less one (07BB52 "LDA ,X+; STA #$06,U"; 07BD51 "LDA #$06,U; STA <$F0", counted to 0)
scoped palette_job effect 06 extra_colours u8
# the times the effect's repeat command has gone back (palette_effect_repeat 07BDC8 "CMPA #$07,U; BEQ", 07BDCD "INC
# #$07,U", 07BDDB "CLR #$07,U"; 07BB42 "CLR #$07,U" at the start)
scoped palette_job effect 07 repeats u8
# kind 3, the background colour (request_background_colour 07BB7D "LDD <$E8; STD #$01,U"; palette_job_background_colour
# 07BDF6 "LDD #$01,U; STD $0C00")
scoped palette_job background 01 colour u16
# kinds 4 and 5, a fade (request_palette_fade 07BB85; palette_job_fade 07BE21): the palette ranges it works on, a bit
# a step (07BBEC "LDD <$EA; STD #$01,U; STD #$05,U"; 07BE2B "LDD #$01,U; STD #$05,U" each 16 steps)
scoped palette_job fade 01 ranges u16
# the frames it lasts, one step a frame (07BB8D "CLR #$03,U", 07BB90 "LDA <$E9; STA #$04,U" the request's B;
# palette_job_darken 07BE1C "LDD #$03,U; BEQ" done, 07BE21 "DECW #$03,U")
scoped palette_job fade 03 frames_left u16
# the ranges still to come, shifted one bit a step (07BE71 "LSRW #$05,U"), whose bit 0 says the step's range fades
# (07BE34 "LDA #$06,U; ANDA #$01")
scoped palette_job fade 05 ranges_left u16
# the step, 0-15: the range of fade_ranges it fades (07BE50 "LDA #$07,U; ASLA; ASLA; LEAX A,X", 07BE74 "INC #$07,U",
# 07BE24 "CMPA #$10" then 07BE31 "CLR #$07,U")
scoped palette_job fade 07 range u8
# kind 6, a white flash (request_white_flash 07BC6B "LDD <$E8; STD #$01,U": the request's A, the layers that flash,
# and B, its frames; palette_job_white_flash 07BE8B "DEC #$02,U; BEQ")
scoped palette_job flash 01 flash_layers u8
scoped palette_job flash 02 frames_left u8
# the K053251's registers 9 and 10 while the flash shows, every other frame (07BC71 "LDD <$EA; STD #$03,U" from the
# layer bits; 07BEA5 "LDA #$03,U; STA $1FB9", 07BEAC "LDA #$04,U; STA $1FBA")
scoped palette_job flash 03 k053251_9 u8
scoped palette_job flash 04 k053251_10 u8
# kind 7, a clearing: the palette_clears it clears, a bit each (request_palette_clear 07BC80 "LDA <$E8; STA #$01,U";
# palette_job_clear 07BEFB "LDA #$01,U; STA <$F1", 07BF04 "ANDA #$01", 07BF1B "LSR <$F1")
scoped palette_job clearing 01 ranges u8

# A sprite of the K053247, 16 bytes (MAME's k053246_k053247_k055673.cpp, "Sprite Format"), in the sprite RAM at 2000
# (1FC2's bit 1): each object has 8 of them from its field sprites (2000 + 80 x its number: 07955F "LDU #$2000",
# 079575 "LEAU #$0080,U"); the sprite engine writes them (write_object_sprites 079C02, write_shadow_sprite 079DFE), the
# VBLANK's DMA copies those with bit 7 of byte 0 and a depth to the K053247
struct sprite_entry 10
# bit 7 shown, bit 6 the zoom kept for both axes, bit 5 flipped vertically, bit 4 horizontally, bits 0-3 the size:
# 079C2C "LDA <$F4; EORA <$F5; ORA ,U+; STA #$00,Y" (frame_attributes C0, 10 facing left, the sprite list's size),
# 079CD9 "LDA #$00,Y; ANDA #$BF" (a zoomed object: each axis its own zoom); 07989B "STD ,U" / 079CB2 "STD ,Y" clear it,
# 0798B7 / 079CAD "TST ,U" / "LDB ,Y; BEQ" the last one used
field sprite_entry 00 flags u8
# the depth the K053247 sorts by: sort_objects_by_depth's order, 1 up from the objects lowest on the screen, 0 for an
# object without bit 7 of its flags (079A9F "LDA <$F1; LDB #$00,X; BMI; CLRA", 079AA8 "STA #$01,U", 079AAB "INC <$F1")
field sprite_entry 01 depth u8
# the sprite's code (079C0B / 079C15 "STD #$02,Y" from the sprite list, bit 15 off: flipped)
field sprite_entry 02 code u16
# y and x on the screen (079C59 "STD #$04,Y": the object's y + z + the sprite's offset; 079C4D "STD #$06,Y": x + the
# offset; zoomed 079DCC / 079D4E)
field sprite_entry 04 y u16
field sprite_entry 06 x u16
# the vertical and horizontal zooms' low bytes (40 normal: 079C5C "LDA #$40; STA #$09,Y"; a zoomed object's 079D6A
# "STB #$09,Y" field 0B, 079CEA "STB #$0B,Y" field 0A, at least 10)
field sprite_entry 09 zoom_y u8
field sprite_entry 0B zoom_x u8
# the priority against the layers (the high byte: object_sprite_priority, 079C18 "LDA <$FB"; the shadow sprite's with
# bit 7, 079E22 "LDA <$FB; ORA #$80") and the colour (079C20 "LDB ,U+" from the sprite list, or the object's
# attributes' low bits 079C27 "ANDB #$0F"): 079C29 "STD #$0C,Y"
field sprite_entry 0C priority u8
field sprite_entry 0D colour u8
# the last of an object's 8 holds the object whose sprites it goes on in when a frame needs more (draw_object 079BE7
# "LDX #$7E,Y; BNE", 079BEC "LBSR $9CBD" borrow_object_for_sprites, 079BFD "STX #$7E,Y"; write_object_sprites 079C6E
# "LDD #$-02,Y" then 079C75 "LDY #$59,Y" its sprites; 079C9A "LDU #$-02,Y; BEQ", 079CA0 "STD #$-02,Y", 079CA5 "CLR ,Y"
# the object freed)
field sprite_entry 0E borrowed_object u16 object

# A word of the main loop's job queue (job_queue, 4944-497F round): the job's kind in the high byte and its argument
# in the low one, FFFF none (boot 0789CB "LDX $4942; LDD ,X; BMI", 0789D3 "LDU #$FFFF; STU ,X++", 0789E4 "LDX #$E3FB;
# ASLA; JSR [A,X]"; queue_job 0797C3 "STD ,X++")
struct queued_job 02
field queued_job 00 job u16
field queued_job 00 kind u8


# ---- bonus/balloon.c (the bonus stages' temporaries, untyped pointers and register names) ----
# Evidence: build/listing/simpsons.s as PLACE "INSTRUCTION", the C of the Cbonus/balloon.c.
# The scenes' dispatchers read their state in the K052109's RAM (scene_state 18E0, scene_substate 18E1, bonus 2's
# 1840), double it and jump through a table they load in X (or U): the state's number, its offset in the table and
# the table are named so; the "INC $18E0" / "INC $18E1" / "CLR $18E1" that end a state read the number first (t1).

# bonus_1_contest: 0200FD "LDX #$7B86", 020100 "LDA $18E0", 020104 "ASLA", 020105 "JMP [A,X]"
local bonus_1_contest 0200FD x state_table
local bonus_1_contest 020100 t1 state_number
local bonus_1_contest 020104 a state_offset
# bonus_2_contest: 020ACF "LDA $1840" (bonus 2's state, at least 3: 020AD3 "CMPA #$03; BGE", 020AD7 "LDA #$03; STA
# $1840"), 020ADD "ASLA", 020AE1 "JMP [A,X]"
local bonus_2_contest 020ACF t1 read_state
local bonus_2_contest 020ACF,020AD7 a state_number
# wrestler_update: 0212FB "LDU #$7E2F" the wrestler's states, 0212FE "LDA #$02,X; ASLA", 021302 "JSR [A,U]"
local wrestler_update 0212FB u state_table
local wrestler_update 0212FE,021301 a state_offset
# bonus_1_intro: 020016 "LDX #$7B80", 020019 "LDA $18E0", 02001D "ASLA", 02001E "JMP [A,X]"
local bonus_1_intro 020016 x state_table
local bonus_1_intro 020019 t1 state_number
local bonus_1_intro 02001D a state_offset
# bonus_2_intro: 020A32 "LDA $1840; ASLA", 020A37 "LDX #$7D18; JMP [A,X]"
local bonus_2_intro 020A32 t1 state_number
# bonus_1_intro_pan: 020025 "INC $18E0" when the pan is done
local bonus_1_intro_pan 020025 t1 state_number
# bonus_1_intro_set_up: the intro's player's blower and middle part, put by the balloon (020074 "LDU #$37,X",
# 020077-02009E "STD #$0C,U; STD #$11,U; STD #$16,U": x, y, z; 02008C "LDU #$35,X"), one after the other in U; 0200A8 "LDA <$F1; CMPA #$04"
# the players counted; 0200AF "INC $18E0"
local bonus_1_intro_set_up 020074,02008C u placed_part object
local bonus_1_intro_set_up 0200A8 a players_done
local bonus_1_intro_set_up 0200AF t1 state_number
# bonus_1_intro_show_how: the player the intro shows (0200B7 "LDA $18EE", 02005B "STA $18EE" in the set-up), its
# record's balloon (0200C1 "LDX #$05,U", 0200C4-0200C8 "LDA ,X; ORA #$10; STA ,X": its flags), kept over the press
# sound (0200D7 "PUSHS U,X", 0200DC "PULLS X,U"), and the player again for bonus_1_blow (0200DE "LDA $18EE; LBSR $634A")
local bonus_1_intro_show_how 0200B7 t1 shown_player_number
local bonus_1_intro_show_how 0200C1,0200DC x player_balloon object
local bonus_1_intro_show_how 0200DE t1 player_number
# bonus_1_contest_start: 02010C "LDX #$7B8C", 02010F "LDA $18E1; ASLA", 020114 "JMP [A,X]"
local bonus_1_contest_start 02010C x step_table
local bonus_1_contest_start 02010F t1 step_number
local bonus_1_contest_start 02010F,020113 a step_offset
# bonus_1_contest_set_up: the players' presses cleared (020116-020122 "CLR $18E8 ... CLR $18EB": bonus_player's
# presses, 18E8 + player, read before they are cleared); 02013A "INC $18E1"
local bonus_1_contest_set_up 020116 t1 old_marge_presses
local bonus_1_contest_set_up 02011A t1 old_homer_presses
local bonus_1_contest_set_up 02011E t1 old_bart_presses
local bonus_1_contest_set_up 020122 t1 old_lisa_presses
local bonus_1_contest_set_up 02013A t1 step_number
# bonus_1_contest_ready: the timer drawn 28 to the right of the READY sign (020154 "LDD <$F8; ADDD #$0028; STD <$F8",
# then 02015D "LBSR $6685"); 020160 "DEC $18E2" the frames the sign stays (020134 "LDA #$60; STA $18E2" in the set-up);
# then 020166 "INC $18E0", 02016A "CLR $18E1"
local bonus_1_contest_ready 020154,020157 d timer_x
local bonus_1_contest_ready 020160 t1 ready_frames
local bonus_1_contest_ready 020166 t1 state_number
local bonus_1_contest_ready 02016A t1 old_step
# bonus_1_contest_play: 020178 "LDX #$7B90", 02017B "LDA $18E1; ASLA", 020180 "JMP [A,X]"
local bonus_1_contest_play 020178 x step_table
local bonus_1_contest_play 02017B t1 step_number
local bonus_1_contest_play 02017B,02017F a step_offset
# bonus_1_start_music: 020182 "LDD #$8900; LBSR $8689" (the bonus music), 020188 "INC $18E1"
local bonus_1_start_music 020182 d music_command
local bonus_1_start_music 020188 t1 step_number
# bonus_1_blow_until_done: the timer drawn 28 to the right of the sign (0201A9 "LDD <$F8", 0201AC "ADDD #$0028; STD
# <$F8"); at the end each balloon's type from its size (0201D4 "LDD #$30,X; SUBD #$00A0; LSRDI #$02; STB #$01,X"), the
# players' count on the stack (0201E3 "DEC ,S"), 0201E9 "INC $18E0", 0201ED "CLR $18E1"
local bonus_1_blow_until_done 0201A9 t4 sign_x
local bonus_1_blow_until_done 0201AC t1 draw_x
local bonus_1_blow_until_done 0201AC a timer_x_high
local bonus_1_blow_until_done 0201AC b timer_x_low
local bonus_1_blow_until_done 0201D7 t2 size_over_minimum
local bonus_1_blow_until_done 0201E3 t2 balloons_left
local bonus_1_blow_until_done 0201E9 t1 state_number
local bonus_1_blow_until_done 0201ED t1 old_step
# bonus_1_finish: 0201F2 "LDX #$7B94", 0201F5 "LDA $18E1; ASLA", 0201FA "JMP [A,X]"
local bonus_1_finish 0201F2 x step_table
local bonus_1_finish 0201F5 t1 step_number
local bonus_1_finish 0201F5,0201F9 a step_offset
# bonus_1_finish_music: 0201FC "LDD #$8800; LBSR $8689", 020202 "INC $18E1"
local bonus_1_finish_music 0201FC d music_command
local bonus_1_finish_music 020202 t1 step_number
# bonus_1_results: each player's place (020249 "LDB ,U+" from 48F0, results_places) times F is the frames its balloon
# waits to fly (02024B "MUL; STB ,Y" at 18E4 + player); a balloon too small has its middle part's animation started
# (02023D "LDY #$35,X", 020240 "LDA #$81; STA #$05,Y"); 02025D "INC $18E1"
local bonus_1_results 020249 t1 place_address
local bonus_1_results 02023D y middle_part_object object
local bonus_1_results 02025D t1 step_number
# bonus_1_top_up_balloons: 0202B4 "LDA #$3F,X; ORA <$F0; STA <$F0" (a balloon still too small keeps them growing),
# 0202D4 "INC $18E1"
local bonus_1_top_up_balloons 0202B4 t3 still_too_small
local bonus_1_top_up_balloons 0202D4 t1 step_number
# bonus_1_fly_away: 18EC counts the balloons that flew away (0202DD "CLR $18EC" read first; 0205BB/020628 "INC $18EC"),
# 020308 "LDA $18EC; CMPA #$04", 020310 "INC $18E1"
local bonus_1_fly_away 0202DD t1 old_flown
local bonus_1_fly_away 020308 t1 flown_count
local bonus_1_fly_away 020310 t1 step_number
# bonus_1_blow: 02034D "LDB $18E0" (0: the intro, the blower only); each frame the balloon's zooms from its width and
# height (020406 "LDA #$29,X; STA #$0A,X", 02040C "LDA #$2B,X; STA #$0B,X") and its size from them (020413 "LDB
# #$29,X; NEGB", 02041A "LDB #$2B,X; NEGB; ADDD ,S; STD #$30,X"); the hit box's dx from 4000 / zoom x 0 (02044C
# "LMUL"); a balloon full when both are B0 (02046A "LDA #$29,X; CMPA #$B0", 020471 "LDA #$2B,X; CMPA #$B0"); a balloon
# no longer blown has its middle part's animation started (0203C7 "LDY #$35,X; LDA #$81; STA #$05,Y")
local bonus_1_blow 02034D t1 state_number
local bonus_1_blow 020406 t3 zoom_width
local bonus_1_blow 02040C t3 zoom_height
local bonus_1_blow 020413 t3 size_width
local bonus_1_blow 02041A t3 size_height
local bonus_1_blow 02044C t1 box_dx_product
local bonus_1_blow 02046A t3 checked_width
local bonus_1_blow 020471 t3 checked_height
local bonus_1_blow 0203C7 y middle_part_object object
# bonus_1_stretch_height: the height zoom the change is added to (0204EE "ADDD #$2B,X")
local bonus_1_stretch_height 0204EE t5 old_height_zoom
# bonus_1_flight: 020510 "LDU #$7B9E", 020513 "LDA #$43,X; ASLA", 020517 "JMP [A,U]"
local bonus_1_flight 020516 a flight_offset
# bonus_1_fly: 020519 "LDU #$7BA2", 02051C "LDA #$44,X; ASLA", 020520 "JMP [A,U]"
local bonus_1_fly 02051C,02051F a step_offset
# bonus_1_take_off: the middle part's animation started (020535 "LDY #$35,X", 020538 "LDA #$83; STA #$05,Y")
local bonus_1_take_off 020535 y middle_part_object object
# bonus_1_rise: a balloon gone off the top counts as flown away (0205BB "INC $18EC")
local bonus_1_rise 0205BB t1 flown_count
# bonus_1_popped: the balloon handed back by its step's handler (0205C7 "JSR [A,U]"), whose animation ended (0205C9
# "LDA #$06,X; ANDA #$01") clears it (0205D0 "CLR ,X"); 0205C3 "LDA #$44,X; ASLA"
local bonus_1_popped 0205C7 x balloon_object object
local bonus_1_popped 0205C3,0205C6 a step_offset
local bonus_1_popped 0205C9 t3 popped_flags
local bonus_1_popped 0205CC t2 animation_ended
# bonus_1_fall: the flyer lies down (02060E "LDU #$33,X", 020611 "LDA #$8E; STA #$05,U")
local bonus_1_fall 02060E u flyer_object object
# bonus_1_fall_done: 020628 "INC $18EC"
local bonus_1_fall_done 020628 t1 flown_count
# bonus_1_any_balloon_full: the players' count on the stack (020640 "DEC ,S")
local bonus_1_any_balloon_full 020640 t2 balloons_left
# bonus_timer_tick: the frames (02064A "LDA <$7B") and seconds (020663 "LDA <$7A") of bonus_frames / bonus_seconds as
# they were
local bonus_timer_tick 02064A t2 old_frames
local bonus_timer_tick 020663 t2 old_seconds
# unused_bonus_draw_timer_digits: each digit object at bonus_draw_x (020698 "LDD <$F8; STD #$0C,X"), 10 on for the
# next (02069E "ADDD #$0010; STD <$F8"), at bonus_draw_y's height (0206AA "LDD <$FA; STD #$16,X"), 8 more after the
# second (0206B6 "LDD <$F8", 0206B9 "ADDD #$0008"); 0206C2 "DEC ,S" the digits left; the seconds' tens (0206CB "LDA
# <$7A; LSRA x4", 0206D2 "BNE" or the digit is cleared)
local unused_bonus_draw_timer_digits 020698 t4 digit_x
local unused_bonus_draw_timer_digits 02069E t2 next_digit_x
local unused_bonus_draw_timer_digits 0206AA t4 digit_z
local unused_bonus_draw_timer_digits 0206B6 t4 x_before_gap
local unused_bonus_draw_timer_digits 0206B9 t2 x_after_gap
local unused_bonus_draw_timer_digits 0206C2 t2 digits_left
local unused_bonus_draw_timer_digits 0206D1 t2 seconds_tens
# unused_bonus_1_put_sign: 02071A "LDD <$F8; STD #$0C,X", 020726 "LDD <$FA; STD #$16,X"
local unused_bonus_1_put_sign 02071A t4 sign_x
local unused_bonus_1_put_sign 020726 t4 sign_z
# bonus_1_put_players: each balloon's part put by its placement (02078E "BSR $67C7", 02079E "LBSR $67C7": the object in
# Y), kept in the balloon's fields 33/35/37 (0207A3-0207A9 "LDB <$F1; ASLB; ADDB #$33; STY B,X"); 020790 "LDA #$3E,X"
# (a player out of the game puts the spare part instead)
local bonus_1_put_players 02078E,02079E y placed_part object
local bonus_1_put_players 020790 t3 player_in_game
# bonus_put_placement: the placement's record (0207CD "LDU A,U", bonus_placements), read through U (0207CF "LDY ,U++"
# the object, 0207E0 "LDD ,U++" kind and animation, 0207E7 "LDD ,U++" x, 0207F7 "LDD ,U++" z: FFFF leaves either as
# it is, 0207E9 / 0207F9 "CMPD #$FFFF")
local bonus_put_placement 0207CF t1 placement_record
local bonus_put_placement 0207CF u record_cursor
local bonus_put_placement 0207E0 t1 kind_cursor
local bonus_put_placement 0207E7 t1 x_cursor
local bonus_put_placement 0207E7 t4 new_x
local bonus_put_placement 0207F9 t1 new_z
local bonus_put_placement 0207E7,0207F7 a coordinate_high
local bonus_put_placement 0207E7,0207F7 b coordinate_low
# bonus_1_set_absent_rates: 02083C "LDX #$05,U" the record's balloon, 02083F "LDA #$3E,X; BNE"
local bonus_1_set_absent_rates 02083F t3 player_in_game
# bonus_1_press_sound: 18ED counts the frames since the last blowing sound (0208AB "LDA $18ED; BMI", 0208B1 "INC
# $18ED"); the presses of the players in the game (0208BD "LDB #$3E,X" with X in bonus_1_player_records: the original
# reads the table, not a balloon; 0208C2 "ORA [,U]"), the attack and jump bits (0208D2 "ANDA #$3F"); past 20 frames
# (0208D6 "LDA $18ED; CMPA #$20") the count is cleared (0208DE "CLR $18ED") and the sound 29 queued
local bonus_1_press_sound 0208AB t1 frames_since_sound
local bonus_1_press_sound 0208B1 t1 counted_frames
local bonus_1_press_sound 0208BD t3 slot_in_game
local bonus_1_press_sound 0208D2 t2 pressed_bits
local bonus_1_press_sound 0208D6 t1 waited_frames
local bonus_1_press_sound 0208DE t1 old_waited_frames
# bonus_mark_players_in_game / bonus_1_zoom_players: the players counted down in B (020900 / 020915 "DECB; BNE")
local bonus_mark_players_in_game 020900 t1 players_left_before
local bonus_1_zoom_players 020915 t1 players_left_before
# bonus_pan: 020919 "LDX #$7BB2", 02091C "LDA <$05; ASLA", 020920 "JMP [A,X]"
local bonus_pan 020919 x step_table
local bonus_pan 02091C,02091F a step_offset
# bonus_pan_up: layer A's y scroll up 3 a frame (020940 "LDD <$C5; ADDD #$0003; STD <$C5", 020949 "BCC": to 0 the pan
# is done)
local bonus_pan_up 020940 t4 scroll_y_read
local bonus_pan_up 020943 t1 old_scroll_y
local bonus_pan_up 020943 b new_scroll_low
# bonus_blink_hints: the hints' blinking step by the frame count (020968 "LDB <$16; ANDB #$60; LSRDI #$05"), 02096F "LDX
# #$7BB6", 020972 "ASLB", 020973 "JMP [B,X]"
local bonus_blink_hints 02096D t2 blink_step
local bonus_blink_hints 02096F x step_table
local bonus_blink_hints 020972 b step_offset
# bonus_title: 0209C0 "LDX #$7BBE", 0209C3 "LDB $18F1; ASLB", 0209C8 "JMP [B,X]"
local bonus_title 0209C0 x step_table
local bonus_title 0209C3 t1 title_step
local bonus_title 0209C7 b step_offset
# bonus_title_wait: the title's frames (0209CA "LDD #$00C0; STD $18EF"), 0209D1 "INC $18F1"
local bonus_title_wait 0209CA d title_frames
local bonus_title_wait 0209D1 t1 title_step
# bonus_title_show: 0209D6 "DECW $18EF" the frames left; then the bonus's sound (0209E9 "LDX #$7BC4; ASLA", 0209ED "LDD
# A,X", bonus_intro_sounds; 0209EF "LBSR $8680"), 0209F2 "INC $18F1"
local bonus_title_show 0209D6 t3 title_frames_left
local bonus_title_show 0209ED t4 intro_sound
local bonus_title_show 0209F2 t1 title_step
# bonus_reward_winners: the 4 result boxes counted on the stack (020A2A "DEC ,S")
local bonus_reward_winners 020A2A t2 boxes_left
# The balloons read through the common view where bonus_1's are meant (the C reads unk_3E, unk_3F, behaviour,
# target_dx, parameter, enemy_class): typed by the bonus_1 family, as symbols.txt's other balloon lines are.
# bonus_1_stretch_width / _height: the balloon back from the stack (0204A8 / 0204E6 "PULLS X"), its width / height zoom
# changed (0204B0 "ADDD #$29,X; ... STD #$29,X", 0204EE "ADDD #$2B,X"); the change and the new width as the height's
# (symbols.txt: local bonus_1_stretch_height 0204E4,0204ED d change, 0204EE d new_height)
local bonus_1_stretch_width 0204A8 x balloon object.bonus_1
local bonus_1_stretch_width 0204A6,0204AF d change
local bonus_1_stretch_width 0204B0 d new_width
local bonus_1_stretch_height 0204E6 x balloon object.bonus_1
# bonus_1_any_balloon_full: the balloons (02062D "LDX #$4A40", 02063C "LEAX #$00C0,X"), their size (020634 "LDD #$30,X;
# CMPD #$01A0")
local bonus_1_any_balloon_full 02062D,02063C x balloon object.bonus_1
# bonus_1_top_up_balloons: the balloon as bonus_1_blow hands it back (020293 "LBSR $634A"), read at 0202B4 "LDA #$3F,X"
local bonus_1_top_up_balloons 020293 x balloon object.bonus_1
# bonus_1_put_players / bonus_1_set_absent_rates: symbols.txt's player_object lines again with the family (the balloon:
# 020790 "LDA #$3E,X" in_game, 0207B5 "CLR [#$33,X]" its flyer; 02083F "LDA #$3E,X", 020856 "CLR #$42,X", 02085E "STA #$42,X" its
# press_rate)
local bonus_1_put_players 02077B,0207A1,0207B8 x player_object object.bonus_1
local bonus_1_set_absent_rates 02083C x player_object object.bonus_1
# done: bonus/balloon.c

# ---- bonus/results.c ----
# The results keep their state in the K052109's RAM: 1842 the state (020F39 "LDA $1842; ASLA; LDX #$7D8D; JMP
# [A,X]"), 1843 its frames (020F87 "DEC $1843", 020FC3 "LDD #$063C; STD $1842": state 6 after 3C frames), 1844 the
# result being placed (0210B8 "CMPB $1844", 0210D9 "STB $1844"), 1845 the boxes placed (02115E "INC $1845"), 1846 the
# place (021131 "LDA $1846", 021184 "INC $1846").
# bonus_show_go: the GO sign's frames in its object's word 01 (020F01 "LDU #$5580", 020F04 "LDD #$01,U; BEQ", 020F09
# "CMPD #$00A0": the sound at A0)
local bonus_show_go 020F04 d go_frames
# bonus_results: 020F39 "LDA $1842; ASLA", 020F3E "LDX #$7D8D", 020F41 "JMP [A,X]"
local bonus_results 020F39 t1 state_number
local bonus_results 020F3E x state_table
# bonus_results_start: 020F70 "DEC <$F0" the boxes counted, 020F7B "CLR $1845"
local bonus_results_start 020F70 t2 boxes_left_before
local bonus_results_start 020F7B t1 old_boxes_placed
# bonus_results_first .. fourth: each place's sign, kind 0E and its animation (020F7F "LDX #$0E8B", 020F91 "LDX
# #$0E8C", 020FA3 "LDX #$0E8D", 020FB5 "LDX #$0E8E"), handed to bonus_results_place_next (its p_sign_kind; "LBSR
# $70A5"), after the frames run out (020F87 / 020F99 / 020FAB "DEC $1843; BNE", then "INC $1843")
local bonus_results_first 020F7F x sign_kind
local bonus_results_second 020F91 x sign_kind
local bonus_results_second 020F87 t1 results_frames_left
local bonus_results_second 020F8D t1 expired_frames
local bonus_results_third 020FA3 x sign_kind
local bonus_results_third 020F99 t1 results_frames_left
local bonus_results_third 020F9F t1 expired_frames
local bonus_results_fourth 020FB5 x sign_kind
local bonus_results_fourth 020FAB t1 results_frames_left
local bonus_results_fourth 020FB1 t1 expired_frames
# bonus_results_wait / bonus_results_wait_count: 020FBD / 020FCC "DEC $1843; BNE", then the next state and its frames
# (020FC3 "LDD #$063C; STD $1842", 020FD2 "LDD #$0704; STD $1842")
local bonus_results_wait 020FBD t1 results_frames_left
local bonus_results_wait 020FC3 d state_and_frames
local bonus_results_wait_count 020FCC t1 results_frames_left
local bonus_results_wait_count 020FD2 d state_and_frames
# bonus_results_animate: the hop speeds (020FFE "LDX #$7D9C" bonus_results_hop_speeds, 021001 "LDA A,X"), 02100D "DEC <$F1"
local bonus_results_animate 020FFE x hop_speed_table
local bonus_results_animate 02100D t2 boxes_left_before
# bonus_results_count_points: 021017 "DEC $1843; BNE"; the next box's print place (02105E "LDX <$F8", 021061 "LEAX
# #$09,X; STX <$F8"); 02106B "DEC <$F0"
local bonus_results_count_points 021017 t1 results_frames_left
local bonus_results_count_points 021061 x next_print_place
local bonus_results_count_points 02106B t2 boxes_left_before
# bonus_results_place_next: the result placed before (0210B8 "CMPB $1844": only results below it), the players
# counted in A (0210CD "DECA"), the result to place (0210F5 "CMPA $1844"), the place (021131 "LDA $1846"), the boxes
# placed (02115E "INC $1845", 02116F "LDA $1845"), the boxes counted (021169 "DEC <$F1"), the next place (021184 "INC
# $1846")
local bonus_results_place_next 0210B8 t1 placed_before
local bonus_results_place_next 0210CD t1 players_left_before
local bonus_results_place_next 0210F5 t1 result_to_place
local bonus_results_place_next 021131 t1 current_place
local bonus_results_place_next 02115E t1 old_boxes_placed
local bonus_results_place_next 021169 t2 boxes_left_before
local bonus_results_place_next 02116F t1 boxes_placed
local bonus_results_place_next 021184 t1 old_place
# bonus_show_player_portraits: the portraits, the result boxes' objects 4F80 + C0 n (02118C "LDU #$4F80", 021204 "LEAU
# #$00C0,U"), read by bonus_results' fields (021194 "LDB #$2F,U": its look, bonus_results' 2F); 0211E0 "DECB" the look
# counted down; 0211E6 "TST $1842" (the results not running); each at bonus_draw_x + 48 x player (0211C9 "LDA <$F1; LDB
# #$48; MUL", 0211CF "ADDD <$F8; STD #$0C,U"), bonus_draw_y (0211D5 "LDD <$FA; STD #$11,U")
local bonus_show_player_portraits 02118C,021204 u portrait object.bonus_results
local bonus_show_player_portraits 021194 t3 current_look
local bonus_show_player_portraits 0211E0 t1 look_before
local bonus_show_player_portraits 0211E6 t1 results_state
local bonus_show_player_portraits 0211CE t1 portrait_offset
local bonus_show_player_portraits 0211CF t6 portrait_x
local bonus_show_player_portraits 0211D5 t4 portrait_y
# bonus_results_type_text: the text's next character (021220 "LDA ,Y+" from the box's text, field 43), the move of the
# tile cursor ('$': 02123D "LDD ,Y++", 021245 "LEAY D,Y"); a letter written at the tile cursor (021231 "LDY #$40,U",
# 021234 "STA ,Y+"): a place in the K052109's tile RAM (bonus_results_start 020F57 "LDX #$2310; STX #$40,U"), not an
# object (field 40 is the common parent's, typed object)
local bonus_results_type_text 021220 t1 character_place
local bonus_results_type_text 021220 t2 text_byte
local bonus_results_type_text 02123D t1 move_place
local bonus_results_type_text 02123D t4 cursor_move
local bonus_results_type_text 021231 y tile_cursor io
local bonus_results_type_text 021234 t1 tile_place
# bonus_results_print_number: the tiles of the hundreds (021278 "STB ,Y+") and the tens (021284 "STB ,Y+")
local bonus_results_print_number 021278 t1 hundreds_place
local bonus_results_print_number 021284 t1 tens_place
# bonus_first_player_in_game: the players' bits shifted out (021297 "LSRB; BCS"), the slots counted (02129E "DEC
# <$F0"), the player's number (0212A3 "LDA #$04; SUBA <$F0")
local bonus_first_player_in_game 021297 t1 bits_before
local bonus_first_player_in_game 02129E t2 slots_left_before
local bonus_first_player_in_game 0212A5 t4 first_player_number
# bonus_results_draw_box: the box's first tile from its x (0212B9 "SUBD $00A0": the word at 00A0, in the K052109's RAM,
# where 48A0 would be the direct page's; 0212BD "LSRDI #$03", 0212BF "ADDD #$22C0"); its tiles copied from the ROM
# (0212D6 "LDY #$7DF1" bonus_result_box_tiles, 0212DE "BMOVE Y,X,U": symbols.txt's box_tiles line again, with the
# pointer into the ROM, so the copy reads the data rather than the bus), the rows counted (0212E2 / 0212F3 "DBJNZ")
local bonus_results_draw_box 0212B9 t3 subtracted_scroll
local bonus_results_draw_box 0212B9 t5 screen_x
local bonus_results_draw_box 0212BD t2 tile_column
local bonus_results_draw_box 0212BF t2 first_tile
local bonus_results_draw_box 0212D6,0212DE y box_tiles
local bonus_results_draw_box 0212E2 t1 tile_rows_before
local bonus_results_draw_box 0212F3 t1 colour_rows_before
# done: bonus/results.c

# ---- bonus/wake_up.c ----
# Bonus 2 keeps its state in the K052109's RAM: 1840 the state (020A32 "LDA $1840; ASLA; LDX #$7D18; JMP [A,X]"), 1841
# its frames (020B9E "DEC $1841"); each player's objects: its own (4A40 + C0 n), its level meter (+60) and the sign
# beside it (+840, bonus_2_put_player 020B69 "LDA #$0E; STA #$0844,U").
# bonus_2_start_music: 020A42 "INC $1840"
local bonus_2_start_music 020A42 t1 state_number
# bonus_2_intro_set_up: bonus_title and bonus_pan get the bonus in A (020A47 "LDA #$01; LBSR $69C0": bonus 2); the
# first player in the game moved to x A8 (020A6C "LDD #$00A8; SUBD $4A4C": its x), 020A8B "INC $1840"
local bonus_2_intro_set_up 020A49 d bonus_number
local bonus_2_intro_set_up 020A6F t5 first_player_x
local bonus_2_intro_set_up 020A8B t1 state_number
# bonus_2_move_player: the field (D its offset, 020A95 "LEAU D,U") moved in the player's object, its meter (020A9E
# "LDD #$60,U; ADDD <$F8") and its sign (020AA7 "LDD #$0840,U; ADDD <$F8")
local bonus_2_move_player 020A9E t5 meter_coordinate
local bonus_2_move_player 020AA7 t5 sign_coordinate
# bonus_2_intro_try: 020AB7 "LDA #$01; LBSR $69C0" (bonus_title, bonus 2)
local bonus_2_intro_try 020AB9 d bonus_number
# bonus_2_put_player: the player's x from bonus_2_portrait_x (020B58 "LBSR $6E66; STX #$0C,U") and the meter's from
# bonus_2_place_meter (020B66 "LBSR $6E80", 020B77 "LEAX A,X; STX #$084C,U"); the players' bits shifted out (020B8B "LSR
# <$F1; BCS": the sign 88 for a player in the game, C5 for one out)
local bonus_2_put_player 020B58,020B66 x placed_x
local bonus_2_put_player 020B8B t2 player_bits_before
# bonus_2_countdown / bonus_2_end: 020B9E / 020C17 "DEC $1841; BNE"
local bonus_2_countdown 020B9E t1 bonus_2_frames_left
local bonus_2_end 020C17 t1 bonus_2_frames_left
# bonus_2_results: 020BE3 "TST $1841; BEQ", 020BE9 "DEC $1841", 020BF5 "TST $1841" (then "LDD #$070A; STD $1840")
local bonus_2_results 020BE3 t1 bonus_2_frames_left
local bonus_2_results 020BE9 t1 frames_before
local bonus_2_results 020BF5 t1 tested_frames
# bonus_2_all_players: each player's controls (020C47 "LDA <$42", 020C5B "LDA <$46"...) and bit (020C4A "LDB #$01", 020C5E
# "LDB #$02"...) handed to bonus_2_player in D (its p_controls_and_bit)
local bonus_2_all_players 020C4F,020C63,020C77,020C8B d controls_and_bit
# bonus_2_player: the player's result box's look (020C9A "LDA #$056F,U": 4F80 + 2F + C0 n; 020C9E "CMPA #$03")
local bonus_2_player 020C9A t3 box_look
# bonus_2_wait_start: 020CD1 "LDA $1840; CMPA #$05"
local bonus_2_wait_start 020CD1 t1 bonus_state
# bonus_2_end_pose: the result box's place (020CE8 "LDA #$0585,U": 4F80 + 45; "CMPA #$01" the winner), the sign's
# animation kept in its field 43 (020CF6 "LDA #$0883,U; ADDA #$02; STA #$0845,U")
local bonus_2_end_pose 020CE8 t3 box_place
local bonus_2_end_pose 020CF6 t3 sign_animation
# bonus_2_shake / squash / meter_jumps / bounce: the player's x again (020D1A / 020DBD "LBSR $6E66": bonus_2_portrait_x,
# "STX #$0C,U"), the sign's animation back (020DC3 "LDA #$0883,U; STA #$0845,U"), the level's high byte (020D3B / 020D68 /
# 020D95 "LDA #$01,U; CMPA #$30 / #$48 / #$18")
local bonus_2_shake 020D1A,020DBD x portrait_x
local bonus_2_shake 020DC3 t3 sign_animation
local bonus_2_squash 020DBD x portrait_x
local bonus_2_squash 020DC3 t3 sign_animation
local bonus_2_squash 020D3B t3 current_level
local bonus_2_meter_jumps 020DBD x portrait_x
local bonus_2_meter_jumps 020DC3 t3 sign_animation
local bonus_2_meter_jumps 020D68 t3 current_level
# bonus_2_meter_jumps: the jump's step by the reaction's frames (020D6F "LDA #$31,U; LSRA", 020D76 "LEAX A,X")
local bonus_2_meter_jumps 020D72 a jump_step
local bonus_2_bounce 020DBD x portrait_x
local bonus_2_bounce 020DC3 t3 sign_animation
local bonus_2_bounce 020D95 t3 current_level
# bonus_2_level: the level's high byte (020DCE "LDA #$01,U; LSRA; LSRA"), the state (020DEE "LDA $1840"), the level down
# 8 a frame (020DFD "SUBD #$0008"), the player's presses (020E06 "LDA #$2F,U; ANDA #$30": attack or jump), up 180 a
# press (020E10 "ADDD #$0180"), its low bits (020E20 "ANDB #$03"), the random reaction (020E24 "LDA <$58; ROLA; ROLA;
# ROLA; ANDA #$03"), the sign's next animation (020E38 "LDA #$0883,U; INCA"), down B0 after 15 quiet frames (020E58
# "SUBD #$00B0")
local bonus_2_level 020DCE t3 level_high
local bonus_2_level 020DEE t1 bonus_state
local bonus_2_level 020DFD t2 lowered_level
local bonus_2_level 020E06 t3 pressed_controls
local bonus_2_level 020E10 t2 raised_level
local bonus_2_level 020E20 t2 level_low_bits
local bonus_2_level 020E27 t2 random_rolled_once
local bonus_2_level 020E28 t2 random_rolled_twice
local bonus_2_level 020E38 t3 sign_animation
local bonus_2_level 020E58 t2 dropped_level
# bonus_2_portrait_x: 020E66 "LDB $1840; CMPB #$02" (the intro: x A8), else the player's from the table (020E76 "LDX
# #$7D7D", 020E79 "LDD B,X")
local bonus_2_portrait_x 020E66 t1 bonus_state
local bonus_2_portrait_x 020E79 t4 table_x
# bonus_2_place_meter: the meter by the player (020E89 "LDX #$0C,U; LEAX A,X", 020E96 "LDY #$11,U; LEAY #$-02,Y")
local bonus_2_place_meter 020E89 t5 player_x_place
local bonus_2_place_meter 020E96 t5 player_y_place
# done: bonus/wake_up.c

# ---- system (fork: test_mode/*, game/*, engine/*): temporaries, typed pointers, register names ----
# Evidence: build/listing/simpsons.s as PLACE "INSTRUCTION", the C of the C.



# ---- engine/directions.c ----
# scaled_sine_from_table: the sine times the heading's low byte (07CCB6 "MUL"), the sine / 16 as a speed (07CCB7
# "LSRDI #$04": A the high byte, B the low), negated for a heading past 80 (07CCBE "NEGD")
local scaled_sine_from_table 07CCB6 t1 sine_product
local scaled_sine_from_table 07CCB7 t2 sine_sixteenths
local scaled_sine_from_table 07CCBE t2 negated_sine
local scaled_sine_from_table 07CCB7,07CCBE a scaled_high
local scaled_sine_from_table 07CCB7,07CCBE d scaled_low
# walk_sine_from_table: the quarter wave's entry times 16 (07CCD1 "LDB A,U; CLRA", 07CCD4 "ASLDI #$04"), negated past
# 80 (07CCDB "NEGD")
local walk_sine_from_table 07CCD4 t2 sine_speed
local walk_sine_from_table 07CCDB t2 negated_speed
local walk_sine_from_table 07CCD4,07CCDB a speed_high
local walk_sine_from_table 07CCD4,07CCDB b speed_low
# set_walk_speeds_from_direction: the speed the sine gives (07CCDF "BSR $CCC0", 07CCE1 "STD #$14,X" the y speed), then
# the heading a quarter turn on (07CCE4 "LDA ,S; ADDA #$40") and its sine (07CCE8 "BSR $CCC3", 07CCEA "STD #$0F,X" the
# x speed)
local set_walk_speeds_from_direction 07CCDF,07CCE8 a speed_high
local set_walk_speeds_from_direction 07CCDF,07CCE8 b speed_low
local set_walk_speeds_from_direction 07CCE8 d across_heading
# direction_to_beside / direction_to: the x offset sign-extended (07CCF2 "SEX"), the other object's x (07CCF3 "ADDD
# #$0C,U" / 07CCFD "LDD #$0C,U") and this one's (07CCF6 / 07CD00 "SUBD #$0C,X"), the difference and its absolute
# value (07CD06 "ABSD"); the same across y (07CD0A "LDD #$11,U", 07CD0D "SUBD #$11,X", 07CD13 "ABSD"); the shifts
# that bring the shorter distance to 64ths of the longer (07CD31/07CD5F "INCA" up to 0, 07CD39/07CD67 "DECA" down to
# 0); A and B the difference's high and low bytes (07CD03 "STA <$EC", 07CD10 "STA <$ED")
local direction_to_beside 07CCF2 t1 x_offset_word
local direction_to_beside 07CCF3 t5 other_x
local direction_to_beside 07CCF3 t7 beside_x
local direction_to_beside 07CCF6 t5 own_x
local direction_to_beside 07CCF6 t7 x_difference
local direction_to_beside 07CD06 t1 signed_x_difference
local direction_to_beside 07CD06 t3 x_distance
local direction_to_beside 07CD0A t5 other_y
local direction_to_beside 07CD0D t5 own_y
local direction_to_beside 07CD0D t7 y_difference
local direction_to_beside 07CD13 t1 signed_y_difference
local direction_to_beside 07CD13 t3 y_distance
local direction_to_beside 07CD39 t1 shifts_left
local direction_to_beside 07CD67 t1 shifts_left_2
local direction_to_beside 07CD31 t2 shifts_to_go
local direction_to_beside 07CD5F t2 shifts_to_go_2
local direction_to_beside 07CCF6,07CD0D,07CD13 a difference_high
local direction_to_beside 07CCF0,07CCF6,07CD13 b difference_low
local direction_to 07CCFD t5 other_x
local direction_to 07CD00 t5 own_x
local direction_to 07CD00 t7 x_difference
local direction_to 07CD06 t1 signed_x_difference
local direction_to 07CD06 t3 x_distance
local direction_to 07CD0A t5 other_y
local direction_to 07CD0D t5 own_y
local direction_to 07CD0D t7 y_difference
local direction_to 07CD13 t1 signed_y_difference
local direction_to 07CD13 t3 y_distance
local direction_to 07CD39 t1 shifts_left
local direction_to 07CD67 t1 shifts_left_2
local direction_to 07CD31 t2 shifts_to_go
local direction_to 07CD5F t2 shifts_to_go_2
local direction_to 07CD00,07CD0D,07CD13 a difference_high
local direction_to 07CD13 b difference_low
# done: engine/directions.c

# ---- engine/floor.c ----
# floor_at_offset hands back in D the floor cell floor_cell_at found (0794A3 "BSR $94EB", its A the cell's byte)
local floor_at_offset 0794A3 d cell
# floor_cell_at: the x offset (0794EE "LDD <$E9"), added to the object's x low byte and fraction (0794F6 "ADDD
# #$0D,X"), its high byte (0794FB "LDA #$0C,X; ADCA <$E8"), plus the camera (079501 "ADDD <$AC") less the screen's
# left 40 (079504 "SUBD #$0040"): the map column; the same across y (079516 "LDD <$ED", 07951E "ADDD #$12,X", 079523
# "LDA #$11,X; ADCA <$EC"), the row times 64 (07953C "LDA #$40; MUL"), plus the column (07953D "ADDD <$E8"), the
# cell's byte in the floor map (079545 "LDA ,U" with U = 4000 + that)
local floor_cell_at 0794EE t4 x_offset_read
local floor_cell_at 0794F6 t5 x_low_and_fraction
local floor_cell_at 0794F6 t6 x_offset_added
local floor_cell_at 0794FB t3 x_high
local floor_cell_at 079501 t6 map_x
local floor_cell_at 079504 t2 map_column_x
local floor_cell_at 079516 t4 y_offset_read
local floor_cell_at 07951E t5 y_low_and_fraction
local floor_cell_at 07951E t6 y_offset_added
local floor_cell_at 079523 t3 y_high
local floor_cell_at 07953C t1 row_offset
local floor_cell_at 07953D t6 cell_offset
local floor_cell_at 079545 t2 cell_byte
local floor_cell_at 0794EE,079516,079526 a offset_high
local floor_cell_at 0794EE,079516,07953D b offset_low
# unused_take_floor_priority runs on an object in X (07CD9C "LDA #$09,X; ANDA #$CF; ORA <$E8; STA #$09,X" its
# attributes' priority bits, 07CDA7 "LDA #$C0; STA #$00,X" its flags), as take_floor_height_and_priority's twin does;
# D the offsets (07CD90 "CLRD": none) and the floor cell handed back (07CD91 "LBSR $9495", 07CD94 "TSTA")
param unused_take_floor_priority x object object
local unused_take_floor_priority 07CD9C t3 old_attributes
local unused_take_floor_priority 07CD90,07CD91 d cell
# set_climb_speed: the table of climb speeds it leaves in U (07CDD3 "LDU #$F124"), the height of the floor the object
# is on (07CDD6 "LDB #$5D,X; LSRB x3": its floor_z's low byte), the speed times 16 (07CDE3 "ASLDI #$04", 07CDE5 "STD
# #$19,X")
local set_climb_speed 07CDD3 u climb_speed_table
local set_climb_speed 07CDD6 t3 floor_height
local set_climb_speed 07CDE3 t2 climb_z_speed
# check_floor: the cell under the object (07CE09 "CLRD", 07CE0A "LBSR $9495", 07CE0D "STA <$F0")
local check_floor 07CE0A d cell_here
# check_floor_ahead / enemy_start_climbing: the height of the step the enemy climbs to (07CF0E "CLRA; LDB #$45,X",
# 07CF11 / 07CF77 "ASLDI #$03": 8 pixels a level), compared with its height (07CF13 "CMPD #$16,X") or its floor's
# (07CF79 "CMPD #$5C,X")
local check_floor_ahead 07CF11 t2 step_height
local enemy_start_climbing 07CF77 t2 step_height
# done: engine/floor.c

# ---- engine/objects.c ----
# clear_objects / clear_enemy_objects / clear_list_1_objects clear the objects a word at a time (07956B / 07959D /
# 0795CD "STD ,X++" with D cleared: 07956A / 07959C / 0795CC "CLRD"), 30 words each (07956D / 07959F / 0795CF "DEC
# <$E8|<$E9"), then the next object (0795A9 / 0795D9 "DEC <$E8"), keeping each object's sprites (079597 / 0795C7 "LDD
# #$59,X; PUSHS D", 0795A6 / 0795D6 "STD #$-07,X")
local clear_objects 07956B t1 cleared_word
local clear_objects 07956D t2 words_left
local clear_objects 07956A a blank_high
local clear_objects 07956A d blank_low
local clear_enemy_objects 079597 t5 kept_sprites
local clear_enemy_objects 07959D t1 cleared_word
local clear_enemy_objects 07959F t2 words_left
local clear_enemy_objects 0795A9 t2 objects_left
local clear_enemy_objects 07959C a blank_high
local clear_enemy_objects 07959C d blank_low
local clear_list_1_objects 0795C7 t5 kept_sprites
local clear_list_1_objects 0795CD t1 cleared_word
local clear_list_1_objects 0795CF t2 words_left
local clear_list_1_objects 0795D9 t2 objects_left
local clear_list_1_objects 0795CC a blank_high
local clear_list_1_objects 0795CC d blank_low
# done: engine/objects.c

# ---- game/attract.c ----
# attract: the credits, each slot's with separate coin slots (079E50 "LDD <$17", 079E55 "LDD <$1F", 079E5A "LDD
# <$27", 079E5F "LDD <$2F"), the common ones else (079E46 "LDD <$37"); with any, their high byte is what 079E89 "STA
# <$5B" stores in players_joined as the game starts
local attract 079E50 t4 slot_1_credit_count
local attract 079E55 t4 slot_2_credit_count
local attract 079E5A t4 slot_3_credit_count
local attract 079E5F t4 slot_4_credit_count
local attract 079E46 t4 credit_count
local attract 079E46,079E50,079E55,079E5A,079E5F a credits_high
# attract_opening_run: the opening's step doubled, the offset bank 20's dispatcher jumps by (04001B "ASLA", then "JMP
# [A,X]"); attract_profile_move_out and _pause take it as the move's number
local attract_opening_run 04001B a step_offset
# done: game/attract.c

# ---- game/continue.c ----
# continue_screen: each player's variables (07B985 "LDY #$49D0", 07B989 "LDB #$07,Y" the state) and its continue
# countdown (07B96D/07B998/07B9DE "LDU #$07,X": the player record's countdown; 07B983 "STA ,U", 07B9A3 "STA ,U; CLR
# #$01,U", 07B9E1 "CLRW ,U"); the seconds before and after the BCD step down (07B94C/07B972 "ADDA $4A1C" with A = 99,
# then "DAA"); each record's state (07B989 / 07B9CF "LDB #$07,Y; CMPB #$03")
local continue_screen 07B985,07B9AA,07B9CB,07B9ED y player_vars player_values
local continue_screen 07B96D,07B998,07B9DE u countdown_address player_counters
local continue_screen 07B94C t1 old_seconds
local continue_screen 07B94C t3 seconds_sum
local continue_screen 07B972 t1 old_seconds_2
local continue_screen 07B972 t3 seconds_sum_2
local continue_screen 07B9CF t3 record_state
local continue_screen 07B989 t3 record_state_2
# check_players_out hands back in D the last play status it read (07B8BA ... 07B8D2 "LDA $49F3; CMPA #$02") or 2 once
# all are out (07B8FB "LDA #$02"), over the B it was given
local check_players_out 07B900 d play_status_word
# done: game/continue.c

# ---- game/game.c ----
# game_start_clear: the K052109's scroll control (1C80), which "CLR $1C80" reads before it clears it (07A3D1)
local game_start_clear 07A3D1 t1 old_scroll_control
# end_game: the players left to look at, before the count down (07B6CE "DECB")
local end_game 07B6CE t1 players_to_check
# done: game/game.c

# ---- game/game_over.c ----
# game_over_wait: the scene timer before its count down (07B4BF "DECW <$0A")
local game_over_wait 07B4BF t4 timer_before
# game_finish: the K052109's scroll control the clear reads (07B4C4 "CLR $1C80"), the scores left to rank (07B4E0 "DEC
# <$F0", 4 from 07B4D1)
local game_finish 07B4C4 t1 old_scroll_control
local game_finish 07B4E0 t2 scores_left
# done: game/game_over.c

# ---- game/name_entry.c ----
# (name_entry_end's U is what end_game leaves there, handed to palette_request: left)
# done: game/name_entry.c

# ---- game/score.c ----
# add_score: a BCD addition into the score X points at: the score's low byte (079708 "ADDA #$01,X"), the binary sum
# and its decimal form (07970B "DAA", 07970C "STA #$01,X"), the high byte (079711 "ADCA ,X") and its binary sum
local add_score 079708 t3 score_low
local add_score 079708 t5 low_binary_sum
local add_score 07970B t1 low_digits
local add_score 079711 t2 score_high
local add_score 079711 t4 high_binary_sum
# high_score_rank: the score it ranks (079723 "LDD <$E8"), compared with each high score (079726 "CMPD ,X")
local high_score_rank 079723 t4 score_compared
local high_score_rank 079723 d score_low_byte
# insert_high_score: the place the records move down to (079758 "DEC <$E9"), each word of the record above (079762
# "LDD #$-08,X") and where it goes (079765 "STD ,X++"), the words left of a record (079767 / 07977D "DEC <$EA"), the
# new entry's words (079779 "LDD ,U++" from 48F0) and where they go (07977B "STD ,X++")
local insert_high_score 079758 t3 moved_place
local insert_high_score 079762 t5 moved_word
local insert_high_score 079765 t1 word_place
local insert_high_score 079767 t2 words_left
local insert_high_score 079779 t1 entry_word_place
local insert_high_score 079779 t4 entry_word
local insert_high_score 07977B t1 word_place_2
local insert_high_score 07977D t2 words_left_2
# done: game/score.c

# ---- game/skip.c ----
# check_skip: the players' newly pressed controls' addresses (07979A "LDX #$E449", 0797A1 "LDA [A,X]")
local check_skip 07979A x presses_addresses
# done: game/skip.c

# ---- game/start.c ----
# portraits_run: the step timer before its count down (07A465 "DECW <$0B"); portraits_wait: its high byte before the
# count down (07A4B4 "DEC <$0B")
local portraits_run 07A465 t4 timer_before
local portraits_wait 07A4B4 t2 wait_before
# done: game/start.c

# ---- test_mode/checks.c ----
# each page's dispatcher: the page's table of steps (05E09B "LDX #$60A1", 05E0C3 "LDX #$60C9", 05E0EC "LDX #$60F2",
# 05E177 "LDX #$617D"), which the shared 05E03B jumps through by the page's step ("JMP [A,X]") and leaves in X for the
# step it runs
local test_rom_check_page 05E09B x page_steps
local test_screen_check_page 05E0C3 x page_steps
local test_color_check_page 05E0EC x page_steps
local test_io_check_page 05E177 x page_steps
# test_screen_check_draw: the tile pair's place (05E0DD "STU ,X++"), the pairs and rows still to draw before each count
# down (05E0DF "DBJNZ", 05E0E4 "DECA")
local test_screen_check_draw 05E0DD t1 tile_place
local test_screen_check_draw 05E0DF t1 pairs_to_go
local test_screen_check_draw 05E0E4 t1 rows_to_go
# test_color_check_draw: the counts before each count down (05E10F "DEC <$F2" a block's tiles, 05E117 "DEC <$F1" its
# rows, 05E121 "DEC <$F0" the blocks); the last ramp's tile and colour (05E144 "LDA #$30", 05E146 "LDB #$C0", 05E148
# "BSR $614F"), whose B the page's text number takes (05E14A "LDA #$03; LBRA $662A")
local test_color_check_draw 05E10F t2 block_tiles_to_go
local test_color_check_draw 05E117 t2 block_rows_to_go
local test_color_check_draw 05E121 t2 blocks_to_go
local test_color_check_draw 05E148 d ramp_tile_and_colour
local test_color_check_draw 05E148 b ramp_colour
# test_color_check_draw_ramp: the ramp's tile and colour from the stack (05E15B "LDD ,S"; 05E16E "INC ,S" a colour on
# each time), the rows and colours still to draw before each count down (05E166 "DEC <$F1", 05E170 "DEC <$F0")
local test_color_check_draw_ramp 05E15B t4 ramp_step
local test_color_check_draw_ramp 05E15B a ramp_tile
local test_color_check_draw_ramp 05E15B b ramp_colour
local test_color_check_draw_ramp 05E166 t2 rows_to_go
local test_color_check_draw_ramp 05E170 t2 colours_to_go
# test_io_check_open: the places of the second and third pairs of blank tiles (05E19B "STD ,X++", 05E19D "LEAX
# #$05,X", 05E1A0 "STD ,X++")
local test_io_check_open 05E19B t1 second_pair_place
local test_io_check_open 05E1A0 t1 third_pair_place
# test_io_check_run: each input port's place (05E1B3 "LDA ,Y+" from 1F90), its bits before each shift (05E1BF "LSRA"),
# the bits and ports still to draw before each count down (05E1C7 / 05E1FF "DBJNZ"), the coin bits before their shift
# (05E1E2 "LSR <$F0"); after the start buttons' setting is read (05E1D1 "LBSR $660A": B the setting, A the port's bits
# left)
local test_io_check_run 05E1B3 t1 port_place
local test_io_check_run 05E1BF t1 bits_before_shift
local test_io_check_run 05E1C7 t1 bits_to_go
local test_io_check_run 05E1E2 t2 coin_bits_before_shift
local test_io_check_run 05E1FF t1 ports_to_go
local test_io_check_run 05E1D1 a port_bits_left
local test_io_check_run 05E1D1 b start_buttons_setting
# test_io_check_draw_bit: the bit (0 or 1) rotated right through the carry three times into the colour's bit 5
# (05E20A "RORB", 05E20B "RORB", 05E20C "RORB", 05E20D "STB #$-1FC0,X")
local test_io_check_draw_bit 05E20A t2 rotated_once
local test_io_check_draw_bit 05E20B t2 rotated_twice
# done: test_mode/checks.c

# ---- test_mode/menu.c ----
# test_run_page: the pages' table (05E024 "LDX #$7580", 05E02C "JSR [A,X]" by 5908); the menu page's step table (05E042
# "LDX #$6047")
local test_run_page 05E024 x pages
local test_menu_page 05E042 x page_steps
# test_menu_open: each test palette's record (05E060 "LDX ,Y++" its destination, 05E065 "BMOVE Y,X,U" its 32 colours,
# from 05E05D "LDY #$7B6C" test_mode_palettes), the palettes still to load before the count down (05E066 "DBJNZ");
# the menu's text number (05E07E "LDA #$00"), the start buttons' setting read with it (05E083 "LDY #$5A60", 05E086
# "LBSR $660A"), the print's colour (05E095 "LDB #$00")
local test_menu_open 05E060 t1 palette_record test_palette
local test_menu_open 05E066 t1 palettes_to_go
local test_menu_open 05E07E,05E086 a menu_text_number
local test_menu_open 05E095 b print_colour
local test_menu_open 05E086 d start_buttons_word
# test_menu_update: player 1's port (05E50C "LDA $1F90"), its up and down bits (05E510 "ANDA #$0C"), the cursor moved
# by the step (05E523 "ADDA [,Y]"), the cursor sign-extended for the division by 3 (05E599 "SEX", 05E5A0 "DIV X,B");
# the cursor's repeat delay (05E542 "LDA #$07", 05E550 "CLRA", 05E551 "STA $5914")
local test_menu_update 05E50C t1 player_1_port
local test_menu_update 05E510 t2 up_down_bits
local test_menu_update 05E523 t7 moved_cursor
local test_menu_update 05E599 t1 cursor_word
local test_menu_update 05E542,05E550 a repeat_delay
# test_colour_row: the row's place from the stack (05E5C0 "LDD #$02,S") and its colours' place (05E5C3 "ADDD #$E000":
# 2000 below)
local test_colour_row 05E5C0 t5 saved_row
local test_colour_row 05E5C3 t2 row_colours
# test_read_setting: a setting kept in RAM (05E627 "LDB ,Y"); the high byte it hands back as it came (05E60A, 05E614
# "PUSHS U,Y,X,A"); the EEPROM's place (05E616 "LEAY #$-59F0,Y", 05E61C "LDA #$01,S") and the byte read (05E621 "LBSR
# $6915")
local test_read_setting 05E627 t2 setting_byte
local test_read_setting 05E60A a value_high
local test_read_setting 05E621 d eeprom_word
# test_open_page: after the text, the page's menu: its length (05E636 "LDA ,U+"), the address of its cursor's variable
# (05E63C "LDD ,U++") and where that word is, then the lines (05E646 "STU $590D")
local test_open_page 05E636 t1 page_menu
local test_open_page 05E63C t1 cursor_variable_place
local test_open_page 05E63C t4 cursor_variable_address
# test_print: the text's next byte's place (05E656 "LDA ,U+"), the character (05E65C "SUBA #$30") or the command
# (05E685 "SUBA #$C7"), the address of the variable printed in hex (05E6D6 "LDY ,U++"), a new place: the row times 64
# (05E673 "ASLDI #$06"), the column byte's place (05E675 "ADDB ,U+") and the tile place (05E677 "ADDD #$208C")
local test_print 05E656 t1 text_place
local test_print 05E65C t1 printed_character
local test_print 05E685 t1 command_character
local test_print 05E6D6 t1 variable_address_place
local test_print 05E673 t2 place_row_offset
local test_print 05E675 t1 column_place
local test_print 05E677 t2 new_tiles
# test_put_tile: the tile's place (05E701 "STA ,X+")
local test_put_tile 05E701 t1 tile_place
# unused_test_print_hex_word: the word in U, printed a byte at a time (05E706 "LDA ,S", 05E70A "LDA #$01,S")
param unused_test_print_hex_word u printed_word
# test_print_hex: the two digits' places (05E71C / 05E724 "STA ,X+")
local test_print_hex 05E71C t1 high_digit_place
local test_print_hex 05E724 t1 low_digit_place
# done: test_mode/menu.c

# ---- test_mode/options.c ----
# the setting pages hand test_choose_setting the page's text number in B (05E2AD "LDB #$07", 05E3FE "LDB #$0C",
# 05E406 "LDB #$0D"...; 05E42F "TFR B,A; ... LBSR $662A" opens it) and get the choice back in B (05E2B4 "TSTB")
local test_start_buttons_page 05E2AF d text_and_choice
local test_players_page 05E400 d text_and_choice
local test_difficulty_page 05E408 d text_and_choice
local test_attract_sound_page 05E410 d text_and_choice
local test_screen_flip_page 05E418 d text_and_choice
local test_sound_output_page 05E423 d text_and_choice
local test_coinage_page 05E4DB d text_and_choice
local test_premium_coins_page 05E4E3 d text_and_choice
local test_premium_coinage_page 05E4DB d text_and_choice
# the options' and the factory setting's step tables (05E2C3 "LDX #$62C9", 05E467 "LDX #$646D"), the setting's
# (05E425 "LDX #$642B")
local test_options_page 05E2C3 x page_steps
local test_factory_setting_page 05E467 x page_steps
local test_choose_setting 05E425 x page_steps
# test_print_coinage: the coins (A) and the premium start's extra coins (B) read together (05E2ED "LBSR $660A",
# 05E2F0 "PUSHS B; ADDA ,S+")
local test_print_coinage 05E2ED d coins_and_extra
# test_options_open: the players' setting plus 1, the digit printed (05E336 "TFR B,A", 05E338 "ADDA #$01"); each
# setting read (05E330 / 05E34A / 05E369 / 05E380 "LBSR $660A": B)
local test_options_open 05E338 a players_digit
local test_options_open 05E330,05E34A,05E369,05E380 b setting_byte
# test_choose_setting_open: the marking colour handed to test_mark_setting (05E438 "LDA #$40", 05E43A "BSR $6461")
local test_choose_setting_open 05E43A d mark_colour_word
# done: test_mode/options.c

# ---- test_mode/rom_check.c ----
# test_rom_check_step: the step doubled (05EAB7 "ASLA", 05EAB8 "JMP [A,X]")
local test_rom_check_step 05EAB7 a step_offset
# test_rom_check_start: the sound CPU's answer (05EACB "LBSR $8605", 05EACE "ANDA #$80": no sound CPU) and the
# sample ROM check's start (05EAD6 "LBSR $8608")
local test_rom_check_start 05EACB,05EAD6 d sound_cpu_answer
local test_rom_check_start 05EACB,05EAD6 b answer_low
# test_rom_check_tiles_result: the second and fourth tile ROM sums (05EB1D "LDD $5A14", 05EB2A "LDD $5A18"), added to
# the first and third (05EB21 / 05EB2E "LEAX D,X")
local test_rom_check_tiles_result 05EB1D t3 tile_sum_2
local test_rom_check_tiles_result 05EB2A t3 tile_sum_4
# test_rom_check_sum_sprites: the passes still to run before the count down (05EB72 "DEC <$F0")
local test_rom_check_sum_sprites 05EB72 t2 passes_to_go
# test_rom_check_6g / _7g: whether there is no sound CPU (05EB93 / 05EBBF "LDA $5A1B"); the sum of the sample ROM the
# sound CPU hands back (05EBA1 "PUSHS D; PULLS X", printed by test_print_rom_ok / _bad: 05ED45 "PUSHS X; PULLS D")
local test_rom_check_6g 05EB93 t1 sound_cpu_missing
local test_rom_check_6g 05EBA5 x sample_sum
local test_rom_check_7g 05EBBF t1 sound_cpu_missing
local test_rom_check_7g 05EBCC x sample_sum
# test_sum_tile_rom: the watchdog's read each byte (05EC29 "TST $1FCA"), the bytes left after the count down (05EC35
# "LEAY #$-01,Y"), the pages still to sum before the count down (05EC49 "DEC <$E8")
local test_sum_tile_rom 05EC29 t1 watchdog_read
local test_sum_tile_rom 05EC35 t2 remaining_bytes
local test_sum_tile_rom 05EC49 t2 pages_to_go
# test_sum_sprite_rom: the sprite ROM's two bytes (05ECAF "LDB $1FC8", 05ECB4 "LDB $1FC9"), the address's low word
# before its step of 4 (05ECB9 "LDD <$F5", 05ECBC "ADDD #$0004"), the watchdog's read (05ECCA "TST $1FCA"), the
# reads left after the count down (05ECCE "LEAY #$-01,Y")
local test_sum_sprite_rom 05ECAF t1 first_byte
local test_sum_sprite_rom 05ECB4 t1 second_byte
local test_sum_sprite_rom 05ECB9 t4 old_address_low
local test_sum_sprite_rom 05ECBC t1 address_low_before
local test_sum_sprite_rom 05ECCA t1 watchdog_read
local test_sum_sprite_rom 05ECCE t2 remaining_reads
# test_print_rom_ok: the places of its letters, O (05ED16 "STB ,U+" tile 1F) and K (05ED1E, tile 1B)
local test_print_rom_ok 05ED16 t1 letter_o_place
local test_print_rom_ok 05ED1E t1 letter_k_place
# test_print_rom_bad: B (05ED30, tile 12), A (05ED38, tile 11), D (05ED40, tile 14)
local test_print_rom_bad 05ED30 t1 letter_b_place
local test_print_rom_bad 05ED38 t1 letter_a_place
local test_print_rom_bad 05ED40 t1 letter_d_place
# done: test_mode/rom_check.c

# ---- test_mode/sound_test.c ----
# the music and sound pages' step tables (05E215 "LDX #$621B", 05E271 "LDX #$6277")
local test_music_page 05E215 x page_steps
local test_sound_page 05E271 x page_steps
# the variable with the number the page plays (05E22E "LDX #$5915", 05E290 "LDX #$5916"), handed to
# test_sound_test_next
local test_music_choice 05E22E x number_variable
local test_sound_choice 05E290 x number_variable
# test_sound_test_next: the last number, past which the count goes back to 0 (05E24B "PUSHS A", 05E250 "CMPA ,S+")
local test_sound_test_next 05E248 a last_number
# test_sound_choice: the sound's timer before its count down (05E285 "DEC $5917")
local test_sound_choice 05E285 t1 timer_before
# done: test_mode/sound_test.c

# ---- system (fork: system/*): temporaries, typed pointers, register names ----
# Evidence: build/listing/simpsons.s as PLACE "INSTRUCTION", the C of the C.


# A player's controls, 4 bytes from 4840 + 4 x player (player_controls): update_controls keeps them from the port at
# U (07924D "LDA ,X; STA #$01,X", 079252 "LDA ,U; COMA; STA ,X", 079257 "LDA #$01,X; ANDA ,X; STA #$03,X", 07925F "LDA
# #$01,X; COMA; ANDA ,X; STA #$02,X"), for the IRQ's 4 ports (079092 "LDU #$1F90; LDX #$4840; LBSR $9248" ...
# 0790B0 "LDX #$484C") and the attract's demo inputs (07A1B4-07A1DB "LDX #$4840" ... "LBSR $924D"); bonus_player's
# controls_pressed and player_variable_records' held point into them
struct player_input 04
field player_input 00 now u8
field player_input 01 last u8
field player_input 02 pressed u8
field player_input 03 held u8

# the settings the test mode keeps after the coin setting (59F1), which eeprom_load_settings copies from the EEPROM's
# 68-7D to 59F0-59FD (05EA81 "LDU #$59F0; LDA #$68", 05EA89 "STB ,U+") and apply_settings reads by X = 59F1: the
# OPTIONS page's lines (assets/data/texts.txt: "3 DIFFICULTY", "4 SOUND IN ATTRACT MODE", "5 VIDEO SCREEN FLIP", "6
# SOUND OUTPUT"); 078A56 "LDA #$03,X; STA <$14" (difficulty_setting)
59F4  var  difficulty_option  u8
# 078A4F "LDA #$04,X; INCA; STA <$5A": the lives a credit gives, less one
59F5  var  lives_option  u8
# 078A5C "LDA #$05,X; STA <$13" (attract_sound)
59F6  var  attract_sound_option  u8
# 078A62 "LDA #$06,X; BNE" the screen flipped (1E80, the K053246's 1FA5 bits 0-1, flip_screen)
59F7  var  screen_flip_option  u8
# 078ACD "LDB #$08,X; BEQ", 078AD2 "ORA #$04": board_output's bit 2 (1FC0: MAME's simpsons.cpp, "bit 2 selects mono or
# stereo sound")
59F9  var  sound_output_option  u8
# 078AD7 "LDA #$09,X; STA <$3A" (first_credit_extra_coins: the coins more a slot's first credit takes)
59FA  var  first_credit_coins_option  u8

# ---- system/boot.c ----
# boot: the power-on delay (0786CF "INCA; BNE"): the count after each step
local boot 0786CF t2 power_on_count
# the reads of the K052109's registers its clears make (0786FA "CLR $1C80", 078707 / 078898 "CLR $1E80": the scroll
# control and the flip), and of 1FC4 (078703 "TST $1FC4": the Z80's IRQ)
local boot 0786FA t1 old_scroll_control
local boot 078707 t1 old_flip
local boot 078898 t1 old_flip_2
local boot 078703 t1 sound_irq_read
# the watchdog's reads (TST / LDB $1FCA: 07876D, 078781, 0787F7, 078837, 0788F0, 0788F7, 07890D, 078950, 078972,
# 078A0C)
local boot 07876D t1 watchdog_read
local boot 078781 t1 watchdog_read_2
local boot 0787F7 t1 watchdog_read_3
local boot 078837 t1 watchdog_read_4
local boot 0788F0 t1 watchdog_read_5
local boot 0788F7 t1 watchdog_read_6
local boot 07890D t1 watchdog_read_7
local boot 078950 t1 watchdog_read_8
local boot 078972 t1 watchdog_read_9
local boot 078A0C t1 watchdog_read_10
# the RAM test of 5D00-5FFF: the byte each pass writes (078766 "STA ,U+"), checks (078777 "CMPA ,U+") and clears
# (078791 "CLR ,U+"), and the bytes still to do after each (078768 / 07877C / 078793 "LEAX #$-01,X")
local boot 078766 t1 pattern_place
local boot 078777 t1 checked_place
local boot 078791 t1 cleared_place
local boot 078768 t2 remaining_bytes
local boot 07877C t2 remaining_bytes_2
local boot 078793 t2 remaining_bytes_3
# the bad RAM's text: the letter read (0789F9 "LDA ,U+") and the tile written (0789FD "STA ,X+"), the letters before
# each (0789FF "DECB")
local boot 0789F9 t1 letter_place
local boot 0789FD t1 tile_place
local boot 0789FF t1 letters_left_was
# the waits: the count after each step (078A07 / 078908 "LEAX #$-01,X"), the loops before each (078A10 / 078911
# "DECA")
local boot 078A07 t2 remaining_wait
local boot 078908 t2 remaining_wait_2
local boot 078A10 t1 delay_was
local boot 078911 t1 delay_was_2
# the wait for the first VBLANK's DMA (078814 "LDA <$56; BNE")
local boot 078814 t2 dma_still_pending
# the test switch, bit 0 of 1F81 (078819 / 07887C "LDA $1F81; ANDA #$01")
local boot 078819 t1 test_inputs
local boot 07887C t1 test_inputs_2
# 07884D "LBSR $6000" (eeprom_test), 078850 "TSTA; BEQ": A not 0, the EEPROM is bad (text 8, "BAD")
local boot 07884D a eeprom_bad
# the queues filled with FFFF, no job or command (07891F / 078934 "LDD #$FFFF"), a word at a time (078922 / 078937
# "STD ,X++")
local boot 07891F,078934 a free_mark_high
local boot 07891F,078934 b free_mark_low
local boot 078922 t1 job_slot_place
local boot 078937 t1 sound_slot_place
# the job queue's slots from 4944 (078914 "LDX #$4944", 078922 "STD ,X++")
local boot 078914 x queue_place queued_job
# the default high scores copied, a byte at a time (078946 "LDA ,X+", 078948 "STA ,U+", 07894A "DECB")
local boot 078946 t1 default_byte_place
local boot 078948 t1 high_score_byte_place
local boot 07894A t1 table_bytes_left_was
# the main loop: the job queue's read place (0789CB "LDX $4942"), the job there (0789CF "LDD ,X; BMI": FFFF none; A
# the kind, B the argument) and the slot it frees (0789D3 "LDU #$FFFF; STU ,X++")
local boot 0789CB x job_place queued_job
local boot 0789CF t4 job_word
local boot 0789D6 t1 taken_job_place
# apply_settings: the settings read from 59F1 + n (078A4F "LDA #$04,X", 078A56 "LDA #$03,X", 078A5C "LDA #$05,X",
# 078A62 "LDA #$06,X", 078ACD "LDB #$08,X", 078AD7 "LDA #$09,X")
local apply_settings 078A4F t3 lives_chosen
local apply_settings 078A56 t3 difficulty_chosen
local apply_settings 078A5C t3 attract_sound_chosen
local apply_settings 078A62 t3 flip_chosen
local apply_settings 078ACD t3 stereo_chosen
local apply_settings 078AD7 t3 extra_coins_chosen
# draw_boot_pattern: the tile pair's place (078AF8 / 078B05 "STU ,X++"), the pairs before each (078AFA / 078B07
# "DECA"), the rows before each (078B0D "DECB")
local draw_boot_pattern 078AF8 t1 pair_place
local draw_boot_pattern 078B05 t1 pair_place_2
local draw_boot_pattern 078AFA t1 pairs_left_was
local draw_boot_pattern 078B07 t1 pairs_left_was_2
local draw_boot_pattern 078B0D t1 rows_left_was
# check_work_ram: test_ram_words's result, B 0 good (078B17 "LBSR $8DCF", 078B1A "TSTB")
local check_work_ram 078B17 d test_result
# ram_rom_check: what each check gives back, B its result (078B35 ... 078BAE "LBSR $8DCF" / "LBSR $8E19", 078BC1
# "LBSR $600C" eeprom_verify, then "STB $5D04" ...; 078D41 the Z80's ROM sum)
local ram_rom_check 078B35,078B48,078B55,078B66,078B73,078B84,078B9B,078BAE,078BC1,078D41 d check_word
local ram_rom_check 078BCB t1 watchdog_read
local ram_rom_check 078D79 t1 watchdog_read_2
# the sums of each chip's banks against the ones kept (078C43 / 078C8B / 078CCA / 078D09 "LDD <$FA; CMPD")
local ram_rom_check 078C43 t4 sum_13c
local ram_rom_check 078C8B t4 sum_15c
local ram_rom_check 078CCA t4 sum_16c
local ram_rom_check 078D09 t4 sum_17c
# the last wait: the count and what is left of it (078D74 "SUBD #$0001; BNE"), the loops before each (078D7D "DEC
# <$F2")
local ram_rom_check 078D74 t1 wait_count
local ram_rom_check 078D74 t2 wait_count_left
local ram_rom_check 078D7D t2 wait_loops_was
# set_check_colours: the colour's place (078D9C / 078DB1 "STD ,X++"), the colours before each (078D9E / 078DB3 "DEC
# ,S")
local set_check_colours 078D9C t1 written_colour_place
local set_check_colours 078DB1 t1 written_colour_place_2
local set_check_colours 078D9E t2 colours_left_was
local set_check_colours 078DB3 t2 colours_left_was_2
# test_ram_words: the word written (078DDE "STX ,U++") and checked (078E02 "CMPX ,U++"), the words before each
# (078DE5 / 078E06 "SUBD #$0001"), the wait before each step (078DF1), the watchdog (078DE1 / 078DED / 078DFE "TST
# $1FCA")
local test_ram_words 078DDE t1 written_word_place
local test_ram_words 078E02 t1 checked_word_place
local test_ram_words 078DE5 t1 words_left_was
local test_ram_words 078E06 t1 words_left_was_2
local test_ram_words 078DF1 t1 wait_left_was
local test_ram_words 078DE1 t1 watchdog_read
local test_ram_words 078DED t1 watchdog_read_2
local test_ram_words 078DFE t1 watchdog_read_3
# test_ram_bytes: the same a byte at a time, every other byte (078E25 "STA ,U++", 078E47 "CMPA ,U++"), the bytes and
# the wait still left after each step (078E2C / 078E4B / 078E38 "LEAX #$-01,X")
local test_ram_bytes 078E25 t1 written_byte_place
local test_ram_bytes 078E47 t1 checked_byte_place
local test_ram_bytes 078E2C t2 bytes_still_left
local test_ram_bytes 078E4B t2 bytes_still_left_2
local test_ram_bytes 078E38 t2 wait_still_left
local test_ram_bytes 078E28 t1 watchdog_read
local test_ram_bytes 078E34 t1 watchdog_read_2
local test_ram_bytes 078E43 t1 watchdog_read_3
# print_check_result: B the check's result, 0 OK, 3 BAD (078E7F "PUSHS B", 078E81 "ORB $5D02", 078E94 "TSTB; BEQ;
# ABX": the text OK or BAD), what it gives back (078EAE "PULLS B,PC": A the last tile, B the result)
local print_check_result 078E7F b result_code
local print_check_result 078EAE d tile_and_result
# the letter read (078EA3 "LDA ,X+"), the tile written (078EA7 "STA ,U+"), the letters before each (078EA9 "DEC <$F0")
local print_check_result 078EA3 t1 letter_place
local print_check_result 078EA7 t1 tile_place
local print_check_result 078EA9 t2 letters_left_was
# ask_sound_cpu_check: 078EB7 "TST $1FC4" (the Z80's IRQ), 078EBE "LEAX #$-01,X" the wait left, 078EC3 "CMPB $1FC7"
# the Z80's echo of the command, 078EC9 "LDD $1FC6" its answer
local ask_sound_cpu_check 078EB7 t1 sound_irq_read
local ask_sound_cpu_check 078EBE t2 wait_still_left
local ask_sound_cpu_check 078EC3 t1 sound_echo
local ask_sound_cpu_check 078EC9 t3 sound_answer
# read_sound_rom_sum: the commands F383 and F282 and the Z80's answers (078ED2 "LDD #$F383", 078ED5 "JSR $8F30",
# 078EDB "LDD #$F282", 078EDE "JSR $8F30")
local read_sound_rom_sum 078ED5,078EDE d sound_exchange
# reset_sound: 078F2B "TST $1FC4" (the Z80's IRQ)
local reset_sound 078F2B t1 sound_irq_read
# send_sound_command_and_wait: 078F34 "TST $1FC4", 078F38 "CMPB $1FC7; BNE" the echo, 078F3E "LDD $1FC6" the answer
local send_sound_command_and_wait 078F34 t1 sound_irq_read
local send_sound_command_and_wait 078F38 t1 sound_echo
local send_sound_command_and_wait 078F3E t3 sound_answer
# done: system/boot.c

# ---- system/eeprom.c ----
# eeprom_test: each cell's address and data, both one up (05EA26 "ADDD #$0101"), written (05EA23 "LBSR $68F1") and
# read back (05EA31 "LBSR $6915")
local eeprom_test 05EA26 t2 next_cell
local eeprom_test 05EA23,05EA31 d cell
# eeprom_verify: the stored sum's cells (05EA6A "LDA #$7E", 05EA6C / 05EA72 "LBSR $6915")
local eeprom_verify 05EA6C,05EA72 d cell
# eeprom_load_settings: the cells 68-7D (05EA86 "LBSR $6915") into 59F0 on (05EA89 "STB ,U+")
local eeprom_load_settings 05EA86 d cell
local eeprom_load_settings 05EA89 t1 setting_byte_place
# the signal lists the EEPROM's lines are driven by, one byte a step to FF (05E9E5 "LDA ,X+; STA $1FC2")
local eeprom_send_unlock 05E9E5 t1 signal_place
local eeprom_send_write 05E9E5 t1 signal_place
local eeprom_deselect 05E9E5 t1 signal_place
local eeprom_send_lock 05E9E5 t1 signal_place
local eeprom_send_read 05E9E5 t1 signal_place
local unused_eeprom_send_ones 05E9E5 t1 signal_place
# the address's and the data's bits: the clock's signal (05E954 / 05E97A "ORA ,X+; STA $1FC2"), the next bit's
# (05E95E / 05E983 "LDA ,X+; CMPA #$FF")
local eeprom_send_address 05E954 t1 clock_place
local eeprom_send_address 05E95E t1 signal_place
local eeprom_send_data 05E97A t1 clock_place
local eeprom_send_data 05E983 t1 signal_place
# eeprom_wait_ready: 1F81's bit 5, the EEPROM ready (05E998 "LDA $1F81; ANDA #$20; BEQ")
local eeprom_wait_ready 05E998 t1 status_port
# eeprom_receive_data: the two signals of each bit (05E9B4 / 05E9BD "LDA ,X+; STA $1FC2"), 1F81's bit 4, the data line
# (05E9C6 "LDA $1F81", 05E9CA "ANDA #$10"), the byte so far and shifted (05E9D0 "ROL $5A02"), the bits before each
# (05E9DC "DECB")
local eeprom_receive_data 05E9B4 t1 signal_place
local eeprom_receive_data 05E9BD t1 clock_place
local eeprom_receive_data 05E9C6 t1 status_port
local eeprom_receive_data 05E9CA t2 data_line
local eeprom_receive_data 05E9D0 t1 read_bits
local eeprom_receive_data 05E9D0 t2 read_bits_shifted
local eeprom_receive_data 05E9DC t1 bits_left_was
# eeprom_delay: 05E9F2 "TST $1FCA"
local eeprom_delay 05E9F2 t1 watchdog_read
# eeprom_write_defaults: the factory setting's byte (05EA4B "LDB ,U+; CMPB #$FF")
local eeprom_write_defaults 05EA4B t1 default_place
# eeprom_sum: the cells read (05EA98 "LDA <$F2", 05EA9B "LBSR $6915"), the total with each added (05EA9F "ADDD <$F0";
# B its low byte, 05EA91 "CLRD")
local eeprom_sum 05EA9B d cell
local eeprom_sum 05EA9F t6 new_total
local eeprom_sum 05EA91,05EA9F d total_low
# done: system/eeprom.c

# ---- system/inputs.c ----
# coin_inserted: the slot's bit among the coins let go of this frame (0791DA "LDB <$3D; ORB <$3E; COMB; ANDB <$3F",
# 0791E4 "ANDB ,S")
local coin_inserted 0791E4 t4 released_coin_bits
# add_coin: U the coin slot's record (the IRQ's 079005 "LDU #$4817" ...)
param add_coin u slot coin_slot
# the coins before this one (0791F7 "INC #$02,U"), the pulses before (0791FF "INC #$03,U"), the coins in (079202
# "LDA #$02,U", 079229 "CMPA #$02,U", 079230 "LDA #$02,U"), the coins a credit takes (079205 "CMPA #$05,U", 07920A
# "SUBA #$05,U"), the credits they give (079211 "LDB #$06,U") and the shared credits with them (079214 "ADDD <$37"),
# the slot's first credit given (079221 "LDB #$07,U"), the slot's own credits with them (07923C "ADDD #$00,U")
local add_coin 0791F7 t3 coins_before
local add_coin 0791FF t3 pulses_before
local add_coin 079202 t3 slot_coins
local add_coin 079229 t3 slot_coins_2
local add_coin 079230 t3 slot_coins_3
local add_coin 079205 t3 credit_price
local add_coin 07920A t3 credit_price_2
local add_coin 079211 t3 credit_gain
local add_coin 079214 t6 new_credits
local add_coin 079221 t3 given_already
local add_coin 07923C t7 new_slot_credits
# update_controls / read_controls: X the player's controls (the IRQ's 079095 "LDX #$4840" ...)
param update_controls x controls player_input
param read_controls x controls player_input
# last frame's controls, taken with this frame's for the held ones (079257 "LDA #$01,X; ANDA ,X; STA #$03,X") and
# against them for the newly pressed ones (07925F "LDA #$01,X; COMA; ANDA ,X; STA #$02,X")
local update_controls 079257 t3 last_controls
local update_controls 07925F t3 last_controls_2
# done: system/inputs.c

# ---- system/interrupts.c ----
# irq_handler: the coin port (078F6F "LDA $1F80; COMA; STA <$3D"), the game's mode before the FIRQ's point (078F77
# "LDA <$00; LBEQ"), the test switch (079037 "LDA $1F81; ANDA #$01")
local irq_handler 078F6F t1 coin_port
local irq_handler 078F77 t2 mode_before_firq
local irq_handler 079037 t1 test_inputs
# the coin slots' bits and coin_inserted's / add_coin's answers (079000 "LDA #$01; LBSR $91D8", 07900B "LDA #$02",
# 07901D "LDA #$04", 07902A "LDA #$08"; 079008 ... "LBSR $91F7")
local irq_handler 079000,07900D,07901F,07902C d coin_bit
# the coin slots' records handed to add_coin (079005 "LDU #$4817", 079012 "LDU #$481F", 079024 "LDU #$4827", 079031
# "LDU #$482F")
local irq_handler 079005,079012,079024,079031 u slot coin_slot
# the sound queue's command sent to the Z80 (07905E "LDD ,X++", 079060 "STD $1FC6", 079064 "TST $1FC4")
local irq_handler 07905E t1 sound_slot_place
local irq_handler 07905E t4 sound_command
local irq_handler 079064 t1 sound_irq_read
local irq_handler 07908B t1 watchdog_read
# the players' controls (079095 "LDX #$4840", 07909E "LDX #$4844", 0790A7 "LDX #$4848", 0790B0 "LDX #$484C"; 079098
# "LBSR $9248")
local irq_handler 079095,07909E,0790A7,0790B0 x controls player_input
# the K052109's x scrolls of layers A and B: the layer's x (0790B6 "LDD <$BE", 0790DD "LDD <$CE"), less 5A (0790B9 /
# 0790E0 "SUBD #$005A"), the bytes swapped for the chip (0790BE / 0790E5 "EXG A,B"; "STD $1A00" / "STD $3A00")
local irq_handler 0790B6 t4 layer_a_x
local irq_handler 0790B9 t2 layer_a_chip_x
local irq_handler 0790BE t1 layer_a_x_swapped
local irq_handler 0790DD t4 layer_b_x
local irq_handler 0790E0 t2 layer_b_chip_x
local irq_handler 0790E5 t1 layer_b_x_swapped
# this frame's scrolls kept as last frame's (0790F4 "LDD <$BE; STD <$C1", 0790FA "LDD <$C5; STD <$C8", 079100 "LDD
# <$CE; STD <$D1", 079106 "LDD <$D5; STD <$D8"), and the camera's and the cemetery's low bytes and fractions (079112
# "LDD <$AD; STD <$B0", 07911E "LDD <$B3; STD <$B6", 07912A "LDD <$B9; STD <$BC")
local irq_handler 0790F4 t4 kept_layer_a_x
local irq_handler 0790FA t4 kept_layer_a_y
local irq_handler 079100 t4 kept_layer_b_x
local irq_handler 079106 t4 kept_layer_b_y
local irq_handler 079112 t4 camera_x_low
local irq_handler 07911E t4 camera_y_low
local irq_handler 07912A t4 cemetery_scroll_low
# done: system/interrupts.c

# ---- system/jobs.c ----
# queue_job / queue_sound_always: the queue's slot the word goes into (0797C3 "LDX $4940"... "STD ,X++"; 0797F8 "LDX
# $4900"... "STD ,X++")
local queue_job 0797C3 t1 job_slot_place
local queue_sound_always 0797F8 t1 sound_slot_place
# done: system/jobs.c

# ---- system/jump_table.c ----
# print_bcd_byte: A the BCD byte (its callers' D: 0785EA "LBRA $9400"; 079400 "PUSHS A"), its high digit before a
# blank 10 takes a 0's place (079402-079405 "LSRA" x 4, 079406 "BNE"), the tile's place (07940E "STA ,X+")
local print_bcd_byte 0785EA a bcd_byte
local print_bcd_byte 079405 t2 high_nibble
local print_bcd_byte 07940E t1 tile_place
# print_bcd_word: the digits before a blank 10 takes a leading 0's place (079420 / 079440 "LSRA", 07942D "ANDA #$0F"),
# the tiles' places (079429 / 079437 / 07944E "STA ,X+")
local print_bcd_word 079420 t2 nibble_1
local print_bcd_word 07942D t2 nibble_2
local print_bcd_word 079440 t2 nibble_3
local print_bcd_word 079429 t1 tile_place
local print_bcd_word 079437 t1 tile_place_2
local print_bcd_word 07944E t1 tile_place_3
# clear_child_objects: X the objects of list 2 from 4D40 (0795DF "LDX #$4D40", 0795E7 "LDA ,X; CMPA #$01", 0795ED
# "LEAX #$60,X")
local clear_child_objects 0795DF,0795ED x object_place object
# each one's sprites kept (0795F7 "LDD #$59,X; PUSHS D", 079606 "STD #$-07,X"), cleared with D 0 a word at a time
# (0795FC "CLRD", 0795FD "STD ,X++"), the words and objects before each (0795FF "DEC <$E9", 079609 "DEC <$E8")
local clear_child_objects 0795F7 t5 kept_sprites
local clear_child_objects 0795FC d clear_value
local clear_child_objects 0795FC a clear_value_high
local clear_child_objects 0795FD t1 cleared_word_place
local clear_child_objects 0795FF t2 object_words_left_was
local clear_child_objects 079609 t2 objects_left_was
# enemy_react_with_pits: the cemetery's scroll (07D694 "LDD <$B8; CMPD #$0500"), floor_at_offset's offsets in and
# cell out (07D6A4 "CLRD", 07D6A5 "LBSR $9495", 07D6A8 "TSTA")
local enemy_react_with_pits 07D694 t4 cemetery_position
local enemy_react_with_pits 07D6A4,07D6A5 d floor_probe
# sample_rom_check_answered: the Z80's echo (078F1D "LDB #$88", 078F1F "CMPB $1FC7")
local sample_rom_check_answered 078F1F t1 sound_echo
local sample_rom_check_answered 078F23 d sample_check_command
# floor_at_scratch_offset: floor_cell_at's D, the cell in A (0794B5 "BSR $94EB")
local floor_at_scratch_offset 0794B5 d cell
# unused_take_floor_height_and_priority: X an object (07CDBC "STA #$5D,X" its floor height, 07CDC7 "LDA #$09,X; ANDA
# #$CF; ORA <$E8" its attributes' priority); floor_at_offset's offsets in and cell out (07CDAD "CLRD", 07CDAE "LBSR
# $9495")
param unused_take_floor_height_and_priority x object object
local unused_take_floor_height_and_priority 07CDC7 t3 attributes
local unused_take_floor_height_and_priority 07CDAD,07CDAE d floor_probe
# the unused vectors hand X to routines that read it as an object (unused_take_floor_priority 07CD91 "LDA #$09,X";
# unused_collide_with_list_1_objects "LDA #$00,X; ANDA #$DF")
param unused_vector_take_floor_priority x object object
param unused_vector_collide_with_list_1_objects x object object
# enemy_hurt: U the hurt steps' table its steps' handlers get (07E1D3 "LDU #$F29E; LDA #$29,X; ASLA; JSR [A,U]")
local enemy_hurt 07E1D3 u hurt_step_table
# check_hits_with_enemies: the enemies before each (07C106 "DEC <$F1")
local check_hits_with_enemies 07C106 t2 enemies_left_was
# remove_off_screen: the object's x (07D1E8 "LDD #$0C,X; SUBD #$0040; CMPD #$0180")
local remove_off_screen 07D1E8 t5 object_x
# find_nearest_player: the players present (07D2AB "LDA $1874; BNE"), the object's and the player's x and y and their
# differences (07D2CA "LDD #$0C,X", 07D2CD "SUBD #$0C,U", 07D2D5 "LDD #$11,X", 07D2D8 "SUBD #$11,U"), the players
# before each (07D2F0 "DEC ,S"), the nearest one's object (07D2F7 "LDU $1872"), the nearest's distance's high byte, 7F
# none (07D2B1 "CLRA", 07D2FB "LDA <$EC; CMPA #$7F")
local find_nearest_player 07D2AB t1 present_count
local find_nearest_player 07D2CA t5 own_x
local find_nearest_player 07D2CD t5 player_x
local find_nearest_player 07D2CD t7 x_difference
local find_nearest_player 07D2D5 t5 own_y
local find_nearest_player 07D2D8 t5 player_y
local find_nearest_player 07D2D8 t7 y_difference
local find_nearest_player 07D2F0 t2 players_left_was
local find_nearest_player 07D2F7 t3 nearest_found
local find_nearest_player 07D2B1,07D2FB d nearest_result
# reserve_objects_for_sprites: A the objects to reserve (0786B3 "LBRA $E451": its callers' D), U each one's sprites
# (07E465 "LDU #$59,X", 07E470 "STA #$01,U": the depth, 07E473 "LEAU #$10,U"), the sprites and objects before each
# (07E477 / 07E480 "DEC ,S")
local reserve_objects_for_sprites 0786B3 a reserve_count
local reserve_objects_for_sprites 07E465,07E473 u sprite_place sprite_entry
local reserve_objects_for_sprites 07E477 t2 sprites_left_was
local reserve_objects_for_sprites 07E480 t2 objects_left_was
# print_big_text / erase_big_text: the text's place word (07939D / 0793D1 "LDX ,U++") and each character (07939F /
# 0793D3 "LDB ,U+")
local print_big_text 07939D t1 place_source
local print_big_text 07939F t1 character_source
local erase_big_text 0793D1 t1 place_source
local erase_big_text 0793D3 t1 character_source
# done: system/jump_table.c

# ---- system/reset.c ----
# (only BMOVE clears of work RAM and of the K052109's RAM, with names already: nothing to name)
# done: system/reset.c

# ---- video/palette.c ----
# request_palette_sets: the job find_free_palette_job hands back (07BAEF "LBSR $BF39", U), filled with kind 1 (07BAFA
# "LDA #$01; STA ,U") and the request (07BAFE "LDD <$E8; STD #$01,U": the loads wanted and the set)
local request_palette_sets 07BAEF u palette_job palette_job.sets
local request_palette_sets 07BAFE t4 loads_and_set
# request_palette_effect / request_palette_effect_in_slot (the second starts the effect again in the caller's job,
# 07BB15 "LDA ,U; CMPA #$02"): the job, kind 2 (07BB2F "LDA #$02; STA ,U")
param request_palette_effect_in_slot u palette_job palette_job.effect
local request_palette_effect 07BB24 u palette_job palette_job.effect
# the effect's number (07BB12 / 07BB21 "STD <$E8", 07BB48 "LDD <$E8; ASLB; ROLA; LDX D,X"): its low byte, doubled for
# palette_effects' index
local request_palette_effect_in_slot 07BB12,07BB48 b effect_low
local request_palette_effect 07BB48 b effect_low
local request_palette_effect_in_slot 07BB48 t4 effect_number
local request_palette_effect 07BB48 t4 effect_number
# the effect's header past its first 2 bytes, in bank 2E (07BB4D "LDX D,X", 07BB4F "LEAX #$02,X"), read a byte at a
# time: the colours a step sets less one (07BB52 "LDA ,X+; STA #$06,U") and the frames between steps (07BB57 "LDA ,X+;
# STA #$04,U; STA #$05,U"), then the steps (07BB5F "STX #$02,U"). Typed as the program's data, so that the reads are
# no bus reads in the statement that writes the job
local request_palette_effect_in_slot 07BB4F x effect_header rom
local request_palette_effect 07BB4F x effect_header rom
local request_palette_effect_in_slot 07BB52 t1 extra_colours_at
local request_palette_effect 07BB52 t1 extra_colours_at
local request_palette_effect_in_slot 07BB57 t1 delay_at
local request_palette_effect 07BB57 t1 delay_at
# request_background_colour: the job (07BB74 "LBSR $BF39"), kind 3, and the colour (07BB7D "LDD <$E8; STD #$01,U")
local request_background_colour 07BB74 u palette_job palette_job.background
local request_background_colour 07BB7D t4 background_colour
# request_palette_fade: the job (07BB88 "LBSR $BF39"), kind 4 or 5 (07BB96 "LDA <$7E; STA ,U"), and the mask of the
# ranges it fades (07BBEC "LDD <$EA; STD #$01,U; STD #$05,U")
local request_palette_fade 07BB88 u palette_job palette_job.fade
local request_palette_fade 07BBEC t4 ranges_mask
# request_white_flash: the job (07BBF9 "LBSR $BF39"), kind 6; the palette's white bank (0C00-0DFF) filled with FFFF
# (07BC0E "LDX #$0C00; LDY #$0100; LDD #$FFFF", 07BC17 "STD ,X++", 07BC19 "LEAY #$-01,Y"), then the request (07BC6B
# "LDD <$E8; STD #$01,U") and the K053251's values for the flash (07BC71 "LDD <$EA; STD #$03,U")
local request_white_flash 07BBF9 u palette_job palette_job.flash
local request_white_flash 07BC14 a white_high
local request_white_flash 07BC14 b white_low
local request_white_flash 07BC17 t1 white_place
local request_white_flash 07BC19 t2 words_after
local request_white_flash 07BC6B t4 flash_request
local request_white_flash 07BC71 t4 flash_priorities
# request_palette_clear: the job (07BC7B "LBSR $BF39"), kind 7 (07BC86 "LDA #$07; STA ,U")
local request_palette_clear 07BC7B u palette_job palette_job.clearing
# run_palette_jobs: each slot's kind (07BC93 "LDA ,U; BEQ"), the slots left (07BCA4 "DEC <$7F")
local run_palette_jobs 07BC8B,07BC9F,07BCA1 u palette_job palette_job
local run_palette_jobs 07BC93 t2 slot_kind
local run_palette_jobs 07BCA4 t2 jobs_left_was
# palette_job_load_sets: the job (U), its loads wanted (07BCC8 "LDA #$01,U; STA <$F0") and set (07BCD1 "LDB #$02,U;
# BPL"); a load's bit (07BCE6 "ANDA #$01"), the loads left (07BCFB "DEC <$F1")
param palette_job_load_sets u palette_job palette_job.sets
local palette_job_load_sets 07BCC8 t3 wanted_loads
local palette_job_load_sets 07BCD1 t3 job_set
local palette_job_load_sets 07BCE6 t2 wanted_bit
local palette_job_load_sets 07BCFB t2 loads_left_was
# palette_job_effect: the job (U), the frames it waited (07BD0D "LDA #$04,U; CMPA #$05,U": the delay), counted
# (07BD4D "INC #$04,U"); the step it is at (07BD28 "LDX #$02,U") and its direction (07BD36 "LDA #$01,U; ASLA; JSR
# [A,Y]")
param palette_job_effect u palette_job palette_job.effect
local palette_job_effect 07BD2F,07BD3A u palette_job palette_job.effect
local palette_job_effect 07BD0D t3 frames_waited_now
local palette_job_effect 07BD10 t3 effect_delay
local palette_job_effect 07BD4D t3 frames_waited_was
local palette_job_effect 07BD28 t5 effect_step
local palette_job_effect 07BD36 t3 effect_direction
# palette_effect_forward / palette_effect_backward (the shared end 07BD97-07BDA7 "LDA <$0F; ANDA #$FC; STA <$0F; STA
# $1FC2": the palette's view off again): the job (U); the colours a step sets less one (07BD51 / 07BD6C "LDA #$06,U;
# STA <$F0"); each colour's place and value from the step (07BD57 / 07BD72 "LDY ,X++", 07BD59 / 07BD74 "LDD ,X++",
# "STD ,Y"), the colours still to set (07BD5D "LDA <$F0; BEQ")
param palette_effect_forward u palette_job palette_job.effect
param palette_effect_backward u palette_job palette_job.effect
local palette_effect_forward 07BD51 t3 step_extra_colours
local palette_effect_backward 07BD6C t3 step_extra_colours
local palette_effect_forward 07BD57 t1 step_at
local palette_effect_backward 07BD72 t1 step_at
local palette_effect_forward 07BD59 t1 colour_at
local palette_effect_backward 07BD74 t1 colour_at
local palette_effect_forward 07BD59 d colour_low
local palette_effect_backward 07BD74 d colour_low
local palette_effect_forward 07BD5D t2 more_colours
local palette_effect_forward 07BD9C a control
local palette_effect_backward 07BD9C a control
# palette_effect_stop / palette_effect_reverse / palette_effect_repeat, the effect's commands (palette_effect_command
# 07BDA8 "LDY #$E975; ANDA #$7F; ASLA; JMP [A,Y]"), on the job in U: 07BDB0 "CLR ,U", 07BDB4 "LDA #$01; STA #$01,U",
# 07BDC8 "CMPA #$07,U"
param palette_effect_stop u palette_job palette_job.effect
param palette_effect_reverse u palette_job palette_job.effect
param palette_effect_repeat u palette_job palette_job.effect
# palette_effect_repeat: the command's count (07BDC1 "LDA #$01,X; CMPA #$FF": FF always), the times it went back
# (07BDC8 "CMPA #$07,U", 07BDCD "INC #$07,U"), the step it goes back to (07BDD0 "LDX #$02,X; LEAX #$04,X")
local palette_effect_repeat 07BDC1 t3 wanted_repeats
local palette_effect_repeat 07BDC8 t3 repeats_done
local palette_effect_repeat 07BDCD t3 repeats_was
local palette_effect_repeat 07BDD0 t5 repeat_target
# palette_job_background_colour: the job (U) and its colour (07BDF6 "LDD #$01,U; STD $0C00")
param palette_job_background_colour u palette_job palette_job.background
local palette_job_background_colour 07BDF6 t5 background_colour
# palette_job_darken / palette_job_brighten / palette_job_fade: the job (U); its frames left (07BE1C "LDD #$03,U;
# BEQ", 07BE21 "DECW #$03,U")
param palette_job_darken u palette_job palette_job.fade
param palette_job_brighten u palette_job palette_job.fade
param palette_job_fade u palette_job palette_job.fade
local palette_job_fade 07BE6F u palette_job palette_job.fade
local palette_job_darken 07BE1C t5 job_frames_left
local palette_job_fade 07BE21 t5 frames_left_was
# palette_job_fade: the step (07BE24 "LDA #$07,U; CMPA #$10"), the 16 steps' mask again (07BE2B "LDD #$01,U; STD
# #$05,U"), the mask's low byte and its bit for the step (07BE34 "LDA #$06,U", 07BE37 "ANDA #$01"), the mask shifted
# and the step counted (07BE71 "LSRW #$05,U", 07BE74 "INC #$07,U"); the step's range (07BE50 "LDA #$07,U; ASLA; ASLA;
# LEAX A,X", 07BE57 "LDA ,X+; STA <$F1" its colours), each colour darkened or brightened by palette_fade_brightens
# (07BE61 "LDA <$F0; ASLA; JSR [A,Y]"), the colours left (07BE6A "DEC <$F1")
local palette_job_fade 07BE24 t3 range_number
local palette_job_fade 07BE2B t5 all_ranges
local palette_job_fade 07BE34 t3 ranges_left_low
local palette_job_fade 07BE37 t2 range_on
local palette_job_fade 07BE71 t5 ranges_left_was
local palette_job_fade 07BE74 t3 range_was
local palette_job_fade 07BE50 t3 range_index
local palette_job_fade 07BE57 t1 range_record
local palette_job_fade 07BE64 a fade_direction
local palette_job_fade 07BE6A t2 colours_left_was
# palette_job_white_flash: the job (U); its frames (07BE8B "DEC #$02,U; BEQ"); every other frame the K053251's values
# for the flash (07BEA5 "LDA #$03,U; STA $1FB9", 07BEAC "LDA #$04,U; STA $1FBA"); at the end the white bank cleared
# to black (07BEC4 "LDX #$0C00; LDY #$0100; CLRD", 07BECB "STD ,X++", 07BECD "LEAY #$-01,Y")
param palette_job_white_flash u palette_job palette_job.flash
local palette_job_white_flash 07BE8B t3 flash_frames_was
local palette_job_white_flash 07BEA5 t3 flash_k053251_9
local palette_job_white_flash 07BEAC t3 flash_k053251_10
local palette_job_white_flash 07BECA a black_high
local palette_job_white_flash 07BECB t1 cleared_place
local palette_job_white_flash 07BECD t2 cleared_words_after
# palette_job_clear: the job (U), its ranges' bits (07BEFB "LDA #$01,U; STA <$F1"); each range's record of
# palette_clears (07BF12 "LDU ,X++"), the first byte cleared (07BF18 "CLR ,X+"), the rest copied from it (BMOVE)
param palette_job_clear u palette_job palette_job.clearing
local palette_job_clear 07BEFB t3 clear_ranges
local palette_job_clear 07BF12 t1 clear_record
local palette_job_clear 07BF18 t1 first_cleared
# find_free_palette_job: the slots from 3C00 (07BF39 "LDU #$3C00", 07BF45 "LEAU #$08,U"), the slots left (07BF48
# "DEC <$7F")
local find_free_palette_job 07BF39,07BF45 u palette_job palette_job
local find_free_palette_job 07BF48 t2 jobs_left_was
# load_palettes: the palettes it copies are in bank 2D (07BF63 "LDB #$2D; STB <$0E; SETLN <$0E"): the source is the
# program's data (palette_job_load_sets' PALETTE_LOAD(...)->source, boot's 0788C4 "LDU #$..."), the destination the
# palette RAM (a board memory: left untyped); each colour (07BF75 "LDD ,U++", 07BF77 "STD ,X++"), the colours of a
# palette left (07BF79 "DEC <$E9") and the palettes left (07BF7E "DEC <$E8")
param load_palettes u source rom
local load_palettes 07BF75 t1 source_at
local load_palettes 07BF75 t4 colour
local load_palettes 07BF77 t1 destination_at
local load_palettes 07BF79 t2 colours_left_was
local load_palettes 07BF7E t2 palettes_left_was
# darken_colour / brighten_colour: the colour (07BF98 / 07BFD5 "LDD ,U; STD <$EA"), its copy read back (07BFC8 /
# 07C00D "LDD <$EA"), the components' steps (07BFCB "SUBD <$E8" / 07C010 "ADDD <$E8"), the new colour (07BFCE / 07C013
# "STD ,U")
local darken_colour 07BF98 t4 old_colour
local darken_colour 07BFC8 t4 saved_colour
local darken_colour 07BFCB t4 component_steps
local darken_colour 07BFCB t5 colour_before
local darken_colour 07BFCB t6 darker_colour
local brighten_colour 07BFD5 t4 old_colour
local brighten_colour 07C00D t4 saved_colour
local brighten_colour 07C010 t4 component_steps
local brighten_colour 07C010 t5 colour_before
local brighten_colour 07C010 t6 brighter_colour
# done: video/palette.c

# ---- video/sprites.c ----
# animate_objects: each object's flags (079876 "LDA #$00,X; BEQ" none: its sprites cleared; "CMPA #$01; BEQ" kept out)
local animate_objects 079876 a slot_flags
# clear_object_sprites: the object's sprites (07988E "LDU #$59,X"), cleared a word at a time (079896 / 0798B0 "CLRD",
# 07989B "STD ,U") up to the first unused (079897 "TST ,U; BEQ"); after 8 (0798A0 "DEC <$E8") the object it borrowed
# more from (0798A5 "LDY #$-0002,U; BEQ"), unlinked and freed (0798B1 "STD #$-0002,U", 0798B5 "CLR ,Y"), and its sprites
# (0798B7 "LDU #$59,Y")
local clear_object_sprites 07988E,07989D,0798B7 u sprite sprite_entry
local clear_object_sprites 0798A5 y lender object
local clear_object_sprites 079896,0798B0 a blank_flags
local clear_object_sprites 079896,0798B0 d blank_word
local clear_object_sprites 0798A0 t2 slots_left_was
local clear_object_sprites 0798A5 t5 next_lender
local clear_object_sprites 0798B7 t5 lender_sprites
# animate_object: the object draw_object hands back in X (079AE9-079C00 keep it: 079BE5 "PUSHS X", 079BF1 "PULLS X"),
# whose frame's time counts down (0798DE "DEC #$08,X"); the animation flags (0798C2 "LDA #$06,X; BMI", 0798C7 "ANDA
# #$40")
local animate_object 0798D8,0798DB,0798EA x object object
local animate_object 0798DE t3 frame_time_was
local animate_object 0798C2 a animation_flags_now
# move_objects: the camera's move since the last frame as the objects' shift, the other way in x (0798FA "LDB <$AD;
# SUBB <$B0; NEGB; SEX" moving right, 079904 "LDB <$B0; SUBB <$AD; SEX" moving left; 07990B "STD <$F0") and the same
# way in y (079913 "LDB <$B3; SUBB <$B6; SEX", 07991C "LDB <$B6; SUBB <$B3; NEGB; SEX"; 079924 "STD <$F2")
local move_objects 079901 t1 shift_x_moving_right
local move_objects 07990A t1 shift_x_moving_left
local move_objects 079919 t1 shift_y_moving_down
local move_objects 079923 t1 shift_y_moving_up
# each object's x step this frame with the camera's shift (079932 "LDA <$F1; CLRB; ADDD #$0F,X"), its x's low byte and
# fraction (07993B "ADDD #$0D,X"), the low byte (07993E "SUBA #$0D,X"): the whole pixels it moves on the screen
# (079943 "SEX; STD <$FC"), added to each of its sprites' x (079955 "LDD <$FC; ADDD #$0006,U; STD #$0006,U")
local move_objects 079936 t7 screen_step_x
local move_objects 07993B t5 pre_x_and_fraction
local move_objects 07993E t3 x_low
local move_objects 079943 t1 sprite_shift_x
local move_objects 079955 t4 x_shift
local move_objects 079958 t5 old_sprite_x
local move_objects 079958 t7 new_sprite_x
# the sprites (07994C "LDU #$59,X", 079960 "LEAU #$10,U") and, past 8 (079963 "DEC <$F6"), those of the object they go
# on in (079968 "LDY #$-0002,U; BEQ", 07996E "LDU #$59,Y"); the same for y (0799C7, 0799E4, 0799EC, 0799F2, 0799E7)
local move_objects 07994C,079960,07996E,0799C7,0799E4,0799F2 u sprite sprite_entry
local move_objects 079968,0799EC y lender object
local move_objects 079963 t2 x_slots_left_was
local move_objects 0799E7 t2 y_slots_left_was
local move_objects 079968 t5 x_lender_found
local move_objects 0799EC t5 y_lender_found
local move_objects 07996E t5 x_lender_sprites
local move_objects 0799F2 t5 y_lender_sprites
# the object's x moved by its speed (079978 "LDD #$0D,X; ADDD #$0F,X; STD #$0D,X", 079985 "ADCA #$0C,X") and by the
# camera's shift (07998B "LDD <$F0; ADDD #$0C,X; STD #$0C,X")
local move_objects 079978 t5 x_and_fraction
local move_objects 07997B t6 x_and_fraction_before
local move_objects 07997B t7 x_and_fraction_after
local move_objects 079985 t3 x_high
local move_objects 07998B t4 camera_shift_x
local move_objects 07998E t5 moved_x
local move_objects 07998E t7 shifted_x
# the y step with the camera's shift (079994 "LDA <$F3; CLRB; ADDD #$14,X"), y's low byte and fraction (07999B "ADDD
# #$12,X"), the low byte (07999E "SUBA #$12,X"): the pixels the floor moves (0799A3 "SEX; STD <$FE": the shadow
# sprite's move); the height's step (0799A7 "LDD #$19,X; ADDD #$17,X; SUBA #$17,X; SEX"), the sprites' y move (0799B3
# "ADDD <$FE; STD <$FC"); each sprite's y moved by it, or a shadow sprite's (priority bit 7: 0799D3 "TST #$000C,U; BPL")
# by the floor's only (0799D9 "LDD <$FE")
local move_objects 079998 t7 screen_step_y
local move_objects 07999B t5 pre_y_and_fraction
local move_objects 07999E t3 y_low
local move_objects 0799A3 t1 floor_shift_y
local move_objects 0799AA t5 pre_z_and_fraction
local move_objects 0799AD t3 z_low
local move_objects 0799B2 t1 height_shift
local move_objects 0799B3 t6 sprite_shift_y
local move_objects 0799B6 t2 y_shift
local move_objects 0799D0 t4 y_shift_now
local move_objects 0799D3 t3 sprite_priority
local move_objects 0799D9 t4 floor_y_shift
local move_objects 0799DC t5 old_sprite_y
local move_objects 0799DC t7 new_sprite_y
# the object's y moved by its speed (0799FC "LDD #$12,X; ADDD #$14,X; STD #$12,X", 079A09 "ADCA #$11,X") and by the
# camera's shift (079A0F "LDD <$F2; ADDD #$11,X"); its height by its speed (079A18 "LDD #$19,X; BEQ", 079A1D "ADDD
# #$17,X")
local move_objects 0799FC t5 y_and_fraction
local move_objects 0799FF t6 y_and_fraction_before
local move_objects 0799FF t7 y_and_fraction_after
local move_objects 079A09 t3 y_high
local move_objects 079A0F t4 camera_shift_y
local move_objects 079A12 t5 moved_y
local move_objects 079A12 t7 shifted_y
local move_objects 079A1D t5 z_and_fraction
local move_objects 079A1D t6 height_speed
local move_objects 079A1D t7 z_and_fraction_after
# sort_objects_by_depth: each object's y kept between 0 and 17F (079A44 "LDD #$11,X; BPL", 079A52 "LDD #$017F",
# 079A57 "LDD #$11,X"), even (079A5A "ANDB #$FE"): its row in the table at 3000 (a board memory, 079A5C "LDY D,U"), the
# first object there and the next ones by their field draw_next (079A68 "LDD #$5E,Y; BNE", 079A6D "STX #$5E,Y")
local sort_objects_by_depth 079A5C,079A66 y last_in_row object
local sort_objects_by_depth 079A44 t5 object_y
local sort_objects_by_depth 079A57 t5 object_y_again
local sort_objects_by_depth 079A5C t4 row_head
local sort_objects_by_depth 079A68 t5 next_drawn
# then the rows from 3000 (079A89 "LDX ,Y++", 079A8E "STD #$-02,Y" emptied), each row's objects (079ACA "LDU #$5E,X",
# 079AD0 "STD #$5E,X" unlinked) and their sprites (079A91 "LDU #$59,X", 079AAE "LEAU #$10,U", 079AC0 "LDU #$59,U"),
# numbered for the K053247's depth (079AA8 "STA #$01,U"); the rows left (079AD7 "DEC <$F0")
local sort_objects_by_depth 079A89,079AD3 x row_object object
local sort_objects_by_depth 079ACA u next_in_row object
local sort_objects_by_depth 079A91,079AAE,079AC0 u sprite sprite_entry
local sort_objects_by_depth 079A89 t1 row_at
local sort_objects_by_depth 079A89 t4 row_first
local sort_objects_by_depth 079A91 t5 row_object_sprites
local sort_objects_by_depth 079AB1 t2 sort_slots_left_was
local sort_objects_by_depth 079AB6 t5 sort_lender
local sort_objects_by_depth 079AC0 t5 sort_lender_sprites
local sort_objects_by_depth 079ACA t5 next_drawn_read
local sort_objects_by_depth 079AD7 t2 rows_left_was
# draw_object: the object's sprites (Y: animate_object 0798D2 / 0798E7 "LDY #$59,X"); the animation set's record
# (079B11 / 079B2A "LDB ,U+; STB <$0E": the bank, then 079B1B / 079B34 "LDB ,U" the index), the high byte of the
# doubled number (079B02 / 079B58 "CLRA", 079B0C / 079B6A "ROLA")
param draw_object y sprites sprite_entry
local draw_object 079B02,079B58 a index_high
local draw_object 079B11 t1 set_record
local draw_object 079B2A t1 high_set_record
# the set's table of animations in the bank (079B42 "LDU D,U") and the frames of the animation, records of the
# program's data (079B6B "LDU D,U", 079B72 "LEAU A,U", 079B74 "LDA ,U+" its flags, 079B84 "LDA ,U+" its time; at the
# animation's end 079B9F "LDA ,U+; STA #$05,X" the next animation or 079BA8 "LDA ,U+; STA #$07,X" the frame, then
# 079BA4 / 079BAD "LDU ,U" the frame record, 079BAF "LDA ,U+", 079BBD "LDA ,U+; STA #$08,X"); the frame's sprite list
# (079BD2 "LDU ,U")
local draw_object 079B42 u animations
local draw_object 079B74,079B84,079BA4,079BAD,079BBD u frame_record
local draw_object 079BD2 u list
local draw_object 079B74 t1 frame_at
local draw_object 079B74 t2 frame_head
local draw_object 079B84 t1 frame_time_at
local draw_object 079B9F t1 next_animation_at
local draw_object 079BA8 t1 jump_frame_at
local draw_object 079BAF t1 new_frame_at
local draw_object 079BBD t1 new_frame_time_at
# more than 8 sprites: the object whose sprites the last of the 8 goes on in (079BE7 "LDX #$7E,Y; BNE"), else one
# borrow_object_for_sprites frees (079BEC "LBSR $9CBD"; 079BFD "STX #$7E,Y")
local draw_object 079BE7,079BEC x lender object
local draw_object 079BE7 t5 lender_found
# write_object_sprites: the object (X, and again after the zoom's multiply: 079D2E / 079DAE "LDX <$E9"), its sprites
# (Y: 079C61 "LEAY #$10,Y", 079C75 / 079CA7 "LDY #$59,Y" the borrowed object's, 079CB4 "LEAY #$10,Y", 079D2C / 079DAC
# "PULLS Y", 079C8D the shadow sprite's write_shadow_sprite), the frame's sprite list in the animation's bank (U: 079C05
# "LDD ,U++" ... 079D72 "LDA ,U+", 079D5F "PULLS CC,B,U" after the bank 1D's zoom steps). The list typed as the
# program's data, so that 079C32 "ORA ,U+; STA #$00,Y" reads no bus in the statement that writes the sprite
param write_object_sprites x object object
param write_object_sprites y sprite sprite_entry
param write_object_sprites u list
local write_object_sprites 079D2E,079DAE x object object
local write_object_sprites 079C61,079C75,079C8D,079CA7,079CB4,079D2C,079DAC y sprite sprite_entry
local write_object_sprites 079C05,079C20,079C24,079C32,079C3F,079C50,079CF2,079D5F,079D72 u list
# the borrowed object past the 8th sprite (079C6E "LDD #$-02,Y" then 079C75 "LDY #$59,Y"); at the end the unused
# sprites cleared and the borrowed object given back (079C9A "LDU #$-02,Y; BEQ", 079CA0 "STD #$-02,Y", 079CA5 "CLR ,Y")
local write_object_sprites 079C9A u lender object
local write_object_sprites 079CA3 y lender_object object
local write_object_sprites 079C6E t5 next_block_object
local write_object_sprites 079C75 t5 next_block_sprites
local write_object_sprites 079C9A t5 spare_block_object
local write_object_sprites 079CA7 t5 spare_block_sprites
local write_object_sprites 079C7B t3 sprites_left_was
# a sprite of the list: its code, bit 15 flipped (079C05 "LDD ,U++; BPL", 079C09 "ANDA #$7F"); its colour from the
# list or the object's attributes (079C1B "LDB #$09,X; BMI", 079C20 "LDB ,U+"); its size (079C32 "ORA ,U+")
local write_object_sprites 079C05 t1 code_at
local write_object_sprites 079C05 t4 listed_code
local write_object_sprites 079C1B t3 object_attributes
local write_object_sprites 079C20 t1 colour_at
local write_object_sprites 079C32 t1 size_at
# unzoomed: the sprite's x and y offsets (079C3F "LDB ,U+", 079C48 "NEGB" facing left, 079C49 / 079C52 "SEX") added to
# the object's x (079C4A "ADDD #$0C,X; STD #$06,Y") and y + z (079C53 "ADDD #$11,X", 079C56 "ADDD #$16,X; STD #$04,Y")
local write_object_sprites 079C3F t1 plain_offset_x_at
local write_object_sprites 079C49 t1 offset_x
local write_object_sprites 079C4A t5 object_x
local write_object_sprites 079C4A t7 sprite_x
local write_object_sprites 079C50 t1 plain_offset_y_at
local write_object_sprites 079C52 t1 offset_y
local write_object_sprites 079C53 t5 object_y
local write_object_sprites 079C53 t7 ground_y
local write_object_sprites 079C56 t5 plain_object_z
local write_object_sprites 079C56 t7 sprite_y
# zoomed (the object's flags bit 4): the zooms (079CE1 "LDB #$0A,X", 079D61 "LDB #$0B,X"); each offset (079CF2 /
# 079D72 "LDA ,U+") times the zoom's step from bank 1D (079D21 / 079DA1 "LMUL", 079D24 / 079DA4 "LDD #$01,S; STD <$FE"),
# taken from or added to x (079D3B / 079D48 "LDD #$0C,X", 079D3E "ADDD <$FE", 079D4B "SUBD <$FE"; 079D43 "LDD #$0C,X"
# with no offset) and y (079DB6 / 079DC3 / 079DBE "LDD #$11,X", 079DB9 "ADDD <$FE", 079DC6 "SUBD <$FE"), then z (079DC9
# "ADDD #$16,X; STD #$04,Y")
local write_object_sprites 079CE1 t3 object_zoom_x
local write_object_sprites 079CF2 t1 offset_x_at
local write_object_sprites 079CF2 t2 listed_offset_x
local write_object_sprites 079D21 t1 zoomed_product_x
local write_object_sprites 079D24 t5 scaled_offset_x
local write_object_sprites 079D3B t5 x_before_plus
local write_object_sprites 079D3E t6 x_plus_offset
local write_object_sprites 079D43 t5 plain_x
local write_object_sprites 079D48 t5 x_before_minus
local write_object_sprites 079D4B t6 x_minus_offset
local write_object_sprites 079D61 t3 object_zoom_y
local write_object_sprites 079D72 t1 offset_y_at
local write_object_sprites 079D72 t2 listed_offset_y
local write_object_sprites 079DA1 t1 zoomed_product_y
local write_object_sprites 079DA4 t5 scaled_offset_y
local write_object_sprites 079DB6 t5 y_before_plus
local write_object_sprites 079DB9 t6 y_plus_offset
local write_object_sprites 079DBE t5 plain_y
local write_object_sprites 079DC3 t5 y_before_minus
local write_object_sprites 079DC6 t6 y_minus_offset
local write_object_sprites 079DC9 t5 zoomed_object_z
local write_object_sprites 079DC9 t7 zoomed_sprite_y
# set_object_priority: the object's priority bits (079DE2 "LDA #$09,X", 079DE5 "ANDA #$30")
local set_object_priority 079DE5 t2 attribute_priority_bits
# write_shadow_sprite: the sprite (Y) under the object: at its floor's y (079DFE "LDD #$5C,X; ADDD #$11,X; STD
# #$04,Y"), its x (079E07 "LDD #$0C,X; STD #$06,Y"); the record of shadow_sprites (079E19 "LDA ,U+; STA #$00,Y")
param write_shadow_sprite y sprite sprite_entry
local write_shadow_sprite 079E35 y sprite sprite_entry
local write_shadow_sprite 079E01 t5 shadow_object_y
local write_shadow_sprite 079E01 t7 shadow_y
local write_shadow_sprite 079E07 t5 shadow_x
local write_shadow_sprite 079E19 t1 shadow_record
# done: video/sprites.c

# ---- system (fork: video/background_maps.c, video/clear.c, video/dream_wave.c, video/text.c) ----
# Evidence: build/listing/simpsons.s as PLACE "INSTRUCTION", the C of the C. A temporary of a post-increment
# access (",X+", ",U++") is the place read or written before the increment: *_at for a read, written_place for a write.
# The tile layers' codes and colours (the K052109's RAM, "place - 0x2000u"), the line scroll at 1A00, the floor map and
# the sprite RAM seen with 1FC2's bit 1 are board memory and stay untyped.

# ---- video/background_maps.c ----
# draw_scrolled_layer_edges: the counts of the two loops over the layers (07C411 "LDA #$03; LDB #$04; PUSHS D": ,S the
# layer's number 3 to 1, 1,S its bit), each before its decrement (07C439 / 07C467 "DEC ,S; BNE")
local draw_scrolled_layer_edges 07C439 t2 column_layers_left
local draw_scrolled_layer_edges 07C467 t2 row_layers_left
# the layer's column and row finders take the layer in A and hand back, in B, the tile column (find_layer_column
# 07C612-07C615 "LSRB x3; ANDB #$03") or row x 4 (find_layer_row 07C6B9 "LSRB; ANDB #$0C") of the edge in its 4 x 4 map
# block, which the drawers hand on (07C744 "STB <$F1", 07C7F2 "STB <$F0"): D going in and coming out of the call
# (07C46D "LDA <$A6; LBSR $C573; LBSR $C789")
local draw_floor_map_column 07C470 d layer_and_block_column
local draw_layer_a_column 07C482 d layer_and_block_column
local draw_layer_b_column 07C48B d layer_and_block_column
local draw_layer_columns 07C4B5 d layer_and_block_column
local draw_layer_columns_with_floor_map 07C4F4,07C500 d layer_and_block_column
local draw_floor_map_row 07C47A d layer_and_block_row
local draw_layer_a_row 07C493 d layer_and_block_row
local draw_layer_b_row 07C49C d layer_and_block_row
# draw_layer_columns: the layer's x offset (the variable layer_map's offset_x points at: 07C4BD "LDD [#$0A,X]"), 8 more
# for the next column (07C4C0 "ADDD #$0008"), and the columns still to draw before the decrement (07C4C6 "DEC #$02,S")
local draw_layer_columns 07C4BD t8 layer_offset_x
local draw_layer_columns 07C4C0 t2 next_offset_x
local draw_layer_columns 07C4C6 t3 columns_left_before
# draw_layer_columns_with_floor_map: X the layer's record (07C4E7 "LDX A,X" from layer_maps), kept on the stack over
# each call (07C4F2 "PUSHS X", 07C4FA / 07C506 "PULLS X"): typed, so 07C508 "LDD [#$0A,X]" reads its offset_x
local draw_layer_columns_with_floor_map 07C4E7,07C4FA,07C506 x layer_map layer_map
# the address of the layer's x offset (07C508 "LDD [#$0A,X]": t5 the address, t8 the offset), 8 more (07C50B "ADDD
# #$0008"), stored back through the address (07C50E "STD [#$0A,X]"), the columns left before the decrement (07C511
# "DEC #$01,S"), and the address the offset is cleared through at the end (07C517 "STD [#$0A,X]")
local draw_layer_columns_with_floor_map 07C508 t5 layer_offset_x_at
local draw_layer_columns_with_floor_map 07C508 t8 layer_offset_x
local draw_layer_columns_with_floor_map 07C50B t2 next_offset_x
local draw_layer_columns_with_floor_map 07C50E t5 layer_offset_x_to
local draw_layer_columns_with_floor_map 07C511 t3 columns_left_before
local draw_layer_columns_with_floor_map 07C517 t5 cleared_offset_x_at
# draw_tile_picture: U through the record (07C52C "LDB ,U+" the bank, 07C536 "LDX ,U++" the tile place, 07C538 "LDU
# ,U" the picture) and the picture (07C53A / 07C53F / 07C544 "LDA ,U+": width, height, colour; 07C556 "LDA ,U+" each
# tile), X the tile RAM place written (07C55F "STA ,X+"), the columns and rows left before their decrements (07C561
# "DEC <$F1", 07C56D "DEC <$F2")
local draw_tile_picture 07C536 t1 place_at
local draw_tile_picture 07C53A t1 width_at
local draw_tile_picture 07C53F t1 height_at
local draw_tile_picture 07C544 t1 colour_at
local draw_tile_picture 07C556 t1 tile_at
local draw_tile_picture 07C55F t1 written_place
local draw_tile_picture 07C561 t2 columns_left_before
local draw_tile_picture 07C56D t2 rows_left_before
# find_layer_column: the layer's x scroll (07C57E "LDD [#$02,X]"), plus its x offset (07C581 "ADDD [#$0A,X]"): the edge's
# x for the tile RAM place; its y scroll (07C58C "LDD [#$04,X]"); the row's place in the tile RAM, 40 a row of 8 pixels
# (07C597 "LDA #$40; MUL") plus the column (07C59A "ADDD <$F0")
local find_layer_column 07C57E t8 tile_scroll_x
local find_layer_column 07C581 t10 tile_edge_x
local find_layer_column 07C58C t8 tile_scroll_y
local find_layer_column 07C599 t1 row_offset
local find_layer_column 07C59A t6 tile_offset
# the edge's x again for the floor map's place (07C5A2 "LDD [#$02,X]", 07C5A5 "ADDD [#$0A,X]"), the scene (07C5B5 "LDA
# <$75; BPL": bit 7 the high tables), the edge's x for the map's strip (07C5DE / 07C5E1, then 07C5E4 "ASLA; LDY A,Y"),
# the edge's y (07C5FA "LDD [#$04,X]", 07C600 "ADDD [#$0E,X]") for the cell (07C607 "ADDD <$F0"), and the edge's x once
# more for the block column handed back (07C60C / 07C60F)
local find_layer_column 07C5A2 t8 floor_scroll_x
local find_layer_column 07C5A5 t10 floor_edge_x
local find_layer_column 07C5B5 t2 scene_byte
local find_layer_column 07C5DE t8 map_scroll_x
local find_layer_column 07C5E1 t10 map_edge_x
local find_layer_column 07C5FA t8 map_scroll_y
local find_layer_column 07C600 t10 map_edge_y
local find_layer_column 07C607 t6 cell_offset
local find_layer_column 07C60C t8 column_scroll_x
local find_layer_column 07C60F t10 column_edge_x
# A the edge's y's high byte (07C5FA "LDD [#$04,X]", 07C600 "ADDD [#$0E,X]", 07C603 "ASRA")
local find_layer_column 07C5FA,07C600 a edge_y_high
# what it hands back: A the edge's x's high byte (the map's strip), B the tile column in the block (07C60C-07C615)
local find_layer_column 07C617 d strip_and_block_column
# find_layer_row: the layer's x scroll (07C623 "LDD [#$02,X]"), the row's place in the tile RAM (07C63C "LDA #$40;
# MUL") plus the column (07C63F "ADDD <$F0"), the scene (07C64F "LDA <$75"), the x scroll for the strip (07C678 "LDD
# [#$02,X]; ASLA"), the next strip's address (07C685 "LDD A,Y" with 07C683 "ADDA #$02"), less this one's (07C687 "SUBD
# <$FC") and a row of 16 (07C68A "SUBD #$0010"): the step to the next strip's row
local find_layer_row 07C623 t8 tile_scroll_x
local find_layer_row 07C63E t1 row_offset
local find_layer_row 07C63F t6 tile_offset
local find_layer_row 07C64F t2 scene_byte
local find_layer_row 07C678 t8 map_scroll_x
local find_layer_row 07C685 t4 next_strip
local find_layer_row 07C687 t6 strip_length
local find_layer_row 07C68A t2 strip_last_row
# the edge's y for the cell (07C69E "LDD [#$04,X]", 07C6A1 "ADDD [#$0C,X]", 07C6A4 "ADDD [#$0E,X]", 07C6AB "ADDD
# <$F0"), and again for the block row handed back (07C6B0 / 07C6B3 / 07C6B6)
local find_layer_row 07C69E t8 map_scroll_y
local find_layer_row 07C6A1 t10 map_view_y
local find_layer_row 07C6A4 t10 map_edge_y
local find_layer_row 07C6AB t6 cell_offset
local find_layer_row 07C6B0 t8 row_scroll_y
local find_layer_row 07C6B3 t10 row_view_y
local find_layer_row 07C6B6 t10 row_edge_y
# what it hands back: A the edge's y's high byte, B the tile row in the block x 4 (07C6B9 "LSRB; ANDB #$0C")
local find_layer_row 07C6BC d strip_and_block_row
# draw_block_column / draw_block_row: X the block (07C6C2 / 07C6DF "LDB ,X++": its colour), its tile cells (07C6E3
# "LDA ,X+"), U the tile RAM place written (07C6E9 "STA ,U+"), the cells left before the decrement (07C6D4 / 07C6EB
# "DEC <$A3")
local draw_block_column 07C6C2 t1 block_at
local draw_block_column 07C6D4 t2 cells_left_before
local draw_block_row 07C6DF t1 block_at
local draw_block_row 07C6E3 t1 tile_at
local draw_block_row 07C6E9 t1 written_place
local draw_block_row 07C6EB t2 cells_left_before
# copy_block_floor_column / copy_block_floor_row: the block's floor pattern (07C6F4 / 07C71F "LDB #$01,X; STB <$A2"),
# times 16 into block_tile_flags (07C700 / 07C72B "LDB #$10; MUL"), the pattern's cell read (07C73A "LDB ,X+"), the
# floor map's place written (07C73C "STB ,Y+"), the cells left before the decrement (07C719 / 07C73E "DEC <$A3")
local copy_block_floor_column 07C6F4 t3 block_floor_pattern
local copy_block_floor_column 07C702 t1 pattern_offset
local copy_block_floor_column 07C719 t2 cells_left_before
local copy_block_floor_row 07C71F t3 block_floor_pattern
local copy_block_floor_row 07C72D t1 pattern_offset
local copy_block_floor_row 07C73A t1 pattern_at
local copy_block_floor_row 07C73C t1 written_place
local copy_block_floor_row 07C73E t2 cells_left_before
# draw_map_column / fill_floor_map_column: the map's cell (07C759 / 07C7AE "LDD ,Y": the block's number), the block
# find_map_block finds (07C760 / 07C7B3 "LBSR $C8B1": X), handed with the tile column in the block (07C763 / 07C7B9
# "LDA <$F1") to draw_block_column / copy_block_floor_column, the draw scroll 20 on (07C769 / 07C7BF "LDD <$F8", 07C76C /
# 07C7C2 "ADDD #$0020"), its low byte, and the blocks left before the decrement (07C783 / 07C7DC "DEC <$F0")
local draw_map_column 07C759 t4 map_word
local draw_map_column 07C760 x block
local draw_map_column 07C766 d tile_column
local draw_map_column 07C769 t4 drawn_scroll
local draw_map_column 07C76C t2 next_scroll
local draw_map_column 07C76C b next_scroll_low
local draw_map_column 07C783 t2 blocks_left_before
local fill_floor_map_column 07C7AE t4 map_word
local fill_floor_map_column 07C7B3 x block
local fill_floor_map_column 07C7BC d tile_column
local fill_floor_map_column 07C7BF t4 drawn_scroll
local fill_floor_map_column 07C7C2 t2 next_scroll
local fill_floor_map_column 07C7C2 b next_scroll_low
local fill_floor_map_column 07C7DC t2 blocks_left_before
# draw_map_row / fill_floor_map_row: the map's cell read (07C807 / 07C865 "LDD ,Y++": t1 its place, t4 the word), the
# block (07C80D / 07C869 to $C8B1), the tile row in the block with it (07C810 "LDA <$F0"), the draw scroll and 20 on
# (07C816 / 07C874 "LDD <$F8", 07C819 / 07C877 "ADDD #$0020"), the step into the next strip (07C82F / 07C890 "LDD
# <$FC; LEAY D,Y"), the new draw scroll (07C834 / 07C895 "LDD <$F4; STD <$F8"), the blocks left before the decrement
# (07C83A / 07C89B "DEC <$F1")
local draw_map_row 07C807 t1 map_cell_at
local draw_map_row 07C807 t4 map_word
local draw_map_row 07C80D x block
local draw_map_row 07C813 d tile_row
local draw_map_row 07C816 t4 drawn_scroll
local draw_map_row 07C819 t2 next_scroll
local draw_map_row 07C82F t4 strip_jump
local draw_map_row 07C834 t4 new_draw_scroll
local draw_map_row 07C83A t2 blocks_left_before
local fill_floor_map_row 07C865 t1 map_cell_at
local fill_floor_map_row 07C865 t4 map_word
local fill_floor_map_row 07C869 x block
local fill_floor_map_row 07C874 t4 drawn_scroll
local fill_floor_map_row 07C877 t2 next_scroll
local fill_floor_map_row 07C890 t4 strip_jump
local fill_floor_map_row 07C895 t4 new_draw_scroll
local fill_floor_map_row 07C89B t2 blocks_left_before
# find_layer_a_block / find_layer_b_block: the scene (07C8C0 / 07C8FA "LDA <$75; BPL"), the block's number (07C8E3 /
# 07C91D "LDD <$FE"), doubled (07C8E6-07C8E8 "ASLB; ROLA; STD <$FE") and then times 16 (07C8EB-07C8F0), A and B the
# halves of that offset, and 18 x the number (07C8F1 / 07C92B "ADDD <$FE"): the block's place in the area's array
local find_layer_a_block 07C8C0 t2 scene_byte
local find_layer_a_block 07C8E3 t4 block_number
local find_layer_a_block 07C8F1 t6 block_offset
local find_layer_a_block 07C8E7,07C8EC,07C8EE a block_offset_high
local find_layer_a_block 07C8E3,07C8E6,07C8EB,07C8ED b block_offset_low
local find_layer_b_block 07C8FA t2 scene_byte
local find_layer_b_block 07C91D t4 block_number
local find_layer_b_block 07C92B t6 block_offset
local find_layer_b_block 07C921,07C926,07C928 a block_offset_high
local find_layer_b_block 07C91D,07C920,07C925,07C927 b block_offset_low
# set_area_tile_banks: the scene (07C934 "LDA <$75; BPL") and the area's layer_mode record (07C947 / 07C94D "LDA ,Y+")
local set_area_tile_banks 07C934 t2 scene_byte
local set_area_tile_banks 07C947 t1 area_mode
# done: video/background_maps.c

# ---- video/clear.c ----
# clear_layer_a / clear_layer_b (0792CB-0792DA, shared): the code place cleared (0792D5 "CLRW ,X++") and the words left
# after the decrement (0792D7 "LEAY #$-01,Y; BNE")
local clear_layer_a 0792D5 t1 cleared_place
local clear_layer_a 0792D7 t2 remaining_words
local clear_layer_b 0792D5 t1 cleared_place
local clear_layer_b 0792D7 t2 remaining_words
# clear_text_layer: the code place written (07928D "STD ,X++"), the words of a row and the rows left before their
# decrements (07928F "DEC ,S", 079298 "DEC ,S"); then the two edge columns: the tile pair (0792AD "LDD ,S": 3F3F), the
# colour pair (0792B4 "LDD #$02,S": 0000) and the rows left (0792C2 "DEC #$04,S")
local clear_text_layer 07928D t1 written_place
local clear_text_layer 07928F t2 row_words_left
local clear_text_layer 079298 t2 rows_left
local clear_text_layer 0792AD t4 edge_tiles
local clear_text_layer 0792B4 t5 edge_colours
local clear_text_layer 0792C2 t3 edge_rows_left
# clear_sprites: the sprite RAM place cleared (0792F6 "CLRW ,X++"), the words of a sprite left before the decrement
# (0792F8 "DECB"), the bytes left after it (0792FB "LEAY #$-10,Y")
local clear_sprites 0792F6 t1 cleared_place
local clear_sprites 0792F8 t1 sprite_words_left
local clear_sprites 0792FB t2 remaining_bytes
# done: video/clear.c

# ---- video/dream_wave.c ----
# The dream's wave keeps its state in the K052109's RAM (io reads in the C): 18EA the lines left, 18EB the phase (2
# less a frame: 0254E9 "LDA $18EB; SUBA #$02"), 18EC the step (dream_wave_grow_steps / dream_wave_fade_out_steps), 18ED
# the size, 18EE the size a frame draws, 18F3 the frames held. The temporaries are what the CLR/INC/DEC there read.
local dream_wave_start 025433 t1 previous_wave_size
local dream_wave_start 025437 t1 previous_wave_phase
local dream_wave_start 025441 t1 wave_step
local dream_wave_grow 025446 t1 wave_size
local dream_wave_grow 02544D t1 wave_size_before
local dream_wave_grow 025457 t1 grown_size
local dream_wave_grow 02545F t1 wave_step
local dream_wave_keep 025464 t1 wave_size
# dream_wave_fade_out: U its steps' table (02546C "LDU #$799C", 025474 "JMP [A,U]"), the step (02546F "LDA $18EC")
local dream_wave_fade_out 02546C,025474 u fade_out_step_table
local dream_wave_fade_out 02546F t1 wave_step
local dream_wave_start_full 025476 t1 previous_wave_phase
local dream_wave_start_full 02548C t1 wave_step
local dream_wave_hold 025491 t1 wave_size
local dream_wave_hold 025498 t1 hold_frames_left
local dream_wave_hold 02549E t1 wave_step
local dream_wave_shrink 0254A3 t1 wave_size
local dream_wave_shrink 0254AA t1 wave_size_before
# (0254B6 "CLR $1C80": the K052109's line scroll turned off)
local dream_wave_shrink 0254B6 t1 previous_line_scroll_mode
local dream_wave_shrink 0254BA t1 wave_step
# dream_wave_draw_lines: the line count cleared (0254C3 "CLR $18EA"), each line's number and the phase (0254CA "LDA
# $18EA", 0254CE "ADDA $18EB"), the size (0254D3 "LDB $18EE"), the sine wave_sine gives for them (0254D7 "LBSR $74F4"),
# the line's x scroll (0254DA "ADDD #$0196"), its high bit and low byte swapped into the K052109's order (0254DD "ANDA
# #$01", 0254DF "EXG A,B"), the line scroll place written (0254E1 "STD ,X++"), the lines left before the decrement
# (0254E3 "DEC $18EA"), the phase moved on (0254E9 "LDA $18EB")
local dream_wave_draw_lines 0254C3 t1 previous_line_count
local dream_wave_draw_lines 0254CA t1 wave_line
local dream_wave_draw_lines 0254CE t1 wave_phase
local dream_wave_draw_lines 0254D3 t1 line_wave_size
local dream_wave_draw_lines 0254D7 d line_wave_offset
local dream_wave_draw_lines 0254D7 a line_offset_high
local dream_wave_draw_lines 0254D7 b line_offset_low
local dream_wave_draw_lines 0254DA t2 line_x_scroll
local dream_wave_draw_lines 0254DF t1 swapped_scroll
local dream_wave_draw_lines 0254E1 t1 written_place
local dream_wave_draw_lines 0254E3 t1 lines_left_before
local dream_wave_draw_lines 0254E9 t1 wave_phase_before
# wave_sine: the offset with its sign (02552B "NEGW <$EC" for the angle's bit 7, 02552E "LDD <$EC")
local wave_sine 02552E t4 signed_offset
# done: video/dream_wave.c

# ---- video/text.c ----
# print_game_text: the text's number before the shift (07931C "ASLB; BCS": bit 7 erases it)
local print_game_text 07931C t1 text_byte
# print_text / erase_text: the text's place word read (07936D / 079384 "LDX ,U++"), each character read (07936F /
# 079386 "LDB ,U+"), the tile RAM place written (07937F "STB ,X+", 079396 "STB ,X+")
local print_text 07936D t1 place_word_at
local print_text 07936F t1 character_at
local print_text 07937F t1 written_place
local erase_text 079384 t1 place_word_at
local erase_text 079386 t1 character_at
local erase_text 079396 t1 written_place
# print_hex_byte: the places of the high and low digits (07946D / 079479 "STA ,X+")
local print_hex_byte 07946D t1 high_digit_place
local print_hex_byte 079479 t1 low_digit_place
# print_hex_word: the word's low byte (079484 "PULLS A") with the colour (079486 "LDB <$F0") for the second digit pair
local print_hex_word 079489 d low_byte_and_colour
local print_hex_word 079489 a low_byte
# done: video/text.c

# ======== temporaries, typed pointers and locals: objects a-j ========
# ======== temporaries, untyped pointers and register names of objects/a* to j* ========
#. Evidence: build/listing/simpsons.s (PLACE "INSTRUCTION") and the C of the Cobjects/.
# Webs that hold two things in turn (a register the code reuses) take one name for both, said in the comment.

# ---- objects/bear.c ----
# bear_part: the cage parts' phase the bear leaves in 184A (03CE65 "LDA $184A")
local bear_part 03CE65 t1 parts_phase
# landing, the z speed bounced back and halved (03CEB6 "NEGD", 03CEB7 "ASRDI #$01"), less the gravity 60 (03CEB9 "SUBD
# #$0060; STD #$19,X")
local bear_part 03CEB6 t2 rebound_speed
local bear_part 03CEB7 t2 halved_rebound
local bear_part 03CEB9 t2 next_z_speed
# the part's y, compared with 76 to take it off (03CEBF "LDD #$11,X; CMPD #$0076")
local bear_part 03CEBF t5 part_y
# its flight record by its number (03CE96 "LDD ,Y++": bear_part_flights), then past the x speed (03CE9B "LDA ,Y+")
local bear_part 03CE96 t1 flight_record
local bear_part 03CE9B t1 flight_rest
# the z speed's halves (03CEAB "LDD #$19,X"; 03CEB7 "ASRDI #$01")
local bear_part 03CEAB,03CEB7 a z_speed_high
local bear_part 03CEAB,03CEB7 d z_speed_low
# bear_boulder: falling, the z speed less the gravity 60 (03CF5E "SUBD #$0060; STD #$19,X")
local bear_boulder 03CF5E t2 next_z_speed
# at the floor, the z speed bounced back (03CF43 "NEGD; STD <$F3"), times 3 (03CF47, 03CF4A "ADDD <$F3"), over 4
# (03CF4D "ASRDI #$02")
local bear_boulder 03CF43 t2 rebound_speed
local bear_boulder 03CF47 t6 rebound_twice
local bear_boulder 03CF4A t6 rebound_thrice
local bear_boulder 03CF4D t2 bounce_back_speed
# the floor line 98 below the camera, compared with its y (03CF51 "LDD #$0098", 03CF54 "ADDD <$B2", 03CF57 "CMPD #$11,X")
local bear_boulder 03CF54 t6 floor_y
local bear_boulder 03CF57 t5 boulder_y
local bear_boulder 03CF57 t6 landing_y
# where it starts: x 60 + a random multiple of 8, y F0 below the camera (03CF07 "ADDD #$0060; STD #$0C,X", 03CF10 "ADDD
# <$B2; STD #$11,X")
local bear_boulder 03CF07 t2 first_x
local bear_boulder 03CF10 t6 first_y
# A:B, its box's width and depth (03CEE7, 03CEF2 "LDD #$1004"), then the z speed (03CF23 "LDD #$19,X") it bounces
local bear_boulder 03CEE7,03CEF2,03CF23,03CF38,03CF43,03CF5A a word_high
local bear_boulder 03CEE7,03CEF2,03CF23,03CF38,03CF43,03CF5A b word_low
# bear_start: what the clear of 184A reads (03C91D "CLR $184A")
local bear_start 03C91D t1 old_parts_phase
# its x moved 40 on (03C8DD "LDD #$0C,X", 03C8E0 "ADDD #$0040; STD #$0C,X")
local bear_start 03C8DD t5 cage_x
local bear_start 03C8E0 t2 bear_x
# bear_put_parts: the child record it is handed and spawns each part from (03C92E "LBSR $862C" with Y; its callers
# 03C904, 03C90E, 03C918 "LDY #$7Exx", and its own loop back 03C973 "BNE $6925" with Y kept on the stack)
param bear_put_parts y child_record child_object
# each part's offset from the cage, three signed bytes walked from cage_part_offsets (03C933 "LDY <$F8", 03C936 "LDB
# ,Y+; SEX", 03C942, 03C94E "LDB ,Y+; SEX"), added to its x, y, z (03C939 "ADDD #$0C,U", 03C945 "ADDD #$11,U", 03C951
# "ADDD #$16,U")
local bear_put_parts 03C933 y offsets part_offset
local bear_put_parts 03C936 t1 offset_record
local bear_put_parts 03C938 t1 offset_dx
local bear_put_parts 03C939 t5 part_x
local bear_put_parts 03C939 t7 placed_x
local bear_put_parts 03C942 t1 dy_at
local bear_put_parts 03C944 t1 offset_dy
local bear_put_parts 03C945 t5 part_y
local bear_put_parts 03C945 t7 placed_y
local bear_put_parts 03C94E t1 dz_at
local bear_put_parts 03C950 t1 offset_dz
local bear_put_parts 03C951 t7 placed_z
local bear_put_parts 03C939,03C945,03C951 a place_high
local bear_put_parts 03C939,03C945,03C951 b place_low
# the parts left to put, counted down (03C970 "DEC <$F0")
local bear_put_parts 03C970 t2 parts_left
# bear_break_out: the bear itself, back from the stack after the clearing (03C9D6 "PUSHS X" ... 03C9E1 "PULLS X"),
# flagged and lowered (03C9F5 "STA #$00,X", 03C9F8 "LDD #$11,X; ADDD #$0010; STD #$11,X")
local bear_break_out entry,03C9E1 x object object
local bear_break_out 03C9F8 t5 bear_y
local bear_break_out 03C9FB t2 lowered_y
# the byte at 00C0 the row's start is masked with (03C9D2 "ANDB $00C0": the board's RAM, where the immediate C0 was
# meant), and the row's start low byte it makes (03C9CE "PUSHS U; PULLS D", 03C9D2 "ANDB")
local bear_break_out 03C9D2 t1 row_mask
local bear_break_out 03C9D2 b row_start_low
# A: its wait (03C9A9 "LDA #$2F,X; CMPA #$DC"), then the floor cell's high byte (03C9D0 "PULLS D")
local bear_break_out 03C9A9,03C9D0 a wait_then_row_high
# bear_choose_target: a player's object by a random number's bits 0-1 (03CA85 "ANDA #$03; LDB #$C0", 03CA8A "MUL",
# 03CA8B "ADDD #$4A40"), its flags tested to take it (03CA90 "PULLS U", 03CA92 "TST #$00,U")
local bear_choose_target 03CA8A t1 player_offset
local bear_choose_target 03CA8B t2 player_object
local bear_choose_target 03CA90,03CA97 u chosen_target object
local bear_choose_target 03CA8B b target_low
# the walk's animation (03CAA0 "LDA #$80", 03CAA2 "LBSR $604C": stage_boss_set_state)
local bear_choose_target 03CAA2 d animation_number
# bear_walk: rank times 8 times a random number, 3000 or more drops a boulder (03CAC7 "MUL", 03CAC8 "CMPD #$3000")
local bear_walk 03CAC7 t1 boulder_roll
# its x and its target's (03CB54 "LDY #$0C,X", 03CB57 "CMPY #$0C,U")
local bear_walk 03CB54 t5 bear_x
local bear_walk 03CB57 t5 target_x
# the way to walk, to B pixels beside the target (03CB8A "LBSR $8671": vector_direction_to_offset)
local bear_walk 03CB8A d direction_word
# bear_start_charge: its charge speed by rank (03CBB3 "LDD A,Y": bear_charge_speeds_by_rank), negated facing left
# (03CBBA "BITA #$40", 03CBC0 "NEGD"; 03CBC1 "STD #$0F,X")
local bear_start_charge 03CBB3 t4 charge_speed
local bear_start_charge 03CBBA t2 facing
local bear_start_charge 03CBC0 t2 reversed_speed
local bear_start_charge 03CBBC,03CBC0 a speed_high
local bear_start_charge 03CBB3,03CBC0 d speed_low
# bear_charge_check_hit: the health limits by players stage_boss_check_hit compares with (03CBCA "LDY #$7E67; LBSR
# $6260": bear_beaten_vitality)
local bear_charge_check_hit 03CBCA y health_limits
# bear_charge: its x, which it also leaves in U (03CBF0 "LDU #$0C,X"), and the low byte of its x speed, which becomes
# the stop animation's (03CBF3 "LDD #$0F,X", 03CBFE "LDA #$88")
local bear_charge 03CBF0 t5 bear_x
local bear_charge 03CBF0 u charge_x
local bear_charge 03CBF3 d speed_low
# bear_recover: the state and wait it turns to a player with (03CC3B "LDY #$0601; ... LBNE $6A5E": bear_face_player)
local bear_recover 03CC3B y state_wait
# unused_bear_land_in_area: the bear (03CCAA "LDY #$0C,X"; 03CCB4 "CLRW #$0F,X")
param unused_bear_land_in_area x object object
local unused_bear_land_in_area 03CCAA t5 current_x
# bear_land: the state of its change once beaten (03CCEE "LDY #$0DC8; LDA #$86; LBSR $604C")
local bear_land 03CCEE y change_state_wait
# bear_change: its wait, which the program counts at 002F (03CD05 "DEC $002F", 03CD0B "LDA $002F": the board's RAM,
# where field 2F was meant)
local bear_change 03CD05 t1 wait_before
local bear_change 03CD0B t1 wait_left
# what spawning the change effect leaves in D: the effect's z, A complemented (03CD16 "LBSR $862C"; 07CADF "ADDD
# #$16,X", 07CAE8 "COMA"), whose A is then compared as the wait (03CD19 "CMPA #$28")
local bear_change 03CD16 d child_z
# bear_think: its x, compared with the screen's sides (03CDB9 "LDY #$0C,X; CMPY #$0058")
local bear_think 03CDB9 t5 x_now
# bear_check_hit: the health limits by players (03CDE5 "LDY #$7E67; LBSR $6260"), then the flinch's state and wait
# (03CDF7, 03CDFE "LDY #$0B00")
local bear_check_hit 03CDE5 y health_limits
local bear_check_hit 03CDF7,03CDFE y flinch_state_wait
# done: objects/bear.c

# ---- objects/boss_door.c ----
# boss_door_stage_8: the camera's x, past 320 the door goes (02789D "LDD <$AC; CMPD #$0320")
local boss_door_stage_8 02789D t4 camera_x_now
# boss_door_set_up: the two halves' places from the camera (02781F, 027828 "SUBD <$AC", 027831, 02783A "ADDD <$B2";
# "STD #$0C,X", "STD #$0C,U", "STD #$11,X", "STD #$11,U")
local boss_door_set_up 02781F t6 door_x
local boss_door_set_up 027828 t6 other_half_x
local boss_door_set_up 027831 t6 door_y
local boss_door_set_up 02783A t6 other_half_y
local boss_door_stage_8_set_up 0278BD t6 door_x
local boss_door_stage_8_set_up 0278C6 t6 other_half_x
local boss_door_stage_8_set_up 0278CF t6 door_y
local boss_door_stage_8_set_up 0278D8 t6 other_half_y
# boss_door_closed, boss_door_open: the other half, shown or hidden (02786F "LDU #$28,X; LDA #$80; STA ,U; LDA #$87;
# STA #$05,U"; 027889 "LDU #$28,X; LDA #$04; STA ,U")
local boss_door_closed 02786F u half object
local boss_door_open 027889 u half object
# done: objects/boss_door.c

# ---- objects/boulder.c ----
# boulder_bounce: its zoom one step smaller, kept from 2020 on (02CF72 "LDD #$0A,X", 02CF75 "SUBD #$0101; CMPD #$2020")
local boulder_bounce 02CF75 t2 smaller_zoom
# off the floor: its y, below 40 it stops across (02CFBA "LDD #$11,X; CMPD #$0040"); its z speed less the gravity 20, at
# most FC00 down (02CFE2 "SUBD #$0020", 02CFE5 "STD #$19,X", 02CFEA "CMPA #$FC")
local boulder_bounce 02CFBA t5 boulder_y
local boulder_bounce 02CFE2 t2 dropping_z_speed
local boulder_bounce 02CFE5 t3 kept_z_speed
# on the floor: its z speed less the gravity (02CF97 "LDD #$19,X", 02CF9A "SUBD #$0020; STD #$19,X")
local boulder_bounce 02CF9A t2 next_z_speed
# done: objects/boulder.c

# ---- objects/bouncing_prop.c ----
# bouncing_prop_fly_away, bouncing_prop_bounce_start: the camera's x, past 3A2 it leaves (0320A2, 032115 "LDD <$AC; CMPD
# #$03A2")
local bouncing_prop_fly_away 0320A2 t4 camera_x_now
local bouncing_prop_bounce_start 032115 t4 camera_x_now
# bouncing_prop_follow: the nearest player (0321B4 "LBSR $8620": vector_choose_nearest_player), and how far it is
# across and along the floor (0321B7 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$0040", 0321C3 "LDD #$11,X; SUBD #$11,U;
# ABSD")
local bouncing_prop_follow 0321B4 u player object
local bouncing_prop_follow 0321B7 t5 prop_x
local bouncing_prop_follow 0321BA t5 nearest_x
local bouncing_prop_follow 0321BA t7 difference_x
local bouncing_prop_follow 0321BD t1 signed_dx
local bouncing_prop_follow 0321BD t3 distance_x
local bouncing_prop_follow 0321C3 t5 prop_y
local bouncing_prop_follow 0321C6 t5 nearest_y
local bouncing_prop_follow 0321C6 t7 difference_y
local bouncing_prop_follow 0321C9 t1 signed_dy
local bouncing_prop_follow 0321C9 t3 distance_y
# the way to the player (0321D2 "LBSR $8671": vector_direction_to_offset, its A the direction; 0321D5 "LDB #$10;
# LBSR $8617")
local bouncing_prop_follow 0321D2 d direction_offset
# bouncing_prop_bounce_off_edge: its x, between 60 and 15F it keeps going (03220C "LDD #$0C,X; SUBD #$0060; CMPD
# #$0100")
local bouncing_prop_bounce_off_edge 03220C t5 prop_x
# done: objects/bouncing_prop.c

# ---- objects/burns_robot.c ----
# burns_robot_run: its three attack counters, one more each frame (03A9A1, 03A9AA, 03A9B3 "ADDD #$0001; STD #$3B,X /
# #$3E,X / #$41,X")
local burns_robot_run 03A9A1 t2 new_lob_frames
local burns_robot_run 03A9AA t2 new_volley_frames
local burns_robot_run 03A9B3 t2 new_part_frames
# the floor is looked at 20 ahead of where its x speed takes it (03B31D "LDD #$0F,X; BMI", 03B322 "ADDD #$0020", 03B327
# "SUBD #$0020", 03B32A "STD <$F8; STD <$F0"), and again with that offset (03B340 "LDD <$F0; STD <$F8")
local burns_robot_run 03B322 t2 look_ahead_right
local burns_robot_run 03B327 t2 look_ahead_left
local burns_robot_run 03B340 t4 saved_look_ahead
local burns_robot_run 03B31D,03B322,03B327 a look_ahead_high
local burns_robot_run 03B31D,03B322,03B327 d look_ahead_low
# burns_robot_drop_maggie: Maggie's object, type E7 (rescued_maggie_run), put at 420 across, A8 down (03A9E3 "LBSR
# $867D", 03A9E6 "LDA #$E7; STA #$01,U", 03A9EE "SUBD <$AC; STD #$0C,U", 03A9F7 "ADDD <$B2; STD #$11,U")
local burns_robot_drop_maggie 03A9E3 u maggie_object object.rescued_maggie
local burns_robot_drop_maggie 03A9EE t6 maggie_x
local burns_robot_drop_maggie 03A9F7 t6 maggie_y
# burns_robot_walk_to_maggie: how far it is from her across and along the floor (03AA1C "LDD #$0C,X; SUBD #$0C,U",
# 03AA28 "LDD #$11,X; SUBD #$11,U")
local burns_robot_walk_to_maggie 03AA1C t5 robot_x
local burns_robot_walk_to_maggie 03AA1F t5 maggie_x
local burns_robot_walk_to_maggie 03AA28 t5 robot_y
local burns_robot_walk_to_maggie 03AA2B t5 maggie_y
# burns_robot_let_burns_out: Mr. Burns' object (part 7: 03AA73 "LBSR $867D", 03AA78 "LDD #$0701; LBSR $751E"), linked
# both ways with Maggie's (03AA7F "LDY #$38,X; STU #$2A,Y; STY #$29,U": rescued_maggie.burns, mr_burns.maggie)
local burns_robot_let_burns_out 03AA73 u burns_object object.mr_burns
local burns_robot_let_burns_out 03AA7F y maggie_object object.rescued_maggie
# burns_robot_shed_form_3: D, piece 4 to throw (03AACB "LDA #$04; BSR $6B00"), then what burns_robot_throw_piece
# leaves (0500, its z speed), stored as the piece's x (03AACF "STD #$0C,U")
local burns_robot_shed_form_3 03AACD d piece_word
local burns_robot_shed_form_3 03AACD a piece_word_high
# burns_robot_shed_form_2: its shedding frame (03AB38 "LDA #$06,X; ANDA #$02"), whose 2 is also the first piece thrown
# (03AB3F "BSR $6B82"); that piece goes 20 ahead of it (03AB41 "LDD #$0C,X; ADDD #$0020; STD #$0C,U")
local burns_robot_shed_form_2 03AB3B t2 shed_frame
local burns_robot_shed_form_2 03AB3B a first_piece
local burns_robot_shed_form_2 03AB41 t5 robot_x
local burns_robot_shed_form_2 03AB44 t2 piece_x
# burns_robot_shed_form_1, burns_robot_shed_form_0: it rises 20 (03ABB1, 03AC4F "ADDD #$0020; STD #$16,X"); the low
# byte goes on in D as the first piece's (03ABB7 "LDA #$81", 03AC55 "CLRA; LBSR $6CF0")
local burns_robot_shed_form_1 03ABB1 t2 raised_z
local burns_robot_shed_form_1 03ABB1 d raised_z_low
local burns_robot_shed_form_0 03AC4F t2 raised_z
local burns_robot_shed_form_0 03AC4F,03AC56 d first_piece_word
# burns_robot_place: put at 420 across and E8 down the stage (03AD50 "SUBD <$AC; STD #$0C,X", 03AD59 "ADDD <$B2; STD
# #$11,X")
local burns_robot_place 03AD50 t6 robot_x
local burns_robot_place 03AD59 t6 robot_y
# burns_robot_appear: look 32 (03AD83 "LDA #$32; LBSR $72F0"), what burns_robot_set_look leaves, then its B as the box
# (03AD88 "CLRA; LBSR $72FF")
local burns_robot_appear 03AD85,03AD89 d look_word
# burns_robot_step_up: 10 up the screen (03AD97 "LDD #$11,X; SUBD #$0010; STD #$11,X")
local burns_robot_step_up 03AD97 t5 robot_y
local burns_robot_step_up 03AD9A t2 raised_y
# burns_robot_start_fight: look 34 (03AE15 "LDA #$34; LBSR $72F0"), what burns_robot_set_look leaves stored as the
# step's subphase and countdown (03AE20 "STD <$05")
local burns_robot_start_fight 03AE17 d look_word
local burns_robot_start_fight 03AE17 a look_kind
# burns_robot_fire_shot: the shot's x speed, 0500 the way it faces (03AF8B "LDD <$F0; STD #$0F,U")
local burns_robot_fire_shot 03AF8B t4 shot_x_speed
# burns_robot_part_attack_hold: the part it holds out (03B030 "LBSR $867D"; 03B045 "LDA #$C0; STA ,U; STX #$29,U":
# burns_held_part.robot), and itself again after setting the part's box (03B04F "PUSHS X; TFR U,X", 03B056 "PULLS X",
# 03B05A "INC #$43,X": holding_part)
local burns_robot_part_attack_hold 03B030 u held_object object.burns_held_part
local burns_robot_part_attack_hold 03B056 x robot_back object.burns_robot
# burns_robot_lob_throw: the bomb's speeds, 0200 across the way it faces and down the screen by the bombs thrown
# (03B0D9 "LDD <$F2; STD #$0F,U", 03B0E6 "LDD A,Y; STD #$14,U": burns_robot_shot_y_speeds)
local burns_robot_lob_throw 03B0D9 t4 lob_x_speed
local burns_robot_lob_throw 03B0E6 t4 lob_y_speed
# burns_robot_decide_late_forms: the frames before it holds out its part, by form and rank (03B239 "LDD A,Y":
# burns_robot_held_part_times; 03B23B "CMPD #$41,X")
local burns_robot_decide_late_forms 03B239 t4 held_part_time
# burns_robot_facing_target: its x and its target's (03B246 "LDD #$0C,X; CMPD #$0C,U")
local burns_robot_facing_target 03B246 t5 robot_x
local burns_robot_facing_target 03B249 t5 target_x
# burns_robot_choose_target: its current target (03B285 "LDY #$2B,X"), gone or down (03B288 "LDA #$00,Y", 03B28D
# "LDA #$02,Y; BMI")
local burns_robot_choose_target 03B285 y current_target object
local burns_robot_choose_target 03B28D t3 target_state
# burns_robot_aim_at_target: its x and its target's (03B2A9 "LDD #$0C,X; CMPD #$0C,U"); D, the floor looked at beside
# the target (03B2BB "TFR B,A; CLRB; LBSR $8638"), then the way to that side (03B2C8 "LBSR $8671")
local burns_robot_aim_at_target 03B2A9 t5 robot_x
local burns_robot_aim_at_target 03B2AC t5 target_x
local burns_robot_aim_at_target 03B2BE,03B2C8 d side_probe
# burns_robot_set_look: the look's kind and animation (03B2F6 "LDD A,U": burns_robot_animations)
local burns_robot_set_look 03B2F6 t4 look_entry
# burns_robot_set_box: the hit box record (03B303 "LDU A,U": burns_robot_hit_boxes) walked a word at a time (03B305,
# 03B30D, 03B312, 03B317 "LDD ,U++")
local burns_robot_set_box 03B305 t1 box_record
local burns_robot_set_box 03B30D t1 box_sizes
local burns_robot_set_box 03B312 t1 box_heights
local burns_robot_set_box 03B317 t1 box_offsets
local burns_robot_set_box 03B317 u box_end
# burns_robot_target_in_depth: how far down the screen the target is (03B37B "LDD #$11,U; SUBD #$11,X; BMI")
local burns_robot_target_in_depth 03B37B t5 target_y
local burns_robot_target_in_depth 03B37E t5 robot_y
local burns_robot_target_in_depth 03B37E t7 difference_y
# burns_robot_target_across: its x and the target's (03B38A "LDD #$0C,X; SUBD #$0C,U; ABSD")
local burns_robot_target_across 03B38A t5 robot_x
local burns_robot_target_across 03B38D t5 target_x
# burns_robot_slow_down: each speed halved twice (03B509 "LDD #$0F,X; ASRA; RORB", 03B513 "LDD #$14,X")
local burns_robot_slow_down 03B509,03B50C,03B513,03B516 a speed_high
local burns_robot_slow_down 03B50D,03B517 b speed_low
# burns_robot_place_part: the part's record walked a byte at a time (03B530 "LDY #$7D21; LEAY A,Y": object_1d_parts;
# 03B535 "LDA ,Y+", 03B53A, 03B543 "LDB ,Y+", 03B54C "LDA ,Y+")
local burns_robot_place_part 03B535 t1 part_record
local burns_robot_place_part 03B53A t1 record_dy
local burns_robot_place_part 03B543 t1 record_dz
local burns_robot_place_part 03B54C t1 record_type
# the part's y and z from its offsets (03B53D "ADDD #$11,X; STD #$11,U", 03B546 "ADDD #$16,X; STD #$16,U")
local burns_robot_place_part 03B53D t5 self_y
local burns_robot_place_part 03B53D t7 part_y
local burns_robot_place_part 03B546 t7 part_z
# its x offset, negated for a turned part (03B556 "LDD <$EA; TST <$E8; BPL", 03B55E "NEGD"), from its x (03B55F
# "ADDD #$0C,X; STD #$0C,U")
local burns_robot_place_part 03B556 t4 shift_x
local burns_robot_place_part 03B55E t2 turned_shift_x
local burns_robot_place_part 03B55F t5 self_x
local burns_robot_place_part 03B55F t7 part_x
local burns_robot_place_part 03B556,03B55E a shift_x_high
local burns_robot_place_part 03B556,03B55E b shift_x_low
# burns_robot_in_middle: its x, between 40 and 180 (03B566 "LDD #$0C,X; CMPD #$0040")
local burns_robot_in_middle 03B566 t5 robot_x
local burns_robot_in_middle 03B566 a robot_x_high
local burns_robot_in_middle 03B566 d robot_x_low
# burns_robot_lob_due: the frames between its bombs by rank and form (03B585 "LDD A,Y": burns_robot_shot_times; 03B587
# "CMPD #$3B,X")
local burns_robot_lob_due 03B585 t4 lob_time
# done: objects/burns_robot.c

# ---- objects/burns_robot_parts.c ----
# burns_held_part_run: kept 30 in front of the robot (03B8F3 "LDD #$0C,U; ADDD <$F0; STD #$0C,X", 03B8FC "LDD #$11,U;
# STD #$11,X")
local burns_held_part_run 03B8F3 t5 holder_x
local burns_held_part_run 03B8F6 t6 part_x
local burns_held_part_run 03B8FC t5 holder_y
# burns_breakout_wait: the piece it puts in at the cue (03B5B9 "LBSR $867D", 03B5C1 "LDA #$80; STA ,U"), and the
# frame's low byte, 0 and 80 changing the look (03B5D6 "LDA <$16; BEQ", 03B5DB "CMPA #$80")
local burns_breakout_wait 03B5B9 u piece object
local burns_breakout_wait 03B5D6 t2 frame_now
# burns_breakout_break_wall: the piece moved 10 up the screen (03B5F6 "LDD #$11,U; SUBD #$0010; STD #$11,U")
local burns_breakout_break_wall 03B5F6 t5 piece_y
local burns_breakout_break_wall 03B5F9 t2 raised_y
# the tile written in the wall's hole and the counts left (03B614 "STA ,U+", 03B616 "DEC <$F1", 03B620 "DEC <$F0")
local burns_breakout_break_wall 03B614 t1 tile_at
local burns_breakout_break_wall 03B616 t2 tiles_left
local burns_breakout_break_wall 03B620 t2 rows_left
# burns_part_fall: its z speed less the gravity 60 (03B6CD "SUBD #$0060; STD #$19,X"), added to its z and fraction
# (03B6D3 "ADDD #$17,X; STD #$17,X")
local burns_part_fall 03B6CD t2 next_z_speed
local burns_part_fall 03B6D3 t5 z_low_and_fraction
local burns_part_fall 03B6D3 t6 z_speed_now
local burns_part_fall 03B6D3 t7 new_z_low_and_fraction
local burns_part_fall 03B6CD a z_speed_high
local burns_part_fall 03B6CD b z_speed_low
# rescued_maggie_drop: beside Mr. Burns (03B706 "LDD #$0C,U; ADDD #$0020; STD #$0C,X", 03B70F "LDD #$11,U")
local rescued_maggie_drop 03B706 t5 burns_x
local rescued_maggie_drop 03B70F t5 burns_y
# rescued_maggie_fall: Mr. Burns, told she landed (03B730 "LDU #$2A,X", 03B733 "INC #$3A,U": mr_burns.maggie_landed);
# her bounce, the z speed negated and halved (03B739 "NEGD", 03B73A "ASRA; RORB")
local rescued_maggie_fall 03B730 u mr_burns object.mr_burns
local rescued_maggie_fall 03B733 t3 landed_count
local rescued_maggie_fall 03B73A t1 bounce_high
# rescued_maggie_bounce: likewise (03B757 "NEGD", 03B758 "ASRA; RORB")
local rescued_maggie_bounce 03B758 t1 bounce_high
# rescued_maggie_crawl_to_burns: how far she is past Mr. Burns (03B7D7 "LDD #$0C,X; SUBD #$0C,U; CMPD #$0060")
local rescued_maggie_crawl_to_burns 03B7D7 t5 maggie_x
local rescued_maggie_crawl_to_burns 03B7DA t5 burns_x
local rescued_maggie_crawl_to_burns 03B7DA t7 difference_x
# rescued_maggie_sound: the frame's low 4 bits, 0 plays sound 45 (03B806 "LDA <$16; ANDA #$0F; BNE", 03B80D "LDD #$4500")
local rescued_maggie_sound 03B809 t2 frame_phase
local rescued_maggie_sound 03B809,03B80D a phase_then_sound
# mr_burns_wait_for_blow: what clearing 18FC reads, where the player who hits him is kept (03B937 "CLR $18FC";
# 03B96A "STA $18FC")
local mr_burns_wait_for_blow 03B937 t1 old_blow_player
# mr_burns_release_maggie: Maggie's object, whose state moves on (03B9A3 "LDU #$29,X", 03B9A6 "INC #$02,U")
local mr_burns_release_maggie 03B9A3 u rescued object.rescued_maggie
local mr_burns_release_maggie 03B9A6 t3 maggie_state
# mr_burns_see_maggie: his place, kept in 18F4/18F6 (03B9B8 "LDD #$0C,X; STD $18F4", 03B9BF "LDD #$11,X; STD $18F6")
local mr_burns_see_maggie 03B9B8 t5 burns_x
local mr_burns_see_maggie 03B9BF t5 burns_y
# done: objects/burns_robot_parts.c

# ---- objects/buzzing_chaser.c ----
# buzzing_chaser_chase: the way to its target (02F495 "LBSR $861D": vector_direction_to, its A the direction; 02F498
# "STA #$3E,X")
local buzzing_chaser_chase 02F495 d direction_to_target
# its target's height plus 30, which it climbs to or drops from (02F4AC "LDD #$16,U; ADDD #$0030; CMPD #$16,X"), with
# z speed 0040 or FFC0 (02F4B7 "LDD #$FFC0", 02F4BC "LDD #$0040"; 02F4BF "STD #$19,X")
local buzzing_chaser_chase 02F4AF t2 target_height
local buzzing_chaser_chase 02F4B7,02F4BC a z_speed_high
local buzzing_chaser_chase 02F4B7,02F4BC b z_speed_low
# done: objects/buzzing_chaser.c

# ---- objects/bystander.c ----
# bystander_start: the x where it reacts, its place times 16 (02E659 "CLRA; ASLDI #$04; STD #$3E,X")
local bystander_start 02E65A t2 trigger_place
# bystander_wait_car: whether the police car has stopped (02E673 "LDA $1884; BEQ")
local bystander_wait_car 02E673 t1 car_stopped
# done: objects/bystander.c

# ---- objects/clown_on_ball.c ----
# clown_on_ball_pose, clown_on_ball_hop: its x (02F0D8 "LDD #$0C,X; CMPD #$00E0"; 02F248 "LDD #$0C,X; SUBD #$0040;
# CMPD #$0140")
local clown_on_ball_pose 02F0D8 t5 clown_x
local clown_on_ball_hop 02F248 t5 clown_x
# clown_on_ball_jump_fall: its z speed less the gravity 20 (02F13E "LDD #$19,X; SUBD #$0020; STD #$19,X")
local clown_on_ball_jump_fall 02F141 t2 next_z_speed
# orbit_offset: the angle's quarter of the circle, which says which offsets are negated (02F299 "LDA <$EC; ANDA #$C0;
# BEQ", 02F2A0 "CMPA #$C0")
local orbit_offset 02F29C t2 quadrant_bits
# done: objects/clown_on_ball.c

# ---- objects/descent_balloon.c ----
# descent_balloon_release: over the fat goon that carries it, 3C higher (02A7A5 "LDD #$0C,U; STD #$0C,X", 02A7AB "LDD
# #$11,U", 02A7B1 "LDD #$16,U; ADDD #$003C")
local descent_balloon_release 02A7A5 t5 carrier_x
local descent_balloon_release 02A7AB t5 carrier_y
local descent_balloon_release 02A7B4 t2 balloon_z
# done: objects/descent_balloon.c

# ---- objects/goon_lift.c ----
# goon_lift_arrive: its x, below 140 it comes in (032F03 "LDD #$0C,X; CMPD #$0140")
local goon_lift_arrive 032F03 t5 lift_x
# done: objects/goon_lift.c

# ---- objects/collisions.c ----
# clear_hits: the objects left, counted down (07C036 "DECA; BNE"), and D at its end, the count and the last flags
# (07C039 "RTS")
local clear_hits 07C036 t1 objects_left
local clear_hits 07C039 d count_and_flags
# collide_players_with_enemies, collide_players_with_child_objects, collide_players_with_list_1_objects,
# unused_collide_with_list_1_objects: the inner and outer counts (07C063 "DEC <$F1", 07C06B "DEC <$F0"; 07C09A "DEC
# <$F3", 07C0A3 "DEC <$F0"; 07C0D2 "DEC <$F2", 07C0DA "DEC <$F0"; 07C133 "DEC <$F2"), and D at the end, A the last
# flags read (07C070, 07C0A8, 07C0DF "RTS")
local collide_players_with_enemies 07C063 t2 enemy_checks_left
local collide_players_with_enemies 07C06B t2 players_left
local collide_players_with_enemies 07C070 d last_flags_word
local collide_players_with_child_objects 07C09A t2 children_left
local collide_players_with_child_objects 07C0A3 t2 players_left
local collide_players_with_child_objects 07C0A8 d last_flags_word
local collide_players_with_list_1_objects 07C0D2 t2 list_1_left
local collide_players_with_list_1_objects 07C0DA t2 players_left
local collide_players_with_list_1_objects 07C0DF d last_flags_word
local unused_collide_with_list_1_objects 07C133 t2 list_1_left
# the object it checks (07C10D "LDA #$00,X; ANDA #$DF; STA #$00,X", "CLR #$1E,X")
param unused_collide_with_list_1_objects x checked object
# boxes_overlap: the boxes' distance along the floor (07C13A "LDB #$23,X; SEX; ADDD #$11,X; STD <$F6", 07C144 "LDB
# #$23,U; SEX; ADDD #$11,U; SUBD <$F6", 07C150 "NEGD")
local boxes_overlap 07C13D t1 object_dy
local boxes_overlap 07C13E t5 object_y
local boxes_overlap 07C13E t7 object_box_y
local boxes_overlap 07C147 t1 other_dy
local boxes_overlap 07C148 t5 other_y
local boxes_overlap 07C148 t7 other_box_y
local boxes_overlap 07C14B t6 difference_y
local boxes_overlap 07C150 t2 distance_y
# across, each box's offset turned the way it faces (07C162 "LDB #$22,X; SEX; STD <$F4", 07C170 "LDD #$0C,X; SUBD
# <$F4", 07C178 "LDD #$0C,X; ADDD <$F4"; likewise for U at 07C181-07C19A; 07C19D "SUBD <$F6", 07C1A2 "NEGD")
local boxes_overlap 07C165 t1 object_dx
local boxes_overlap 07C178 t5 object_x
local boxes_overlap 07C17B t6 object_box_x
local boxes_overlap 07C170 t5 turned_object_x
local boxes_overlap 07C173 t6 turned_object_box_x
local boxes_overlap 07C184 t1 other_dx
local boxes_overlap 07C197 t5 other_x
local boxes_overlap 07C19A t6 other_box_x
local boxes_overlap 07C18F t5 turned_other_x
local boxes_overlap 07C192 t6 turned_other_box_x
local boxes_overlap 07C19D t6 difference_x
local boxes_overlap 07C1A2 t2 distance_x
# in height (07C1B4 "CLRA; LDB #$24,X; ADDD #$16,X; STD <$F6", 07C1BE "CLRA; LDB #$24,U; ADDD #$16,U; SUBD <$F6",
# 07C1CA "NEGD")
local boxes_overlap 07C1B8 t7 object_box_z
local boxes_overlap 07C1C2 t7 other_box_z
local boxes_overlap 07C1C5 t6 difference_z
local boxes_overlap 07C1CA t2 distance_z
# A:B, each distance, then the two boxes' sizes added (07C154 "CLRA; LDB #$20,X; ADDB #$20,U; ADCA #$00; CMPD <$F6")
local boxes_overlap 07C14B,07C150,07C173,07C17B,07C192,07C19A,07C19D,07C1A2,07C1C5,07C1CA,07C1D5 a distance_high
local boxes_overlap 07C14B,07C150,07C155,07C158,07C173,07C17B,07C192,07C19A,07C19D,07C1A2,07C1A7,07C1AA,07C1C5,07C1CA,07C1CF,07C1D2 b distance_low
# what it hands back in D: the last sizes added, A complemented when the boxes touch (07C1DC "CLRA; RTS", 07C1DE "COMA;
# RTS")
local boxes_overlap 07C1DD,07C1DF d overlap_word
# collide_players_with_players: the players left to check against (07C205, 07C22F "DEC <$F0"), and D at the end
# (07C26C "RTS")
local collide_players_with_players 07C205 t2 players_left
local collide_players_with_players 07C22F t2 later_players_left
local collide_players_with_players 07C26C d last_flags_word
# trade_hits_with_enemy, trade_hits: the vitality before the other's damage is taken (07C274 "LDA #$1B,X; SUBA #$1C,U;
# BCC; CLRA"; 07C2E0, 07C30E)
local trade_hits_with_enemy 07C277 t4 old_vitality
local trade_hits 07C2E3 t4 old_vitality
local trade_hits 07C311 t4 other_old_vitality
# give_hit: the hitter's damage (07C2A2 "LDA #$1C,X; BEQ; STA <$E8"), taken off the target's vitality (07C2AA "LDA
# #$1B,U; SUBA <$E8")
local give_hit 07C2A2 a hitter_damage
local give_hit 07C2AD t2 damage_dealt
local give_hit 07C2AD t3 old_vitality
# done: objects/collisions.c

# ---- objects/doors.c ----
# door_kind_12_run: its x less 30, from 190 on (off the screen) it goes (03623F "LDD #$0C,X; SUBD #$0030; CMPD #$0190")
local door_kind_12_run 03623F t5 door_x
local door_kind_12_run 036242 t2 screen_offset
# car_doors_run, door_wait_for_place: its x (036127 "LDD #$0C,X; CMPD #$0030"; 036344 "LDD #$0C,X; CMPD #$3E,X")
local car_doors_run 036127 t5 door_x
local door_wait_for_place 036344 t5 door_x
# car_doors_wait_for_scroll: the camera's x (036142 "LDD <$AC; CMPD #$0120")
local car_doors_wait_for_scroll 036142 t4 camera_x_now
# car_doors_shake_and_unload, car_doors_shake: its timer, whose bit 0 flips the low byte of its z while 18 or more
# (036197, 036219 "LDA #$3B,X; CMPA #$18; BCS; ANDA #$01; EORA #$17,X; STA #$17,X")
local car_doors_shake_and_unload 036197 a timer_now
local car_doors_shake_and_unload 0361A0 t3 z_low
local car_doors_shake 036219 a timer_now
local car_doors_shake 036222 t3 z_low
# car_doors_let_out_enemies, door_let_out_list: the spawn record walked (0361C5, 036384, 036393 "LDA ,Y+; CMPA #$7F"),
# each let out when fewer players than 1874 counts are present (0361CB, 036399 "CMPA $1874; BCC")
local car_doors_let_out_enemies 0361C5 t1 spawn_record
local car_doors_let_out_enemies 0361CB t1 players_counted
local door_let_out_list 036382 y first_spawn door_spawn
local door_let_out_list 036384 t1 first_spawn_record
local door_let_out_list 036393 t1 spawn_record
local door_let_out_list 036399 t1 players_counted
# door_kind_12_start, door_kind_10_start, door_kind_0f_start: the x where it opens, from its opening record (036263,
# 0362C3, 036332 "LDD ,U; STD #$3E,X")
local door_kind_12_start 036263 t4 opening_x
local door_kind_10_start 0362C3 t4 opening_x
local door_kind_0f_start 036332 t4 opening_x
# done: objects/doors.c

# ---- objects/fat_goon.c ----
# unused_become_fat_goon: the enemy it makes a fat goon (02A0D0 "LBSR $85AB" with X; 02A0D3 "LDA #$42,X; BMI", 02A0D8
# "LDU #$38,X; LBSR $859F", then 2A, 3A, 30, 3B, 01 set), its class and target before
param unused_become_fat_goon x enemy object
local unused_become_fat_goon 02A0D3 t3 old_class
local unused_become_fat_goon 02A0D8 t5 old_target
# fat_goon_waiting: its x, below 100 it fights (02A1EA "LDD #$0C,X; CMPD #$0100")
local fat_goon_waiting 02A1EA t5 goon_x
# fat_goon_from_back_place, fat_goon_descent_start, fat_goon_jump_in_start, fat_goon_from_below_start: the x its
# spawn's state picks (02A469 "LDD A,U; STD #$0C,X"; 02A6DC "LDD ,U; STD #$0C,X"; 02ABD3, 02AC83 "LDD A,U; STD #$0C,X")
local fat_goon_from_back_place 02A469 t4 first_x
local fat_goon_descent_start 02A6DC t4 first_x
local fat_goon_jump_in_start 02ABD3 t4 first_x
local fat_goon_from_below_start 02AC83 t4 first_x
# fat_goon_thrower_pick_up: its x speed, 0200 or FF00 by its target's direction (02A50A "LDD #$FF00", 02A50F "LDD
# #$0200"; 02A512 "STD #$0F,X")
local fat_goon_thrower_pick_up 02A50A,02A50F a x_speed_high
local fat_goon_thrower_pick_up 02A50A,02A50F d x_speed_low
# fat_goon_thrower_carry: the object carried over its head (02A57F "LDD #$0C,X; STD #$0C,U", 02A585 "LDD #$11,X",
# 02A58B "LDD #$16,X; ADDD #$0044; STD #$16,U"); its x less 60, from 100 on it does not throw (02A5A4 "LDD #$0C,X; SUBD
# #$0060; CMPD #$0100")
local fat_goon_thrower_carry 02A57F t5 thrower_x
local fat_goon_thrower_carry 02A585 t5 thrower_y
local fat_goon_thrower_carry 02A58E t2 carried_z
local fat_goon_thrower_carry 02A5A4 t5 thrower_x_now
local fat_goon_thrower_carry 02A5A7 t2 screen_offset
# fat_goon_delayed_steps, fat_goon_descent_steps: its substep times 2, the jump's offset (02A68B "ASLA; JMP [A,U]",
# 02A715 "ASLB; JSR [B,U]")
local fat_goon_delayed_steps 02A68B t2 step_offset
local fat_goon_descent_steps 02A715 t2 step_offset
# fat_goon_delayed_appear: its direction and speed (02A698 "LDD #$3E,X; LBSR $8617")
local fat_goon_delayed_appear 02A698 t5 direction_and_speed
# fat_goon_descent_fall: its zoom one step larger, up to 4040 (02A72A "LDD #$0A,X; ADDD #$0101; CMPD #$4040")
local fat_goon_descent_fall 02A72D t2 bigger_zoom
# fat_goon_jump_in_start, fat_goon_from_below_start: its x, from E0 on it turns (02ABFD, 02ACA6 "LDD #$0C,X; CMPD
# #$00E0"); fat_goon_jump_in_jump, fat_goon_from_below_rise too: the cemetery's scroll speed as its z speed (02AC0E,
# 02AC56, 02ACB6, 02AD01 "LDD <$E2; STD #$19,X")
local fat_goon_jump_in_start 02ABFD t5 goon_x
local fat_goon_jump_in_start 02AC0E t4 scroll_z_speed
local fat_goon_jump_in_jump 02AC56 t4 scroll_z_speed
local fat_goon_from_below_start 02ACA6 t5 goon_x
local fat_goon_from_below_start 02ACB6 t4 scroll_z_speed
local fat_goon_from_below_rise 02AD01 t4 scroll_z_speed
# fat_goon_from_below_rise: its z, under the floor while negative (02ACC9 "LDD #$16,X; BMI; CMPD #$0000")
local fat_goon_from_below_rise 02ACC9 a z_high
local fat_goon_from_below_rise 02ACC9 d z_low
# done: objects/fat_goon.c

# ---- objects/fat_goon_actions.c ----
# fat_goon_grab_approach, fat_goon_grab: the way to its target (02AA74, 02AB47 "LBSR $861D": vector_direction_to, its A
# the direction; "LDB #$20 / #$30; LBSR $8617")
local fat_goon_grab_approach 02AA74 d direction_word
local fat_goon_grab 02AB47 d direction_word
# fat_goon_grab: A:B, the action to take (02AA82 "LDD #$0B00", 02AA87 "LDD #$0C00"; 02AA8A "STD #$28,X"), or the
# target's floor height compared with its z and the goon's (02AAC2 "LDD #$5C,U; CMPD #$16,U")
local fat_goon_grab 02AA82,02AA87,02AAC2 a action_or_floor_high
local fat_goon_grab 02AA82,02AA87,02AAC2 b action_or_floor_low
# the target it holds, at whose place it stands (02AAEE "LDD #$0C,U; STD #$0C,X", 02AAF4 "LDD #$11,U; STD #$11,X")
local fat_goon_grab 02AAEE t5 target_x
local fat_goon_grab 02AAF4 t5 target_y
# done: objects/fat_goon_actions.c
# burns_robot_start_walking: what burns_robot_set_box leaves in U, past the box record (03B3A6 "LBSR $72FF"; 03B317
# "LDD ,U++")
local burns_robot_start_walking 03B3A6 u box_end

# ---- objects/floor_scenery.c ----
# floor_blocker_start, platform_scenery_start, charging_scenery_start: its y moved 2 up (02B25B, 02C834, 02C9F7 "LDD
# #$11,X; SUBD #$0002; STD #$11,X")
local floor_blocker_start 02B25B t5 blocker_y
local platform_scenery_start 02C834 t5 scenery_y
local platform_scenery_start 02C837 t2 raised_y
local charging_scenery_start 02C9F7 t5 scenery_y
local charging_scenery_start 02C9FA t2 raised_y
# platform_scenery_start, charging_scenery_start: the low byte of the floor cell's place under it, its column (02C843,
# 02CA10 "PUSHS U; PULLS D; STB <$F0; ANDB #$C0")
local platform_scenery_start 02C845 b cell_low
local charging_scenery_start 02CA12 b cell_low
# the parts' handlers: its x, compared with where each part is written (02B28C "LDD #$0C,X; CMPD #$0180", 02B29E, 02B2B0;
# 02C77E, 02C78F, 02C7A0, 02C7B1; 02C9C3, 02C9D5)
local floor_blocker_first_part 02B28C t5 blocker_x
local floor_blocker_second_part 02B29E t5 blocker_x
local floor_blocker_last_part 02B2B0 t5 blocker_x
local platform_scenery_second_part 02C77E t5 scenery_x
local platform_scenery_third_part 02C78F t5 scenery_x
local platform_scenery_fourth_part 02C7A0 t5 scenery_x
local platform_scenery_last_part 02C7B1 t5 scenery_x
local charging_scenery_second_part 02C9C3 t5 scenery_x
local charging_scenery_last_part 02C9D5 t5 scenery_x
# floor_blocker_write_cells, platform_scenery_write_cells: the shape's floor cells, 3 rows of 4 (the 12-byte shapes
# floor_blocker_shape_1-3, platform_scenery_shape_1-5, charging_scenery_shape_1-3, 12 apart: the callers' "LDY #$7Fxx"),
# written a column at a time into the floor map's rows above, at and below the object's (02B2F1 "LDA ,Y; STA #$-40,U",
# 02B2F6 "LDA #$04,Y; STA ,U", 02B2FB "LDA #$08,Y; STA #$40,U", 02B302 "LEAY #$01,Y"; likewise 02C7F6-02C807): the
# pointer walks the top row, a column's cells 4 apart (a record of 9 from the last column ends at the shape's end)
struct shape_column 09 rom
field shape_column 00 top_cell u8
field shape_column 04 middle_cell u8
field shape_column 08 bottom_cell u8
param floor_blocker_write_cells y cells shape_column
local floor_blocker_write_cells 02B302 y cells shape_column
local floor_blocker_write_cells 02B2F6 t3 cell_in_middle
local floor_blocker_write_cells 02B2FB t3 cell_at_bottom
param platform_scenery_write_cells y cells shape_column
local platform_scenery_write_cells 02C807 y cells shape_column
local platform_scenery_write_cells 02C7FB t3 cell_in_middle
local platform_scenery_write_cells 02C800 t3 cell_at_bottom
# the columns left (02B305, 02C80A "DEC <$F4")
local floor_blocker_write_cells 02B305 t2 columns_left
local platform_scenery_write_cells 02C80A t2 columns_left
# platform_scenery_clear_floor: the cell it stood on, written back over 20 columns (02C896 "LDA #$33,X", 02C8A3 "STA
# ,U"), and the columns left (02C8A9 "DEC <$F4")
local platform_scenery_clear_floor 02C896 a stood_cell
local platform_scenery_clear_floor 02C8A9 t2 columns_left
# platform_scenery_press: the players present (1874), twice, added to its z (02C8C9 "CLRA; LDB $1874; ASLB; ADDD
# #$16,X; STD #$16,X")
local platform_scenery_press 02C8CA t1 players_counted
local platform_scenery_press 02C8CF t7 pressed_z
# pick_random_player: the tries before the count (02CA58 "DBJNZ")
local pick_random_player 02CA58 t1 tries_before
# charging_scenery_wait_target: its x (02CA5B "LDD #$0C,X; CMPD #$0128"); charging_scenery_charge: its y (02CA9A "LDD
# #$11,X; CMPD #$0040")
local charging_scenery_wait_target 02CA5B t5 scenery_x
local charging_scenery_charge 02CA9A t5 scenery_y
# solid_scenery_start: raised 4C (02CE56 "LDD #$16,X; ADDD #$004C; STD #$16,X")
local solid_scenery_start 02CE59 t2 raised_z
# rising_scenery_start: what clearing 187F reads, the second's cue to rise (02D742 "CLR $187F"; rising_scenery_rise
# 02D7A2 "STA $187F"); the second set 8 right and 2 up (02D74C "LDD #$0C,X; ADDD #$0008", 02D755 "LDD #$11,X; SUBD
# #$0002"); the camera's x it waits for (02D765 "LDD A,U; STD #$3E,X": rising_scenery_camera_xs)
local rising_scenery_start 02D742 t1 old_rise_cue
local rising_scenery_start 02D74C t5 scenery_x
local rising_scenery_start 02D74F t2 moved_x
local rising_scenery_start 02D755 t5 scenery_y
local rising_scenery_start 02D758 t2 raised_y
local rising_scenery_start 02D765 t4 camera_trigger
# rising_scenery_wait_camera, looping_scenery_wrap_until_camera: the camera's x (02D76E "LDD <$AC; CMPD #$3E,X"; 02E0C1
# "LDD <$AC; CMPD #$06B0")
local rising_scenery_wait_camera 02D76E t4 camera_x_now
local looping_scenery_wrap_until_camera 02E0C1 t4 camera_x_now
# rising_scenery_rise: its timer, 20 cues the second (02D79B "LDA #$3B,X; CMPA #$20; BNE; STA $187F")
local rising_scenery_rise 02D79B a timer_left
# the looping scenery: its x's high byte, kept 0 or 1 (02E0AA, 02E0B9, 02E0CD "LDA #$0C,X; ANDA #$01; STA #$0C,X"), and
# its x past 1C0 (02E0D5 "LDD #$0C,X; CMPD #$01C0")
local looping_scenery_wrap 02E0AA t3 x_high
local looping_scenery_wrap_until_camera 02E0B9 t3 x_high
local looping_scenery_leave 02E0CD t3 x_high
local looping_scenery_leave 02E0D5 t5 scenery_x
# done: objects/floor_scenery.c

# ---- objects/football_player.c ----
# football_line_piece: its step, counted in field 2F (03C895 "LDA #$2F,X; CMPA #$04", 03C89E, 03C8A3 "INC #$2F,X")
local football_line_piece 03C895 t3 piece_step
local football_line_piece 03C8A3 t3 step_before
local football_line_piece 03C89E t3 early_step_before
# the pieces put out so far, counted in 184A, up to 7 (03C8A6 "LDA $184A; CMPA #$07", 03C8AF "INC $184A")
local football_line_piece 03C8A6 t1 pieces_out
local football_line_piece 03C8AF t1 pieces_before
# the piece's number in the line (184A), its record in football_player_line_pieces (03C849 "LDB $184A", 03C86D "LDB
# $184A; ASLB; LDY #$7DD6; LEAY B,Y", 03C879 "LDB ,Y+"), and its x moved by the record's offset (03C888 "SEX; ADDD
# #$0C,X; STD #$0C,X")
local football_line_piece 03C849 t1 line_piece_number
local football_line_piece 03C86D t1 piece_index
local football_line_piece 03C879 t1 piece_record
local football_line_piece 03C888 t1 shift_x
local football_line_piece 03C889 t5 piece_x
local football_line_piece 03C889 t7 moved_x
# football_player_start: set 30 further down the screen and 30 lower (03C379 "LDD #$11,X; ADDD #$0030", 03C382 "LDD
# #$16,X; SUBD #$0030"); what clearing 184A reads (03C393 "CLR $184A")
local football_player_start 03C379 t5 football_y
local football_player_start 03C37C t2 lowered_y
local football_player_start 03C385 t2 dropped_z
local football_player_start 03C393 t1 old_line_cue
# football_player_wait_cue: the story's cue (03C3A2 "LDA $184A; BEQ"), then 30 up the screen (03C3AE "LDD #$11,X;
# SUBD #$0030")
local football_player_wait_cue 03C3A2 t1 line_cue
local football_player_wait_cue 03C3AE t5 football_y
# the reach to look for a player in, 003C across (03C615 "LDD #$003C"; 03C61D "STD <$F8"), in the handlers that end in
# that shared tail; in football_player_throwing and football_player_charge A is first its animation's flags (03C6DD,
# 03C720 "LDA #$06,X; BITA #$01")
local football_player_ready 03C615 a reach_x_high
local football_player_ready 03C615 b reach_x_low
local football_player_tackle 03C615 a reach_x_high
local football_player_tackle 03C615 b reach_x_low
local football_player_flinch 03C615 a reach_x_high
local football_player_flinch 03C615 b reach_x_low
local football_player_throwing 03C615,03C6DD a frame_or_reach_high
local football_player_throwing 03C615 b reach_x_low
local football_player_charge 03C615,03C720 a frame_or_reach_high
local football_player_charge 03C615 b reach_x_low
# football_player_start_run, football_player_run_at_target: D, the x offset ahead of the target (03C422, 03C483 "LBSR
# $60E0": stage_boss_offset_ahead_of), then the way to it (03C425, 03C486 "LBSR $8671", "STA #$32,X")
local football_player_start_run 03C422,03C425 d direction_word
local football_player_run_at_target 03C483,03C486 d direction_word
# football_player_run: where its speeds take it, checked against the field's sides: x (03C53E "LDB #$0F,X; SEX; STA
# <$F0", 03C545 "LDD #$0D,X; ADDD #$0F,X; TFR A,B", 03C54D "LDA #$0C,X; ADCA <$F0"), then y (03C568-03C57A); A:B the
# place, and at the shared tail the reach (03C615)
local football_player_run 03C545 t5 x_low_and_fraction
local football_player_run 03C548 t6 x_low_fraction
local football_player_run 03C54D t3 x_high
local football_player_run 03C56F t5 y_low_and_fraction
local football_player_run 03C572 t6 y_low_fraction
local football_player_run 03C577 t3 y_high
local football_player_run 03C550,03C57A,03C615 a place_high
local football_player_run 03C54B,03C575,03C615 b place_low
# football_player_charge: what clearing 184A reads, the line's count (03C733 "CLR $184A")
local football_player_charge 03C733 t1 old_line_pieces
# football_player_defeated: what clearing the stage's flag 1850 reads (03C78E "CLR $1850")
local football_player_defeated 03C78E t1 old_stage_flag
# football_player_check_hit: the health limits by players (03C7AC "LDY #$7DB9; LBSR $6260"), then the x speed it is
# knocked away with (03C7E6, 03C809 "LDY #$0400; LBSR $6078": stage_boss_knock_away's x speed); its z one higher
# (03C7EC "INC #$17,X")
local football_player_check_hit 03C7AC y health_limits
local football_player_check_hit 03C7E6,03C809 y knock_speed
local football_player_check_hit 03C7EC t3 z_low
# done: objects/football_player.c

# ---- objects/handlers_bank_15.c ----
# fat_goon_descent_update: its state times 2, the jump's offset (02A6A5 "ASLB; JSR [B,U]")
local fat_goon_descent_update 02A6A5 t2 state_offset
# goon_hat_update: its x, from 1C0 on it goes (02B370 "LDD #$0C,X; CMPD #$01C0")
local goon_hat_update 02B370 t5 hat_x
# done: objects/handlers_bank_15.c

# ---- objects/handlers_bank_16.c ----
# the handlers' x checks after the state's handler: gone off the screen (02CE35 "LDD #$0C,X; CMPD #$01F0"; 02C49B
# "LDD #$0C,X; SUBD #$0010; CMPD #$01A0"; 02D5D3 "LDD #$0C,X; SUBD #$0040; CMPD #$01C0")
local solid_scenery_update 02CE35 t5 scenery_x
local carried_obstacle_update 02C49B t5 obstacle_x
local carried_obstacle_update 02C49E t2 screen_offset
local dreamland_obstacle_update 02D5D3 t5 obstacle_x
local dreamland_obstacle_update 02D5D6 t2 screen_offset
# obstacle_update, heavy_obstacle_update: its state after the handler, below 4 or knocked (02CACE "LDA #$02,X; BMI;
# CMPA #$04"; 02C13E "LDA #$02,X; BPL; CMPA #$FF")
local obstacle_update 02CACE a state_now
local heavy_obstacle_update 02C13E a state_now
# woman_in_apron_update: its x on the screen, from 1C0 on it goes (02D83D "LDD #$0C,X; CMPD #$01C0"), and in the stage, from
# its home (02D849 "LDD #$0C,X; ADDD <$AC; SUBD #$3E,X")
local woman_in_apron_update 02D83D t5 screen_x
local woman_in_apron_update 02D849 t5 walker_x
# done: objects/handlers_bank_16.c

# ---- objects/handlers_bank_17.c ----
# teacup_goon_ride_update: its x, below E0 it holds the scroll (02E8AD "LDD #$0C,X; CMPD #$00E0"), from 1E0 on it goes
# (02E8CC); the players present, by which the riders out are limited (02E8BE "LDA $1874; LDA A,U": krustyland_child_
# limits_by_players)
local teacup_goon_ride_update 02E8AD t5 hub_x
local teacup_goon_ride_update 02E8BE t1 players_counted
local teacup_goon_ride_update 02E8CC t5 hub_x_now
# the handlers' x checks after the state's handler (02F15E "LDD #$0C,X; SUBD #$0060; CMPD #$0100"; 02F4FB "LDD #$0C,X;
# CMPD #$01C0"; 02E38F "LDD #$0C,X; SUBD #$0040; CMPD #$0190"; 02E4A7 "LDD #$0C,X; SUBD #$0010; CMPD #$01B0")
local clown_on_ball_charge_update 02F15E t5 clown_x
local bluebird_update 02F4FB t5 creature_x
local girl_with_food_update 02E38F t5 walker_x
local sideshow_bob_update 02E4A7 t5 walker_x
local sideshow_bob_update 02E4AA t2 screen_offset
# done: objects/handlers_bank_17.c

# ---- objects/handlers_bank_18.c ----
# (only registers the handlers hand on: nothing named)
# done: objects/handlers_bank_18.c

# ---- objects/handlers_bank_19.c ----
# robot_update: its animation, 87 or 80 plays sound 27 (032B34 "LDA #$05,X; CMPA #$87")
local robot_update 032B34 a animation_now
# ninja_update: 187E, set when the ninjas are to vanish (0322BC "LDA $187E; BEQ"; "LDA #$06; STA #$02,X")
local ninja_update 0322BC t1 ninjas_vanish
# ninja_star_update: its flags after the off-screen check (032633 "LDA #$00,X; BEQ; BITA #$20"), and its height over the
# floor compared with the floor cell's (032645 "ASLA; ASLA; ASLA; CMPA #$5D,X")
local ninja_star_update 032633 a flags_now
local ninja_star_update 032648 t3 star_floor_z
# done: objects/handlers_bank_19.c

# ---- objects/handlers_bank_1a.c ----
# boss_ball_update: its y speed's size, which makes it wider (034E06 "LDD #$14,X; ABSD; LSRDI #$03; ADDB #$40")
local boss_ball_update 034E09 t1 signed_y_speed
local boss_ball_update 034E09 t3 y_speed_size
# unused_show_debug_values: 188C (the level object_1a puts there), the camera's x plus 150 (03403B "LDD <$AC; ADDD
# #$0150; STD <$F0") and the cemetery's scroll (03405A "LDD <$B8; STD <$F0")
local unused_show_debug_values 03402F t1 object_1a_level_shown
local unused_show_debug_values 03403B t4 camera_x_now
local unused_show_debug_values 03403E t2 shown_scroll_x
local unused_show_debug_values 03405A t4 shown_cemetery_scroll
# done: objects/handlers_bank_1a.c

# ---- objects/hurry_up.c ----
# hurry_up: a player's object by a random number's bits 0-1 (03D013 "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40;
# STD #$2B,X"), and the camera's x it keeps (03D024 "LDD <$AC; STD #$29,X")
local hurry_up 03D01A t1 player_offset
local hurry_up 03D01B t2 player_object
local hurry_up 03D024 t4 camera_x_now
# hurry_up_enter: against the camera's y speed (03D045 "LDD <$E0; NEGD; STD #$14,X")
local hurry_up_enter 03D045 t4 camera_speed
local hurry_up_enter 03D048 t2 against_camera
# hurry_up_next_player: the next player's object, C0 on and round from 4A40, until one in use (03D078 "LDU #$2B,X",
# 03D086 "LEAU #$00C0,U; CMPU #$4D40", 03D08F "LDU #$4A40", 03D092 "TST #$00,U")
local hurry_up_next_player 03D078,03D086,03D08F u candidate object
# hurry_up_go_to_player: its player's y moved by the player's height while it compares (03D0AF "LDD #$11,U; ADDD
# #$16,U; SUBD #$0080; STD #$11,U") and moved back (03D0E8, 03D103 "LDD #$11,U; SUBD #$16,U; ADDD #$0080")
local hurry_up_go_to_player 03D0AF t5 target_y
local hurry_up_go_to_player 03D0E8 t5 raised_target_y
local hurry_up_go_to_player 03D103 t5 raised_target_y_2nd
# the window around it the player must be in: 18 right to 18 left of its x, 10 down to 10 up of its y (03D0BB "LDD
# #$0C,X; ADDD #$0018; CMPD #$0C,U", 03D0C6 "SUBD #$0030; CMPD #$0C,U", 03D0CE "LDD #$11,X; ADDD #$0010; CMPD #$11,U",
# 03D0D9 "SUBD #$0020; CMPD #$11,U")
local hurry_up_go_to_player 03D0BB t5 hurry_x
local hurry_up_go_to_player 03D0C1 t5 target_x
local hurry_up_go_to_player 03D0C9 t5 target_x_2nd
local hurry_up_go_to_player 03D0CE t5 hurry_y
local hurry_up_go_to_player 03D0D4 t5 raised_y_checked
local hurry_up_go_to_player 03D0DC t5 raised_y_checked_2nd
# D, the window's edges, then the way to the player (03D0F9 "LDB #$F6; LBSR $8671")
local hurry_up_go_to_player 03D0BE,03D0D1,03D0F9,03D0FB d edge_or_direction
# its y, kept in player_y (03D12D "LDD #$11,X; STD #$32,X")
local hurry_up_go_to_player 03D12D t5 hurry_y_now
# done: objects/hurry_up.c

# ---- objects/items.c ----
# food_jump_out_start: its move, from food_move_choices by its state (02E22B "LDU A,U"; 02E22D "LDD ,U", 02E237 "LDD
# #$02,U", 02E23D "LDD #$04,U", 02E24C "LDD #$06,U")
local food_jump_out_start 02E22B u chosen_move food_move
local food_jump_out_start 02E22D t4 animation_and_hit
local food_jump_out_start 02E237 t5 move_gravity
local food_jump_out_start 02E23D t5 move_x_speed
local food_jump_out_start 02E24C t5 move_z_speed
# a random number, its low bit keeping the x speed's low byte, the rest halved into it (02E243 "LDA <$58; LSRA; BCS;
# STA #$10,X")
local food_jump_out_start 02E246 t1 roll
local food_jump_out_start 02E246 a half_roll
# the object it came out of and its own x (02E262 "LDU #$2A,X; LDD #$0C,U; CMPD #$0C,X")
local food_jump_out_start 02E265 t5 source_x
local food_jump_out_start 02E268 t5 food_x
# food_jump_out_bounce: its z speed less its gravity (02E279 "LDD #$19,X; SUBD #$3E,X; STD #$19,X")
local food_jump_out_bounce 02E27C t7 next_z_speed
# food_eaten_shrink: its zoom one step smaller (02E336 "LDD #$0A,X; SUBD #$0101; STD #$0A,X")
local food_eaten_shrink 02E339 t2 smaller_zoom
# girl_with_food (02E39E-02E45E): 187C counts the food dropped, 187D those leaving (02E3B1 "CLR $187C", 02E3B5 "CLR $187D",
# 02E3FC "LDA $187C", 02E40E "INC $187C", 02E454 "INC $187D", 02E458 "LDA $187D; CMPA #$01"); 1874 the players present
# (02E3C1 "LDB $1874; CMPB #$02")
local girl_with_food_start 02E3B1 t1 old_food_drops
local girl_with_food_start 02E3B5 t1 old_leavers
local girl_with_food_start 02E3C1 t1 players_counted
local girl_with_food_walk_in 02E3FC t1 food_drops
local girl_with_food_drop_food 02E40E t1 food_drops_before
local girl_with_food_walk_off 02E454 t1 leavers_before
local girl_with_food_walk_off 02E458 t1 leavers
# done: objects/items.c

# ======== temporaries, typed pointers and locals: objects k-z ========
# objects_b (objects/k* to z*): temporaries, untyped pointers and the last register names
# Proposals in symbols.txt syntax; each with its evidence above it. Conventions used throughout:
#   an object's x is on the screen (x + camera_x is the stage's x: 02D8E1 "ADDD <$AC"), so a load of x compared with
#   a constant is `screen_x`; one compared with another object's is `own_x`, the other's `target_x`, `device_x`...;
#   `old_x` / `new_x` (`old_y` / `new_y`) are a field read and written back moved (LDD #$0C,X; ADDD #n; STD #$0C,X),
#   `new_z_speed` the z speed with gravity taken off (LDD #$19,X; SUBD #n; STD #$19,X);
#   an ABSD is a difference (`x_difference`), its copy (`signed_x_difference`) and its size (`x_distance`).
#   a CLR of the tile chip's spare RAM (1840-18FF) reads before it clears: those reads are `old_...`.

# ======== objects/moes_street_scenery.c ========
# 02C245 "LDD #$0C,X", 02C248 "ADDD #$0010", 02C24B "STD #$0C,X": the riser moved 16 to the right
local moes_street_scenery_riser_start 02C245 t5 old_x
local moes_street_scenery_riser_start 02C248 t2 new_x
# 02C2EA "LDD #$0C,X", 02C2ED "ADDD #$0010", 02C2F0 "STD #$0C,X": the dropper moved 16 to the right
local moes_street_scenery_dropper_start 02C2EA t5 old_x
local moes_street_scenery_dropper_start 02C2ED t2 new_x
# 02C374 "INC $184A": the first dropper counts itself down (03C3A2 and the others read 184A as the stage's phase)
local moes_street_scenery_dropper_land 02C374 t1 droppers_down
# 02C3E0 "DEC <$F0; BNE": floor_columns_left before the decrement (32 columns written)
local moes_street_scenery_dropper_write_floor 02C3E0 t2 columns_to_write
# done: objects/moes_street_scenery.c

# ======== objects/woman_in_apron.c ========
# 02D87F "LDD #$0C,X; ADDD <$AC; SUBD #$0030; STD #$3E,X": its home, 48 left of where it starts on the stage
local woman_in_apron_start 02D87F t5 screen_x
local woman_in_apron_start 02D882 t6 world_x
local woman_in_apron_start 02D885 t2 home_place
# 02D89A "LDD #$11,X; SUBD #$0006; STD #$11,X": 6 up
local woman_in_apron_start 02D89A t5 old_y
local woman_in_apron_start 02D89D t2 new_y
# 02D8DE "LDD #$0C,X; ADDD <$AC; CMPD #$3E,X": where it is on the stage against its home
local woman_in_apron_wander 02D8DE t5 screen_x
local woman_in_apron_wander 02D8E1 t6 world_x
# 02D919 "LDU #$40,X", 02D91C "LDD #$0C,X", 02D91F "CMPD #$0C,U": its x against its device's
local woman_in_apron_run_to_device 02D91C t5 own_x
local woman_in_apron_run_to_device 02D91F t5 device_x
# 02D938 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$0004": within 4 of its device
local woman_in_apron_reach_device 02D938 t5 own_x
local woman_in_apron_reach_device 02D93B t5 device_x
local woman_in_apron_reach_device 02D93B t7 x_difference
local woman_in_apron_reach_device 02D93E t1 signed_x_difference
local woman_in_apron_reach_device 02D93E t3 x_distance
# done: objects/woman_in_apron.c

# ======== objects/teacup_goon_ride.c ========
# 02E8E3 "CLR $1881": the clear reads first (nothing else reads 1881)
local teacup_goon_ride_start 02E8E3 t1 old_value
# 02E8F1 "LDD #$0C,X; ADDD #$0040; STD #$0C,X": the hub moved 64 to the right
local teacup_goon_ride_start 02E8F1 t5 old_x
local teacup_goon_ride_start 02E8F4 t2 new_x
# 02E901 "LDA $1876; CMPA #$02": the enemies in play (07CB89 "INC $1876"), fewer than 2 to go on
local teacup_goon_ride_put_in_arms 02E901 t1 enemies
# 02E93F "DEC <$F0; BNE $6918": ride_parts_left before the decrement (3 arms)
local teacup_goon_ride_put_in_arms 02E93F t2 arms_to_put
# 02E945 "LDA $1884; BEQ": set when the police car stops (02B489 "STA $1884")
local teacup_goon_ride_wait_signal 02E945 t1 stop_signal
# 02E95D "LDA $1876; CMPA #$02": the enemies in play
local teacup_goon_ride_wait_enemies 02E95D t1 enemies
# 02E9E2 "DEC <$F0; BNE $69B3": ride_parts_left before the decrement (2 riders)
local teacup_goon_ride_arm_put_in_riders 02E9E2 t2 riders_to_put
# 02EA5C "LDD #$3E,X; SUBA #$01; STA #$3E,X": the arm's angle (A) and radius (B) before the step
local teacup_goon_ride_arm_orbit 02EA5C t5 old_angle_and_radius
# 02EA67 "LDD #$0C,U; ADDD <$E8; SUBD #$0C,X": the hub's x plus the orbit's, less the arm's: the x speed's high byte
local teacup_goon_ride_arm_orbit 02EA67 t5 hub_x
local teacup_goon_ride_arm_orbit 02EA6D t5 own_x
# 02EA79 "LDD #$11,U; ADDD <$EA; SUBD #$11,X": the same for y
local teacup_goon_ride_arm_orbit 02EA79 t5 hub_y
local teacup_goon_ride_arm_orbit 02EA7F t5 own_y
# 02EABE "LDD #$0C,X; CMPD #$00E0; BCS": right of the screen's middle, the piece flies left
local teacup_goon_piece_start 02EABE t5 screen_x
# 02EACF "LDD #$19,X; SUBD #$0018; STD #$19,X": gravity
local teacup_goon_piece_fall 02EAD2 t2 new_z_speed
# 02EBBD "LDD #$0C,X; CMPD #$00E0; BCS"
local teacup_goon_knocked 02EBBD t5 screen_x
# 02EBE9 "LDD #$19,X; SUBD #$0020; STD #$19,X": gravity
local teacup_goon_knocked_fall 02EBEC t2 new_z_speed
# 02ECBE "LDD #$0C,U; ADDD <$E8; SUBD #$0C,X" (U = the arm, 02EC9C "LDU #$40,X"), 02ECD3 the same for y
local teacup_goon_follow_arm 02ECBE t5 arm_x
local teacup_goon_follow_arm 02ECC4 t5 own_x
local teacup_goon_follow_arm 02ECD3 t5 arm_y
local teacup_goon_follow_arm 02ECD9 t5 own_y
# 02ED10 "CLRA; LDB <$58; ASLDI #$01; STD #$0F,X": a random x speed up to 2 pixels
local teacup_goon_leap_off 02ED14 t2 random_x_speed
# 02ED4F "LDD #$19,X; SUBD #$0020; STD #$19,X": gravity
local teacup_goon_leap_land 02ED52 t2 new_z_speed
# 02EDA9 "LDD #$0C,X; SUBD #$0040; CMPD #$0140; BCS": on the screen (x - 64 below 320)
local teacup_goon_keep_on_screen 02EDA9 t5 screen_x
local teacup_goon_keep_on_screen 02EDAC t2 from_left_edge
# 02EEA2 "LDD #$0C,X; CMPD #$00E0; BCS"
local teacup_goon_charge 02EEA2 t5 screen_x
# done: objects/teacup_goon_ride.c

# ======== objects/belly_dancer.c ========
# 0312AF "LDD #$0C,X; CMPD #$0150; BCC": waits until it is on the screen
local belly_dancer_thrower_wait 0312AF t5 screen_x
# done: objects/belly_dancer.c

# ======== objects/fireman_goon.c ========
# 02E6B4 "LDD #$11,X; ADDD #$0002; STD #$11,X": 2 down
local fireman_goon_setup 02E6B4 t5 old_y
local fireman_goon_setup 02E6B7 t2 new_y
# 02E6F3 "LDD ,U; STD #$3E,X; CMPD #$0100" (U = fireman_goon_starts + 4 x parameter): the entry's x
local fireman_goon_setup 02E6F3 t4 entry_x
# 02E725 "LDD <$AC; CMPD #$03D0; BCS": waits for the camera
local fireman_goon_wait_camera 02E725 t4 camera_position
# done: objects/fireman_goon.c
# done: objects/fireman_goon_effect.c
# done: objects/rabbit.c

# ======== objects/one_eared_rabbit.c ========
# 02EFE8 "LDY #$7CB6; LBSR $85B4": the striking hit box handed to vector_set_hit_box (Y as it came otherwise)
local one_eared_rabbit_strike_hit 02EFE8 y box
# done: objects/one_eared_rabbit.c

# ======== objects/bluebird.c ========
# 02F51C "LDA #$30,X; BPL", 02F521 "ANDA #$7F; BEQ", 02F525 "DECA; STA #$30,X": the parameter's count without bit 7
local bluebird_start 02F521 t2 masked_parameter
# 02F55F "LDD #$04,U; STD #$0C,X" (U = bluebird_entries + 8 x parameter): the entry's x
local bluebird_start 02F55F t5 entry_x
# 02F58D "LDD #$19,X; SUBD #$0020; STD #$19,X": gravity
local bluebird_land 02F590 t2 new_z_speed
# 02F5B7 "LDD #$0C,X; CMPD #$00E0; BCC"
local bluebird_sit 02F5B7 t5 screen_x
# 02F657 "LDU #$40,X", 02F65A "LDD #$0C,U; CMPD #$0160; BCC": waits for the scenery it sits on to come in
local bluebird_wait_launch 02F65A t5 scenery_x
# 02F6EA "LDD #$0A,X; ADDD #$0303; STD #$0A,X": both zooms 3 bigger
local bluebird_launch_fly 02F6ED t2 new_zoom
# 02F6D7 "LDA #$30,X; CMPA #$02" and 02F6E3 "LDA #$3B,X; CMPA #$30", both then 02F6F4 "CMPA #$08": the parameter, or for
# parameter 2 the timer, checked for 8
local bluebird_launch_fly 02F6D7,02F6E3 a parameter_or_timer
# 02F71A "LDU #$40,X", 02F72B "LDD #$0C,U; CMPD #$3E,X": the scenery's x against the one it leaves at
local bluebird_sit_on_scenery 02F72B t5 scenery_x
# done: objects/bluebird.c
# done: objects/kent_brockman.c

# ======== objects/krusty_balloon.c ========
# 0265B2 "LDD #$0C,X; CMPD #$00D0; BLE": right of 208 it flies off to the left
local krusty_balloon_beaten 0265B2 t5 screen_x
# 026563 "LDA $184E; BEQ": set by player_run_all when all four stand idle at a stage's end (038088 "STA $184E")
local krusty_balloon_wait_for_players 026563 t1 players_idle
# 0265E8 "LDD #$0C,X; CMPD #$0040; BLT ... CMPD #$017F; BGT", 0265F6 "LDD #$0F,X; NEGD; STD #$0F,X": turned back at the
# screen's edges
local krusty_balloon_fly_up 0265E8 t5 screen_x
local krusty_balloon_fly_up 0265F9 t2 reversed_x_speed
# 026633 "LDD #$0100; ADDD <$B2; STD #$11,X": comes in 256 below the camera's top
local krusty_balloon_appear 026636 t6 appear_y
# 0267CC "LDD #$0C,X; SUBD #$00E0; ABSD; CMPD #$0010": within 16 of the screen's middle
local krusty_balloon_volley_take_position 0267CC t5 screen_x
local krusty_balloon_volley_take_position 0267CF t2 x_difference
local krusty_balloon_volley_take_position 0267D2 t1 signed_x_difference
local krusty_balloon_volley_take_position 0267D2 t3 x_distance
# 0267DC "LDD #$0100; ADDD <$B2; CMPD #$11,X": the y it takes for the volley, against its own
local krusty_balloon_volley_take_position 0267DF t6 volley_y
local krusty_balloon_volley_take_position 0267E2 t5 own_y
# 02689D "LDD #$00FF; SUBD <$B2; STD #$11,X": the y it stomps from
local krusty_balloon_volley_shrink 0268A0 t6 stomp_y
# 0268E6 "LDD #$11,X; CMPD #$0090; BGE": kept at 144 or lower
local krusty_balloon_stomp_land 0268E6 t5 own_y
# 02693A "LDU #$2B,X" (the target: 02693D "LDA ,U" flags, 026942 "LDA #$02,U" state, 02694B "SUBD #$11,U" y,
# 026958 "SUBD #$0C,U" x), then 026C24 "LBSR $867D" (vector_find_free_slot: the attack object, 026C2B "STA #$01,U",
# 026C31 "STD #$0C,U", 026C37 "STD #$11,U", 026C3D "STD #$16,U", 026C40 "STU #$38,X"): an object either way
local krusty_balloon_check_over_target 02693A,026C24 u other_object object
# 026942 "LDA #$02,U; LBMI": the target's state (negative: down)
local krusty_balloon_check_over_target 026942 t3 target_state
# 026948 "LDD #$11,X; SUBD #$11,U; BMI; CMPD #$0010; BGT": no more than 16 below the target
local krusty_balloon_check_over_target 026948 t5 own_y
local krusty_balloon_check_over_target 02694B t5 target_y
local krusty_balloon_check_over_target 02694B t7 y_difference
# 026955 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$0040 ... CMPD #$0010": 16 to 64 to the side of the target
local krusty_balloon_check_over_target 026955 t5 own_x
local krusty_balloon_check_over_target 026958 t5 target_x
local krusty_balloon_check_over_target 026958 t7 x_difference
local krusty_balloon_check_over_target 02695B t1 signed_x_difference
local krusty_balloon_check_over_target 02695B t3 x_distance
# 026C2E "LDD #$0C,X; STD #$0C,U", 026C34 "LDD #$11,X; STD #$11,U": the attack object put where the balloon is
local krusty_balloon_check_over_target 026C2E t5 attack_x
local krusty_balloon_check_over_target 026C34 t5 attack_y
# 02696B "LDU #$7CB6; ASLA; LDD A,U; ORB #$80; STD #$04,X": the kind (A) and animation (B) of the number
local krusty_balloon_set_animation 02696F t4 kind_with_animation
# 02697A "LDU #$7CD0; ASLA x3; LEAU A,U", 026982/02698A/02698F "LDD ,U++": the hit box record and the cursor
# through its words
local krusty_balloon_set_hit_box 026982 t1 box_record
local krusty_balloon_set_hit_box 02698A t1 box_cursor
local krusty_balloon_set_hit_box 02698F t1 box_cursor_2
# 02699B "LDU #$2B,X", 02699E "LDD #$0C,X; CMPD #$0C,U; BGT": which side of its target it is
local krusty_balloon_aim 02699E t5 own_x
local krusty_balloon_aim 0269A1 t5 target_x
# 0269FE "LDD #$0C,X; STD #$0C,U", 026A04 "LDD #$11,X; STD #$11,U": the shot put where the balloon is
local krusty_balloon_throw 0269FE t5 balloon_x
local krusty_balloon_throw 026A04 t5 balloon_y
# 026A55 "LDB <$58; SEX; ROLB; ASLA; ADDD #$0F,U; STD #$0F,U": a random -256..254 added to the shot's x speed
local krusty_balloon_throw_spread 026A58 t1 signed_random
local krusty_balloon_throw_spread 026A5B t7 spread_x_speed
# 026A61 "LDY #$7D28; ... LDD B,Y; LDB <$58; NEGD; STD #$14,U": an upward y speed from the table, random fraction
local krusty_balloon_throw_spread 026A6F t2 spread_y_speed
# 026A7F "LDA #$35,X; CMPA #$04; BNE": the wobble's step after it ran (4: over)
local krusty_balloon_wobble 026A7F t3 wobble_step
# 026B92 "LDA #$07; LBSR $6969" (krusty_balloon_set_animation: number 7), 026B97 "CLRA; LBSR $6978"
# (krusty_balloon_set_hit_box: box 0)
local krusty_balloon_hit 026B94,026B98 d look_numbers
# 026BF7 "LDU #$25,X", 026BFA "LDD #$0C,X; CMPD #$0C,U; BGT": knocked away from the one that hit it
local krusty_balloon_hit 026BFA t5 own_x
local krusty_balloon_hit 026BFD t5 hitter_x
# 026C86 "LDD #$0C,X; CMPD #$00E0; BLE": right of the screen's middle it flies off to the left
local krusty_balloon_hit 026C86 t5 screen_x
# 026D01 "LDD #$0D,X; ADDD #$0F,X; STD <$F1", 026D0A "LDB #$0F,X; SEX; ADCA #$0C,X; STA <$F0", 026D14 "LDD <$F1; ADDD
# <$AD": the next x (low byte and fraction, then the high byte) on the stage, kept within 0770-08DF
local krusty_balloon_keep_in_arena_x 026D01 t5 x_low_and_fraction
local krusty_balloon_keep_in_arena_x 026D0E t3 x_high
local krusty_balloon_keep_in_arena_x 026D17 t4 camera_x_low_and_fraction
# 026D3E "LDD #$12,X; ADDD #$14,X; STD <$F1", 026D47 "LDB #$14,X; SEX; ADCA #$11,X; STA <$F0", 026D51 "LDD <$F1; SUBD
# <$B3; STD <$F1": the next y on the screen, kept within 61-FF
local krusty_balloon_keep_in_arena_y 026D3E t5 y_low_and_fraction
local krusty_balloon_keep_in_arena_y 026D41 t6 old_y_low_and_fraction
local krusty_balloon_keep_in_arena_y 026D41 t7 next_y_low_and_fraction
local krusty_balloon_keep_in_arena_y 026D4B t3 y_high
local krusty_balloon_keep_in_arena_y 026D51 t4 stage_y_low_and_fraction
local krusty_balloon_keep_in_arena_y 026D54 t4 camera_y_low_and_fraction
local krusty_balloon_keep_in_arena_y 026D54 t5 next_stage_y_low
local krusty_balloon_keep_in_arena_y 026D54 t6 screen_y_low_and_fraction
# done: objects/krusty_balloon.c

# ======== objects/krustyland_bear.c ========
# 02F2C2 "LDD <$AC; CMPD #$0420; BCS": waits for the camera
local krustyland_bear_wait_camera 02F2C2 t4 camera_position
# 02F355 "LDD #$0C,X; CMPD #$0130; BCC", 02F35D "LDD #$11,X; CMPD #$0120; BCC": near the screen's left and top
local caged_gorilla_idle 02F355 t5 screen_x
local caged_gorilla_idle 02F35D t5 own_y
# done: objects/krustyland_bear.c

# ======== objects/marge_cloud.c ========
# 03D6ED "LDU #$0C,X; CMPU #$0040; BGE": gone past the screen's left edge
local marge_cloud 03D6ED t5 screen_x
# 03D71A "LDD <$AC; ADDD #$0060; ADDD #$0C,X; STD #$33,X": the stage's x 96 ahead of where it starts
local marge_cloud_start 03D71A t4 camera_position
local marge_cloud_start 03D71D t2 camera_ahead
local marge_cloud_start 03D720 t5 screen_x
local marge_cloud_start 03D720 t7 wander_end
# 03D748 "LDD <$AC; ADDD #$0C,X; CMPD #$33,X; BLE": its x on the stage against where it stops wandering
local marge_cloud_wander 03D748 t4 camera_position
local marge_cloud_wander 03D74B t5 screen_x
local marge_cloud_wander 03D74B t7 world_x
# 03D7A5 "LDA #$0D,X; SUBA #$40; ANDA #$78; CMPA ,S+": its x's low byte against the frame count's
local marge_cloud_idle 03D7A5 t3 x_low
# done: objects/marge_cloud.c

# ======== objects/object_lists.c ========
# 07CB4E "LDA $1876; STA $1880": last frame's count of enemies kept in 1880
local run_enemies 07CB4E t1 enemies_last_frame
# 07CB56 "CLR $1876", 07CB5A "CLR $1883", 07CB5E "CLR $1878": the clears read first (the enemies in play, the
# enemies with field 57 clear, the walk delays in turn)
local run_enemies 07CB56 t1 old_enemy_count
local run_enemies 07CB5A t1 old_entered_count
local run_enemies 07CB5E t1 old_walk_delays
# 07CB84 "LDA #$42,X; BMI", 07CB89 "INC $1876": the enemies counted so far this frame
local run_enemies 07CB89 t1 enemies_so_far
# 07CB8D "LDA #$57,X; BNE", 07CB92 "INC $1883": those done with their entrance
local run_enemies 07CB92 t1 entered_so_far
# 07CB9F "CLR $1879", 07CBC5 "INC $1879": list 1's objects counted (nothing reads 1879)
local run_list_1_objects 07CB9F t1 old_list_1_count
local run_list_1_objects 07CBC5 t1 list_1_count
# 07CBD2 "CLR $187A", 07CBF8 "INC $187A": the child objects counted
local run_child_objects 07CBD2 t1 old_child_count
local run_child_objects 07CBF8 t1 child_count
# 07CC38 "LDD #$7F04" (B = 4), 07CC56 "DBJNZ $CC40": the players left before the decrement
local find_least_attacked_player 07CC56 t1 players_to_check
# 07CC5A "LDA $1876; CMPA #$10": 16 enemies or more, 4 after each player
local share_out_attackers 07CC5A t1 enemy_count
# 07CC69 "LDB $1876", 07CC6D "LDA $1874; BEQ", 07CC73 "DECA; BNE": the enemies and the players in the game
local share_out_attackers 07CC69 t1 enemies_now
local share_out_attackers 07CC6D t1 players_now
local share_out_attackers 07CC73 t1 players_counted
# done: objects/object_lists.c

# ======== objects/object_setup.c ========
# 07D182 "LDD #$5C,X; ADDD #$0007; STD <$E8", 07D18B "LDD #$16,X; CMPD <$E8; BHI": lands within 7 of its floor
local cap_fall_and_land 07D185 t2 landing_z
# 07D1D4 "LDD #$0C,X; SUBD #$0010; CMPD #$01A0; BCS": stopped beyond the screen's edges
local stop_beyond_screen_edge 07D1D4 t5 screen_x
# 07D1FC "LDD #$0C,X; CMPD #$01C0; BCS"
local enemy_remove_off_screen 07D1FC t5 screen_x
# 07D216 "LDD #$0C,X; SUBD #$0050; CMPD #$0120"
local enemy_on_screen 07D216 t5 screen_x
# done: objects/object_setup.c

# ======== objects/obstacles.c ========
# 02C084 "LBSR $6CE8": obstacle_restore_floor hands back the floor map's place it wrote last (02CD08 "LDU #$38,X;
# ... LEAU B,U")
local cemetery_obstacle_break 02C084 u floor_place
# 02C0CF "LDD #$11,X; SUBD #$0002; STD #$11,X": 2 up
local cemetery_obstacle_start 02C0CF t5 old_y
local cemetery_obstacle_start 02C0D2 t2 new_y
# 02C0FF "LDU #$7B58; LDA #$30,X; ASLA; LDD A,U; STD #$0C,X": cemetery_obstacle_xs by the parameter
local cemetery_obstacle_start 02C106 t4 entry_x
# 02C10F "LDD #$0C,X; CMPD #$0160; BCC": waits until on the screen
local cemetery_obstacle_raise_floor 02C10F t5 current_x
# 02C125 "LBSR $6CE8": obstacle_restore_floor's floor place
local cemetery_obstacle_wait_boss 02C125 u floor_place
# 02C17F "LDD #$11,X; SUBD #$0002; STD #$11,X": 2 up (new_y is the byte B the floor raise takes)
local heavy_obstacle_start 02C17F t5 old_y
local heavy_obstacle_start 02C182 t2 moved_y
# 02C18A "LBSR $6C4A": obstacle_raise_floor hands back the floor map's place in U (02CC82 "LEAU B,U")
local heavy_obstacle_start 02C18A u floor_place
# 02C21A "LDY #$7AD8; LBSR $85B4": the smashed hit box handed to vector_set_hit_box (Y as it came otherwise)
local timed_throwable_fall 02C21A y box
# 02C532 "CLRA; LDB <$F1; ANDB #$0F; ASLDI #$03; CMPD #$16,X; BCC": the floor ahead's height (8 per step)
local carried_obstacle_check_floor 02C538 t2 height_ahead
# 02CB5C "CLRA; LDB <$F1; ANDB #$0F; ASLDI #$03; CMPD #$16,X; BCC"
local throwable_follow_floor 02CB62 t2 height_ahead
# 02CBAD "LDD #$0C,X; CMPD #$0180; BCC": waits until on the screen
local obstacle_start 02CBAD t5 screen_x
# 02CBB5 "LDD #$11,X; SUBD #$0002; STD #$11,X": 2 up (new_y is the byte B the floor raise takes)
local obstacle_start 02CBB5 t5 old_y
local obstacle_start 02CBB8 t2 moved_y
# 02CC2D "LDU #$25,X", 02CC30 "LDD #$0C,U; CMPD #$0C,X; BCS": knocked away from the one that hit it
local obstacle_knocked 02CC30 t5 hitter_x
local obstacle_knocked 02CC33 t5 own_x
# 02CC8B "LDA #$40,U; CMPA #$33,X": the floor cell a row below must be the same too
local obstacle_raise_floor 02CC8B t3 cell_below
# 02CC94 "DEC <$F4; BNE": floor_columns_left before the decrement (3 columns checked)
local obstacle_raise_floor 02CC94 t2 columns_to_check
# 02CCA1 "LDA #$33,X; ANDA #$0F; ADDA $188B": the raise asked for (02CC4A "STA $188B")
local obstacle_raise_floor 02CCA6 t1 raise_height
# 02CCB8 "DEC <$F4; BNE": the 3 columns raised
local obstacle_raise_floor 02CCB8 t2 columns_to_raise
# 02CD12 "DEC <$F4; BNE": the 3 columns put back
local obstacle_restore_floor 02CD12 t2 columns_to_restore
# 02CD49 "LBSR $6CE8": obstacle_restore_floor's floor place, handed back
local obstacle_pick_up 02CD49 u floor_place
# 02CD59 "ANDA #$0F; ASLA x3; CMPA #$17,X; BCS": the floor's height against its height's low byte
local obstacle_throw 02CD5E t3 z_low
# 02D60D "LDD #$02,U; STD #$0C,X" (U = dreamland_obstacle_drops + 4 x parameter): the entry's x
local dreamland_obstacle_start 02D60D t5 entry_x
# 02D674 "LDY #$7A98; LBSR $85B4": the settled hit box handed to vector_set_hit_box (Y as it came otherwise)
local dreamland_obstacle_settle 02D674 y box
# done: objects/obstacles.c

# ======== objects/police_car.c ========
# 02C41E "LDA ,U; CMPA $1874; BHI": the players in the game (07C994 "LDA <$57; STA $1874") against the door's
local police_car_door_start 02C420 t1 players_now
# 02C426 "CLRA; LDB #$01,U; ASLDI #$04; STD #$3E,X": the door's x in 16s
local police_car_door_start 02C42A t2 trigger_at_x
# 02C442 "LDA $1884; BEQ": set when the police car stops (02B489 "STA $1884")
local police_car_door_wait_car 02C442 t1 car_stopped
# 02C465 "LDA ,Y+; CMPA #$7F; BEQ": the release record read, the cursor moved on
local police_car_door_open 02C465 t1 release_record
# 02C46B "CMPA $1874; BCC": the players in the game
local police_car_door_open 02C46B t1 players_now
# done: objects/police_car.c

# ======== objects/robot_scrap.c ========
# 032A18 "CLRA; LDB <$F1; ANDB #$0F; ASLDI #$03; CMPD #$16,X; BCC": the floor ahead's height
local robot_scrap_keep_on_floor 032A1E t2 height_ahead
# done: objects/robot_scrap.c

# ======== objects/running_animal.c ========
# 02D393 "LDA #$2D,X; INCA; STA #$05,X": the look's animation (field 2D, the low byte of look)
local running_animal_knocked 02D393 t3 look_animation
# 02D3B9 "LDD #$0A,X; SUBD #$0101; CMPD #$2020; BCS": both zooms 1 smaller, down to 20
local running_animal_knocked_away 02D3BC t2 smaller_zoom
# 02D40F "LDA #$2C,X; STA #$04,X": the look's kind (field 2C)
local running_animal_knocked_back 02D40F t3 look_kind
# 02D420 "LDD #$0C,X; CMPD #$00E0; BCC"
local running_animal_knocked_back 02D420 t5 screen_x
# 02D47F "LDD #$0C,X; CMPD #$00E0; BCS"
local running_animal_start 02D47F t5 screen_x
# 02D4CB "LDA #$2C,X; STA #$04,X"
local running_animal_stop 02D4CB t3 look_kind
# 02D4F9 "LDA #$2D,X; STA #$05,X"
local running_animal_picked_up 02D4F9 t3 look_animation
# 02D51E "LDA #$2D,X; INCA; STA #$05,X"
local running_animal_thrown 02D51E t3 look_animation
# 02D531 "LDA #$2C,X; STA #$04,X", 02D541 "LDD #$11,X; ADDD #$0002; STD #$11,X": 2 down
local running_animal_land 02D531 t3 look_kind
local running_animal_land 02D541 t5 old_y
local running_animal_land 02D544 t2 new_y
# done: objects/running_animal.c

# ======== objects/scenery_bank_15.c ========
# 02AF55 "CLRA; ASLDI #$04; STD #$3E,X": the door's x in 16s
local krustyland_door_start 02AF56 t2 trigger_at_x
# 02AF7F "LDA $1876; CMPA #$04; BLS": opens with 4 enemies or fewer in play
local krustyland_door_open 02AF7F t1 enemies
# 02B0CF "CLRA; ASLDI #$04; STD #$3E,X": the x it leaves at, in 16s
local prop_start 02B0D0 t2 leave_at_x
# 02B0D9 "LDD #$0C,X; CMPD #$3E,X; BCC"
local prop_leave 02B0D9 t5 screen_x
# 02B131 "LDD #$0C,X; CMPD #$0020; BCC"
local poster_pair_leave 02B131 t5 screen_x
# done: objects/scenery_bank_15.c

# ======== objects/scenery_bank_17.c ========
# 02F78C "LDU #$2A,X": the figure's 4 poses in random_figure_poses (its field 2A points at them), 02F797 "LDA A,U"
# the 4 animation numbers of a figure in random_figure_poses, read through the pointer in its field 2A (02F797 "LDA
# A,U; ORA #$80; STA #$05,X")
elements figure_pose u8
local random_pose_figure_pose 02F78C u figure_poses figure_pose
# 02F78F "LDA <$58; ADDA #$0D,X; ANDA #$03": the random number plus its x's low byte picks the pose
local random_pose_figure_pose 02F792 t3 x_low
# 02F7D8 "LDD #$2E,X; ADDD #$2C,X; CMPD #$0040; BCC": the target's distance (dy + dx)
local unused_homer_object_wait_near 02F7DB t7 target_distance
# done: objects/scenery_bank_17.c

# ======== objects/scripted_object.c ========
# 03DB61 "LDD #$0C,X; CMPD #$01A0; BHI ... CMPD #$0020; BGE": removed beyond the screen's edges
local scripted_object 03DB61 t5 screen_x
# 03DB90 "LDD #$36,X; ADDD #$0F,X; STD #$0F,X" (and 38/14, 3A/19): the speeds with the accelerations added
local scripted_object 03DB93 t7 new_x_speed
local scripted_object 03DB9C t7 new_y_speed
local scripted_object 03DBA5 t7 new_z_speed
# 03DBCE "TFR A,B; SEX; STD #$5C,X": the floor's height ahead as its floor
local scripted_object 03DBD0 t1 new_floor_z
# 03DBD4 "LDD #$42,X; BEQ", 03DBD9 "CMPD #$0C,X; BLT": waits until its x reaches wait_x
local scripted_object 03DBD9 t5 current_x
# 03DBE3 "LDB #$3C,X; BMI", 03DBF0 "SEX; CMPD #$16,X; BLT; STD #$16,X": the floor it lands on, as a height
local scripted_object 03DBF0 t1 landing_z
# 03DC18 "LDY #$32,X", 03DC1B "LDA ,Y+; ASLA; LDU #$7FAA; JMP [A,U]": the script's next command byte
local scripted_object 03DC1B t1 command_place
# 03DC23 "LDA ,Y+; STA #$09,X; LBRA $7C1B": the operand, then the next command (03DC1B "LDA ,Y+")
local scripted_object_set_attributes 03DC23 t1 operand_place
local scripted_object_set_attributes 03DC1B t1 command_place
# 03DC2B "LDA ,Y+; STA #$34,X; STY #$32,X"
local scripted_object_wait 03DC2B t1 operand_place
# 03DC38 "LDD ,Y++; STD #$04,X": the kind (A) and animation (B)
local scripted_object_set_kind 03DC38 t1 operand_place
local scripted_object_set_kind 03DC38 t4 kind_with_animation
local scripted_object_set_kind 03DC1B t1 command_place
# 03DC40 "LDA ,Y+; STA #$05,X"
local scripted_object_set_animation 03DC40 t1 operand_place
local scripted_object_set_animation 03DC1B t1 command_place
# 03DC48 "LDD ,Y++; STD #$0C,X", 03DC4D "LDD ,Y++; ADDD <$B2; STD #$11,X", 03DC55 "LDD ,Y++; STD #$16,X"
local scripted_object_set_place 03DC48 t1 x_place
local scripted_object_set_place 03DC4D t1 y_place
local scripted_object_set_place 03DC55 t1 z_place
local scripted_object_set_place 03DC1B t1 command_place
# 03DC5D/03DC62/03DC67 "LDD ,Y++; STD #$0F,X / #$14,X / #$19,X"
local scripted_object_set_speeds 03DC5D t1 x_speed_place
local scripted_object_set_speeds 03DC62 t1 y_speed_place
local scripted_object_set_speeds 03DC67 t1 z_speed_place
local scripted_object_set_speeds 03DC1B t1 command_place
# 03DC6F/03DC74/03DC79 "LDD ,Y++; STD #$36,X / #$38,X / #$3A,X"
local scripted_object_set_accelerations 03DC6F t1 x_acceleration_place
local scripted_object_set_accelerations 03DC74 t1 y_acceleration_place
local scripted_object_set_accelerations 03DC79 t1 z_acceleration_place
local scripted_object_set_accelerations 03DC1B t1 command_place
# 03DC89 "LBRA $7C1B"
local scripted_object_toggle_airborne 03DC1B t1 command_place
# 03DC8C "LDA ,Y+; STA #$5B,X"
local scripted_object_set_shadow 03DC8C t1 operand_place
local scripted_object_set_shadow 03DC1B t1 command_place
# 03DC94 "LDA ,Y+; STA #$3C,X; STY #$32,X"
local scripted_object_wait_landing 03DC94 t1 operand_place
# 03DC9D "LDD ,Y++; TST #$30,X; BMI; PUSHS Y; LBSR $8680": the sound command (vector_queue_sound)
local scripted_object_play_sound 03DC9D t1 operand_place
local scripted_object_play_sound 03DC9D t4 sound_word
local scripted_object_play_sound 03DC1B t1 command_place
# 03DCAE "LDA ,Y+": the zoom
local scripted_object_set_zoom 03DCAE t1 operand_place
local scripted_object_set_zoom 03DC1B t1 command_place
# 03DCC1 "LDA ,Y+": the zoom step
local scripted_object_set_zoom_step 03DCC1 t1 operand_place
local scripted_object_set_zoom_step 03DC1B t1 command_place
local scripted_object_stop 03DC1B t1 command_place
# 03DCDE "LDD ,Y++": the x it waits for
local scripted_object_wait_x 03DCDE t1 operand_place
# done: objects/scripted_object.c

# ======== objects/shaking_scenery.c ========
# 02D166 "LDU #$25,X", 02D169 "LDD #$16,U; SUBD #$5C,X; CMPD #$0050; BCS": the hitter at least 80 above its floor
local shaking_scenery_check_hit_from_above 02D16C t7 height_above_floor
# 02D189 "LDA #$30,X; BPL", 02D18E "ANDA #$7F; BEQ; STA #$30,X": the parameter without bit 7
local shaking_scenery_start 02D18E t2 masked_parameter
# 02D20F "LDD #$11,X; SUBD #$0002; STD #$11,X": 2 up
local shaking_scenery_start 02D20F t5 old_y
local shaking_scenery_start 02D212 t2 new_y
# 02D215 falls into 02D218 (scenery_block_floor), which hands back the floor map's place it wrote last
local shaking_scenery_start 02D215 u floor_place
# 02D256 "DEC <$F4; BNE": floor_columns_left before the decrement (3 columns blocked)
local scenery_block_floor 02D256 t2 columns_to_block
# 02D30E "LDY #$7ED5; LBSR $862C" (the food's child record), then 02D316 "LDY #$3E,X" (the scenery's food pattern,
# 02D326 "LDB A,Y"): both the food's data, handed back in Y
local shaking_scenery_drop_food 02D30E,02D316 y food_data
# done: objects/shaking_scenery.c

# ======== objects/spawning.c ========
# 07C95B "CLR $1876": the clear reads first
local start_stage_objects 07C95B t1 old_enemy_count
# 07C985 "LDU #$EFD4; CLRA; LDB <$61; LDB B,U; ASLDI #$01; STD $1886": the enemies' speed by the rank, doubled
local spawn_stage_objects 07C98E t2 enemies_speed
# 07C9D8 "LDD <$AC; ADDD #$0150; CMPD #$00,X; BCS": an object comes in when the camera is 336 short of it
local spawn_stage_objects 07C9D8 t4 camera_position
local spawn_stage_objects 07C9DB t2 spawn_edge
# 07C9C1 "LDD <$B8; CMPD #$00,X; BCS": in the cemetery by its scroll (direct page B8)
local spawn_stage_objects 07C9C1 t4 scroll_position
local spawn_stage_objects 07C9C4 t5 spawn_place
local spawn_stage_objects 07C9C4 t6 compared_scroll
# 07CA04 "LDD #$00,X; SUBD <$AC; ADDD #$0040; STD #$0C,U": the spawn's place on the stage made a screen x
local spawn_stage_objects 07CA04 t5 spawn_stage_x
local spawn_stage_objects 07CA07 t6 camera_offset
local spawn_stage_objects 07CA0A t2 spawn_screen_x
# 07CA10 "LDA #$04,X; BPL", 07CA15 "LDD #$0C,U; SUBD #$0160; STD #$0C,U": bit 7 of its flags puts it in from the left
local spawn_stage_objects 07CA15 t5 placed_x
local spawn_stage_objects 07CA18 t2 left_side_x
# 07CA21 "LDB #$02,X; SEX; ASLDI #$03; NEGD; ADDD <$B2; ADDD #$0190; STD #$11,U": its height (8 pixels a step up from
# the floor line, struct spawn's y) made its y
local spawn_stage_objects 07CA21 t3 height_steps
local spawn_stage_objects 07CA24 t1 signed_steps
local spawn_stage_objects 07CA25 t2 height_pixels
local spawn_stage_objects 07CA27 t2 negated_height
local spawn_stage_objects 07CA28 t6 height_on_screen
local spawn_stage_objects 07CA2B t2 spawn_y
# 07CA5A "LDU #$EFF8; LDU B,U" (object_lists), 07CA5F "LDB #$00,U; BNE", 07CA64 "LDD #$59,U", 07CA7D "STB #$00,U",
# 07CA82 "LEAU #$60,U": the slot looked at is an object (its flags, its sprites)
local take_free_object 07CA5D,07CA73,07CA82 u slot_object object
# 07CA85 "DECA; BNE $CA5F": slots_left before the decrement
local take_free_object 07CA85 t1 slots_to_check
# 07CA64 "LDD #$59,U; STD <$E8", 07CA75 "LDD <$E8; STD #$59,U": the slot's sprites kept over the clearing
local take_free_object 07CA64 t5 kept_sprites
local take_free_object 07CA75 t4 restored_sprites
# 07CA8A "LDB #$05,Y; LBSR $CA54": the child record's list handed to take_free_object (B)
local spawn_child_object 07CA8D d list_number
# 07CAC9 "LDD <$E8; ADDD #$0C,X; STD #$0C,U": the child's x off the parent's (the offset turned with it)
local place_child_object 07CAC9 t4 offset_from_parent
local place_child_object 07CACC t5 parent_place_x
local place_child_object 07CACC t7 child_x
# 07CAD2 "LDD #$02,Y; ADDD #$11,X; STD #$11,U", 07CADB "CLRA; LDB #$04,Y; ADDD #$16,X; STD #$16,U"
local place_child_object 07CAD5 t5 parent_place_y
local place_child_object 07CAD5 t7 child_y
local place_child_object 07CADF t7 child_z
# 07CAEF "LDA $189C; BEQ": set, both scrolls are held (07CAF5 "LDD #$0101; STD <$A7")
local check_enemy_limit 07CAEF t1 hold_scrolls
# 07CB06 "LDU #$F000; LDA <$6B; LDA A,U; STA $1885", 07CB1A "ADDA $1885": the limit by difficulty plus the scene's
local check_enemy_limit 07CB1A t1 difficulty_limit
# 07CB2C "CMPA $1876; BCC": the enemies in play against the limit (A)
local hold_scroll_over_enemy_limit 07CB2C t1 enemies
local hold_scroll_over_enemy_limit 07CB2C t2 limit_value
# 07CB37 "CMPA $1876"
local compare_enemy_limit 07CB37 t1 enemies
# done: objects/spawning.c

# ======== objects/speech_balloon.c ========
# 0219F9 "LDU #$29,X", 0219FC "LDD #$0C,U; SUBD #$0020; STD #$0C,X", 021A05 "LDD #$11,U; SUBD #$0002; STD #$11,X": put
# by the speaker
local speech_balloon_start 0219FC t5 speaker_x
local speech_balloon_start 021A05 t5 speaker_y
# done: objects/speech_balloon.c

# ======== objects/stage_3_boss.c ========
# 03D230 "LDY $1852; LDA #$01; STA #$2A,Y": the marker object kept in 1852
local stage_3_boss_enter 03D230 t3 stored_marker
# 03D24D "LDY $1852; CLR #$2A,Y"
local stage_3_boss_arrive 03D24D t3 stored_marker
# 03D2D7 "LDU #$34,X", 03D2DA "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$004A", 03D2E7 the same for y (#$0012)
local stage_3_boss_together 03D2DA t5 own_x
local stage_3_boss_together 03D2DD t5 target_x
local stage_3_boss_together 03D2E7 t5 own_y
local stage_3_boss_together 03D2EA t5 target_y
# 03D30E "LDU #$34,X", 03D311 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$003A", 03D31D the same for y (#$000A)
local stage_3_boss_walk 03D311 t5 own_x
local stage_3_boss_walk 03D314 t5 target_x
local stage_3_boss_walk 03D31D t5 own_y
local stage_3_boss_walk 03D320 t5 target_y
# 03D33E "LDY #$0C,X; CMPY #$0C,U; BGE": faces its target
local stage_3_boss_attack_or_wait 03D33E t5 own_x
local stage_3_boss_attack_or_wait 03D341 t5 target_x
# 03D385 "LDY #$0C,X; CMPY #$0C,U; BGE": which side its target is
local stage_3_boss_move 03D385 t5 own_x
local stage_3_boss_move 03D388 t5 target_x
# 03D3CF "LDD #$0F,X; ADDD #$0F,X; STD #$0F,X": the walk speed doubled
local stage_3_boss_move 03D3D2 t7 doubled_x_speed
# 03D3F4 "LDU #$41,X; CLRW #$0F,U; CLRW #$14,U; CLRW #$19,U" (the partner stopped) and 03D403 "LDU #$34,X; LDA #$02,U"
# (the target's state): an object either way (03D431 "LDU #$0580" is a speed for stage_boss_knock_away)
local stage_3_boss_attack 03D3F4,03D403 u other_object object
# 03D406 "LDA #$02,U; CMPA #$01": the target's state
local stage_3_boss_attack 03D406 t3 target_state
# 03D437 "INC #$17,X": its height's low byte, one up
local stage_3_boss_attack 03D437 t3 z_low
# 03D4B3 "LDY #$41,X; LDA #$2E,Y; CMPA #$13; BLT": the partner, the other boss, and its phase
local stage_3_boss_knocked 03D4B3 y partner_boss object.stage_3_boss
local stage_3_boss_knocked 03D4B6 t3 partner_phase
# 03D4F0 "LDY #$41,X; TST #$00,Y" (the partner) and 03D500 "LDY $1852; STA #$2A,Y" (the marker): objects
local stage_3_boss_defeated 03D4F0,03D500 y other_object object
local stage_3_boss_defeated 03D500 t3 stored_marker
# 03D54F "LDU #$41,X; LDD #$16,U; BNE": the partner (its height); the web also takes speeds for stage_boss_knock_away
# (03D5FD "LDU #$0500") and what the calls hand back
local stage_3_boss_update 03D54F u other_object object
local stage_3_boss_update 03D552 t5 partner_z
# 03D537, 03D54A (what the calls leave), 03D552 "LDD #$16,U" (the partner's height's low byte), 03D579 "LDB #$80": B,
# whose value only ends as the low byte of D in 03D5B7/03D5DC "LDA #$85; LBSR $604C" (stage_boss_set_state takes A)
local stage_3_boss_update 03D537,03D54A,03D552,03D579 b ignored_low_byte
# 03D5B7 "LDA #$85; LBSR $604C", 03D5DC "LDA #$85; LBSR $604C": the hurt animation in A
local stage_3_boss_update 03D5B9,03D5DE d hurt_animation
# 03D5A3 "TST #$43,X; BNE": still joined with its partner
local stage_3_boss_update 03D5A3 t3 still_together
# 03D5BD "LDU #$0C,X; LDY #$11,X; PUSHS X; LDX #$41,X; STU #$0C,X; STY #$11,X": the partner put where it is
local stage_3_boss_update 03D5BD t5 boss_x
local stage_3_boss_update 03D5C0 t5 boss_y
local stage_3_boss_update 03D5C5 t5 partner_address
# 03D615 "LDU #$41,X", 03D618 "LDD #$0C,X; SUBD #$000A; CMPD #$0C,U; BGE; ADDD #$0014; CMPD #$0C,U; BLE": the partner
# within 10 of it, and the same for y (03D62B)
local stage_3_boss_reach_partner 03D618 t5 own_x
local stage_3_boss_reach_partner 03D61E t5 partner_x
local stage_3_boss_reach_partner 03D626 t5 partner_x_2
local stage_3_boss_reach_partner 03D62B t5 own_y
local stage_3_boss_reach_partner 03D631 t5 partner_y
local stage_3_boss_reach_partner 03D639 t5 partner_y_2
# done: objects/stage_3_boss.c

# ======== objects/stage_4_figures.c ========
# 031311 "LDD #$0C,X; CMPD #$0120; BCC"
local walking_kind_87_wait 031311 t5 screen_x
# 0313EA "LDD <$AC; CMPD #$0238; BCS": waits for the camera
local moe_wait_for_scroll 0313EA t4 camera_position
# 03141E "LDD #$0C,X; CMPD #$0100; BCS", 031431 "LDD <$AC; CMPD #$0340; BCS"
local moe_walk_right 03141E t5 screen_x
local moe_walk_right 031431 t4 camera_position
# 031471 "LDD <$AC; CMPD #$0340; BCS", 03149B "LDD #$0C,X; CMPD #$00E0; BCC ... CMPD #$0100"
local moe_pace 031471 t4 camera_position
local moe_pace 03149B t5 screen_x
# 0314CD "LDD #$0C,X; CMPD #$0030; BCC"
local moe_remove_at_edge 0314CD t5 screen_x
# 03150D "LDA $187F; BEQ": set by the kind 0F object of 02D7A2 "STA $187F"
local belly_dancer_watcher_wait_signal 03150D t1 watch_signal
# 0315CA "LDD <$AC; CMPD #$0270; BCS"
local barney_bystander_pose 0315CA t4 camera_position
# 031659 "LDU #$40,X", 031664 "LDD #$0C,X; STD #$0C,U", 03166A "LDD #$11,X; SUBD #$0004; STD #$11,U", 031673 "LDD
# #$16,X; ADDD #$0040; STD #$16,U": the goon it carries held over it
local woman_in_green_carrier_carry 031664 t5 carrier_x
local woman_in_green_carrier_carry 03166A t5 carrier_y
local woman_in_green_carrier_carry 03166D t2 goon_y
local woman_in_green_carrier_carry 031676 t2 goon_z
# done: objects/stage_4_figures.c

# ======== objects/stage_7_boss.c ========
# 022E5C "LDA #$40; STA #$2A,X; STU #$2B,X" (stage_7_boss_pick_target keeps the nearest player found), 022DF2/0230B3
# "LDU #$2B,X; LDD #$0C,X; CMPD #$0C,U" / "LDA #$02,U" (stage_7_boss_approach), 022E65 "LDU #$2B,X" (stage_7_boss_aim),
# 022E46 "LDY #$2B,X; LDA #$00,Y; ... LDA #$02,Y" (stage_7_boss_pick_target): the player it goes after, a word at 2B as
# krusty_balloon's target (the C reads it today as halves of behaviour and target_dx)
scoped object stage_7_boss 2B target u16 object
# 022A90 "LDA <$16; ANDA #$01; RORA; RORA; ORA #$00,X": the frame's bit rotated once (into bit 7 on the second RORA)
local stage_7_boss_blink_out 022A95 t2 rotated_once
# 022AD5 "LBSR $85B1" (vector_apply_gravity): what it leaves in D, whose B only ends as the low byte of the animation
# number (022AF0 "LDA #$0B; LBSR $6E9E": stage_7_boss_set_animation takes A)
local stage_7_boss_fall 022AD5 d landing_result
# 022FDA "INC $187E": counts the boss down; ninja_update (0322BC "LDA $187E; BEQ") vanishes its ninjas once it is set
local stage_7_boss_fall 022FDA t1 ninja_vanish_signal
# 022B13 "LBSR $6FAC" (stage_7_boss_stand): U is left at the end of the hit box record (022EC7 "LDD ,U++"), which
# stage_7_boss_pick_target's search overwrites (022E40 "LBSR $8686")
local stage_7_boss_get_up 022B13 u box_end
local stage_7_boss_flinch_land 022B33 u box_end
local stage_7_boss_recover 022CF7 u box_end
local stage_7_boss_charge_end 022D72 u box_end
# 022FB1 "CLRA; LBSR $6EAD" (stage_7_boss_set_hit_box): what it leaves in U, handed back
local stage_7_boss_stand 022FB2 u box_end
# 022B54 "LDY #$7AD9; LDA <$F0; ASLA; ASLA; LEAY A,Y" (stage_7_boss_helper_starts by boss_helper_number), 022B5E "LDA
# ,Y+; STA #$05,U", 022B68 "LDD ,Y++; ADDD #$091F; SUBD <$AC; STD #$0C,U": the helper's start record and its x
local stage_7_boss_put_in 022B5E t1 helper_start_record
local stage_7_boss_put_in 022B68 t1 start_cursor
local stage_7_boss_put_in 022B68 t4 start_offset_x
local stage_7_boss_put_in 022B6A t2 helper_stage_x
local stage_7_boss_put_in 022B6D t6 helper_screen_x
# 022B73 "LDD #$00C8; ADDD <$B2; STD #$11,U": the helper's y
local stage_7_boss_put_in 022B76 t6 helper_y
# 022BAD "LDD #$096F; SUBD <$AC; STD #$0C,X": the boss's x
local stage_7_boss_put_in 022BB0 t6 boss_screen_x
# 022BD3 "LDU #$35,X; LDA #$03; STA #$02,U", 022BDB "LDU #$37,X; LDA #$01; STA #$02,U": its first two helpers set
# moving (helper_1, helper_2: objects; the loads fold into the stores, so the C writes mem_write8(helper + 2u, ...))
local stage_7_boss_start_entrance 022BD3 u first_helper object
local stage_7_boss_start_entrance 022BDB u second_helper object
# 022BF4 "LDU #$37,X", 022BFC "LDU #$33,X", 022C04 "LDU #$39,X": "LDA #$0n; STA #$02,U" (helper_2, helper_3, helper_4)
local stage_7_boss_move_helpers 022BF4 u second_helper object
local stage_7_boss_move_helpers 022BFC u third_helper object
local stage_7_boss_move_helpers 022C04 u fourth_helper object
# 022C10 "LDU #$35,X; LDA #$02,U; BNE": waits until its first helper has stopped
local stage_7_boss_step_forward 022C10 u first_helper object
local stage_7_boss_step_forward 022C13 t3 first_helper_state
# 022C22 "LDD #$11,X; SUBD <$B2; CMPD #$00C8; BGT": stops 200 below the camera's top
local stage_7_boss_arrive 022C22 t5 own_y
local stage_7_boss_arrive 022C25 t6 screen_y
# 022C39 "LDU #$35,X", 022C41 "LDU #$37,X", 022C49 "LDU #$33,X", 022C51 "LDU #$39,X": "LDA #$0n; STA #$02,U"
local stage_7_boss_arrive 022C39 u first_helper object
local stage_7_boss_arrive 022C41 u second_helper object
local stage_7_boss_arrive 022C49 u third_helper object
local stage_7_boss_arrive 022C51 u fourth_helper object
# 022CD1 "CLRA ... LDA #$01; LBSR $6EAD" (stage_7_boss_set_hit_box: box 0 or 1 in A), then 022CE5 "CLRA; LBSR $6E9E"
# (stage_7_boss_set_animation: animation 0): the numbers handed in A
local stage_7_boss_strike 022CDB,022CE6 d look_numbers
# 022D1D "LBSR $8686" (find_nearest_player: the player in U), 022D2E "LBSR $861D" (vector_direction_to U); but 022D29
# "LDA #$02; LBSR $6EAD" (stage_7_boss_set_hit_box) in between, when the animation's bit 1 is set, leaves U at the end
# of the box record, and the charge then turns toward that address
local stage_7_boss_charging 022D08,022D1D,022D2B u target_or_box_end
# 022D2E "LBSR $861D; SUBA #$32,X": the direction to it
local stage_7_boss_charging 022D2E d toward_target
# 022D82 "LBSR $85B1" (vector_apply_gravity): what it leaves in D (B ends as the low byte of the animation number)
local stage_7_boss_jump_rise 022D82 d landing_result
# 022DD6 "LDY #$2B,Y; LDA #$02,Y": reads the word at 2B of whatever Y the dispatcher left (its twins read #$2B,X;
# no scenario reaches it)
local stage_7_boss_wait_target_up 022DD6 t5 read_target
# 022DF2 "LDU #$2B,X", 022DF5 "LDD #$0C,X; CMPD #$0C,U; BLT": which side of its target it is
local stage_7_boss_approach 022DF2 t5 walk_target
local stage_7_boss_approach 022DF5 t5 own_x
local stage_7_boss_approach 022DF8 t5 target_x
# 022E0E "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$0040", 022E1A "LDD #$11,X; SUBD #$11,U; ABSD; CMPD #$0008"
local stage_7_boss_approach 022E0E t5 boss_x
local stage_7_boss_approach 022E11 t5 target_place_x
local stage_7_boss_approach 022E11 t7 x_difference
local stage_7_boss_approach 022E14 t1 signed_x_difference
local stage_7_boss_approach 022E14 t3 x_distance
local stage_7_boss_approach 022E1A t5 boss_y
local stage_7_boss_approach 022E1D t5 target_y
local stage_7_boss_approach 022E1D t7 y_difference
local stage_7_boss_approach 022E20 t1 signed_y_difference
local stage_7_boss_approach 022E20 t3 y_distance
# 0230B3 "LDU #$2B,X; LDA #$02,U; LBMI": the target down, it goes idle
local stage_7_boss_approach 0230B3 t5 attack_target
# 022E46 "LDY #$2B,X; LDA #$00,Y; BEQ; LDA #$02,Y; BMI": the target it has
local stage_7_boss_pick_target 022E46 t5 kept_target
# 022E65 "LDU #$2B,X", 022E68 "LDD #$0C,X; CMPD #$0C,U; BGT"
local stage_7_boss_aim 022E65 t5 aim_target
local stage_7_boss_aim 022E68 t5 own_x
local stage_7_boss_aim 022E6B t5 target_x
# 022EA0 "LDU #$7A55; ASLA; LDD A,U; ORB #$80; STD #$04,X": the kind (A) and animation (B)
local stage_7_boss_set_animation 022EA4 t4 kind_with_animation
# 022EB0 "LDU #$7A71; ASLA x3; LEAU A,U", 022EB5/022EBD/022EC2/022EC7 "LDD ,U++": the record and the cursor through it
local stage_7_boss_set_hit_box 022EB5 t1 box_record
local stage_7_boss_set_hit_box 022EBD t1 box_cursor
local stage_7_boss_set_hit_box 022EC2 t1 box_cursor_2
local stage_7_boss_set_hit_box 022EC7 t1 box_cursor_3
# 022ECD "LDD #$0D,X; ADDD #$0F,X; STD <$F1", 022ED6 "LDB #$0F,X; SEX; ADCA #$0C,X", 022EE0 "LDD <$F1; ADDD <$AD": the
# next x on the stage, kept within 08B1-0A0E
local stage_7_boss_keep_in_x 022ECD t5 x_low_and_fraction
local stage_7_boss_keep_in_x 022EDA t3 x_high
local stage_7_boss_keep_in_x 022EE3 t4 camera_x_low_and_fraction
# 022F06 "LDD #$12,X; ADDD #$14,X; STD <$F1", 022F0F "LDB #$14,X; SEX; ADCA #$11,X", 022F19 "LDD <$F1; SUBD <$B3"
local stage_7_boss_keep_in_y 022F06 t5 y_low_and_fraction
local stage_7_boss_keep_in_y 022F09 t6 old_y_low_and_fraction
local stage_7_boss_keep_in_y 022F09 t7 next_y_low_and_fraction
local stage_7_boss_keep_in_y 022F13 t3 y_high
local stage_7_boss_keep_in_y 022F19 t4 stage_y_low_and_fraction
local stage_7_boss_keep_in_y 022F1C t4 camera_y_low_and_fraction
local stage_7_boss_keep_in_y 022F1C t5 next_stage_y_low
local stage_7_boss_keep_in_y 022F1C t6 screen_y_low_and_fraction
# 022F44 "LDD #$3B,X; ADDD #$0001; STD #$3B,X", 022F4D "LDU #$7AB9; LDA <$61; ANDA #$FE; LDD A,U; CMPD #$3B,X"
local stage_7_boss_order_throws 022F47 t2 new_throw_wait
local stage_7_boss_order_throws 022F55 t4 attack_time
# 022F6E "LDB $1880; DECB": last frame's enemies (07CB52 "STA $1880"), the boss one of them
local stage_7_boss_order_throws 022F6E t1 enemies_last_frame
# 022F68 "LDA <$57; DECA; LSRA; INCA", 022F75 "SUBA ,S": the throws (1 or 2 by the players) less the other enemies
local stage_7_boss_order_throws 022F75 t3 throws_allowed
local stage_7_boss_order_throws 022F75 t4 throws_wanted
# 022F8B "DEC <$F1; BNE": helper_throws_left before the decrement
local stage_7_boss_order_throws 022F8B t2 throws_to_order
# 022F81 "LDA <$F0; ANDA #$03; BSR $6F91": the helper's number in A (stage_7_boss_order_throw's helper_number)
local stage_7_boss_order_throws 022F86 d helper_number
# 022F9D "LDY #$7AE9; LBSR $862C": the child record of the thrown object (Y as it came otherwise)
local stage_7_boss_order_throw 022F9D y throw_record
# 023137 "LDD #$0C,X; CMPD #$00E0; BLE": jumps away from the screen's side it is on
local stage_7_boss_take_hit 023137 t5 screen_x
# done: objects/stage_7_boss.c

# ======== objects/stage_7_boss_helper.c ========
# 023184 "LDU #$7B09; LDA #$02,X; DECA; ASLA; LDD A,U; STD #$0F,X": its speed by its state
local stage_7_boss_helper_start_move 02318C t4 move_speed
# 0231A6 "LDD #$2A,X; ADDD #$0F,X; STD #$2A,X", 0231AF "LDB #$0F,X; SEX; ADCA #$29,X; STA #$29,X": the distance gone
# (16.8 in 29-2B) with the x speed added
local stage_7_boss_helper_moving 0231A9 t6 old_distance_low
local stage_7_boss_helper_moving 0231A9 t7 new_distance_low
local stage_7_boss_helper_moving 0231B3 t3 distance_high
# 0231B9 "LDD #$29,X; ABSD; CMPD ,Y": the distance gone against the one by its state
local stage_7_boss_helper_moving 0231BC t1 signed_distance
local stage_7_boss_helper_moving 0231BC t3 distance_gone
# done: objects/stage_7_boss_helper.c

# ======== objects/stage_8_boss.c ========
# 03A274 "LBSR $695C" (stage_8_boss_next_random: D, B its low byte), 03A27C "LDB #$1B,X; CMPB #$48": B holds the random
# number's low byte or its vitality when it reaches 03A292 "JMP [A,Y]"; stage_8_boss_vanish keeps it as step_countdown
# (03A797 "PUSHS D; STD <$05")
local stage_8_boss_run 03A274,03A27C b random_or_vitality
local stage_8_boss_run 03A292 d countdown_value
# 03A02D "LDB <$50; LSRB; BCC; TST $4A42; BMI", then 03A039, 03A042 "LSRB": the players in the game, a bit each from
# Marge's (4A40, 4B00, 4BC0, 4C80)
local stage_8_boss_player_down 03A030 t1 bits_from_marge
local stage_8_boss_player_down 03A039 t1 bits_from_homer
local stage_8_boss_player_down 03A042 t1 bits_from_bart
# 03A09C "TFR A,B; ... ANDB #$0F; ASLB x3; SEX; CMPD #$16,X": the floor ahead's height
local stage_8_boss_move 03A0B3 t1 floor_height
# 03A0CC "LDD #$19,X; SUBD #$0060; STD #$19,X": gravity
local stage_8_boss_move 03A0CF t2 new_z_speed
# 03A0E7 "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40": a player's object picked at random
local stage_8_boss_pick_player 03A0EE t1 player_offset
local stage_8_boss_pick_player 03A0EF t2 start_player
# 03A150 "LSRB; BCC": the players' bits before the shift
local stage_8_boss_player_is_close 03A150 t1 player_bits
# 03A155 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD <$F8", 03A165 "LDD #$11,X; SUBD #$11,U; ABSD; CMPD <$FA"
local stage_8_boss_player_is_close 03A155 t5 own_x
local stage_8_boss_player_is_close 03A158 t5 player_at_x
local stage_8_boss_player_is_close 03A15C t5 x_distance
local stage_8_boss_player_is_close 03A165 t5 own_y
local stage_8_boss_player_is_close 03A168 t5 player_at_y
local stage_8_boss_player_is_close 03A16C t5 y_distance
# 03A1B2 "LDA #$1B,X; LDB <$57; CMPA B,Y": Y points at its beaten healths by players (03A683 "LDY #$7ABD")
param stage_8_boss_take_hit y limits beaten_health
# 03A20E "LDD ,Y++; STD #$1F,X", 03A213 "LDD ,Y; STD #$21,X": the box record handed in Y
local stage_8_boss_set_box 03A20E t1 box_record
# 03A244 "LDY #$0C,X; CMPY #$0C,U; BLE": faces the nearest player
local stage_8_boss_face_nearest_player 03A244 t5 own_x
local stage_8_boss_face_nearest_player 03A247 t5 target_x
# 03A252 "LDB <$61; LSRB; LDB B,Y": a walking speed by rank/2 (as burns_robot_walk_speeds' tables)
param unused_stage_8_boss_set_speed_by_rank y speeds_by_rank walk_speed
# 03A269 "LDA <$57; LDA A,Y": a gauge health by the players
param unused_stage_8_boss_shade_by_players y piece_health_by_players gauge_health
# 03A2C1 "LDD <$58; STD $1852": the random number and the byte after it, the bombs' shared random seed
local stage_8_boss_start 03A2C1 t4 random_word
# 03A3A4 "LDA #$38,X; BITA #$01": the high byte of its own random seed (field 38)
local stage_8_boss_phase_1 03A3A4 t3 random_high
# 03A3C7 "LDD #$0F,X; ADDD #$0F,X; STD #$0F,X": the x speed doubled
local stage_8_boss_phase_1 03A3CA t7 doubled_x_speed
# 03A45A "LBSR $863B" (vector_floor_ahead: the cell's value in A), 03A45D "TSTA; PULLS A; BPL": a wall ahead turns it
local stage_8_boss_phase_2 03A45A a cell_ahead
local stage_8_boss_phase_2 03A45D t1 tested_cell
# 03A558 "INC #$17,X": its height's low byte, one up
local stage_8_boss_keep_away 03A558 t3 z_low
# 03A5BA "LBSR $6925" (stage_8_boss_throw_bombs): the last bomb spawned, in U
local stage_8_boss_jump 03A5BA u last_bomb
# 03A5C3 "LBSR $6991; CMPD #$00C0; BLE": its speed
local stage_8_boss_dash 03A5C3 d current_speed
# 03A7EF "LDA $1852; ANDA #$07; SUBA #$03" (the spread), 03A80D "LDB $1852; ANDB #$78; LSRB; LSRB; ADDB #$1A" (the
# speed): the shared random seed kept in 1852
local stage_8_boss_bomb_throw 03A7EF t1 spread_random
local stage_8_boss_bomb_throw 03A80D t1 speed_random
# 03A81A "LDD #$0F,X; ADDD #$0F,X; STD #$0F,X"
local stage_8_boss_bomb_throw 03A81D t7 doubled_x_speed
# 03A82D "LDD #$0C,X; SUBD #$0C,U; ABSD; STD <$F8", 03A837 "LDD #$11,X; SUBD #$11,U; ABSD; ADDD <$F8; ADDD <$F8; STD
# <$F8; ADDD <$F8; STD #$19,X": its z speed from how far the target is (dy + 2 dx, doubled)
local stage_8_boss_bomb_throw 03A82D t5 bomb_x
local stage_8_boss_bomb_throw 03A830 t5 target_x
local stage_8_boss_bomb_throw 03A830 t7 x_difference
local stage_8_boss_bomb_throw 03A833 t1 signed_x_difference
local stage_8_boss_bomb_throw 03A833 t3 x_distance
local stage_8_boss_bomb_throw 03A837 t5 bomb_y
local stage_8_boss_bomb_throw 03A83A t5 target_y
local stage_8_boss_bomb_throw 03A83A t7 y_difference
local stage_8_boss_bomb_throw 03A83D t1 signed_y_difference
local stage_8_boss_bomb_throw 03A83D t3 y_distance
local stage_8_boss_bomb_throw 03A83E t6 distance_sum
local stage_8_boss_bomb_throw 03A841 t6 weighted_reach
local stage_8_boss_bomb_throw 03A847 t6 throw_z_speed
# 03A897 "LDY #$40,X" (its thrower), 03A8A6 "LDA #$2D,Y; CMPA #$01": the thrower's phases left
local stage_8_boss_bomb_fly 03A8A6 t3 thrower_phases_left
# 03A8B3 "LDA $1852; BPL": the shared random seed
local stage_8_boss_bomb_fly 03A8B3 t1 shared_random
# 03A936 "DEC <$F0; BNE": bombs_left before the decrement
local stage_8_boss_throw_bombs 03A936 t2 bombs_to_throw
# 03A940 "LDD #$0C,X; CMPD #$0030; BLE; CMPD #$01A0; BGE", 03A94D "LDD #$11,X; CMPD #$0090; BLE"
local stage_8_boss_throw_bombs 03A940 t5 boss_x
local stage_8_boss_throw_bombs 03A94D t5 boss_y
# 03A2A0 "LDD #$1234; STD #$38,X; LBSR $607B": its field 38, the random seed stage_8_boss_run steps (03A271 "LEAY
# #$38,X; LBSR $695C"), set to 1234 (the function is unused)
param unused_stage_8_boss_mark_on_floor x boss object.stage_8_boss
# done: objects/stage_8_boss.c

# ======== objects/stage_bosses.c ========
# a boss's box record (stage_8_boss_box, stage_8_boss_wind_up_box, stage_8_boss_bomb_blast_box, football_player_box,
# bear_box, bear_charge_box, stage_3_boss_box...): 03C2E5 / 03A20E "LDD ,Y++; STD #$1F,X; LDD ,Y; STD #$21,X; STA
# #$24,X": its width and depth (into 1F, 20), height and dx (into 21, 22; the height again into dz, 24)
struct boss_box 04 rom
field boss_box 00 width u8
field boss_box 01 depth u8
field boss_box 02 height u8
field boss_box 03 dx s8
param stage_boss_set_hit_box y box boss_box
param stage_8_boss_set_box y box boss_box
# 03C021 "LDB <$50; LSRB; BCC; TST $4A42; BMI", 03C02D, 03C036 "LSRB": the players in the game, a bit each from Marge's
local stage_boss_any_player_down 03C024 t1 bits_from_marge
local stage_boss_any_player_down 03C02D t1 bits_from_homer
local stage_boss_any_player_down 03C036 t1 bits_from_bart
# 03C08B "LDD #$0C,X; CMPD #$0078" (in the open), 03C081 "LDD #$0C,X; CMPD #$00E0" (against a wall): where it is
local stage_boss_knock_away 03C08B t5 boss_x
local stage_boss_knock_away 03C081 t5 boss_x_at_wall
# 03C0EB "LDD #$0D,X; ADDD #$0F,X; PUSHS A; LDB #$0F,X; SEX; ADCA #$0C,X; PULLS B": its next x, kept within 70-140
local stage_boss_move_on_screen 03C0EB t5 x_low_and_fraction
local stage_boss_move_on_screen 03C0F7 t3 x_high
# the floor ahead's height (8 per step) against its height
local stage_boss_follow_floor 03C145 t1 floor_height
# 03C17F "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40": a player's object picked at random
local stage_boss_pick_random_player 03C186 t1 player_offset
local stage_boss_pick_random_player 03C187 t2 start_player
# 03C1B1 "LBSR $8671; CMPA <$F0; BLT ... ADDB <$F0; STB <$F0": the direction toward the other against turning_direction
local stage_boss_turn_toward 03C1B4 t2 current_direction
local stage_boss_turn_toward 03C1B4 t3 wanted_direction
# 03C1FE "LSRB; BCC": the players' bits before the shift
local stage_boss_player_is_near 03C1FE t1 player_bits
# 03C203 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD <$F8", 03C213 "LDD #$11,X; SUBD #$11,U; ABSD; CMPD <$FA"
local stage_boss_player_is_near 03C203 t5 own_x
local stage_boss_player_is_near 03C206 t5 player_at_x
local stage_boss_player_is_near 03C20A t5 x_distance
local stage_boss_player_is_near 03C213 t5 own_y
local stage_boss_player_is_near 03C216 t5 player_at_y
local stage_boss_player_is_near 03C21A t5 y_distance
# 03C289 "LDA #$1B,X; LDB <$57; CMPA B,Y; BHI": Y points at the boss's beaten healths by players
# (football_player_beaten_vitality, bear_beaten_vitality...: "beaten at or below")
param stage_boss_check_hit y health_limits beaten_health
# 03C2BF "DEC #$2F,X; BNE": the blinking frames left before the decrement
local stage_boss_blink_out 03C2BF t3 blinks_left
# 03C2E5 "LDD ,Y++": the box record handed in Y
local stage_boss_set_hit_box 03C2E5 t1 box_record
# 03C31B "LDY #$0C,X; CMPY #$0C,U; BLE": faces the nearest player
local stage_boss_face_nearest_player 03C31B t5 own_x
local stage_boss_face_nearest_player 03C31E t5 target_x
# 03C329 "LDB <$61; LSRB; LDB B,Y; LBRA $8617": its walking speed by rank/2 (bear_walk_speeds...: as
# burns_robot_walk_speeds' tables)
param stage_boss_walk_by_rank y speeds_by_rank walk_speed
# 03C340 "LDA <$57; LDA A,Y; LBRA $86BF": the gauge's health step by the players (football_player_gauge_healths,
# bear_gauge_healths: 00 16 19 1C 20)
elements gauge_health u8
param stage_boss_set_gauge y piece_health_by_players gauge_health
# done: objects/stage_bosses.c

# ======== objects/wrestler.c ========
# 021729 "LDA #$40; STA #$2A,X; STU #$2B,X" (wrestler_pick_target keeps the nearest player found), 0216E4/021920 "LDU
# #$2B,X" (wrestler_approach), 02172D "LDU #$2B,X" (wrestler_aim), 02170E "LDY #$2B,X" (wrestler_pick_target): the
# player it goes after, a word at 2B as krusty_balloon's target (the C reads it today as halves of behaviour and
# target_dx)
scoped object wrestler 2B target u16 object
# 021340 "LDA <$16; ANDA #$01; RORA; RORA; ORA #$00,X"
local wrestler_blink_out 021345 t2 rotated_once
# 021362 "LDU #$33,X; CLR #$00,U": the object put in with it (021468 "STU #$33,X") removed
local wrestler_blink_out 021362 u partner_object object
# 021845 "LDU #$33,X; LDD #$0100; STD #$19,U": the object put in with it thrown up
local wrestler_fall 021845 u partner_object object
# 021408 "LDA #$0E; LBSR $7766" (wrestler_set_animation, animation 0E), 02140D "CLRA; LBSR $7775" (wrestler_set_hit_box,
# box 0): the numbers handed in A
local wrestler_put_in 02140A,02140E d look_numbers
# 02141D "LDD #$0100; SUBD <$B2; STD #$16,X", 021459 "LDD #$0158; SUBD <$B2; STD #$16,U": the heights they drop from
local wrestler_put_in 021420 t6 entrance_z
local wrestler_put_in 02145C t6 partner_z
# 021437 "LDB #$02; LBSR $867D" (vector_find_free_slot), 02143C-021465 "STA #$00,U; STA #$06,U; CLR #$01,U; STD
# #$04,U; STD #$0C,U; STD #$11,U; STD #$16,U; STD #$19,U", 021468 "STU #$33,X": the object put in with it
local wrestler_put_in 021439 u partner_object object
# 021488 "LDU #$33,X; LDD #$16,U; ADDD #$11,U; SUBD <$B2; CMPD #$0130": the object put in with it lands
local wrestler_entrance_drop 021488 u partner_object object
local wrestler_entrance_drop 02148B t5 partner_z
local wrestler_entrance_drop 02148E t5 partner_y
local wrestler_entrance_drop 02149F t5 partner_y_2
# 0213C3 "LBSR $7816" (wrestler_stand): U is left at the end of the hit box record (02178F "LDD ,U++"), which
# wrestler_pick_target's search overwrites (021708 "LBSR $8686")
local wrestler_get_up 0213C3 u box_end
local wrestler_flinch_land 0213E3 u box_end
local wrestler_punch_recover 0215DC u box_end
local wrestler_guarding 0215FF u box_end
# 021825 "CLRA; LBSR $7775" (wrestler_set_hit_box): what it leaves in U, handed back
local wrestler_stand 021826 u box_end
# 021816 "LDA #$01; LBSR $7766" (wrestler_set_animation), 021825 "CLRA; LBSR $7775" (wrestler_set_hit_box): the numbers
# handed in A
local wrestler_stand 021818,021826 d look_numbers
# 0215C6 "CLRA; LBSR $7766", 0215CA "CLRA; LBSR $7775"
local wrestler_punch_strike 0215C7,0215CB d look_numbers
# 0216C8 "LDY #$2B,Y; LDA #$02,Y": reads the word at 2B of whatever Y the dispatcher left (its twins read #$2B,X; no
# scenario reaches it)
local wrestler_wait_target_up 0216C8 t5 read_target
# 0216E4 "LDU #$2B,X; LDD #$0C,X; CMPD #$0C,U; BLT": which side of its target it is
local wrestler_approach 0216E4 t5 walk_target
local wrestler_approach 0216E7 t5 own_x
local wrestler_approach 0216EA t5 target_x
# 021920 "LDU #$2B,X; LDA #$02,U; LBMI"
local wrestler_approach 021920 t5 attack_target
# 02170E "LDY #$2B,X; LDA #$00,Y; BEQ; LDA #$02,Y; BMI"
local wrestler_pick_target 02170E t5 kept_target
# 02172D "LDU #$2B,X", 021730 "LDD #$0C,X; CMPD #$0C,U; BGT"
local wrestler_aim 02172D t5 aim_target
local wrestler_aim 021730 t5 own_x
local wrestler_aim 021733 t5 target_x
# 021768 "LDU #$7E79; ASLA; LDD A,U; ORB #$80; STD #$04,X": the animation's number (A) and the table's kind and
# animation
local wrestler_set_animation 021766 a animation_index
local wrestler_set_animation 02176C t4 kind_with_animation
# 021775 "LDU #$7E99; ASLA x3; LEAU A,U", 02177D/021785/02178A/02178F "LDD ,U++": the record and the cursor through it
local wrestler_set_hit_box 02177D t1 box_record
local wrestler_set_hit_box 021785 t1 box_cursor
local wrestler_set_hit_box 02178A t1 box_cursor_2
local wrestler_set_hit_box 02178F t1 box_cursor_3
# 021795 "LDD #$0D,X; ADDD #$0F,X; STD <$F1", 02179E "LDB #$0F,X; SEX; ADCA #$0C,X", 0217A8 "LDD <$F1; ADDD <$AD": the
# next x on the stage, kept within 0580-069E
local wrestler_keep_in_area 021795 t5 x_low_and_fraction
local wrestler_keep_in_area 0217A2 t3 x_high
local wrestler_keep_in_area 0217AB t4 camera_x_low_and_fraction
# 0217C9 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$0040", 0217D5 "LDD #$11,X; SUBD #$11,U; ABSD; CMPD #$0004"
local wrestler_within_reach 0217C9 t5 own_x
local wrestler_within_reach 0217CC t5 player_at_x
local wrestler_within_reach 0217D5 t5 own_y
local wrestler_within_reach 0217D8 t5 player_at_y
# 0217EF "LDA #$04; CLRB; PUSHS D", 021808 "DEC ,S; BNE": the players left to look at before the decrement
local wrestler_surrounded 021808 t2 players_to_check
# done: objects/wrestler.c

# ======== temporaries, typed pointers and locals: enemies, bosses, players ========
# ======== actors ========
# Temporaries (local FUNC PLACE tN NAME), pointers typed by their structure and variables still named after a
# register, from the work list and the C of the C. Evidence: build/listing/simpsons.s
# (PLACE "INSTRUCTION") and the C lines of the C.

# ---- bosses/dreamland_boss.c ----
# 0340C1 "LBSR $85AB" (vector_object_setup: 07D13E "LDY #$02,U" leaves the setup's hit box record in Y), handed back
local dreamland_boss_setup 0340C1 y box
# 0341A2 "LDD #$0A,X", 0341A5 "ADDD #$0101": both zooms one up (C "t1 = zoom_x + 0x101u")
local dreamland_boss_grow 0341A5 t2 grown_zoom
# 0342A1 "LDD #$11,U" (the nearest player's y), 0342A4 "SUBD #$11,X" (the boss's), 0342A7 "ABSD": the distance in depth
local dreamland_boss_chase_leg 0342A1 t5 player_y
local dreamland_boss_chase_leg 0342A4 t5 boss_y
local dreamland_boss_chase_leg 0342A4 t7 dy
local dreamland_boss_chase_leg 0342A7 t1 dy
local dreamland_boss_chase_leg 0342A7 t3 depth_distance
# 03430F "LDD #$11,U" (its player's y), 034312 "SUBD #$11,X" (the boss's)
local dreamland_boss_check_in_line 03430F t5 player_y
local dreamland_boss_check_in_line 034312 t5 boss_y
# 034357 "LDD #$0C,U" (its player's x), 03435A "CMPD #$0C,X" (the boss's): the dash goes the player's way
local dreamland_boss_charge_dash 034357 t5 player_x
local dreamland_boss_charge_dash 03435A t5 boss_x
# 03452C "LDD #$0C,U" (its player's x), 03452F "CMPD #$0C,X": knocked away from the player
local dreamland_boss_first_form_hit_start 03452C t5 player_x
local dreamland_boss_first_form_hit_start 03452F t5 boss_x
# 034604 "LDA A,U" from object_1a_pose_times (C "t1 = object_1a_pose_times[...]; timer = t1; if ((int8_t)t1 < 0)")
local dreamland_boss_next_pose 034604 t2 pose_time
# 034662 "LBSR $8620" (vector_choose_nearest_player), handed to vector_measure_target
local dreamland_boss_leap_crouch 034662 u nearest_player object
local dreamland_boss_spit_start 034952 u nearest_player object
local dreamland_boss_creep_start 034C0A u nearest_player object
local dreamland_boss_lash_start 034C5F u nearest_player object
# 034C86 "LDB #$29,X", 034C89 "ASLB", 034C8A "JSR [B,U]": the doubled step, which dreamland_boss_defeat_vanish keeps
# as its step_offset
local dreamland_boss_defeat 034C8A d step_offset
# 034CAF "LDD #$0C,X; CMPD #$00E0": the boss walks to the middle from the side it is on
local dreamland_boss_defeat_start 034CAF t5 boss_x
# 034CBE "LDD #$0C,X", 034CC1 "SUBD #$00C0", "CMPD #$0040": inside 00C0-00FF, the middle of the screen
local dreamland_boss_defeat_reach_middle 034CBE t5 boss_x
local dreamland_boss_defeat_reach_middle 034CC1 t2 middle_offset
# done: bosses/dreamland_boss.c

# ---- bosses/dreamland_boss_objects.c ----
# 034E84 "LBSR $8620" (vector_choose_nearest_player), handed back to the dispatcher
local boss_ball_setup 034E84 u nearest_player object
# 034EC2 "LDD #$0C,U" (its player's x), 034EC5 "SUBD #$0C,X", 034EC8 "ABSD": the ball rises while 20 or more away
# across (034ED1 "ADDD #$0040" on its z speed)
local boss_ball_fly_out 034EC2 t5 player_x
local boss_ball_fly_out 034EC5 t5 ball_x
local boss_ball_fly_out 034EC5 t7 dx
local boss_ball_fly_out 034EC8 t1 dx
local boss_ball_fly_out 034EC8 t3 distance
local boss_ball_fly_out 034ED1 t2 raised_z_speed
# 034F02 "SUBD #$0080" on its z speed: the ball comes down
local boss_ball_home_in 034F02 t2 lowered_z_speed
# 034F86 / 034FAA / 034FEB "LBSR $85AB" (vector_object_setup leaves the setup's hit box record in Y)
local boss_ball_trail_setup 034F86 y box
local dreamland_boss_shadow_setup 034FAA y box
local chain_holder_setup 034FEB y box
# 034FC9 "LDD #$0C,U" (the boss's x), 034FCC "SUBD #$0C,X" (the shadow's), 034FD5/034FD8 the same for y
local dreamland_boss_shadow_follow 034FC9 t5 boss_x
local dreamland_boss_shadow_follow 034FCC t5 shadow_x
local dreamland_boss_shadow_follow 034FD5 t5 boss_y
local dreamland_boss_shadow_follow 034FD8 t5 shadow_y
# 035020 "LDD #$0C,X" (the holder's x), 035023 "CMPD #$0C,U" (the nearest player's): it faces him
local chain_holder_watch 035020 t5 holder_x
local chain_holder_watch 035023 t5 player_x
# C "t1 = OBJECT(previous_piece)->x; OBJECT(piece)->x = t1; t2 = OBJECT(previous_piece)->y": each piece put where
# the one before is; 03515A "DEC" the pieces left (C "t3 = chain_pieces_left; chain_pieces_left = t3 - 1u");
# 035165/035178 the head (C "OBJECT(previous_piece)->parent = t4"); 03516B "LDA ,U+" the next link's parameter byte
# from dreamland_boss_chain_link_parameters
local dreamland_boss_chain_setup 03511A t5 previous_x
local dreamland_boss_chain_setup 035120 t5 previous_y
local dreamland_boss_chain_setup 03515A t2 pieces_left
local dreamland_boss_chain_setup 035165 t4 head_link
local dreamland_boss_chain_setup 03516B t1 parameter_address
local dreamland_boss_chain_setup 035178 t4 last_head_link
# 035190 "LDD #$3E,X" (the next piece's direction and distance, handed to chain_link_offset); 0351A8 "LDD #$0C,X"
# (the base's x), 0351AE "SUBD #$0C,Y" (the next link's); 0351B7/0351BD the same for y
local dreamland_boss_chain_lead 035190 t5 next_direction_and_distance
local dreamland_boss_chain_lead 0351A8 t5 base_x
local dreamland_boss_chain_lead 0351AE t5 next_x
local dreamland_boss_chain_lead 0351B7 t5 base_y
local dreamland_boss_chain_lead 0351BD t5 next_y
# 0351E4 "LDD $1888" (the chain's x offset, -16 to 15), 0351F8 "SUBD #$0001" (one step to the left, biased by 16)
local dreamland_boss_chain_shift_offset 0351E4 t3 chain_offset
local dreamland_boss_chain_shift_offset 0351F8 t2 offset_left
# 03521D "LDD #$0C,U" (the holder's x), 035220 "ADDD $1888" (the chain's x offset), 035224 "SUBD #$0C,X" (the
# base's x); 03522D/035233 the same for y
local dreamland_boss_chain_stay_at_holder 03521D t5 holder_x
local dreamland_boss_chain_stay_at_holder 035220 t3 chain_offset
local dreamland_boss_chain_stay_at_holder 035224 t5 base_x
local dreamland_boss_chain_stay_at_holder 03522D t5 holder_y
local dreamland_boss_chain_stay_at_holder 035233 t5 base_y
# 03528B "LDD #$0C,X" (this link's x), 035291 "SUBD #$0C,Y" (the next link's); 0352A0/0352A6 the same for y
local dreamland_boss_chain_link_follow 03528B t5 link_x
local dreamland_boss_chain_link_follow 035291 t5 next_x
local dreamland_boss_chain_link_follow 0352A0 t5 link_y
local dreamland_boss_chain_link_follow 0352A6 t5 next_y
# 035364 "LDY #$2C,X", 035367 "LDD ,Y++": the path's step (direction, distance); after FFFF the record holds the
# loop's path (03537E "LDY ,Y"), the next path (035379 "LDY #$02,Y") and the loops (035373 "LDA #$04,Y")
local dreamland_boss_chain_head_follow_path 035367 t1 step_address
local dreamland_boss_chain_head_follow_path 035367 t4 step_word
local dreamland_boss_chain_head_follow_path 035373 t3 next_loops
local dreamland_boss_chain_head_follow_path 035379 t5 next_path
local dreamland_boss_chain_head_follow_path 035380 t1 loop_step_address
local dreamland_boss_chain_head_follow_path 035380 t4 loop_step_word
# 035445 "LDA #$18" the slots to look at, 03546D "DECA; BNE" (C "t1 = a; a = t1 - 1u; if (t1 != 1u)"); 035454 "CLRD"
# the word 03545A "BSETW D,X,U" fills the slot with; 03545D "LDD <$E8" the sprites' place kept across the clearing
local find_free_object_from_4d40 035445,03546D a slots_left
local find_free_object_from_4d40 03546D t1 slots_before
local find_free_object_from_4d40 035454 a clear_high
local find_free_object_from_4d40 035454 b clear_low
local find_free_object_from_4d40 03545D t4 kept_sprites
# 0354B7 "ANDA #$C0": the direction's quarter (C "t1 = chain_direction & 0xC0u")
local chain_link_offset 0354B7 t2 quarter
# done: bosses/dreamland_boss_objects.c

# ---- enemies/cloud_devil.c ----
# 030E49 "LDD #$16,X", 030E4C "SUBD #$0030": the bolt starts 30 below the cloud
local lightning_bolt_setup 030E4C t2 bolt_z
# 030E92 "LBSR $85AB" (vector_object_setup leaves the setup's hit box record in Y), handed back
local cloud_devil_setup 030E92 y box
# 030EBC "LDD A,U" from kind_c7_start_x (C "t1 = kind_c7_start_x[...]; OBJECT(object)->x = t1")
local cloud_devil_setup 030EBC t4 start_x
# 030E77 "LDD #$0C,X" (the devil's x), 030E7A "CMPD #$0C,U" (its player's): it faces him
local cloud_devil_fly 030E77 t5 devil_x
local cloud_devil_fly 030E7A t5 player_x
# 031092 "LDU #$38,X" (its player), 03109C "LBSR $8620" (the nearest one every 128 frames); 0310A2 "CMPD #$0C,U"
# reads his x (C "t2 = mem_read16(target_player + 0xCu)")
local cloud_devil_steer 031092,03109C,031108 u target_player object
local cloud_devil_steer 03109F t5 devil_x
local cloud_devil_steer 0310A2 t5 player_x
# 0310AD "LDB #$3A,X", 0310B0 "ADDD #$2E,X" (or 0310C5 "NEGD" first): the heading turned by the sweep's rate, its
# whole part (0310B3 "ANDA #$0F") checked for 4 or C, the sweep's ends
local cloud_devil_steer 0310F5 t2 turn
local cloud_devil_steer 0310C5 t2 turn
local cloud_devil_steer 0310F6 t7 new_heading
local cloud_devil_steer 0310E0 t7 new_heading
local cloud_devil_steer 0310C6 t7 new_heading
local cloud_devil_steer 0310B0 t7 new_heading
local cloud_devil_steer 0310B3,0310C9,0310E3,0310F9 a heading_whole
# 03110B "LDD #$11,X" (the devil's y), 03110E "SUBD #$11,U" (its player's), 031111 "STA <$F0" (the sign), 031114
# "ABSD": it follows his depth when 4 or more away
local cloud_devil_steer 03110B t5 devil_y
local cloud_devil_steer 03110E t5 player_y
local cloud_devil_steer 03110E t7 dy
local cloud_devil_steer 03110E a dy_high
local cloud_devil_steer 031114 t1 dy
local cloud_devil_steer 031114 t3 depth_distance
# 031128 "LDD #$0C,X; CMPD #$0060", 031130 "LDD #$0060", 03113A "LDD #$015F", 03113D "SUBD #$0C,X": the x to go
# to, kept inside 0060-015F; 031146 "LDD #$11,X; CMPD #$0090", 03114E "LDD #$0090", 031158 the y to go to, inside
# 0090-00FF
local cloud_devil_steer 031128 t5 devil_x
local cloud_devil_steer 031128 a goal_x_high
local cloud_devil_steer 031128,031130,03113A b goal_x_low
local cloud_devil_steer 03113D t5 devil_x
local cloud_devil_steer 031146 t5 devil_y
local cloud_devil_steer 031146 a goal_y_high
local cloud_devil_steer 031146,03114E,031158 b goal_y_low
local cloud_devil_steer 03115B t5 devil_y
# 0311BB "LDA #$2E,X" (the heading's whole part), 0311BE "ASLA; ASLA; LEAU A,U": its velocity record
local cloud_devil_set_speeds 0311BB t3 heading_whole
# done: enemies/cloud_devil.c

# ---- enemies/donut.c ----
# 032FF8 "LBSR $85AB" (vector_object_setup leaves the setup's hit box record in Y), handed back; 032FFB "LBSR $8620"
# (vector_choose_nearest_player), handed to vector_measure_target
local donut_setup 032FF8 y box
local donut_setup 032FFB u nearest_player object
# 0330DD / 033136 "LDD #$0C,X; CMPD #$00E0": the donut goes toward the middle from the side it is on
local donut_drop_down 0330DD t5 donut_x
local donut_walk_in 033136 t5 donut_x
# 0331C2 (vector_spawn_child): the small donut it puts in, handed back in U
local donut_throw_release 0331C2 u small_donut object
# 0331DB "LBSR $85AB" (vector_object_setup leaves the setup's hit box record in Y)
local donut_shot_setup 0331DB y box
# done: enemies/donut.c

# ---- enemies/enemy_climbing.c ----
# 07D6D6 / 07D70F / 07D739 / 07D763 "LBSR $CDD3" (set_climb_speed: 07CDD3 "LDU #$F124" leaves climb_speeds in U),
# handed back
local enemy_climb_up_front_start 07D6D6 u speeds_table
local enemy_climb_up_back_start 07D70F u speeds_table
local enemy_climb_up_left_start 07D739 u speeds_table
local enemy_climb_up_right_start 07D763 u speeds_table
# done: enemies/enemy_climbing.c

# ---- enemies/enemy_hit_reactions.c ----
# 07DE49 / 07DED1 "LDD #$16,X", 07DE4C / 07DED4 "SUBD #$5C,X", "CMPD #$0020": thrown up when less than 20 above its
# floor
local enemy_knocked_forward_start 07DE4C t7 height_above_floor
local enemy_knocked_back_start 07DED4 t7 height_above_floor
# 07DE68 / 07DEF0 "LDD #$19,X", 07DE6B / 07DEF3 "SUBD #$0020", "STD #$19,X": gravity on its z speed
local enemy_knocked_fall 07DE6B t2 falling_z_speed
local enemy_knocked_back_fall 07DEF3 t2 falling_z_speed
# 07E006 "INC #$17,X": z's low byte, a pixel up when a step stops it
local enemy_sent_flying_step 07E006 t3 z_low
# done: enemies/enemy_hit_reactions.c

# ---- enemies/enemy_hits.c ----
# 07D034 "LDD #$0C,U" (the hitter's x), 07D037 "CMPD #$0C,X" (the enemy's): a standing hitter pushes it away from
# his side
local enemy_set_knock_direction 07D034 t5 hitter_x
local enemy_set_knock_direction 07D037 t5 enemy_x
# 07D064 "DEC $187B", 07D068 "LDA $187B; ANDA #$01" (C "t1 = io_read8(0x187Bu); io_write8(0x187Bu, t1 - 1u); t2 =
# io_read8(0x187Bu)"): a count in the K052109's RAM whose bit 0 takes knocked down and sent flying by turns
local enemy_react_to_hit 07D064 t1 knock_turn
local enemy_react_to_hit 07D068 t1 next_knock_turn
# 07D0F0 "DEC" its player's attackers (C "t1 = attackers - 1u; ... if ((int8_t)t1 < 0)"), not below 0
local enemy_release_target 07D0F0 t4 attackers_left
# done: enemies/enemy_hits.c

# ---- enemies/enemy_moves.c ----
# 07D7E3 "LDA #$36,X", 07D7E6 "LDB #$3D,X; BNE": which way round it goes (60 one way, -20 the other)
local unused_enemy_move_aside 07D7E6 t3 other_way
# 07D7FD "ASLB", 07D7FE "JSR [B,U]": the doubled step, handed to the climbs and hops (C "d = step_offset")
local enemy_get_around 07D7FE d step_offset
local enemy_circle_target 07DC42 d step_offset
# 07D99A "INC $1878", 07D99E "LDA $1878; STA #$3B,X": a count in the K052109's RAM that gives each enemy starting a
# walk this frame one frame more to wait
local enemy_walk_start_in_turn 07D99A t1 delays_given
local enemy_walk_start_in_turn 07D99E t1 walk_delay
# 07DA35 / 07DA49 / 07DA87 "LDD $1886": the enemies' walking speed (a word in the K052109's RAM), into y speed or
# x speed
local enemy_line_up_in_depth 07DA49 t3 walk_speed_now
local enemy_line_up_in_depth 07DA35 t3 walk_speed_now
local enemy_line_up_in_x 07DA87 t3 walk_speed_now
# 07DB4F "LDD #$2C,X; CMPD #$0070", 07DB57 "LDD #$2E,X; CMPD #$0040": the distance to its target, whose low byte
# stays in B for set_walk_speeds_from_direction (07DB6A "LDA #$36,X; LBSR $CCDD")
local enemy_keep_distance_close_in 07DB4F,07DB57 d distance_low
# 07DB83 "LDD #$0C,X; SUBD #$0040; CMPD #$0140": stopped when off the screen
local enemy_wait_while_target_down 07DB83 t5 enemy_x
local enemy_back_off 07DB83 t5 enemy_x
# done: enemies/enemy_moves.c

# ---- enemies/enemy_states.c ----
# enemy_think: its target, 07D49C "LDU #$38,X", 07D4B7 "LBSR $D301" (the nearest player), 07D4C6 "LDU $1870" (the one
# the fewest go after: find_least_attacked_player), 07D4DB "LDU #$38,X"; the code reads his fields 45 (attackers:
# 07D4BA "LDA #$45,U", 07D4CD "INC #$45,U"), 46 (the sides taken: 07D4F7, 07D527, 07D53B, 07D574 "LDA #$46,U"), 02
# (his state: 07D581, 07D5A7 "LDA #$02,U") and 5C (his floor: 07D5AC "LDD #$5C,U")
local enemy_think 07D49C,07D4B7,07D4C6,07D4DB u target_player object.player
# 07D4AF "DEC #$45,U; BPL; CLR": one attacker fewer on the player it leaves
local enemy_think 07D4AF t4 attackers_left
# 07D4BA "LDA #$45,U", 07D4BD "CMPA $1877" (the most attackers a player takes, a byte in the K052109's RAM)
local enemy_think 07D4BA t3 nearest_attackers
local enemy_think 07D4BD t1 attackers_limit
# 07D4C6 "LDU $1870" (what find_least_attacked_player leaves there)
local enemy_think 07D4C6 t3 least_attacked
# 07D4CD "INC #$45,U" (C "t5 = mem_read8(target_player + 0x45u); mem_write8(target_player + 0x45u, t5 + 1u)")
local enemy_think 07D4CD t3 old_attackers
# 07D4F7 / 07D574 "LDA #$46,U; CMPA #$C0" (both sides taken), 07D527 / 07D53B "LDA #$46,U" then 07D52C "ORA #$80" or
# 07D542 "ORA #$40": the side the enemy takes (C "a = t8; ... mem_write8(target_player + 0x46u, a | 0x40u)")
local enemy_think 07D4F7 t3 taken_sides
local enemy_think 07D574 t3 taken_sides
local enemy_think 07D527 t3 taken_sides
local enemy_think 07D53B t3 taken_sides
local enemy_think 07D527,07D53B a sides
# 07D581 / 07D5A7 "LDA #$02,U; BPL" (the target's state: negative when it is hit or down)
local enemy_think 07D581 t3 target_state
local enemy_think 07D5A7 t3 target_state
# 07D5AC "LDD #$5C,U", 07D5AF "SUBD #$5C,X", 07D5B2 "ABSD; CMPD #$0020": the target's floor not more than 20 from the
# enemy's
local enemy_think 07D5AC t5 target_floor
local enemy_think 07D5AF t7 floor_difference
local enemy_think 07D5B2 t1 floor_difference
local enemy_think 07D5B2 t3 floor_distance
# 07D5C0 "LDU #$2A,X; LEAU #$28,U": its behaviour's attack ranges; 07D5C6 "LBSR $D3D7" (enemy_find_attack_range: the
# range found, with its chance in A: 07D406 "LDA #$03,U"); 07D5D9 "LEAU #$07,U" (its chances), 07D5E5 "LEAU
# #$-04,U" (its actions, 07D5E8 "LDA B,U; STA #$28,X")
local enemy_think 07D5C6 a attack_chance
# 07D5CD / 07D5D4 / 07D60F "LBSR $D34F" (enemy_random), 07D5DC / 07D617 "SUBA B,U" each choice's chance off it until
# it goes below 0 (C "t17 = a; a = t17 - t16; if (t17 < t16)"); 07D5E0 / 07D61B "DECB; BNE" the choices left
local enemy_think 07D5CD,07D5D4,07D5DC,07D60F,07D617 a roll
local enemy_think 07D5DC t2 action_chance
local enemy_think 07D5DC t3 remaining_roll
local enemy_think 07D5E0 t1 choices_left
local enemy_think 07D617 t2 action_chance
local enemy_think 07D617 t3 remaining_roll
local enemy_think 07D61B t1 choices_left
# 07D604 "LDU #$2A,X", 07D607 "LDA #$30,X; ASLA x3", 07D60D "LEAU A,U": its behaviour's record for its state (8
# bytes: chances from 4, actions from 1), 07D614 "LEAU #$03,U"
# 07D62C "LDD #$28,X", 07D62F "LDU #$F586" (enemy_think_actions), "ASLA; JSR [A,U]": the action's handlers
local enemy_think 07D62F u action_handlers
local enemy_think 07D632 a action_offset
# 07D66E "JSR [A,U]" (what the reaction's step leaves in U), 07D675 "LBRA $CDE9" (check_floor)
local enemy_hit_reaction 07D66E,07D675 u step_handlers
# done: enemies/enemy_states.c

# ---- enemies/enemy_targets.c ----
# 07D301 "LDA $1874; LBEQ" (the players in the game, copied into the K052109's RAM: no players, the last one found)
local enemy_target_nearest_player 07D301 t1 players_counted
# 07D31A "LDD #$0C,X", 07D31D "SUBD #$0C,U": the x distance to each player; 07D325 "LDD #$11,X", 07D328 "SUBD #$11,U"
# the y one, added (07D32E "ADDD ,S++")
local enemy_target_nearest_player 07D31A t5 enemy_x
local enemy_target_nearest_player 07D31D t5 player_x
local enemy_target_nearest_player 07D31D t7 dx
local enemy_target_nearest_player 07D325 t5 enemy_y
local enemy_target_nearest_player 07D328 t5 player_y
local enemy_target_nearest_player 07D328 t7 dy
# 07D340 "DEC ,S; BNE": the players' slots left to look at; 07D347 "LDU $1872; STU #$38,X": the nearest one
local enemy_target_nearest_player 07D340 t2 slots_before
local enemy_target_nearest_player 07D347 t3 nearest_player
# 07D361 "LDD #$0C,U" (the target's x), 07D364 "SUBD #$0C,X" (the enemy's), 07D369 "NEGD" made positive; 07D37A,
# 07D37D, 07D382 the same in depth
local enemy_look_at_target 07D361 t5 target_x
local enemy_look_at_target 07D364 t5 enemy_x
local enemy_look_at_target 07D364 t7 dx
local enemy_look_at_target 07D369 t2 x_distance
local enemy_look_at_target 07D37A t5 target_y
local enemy_look_at_target 07D37D t5 enemy_y
local enemy_look_at_target 07D37D t7 dy
local enemy_look_at_target 07D382 t2 y_distance
# One of an enemy behaviour's 4 attack ranges (enemy_behaviour.ranges, 12 bytes each from its byte 28), which
# enemy_find_attack_range and enemy_think read: 07D3E9 "LDB #$2F,X; CMPB ,U; BHI" (the most distance in depth),
# 07D3F0 "LDB #$2D,X; CMPB #$01,U; BCS; CMPB #$02,U; BLS" (the least and the most across), 07D406 "LDA #$03,U" (the
# chance to attack), enemy_think's 07D5D9 "LEAU #$07,U; ... SUBA B,U" (the 4 actions' chances, B 4 to 1) and 07D5E5
# "LEAU #$-04,U; LDA B,U; STA #$28,X" (the 4 actions)
struct attack_range 0C rom
field attack_range 00 most_dy u8
field attack_range 01 least_dx u8
field attack_range 02 most_dx u8
field attack_range 03 chance u8
field attack_range 04 actions u8[4]
field attack_range 08 action_chances u8[4]
# 07D5C3 "LEAU #$28,U; LBSR $D3D7": the first range, 07D3FD "LEAU #$0C,U" the next
param enemy_find_attack_range u range attack_range
local enemy_find_attack_range 07D3FD u range attack_range
# 07D3D7 "LDD #$2C,X; CMPD #$0100" and 07D3DF "LDD #$2E,X; CMPD #$0100" (too far: A, the distance's high byte, is
# handed back with no carry); 07D3E7 "LDA #$04", 07D400 "DECA; BNE": the ranges left to look at
local enemy_find_attack_range 07D3D7,07D3DF a distance_high
local enemy_find_attack_range 07D3E7,07D400 a ranges_left
local enemy_find_attack_range 07D400 t1 ranges_before
# 07D3E9 "LDB #$2F,X" (the depth distance's low byte), 07D3F0 "LDB #$2D,X" (the x distance's), 07D3F3 "CMPB #$01,U",
# 07D3F8 "CMPB #$02,U", 07D406 "LDA #$03,U"
local enemy_find_attack_range 07D3E9 t3 dy_low
local enemy_find_attack_range 07D3F0 t3 dx_low
local enemy_find_attack_range 07D3F3 t3 range_least_dx
local enemy_find_attack_range 07D3F8 t3 range_most_dx
local enemy_find_attack_range 07D406 t3 range_chance
# done: enemies/enemy_targets.c

# ---- enemies/goon.c ----
# 07D419 / 07D453 "LBSR $D132" (start_object_from_setup: 07D13E "LDY #$02,U" leaves the setup's hit box record in Y)
local enemy_goon_set_up 07D419 y box
local enemy_become_goon 07D453 y box
# 07D429 "LBSR $D301" (enemy_target_nearest_player), handed to enemy_look_at_target; 07D42F "LDU #$F144; STU #$2A,X"
# (goon_behaviour), handed back
local enemy_goon_set_up 07D429 u nearest_player object
local enemy_goon_set_up 07D42F u behaviour_address
# 07D43B "BSR $D416" (enemy_goon_set_up hands back the hit box record in Y and the behaviour in U)
local enemy_goon_enter 07D43B y box
local enemy_goon_enter 07D43B u behaviour_address
# done: enemies/goon.c

# ---- enemies/goon_actions.c ----
# 028BE0 "LDA $1874; CMPA #$03" (the players in the game: 3 or more, the action is done at once)
local goon_keep_distance_start 028BE0 t1 players_counted
# 028C2A "LDD #$0080" / 028C2F "LDD #$FF80", 028C32 "STD #$0F,X": half a pixel a frame, A the sign
local goon_keep_distance_check 028C2A,028C2F a speed_sign
local goon_keep_distance_check 028C2A,028C2F d speed
# 028E78 "LDD #$5C,U; CMPD #$16,U" (the player's floor height against his z), 028E80 "CMPD #$5C,X" (and the goon's
# floor): both halves of the player's floor height. Was "local goon_grab_try 028E78 b step" (it is no step)
local goon_grab_try 028E78 a floor_high
local goon_grab_try 028E78 b floor_low
# 028EF5 "LBSR $861D" (vector_direction_to): the direction's whole part, the heading's (028EF8 "LDB #$30")
local goon_grab_try 028EF5 a angle
# 028EA3 "LDD #$0C,U; STD #$0C,X", 028EA9 "LDD #$11,U; STD #$11,X": the goon takes the grabbed player's place
local goon_grab_try 028EA3 t5 player_x
local goon_grab_try 028EA9 t5 player_y
# 02923D "LDA #$2D,X; LSRA x3": an eighth of the x distance to its target (its low byte) more frames to run
local goon_run_through 02923D t3 dx_low
# done: enemies/goon_actions.c

# ---- the set-ups' hit box record (all files) ----
# What a set-up hands back in Y: vector_object_setup and start_object_from_setup (07D13E "LDY #$02,U") leave the
# setup record's hit box record there, and every set-up below hands it back unchanged (C "y =
# vector_object_setup(object, setup); ... return y;", or through a set-up that does: "y = goon_base_set_up(object)",
# "hat_goon_set_up(object, &y, &ignored16)", the vectors vector_goon_setup / vector_enemy_hurt_become_goon); the
# beaten bosses' code names it box already (C "box = hit_box; vector_set_hit_box(object, box); return box;")
local hat_goon_brawler_set_up 0280C0 y box
local hat_goon_brawler_start 0280D8 y box
local goon_base_set_up 028101 y box
local goon_keeps_away_set_up 02811D y box
local goon_keeps_away_start 02812B y box
local goon_striker_set_up 028144 y box
local goon_striker_start 028157 y box
local goon_close_grabber_set_up 02817B y box
local goon_close_grabber_start 028184 y box
local goon_balloon_set_up 02819A y box
local umbrella_goon_rush_in_set_up 028314 y box
local shovel_goon_rush_in_set_up 028330 y box
local goon_striker_rush_in_set_up 028394 y box
local goon_rush_in_set_up 0283B0 y box
local goon_from_back_set_up 02840B y box
local hat_goon_waiting_set_up 02849C y box
local goon_walk_in_set_up 028550 y box
local goon_delayed_set_up 028633 y box
local shovel_goon_step_out_set_up 028692 y box
local hat_goon_step_out_set_up 028722 y box
local goon_step_out_set_up 028733 y box
local goon_striker_from_side_set_up 028825 y box
local goon_from_side_set_up 028836 y box
local goon_run_in_set_up 028895 y box
local hat_goon_jump_in_set_up 02893D y box
local goon_drop_set_up 028A12 y box
local umbrella_goon_float_down_set_up 028A62 y box
local bomb_goon_set_up 028F7E y box
local bomb_goon_start 028FA0 y box
local hat_goon_set_up 028FC4 y box
local hat_goon_start 028FE6 y box
local umbrella_goon_set_up 029015 y box
local umbrella_goon_start 029039 y box
local shovel_goon_set_up 02905D y box
local shovel_goon_start 029082 y box
local goon_bomb_run_in_set_up 02937B y box
local goon_striker_jump_in_set_up 0293F9 y box
local goon_jump_in_set_up 029426 y box
local cemetery_umbrella_goon_set_up 029577 y box
local gorilla_setup 03097A y box
local grabbing_zombie_setup 030670 y box
local enemy_hurt_become_goon 07E1B4 y box
local ghost_on_rope_setup 030462 y box
local flying_saxophone_setup 033229 y box
local flying_saxophone_shot_setup 033636 y box
local knight_setup 030C0D y box
local lumberjack_setup 030845 y box
local ninja_thrower_setup 032275 y box
local ninja_fighter_setup 03229A y box
local ninja_setup 032304 y box
local rising_zombie_setup 030568 y box
local robot_piece_setup 032A42 y box
local robot_spark_setup 032AFA y box
local robot_setup 032B4F y box
local wandering_zombie_setup 030084 y box
local zombie_setup 030125 y box
# the same through calls the list above does not follow: 030456 "LBSR $85F3" (vector_enemy_hurt_become_goon),
# 03017A (ghost_on_rope_setup's Y)
local ghost_on_rope_fall 030456 y box
local zombie_come_out 03017A y box

# ---- the nearest player (all files) ----
# "LBSR $8620" (vector_choose_nearest_player: the nearest player, also kept as its target), handed to
# vector_measure_target (or back)
local goon_base_set_up 028116 u nearest_player object
local goon_from_back_set_up 028425 u nearest_player object
local hat_goon_jump_in_leap 0289B2 u nearest_player object
local goon_drop_show 028A4C u nearest_player object
local umbrella_goon_float_down_face 028ABC u nearest_player object
local bomb_goon_set_up 028F8E u nearest_player object
local goon_bomb_run_in_stop 0293C6 u nearest_player object
local gorilla_setup 03097D u nearest_player object
local grabbing_zombie_setup 030673 u nearest_player object
local lumberjack_setup 030848 u nearest_player object
local ninja_setup_common 032312 u nearest_player object
local ninja_fall_in 0325AC u nearest_player object
local robot_setup 032B5D u nearest_player object
local wandering_zombie_wait 0300B5 u nearest_player object
local zombie_setup 030164 u nearest_player object
local zombie_start_coming_out 03018A u nearest_player object
local ghost_on_rope_fall 030447 u nearest_player object
local hat_goon_set_up 028FD4 u nearest_player object
local umbrella_goon_set_up 029027 u nearest_player object
local shovel_goon_set_up 029070 u nearest_player object

# ---- a goon's behaviour handed back in U ----
# 028FDA "LDU #$7D37", 02902D "LDU #$7D8F", 029076 "LDU #$7DE7" (then "STU #$2A,X": the goon's behaviour), handed
# back; and what their callers, vector_goon_setup (07D42F "LDU #$F144") and vector_enemy_hurt_become_goon (07D450,
# C "*p_behaviour = behaviour") hand back
local hat_goon_set_up 028FDA u behaviour_address
local umbrella_goon_set_up 02902D u behaviour_address
local shovel_goon_set_up 029076 u behaviour_address
local hat_goon_run_across_set_up 0282B8 u behaviour_address
local umbrella_goon_rush_in_set_up 028314 u behaviour_address
local shovel_goon_rush_in_set_up 028330 u behaviour_address
local goon_rush_in_set_up 0283B0 u behaviour_address
local ghost_on_rope_fall 030456 u behaviour_address

# ---- enemies/goons.c ----
# 028719 / 02872A / 028689 "ASLB", then "JSR [B,U]": the doubled state the entrance's handler is picked by
local hat_goon_step_out 028719 t2 state_offset
local goon_step_out 02872A t2 state_offset
local shovel_goon_step_out 028689 t2 state_offset
# 02866C / 0286C5 "LDA #$29,X", 02866F / 0286C8 "ASLA", then "JMP [A,U]": the doubled step
local goon_delayed_step 02866F t2 step_offset
local shovel_goon_step_out_step 0286C8 t2 step_offset
# 0281C4 "LDD #$0C,U; STD #$0C,X", 0281CA "LDD #$11,U; STD #$11,X": the balloon at its goon's place, 0281D0 "LDD
# #$16,U; ADDD #$003C; STD #$16,X" 3C higher
local goon_balloon_set_up 0281C4 t5 goon_x
local goon_balloon_set_up 0281CA t5 goon_y
local goon_balloon_set_up 0281D3 t2 balloon_z
# 028244 "LDD ,U; STD #$0C,X" (goon_descent_starts' x), 02843E / 028A7B / 029411 / 0294C0 / 029572 "LDD A,U; STD
# #$0C,X" (the x the goon starts at, from its table by its spawn's parameter)
local goon_descent_set_up 028244 t4 start_x
local goon_from_back_place 02843E t4 start_x
local umbrella_goon_float_down_set_up 028A7B t4 start_x
local goon_jump_in_place 029411 t4 start_x
local goon_from_below_set_up 0294C0 t4 start_x
local cemetery_umbrella_goon_set_up 029572 t4 start_x
# 0282E4 "LDD #$0C,X; CMPD #$0100", 0284FE / 0285B3 / 0288E4 / 02897F "LDD #$0C,X; CMPD #$3E,X" (the x the scroll
# must bring it to), 02939F / 029443 / 0294E4 "LDD #$0C,X; CMPD #$00E0" (it goes toward the middle)
local hat_goon_run_across_wait 0282E4 t5 goon_x
local hat_goon_waiting_for_scroll 0284FE t5 goon_x
local goon_walk_in_wait_for_scroll 0285B3 t5 goon_x
local goon_run_in_go 0288E4 t5 goon_x
local goon_wait_for_scroll 02897F t5 goon_x
local goon_bomb_run_in_set_up 02939F t5 goon_x
local goon_jump_in_run 029443 t5 goon_x
local goon_from_below_set_up 0294E4 t5 goon_x
# 028581 / 0288B7 "ASLDI #$04", "STD #$3E,X": the start record's x byte times 16, the x the scroll must bring it to
local goon_walk_in_set_up 028581 t2 scaled_trigger_x
local goon_run_in_set_up 0288B7 t2 scaled_trigger_x
# 028A1C "ANDB #$0F", 028A1E / 028A8E "ASLDI #$03", "STD #$5C,X": the floor's height under it (its level times 8)
local goon_drop_set_up 028A1E t2 floor_height
local umbrella_goon_float_down_set_up 028A8E t2 floor_height
# 028A32 "LDD A,U; STD #$3E,X" (goon_drop_xs: the x the scroll must bring it to)
local goon_drop_set_up 028A32 t4 drop_x
# 029454 / 029493 / 0294F4 / 02953F "LDD <$E2; STD #$19,X": the cemetery ground's scroll speed, as its z speed
local goon_jump_in_run 029454 t4 ground_speed
local goon_jump_in_leap 029493 t4 ground_speed
local goon_from_below_set_up 0294F4 t4 ground_speed
local goon_from_below_leap 02953F t4 ground_speed
# 029507 "LDD #$16,X; BMI": its height, still below the floor while negative
local goon_from_below_leap 029507 a z_high
local goon_from_below_leap 029507 d z_low
# 0295A5 "LDD #$19,X", 0295A8 "SUBD #$0010": a sixth of the gravity
local cemetery_umbrella_goon_float_down 0295A8 t2 falling_z_speed
# done: enemies/goons.c

# ---- enemies/gorilla.c ----
# 0309CB "ASLDI #$04" (gorilla_entrances' x byte times 16: the x the scroll must bring it to)
local gorilla_entrance_setup 0309CB t2 scaled_entrance_x
# 0309E6 / 030A3F / 030A8E "LDD #$0C,X; CMPD #$3E,X": its x against the x it comes in at
local gorilla_wait_for_place 0309E6 t5 gorilla_x
local gorilla_walk_right_in 030A3F t5 gorilla_x
local gorilla_walk_left_in 030A8E t5 gorilla_x
# 030A19 "CMPA #$5D,X": its floor's height (low byte) against the floor map's under it
local gorilla_reach_floor 030A19 t3 own_floor
# 030B04 "LDD A,U; STD #$19,X" (gorilla_leap_speeds by the difficulty)
local gorilla_leap_take_off 030B04 t4 leap_speed
# done: enemies/gorilla.c

# ---- enemies/grabbing_zombie.c ----
# 0306C1 "ASLDI #$04; STD #$0C,X": kind_97_entrances' x byte times 16
local grabbing_zombie_place 0306C1 t2 start_x
# as goon_grab_try: 030750 "LDD #$5C,U; CMPD #$16,U" (the player's floor height), 0307CD "LBSR $861D" (the
# direction's whole part), 03077B "LDD #$0C,U; STD #$0C,X", 030781 "LDD #$11,U; STD #$11,X" (the player's place)
local zombie_grab_reach 030750 a floor_high
local zombie_grab_reach 030750 b floor_low
local zombie_grab_reach 0307CD a angle
local zombie_grab_reach 03077B t5 player_x
local zombie_grab_reach 030781 t5 player_y
# done: enemies/grabbing_zombie.c

# ---- enemies/hurt.c ----
# 07E225 "LDD #$0C,U" (the hitter's x), 07E228 "CMPD #$0C,X": knocked away from a standing hitter
local enemy_hurt_start 07E225 t5 hitter_x
local enemy_hurt_start 07E228 t5 enemy_x
# 07E290 "LDD #$4C,X; BEQ", 07E295 "LBRA $97D3" (queue_sound): the sound of the marked frame
local enemy_hurt_lie_defeated 07E290 a sound_high
local enemy_hurt_lie_defeated 07E290 d sound_low
# 07E27E "LBRA $E1AE" (enemy_hurt_become_goon hands back the hit box record in Y and the behaviour in U)
local enemy_hurt_lie_defeated 07E27E y box
local enemy_hurt_lie_defeated 07E27E u behaviour_address
# done: enemies/hurt.c

# ---- enemies/ghost_on_rope.c ----
# 030497 "LDD #$0C,X", 03049A "ADDD <$AC; STD #$2A,X": its place along the stage (x plus the camera's)
local ghost_on_rope_setup 030497 t5 dropper_x
local ghost_on_rope_setup 03049A t6 place_in_stage
# 0304A9 "LDD #$0C,X; CMPD #$0100"
local ghost_on_rope_wait_mode 0304A9 t5 dropper_x
# done: enemies/ghost_on_rope.c

# ---- enemies/flying_saxophone.c ----
# 03320E "LDD #$0C,X" (the flyer's x), 033211 "CMPD #$0C,U" (its player's)
local flying_saxophone_face_player 03320E t5 flyer_x
local flying_saxophone_face_player 033211 t5 player_x
# 033259 "LDD A,U; STD #$3E,X" (flying_saxophone_descent_slowdowns), 033265 "LDD A,U; STD #$52,X" (flying_saxophone_descent_y_speeds)
local flying_saxophone_setup 033259 t4 descent_slowdown_value
local flying_saxophone_setup 033265 t4 descent_speed
# flying_saxophone_steer, the same routine as cloud_devil_steer: 0334EF "LDU #$38,X", 0334F9 "LBSR $8620", 0334FF
# "CMPD #$0C,U" reads his x (C "t2 = mem_read16(target_player + 0xCu)")
local flying_saxophone_steer 0334EF,0334F9,033565 u target_player object
local flying_saxophone_steer 0334FC t5 flyer_x
local flying_saxophone_steer 0334FF t5 player_x
local flying_saxophone_steer 033552 t2 turn
local flying_saxophone_steer 033522 t2 turn
local flying_saxophone_steer 033553 t7 new_heading
local flying_saxophone_steer 03353D t7 new_heading
local flying_saxophone_steer 033523 t7 new_heading
local flying_saxophone_steer 03350D t7 new_heading
local flying_saxophone_steer 033510,033526,033540,033556 a heading_whole
local flying_saxophone_steer 033568 t5 flyer_y
local flying_saxophone_steer 03356B t5 player_y
local flying_saxophone_steer 03356B t7 dy
local flying_saxophone_steer 03356B a dy_high
local flying_saxophone_steer 033571 t1 dy
local flying_saxophone_steer 033571 t3 depth_distance
local flying_saxophone_steer 033585 t5 flyer_x
local flying_saxophone_steer 033585 a goal_x_high
local flying_saxophone_steer 033585,03358D,033597 b goal_x_low
local flying_saxophone_steer 03359A t5 flyer_x
local flying_saxophone_steer 0335A3 t5 flyer_y
local flying_saxophone_steer 0335A3 a goal_y_high
local flying_saxophone_steer 0335A3,0335AB,0335B5 b goal_y_low
local flying_saxophone_steer 0335B8 t5 flyer_y
# 03360C "LDA #$2E,X; ASLA; ASLA" (the heading's whole part: its velocity record)
local flying_saxophone_set_speeds 03360C t3 heading_whole
# 033658 "LDD A,U; STD #$0F,X" (flying_saxophone_shot_speeds, one of four at random)
local flying_saxophone_shot_setup 033658 t4 shot_x_speed
# done: enemies/flying_saxophone.c

# ---- enemies/knight.c ----
# 030C49 "ASLDI #$04; STD #$0C,X": knight_entrances' x byte times 16
local knight_setup 030C49 t2 start_x
# 030D1C "LDD #$0C,X; CMPD #$0160"
local knight_walk_in 030D1C t5 knight_x
# done: enemies/knight.c

# ---- enemies/lumberjack.c ----
# 030886 (lumberjack_axe_rest hands back the hit box record it set: C "*p_box = box")
local lumberjack_jump_in 030886 y box
# 0308C4 "SUBD #$0030; STD #$19,X": gravity on its z speed
local lumberjack_land 0308C4 t2 falling_z_speed
# done: enemies/lumberjack.c

# ---- enemies/ninja.c ----
# 0323EB / 03246B "SUBD #$0020; STD #$19,X": gravity on its z speed
local ninja_drop_land 0323EB t2 falling_z_speed
local ninja_leap_land 03246B t2 falling_z_speed
# 03244A "CMPA #$17,X": z's low byte against the floor's height under it
local ninja_leap_find_floor 03244A t3 z_low
# 0324A3 "LDD #$0C,X; CMPD #$00E0"; 03282C "LDD #$0C,X; SUBD #$0048" (it bounces once off the screen's edge)
local ninja_run_and_jump_in 0324A3 t5 ninja_x
local ninja_rush_leap 03282C t5 ninja_x
# 032799 "LDD #$0C,X", 03279C "SUBD #$0040; CMPD #$0140": outside 0040-017F it has bounced already
local ninja_rush_start 032799 t5 ninja_x
local ninja_rush_start 03279C t2 screen_offset
# 032626 "LBRA $862F" (spawn_list_2_child hands back the star it put in, in U)
local ninja_throw_release 032626 u star object
# done: enemies/ninja.c

# ---- enemies/reactions.c ----
# 07E08B "LDD #$11,X", 07E08E "SUBD <$B2; CMPD #$00A0": its y on the screen (less the camera's y)
local enemy_defeated_launch 07E08B t5 enemy_y
local enemy_defeated_launch 07E08E t6 screen_y
# 07E0AF / 07E0EF "SUBD #$0020", 07E172 "SUBD #$0040" (and 07E177 "CMPD #$FC00", no faster than FC00): gravity on its
# z speed
local enemy_defeated_fly 07E0AF t2 falling_z_speed
local enemy_defeated_shrink 07E0EF t2 falling_z_speed
local enemy_pit_fall 07E172 t2 falling_z_speed
local enemy_pit_fall 07E172 a z_speed_high
local enemy_pit_fall 07E172 d z_speed_low
# done: enemies/reactions.c

# ---- enemies/rising_zombie.c ----
# 030570 "LDU $1854; STU #$40,X": the object it drifts toward, which another keeps in the K052109's RAM
local rising_zombie_setup 030570 t3 drift_object
# done: enemies/rising_zombie.c

# ---- enemies/robot.c ----
# 032A9F "SUBD #$0030; STD #$19,X": gravity on its z speed
local robot_piece_bounce 032A9F t2 falling_z_speed
# 032CC4 / 032D02 / 032D40 "LDY A,Y; BMI": the child record of the sparks of this frame (none when negative)
local robot_advance_shock_sparks 032CC4 t4 spark_record
local robot_shock_92_sparks 032D02 t4 spark_record
local robot_shock_91_sparks 032D40 t4 spark_record
# 032E0E "BSR $6E17" (robot_put_in_pieces hands back, in Y, the piece record after the last it put in)
local robot_explode 032E0E y piece_record
# 032E2D "DEC <$F4; BNE": the pieces left to put in
local robot_put_in_pieces 032E2D t2 pieces_before
# 032E5D "LBRA $862F" (spawn_list_2_child hands back the part it sent off, in U)
local robot_launch_part_release 032E5D u part object
# done: enemies/robot.c

# ---- enemies/zombies.c ----
# 0301AA "LDD #$0C,X; CMPD #$00E0": it walks in toward the middle
local zombie_start_coming_out 0301AA t5 zombie_x
# done: enemies/zombies.c

# ---- players/effects.c ----
# 039B3F "LDD #$17,U" (z's low byte and its fraction), 039B42 "ADDD #$19,U" (plus the z speed), 039B47-039B4A the high
# byte with the carry: the next height, 039B4D "CMPD #$5C,U" against the floor
local player_next_height_against_floor 039B3F t5 z_and_fraction
local player_next_height_against_floor 039B42 t6 z_and_fraction
local player_next_height_against_floor 039B4D t6 next_z
local player_next_height_against_floor 039B4D t7 next_height_above_floor
# 039B5C "LDX #$3F,U": the heavy object the player works at (field held), whose x 039B5F "LDY #$0C,X" reads (C "t1 =
# mem_read16(held + 0xCu)"); 039B65 / 039B6E "CMPY #$0C,U" the player's x
local player_face_heavy_object 039B5C x held object
local player_face_heavy_object 039B5F t5 held_x
local player_face_heavy_object 039B65 t5 player_x
local player_face_heavy_object 039B6E t5 player_x
# 039BCF "LDD #$0C,U" (the player's x), 039BD2 "CMPD #$0C,X" (the hitter's), 039BD7 "ADDD #$0010" / 039BDC "SUBD
# #$0010": the spark's x, 10 toward the hitter; 039BE6 "ADDD #$11,U" (the player's y)
local player_show_hurt_spark 039BCF t5 player_x
local player_show_hurt_spark 039BD2 t5 hitter_x
local player_show_hurt_spark 039BCF,039BD7,039BDC d spark_x
local player_show_hurt_spark 039BE6 t5 player_y
# Y: the spark's height above the player's (its callers: C "y = hit_spark_height_ADDRESS" or
# "hit_spark_height_in_air_ADDRESS"), 039BFC "PUSHS Y", 039C06 "PULLS Y", 039C13 "LDB ,Y"; 039C1F the object the
# blow hit (field object_hit), whose x 039C22 reads (C "t2 = mem_read16(y_2 + 0xCu)")
param player_show_hit_spark y spark_height
local player_show_hit_spark 039C06 y spark_height
local player_show_hit_spark 039C1F y hit_object object
local player_show_hit_spark 039C0A t5 player_y
local player_show_hit_spark 039C22 t5 hit_x
# done: players/effects.c

# ---- players/players.c ----
# A player's variables, 8 bytes from 49D0 + 8 x player (the player records point into them; 1848 holds the running
# player's: 03801B "LDX #$49D0; STX $1848" ... player_run's X): its lives (00, a word: 038FD9 "LDD [$1848]; CMPD #$0001"), the
# life it keeps (02: 03813B "LDB #$02,X; STB #$1B,U"), where its object is (03: 0380B5 "TST #$03,X", 038141 "LDB
# #$01; STB #$03,X", 039305 "LDX $1848", 039309 "LDA #$02", 03930B "STA #$03,X", 039054 "LDX $1848", 039058 "CLR #$03,X"), its score (04, BCD: 49D4 + 8n), its grab
# hints (06: 0395B9 "LDA #$06,Y; CMPA #$05"), its state (07: 07B985 "LDY #$49D0; LDB #$07,Y; CMPB #$03");
# symbols.txt names their bytes for each player (marge_entry_status, homer_lives, marge_score, marge_grab_hints,
# marge_state...)
struct player_values 08
field player_values 00 lives u16
field player_values 02 kept_life u8
field player_values 03 entry_status u8
field player_values 04 score u16
field player_values 06 grab_hints u8
field player_values 07 state u8
# A coin slot's record, 8 bytes from 4817 + 8 x slot (the note at slot_credits: add_coin 0791F7-079244 by U), which
# update_players hands each player's state routine in U (07B70D "LDU #$4817", 07B724 "LEAU #$08,U"): its credits
# when each slot has its own (00: 07B744 / 07B7F7 / 07B85B "LDD #$00,U", 07B784 "LDY #$00,U", 07B797 "STD #$00,U"),
# the coins towards a credit (02: 0791F7 "INC #$02,U"), the coin counter's pulses (03) and their time (04), the
# coins a credit takes (05) and the credits they give (06), whether it gave a credit already (07: 079244 "STA
# #$07,U", 07B89A "CLR #$07,U")
struct coin_slot 08
field coin_slot 00 own_credits u16
field coin_slot 02 coins u8
field coin_slot 03 counter_pulses u8
field coin_slot 04 counter_time u8
field coin_slot 05 coins_per_credit u8
field coin_slot 06 credits_per_coins u8
field coin_slot 07 credit_given u8
local update_players 07B70D,07B724 u slot coin_slot
param player_out u slot coin_slot
param player_join u slot coin_slot
param player_playing u slot coin_slot
param player_continue_countdown u slot coin_slot
param player_game_over u slot coin_slot
# A player's counters, 7 bytes from 4A00 + 7 x player (the player records' countdown, field 07, and the gauge
# records' counters, field 02): the continue's countdown, BCD seconds (00: 07B82B "LDA #$20; STA [#$07,X]", 07B87E
# "LDA #$99; ADDA ,Y; DAA; STA ,Y") and its frames (01: 07B871 "INC #$01,Y; LDA #$01,Y; CMPA #$3C"), or game over's
# frames (00: 07B89D "INC [#$07,X]; LDA [#$07,X]; CMPA #$C0"); the health gauge's shown step (02: 040A0D "CMPB
# #$02,U", 040A34 "STA #$02,U") and the frames until its next step (03: 040A20 "TST #$03,U", 040A39 "STB #$03,U",
# 0408EE "LDA #$03,Y; DECA; STA #$03,Y"). symbols.txt calls bytes 02-06 unused (unused_marge_word_1 at 4A02...):
# the gauge uses 02 and 03 through this pointer
struct player_counters 07
field player_counters 00 seconds u8
field player_counters 01 frames u8
field player_counters 02 gauge_step u8
field player_counters 03 gauge_delay u8
# 07B86E "LDY #$07,X": the player's counters
local player_continue_countdown 07B86E y countdown_digits player_counters
# player_run's X: the player's variables (the callers' records), 03812B "PULLS D,X" the same back; 0380E2 "LDX
# #$32,U" its partner (0380EB "CLR #$38,X" its state frames: C "mem_write8(record + 0x38u, 0u)"); 03817D / 0381A3
# "TFR U,X" the player for vector_floor_ahead; 03824A "LDX #$0E00; STX #$0F,U" the x speed it jumps in with
param player_run x record player_values
local player_run 03812B x record player_values
local player_run 0380E2 x partner_object object.player
local player_run 03817D,0381A3 x entering_player object
local player_run 03824A x entry_speed
# 038003 "CLR $184C", 038007 "CLR $184D", 038076 "CLR $184E" (a clear reads first: the counts of the last frame,
# unused), 03807A "TST $184B" (the stage over), 038080 "LDA $184C" then "CMPA #$04" (the players standing idle)
local player_run_all 038003 t1 last_idle_players
local player_run_all 038007 t1 last_heavy_workers
local player_run_all 038076 t1 last_all_idle
local player_run_all 03807A t1 stage_is_over
local player_run_all 038080 t1 idle_players
local player_run_all 038080 a idle_players
# 03808F "LDA #$04", 0380A7 "DECA" then "BNE": the players' objects left to look at
local player_run_all 03808F,0380A7 a players_left
local player_run_all 0380A7 t1 players_before
# 03809B "TST #$3F,X": the held object's high byte (one is held)
local player_run_all 03809B t3 held_high
# 0380B0 "INC $184C" (one more player idle), 0380BB "TST $184B" (the stage over), 0380F7 "TST $184E" (all idle)
local player_run 0380B0 t1 idle_players
local player_run 0380BB t1 stage_is_over
local player_run 0380F7 t1 all_idle
# 0380AB "BITA <$50": B the player's number (C "b = (uint8_t)bit_and_number")
local player_run 0380AB b player_number
# 0380B5 "TST #$03,X" (where its object is), 03813B "LDB #$02,X" (the life it keeps)
local player_run 0380B5 t3 entry_status
local player_run 03813B t3 kept_life
# 038112 "CLRA", 038113 "BSET A,X,U": the object cleared from field 1C
local player_run 038112 a clear_value
# 03814E "LDA <$67" then "CMPA #$04" (the scene: 4 and 0B drop the player in from above)
local player_run 03814E a scene_number
# 038159 "LDB #$04,U", "ASLB" x5, 038161 "SEX", 038162 "ADDD #$00D0": its kind times 32 plus D0, the x it drops in at (kept in 1858)
local player_run 038161 t1 kind_offset
local player_run 038162 t2 drop_x
local player_run 038162 a drop_x_high
local player_run 038162 b drop_x_low
# 03817F / 0381A5 "LBSR $863B" (vector_floor_ahead), 038182 "INCA": the floor ahead, FF none
local player_run 03817F,0381A5 a floor_value
# 038185 / 03819A "LDD #$0C,U", 038188 "SUBD #$0010" / 03819D "ADDD #$0010": 16 pixels on, 038193 "LDX $1858" the
# first x tried
local player_run 038185 t5 player_x
local player_run 038188 t2 moved_x
local player_run 03819A t5 player_x
local player_run 03819D t2 moved_x
local player_run 038193 t3 first_drop_x
# 03818E / 0381DB / 0381F8 "DEC <$F1" then "BNE": the tries left
local player_run 03818E t2 tries_before
local player_run 0381DB t2 tries_before
local player_run 0381F8 t2 tries_before
# 0381D2 / 0381EF "LDY #$11,U", 8 nearer or farther each try
local player_run 0381D2 t5 player_y
local player_run 0381EF t5 player_y
# 03822F "ADDD #$0020; STD #$16,U": 20 above the highest floor met; 03823B-038244 its kind times 32 less 10, the x it
# jumps in from
local player_run 03822F t2 entry_z
local player_run 038243 t1 kind_offset
local player_run 038244 t2 entry_x
# 03821B "LDX #$0C,U; LEAX #$08,X": 8 pixels on each place; "DEC <$F2" the places left
local player_find_entry_floor 03821B t5 player_x
local player_find_entry_floor 038224 t2 places_before
# 07B729 "LDA ,S" then "CMPA #$04": the players done
local update_players 07B729 a players_done
# player_out: 07B739 "LDD <$37" (the shared credits) or 07B744 "LDD #$00,U" (the slot's own), 07B73E / 07B749 "LDA
# #$01" (A 1 when there is a credit), handed back in D
local player_out 07B739 t4 shared_credits
local player_out 07B744 t5 own_credits
local player_out 07B739,07B73E,07B744,07B749 a credits_high
local player_out 07B739,07B744 d credits_low
local player_out 07B743,07B74E d credits_word
# player_join / player_playing: 07B75C / 07B77B "LDA [,X]; ANDA #$B0" (start or a button newly pressed), 07B757 /
# 07B763 "LDD <$37" (the shared credits), 07B766 "SUBD #$0001", 07B7F2 "LDA <$3B" (each slot its credits), 07B7F7
# "LDD #$00,U" (the slot's own), 07B781 / 07B7FC "LDB [#$04,X]" the lives, 07B787 / 07B802 "ADDB <$5A" a credit's
# lives each coin (FF at most), 07B78E / 07B809 "LEAY #$-01,Y" the coins left; 07B7B6 "LDD [#$09,X]" the last score
local player_join 07B77D t2 start_pressed
local player_join 07B75E t2 start_pressed
local player_join 07B757 t4 shared_credits
local player_join 07B763 t4 shared_credits
local player_join 07B766 t2 credits_left
local player_join 07B787 t2 lives_added
local player_join 07B787 t3 lives_before
local player_join 07B78E t2 coins_left
local player_join 07B781,07B787,07B78C b new_lives
local player_join 07B7B6 t8 last_score
local player_playing 07B7F2 t2 own_slots
local player_playing 07B7F7 t5 own_credits
local player_playing 07B802 t2 lives_added
local player_playing 07B802 t3 lives_before
local player_playing 07B809 t2 coins_left
local player_playing 07B7FC,07B802,07B807 b new_lives
# player_continue_countdown: 07B84D "LDD <$37", 07B85B "LDD #$00,U" (a credit lets it join again), 07B869 "LDA <$6A"
# (the gauges shown), 07B871 "INC #$01,Y" and 07B874 "LDA #$01,Y" (the frames), 07B87E "LDA #$99; ADDA ,Y; DAA" (a
# second less)
local player_continue_countdown 07B84D t4 shared_credits
local player_continue_countdown 07B85B t5 own_credits
local player_continue_countdown 07B869 t2 gauges_on
local player_continue_countdown 07B871 t3 frames_before
local player_continue_countdown 07B874 t3 frames_now
local player_continue_countdown 07B880 t2 seconds_now
local player_continue_countdown 07B880 t4 seconds_sum
local player_continue_countdown 07B882 a seconds_left
# 07BA44 "DECB" then "BNE": the players' bits left to count
local count_players_in_game 07BA44 t1 players_before
# 07BA81 "DEC <$F0" then "BNE": the objects left to look at
local award_enemy_points 07BA81 t2 objects_before
# done: players/players.c

# ---- players/gauges.c ----
# gauges_draw: 040906 "CLRA", 040919 "INCA; CMPA #$04" (the player whose quarter is drawn); 04092D "LDD <$37" (the
# credits), 040937 "LBSR $69CF" (gauges_byte_to_bcd: B in, the BCD byte back in A), 04093C "LDA #$99" (past 99)
local gauges_draw 040906,040919 a player_index
local gauges_draw 04092D t4 credits_count
local gauges_draw 040937 d bcd_value
local gauges_draw 040937,04093C a credits_bcd
# gauges_count_delays: 0408EB "LDY #$02,X" (the player's counters, struct player_counters), 0408EE "LDA #$03,Y; BEQ;
# DECA; STA #$03,Y" (its gauge's step delay), 0408E2 "CLRA" / 0408F9 "LDA ,S; CMPA #$04" (the player)
local gauges_count_delays 0408EB y gauge_counters player_counters
local gauges_count_delays 0408E2,0408F9 a player_index
local gauges_count_delays 0408EE,0408F3 a delay
local gauges_count_delays 0408EE t3 old_delay
# gauge_draw_player: 040970 "LDA [#$16,X]" (the player's state: 3 continue, 4 game over, 1 and 5 joining), 04096D
# "LDB #$01; LBSR $6BCE" (picture 1 in its quarter), 0409AF "LDD [#$06,X]" (its lives), 0409BA "BSR $69CF" (in BCD:
# A back, 0409BE "LDA #$99" past 99), 0409C6 "BSR $69F2" (gauge_draw_health hands back the gauge record in X),
# 0409C8 "LDA #$01,X" (its quarter)
local gauge_draw_player 040970 a player_status
local gauge_draw_player 04096D d quarter_and_picture
local gauge_draw_player 0409AF t8 lives_count
local gauge_draw_player 0409BA d bcd_value
local gauge_draw_player 0409BA,0409BE a lives_bcd
local gauge_draw_player 0409C6 x gauge_player gauge_player
local gauge_draw_player 0409C8 t3 quarter
# gauges_byte_to_bcd: 0409DD "ADDA ,U" (the BCD value of the bit: bcd_bit_values), 0409DF "DAA", 0409E9 "DEC ,S;
# BNE" (the bits left)
local gauges_byte_to_bcd 0409DD t2 bit_value
local gauges_byte_to_bcd 0409DD t4 bcd_sum
local gauges_byte_to_bcd 0409DF t1 adjusted_bcd
local gauges_byte_to_bcd 0409E9 t2 bits_before
# gauge_draw_health: 0409F2 "LDU #$02,X" (the player's counters: 040A0D "CMPB #$02,U", 040A20 "TST #$03,U", 040A34
# "STA #$02,U", 040A39 "STB #$03,U"); 040A3C "LDU #$0E,X" the gauge's first tile in the K052109's RAM, 040A9E
# "LEAU #$01,U" the next
local gauge_draw_health 0409F2 u gauge_counters player_counters
local gauge_draw_health 040A3C,040A9E u gauge_tile
# 0409F5 "LDA #$1F", 0409F7 "LDB [#$0C,X]" (the player's health), 0409FC "MUL", 040A05 "DIV X,B" (by 28), 040A0A
# "INCB": the step the health makes; 040A14 "CLRB" / 040A17 "LDB #$01" / 040A1B "LDB #$02" (up, down, there)
local gauge_draw_health 0409F5 a gauge_scale
local gauge_draw_health 0409F7 t6 health_value
local gauge_draw_health 0409FC t1 scaled_health
local gauge_draw_health 0409F7,040A0A b target_step
local gauge_draw_health 040A14,040A17,040A1B b step_change
# 040A0D "CMPB #$02,U", 040A1D "LDA #$02,U" (the shown step), 040A20 "TST #$03,U" (its delay); 040A2E "INCA" /
# 040A33 "DECA" one step toward it, then 8 steps each of the gauge's 4 tiles (040A99 "SUBA #$08", 040A9D "CLRA")
local gauge_draw_health 040A0D t3 shown_step
local gauge_draw_health 040A1D t3 shown_step
local gauge_draw_health 040A20 t3 step_delay
local gauge_draw_health 040A1D,040A2E,040A33,040A65,040A7E,040A97,040A99,040A9D a gauge_steps
local gauge_draw_health 040A3C t5 first_tile
# 040A54 "LDA ,Y+" (the step's tiles: gauge_step_tiles), 040A99 "SUBA #$08", 040AA1 "DEC ,S; BNE" (the tiles left)
local gauge_draw_health 040A54 t1 step_record
local gauge_draw_health 040A99 t1 steps_before
local gauge_draw_health 040AA1 t2 tiles_before
# gauge_print_count: 040AC1 "ANDA #$F0" (the tens), 040AC5 "LDA #$A0" (a blank for 0), 040ACD "LDA ,Y+" (the digit's
# attribute), 040ACF / 040AF4 "ORA #$01,S" (with the player's colour), 040ADA "LDB ,Y+" (its top tile); 040AF2,
# 040AFF the units'
local gauge_print_count 040AC1 t2 tens_nibble
local gauge_print_count 040AC1,040AC5 a tens_index
local gauge_print_count 040ACF,040AF4 a digit_attribute
local gauge_print_count 040ACD t1 tens_record
local gauge_print_count 040ADA t1 tens_cursor
local gauge_print_count 040AF2 t1 units_record
local gauge_print_count 040AFF t1 units_cursor
# continue_draw_count: 040B44 "LDA $4A1C" (the continue's seconds, BCD), 040B4A-040B4D "LSRA" x4 (the tens),
# 040B59 "PULLS A" (the tens again: 80, blank, for 0)
local continue_draw_count 040B44 a seconds
local continue_draw_count 040B4D a tens
local continue_draw_count 040B59,040B5E a tens_or_blank
# gauges_put_picture: 040B8A "LDD ,U++" (the picture's size: columns, rows), 040B8E "LDA ,U+" (its colour); 040BA4
# "LDA ,U+", 040BA6 "STA ,X+" (each tile), 040BB6 "STA ,X+" (a blank one), 040BA8 / 040BB8 "DEC #$01,S" (the
# columns left), 040BC4 "DEC #$03,S" (the rows left)
local gauges_put_picture 040B8A t1 header
local gauges_put_picture 040B8A t4 picture_size
local gauges_put_picture 040B8E t1 colour_address
local gauges_put_picture 040BB6 t1 blank_place
local gauges_put_picture 040BB8 t3 columns_before
local gauges_put_picture 040BA4 t1 source
local gauges_put_picture 040BA6 t1 tile_place
local gauges_put_picture 040BA8 t3 columns_before
local gauges_put_picture 040BC4 t3 rows_before
# gauge_draw_picture: 040BCE "PUSHS U,X,D" (A the player's quarter, bit 7 blank), each part of the picture: 040BF6
# "LDU ,X++" (its first tile), 040BFD "LDA ,X+" (columns), 040C02 "LDA ,X+" (rows), 040C07 "LDA ,X+; ORA #$03,S"
# (its colour with the player's; 040C11 "CLRA" blank), 040C22 "LDA ,X+", 040C24 "STA ,U+" (each tile), 040C26 /
# 040C32 "DEC" (columns, rows left), 040C37 "LDA ,X+; BEQ" (0: another part follows)
local gauge_draw_picture 040BCE a quarter_byte
local gauge_draw_picture 040C09,040C11 a part_colour
local gauge_draw_picture 040BF6 t1 part
local gauge_draw_picture 040BFD t1 columns_address
local gauge_draw_picture 040C02 t1 rows_address
local gauge_draw_picture 040C07 t1 colour_address
local gauge_draw_picture 040C22 t1 source
local gauge_draw_picture 040C24 t1 tile_place
local gauge_draw_picture 040C26 t3 columns_before
local gauge_draw_picture 040C32 t3 rows_before
local gauge_draw_picture 040C37 t1 end_mark
# done: players/gauges.c

# ---- players/motion.c ----
# 039865 "LDX $1848", 039869 "STB #$02,X": the running player's variables (struct player_values, 1848 set by
# player_run_all), the life it keeps (C "t8 = io_read16(0x1848u); mem_write8(t8 + 2u, vitality_3)")
local player_keep_life 039865 x player_vars player_values
local player_keep_life 039865 t3 player_vars
local player_check_motion 039865 x player_vars player_values
local player_check_motion 039865 t3 player_vars
# 0397A7 "LDD #$12,U" (y's low byte and fraction), 0397AA "ADDD #$14,U", 0397B3 "ADCA #$11,U": the next y, against
# the back line (0397B8 "CMPD #$0098"); 0397C3 "LDD #$0D,U", 0397C6 "ADDD #$0F,U", 0397CF "ADCA #$0C,U", 0397D2
# "PULLS B": the next x (A, B), against the screen's edges
local player_check_motion 0397A7 t5 y_and_fraction
local player_check_motion 0397AA t6 y_and_fraction
local player_check_motion 0397B3 t3 y_high
local player_check_motion 0397C3 t5 x_and_fraction
local player_check_motion 0397C6 t6 x_and_fraction
local player_check_motion 0397CF t3 x_high
local player_check_motion 0397CF,0397FE a next_x_high
local player_check_motion 0397D2 b next_x_low
# 0397F9 "LDA <$67", 0397FC "CMPA #$04" (scene 4 lets it 10 farther right)
local player_check_motion 0397FC t1 scene_number
# 039812 "LBSR $863B" / 039820 "LBSR $8644" / 039838 "LBSR $8647" (the floor ahead, both ways, across, on the floor),
# then 039818 / 039826 / 03983E "LBSR $7794" (player_floor_against_height: the floor's height in D)
local player_check_motion 039812,039820,039838 a floor_value
local player_check_motion 039818,039826,03983E a floor_high
local player_check_motion 039818,039826,03983E b floor_low
# player_floor_against_height: 039794 "TFR A,B" (A the floor map's block flags), 03979B "ANDB #$0F", 03979D-03979F
# "ASLB" x3, 0397A0 "SEX" (the floor's height), 0397A1 "CMPD #$16,U" (against the player's z)
local player_floor_against_height 039794 a block_flags
local player_floor_against_height 0397A0 t1 floor_height_byte
local player_floor_against_height 0397A0 a height_high
local player_floor_against_height 0397A0 b height_low
local player_floor_against_height 0397A1 t6 floor_height_word
local player_floor_against_height 0397A1 t7 height_difference
# 03986F "LBSR $863B" (vector_floor_ahead: the cell in D)
local player_floor_at_next_place 03986F b floor_low
# 03988F "LDY #$7F21", 039892 "LEAY A,Y", 039894 "LDD ,Y++": the joystick's velocity record
local player_steer 039894 t1 velocity_record
# player_request_scroll: 0398AB "LDX #$0C,U" (the player's x), the scroll lines across 0398BB / 0398F5 (118 / 98) the
# other players must be behind; 03992E "LDX #$11,U" (its y), 03993B "CMPX $1840" / 03997C "CMPX $1842" (the lines
# past which a walk on the floor scrolls), 039942 "LDX $1846" / 039983 "LDX $1844" (the lines the others must be
# past); 039931 "LDD ,Y; STD #$14,U" (the y speed), 0399BE "ADDD <$E6; STD <$E6" (added to the players' push)
local player_request_scroll 0398AB x place_x
local player_request_scroll 0398AB t5 place_x
local player_request_scroll 0398BB,0398F5 x scroll_line_x
local player_request_scroll 03992E x place_y
local player_request_scroll 03992E t5 place_y
local player_request_scroll 039942,039983 x others_line_y
local player_request_scroll 039931 a y_speed_high
local player_request_scroll 039931 b y_speed_low
local player_request_scroll 039933 t3 new_y_speed
local player_request_scroll 03993B t3 lower_scroll_line
local player_request_scroll 039942 t3 lower_others_line
local player_request_scroll 03997C t3 upper_scroll_line
local player_request_scroll 039983 t3 upper_others_line
local player_request_scroll 0399BE t6 push_sum
# player_place_carried: 0399CA "LDA #$04,U; ASLA", 0399CE "LEAY A,Y" (the offsets for its kind), 0399D0 "LDB ,Y+" (x,
# 0399D9 "NEGB" facing left), 0399DA "SEX", 0399DB "ADDD #$0C,U" (the player's x); Y then at the height
local player_place_carried 0399D0 t1 kind_offsets
local player_place_carried 0399D0 y height_address
local player_place_carried 0399D0,0399D9 b x_offset
local player_place_carried 0399DA t1 x_offset_word
local player_place_carried 0399DB t5 player_x
local player_place_carried 0399DB t7 carried_x
# player_place_carried_above: 0399E3 "SEX", 0399E4 "ADDD #$16,U; STD #$16,X" (above the player's z), 0399EA "LDD
# #$11,U", 0399ED "SUBD #$0002; STD #$11,X" (just in front of it)
local player_place_carried_above 0399E3 t1 height_word
local player_place_carried_above 0399E4 t7 carried_z
local player_place_carried_above 0399EA t5 player_y
local player_place_carried_above 0399ED t2 carried_y
# 039A80 "LDD #$0C,U; STD #$0C,X", 039A86 "LDD #$11,U; STD #$11,X": the partner at the player's place
local player_team_follow 039A80 t5 player_x
local player_team_follow 039A86 t5 player_y
# player_check_screen_edges: 039AB1 "LBSR $8644" (the floor ahead across), 039AC9 "ANDB #$0F", "ASLB" x3, 039ACE "SEX"
# (its height), 039AD8 "LDD #$0F,U", 039ADB "ADDD #$0D,U", 039AE4 "ADCA #$0C,U", 039AE7 "PULLS B" (the next x),
# 039B05 "CLRA" / 039B08 "LDA #$FF" then "COMA" (Z when the player has life: the edge stops it)
local player_check_screen_edges 039AB1 a floor_value
local player_check_screen_edges 039ACE t1 floor_height_byte
local player_check_screen_edges 039ACE a height_high
local player_check_screen_edges 039ACE b height_low
local player_check_screen_edges 039ADB t5 x_and_fraction
local player_check_screen_edges 039ADB t6 speed_word
local player_check_screen_edges 039AE4 t3 x_high
local player_check_screen_edges 039AE4 a next_x_high
local player_check_screen_edges 039AE7 b next_x_low
local player_check_screen_edges 039B05,039B08 a stopped_flag
# done: players/motion.c

# ---- players/reactions.c ----
# 039305 "LDX $1848", 039309 "LDA #$02", 03930B "STA #$03,X": the running player's variables (struct
# player_values), its object in play once its blinking ends (C "t1 = io_read16(0x1848u); mem_write8(t1 + 3u, 2u)")
local player_take_touches 039305 x player_vars player_values
local player_take_touches 039305 t3 player_vars
# 03932F "SEX" (the touch's strength doubled, signed: the switch)
local player_take_touches 03932F t1 hit_offset
# a team move by the two characters (team_moves_by_characters, 8 bytes): 03970F "LEAY D,Y", 039711 "LDB ,Y+" (the
# move), 039727 "LDD #$03,Y; LBSR $8680" (its sound), 03972D "LDB ,Y+" (its first object, 039730 "ASLDI #$02",
# 039735 "LEAX D,X" from 4A40), 039737 "LDA ,Y+" (its direction), 03974B "LDB ,Y" (the second object, 03974E
# "ASLDI #$02"), 039755 "LDB ,-Y" (the direction again, less one)
local player_take_touches 039711 t1 team_move_record
local player_take_touches 03972D t1 first_object_address
local player_take_touches 039730 t2 first_object_offset
local player_take_touches 039737 t1 first_direction_address
local player_take_touches 03974E t2 second_object_offset
local player_take_touches 039755 t2 second_direction_address
local player_take_touches 03972A d team_sound
# C "d = (d & 0xFFu) | 0x300u; player_show_balloon(facing, player, d)": the balloon's word (A 3)
local player_take_touches 039767 d balloon_value
# C "t8 = OBJECT(team_member)->x; team_member = stack; ... t9 = OBJECT(team_member)->x": the second object's x and the
# first's
local player_take_touches 03976A t5 second_x
local player_take_touches 039772 t5 first_x
# 039442 "TST #$3F,U": the held object's high byte (one is held), in each pickup
local player_pick_up_item 039442 t3 held_high
local player_pick_up_weapon 039442 t3 held_high
local player_eat_food 039442 t3 held_high
local player_drop_held 03963F t3 held_high
# 0393F2 / 0395F4 "LBSR $7C29" (player_show_balloon: the balloon's word in D, C "d = 0x10Cu", "d = 0u")
local player_eat_food 0393F2 d balloon_value
local player_take_stun_blow_2 0395F4 d balloon_value
# 03947B "ADDD #$0010", 03947E "CMPD #$16,Y": 10 above the player's height (a blow from above)
local player_take_blow 03947B t2 z_above
# 0394B5 "LDA #$0D,U; ANDA #$02", 03956B "LDB #$0D,U; BITB #$02": the x's low byte (bit 1 picks the reaction)
local player_take_blow 0394B5 t3 x_low
local player_take_heavy_blow 03956B t3 x_low
# 039583 "LDD #$0400; STD #$0F,U" / 039590 "LDD #$FC00; STA #$0F,U" then 039596 "NEGA": the speed across, then up
# (039597 "STD #$19,U")
local player_bounce_away 039583,039596 a speed_high
local player_bounce_away 039583,039590 b speed_low
# 0395AD "LDX #$4B,U", 0395B2 "STA #$58,X": its holder (C "mem_write8(holder + 0x58u, 1u)")
local player_get_grabbed 0395AD x holder object.grabber
# 0395B5 "LDY $1848", 0395B9 "LDA #$06,Y; CMPA #$05" (the grab hints shown), 0395C0 "INC #$06,Y"
local player_get_grabbed 0395B5 y player_vars player_values
local player_get_grabbed 0395B5 t3 player_vars
local player_get_grabbed 0395B9 t3 hints_shown
local player_get_grabbed 0395C0 t3 hints_before
# 03966F "LDD #$30,U; CMPA #$1C" (its state and timer: state 1C grabbed); 0396A0 "SUBA #$52,U" (its life less the
# last: what it lost), 0396A6 "ADDA #$1B,X" (the partner's less as much)
local player_break_team 03966F t5 state_and_timer
local player_break_team 03966F a state_value
local player_break_team 03966F d timer_value
local player_break_team 0396A0 t4 life_now
local player_break_team 0396A0 a life_lost
local player_break_team 0396A6 t4 lost_life
# done: players/reactions.c

# ---- players/second_sprite.c ----
# 03EA5E "LDA $184D; CMPA #$02" (the players who worked the heavy object: two lift it), 03EA9B "DEC <$F0" then "BNE"
local players_update_second_sprites 03EA5E t1 heavy_workers
local players_update_second_sprites 03EA9B t2 players_before
# 03EAC3 "LDD #$0C,U" / 03EAEF "LDX #$0C,U" (the player's x), 03EAC9 / 03EAF5 the y (above it: 40, 7F)
local player_second_sprite_follow 03EAC3 t5 player_x
local player_second_sprite_follow 03EAC9 t5 player_y
local player_second_sprite_overhead 03EAEF t5 player_x
local player_second_sprite_overhead 03EAF5 t5 player_y
# 03EB38 "ANDA #$40; PUSHS A" (the player faces left), 03EB5B "SEX", 03EB5C "ADDD #$0C,U; STD #$6C,U" (4 to its
# side), 03EB62 "LDY #$11,U; STY #$71,U"
local player_second_sprite_throw 03EB38 t2 facing_left
local player_second_sprite_throw 03EB5B t1 dx_word
local player_second_sprite_throw 03EB5C t5 player_x
local player_second_sprite_throw 03EB5C t7 thrown_x
local player_second_sprite_throw 03EB62 t5 player_y
# 03EB9D "LDD #$71,U; SUBD #$0010": the thrown thing's y, 10 nearer
local player_second_sprite_land 03EB9D t5 sprite_y
# 03EBBB "LDX #$6C,U; CMPX #$0044" (the thrown thing's x: off the screen), 03EBDC "SEX; CMPD #$76,U" (the floor's
# height against its z)
local player_second_sprite_fall 03EBBB t5 sprite_x
local player_second_sprite_fall 03EBDC t1 floor_height
# 03EC0B "DEC #$009D,U", 03EC11 "LDA #$009D,U; CMPA #$1E": the prompt's frames (60 a cycle)
local player_second_sprite_prompt 03EC0B t3 prompt_time
local player_second_sprite_prompt 03EC11 t3 prompt_time_now
# 03EC3C "DEC #$009E,U", 03EC43 "LDA #$009E,U", 03EC47 "ANDA #$3F": the blinking's frames
local player_second_sprite_blink 03EC3C t3 blink_time_before
local player_second_sprite_blink 03EC43 t3 blink_time_now
local player_second_sprite_blink 03EC47 t2 blink_phase
# 03EC60 "TST $185A" (no balloons), 03EC67 "LDA #$00A0,U" (the balloon's number, which player_show_balloon put there)
local player_second_sprite_start_balloon 03EC60 t1 balloons_off
local player_second_sprite_start_balloon 03EC67 t3 balloon_number
# 03ECBB "LDX #$32,U", 03ECBE "LDA #$04,X": the partner's kind (C "t1 = mem_read8(partner_2 + 4u)"), with the
# player's (03ECC3 "ADDA #$04,U") the pair's speaker (pair_balloon_players), 03ECCB "LDB #$C0; MUL" its object;
# 03ECD5 "LDD #$0C,X", 03ECDB "LDD #$11,X" the speaker's place
local player_second_sprite_balloon 03ECBB x team_partner object
local player_second_sprite_balloon 03ECBE t3 partner_kind
local player_second_sprite_balloon 03ECCB d speaker_and_stride
local player_second_sprite_balloon 03ECD5 t5 speaker_x
local player_second_sprite_balloon 03ECDB t5 speaker_y
# done: players/second_sprite.c

# ---- players/states.c ----
# The team states' partner, a player's object (field 32): typed by the player family so its fields read as its
# controls (2E) and newly pressed controls (2F), which 0382D3 "ORA #$2F,X", 038347 "LDA #$2E,U" / 03834A "ORA
# #$2E,X", 03852B / 03857B "ORB #$2F,X", 039181 "ORA #$2F,X" read (the C reads them as target_dy). Replaces the
# lines typed "object" above
local player_team_move 0382B9,039205 x teammate object.player
local player_walk 0383F5,03844C,039205 x teammate object.player
local player_team_jump 038510,039205 x teammate object.player
local player_team_start_fall 039205 x teammate object.player
local player_team_fall 038560,039205 x teammate object.player
local player_attack_end 038C9F,039205 x teammate object.player
local player_team_ready 03916D,039205 x teammate object.player
local player_team_together 039205 x teammate object.player
# 0391C1 "LDX #$32,U", 0391CA "STY #$28,X": the partner's action word too (C "mem_write16(partner + 0x28u, 0x1E0u)")
local player_team_start 0391C1 x teammate object.player
# the end the team states share: 0386E7 "LDX #$7DD5", 0386EA "LDA A,X" (team_move_attack_states, into field 3C),
# 038703 "LDB #$F8" / 03870A "LDB #$FC" (the animation base on the floor or in the air, then 0391EB "STB <$F2"),
# 0391EE "LDY #$7E3D" (team_move_animation_offsets), 0391FB "LDA A,Y" (the animation's offset by the move and the
# character, negative none), 03920B "LDA #$04,X" / 039213 "LDA #$04,U" (the kind whose player number goes into
# field 5B: 039216 "ASLA" x4, 03921A "STA #$5B,U")
local player_team_move 038703,03870A b animation_base
local player_walk 038703,03870A b animation_base
local player_team_jump 038703,03870A b animation_base
local player_team_start_fall 038703,03870A b animation_base
local player_team_fall 038703,03870A b animation_base
local player_attack_end 038703,03870A b animation_base
local player_team_ready 038703,03870A b animation_base
local player_team_together 038703,03870A b animation_base
local player_team_move 0391EE y animation_offsets
local player_walk 0391EE y animation_offsets
local player_team_jump 0391EE y animation_offsets
local player_team_start_fall 0391EE y animation_offsets
local player_team_fall 0391EE y animation_offsets
local player_attack_end 0391EE y animation_offsets
local player_team_ready 0391EE y animation_offsets
local player_team_together 0391EE y animation_offsets
local player_team_move 0391FB a animation_offset
local player_walk 0391FB a animation_offset
local player_team_jump 0391FB a animation_offset
local player_team_start_fall 0391FB a animation_offset
local player_team_fall 0391FB a animation_offset
local player_attack_end 0391FB a animation_offset
local player_team_ready 0391FB a animation_offset
local player_team_together 0391FB a animation_offset
local player_team_move 0391FB t2 animation_offset
local player_walk 0391FB t2 animation_offset
local player_team_jump 0391FB t2 animation_offset
local player_team_start_fall 0391FB t2 animation_offset
local player_team_fall 0391FB t2 animation_offset
local player_attack_end 0391FB t2 animation_offset
local player_team_ready 0391FB t2 animation_offset
local player_team_together 0391FB t2 animation_offset
local player_team_move 03920B,039213 a owner_kind
local player_walk 03920B,039213 a owner_kind
local player_team_jump 03920B,039213 a owner_kind
local player_team_start_fall 03920B,039213 a owner_kind
local player_team_fall 03920B,039213 a owner_kind
local player_attack_end 03920B,039213 a owner_kind
local player_team_ready 03920B,039213 a owner_kind
local player_team_together 03920B,039213 a owner_kind
# the other animation bases: 03855B "LDB #$F4", 0391BD "LDB #$E4", 0391E9 "LDB #$EC", 0384E4 / 03850B (E8, F0)
local player_team_start_fall 03855B b animation_base
local player_team_ready 0391BD b animation_base
local player_team_together 0391E9 b animation_base
local player_team_move 0384E4,03850B b animation_base
# player_team_move: 0382BC "LDD #$16,U" (z, against the floor), 0382D0 "LDA #$2F,U", 0382D3 "ORA #$2F,X" (either's
# newly pressed controls), 038302 "LDA #$2F,X" / 038352 "ORA #$2F,X" (the partner's), 0382E5 "LDA #$35,U" (the team move),
# 03830E "LDD #$3F2A" / 038309 "LDD #$3F2B", 038311 "LBSR $8680" (the voice), 038314 "LDD #$0413" / 03832D "LDD
# #$0411" (the hit it gives), 0382DE "LDY #$7F21" / 03831A "LDY #$7F5D" (the walk's velocities: the player's, the
# team's), 03833A "LDY #$7E3B" (the spark's height), 038340 "PULLS Y" (the velocities back)
local player_team_move 0382BC b z_low
local player_team_move 0382D3 t3 partner_pressed
local player_team_move 038302 t3 partner_pressed
local player_team_move 038352 t3 partner_pressed
local player_team_move 0382D3 a pressed_either
local player_team_move 0382E5 a move_number
local player_team_move 038309,03830E a voice_high
local player_team_move 038309,03830E b voice_low
local player_team_move 038311 d voice_command
local player_team_move 038314,03832D b attack_kind
local player_team_move 0382DE,03831A,038340 y walk_velocities
local player_team_move 03833A y spark_height
# 038347-038367 the controls (either's, 03834A "ORA #$2E,X"), 03836A "ANDA #$1F" (a direction or attack), 038374 /
# 03837C the partner's and the player's joystick (038377 / 03837F "ANDA #$0F")
local player_team_move 03834A,03835A,038362,038367,03836A a walk_controls
local player_team_move 03836A t2 walk_controls
local player_team_move 038377,03837F a joystick_bits
local player_team_move 038377 t2 partner_joystick
local player_team_move 03837F t2 own_joystick
# player_stand: 0383A4 "LDB #$2F,U" (newly pressed), 038731 / 038856 "ANDB #$03" (left or right held), 0383CC "ANDA
# #$0F" (the joystick), 038726 "LDA #$1E,U" (what touched it: FE a heavy object, FF a pickup), 038471 "INC $184C"
# (one more player idle), 038498 "LBSR $7C29" (balloon 2), 0385E5 "TST #$3F,U" / 0385EA "LDA #$40,U" (what it holds:
# a weapon by its kind), 0385F1 "PULLS Y" (the weapon's effect), 038601 "LBRA $6988" (with D 2BB1), 0387A2 "LDY
# #$7DD9" (carry_offsets_picking_up), 0387A5 "LBSR $79CA" (player_place_carried hands it back)
local player_stand 0383A4 b pressed
local player_stand 038731,038856 b joystick_x
local player_stand 038731 t2 joystick_x
local player_stand 038856 t2 joystick_x
local player_stand 0383CC a joystick_bits
local player_stand 0383CC t2 joystick_bits
local player_stand 038726 a touched_by
local player_stand 038471 t1 idle_players
local player_stand 038498 d balloon_value
local player_stand 0385E5 t3 held_high
local player_stand 0385EA t3 held_weapon
local player_stand 0385F1 y weapon_effect
local player_stand 038601 d move_and_animation
local player_stand 0387A2,0387A5 y carry_offsets
# player_walk: 0383D6 "LEAY A,Y", 0383D8 "LDD ,Y++" (the joystick's velocity: its x speed, A its facing; Y on at its y
# speed), 03841C "LDB #$01" / 03843B "LDB #$81" (the walk's animation), 038454 "LDB #$01" (the team's way)
local player_walk 0383D8 t1 velocity_record
local player_walk 0383DA t3 walk_x_speed
local player_walk 0383D8 a x_speed_high
local player_walk 0383D8 y velocity
local player_walk 03841C,03843B b walk_animation
local player_walk 038454 b team_way
# 038519 / 038569 / 038639 / 03868D "LBSR $788B" (player_steer hands back its velocity's y speed address in Y)
local player_team_jump 038519 y velocity
local player_team_fall 038569 y velocity
local player_jump 038639 y velocity
local player_fall 03868D y velocity
# 03852B / 03857B "ORB #$2F,X" (the partner's newly pressed controls)
local player_team_jump 03852B t3 partner_pressed
local player_team_fall 03857B t3 partner_pressed
# gravity: 038539 / 03865A "SUBD #$0040", "STD #$19,U"; 03858B / 0386A5 "SUBD #$0040", 038593 / 0386AA "SUBD #$0080"
# (faster down); 0385C2 "ASRDI #$01", 0385C8 "NEGD" (a bounce at half the speed)
local player_team_jump 038539 t2 new_z_speed
local player_team_jump 03853C t3 new_z_speed
local player_jump 03865A t2 new_z_speed
local player_jump 03865D t3 new_z_speed
local player_team_fall 03858B t2 new_z_speed
local player_team_fall 038593 t2 faster_z_speed
local player_team_fall 0385C2 t2 bounce_z_speed
local player_team_fall 0385C8 t2 bounce_up_speed
local player_team_fall 03858B,038593,0385C2,0385C8 a z_speed_high
local player_team_fall 03858B,038593,0385C2 b z_speed_low
local player_fall 0386A5 t2 new_z_speed
local player_fall 0386AA t2 faster_z_speed
local player_fall 0386A5,0386AA a z_speed_high
local player_fall 0386A5,0386AA b z_speed_low
# 038644 "SUBD #$5C,U": its height above the floor; 038678 "LDB #$83" (the jump's animation)
local player_jump 038644 t7 height_above_floor
local player_jump 038678 b jump_animation
# player_use_held: X the held object (field held, "u16 object"): 0387E0 "LDA #$04,X" its kind (C "t3 =
# mem_read8(held + 4u)"), 0387D8 "LDA #$40,U" (the weapon's kind when it holds no object), 0387DB "TST #$3F,U",
# 0387E3 "SUBA #$04", 0387E5 "TFR A,B" (handed on in B), 0387EB "JMP [A,Y]"
param player_use_held x held object
local player_use_held 0387D8 t3 weapon_kind
local player_use_held 0387DB t3 held_high
local player_use_held 0387E0 t3 carried_kind
local player_use_held 0387D8,0387E0,0387E3 a held_kind
local player_use_held 0387E5 b use_index
local player_use_held 0387EB d use_index
# player_start_throw_kind_4: 0387F6 "LDD #$04,X" (the held object's kind and animation, C "t1 = mem_read16(held +
# 4u)"), 0387F9 "ANDB #$7E", 0387FB "CMPD #$041A"; 0387F4 "PUSHS B" / 0387FE "PULLS B" (the use's index), 038809
# "LBRA $6988" (with D 04E0)
param player_start_throw_kind_4 x held object
local player_start_throw_kind_4 0387F6 t5 held_look
local player_start_throw_kind_4 0387FB t1 masked_look
local player_start_throw_kind_4 0387ED,0387FE b use_index
local player_start_throw_kind_4 0387F2 d use_index
local player_start_throw_kind_4 038809 d move_and_animation
# 038820 "PULLS B" (the use's index), 03883E "LDD #$08B4", 0388FD "LDD #$0BB7", 03892C "LDD #$0CB8", 038916 "LDD
# #$09B5", 038921 "LDD #$0AB6", 0388EB (the move record's state and animation): a move's state and animation for
# player_start_move / player_set_move_on_floor
local player_start_swing_6 038820 d use_index
local player_start_throw_weapon_8 03883E d move_and_animation
local player_start_attack 0388FD,03892C d move_and_animation
local player_plain_attack 038916,038921 d move_and_animation
local player_choose_attack 0388EB d move_and_animation
# player_choose_attack: 0388AF "LDX #$25,U" (what it hit last: an enemy of the lists 4F80-5280), 0388C1 "LDY #$0C,U",
# 0388C7 "CMPY #$0C,X" (it faces the enemy), 0388D1 "LDB #$4D,U" (the combo's step), 0388D7 "LDA B,X"
# (object_1c_move_steps), 0388DB "CLRD" (back to the first), 0388E7 "LDD ,X++" (object_1c_moves' record)
local player_choose_attack 0388AF x hit_object object
local player_choose_attack 0388C1 t5 player_x
local player_choose_attack 0388C7 t5 hit_x
local player_choose_attack 0388D1,0388DB b combo_index
local player_choose_attack 0388D7,0388DB a move_number
local player_choose_attack 0388D7 t2 move_step
local player_choose_attack 0388E7 t1 move_record
# 038937 "BSR $693B" (player_start_jump_attack hands back the move's hit in Y)
local player_start_move 038937 y move_hit
# player_start_jump_attack: 038947 "SUBD #$5C,U" (its height above the floor: under 40 the lower settings), 038955
# "LDY ,X++" (the move's hit), 038957 "LDD ,X++; STD #$53,U" (the gravity), 038964 "LDD ,X++; STD #$19,U" (the speed
# up), then the x speed (two, by its facing) of player_jump_attack_settings' record
local player_start_jump_attack 038947 t7 height_above_floor
local player_start_jump_attack 038955 t1 settings
local player_start_jump_attack 038955 y move_hit
local player_start_jump_attack 038957 t1 gravity_address
local player_start_jump_attack 038957 t4 gravity
local player_start_jump_attack 038964 t1 rise_address
local player_start_jump_attack 038964 t4 rise_speed
# player_jump_kick: 0389EE "LDA #$2E,U" (the controls), 038A13 "LDY #$0C13; STY #$1C,U" (its damage and attack),
# 038A34 "LDY #$7E3B" (the spark's height)
local player_jump_kick 0389EE a joystick_bits
local player_jump_kick 038A13 y damage_and_attack
local player_jump_kick 038A34 y spark_height
# 038A5B / 03915A "LDX #$3F,U" (the heavy object it holds): 038A63 "STA #$02,X" (its state 4), 03915F "STA #$28,X"
# (its action 2)
local player_heave_heavy_object 038A5B x held_object object
local player_work_heavy_object 03915A x held_object object
# 03914B "INC $184D" (one more player worked it), 039164 "LBSR $7B5C" (player_face_heavy_object hands back the x left
# of it)
local player_work_heavy_object 03914B t1 heavy_workers
local player_work_heavy_object 039164 y left_of_held
# 038A6C / 038A89 "TST $0031": an absolute address in the K052109's RAM (one of the errors of the original noted in
# symbols.txt: the field 31 meant)
local player_throw_carried_4 038A6C t1 misread_0031
local player_throw_carried_5 038A89 t1 misread_0031
# 038AAA "LDD #$11,U" (the player's y, given to the thrown object)
local player_release_throw 038AAA t5 player_y
# 038AE5 "DEC #$009F,U": the weapon's uses left (the second object's byte 3F: 20 at the pickup)
local player_throw_weapon_8 038AE5 t3 weapon_uses
# 038B03 / 038B15 / 038B21 / 038B26 / 038B2B / 038B4B / 038B50 "LDY #$7E3B" (hit_spark_height)
local player_swing_6 038B03 y spark_height
local player_swing_7 038B15 y spark_height
local player_team_attack_homer 038B21 y spark_height
local player_attack_1 038B26 y spark_height
local player_attack_2 038B2B y spark_height
local player_attack_3 038B4B y spark_height
local player_attack_finish 038B50 y spark_height
# player_team_attack_homer: 038B1A "TST $184B" (a stage's end); X the partner (player_run left it there at a stage's
# end: 0380E2 "LDX #$32,U"), 039188 "LBSR $7A1A" (player_team_split), 03918B "LDA #$C0", 03918D "STA #$00,X"
local player_team_attack_homer 038B1A t1 stage_is_over
param player_team_attack_homer x teammate object.player
# 038B43 "ASRDI #$03" (an eighth of the x speed), 038B56 "ANDB #$7F" (the animation), 038B92 "SUBD #$53,U" (the attack's
# gravity), 038BBE "LDA #$30,U" (its state)
local player_attack_walking 038B43 t2 slow_x_speed
local player_attack_move 038B56 b animation_number
local player_jump_attack 038B92 t7 new_z_speed
local player_ground_attack 038BBE a state_value
# player_attack_end: 038C88 "LDD #$5C,U; CMPD #$16,U" (its floor against its height), 038CC9 "ANDA #$40" (facing left)
local player_attack_end 038C88 a floor_high
local player_attack_end 038C88 b floor_low
local player_attack_end 038CC9 a facing_left
local player_attack_end 038CC9 t2 facing_left
# 038D06 "LDX #$11,U" (its y, against the back line 98)
local player_flung_back 038D06 t5 player_y
# 038E88 "SUBA #$04": its life before losing 4
local player_grabbed 038E88 t1 life_before
# player_struggle: 038E96 "TST $184B"; 038ECC "LDX #$4B,U" (its holder), 038ECF "CLR #$58,X" (C "mem_write8(holder_2 +
# 0x58u, 0u)")
local player_struggle 038E96 t1 stage_is_over
local player_struggle 038ECC x holder_object object.grabber
# player_knocked_up: 038F02 "SUBD #$0060" (gravity), 038F34 "LDB #$0F,U" (its x speed's high byte), 038F3A "LDA
# #$30,U" (its state), 038F41 "LDX #$0C,U" (its x, inside 70-140), 038F4E "LDA #$0D,U" (the x's low byte), 038F6B "LDB
# #$D3" (the animation)
local player_knocked_up 038F02 t2 falling_z_speed
local player_knocked_up 038F34 b x_speed_high
local player_knocked_up 038F6B b animation_number
local player_knocked_up 038F3A a state_value
local player_knocked_up 038F41 x place_x
local player_knocked_up 038F41 t5 place_x
local player_knocked_up 038F4E a x_low
local player_knocked_up 038F4E t3 x_low
# player_die: 038FAE "LDX #$3F,U" (what it carries: 038FBB "LDA #$1D,X; CMPA #$FE" a heavy object stays, else its
# speeds cleared and its state 6), 038FB3 "TST #$3F,U"; 038FD9 "LDD [$1848]" (its lives), 038FF0 "LDX $1848", 038FF4
# "CLR #$06,X" (its grab hints); 039004 "LDX #$0C,U", 03900A "LDX #$11,U", 03900D "LEAX #$-50,X" (50 nearer)
local player_die 038FAE x held_object object
local player_die 038FB3 t3 held_high
local player_die 038FBB t3 held_attack
local player_die 038FD9 t3 player_vars
local player_die 038FD9 t6 lives_word
local player_die 038FD9 d lives_low
local player_die 038FF0 x player_vars player_values
local player_die 038FF0 t3 player_vars
local player_die 039004 t5 player_x
local player_die 03900A t5 player_y
local player_die 03900D x raised_y
# player_lose_life / player_game_over_end: 039054 / 03908B "LDX $1848" then "CLR #$03,X" (its object to be put in
# again), 03905E "DECW [$1848]" (a life less), 039033 "LDA #$31,U" (its state's timer)
local player_lose_life 039054 x player_vars player_values
local player_lose_life 039054 t3 player_vars
local player_lose_life 03905E t3 player_vars
local player_lose_life 039033 a timer_value
local player_game_over_end 03908B x player_vars player_values
local player_game_over_end 03908B t3 player_vars
local player_game_over_end 039054 x player_vars player_values
local player_game_over_end 039054 t3 player_vars
local player_game_over_end 03905E t3 player_vars
# 0390C4 "LDX #$0C,U" (its x: in at 72), 0390E0 "LDD #$0F,U" (its x speed, slowed by 60 to -300)
local player_jump_in 0390C4 t5 player_x
local player_drop_in 0390E0 d old_x_speed
# player_team_ready: 039170 "TST $184B", 039181 "ORA #$2F,X" (either's newly pressed controls)
local player_team_ready 039170 t1 stage_is_over
local player_team_ready 039181 t3 partner_pressed
local player_team_ready 039181 a pressed_either
# player_set_animation: 03924D / 0392AC "TST #$3F,U" (an object held), 039252 "LDA #$40,U" (a weapon's kind),
# 039261 / 039288 / 0392A1 "TST $184B" (a stage's end), 039279 "CMPD #$041A" (Homer's kind-04 object at animation
# 1A), 039299 "ASLA" (8 animations a held kind), 0392A7 "LDY #$3F,U" (the held object, cleared: C "mem_write8(y,
# 0u)"), 0392C2 "LDB ,Y+" (the carry offsets' x for the kind; Y on at the height), 0392C7 "ANDA #$40" (facing left),
# 0392D8 "SEX", 0392D9 "ADDD #$0C,U" (the held object's x)
local player_set_animation 03924D t3 held_high
local player_set_animation 0392AC t3 held_high
local player_set_animation 039252 t3 weapon_kind
local player_set_animation 039261 t1 stage_is_over
local player_set_animation 039288 t1 stage_is_over
local player_set_animation 0392A1 t1 stage_is_over
local player_set_animation 039279 t1 held_look
local player_set_animation 039299 a animation_offset
local player_set_animation 0392C7 a facing_left
local player_set_animation 0392C7 t2 facing_left
local player_set_animation 0392A7 y dropped_object object
local player_set_animation 0392C2 y height_address
local player_set_animation 0392C2 t1 kind_offsets
local player_set_animation 0392D8 t1 dx_word
local player_set_animation 0392D9 t5 player_x
local player_set_animation 0392D9 t7 carried_x
# done: players/states.c

# ---- enemies/enemy_targets.c (one more) ----
# 07D34F "LDA $189E", 07D353 "ADDA <$58", 07D356 "STA $189E": the last of the enemies' random numbers, kept in the
# K052109's RAM
local enemy_random 07D34F t1 last_roll

# ---- players/gauges.c (one more) ----
# 040A0B "PULLS X" (the gauge record back after the division), 040A3C "LDU #$0E,X" its gauge tiles (C "t6 =
# mem_read16(gauge_player + 0xEu)")
local gauge_draw_health 040A0B x gauge_player gauge_player

# ======== temporaries, typed pointers and locals: scenes, stages, attract ========
# ======== the temporaries, untyped pointers and register names of src/attract,
# src/scenes and src/stages ========
# Evidence by place in build/listing/simpsons.s. Conventions of this part:
# - a countdown decremented and tested ("DEC <$0B; BNE": t = the count before the decrement, "if (t == 1u)" its last
#   frame) is wait_left (the scenes' own counters at 18E2/18E3... are ..._wait); a scroll's low byte and fraction read
#   with "LDD <$BF" and then added to or subtracted from is layer_a_x_low (the read), old_layer_a_x_low (the operand
#   the ADDD/SUBD takes) and new_layer_a_x_low (the result), and likewise for the other layers and the camera
# - "INC $18E0" (scene_state) and the like: the read the INC makes first is old_scene_state; a CLR of memory reads it
#   first too, which nothing uses: discarded_read
# - a cursor's value before a post-increment read (",X+", ",U++": the read's t1) is named for what it reads: ..._at.

# ======== the attract's demo playback (work RAM) ========
# Each player's demo playback, 5810 + 10 x player: 07A0D2 "LDY #$5810", 07A117/07A19A "LEAY #$10,Y" (4 of them,
# 07A123/07A1A6 "CMPA #$04"); read and written by demo_start and demo_play:
# 07A0F2 "LDU ,X++; STU ,Y" (the player's inputs in bank 2C), 07A17A "LDU ,Y; LDA ,U", 07A186 "LEAU #$02,U", 07A198
# "STU ,Y" (the next input step); 07A0F6 "LDA #$01,U; STA #$02,Y", 07A181 "DEC #$02,Y", 07A192 "LDA #$01,U; STA
# #$02,Y" (the frames left of the step); 07A0FC "LDA ,U; STA #$03,Y", 07A17C "LDA ,U; STA #$03,Y" (its controls, which
# 07A1AA "COM $5813; LDU #$5813; LBSR $924D" hands update_controls as the player's port: marge_demo_controls...);
# 07A18E "COMA; STA #$04,Y" (the controls inverted; nothing reads them back)
struct demo_playback 10
field demo_playback 00 input u16 demo_input
field demo_playback 02 frames u8
field demo_playback 03 controls u8
field demo_playback 04 controls_inverted u8

# ---- attract/demo.c ----
# (07A0D2 "LDY #$5810", 07A117 "LEAY #$10,Y"): the playbacks, as struct demo_playback
local demo_start 07A0D2,07A117 y playback demo_playback
local demo_play 07A15F,07A19A y playback demo_playback
# 07A0AB "LDX A,X" (demos[demo_number]), 07A0AD "LDA ,X+; STA <$50" (its players): the demo's record
local demo_start 07A0AD t1 demo_record
# 07A0B2 "LDD ,X++; STD $5800" (its frames), 07A0B8 "LDA ,X+; STA <$03" (its step), 07A0F2 "LDU ,X++" (a player's
# inputs): the cursor through the record at each read
local demo_start 07A0B2 t1 frames_at
local demo_start 07A0B8 t1 step_at
local demo_start 07A0F2 t1 inputs_at
# 07A14C "DECW $5800; LBEQ $A1E7": the demo's frames before this one (the last one moves on to the next demo)
local demo_play 07A14C t3 demo_frames_left
# 07A181 "DEC #$02,Y; BNE": the frames left of a player's input step before this one
local demo_play 07A181 t3 step_frames_left

# ---- attract/intro.c ----
# 04005E "CLR #$-2000,X; STB ,X+; CMPX #$3000" (2800-2FFF), 04006E likewise to 3800 (3000-37FF): the K052109's codes
# of layer A and layer B (their colours 2000 below), the tile each STB writes
local attract_opening_start 040062 t1 layer_a_tile
local attract_opening_start 040072 t1 layer_b_tile
# 0400B2 "LDD #$28,X; SUBD #$00C0; STD #$28,X; STA #$0A,X; STA #$0B,X": the picture's zoom (with its fraction) after
# this frame's shrink
local attract_opening_zoom 0400B5 t2 new_zoom
local attract_opening_end_start 040113 t2 new_zoom
local attract_opening_end_scroll 04015B t2 new_zoom
# 0400CA "LDD <$BF; SUBD #$0080; STD <$BF" (then the borrow into <$BE): layer A's scroll x's low byte and fraction
local attract_opening_zoom 0400CA t4 layer_a_x_low
local attract_opening_zoom 0400CD t1 old_layer_a_x_low
local attract_opening_zoom 0400CD t2 new_layer_a_x_low
# 0400DB "LDD <$CF; ADDD #$0080; STD <$CF" (then the carry into <$CE): layer B's
local attract_opening_zoom 0400DB t4 layer_b_x_low
local attract_opening_zoom 0400DE t1 old_layer_b_x_low
# 0400F3 "DEC <$0B; BNE" (every other frame: 0400EC "LDA <$16; ANDA #$01")
local attract_opening_zoom 0400F3 t2 wait_left
# 04016E "DEC <$0B; BEQ $6196"
local attract_opening_end_scroll 04016E t2 wait_left
# 040173 "LDD <$C6; ADDD #$0018; STD <$C6" (the carry into <$C5): layer A's scroll y's low byte and fraction
local attract_opening_end_scroll 040173 t4 layer_a_y_low
local attract_opening_end_scroll 040176 t1 old_layer_a_y_low
# 040184 "LDD <$D6; SUBD #$0030; STD <$D6" (the borrow into <$D5): layer B's
local attract_opening_end_scroll 040184 t4 layer_b_y_low
local attract_opening_end_scroll 040187 t1 old_layer_b_y_low
local attract_opening_end_scroll 040187 t2 new_layer_b_y_low
# the scenes' waits: "DEC <$0B; BNE" (step_timer's high byte), the next phase on its last frame
local attract_opening_end_wait 04019F t2 wait_left
local attract_bart_scene_move 040218 t2 wait_left
local attract_bart_scene_wait 040247 t2 wait_left
local attract_bart_profile_type 040284 t2 wait_left
local attract_homer_scene_wait 0402F2 t2 wait_left
local attract_homer_scene_end 040300 t2 wait_left
local attract_homer_profile_type 040342 t2 wait_left
local attract_lisa_scene_walk 0403B4 t2 wait_left
local attract_lisa_scene_play 0403E7 t2 wait_left
local attract_lisa_profile_type 040426 t2 wait_left
local attract_marge_scene_wait 040509 t2 wait_left
local attract_marge_scene_pose 04051A t2 wait_left
local attract_marge_scene_end 04054A t2 wait_left
local attract_marge_profile_type 04060B t2 wait_left
local attract_leap_rise 04068F t2 wait_left
local attract_leap_fall 0406AA t2 wait_left
local attract_leap_land 0406D2 t2 wait_left
local attract_leap_end 0406F1 t2 wait_left
local attract_last_screen_wait 040758 t2 wait_left
# 040451 "LDA #$28,X; LDB #$0D; MUL; ADDB #$07; STB #$28,X; ANDA #$01": the pseudo-random step (field 28 x 13 + 7),
# whose high byte's bit 0 picks one of two poses
local attract_lisa_scene_animate 040456 t1 random_product
# 0404D0 "LDU #$7093; ... LBSR $680D": the picture that moves across (attract_marge_scene_moving_picture)
local attract_marge_scene_start 0404D0 u moving_picture
# 0406D9 "LDD #$71,X; ADDD #$0004; STD #$71,X": the partner's (X + 60) y, 4 lower
local attract_leap_land 0406D9 t5 partner_y
local attract_leap_land 0406DC t2 new_partner_y
# 04078D "LDU #$705A", 04079C "JMP [B,U]": the move's steps (attract_profile_move_steps)
local attract_profile_move 04078D u move_steps
# 0407A5 "LDD ,Y++; STD #$0F,X" (the move's speed x), 0407AD "LDD ,Y++; STD #$14,X" (its speed y), as struct
# profile_move: the move's record at each read
local attract_profile_move_out 0407A5 t1 speed_x_at
local attract_profile_move_out 0407AD t1 speed_y_at
local attract_profile_move_back 0407F1 t1 speed_x_at
local attract_profile_move_back 0407FA t1 speed_y_at

# A picture of the attract (attract_opening_picture, attract_marge_scene_picture_1-4, attract_marge_scene_moving_picture
# and the profiles' pictures: 040085 "LDU #$7066", 04049A "LDU #$708E", 0404A5 "LDU #$7089", 0404D0 "LDU #$7093"...,
# each handed to attract_put_picture): 040817 "LDA ,U+; ORA #$80; STA #$05,X" its animation, 04081E "LDD ,U++; STD
# #$0C,X" its x, 040823 "LDD ,U++; STD #$11,X" its y; 5 bytes (04049A 708E, 0404A5 7089, 040085 7066 + 5 = 706B the
# next picture: 0401FA "LDU #$706B")
struct attract_picture 05 rom
field attract_picture 00 animation u8
field attract_picture 01 x u16
field attract_picture 03 y u16
param attract_put_picture u picture attract_picture
local attract_put_picture 040817 t1 animation_at
local attract_put_picture 04081E t1 x_at
local attract_put_picture 04081E t4 picture_x
local attract_put_picture 040823 t1 y_at
local attract_put_picture 040823 t4 picture_y
# 04082C "LDX #$7106; ASLA; LDX A,X" (profile_texts), 040832 "LDD ,X++; STD <$F3": a profile text starts with the
# address of its letter counter (profile_count_address), then letters, FE + a place, FF the end
local attract_type_profile_text 040832 t1 profile_text
local attract_type_profile_text 040832 t4 counter_address
# 04083B "LDB ,X+" (a letter), 040845 "LDU ,X++; STU <$F1" (FE's place), 04084D "LDB ,X+" (the letter after it)
local attract_type_profile_text 04083B t1 letter_at
local attract_type_profile_text 040845 t1 place_at
local attract_type_profile_text 04084D t1 letter_after_place_at
# 040866 "INC [$48F3]": the counter, one letter more typed
local attract_type_profile_text 040866 t3 counter
# done: attract/demo.c
# done: attract/high_scores.c
# done: attract/intro.c

# ---- attract/title.c ----
# 07A009/07A026 "DEC <$09; BNE": the attract's timer before this frame
local title_show_notices 07A009 t2 wait_left
local title_end 07A026 t2 wait_left
# 07A052 "LDD <$BF; SUBD #$0040; STD <$BF" (the borrow into <$BE): layer A's scroll x's low byte and fraction
local title_scroll_layers 07A052 t4 layer_a_x_low
local title_scroll_layers 07A055 t1 old_layer_a_x_low
local title_scroll_layers 07A055 t2 new_layer_a_x_low
# 07A063 "LDD <$CF; ADDD #$0040; STD <$CF" (the carry into <$CE): layer B's
local title_scroll_layers 07A063 t4 layer_b_x_low
local title_scroll_layers 07A066 t1 old_layer_b_x_low
# 07A367 "CLR $1C80": the read a CLR of memory makes first (the K052109's scroll control), unused
local coin_title_draw 07A367 t1 discarded_read
# done: attract/title.c

# ---- attract/warning.c ----
# 07A314/07A329 "DEC <$09; BNE"
local warning_second_page 07A314 t2 wait_left
local warning_end 07A329 t2 wait_left
# done: attract/warning.c

# ---- scenes/ending.c ----
# 0227EB "CLR $18E6" (the staff roll's line), 022926 "CLR $18EA": the read a CLR of memory makes first, unused
local ending_set_up 0227EB t1 discarded_read
local ending_scroll_up 022926 t1 discarded_read
# "INC $18E0" (scene_state): the scene's state before it moves on
local ending_set_up 0227EF t1 old_scene_state
local ending_show_family 022842 t1 old_scene_state
local ending_roll_credits 022857 t1 old_scene_state
local ending_toss 022895 t1 old_scene_state
local ending_catch 0228AE t1 old_scene_state
local ending_fade_start 0228EE t1 old_scene_state
# 02281A "LDA #$01; LDB #$26; LBSR $86AD" (layer B's columns), then 022831 "CLRA; LBSR $6A1C" and 022835 "LDA #$01; LBSR
# $6A1C" (the placements 0 and 1, by A; B still 26): one D through both
local ending_show_family 02281E,022832,022837 d layer_then_placement
# 022873 "LDA #$05; LBSR $6A1C" (the tossed one, back in Y), 022878 "LDD #$11,Y; SUBD #$0002; STD #$11,Y"
local ending_toss 022878 t5 tossed_y
local ending_toss 02287B t2 new_tossed_y
# 0228FC "DECW $18E2; BEQ" (0228E7 "LDD #$0180; STD $18E2": the fade's frames), 022902 "LDD $18E2; CMPD #$0080"
local ending_fade 0228FC t3 fade_frames_left
local ending_fade 022902 t3 fade_frames
# 02291E "LDA $18EA; CMPA #$68" (the frames between two steps of the scroll up), 022938 "INC $18EA"
local ending_scroll_up 02291E t1 scroll_wait
local ending_scroll_up 022938 t1 old_scroll_wait
# 02292A "LDD <$C5; CMPD #$001B; ADDD #$0001; STD <$C5": layer A's scroll y, one up
local ending_scroll_up 02292A t4 layer_a_y
local ending_scroll_up 022932 t2 new_layer_a_y
# 022940 "LDA $18E4; BEQ", 022946 "DEC $18E4" (the wait between two lines of the staff roll: 022988 "LDA #$A0; STA
# $18E4"); 02294B/022959 "LDA $18E6" the line erased (its name and title), 022967 "INC $18E6", 02296B/02297A "LDA
# $18E6" the line printed
local ending_staff_roll 022940 t1 roll_wait
local ending_staff_roll 022946 t1 old_roll_wait
local ending_staff_roll 02294B t1 erased_name_line
local ending_staff_roll 022959 t1 erased_title_line
local ending_staff_roll 022967 t1 old_roll_line
local ending_staff_roll 02296B t1 name_line
local ending_staff_roll 02297A t1 title_line
# 02298F "LDX #$76F8; LDA $18E9; ASLA; LDD A,X" (ending_family_waits by the family's step), 02299E "CMPD $18E7; BHI"
# (the frames waited), 0229BB "INCW $18E7", 0229B6 "INC $18E9"
local ending_family_animations 022992 t1 family_step
local ending_family_animations 022997 t4 step_wait
local ending_family_animations 02299E t3 frames_waited
local ending_family_animations 0229BB t3 old_frames_waited
local ending_family_animations 0229B6 t1 old_family_step
# 0229C9 "LDD #$19,X; SUBD #$0004; STD #$19,X" (object 4E00's z speed)
local ending_tossed_rise 0229CC t2 new_z_speed
# 022A1E "LDU #$7706; CLRB; EXG A,B; ASLB; ROLA" x3, 022A2A "LEAU D,U": the placement's offset (A x 8) in two halves
local ending_put_placement 022A1C,022A25,022A27 a offset_high
local ending_put_placement 022A22,022A24,022A26 b offset_low
local ending_put_placement 022A22 t1 exchanged
# 022A2C "LDY ,U++" (the placement's object), 022A33 "LDD ,U++" (its kind and animation), 022A3A "LDD ,U++; STD
# #$0C,Y" (its x), as struct placement
local ending_put_placement 022A2C t1 placement_record
local ending_put_placement 022A33 t1 kind_at
local ending_put_placement 022A3A t1 x_at
local ending_put_placement 022A3A t4 placement_x
# done: scenes/ending.c

# ---- scenes/game_start_portraits.c ----
# 05ED5B "LDX #$7D78; LDA <$05; ASLA; JSR [A,X]": the subphase's steps (game_start_portraits_steps)
local game_start_portraits 05ED5B x subphase_steps
# 05ED64 "LDA <$78; ADDA #$01; BCC; LDA #$FF": the skip wait before this frame's (up to FF)
local game_start_portraits 05ED67 t1 old_skip_wait
# 05EDAE "DEC <$F1; BNE" (05ED7C "LDB #$04; STB <$F1"): the players still to look at
local game_start_portraits 05EDAE t2 players_left
# 05EDE4 "LDA #$04; STA <$F0", 05EE02 "DEC <$F0" (the coin slots), 05EDC1 "LDA #$04", 05EDDD "DECA" (the players)
local game_start_join_players 05EE02 t2 slots_left
local game_start_join_players 05EDDD t1 players_left
# 05EE49 "LDX #$7DD8; LDA <$F0; ASLA; ASLA; LEAX A,X", 05EE53 "LDU ,X++": the portrait's record (portrait_areas)
local game_start_draw_portraits 05EE53 t1 area_record
# 05EE74 "DEC <$F1" (9 columns), 05EE88 "DEC <$F2" (20 rows)
local game_start_draw_portraits 05EE74 t2 columns_left
local game_start_draw_portraits 05EE88 t2 rows_left
# 05EEEA "LDD #$04,U; STD #$0C,X": the portrait's x (test_player)
local portrait_start 05EEEA t5 portrait_x
# 05EF3F "DEC #$28,X; BNE" (05EF44 "LDA #$03; STA #$28,X": the frames between two of the portrait's frames)
local portrait_come_alive 05EF3F t3 wait_left
# 05EF5A "PUSHS U" (the test player's record), 05EF69 "LDU ,S", 05EF76 "PULLS U", 05EF78 "LDD #$0F,U; LBSR $869E": the
# record kept on the stack across the palette requests, and the sound it plays
local portrait_come_alive 05EF5A s3 saved_test_player
local portrait_come_alive 05EF76 u test_player_again test_player
local portrait_come_alive 05EF78 t5 start_sound
# done: scenes/game_start_portraits.c

# ---- scenes/high_scores.c ----
# 022022 "LDA $3840; ASLA; JMP [A,X]": the name entry's phase (the K052109's RAM at 3840, a variable)
local name_entry 022022 t1 entry_phase
# 0227AE "LDA $18E0; ASLA; JMP [A,X]": the ending's state (scene_state)
local ending 0227AE t1 ending_state
# 022A4F "LDU #$7A13; LDA #$02,X; ASLA; JSR [A,U]": the boss's states (stage_7_boss_states)
local stage_7_boss_update 022A4F u boss_states
# 023171: the helper's states (stage_7_boss_helper_states) for its JSR [A,U]
local stage_7_boss_helper_update 023171 u helper_states
# 022037 "LDX #$3860", 022040 "LDA ,X+; ASLA; LDY A,Y" (the player by rank: name_entry_rank_players' list, a player
# and a place each), 022055/022061 "STA ,X+" (the place, or FF out of the table), 022057/022063 "STA ,U+" (the
# player's entry at 3842 + 4 x player: its place)
local name_entry_set_up 022040 t1 ranking_at
local name_entry_set_up 022055 t1 place_at
local name_entry_set_up 022061 t1 no_place_at
local name_entry_set_up 022057 t1 place_entry
local name_entry_set_up 022063 t1 no_place_entry
# 022048 "LDD [#$08,Y]" (the player's score), 02204B "LBSR $86A4" (vector_high_score_rank: the place in A)
local name_entry_set_up 022048 t8 player_score
local name_entry_set_up 02204B d high_score_place
# 022087 "LDD [#$08,Y]; STD <$FE"
local name_entry_set_up 022087 t8 entry_player_score
# 0220B0 "LDA ,X; ADDA #$01; DAA; STA <$F1; LSRA x4; BEQ": the place's tens digit (none below 10)
local name_entry_set_up 0220BB t2 place_tens
# "LDD <$F8; ADDD #$0010; STD <$F8": the x of the letter just printed, and the next one's
local name_entry_set_up 0220C8 t4 tens_x
local name_entry_set_up 0220CB t2 x_after_tens
local name_entry_set_up 0220E0 t4 units_x
local name_entry_set_up 0220E3 t2 x_after_units
local name_entry_set_up 0220FB t4 suffix_x
local name_entry_set_up 0220FE t2 x_after_suffix
local name_entry_set_up 02213D t4 digit_1_x
local name_entry_set_up 022140 t2 x_after_digit_1
local name_entry_set_up 022161 t4 digit_2_x
local name_entry_set_up 022164 t2 x_after_digit_2
local name_entry_set_up 022187 t4 digit_3_x
local name_entry_set_up 02218A t2 x_after_digit_3
# 0220E9 "LDY #$751E; LDA ,X; ASLA; LEAY A,Y", 0220F1 "LDA ,Y+": the place's suffix (place_suffixes: ST, ND...)
local name_entry_set_up 0220F1 t1 suffix
# the score's first three digits (022123 "LDA <$FE; LSRA x4", 022149 "LDA <$FE; ANDA #$0F", 02216D "LDA <$FF; LSRA
# x4"), each blank while it is a leading zero: "DEC <$F1; BNE; LDA #$10"
local name_entry_set_up 022129 t2 score_digit_1
local name_entry_set_up 02214C t2 score_digit_2
local name_entry_set_up 022173 t2 score_digit_3
local name_entry_set_up 02212C t2 leading_check_1
local name_entry_set_up 022150 t2 leading_check_2
local name_entry_set_up 022176 t2 leading_check_3
# 0221AD "LDX #$3852", 0221B7 "LDA #$41; STA ,X+" (A), 0221BC "LDD #$4040; STD ,X++" (two blanks): each player's
# initials; 0221BE "DEC <$F0" (4 players)
local name_entry_set_up 0221B7 t1 initial_at
local name_entry_set_up 0221BC t1 other_initials_at
local name_entry_set_up 0221BE t2 players_left
# 0221CC "LDX #$4D40" (7 Maggies, 0221C3 "LDA #$07; STA <$F0"): 0221E2 "LDD #$0030; ADDD <$F2; STD #$0C,X", 0221F7
# "LDD <$F2; ADDD #$0030; STD <$F2", 022203 "DEC <$F0"
local name_entry_set_up 0221E5 t6 maggie_x
local name_entry_set_up 0221F7 t4 maggie_offset
local name_entry_set_up 0221FA t2 next_maggie_offset
local name_entry_set_up 022203 t2 maggies_left
# 02220D "INC $3840": the name entry's phase before it moves on
local name_entry_set_up 02220D t1 old_entry_phase
local name_entry_type_initials 0222AA t1 old_entry_phase
# 022212 "LDD $385E; ADDD #$0001; STD $385E" (the name entry's frames: 0700 its end), 0222B0 likewise
local name_entry_type_initials 022212 t3 entry_time
local name_entry_type_initials 022216 t2 new_entry_time
local name_entry_linger 0222B0 t3 entry_time
# 02223F "LDD #$0C,X; CMPD #$0180" (each Maggie's x: back to 30 past 180), 022250 "DEC <$F0"
local name_entry_type_initials 02223F t5 maggie_x
local name_entry_type_initials 022250 t2 maggies_left
# 02225A "LDB #$04", 022261 "DECB" (the 4 entries)
local name_entry_type_initials 022261 t1 entries_left
# 022282 "LDD <$F8; PUSHS D", 022290 "ADDD #$0048; STD <$F8": the x of the player's initials, and the next player's
local name_entry_type_initials 022282 t4 player_text_x
local name_entry_type_initials 022290 t2 next_player_text_x
# 0222D4 "LDA #$01,X; BMI" (the player's place in name_entry_rank_players' list, FF none), 0222F7 "LDA #$01,X; LBSR
# $86A1" (vector_insert_high_score's place)
local name_entry_save 0222D4 t3 ranked_place
local name_entry_save 0222F7 t3 insert_place
# 0222E4 "LDY #$06,U" (the player's initials), 0222E7 "LDD ,Y++; STD <$F0" (two), 0222EC "LDA ,Y; STA <$F2" (the third)
local name_entry_save 0222E7 t1 initials_at
local name_entry_save 0222E7 t4 first_initials
local name_entry_save 0222EC a third_initial
# 0222F1 "LDD [#$08,U]; STD <$F3": the player's score (B its low byte)
local name_entry_save 0222F1 t8 player_score
local name_entry_save 0222F1 d score_low
# 022300 "DEC ,S; BNE" (0222D0 "LDA #$04; PUSHS A")
local name_entry_save 022300 t2 players_left
# 022326 "LDA <$E8; INCA; CMPA #$04" (the place after the one ranked)
local name_entry_rank_players 022329 a next_place
# 022334 "LDD [A,X]; STD <$EA" (the other player's score, by player_score_addresses), 02233C "LDD [A,X]; CMPD <$EA"
local name_entry_rank_players 022334 t7 other_score
local name_entry_rank_players 02233C t7 ranked_player_score
# 02238D/0223BD/0223DC/022400 "LDA #$03,X" (the entry's initial being typed, 0-2): up, down, the button, the print
local name_entry_edit_initials 02238D t3 up_initial
local name_entry_edit_initials 0223BD t3 down_initial
local name_entry_edit_initials 0223DC t3 next_initial
local name_entry_edit_initials 022400 t3 last_initial
# 022390 "LDY #$06,U; INC A,Y" / 0223C3 "DEC A,Y": the letter's place among the player's initials
local name_entry_edit_initials 022393 t1 letter_up_at
local name_entry_edit_initials 0223C3 t1 letter_down_at
# 022409 "LDA ,Y+": an initial to print; 02240E "LDB #$18,U; ADDB #$0A" (the player's colour)
local name_entry_edit_initials 022409 t1 letter_at
local name_entry_edit_initials 02240E t3 player_colour
# 022458 "LDD <$F8; ADDD #$0010; STD <$F8", 022461 "DEC <$F1"
local name_entry_edit_initials 022458 t4 letter_x
local name_entry_edit_initials 02245B t2 next_letter_x
local name_entry_edit_initials 022461 t2 letters_left
# a picture's blocks (name_entry_block): 0224B9 "LDU ,X++" (its place), 0224C0/0224C5/0224CA "LDA ,X+" (width,
# height, colour), 0224E5 "LDA ,X+; STA ,U+" (a tile), 0224E9 "DEC #$04,S" (the row's tiles), 0224F5 "DEC #$02,S"
# (the rows), 0224FA "LDA ,X+; BEQ" (00 another block)
local name_entry_draw_picture 0224B9 t1 block
local name_entry_draw_picture 0224C0 t1 width_at
local name_entry_draw_picture 0224C5 t1 height_at
local name_entry_draw_picture 0224CA t1 colour_at
local name_entry_draw_picture 0224E5 t1 tile_code_at
local name_entry_draw_picture 0224E7 t1 tile_place
local name_entry_draw_picture 0224E9 t3 columns_left
local name_entry_draw_picture 0224F5 t3 rows_left
local name_entry_draw_picture 0224FA t1 end_mark_at
# the high score table's waits: "DEC <$0A; BNE" (scene_timer's high byte)
local high_scores_show_first 02254A t2 wait_left
local high_scores_wave_out 022564 t2 wait_left
local high_scores_show_second 0225EE t2 wait_left
local high_scores_end 022625 t2 wait_left
# 0225D6 "CLR $1C80": the read a CLR of memory makes first, unused
local high_scores_wave_out 0225D6 t1 discarded_read
# 022578 "LDA #$0D; LDB <$F1; MUL; SUBD #$7001; STD ,X++" (into the row scroll at 1A00), 022586 "DEC <$F0" (256 rows)
local high_scores_wave_out 02257D t1 wave_product
local high_scores_wave_out 02257E t2 row_scroll
local high_scores_wave_out 022581 t1 row_scroll_at
local high_scores_wave_out 022586 t2 rows_left
# 022656 "LDA <$F0; LSRA x4; BEQ" (the place's tens)
local high_scores_print_entries 02265C t2 place_tens
# "LDD <$F8; ADDD #$0010; STD <$F8": the x of the letter printed, and the next one's
local high_scores_print_entries 022665 t4 place_tens_x
local high_scores_print_entries 022668 t2 x_after_tens
local high_scores_print_entries 02268A t4 initial_x
local high_scores_print_entries 02268D t2 x_after_initial
local high_scores_print_entries 0226D1 t4 digit_x
local high_scores_print_entries 0226D4 t2 x_after_digit
# 022684 "LDA ,X+" (an initial of the entry), 022693 "DEC <$F2" (3 of them)
local high_scores_print_entries 022684 t1 initial_at
local high_scores_print_entries 022693 t2 initials_to_print
# 0226A3 "LDD ,X++; PUSHS D" (the entry's score, BCD), 0226CB "LDD ,S; ASLDI #$04; STD ,S" (its digits, the next in
# the top 4 bits), 0226DA "DEC <$F2" (4 digits)
local high_scores_print_entries 0226A3 t1 score_at
local high_scores_print_entries 0226A3 t4 bcd_score
local high_scores_print_entries 0226CB t4 digits
local high_scores_print_entries 0226CD t2 digits_shifted
local high_scores_print_entries 0226CF t2 stored_digits
local high_scores_print_entries 0226DA t2 digits_left
# 022712 "LDD <$FA; SUBD #$0018; STD <$FA" (the next entry 18 up), 022729 "DEC <$F1" (5 entries)
local high_scores_print_entries 022712 t4 entry_y
local high_scores_print_entries 022715 t2 next_entry_y
local high_scores_print_entries 022729 t2 entries_left
# 022748 "LDA <$EA; ASLA; LDD A,X; STD <$E8": a table of sprite codes in X (nothing calls it)
param unused_print_sprite_code x sprite_codes
local unused_print_sprite_code 02274C t4 sprite_code
# 022771 "LDD <$E8; STD #$02,U" (the code), 022777 "LDD <$F8; STD #$06,U" (x), 02277D "LDD <$FA; STD #$04,U" (y)
local put_sprite 022771 t4 sprite_code
local put_sprite 022777 t4 sprite_x
local put_sprite 02277D t4 sprite_y
# done: scenes/high_scores.c

# ---- scenes/scene_objects.c ----
# 02538A "LDU #$77BA; CLRB; EXG A,B; ASLB; ROLA" x3 (the record's offset, A x 8), then 0253AD/0253BD "LDD ,U++;
# CMPD #$FFFF" (its x and z, FFFF: as they are): A and B, the high and low halves of the word at hand
local scene_put_placement 025388,025391,025393,0253AD,0253BD a value_high
local scene_put_placement 02538E,025390,025392,0253AD,0253BD b value_low
local scene_put_placement 02538E t1 exchanged
# 025398 "LDY ,U++" (the placement's object), 0253A6 "LDD ,U++" (its kind and animation), 0253AD "LDD ,U++" (its
# x), 0253BD "LDD ,U++; STD #$16,Y" (its z): the record at each read
local scene_put_placement 025398 t1 placement_record
local scene_put_placement 0253A6 t1 kind_at
local scene_put_placement 0253AD t1 x_at
local scene_put_placement 0253BD t4 placement_z
# The cursor U across the "CMPY #$FFFF; BNE; TFR X,Y" join is a variable (place: 025398, after "LDY ,U++"; placement:
# 0253AD, after the x's "LDD ,U++") that the line "local scene_put_placement 025396 u place placement" types as a
# placement's start, so the C names the reads after the join by the wrong fields (PLACEMENT(t3)->object is the kind,
# ->kind the x, ->x the z): they point 2 and 6 bytes into the record
local scene_put_placement 025398 u place placement+2
local scene_put_placement 0253AD u placement placement+6
# 0253CE "LDU #$797A; ASLB; LDU B,U" (absent_player_blanks), 0253D4/0253D9/0253DE/0253E0 "LDA ,U+" (width, height,
# tile, colour), 0253FA "STA ,X+" (a tile), 0253FC "DEC <$E9" (the row's columns), 02540C "DEC <$EA" (the rows)
local blank_absent_player 0253D4 t1 blank
local blank_absent_player 0253D9 t1 height_at
local blank_absent_player 0253DE t1 tile_at
local blank_absent_player 0253E0 t1 colour_at
local blank_absent_player 0253FA t1 tile_place
local blank_absent_player 0253FC t2 columns_left
local blank_absent_player 02540C t2 rows_left
# done: scenes/scene_objects.c

# ---- scenes/stage_7_scenes.c ----
# 024741 "LBSR $85FF" (clear_child_objects: X past list 2), then 024753 "LBSR $7388" (scene_put_placement, whose
# records' object FFFF is X's)
local stage_7_scene_set_up 024741 x default_object
# 024756 "LDD #$0C,Y; ADDD <$F0; STD #$0C,Y" (the placement's x moved by the scroll), 024771 "DECB; BNE" (024751
# "LDD #$1404": 4 placements from 14)
local stage_7_scene_set_up 024756 t5 placed_x
local stage_7_scene_set_up 024771 t1 placements_left
# "INC $18E0" (scene_state) / "INC $18E1" (scene_substate): the scene's state before it moves on
local stage_7_scene_set_up 024774 t1 old_scene_state
local stage_7_scene_wait_scroll 024787 t1 old_scene_state
local unused_stage_7_scene_wait_far 024794 t1 old_scene_state
local stage_7_scene_wait_signal 0247A5 t1 old_scene_state
local stage_7_scene_wait_train 024834 t1 old_scene_substate
local stage_7_scene_put_chain 024887 t1 old_scene_substate
local stage_7_scene_move_chain 0248EF t1 old_scene_substate
local stage_7_end_board 024A06 t1 old_scene_state
local stage_7_end_set_up 024968 t1 old_scene_state
local stage_7_end_show 0249B1 t1 old_scene_state
local stage_7_end_take_off 024AA9 t1 old_scene_state
local stage_7_end_slow_down 024ACF t1 old_scene_state
# 0247AA "DECW $18E2; BEQ" (0247A1 "LDD #$FFFF; STD $18E2": the lift's frames)
local stage_7_scene_lift 0247AA t3 lift_frames_left
# 0247B0 "LDD $18EB; ADDD #$0002; STD $18EB" (the lift's speed, faster each frame), 0247BB "LDD <$D6; ADDD $18EB;
# STD <$D6" (layer B's scroll y's low byte and fraction), 0247C5 "LDB $18EB; SEX; ADCA <$D5" (the speed's high byte,
# into the scroll's high byte)
local stage_7_scene_lift 0247B0 t3 lift_speed
local stage_7_scene_lift 0247B4 t2 new_lift_speed
local stage_7_scene_lift 0247BB t4 layer_b_y_low
local stage_7_scene_lift 0247BE t3 speed_added
local stage_7_scene_lift 0247BE t4 old_layer_b_y_low
local stage_7_scene_lift 0247BE t5 new_layer_b_y_low
local stage_7_scene_lift 0247C5 t1 speed_high
# 0247D0 "LDX #$4D40", 0247D8 "LDD $18EB; STD #$19,X" (each of the 4 objects on the lift rises with it), 0247E2 "DEC
# <$F0"
local stage_7_scene_lift 0247D8 t3 item_speed
local stage_7_scene_lift 0247E2 t2 items_left
# 0247F6 "LDX #$3000; LDA <$D6; LSRA x3; ADDA #$1C; ANDA #$1F; LDB #$40; MUL; LEAX D,X": the row of layer B's codes
# the lift uncovers, 02480D "LDA #$10" (the tile), 02480F "LDB #$00" (its colour), 024815 "STA ,X+", 024817 "DEC <$F0"
# (64 columns)
local stage_7_scene_lift 024805 t1 row_offset
local stage_7_scene_lift 02480D a tile_code
local stage_7_scene_lift 02480F b tile_colour
local stage_7_scene_lift 024815 t1 tile_place
local stage_7_scene_lift 024817 t2 columns_left
# The chain of links stage_7_scene_put_chain hangs (024853 "LDA #$28; LBSR $68F8" an upper link, 024866 "LDA #$29;
# LBSR $68F8" its pair below, 6 times): each upper link keeps its pair in field 28 (02486B "LDX ,S; STY #$28,X") and
# the next upper link in field 2A (02485A "LDX <$FA; STY #$2A,X"; the last one the first: 02487A "LDD $18F0; STD
# #$2A,X"); stage_7_scene_move_chain walks them (0248CD/0248E1 "LDU #$28,X" the pair, 0248C0/0248E7 "LDX #$2A,X" the
# next)
scoped object stage_7_link 28 pair u16 object
scoped object stage_7_link 2A next_link u16 object
local stage_7_scene_put_chain 02485A x link_before object.stage_7_link
local stage_7_scene_put_chain 02486B x upper_link object.stage_7_link
local stage_7_scene_put_chain 024873 x last_link object.stage_7_link
local stage_7_scene_move_chain 02489E,0248C0,0248D4,0248E7 x link object.stage_7_link
# 02488C "LDX $18F2; LDD #$0C,X" (the chain's last link: 024847 "STU $18F2"), its x
local stage_7_scene_move_chain 02488C x end_link object
local stage_7_scene_move_chain 02488C t3 end_link_place
local stage_7_scene_move_chain 024890 t5 end_x
# 024875 "DEC <$F0" (024848 "LDA #$06; STA <$F0": 6 pairs), 0248EA likewise
local stage_7_scene_put_chain 024875 t2 links_left
local stage_7_scene_move_chain 0248EA t2 links_left
# 02487A "LDD $18F0" (the first link: 024843 "STU $18F0")
local stage_7_scene_put_chain 02487A t3 first_link
# 0248D4 "LDX $18F0" (the link that leads), 02489E likewise, 0248A2 "LDD #$0C,X" its x, 0248AB "SUBD $18EE" (the
# spacing: 024839 "LDD #$0808; STD $18EE")
local stage_7_scene_move_chain 0248D4 t3 first_link
local stage_7_scene_move_chain 02489E t3 lead_link
local stage_7_scene_move_chain 0248A2 t5 lead_x
local stage_7_scene_move_chain 0248AB t3 chain_spacing
# 0248B4 "INC $18ED", 0248B8 "LDA $18ED; CMPA #$06": the links that have moved off
local stage_7_scene_move_chain 0248B4 t1 old_links_moved
local stage_7_scene_move_chain 0248B8 t1 links_moved
# 024919/024920 "LBSR $867D" (vector_find_free_slot in lists 0 and 1): the slot found, in U
local stage_7_scene_new_object 024919,024920 u free_slot
# 0249FA/024A8E "DEC <$F0" (4 riders, a bit each of players_present: 0249D3 "LDA <$85; STA <$F1")
local stage_7_end_board 0249FA t2 riders_left
local stage_7_end_take_off 024A8E t2 riders_left
# 024A0B "LDX #$4D40; LDD #$0C,X; CMPD #$00E0" (the board's x), 024A16 "LDD #$19,X; ADDD #$0004; STD #$19,X"
local stage_7_end_take_off 024A0E t5 board_x
local stage_7_end_take_off 024A19 t2 new_z_speed
# 024A2C "LBSR $6AEB" (stage_7_end_zoom_riders: X past the riders), then 024A38 "LBSR $7388" (scene_put_placement)
local stage_7_end_take_off 024A2C,024A33,024AAD x default_object
# 024A2F "DECW $18E2; LBNE" (0249FF "LDD #$00F0; STD $18E2")
local stage_7_end_take_off 024A2F t3 take_off_wait
# 024ADE "DECW $18E2; BNE" (024AC8 "LDD #$0100; STD $18E2")
local stage_7_end_finish 024ADE t3 finish_wait
# 024AFC "DEC <$F0" (5 objects from 4D40), 024B24 "DEC <$F0" (the 4 riders from 4DA0)
local stage_7_end_zoom_riders 024AFC t2 objects_left
local stage_7_end_move_riders 024B24 t2 riders_left
# done: scenes/stage_7_scenes.c

# ---- scenes/stage_8_scenes.c ----
# "INC $18E0" (scene_state): the scene's state before it moves on
local stage_8_start_set_up 024B79 t1 old_scene_state
local stage_8_start_show 024C2B t1 old_scene_state
local stage_8_start_descend 024C89 t1 old_scene_state
local stage_8_start_stop 024CBD t1 old_scene_state
local stage_8_start_landing 024CE8 t1 old_scene_state
local stage_8_start_run_off 024D03 t1 old_scene_state
local stage_8_end_set_up 024E0B t1 old_scene_state
local stage_8_end_show 024E66 t1 old_scene_state
local stage_8_end_hold 024E82 t1 old_scene_state
local stage_8_end_switch_view 024EB8 t1 old_scene_state
local stage_8_end_show_kind_13 024F10 t1 old_scene_state
local stage_8_end_reunion 0251AF t1 old_scene_state
local stage_8_end_run_family 025344 t1 old_scene_state
# 024BA9/024E3C/024EF7 "LBSR $86AD"/"LBSR $868C" (X as the call leaves it), then "LBSR $7388" (scene_put_placement,
# whose records' object FFFF is X's)
local stage_8_start_show 024BA9 x default_object
local stage_8_end_show 024E3C x default_object
local stage_8_end_show_kind_13 024EF7 x default_object
# 024BDB "LDA #$32; LBSR $7388", 024BFC "LDA <$F2; LBSR $7388" (a rider's placement, from 2A: 024BF0 "LDA #$2A; STA
# <$F2"): the placement's number in A
local stage_8_start_show 024BDD,024BFF d rider_record
# 024C19 "DEC <$F0" (024BE5 "LDA #$04; STA <$F0": the 4 riders)
local stage_8_start_show 024C19 t2 riders_left
# 024C33 "LDD $18EB; SUBD #$0009; CMPD #$0009" (the descent's speed, slowing to 9), 024C46 "LDD <$D6; SUBD $18EB;
# STD <$D6" (layer B's scroll y down by it)
local stage_8_start_descend 024C33 t3 old_descent_speed
local stage_8_start_descend 024C49 t3 descent_step
# 024C8D "LDX #$5400", 024C95 "LDD $18EB; NEGD; STD #$19,X" (each of the 4 objects from 5400 sinks with it), 024CA0
# "DEC <$F0"
local stage_8_start_descend 024C95 t3 object_speed
local stage_8_start_descend 024CA0 t2 objects_left
# 024CAE "CLRD; STD #$19,X" (the 3 objects from 5460 stop), 024CB5 "DEC <$F0"
local stage_8_start_stop 024CAE d stop_speed
local stage_8_start_stop 024CAE a stop_speed_high
local stage_8_start_stop 024CB5 t2 objects_left
# 024D08 "DECW $18E2; BNE" (024CFA "LDD #$0080; STD $18E2")
local stage_8_start_wait_end 024D08 t3 end_wait
# 024D31 "LDU #$7774; LDA #$02,X; ASLA; JSR [A,U]": the players' states (stage_8_start_run_players_states), 024D3D
# "DEC ,S" (024D26 "LDA #$04; PUSHS A": the 4 players' objects from 5280)
local stage_8_start_run_players 024D31 u player_states
local stage_8_start_run_players 024D3D t2 players_left
# 024D58 "LDD $18EB; NEGD; STD #$19,X": the player rides down with the descent
local stage_8_start_player_ride 024D58 t3 descent_speed
# 024D75 "CLRA; LDB #$04,X; ADDD #$3F24; LBSR $8680": the landing shout of the player's kind
local stage_8_start_player_drop 024D79 t2 landing_shout
# 024DBF "LDD #$0C,X; CMPD #$0150"
local stage_8_start_player_gone 024DBF t5 player_x
# 024E75 "DECW $18E2; BNE" (024E5F "LDD #$0030; STD $18E2"), 024ECD likewise (0060), 0251C9 likewise (01C0), 025359
# likewise (0140)
local stage_8_end_hold 024E75 t3 hold_wait
local stage_8_end_show_kind_13 024ECD t3 view_wait
local stage_8_end_reunion 024F25 t3 reunion_wait
local stage_8_end_run_family 0251C9 t3 family_wait
local stage_8_end_finish 025359 t3 finish_wait
# 0251D2 "LDA #$07; PUSHS A", 0251E2 "DEC ,S": the 7 actors from 5280
local stage_8_end_run_family 0251E2 t2 actors_left
# 0251F6 "LDU #$779A" / 025245 / 02527F / 025297, then "LDA #$28,X; ASLA; JMP [A,U]": each actor's steps by its field 28
local stage_8_end_walker 0251F6 u walker_steps
local stage_8_end_extra 025245 u extra_steps
local stage_8_end_slow_extra 02527F u slow_extra_steps
local stage_8_end_maggie_taker 025297 u taker_steps

# The actors of the scene after stage 8's last boss (type F4: stage_8_end_reunion puts them, 0250A1 "STA #$002D,X",
# 02505B/025110/02514A "STD #$002B,X"; stage_8_end_run_family runs them): field 2A their wait (stage_8_end_actor_start
# "LDA #$20; STA #$2A,X", the _go steps "DEC #$2A,X; BNE", stage_8_end_taker_wait "LDA #$80; STA #$2A,X"), field 2B
# where the walker or extra stops, past the reunion's spot (02521C/02525D "LDD #$0C,X; ADDD #$2B,X; SUBD $18F4; BMI;
# CMPD #$0020": 0000, 0020, 0040... for each one in the line), field 2D the player (02522E "LDB #$2D,X; ADDD #$3F08;
# LBSR $8680": the player's voice)
scoped object stage_8_end 2A actor_wait u8
scoped object stage_8_end 2B stop_offset u16
scoped object stage_8_end 2D actor_player u8
# 024FDF "LDX #$5280", 0250A5/02511E "LEAX #$60,X", 025183 "LDX #$5580": the actors stage_8_end_reunion puts
local stage_8_end_reunion 024FDF,0250A5,02511E,025183 x object object.stage_8_end
# 024F2F "LDD $18F8; STD <$BE; STD <$CE", 024F39 "LDD $18FA; STD <$C5; STD <$D5": the scroll where the fight ended
local stage_8_end_reunion 024F2F t3 saved_scroll_x
local stage_8_end_reunion 024F39 t3 saved_scroll_y
# 024F8F "LDA $18FC; LSRA x4; BNE" (the player picked to take Maggie, number + 1 in the high bits, else the first one
# present), 024FA1 "LDB #$04", 024FAB "DECB"
local stage_8_end_reunion 024F8F t1 picked
local stage_8_end_reunion 024F96 t2 picked_number
local stage_8_end_reunion 024FAB t1 players_left
# 024FE9 "LDA $18FC; ANDA #$01" (this player the picked one), 02506B "CLR $18FC", 0250A8 "LSR $18FC" (the next player's
# bit)
local stage_8_end_reunion 024FE9 t1 picked_bit
local stage_8_end_reunion 02506B t1 discarded_read
local stage_8_end_reunion 0250A8 t1 old_picked_bits
# the spot of the reunion (18F4 x, 18F6 y) each actor is put by: 025035/025039 "LDD $18F4; ADDD <$FA" and
# 02503F/025043 "LDD $18F6; SUBD #$0010" (a walker), 025049 "LDD <$FA; SUBD #$0020" (the next walker's x),
# 025052/025055 "LDD <$FC; ADDD #$0020; STD <$FC; STD #$002B,X" (its stop offset)
local stage_8_end_reunion 025035 t3 walker_spot_x
local stage_8_end_reunion 025039 t6 walker_x
local stage_8_end_reunion 02503F t3 walker_spot_y
local stage_8_end_reunion 025043 t2 walker_y
local stage_8_end_reunion 025049 t4 old_walker_x
local stage_8_end_reunion 02504C t2 next_walker_x
local stage_8_end_reunion 025052 t4 old_stop_offset
local stage_8_end_reunion 025055 t2 walker_stop_offset
local stage_8_end_reunion 025055,02510A a stop_offset_high
local stage_8_end_reunion 025055,02510A b stop_offset_low
# 02507B "LDD $18F4; ADDD #$0070", 025085 "LDD $18F6; ADDD #$FFF2": the picked player, by the spot
local stage_8_end_reunion 02507B t3 taker_spot_x
local stage_8_end_reunion 02507F t2 taker_x
local stage_8_end_reunion 025085 t3 taker_spot_y
local stage_8_end_reunion 025089 t2 taker_y
# 024FFD "LDD $18F4; ADDD <$F8", 025007 "LDD $18F6; ADDD #$0010", 025011 "LDD <$F8; SUBD #$0020": a player standing
# there already
local stage_8_end_reunion 024FFD t3 stander_spot_x
local stage_8_end_reunion 025001 t6 stander_x
local stage_8_end_reunion 025007 t3 stander_spot_y
local stage_8_end_reunion 02500B t2 stander_y
local stage_8_end_reunion 025011 t4 old_stander_x
local stage_8_end_reunion 025014 t2 next_stander_x
# with all four players (0250BA "LDA <$85; ANDA #$0F; CMPA #$0F"): two extras (0250D8 "LDA #$C9"), 0250EA-02510D as
# for the walkers, 025121 "DEC <$F1"
local stage_8_end_reunion 0250EA t3 extra_spot_x
local stage_8_end_reunion 0250EE t6 extra_x
local stage_8_end_reunion 0250F4 t3 extra_spot_y
local stage_8_end_reunion 0250F8 t2 extra_y
local stage_8_end_reunion 0250FE t4 old_extra_x
local stage_8_end_reunion 025101 t2 next_extra_x
local stage_8_end_reunion 025107 t4 old_extra_offset
local stage_8_end_reunion 02510A t2 extra_stop_offset
local stage_8_end_reunion 025121 t2 extras_left
# 025126 "LDD #$CA81": the slow extra, 025130 "LDD $18F4; ADDD #$FE80", 02513A "LDD $18F6; ADDD #$0010", 025144 "LDD
# <$FC; ADDD #$0020; STD #$002B,X"
local stage_8_end_reunion 025130 t3 slow_spot_x
local stage_8_end_reunion 025134 t2 slow_extra_x
local stage_8_end_reunion 02513A t3 slow_spot_y
local stage_8_end_reunion 02513E t2 slow_extra_y
local stage_8_end_reunion 025144 t4 old_slow_offset
local stage_8_end_reunion 025147 t2 slow_stop_offset
# 025158 "LDX #$5520; LDD #$1186" (Maggie, kind 11), 02516A "LDD $18F4; ADDD #$0060", 025174 "LDD $18F6; SUBD #$0010"
local stage_8_end_reunion 02516A t3 maggie_spot_x
local stage_8_end_reunion 02516E t2 maggie_x
local stage_8_end_reunion 025174 t3 maggie_spot_y
local stage_8_end_reunion 025178 t2 maggie_y
# 025183 "LDX #$5580; LDD #$D383", 025195 "LDD $18F4", 02519C "LDD $18F6": the one put on the spot itself
local stage_8_end_reunion 025195 t3 spot_x
local stage_8_end_reunion 02519C t3 spot_y
# 02521C/02525D "LDD #$0C,X; ADDD #$2B,X; SUBD $18F4": the actor's x, its stop offset, the spot's x, and how far past
# the spot (with the offset) it is
local stage_8_end_walker_arrive 02521C t5 walker_x
local stage_8_end_walker_arrive 02521F t5 walker_offset
local stage_8_end_walker_arrive 025222 t3 spot_x
local stage_8_end_walker_arrive 025222 t5 past_spot
local stage_8_end_extra_arrive 02525D t5 extra_x
local stage_8_end_extra_arrive 025260 t5 extra_offset
local stage_8_end_extra_arrive 025263 t3 spot_x
local stage_8_end_extra_arrive 025263 t5 past_spot
# 02522E "LDB #$2D,X; ADDD #$3F08"
local stage_8_end_walker_arrive 02522E t3 walker_player
# done: scenes/stage_8_scenes.c

# ---- scenes/stage_ends.c ----
# the scenes' dispatchers: "LDX #$77xx; LDA $18E0; ASLA; JMP [A,X]" (024024, 02414B, 024412, 02460C, 02492F, 024DCD,
# 024B35, 024567, 0245C7; 02472D also "LDX #$7752; LDA $18E1" for its substate, 024737): the scene's steps, and its
# state (scene_state) or substate (scene_substate) now
local stage_1_end 024024 x scene_steps
local stage_1_end 024027 t1 scene_step
local stage_2_end 02414B x scene_steps
local stage_2_end 02414E t1 scene_step
local stage_5_end 024412 x scene_steps
local stage_5_end 024415 t1 scene_step
local post_bonus_2_scene 02460C x scene_steps
local post_bonus_2_scene 02460F t1 scene_step
local stage_7_scene 02472D,024737 x scene_steps
local stage_7_scene 024730 t1 scene_step
local stage_7_scene 02473A t1 scene_substep
local stage_7_end 02492F x scene_steps
local stage_7_end 024932 t1 scene_step
local stage_8_end 024DCD x scene_steps
local stage_8_end 024DD0 t1 scene_step
local stage_8_start 024B35 x scene_steps
local stage_8_start 024B38 t1 scene_step
local stage_6_end 024567 x scene_steps
local stage_6_end 02456A t1 scene_step
local stage_6_wake 0245C7 x scene_steps
local stage_6_wake 0245CA t1 scene_step
# 0241E2 "LDX #$771A; LDA $18E1; ASLA; JMP [A,X]" (stage_end_jump_away_steps)
local stage_end_jump_away 0241E2 x jump_steps
local stage_end_jump_away 0241E5 t1 scene_substep
# "INC $18E0" (scene_state) / "INC $18E1" (scene_substate): the scene's state before it moves on
local stage_1_end_start 024035 t1 old_scene_state
local stage_1_end_put_police_car 0240DE t1 old_scene_state
local stage_1_end_move_police_car 02410E t1 old_scene_state
local stage_1_end_wait 024120 t1 old_scene_state
local scene_clear 024183 t1 old_scene_state
local stage_2_end_set_up 0241DD t1 old_scene_state
local stage_end_put_jumpers 024246 t1 old_scene_substate
local stage_end_run_jumpers 024275 t1 old_scene_state
local stage_2_end_show_area_3 02435E t1 old_scene_state
local stage_2_end_put_players 024399 t1 old_scene_state
local stage_2_end_players_look_around 0243EA t1 old_scene_state
local stage_5_end_set_up 02448A t1 old_scene_state
local stage_end_show_players 02452D t1 old_scene_state
local stage_5_end_fade 024552 t1 old_scene_state
local stage_6_end_start 024577 t1 old_scene_state
local stage_6_end_effect 02459E t1 old_scene_state
local stage_6_wake_start 0245EF t1 old_scene_state
local post_bonus_2_scene_set_up 024643 t1 old_scene_state
local post_bonus_2_scene_show 0246BE t1 old_scene_state
local post_bonus_2_scene_wait 0246DA t1 old_scene_state
local post_bonus_2_scene_pan 02471E t1 old_scene_state
# 024279 "CLR $18E1": the read a CLR of memory makes first, unused
local stage_end_run_jumpers 024279 t1 discarded_read
# the scenes' waits: "DECW $18E7; BNE" (stage 1's end: 02402E "LDD #$0080; STD $18E7"), "DECW $18E2" (the others)
local stage_1_end_put_police_car 02403A t3 police_wait
local stage_1_end_move_police_car 0240E3 t3 police_wait
local stage_1_end_wait 024113 t3 police_wait
local stage_1_end_car_sound 02413E t3 police_wait
local stage_end_run_jumpers 02424B t3 jumpers_wait
local stage_2_end_players_look_around 02439E t3 look_wait
local stage_5_end_fade 024532 t3 fade_wait
local stage_5_end_finish 024557 t3 finish_wait
local stage_6_end_finish 0245A3 t3 finish_wait
local stage_6_wake_wave 0245F7 t3 wave_wait
local post_bonus_2_scene_wait 0246C3 t3 pan_wait
local post_bonus_2_scene_finish 024723 t3 finish_wait
# 02457C "DEC $18E2; BNE" (024571 "LDA #$80; STA $18E2": a byte here)
local stage_6_end_effect 02457C t1 effect_wait
# stage 1's end: the police car's three parts in list 2 (02404C "STU $18E1", 02407C "STU $18E3", 0240AC "STU $18E5"),
# 0240A9 "LBSR $867D" (the third part's free slot, set up through U: "STA #$00,U" ... "STD #$16,U"); 0240F2 "LDX
# $18E1; STD #$19,X", 0240F9 "LDX $18E3", 024100 "LDX $18E5" (each one's z speed), 02412C "LDX $18E1; LDD #$16,X"
local stage_1_end_put_police_car 0240A9 u car_part object
local stage_1_end_move_police_car 0240F2 x first_part object
local stage_1_end_move_police_car 0240F9 x second_part object
local stage_1_end_move_police_car 024100 x third_part object
# (the reads LDX makes, should they stay apart from X)
local stage_1_end_move_police_car 0240F2 t3 saved_first_part
local stage_1_end_move_police_car 0240F9 t3 saved_second_part
local stage_1_end_move_police_car 024100 t3 saved_third_part
local stage_1_end_car_sound 02412C t3 saved_first_part
local stage_1_end_car_sound 02412C x first_part object
local stage_1_end_car_sound 024130 t5 part_z
# 0241B0/024472/0244E0 "LBSR $86AD" (X as vector_draw_layer_strips leaves it), then "LBSR $7388" (scene_put_placement,
# whose records' object FFFF is X's)
local stage_2_end_set_up 0241B0 x default_object
local stage_5_end_set_up 024472 x default_object
local stage_end_show_players 0244E0 x default_object
# 024254 "LDA #$05; PUSHS A", 024269 "DEC ,S" (the 5 objects from 4D40)
local stage_end_run_jumpers 024269 t2 jumpers_left
# 024287 "LDB #$32,X; CMPB #$04; BEQ", 02428E "ADDD #$3F28; LBSR $8680": the jumper's shout (A 0 after "LDA #$31,X;
# BEQ"); 024294 "LDU #$7966; LDA #$30,X; ASLA; ASLA; LEAU A,U", 02429E "LDD ,U++" (stage_end_exit_speeds)
local stage_end_jumper_wait 02428E t2 jump_shout
local stage_end_jumper_wait 02429E t1 exit_speed_record
# 0242D0 "LDA #$0A,X; ADDA #$02; STA #$0A,X; BCC" (the zoom before it grows), 02430B "LDD #$0F,X; SUBD #$0008; BCC;
# CLRD" (slower, down to 0), 024317 "LDD #$19,X; ADDD #$0016; CMPD #$FFF0; BLT; LDD #$FFF0"
local stage_end_jumper_fly 0242D3 t1 old_zoom
local stage_end_jumper_fly 02430E t1 old_x_speed
local stage_end_jumper_fly 02430E t2 slower_x_speed
local stage_end_jumper_fly 02431A t2 new_z_speed
local stage_end_jumper_fly 02430E,024313,02431A,024322 a speed_high
local stage_end_jumper_fly 02430E,024313,02431A,024322 b speed_low
# 02437B "CLRA; LDB <$F1; ADDD #$3F28; LBSR $8680": the player's shout
local stage_2_end_put_players 02437F t2 shout
local stage_2_end_put_players 024382 d shout_command
# 0243A4 "LDD <$C5; ADDD #$0010; STD <$C5": layer A's scroll y
local stage_2_end_players_look_around 0243A4 t4 layer_a_y
local stage_2_end_players_look_around 0243A7 t2 new_layer_a_y
# 02448F/024538 "CLR [$18E4]", 024493/02453C "CLR [$18E6]": the two palette effects' jobs the scene started
# (024438/0244A2 "STU $18E4", 024447/0244B1 "STU $18E6", what vector_palette_request hands back), stopped
local stage_5_end_show_players 02448F t3 first_effect
local stage_5_end_show_players 024493 t3 second_effect
local stage_5_end_fade 024538 t3 first_effect
local stage_5_end_fade 02453C t3 second_effect
local stage_6_end_finish 0245A9 t3 effect_job
# 0244DC "LDA #$01; LDB #$26; LBSR $86AD" (layer B's columns), 0244F3 "LDA <$F0; CLRB; LBSR $73C9" (an absent player
# blanked), 0244FC "LDA <$F0; ADDA #$09; LBSR $7388" (a player's placement): one D through them
local stage_end_show_players 0244E0,0244F7,024501 d layer_then_player
# 025413 "LDU #$..." (dream_wave_grow_steps), 025416 "LDA $18EC; ASLA; JMP [A,U]": the dream wave's step
local stage_5_end_finish 025413 u wave_steps
local stage_5_end_finish 025416 t1 wave_step
# 024600 "LDX #$2000; LEAX #$-01,X; BNE": a delay loop
local stage_6_wake_wave 024603 t2 delay_left
local stage_6_wake 024603 t2 delay_left
# dream_wave_draw: 025533 "CLR $18EA" (the read a CLR makes first, unused); 025537 "LDX #$1A00" (the row scroll),
# 02553A "LDA $18EA; ADDA $18EB; ASLA; LDB #$40; LBSR $74F4" (wave_sine of the row plus the wave's phase), 025548
# "ADDD #$0196; ANDA #$01; EXG A,B; STD ,X++" (the row's scroll), 025551 "DEC $18EA; BNE" (256 rows)
local dream_wave_draw 025533 t1 discarded_read
local dream_wave_draw 02553A t1 row
local dream_wave_draw 02553E t1 wave_phase
local dream_wave_draw 025545 d wave_value
local dream_wave_draw 025545,02554B a wave_high
local dream_wave_draw 025545 b wave_low
local dream_wave_draw 025548 t2 row_scroll
local dream_wave_draw 02554D t1 exchanged
local dream_wave_draw 02554F t1 row_scroll_at
local dream_wave_draw 025551 t1 rows_left
# done: scenes/stage_ends.c

# ---- scenes/stories.c ----
# 03E81F "LDX #$5640" (the story actor, object 32), 03E82A "LDY #$47,X", 03E842 "LDY #$43,X", 03E84B "LDY #$45,X" (its
# child actors: child_actors[2], [0], [1])
local stage_2_events 03E84B t5 second_child
# 03E866 "LDD #$16,X; ADDD #$0040; STD #$16,X": the follower 40 higher
local story_follower 03E869 t2 new_z
# 03E943 "LDY $1852; STY #$45,X": the actor noted at 1852 (story_noted_actor: 03E895 "STX $1854"), as the story
# actor's second child
local story_stage_4_end 03E943 t3 noted_actor
# 03E9C6 "LDX #$5640", 03E9CB "STA #$30,X" (the story actor's script number), 03E9CE "LDA $1854; LBEQ" (a wait for
# the noted actor), 03E9D5 "LDY $1852; DECA; STA #$2A,Y", 03E9DD "CLR $1854" (the read a CLR makes first, unused)
local stage_8_events 03E9CE t1 noted_wait
local stage_8_events 03E9D5 t3 noted_actor
local stage_8_events 03E9DD t1 discarded_read
# 03E9EA "LDY $1852", 03E9EE "LDD #$0C,Y; CMPD #$00AF" (the noted actor's x, to walk the camera towards); for each
# player (story_first_player, story_next_player): its kind x 32 (signed) from the noted actor's x and 10 below it,
# its partner's (player + 60) place
local story_stage_8_end 03E9EA t3 noted_object
local story_stage_8_end 03E9EE t5 noted_x
local story_stage_8_end 03EA23 t1 kind_offset
local story_stage_8_end 03EA24 t3 noted_again
local story_stage_8_end 03EA28 t5 noted_x_again
local story_stage_8_end 03EA28 t7 partner_x
local story_stage_8_end 03EA2E t5 noted_y
local story_stage_8_end 03EA31 t2 partner_y
# 03FDD2 "LDD <$AC; CMPD #$033C" (the camera's x), then for each player its kind x 32 + 03ED less the camera's x, and
# B0 + the camera's y, its partner's place
local story_burns_robot_entrance 03FDD2 t4 camera_x_now
local story_burns_robot_entrance 03FE01 t1 kind_offset
local story_burns_robot_entrance 03FE02 t2 offset_place_x
local story_burns_robot_entrance 03FE05 t6 partner_x
local story_burns_robot_entrance 03FE0E t6 partner_y
# 03ED43 "CLR $184B", 03ED47 "CLR $184E", 03ED4B "CLR $1850", 03ED4F "CLR $185A": the reads a CLR of memory makes
# first, unused
local scene_load_story_settings 03ED43 t1 discarded_read_1
local scene_load_story_settings 03ED47 t1 discarded_read_2
local scene_load_story_settings 03ED4B t1 discarded_read_3
local scene_load_story_settings 03ED4F t1 discarded_read_4
# done: scenes/stories.c

# ---- scenes/story_1.c ----
# 02722D "LDX #$7ED1; LDA $18E0; ASLA; JSR [A,X]" (the story's steps by scene_state), 027237 "LDA $18E2; BEQ" (set
# by each part when it is done: "INC $18E2"), 02723D "CLR $18E2", 027241 "INC $18E0", 027245 "CLR $18E1"
local story_1 02722D x scene_steps
local story_1 027230 t1 scene_step
local story_1 027237 t1 part_done
local story_1 02723D t1 discarded_read
local story_1 027241 t1 old_scene_state
local story_1 027245 t1 discarded_read_2
# "INC $18E2": the part's done flag before it is set
local story_1_set_up_street 0272C5 t1 old_part_done
local story_1_street 027364 t1 old_part_done
local story_1_redraw 0273D6 t1 old_part_done
local story_1_rise_coast 027485 t1 old_part_done
local story_1_last_view 02751E t1 old_part_done
local story_1_end 0275A6 t1 old_part_done
local story_1_finish 0275A6 t1 old_part_done
# "INC $18E0" / "INC $18E1": the story's state or substate before it moves on
local story_1_rise 0273ED t1 old_scene_state
local story_1_rise_start 027412 t1 old_scene_substate
local story_1_rise_slow_down 027443 t1 old_scene_substate
local story_1_pan_right 0274C3 t1 old_scene_substate
local story_1_end_start 02753A t1 old_scene_substate
local story_1_end_sounds 027557 t1 old_scene_substate
local story_1_hide_text 02756E t1 old_scene_substate
local story_1_show_text 027595 t1 old_scene_substate
# "LDA $18E1; ASLA; JMP [A,X]": the story's substate now (0273E3 "LDX #$7EDD", 02748A "LDX #$7EE3", 02752A "LDX #$7EE7")
local story_1_rise 0273E6 t1 scene_substep
local story_1_pan 02748D t1 scene_substep
local story_1_end 02752D t1 scene_substep
# 0272BC/02751B "LBSR $77D6" (story_put_object: the object it puts, in X)
local story_1_set_up_street 0272BC x street_object
local story_1_last_view 02751B x text_object
# the parts' waits: "DEC $18E3; BNE" (each part sets it: 0272BF "LDA #$B0; STA $18E3"...)
local story_1_street 0272D1 t1 street_wait
local story_1_redraw 027370 t1 street_wait
local story_1_rise_coast 027448 t1 coast_wait
local story_1_pan_right 027494 t1 pan_wait
local story_1_pan_wait 0274C8 t1 pan_wait
local story_1_hide_text 02755C t1 caption_wait
local story_1_show_text 027573 t1 caption_wait
local story_1_finish 02759A t1 finish_wait
# 02733A "LBSR $8677; STU $18E7" (vector_palette_request: the palette effect's job, in U), 027376 "CLR [$18E7]"
# (stopped)
local story_1_street 02733A u effect_job
local story_1_redraw 027376 t3 effect_job
# 0273FA "LDD #$FA00; STD $18E5" (the rise's speed), 02741E/02744E "LDD $18E5; ADDD #$000A; STD $18E5" (slowing)
local story_1_rise_slow_down 02741E t3 rise_speed
local story_1_rise_slow_down 027422 t2 new_rise_speed
local story_1_rise_coast 02744E t3 rise_speed
# 027460 "LDD <$C6; ADDD $18E5; STD <$C6" (layer A's scroll y's low byte and fraction), 02746A "LDB $18E5; SEX; ADCA
# <$C5" (the speed's high byte into the scroll's high byte)
local story_1_scroll_layer_a 027460 t4 layer_a_y_low
local story_1_scroll_layer_a 027463 t3 rise_speed
local story_1_scroll_layer_a 027463 t4 old_layer_a_y_low
local story_1_scroll_layer_a 027463 t5 new_layer_a_y_low
local story_1_scroll_layer_a 02746A t1 rise_speed_high
# 02749A "LDD <$CF; ADDD #$0A00; STD <$CF" (layer B's scroll x's low byte and fraction)
local story_1_pan_right 02749A t4 layer_b_x_low
local story_1_pan_right 02749D t1 old_layer_b_x_low
# 027585 "LDB #$08" (the next wait), 02758F "LDB #$80" (a longer one at substate 9: 027587 "LDA $18E1; CMPA #$09"),
# 027591 "STB $18E3"
local story_1_show_text 027585,02758F b next_wait
local story_1_show_text 027587 t1 substate_now
# 0275B1 "LDU #$7EFD" (story_1_family_scripts), 02765C "LDU #$7F17" (story_1_runner_scripts), 027767 "LDU #$7F37"
# (story_1_text_steps), each then "ASLA; JMP [A,U]"; 02776A "LDX #$4F80" the text's object
local story_1_family 0275B1 u family_scripts
local story_1_runners 02765C u runner_scripts
local story_1_text 027767 u text_steps
local story_1_text 02776A x text_object
# 0276A3 "LDD #$0C,X; CMPD #$00A0", 0276B9 "LDD #$11,X; SUBD #$0008"
local story_1_smithers_collide 0276A3 t5 smithers_x
local story_1_smithers_collide 0276B9 t5 smithers_y
# 0276E3/027749 "LDA #$29,X; ADDA #$02; STA #$29,X; BCC" (the turn, by the heading in field 29)
local story_1_smithers_run_off 0276E6 t1 old_heading
local story_1_goon_run_off 02774C t1 old_heading

# An object a story puts (story_put_object, 0277D6, the records story_1_marge_start... story_1_smithers_drop_start
# and the other object_start pieces of bank 13, 10 bytes each: assets/data/layout.txt): 0277D6 "LDX ,U++" (its place
# in the work RAM), 0277E0 "LDA ,U+; STA #$04,X" (its kind), 0277E5 "LDA ,U+; ORA #$80; STA #$05,X" (its animation),
# 0277EC "LDD ,U++; STD #$0C,X" (x), 0277F1 "LDD ,U++; STD #$11,X" (y), 0277F6 "LDD ,U; STD #$16,X" (z)
struct story_object_start 0A rom
field story_object_start 00 object u16 object
field story_object_start 02 kind u8
field story_object_start 03 animation u8
field story_object_start 04 x u16
field story_object_start 06 y u16
field story_object_start 08 z u16
param story_put_object u record story_object_start
local story_put_object 0277D6 t1 object_at
local story_put_object 0277E0 t1 kind_at
local story_put_object 0277E5 t1 animation_at
local story_put_object 0277EC t1 x_at
local story_put_object 0277EC t4 placed_x
local story_put_object 0277F1 t1 y_at
local story_put_object 0277F1 t4 placed_y
local story_put_object 0277F6 t4 placed_z
# done: scenes/story_1.c

# ---- scenes/story_actor.c ----
# story_actor_run runs the actor in X (03E05A "LDA #$00,X"; 03E05F "CMPX #$5640": the story actor itself, object 32,
# or one of its children and the players, 03E69A/03E6B7 "LBSR $605A" with X each): its fields as story_actor's
# (03E07B "LDB #$30,X" script_number, 03E0A2 "STY #$2E,X" script, 03E0BF "LDU #$37,X" script_target, 03E15A "ADDD
# #$31,X" acceleration_x...). Today its accesses are mem_read8(object + 0x42u): X is also the cursor of the BSETW that
# clears fields 28-57 (03E084 "LEAX #$28,X; LDU #$0018; BSETW D,X,U"), so that one site points at no structure, and
# 03E08B "PULLS B,X" brings the actor back
param story_actor_run x object object.story_actor
local story_actor_run 03E084 x cleared_fields none
local story_actor_run 03E08B x object object.story_actor
# 03E1B0 "PUSHS X" round the players' clearing (story_clear_player with X each), 03E1C6 "PULLS X": the actor again
local story_actor_run 03E1C6 x object object.story_actor
# 03E0BF "LDU #$37,X; LBEQ" (the object it walks to), 03E0C5 "LDB #$1F,X; CLRA; STD <$F8" (its reach in x, the hit box
# width), 03E0CC "LDB #$39,X; NEGB; SEX; ADDD #$0C,X; STD <$FA" (its x less the target margin), 03E0D7-03E0E8 "LDD
# <$FA; SUBD/ADDD <$F8; CMPD #$0C,U" (the target's x within the reach), 03E0ED "LDB #$20,X" (the reach in y),
# 03E0F4-03E105 "LDD #$11,X; SUBD/ADDD <$F8; CMPD #$11,U"
local story_actor_run 03E0BF t5 walk_target
local story_actor_run 03E0C5 t3 reach_width
local story_actor_run 03E0CC t3 reach_margin
local story_actor_run 03E0D0 t1 negative_margin
local story_actor_run 03E0D1 t5 actor_x
local story_actor_run 03E0D1 t7 reach_centre
local story_actor_run 03E0D7 t4 centre_x
local story_actor_run 03E0DA t6 reach_left
local story_actor_run 03E0DD t5 target_x
local story_actor_run 03E0E2 t4 centre_x_again
local story_actor_run 03E0E5 t6 reach_right
local story_actor_run 03E0E8 t5 target_x_again
local story_actor_run 03E0ED t3 reach_depth
local story_actor_run 03E0F4 t5 actor_y
local story_actor_run 03E0F7 t6 reach_top
local story_actor_run 03E0FA t5 target_y
local story_actor_run 03E0FF t5 actor_y_again
local story_actor_run 03E102 t6 reach_bottom
local story_actor_run 03E105 t5 target_y_again
# 03E117 "LDA #$06,X; ORA #$40; STA #$06,X" (arrived: its animation held)
local story_actor_run 03E117 t3 old_animation_flags
# 03E122 "LDB #$39,X; LDA #$04,X; CMPA #$03; BHI" (a player: kind 0-3, its margin by its place), 03E12C "MUL; SUBB
# #$39,X; LDA #$39,X; ASRA; SUBB ,S+", then 03E138 "LBSR $8671" (vector_direction_to_offset), 03E13B "LDB #$3A,X;
# LBSR $8617" (vector_set_speed_by_direction at its walk speed)
local story_actor_run 03E122 t3 walk_margin
local story_actor_run 03E125 t3 actor_kind
local story_actor_run 03E12D t3 margin_again
local story_actor_run 03E130 t3 margin_to_halve
local story_actor_run 03E13B t3 actor_walk_speed
# the script flags (field 42) read at 03E141 (bit 0: walk without turning), 03E172 (bit 1: a sound every 16 frames),
# 03E186 (bit 4: halted), 03E1E2 (bit 4: waiting for presses), 03E214 (cleared)
local story_actor_run 03E141 t3 turn_flags
local story_actor_run 03E172 t3 sound_flags
local story_actor_run 03E186 t3 halt_flags
local story_actor_run 03E1E2 t3 press_flags
local story_actor_run 03E214 t3 old_press_flags
# 03E148 "LDA #$09,X; ANDA #$BF; LDU #$0F,X; BPL; ORA #$40" (facing by its x speed)
local story_actor_run 03E148 t3 old_attributes
local story_actor_run 03E14D t5 x_speed_now
# 03E157-03E16F "LDD #$0F,X; ADDD #$31,X; STD #$0F,X" and likewise y (14, 33) and z (19, 35): each speed plus its
# acceleration
local story_actor_run 03E157 t5 old_x_speed
local story_actor_run 03E15A t5 x_acceleration
local story_actor_run 03E15A t7 new_x_speed
local story_actor_run 03E160 t5 old_y_speed
local story_actor_run 03E163 t5 y_acceleration
local story_actor_run 03E163 t7 new_y_speed
local story_actor_run 03E169 t5 old_z_speed
local story_actor_run 03E16C t5 z_acceleration
local story_actor_run 03E16C t7 new_z_speed
# 03E0B0 "LDD #$31,X; STD <$E4", 03E0B6 "LDD #$33,X; STD <$E6" (the story actor's accelerations push the players)
local story_actor_run 03E0B0 t5 push_x
local story_actor_run 03E0B6 t5 push_y
# 03E18E "LDY #$2A,X; BEQ" (the object it waits for), 03E193 "LDA #$2D,Y; CMPA #$01" (that one's wait)
local story_actor_run 03E18E t5 awaited_actor
local story_actor_run 03E193 t3 awaited_wait
# 03E1A1 "TST #$29,X" (waiting for the players: story_actor_wait_for_players), 03E1A6 "TST $184E"
local story_actor_run 03E1A1 t3 players_awaited
local story_actor_run 03E1A6 t1 players_signal
# 03E1D1 "LDD #$3C,X; CMPD <$AC" (the camera x it waits for)
local story_actor_run 03E1D1 t5 awaited_camera_x
# 03E1E9 "LDA #$04; LDB #$04,X; MUL; ADDD #$4842" (the player's newly pressed controls), 03E1FA "LDA #$1D,X; DECA;
# STA #$1D,X; ADDA #$1C,X" (each press shortens the wait), 03E20E "DEC #$1C,X; LBNE"
local story_actor_run 03E1EB t3 player_number
local story_actor_run 03E1EE t1 controls_offset
local story_actor_run 03E1EF t2 pressed_controls
local story_actor_run 03E1FA t3 press_step
local story_actor_run 03E204 t3 press_frames
local story_actor_run 03E20E t3 press_wait_left
# 03E21F "LDB #$3B,X; CLRA; CMPD #$16,X; LBLT" (the height it waits to come down to)
local story_actor_run 03E21F t3 awaited_height
local story_actor_run 03E225 t5 actor_z
# 03E238 "LDD #$3E,X; SUBD <$AC; CMPD #$0C,X; LBGT; DECD; STD #$0C,X" (the x on screen it waits to reach)
local story_actor_run 03E238 t5 awaited_x
local story_actor_run 03E23D t6 awaited_screen_x
local story_actor_run 03E240 t5 actor_x_now
local story_actor_run 03E246 t2 stop_x
# 03E252 "LDD #$0A,X; BEQ; LBSR $863B; ANDA #$0F; CMPA #$0B,X" (the floor it waits for: story_actor_wait_for_floor)
local story_actor_run 03E252 t5 floor_wait_word
local story_actor_run 03E25C t3 awaited_floor
# 03E267 "DEC #$2D,X; LBNE" (story_actor_wait's frames)
local story_actor_run 03E267 t3 wait_left
# 03E270 "LDY #$2E,X" (where its script goes on)
local story_actor_run 03E270 t5 script_at
# 03E273 "LDA ,Y+; CMPA #$FF; ASLA; LDU #$7000; JMP [A,U]": the script's next operation
local story_actor_next_operation 03E273 t1 operation_at
local story_actor_next_operation 03E273 a operation
# the operations' arguments, read through the script cursor (Y) one after another
local story_actor_set_kind 03E280 t1 kind_at
local story_actor_set_animation 03E288 t1 animation_at
local story_actor_set_place 03E290 t1 x_at
local story_actor_set_place 03E295 t1 y_at
local story_actor_set_place 03E29A t1 z_at
local story_actor_set_speeds 03E2AA t1 x_speed_at
local story_actor_set_speeds 03E2AF t1 y_speed_at
local story_actor_set_speeds 03E2B4 t1 z_speed_at
local story_actor_set_accelerations 03E2BC t1 acceleration_x_at
local story_actor_set_accelerations 03E2C1 t1 acceleration_y_at
local story_actor_set_accelerations 03E2C6 t1 acceleration_z_at
local story_actor_set_accelerations_xy 03E3BB t1 acceleration_x_at
local story_actor_set_accelerations_xy 03E3C0 t1 acceleration_y_at
# 03E2E9 "LDU ,Y++; LDU ,U" (the address of a variable that holds the object to walk to), 03E2F0 "LDD ,Y++; STA
# #$39,X; STB #$3A,X" (the margin and the walk speed)
local story_actor_walk_to_object_in 03E2E9 t1 variable_at
local story_actor_set_target 03E2F0 t1 margin_at
local story_actor_set_target 03E2F0 d margin_and_speed
# story_actor_put_in's argument is a child_object record (8 bytes, 03E332/03E378/03E384 "LEAY #$08,Y"): 03E2FB "LDA
# #$05,Y; CMPA #$04" (its list: 4 the players, 5 a player's partner, else 03E37F "LBSR $862C" vector_spawn_child with
# the record in Y), 03E31A "LDA #$06,Y; STA #$30,X" (its state), 03E325 "ADDA #$07,Y" (its type); 03E34E "LDD ,Y++;
# ADDD #$0C,X" (dx), 03E356 (dy), 03E35E "LDB ,Y++" (dz), 03E367 "LDA ,Y++; STA #$30,U" (state)
param story_actor_put_in y script child_object
local story_actor_put_in 03E2FB t3 child_list
local story_actor_put_in 03E310 t2 present_bits
local story_actor_put_in 03E31A t3 players_state
local story_actor_put_in 03E325 t3 kind_base
local story_actor_put_in 03E34E t1 dx_at
local story_actor_put_in 03E34E t4 offset_dx
local story_actor_put_in 03E350 t5 actor_x
local story_actor_put_in 03E350 t7 child_x
local story_actor_put_in 03E356 t1 dy_at
local story_actor_put_in 03E356 t4 offset_dy
local story_actor_put_in 03E358 t5 actor_y
local story_actor_put_in 03E358 t7 child_y
local story_actor_put_in 03E35E t1 dz_at
local story_actor_put_in 03E361 t7 child_z
local story_actor_put_in 03E367 t1 state_at
# 03E341 "LDU #$4AA0", 03E36F "LEAU #$00C0,U", 03E373 "DEC <$F0" (the players' partners); 03E39B "LDD ,X; BNE",
# 03E3A6 "DEC <$F0" (03E391 "LDA #$0B": the 11 child slots from 43)
local story_actor_put_in 03E373 t2 partners_left
local story_actor_put_in 03E3A6 t2 slots_left
# 03E3B0 "LDA ,Y+; STA #$2D,X"
local story_actor_wait 03E3B0 t1 wait_at
# story_actor_line_up_players: 03E3D7 "LDB #$04; SUBB <$F0" (the player's place in the line), 03E3DC "LDA #$06,Y; BMI;
# MUL" (times the x step, 03E3E4 "NEGA; MUL; NEGD" when it is negative), 03E3E7 "ADDD ,Y; STD #$0C,X", 03E3EC "LDD
# #$02,Y; STD #$11,X", 03E3F2 "LDB ,U+" (player_line_up_orders), 03E3F4 "LDA #$07,Y; MUL; ADDD #$04,Y; STD #$16,X"
local story_actor_line_up_players 03E3DC t3 x_step
local story_actor_line_up_players 03E3E5 t1 back_product
local story_actor_line_up_players 03E3E6 t2 back_offset
local story_actor_line_up_players 03E3E1 t1 forward_offset
local story_actor_line_up_players 03E3E7 t6 player_x
local story_actor_line_up_players 03E3EC t5 line_y
local story_actor_line_up_players 03E3F2 t1 order_at
local story_actor_line_up_players 03E3F4 t3 z_step
local story_actor_line_up_players 03E3F7 t1 z_offset
local story_actor_line_up_players 03E3F8 t5 line_z
local story_actor_line_up_players 03E3F8 t7 player_z
local story_actor_line_up_players 03E3DC,03E3E1,03E3E6 a offset_high
local story_actor_line_up_players 03E3D9,03E3E1,03E3E6 b offset_low
# 03E413 "LDD ,Y++; STD #$1F,X" (the box's width and depth), 03E418 "LDA ,Y+; STA #$21,X" (its height)
local story_actor_set_hit_box 03E413 t1 box_at
local story_actor_set_hit_box 03E413 t4 width_and_depth
local story_actor_set_hit_box 03E418 t1 height_at
# 03E420 "LDU ,Y++" (the sound), 03E422 "LDB ,Y+; LDA #$C0; MUL; ADDD #$4A40" (the player's object), 03E430 "TST ,X"
local story_actor_play_sound_if_player 03E420 t1 sound_at
local story_actor_play_sound_if_player 03E422 t1 player_at
local story_actor_play_sound_if_player 03E426 t1 player_offset
local story_actor_play_sound_if_player 03E427 t2 player_object
local story_actor_play_sound_if_player 03E430 t2 player_flags
# 03E441 "LDB #$04,X; CLRA; ADDD ,Y++" (the sound of the actor's kind)
local story_actor_play_kind_sound 03E445 t1 command_at
local story_actor_play_kind_sound 03E445 t6 kind_command
local story_actor_play_sound 03E44D t1 command_at
local story_actor_set_attributes 03E463 t1 attributes_at
# 03E47E "LDU ,Y++; LDD ,U; STD #$2A,X" (the address of a variable that holds the object to wait for)
local story_actor_wait_for_object 03E47E t1 variable_at
local story_actor_wait_for_object 03E47E u object_variable
# "TST $184E" (the story's signal that the players may go on)
local story_actor_wait_for_players 03E48B t1 players_signal
# 03E4A6 "LDA ,Y+; STA #$05,X" (the animation), 03E4B0/03E4EF "LDU ,Y++; LDU ,U; LDU #$0C,U; CMPU #$0C,X" (the x
# of the object a variable holds, against the actor's)
local story_actor_random_player_faces 03E4A6 t1 animation_at
local story_actor_random_player_faces 03E4B0 t1 variable_at
local story_actor_random_player_faces 03E4B4 t5 faced_x
local story_actor_random_player_faces 03E4B7 t5 player_x
local story_actor_face_object 03E4EF t1 variable_at
local story_actor_face_object 03E4F3 t5 faced_x
local story_actor_face_object 03E4F6 t5 actor_x
# 03E4D7 "LDA #$01,Y; STA #$05,X"
local story_actor_set_players_animation 03E4D7 t3 new_animation
local story_actor_wait_for_height 03E50B t1 height_at
local story_actor_wait_for_camera 03E528 t1 camera_x_at
# 03E533 "LDU ,Y++" (a variable's address), 03E535 "LDA ,Y+; STA ,U" (its value)
local story_actor_set_variable 03E533 t1 variable_at
local story_actor_set_variable 03E533 u variable
local story_actor_set_variable 03E535 t1 value_at
local story_actor_wait_for_x 03E550 t1 x_wait_at
# 03E55C "LDU ,Y++; STU <$F8", 03E561 "LDU ,Y++; STU <$FA" (the players' place), 03E56E/03E576 "LDD ,U++; ADDD <$F8"
# (each player's offset: story_player_place_offsets), 03E585 "TST ,Y+" (whether they run in)
local story_actor_place_players 03E55C t1 place_x_at
local story_actor_place_players 03E561 t1 place_y_at
local story_actor_place_players 03E56E t1 offset_x_at
local story_actor_place_players 03E576 t1 offset_y_at
local story_actor_place_players 03E585 t1 run_in_at
# 03E5A9 "LDB <$50" (players_playing), 03E5B1 "LSRB; BCS" (a player who is not playing gets the absent script)
local story_actor_start_absent_players 03E5B1 t1 playing_bits
local story_actor_wait_for_floor 03E5C6 t1 floor_at
# 03E5DB "LDB #$04,X; ASLB; LDD B,Y" (the voice of the player picked, by its kind), 03E5F8-03E60D its partner put by it
# (x, y - 2, z + 42: its speech balloon)
local story_actor_player_speaks 03E5DF t4 voice
local story_actor_player_speaks 03E5DF,03E610 a voice_high
local story_actor_player_speaks 03E5DF,03E610 b voice_low
local story_actor_player_speaks 03E5F8 t5 speaker_x
local story_actor_player_speaks 03E5FE t5 speaker_y
local story_actor_player_speaks 03E601 t2 balloon_y
local story_actor_player_speaks 03E60A t2 balloon_z
# 03E65C "LDD ,Y++; STD #$1C,X" (the wait and the step each press takes off it)
local story_actor_wait_or_presses 03E65C t1 wait_at
local story_actor_wait_or_presses 03E65C t4 wait_and_step
# 03E68D "LEAX #$43,X; TFR X,Y", 03E694 "LDX ,Y++; BEQ" (its child actors: story_actor_run each), 03E6A1 "DECA"; 03E6AC
# "TST $184E" (the players run too); 03E6EB "LDA #$30,X; CMPA #$21" (its script number), 03E6F6 "LDY #$0C,X; CMPY
# #$0190" (off the screen: removed)
local story_actor_finish_frame 03E694 t1 child_slot_at
local story_actor_finish_frame 03E694 t4 slot_child
local story_actor_finish_frame 03E6A1 t1 children_left
local story_actor_finish_frame 03E6AC t1 players_signal
local story_actor_finish_frame 03E6EB a actor_script
local story_actor_finish_frame 03E6F6 t5 actor_x
# 03E736 "CLR $184B", 03E73A "CLR $184E": the reads a CLR of memory makes first, unused
local story_actor_remove 03E736 t1 discarded_read
local story_actor_remove 03E73A t1 discarded_read_2
# 03E719 "LDY #$40,X; LEAY #$43,Y", 03E724 "CMPX ,Y++" (the parent's child slots), 03E72D "DEC <$F0"
local story_actor_remove 03E724 t1 child_slot_at
local story_actor_remove 03E72D t2 slots_left
# 03E779 "LEAX #$1C,X; LDU #$003D; CLRA; BSET A,X,U" (a player's fields 1C-58 cleared), 03E783 "LDA #$34,X; ORA #$02"
local story_actor_remove 03E77F a fill
local story_actor_remove 03E783 t3 old_bits_34
# 03E7A9 "LEAX #$43,X", 03E7AC "LDU ,X++; BEQ" (each child), 03E7B5 "DECA"
local story_actor_remove_children 03E7AC t1 child_slot_at
local story_actor_remove_children 03E7AC t4 slot_child
local story_actor_remove_children 03E7B5 t1 children_left
# 03E7C0 "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40" (a player's object at random), 03E7CF "LDA #$04,X; LSR <$F1;
# DECA" (its bit among players_present), 03E7DA "LSR <$F1; BCS" (present), 03E7E8 "LSR <$F1; BCS" (else the first
# present one)
local story_random_player 03E7C7 t1 player_offset
local story_random_player 03E7C8 t2 random_player
local story_random_player 03E7D7 t1 shifts_left
local story_random_player 03E7DA t2 player_bits
local story_random_player 03E7E8 t2 first_bits
# 03E800 "DEC <$F0" (story_first_player: 03E7F3 the 4 players)
local story_next_player 03E800 t3 players_left
# done: scenes/story_actor.c

# ---- stages/bonus_1.c, stages/bonus_2.c ----
# 07A6E3/07AFAE "DECW <$0A; BEQ" (scene_timer: the bonus intro's frames)
local bonus_1_intro_phase 07A6E3 t4 intro_wait
local bonus_2_intro_phase 07AFAE t4 intro_wait
# 07A73A "CLR $18E0", 07AF2C "CLR $1C80": the read a CLR of memory makes first, unused
local bonus_1_intro_phase 07A73A t1 discarded_read
local bonus_2_setup 07AF2C t1 discarded_read
# done: stages/bonus_1.c
# done: stages/bonus_2.c
# done: stages/ending.c

# ---- stages/rank.c ----
# 040C96 "LDD <$63; CMPD ,X" (the frames of the scene against rank_step_times), 040CCF "LDD <$65; CMPD ,X"
local rank_add_time_step 040C96 t4 scene_frames
local rank_check_frame_limit 040CCF t4 waited_frames
# 040CD7 "LDD <$93; ADDD #$0001; STD <$93" (the frames without moving on), 040CE9 "LDA $1876; BEQ" (the enemies in
# play: 07CB89 "INC $1876"), 040D17 "LDD <$93; CMPD #$0100"
local hurry_up_timer 040CD7 t4 old_hurry_frames
local hurry_up_timer 040CDA t2 new_hurry_frames
local hurry_up_timer 040CE9 t1 enemies_in_play
local hurry_up_timer 040D17 t4 hurry_frames
# done: stages/rank.c

# ---- stages/stage.c ----
# 07B5B6 "LDX #$E7D3; LDA <$67; ASLA; ASLA; LEAX A,X", 07B5C2 "LDB ,X+; STB <$0E" (the scene routine's bank), 07B5CC
# "JSR [,X]" (its address): scene_routines' record
local stage_opening 07B5C2 t1 routine_record
# 07B693 "LDA $184E; BEQ" (the story's signal that the players are out)
local stage_players_exit 07B693 t1 players_signal
# 07BAA4 "LDX A,X" (the scene's music list), 07BAB2 "LEAX A,X" (by the stage's part), 07BAB4 "LDD ,X++; LBSR $97E3",
# 07BAC0 "LDD ,X; LBSR $97E3" (scene 6 plays a second one)
local play_scene_music 07BAB4 t1 music_at
local play_scene_music 07BAB4 t4 music_command
local play_scene_music 07BAC0 t4 second_command
# done: stages/stage.c

# ---- stages/scroll.c ----
# 0260C5 "LDX #$4460" (the floor map of the cemetery's part 2: 6 rows of 9 cells, 40 apart), 0260D6 "STB ,X+", 0260D8
# "DEC <$F1", 0260E2 "DEC <$F0"
local cemetery_scroll_slow_down 0260D6 t1 floor_place
local cemetery_scroll_slow_down 0260D8 t2 cells_left
local cemetery_scroll_slow_down 0260E2 t2 rows_left
# 0260F1 "LDA $1876; CMPA #$02; BHI" (the enemies in play)
local cemetery_put_in_boss 0260F1 t1 enemies_in_play
# 02612D "LDD ,X++; CMPD <$C5" (stage_3_part_2_layer_offsets' record), 02613F "LDD <$B9; ADDD <$E2; STD <$C6; STD
# <$B9" (the cemetery's scroll low byte and fraction, plus its speed)
local cemetery_scroll_up 02612D t1 offset_record
local cemetery_scroll_up 02613F t4 cemetery_y_low
local cemetery_scroll_up 026142 t4 cemetery_speed
local cemetery_scroll_up 026142 t5 old_cemetery_y_low
local cemetery_scroll_up 026142 t6 new_cemetery_y_low
# 026175 "CMPD ,U++" (the part's x)
local stage_5_next_part 026175 t1 part_x_at
# 02619A "LDD <$BF; ADDD <$DE; STD <$BF" (layer A's scroll x's low byte and fraction plus the camera's x speed),
# 0261AD "LDD <$C6; ADDD <$E0; STD <$C6" (its y)
local story_1_scroll 02619A t4 layer_a_x_low
local story_1_scroll 02619D t4 camera_speed_x
local story_1_scroll 02619D t5 old_layer_a_x_low
local story_1_scroll 02619D t6 new_layer_a_x_low
local story_1_scroll 0261AD t4 layer_a_y_low
local story_1_scroll 0261B0 t4 camera_speed_y
local story_1_scroll 0261B0 t5 old_layer_a_y_low
local story_1_scroll 0261B0 t6 new_layer_a_y_low
# 0261E9 "LDD <$BF; ADDD ,X; STD <$BF" (layer A's scroll x shaken by the step's pixels), 0261FA "LDD <$CF; ADDD ,X"
# (layer B's), 02620B "LDB ,X; NEGB; SEX; ADDD <$86; STD <$86" (the sprites' the other way)
local screen_shake_advance 0261E9 t4 layer_a_x_low
local screen_shake_advance 0261EC t5 old_layer_a_x_low
local screen_shake_advance 0261EC t6 new_layer_a_x_low
local screen_shake_advance 0261FA t4 layer_b_x_low
local screen_shake_advance 0261FD t5 old_layer_b_x_low
local screen_shake_advance 0261FD t6 new_layer_b_x_low
local screen_shake_advance 02620E t1 back_pixels
local screen_shake_advance 02620F t6 new_sprite_scroll_x

# The stage records' entries (stage_records, walked by direct page A4, stage_record_entry: 07A555 "LDX $600C; STX
# <$A4" the stage's first, 0262BE/0264AB "LEAX #$04,X; STX <$A4" the next): 02633E "CMPD ,X" (camera_next_entry_at_x:
# the camera's x past which the next entry starts), 02625A/0264B1 "LDU #$02,X" (the entry's data: its checks, the
# layers' ratios and flags); camera_move_to_last_entry_x 0264D5 "LDA #$-03,X" (the low byte of the entry before's x)
struct camera_entry 04 rom
field camera_entry 00 x u16
field camera_entry 02 data u16
local camera_update 026257,02626F x entry camera_entry
param camera_next_entry x entry camera_entry
local camera_next_entry 0264AB x entry camera_entry
param camera_next_entry_at_x x entry camera_entry
param camera_move_to_last_entry_x x entry camera_entry
# A check of an entry's data (3 bytes: camera_check_x 0262F1/026300 "LEAU #$06,U" / "LEAU #$03,U", camera_check_y
# likewise): 0262EC "LDA ,U; ASLA; JSR [A,Y]" (its kind, the handler's number), 026315/026389/0263D7/0263F9 "CMPD
# #$01,U" (where the camera stops), 02631A/02638E/0263DC/0263FE "LDA #$02,U; CLRB" (that place's low byte, as the
# camera's whole pixels), 026354/02636D "LDA #$01,U; LBSR $64E1" (camera_x_follows_y_*: the ratio of the x move)
struct camera_check 03 rom
field camera_check 00 kind u8
field camera_check 01 place u16
field camera_check 01 ratio u8
field camera_check 02 place_low u8
param camera_stop_at_x u check camera_check
param camera_stop_at_x_left u check camera_check
param camera_stop_at_y u check camera_check
param camera_stop_at_y_up u check camera_check
param camera_x_follows_y_down u check camera_check
param camera_x_follows_y_up u check camera_check
# camera_update: 02625A "LDU #$02,X" (the entry's data), 02625D "LDD <$DE; ADDD <$E4; STD <$DE" and 026266 "LDD <$E0;
# SUBD <$E6; STD <$E0" (the camera's speeds plus the players' push), 026274 "LDD <$AD; ADDD <$DE; STD <$AD" and 026287
# "LDD <$B3; ADDD <$E0" (the camera's x and y, low byte and fraction), 02629D-0262AC "LDA ,U+" (the data's flags),
# 0262CE "LDD <$DE; CMPD #$0300"
local camera_update 02625A t5 first_data
local camera_update 02625D t4 old_x_speed
local camera_update 026260 t6 pushed_x_speed
local camera_update 026266 t4 old_y_speed
local camera_update 026269 t6 pushed_y_speed
local camera_update 026274 t4 camera_x_low
local camera_update 026277 t4 x_speed_now
local camera_update 026277 t5 old_camera_x_low
local camera_update 026277 t6 new_camera_x_low
local camera_update 026287 t4 camera_y_low
local camera_update 02628A t4 y_speed_now
local camera_update 02628A t5 old_camera_y_low
local camera_update 02628A t6 new_camera_y_low
local camera_update 02629D t1 layer_a_edges_at
local camera_update 0262A2 t1 layer_b_edges_at
local camera_update 0262A7 t1 columns_at
local camera_update 0262AC t1 rows_at
local camera_update 0262CE t4 fast_x_speed
# the stops: 026304 "LDD <$DE; ADDD <$AD" (the camera's next x, low byte), 026315 "CMPD #$01,U", 02631A "LDA #$02,U;
# CLRB; SUBD <$AD; STD <$DE" (the speed that stops it there); 026378 likewise to the left, 0263C6/0263E8 in y
local camera_stop_at_x 026304 t4 x_speed_now
local camera_stop_at_x 026307 t4 camera_x_low
local camera_stop_at_x 026307 t5 x_move
local camera_stop_at_x 026315 t5 stop_x
local camera_stop_at_x 02631A t3 stop_x_low
local camera_stop_at_x 02631E t6 stopping_speed
local camera_stop_at_x_left 026378 t4 x_speed_now
local camera_stop_at_x_left 02637B t4 camera_x_low
local camera_stop_at_x_left 02637B t5 x_move
local camera_stop_at_x_left 026389 t5 stop_x
local camera_stop_at_x_left 02638E t3 stop_x_low
local camera_stop_at_x_left 026392 t6 stopping_speed
local camera_stop_at_y 0263C6 t4 y_speed_now
local camera_stop_at_y 0263C9 t4 camera_y_low
local camera_stop_at_y 0263C9 t5 y_move
local camera_stop_at_y 0263D7 t5 stop_y
local camera_stop_at_y 0263DC t3 stop_y_low
local camera_stop_at_y 0263E0 t6 stopping_speed
local camera_stop_at_y_up 0263E8 t4 y_speed_now
local camera_stop_at_y_up 0263EB t4 camera_y_low
local camera_stop_at_y_up 0263EB t5 y_move
local camera_stop_at_y_up 0263F9 t5 stop_y
local camera_stop_at_y_up 0263FE t3 stop_y_low
local camera_stop_at_y_up 026402 t6 stopping_speed
local camera_next_entry_at_x 02632D t4 x_speed_now
local camera_next_entry_at_x 026330 t4 camera_x_low
local camera_next_entry_at_x 026330 t5 x_move
# 026354/02636D "LDA #$01,U" (the check's ratio)
local camera_x_follows_y_down 026354 t3 follow_ratio
local camera_x_follows_y_up 02636D t3 follow_ratio
# 026413 "LDA ,U+; STA <$A6" (the main layer), 02643E "LDA ,U+" (the other layer's ratio)
local camera_scroll_layers 026413 t1 main_layer_at
local camera_scroll_layers 02643E t1 ratio_at
# 026483 "LDY ,X" (the layer's scroll x variable), 026485 "LDD <$F2; ADDD #$01,Y; STD #$01,Y" (its low byte and
# fraction plus the move), 026496 "LDY #$02,X" (its scroll y), 026499 "LDD <$F4; ADDD #$01,Y"
local layer_scroll_move 026485 t4 move_x
local layer_scroll_move 026488 t5 scroll_x_low
local layer_scroll_move 026488 t6 added_move_x
local layer_scroll_move 026488 t7 new_scroll_x_low
local layer_scroll_move 026496 t5 y_variable
local layer_scroll_move 026499 t4 move_y
local layer_scroll_move 02649C t5 scroll_y_low
local layer_scroll_move 02649C t6 added_move_y
local layer_scroll_move 02649C t7 new_scroll_y_low
# 0264B1 "LDU #$02,X" (the next entry's data)
local camera_next_entry 0264B1 t5 next_data
# 0264D5 "LDA #$-03,X; CLRB; SUBD <$AD; INCA; STD <$DE"
local camera_move_to_last_entry_x 0264D9 t6 to_last_x
local camera_move_to_last_entry_x 0264DC a move_high
local camera_move_to_last_entry_x 0264D9 b move_low
# 0264E7/0264EF/0264FB/026501 "LDD <$F0" (the move to scale), 0264F9 "CLRD" (none)
local camera_scale_quarter 0264E7 t4 unscaled_move
local camera_scale_half 0264EF t4 unscaled_move
local camera_scale_double 0264FB t4 unscaled_move
local camera_scale_quadruple 026501 t4 unscaled_move
local camera_scale_none 0264F9 d scaled_move
# dreamland_scroll: 027968 "LDD <$C6; ADDD #$0100; STD <$C6" (layer A's scroll y's low byte and fraction), 027986
# "LDD <$D5; ADDD #$0001" / 027995 "SUBD #$0001" (layer B's scroll y, every 8 frames, down or up by bit 5 of the step),
# 0279B2/0279C4 likewise the sprites' scroll y, 0279D4 "LDD <$86; STD $1FA0", 0279DB "LDD <$89; STD $1FA2"
local dreamland_scroll 027968 t4 layer_a_y_low
local dreamland_scroll 02796B t1 old_layer_a_y_low
local dreamland_scroll 027986 t4 layer_b_y
local dreamland_scroll 027989 t2 layer_b_y_plus
local dreamland_scroll 027995 t4 layer_b_y_again
local dreamland_scroll 027998 t2 layer_b_y_minus
local dreamland_scroll 0279B2 t4 sprite_y
local dreamland_scroll 0279B5 t2 sprite_y_plus
local dreamland_scroll 0279C4 t4 sprite_y_again
local dreamland_scroll 0279C7 t2 sprite_y_minus
local dreamland_scroll 0279D4 t4 sprite_x_now
local dreamland_scroll 0279DB t4 sprite_y_now
# done: stages/scroll.c

# ---- stages/stage_1.c ... stage_8.c ----
# stage_N_begin's y (what draw_layer_columns_with_floor_map leaves in Y, handed to start_stage_objects and on to the
# enemies' handlers) and the u/x/y the stage phases hand on from the calls they make: left as they are (carried)
# done: stages/stage_1.c
# done: stages/stage_2.c
# 07A98A "LDD #$0E08; LBSR $BAC7" (a palette effect), 07A990 "CLRA; LBSR $C51C" (draw_tile_picture 0, B still 08):
# one D through both
local stage_3_forest_play 07A98A,07A991 d effect_then_picture
# 07A9A3 "DEC <$82; BNE" (stage_cue_timer)
local stage_3_forest_cleared 07A9A3 t2 cue_wait
# 07A9FC "CLRD; STA <$04; STD <$05" (step_phase, step_subphase and step_countdown cleared)
local stage_3_forest_end_phase 07A9FC,07A9FD d cleared_steps
# done: stages/stage_3.c
# done: stages/stage_4.c
# done: stages/stage_5.c
# 07AE03 "CLR $1C80", 07AF07 "CLR $1C80": the read a CLR of memory makes first, unused
local stage_6_setup 07AE03 t1 discarded_read
local stage_6_end_phase 07AF07 t1 discarded_read
# done: stages/stage_6.c
# done: stages/stage_7.c
# done: stages/stage_8.c

# ---- stages/stage_events.c ----
# 02AD27 "LDY #$79C5; LBSR $862C", 02AD39 "LDY #$79CD; LBSR $862C" (vector_spawn_child's records)
local cleared_wave_start 02AD27,02AD39 y child_record
# "LDA $1876" (the enemies in play: 07CB89 "INC $1876")
local cleared_wave_wait 02AD47 t1 enemies_in_play
local scroll_lock 02AD74 t1 enemies_in_play
local enemy_waves_next 02AE21 t1 enemies_in_play
local enemy_waves_end 02AE31 t1 enemies_in_play
# 02ADD9 "LDA #$0004,Y; CMPA $1874" (the players present), 02ADF8 "CLRA; LDB #$0001,Y; ASLDI #$03; STD #$0C,U" (the
# spawn's x / 8), 02AE02 "LDB #$0002,Y; ASLDI #$03; ADDD <$B2; STD #$11,U" (its y / 8 on the camera's), 02AE10 "LDB
# #$0003,Y; STD #$16,U; STD #$5C,U" (its height)
local enemy_waves_spawn 02ADDD t1 players_present_now
local enemy_waves_spawn 02ADF9 t3 spawn_x
local enemy_waves_spawn 02ADFD t2 enemy_x
local enemy_waves_spawn 02AE03 t3 spawn_y
local enemy_waves_spawn 02AE07 t2 screen_y
local enemy_waves_spawn 02AE09 t6 enemy_y
local enemy_waves_spawn 02AE10 b enemy_z
# done: stages/stage_events.c

# ---- stages/stories.c ----
# 07ADC4 "CLR $1C80": the read a CLR of memory makes first, unused
local step_story_3 07ADC4 t1 discarded_read
# done: stages/stories.c

# ---- stages/title_cards.c ----
# the title cards' x, y and u: what the calls hand back, handed on from one step to the next (left as they are)
# 026F9B "CLRA; LDB #$2C; LBSR $86AD" (layer A's columns), 026FA4 "CLRA; LBSR $85A5" (the text), 026FA8 "LDA #$02;
# LBSR $719A" (title_card_put_picture 2): one D through them; 02703B-02704A likewise
local stage_3_title_show 026F9E,026FA5,026FAA d layer_then_picture
local stage_5_title_show 02703E,027045,02704A d layer_then_picture
# 027104 "LDX #$4D40; LDD #$0C,X; CMPD #$00E0" (the first picture's x), 02711F "DEC <$06; BNE" (step_countdown)
local stage_7_title_second_picture 027107 t5 picture_x
local stage_7_title_second_picture 02711F t2 picture_wait
# 02719C "LDU #$7E81; CLRB; EXG A,B; ASLB; ROLA" x3, 0271A8 "LEAU D,U" (the placement's offset, A x 8, in two halves),
# 0271AA "LDY ,U++" (its object), 0271B1 "LDD ,U++" (kind and animation), 0271B8 "LDD ,U++; STD #$0C,Y" (x), as struct
# placement (stage_title_placements)
local title_card_put_picture 02719A,0271A3,0271A5 a offset_high
local title_card_put_picture 0271A0,0271A2,0271A4 b offset_low
local title_card_put_picture 0271A0 t1 exchanged
local title_card_put_picture 0271AA t1 placement_record
local title_card_put_picture 0271B1 t1 kind_at
local title_card_put_picture 0271B8 t1 x_at
local title_card_put_picture 0271B8 t4 placement_x
# done: stages/title_cards.c

# ======== the board's memory the program uses as variables, by name ========
# ======== the board's addresses the 053248's C reads and writes as numbers, by name ========
# io lines (ADDRESS io NAME TYPE): the C then reads io_read8(NAME), and a constant the code puts in X, Y or U that equals
# the address is printed by the name too (stage_7_scene_lift's "clear_from = scene_state"), so each name below was also
# checked against the constants of its value in src/ (noted where they are not that thing).
#
# The K052109 only decodes 180C-1833 (layer A's y scroll), 1A00-1BFF (layer A's x scroll), 1C00, 1C80, 1D00, 1D80,
# 1E00, 1E80, 1F00 and the same of layer B at 380C/3A00 (MAME konami/k052109.cpp, k052109_device::write); the rest of
# 1800-1FFF and 3800-3FFF is RAM the program keeps variables in. Boot clears 1840-19FF and 3840-39FF (0787A9 "LDX #$1840;
# ... LDU #$01BF; BMOVE", 0787B9 "LDX #$3840"), reset_sprites_and_objects 18E0-18FF, 1860-18DF and 1840-185F (079652,
# 07965D, 079668). One name per address: where scenes reuse a byte for their own ends, the name is that of most uses
# and the comment says what else keeps it there.

# ============================================================================================ 1840-185F: the stage's
# ---- the bonuses' bytes (1840-1846; outside the bonuses the step's start copies the scene's camera lines there: 03ED31
# "LDY #$7EDC; LEAY A,Y; LDX #$1840; LDU #$0008; BMOVE Y,X,U", story_scene_settings, and player_request_scroll reads
# them as four words: 03993B "CMPX $1840", 03997C "CMPX $1842", 039983 "LDX $1844", 039942 "LDX $1846") ----
# bonus 2's state: 020A32 "LDA $1840; ASLA; LDX #$7D18; JMP [A,X]" (bonus_2_contest by it), 020A42/020A8B "INC $1840"
# (bonus_2_start_music, bonus_2_intro_set_up), 020B13 "LDY #$0464; STY $1840" (state 4 and 64 frames), 020BAF "STA
# $1840" (5), 020BDD/020BFC "STD $1840" (628, 70A), 020CD1/020DEE/020E66 read it; 17 of its 20 uses. Also the first
# camera line (player_request_scroll's word), and the start of the cleared block (boot.c, reset.c, scene_load_story_
# settings's "copy_to", ram_rom_check's "start": those constants read bonus_2_state too)
1840  io  bonus_2_state  u8
# bonus 2's frames: 020B9E "DEC $1841" (bonus_2_countdown: at 1 the music 8A00 and state 5), 020BE3 "TST $1841",
# 020BE9 "DEC $1841" (bonus_2_results), 020C17 "DEC $1841" (bonus_2_end); set with the state by 020B16 "STY $1840"
1841  io  bonus_2_timer  u8
# the bonuses' results' state: 020F39 "LDA $1842; ASLA; LDX #$7D8D; JMP [A,X]" (bonus_results by it,
# bonus_results_states), 020F45 "STA $1842" (1), 020FC6/020FD5/02109F/021180 "STD $1842" (state and frames),
# 0211E6 "TST $1842" (bonus_show_player_portraits); 7 of its 8 uses (the eighth: the second camera line). u16: the state
# is a byte, but 5 of the 8 uses are words (state and frames written together, and the camera line)
1842  io  bonus_results_state  u16
# the results' frames: 020F87 "DEC $1843; BNE; INC $1843" (bonus_results_second, _third, _fourth), 020FBD/020FCC/021017
# "DEC $1843", 02101F "STA $1843" (4: bonus_results_count_points)
1843  io  bonus_results_timer  u8
# the result last placed: 020F4B "STA $1844" (FF at the start), 0210B8 "CMPB $1844" (each round takes the best result
# below it), 0210D9 "STB $1844", 0210F5 "CMPA $1844" (the boxes of that result placed); 4 of 5 uses (the fifth: the
# third camera line)
1844  io  results_last_result  u8
# the result boxes placed so far: 020F7B "CLR $1845", 02115E "INC $1845" (each box placed), 02116F "LDA $1845" (all four
# placed: the results go on to state 5)
1845  io  results_boxes_placed  u8
# the place being given (1st, 2nd...): 020F77 "STA $1846" (1), 021131 "LDA $1846" (into the box: its place), 021184
# "INC $1846" (after each result); 4 of 5 uses (the fifth: the fourth camera line)
1846  io  results_place  u8
# ---- the players' run ----
# the running player's values (player_values, 49D0 + 8 x player): 03801E/038038/038052/03806C "STX $1848" (player_run_all,
# 49D0 49D8 49E0 49E8 before each player_run), 038FD9 "LDD [$1848]; CMPD #$0001" (its last life), 03905E "DECW
# [$1848]" (a life less), 039305/0395B5/039865 "LDX $1848"/"LDY $1848" (player_take_touches, player_get_grabbed,
# player_keep_life)
1848  io  running_player_values  u16
# a count or phase the objects of one set share: the football player's line pieces (03C8A6 "LDA $184A", 03C8AF "INC
# $184A": up to 8, each piece by it; 03C393/03C733 "CLR $184A"; football_player_wait_cue waits for it), the bear's
# phase for its parts (03C91D "CLR", 03C998 "STA" 1, 03CA11 "STB" 2: the parts fly; 03CE65 "LDA $184A"), kind 10's
# droppers down (02C374 "INC $184A": the first rewrites the floor)
184A  io  object_group_count  u8
# the players stop for a scene: 07B666 "LDA #$01; STA $184B" (stage_over), 07A9B7 (stage_3_forest_cleared), 07B32C
# (stage_8_first_part_exit), 02655B (krusty_balloon_beaten_wait), 03E497 (story_actor_wait_for_players), 03E511 (the
# height story_actor_wait_for_height waits for); the players' code tests it, 03807A/0380BB/038B1A/038E96/039170 "TST
# $184B" (no controls, a team-up broken up, stand still); cleared by 03E736 (story_actor_remove) and 03ED43 (each step's
# start)
184B  io  players_stop_request  u8
# the players standing or absent this frame: 038003 "CLR $184C" (player_run_all), 0380B0 "INC $184C" (a player not in
# the game, or all idle already), 038471 "INC $184C" (player_stand); 038080 "LDA $184C; CMPA #$04" (all four)
184C  io  players_idle_count  u8
# the players done working a heavy object (three attacks each): 038007 "CLR $184D", 03914B "INC $184D"
# (player_work_heavy_object), 03EA5E "LDA $184D; CMPA #$02; BLT" (two of them: they lift it, state 2D)
184D  io  heavy_object_workers  u8
# all four players idle after a stop: 038076 "CLR $184E", 038088 "STA $184E" (4, when 184B is set and 184C is 4); read
# by 07B693 "LDA $184E; BEQ" (stage_players_exit), 026563 (krusty_balloon_wait_for_players), 03E1A6/03E48B/03E6AC
# (the story actor waiting for the players); cleared by 03E73A and 03ED47
184E  io  players_all_idle  u8
# (1850: only ever cleared, 03C78E "CLR $1850" in football_player_defeated and 03ED4B at each step's start; nothing sets
# or reads it: left unnamed)
# the object the stage keeps for its scene and its other objects: 027805/0278A8 "STX $1852" (the boss's door keeps
# itself; 03D230/03D24D/03D500 "LDY $1852" the stage 3 boss opens and closes it), 026594 (the beaten Krusty balloon),
# 03B981 (Mr. Burns beaten), 03C39D "STU $1852" (the football player's marker), 03E812/03E888 "STX $1852" (the story
# actor, the noted actor), 03E943/03E9D5/03EA24 read it (story_stage_4_end, stage_8_events, story_stage_8_end); also
# stage 8's boss keeps its bombs' random word there (03A2C4 "LDD <$58; STD $1852", 03A7EF/03A80D/03A8B3 "LDA $1852",
# 03A863 "LDY #$1852": stage_8_boss.c's "seed = 0x1852u" will read stage_kept_object)
1852  io  stage_kept_object  u16
# a second object kept for the stories: 03AD44 "STX $1854" (burns_robot_place: the robot), 030570 "LDU $1854; STU
# #$40,X" (the rising zombies drift toward it), 03E895/03E93A/03E961 "STX $1854" (the noted actor); stage_8_events
# reads its byte as a wait (03E9CE "LDA $1854", 03E9DD "CLR $1854"); 03E743 "STD $1854" (cleared)
1854  io  stage_kept_object_2  u16
# cleared with the kept objects by story_actor_remove (03E747 "STD $1856" with D = 0) and read nowhere
1856  io  unread_kept_word  u16
# the x a player dropping in tries first: 038168 "STD $1858" (player_run: 00D0 + 20 x kind, stepped back 10 at a time
# until the floor is under it), 038193 "LDX $1858" (back to it when no place had floor); 03E74B cleared
1858  io  player_drop_x  u16
# no speech balloons over the players: 034BD0 "LDA #$01; STA $185A" (dreamland_boss_put_out_chain), 03EC60 "TST $185A;
# LBNE" (player_second_sprite_start_balloon: the second sprite off), 03ED4F "CLR $185A" (each step's start)
185A  io  player_balloons_off  u8

# ============================================================================================ 1860-18DF: the objects'
# (1860: the start of the block reset_sprites_and_objects clears, 07965D "LDX #$1860"; nothing else: left unnamed)
# the player the fewest enemies attack: 07CC4E "STU $1870" (find_least_attacked_player), 07D4C6 "LDU $1870" (enemy_think
# turns to it when its target has too many)
1870  io  least_attacked_player  u16
# the nearest player found: 07D338 "STU $1872" (enemy_target_nearest_player, the nearest so far), 07D347 "LDU $1872"
# (its target), 07D2E8/07D2F7 the same, 07C957 "STU $1872" (start_stage_objects: player 1's object)
1872  io  nearest_player_found  u16
# the players in the game, as the stage's spawns count them: 07C994 "LDA <$57; STA $1874" (spawn_stage_objects:
# player_count), 07CC33 (unused_note_player_count); read by the spawns and doors (02ADDD/0361CB/036399 "CMPA $1874"),
# kind A5, the police car's doors, goon_keep_distance_start, share_out_attackers, enemy_target_nearest_player
1874  io  stage_player_count  u8
# the enemies in play: 07CB56 "CLR $1876", 07CB89 "INC $1876" (run_enemies: each object of list 0 with field 2E's
# class not negative), 07CB2C/07CB37 "CMPA $1876" (the enemy limit), 02AD47/02AD74/02AE21/02AE31 (the waves wait for
# them), 0260F1, 02AF7F, 02E901, 02E95D, 07CC5A/07CC69 (share_out_attackers)
1876  io  enemies_present  u8
# how many enemies may attack one player: 07CC64/07CC76/07CC87 "STA $1877" (share_out_attackers: 4, by
# attackers_per_player, or the enemies), 07D4BD "CMPA $1877" (enemy_think: past it, to the least attacked player)
1877  io  attackers_per_player_limit  u8
# the walk delays the enemies take in turn this frame: 07CB5E "CLR $1878" (run_enemies), 07D99A "INC $1878; LDA
# $1878" (enemy_walk_start_in_turn: its timer)
1878  io  walk_delay_turn  u8
# list 1's objects (4F80) run this frame: 07CB9F "CLR $1879", 07CBC5 "INC $1879" (run_list_1_objects)
1879  io  list_1_objects_in_play  u8
# the child objects run this frame: 07CBD2 "CLR $187A", 07CBF8 "INC $187A" (run_child_objects)
187A  io  child_objects_in_play  u8
# knocked down or sent flying by turns: 07D064 "DEC $187B; LDA $187B" (enemy_react_to_hit: bit 0 picks)
187B  io  knockdown_turn  u8
# the kind A5 characters that dropped their food: 02E3B1 "CLR $187C" (girl_with_food_start), 02E40E "INC $187C"
# (girl_with_food_drop_food), 02E3FC "LDA $187C" (girl_with_food_walk_in stops at once when one has)
187C  io  girl_with_food_drop_count  u8
# the kind A5 characters walking off: 02E3B5 "CLR $187D", 02E454 "INC $187D; LDA $187D" (girl_with_food_walk_off: the first
# and its partner go opposite ways)
187D  io  girl_with_food_leave_count  u8
# the ninjas called off: 022FDA "INC $187E" (stage 7's boss beaten: stage_7_boss_fall), 0322BC "LDA $187E" (each ninja
# then leaves, state 6: ninja_update)
187E  io  ninjas_dismissed  u8
# the rising scenery's cue: 02D742 "CLR $187F" (rising_scenery_start), 02D7A2 "STA $187F" (rising_scenery_rise with 20
# frames left), 03150D "LDA $187F" (belly_dancer_watcher_wait_signal: the figures become hittable)
187F  io  rising_scenery_cue  u8
# last frame's enemies in play: 07CB4E "LDA $1876; STA $1880" (run_enemies), 022F6E "LDB $1880"
# (stage_7_boss_order_throws)
1880  io  enemies_present_last_frame  u8
# (1881: only 02E8E3 "CLR $1881" in teacup_goon_ride_start, read nowhere: left unnamed)
# the enemies that have entered (field 57, entrance_pending, clear): 07CB5A "CLR $1883", 07CB92 "INC $1883"
# (run_enemies), 040CE9 "LDA $1883" (hurry_up_timer: no hurry-up while any)
1883  io  enemies_entered  u8
# the police car stopped: 02B489 "STA $1884" (police_car_drive_in, C0), 02C442 "LDA $1884" (its doors open),
# 02E673 (bystander_wait_car: startled), 02E945 (teacup_goon_ride_wait_signal)
1884  io  police_car_stop_signal  u8
# how many enemies the scroll waits for: 07CB06-07CB0E "LDU #$F000; LDA <$6B; LDA A,U; STA $1885"
# (enemy_limits_by_difficulty), 07CB1A "ADDA $1885", 07CB1E "STA $1885" (plus extra_enemies_by_scene; in the cemetery
# 07CAFC "LDU #$F014; LDA <$57; LDA A,U": cemetery_enemy_limits_by_players), then 07CB29 "JMP [B,U]" by the scene to
# hold_scroll_over_enemy_limit / compare_enemy_limit
1885  io  enemies_allowed  u8
# the enemies' walking speed: 07C985-07C990 "LDU #$EFD4; LDB <$61; LDB B,U; ASLDI #$01; STD $1886" (by the rank,
# doubled), 07DA35/07DA49/07DA87 "LDD $1886" (enemy_line_up_in_depth, enemy_line_up_in_x)
1886  io  enemy_walk_speed  u16
# the x offset of the Dreamland boss's chain from its holder: 0351E4 "LDD $1888" and 035200/035213 "STD $1888"
# (dreamland_boss_chain_shift_offset, -10 to 0F by the holder's facing), 035220 "ADDD $1888" (the chain's base)
1888  io  dreamland_chain_x_offset  u16
# how high the obstacle raises the floor: 02CC4A "STA $188B", 02CCA6 "ADDA $188B" (each floor cell, obstacle_raise_floor)
188B  io  floor_raise_height  u8
# the Dreamland boss's vitality for its next phase: 0340A9 "STA $188C" (dreamland_boss_hit, by object_1a_level_rows and
# the players), 03402F "LDA $188C" (unused_show_debug_values prints it)
188C  io  dreamland_boss_phase_vitality  u8
# hold both scrolls (nothing writes it, but the clear of 1860-18DF): 07CAEF "LDA $189C; BEQ", 07CAF5 "LDD #$0101; STD
# <$A7" (check_enemy_limit: camera_x_held and camera_y_held)
189C  io  hold_both_scrolls  u8
# the enemies' random number: 07D34F "LDA $189E; ADDA <$58; STA $189E" (enemy_random: the frame's random number added)
189E  io  enemy_random_number  u8

# ============================================================================================ 18E0-18FF: the scenes'
# (18E0 scene_state and 18E1 scene_substate are named; the scripted scenes keep their own bytes after them, each its own
# way: the names below are those of most uses, the comments say what else)
# the scene's wait, a word counted down: 0228EA/0228FC (ending_fade), 024234/02424B (stage_end_run_jumpers), 024395/
# 02439E (stage 2's end), 024529/024532/024557 (stage 5's), 02459A/0245A3 (stage 6's), 0245EB/0245F7 (stage_6_wake),
# 0246BA-024723 (after bonus 2), 0247A1/0247AA (stage 7's lift), 024A02-024ADE (stage 7's end), 024C7C-024D08 (stage 8's
# start), 024E62-025359 (stage 8's end): "STD $18E2" then "DECW $18E2"; bonus 1 a byte (020136 "LDA #$60; STA $18E2",
# 020160 "DEC $18E2"), stage 6's end once (024573/02457C). Story 1 keeps a byte there instead, its part done (0272C5-
# 0275A6 "INC $18E2", 027237 "LDA $18E2; CLR $18E2": the next part). u16: 61 word uses, 23 byte uses
18E2  io  scene_wait  u16
# a byte wait: story 1's (0272C1 "STA $18E3" B0, 0272D1 "DEC $18E3" ... 02759A: 25 of 27 uses, each part's frames);
# stage 1's end keeps a part of the police car there (02407C "STU $18E3", 0240F9 "LDX $18E3")
18E3  io  scene_short_wait  u8
# a palette effect the scene runs: 024438 "STU $18E4" (stage_5_end_set_up), 0244A2 (stage_end_show_players), 02458D
# (stage_6_end_effect), 02448F/024538/0245A9 "CLR [$18E4]" (stopped); the ending's staff roll keeps its wait there
# (022940 "LDA $18E4", 022946 "DEC", 02298A "STA" A0); bonus 1 each player's flight wait from it (020212 "LDY #$18E4",
# 0202E4 "LDU #$18E4": balloon.c's "wait_place" will read scene_palette_effect)
18E4  io  scene_palette_effect  u16
# layer A's scroll speed in story 1: 0273FD "LDD #$FA00; STD $18E5", 02741E/02744E "LDD $18E5; ADDD #$000A" (slowing
# down), 027463 "ADDD $18E5" (story_1_scroll_layer_a); stage 1's end keeps the police car's third part there
# (0240AC "STU $18E5", 024100 "LDX $18E5")
18E5  io  scene_layer_a_speed  u16
# the staff roll's line: 0227EB "CLR $18E6" (ending_set_up), 02294B/022959 "LDA $18E6" (the name and title erased),
# 022967 "INC $18E6", 02296B/02297A "LDA $18E6" (the next printed: staff_roll_names, staff_roll_titles); stage 5's end
# keeps its second palette effect there (024447 "STU $18E6", 024493/02453C "CLR [$18E6]"): 8 of 12 uses
18E6  io  staff_roll_line  u8
# a second wait, a word: stage 1's end (024031 "STD $18E7" 80, 02403A/0240E3/024113/02413E "DECW $18E7": the police
# car's), the ending's family (02299E "CMPD $18E7", 0229BB "INCW $18E7", 0229B2 "STD $18E7": frames since the last
# animation); story 1 keeps a palette effect there (02733D "STU $18E7", 027376 "CLR [$18E7]")
18E7  io  scene_second_wait  u16
# bonus 1's presses, a byte a player from here (Marge's): 020116 "CLR $18E8" ... 020122 "CLR $18EB" (the contest's
# start), read by the players' bonus records ("LDA [,U]": field bonus_player 00 presses)
18E8  io  bonus_1_presses  u8
# the ending's family step: 022992 "LDA $18E9" (ending_family_waits by it), 0229B6 "INC $18E9"; also Homer's presses in
# bonus 1 (02011A "CLR $18E9")
18E9  io  ending_family_step  u8
# the dream's wave line: 0254C3 "CLR $18EA", 0254CA "LDA $18EA" (its sine), 0254E3 "DEC $18EA" (256 lines) in
# dream_wave_draw_lines and dream_wave_draw (025533-025551); the ending's scroll wait (02291E "LDA $18EA" up to 68,
# 022926 "CLR", 022938 "INC"); Bart's presses in bonus 1 (02011E): 10 of 19 uses
18EA  io  dream_wave_line  u8
# layer B's scroll speed: stage 7's lift (0247B0 "LDD $18EB; ADDD #$0002; STD $18EB", 0247BE "ADDD $18EB": layer B's
# y and the four items' z speed), stage 8's start (024C27 "STD $18EB" 0400, 024C33-024C49 slowing by 9, 024C95/024D58:
# the riders' z speed); the dream's wave keeps its phase there as a byte (025437/025476 "CLR $18EB", 0254CE "ADDA
# $18EB", 0254E9 "LDA $18EB; SUBA #$02; STA $18EB"), Lisa's presses in bonus 1 (020122): the speed is 11 of the 21
# uses (10 of them words), but u8 since 11 of the 21 are bytes (the wave, the presses and stage 7's speed's high byte)
18EB  io  scene_layer_b_speed  u8
# the dream's wave step: 025441/02545F/02548C/02549E/0254BA "INC $18EC", 02546F "LDA $18EC" (dream_wave_fade_out by
# it), 025416; bonus 1 counts the balloons gone there (0202DD "CLR $18EC", 0205BB/020628 "INC $18EC", 020308)
18EC  io  dream_wave_step  u8
# the dream's wave size: 025433 "CLR $18ED", 02544D-025453 "ADDA #$08; STA $18ED" (growing to C0), 02547C "STA $18ED"
# (C0), 0254AA-0254B0 (shrinking by 2), 025446/025464/025491/0254A3 "LDB $18ED" (drawn at it); bonus 1's frames since a
# press sound (0208AB-0208DE), stage 7's links moved (0248B4 "INC $18ED"): 12 of 21 uses
18ED  io  dream_wave_size  u8
# a value three scenes keep here, each its own: the player bonus 1's introduction shows (02005B "STA $18EE",
# bonus_1_intro_set_up; 0200B7/0200DE "LDA $18EE", bonus_1_intro_show_how), stage 7's chain spacing (02483C "STD $18EE"
# 0808, 0248AB "SUBD $18EE": a word), the dream's wave line size (0254BF "STB", 0254D3 "LDB")
18EE  io  scene_shared_value  u8
# the bonus title's frames: 0209CD "STD $18EF" (C0, bonus_title_wait), 0209D6 "DECW $18EF" (bonus_title_show);
# 02542F "CLRW $18EF" (dream_wave_start)
18EF  io  bonus_title_frames  u16
# stage 7's chain's lead link: 024843 "STU $18F0" (the first, stage_7_scene_put_chain), 02487A "LDD $18F0" (the last
# link's next), 02489E/0248D4 "LDX $18F0" (the link moving), 0248C3 "STX $18F0" (the next one moves)
18F0  io  chain_lead_link  u16
# the bonus title's step: 0209C3 "LDB $18F1" (bonus_title by it), 0209D1/0209F2 "INC $18F1"; 02542B "CLRW $18F1"
18F1  io  bonus_title_step  u8
# stage 7's chain's end link: 024847 "STU $18F2" (stage_7_scene_put_chain), 02488C "LDX $18F2" (in place when its x
# reaches 09E8 from the camera)
18F2  io  chain_end_link  u16
# the dream's wave held at full size: 025488 "STA $18F3" (40 frames, dream_wave_start_full), 025498 "DEC $18F3"
# (dream_wave_hold)
18F3  io  dream_wave_hold_frames  u8
# where Mr. Burns stood when he lost Maggie, and the camera then: 03B9BB "STD $18F4", 03B9C2 "STD $18F6", 03B9C9 "STD
# $18F8", 03B9D0 "STD $18FA" (mr_burns_see_maggie); stage 8's end puts the family round the spot (024FFD-025195 "LDD
# $18F4" / "LDD $18F6", 025222/025263 "SUBD $18F4": the walkers arrive) and the camera back (024F2F "LDD $18F8",
# 024F39 "LDD $18FA")
18F4  io  reunion_spot_x  u16
18F6  io  reunion_spot_y  u16
18F8  io  reunion_camera_x  u16
18FA  io  reunion_camera_y  u16
# the player who takes Maggie back: 03B937 "CLR $18FC", 03B953 "STA $18FC" (mr_burns_wait_for_blow: the last blow's
# player, from the hitter's field 41), 024F8F "LDA $18FC" (stage_8_end_reunion: as a bit, or the first player present,
# 024FB1/024FC0), 024FE9 "LDA $18FC; LSRA" each player, 02506B "CLR", 0250A8 "LSR $18FC"
18FC  io  maggie_rescuer  u8

# ============================================================================================ the K052109's registers
# layer A's y scroll: 0790C9 "STB $180C" (irq_handler: layer_a_scroll_y less 10), 0788B9 (boot: 0)
180C  io  tile_chip_layer_a_y  u8
# layer A's x scroll, a line's from here when line scroll is on: 0790C0 "STD $1A00" (irq_handler: layer_a_scroll_x less
# 5A, its high bit in the second byte), 0788B1 (boot); the line scrolls drawn from it (022569, 025423, 0254C7, 025537
# "LDX #$1A00": the high score table's wave, the dream's wave)
1A00  io  tile_chip_layer_a_x  u16
# the K052109's scroll control (line scroll of layer A: 3, off: 0): 07AE70 "LDA #$03; STA $1C80" (stage_6_begin),
# 02543D/025482 (the dream's wave), 022551/0225F5 (the high scores' wave); "CLR $1C80" at 0786FA (boot), 07A367,
# 07A3D1, 07ADC4, 07AE03, 07AF07, 07AF2C, 07B4C4, 0225D6, 0254B6
1C80  io  tile_chip_scroll_control  u8
# the K052109's interrupt control (bit 2 the IRQ: cleared to acknowledge or keep it off): 078F49 "LDA #$FB; STA $1D00",
# 078F55 "LDA #$FF; STA $1D00" (irq_handler), 0786DA/0789B6 (boot), 05E01E/05E034 (test_run_page), 05EBED/05EC54,
# 05EC76/05ECE5 (the ROM sums)
1D00  io  tile_chip_irq_control  u8
# the K052109's tile ROM banks 0 and 1: 07C949 "STA $1D80" (set_area_tile_banks, layer_modes' tile_banks_01), 0786F2
# (boot, 10), 05EAE6/05EAF9/05EB35 (the ROM check: 10, 54, 10)
1D80  io  tile_chip_banks_0_1  u8
# (1E00, the K052109's ROM page for reading the tiles back, 05EC0D "STA $1E00" once: left unnamed, since two Y
# constants of the players' code equal it, 0394A7/0394C6 "LDY #$1E00" (reactions.c's "state_and_time = 0x1E00u"),
# which the name would take)
# the K052109's flip (bit 0 the screen flipped): 078A6B/078A9A "STA $1E80" (apply_settings by flip_screen), 05E41B
# "STB $1E80" (test_screen_flip_page), 078707/078898 "CLR $1E80", 0788A0 (boot)
1E80  io  tile_chip_flip  u8
# the K052109's tile ROM banks 2 and 3: 07C94F "STA $1F00" (set_area_tile_banks), 0786F6 (boot, 32), 05EAEC/05EAFF/
# 05EB3B (the ROM check: 32, 76, 32)
1F00  io  tile_chip_banks_2_3  u8
# layer B's y scroll: 0790F0 "STB $380C" (irq_handler: layer_b_scroll_y less 10), 0788BD (boot: 0)
380C  io  tile_chip_layer_b_y  u8
# layer B's x scroll: 0790E7 "STD $3A00" (irq_handler: layer_b_scroll_x less 5A, its high bit in the second byte),
# 0788B5 (boot)
3A00  io  tile_chip_layer_b_x  u16

# ============================================================================================ the board's ports
# the coins (inverted): 078F6F "LDA $1F80; COMA; STA <$3D" (irq_handler: coin_inputs)
1F80  io  coin_switch_port  u8
# the test switch (bit 0, 0 pressed) and the EEPROM (bit 4 its data, bit 5 ready): 079037 "LDA $1F81" (irq_handler: the
# test mode), 078819/07887C (boot: the test switch held resets the EEPROM), 05E998 "LDA $1F81; ANDA #$20"
# (eeprom_wait_ready), 05E9C6 (eeprom_receive_data)
1F81  io  test_eeprom_port  u8
# the players' controls: 079092/07909B/0790A4/0790AD "LDU #$1F90" ... "#$1F93" (irq_handler: read_controls for each of
# the four), 05E50C "LDA $1F90" (test_menu_update), 05E1A5 "LDY #$1F90" (the I/O check). 1F91-1F93 only as those
# constants (interrupts.c's "port = 0x1F91u"), named with the first
1F90  io  player_1_input_port  u8
1F91  io  player_2_input_port  u8
1F92  io  player_3_input_port  u8
1F93  io  player_4_input_port  u8
# the board's outputs (bits 0-1 the coin counters, bit 3 the tile ROM read through the K052109, bit 5 cleared while
# the sprite ROM is read), a copy in board_output (4810): 078F96/078FB0/078FD9/078FF3 "STA $1FC0" (irq_handler: the
# coin counters' pulses), 0786EB (boot, 30), 07896E (boot), 05EC25/05EC42 and 05EC96/05ECDB (the ROM sums)
1FC0  io  board_output_register  u8
# the board's control (bit 0 the palette RAM at 0000, bit 1 the sprite RAM at 2000, bit 2 the FIRQ, bits 3/4/7 the
# EEPROM's CS/CLK/DI), a copy in board_control (480F): 0787FF "STA <$0F" with each "STA $1FC2" (86 of them: irq_handler
# 07907E-07915E, the floor and tile writers 02B2CC-02D265, the EEPROM 05E90F-05E9E7, boot 0786DF-07899A ...)
1FC2  io  board_control_register  u8
# reading it interrupts the Z80: "TST $1FC4" after each command written to 1FC6, 079064 (irq_handler: the sound queue),
# 078703 (boot), 078EB7 (ask_sound_cpu_check), 078F18, 078F2B (reset_sound), 078F34 (send_sound_command_and_wait),
# start_sample_rom_check
1FC4  io  sound_irq_port  u8
# the K053260's ports to and from the Z80, a word: written the command, 079060 "STD $1FC6" (irq_handler: the sound
# queue's next), 0786FF (boot, 0000), 078EB3 (F181), 078F27 (FF00), 078F30 (send_sound_command_and_wait), FE88; read
# the Z80's answer, 078EC9 / 078F3E "LDD $1FC6"
1FC6  io  sound_command_port  u16
# the second port read alone, the Z80's echo of the command's low byte once it has taken it: 078EC3 / 078F1F / 078F38
# "CMPB $1FC7" (ask_sound_cpu_check, send_sound_command_and_wait), sample_rom_check_answered (88)
1FC7  io  sound_echo_port  u8
# the watchdog, kicked by reading it: "TST $1FCA" in irq_handler, boot's loops (07876D-078972), ram_rom_check,
# test_ram_words, test_ram_bytes, 05E9F2 (eeprom_delay), 05EC29 / 05ECCA (the ROM sums)
1FCA  io  watchdog_port  u8

# ============================================================================================ the K053246's registers
# the sprites' x and y scroll (registers 0-1, 2-3): 026215 "STD $1FA0" (screen_shake_advance), 0279D7/0279DE
# (dreamland_scroll), 078A83/078A8D and 078AB4/078ABE (apply_settings: 0255/0071 or 0015/0261, the screen flipped or
# not), 079622-079642 (reset_sprites_and_objects), 07870F/078713 (boot, 0)
1FA0  io  sprite_chip_scroll_x  u16
1FA2  io  sprite_chip_scroll_y  u16
# the K053246's control (register 5: bit 4 the sprite DMA and its FIRQ), a copy in sprite_chip_control (4855):
# 07916E "STA $1FA5" (irq_handler), 0791CE (firq_handler), 07880B/0788A9/0789AA (boot), 078A77/078AA6
# (apply_settings), 05EB52/05EB8D (the ROM check)
1FA5  io  sprite_chip_control_register  u8
# the address of the sprite ROM read back (registers 6, 7 and 4: MAME's k053246_r, (6 << 17) | (7 << 9) | (4 << 1)):
# 05EC9D "STA $1FA6", 05ECA4 "STA $1FA7", 05ECAB "STA $1FA4" (test_sum_sprite_rom, from sprite_rom_address_high,
# _middle, _bottom); 0786E5 "STA $1FA4" (boot, 24)
1FA6  io  sprite_chip_rom_high  u8
1FA7  io  sprite_chip_rom_middle  u8
1FA4  io  sprite_chip_rom_bottom  u8
# the sprite ROM's two bytes there: 05ECAF "LDB $1FC8", 05ECB4 "LDB $1FC9" (test_sum_sprite_rom: each added to the sum)
1FC8  io  sprite_chip_rom_first_byte  u8
1FC9  io  sprite_chip_rom_second_byte  u8

# ============================================================================================ the K053251's registers
# (the priority encoder: MAME konami/k053251.cpp's notes, and runtime/src/video.c's draw: registers 2-4 the priorities
# of CI2-CI4, the fixed layer, A and B; 9 and 10 the colour bases)
# register 0, CI0's priority (the background colour): 07871F "LDA #$3F; STA $1FB0" (boot)
1FB0  io  background_priority  u8
# registers 2-4, the fixed layer's, layer A's and layer B's priorities: 078725 "STA $1FB2" (04), 07872B "STA $1FB3"
# (28), 078731 "STA $1FB4" (18) (boot)
1FB2  io  fixed_layer_priority  u8
1FB3  io  layer_a_priority  u8
1FB4  io  layer_b_priority  u8
# (1FB6, 1FB7, 1FB8, 1FBB, 1FBC: registers 6, 7, 8, 11 and 12, written once at boot with 17, 27, 37, 00, 05 (078737-
# 07875B); MAME does not know what they do: left unnamed)
# register 9, the colour bases of the background (bits 0-1), the sprites (2-3) and the fixed layer (4-5): 13 in play
# (078747 "LDA #$13; STA $1FB9", boot), 3F while a screen is redrawn, then 13 again ("LDA #$3F; STA $1FB9" ... "LDA
# #$13; STA $1FB9": 07A252-07A27B, 026EE6, 07BE97, 0227FD/022825, 024197/0241B7 ..., the attract's and the scenes'
# drawing: 83 writes)
1FB9  io  colour_bases_back_sprites_fixed  u8
# register 10, the colour bases of layers A (bits 0-2) and B (3-5): 2C in play (07874D "LDA #$2C; STA $1FBA", boot), 36
# while a screen is redrawn ("LDA #$36; STA $1FBA" ... "LDA #$2C; STA $1FBA" beside each 1FB9: 83 writes)
1FBA  io  colour_bases_layers_a_b  u8

# ============================================================================================ 2000-3FFF as RAM
# the name entry's state: 02200F "LDX #$7510", 022022 "LDA $3840; JMP [A,X]" (name_entry by it), 02220D / 0222AA "INC
# $3840" (name_entry_set_up, name_entry_type_initials); cleared with 3840-386F by boot and reset_for_play (0796AE "LDX
# #$3840")
3840  io  name_entry_state  u8
# each player's entry, 4 bytes from here (its place, bit 7 when done; its sprites): 02203A "LDU #$3842", 022073/
# 022255/022267 "LDX #$3842; ... LEAX #$04,X" (high_scores.c's "entry = 0x3842u")
3842  io  name_entry_records  u8
# the name entry's frames: 022209 "STD $385E" (0000, name_entry_set_up), 022212 "LDD $385E; ADDD #$0001; STD $385E;
# CMPD #$0700" (time up; 06C0 the sound stopped), 0222A6 (0000 again), 0222B0/0222B7 (name_entry_linger, up to 0100)
385E  io  name_entry_time  u16
# the players ranked best first, 2 bytes each (the player, its place): 02231D-022336 name_entry_rank_players "CLR $3860;
# LDA #$01; STA $3862 ..." then sorted (022309 "LDU #$3860"), 022037/0222CD "LDX #$3860" (each in turn). 3862, 3864 and
# 3866 are its next entries (one write each there: left unnamed, an io line has no array)
3860  io  name_entry_ranking  u8
# the 64 palette jobs, 8 bytes each (palette_job): 07BF39 "LDU #$3C00" (find_free_palette_job), 07BC8B "LDU #$3C00"
# (run_palette_jobs), cleared from here by 024DE3/07B47C/0787C4/079676 "LDX #$3C00; ... CLR ,X+; BMOVE" (the census's
# four io_write8(0x3C00u, 0u) are those clears' first bytes)
3C00  io  palette_jobs  u8

# ============================================================================================ left unnamed
# The original's mistakes, an extended address where the object's field was meant (symbols.txt notes each): 002F
# (03CD05 "DEC $002F", bear_change: the field 2F), 0031 (038A69/038A86 "TST $0031", player_throw_carried_4/5: the
# field 31), 003C (03C433 "STA $003C", football_player_start_rest: the field 3C), 00A0 (0212B9 "SUBD $00A0",
# bonus_results_draw_box), 00C0 (03C9D2 "ANDB $00C0", bear_break_out: the immediate C0). An io line names every
# constant of its value the C does not take for a number (X, Y and U loads, an address added to), and these values are
# everyday numbers there: the listing has 63 "#$00C0" (LEAX #$00C0,X: the players' stride), 14 "#$00A0", 4 "#$003C",
# 2 "#$002F"; a name such as meant_object_field_2f would replace them. So are 0C00 (palette_job_background_colour's
# "STD $0C00", the background's colour in the palette RAM: 9 "#$0C00", counts of the RAM test, Y loads in bank 1E) and
# 2000 (boot's clear of the sprite RAM: 27 "#$2000", the tile layers' "- 0x2000u").
# 24E2 and 26DD: places in the fixed layer's tiles the test mode writes once (05E193 "LDX #$24E2": the I/O check's
# blanked cells; 05E0B3 "LDX #$26DD": the ROM check's row), not variables.



# ======== the last object fields, and corrections ========
# ======== the 053248's last object fields still named after their offset, and corrections ========
# Evidence: build/listing/simpsons.s (quoted as PLACE "INSTRUCTION"), the C of src/ and the work list
# How the names reach the C here (read in tools/core): a function's own object (X) reads its family's fields only while
# the emitter knows X is still that object (decompiler/emit.py own_object: lost after a PULLS X or a call that may write
# X); otherwise the family comes from the pointer analysis, whose entry kinds carry no family in Konami
# (konami_cpu/decompile.py builds pointers.Program without families), so a "param FUNC x NAME object.FAMILY" line or a
# typed "local" at the instruction that writes the register gives it; a family's moved pointer (player + 0x60u) keeps
# the base's family (pointers.access, RUNS); an access by a constant address takes a family only through the profile's
# INSTANCE_FAMILIES_BY_FUNCTION (the "# instance" lines below); and Konami has no array fields (konami_cpu/emit.py:
# FIELD_ARRAYS and SCOPED_ARRAYS empty), so a structure's array is named one field per element.
# A line that changes an existing one has "# replaces: OLD LINE" right above it; where one old line becomes several new
# ones the replacement's other lines follow it, marked "(with the line above)".

# ======== the fields still unk_XX ========

# ---- 3D: carried, common ----
# What the engine does with byte 3D of every object: it clears it at every birth, with blocked (spawn_stage_objects
# 07CA41 "CLR #$3D,U" next to 07CA44 "CLR #$31,U"; place_child_object 07CAE5 "CLR #$3D,U"), and the players set it on
# whatever they pick up, of any kind (player_stand 038790 "LDA #$01; STA #$3D,X" on the object that touched it,
# player_eat_food 03942C "STB #$3D,Y" with B = 1): "carried" for the eight families that read it (throwable,
# bouncing_throwable, carried_obstacle, obstacle, running_animal, robot_scrap, bird_item, timed_throwable: their own
# lines say carried). The families that use the byte otherwise keep their own names (enemy way_round, player
# hold_presses, ...). Census: spawn_stage_objects and place_child_object "OBJECT(...)->unk_3D = 0u" (a new object is not
# carried); fat_goon_thrower_pick_up and unused_obstacle_fall too (both carried, see below)
field object 3D carried u8

# ---- 3D, 3E: the player's second sprite (the partner object at +60) ----
# player_second_sprite_start_prompt / _prompt / _blink get the player in U and work on its second sprite through
# U + 60 (03EBF0-03EC5D: "#$0090,U", "#$009D,U", "#$009E,U", "#$60,U": the partner's 30, 3D, 3E, 00). As the player
# family's view (the moved pointer keeps it) 3E already reads blink_frames, as the player code reads the same byte
# (player_team_ready 0391A4 "CLR #$009E,U" before "LDA #$03; LDY #$B180; LBSR $7C2F": state 3, the blinking picture);
# 3D is not hold_presses there but the prompt's frames: 03EC02 "LDA #$01; STA #$009D,U" (state 5 starts it at 1),
# 03EC0B "DEC #$009D,U; BEQ" (at 0: "LDA #$3C; STA #$009D,U", 60 frames, and picture B180), 03EC11 "LDA #$009D,U; CMPA
# #$1E" (at 30: picture B181): the two prompts (Hit Buttons!, Wiggle Joystick!) alternate every 30 frames. A family of
# its own, player_second_sprite, whose view takes the player's fields (NESTED_FAMILIES) but this one. The functions
# player_second_sprite_* then belong to it (their X is never an object: 03EAB3 "LDX #$7E5B; JMP [A,X]", and
# player_second_sprite_fall's X is a place), and nothing in them reads the player's own 3D
scoped object player_second_sprite 3D prompt_frames u8
param player_second_sprite_start_prompt u player object.player_second_sprite
param player_second_sprite_prompt u player object.player_second_sprite
param player_second_sprite_blink u player object.player_second_sprite

# ---- 3D: an enemy's way round, an obstacle carried, a held player's presses ----
# unused_enemy_move_aside 07D7E6 "LDB #$3D,X; BNE" (ADDA #$60 the other way, SUBA #$20): the enemy's way round, as
# enemy_get_around reads it (07DC74 "LDB #$3D,X; BNE", 07DC64 / 07DC6B sets it); it sits among the enemies' shared
# moves (07D7E3, after enemy_climb's 07D7D1), its X an enemy
# replaces: param unused_enemy_move_aside x object object
param unused_enemy_move_aside x object object.enemy
# unused_obstacle_fall 02CE07 "CLR #$3D,X; LBSR $85B1": an obstacle's step after obstacle_rebound_fall (02CDD4), clearing
# its carried byte as obstacle_throw does (02CD72 "CLR #$3D,X")
# replaces: param unused_obstacle_fall x object object
param unused_obstacle_fall x object object.obstacle
# fat_goon_thrower_pick_up 02A518 "LBSR $862C" (vector_spawn_child, the child in U), 02A51E "STU #$40,X" (the thrower's
# carried_object), 02A527 "LDA #$01; STA #$3D,U": the obstacle on its head, carried; the same object the carry and
# the throw get (fat_goon_thrower_carry 02A535 "LDU #$40,X" typed object.carried_obstacle)
local fat_goon_thrower_pick_up 02A518 u carried object.carried_obstacle
# unused_homer_object_wait_hit 02F7F8 "LDU #$25,X; CMPU #$4F80; BCC" (the player that hit it), 02F808 "LDD #$1006;
# STA #$31,U; STB #$3D,U": the player's state timer and its presses to break free (player.hold_presses, as goon_grab_try
# 028E8B "LDA #$0C; STA #$3D,U"); symbols.txt's "param unused_homer_object_wait_hit u hitter object.player" is
# overridden by this local's plain object
# replaces: local unused_homer_object_wait_hit 02F7F8 u hitter object
local unused_homer_object_wait_hit 02F7F8 u hitter object.player

# ---- 32, 35, 37, 3C, 3E, 3F, 50-53: the dreamland boss's chain pieces ----
# dreamland_boss_chain_setup gives each piece it puts in (U: 0350EC "LBSR $867D" find_free_slot, 035101 "LBSR $7442"
# find_free_object_from_4d40, 035109 "LDU <$F2" the head) the chain's fields: 03512F "LDD #$0002; STD #$3E,U"
# (next_direction 0, next_distance 2), 035132 "STD #$35,U" (queued_direction 0), 035135 "STA #$37,U" (direction 0),
# 03513A "STA #$3C,U" (10), 035143 "STX #$2A,U" (chain_base), 035146 "STY #$2E,U" (previous_link), 035149 "STU #$2C,Y"
# (next_link of the one before), 03514C "CLRW #$50,U; CLRW #$52,U" (next_dx, next_dz), 035155 "STA #$32,U" (link_index):
# every piece is a link (type FF) or the head (type FE, dreamland_boss_chain_head, whose view takes the chain's). U then
# holds dreamland_boss_chain_link_parameters (035160 "LDU #$798E", 03516B "LDA ,U+"): those two sites keep their old
# type (the C reads that ROM byte as OBJECT(parameter_address)->flags, a pointer into the window read as an object; a
# separate name and no type there would be cleaner but changes how the byte is read)
# replaces: local dreamland_boss_chain_setup 0350EC,035101,035109,035160,03516B u piece object
local dreamland_boss_chain_setup 0350EC,035101,035109 u piece object.dreamland_boss_chain
# (with the line above)
local dreamland_boss_chain_setup 035160,03516B u piece object
# Y: the base (0350F8 / 035163 "LEAY ,X"), each new piece (035158 "LEAY ,U"), then the walk down the chain (035170 "LDY
# #$2C,Y": next_link); 035149 "STU #$2C,Y" (next_link), 035168 "STD #$40,Y" (chain_head), 03516D "STA #$30,Y"
# replaces: local dreamland_boss_chain_setup 0350F8,035158,035163,035170 y previous_piece object
local dreamland_boss_chain_setup 0350F8,035158,035163,035170 y previous_piece object.dreamland_boss_chain
# 3C of a chain piece: the setup gives the base and every piece 10 (0350DC "LDA #$10; STA #$3C,X", 03513A "STA
# #$3C,U"), the head's own setup 4 (dreamland_boss_chain_head_setup 035340 "LDA #$04; STA #$3C,X"); only the head reads
# it: dreamland_boss_chain_head_follow_path 035355 "LDA #$36,U; BNE" (its holder's target_direction), 03535A "DEC
# #$3C,X; BNE $73A1" (no step yet), 03535F "LDA #$01; STA #$3C,X" then the next step of its path: the frames before
# its next path step (4 at first, then 1: a step each frame). Without this line the chain's view takes dreamland_boss's
# legs_left (NESTED_FAMILIES), which the base's setup and the head's path now read
scoped object dreamland_boss_chain 3C path_wait u8

# ---- 50-53: the bear's cage parts ----
# bear_put_parts 03C93C "STD #$0C,U; STD #$50,U" (the part's x, kept), 03C948 "STD #$11,U; STD #$52,U" (its y), 03C954
# "STD #$16,U; STD #$54,U" (its z, rest_height): its place at rest. bear_part reads only the height back (03CE76 "LDY
# #$54,X" for the shake); nothing reads 50 or 52 (no "#$50,X", "#$52,X" in bank 1E or the fixed program)
scoped object bear_part 50 rest_x u16
scoped object bear_part 52 rest_y u16

# ---- 32, 31, 33: the stages' closing jumpers ----
# what scene_put_placement hands back in Y (025388; 0241C5 "LDA #$0D; LBSR $7388"): stage 2's kind-9C character, a
# jumper like the players' (0241D0 "LDA #$04; STA #$30,Y; STA #$32,Y", 0241D8 "LDA #$01; STA #$31,Y": jumper_player 4,
# which stage_end_jumper_wait 02428A "CMPB #$04; BEQ" keeps silent and stage_end_jumper_fly 0242E5 "CMPB #$04; BNE; LDA
# #$8E" gives its own animation); run by stage_end_run_jumpers (024251 "LDX #$4D40", 024264 "JSR [A,U]" by type)
# replaces: local stage_2_end_set_up 0241C5 y object object
local stage_2_end_set_up 0241C5 y jumper object.stage_end_jumper
# stage_end_put_jumpers 024202 "LBSR $7388", 024208 "LDA <$F1; STA #$32,Y" (jumper_player)
# replaces: local stage_end_put_jumpers 024202 y jumper object
local stage_end_put_jumpers 024202 y jumper object.stage_end_jumper
# a jumper's wait before it jumps: stage_end_put_jumpers 02421C "LDA A,X; STA #$31,Y" (from stage_end_exit_waits by its
# order), stage_2_end_set_up 0241D8 "LDA #$01; STA #$31,Y"; stage_end_jumper_wait 02427E "LDA #$31,X; BEQ", 024283 "DEC
# #$31,X" (the common blocked is the walk check's, which a jumper does not run)
scoped object stage_end_jumper 31 jump_wait u8
# the legs it has flown: stage_end_jumper_fly 0242F6 "INC #$33,X" each time it has shrunk to nothing and shows again;
# stage_end_jumper_last_leg 0242AC "LDB #$33,X; BEQ" (stage 5's second leg; the common hit_from_behind is the hit
# check's)
scoped object stage_end_jumper 33 legs_flown u8
# 02427E "LDA #$31,X; BEQ $6287" (the wait left; at 0 it is the shout command's high byte: 02428E "ADDD #$3F28")
# replaces: local stage_end_jumper_wait 02427E a blocked
local stage_end_jumper_wait 02427E a wait_left

# ---- 34: the players after the story ----
# story_actor_remove (the actor at 5640, 03E733 on): 03E754 "LBSR $67F3" (story_first_player: X = 4A40), 03E79A "LBSR
# $67FC" (story_next_player), 03E777 "PUSHS X; LEAX #$1C,X; LDU #$003D; CLRA; BSET A,X,U; PULLS X" (the player's
# fields 1C-58 cleared: X is the player, not the actor), 03E783 "LDA #$34,X; ORA #$02; STA #$34,X" (player.status bit 1,
# rejoining: 0380FE-038116 "BITB #$02"), 03E75C "CLR #$30,X" (player_state), 03E75F "CLR #$0090,X" (its second
# sprite's state)
# replaces: local story_actor_remove 03E754,03E79A x player object
local story_actor_remove 03E754,03E79A x player object.player
# replaces: local story_actor_remove 03E781 x object object
local story_actor_remove 03E781 x player object.player

# ---- 35: Krusty's balloon's squash steps ----
# krusty_balloon_wobble 026A79 "LDA #$35,X; ASLA; JSR [A,U]" (squash_step, named while X is its own object), 026A7F
# "LDA #$35,X; CMPA #$04", 026A86 "CLR #$35,X": after the call X is what the step hands back (the steps' table has no
# length, so the switch holds handlers that hand back X: krusty_balloon_volley_throw, krusty_balloon_stomp_bounce); the
# balloon itself, at the call and on the way in
param krusty_balloon_wobble x balloon object.krusty_balloon
local krusty_balloon_wobble 026A7D x balloon object.krusty_balloon
# krusty_balloon_flinch (state -1): the balloon it wobbles, 026601 "LBSR $6A74" (krusty_balloon_wobble, which hands X back)
# (its callers name it object and balloon, so the name by use stopped at the register)
param krusty_balloon_flinch x balloon object.krusty_balloon

# ---- 43: stage 3's bosses ----
# 41 holds the other boss (03D1CB "STU #$41,X; STX #$41,U"): both are stage_3_boss (list 0 type 3E, run by stage_3_boss)
# replaces: scoped object stage_3_boss 41 partner u16 object
scoped object stage_3_boss 41 partner u16 object.stage_3_boss
# stage_3_boss_update: after 03D574 "PUSHS X; LDX #$41,X ... PULLS X" the emitter no longer takes X for the function's
# own object, and the way that does not go through it carries no family (pointers.merge), so from 03D58B on the C
# reads the common fields: 03D58B "LDA #$3A,X" (apart_time, C "retarget_time"), 03D59E "LDA #$10; STA #$40,X"
# (join_wait, C "parent"), 03D5A3 "TST #$43,X" (together, C "unk_43"), 03D5C5 "LDX #$41,X" (partner, C "parent &
# 0xFF << 8 | enemy_class"): the boss, its family on the way in
param stage_3_boss_update x boss object.stage_3_boss
# 03D576 / 03D5C5 "LDX #$41,X": the partner; 03D5ED "CLR #$43,X" (its together)
# replaces: local stage_3_boss_update 03D576,03D5C5 x partner object
local stage_3_boss_update 03D576,03D5C5 x partner object.stage_3_boss
# stage_3_boss_join 03D682 "LDU #$41,X", 03D685 "LDY #$0D00; STY #$2E,U" (phase 0D, wait 0: C "target_dy = 0xD00u"),
# 03D6A3 "STA #$43,U" (its together)
# replaces: local stage_3_boss_join 03D682 u partner object
local stage_3_boss_join 03D682 u partner object.stage_3_boss
# stage_3_boss_partner_ready 03D6AF "LDU #$41,X", 03D6BE "LDA #$2E,U; CMPA #$13" (its phase: C "target_dy >> 8u")
# replaces: local stage_3_boss_partner_ready 03D6AF u partner object
local stage_3_boss_partner_ready 03D6AF u partner object.stage_3_boss

# ---- 43, 45: bonus 2's signs and result boxes, through the player's object ----
# Bonus 2 reaches each player's sign (+840: 5280 + C0 n) and result box (+540: 4F80 + C0 n) by offsets from the player's
# object, its U (typed object.bonus_2 in every bonus_2_* function), so the C reads them through the bonus_2 view (a moved
# pointer keeps its base's family). The sign's animation kept in its 43, to come back to after a reaction:
# bonus_2_put_player 020B92 "STA #$0845,U; STA #$0883,U" (88 a player in the game, C5 one out), bonus_2_end_pose 020CF6
# "LDA #$0883,U; ADDA #$02; STA #$0845,U", bonus_2_shake/_squash/_meter_jumps/_bounce 020DC3 "LDA #$0883,U; STA
# #$0845,U", bonus_2_level 020E38. No bonus_2 code reads 43 or 45 of the player's own object
scoped object bonus_2 43 sign_kept_animation u8
# the result box's place (bonus_results.place, 1 the winner): bonus_2_end_pose 020CE8 "LDA #$0585,U; CMPA #$01"
scoped object bonus_2 45 result_place u8

# ---- 43-58: the story actor's child slots, one field each ----
# Konami has no array fields (a structure laid out backwards: konami_cpu/emit.py), so "child_actors u16[B]" names only
# its first word. The 11 slots (story_actor_put_in 03E398 "LEAX #$43,X; LDD ,X; BNE; STU ,X", 03E3A6 "DEC <$F0" from
# 0B; story_actor_finish_frame 03E68D, story_actor_remove 03E71C, story_actor_remove_children 03E7A9 walk them by
# pointer) are read by place in stage_2_events (03E842 "LDY #$43,X", 03E84B "LDY #$45,X", 03E82A "LDY #$47,X": C
# "child_actors", "unk_45 << 8 | floor_cell", "next_floor_cell << 8 | hit_box >> 8") and written in story_stage_4_end
# (03E943 "LDY $1852; STY #$45,X": the noted actor as the actor's second child; C "unk_45", "floor_cell"); the start
# of an actor clears 28-57 by a block and the last slot's low byte apart (story_actor_run 03E084 "LEAX #$28,X; LDU
# #$0018; BSETW D,X,U", 03E093 "CLR #$58,X": C "unk_58")
# replaces: scoped object story_actor 43 child_actors u16[B]
scoped object story_actor 43 child_actor_1 u16 object
# (with the line above)
scoped object story_actor 45 child_actor_2 u16 object
scoped object story_actor 47 child_actor_3 u16 object
scoped object story_actor 49 child_actor_4 u16 object
scoped object story_actor 4B child_actor_5 u16 object
scoped object story_actor 4D child_actor_6 u16 object
scoped object story_actor 4F child_actor_7 u16 object
scoped object story_actor 51 child_actor_8 u16 object
scoped object story_actor 53 child_actor_9 u16 object
scoped object story_actor 55 child_actor_10 u16 object
scoped object story_actor 57 child_actor_11 u16 object

# ---- 58: the enemy holding a player ----
# The player's holder (player 4B: goon_grab_try 028E88, fat_goon_grab 02AAD3, zombie_grab_reach 030760 "STX #$4B,U")
# is a goon, a fat goon or a grabbing zombie, each with its squeeze_step at 58 (1 holding, 2 a squeeze asked, 3
# squeezing: goon_grab_hold, fat_goon_squeeze, zombie_grab_hold). The player sets it: player_get_grabbed 0395AD "LDX
# #$4B,U ... STA #$58,X" (1), player_grabbed 038E5A "LDA #$02; STA #$58,X" (hit while held: the holder squeezes),
# player_struggle 038EB4 / 038ECF "CLR #$58,X" (free). A view for the three, through the pointer only (no function is
# named grabber_*, and no family name starts with "grabber_")
scoped object grabber 58 squeeze_step u8
# replaces: scoped object player 4B holder u16 object
scoped object player 4B holder u16 object.grabber
# player_struggle's X: the holder (player_grabbed 038E45 "LDX #$4B,U" and player_grabbed_and_hit 038ED5 "LDX #$4B,U"
# fall into it at 038E90); 038EB4 "CLR #$58,X"
# replaces: param player_struggle x holder
param player_struggle x holder object.grabber

# ---- 3F, 44, 45: objects at a fixed address (profile INSTANCE_FAMILIES_BY_FUNCTION) ----
# story_actor_drop_players_held 03E53C "CLRD; STD $4A7F; STD $4B3F; STD $4BFF; STD $4CBF": the four players' held
# (player 3F, u16 object: 038766 "STD #$3F,U", 03876B "STX #$3F,U")
# instance 0x4A40 story_actor_drop_players_held player
# instance 0x4B00 story_actor_drop_players_held player
# instance 0x4BC0 story_actor_drop_players_held player
# instance 0x4C80 story_actor_drop_players_held player
# gorge_rock_start 02D04E "LDA #$97; STA $4A84; STA $4B44; STA $4C04; STA $4CC4" (the first rock, field 30 = 0) and
# belly_dancer_watcher_wait_signal 031513 "LDA #$9F; STA $4A84 ..." (when 187F is set): the four players' pose_animation
# (player 44: player_take_pose_blow 03933E "LDB #$44,U; LBEQ; STB #$05,U; CMPB #$97")
# instance 0x4A40 gorge_rock_start player
# instance 0x4B00 gorge_rock_start player
# instance 0x4BC0 gorge_rock_start player
# instance 0x4C80 gorge_rock_start player
# instance 0x4A40 belly_dancer_watcher_wait_signal player
# instance 0x4B00 belly_dancer_watcher_wait_signal player
# instance 0x4BC0 belly_dancer_watcher_wait_signal player
# instance 0x4C80 belly_dancer_watcher_wait_signal player
# bonus_results_read_places 021081 "LDA $4FC5; STA <$F0", 021088 "LDA $5085", 02108F "LDA $5145", 021096 "LDA $5205":
# the four result boxes' place (4F80 + C0 n, bonus_results 45: bonus_results_place_next 021154 "STA #$45,U")
# instance 0x4F80 bonus_results_read_places bonus_results
# instance 0x5040 bonus_results_read_places bonus_results
# instance 0x5100 bonus_results_read_places bonus_results
# instance 0x51C0 bonus_results_read_places bonus_results

# ---- 07: an attack range's chances and actions, counted from 1 (not an object field) ----
# enemy_think 07D5D9 "LEAU #$07,U" (U one before the range's action_chances), 07D5DC "SUBA B,U" with B 4 down to 1
# (action_chances[B - 1]); 07D5E5 "LEAU #$-04,U" (one before its actions), 07D5E8 "LDA B,U; STA #$28,X" (actions[B -
# 1]). The C reads them as ATTACK_RANGE(range + choice - 7)->unk_07 and ATTACK_RANGE(range + choice - 3)->chance (the
# range's own chance, wrong): a record pointer moved inside the record has no array to land in (no array fields in
# Konami). The same in the state's choice: 07D614 "LEAU #$03,U", 07D617 "SUBA B,U" (the state record's chances 4-7),
# 07D621 "LEAU #$-03,U", 07D624 "LDA B,U" (its actions 1-4), C "mem_read8(state_record + choice)", "mem_read8(state_record
# - 3u + choice)". As values a pointer walks (elements, read through data_record as the records are) the C reads
# BEHAVIOUR_CHANCE(range_chances + choice) and BEHAVIOUR_ACTION(range_actions + choice)
elements behaviour_chance u8
elements behaviour_action u8
# replaces: local enemy_think 07D5C3,07D5C6,07D5D9,07D5E5 u range
local enemy_think 07D5C3,07D5C6 u range
# (with the line above)
local enemy_think 07D5D9 u range_chances behaviour_chance
local enemy_think 07D5E5 u range_actions behaviour_action
# replaces: local enemy_think 07D60D,07D614 u state_record
local enemy_think 07D60D u state_record
# (with the line above)
local enemy_think 07D614 u state_chances behaviour_chance
local enemy_think 07D621 u state_actions behaviour_action

# ======== corrections ========

# ---- hit_box: the object's attack and box words ----
# set_hit_box 07D1B7 "LDD ,Y; STD #$1C,X" (damage, attack), 07D1BC "LDD #$02,Y; STD #$1F,X" (box_width, box_depth),
# 07D1C2 "LDD #$04,Y; STD #$21,X" (box_height, box_dx), 07D1C8 "LDD #$06,Y; STD #$23,X" (box_dy, box_dz); burns_robot
# 03B305 "LDD ,U++; STA #$1C,X; STB #$1D,X", 03B30D / 03B312 / 03B317 "LDD ,U++; STD #$1F,X / #$21,X / #$23,X"
# replaces: field hit_box 00 field_1c u16
field hit_box 00 damage_attack u16
# replaces: field hit_box 02 field_1f u16
field hit_box 02 width_depth u16
# replaces: field hit_box 04 field_21 u16
field hit_box 04 height_dx u16
# replaces: field hit_box 06 field_23 u16
field hit_box 06 dy_dz u16

# ---- object 59: 8 sprite entries of 16 bytes ----
# 07955F "LDU #$2000", 079575 "LEAU #$0080,U": 80 (128) bytes an object, 8 sprite_entry of 10 (16) bytes (struct
# sprite_entry 10; write_object_sprites 079C02 walks them by 10, borrowed_object at 0E of the eighth). The comment above
# the old line says "8 of 10 bytes": it should say "8 of 16 (0x10) bytes"
# replaces: field object 59 sprites u16
field object 59 sprites u16 sprite_entry

# ---- 4A02-4A1B: bytes 02 and 03 of each player's counters are the health gauge's ----
# player_counters (4A00 + 7 n) 02 gauge_step and 03 gauge_delay: gauge_draw_health 040A0D "CMPB #$02,U", 040A1D "LDA
# #$02,U; TST #$03,U", 040A34 "STA #$02,U", 040A39 "LDB #$02; STB #$03,U"; gauges_count_delays 0408EE "LDA #$03,Y; BEQ;
# DECA; STA #$03,Y". The game's start clears them as a word (0796CA "STD $4A02", 0796D6 "STD $4A09", 0796E2 "STD $4A10",
# 0796EE "STD $4A17"): two bytes each (the C writes both, as continue_seconds/continue_player). 04-06 stay unused (only
# that start clears them: 0796CE "STD $4A04", 0796D2 "CLR $4A06"). The comment above the old lines says "nothing reads
# them": the gauge reads 02 and 03 through the player's counters
# replaces: 4A02  var  unused_marge_word_1  u16
4A02  var  marge_gauge_step  u8
# (with the line above)
4A03  var  marge_gauge_delay  u8
# replaces: 4A09  var  unused_homer_word_1  u16
4A09  var  homer_gauge_step  u8
# (with the line above)
4A0A  var  homer_gauge_delay  u8
# replaces: 4A10  var  unused_bart_word_1  u16
4A10  var  bart_gauge_step  u8
# (with the line above)
4A11  var  bart_gauge_delay  u8
# replaces: 4A17  var  unused_lisa_word_1  u16
4A17  var  lisa_gauge_step  u8
# (with the line above)
4A18  var  lisa_gauge_delay  u8

# ---- goon_grab_try 028E78: already done ----
# symbols.txt has it corrected already ("Was local goon_grab_try 028E78 b step (it is no step)": 028E78 a floor_high, b
# floor_low, the player's floor height): nothing to change

# ---- bank 15's enemy waves: counts of enemies, not times and kinds ----
# enemy_waves_start 02AD8F "LDY #$79F1; LDA #$30,X; LDB A,Y; STB #$3D,X" (by the wave set, field 30, into end_enemies),
# enemy_waves_end 02AE31 "LDA $1876; CMPA #$3D,X; BHI; CLR #$00,X": the enemies left (1876, the stage's count) at or
# below which the waves are over (values 0-3)
# replaces: 02B9F1  table  object_15_times[13]  u8
02B9F1  table  enemy_waves_end_enemies[13]  u8
# 02ADA3 "LDY #$7A18; ASLA; LEAY A,Y" (4 a set: A is the set x 4), 02ADA9 "LDA <$57; DECA; ANDA #$03; LDA A,Y; STA
# #$30,X" (by the players, into next_wave_enemies), 02AE21 "LDA $1876; CMPA #$30,X; BHI; INC #$28,X": the enemies left
# at or below which the next wave comes (values 1-3)
# replaces: 02BA18  table  object_15_next_kinds[52]  u8
02BA18  table  enemy_waves_next_wave_enemies[52]  u8

# ---- team_move_attack_states: the team attacks' player states ----
# 0386E4 "LDA #$35,U; LDX #$7DD5; LDA A,X; STA #$3C,U" and then, A unchanged, 03870F "STA #$30,U": the player_state the
# team move's attack takes (32, 32, 35, 38: state 38 is Homer's team attack, player_team_attack_homer 038B1A), which
# attack_started (3C) also keeps; nothing counts 3C down (C "OBJECT(player)->player.player_state = attack_length")
# replaces: 039DD5  table  team_move_attack_lengths[4]  u8
039DD5  table  team_move_attack_states[4]  u8
# replaces: local player_team_move 0386EA a attack_length
local player_team_move 0386EA a attack_state
# replaces: local player_walk 0386EA a attack_length
local player_walk 0386EA a attack_state
# replaces: local player_team_jump 0386EA a attack_length
local player_team_jump 0386EA a attack_state
# replaces: local player_team_start_fall 0386EA a attack_length
local player_team_start_fall 0386EA a attack_state
# replaces: local player_team_fall 0386EA a attack_length
local player_team_fall 0386EA a attack_state
# replaces: local player_attack_end 0386EA a attack_length
local player_attack_end 0386EA a attack_state
# replaces: local player_team_ready 0386EA a attack_length
local player_team_ready 0386EA a attack_state
# replaces: local player_team_together 0386EA a attack_length
local player_team_together 0386EA a attack_state

# ---- stage 8's reunion: where each walker stops ----
# stage_8_end_reunion 024FDC "STD <$FC" (FFE0), 025052-025058 / 0250CF, 025144 (20 more each) into the walker's 2B
# (stage_8_end.stop_offset: C "OBJECT(object)->stage_8_end.stop_offset = ..."), which its _arrive step reads as the
# distance past the reunion's spot it stops at (02521C / 02525D "LDD #$0C,X; ADDD #$2B,X; SUBD $18F4"): no wait
# replaces: scoped global stage_8_end_reunion 48FC reunion_walker_wait u16
scoped global stage_8_end_reunion 48FC reunion_walker_stop_offset u16

# ---- game_start_join_players' 48F0: a bit or a count ----
# with shared credits each player's bit (05EDC3 "LDB #$01; STB <$F0", 05EDD1 "ORB <$F0", 05EDDA "ASL <$F0"); with
# separate coin slots the slots left (05EDE4 "LDA #$04; STA <$F0", 05EE02 "DEC <$F0"), the bit being 48F1
# replaces: scoped global game_start_join_players 48F0 join_player_bit u8
scoped global game_start_join_players 48F0 join_bit_or_slots u8

# ---- enemy_behaviour.ranges: not attack_range[4] ----
# Left as it is: a field's type is a value (u8 ... s32, or one of them [N]) or a pointer to a structure; Konami has no
# structure inside a structure (konami_cpu/emit.py: pointers.NESTED = {}) and no array fields. The ranges are read through
# the pointer enemy_think makes (07D5C3 "LEAU #$28,U"), typed attack_range by enemy_find_attack_range's parameter.

# ---- the players' counters through the player records ----
# gauge_player 02 (4A00 + 7 n): gauge_draw_health 0409F2 "LDU #$02,X; ... CMPB #$02,U; ... TST #$03,U",
# gauges_count_delays 0408EB "LDY #$02,X; LDA #$03,Y", gauge_draw_player 04099E "LDA [#$02,X]" (the continue's seconds):
# a pointer to the player's player_counters (C "counters = GAUGE_PLAYER(...)->counters; ... mem_read8(counters)")
# replaces: field gauge_player 02 counters u16
field gauge_player 02 counters u16 player_counters
# player 07: 07B82D "LDA #$20; STA [#$07,X]" (seconds), 07B86E "LDY #$07,X; INC #$01,Y" (frames), 07B89D "INC [#$07,X]"
# (game over's frames), 07B7AC / 07B828 / 07B8A9 "STD [#$07,X]" with D 0 (C "mem_write16(countdown, 0u)",
# "mem_write8(countdown_2, 0x20u)")
# replaces: field player 07 countdown u16
field player 07 countdown u16 player_counters

# ---- 0356DD-0356FD: the debug display's tile places ----
# unused_show_debug_values reads tile places (X for print_hex_byte through 0785A8) as words: 034028 "LDX $76E0", 034034
# "LDX $76E2", 034048 "LDX $76EC", 034053 "LDX $76EE", 034064 "LDX $76F0", 03406F "LDX $76F2" (bank 1A: 0356E0, E2, EC,
# EE, F0, F2). From 0356E0 to the texts at 0356FE the bytes are 15 such words (2510 2590 2514 2594 2590 2610 2690 2692
# 2710 2712 272B 271F 2721 2713 2719; the texts after them print at 2710-2728); the C reads them now as
# "unused_spawn_0356DD[0].depth << 8 | .flags" and "AT16(unused_tile_places[7], -1)"
# replaces: 0356E5  table  unused_tile_places[25]  u8
0356E0  table  unused_debug_tile_places[15]  u16
# the 3 bytes before them, 05 40 30: the start of a 68th record of unused_dreamland_spawn_list (67 records of 8 from
# 0354C5 end at 0356DD; x 0540, y +30, as its last records' x 0500-0540), cut short where the places start
# replaces: 0356DD  table  unused_spawn_0356DD[1]  spawn
0356DD  table  unused_spawn_tail[3]  u8


# ======== what the carry a routine hands back says ========
# What the carry of a routine says where it hands it back ('flag FUNCTION cy NAME'); the functions that only hand it on
# from these, and the callers whose carry only comes from them, take the name too (konami_cpu/decompile.py
# inherited_flag_names)
# stage_boss_any_player_down: carry 1 when a player in play is in a state its class marks negative (down, hurt)
flag stage_boss_any_player_down cy player_down
# stage_boss_blink_out: carry 1 once the blinks are done and the boss is removed (its score awarded)
flag stage_boss_blink_out cy gone

# ======== what the flags say, the last register names ========
# ---- system ----
# group system: flags and register variables of src/system, src/engine, src/video, src/game, src/attract,
# src/test_mode (proposals; symbols.txt syntax)

# ======== flag sources ========

# --- src/engine/floor.c ---
# floor_cell_at: the floor map's cell is read last (079545 "LDA ,U; RTS"): N is its bit 7, which the floor map sets
# where there is no floor ("its value in A (negative: no floor)"; scenery_block_floor writes FF there to take the floor
# away; check_floor_ahead "BMI" on the cell ahead stops the object before a gap)
flag floor_cell_at s no_floor
# check_floor_ahead: 07CF4C "LDA #$42,X; BMI $CF5E; BEQ $CF5E": Z set when the object's enemy_class is 0 (the C:
# "zero = enemy_class == 0u; if ((int8_t)enemy_class >= 0 && zero == 0u)")
flag check_floor_ahead z no_enemy_class
# done: src/engine/floor.c
# done: src/engine/directions.c

# --- src/game/score.c ---
# high_score_rank: 07973D "COMA" when the score is at least a table entry's (079726 "CMPD ,X; BCC $973D"), 079737
# "CLRA" after the 10 places; game_finish: "if (carry) { reset_for_stage(); mode_phase = 4u; ..." (the name entry),
# players.c's caller: "if (carry == 0u)" the player is out without a place
flag high_score_rank cy in_high_scores
# done: src/game/score.c

# --- src/game/skip.c ---
# check_skip: 0797B5 "COMA" when a player in the game newly presses attack or jump (0797A1 "LDA [A,X]; ANDA #$30;
# BNE"), 0797B0 "CLRA" while it waits or nobody pressed; the stories and the stage ends skip on it
flag check_skip cy skipped
# done: src/game/skip.c
# done: src/game/continue.c
# done: src/game/game_over.c
# done: src/game/name_entry.c

# --- src/system/boot.c ---
# check_work_ram: 078B17 "LBSR $8DCF" (test_ram_words) then 078B1A "TSTB; RTS": Z when no word of 4000-5CFF failed
# ("Z when it is good"); boot: "if (zero == 0u)" prints the RAM BAD texts
flag check_work_ram z work_ram_good
# done: src/system/boot.c
# done: src/system/eeprom.c

# --- src/system/inputs.c ---
# coin_inserted: 0791F1 "COMA" after the coin's sound (0791E8 "LDD #$4002; LBSR $97ED") and 0791EE "INC <$51"
# (coins_inserted), 0791F4 "CLRA" when no coin of the slot was released; irq_handler: "if (carry)" add_coin
flag coin_inserted cy coin_dropped
# done: src/system/inputs.c
# done: src/system/interrupts.c
# done: src/system/jobs.c

# --- src/system/jump_table.c ---
# sample_rom_check_answered: 078F1D "LDB #$88; CMPB $1FC7; RTS": Z once the Z80 echoes 88 in 1FC7 (test_rom_check_6g:
# "if (zero == 0u)" waits another frame)
flag sample_rom_check_answered z answered
# find_nearest_player: 07D2B1 "CLRA" when no player is in the stage (07D2AB "LDA $1874; BNE"), else 07D2FB "LDA <$EC;
# CMPA #$7F": carry while the nearest distance is under 7F00, i.e. a player in play was found (it starts at 7FFF:
# 07D2BA "LDD #$7FFF; STD <$EC"); burns_robot, krusty_balloon and stage_7_boss: "if (carry == 0u)" no target
flag find_nearest_player cy player_found
# done: src/system/jump_table.c

# --- src/test_mode/menu.c ---
# test_menu_update: 05E5A5 "COMA; RTS" after SHOOT1 on a line whose page byte is 20 (05E579 "CMPA #$20; BEQ $6597"),
# handing back the line (05E5A0 "DIV X,B": the cursor / 3); 05E595 "CLRA" otherwise (no press, or a line that opens
# its page); test_choose_setting_run: "if (carry == 0u)" just marks the setting
flag test_menu_update cy line_chosen
# test_read_setting: Z from the setting's value, 05E627 "LDB ,Y; RTS" (the variable) or 05E621 "LBSR $6915; TSTB"
# (the EEPROM's byte): the C "zero = setting_byte == 0u" / "zero = value_byte == 0u"; test_io_check_open: "if (zero == 0u)" the start
# buttons' row is printed (5A60 not 0), test_coin_setting_page "if (zero == 0u)" the plain coin page
flag test_read_setting z setting_off
# test_open_page: 05E642 "CLR $5912" leaves carry clear before 05E64E "PULLS D,X,Y,U,PC": a page just printed has no
# line chosen; test_music_choice/test_sound_choice hand it back after a choice ("carry = test_music_open(...)"), the
# same variable as test_menu_update's
flag test_open_page cy line_chosen
# done: src/test_mode/menu.c

# --- src/test_mode/options.c ---
# test_choose_setting_run: 05E459 "COMA; RTS" after the chosen line's value is written (05E452 "LBSR $65E8",
# test_write_setting with 05E451 "DECB"), 05E45F "CLRA; RTS" when test_menu_update chose nothing (05E443 "BCC $645B")
flag test_choose_setting_run cy setting_chosen
# done: src/test_mode/options.c

# --- src/video/palette.c ---
# find_free_palette_job: 07BF4F "CLRA" on the first job whose kind is 0 (07BF41 "LDA ,U; BEQ"), 07BF4D "COMA" when the
# 64 are all taken; every request_*: "if (carry == 0u)" fills the job ("carry when there is none")
flag find_free_palette_job cy no_free_job
# palette_effect_stop: 07BDB0 "CLR ,U; COMA; RTS": the effect's command 80 frees its job and sets carry, on which
# palette_job_effect skips the step (07BD2F "BSR $BDA8; BCS $BD3C")
flag palette_effect_stop cy effect_ended
# palette_effect_reverse: 07BDBF "CLRA; RTS" (command 81: the effect runs on backward)
flag palette_effect_reverse cy effect_ended
# palette_effect_repeat: 07BDD9 / 07BDE4 "CLRA; RTS" (command 82: the effect runs on from the step it names, or the
# next)
flag palette_effect_repeat cy effect_ended
# palette_effect_backward: 07BD8C "CLR #$01,U" (direction forward again at the first step) clears carry; the effect
# runs on
flag palette_effect_backward cy effect_ended
# palette_effect_command: 07BDA8 "LDY #$E975; ANDA #$7F; ASLA; JMP [A,Y]": its carry is the command's (80 stop: set,
# 81 reverse / 82 repeat: clear); palette_job_effect: 07BD2F "BSR $BDA8; BCS $BD3C" leaves the step undone when the
# effect ended
flag palette_effect_command cy effect_ended
# done: src/video/palette.c

# --- src/video/sprites.c ---
# borrow_object_for_sprites: 079CCE "LDA #$01; STA ,X; COMA; RTS" on a free object from 55E0 down (079CC0 "LDA ,X;
# BEQ"), 079CCC "CLRA; RTS" at 4D40; draw_object: "if (carry)" keeps the lender in the 8th sprite's borrowed_object
flag borrow_object_for_sprites cy object_borrowed
# write_object_sprites: 079CF2 "LDA ,U+; BEQ $9D43; BPL $9CFC; NEGA; DEC <$F0" (and 079D72 for y): N of the listed
# offset, negative when the sprite is left of (above) the object, then turned positive and zoom_offset_negative marked
# ("negative = listed_offset_x >> 7; ... if (negative)")
flag write_object_sprites s negative_offset
# done: src/video/sprites.c

# ======== caller exceptions (callees that mean different things, one test in the caller) ========

# spawn_list_2_child: 07CA9E "LDB #$02; LBSR $CA54; BCC $CAE9": carry from take_free_object (a free object of list 2),
# then from place_child_object (07CAAB.., which ends with carry set): set when the child is in; its callers test it
# once for that ("carry when there was a free slot")
flag spawn_list_2_child cy child_placed
# test_choose_setting: the setting pages' step runner (05E425 "LDX #$642B; LBRA $603B": step 0 test_choose_setting_open,
# step 1 test_choose_setting_run, both setting_chosen; the switch's other cases are entries of the next step tables);
# test_start_buttons_page, test_premium_start_page and test_premium_coins_page test it once: "if (carry == 0u) return"
# before writing the chosen value
flag test_choose_setting cy setting_chosen
# test_music_first_choice: 05E223 "BSR $6261; BCC $6260; BRA $623E": the carry of test_sound_test_first_press
# (test_menu_update's line_chosen) is tested once, then test_music_play's (queue_sound's, which nothing tests) is handed
# back
flag test_music_first_choice cy line_chosen
# test_sound_first_choice: 05E27F "BSR $6261; BCC $6260; BRA $62A0", the same with test_sound_play
flag test_sound_first_choice cy line_chosen
# palette_job_effect: tests the carry once, after palette_effect_command (07BD2F "BSR $BDA8; BCS $BD3C": the effect
# ended, its step is not run); its other callees (the direction handlers, darken_colour/brighten_colour of the
# over-read entries) hand back carries nobody tests
flag palette_job_effect cy effect_ended
# done: src/test_mode/sound_test.c
# done: src/test_mode/checks.c
# done: src/test_mode/rom_check.c

# ======== register variables ========

# boss_shade_by_vitality: 07E4F1 "LDY #$E526", 07E4F4 "LDA <$E9; ASLA", 07E4F8 "LDY A,Y": the boss's row of
# hurt_effect_rows (by shade_effect_row), whose effect for the new level 07E4FE "LDD A,Y" reads
local boss_shade_by_vitality 07E4F8 y hurt_row hurt_effect_row
# palette_job_clear: 07BF16 "LEAY ,X; CLR ,X+; BMOVE Y,X,U": Y the range's first byte, just cleared, from which BMOVE
# copies the 0 along the range
local palette_job_clear 07BF16,07BF1A y fill_source
# clear_text_layer: 0792AD "LDD ,S; STD ,X; STD #$26,X" (the edge columns' tiles, 3F3F) and 0792B4 "LDD #$02,S; STD
# #$-2000,X; STD #$-1FDA,X" (their colours, 0000): the word written into each side's two columns, A the left one's
local clear_text_layer 0792AD,0792B4 a edge_high
local clear_text_layer 0792AD,0792B4 d edge_low
# test_options_open: 05E33A "LDB #$00" before 05E33C "LBSR $66FD" (test_put_tile, D = digit:colour) and 05E38F "LDB
# #$00" before 05E391 "LBSR $6650" (test_print, B the colour): the colour the values are printed in
local test_options_open 05E33A,05E38F b print_colour
# done: src/video/clear.c
# done: src/video/background_maps.c
# done: src/attract/intro.c
# done: src/attract/title.c
# ---- objects ----
# ======== group objects: flags and register variables of src/objects/ ========
# Every line has its evidence above it. Sections by source file; "# done: FILE" closes each file of the work list.
# Kinds: the sources first (they name their callers), then local flags, then register variables. At the end, a
# separate section of caller lines whose only source can not carry a name (its variable is also an arithmetic carry
# or another test): see the report.

# ---- objects/object_setup.c ----
# apply_gravity: 07D16E "LDD #$19,X; SUBD #$0060; STD #$19,X; BPL $D1AE" (still rising: 07D1AE "CLRA; RTS", carry
# clear), else cap_fall_and_land; C: "carry = 0u;" while the height speed is >= 0. Set once the object is on its floor.
flag apply_gravity cy landed
# cap_fall_and_land: 07D18E "CMPD <$E8; BHI $D1AE" (above its floor + 7: "CLRA; RTS"), else 07D193-07D1A9 puts it on
# its floor (height speed 0, flags bit 3 off, animation_flags bit 7) and 07D1AC "COMA; RTS": carry set when it lands.
flag cap_fall_and_land cy landed
# land_if_falling: 07D1B0 "LDA #$19,X; BPL $D1AE" (not falling: "CLRA; RTS"), else 07D1B5 "BRA $D179"
# (cap_fall_and_land): carry set when it lands. vector_check_landing only leads here.
flag land_if_falling cy landed
# enemy_on_screen: 07D216 "LDD #$0C,X; SUBD #$0050; CMPD #$0120; RTS": carry set when its x is within 50-16F; C:
# "carry = screen_x >= 0x50 && screen_x <= 0x16F;"
flag enemy_on_screen cy on_screen
# done: objects/object_setup.c

# ---- objects/spawning.c ----
# take_free_object: 07CA5F "LDB #$00,U; BNE $CA82" (taken: next slot), a free one cleared and marked 4, then 07CA80
# "COMB; RTS" (carry set); 07CA85 "DECA; BNE", 07CA88 "CLRB; RTS" when the list is full (carry clear). Callers:
# spawn_child_object 07CA8D "LBSR $CA54; BCC $CA9D", spawn_stage_objects' take_free_object_for_spawn, and every
# vector_find_free_slot caller ("if (carry) type = ...").
flag take_free_object cy slot_found
# place_child_object: runs only after take_free_object found a slot (07CA90 "BCC $CA9D", 07CAA3 "BCC $CAE9") and
# ends 07CAE8 "COMA; RTS": carry always set, handed back by spawn_child_object and spawn_list_2_child as "the child
# had its slot and is placed"; the same name as take_free_object's so that those two (and vector_spawn_child,
# fireman_goon_put_in_missile...) take it.
flag place_child_object cy slot_found
# hold_scroll_over_enemy_limit: 07CB2B "CLRB; CMPA $1876; BCC $CB33; DECB; STB <$A7; RTS": carry set when the
# enemies present (1876) are more than the limit in A (then the camera's x scroll is held)
flag hold_scroll_over_enemy_limit cy too_many_enemies
# compare_enemy_limit: 07CB37 "CMPA $1876; RTS": the same test without the scroll. check_enemy_limit only hands on
# these two (07CB29 "JMP [B,U]") or the carry it got (07CAF5 "LDD #$0101; STD <$A7; RTS")
flag compare_enemy_limit cy too_many_enemies
# done: objects/spawning.c

# ---- objects/stage_bosses.c ----
# stage_boss_settle: 03C159 "CMPD #$16,X; BGE $6169" (still above the floor: height speed - 60, 03C167 "CLRA; RTS"),
# else on its floor (03C169 "STD #$16,X", height speed cleared) and 03C177 "COMA; RTS": carry set once it is on its
# floor. stage_boss_follow_floor and stage_boss_stop_on_floor only hand it on.
flag stage_boss_settle cy landed
# stage_boss_next_player_slot: 03C1AD "TST #$00,U; RTS": zero set when the player slot's object is not in use; C:
# "zero = OBJECT(player)->flags == 0u;", stage_boss_pick_random_player "if (zero == 0u) return player;"
flag stage_boss_next_player_slot z slot_empty
# stage_boss_player_is_near: 03C1FE "LSRB; BCC $6223" (not playing: "CLRA; RTS"), x then y distance against the
# reaches <$F8/<$FA ("CMPD <$F8; BGE $6223", "CMPD <$FA; BGE $6223"), 03C221 "COMA; RTS": carry set when the player
# is in play and within reach. stage_boss_find_near_player only hands it on (03C1E4.. "BSR; BCS").
flag stage_boss_player_is_near cy player_near
# stage_boss_player_off_floor: 03C240 "TST #$00,U; BEQ $624C" (not in use), "LDU #$16,U; BEQ $624C" (height 0), else
# 03C24A "COMA; RTS": carry set when the player is in use and off the floor. stage_boss_any_player_off_floor only
# hands it on (03C225 "BSR $6240; BCS $623F" for each player).
flag stage_boss_player_off_floor cy player_off_floor
# stage_boss_check_hit hands back A: 0 not hit (03C2B3 "CLRA; RTS": zero set), 1 hurt (03C2A1 "LDA #$01; RTS"), FF
# beaten (03C2B0 "LDA #$FF; RTS": negative set); bear_charge_check_hit "if (zero) {...} if (negative) bear_beaten"
flag stage_boss_check_hit z not_hit
flag stage_boss_check_hit s beaten
# stage_boss_attack_frame: 03C2E0 "LDA #$06,X; LSRA; RTS": carry = animation_flags bit 0, the animation ran to its
# end (field object 06); bear_swipe "if (carry) bear_turn_to_player"
flag stage_boss_attack_frame cy animation_ended
# done: objects/stage_bosses.c

# ---- objects/burns_robot.c ----
# burns_robot_facing_target: 03B243 "LDU #$2B,X; LDD #$0C,X; CMPD #$0C,U; BLT", the facing bit "LDA #$09,X; ANDA
# #$40", 03B25F "COMA; RTS" when it faces the target, 03B261 "CLRA; RTS" when not
flag burns_robot_facing_target cy facing
# burns_robot_target_in_reach: 03B371 "LDU #$2B,X; BSR $738A (across); BCC $7398 (CLRA); BSR $737B (in depth); RTS":
# carry set when its target is within reach across and in depth
flag burns_robot_target_in_reach cy in_reach
# burns_robot_target_in_depth: 03B37B "LDD #$11,U; SUBD #$11,X; BMI $7398; CMPD <$FA; BGT $7398", 03B396 "COMA; RTS":
# carry set when the target is 0 to <$FA further down the screen
flag burns_robot_target_in_depth cy within_depth
# burns_robot_target_across: 03B38A "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD <$F8; BGT $7398", 03B396 "COMA; RTS": carry
# set when the target is within <$F8 across
flag burns_robot_target_across cy within_across
# burns_robot_start_gloating: 03B3D8-03B3F6 sound 3F38, handler 0D, its gloating look, can not be hit; 03B3F9 "COMA;
# RTS": carry always set, an action other than walking started (the walking handlers 03AE44 "BCS $6E73" stop)
flag burns_robot_start_gloating cy action_started
# burns_robot_start_attack: its attack's handler and look started, or burns_robot_start_gloating when the target is
# down; every way out sets carry (C: "carry = 1u;" three times, "carry = burns_robot_start_gloating(robot);")
flag burns_robot_start_attack cy action_started
# burns_robot_start_lob: 03B4E1-03B4F9 lob timers cleared, handler 0C; 03B4FC "COMA; RTS": carry always set
flag burns_robot_start_lob cy action_started
# burns_robot_in_middle: 03B566 "LDD #$0C,X; CMPD #$0040; BLT $7575; CMPD #$0180; BGT $7575", 03B573 "COMA; RTS":
# carry set when its x is within 40-180
flag burns_robot_in_middle cy in_middle
# burns_robot_lob_due: 03B577 "LDY #$7BA7 (burns_robot_shot_times) ... LDD A,Y; CMPD #$3B,X; BLT $758E", 03B58E
# "COMA; RTS" when its lob frames passed the time, 03B58C "CLRA; RTS" when not
flag burns_robot_lob_due cy lob_due
# burns_robot_walk_form_1 and burns_robot_steer: 03AE9F/03AED5 "LDB #$2D,X; SUBB #$31,X; BEQ; BPL; NEGA": negative
# set when its aim (2D) is below its walking direction (31), so the turn goes down (C: "if (negative) turn = 0u -
# turn;")
flag burns_robot_walk_form_1 s aim_below
flag burns_robot_steer s aim_below
# burns_robot_check_hit: 03B168 "LDB #$1E,X; BEQ $7175; BMI $7175": negative set when its hit value has bit 7 set
# (then it is not taken); C: "negative = hit >> 7; if (hit != 0u && negative == 0u)"
flag burns_robot_check_hit s negative_hit
# done: objects/burns_robot.c

# ---- objects/burns_robot_parts.c ----
# burns_part_fall: 03B6E3 "LDD #$16,X; BEQ $76EC; BMI $76EC": negative set when its height is below 0 (then it is put
# on the floor); C: "negative = z_2 >> 15; if (z_2 == 0u || negative)". Its carry is left: the variable is also the
# carry of the height's sum (03B6DD "ADCA #$16,X").
flag burns_part_fall s below_floor
# mr_burns_beaten: B is the state the list runner hands every handler (its "LDD #$01,X": type, state; the parts'
# dispatcher 03B59B "LDA #$02,X; ASLA; JMP [A,U]" keeps B), stored with 01 into <$05-<$06 (03B98F "PUSHS D" ...
# step_subphase 1, step_countdown the state number); its callers pass "state" but one "(uint8_t)floor_cell", so it
# needs its line ("state" is a local of it already)
param mr_burns_beaten d state_number
# done: objects/burns_robot_parts.c

# ---- objects/collisions.c ----
# collide_players_with_enemies, collide_players_with_child_objects, collide_players_with_list_1_objects: D is what
# boxes_overlap hands back in it (07C058/07C08F/07C0C7 "LBSR $C13A"; boxes_overlap's "local ... d overlap_word",
# 07C1DD/07C1DF), A read as the last flags and D handed back at the end (last_flags_word)
param collide_players_with_enemies d overlap_word
param collide_players_with_child_objects d overlap_word
param collide_players_with_list_1_objects d overlap_word
# done: objects/collisions.c

# ---- objects/krusty_balloon.c ----
# krusty_balloon_check_over_target: its target gone or down: krusty_balloon_lose_target (02693F "LBEQ $6CD8", 026945
# "LBMI $6CD8"); not in place: 026967 "CLRA; RTS"; in place: 026C24 "LBSR $867D (free slot); BCC $6C7B" and the attack
# set up, 026C72/026C7A "COMA; RTS". Carry set when the chase ends (an attack starts or it waits for a target):
# krusty_balloon_chase "if (carry) return;"
flag krusty_balloon_check_over_target cy chase_ended
# krusty_balloon_lose_target: keeps its state and step, stops, state 5 (waiting for a target), 026CFF "COMA; RTS":
# carry always set, the chase ended
flag krusty_balloon_lose_target cy chase_ended
# krusty_balloon_check_hit: 026923 "LDB #$1E,X; BEQ $6939; BMI $6939": negative set when the hit value has bit 7 set
flag krusty_balloon_check_hit s negative_hit
# done: objects/krusty_balloon.c

# ---- objects/police_car.c ----
# police_car_door_open: 02C465 "LDA ,Y+; CMPA #$7F; BEQ" (the list's end), 02C46B "CMPA $1874; BCC $6474" (skipped
# unless more players are present than it), 02C471 "LBSR $862C" puts in the child record after it: the byte
# car_door_release's "players" field gives
local police_car_door_open 02C465 a player_threshold
# done: objects/police_car.c

# ---- objects/fireman_goon_effect.c ----
# fireman_goon_effect: 07E18F "LDU #$F28C; ASLB; JMP [B,U]": B is the object's state the list runner hands it (its "LDD
# #$01,X"); C: "switch ((int8_t)(uint8_t)((uint32_t)d << 1))"
param fireman_goon_effect d state
# done: objects/fireman_goon_effect.c

# ---- objects/stage_3_boss.c ----
# stage_3_boss_partner_ready: 03D6AF "LDU #$41,X; LDA #$01,U; CMPA #$3E; BNE $76C7", "TST #$00,U; BEQ $76C7", "LDA
# #$2E,U; CMPA #$13; BGE $76C7", 03D6C5 "COMB; RTS", 03D6C7 "CLRB; RTS": carry set when its partner is still a boss
# (type 3E) in use and standing (phase below 13); stage_3_boss_update "if (carry)" joins it again
flag stage_3_boss_partner_ready cy partner_ready
# stage_3_boss_arrive: 03D24D "LDY $1852; CLR #$2A,Y": the object kept in stage_kept_object (the story's marker
# stage_3_boss_enter tells: "local stage_3_boss_enter 03D230 y marker object"), its byte 2A cleared
local stage_3_boss_arrive 03D24D y marker object
# stage_3_boss_together: 03D2C6 "TFR X,Y; LEAY #$0C,Y; LDX #$41,X; LEAX #$0C,X; LDU #$000F; BMOVE Y,X,U": Y walks its
# own place (x, y, z: 15 bytes from field 0C) copied to its partner's (partner_place)
local stage_3_boss_together 03D2C8,03D2D4 y own_place
# done: objects/stage_3_boss.c

# ---- objects/stage_7_boss.c ----
# stage_7_boss_approach: not facing the target or not near it: 022E3B "INCW #$3D,X; CLRA; RTS"; charging (0230FD..)
# 02312D "COMA; RTS"; attacking (0230B3..) 0230F3/0230FB "COMA; RTS"; its target down: stage_7_boss_go_idle. Carry set
# when it started an attack or a charge (its comment: "carry: it did either"); stage_7_boss_walk "if (carry) return;".
# (Its find_nearest_player call at 023119 also writes the carry, which 02312D overwrites unread.)
flag stage_7_boss_approach cy action_started
# stage_7_boss_charging: 022D2E "LBSR $861D; SUBA #$32,X; BEQ; BPL $6D3D; DEC #$32,X": negative set when the
# direction to its target is below its charge direction (32), which then turns down
flag stage_7_boss_charging s target_below
# stage_7_boss_check_hit: 022DE7 "LDB #$1E,X; BEQ $6DF1; BMI $6DF1": negative set when the hit value has bit 7 set
flag stage_7_boss_check_hit s negative_hit
# stage_7_boss_order_throws: 022F6E "LDB $1880; DECB; PUSHS B; SUBA ,S; LEAS #$01,S; BEQ $6F90; BMI $6F90": negative
# set when the other enemies are more than the throws allowed for the players (then no throw is ordered)
flag stage_7_boss_order_throws s too_many_enemies
# done: objects/stage_7_boss.c

# ---- objects/stage_8_boss.c ----
# stage_8_boss_player_down: 03A02D "LDB <$50; LSRB; BCC; TST $4A42; BMI $6056" for each player in the game,
# 03A054 "CLRA; RTS", 03A056 "COMA; RTS": carry set when a player in the game is reeling or down (as
# stage_boss_any_player_down's player_down)
flag stage_8_boss_player_down cy player_down
# stage_8_boss_move: walls, the floor ahead, then its height against the floor: above it, height speed - 60 and
# "carry = 0u"; on it, "carry = 1u" (its comment: "carry once it is on the floor")
flag stage_8_boss_move cy landed
# stage_8_boss_next_player: 03A115 "TST #$00,U; RTS": zero set when that player's object is not in use
flag stage_8_boss_next_player z slot_empty
# stage_8_boss_player_is_close: as stage_boss_player_is_near (03A150 "LSRB; BCC $6175", the reaches <$F8/<$FA, COMA
# when within): carry set when the player is in the game and within reach
flag stage_8_boss_player_is_close cy player_close
# stage_8_boss_make_invulnerable: 03A177 "LDA #$00,X; ORA #$04; STA #$00,X; RTS": zero set when its flags byte is
# clear (never: bit 2 was just set); stage_8_boss_reel 03A726 "LBSR $6177; LBNE $65D1" (always taken)
flag stage_8_boss_make_invulnerable z flags_clear
# stage_8_boss_take_hit: as stage_boss_check_hit, A 0 not hit (zero), 1 hurt, FF beaten (negative); stage_8_boss_take_hits
# "if (zero)"
flag stage_8_boss_take_hit z not_hit
flag stage_8_boss_take_hit s beaten
# stage_8_boss_blink_out: 03A1E8 "DEC #$2F,X; BNE $61F5" (03A1F5 "CLRA; RTS"), else removed and scored, 03A1F3 "COMA;
# RTS": carry set once it is gone (as stage_boss_blink_out's gone)
flag stage_8_boss_blink_out cy gone
# stage_8_boss_hit_on_frame: 03A209 "LDA #$06,X; LSRA; RTS": carry = animation_flags bit 0, the animation ended
flag stage_8_boss_hit_on_frame cy animation_ended
# stage_8_boss_is_still: 03A25B "LDD #$0F,X; BNE $6267; LDD #$14,X; BNE $6267; COMA; RTS": carry set when its x and y
# speeds are 0
flag stage_8_boss_is_still cy standing_still
# done: objects/stage_8_boss.c

# ---- objects/wrestler.c ----
# wrestler_within_reach: 0217C9 "LDD #$0C,X; SUBD #$0C,U; ABSD; CMPD #$0040; BGT $77E3", the same in y against 4,
# 0217E1 "COMA; RTS": carry set when the object in U is within 40 across and 4 in depth
flag wrestler_within_reach cy in_reach
# wrestler_check_hit: 0216D9 "LDB #$1E,X; BEQ $76E3; BMI $76E3": negative set when the hit value has bit 7 set
flag wrestler_check_hit s negative_hit
# done: objects/wrestler.c

# ---- files of the work list with nothing of their own to name (their flags come from the sources above or other
# groups', or are arithmetic) ----
# done: objects/bear.c
# done: objects/bird_item.c
# done: objects/boss_door.c
# done: objects/boulder.c
# done: objects/bouncing_prop.c
# done: objects/clown_on_ball.c
# done: objects/fat_goon.c
# done: objects/fat_goon_actions.c
# done: objects/floor_scenery.c
# done: objects/football_player.c
# done: objects/handlers_bank_15.c
# done: objects/items.c
# done: objects/teacup_goon_ride.c
# done: objects/fireman_goon.c
# done: objects/bluebird.c
# done: objects/marge_cloud.c
# done: objects/object_lists.c
# done: objects/obstacles.c
# done: objects/robot_scrap.c
# done: objects/running_animal.c
# done: objects/scenery_bank_15.c
# done: objects/shaking_scenery.c
# done: objects/stage_4_figures.c
# done: objects/stage_7_boss_helper.c
# done: objects/unused_objects.c

# ======== callers whose only source can not carry a name ========
# Each source below hands back a flag its own variable also uses for something else (an arithmetic carry, a shift's
# carry handed to table overrun cases, or other tests), so no flag line can be given to it and the name can not come
# up by itself; each caller here gets the flag only from it (calls whose flag nothing reads after them aside) and
# tests it for that one thing.
#
# boxes_overlap (its carry is also the ADDB/ADCA carry of the half sizes added, 07C154.. "ADDB #$20,U; ADCA #$00"):
# 07C1DA "CMPD <$F6; BCC $C1DE", 07C1DC "CLRA; RTS", 07C1DE "COMA; RTS": carry set when the two boxes overlap. Callers:
# 07C058/07C08F/07C0C7/07C129/07C1F9 "LBSR $C13A; BCC" then the trade of hits (players_touch for the players' pairs)
flag collide_players_with_enemies cy overlapping
flag collide_players_with_child_objects cy overlapping
flag collide_players_with_list_1_objects cy overlapping
flag unused_collide_with_list_1_objects cy overlapping
flag collide_players_with_players cy overlapping
# stage_boss_move_on_screen (its variable is the carry of the x sum, 03C0EB..; it ends in stage_boss_follow_floor or
# stage_boss_stop_on_floor, which hand on stage_boss_settle's landed): callers 03CC47 "LBSR $60EB; LBCC $6CD9"
# (bear_knocked_down: its vector_spawn_child carries are read by nothing), 03D497 "LBSR $60EB; LBCS $7285", 03D4A7
# "LBSR $60EB; BCS $74AD", 03C76A "LBSR $60EB; BCC $6769", 03C772 "LBSR $60EB; BCC $67AB": each goes on once landed
flag bear_knocked_down cy landed
flag stage_3_boss_leap cy landed
flag stage_3_boss_knocked cy landed
flag football_player_knocked_back cy landed
flag football_player_knocked_out cy landed
# burns_part_fall (its variable is also the carry of the height's sum, 03B6DD "ADCA #$16,X"): 03B6EA "CLRA; RTS"
# above the floor, 03B6F3 "COMA; RTS" put on the floor; burns_debris_bounce 03B6AD "LBSR $76CA; BCC $76C9" bounces
# when it lands
flag burns_debris_bounce cy landed
# krusty_balloon_throw (its variable also takes the ASLA carry of the side handed to the table overrun cases,
# "carry = (int8_t)side_index < 0;"): carry set when neither list 1 nor list 2 has room for the shot ("carry = 1u;"
# after the second vector_find_free_slot fails; 0 at the end); krusty_balloon_volley_throw 02684A "LBSR $69E0; BCS
# $686E" ends the volley
flag krusty_balloon_volley_throw cy no_room
# krusty_balloon_wobble (its variable also takes the ASLA carry of the squash step handed to the overrun cases):
# carry set once the four squash steps are done ("carry = 1u;" when squash_step reaches 4); krusty_balloon_flinch
# 026601 "LBSR $6A74; LBCS $6B33" goes back to chasing
flag krusty_balloon_flinch cy wobble_done
# burns_robot_decide_form_0/1/late_forms (their variable is also the facing, lob-due, in-middle and in-reach tests in
# turn) and burns_robot_choose_target (its variable is first find_nearest_player's "found"): each hands back carry set
# when the robot started something else than walking (an attack, a lob, a volley, holding out its part, or gloating);
# the walking handlers 03AE41 "LBSR $7176; BCS $6E73; LBSR $727F; BCS $6E73" (03AE74, 03AEB4 the same) stop there
flag burns_robot_walk_form_0 cy action_started
flag burns_robot_walk_form_1 cy action_started
flag burns_robot_walk_late_forms cy action_started
# wrestler_approach (its variable is also the within-reach and the surrounded tests): carry set when it started an
# attack, a guard or a leap (its comment: "carry: it did"); wrestler_walk 021565 "LBSR $76E4; BCS $758E" stops walking
flag wrestler_walk cy action_started
# ---- actors ----
# actors (src/bonus, src/bosses, src/enemies, src/players): the flags' names and the last register names.
# Flags named where they are worked out (the sources); the functions that only hand them on take the name by
# themselves. A few caller lines where the guide's exception applies (each says why).

# ---------------------------------------------------------------------------------------------------------------
# src/bonus/balloon.c (bonus 1, the bonuses' pan, title and timer)
# ---------------------------------------------------------------------------------------------------------------

# bonus_pan: the bonuses' camera pan by its step (020919 "LDX #$7BB2; LDA <$05; ASLA; JMP [A,X]"); its carry is
# the step's: bonus_pan_up 020963 "COMA" once the view has gone round (step_subphase back to 0), 020965 "CLRA"
# meanwhile; bonus_pan_start 020935 "CLRA". The callers wait on it: bonus_1_intro_pan "if (carry)" next state,
# bonus_2_intro_set_up 020A4F "BCC $6A8F" (returns until the pan is done)
flag bonus_pan cy pan_done
# bonus_pan_up: 020943 "ADDD #$0003" on the layer's y scroll, 020949 "BCC" not round yet: 020965 "CLRA"; round:
# the backdrop put back, step_subphase cleared, 020963 "COMA"
flag bonus_pan_up cy pan_done
# bonus_pan_start: the pan's first step, never the last: 020935 "CLRA; RTS"
flag bonus_pan_start cy pan_done

# bonus_1_any_balloon_full: 020637 "CMPD #$01A0; BCC $6647" a balloon's size past 1A0: 020647 "COMA"; none of the
# four: 020644 "CLRA". bonus_1_blow_until_done tests it ("if (carry)": the contest stops)
flag bonus_1_any_balloon_full cy balloon_full

# bonus_timer_tick: the bonuses' timer (BCD seconds and frames, 020655 "ADDA #$99; DAA" counts one down); with
# seconds and frames at 0: 020683 "COMA" (time up), else 02065E/020673 "CLRA". bonus_1_blow_until_done and
# bonus_2_yell test it ("carry = bonus_timer_tick(); if (carry)": the contest stops). The DAA's own carry in between
# is this variable too.
flag bonus_timer_tick cy time_up

# bonus_1_blow_until_done: tests the carry twice for one end of the contest: "bonus_1_any_balloon_full(&balloon,
# &carry); if (carry)" and "carry = bonus_timer_tick(); if (carry)", both stopping the balloons and going on to the
# next state (a balloon full or the time up); what it hands back nobody tests
flag bonus_1_blow_until_done cy contest_over

# bonus_1_stretch_width: 0204B3 "CMPD #$B000; BLS" past the biggest: width_zoom = B000, 0204BE "COMA"; 0204C0
# "CMPD #$4000; BCC" below the smallest: width_zoom = 4000, 0204CB "COMA"; in between: 0204D0 "CLRA"
flag bonus_1_stretch_width cy at_limit
# bonus_1_stretch_height: the same between 2000 and B000 (carry at a limit)
flag bonus_1_stretch_height cy at_limit
# bonus_1_blow: its carry is tested only after the stretches ("carry = bonus_1_stretch_height(balloon); if (carry)
# bonus_1_stretch_width(balloon);": at the limit one way, it stretches the other); what it hands back nobody tests
flag bonus_1_blow cy at_limit

# bonus_1_results: tests the carry once, after bonus_results ("if (carry == 0u)": the results still showing; when
# done, the small balloons marked and the flight waits given); its other carries (the loop's "CMPA #$04") nobody
# tests
flag bonus_1_results cy results_done

# done: src/bonus/balloon.c

# ---------------------------------------------------------------------------------------------------------------
# src/bonus/results.c
# ---------------------------------------------------------------------------------------------------------------

# bonus_results_count_points: the results' last state; when all four players' points are counted: 02109E "CLRD;
# STD $1842" (the results' state back to 0), 0210A3 "COMA"; else 02107F "CLRA". bonus_results hands it on from its
# states (bonus_results_start, _first ... _fourth, _wait, _wait_count, all through bonus_results_animate), and
# bonus_1_results / bonus_2_results wait on it
flag bonus_results_count_points cy results_done
# bonus_results_animate: the results' other states, never done: 021015 "CLRA; RTS"
flag bonus_results_animate cy results_done

# bonus_first_player_in_game: 0212A3 "LDA #$04; SUBA <$F0; RTS" (4 less the slots left: the first player's number);
# bonus_2_intro_set_up 020A57 "BMI $6A8B" skips showing a player when it is negative (it never is: the count goes
# from 4 to 0)
flag bonus_first_player_in_game s no_player

# done: src/bonus/results.c

# ---------------------------------------------------------------------------------------------------------------
# src/bonus/wake_up.c (bonus 2)
# ---------------------------------------------------------------------------------------------------------------

# bonus_2_level: a player's level; past the top (level byte / 4 above 14): 020DEC "COMA; RTS"; else it ends in the
# shared 020E64 "CLRA; RTS" (bonus_2_not_full). bonus_2_player hands it on from every reaction, and
# bonus_2_all_players stops at the first player whose level is full ("if (carry == 0u)" next player); bonus_2_yell
# then ends the yelling. The CMPA and ROLA carries in between are this variable too.
flag bonus_2_level cy level_full
# bonus_2_not_full: 020E64 "CLRA; RTS", the reactions' "not full"
flag bonus_2_not_full cy level_full
# bonus_2_wait_start: the player before the yelling: 020CDE "CLRA; RTS"
flag bonus_2_wait_start cy level_full

# bonus_2_yell (caller, exception): its carry comes from bonus_2_all_players (level_full) and bonus_timer_tick
# (time_up), and it tests both for one thing: "if (carry)" the results' music (8800) and state 0x628, the yelling over
flag bonus_2_yell cy contest_over
# bonus_2_results (caller, exception): from bonus_2_all_players (level_full) and bonus_results (results_done); it
# tests it once, after bonus_results: "if (carry)" the players' end pose (state 0x70A)
flag bonus_2_results cy results_done

# done: src/bonus/wake_up.c

# ---------------------------------------------------------------------------------------------------------------
# src/bosses
# ---------------------------------------------------------------------------------------------------------------

# dreamland_boss_fall: falls with C0 less height speed each frame; rising or still above floor + 10: 034406 "CLRA";
# down on its floor (z = floor_z, speed 0): 034404 "COMA". dreamland_boss_drop_in, _knocked_fall, _knocked_land and
# _leap_fall test it ("if (carry == 0u) return;")
flag dreamland_boss_fall cy on_floor

# find_free_object_from_4d40: 035447 "LDB #$00,U; BNE" a free object of the 24 from 4D40: cleared and marked,
# 035468 "COMB; RTS"; none: 035470 "CLRB; RTS". dreamland_boss_chain_setup tests it ("if (carry)" the piece put)
flag find_free_object_from_4d40 cy found

# done: src/bosses

# ---------------------------------------------------------------------------------------------------------------
# src/enemies
# ---------------------------------------------------------------------------------------------------------------

# enemy_find_attack_range: target too far (07D3DA/07D3E2 "CMPD #$0100") or in none of the 4 ranges: 07D403 "CLRB"
# (carry 0); in a range (07D3F3 "CMPB #$01,U; BCS", 07D3F8 "CMPB #$02,U; BLS $D405"): carry set with the range's
# chance. enemy_think tests it ("if (carry)" it rolls the chance to attack)
flag enemy_find_attack_range cy in_range

# enemy_take_hit: 07D02D "LDD #$0F,U" the hitter's x speed, then 07D030 enemy_set_knock_direction "BMI"/"BNE" on it:
# zero when the hitter does not move (the side it stands on decides), negative when it moves left
flag enemy_take_hit z hitter_still
flag enemy_take_hit s hitter_moving_left
# enemy_set_knock_direction: the flags it gets (07D030 "BMI $D044" no turn, 07D032 "BNE $D03C" turned, else
# 07D034 "LDD #$0C,U; CMPD #$0C,X" by the hitter's place); its other callers (the step tables' overruns in
# goons.c) hand it their dispatch's flags
flag enemy_set_knock_direction z hitter_still
flag enemy_set_knock_direction s hitter_moving_left

# enemy_hurt_start: 07E21E "LDD #$0F,U" the hitter's x speed; 07E221 "BMI", 07E223 "BNE": zero when the hitter does
# not move ("if (zero)": then the side it stands on turns the knock-back)
flag enemy_hurt_start z hitter_still

# done: src/enemies

# ---------------------------------------------------------------------------------------------------------------
# src/players
# ---------------------------------------------------------------------------------------------------------------

# player_next_height_against_floor: 039B3F-039B4A the next height (z + height speed), 039B4D "CMPD #$5C,U; RTS"
# against the floor; its callers branch on the signed compare: "if ((negative ^ overflow) | zero)" (BLE) the
# player lands, player_attack_fall "if (zero)" (BEQ) right at the floor
flag player_next_height_against_floor z at_floor
flag player_next_height_against_floor s below_floor
flag player_next_height_against_floor ov compare_overflow

# player_floor_against_height: the floor's height from the block flags (0397A0 "SEX"), 0397A1 "CMPD #$16,U; RTS"
# against the player's height; player_check_motion "if ((negative ^ overflow) | zero)" (BLE): the floor is not
# above the player, so it takes it
flag player_floor_against_height z floor_at_height
flag player_floor_against_height s floor_below_height
flag player_floor_against_height ov floor_compare_overflow
# player_check_motion (caller, exception for N only): its negative comes from player_floor_against_height and from
# vector_floor_ahead/_x/_y, whose N it never tests (it tests the floor cell's byte); it tests it only in "(negative ^
# overflow) | zero" after player_floor_against_height (3 times, one purpose). Its zero and overflow come from
# player_floor_against_height alone.
flag player_check_motion s floor_below_height

# player_floor_at_next_place: 039872 "CMPA #$FF" the floor ahead a wall: 03987F "COMA"; else its height, 03987D
# "CLRA"
flag player_floor_at_next_place cy wall
# player_find_entry_floor: 038211 "BCS $622A" stops at the first wall of the 8 places; none: 038229 "CLRA".
# player_run tries another depth while it is set
flag player_find_entry_floor cy wall

# player_start_effect: 039C2F "CMPA #$0090,U" an effect of a higher number already on the second sprite: 039C4E
# "COMA" (not started); else it starts it and clears the carry. player_show_hurt_spark, player_show_hit_spark and
# player_stand test it ("if (carry == 0u)" the spark placed)
flag player_start_effect cy effect_busy

# player_check_screen_edges: zero comes out of 039B0A "COMA" with A = FF (vitality left) or 0 (none): set unless a
# player with no vitality was stopped; 039AF8 "CLRA" when it goes on. player_knocked_flying and player_knocked_up:
# "if (zero)" keep on, else player_crash_into_edge
flag player_check_screen_edges z no_crash
# (its carry, set at 039B0A "COMA" when stopped and cleared at 039AF8 "CLRA", shares the variable with the ADDD/ADCA
# of the next x (039ADB, 039AE4), so it is left; its two callers that test it get a line each)
# player_knocked_flying (caller, exception): its carry comes from player_check_screen_edges alone, whose variable
# can not take the name; it tests it once: "if (carry == 0u)" keeps its life, else lies down
flag player_knocked_flying cy blocked_ahead
# player_entry_crash (caller, exception): the same, "if (carry == 0u)" keeps its life, else stops
flag player_entry_crash cy blocked_ahead

# player_eat_food: 0393D9 "LDA #$1B,U; CMPA #$1B,X; BCS; BHI" the player's vitality against its partner's: the food
# goes to the partner when the player has more (or the same, at random)
flag player_eat_food z same_vitality
flag player_eat_food cy less_vitality

# done: src/players/effects.c src/players/motion.c src/players/players.c src/players/reactions.c src/players/states.c

# gauges_byte_to_bcd: adds the BCD value of each set bit (0409DF "DAA"); past 99 the DAA's carry stops it (0409F0
# "PULLS U,PC" with it set). gauges_draw and gauge_draw_player test it ("if (carry)" shows 99)
flag gauges_byte_to_bcd cy past_99

# gauge_draw_health: 040A0D "CMPB #$02,U; BEQ; BLS" the health's gauge step against the shown one: the same, no
# change; shown above (BLS: carry or zero), one step down; else one up
flag gauge_draw_health z gauge_at_health
flag gauge_draw_health cy gauge_above_health

# done: src/players/gauges.c

# ---------------------------------------------------------------------------------------------------------------
# Register variables
# ---------------------------------------------------------------------------------------------------------------

# bonus_1_intro: 020012 "CLRA", 020013 "LBSR $69C0" (bonus_title, A = the bonus: 0 here, 1 from bonus_2_intro_set_up
# 020A47 "LDA #$01", whose local is bonus_number already); bonus_title's param then has the same name from all its
# callers
local bonus_1_intro 020013 d bonus_number

# unused_bonus_draw_timer_digits: 020698 "LDD <$F8" (bonus_draw_x), 02069B "STD #$0C,X" the digit's x; the C keeps its
# low byte in d (uint8_t) and its high byte in a (which later holds the tens of the seconds: left)
local unused_bonus_draw_timer_digits 020698 d digit_x_low

# player_set_air_move: D is the move (player state in A, 038998 "ADDB #$10" the air version of the animation in B):
# player_set_move_on_floor and player_start_attack hand it over as move_and_animation, player_set_move takes A as the
# player state and B as the animation
param player_set_air_move d move_and_animation

# done: register variables
# ---- scenes ----
# scenes (src/scenes/, src/stages/): flags and register names, in symbols.txt syntax

# ---- scenes/ending.c ----
# 02291E "LDA $18EA; CMPA #$68; BNE" (a pixel every 104 frames), 02292A "LDD <$C5; CMPD #$001B; BEQ $693E" ->
# 02293E "COMA; RTS" (carry 1: layer A's y has reached 27, the view is at the top), else 022932 "ADDD #$0001; STD
# <$C5", 02293C "CLRA; RTS" (carry 0). ending_roll_credits: "carry = ending_scroll_up(); if (carry == 0u) return;"
# then its next pose
flag ending_scroll_up cy at_top
# 0229D2 "INC #$28,X; LDA #$28,X; CMPA #$03; BNE $69F9" (every 3 frames), 0229DF "LDA #$0A,X; DECA; CMPA #$30" (its
# zoom), 0229E7 "LDB #$05,X; CMPB #$07; BEQ $69FB" -> 0229FB "CLR ,X; COMA; RTS" (carry 1: its last animation done,
# the tossed object removed: flags 0), every other way out 0229F9 "CLRA; RTS" (carry 0). ending_fade_start: "if
# (carry)" the family floats away and the fade starts
flag ending_tossed_rise cy gone
# 022A21 "CLRB; EXG A,B; ASLB; ROLA; ASLB; ROLA; ASLB; ROLA": the record number times 8 as a 16-bit shift done a byte at
# a time; the carry is the bit each ASLB moves out of the low byte into the high one (ROLA)
flag ending_put_placement cy shifted_bit
# done: scenes/ending.c

# ---- scenes/high_scores.c ----
# 022A52 "LDA #$02,X; ASLA; JSR [A,U]": the carry is the state's top bit the ASLA shifts out (the states are below 80,
# so it is 0), which stage_7_boss_blink_out gets with the carry and rotates into the boss's flags (022A93 "RORA")
flag stage_7_boss_update cy state_top_bit
# The name entry (022003, by name_entry_state at 3840) hands its carry back to name_entry_run: "carry = name_entry();
# if (carry) game_step++;" (1 once the scores are saved: done).
# 0222CD (name_entry_save) "... LBSR $86A1 (vector_insert_high_score) ... DEC ,S; BNE; COMA; PULLS A,PC": carry 1, the
# players who made the table put into it: the name entry is done
flag name_entry_save cy done
# 022212 "LDD $385E; ADDD #$0001; STD $385E; CMPD #$0700; LBEQ $62CD" (time up: name_entry_save, carry 1), else
# 0222A3/0222AE "CLRA; RTS" (carry 0: still typing, or all done and on to name_entry_linger)
flag name_entry_type_initials cy done
# 0222B0 "LDD $385E; ADDD #$0001; STD $385E; CMPD #$0100; BEQ $62CD" (after 256 frames name_entry_save, carry 1),
# else 0222CB "CLRA; RTS" (carry 0)
flag name_entry_linger cy done
# name_entry's carry only comes from its states (tail calls by name_entry_state): name_entry_type_initials,
# name_entry_linger and name_entry_save say done, but name_entry_set_up's carry is also the carry of the BCD
# increment of the place (022029.. "ADDA #$01; DAA": carry = (uint8_t)(place_number + 1u) < place_number, handed to
# konami_daa) before its "CLRA; RTS": named "done" there it would name that DAA carry too, so name_entry_set_up is left
# with its carry and name_entry (one meaning for its callers: name_entry_run "if (carry) game_step++;") takes the
# name itself
flag name_entry cy done
# (left: name_entry_set_up's half_carry and carry, and high_scores_print_entries' carry and half_carry 02263C..: the
# half carry and carry of the place's BCD increment "ADDA #$01; DAA", arithmetic carries)
# done: scenes/high_scores.c

# ---- scenes/scene_objects.c ----
# 02538D "CLRB; EXG A,B; ASLB; ROLA; ASLB; ROLA; ASLB; ROLA": the record number times 8, a 16-bit shift done a byte at a
# time; the carry is the bit each ASLB moves out of the low byte into the high one
flag scene_put_placement cy shifted_bit
# done: scenes/scene_objects.c

# ---- scenes/story_actor.c ----
# 03E7FC "LEAX #$00C0,X; DEC <$F0; RTS": the next player's object and the count of players left (story_players_left)
# down by one; the zero flag of the DEC is 1 when none is left. Its callers loop "do { ... story_next_player(&player,
# &zero); } while (zero == 0u);" (story_random_player, story_actor_line_up_players...)
flag story_next_player z none_left
# 03E05A "LDA #$00,X; BNE $6065", 03E065 "CMPA #$04; LBNE": the actor's flags (4: start its script again)
local story_actor_run 03E05A a actor_flags
# 03E083 "CLRD; LEAX #$28,X; LDU #$0018; BSETW D,X,U": the word its fields from 28 are filled with (0)
local story_actor_run 03E083 a fill_high
local story_actor_run 03E083 b fill_low
# 03E125 "LDA #$04,X; CMPA #$03; BHI $6138; MUL": the actor's kind (a player, 0-3, times the margin: 03E12C "MUL")
local story_actor_run 03E125 a kind
# 03E138 "LBSR $8671" (vector_direction_to_offset: the direction towards beside the target, in A), 03E13B "LDB
# #$3A,X; LBSR $8617" (vector_set_speed_by_direction with the direction and the walk speed)
local story_actor_run 03E138 a direction
# 03E1D1 "LDD #$3C,X; BEQ; CMPD <$AC; LBGE $667F": the camera x the actor waits for (story_actor.camera_wait), its
# two bytes
local story_actor_run 03E1D1 a camera_wait_high
local story_actor_run 03E1D1 b camera_wait_low
# 03E1E9 "LDA #$04; LDB #$04,X; MUL; ADDD #$4842; PUSHS D; PULLS U; TST ,U": the pressed byte (player_input.pressed)
# of the player whose number is the actor's kind
local story_actor_run 03E1F4 u pressed_at
# 03E1FA "LDA #$1D,X; LBEQ; DECA; STA #$1D,X": on each press, what it adds to the wait, one less every press
local story_actor_run 03E1FA,03E200 a press_bonus
# 03E204 "ADDA #$1C,X; CMPA #$E0; BHI; STA #$1C,X": the wait (field 1C, 03E20E "DEC #$1C,X; LBNE") made longer, up to E0
local story_actor_run 03E204 a longer_wait
# 03E21F "LDB #$3B,X; BEQ; CLRA; CMPD #$16,X; ... DECB; STD #$16,X": the height waited for (landing_height) as a word,
# its high byte 0
local story_actor_run 03E224 a height_high
# 03E238 "LDD #$3E,X; BEQ $6252" (story_actor.x_wait, the x waited for), 03E23D "SUBD <$AC; CMPD #$0C,X; LBGT;
# DECD; STD #$0C,X" (on the screen: less camera_x)
local story_actor_run 03E238 a x_wait_high
local story_actor_run 03E238 b x_wait_low
local story_actor_run 03E23D a screen_x_high
local story_actor_run 03E23D b screen_x_low
# 03E252 "LDD #$0A,X; BEQ", 03E257 "LBSR $863B" (vector_floor_ahead: the floor map's cell where the speeds take it,
# its value in A), 03E25A "ANDA #$0F; CMPA #$0B,X; LBNE" (its floor against the one waited for)
local story_actor_run 03E257 d cell
local story_actor_run 03E257 a cell_value
# 03E6F6 "LDY #$0C,X; CMPY #$0190; BGE; CMPY #$0000; BLT" (its x on the screen), 03E703 "LDY #$16,X; CMPY #$0280;
# BGE; CMPY #$FE00; BLE" (its height): off either, story_actor_remove
local story_actor_finish_frame 03E6F6 y x_now
local story_actor_finish_frame 03E703 y z_now
# (left: story_actor_remove_children's d, d_2 and p_d: A, which 03E7A3 "PUSHS X,A" keeps and 03E7B8 "PULLS A,X,PC"
# gives back, passed along; story_actor_run's d at 03E138, margin in and direction out, and its u from the calls)
# done: scenes/story_actor.c

# ---- stages/scroll.c ----
# 0264E7 "LDD <$F0; ASRA; RORB; ASRA; RORB": the move divided by 4, a 16-bit shift done a byte at a time; the carry is
# the bit each ASRA moves out of the high byte into the low one (RORB)
flag camera_scale_quarter cy shifted_bit
# 0264EF "LDD <$F0; ASRA; RORB": the move divided by 2
flag camera_scale_half cy shifted_bit
# 0264FB "LDD <$F0; ASLB; ROLA": the move times 2; the bit the ASLB moves out of the low byte into the high one
flag camera_scale_double cy shifted_bit
# 026501 "LDD <$F0; ASLB; ROLA; ASLB; ROLA": the move times 4
flag camera_scale_quadruple cy shifted_bit
# (left: camera_scale_move's d at 0264E5, A doubled by "ASLA" with the ratio's low byte, handed back as it is; and the
# arithmetic carries of camera_update, camera_stop_at_x/_y..., layer_scroll_move, cemetery_scroll_up, story_1_scroll,
# screen_shake_advance, dreamland_scroll: sums done a byte at a time)
# done: stages/scroll.c

# ---- stages/stage.c ----
# 07B693 "LDA $184E; BEQ $B6A4" (players_all_idle: not all out, scene_routine_nothing, carry 0), else 07B699 "LDA
# <$50; STA <$85; INC <$04; COMA; RTS" (the players noted again, the next phase, carry 1: all the players are out).
# Its callers stage_N_exit: "if (carry) stage_record_entry += 4u;"
flag stage_players_exit cy players_out
# 07B6A4 "CLRA; RTS": carry 0, what stage_players_exit hands back while the players are not all out (its other caller,
# stage_play_frame's scene routine, does not read it)
flag scene_routine_nothing cy players_out
# done: stages/stage.c

# ---- stages/stage_3.c ----
# 07A9FC "CLRD; STA <$04", 07AA00 "STD <$05" (step_subphase and step_countdown, from D: stage_3_forest_end_phase
# hands it 0, cleared_steps); the palette callers reach it only through table entries read past their ends
param stage_3_forest_end_phase_tail d subphase_and_countdown
# done: stages/stage_3.c

# ---- stages/stage_7.c ----
# (left: stage_7_closing_scene's u. 07B181 "LDU #$001F; BMOVE Y,X,U" makes it a count, but 07B188 joins that path
# with the one where U is what run_child_objects hands back, and the C has one variable for the parameter and all of
# them (the parameter's web keeps its name, so a local line there would do nothing): the U the step dispatcher hands
# on)
# done: stages/stage_7.c

# ---- stages/title_cards.c ----
# 02719F "CLRB; EXG A,B; ASLB; ROLA; ASLB; ROLA; ASLB; ROLA": the record number times 8, a 16-bit shift done a byte at a
# time; the carry is the bit each ASLB moves out of the low byte into the high one
flag title_card_put_picture cy shifted_bit
# done: stages/title_cards.c

# (left as passing a value along: the b that story_1_street, story_1_redraw, bonus_1_intro_phase, bonus_2_intro_phase,
# bonus_2_end_phase, stage_2_end_phase and stage_5_end_phase find in B: "LDA #$xx; LBSR check_skip", which reads only
# A, the frames to wait)

# ======== the stack slots and temporaries ========
# ---- system ----
# group system: the 053248 C's stack slots and temporaries in src/system, src/engine, src/video, src/game,
# src/attract, src/test_mode, src/scenes, src/stages (proposals; symbols.txt syntax)
#
# A note on the plain `stack` the C shows: emit.renumbered() renames the first of a function's numbered names
# (stack_1, stack_10, stack_10001...) to its base when the base is free, so the C's `stack` is a slot too; the work
# list (which looks for stack_N) misses it. Its slot is named here with the rest, by the store that writes it.

# ---- src/attract/demo.c ----
# demo_start 07A0EA "PUSHS U": U the player's record (07A0E5 "LDU A,U" from player_records[demo_player]), kept over
# 07A0F2-07A0FE (U then walks the demo's inputs) and taken back at 07A101 "PULLS U" (the C: "record = ((uint32_t)
# stack_2 << 8) | stack;", then the record's lives). s2 its high byte, s1 its low byte
local demo_start 07A0EA s2 saved_player_high
local demo_start 07A0EA s1 saved_player_low
# done: src/attract/demo.c

# ---- src/engine/directions.c ----
# set_walk_speeds_from_direction 07CCDD "PUSHS U,D": U, the caller's, kept to hand back (07CCED "PULLS D,U,PC"; the C
# returns "((uint32_t)stack_2 << 8) | stack"); A the direction's angle (heading's high byte), read back at 07CCE4
# "LDA ,S; ADDA #$40" for the speed across, a quarter turn on
local set_walk_speeds_from_direction 07CCDD s2 saved_u_high
local set_walk_speeds_from_direction 07CCDD s1 saved_u_low
local set_walk_speeds_from_direction 07CCDD s4 heading_angle

# ---- src/engine/objects.c ----
# clear_enemy_objects / clear_list_1_objects / clear_child_objects 07959A / 0795CA / 0795FA "PUSHS D" after 079597 /
# 0795C7 / 0795F7 "LDD #$59,X" (the object's sprites), put back after the clearing at 0795A4/0795A6 "PULLS D; STD
# #$-07,X" (the C: "mem_write16(object_place - 7u, ((uint32_t)stack << 8) | stack_10002)"): the high byte (s10001,
# the C's `stack`) and the low byte (s10002)
local clear_enemy_objects 07959A s10001 saved_sprites_high
local clear_enemy_objects 07959A s10002 saved_sprites_low
local clear_list_1_objects 0795CA s10001 saved_sprites_high
local clear_list_1_objects 0795CA s10002 saved_sprites_low
# done: src/engine/objects.c

# ---- src/scenes/game_start_portraits.c ----
# game_start_draw_portraits 05EE68/05EE7C "PUSHS U; PULLS D; ANDA #$07; ORA #$28" and 05EE70/05EE84 "PUSHS D; PULLS
# U": the tile place, past each column and each row, kept inside the tile layer's page 2800-2FFF (the C: "stack_2 =
# (stack_2 & 7u) | 0x28u; tile = ((uint32_t)stack_2 << 8) | stack;"): s2 the place's high byte, s1 its low byte
local game_start_draw_portraits 05EE68,05EE70,05EE7C,05EE84 s2 tile_high
local game_start_draw_portraits 05EE68,05EE70,05EE7C,05EE84 s1 tile_low

# ---- src/scenes/high_scores.c ----
# name_entry_type_initials 022228 "PUSHS D" (the name entry's timer, 022212 "LDD $385E", over the sound at 02222D,
# 022230 "PULLS D") and 022285 "PUSHS D" (the text's x, 022282 "LDD <$F8", over name_entry_edit_initials, 02228E
# "PULLS D; ADDD #$0048"): a word kept over a call; s10001 (the C's `stack`) its high byte, s10002 its low byte
local name_entry_type_initials 022228,022285 s10001 kept_word_high
local name_entry_type_initials 022228,022285 s10002 kept_word_low
# name_entry_edit_initials 022407 "PUSHS U" (the letter's sprite, over 02240B "LDU <$FC; LDB #$18,U": the player's
# colour, back at 022413 "PULLS U") and 022435 "PUSHS X" (the entry, over 022437 "LDX #$759E": the cursor's zooms,
# back at 022446 "PULLS X"): a pointer kept while U or X reads something else; s2 its high byte, s1 its low byte
local name_entry_edit_initials 022407,022435 s2 kept_pointer_high
local name_entry_edit_initials 022407,022435 s1 kept_pointer_low
# name_entry_draw_picture 022491 "PUSHS U,X,D; LEAS #$-10,S": its frame from 0,S = s16
# 022496 "STA #$00,S": A the column with bit 7 (022491's "bit 7 of A blank": 0224CF "LDB #$00,S; BPL" else colour 0)
local name_entry_draw_picture 022496 s16 column_and_blank
# 02249B "ANDA #$7F; STA #$06,S" (s10, the C's `stack`): the player's column, 0224A4 "LDA #$06,S; ASLA; LDD A,X" its
# name_entry_columns entry
local name_entry_draw_picture 02249B s10 column_number
# 02249E "STB #$07,S": B the picture, 0224B3 "LDB #$07,S; ASLB; LDX B,X" name_entry_pictures
local name_entry_draw_picture 02249E sF picture_number
# 0224AA "STA #$05,S": the column entry's column (name_entry_column.column), added to every block's tile place at
# 0224BB "LDB #$05,S; LEAU B,U"
local name_entry_draw_picture 0224AA s11 column_tiles
# 0224AD "STB #$03,S": the column entry's palette, ORed into each block's colour at 0224CC "ORA #$03,S"
local name_entry_draw_picture 0224AD s13 column_palette
# 0224C2 "LDA ,X+; STA #$01,S": the block's width, the columns of each row (0224D8 "LDA #$01,S; STA #$04,S") and the
# step to the next row (0224EE "LDA #$40; SUBA #$01,S")
local name_entry_draw_picture 0224C2 s15 block_width
# 0224C7 "LDA ,X+; STA #$02,S", 0224F5 "DEC #$02,S; BNE": the block's rows still to draw
local name_entry_draw_picture 0224C7,0224F5 s14 rows_to_draw
# 0224DB "STA #$04,S" (the width), 0224E9 "DEC #$04,S; BNE": the row's tiles still to draw
local name_entry_draw_picture 0224DB,0224E9 s12 columns_to_draw
# 0224D5 "STA #$08,S": the block's colour with the column's palette, 0 to blank (0224D4 "CLRA"); 0224DE "LDB #$08,S;
# STB #$-2000,U" each tile's colour
local name_entry_draw_picture 0224D5 sE block_colour
# high_scores_print_entries 022654 "PUSHS X": the entry, kept over the row (022724 "PULLS X; LEAX #$08,X": the next
# entry; the C: "entry = (((uint32_t)stack_2 << 8) | stack) + 8u"); s2 its high byte, s1 its low byte
local high_scores_print_entries 022654 s2 saved_entry_high
local high_scores_print_entries 022654 s1 saved_entry_low
# 0226A5 "LDD ,X++; PUSHS D" (the entry's BCD score), 0226CF "ASLDI #$04; STD ,S" (the digits moved a digit up after
# each one printed), 0226DF "PULLS D"; then 0226E9 "LDA ,X++; PUSHS A" (the entry's icon number, read back at
# 022702 "PULLS A; ADDB A,Y" in high_score_icons) and 0226EE "PUSHS U; PULLS D" (the sprite place, for the icon's
# frame: 0226F2 "LSRDI #$03; ADDB <$16"). s4: the score's high digits, then the sprite place's low byte; s3: the
# score's low digits, then the icon number; s5: the sprite place's high byte
local high_scores_print_entries 0226A5,0226CF,0226EE s4 digits_high_then_sprite_low
local high_scores_print_entries 0226A5,0226CF,0226E9 s3 digits_low_then_icon
local high_scores_print_entries 0226EE s5 sprite_high
# done: src/scenes/high_scores.c

# ---- src/scenes/scene_objects.c ----
# scene_put_placement 0253AD "LDD ,U++; CMPD #$FFFF; BEQ; STD #$0C,Y": the placement's x (FFFF keeps the object's)
local scene_put_placement 0253AD t4 placement_x

# ---- src/scenes/story_actor.c ----
# story_actor_run: 03E081 "PUSHS X,B" (the actor and its script number, 03E07B "LDB #$30,X", over the clearing of
# fields 28-57: 03E08B "PULLS B,X; STB #$30,X"); 03E134 "PUSHS A; SUBB ,S+" (half the target margin, 03E130 "LDA
# #$39,X; ASRA"); 03E1B0 "PUSHS X" (the actor, over clearing the players' fields 2F: 03E1C6 "PULLS X"); 03E1F2
# "PUSHS D; PULLS U" (the player's controls place 4842 + 4 x kind). s2: the high byte of the actor (or of the
# controls place); s1: their low byte, or the half margin; s3: the actor's script number
local story_actor_run 03E081,03E1B0,03E1F2 s2 kept_high
local story_actor_run 03E081,03E134,03E1B0,03E1F2 s1 kept_low
local story_actor_run 03E081 s3 saved_script_number
# story_actor_play_sound_if_player 03E42A "PUSHS X" (the actor, over 03E42C-03E430 the player's flags, 03E432 "PULLS
# X") and 03E437 "PUSHS U; PULLS D" (the operation's sound, 03E420 "LDU ,Y++", to D for 03E43B "LBSR $8680"): s2,
# the C's 16-bit `stack`
local story_actor_play_sound_if_player 03E42A,03E437 s2 kept_word
# 03E42C "PUSHS D; PULLS X": the player's object (03E424 "LDA #$C0; MUL; ADDD #$4A40"), D to X; s10003 its high byte,
# s10004 its low byte
local story_actor_play_sound_if_player 03E42C s10003 player_object_high
local story_actor_play_sound_if_player 03E42C s10004 player_object_low
# story_actor_player_speaks 03E5D6 "PUSHS X": the actor, over story_random_player (03E5D8) and the balloon's set-up,
# back at 03E639 "PULLS X" (the C's 16-bit `stack`)
local story_actor_player_speaks 03E5D6 s2 saved_actor
# 03E5EB / 03E61E "PUSHS D": the voice's sound command (03E5DF "LDD B,Y", the player's entry), kept over the balloon's
# set-up and taken back at 03E610 "PULLS D" for 03E633 "LBSR $8680"
local story_actor_player_speaks 03E5EB,03E61E s10003 saved_voice_high
local story_actor_player_speaks 03E5EB,03E61E s10004 saved_voice_low
# story_actor_finish_frame 03E68B / 03E6B2 "PUSHS X": the actor, over running its 11 child slots and over running the
# eight players' objects (03E6A4 / 03E6E4 "PULLS X"; the C's 16-bit `stack`)
local story_actor_finish_frame 03E68B,03E6B2 s2 saved_actor
# 03E689 "LDA #$0B", 03E692 "PUSHS A" ... 03E69F "PULLS A; DECA; BNE": the child slots still to run
local story_actor_finish_frame 03E692 s3 child_slots_left
# 03E698 "PUSHS Y": the next child slot (03E694 "LDX ,Y++"), over story_actor_run (03E69D "PULLS Y")
local story_actor_finish_frame 03E698 s5 saved_child_slot
# story_actor_remove 03E752 "PUSHS X": the actor (5640), over the players' loop (03E79F "PULLS X; TFR X,U": the
# parent of story_actor_remove_children; the C's 16-bit `stack`)
local story_actor_remove 03E752 s2 saved_actor
# 03E777 "PUSHS X": the player, over clearing its fields 1C-58 (03E77C "LDU #$003D; BSET"), back at 03E781 "PULLS X"
local story_actor_remove 03E777 s4 saved_player
# story_random_player 03E7CB "PUSHS D; PULLS X": a player's object picked by the random number (03E7C0 "LDA <$58;
# ANDA #$03; LDB #$C0; MUL; ADDD #$4A40"), D to X; s10001 (the C's `stack`) its high byte, s10002 its low byte
local story_random_player 03E7CB s10001 random_player_high
local story_random_player 03E7CB s10002 random_player_low
# done: src/scenes/story_actor.c

# ---- src/system/jump_table.c ----
# clear_child_objects (0795DF folded in): 0795FA "PUSHS D" after 0795F7 "LDD #$59,X" (the object's sprites), put
# back at 079604/079606 "PULLS D; STD #$-07,X"
local clear_child_objects 0795FA s10001 saved_sprites_high
local clear_child_objects 0795FA s10002 saved_sprites_low
# start_sample_rom_check 078F18 "TST $1FC4": reading 1FC4 interrupts the Z80 (CLAUDE.md: "1FC4 lectura = IRQ al
# Z80"); the value read is not used
local start_sample_rom_check 078F18 t1 ignored_irq_read
# find_nearest_player 07D2B3 "LDA #$04; PUSHS A" (s1, the C's `stack`), 07D2F0 "DEC ,S; BNE": the players still to
# look at
local find_nearest_player 07D2B5,07D2F0 s1 players_to_check
# 07D2D3 "PUSHS D": the x distance to the player (07D2CA "LDD #$0C,X; SUBD #$0C,U", made positive), added to the y
# distance at 07D2DE "ADDD ,S++"
local find_nearest_player 07D2D3 s3 kept_x_distance
# print_bcd_word 07941B "PUSHS A" (s1, the C's `stack`): the BCD word's high byte (its first two digits), read back
# at 07942B "LDA ,S; ANDA #$0F" (the second digit) and 079443 "TST #$01,S" (the third digit is blank only when the
# first two are 0)
local print_bcd_word 07941B s1 high_digits
# 079439 "TFR B,A; PUSHS A": the low byte (the last two digits), read back at 079450 "PULLS A; ANDA #$0F"
local print_bcd_word 07943B s2 low_digits
# print_bcd_byte 079400 "PUSHS A" (s1, the C's `stack`): the BCD byte, back at 079410 "PULLS A; ANDA #$0F" (the
# low digit)
local print_bcd_byte 079400 s1 saved_bcd_byte
# reserve_objects_for_sprites 07E461 "PUSHS A" (s1, the C's `stack`; A the count of objects), 07E480 "DEC ,S; BNE":
# the objects still to reserve
local reserve_objects_for_sprites 07E451,07E461,07E480 s1 objects_left
# 07E468 "LDB #$08; PUSHS B", 07E477 "DEC ,S; BNE": the object's sprites still to give an order
local reserve_objects_for_sprites 07E46A,07E477 s2 sprites_left
# done: src/system/jump_table.c

# ---- src/test_mode/checks.c ----
# test_color_check_draw_ramp 05E14F "PUSHS D": A the ramp's first tile (05E132 "LDA #$30"), B its colour byte (05E134
# "LDB #$40", 05E13D "#$80", 05E146 "#$C0"), read back for each step at 05E15B "LDD ,S" (test_put_tile: tile A,
# colour B); 05E16E "INC ,S": the next step's tile
local test_color_check_draw_ramp 05E14F,05E16E s2 step_tile
local test_color_check_draw_ramp 05E14F s1 kept_colour
# test_io_check_run 05E1B8 "PUSHS X,B": X the place of the port's row (05E1B5 "LEAX #$09,X"), back at 05E1FD "PULLS
# B,X"; B the ports still to show (05E1AB "LDB #$04", 05E1FF "DBJNZ"), read at 05E1DA "LDB #$01,S; CMPB #$02"
local test_io_check_run 05E1B8 s2 row_place_high
local test_io_check_run 05E1B8 s1 row_place_low
local test_io_check_run 05E1B8 s3 ports_remaining
# s4: 05E1BC "PUSHS B" (the bits still to show, 05E1BA "LDB #$06", 05E1C5 "PULLS B; DBJNZ"), 05E1CC "PUSHS Y" (the
# next port's place, low byte, over test_read_setting) and 05E1D6 "PUSHS B" (the start buttons setting it read, 05E1EF
# "PULLS B; TSTB"); s5: the port place's high byte
local test_io_check_run 05E1BC,05E1CC,05E1D6 s4 kept_byte
local test_io_check_run 05E1CC s5 saved_port_high
# done: src/test_mode/checks.c

# ---- src/test_mode/menu.c ----
# test_menu_update 05E597 "LDB [,Y]; SEX; PUSHS D; PULLS X": the cursor (sign extended) from D to X for the division
# by 3 (05E59E "LDB #$03; DIV X,B"); s10001 its high byte, s10002 its low byte
local test_menu_update 05E59A s10001 cursor_high
local test_menu_update 05E59A s10002 cursor_low
# 05E5A1 "PUSHS X; PULLS D": the quotient, the line chosen (each menu line takes three bytes), handed back in D
# (05E5A5 "COMA": chosen); the C's 16-bit `stack`
local test_menu_update 05E5A1 s2 chosen_line
# test_colour_row 05E5BE "PUSHS U,X,D": U the caller's, put back (05E5E6 "PULLS D,X,U,PC"); X the row's place (05E5C0
# "LDD #$02,S; ADDD #$E000": its colour place); A the colour to write (05E5D9 "LDA ,S; ... BSET A,X,U"), B the
# caller's
local test_colour_row 05E5BE s2 saved_u_high
local test_colour_row 05E5BE s1 saved_u_low
local test_colour_row 05E5BE s4 row_high
local test_colour_row 05E5BE s3 row_low
local test_colour_row 05E5BE s6 row_colour
local test_colour_row 05E5BE s5 saved_colour_low
# 05E5C6 "ANDB #$C0; ADDB #$0F; PUSHS D; PULLS X": the row's colour place (from the line's start, column 0F), D to X
local test_colour_row 05E5CA s8 colour_place_high
local test_colour_row 05E5CA s7 colour_place_low
# test_write_setting 05E5F2 "PUSHS U,Y,X,A": Y the setting's place (5A58-5A67 are in the EEPROM), put back at 05E605
# "PULLS A,X,Y,U,PC"; 05E5F4 "LEAY #$-59F0,Y; PUSHS Y; LDA #$01,S": the EEPROM's cell, its low byte (s8)
local test_write_setting 05E5F2 s4 saved_setting_high
local test_write_setting 05E5F2 s3 saved_setting_low
local test_write_setting 05E5F8 s8 eeprom_cell
# test_read_setting 05E614 "PUSHS U,Y,X,A": Y the setting's place, X the caller's place on the screen (its tiles),
# A the caller's, put back at 05E625 "PULLS A,X,Y,U,PC"; 05E61A "PUSHS Y; LDA #$01,S": the EEPROM's cell (s8)
local test_read_setting 05E614 s4 saved_setting_high
local test_read_setting 05E614 s3 saved_setting_low
local test_read_setting 05E614 s6 saved_tiles_high
local test_read_setting 05E614 s5 saved_tiles_low
local test_read_setting 05E614 s7 saved_value_high
local test_read_setting 05E61A s8 eeprom_cell
# test_print 05E650 "PUSHS X,D": X the line's start place, read back by the line commands (05E69F/05E6A6/05E6AE/
# 05E6C1 "PULLS D,X; LEAX #$40|#$80|#$C0|#$100,X": the next lines); the C's 16-bit `stack`
local test_print 05E650 s2 line_start
# 05E677 "ADDD #$208C; PUSHS D; PULLS X": a place the text gives (row and column), D to X
local test_print 05E67A s10005 new_place_high
local test_print 05E67A s10006 new_place_low
# 05E6E6 "PUSHS U,D": U the text after the word (05E6F1 "PULLS D,U"), A the word's number (C7 + n, 05E6F3 "TSTA":
# the word C7 ends the text), B the colour
local test_print 05E6E6 s6 saved_text
local test_print 05E6E6 s10007 saved_word_number
local test_print 05E6E6 s10008 saved_colour
# unused_test_print_hex_word 05E704 "PUSHS U": the word, 05E706 "LDA ,S" its high byte, 05E70A "LDA #$01,S" its low
# byte, each printed with test_print_hex
local unused_test_print_hex_word 05E704 s2 word_high_byte
local unused_test_print_hex_word 05E704 s1 word_low_byte
# test_print_hex 05E711 "PUSHS D": A the byte printed (its low digit read back at 05E71E "LDA ,S; ANDA #$0F"), B the
# caller's colour (05E726 "PULLS D,PC")
local test_print_hex 05E711 s2 kept_printed_byte
local test_print_hex 05E711 s1 saved_colour
# done: src/test_mode/menu.c

# ---- src/test_mode/options.c ----
# test_print_coinage 05E2E1 "PUSHS B" (s1, the C's `stack`): the coinage setting, back at 05E304 "PULLS A" for its
# credits digit (05E30C "LDA A,Y", coin_setting_credit_digits)
local test_print_coinage 05E2E1 s1 saved_coinage
# 05E2F0 "PUSHS B; ADDA ,S+": the extra coins of the first credit (setting 5A62) added to the coins
local test_print_coinage 05E2F0 s2 added_extra_coins
# test_choose_setting_run 05E43C "PUSHS Y": the setting's place, over test_menu_update (05E441 "PULLS Y"); then
# 05E447 "PUSHS B": the line chosen, back at 05E44F "PULLS B; DECB" (the value to write)
local test_choose_setting_run 05E43C s2 saved_setting_high
local test_choose_setting_run 05E43C,05E447 s1 setting_low_then_line
# done: src/test_mode/options.c

# ---- src/video/background_maps.c ----
# draw_scrolled_layer_edges 07C411 "LDA #$03; LDB #$04; PUSHS D" (and 07C43F-07C443 for the rows): A the edge's number
# (07C41F "LDA ,S; ASLA; JSR [A,X]": its draw routine), counted down by 07C439/07C467 "DEC ,S"; B its bit in the
# edges to draw (07C417 "LDA #$01,S; BITA <$9A"), 07C436/07C464 "LSR #$01,S"
local draw_scrolled_layer_edges 07C415,07C439,07C443,07C467 s2 edge_number
local draw_scrolled_layer_edges 07C415,07C436,07C443,07C464 s1 edge_bit
# draw_layer_columns 07C4A3 "PUSHS D": A the layer (07C4B0 "LDA #$01,S" for find_layer_column), B the columns to draw
# (07C4C6 "DEC #$02,S; BNE")
local draw_layer_columns 07C4A3 s2 kept_layer
local draw_layer_columns 07C4A3,07C4C6 s1 columns_to_go
# 07C4B3 "PUSHS X": the layer's map record, over drawing the column (07C4BB "PULLS X")
local draw_layer_columns 07C4B3 s5 saved_layer_map_high
local draw_layer_columns 07C4B3 s4 saved_layer_map_low
# draw_layer_columns_with_floor_map 07C4E1 "PUSHS D": A the layer (07C4F0/07C4FC "LDA ,S"), B the columns to draw
# (07C511 "DEC #$01,S; BNE")
local draw_layer_columns_with_floor_map 07C4E1 s2 kept_layer
local draw_layer_columns_with_floor_map 07C4E1,07C511 s1 columns_to_go
# 07C4F2 / 07C4FE "PUSHS X": the layer's map record, over drawing the column and filling the floor map
local draw_layer_columns_with_floor_map 07C4F2,07C4FE s4 saved_layer_map_high
local draw_layer_columns_with_floor_map 07C4F2,07C4FE s3 saved_layer_map_low
# find_layer_column 07C5F1 "PUSHS Y": the map's strip under the column (07C5E5 "LDY A,Y"), back at 07C5F8 "PULLS Y"
# for the cell (07C60A "LEAY D,Y")
local find_layer_column 07C5F1 s2 strip_high
local find_layer_column 07C5F1 s1 strip_low
# find_layer_row 07C67C "PUSHS X,D": X the layer's map record, A the strip's word in the map (07C67B "ASLA", the
# scroll x's high byte times 2), B the scroll x's low byte; 07C690 "PULLS D,X; LDY A,Y"
local find_layer_row 07C67C s2 saved_layer_map_high
local find_layer_row 07C67C s1 saved_layer_map_low
local find_layer_row 07C67C s4 strip_word
local find_layer_row 07C67C s3 scroll_x_low
# draw_map_row 07C80B "PUSHS Y": the next map cell (07C807 "LDD ,Y++"), over drawing the block's row (07C829 "PULLS Y")
local draw_map_row 07C80B s2 next_cell_high
local draw_map_row 07C80B s1 next_cell_low
# fill_floor_map_row 07C867 "PUSHS Y": the same, over the floor map's row (07C88A "PULLS Y")
local fill_floor_map_row 07C867 s2 next_cell_high
local fill_floor_map_row 07C867 s1 next_cell_low
# done: src/video/background_maps.c

# ---- src/video/clear.c ----
# clear_text_layer 07927F / 0792A3 "LDA #$20; PUSHS A" (s1, the C's `stack`), 079298 "DEC ,S" / 0792C2 "DEC #$04,S":
# the rows still to clear, then the edge rows
local clear_text_layer 07927F,079298,0792A3,0792C2 s1 rows_to_go
# 079283 "LDA #$12; PUSHS X,A": X the row's place (079293 "PULLS A,X; LEAX #$40,X"), A the words of the row (07928F
# "DEC ,S"); then 0792A5 "CLRD; PUSHS D" (the edges' colours, 0792B4 "LDD #$02,S") and 0792A8 "LDD #$3F3F; PUSHS D"
# (the edges' tiles, 0792AD "LDD ,S"). s3/s2: the row place, then the colours; s4: the words left, then the tiles'
# low byte; s5: the tiles' high byte
local clear_text_layer 079283,0792A6 s3 row_or_colours_high
local clear_text_layer 079283,0792A6 s2 row_or_colours_low
local clear_text_layer 079283,07928F,0792AB s4 words_or_tiles_low
local clear_text_layer 0792AB s5 edge_tiles_high
# done: src/video/clear.c

# ---- src/video/palette.c ----
# palette_job_fade 07BE3B "PUSHS U": the palette job, over the range's colours (07BE6F "PULLS U"); 07BE77 "PUSHS A":
# A (the step's bit from the last colour routine) over the board's control write, handed back (07BE85 "PULLS A")
local palette_job_fade 07BE3B s2 saved_job_high
local palette_job_fade 07BE3B,07BE77 s1 job_low_then_step_bit
# done: src/video/palette.c

# ---- src/video/sprites.c ----
# sort_objects_by_depth 079A60 "PUSHS Y; PULLS D": the row's first object (079A5C "LDY D,U"), Y to D; the C's 16-bit
# `stack`
local sort_objects_by_depth 079A60 s2 first_in_row
# 079A64 "PUSHS D; PULLS Y" (the next object in the row, 079A68 "LDD #$5E,Y": draw_next) and 079ABC "PUSHS D; PULLS
# U" (the object lending the next sprites, 079AB6 "LDD #$-0002,U"): an object reached by a link, D to Y or U
local sort_objects_by_depth 079A64,079ABC s10001 linked_object_high
local sort_objects_by_depth 079A64,079ABC s10002 linked_object_low
# draw_object 079BE5 "PUSHS X": the object, while X looks for an object to lend it sprites (079BE7 "LDX #$7E,Y",
# 079BEC "LBSR $9CBD"), back at 079BF1/079C00 "PULLS X"
local draw_object 079BE5 s2 saved_object_high
local draw_object 079BE5 s1 saved_object_low
# write_object_sprites: 079C71 "PUSHS D; PULLS Y" (the object lending the next 8 sprites, 079C6E "LDD #$-02,Y", D to
# Y: s2 its high byte, s1 its low byte); 079CD7 "PUSHS A" (the window's bank, 079CD4 "LDA <$0E", set back at 079D51-
# 079D5C "LDB #$04,U; STB <$0E; SETLN" and 079DCF-079DD7: s1); 079D02 / 079D82 "PUSHS Y" (the sprite entry, over the
# zoom table in bank 1D) and 079D51 "PUSHS U,B,CC" (the sprite list): s3 their high byte, s2 their low byte
local write_object_sprites 079C71,079CD7 s1 bank_or_lender_low
local write_object_sprites 079C71,079D02,079D51,079D82 s2 pointer_low_or_lender_high
local write_object_sprites 079D02,079D51,079D82 s3 kept_pointer_high
# 079D04 / 079D84 "PUSHS B,CC": the zoom less 10 (the zoom step's index, 079D0E "PULLS CC,B; ... LDX D,X"); 079D1D /
# 079D9D "CLRA; LDB <$EB; PUSHS D; PULLS Y": the offset to scale (s5 0, s4 the offset), D to Y for "LMUL"; 079D22 /
# 079DA2 "PUSHS Y,X; LDD #$01,S": the product's middle bytes, the scaled offset (s6 its high byte, s5 its low byte)
local write_object_sprites 079D04,079D1D,079D84,079D9D s4 zoom_then_offset
local write_object_sprites 079D1D,079D22,079D9D,079DA2 s5 offset_high_then_scaled_low
local write_object_sprites 079D22,079DA2 s6 scaled_offset_high
# done: src/video/sprites.c

# ======== the plain `stack` slots of the group's other functions (not in the work list) ========
# Each is the slot the C calls `stack` (the first numbered slot of the function, renamed by emit.renumbered()); the
# slot's key is given by the push that writes it.

# ---- src/attract/intro.c ----
# attract_lisa_scene_animate 04045C "ANDA #$01; PUSHS A": Lisa's random pose (0 or 1), her animation 1A + pose, back at
# 040467 "PULLS A; ADDA #$1C" for her partner's
local attract_lisa_scene_animate 04045E s1 saved_pose
# attract_profile_move_out 0407A3 "PUSHS A": the move's number, over the move's speeds, back at 0407B5 "PULLS A; CMPA
# #$04"
local attract_profile_move_out 0407A3 s1 saved_move_number
# done: src/attract/intro.c

# ---- src/engine/directions.c ----
# set_speeds_from_direction 07CC8E "PUSHS U,D": D the heading (A its angle), read back at 07CC95 "LDD ,S" for the speed
# across, a quarter turn on (the C: "stack = heading", 16 bits at s4)
local set_speeds_from_direction 07CC8E s4 saved_heading
# direction_to_beside 07CCF0 "PUSHS X,B": B the x offset beside the other object (07CCF2 "SEX; ADDD #$0C,U"), handed
# back as the direction's low byte (07CD86/07CD8E "PULLS B,X,PC")
local direction_to_beside 07CCF0 s3 saved_x_offset
# direction_to 07CCFB "PUSHS X,B": the caller's B, handed back as the direction's low byte ("PULLS B,X,PC")
local direction_to 07CCFB s3 direction_low
# done: src/engine/directions.c

# ---- src/engine/floor.c ----
# set_climb_speed 07CDD6 "LDB #$5D,X; LSRB x3; PUSHS B; SUBA ,S+": the level of the floor the object is on (its floor
# height in steps of 8), taken from the target level
local set_climb_speed 07CDDC s1 current_level
# done: src/engine/floor.c

# ---- src/game/continue.c ----
# continue_screen 07B990 / 07B9D6 "PUSHS A" (the player's number, over its record's countdown, 07B9A8 / 07B9EB "PULLS
# A; ... INCA"); 07B925 / 07BA15 "PUSHS B,CC" keep B over the bank switch in the same slot
local continue_screen 07B925,07B990,07B9D6,07BA15 s1 saved_player_number
# done: src/game/continue.c

# ---- src/scenes/game_start_portraits.c ----
# game_start_run_portraits 05EEB3 "CLRA; PUSHS A", 05EEC7 "INC ,S", 05EEC9 "LDA ,S; CMPA #$04": the portrait (test
# player) to run, 05EEB9 "LDA ,S" its record in test_player_records
local game_start_run_portraits 05EEB4,05EEC7 s1 portrait_index
# portrait_come_alive 05EF58 "PUSHS A": the portrait's last frame (16), over the palette requests and the voice, back
# at 05EF7E "PULLS A"
local portrait_come_alive 05EF58 s1 saved_frame
# portrait_blink_now_and_then 05EF89 "PUSHS X; PULLS D": the object's address as a number, added to the random number
# so that each portrait blinks at its own time (the C: "((stack + random_number) & 0xF7u) == 0u")
local portrait_blink_now_and_then 05EF89 s2 object_as_number
# done: src/scenes/game_start_portraits.c

# ---- src/scenes/high_scores.c ----
# name_entry_save 0222D0 "LDA #$04; PUSHS A", 022300 "DEC ,S; BNE": the players' entries still to save
local name_entry_save 0222D2,022300 s1 entries_to_save
# print_sprite_letter 022730 "PUSHS X; PUSHS B": B the colour, over the letter's sprite code, back at 022741 "PULLS B"
# for put_sprite
local print_sprite_letter 022732 s3 saved_colour
# put_sprite 022757 "PUSHS A": the sprite's flags byte (A), over the board's control write, back at 022765 "PULLS A;
# ORA #$80; STA ,U"
local put_sprite 022757 s1 saved_flags

# ---- src/scenes/scene_objects.c ----
# blank_absent_player 0253CC "PUSHS U,X", then (s5) 0253E2 / 0253EC "PUSHS A" (the blank's tile, over reading the
# player's place and the column count) and 025401 "PUSHS B" (the colour, over the step to the next row)
local blank_absent_player 0253E2,0253EC,025401 s5 saved_tile_or_colour
# done: src/scenes/scene_objects.c

# ---- src/scenes/stage_7_scenes.c ----
# stage_7_scene_set_up 024751 "PUSHS D": A the placement's record, B the placements left (02474F "LDB #$04"), over
# scene_put_placement, back at 02476E "PULLS D" (the next record)
local stage_7_scene_set_up 024751 s2 saved_record_and_count
# stage_7_scene_put_chain 024858 "PUSHS Y": the link just put (record 28), 02486B "LDX ,S" to give it its pair (the
# record 29 link), 024873 "PULLS X": the chain's last link
local stage_7_scene_put_chain 024858 s2 saved_link
# stage_7_end_board 0249E2 / stage_7_end_take_off 024A72 "PUSHS A": the rider's placement record, over
# scene_put_placement, back at 0249F4 / 024A88 "PULLS A"
local stage_7_end_board 0249E2 s1 saved_record
local stage_7_end_take_off 024A72 s1 saved_record
# done: src/scenes/stage_7_scenes.c

# ---- src/scenes/stage_8_scenes.c ----
# stage_8_start_run_players 024D26 "LDA #$04; PUSHS A", 024D3D "DEC ,S; BNE": the players' objects still to run
local stage_8_start_run_players 024D28,024D3D s1 players_to_run
# stage_8_end_run_family 0251D2 "LDA #$07; PUSHS A", 0251E2 "DEC ,S; BNE": the family's objects still to run
local stage_8_end_run_family 0251D4,0251E2 s1 actors_to_run
# done: src/scenes/stage_8_scenes.c

# ---- src/scenes/stage_ends.c ----
# stage_end_run_jumpers 024254 "LDA #$05; PUSHS A", 024269 "DEC ,S; BNE": the jumpers still to run
local stage_end_run_jumpers 024256,024269 s1 jumpers_to_run
# stage_2_end_players_look_around 0243C0 "PUSHS X; PULLS D": the object's address as a number, added to the frame
# count (the C: "((stack + (uint8_t)frame_count) & 0x40u) == 0u")
local stage_2_end_players_look_around 0243C0 s2 object_as_number
# done: src/scenes/stage_ends.c

# ---- src/scenes/stories.c ----
# story_stage_8_end 03EA0C / story_burns_robot_entrance 03FDEA "PUSHS X": the actor, over the players' loop (03E7F3),
# back at 03EA3C / 03FE19 "PULLS X"
local story_stage_8_end 03EA0C s2 saved_actor
local story_burns_robot_entrance 03FDEA s2 saved_actor
# done: src/scenes/stories.c

# ---- src/scenes/story_1.c ----
# story_1_family 0275AE "CLRA; PUSHS A", 0275BD "INC ,S", 0275B4 "LDA ,S" (its script): the family member being set up
local story_1_family 0275AF,0275BD s1 family_member
# story_1_runners 027659 "CLRA; PUSHS A", 027676 "INC ,S", 02765F "LDA ,S": the runner being set up
local story_1_runners 02765A,027676 s1 runner_number
# story_1_smithers_drop 0276D3 "PUSHS X": the object, over story_put_object (0276D8 "PULLS X")
local story_1_smithers_drop 0276D3 s2 saved_object
# done: src/scenes/story_1.c

# ---- src/scenes/story_actor.c ----
# story_actor_walk_to_partner 03E2D8 "PUSHS X; PULLS D": the actor's address as a number (the C: "target = stack +
# 0x60u", its partner object)
local story_actor_walk_to_partner 03E2D8 s2 actor_as_number
# story_actor_put_in 03E308 / 03E396 "PUSHS X" (the actor, over the players' loop and its child slots) and 03E37D
# "PUSHS Y" (the script, over 03E37F "LBSR $862C", back at 03E382 "PULLS Y; LEAY #$08,Y")
local story_actor_put_in 03E308,03E37D,03E396 s2 saved_actor_or_script
# story_actor_line_up_players 03E3D2, story_actor_random_player_faces 03E4A1, story_actor_set_players_animation
# 03E4C6, story_actor_place_players 03E566, story_actor_start_absent_players 03E5AC "PUSHS X": the actor, over the
# players' loop, back at 03E403 / 03E4C1 / 03E4E2 / 03E583 / 03E5C1 "PULLS X"
local story_actor_line_up_players 03E3D2 s2 saved_actor
local story_actor_random_player_faces 03E4A1 s2 saved_actor
local story_actor_set_players_animation 03E4C6 s2 saved_actor
local story_actor_place_players 03E566 s2 saved_actor
local story_actor_start_absent_players 03E5AC s2 saved_actor
# story_actor_remove_children 03E7A3 "PUSHS X,A": A the caller's count of child slots (the function calls itself for
# each child, 03E7B3 "BSR $67A3"), handed back at 03E7B8 "PULLS A,X,PC"
local story_actor_remove_children 03E7A3 s3 callers_count

# ---- src/stages/scroll.c ----
# cemetery_scroll_slow_down 0260D4 "PUSHS X": the row's first place, back at 0260DD "PULLS X; LEAX #$40,X"
local cemetery_scroll_slow_down 0260D4 s2 row_start
# camera_stop_at_x 026304 / camera_next_entry_at_x 026330 / camera_stop_at_x_left 02637B "(LDD <$DE;) ADDD <$AD;
# PUSHS A": the camera's next x, its low byte (its high byte from 026310 "ADCA <$AC"; 026313 "PULLS B")
local camera_stop_at_x 02630A s1 next_x_low
local camera_next_entry_at_x 026333 s1 next_x_low
local camera_stop_at_x_left 02637E s1 next_x_low
# camera_stop_at_y 0263CC / camera_stop_at_y_up 0263EE: the same for y ("ADDD <$B3", "ADCA <$B2")
local camera_stop_at_y 0263CC s1 next_y_low
local camera_stop_at_y_up 0263EE s1 next_y_low
# camera_scroll_layers 02643E "LDA ,U+; PUSHS A": the entry's ratio for the other layer's move, used for x (026442
# "LBSR $64E1") and again for y (02644E "PULLS A")
local camera_scroll_layers 026440 s1 saved_ratio
# done: src/stages/scroll.c

# ---- src/system/boot.c ----
# apply_settings 078A22 "LDA A,U; PUSHS A": the coinage's byte (coinages), its low digit the credits, back at 078A2E
# "PULLS A; LSRA x4" for the coins
local apply_settings 078A24 s1 coinage_byte
# ram_rom_check 078C22 "LDA #$20; PUSHS A" (and 078C6C #$30, 078CAB #$00, 078CEA #$10), 078C39 / 078C81 / 078CC0 /
# 078CFF "INC ,S": the bank whose bytes are summed next (078C26-078C31 "LEAU #$00,S; LDB #$03,U; STB <$0E; SETLN")
local ram_rom_check 078C24,078C39,078C6C,078C81,078CAB,078CC0,078CEA,078CFF s1 summed_bank
# set_check_colours 078D95 "LDA #$0F; PUSHS A" / 078DAA "LDA #$10; PUSHS A", 078D9E / 078DB3 "DEC ,S": the colours
# still to set
local set_check_colours 078D97,078D9E,078DAC,078DB3 s1 colours_to_set
# test_ram_words 078DD6 / 078DF6 "PUSHS Y; PULLS D": the count of words to test, Y to D
local test_ram_words 078DD6,078DF6 s2 words_to_test
# print_check_result 078E7F "PUSHS B": the result (0 good, else BAD's offset in the texts), read back at 078E89 "LDB
# ,S" and handed back at 078EAE "PULLS B,PC"
local print_check_result 078E7F s1 saved_result
# read_sound_rom_sum 078ED9 "PUSHS A": the sum's high byte (command F383), back at 078EE4 "PULLS A"
local read_sound_rom_sum 078ED9 s1 saved_sum_high
# done: src/system/boot.c

# ---- src/system/eeprom.c ----
# eeprom_verify 05EA6F "PUSHS B": the stored sum's high byte (cell 7E), back at 05EA75 "PULLS A; CMPD <$F0"
local eeprom_verify 05EA6F s1 saved_sum_high
# eeprom_read 05E915 "PUSHS U,A": A the cell's address, handed back at 05E930 "PULLS A,U,PC"
local eeprom_read 05E915 s3 saved_address
# done: src/system/eeprom.c

# ---- src/system/inputs.c ----
# coin_inserted 0791D8 "PUSHS A": the slot's coin bit, 0791E4 "ANDB ,S" (the coins let go), handed back at 0791F2 /
# 0791F5 "PULLS A,PC"
local coin_inserted 0791D8 s1 saved_coin_bit
# add_coin 07922E "PUSHS A; LDA #$02,U; SUBA ,S+": the coins a credit costs, taken from the slot's coins
local add_coin 07922E s1 credit_cost
# done: src/system/inputs.c

# ---- src/system/interrupts.c ----
# test_mode_run 0791A2 "PUSHS B,CC": the interrupted code's B, kept over the switch to bank 2F and handed to
# test_run_page
local test_mode_run 0791A2 s1 saved_b
# done: src/system/interrupts.c

# ---- src/system/jump_table.c (the routines behind its jumps) ----
# object_take_special_hit 07CFC2 "LDA #$5B,U; ANDA #$70; PUSHS A; ... ORA ,S+": the hitter's player bits (its
# shadow_player's 70), put into the object's points field
local object_take_special_hit 07CFC7 s1 hitter_player_bits

# ---- src/system/random.c ----
# next_random 079548 "LDD <$58; PUSHS D", 079556 "ADDD ,S++": the old random number, added to the new one
local next_random 07954B s2 saved_random
# done: src/system/random.c

# ---- src/test_mode/menu.c ----
# test_mark_line 05E5A7 "PUSHS D; INCB; PUSHS A": A the colour (s3), over the line's row, back at 05E5B7 "PULLS A" for
# test_colour_row
local test_mark_line 05E5AA s3 saved_colour

# ---- src/test_mode/options.c ----
# test_choose_setting_open 05E431 "PUSHS Y": the setting's place, over test_open_page (05E436 "PULLS Y")
local test_choose_setting_open 05E431 s2 saved_setting
# test_premium_start_page 05E495 "PUSHS B" (the line chosen, over test_read_setting, 05E49A "PULLS B") and 05E4C0
# "PUSHS B" (the next page, 14, over test_open_coinage_page, 05E4C7 "PULLS B; STB $5908")
local test_premium_start_page 05E495,05E4C0 s1 choice_or_next_page

# ---- src/test_mode/rom_check.c ----
# test_sum_tile_rom 05EC50 / 05EC5C "PUSHS A": the board's output byte last written (A), over the interrupt control
# writes, handed back (05EC58 / 05EC6A "PULLS A")
local test_sum_tile_rom 05EC50,05EC5C s1 saved_output
# test_print_rom_ok / test_print_rom_bad 05ED45 "PUSHS X; PULLS D": the ROM's sum, X to D for print_hex_word
local test_print_rom_ok 05ED45 s2 printed_sum
local test_print_rom_bad 05ED45 s2 printed_sum
# done: src/test_mode/rom_check.c

# ---- src/test_mode/sound_test.c ----
# test_sound_test_next 05E24B "PUSHS A; INCA; CMPA ,S+": the list's last number, compared with the next one
local test_sound_test_next 05E24B s1 saved_last_number
# done: src/test_mode/sound_test.c

# ---- src/video/palette.c ----
# palette_request 07BAC7 "PUSHS X", 07BACC "PUSHS A" (s3): the request's kind (A), over its routine's address (07BAD2
# "LDX A,X"), back at 07BAD4 "PULLS A"
local palette_request 07BACC s3 saved_request_high
# run_palette_jobs 07BC97 "PUSHS U": the palette job, over its routine (07BC9D "JSR [A,X]"), back at 07BC9F "PULLS U"
local run_palette_jobs 07BC97 s2 saved_job
# palette_job_effect 07BD01 "PUSHS B,CC" (B over the switch to bank 2E) and 07BD15 / 07BD3C "PUSHS A" (A over the
# board's control writes): a register kept over a write
local palette_job_effect 07BD01,07BD15,07BD3C s1 kept_byte
# palette_effect_forward / palette_effect_backward 07BD97 "PUSHS A": A (the colours left, or the step's mark) over the
# board's control write, handed back at 07BDA5 "PULLS A"
local palette_effect_forward 07BD97 s1 saved_colours_left
local palette_effect_backward 07BD97 s1 saved_step_mark
# palette_job_background_colour 07BDE6 / 07BDFF "PUSHS A": A over the board's control writes; at 07BDFF the background
# colour's high byte (07BDF6 "LDD #$01,U; STD $0C00")
local palette_job_background_colour 07BDE6,07BDFF s1 saved_colour_high
# load_palettes 07BF51 "PUSHS A" (the palettes to load, over the control write, 07BF5F "PULLS A") and 07BF83 "PUSHS
# A" (the last colour's high byte, over the control write)
local load_palettes 07BF51,07BF83 s1 count_then_colour_high

# ---- src/video/text.c ----
# print_game_text 07931F "ANDB #$7F; PUSHS B,CC" (and 079348): the text's entry in game_texts (number x 2), kept over
# the switch to bank 12, read at 079331 "LDU B,X"
local print_game_text 079321,079348 s2 text_entry_offset
# print_hex_byte 07945C "PUSHS U,A" (s3): the byte printed, its low digit read back at 07946F "PULLS A; ANDA #$0F"
local print_hex_byte 07945C s3 saved_printed_byte
# print_hex_word 07947D "PUSHS B": the word's low byte, printed after the high one (079484 "PULLS A")
local print_hex_word 07947D s1 kept_low_byte
# done: src/video/text.c
# ---- objects ----
# objects: the stack slots and temporaries of src/objects, src/enemies, src/players, src/bosses, src/bonus
# (lines 'local FUNCTION PLACE sN NAME' / 'local FUNCTION PLACE tN NAME', PLACE the store from the work list)

# ---- src/bonus/balloon.c ----
# 0200D7 "PUSHS U,X", 0200D9 "LBSR $68AB" (bonus_1_press_sound), 0200DC "PULLS X,U": X, the shown player's balloon,
# kept around the call (C "stack_4 = player_balloon; ... player_balloon = stack_4;")
local bonus_1_intro_show_how 0200D7 s4 saved_player_balloon
# 02022C "PUSHS Y" ... "PULLS Y": the player's wait place (scene_palette_effect + player, the wait before its flight),
# kept while the too-small player's blower and middle part get their animations
local bonus_1_results 02022C s3 saved_wait_place
# 0202EE "PUSHS U", 0202F0 "LBSR $6510" (bonus_1_flight), 0202F3 "PULLS U": the player's wait place around its flight
local bonus_1_fly_away 0202EE s3 saved_wait_place
# 020412 "CLRA", 020413 "LDB #$29,X; NEGB", 020417 "PUSHS D", 02041E "ADDD ,S": 00 and minus the width zoom's whole
# part, added to minus the height's into the balloon's size (C "size = b + ((stack_10001 << 8) | stack_10002)")
local bonus_1_blow 020417 s10001 negated_width_high
local bonus_1_blow 020417 s10002 negated_width
# 020431 "LMUL", 020432 "PUSHS Y; PULLS D", 020438 "STA #$1F,X" (box width); 02044C "LMUL", 02044D "PUSHS Y; PULLS D",
# 020453 "STA #$22,X" (box dx): 4000 / zoom times a factor, whose high byte is the box's size
local bonus_1_blow 020432,02044D s4 scaled_box_size
# 020496 "LDY #$2D,X; PUSHS Y" (the growth), 0204A1 "PULLS Y; LMUL", 0204A4 "PUSHS X; PULLS D": the growth, then the
# growth scaled by the width zoom squared (the change to the width)
local bonus_1_stretch_width 020499,0204A4 s4 scaled_growth
# 0204D4 "LDY #$2D,X; PUSHS Y", 0204E2 "PUSHS X; PULLS D": the same for the height
local bonus_1_stretch_height 0204D7,0204E2 s4 scaled_growth
# 020795 "PUSHS X", 020797 "TFR Y,X", 02079E "LBSR $67C7" (bonus_put_placement), 0207A1 "PULLS X": the player's object
# kept while an absent player's part is placed (its high byte here; the low byte shares the player-count slot)
local bonus_1_put_players 020795 s2 saved_player_object_high
# 02082C "LDA <$58; ANDA #$03; CLRB; PUSHS D" (A at ,S: a random player number), 020837 "LDA ,S; ASLA; LDU A,U"
# (bonus_1_player_records), 02084C "ADDA ,S" (the rate), 020861 "LDA ,S; INCA; ANDA #$03; STA ,S": the player whose
# record is looked at, going round from a random one
local bonus_1_set_absent_rates 020832,020866 s2 record_index
# 020A00 "LDA #$04; PUSHS A", 020A2A "DEC ,S; BNE": the result boxes still to check (4 down)
local bonus_reward_winners 020A02,020A2A s6 boxes_to_check
# done: src/bonus/balloon.c

# ---- src/bonus/results.c ----
# 0211B0 "LDA <$F1; ADDA #$0A" (the portrait's kind: 0A + the player), 0211B5 "LDB <$F0", 0211B8 "PUSHS D; PULLS Y",
# 0211C1 "STY #$04,U" (kind and animation)
local bonus_show_player_portraits 0211B8 s10002 portrait_kind
# 0212A9 "PUSHS U,Y,X,D" ... 0212F5 "PULLS D,X,Y,U": X, the box's x, given back to the caller
local bonus_results_draw_box 0212A9 s6 saved_box_x
# 0212B3 "PUSHS A" (the colour, B2 or F2), 0212C6 "PULLS A"; 0212D2 "PUSHS B" (the rows, 7 or 4), 0212D4 "LDB ,S",
# 0212EA "LDB ,S+": the slot holds the colour, then the row count
local bonus_results_draw_box 0212B3,0212D2 s9 colour_or_rows
# 0212BF "ADDD #$22C0", 0212C2 "PUSHS D; PULLS X": the box's first tile (22C0 + (x - scroll) / 8)
local bonus_results_draw_box 0212C2 s1000A first_tile_high
local bonus_results_draw_box 0212C2 s1000B first_tile_low
# 0212B5 "PUSHS X; PULLS D" (the box's x, into D to take the scroll off), 0212D9 "PUSHS X", 0212E4 "PULLS X; LEAX
# #$-2000,X" (the first tile, kept for the colours): the box's start, as x and then as tile
local bonus_results_draw_box 0212B5,0212D9 sB box_start
# done: src/bonus/results.c

# ---- src/bonus/wake_up.c ----
# 020A6C "LDD #$00A8; SUBD $4A4C", 020A73 "PUSHS D; PULLS X", 020A7A "LBSR $6A90" (bonus_2_move_player): how far the
# first player walks to x A8 (low byte; the high byte shares another slot)
local bonus_2_intro_set_up 020A73 s10002 walk_distance_low
# 020E76 "LDX #$7D7D; LDD B,X" (bonus_2_player_x), 020E7B "PUSHS D; PULLS X": the player's x (low byte)
local bonus_2_portrait_x 020E7B s10002 player_x_low
# done: src/bonus/wake_up.c

# ---- src/bosses/dreamland_boss.c ----
# 0342A1 "LDD #$11,U; SUBD #$11,X", 0342A7 "ABSD": the player's y minus the boss's (depth), before its absolute value
local dreamland_boss_chase_leg 0342A7 t1 depth_difference
# done: src/bosses/dreamland_boss.c

# ---- src/bosses/dreamland_boss_objects.c ----
# 034EC2 "LDD #$0C,U; SUBD #$0C,X", 034EC8 "ABSD": the target's x minus the ball's, before its absolute value
local boss_ball_fly_out 034EC8 t1 x_difference
# done: src/bosses/dreamland_boss_objects.c

# ---- src/enemies/cloud_devil.c ----
# 03109F "LDD #$0C,X; CMPD #$0C,U; BCS" (the player to the right), 0310DD "LDB #$3A,X", 0310E0 "ADDD #$2E,X": the
# heading plus the sweep rate (sweeping up to 4)
local cloud_devil_steer 0310E0 t7 right_heading_up
# 0310C2 "LDB #$3A,X", 0310C5 "NEGD": minus the sweep rate (the player to the left, sweeping back)
local cloud_devil_steer 0310C5 t2 left_minus_rate
# 0310C6 "ADDD #$2E,X", 0310CE "CMPA #$04": the heading minus the rate (the player to the left, down to 4)
local cloud_devil_steer 0310C6 t7 left_heading_down
# 0310AD "LDB #$3A,X", 0310B0 "ADDD #$2E,X", 0310B8 "CMPA #$0C": the heading plus the rate (the player to the left, up
# to C)
local cloud_devil_steer 0310B0 t7 left_heading_up
# 03110B "LDD #$11,X; SUBD #$11,U; STA <$F0", 031114 "ABSD": the devil's y minus the player's, before its absolute value
local cloud_devil_steer 031114 t1 depth_difference
# 031128 "LDD #$0C,X; CMPD #$0060" / "CMPD #$0160": the x checked against the screen's sides
local cloud_devil_steer 031128 t5 checked_x
# 03113D "SUBD #$0C,X": the x again, taken from the edge to make the speed back in
local cloud_devil_steer 03113D t5 old_x
# 031146 "LDD #$11,X; CMPD #$0090" / "CMPD #$0100": the y checked against the floor's band
local cloud_devil_steer 031146 t5 checked_y
# 03115B "SUBD #$11,X": the y again, taken from the band's edge
local cloud_devil_steer 03115B t5 old_y
# done: src/enemies/cloud_devil.c

# ---- src/enemies/enemy_moves.c ----
# 07DA32 "CLRW #$0F,X", 07DA35 "LDD $1886" (enemy_walk_speed), 07DA39 "STD #$14,X": the walk speed, as depth speed
local enemy_line_up_in_depth 07DA35 t3 depth_walk_speed
# done: src/enemies/enemy_moves.c

# ---- src/enemies/enemy_states.c ----
# 07D5AC "LDD #$5C,U; SUBD #$5C,X", 07D5B2 "ABSD; CMPD #$0020": the target's floor minus the enemy's
local enemy_think 07D5B2 t1 floor_gap
# 07D617 "SUBA B,U; BCS": the roll before this choice's chance comes off it (the state's choice of an action)
local enemy_think 07D617 t3 roll_before
# 07D61B "DECB; BNE": the choice before it counts down
local enemy_think 07D61B t1 choice_before
# done: src/enemies/enemy_states.c

# ---- src/enemies/enemy_targets.c ----
# 07D31A "LDD #$0C,X; SUBD #$0C,U; BPL; NEGD", 07D323 "PUSHS D", 07D32E "ADDD ,S++": the x distance to the player,
# added to the y distance
local enemy_target_nearest_player 07D323 s3 x_distance
# done: src/enemies/enemy_targets.c

# ---- src/enemies/flying_saxophone.c ----
# the same steering as cloud_devil_steer: 03353D "ADDD #$2E,X" (the player to the right, sweeping up to 4)
local flying_saxophone_steer 03353D t7 right_heading_up
# 033522 "NEGD": minus the sweep rate (the player to the left)
local flying_saxophone_steer 033522 t2 left_minus_rate
# 033523 "ADDD #$2E,X": the heading minus the rate (the player to the left, down to 4)
local flying_saxophone_steer 033523 t7 left_heading_down
# 03350D "ADDD #$2E,X": the heading plus the rate (the player to the left, up to C)
local flying_saxophone_steer 03350D t7 left_heading_up
# 033568 "LDD #$11,X; SUBD #$11,U; STA <$F0", 033571 "ABSD": the flyer's y minus the player's
local flying_saxophone_steer 033571 t1 depth_difference
# 033585 "LDD #$0C,X; CMPD #$0040": the x checked against the screen's sides
local flying_saxophone_steer 033585 t5 checked_x
# 03359A "SUBD #$0C,X": the x again, taken from the edge
local flying_saxophone_steer 03359A t5 old_x
# 0335A3 "LDD #$11,X": the y checked against the floor's band
local flying_saxophone_steer 0335A3 t5 checked_y
# 0335B8 "SUBD #$11,X": the y again, taken from the band's edge
local flying_saxophone_steer 0335B8 t5 old_y
# done: src/enemies/flying_saxophone.c

# ---- src/objects/bear.c ----
# 03CF23 "LDD #$19,X" (z speed), 03CF30 "PUSHS D", 03CF35 "LBSR $8680" (vector_queue_sound), 03CF38 "PULLS D";
# 03CF4D "ASRDI #$02" (the bounce speed), 03CF4F "PUSHS D", 03CF5A "PULLS D": the z speed kept (low byte; the high byte
# shares another slot)
local bear_boulder 03CF30,03CF4F s10002 saved_z_speed_low
# 03C9CE "PUSHS U; PULLS D" (the floor cell's place, high byte), 03C9D6 "PUSHS X" ... 03C9E1 "PULLS X" (the bear kept
# around the fill): the slot holds the place's high byte, then the bear's
local bear_break_out 03C9CE,03C9D6 s2 place_or_object_high
# 03C9D2 "ANDB $00C0" (the row's start), 03C9D8 "PUSHS D; PULLS X", 03C9E0 "BSET A,X,U": the floor row cleared
local bear_break_out 03C9D8 s3 floor_row_low
local bear_break_out 03C9D8 s4 floor_row_high
# 03CA86 "ANDA #$03; LDB #$C0; MUL; ADDD #$4A40", 03CA8E "PUSHS D; PULLS U": a random player's object (low byte)
local bear_choose_target 03CA8E s10002 chosen_player_low
# 03CB1E "LDU #$7E63; LDB <$57; LDB B,U" (bear_attack_delays_by_players), 03CB26 "LDA #$11", 03CB28 "PUSHS D;
# PULLS Y", 03CB2E "LBSR $604C" (stage_boss_set_state: state 11 and this wait)
local bear_walk 03CB28 s10002 attack_wait
# done: src/objects/bear.c

# ---- src/objects/burns_robot.c ----
# 03B2B1 "LDB #$C0" / 03B2B5 "LDB #$40" (the side to aim at), 03B2B7 "PUSHS X,B", 03B2C4 "NEG ,S" (the other side when
# the floor there is a wall), 03B2C6 "PULLS B,X", 03B2C8 "LBSR $8671" (vector_direction_to_offset)
local burns_robot_aim_at_target 03B2B7,03B2C4 s3 aim_offset
# done: src/objects/burns_robot.c

# ---- src/objects/floor_scenery.c ----
# 02C859 "LDD #$38,X; ORB <$F0", 02C85F "PUSHS D; PULLS U", 02C863 "STU #$2A,X": the floor row with the column two to
# the left, the scenery's floor start
local platform_scenery_start 02C85F s10001 floor_start_high
local platform_scenery_start 02C85F s10002 floor_start_low
# 02CA26 "LDD #$38,X; ORB <$F0", 02CA2C "PUSHS D; PULLS U", 02CA30 "STU #$2A,X": the same
local charging_scenery_start 02CA2C s10001 floor_start_high
local charging_scenery_start 02CA2C s10002 floor_start_low
# done: src/objects/floor_scenery.c

# ---- src/objects/football_player.c ----
# 03C465 "LDB #$12", 03C46D "LDA #$0B", 03C46F "PUSHS D; PULLS Y", 03C475 "LBSR $604C" (stage_boss_set_state: state
# 0B, this wait)
local football_player_start_charge 03C46F s10002 wait_time
# 03C5D9 "LDB #$18", 03C5E1 "LDA #$09", 03C5E3 "PUSHS D; PULLS Y", 03C5E9 "LBSR $604C" (state 09, this wait)
local football_player_run 03C5E3 s10002 wait_time
# done: src/objects/football_player.c

# ---- src/objects/krusty_balloon.c ----
# 026A18 "PUSHS U,X", 026A1E "LBSR $6969" (krusty_balloon_set_animation), 026A23 "LBSR $6978" (set_hit_box), 026A26
# "PULLS X,U": U the shot and X the balloon, kept while the shot gets its look
local krusty_balloon_throw 026A18 s3 saved_shot
local krusty_balloon_throw 026A18 s5 saved_balloon
# done: src/objects/krusty_balloon.c

# ---- src/objects/obstacles.c ----
# 02CC64 "PUSHS U; PULLS D" (the floor cell's place), 02CC6B "ANDB #$C0; STD #$38,X": the row's high byte
local obstacle_raise_floor 02CC64 s2 floor_row_high
# done: src/objects/obstacles.c

# ---- src/objects/shaking_scenery.c ----
# 02D234 "PUSHS U; PULLS D", 02D23B "ANDB #$C0; STD #$38,X": the floor row's high byte
local scenery_block_floor 02D234 s2 floor_row_high
# done: src/objects/shaking_scenery.c

# ---- src/objects/stage_8_boss.c ----
# 03A0E7 "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40", 03A0F2 "PUSHS D; PULLS U": the random player to start
# looking from (low byte)
local stage_8_boss_pick_player 03A0F2 s10002 start_player_low
# done: src/objects/stage_8_boss.c

# ---- src/objects/stage_bosses.c ----
# 03C17F "LDA <$58; ANDA #$03; LDB #$C0; MUL; ADDD #$4A40", 03C18A "PUSHS D; PULLS U": the same
local stage_boss_pick_random_player 03C18A s10002 start_player_low
# done: src/objects/stage_bosses.c

# ---- src/objects/wrestler.c ----
# 0217EF "LDA #$04; CLRB", 0217F2 "PUSHS D" (A at ,S), 021808 "DEC ,S; BNE": the player slots still to check
local wrestler_surrounded 0217F2,021808 s2 slots_left
# done: src/objects/wrestler.c

# ---- src/players/effects.c ----
# 039B3F "LDD #$17,U" (z's low byte and fraction), 039B42 "ADDD #$19,U" (plus the z speed)
local player_next_height_against_floor 039B42 t6 z_low_and_fraction
# 039B6A "LEAX #$0090,Y" (an X nothing reads), 039B6E "CMPY #$0C,U": the player's x read again for the second compare
local player_face_heavy_object 039B6E t5 rechecked_player_x
# done: src/players/effects.c

# ---- src/players/gauges.c ----
# 0409CF "PUSHS U" ... 0409F0 "PULLS U,PC": the caller's U, the tiles it prints on (gauge_draw_player hands its
# lives' `tiles`), kept (its high byte; the low byte shares another slot)
local gauges_byte_to_bcd 0409CF s2 saved_tiles_high
# 0409D4 "LDA #$08; PUSHS D" (A at ,S), 0409E9 "DEC ,S; BNE": the bits still to add
local gauges_byte_to_bcd 0409D6,0409E9 s4 bit_count
# 0409FD "PUSHS X" ... 040A0B "PULLS X" (the gauge player kept around the division, its high byte); 040A4A, 040A69,
# 040A82 "PUSHS A" (the gauge's steps kept while a tile is drawn): the slot holds both
local gauge_draw_health 0409FD,040A4A,040A69,040A82 s2 player_high_or_steps
# 0409FC "MUL" (1F x health), 0409FF "PUSHS D; PULLS X", 040A05 "DIV X,B" (by 28), 040A06 "PUSHS X; PULLS D": the
# division's dividend, then its quotient (the step)
local gauge_draw_health 0409FF,040A06 s3 division_low
local gauge_draw_health 0409FF s4 division_high
# 040AAE "LDY #$730E; LDA #$01,X; ASLA; INCA; LDA A,Y" (gauge_player_columns: the colour byte of the player's
# entry), 040AB8 "STA #$01,S", 040ACF "ORA #$01,S" (into each digit's attribute)
local gauge_print_count 040AB8 sF player_colour
# 040B44 "LDA $4A1C" (continue_seconds), 040B4A "LSRA" x4, 040B4E "PUSHS A", 040B59 "PULLS A; TSTA": the tens digit
local continue_draw_count 040B4E s2 tens_digit
# 040B8A "LDD ,U++" (the picture's width and rows), 040B8C "PUSHS D" (B at 3,S), 040BC4 "DEC #$03,S; BNE": the rows
# still to draw
local gauges_put_picture 040B8C,040BC4 s2 rows_left
# 040B8C "PUSHS D" (A at 2,S), 040B92 "LDA #$02,S; STA #$01,S", 040BBF "SUBA #$02,S": the picture's width in tiles
local gauges_put_picture 040B8C s3 columns_wide
# 040B95 "STA #$01,S" (the width), 040BA8 / 040BB8 "DEC #$01,S; BNE": the columns still to draw in the row
local gauges_put_picture 040B95,040BA8,040BB8 s4 columns_left
# 040B8E "LDA ,U+" (the picture's colour), 040B90 "PUSHS D" (A at ,S), 040B9D "LDB #$00,S; STB #$-2000,X"
local gauges_put_picture 040B90 s5 tile_colour
# 040BA8 "DEC #$01,S; BNE": the columns left before this tile, while the picture's tiles are copied
local gauges_put_picture 040BA8 t3 copy_columns_before
# 040BD0 "LEAS #$-10,S", 040BD3 "STA #$00,S" (the player, bit 7 for blank), 040C0C "LDB #$00,S; BPL"
local gauge_draw_picture 040BD3 s16 quarter_and_blank
# 040BDB "STB #$07,S", 040BF0 "LDB #$07,S; ASLB; LDX B,X" (gauge_pictures)
local gauge_draw_picture 040BDB sF picture_number
# 040BDE "LDX #$730E; LDA #$06,S; ASLA; LDD A,X" (gauge_player_columns), 040BE7 "STA #$05,S" (the column),
# 040BF8 "LDB #$05,S; LEAU B,U"
local gauge_draw_picture 040BE7 s11 quarter_column
# 040BEA "STB #$03,S" (the colour), 040C09 "ORA #$03,S"
local gauge_draw_picture 040BEA s13 quarter_colour
# 040BFD "LDA ,X+; STA #$01,S" (the part's width), 040C15 "LDA #$01,S; STA #$04,S", 040C2D "SUBA #$01,S"
local gauge_draw_picture 040BFF s15 part_width
# 040C02 "LDA ,X+; STA #$02,S" (the part's rows), 040C32 "DEC #$02,S; BNE"
local gauge_draw_picture 040C04,040C32 s14 rows_left
# 040C18 "STA #$04,S" (the width), 040C26 "DEC #$04,S; BNE": the columns still to draw in the row
local gauge_draw_picture 040C18,040C26 s12 columns_left
# 040C07 "LDA ,X+; ORA #$03,S" (the part's colour with the player's), 040C11 "CLRA" (blank), 040C12 "STA #$08,S",
# 040C1B "LDB #$08,S; STB #$-2000,U"
local gauge_draw_picture 040C12 sE draw_colour
# done: src/players/gauges.c

# ---- src/players/motion.c ----
# 0397A7 "LDD #$12,U" (y's low byte and fraction), 0397AA "ADDD #$14,U" (plus the y speed)
local player_check_motion 0397AA t6 y_low_and_fraction
# 0397C3 "LDD #$0D,U" (x's low byte and fraction), 0397C6 "ADDD #$0F,U" (plus the x speed)
local player_check_motion 0397C6 t6 x_low_and_fraction
# 039865 "LDX $1848" (running_player_values), 039869 "STB #$02,X" (kept_life)
local player_check_motion 039865 t3 running_values
local player_keep_life 039865 t3 running_values
# 0398AB "LDX #$0C,U": the player's x
local player_request_scroll 0398AB t5 player_x
# 03992E "LDX #$11,U": the player's y
local player_request_scroll 03992E t5 player_y
# 039ACE "SEX" (the floor's height), 039AD4 "PUSHS D; PULLS X", 039AE9 "CMPD <$F8": the floor's z (high byte)
local player_check_screen_edges 039AD4 s2 floor_z_high
# done: src/players/motion.c

# ---- src/players/players.c ----
# 03800E "LDA <$40; LDB <$42" (player_controls: player_input.now and .pressed), 038014 "PUSHS D; PULLS Y" (the same at
# 03802E, 038048, 038062 for the other three): the pressed buttons (low byte)
local player_run_all 038014,03802E,038048,038062 s10002 pressed_buttons
# 03807A "TST $184B" (players_stop_request), 038080 "LDA $184C; CMPA #$04" (players_idle_count)
local player_run_all 038080 t1 idle_count
# 0380FE "PUSHS X,D" (B the player number, X the player's values), 03812B "PULLS D,X; ASLB" x4, 038131 "ORB #$5B,U"
# (C "stack_10004 = player_number; ... shadow_player = (stack_10004 << 4) | ...")
local player_run 0380FE s10004 saved_player_number
# 038108 "PUSHS U", 03810A "TFR U,X; LEAX #$1C,X" (clearing the object's fields), then "PULLS U"
local player_run 038108 s6 saved_player
# 0381EF "LDY #$11,U; LEAY #$08,Y; STY #$11,U": the y tried for the entry floor, a row nearer each time
local player_run 0381EF t5 tried_y
# 0381F8 "DEC <$F1; BNE" (entry_tries_left): the tries before this one (the second search, 9 rows)
local player_run 0381F8 t2 second_tries_before
# 038159 "LDB #$04,U; ASLB" x5, 038161 "SEX; ADDD #$00D0": the kind times 20 (signed), the drop's x offset
local player_run 038161 t1 drop_offset
# 03818E "DEC <$F1; BNE": the tries before this one (the drop's search, 8 columns)
local player_run 03818E t2 drop_tries_before
# 03819A "LDD #$0C,U": the x being scanned for a floor
local player_run 03819A t5 scan_x
# 03819D "ADDD #$0010; STD #$0C,U": the next x to scan
local player_run 03819D t2 next_scan_x
# 07B75C "LDA [,X]" (the player's pressed buttons), 07B75E "ANDA #$B0; LBEQ": the start buttons pressed
local player_join 07B75E t2 start_buttons
# 07B763 "LDD <$37; SUBD #$0001; STD <$37" (credits)
local player_join 07B763 t4 credits_before
# done: src/players/players.c

# ---- src/players/reactions.c ----
# 039305 "LDX $1848" (running_player_values), 03930B "STA #$03,X" (entry_status)
local player_take_touches 039305 t3 running_values
# 0393C3 "LDA #$1E,U" (hit: the food taken), 0393C6 "PUSHS A", 0393F5 "PULLS A; SUBA #$F9; LDX #$7EAD; ADDB A,X"
# (pickup_vitality)
local player_eat_food 0393C6 s3 food_kind
# 0395B5 "LDY $1848" (running_player_values), 0395B9 "LDA #$06,Y" (grab_hints)
local player_get_grabbed 0395B5 t3 running_values
# 039694 "PUSHS U,X", 039698 "LBSR $7A93" (player_check_screen_edges on the partner), 03969B "PULLS X,U": X the partner
local player_break_team 039694 s4 saved_partner
# done: src/players/reactions.c

# ---- src/players/second_sprite.c ----
# 03EB3E "PUSHS Y" (the throw's x speed), 03EB40 "LDA ,S; NEGA; STA ,S" (only the high byte negated, facing left),
# 03EB45 "PULLS Y"
local player_second_sprite_throw 03EB3E s2 x_speed_low
local player_second_sprite_throw 03EB3E,03EB43 s3 x_speed_high
# 03EBBB "LDX #$6C,U; CMPX #$0044": the second sprite's x (field 0C of the object after the player's)
local player_second_sprite_fall 03EBBB t5 second_sprite_x
# done: src/players/second_sprite.c

# ---- src/players/states.c ----
# 0391EE "LDY #$7E3D" (team_move_animation_offsets), 0391FB "LDA A,Y; BMI" (by the move and the character): the
# table's entry, negative for none (the same shared end in each team state)
local player_team_move 0391FB t2 animation_entry
local player_walk 0391FB t2 animation_entry
local player_team_jump 0391FB t2 animation_entry
local player_team_start_fall 0391FB t2 animation_entry
local player_team_fall 0391FB t2 animation_entry
local player_attack_end 0391FB t2 animation_entry
local player_team_ready 0391FB t2 animation_entry
local player_team_together 0391FB t2 animation_entry
# 038365 "ANDA #$EF; ORA <$F0" (the joystick and the attack bit), 03836A "ANDA #$1F; LBEQ"
local player_team_move 03836A t2 active_controls
# 0385EA "LDA #$40,U" (the weapon held), 0385ED "LDB #$80", 0385EF "PUSHS D; PULLS Y", 0385F5 "LBSR $7C2F"
# (player_start_effect): the weapon's effect (high byte)
local player_stand 0385EF s2 weapon_effect_kind
# 038853 "LDB #$2E,U", 038856 "ANDB #$03; BEQ" (after player_set_in_air): left or right for the jump
local player_stand 038856 t2 jump_joystick_x
# 03872E "LDB #$2E,U", 038731 "ANDB #$03; BEQ; CLR #$09,U; BITB #$01": left or right to face
local player_stand 038731 t2 facing_joystick_x
# 0383C9 "LDA #$2E,U", 0383CC "ANDA #$0F; LBEQ": the joystick's four ways, to walk
local player_stand 0383CC t2 walk_joystick
# 038536 "LDD #$19,U; SUBD #$0040", 03853C "STD #$19,U; BMI": the z speed slowed by gravity
local player_team_jump 03853C t3 slowed_z_speed
# 038657 "LDD #$19,U; SUBD #$0040", 03865D "STD #$19,U; BMI"
local player_jump 03865D t3 slowed_z_speed
# 038CC6 "LDA #$09,U", 038CC9 "ANDA #$40; BEQ": the facing bit of the attributes
local player_attack_end 038CC9 t2 facing_left_bit
# 038F41 "LDX #$0C,U; CMPX #$0140; ... CMPX #$0070": the player's x
local player_knocked_up 038F41 t5 player_x
# 038FD9 "LDD [$1848]; CMPD #$0001": running_player_values, the place of the player's lives
local player_die 038FD9 t3 lives_address
# 038FF0 "LDX $1848; CLR #$06,X" (grab_hints)
local player_die 038FF0 t3 running_values
# 039054 "LDX $1848; CLR #$03,X" (entry_status)
local player_lose_life 039054 t3 running_values
# 03905E "DECW [$1848]": the lives
local player_lose_life 03905E t3 lives_address
# 03908B "LDX $1848; CLR #$03,X" (entry_status, before the shared end at 03904E)
local player_game_over_end 03908B t3 game_over_values
local player_game_over_end 039054 t3 running_values
local player_game_over_end 03905E t3 lives_address
# 039288 "TST $184B; LBNE" (players_stop_request, carrying a teammate)
local player_set_animation 039288 t1 team_stop_request
# 0392A1 "TST $184B; BEQ" (players_stop_request, carrying an object)
local player_set_animation 0392A1 t1 carry_stop_request
# 0392A7 "LDY #$3F,U; BEQ", 0392AC "TST #$3F,U": the held word's high byte (an object, not a weapon)
local player_set_animation 0392AC t3 dropped_high
# 0392C4 "LDA #$09,U", 0392C7 "ANDA #$40; BEQ; NEGB"
local player_set_animation 0392C7 t2 facing_left_bit
# done: src/players/states.c

# ======== the objects' plain stack slots ========
# objects: the stack slots the C still calls plain `stack` (one line per slot, all its stores)

# ---- src/bonus/balloon.c ----
# 0200D7 "PUSHS U,X", 0200D9 "LBSR $68AB" (bonus_1_press_sound), 0200DC "PULLS X,U": U, the shown player's bonus record
# (C "stack = bonus_player; ... record = stack;")
local bonus_1_intro_show_how 0200D7 s2 saved_bonus_player
# 0201B9 "LDA #$04; PUSHS A", 0201E3 "DEC ,S; BNE": the balloons still to set (4 down)
local bonus_1_blow_until_done 0201BB,0201E3 s1 balloon_count
# 020215 "CLRA; PUSHS A", 020255 "INC ,S", 020257 "LDA ,S; CMPA #$04": the player being handled (0 up to 4)
local bonus_1_results 020216,020255 s1 player_counter
# 02026A "CLRA; PUSHS A", 0202C1 "INC ,S; LDA ,S; CMPA #$04"
local bonus_1_top_up_balloons 02026B,0202C1 s1 player_counter
# 0202E7 "CLRA; PUSHS A", 020300 "INC ,S; LDA ,S; CMPA #$04"
local bonus_1_fly_away 0202E8,020300 s1 player_counter
# 020316 "LBSR $69F8" (bonus_reward_winners: D the caller's state offset and B), 02031C "PUSHS D", 02031E "STD <$05"
# (step_subphase, step_countdown), 020321 "PULLS D"
local bonus_1_end 02031C s2 subphase_and_countdown
# 020425 "PUSHS X" ... 020436 "PULLS X"; 020440 "PUSHS X" ... 020451 "PULLS X": the balloon kept around the divisions
local bonus_1_blow 020425,020440 s2 saved_balloon
# 020494 "PUSHS X" ... 0204A8 "PULLS X": the balloon kept around the multiplications
local bonus_1_stretch_width 020494 s2 saved_balloon
# 0204D2 "PUSHS X" ... "PULLS X"
local bonus_1_stretch_height 0204D2 s2 saved_balloon
# 020600 "LDU #$33,X" (the flyer), 020603 "PUSHS X; TFR U,X", 020607 "LBSR $85B1" (vector_apply_gravity on the flyer),
# 02060A "PULLS X": the balloon kept
local bonus_1_fall 020603 s2 saved_balloon
# 020630 "LDA #$04; PUSHS A", 020640 "DEC ,S; BNE": the balloons still to check
local bonus_1_any_balloon_full 020632,020640 s1 balloon_count
# 02068B "LDA #$04; PUSHS A", 0206C2 "DEC ,S; BNE": the timer digits still to set up
local unused_bonus_draw_timer_digits 02068D,0206C2 s3 digit_count
# 020731 "CLRA", 020732 "PUSHS A" (the player number, first loop); 020795 "PUSHS X" (the player's object, its low byte
# here): the slot holds the player number, then the object's low byte
local bonus_1_put_players 020732,020795 s1 player_or_object_low
# 020806 "CLRA; PUSHS A", 02081F "INC ,S; LDA ,S; CMPA #$04"
local bonus_1_take_presses 020807,02081F s1 player_counter
# 020831 "CLRB", 020832 "PUSHS D" (B at 1,S), 020868 "INC #$01,S; LDA #$01,S; CMPA #$04", 02084C "ADDA ,S" (the rate)
local bonus_1_set_absent_rates 020832,020868 s1 player_counter
# 020877 "CLRA; PUSHS A", 0208A1 "INC ,S; LDA ,S; CMPA #$04"
local bonus_1_absent_presses 020878,0208A1 s1 player_counter
# 0208B5 "CLRA; PUSHS A", 0208C7 "INC ,S; LDB ,S; CMPB #$04"
local bonus_1_press_sound 0208B6,0208C7 s1 player_counter
# 0209DC "PUSHS A" (the bonus: A + 1A its title's placement), 0209E7 "PULLS A", 0209E9 "LDX #$7BC4; ASLA; LDD A,X"
# (bonus_intro_sounds)
local bonus_title_show 0209DC s1 bonus_index
# 0209F8 "PUSHS U,X,A" ... 020A30 "PULLS A,X,U,PC": A, the state offset its dispatcher handed (bonus_1_end's callers:
# C "d = (d & 0xFFu) | (state_offset << 8)"), given back
local bonus_reward_winners 0209F8 s5 saved_state_offset
# done: src/bonus/balloon.c

# ---- src/bonus/results.c ----
# 02118F "LDA <$50" (players_playing), 021192 "PUSHS A", 021201 "PULLS A; LSRA": the players' bits still to go
local bonus_show_player_portraits 021192 s1 player_bits_left
# 0212A9 "PUSHS U,Y,X,D" ... 0212F5 "PULLS D,X,Y,U": Y, the box's text (bonus_results_draw_box(sign_kind, box_text, ...)),
# given back
local bonus_results_draw_box 0212A9 s4 saved_box_text
# done: src/bonus/results.c

# ---- src/bonus/wake_up.c ----
# 020A6C "LDD #$00A8; SUBD $4A4C", 020A73 "PUSHS D; PULLS X": how far the first player walks (high byte)
local bonus_2_intro_set_up 020A73 s10001 walk_distance_high
# 020E79 "LDD B,X" (bonus_2_player_x), 020E7B "PUSHS D; PULLS X": the player's x (high byte)
local bonus_2_portrait_x 020E7B s10001 player_x_high
# done: src/bonus/wake_up.c

# ---- src/bosses/dreamland_boss_objects.c ----
# 035452 "PUSHS U,X", 035455 "TFR U,X", 03545A "BSETW D,X,U" (clearing the free object), then "PULLS X,U": U the free object
local find_free_object_from_4d40 035452 s2 saved_free_object
# done: src/bosses/dreamland_boss_objects.c

# ---- src/enemies/enemy_hits.c ----
# 07D044 "LDA #$5B,U; ANDA #$70" (the hitter's player number bits), 07D049 "PUSHS A", 07D04B "LDA #$27,X; ANDA #$8F;
# ORA ,S+" (into the enemy's points: who gets them)
local enemy_set_knock_direction 07D049 s1 hitter_player_bits
# done: src/enemies/enemy_hits.c

# ---- src/enemies/enemy_states.c ----
# 07D5C6 "LBSR $D3D7" (enemy_find_attack_range: A the attack chance), 07D5CB "PUSHS A", 07D5CD "LBSR $D34F"
# (enemy_random), 07D5D0 "CMPA ,S+; BCC"
local enemy_think 07D5CB s1 attack_odds
# 07D64F "LDD #$28,X" (action, action_step), 07D652 "PUSHS B,CC", 07D659 "SETLN <$0E", 07D65C "PULLS CC,B": the step kept
# across the bank switch
local enemy_attack 07D652 s1 saved_action_step
# done: src/enemies/enemy_states.c

# ---- src/enemies/enemy_targets.c ----
# 07D308 "LDA #$04; PUSHS A", 07D340 "DEC ,S; BNE": the player slots still to check
local enemy_target_nearest_player 07D30A,07D340 s1 slots_left
# done: src/enemies/enemy_targets.c

# ---- src/enemies/goon_actions.c ----
# 028EC2 "LDA #$5B,U; ANDA #$70" (the grabbed player's number bits), 028EC7 "PUSHS A", 028EC9 "LDA #$27,X; ANDA #$8F;
# ORA ,S+"
local goon_grab_try 028EC7 s1 target_player_bits
# done: src/enemies/goon_actions.c

# ---- src/enemies/grabbing_zombie.c ----
# 03079A "LDA #$5B,U; ANDA #$70", 03079F "PUSHS A", 0307A1 "LDA #$27,X; ANDA #$8F; ORA ,S+"
local zombie_grab_reach 03079F s1 target_player_bits
# done: src/enemies/grabbing_zombie.c

# ---- src/objects/bear.c ----
# 03CF30 "PUSHS D" ... 03CF38 "PULLS D" (around the sound), 03CF4F "PUSHS D" ... 03CF5A "PULLS D": the z speed (high byte)
local bear_boulder 03CF30,03CF4F s10001 saved_z_speed_high
# 03C9CE "PUSHS U; PULLS D" (the floor cell's place, low byte), 03C9D6 "PUSHS X" ... 03C9E1 "PULLS X" (the bear, low
# byte): the slot holds the place's low byte, then the bear's
local bear_break_out 03C9CE,03C9D6 s1 place_or_object_low
# 03CA5B "LDY #$0610", 03CA5E "PUSHS Y", 03CA63 "LBSR $62E5" (stage_boss_set_hit_box), 03CA66 "PULLS Y", 03CA6A "LBSR
# $604C" (stage_boss_set_state)
local bear_face_player 03CA5E s2 saved_state_wait
# 03CA8B "ADDD #$4A40", 03CA8E "PUSHS D; PULLS U": a random player's object (high byte)
local bear_choose_target 03CA8E s10001 chosen_player_high
# 03CB26 "LDA #$11", 03CB28 "PUSHS D; PULLS Y", 03CB2E "LBSR $604C" (stage_boss_set_state: state 11)
local bear_walk 03CB28 s10001 attack_state
# 03CBB3 "LDD A,Y" (bear_charge_speeds_by_rank), 03CBB5 "PUSHS A", 03CBB7 "LDA #$09,X; BITA #$40", 03CBBC "PULLS A":
# the speed's high byte kept across the facing test
local bear_start_charge 03CBB5 s1 saved_speed_high
# 03CD92 "LDA <$57; ASLA" x4, 03CD99 "PUSHS A", 03CD9B "LDA #$96; SUBA ,S+; CMPA #$3A,X": 16 frames off the charge's
# wait for each player
local bear_think 03CD99 s1 time_off_by_players
# done: src/objects/bear.c

# ---- src/objects/burns_robot.c ----
# 03AB00 "PUSHS A" (the piece's number), 03AB04 "LBSR $867D" (vector_find_free_slot), 03AB07 "PULLS A", 03AB09 "LBSR
# $751E" (burns_robot_place_part)
local burns_robot_throw_piece 03AB00 s1 saved_piece_number
# 03AB82 "PUSHS A", 03AB86 "LBSR $867D", 03AB89 "PULLS A"
local burns_robot_throw_piece_2 03AB82 s1 saved_piece_number
# 03ABEC "PUSHS A", 03ABF0 "LBSR $867D", 03ABF3 "PULLS A"
local burns_robot_throw_piece_3 03ABEC s1 saved_piece_number
# 03ACF0 "PUSHS A", 03ACF4 "LBSR $867D", 03ACF7 "PULLS A"
local burns_robot_throw_piece_4 03ACF0 s1 saved_piece_number
# 03AF91 "PUSHS X; TFR U,X", 03AF97 "LBSR $72FF" (burns_robot_set_box on the shot), 03AF9A "PULLS X": the robot
local burns_robot_fire_shot 03AF91 s2 saved_robot
# 03B04D "PUSHS U,X; TFR U,X", 03B053 "LBSR $72FF" (burns_robot_set_box on the held part), 03B056 "PULLS X,U": X the robot
local burns_robot_part_attack_hold 03B04D s4 saved_robot
# 03B2B7 "PUSHS X,B; TFR U,X", 03B2BE "LBSR $8638" (vector_floor_at_offset on the target), 03B2C6 "PULLS B,X": X the robot
local burns_robot_aim_at_target 03B2B7 s2 saved_robot
# done: src/objects/burns_robot.c

# ---- src/objects/burns_robot_parts.c ----
# 03B60E "PUSHS U" (the row's first tile), 03B610 "CLR #$-2000,U; STA ,U+" x 20, then "PULLS U; LEAU #$40,U"
local burns_breakout_break_wall 03B60E s2 row_start
# done: src/objects/burns_robot_parts.c

# ---- src/objects/fat_goon_actions.c ----
# 02AB0F "LDA #$5B,U; ANDA #$70", 02AB14 "PUSHS A", 02AB16 "LDA #$27,X; ANDA #$8F; ORA ,S+"
local fat_goon_grab 02AB14 s1 target_player_bits
# done: src/objects/fat_goon_actions.c

# ---- src/objects/floor_scenery.c ----
# 02B26D "STU #$2A,X" (the floor cell's place), 02B270 "PUSHS U; PULLS D", 02B274 "ANDB #$C0; STD #$38,X" (its row)
local floor_blocker_start 02B270 s2 floor_place
# 02B2D2 "LDU #$2A,X; LDA #$37,X; ASLA; ASLA; LEAU A,U" (the part's place), 02B2DC "PUSHS U; PULLS D", 02B2E0 "STB
# #$34,X" (its column, the low byte)
local floor_blocker_write_cells 02B2DC s1 part_place_low
# 02C7D7 "LDU #$2A,X; ... LEAU A,U", 02C7E1 "PUSHS U; PULLS D", 02C7E5 "STB #$34,X"
local platform_scenery_write_cells 02C7E1 s1 part_place_low
# 02C83D "LBSR $8650" (floor_cell_under: U the place), 02C843 "PUSHS U; PULLS D", 02C84A "ANDB #$C0; STD #$38,X"
local platform_scenery_start 02C843 s2 floor_place
# 02C885 "LDU #$2A,X" (floor_start), 02C888 "PUSHS U; PULLS D", 02C88C "STB #$34,X"
local platform_scenery_clear_floor 02C888 s2 floor_place
# 02CA0A "LBSR $8650", 02CA10 "PUSHS U; PULLS D", 02CA17 "ANDB #$C0; STD #$38,X"
local charging_scenery_start 02CA10 s2 floor_place
# done: src/objects/floor_scenery.c

# ---- src/objects/football_player.c ----
# 03C46D "LDA #$0B", 03C46F "PUSHS D; PULLS Y", 03C475 "LBSR $604C" (stage_boss_set_state: state 0B)
local football_player_start_charge 03C46F s10001 new_state
# 03C5E1 "LDA #$09", 03C5E3 "PUSHS D; PULLS Y", 03C5E9 "LBSR $604C" (state 09)
local football_player_run 03C5E3 s10001 new_state
# done: src/objects/football_player.c

# ---- src/objects/moes_street_scenery.c ----
# 02C309 "LBSR $8650" (floor_cell_under), 02C312 "PUSHS U; PULLS D", 02C319 "ANDB #$C0; STD #$38,X"
local moes_street_scenery_dropper_start 02C312 s2 floor_place
# 02C393 "LDU #$2A,X" (floor_start), 02C396 "PUSHS U; PULLS D", 02C39A "STB #$34,X" (its column)
local moes_street_scenery_dropper_write_floor 02C396 s1 start_place_low
# done: src/objects/moes_street_scenery.c

# ---- src/objects/krusty_balloon.c ----
# 026789 "PUSHS X; TFR U,X", 02678F "LBSR $6978" (krusty_balloon_set_hit_box on the attack), 026792 "PULLS X"
local krusty_balloon_attack_hit 026789 s2 saved_balloon
# 0269E0 "PUSHS A" (the throw's side), 0269E4 "LBSR $867D" (vector_find_free_slot), later "PULLS A; ASLA" (the throw
# by side: krusty_balloon_throw_directions)
local krusty_balloon_throw 0269E0 s1 saved_side
# 026DD9 "PUSHS X; PULLS D", 026DDD "ADDB <$16; ANDB #$20": the shot's address, its low byte a phase for the drift
local krusty_balloon_shot_drift 026DD9 s2 shot_address
# done: src/objects/krusty_balloon.c

# ---- src/objects/marge_cloud.c ----
# 03D79B "LDA <$16; ASLA" x3, 03D7A1 "ANDA #$78", 03D7A3 "PUSHS A", 03D7AC "CMPA ,S+" (with the x's low byte - 40)
local marge_cloud_idle 03D7A3 s1 frame_phase
# done: src/objects/marge_cloud.c

# ---- src/objects/object_lists.c ----
# 07CB6F "LDD #$01,X" (type, state), 07CB72 "PUSHS B,CC", 07CB79 "SETLN <$0E", 07CB7C "PULLS CC,B": the state kept
# across the bank switch
local run_enemies 07CB72 s1 kept_state
# 07CBB0 "LDD #$01,X", 07CBB3 "PUSHS B,CC", 07CBBD "PULLS CC,B"
local run_list_1_objects 07CBB3 s1 kept_state
# 07CBE3 "LDD #$01,X", 07CBE6 "PUSHS B,CC", 07CBF0 "PULLS CC,B"
local run_child_objects 07CBE6 s1 kept_state
# 07CC12 "LDD #$01,X", 07CC15 "PUSHS B,CC", 07CC1F "PULLS CC,B"
local run_stage_event 07CC15 s1 kept_state
# 07CC38 "LDD #$7F04; PUSHS A", 07CC48 "CMPA ,S; BCC", 07CC4C "STA ,S; STU $1870" (least_attacked_player)
local find_least_attacked_player 07CC3B,07CC4C s1 fewest_attackers
# done: src/objects/object_lists.c

# ---- src/objects/obstacles.c ----
# 02CC4E "LBSR $8650" (A the old floor cell), 02CC51 "PUSHS A" ... 02CC5F "PULLS A"; 02CC64 "PUSHS U; PULLS D" (the
# place's low byte, the column): the slot holds the cell, then the column
local obstacle_raise_floor 02CC51,02CC64 s1 cell_or_column
# done: src/objects/obstacles.c

# ---- src/objects/scripted_object.c ----
# 03DC9D "LDD ,Y++" (the sound from the script), 03DCA4 "PUSHS Y", 03DCA6 "LBSR $8680" (vector_queue_sound), 03DCA9
# "PULLS Y"
local scripted_object_play_sound 03DCA4 s2 saved_script_cursor
# done: src/objects/scripted_object.c

# ---- src/objects/shaking_scenery.c ----
# 02D21E "PUSHS A" (the old floor cell) ... 02D22C "PULLS A"; 02D234 "PUSHS U; PULLS D" (the column)
local scenery_block_floor 02D21E,02D234 s1 cell_or_column
# done: src/objects/shaking_scenery.c

# ---- src/objects/spawning.c ----
# 07CA6A "PUSHS U,X", 07CA6D "TFR U,X", 07CA72 "BSETW D,X,U" (clearing the slot), 07CA73 "PULLS X,U": U the slot's object
local take_free_object 07CA6A s2 saved_slot_object
# done: src/objects/spawning.c

# ---- src/objects/stage_3_boss.c ----
# 03D2C4 "PUSHS X", 03D2CB "LDX #$41,X" (the partner) ... then "PULLS X": the boss
local stage_3_boss_together 03D2C4 s2 saved_boss
# 03D574 "PUSHS X; LDX #$41,X" (the partner's state set); 03D5C3 "PUSHS X; LDX #$41,X" (the partner moved): the boss
local stage_3_boss_update 03D574,03D5C3 s2 saved_boss
# done: src/objects/stage_3_boss.c

# ---- src/objects/stage_7_boss.c ----
# 022F6E "LDB $1880; DECB" (enemies_present_last_frame, less the boss), 022F73 "PUSHS B", 022F75 "SUBA ,S"
local stage_7_boss_order_throws 022F73 s1 other_enemy_count
# done: src/objects/stage_7_boss.c

# ---- src/objects/stage_8_boss.c ----
# 03A0EF "ADDD #$4A40", 03A0F2 "PUSHS D; PULLS U": the random player to start from (high byte)
local stage_8_boss_pick_player 03A0F2 s10001 start_player_high
# 03A150 "LSRB; BCC" (the players' bits), 03A153 "PUSHS B" ... 03A15F "PULLS B"; 03A163 "PUSHS B" ... 03A16F "PULLS B":
# the bits kept around the distance checks
local stage_8_boss_player_is_close 03A153,03A163 s1 saved_player_bits
# 03A3B5 "PUSHS A" (the angle to walk), 03A3BD "LDB A,Y" (stage_8_boss_walk_speeds_by_players), 03A3BF "PULLS A",
# 03A3C1 "LBSR $8617" (vector_set_speed_by_direction)
local stage_8_boss_phase_1 03A3B5 s1 saved_angle
# 03A458 "PUSHS A" (the run speed), 03A45A "LBSR $863B" (vector_floor_ahead), 03A45E "PULLS A; BPL; NEGA"
local stage_8_boss_phase_2 03A458 s1 saved_run_speed
# 03A68D "PUSHS X" (the boss, around the palette request), later "PULLS X"
local stage_8_boss_take_hits 03A68D s2 saved_boss
# 03A95C "LDD ,Y", 03A95E "PUSHS D", 03A960 "ADDD ,Y" x3, 03A966 "ADDD ,S++; ADDD #$3711": the old value, 5 times it
# plus 3711 the next
local stage_8_boss_next_random 03A95E s2 old_value
# 03A991 "LDD #$0F,X; ABSD", 03A995 "PUSHS D", 03A99B "ADDD ,S++" (the y speed's size)
local stage_8_boss_speed 03A995 s2 x_speed_size
# done: src/objects/stage_8_boss.c

# ---- src/objects/stage_bosses.c ----
# 03C0B0 "PUSHS Y; PULLS D; NEGD", 03C0B5 "PUSHS D; PULLS Y", 03C0B9 "STY #$0F,X": the knock-away speed, turned round
local stage_boss_knock_away 03C0B0,03C0B5 s2 knock_speed
# 03C0EB "LDD #$0D,X; ADDD #$0F,X", 03C0F1 "PUSHS A" (the next x's low byte), 03C0FA "PULLS B; CMPD #$0070"
local stage_boss_move_on_screen 03C0F1 s1 next_x_low
# 03C187 "ADDD #$4A40", 03C18A "PUSHS D; PULLS U": the random player to start from (high byte)
local stage_boss_pick_random_player 03C18A s10001 start_player_high
# 03C1FE "LSRB; BCC", 03C201 "PUSHS B" ... "PULLS B"; 03C211 "PUSHS B" ... "PULLS B"
local stage_boss_player_is_near 03C201,03C211 s1 saved_player_bits
# done: src/objects/stage_bosses.c

# ---- src/objects/wrestler.c ----
# 0217F1 "CLRB", 0217F2 "PUSHS D" (B at 1,S), 021801 "INC #$01,S" (a player within reach), 02180C "PULLS D; CMPB #$02"
local wrestler_surrounded 0217F2,021801 s1 players_in_reach
# done: src/objects/wrestler.c

# ---- src/players/effects.c ----
# 039B89 "PUSHS U,Y,D" ... "PULLS D,Y,U": Y, whatever the caller holds there (player_grabbed's y), given back
local player_flash_palette 039B89 s4 saved_y
# 039BFC "PUSHS Y" (the spark's height), 039C03 "LBSR $7C2F" (player_start_effect), 039C06 "PULLS Y"
local player_show_hit_spark 039BFC s2 saved_spark_height
# done: src/players/effects.c

# ---- src/players/gauges.c ----
# 040906 "CLRA", 040907 "PUSHS A", 040912 "LDA ,S" (gauge_player_records by player), 040917 "PULLS A; INCA; CMPA #$04" (pushed again at 040907)
local gauges_draw 040907 s1 player_counter
# 040B26 "PUSHS U,X,D" ... "PULLS D,X,U,PC": the caller's B, given back (nothing reads it)
local continue_end 040B26 s10006 saved_caller_byte
# 0408E2 "CLRA; PUSHS A", 0408F7 "INC ,S; LDA ,S; CMPA #$04"
local gauges_count_delays 0408E3,0408F7 s1 player_counter
# 0409CF "PUSHS U" ... 0409F0 "PULLS U,PC": the caller's tiles (low byte)
local gauges_byte_to_bcd 0409CF s1 saved_tiles_low
# 0409FD "PUSHS X" (the gauge player, low byte) ... 040A0B "PULLS X"; 040A3F "LDB #$04; PUSHS B", 040AA1 "DEC ,S; BNE":
# the slot holds the player's low byte, then the tiles still to draw
local gauge_draw_health 0409FD,040A41,040AA1 s1 player_low_or_tiles_left
# 040AA8 "LEAS #$-10,S", 040AAB "STA #$00,S" (the count, BCD), 040ABE "LDA #$00,S; ANDA #$F0" (tens), 040AE9 "LDA #$00,S;
# ANDA #$0F" (units)
local gauge_print_count 040AAB s10 bcd_count
# 040B44 "LDA $4A1C" (continue_seconds), 040B48 "PUSHS A", 040B62 "PULLS A; ANDA #$0F" (the units)
local continue_draw_count 040B48 s1 seconds_bcd
# 040B88 "PUSHS A" (bit 7: blank), 040B98 "LDA #$04,S; BMI"
local gauges_put_picture 040B88 s1 blank_flag
# 040BD6 "ANDA #$7F", 040BD8 "STA #$06,S", 040BE1 "LDA #$06,S; ASLA; LDD A,X" (gauge_player_columns)
local gauge_draw_picture 040BD8 s10 quarter_number
# done: src/players/gauges.c

# ---- src/players/motion.c ----
# 0397AD "PUSHS A" (the next y's low byte) ... 0397B6 "PULLS B"; 0397C9 "PUSHS A" (the next x's low byte) ... 0397D2
# "PULLS B"; 0397F7 "PUSHS A" (the next x's high byte, around the scene check) ... 0397FE "PULLS A"
local player_check_motion 0397AD,0397C9,0397F7 s1 next_position_byte
# 039898 "STD #$0F,U" (the x speed), 03989B "ANDA #$40", 03989D "PUSHS A", 0398A4 "ORA ,S+; STA #$09,U" (the facing)
local player_steer 03989D s1 facing_left_bit
# 039AD4 "PUSHS D; PULLS X" (the floor's z, low byte); 039ADE "PUSHS A" (the next x's low byte), 039AE7 "PULLS B"
local player_check_screen_edges 039AD4,039ADE s1 floor_or_next_x_low
# done: src/players/motion.c

# ---- src/players/players.c ----
# 03800E "LDA <$40" (player_input.now, the buttons held), 038014 "PUSHS D; PULLS Y" (the same at 03802E, 038048, 038062)
local player_run_all 038014,03802E,038048,038062 s10001 buttons_now
# 0380FE "PUSHS X,D" (X the player's values), 038125 "LDX #$02,S; STA #$02,X" (kept_life), 03812B "PULLS D,X"
local player_run 0380FE s2 saved_record
# 07B710 "CLRA; PUSHS A", 07B716 "LDA ,S; ASLA; LDX A,X" (player_records), 07B727 "INC ,S; LDA ,S; CMPA #$04"
local update_players 07B711,07B727 s1 player_counter
# 07B7BF "LBSR $9718" (high_score_rank: A the place), 07B7C4 "PUSHS A", later "PULLS A" for insert_high_score
local player_join 07B7C4 s1 high_score_place
# done: src/players/players.c

# ---- src/players/reactions.c ----
# 039749 "PUSHS X" (the first team member), 039750 "LDX #$4A40; LEAX D,X" (the second), later "PULLS X"
local player_take_touches 039749 s2 saved_team_member
# 03937F "PUSHS U" (the player, popped at 03943A "PULLS U" after the pick-up's shared end)
local player_pick_up_item 03937F s2 saved_player
# 0393B2 "PUSHS U", 03943A "PULLS U"
local player_pick_up_weapon 0393B2 s2 saved_player
# 0393C1 "PUSHS U", 03943A "PULLS U" (the player, while the partner may eat instead)
local player_eat_food 0393C1 s2 saved_player
# 03945F "LDX #$16,U" (the player's z), 039477 "PUSHS X; PULLS D", 03947B "ADDD #$0010; CMPD #$16,Y"
local player_take_blow 039477 s2 player_z
# 039694 "PUSHS U,X", 039698 "LBSR $7A93" (player_check_screen_edges on the partner), 03969B "PULLS X,U": U the player
local player_break_team 039694 s2 saved_player
# done: src/players/reactions.c

# ---- src/players/second_sprite.c ----
# 03EB35 "LDA #$09,U; ANDA #$40", 03EB3A "PUSHS A", 03EB4D "ORA ,S+; STA #$69,U" (the second sprite's facing)
local player_second_sprite_throw 03EB3A s1 facing_left_bit
# 03ECC9 "LDA A,X" (pair_balloon_players), 03ECCB "LDB #$C0; MUL; ADDD #$4A40", 03ECD1 "PUSHS D; PULLS X", 03ECD5 "LDD
# #$0C,X": the player who speaks
local player_second_sprite_balloon 03ECD1 s2 speaker_object
# done: src/players/second_sprite.c

# ---- src/players/states.c ----
# 038338 "PUSHS Y", 03833A "LDY #$7E3B", 03833D "LBSR $7BF9" (player_show_hit_spark), 038340 "PULLS Y": the walk
# velocities kept
local player_team_move 038338 s2 saved_walk_velocities
# 0385ED "LDB #$80", 0385EF "PUSHS D; PULLS Y" (the weapon effect's low byte); 03876E "LDA #$5B,U; ANDA #$30", 038773
# "PUSHS A", 03877A "ORA ,S+; STA #$5B,X" (the player's bits into the picked-up object's)
local player_stand 0385EF,038773 s1 effect_low_or_shadow_bits
# 0387F4 "PUSHS B" (the use index) ... 0387FE "PULLS B"
local player_start_throw_kind_4 0387F4 s1 saved_use_index
# 038818 "PUSHS B", 03881D "LBSR $8680" (vector_queue_sound), 038820 "PULLS B"
local player_start_swing_6 038818 s1 saved_use_index
# 038943 "PUSHS X; PULLS D" (the player's z, which its callers load from field 16), 038947 "SUBD #$5C,U" (the height
# above the floor)
local player_start_jump_attack 038943 s4 player_z
# 038CD9 "PUSHS A" (the facing bit), 038CDB "LDA #$09,X; ANDA #$70; ORA ,S+; STA #$09,X" (into the teammate's)
local player_attack_end 038CD9 s1 facing_for_teammate
# 03925A "PUSHS A" (the weapon's animation offset), 039272 "PUSHS B" (the animation, around the held look's check),
# 03929A "PUSHS A" (the held object's animation offset), 0392CC "PUSHS A" (the facing bit): the slot holds each in turn
local player_set_animation 03925A,039272,03929A,0392CC s1 offset_or_facing
# done: src/players/states.c

# ======== the closing's fixes ========
# the object's own z, compared with its floor: 0386F5 "LDX #$16,U; CMPX #$5C,U" (the code the players' standing, walking
# and team states share), 03892F (player_start_move) and 03945F (player_take_blow) the same; the C had named it floor_z
# after the field it is compared with
local player_walk 0386F5 x player_z
local player_team_jump 0386F5 x player_z
local player_team_start_fall 0386F5 x player_z
local player_attack_end 0386F5 x player_z
local player_team_together 0386F5 x player_z
local player_team_move 0386F5 x player_z
local player_team_fall 0386F5 x player_z
local player_start_move 03892F x player_z
local player_take_blow 03945F x player_z
# player_start_jump_attack gets that z in X (its callers' player_z), which it keeps in its stack slot player_z
param player_start_jump_attack x z

# the stage bosses' shared routines' phase and wait, as the bear's and the football player's own: stage_boss_set_state
# 03C055 "STY #$2E,X" (the state and its wait), stage_boss_blink_out counts the blinks down in 2F
scoped object stage_boss 2E phase u8
scoped object stage_boss 2F wait u8

# burns_robot_aim_at_target: X is the target (03B2B9 "TFR U,X"), then the robot again (03B2C6 "PULLS B,X"), whose
# aim (2D) and heading (2E) it sets
local burns_robot_aim_at_target 03B2B9,03B2C6 x object object.burns_robot

# ======== the board's ROM sum's temporaries ========
# add_rom_bytes (the board's own takes its place, the original kept for reading): 078E68 "LDD <$FA" the sum so far,
# 078E6B "ADDB ,X+" the byte's place and the ROM byte added, 078E7A "TST $1FCA" the watchdog's read
local add_rom_bytes 078E68 t4 sum_before
local add_rom_bytes 078E6B t1 byte_place
local add_rom_bytes 078E6B t2 rom_byte
local add_rom_bytes 078E7A t1 watchdog_read
