# OutRunners (MAME set 'orunners', World) - V70 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
#   A code label of a computed call or jump may say where it goes: calls=TABLE, the code of a described table
#   register RN NAME: a register the whole program shares, a global variable of the C (its name)
#   exit FUNCTION ADDRESS: the function (a func line in the middle of code) goes back to the code that runs
#   it where it jumps to ADDRESS: that jump is its return, and a jump into it a call, then a jump there
# Addresses use the copy of the program the code refers to:
#   000000-03FFFF (ic37 + ic40, a 16-bit word of each in every 32-bit word), 100000-1FFFFF (ic36 + ic39)
# Mirrors are accepted and folded (e.g. FFFFF0 -> 03FFF0).
#
# LAYOUT, for data tables that hold code addresses the analysis cannot see the code load:
#   record=N        the table is an array of N-byte records
#   count=N         ... of N records, or
#   count=prefix    ... of as many records as the 16-bit word before them says, or
#   count=prefix32  ... of as many records as the 32-bit word before them says, or
#   count=bytes32   ... of as many records as fill the length in bytes the 32-bit word before them says, or
#   end=XXXX        ... closed by this 16-bit word where the next record would start
#   kinds=O:K=N,..  ... of records whose length the 16-bit field at offset O picks: N bytes for kind K
#                   (hexadecimal), 'end' for a kind that closes the array, or 'fork' for one that closes it
#                   with a table of addresses of arrays that go on from there (as many as fit before the
#                   first of them)
#   code=A,B        every record holds a 32-bit code address at these offsets (0 = no code);
#                   A:BASE is a 16-bit offset from BASE instead
#   data=A,B        every record holds at these offsets a 32-bit value that its code may take as the address
#                   of data: the data it goes with, when the value's low 24 bits (the V70's address bus) are
#                   an address of the program ROM that is not code (0 and numbers are not)
#   lists=N         the table is N 16-bit offsets, from its own address, to such arrays
#   pointers=N      the table is N 32-bit addresses of such arrays (0: no array)
# Sizes, offsets and counts are decimal; end and BASE are hexadecimal, like the data and addresses.

# ======== entry points ========
03FFF0  func  reset              # V70 reset vector (0xFFFFFFF0 on a 24-bit bus): "jmp 6"
comment reset The V70's reset vector, at the top of the program's address space: a jump to boot.
000006  func  boot               # sets SBR to 03F000, the stack to 21FC00, and copies blocks to E00000 and E80000
03F000  data  vector_table       # 256 x 32-bit entries, base loaded into SBR by boot
03F8B4  func  int_default        # target of 250 of the 256 vector table entries
03F8C0  func  int_vector_02      # NMI
# The V70 takes maskable interrupts at vector 0x40 + the number the interrupt controller (D00000) supplies
03F500  func  int_vector_40
03F794  func  int_vector_41
03F7A0  func  int_vector_42
03F7AC  func  int_vector_43
03F830  func  int_vector_44

# ======== the registers the program shares ========
# Globals of the C (decompiler/signatures.py CONTEXT); each task has its own copy, which the runtime swaps
# with it. R12 and R14 are shared too, as scratch registers whose last value the next function may read
# (a handler what the one before it left: race_cars_start the page in R12's high half, the road rows' and
# the scenery's drawing the height of the last size step in R14), and keep their register names. R26, R27
# and R28 are not: every function sets them before it reads them (tools/game_profile.py)
register R20  current_object     # the object the object loop (011CC0) runs: set before it calls the handler at field 4
register R23  player_car         # the screen's car: the object at 1000[R25] (209000 or 219000)
register R25  screen             # the block of the screen the task runs: 208000 for screen 1 (the second task), 218000 for screen 2 (the boot task)
register R32  stack_pointer      # SP, in the functions whose stack stays in memory (decompiler/stack.py); 21F400 after boot

# ======== structures ========
# The game's own (decompiler/pointers.py works out which registers point at them): the objects, 124 in the
# page of each screen's block, run by the object loop; the screen's car block, at 1000 of its block (its
# field 0 is the car's object, which player_car_update runs); the block of the screen a task runs (R25), 6000
# bytes: after screen 1's come the game's variables (20E000), after screen 2's the race records the ISDN link
# brings in (21E000) and the stacks.
# Times are in the task's frames: each task runs every other video frame, 30 a second
struct object 100
struct car 200
struct screen 6000
# Each player's race record, two copies of 0x80 bytes in the game's variables: 20FB00 and 20FB80 (the number
# of stages at 60, the stage at 62, the time of the last checkpoint pass at 68, the time left at 6A in 30ths
# of a second, the race time at 6C in thousandths), and the copies of every player's from 20FC00, 0x80 apart,
# that the screens read (eight with the link: link_receive_records brings in the other cabinets')
struct race 80
# Below each screen's block (screen - 8000), its objects' area: this frame's list of objects and the next
# frame's (each a count, then the low halves of the objects' addresses; the two, at 200 and 300, swap every
# frame), the used slots (7C bytes at 10, FF used), a spare object at 100 and the 124 objects from 400
struct object_area 8000
struct object_list 100
struct object_list_block 8   # an object list as run_objects clears it, eight bytes at a time (its first halfword the count)
field object_list_block 00 low u32
field object_list_block 00 count u16   # the list's count of objects, read before it is cleared
field object_list_block 04 high u32
field object_area 00 list u32 object_list            # this frame's list, which run_objects walks
field object_area 04 list_first u32 object_list      # its first object's place (nothing reads it)
field object_area 08 next_list u32 object_list       # the next frame's list, where run_objects puts the live ones
field object_area 0C list_end u32 object_list        # past this frame's list's last object (nothing reads it)
# The structures inside a screen's block and an objects' area (member lines): the hit boxes of the race's cars
# (up to eight, after hit_box_count) and the one of the screen's car from its own fields (player_car_build_hit_boxes
# 012255-0122A9: 0x12 bytes each from 514; the last at 5AE, written from its record at 5B0 on), the screen's ring of eight views
# (player_car_publish), its car (player_car), the course's ring of 128 road segments, the road's segments as the
# screen shows them, the 416 depth layers' lists of sprite groups; the area's spare object, this frame's and the
# next frame's object lists, and its 124 objects
member screen 514 car_hit_boxes car_hit_box[8]
member screen 5AE player_car_hit_box car_hit_box
member screen 600 views view[8]
member screen 1000 car car
member screen 2000 road_segments road_segment[80]
member screen 3000 projected_segments projected_segment[80]
member screen 5000 depth_layers depth_list[1A0]
member object_area 100 spare_object object
member object_area 200 object_lists object_list[2]
member object_area 400 objects object[7C]
# ======== records of the program ROM ========
# A row of the same sprite along the road (scenery, fork signs, flashing and animated scenery: road_row_start
# 012894 reads it from object 18): its animation, palette, flags, the size table and shift, the side of the
# road, the offsets, how far apart the sprites are and how many, then the hit box (none: 0 in its first 32 bits;
# the records follow one another 18 bytes apart: 723 of the 770 the streams start, 212 of them with a hit box)
struct road_row_record 18 rom
field road_row_record 00 animation u16          # 01289B "movz.hw [R10+], R9" (012B13 in road_row_start_copy): animation_start's
field road_row_record 02 palette u16            # 01289E -> object 3A
field road_row_record 04 flags u8               # 0128A3: or-ed into object 00
field road_row_record 05 size_table u8          # -> object 45
field road_row_record 06 scale_shift u8         # -> object 44
field road_row_record 07 side s8                # -> object 3F
field road_row_record 08 x_offset s16           # -> object 20
field road_row_record 0A y_offset s16           # -> object 24
field road_row_record 0C spacing u16            # -> object 10
field road_row_record 0E count u16              # -> object 12
field road_row_record 10 hit_box u16[4]             # its hit box, an item_hit_box: the bounds along the road (along_start, along_end), then across it (across_start, across_end), which the hit checks read a halfword each; the code that starts the object tests the first two as one word (0128CA, 012B42 "test.w [R10]"): none when both are 0; its address -> object 60, where road_row_hit_check reads it (020EBF: 30 -30 50 250, decimal)
# The objects of a road's stream (road_object_streams), each a (position, command) halfword pair; command 0
# goes on with the object's handler and its parameter (12 bytes in all; 1 and 2 are 4, 3 a fork: the table of
# its branches' streams follows): road_object_stream_read 01273D "movz.hw [R10+], R0" (compared with car
# stage_segments, cmp.h: signed) and 012733 "movz.hw [R10+], R1" (the command, by which 012736 picks the code
# from road_object_stream_command_jumps), road_object_stream_start_object 012767 and 01276C
struct road_object_stream_entry 0C rom
field road_object_stream_entry 00 position s16       # 01273D: segments from the stage's start (+ stage_start -> object 1C)
field road_object_stream_entry 02 command u16        # 012733: 0 start an object, 1 the stage's end, 2 the end, 3 a fork
field road_object_stream_entry 04 handler u32        # 012767 "mov.w [R10+], 4[R21]": the new object's handler
field road_object_stream_entry 08 parameter u32      # 01276C "mov.w [R10+], 18[R21]": its field 18 (most often its record)
elements road_object_stream_forks u32 road_object_stream_entry   # a fork's table: the streams of its two branches, by the branch the car takes (road_object_stream_read, state 3)
# A flashing_scenery object's record (flashing_scenery_update 012923-012956, from field 18): road_row_record's
# fields, but with the address of the list of palettes the scenery cycles through (flashing_scenery_palettes)
# in place of the palette; then the hit box (none: all 11 records in the streams, 021027-02D04C, have 0)
struct flashing_scenery_record 1A rom
field flashing_scenery_record 00 animation u16          # 012927 "movz.hw [R10+], R9": animation_start's
field flashing_scenery_record 02 palettes u32 flashing_scenery_palettes   # 01292A -> object 18 (palette_cycle)
field flashing_scenery_record 06 flags u8               # 01292F: or-ed into object 00 (0 in all 11)
field flashing_scenery_record 07 size_table u8          # 012933 -> object 45 (0, 1)
field flashing_scenery_record 08 scale_shift u8         # 012938 -> object 44
field flashing_scenery_record 09 side s8                # 01293D -> object 3F (-1, 0, 1)
field flashing_scenery_record 0A x_offset s16           # 012942 -> object 20
field flashing_scenery_record 0C y_offset s16           # 012947 -> object 24
field flashing_scenery_record 0E spacing u16            # 01294C -> object 10
field flashing_scenery_record 10 count u16              # 012951 -> object 12
field flashing_scenery_record 12 hit_box u16[4]             # its hit box, an item_hit_box: the bounds along the road (along_start, along_end), then across it (across_start, across_end), which the hit checks read a halfword each; the code that starts the object tests the first two as one word (012956 "test.w [R10]"): none when both are 0; its address -> object 60
# The palettes a flashing_scenery cycles through, one a frame (flashing_scenery_update 012990 "movs.hw [R10+],
# R0"): a negative entry goes back that many bytes (012997 "add.w R0, R10") to the list's start (-8 after
# three, -18 after eight, decimal: 021041, 022FF2, 023E56, 024C16, 0287AA, 02C444). Halfwords at an odd address,
# the first list (021041, in road_object_streams' piece), which the code reads there whole: unaligned (found by
# -fsanitize=alignment on the 16 scenarios, flashing_scenery_update's two reads)
elements flashing_scenery_palettes s16 unaligned
# The record of the northern lights (aurora_update 012A3B-012A4D, from field 18; two, 02C44E and 02C470)
struct aurora_record 08 rom
field aurora_record 00 animations u32 aurora_animations   # 012A3F "mov.w [R10+], 18[R20]" (animation_list)
field aurora_record 04 palette u16              # 012A44 -> object 3A (25C)
field aurora_record 06 flags u8                 # 012A49: or-ed into object 00 (0)
field aurora_record 07 animation_frames u8      # 012A4D "mov.b [R10], 9[R20]": how long each animation shows (28: 40 frames)
# The northern lights' animations, one after another (aurora_next_animation 012AAF "movs.hw [R10+], R0"): a
# negative entry goes back that many bytes (012AB6) to the list's start (-18 decimal after eight: 02C45E, 02C481).
# The second list is at an odd address (02C481, in road_object_streams' piece), which the code reads there
# whole: unaligned (found by -fsanitize=alignment on the 16 scenarios, aurora_next_animation's two reads)
elements aurora_animations s16 unaligned
# What crosses the road when the car comes near (road_crosser_update 012BCF-012C0E, from field 18: the camels,
# 12 records 02737C-02D8A8), and the kangaroos (kangaroo_update 012CCB-012CFC reads its record, 02AB8C, the
# same way: hop_animation for crossing_animation)
struct road_crosser_record 10 rom
field road_crosser_record 00 animation u16            # 012BD3 "movz.hw [R10+], R9": animation_start's
field road_crosser_record 02 crossing_animation u16   # 012BE4 -> object 80, once the car reaches trigger_position
field road_crosser_record 04 palette u16              # 012BEA -> object 3A
field road_crosser_record 06 flags u8                 # 012BEF: or-ed into object 00 (0 or 40)
field road_crosser_record 07 side s8                  # 012BF3 -> object 3F (0 or 1)
field road_crosser_record 08 x_offset s16             # 012BF8 -> object 20
field road_crosser_record 0A trigger_distance u16     # 012BFD -> object 82
field road_crosser_record 0C x_speed s16              # 012C03 -> object 84 (-15 to -22 decimal; 0 for animation 165)
field road_crosser_record 0E draw_mode u8             # 012C09 -> object 3E
field road_crosser_record 0F scale_shift u8           # 012C0E -> object 44
# The record of scenery that travels across the view (moving_scenery_update 012DD3-012E16, from field 18; 18
# records, 021091-029248)
struct moving_scenery_record 14 rom
field moving_scenery_record 00 animation u16          # 012DD7 "movz.hw [R10+], R9": animation_start's
field moving_scenery_record 02 palette u16            # 012DDA -> object 3A
field moving_scenery_record 04 flags u8               # 012DDF: or-ed into object 00 (0 or 40)
field moving_scenery_record 05 draw_mode u8           # 012DE3 -> object 3E (9)
field moving_scenery_record 06 scale_shift u8         # 012DE8 -> object 44
field moving_scenery_record 07 side s8                # 012DED -> object 3F (0)
field moving_scenery_record 08 x_offset s16           # 012DF2 -> object 20
field moving_scenery_record 0A y_offset s16           # 012DF7 -> object 24
field moving_scenery_record 0C trigger_distance u16   # 012DFC -> object 80 (plus 16)
field moving_scenery_record 0E x_speed s16            # 012E0A -> object 82
field moving_scenery_record 10 y_speed s16            # 012E10 -> object 84
field moving_scenery_record 12 road_speed s16         # 012E16 -> object 86
# The record of the helicopter of stage 4 (swooping_helicopter_update 012EC3-012F12, from field 18; one,
# 02304C): moving_scenery_record's fields, then how long it dives and how fast
struct swooping_helicopter_record 17 rom
field swooping_helicopter_record 00 animation u16          # 012EC7 "movz.hw [R10+], R9": animation_start's
field swooping_helicopter_record 02 palette u16            # 012ECA -> object 3A
field swooping_helicopter_record 04 flags u8               # 012ECF: or-ed into object 00
field swooping_helicopter_record 05 draw_mode u8           # 012ED3 -> object 3E
field swooping_helicopter_record 06 scale_shift u8         # 012ED8 -> object 44
field swooping_helicopter_record 07 side s8                # 012EDD -> object 3F
field swooping_helicopter_record 08 x_offset s16           # 012EE2 -> object 20
field swooping_helicopter_record 0A y_offset s16           # 012EE7 -> object 24
field swooping_helicopter_record 0C trigger_distance u16   # 012EEC -> object 80 (plus 16)
field swooping_helicopter_record 0E x_speed s16            # 012EFA -> object 82
field swooping_helicopter_record 10 y_speed s16            # 012F00 -> object 84
field swooping_helicopter_record 12 road_speed s16         # 012F06 -> object 86
field swooping_helicopter_record 14 dive_frames u8         # 012F0C -> object 88 (1E: 30 frames)
field swooping_helicopter_record 15 dive_y_speed s16       # 012F12 -> object 8A (40 decimal)
# The record of the START banner and its posts (start_gate_update 012FDB-01300E, from field 18; four,
# 020D3F-020D87, 18 apart): as road_row_record, with the draw mode where the size table is; then the hit box
# (none: 0 in all four)
struct start_gate_record 18 rom
field start_gate_record 00 animation u16          # 012FDF "movz.hw [R10+], R9": animation_start's
field start_gate_record 02 palette u16            # 012FE2 -> object 3A (C9)
field start_gate_record 04 flags u8               # 012FE7: or-ed into object 00
field start_gate_record 05 draw_mode u8           # 012FEB -> object 3E (9)
field start_gate_record 06 scale_shift u8         # 012FF0 -> object 44
field start_gate_record 07 side s8                # 012FF5 -> object 3F (-1, 0, 1)
field start_gate_record 08 x_offset s16           # 012FFA -> object 20
field start_gate_record 0A y_offset s16           # 012FFF -> object 24
field start_gate_record 0C spacing u16            # 013004 -> object 10
field start_gate_record 0E count u16              # 013009 -> object 12
field start_gate_record 10 hit_box u16[4]             # its hit box, an item_hit_box: the bounds along the road (along_start, along_end), then across it (across_start, across_end), which the hit checks read a halfword each; the code that starts the object tests the first two as one word (01300E "test.w [R10]"): none when both are 0; its address -> object 60
# The record of a man with a chequered flag: the one at the start (start_flagman_update 01309B-0130B7, 020D14)
# and the ones at the forks and the goal (flagman_update 01311C-013138, 02DA44 and 02DC07): the standing and
# the waving animations (6E, 6F), the palette (7B), the side and the offsets
struct flagman_record 0B rom
field flagman_record 00 animation u16          # 01309F, 013120 "movz.hw [R10+], R9": animation_start's
field flagman_record 02 waving_animation u16   # 0130A2, 013123 -> object 80 (go_animation, in_view_animation)
field flagman_record 04 palette u16            # 0130A8, 013129 -> object 3A
field flagman_record 06 side s8                # 0130AD, 01312E -> object 3F (-1, 0)
field flagman_record 07 x_offset s16           # 0130B2, 013133 -> object 20
field flagman_record 09 y_offset s16           # 0130B7, 013138 -> object 24
# The record of a balloon let go at the start (start_balloon_update 0131BF-0131D5, from field 18; six,
# 0210DD-021154)
struct start_balloon_record 09 rom
field start_balloon_record 00 animation u16    # 0131C3 "movz.hw [R10+], R9": animation_start's (E2)
field start_balloon_record 02 palette u16      # 0131C6 -> object 3A (E4)
field start_balloon_record 04 side s8          # 0131CB -> object 3F (-1, 1)
field start_balloon_record 05 x_offset s16     # 0131D0 -> object 20
field start_balloon_record 07 y_offset s16     # 0131D5 -> object 24
# The record of Santa's sleigh (santa_sleigh_update 013358-01339F, from field 18; one, 02C493)
struct santa_sleigh_record 0E rom
field santa_sleigh_record 00 animation u16     # 01335C "movz.hw [R10+], R9": animation_start's (3A0)
field santa_sleigh_record 02 palette u16       # 01337B -> object 3A
field santa_sleigh_record 04 flags u8          # 013380: or-ed into object 00
field santa_sleigh_record 05 side s8           # 013384 -> object 3F
field santa_sleigh_record 06 x_offset s16      # 013389 -> object 20
field santa_sleigh_record 08 x_speed s16       # 01338E -> object 82 (-22 decimal)
field santa_sleigh_record 0A sound u16         # 013394 -> object 84 (49)
field santa_sleigh_record 0C draw_mode u8      # 01339A -> object 3E
field santa_sleigh_record 0D scale_shift u8    # 01339F "mov.b [R10], 44[R20]" -> object 44
# The record of what runs back and forth in front of a goal's crowd (goal_parade_rightward_update
# 01346C-01349F, goal_parade_leftward_update 0135E8-01361B, goal_parade_dragon_update 0136B8-0136DD, from
# field 18; eight, 02ABA4-02D58C)
struct goal_parade_record 0C rom
field goal_parade_record 00 animation u16      # 013470 "movz.hw [R10+], R9": animation_start's
field goal_parade_record 02 palette u16        # 013481 -> object 3A
field goal_parade_record 04 flags u8           # 013486: or-ed into object 00 (0, or 40 for the rightward ones)
field goal_parade_record 05 side s8            # 01348A -> object 3F (-1, 1)
field goal_parade_record 06 x_offset s16       # 01348F -> object 20
field goal_parade_record 08 x_speed s16        # 013494 -> object 80 (-22, 22 decimal)
field goal_parade_record 0A draw_mode u8       # 01349A -> object 3E (9)
field goal_parade_record 0B scale_shift u8     # 01349F -> object 44 (1)
# The record of a sounding_scenery (sounding_scenery_update 01353F-013572, from field 18; three, 02B69C,
# 02BA44, 02CAD0): road_row_record's fields, then the sound where a hit box would be
struct sounding_scenery_record 12 rom
field sounding_scenery_record 00 animation u16          # 013543 "movz.hw [R10+], R9": animation_start's
field sounding_scenery_record 02 palette u16            # 013546 -> object 3A
field sounding_scenery_record 04 flags u8               # 01354B: or-ed into object 00
field sounding_scenery_record 05 size_table u8          # 01354F -> object 45
field sounding_scenery_record 06 scale_shift u8         # 013554 -> object 44
field sounding_scenery_record 07 side s8                # 013559 -> object 3F
field sounding_scenery_record 08 x_offset s16           # 01355E -> object 20
field sounding_scenery_record 0A y_offset s16           # 013563 -> object 24
field sounding_scenery_record 0C spacing u16            # 013568 -> object 10
field sounding_scenery_record 0E count u16              # 01356D -> object 12
field sounding_scenery_record 10 sound u16              # 013572 "mov.h [R10], 80[R20]" (4A, 47, 46); its address -> object 60
# A traffic object's record (field 18: traffic_car_start 013900-013939, traffic_figure_update 013BB8-013C0C):
# the address of its sprite record, the side of the road, x_offset and speed (each list of stage_road_object_lists)
struct traffic_record 0A rom
field traffic_record 00 sprite u32 traffic_sprite_record   # 013904 "mov.w [R10+], R11"
field traffic_record 04 side s16              # 01392F "movt.hb [R10+], 3F[R20]": its low byte -> object 3F (-1, 0, 1)
field traffic_record 06 x_offset s16          # 013934 "movs.hw [R10+], 20[R20]" -> object 20
field traffic_record 08 speed s16             # 013939 -> object 2C
# What a traffic_record's first word points at (traffic_car_start 013907-01392B, traffic_figure_update
# 013BBF-013BF9): the animation, palette, the sounds of passing it and of hitting it, its weight, then its hit
# box, whose address goes to object 60 (030B60-031514, 10 apart)
struct traffic_sprite_record 10 rom
field traffic_sprite_record 00 animation u16     # 013907 "movz.hw [R11+], R9": animation_start's
field traffic_sprite_record 02 palette u16       # 01390F -> object 3A
field traffic_sprite_record 04 passing_sound u8  # 01391A -> object 81
field traffic_sprite_record 05 hit_sound u8      # 013920 -> object 82
field traffic_sprite_record 06 weight u16        # 013926 -> object 6A
field traffic_sprite_record 08 hit_box u16[4]    # its address -> object 60 (01392B), where traffic_hit_check reads it (030B60: 48 0 -20 20, decimal)
# The traffic of a stage (each list of stage_road_object_lists, from traffic_spawner field 18; 647 entries, closed by
# 8000 FFFF): traffic_spawner_update 013821-013814 starts the entries whose position, plus the stage's start, is
# within the draw distance of the leader's view, when their level is not above traffic_level
struct traffic_spawn_entry 10 rom
field traffic_spawn_entry 00 position s16          # 013821 "mov.h [R10+], R0", + stage_start (add.h; blt: signed) -> object 1C
field traffic_spawn_entry 02 level u16             # 013839 "cmp.h [R10+], 2C[R20]" (bl: unsigned): 0-E, against traffic_level
field traffic_spawn_entry 04 handler u32           # 013809 "mov.w [R10+], 4[R21]": the new object's handler
field traffic_spawn_entry 08 stop_distance u32     # 01380E "movt.wh [R10+], 84[R21]": its low half -> object 84
field traffic_spawn_entry 0C record u32            # 013814 "mov.w [R10+], 18[R21]": its traffic_record (traffic_line_record for a leader)
# The record a traffic leader starts with (traffic_car_start_convoy 01389E-0138D9, traffic_figure_start_team
# 013B56-013B8D, from field 18): the distance between the vehicles of the line, then the records of the ones
# behind it (traffic_follower, pulled_vehicle), closed by 0, then the leader's own traffic_record (030F90: 2,
# eight followers; 0311DC-0312C8: 1, one)
struct traffic_line_record 04 rom
field traffic_line_record 00 spacing u32         # 0138A2, 013B5A "mov.w [R10+], R0" (its low half: sub.h R0, R1)
# The records of the vehicles behind a traffic leader, after its traffic_line_record's spacing (0138D9, 013B91
# "mov.w [R10+], R12"), closed by 0: each one's traffic_record, into the new object's field 18
elements traffic_line_followers u32 traffic_record
field object_area 10 slots u8[7C]                    # a byte an object slot: FF used, 0 free
field object_list 00 count u16
field object_list 02 objects u16[7F]                 # the objects on the list (their places' low halves), count of them
field object 08 slot u8                # its slot in the objects' area (start_object), which run_objects frees when it dies
field object 00 flags u8               # bit 0: the object is live (run_objects runs it; else it frees its slot)
field object 04 handler u32            # the code run_objects runs for it each frame ("jsr [4[R20]]", 011CD2)
field object 0C state u8               # the step its handler is at: most handlers go by it through a table
field object 09 number u8              # what the code that starts it numbers it by: its place in its start list (start_object_list), a choice flag's player
field object 0A car u8                 # a choice flag's car (car_select_entries_run)
field object 0B car_colour u8          # the car whose colours the coin prompt's pieces take (coin_prompt_update)
# How draw_object draws it (by draw_mode, through draw_object_mode_jumps): an animation of the animations (sprite_animations),
# each a list of frames, each a list of pieces; the palette word (sprite_palettes); flags bits 6-7 flip it
field object 30 x u16                  # draw mode 0: its place on the screen, less the screen's scroll (screen 14, 16)
field object 32 y u16
field object 34 width_scale u16        # the pieces' width on the screen (sprite word 3) = their size * this >> 8
field object 36 height_scale u16       # ... and their height (sprite word 2)
field object 38 animation u16          # the animation it shows (sprite_animations)
field object 3A palette u16            # its palette (sprite_palettes: the sprites' palette words)
field object 3E draw_mode u8           # how draw_object places it: 0 on the screen at x, y; others on the road
field object 40 frame u8               # the frame of its animation
field object 43 size_step u8           # the row of piece sizes its pieces take (0x122B74, 3 a frame piece)
field object 44 scale_shift u8         # the road modes shift the road's scale left by it
field screen 20 race_copy u32 race     # 20FC00 for screen 1, 20FC80 for screen 2
field screen 24 race u32 race          # 20FB00 for screen 1, 20FB80 for screen 2

# ======== the frame loop ========
# 0008F0-000912: the program waits for the next frame polling 23[R24] (20E023), which an interrupt sets,
# and clears it; while B00[R25] says data is being unpacked it calls 010E42 for a piece of it each time
000908  code  frame_wait_loop    # "test.b 23[R24]": the poll
00090D  code  frame_wait_done    # the wait is over: a frame is done

# ======== the tasks ========
# The program runs two tasks, each on a stack of its own: the one boot starts runs the loop of screen 2
# (R25 = 218000, 000719), the other the loop of screen 1 (R25 = 208000, 0006B0). Boot (0005C5-0005EF)
# copies the second one's first interrupt frame (registers, PC 0006B0, PSW 00040000) from 000C98 to
# 21FF84, and keeps its stack pointers at 0[R24] (the frame) and 4[R24] (21F800, its L0SP). When 24[R24]
# is clear, the VBLANK handler swaps them (03F5FC): it stores the running task's pair there and returns
# into the other one
0006B0  func  second_task        # where the second task's first frame returns to
task  second_task
000719  func  second_task_frames   # both screens' frames from screen 2's, which second_task runs until the test mode
exit  second_task_frames  00077F   # the test mode: there second_task_frames goes back to second_task
03F5FC  code  task_swap          # 03F5FC-03F608: the running task's stacks go to 0[R24] and 4[R24], the other one's come back
03F60C  code  task_swap_done     # the handler goes on with the other task's interrupt frame: it returns into that task

# ======== the objects ========
# Below each screen's block (screen - 8000): this frame's list of objects at -8000 (a count, then the low
# halves of their addresses), the next frame's at -7FF8 (the two lists, at -7E00 and -7D00, swap every
# frame), the used slots at -7FF0 (7C bytes, FF used), a spare object at -7F00 and the 124 objects from
# -7C00, 100 bytes each
011CC0  func  run_objects        # the object loop: each live object of this frame's list (flags bit 0) has its handler run and goes on the next frame's list; a dead one frees its slot; then this frame's list is cleared and the two swap
011D43  func  start_object       # the first free slot: its 100 bytes cleared, live (flags bit 0), its slot number at 8, on this frame's list; R21 = the object (the spare at screen - 7F00 when no slot is free)
comment run_objects The object loop, once a frame for the screen: each live object (flags bit 0) of this frame's list (screen - 8000) has its handler run and goes on the next frame's list (screen - 7FF8); a dead one frees its slot (its byte at screen - 7FF0, by its slot number at 8). Then this frame's list is cleared and the two lists swap.
comment start_object Takes the first free object slot of the screen (FF into its byte at screen - 7FF0), clears its 100 bytes, makes it live (flags bit 0) with its slot number at 8, puts it on this frame's list and returns it; with no slot free, it returns the spare object at screen - 7F00 without any of that.

# ======== object handler lists ========
# A 32-bit count, then that many handlers: the code takes a list with "movea.b list[PC], R10" and starts an
# object per handler with "mov.w [R10+], R8" (the count) and "mov.w [R10+], 4[R21]" (011E2C-011E35); the
# object loop calls the handler at field 4 (011CD2, "jsr [4[R20]]")
003470  data  player_car_object_handlers  record=4 count=1 code=0    # the count at 00346C; list taken at 003133
003478  data  race_object_handlers  record=4 count=19 code=0   # the count at 003474; list taken at 003161
0034C8  data  demo_race_object_handlers  record=4 count=9 code=0    # the count at 0034C4; list taken at 003170
0034F0  data  route_map_object_handlers  record=4 count=1 code=0    # the count at 0034EC; list taken at 003257
001A7C  data  car_presentation_object_handlers  record=4 count=3 code=0    # the count at 001A78; list taken at 0014BA
002D5C  data  name_entry_object_handlers  record=4 count=4 code=0    # the count at 002D58

# Tables of lists taken by an index: "mov.w table[PC](R0), R10", then the records with [R10+]
014A20  data  ending_actor_lists  pointers=16 record=8 count=prefix32 code=0 data=4   # 0146E9-014709: a 32-bit count, then (handler -> field 4, data -> field 80) pairs
014A60  data  unfinished_ending_actor_count  record=8 count=prefix32 code=0 data=4    # the same, taken whole at 0146DB
0181B8  data  stage_background_object_lists  pointers=62 record=8 count=bytes32 code=0 data=4  # 017BD2-017BF6: the records' length in bytes (the count is >> 3), then (handler, data) pairs
02E1F0  data  stage_road_object_lists  pointers=32 record=16 end=FFFF8000 code=4 data=12  # 0137F1, 013809-013821: (position, type, handler -> field 4, field 84, field 18) records, closed by 8000 FFFF
00DF78  data  entry_invitation_object_handlers  record=4 count=3 code=0    # the count at 00DF74; list taken at 00DE57
000F74  data  isdn_connection_object_handlers  record=4 count=1 code=0     # the count at 000F70: game mode 8's (the ISDN connection)

# The objects of each stage's road: a stream of (position, command) halfword pairs, taken from this table by
# the stage's number (012720 and 0127BF, "mov.w 20800(R0), 80[R20]") and read at 01272C-012746 as the road
# goes by. Command 0 starts an object (handler -> field 4, then a parameter -> field 18, 012758); 1 ends the
# stage's stream, which goes on from this table when the next stage starts (012777, 0127A4-0127CA); 2 ends
# it for good (01279C); 3 is a fork: a table of the streams of its branches follows, and the one the route
# takes, C9[R23], goes on when the stage changes (012786, 0127CD-0127EB)
020800  data  road_object_streams  pointers=32 record=12 kinds=2:0=12,1=end,2=end,3=fork code=4 data=8

# A timeline: (frame, routine) pairs that 01AE0D-01AE2C calls when the object's counter, 10[R20], reaches the
# frame, from the address 01ADFC puts in 80[R20]; closed by frame 0000FFFF
01AFC0  data  timeline_1AFC0  record=8 end=0000FFFF code=4
01AE24  code  timeline_call  calls=timeline_1AFC0    # "jsr [R1]": the routine of the record the counter reached

# The radio DJ's voice lines: (sound << 24 | address) records; the address is a string of mouth shapes
# (indices into 018AE8, pairs of the LCD's custom characters, shown in its characters 0-1) closed by a
# negative byte. start_dj_message (019402) starts line R0 (the sound through request_sound, the string's
# address to F30[R25]); 0189D9 shows its next shape every third frame
019576  data  dj_messages  record=4 count=61 data=0

# 019266-019294: lists of routines an object runs one after another, a step each time; 019280 picks the list
# by a number below 14 and keeps its place at 38[R20]
01966C  data  dj_remark_lists  pointers=14 record=4 end=00000000 code=0
0196F8  data  dj_mouth_shapes      # the DJ's mouth shapes, a string a message (dj_messages' low 24 bits point at them): shapes 0-2 (dj_face_characters), lcd_update one every third frame (0189F3), closed by a negative byte
019294  code  routine_list_jump  calls=dj_remark_lists   # "jmp [R0]": the list's next routine

# ======== code and data nothing uses ========
# No scenario runs or reads them, and no table or instruction holds their addresses: functions nothing
# calls, code a branch or a jump right before it always goes past, and tables nothing reads. The "func"
# ones are decompiled too. The "code" ones are left out of the C: they jump or call into the middle of
# functions the game runs, and their C would cut those functions in two (tools/coverage.py counts them
# as code all the same)
0002E6  code  unused_0002E6      # unused: what the branch before it skips, then on into the code at 0002EA
0002FD  code  unused_0002FD      # unused: runs into the code at 00041B
000303  code  unused_000303      # unused: what the branch before it skips, then on into the code at 00041B
000310  func  eeprom_read_one_word         # unused: what the branch before it skips
000327  func  reload_settings         # unused: what the branch before it skips
000354  func  eeprom_write_one_word         # unused
000EA4  func  isdn_status_update         # the handler of isdn_connection_object_handlers, which game mode 8 (the ISDN connection) starts
0010CD  func  bar_picture_start         # unused: starts objects (011D43)
001737  code  unused_001737      # unused object set-up; its handler (001820) calls into 011EB8 at 011EC0
001783  code  unused_001783      # unused object set-up, like unused_001737
0017CF  code  unused_0017CF      # unused object set-up, like unused_001737
# Five tables by the screen's attract_car (screen 9C), read only by the unused object set-ups before them:
# unused_0017CF's sound (into its field B, which its handler at 001820 hands to request_sound: the car's name),
# then the animation and palette of unused_001783's sprite (at 50 A0), of unused_001737's (at A0 A0) and the
# palette of unused_0017CF's car caption letters (animation 26E, its frame by the car)
00183B  table unused_attract_car_name_sounds  u8           # unused (unused_0017CF "mov.b 183B[PC](R0), B[R20]"): 60-67 (62 66 61 65 60 64 63 67), then a byte of padding
001844  table unused_attract_car_animations_2  u16         # unused (unused_001783 "movz.hw 1844[PC](R0), R9"): 0DD6-0DDD
001854  table unused_attract_car_palettes_2  u16           # unused (unused_001783 "mov.h 1854[PC](R0), 3A[R20]"): 00B6-00BD
001864  table unused_attract_car_animations_1  u16         # unused (unused_001737 "movz.hw 1864[PC](R0), R9"): 03AC-06D8, 74 apart
001874  table unused_attract_car_palettes_1  u16           # unused (unused_001737 "mov.h 1874[PC](R0), 3A[R20]"): 7E 83 97 9C 88 8D A1 92
001884  table unused_attract_car_caption_palettes  u16     # unused (unused_0017CF "mov.h 1884[PC](R0), 3A[R20]"): 029B-02A2
004578  func  route_map_leg_car_end         # unused: after a jump that always leaves (to 00EAE4)
009EFC  table unused_car_animations  u16                 # unused: 0DC6-0DCD, eight numbers like the attract mode's unused animations by car (0DD6-0DDD at 001844)
# Ten 32-bit numbers nothing reads, the same three times, each between a table and the code after it (006EC8,
# 009FE4, 01060C): 150 150 110 110 300 1600 80 200 100 100 (decimal)
006EC8  table unused_numbers_006EC8  u32                  # unused: after mega_driver_title (and two bytes of padding)
009FE4  table unused_numbers_009FE4  u32                  # unused
01060C  table unused_numbers_01060C  u32                  # unused: after segment_projection_pattern
00A337  code  unused_00A337      # unused: what the branch before it skips, then on into the code at 00A373
00AB04  data  distance_offset_functions  record=4 count=8 code=0   # unused: the addresses of the code after it (00AB24, 00AB36)
00AB66  code  unused_00AB66      # unused: the code of distance_offset_functions, on into the code at 00A71B
00C552  func  lap_timer_spare_return         # unused: an rsr after a jump that always leaves (to 00EAE4)
00C8B5  func  stage_entry_spare_return         # unused: an rsr after the function's own rsr
00CEA4  func  time_to_text_thousandths         # unused: what the branch before it skips
00D658  func  network_check_delay         # unused
00D797  code  unused_00D797      # unused: what the branch before it skips, then on into 00D7CB
00D7B1  code  unused_00D7B1      # unused: what the branch before it skips, then on into 00D7CB
# Two tables of a byte a segment out from the window, like segment_projection_pattern after them, which nothing
# reads: 4 for 9 segments, 3 for 19, 2 for 28, 1 for 56, 0 for 153, -1 for 19; and -2 for 28, -3 for 56, -4 for 144
010309  table unused_segment_steps  s8                    # unused: right after rotate_offset's code
010425  table unused_segment_shifts  s8                   # unused
01078F  func  clear_tile_pages         # unused
010996  func  unrolled_copy         # unused: copies by jumping into an unrolled run of moves
010F66  func  unpack_list         # unused
010FA6  func  queue_unpack_list         # unused
011314  func  bookkeeping_increment8         # unused
011362  func  bookkeeping_add8         # unused
011388  func  bookkeeping_set32         # unused
011393  func  bookkeeping_set8         # unused
01142A  func  bookkeeping_check_block         # unused
0117FE  func  load_shadowed_text_font         # unused
011896  code  unused_011896      # unused: calls into 011874 at 011884
0118BD  func  erase_text_layer_to_blank_character         # unused
0118D2  func  print_text_layer_halfwords         # unused
0118F7  func  erase_text_layer_to_blank_cell         # unused
011914  func  print_hex_halfword         # unused: what the branch before it skips
01191C  func  print_hex_24_bits         # unused: what the branch before it skips
011928  func  print_hex_word         # unused: what the branch before it skips
011958  func  bcd_to_binary         # unused
0119B1  code  unused_0119B1      # unused: on into the code at 011A7C
011AAD  code  unused_011AAD      # unused: what the branch before it skips, then on into the code at 011C27
011B29  code  unused_011B29      # unused: an entry into the code at 011B9D, on into 011C27
011B39  code  unused_011B39      # unused: an entry into the code at 011B9D, on into 011C27
011B49  code  unused_011B49      # unused: an entry into the code at 011B9D, on into 011C27
011B58  code  unused_011B58      # unused: an entry into the code at 011B9D, on into 011C27
011B64  code  unused_011B64      # unused: an entry into the code at 011B9D, on into 011C27
011B74  code  unused_011B74      # unused: an entry into the code at 011B9D, on into 011C27
011B84  code  unused_011B84      # unused: an entry into the code at 011B9D, on into 011C27
011B93  code  unused_011B93      # unused: an entry into the code at 011B9D, on into 011C27
011DEB  func  reserve_object_slot         # unused
011E1D  func  free_object_slot         # unused
011EF4  func  request_second_sound         # unused
01248C  func  road_row_pair_crash_check_unflipped         # unused: called only by unused_0129D0
0129D0  code  unused_0129D0      # unused object handler: goes by its state (C[R20]) through the table after it, into 00F911 at 00F916
017D70  func  backdrop_far_start         # unused object handler
017DE4  table backdrop_far_state_jumps  u32   # backdrop_far_update (017DE0 "jmp [R0]") jumps through it by state: 017DEC 017DF4
# A backdrop sprite's data (the data, 80, of backdrop_far, backdrop_near, backdrop_landmark,
# backdrop_flashing and backdrop_translucent; stage_background_object_lists): their starts read it with [R10+] from
# "mov.w 80[R20], R10" (017D7E, 017E29, 017F00, 018017, 0180D9): "mov.w [R10+], R9" (animation_start's: 017D83),
# "mov.h [R10+]" into 3A, 20, 24, 28 (017D86-017D95); backdrop_landmark_start also "neg.w [R10], R0" (017F2C):
# approach_distance, which only the landmarks' records have (the others are 12 bytes); census ROM 0182D4-01847B
# (translucent: 000129 0112 0097 0080 0065, ...; landmarks: 000144 014A 0200 0000 00C1 00000100, ...)
struct backdrop_record 10 rom
field backdrop_record 00 animation u32
field backdrop_record 04 palette u16
field backdrop_record 06 panorama_x u16
field backdrop_record 08 height u16
field backdrop_record 0A half_width u16
field backdrop_record 0C approach_distance u32
018009  func  backdrop_flashing_start         # unused object handler
018094  table backdrop_flashing_state_jumps  u32   # backdrop_flashing_update (018092 "jmp [R0]") jumps through it by state: 01809C 0180A4
01AFDC  func  kanji_text_viewer_update         # unused object handler: goes by its state (C[R20]) through the table after it
01B248  table unused_kanji_text_viewer_words  u16      # unused: 48D8 093C 0990 0984 09B4 0000, between the kanji text viewer's code and its kanji_texts
01EA14  func  test_mode_duration_to_seconds         # unused: what the branch before it skips
01EA4B  func  test_mode_split_minutes_seconds         # unused
# The traffic's records, which the entries of stage_road_object_lists point at (their record, field 18 of the
# object they start): traffic_sprite_record (animation, palette, sounds, weight, hit box: traffic_car_start
# 013907-01392B, traffic_figure_update 013BBF-013BF9, traffic_hit_check 01267C-012685), traffic_record (12 apart:
# its last two bytes nothing reads; traffic_car_start 013904-013939) and the leaders' traffic_line_record with
# their followers (traffic_car_start_convoy 0138A2, 0138D9; traffic_figure_start_team 013B5A, 013B91)
030B60  data  traffic_records
03F7D8  code  unused_03F7D8      # unused: what the branch before it skips, then on into the code at 03F801
03F86C  code  link_unused_case   # unused: a case of int_vector_44 (R0 and R1 pushed) its table at 03F85C does not list; it runs into the shared ending at 03F895

# ======== road objects (naming batch A) ========
00EAE4  func  draw_object
00F30D  func  animation_advance
00F366  func  animation_start
00F5C8  func  road_row_draw
00F911  func  road_row_pair_draw
0122E3  func  fork_sign_hit_check
0122E8  func  road_row_crash_check
0122EB  func  road_row_hit_check
0123AF  func  road_row_pair_crash_check
01287C  func  scenery_update
012894  func  road_row_start
012906  func  flashing_scenery_update
012914  table flashing_scenery_state_jumps  u32   # flashing_scenery_update (01290F) jumps through it by state: 012920 012986 01298C
012708  table road_object_stream_state_jumps  u32   # road_object_stream_read (012705) jumps through it by state: 012718 01272C 0127A4 0127CD
012748  table road_object_stream_command_jumps  u32   # road_object_stream_read (01273B, "jsr [R1]") calls through it by the entry's command: road_object_stream_start_object road_object_stream_stage_end road_object_stream_end road_object_stream_fork
0127FC  table crest_clip_state_jumps  u32   # crest_clip_update (0127F7) jumps through it by state: 012804 012831
012888  table scenery_state_jumps  u32   # scenery_update (012885) jumps through it by state: road_row_start 0128FA 012900
0129B8  table scenery_pair_state_jumps  u32   # scenery_pair_update (0129B4) jumps through it by state: road_row_start 0129C4 0129CA
0129DC  table unused_0129D0_state_jumps  u32  # unused_0129D0 jumps through it by state: road_row_start 0129E8 0129EE; after a byte of padding
012A00  table overhead_scenery_state_jumps  u32   # overhead_scenery_update (0129FD) jumps through it by state: 012A0C 012A14 012A14
012A2C  table aurora_state_jumps  u32   # aurora_update (012A29) jumps through it by state: 012A38 012A7B 012A8C
012ADC  table fork_sign_state_jumps  u32   # fork_sign_update (012AD8) jumps through it by state: road_row_start 012AE8 012900
012B00  table animated_scenery_state_jumps  u32   # animated_scenery_update (012AFD) jumps through it by state: road_row_start_copy 012B72 012B78
012B90  table animated_scenery_pair_state_jumps  u32   # animated_scenery_pair_update (012B8D) jumps through it by state: road_row_start_copy 012B9C 012BA2
012BBC  table road_crosser_state_jumps  u32   # road_crosser_update (012BB7) jumps through it by state: 012BCC 012C3D 012C4A 012C66
012CB8  table kangaroo_state_jumps  u32   # kangaroo_update (012CB3) jumps through it by state: 012CC8 012D2B 012D38 012D54
012DC4  table moving_scenery_state_jumps  u32   # moving_scenery_update (012DC0) jumps through it by state: 012DD0 012E46 012E53
012EB0  table swooping_helicopter_state_jumps  u32   # swooping_helicopter_update (012EAB) jumps through it by state: 012EC0 012F42 012F5C 012F6D
012FC8  table start_gate_state_jumps  u32   # start_gate_update (012FC5) jumps through it by state: 012FD8 01303E 01304A 013067
01306E  table start_gate_light_palettes  u16   # start_gate_update (013059 "mov.h 1306E[PC](R0), 3A[R20]"): the lights' palette by the seconds left to the start, rounded up: CA (0, the start), CB, CC, then C9 (3 on)
01308C  table start_flagman_state_jumps  u32   # start_flagman_update (013087) jumps through it by state: 013098 0130CD 0130EA
013110  table flagman_state_jumps  u32   # flagman_update (01310D) jumps through it by state: 01311C 013174 01318C
0131B0  table start_balloon_state_jumps  u32   # start_balloon_update (0131AE) jumps through it by state: 0131BC 0131EB 0131F4
013238  table ambient_sound_state_jumps  u32   # ambient_sound_update (013236) jumps through it by state: 013244 013255 013269
0132A4  table west_east_panel_state_jumps  u32   # west_east_panel_update (01329F) jumps through it by state: 0132B4 0132E4 0132F5 013329
013348  table santa_sleigh_state_jumps  u32   # santa_sleigh_update (013345) jumps through it by state: 013358 0133D6 0133E3 013415
01345C  table goal_parade_rightward_state_jumps  u32   # goal_parade_rightward_update (013458) jumps through it by state: 01346C 0134D1 0134DE 0134FB
01352C  table sounding_scenery_state_jumps  u32   # sounding_scenery_update (013527) jumps through it by state: 01353C 0135A8 0135A8 0135C0
0135D8  table goal_parade_leftward_state_jumps  u32   # goal_parade_leftward_update (0135D5) jumps through it by state: 0135E8 01364D 01365A 013677
0136A8  table goal_parade_dragon_state_jumps  u32   # goal_parade_dragon_update (0136A3) jumps through it by state: 0136B8 01370F 01371C 013733
013778  table traffic_spawner_state_jumps  u32   # traffic_spawner_update (013775) jumps through it by state: 013780 0137CC
0138F8  table traffic_car_state_jumps  u32   # traffic_car_update (0138F4) jumps through it by state: traffic_car_start 01394D
013B04  table traffic_stopping_car_state_jumps  u32   # traffic_stopping_car_update (013B02) jumps through it by state: traffic_car_start 013B0C
013BB0  table traffic_figure_state_jumps  u32   # traffic_figure_update (013BAC) jumps through it by state: 013BB8 013C5D
013D45  table traffic_shake_frame_offsets  u8   # traffic_car_draw (013A75 "mov.b 13D45[PC](R1), R1"): added to the frame the angle picks, by shake (1-20 after a hit): 0 -1 -2 -3 -4 -3 -2 -1 0 1 2 3 2 1 0 -1 -2 -1 0 1 0
013DF0  table fork_branch_state_jumps  u32   # fork_branch_draw (013DED) jumps through it by state: 013DF8 013E0F
034308  table fork_branch_piece_animation  sprite_animation_pointer   # fork_branch_sprite (014066 "mov.w 34138(R26), R26" with R26 = 74): entry 74 of the animations' table (sprite_animations), the record of animation 74, the branch's piece of road
0140C8  table fork_branch_stage_palettes  u16   # fork_branch_sprite (0140A7 "movz.hw 140C8[PC](R15), R15"): the palette (into sprite_palettes) of the branch's road piece by the stage being built (screen built_stage), 32 stages
0129AB  func  scenery_pair_update
0129F4  func  overhead_scenery_update
012ACF  func  fork_sign_update
012AF4  func  animated_scenery_update
012B0C  func  road_row_start_copy
012B84  func  animated_scenery_pair_update
012BAE  func  road_crosser_update
012DB7  func  moving_scenery_update
013104  func  flagman_update
comment scenery_update Static scenery along the road (trees, buildings, crowds, banners, signs): a row of identical sprites from its record. By state: 0 road_row_start; 1 road_row_crash_check, then road_row_draw; 2 (a record without a hit box) road_row_draw only. Ends when road_row_draw finds the whole row behind the view.
comment scenery_pair_update Static scenery drawn twice, at each side of the road, the second mirrored (rows of trees, houses, spectators). By state: 0 road_row_start; 1 road_row_pair_crash_check, then road_row_pair_draw; 2 (no hit box) road_row_pair_draw only.
comment fork_sign_update The signs on the road where it forks at the end of a stage: a line down the middle before the fork and a line across each branch after it. By state: 0 road_row_start; 1 fork_sign_hit_check, then road_row_draw; 2 road_row_draw only. A car that hits one is slowed, not crashed.
comment fork_sign_hit_check road_row_hit_check with kind 3 (R27): a car that hits a fork sign is slowed for 15 frames, as off the road (car slowed_frames), instead of crashing.
comment animated_scenery_update Scenery that animates in place (the Ferris wheel, windmills; also the scenery of the goal lines). By state: 0 road_row_start_copy; 1 road_row_crash_check; 1 and 2 animation_advance and road_row_draw.
comment animated_scenery_pair_update Animated scenery drawn twice, at each side of the road, the second mirrored (the people lining the start and the goal, the scenery around the forks). By state: 0 road_row_start_copy; 1 road_row_pair_crash_check; 1 and 2 animation_advance and road_row_pair_draw.
comment flashing_scenery_update Scenery whose palette cycles a step every frame, for flashing lights (the Christmas trees, the arches over the underwater tunnel, a fairground ride). By state: 0 reads its record as road_row_start does, except that the second and third halfwords are the address of its list of palettes (palette_cycle) instead of a palette; 1 road_row_crash_check; 1 and 2 the next palette from the list into palette (a negative entry goes back that many bytes first), then road_row_draw.
comment overhead_scenery_update Animated scenery high over the road, drawn from the middle of the screen instead of the road's centre line (screen_centered), so it does not swing with the bends: the schools of fish over the underwater tunnel, the cloud bands of stage 25. By state: 0 screen_centered = FF, then road_row_start (its records have no hit box); 1 and 2 animation_advance and road_row_draw.
comment flagman_update The man waving a chequered flag at each fork and at the goal. By state: 0 reads the record (animation, in_view_animation, palette, side, x_offset, y_offset), draw_mode 9, scale_shift 1, appear_position = position - draw_distance (and 58 = position - 30, never read); 1 not drawn until the view (race_copy window_segment) passes appear_position, then in_view_animation (06F, the waving; so 06E is never drawn); 1 and 2: ends once the car (car window_segment) reaches its position, else animation_advance and draw_object.
comment road_crosser_update What walks across the road as the car comes near (the camels of the desert stages). By state: 0 reads the record (animation, crossing_animation, palette, flags, side, x_offset, trigger_distance, x_speed, draw_mode, scale_shift; y_offset -256 for animation 165), trigger_position = position - trigger_distance, appear_position = position - draw_distance; 1 not drawn until the view (race_copy window_segment) passes appear_position; 2 drawn standing (draw_object) until the car (car segment) reaches trigger_position, then crossing_animation; 3 while the car (car window_segment) has not reached it: x_offset += x_speed and position + 1 each frame, and while within draw_distance of the car animation_advance and draw_object; it ends when the car reaches it, it gets beyond draw_distance or its screen_x leaves -F0..130.
comment moving_scenery_update Scenery that travels across the view once the car comes near (helicopters, the roller coaster train, birds, fish over the tunnel, a tanker truck on a bridge). By state: 0 reads the record (animation, palette, flags, draw_mode, scale_shift, side, x_offset, y_offset, trigger_distance + 16, x_speed, y_speed, road_speed), trigger_position = position - trigger_distance; 1 not drawn until the view (race_copy window_segment) passes trigger_position; 1 and 2: while the car (car window_segment) has not reached it, each frame x_offset += x_speed, y_offset += y_speed, position += road_speed, and while within draw_distance of the car animation_advance and draw_object; it ends when the car reaches it, it gets beyond draw_distance or its screen_x leaves -F0..130.
comment road_row_start Sets up a row of identical sprites along the road from its record (record): animation (animation_start), palette, flags bits to set (bit 6 mirrors the sprites), size_table, scale_shift, side, x_offset, y_offset, spacing, count and the hit box (hit_box points at it; none when its first 32 bits are 0); first_position = position, end_position = position + spacing * (count - 1) + 1. Goes on to the next state, or the one after it (no hit check) without a hit box. Used by scenery, scenery_pair, fork_sign and overhead_scenery.
comment road_row_start_copy The same code as road_row_start, at another address: the first step of animated_scenery and animated_scenery_pair.
comment road_row_hit_check Whether the screen's car hits an item of the row, unless the car's object has flags bit 3 set: the car's box (the entry screen->own_hit_box points at: its segments at +6 and +8, along the road +A..+C in 128ths of a segment from its first, across +E..+10) against each item's hit_box (along from (item - the car's first segment) * 128 + position_fraction, across from the road's width * side + x_offset), for the items from first_position to end_position within the car's segments. On the first that overlaps: the car's object gets flags bit 2 and byte 6E = R27, the kind of hit (0 a crash, 3 slowed), and the car's hit_along and hit_across half the distances from the car's box to the item's (along, across).
comment road_row_crash_check road_row_hit_check with kind 0 (R27): hitting an item crashes the car. Used by scenery, animated_scenery and flashing_scenery (and 012FBC).
comment road_row_pair_crash_check road_row_hit_check for the rows drawn in mirrored pairs, with kind 0 (a crash): each item's hit box is tested as it is and mirrored across the road's centre. Used by scenery_pair and animated_scenery_pair.
comment road_row_draw Draws the row's items in view: ends the object once end_position is not past the view's start (race_copy window_segment); nothing while first_position is beyond the draw distance (screen->draw_distance >> 7 segments); moves first_position up to the first item in view; for each item (spacing apart, to the draw distance) where the road has a scale: x = (the road's width * side + x_offset) * scale >> 12 plus the road's screen x unless screen_centered, y = y_offset * scale >> 12 plus the road's screen y; off the screen (x beyond -1E0..1E0, y beyond -160..80) it is skipped, else the scale shifted by scale_shift picks the size (size_table: a size step and a shift) and a sprite of the animation's frame with its palette (flags bits 6-7 flip it) goes into the screen's sprite list (sprite_list_last; the copy at +3000 is the halfway point from the item's sprite of the frame before, previous_sprites) and the depth list of its road segment (screen + 5000). Sets flags bit 5 and keeps where its sprites went in previous_sprites. Used by scenery, fork_sign, animated_scenery, flashing_scenery and overhead_scenery (and 01351E).
comment road_row_pair_draw road_row_draw for the rows drawn in mirrored pairs: each item twice, at the same distance either side of the road's centre, the second with sprite attribute bits 43 toggled (bit 6 flips it, bits 0-1 swap its X alignment); there is no off-screen test and no screen_centered. Used by scenery_pair and animated_scenery_pair.
comment animation_start Starts animation R9 (sprite_animations[R9] is its record) at its first frame: frame_time and frame_countdown from the record's first byte, size_step 0, and fields 34 and 36 to 100 (the width and height zoom of the screen-position drawing, draw_object_on_screen: 100 the sprite's own size).
comment animation_advance Steps the object's animation: nothing while frame_time is 0; when frame_countdown runs out (back to frame_time), the next frame. A frame's entry in the record (32 bits at +4 + frame * 4) is the address of its data when positive, else an order: 0 holds the frame before (frame_time 0), -1 goes back to frame 0, -2 starts the animation whose number is the next entry.
comment draw_object Draws the object's sprite, unless flags bit 1 is set or the screen's sprite list is full: field 3E picks the routine (draw_object_mode_jumps): some project the object's road position (1C) with its offsets (20, 24) and set fields 30 and 32 to where it lands and 3C to the road's depth layer there, some draw it at the screen position in 30 and 32, some copy a ready sprite entry from the address in field 38; then links it into the depth list of layer 3C (screen + 5000).
scoped object flashing_scenery 10 spacing u16
scoped object flashing_scenery 12 count u16
scoped object flashing_scenery 18 palette_cycle u32 rom
scoped object flashing_scenery 1C position s16
scoped object flashing_scenery 20 x_offset s16
scoped object flashing_scenery 24 y_offset s16
scoped object flashing_scenery 3F side s8
scoped object flashing_scenery 45 size_table u8
scoped object flashing_scenery 56 first_position s16
scoped object flashing_scenery 58 end_position s16
scoped object flashing_scenery 60 hit_box u32 rom
scoped object overhead_scenery 5C screen_centered u8
scoped object flagman 10 draw_distance u16
scoped object flagman 18 record u32 flagman_record
scoped object flagman 1C position s16
scoped object flagman 20 x_offset s16
scoped object flagman 24 y_offset s16
scoped object flagman 3F side s8
scoped object flagman 56 appear_position s16
scoped object flagman 80 in_view_animation u16
scoped object road_crosser 10 draw_distance u16
scoped object road_crosser 18 record u32 road_crosser_record
scoped object road_crosser 1C position s16
scoped object road_crosser 20 x_offset s16
scoped object road_crosser 24 y_offset s16
scoped object road_crosser 26 y_offset_sign s16   # the upper half of the 32-bit stores of y_offset (its sign); the object code reads y_offset as 16 bits and nothing reads this
scoped object road_crosser 30 screen_x s16
scoped object road_crosser 3F side s8
scoped object road_crosser 56 appear_position s16
scoped object road_crosser 58 trigger_position s16
scoped object road_crosser 80 crossing_animation u16
scoped object road_crosser 82 trigger_distance u16
scoped object road_crosser 84 x_speed s16
scoped object moving_scenery 10 draw_distance u16
scoped object moving_scenery 18 record u32 moving_scenery_record
scoped object moving_scenery 1C position s16
scoped object moving_scenery 20 x_offset s16
scoped object moving_scenery 24 y_offset s16
scoped object moving_scenery 30 screen_x s16
scoped object moving_scenery 3F side s8
scoped object moving_scenery 56 appear_position s16
scoped object moving_scenery 58 trigger_position s16
scoped object moving_scenery 80 trigger_distance u16
scoped object moving_scenery 82 x_speed s16
scoped object moving_scenery 84 y_speed s16
scoped object moving_scenery 86 road_speed s16
scoped object road_row 10 spacing u16
scoped object road_row 12 count u16
scoped object road_row 18 record u32 road_row_record
scoped object road_row 1C position s16
scoped object road_row 20 x_offset s16
scoped object road_row 24 y_offset s16
scoped object road_row 28 position_fraction u16
scoped object road_row 3F side s8
scoped object road_row 45 size_table u8
scoped object road_row 50 previous_sprites u32
scoped object road_row 56 first_position s16
scoped object road_row 58 end_position s16
scoped object road_row 5C screen_centered u8
scoped object road_row 60 hit_box u32 item_hit_box
scoped object animation 41 frame_time u8
scoped object animation 42 frame_countdown s8

# ======== race objects, the LCD and the radio (naming batch B) ========
001894  func  staff_credits_code_start
0018A4  func  staff_credits_code_watch
0018E5  func  staff_credits_code_show
0018FE  func  staff_credits_code_done
00190B  func  staff_credits_code_read_controls
005030  func  car_select_start
00503D  func  car_select_run
0053DF  func  car_select_turn_to_choice
005443  func  car_select_update_rowscroll
0054BC  func  car_select_skew_floor_next
0054C1  func  car_select_skew_floor_previous
0054C4  func  car_select_skew_floor
005862  func  welcome_letter_start
005883  func  welcome_letter_show
005C71  func  transmission_label_start_automatic
005CA4  func  transmission_label_start_manual
005CE5  func  transmission_label_follow
006294  func  car_select_wait_confirm
006356  func  entry_countdown_start
0063F9  func  entry_countdown_count
006463  func  entry_countdown_done
0064E2  func  entry_banner_start
006514  func  entry_banner_blink
00652A  func  entry_car_ring_start
006560  func  entry_car_ring_draw
# The car select's records and tables of the program ROM
# Each screen's tilemap set-up for the car select (car_select_run 0050BB "movea.w 6920[PC](R0), R10" with
# R0 = screen index << 3: 20 bytes a screen; 006920 screen 1, 006940 screen 2): the addresses of the
# tilemap register copies it keeps (0050C1-0050DF "mov.w [R10+], 98/9C/A8/AC/A0/A4[R20]": 20E2A2 20E2A6
# 20E292 20E296 31C000 31C400 for screen 1), the background record for set_up_background (0050E5 "mov.w
# [R10+], R19": 006960, 006974) and the bits or-ed into video register 2 (0050F2 "or.h [R10+], 204[R24]":
# E005, E00A)
struct car_select_tilemap_setup 20 rom
field car_select_tilemap_setup 00 scroll_x_address u32
field car_select_tilemap_setup 04 scroll_y_address u32
field car_select_tilemap_setup 08 second_scroll_x_address u32
field car_select_tilemap_setup 0C second_scroll_y_address u32
field car_select_tilemap_setup 10 rowscroll_address u32
field car_select_tilemap_setup 14 rowselect_address u32
field car_select_tilemap_setup 18 background u32 background_setup
field car_select_tilemap_setup 1C video_register_bits u16
local car_select_run 0050BB r10 setup car_select_tilemap_setup
006920  table car_select_tilemap_setups car_select_tilemap_setup
006988  table entry_countdown_backgrounds  background_setup   # by screen: entry_countdown_start 00635E "movea.w 6988[PC](R0), R19" (R0 = index x 20), for set_up_background
# A sprite's animation and palette, a record of a table by car (0056D5 turntable_car_show, 0065E9
# entry_car_ring_draw, 006680 entry_traffic_car_drive "movea.w 69B8[PC](R0), R10" by the car; 005D24
# driver_couple_start "movea.w 6E58[PC](R0), R10" by the car's model), then "movz.hw [R10+], R9"
# (animation_start's) and "mov.h [R10+], 3A[R20]" (the object's palette)
struct animation_palette 4 rom
field animation_palette 00 animation u16
field animation_palette 02 palette u16
# the eight cars of the turntable (animation 401, 475 ... 72D, 74 apart; palettes 7E 7E 97 97 7E 8D 97 8D)
0069B8  table turntable_car_looks animation_palette
# the couple who drive each model (animations DD6-DDD, palettes B6-BD)
006E58  table driver_couple_looks animation_palette
local turntable_car_show 0056D5 r10 look animation_palette
local entry_car_ring_draw 0065E9 r10 look animation_palette
local entry_traffic_car_drive 006680 r10 look animation_palette
local driver_couple_start 005D24 r10 look animation_palette
# A ring of the turntable's scenery (turntable_scenery_show 005784 "movea.w 6A18[PC](R0), R10" by group * 2:
# 8 bytes, twelve groups): its animation (00578A "movz.hw [R10+], R9", animation_start's), palette (005793
# "mov.h [R10+], 3A[R20]"), size_step in the top four bits and size in the rest (005798 "mov.h [R10+], R0":
# 0140, 2400, 1300) and the offset from that last word to its list of items (0057AF "movz.hw [R10], R0",
# 0057B2 "movea.b [R10](R0), 18[R20]": angle, radius and height of each, closed by a negative angle)
struct turntable_scenery_group 8 rom
field turntable_scenery_group 00 animation u16
field turntable_scenery_group 02 palette u16
field turntable_scenery_group 04 size u16
field turntable_scenery_group 06 item_list_offset u16
local turntable_scenery_show 005784 r10 group turntable_scenery_group
006A18  table turntable_scenery_groups turntable_scenery_group
006A78  table turntable_scenery_items  u16   # the groups' items, which each group's item_list_offset reaches (turntable_scenery_show 0057BB "mov.w 18[R20], R10"): an angle, a radius and a height each (turntable_scenery_item), a list closed by a negative angle; halfwords up to 006D9B
# A letter of WELCOME! (welcome_letter_show 0058BE "movea.w 6DAC[PC](R0), R10" by index: 4 bytes): its x
# (0058C4 "mov.h [R10+], 30[R20]": 38 58 78 98 B8 D8 F8 118) and the letter, the frame of font 346 (0058D0
# "mov.b [R10+], 40[R20]": W E L C O M E !)
struct welcome_letter_place 4 rom
field welcome_letter_place 00 x u16
field welcome_letter_place 02 letter u8
local welcome_letter_show 0058BE r10 place welcome_letter_place
006DAC  table welcome_letter_places welcome_letter_place
# A piece of the car select's instructions under "To Select A Car," (select_car_heading_show 005920
# "movea.b 6DF6[PC], R10", then for each 00593A-005949 "mov.h [R10+], 18/3A/30/32[R21]": piece_animation,
# palette, x, y of a select_instruction; closed by animation 0 at 006E16): animations 2B6 2B7 284 2BA
struct select_instruction_piece 8 rom
field select_instruction_piece 00 animation u16
field select_instruction_piece 02 palette u16
field select_instruction_piece 04 x u16
field select_instruction_piece 06 y u16
local select_car_heading_show 005920 r10 piece select_instruction_piece
006DF6  table select_instruction_pieces select_instruction_piece
# A step of the path of the cars on the road behind the certificate and the entry countdown (passing_car, entry_traffic_car):
# the cars' size there, x and y; passing_traffic_start 002933 "movea.b 67B2, R10", 002944 "test.h [R10]" (0 closes it),
# 002941 "add.w #6, R10"; passing_car_update 002A0E/002A41 "movea.h 67B2(R10), R10" by its step (* 3), then "mov.h [R10+]"
# (size into 34 and 36, x, y), entry_traffic_car_drive 006706, 00676A "movea.h 67B2[PC](R10), R10"; census ROM 0067B2-0068FB: 55 steps, size 5-370, x -35-75, y 46-183
struct traffic_path_step 6 rom
field traffic_path_step 00 size u16
field traffic_path_step 02 x u16
field traffic_path_step 04 y u16
0067B2  table traffic_path  traffic_path_step
# the car select's jumps, by object state (C[R20]) unless said
005058  table car_select_state_jumps u32   # car_select_run (005055) jumps through it by state: 005084 005113 00520D 00521C 005254 00534B 00539A 0053A3 0053B2 0053C7 0053D9
0053EC  table car_select_choice_turn_jumps u32   # car_select_turn_to_choice (0053E8) by choice_turn (F[R20]): 0053F8 005400 005416
00548C  table car_select_rowscroll_copies_jumps u32   # car_select_update_rowscroll (00548A) by rowscroll_copies (E[R20]): 0054BB 00549C 00549C 0054B8
005534  table car_attendant_state_jumps u32   # car_attendant_run (00552F): 005548 00557D 0055A6 0055F8 00566A
0056C0  table turntable_car_state_jumps u32   # turntable_car_show (0056BD): 0056CC 0056F3 00EAE4 (draw_object)
005770  table turntable_scenery_state_jumps u32   # turntable_scenery_show (00576B): 005778 0057BB
005890  table welcome_letter_state_jumps u32   # welcome_letter_show (00588C): 00589C 0058ED 0058F8
005914  table select_car_heading_state_jumps u32   # select_car_heading_show (005911): 005920 005988 0059A2
0059C4  table select_instruction_state_jumps u32   # select_instruction_show (0059C1): 0059D4 0059ED 0059FD 005A0A
005A28  table transmission_choice_state_jumps u32   # transmission_choice_run (005A26): 005A3C 005A66 005A7F 005ADD 005AF6
005B50  table automatic_panel_state_jumps u32   # automatic_panel_show (005B4E): 005B5C 005BA3 005BB4
005BE4  table manual_panel_state_jumps u32   # manual_panel_show (005BDF): 005BF0 005C3E 005C4F
005D68  table car_caption_state_jumps u32   # car_caption_show (005D65): 005D74 005DB4 005DED
005E1C  table car_gears_caption_state_jumps u32   # car_gears_caption_show (005E19): 005E28 005E5C 005E91
005EC0  table waiting_banner_state_jumps u32   # waiting_banner_show (005EBD): 005ED4 005F09 005F3A 005F27 005F42
005F5C  table car_select_entries_state_jumps u32   # car_select_entries_run (005F5A): 005F68 005F7E 005FC3
0062B0  table car_select_gas_down_jumps u32   # car_select_wait_confirm (0062AB) by gas_down (D[R20]): 0062B8 0062CC
00661C  table entry_traffic_state_jumps u32   # entry_traffic_run (006618): 006624 006645
00665C  table entry_traffic_car_state_jumps u32   # entry_traffic_car_drive (006657): 006670 0066F8 00675C 0066C7 00672B
# the car select's tables of values
0069B0  table car_select_default_cars u8   # 005184 "movz.bh 69B0[PC](R0), R0" by the player's place in the race (320[R25] by player): the car model the turntable starts at, 02 03 00 01 06 07 04 05
0069D8  table turntable_car_frames u8   # turntable_car_show 005723 "mov.b 69D8[PC](R1), 40[R20]" by the car's angle from the front >> 6 (64 entries): its frame, 0 (from the front) up to C
006D9C  table car_select_turn_delays u8   # car_select_run 0052BF "sub.b 6D9C[PC](R0), A[R20]" by the wheel >> 5: what turn_delay counts down by, 0F 05 03 00 00 03 05 0F (the further the wheel is turned, the sooner the turntable turns)
006DA4  table car_select_wheel_transmissions u8   # car_select_run 005359 "mov.b 6DA4[PC](R0), 61[R23]" by the wheel >> 5: the car's transmission, 01 01 01 00 00 00 00 00 (1 manual, 0 automatic)
006DEE  table car_select_car_sounds u8   # car_select_run 005319 "mov.b 6DEE[PC](R0), R0", request_sound's, by the chosen model: 62 66 61 65 60 64 63 67
006DDE  table car_caption_palettes u16   # car_caption_show 005DDF "mov.h 6DDE[PC](R0), 3A[R20]": the caption's palette by the model in front: 29B-2A2
006E30  table automatic_panel_palette_lists u32 palette_block_list   # transmission_choice_run 005B28 "mov.w 6E30[PC](R0), R19" by automatic_cycle >> 1: the palette lists for queue_palette_list that cycle the AUTOMATIC panel's colours (13F968 13F974 13F980 13F98C), closed by 0
006E44  table manual_panel_palette_lists u32 palette_block_list   # transmission_choice_run 005B03 "mov.w 6E44[PC](R0), R19" by manual_cycle >> 1: the same for the MANUAL panel (13F9A4 13F9B0 13F9BC 13F9C8), closed by 0
006E78  table car_gears_caption_frames u8   # car_gears_caption_show (005E83) and transmission_label_start_manual (005CC1) "mov.b 6E78[PC](R0), 40[R20]" by the model: the frame of the gearbox caption (04 00 03 00 00 01 02 01)
006E80  table choice_flag_palettes u16   # choice_flag_start (00608B) and stacked_choice_flag_start (006120) "mov.h 6E80[PC](R0), 3A[R20]" by the car chosen: 2A 28 29 2C 27 2D 2E 2B
006E90  table choice_flag_number_animations u16   # choice_flag_number_start 006189 "movz.hw 6E90[PC](R9), R9" by the player's car number (car_numbers): animations 1D-24
006EA0  table car_select_entries_flag_blink u8   # car_select_entries_run 006067 "mov.b 6EA0[PC](R0), 12[R20]" by frames >> 1 & F: flags_visible, 01 01 01 00 01 01 01 00 then 0
# An LCD text of the program's data, a character a byte, as a move copies it into the screen's lcd_text (move_halfwords from entry_countdown_lcd_texts in entry_countdown_count, from lcd_countdown_bars in lcd_race_info_update)
elements lcd_text_characters u8
006464  table entry_countdown_lcd_texts u32 lcd_text_characters   # entry_countdown_count 006423 "mov.w 6464[PC](R1), R1" by the frames left in the second (+ 2) / 5: the LCD's 7 texts (006480-0064D4, 14 bytes apart) moved to screen + F12
0067A9  table car_pass_sounds  u8                    # the sound of a car going by, by its model: passing_car_update 0029D0 "mov.b 67A9(R0), R0" (request_sound), entry_traffic_car_drive 00679A "mov.b 67A9[PC](R0), R0"; census ROM 0067A9-0067B0: 3A 37 36 39 38 39 36 37
031E7C  table car_select_palette  u32 palette_block  # scene_palettes[28]: game_mode_play's step 2 (002FBD "movz.bw #28, R19", 002FC1); 03283C
0068FE  func  step_palette
00C553  func  stage_indicator_start
00C585  func  stage_indicator_draw
00DED2  func  set_player_ready
00DED9  func  players_not_ready
011975  func  binary_to_bcd
011A32  func  draw_text
011E45  func  random_number
011EB8  func  request_sound
011EDE  func  queue_sound
018AF0  func  clear_lcd
018BA0  func  lcd_race_info_start
018BB2  func  lcd_race_info_update
018BD4  table lcd_race_info_state_jumps  u32   # lcd_race_info_update (018BD0 "jmp [R0]") jumps through it by state: 018BE0 018C2D 018C35
018C64  table lcd_race_info_page_jumps  u32   # lcd_race_info_update (018C61 "jmp [R0]") jumps through it by page: 018C78 018CE4 018D4F 018D7D 018DA9
018C84  table lcd_race_info_time_step_jumps  u32   # lcd_race_info_update (018C81 "jmp [R0]") jumps through it by page_step on page 0: 018C8C lcd_race_info_time_page, 018C99 lcd_race_info_time
018CF0  table lcd_race_info_order_step_jumps  u32   # lcd_race_info_update (018CED "jmp [R0]") jumps through it by page_step on page 1: 018CF8 018D15
018D5C  table lcd_race_info_speed_step_jumps  u32   # lcd_race_info_update (018D58 "jmp [R0]") jumps through it by page_step on page 2: 018D64 018D71
018D88  table lcd_race_info_maximum_step_jumps  u32   # lcd_race_info_update (018D86 "jmp [R0]") jumps through it by page_step on page 3: 018D90 018D9D
018DB4  table lcd_race_info_average_step_jumps  u32   # lcd_race_info_update (018DB2 "jmp [R0]") jumps through it by page_step on page 4: 018DBC lcd_race_info_average_page, 018DC9 lcd_race_info_average
018F1E  table lcd_time_label  u8   # "Time:" and the marks of the minutes and seconds, lcd_race_info_time_page "movcu.h 18F1E[PC], #7, F12[R25], #7" (018C8C): the LCD's text from its third character; census ROM 018F1E-018F2B
018F2C  table lcd_order_label  u8   # "Order:        ", lcd_race_info_update "movcu.h 18F2C[PC], #7, F12[R25], #7" (018D03)
018F3A  table lcd_speed_label  u8   # "Speed:    km/h", lcd_race_info_update (018D64)
018F48  table lcd_maximum_label  u8   # "Max.:     km/h", lcd_race_info_update (018D90)
018F56  table lcd_average_label  u8   # "Ave.:     km/h", lcd_race_info_average_page (018DBC)
018F64  table lcd_finish_label  u8   # "### FINISH ###", lcd_race_info_finish (018E50)
018EA0  table lcd_countdown_bars  u32 lcd_text_characters  # lcd_race_info_update "mov.w 18EA0[PC](R1), R1" (018BF9) by (the frames to the start mod 30 + 2) / 5: a bar of 14 characters, for move_string into the LCD's text; census ROM 018EA0-018EBB (018EBC-018F10, 14 bytes apart)
018C8C  func  lcd_race_info_time_page
018C99  func  lcd_race_info_time
018DBC  func  lcd_race_info_average_page
018DC9  func  lcd_race_info_average
018DDF  func  lcd_race_info_write_number
018E32  func  lcd_race_info_finish
018E40  table lcd_race_info_finish_state_jumps  u32   # lcd_race_info_finish (018E3B "jmp [R0]") jumps through it by state: 018E50 018E5D 018E66 018E79
018E98  func  lcd_race_info_paused
018F74  func  car_radio_start
019421  table car_model_songs  u8   # car_radio_start "mov.b 19421[PC](R0), 14[R23]" (018FBE) by car model: car song; census ROM 019421-019428 (02 00 06 03 04 08 05 07)
018FD3  func  car_radio_wait_start
018FE0  func  car_radio_read_buttons
01900A  func  car_radio_update
019044  table car_radio_state_jumps  u32   # car_radio_update (019041 "jmp [R0]") jumps through it by state: 019068 019078 0190F0 019118 019132 01914C 019154 019167 019180
0191A8  func  car_radio_talk   # the code state 3 runs on into, and states 4-8 jump to while they wait
0191E0  table car_radio_talk_step_jumps  u32   # car_radio_talk (0191DC "jmp [R0]") jumps through it by talk_step: 0191F8 019205 019227 019249 019256 0192E4
019458  table route_stage_radio_sounds  u8   # car_radio_update "mov.b 19458[PC](R0), R0" (019109, 019197) by screen route_stage: the station's sound, for request_sound; census ROM 019458-019477 (0D, then E1-F4)
019478  data  radio_song_titles   # the songs' titles radio_songs points at (song_title_record: x, then the text closed by 0), Magical Sound Shower to Jingle Bell
019571  table stage_level_radio_messages  u8   # car_radio_update "mov.b 19571[PC](R0), B[R20]" (01918A) by screen current_stage_level: queued_message; census ROM 019571-019575 (30 30 30 30 2E)
01929E  func  car_radio_dj_leader
0192B1  func  car_radio_dj_own_car
0192BC  func  car_radio_dj_remark_2a
0192C3  func  car_radio_dj_remark_2b
0192CA  func  car_radio_dj_remark_2d
0192D1  func  car_radio_dj_remark_2f
0192D8  func  car_radio_dj_remark_2c
0192E5  func  car_radio_song
01942C  table radio_songs  u32   # car_radio_song "mov.w 1942C[PC](R0), R10" (0192E5) by song: its sound in the top byte ("rvbyt R10, R0"), the address of its song_title_record in the low 24 bits; census ROM 01942C-019457 (01019478 02019492 ... 1201953C: 11 songs)
0192F5  func  car_radio_show_title
01930A  func  start_song_title
0193FC  func  start_dj_message_if_quiet
019402  func  start_dj_message
comment lcd_race_info_start Starts the race information on the cabinet LCD: clears it (clear_lcd), shows the DJ's face in its first two characters (screen dj_face) and goes on to lcd_race_info_update.
comment lcd_race_info_update Shows the race on the cabinet LCD. Before the start, while the car object's timer counts the frames to it: a bar shrinking through each second (lcd_countdown_bars) with the seconds left. Then a page every 150 frames (page_frames), by page: 0 Time (lcd_race_info_time), 1 Order (the car numbers, car_numbers + 1, in race order from order_list, this screen's own blinking; skipped with one player), 2 Speed (screen shown_speed), 3 Max. (screen maximum_speed), 4 Ave. (lcd_race_info_average); page_step 0 writes the label, 1 updates the number. When the car reaches the goal (car at_goal) goes to lcd_race_info_finish; when the race is over (car race_over) shows the average and ends; while the LCD scrolls a text (screen lcd_scroll) waits in lcd_race_info_paused.
comment lcd_race_info_time_page Writes the Time page's label on the LCD, then the time (lcd_race_info_time).
comment lcd_race_info_time Writes the race time (the car's race_time, in thousandths of a second) on the LCD as minutes'seconds"hundredths.
comment lcd_race_info_average_page Writes the Ave. page's label on the LCD, then the average speed (lcd_race_info_average).
comment lcd_race_info_average Writes the average speed on the LCD: the sum of the speeds (screen speed_sum) over how many there are (speed_samples), with lcd_race_info_write_number.
comment lcd_race_info_write_number Writes a number of up to three digits on the LCD, right-aligned to end before the address it is given (F1C of the screen for the km/h pages), spaces for the leading zeros.
comment lcd_race_info_finish The car has reached the goal: shows ### FINISH ### on the LCD, waits for a text to scroll across it (screen lcd_scroll) and out, shows the average speed for 150 frames (frames), then the race time, and ends.
comment lcd_race_info_paused Waits while the LCD scrolls a text (screen lcd_scroll), then goes back to lcd_race_info_update, which writes the page's label again.
comment car_radio_start Sets up the radio as the race starts: the car each player chose (byte 49 of its race_copy record) by car number in car_models (FF where none) and how many in cars_to_introduce, this screen's car number, clears screen nearing_fork, gives the car the song of its model (car song = car_model_songs by car model), notes the stage (screen route_stage), then car_radio_wait_start.
comment car_radio_wait_start Waits for the start (the car object's timer, the frames to it, down to 0), then goes on to car_radio_read_buttons.
comment car_radio_read_buttons Each frame of the race: the buttons newly pressed (screen buttons_pressed) into buttons, then car_radio_update. Once the race is over (car at_goal at the goal, or race_over) clears them, silences the DJ (talk_step 5), turns the screen's two lamps off (button_lamps) and leaves car_radio_update alone, without the buttons.
comment car_radio_update The radio, by state: 0 plays the car's song (car song) with its title; 1 << and >> step through the ten songs (both together: song 10, Jingle Bell), START does >>, the DJ/music button goes to the station; 2 the station: title "Mega Radio Station", DJ message 29 queued, the stage's sound (route_stage_radio_sounds by screen route_stage); 3 the station plays; 4-8 while screen nearing_fork is set (fork_camera_update sets it, a new route_stage clears it): 3F to the screen's sound byte (fade_out_music_at), sound E0 after 60 frames, sound EE, 7F when it clears and after 120 frames the stage's message (stage_level_radio_messages by screen current_stage_level) and sound. On the station (3, without nearing_fork) and while 4-8 wait, the DJ talks (car_radio_talk).
comment car_radio_talk The station's DJ, each frame of car_radio_update's state 3 (without screen nearing_fork) and while its states 4-8 wait: any of the three buttons goes back to the car's song (state 0, talk_step 4, screen dj_mouth_shapes 0, sound 1F); while a message plays (dj_mouth_shapes) the queued_message is dropped; else by talk_step: 0 message 0, 1-2 each car number (message 9 + number) and its car (message 1 + model), cars_to_introduce of them, 3 message 2A, 4 the queued_message, or in state 3 the next remark of the list (remark_list), a new list of dj_remark_lists 14 times in 1024, 5 nothing.
comment car_radio_dj_leader A DJ remark: message 11 plus the car number of the car in the lead.
comment car_radio_dj_own_car A DJ remark: message 19 plus this screen's car number.
comment car_radio_dj_remark_2a A DJ remark: message 2A (also the end of the cars' introduction).
comment car_radio_dj_remark_2b A DJ remark: message 2B.
comment car_radio_dj_remark_2d A DJ remark: message 2D.
comment car_radio_dj_remark_2f A DJ remark: message 2F.
comment car_radio_dj_remark_2c A DJ remark: message 2C.
comment car_radio_song Shows the title of song R0 (radio_songs: 0 Magical Sound Shower, 1 Passing Breeze, 2 Splash Wave, 3 Picture the Rivers, 4 Blow Your Cool, 5 Looking for the Rainbow, 6 Speed King, 7 Adventure, 8 Sonic Control, 9 Last Wave, 10 Jingle Bell) and returns the song's sound.
comment car_radio_show_title Starts a song title (start_song_title) for the record it is given, sends the one shown (title) away and keeps the new one in title.
comment staff_credits_code_start Starts watching for the secret code during the presentation of the cars: takes the controls held (staff_credits_code_read_controls), puts code_place at the start of the code (001ADC) and goes on to staff_credits_code_watch.
comment staff_credits_code_watch Watches the controls for the code (staff_credits_code_sequence: shift down twice, shift up twice, the wheel left, right, left, right, the brake, the gas; a wrong one starts over); when it is complete: sound 9, the presentation 1200 frames longer (screen mode_timer), and staff_credits_code_show.
comment staff_credits_code_show Shows the staff credits (the texts at 001AE8, draw_text) for 1200 frames, then fade_out_music and staff_credits_code_done.
comment staff_credits_code_done Does nothing: the code has been used; the object stays until the presentation's objects are cleared.
comment staff_credits_code_read_controls Reads the controls as bits (0 shift up, 1 shift down, 2 the wheel right, 3 the wheel left, 4 the brake, 5 the gas, each with less needed to stay on), keeps them in controls_held and returns the ones newly on (zero set when there are none).
comment transmission_label_start_automatic Sets up the label of the automatic transmission's panel (sprite set 2C1, 24 below the panel's place; the frames show NOVICE there), then transmission_label_follow.
comment transmission_label_start_manual Sets up the label of the manual transmission's panel (sprite set 2C9, its frame from car_gears_caption_frames by the car's model; the frames show 5 SPEED there for the car coin_start takes), then transmission_label_follow.
comment transmission_label_follow Keeps the label on its panel (the panel's place plus its offsets, the panel's palette) and draws it; ends when the panel ends.
comment entry_countdown_start Sets up the invitation to join, on a seat with no player while the entry time of a game runs: the screen (set_up_background, start_palette_fades), clears the LCD (clear_lcd) with the DJ's face, the music (sound F, Mega Driver) and DJ message 3B, marks the screen (entry_countdown_shown) so the car select does not start them again, starts the WAITING YOUR ENTRY banner (entry_banner), the ring of cars (entry_car_ring, in car_ring) and the traffic behind it (entry_traffic_run), and goes on to entry_countdown_count.
comment entry_countdown_count Shows the entry time left (RACE_COPY_1's entry_frames, frames): the seconds as the big number (its frame), the frames into the second to the ring of cars, and on the LCD a shrinking bar (entry_countdown_lcd_texts) with the seconds; when it is over clears the screen's entry_countdown_shown, fade_out_music, and goes on to entry_countdown_done.
comment entry_countdown_done Does nothing (the number is no longer drawn): the entry time is over.
comment entry_banner_start Sets up the WAITING YOUR ENTRY banner (sprite set 287) at the centre of the screen, then entry_banner_blink.
comment entry_banner_blink Draws the banner 16 frames out of every 32.
comment entry_car_ring_start Sets up the ring of cars around the entry countdown with the first car's sprite (turntable_car_looks), then entry_car_ring_draw.
comment entry_car_ring_draw Draws a ring of as many copies of a car around the countdown as frames have gone in the second (copies, set by entry_countdown_count, at most 16); with a new second, the next of the eight cars (car).
comment stage_indicator_start Sets up the STAGE label at the top left of the race screen (sprite set 2E), then stage_indicator_draw.
comment stage_indicator_draw Draws the stage's name after the label (stage_level_texts by the forks taken, screen route_stage_level: PRE-STAGE, 1 to 4, FINAL STAGE) and the label itself.
comment car_select_start Starts the car select with 630 frames (21 seconds) to choose, then car_select_run.
comment car_select_run The car select, by state: 0 sets the screen up (unless screen entry_countdown_shown says the entry countdown did: clears the LCD, the title Mega Driver, sound F, DJ message 3B), the tile layer's tables from 006920, the WELCOME! letters; 1 when the screen's data is unpacked (unpack_state) starts the eight cars on the turntable and the rest, the default car (car_select_default_cars by the player's place in the race), the time display (time_digits_start); 2 30 frames; 3 the screen's turntable_depth_offset up to 0, then the instructions (select_car_heading_show) and the car's caption (car_caption_show); 4 the wheel turns the turntable (turn, turn_delay, angle; car model is the car in front) until the gas or START confirms or time_left runs out: race model = the car, car_choice = the car + 1, the car's sound (car_select_car_sounds), at least 180 frames left, the transmission choice (transmission_choice_run); 5 the wheel picks the transmission (car transmission = car_select_wheel_transmissions by the wheel: 0 automatic, 1 manual) until confirmed or out of time; 6-8 when the entry time is over (entry_over) marks the player ready (set_player_ready) and waits for the race's other players (players_not_ready), DJ message 3C; 9 60 frames, then fade_out_music and the game's next step (screen game_mode byte 2); 10 stays. Every frame from 4 on: car_select_turn_to_choice and car_select_update_rowscroll; time_left down by one and shown in seconds.
comment car_select_turn_to_choice Once the car is chosen (car_chosen), turns the turntable the short way round until the chosen car (car model) is in front, 20 a frame, skewing the floor as it goes.
comment car_select_update_rowscroll Writes the line scroll of the tile layer for the next frames: the top 104 lines all at top_scroll, which moves one more each frame, and while rowscroll_copies says, the floor's 120 lines from their offsets at 3800 of the screen.
comment car_select_skew_floor_next Skews the turntable's floor for a step toward the next car (car_select_skew_floor with 6).
comment car_select_skew_floor_previous Skews the turntable's floor for a step toward the previous car (car_select_skew_floor with -6).
comment car_select_skew_floor Adds a step that grows line by line (by R0) to the floor's 120 line offsets at 3800 of the screen, writes them to the next two pages of the line scroll and has car_select_update_rowscroll copy them to the others (rowscroll_copies).
comment car_select_wait_confirm Whether the player has not confirmed yet (zero set): confirming is pressing the gas pedal down (screen gas from C0, after letting it up under 40) or START, once confirm_delay has run out.
comment welcome_letter_start Starts the eight letters of WELCOME! (itself the first), then welcome_letter_show.
comment welcome_letter_show Shows its letter of WELCOME! (font 346): appears 2 frames after the one before it, cycles its colours (step_palette, from 006DCC) and ends 45 frames after the start.
comment clear_lcd Clears the cabinet's LCD: sixteen spaces, no DJ message (screen dj_mouth_shapes), no scrolling text (lcd_scroll_request, lcd_scroll), the DJ's face off (dj_face).
comment start_dj_message Starts DJ message R0 (typed_messages): requests its voice (the sound in the record's top byte) and has the face on the LCD move its mouth by the record's string (screen dj_mouth_shapes).
comment start_dj_message_if_quiet Starts DJ message R0 (start_dj_message) unless one is being said (screen dj_mouth_shapes).
comment start_song_title Starts an object that shows the song title of record R10 (x, then the text) on the screen and scrolls it on the LCD; returns the object.
comment random_number Returns the next pseudo-random number of the screen's sequence (kept in random_state).
comment request_sound Requests sound R0 for the screen (queue_sound), except while the screen's demo_flags bit 8 is set, when only the sounds the table at 01202E (demo_sounds) allows play, and only with advertise_sound set.
comment queue_sound Puts sound R0 in the screen's ring of 32 sound requests (801 of the screen: the place, then the requests).
comment draw_text Draws the text record R19 (x and y, an attribute, a string closed by 0) as one sprite per character and returns the address of the record after it.
comment step_palette Gives the object the next palette (palette, an index into the sprites' palette words, sprite_palettes) of its palette_list; a negative entry goes back by that many bytes, to loop.
comment binary_to_bcd Converts R0 into eight decimal digits, one per four bits, the units in the lowest.
comment set_player_ready Marks the screen's player ready in its race record (ready), after its selections.
comment players_not_ready Whether a player of the race has not marked itself ready yet (zero set): byte 5C of each one's race_copy record.
scoped object lcd_race_info 09 racer_count u8
scoped object lcd_race_info 0D page u8
scoped object lcd_race_info 0E page_step u8
scoped object lcd_race_info 10 frames u16
scoped object lcd_race_info 12 page_frames u16
scoped object lcd_race_info 18 order_list u32 race_order_players
scoped object car_radio 09 car_number u8
scoped object car_radio 0A stage u8
scoped object car_radio 0B queued_message u8
scoped object car_radio 0D talk_step u8
scoped object car_radio 10 timer u8
scoped object car_radio 2C buttons u16
scoped object car_radio 38 remark_list u32 rom
scoped object car_radio 80 car_models u8[8]   # each car's model by its car number (car_radio_start: the race copies' 49 by player)
scoped object car_radio 88 cars_to_introduce u8
scoped object car_radio 89 next_car_number u8
scoped object staff_credits_code 09 controls_held u8
scoped object staff_credits_code 10 frames_left u16
scoped object staff_credits_code 14 presentation u32 object.car_presentation
scoped object staff_credits_code 18 code_place u32 staff_credits_code_controls
scoped object transmission_label 14 panel u32 object
scoped object transmission_label 20 x_offset s16
scoped object transmission_label 24 y_offset s16
scoped object entry_banner 10 blink u8
scoped object entry_car_ring 10 copies u8
scoped object entry_car_ring 12 car u8
scoped object car_select 09 turn s8
scoped object car_select 0A turn_delay s8
scoped object car_select 0B confirm_delay u8
scoped object car_select 0D gas_down u8
scoped object car_select 0E rowscroll_copies u8
scoped object car_select 0F choice_turn u8
scoped object car_select 10 timer u16
scoped object car_select 1C time_left u16
scoped object car_select 24 angle u16
scoped object car_select 28 top_scroll u16
scoped object car_select 2C car_chosen u8
scoped object car_select 2D transmission_chosen u8
scoped object car_select 98 scroll_x_address u32 video_register_words
scoped object car_select 9C scroll_y_address u32 video_register_words
scoped object car_select A0 rowscroll_address u32 line_scroll_values
scoped object car_select A4 rowselect_address u32 line_selects
scoped object car_select A8 second_scroll_x_address u32 video_register_words
scoped object car_select AC second_scroll_y_address u32 video_register_words
scoped object car_select B0 entry_over u8
scoped object welcome_letter 09 index u8
scoped object welcome_letter 10 delay s16
scoped object welcome_letter 12 frames_left u16
scoped object welcome_letter 18 palette_list u32 rom

# ======== road objects, traffic and backdrops (naming batch C) ========
00C873  func  stage_entry_update
01262A  func  traffic_hit_check
0126FC  func  road_object_stream_read
012758  func  road_object_stream_start_object
012777  func  road_object_stream_stage_end
012786  func  road_object_stream_fork
01279C  func  road_object_stream_end
0127EE  func  crest_clip_update
012A20  func  aurora_update
012AA5  func  aurora_count_down
012AAB  func  aurora_next_animation
012CAA  func  kangaroo_update
012EA2  func  swooping_helicopter_update
012FBC  func  start_gate_update
01307E  func  start_flagman_update
0131A5  func  start_balloon_update
01322D  func  ambient_sound_update
013288  func  one_shot_sound_update
013296  func  west_east_panel_update
01333C  func  santa_sleigh_update
01344F  func  goal_parade_rightward_update
01351E  func  sounding_scenery_update
0135CC  func  goal_parade_leftward_update
01369A  func  goal_parade_dragon_update
01376C  func  traffic_spawner_update
01389E  func  traffic_car_start_convoy
0138EB  func  traffic_car_update
013900  func  traffic_car_start
01397E  func  traffic_car_draw
013AF9  func  traffic_stopping_car_update
013B56  func  traffic_figure_start_team
013BA3  func  traffic_figure_update
013CF6  func  traffic_start_hit_sound
013D29  func  traffic_out_of_view
013DC4  func  fork_branch_start_right
013DD5  func  fork_branch_start_left
013DE4  func  fork_branch_draw
01405F  func  fork_branch_sprite
014514  func  stage_end_sounds_update
014520  table stage_end_sounds_state_jumps  u32   # stage_end_sounds_update (01451D "jmp [R0]") jumps through it by state: 01452C 014547 01456A
01466F  table stage_end_sound_cues  sound_cue   # stage_end_sounds_update "movea.b 1466F[PC], R10" (014536); census ROM 01466F-014673 (01 24, 14 53, 00)
01458D  func  fork_camera_update
0145A0  table fork_camera_state_jumps  u32   # fork_camera_update (01459C "jmp [R0]") jumps through it by state: 0145B0 014605 014632 014640
010BD2  table model_view_pitch_bases  u16   # the view's base pitch by car model: fork_camera_update "neg.h 10BD2(R0), R1" (0145C1) by race_copy model (lift_height = 1E0 less it); init_screen takes the first as the screen's view_pitch_base ("mov.h [R2+], 18[R25]" 01067D, the last of the constants it reads from 010BC8); census ROM 010BD2-010BE1 (E8 F0 110 110 110 100 190 140)
014674  table fork_camera_lift_steps  u16   # fork_camera_update "mov.h 14674[PC](R0), 80[R20]" (0145D3) by race_copy model: lift_step; census ROM 014674-014683 (6 for all eight)
014684  table fork_camera_tilt_steps  u16   # fork_camera_update "mov.h 14684[PC](R0), 82[R20]" (0145DE) by race_copy model: tilt_step; census ROM 014684-014693 (6 for all eight)
014735  func  goal_actor_car_start
014777  func  goal_actor_driver_start
014782  func  goal_actor_passenger_start
01478B  func  goal_actor_rider_place
014838  func  goal_actor_start
014846  func  goal_actor_run
014994  table goal_actor_command_jumps  u32   # goal_actor_run (014990 "jmp [R0]") jumps through it by the command word after a step with bit 0 set: 0149AC 0149B5 0149BA 0149C5 0149CE 0149D8
014A16  table goal_actor_place_waits  u8   # goal_actor_run's command 5 "movz.bh 14A16[PC](R1), R1" (0149E5) by the screen's place (320[R25] + player), "shl.h #3" (8 counts each) added to the repeat's count; census ROM 014A16-014A1D (00 02 02 03 03 03 04 04)
# The words of a goal actor's script (the data of ending_actor_lists, unfinished_ending_actor_count: goal_actor script,
# 80, and step, 84): a word of flags, then a word for each flag set: goal_actor_run "movz.hw [R10+], R5"
# (01484B), "cmp.h [R10+], 10[R20]" (0148BF, 0148D6), "movt.hb [R10+], 40[R20]" (014900), "add.h"/"mov.h
# [R10+]" (014908-01494A), "movz.hw [R10+], R9" (014952), "mov.h [R10+], 3A[R20]" (014974), "movz.hw [R10+],
# R0" (01497C, 014988), "mov.h [R10+], R0" (0149F0); census ROM 01500C-016AFF
# (156 scripts, from the 17 lists; the first: 8000 0032, a wait of 32, then 1508 ...)
elements goal_actor_script_words u16
local goal_actor_run 014952 R9 animation
local goal_actor_run 0148BF t1 wait_count
local goal_actor_run 0148D6 t1 repeat_count
local goal_actor_run 01498B t0 command
017BFB  func  palette_cycle_update
017C08  table palette_cycle_state_jumps  u32   # palette_cycle_update (017C04 "jmp [R0]") jumps through it by state: 017C18 017C44 017C56 017C5B
017C68  table palette_cycle_running_jumps  u32   # palette_cycle_update (017C64 "jmp [R0]") jumps through it by running: 017C70 017C79
# A palette_cycle's data (palette_cycle data, 80; stage_background_object_lists): palette_cycle_update reads it with
# [R10+] from 017C18 "mov.w 80[R20], R10"; census ROM 018330-0184CB (8 records: 0000 0383 14159C 1, 04B0 0000
# 1415E0 1, ...)
struct palette_cycle_record C rom
field palette_cycle_record 00 delay u16          # "mov.h [R10+], 10[R20]" (017C1D)
field palette_cycle_record 02 frames_left u16    # "mov.h [R10+], 12[R20]" (017C22)
field palette_cycle_record 04 palette_list u32 palette_cycle_steps   # "mov.w [R10+], 38[R20]" (017C27)
field palette_cycle_record 08 step_frames u32    # "mov.w [R10+], R0" (017C2C), its low half into 14 and 16
# The steps of a palette_cycle's list (palette_cycle palette_list, 38): the address of a palette list for
# queue_palette_list, or a negative number of bytes to go back: "mov.w [R10+], R19" (017C8E, 017C98), "test.w
# R19" (bp), "add.w R19, R10" (017C95)
elements palette_cycle_steps u32 palette_block_list
017CAA  func  sunset_fade_start
017CB8  table sunset_fade_state_jumps  u32   # sunset_fade_start (017CB3 "jmp [R0]") jumps through it by state: 017CC4 017CDB 017CE4
# A sunset_fade's data (sunset_fade data, 80; stage_background_object_lists): sunset_fade_start reads it with [R10+] from
# 017CC4 "mov.w 80[R20], R10"; census ROM 018328 (384 14152C), 018458 (0 141700), 018498 (12C 141740), 0184A0
# (258 1417A4)
struct sunset_fade_record 8 rom
field sunset_fade_record 00 delay u32       # "mov.w [R10+], 10[R20]" (017CC9: count)
field sunset_fade_record 04 fade_list u32 palette_fade_list   # "mov.w [R10+], 38[R20]" (017CCE)
# A list of palette fades (start_palette_fades, road_surface_fade_back, race_background_fade_palettes and
# sunset_fade_start read them): a length, which divided by 12 is the number of the palette_fade_entry records
# after it (the lists say 12 n + 2): sunset_fade_start "mov.w [R19+], R18; divu.w #C, R18" (017CEF, 017CF2);
# census ROM 14152C (6E: 9 records), 141700 (3E: 5), 141740 (62: 8), 1417A4 (62: 8)
struct palette_fade_list 4 rom
field palette_fade_list 00 length u32
field palette_fade_list 04 fades palette_fade_entry[]   # the list's fades, its length's bytes of them (start_palette_fades)
# A palette fade of such a list (12 bytes), for start_palette_fade: sunset_fade_start reads it with [R19+]:
# "mov.d [R19+], R10" (017CFF: R10 and R11), "mov.h [R19+], R12" (017D02), "mov.b [R19+], R0" (017D05), "mov.b
# [R19+], R1" (017D08); census ROM 141530-141809 (sunset_fade's lists: 143154 143274 2DA0 01 08, ...)
struct palette_fade_entry C rom
field palette_fade_entry 00 from u32 palette_colours           # the palette faded from (R10), the to one (R11) next
field palette_fade_entry 04 to u32 palette_colours
field palette_fade_entry 08 palette_offset u16 # R12
field palette_fade_entry 0A blocks u8          # R0
field palette_fade_entry 0B period u8          # R1
local sunset_fade_start 017CEF R19 fade palette_fade_entry
local sunset_fade_start 017CEB,017CFF,017D02,017D05,017D08 R19 fade
017D1F  func  sunset_fade_wait
017E1B  func  backdrop_near_start
017E98  table backdrop_near_state_jumps  u32   # backdrop_near_update (017E95 "jmp [R0]") jumps through it by state: 017EA0 017EA8
017E5B  func  backdrop_near_update
017EF2  func  backdrop_landmark_start
017F7C  table backdrop_landmark_state_jumps  u32   # backdrop_landmark_update (017F77 "jmp [R0]") jumps through it by state: 017F88 017F90 017FBF
017F3D  func  backdrop_landmark_update
0180CB  func  backdrop_translucent_start
01814C  table backdrop_translucent_state_jumps  u32   # backdrop_translucent_update (018149 "jmp [R0]") jumps through it by state: 018154 01815C
018110  func  backdrop_translucent_update
01818A  func  backdrop_off_screen
comment road_object_stream_read Starts the objects along the road of the stage being built (road_object_streams). By state: 0 takes the stream of the stage being built (screen built_stage); 1 reads the stream's records while their position is not beyond the segments the road generator has built of the stage (car stage_segments): command 0 road_object_stream_start_object, 1 road_object_stream_stage_end, 2 road_object_stream_end, 3 road_object_stream_fork; 2 (the stage's stream is over) waits until the generator builds the stage the route goes to (screen built_stage = stage), then stage_start = car built_segments (the segment the new stage starts at) and its stream; 3 (a fork) waits until the route's next stage is known (screen route_stage no longer stage), then goes on with the stream of the branch the car takes (car branch) from the fork's table, the same stage_start.
comment road_object_stream_start_object Command 0 of a stream: starts an object (start_object) at the record's position plus stage_start (field 1C), with the record's handler and its parameter in field 18 (most often the address of the object's record in the ROM), and moves the stream past the record.
comment road_object_stream_stage_end Command 1: the stage's stream is over; notes the stage the route goes to next (screen route_stage) in stage and waits for it (state 2).
comment road_object_stream_fork Command 3, a fork: keeps the address of the table of the branches' streams in stream, the current stage (screen built_stage) in stage, and waits for the branch (state 3).
comment road_object_stream_end Command 2: the last stage's stream is over (the goals): ends the reader.
comment crest_clip_update Cuts the sprites beyond the road's crests: each frame, for the crests the road's projection found (screen crest_count of them; their depth layers at 1F10 of the screen and their screen heights at 1F30), each whose layer is lower than all those before it gets a sprite clip command in its layer (draw_mode 6: the 16-byte entry at clip_command, command 7000: the drawing area from the top of the screen down to clip_bottom = the crest's height + screen sprite_origin_y - 1, across clip_left..clip_right), so the sprites the list draws after it (meant: what lies beyond the crest) are cut at the crest's height.
comment traffic_spawner_update Starts the traffic of the stage the race's leader is in (stage_road_object_lists). By state: 0 the list of the stage being built (screen built_stage), traffic_level = 8 - the number of players (byte 1F of the record screen host_record points at) + the game setting game_difficulty, the draw distance into screen traffic_draw_distance, no traffic yet (screen traffic_count); 1 (outside the attract demo, screen demo_flags bit 8) when the leader's stage (screen leader_stage) changes, takes its list with positions from where the leader was then (screen leader_window_segment); starts each record (position, level, handler, stop_distance, record) whose position is within the draw distance of the leader's view (window_segment of the race record screen leader_record), when its level is not above traffic_level and fewer than 32 are on the road (screen traffic_count); then writes at F84 of the screen the stretches of road the players can see (each player's view, window_segment of the race records listed after byte 1F, give or take the draw distance; a count, then each stretch's top and bottom from the highest), for traffic_out_of_view.
comment traffic_car_start Sets up a traffic car from its record (the address of its sprite record, then side, x_offset and speed): from the sprite record its animation (animation_start), palette, passing_sound, hit_sound, weight and hit_box (the sprite record's last 8 bytes); draw_mode B (the frame chosen by the angle it is seen from, traffic_car_draw), scale_shift FF, passed 0; goes on to state 1.
comment traffic_car_draw Moves and draws a traffic car: keeps the position_fraction; ends it (taking it off the count, screen traffic_count) when traffic_out_of_view; plays passing_sound whenever the screen's car (race_copy segment) passes it or it passes the car (passed); while it is within the draw distance ahead of the view (race_copy window_segment) picks its frame by the angle the player sees it from: a column (4-1B) from the difference between the road's direction (+0 of the road's segment record) at the car and at it, plus a quarter of its screen_x, and a row (0-3, 20 frames apart) from the difference in height (+2) and the car's pitch (car view_pitch), shaken for 20 frames after a hit (shake, traffic_shake_frame_offsets); traffic_hit_check, and on a hit traffic_start_hit_sound and shake = 1; draw_object.
comment traffic_start_hit_sound When the traffic object has a hit_sound, starts an object (013D15) that plays it 15 frames later.
comment traffic_out_of_view Whether road position R0 is outside every stretch of road the race's players see (zero set: the traffic there is removed): the stretches traffic_spawner writes at F84 of the screen (a count, then each stretch's top and bottom).
comment traffic_hit_check Whether the screen's car hits this traffic object (negative set), unless the car's object has flags bit 3 set: the car's box (the entry screen->own_hit_box points at) against the object's hit_box (along the road from (position - the car's first segment) * 128 + position_fraction, across from the road's width * side + x_offset). On a hit the car's object gets flags bit 2, byte 6E = 1 (the kind of hit: a single object) and 68 = this object, whose speed and weight the crash (007DBD) reads.
comment traffic_car_update A traffic car, drawn from the angle the player sees it at. By state: 0 traffic_car_start; 1 moves along the road by speed (128ths of a segment a frame, position_fraction carrying into position), then traffic_car_draw; once the screen's car has reached the goal (car at_goal) it ends when it is 8 segments behind the view.
comment traffic_car_start_convoy The first vehicle of a convoy (the only one: stage 25, animation 35C followed by eight 35D): its record starts with the distance between them and the records of those that follow, closed by 0; starts each (handler 013AB7: traffic_car_update, kept live as long as the one before it is, which ends it) that distance behind the one before, keeping the one before in its field 14, with the same stop_distance, counted in screen traffic_count; then becomes a traffic_car with the record after the list.
comment traffic_stopping_car_update A traffic car that slows to a stop: as traffic_car_update, but at each segment it counts stop_distance down and, once it has run out (stopping), its speed drops by one a segment to 0. The cars of stages 2 and 12, and what the traffic_figure teams pull (013AD8 runs it).
comment traffic_figure_start_team The leader of a team (the horses pulling a covered wagon in stage 1, the reindeer pulling a sleigh in stages 25 and 26): its record starts with the distance and the records of what it pulls, closed by 0; starts each (handler 013AD8: traffic_stopping_car_update, kept live as long as the one before it is, which ends it) that distance behind the one before (its field 14 the one before, the same stop_distance, counted in screen traffic_count), then becomes a traffic_figure with the record after the list.
comment traffic_figure_update Traffic drawn from a single view (draw_mode 5) instead of by angle: the horses of the covered wagons (stage 1), the reindeer (stages 25, 26) and the figures of stages 10 and 24 (animation 185) and 30 (258, 071). By state: 0 reads its record as traffic_car_start does (draw_mode 4, scale_shift 2 and y_offset -2C0 for animation 165; scale_shift 0 for 258 and 185, else 1); 1 once the screen's car has reached the goal (car at_goal) ends when 8 segments behind the view; moves along the road by speed, slowing to a stop once stop_distance has run out (stopping); ends when traffic_out_of_view; while within the draw distance ahead of the view: traffic_hit_check when it has a hit box (traffic_start_hit_sound on a hit), draw_object and animation_advance.
comment stage_entry_update The start of a stage's road (position 0 of streams 1-30): when the car (car segment) reaches it, the stage the car is in becomes the one whose road is being built (screen current_stage_level = built_stage_level, its level; current_stage = built_stage, its number; car reached_stage_start = stage_start, the segment it starts at), and it ends. In the attract demo (screen demo_flags bit 8) it ends at once.
comment aurora_update The northern lights over stage 26 (stream 26 at 1040: two of them, with their own lists): drawn at a screen position (draw_mode 0) that slides in from x -160 to 160, 8 a frame (y 40, or 30 for car model 6, car model), then stays; it steps through its list of animations (aurora_next_animation, each shown animation_frames frames, aurora_count_down) and is drawn only every other frame (when countdown is odd), so it looks faint. It never ends.
comment aurora_count_down Counts the current animation's frames down; when they run out, aurora_next_animation.
comment aurora_next_animation Starts the next animation of the list (animation_list; a negative entry goes back that many bytes first) for animation_frames frames.
comment kangaroo_update The kangaroos of stage 21 (Australia) that hop across the road ahead of the car. By state: 0 reads the record (animation, hop_animation, palette, flags, side, x_offset, trigger_distance, x_speed, draw_mode, scale_shift), trigger_position = position - trigger_distance, appear_position = position - draw_distance; 1 not drawn until the view (race_copy window_segment) passes appear_position; 2 drawn standing until the car (car segment) reaches trigger_position, then hop_animation; 3 while the car (car window_segment) has not reached it: x_offset += x_speed each frame and it moves along the road at the car's own pace (position_fraction += the car's speed, car speed, >> 9), animation_advance and draw_object; it ends when the car reaches it, when it gets beyond draw_distance or when its screen_x leaves -F0..130.
comment swooping_helicopter_update The helicopter over the waterfalls of stage 4: it swoops down, then flies off. By state: 0 reads the record (animation, palette, flags, draw_mode, scale_shift, side, x_offset, y_offset, trigger_distance + 16, x_speed, y_speed, road_speed, dive_frames, dive_y_speed), trigger_position = position - trigger_distance, appear_position = position - draw_distance; 1 not drawn until the view (race_copy window_segment) passes trigger_position, then dive_countdown = dive_frames; 2 for dive_frames frames y_offset += dive_y_speed and position += road_speed; 3 x_offset += x_speed, y_offset += y_speed, position += road_speed; from 2 on, animation_advance and draw_object while within draw_distance of the car (car window_segment); it ends when the car reaches it, when it gets beyond draw_distance or when its screen_x leaves -F0..130.
comment start_gate_update The START banner over the start line and its two posts with the signal lights (stream 0 at 20: four of them). By state: 0 reads the record as road_row_start does (animation, palette, flags, draw_mode, scale_shift, side, x_offset, y_offset, spacing, count, hit box; first_position, end_position), and goes on to state 2 without a hit box; 1 road_row_crash_check and draw_object (no record has a hit box); 2 the lights: palette from start_gate_light_palettes by the seconds to the start (the car object's timer, in frames, rounded up): C9 until the last 3 seconds, then CC, CB, and CA at the start, which goes on to state 3; 3 draw_object. It never ends.
comment start_flagman_update The man at the start line who waves the chequered flag as the race starts (stream 0 at 20). By state: 0 reads the record (animation, go_animation, palette, side, x_offset, y_offset), draw_mode 9, scale_shift 1; 1 drawn standing (06E) while the car object's timer counts the frames to the start, then go_animation (06F, the waving); 1 and 2: ends once the car (car window_segment) reaches its position, else animation_advance and draw_object.
comment start_balloon_update The balloons let go over the start line as the race starts (stream 0 at 24-34). By state: 0 reads the record (animation, palette, side, x_offset, y_offset), draw_mode 9, scale_shift 1; 1 not drawn until the start (the car object's timer down to 0); 1 and 2: it rises faster and faster (rise_speed + 1 each frame, y_offset - rise_speed / 2) and drifts (x_offset + 8), animation_advance and draw_object; it ends when the car (car window_segment) reaches its position or y_offset passes -3000 (high above).
comment ambient_sound_update A sound repeated at random along a stretch of road (the jungle of stage 3: sound 51): plays it, then again after 15 to 78 frames at random (random_number), until the car (car segment) has gone length segments from where it started.
comment one_shot_sound_update Plays sound 23 once and ends: placed at the start of stage 30's stream, so it sounds as the road of stage 30 starts being built.
comment west_east_panel_update The WEST BOUND / EAST BOUND panel at the bottom centre of the screen before the first fork (stream 0 at 550): animation 39 at a screen position (draw_mode A, layer 19D), its palette cycling through base_palette to base_palette + 3 (a step every 4 frames, colour_count). By state: 0 sets it up below the screen (y 118); 1 rises 2 a frame to y DC; 1 and 2: once the car (car segment) passes 250 or the race time runs out (word 6A of the race record screen host_record points at), 3: goes down 2 a frame and ends at y 118.
comment santa_sleigh_update Santa's sleigh and reindeer flying back and forth over the goal of stage 26, with sound 49 (sound) every 15 frames. By state: 0 reads the record (animation, palette, flags, side, x_offset, x_speed, sound, draw_mode, scale_shift; y_offset -100 for animation 3A0, -180 for 3A2), appear_position = position - draw_distance (and 58 = position - 100, never read); 1 not drawn until the view (race_copy window_segment) passes appear_position; 2 moves by x_speed (leftward) until its screen_x is below -B0, then 3: mirrored (flags bit 6), moves back until screen_x is above F0, then 2 again; each frame animation_advance and draw_object. It never ends (the race ends at the goal).
comment goal_parade_rightward_update What runs back and forth in front of a goal's crowd, setting off rightward: a kangaroo (stage 21), a dragon dance (22), an orca leaping over the sea (28). By state: 0 reads the record (animation, palette, flags, side, x_offset, x_speed, draw_mode, scale_shift; y_offset -180 for animation 3A2), appear_position = position - draw_distance (and 58 = position - 100, never read); 1 not drawn until the view (race_copy window_segment) passes appear_position; 2 moves by x_speed (mirrored by the record's flags bit 6) until its screen_x passes B0, then 3: unmirrored, moves back until screen_x is below -F0, then 2 again; each frame animation_advance and draw_object. It never ends.
comment goal_parade_leftward_update What runs back and forth in front of a goal's crowd, setting off leftward: a kangaroo (stage 21), an orca (28), the bulls (29). As goal_parade_rightward_update, with the turns the other way: 2 moves by x_speed (negative) until its screen_x is below -B0, then 3: mirrored (flags bit 6), moves back until screen_x is above F0, then 2 again. It never ends.
comment goal_parade_dragon_update The dragon dance in front of the crowd at the goal of stage 22 (with goal_parade_rightward's second dragon): as goal_parade_leftward_update, plus sound 44 on one frame in four at random (random_number). It never ends.
comment sounding_scenery_update Animated scenery at a goal that makes a sound every second: the pandas at Beijing (stage 24, sound 47), the cheering group with banners in Japan (23, sound 4A), at the Matterhorn (27, sound 46). By state: 0 reads its record as road_row_start does (animation, palette, flags, size_table, scale_shift, side, x_offset, y_offset, spacing, count), with a sound where a hit box would be; 1 and 2: every 60 frames (sound_countdown) the sound, animation_advance and road_row_draw. (State 3, the same without the sound, is never reached.)
comment fork_branch_start_right Starts the other branch of the road off to the right (placed on the left branch's stream: the car took the left way): direction -1, then fork_branch_draw.
comment fork_branch_start_left Starts the other branch of the road off to the left (on the right branch's stream): direction 1, then fork_branch_draw.
comment fork_branch_draw Draws the branch of the road the car did not take, after a fork, as a strip of sprites curving away to one side (direction) along the 40 segments from position: for each segment in view (the road's per-segment records from the view, screen + 3000) the piece of road (fork_branch_sprite) goes at the road's screen x plus a curve growing with the distance from start_position (cosine_table) times the road's scale times direction, the pieces between segments filled in, into the screen's sprite list and its segment's depth list, until the strip leaves the screen. Ends once the view (race_copy window_segment) passes end_position.
comment fork_branch_sprite Builds the sprite words of the branch's road piece for fork_branch_draw: the first frame of animation 74 (its size and place in the sprite ROM, the size steps at 0x122B74) and the palette of the stage being built (fork_branch_stage_palettes by screen built_stage, into sprite_palettes).
comment stage_end_sounds_update The sounds as the car nears the end of a stage (before each fork's checkpoint and each goal): sound 24, then sound 53 20 frames later (the list at 01466F: a delay, then sounds and delays closed by 0); when the race record's stage count (race_copy stage_count) changes (the checkpoint or the goal passed), sound 24 if this screen's player leads the race (screen player = leader_player), else 28, and it ends.
comment fork_camera_update Raises and tilts the view before each fork (256 segments before it), so the fork is seen from above. By state: 0 waits until the car (race_copy segment) reaches its position; 1 each frame the view's pitch lift (car view_pitch_lift) up by lift_step to lift_height (1E0 less the car model's view_pitch_base, screen_view_defaults view_pitch_bases by race_copy model; screen nearing_fork = FF when it gets there: the radio's checkpoint message) and its shift lift (car view_shift_lift) down by tilt_step; 2 holds until the car reaches lower_position (224 segments on); 3 lowers it back the same way and ends. Does nothing while car crash_body_shown is set.
comment goal_actor_start Sets an actor of the goal scene to a screen position (draw_mode 0) and goes on to goal_actor_run.
comment goal_actor_run Plays the actor's script (script; step is where this frame's step began), a step a frame: a halfword of flags, from bit 15: wait (counter to the next halfword, drawn), repeat from step (until the counter passes the next halfword), animation_advance, frame =, x +=, x =, y +=, y =, scale += and = (34, 36), layer += and =, a new animation, palette =, a sound (request_sound); with bit 0 clear the step ends and the actor is drawn (draw_object); with bit 0 set a command (goal_actor_command_jumps): 0 tells the scene object it is over (its state = 2), 1 ends the actor, 2 ends the step undrawn, 3 flips it (flags bit 6), 4 car segment_progress + 4000, 5 a repeat whose count grows by 8 for each place behind (goal_actor_place_waits by screen + 320 + player).
comment goal_actor_car_start The player's car in the goal scene: its animation, palette and frame from the race record (race_copy animation, palette, frame), its layer, place and scale from the scene object (scene: the car's drawing object, 00974C's, whose handler is 014694 at the goal); then goal_actor_start.
comment goal_actor_driver_start The driver in the goal scene: goal_actor_rider_place with the scene object's first rider record (+90).
comment goal_actor_passenger_start The passenger in the goal scene: goal_actor_rider_place with the scene object's second rider record (+A0).
comment goal_actor_rider_place Places a rider in the scene's car: from the car's current frame (the car's animation and frame from race_copy animation, frame) the view it is drawn from (bit 6 of the frame's attributes picks the mirrored set) and the seat's offset; from the rider record (R12: a table of offsets by view, the animation of the first view, the palette, the frame) the rider's animation, palette and frame; scaled by the scene object's scale onto its place, in its layer; then goal_actor_start.
comment palette_cycle_update Cycles palettes of the stage's scenery (stage_background_object_lists): after delay frames, every step_frames frames queues the next palette set of its list (palette_list; a negative entry goes back that many bytes) with queue_palette_list, for frames_left frames (or for good when it is 0); it waits while the stage's background is changing (screen background_fading) and ends when it changes again (running).
comment sunset_fade_start Fades the colours of the stage toward evening after a while (stage_background_object_lists: Hawaii's sunset after 900 frames, stage 26's dusk after 300 and its night after 600): waits count frames (not while the background changes, screen background_fading), then starts a palette fade (start_palette_fade) for each entry of its list (fade_list: from, to, the palette, the speed), keeps them in fades and their number in count, and goes on to sunset_fade_wait.
comment sunset_fade_wait Waits for its palette fades to finish, then ends; if the stage's background starts changing (screen background_fading) it stops them and ends.
comment backdrop_near_start Sets up a sprite on the background a little nearer than the panorama (the hill of the Acropolis with the Parthenon, stages 14 and 19): from its data the animation, palette, panorama_x, height and half_width; draw_mode A, layer 1; straight to state 1 when the background is being set up (screen background_at_start); then backdrop_near_update.
comment backdrop_near_update Keeps the sprite on the background, moving with its panorama a quarter faster (nearer): x from the car's heading (car view_yaw, a quarter of it until screen background_changing is set) less panorama_x, y from the background's height (screen background_scroll_y) and height, but not below screen road_top_line's line. By state: 0 waits until it is off the screen (so it does not pop up in view); 1 draw_object while on the screen; off it, it ends once leaving.
comment backdrop_landmark_start Sets up a landmark on the horizon that grows as the car approaches (Tiananmen in stage 10, the castle of stages 16 and 17...): as backdrop_near_start, layer 2, and approach_start = the car's segment (car window_segment) less the distance in its data; then backdrop_landmark_update.
comment backdrop_landmark_update Keeps the landmark on the background's panorama (as backdrop_near_update, a quarter faster than the panorama) and grows it with the distance travelled: its scale (width_scale, height_scale) follows the sine of (car window_segment - approach_start) / 2 (sine_table) up to full size (100, state 2). By state: 0 waits until it is off the screen; 1 and 2 drawn while on the screen; off it, it ends once leaving.
comment backdrop_translucent_start Sets up a sprite on the background that is drawn every other frame, so it looks faint (the pyramids of stages 13 and 20, the spray of stage 4's falls): as backdrop_near_start, layer 1, frame_count 0; then backdrop_translucent_update.
comment backdrop_translucent_update Keeps the sprite on the background's panorama at the panorama's own speed (as backdrop_far_update), animates it and draws it only on even frames (frame_count), so it looks faint. By state: 0 waits until it is off the screen; 1 drawn while on the screen; off it, it ends once leaving.
comment backdrop_off_screen Whether the background sprite is wholly off the screen (zero set; it clears flags bit 5 then): its x (field 30) more than half_width beyond the screen's edges (0..140).
scoped object road_object_stream 80 stream u32 road_object_stream_forks   # the stream it reads (an entry), or at a fork (state 3) the fork's table
scoped object road_object_stream 84 stage_start u16
scoped object road_object_stream 86 stage u8
scoped object crest_clip 10 crest u8
scoped object crest_clip 38 clip_entry u32
scoped object crest_clip 80 clip_command u16
scoped object crest_clip 82 clip_bottom u16
scoped object crest_clip 84 clip_left u16
scoped object crest_clip 86 clip_right u16
# Draw modes 1 and 6 take the address of a ready 16-byte entry of the sprite list from the object's fields 38-3B,
# which the object's own code writes as one word (crest_clip clip_entry); each is a family of its one function
scoped object draw_object_entry 38 entry u32      # 00F104, 00F10B "movcu.h [38[R20]], #8, [R10], #8": the entry it copies into the list
scoped object draw_object_command 38 entry u32    # 00F126, 00F12D "movcu.h [38[R20]], #8, [R10], #8"
scoped object traffic_spawner 18 list u32 rom
scoped object traffic_spawner 1C stage_start s16
scoped object traffic_spawner 1E stage u8
scoped object traffic_spawner 2C traffic_level u16
scoped object traffic 14 leader u32 object
scoped object traffic 18 record u32 rom
scoped object traffic 1C position s16
scoped object traffic 20 x_offset s16
scoped object traffic 22 x_offset_sign s16   # the upper half of the 32-bit stores of x_offset (its sign); the object code reads x_offset as 16 bits and nothing reads this
scoped object traffic 24 y_offset s16
scoped object traffic 26 y_offset_sign s16   # the upper half of the 32-bit stores of y_offset (its sign); the object code reads y_offset as 16 bits and nothing reads this
scoped object traffic 28 position_fraction u16
scoped object traffic 2C speed s16
scoped object traffic 30 screen_x s16
scoped object traffic 3F side s8
scoped object traffic 60 hit_box u32 item_hit_box
scoped object traffic 6A weight u16
scoped object traffic 80 passed u8
scoped object traffic 81 passing_sound u8
scoped object traffic 82 hit_sound u8
scoped object traffic 84 stop_distance u16
scoped object traffic 86 stopping u8
scoped object traffic 87 shake u8
scoped object stage_entry 1C position s16
scoped object aurora 09 animation_frames u8
scoped object aurora 10 countdown u8
scoped object aurora 18 animation_list u32 rom
scoped object kangaroo 10 draw_distance u16
scoped object kangaroo 18 record u32 road_crosser_record
scoped object kangaroo 1C position s16
scoped object kangaroo 20 x_offset s16
scoped object kangaroo 28 position_fraction u16
scoped object kangaroo 30 screen_x s16
scoped object kangaroo 3F side s8
scoped object kangaroo 56 appear_position s16
scoped object kangaroo 58 trigger_position s16
scoped object kangaroo 80 hop_animation u16
scoped object kangaroo 82 trigger_distance u16
scoped object kangaroo 84 x_speed s16
scoped object swooping_helicopter 10 draw_distance u16
scoped object swooping_helicopter 12 dive_countdown u8
scoped object swooping_helicopter 18 record u32 swooping_helicopter_record
scoped object swooping_helicopter 1C position s16
scoped object swooping_helicopter 20 x_offset s16
scoped object swooping_helicopter 24 y_offset s16
scoped object swooping_helicopter 30 screen_x s16
scoped object swooping_helicopter 3F side s8
scoped object swooping_helicopter 56 appear_position s16
scoped object swooping_helicopter 58 trigger_position s16
scoped object swooping_helicopter 80 trigger_distance u16
scoped object swooping_helicopter 82 x_speed s16
scoped object swooping_helicopter 84 y_speed s16
scoped object swooping_helicopter 86 road_speed s16
scoped object swooping_helicopter 88 dive_frames u8
scoped object swooping_helicopter 8A dive_y_speed s16
scoped object start_gate 10 spacing u16
scoped object start_gate 12 count u16
scoped object start_gate 18 record u32 start_gate_record
scoped object start_gate 1C position s16
scoped object start_gate 20 x_offset s16
scoped object start_gate 24 y_offset s16
scoped object start_gate 3F side s8
scoped object start_gate 56 first_position s16
scoped object start_gate 58 end_position s16
scoped object start_gate 60 hit_box u32 rom
scoped object start_flagman 18 record u32 flagman_record
scoped object start_flagman 1C position s16
scoped object start_flagman 20 x_offset s16
scoped object start_flagman 24 y_offset s16
scoped object start_flagman 3F side s8
scoped object start_flagman 80 go_animation u16
scoped object start_balloon 12 rise_speed u16
scoped object start_balloon 18 record u32 start_balloon_record
scoped object start_balloon 1C position s16
scoped object start_balloon 20 x_offset s16
scoped object start_balloon 24 y_offset s16
scoped object start_balloon 3F side s8
scoped object ambient_sound 10 end_position s16
scoped object ambient_sound 12 countdown u8
scoped object ambient_sound 18 length u32
scoped object west_east_panel 10 colour_count u16
scoped object west_east_panel 80 base_palette u16
scoped object santa_sleigh 10 draw_distance u16
scoped object santa_sleigh 12 sound_countdown u8
scoped object santa_sleigh 18 record u32 santa_sleigh_record
scoped object santa_sleigh 1C position s16
scoped object santa_sleigh 20 x_offset s16
scoped object santa_sleigh 24 y_offset s16
scoped object santa_sleigh 30 screen_x s16
scoped object santa_sleigh 3F side s8
scoped object santa_sleigh 56 appear_position s16
scoped object santa_sleigh 82 x_speed s16
scoped object santa_sleigh 84 sound u16
scoped object goal_parade 10 draw_distance u16
scoped object goal_parade 18 record u32 goal_parade_record
scoped object goal_parade 1C position s16
scoped object goal_parade 20 x_offset s16
scoped object goal_parade 24 y_offset s16
scoped object goal_parade 30 screen_x s16
scoped object goal_parade 3F side s8
scoped object goal_parade 56 appear_position s16
scoped object goal_parade 80 x_speed s16
scoped object sounding_scenery 10 spacing u16
scoped object sounding_scenery 12 count u16
scoped object sounding_scenery 18 record u32 sounding_scenery_record
scoped object sounding_scenery 1C position s16
scoped object sounding_scenery 20 x_offset s16
scoped object sounding_scenery 24 y_offset s16
scoped object sounding_scenery 3F side s8
scoped object sounding_scenery 45 size_table u8
scoped object sounding_scenery 56 first_position s16
scoped object sounding_scenery 58 end_position s16
scoped object sounding_scenery 80 sound u16
scoped object sounding_scenery 82 sound_countdown u8
scoped object fork_branch 1C position s16
scoped object fork_branch 56 start_position s16
scoped object fork_branch 58 end_position s16
scoped object fork_branch 80 direction s32
scoped object stage_end_sounds 09 stage u8
scoped object stage_end_sounds 10 countdown u8
scoped object stage_end_sounds 18 sound_list u32 sound_cue+1    # the next sound_cue's sound (014542 "mov.w R10, 18[R20]" after its time)
scoped object fork_camera 1C position s16
scoped object fork_camera 80 lift_step u16
scoped object fork_camera 82 tilt_step u16
scoped object fork_camera 84 lift_height u16
scoped object fork_camera 86 lower_position u16
scoped object goal_actor 10 counter u16
scoped object goal_actor 41 frame_time u8
scoped object goal_actor 42 frame_countdown s8
scoped object goal_actor 80 script u32 goal_actor_script_words
scoped object goal_actor 84 step u32 goal_actor_script_words
scoped object palette_cycle 0D running u8
scoped object palette_cycle 10 delay u16
scoped object palette_cycle 12 frames_left u16
scoped object palette_cycle 14 step_frames u16
scoped object palette_cycle 16 step_countdown u16
scoped object palette_cycle 38 palette_list u32 palette_cycle_steps
scoped object palette_cycle 80 data u32 palette_cycle_record
scoped object sunset_fade 10 count u32
scoped object sunset_fade 18 fades u32 object
scoped object sunset_fade 38 fade_list u32 palette_fade_list
scoped object sunset_fade 80 data u32 sunset_fade_record
scoped object backdrop 0D leaving u8
scoped object backdrop 20 panorama_x u16
scoped object backdrop 24 height u16
scoped object backdrop 28 half_width u16
scoped object backdrop 80 data u32 backdrop_record
scoped object backdrop_landmark 0D leaving u8
scoped object backdrop_landmark 10 approach_start u16
scoped object backdrop_landmark 20 panorama_x u16
scoped object backdrop_landmark 24 height u16
scoped object backdrop_landmark 28 half_width u16
scoped object backdrop_landmark 80 data u32 backdrop_record
scoped object backdrop_translucent 0D leaving u8
scoped object backdrop_translucent 10 frame_count u8
scoped object backdrop_translucent 20 panorama_x u16
scoped object backdrop_translucent 24 height u16
scoped object backdrop_translucent 28 half_width u16
scoped object backdrop_translucent 80 data u32 backdrop_record

# ======== the player's car and the race display (naming batch D) ========
006EF0  func  player_car_update
007F31  func  player_car_crash_step   # state 5 of player_car_update, which a hit runs into the frame it starts the crash
0070EC  func  player_car_move
007396  func  player_car_steer_to_stop
007443  func  player_car_check_place
007551  func  player_car_publish
007734  func  player_car_set_horizon
0077A4  func  player_car_place_on_road
0077DF  func  player_car_clear_hit
00780E  func  player_car_animate
007829  func  player_car_steer_frame
0078D3  func  player_car_view_height
007908  func  player_car_move_view
007B28  func  player_car_check_rivals
007C36  func  rival_warning_update
007C9E  func  rival_alarm_update
007CF1  func  player_car_load_crash_physics
009590  func  race_cars_start
00974C  func  race_car_draw
009B4A  func  race_car_draw_behind   # a rival behind the screen's car, or off the screen: race_car_draw goes on to it
009BDC  func  race_car_draw_link   # the last step of race_car_draw and race_car_draw_behind, which both go on to it
009C1E  func  race_car_draw_spray
009C71  func  race_car_draw_part
009C9E  func  race_car_put_frame
009CB6  func  race_car_put_sprite
009D54  func  race_car_put_flat_sprite
00A00C  func  player_car_load_gears
00A04A  func  player_car_build_torque_curves
00A098  func  player_car_read_controls
00A130  func  player_car_drive
00A537  func  player_car_world_position
00A632  func  player_car_place_view
00A85D  func  player_car_engine
00A914  func  player_car_engine_wheelspin   # the speed while the wheels spin or lock, which both of player_car_engine's sides go on to
00A9E9  func  player_car_engine_grip   # the speed with grip, which both of player_car_engine's sides go on to
00AA7B  func  player_car_engine_standing   # where player_car_engine_wheelspin and player_car_engine_grip go when the speed is 0
00AA88  func  player_car_engine_revs   # player_car_engine_grip's last step, which player_car_engine_standing goes on to
00AABC  func  angles_to_offset
00B4F8  func  player_car_next_surfaces
00B52F  func  player_car_road_drag
# The player's car's records and tables of the program ROM
# The race view's constants (player_car_update 006F38 "movea.b 10BC8, R2"): the address of the draw
# distances by the race's racer count (006F3F "mov.w [R2+], R0", 010BE2: 2400 3000 3000 2800 2800 2400...;
# 006F52 "mov.h [R0](R1), 12[R25]" -> screen draw_distance), eye_distance, sprite_origin_x, sprite_origin_y
# (006F58-006F62 "mov.h [R2+], 10/14/16[R25]": C0 A0 DE) and view_pitch_base by the car's model (006F6B
# "mov.h [R2](R0), 18[R25]": E8 F0 110 110 110 100 190 140)
# The grid: by the race's racer count less 1 (none in the demo), the segments each place starts ahead
# (006FB7 "mov.w 91CC[PC](R2), R3", 006FBF "add.h [R3](R1), R0" by the place) and its place across the road
# with what is left of the segment (006FD3 "mov.w 90AC[PC](R2), R3", 006FDB "mov.w [R3](R1), R1" -> car
# road_x and segment_remaining: FFFFFF50, 000000B0 for two racers)
elements grid_segments u16
elements grid_road_places u32
0091CC  table grid_segment_lists u32 grid_segments
0090AC  table grid_road_place_lists u32 grid_road_places
# Where a car stops after the goal, by its place in the race (player_car_update 00726F "mov.w
# 9540[PC](R0), R0", then 007277 "add.h [R0+], F0[R20]" to stop_position, "mov.h [R0+], F2[R20]" stop_x,
# "mov.h [R0+], F4[R20]" stop_speed): 6 bytes a place from 009560 (17C 0 C000, 178 -B0 B800...)
struct goal_stop 6 rom
field goal_stop 00 position u16
field goal_stop 02 x s16
field goal_stop 04 speed u16
009540  table goal_stops u32 goal_stop
# The crash physics of a model (player_car_load_crash_physics 007CF5 "mov.w 804A(R0), R10" by the model,
# 007CFD-007D0F "mov.h [R10+], 126/12C/128/12A[R23]": car bounce_damping, speed_change_decay, push_decay,
# gravity), its crash table right after it (007D15 "mov.w R10, 130[R23]": car crash_table): 0x208 bytes a
# model from 00806A
struct crash_physics 8 rom
field crash_physics 00 bounce_damping u16
field crash_physics 02 speed_change_decay u16
field crash_physics 04 push_decay u16
field crash_physics 06 gravity u16
field crash_physics 08 crash_entries crash_entry[]   # its crash table, whose address player_car_load_crash_physics keeps (car crash_table: the address after gravity)
00804A  table car_crash_physics u32 crash_physics
# Handling of a model (player_car_load_gears 00A010 "mov.w ADCC(R0), R12" by the model -> car handling;
# 28 bytes a model from 00ADEC): the steering by the wheel (player_car_drive 00A21F "movs.bw [0[R12]](R0),
# R0" by the wheel >> 3: 32 signed bytes, 1A at one end, E6 at the other), the drag factor off the road
# (player_car_road_drag 00B58E "mulu.w 8[R12], R0": 5A), the force that starts a wheelspin and the one that
# ends it (player_car_engine 00A9D3 "cmp.w C[R12], R9", 00A883 "cmp.w 10[R12], R9": 1C0, 1A0), the drive
# force while the wheels spin (00A8F8 "mov.w 14[R12], R9": 120), the car's half width on the road
# (player_car_drive 00A17A "movz.hw 1A[R12], R3": 2C), the brake's factor (00A1CB "mulu.w 1C[R12], R9":
# -190), the grip (00A2B1 "mov.w 20[R12], R2", a signed compare: 12C000 for the first model) and the
# slide's factor past it (00A2D0 "mulu.w 24[R12], R1": 25)
elements wheel_steering s8
struct car_handling 28 rom
field car_handling 00 steering u32 wheel_steering
field car_handling 08 off_road_drag u32
field car_handling 0C spin_start_force s32
field car_handling 10 spin_end_force s32
field car_handling 14 spin_drive_force s32
field car_handling 1A half_width u16
field car_handling 1C brake_factor s32
field car_handling 20 grip s32
field car_handling 24 slide_factor s32
00ADCC  table car_handlings u32 car_handling
# A model's gears, by model * 2 + transmission (player_car_load_gears 00A02A "mov.w B04C[PC](R1), R1"):
# the top gear, then a ratio for each gear, the first's here (car top_gear, gear_ratio; car gear_ratios points at it:
# 00A032-00A037): 00B08C 00 F8 for an automatic, 00B08E 05 6A 92 BA DD FD FF for a manual
struct gear_list 2 rom
field gear_list 00 top_gear u8
field gear_list 01 first_ratio u8
00B04C  table car_gear_lists u32 gear_list
# A point of a gear's torque curve (player_car_build_torque_curves 00A05D-00A066 "movz.hw [R11+]/[R12+]":
# the speed and the force; a gear's points end with FFFF FFFF, 00A08B "test.h [R12]", "bp"), the curves of
# a model by model * 2 + transmission (player_car_load_gears 00A020 "mov.w B0C0[PC](R1), 50[R23]" -> car
# torque_curves: 00B100 0 4800, 30 4800, 60 4800...)
struct torque_point 4 rom
field torque_point 00 speed s16
field torque_point 02 force u16
00B0C0  table car_torque_curves u32 torque_point[]   # by model: the address of its torque curve, its points up to one of negative speed (player_car_build_torque_curves)
# A stretch of a roadside surface (player_car_road_drag: 00B55E "movz.hw [R13], R6" where it ends, from the
# stage's start, FFFF to its end; 00B5E1-00B5ED "mov.h 2[R13]/4[R13]" its inner and outer edges across the
# road; wheel_effect_* 00B666 "mov.b 6[R13], 141[R23]" and 00B674 "mov.b 7[R13]" the wheel effect inside and
# outside them; 00B569 "add.w #8, R13" the next): the two lists of a stage, one for each side
# (player_car_next_surfaces 00B51A "movea.w B78C[PC](R7), R7" by stage * 2, 00B522 "mov.w [R7+],
# 148[R23]", 00B528 "mov.w [R7+], 14C[R23]": 00B88C 00B894 for stage 0)
struct roadside_surface 8 rom
field roadside_surface 00 end s16
field roadside_surface 02 inner_edge u16
field roadside_surface 04 outer_edge u16
field roadside_surface 06 inner_effect u8
field roadside_surface 07 outer_effect u8
struct stage_roadside_surfaces 8 rom
field stage_roadside_surfaces 00 first u32 roadside_surface[]   # a list of the stage's surfaces, the next one taken as the car passes each one's end (player_car_road_drag)
field stage_roadside_surfaces 04 second u32 roadside_surface[]
00B78C  table stage_roadside_surface_lists stage_roadside_surfaces
local player_car_next_surfaces 00B51A R7 stage_then_surfaces stage_roadside_surfaces
# the player's car's jumps
006F18  table player_car_state_jumps u32   # player_car_update (006F16) by state (C[R20]): 006F30 007088 0070B9 007134 007200 007F31
007164  table player_car_time_up_step_jumps u32   # player_car_move (007160), state 3, by step (D[R20]): 007174 007181 0071C8 0071EE
00720C  table player_car_goal_step_jumps u32   # player_car_move (007209), state 4, by step (D[R20]): 007224 007242 007299 0072C3 0072FB 007321
007917  table player_car_rival_step_jumps u32   # player_car_move_view (007915) by rival_step (E0[R20]): 007927 00792B 007AD1 007AFA
007C44  table rival_warning_state_jumps u32   # rival_warning_update (007C3F) by state: 007C50 007C6C 007C90
007CAC  table rival_alarm_state_jumps u32   # rival_alarm_update (007CA7) by state: 007CB4 007CC7
007D28  table player_car_hit_kind_jumps u32   # player_car_update (007D24) by hit_kind (6E[R20]): 007D47 007DBD 007E08 007D38
00A5F4  table player_car_heading_quadrant_jumps u32   # player_car_world_position (00A5F0) by the quadrant of the segment's heading (R2 >> 14): 00A604 00A60C 00A60C 00A604
00A798  table player_car_view_yaw_quadrant_jumps u32   # player_car_place_view (00A795) by the quadrant of the view's heading (R2 >> 14): 00A7A8 00A7B0 00A7B0 00A7A8
00B70C  table wheel_effect_1_jumps u32   # player_car_road_drag (00B626 "jsr [R1]") by which edges of the two surfaces the car's first side is past: 00B65F (wheel_effect_1_none), 00B68A 00B67C 00B68A 00B66E 00B68A 00B67C 00B68A 00B660 00B68A 00B67C 00B68A 00B66E 00B68A 00B67C 00B68A
00B74C  table wheel_effect_2_jumps u32   # player_car_road_drag (00B65D "jmp [R1]") the same for the other side: 00B698 (wheel_effect_2_none), 00B6C3 00B6B5 00B6C3 00B6A7 00B6A7 00B6A7 00B6A7 00B699 00B699 00B699 00B699 00B6A7 00B6A7 00B6A7 00B6A7
# the player's car's tables of values
008026  table crash_place_offsets u16   # player_car_update 007D70, 007E76 "movz.hw 8026[PC](R8), R8" by the car's place in the race: added to the crash's speed step before it picks the crash table's record (60 50 40 30 20 10 0 0)
008038  table car_weights u16   # player_car_update 007E39, 007E45 "movz.hw 8038[PC](R6/R7)" by the model of the car hit and the car's own: the weights of a car-to-car crash (110 100 F0 F0 120 180 A0 100)
00926C  table player_car_steer_animations u16   # player_car_steer_frame 007829 "mov.h 926C[PC](R9), R0" by the model: its body's animation as it steers (3AC 420 ... 6D8, 74 apart)
00927C  table steer_frames_by_steering[129] u8   # player_car_steer_frame 007840 "mov.b 92BC[PC](R0), R0" by the steering, signed (-64 to 64) from the middle (0092BC): the body's frame for it, 0 full left to 8 full right, 4 straight on
009300  table player_car_wheelspin_animations u16   # player_car_animate 007864 "movz.hw 9300[PC](R9), R9" by the model: its wheelspin (3B2 426 ... 6DE)
009310  table player_car_skid_animations_wheel_high u16   # player_car_animate 007886 "movz.hw 9310[PC](R9), R9" by model * 16 + the slide, with the wheel 80 or more: the skids (3CA 3CA 3D0 3D0 3D6...)
009410  table player_car_skid_animations_wheel_low u16   # player_car_animate 00789D "movz.hw 9410[PC](R9), R9" the same with the wheel under 80 and the slide's sign turned (3B8 3B8 3BE 3BE 3C4...)
009510  table player_car_palettes u16   # player_car_update 007004 "mov.h 9510[PC](R0), 3A[R20]" by the model: 7E 83 97 9C 88 8D A1 92
009520  table player_car_arrival_animations u16   # player_car_update 0072B5 "movz.hw 9520[PC](R0), R9" by the model: the animation it plays stopping after the goal (400 474 ... 72C)
009530  table player_car_time_up_brakes u8   # player_car_update 00714C "mov.b 9530[PC](R0), D1[R20]" by model * 2 + transmission: the brake when the time is up (87 95 87 96 6D 6F...)
00ABC3  table car_skid_noises u8   # player_car_update 0072DE "mov.b ABC3(R0), R0" and player_car_engine 00A8B4 "mov.b ABC3[PC](R0), R0" by the model: set_tyre_noise's (04 04 06 06 07 07 05 05)
00ABCB  table gas_pedal_curve s8   # player_car_drive 00A1CF "movs.bw ABCB[PC](R8), R8" by the gas: the drive's factor, -20 with the pedal up to 7F down
00ACCB  table brake_pedal_curve u8   # player_car_drive 00A1B2 "movz.bw ACCB[PC](R9), R9" by the brake: the brake force (0 for the first 64, then up to 7F)
# the race cars' tables, by the car's model unless said (race_cars_start 0095C8-00962B "mov.h/mov.b
# 9xxx[PC](R2), xx[R21]" into the race_car's fields)
009DCC  table race_car_first_body_pieces u16   # -> first_body_piece (32D 1AD 3ED 4AD 56D 2D 26D ED)
009DDC  table race_car_first_body_animations u16   # -> first_body_animation (3AC 420 ... 6D8)
009DEC  table race_car_driver_animations u16   # -> driver_animation (746 816 ... CF6)
009DFC  table race_car_passenger_animations u16   # -> passenger_animation (7AE 87E ... D5E)
009E0C  table race_car_driver_gesture_masks u8   # -> driver_gesture_mask (00 FF FF FF 00 FF 00 00)
009E14  table race_car_passenger_gesture_masks u8   # -> passenger_gesture_mask (FF FF 00 00 FF FF FF FF)
009E1C  table race_car_driver_palettes u16   # -> driver_palette (A6 AA A9 A8 A7 AD AB AC)
009E2C  table race_car_passenger_palettes u16   # -> passenger_palette (AE B2 B1 B0 AF B5 B3 B4)
009E3C  table race_car_driver_frame_counts u8   # -> driver_frames (03 03 03 08 08 03 03 03)
009E44  table race_car_passenger_frame_counts u8   # -> passenger_frames (03 05 03 03 08 03 03 06)
18D25C  table race_car_rider_places u32 car_part_place[]   # race_cars_start 009636 "mov.w 18D25C(R2), R3" (and 01431F): a model's places of the driver, the passenger and the two sprays, 16 bytes a view (-> driver_places, passenger_places + 4, spray_2_places + 8, spray_1_places + C; 18D27C...)
009EBC  table race_car_driver_handlers u32   # race_cars_start 0096C4 "mov.w 9EBC[PC](R3), 4[R21]": the handler of the car's driver (014108 for all)
009EDC  table race_car_passenger_handlers u32   # race_cars_start 0096E1 "mov.w 9EDC[PC](R3), 4[R21]": the passenger's (014108 for all)
009F7C  table race_car_tag_palettes u16   # race_cars_start 009695 -> tag_palette (2A 28 29 2C 27 2D 2E 2B)
009F8C  table race_car_tag_animations u16   # race_cars_start 00968A "mov.h 9F8C[PC](R1), BA[R21]" by the car number -> tag_animation (1D-24)
009F9C  table race_car_blink_starts u8   # race_cars_start 0096A0 by the car number -> blink_counter (00 10 04 0C 02 0A 06 0E)
009FC4  table race_car_ending_handlers u32   # race_car_draw 009799 "mov.w 9FC4[PC](R0), 4[R20]": what the car becomes once the race is over (014694, race_car_start_ending, for all)
009E4C  table race_car_body_wheel_kinds u8   # race_car_draw 0098D7 "test.b 9E4C[PC](R1)", 00990C "cmp.b #2, 9E4C[PC](R1)" by the body animation less first_body_animation: 0 no wheels drawn (special_body), 1 wheels, 2 wheels the other way round
009FA4  table race_car_tag_blink u8   # race_car_draw 009A56 "test.b 9FA4[PC](R0)" by blink_counter & 1F: the tag shown (01 x6, 00 00, 01 x6, then 0)
009F6C  table race_car_spray_frame_counts u8   # race_car_draw_spray 009C4F "cmp.b 9F6C[PC](R0), R1" by the spray's kind: its number of frames (05 05 05 05 05 05 05 04 04 12...)
009F0C  table race_car_spray_palettes u16   # race_car_draw_spray 009C69 "movz.hw 9F0C[PC](R0), R13" by the spray's kind: its palette (4F x5, 50 53 53 54...)
elements object_palette_steps s16                 # an object's palettes to step through, a word each; a negative one goes back that many bytes (branch_arrow_update 00CB7D "movs.hw [R10+], R0", a negative one added to R10 at 00CB84: 5D 5D 5E 5E 5F 5F -14 at D0A0)
struct sprite_animation 4 rom
field sprite_animation 00 frame_time u8           # animation_start (00F372 "mov.b [R9], R9") -> object 41, 42
field sprite_animation 04 frames s32[] sprite_frame   # the frames' entries: 00EF66 "mov.w 4[R12](R26), R12" (by object 40); animation_advance 00F335-00F361 tests them (0 hold, -1 back to frame 0, -2 the animation the next entry names)
elements sprite_animation_pointer u32 sprite_animation
034138  table  sprite_animations  sprite_animation_pointer  # by object 38: animation_start (00F36A "mov.w 34138(R9), R9"), put_object_sprites (00EF5A), animation_advance, the road rows
struct sprite_frame 2 rom
field sprite_frame 00 piece_count u16             # put_object_sprites 00EF9C "movz.hw [R12+], R11" (dbr's count), draw_object_smoothed 00F21C; draw_object_one_piece and the road rows skip it (00F082 "add.w #2, R12")
struct sprite_piece 8 rom
field sprite_piece 00 attributes u16              # sprite word 0, xor-ed with flags bits 6-7 (00EF9F "mov.h [R12+], R0; xor.h R19, R0")
field sprite_piece 02 sprite u16                  # its first size step at 122B74 + 4 * it (00EFAD "add.h [R12+], R26"; all 26323 pieces of the census a multiple of 3)
field sprite_piece 04 y_offset s16                # 00EFE9 "movs.hw [R12+], R4": times the height and the flip's sign, + y
field sprite_piece 06 x_offset s16                # 00EFF6 "movs.hw [R12+], R5": times the width and the flip's sign, + x
struct sprite_size_step 0C rom
field sprite_size_step 00 source_size u16         # 00EFB8 "mov.h [R14+], R1": sprite word 1
field sprite_size_step 02 rom_offset u16          # 00EFBB "mov.h [R14+], R6": sprite word 6
field sprite_size_step 04 height u16              # 00EFC1 "movz.hw [R14+], R2": times the height scale >> 8 & 3FF, sprite word 2
field sprite_size_step 06 height_bits u16         # 00EFD0 "or.h [R14+], R2"
field sprite_size_step 08 width u16               # 00EFD3 "movz.hw [R14+], R3": times the width scale >> 8 & 3FF, sprite word 3
field sprite_size_step 0A width_bits u16          # 00EFE2 "or.h [R14+], R3"
elements sprite_palette_words u16                 # a palette's words, one a piece (put_object_sprites 00EFBE "mov.h [R13+], R7")
elements sprite_palette_pointer u32 sprite_palette_words
032BA4  table  sprite_palettes  sprite_palette_pointer  # by object 3A: put_object_sprites (00EF6F "mov.w 32BA4(R26), R13"), draw_object_one_piece, draw_object_smoothed, the road rows
# the race cars' sprites (race_car_draw 009967 "add.w #2, R11", race_car_put_frame 009CAB and race_car_put_flat_sprite
# 009D60 "add.w #2, R12": past the frame's piece count, its first piece; race_car_put_sprite 009CC4 and
# race_car_put_flat_sprite 009D71 "movea.w 122B74(R14), R14": the piece's size step)
param race_car_draw_behind R10 sprite_entry
param race_car_draw_behind R19 race
param race_car_draw_link R9 depth_layer
param race_car_draw_link R10 sprite_entry
local race_car_draw 009967 r11 piece sprite_piece
local race_car_put_frame 009CAB r12 piece sprite_piece
local race_car_put_flat_sprite 009D60 r12 piece sprite_piece
local race_car_put_sprite 009CC4 r14 size_step sprite_size_step
local race_car_put_flat_sprite 009D71 r14 size_step sprite_size_step
# the perspective by depth (race_car_draw 009831 "movz.hw 1A0340(R17), R9", 009839 "movz.hw 19A340(R17), R8")
19A340  table  perspective_scales  u16            # player_car_project_road (0101BF "movz.hw 19A340(R28), R5") by the segment's depth: its scale, C0000 / depth (EC4E at D; 0 below D, where it would not fit)
1A0340  table  depth_layers_by_depth  u16         # player_car_project_road (010202 "movz.hw 1A0340(R28), R28") by the depth: the depth layer (screen + 5000) of what is there, 190 near
100C00  table  sine_table  s16                         # "movs.hw 100C00(Rn)" by a 12-bit angle (1000 a turn): 4000 * sin; 5120 words, so that cosine_table (100C00 + 800) is the same table a quarter turn on
101400  table  cosine_table  s16                       # "movs.hw 101400(Rn)": 4000 * cos
00B6D1  func  player_car_off_road_shake
00BFC1  func  rev_meter_update
00C017  func  speedometer_update
00C0C6  func  speed_unit_update
00C10D  func  gear_indicator_update
00C231  func  shift_up_hint_update
00C2AC  func  place_count_update
00C342  func  place_number_update
00C43E  func  lap_timer_update
00C59C  func  start_message_update
00C65F  func  time_left_display_update
00C68E  func  time_digits_start
00C70C  func  time_digits_draw
00C7CD  func  time_left_display_check_extension
00C7EC  func  extend_time_message_start
00C857  func  extend_time_message_blink
00C8B6  func  goal_update
00C9ED  func  race_result_start
00CA44  func  race_result_hold
00CA50  func  race_result_verdict_start
00CAA8  func  race_result_verdict_blink
00CABC  func  branch_arrow_update
00CBC0  func  checkpoint_board_update
00CD8B  func  checkpoint_board_draw_row
00CE99  func  checkpoint_board_leader_time
00CEA7  func  time_to_text
00CEF3  func  checkpoint_board_gap_time
00FCBC  func  player_car_start_course
00FD22  func  player_car_extend_course
00FD78  func  player_car_build_segment
010062  func  player_car_project_road
01028A  func  rotate_offset
0115B1  func  queue_stage_load
011F30  func  player_car_start_engine_sound
011F7C  func  player_car_engine_sound
011FC3  func  set_tyre_noise_on_road
011FC9  func  set_tyre_noise
0120AC  func  vector_angle
012109  func  vector_angles
# ---- B3: the tables and records the HUD, the sprites, the road and the screen set-up read ----
# Tables of code addresses each handler jumps through by its state ("mov.w TABLE[PC](R0), R0; jmp [R0]")
00BFCC  table  rev_meter_state_jumps  u32           # rev_meter_update (00BFCA) jumps through it by state: 00BFD4 00C005
00C024  table  speedometer_state_jumps  u32         # speedometer_update (00C020): 00C02C 00C06F
00C0D4  table  speed_unit_state_jumps  u32          # speed_unit_update (00C0CF): 00C0DC 00EAE4 (draw_object)
00C118  table  gear_indicator_state_jumps  u32      # gear_indicator_update (00C116): 00C124 00C158 00EAE4 (draw_object)
00C23C  table  shift_up_hint_state_jumps  u32       # shift_up_hint_update (00C23A): 00C244 00C273
00C2B8  table  place_count_state_jumps  u32         # place_count_update (00C2B5): 00C2C0 00C320
00C350  table  place_number_state_jumps  u32        # place_number_update (00C34B): 00C368 00EAE4 00C3AE 00C3F0 00C418 00EAE4
00C44C  table  lap_timer_state_jumps  u32           # lap_timer_update (00C447): 00C45C 00C4B3 00C53B 00C541
00C5A8  table  start_message_state_jumps  u32       # start_message_update (00C5A5): 00C5B8 00C5FF 00C628 00C653
00C66C  table  time_left_display_state_jumps  u32   # time_left_display_update (00C668): 00C67C 00C6DC 00C6E7 00C7A9
00C880  table  stage_entry_state_jumps  u32         # stage_entry_update (00C87C): 00C884 (its one state)
00C8C4  table  goal_state_jumps  u32                # goal_update (00C8BF): 00C8DC 00C8EE 00C973 00C982 00C9C0 00C9C8
00CAC8  table  branch_arrow_state_jumps  u32        # branch_arrow_update (00CAC5): 00CAD4 00CB3F 00CB57
00CBCC  table  checkpoint_board_state_jumps  u32    # checkpoint_board_update (00CBC9): 00CBD8 00CC1E 00CC43
00CC70  table  checkpoint_board_row_state_jumps  u32  # checkpoint_board_update (00CC6E) by the state of a player's row (object F0 + player): 00CC84 00CCEC 00CCFC 00CD32 00CD55
00DDB4  table  entry_invitation_step_jumps  u32     # entry_invitation_step (00DDB2) by screen game_step: 00DDC8 00DDD9 00DE53 00DE62 00DE8B
00EB44  table  draw_object_mode_jumps  u32          # draw_object calls through it by draw_mode (read at 00EAEE, "jsr [R0]" at 00EB01): 00EF32 00F104 00EB74 00EEBF 00EE37 00EC1B 00F126 00ECCD 00F04E 00EE75 00F15C 00ED82
00F34C  table  animation_order_jumps  u32           # animation_advance (00F349) by the order a frame entry holds (0 - the entry): 00F358 (0: hold) 00F390 (1: back to frame 0) 00F361 (2: the next animation)
00FF40  table  course_command_jumps  u32            # player_car_build_segment's course reading (00FF3E; player_car_extend_course goes into it) by 0 - the command: 00FF5C (0 the end) 00FF80 (1 a jump) 00FF89 (2 a fork) 010020 (3) 010030 (4 a stage) 010052 (5) 00FF62 (6 the goal)
013D94  table  course_length_command_jumps  u32     # init_screen (013D90) by ~ the command while it adds up a course's lengths: 013DAC 013DB6 013D7B 013DB1 013D7B 013DB6
01168C  table  screen_fade_kind_jumps  u32          # step_screen_fade (011688) by screen fade_kind: 0116A8 0116B1 0116BA 0116C3 0116CC 0116D5 0116FA
# The car models' (car model, 0-7) off-road effects, by model
00B6FC  table  car_model_off_road_noises  u8      # player_car_off_road_shake (00B6E9 "movz.bw B6FC[PC](R1), R0", set_tyre_noise): 2 for models 0-6, 8 for model 7
00B704  table  car_model_off_road_shakes  u8      # player_car_off_road_shake (00B6DD "mov.b B704[PC](R1), D0[R24](R0)", wheel_motor): 10 for models 0-6, 0 for model 7
elements car_gear_ratios u8                       # a car's gear ratios, first gear first (car gear_ratios: player_car_load_gears 00A032-00A037 points it past the record's top gear; gear_indicator_update 00C19D "movz.bw [54[R23]](R1), R2", 00C1C7 -> car gear_ratio): 1 for the automatics (F8, F0, E6...), 2-6 for the manuals (6A 92 BA DD FD FF)
local gear_indicator_update 00C19D R2 old_ratio                 # the ratio of the gear shifted down from
00D018  table  gear_indicator_animations  u16     # gear_indicator_update (00C12B "movz.hw D018[PC](R0), R9") by car top_gear: 7 (AUTO) for 0, 8 9 A B C for 1-5
00D034  table  stage_level_texts  u32             # stage_indicator_draw (00C58A "mov.w D034[PC](R0), R19", draw_text) by screen route_stage_level: text records D04C PRE-STAGE, D05C 1, D064 2, D06C 3, D074 4, D07C FINAL STAGE
00D04C  data  stage_level_text_records   # the draw_text records stage_level_texts points at: PRE-STAGE, 1, 2, 3, 4, FINAL STAGE
00D0C0  table  lap_timer_checkpoint_states  u8    # lap_timer_update (00C4EC "mov.b D0C0[PC](R1), C[R20]") by the checkpoint passed less 1: its next state, 2 (the split shown) for 0-4, 3 (the last lap's time kept) for 5
# Where checkpoint_board_draw_row puts a row's pieces, by row ("movea.w TABLE[PC](R0), R10" with row = object 12, then [R10+] twice)
struct checkpoint_board_place 4 rom
field checkpoint_board_place 00 x u16             # 00CD95 "mov.h [R10+], R0" (+ the row's slide, A0[R20](R21)) -> object 30
field checkpoint_board_place 02 y u16             # 00CDA2 "mov.h [R10+], 32[R20]" -> object 32
local checkpoint_board_draw_row 00CD8F,00CDD5,00CE5C R10 place
00CF68  table  checkpoint_board_car_places  checkpoint_board_place      # 00CDD5: the car's small image, x 60, y 48 58 ... B8
00CF88  table  checkpoint_board_number_places  checkpoint_board_place   # 00CD8F: the car number, x 60, y 4B 5B ... BB
00CFA8  table  checkpoint_board_behind_places  checkpoint_board_place   # 00CE5C: BEHIND, x 112, y 49 59 ... B9
00CFC8  table  checkpoint_board_car_sprites  u32  # checkpoint_board_update (00CBF5 "mov.w CFC8[PC](R1), 80[R20](R0)") by the car chosen (byte 49 of the player's race_copy record): the small image's animation (low half) and palette (high half)
00CFE8  table  checkpoint_board_number_animations  u16  # checkpoint_board_draw_row (00CDAC "movz.hw CFE8[PC](R9), R9") by car_numbers[player]: animations 1D-24 for car numbers 0-7
00CFF8  table  checkpoint_board_time_places  u32  # checkpoint_board_draw_row (00CE28 "mov.w CFF8[PC](R0), R3", draw_text_at's place) by row: x (low half) C0, y (high half) 40 50 ... B0
00E4D0  table  link_board_ic_texts  u32           # network_check_show_ics (00D6D7 "mov.w E4D0(R3), R19", print_text_layer) by 2 * IC + its bit: IC17 GOOD E514, BAD E524; IC23 E534, E544; IC11 E554, E564; IC10 E574, E584; IC9 E594, E5A4
00E4F8  data  link_board_ic_text_records   # COMMUNICATION BOARD TEST (characters alone, then FFFF), then the print_text_layer records link_board_ic_texts points at (IC17 GOOD ... IC9 BAD), each closed by FFFF
00E0C4  table  race_copy_player_offsets  u32 race@20FC00  # players_not_ready (00DEE6 "mov.w E0C4[PC](R2), R2", then 1C5C[R24](R2): byte 5C of the record at 20FC00 + it) by player: 0, 80, 100 ... 380
00E5B3  table  stage_start_times  u8              # race_progress_update (00DC30 "mov.b E5B3[PC](R0), R0", + master_time_difficulty, * 30 into time_left) by the stage the fork leads to: seconds, 40 for stage 0, 32 for 1-2, 34 for 3-6, 31 for 7-C, 40 for D-1E (1F: 0)
00E5D3  table  fork_next_stages  u8               # race_progress_update (00DC28, 00DD9B) by stage * 2 + branch: the stage the branch leads to (1 2 for stage 0, 3 4 for 1, ... up to 1E)
00E614  table  entry_frames_by_machines  u16      # race_entries_update (00DA5C "movz.hw E614[PC](R1), R9") by machine_count (0 when stand_alone): 258 (600 frames) for each of 0-4
# The program ROM's animations: sprite_animations (034138: the address of each animation's record, by the
# object's animation) -> a record (frame_time, then a 32-bit entry a frame: the frame's address, or an order
# when not positive) -> a frame (its count of pieces, then 8 bytes a piece) -> a piece's size steps (122B74 +
# 4 * (the piece's sprite + 3 * the object's size_step): 12 bytes each)
# The pointers: where each function moves past the frame's count to its first piece, and where it takes a piece's size steps
local put_object_sprites 00EF66 R12 frame sprite_frame
local put_object_sprites 00EF9C R12 piece sprite_piece
local put_object_sprites 00EFBE t1 palette_word
local put_object_sprites 00EFB0 R14 size_step sprite_size_step
local fork_branch_sprite 01407A R26 size_step sprite_size_step   # 01407A "movea.w 122B74(R26), R26": the first piece's size step, read through as put_object_sprites does (014082-01409B "[R26+]")
local draw_object_one_piece 00F082 R12 piece sprite_piece
local draw_object_one_piece 00F0A4 R7 palette_word
local draw_object_one_piece 00F096 R14 size_step sprite_size_step
local draw_object_smoothed 00F1EC R12 frame sprite_frame
local draw_object_smoothed 00F21C R12 piece sprite_piece
local draw_object_smoothed 00F2FF t1 palette_word
local animation_advance 00F361 R9 next_animation
local draw_object_smoothed 00F23B R14 size_step sprite_size_step
local road_row_draw 00F691 R12 piece sprite_piece
local road_row_draw 00F6B5 R13 size_steps sprite_size_step
local road_row_pair_draw 00F9DF R12 piece sprite_piece
local road_row_pair_draw 00FA03 R13 size_steps sprite_size_step
00F13C  table  sprite_flip_x_signs  u32           # put_object_sprites (00EF8C "mulu.w F13C[PC](R26), R17", R26 = flags & C0 >> 5: 0 2 4 6): 1, -1 (bit 6), 1, -1; the width's sign for the x offsets
00F140  table  sprite_flip_y_signs  u32           # put_object_sprites (00EF94 "mulu.w F140[PC](R26), R18"): 1, 1, -1 (bit 7), -1; the height's sign for the y offsets
00F4E8  table  smoothed_flip_x_signs  u32         # draw_object_smoothed (00F20C "mov.w F4E8[PC](R26), R17", R26 = flags & C0 >> 5: 0 2 4 6): 1, -1 (bit 6), 1, -1; records of two signs, smoothed_flip_signs (the y one) after each
00F4EC  table  smoothed_flip_signs  u32           # draw_object_smoothed (00F214 "mov.w F4EC[PC](R26), R18", the same index): 1, 1, -1 (bit 7), -1
# What finish_sprite_list switches to, by screen and buffer (sprite_list_switches: 00F3A8 "mov.w F508[PC](R9), R19")
struct sprite_list_switch 14 rom
field sprite_list_switch 00 list u32              # the list just finished: its start entry
field sprite_list_switch 04 end_word u16          # the word that ends its chain (8003, 8004: a jump to entry 3, or the end)
field sprite_list_switch 06 entry_2_jump u16      # -> sprite RAM 400020
field sprite_list_switch 08 entry_3_jump u16      # -> sprite RAM 400030
field sprite_list_switch 0A next_buffers u16      # -> sprite_list_buffers
field sprite_list_switch 0C next_list u32         # -> screen sprite_list_last (40A000, 404000, ...)
field sprite_list_switch 10 next_limit u32        # -> screen sprite_list_limit
elements sprite_list_switch_pointer u32 sprite_list_switch
00F508  table  sprite_list_switches  sprite_list_switch_pointer  # F528 F53C F550 F564 F578 F58C F5A0 F5B4: 14 bytes apart
00F528  table  sprite_list_switch_records  sprite_list_switch   # the eight records sprite_list_switches points at (by screen, buffer and list), 14 bytes each, to 00F5C7
# The hit box of a road item (road_row: its record's 8 bytes at 10; traffic: its sprite record's last 8)
struct item_hit_box 8 rom
field item_hit_box 00 along_start u16             # road_row_hit_check 01236F "add.h [R10+], R6": along the road, from the item
field item_hit_box 02 along_end u16               # 012372 "add.h [R10+], R7"
field item_hit_box 04 across_start u16            # 012375 "add.h [R10+], R8": across, from the item's place
field item_hit_box 06 across_end u16              # 012378 "add.h [R10+], R9"
# The course: stage_courses (03CC00, by stage) holds each stage's stream of commands (car course)
elements course_pointer u32
03CC00  table  stage_courses  course_pointer      # player_car_start_course (00FCD2 "mov.w 3CC00(R0), R11") by screen first_stage; init_screen walks the 31 (013D6F "mov.w [R10+], R12")
# A fork's command (-2) is followed by the stages of its two branches and their courses
struct course_fork 0A rom
field course_fork 00 branch_stages u8[2]          # player_car_extend_course 00FFCF "movz.bw [R11](R0), R1" (R0 the branch) -> screen route_stage
field course_fork 02 branch_courses u8[8]         # 00FFD3 "mov.w 2[R11](R0), A0[R23]" -> car course: the two branches' courses, a 32-bit address each, as the bytes of the course's stream they lie in (course_bytes)
local player_car_extend_course 00FFBF R11 course course_fork
local player_car_start_course 00FCD2 R11 course course_start
elements road_projection_pattern u8               # player_car_project_road 010150 "test.b [AP+]": a byte a segment out from the window, 1 projects it, 0 copies the one before
local player_car_project_road 01013C R29 projection_pattern road_projection_pattern
local player_car_project_road 010150 t1 projected
# note_road_crest takes the last segment's height and depth layer in R27 and R28, which the function sets
# when it projects a segment (01015F, 010166); only a pattern that copied every segment out to the view's
# distance would hand it what R27 and R28 held when the function started, and segment_projection_pattern
# starts with a 1
unread player_car_project_road R27
unread player_car_project_road R28
100000  table  blank_sprite_places  u32           # road_row_draw (00F8E6 "mov.w 100000, R26", 4 times into the next sprite places), road_row_pair_draw (00FC97); 00F61E "movea.b 100000, R28" when nothing was drawn the frame before: 16-byte places 00000000 F800F800 ..., this one's first word 0
# The road rows' sizes: by the record's size_table (object 45), a list of the size step and of the shift by the scale >> 5
elements road_row_size_steps u8
elements road_row_size_steps_pointer u32 road_row_size_steps
1598CC  table  road_row_size_step_lists  road_row_size_steps_pointer    # road_row_draw (00F763 "mov.w 1598CC(R26), AP"; "movz.bw [AP](R4), R4"): 1598DC 15995C 1599DC 159A6C; their bytes 4 down to 0
elements road_row_size_shifts s8
elements road_row_size_shifts_pointer u32 road_row_size_shifts
159AFC  table  road_row_size_shift_lists  road_row_size_shifts_pointer  # road_row_draw (00F754 "mov.w 159AFC(R26), AP"; "movs.bw [AP](R4), AP"): 159B0C 159B8C 159C0C 159C9C; their bytes 0 down to -4
103400  table  arctangents  u16                   # vector_angle (0120E6 "movz.hw 103400(R0), R0") by 400 * the smaller / the larger: the angle (0-200)
0121D8  table  octant_base_angles  u16            # vector_angle (0120F6 "add.h 121D8[PC](R4), R0") by the octant (bits: 1 x < 0, 2 y < 0, 4 |x| < |y|): 400 C00 400 C00 0 0 800 800
0121E8  table  octant_angle_factors  u16          # vector_angle (0120EE "mulu.h 121E8[PC](R4), R0"): FFFF 1 1 FFFF 1 FFFF FFFF 1, the arctangent added or taken off
# The screens' set-up (init_screen, init_video, init_sprite_chip, init_mixer) and their fades
struct screen_hardware 10 rom
field screen_hardware 00 sprite_screen_bit u16    # init_screen 01064A "mov.h [R2+], 1A[R25]" -> screen sprite_screen_bit (0, 0800)
field screen_hardware 02 palette_ram u32          # -> screen palette_ram (600000, 680000)
field screen_hardware 06 mixer u32                # -> screen mixer (610000, 690000)
field screen_hardware 0A io_chip u32              # -> screen io_chip (C00000, C80000)
elements screen_hardware_pointer u32 screen_hardware
010BA0  table  screen_hardware_records  screen_hardware_pointer  # init_screen (010642 "mov.w 10BA0[PC](R1), R2") by screen index: 010BAA, 010BBA
# The screens' view at the start: init_screen (01065E "movea.b 10BC8[PC], R2", then [R2+]) and player_car_update (its first state: 10BC8 and 10BCC, by isdn_mode and the car model)
elements draw_distance_list u16                   # 010BE2: 2400 3000 3000 2800 2800 2400 2400 2400 2400
struct screen_view_default 1A rom
field screen_view_default 00 draw_distances u32 draw_distance_list  # 010665 "mov.w [R2+], R0"; 010668 "mov.h 2[R0], 12[R25]": the second -> screen draw_distance
field screen_view_default 04 eye_distance u16     # 01066E "mov.h [R2+], 10[R25]" -> screen eye_distance: C0
field screen_view_default 06 sprite_origin_x u16  # 010673 -> screen sprite_origin_x: A0
field screen_view_default 08 sprite_origin_y u16  # 010678 -> screen sprite_origin_y: DE
field screen_view_default 0A view_pitch_bases u16[8]  # by car model: E8 F0 110 110 110 100 190 140; init_screen 01067D takes model 0's -> screen view_pitch_base, fork_camera_update (by race_copy model) and player_car_update (by car model) theirs
010BC8  table  screen_view_defaults  screen_view_default  # one record
010B10  table  video_control_default  u16         # init_video (0106B8 "mov.h 10B10, 31FF00", 0106C4 into video_registers): 0800, the video control register
010B0A  table  sprite_control_mode  u8            # init_sprite_chip (0107CA "movz.bh [R19+], [R18+]") -> 500000: 00
010B0B  table  sprite_control_flip  u8            # 0107D1 "movz.bh [R19+], R0" (xor 3 with flip_screen) -> 500004: 00
elements sprite_control_values u8                 # 0107E0-0107EC: the rest -> 500006-50000C (00 01 03 00)
local init_sprite_chip 0107D1 R19 control_values sprite_control_values
struct hidden_layer_pair 2 rom
field hidden_layer_pair 00 first_layer u8               # init_mixer 0108BD "movz.bw [R10+], R0": a mixer register of the other screen's layers, cleared
field hidden_layer_pair 01 second_layer u8              # 0108C0
010B06  table  hidden_layer_pairs  hidden_layer_pair  # init_mixer (0108B5 "movea.h 10B06[PC](R0), R10") by screen index: 12 14 (NBG1, NBG3), 11 13 (NBG0, NBG2)
struct screen_fade_start 4 rom
field screen_fade_start 00 level u8               # step_screen_fade 0116DC "mov.b [R19+], 150[R25]" -> fade_level
field screen_fade_start 01 step s8                # 0116E2 -> fade_step
field screen_fade_start 02 end u8                 # 0116E8 -> fade_end
field screen_fade_start 03 channels u8            # 0116EE -> fade_channels (E0 red, green and blue; 80 red)
01173A  table  screen_fade_starts  screen_fade_start  # by fade_kind: 40 FF 20 E0 (to black), 20 01 00 E0, 00 01 1F E0 (to white), 1F FF 00 E0, 00 01 05 80 (red tint), 05 FF 00 80
local step_screen_fade 0116A8,0116B1,0116BA,0116C3,0116CC,0116D5 R19 fade_start screen_fade_start
elements text_font_rows u8                        # a character's 8 rows of 8 one-bit pixels
local load_shadowed_text_font 0117FE R19 font_rows text_font_rows
elements text_characters u8                       # a text's characters, closed by 0
elements course_bytes u8                         # a course's records (stage_courses): a halfword, a run's length or 0 - its command, then its operands (player_car_extend_course and player_car_build_segment read them a byte or a halfword at a time)
elements input_test_bytes u8                     # input_test_items as test_mode_input_test_draw walks them: the numbers' cells (halfwords), then each switch's port and bit (bytes) and its two cells (halfwords)
elements test_mode_text_bytes u8                 # a test mode text record as test_mode_draw_texts walks it: lines of a cell (a halfword), characters and colour changes (bytes), each closed by 0
struct stored_duration 5                         # a time as the unused test_mode_duration_to_seconds and test_mode_split_minutes_seconds keep it
field stored_duration 00 seconds u8
field stored_duration 01 minutes u8
field stored_duration 02 hours u8
field stored_duration 03 days u16
local network_check_toggle_memory_text 00D739 R28 memory_text text_characters
122B5C  table  text_sprite_words_0_1  u32         # draw_text, draw_text_at (011A15 "mov.w [R0+], R1" from 122B5C): a character's sprite words 0 and 1 (000A, 0802)
122B60  table  text_sprite_size  u32              # 011A18: words 2 and 3, its size (D008, 0008), with sprite_screen_bit
122B64  table  text_sprite_font  u16              # 011A2A: word 6, the font's place in the sprite ROM (A861), + 8 a character
122B66  table  text_sprite_palette  u16           # 011A2D: word 7, or-ed with the text's attribute
011FFC  table  music_fade_addresses  u32 music_fade_delays          # fade_out_music_at (011FEE "mov.w 11FFC[PC](R10), R10") by screen index: 700918, 70F118
012026  table  car_model_engine_samples  u8       # player_car_start_engine_sound by car model -> the sound board's engine sample: 0 2 5 4 3 3 6 1
01202E  table  demo_sounds  u32                   # request_sound (011ED4 "test1 R1, 1202E[PC](R2)"): 8 words of a bit a sound, the ones the demo plays (20-DF)
01204E  table  demo_second_sounds  u32            # request_second_sound (unused): the same for the second ring, all 0
012238  func  player_car_build_hit_boxes
0122AD  func  player_car_write_hit_box
01256F  func  player_car_check_car_hits
014108  func  race_car_occupant_update
014114  table race_car_occupant_state_jumps  u32   # race_car_occupant_update (014111 "jmp [R0]") jumps through it by state: 014120 014144 01416F
01440E  table race_car_occupant_animations  u16   # race_car_occupant_update "movz.hw 1440E[PC](R0), R9" (01412C) by occupant (the car's model for its driver, model + 8 for its passenger: race_cars_start), for animation_start; census ROM 01440E-01442D (0DC6-0DD5, one a rider)
01442E  table race_car_rider_palettes  u16   # the riders' palettes, by occupant or rider (model, model + 8): race_car_occupant_update (014134) and rider_gesture_update (014229) "mov.h 1442E[PC](R0), 3A[R20]"; census ROM 01442E-01444D (00A6-00B5)
014694  func  race_car_start_ending
comment player_car_update The screen's car, each frame: player_car_check_place, player_car_read_controls, player_car_build_hit_boxes, then by state: 0 sets up the race (the view's constants in screen eye_distance-18, the course, the car on its grid place: segment 16 + grid_segment_lists by players and place, road_x from grid_road_place_lists, its world position; the palette of its model, player_car_palettes; timer 8 frames in the demo, 149 in a race with the intro view car view_shift_intro/view_pitch_intro; the gears, torque curves, crash physics, with screen is_host the race's time left (race time_left: 40 seconds plus master_time_difficulty), the engine sound); 1 the countdown to the start: brake full and the wheel centred until timer runs out (others read it as the frames to the start), then car moving and race started; 2 driving (player_car_move): goes to 3 when the time is up (car time_up), to 4 at the goal (car at_goal); counts hit_guard down; on a hit (flags bit 2, by hit_kind): 3 a fork sign slows it for 15 frames (car slowed_frames), 0 scenery, 1 a road object (hit_other), 2 the other player's car (hit_other): a speed change, a push and a bounce from the model's crash table (car crash_table, by impact_speed or the cars' speeds and places), the hit's sounds, a crash animation, the CRASH text (car crash_text), immune (flags bit 3), state 5 and its first frame; 5 the crash plays out (player_car_crash_step); 3 time up: gas off and the model's brake (player_car_time_up_brakes), 180 frames, then the race is over (car race_over), GAME OVER (004771) with one player or race_result_start with two, 60 frames, screen flags bit 4 and DJ message 36 or 37; 4 the goal: finished, the race's stage count up, waits for the screen's finish time (screen 410) into race finish_time and the race time, race finished, then drives itself (player_car_steer_to_stop) to its stop_position by its place (goal_stops), plays the model's arrival animation (player_car_arrival_animations), brakes to a stop, 90 frames, screen flags bit 4.
comment player_car_crash_step The crash playing out, each frame of player_car_update's state 5 and the frame a hit starts it: at the goal (car at_goal) back to 2 at once; else the wheel motor at 10, the hit's sound once its delay (car crash_sound_delay) runs out, no controls, the push and the speed change dying away (car push_decay, speed_change_decay), a bounce under gravity (car gravity, bounce_damping; sound 31 on landing), and back to 2 with 15 frames of hit_guard when the crash animation ends (frame_time 0).
0146A0  table race_car_ending_state_jumps  u32   # race_car_start_ending (01469D "jmp [R0]") jumps through it by state: 0146B0 01470D 01470E 01470D
comment player_car_move One frame of the car on the road: player_car_drive, player_car_place_view, player_car_move_view, player_car_set_horizon, player_car_publish, player_car_extend_course, player_car_project_road, player_car_engine_sound and player_car_animate; no wheel effects while it crashes (state 5).
comment player_car_steer_to_stop Drives the car by itself after the goal: gas 40, no brake, the speed (car speed) a 16th of the way to stop_speed each frame, and the wheel turned step by step toward stop_x across the road (centred within 8 of it; stop_wheel keeps it).
comment player_car_check_place Keeps the race order around the screen's car: screen leader_record-6C the race records (leader_player to behind_player the players) of the leader, the last, the car just ahead and the car just behind (all itself in the demo), screen leader_window_segment and leader_stage the leader's race window_segment and stage. When its place (screen 320 + player, kept in place) changes during the race: sound 37 when the car it passed or that passed it is within 160 across, else 3A. While first, blinks one of the screen's lamps (the count, period and timer bytes C9-CB of its entry at checkpoint_lamp).
comment player_car_publish Hands the car's state on: this frame's view into the screen's ring of eight (screen + 600, slot view_ring_slot, also race view_slot) and the view of the slot race_copy view_slot names back into the car and screen shown_view, so that both screens draw the view of the same frame; and the car's world position, animation, palette, frame, wheel effects, speed, sideways speed, flags, segments, place across the road and bounce into its race record (race published set), from which race_car draws it on both screens. Not in ISDN mode (isdn_mode), which reads them back instead.
comment player_car_set_horizon Works out the horizon's line on the screen (screen horizon_line) from the view's tilt: the nod (car view_pitch_nod), the rival's and the fork camera's pulls (view_pitch_rival, view_pitch_lift), the car model's base pitch (screen view_pitch_base), clamped to C0-200, and the intro's (view_pitch_intro).
comment player_car_place_on_road Puts the car on its starting segment at the start: no way into the segment, road_x from the grid's place, its world position (player_car_world_position) and the view behind it (player_car_place_view).
comment player_car_clear_hit Ends what a hit was doing to the car: no sideways_push, speed_change, bounce, no hit pending (flags bit 2), and the car no longer skidding (car skidding) or slipping (wheel_slip).
comment player_car_animate Picks the car's animation: while a hit is pending, the one it has goes on; skidding (car skidding), a skid by how far it slides (slide) toward the side the wheel is turned (player_car_skid_animations_wheel_high, player_car_skid_animations_wheel_low by model); spinning its wheels while it speeds up (car wheel_slip, acceleration above 0), the model's wheelspin (player_car_wheelspin_animations); else its body turned by the steering (player_car_steer_frame). Each one in the row of the view's height (player_car_view_height); a new one starts at frame 0.
comment player_car_steer_frame The car's body as it steers: the model's animation (player_car_steer_animations) in the row of the view's height, its frame (steer_frame) one step a frame toward the one of the steering (steer_frames_by_steering, from its middle: 0 full left to 8 full right, 4 straight on).
comment player_car_view_height The row of the car's animations for how steeply the view looks down on it: the view's pitch (car view_pitch) less B0 and less the road's pitch under the car (race_copy segment_pitch), in steps of 30, 0 to 5 (view_height).
comment player_car_move_view Moves the view with what the car does: when a rival comes close (player_car_check_rivals, rival_step) it starts the RIVAL SEKKIN warning (rival_warning) and pulls the view back and up (car view_shift_rival to -256, view_pitch_rival +8 a step) until the rival has gone, then lets it back; a speed gain of more than A0 in a frame without wheelspin sets car hard_acceleration (hard acceleration); the view nods (nod, car view_shift_nod and view_pitch_nod) one way with that hard acceleration and the other with hard braking (more than 120 a frame with the brake down), easing back; and it lags the car's rises and drops (car view_rise).
comment player_car_check_rivals Whether a rival is close (rival_near): at speed 6000 or more (5000 to stay on), the car just ahead (screen ahead_record) a little slower and within reach, or the car just behind (behind_record) a little faster and close; once on it stays for 30 frames (rival_hold) after the rival has gone.
comment player_car_load_crash_physics Loads the crash physics of the car's model (car_crash_physics): bounce_damping, speed_change_decay, push_decay, gravity and the address of its crash table.
comment player_car_load_gears Loads the car's model and transmission: its handling record (car handling), its torque curves (torque_curves), its gear ratios (gear_ratios) and top gear (top_gear), the first gear's ratio (gear_ratio), and the roadside surfaces of the first stage (player_car_next_surfaces).
comment player_car_build_torque_curves Builds the drive force of each gear by speed at screen + 1300 (256 values a gear), interpolating the model's points (car torque_curves).
comment player_car_read_controls Takes the controls: gas, brake and wheel from the screen's pedals and wheel (screen gas, brake, wheel). In the demo (screen demo_flags bit 8) the car drives itself: no brake, the gas up to F0 (eased off while skidding), the wheel back toward the middle when off the road or slowed, else against its sideways drift.
comment player_car_drive Moves the car for the frame: the drag (player_car_road_drag), the slope of its segment (race segment_pitch), the brake (no gas while braking; brake lights car brake_lights) and the gas through the gear's torque curve go to player_car_engine (speed, revs); the wheel steers through the model's table (less at low speed) into steering; the road's turn under it (previous_heading less heading) pushes it out (less with catch-up, car catch_up); beyond the model's grip it skids (car skidding, slide, tyre noise 3, smoke on both sides); sideways_speed and sideways_push move it across (car road_x, within the road's half width + 60); the speed along (less its sideways angle, vector_angle) plus a catch-up bonus by the distance to the car ahead (car catch_up_target, catch_up; not once finished) moves it along, passing segments (car window_segment, segment, segment_offset, window_offset, segment_progress, segment_fraction); then player_car_world_position. In ISDN mode (isdn_mode) the race record the link brings in gives all this.
comment player_car_world_position Places the car in the world from its segment: world_x and world_z from the segment's position and the car's place across and along it turned by the road's heading and pitch (rotate_offset), world_y the road's height there plus bounce_height (the old one to previous_world_y); the rest of the segment (car segment_remaining) and the road's heading under the car (heading, the old one to previous_heading).
comment player_car_place_view Places the view behind the car: a point on the road some way back of the car (the nod, the intro, the rival and road-object pulls: car view_shift_nod, view_shift_intro, view_shift_rival, view_shift_lift) and across (view_side) and above (view_rise) it (view_target_x/y/z), looking toward the road twelve segments on (vector_angles: car view_yaw the yaw, road_pitch the road's pitch; car view_pitch the pitch with the view's tilt), the eye screen eye_distance back from the target along those angles (angles_to_offset) in car view_x-28.
comment player_car_engine The engine and the speed: the force (brake, slope and drag, drive; acceleration) changes the speed (car speed, also impact_speed), with any speed_change from a hit, up to the top speed of the gear (its ratio, car gear_ratio); a force past the model's grip spins the wheels, and hard braking locks them (car wheel_slip: tyre noise 1 or the model's skid noise, smoke; player_car_engine_wheelspin), the rest has grip (player_car_engine_grip); the revs (car revs) follow the speed through the gear's ratio, or the gas when the car stands; car moving says it moves.
comment player_car_engine_wheelspin The speed and the revs while the wheels spin or lock (player_car_engine goes on to it from both of its sides): the speed (car speed, with any speed_change from a hit, not below 0) goes half the way toward itself plus the force (not below 0), or a thirtieth of the way down to the gear's top speed (at most FFFF), into car speed and impact_speed; standing, player_car_engine_standing; moving, car moving FF and the revs a tenth of the way toward the speed * 256 by the gear's ratio (at most FFFF).
comment player_car_engine_grip The speed and the revs with grip (player_car_engine goes on to it from both of its sides): car wheel_slip 0, the speed as player_car_engine_wheelspin works it out; standing, player_car_engine_standing; moving, car moving FF and the revs toward the speed * 256 by the gear's ratio (player_car_engine_revs).
comment player_car_engine_standing The car standing (speed 0): car moving 0 and the revs toward the gas * 256 (player_car_engine_revs).
comment player_car_engine_revs Moves the revs (car revs) a third of the way toward target_revs, at most FFFF.
comment player_car_next_surfaces Takes the roadside surfaces of the stage (screen built_stage): the two lists of stage_roadside_surface_lists for it (car surface_entry_1, surface_entry_2), from the segment where the stage starts (car surface_start) to the next one's (surface_next_start).
comment player_car_road_drag The drag on the car: speed squared, times the model's off-road factor while slowed (car slowed_frames) or off the road (car off_road, with the off-road shake); and the roadside surfaces under its wheels (car surface_entry_1, surface_entry_2) give the effects at each side (car wheel_effect_sides: bit 0 with wheel_effect_1, bit 1 with wheel_effect_2).
comment player_car_off_road_shake Off the road: the model's shake to the screen's bits of output port D (wheel_motor, the wheel motor's; car_model_off_road_shakes) and its off-road noise (car_model_off_road_noises).
comment player_car_start_course Starts the race's course (stage_courses by screen first_stage, car course): clears the ring of segments, the first road width, and builds the segments as far as the view reaches (screen draw_distance >> 7, prebuilt_segments); the first stage into the stage history.
comment player_car_extend_course Keeps the course built 104 segments past the window's start (window_record, build_end_offset). At a fork the building waits (at_fork) until the checkpoint is passed (screen forks_decided): then the branch taken (screen 349 + the fork) goes on: branch, the course of that branch (car course), its stage (screen route_stage, stage indicator A5), the stage and branch histories and forks_taken, the stage's data queued (queue_stage_load) and the branch_arrow.
comment player_car_build_segment Builds the next segment of the road from the course (car course): at the end of a run reads the next records: 0 the course ends (the car's state 3), 1 a jump to another part, 2 a fork (forks_reached, the race's stage count, at_fork), 3 and 5 the pitch and the heading back to 0, 4 a new stage (screen built_stage_level, built_stage; stage_segments, stage_start), 6 the goal (a goal object at this segment), else a run (its length, pitch and heading steps, road width, a byte for the segments). The segment: heading and pitch turned by the run's steps, the position moved along them (next_x/y/z), the width eased toward the run's; written at build_offset, then built_segments and stage_segments count up.
comment player_car_project_road Projects the road for the view of screen shown_view (player_car_publish): its rotation (view_matrix_*, from the view's pitch and yaw), then each segment from the window's start out to the view's distance turned into the view and scaled by its depth into the screen's list at screen + 3000 (scale, width, x, y, the segment's byte), segments behind the view or too far left out.
comment player_car_start_engine_sound Starts the car's engine sound on the screen's channel of the sound board: the model's engine sample (car_model_engine_samples) and the engine's loudness by the transmission (10, or 30, 6 dB louder, with the transmission's value set), then the revs on (1) and the requests for the sample and the pitch (A0); silent in the demo without sound.
comment player_car_engine_sound Sets the engine's pitch from the revs (car revs) each frame, or silences it in the demo without sound.
comment player_car_build_hit_boxes Builds the hit boxes of the race's cars at screen + 510: how many, then for each its player, race record and box (player_car_write_hit_box from its segment, model, place along and across; screen own_hit_box the screen's own), and the screen's car's box from its own fields at screen + 5B0.
comment player_car_write_hit_box Writes a car's hit box: its record, its first and last segment (4 on), and its box along and across from the model's size (car_hit_box_sizes).
comment player_car_check_car_hits Whether the car hits another car of the race (the boxes of player_car_build_hit_boxes; not while either is immune, flags bit 3): a hit of kind 2 with that car's player in hit_other.
comment vector_angle Returns the 12-bit angle of the vector (R0 - R2, R1 - R3). Used by player_car_drive.
comment vector_angles Returns the angles from a point (R3, R4, R5: x, y, z) toward another (R0, R1, R2): the pitch in R0, the yaw in R1. Used by player_car_place_view.
comment rotate_offset Turns an offset (R1 across, R2 along, R0 up) by a heading (R3) and a pitch (R4) into the world's axes. Used by player_car_world_position and player_car_place_view.
comment angles_to_offset Returns the offset of length R2 along pitch R0 and yaw R1 (R3, R4, R5: x, y, z). Used by player_car_place_view for the eye behind the view's target.
comment set_tyre_noise Sets the noise of the screen's car's tyres on the sound board (byte 718 of the screen's page; the sound program keeps it while the game keeps writing it and keys it off 255 of its main loop's passes after the last): wheelspin, skids, off-road rumble. In the demo without sound it mutes the engine instead. Used by player_car (player_car_engine, player_car_off_road_shake, the goal) and 00664E.
comment set_tyre_noise_on_road set_tyre_noise, unless the car is off the road (car off_road), where the off-road noise plays. Used by player_car_drive, player_car_engine and gear_indicator_update.
comment queue_stage_load Queues the palette of the stage the screen goes to (scene_palettes by screen route_stage) through queue_palette (the palette queue at screen + 900). Used by player_car_extend_course and the game's code (002E74).
comment rev_meter_update The rev meter, the bar left of the speed at the bottom right: state 0 sets it up (animation 6, at F2, D6), 1 draws the frame of the revs (car revs >> 11, 32 steps).
comment speedometer_update The speed in km/h at the bottom right: state 0 sets it up (digits of animation 12, units_x, digits_y) and clears the screen's maximum (maximum_speed), sum (speed_sum) and count (speed_samples); 1 each frame the car's speed / 88 into screen shown_speed, and while moving adds it to the sum, counts it and keeps the maximum (for the LCD's pages), then draws its digits from the units leftwards.
comment speed_unit_update The km/h after the speed: state 0 sets it up (animation 10 at 127, CE), 1 draws it.
comment gear_indicator_update The gear at the bottom right, and the shifting: state 0 sets it up (gear_indicator_animations by the top gear: AUTO for the automatic). 1 each frame: the shift buttons (screen buttons_pressed bits 4 up, 5 down) change the gear within 0 and the top gear; shifting up at revs F000 or more, or down into revs past FFFF, spins the wheels 30 frames (car shift_spin, tyre noise 1); the gear's ratio to car gear_ratio, its frame drawn. Below the top gear with the revs at the limit (FF00) and the car moving, after 150 frames starts the shift_up_hint once. Once the race is over (car at_goal or race_over), 2 only draws.
comment shift_up_hint_update A hint to shift up, blinking at the bottom centre (animation E): state 0 sets it up; 1 blinks it (4 frames of 8) while the car stays in the gear it started in with the revs at FC00 or more, then ends and lets the gear indicator start it again.
comment place_count_update The number of cars after the place at the bottom left (/2): ends at once with one player; state 0 sets it up (animation 5, frame the players less one) and starts the place_number; 1 draws it, and when the screen's place (screen place) changes passes the new one to the place_number (its place, state 2).
comment place_number_update The screen's place, 1st or 2nd, at the bottom left: state 0 sets it up (animation 4, the place's frame and colour); 1 draws it; 2 a new place: twice the size and blinking for 40 frames, 4 shrinking back into place in 8, then 5 draws it.
comment lap_timer_update The lap time after LAP at the top right: state 0 sets it up (the label, the text record and the checkpoints passed); 1 shows the race time since the last checkpoint (car race_time / 10 less car checkpoint_time, time_to_text); when the screen's car passes a checkpoint (screen 480 + player) the time it took (screen 3C0 records) starts the next lap (car checkpoint_time) and stays shown in another colour for 180 frames (split_frames; state 2), and C00074, which the board does not map, gets 8 + 2 * screen + (1 - the stage's parity); after the last (lap_timer_checkpoint_states) 3 keeps the last lap's time.
comment start_message_update The start's messages in the middle of the screen: state 0 shows YOU'RE IN CAR NUMBER n! (animation 28F + the screen's car number, screen car_number, with DJ message 21 + it); when the start's countdown (the car object's timer) is at 30 frames, Ready (animation 31, DJ message 31); at 0, Go! (animation 32, DJ message 32), 30 frames, then it ends.
comment time_left_display_update The time left in seconds at the top centre, and the time up: state 0 waits for the race's time (host_record's time_left), takes it into car time_left and sets the digits up (time_digits_start); 1 shows it during the start's countdown; 2 follows the race's time (until the screen's car has finished, race_copy finished) and starts EXTEND TIME at each checkpoint (time_left_display_check_extension); at 0 the time is up (car time_up) and 3 shows 0, until time comes back (the car drives on: its state 2). The digits flip as they change (time_digits_draw).
comment time_left_display_check_extension Starts the EXTEND TIME message once for each checkpoint passed (screen forks_decided, counted in car extensions_shown).
comment time_digits_start Sets up the three digits of the time at the top centre (animation 3 at A9, 11), each to open from nothing at its first value. Used by time_left_display, car_select_run and 001EC2.
comment time_digits_draw Draws the three digits of R0 (binary-coded decimal), the units at the right: a digit that changes squeezes shut and opens again as the new one; leading zeros are left out.
comment extend_time_message_start Sets up the EXTEND TIME message under the time (animation 33) for 90 frames, blinks one of the screen's cabinet lamps 16 times (bytes C1-C3 of its entry at checkpoint_lamp), then extend_time_message_blink.
comment extend_time_message_blink Blinks EXTEND TIME (4 frames on, 4 off) until its frames run out.
comment goal_update The goal line and what follows it: state 0 waits until the screen's car reaches its segment (position), then marks the car at the goal (car at_goal); 1 when the car's finish is recorded (race finished) sets up Congratulations! (animation 2F5) and the TOTAL TIME (the text at D08E and the screen's finish time, screen 410, through time_to_text), DJ message 34 when first, else 35, the screen's sound byte to 7F; 2 waits; 3 after 120 frames draws them for 60, then the title Dream Flying (start_song_title) and sound 10; 4 240 more frames of both, or with two players 5 only the TOTAL TIME beside the race_result; then it ends.
comment race_result_start With two players, the result at the end of the race: the screen's place in big letters (animation 2F8: 1st, 2nd) at the bottom for 240 frames (race_result_hold), and the verdict above it (race_result_verdict_start).
comment race_result_hold Draws the place or Loser until its frames run out.
comment race_result_verdict_start The verdict over the place: Winner (animation 2F6), blinking (race_result_verdict_blink), for the first, Loser (2F7) for the other, 240 frames.
comment race_result_verdict_blink Blinks Winner (4 frames on, 4 off) until its frames run out.
comment branch_arrow_update The arrow of the way taken at a fork, at the bottom centre, with CHECK POINT scrolling on the LCD between arrows of that way: state 0 sets it up (animation 34 or 35 by the branch, car branch; DJ message 33 when first, else 3A, unless one is playing) for 57 segments of the race (leave_segment); 1 cycles its colours (palette_list); 2 then grows and drops out of the screen. Ends when the race is over.
comment checkpoint_board_update The times at a checkpoint, in rows under the top line: state 0 takes each player's car image (checkpoint_board_car_sprites by the car chosen); 1 waits until the screen's car passes a checkpoint (screen 480 + player); 2 then shows a row for each car that has passed it, in the order they did (screen 390): the first with its time, the others with how far behind the first they were (BEHIND); each row slides in from the right, the screen's own blinks while it waits for the others, and all slide out once the race has gone C0 segments on (leave_segment) or is over; when the last has gone, back to 1.
comment checkpoint_board_draw_row Draws row of the board for player R21, slid by its offset: the car number, the car's small image, the time text (draw_text_at; another colour after the first row) and, after the first, BEHIND.
comment checkpoint_board_leader_time Writes the first car's time R0 as M'SS"HH into player R1's row text.
comment checkpoint_board_gap_time Writes how far behind the first player R1 passed (R0, hundredths) into its row text, as time_to_text does but with spaces for zero minutes and zero tens of seconds.
comment time_to_text Writes the time R0 (hundredths of a second) as M'SS"HH, closed by 0, at R10. Used by lap_timer, goal, checkpoint_board, 001EC2 and 00270C.
comment race_cars_start Starts the race's cars: for each player of the race, a race_car with its race record and the tables of its model (body, driver_places, passenger_places, sprays, tag), the two race_car_occupant objects and two rider_gesture objects that follow it; then ends.
comment race_car_occupant_update One of the two people in a race car (race_car_occupant_animations, race_car_rider_palettes by occupant), seen only while the car shows an animation of its own (its special_body: a crash): then drawn at the car's place and size until its animation ends, when the second one lets the car go back to its body.
comment race_car_draw Draws a car of the race, the screen's own or a rival, from its race record (record), as the screen's view sees it: its world position less the view's through the view's matrix and scaled by its depth (off the screen, too near or too far: not drawn); its body (animation, frame, palette from the record, plus the screen's brake lights and wheel_turn), its driver and passenger (driver_places, passenger_places), the sprays at its wheels (race_car_draw_spray), five frames of animation 44 on its hard acceleration (record hard_acceleration, car hard_acceleration); over the screen's own car the CRASH (or Ouch!) text after a hit, over a rival its number tag, blinking. A rival behind the window of the road, or off the screen, is race_car_draw_behind's. Its sprites go into the list of their depth layer (race_car_draw_link). A body animation without wheels (race_car_body_wheel_kinds) sets special_body for the occupants. Once the race is over (screen flags bit 4) it becomes race_car_start_ending.
comment race_car_draw_behind A rival behind the screen's car, or off the screen (race_car_draw goes on to it): within 256 segments behind, small at the bottom of the screen, larger as it closes in (depth layer 191), across as it is on the road (the difference of road_x, at most 58 either way) and up by its bounce; its car and its number tag (tag_animation, tag_palette), into the list of that depth layer (race_car_draw_link), with special_body and gesture_shown cleared.
comment race_car_draw_link Puts the sprites a car has just written (from the screen's sprite_list_last on, up to sprite_entry) at the head of the list of its depth layer (screen + 5000 + 4 * depth_layer; its tail too when the list was empty), and moves sprite_list_last on to sprite_entry.
comment race_car_draw_spray Draws the spray at one side's wheels (dust, smoke, water...: the record's kind, from the race record's wheel effects), cycling its frames.
comment race_car_draw_part Draws a part of the car (a wheel, a spray) at its offset from the car's place, scaled with the car.
comment race_car_put_frame Puts the first piece of frame R14 of animation R12 with palette R13 into the sprite list, scaled by R8 at R17, R18 (race_car_put_sprite).
comment race_car_put_sprite Writes one sprite of a frame's piece into the screen's sprite list (and its copy at + 3000), its size and offsets scaled by R8, at R17, R18.
comment race_car_put_flat_sprite Writes the first piece of animation R12 into the sprite list at R17, R18 at its own size (the number tags).
comment race_car_start_ending The end of the race for the screen's car: starts the objects of its ending (ending_actor_lists by its model and whether it won, or unfinished_ending_actor_count when it did not finish); when they are done (state 2) sound 4F and raises screen flags bit 1, which game step 7 waits for ( the music stopped without a finish).
comment rival_warning_update RIVAL SEKKIN !! (a rival approaching) at the centre of the screen: 12 frames on, 6 off, 12 on, with the rival_alarm, then it ends.
comment rival_alarm_update The sound of the rival warning: sound 2B twice, 15 frames apart.
scoped object player_car 0D step u8
scoped object player_car 10 timer u16
scoped object player_car 20 world_x s32
scoped object player_car 24 world_y s32
scoped object player_car 28 world_z s32
scoped object player_car 2C speed u16
scoped object player_car 2E sideways_speed s16
scoped object player_car 41 frame_time u8
scoped object player_car 42 frame_countdown s8
scoped object player_car 68 hit_other u16
scoped object player_car 6E hit_kind u8
scoped object player_car 6F hit_guard u8
scoped object player_car 8E heading u16
scoped object player_car 90 previous_heading u16
scoped object player_car 94 acceleration s16
scoped object player_car 96 steering s16
scoped object player_car A0 view_target_x s32
scoped object player_car A4 view_target_y s32
scoped object player_car A8 view_target_z s32
scoped object player_car B0 brake_force u16
scoped object player_car B4 previous_world_y s32
scoped object player_car B8 slide s16
scoped object player_car C0 impact_speed u32
scoped object player_car C4 speed_change s32
scoped object player_car C8 bounce_height s32
scoped object player_car CC bounce_speed s16
scoped object player_car CE sideways_push s16
scoped object player_car D0 gas u8
scoped object player_car D1 brake u8
scoped object player_car D2 wheel u8
scoped object player_car D9 view_height u8
scoped object player_car DA place u8
scoped object player_car DB steer_frame u8
scoped object player_car E0 rival_step u8
scoped object player_car E1 rival_near u8
scoped object player_car E2 nod s16
scoped object player_car E4 rival_hold u8
scoped object player_car F0 stop_position u16
scoped object player_car F2 stop_x s16
scoped object player_car F4 stop_speed u16
scoped object player_car F6 stop_wheel u8
scoped object player_car F7 stop_gas u8
scoped object player_car F8 finished u8
scoped object speedometer 20 units_x u16
scoped object speedometer 24 digits_y u16
scoped object gear_indicator 10 redline_frames u16
scoped object gear_indicator 80 hint_started u8
scoped object shift_up_hint 09 gear u8
scoped object shift_up_hint 10 blink u8
scoped object shift_up_hint 14 indicator u32 object.gear_indicator
scoped object place_count 09 place u8
scoped object place_count 14 number u32 object.place_number
scoped object place_number 09 place u8
scoped object place_number 10 frames u8
scoped object place_number 12 blink_timer u8
scoped object lap_timer 0A checkpoints u8
scoped object lap_timer 10 split_frames u16
scoped object lap_timer 80 text_x u16
scoped object lap_timer 82 text_y u16
scoped object lap_timer 84 text_attribute u16
scoped object start_message 10 frames u8
scoped object extend_time_message 10 frames u8
scoped object extend_time_message 12 blink u8
scoped object goal 10 timer u16
scoped object goal 1C position s16
scoped object goal 80 text_x u16
scoped object goal 82 text_y u16
scoped object goal 84 text_attribute u16
scoped object race_result 10 frames u16
scoped object branch_arrow 10 leave_segment u16
scoped object branch_arrow 18 palette_list u32 object_palette_steps
scoped object checkpoint_board 0A checkpoints_seen u8
scoped object checkpoint_board 0B checkpoint u8
scoped object checkpoint_board 0D blink_timer u8
scoped object checkpoint_board 0E blink_on u8
scoped object checkpoint_board 0F rows_shown u8
scoped object checkpoint_board 10 leave_segment u16
scoped object checkpoint_board 12 row u8
scoped object checkpoint_board 13 rows_left u8
scoped object checkpoint_board 14 passing_order u32 checkpoint_pass
scoped object checkpoint_board 18 checkpoint_count u32 checkpoint_counts
scoped object checkpoint_board 1C leader_time u16
scoped object checkpoint_board 80 car_sprites u32[8]   # each player's small car image (checkpoint_board_car_sprites by the car the player chose: state 0): its animation in the low half, its palette in the high one
scoped object checkpoint_board A0 row_offsets u16[8]   # how far each row is slid, by its player (100 as it comes in, 10 less a frame)
scoped object race_car_occupant 09 occupant u8
scoped object race_car_occupant 0A body_back u8
scoped object race_car_occupant 14 car u16 object.race_car
scoped object race_car 09 player u8
scoped object race_car 0A model u8
scoped object race_car 2E special_body u8
scoped object race_car 80 record u32 race
scoped object race_car 88 wheel_turn u32
scoped object race_car B0 crash_text_y s16
scoped object race_car B2 crash_text_frames u8
scoped object race_car B3 crash_text_rise u8
scoped object race_car B4 crash_text_animation u16
scoped object race_car B6 crash_text_palette u16
scoped object race_car B8 tag_palette u16
scoped object race_car BA tag_animation u16
scoped object race_car BC blink_counter u8
scoped object race_car BD rival u8
scoped object rival_warning 10 frames u8
scoped object rival_warning 12 blinks u8
scoped object rival_alarm 10 frames u8
field car 0 object u32 object.player_car
field car 04 race_time u32
field car 08 checkpoint_time u32
field car 12 time_left u16
field car 14 song u8
field car 20 view_x s32
field car 24 view_y s32
field car 28 view_z s32
field car 2C view_pitch u16
field car 2E view_yaw u16
field car 30 road_pitch u16
field car 32 segment_fraction u16
field car 34 segment_progress u32
field car 38 road_x s16
field car 3A segment_remaining u16
field car 3C window_record u32 road_segment   # the ring's segment the car's window starts at
field car 40 segment_offset u16
field car 42 window_segment u16
field car 44 segment u16
field car 46 stage_segments u16
field car 48 stage_start u16
field car 4A reached_stage_start u16
field car 4C surface_next_start u16
field car 4E surface_start u16
field car 50 torque_curves u32 torque_point
field car 58 handling u32 car_handling
field car 54 gear_ratios u32 car_gear_ratios
field car 60 model u8
field car 61 transmission u8
field car 62 gear u8
field car 63 top_gear u8
field car 64 gear_ratio u8
field car 65 wheel_slip u8
field car 66 moving u8
field car 67 skidding u8
field car 68 catch_up_target u16
field car 6A catch_up u16
field car 70 revs u16
field car 74 speed u16
field car 7C off_road u8
field car 7E brake_lights u16
field car 80 next_x u32
field car 84 next_y u32
field car 88 next_z u32
field car 90 next_x_fine u32
field car 94 next_y_fine u32
field car 98 next_z_fine u32
field car 9C width_code u8
field car 9D width_changing u8
field car A0 course u32 rom
field car A4 window_offset u16
field car A6 build_offset u16
field car A8 build_end_offset u16
field car AA built_segments u16
field car AC prebuilt_segments u16
field car AE run_left u16
field car B0 pitch_angle u32
field car B4 heading_angle u32
field car B8 pitch_step u16
field car BA heading_step u16
field car BC road_width u16
field car BE road_width_step s16
field car C0 road_width_target u16
field car C9 branch u8
field car CB at_fork u8
field car CC forks_reached u8
field car CD extensions_shown u8
field car D0 forks_taken u8
field car D1 stage_history u8[6]   # the stages taken, one a fork (player_car_extend_course: at forks_taken + 1)
field car D7 branch_history u8[5]   # the branches taken, one a fork (player_car_extend_course: at forks_taken)
field car DC view_matrix_xx s32
field car E0 view_matrix_xy s32
field car E4 view_matrix_xz s32
field car E8 view_matrix_yx s32
field car EC view_matrix_yy s32
field car F0 view_matrix_yz s32
field car F4 view_matrix_zx s32
field car F8 view_matrix_zy s32
field car FC view_matrix_zz s32
field car 100 view_shift_nod u16
field car 102 view_pitch_nod u16
field car 104 view_rise u16
field car 106 view_side u16
field car 108 view_shift_lift u16
field car 10A view_pitch_lift u16
field car 10C view_shift_intro u16
field car 10E view_pitch_intro u16
field car 110 view_shift_rival u16
field car 112 view_pitch_rival u16
field car 120 hit_across u16
field car 122 hit_along u16
field car 126 bounce_damping u16
field car 128 push_decay u16
field car 12A gravity u16
field car 12C speed_change_decay u16
field car 130 crash_table u32 crash_entry
field car 134 crash_sound u8
field car 135 crash_sound_delay u8
field car 136 crash_text u8
field car 140 wheel_effect_sides u8
field car 141 wheel_effect_1 u8
field car 142 wheel_effect_2 u8
field car 144 shift_spin u8
field car 145 hard_acceleration u8
field car 146 surface_stage u8
field car 147 slowed_frames u8
field car 148 surface_entry_1 u32 roadside_surface
field car 14C surface_entry_2 u32 roadside_surface
field car 180 time_up u8
field car 181 at_goal u8
field car 182 race_over u8

# ======== the attract mode, the name entry, the ranking and the route map (naming batch E1) ========
001687  func  car_presentation_update
001980  func  car_name_start
0019C0  func  car_name_letter_update
001EC2  func  name_entry_update
00200F  func  name_entry_read_wheel   # state 2's reading of the wheel, which name_entry_update goes on to from two places
002067  func  name_entry_choose   # the rest of state 2, which name_entry_update and name_entry_read_wheel go on to
002157  func  name_entry_finish   # the end of the name, which name_entry_choose goes on to from four places
00218E  func  name_entry_store_record   # state 3, which name_entry_finish goes on to
0021D9  func  name_entry_draw_time   # the seconds left and the texts, which states 1 and 2 both go on to
002204  func  name_entry_letter_update
0022F7  func  name_entry_lcd_update
002379  func  name_entry_car_update
0023C6  func  name_entry_drivers_update
002416  func  name_entry_course_name_update
00247A  func  ranking_update
00254D  func  ranking_background_update
002612  func  ranking_title_left_update
00265F  func  ranking_title_right_update
0026AD  func  ranking_course_banner_update
00270C  func  ranking_record_start
00278E  func  ranking_record_character_update
002870  func  ranking_record_car_update
002933  func  passing_traffic_start
002952  func  passing_traffic_update
002998  func  passing_car_update
002AC8  func  ranking_background_load
003520  func  route_map_update
003E1B  func  route_map_car_update
003F27  func  route_map_sign_update
004056  func  route_map_landmark_update
004122  func  map_depth_from_y
004152  func  stage_result_line_draw
011011  func  queue_tile_pages
0119FA  func  draw_text_at
011E2C  func  start_object_list
0179AC  func  set_up_background
comment car_presentation_update The presentation of a car in the attract mode (game mode 3, car_presentation_object_handlers): the picture of the car screen attract_car names. By state: 0 starts car_name and staff_credits_code (with this object as its presentation, kept in staff_credits_code), the screen's background (set_up_background with 001AA0 by screen), the picture (animation attract_car_picture_animations by the car, palette 275, draw mode 0) at x A0, y 60 on depth layer 0; 1 steps its animation (animation_advance) and draws it. Every frame, in all states, it queues the next of the four palette records of car_presentation_palette_cycle (palette_step, round and round) with queue_palette_list, so the picture's colours cycle. State 2 (the palette only, no picture) is not set by its own code.
comment car_name_start Starts the letters of the presented car's name (attract_car_names by screen attract_car: MAD POWER, SPEED BUSTER, EASY HANDLING, SMOOTH OPERATOR, BAD BOY, ROAD MONSTER, QUICK REACTOR, WILD CHASER): a car_name_letter for each character, spaces too, 18 pixels apart from x 168, each 2 frames later than the one before (delay 15, 17...); then ends.
017A78  table background_register_lists  u32 background_registers   # set_up_background "mov.w 17A78[PC](R0), R10" (0179B0) by screen index: where its two tilemaps' register copies are; census ROM 017A78-017A7F (017A80 017AB0)
# The addresses of a screen's two tilemaps' register copies (and the bits it clears in video_registers[2]),
# as set_up_background writes them: "mov.w [R10+], R11" then a write through R11 (0179B6-017A06), "mov.w
# [R10+], R0; and.h R0, 204[R24]" (017A0A), "mov.w [R10+], R11" (017A17: the mixer, two registers on);
# census ROM 017A80-017ADF (screen 1: 20E240 20E2B0 20E250 20E252 20E230 20E232 20E292 20E296 20E2A2 20E2A6
# FFFA 208182; screen 2: 20E244 20E2B1 20E254 20E256 20E234 20E236 20E29A 20E29E 20E2AA 20E2AE FFF5 218184)
struct background_registers 30 rom
field background_registers 00 pages_address u32 tilemap_pages   # the record's two page words at it and 8 on
field background_registers 04 tile_banks_address u32 tilemap_banks   # its two tile banks at it and 2 on
field background_registers 08 zoom_x_address u32 video_register_words   # 200: 1:1
field background_registers 0C zoom_y_address u32 video_register_words
field background_registers 10 zoom_centre_x_address u32 video_register_words   # 0
field background_registers 14 zoom_centre_y_address u32 video_register_words
field background_registers 18 scroll_x_address u32 video_register_words
field background_registers 1C scroll_y_address u32 video_register_words
field background_registers 20 second_scroll_x_address u32 video_register_words
field background_registers 24 second_scroll_y_address u32 video_register_words
field background_registers 28 video_mask u32               # its low half and-ed into video_registers[2]
field background_registers 2C mixer_address u32 mixer_register_copies   # the two priorities into the low four bits of it and the next
# A picture on a screen's two tilemaps, for set_up_background (R19: title_background_setups and the records
# car_presentation, name_entry, route_map, car_select_run and entry_countdown_start pass): "mov.w [R19+], [R11]"
# (0179B9), "mov.w [R19+], 8[R11]" (0179BD), "mov.b [R19+], [R11]" (0179C5), "mov.b [R19+], 2[R11]" (0179C9),
# "or.b [R19+], R0" (017A22, 017A30), "mov.w [R19+], R10" (017A3C: queue_tile_pages), "mov.w [R19], R19"
# (017A45: queue_palette_list); census ROM 01AD0C-01AD33 (05040302 00000101 01 03 01 02 01AD34 01AD64, ...)
struct background_setup 14 rom
field background_setup 00 pages u32               # the first tilemap's page word
field background_setup 04 second_pages u32
field background_setup 08 tile_bank u8
field background_setup 09 second_tile_bank u8
field background_setup 0A priority u8             # 0: off
field background_setup 0B second_priority u8
field background_setup 0C tile_pages u32 tile_page_entries        # the list of tile pages for queue_tile_pages
field background_setup 10 palette_list u32 palette_block_list        # for queue_palette_list
param set_up_background R19 background_setup background_setup
comment car_name_letter_update A letter of the presented car's name (font 346 at size A0, its colours cycling through 001D70 with step_palette, at y 14). By state: 0 sets itself up (its character from character, x + 8); 1 hidden until delay runs out; 2 slides in from the right, 24 pixels a frame for 14 frames (slide_frames); 3 stays until 120 frames after its start (frames_left); 4 slides out to the left, 24 pixels a frame, and ends once x is negative.
comment name_entry_update The name entry after a race won at the goal under the course's record time (game step 18, when course_record_beaten says so): the certificate (CONGRATULATIONS!, the course, BEST RUNNER OF THE RACE.) with the time and the name, a drum of letters to pick from. By state: 0 lights the screen's two lamps (button_lamps) and clears lcd_restart_frames, starts name_entry_lcd, the background (set_up_background with 002E4C by screen; start_palette_fades with 13F6C0), the countdown number (time_digits_start), name_entry_object_handlers (name_entry_car, name_entry_drivers, name_entry_course_name, passing_traffic) and the 32 name_entry_letter objects; open, timer 600 frames, wheel_angle A80, the name's text record at x F8, y 54 and the time's at x A8, y 54 (time_to_text of the player's time, screen 410 + 2 * player); 1 the drum spins in (wheel_angle + 20 a frame for 40 frames, spin_frames; a letter is 80 of the turn's 1000), with the seconds left (name_entry_draw_time); 2 the wheel turns the drum a letter at a time, 4 frames a letter (turn_steps; a turn under way turns back if the wheel goes the other way), name_entry_read_wheel takes the next turn when none is under way and name_entry_choose the letter in front, the entry and the time; 3 name_entry_store_record; 4 nothing. Every frame it draws the time and the name (draw_text).
comment name_entry_read_wheel State 2's reading of the wheel for the drum's next turn (name_entry_update goes on to it when no turn is under way, or when one has just ended): the wheel in sixteenths gives a turn rate (name_entry_turn_rates: none in the middle, where << and >> turn it at rate F, one way or the other, and with neither turn_delay goes to 1); turn_delay counts down by it, and when it runs out (back to F) a turn of 4 steps starts (turn_steps 4, or -4 the other way). Then name_entry_choose.
comment name_entry_choose The rest of state 2 (name_entry_update and name_entry_read_wheel go on to it): the letter in front of the pointer (letter, from wheel_angle); the gas pedal let up (under 40) then pressed (C0 or more), START or the music button enters it with a sound (name_entry_place_sounds by place): the left arrow takes the last letter back, the right arrow enters a space, ED or a third letter ends the name (name_entry_finish); the letter in front blinks at the name's next place; the timer counts down, the name ends when it runs out (name_entry_finish), and the seconds left show (name_entry_draw_time).
comment name_entry_finish The end of the name (name_entry_choose goes on to it: ED, the third letter, or the time up): open 0, the name closed at its place; an empty name, or one of name_entry_rejected_names (SEX, XXX, XX and X's with spaces), becomes ---; state 3 with 60 frames (timer), and its first frame (name_entry_store_record).
comment name_entry_store_record State 3 of name_entry_update (and the frame name_entry_finish ends the name): after 60 frames (timer) writes the record into the race record (record_serial + 1, finish_time the player's time, record_model the car's model, record_name and record_name_rest the name, record_course the course: screen built_stage - 15), turns the lamps off (button_lamps), sets the game's next step (game_step 21) and state 4; every frame it draws the time and the name (draw_text).
comment name_entry_draw_time The seconds left as the countdown number (timer frames / 30 in BCD, time_digits_draw), then the time and the name (draw_text): each frame of states 1 and 2.
comment name_entry_letter_update A letter on the name entry's drum (font 2DE; index 0-31: A-Z ! ? . and the right arrow, the left arrow and ED, name_entry_letters); ends when the entry closes (the name entry's open is 0). By state: 0 its angle index * 80 round the drum, y_offset -5; 1 for 40 frames (spin_frames) y_offset + 1, the drum dropping into place. Every frame its place from its angle less the wheel_angle (sine_table, cosine_table): x_offset, depth, a width that narrows toward the drum's edges (width_factor), mirrored (flags bit 6) with palette 27 where it faces away (the cosine under 2000, more than 60 degrees from the front), 34 in front, 30 for the letter in front (shown 4 frames of 8: hidden, flags bit 5 cleared, when bit 2 of game_frame_count is clear); drawn in perspective (100000 / (depth + 100)) about x E0, y 40.
comment name_entry_lcd_update Shows the name entry on the cabinet LCD: 0 clears it (clear_lcd), shows the DJ's face (screen dj_face = FF) and writes the time (7 characters of the entry's time_text) at F13; then every frame the name's three characters at F1C, in the LCD's codes (7F -> 7E and | -> 7F, its arrows; \ -> 65); ends when the entry closes. It means to write spaces after the end of the name, but tests the address (tb R10) instead of the character, so it never does.
comment name_entry_car_update The player's car on the certificate screen (animation certificate_car_animations by the car's model, car model; palette car_model_palettes) at x 40, y C0: state 0 sets it up and runs into name_entry_drivers_update, which with state 1 draws it; then it draws itself every frame.
comment name_entry_drivers_update The car's two drivers standing by it on the certificate screen (animation certificate_driver_animations by the car's model, car model; palette certificate_driver_palettes) at x 60, y C8: state 0 sets them up and runs into name_entry_course_name_update, which with state 1 draws them; then drawn every frame.
comment name_entry_course_name_update The course's name on the certificate (Australia Course...: animation certificate_course_animations by the course, screen built_stage - 15; palette certificate_course_palettes) at x E0, y 40: state 0 sets it up; drawn every frame.
comment passing_traffic_start Counts the steps of the passing cars' path (traffic_path: size, x, y; closed by 0) into path_steps, then runs passing_traffic_update.
comment passing_traffic_update Now and then a car passes on the road behind the certificate: by state, 0 one frame in 16 at random (random_number) starts a passing_car on the path's last step (path_steps), 1 then waits 10 frames (wait).
comment passing_car_update A car on the road behind the certificate (animation car_model_turn_animations by a random model, palette car_model_palettes; its sound, car_pass_sounds by the model, requested as it starts): state 0 picks frame C and state 1, or frame 1 and state 2 when the random number is negative; then a frame a step it goes from the path's last step (traffic_path: size 370 near the bottom edge) to its first (size 5 on the horizon), at the path's x in state 1 or at 96 - x on the other side of the road in state 2; ends past the first step.
comment ranking_update The ranking in the attract mode (game mode 5, game_mode_ranking): OutRunner of OutRunners, the record of three courses in turn. By state: 0 starts ranking_objects (01AA01, 01A6CF, which game_mode_ranking has started too), ranking_background and the two halves of the title (ranking_title_left, ranking_title_right); 1 clears course_over; once the screen's fade is over (screen flags bit 0): after three courses ends, else courses_shown + 1, 60 frames (frames_left), and starts ranking_course_banner and ranking_record for the course screen record_course; 2 when the 60 frames are over sets course_over for a frame (the background fades out) and moves screen record_course to the next of the ten courses, back to 1.
comment ranking_background_update The picture of the course behind the ranking, while the game mode is the ranking (screen game_mode 5). By state: 0 courses_shown from the ranking; for the first course I/O C0001C = 6 (C8001C = 86 for screen 2) and a fade in (screen fade_kind 1, flags bit 0); ranking_background_load; 1 waits while the pages are unpacked (screen unpack_state), then for the later courses a fade in (fade_kind 3); 2 when the ranking says course_over: after the third course a fade out (fade_kind 0) and state 4, else a fade out (fade_kind 2); 3 when the fade is over, back to 0 for the next course's picture; 4 nothing more. Every frame, in any game mode, the picture scrolls by 3 pixels (scroll_x - 3).
comment ranking_background_load Loads the picture of the course screen record_course (course_backgrounds picks it) into the screen's first tilemap: its register addresses for the screen (ranking_background_register_sets, into 80-AC), the tile bank (ranking_background_tile_banks), the palette (background_palettes, queue_palette_list), the four tilemap pages (background_tile_page_lists, with the screen's page numbers from ranking_background_page_numbers, in page_list; queue_tile_pages), start_palette_fades with background_palette_fades, zoom 1:1, zoom centre and the second tilemap's scroll 0, the pages, the scroll's start (ranking_background_scroll_xs: x 360 for screen 1, 4A0 for screen 2; y 60), its priority 1 and the second tilemap off in the mixer (ranking_mixer_addresses: screen 182 and 186; flags bit 2); send_video_registers = FF to send the registers.
comment ranking_title_left_update The left half of the ranking's title, OutRunner of OutRunners (animation 2D2, palette 2B2) at x 0, y 30: state 0 sets it up; drawn every frame.
comment ranking_title_right_update The right half of the ranking's title, OutRunner of OutRunners (animation 2D3, palette 2B3) at x 13F, y 30: state 0 sets it up; drawn every frame.
comment ranking_course_banner_update The scroll with the course's name under the ranking's title (Australia Course...: animation ranking_course_banner_animations by course, palette ranking_course_banner_palettes) at x A0, y 50, for 90 frames (frames_left).
comment ranking_record_start Sets up the course's record line from the records at 20E300 (by course: the initials, '-' shown as '.', and a 0 into text, then the time as 5'00"00, time_to_text), starts a ranking_record_character for each of its 11 characters (index, course, itself) and ends at once.
comment ranking_record_character_update A character of a course's record line (font 2DE, palette 27): 0 its character from the record's text by index, at y 80 and x -A0 plus 16 pixels for each place of index; 1 slides in, 32 pixels a frame for 7 frames (slide_steps), then starts a ranking_record_car (each of the 11 characters starts one, all at the same place); 2 index + 2 frames later (colour_delay) takes the colours of the record's car (ranking_record_character_palettes by its model); 3 58 frames after its start (frames_left) slides out to the left, 16 pixels a frame, and ends at x -20.
comment ranking_record_car_update The record holder's car under the course's record line (animation car_model_turn_animations by the model of the course's record, palette car_model_palettes; size 50, y 88): drives in from the left 16 pixels a frame to x 108 or more, turns round (frame 9 down to 4), waits 15 frames (wait_frames), drives back left 16 pixels a frame and ends at x 0. State 5 (drawn only) is not set by its own code.
comment route_map_update The map of the route after the race (game step 12, route_map_object_handlers); keeps "Thank you for your playing." scrolling on the LCD (F40 = 005014). By state: 0 copies its screen's tilemap register addresses (route_map_register_sets) into 80-BC, first_branch from screen route_branches, the background (set_up_background with 004868 by screen and first_branch: the routes on tilemap 0 over the world on the second), the palette route_map_background_palette (scene_palettes[2C]) (queue_palette); 1 zoom 1:1 about the middle of the screen, sea_colour black, 30 frames (timer); 2 the world's tilemap off, sea_colour 7EE0; 3 zooms in (zoom + 20 a frame for 9 frames, 200 being 1:1), then the close-up map (pages route_map_close_up_pages) at its start (x scroll route_map_start_scroll_xs by first_branch, y 8C), starts route_map_car and the 32 route_map_landmark objects; 4 checkpoint_legs_left from the car's forks_taken, first_legs_left from screen current_stage_level, stage 0; 5-14 the car drives the route leg by leg (leg_frames frames each): 22 frames up from the start to the first checkpoint (the car moves, the map stands), then 6 frames of 8 pixels sideways (first_branch picks the side), 11 of 5, then for each stage 10 frames of 4 up or down by the branch taken (screen route_branches + stage - 1) and 15 of 7 sideways; on these legs the map scrolls under the car (the object's x and y move the other way, for the objects on the map), screen route_map_signals telling the car its way (bits 0 down, 1 up, 2 right, 3 left, 5 the map at its edge, 7 standing); a stage_result_line starts where each stage begins (5, 7, 11), a route_map_sign (C.P) and stage + 1 where a checkpoint leg ends; when its count of legs (first_legs_left for the first leg of a stage, checkpoint_legs_left for the others) is 0 at a leg's start, the race ended on it: last_leg_progress and leg_frames are worked out from the race_copy record's segment, the car's reached_stage_start and the stage lengths at 700 of the screen, and screen route_map_signals bit 6 ends the drive after it; at the end (stage 6 or a cut leg) the car stands (bit 7), FINISH (route_map_sign 1) if the goal was reached (race_copy finished), 60 frames; 15 the routes (pages route_map_routes_pages) at zoom 2x where the close-up map was, the steps of the zoom out into x and y, screen route_map_signals bit 4 (the car, the landmarks and the signs end); 16 zooms out over 9 frames to 1:1 and the whole route (x scroll route_map_whole_scroll_xs by first_branch, y 70), then the world's tilemap again (pages route_map_world_pages); 17 sea_colour black, starts 00463C and an 004240 for each leg (stage + 1, at most 6), DJ message 38, 90 frames; 18 DJ message 39 once the DJ is quiet (screen dj_mouth_shapes); 19 when the 90 frames are over sets the game's next step (screen game_mode byte 2 = 0x10 (step 16)) and starts 0046BB; 20 nothing.
comment route_map_car_update The player's car on the route map (animation route_map_car_animations by the car's model, palette route_map_car_palettes, size 50): 0 at x 8C, y C3 with frame C; 1 until the route map's stage is not 0, drives up 4 pixels and right 1 a frame unless the map says it stands (screen route_map_signals bit 7); 2 stays where it is while the map scrolls under it, its frame by the way the map says it goes (bit 2 frame 9, bit 3 frame 4, bit 0 frame 6, bit 1 frame C), moving itself 7 pixels a frame sideways when the map is at its edge (bit 5); ends when the map zooms out (bit 4). Its depth layer follows its y (map_depth_from_y).
comment route_map_sign_update A sign on the route map, by kind: 0 C.P where the car passed a checkpoint (animation 2F9), 1 FINISH at the goal (2FA); palette 2CF, depth layer 195. State 0: x_offset and y_offset are the middle of the screen (A0, 70 less 8) less the map's place, where the car is; kind 1 goes to state 2; 1 follows the map (its x and y plus the offsets) and turns (animation_advance); 2 FINISH at the goal's place on the map (the map's x plus route_map_goal_xs by the goal, screen current_stage - 15; y 5C), drawn 4 frames of 8 (blink); both end when the map zooms out (screen route_map_signals bit 4).
comment route_map_landmark_update One of the 32 animated pictures on the close-up route map (people, animals and vehicles by the landmarks): 0 from its record (route_map_landmarks: 16 * the index in 9, the second set of 32 (+ 200) when screen route_branches is 1): animation, palette, size, x_offset and y_offset from the map's place, then field 9 from the record (set for one record: it then shows only every other frame); 1 follows the map (its x and y plus the offsets), animation_advance and draw_object, with field 9 set only when toggle comes round; ends when the map zooms out (screen route_map_signals bit 4). Its depth layer follows its y (map_depth_from_y).
comment stage_result_line_draw A line of the player's places by stage on the route map, with two players or more (ends at once with one): every frame, the stage's label (stage_result_labels by stage: PRESTG, STAGE1-4, RESULT) at x A8, y 40 + 16 * stage, and at x E8 the player's place at that stage (stage_result_places by screen 360 + player + 8 * stage: 1st-8th); the last line says Retire (stage_result_retire) instead, unless it is RESULT (the goal reached), where the player's final place (place_address) is drawn big (animation 4, draw mode 8, at x F0, y B0, size 160; palette 41 for 1st, 42 for the others).
comment map_depth_from_y Sets the object's depth layer (3C) from its y: (y + D0) >> 3, at most 19F, so that what stands lower on the route map is drawn in front. Used by route_map_car and route_map_landmark.
comment draw_text_at Draws the string at R18 as draw_text does (a sprite per character into the screen's sprite list), at the place R3 holds (x in its low half, y in its high half, as a text record's first 32 bits) with the attribute R5. Used by stage_result_line, stage_indicator_draw and song_title_show (the song title).
comment queue_tile_pages Queues the tilemap pages of the list R10 to be unpacked into video RAM: each 32-bit entry a page number in its top byte (the page at 300000 + 400 * page) and the address of its packed data below, closed by a negative entry; the requests go into the screen's ring of 64 at C00 (unpack_write_place the place) and unpack_state says there is work. Used by set_up_background, ranking_background_load and race_background_update.
comment set_up_background Sets up the screen's two tilemaps (0 and 2 for screen 1, 1 and 3 for screen 2; their register copies listed at background_register_lists by screen) from the 20-byte record background_setup (R19): their pages (two words), their tile banks (two bytes) and their priorities in the mixer (two bytes, the low four bits of mixer registers 22 and 26, 24 and 28 for screen 2; 0 is off), zoom 1:1, zoom centre and scrolls 0, the second tilemap's row scroll and row select off (video_registers[2]), the registers and the mixer to be sent (send_video_registers, screen flags bit 2); then queues the pages of the list at the record's +C (queue_tile_pages) and the palette record at +10 (queue_palette_list). Used by car_presentation, name_entry, route_map, car_select_run, entry_countdown_start and title_screen_update.
comment start_object_list Starts an object for each handler of the list R10 (a 32-bit count, then the handlers: the object_handlers_* tables), each with its place in the list at 9, and returns the last one. Used by the game modes (game_mode_car_presentation, game_mode_ranking, game_mode_play, initialise_board...), name_entry and ranking.
scoped object car_presentation 10 timer u16   # staff_credits_code_watch adds 1200 to it when the code is complete (0018D0 "add.h #4B0, 10[14[R20]]"), as to the screen's mode_timer
scoped object car_presentation 12 palette_step u8
scoped object car_presentation 14 staff_credits_code u32 object
scoped object car_name_letter 09 character u8
scoped object car_name_letter 10 delay u8
scoped object car_name_letter 11 slide_frames u8
scoped object car_name_letter 12 frames_left u16
scoped object car_name_letter 18 palette_list u32 rom
scoped object name_entry 09 open u8
scoped object name_entry 0A letter u8
scoped object name_entry 0B place u8
scoped object name_entry 0D gas_step u8
scoped object name_entry 10 timer u16
scoped object name_entry 12 spin_frames u16
scoped object name_entry 2C wheel_angle u16
scoped object name_entry 98 turn_steps s8
scoped object name_entry 99 turn_delay s8
scoped object name_entry 9A name_x u16
scoped object name_entry 9C name_y u16
scoped object name_entry 9E name_attribute u16
scoped object name_entry A0 name u8[4]   # the letters entered (read and cleared as one word: AS32; its bytes 1-2 are the record's record_name_rest)
scoped object name_entry A4 time_x u16
scoped object name_entry A6 time_y u16
scoped object name_entry A8 time_attribute u16
scoped object name_entry AA time_text u8
scoped object name_entry_letter 09 index u8
scoped object name_entry_letter 12 spin_frames u16
scoped object name_entry_letter 1C width_factor s32
scoped object name_entry_letter 20 x_offset s32
scoped object name_entry_letter 24 y_offset s32
scoped object name_entry_letter 28 depth s32
scoped object name_entry_letter 2C angle u16
scoped object passing_traffic 09 path_steps u8
scoped object passing_traffic 10 wait u16
scoped object passing_car 10 step s16
scoped object ranking 02 course_over u16
scoped object ranking 10 courses_shown u8
scoped object ranking 12 frames_left u16
scoped object ranking_background 10 courses_shown u8
scoped object ranking_background 80 tile_bank_address u32 tile_bank_values
scoped object ranking_background 84 pages_address u32 page_select
scoped object ranking_background 88 scroll_x_address u32 video_register_words
scoped object ranking_background 8C scroll_y_address u32 video_register_words
scoped object ranking_background 90 zoom_x_address u32 video_register_words
scoped object ranking_background 94 zoom_y_address u32 video_register_words
scoped object ranking_background 98 zoom_center_x_address u32 video_register_words
scoped object ranking_background 9C zoom_center_y_address u32 video_register_words
scoped object ranking_background A8 second_scroll_x_address u32 video_register_words
scoped object ranking_background AC second_scroll_y_address u32 video_register_words
scoped object ranking_background B0 page_list u32
scoped object ranking_course_banner 09 course u8
scoped object ranking_course_banner 10 frames_left u16
scoped object ranking_record 09 course u8
scoped object ranking_record 80 text u8[10]   # its line: the three initials, then the time from time_to_text
scoped object ranking_record_character 09 index u8
scoped object ranking_record_character 0A course u8
scoped object ranking_record_character 10 slide_steps u8
scoped object ranking_record_character 12 colour_delay u8
scoped object ranking_record_character 14 ranking_record u32 object.ranking_record
scoped object ranking_record_character 82 frames_left u16
scoped object ranking_record_car 09 course u8
scoped object ranking_record_car 10 wait_frames u16
scoped object route_map 09 first_branch u8
scoped object route_map 0B last_leg_progress u8
scoped object route_map 10 timer u8
scoped object route_map 11 leg_frames s8
scoped object route_map 13 checkpoint_legs_left u8
scoped object route_map 18 sea_colour_address u32 io   # a palette entry (route_map_sea_colour_addresses: 601C00, 681C00): the sea's colour, written straight into the palette
scoped object route_map 28 stage u32
scoped object route_map 80 pages_address u32 page_select
scoped object route_map 84 scroll_x_address u32 video_register_words
scoped object route_map 88 scroll_y_address u32 video_register_words
scoped object route_map 8C zoom_x_address u32 video_register_words
scoped object route_map 90 zoom_y_address u32 video_register_words
scoped object route_map 94 zoom_center_x_address u32 video_register_words
scoped object route_map 98 zoom_center_y_address u32 video_register_words
scoped object route_map 9C register_scroll_x_address u32 video_register_words
scoped object route_map A0 register_scroll_y_address u32 video_register_words
scoped object route_map A8 second_pages_address u32 page_select
scoped object route_map AC second_scroll_x_address u32 video_register_words
scoped object route_map B0 second_scroll_y_address u32 video_register_words
scoped object route_map B4 second_register_scroll_x_address u32 video_register_words
scoped object route_map B8 second_register_scroll_y_address u32 video_register_words
scoped object route_map_car 09 model u8
scoped object route_map_sign 09 kind u8
scoped object route_map_sign 10 blink u16
scoped object route_map_sign 14 route_map u32 object
scoped object route_map_sign 84 x_offset s16
scoped object route_map_sign 88 y_offset s16
scoped object route_map_landmark 10 toggle u8
scoped object route_map_landmark 14 route_map u32 object
scoped object route_map_landmark 84 x_offset s16
scoped object route_map_landmark 88 y_offset s16
scoped object stage_result_line 0A last u8
scoped object stage_result_line 20 place_address u32 player_place
scoped object stage_result_line 28 stage u32

# ======== the program ROM's data of the boot, the attract mode, the name entry, the ranking and the route map (rom names batch B1) ========
# The tables of code addresses the switches of these functions go through
0008CC  table game_mode_jumps  u32   # second_task calls through it by game_mode ("mov.w 8CC[PC](R0), R0" 0006FC and 000761, "jsr [R0]" 000704 and 000769): 001440 00144C 001000 001458 001516 001DCC 002E74 00DDA8 000D9F
000DAC  table isdn_connection_step_jumps  u32   # game_mode_isdn_connection jumps through it by mode_step ("mov.w DAC[PC](R0), R0" 000DA4, "jmp [R0]" 000DA9): 000DC8 000DDE 000E41 000E52 000E60 000E7E 000E95
000EB0  table isdn_status_state_jumps  u32   # isdn_status_update jumps through it by state ("mov.w EB0[PC](R0), R0" 000EA8, "jmp [R0]" 000EAD): 000EB8 000F6D
001014  table title_step_jumps  u32   # game_mode_title jumps through it by mode_step ("mov.w 1014[PC](R0), R0" 00100B, "jmp [R0]" 001010): 001024 001092 0010A7 0010BE
00146C  table car_presentation_step_jumps  u32   # game_mode_car_presentation jumps through it by mode_step ("mov.w 146C[PC](R0), R0" 001463, "jmp [R0]" 001468): 00147C 0014D6 0014EB 001502
001530  table demo_race_step_jumps  u32   # game_mode_demo_race calls through it by mode_step ("mov.w 1530[PC](R0), R0" 001521, "jsr [R0]" 001526): 001544 001577 001594 0015A9 0015C0
001694  table car_presentation_state_jumps  u32   # car_presentation_update jumps through it by state ("mov.w 1694[PC](R0), R0" 00168B, "jmp [R0]" 001690): 0016A0 001709 001715
0019CC  table car_name_letter_state_jumps  u32   # car_name_letter_update jumps through it by state ("mov.w 19CC[PC](R0), R0" 0019C4, "jmp [R0]" 0019C9): 0019E0 001A2D 001A38 001A47 001A5B
001DE0  table ranking_step_jumps  u32   # game_mode_ranking jumps through it by mode_step ("mov.w 1DE0[PC](R0), R0" 001DD7, "jmp [R0]" 001DDC): 001DF0 001E62 001E6F 001E7A
001ED0  table name_entry_state_jumps  u32   # name_entry_update jumps through it by state ("mov.w 1ED0[PC](R0), R0" 001EC6, "jmp [R0]" 001ECB): 001EE4 001FB0 001FC0 00218E 0021EE
002088  table name_entry_gas_step_jumps  u32   # name_entry_update jumps through it by gas_step ("mov.w 2088[PC](R0), R0" 002081, "jmp [R0]" 002086): 002090 00209D
0020C8  table name_entry_place_jumps  u32   # name_entry_update jumps through it by place ("mov.w 20C8[PC](R2), R2" 0020C1, "jmp [R2]" 0020C6): 0020D4 0020E2 0020E2
00221C  table name_entry_letter_state_jumps  u32   # name_entry_letter_update jumps through it by state ("mov.w 221C[PC](R0), R0" 002212, "jmp [R0]" 002217): 002228 00225E 00226B
002304  table name_entry_lcd_state_jumps  u32   # name_entry_lcd_update jumps through it by state ("mov.w 2304[PC](R0), R0" 0022FB, "jmp [R0]" 002300): 00230C 002327
002384  table name_entry_car_state_jumps  u32   # name_entry_car_update jumps through it by state ("mov.w 2384[PC](R0), R0" 00237D, "jmp [R0]" 002382): 00238C 00EAE4
0023D4  table name_entry_drivers_state_jumps  u32   # name_entry_drivers_update jumps through it by state ("mov.w 23D4[PC](R0), R0" 0023CA, "jmp [R0]" 0023CF): 0023DC 00EAE4
002424  table name_entry_course_name_state_jumps  u32   # name_entry_course_name_update jumps through it by state ("mov.w 2424[PC](R0), R0" 00241A, "jmp [R0]" 00241F): 00242C 00EAE4
002488  table ranking_state_jumps  u32   # ranking_update jumps through it by state ("mov.w 2488[PC](R0), R0" 00247E, "jmp [R0]" 002483): 002494 0024D3 002528
002564  table ranking_background_state_jumps  u32   # ranking_background_update jumps through it by state ("mov.w 2564[PC](R0), R0" 00255A, "jmp [R0]" 00255F): 002578 0025AE 0025C8 0025FC 002609
002620  table ranking_title_left_state_jumps  u32   # ranking_title_left_update jumps through it by state ("mov.w 2620[PC](R0), R0" 002616, "jmp [R0]" 00261B): 00262C 002659 00EAE4
00266C  table ranking_title_right_state_jumps  u32   # ranking_title_right_update jumps through it by state ("mov.w 266C[PC](R0), R0" 002663, "jmp [R0]" 002668): 002678 0026A7 00EAE4
0026B8  table ranking_course_banner_state_jumps  u32   # ranking_course_banner_update jumps through it by state ("mov.w 26B8[PC](R0), R0" 0026B1, "jmp [R0]" 0026B6): 0026C0 0026FC
00279C  table ranking_record_character_state_jumps  u32   # ranking_record_character_update jumps through it by state ("mov.w 279C[PC](R0), R0" 002792, "jmp [R0]" 002797): 0027B0 0027FD 00282F 00284C 002855
00287C  table ranking_record_car_state_jumps  u32   # ranking_record_car_update jumps through it by state ("mov.w 287C[PC](R0), R0" 002874, "jmp [R0]" 002879): 002894 0028E8 002901 00290E 00291C 00292D
002960  table passing_traffic_state_jumps  u32   # passing_traffic_update jumps through it by state ("mov.w 2960[PC](R0), R0" 002956, "jmp [R0]" 00295B): 002968 00298F
0029A4  table passing_car_state_jumps  u32   # passing_car_update jumps through it by state ("mov.w 29A4[PC](R0), R0" 00299C, "jmp [R0]" 0029A1): 0029B0 0029FE 002A31
002E80  table game_step_jumps  u32   # game_mode_play jumps through it by game_step ("mov.w 2E80[PC](R0), R0" 002E79, "jmp [R0]" 002E7E): 002EF4 002F21 002F6D 00305C 00305D 003103 0031C0 0031CD 0031EC 00320D 003088 0031AD 003225 003275 003282 00328B 003293 003317 0032B7 0032D9 0032EA 0032EB 0032F5 003155 00317D 00317D 003182 0030FC 003400
003540  table route_map_state_jumps  u32   # route_map_update jumps through it by state ("mov.w 3540[PC](R0), R0" 003538, "jmp [R0]" 00353D): 003594 003644 0036C0 0036DF 0037A7 0037BE 00383A 003877 003908 00394E 0039B4 003A14 003AA5 003B16 003B77 003C2D 003CF1 003D94 003DE9 003DFC 003E1A
003E28  table route_map_car_state_jumps  u32   # route_map_car_update jumps through it by state ("mov.w 3E28[PC](R0), R0" 003E1F, "jmp [R0]" 003E24): 003E34 003E7E 003EB1
003F34  table route_map_sign_state_jumps  u32   # route_map_sign_update jumps through it by state ("mov.w 3F34[PC](R0), R0" 003F2B, "jmp [R0]" 003F30): 003F40 003FC4 003FF5
004064  table route_map_landmark_state_jumps  u32   # route_map_landmark_update jumps through it by state ("mov.w 4064[PC](R0), R0" 00405A, "jmp [R0]" 00405F): 00406C 0040DA
00424C  table route_map_leg_state_jumps  u32   # route_map_leg_show jumps through it by state ("mov.w 424C[PC](R0), R0" 004244, "jmp [R0]" 004249): 004254 00EAE4
004280  table route_map_leg_jumps  u32   # route_map_leg_show jumps through it by leg ("mov.w 4280[PC](R0), R0" 004279, "jmp [R0]" 00427E): 004298 0042E8 004342 004342 004342 004342
00442C  table route_map_leg_car_state_jumps  u32   # route_map_leg_car_show jumps through it by state ("mov.w 442C[PC](R0), R0" 004425, "jmp [R0]" 00442A): 004434 004572
004474  table route_map_leg_car_leg_jumps  u32   # route_map_leg_car_show jumps through it by leg ("mov.w 4474[PC](R0), R0" 00446B, "jmp [R0]" 004470): 00448C 0044C1 004501 004501 004501 004501
004588  table route_map_checkpoint_state_jumps  u32   # route_map_checkpoint_show jumps through it by state ("mov.w 4588[PC](R0), R0" 004581, "jmp [R0]" 004586): 004594 00460F 00461B
004648  table route_map_direction_sign_state_jumps  u32   # route_map_direction_sign_show jumps through it by state ("mov.w 4648[PC](R0), R0" 004640, "jmp [R0]" 004645): 004654 00468A 00469B
0046C8  table route_map_wait_banner_state_jumps  u32   # route_map_wait_banner_show jumps through it by state ("mov.w 46C8[PC](R0), R0" 0046BF, "jmp [R0]" 0046C4): 0046D8 004722 004749 004762
00477C  table game_over_banner_state_jumps  u32   # game_over_banner_show jumps through it by state ("mov.w 477C[PC](R0), R0" 004775, "jmp [R0]" 00477A): 004788 0047C6 00EAE4
# The four bytes the boot writes to E80000 (which the board does not map), read one at a time by their own address
# (boot 000032 "movea.b B4[PC], R10", 000040-00004C "mov.b [R10+], [R11+]"), between the 16 bytes it copies to E00000
# (from 0000A4) and the interrupt controller's 12 (from 0000B8); census ROM 0000B4-0000B7: 01 04 01 01. One word here:
# a record table this low would also take the structures' fields at these offsets (pointers.indexed_access)
0000A4  data  boot_e00000_bytes                # the 16 bytes boot copies to E00000 (which the board does not map) a byte at a time (000026, 00002A); after a byte of padding
0000B4  table boot_e80000_bytes[4]  u8            # the 4 bytes boot writes to E80000-E80003 (which the board does not map), a byte at a time
0000B8  table boot_interrupt_control_bytes[12]  u8   # the 12 bytes boot writes to the interrupt controller from D00000, a byte at a time: its five sources' vectors (0-4), D00005 0, the mask and the pending 0, the timers' counts (07D0, 1388)
# Each seat's first car of the attract mode by its car number (second_task 00068B, 000694 "mov.b [R0](R1), 20809E": screen
# next_attract_car), a list for each number of machines on the link (000675 "mov.w D14[PC](R0), R0" by machine_count);
# census ROM 000D14-000D27: 000D28 000D28 000D2A 000D2E 000D34; the lists 000D28-000D3B: 00 04 | 00 02 04 06 | 00 01 02 04 05 06 | 00-07
elements first_attract_cars u8
000D14  table first_attract_car_lists  u32 first_attract_cars
0008C4  table seat_credits_addresses  u32            # check_game_start 00085B "mov.w 8C4[PC](R1), R2" by index: the seat's credits (20E0A0 seat1_credits, 20E0A8 seat2_credits), taken one off by START
000B14  table analog_input_counts  u8                # read_switches_and_analog 000A89 "movz.bw B14[PC](R5), R4" by the screen's turn: the A/D inputs read on it (04, 02; the loop's count, dbr R4 000AFA)
000B0C  table analog_calibration_addresses  u32      # read_switches_and_analog 000A91 "mov.w B0C[PC](R5), R6" by the screen's turn: where the inputs' low and high calibration bytes are (20E638, 20E640)
# A bar of the unused bar picture: its place (target_x in the low half, target_y in the high half: the bar_picture object's
# 80 and 82) and its two scales (84); bar_picture_start 0010CD "movea.b 11B1[PC], R19", 0010E0 "mov.d [R19+], 80[R21]" (the
# whole record), 0010E6 "test.w [R19]" + bp (a negative place ends them); census ROM 0011B1-001438: 81 bars (x 000B-0133, y 0013-00C3), then FFFFFFFF
struct bar_picture_bar 8 rom
field bar_picture_bar 00 target u32
field bar_picture_bar 04 scales u32
0011B1  table bar_picture_bars  bar_picture_bar
local bar_picture_start 0010CD R19 bar bar_picture_bar
local bar_picture_start 0010E0 R19 bar
# The texts of the ISDN connection screen (print_text_layer's records): one table of seven in the code (isdn_status_update
# 000ED7 "mov.w F78[PC](R0), R19" by R0 0-2, 000EFF "movea.w F78[PC](R0), R10" with R0 3, then "mov.w [R10+], R19" four
# times), which the C reads by the place of each: census ROM 000F78-000F93: 000F94 000FA6 000FB8 000FCA 000FDC 000FE9 000FF7
000F78  table isdn_connecting_texts  u32             # blinking by 8 frames: blank (000F94), ISDN CONECTING (000FA6)
000F80  table isdn_failed_text  u32                  # ISDN FAILED (000FB8)
000F84  table isdn_success_text  u32                 # ISDN SUCCESS (000FCA)
000F88  table isdn_this_side_text  u32               # THIS SIDE (000FDC)
000F8C  table isdn_other_side_text  u32              # OTHER SIDE (000FE9)
000F90  table isdn_total_text  u32                   # TOTAL (000FF7)
000F94  data  isdn_texts                        # the seven texts (print_text_layer's records, no FFFF after them) the tables before it point at
# The colour blocks (queue_palette's records) of the scenes, by number ("mov.w 31DDC(R19), R19"): 0-1F the stages'
# (queue_stage_load by screen route_stage), 20-27 the scenes of the attract mode's cars (game_mode_car_presentation 00149F
# by attract_car_scene_palettes), 28-2C by a constant number ("movz.bw #N, R19" before the read), which the C reads by
# the entry's own address below; census ROM 031DDC-031E8F: 154D08-159768 and 032294-03283C, 031E90
031DDC  table scene_palettes  u32 palette_block  # queue_stage_load (0115B6 "mov.w 31DDC(R19), R19", queue_palette) by screen route_stage, and the game's code by palette number: colour blocks
031E80  table ranking_palette  u32 palette_block     # scene_palettes[29]: game_mode_ranking (001E25, 001E29); 1596E0
031E84  table route_map_palette  u32 palette_block   # scene_palettes[2A]: game_mode_play's step 12 (003245, 003249); 159724
031E88  table title_palette  u32 palette_block       # scene_palettes[2B]: game_mode_title (00103C, 001040) and the demo race's set-up (game_mode_play step 10, 0030EA, 0030EE); 159768
031E8C  table route_map_background_palette  u32 palette_block  # scene_palettes[2C]: route_map_update's state 0 (00362E, 003632); 031E90
001A98  table attract_car_scene_palettes  u8         # game_mode_car_presentation 001499 "movz.bw 1A98[PC](R0), R19" by screen attract_car: its scene's number in scene_palettes; census ROM 001A98-001A9F: 27 23 26 25 22 20 24 21
001AA0  table car_presentation_backgrounds  background_setup   # by screen: car_presentation_update 0016CD "movea.w 1AA0[PC](R0), R19" (R0 = index x 20), for set_up_background
001A88  table attract_car_picture_animations  u16    # car_presentation_update 0016F6 "movz.hw 1A88[PC](R0), R9" by screen attract_car (animation_start); census ROM 001A88-001A97: 0345 0341 0344 0343 0340 033E 0342 033F
001AC8  table car_presentation_palette_cycle  u32 palette_block_list    # car_presentation_update 001719 "mov.w 1AC8[PC](R0), R19" by palette_step, 001723 its first when it reads 0 (queue_palette_list); census ROM 001AC8-001ADB: 13F724 13F730 13F73C 13F748 0
# The secret code of the car presentation (the controls' bits of staff_credits_code_read_controls, closed by 0):
# staff_credits_code_watch 0018AD "cmp.b R0, [R10+]", 0018BB "test.b [R10]" through its code_place, which starts here
# (001894, and again at 0018B2 "movea.b 1ADC[PC], R10" on a wrong one); census ROM 001ADC-001AE6: 02 02 01 01 08 04 08 04 10 20 00
elements staff_credits_code_controls u8
001ADC  table staff_credits_code_sequence  staff_credits_code_controls
# The characters of a car's name, closed by 0 (car_name_start 0019A2 "mov.b [R10+], 9[R21]", 0019B7 "test.b [R10]")
elements car_name_letters u8
001CEC  table attract_car_names  u32 car_name_letters     # car_name_start 001985 "mov.w 1CEC[PC](R0), R10" by screen attract_car; census ROM 001CEC-001D0B: 001D0C-001D64 (MAD POWER, SPEED BUSTER, EASY HANDLING, SMOOTH OPERATOR, BAD BOY, ROAD MONSTER, QUICK REACTOR, WILD CHASER)
001D0C  data  attract_car_name_texts   # the names attract_car_names points at, strings closed by 0 (car_name_letters)
# A course's record as course_records keeps it (6 bytes): the car's model, the name's three letters, the time in hundredths;
# load_course_records takes a course's default from here (001D8E "movea.b 2CC4[PC], R11", 001D9C "mov.w [R11+], [R12+]" the
# model and the name, 001DA0 "mov.h [R11+], [R12+]" the time); census ROM 002CC4-002D03: models 0-7 0 1, SGA TSU WIZ AIK SNB KND HDK NKJ MKA SMA, all 7530 (5'00"00)
struct course_record 6 rom
field course_record 00 model u8
field course_record 01 name u8[3]
field course_record 04 time u16
002CC4  table default_course_records  course_record
002D6C  table name_entry_turn_rates  u8              # name_entry_update 002018 "movz.bw 2D6C[PC](R0), R1" by the wheel / 16: how fast turn_delay counts down (0 in the middle: the buttons turn it); census ROM 002D6C-002D7B: 0F 0C 09 06 03 00 00 00 00 00 00 03 06 09 0C 0F
# The names the entry does not keep (made ---): each 3 letters and a 0 as a word, closed by a negative one; name_entry_update
# 00216C "movea.b 2D7C[PC], R10", 002171 "test.w [R10]" + bn, 002175 "cmp.w [R10+], R0"; census ROM 002D7C-002D97: SEX XXX "XX " "X X" " XX" XX, FFFFFFFF
elements rejected_names u32
002D7C  table name_entry_rejected_names  rejected_names
002D98  table name_entry_place_sounds  u8            # name_entry_update 0020FF "mov.b 2D98[PC](R1), R0" by place (request_sound as a letter is entered); census ROM 002D98-002D9A: 2B 2C 2D
002D00  table name_entry_letters  u8                 # the drum's characters by index: name_entry_letter_update 00223C "mov.b 2D00[PC](R0), 40[R20]" (the frame of font 2DE), name_entry_update 002113, 00213B by letter; census ROM 002D00-002D1F: A-Z ! ? . 7F 7C 5C (the arrows, ED)
# The sine of an angle, 0x1000 entries a turn (0x4000 = 1.0; 0x400 entries a quarter turn, the cosine from 101400 on): name_entry_letter_update
# 002278 "movs.hw 100C00(R0), R1" (sign-extended), and the code of many objects (00567D-01216C); census ROM 100C00: 0000 0019 0032 004B...
002D9C  table certificate_car_animations  u16        # name_entry_car_update 002398 "movz.hw 2D9C[PC](R0), R9" by the car's model; census ROM 002D9C-002DAB: 03AF 0423 0497 050B 057F 05F3 0667 06DB
002DAC  table car_model_palettes  u16                # the car's palette by its model: "mov.h 2DAC[PC](R0), 3A[R20]" name_entry_car_update 00239E, ranking_record_car_update 0028B4, passing_car_update 0029C2; census ROM 002DAC-002DBB: 7E 7E 97 97 7E 8D 97 8D
002DBC  table certificate_driver_animations  u16     # name_entry_drivers_update 0023E8 "movz.hw 2DBC[PC](R0), R9" by the car's model; census ROM 002DBC-002DCB: 0DD6-0DDD
002DCC  table certificate_driver_palettes  u16       # name_entry_drivers_update 0023EE "mov.h 2DCC[PC](R0), 3A[R20]" by the car's model; census ROM 002DCC-002DDB: 00B6-00BD
002E24  table certificate_course_animations  u16     # name_entry_course_name_update 002445 "movz.hw 2E24[PC](R0), R9" by the course (screen built_stage - 15); census ROM 002E24-002E37: 02DF-02E8
002E38  table certificate_course_palettes  u16       # name_entry_course_name_update 00243D "mov.h 2E38[PC](R0), 3A[R20]" by the course; census ROM 002E38-002E4B: 000E-0017
002E4C  table name_entry_backgrounds  background_setup   # by screen: name_entry_update 001F09 "movea.w 2E4C[PC](R0), R19" (R0 = index x 20), for set_up_background
002DFC  table ranking_course_banner_animations  u16  # ranking_course_banner_update 0026D4 "movz.hw 2DFC[PC](R0), R9" by course; census ROM 002DFC-002E0F: 02D4-02DD
002E10  table ranking_course_banner_palettes  u16    # ranking_course_banner_update 0026CC "mov.h 2E10[PC](R0), 3A[R20]" by course; census ROM 002E10-002E23: 0004-000D
002D2A  table ranking_record_character_xs  u16       # ranking_record_character_update 0027E8 "mov.h 2D2A[PC](R0), 30[R20]" by index (where it slides in from); census ROM 002D2A-002D3F: FF60 FF70 ... FFF0 0000
002D40  table ranking_record_character_ys  u16       # ranking_record_character_update 0027F0 "mov.h 2D40[PC](R0), 32[R20]" by index; census ROM 002D40-002D55: 0080 x 11
002DEC  table ranking_record_character_palettes  u16 # ranking_record_character_update 002841 "mov.h 2DEC[PC](R0), 3A[R20]" by the model of the course's record; census ROM 002DEC-002DFB: 2A 28 29 2C 27 2D 2E 2B
002DDC  table car_model_turn_animations  u16         # the car seen turning round (its frames the angles) by its model: "movz.hw 2DDC[PC](R0), R9" ranking_record_car_update 0028AE, passing_car_update 0029BC; census ROM 002DDC-002DEB: 0401 0475 04E9 055D 05D1 0645 06B9 072D
# A step of the path of the cars on the road behind the certificate and the entry countdown (passing_car, entry_traffic_car):
# the cars' size there, x and y; passing_traffic_start 002933 "movea.b 67B2, R10", 002944 "test.h [R10]" (0 closes it),
# 002941 "add.w #6, R10"; passing_car_update 002A0E/002A41 "movea.h 67B2(R10), R10" by its step (* 3), then "mov.h [R10+]"
# (size into 34 and 36, x, y), entry_traffic_car_drive 006706, 00676A "movea.h 67B2[PC](R10), R10"; census ROM 0067B2-0068FB: 55 steps, size 0005-0172, x -0023-004B, y 002E-00B7, then 0000
# The pictures of the ranking (and of the stages' backgrounds, race_background_update), by number
002D20  table course_backgrounds  u8                 # ranking_background_load 002B27 "movz.bw 2D20[PC](R0), R0" by screen record_course: the picture of the course; census ROM 002D20-002D29: 1A 1B 1D 1F 21 22 23 25 27 29
002C18  table ranking_background_tile_banks  u8              # ranking_background_load 002B2D "mov.b 2C18[PC](R0), [80[R20]]" by the picture; census ROM 002C18-002C43: 0-3
002CAC  table ranking_background_page_numbers  u32   # by screen: ranking_background_load 002B5D "mov.w 2CAC[PC](R0), R0" (the pages' numbers, a byte each from the top) and 002BD5 "rvbyt 2CAC[PC](R0), [84[R20]]"; census ROM 002CAC-002CB3: 01020304 0B0C0D0E
002CB4  table ranking_background_scroll_xs  u16      # by screen: ranking_background_load 002BDE "mov.h 2CB4[PC](R0), [88[R20]]"; census ROM 002CB4-002CB7: 0360 04A0
002CA4  table ranking_mixer_addresses  u32           # by screen: ranking_background_load 002BEF "mov.w 2CA4[PC](R0), R10" (the tilemap's priority, then the second one off); census ROM 002CA4-002CAB: 208182 218184
# The addresses of the copies of a screen's tilemap registers the ranking's picture sets (ranking_background_load 002ACF
# "movea.w 2C44[PC](R0), R19" by index * C, then "mov.w [R19+], 80[R20]" to AC); census ROM 002C44-002CA3: 20E2B0 20E240
# 20E292 20E296 20E250 20E252 20E230 20E232 20E292 20E296 20E2A2 20E2A6 for screen 1, 20E2B1 20E244 20E29A... for screen 2
struct ranking_background_registers 30 rom
field ranking_background_registers 00 tile_bank_address u32
field ranking_background_registers 04 pages_address u32
field ranking_background_registers 08 scroll_x_address u32
field ranking_background_registers 0C scroll_y_address u32
field ranking_background_registers 10 zoom_x_address u32
field ranking_background_registers 14 zoom_y_address u32
field ranking_background_registers 18 zoom_center_x_address u32
field ranking_background_registers 1C zoom_center_y_address u32
field ranking_background_registers 20 cleared_scroll_x_address u32
field ranking_background_registers 24 cleared_scroll_y_address u32
field ranking_background_registers 28 second_scroll_x_address u32
field ranking_background_registers 2C second_scroll_y_address u32
002C44  table ranking_background_register_sets  ranking_background_registers
003463  table game_start_c00074_bytes  u8            # game_mode_play 002F9E "mov.b 3463[PC](R1), C00074" by index (the car select's start); census ROM 003463-003464: 01 03
003465  table game_end_c00074_bytes  u8              # game_mode_play 00338A "mov.b 3465[PC](R1), C00074" by index (the game's end); census ROM 003465-003466: 00 02
003467  table game_end_c00074_next_bytes  u8         # game_mode_play 003397 "mov.b 3467[PC](R1), C00074" by index, after them; census ROM 003467-003468: 08 0A
# The demo race of each car of the attract mode: its stage and the car's model (game_mode_play step 10: 00309B "movea.b
# 34F4[PC](R0), R10" by attract_car * 2, "mov.b [R10+]" the stage, then the model); census ROM 0034F4-003503: 0E/0 03/1 10/2 0B/3 19/4 01/5 0C/6 0D/7
struct demo_race_choice 2 rom
field demo_race_choice 00 stage u8
field demo_race_choice 01 model u8
0034F4  table attract_demo_races  demo_race_choice
# The attract mode's lamps, a step every 8 frames (vblank_counter / 8) for each screen: the checkpoint lamp's byte and the
# leader lamp's (attract_lamps_update 0015EA "movea.h 1607[PC](R0), R0", 0015F8 "mov.b [R0+], C0[R24](R1)", 0015FF
# "mov.b [R0+], C8[R24](R1)"); census ROM 001607-001686: 32 steps x 2 screens, 00 or 02, 00 or 08
struct attract_lamp_step 2 rom
field attract_lamp_step 00 checkpoint u8
field attract_lamp_step 01 leader u8
001607  table attract_lamp_steps  attract_lamp_step
# The addresses of the copies of a screen's two tilemaps' registers the route map sets (route_map_update 0035A1 "movea.w
# 47E8[PC](R0), R19" by index * 10, then 0035A7 "mov.w [R19+], 80[R20]" ... to BC); census ROM 0047E8-004867: 20E240 20E292 20E296 20E250 20E252 20E230
# 20E232 20E212 20E216 20E2B0 20E248 20E2A2 20E2A6 20E222 20E226 20E2B2 for screen 1, 20E244 20E29A... for screen 2
struct route_map_registers 40 rom
field route_map_registers 00 pages_address u32
field route_map_registers 04 scroll_x_address u32
field route_map_registers 08 scroll_y_address u32
field route_map_registers 0C zoom_x_address u32
field route_map_registers 10 zoom_y_address u32
field route_map_registers 14 zoom_center_x_address u32
field route_map_registers 18 zoom_center_y_address u32
field route_map_registers 1C register_scroll_x_address u32
field route_map_registers 20 register_scroll_y_address u32
field route_map_registers 24 tile_bank_address u32
field route_map_registers 28 second_pages_address u32
field route_map_registers 2C second_scroll_x_address u32
field route_map_registers 30 second_scroll_y_address u32
field route_map_registers 34 second_register_scroll_x_address u32
field route_map_registers 38 second_register_scroll_y_address u32
field route_map_registers 3C second_tile_bank_address u32
0047E8  table route_map_register_sets  route_map_registers
0048B8  table route_map_close_up_pages  u32          # by screen: route_map_update 0036FE "mov.w 48B8[PC](R0), [80[R20]]" (the close-up map's page numbers); census ROM 0048B8-0048BF: 08070605 1211100F
004868  table route_map_backgrounds  background_setup   # by screen x 2 + its first branch (screen route_branches): route_map_update 003622 "movea.w 4868[PC](R0), R19", for set_up_background
0048C0  table route_map_routes_pages  u32            # by screen: route_map_update 003C37 "mov.w 48C0[PC](R0), [80[R20]]" (the routes' pages); census ROM 0048C0-0048C7: 0403 0E0D
0048C8  table route_map_world_pages  u32             # by screen: route_map_update 003D52 "mov.w 48C8[PC](R0), [A8[R20]]" (the world's pages); census ROM 0048C8-0048CF: 0201 0C0B
0048D0  table route_map_start_scroll_xs  u16         # by first_branch: route_map_update 003727 "mov.h 48D0[PC](R0), [84[R20]]"; census ROM 0048D0-0048D3: 00E0 01E0
0048D4  table route_map_whole_scroll_xs  u16         # by first_branch: route_map_update 003CAE "mov.h 48D4[PC](R0), 30[R20]", 003D2D "mov.h 48D4[PC](R0), [84[R20]]"; census ROM 0048D4-0048D7: 0208 00F0
0048D8  table route_map_sea_colour_addresses  u32    # by screen: route_map_update 003648 "mov.w 48D8[PC](R0), 18[R20]"; census ROM 0048D8-0048DF: 601C00 681C00
0048E0  table route_map_car_animations  u16          # by the car's model: "movz.hw 48E0[PC](R0), R9" route_map_car_update 003E3D, route_map_leg_car_show 00443D; census ROM 0048E0-0048EF: as car_model_turn_animations
0048F0  table route_map_car_palettes  u16            # by the car's model: "mov.h 48F0[PC](R0), 3A[R20]" route_map_car_update 003E49, route_map_leg_car_show 004449; census ROM 0048F0-0048FF: as car_model_palettes
00403A  table route_map_sign_animations  u16         # by kind (C.P, FINISH): "movz.hw 403A[PC](R0), R9" route_map_sign_update 003F49, route_map_checkpoint_show 00459D; census ROM 00403A-00403D: 02F9 02FA
00403E  table route_map_sign_palettes  u16           # by kind: "mov.h 403E[PC](R0), 3A[R20]" route_map_sign_update 003F55, route_map_checkpoint_show 0045A9; census ROM 00403E-004041: 02CF 02CF
004042  table route_map_goal_xs  s16                 # by the goal (screen current_stage - 15): route_map_sign_update 00400A "mov.h 4042[PC](R0), 84[R20]" (x_offset); census ROM 004042-004055: 01F4 0208 021C 0230 0244 -1F4 -208 -21C -230 -244
004954  table route_map_direction_x_shifts  u16      # by the direction (first_branch, screen route_branches): "add.h 4954[PC](R0), 30[R20]" route_map_leg_show 00440E, route_map_leg_car_show 0044A9 0044E9 00455A, "mov.h" route_map_direction_sign_show 004668; census ROM 004954-004957: 0018 0130
004958  table route_map_first_fork_leg_animations  u16   # by the direction: route_map_leg_show 0042ED "movz.hw 4958[PC](R0), R9" (leg 1); census ROM 004958-00495B: 0308 0307
00495C  table route_map_fork_leg_animations  u16     # by the direction * 2 + the branch: route_map_leg_show 004359 "movz.hw 495C[PC](R0), R9" (legs 2-5); census ROM 00495C-004963: 0304 0305 0303 0302
004900  table route_map_stage_xs  u16                # by the stage (screen route_stages): "mov.h 4900[PC](R0), 30[R20]" route_map_leg_show 00436B, route_map_leg_car_show 00453B; census ROM 004900-004929: 21 entries, 0000 0033 FFCD...
00492A  table route_map_stage_ys  u16                # by the stage: "mov.h 492A[PC](R0), 32[R20]" route_map_leg_show 004373, route_map_leg_car_show 004543; census ROM 00492A-004953: 21 entries, 0000 0000 0000 0015...
00462C  table route_map_finish_x_offsets  u16        # by the direction * 2 + the branch: route_map_checkpoint_show 0045F8 "add.h 462C[PC](R0), 30[R20]"; census ROM 00462C-004633: 0020 002A FFE0 FFD6
004634  table route_map_finish_y_offsets  u16        # by the direction * 2 + the branch: route_map_checkpoint_show 004600 "add.h 4634[PC](R0), 32[R20]"; census ROM 004634-00463B: 0014 FFEC FFEC 0014
# The car's place on a leg of the map after the race by the leg's progress: x, y and its frame (which way it faces; read as
# a halfword cut to a byte, "movt.hb [R10+], 40[R20]"); route_map_leg_car_show 004494 "movea.b 4964[PC](R0), R10" leg 0,
# 0044D4 "movea.b 49A4[PC](R0), R10" leg 1 (direction * 40 + progress * 8), 00452F "movea.b 4A24[PC](R0), R10" legs 2-5
# (direction * C0 + branch * 60 + progress * 8), then "mov.h [R10+], 30[R20]" / "add.h [R10+], 30[R20]"; census ROM
# 004964-004BA3: frames 4 6 9 C, the last halfword 0
struct route_map_leg_car_place 8 rom
field route_map_leg_car_place 00 x u16
field route_map_leg_car_place 02 y u16
field route_map_leg_car_place 04 frame u16
004964  table route_map_start_leg_car_places  route_map_leg_car_place         # 8, frame C
0049A4  table route_map_first_fork_leg_car_places  route_map_leg_car_place    # 2 directions x 8
004A24  table route_map_fork_leg_car_places  route_map_leg_car_place          # 2 directions x 2 branches x 12
local route_map_leg_car_show 004494,0044D4,00452F R10 place route_map_leg_car_place
local route_map_leg_car_show 00449A,0044DA,00454B R10 place
# A text drawn with draw_text_at: its attribute word (r5), then the characters, closed by 0 (stage_result_line_draw: 00417B
# "movea.b 4BA4[PC](R1), R18" by stage * 9, 0041E1 "movea.h 4C0A[PC], R18", then "mov.h [R18+], R5")
struct stage_result_text 9 rom
field stage_result_text 00 attribute u16
field stage_result_text 02 characters u8[7]
004BA4  table stage_result_labels  stage_result_text  # census ROM 004BA4-004BD9: 00A0 PRESTG, STAGE1-4, 00F0 RESULT
004C0A  table stage_result_retire  stage_result_text  # census ROM 004C0A-004C13: 00C0 Retire
# The player's place at a stage (stage_result_line_draw 0041CB "movea.h 4BDA[PC](R0), R18" by the place * 3, "mov.h [R18+], R5")
struct stage_result_place_text 6 rom
field stage_result_place_text 00 attribute u16
field stage_result_place_text 02 characters u8[4]
004BDA  table stage_result_places  stage_result_place_text   # census ROM 004BDA-004C09: 00C0 1st, 00B0 2nd-8th
local stage_result_line_draw 0041CB R18 place_text stage_result_place_text
local stage_result_line_draw 0041D1 R18 place_text
# A landmark's picture on the close-up route map (route_map_landmark_update 004083 "movea.b 4C14[PC](R0), R10" by index * 10
# + screen route_branches * 200, then 004089 "movz.hw [R10+], R9", "mov.h [R10+]" into 3A 34 36 84 88, 0040C9 "movt.hb [R10+],
# 9[R20]"); census ROM 004C14-005013: 2 x 32, animations 0039-033C, half_rate 0 or 1, the last halfword 0
struct route_map_landmark_record 10 rom
field route_map_landmark_record 00 animation u16
field route_map_landmark_record 02 palette u16
field route_map_landmark_record 04 width_scale u16
field route_map_landmark_record 06 height_scale u16
field route_map_landmark_record 08 x_offset s16
field route_map_landmark_record 0A y_offset s16
field route_map_landmark_record 0C half_rate u16
004C14  table route_map_landmarks  route_map_landmark_record
local route_map_landmark_update 004083 R10 landmark route_map_landmark_record
local route_map_landmark_update 004089,004092,004097,00409C,0040A1 R10 landmark


# ======== the car select, the map after the race and the entry screens (naming batch E2) ========
004240  func  route_map_leg_show
004421  func  route_map_leg_car_show
00457D  func  route_map_checkpoint_show
00463C  func  route_map_direction_sign_show
0046BB  func  route_map_wait_banner_show
004771  func  game_over_banner_show
005526  func  car_attendant_run
0056B4  func  turntable_car_show
005762  func  turntable_scenery_show
005908  func  select_car_heading_show
0059B8  func  select_instruction_show
005A1D  func  transmission_choice_run
005B45  func  automatic_panel_show
005BD6  func  manual_panel_show
005D14  func  driver_couple_start
005D5C  func  car_caption_show
005E10  func  car_gears_caption_show
005EB4  func  waiting_banner_show
005F51  func  car_select_entries_run
006070  func  choice_flag_start
0060B1  func  choice_flag_follow
006105  func  stacked_choice_flag_start
00613F  func  stacked_choice_flag_follow
006173  func  choice_flag_number_start
0061A2  func  choice_flag_number_follow
0061DB  func  turntable_draw
00660F  func  entry_traffic_run
00664E  func  entry_traffic_car_drive
0115C0  func  queue_palette
0115C5  func  queue_palette_list
0115CC  func  queue_palette_upload
0115EB  func  upload_queued_palettes
011615  func  upload_palette
011643  func  upload_palette_list
comment turntable_draw Places the object at a point of the car select's turntable scene and draws it: R1 across, R2 down and R3 in depth (the turntable's centre at 140), seen from a view that screen turntable_depth_offset takes back (car_select starts it at -300 and raises it to 0, so the scene shrinks into its place): with d = R3 + 100 + turntable_depth_offset, x = R1 * (100000 / d) >> 12 + A0, y = R2 * (100000 / d) >> 12 + 60, the depth layer (3C) 100 - d >> 4, the width and height scale (100000 / d) * the object's size (1C) >> 12. Not drawn (flags bit 5 cleared) with d under 10 or x outside -28..168. Used by car_attendant, turntable_car and turntable_scenery.
comment queue_palette Queues a block of colours (record R19: its place in the palette, its length in bytes, the colours) for the screen's palette RAM, copied in the vertical blank (upload_queued_palettes).
comment queue_palette_list Queues a list of colour blocks (record R19: its length in bytes, then 8-byte entries: the colours' address, their place in the palette, how many blocks of 16) for the screen's palette RAM, copied in the vertical blank (upload_queued_palettes).
comment queue_palette_upload Adds R19 (bit 31 from R8: a list, not a block) to the screen's queue of palette uploads (the count at palette_upload_count, the entries after it, up to 128).
comment upload_queued_palettes Copies the queued palette uploads (queue_palette, queue_palette_list) into the screen's palette RAM in the vertical blank and empties the queue.
comment upload_palette Copies a block of colours (place, length in bytes, colours) into the screen's palette RAM (600000 for screen 1, 680000 for screen 2).
comment upload_palette_list Copies a list of colour blocks (the list's length in bytes, then the address, place and number of 32-byte blocks of each) into the screen's palette RAM.
comment route_map_leg_show A leg of the route the player drove, drawn in red over the map shown after the race (003520), by state: 0 sets it up by its number (leg): 0 from the start to the first fork, 1 on from there by the direction taken (screen route_branches: 0 east, 1 west, the map's 09), 2-5 by the branch taken at each fork (screen route_branches + leg - 1) from the place of its stage (route_map_stage_xs, route_map_stage_ys by screen route_stages + leg - 2), the map shifted by the direction (route_map_direction_x_shifts) and 6B down; a leg driven already shows whole (frame 7, or B for 2-5), the leg the car is on (the map's stage) up to the frame before its progress, with the car on it (route_map_leg_car); legs 1-5 start the CP sign at their start (route_map_checkpoint), and leg 5, when the race reached the goal (race_copy finished), also the FINISH sign and the car at its end; 1 draws it.
comment route_map_leg_car_show The player's car on the map after the race, where the red line of its leg ends, by state: 0 sets it up: the sprite of its model (route_map_car_animations, route_map_car_palettes by car model) at a quarter size, its place and frame (which way it faces) from a record by the leg's progress (route_map_start_leg_car_places for leg 0, route_map_first_fork_leg_car_places for leg 1 by the direction, route_map_fork_leg_car_places for legs 2-5 by the direction and the branch, from the stage's place), shifted like the legs; 1 draws it.
comment route_map_checkpoint_show A sign on the map after the race, by state: 0 sets it up by its kind (route_map_sign_animations, route_map_sign_palettes): 0 the CP sign at the start of its leg (the fork it leaves from), 1 the FINISH sign beside the goal end of the last leg (route_map_finish_x_offsets, route_map_finish_y_offsets by the direction and the branch); 1 the CP sign turns (animation_advance) and is drawn; 2 FINISH blinks, drawn 4 frames out of 8 (blink).
comment route_map_direction_sign_show The WEST BOUND / EAST BOUND sign at the foot of the map after the race: a globe between the two, placed by the direction (screen route_branches) so that only the half of the way taken shows, by state: 0 sets it up below the screen; 1 rises 2 a frame to DC; 1 and 2 cycle its colours through four palettes from palette_base, one every 4 frames (colour_timer), and draw it.
comment route_map_wait_banner_show JUST A MOMENT PLEASE over the map after the race, while the game waits to go on, by state: 0 waits 32 frames (timer), then sets it up at the centre of the screen, tiny; 1 grows to full size in 15 frames; 2 drawn 15 frames; 3 hidden 5 frames, back to 2.
comment game_over_banner_show GAME OVER at the centre of the screen when a one-player race ends short of the goal, by state: 0 sets it up, tiny; 0 and 1 grow it to full size in 15 frames (timer); 2 draws it.
comment car_attendant_run The man who stands by the car in front on the car select's turntable, by state (car_attendant_state_jumps): 0 sets him up half a car round from the front (angle, radius, size); 1 stands beside the car in front (car model) until it changes, then 2 walks round the turntable, 20 a frame, to the front, facing his way (flags bit 6), and stands again; once the car is chosen (car_select car_chosen), 3 walks to one side of the car or the other by the transmission the wheel picks (side_offset to car transmission * 80) and stands there; once it is chosen (transmission_chosen), 4 strikes the pose for it (animation 267 automatic, 268 manual). Each frame he is drawn at his angle (plus side_offset) less the turntable's (car_select angle) with turntable_draw, and animated.
comment turntable_car_show One of the eight cars on the car select's turntable (car: its model and its place, car << 9), by state: 0 its sprite set and palette (turntable_car_looks by car); 1 placed by its angle less the turntable's (car_select angle), with the frame that shows it from there (turntable_car_frames), round the centre (radius screen turntable_radius_offset + 140) with turntable_draw; once the car is chosen (car_select car_chosen) the car in front takes the palette 4 on if it is the chosen one (car model) and goes to 2, where draw_object draws it where it was.
comment turntable_scenery_show A ring of scenery round the car select's turntable (one of twelve groups, from 006A18: the crowd, the palm trees), by state: 0 its animation, palette, size_step, size and list of items (item_list: angle, radius and height of each, closed by a negative angle); 1 each frame takes the turntable's angle (car_select angle) and draws the items on the far side (their angle less it 480..B7F) with turntable_draw, keeping for each its previous_place and flags bit 5 in item_places for draw mode 0A's halfway copy; then animation_advance.
comment select_car_heading_show "To Select A Car," at the top of the car select, by state: 0 starts the four pieces of the instructions under it (select_instruction, records at 006DF6) and sets it up; 1 drawn 20 frames (timer); 2 hidden 10 frames; it ends as soon as the car is chosen (car_select car_chosen).
comment select_instruction_show A piece of the car select's instructions ("Turn your", the steering wheel, "Then foot the", the accelerator; piece_animation, palette and place from select_car_heading), by state: 0 starts its animation; 1 drawn and animated until the car is chosen (car_select car_chosen); 2 rises 2 a frame for 16 frames (timer), over the transmission choice; 3 drawn and animated until the transmission is chosen (transmission_chosen), when it ends.
comment transmission_choice_run The transmission choice of the car select: the AUTOMATIC and MANUAL panels (on the second tile layer, with the sprites automatic_panel and manual_panel following x and y), by state: 0 starts the two panels; 1 slides them down into view, 10 a frame for 14 frames (y, car_select second_scroll_y_address); 2 when the wheel picks the other transmission (car transmission against shown_transmission) queues the panels' colours for it (queue_palette_list 13F998 automatic, 13F95C manual); when it is chosen (car_select transmission_chosen) starts the driver couple (driver_couple) and 3 slides the panels aside, 10 a frame for 10 frames (slide_step, slide_frames; x, second_scroll_x_address), the chosen one to the half the couple leaves free; 4 stays. From 2 on, every frame, the colours of the transmission picked or chosen cycle: the next palette list of automatic_panel_palette_lists (automatic, automatic_cycle) or manual_panel_palette_lists (manual, manual_cycle) every two frames.
comment automatic_panel_show The AUTOMATIC TRANSMISSION title of the left panel of the transmission choice, by state (automatic_panel_state_jumps): 0 starts its label (transmission_label_start_automatic) and sets it up; 1 cycles its colours (step_palette from palette_list) while the wheel picks automatic (car transmission 0), else palette 2AE; drawn at x_offset, y_offset less the choice's x, y (transmission_choice), which slide it. Nothing sets state 2 (drawing only).
comment manual_panel_show The MANUAL TRANSMISSION title of the right panel of the transmission choice, by state (manual_panel_state_jumps): 0 starts its label (transmission_label_start_manual) and sets it up; 1 cycles its colours (step_palette from palette_list) while the wheel picks manual (car transmission 1), else palette 2AE; drawn at x_offset, y_offset less the choice's x, y (transmission_choice), which slide it. Nothing sets state 2 (drawing only).
comment driver_couple_start Sets up the couple who drive the chosen car (a man and a woman, by the car's model: 006E58) on the left (x 50) after automatic (left_side) or on the right (F0) after manual, the half the panels slid away from; draw_object then draws it as its handler.
comment car_caption_show The caption of the car in front on the car select (EASY HANDLING, SMOOTH OPERATOR...: animation 26E, frame car model, palette car_caption_palettes), by state: 0 starts the gearboxes under it (car_gears_caption) and sets it up; 1 drawn 10 frames (timer); 2 hidden 10 frames; a new car in front (shown_car) shows it at once, for 10 frames more; it ends when the car is chosen (car_select car_chosen).
comment car_gears_caption_show The gearboxes of the car in front under its caption (Auto/5 Speed...: animation 2D1, frame car_gears_caption_frames by car model, the manual box's), blinking like car_caption: 1 drawn 10 frames (timer), 2 hidden 10, at once for a new car (shown_car); it ends when the car is chosen (car_select car_chosen).
comment waiting_banner_show The car select's message once the choices are made, by state: 0 sets up WAITING FOR CHALLENGERS! JUST A MOMENT PLEASE (animation 28B); 1 drawn 20 frames (timer); 2 hidden 10; once the entry time is over (car_select entry_over) JUST A MOMENT PLEASE (animation 28D) instead: 3 drawn 20 frames, 4 hidden 10.
comment car_select_entries_run The other players on the car select, by state: 0 its list of the race's players (race_order: the count, then the players); 1 when the LCD is not scrolling a text (screen lcd_scroll) writes Entry: on it with _ at each player's car number (car_numbers); then every frame: this screen's number blinks with _ every 8 frames (own_number, digit_toggle, blink_timer); each other player not yet marked (a bit each from 40, the frame field) gets its number on the LCD and, once it has chosen a car (byte 48 of its race_copy record, which car_select writes), a flag over that car on the turntable (choice_flag, kept in car_flags by car; one more player on the same car gets a stacked_choice_flag on the last one) and its bit; flags_visible follows the blink pattern car_select_entries_flag_blink (frames >> 1).
comment choice_flag_start Sets up a flag over the car another player has chosen (animation 1B, a palette by the car, choice_flag_palettes; angle: the car's place on the turntable), starts its number (choice_flag_number) and goes on to choice_flag_follow.
comment choice_flag_follow Keeps the flag over its car as the turntable turns (its angle less car_select angle, projected as turntable_draw does, above the cars) and draws it while car_select_entries' flags_visible says so (visible); not drawn behind the view.
comment stacked_choice_flag_start Sets up the flag of one more player on a car that has one (on the last flag there, below), starts its number (choice_flag_number) and goes on to stacked_choice_flag_follow.
comment stacked_choice_flag_follow Draws the flag 14 higher (and 3 right) than the one below it while that one is drawn (its flags bit 5 and visible); else it is not drawn.
comment choice_flag_number_start Sets up the car number of a flag's player (choice_flag_number_animations by its car number, car_numbers), then choice_flag_number_follow.
comment choice_flag_number_follow Draws the number on its flag (13 right, 10 up from its place) while the flag is drawn (its flags bit 5 and visible); else it is not drawn.
comment entry_traffic_run Sends cars up the road behind the entry countdown (entry_traffic_car), by state: 0 one chance in 16 each frame to start one; 1 then waits 10 frames (delay).
comment entry_traffic_car_drive A car coming up the road toward the view behind the entry countdown (car: a random one of the eight, turntable_car_looks), by state: 0 sets it up and picks its way: 1 along the path at 0067B2 (scale, x and y a frame, path_step) seen from the front and one side (frame 6), 2 the same path mirrored (x = 96 - x) from the other side (frame 7); one car in 128 goes to 3 or 4 instead, the same paths, but after 45 frames (spin_delay) its frames, its views all round, run five a frame (it spins) with set_tyre_noise(4) each frame; at the end of the path it requests its car's sound (car_pass_sounds) and ends.
scoped object route_map_leg 09 leg u8
scoped object route_map_leg 0A progress u8
scoped object route_map_checkpoint 0A kind u8
scoped object route_map_checkpoint 10 blink u16
scoped object route_map_direction_sign 10 colour_timer u16
scoped object route_map_direction_sign C0 palette_base u16
scoped object route_map_wait_banner 10 timer u8
scoped object game_over_banner 10 timer u8
scoped object car_attendant 1C size u16
scoped object car_attendant 20 side_offset s16
scoped object car_attendant 2C angle u16
scoped object car_attendant 2E radius u16
scoped object turntable_car 09 car u8
scoped object turntable_car 1C size u16
scoped object turntable_scenery 09 group u8
scoped object turntable_scenery 18 item_list u32 rom
scoped object turntable_scenery 1C size u16
scoped object turntable_scenery 2C angle u16
scoped object turntable_scenery 50 previous_place u32
scoped object turntable_scenery 80 item_places u16
scoped object select_car_heading 10 timer u16
scoped object select_instruction 10 timer u16
scoped object select_instruction 18 piece_animation u16
scoped object transmission_choice 09 shown_transmission u8
scoped object transmission_choice 10 manual_cycle u8
scoped object transmission_choice 12 automatic_cycle u8
scoped object transmission_choice 13 slide_frames u8
scoped object transmission_choice 2C slide_step s16
scoped object automatic_panel 14 choice u32 object
scoped object automatic_panel 18 palette_list u32 rom
scoped object automatic_panel 20 x_offset s16
scoped object automatic_panel 24 y_offset s16
scoped object manual_panel 14 choice u32 object
scoped object manual_panel 18 palette_list u32 rom
scoped object manual_panel 20 x_offset s16
scoped object manual_panel 24 y_offset s16
scoped object driver_couple 09 left_side u8
scoped object car_caption 09 shown_car u8
scoped object car_caption 10 timer u16
scoped object car_gears_caption 09 shown_car u8
scoped object car_gears_caption 10 timer u16
scoped object waiting_banner 10 timer u8
scoped object car_select_entries 09 own_number u8
scoped object car_select_entries 0A digit_toggle u8
scoped object car_select_entries 0B blink_timer u8
scoped object car_select_entries 10 frames u8
scoped object car_select_entries 12 flags_visible u8
scoped object car_select_entries 18 race_order u32 racer_numbers
scoped object car_select_entries 80 car_flags u32[8] object   # each player's flag object, by the player
scoped object choice_flag 09 player u8
scoped object choice_flag 0A car u8
scoped object choice_flag 12 visible u8
scoped object choice_flag 18 top_flag u32 object
scoped object choice_flag 24 angle u16
scoped object stacked_choice_flag 09 player u8
scoped object stacked_choice_flag 0A car u8
scoped object stacked_choice_flag 12 visible u8
scoped object choice_flag_number 12 visible u8
scoped object entry_traffic 10 delay u16
scoped object entry_traffic_car 09 car u8
scoped object entry_traffic_car 10 path_step u16
scoped object entry_traffic_car 12 spin_delay u16

# ======== the title screen, the coin prompts, the road surface and the backgrounds (naming batch F) ========
013AB7  func  traffic_follower_update
013AD8  func  pulled_vehicle_update
013D15  func  traffic_hit_sound_wait
0141F4  func  rider_gesture_update
014200  table rider_gesture_state_jumps  u32   # rider_gesture_update (0141FD "jmp [R0]") jumps through it by state: 014211 014239 014261
01444E  table rider_gesture_animations  u16   # the riders' gestures, by rider (model, model + 8): rider_gesture_update "movz.hw 1444E[PC](R0), R9" (01421D), "tb R9" (014225: 0, no gesture: the object ends), then animation_start; census ROM 01444E-01446D (0E3A-0E43 for 9 of the 16 riders, 0 for the others)
0142B4  func  rider_gesture_check_view
0143A0  table rider_gesture_car_states  u8   # rider_gesture_check_view "movz.bw 143A0[PC](R0), R9" (0142B9) by the state of the screen's car object (C[0[R23]]): FF where a gesture may show; census ROM 0143A0-0143A5 (00 00 FF 00 FF 00: states 2 and 4)
0143A6  table rider_gesture_views  u8   # rider_gesture_check_view "and.b 143A6[PC](R0), R9" (0142C6) by the car's view (race_car view, E3[R10]): FF for the views that show the rider's gesture; census ROM 0143A6-01440D (two sets of 34 views, as drawn and mirrored: FF for the first five of each eight, 00 for the others and the last four)
0142D2  func  rider_gesture_check_place
0142F7  func  rider_gesture_place
014360  table rider_gesture_x_offsets  u16   # rider_gesture_place "mov.h 14360[PC](R3), R6" (01430B) by rider, plus the seat's x ("add.h [R11+], R6" 01433C), scaled by the car's ("mulu.h R0, R6"); census ROM 014360-01437F (0, FFFC, 4, 2, FFF9: -7 to 4)
014380  table rider_gesture_y_offsets  u16   # the same for y: "mov.h 14380[PC](R3), R7" (014313), "add.h [R11+], R7" (01433F); census ROM 014380-01439F (0-10)
014470  func  race_opening_update
01447C  table race_opening_state_jumps  u32   # race_opening_update (014479 "jmp [R0]") jumps through it by state: 014488 014488 0144A4
0144A9  table race_opening_sound_step_jumps  u32   # race_opening_update calls through it (014494 "jsr [R0]") by sound_step: 0144B5 race_opening_sounds_start, 0144C9 race_opening_sounds_play, 0144EB race_opening_sounds_done
0144EC  table race_opening_camera_step_jumps  u32   # race_opening_update (0144A2 "jmp [R0]") jumps through it by camera_step: 0144F8 0144FC 014513
# A timed sound of the lists of race_opening (014660) and stage_end_sounds (01466F): when it plays (the
# opening: the count of its steps it waits for; stage_end_sounds: the frames after the one before), then the
# sound; a time of 0 closes the list. The object keeps the place of the next sound (sound_list, 18)
struct sound_cue 2 rom
field sound_cue 00 time u8      # race_opening "mov.b [R10+], 12[R20]" (0144BF: next_count), stage_end_sounds "mov.b [R10+], 10[R20]" (01453D: countdown); "test.b [R10]" (0144E1, 014562: 0 ends)
field sound_cue 01 sound u8     # "movz.bw [R10+], R0" then request_sound (0144D8, 014559)
014660  table race_opening_sound_cues  sound_cue   # race_opening_sounds_start "movea.b 14660[PC], R10" (0144B8); census ROM 014660-01466E (01 2D, 14 24, 41 0A, 78 21, 96 2E, A0 2D, BE 24, 00)
0144B5  func  race_opening_sounds_start
0144C9  func  race_opening_sounds_play
0144EB  func  race_opening_sounds_done
016B00  func  road_surface_update
016B0C  table road_surface_state_jumps  u32   # road_surface_update (016B09 "jmp [R0]") jumps through it by state: 016B1C 016B2A 016B38 016B53
016BBC  table road_surface_event_jumps  u32   # road_surface_update (016BB8 "jmp [R0]") jumps through it by the segment's event: 016BF8 016BF9 016C15 016C07 016BDF 016BEC
016C23  func  road_surface_start
# The road tilemap's set-up for a screen (road_surface_layer_setups, by screen index): road_surface_start reads
# it with [R10+] from 016C2A "movea.w 1710C[PC](R0), R10" (R0 = index << 3, a word each: 32 bytes)
struct road_surface_layer_setup 20 rom
field road_surface_layer_setup 00 video_mask u16          # "and.h [R10+], R0" (016C35) with video_registers[2]
field road_surface_layer_setup 02 video_bits u16          # "or.h [R10+], R0" (016C38)
field road_surface_layer_setup 04 scroll_x_address u32 video_register_words    # "mov.w [R10+], R0; mov.h #160, [R0]" (016C40)
field road_surface_layer_setup 08 scroll_y_address u32 video_register_words    # "mov.w [R10+], R0; mov.h #0, [R0]" (016C49)
field road_surface_layer_setup 0C tile_bank_address u32 tile_bank_values   # "mov.w [R10+], R11; mov.b #0, [R11]" (016C55)
field road_surface_layer_setup 10 page_register u32 page_select       # "mov.w [R10+], 54[R20]" (016C5C)
field road_surface_layer_setup 14 mixer_address u32 mixer_register_copies       # "mov.w [R10+], R11" (016C61), then its low bits 8
field road_surface_layer_setup 18 line_scroll_table u32   # "mov.w [R10+], 58[R20]" (016C78)
field road_surface_layer_setup 1C line_select_table u32   # "mov.w [R10], R10" (016C7D) -> 5C[R20]
01710C  table road_surface_layer_setups  road_surface_layer_setup   # census ROM 01710C-01714B (screen 1: 03FA E005 20E2A2 20E2A6 20E2B2 20E248 208186 31C1C0 31C5C0; screen 2: 03F5 E00A 20E2AA 20E2AE 20E2B3 20E24C 218188 31C3C0 31C7C0)
03CC80  table stage_road_page_sets  u8   # road_surface_start "mov.b 3CC80(R0), D[R20]" (016CB4) by screen first_stage: page_set; census ROM 03CC80-03CC9F (05 for all 32)
01714C  table road_surface_page_words  u8   # the road's pages, a byte each as road_tiles_change_update writes them and four of them a page word, which road_surface_update takes whole: five words (by the near scroll, 512 lines a step) for each of page sets 3-5: road_surface_start copies them into its page_table (18) with "movcu.h 1714C[PC], R0, 18[R20], R0" (016CDE, 1E halfwords); census ROM 01714C-017187 (36332C29 36332C29 34332A29 34352A2B 34352A2B, ...)
031C38  table stage_road_palettes  u32 stage_road_palette_record  # road_surface_start "mov.w 31C38(R0), R19" (016CEC) by screen first_stage: a record of the road's palettes, the address of its fade list first ("mov.w [R19+], 208[R25]" 016CF4: screen road_palette_fades), then its palette list (queue_palette_list); census ROM 031C38-031CB7 (32 stages, 146054-1472BC)
016D00  func  road_surface_lines
016E8C  func  road_surface_halfway_lines
016FEB  func  road_surface_fill_lines
0170A6  func  road_surface_fill_skipped_lines
017188  func  road_surface_start_tiles_change
0171CE  func  road_tiles_change_update
0171E0  table road_tiles_change_state_jumps  u32   # road_tiles_change_update (0171DB "jmp [R0]") jumps through it by state: 0171F8 017249 0172C9 017319 017370 0173F0
# The bytes of a road_tiles_change's data list (road_tiles_change data, 38: 017444 for the first flag, 0174B4 for
# the second; 0x70 bytes): the four pages by page set (from data - C, four bytes a set from set 3), the
# pages by screen (+ 18), the page table's bytes by screen (+ 20, 10 each) and the two tables' halves to
# put back (+ 34, + 52, 30 each); road_tiles_change_update walks them a byte at a time: "movz.bw [R12+], R0"
# (017205...), "movz.bw [R13+], R0", "mov.b [R12+], [R11]" (01729C...), "mov.b [R10+], [R11]" (0172F4...)
elements road_tiles_change_bytes u8
017444  table road_tiles_change_first_data  u8   # the data list of the first flag's road_tiles_change (events 1 and 3): road_surface_start_tiles_change "movea.b 17444[PC], 38[R21]" (01719D); census ROM 017444-0174B3
0174B4  table road_tiles_change_second_data  u8   # the second flag's (events 2 and 3): road_surface_update "movea.b 174B4[PC], 38[R21]" (0171C0); census ROM 0174B4-017523
local road_tiles_change_update 017229 t1 target_page
local road_tiles_change_update 017350 t1 target_page_back
017524  func  race_background_update
017530  table race_background_state_jumps  u32   # race_background_update (01752D "jmp [R0]") jumps through it by state: 01753C 017672 01771A
017738  table race_background_change_step_jumps  u32   # race_background_update (017733 "jmp [R1]") jumps through it by change_step: 017750 017776 0177B6 0177D4 0177EF 0177F8
# The background tilemap's register copies for a screen (race_background_layer_setups, by screen index):
# race_background_update reads it with [R10+] from 017548 "movea.w 17A50[PC](R0), R10" (R0 = index x 5, a
# word each: 20 bytes)
struct race_background_layer_setup 14 rom
field race_background_layer_setup 00 scroll_x_address u32 video_register_words   # "mov.w [R10+], 18[R20]" (01754E)
field race_background_layer_setup 04 scroll_y_address u32 video_register_words   # "mov.w [R10+], 1C[R20]" (017553)
field race_background_layer_setup 08 tile_bank_address u32 tilemap_banks   # "mov.w [R10+], 24[R20]" (017558)
field race_background_layer_setup 0C page_word_address u32 tilemap_pages   # "mov.w [R10+], R11" (01755D) -> 20[R20], the first page word into it
field race_background_layer_setup 10 mixer_address u32 mixer_register_copies   # "mov.w [R10], R10" (017572), then its low bits 4
017A50  table race_background_layer_setups  race_background_layer_setup   # census ROM 017A50-017A77 (screen 1: 20E292 20E296 20E2B0 20E240 208182; screen 2: 20E29A 20E29E 20E2B1 20E244 218184)
017AE0  table background_page_words  u32   # the background's page words, four a set (16 bytes) by page half x 2 + branch: race_background_update "mov.w 17AE0[PC](R0), [R11]" (01756B: R0 = page_half << 3, the set's first) and "movea.w 17AE0[PC](R0), 28[R20]" (017707: the set into next_page_words); census ROM 017AE0-017B5F (8 sets: 04030201 04070209 08070609 08070605, ...)
# The page words a background change puts into the tilemap one at a time (race_background next_page_words, 28,
# four from a set of background_page_words): "mov.w [R10+], [20[R20]]" (01783F), "mov.w R10, 28[R20]"
elements background_page_word_steps u32
109684  table no_background_tile_pages  u32   # the tile pages race_background_update unpacks for a stage without a background of its own (stage 0: stage_backgrounds FF), "movea.b 109684, R11" (0175A0), four words before background_tile_page_lists; census ROM 109684-109693 (110F67 1111BB 11135F 1114BD)
13F9D4  table no_background_palettes  palette_block_list   # the palette list race_background_update queues then (queue_palette_list), "movea.b 13F9D4, R19" (01761D)
017B60  table stage_backgrounds  u8  # race_background_update "not.b 17B60[PC](R0), R0" (017592) by screen first_stage (not read for stage 0: none): background; census ROM 017B60-017B7E (FF, then 00-29)
017B7F  table background_tile_banks  u8   # race_background_update "mov.b 17B7F[PC](R0), [24[R20]]" (01776B) by background, at a change; census ROM 017B7F-017BA8 (42 backgrounds, 0-3)
017BA9  table stage_tile_banks  u8   # race_background_update "mov.b 17BA9[PC](R0), [24[R20]]" (0175EC) by screen first_stage, at the start; census ROM 017BA9-017BC7 (31 stages, 0-3)
109694  table background_tile_page_lists  u32 tile_page_entries   # by background: the address of its list of tile pages (nine words, 36 bytes apart), "mov.w 109694(R0), R11" (race_background_update 0175AC, + 10: the last four at the start; 0176AC: all nine at a change), then "or.w [R11+], R1" into page_list (0175D1, 0176D1); ranking_background_load too (002B36); census ROM 109694-10973B (42 lists, 1097B8-109D7C)
109E0C  table background_packed_tile_pages  u8   # the tile pages' packed data, to 12297B, which unpack and unpack_queued_step read a byte at a time (and halfwords of it) from the addresses the lists of background_tile_page_lists give
0318CC  table background_palettes  u32 palette_block_list   # by background: its palette list for queue_palette_list, "mov.w 318CC(R0), R19" (race_background_update 01763E, 01775D; ranking_background_load 002B48); census ROM 0318CC-031973 (42, 13FA50-14063C)
0319F0  table background_leaving_fades  u32 palette_fade_list   # by background: the fades started as the old background leaves the screen (change_step 1, at 2A0): race_background_update "mov.w 319F0(R0), R19" (017788) for start_palette_fades; census ROM 0319F0-031A97 (42, 1406FC-140B68)
031B14  table background_palette_fades  u32 palette_fade_list   # by background: its palette fades (race_background_fade_palettes), "mov.w 31B14(R0), R19" (race_background_update 01762C, 0177DF; ranking_background_load 002B3E, with start_palette_fades); census ROM 031B14-031BBB (42, 140C50-14145C)
031CB8  table background_road_palettes  u32 road_palette_record   # by background: as stage_road_palettes, at a change: race_background_update "mov.w 31CB8(R0), R19" (01779A; "test.w R19", 0 none), the fade list's address first ("mov.w [R19+], 208[R25]" 0177A7: screen road_palette_fades), then the fades to start (start_palette_fades); census ROM 031CB8-031D5F (42, 1472BC-14ADAC: no 0)
01789C  func  race_background_start_lower_animation
017904  table background_lower_animation_tile_pages  u32 tile_page_entries   # race_background_start_lower_animation "mov.w 17904[PC](R0), R10" (0178A0) by screen index: the tile pages of the lower animation, for queue_tile_pages; census ROM 017904-01790B (1095FC 109610)
0178C9  func  race_background_lower_animation_wait
0178D5  func  race_background_lower_animation_cycle
01790C  table background_lower_animation_page_pairs  u16   # race_background_lower_animation_cycle "mov.h 1790C[PC](R0), 2[20[R20]]" (0178F3) by step (0-7, two on each time): the lower half of the page word; census ROM 01790C-01791B (3131 5959 3B3B 5A5A 4545 5B5B 4F4F 5C5C)
01791C  func  race_background_start_upper_animation
017988  table background_upper_animation_tile_pages  u32 tile_page_entries   # race_background_start_upper_animation "mov.w 17988[PC](R0), R10" (017923) by animation x 2 + screen index: the tile pages for queue_tile_pages; census ROM 017988-01799F (109624 109654 109634 109664 109644 109674)
01794C  func  race_background_upper_animation_wait
017958  func  race_background_upper_animation_cycle
0179A0  table background_upper_animation_page_pairs  u16   # race_background_upper_animation_cycle "mov.h 179A0[PC](R0), [20[R20]]" (01797B) by step (0, 2, 4 and the screen's 1, 3, 5): the upper half of the page word; census ROM 0179A0-0179AB (3131 5959 3B3B 5A5A 4545 5B5B)
017BC8  func  race_background_start_objects
0184D0  func  start_palette_fades
0184EC  func  road_surface_fade_back
01850B  func  race_background_fade_palettes
# The colours of a palette a palette_fade walks (palette_fade from, 18, and to, 1C: the palettes of a
# palette_fade_entry): palette_fade_prepare "mov.h [R10+]" (0185E9) and "mov.h [R11+]" (0185EC), a colour a
# frame
elements palette_colours u16
01854A  func  race_background_fade_watch_update
018581  func  start_palette_fade
0185D2  func  palette_fade_prepare
01864A  func  palette_fade_step
019322  func  song_title_show
019330  table song_title_state_jumps  u32   # song_title_show (01932B "jmp [R0]") jumps through it by state: 019344 019369 01938A 019394 0193BA
019561  table song_title_colours  u16   # song_title_show "mov.h 19561[PC](R5), R5" (0193EC) by colour_step >> 1 (0-7), for draw_text_at; census ROM 019561-019570 (0080 00C0 00A0 00B0 00D0 0090 00E0 00F0)
# A song's title as the radio and the car select show it (radio_songs, start_song_title's record): the x of
# the title on the screen, its text after it (song_title text after the first frame, and the LCD's
# scroll): song_title_show "mov.h [R10+], 30[R20]" (019348); census ROM 019478-019560 (0048 "` Magical
# Sound Shower", 0060 "` Passing Breeze", ...)
struct song_title_record 2 rom
field song_title_record 00 x u16
local song_title_show 019344 R10 record song_title_record
01954C  table radio_station_title  song_title_record   # "Mega Radio Station", the title car_radio_update shows for the station (0190F0 "movea.b 1954C[PC], R10", car_radio_show_title); census ROM 01954C-019560 (0058, then the text)
019CAC  func  title_screen_update
019CB8  table title_screen_state_jumps  u32   # title_screen_update (019CB5 "jmp [R0]") jumps through it by state: 019CC4 019DAB 019E27
# The title's tilemap register copies for a screen (title_screen_layer_setups, by screen index):
# title_screen_update reads it with [R19+] from 019CD7 "movea.w 1ACCC[PC](R0), R19" (R0 = index << 3, a word
# each: 32 bytes) into 84-A0
struct title_screen_layer_setup 20 rom
field title_screen_layer_setup 00 tile_bank_address u32
field title_screen_layer_setup 04 pages_address u32
field title_screen_layer_setup 08 scroll_x_address u32
field title_screen_layer_setup 0C scroll_y_address u32
field title_screen_layer_setup 10 second_tile_bank_address u32
field title_screen_layer_setup 14 second_pages_address u32
field title_screen_layer_setup 18 second_scroll_x_address u32
field title_screen_layer_setup 1C second_scroll_y_address u32
01ACCC  table title_screen_layer_setups  title_screen_layer_setup   # census ROM 01ACCC-01AD0B (screen 1: 20E2B0 20E240 20E292 20E296 20E2B2 20E248 20E2A2 20E2A6; screen 2: 20E2B1 20E244 20E29A 20E29E 20E2B3 20E24C 20E2AA 20E2AE)
01AD0C  table title_background_setups  background_setup   # title_screen_update "movea.w 1AD0C[PC](R0), R19" (019D15, R0 = index x 5) for set_up_background; census ROM 01AD0C-01AD33 (screen 1: 05040302 00000101 01 03 01 02 01AD34 01AD64; screen 2: 0F0E0D0C 00000B0B 01 03 01 02 01AD4C 01AD64)
01ACC0  table title_logo_car_wave_frames  u16  # title_screen_update "movea.b 1ACC0[PC], 80[R20]" (019E16): the frames at which three more logo cars start, closed by 0; census ROM 01ACC0-01ACCB (78 F0 12C 186 1C2 0)
# The frames of title_logo_car_wave_frames the title waits for (title_screen wave_times, 80): "mov.w 80[R20], R10;
# cmp.h [R10], 10[R20]" (019E3B, 019E40), then "add.w #2, 80[R20]" (019E64)
elements title_wave_frames u16
019E6B  func  title_car_drive
019E78  table title_car_state_jumps  u32   # title_car_drive (019E74 "jmp [R0]") jumps through it by state: 019E80 019EFD
# One of the eight cars driving past at the bottom of the title (title_car_records, by title_car index):
# title_car_drive reads it with [R10+] from 019E8C "movea.b 1ABB4[PC](R0), R10" (R0 = index << 4): "movz.hw
# [R10+], R0" (019E92: the model), "mov.h [R10+]" into 3A, 34, 36, 20, 32, 2C (019EA1-019EBA), "add.h [R10],
# 3C[R20]" (the layer, less 18F)
struct title_car_record 10 rom
field title_car_record 00 model u16
field title_car_record 02 palette u16
field title_car_record 04 width_scale u16
field title_car_record 06 height_scale u16
field title_car_record 08 position u16
field title_car_record 0A y u16
field title_car_record 0C speed u16
field title_car_record 0E depth_layer u16
01ABB4  table title_car_records  title_car_record   # census ROM 01ABB4-01AC33 (model 6 palette 97 scale 90 position 400 y A8 speed 10 layer FFF9, ...)
01AC34  table title_car_animations  u16   # by car model: title_car_drive "movz.hw 1AC34[PC](R0), R9" (019E95), title_logo_car_update too (01A368); census ROM 01AC34-01AC43 (0401 0475 04E9 055D 05D1 0645 06B9 072D)
01ABA4  table title_car_screen_offsets  u16   # title_car_drive "mov.h 1ABA4[PC](R1), R1" (019F21) by screen car_number: taken off the position for x; census ROM 01ABA4-01ABB3 (300 440 580 6C0 800 940 A80 BC0)
019F4C  func  title_car_driver_update
019F58  table title_car_driver_state_jumps  u32   # title_car_driver_update (019F55 "jmp [R0]") jumps through it by state: 019F74 019FD3
01A012  table title_driver_animations  u16   # title_car_driver_update "movz.hw 1A012[PC](R0), R9" (019F90) by model, for animation_start; census ROM 01A012-01A021 (07AB-0D5B)
01A032  table title_driver_palettes  u16   # title_car_driver_update "mov.h 1A032[PC](R0), 3A[R20]" (019F78) by model; census ROM 01A032-01A041 (A6-AD)
01A062  table title_driver_x_offsets  u16   # title_car_driver_update "mov.h 1A062[PC](R0), 10[R20]" (019F80) by model: x_offset; census ROM 01A062-01A071 (8 6 FFFB 0 FFEF 0 2 10)
01A072  table title_driver_y_offsets  u16   # title_car_driver_update "mov.h 1A072[PC](R0), 12[R20]" (019F88) by model: y_offset; census ROM 01A072-01A081 (FFE0-FFED)
019F60  func  title_car_passenger_update
019F6C  table title_car_passenger_state_jumps  u32   # title_car_passenger_update (019F69 "jmp [R0]") jumps through it by state: 019F98 019FD3
01A022  table title_passenger_animations  u16   # title_car_passenger_update "movz.hw 1A022[PC](R0), R9" (019FB4) by model, for animation_start; census ROM 01A022-01A031 (0813-0DC3)
01A042  table title_passenger_palettes  u16   # title_car_passenger_update "mov.h 1A042[PC](R0), 3A[R20]" (019F9C) by model; census ROM 01A042-01A051 (AE-B5)
01A082  table title_passenger_x_offsets  u16   # title_car_passenger_update "mov.h 1A082[PC](R0), 10[R20]" (019FA4) by model: x_offset; census ROM 01A082-01A091 (3 FFFD FFF2 FFFA FFEC FFF6 4 6)
01A092  table title_passenger_y_offsets  u16   # title_car_passenger_update "mov.h 1A092[PC](R0), 12[R20]" (019FAC) by model: y_offset; census ROM 01A092-01A0A1 (FFDA-FFED)
019FD3  func  title_rider_draw
01A052  table title_rider_scales  u16   # title_rider_draw "mov.h 1A052[PC](R0), 34[R20]" and "36[R20]" (019FD7, 019FDF) by model: the riders' width and height scale; census ROM 01A052-01A061 (90-100)
01A0A2  func  title_screen_start_palms
01A0E2  func  title_palm_tree_update
01A18C  func  title_logo_update
01A29C  func  title_logo_copy_update
01A329  func  title_logo_car_update
01A3E9  func  title_logo_stripe_update
01A499  func  title_board_palms_update
01A536  func  title_seagull_fly
01A672  func  title_picture_draw
01A6CF  func  coin_prompt_update
01A7C5  func  coin_prompt_car_drive
01A834  func  coin_prompt_message_update
01A8CA  func  coin_prompt_start_key_prompt
01A8E2  func  ignition_key_prompt_update
01AA01  func  credit_display_update
01AB20  func  credit_display_digit
01ADE8  func  demo_captions_run
01AE2D  func  demo_captions_head_to_head
01AE61  func  demo_captions_checkpoint
01AE6B  func  demo_captions_music_select
01AE75  func  demo_captions_start
01AE8D  func  demo_caption_update
comment title_screen_update The title of the attract mode. By state: 0 sets it up: clears screen 5800 and 5801 (title_logo_shine, the logo's shine signal), keeps the addresses of the tilemaps' register copies (title_screen_layer_setups by screen: scroll_x_address, scroll_y_address for the first tilemap, second_scroll_x_address, second_scroll_y_address for the second), the background (set_up_background with title_background_setups by screen) and its scrolls, picks the car of the next car presentation (screen attract_car from next_attract_car, which steps through the eight), starts the credits line (credit_display), the prompt (coin_prompt) and the eight cars driving past (title_car); 1 for 45 frames (frames): palm trees (title_screen_start_palms) and the two tilemaps scrolled by 8 and 20 a frame, then the logo (title_logo, title_logo_copy), three logo cars (title_logo_car) and the three lines across the logo (title_logo_stripe); 2 the same palms and scrolls, with three more logo cars at each count of wave_times (120, 240, 300, 390, 450).
comment title_screen_start_palms Starts the title's palm trees: a near one (title_palm_tree with near_or_far 0) every 8th frame (palm_frames), else a far one (1) every other frame.
comment title_car_drive One of the eight cars driving past at the bottom of the title (title_screen starts them, index 0-7). Sets itself up from its record (title_car_records by index: the model, whose animation title_car_animations gives, palette, width_scale, height_scale, position, y, speed, and its depth_layer less 18F; draw mode A, frame 9) and starts its driver (title_car_driver) and passenger (title_car_passenger); each frame drives on by speed along a strip 4096 wide that wraps (clearing flags bit 5 as it wraps), is drawn at the position less the screen's offset (title_car_screen_offsets by screen car_number) and bobs a line up on odd frames (frames; rest_y keeps its y meanwhile).
comment title_car_driver_update The driver of a title car (the blond man at the wheel): sets up its picture by the car's model (animation title_driver_animations, palette title_driver_palettes, x_offset title_driver_x_offsets, y_offset title_driver_y_offsets, a layer in front of the car), then is drawn with the car each frame (title_rider_draw).
comment title_car_passenger_update The passenger of a title car (the red-haired woman beside the driver): sets up its picture by the car's model (animation title_passenger_animations, palette title_passenger_palettes, x_offset title_passenger_x_offsets, y_offset title_passenger_y_offsets, a layer in front of the car), then is drawn with the car each frame (title_rider_draw).
comment title_palm_tree_update A palm tree passing the title from right to left (title_screen_start_palms starts them): near (near_or_far 0: full size, low on the screen, 48 a frame) or far (1: 3/8 of the size, along the beach, 18 a frame); ends once off the left edge.
comment title_logo_update The OutRunners logo of the title: slides in from the right (16 a frame for 10 frames); then starts the palm trees of its board (title_board_palms), the two seagulls (title_seagull) and the title's still pictures (title_picture: the board, SEGA, (C) SEGA 1992), flashes through the palettes at 01AC54 (palette_list) for 6 frames and settles in palette 269 at its next frame; then shines (its animation again from frame 1) each time the first logo car reaches the right edge (screen title_logo_shine).
comment title_logo_copy_update A copy of the logo in other colours (cyan) that slides in from the left as the logo (title_logo) slides in from the right, meets it, flashes through the palettes at 01AC62 (palette_list) and ends.
comment title_logo_car_update A small car racing across the logo along one of its lines (title_screen starts three at a time, index 0-2): after 1, 5 or 9 frames by index, one of the eight cars at random (title_car_animations, title_logo_car_palettes) at a quarter of its size at the left edge; 16 a frame to the right edge; the first of the three then makes the logo, its board's palm trees and the lines shine (screen title_logo_shine for a frame), and it ends.
comment title_logo_stripe_update One of the three thin coloured lines across the logo that the logo cars race along (index 0-2): after 1, 5 or 9 frames by index it slides in from the left (16 a frame for 19 frames), then shines with the logo (its animation from frame 0 when screen title_logo_shine is set).
comment title_board_palms_update The palm trees at the right end of the logo's board: grow in from 3/4 of their size (8 frames), then sway each time the logo shines (screen title_logo_shine).
comment title_seagull_fly One of the two seagulls over the title (index 0, 1): flies up out of the logo for 8 frames growing to full size, then circles about that place in a figure of eight (the sine of x_angle, a turn in 128 frames, and of y_angle, twice as fast), flapping (its animation).
comment title_picture_draw One of the title's still pictures (title_logo starts them): by index, from its record at 01AC70 (animation, palette, width_scale, height_scale, x, y, depth_layer): 0 (C) SEGA 1992, 1 the oval board behind the logo, 2 the SEGA logo.
comment coin_prompt_update The prompt at the bottom of the title, the car presentations and the demo races, and its text on the cabinet's LCD; ends at once in game mode 6 (screen game_mode). Every 30 frames (round_frames): a little car crosses the message (coin_prompt_car with this round's car; next_car then steps through the eight, from screen car_number) and the message by the seat (seat1_credits and seat1_coin_units for screen 1, seat2_credits and seat2_coin_units for screen 2): with free play (free_play) or a credit message 2, TURN THE IGNITION KEY (coin_prompt_start_key_prompt); else message 1 with coins in toward a credit or 0, a coin_prompt_message in the car's colour (INSERT COIN(S)). Each frame the LCD's text to scroll (screen lcd_scroll_request) is the message's (coin_prompt_lcd_texts: Insert Coin(s), Insert More Coin(s), Turn the Ignition Key), except in game modes 6 and 7 or while a text scrolls (lcd_scroll).
comment coin_prompt_start_key_prompt Starts R1 pieces of the ignition key prompt (ignition_key_prompt), pieces R2 on, and returns the last one.
comment coin_prompt_car_drive The little car that drives across the prompt from right to left each round (coin_prompt starts it): one of the eight cars (car) at a quarter of its size, 14 a frame, ending at the left edge.
comment coin_prompt_message_update The prompt's message for a round (coin_prompt starts one every 30 frames): after 6 frames, INSERT COIN(S) (message 0; 1 when coins are in, animation coin_prompt_message_animations) in the colour of the round's car (coin_prompt_message_palettes by car_colour), animating in for 22 frames over the one before, then a layer back for 30 frames, and ends; ends at once when the prompt's message changes.
comment ignition_key_prompt_update A piece of the prompt when a game can start (coin_prompt starts both every round): by piece, from its record at 01A95B (animation, palette, width_scale, height_scale, x, y, depth_layer, frames_left): 0 the words TURN THE IGNITION KEY, 1 the START / IGNITION key with its arrow; animates until frames_left runs out (24 or 30 frames) and ends.
comment credit_display_update The credits line under the prompt (title, car presentations, demo races); ends in game mode 6. With free play (free_play) FREE PLAY; otherwise, for the screen's seat (seat1_credits and seat1_coin_units for screen 1, seat2_credits and seat2_coin_units for screen 2): Credit (0 or 1) or Credits and the number of credits in the font's digits (tens at x AC when there are, units at B4), and while coins are in toward the next credit the coins and the coins a credit costs (coins_per_credit) as a fraction (C0 and C8), each drawn with credit_display_digit.
comment credit_display_digit Draws one digit of the credits line at x and y: digit_kind picks the animation and palette (credit_display_animations, credit_display_palettes: 0 the font, whose frames are its characters, 1 the coins, 2 the coins a credit costs) and digit the frame.
comment demo_captions_run The captions over the demo race of the attract mode: counts its frames and runs the routines of timeline_1AFC0 as it reaches their frames (30 demo_captions_head_to_head, 225 demo_captions_checkpoint, 420 demo_captions_music_select); ends once the count passes a record's frame (the closing FFFF).
comment demo_captions_head_to_head Frame 30 of the demo captions: HEAD TO HEAD! 2 PLAYER RACING (demo_caption records 0, 1 and 3 + machine_count, or 4 when stand_alone is set; 4 in attract.txt).
comment demo_captions_checkpoint Frame 225 of the demo captions: AT THE CHECKPOINT ONLY THE RACE LEADER CAN SELECT THE NEXT STAGE ! (demo_caption records 2 and 3).
comment demo_captions_music_select Frame 420 of the demo captions: the radio's panel, the hand pressing its button and MUSIC SELECT (demo_caption records 8-11).
comment demo_captions_start Starts R1 demo_caption objects with the records from R0 on.
comment demo_caption_update One picture of the demo captions (demo_captions_start starts them): from its record at 01AF00 (animation, palette, width_scale, height_scale, x, y, depth_layer, frames_left: 180 frames for records 0-7, 240 for 8-11), animated and drawn until frames_left runs out.
comment traffic_follower_update A vehicle in a line of road traffic behind a 0138EB leader (traffic_car_start_convoy starts the line from the leader's list: each one the list's spacing behind the one before it, with its own record): moves and draws as the leader's family does (traffic_car_update), but lives exactly as long as the one before it (leader): when that one has ended it ends too (screen traffic_count, the count of the traffic, less 1). The only line in the road's lists is in list 25 of stage_road_object_lists (a leader of animation 35C and eight of 35D); the scenarios start it only for a frame or two.
comment pulled_vehicle_update The vehicle a road animal pulls (traffic_figure_start_team starts it behind a 013BA3 leader from the leader's list): the covered wagons behind the horses (list 1 of stage_road_object_lists), the sleighs behind the reindeer (lists 25 and 26). Moves and draws as the 013AF9 traffic does (traffic_stopping_car_update), and lives exactly as long as the one before it (leader): when that one has ended it ends too (screen traffic_count less 1).
comment traffic_hit_sound_wait Plays a road object's own sound 15 frames after the car has hit it (traffic_start_hit_sound starts it with the sound of the object's record): counts delay down, then requests sound (request_sound) and ends.
comment rider_gesture_update A rider's gesture on another racer's car (00974C; race_cars_start starts one for its driver, rider = model, and one for its passenger, model + 8; only some have a gesture, rider_gesture_animations, the others end at once): when the car moves up a place in the race (rider_gesture_check_place) it plays its gesture once (the driver raises an arm, a finger up) in place of the rider, and while the car can be seen from the angle and the screen's car is racing (rider_gesture_check_view) it is drawn on the car (rider_gesture_place) at the car's size and a layer in front; then waits for the next time.
comment rider_gesture_check_view Whether the gesture shows (zero clear): only while the screen's car object is in state 2 or 4 (rider_gesture_car_states) and the car is seen from one of the angles that show it (rider_gesture_views by the car's view); otherwise clears the car's gesture_shown; then rider_gesture_check_place.
comment rider_gesture_check_place Notes the racer's place in the race (screen + 320 + player) in its car's last_place and sets its gesture_shown when it is better than the last one; returns gesture_shown masked with R9 (zero set when there is no gesture to show).
comment rider_gesture_place Places the gesture on its car: the car's x and y (plus the screen's scroll, screen sprite_origin_x and sprite_origin_y) and the rider's offset, rider_gesture_x_offsets and rider_gesture_y_offsets by rider plus the seat's offset for the car's view (race_car_rider_places by model, by the car's view, the driver's or the passenger's), scaled by R0 (the car's width_scale).
comment race_opening_update The opening of a race (not in the demo): the view comes down from high above the start line to behind the car, taking the car's view_shift_intro up by 18 and view_pitch_intro down by 3 a step until it is 0 (80 steps from FA60 and F0; camera_step), while the opening's sounds play (race_opening_sounds_play; sound_step); ends when both are done.
comment race_opening_sounds_start Starts the opening's sounds: the first at count 1, the rest of race_opening_sound_cues.
comment race_opening_sounds_play Counts the opening's steps (count) and requests each sound of the list at its count (sound_list: sounds 2D, 24, 0A, 21, 2E, 2D, 24 at the counts 1, 20, 65, 120, 150, 160, 190); after the last goes on to race_opening_sounds_done.
comment race_opening_sounds_done Does nothing: the opening's sounds are over.
comment road_surface_update The road of the race, drawn on its tilemap with line scroll and line select. By state: 0 road_surface_start; then each frame this frame's lines (road_surface_lines) and, from state 2, those of the frame in between (road_surface_halfway_lines); where the first segment's page set (segment_page_set) is 0 it starts the stage's palette fades (start_palette_fades with screen road_palette_fades; state 3), and at the next one that is not takes it as page_set and fades back (road_surface_fade_back; state 2). Each frame the tilemap's page word (at page_register) is the page table's word for page_set and near_scroll (five a set). At each new segment (segment past last_segment) acts on the segment's event when it changes (after the first 30 segments, event_delay): 4 and 5 change the background within the stage (screen stage_background_change = FF, stage_background_branch = 0 or 1, for race_background), 1 and 2 turn the two road_tiles_change flags (0A, 0B) on and off, 3 both; a flag turned on starts a road_tiles_change (the Golden Gate Bridge in race_to_goal.txt, frames 7659-8325).
comment road_surface_start Sets up the road's tilemap from the screen's road_surface_layer_setups record: its bits in video_registers[2], its scroll (160, 0), tile bank, mixer bits, page_register, the line tables in the video RAM (line_scroll_table, line_select_table) with the line select's start from 100800, the page set of the stage (stage_road_page_sets by screen first_stage), the page table (road_surface_page_words) and the stage's palettes (stage_road_palettes by stage: the fades' list into screen road_palette_fades, the rest queued with queue_palette_list).
comment road_surface_lines Works out this frame's road: from the segments in view (screen + 3000, 16 bytes each, the first at the view's position race_copy window_segment) the first one's page set and event (+C, +D) and number (segment), each segment's point (+2 depth, +4 x, +6 y) into the points buffer (screen + 3800 by points_buffer), and between points the lines of the line scroll (the road's x) and line select (its depth, every other pair of segments in the picture's second half: the stripes) tables, from the bottom line up (road_surface_fill_lines); a stretch it passes over is filled after (road_surface_fill_skipped_lines); the farthest point's line into screen road_top_line and the bottom line's scroll into near_scroll.
comment road_surface_halfway_lines Works out the road of the frame in between: the same lines from the average of this frame's points and the last frame's (the two halves of the points buffer, matched by segment), into the next tables; flips points_buffer.
comment road_surface_fill_lines Fills the road's lines between two of its points, from the lower one up: the line scroll steps evenly from one point's x to the other's and the line select from one's depth to the other's (at most R18), plus R14 (100 on alternate pairs of segments); returns the two steps.
comment road_surface_fill_skipped_lines Fills the stretch of lines road_surface_lines passed over (from line skipped_line, at the table places it kept) by going on from the kept point with the kept steps down to line DF; nothing when there is none.
comment road_surface_start_tiles_change Starts the road_tiles_change of event 1 (its data road_tiles_change_first_data, the even bytes of the page table) with the road's first flag (0A).
comment road_surface_fade_back Starts the palette fades of list R19 backwards (start_palette_fade from each record's second palette to its first): the road's colours back after a change of page set.
comment road_tiles_change_update Changes the road's tiles for a stretch of road (road_surface starts it when an event turns one of its flags on; the Golden Gate Bridge in race_to_goal.txt): copies the four tile pages the road shows (source_pages to target_pages, a page a frame), turns its half of the road's page table (table_half: the even or odd bytes) to the copies, copies the new look into the pages by the road's page set (16 halfwords of each a frame for 16 frames) and turns the table back; when the road turns its flag off (flag) it changes them back the same way and ends; its data list (data: road_tiles_change_first_data for the first flag, road_tiles_change_second_data for the second) holds the pages and the bytes for the table.
comment race_background_update The scenery behind the road (the race's first tilemap). By state: 0 sets it up: its register copies (race_background_layer_setups by screen: scroll_x_address, scroll_y_address, tile_bank_address, page_word_address), the stage's background (background: stage_backgrounds by screen first_stage, none for stage 0), its tile pages (background_tile_page_lists, loaded at once with unpack_tile_pages), tile bank and palettes (race_background_fade_palettes, queue_palette_list), its objects (race_background_start_objects) and, for stages 6, 8 and 1C, its animation (race_background_start_lower_animation, race_background_start_upper_animation); 1 waits for a change: a fork's new stage (the car's new_branch; background 2 * screen built_stage + the branch, car branch) or the road's events 4 and 5 (screen stage_background_change; background 2A + built_stage): screen background_changing set, the new background's pages queued into the other half of the pages (page_half; queue_tile_pages); 2 changes over as the view turns away and back (the car's view_yaw; change_step): when it starts its palettes, tile bank and the first page word (next_page_words), at 2A0 (off the screen) the fades of background_leaving_fades and of the road (background_road_palettes, into screen road_palette_fades) and the next, the new stage's objects (screen route_stage), at 160 its palette fades (race_background_fade_palettes) and the next, at 60 the last, at 0 back to state 1 with the animation of backgrounds 5, 7, 8, 25 and 26. Each frame scrolls it: x by the car's view_yaw (a quarter of it, all of it during a change) less A0, y by the slope (the car's road_pitch) and screen horizon_line, kept between 0 and 180 less the road's top line (screen road_top_line; also into screen background_scroll_y).
comment race_background_start_lower_animation Loads the tiles of the background's lower animation (queue_tile_pages with background_lower_animation_tile_pages by screen) and starts it (race_background_lower_animation).
comment race_background_start_upper_animation Loads the tiles of upper animation R0 (queue_tile_pages with background_upper_animation_tile_pages by R0 and screen) and starts it (race_background_upper_animation).
comment race_background_start_objects Starts the background objects of stage R0 (stage_background_object_lists; R0 + 1F during a change within the stage, screen stage_background_change), each with its data (field 80) and this object (14).
comment race_background_fade_palettes Starts the palette fades of list R19 (start_palette_fade for each record) and a race_background_fade_watch that keeps them; with an empty list clears screen background_fading (the background's palettes are changing) at once.
comment race_background_lower_animation_wait Waits until the animation's tiles are loaded (screen unpack_state), then goes on to race_background_lower_animation_cycle.
comment race_background_lower_animation_cycle Every 2 frames (delay) puts the next of four page pairs (background_lower_animation_page_pairs; step goes two on, keeping to the screen's own) into the second half of the background's page word (the lower pages); ends when a change of background starts (screen background_changing).
comment race_background_upper_animation_wait Waits until the animation's tiles are loaded (screen unpack_state), then goes on to race_background_upper_animation_cycle.
comment race_background_upper_animation_cycle Every 3 frames (delay) puts the next of three page pairs (background_upper_animation_page_pairs) into the first half of the background's page word (the upper pages: the schools of fish over the underwater tunnel swim); ends when a change of background starts (screen background_changing).
comment race_background_fade_watch_update Waits for the background's palette fades (fades, count of them) to end, forgetting each as it ends (its flags bit 0 clear); then clears screen background_fading (the background's palettes are changing) and ends.
comment palette_fade_prepare Prepares a palette fade, one colour a frame for its 16 (colours_left): the colour of the first palette (from) into its colours (34 on) and its red, green and blue (five bits each) less those of the second (to) into its differences (54 on); then palette_fade_step.
comment palette_fade_step Every period frames (delay; start_palette_fade staggers the first) moves each of the 16 colours one step of each of red, green and blue toward the second palette (by its differences, counted down to 0) and queues them (queue_palette_list with its record at 28: 8 bytes, the colours, palette_offset, blocks); ends when no colour moved, or when the screen fades out (screen flags bit 0, with fade_kind at most 5 and even).
comment start_palette_fade Starts a palette_fade of 16 colours from the palette at R10 to the one at R11, for palette offset R12 (R0 blocks of 16 in its upload record), a step every R1 frames, the first after (screen palette_fades_started mod R1) + 1 (palette_fades_started counts the fades started); returns the object.
comment start_palette_fades Starts a palette_fade for each 12-byte record of list R19 (a 32-bit length in bytes, then records: from, to, palette offset, blocks, period).
comment song_title_show A song title on the screen (start_song_title starts it, for car_radio, the car select and 00C8B6): its x and text from the record (x, and the text, which also scrolls on the LCD through screen lcd_scroll_request), then slides in from the right (slide from D2, slowing down to a stop by speed), stays for time_left (60 frames) and slides out to the left speeding up; sent away early (time_left 0, car_radio_show_title) it leaves at 40 a frame. Drawn each frame with draw_text_at at y C8 in colours that cycle every 2 frames (song_title_colours by colour_step).
scoped object title_screen 10 frames u16
scoped object title_screen 12 palm_frames u16
scoped object title_screen 80 wave_times u32 title_wave_frames
scoped object title_screen 8C scroll_x_address u32 video_register_words
scoped object title_screen 90 scroll_y_address u32 video_register_words
scoped object title_screen 9C second_scroll_x_address u32 video_register_words
scoped object title_screen A0 second_scroll_y_address u32 video_register_words
scoped object title_car 09 index u8
scoped object title_car 10 frames u16
scoped object title_car 20 position s16
scoped object title_car 24 rest_y u16
scoped object title_car 2C speed u16
scoped object title_car_driver 09 model u8
scoped object title_car_driver 10 x_offset s16
scoped object title_car_driver 12 y_offset s16
scoped object title_car_driver 14 car u32 object
scoped object title_car_passenger 09 model u8
scoped object title_car_passenger 10 x_offset s16
scoped object title_car_passenger 12 y_offset s16
scoped object title_car_passenger 14 car u32 object
scoped object title_palm_tree 09 near_or_far u8
scoped object title_logo 10 frames u8
scoped object title_logo 80 palette_list u32 title_logo_palettes
scoped object title_logo_copy 10 frames u8
scoped object title_logo_copy 80 palette_list u32 title_logo_palettes
scoped object title_logo_car 09 index u8
scoped object title_logo_car 10 delay u8
scoped object title_logo_stripe 09 index u8
scoped object title_logo_stripe 10 frames u8
scoped object title_board_palms 10 frames u8
scoped object title_seagull 09 index u8
scoped object title_seagull 10 frames u8
scoped object title_seagull 88 x_angle s16
scoped object title_seagull 8C centre_x s16
scoped object title_seagull 90 centre_y s16
scoped object title_seagull 98 y_angle s16
scoped object title_picture 09 index u8
scoped object coin_prompt 09 message u8
scoped object coin_prompt 0A next_car u8
scoped object coin_prompt 0B car u8
scoped object coin_prompt 10 round_frames u8
scoped object coin_prompt_car 0A car u8
scoped object coin_prompt_car 0B car_colour u8
scoped object coin_prompt_message 09 message u8
scoped object coin_prompt_message 0B car_colour u8
scoped object coin_prompt_message 10 frames u8
scoped object ignition_key_prompt 09 piece u8
scoped object ignition_key_prompt 10 frames_left u16
scoped object credit_display 09 digit_kind u8
scoped object credit_display 0A digit u8
scoped object demo_captions 10 frames u32
scoped object demo_captions 80 timeline u32 demo_caption_cue
scoped object demo_caption 09 record u8
scoped object demo_caption 10 frames_left u16
scoped object traffic_follower 14 leader u32 object
scoped object traffic_follower 18 record u32 rom
scoped object pulled_vehicle 14 leader u32 object
scoped object pulled_vehicle 18 record u32 rom
scoped object traffic_hit_sound 10 delay u8
scoped object traffic_hit_sound 12 sound u8
scoped object rider_gesture 09 rider u8
scoped object rider_gesture 0A model u8
scoped object rider_gesture 0B player u8
scoped object race_opening 0D sound_step u8
scoped object race_opening 0E camera_step u8
scoped object race_opening 10 count u8
scoped object race_opening 12 next_count u8
scoped object race_opening 18 sound_list u32 sound_cue+1    # the next sound_cue's sound (0144C4 "mov.w R10, 18[R20]" after its time)
scoped object road_surface 0A first_tiles_flag u8
scoped object road_surface 0B second_tiles_flag u8
scoped object road_surface 0D page_set u8
scoped object road_surface 0E segment_page_set u8
scoped object road_surface 0F points_buffer u8
scoped object road_surface 10 near_scroll u16
scoped object road_surface 12 event u8
scoped object road_surface 13 last_event u8
scoped object road_surface 14 segment u16
scoped object road_surface 16 last_segment u16
scoped object road_surface 18 page_table u8[3C]   # the pages, four a page word: five page words (by the near scroll, 512 lines a step) for each of page sets 3-5: road_surface_page_words, copied in by road_surface_start
scoped object road_surface 54 page_register u32 page_select
scoped object road_surface 58 line_scroll_table u32
scoped object road_surface 5C line_select_table u32
scoped object road_surface 60 skipped_line u32
scoped object road_surface 64 skipped_x u32
scoped object road_surface 68 skipped_depth u32
scoped object road_surface 6C skipped_x_step u32
scoped object road_surface 70 skipped_depth_step u32
scoped object road_surface 74 skipped_scroll_place u32
scoped object road_surface 78 skipped_select_place u32
scoped object road_surface 7C skipped_stripe u32
scoped object road_surface 80 event_delay u8
scoped object road_tiles_change 09 table_half u8
scoped object road_tiles_change 0A page_set u8
scoped object road_tiles_change 10 step u8
scoped object road_tiles_change 12 pages_left u8
scoped object road_tiles_change 18 source_pages u32[4]   # the four tile pages it copies from
scoped object road_tiles_change 28 target_pages u32[4]   # the four it copies to
scoped object road_tiles_change 38 data u32 road_tiles_change_bytes
scoped object road_tiles_change 3C flag u32 tiles_change_flags
scoped object race_background 0D change_step u8
scoped object race_background 0E page_half u8
scoped object race_background 0F background u8
scoped object race_background 18 scroll_x_address u32 video_register_words
scoped object race_background 1C scroll_y_address u32 video_register_words
scoped object race_background 20 page_word_address u32 tilemap_pages
scoped object race_background 24 tile_bank_address u32 tilemap_banks
scoped object race_background 28 next_page_words u32 background_page_word_steps
scoped object race_background 2C page_list u32
scoped object race_background_lower_animation 10 delay u8
scoped object race_background_lower_animation 12 step u8
scoped object race_background_lower_animation 20 page_word_address u32 tilemap_pages
scoped object race_background_upper_animation 10 delay u8
scoped object race_background_upper_animation 12 step u8
scoped object race_background_upper_animation 20 page_word_address u32 tilemap_pages
scoped object race_background_fade_watch 10 count u32
scoped object race_background_fade_watch 14 background u32 object
scoped object race_background_fade_watch 80 fades u32 object
scoped object palette_fade 10 delay u8
scoped object palette_fade 12 period u8
scoped object palette_fade 13 colours_left u8
scoped object palette_fade 18 from u32 palette_colours
scoped object palette_fade 1C to u32 palette_colours
scoped object palette_fade 20 colour_place u32 palette_fade_colours
scoped object palette_fade 24 difference_place u32 palette_fade_differences
scoped object palette_fade 30 palette_offset u16
scoped object palette_fade 32 blocks u16
scoped object song_title 0D colour_step u8
scoped object song_title 10 time_left s16
scoped object song_title 12 speed u16
scoped object song_title 18 text u32 rom
scoped object song_title 20 slide s16
scoped object song_title 22 y u16
field object 3C depth_layer u16
scoped object car_select_entries 40 shown_players u32  # bit n: player n's choice is shown already (test1/set1 R0, 40[R20])

# ======== the frame loops, the inputs, the game modes and the EEPROM (naming batch G) ========
0000C4  func  crc16
0000FC  func  signature_checksum
00013C  func  load_settings
0002CA  func  count_eeprom_write
0002E1  func  eeprom_lock
000337  func  eeprom_read_settings
00036B  func  save_settings
000372  func  eeprom_write_settings_counted
000375  func  eeprom_write_settings
0003BA  func  eeprom_read_word
0003ED  func  eeprom_write_word
000451  func  eeprom_send_command
0004A1  func  eeprom_begin
0004B8  func  eeprom_set_lines
000848  func  check_game_start
0008F0  func  wait_for_frame
000913  func  initialise_game
000976  func  initialise_screen
000995  func  initialise_board
0009F9  func  read_switches_and_analog
000B16  func  pack_seat_inputs
000BBC  func  link_send_seat_inputs
000BF3  func  queue_seat_inputs
000C1C  func  queue_screen_inputs
000C5A  func  take_screen_inputs
000D7D  func  isdn_count_players
000D9F  func  game_mode_isdn_connection
001000  func  game_mode_title
001440  func  game_mode_power_on
00144C  func  game_mode_restart
001458  func  game_mode_car_presentation
001516  func  game_mode_demo_race
001544  func  demo_race_set_up
001577  func  demo_race_fade_in
001594  func  demo_race_start_timer
0015A9  func  demo_race_count_down
0015C0  func  demo_race_end
0015D8  func  attract_lamps_update
001969  func  staff_credits_code_control_bit
001D84  func  load_course_records
001DCC  func  game_mode_ranking
001E89  func  course_record_beaten
002E74  func  game_mode_play
003407  func  silence_and_clear_screen
00340D  func  clear_screen
003425  func  clear_race_state
007677  func  clear_published_car
comment boot The reset's code (000006): SBR to the vector table, the stack 21FC00, 16 bytes from 0000A4 to E00000 and 4 from 0000B4 (boot_e80000_bytes) to E80000 (which the board does not map), the interrupt controller's registers from 0000B8, privilege level 0 with the stack 21F400 and a delay; then clears 21E000-21E3FF, turns the link board off (801000), clears 21F000-21FFFF, sets the I/O chips up (init_io_chips), clears the game's variables (20E000-20FFFF), writes the second task's first interrupt frame (000C98 to 21FF84: its PC 0006B0) and its stack pointers (waiting_task_frame, waiting_task_stack), initialise_game, lcd_start (the LCD), the interrupts on, the link's check (network_check), and goes on as the boot task's frame loop (second_task(1), screen 2's).
comment second_task The two tasks' frame loops, one function in the C: second_task(0) is the second task (from 0006B0), which runs screen 1; second_task(1) the boot task after boot (from 000637), which first sets up the link's race (link_take_master_settings), the interrupt controller's timer (D00008, D0000A), task_swapping, each screen's first attract car (screen next_attract_car from first_attract_car_lists by machine_count and the screen's car number) and the screens on (C0001C, C8001C), then runs screen 2 (second_task_frames, which comes back when the test mode starts). A frame of either: wait_for_frame (the VBLANK swaps the tasks meanwhile; the second task calls link_send_records before it with second_task_waiting set, and the boot task calls link_send_records and link_receive_records only while that is clear), the test mode when test_mode_on is set, link_receive_records, race_entries_update, race_progress_update and course_records_update (the link and the race records), game_frame_count + 1 (screen 1's loop), take_screen_inputs, check_game_start, the game mode's code (game_mode_jumps by game_mode: game_mode_power_on, game_mode_restart, game_mode_title, game_mode_car_presentation, game_mode_demo_race, game_mode_ranking, game_mode_play, entry_invitation_step (the entry countdown on a seat without a player), game_mode_isdn_connection), run_objects and lcd_update; with single_task set it goes on with the other screen's frame instead of waiting. The test mode: task_swapping off, test_mode_start, then test_mode_frame each frame while test_mode_on lasts; then the screens off, the variables cleared, the second task's frame written again, initialise_game, lcd_reset, both screens in game mode 1 with a fade in (fade 1), network_check_again, and the boot task's part again.
comment second_task_frames Both screens' frames from screen 2's on, until the test button (test_mode_on) ends them: then back to second_task, for the test mode. Screen 2's frame (as second_task's, without game_frame_count) over and over; with single_task set, screen 1's frame after it (second_task_waiting set around its link_send_records and wait_for_frame, game_frame_count + 1), which goes on over and over while single_task is clear, and back to screen 2's when it is set.
comment wait_for_frame Waits for the next frame: polls frame_ready (set by the VBLANK, which also swaps the tasks) and clears it; while the screen has tile pages to unpack (screen unpack_state) it unpacks them a piece at a time (unpack_queued_step) between the polls.
comment initialise_game Sets the game up, at start-up and after the test mode: 13, 0, 0, 1F to C00074 (which the board does not map); for screen 2, then 1, its objects' page cleared (clear_screen_ram) and its constants (init_screen: index, its video registers, the view's, the courses' stage lengths at 700); initialise_board; then initialise_screen for screens 1 and 2.
comment initialise_screen Sets a screen up: its sound off (reset_screen_sound), no objects (clear_objects), its tilemaps' registers and their copies (init_mixer), three palettes uploaded (upload_boot_palettes) and the courses' records (load_course_records).
comment initialise_board Sets the board up: the I/O chips (init_io_chips), the settings (load_settings), the sprite chip and its RAM (init_sprite_chip, load_sprite_ram_tables), the video RAM and its control (init_video), the backup RAM checked (bookkeeping_check), the credits (init_coins), the sound requests (start_sound_program), three lists of tile pages unpacked at once (unpack_tile_pages: 109420, 109428, 109578), then the inputs read and taken twice (read_switches_and_analog, take_screen_inputs) so that their previous values hold.
comment read_switches_and_analog Reads the inputs in the VBLANK (int_vector_40; twice at start-up): the switches of both I/O chips (ports E and F: bits 0-1 the seats' service switches, 2-5 the coin switches, 7 a test switch) into switches, with previous_switches, switches_pressed and switches_released; then, on the turn of the screen whose task runs, half the analog inputs through the A/D converter (C00050 + 4 * index): screen 1's turn seat 1's wheel, gas and brake and seat 2's wheel, screen 2's seat 2's gas and brake (the converter's second bank), each raw into analog_raw on and scaled to 0-FF between its calibration (a low and a high byte from 20E638, in the settings) into analog_inputs on; then the converter's bank for the other turn (C00060).
comment pack_seat_inputs Packs both seats' inputs for the coming frame (the VBLANK, on screen 1's turn) into their records: the screen's player + 1, the buttons (port A's high bits into 0-3, its low two into 4-5, the shift; port E bit 4 into bit 6, START), the wheel (analog_inputs inverted), the gas and the brake: seat_1_player to seat_1_brake and seat_2_player to seat_2_brake. On ISDN (isdn_mode) they go to the link board instead (link_send_seat_inputs).
comment link_send_seat_inputs Never runs in the scenarios (ISDN only): writes a seat's five bytes as halfwords on the link board at R11 (800020 on): 0, the buttons (R0), the wheel (inverted), gas and brake from analog_inputs at R10; or, when its screen has a link_event (R2: screen + 40), the event and the four bytes after it, which it then clears (without moving R10 on, so the next seat would read this one's analog inputs).
comment queue_seat_inputs queue_screen_inputs for screen 1 (seat_1_buttons, the first I/O chip) and screen 2 (seat_2_buttons, the second): the VBLANK on screen 2's turn.
comment queue_screen_inputs Puts a screen's inputs into its ring of eight (screen + 130, at input_write_place): the seat's buttons (R11) with ~port B of its I/O chip (R12 + 2) in bits 8-15; and the record's wheel, gas and brake into the screen's wheel, gas and brake. On ISDN the record is the screen's race_copy's +2C (the inputs the link brought).
comment take_screen_inputs Takes the screen's inputs for the frame from its ring (input_read_place; both frame loops, before check_game_start): buttons, with previous_buttons, buttons_pressed and buttons_released (bit 6 START, 4-5 the shift up and down, 0-3 the others, 8-15 port B). On ISDN also the link's status (race_copy link_status) into link_status, with link_status_set, link_status_cleared and link_status_changed, and, unless in it already, game mode 8 (game_mode_isdn_connection) while it says the line connects (bits 2-3).
comment check_game_start Each frame before the game mode's code: in the attract modes (not 0, not 6), with a credit on the seat (seat1_credits, seat2_credits for screen 2) or free play (free_play), blinks the START lamp (bit 2 of the seat's port_d_outputs, 8 frames on and 8 off by start_lamp_blink); START pressed (buttons_pressed bit 6) takes the credit (not with free play; and clears the bytes at 20E0A2 and 20E0AA, after each seat's coin units), turns the lamp off and starts a game: game mode 6 at step 0, link_event 1, the race record's car part cleared (race_record_clear) and race entry_request = FF. Returns the game mode.
comment game_mode_power_on Game mode 0 (the first frame after start-up): game mode 2 and its first step (game_mode_title).
comment game_mode_restart Game mode 1 (after the ranking, game_mode_ranking, and after the test mode): game mode 2 and its first step (game_mode_title).
comment game_mode_title Game mode 2, the title (title_screen_update), by mode_step: 0 the screen cleared (as clear_screen), the title's palette (title_palette), title_screen_update started, a fade in (fade 1), the input ring's places to 0 (input_write_place, input_read_place), the screen on (C0001C = 6, C8001C = 86 for screen 2); 1 when the fade is over, mode_timer 450 frames (15 seconds); 2 counts them down, then a fade out (fade 0); 3 when it is over, game mode 3 (the car presentation). attract_lamps_update every frame first.
comment game_mode_car_presentation Game mode 3, the presentation of a car (car_presentation_update), by mode_step: 0 the screen cleared (as clear_screen), the palettes of the car's scene (scene_palettes by attract_car_scene_palettes by attract_car) and 031740, car_presentation_object_handlers (credit_display, coin_prompt, car_presentation) started, a fade in; 1 when it is over, mode_timer 180 frames (6 seconds; the staff credits code adds 1200); 2 counts them down, then a fade out; 3 when it is over, link_event 3 and game mode 4 (the demo race). attract_lamps_update every frame first.
comment game_mode_demo_race Game mode 4, the demo race of the attract mode (the car just presented, attract_car, on its stage): attract_lamps_update, then by mode_step demo_race_set_up, demo_race_fade_in, demo_race_start_timer, demo_race_count_down, demo_race_end, and but on the set-up's and the end's frames the race's own steps (game_mode_play by game_step, from step 10).
comment demo_race_set_up Step 0 of the demo race: demo_flags bit 8 (the race's code tells the demo by it: the car drives itself), the screen cleared (as clear_screen), step 1 with mode_timer 0, and game_step 10 (the demo race's set-up in game_mode_play, which does not run this frame).
comment demo_race_fade_in Step 1 of the demo race: after two frames (mode_timer), a fade in and step 2.
comment demo_race_start_timer Step 2 of the demo race: when the fade is over, mode_timer 600 frames (20 seconds) and step 3.
comment demo_race_count_down Step 3 of the demo race: counts mode_timer down, then a fade out and step 4.
comment demo_race_end Step 4 of the demo race: when the fade is over, game mode 5 (the ranking) and the race record's car part cleared (race_record_clear), without the race's step that frame.
comment attract_lamps_update The lamp show of the attract modes (game_mode_title, game_mode_car_presentation, game_mode_demo_race, game_mode_ranking, game_mode_isdn_connection): every 8 video frames (vblank_counter >> 3) the next of 32 steps of the pattern attract_lamp_steps, two bytes a step and screen, into the screen's two lamp entries (byte 0 of checkpoint_lamp and leader_lamp by 4 * index: bits 1 and 3 of the seat's output port D, which the VBLANK writes).
comment game_mode_ranking Game mode 5, the ranking (ranking_update), after the demo race and after a game, by mode_step: 0 demo_flags bit 8 clear, the wheel motor off (wheel_motor by index), the sound off (reset_screen_sound), the screen cleared (as clear_screen), clear_published_car, the ranking's palette (ranking_palette), ranking_objects (credit_display, coin_prompt) and ranking_update started, mode_timer 270 frames (9 seconds), race game_over cleared; 1 waits until no fade runs (ranking_background fades the screen in); 2 counts the 270 frames down; 3 when no fade runs, game mode 1 (back to the title). attract_lamps_update every frame first.
comment game_mode_isdn_connection Game mode 8, on ISDN only (never in the scenarios; take_screen_inputs goes to it while link_status says the line connects, bits 2-3), by mode_step: 0 a fade out (attract_lamps_update in 0 and 1); 1 when it is over, no objects, the sound off, the screen's tilemaps, sprites and text off, palette 031740, the lamps off (checkpoint_lamp, leader_lamp by index), clear_lcd, isdn_status_update started (the list at 000F70); 2 a fade in; 3 when it is over, 4; 4 when link_status says connected (bit 0: isdn_count_players) or no longer connecting (bits 2-3 clear), mode_timer 150 frames; 5 counts them down, then a fade out; 6 when it is over, game mode 2 (the title).
comment isdn_status_update Never runs in the scenarios: the ISDN connection screen's texts (game_mode_isdn_connection starts it from the list at 000F70), on the text layer (print_text_layer), by state: 0 by link_status: bit 0 ISDN SUCCESS, THIS SIDE, OTHER SIDE and TOTAL with the players (race_copy players_this_side, players_other_side and their sum, print_hex_byte), then 1; bits 2-3 clear ISDN FAILED, then 1; else ISDN CONECTING (sic) blinking every 8 frames (its blink_counter counting); 1 nothing more.
comment isdn_count_players Never runs in the scenarios (ISDN only): the players on this side and on the other (race_copy players_this_side, players_other_side) into isdn_players_this_side and isdn_players_other_side, their sum into player_count (the race's players) and half of it into machine_count (its cabinets).
comment game_mode_play Game mode 6, a game (check_game_start starts it at step 0) and the demo's race (game_mode_demo_race, from step 10), by game_step: 0 sound 21 (queue_sound), the screen's two lamps on (button_lamps), lcd_restart_frames cleared (the LCD's timer), a fade out, race game_over cleared; 1 when the fade is over, waits until the screen's player is in the list of the race's players (from byte 1F of the race_copy record of host_player), then the host itself (not on ISDN) writes 1 to the link board's 80000A; 2 the car select: demo_flags bit 8 clear, the wheel motor off (wheel_motor), game_start_time from the backup RAM's seconds (701F10), a game counted on the seat (701F14 + 2 * index, bookkeeping_increment16), C00074 = game_start_c00074_bytes by index, the sound off (reset_screen_sound) unless the entry countdown's music plays (entry_countdown_shown), clear_screen, clear_race_state, palette car_select_palette, in_game, host_record (the host's race_copy record), the stages (screen first_stage-A6) 0, the seat's lamps on (checkpoint_lamp 2, leader_lamp 8), car_select_start started, a fade in, the screen on; 3 the car select (car_select_run goes on to 4); 4 a fade out, entry_countdown_shown cleared, the lamps on; 5 when the fade is over, race ready cleared, silence_and_clear_screen, the screen off (C0001C = 4), the stage's palette (queue_stage_load), the screen's car (player_car_object_handlers: player_car_update, its place from screen 320 + player), step 23; 23 once the car has published its state (race_copy published): race_running, the race's objects (race_object_handlers; the demo's demo_race_object_handlers), 24; 24 and 25 a frame each; 26 step 11, the input ring's places to 0, the screen on; 11 a fade in, step 6; 6 when it is over, 7; 7 the race, until its ending is over (flags bit 1, race_car_start_ending): race_running cleared, a fade out, 8; 8 when it is over, the lamps on, 9; 9 the text and the tilemaps off (clear_text_layer, reset_tile_layers), no objects, step 12; 12 the route map: short of the goal (race_copy finished clear) the sound off, the song title Meaning of the Light (start_song_title with 003504) and sound 0B; palette route_map_palette, route_map_update (route_map_object_handlers), a fade in; 13 when it is over, 14; 14 the map until START (buttons_pressed bit 6) or route_map_update sets 16; 15 (nothing sets it) 16; 16 with a new course record (course_record_beaten) a fade out and 18, else 21; 18 when the fade is over, no objects, name_entry_update started, 19; 19 a fade in, 20; 20 the name entry (name_entry_update sets 21); 21 set_player_ready and 22; 21 and 22 once every player of the race is ready (players_not_ready): a fade out, fade_out_music, 17; 17 when the fade is over, the game's end: the time played (the backup's seconds less game_start_time) added to the seat's total (701F18 + 4 * index) and kept if the longest (701F20) or the shortest (701F22), a game counted at the stage level reached (screen current_stage_level, 6 at the goal: 701F24 + 2 * it), C00074 = game_end_c00074_bytes then game_end_c00074_next_bytes by index, sound 1E, the sound and the tilemaps off, in_game, screen race_started and is_host cleared, the race record's car part cleared (race_record_clear), no objects, race game_over (the screens in the attract modes go to the ranking, race_entries_update), the lamps off, clear_lcd, 28; 28 game mode 5 (the ranking). The demo: 10 silence_and_clear_screen, clear_race_state, the stage and the car model from attract_demo_races by attract_car (the stage into screen first_stage, A1, A3, A5), host_record its own record at screen + 490 (demo_player_count 1, demo_players this screen's player, demo_stage), the model into car model and race model, palette title_palette, then as 27; 27 waits until race_copy published is clear, then as 5.
comment course_record_beaten Whether the screen's player has beaten the course's record (zero clear): when the race was finished (race_copy finished), the course (the goal's stage, screen built_stage, less 15) into record_course, and a record when the player came first (screen 320 + player is 0) in a time (screen 410 + 2 * player) under the course's (course_record_times by course).
comment load_course_records Loads the ten courses' records into course_records (6 bytes each: the car's model, the name's three letters, the time in hundredths) from the backup RAM (701F32); a course without one there (its first byte negative) gets its default from default_course_records (SGA, 5'00"00); the model is kept to its low three bits.
comment silence_and_clear_screen The screen's sound off (reset_screen_sound), then clear_screen.
comment clear_screen Clears what the screen shows: no objects (clear_objects), its tilemaps off in the mixer (reset_tile_layers), no sprites (clear_sprite_group_count, screen sprite_groups) and the text layer cleared (clear_text_layer).
comment clear_race_state Clears the race's state: the race record's car part (race_record_clear), the screen's car block and the 100 bytes after it (300 bytes from player_car), the race's order, places and times (screen + 330, 160 bytes) and the ring of views (screen + 600, 100 bytes).
comment clear_published_car Clears what the screen's car hands on to the race record (player_car_publish's), for the ranking (game_mode_ranking): race published, the next of the ring of eight views (screen view_ring_slot, race view_slot, its address in screen shown_view) with the view's place and angles cleared in it and the car (view_x-z, view_pitch, view_yaw), the wheel effects and hard acceleration (race wheel_effect_sides-53), segment_fraction, segment, road_x, window_segment (race segment_fraction-46), window_offset, segment_remaining, the horizon (screen horizon_line), and the halfword at C8 of current_object (player_car_publish's bounce_height) with race bounce_height; from the ranking current_object is what run_objects left in it, not the car.
comment staff_credits_code_control_bit Sets bit R3 of the controls being read (R1) when the value R2 is E0 or more, or C0 or more when the bit was on in the controls held before (R0): staff_credits_code_read_controls' test for the wheel turned right, the gas and the brake.
comment crc16 Returns the CRC-16 (polynomial 1021) of the R11 bytes at R10, worked out in the top half of a 32-bit register that starts at DEBDEB00, each byte entering its low byte, with eight more shifts after the last. Used for the EEPROM's settings (load_settings, eeprom_write_settings) and the program's signature (signature_checksum).
comment signature_checksum Returns the crc16 of the program's 48-byte signature text at 00010C (OUTRUNNERS EUROPA and its build date, 93.4.21), which the EEPROM keeps in settings_signature so that a new program is noticed (load_settings).
comment load_settings Loads the settings from the EEPROM at start-up (eeprom_read_settings into 20E600-20E67F) and repairs them: a block marked SEGA gets the defaults (0004C0, marked S32A) with eeprom_write_count 100; one without the S32A mark the defaults; with it, a new program (signature_checksum unlike settings_signature) gets the defaults keeping the eeprom_write_count of a sound copy (the settings or their backup, each checked with its crc16); with the same program a bad copy (or a backup unlike the settings) is rewritten from the other, both bad the defaults. Every repair but rewriting a copy also resets the backup RAM's data (bookkeeping_reset); each one saves the result (eeprom_write_settings).
comment count_eeprom_write Counts a save of the settings in eeprom_write_count, up to 10000 (the test mode warns when the EEPROM's limit of 10,000 writes is reached).
comment eeprom_lock Locks the EEPROM against writes (command 00, the 93C46's write disable) and turns the interrupts back on.
comment eeprom_read_settings Reads the EEPROM's 64 words into 20E600-20E67F (settings_magic, settings_signature, the settings from settings_checksum on, their backup from backup_settings_checksum on), with the interrupts off.
comment save_settings Saves the settings into the EEPROM after they changed (the link's, link_take_master_settings; the test mode's, test_mode_exit): eeprom_write_settings_counted, then eeprom_lock.
comment eeprom_write_settings_counted Counts the save (count_eeprom_write) and writes the settings (eeprom_write_settings).
comment eeprom_write_settings Writes the settings into the EEPROM: their checksum (crc16 of the 3A bytes from eeprom_write_count) into settings_checksum, checksum and settings copied over the backup (backup_settings_checksum on), the EEPROM unlocked (command 30, write enable) and its 64 words written from 20E600 (eeprom_write_word). Leaves the interrupts off and the EEPROM unlocked (save_settings locks it).
comment eeprom_read_word Reads the EEPROM word of read command R4 (eeprom_send_command): 18 clock pulses collecting the data out (bit 7 of R12, port F of the second I/O chip), the 16-bit word into R0; then chip select off.
comment eeprom_write_word Writes R0 into the EEPROM word of write command R4 (eeprom_send_command): its 16 bits high first, chip select dropped to start the write, then waits, clocking, until the data out (bit 7 of R12) says it is done.
comment eeprom_send_command Sends command R4 to the EEPROM (a 93C46 on port H of the second I/O chip, R13: bit 7 data in, 6 clock, 5 chip select): chip select, a start bit, then the 8 bits of R4 high first (two of opcode: 2 read, 1 write, 0 with the address's top bits 3 write enable or 0 write disable; six of address), each with a clock pulse.
comment eeprom_begin Starts an EEPROM access: the interrupts off, R13 the EEPROM's lines (C8000E, port H of the second I/O chip), R12 its data out (C8000A, port F, bit 7), R2 the lines' present value.
comment eeprom_set_lines Writes R2 to the EEPROM's lines (R13), with bit 4 set too.
comment eeprom_read_one_word Unused: reads the EEPROM's word R4 (its read command, R4 | 80) into R0 and turns the interrupts back on.
comment reload_settings Unused: reads the settings from the EEPROM again (eeprom_read_settings) and turns the interrupts back on.
comment eeprom_write_one_word Unused: writes R0 into the EEPROM's word R4 (its write command, R4 | 40) without unlocking it first, and turns the interrupts back on.
field screen 40 link_event u8
field screen 45 link_status u8
field screen 46 link_status_set u8
field screen 47 link_status_cleared u8
field screen 48 link_status_changed u8
field screen 80 game_mode u8
field screen 81 mode_step u8
field screen 82 game_step u8
field screen 83 game_mode_spare u8   # the byte after game_step, which the game mode's 32-bit writes clear with it (game_mode_power_on, \"mov.w #2, 80[R25]\"); nothing reads it
field screen 88 mode_timer u16
field screen 90 demo_flags u32
field screen 94 flags u32
field screen 98 game_start_time u32
field screen 9C attract_car u8
field screen 9D record_course u8
field screen E1 start_lamp_blink u8
field screen E2 entry_countdown_shown u8
field screen 100 wheel u8
field screen 101 gas u8
field screen 102 brake u8
field screen 103 controls_spare u8   # the byte after brake, which queue_screen_inputs writes with the controls (always 0); nothing reads it
field screen 108 input_write_place u8
field screen 109 input_read_place u8
field screen 110 buttons u32
field screen 114 previous_buttons u32
field screen 118 buttons_pressed u32
field screen 11C buttons_released u32
field screen 31A in_game u8
field screen 31B race_running u8
field screen 4AF demo_player_count u8
field screen 4B0 demo_players u8
field screen 4F2 demo_stage u8
field race 28 game_over u8
field race 5C ready u8
field race 5F published u8
20E004  var  waiting_task_stack u32
20E023  var  frame_ready u8
20E024  var  single_task u8
20E026  var  game_frame_count u8
20E02B  var  second_task_waiting u8
20E04A  var  isdn_players_this_side u8
20E04B  var  isdn_players_other_side u8
20E100  var  switches u8
20E101  var  previous_switches u8
20E102  var  switches_pressed u8
20E103  var  switches_released u8
20E110  var  analog_raw u8
20E116  var  analog_inputs u8
20E117  var  analog_gas_1 u8
20E118  var  analog_brake_1 u8
20E119  var  analog_wheel_2 u8
20E11A  var  analog_gas_2 u8
20E11B  var  analog_brake_2 u8
20E120  var  seat_1_player u8
20E121  var  seat_1_buttons u8
20E122  var  seat_1_wheel u8
20E123  var  seat_1_gas u8
20E124  var  seat_1_brake u8
20E125  var  seat_2_player u8
20E126  var  seat_2_buttons u8
20E127  var  seat_2_wheel u8
20E128  var  seat_2_gas u8
20E129  var  seat_2_brake u8
20E304  var  course_record_times[28] u16
20E600  var  settings_magic u32
20E604  var  settings_signature u16
20E608  var  settings_checksum u16
20E644  var  backup_settings_checksum u16
20E646  var  backup_eeprom_write_count u16

# ======== the race's logic, the link between cabinets, the draw modes and the LCD (naming batch H) ========
00AB24  func  distance_offset_from_x
00AB36  func  distance_offset_from_z
00AB46  func  distance_offset_at_angle
00B65F  func  wheel_effect_1_none
00B660  func  wheel_effect_1_surface_1_inner
00B66E  func  wheel_effect_1_surface_1_outer
00B67C  func  wheel_effect_1_surface_2_inner
00B68A  func  wheel_effect_1_surface_2_outer
00B698  func  wheel_effect_2_none
00B699  func  wheel_effect_2_surface_1_inner
00B6A7  func  wheel_effect_2_surface_1_outer
00B6B5  func  wheel_effect_2_surface_2_inner
00B6C3  func  wheel_effect_2_surface_2_outer
00D0C8  func  network_check_again
00D13A  func  network_check
00D298  func  network_check_join
00D2BE  func  network_check_isdn
00D2EB  func  link_lost
00D2F0  func  network_check_stand_alone
00D341  func  network_check_result
00D524  func  network_check_board_memory
00D544  func  network_check_memory_test
00D5E0  func  network_check_wait_board
00D612  func  network_check_wait_isdn
00D664  func  network_check_greeting
00D6AD  func  network_check_five_ics
00D6BB  func  network_check_four_ics
00D6C7  func  network_check_show_ics
00D6EC  func  network_check_blink_text
00D716  func  network_check_clear_status_line
00D72D  func  network_check_toggle_memory_text
00D7CB  func  network_check_error
00D884  func  network_check_halt
00D8A5  func  link_take_master_settings
00D9F3  func  race_entries_update
00DB6D  func  race_progress_update
00DDA8  func  entry_invitation_step
00DEC2  func  race_record_clear
00DEF8  func  course_records_update
00E620  func  link_receive_records
00E638  func  link_isdn_receive_records
00E67C  func  link_copy_records_in
00E8DF  func  link_send_records
00EB74  func  draw_object_between_segments
00EC1B  func  draw_object_from_road_edge
00ECCD  func  draw_object_from_road_edge_unshifted
00ED82  func  draw_object_from_road_edge_doubled
00EE37  func  draw_object_at_car_window_segment
00EE75  func  draw_object_at_segment
00EEBF  func  draw_object_at_car_window_segment_on_road
00EEF0  func  draw_object_at_segment_scale
00EEF4  func  draw_object_at_shifted_scale
00EEFF  func  draw_object_at_scale
00EF32  func  draw_object_on_screen
00EF4A  func  put_object_sprites
0186FC  func  lcd_start
# A line of the LCD's text, 16 characters, as the screens keep it (screen lcd_text, four words at a time):
# lcd_start and lcd_reset copy lcd_boot_text into both screens' with
# "movea.b 18B90[PC], R10" (01875F, 01883D) and "mov.d [R10+]"
struct lcd_text_line 10 rom
field lcd_text_line 00 text_0_to_3 u32
field lcd_text_line 04 text_4_to_7 u32
field lcd_text_line 08 text_8_to_11 u32
field lcd_text_line 0C text_12_to_15 u32
018B90  table lcd_boot_text  lcd_text_line   # census ROM 018B90-018B9F ("SEGA Enterprises")
# The rows of the LCD's custom characters, eight a character, as lcd_start sends them after command 40: "movea.b
# 18B4E[PC], R10" (018791), "mov.b [R10+], R0" while not negative; census ROM 018B4E-018B8E (8 characters, the
# DJ's face among them; FF closes them)
elements lcd_character_rows u8
018B4E  table lcd_custom_characters  lcd_character_rows
0187A3  func  lcd_write_character
0187C1  func  lcd_write_data_nibble
0187F0  func  lcd_command_nibble_after_pause
0187F8  func  lcd_write_command_nibble
018827  func  lcd_reset
018863  func  lcd_refresh
0188BE  func  lcd_send_next_nibble
018B21  table lcd_restart_nibbles  u8   # lcd_send_next_nibble "not.b 18B21[PC](R0), R0" (0189A4) by lcd_init_step, from 2C down to 1: the LCDs' start sequence, a nibble each timer interrupt; census ROM 018B22-018B4D (C3 CB 03 0B 23 2B 33 3B 33 3B 33 ... 3B)
0189D9  func  lcd_update
018A70  table lcd_scroll_step_jumps  u32   # lcd_update (018A6E "jmp [R1]") jumps through it by screen lcd_scroll_step: 018A80 018AA5 018AC2 018AD8
018AE8  table dj_face_characters  u16   # lcd_update "mov.h 18AE8[PC](R0), [R10+]" (0189FA; the closed mouth, the first, 018A17) by mouth shape: the two custom characters of the DJ's face into the LCD's text; census ROM 018AE8-018AEF (0201 0403 0605 0403)
# The mouth shapes of a DJ message (screen dj_mouth_shapes, F30: the low 24 bits of its typed_messages
# record): lcd_update "movz.bw [R11+], R0" (0189F3) every third frame, a shape of dj_face_characters each, a
# negative byte closes them
elements dj_mouth_shape_numbers u8
local lcd_update 0189F3 R0 mouth_shape
comment distance_offset_from_x Unused (only distance_offset_functions lists it, for octants 1, 2, 5 and 6 of an angle): the distance along angle R0 that has the x distance from R11's x (+4) to the object's field 20 (that distance / the sine of R0), turned to angle R1 by distance_offset_at_angle. Its C has no body: nothing reads the results (R2, R3).
comment distance_offset_from_z Unused (only distance_offset_functions lists it, for octants 0, 3, 4 and 7 of an angle): the distance along angle R0 that has the z distance from R11's z (+8) to the object's field 28 (that distance / the cosine of R0), turned to angle R1 by distance_offset_at_angle. Its C has no body: nothing reads the results (R2, R3).
comment distance_offset_at_angle Unused (the end of distance_offset_from_x and distance_offset_from_z): R2 / R6 as a length along angle R1, its sine part into R2 and its cosine part into R3. Its C has no body: nothing reads the results.
comment wheel_effect_1_none The wheel at road_x plus the model's half track (handling +1A) is within the bounds of both surface entries: no effect (player_car_road_drag's pick, wheel_effect_1_jumps).
comment wheel_effect_1_surface_1_inner wheel_effect_sides bit 0 and wheel_effect_1 = the effect (+6) of surface_entry_1 past its inner bound (+2): the wheel at road_x plus the half track is past it and no other bound (player_car_road_drag's pick, wheel_effect_1_jumps).
comment wheel_effect_1_surface_1_outer wheel_effect_sides bit 0 and wheel_effect_1 = the effect (+7) of surface_entry_1 past its outer bound (+4), when the wheel at road_x plus the half track is past it and not past the bounds of surface_entry_2.
comment wheel_effect_1_surface_2_inner wheel_effect_sides bit 0 and wheel_effect_1 = the effect (+6) of surface_entry_2 past its inner bound (+2), when the wheel at road_x plus the half track is past it but not past its outer bound.
comment wheel_effect_1_surface_2_outer wheel_effect_sides bit 0 and wheel_effect_1 = the effect (+7) of surface_entry_2 past its outer bound (+4): for the wheel at road_x plus the half track it comes before every other.
comment wheel_effect_2_none The wheel at road_x less the model's half track is within the bounds of both surface entries: no effect (player_car_road_drag's pick, wheel_effect_2_jumps).
comment wheel_effect_2_surface_1_inner wheel_effect_sides bit 1 and wheel_effect_2 = the effect (+6) of surface_entry_1 past its inner bound (+2), when the wheel at road_x less the half track is past it but not past its outer bound.
comment wheel_effect_2_surface_1_outer wheel_effect_sides bit 1 and wheel_effect_2 = the effect (+7) of surface_entry_1 past its outer bound (+4): for the wheel at road_x less the half track it comes before every other.
comment wheel_effect_2_surface_2_inner wheel_effect_sides bit 1 and wheel_effect_2 = the effect (+6) of surface_entry_2 past its inner bound (+2), when the wheel at road_x less the half track passes no bound of surface_entry_1 nor the outer one of surface_entry_2.
comment wheel_effect_2_surface_2_outer wheel_effect_sides bit 1 and wheel_effect_2 = the effect (+7) of surface_entry_2 past its outer bound (+4), when the wheel at road_x less the half track passes no bound of surface_entry_1.
comment network_check_again The network check after the test mode: network_check, or in ISDN mode (isdn_mode) the link board off for a moment, the link's variables (from machine_count), the board's memory at 800004 and 800600, this machine's two race records and all the players' records cleared, then network_check_isdn.
comment network_check The network check at boot: the link board off (801000), the link's variables, the board's first bytes and all the race records cleared; with the STAND-ALONE setting (stand_alone into link_off) only network_check_stand_alone. Else it shows NETWORK CHECK (MASTER, SLAVE or ISDN) and BOARD CHECK, tests the board's memory (network_check_board_memory), writes its greeting V70 and turns the board on, waits for it (network_check_wait_board), checks the board's answer Z80 (network_check_greeting), waits again, shows the board's self-test (network_check_four_ics); in ISDN mode goes on to network_check_isdn; else gives the board this machine's role (link_master at 800004), waits, shows the self-test again (network_check_five_ics), waits for the board's flag (801002 bit 7) with CHECK NETWORK STATUS blinking, gives it this machine's number (800002 to 800E20) and FF at 800006, shows CHECK TRANS END until the board's 800008 is set (link_lost if 80000C is), and goes on to network_check_join. The test button (test_mode_on) gives it up at any wait (link_failed FF).
comment network_check_join Takes the link from the board: machine_count from its byte at 800000, player_count twice it, this machine's number from 800002, the board's flag 801002 set; with no machine on the link (and not in ISDN mode) network_check_stand_alone; else the two screens' car numbers from the cabinet ID (cabinet_id * 2 and + 1, into screen car_number and race car_number), then network_check_result with this machine's number.
comment network_check_isdn The network check's ISDN mode: the link board off for a moment, 1 into its byte at 800014 (0 in network mode), its flag clear, the board on, network_check_wait_isdn, then network_check_join.
comment link_lost The link has failed (the board's error byte 80000C, seen by network_check, link_receive_records or link_send_records): link_failed 1, then network_check_stand_alone (which shows COMMUNICATION FAILED. for 128 frames).
comment network_check_stand_alone Sets the machine up alone: link_off, one machine and two players (machine_count, player_count), car numbers 0 and 1 for the two screens (screen and race car_number), then network_check_result as machine 1.
comment network_check_result Sets up the machine's two players from its number R0 (1-4): both race records' machine, their players ((R0 - 1) * 2 and + 1, also screen player), the screens' race_copy (race_copy_offsets by player: 20FC00 + 80 each) and race (20FB00, 20FB80); machine 1 also puts its settings (advertise_sound, steering_wheel_reaction, coins_per_credit, first_chute_multiplier, bonus_adder, coin_setting, free_play, game_difficulty, time_difficulty[0-5]) at 03-10 of its first record (the master_ fields; second_chute_multiplier is not sent) and its course records (the backup's, 701F32) at 30. Then NETWORK CHECK and the result for 128 frames: COMMUNICATION FAILED. (link_failed), THIS MACHINE IS ISDN MODE., THIS MACHINE IS STAND-ALONE., or SLAVE / MASTER CONTROLLER (the board's 800004) with COMMUNICATION SUCCESS. and THIS MACHINE ID IS n (the board's 800002); the text cleared.
comment network_check_board_memory Tests the link board's memory (network_check_memory_test over 7FF of its bytes); on a fault the screens off, CONNECTION ERROR and network_check_error.
comment network_check_memory_test A memory test: eight passes (seed 01, 02, ... 80), each writing a pattern from the seed into R1 bytes (one a halfword) from R10, reading them back and gathering the bits that differ into R0's low byte (0: no fault); CHECK DUALPORT RAM flips on the status line after each pass (network_check_toggle_memory_text).
comment network_check_wait_board Waits for the link board's flag (801002 bit 7), WAIT blinking, for up to E10 frames (two minutes, link_wait_frames): then the screens off, COMMUNICATION TIME OUT and network_check_error; the test button gives the check up (link_failed FF); the status line cleared after.
comment network_check_wait_isdn ISDN mode: waits, WAIT blinking, until the link board's byte 800000 (its machine count) is set, then 60 frames more (link_wait_frames); the test button gives the check up (link_failed FF); the status line cleared after.
comment network_check_greeting Checks the greetings on the link board: V70 (this program's, at 800000) and Z80 (the board's answer, at 800010); otherwise the screens off, CONNECTION ERROR and network_check_error.
comment network_check_five_ics The link board's self-test (its byte 80000C), the second time: clear, IC17, IC23, IC11, IC10 and IC9 GOOD (network_check_show_ics); else the screens off, COMMUNICATION BOARD ERROR and network_check_four_ics, which, the byte still set, shows four of the ICs and halts there (the five after it only show if the byte clears meanwhile), then network_check_halt.
comment network_check_four_ics The link board's self-test (its byte 80000C), the first time: clear, IC17, IC23, IC11 and IC10 GOOD (network_check_show_ics); else the screens off, COMMUNICATION BOARD ERROR with each of the four GOOD or BAD, the screens on, and network_check_halt.
comment network_check_show_ics Shows R0 of the link board's ICs (IC17, IC23, IC11, IC10, IC9), each GOOD or BAD by its bit in R2 (link_board_ic_texts).
comment network_check_blink_text Blinks a text record (at current_object: its cell, attribute and characters) by flipping it into the text layer every 16th call (network_check_blink_counter): WAIT, CHECK NETWORK STATUS, NETWORK ERROR.
comment network_check_clear_status_line Clears row 24 of the text layer, where the network check's waits blink their texts.
comment network_check_toggle_memory_text Flips CHECK DUALPORT RAM on or off on the status line (row 24), once each pass of network_check_memory_test.
comment network_check_error Shows the error R19 (a text list: CONNECTION ERROR, COMMUNICATION TIME OUT...) on a cleared text layer with the screens on, then halts like network_check_halt.
comment network_check_halt Blinks NETWORK ERROR until the test button (test_mode_on) is pressed; then link_failed FF and the network check is given up (it returns past its caller).
comment link_take_master_settings After the network check (unless the test button is down): sends and receives the race records (link_send_records, 5 frames, link_receive_records; in ISDN mode once the board's 8006E1 is set, link_isdn_receive_records), keeps each player's car number (race car_number into car_numbers), takes the first player's (the master's) course records into the backup (701F32 with its checksum, 011418, and the copy at 701FAE) and into course_records (001D84), and adopts its settings (record +03-10 into advertise_sound, steering_wheel_reaction, coins_per_credit, first_chute_multiplier, bonus_adder, coin_setting, free_play, game_difficulty, time_difficulty[0-5]; second_chute_multiplier is not taken; 011018 and 01139E when any of the coin settings changes, all saved by 00036B when any changes).
comment race_entries_update The entries to a race, each frame. Player 0's screen keeps them in its record: once every entry is taken (it means to wait for each record's entry_serial_seen, but compares player 0's own each time), a player's entry_request not yet accepted (accepted_players) is accepted: entrant = that player, entry_serial + 1, and the first one starts entry_frames at 600 (entry_frames_by_machines), cut to 40 once every player is in; entry_frames counting down to 0 closes the entries (entrant FF, entry_serial + 1, accepted_players cleared, 1 to the link board's 80000A). Every screen: when some player's race is over (race game_over) an idle screen (game steps 1-5) goes to step 5 (cleared_on_race_over cleared), and while player 0's entry_frames runs to step 7 (entry_invitation_step); each new entry_serial of player 0's record (entry_serial_seen) adds its entrant to the screen's entrants (entrant_count), or the close clears them (and entry_accepted); the screen's own player accepted: its entry_request cleared, entry_accepted, the first entrant into host_player and is_host when that is itself; the host keeps racer_count and race_order in its record from the entrants.
comment race_progress_update The race's progress, each frame of a race (screen in_game). The host (is_host) runs it in its record: once every racer has taken the last pass (pass_seen = pass_count), a racer whose stage_count changed (against counted_stages) has passed a checkpoint (stage_count - 1): pass_player, pass_checkpoint, pass_order (counted_passes), pass_branch (the side of the road it was on: race road_x bit 15), pass_time (race_time in hundredths plus the order), pass_count + 1; the first to pass a checkpoint before the goal adds the time of the stage its branch leads to (stage_start_times by fork_next_stages[stage * 2 + branch]) plus the setting for that checkpoint (master_time_difficulty) to time_left. Once the race has started (race_started) race_time + 34 and time_left - 1 a frame, and one pass of sorting race_order: the finished (race finished) first by finish_time, then by distance (race segment_fraction-43). Every screen from the host's record (host_record): the leader's segment and stage (leader_window_segment, leader_stage), each player's place (places, its own in place); each new pass: pass_seen (screen and race), checkpoints_passed, checkpoint_passes, the order and the time by player and by order (checkpoint_orders, checkpoint_order, checkpoint_times_by_player, checkpoint_times); the first car past a fork decides the route: forks_decided + 1, its branch in route_branches and the stage it leads to in route_stages.
comment entry_invitation_step Game step 7, an idle seat while another one's game takes entries (race_entries_update sends it here), by screen game_mode's byte 2: 0 screen fade_kind = 0 and flags bit 0; 1 once that bit has cleared: the seat's sound channel (012004), the screen's objects (011C60), layers (01070C), sprite count (010889) and text layer (01076A) set afresh, its race record's race part cleared (race_record_clear), not the demo (demo_flags bit 8), the wheel motor off (wheel_motor), both of the seat's lamps blinking (bytes C0-C3 and C8-CB of its entry at checkpoint_lamp); 2 starts entry_invitation_object_handlers (entry_countdown_start, credit_display_update, coin_prompt_update): the invitation to join with the entry time left; 3 the seat's screen on (its I/O chip's CNT, 6 or 86), fade_kind = 1, flags bit 0; 4 once player 0's entry_frames is over: the sound channel again (012004), step 2, the lamps off, the LCD cleared (clear_lcd).
comment race_record_clear Clears bytes 30-7F of the screen's race record (the race's part: the car's published state, the checkpoint passes, the times), from the zeros at 100800.
comment course_records_update Takes the players' new course records, each frame: when a player's record_serial changes (against name_entries_seen), its time (finish_time) on its course (record_course) at or under the course's record (course_records, 6 bytes a course: model, the three letters of the name, the time) replaces it with its record_model and record_name (the first letter) and record_name_rest (the other two), also in the two copies in the backup (701F32 with its checksum, 011418, and 701FAE).
comment link_receive_records Takes the race records of all the players into 20FC00 (80 bytes each, by player), each frame: alone (link_off, link_failed) this machine's own two (20FB00, 20FB80); in ISDN mode the eight from 21E000; on the link the eight from the link board (link_copy_records_in from 800020, or 800720 when its byte 80000E is set), or link_lost when its error byte 80000C is set.
comment link_isdn_receive_records ISDN mode: copies the eight race records from the link board (800600) to 21E000, where link_receive_records takes them; the link interrupt (int_vector_44) does it on the board's command 3.
comment link_copy_records_in Copies R1 race records from the link board's memory at R10 (a byte in each halfword) to R11: their first 70 bytes, 80 apart.
comment link_send_records Sends this machine's two race records to the link board, each frame (not in ISDN mode, nor alone): their first 70 bytes to 800E20 and 800F00 (a byte in each halfword), then FF to its byte 800006; link_lost when its error byte 80000C is set. link_wait_frames from link_wait_frames_start (which nothing sets).
comment draw_object_between_segments Draw mode 2: the object between the road's segment at its position (field 1C, counted from the view drawn: race_copy window_segment) and the next, by the fraction in field 28 (80ths), offset across and up by fields 20 and 24 scaled by each segment's scale (draw_object_at_scale). Its size, meant as the two segments' scales by the fraction, multiplies them by the second point's offsets instead (R4 and R5 used twice): a slip in the game's code; nothing in the scenarios draws with it.
comment draw_object_from_road_edge Draw mode 5: the object on the road's surface between its segment (field 1C) and the next by the fraction in field 28, across at field 20 from the road's edge on side field 3F (the segment's half width times the side), its size the two segments' scales by the fraction shifted by scale_shift (draw_object_at_shifted_scale).
comment draw_object_from_road_edge_unshifted Draw mode 7: as draw_object_from_road_edge, at the size of scale_shift 0 whatever the object's.
comment draw_object_from_road_edge_doubled Draw mode B (the traffic cars'): as draw_object_from_road_edge, at twice the size of draw_object_from_road_edge_unshifted (scale_shift 1) whatever the object's.
comment draw_object_at_car_window_segment Draw mode 4: as draw_object_at_segment, but the segment counted from the screen car's own window_segment instead of the view drawn (race_copy window_segment).
comment draw_object_at_segment Draw mode 9: the object at the road's segment of its position (field 1C, counted from the view drawn: race_copy window_segment), offset across and up by fields 20 and 24 scaled by the segment's scale, its size that scale shifted by scale_shift; not drawn when the segment is behind or not projected.
comment draw_object_at_car_window_segment_on_road Draw mode 3: as draw_object_at_car_window_segment, on the road's surface (no up offset).
comment draw_object_at_segment_scale Draws the object at R0, R1 at the projected segment R11's own scale (draw_object_at_shifted_scale).
comment draw_object_at_shifted_scale Draws the object at R0, R1 at the scale R2 shifted by its scale_shift (and >> 4) (draw_object_at_scale).
comment draw_object_at_scale Places a road object projected at R0, R1 with size R2 (both scales): x and y; off the screen (x beyond 1A0 or -1A0, y beyond 80 or -160) back to draw_object's caller undrawn; the depth_layer of the projected segment R11 (+8), then put_object_sprites.
comment draw_object_on_screen Draw mode 0: the object at x, y on the screen, less the screen's scroll (screen sprite_origin_x, sprite_origin_y), at its width_scale and height_scale (put_object_sprites).
comment put_object_sprites Writes the object's frame (animation, frame) into the screen's sprite list at R10 and its copy at + 3000, a sprite of 8 halfwords for each piece: its word flipped by flags bits 6-7, its size from 0x122B74 by size_step scaled by R2 (height) and R3 (width), placed at R0, R1 plus its offsets scaled the same way (signs flipped by the flags: sprite_flip_x_signs, sprite_flip_y_signs), its palette word from sprite_palettes by palette; R10 past them.
comment lcd_start Starts the cabinets' LCDs at boot (both, through port G of the two I/O chips): the 4-bit start (command nibbles 3, 3, 3, 2), display on (0C), SEGA Enterprises as both screens' text (lcd_text), command 40 then the eight custom characters (lcd_custom_characters: the DJ's face among them); the screens' lamps off (screen button_lamps), lcd_restart_frames E10.
comment lcd_write_character Writes the data byte R0 to both LCDs, its high nibble then its low one (lcd_write_data_nibble), with pauses.
comment lcd_write_data_nibble Writes the high nibble of R0 to both LCDs as data (port G of the two I/O chips, inverted: the data lines, register select set, then the enable strobe bit 3 dropped).
comment lcd_command_nibble_after_pause A pause, then lcd_write_command_nibble.
comment lcd_write_command_nibble Writes the high nibble of R0 to both LCDs as a command (register select clear), then drops the enable strobe (bit 3).
comment lcd_reset After the test mode: both screens' LCD text back to SEGA Enterprises (lcd_text), their lamps off (screen button_lamps), and lcd_restart_frames 0 so that the next VBLANK starts the LCDs again.
comment lcd_refresh Each VBLANK: counts lcd_restart_frames down and, when it runs out, has the LCDs started again (lcd_init_step 2C, E10 VBLANKs to the next, a minute); else, unless a nibble is being written (lcd_busy), after a byte cut in half (an odd lcd_send_step) writes one more command nibble (0 or 4) to keep the LCDs in step, takes both screens' lcd_text into lcd_send_buffer_1 and lcd_send_buffer_2 and starts sending them (lcd_send_step 0).
comment lcd_send_next_nibble One nibble to the LCDs each timer interrupt (int_vector_43), with the other bits of port G (port_g_outputs, the lamps): while lcd_init_step counts, the start sequence (lcd_restart_nibbles, from the end), then idle (lcd_send_step 22); else by lcd_send_step: the cursor home command (80), then the 16 characters of lcd_send_buffer_1 to screen 1's LCD and of lcd_send_buffer_2 to screen 2's, a nibble at a time; lcd_busy while it writes the port.
comment lcd_update The screen's LCD, each frame. With the DJ's face on (dj_face) its first two characters are the face, its mouth the next shape of dj_mouth_shapes every third frame (dj_mouth_frames; dj_face_characters, pairs of custom characters), closed when the string ends (a negative byte); the rest of the line (all 16 without the face) scrolls a text: a new lcd_scroll_request clears the line and starts lcd_scroll, which shifts the text in from the right a character every 5 frames (lcd_scroll_frames; ` shows custom character 7), then shifts spaces in until the text has gone (lcd_scroll_step 0-3).
field screen 01 player u8
field screen 02 car_number u8
field screen 300 accepted_players u8[8]   # a byte a player: race_entries_update 00DA6F "test.b [R14](R3)", 00DA83 "not.b #0, [R14](R3)" (R14 = 300[R25]); cleared as two words (and last_four_accepted_players)
field screen 308 host_record u32 race
field screen 30C host_player u8
field screen 30F entrant_count u8
field screen 310 entrants u8[8]   # the players entered in the race, entrant_count of them: race_entries_update 00DB2A "mov.b R0, [R13](R1)" (R13 = 30F, R1 the count after it)
field screen 318 is_host u8
field screen 319 entry_accepted u8
field screen 31C race_started u8
field screen 31F place u8
field screen 320 places u8[8]
field screen 328 name_entries_seen u8
field screen 330 counted_stages u8[8]   # a byte a racer, its stage_count as last counted: race_progress_update 00DBCB "cmp.b 60[R15], [R14](R2)", 00DBDB "mov.b R3, [R14](R2)" (R14 = 330[R25])
field screen 338 counted_passes u8[6]   # a byte a checkpoint (0-4 the forks, 5 the goal): race_progress_update 00DBE9 "movz.bw 338[R25](R3), R4", 00DBEF "inc.b 338[R25](R3)"
field screen 342 pass_seen u8
field screen 344 route_stages u8[5]   # a byte a fork (not the goal, checkpoint 5): race_progress_update 00DD9B "mov.b E5D3[PC](R0), 344[R25](R1)"
field screen 349 forks_decided u8
field screen 34A route_branches u8[6]   # a byte a fork (not the goal, checkpoint 5): race_progress_update 00DD80 "mov.b R3, 34A[R25](R1)"; route_map reads one before it as 349 + forks_reached (forks_decided)
field screen 350 leader_window_segment u16
field screen 352 leader_stage u8
field screen 35A checkpoint_passes u8[6]   # a byte a checkpoint: race_progress_update 00DD43 "inc.b 35A[R25](R1)"
field screen 360 checkpoint_orders u8[30]
field screen 390 checkpoint_order u8[30]   # by checkpoint (8 each), then the order the cars passed it in: the player
field screen 480 checkpoints_passed u8[8]   # a byte a player: race_progress_update 00DD3E "inc.b 480[R25](R0)"
field screen 3C0 checkpoint_times_by_player u16[30]   # by checkpoint (8 players each), then player: lap_timer_update, checkpoint_board_update; checkpoint 5's are the finish times (410 + 2 * player: goal_update, player_car_update)
field screen 420 checkpoint_times u16[30]   # by checkpoint (8 each), then the order the cars passed it in
field screen F10 lcd_text u8[10]   # the 16 characters of the LCD's line (lcd_start, lcd_reset copy them in four words)
field screen F30 dj_mouth_shapes u32 dj_mouth_shape_numbers
field screen F34 dj_mouth_frames u8
field screen F35 dj_face u8
field screen F40 lcd_scroll_request u32
field screen F44 lcd_scroll u32 text_characters   # the text lcd_update scrolls in (a ROM text, closed by 0), then the spaces still to shift in after it
field screen F48 lcd_scroll_step u8
field screen F49 lcd_scroll_frames u8
field race 00 machine u8
field race 01 player u8
field race 02 car_number u8
field race 11 record_serial u8
field race 12 record_model u8
field race 13 record_name u8
field race 16 finish_time u16
field race 18 record_course u8
field race 19 entry_request u8
field race 1A entry_frames u16
field race 1C entry_serial_seen u8
field race 1D entry_serial u8
field race 1E entrant u8
field race 1F racer_count u8
field race 20 race_order u8
field race 60 stage_count u8
field race 61 pass_seen u8
field race 62 stage u8
field race 63 pass_count u8
field race 64 pass_player u8
field race 65 pass_checkpoint u8
field race 66 pass_order u8
field race 67 pass_branch u8
field race 68 pass_time u16
field race 6A time_left u16
field race 6C race_time u32
20E030  var  car_numbers[8] u8
20E040  var  machine_count u8
20E041  var  player_count u8
20E042  var  link_off u8
20E043  var  link_failed u8
20E046  var  link_wait_frames u16
20E048  var  network_check_blink_counter u16
20E300  var  course_records[60] u8
20E3C0  var  lcd_send_buffer_1[16] u8
20E3D0  var  lcd_send_buffer_2[16] u8
20E3F0  var  lcd_restart_frames u16
20E3F2  var  lcd_send_step u8
20E3F3  var  lcd_busy u8
20E3F4  var  lcd_init_step u8

# ======== the sprite lists, the boot of the video, unpacking, fades, coins, bookkeeping and sound (naming batch I) ========
00F04E  func  draw_object_one_piece
00F104  func  draw_object_entry
00F126  func  draw_object_command
00F15C  func  draw_object_smoothed
00F396  func  finish_sprite_list
010243  func  note_road_crest
010634  func  init_screen
010688  func  clear_screen_ram
0106AF  func  init_video
01070C  func  reset_tile_layers
010741  func  clear_video_ram
01076A  func  clear_text_layer
0107BC  func  init_sprite_chip
0107F0  func  init_sprite_lists
010889  func  clear_sprite_group_count
010890  func  init_mixer
0108EA  func  init_io_chips
010936  func  load_sprite_ram_tables
010DC4  func  unpack
010E42  func  unpack_queued_step
010FA1  func  unpack_tile_pages
011018  func  init_coins
01106C  func  update_coins
0111CB  func  pulse_coin_meter
011213  func  write_bookkeeping_credits
01122C  func  add_service_credit
011252  func  insert_coin
0112D9  func  show_title_on_credit
0112F0  func  bookkeeping_increment16
011324  func  bookkeeping_add16
011341  func  bookkeeping_add32
01137D  func  bookkeeping_set16
01139E  func  bookkeeping_clear_credits
0113C0  func  bookkeeping_check
0113E5  func  bookkeeping_reset
01140E  func  bookkeeping_copy
011418  func  bookkeeping_update_checksum
01143E  func  bookkeeping_checksum
011594  func  upload_boot_palettes
01167E  func  step_screen_fade
0117E4  func  load_text_font
011868  func  print_text_layer_list
011874  func  print_text_layer
01190C  func  print_hex_byte
01192B  func  print_hex_digits
011A72  func  draw_text_sprites
011C60  func  clear_objects
011E88  func  start_sound_program
011FE6  func  fade_out_music
011FEA  func  fade_out_music_at
012004  func  reset_screen_sound
comment draw_object_one_piece Draw mode 8: the first piece of the animation's frame at its own size (no zoom, no flip), at x, y on the screen (less sprite_origin_x, sprite_origin_y), with the first word of its palette (sprite_palettes), into the sprite list and its halfway copy alike.
comment draw_object_entry Draw mode 1: copies a ready 16-byte sprite entry, from the address in entry (where the other objects keep animation and palette), into the sprite list and its halfway copy, with the screen's bit in its fourth word (sprite_screen_bit). Not run in the scenarios.
comment draw_object_command Draw mode 6: copies a ready 16-byte entry from the address in entry into the sprite list and its halfway copy as it is, without the screen's bit: for list commands such as crest_clip_update's clip.
comment draw_object_smoothed Draw mode A: every piece of the animation's frame at x, y on the screen (less sprite_origin_x, sprite_origin_y), zoomed by width_scale and height_scale, flipped by flags bits 6-7 (with bit 7 the pieces' offsets are negated, smoothed_flip_signs), each with its palette word; the halfway copy (+3000) is drawn from the averages of this frame's x, y, width_scale and height_scale and the last frame's, kept in the ring of sprite places (next_sprite_place, 16 bytes a record; the object's field 50 points at its record) when flags bit 5 says it was drawn the frame before. Keeps this frame's values in a new record and sets flags bit 5.
comment finish_sprite_list Finishes the screen's sprite list in the vertical blank (int_vector_40): picks a record of sprite_list_switches by the screen (index) and sprite_list_buffers; when groups were drawn (sprite_groups), chains the depth lists from layer 0 to 415 (depth_lists: the list's start entry jumps to the first layer's newest group, each layer's tail to the next layer's head; the heads cleared), in the list and its halfway copy, and ends the chain with the record's word (a jump on to sprite entry 3, screen 2's list, after screen 1's; entry 4, the end, after screen 2's); points sprite RAM entries 2 and 3 (the jumps to each screen's list) at the halfway copy of the list just finished and at the other screen's finished list; then the next buffer (sprite_list_buffers, sprite_list_last, sprite_list_limit) and sprite_groups 0.
comment init_sprite_chip Sets up the sprite chip at boot: its control registers 500000-50000C from 010B0A-010B0F (rendering every frame), the buffer's flip bits inverted when the screen is flipped (flip_screen), then init_sprite_lists.
comment init_sprite_lists Sets up the sprite lists: sprite RAM entries 0-4 (0 clips to the whole screen, 1 sets the offset sprites can add, x A0 y DE (sprite_origin_x, sprite_origin_y), and jumps to 2; 2 and 3, the jumps to screen 1's and screen 2's lists, and 4 an end), an end at the start of the eight list buffers (404000, 40A000, 414000, 41A000 and their halfway copies 3000 on), each screen's list at its first buffer (sprite_list_last 404000 and 414000, sprite_list_buffers 0), its ring of sprite places at 20C000 and 21C000 (next_sprite_place), sprite_groups 0, and sprite_lists_set_up = 1 (nothing reads it).
comment clear_sprite_group_count Sets the count of sprite groups drawn this frame (sprite_groups) to 0: unless something is drawn after it, the vertical blank (finish_sprite_list) ends the screen's list at its start, without sprites. Used as the game modes start.
comment draw_text_sprites Writes a sprite per character of the string at R18 (closed by 0) into the sprite list and its halfway copy alike: words 0-3 from R1 and R2 (an 8x8 piece, with the screen's bit), the place R3 (y, x; x 8 more each character), the graphics R4 + 8 * the character, the attribute R5; then links them into depth layer 19E (screen 5678, drawn after nearly all the others) and counts them (sprite_groups). Returns the address after the string. The end of draw_text and draw_text_at.
comment load_sprite_ram_tables Copies data into sprite RAM outside the lists at boot: 1E0 bytes from 12297C to 410000, 2400 bytes from 107020 to 401000, and twelve tables of sixteen halfwords from 010C44 to 403400 (laid out as the indirect colour tables sprites can take from sprite RAM).
comment note_road_crest Notes a crest of the road while player_car_project_road projects it, for crest_clip_update: when it is the first, or higher on the screen (R27) than the last one noted, crest_count goes up, its depth layer R28 goes into crest_layers (at the old count, with 3 in the next place) and its height into crest_heights (at the new count; entry 0 is the bottom of the screen).
comment init_screen Sets up the constants of the screen's block at boot: index (0 for the block at 208000, 1 at 218000) and by it (screen_hardware_records) sprite_screen_bit, palette_ram, mixer and io_chip; eye_distance, draw_distance (the second of the draw distances at 010BE2), sprite_origin_x, sprite_origin_y and view_pitch_base from 010BCC (010BC8 holds the draw distances' address); and stage_lengths: for each of the 31 roads of stage_courses (the courses player_car_start_course starts by screen first_stage) the sum of its sections' lengths (the first halfword of each 6-byte record; the negative ones are commands: -1 goes on at the address it holds, -4 is 4 bytes long, -2 and -6 end it), and branch_road_length (14A) after them.
comment clear_screen_ram Clears the screen's work RAM at boot: E000 bytes from 8000 below its block (the objects and their lists) to 6000 into it.
comment init_mixer Sets the screen's mixer (registers 00-4E at mixer) and its two copies in the screen's block (mixer_values, mixer_defaults) to the defaults at 010AB6, with the other screen's two tile layers turned off (010B06: NBG1 and NBG3 on screen 1, NBG0 and NBG2 on screen 2; the two screens share video RAM, each showing two of the four layers).
comment init_io_chips Sets up the two I/O chips at boot: ports D, G and H outputs and cleared (the coin meters, lamps, LCD, the tile bank and the EEPROM's lines), each chip's screen on and the sound CPU out of reset (CNT 6 and 86), and the first bank of the wheels' and pedals' A/D inputs (C00060).
comment upload_boot_palettes Uploads three blocks of colours straight into the screen's palette RAM at boot (upload_palette): 256 colours at 9E00 (03153C), 16 at 9C00 (031740) and 2560 at 8000 (153904).
comment init_video Sets up video RAM: cleared (clear_video_ram), the text font (load_text_font), the video control register 31FF00 (0800; 0A00 flipped, flip_screen) and the registers 31FF02-31FF8F from 010B12, with their copy at video_registers, the four tile layers' scroll targets (scroll_targets-20E2AF) cleared, then reset_tile_layers.
comment reset_tile_layers Puts the screen's two tile layers (NBG0 and NBG2 for screen 1, NBG1 and NBG3 for screen 2) back at page 0 and scroll 0: their page selects (video_registers[32], video_registers[36]) and scroll targets (scroll_targets, scroll_targets[8]) cleared, and bits 12-15 of the video control register (31FF00, video_registers) cleared. Used as the game modes start.
comment clear_video_ram Clears video RAM below its registers (300000-31FEFF): the tilemap pages, the text layer and its font, the bitmap and the line tables.
comment clear_text_layer Clears the text layer's first 30 rows (64 cells each, 31F000-31FEFF).
comment load_text_font Copies the text layer's characters (3000 bytes, 384 characters of 8x8 pixels) from 104020 into video RAM at 318000.
comment print_text_layer Writes a string on the text layer: from the record R19, the cell's address (310000 + its first halfword), an attribute byte (the cells' high byte: palette) and the characters, closed by 0; returns the address after it.
comment print_hex_byte Never runs in the scenarios (ISDN only): writes a number's low byte as two hex digits on the text layer, ending before the cell it is given, with the attribute byte it is given (print_hex_digits).
comment print_hex_digits Writes a number in hex on the text layer, in as many cells as it is told, ending before the cell it is given, the lowest digit last: each digit a character ('0'-'9', 'A'-'F') with the attribute byte it is given; when the number runs out, the cells left before it are cleared (0). Only print_hex_byte runs it; the entries for four, six and eight digits before it (print_hex_halfword, print_hex_24_bits, print_hex_word) are unused.
comment print_text_layer_list Writes the strings of the list R19 on the text layer (print_text_layer each) until an FFFF halfword. Not run in the scenarios.
comment unpack Unpacks the packed data at R10 into R11: flag bits read the highest first, 8 to a byte as needed; 1 copies a byte; 01 takes a halfword (an offset back of its value >> 3, -1 to -8192, and a length of its low three bits + 2, or when they are 0 the next byte + 1; a 0 byte ends the data); 00 takes two bits more (a length of 2-5) and a byte (an offset back of -1 to -256); a length copies that many bytes from that far back in what has been unpacked.
comment unpack_queued_step Unpacks a little of the screen's queued tile pages (queue_tile_pages), from the frame loop's wait while unpack_state says there is work: with none under way, takes the next request of the ring unpack_queue (unpack_read_place; unpack_state 0 when it is empty); else goes on where it stopped, by unpack_state's second byte: FF one byte of a match (unpack_copy_source, unpack_copy_count), 1 one step of unpack's format (unpack_flags, unpack_flags_left, unpack_source, unpack_destination): a byte, or a match's first byte.
comment unpack_tile_pages Unpacks a list of tilemap pages into video RAM at once (unpack): each 32-bit entry a page number in its top byte (the page at 300000 + 400 * page) and the address of its packed data below, closed by a negative entry; the list format of queue_tile_pages.
comment step_screen_fade Steps the screen's fade while the screen's flags bit 0 is set (vblank_update_mixer, every other vertical blank): a fade asked for by fade_kind (0 to black, 1 from black, 2 to white, 3 from white, 4 to a red tint, 5 back from it; records at 01173A) sets fade_level, fade_step, fade_end and fade_channels and fade_kind 6 (under way); then each time the level moves a step (6 bits: 20 is -32, black; 1F is +31, white) and goes into the mixer's colour offset 0 in mixer_values (registers 40-44: red, green, blue, those fade_channels has; register 3E's high byte C0), which vblank_update_mixer copies to the mixer; flags bit 0 is cleared when the level reaches fade_end.
comment clear_objects Ends all of the screen's objects at once: every slot free (screen - 7FF0), both object lists empty (this frame's at - 7E00, the next one's at - 7D00, with run_objects' pointers to them at - 8000, - 7FFC, - 7FF4 and - 7FF8), and the queue of palette uploads (palette_upload_count) emptied. At boot and as each game mode starts.
comment start_sound_program Starts the sound at boot: the screen's ring of sound requests with one request of sound 0 waiting (800 the place read, 801 the place written, the requests from 802), I/O chip 0's CNT 6 (its screen on, the sound CPU out of reset), screen byte 822 cleared, and 701FFF cleared, which lets the sound program's main loop run.
comment fade_out_music Fades out the screen's music with 20 (fade_out_music_at): a step every 4 x (20 + 1) of the sound program's ticks.
comment fade_out_music_at Fades out the screen's music: R0 into byte 18 of the screen's first track in the shared sound RAM (700918 for screen 1, 701118 for screen 2; music_fade_addresses), which has the sound program lower the music's volume, from its last CC 10, by one every 4 x (R0 + 1) of its ticks; at 0 it stops the music's player and its MultiPCM voices (CC 50 7E). 20 from fade_out_music, 3F and 7F from car_radio_update, 7F from goal_update.
comment reset_screen_sound Sends sound command 1F straight to the screen's request byte in the shared sound RAM (700700 + 100 * screen, without going through the ring of requests) and mutes the car's engine (710 = 0, 712 bit 5, as set_tyre_noise does in the silent demo). As the game modes start. Command 1F plays song 03, then FF: song 03 sends CC 50 7F on channel E, which stops every MultiPCM voice of the screen, and FF clears the screen's eight sequence players (music and effects); FM notes go on.
comment update_coins The coins and service credits, in the vertical blank unless on free play (free_play): queues each seat's pending coin sound (4E, seat1_coin_sounds, seat2_coin_sounds) and service sound (50, seat1_service_sounds, seat2_service_sounds), one each vertical blank; SERVICE newly pressed (switches_pressed bits 0-1) gives that seat a credit (add_service_credit), counted in the bookkeeping's service credits (701F04); a coin chute let go (switches_released bits 2-3 seat 1's two chutes, 4-5 seat 2's) counts its coin (insert_coin, entries at 0114D4) and the credits it gives in the bookkeeping (701F02); then drives the coin meters (pulse_coin_meter: each seat's first, and its second unless the chutes are shared, chute_entry_offset).
comment pulse_coin_meter Drives coin meter R1 (its bit in the port D outputs at R12, port_d_outputs: bit 0 a seat's first chute's meter, bit 1 its second's) from its record R7 in coin_meters (frames on, frames off, pulses owed): when idle with a pulse owed, the bit goes on for 6 vertical blanks and off for 6. Then writes the credits into the bookkeeping and its backup (write_bookkeeping_credits) with the checksum.
comment write_bookkeeping_credits Writes the seats' credits (the halfwords at seat1_credits, seat1_bookkeeping_byte, seat2_credits, seat2_bookkeeping_byte) at R12: 701F74 in the bookkeeping or 701FF0 in its backup.
comment add_service_credit A service credit for the seat whose credits are at R10 (seat1_credits or seat2_credits): one credit more, up to 9 (at 9 its coin units are cleared; beyond, nothing); a credit given brings the screen R12 to the title from the attract mode (show_title_on_credit), asks for the seat's service sound (R11) and counts one in R9, which it returns. Not run in the scenarios.
comment insert_coin A coin from the chute of entry R19 (when its bit is in R6): takes the entry's variant (chute_entry_offset: with the chutes shared, the second counts as the first), writes its byte to I/O C00074, owes the chute's coin meter a pulse (coin_meters) and counts the coin in the bookkeeping (701F06-701F0C, bookkeeping_increment16); with fewer than 9 credits: the screen's coin sound, and the chute's coin units (first_chute_multiplier or second_chute_multiplier) go toward a bonus unit (the credit record's third byte; one more unit each bonus_adder, when set) and toward a credit (its second byte, seat1_coin_units: a credit each coins_per_credit, up to 9, show_title_on_credit). Returns R9 plus the credits given.
comment show_title_on_credit A credit on the screen R12 during the attract mode (game modes 1-5, the low byte of its game_mode) brings it to the title: game_mode = 2 (game mode 2, game_mode_title, from its first step).
comment init_coins Sets up the coins: chute_entry_offset 14 (the two chutes shared: the second's coins counted as the first's, on its meter) when not on free play and both chutes give the same units (first_chute_multiplier = second_chute_multiplier), else 0; the seats' credits back from the bookkeeping (701F74-701F7A, bytes); and the low four bits of I/O chip 1's port F, inverted, into second_io_chip_port_f (nothing reads it).
comment bookkeeping_checksum Returns the checksum of the 3E halfwords at R2 (the bookkeeping or its backup): from 1, each halfword XORed in, then a shift right by one, with 8810 XORed in when the bit shifted out was 1.
comment bookkeeping_update_checksum Writes the checksum of the bookkeeping (701F02-701F7D in the shared sound RAM) into 701F00, after a change to it; returns it.
comment bookkeeping_copy Copies 3E halfwords from R2 over R3 (the bookkeeping and its backup at 701F7E, either way, or the defaults), then bookkeeping_update_checksum.
comment bookkeeping_check Checks the bookkeeping at boot: when the block (701F02) matches the checksum (701F00), copies it over the backup (701F7E); else when the backup matches, the backup over the block; else resets both (bookkeeping_reset).
comment bookkeeping_reset Resets the bookkeeping: the defaults at 011458 into the block (701F02), then the block into its backup (701F7E), with the checksum.
comment bookkeeping_increment16 Adds one to the 16-bit bookkeeping counter at R7 (and its backup's, 7C on) unless it is at FFFF, with the checksum: the coins by chute (insert_coin), the games by seat and the races' results (game_mode_play).
comment bookkeeping_add16 Adds R9 to the 16-bit bookkeeping counter at R7 (the credits from coins, 701F02, and the service credits, 701F04: update_coins) and to its backup's (7C on), with the checksum; past FFFF it stays at FFFF (and the backup's is left as it was: the code writes R7 twice).
comment bookkeeping_add32 Adds R9 to the 32-bit bookkeeping counter at R7 and to its backup's (7C on), with the checksum; past FFFFFFFF it stays there (the backup's left as it was): the play time by seat (game_mode_play).
comment bookkeeping_set16 Sets the 16-bit bookkeeping value at R7 and its backup's (7C on) to R9, with the checksum: the longest and shortest play (701F20, 701F22; game_mode_play).
comment bookkeeping_clear_credits Clears the credits kept in the bookkeeping (701F74-701F7B) and in its backup (701FF0-701FF7), with the checksum. Not run in the scenarios.
field screen 00 index u8
field screen 04 palette_ram u32
field screen 08 mixer u32 io
field screen 0C io_chip u32
field screen 14 sprite_origin_x u16
field screen 16 sprite_origin_y u16
field screen 1A sprite_screen_bit u16
field screen B0 sprite_groups u16
field screen B4 next_sprite_place u32 sprite_place
field screen C0 sprite_list_last u32
field screen C4 sprite_list_limit u32
field screen 150 fade_level u8
field screen 151 fade_step s8
field screen 152 fade_end u8
field screen 153 fade_kind u8
field screen 154 fade_channels u8
field screen 160 mixer_values u16[1F]          # the mixer's registers 00-3D as the screen keeps them (init_mixer from mixer_register_defaults, the other screen's layers cleared by number: "mov.h #0, 160[R25](R0)" 0108CD); vblank_update_mixer sends them with 4C-4F (1AC); 3E-4B are the colour offsets
field screen 1B0 mixer_defaults u16[1F]        # the set vblank_update_mixer makes the current one (flags bit 3), registers 00-3D as mixer_values (4C-4F at 1FC)
field screen 700 stage_lengths u16[1F]         # the 31 roads of stage_courses, the sum of their sections' lengths (init_screen "mov.h R8, [R11+]" 013DB6); branch_road_length after them
field screen B00 unpack_state u16
field screen B02 unpack_read_place u8
field screen B03 unpack_write_place u8
field screen B04 unpack_source u32
field screen B08 unpack_destination u32 unpacked_bytes
field screen B0C unpack_copy_source u32 unpacked_bytes
field screen B10 unpack_copy_count u8
field screen B11 unpack_flags u8
field screen B12 unpack_flags_left u8
field screen C00 unpack_queue u32
field screen 1F00 crest_count u8
field screen 1F10 crest_layers u16[10]   # by crest (note_road_crest: at the old count, 3 in the next place)
field screen 1F30 crest_heights u16[10]   # by crest (entry 0 the bottom of the screen; note_road_crest at the new count)
field screen 5000 depth_lists u16
20E020  var  sprite_list_buffers u16
20E080  var  coin_meters u8
20E08C  var  seat1_coin_sounds u8
20E08D  var  seat2_coin_sounds u8
20E08E  var  seat1_service_sounds u8
20E08F  var  seat2_service_sounds u8
20E091  var  chute_entry_offset u8
20E092  var  port_d_outputs[2] u8
20E0A0  var  seat1_credits u8
20E0A1  var  seat1_coin_units u8
20E0A8  var  seat2_credits u8
20E0A9  var  seat2_coin_units u8
20E200  var  video_registers[72] u16
20E60C  var  flip_screen u8

# ======== the test mode, first part (naming batch J1) ========
01C241  func  test_mode_start
01C388  func  test_mode_frame
01C392  func  test_mode_menu
01C3E6  func  test_mode_menu_run
01C435  func  test_mode_menu_show_write_count
01C5BA  func  test_mode_menu_toggle_continue
01C5DB  func  test_mode_memory_test
01C928  func  test_mode_memory_test_run
01C93B  func  test_mode_memory_test_draw
01C98E  func  test_mode_memory_test_checksum
01C9BE  func  test_mode_memory_test_words
01CA5D  func  test_mode_memory_test_halfwords
01CAF8  func  test_mode_memory_test_bytes
01CB8F  func  test_mode_memory_test_nibbles
01CC80  func  test_mode_memory_test_blink
01CDE0  func  test_mode_volume_adjustment
01CE15  func  test_mode_volume_adjustment_select
01CE97  func  test_mode_volume_adjustment_adjust
01CEDB  func  test_mode_volume_adjustment_draw
01D111  func  test_mode_input_test
01D126  func  test_mode_input_test_run
01D13B  func  test_mode_input_test_release
01D151  func  test_mode_input_test_draw
01D3E4  func  test_mode_output_test
01D419  func  test_mode_output_test_run
01D49A  func  test_mode_output_test_draw
01D4C7  func  test_mode_output_test_toggle
01D4DF  func  test_mode_output_test_exit
01D620  func  test_mode_sound_test
01D661  func  test_mode_sound_test_run
01D6BD  func  test_mode_sound_test_draw
01D6E7  func  test_mode_sound_test_play_a
01D72C  func  test_mode_sound_test_play_b
01D771  func  test_mode_sound_test_exit
01D840  func  test_mode_crt_test
01D868  func  test_mode_crt_test_bars_run
01D87A  func  test_mode_crt_test_grid
01D88F  func  test_mode_crt_test_grid_run
01D8B9  func  test_mode_crt_test_draw_bars
01D927  func  test_mode_crt_test_draw_bar
01D957  func  test_mode_crt_test_draw_grid
01D9F3  func  test_mode_game_assignments
01DA28  func  test_mode_game_assignments_run
01DA7C  func  test_mode_game_assignments_draw
01DB58  func  test_mode_game_assignments_difficulty
01DB68  func  test_mode_game_assignments_time
01DB85  func  test_mode_game_assignments_steering
01DB97  func  test_mode_game_assignments_advertise
01DBA9  func  test_mode_game_assignments_exit
01DD1E  func  test_mode_coin_assignments
01DD2B  func  test_mode_coin_assignments_show
01DD58  func  test_mode_coin_assignments_run
01DDAC  func  test_mode_coin_assignments_draw
01DE56  func  test_mode_coin_assignments_next_setting
comment test_mode_start Enters the test mode (reset calls it once when test_mode_on says the test mode is on): turns the link board off, clears the tilemaps and the sprite lists (init_video, init_sprite_lists), clears both screens' pending tile unpacking (screen unpack_state), demo flag (demo_flags bit 8) and flags bit 0, the mixers' registers 40-4A, turns both screens on (the I/O chips' CNT), sets up the test mode's palettes and font (test_mode_set_up_colours), test_mode_flags 0 (INDIVIDUAL) and the cursor on EXIT, stops both monitors' sounds (command 1F through the sound command queue, test_mode_queue_sound and test_mode_queue_sound_screen_2), turns the lamps and the wheel motor off (checkpoint_lamp-wheel_motor[1], screen button_lamps, port_d_outputs, port_g_outputs), writes " LCD status OK! " on both cabinets' LCDs (the 16 bytes at F10 of each screen's block), sets test_mode_routine to test_mode_menu and reads the controls (test_mode_read_controls).
comment test_mode_frame The test mode's frame, which reset runs every video frame while the test mode is on: reads the buttons and the analog inputs (test_mode_read_controls), sends the sound board the next queued sound command (test_mode_send_sound) and runs test_mode_routine, the step of the menu or page being shown.
comment test_mode_menu Shows the test mode's menu, where every page returns: in CONTINUE mode (test_mode_flags bit 0) the cursor first moves on to the next item; clears the text layer, shows the E2PROM write count while SERVICE is held (test_mode_menu_show_write_count), draws TEST MODE, the heading (INDIVIDUAL or CONTINUE), the twelve items and SELECT BY SERVICE BUTTON AND PUSH TEST BUTTON, puts the cursor on test_mode_cursor (test_mode_set_cursor) and goes on to test_mode_menu_run. With the cursor on the heading (after test_mode_menu_toggle_continue has redrawn it) it goes straight on.
comment test_mode_menu_run The menu, each frame: SERVICE moves the cursor (test_mode_cursor) down, from EXIT back to the heading; TEST starts the item's page (test_mode_page_jumps: test_mode_menu_toggle_continue, test_mode_memory_test, test_mode_volume_adjustment, test_mode_input_test, test_mode_output_test, test_mode_sound_test, test_mode_crt_test, test_mode_game_assignments, test_mode_coin_assignments, then the network assignments, bookkeeping, backup data clear and exit pages, test_mode_network_assignments_start, test_mode_bookkeeping_start, test_mode_backup_data_clear_start, test_mode_exit); the cursor's arrow blinks (test_mode_blink_address, test_mode_blink_timer: 11 frames shown, 6 hidden).
comment test_mode_menu_show_write_count While SERVICE is held as the menu is drawn: E2PROM WRITE COUNT and the count (eeprom_write_count, 5 digits) at the bottom of the menu.
comment test_mode_menu_toggle_continue The menu's heading: TEST switches between INDIVIDUAL and CONTINUE (test_mode_flags bit 0) and redraws it, then back to test_mode_menu. In CONTINUE mode each return to the menu moves the cursor to the next item, so the pages run one after another with TEST alone.
comment test_mode_memory_test The MEMORY TEST, all at once with the interrupts off and the sound program held in its wait loop (sound RAM 1FFF = 1): each chip's result shows TEST while it is tested, then GOOD or BAD (memory_test_results, test_mode_memory_test_draw). The program ROM's two halves by test_mode_memory_test_checksum against the sums at 03FFF8-03FFFF (IC37, IC40: 000000-03FFF7; IC36, IC39: 100000-1FEFFF); the video RAM (IC60, IC58, IC57, IC54) and the sprite RAM (IC61, IC67, IC68, IC70) by 4-bit lanes (test_mode_memory_test_nibbles); the palette RAMs' four 16 KB blocks by byte (IC1, IC3, IC2, IC4, IC120, IC121, IC122, IC123; test_mode_memory_test_halfwords); the work RAM (IC115-IC118, test_mode_memory_test_words) and the sound RAM (IC21, test_mode_memory_test_bytes) each saved in the sprite RAM and put back. The tilemaps, sprite lists and palettes it overwrites are set up again (init_video, init_sprite_lists, test_mode_set_up_colours). IC70 always shows GOOD: the test of its lane has no branch to BAD. Ends with the blinking PUSH TEST BUTTON TO EXIT (test_mode_show_exit_prompt) and test_mode_memory_test_run.
comment test_mode_memory_test_run The memory test's results, each frame: TEST goes back to the menu; PUSH TEST BUTTON TO EXIT blinks (test_mode_blink_prompt).
comment test_mode_memory_test_draw Draws the memory test's page (MEMORY TEST, 837-8890 <ROM> and its four chips, 837-8676 <RAM> and its 21, NOW TESTING) and each chip's result from memory_test_results beside its name: ---- (not yet), TEST, GOOD or BAD.
comment test_mode_memory_test_checksum Sums a stretch of the program ROM as two 16-bit checks, one of the even halfwords (the chip of the low half of each 32-bit word: IC37 or IC36) and one of the odd (IC40 or IC39): each halfword is xored in, the sum shifted right by one and xored with 8810 when a 1 falls out (a CRC); both start at 1.
comment test_mode_memory_test_words Tests RAM 32 bits at a time (the work RAM, in place: it takes its return address off the stack into a register and jumps back through it, so that it needs no stack in the RAM it overwrites): 8 passes, each writing a walking pattern (01010101 the first pass, one bit further each pass, turned by a few bits from word to word by the word's address) and reading it back; returns the bits found wrong (each mismatch's expected ^ read, xored together), a byte per chip; NOW TESTING blinks once a pass (test_mode_memory_test_blink).
comment test_mode_memory_test_halfwords test_mode_memory_test_words 16 bits at a time (the palette RAMs: a chip for each byte), with the pattern 0101; returns the bits found wrong.
comment test_mode_memory_test_bytes test_mode_memory_test_words a byte at a time (the sound RAM, all but its last byte, which holds the sound program), with the pattern 01; returns the bits found wrong.
comment test_mode_memory_test_nibbles test_mode_memory_test_words for RAM of 4-bit chips, 16 bits at a time (the video RAM and the sprite RAM): 4 passes with the pattern 1111 (a bit per chip); returns the bits found wrong, a nibble per chip.
comment test_mode_memory_test_blink Shows or hides NOW TESTING (each of its cells xored with its character in palette 66): the RAM tests call it after each pass.
comment test_mode_volume_adjustment Starts the VOLUME ADJUSTMENT, the calibration of the wheels' and pedals' potentiometers: draws ADJUST and CANCEL with the cursor on CANCEL (test_mode_page_cursor 1), the six controls' names (MONITOR A and B: STEERING WHEEL, ACCELERATOR, BRAKE) and the prompt; then test_mode_volume_adjustment_select.
comment test_mode_volume_adjustment_select Each frame: the bars (test_mode_volume_adjustment_draw); SERVICE moves the cursor between ADJUST and CANCEL; TEST on CANCEL goes back to the menu; TEST on ADJUST starts the adjustment: ADJUSTING, PUSH TEST BUTTON TO EXIT, each control's range (volume_ranges) narrowed to where it is now, then test_mode_volume_adjustment_adjust.
comment test_mode_volume_adjustment_adjust The adjustment, each frame: each control's range (volume_ranges) widens to take its position (test_mode_analog_inputs), as the operator turns the wheels and presses the pedals all the way; the bars; TEST marks the settings changed (test_mode_flags bit 1) and goes back to the menu; PUSH TEST BUTTON TO EXIT blinks.
comment test_mode_volume_adjustment_draw Draws the six controls' bars (32 cells, a cell for 8 steps): the range of volume_ranges in green and the control's position (test_mode_analog_inputs) in red.
comment test_mode_input_test Starts the INPUT TEST: clears the text layer, draws the inputs' names and the blinking PUSH TEST BUTTON TO EXIT, then test_mode_input_test_run.
comment test_mode_input_test_run The input test, each frame: the inputs (test_mode_input_test_draw); TEST goes on to test_mode_input_test_release, so that the press shows as TEST On before the page ends; PUSH TEST BUTTON TO EXIT blinks (test_mode_blink_prompt).
comment test_mode_input_test_release The input test once TEST is pressed: the inputs each frame until TEST is let go, then back to the menu.
comment test_mode_input_test_draw Draws the inputs of both monitors (cabinets): the wheel, accelerator and brake as the game sees them through the calibration (test_mode_analog_inputs clamped to volume_ranges and scaled to 0-FF), as a mark on a bar of 16 cells and a hexadecimal number; SHIFT UP, SHIFT DOWN, START, DJ/MUSIC, <<, >>, COIN and SERVICE On or Off, read from each I/O chip's ports (active low); TEST On when either monitor's is pressed.
comment test_mode_output_test Starts the OUTPUT TEST: the ten outputs of the two monitors (cabinets) with their state (test_mode_output_test_draw), EXIT and the prompt, the cursor on EXIT (test_mode_page_cursor 10); then test_mode_output_test_run.
comment test_mode_output_test_run The output test, each frame: TEST turns the output under the cursor on and letting go of it turns it off again (test_mode_output_test_toggle both times), so it is on while TEST is held; TEST on EXIT runs test_mode_output_test_exit; SERVICE, while TEST is not held, moves the cursor through the eleven items; the arrow blinks.
comment test_mode_output_test_draw Draws On or Off for the ten outputs, from their bits in the game's output bytes: monitor A's CHECK POINT and RACE LEADER lamps (port_d_outputs bits 1 and 3), the steering wheel's motor (port_d_outputs bit 4), the DJ/MUSIC and << >> lamps (port_g_outputs bits 0 and 1); monitor B's the same bits of 20E093 and 20E095.
comment test_mode_output_test_toggle Turns the output under the cursor (test_mode_page_cursor) on or off: flips its bit in the game's output bytes (the list at 01D5C0).
comment test_mode_output_test_exit The output test's EXIT: turns the lamps and the wheel motor off (port_d_outputs &= E0E1, port_g_outputs &= FBFC: monitor B's DJ/MUSIC and << >> bits, 20E095 bits 0-1, are not among them) and goes back to the menu.
comment test_mode_sound_test Starts the SOUND TEST: MONITOR A No., MONITOR B No. (the numbers of the next sounds, both 0: sound_test_number_a, sound_test_number_b), EXIT with the cursor on it (test_mode_page_cursor 2) and the prompt; then test_mode_sound_test_run.
comment test_mode_sound_test_run The sound test, each frame: SERVICE moves the cursor through the three items; TEST stops both monitors' sounds (command 1F to each), then plays monitor A's next sound (test_mode_sound_test_play_a), monitor B's (test_mode_sound_test_play_b) or goes back to the menu (test_mode_sound_test_exit), and redraws the numbers; the arrow blinks.
comment test_mode_sound_test_draw Draws the two monitors' sound numbers (sound_test_number_a, sound_test_number_b), 3 digits each.
comment test_mode_sound_test_play_a Plays monitor A's sound number sound_test_number_a from the list of 121 sound codes at 01D7C6 (test_mode_queue_sound) and steps to the next; from number 40 on it first sends command D6 (DA from 66, D8 from 6B), which selects sound set 6 (A, 8): the music parts' templates and the screen's MultiPCM sample bank; past the list's end (its closing 0) the number goes back to 0 without a sound.
comment test_mode_sound_test_play_b test_mode_sound_test_play_a for monitor B: sound_test_number_b, sent through test_mode_queue_sound_screen_2.
comment test_mode_sound_test_exit The sound test's EXIT: back to the menu.
comment test_mode_crt_test Starts the C.R.T. TEST's first page: a black background (the background colour of both palettes, 609C00 and 689C00), C.R.T. TEST 1/2, the colour bars (test_mode_crt_test_draw_bars) and the blinking PUSH TEST BUTTON TO CONTINUE; then test_mode_crt_test_bars_run.
comment test_mode_crt_test_bars_run The colour bars, each frame: TEST goes on to the second page (test_mode_crt_test_grid); the message blinks.
comment test_mode_crt_test_grid The C.R.T. test's second page: the crosshatch (test_mode_crt_test_draw_grid), C.R.T. TEST 2/2 and the blinking PUSH TEST BUTTON TO EXIT; then test_mode_crt_test_grid_run.
comment test_mode_crt_test_grid_run The crosshatch, each frame: TEST clears the text layer, gives the background back its blue (733) and goes back to the menu; the message blinks.
comment test_mode_crt_test_draw_bars Draws the first page on the text layer: a frame around the screen and four bars of 32 steps (test_mode_crt_test_draw_bar, characters 8001-8004: red, green, blue and white).
comment test_mode_crt_test_draw_bar Draws one colour bar: 5 rows of 32 cells of character R0, each column with the next palette (the cell + 200), so that the colour steps up across it; returns the place 5 rows down for the next bar.
comment test_mode_crt_test_draw_grid Draws the crosshatch of the second page over the whole text layer (characters 6C1B-6C1F: the edges and the inside), and blanks the cell after the exit message.
comment test_mode_game_assignments Starts the GAME ASSIGNMENTS: the settings' names and values (test_mode_game_assignments_draw), EXIT, the prompt, the cursor on EXIT (test_mode_page_cursor 9); then test_mode_game_assignments_run.
comment test_mode_game_assignments_run The game assignments, each frame: SERVICE moves the cursor through the ten items; TEST changes the setting under it: the game difficulty (test_mode_game_assignments_difficulty), a stage's time (test_mode_game_assignments_time), the steering wheel reaction (test_mode_game_assignments_steering), the advertise sound (test_mode_game_assignments_advertise), or EXIT (test_mode_game_assignments_exit); the arrow blinks.
comment test_mode_game_assignments_draw Draws the game settings: game_difficulty + 1 (1-8) and its bar from EASY to HARD (two cells a level), the six stages' time_difficulty (NORMAL, or +n SEC / -n SEC), and steering_wheel_reaction and advertise_sound (bit 0) as On or Off.
comment test_mode_game_assignments_difficulty GAME DIFFICULTY: game_difficulty one level harder, after the eighth back to the first; redraws.
comment test_mode_game_assignments_time TIME DIFFICULTY: the time_difficulty of the stage under the cursor (items 1-6: PRE-STAGE, STAGE 1-4, FINAL STAGE) one second more, from +5 back to -5; redraws.
comment test_mode_game_assignments_steering STEERING WHEEL REACTION: steering_wheel_reaction on or off (1 or 0); redraws.
comment test_mode_game_assignments_advertise ADVERTISE SOUND: advertise_sound on or off (1 or 0); redraws.
comment test_mode_game_assignments_exit The game assignments' EXIT: compares game_difficulty, time_difficulty, steering_wheel_reaction and advertise_sound with their backup copy 3C bytes on (backup_settings_checksum on, the copy of the settings the boot code keeps); if any changed, marks the settings changed (test_mode_flags bit 1); back to the menu.
comment test_mode_coin_assignments Starts the COIN ASSIGNMENTS with the cursor on EXIT (test_mode_page_cursor 2): test_mode_coin_assignments_show.
comment test_mode_coin_assignments_show Draws the coin assignments page (COIN/CREDIT SETTING with the setting, test_mode_coin_assignments_draw; MANUAL SETTING; EXIT; the prompt) with the cursor where test_mode_page_cursor says: on EXIT when the page starts, on MANUAL SETTING when that page (test_mode_coin_assignments_manual_start) returns here; then test_mode_coin_assignments_run.
comment test_mode_coin_assignments_run The coin assignments, each frame: SERVICE moves the cursor through the three items; TEST on COIN/CREDIT SETTING takes the next setting (test_mode_coin_assignments_next_setting), on MANUAL SETTING opens that page (test_mode_coin_assignments_manual_start), on EXIT leaves (test_mode_coin_assignments_exit); the arrow blinks. Its table's last four entries belong to the manual setting page, whose table starts inside this one: they are never taken from here.
comment test_mode_coin_assignments_draw Draws the coin/credit setting: its number (coin_setting + 1) and what it gives, from its description (coin_setting_descriptions): up to five lines of "n COIN(S) m CREDIT(S)", or a text (FREE PLAY, MANUAL SETTING).
comment test_mode_coin_assignments_next_setting COIN/CREDIT SETTING: the next of the 26 settings (coin_setting, after FREE PLAY back to #1): its record at 01E3E8 gives coins_per_credit, bonus_adder, first_chute_multiplier and second_chute_multiplier, and free_play 0; FREE PLAY (#26) sets coins_per_credit, first_chute_multiplier and second_chute_multiplier to 1 and bonus_adder and free_play to FF. Settings whose first three bytes are the ones in place are skipped (they differ only in second_chute_multiplier), so only 15 of them come up: #1, 6, 8-12, 15, 17-19, 21, 22, 24, 26. Redraws.
20E701  var  test_mode_flags u8
20E702  var  test_mode_cursor u8
20E703  var  test_mode_page_cursor u8
20E704  var  test_mode_routine u32
20E708  var  test_mode_blink_address u32 text_layer_cells
20E70C  var  test_mode_buttons u8
20E70D  var  test_mode_buttons_previous u8
20E70E  var  test_mode_buttons_pressed u8
20E70F  var  test_mode_buttons_released u8
20E710  var  test_mode_analog_inputs u8
20E716  var  memory_test_results[25] u8
20E72F  var  test_mode_blink_timer s8
20E730  var  sound_test_number_a u8
20E731  var  sound_test_number_b u8
20E60A  var  eeprom_write_count u16
20E60D  var  advertise_sound u8
20E614  var  coin_setting u8
20E615  var  free_play u8
20E624  var  steering_wheel_reaction u8
20E630  var  game_difficulty u8
20E632  var  time_difficulty[6] s8
20E638  var  volume_ranges u8

# ======== the test mode, second part, and the interrupt hooks (naming batch J2) ========
01DEC7  func  test_mode_coin_assignments_manual_start
01DEFD  func  test_mode_coin_assignments_manual_run
01DF51  func  test_mode_coin_assignments_manual_draw
01E02E  func  test_mode_draw_two_digits
01E04F  func  test_mode_coin_assignments_step_coin_to_credit
01E053  func  test_mode_coin_assignments_step_value
01E073  func  test_mode_coin_assignments_step_bonus_adder
01E09B  func  test_mode_coin_assignments_step_multiplier
01E0A1  func  test_mode_coin_assignments_manual_exit
01E0B0  func  test_mode_coin_assignments_exit
01E453  func  test_mode_network_assignments_start
01E4BA  func  test_mode_network_assignments_run
01E523  func  test_mode_network_assignments_draw
01E57F  func  test_mode_network_assignments_toggle_communication
01E5C3  func  test_mode_network_assignments_toggle_privilege_mode
01E5E7  func  test_mode_network_assignments_step_cabinet_id
01E5F7  func  test_mode_network_assignments_exit
01E6EB  func  test_mode_bookkeeping_start
01E703  func  test_mode_bookkeeping_wait
01E715  func  test_mode_bookkeeping_second_page_start
01E72D  func  test_mode_bookkeeping_second_page_wait
01E740  func  test_mode_bookkeeping_draw_totals
01E862  func  test_mode_bookkeeping_draw_histogram
01E9A4  func  test_mode_draw_duration
01E9E6  func  test_mode_draw_minutes_seconds
01EDC4  func  test_mode_backup_data_clear_start
01EDF1  func  test_mode_backup_data_clear_run
01EE66  func  test_mode_backup_data_clear_wait
01EEC1  func  test_mode_exit
01EEEF  func  test_mode_exit_caution_wait
01EF6E  func  test_mode_set_up_colours
01F02C  func  test_mode_draw_instructions
01F034  func  test_mode_show_exit_prompt
01F043  func  test_mode_show_continue_prompt
01F052  func  test_mode_blink_prompt
01F085  func  test_mode_set_cursor
01F09A  func  test_mode_clear_cursor
01F0CA  func  test_mode_draw_texts
01F0ED  func  test_mode_draw_count
01F103  func  test_mode_draw_number
01F131  func  test_mode_draw_hex_number
01F16C  func  test_mode_colour_line
01F17D  func  test_mode_clear_text
01F190  func  test_mode_read_controls
01F237  func  test_mode_send_sound
01F266  func  test_mode_queue_sound_screen_2
01F26B  func  test_mode_queue_sound
03F62A  func  vblank_update_mixer
03F6A0  func  vblank_update_scrolls
03F8C9  func  check_test_button
03F8DA  func  send_sound_requests
03F922  func  count_total_time
03F96B  func  update_lamps
03FA54  func  update_button_lamps
comment test_mode_coin_assignments_manual_start Opens the coin assignments' MANUAL SETTING page: clears the text, draws its texts (COIN TO CREDIT, BONUS ADDER, MULTIPLIER, the table of credits for 1 to 9 coins, EXIT) and the setting (test_mode_coin_assignments_manual_draw), the instructions, puts the cursor on EXIT (test_mode_page_cursor 3) and goes on in test_mode_coin_assignments_manual_run.
comment test_mode_coin_assignments_manual_run Each frame of the MANUAL SETTING page: SERVICE moves the cursor down its four lines (test_mode_page_cursor, wrapping), TEST changes the line's value: COIN TO CREDIT (test_mode_coin_assignments_step_coin_to_credit), BONUS ADDER (test_mode_coin_assignments_step_bonus_adder), MULTIPLIER (test_mode_coin_assignments_step_multiplier) or EXIT (test_mode_coin_assignments_manual_exit); then blinks the cursor.
comment test_mode_coin_assignments_manual_draw Draws the manual coin setting: coins_per_credit (N COIN(S) 1 CREDIT), the bonus_adder (N COINS GIVE 1 EXTRA COIN, NO BONUS ADDER, or FREE PLAY when negative), the first_chute_multiplier (1 COIN COUNTS AS N COIN(S)), and the table of what 1 to 9 coins give: each coin counts as the multiplier, the bonus adds a coin for every bonus_adder counted (the rest carried on), and the credits (at most 9) show as two digits (test_mode_draw_two_digits) with what is left over as a fraction of a credit in the font's fraction characters.
comment test_mode_draw_two_digits Draws R5 (below 100) at text cell R10 as two digits in white (6A), a blank for a 0 tens digit, and returns the cell after them. Used by test_mode_coin_assignments_manual_draw.
comment test_mode_coin_assignments_step_coin_to_credit COIN TO CREDIT: test_mode_coin_assignments_step_value with coins_per_credit.
comment test_mode_coin_assignments_step_value Steps the coin setting R0 bytes into the settings (coins_per_credit or first_chute_multiplier) from 1 to 9 and round; unless free play is on, the coin setting becomes the manual one (coin_setting 1A); redraws (test_mode_coin_assignments_manual_draw).
comment test_mode_coin_assignments_step_bonus_adder BONUS ADDER: steps bonus_adder through none (0), 2 to 9 and back to none; from free play (FF) it goes to none and turns free_play off; the coin setting becomes the manual one (coin_setting 1A); redraws.
comment test_mode_coin_assignments_step_multiplier MULTIPLIER: test_mode_coin_assignments_step_value with first_chute_multiplier (1 COIN COUNTS AS N COIN).
comment test_mode_coin_assignments_manual_exit EXIT of the MANUAL SETTING page: back to the coin assignments page, its cursor on MANUAL SETTING (test_mode_page_cursor 1).
comment test_mode_coin_assignments_exit EXIT of the coin assignments page: when coins_per_credit, first_chute_multiplier, bonus_adder, free_play or coin_setting differ from the copy last written to the EEPROM (3C bytes on), marks the settings changed (test_mode_flags bit 1, written at the test mode's EXIT) and clears the credits kept in the shared RAM (bookkeeping_clear_credits); back to the menu.
comment test_mode_network_assignments_start Opens the NETWORK ASSIGNMENTS page: its texts, with PRIVILEGE MODE and CABINET ID hidden (colour 6E) when the cabinet is stand_alone; test_mode_privilege_mode from link_master; the values (test_mode_network_assignments_draw), the instructions, the cursor on EXIT; goes on in test_mode_network_assignments_run.
comment test_mode_network_assignments_run Each frame of the NETWORK ASSIGNMENTS page: SERVICE moves the cursor (between COMMUNICATION and EXIT only when stand_alone, else down all four lines), TEST runs its line: COMMUNICATION (test_mode_network_assignments_toggle_communication), PRIVILEGE MODE (test_mode_network_assignments_toggle_privilege_mode), CABINET ID (test_mode_network_assignments_step_cabinet_id) or EXIT (test_mode_network_assignments_exit); then blinks the cursor.
comment test_mode_network_assignments_draw Draws the network settings: COMMUNICATION NETWORK or STAND-ALONE (stand_alone), PRIVILEGE MODE SLAVE or MASTER (test_mode_privilege_mode), CABINET ID 1-4 (cabinet_id + 1); the last two hidden (colour 6E) when stand-alone.
comment test_mode_network_assignments_toggle_communication COMMUNICATION: switches stand_alone (NETWORK, STAND-ALONE), puts the privilege mode back to MASTER (link_master 1, isdn_mode 0, test_mode_privilege_mode 1), shows or hides the PRIVILEGE MODE and CABINET ID labels and redraws the values.
comment test_mode_network_assignments_toggle_privilege_mode PRIVILEGE MODE: switches test_mode_privilege_mode between SLAVE and MASTER and sets link_master and isdn_mode from it (01E6E5: SLAVE 0 and 0, MASTER 1 and 0; the table's third pair, ISDN, 0 and 1, cannot be reached); redraws.
comment test_mode_network_assignments_step_cabinet_id CABINET ID: steps cabinet_id through 0-3 (shown 1-4); redraws.
comment test_mode_network_assignments_exit EXIT of the NETWORK ASSIGNMENTS page: when stand_alone, link_master, isdn_mode or cabinet_id differ from the copy last written to the EEPROM, marks the settings changed (test_mode_flags bit 1); back to the menu.
comment test_mode_bookkeeping_start Opens the first BOOKKEEPING page (1/2): its texts, its numbers (test_mode_bookkeeping_draw_totals) and the blinking PUSH TEST BUTTON TO CONTINUE (test_mode_show_continue_prompt); goes on in test_mode_bookkeeping_wait.
comment test_mode_bookkeeping_wait Blinks the prompt (test_mode_blink_prompt) until TEST, then the second page (test_mode_bookkeeping_second_page_start).
comment test_mode_bookkeeping_second_page_start Opens the second BOOKKEEPING page (2/2): its texts, the time histogram and the course records (test_mode_bookkeeping_draw_histogram) and the blinking PUSH TEST BUTTON TO EXIT (test_mode_show_exit_prompt); goes on in test_mode_bookkeeping_second_page_wait.
comment test_mode_bookkeeping_second_page_wait Blinks the prompt until TEST, then back to the menu.
comment test_mode_bookkeeping_draw_totals Draws the first bookkeeping page's numbers from the bookkeeping in the sound board's shared RAM (701F00 on): COIN CHUTE A and B (the coins of each seat's first chute, 701F06 and 701F0A) and TOTAL COIN(S); COIN CREDIT(S) (701F02) and SERVICE CREDIT(S) (701F04) and their TOTAL; NUMBER OF GAME(S) A and B (701F14, 701F16); TOTAL TIME (701F10, counted by count_total_time) and GAME PLAY TIME A and B (701F18, 701F1C) in days, hours, minutes and seconds (test_mode_draw_duration); once a game was played, AVERAGE GAME TIME (the play times over the games), LONGEST (701F20) and SHORTEST (701F22) in minutes and seconds (test_mode_draw_minutes_seconds).
comment test_mode_bookkeeping_draw_histogram Draws the second bookkeeping page's numbers: the TIME HISTOGRAM, how far the games got (seven counts from 701F24: PRE-STAGE, STAGE 1-5, COMPLETE), each with a bar of up to 20 blocks scaled to the largest; and OutRunner of OutRunners, the record of each of the ten goals (AUSTRALIA to KENYA; six bytes each from 701F32: the car, none when negative, shown by its colour, the three letters of the name and the time in hundredths, shown as minutes, seconds and hundredths).
comment test_mode_draw_duration Draws a time of R0 seconds at text cell R11 as days (5 digits), hours, minutes and seconds (2 digits each, a cell apart, for the D H M S of the text) and returns the cell after it.
comment test_mode_draw_minutes_seconds Draws a time of R0 seconds at text cell R11 as minutes and seconds, 2 digits each a cell apart; R11 moves to the seconds.
comment test_mode_backup_data_clear_start Opens the BACKUP DATA CLEAR page: YES (CLEAR) and NO (CANCEL), the instructions, the cursor on NO; goes on in test_mode_backup_data_clear_run.
comment test_mode_backup_data_clear_run Each frame of the BACKUP DATA CLEAR page: SERVICE moves the cursor between YES and NO; TEST on NO goes back to the menu; TEST on YES leaves the cursor on, clears the bookkeeping (bookkeeping_reset: all of it back to its defaults at 011458, zeros but SHORTEST GAME TIME FFFF and no course records, the credits too), shows COMPLETED, hides SELECT BY SERVICE BUTTON and blinks PUSH TEST BUTTON TO EXIT (test_mode_show_exit_prompt) until TEST (test_mode_backup_data_clear_wait).
comment test_mode_backup_data_clear_wait After the clear: blinks the prompt until TEST, then back to the menu.
comment test_mode_exit EXIT: when a page changed a setting (test_mode_flags bit 1, cleared here) writes the settings to the EEPROM (save_settings, which counts eeprom_write_count up to 10000); while eeprom_write_count is below 10000, or with nothing to write, leaves the test mode: test_mode_on 0 and the I/O chips' CNT registers 4 and 80 (the test mode's start wrote 6 and 86: bit 1, cleared now, turns a chip's screen output on, runtime/src/io.c); at 10000 shows the CAUTION that the EEPROM has been written 10,000 times and waits for TEST first (test_mode_exit_caution_wait).
comment test_mode_exit_caution_wait Blinks PUSH TEST BUTTON TO EXIT under the CAUTION until TEST, then leaves the test mode as test_mode_exit does.
comment test_mode_set_up_colours Sets up the test mode's colours and tiles on both screens: the whole palette in the background's colour (733), the text palettes (01F304 for screen 1, 01F506 for screen 2: the text colours 60 grey, 62 red, 64 green, 66 yellow, 68 cyan, 6A white, 6E the background's), 32 palettes after them whose colours 1-4 are red, green, blue and white at levels 0-31, and four solid tiles of colours 1-4 (318020): what the C.R.T. test's colour bars are drawn with.
comment test_mode_draw_instructions Draws SELECT BY SERVICE BUTTON AND PUSH TEST BUTTON at the bottom of the screen.
comment test_mode_show_exit_prompt Makes PUSH TEST BUTTON TO EXIT (the text record at 01F2BC, row 25) the prompt test_mode_blink_prompt blinks (test_mode_blink_address), from the next frame.
comment test_mode_show_continue_prompt Makes PUSH TEST BUTTON TO CONTINUE (the text record at 01F2DE) the prompt test_mode_blink_prompt blinks, from the next frame.
comment test_mode_blink_prompt Blinks the prompt whose text record test_mode_blink_address holds: when test_mode_blink_timer runs out, draws it (shown 21 frames) if its first cell is empty, else erases it (hidden 11 frames).
comment test_mode_set_cursor Puts the cursor at text cell R10, the cell two before a menu line: test_mode_blink_address = R10 (the cursor, character 7F, blinks there: the menu loops' tail at 01F0AD), test_mode_blink_timer 0, and the line in white (6A, test_mode_colour_line).
comment test_mode_clear_cursor Takes the cursor off its line: clears its cell (test_mode_blink_address) and puts the line back in grey (60).
comment test_mode_draw_texts Draws the text record at R10 on the text layer: lines of a cell (halfword), characters and colour changes (a negative byte: its complement is the colour, the cells' high byte), each closed by 0; a 0 cell ends it.
comment test_mode_draw_count Draws the number R0 as test_mode_draw_number does, and R3 cells from R10 an S (or a blank for 1 or less) for the plural of the word beside it (COIN(S), CREDIT(S), GAME(S)); R1 holds the S's colour (the word's) in its low byte and the digits' in its second.
comment test_mode_draw_number Draws the number R0 in decimal in R2 cells ending at text cell R10 + 2 * R2, right-aligned in the colour in R1's low byte (the cells' high byte), the unused cells before it cleared.
comment test_mode_draw_hex_number test_mode_draw_number in hexadecimal (digits 0-9, A-F).
comment test_mode_colour_line Gives the text from cell R10 up to the next empty cell the colour R0 (60 grey, 6A white, 6E hidden...).
comment test_mode_clear_text Clears the text layer (30 rows of 64 cells).
comment test_mode_read_controls The test mode's controls, each frame: test_mode_buttons (SERVICE bit 0, TEST bit 1, START bit 4 and bit 5 of input port E, of either seat; bits 4-5 of port F count as SERVICE and TEST too), test_mode_buttons_previous, test_mode_buttons_pressed and test_mode_buttons_released; and the analog inputs into test_mode_analog_inputs, alternately (test_mode_flags bit 2, which also sets the converter's input bank): the first four (seat A's wheel, gas and brake, seat B's wheel) one frame, seat B's gas and brake the next.
comment test_mode_send_sound Sends the test mode's next queued sound request (test_mode_sound_queue, test_mode_sound_queue_read) to the sound CPU, one a frame: to screen 2's command byte (SOUND_COMMAND_2) when the request has its high byte set, else to screen 1's (SOUND_COMMAND_1).
comment test_mode_queue_sound_screen_2 test_mode_queue_sound for screen 2's sound CPU commands (the high byte set).
comment test_mode_queue_sound Puts sound request R0 in the test mode's ring of 16 (test_mode_sound_queue at test_mode_sound_queue_write) for test_mode_send_sound: screen 1's, or screen 2's with the high byte set (test_mode_queue_sound_screen_2).
comment vblank_update_mixer In the vertical blank, a screen's mixer and colours: while the screen's flags bit 0 is set, a step of its colour offsets (step_screen_fade) into the mixer's colour offset registers (3E-4B); flags bit 2 (cleared) sends the mixer settings at 160 of the screen (registers 00-3D and 4C-4F); flags bit 3 (cleared) makes the set at 1B0 the current one and sends it; then the queued palettes (upload_queued_palettes).
comment vblank_update_scrolls In the vertical blank, the tilemaps' scrolls (two per screen): those of the screen whose task was running from video_registers[8] and video_registers[16] as they are; those of the other screen half-way between the values they have (video_registers[8], video_registers[16] by screen) and the new ones (scroll_targets, scroll_targets[8]), which become their values: the in-between frame of the screen whose task did not run (each task's scrolls change every other frame); and the byte at 31FF05 from video_registers[2]'s second byte, which steps by 4 (bits 2-3).
comment check_test_button Turns the test mode on (test_mode_on FF) when TEST has just been pressed (bit 7 of switches_pressed, the inputs newly pressed); the boot task's loop then runs the test mode.
comment send_sound_requests In the vertical blank, sends the screen's next sound request to the sound CPU: one from its ring of 32 (queue_sound's: sound_queue_read, sound_queue_write, the requests after them) to its command byte (SOUND_COMMAND_1 for screen 1, SOUND_COMMAND_2 for screen 2), and one from its second ring at 840 (second_sound_queue_read, second_sound_queue_write; only the unused request_second_sound fills it) to the byte 8 after it, which the sound program never reads.
comment count_total_time Counts the bookkeeping's TOTAL TIME (701F10, seconds, kept with its copy and checksum), outside the test mode only: total_time_count gains 17 every vertical blank and a second passes at each 1000 (2000 for every 73rd second).
comment update_lamps In the vertical blank, the cabinet's lamps: blinks each seat's CHECK POINT lamp (output port D bit 1: checkpoint_lamp, checkpoint_lamp_2) and RACE LEADER lamp (bit 3: leader_lamp, leader_lamp_2), each with a blinks, a period and a timer byte after it: while blinks is not 0 the timer counts the vertical blanks and at 0 toggles the lamp, starts again from period and takes one off blinks; writes output port D of each I/O chip from port_d_outputs or port_d_outputs[1] with those lamps and, when the seat is not in the attract mode (screen demo_flags bit 8) and the STEERING WHEEL REACTION setting (steering_wheel_reaction) is on, the wheel motor's bits (wheel_motor by seat); then the music and arrows lamps (update_button_lamps).
comment update_button_lamps A screen's two button lamps, in its port G image (R11: port_g_outputs or port_g_outputs[1], which the LCD's output sends): the DJ/MUSIC lamp (bit 0) by the low byte of button_lamps and the << >> lamp (bit 1) by its high byte: 0 off, negative on, n blinking every n vertical blanks (music_lamp_timer, arrows_lamp_timer), each mode taken when it changes (music_lamp_mode, arrows_lamp_mode).
comment int_vector_40 The vertical blank interrupt (IRQ 0), every video frame: counts vblank_counter and vblanks_since_start, starts timer 0 for the LCD (int_vector_43, 34 times: timer_interrupts_left); when it interrupted screen 2's task: both screens' mixers and palettes (vblank_update_mixer), the video registers (all 72 halfwords from video_registers when send_video_registers asks for them, which it clears, else the 8 at video_registers[16] and the 8 at video_registers[32]) and the external tile banks of chip 0's port H (2 bits each of tile_banks-tile_banks[3]); then for the interrupted task's screen the sprite list (finish_sprite_list), send_sound_requests, and vblank_update_scrolls unless the screen's skip_scroll_update is set (cleared here); outside the test mode the inputs (read_switches_and_analog), pack_seat_inputs (screen 1) or queue_seat_inputs (screen 2), check_test_button and, without free play, the coins (update_coins); then update_lamps, the LCD (lcd_refresh), count_total_time; sets frame_ready; swaps the tasks (task_swap) unless single_task is set, when task_swapping is set or when the test mode is on and screen 1's task is running; counts the frame for the running task's screen (screen_1_vblanks, screen_2_vblanks).
comment int_vector_41 The end of the vertical blank (IRQ 1): only acknowledged.
comment int_vector_42 The sound CPU's interrupt (IRQ 2): only acknowledged. The sound program never raises it.
comment int_vector_43 Timer 0 (IRQ 3), which int_vector_40 starts each frame at its shortest period: sends the LCD its next piece (lcd_send_next_nibble) and starts the timer again until timer_interrupts_left runs out, 34 times a frame. When it runs out it tests the screen's byte 1 and test_mode_on but goes the same way; the code after them (unused_03F7D8: counts debug_timer_rounds and shows it on the text layer) is never reached.
comment int_vector_44 Timer 1 (IRQ 4), the link board's: outside the ISDN mode (isdn_mode) only acknowledged, which leaves the timer stopped; in it counts link_wait_count and takes the kind of the link board's message (its byte at 800010, cleared as it is read): 3, a message, is copied out of the board (link_isdn_receive_records: 800600 on to 21E000), link_wait_count cleared and the timer started at 168; any other kind polls again at the shortest period. link_unused_case is a fourth case (the controls, pack_seat_inputs, then 96) its table does not list.
comment int_default The vectors no interrupt uses (250 of the 256): halt instructions, on into int_vector_02's.
comment int_vector_02 The NMI: halt instructions, then on into check_test_button (whose return is not an interrupt's).
field screen A7 skip_scroll_update u8
field screen 800 sound_queue_read u8
field screen 801 sound_queue_write u8
field screen 840 second_sound_queue_read u8
field screen 841 second_sound_queue_write u8
field screen F20 button_lamps u16
field screen F22 music_lamp_mode u8
field screen F23 arrows_lamp_mode u8
field screen F24 music_lamp_timer u8
field screen F25 arrows_lamp_timer u8
20E700  var  test_mode_on u8
20E732  var  test_mode_sound_queue_write u8
20E733  var  test_mode_sound_queue_read u8
20E734  var  test_mode_sound_queue[16] u16
20E754  var  test_mode_privilege_mode u8
20E610  var  coins_per_credit u8
20E611  var  first_chute_multiplier u8
20E612  var  second_chute_multiplier u8
20E613  var  bonus_adder u8
20E620  var  stand_alone u8
20E621  var  link_master u8
20E622  var  cabinet_id u8
20E623  var  isdn_mode u8
20E00A  var  vblanks_since_start u16
20E028  var  task_swapping u8
20E02C  var  timer_interrupts_left u8
20E02D  var  vblank_counter u8
20E03A  var  total_time_count u16
20E060  var  link_wait_count u32
20E0FC  var  screen_2_vblanks u8
20E0FE  var  screen_1_vblanks u8
20E0C0  var  checkpoint_lamp[8] u8
20E0C1  var  checkpoint_lamp_blinks u8
20E0C2  var  checkpoint_lamp_period u8
20E0C3  var  checkpoint_lamp_timer u8
20E0C4  var  checkpoint_lamp_2 u8
20E0C5  var  checkpoint_lamp_2_blinks u8
20E0C6  var  checkpoint_lamp_2_period u8
20E0C7  var  checkpoint_lamp_2_timer u8
20E0C8  var  leader_lamp[8] u8
20E0C9  var  leader_lamp_blinks u8
20E0CA  var  leader_lamp_period u8
20E0CB  var  leader_lamp_timer u8
20E0CC  var  leader_lamp_2 u8
20E0CD  var  leader_lamp_2_blinks u8
20E0CE  var  leader_lamp_2_period u8
20E0CF  var  leader_lamp_2_timer u8

# ======== the title's, the prompts', the test mode's and the interrupts' data (rom names, batch B6) ========
# The tables of code addresses the handlers' and the pages' switches go through
01A0F0  table  title_palm_tree_state_jumps  u32   # title_palm_tree_update jumps through it by state (01A0E6 mov.w 1A0F0[PC](R0), R0, 01A0EB jmp [R0]): 01A0F8 01A15F
01A198  table  title_logo_state_jumps  u32   # title_logo_update jumps through it by state (01A190 mov.w 1A198[PC](R0), R0, 01A195 jmp [R0]): 01A1A8 01A1DC 01A24B 01A27B
01A2A8  table  title_logo_copy_state_jumps  u32   # title_logo_copy_update jumps through it by state (01A2A0 mov.w 1A2A8[PC](R0), R0, 01A2A5 jmp [R0]): 01A2B4 01A2E6 01A30E
01A334  table  title_logo_car_state_jumps  u32   # title_logo_car_update jumps through it by state (01A32D mov.w 1A334[PC](R0), R0, 01A332 jmp [R0]): 01A344 01A354 01A3B6 01A3E0
01A3F4  table  title_logo_stripe_state_jumps  u32   # title_logo_stripe_update jumps through it by state (01A3ED mov.w 1A3F4[PC](R0), R0, 01A3F2 jmp [R0]): 01A404 01A414 01A458 01A478
01A4A4  table  title_board_palms_state_jumps  u32   # title_board_palms_update jumps through it by state (01A49D mov.w 1A4A4[PC](R0), R0, 01A4A2 jmp [R0]): 01A4B0 01A4F2 01A515
01A544  table  title_seagull_state_jumps  u32   # title_seagull_fly jumps through it by state (01A53A mov.w 1A544[PC](R0), R0, 01A53F jmp [R0]): 01A550 01A59B 01A5F3
01A680  table  title_picture_state_jumps  u32   # title_picture_draw jumps through it by state (01A676 mov.w 1A680[PC](R0), R0, 01A67B jmp [R0]): 01A688 draw_object
01A6DC  table  coin_prompt_state_jumps  u32   # coin_prompt_update jumps through it by state (01A6D3 mov.w 1A6DC[PC](R0), R0, 01A6D8 jmp [R0]): 01A6E4 01A6FC
01A744  table  coin_prompt_screen_jumps  u32   # coin_prompt_update jumps through it by screen_index (01A73B mov.w 1A744[PC](R0), R0, 01A740 jmp [R0]): 01A74C 01A758
01A7D0  table  coin_prompt_car_state_jumps  u32   # coin_prompt_car_drive jumps through it by state (01A7C9 mov.w 1A7D0[PC](R0), R0, 01A7CE jmp [R0]): 01A7D8 01A829
01A84C  table  coin_prompt_message_state_jumps  u32   # coin_prompt_message_update jumps through it by state (01A842 mov.w 1A84C[PC](R0), R0, 01A847 jmp [R0]): 01A85C 01A864 01A8A9 01A8C1
01A8F0  table  ignition_key_prompt_state_jumps  u32   # ignition_key_prompt_update jumps through it by state (01A8E6 mov.w 1A8F0[PC](R0), R0, 01A8EB jmp [R0]): 01A8F8 01A945
01AA0C  table  credit_display_state_jumps  u32   # credit_display_update jumps through it by state (01AA05 mov.w 1AA0C[PC](R0), R0, 01AA0A jmp [R0]): 01AA18 01AA34 01AA41
01AA4C  table  credit_display_screen_jumps  u32   # credit_display_update jumps through it by screen_index (01AA45 mov.w 1AA4C[PC](R0), R0, 01AA4A jmp [R0]): 01AA54 01AA60
01ADF4  table  demo_captions_state_jumps  u32   # demo_captions_run jumps through it by state (01ADEC mov.w 1ADF4[PC](R0), R0, 01ADF1 jmp [R0]): 01ADFC 01AE0D
01AE98  table  demo_caption_state_jumps  u32   # demo_caption_update jumps through it by state (01AE91 mov.w 1AE98[PC](R0), R0, 01AE96 jmp [R0]): 01AEA0 01AEED
01AFE8  table  kanji_text_viewer_state_jumps  u32   # kanji_text_viewer_update jumps through it by state (01AFE0 mov.w 1AFE8[PC](R0), R0, 01AFE5 jmp [R0]): 01AFF8 01B04A 01B17B 01B1B0
01D5EC  table  test_mode_output_test_item_jumps  u32   # test_mode_output_test_run jumps through it by test_mode_page_cursor (01D426 mov.w 1D5EC[PC](R0), R10, 01D42C jsr [R10]; 01D44D mov.w 1D5EC[PC](R0), R10, 01D453 jsr [R10]): test_mode_output_test_toggle (10 times) test_mode_output_test_exit
01D77C  table  test_mode_sound_test_item_jumps  u32   # test_mode_sound_test_run jumps through it by test_mode_page_cursor (01D6AF mov.w 1D77C[PC](R0), R10, 01D6B5 jsr [R10]): test_mode_sound_test_play_a test_mode_sound_test_play_b test_mode_sound_test_exit
01DBD0  table  test_mode_game_assignments_item_jumps  u32   # test_mode_game_assignments_run jumps through it by test_mode_page_cursor (01DA71 mov.w 1DBD0[PC](R0), R10, 01DA77 jsr [R10]): test_mode_game_assignments_difficulty test_mode_game_assignments_time (6 times) test_mode_game_assignments_steering test_mode_game_assignments_advertise test_mode_game_assignments_exit
01E0D8  table  test_mode_coin_assignments_item_jumps  u32   # test_mode_coin_assignments_run jumps through it by test_mode_page_cursor (01DDA1 mov.w 1E0D8[PC](R0), R10, 01DDA7 jsr [R10]): test_mode_coin_assignments_next_setting test_mode_coin_assignments_manual_start test_mode_coin_assignments_exit
01E0E4  table  test_mode_coin_assignments_manual_item_jumps  u32   # test_mode_coin_assignments_manual_run jumps through it by test_mode_page_cursor (01DF46 mov.w 1E0E4[PC](R0), R10, 01DF4C jsr [R10]): test_mode_coin_assignments_step_coin_to_credit test_mode_coin_assignments_step_bonus_adder test_mode_coin_assignments_step_multiplier test_mode_coin_assignments_manual_exit
01E61C  table  test_mode_network_assignments_item_jumps  u32   # test_mode_network_assignments_run jumps through it by test_mode_page_cursor (01E518 mov.w 1E61C[PC](R0), R10, 01E51E jsr [R10]): test_mode_network_assignments_toggle_communication test_mode_network_assignments_toggle_privilege_mode test_mode_network_assignments_step_cabinet_id test_mode_network_assignments_exit
03F85C  table  link_message_kind_jumps  u32   # int_vector_44 jumps through it by message_kind (03F84F mov.w 3F85C[PC](R0), R0, 03F857 jmp [R0]): 03F89B 03F89B 03F89B 03F87F
03FAC4  table  vblank_seat_inputs_jumps  u32   # int_vector_40 jumps through it by screen_index (03F5BD mov.w 3FAC4[PC](R0), R0, 03F5C5 jsr [R0]): pack_seat_inputs queue_seat_inputs
# The place a title sprite starts at (x, y), read by its index * 4: "movea.b TABLE[PC](R0), R10" then
# "mov.h [R10+], 30[R20]" (x) and "mov.h [R10+], 32[R20]" (y): title_logo_car_update 01A383,
# title_logo_stripe_update 01A438, title_seagull_fly 01A57C
struct title_place 4 rom
field title_place 00 x u16
field title_place 02 y u16
01ACA0  table  title_seagull_places  title_place        # index 0, 1: (48, 40) (60, 50), over the logo
01ACA8  table  title_logo_stripe_places  title_place    # index 0-2: (-8E, 50) (-91, 56) (-94, 5C), off the left edge
01ACB4  table  title_logo_car_places  title_place       # index 0-2: (8, 51) (4, 57) (0, 5C), the stripes' lines
local title_logo_car_update 01A383 r10 place title_place
local title_logo_stripe_update 01A438 r10 place title_place
local title_seagull_fly 01A57C r10 place title_place
# A still picture an object shows, read by its number * 16 ("movea.b TABLE[PC](R0), R10", then "movz.hw
# [R10+], R9" for animation_start and "mov.h [R10+], ..." to 3A, 34, 36, 30, 32, 3C and, but for the title's
# pictures, the handler's frames_left at 10[R20]): title_picture_draw 01A694, ignition_key_prompt_update
# 01A904, demo_caption_update 01AEAC
struct picture_record 10 rom
field picture_record 00 animation u16
field picture_record 02 palette u16
field picture_record 04 width_scale u16
field picture_record 06 height_scale u16
field picture_record 08 x u16
field picture_record 0A y u16
field picture_record 0C depth_layer u16
field picture_record 0E frames_left u16     # 0 in the title's pictures (title_picture_draw does not read it)
01AC70  table  title_pictures  picture_record                 # 3: (C) SEGA 1992 (25C), the oval board (259), SEGA (260)
01A95B  table  ignition_key_prompt_pieces  picture_record     # 2: TURN THE IGNITION KEY, the key; frames_left 24 and 30
01AF00  table  demo_caption_pictures  picture_record          # 12, by demo_caption record (demo_captions_start): animations 34F 34E 34B 34C 350-353 2E9 2EA 2EC 2ED; frames_left 180 (0-7) and 240 (8-11)
local title_picture_draw 01A694 r10 picture picture_record
local title_picture_draw 01A69A,01A6A3,01A6A8,01A6AD,01A6B2 r10 picture
local ignition_key_prompt_update 01A904 r10 piece picture_record
local ignition_key_prompt_update 01A90A,01A913,01A918,01A91D,01A922,01A927 r10 piece
local demo_caption_update 01AEAC r10 picture picture_record
local demo_caption_update 01AEB2,01AEBB,01AEC0,01AEC5,01AECA,01AECF r10 picture
# The palettes the logo and its copy flash through, a frame each (title_logo palette_list,
# title_logo_copy palette_list: "mov.w 80[R20], R10", "mov.h [R10+], 3A[R20]" at 01A250 and 01A314):
# 01AC54: 26A 26A 26B 26B 26C 26C 26C; 01AC62: 26D 26D 26E 26E 26F 26F 26C (5 of each are shown)
elements title_logo_palettes u16
01AC54  data  title_logo_flash_palettes
01AC62  data  title_logo_copy_flash_palettes
01AC44  table  title_logo_car_palettes  u16     # by car model 0-7 ("mov.h 1AC44[PC](R0), 3A[R20]", 01A374): 7E 7E 97 97 7E 8D 97 92
# The prompt under the title (coin_prompt and its pieces)
01A9BC  table  coin_prompt_lcd_texts  u32       # by message ("mov.w 1A9BC[PC](R0), F40[R25]", 01A7BB: screen lcd_scroll_request): Insert Coin(s), Insert More Coin(s), Turn the Ignition Key (01A9C8, 01A9D7, 01A9EB)
01A9C8  data  coin_prompt_lcd_strings   # the LCD's texts coin_prompt_lcd_texts points at, strings closed by 0
01A986  table  coin_prompt_car_animations  u16  # by car ("movz.hw 1A986[PC](R0), R9", 01A7DC): 401 475 4E9 55D 5D1 645 6B9 72D
01A996  table  coin_prompt_car_palettes  u16    # by car_colour ("mov.h 1A996[PC](R0), R0", 01A7EC; + 4): 7E 7E 97 97 7E 8D 97 8D
01A9A6  table  coin_prompt_message_animations  u16   # by message ("movz.hw 1A9A6[PC](R0), R9", 01A873): 2EE 2EF 2F0
01A9AC  table  coin_prompt_message_palettes  u16     # by car_colour ("mov.h 1A9AC[PC](R0), 3A[R20]", 01A883): 32 30 31 34 2F 35 36 33
01AB8E  table  credit_digit_characters  u8      # by digit ("mov.b 1AB8E[PC](R0), A[R20]", 01AAC2, 01AADE): '0'-'9', the font's frames
01AB98  table  credit_display_animations  u16   # by digit_kind ("movz.hw 1AB98[PC](R0), R9", 01AB29): 37 (the font), 1 (coins), 2 (coins a credit)
01AB9E  table  credit_display_palettes  u16     # by digit_kind ("mov.h 1AB9E[PC](R0), 3A[R20]", 01AB37): 34 36 36
# A cue of the demo captions' timeline (timeline_1AFC0, from demo_captions timeline): the frame count it
# runs at ("cmp.w R0, [R10+]", 01AE19) and its routine ("mov.w [R10+], R1" 01AE21, "jsr [R1]" 01AE24);
# 1E demo_captions_head_to_head, E1 demo_captions_checkpoint, 1A4 demo_captions_music_select, then a frame
# of 0000FFFF closes it
struct demo_caption_cue 8 rom
field demo_caption_cue 00 frame u32
field demo_caption_cue 04 routine u32
local demo_captions_run 01AE14,01AE19 r10 cue
# The kanji text viewer (unused)
01B254  table  kanji_texts  u32  kanji_text     # by number ("mov.w 1B254[PC](R0), R10", 01B18B): 1000 texts (001AF594, 001A6740, ...)
elements kanji_text s16                         # a text's characters (kanji_text_viewer_draw_line 01B1B1 "movs.hw [R10+], R13"): 0 ends a line, negative the text
elements kanji_character_rows u8                # a quarter of a 16x16 character of the kanji font (1CF000 on, 32 bytes a character: four 8x8 quarters, a byte a row): kanji_text_viewer_draw_quarter 01B1EA "movz.bw [R13+], R0"
param kanji_text_viewer_draw_quarter r13 rows kanji_character_rows
1A6340  table  kanji_row_pixels  u32            # by a byte of a character's row ("rvbyt 1A6340(R0), [R12]", 01B1ED): its eight bits as eight 4-bit pixels of pen 1 (00000000, 00000010, 00000001, ...)
# The test mode's texts, cursors and lists. A cursor table holds the low halves of the text layer's cells
# (31xxxx) where test_mode_set_cursor puts the arrow, by test_mode_cursor or test_mode_page_cursor ("mov.h
# TABLE[PC](R0), R10"); a page that starts with the cursor on its last item reads that one with the
# index known, which the C shows as a name of its own
01C378  table  test_mode_lcd_text  u32            # " LCD status OK! " for both LCDs (test_mode_start "movea.b 1C378[PC], R10", 01C349, then "mov.d [R10+], R0" twice): its bytes 0-3
01C37C  table  test_mode_lcd_text_4_to_7  u32
01C380  table  test_mode_lcd_text_8_to_11  u32
01C384  table  test_mode_lcd_text_12_to_15  u32
01C560  table  test_mode_menu_headings  u32       # by test_mode_flags bit 0 ("mov.w 1C560[PC](R0), R10", 01C3BE, 01C5C9): the text records INDIVIDUAL (01C568), CONTINUE (01C578)
01C568  data  test_mode_menu_heading_texts      # INDIVIDUAL and CONTINUE, test_mode_draw_texts' lists, which test_mode_menu_headings points at
01C588  table  test_mode_menu_cursor_cells  u16   # by test_mode_cursor (01C3D6, 01C414): F312 F412 ... F992, 13 items
01C45C  table  test_mode_page_jumps  u32          # by test_mode_cursor ("mov.w 1C45C[PC](R0), 704[R24]", 01C42A: test_mode_routine, which test_mode_frame calls): 01C5BA test_mode_memory_test test_mode_volume_adjustment test_mode_input_test test_mode_output_test test_mode_sound_test test_mode_crt_test test_mode_game_assignments test_mode_coin_assignments test_mode_network_assignments_start test_mode_bookkeeping_start test_mode_backup_data_clear_start test_mode_exit
# The sums of the program ROM's chips, at the top of the first chips' space (test_mode_memory_test sums
# 000000-03FFF7, "mov.w #3FFF8, R0" at 01C60C, and 100000-1FEFFF: R0 the halfwords of IC37 and IC36, R1
# those of IC40 and IC39): "cmp.h R0, FFFFFFF8" 01C616, "cmp.h R1, FFFFFFFA" 01C628, "cmp.h R0, FFFFFFFC"
# 01C654, "cmp.h R1, FFFFFFFE" 01C666 (the mirror of 03FFF8-03FFFF): F553 DC89 1C9B 254C
03FFF8  table  ic37_checksum  u16
03FFFA  table  ic40_checksum  u16
03FFFC  table  ic36_checksum  u16
03FFFE  table  ic39_checksum  u16
# A list of the text layer's cells (the low halves of 31xxxx addresses) a page walks ("mov.h [Rn+], R10"
# or "mov.h [R11+], R12"): the memory test's results (01CD96, 25: test_mode_memory_test_draw 01C948), the
# volume adjustment's bars (01D030, 6: test_mode_volume_adjustment_draw 01CEEA and 01CF4E), the input
# test's bars (01D3D8, 6: test_mode_input_test_draw 01D16F, R14)
elements test_mode_cells u16
01CD96  data  memory_test_result_cells
01D030  data  volume_adjustment_bar_cells
01D380  data  input_test_items                # test_mode_input_test_draw 01D160 (R11): six numbers' cells, then the switches (port, bit, cell A, cell B; FFFF ends them), then TEST's three cells: one pointer over two layouts, left untyped
01D3D8  data  input_test_bar_cells
local test_mode_memory_test_draw 01C948 r11 result_cells test_mode_cells
local test_mode_memory_test_draw 01C96B r11 result_cells
local test_mode_memory_test_draw 01C96B t1 cell
local test_mode_volume_adjustment_draw 01CEEA,01CF4E r11 bar_cells test_mode_cells
local test_mode_volume_adjustment_draw 01CF0A,01CF37,01CF62 r11 bar_cells
local test_mode_volume_adjustment_draw 01CF0A t1 range_cell_a
local test_mode_volume_adjustment_draw 01CF37 t1 range_cell_b
local test_mode_volume_adjustment_draw 01CF62 t1 position_cell
local test_mode_input_test_draw 01D16F r14 bar_cells test_mode_cells
# A memory test result's word, by the result (0 not yet, 1 testing, 2 good, 3 bad) * 6
# (test_mode_memory_test_draw 01C95F "movea.h 1CDC8[PC](R0), R13", R0 = result * 3): the colour ("movz.bh
# [R13+], R0; shl.h #8, R0": the cells' high byte) and four characters ("mov.b [R13+], R0" at 01C96E,
# 01C974, 01C97A, 01C980, each the low byte of a cell): 60 "----", 66 "TEST", 64 "GOOD", 62 "BAD "; a 0
# after them
struct memory_test_result_text 6 rom
field memory_test_result_text 00 colour u8
field memory_test_result_text 01 character_0 u8
field memory_test_result_text 02 character_1 u8
field memory_test_result_text 03 character_2 u8
field memory_test_result_text 04 character_3 u8
01CDC8  table  memory_test_result_texts  memory_test_result_text
local test_mode_memory_test_draw 01C95F r13 result_text memory_test_result_text
local test_mode_memory_test_draw 01C965,01C96E,01C974 r13 result_text
local test_mode_memory_test_words 01C9D1,01C9DA R12 tested_address
local test_mode_memory_test_halfwords 01CA6E,01CA77 R12 tested_address
local test_mode_memory_test_nibbles 01CBA0,01CBA9 R12 tested_address
# A text's characters, closed by 0: NOW TESTING (01CD87, test_mode_memory_test_blink "movea.b
# 1CD87[PC], R28" 01CC8C, "mov.b [R28+], R26"), the coin assignments' " COIN    CREDIT" (01E20E,
# test_mode_coin_assignments_draw "movea.b 1E20E[PC], R13" 01DDE9, "mov.b [R13+], R1")
elements test_mode_characters u8
01CD87  data  memory_test_now_testing_text
01E20E  data  coin_assignments_line_text
local test_mode_memory_test_blink 01CC8C r28 now_testing test_mode_characters
local test_mode_coin_assignments_draw 01DDE9 r13 line_text test_mode_characters
local test_mode_coin_assignments_draw 01DDF1 r13 line_text
01CF9C  table  volume_adjustment_cursor_cells  u16   # by test_mode_page_cursor (01CE37): ADJUST F21C, CANCEL F31C
01CF9E  table  volume_adjustment_cancel_cell  u16    # volume_adjustment_cursor_cells[1], where test_mode_volume_adjustment starts the cursor (01CE05, R0 = 1)
01D3C0  table  input_test_on_off_cells  u32     # by the input's bit (active low: "mov.w 1D3C0[PC](R1), [R10]", 01D1E4, 01D1FA, 01D23B, 01D24E, 01D264): two cells, On (6411 6412) and Off (6013 6014)
# An output of the output test (01D5C0, closed by a cell of 0): its cell, its byte in the game's variables
# (from 20E000) and its bit. test_mode_output_test_draw 01D4A1 "movea.b 1D5C0[PC], R11", then "mov.h
# [R11+], R10", "movz.bw [R11+], R12", "movz.bw [R11+], R0", "test1 R0, [R12]" and "test.h [R11]";
# test_mode_output_test_toggle 01D4CC "movea.w 1D5C2[PC](R0), R10" (by test_mode_page_cursor, 4 bytes a
# step: the record's byte 2), "movz.bw [R10+], R11", "movz.bw [R10], R0", "not1 R0, [R11]": F424 92 1
# (CHECK POINT), F524 92 3 (RACE LEADER), F624 94 0, F724 94 1, F824 92 4 (motor), then monitor B's at 93
# and 95
struct output_test_output 4 rom
field output_test_output 00 cell u16
field output_test_output 02 variable u8
field output_test_output 03 bit u8
01D5C0  table  output_test_outputs  output_test_output
local test_mode_output_test_draw 01D4A1 r11 output
local test_mode_output_test_draw 01D4A6,01D4A9,01D4AF r11 output
local test_mode_output_test_toggle 01D4CC r10 output
01D5AA  table  output_test_cursor_cells  u16    # by test_mode_page_cursor (01D406, 01D48E): F402 ... F828, EXIT FA22
01D5BE  table  output_test_exit_cell  u16       # output_test_cursor_cells[10], where test_mode_output_test starts the cursor
01D618  table  output_test_on_off_cells  u32    # by the output's bit ("mov.w 1D618[PC](R0), [R10]", 01D4BB): Off (6013 6014), On (6411 6412)
01D7C0  table  sound_test_cursor_cells  u16     # by test_mode_page_cursor (01D642, 01D68F): MONITOR A F596, MONITOR B F696, EXIT F796
01D7C4  table  sound_test_exit_cell  u16        # sound_test_cursor_cells[2], where test_mode_sound_test starts the cursor
01DCCE  table  game_assignments_cursor_cells  u16   # by test_mode_page_cursor (01DA18, 01DA56): 10 items, EXIT FA8C
01DCE0  table  game_assignments_exit_cell  u16      # game_assignments_cursor_cells[9], where test_mode_game_assignments starts the cursor
01DCE4  table  steering_wheel_reaction_texts  u32   # by steering_wheel_reaction ("mov.w 1DCE4[PC](R0), R10", 01DB3F): text records 01DCF4, 01DCFC
01DCEC  table  advertise_sound_texts  u32           # by advertise_sound ("mov.w 1DCEC[PC](R0), R10", 01DB4F): text records 01DD04, 01DD0C
01DCF4  data  game_assignments_value_texts   # the text records steering_wheel_reaction_texts and advertise_sound_texts point at, two each, lists for test_mode_draw_texts: the value's cell (F8C0 the steering wheel reaction's, F9C0 the advertise sound's) and the value in the test mode's characters (9B 13 14, 9B 11 12), each list closed by 0; 01DCF4-01DD13
# The settings a page's EXIT checks, as the low bytes of their addresses in settings_magic's page, closed
# by 0 ("movea.b TABLE[PC], R10", "mov.b [R10+], R20", "cmp.b [R20], 3C[R20]": the copy 3C bytes on):
# 01DD14 (test_mode_game_assignments_exit 01DBA9: 30 32-37 24 0D), 01E44D (test_mode_coin_assignments_exit
# 01E0B0: 10 11 13 15 14), 01E6E0 (test_mode_network_assignments_exit 01E5F7: 20 21 23 22)
elements test_mode_setting_places u8
01DD14  data  game_assignments_setting_places
01E44D  data  coin_assignments_setting_places
01E6E0  data  network_assignments_setting_places
local test_mode_game_assignments_exit 01DBA9 r10 setting_places test_mode_setting_places
local test_mode_game_assignments_exit 01DBB3 r10 setting_places
local test_mode_coin_assignments_exit 01E0B0 r10 setting_places test_mode_setting_places
local test_mode_coin_assignments_exit 01E0B5 r10 setting_places
local test_mode_network_assignments_exit 01E5F7 r10 setting_places test_mode_setting_places
local test_mode_network_assignments_exit 01E5FC r10 setting_places
01E200  table  coin_assignments_cursor_cells  u16   # by test_mode_page_cursor (01DD48, 01DD86): COIN/CREDIT SETTING F48C, MANUAL SETTING F78C, EXIT F88C
01E206  table  coin_manual_cursor_cells  u16        # by test_mode_page_cursor (01DEEC, 01DF2B): COIN TO CREDIT F402, BONUS ADDER F502, MULTIPLIER F602, EXIT F902
01E20C  table  coin_manual_exit_cell  u16           # coin_manual_cursor_cells[3], where test_mode_coin_assignments_manual_start starts the cursor
01E220  table  coin_setting_descriptions  u32   # by coin_setting ("mov.w 1E220[PC](R0), R11", 01DDCC): pairs of coins and credits ("movz.bw [R11+], R0", up to five), closed by 0 or by a negative byte and a text (FREE PLAY, MANUAL SETTING) closed by 0
01E28C  data  coin_setting_description_records   # the descriptions coin_setting_descriptions points at: (coins, credits) pairs, closed by 0, or by FF and a text closed by 0
# A coin/credit setting (01E3E8, by coin_setting * 4: test_mode_coin_assignments_next_setting 01DE69
# "movea.w 1E3E8[PC](R0), R10", then "mov.b [R10+], ..." to 10, 13, 11 and 12[R20]): coins_per_credit,
# bonus_adder, first_chute_multiplier, second_chute_multiplier; a negative first byte is FREE PLAY (the 26th,
# FF 10 11 13)
struct coin_setting_record 4 rom
field coin_setting_record 00 coins u8
field coin_setting_record 01 bonus u8
field coin_setting_record 02 first_multiplier u8
field coin_setting_record 03 second_multiplier u8
01E3E8  table  coin_setting_records  coin_setting_record
local test_mode_coin_assignments_next_setting 01DE69 r10 setting
local test_mode_coin_assignments_next_setting 01DE8F,01DE94 r10 setting
01E67C  table  network_assignments_cursor_cells  u16   # by test_mode_page_cursor (01E4AA, 01E4FD): 4 items, EXIT F80C
01E682  table  network_assignments_exit_cell  u16      # network_assignments_cursor_cells[3], where test_mode_network_assignments_start starts the cursor
01E684  table  communication_texts  u32                # by stand_alone ("mov.w 1E684[PC](R0), R10", 01E52F): text records NETWORK 01E698, STAND-ALONE 01E6AA
01E68C  table  privilege_mode_texts  u32               # by test_mode_privilege_mode ("mov.w 1E68C[PC](R0), R10", 01E53D): text records SLAVE 01E6BC, MASTER 01E6C8
01E698  data  privilege_mode_text_lists   # the test_mode_draw_texts lists privilege_mode_texts points at: NETWORK, STAND-ALONE, SLAVE, MASTER, ISDN
# A privilege mode's settings (01E6E5, by test_mode_privilege_mode * 2: test_mode_network_assignments_
# toggle_privilege_mode 01E5D4 "movea.h 1E6E5[PC](R0), R10", "mov.b [R10+], 21[R20]" link_master,
# "mov.b [R10+], 23[R20]" isdn_mode): SLAVE 0 0, MASTER 1 0, ISDN 0 1
struct privilege_mode_setting 2 rom
field privilege_mode_setting 00 master u8
field privilege_mode_setting 01 isdn u8
01E6E5  table  privilege_mode_settings  privilege_mode_setting
local test_mode_network_assignments_toggle_privilege_mode 01E5D4 r10 setting
# A car colour's name on the bookkeeping's second page, by the colour * 6 (test_mode_bookkeeping_draw_
# histogram 01E8F3 "movea.h 1ED94[PC](R0), R13", then "mov.b [R13+], R0" six times): YELLOW, RED, BLUE,
# SILVER, BLACK, PINK, ORANGE, GREEN
01ED94  data  car_colour_names
local test_mode_bookkeeping_draw_histogram 01E8F3 r13 colour_name test_mode_characters
local test_mode_bookkeeping_draw_histogram 01E8FE,01E904,01E90A,01E910 r13 colour_name
# A digit of a time in hundredths (01E970, test_mode_bookkeeping_draw_histogram 01E942 "movea.b
# 1E970[PC], R13"): the divisor ("mov.w [R13+], R2; divux R2, R0") and how far on the next digit's cell
# is ("add.w [R13+], R12"); a negative divisor closes it ("test.w [R13]"): 60000 2, 6000 4, 1000 2, 100 4,
# 10 2, 1 6
struct time_digit_step 8 rom
field time_digit_step 00 divisor u32
field time_digit_step 04 cell_step u32
01E970  data  time_digit_steps
local test_mode_bookkeeping_draw_histogram 01E942 r13 digit_step time_digit_step
local test_mode_bookkeeping_draw_histogram 01E94A,01E956 r13 digit_step
01EEAE  table  backup_data_clear_cursor_cells  u16   # by test_mode_page_cursor (01EDE1, 01EE10): YES F51A, NO F61A
01EEB0  table  backup_data_clear_no_cell  u16        # backup_data_clear_cursor_cells[1], where test_mode_backup_data_clear_start starts the cursor
# SELECT BY SERVICE BUTTON AND PUSH TEST BUTTON, a text record of test_mode_draw_texts' (its cell, then
# colour codes and characters closed by 0; test_mode_draw_instructions 01F02C "movea.b 1F282[PC], R10"):
# test_mode_backup_data_clear_run reads its first halfword, the line's cell, to grey the line out ("mov.h
# 1F282[PC], R10", 01EE4F)
01F282  table  test_mode_instructions_text  u16
# The test mode's text palettes for each screen, each after its size in bytes (test_mode_set_up_colours:
# "movea.b 1F302[PC], R10" 01EF8C and "movea.b 1F504[PC], R10" 01EFA2, then "mov.h [R10+], R0", the size,
# 200, and "movcu.h [R10], R0, ..." the palettes after it)
01F302  table  test_mode_palettes_1_bytes  u16
01F304  data  test_mode_palettes_1
01F504  table  test_mode_palettes_2_bytes  u16
01F506  data  test_mode_palettes_2
01F706  data  unused_words_01F706            # unused: 0000 00CD 0000 00CA 0000 00CA 0000, after test_mode_palettes_2's 200 bytes
01F714  data  unused_fill_01F714             # unused: FF up to road_object_streams (020800)
# The texts the pages draw: test_mode_draw_texts' records (a cell, then colour codes and characters closed
# by 0, again until a cell of 0), and draw_text's for the credits line (x, y, a third word, then the text)
01AB62  data  credit_free_play_text            # FREE PLAY (credit_display_update)
01AB72  data  credit_singular_text             # Credit
01AB80  data  credit_plural_text               # Credits
01C490  data  test_mode_menu_text              # TEST MODE and the twelve items (test_mode_menu)
01CC9C  data  memory_test_page_text            # MEMORY TEST, the chips' names, NOW TESTING (test_mode_memory_test_draw)
01CF71  data  volume_adjustment_page_text      # VOLUME ADJUSTMENT, ADJUST, CANCEL (test_mode_volume_adjustment)
01CFA0  data  volume_adjustment_controls_text  # MONITOR A and B, STEERING WHEEL, ACCELERATOR, BRAKE
01D021  data  volume_adjusting_text            # ADJUSTING (test_mode_volume_adjustment_select)
01D03C  data  volume_adjustment_bars_text      # the six empty bars (tile 03), drawn each frame (test_mode_volume_adjustment_draw)
01D30A  data  input_test_bars_text             # the input test's bars and inputs' names (test_mode_input_test_draw)
01D4F8  data  output_test_page_text            # OUTPUT TEST and the ten outputs (test_mode_output_test)
01D788  data  sound_test_page_text             # SOUND TEST, MONITOR A No., MONITOR B No., EXIT (test_mode_sound_test)
01DBF8  data  game_assignments_page_text       # GAME ASSIGNMENTS and its items (test_mode_game_assignments)
01E0F4  data  coin_assignments_page_text       # COIN ASSIGNMENTS, COIN/CREDIT SETTING, MANUAL SETTING, EXIT (test_mode_coin_assignments_show)
01E13F  data  coin_manual_page_text            # COIN ASSIGNMENTS' MANUAL SETTING page (test_mode_coin_assignments_manual_start)
01E62C  data  network_assignments_page_text    # NETWORK ASSIGNMENTS and its items (test_mode_network_assignments_start)
01EE79  data  backup_data_clear_page_text      # BACKUP DATA CLEAR, YES (CLEAR), NO (CANCEL) (test_mode_backup_data_clear_start)
01EEB2  data  backup_data_clear_completed_text # COMPLETED (test_mode_backup_data_clear_run)
# The interrupts
03F82A  table  vblank_timer_period  u16         # int_vector_40 starts timer 0 with it ("mov.h 3F82A[PC], D00008", 03F50C): 1
03F82C  table  lcd_timer_period  u16            # int_vector_43 starts timer 0 again with it ("mov.h 3F82C[PC], D00008", 03F7F5): 1
03FACC  table  screen_vblank_counters  u32      # by the screen's index ("mov.w 3FACC[PC](R0), R0; inc.b [R0]", 03F610): screen_1_vblanks (20E0FE), screen_2_vblanks (20E0FC)

# ======== the code nothing that runs reaches (naming batch U) ========
0010EB  func  bar_picture_bar_start
001141  func  bar_picture_bar_fly
0011AB  func  bar_picture_bar_draw
0107A0  func  clear_tile_page
017DB0  func  backdrop_far_update
018050  func  backdrop_flashing_update
01B1B1  func  kanji_text_viewer_draw_line
01B1CD  func  kanji_text_viewer_draw_character
01B1E7  func  kanji_text_viewer_draw_quarter
01B200  func  kanji_text_viewer_character_address
01B20C  func  kanji_text_viewer_draw_number
comment bar_picture_start Unused: starts the 81 bars of a picture, an object each (start_object, handler bar_picture_bar_start) from the 8-byte records of bar_picture_bars (ended by a negative first word): its place on the screen into target_x, target_y and its two scales into scales. The places make two rows across the screen (y 19-107 and 139-195); what the bars show cannot be told without drawing them.
comment bar_picture_bar_start Only unused code reaches it (bar_picture_start): sets up a bar of the picture: drawn on the screen (draw_mode 0) with animation 0 and palette 25, its width_scale and height_scale from scales, depth layer 3, at the middle of the screen (x A0, y 70), with a random speed_x and speed_y (-8 to 7: a byte of RANDOM_GENERATOR shifted right 4); then bar_picture_bar_fly.
comment bar_picture_bar_fly Only unused code reaches it (bar_picture_start): each frame the bar's speed_x and speed_y grow by 1 toward its place (target_x, target_y) and it moves by them, swinging about it; an axis whose next step lands exactly on the place is put there for that frame. When both land on the same frame it shows frame D and stays (bar_picture_bar_draw). Drawn every frame (draw_object).
comment bar_picture_bar_draw Only unused code reaches it (bar_picture_start): the bar in its place: draws it (draw_object) each frame.
comment route_map_leg_car_end Unused: ends the object (flags 0). It follows the code of route_map_leg_car_show's last state (draw_object), whose state table lists only states 0 and 1.
comment lap_timer_spare_return Unused: does nothing (a lone return after lap_timer_update's last jump to draw_object).
comment stage_entry_spare_return Unused: does nothing (a second return after stage_entry_update's).
comment time_to_text_thousandths Unused: time_to_text for a time in thousandths of a second: R0 / 10 (into hundredths), then time_to_text at R10 (it runs on into it).
comment network_check_delay Unused: a busy wait: counts 3000 down to 0 and returns. It sits between network_check_wait_isdn and network_check_greeting.
comment clear_tile_pages Unused: clears the tilemap pages from the one at R9 (its offset in video RAM) down to the first, 400 bytes apart (clear_tile_page each).
comment clear_tile_page Only unused code reaches it (clear_tile_pages): clears the tilemap page at R9 (300000 + R9: 200 halfwords copied from the zeros at 100800).
comment unrolled_copy Unused: meant to copy R0 & 3F8 bytes from R10 to R11 by jumping into a run of 8-byte moves at 0109B4, but the jump (200 less half the count from the run's start) is worked out for 128 moves and the run has 64: it copies the count less 200 bytes, nothing for 200, and for less it jumps past the run into the data at 010AB5.
comment unpack_list Unused: unpacks a list of packed blocks at once (unpack): 8-byte entries, the packed data's address and where to unpack it, closed by a negative entry (the first is taken without the check). unpack_tile_pages does the same for a list of tile pages.
comment queue_unpack_list Unused: queues the entries of an unpack_list list (the packed data's address, where to unpack it; closed by a negative entry, the first taken unchecked) as they are in the screen's ring unpack_queue (unpack_write_place), with unpack_state set to say there is work, for unpack_queued_step. queue_tile_pages does the same for a list of tile pages.
comment bookkeeping_increment8 Unused: adds one to the 8-bit bookkeeping counter at R7 (and its backup's, 7C on) unless it is at FF, with the checksum (bookkeeping_update_checksum).
comment bookkeeping_add8 Unused: adds R9 to the 8-bit bookkeeping counter at R7 and to its backup's (7C on), with the checksum; past FF it stays at FF (and the backup's is left as it was: the code writes R7 twice), as bookkeeping_add16 does.
comment bookkeeping_set32 Unused: sets the 32-bit bookkeeping value at R7 and its backup's (7C on) to R9, with the checksum.
comment bookkeeping_set8 Unused: sets the 8-bit bookkeeping value at R7 and its backup's (7C on) to R9, with the checksum.
comment bookkeeping_check_block Unused: checks the bookkeeping block (701F02) against its checksum (701F00) and resets both it and its backup (bookkeeping_reset) when they differ; unlike bookkeeping_check it does not try the backup.
comment load_shadowed_text_font Unused: builds the text layer's first 128 characters (318000, where load_text_font puts its 384) from the one-bit font at 103C20 (8 bytes a character, a bit a pixel): the character's pixels in pen 1, and a shadow in pen 2 one pixel right and one row down under them.
comment erase_text_layer_to_blank_character Unused: erases a string from the text layer: from the cell of the print_text_layer record R19, writes 0 cells until the next cell's character is 0.
comment print_text_layer_halfwords Unused: print_text_layer with the characters as halfwords: from the record R19, the cell's address (310000 + its first halfword), the attribute byte, then the characters, 16 bits each (ORed with the attribute << 8, so they can reach past 255: the font has 384), closed by a 0 halfword.
comment erase_text_layer_to_blank_cell Unused: erases a string from the text layer as erase_text_layer_to_blank_character does, but until the next cell is all 0 (character and attribute).
comment print_hex_halfword Unused: writes a number's low halfword as four hex digits on the text layer, ending before the cell it is given, with the attribute byte it is given (print_hex_digits).
comment print_hex_24_bits Unused: writes a number's low 24 bits as six hex digits on the text layer, as print_hex_halfword does (print_hex_digits).
comment print_hex_word Unused: writes a 32-bit number as eight hex digits on the text layer, as print_hex_halfword does (print_hex_digits, which it runs on into).
comment bcd_to_binary Unused: converts R0's eight decimal digits (four bits each, the highest first) into a number, returned in R0: eight times, the result so far times 10 plus the next digit. The inverse of binary_to_bcd.
result bcd_to_binary R0 value
comment reserve_object_slot Unused: takes the first free object slot as start_object does (FF into its byte of the 7C at screen - 7FF0) and clears 100 bytes for it, but at the slot byte's address with its low half shifted 8 left (201000 + 100 * slot for screen 1), not where start_object puts slot n (screen - 7C00 + 100 * n), and without making it live, its slot number or the frame's list; with no slot free, the spare object at screen - 7F00. Returns the object.
result reserve_object_slot R21 object object
comment free_object_slot Unused: frees the slot of the object R21: clears the slot byte (screen - 7FF0) numbered by bits 8-15 of the object's address, which is not the object's own slot: for start_object's slot n it clears slot n + 4, for reserve_object_slot's slot n slot n + 10.
comment request_second_sound Unused: puts sound R0 in the screen's second ring of 32 sound requests (second_sound_queue_write, the requests from 842; send_sound_requests sends them to the command byte 8 after the first ring's), as request_sound does for the first: while demo_flags bit 8 is set only the sounds the table at 01204E (demo_second_sounds) allows, and only with advertise_sound set.
comment road_row_pair_crash_check_unflipped Unused (called only by unused_0129D0, an unused handler that goes on into road_row_pair_draw's code): road_row_pair_crash_check with kind 0 (a crash), but the mirrored item's hit_box is only moved across the road's centre, not flipped: its offsets are added to the mirrored place as they are. For a box even about its middle the two are the same.
comment backdrop_far_start Unused object handler: sets up a sprite on the background as backdrop_near_start does (from its data the animation, palette, panorama_x, height and half_width; draw_mode A, layer 1; straight to state 1 when screen background_at_start is set); then backdrop_far_update.
comment backdrop_far_update Only unused code reaches it (backdrop_far_start): keeps the sprite on the background's panorama at the panorama's own speed (x from the car's view_yaw, a quarter of it until screen background_changing is set, less panorama_x), y from the background's height (screen background_scroll_y) and height. By state: 0 waits until it is off the screen; 1 draw_object while on the screen; off it, it ends once leaving.
comment backdrop_flashing_start Unused object handler: sets up a sprite on the background as backdrop_far_start does, with other_palette 120; then backdrop_flashing_update.
comment backdrop_flashing_update Only unused code reaches it (backdrop_flashing_start): as backdrop_far_update (on the panorama at its speed), animated (animation_advance), and each frame its palette swaps with other_palette, so it flashes between its own palette and palette 120.
comment kanji_text_viewer_update Unused object handler: shows the Japanese texts of the table at 01B254 (1000 of them) by number, a three-digit number chosen with the buttons. By state: 0 stops the tile unpacking (unpack_state), sets up video RAM (init_video) with the tilemaps off and the bitmap layer on at 4 bits a pixel, scroll 0, palette FF (video_registers bit B cleared, video_registers[1] = F, video_registers[68], video_registers[69], video_registers[70]: words 00, 02, 88, 8A and 8C of the video registers' copy, sent as send_video_registers asks), the number 0 (screen route_map_signals-5806), the cursor (x) on the units; 1 buttons_pressed bits 3 and 2 move the cursor over the three digits, bits 1 and 0 step the digit under it (0-9, wrapping); on screen 1 the number is written at text cell (5,10) (kanji_text_viewer_draw_number) with the cursor's digit blinking as '*' (blink_count), and the text drawn on the bitmap a line at a time (kanji_text_viewer_draw_line) from 16 rows and 128 pixels in, 16 rows a line; 2 draws the text only; 3 nothing (nothing sets states 2 and 3).
comment kanji_text_viewer_draw_line Only unused code reaches it (kanji_text_viewer_update): draws a line of the text at R10 on the bitmap layer from R11: each halfword a character (kanji_text_viewer_character_address, kanji_text_viewer_draw_character, 16 pixels on); 0 ends the line, a negative one the text (R4 = -1).
comment kanji_text_viewer_draw_character Only unused code reaches it (kanji_text_viewer_draw_line): draws a 16x16 character on the bitmap layer at R11 from its 32 bytes at R13: four 8x8 quarters (kanji_text_viewer_draw_quarter), upper left, upper right, lower left, lower right.
comment kanji_text_viewer_draw_quarter Only unused code reaches it (kanji_text_viewer_draw_character): draws eight rows of eight one-bit pixels (a byte each, from R13) at R12 on the bitmap layer, 100 bytes a row, each byte spread by the table at 1A6340 into eight 4-bit pixels of pen 1.
comment kanji_text_viewer_character_address Only unused code reaches it (kanji_text_viewer_draw_line): the address of character R13 of the kanji font at 1CF000 (8 bytes a step: a character is 32).
comment kanji_text_viewer_draw_number Only unused code reaches it (kanji_text_viewer_update): writes R4 (0-999) as three decimal digits on the text layer from cell R3 (attribute 60).
comment test_mode_duration_to_seconds Unused: turns a duration kept as five bytes at R10 (seconds, minutes and hours a byte each, then days a halfword) into seconds: ((days * 24 + hours) * 60 + minutes) * 60 + seconds, in R0 (R1 the carry).
result test_mode_duration_to_seconds R0 seconds
comment test_mode_split_minutes_seconds Unused: writes a time of R0 seconds at R10 as two bytes: the seconds (R0 mod 60), then the minutes (R0 / 60).
scoped object bar_picture 10 speed_x s16
scoped object bar_picture 12 speed_y s16
scoped object bar_picture 80 target_x s16
scoped object bar_picture 82 target_y s16
scoped object bar_picture 84 scales u32
scoped object backdrop_flashing 0D leaving u8
scoped object backdrop_flashing 10 other_palette u16
scoped object backdrop_flashing 20 panorama_x u16
scoped object backdrop_flashing 24 height u16
scoped object backdrop_flashing 28 half_width u16
scoped object backdrop_flashing 80 data u32 backdrop_record
scoped object kanji_text_viewer 10 blink_count u8

# ======== the sound board's shared RAM as the game uses it (the sound program's names: sound_symbols.txt) ========
# Each screen has a page: 700700 screen 1's, 700800 screen 2's (the sound program's E700 and E800).
700700  io  SOUND_COMMAND_1  u8
700800  io  SOUND_COMMAND_2  u8
700708  io  SOUND_SECOND_COMMAND_1  u8
700710  io  SOUND_ENGINE_REVS_1  u8
700712  io  SOUND_ENGINE_REQUESTS_1  u8
700713  io  SOUND_ENGINE_SAMPLE_1  u8
700714  io  SOUND_ENGINE_LOUDNESS_1  u8
700718  io  SOUND_TYRE_NOISE_1  u8
# A screen's page of the RAM the sound program shares (700700 screen 1's, 700800 screen 2's): what the
# engine and tyre noise code writes through the screen's index * 100 (sound_page) the names above say for screen 1's
struct screen_sound_page 100 board
field screen_sound_page 00 command u8
field screen_sound_page 08 second_command u8
field screen_sound_page 10 engine_revs u8
field screen_sound_page 12 engine_requests u8
field screen_sound_page 13 engine_sample u8
field screen_sound_page 14 engine_loudness u8
field screen_sound_page 18 tyre_noise u8
700810  io  SOUND_ENGINE_REVS_2  u8
700812  io  SOUND_ENGINE_REQUESTS_2  u8

# ======== the screen's and the car's fields left (naming batch K) ========
field screen 10 eye_distance u16
field screen 12 draw_distance u16
field screen 18 view_pitch_base u16
field screen 19E colour_offset_select u16   # mixer register 3E as the screen keeps it: which colour offset each layer takes (bit 15, and a bit for each layer); init_mixer and the vertical blank copy it with 40-4A as halfwords, step_screen_fade sets its high byte to C0 ("mov.b #C0, [R19+]" 011713, at 19F)
field screen 200 road_top_line u16
field screen 202 background_changing u8
field screen 203 stage_background_change u8
field screen 204 stage_background_branch u8
field screen 205 backdrops_leaving u8
field screen 206 background_fading u8
field screen 207 background_at_start u8
field screen 208 road_palette_fades u32 rom
field screen 20C background_scroll_y u16
field screen 41 link_event_data_1 u8
field screen 42 link_event_data_2 u8
field screen 43 link_event_data_3 u8
field screen 44 link_event_data_4 u8
field screen 500 own_hit_box u32 car_hit_box
field screen 510 hit_box_count u32
field screen 5678 text_depth_list_head u16
field screen 567A text_depth_list_tail u16
field screen 5800 route_map_signals u32   # what the route map tells its car, its landmarks and its signs (route_map_update); the unused viewer of the Japanese texts keeps the number of its text in its low half (kanji_text_viewer_update)
field screen 5801 title_logo_shine u8
field screen 5802 kanji_text_units s16
field screen 5804 kanji_text_tens s16
field screen 5806 kanji_text_hundreds s16
field screen 60 leader_record u32 race
field screen 64 last_record u32 race
field screen 68 ahead_record u32 race
field screen 6C behind_record u32 race
field screen 70 leader_player u8
field screen 71 last_player u8
field screen 72 ahead_player u8
field screen 73 behind_player u8
field screen 73E branch_road_length u16
field screen 822 sound_start_cleared u8
field screen 900 palette_upload_count u32
field screen 904 palette_uploads u32[7F]   # the queued palette uploads (a colour record, bit 31 the list flag), palette_upload_count of them: queue_palette_upload, upload_queued_palettes (the 80th would be unpack_state at B00)
field screen 9E next_attract_car u8
field screen A0 first_stage u8
field screen A1 route_stage u8
field screen A2 built_stage_level u8
field screen A3 built_stage u8
field screen A4 current_stage_level u8
field screen A5 route_stage_level u8
field screen A6 current_stage u8
field screen B8 horizon_line u16
field screen D0 shown_view u32 view
field screen D4 view_ring_slot u8
field screen F00 random_state u32
field screen F04 turntable_depth_offset s32
field screen F08 turntable_radius_offset s32
field screen F0E palette_fades_started u8
field screen F0F nearing_fork u8
field screen F50 shown_speed u16
field screen F52 maximum_speed s16
field screen F54 speed_sum u32
field screen F58 speed_samples u16
field screen F80 traffic_racer_list u32 racer_numbers
field screen F84 visible_stretch_count u16
field screen FA6 traffic_draw_distance u16
field screen FA8 traffic_count u8
field car 137 crash_body_shown u8
field car C2 course_records_read u16
field car CA new_branch u8
field car CE road_event u8

# ======== the race records' fields and the variables left (naming batch M) ========
field race 03 master_advertise_sound u8
field race 04 master_steering_wheel_reaction u8
field race 05 master_coins_per_credit u8
field race 06 master_first_chute_multiplier u8
field race 07 master_bonus_adder u8
field race 08 master_coin_setting u8
field race 09 master_free_play u8
field race 0A master_game_difficulty u8
field race 14 record_name_rest u16
field race 21 race_order_1 u8
field race 22 race_order_2 u8
field race 23 race_order_3 u8
field race 24 race_order_4_7 u32
field race 29 players_this_side u8
field race 2A players_other_side u8
field race 2B link_status u8
field race 2C link_buttons u8
field race 2D link_wheel u8
field race 2E link_gas u8
field race 2F link_brake u8
field race 30 world_x s32
field race 34 world_y s32
field race 38 world_z s32
field race 3C animation u16
field race 3E palette u16
field race 40 segment_fraction u16
field race 42 segment u16
field race 44 road_x s16
field race 46 window_segment u16
field race 48 car_choice u8
field race 49 model u8
field race 4A frame u8
field race 4B view_slot u8
field race 4C speed u16
field race 4E sideways_speed s16
field race 50 wheel_effect_sides u8
field race 51 wheel_effect_1 u8
field race 52 wheel_effect_2 u8
field race 53 hard_acceleration u8
field race 54 segment_pitch u16
field race 56 bounce_height s16
field race 58 car_flags u16
field race 5D started u8
field race 5E finished u8
20E000  var  waiting_task_frame u32
20E00E  var  debug_timer_rounds u8
20E022  var  sprite_lists_set_up u8
20E027  var  send_video_registers u8
20E02E  var  cleared_on_race_over u8
20E038  var  link_wait_frames_start u16
20E094  var  port_g_outputs[2] u8
20E0A4  var  seat1_bookkeeping_byte u8
20E0AC  var  seat2_bookkeeping_byte u8
20E0D0  var  wheel_motor[2] u8
20E0FD  var  screen_2_vblanks_high u8
20E0FF  var  screen_1_vblanks_high u8
20E104  var  second_io_chip_port_f u8
20E290  var  scroll_targets[16] u16   # the four tile layers' scroll targets, x and y two halfwords each (the scroll in the second: 20E292 NBG0's x), written a halfword at a time (video_register_words: title_screen_layer_setups, road_surface_start) and read as one word (vblank_update_scrolls)
20E2B0  var  tile_banks[4] u8
20FC46  var  race_copy_window_segments u16
00E0A0  table  race_copy_offsets  u32  race@20E000   # by player: 1C00, 1C80 ... 1F80, a race_copy record's offset from the game's variables (GAME_VARIABLES + it: 20FC00 on)

# ======== the objects' fields left (naming batch L) ========
comment title_rider_draw Draws a rider of a title car (title_car_driver, title_car_passenger) on its car: at the car's x and y plus its x_offset and y_offset, bobbing with the car (bit 0 of the car's frames), at the size title_rider_scales gives for the model.
scoped object turntable 1C size u16
scoped object step_palette 18 palette_list u32 object_palette_steps
scoped object time_digits 20 units_x u16
scoped object time_digits 80 units_flip s8
scoped object time_digits 81 units_digit u8
scoped object time_digits 82 units_width u16
scoped object time_digits 84 units_remaining u32
scoped object time_digits 88 tens_flip s8
scoped object time_digits 89 tens_digit u8
scoped object time_digits 8A tens_width u16
scoped object time_digits 8C tens_remaining u32
scoped object time_digits 90 hundreds_flip s8
scoped object time_digits 91 hundreds_digit u8
scoped object time_digits 92 hundreds_width u16
scoped object time_digits 94 hundreds_remaining u32
scoped object race_car 84 body_attributes u16
scoped object race_car 8C first_body_piece u16
scoped object race_car 8E first_body_animation u16
scoped object race_car 90 driver_places u32 rom
scoped object race_car 94 driver_animation u16
scoped object race_car 96 driver_palette u16
scoped object race_car 98 driver_gesture_mask u8
scoped object race_car 9A driver_frame u8
scoped object race_car 9B driver_frames u8
scoped object race_car A0 passenger_places u32 rom
scoped object race_car A4 passenger_animation u16
scoped object race_car A6 passenger_palette u16
scoped object race_car A8 passenger_gesture_mask u8
scoped object race_car AA passenger_frame u8
scoped object race_car AB passenger_frames u8
scoped object race_car BF hard_acceleration_frame u8
scoped object race_car C0 spray_2_animations u32 rom
scoped object race_car C4 spray_2_places u32 rom
scoped object race_car C8 spray_2_effect u32
scoped object race_car CC spray_2_frame u8
scoped object race_car CD spray_2_side u8
scoped object race_car CE spray_2_kind u8
scoped object race_car D0 spray_1_animations u32 rom
scoped object race_car D4 spray_1_places u32 rom
scoped object race_car D8 spray_1_effect u32
scoped object race_car DC spray_1_frame u8
scoped object race_car DD spray_1_side u8
scoped object race_car DE spray_1_kind u8
scoped object race_car E1 gesture_shown u8
scoped object race_car E2 last_place u8
scoped object race_car E3 view u8
scoped object isdn_status 10 blink_counter u8
scoped object route_map_landmark 09 index_then_half_rate u8
scoped object route_map 12 first_legs_left u8
scoped object route_map A4 tile_bank_address u32 tile_bank_values
scoped object route_map BC second_tile_bank_address u32 tile_bank_values
scoped object ranking_background A0 cleared_scroll_x_address u32 video_register_words
scoped object ranking_background A4 cleared_scroll_y_address u32 video_register_words
scoped object ranking_course_banner 14 ranking u32 object.ranking
scoped object title_screen 84 tile_bank_address u32 tile_bank_values
scoped object title_screen 88 pages_address u32 page_select
scoped object title_screen 94 second_tile_bank_address u32 tile_bank_values
scoped object title_screen 98 second_pages_address u32 page_select
scoped object player_car 0E state_high u16
scoped object player_car 8C pitch u16
scoped object player_car B2 last_negated_speed u16
scoped object traffic 2E sideways_speed s16
scoped object traffic_follower 84 stop_distance u16
scoped object pulled_vehicle 84 stop_distance u16
scoped object flagman 58 trigger_position s16
scoped object santa_sleigh 58 trigger_position s16
scoped object goal_parade 58 trigger_position s16
scoped object sounding_scenery 60 sound_entry u32 rom
scoped object palette_fade 28 upload_length u16
scoped object palette_fade 2C upload_colours u32
scoped object checkpoint_board F0 row_steps u8[8]   # each row's step (checkpoint_board_row_state_jumps), by the row's player
scoped object ranking_background 14 ranking u32 object.ranking
scoped object name_entry_letter 14 name_entry u32 object.name_entry
scoped object name_entry_lcd 14 name_entry u32 object.name_entry
scoped object route_map_leg 14 map u32 object.route_map
scoped object route_map_leg_car 14 leg u32 object.route_map_leg
scoped object route_map_checkpoint 14 leg u32 object.route_map_leg
scoped object route_map_car 14 route_map u32 object.route_map
scoped object car_attendant 14 car_select u32 object.car_select
scoped object turntable_car 14 car_select u32 object.car_select
scoped object turntable_scenery 14 car_select u32 object.car_select
scoped object select_car_heading 14 car_select u32 object.car_select
scoped object select_instruction 14 car_select u32 object.car_select
scoped object transmission_choice 14 car_select u32 object.car_select
scoped object car_caption 14 car_select u32 object.car_select
scoped object car_gears_caption 14 car_select u32 object.car_select
scoped object waiting_banner 14 car_select u32 object.car_select
scoped object car_select_entries 14 car_select u32 object.car_select
scoped object choice_flag 14 entries u32 object.car_select_entries
scoped object stacked_choice_flag 14 below u32 object.choice_flag
scoped object choice_flag_number 14 flag u32 object.choice_flag
scoped object coin_prompt_message 14 prompt u32 object.coin_prompt
scoped object road_tiles_change 14 road u32 object.road_surface
scoped object entry_countdown 14 car_ring u32 object.entry_car_ring
scoped object car_radio 18 title u32 object.song_title
scoped object rider_gesture 14 car u16 object.race_car
scoped object goal_actor 14 scene u32 object.race_car
scoped object title_rider 09 model u8
scoped object title_rider 10 x_offset s16
scoped object title_rider 12 y_offset s16
scoped object title_rider 14 car u32 object.title_car
field object 01 flags_high u8
field object 1C position s16
field object 20 x_offset s16
field object 24 y_offset s16
field object 28 position_fraction u16
field object 3F side s8
field object 41 frame_time u8
field object 42 frame_countdown s8
field object 50 previous_place u32 sprite_place
local race_cars_start 0096BE,0096DB R21 occupant object.race_car_occupant
local race_car_start_ending 0146F4 R21 actor object.goal_actor
local traffic_spawner_update 0137FF R21 traffic_object object.traffic
local traffic_car_start_convoy 0138A5,0138D2 R11 leader object.traffic
local traffic_figure_start_team 013B5D,013B8A R11 leader object.traffic
local road_object_stream_read 01272C,01273B R10 entry road_object_stream_entry   # 01272C "mov.w 80[R20], R10": the stream's next entry; 01273B: what road_object_stream_start_object hands back, the entry after its own (the other commands leave the reader)
param road_object_stream_start_object R10 entry road_object_stream_entry+4   # 4 bytes into the entry: road_object_stream_read has read its position and command ([R10+] at 01273D, 012733)
local flashing_scenery_update 012923 R10 record flashing_scenery_record   # 012923 "mov.w 18[R20], R10" in state 0: the record (01292A puts the palettes' address in field 18 in its place)
local flashing_scenery_update 01298C,012997 R10 palettes flashing_scenery_palettes   # 01298C "mov.w 18[R20], R10" in states 1 and 2: the next palette; 012997 "add.w R0, R10": back to the list's start
local aurora_update 012A3B R10 record aurora_record   # 012A3B "mov.w 18[R20], R10" in state 0: the record (012A3F puts the animations' address in field 18 in its place)
local aurora_next_animation 012AAB,012AB6 R10 animations aurora_animations   # 012AAB "mov.w 18[R20], R10": the next animation; 012AB6 "add.w R0, R10": back to the list's start
local traffic_car_start 013900 R10 record traffic_record   # 013900 "mov.w 18[R20], R10": the object's traffic_record (a leader's field 18 has been moved past its traffic_line_record's list to it, 0138E0)
local traffic_figure_update 013BB8 R10 record traffic_record   # 013BB8 "mov.w 18[R20], R10" in state 0: the traffic_record (a team leader's moved past its list, 013B98)
local traffic_car_start_convoy 01389E R10 line traffic_line_record   # 01389E "mov.w 18[R20], R10": the leader's record
local traffic_car_start_convoy 0138A2 R10 line traffic_line_followers   # 0138A2 "mov.w [R10+], R0": past the spacing, the followers' records
local traffic_figure_start_team 013B56 R10 line traffic_line_record   # 013B56 "mov.w 18[R20], R10": the leader's record
local traffic_figure_start_team 013B5A R10 line traffic_line_followers   # 013B5A "mov.w [R10+], R0": past the spacing, the records of what it pulls
local traffic_spawner_update 0137CC,0137F1 R10 entry traffic_spawn_entry   # 0137CC "mov.w 18[R20], R10": the list's next entry; 0137F1 "mov.w 2E1F0(R0), R10": the first of the leader's new stage
local traffic_spawner_update 013852 R10 racer_list   # 013852 "mov.w F80[R25], R10": screen traffic_racer_list (work RAM: the racers' count, then their numbers)
local game_mode_play 00313A R21 car object.player_car
local player_car_update 007DBD,007DC0 R10 hit_object object.traffic
param rider_gesture_check_view R10 car object.race_car
param rider_gesture_check_place R10 car object.race_car
param rider_gesture_place R10 car object.race_car
param goal_actor_rider_place R10 scene object.race_car

# ======== locals (batch L1) ========
# boot, the EEPROM and the settings
local boot 000015,000026,00002A,00004C,00005A,00005E R10 source boot_register_values   # the bytes copied to E00000 and the interrupt controller ([R10+])
local boot 00001C,000026,00002A,000050,00005A,00005E R11 destination
local boot 000023,00002E,000057,000062 R1 pair_count                  # bytes copied two at a time (dbr R1)
local boot 000091,000099 R0 delay_count
local boot 00056C,000573 R1 link_off_delay
local boot 000540,000577,0005A1 R0 fill                              # mov.d R0, [R10+]: R0 and R1 are the 64 bits written
local boot 000543,00057A,0005A4 R1 fill_high
local boot 00054D,000554,000557,00055A,00055D,00057D,00058B,00058E,000591,000594,0005AE,0005B5,0005B8,0005BB,0005BE R10 clear_address cleared_ram_words
local boot 000546,000560,000584,000597,0005A7,0005C1 R2 block_count  # 32 bytes a block (four mov.d)
local boot 000066 s100004 psw_image                                  # push #0, then retis takes it as the PSW
param crc16 R10 bytes
param crc16 R11 byte_count
local crc16 0000C4 R2 polynomial
local crc16 0000CB,0000D2,0000D8,0000DD,0000EB,0000F0,0000F7 R0 crc
local crc16 0000D5,0000E0,0000E8,0000F3 R1 bit_count
local signature_checksum 0000FC R10 signature_text
local signature_checksum 000103 R11 signature_length
param load_settings R0 checksum                                      # passed on to bookkeeping_reset, whose checksum it becomes
local load_settings 000158,000177,00018E,0001C4,0001D8,0001FA,00020E,000253,000265,0002A6,0002BA R0 new_checksum
local load_settings 00028C R0 write_count                            # the eeprom_write_count of the copy that is kept
local load_settings 00016B,000182,0001CC,000202,00021E,000259,000272,0002AE R10 settings
local load_settings 000170,000187,0001D1,000207,000223,00025E,000277,0002B3 R11 settings_length
param eeprom_set_lines R2 lines
param eeprom_set_lines R13 lines_port
param eeprom_begin R2 lines
param eeprom_begin R13 lines_port
local eeprom_begin 0004AC R2 lines_now
param eeprom_begin R12 eeprom_port
param eeprom_send_command R2 lines
param eeprom_send_command R4 command
param eeprom_send_command R13 lines_port
local eeprom_send_command 000451,000484 R1 command_bits             # the command's bits still to send, high first
local eeprom_send_command 000481 R0 sent_bits                        # its top bit goes out now
local eeprom_send_command 00047E,00049C R3 pulse_count
param eeprom_read_word R0 eeprom_word
param eeprom_read_word R2 lines
param eeprom_read_word R4 command
param eeprom_read_word R13 lines_port
local eeprom_read_word 0003C5,0003DD R3 pulse_count
param eeprom_read_word R12 eeprom_port
param eeprom_write_word R0 eeprom_word
param eeprom_write_word R2 lines
param eeprom_write_word R4 command
param eeprom_write_word R13 lines_port
local eeprom_write_word 0003ED,0003F3,000401 R6 word_bits            # the word turned high byte first, rotated a bit at a time
local eeprom_write_word 00043B R0 data_out
local eeprom_write_word 0003FD R0 data_bit             # the word's top bit, into the data line (bit 7)
local eeprom_write_word 0003F6,000417,00041B,00042C R3 pulse_count
param eeprom_write_word R12 eeprom_port
local eeprom_lock 0002E1 R4 command
local eeprom_lock 0002EA,0002ED R2 lines
local eeprom_lock 0002EA R13 lines_port
param eeprom_read_one_word R4 command                                # the word's number, R4 | 80 its read command
local eeprom_read_one_word 000314,000317 R2 lines
local eeprom_read_one_word 000314 R13 lines_port
param eeprom_read_settings R0 eeprom_word
local eeprom_read_settings 000337,00034C R11 settings settings_words
local eeprom_read_settings 00033C,00034A R4 command
local eeprom_read_settings 000340,00034F R5 word_count
local eeprom_read_settings 000344,000347 R2 lines
local eeprom_read_settings 000344 R13 lines_port
param reload_settings R0 eeprom_word
param eeprom_write_one_word R0 eeprom_word
param eeprom_write_one_word R4 command                               # the word's number, R4 | 40 its write command
local eeprom_write_one_word 000358,00035B R2 lines
local eeprom_write_one_word 000358 R13 lines_port
local eeprom_write_settings 000381 R0 checksum
local eeprom_write_settings 0003AD R0 eeprom_word
local eeprom_write_settings 000375,00039D,0003AD R10 settings settings_words
local eeprom_write_settings 00037A R11 settings_length
local eeprom_write_settings 000397,00039A,0003AA,0003B0 R2 lines
local eeprom_write_settings 000397,0003AA R13 lines_port
local eeprom_write_settings 000393,0003A2,0003B3 R4 command
local eeprom_write_settings 0003A6,0003B5 R5 word_count
# the frame loops, the start of a game and the inputs
local second_task 000675 R0 attract_car_list
local second_task 0006EF,0006F9,000754,00075E R0 mode
local second_task_frames 0006EF,0006F9,000754,00075E R0 mode
local second_task 0007B5 R0 fill
local second_task 0007B8 R1 fill_high
local second_task 0007C2,0007C9,0007CC,0007CF,0007D2 R10 clear_address cleared_ram_words
local second_task 0007BB,0007D5 R2 block_count
local second_task entry,000684,0006EC,000751 R2 input_changes   # take_screen_inputs' (screen 2's car_number at first)
local second_task_frames 0006EC,000751 R2 input_changes
param check_game_start R0 mode
param check_game_start R2 seat_credits seat_credits
local check_game_start 00085B R2 seat_credits seat_credits
local check_game_start 00086C R3 lamp_blink
local check_game_start 0008B0 R0 play_mode
local initialise_game 000955 R0 checksum                             # what init_screen leaves in R0, which load_settings passes on as bookkeeping_reset's checksum
param initialise_board R0 checksum
local initialise_board 0009C5,0009D2,0009DF R10 tile_page_list
local read_switches_and_analog 0009F9 t1 chip_1_port_e
local read_switches_and_analog 000A00 t1 chip_1_port_f
local read_switches_and_analog 000A16 t1 chip_2_port_e
local read_switches_and_analog 000A1D t1 chip_2_port_f
local read_switches_and_analog 000A00 R1 chip_1_port_f_on
local read_switches_and_analog 000A1D R3 chip_2_port_f_on
local read_switches_and_analog 000A0D R0 new_switches                  # chip 1's switches first (or.b into it: one variable)
local read_switches_and_analog 000A2A R2 chip_2_switches
local read_switches_and_analog 000A45 R1 test_switch
local read_switches_and_analog 000A4B R0 new_switches
local read_switches_and_analog 000A53 R1 old_switches
local read_switches_and_analog 000A6E,000A72 R5 screen_turn
local read_switches_and_analog 000A75,000AF7 R1 converter
local read_switches_and_analog 000A7D,000AD0 R2 raw_place analog_values
local read_switches_and_analog 000A83,000AF4 R3 scaled_place analog_values
local read_switches_and_analog 000A89,000AFA R4 inputs_left
local read_switches_and_analog 000A91,000AD3,000AD6 R6 calibration analog_calibration_bytes
local read_switches_and_analog 000ACC,000ADE,000AE1,000AE6 R0 reading
local read_switches_and_analog 000AD3 R7 calibration_low
local read_switches_and_analog 000AD6 R8 calibration_high
local read_switches_and_analog 000AE1 t2 capped_reading
local pack_seat_inputs 000B16 t1 chip_1_port_e
local pack_seat_inputs 000B1D t1 chip_1_port_a
local pack_seat_inputs 000B38 t1 chip_2_port_e
local pack_seat_inputs 000B3F t1 chip_2_port_a
local pack_seat_inputs 000B1D,000B3F R2 port_a_on
local pack_seat_inputs 000B35,000BB9 R0 seat_buttons
local pack_seat_inputs 000B57 R1 other_seat_buttons
local pack_seat_inputs 000B5A,000B79,000B7D,000B81,000B94,000BAF,000BB9 R10 analog_place
local pack_seat_inputs 000BA1,000BAF,000BB9 R11 link_place
local pack_seat_inputs 000BA8,000BB2 R2 link_event_place
param link_send_seat_inputs R0 seat_buttons
param link_send_seat_inputs R2 link_event_place
param link_send_seat_inputs R10 analog_place analog_values
param link_send_seat_inputs R11 link_place
local link_send_seat_inputs 000BC7 t1 wheel_input
local link_send_seat_inputs 000BCD t1 gas_input
local link_send_seat_inputs 000BD1 t1 brake_input
local queue_seat_inputs 000BF3,000C09 R10 seat_screen
local queue_seat_inputs 000BFA,000C10 R11 seat_record
local queue_seat_inputs 000BFF,000C15 R12 io_chip
param queue_screen_inputs R10 seat_screen
param queue_screen_inputs R11 seat_record seat_inputs   # seat_1_buttons or seat_2_buttons; on ISDN the race_copy's link_buttons
local queue_screen_inputs 000C2B,000C38 R0 inputs
local queue_screen_inputs 000C35 R2 seat_inputs
local take_screen_inputs 000C5F R0 inputs
local take_screen_inputs 000C6F,000C77,000C7A R3 buttons_place
local take_screen_inputs 000C80,000D4E,000D51,000D62 R2 input_changes
local take_screen_inputs 000D5B R3 status_cleared
local take_screen_inputs 000D42 R0 new_link_status
local take_screen_inputs 000D4A R1 old_link_status
local take_screen_inputs 000D4A t2 new_status
local isdn_count_players 000D82 R1 player_sum                       # the other side's players, then the sum (add.b into it)
local isdn_count_players 000D8F R1 player_sum
# the attract modes
local game_mode_isdn_connection 000E0E R19 colour_block
local game_mode_isdn_connection 000E1F R10 lamp_place screen_lamps   # GAME_VARIABLES + 4 * index: checkpoint_lamp at C0, leader_lamp at C8
local game_mode_isdn_connection 000E35 R10 handler_list
local isdn_status_update 000EC6,000ECA,000ED0 R0 blink_frames
local isdn_status_update 000ED7,000EDF,000EEB,000EF3,000F07,000F0A,000F10,000F13,000F19,000F1C,000F22,000F25 R19 text_record
local isdn_status_update 000F2B R1 cell
local isdn_status_update 000F3A,000F4F,000F60 R11 cell_place
local isdn_status_update 000F37 R9 this_side_count
local isdn_status_update 000F4C R8 other_side_count
local isdn_status_update 000F5C R0 total_players
local game_mode_title 001040 R19 colour_block
local bar_picture_bar_start 0010F0 R9 animation
local bar_picture_bar_start 00111C t1 random_x
local bar_picture_bar_start 00112B t1 random_y
local bar_picture_bar_fly 001141,001169,001195 R2 landed                 # FFFFFFFF until an axis misses its place this frame
local bar_picture_bar_fly 001144 R0 x_motion                      # the speed, the place it leads to, the step, the new speed and place: mov.h writes keep one variable
local bar_picture_bar_fly 001148 R1 old_x_speed
local bar_picture_bar_fly 00114B,001165 R0 x_motion
local bar_picture_bar_fly 001156,00115B R0 x_motion
local bar_picture_bar_fly 00115E R0 x_motion
local bar_picture_bar_fly 00114F t3 x_distance
local bar_picture_bar_fly 001170 R0 y_motion
local bar_picture_bar_fly 001174 R1 old_y_speed
local bar_picture_bar_fly 001177,001191,00119C,0011A6 R0 y_motion
local bar_picture_bar_fly 001182,001187 R0 y_motion
local bar_picture_bar_fly 00118A R0 y_motion
local bar_picture_bar_fly 00117B t3 y_distance
local game_mode_car_presentation 00149F,0014AD R19 colour_block
local game_mode_car_presentation 0014BA R10 handler_list
local demo_race_fade_in 00157B t3 frame_parity
local attract_lamps_update 0015E3 R1 screen_index
local attract_lamps_update 0015F2,0015F5 R1 screen_index
local car_presentation_update 00168B R0 routine                            # the state's code (car_presentation_state_jumps), which draw_object is handed
local car_presentation_update 0016F1 R0 attract_car
local car_presentation_update 00170F,001715,001728 R0 palette_index
local car_presentation_update 0016F6 R9 animation
local car_presentation_update 001719,001723 R19 colour_list
local staff_credits_code_start 001894 R0 new_controls
local staff_credits_code_watch 0018A4 R0 new_controls
local staff_credits_code_watch 0018BF R0 sound_code
local staff_credits_code_watch 0018A9,0018AD,0018B2 R10 next_control
local staff_credits_code_watch 0018D0 t2 presentation_timer               # the presentation object's mode timer (+10)
local staff_credits_code_show 0018EA,0018F4 R18 next_text sprite_text_record   # staff_credits_texts, then what draw_text hands back: the next text (batch M2)
local staff_credits_code_show 0018F1 R19 text_record
param staff_credits_code_read_controls R0 new_controls
param staff_credits_code_read_controls R2 control_reading
local staff_credits_code_read_controls 00190B R0 held_before
local staff_credits_code_read_controls 00190F,00192A,001930,00193B,001946,001953,00195B R1 controls_now
local staff_credits_code_read_controls 001912,001933,00193E,001949 R2 reading
local staff_credits_code_read_controls 00192D,001938,001943 R3 control_bit
local staff_credits_code_read_controls 001965 R0 newly_on
local staff_credits_code_read_controls 001965 t3 pressed_controls
param staff_credits_code_control_bit R0 held_before
param staff_credits_code_control_bit R1 controls_now
param staff_credits_code_control_bit R2 reading
param staff_credits_code_control_bit R3 control_bit
local car_name_start 001985,0019A2 R10 letter_place
local car_name_start 00198B,0019AB R0 letter_x
local car_name_start 001990,0019B4 R1 letter_delay
local car_name_letter_update 0019EC R9 animation
local load_course_records 001D84,001DA7,001DC7 R0 courses_left
local load_course_records 001D87 R10 backup_record backup_course_record   # the first course's (701F32): the reads after it are by its offset
local load_course_records 001DA4,001DAC,001DB4,001DB8,001DBC,001DC0 R10 backup_record
local load_course_records 001DB0 t1 model_place
local game_mode_ranking 001E29 R19 colour_block
local game_mode_ranking 001E3B R10 handler_list
local course_record_beaten 001E8F R0 course_number
local course_record_beaten 001E94 R0 course_number
# the name entry
local name_entry_update 001F15 R19 palette_fades
local name_entry_update 0021EE,0021F9 R19 text_record
local name_entry_update 001F28 R10 handler_list
local name_entry_finish 00216C,002175 R10 rejected_name
local name_entry_update 001F33,001F48 R0 letter_index
local name_entry_update 001F48 t1 letters_left
local name_entry_update 001F79,001F7E,001F90,001F95,001F9B,001FA1 R10 text_field
local name_entry_update 001FC0,001FD4,001FF2 R0 steps
local name_entry_update 001FE2,002000 R0 new_angle
local name_entry_update 001F73 R0 player_time
local name_entry_read_wheel 00200F,002014,002039,002043 R0 wheel_position     # the wheel in sixteenths (FF for <<, 0 for >>): its top two bits the way to turn
local name_entry_read_wheel 002018,002046 R1 turn_rate
local name_entry_read_wheel 002056,00205F R1 new_steps
local name_entry_read_wheel 002022 R1 turn_buttons
local name_entry_choose 0020FF R0 sound_code
local name_entry_choose 00210D R0 saved_letter
local name_entry_choose 00210F t1 entered_letter
local name_entry_choose 002113,00211B,00213B,002148 R0 letter_character
local name_entry_choose 0020BA,0020F7,00210B,002125,002137 R1 name_place
param name_entry_finish R1 name_place
local name_entry_finish 002163 R0 entered_name
local name_entry_draw_time 0021D9 R0 remaining_time                  # frames, then seconds, then their BCD digits
local name_entry_draw_time 0021DD R0 remaining_time
local name_entry_draw_time 0021E2 R0 remaining_time
local name_entry_choose 0020FB s4 kept_letter
local name_entry_choose 0020FD s8 kept_place
local name_entry_letter_update 00222D R9 animation
local name_entry_letter_update 00226B,00226F,002273 R0 letter_angle
local name_entry_letter_update 002278 R1 letter_x                     # the sine, the x offset, then the place on the screen
local name_entry_letter_update 00228B R1 letter_x
local name_entry_letter_update 002280 R3 letter_depth
local name_entry_letter_update 002293 R3 letter_depth
local name_entry_letter_update 002288 R0 front_cosine
local name_entry_letter_update 0022B7,0022C4,0022CE R0 width_base
local name_entry_letter_update 0022B7 t2 toward_front                    # the cosine less 2000: negative more than 60 degrees from the front
local name_entry_letter_update 00229E,0022B2,0022D1 R2 letter_palette
local name_entry_letter_update 0022E6 R2 letter_y
local name_entry_letter_update 002A7E R0 letter_scale                 # 100000 / (depth + 100), then the height and width scales
local name_entry_letter_update 002A81,002A8B R1 letter_x
local name_entry_letter_update 002A84,002A9A R2 letter_y
local name_entry_letter_update 002AAF R0 letter_scale
local name_entry_letter_update 002ABA R0 letter_scale
local name_entry_letter_update 002AC2 R0 letter_scale
local name_entry_lcd_update 002338,002345,00234F,002359 R0 lcd_character
local name_entry_lcd_update 00232B,002338 R10 name_place name_letters
local name_entry_lcd_update 002330,00235D,002366 R11 lcd_place lcd_characters
local name_entry_lcd_update 002335,002360,00236B R9 characters_left
local name_entry_car_update 00237D,002382 R0 routine
local name_entry_car_update 002398 R9 animation
local name_entry_drivers_update 0023CA,0023CF R0 routine
local name_entry_drivers_update 0023E8 R9 animation
local name_entry_course_name_update 00241A,00241F,002474 R0 routine
local name_entry_course_name_update 00242F R0 course_number
local name_entry_course_name_update 002434 R0 course_number
local name_entry_course_name_update 002445 R9 animation
# the ranking
local ranking_update 002499 R10 handler_list
local ranking_update 00253A,002541 R0 next_course
local ranking_title_left_update 002616,00261B,002659 R0 routine
local ranking_title_left_update 00263B R9 animation
local ranking_title_right_update 002663,002668,0026A7 R0 routine
local ranking_title_right_update 002687 R9 animation
local ranking_course_banner_update 0026B1,0026C3 R0 course_number               # the state's code at first, which draw_object is handed in state 1
local ranking_course_banner_update 002706 R0 course_number
local ranking_course_banner_update 0026D4 R9 animation
local ranking_record_start 00270C,00272B,00273B,00274B,00274E R10 text_place
local ranking_record_start 002711 R3 record_offset                     # the course, times 6
local ranking_record_start 002715 R3 record_offset
local ranking_record_start 002718,00271E,00272E R11 initial_place course_record_bytes
local ranking_record_start 00271E,002727,00272E,002737,00273E,002747 R4 initial
local ranking_record_start 00272E t1 second_initial
local ranking_record_start 002756 R0 record_time
local ranking_record_start 002762,002785 R0 characters_left
local ranking_record_start 002765,002783 R1 character_index
local ranking_record_character_update 002792,0027D6,002828,00283B R0 character_index   # the state's code at first, then the index, the colour delay (index + 2), the record's model: what draw_object is handed
local ranking_record_character_update 002824 R0 character_index
local ranking_record_character_update 00286A R0 character_index
local ranking_record_character_update 0027C7 R9 animation
local ranking_record_car_update 002874,0028A8 R0 car_model                   # the state's code at first, which draw_object is handed
local ranking_record_car_update 0028FB,002913,00292D R0 car_model
local ranking_record_car_update 0028AE R9 animation
local passing_traffic_start 00293A,00293F R0 step_count
local passing_traffic_update 002968 R0 random
local passing_car_update 0029B0 R0 car_model                         # a random number, its low three bits the model
local passing_car_update 0029B6 R3 random_side                       # the random number again: its sign picks the side of the road
local passing_car_update 0029B9 R0 car_model
local passing_car_update 0029BC R9 animation
local passing_car_update 0029D0 R0 pass_sound
local passing_car_update 002A02,002A35 R0 step_index
local passing_car_update 002A02 t2 near_step
local passing_car_update 002A35 t2 far_step
local passing_car_update 002A16 R0 path_size
local passing_car_update 002A59 R0 mirrored_x
local passing_car_update 002A2B R0 path_size
local passing_car_update 002A65 R0 mirrored_x
local ranking_background_load 002B27 R0 background_number
local ranking_background_load 002B5D,002B79 R0 page_numbers
local ranking_background_load 002BF5,002BF8,002C03 R0 mixer_priority
local ranking_background_load 002B50,002B66 R10 background_pages tile_page_entries
local ranking_background_load 002B84 R10 queued_pages
local ranking_background_load 002BEF,002C00 R10 mixer_place mixer_register_copies
local ranking_background_load 002B54,002B76 R11 page_place object_tile_pages
local ranking_background_load 002B63,002B7C R9 pages_to_copy
local ranking_background_load 002B48 R19 colour_list
local ranking_background_load 002B95 R19 palette_fades
local ranking_background_load 002B46 s4 saved_fades
# a game, the route map
local game_mode_play 002EF4,00323C,0033A4 R0 sound_code
local game_mode_play 002F3D,002F4B R0 racers_left
local game_mode_play 002F48 t2 racer
local game_mode_play 003014,003077,0031F8,0033E9 R10 lamp_place screen_lamps
local game_mode_play 003133,003161,003170,003257 R10 handler_list
local game_mode_play 003231 R10 song_title
local game_mode_play 0030BE R11 demo_record
local game_mode_play 002FC1,0030EE,003249 R19 colour_block
local game_mode_play 00336A,003375 R6 stage_level
local game_mode_play 002F8C,003330,003347,00335D,003378 R7 bookkeeping_entry
local game_mode_play 003327 R9 time_played
local route_map_update 00360F R0 setup_base                              # the screen's first background setup: 10 by screen, 5 by branch
local route_map_update 0037F2,0038CC,00396A,003A69,003B32 R0 leg_distance
local route_map_update 003785,00379D R0 landmark_index
local route_map_update 003DB1,003DCF R0 leg_number
local route_map_update 003DD5,003DEF R0 dj_message
local route_map_update 00377E,00379F R1 landmarks_left
local route_map_update 00398A,003B4D R1 stage_length
local route_map_update 003DA6,003DAF,003DD1 R1 legs_left
local route_map_update 003632 R19 colour_block
local route_map_update 0038C3,003A60 R2 lengths_place
local route_map_update 00383A t3 start_leg_frames
local route_map_update 003908 t3 turn_leg_frames
local route_map_update 0039B4 t3 approach_leg_frames
local route_map_update 003AA5 t3 branch_leg_frames
local route_map_update 003B77 t3 stage_leg_frames
local route_map_car_update 003E1F,003E78,003EA2,003EAB,003F1C R0 routine
local route_map_car_update 003E39 R0 car_model
local route_map_car_update 003E3D R9 animation
local route_map_sign_update 003F2B,003F45 R0 sign_kind                        # the state's code at first, which draw_object is handed in state 1
local route_map_sign_update 004003 R0 goal
local route_map_sign_update 003FEF R0 sign_kind
local route_map_sign_update 004032 R0 goal
local route_map_sign_update 003F49 R9 animation
local route_map_landmark_update 00405A,0040D4,004117 R0 routine
local route_map_landmark_update 004080 R0 record_offset
local route_map_landmark_update 004106 t3 frame_toggle
local stage_result_line_draw 0041C2 R0 place_index
local stage_result_line_draw 00422A,004231 R0 place_palette
local stage_result_line_draw 00423A R0 place_palette
local stage_result_line_draw 004195,004199,0041A8 R3 text_place
local stage_result_line_draw 004217 R9 animation
local stage_result_line_draw 0041E6 R18 retire_text
local stage_result_line_draw 00419E s4 saved_position
local stage_result_line_draw 004226 t2 final_place
local route_map_leg_show 004244,004249 R0 routine
local route_map_leg_show 004365 R0 leg_stage
local route_map_leg_show 00434E R1 fork_index
local route_map_leg_show 004298,0042ED,004359 R9 animation
local route_map_leg_car_show 004425,004572 R0 routine
local route_map_leg_car_show 004535 R0 leg_stage
local route_map_leg_car_show 004512 R1 fork_index
local route_map_leg_car_show 00443D R9 animation
local route_map_checkpoint_show 004581,004615,004625 R0 routine
local route_map_checkpoint_show 0045F5 R0 finish_index
local route_map_checkpoint_show 00459D R9 animation
local route_map_direction_sign_show 00469B,00469F R0 colour_cycle                 # the colour timer + 1, then the palette it picks
local route_map_direction_sign_show 0046AC R0 colour_cycle
local route_map_direction_sign_show 0046B5 R0 colour_cycle
local route_map_direction_sign_show 004677 R9 animation
local route_map_wait_banner_show 0046BF,004735,004743,00474E,00475C R0 routine
local route_map_wait_banner_show 0046E8 R9 animation
local route_map_wait_banner_show 0046DB t3 wait_count
local game_over_banner_show 004775,00477A,0047D9,0047E2 R0 routine
local game_over_banner_show 00478D R9 animation
# the car select
local car_select_run 005096 R10 song_title
local car_select_run 0050A1 R0 sound_code
local car_select_run 0050AA,0053BA R0 dj_message
local car_select_run 0050E8 s4 setup_bits                                # the setup's video register bits (after its background)
local car_select_run 0062E3,0062FF R10 first_rowselect
local car_select_run 0062E8,006302 R11 second_rowselect
local car_select_run 0062F2,006308 R13 fourth_rowselect                  # the third is R12, which the whole program shares
local car_select_run 0062F7,00630B R0 row_number
local car_select_run 0062FB,00630D R9 rows_to_fill
local car_select_run 00513C,005150 R0 car_index
local car_select_run 005150 t1 cars_left
local car_select_run 00515D,005172 R0 group_index
local car_select_run 005172 t1 groups_left
local car_select_run 005184,005198 R0 default_car                        # then times 80: the turntable's angle / 4 for it
local car_select_run 0051FF R19 colour_block
local car_select_run 00521F t3 depth_offset
local car_select_run 00525A,00526D,00528E R0 turn_now
local car_select_run 00527E,00529F R0 new_angle
local car_select_run 0052B6,0052BB R0 wheel_position                     # the wheel in eighths: its top bit the way to turn
local car_select_run 0052BF t1 turn_rate
local car_select_run 0052CE,0052D8 R1 new_turn
local car_select_run 005319 R0 car_sound
local car_select_run 00536C,005370,005375 R0 remaining_time              # frames, then seconds, then their BCD digits
local car_select_turn_to_choice 005407,005419,00542E R1 turntable_angle
local car_select_turn_to_choice 00540E t4 angle_to_choice
local car_select_update_rowscroll 005443,00544B R0 near_page
local car_select_update_rowscroll 005448,005451 R1 far_page
local car_select_update_rowscroll 00545D,005477,0054AE R11 near_scroll_place
local car_select_update_rowscroll 00546D,0054AB R0 line_scroll
local car_select_update_rowscroll 005473,00547D,0054A4,0054B4 R9 lines_left
local car_select_update_rowscroll 00549C R1 fraction_shift
local car_select_update_rowscroll 00549F,0054A8 R10 line_offsets floor_line_offsets
local car_select_update_rowscroll 005463,00547A,0054B1 R12 scroll_place
local car_select_skew_floor_next 0054BC R0 skew_step
local car_select_skew_floor_previous 0054C1 R0 skew_step
param car_select_skew_floor R0 skew_step
local car_select_skew_floor 0054C4,0054CC R1 near_page
local car_select_skew_floor 0054C9,0054D2 R2 far_page
local car_select_skew_floor 0054E3,005516 R11 near_scroll_place
local car_select_skew_floor 0054EF,00550D R10 line_offsets floor_line_offsets
local car_select_skew_floor 0054F4,0054FE R3 skew
local car_select_skew_floor 0054F7 R4 fraction_shift
local car_select_skew_floor 0054FA,00551C R9 lines_left
local car_select_skew_floor 005504 R1 near_offset
local car_select_skew_floor 00550A R2 far_offset
local car_select_skew_floor 0054E9,005519 R12 far_scroll_place   # the far rows' line scroll values, two bytes a row
local car_attendant_run 00554D,005598,0055D9,005622,005635,005655,00565C R9 animation
local car_attendant_run 0055A6,0055BD,0055CD,00566A,005646 R0 attendant_angle   # his angle round the turntable (plus side_offset at 005646)
local car_attendant_run 00566E,005673,005678 R0 attendant_angle            # less 40 and the turntable's angle: where the view sees him
local car_attendant_run 0055B2 t4 angle_to_front
local car_attendant_run 0055F8 R0 attendant_angle                       # side_offset, an angle too
local car_attendant_run 00560E,005619 R0 attendant_angle
local car_attendant_run 005600 R1 target_side                            # car transmission * 80
local car_attendant_run 00567D,00569A R1 across
local car_attendant_run 0056A2 R2 down
local car_attendant_run 00568D,0056A6 R3 point_depth
local turntable_car_show 0056B8,0056BD R0 routine
local turntable_car_show 0056F3,0056F7,0056FA R0 car_angle
local turntable_car_show 0056FF R0 seen_angle
local turntable_car_show 0056FF t2 angle_from_front
local turntable_car_show 00574E R1 across
local turntable_car_show 005743 R2 ring_radius
local turntable_car_show 005756 R2 down
local turntable_car_show 005752,00575A R3 point_depth
local turntable_scenery_show 0057CE,0057D2,005854 R0 item_angle
local turntable_scenery_show 005832,00583E R0 leftover                   # what turntable_draw hands back (draw_object's leftover, or the perspective); the flags go into its low byte (00583E), and the word back to item_places: its bits 8-15 with flags bit 5
local turntable_scenery_show 005807 R1 across
local turntable_scenery_show 0057E4,0057E9 R2 ring_radius
local turntable_scenery_show 00580F R2 down
local turntable_scenery_show 00580B,005812 R3 point_depth
local turntable_scenery_show 0057BB,005835,00584A R10 item_place turntable_scenery_item
local turntable_scenery_show 0057E4,005854 R10 item_place
local turntable_scenery_show 0057BF,005837,005839,005845,00584D,005850 R11 saved_place item_place_words
local turntable_scenery_show 005817 s4 kept_saved_place
local turntable_scenery_show 005830 s8 kept_item_place
local welcome_letter_start 005862,005875 R0 letter_index
local welcome_letter_show 005887,0058FE R0 letter_index                  # the state's code at first, which draw_object is handed; the index, then twice it (the delay)
local welcome_letter_show 0058BA R0 letter_index
local welcome_letter_show 0058D5 R0 letter_index
local welcome_letter_show 0058A8 R9 animation
local welcome_letter_show 0058F0 t3 delay_left
local select_car_heading_show 00590C,00599C R0 routine
local select_car_heading_show 00595E R9 animation
local select_instruction_show 0059BC,005A11 R0 routine
local transmission_choice_run 005A71 t2 panels_y
local transmission_choice_run 005AB3,005AC1 R0 couple_left_side
local transmission_choice_run 005A93,005A9E,005B03,005B12,005B28,005B37 R19 colour_list
local automatic_panel_show 005BC8,005BD0 R0 panel_y
local automatic_panel_show 005B79 R9 animation
local manual_panel_show 005C63,005C6B R0 panel_y
local manual_panel_show 005C0D R9 animation
local transmission_label_start_automatic 005C7D R9 animation
local transmission_label_start_manual 005CB0 R9 animation
local transmission_label_follow 005D00,005D0E R0 label_y
local car_caption_show 005DBB,005DE7 R0 car_model
local car_caption_show 005D93 R9 animation
local car_gears_caption_show 005E63,005E8B R0 car_model
local car_gears_caption_show 005E34 R9 animation
local waiting_banner_show 005EB8,005F34 R0 routine
local waiting_banner_show 005EE0,005F11 R9 animation
local car_select_entries_run 005FA6 R0 own_car_number
local car_select_entries_run 005F8F,005F9E R9 players_left
local car_select_entries_run 005FD9,005FDD,005FE0 R10 racer_place racer_numbers
local car_select_entries_run 005FDD,006052 R8 racers_left
local car_select_entries_run 005FE0 R0 racer
local car_select_entries_run 005FEF R1 racer_car_number
local car_select_entries_run 00600A R1 chosen_car
local car_select_entries_run 00600A t2 car_choice                        # the racer's race_copy byte 48 (its car + 1) less 1
local car_select_entries_run 00600E R11 car_flag object.choice_flag
local car_select_entries_run 006056,00605A,006060 R0 flag_blink_frames
local choice_flag_start 00607C R9 animation
local choice_flag_follow 0060B9 t2 flags_shown
local choice_flag_follow 0060C0,0060C4,0060C9 R0 seen_angle
local choice_flag_follow 006252,006265,006289 R0 perspective
local choice_flag_follow 0060F1,00626B,006271 R1 flag_x
local choice_flag_follow 0060E6 R2 ring_radius
local choice_flag_follow 0060F9,006276 R2 flag_y
local choice_flag_follow 0060F5,0060FD,006259,00625E R3 flag_depth
local choice_flag_follow 00625E t3 view_distance
local stacked_choice_flag_start 006111 R9 animation
local stacked_choice_flag_follow 00614E t2 below_shown
local stacked_choice_flag_follow 006164,00616D R0 flag_y
local choice_flag_number_start 006189 R9 animation
local choice_flag_number_follow 0061B0 t2 flag_shown
local choice_flag_number_follow 0061C7,0061D0 R0 number_y
param turntable_draw R1 across
param turntable_draw R2 down
param turntable_draw R3 point_depth
local turntable_draw 0061DB,0061EF R0 scale                             # 100000, then 100000 / the view distance, then times the object's size
local turntable_draw 00623B,00623E,006241,00624C R0 scale
local turntable_draw 0061E7 R3 view_distance
local turntable_draw 0061E7 t3 distance_sum
local turntable_draw 0061F2 R3 distance_layer
local turntable_draw 0061F2 t4 distance_sixteenths
local turntable_draw 006202 R3 fraction_shift
# the entry countdown
local entry_countdown_start 00636A R19 palette_fades
local entry_countdown_start 006383 R0 sound_code
local entry_countdown_start 00638C R0 dj_message
local entry_countdown_start 0063D3 R9 animation
local entry_countdown_count 006402,006407 R0 time_shown                 # the frames left, the seconds (divux by 30), their tens (divux by 10), the tens' character
local entry_countdown_count 006402 t2 frames_shown                       # entry_frames less 6
local entry_countdown_count 00640D R0 time_shown
local entry_countdown_count 006434,006439,00644B R0 time_shown
local entry_countdown_count 00640A,006431 R1 remainder                 # the dividend's high word (0), then the remainder: the frames into the second, the seconds' units
local entry_countdown_count 00640D R1 remainder
local entry_countdown_count 006434 R1 remainder
local entry_banner_start 0064EE R9 animation
local entry_banner_blink 006514,006518,006523 R0 blink_frames
local entry_car_ring_draw 006560,00656E R0 copy_count
local entry_car_ring_draw 006576,00657D R0 ring_angle
local entry_car_ring_draw 0065AE,0065C5 R0 y_by_four
local entry_car_ring_draw 0065DC,0065E0,0065E2 R0 ring_car
local entry_car_ring_draw 006580,006599,0065A0 R1 ring_x
local entry_car_ring_draw 0065A5,0065B1 R2 ring_y
local entry_traffic_run 006624 R0 random
local entry_traffic_car_drive 006670,006679 R0 traffic_car              # a random number, its low three bits the car
local entry_traffic_car_drive 00670C,006725 R0 path_size
local entry_traffic_car_drive 006784,006790 R0 mirrored_x
local entry_traffic_car_drive 0066EF R0 tyre_noise
local entry_traffic_car_drive 006753,00679A R0 pass_sound
local entry_traffic_car_drive 006676,0066A6 R1 random_swapped           # the random number byte-swapped: its low 7 bits one chance in 128 to spin, its sign the side
local entry_traffic_car_drive 0066A6 t2 spin_chance
local step_palette 006902,00690C R0 palette_entry
local step_palette 0068FE,006902,006909,00690C R10 list_place object_palette_steps
# the player's car
local player_car_update 006F42,006F4F R1 distance_index
local player_car_update 006F84,006FD0,006FE3,006FE9,006FEF R11 start_record   # the window record of the car's start segment
local player_car_update 006F8D,006FBF,006FC7 R0 grid_segment
local player_car_update 006F9D R1 grid_place
local player_car_update 006FA3,006FAE,006FB5 R2 grid_list
local player_car_update 006FDB R1 grid_road_place
local player_car_update 007141,007145 R0 brake_index
local player_car_update 007246 R0 player_time
local player_car_update 0071D8,0071E4 R0 dj_message
local player_car_update 0072DE R0 tyre_noise
local player_car_update 0072B5 R9 arrival_animation
local player_car_update 00722D t2 stage_count_place
local player_car_update 00733A,00733E,00734B,00734F R11 segment_record
local player_car_update 00733E,00734F R13 road_x
local player_car_update 00733E,00734F R15 segment_fraction
local player_car_update 00733E,00734F R17 segment_length
local player_car_update 007D47,007D90,007E4D,007E96 R19 crash_entry crash_entry
local player_car_update 007D4C,007D5A,007D78,007D84,007DF3,007E29,007E31,007E52,007E5F,007E7E,007E8A R5 impact   # the impact speed (or the other's speed, then the difference), then the crash table's offset for it
local player_car_update 007D5F R0 speed_loss
local player_car_update 007DEB,007E25,007E2D R4 own_speed
local player_car_update 007E55 R4 speed_difference
local player_car_update 007DF6,007E39 R6 other_weight
local player_car_update 007E45 R7 own_weight
local player_car_update 007DFA,007E15,007EB9 R0 side_gap
local player_car_update 007ED1 R0 side_gap                               # then the sideways push it gives
local player_car_update 007DC9 R11 car_segment_record road_segment   # the car's segment of the ring (its offset, car segment_offset): the road's half width there
local player_car_update 007DFD,007E19 R1 other_x
local player_car_update 007E00,007E1D R2 own_slide
local player_car_update 007E03,007E21 R3 other_slide
local player_car_update 007E08 R10 other_record   # the other car's player (hit_other), then its race_copy record (007E0F, typed in the M5 block)
local player_car_update 007DA3,007DA7,007EBF R8 hit_side
local player_car_update 007EFA R0 crash_hit_sound
local player_car_update 007F04,007F0C R9 crash_animation
local player_car_update 007F09 R1 view_height_offset
local player_car_update 007FAF,007FBF,007FCA R8 new_height
local player_car_update 007FB9,007FD5 R9 new_bounce_speed
local player_car_update 007FBC R7 old_height
local player_car_update 007FE0 R0 landing_sound
local player_car_move 0070F1,0070F5 R11 segment_record
local player_car_move 0070F5 R13 road_x
local player_car_move 0070F5 R15 segment_fraction
local player_car_move 0070F5 R17 segment_length
# ROM addresses the batch's functions use as values
constant boot 16000 BOARD_OFF_LOOPS                    # the busy wait after the link board is turned off (00056C "mov.w #16000, R1", dbr): as network_check_again's
031740  data  black_background_palette                # a colour block for queue_palette / upload_palette: place 9C00, 20 bytes, 16 black colours (census ROM 031740: 9C00 0020 then zeros); game_mode_car_presentation 0014AD and game_mode_isdn_connection 000E0E "movea.b 31740, R19", upload_boot_palettes
100800  data  zero_block                              # 400 bytes of zeros (100800-100BFF, sine_table follows): the source the clears copy (move_halfwords, move_string from 100800): clear_race_state, car_select_run (rowscroll), clear_objects, clear_screen_ram, race_record_clear...
109420  table  boot_tile_pages_5d  u32                 # a list of tile pages for unpack_tile_pages (initialise_board 0009C5 "movea.b 109420, R10"): page 5D (packed at 10B439), closed by FFFFFFFF
109428  table  boot_tile_pages_5e  u32                 # the same (0009D2): page 5E (10B57F)
109578  table  boot_tile_pages_29_to_4e  u32           # the same (0009DF): pages 29-30, 33-3A, 3D-44, 47-4E (10C072...), closed by FFFFFFFF at 1095F8
13F66C  table  entry_countdown_palette_fades  palette_fade_list      # a palette fade list (palette_fade_list: length 26, three palette_fade_entry records) for start_palette_fades: entry_countdown_start 00636A "movea.b 13F66C, R19"
13F6C0  table  name_entry_palette_fades  palette_fade_list           # the same (length 26, three fades): name_entry_update 001F15 "movea.b 13F6C0, R19"
13F95C  table  manual_picked_palettes  palette_block_list             # a palette list for queue_palette_list (length 0A: one entry, 142054 to 21C0): transmission_choice_run 005A9E when the wheel picks manual (car transmission 1)
13F998  table  automatic_picked_palettes  palette_block_list   # the same (one entry, 142074 to 21E0): transmission_choice_run 005A93 when the wheel picks automatic
# ======== locals (batch L2) ========
# the player's car's physics and course, the race's display, the race's logic and the link between cabinets:
# their parameters, locals and values worked out once by name, and the ROM addresses they use as numbers
007CDB  data  rival_warning_text            # RIVAL SEKKIN !! (rival_warning_update 007C71 "movea.b 7CDB, R19", draw_text)
122B74  data  sprite_size_steps             # the sprites' size steps (struct sprite_size_step, 12 bytes): a piece's first at 122B74 + 4 * its sprite (race_car_put_sprite 009CC4, race_car_put_flat_sprite 009D71 "movea.w 122B74(R14), R14"; put_object_sprites, draw_object_one_piece, draw_object_smoothed, fork_branch_sprite, road_row_draw, road_row_pair_draw)
local player_car_steer_to_stop 0073A3,0073CA R0 speed
local player_car_steer_to_stop 0073AC R1 speed_gap
local player_car_steer_to_stop 0073D1,0073EB,0073F3,0073FD,007422,00742A,007434 R0 stop_wheel
local player_car_steer_to_stop 0073DF R2 distance_from_stop
local player_car_steer_to_stop 0073DF t3 x_from_stop
local player_car_check_place 00744B,00746B R7 leader_player
local player_car_check_place 00744F,007467 R6 last_player
local player_car_check_place 007452,0074EE R5 ahead_player
local player_car_check_place 007455,0074F2 R3 behind_player
local player_car_check_place 0074DE,0074EC R3 behind_place
local player_car_check_place 007472,0074E5 R4 place
local player_car_check_place 00749E t2 old_place
local player_car_check_place 007462,007465 R9 last_place
local player_car_check_place 007480 R0 lamp screen_lamps
local player_car_check_place 0074BD,0074CF R0 sound
local player_car_check_place 0074B8 R3 distance_across
local player_car_check_place 00750E R7 leader_race
local player_car_check_place 0074AA,0074B0 R3 passed_race
local player_car_publish 00756E,007573,007575 R0 view_ring_slot
local player_car_publish 007564,007591 R13 shown_view view
local player_car_publish 007555 R11 race_copy
local clear_published_car 007680,007685,007687 R0 view_ring_slot
local player_car_set_horizon 007743,00774E,00775A,007764 R0 tilt
local player_car_place_on_road 0077B4 R11 segment_record
local player_car_place_on_road 0077BC R17 segment_length
local player_car_animate 00780E,007864,007873,007886,00789D,0078A8 R9 model_then_animation
local player_car_animate 00786E,007880,007894 R8 slide
local player_car_animate 0078A5 R1 view_height
param player_car_steer_frame R9 model
local player_car_steer_frame 007829 R0 animation
local player_car_steer_frame 007831 R1 view_height
local player_car_steer_frame 007840 R0 target_frame
local player_car_steer_frame 007848,007854,007858 R1 steer_frame
local player_car_view_height 0078D3,0078F7,0078FF R1 view_height
local player_car_view_height 0078EA R3 highest
local player_car_view_height 0078ED R4 tilt
local player_car_view_height 0078ED t3 pitch_over_road
local player_car_move_view 007938,007946,00795E,007965,007976,007981,00798A,00798F,007995,00799E,0079A8 R0 nod_step
local player_car_move_view 00795E t1 speed_drop
local player_car_move_view 00798A t2 nod_target
local player_car_move_view 00798F t4 eased_step
local player_car_move_view 007949,0079AB,0079B5,0079C1,0079D7,0079DF R1 nod
local player_car_move_view 0079EB R0 side_target
local player_car_move_view 0079EE,007A07,007A0F,007A22,007A33,007A3D R1 view_side
local player_car_move_view 007A17 t2 negative_side_target
local player_car_move_view 007A2A t2 positive_side_target
local player_car_move_view 007A17,007A2A R2 side_step
local player_car_move_view 007A5C t1 rise
local player_car_move_view 007A5C R0 rise_over_margin
local player_car_move_view 007A65 t1 rise_with_margin
local player_car_move_view 007A65 R0 climb
local player_car_move_view 007A83 t2 drop_target
local player_car_move_view 007A96 t2 climb_target
local player_car_move_view 007A57,007A73,007A7B,007A8E,007A9F,007AA7,007AB1 R1 view_rise
local player_car_move_view 007A83,007A96 R2 rise_step
local player_car_move_view 007ADA,007AE7,007B03,007B0C R0 view_shift_rival
local player_car_check_rivals 007B34,007B3C R0 position
local player_car_check_rivals 007B44,007B4F,007BAF,007BBA R2 gap
local player_car_check_rivals 007B52,007BBD R3 speed_gap
local player_car_check_rivals 007B2C R11 ahead_race
local rival_warning_update 007C71 R19 text
local rival_warning_update 007C6C t2 on_frames
local rival_warning_update 007C90 t2 off_frames
local rival_alarm_update 007CB4,007CCC R0 sound
param player_car_world_position R11 segment_record road_segment
param player_car_world_position R13 road_x
param player_car_world_position R15 segment_fraction
param player_car_world_position R17 segment_length
param player_car_place_view R11 segment_record road_segment
param player_car_place_view R13 road_x
param player_car_place_view R15 segment_fraction
param player_car_place_view R17 segment_length
param player_car_drive R11 segment_record road_segment
param player_car_drive R13 road_x
param player_car_drive R15 segment_fraction
param player_car_drive R17 segment_length
local player_car_drive 00A163,00A16E,00A17E R0 drag
local player_car_drive 00A22B,00A247,00A25D R0 steering
local player_car_drive 00A30B,00A310,00A32E,00A36C,00A379,00A385,00A395 R0 drift
local player_car_drive 00A2FE R0 tyre_noise
local player_car_drive 00A2AE,00A2D4 R1 cornering
local player_car_drive 00A172 R1 start_road_x
local player_car_drive 00A176 R2 road_half_width
local player_car_drive 00A1DE R2 gear_curve torque_curve_forces
local player_car_drive 00A2B1,00A2BA R2 grip
local player_car_drive 00A38F R2 origin_x
local player_car_drive 00A392 R3 origin_z
local player_car_drive 00A3DC,00A3E7,00A3EB R6 catch_up
local player_car_drive 00A48B,00A4AB R6 segment_then_offset
local player_car_drive 00A510,00A517 R6 max_road_x
local player_car_drive 00A514,00A51C R7 min_road_x
local player_car_drive 00A18B R7 segment_pitch
local player_car_drive 00A1A0 R7 road_force
local player_car_drive 00A3BF,00A3CB,00A3D0,00A3D5 R7 catch_up_target
local player_car_drive 00A1A3,00A1BE R8 gas
local player_car_drive 00A1F3 R8 drive_force
local player_car_drive 00A281,00A28D,00A2A2,00A2C2,00A2E3,00A314 R8 new_sideways_speed
local player_car_drive 00A314 t2 target_sideways_speed
local player_car_drive 00A1B2,00A1CB R9 brake_force
local player_car_drive 00A38C,00A3A6 R9 forward_speed
local player_car_drive 00A20F R6 new_speed
local player_car_drive 00A3D0 t1 gap_to_ahead
local player_car_drive 00A3E0 t3 catch_up_change
local player_car_world_position 00A560 R0 offset_y
local player_car_world_position 00A5DE,00A604,00A60C R0 heading_start
local player_car_world_position 00A5E1,00A607,00A60F R1 heading_end
local player_car_world_position 00A569,00A577 R1 offset_x
local player_car_world_position 00A56C,00A577 R2 offset_z
local player_car_world_position 00A54E,00A5C4 R1 height
local player_car_world_position 00A5C9 R1 previous_world_y
local player_car_world_position 00A5C9 t2 world_y
local player_car_world_position 00A5E4 R2 quadrant_heading
local player_car_world_position 00A573 R3 segment_heading
local player_car_world_position 00A56F R4 segment_pitch
local player_car_world_position 00A55B,00A5B5 R18 segment_remaining
local player_car_world_position 00A627 R0 previous_heading
local player_car_world_position 00A627 t2 heading
param player_car_world_position R12 next_segment
local player_car_place_view 00A63C,00A648,00A658,00A66C R0 view_shift
local player_car_place_view 00A67D R9 shift_offset
local player_car_place_view 00A6AE R0 offset_y
local player_car_place_view 00A6B7,00A6C5 R1 offset_x
local player_car_place_view 00A6BA,00A6C5 R2 offset_z
local player_car_place_view 00A6C1 R3 segment_heading
local player_car_place_view 00A6BD R4 segment_pitch
local player_car_place_view 00A729,00A741,00A75F,00A777,00A77D,00A7E3,00A825,00A834,00A839 R0 pitch
local player_car_place_view 00A72D,00A741,00A763,00A777,00A780,00A7A8,00A7B0,00A7DC R1 yaw
local player_car_place_view 00A731,00A767 R2 far_z
local player_car_place_view 00A735,00A76B R3 near_x
local player_car_place_view 00A739,00A76F R4 near_y
local player_car_place_view 00A73D,00A773 R5 near_z
local player_car_place_view 00A789 R2 quadrant_yaw
local player_car_place_view 00A759,00A783 R8 pitch_here
local player_car_place_view 00A75C,00A786,00A7AB,00A7B3 R9 yaw_here
local player_car_place_view 00A801,00A80C,00A818 R2 tilt
local player_car_place_view 00A83E R3 eye_x
local player_car_place_view 00A83E,00A846 R4 eye_y
local player_car_place_view 00A83E,00A84B R5 eye_z
local player_car_place_view 00A6FF R18 segment_remaining
param angles_to_offset R0 pitch
param angles_to_offset R1 yaw
param angles_to_offset R2 distance
param angles_to_offset R3 offset_x
param angles_to_offset R4 offset_y
param angles_to_offset R5 offset_z
param player_car_engine R7 road_force
param player_car_engine R8 drive_force
param player_car_engine R9 force
param player_car_engine R19 gear_ratio
local player_car_engine 00A876 R18 top_speed
local player_car_engine 00A8B4,00A8ED R0 tyre_noise
param player_car_engine R12 handling
param player_car_engine_wheelspin R9 force
param player_car_engine_wheelspin R18 top_speed
param player_car_engine_wheelspin R19 gear_ratio
local player_car_engine_wheelspin 00A918,00A91F,00A94E,00A95A,00A984 R0 speed_then_revs
local player_car_engine_wheelspin 00A925,00A930,00A967,00A96A R1 speed_step
local player_car_engine_wheelspin 00A9A3 R0 revs_change
local player_car_engine_wheelspin 00A99F,00A9BD,00A9C9 R1 revs
local player_car_engine_wheelspin 00A918 t1 spin_speed_change
local player_car_engine_wheelspin 00A918 t3 spin_speed
local player_car_engine_wheelspin 00A96A t2 spin_target_speed
local player_car_engine_wheelspin 00A930 t2 spin_top_speed
local player_car_engine_wheelspin 00A9A3 t2 spin_target_revs
param player_car_engine_grip R9 force
param player_car_engine_grip R18 top_speed
param player_car_engine_grip R19 gear_ratio
local player_car_engine_grip 00A9F2,00A9F9,00AA28,00AA34,00AA5E,00AA76 R0 speed_then_revs
local player_car_engine_grip 00A9FF,00AA0A,00AA41,00AA44 R1 speed_step
local player_car_engine_grip 00A9F2 t1 grip_speed_change
local player_car_engine_grip 00A9F2 t3 grip_speed
local player_car_engine_grip 00AA44 t2 grip_target_speed
local player_car_engine_grip 00AA0A t2 grip_top_speed
local player_car_engine_standing 00AA80,00AA85 R0 gas_revs
param player_car_engine_revs R0 target_revs
local player_car_engine_revs 00AA8C R0 revs_change
local player_car_engine_revs 00AA88,00AAA6,00AAB2 R1 revs
local player_car_engine_revs 00AA8C t2 wanted_revs   # target_revs, kept while the subtraction takes its register
local angles_to_offset 00AAC4 R6 pitch_cosine
local player_car_next_surfaces 00B4F8 R7 stage_then_surfaces
local player_car_next_surfaces 00B508 R5 stage_length
param player_car_road_drag R0 drag
param player_car_road_drag R1 road_x
param player_car_road_drag R2 road_half_width
param player_car_road_drag R3 half_width
local player_car_road_drag 00B5BF,00B600,00B603,00B609,00B60C,00B612,00B615,00B637,00B63A,00B640,00B643,00B649,00B64C R1 surface_bits
local player_car_road_drag 00B59C,00B5B3,00B631 R4 low_side
local player_car_road_drag 00B5F7,00B62E R5 beyond_edge
local player_car_road_drag 00B5A2 R9 empty_bits
local player_car_road_drag 00B5E1 R15 inner_edge_1
local player_car_road_drag 00B5E5 R16 outer_edge_1
local player_car_road_drag 00B5E9 R17 inner_edge_2
local player_car_road_drag 00B5ED R18 outer_edge_2
param player_car_road_drag R12 handling
local player_car_off_road_shake 00B6E9 R0 tyre_noise
local race_cars_start 009597,009743 R0 cars_left
local race_cars_start 0095A0 R1 player
local race_cars_start 009636 R3 rider_places
local race_cars_start 0096BB R3 driver_occupant
local race_cars_start 0096FB R3 rider
local race_cars_start 0095B8 R11 record
local race_car_draw 0098BD R0 body_attributes
local race_car_draw 0099F9,009A0A,009A11 R0 hard_acceleration_frame
local race_car_draw 00976D R1 far_segment
local race_car_draw 009750,0098BD,0099B4,0099D4,0099F0,0099F6,009A29,009A2C,009A91,009AA7,009B21 R10 sprite_entry sprite_words
local race_car_draw_behind 009BBA,009BD9 R10 sprite_entry sprite_words
local race_car_draw 0099A9,0099C9 R11 rider_places
local race_car_draw 0097B8 R13 relative_y
local race_car_draw 00987D,009882,009897,00989B,0098BD,0099AD,0099CD,009A1E,009A29,009A2C,009B06,009B21 R13 palette
local race_car_draw_behind 009BB2,009BBA,009BD1,009BD9 R13 palette
local race_car_draw 0097DE,009847,009B41 R15 screen_x
local race_car_draw 0097FC,00984F,009B44 R16 screen_y
local race_car_draw 00981A R17 depth
local race_car_draw 0098A7,009A23,009A78,009A99,009B14 R17 sprite_x
local race_car_draw_behind 009B80,009B8B,009B99 R17 sprite_x
local race_car_draw 0098AA,009A26,009A89,009AA0 R18 sprite_y
local race_car_draw_behind 009BA2,009BC5 R18 sprite_y
local race_car_draw 0098D2 R1 body_animation
local race_car_draw 0097CC,0097EA R2 x_term
local race_car_draw 0097CF,0097ED R3 y_term
local race_car_draw 00996A,009978,00997D,009981,009986 R3 view
local race_car_draw 009991 R4 view_offset
local race_car_draw_link 009BDC R4 depth_list depth_list
local race_car_draw_link 009BEA R5 group
local race_car_draw_link 009BF1 R6 older_group
local race_car_draw 009928,00993F,009943,00994B R7 second_rider_frame
local race_car_draw_behind 009B59,009B5D,009B61,009B69 R7 distance_behind
local race_car_draw_behind 009B61 t2 past_limit
local race_car_draw 009839,009870,009B1C,009B3C R8 scale
local race_car_draw_behind 009BA6,009BAA,009BC9 R8 scale
local race_car_draw 009831,009B37 R9 depth_layer
local race_car_draw_behind 009B6C R9 depth_layer
local race_car_draw 00991C t1 swapped_rider
local race_car_draw 0099E9 t1 swapped_spray
local race_car_draw_behind 009B55 R11 own_race
param race_car_draw_behind R12 last_piece
param race_car_draw_behind R14 last_size_step
local race_car_draw_behind 009BAE,009BBA R12 animation   # the car's animation, which race_car_put_frame draws from
local race_car_draw_behind 009BB6,009BBA R14 frame
local race_car_draw 0099B7 R12 gestures_shown
local race_car_draw 0099BC t3 second_rider_gesture
param race_car_draw_spray R4 view_offset
param race_car_draw_spray R5 x_offset
param race_car_draw_spray R6 y_offset
param race_car_draw_spray R7 wheel_effect_sides
param race_car_draw_spray R8 scale
param race_car_draw_spray R10 sprite_entry
param race_car_draw_spray R15 screen_x
param race_car_draw_spray R16 screen_y
local race_car_draw_spray 009C2F,009C40 R0 kind
local race_car_draw_spray 009C1E,009C47,009C4D,009C59 R1 frame
local race_car_draw_spray 009C33 R2 effect
local race_car_draw_spray 009C60 R11 places
local race_car_draw_spray 009C69 R13 palette
param race_car_draw_part R4 view_offset
param race_car_draw_part R5 x_offset
param race_car_draw_part R6 y_offset
param race_car_draw_part R8 scale
param race_car_draw_part R10 sprite_entry
param race_car_draw_part R11 places car_part_place
param race_car_draw_part R13 palette
param race_car_draw_part R15 screen_x
param race_car_draw_part R16 screen_y
local race_car_draw_part 009C71,009C84,009C8E,009C98 R17 sprite_x
local race_car_draw_part 009C74,009C87,009C9B R18 sprite_y
param race_car_put_frame R0 attributes
param race_car_put_frame R8 scale
param race_car_put_frame R10 sprite_entry
param race_car_put_frame R13 palette
param race_car_put_frame R17 sprite_x
param race_car_put_frame R18 sprite_y
local race_car_put_frame 009CAE R0 piece_attributes
param race_car_put_frame R12 last_piece
param race_car_put_frame R14 last_size_step
param race_car_put_sprite R0 attributes
param race_car_put_sprite R8 scale
param race_car_put_sprite R10 sprite_entry sprite_words
param race_car_put_sprite R13 palette
param race_car_put_sprite R17 sprite_x
param race_car_put_sprite R18 sprite_y
local race_car_put_sprite 009CB6 R0 piece_attributes
local race_car_put_sprite 009CCC R1 sprite_source_size
local race_car_put_sprite 009CD7 R1 sprite_rom_offset
local race_car_put_sprite 009CE9 R2 height_and_bits
local race_car_put_sprite 009D06 R2 width_and_bits
local race_car_put_sprite 009D1C R2 piece_y
local race_car_put_sprite 009D31 R2 piece_x
local race_car_put_sprite 009D44 R2 palette_word
param race_car_put_sprite R12 last_piece
param race_car_put_sprite R14 last_size_step
param race_car_put_flat_sprite R10 sprite_entry sprite_words
param race_car_put_flat_sprite R13 palette_word
param race_car_put_flat_sprite R17 sprite_x
param race_car_put_flat_sprite R18 sprite_y
local race_car_put_flat_sprite 009D79 R1 sprite_source_size
local race_car_put_flat_sprite 009D84 R1 sprite_rom_offset
local race_car_put_flat_sprite 009D8A R2 height_and_bits
local race_car_put_flat_sprite 009D9B R2 width_and_bits
param race_car_put_flat_sprite R12 last_piece
param race_car_put_flat_sprite R14 last_size_step
local player_car_load_gears 00A01C R1 model_transmission
local player_car_load_gears 00A010 R12 handling                  # car_handlings[model], into the car's handling
local player_car_build_torque_curves 00A069,00A084 R1 curve_force
local player_car_build_torque_curves 00A04A,00A081 R10 curve_entry torque_curve_forces
local player_car_build_torque_curves 00A074,00A087 R2 steps_left
local player_car_build_torque_curves 00A077 R3 force_step
local player_car_build_torque_curves 00A053,00A057,00A093 R9 gears_left
local player_car_build_torque_curves 00A063 t1 next_speed
local player_car_build_torque_curves 00A066 t1 next_force
local player_car_drive 00A40F,00A490,00A526,00A530 R13 road_x
local player_car_drive 00A3B1,00A3F8,00A447,00A477,00A486 R15 segment_fraction
local player_car_drive 00A41F,00A423,00A434,00A43B,00A47B,00A4C5,00A4C9,00A4DA,00A4E8 R17 segment_length
009F2C  table  race_car_spray_2_animations  u16   # race_cars_start "spray_2_animations = 9F2C": the second spray's animation by its kind (3A 3A 3A 3C 3B ..., race_car_draw_spray through spray_2_animations)
009F4C  table  race_car_spray_1_animations  u16   # race_cars_start "spray_1_animations = 9F4C": the first spray's animation by its kind (3F 3F 3F 41 40 ...)
00CB98  data  check_point_lcd_text_branch_0   # ~~~ CHECK POINT ~~~ (7E: the LCD's arrow character), branch_arrow_update 00CAF4 into screen lcd_scroll_request for car branch 0
00CBAC  data  check_point_lcd_text_branch_1   # the same with character 7F, for car branch 1 (branch_arrow_update 00CB04)
00D08E  data  total_time_text                 # TOTAL TIME (x 58, y 30, attribute B0; goal_update, draw_text)
00D0A0  data  branch_arrow_palette_steps      # 5D 5D 5E 5E 5F 5F, then FFF2 back to the start: the arrow's colour cycle (branch_arrow_update into palette_list)
00D0AE  data  dream_flying_song_title         # Dream Flying (goal_update 00C987 "movea.b D0AE, R10", start_song_title)
00DF74  data  entry_invitation_objects        # the count (3) of the handler list at 00DF78 (entry_countdown_start, credit_display_update, coin_prompt_update), which start_object_list takes from here (entry_invitation_step 00DE57)
00DF84  data  network_check_text              # NETWORK CHECK (print_text_layer: x, y, attribute, the characters; FFFF closes the list)
00DF98  data  communication_success_text      # COMMUNICATION SUCCESS. (network_check_result)
00DFB4  data  machine_id_text                 # THIS MACHINE ID IS (the board's number follows it at 31F736)
00DFCE  data  communication_failed_text       # COMMUNICATION FAILED.
00DFEA  data  stand_alone_machine_text        # THIS MACHINE IS STAND-ALONE.
00E00C  data  master_machine_text             # THIS MACHINE IS MASTER CONTROLLER.
00E034  data  slave_machine_text              # THIS MACHINE IS SLAVE.
00E055  data  isdn_machine_text               # THIS MACHINE IS ISDN MODE.
00E07C  data  unused_race_copy_addresses      # unused: by player, the address of its race_copy record (20FC00, 20FC80 ... 20FF80, then 210000), what race_copy_offsets holds as offsets; after three bytes of padding
00E10C  data  network_check_master_text       # NETWORK CHECK (MASTER) (network_check)
00E128  data  network_check_slave_text        # NETWORK CHECK (SLAVE)
00E143  data  network_check_isdn_text         # NETWORK CHECK (ISDN)
00E15E  data  board_check_text                # BOARD CHECK
00E170  data  wait_text                       # WAIT, blinking on the status line (network_check_wait_board, network_check_wait_isdn through current_object, network_check_blink_text)
00E17A  data  check_dualport_ram_characters   # "   CHECK DUALPORT RAM    ", characters only (network_check_toggle_memory_text 00D739)
00E1B6  data  check_network_status_text       # CHECK NETWORK STATUS, blinking (network_check through current_object)
00E1D6  data  check_trans_end_text            # CHECK TRANS END (network_check)
00E40E  data  network_error_text              # NETWORK ERROR, blinking (network_check_error, network_check_halt through current_object)
00E422  data  connection_error_texts          # CONNECTION ERROR (a list: print_text_layer_list; network_check_board_memory, network_check_greeting)
00E464  data  communication_board_error_texts # COMMUNICATION BOARD ERROR (network_check_four_ics, network_check_five_ics)
00E484  data  communication_time_out_texts    # COMMUNICATION TIME OUT (network_check_wait_board)
constant network_check_again 16000 BOARD_OFF_LOOPS   # the busy wait with the link board off (00D0DD "mov.w #16000, R1", dbr)
constant network_check_isdn 16000 BOARD_OFF_LOOPS    # the same (00D2C6)
local rev_meter_update 00BFC5,00C011 R0 state_code
local rev_meter_update 00BFD7 R9 animation
local speedometer_update 00C01B,00C0B4 R0 state_code
local speedometer_update 00C02F R9 animation
local speedometer_update 00C06F,00C07D,00C0AB,00C0BA R18 speed_kmh
local speedometer_update 00C0A8,00C0AB R19 digit
local speedometer_update 00C0B2 s4 saved_speed_kmh
local speed_unit_update 00C0CA,00C0CF R0 state_code
local speed_unit_update 00C0DF R9 animation
local gear_indicator_update 00C111,00C116 R0 state_code
local gear_indicator_update 00C16B,00C1D7,00C1EC,00C22B R0 top_gear_then_frames
local gear_indicator_update 00C162 R0 tyre_noise
local gear_indicator_update 00C16F,00C182,00C1A2 R1 gear
local gear_indicator_update 00C12B R9 animation
local shift_up_hint_update 00C235 R0 state_code
local shift_up_hint_update 00C284,00C288,00C293 R0 blink
local shift_up_hint_update 00C247 R9 animation
local place_count_update 00C2B0,00C2FF R0 place
local place_count_update 00C2C0,00C2C7 R0 count_frame
local place_count_update 00C2C7 t1 racer_count
local place_count_update 00C320,00C33C R0 initial_place
local place_count_update 00C2CC R9 animation
local place_count_update 00C2F2 s4 saved_count_frame
local place_number_update 00C346,00C34B,00C3B6,00C3BD,00C438 R0 new_palette
local place_number_update 00C387,00C38E,00C3A8 R0 palette
local place_number_update 00C374 R9 animation
local place_number_update 00C383 t2 place
local place_number_update 00C3B2 t2 new_place
local place_number_update 00C3FE t2 frames_left
local lap_timer_update 00C442,00C54C R0 checkpoint_signal
local lap_timer_update 00C4D3,00C4E0,00C4FC,00C50A R0 lap_time
local lap_timer_update 00C527,00C52B,00C52E,00C531 R0 checkpoint_signal
local lap_timer_update 00C4C0,00C4EA,00C4F6 R1 checkpoints
local lap_timer_update 00C4B8 R10 time_text
local lap_timer_update 00C4B3,00C541 R19 text
local lap_timer_update 00C45C R9 animation
local stage_indicator_start 00C553 R9 animation
local stage_indicator_draw 00C585,00C596 R0 stage_level
local stage_indicator_draw 00C58A R19 text
local start_message_update 00C5A0,00C659 R0 dj_message
local start_message_update 00C5F2,00C61B,00C646 R0 dj_message
local start_message_update 00C5D2,00C5D6,00C609,00C62E R9 animation
local time_left_display_update 00C6F9,00C701,00C706,00C7AC R0 shown_time
local time_digits_start 00C6BB R9 animation
param time_digits_draw R0 digits
local time_digits_draw 00C71D R1 digit
local time_digits_draw 00C712 R18 digit_record time_digit   # a digit's record (object 80, 88, 90; "movea.b 80[R20], R18"), then the walk through it: past the flip (00C720 "test.b [R18+]"), past the digit (00C722 "mov.b [R18+], R2"), and past the record (00C728 "movea.b 4[R18], R18"; 00C78C "pop R18" brings that back after draw_object)
local time_digits_draw 00C720 R18 digit_record time_digit+1
local time_digits_draw 00C722 R18 digit_record time_digit+2
local time_digits_draw 00C728 R18 digit_record time_digit+8
local time_digits_draw 00C78C R18 digit_record time_digit   # the next digit's record, put back after draw_object
local time_digits_draw 00C717,00C78A,00C79B R19 digits_left
local time_digits_draw 00C722 R2 shown_digit
local time_digits_draw 00C725,00C73F,00C75B R3 flip_width
local time_digits_draw 00C72C,00C73B R4 remaining_digits
local time_digits_draw 00C77E s4 saved_digits
local time_digits_draw 00C780 s8 saved_digit_record
local time_digits_draw 00C782 sC saved_digits_left
local time_digits_draw 00C720 t1 flip
local time_digits_draw 00C73F t1 closing_width
local extend_time_message_start 00C7F8 R9 animation
local extend_time_message_start 00C83F R10 lamp screen_lamps
param extend_time_message_blink R0 leftover
local extend_time_message_blink 00C85D,00C861,00C86C R0 blink
local goal_update 00C8BA,00C9D0 R0 sound_code
local goal_update 00C942 R0 finish_time
local goal_update 00C95F,00C992 R0 sound_code
local goal_update 00C94F,00C955 R0 dj_message
local goal_update 00C987 R10 song_title
local goal_update 00C9D6,00C9E1 R19 text
local goal_update 00C907 R9 animation
local goal_update 00C982 t2 show_timer
local goal_update 00C9C0 t2 title_timer
local goal_update 00C9C8 t2 result_timer
local goal_update 00C9A6 R21 result_object
local race_result_start 00CA19,00CA20 R0 palette
local race_result_start 00CA05 R9 animation
local race_result_start 00CA15 t2 place
local race_result_verdict_start 00CA75,00CA89 R9 animation
local race_result_verdict_start 00CA61 t2 place
local branch_arrow_update 00CAD8,00CADE R0 dj_message
local branch_arrow_update 00CB5B R0 new_y
local branch_arrow_update 00CB6E R0 new_scale
local branch_arrow_update 00CB7D,00CB87,00CB92 R0 palette
local branch_arrow_update 00CAF4,00CB04 R10 lcd_text
local branch_arrow_update 00CB79,00CB7D,00CB84,00CB87 R10 palette_list object_palette_steps
local branch_arrow_update 00CAF9,00CB09 R9 animation
local checkpoint_board_update 00CBE2 R0 racer
local checkpoint_board_update 00CC91,00CCA8,00CCAE R0 row_time
local checkpoint_board_update 00CD0D,00CD19 R0 blink_on
local checkpoint_board_update 00CC1E R0 checkpoints_passed
local checkpoint_board_update 00CD38 R0 row_offset
local checkpoint_board_update 00CC97 R1 player
local checkpoint_board_update 00CCB4 R0 screen_player
local checkpoint_board_update 00CC07 R10 checkpoint_count checkpoint_counts
local checkpoint_board_update 00CC5F R21 row_player
local checkpoint_board_update 00CBDF,00CBFF R9 racers_left
local checkpoint_board_update 00CCA8 t3 gap
local checkpoint_board_update 00CCEC t2 offset_before
param checkpoint_board_draw_row R21 player
local checkpoint_board_draw_row 00CD98,00CDCB,00CDDE,00CE1E,00CE65,00CE92 R0 row_x
elements board_car_images u32 ram   # the checkpoint board's car images in its object, by player from 80 (checkpoint_board car_sprites; checkpoint_board_update 00CBF5 "mov.w CFC8[PC](R1), 80[R20](R0)" from checkpoint_board_car_sprites): a word each, which checkpoint_board_draw_row (00CDED "movea.w 80[R20](R21), R10") reads a half at a time: the animation in the low one (00CDF3 "movz.hw [R10+], R9"), the palette in the high one (00CDF6 "mov.h [R10+], 3A[R20]")
local checkpoint_board_draw_row 00CDED R10 car_sprite board_car_images
local checkpoint_board_draw_row 00CE48 R18 time_text
local checkpoint_board_draw_row 00CE28,00CE2E R3 text_x
local checkpoint_board_draw_row 00CE34,00CE3D R5 text_attribute
local checkpoint_board_draw_row 00CDAC,00CDF3,00CE74 R9 animation
param checkpoint_board_leader_time R0 time
param checkpoint_board_leader_time R1 player
local checkpoint_board_leader_time 00CE9C R10 time_text
param time_to_text_thousandths R0 time
param time_to_text_thousandths R10 text
param time_to_text R0 time
param time_to_text R10 text object_text_characters
local time_to_text 00CEB2,00CEB5,00CEBE,00CEC1,00CECF,00CED2,00CEDB,00CEDE R1 digit
param checkpoint_board_gap_time R0 time
param checkpoint_board_gap_time R1 player
local checkpoint_board_gap_time 00CEF6,00CF0D,00CF19,00CF1C,00CF2C,00CF3A,00CF3D,00CF4C,00CF4F,00CF5E R10 text object_text_characters
local checkpoint_board_gap_time 00CF04,00CF07,00CF10,00CF13,00CF21,00CF24,00CF2F,00CF32 R1 digit
local checkpoint_board_gap_time 00CEFC R2 zero_char
local network_check_again 00D0DD,00D0E4 R1 delay
local network_check 00D199,00D1A6,00D1B3,00D1BA,00D1C0,00D1C7,00D271,00D278 R19 text
local network_check 00D1FD t1 board_flags_greeted
local network_check 00D224 t1 board_flags_role
local network_check 00D238 t1 board_flags_status
local network_check 00D257 t1 board_status
local network_check_join 00D2A7 R0 machine
local network_check_join 00D298,00D2A0 R1 count
local network_check_join 00D324,00D333 R2 car_number
local network_check_isdn 00D2C6,00D2CD R1 delay
local network_check_stand_alone 00D2F5 R0 machine
param network_check_result R0 machine
local network_check_result 00D509,00D51A R0 frames_left
local network_check_result 00D355 R1 second_player
local network_check_result 00D401,00D408,00D429,00D430,00D436,00D43D,00D443,00D44A,00D46B,00D472,00D478,00D47F,00D485,00D48C,00D4AC,00D4B3,00D4B9,00D4C0,00D4C6,00D4CD,00D4ED,00D4F4,00D4FC,00D503 R19 text
local network_check_result 00D510 s4 saved_frames_left
local network_check_result 00D4D3 t1 isdn_machine_id
local network_check_result 00D421 t1 board_master
local network_check_result 00D492 t1 slave_machine_id
local network_check_result 00D450 t1 master_machine_id
local network_check_board_memory 00D52B,00D530 R0 count_then_faults
local network_check_board_memory 00D535,00D53A R1 outcome
local network_check_board_memory 00D524 R10 board_memory
local network_check_board_memory 00D774 R19 error_texts
param network_check_memory_test R0 count
param network_check_memory_test R10 memory
local network_check_memory_test 00D544 R1 byte_count
local network_check_memory_test 00D547,00D5D9 R2 seed
local network_check_memory_test 00D550,00D582,00D58C,00D5CF R3 pattern
local network_check_memory_test 00D553,00D585,00D58F,00D5D2 R4 bytes_left
local network_check_memory_test 00D55F,00D566,00D56D,00D574,00D5AC,00D5B3,00D5BA,00D5C1 R5 address_bits
local network_check_memory_test 00D55C,00D564,00D56B,00D572,00D579,00D580,00D5A9,00D5B1,00D5B8,00D5BF,00D5C6,00D5CD R6 rotation
local network_check_memory_test 00D54D,00D556,00D589,00D592,00D59E R7 cell
local network_check_memory_test 00D55F t3 written_low_15_bits
local network_check_memory_test 00D566 t4 written_low_12_bits
local network_check_memory_test 00D56D t4 written_low_9_bits
local network_check_memory_test 00D574 t4 written_low_6_bits
local network_check_memory_test 00D592 t2 byte_read
local network_check_memory_test 00D5AC t3 read_low_15_bits
local network_check_memory_test 00D5B3 t4 read_low_12_bits
local network_check_memory_test 00D5BA t4 read_low_9_bits
local network_check_memory_test 00D5C1 t4 read_low_6_bits
local network_check_memory_test 00D54A,00D59A R0 faults            # the bits found wrong, in the low byte (what it hands back)
local network_check_wait_board 00D75A R19 error_texts
local network_check_wait_board 00D5FE t2 frames_left
local network_check_wait_board 00D604 t1 board_flags
local network_check_wait_isdn 00D629 t1 board_machines
local network_check_wait_isdn 00D64F t2 frames_left
local network_check_delay 00D658,00D65F R0 delay
local network_check_greeting 00D67E R0 board_answer
local network_check_greeting 00D686,00D689,00D68C,00D68F,00D692,00D695 R2 answer_letters   # the board's answer at 800010, a letter a halfword: Z80 (5A3830)
local network_check_greeting 00D78E R19 error_texts
local network_check_five_ics 00D6B6,00D828 R0 ic_count
local network_check_five_ics 00D818 R19 error_texts
local network_check_five_ics 00D6AD,00D825,00D82B R2 self_test
local network_check_four_ics 00D6C4,00D86D R0 ic_count
local network_check_four_ics 00D85C R19 error_texts
local network_check_four_ics 00D6BB,00D869,00D87B R2 self_test
param network_check_show_ics R0 ic_count
param network_check_show_ics R2 self_test
local network_check_show_ics 00D6C7,00D6E5 R1 ic
local network_check_show_ics 00D6CD,00D6D5 R3 text_index
local network_check_show_ics 00D6D7,00D6DF R19 text
local network_check_blink_text 00D705,00D708 R18 character
local network_check_blink_text 00D6FF,00D710 R19 cell text_layer_cells
local network_check_clear_status_line 00D716,00D724 R0 cell text_layer_cells
local network_check_clear_status_line 00D71D,00D728 R1 cells_left
local network_check_toggle_memory_text 00D72D,00D73E R26 character
local network_check_toggle_memory_text 00D741 t2 cell
param network_check_error R19 error_texts
local link_take_master_settings 00D8F9,00D909,00D919 R0 players_left
local link_take_master_settings 00D8FD R1 record_size
local link_take_master_settings 00D8F0,00D906 R10 record_car_number race+2   # 20FC02: the car_number of each race_copy record, 80 apart
local link_take_master_settings 00D8F5,00D902 R11 car_number_slot player_car_numbers
local link_take_master_settings 00D936,00D966 R9 coins_changed
local link_take_master_settings 00D8DC t1 isdn_records_ready
local race_entries_update 00DA1C,00DA2E,00DA8F,00DAA6 R0 entry_frames
local race_entries_update 00DA06,00DA23,00DA68,00DA7D,00DAAF,00DABE R1 players_left
local race_entries_update 00DA4F,00DA58 R1 machines
local race_entries_update 00DB22,00DB25 R1 entrant_count
local race_entries_update 00DA64,00DA7A R13 request race+19   # the entry_request of each race_copy record, 80 apart
local race_entries_update 00DB1D,00DB64 R13 entrant_list
local race_entries_update 00DA0A R2 record_size
local race_entries_update 00DA6C,00DA78 R3 player
local race_entries_update 00DA30,00DA5C R9 next_entry_frames
local race_entries_update 00DA2E t1 old_entry_frames
local race_entries_update 00DA13,00DAB3,00DAB9 R13 other_race
param race_entries_update R14 entry_place
local race_progress_update 00DB96,00DBAB,00DBBA,00DBD1,00DCCE,00DD09 R0 racers_left
local race_progress_update 00DC1E,00DC22,00DC25,00DD91,00DD95 R0 fork_index
local race_progress_update 00DC68,00DCC3 R0 comparisons_left
local race_progress_update 00DCD1,00DD07 R1 place
local race_progress_update 00DBB5 R14 counted_stages
local race_progress_update 00DB93,00DB99,00DBB2,00DBBD R13 order_entry race_order_players
local race_progress_update 00DBBD,00DCD4,00DD04 R2 racer
local race_progress_update 00DBD7,00DBE3 R3 checkpoint
local race_progress_update 00DBE9 R4 order
local race_progress_update 00DC6F,00DCB7 R4 ahead_player
local race_progress_update 00DBFC R5 branch
local race_progress_update 00DD3B,00DD5C R5 checkpoint_offset
local race_progress_update 00DC83,00DCB7 R6 next_player
local race_progress_update 00DC68 t1 racer_total
local race_progress_update 00DCB7 t1 swapped_player
local race_progress_update 00DC7A,00DCBA R13 ahead_race
local race_progress_update 00DCCA,00DCCE R13 order_place
local race_progress_update 00DCD4,00DD04 R13 order_place race_order_players   # past race_order (20): the next racer's byte
local race_progress_update 00DBA4 R2 checked_race
local race_progress_update 00DB88,00DB8C R19 host_order
local race_progress_update 00DBC8 R15 passing_race
local race_progress_update 00DC61,00DC65 R16 sort_place
local race_progress_update 00DC6F,00DC83 R16 sort_place race_order_players   # past race_order (20): the next racer's byte
local race_progress_update 00DB8C R9 host_racer_count
local race_progress_update 00DB8F R1 host_pass_count
param race_progress_update R12 host_record
param race_progress_update R14 racer_copy
local entry_invitation_step 00DE1A,00DEA1 R10 lamp screen_lamps
local entry_invitation_step 00DE57 R10 object_list
local players_not_ready 00DEE0,00DEF3 R1 racers_left
local course_records_update 00DF1C,00DF20 R8 record_offset
local course_records_update 00DEFD,00DF6D R9 players_left
local course_records_update 00DEF8,00DF0B R10 seen_serials seen_record_serials
local course_records_update 00DF45,00DF5C R13 backup_record backup_course_record
local course_records_update 00DF0B t1 seen_serial
local link_receive_records 00E66C R1 record_count
local link_receive_records 00E632,00E851,00E8D4 R1 pairs_left
local link_receive_records 00E626,00E847,00E854,00E858,00E85C,00E860,00E864,00E868,00E86C,00E870,00E874,00E878,00E87C,00E880,00E884,00E888,00E88C,00E890,00E894,00E898,00E89C,00E8A0,00E8A4,00E8A8,00E8AC,00E8B0,00E8B4,00E8B8,00E8BC,00E8C0,00E8C4,00E8C8,00E8CC,00E8D0 R10 source race_record_words
local link_receive_records 00E62D,00E667,00E84C,00E854,00E858,00E85C,00E860,00E864,00E868,00E86C,00E870,00E874,00E878,00E87C,00E880,00E884,00E888,00E88C,00E890,00E894,00E898,00E89C,00E8A0,00E8A4,00E8A8,00E8AC,00E8B0,00E8B4,00E8B8,00E8BC,00E8C0,00E8C4,00E8C8,00E8CC,00E8D0 R11 destination race_record_words
local link_receive_records 00E657 t1 board_error
local link_receive_records 00E66F t1 second_buffer
local link_receive_records 00E854 t2 block_00
local link_receive_records 00E854 t4 bytes_04
local link_receive_records 00E858 t2 block_08
local link_receive_records 00E858 t4 bytes_0C
local link_receive_records 00E85C t2 block_10
local link_receive_records 00E85C t4 bytes_14
local link_receive_records 00E860 t2 block_18
local link_receive_records 00E860 t4 bytes_1C
local link_receive_records 00E864 t2 block_20
local link_receive_records 00E864 t4 bytes_24
local link_receive_records 00E868 t2 block_28
local link_receive_records 00E868 t4 bytes_2C
local link_receive_records 00E86C t2 block_30
local link_receive_records 00E86C t4 bytes_34
local link_receive_records 00E870 t2 block_38
local link_receive_records 00E870 t4 bytes_3C
local link_receive_records 00E874 t2 block_40
local link_receive_records 00E874 t4 bytes_44
local link_receive_records 00E878 t2 block_48
local link_receive_records 00E878 t4 bytes_4C
local link_receive_records 00E87C t2 block_50
local link_receive_records 00E87C t4 bytes_54
local link_receive_records 00E880 t2 block_58
local link_receive_records 00E880 t4 bytes_5C
local link_receive_records 00E884 t2 block_60
local link_receive_records 00E884 t4 bytes_64
local link_receive_records 00E888 t2 block_68
local link_receive_records 00E888 t4 bytes_6C
local link_receive_records 00E88C t2 block_70
local link_receive_records 00E88C t4 bytes_74
local link_receive_records 00E890 t2 block_78
local link_receive_records 00E890 t4 bytes_7C
local link_receive_records 00E894 t2 block_80
local link_receive_records 00E894 t4 bytes_84
local link_receive_records 00E898 t2 block_88
local link_receive_records 00E898 t4 bytes_8C
local link_receive_records 00E89C t2 block_90
local link_receive_records 00E89C t4 bytes_94
local link_receive_records 00E8A0 t2 block_98
local link_receive_records 00E8A0 t4 bytes_9C
local link_receive_records 00E8A4 t2 block_A0
local link_receive_records 00E8A4 t4 bytes_A4
local link_receive_records 00E8A8 t2 block_A8
local link_receive_records 00E8A8 t4 bytes_AC
local link_receive_records 00E8AC t2 block_B0
local link_receive_records 00E8AC t4 bytes_B4
local link_receive_records 00E8B0 t2 block_B8
local link_receive_records 00E8B0 t4 bytes_BC
local link_receive_records 00E8B4 t2 block_C0
local link_receive_records 00E8B4 t4 bytes_C4
local link_receive_records 00E8B8 t2 block_C8
local link_receive_records 00E8B8 t4 bytes_CC
local link_receive_records 00E8BC t2 block_D0
local link_receive_records 00E8BC t4 bytes_D4
local link_receive_records 00E8C0 t2 block_D8
local link_receive_records 00E8C0 t4 bytes_DC
local link_receive_records 00E8C4 t2 block_E0
local link_receive_records 00E8C4 t4 bytes_E4
local link_receive_records 00E8C8 t2 block_E8
local link_receive_records 00E8C8 t4 bytes_EC
local link_receive_records 00E8CC t2 block_F0
local link_receive_records 00E8CC t4 bytes_F4
local link_receive_records 00E8D0 t2 block_F8
local link_receive_records 00E8D0 t4 bytes_FC
# ======== locals (batch L3) ========
# The link board's race records (link_isdn_receive_records, link_copy_records_in, link_send_records)
param link_copy_records_in R1 record_count            # dbr R1 (00E840): the records to copy
param link_copy_records_in R10 board_records          # the link board's memory (a byte in each halfword): 800600 (ISDN), 800020 or 800720
param link_copy_records_in R11 race_records race_record_bytes   # where they go: 21E000 (ISDN), 20FC00 (race_copy)
local link_isdn_receive_records 00E646 R1 record_count
local link_isdn_receive_records 00E638 R10 board_records
local link_isdn_receive_records 00E63F R11 race_records
local link_send_records 00E90D R1 record_count        # 2: this machine's two records
local link_send_records 00E906 R11 board_records      # 800FE0 down: the link board's copy of them
local link_send_records 00E8F8 t1 board_error         # "test.b 80000C": the link board's error byte
# draw_object and its draw modes: the object's sprites go into the screen's sprite list at sprite_entry (the next
# free 16-byte entry past sprite_list_last); the road modes take the object's segment from the road's projected
# list (screen + 3000: 16 bytes a segment out from the window: scale, width, x, y, depth layer)
param draw_object R0 routine_then_layer               # 00EAEE "mov.w EB44[PC](R0), R0": the draw mode's routine (draw_object_mode_jumps), 00EB03 "movz.hw 3C[R20], R0": the depth layer; one variable with what the handler had in R0 (handed back as it is when nothing is drawn) and what the draw mode leaves there, as draw_object hands it back (no caller reads it)
local draw_object 00EAF3 R10 sprite_entry sprite_words   # "movea.b 10[C0[R25]], R10": the entry past sprite_list_last; the draw mode hands back the one past its sprites
local draw_object 00EB07 R11 depth_list depth_list               # screen + 5000 + depth_layer * 4: the layer's list (its newest group, its oldest)
local draw_object 00EB1C R2 layer_head                # "movz.hw [R11], R2": the jump to the layer's newest group (0: none)
param draw_object_entry R10 sprite_entry sprite_words
param draw_object_command R10 sprite_entry sprite_words
param draw_object_between_segments R0 leftover
param draw_object_between_segments R10 sprite_entry sprite_words
local draw_object_between_segments 00EB7B,00EB83,00EB96 R0 projected_offset   # segments from the window, * 10: the segment's record in the projected list, then the next one's
local draw_object_between_segments 00EBB7,00EBFA R0 x
local draw_object_between_segments 00EBBB,00EC07 R1 y
local draw_object_between_segments 00EB88 R11 projected_segment projected_segment
local draw_object_between_segments 00EB8E,00EC14 R2 scale
local draw_object_between_segments 00EBA1 R3 next_scale
local draw_object_between_segments 00EBD5,00EBF4 R4 next_x
local draw_object_between_segments 00EBD9,00EC01 R5 next_y
local draw_object_between_segments 00EBEE R6 near_weight      # 80 - position_fraction: the near segment's share (80ths)
local draw_object_between_segments 00EB7B t3 segment          # "sub.h 46[20[R25]], R0": the object's segment (position)
param draw_object_from_road_edge R0 leftover
param draw_object_from_road_edge R10 sprite_entry sprite_words
local draw_object_from_road_edge 00EC22,00EC2A,00EC3D R0 projected_offset
local draw_object_from_road_edge 00EC79,00ECA4 R0 x                # the offset across (x_offset + the half width * side), then x
local draw_object_from_road_edge 00EC1F,00EC50 R1 ring_offset      # position * 20: its segment's record in the ring at screen + 2000 (& FFF)
local draw_object_from_road_edge 00ECB9 R1 y
local draw_object_from_road_edge 00EC2F R11 projected_segment projected_segment
local draw_object_from_road_edge 00EC35,00ECC6 R2 scale
local draw_object_from_road_edge 00EC48 R3 next_scale
local draw_object_from_road_edge 00EC72 R4 near_weight
local draw_object_from_road_edge 00EC22 t3 segment
param draw_object_from_road_edge_unshifted R0 leftover
param draw_object_from_road_edge_unshifted R10 sprite_entry sprite_words
local draw_object_from_road_edge_unshifted 00ECD4,00ECDC,00ECEF R0 projected_offset
local draw_object_from_road_edge_unshifted 00ED2B,00ED56 R0 x
local draw_object_from_road_edge_unshifted 00ECD1,00ED02 R1 ring_offset
local draw_object_from_road_edge_unshifted 00ED6B R1 y
local draw_object_from_road_edge_unshifted 00ECE1 R11 projected_segment projected_segment
local draw_object_from_road_edge_unshifted 00ECE7,00ED78 R2 scale
local draw_object_from_road_edge_unshifted 00ECFA R3 next_scale
local draw_object_from_road_edge_unshifted 00ED24 R4 near_weight
local draw_object_from_road_edge_unshifted 00ECD4 t3 segment
param draw_object_from_road_edge_doubled R0 leftover
param draw_object_from_road_edge_doubled R10 sprite_entry sprite_words
local draw_object_from_road_edge_doubled 00ED89,00ED91,00EDA4 R0 projected_offset
local draw_object_from_road_edge_doubled 00EDE0,00EE0B R0 x
local draw_object_from_road_edge_doubled 00ED86,00EDB7 R1 ring_offset
local draw_object_from_road_edge_doubled 00EE20 R1 y
local draw_object_from_road_edge_doubled 00ED96 R11 projected_segment projected_segment
local draw_object_from_road_edge_doubled 00ED9C,00EE2D R2 scale
local draw_object_from_road_edge_doubled 00EDAF R3 next_scale
local draw_object_from_road_edge_doubled 00EDD9 R4 near_weight
local draw_object_from_road_edge_doubled 00ED89 t3 segment
param draw_object_at_car_window_segment R0 leftover
param draw_object_at_car_window_segment R10 sprite_entry sprite_words
local draw_object_at_car_window_segment 00EE3B,00EE42 R0 projected_offset
local draw_object_at_car_window_segment 00EE63,00EE6B R0 x
local draw_object_at_car_window_segment 00EE6F R1 y
local draw_object_at_car_window_segment 00EE47 R11 projected_segment projected_segment
local draw_object_at_car_window_segment 00EE4D R2 scale
local draw_object_at_car_window_segment 00EE3B t2 segment
param draw_object_at_segment R0 leftover
param draw_object_at_segment R10 sprite_entry sprite_words
local draw_object_at_segment 00EE79,00EE81 R0 projected_offset
local draw_object_at_segment 00EEA2,00EEAA R0 x
local draw_object_at_segment 00EEAE R1 y
local draw_object_at_segment 00EE86 R11 projected_segment projected_segment
local draw_object_at_segment 00EE8C,00EEB9 R2 scale
local draw_object_at_segment 00EE79 t3 segment
param draw_object_at_car_window_segment_on_road R0 leftover
param draw_object_at_car_window_segment_on_road R10 sprite_entry sprite_words
local draw_object_at_car_window_segment_on_road 00EEC3,00EECA R0 projected_offset
local draw_object_at_car_window_segment_on_road 00EEE4,00EEE8 R0 x
local draw_object_at_car_window_segment_on_road 00EEEC R1 y
local draw_object_at_car_window_segment_on_road 00EECF R11 projected_segment projected_segment
local draw_object_at_car_window_segment_on_road 00EED5 R2 scale
local draw_object_at_car_window_segment_on_road 00EEC3 t2 segment
param draw_object_at_segment_scale R0 x
param draw_object_at_segment_scale R1 y
param draw_object_at_segment_scale R10 sprite_entry sprite_words
param draw_object_at_segment_scale R11 projected_segment projected_segment
local draw_object_at_segment_scale 00EEF0 R2 scale
param draw_object_at_shifted_scale R0 x
param draw_object_at_shifted_scale R1 y
param draw_object_at_shifted_scale R2 scale
param draw_object_at_shifted_scale R10 sprite_entry sprite_words
param draw_object_at_shifted_scale R11 projected_segment projected_segment
param draw_object_at_scale R0 x
param draw_object_at_scale R1 y
param draw_object_at_scale R2 scale
param draw_object_at_scale R10 sprite_entry sprite_words
param draw_object_at_scale R11 projected_segment projected_segment
local draw_object_at_scale 00EF27 R3 width_scale      # "mov.w R2, R3": the same scale for the width
param draw_object_on_screen R0 leftover
param draw_object_on_screen R10 sprite_entry sprite_words
local draw_object_on_screen 00EF3A R0 x
local draw_object_on_screen 00EF3E R1 y
param put_object_sprites R0 x                         # the frame's place (from the sprite origin); hands back the last piece's attributes
param put_object_sprites R1 y
param put_object_sprites R2 height_scale
param put_object_sprites R3 width_scale
param put_object_sprites R10 sprite_entry sprite_words
local put_object_sprites 00EF4A R8 frame_x
local put_object_sprites 00EF4D R9 frame_y
local put_object_sprites 00EF50 R16 frame_height_scale
local put_object_sprites 00EF53 R15 frame_width_scale
local put_object_sprites 00EF6F R13 palette_words
local put_object_sprites 00EF7A R19 flip_bits         # flags & C0: bits 6 and 7 flip the pieces (xor-ed into their attributes)
local put_object_sprites 00EF7F,00EF82 R26 flip_index # flip_bits >> 5: by it sprite_flip_x_signs and sprite_flip_y_signs
local put_object_sprites 00EFA9 R26 size_step_offset  # "movea.h [R26](R26), R26": size_step * 3, the piece's sizes for the object's size step
local put_object_sprites 00EF8C R17 signed_width_scale
local put_object_sprites 00EF94 R18 signed_height_scale
local put_object_sprites 00EF9C R11 piece_count
local put_object_sprites 00EFA2 R0 attributes         # sprite word 0
local put_object_sprites 00EFB8 R1 sprite_source_size # word 1
local put_object_sprites 00EFD0 R2 sprite_height      # word 2
local put_object_sprites 00EFE5 R3 sprite_width       # word 3
local put_object_sprites 00EFF3 R4 sprite_y           # word 4
local put_object_sprites 00F000 R5 sprite_x           # word 5
local put_object_sprites 00EFBB R6 sprite_rom_offset  # word 6
local put_object_sprites 00EFBE R7 sprite_palette_word  # word 7
param put_object_sprites R12 last_frame
param put_object_sprites R14 last_size_step
param draw_object_one_piece R0 leftover
param draw_object_one_piece R10 sprite_entry sprite_words
local draw_object_one_piece 00F0A7,00F0AA R2 sprite_height
local draw_object_one_piece 00F0AD,00F0B3 R3 sprite_width
local draw_object_one_piece 00F0BA R4 sprite_y
local draw_object_one_piece 00F0C0 R5 sprite_x
local draw_object_one_piece 00F08F R26 size_step_offset
param draw_object_one_piece R12 last_piece
param draw_object_one_piece R14 last_size_step
param draw_object_smoothed R0 leftover
param draw_object_smoothed R10 sprite_entry sprite_words
local draw_object_smoothed 00F171 R0 x
local draw_object_smoothed 00F178 R1 y
local draw_object_smoothed 00F1A1,00F1B3 R4 halfway_x          # the halfway copy's: this frame's, or halfway from the last frame's (its sprite place, R28)
local draw_object_smoothed 00F18F,00F1A5,00F1B6 R5 halfway_y
local draw_object_smoothed 00F18C,00F1A9,00F1B9 R6 halfway_width_scale
local draw_object_smoothed 00F189,00F1AD,00F1BC R7 halfway_height_scale
local draw_object_smoothed 00F21F R11 copy_entry sprite_words  # sprite_entry + 3000: the entry in the list's halfway copy
local draw_object_smoothed 00F1F5 R13 palette_words
local draw_object_smoothed 00F243 R15 sprite_source_size
local draw_object_smoothed 00F24F R15 piece_height
local draw_object_smoothed 00F27C,00F29D R15 piece_width
local draw_object_smoothed 00F2B6 R15 offset_y
local draw_object_smoothed 00F2D9 R15 offset_x
local draw_object_smoothed 00F295,00F2A0 R16 halfway_width
local draw_object_smoothed 00F214 R18 offset_sign      # smoothed_flip_signs: -1 with flags bit 7
local draw_object_smoothed 00F200 R19 flip_bits
local draw_object_smoothed 00F205 R26 flip_index
local draw_object_smoothed 00F234 R26 size_step_offset
local draw_object_smoothed 00F24C R26 sprite_rom_offset
local draw_object_smoothed 00F26D R9 piece_height_bits
local draw_object_smoothed 00F29A R9 piece_width_bits
param animation_advance R7 leftover                   # what the handler had in R7, handed back as it is unless an order runs (then its routine's address)
local animation_advance 00F344 R7 order_routine       # "mov.w F34C[PC](R7), R7": animation_order_jumps
local animation_advance 00F344 t0 order               # "neg.w 4[R8](R9), R7": 0 - the frame's entry
# finish_sprite_list: the depth lists chained into the screen's sprite list
local finish_sprite_list 00F396 R9 switch_index       # (screen index * 2 + buffer) * 2 + list: by it sprite_list_switches
local finish_sprite_list 00F3B0 R10 chain_tail sprite_words   # the list's start entry, then each layer's oldest group: where the next jump goes
local finish_sprite_list 00F3BA R11 depth_list depth_list
local finish_sprite_list 00F3BF R1 layer_octets       # 34: the 416 layers, eight a pass
local finish_sprite_list 00F3C4 R0 empty_head
local finish_sprite_list 00F3C7,00F3E8,00F404,00F420,00F43C,00F458,00F474,00F490,00F4AC R2 cleared_head
local finish_sprite_list 00F3D6,00F3F2,00F40E,00F42A,00F446,00F462,00F47E,00F49A R2 layer_head
local finish_sprite_list 00F3CA R3 copy_distance      # 300: the halfway copy, 3000 bytes on, in 16-byte entries
local finish_sprite_list 00F3CF R4 depth_list_size
local finish_sprite_list 00F3D6 t2 new_head           # "xch.h R2, [R11]": the head the layer is left with (empty)
local finish_sprite_list 00F3F2 t2 new_head_2
local finish_sprite_list 00F40E t2 new_head_3
local finish_sprite_list 00F42A t2 new_head_4
local finish_sprite_list 00F446 t2 new_head_5
local finish_sprite_list 00F462 t2 new_head_6
local finish_sprite_list 00F47E t2 new_head_7
local finish_sprite_list 00F49A t2 new_head_8
# road_row_draw, road_row_pair_draw: a row of items along the road
param road_row_draw R7 rom_offset_and_palette         # sprite words 6 and 7 of the item's size (set before the first item: size_step FF)
param road_row_draw R15 piece_width
local road_row_draw 00F5C8,00F5FC R0 item_position    # first_position, moved up into the view
local road_row_draw 00F6A7,00F6AA,00F6AF,00F795 R0 attributes_and_size   # sprite words 0 and 1
local road_row_draw 00F5CC,00F606,00F611,00F614,00F617,00F619 R1 item_count   # end_position (at most view_end), then the items to it
local road_row_draw 00F6B2,00F79E R1 sprite_then_height_bits   # the first piece's sprite (its size steps), then the height bits of its size step: one variable (the loop reads it before it loads the size step, as far as the code shows)
local road_row_draw 00F5D0,00F7A7 R2 window_then_width_bits    # race_copy window_segment, then the width bits of the size step (with sprite_screen_bit)
local road_row_draw 00F5E0 R3 view_end
local road_row_draw 00F639 R3 positions_moved         # last frame's first_position - this frame's
local road_row_draw 00F6C9,00F736,00F760,00F7BF,00F7E6 R3 size   # the segment's scale, shifted (scale_shift, the size table's shift), then the sprite's height
local road_row_draw 00F739,00F745,00F74C R4 size_index
local road_row_draw 00F88C R4 depth_list depth_list
local road_row_draw 00F7BB,00F7C4,00F7F5 R4 sprite_width
local road_row_draw 00F6FD R5 y
local road_row_draw 00F6F9,00F706 R6 x
local road_row_draw 00F89E R6 layer_head
local road_row_draw 00F676 R8 ring_step               # spacing * 20: from an item's segment record to the next one's
local road_row_draw 00F673 R9 projected_step          # spacing * 10
local road_row_draw 00F6BD R10 sprite_entry sprite_words
local road_row_draw 00F6A3 R16 palette_word           # in the high half
local road_row_draw 00F679 R17 items_left
local road_row_draw 00F65B,00F8C2,00F8C8 R18 ring_segment road_segment
local road_row_draw 00F667,00F8C5 R19 projected_segment projected_segment
local road_row_draw 00F62A R21 places_mask            # EFFF: the ring of sprite places wraps
local road_row_draw 00F81A,00F835,00F852,00F869 R26 previous_word   # the item's sprite place of the frame before
local road_row_draw 00F8E6 R26 blank_place
local road_row_draw 00F619 t3 items_in_view
local road_row_draw 00F639 t2 previous_first_position
param road_row_pair_draw R7 rom_offset_and_palette
param road_row_pair_draw R15 piece_width
local road_row_pair_draw 00F911 R30 mirror_bits       # 43: the attribute bits toggled for the mirrored sprite
local road_row_pair_draw 00F916,00F94A R0 item_position
local road_row_pair_draw 00F9F5,00F9F8,00F9FD,00FAC4,00FB00,00FB0C R0 attributes_and_size
local road_row_pair_draw 00F91A,00F954,00F95F,00F962,00F965,00F967 R1 item_count
local road_row_pair_draw 00FA00,00FACD R1 sprite_then_height_bits
local road_row_pair_draw 00F91E,00FAD6 R2 window_then_width_bits
local road_row_pair_draw 00F92E R3 view_end
local road_row_pair_draw 00F987 R3 positions_moved
local road_row_pair_draw 00FA17,00FA65,00FA8F,00FAEE,00FB24,00FB95 R3 size
local road_row_pair_draw 00FA68,00FA74,00FA7B R4 size_index
local road_row_pair_draw 00FC3B R4 depth_list depth_list
local road_row_pair_draw 00FAEA,00FAF3,00FB3C,00FBBB R4 sprite_width
local road_row_pair_draw 00FA4B R5 y
local road_row_pair_draw 00FA47,00FA52,00FA5A,00FA5D,00FB72,00FC07 R6 pair_x   # the two items' x: the one being written in the low half
local road_row_pair_draw 00FC4D R6 layer_head
local road_row_pair_draw 00F9C4 R8 ring_step
local road_row_pair_draw 00F9C1 R9 projected_step
local road_row_pair_draw 00FA0B R10 sprite_entry sprite_words
local road_row_pair_draw 00F9F1 R16 palette_word
local road_row_pair_draw 00F9C7 R17 items_left
local road_row_pair_draw 00F9A9,00FC73,00FC79 R18 ring_segment road_segment
local road_row_pair_draw 00F9B5,00FC76 R19 projected_segment projected_segment
local road_row_pair_draw 00F978 R21 places_mask
local road_row_pair_draw 00FA4F R26 offset_x          # from the road's centre
local road_row_pair_draw 00FB85,00FB92,00FBA9,00FBB8,00FBCF,00FBDA,00FBEF,00FC0B R26 halfway_word   # the sprite place of the frame before, then halfway to this frame's
local road_row_pair_draw 00FC97 R26 blank_place
local road_row_pair_draw 00F967 t3 items_in_view
local road_row_pair_draw 00F987 t2 previous_first_position
# The course: built into the ring of segments (screen + 2000, 20 bytes a segment, build_offset & FFF)
param player_car_build_segment R5 ring_mask           # FFF: build_offset wraps in the ring
local player_car_start_course 00FCDF R0 width_code    # byte 8 of the course: its first run's (after the stage command)
local player_car_start_course 00FCFF R5 ring_mask
local player_car_extend_course 00FD22 R5 ring_mask
local player_car_extend_course 00FEE6 R0 run_length   # a course record's first halfword: a run's length, or 0 - its command
local player_car_extend_course 00FFC4 R0 branch
local player_car_extend_course 00FF08,00FF1B R1 run_width   # the run's width code, then * B0
local player_car_extend_course 00FEE1 R11 course_place course_bytes
local player_car_extend_course 00FFEA,00FFF5 R2 forks_taken
local player_car_build_segment 00FEE6 R0 run_length
local player_car_build_segment 00FE03 R1 pitch_sine
local player_car_build_segment 00FF08,00FF1B R1 run_width
local player_car_build_segment 00FDF9,00FE0B R2 pitch_cosine     # the pitch angle's index, then its cosine
local player_car_build_segment 00FE13 R3 heading_sine
local player_car_build_segment 00FDFE,00FE1B R4 heading_cosine
local player_car_build_segment 00FE75 R11 ring_segment road_segment   # the segment it writes, at build_offset in the ring
local player_car_build_segment 00FEE1 R11 course_place course_bytes
# player_car_project_road: the view's rotation (view_matrix_*), then each segment from the window
local player_car_project_road 010070 R1 view_pitch    # "movz.hw C[D0[R25]], R1": the shown view's
local player_car_project_road 010077 R2 view_yaw      # E[D0[R25]]
local player_car_project_road 0100E9 R0 to_view_x     # "neg.w 0[D0[R25]], R0": what takes a segment's place to the view's
local player_car_project_road 0100F0 R1 to_view_y
local player_car_project_road 0100F7 R2 to_view_z
local player_car_project_road 01008A R10 matrix_xx
local player_car_project_road 010095 R11 matrix_xz
local player_car_project_road 010086 R13 matrix_yy
local player_car_project_road 010082,0100B0,0100B6 R15 matrix_zx   # the yaw's sine, then times the pitch's cosine
local player_car_project_road 01007E,0100B9 R16 matrix_zy          # the pitch's sine, then negated
local player_car_project_road 0100BF,0100C5 R17 matrix_zz
local player_car_project_road 01008E R8 fixed_point_shift   # FFFFFFF2: the matrix's shift (sha.w R8), also added to each rotated z and y
local player_car_project_road 010105,010109 R3 near_limit   # eye_distance / 2: segments as near are left out
local player_car_project_road 010111 R5 screen_top_y  # 0 - sprite_origin_y
local player_car_project_road 0101BF,0101E3 R5 scale  # perspective_scales by the depth, then times the width
local player_car_project_road 010158,0101B1,0101CB,0101D5 R26 x
local player_car_project_road 010170 R7 unrotated_z
local player_car_project_road 01026C,010270 R26 previous_projected
local player_car_project_road 010123 R9 segments_left
local player_car_project_road 010115,010147,01014B R18 ring_segment road_segment   # the window's segment, where the projection starts; then the next in the ring (010147 "movea.b 20[R18], R18", 01014B "and.h #AFFF, R18")
local player_car_project_road 01011B R19 projected_segment projected_segment
local player_car_project_road 01012D,010211 R21 previous_y   # the last projected segment's y (7FFF: none yet)
local player_car_project_road 01020E t1 last_y
local player_car_project_road 010270 t4 copied_x_y
local player_car_project_road 010274 t4 copied_road_bytes
param rotate_offset R0 y                              # up
param rotate_offset R1 x                              # across, handed back in the world's axes
param rotate_offset R2 z                              # along, likewise
param rotate_offset R3 road_heading                      # the road segment's heading (both callers: [R11])
param rotate_offset R4 road_pitch                        # its pitch (2[R11])
local rotate_offset 01028A R5 pitch_sine
local rotate_offset 010292 R6 pitch_cosine
local rotate_offset 01029A R4 heading_cosine
local rotate_offset 0102A2 R3 heading_sine
local rotate_offset 0102AA R7 y_copy
local rotate_offset 0102CA R9 minus_x
# The screens' set-up
local init_screen 010637 R1 index
local init_screen 013D5C R10 stage_course             # walks stage_courses
local init_screen 013D63 R11 length_place stage_length_list   # screen + 700: stage_lengths, then branch_road_length
local init_screen 013D68 R9 courses_left
local init_screen 013D75 R8 course_length
local init_screen 013D72 R0 section_length
local init_screen 013D88 R0 command_routine           # course_length_command_jumps
local init_screen 013D88 t0 command                   # ~ the section's first halfword
local clear_screen_ram 010688 R10 block
local clear_screen_ram 01068D R0 blocks_left
local clear_screen_ram 010694 R1 block_halfwords
local clear_video_ram 010741 R10 block
local clear_video_ram 010748 R0 blocks_left
local clear_video_ram 01074F R1 block_halfwords
local clear_text_layer 01076A R10 block
local clear_text_layer 010771 R0 blocks_left
local clear_text_layer 010774 R1 block_halfwords
local reset_tile_layers 010734 t1 first_scroll_target
local reset_tile_layers 01073A t1 second_scroll_target
param clear_tile_pages R9 last_page
local clear_tile_pages 01078F R7 next_page
local clear_tile_pages 010792 R9 page
local clear_tile_pages 010798 t1 cleared_page
param clear_tile_page R9 page
local init_sprite_chip 0107D1 R0 control_flip         # sprite_control_flip, xor 3 when flip_screen
local init_sprite_chip 0107CE R18 control_register    # 500004 on
param unrolled_copy R0 byte_count
param unrolled_copy R10 source
param unrolled_copy R11 destination
# unrolled_copy's 64 moves of 8 bytes (0109B4-010AB0 "mov.d [R10+], [R11+]"): where each goes, and its second word
local unrolled_copy 0109B4 t2 move_destination
local unrolled_copy 0109B4 t4 second_word
local unrolled_copy 0109B8 t2 move_destination_2
local unrolled_copy 0109B8 t4 second_word_2
local unrolled_copy 0109BC t2 move_destination_3
local unrolled_copy 0109BC t4 second_word_3
local unrolled_copy 0109C0 t2 move_destination_4
local unrolled_copy 0109C0 t4 second_word_4
local unrolled_copy 0109C4 t2 move_destination_5
local unrolled_copy 0109C4 t4 second_word_5
local unrolled_copy 0109C8 t2 move_destination_6
local unrolled_copy 0109C8 t4 second_word_6
local unrolled_copy 0109CC t2 move_destination_7
local unrolled_copy 0109CC t4 second_word_7
local unrolled_copy 0109D0 t2 move_destination_8
local unrolled_copy 0109D0 t4 second_word_8
local unrolled_copy 0109D4 t2 move_destination_9
local unrolled_copy 0109D4 t4 second_word_9
local unrolled_copy 0109D8 t2 move_destination_10
local unrolled_copy 0109D8 t4 second_word_10
local unrolled_copy 0109DC t2 move_destination_11
local unrolled_copy 0109DC t4 second_word_11
local unrolled_copy 0109E0 t2 move_destination_12
local unrolled_copy 0109E0 t4 second_word_12
local unrolled_copy 0109E4 t2 move_destination_13
local unrolled_copy 0109E4 t4 second_word_13
local unrolled_copy 0109E8 t2 move_destination_14
local unrolled_copy 0109E8 t4 second_word_14
local unrolled_copy 0109EC t2 move_destination_15
local unrolled_copy 0109EC t4 second_word_15
local unrolled_copy 0109F0 t2 move_destination_16
local unrolled_copy 0109F0 t4 second_word_16
local unrolled_copy 0109F4 t2 move_destination_17
local unrolled_copy 0109F4 t4 second_word_17
local unrolled_copy 0109F8 t2 move_destination_18
local unrolled_copy 0109F8 t4 second_word_18
local unrolled_copy 0109FC t2 move_destination_19
local unrolled_copy 0109FC t4 second_word_19
local unrolled_copy 010A00 t2 move_destination_20
local unrolled_copy 010A00 t4 second_word_20
local unrolled_copy 010A04 t2 move_destination_21
local unrolled_copy 010A04 t4 second_word_21
local unrolled_copy 010A08 t2 move_destination_22
local unrolled_copy 010A08 t4 second_word_22
local unrolled_copy 010A0C t2 move_destination_23
local unrolled_copy 010A0C t4 second_word_23
local unrolled_copy 010A10 t2 move_destination_24
local unrolled_copy 010A10 t4 second_word_24
local unrolled_copy 010A14 t2 move_destination_25
local unrolled_copy 010A14 t4 second_word_25
local unrolled_copy 010A18 t2 move_destination_26
local unrolled_copy 010A18 t4 second_word_26
local unrolled_copy 010A1C t2 move_destination_27
local unrolled_copy 010A1C t4 second_word_27
local unrolled_copy 010A20 t2 move_destination_28
local unrolled_copy 010A20 t4 second_word_28
local unrolled_copy 010A24 t2 move_destination_29
local unrolled_copy 010A24 t4 second_word_29
local unrolled_copy 010A28 t2 move_destination_30
local unrolled_copy 010A28 t4 second_word_30
local unrolled_copy 010A2C t2 move_destination_31
local unrolled_copy 010A2C t4 second_word_31
local unrolled_copy 010A30 t2 move_destination_32
local unrolled_copy 010A30 t4 second_word_32
local unrolled_copy 010A34 t2 move_destination_33
local unrolled_copy 010A34 t4 second_word_33
local unrolled_copy 010A38 t2 move_destination_34
local unrolled_copy 010A38 t4 second_word_34
local unrolled_copy 010A3C t2 move_destination_35
local unrolled_copy 010A3C t4 second_word_35
local unrolled_copy 010A40 t2 move_destination_36
local unrolled_copy 010A40 t4 second_word_36
local unrolled_copy 010A44 t2 move_destination_37
local unrolled_copy 010A44 t4 second_word_37
local unrolled_copy 010A48 t2 move_destination_38
local unrolled_copy 010A48 t4 second_word_38
local unrolled_copy 010A4C t2 move_destination_39
local unrolled_copy 010A4C t4 second_word_39
local unrolled_copy 010A50 t2 move_destination_40
local unrolled_copy 010A50 t4 second_word_40
local unrolled_copy 010A54 t2 move_destination_41
local unrolled_copy 010A54 t4 second_word_41
local unrolled_copy 010A58 t2 move_destination_42
local unrolled_copy 010A58 t4 second_word_42
local unrolled_copy 010A5C t2 move_destination_43
local unrolled_copy 010A5C t4 second_word_43
local unrolled_copy 010A60 t2 move_destination_44
local unrolled_copy 010A60 t4 second_word_44
local unrolled_copy 010A64 t2 move_destination_45
local unrolled_copy 010A64 t4 second_word_45
local unrolled_copy 010A68 t2 move_destination_46
local unrolled_copy 010A68 t4 second_word_46
local unrolled_copy 010A6C t2 move_destination_47
local unrolled_copy 010A6C t4 second_word_47
local unrolled_copy 010A70 t2 move_destination_48
local unrolled_copy 010A70 t4 second_word_48
local unrolled_copy 010A74 t2 move_destination_49
local unrolled_copy 010A74 t4 second_word_49
local unrolled_copy 010A78 t2 move_destination_50
local unrolled_copy 010A78 t4 second_word_50
local unrolled_copy 010A7C t2 move_destination_51
local unrolled_copy 010A7C t4 second_word_51
local unrolled_copy 010A80 t2 move_destination_52
local unrolled_copy 010A80 t4 second_word_52
local unrolled_copy 010A84 t2 move_destination_53
local unrolled_copy 010A84 t4 second_word_53
local unrolled_copy 010A88 t2 move_destination_54
local unrolled_copy 010A88 t4 second_word_54
local unrolled_copy 010A8C t2 move_destination_55
local unrolled_copy 010A8C t4 second_word_55
local unrolled_copy 010A90 t2 move_destination_56
local unrolled_copy 010A90 t4 second_word_56
local unrolled_copy 010A94 t2 move_destination_57
local unrolled_copy 010A94 t4 second_word_57
local unrolled_copy 010A98 t2 move_destination_58
local unrolled_copy 010A98 t4 second_word_58
local unrolled_copy 010A9C t2 move_destination_59
local unrolled_copy 010A9C t4 second_word_59
local unrolled_copy 010AA0 t2 move_destination_60
local unrolled_copy 010AA0 t4 second_word_60
local unrolled_copy 010AA4 t2 move_destination_61
local unrolled_copy 010AA4 t4 second_word_61
local unrolled_copy 010AA8 t2 move_destination_62
local unrolled_copy 010AA8 t4 second_word_62
local unrolled_copy 010AAC t2 move_destination_63
local unrolled_copy 010AAC t4 second_word_63
local unrolled_copy 010AB0 t4 second_word_64
# The data the screens' set-up copies (L3)
010509  data  segment_projection_pattern  # player_car_project_road (01013C "movea.b 10509[PC], AP", 010150 "test.b [AP+]"): a byte a segment out from the window (road_projection_pattern), 1 projected, 0 a copy of the one before
010AB6  data  mixer_register_defaults     # init_mixer (28 halfwords, move_halfwords_backward and move_halfwords from 010AB6): the mixer's registers 00-4E -> mixer, and its copies in the screen's block (screen + 160, + 1B0)
010B0C  data  sprite_control_rest         # init_sprite_chip (0107E0-0107EC "[R19+]", after sprite_control_flip): 01 03 00 00 -> 500006-50000C
010B12  data  video_register_defaults     # init_video (47 halfwords -> 31FF02-31FF8F and video_registers + 2)
010BF4  data  sprite_ram_start_entries    # init_sprite_lists (28 halfwords -> 400000): sprite RAM entries 0-4, 16 bytes each (the clip, the origin A0 DE and a jump, two jumps, an end)
010C44  data  last_colour_tables          # load_sprite_ram_tables (C0 halfwords -> 403400): twelve tables of sixteen halfwords, after the ones from indirect_colour_tables
107020  data  indirect_colour_tables      # load_sprite_ram_tables (1200 halfwords -> 401000): 120 tables of sixteen halfwords; table N maps 1-D to 1000 + N * 10 + them, 0 to 1FFF, E to 1FFE
12297C  data  solid_colour_blocks         # load_sprite_ram_tables (F0 halfwords -> 410000): fifteen blocks of 32 bytes, each all one nibble (1 to F)
# ======== locals (batch L4) ========
# The names of the parameters, locals and worked-out values of unpacking, fades, coins, sound requests, the
# road's objects and scenery (batch L4: unpack to fork_branch_draw), and the ROM places they use as numbers.
# Places in the ROM
011458  data  bookkeeping_defaults          # bookkeeping_reset 0113E5 "movea.b 11458[PC], R2": the 3E halfwords bookkeeping_copy copies over the block (701F02) when it resets: zeros but SHORTEST GAME TIME (FFFF)
0114D4  data  seat1_first_chute_entry       # update_coins 011149 "movea.b 114D4[PC], R19" (insert_coin's R19): switch bit 2, seat1_coin_sounds, then twice (alone, shared: chute_entry_offset 0 or 14) the credits (seat1_credits), the meter's pulses owed (20E082), the bookkeeping counter (701F06), the coin units (20E611) and the byte for C00074 (11)
011504  data  seat1_second_chute_entry      # update_coins 011153: switch bit 3; alone 20E085, 701F08, 20E612, 10; shared as seat1_first_chute_entry's
011534  data  seat2_first_chute_entry       # update_coins 011164: switch bit 4, seat2_coin_sounds; seat2_credits, 20E088, 701F0A, 20E611, 11 (both ways)
011564  data  seat2_second_chute_entry      # update_coins 01116E: switch bit 5; alone 20E08B, 701F0C, 20E612, 10; shared as seat2_first_chute_entry's
01173E  data  screen_fade_from_black        # step_screen_fade 0116B1 (fade_kind 1): screen_fade_starts' second record, 20 01 00 E0
011742  data  screen_fade_to_white          # step_screen_fade 0116BA (fade_kind 2): 00 01 1F E0
011746  data  screen_fade_from_white        # step_screen_fade 0116C3 (fade_kind 3): 1F FF 00 E0
01174A  data  screen_fade_to_red_tint       # step_screen_fade 0116CC (fade_kind 4): 00 01 05 80 (red only)
01174E  data  screen_fade_from_red_tint     # step_screen_fade 0116D5 (fade_kind 5): 05 FF 00 80
0126BC  data  car_hit_box_sizes             # player_car_write_hit_box 0122BC "movea.w 126BC(R2), R19" (R2 the model * 8): by car model, 8 bytes as an item_hit_box (along_start, along_end, across_start, across_end: 00A0 0000 FFD4 002C for model 0); 0126BC-0126FB
03153C  data  boot_palette_9e00             # upload_boot_palettes 011594 "movea.b 3153C, R19" (upload_palette): place 9E00, 200 bytes, 256 colours
153904  data  boot_palette_8000             # upload_boot_palettes 0115A8 "movea.b 153904, R19" (upload_palette): place 8000, 1400 bytes, 2560 colours
103C20  data  one_bit_font                  # load_shadowed_text_font 0117FE "movea.b 103C20, R19": 128 characters of 8 rows, a bit a pixel (103C20-10401F)
104020  data  text_font                     # load_text_font: the text layer's 384 characters (3000 bytes) it copies into 318000
# Unpacking
param unpack R10 source packed_bytes                      # the packed data (unpack_list, unpack_tile_pages)
param unpack R11 destination unpacked_bytes
local unpack 010DC4,010DD4,010DDA,010DE6,010DEC,010DF8,010DFE,010E08,010E0E R0 flags   # the byte of flag bits, shifted out highest first
local unpack 010DC7,010DD0,010DD7,010DE2,010DE9,010DF4,010DFB,010E04,010E0B R1 flags_left
local unpack 010DDF R2 back_offset                        # 010DDF "not.w #0, R2": all ones, the high bits of the offset back a match's halfword or byte goes under
local unpack 010E14,010E1A,010E1D,010E27,010E2D R2 copy_source
local unpack 010DF1,010E01,010E11,010E17,010E21,010E31,010E36,010E3D R3 copy_count
local unpack 010E2A R3 length_byte                        # the match halfword's low byte: its low three bits the length
local unpack 010E31 t2 length_bits
local unpack_tile_pages 010F7D R12 entry_word
local unpack_queued_step 010E49,010E61,010E67,010E8C,010E92,010E9E,010EA4,010EAE,010EB4,010F28 R0 flags
local unpack_queued_step 010E4E,010E5D,010E64,010E88,010E8F,010E9A,010EA1,010EAA,010EB1,010F2B R1 flags_left
local unpack_queued_step 010E53,010E61,010E8C,010E9E,010EAE,010EBA,010EEB,010EFA,010F22,010F28 R10 source packed_bytes
local unpack_queued_step 010E58,010F25 R11 destination unpacked_bytes
local unpack_queued_step 010F11 R11 request unpack_request # the request's place in the ring (screen + C00 + 8 * unpack_read_place)
local unpack_queued_step 010E85 R2 back_offset                # 010E85 "not.w #0, R2": all ones, the high bits of the offset back a match's halfword or byte goes under
local unpack_queued_step 010EBA,010EBF,010EEB,010EF1 R2 copy_source
local unpack_queued_step 010E97,010EA7,010EB7,010EBD,010EF5,010EFA R3 copy_count
local unpack_queued_step 010EEE R3 length_byte
local unpack_queued_step 010EF5 t2 length_bits
param unpack_list R10 block_list packed_block_entry
local unpack_list 010F6C R10 source
local unpack_list 010F69 R11 destination
local unpack_list 010F6C t1 next_entry
param unpack_tile_pages R10 page_list tile_page_entries
local unpack_tile_pages 010F7A,010F80 R0 page_bits       # the entry, then its top byte: the page
local unpack_tile_pages 010F98 R10 source
local unpack_tile_pages 010F90 R11 destination
local unpack_tile_pages 010F98 t1 next_entry
param unpack_tile_pages R12 list_next
param queue_unpack_list R10 block_list packed_block_entry
local queue_unpack_list 010FAF R11 request unpack_request
local queue_unpack_list 010FC0 t4 destination
param queue_tile_pages R10 page_list tile_page_entries
local queue_tile_pages 010FE9,010FEF R0 page_bits
local queue_tile_pages 010FEC R1 page_entry
local queue_tile_pages 010FD8 R11 request unpack_request
# Coins and the bookkeeping
local init_coins 011018 t1 chip_2_port_f                  # 0xC8000A, as read_switches_and_analog reads it
local update_coins 01107B,011096,0110B1,0110CC R0 sound
local update_coins 01118D,01119D,0111B3,0111C3 R1 meter_bit
local update_coins 0110F0,011116 R10 seat_credits
local update_coins 0110F5,01111B R11 service_sounds
local update_coins 011149,011153,011164,01116E R19 chute_entry
local update_coins 0110E3 R6 pressed_switches
local update_coins 011134,011139 R6 released_switches
local update_coins 011104,01112A,011178 R7 counter
local update_coins 011188,011198,0111AE,0111BE R7 coin_meter
local update_coins 0110E8,011101,01110E,011127,01113F,011150,01115A,01116B,011175 R9 credits_given
local update_coins 011139 t2 released_chutes
param pulse_coin_meter R1 meter_bit
param pulse_coin_meter R7 coin_meter coin_meter            # its record in coin_meters: frames on, frames off, pulses owed
local pulse_coin_meter 0111CB,011209 R0 meter_frames      # the record's frames on and off (bookkeeping_update_checksum then leaves its checksum under the high half)
local pulse_coin_meter 0111D6 t2 frames_on
param add_service_credit R9 credits_given
param add_service_credit R10 seat_credits seat_credits
param add_service_credit R11 service_sounds seat_sound_counts
local add_service_credit 01122F t1 credits
param insert_coin R6 released_switches
param insert_coin R9 credits_given
param insert_coin R19 chute_entry coin_chute
local insert_coin 011284 R1 chute_units
local insert_coin 011263 R10 seat_credits seat_credits
local insert_coin 01125D R11 coin_sounds seat_sound_counts
local insert_coin 011288 R2 units_per_bonus               # bonus_adder
local insert_coin 0112A9 R2 units_per_credit              # coins_per_credit
local insert_coin 011295,0112A0 R3 bonus_units
local insert_coin 0112B2,0112C2,0112CC R3 credit_units
local insert_coin 011273 R7 counter
local insert_coin 011252 t2 switch_bit
local insert_coin 011270 t1 owed_pulses
param bookkeeping_increment16 R7 counter bookkeeping_count16                  # (insert_coin and game_mode_play pass it)
param bookkeeping_add16 R7 counter bookkeeping_count16
param bookkeeping_add16 R9 amount
local bookkeeping_add16 011324 t3 count
param bookkeeping_add32 R7 counter bookkeeping_count32
param bookkeeping_add32 R9 amount
local bookkeeping_add32 011341 t3 count
param bookkeeping_add8 R7 counter bookkeeping_count8
param bookkeeping_add8 R9 amount
local bookkeeping_add8 011362 t3 count
param bookkeeping_set16 R7 counter bookkeeping_count16
param bookkeeping_set16 R9 amount
param bookkeeping_set32 R7 counter bookkeeping_count32
param bookkeeping_set32 R9 amount
param bookkeeping_set8 R7 counter bookkeeping_count8
param bookkeeping_set8 R9 amount
local bookkeeping_check 0113CE,0113DD,0113E3,011401,01140A R0 checksum
local bookkeeping_check 0113C7,0113D6 R2 block
local bookkeeping_check 0113F6,01140A R2 source
local bookkeeping_check 0113C0 R3 stored_checksum
local bookkeeping_check 0113FD,011403 R3 destination
param bookkeeping_reset R0 checksum                        # (L1 names what load_settings passes on as it too)
local bookkeeping_reset 0113E5,0113F6 R2 source
local bookkeeping_reset 0113EC,0113FD R3 destination
param bookkeeping_copy R0 checksum
param bookkeeping_copy R2 source
param bookkeeping_copy R3 destination
param bookkeeping_update_checksum R0 checksum
local bookkeeping_update_checksum 011418 R2 block
local bookkeeping_check_block 011431,01143B R0 checksum
local bookkeeping_check_block 01142A R2 block
param bookkeeping_checksum R0 checksum                     # only its high half goes on, under the sum
param bookkeeping_checksum R2 block bookkeeping_halfwords
local bookkeeping_checksum 01143E,011445,011448,01144E R0 sum
local bookkeeping_checksum 011441,011453 R1 halfwords_left
# Palettes and the screen's fade
local upload_boot_palettes 011594,01159E,0115A8 R19 colour_block
local queue_stage_load 0115B6 R19 colour_block
param queue_palette R19 colour_block
local queue_palette 0115C0 R8 list_flag
param queue_palette_list R19 colour_list
local queue_palette_list 0115C5 R8 list_flag
param queue_palette_upload R8 list_flag
param queue_palette_upload R19 colour_record               # a colour block (queue_palette) or a list of them (queue_palette_list)
local queue_palette_upload 0115CC R18 upload_queue
local queue_palette_upload 0115DE R9 upload_count
local upload_queued_palettes 0115EB R10 upload_queue                            # screen + 900: palette_upload_count ("mov.w [R10+], R0" 0115F0); then (its own line) the uploads after it
local upload_queued_palettes 0115F0,011602,01160B R0 uploads_left
local upload_queued_palettes 0115F6 R19 colour_record
local upload_queued_palettes 0115F6 t1 queued_upload
param upload_palette R19 colour_block palette_block
local upload_palette 011615,011624,01162E,011632,011636,01163A R18 palette_address
local upload_palette 011627,01162A,01163E R9 blocks_left   # of 32 bytes
local upload_palette 01162E t2 colours_0_place            # each 32-byte block: colours 0-3, 4-7, 8-11 and 12-15, two moves of 32 bits each
local upload_palette 01162E t4 colours_2_3
local upload_palette 011632 t2 colours_4_place
local upload_palette 011632 t4 colours_6_7
local upload_palette 011636 t2 colours_8_place
local upload_palette 011636 t4 colours_10_11
local upload_palette 01163A t2 colours_12_place
local upload_palette 01163A t4 colours_14_15
param upload_palette_list R19 colour_list palette_block_list
local upload_palette_list 011643,01164B,01165C,011662,011666,01166B,011670 R18 palette_address io
local upload_palette_list 011655,011679 R9 entries_left
local upload_palette_list 011659 R17 colour_source
local upload_palette_list 01165F,011675 R8 blocks_left
local upload_palette_list 011662 t4 colours_2_3
local upload_palette_list 011666 t4 colours_6_7
local upload_palette_list 01166B t4 colours_10_11
local upload_palette_list 011670 t4 colours_14_15
local step_screen_fade 011704 R9 level
local step_screen_fade 011718,011720 R0 channels
local step_screen_fade 01171D,011728 R1 channels_left
local step_screen_fade 011713,011725 R19 mixer_register mixer_colour_offsets
# The text layer and the text sprites
local load_shadowed_text_font 011822,01182B,011831 R0 row_bits
local load_shadowed_text_font 011845 R0 pixel_mask
local load_shadowed_text_font 011819,011863 R1 characters_left
local load_shadowed_text_font 011805,011854 R18 destination text_layer_font_words
local load_shadowed_text_font 011825,011837 R2 pixel_pairs_left
local load_shadowed_text_font 01181C,01185F R3 rows_left
local load_shadowed_text_font 011828,01182E,011834,01183B,011848 R4 row_pixels   # a nibble a pixel
local load_shadowed_text_font 011816 R5 pen
local load_shadowed_text_font 01181F,01185B R6 shadow     # the row's pixels in pen 2 one pixel right, for the row below
local load_shadowed_text_font 011842 R7 shadow_pixels
param print_text_layer R19 text_record text_layer_record
local print_text_layer 01187B,01188B R18 cell_place text_layer_cells
local print_text_layer 011881,011884,01188E R9 cell
param erase_text_layer_to_blank_character R19 text_record text_layer_record
local erase_text_layer_to_blank_character 0118C4,0118CA R18 cell_place text_layer_cells
local erase_text_layer_to_blank_character 0118C7 R9 blank_cell
param print_text_layer_halfwords R19 text_record text_layer_record
local print_text_layer_halfwords 0118D9,0118EC R18 cell_place text_layer_cells
local print_text_layer_halfwords 0118DF R9 attribute
local print_text_layer_halfwords 0118E2,0118EF R8 character
param erase_text_layer_to_blank_cell R19 text_record text_layer_record
local erase_text_layer_to_blank_cell 0118FE,011904 R18 cell_place text_layer_cells
local erase_text_layer_to_blank_cell 011901 R9 blank_cell
param print_hex_byte R0 number
param print_hex_byte R1 cell                               # the attribute in its high byte
param print_hex_byte R11 cell_place
local print_hex_byte 01190F R2 digit_count
param print_hex_halfword R0 number
param print_hex_halfword R1 cell
param print_hex_halfword R11 cell_place
local print_hex_halfword 011917 R2 digit_count
param print_hex_24_bits R0 number
param print_hex_24_bits R1 cell
param print_hex_24_bits R11 cell_place
local print_hex_24_bits 011923 R2 digit_count
param print_hex_word R0 number
param print_hex_word R1 cell
param print_hex_word R11 cell_place
local print_hex_word 011928 R2 digit_count
param print_hex_digits R0 number
param print_hex_digits R1 cell
param print_hex_digits R2 digit_count
param print_hex_digits R11 cell_place text_layer_cells
local print_hex_digits 011944 t4 higher_digits
local bcd_to_binary 011971 R0 number
local bcd_to_binary 011958,01196D R2 digits_left
local bcd_to_binary 01195B,01196A R3 total
param binary_to_bcd R0 number
local binary_to_bcd 0119AD R0 bcd
local binary_to_bcd 01197B,01197E R1 digit
local binary_to_bcd 011978,011981,011984,011994 R2 digits
local binary_to_bcd 011975,01198A,011998 R3 digits_left
param draw_text_at R3 place                                # x in its low half, y in its high half
param draw_text_at R5 attribute
param draw_text_at R18 text
local draw_text_at 011A15 R1 sprite_words_0_1
local draw_text_at 011A27 R2 sprite_size
local draw_text_at 011A2A R4 font
local draw_text_at 0119FA R10 sprite
local draw_text_at 011A09 R11 sprite_copy
param draw_text R19 text_record sprite_text_record
local draw_text 011A51 R1 sprite_words_0_1
local draw_text 011A5F R2 sprite_size
local draw_text 011A62,011A65 R3 place
local draw_text 011A69 R4 font
local draw_text 011A6F R5 attribute
local draw_text 011A36 R10 sprite
local draw_text 011A45 R11 sprite_copy
local draw_text 011A32,011A6F R18 text
param draw_text_sprites R1 sprite_words_0_1
param draw_text_sprites R2 sprite_size
param draw_text_sprites R3 place
param draw_text_sprites R4 font
param draw_text_sprites R5 attribute
param draw_text_sprites R10 sprite sprite_words
param draw_text_sprites R11 sprite_copy sprite_words   # the sprite list's halfway copy (+ 3000)
param draw_text_sprites R18 text
local draw_text_sprites 011A72,011A7F,011AA3 R0 character
local draw_text_sprites 011A75 R6 x_step
local draw_text_sprites 011C27 R1 depth_layer
local draw_text_sprites 011C37 R2 first_sprite
local draw_text_sprites 011AA3 t1 next_character
# Objects, random numbers, sounds
local clear_objects 011C93,011C98,011CA6,011CAB R0 halfword_count
local run_objects 011CC3,011CE4 R22 list_entry object_links
local run_objects 011CFE R1 list_block object_list_block   # this frame's list (object_area list) once walked, cleared eight bytes at a time
local run_objects 011D03,011D06,011D09,011D16 R0 blocks_left
local run_objects 011D0D R2 zero_low
local run_objects 011D10 R3 zero_high
local start_object 011D58 R9 slot
local start_object 011D5E,011DE5 R21 object object
local start_object 011D6A,011D6D,011D70,011D73,011D76,011D79,011D7C,011D7F,011D82,011D85,011D88,011D8B,011D8E,011D91,011D94,011D97,011D9A,011D9D,011DA0,011DA3,011DA6,011DA9,011DAC,011DAF,011DB2,011DB5,011DB8,011DBB,011DBE,011DC1,011DC4,011DC7 R26 object_bytes object_words
local reserve_object_slot 011E05,011E17 R21 object
param start_object_list R10 handler_list object_start_list
local start_object_list 011E2C R10 handler_list object_handlers   # past the count (011E2C "mov.w [R10+], R8"): the handlers
local start_object_list 011E2F,011E3E R7 list_index
local start_object_list 011E2C,011E40 R8 objects_left
local random_number 011E47,011E50,011E6C,011E72,011E79 R1 state   # then turned round, its low half the number's (011E79)
local random_number 011E57,011E6F,011E76 R0 number               # the state, its low half then worked out from both halves of the next one
param request_sound R0 sound
local request_sound 011EC6 R2 sound_number
param queue_sound R0 sound
local queue_sound 011EDE,011EE3 R2 request_ring
param request_second_sound R0 sound
local request_second_sound 011F02 R2 sound_number
local request_second_sound 011F1A,011F1F R2 request_ring
local player_car_start_engine_sound 011F56,011F5F R0 loudness
local player_car_start_engine_sound 011F42,011FAE R10 sound_page screen_sound_page@700700   # the screen's index * 100: its page of the sound RAM's engine bytes
local player_car_engine_sound 011F8E,011FAE R10 sound_page screen_sound_page@700700
param set_tyre_noise R0 tyre_noise
local set_tyre_noise 011FAE R10 sound_page screen_sound_page@700700
local fade_out_music 011FE6 R0 fade_delay
param fade_out_music_at R0 fade_delay                      # (fade_out_music and car_radio_update pass it)
local reset_screen_sound 012008 R10 sound_page screen_sound_page@700700
# Angles
param vector_angle R0 x
param vector_angle R1 y
param vector_angle R2 from_x
param vector_angle R3 from_y
local vector_angle 0120AF,0120B4,0120C9 R0 distance       # |dx|, then the longer of |dx| and |dy|
local vector_angle 0120E6,0120EE,0120F6,0120FE R0 angle
local vector_angle 0120B9,0120BE,0120C9 R1 short_side
local vector_angle 0120AC,0120B7,0120C1,0120CC R4 octant
local vector_angle 0120AF t3 dx
local vector_angle 0120B9 t3 dy
local vector_angle 0120C9 t1 long_side
param vector_angles R0 x                                   # what it hands back there: the pitch
param vector_angles R1 y                                   # what it hands back there: the yaw
param vector_angles R2 z
param vector_angles R3 from_x
param vector_angles R4 from_y
param vector_angles R5 from_z
local vector_angles 01210C,012111,012126,012181,01218B R0 distance   # |dx|, the longer of |dx| and |dz|, then the distance along the ground
local vector_angles 0121AB,0121B3,0121BB,0121C3,0121CE R0 pitch
local vector_angles 01218E,012193,0121C8,0121D1 R1 height   # |dy|, then (0121C8, 0121D1) the yaw or 0 it hands back in R1: one variable, as the C keeps it (with the yaw's own name the result would go through its pointer)
local vector_angles 012116,01211B,012126 R2 short_side
local vector_angles 012140,012148,012150,012158 R2 yaw
local vector_angles 012162,01216C R3 yaw_factor          # the yaw's sine or cosine, by the octant
local vector_angles 012109,012114,01211E,012129,012184,012196 R6 octant
local vector_angles 01210C t3 dx
local vector_angles 012116 t3 dz
local vector_angles 012126 t1 long_side
local vector_angles 01218E t3 dy
# Hit boxes and hits
local player_car_build_hit_boxes 01223F,012252,012294 R0 racers_left
local player_car_build_hit_boxes 01225D,01226D R1 racer_player
local player_car_build_hit_boxes 012255,01225A,012275,012291,012298,0122A9 R11 hit_box
local player_car_build_hit_boxes 012281 R15 segment_fraction
local player_car_build_hit_boxes 012285 R17 road_x
local player_car_build_hit_boxes 012289 R1 segment
local player_car_build_hit_boxes 01228D R2 model
param player_car_write_hit_box R1 segment
param player_car_write_hit_box R2 model
param player_car_write_hit_box R11 hit_box car_hit_box+2
param player_car_write_hit_box R15 segment_fraction
param player_car_write_hit_box R17 road_x
local player_car_write_hit_box 0122BC,0122CA,0122D0 R19 box_size
local player_car_write_hit_box 0122CA t1 along_start
local player_car_write_hit_box 0122D0 t1 along_end
local player_car_write_hit_box 0122D6 t1 across_start
param fork_sign_hit_check R7 along_distance               # road_row_hit_check's
param fork_sign_hit_check R15 next_hit_box
param road_row_crash_check R7 along_distance
param road_row_crash_check R15 next_hit_box
param road_row_hit_check R7 along_distance                 # from the car's box to the item's (half of it into car hit_along on a hit); road_row_draw, which gets it next, does not read it
# road_row_hit_check's and road_row_pair_crash_check's R15 (the place after the car's hit box, own_hit_box + 12) keep
# their register name: with every value of the function named, decompile.py's fewer_write_backs takes the joined
# exits instead (its guard counts the rN names), and the C's structure changes
local road_row_hit_check 0122F3,01232F,012345 R0 item_position
local road_row_hit_check 012305 R13 car_last_segment
local road_row_hit_check 0122FB,012302,012305,012308,01230B,01230E,012311 R15 car_hit_box
local road_row_hit_check 012308 R16 car_along_start
local road_row_hit_check 01230B R17 car_along_end
local road_row_hit_check 01230E R18 car_across_start
local road_row_hit_check 012311 R19 car_across_end
local road_row_hit_check 012326 R4 spacing
local road_row_hit_check 012342,012365,01236F R6 item_along
local road_row_hit_check 01233F,01234F,012352 R7 segment_offset   # the item's segment record in the screen's ring at 2000, / 2
local road_row_hit_check 012361 R8 item_across
local road_row_hit_check 012381 R9 across_distance
param road_row_pair_crash_check R7 along_distance
local road_row_pair_crash_check 0123BA,0123F6,01240D R0 item_position
local road_row_pair_crash_check 0123CC R13 car_last_segment
local road_row_pair_crash_check 0123C2,0123C9,0123CC,0123CF,0123D2,0123D5,0123D8 R15 car_hit_box
local road_row_pair_crash_check 0123CF R16 car_along_start
local road_row_pair_crash_check 0123D2 R17 car_along_end
local road_row_pair_crash_check 0123D5 R18 car_across_start
local road_row_pair_crash_check 0123D8 R19 car_across_end
local road_row_pair_crash_check 0123ED R4 spacing
local road_row_pair_crash_check 01240A,01242D,012437,012455 R6 item_along
local road_row_pair_crash_check 012407,012417,01241A R7 segment_offset
local road_row_pair_crash_check 012429,01243D R8 item_across
local road_row_pair_crash_check 012434,012440,01244F R9 across_distance
local road_row_pair_crash_check 01246A t3 overlap_signs   # negative when the boxes overlap
local road_row_pair_crash_check_unflipped 012497,0124D3,0124EA R0 item_position
local road_row_pair_crash_check_unflipped 0124A9 R13 car_last_segment
local road_row_pair_crash_check_unflipped 01249F,0124A6,0124A9,0124AC,0124AF R15 car_hit_box
local road_row_pair_crash_check_unflipped 0124AC R16 car_along_start
local road_row_pair_crash_check_unflipped 0124AF R17 car_along_end
local road_row_pair_crash_check_unflipped 0124B2 R18 car_across_start
local road_row_pair_crash_check_unflipped 0124B5 R19 car_across_end
local road_row_pair_crash_check_unflipped 0124CA R4 spacing
local road_row_pair_crash_check_unflipped 0124E7,01250A,01251A,012538 R6 item_along
local road_row_pair_crash_check_unflipped 0124E4,0124F4 R7 segment_offset
local road_row_pair_crash_check_unflipped 01250E,01251D,01252C R7 along_distance
local road_row_pair_crash_check_unflipped 012506,012520 R8 item_across
local road_row_pair_crash_check_unflipped 012511,012532 R9 across_distance
local road_row_pair_crash_check_unflipped 012514,012523 R26 mirrored_across
local road_row_pair_crash_check_unflipped 01254D t3 overlap_signs
local player_car_check_car_hits 01257C,012584,012588,01258B,01258E,012593 R15 car_hit_box
local player_car_check_car_hits 012581 R4 own_player
local player_car_check_car_hits 01258B R13 car_last_segment
local player_car_check_car_hits 012591 R16 car_along_start   # + 1
local player_car_check_car_hits 012593 R17 car_along_end
local player_car_check_car_hits 012596 R18 car_across_start
local player_car_check_car_hits 012599 R19 car_across_end
local player_car_check_car_hits 01259C,012609,012615,01261D,012625 R5 boxes_left
local player_car_check_car_hits 0125A4 R26 other_player
local player_car_check_car_hits 0125AC R6 other_record race
local player_car_check_car_hits 0125B6,0125D0,0125D6 R6 other_along_start
local player_car_check_car_hits 0125D3,0125D9 R7 other_along_end
local player_car_check_car_hits 0125C2 R8 segment_gap
local player_car_check_car_hits 0125DC,0125F1 R8 other_across
local traffic_hit_check 012632,012672 R6 object_along
local traffic_hit_check 012636,012640 R15 car_hit_box
local traffic_hit_check 01265C R7 segment_offset
local traffic_hit_check 01266E R8 object_across
local traffic_hit_check 01269A t3 overlap_signs
# The road's objects and scenery
local road_object_stream_read 012736 R1 command_routine
param road_object_stream_start_object R0 position
local crest_clip_update 012845 R0 depth_layer
local crest_clip_update 01285F,012866 R0 clip_bottom
local scenery_update 0128FA,entry R7 along_distance
local scenery_update 0128FA,entry R15 next_hit_box
local road_row_start 0128EC R1 row_length
local flashing_scenery_update 012978 R1 row_length
local flashing_scenery_update 012986,entry R7 along_distance
local flashing_scenery_update 012986,entry R15 next_hit_box
local scenery_pair_update 0129C4,entry R7 along_distance
local scenery_pair_update 0129C4,entry R15 next_hit_box
local overhead_scenery_update 012A14,entry R7 animation_order   # what animation_advance hands back in R7: what it was given (0), or its order's routine at the animation's end; road_row_draw does not read it
local aurora_update 012A24 R0 routine                     # the state's routine (aurora_state_jumps)
local aurora_update 012A8F R0 countdown
local aurora_update 012A93,012A9E R0 odd_countdown
local aurora_update 012A93 t2 odd
local aurora_next_animation 012ABC R9 animation
local fork_sign_update 012AE8,entry R7 along_distance
local fork_sign_update 012AE8,entry R15 next_hit_box
local animated_scenery_update 012B72,012B78,entry R7 along_distance
local animated_scenery_update 012B72,entry R15 next_hit_box
local road_row_start_copy 012B64 R1 row_length
local animated_scenery_pair_update 012B9C,012BA2,entry R7 along_distance
local animated_scenery_pair_update 012B9C,entry R15 next_hit_box
local road_crosser_update 012BB2,012C52,012C8C R0 routine   # the state's routine, then what draw_object hands back (its drawing routine)
local road_crosser_update 012C2D R1 draw_distance
local kangaroo_update 012CAE,012D40 R0 routine
local kangaroo_update 012D6F,012D79,012D99 R0 position_fraction
local kangaroo_update 012D1B R1 draw_distance
local moving_scenery_update 012DBB,012E84 R0 routine
local moving_scenery_update 012E36 R1 draw_distance
local swooping_helicopter_update 012EA6,012F56,012F9E R0 routine
local swooping_helicopter_update 012F32 R1 draw_distance
local start_gate_update 012FC0,013044,01304A,01304F,013054,013067 R0 seconds_left   # the state's routine at first
local start_gate_update 013030 R1 row_length
local start_flagman_update 013082,0130CD,0130D6,0130F8 R0 frames_to_start   # the state's routine at first
local flagman_update 013108,01319A R0 routine
local flagman_update 013164 R1 draw_distance
local start_balloon_update 01320F,013215,013222 R0 rise_speed
local ambient_sound_update 013255 R0 random_bits
local ambient_sound_update 013279 R0 sound
local one_shot_sound_update 01328C R0 sound
local west_east_panel_update 013306,01330A,013317,013320 R0 palette   # colour_count, then the palette it picks
local west_east_panel_update 0132D1 R9 animation
local santa_sleigh_update 013340,0133ED,01341F,013449 R0 sound   # the state's routine at first
local santa_sleigh_update 0133C6 R1 draw_distance
local goal_parade_rightward_update 013453,013518 R0 routine
local goal_parade_rightward_update 0134C1 R1 draw_distance
local sounding_scenery_update 01359A R1 row_length
local sounding_scenery_update 0135C0,entry R7 animation_order
local goal_parade_leftward_update 0135D0,013694 R0 routine
local goal_parade_leftward_update 01363D R1 draw_distance
local goal_parade_dragon_update 01374A R0 random_bits
local goal_parade_dragon_update 013750,013755,013765 R0 sound
local goal_parade_dragon_update 0136FF R1 draw_distance
local goal_parade_dragon_update 013750 t2 chance          # one in four: 0
# Traffic
local traffic_spawner_update 013824 R0 spawn_position
local traffic_spawner_update 013824 t3 road_position
local traffic_spawner_update 01382A R1 object_position
local traffic_spawner_update 013870,01387A R0 view_bottom   # a player's view (race_copy_window_segments) less the draw distance
local traffic_spawner_update 013876,01387D R1 view_top      # plus the draw distance, + 1
local traffic_spawner_update 013857,013886,013889 R11 stretches stretch_ends
local traffic_spawner_update 013861,01388C R7 stretch_count
local traffic_spawner_update 013864,01388E R8 stretch_top
local traffic_spawner_update 013867,013891 R9 racers_left
local traffic_car_start_convoy 0138B0,0138B4,entry R1 follower_position
param traffic_car_update R1 follower_position             # what traffic_car_start_convoy leaves in R1 (from the object loop, what the handler before left): only its high half goes on, under whole_segment
local traffic_car_update 0138EF,013953,013957 R0 trailing_position   # the state's routine, then position - 8 (the high half the routine's)
local traffic_car_update 013962,013966,013976 R0 position_fraction
local traffic_car_update 01396A R1 whole_segment          # 80: a segment in 128ths
local traffic_car_start 013907 R9 start_animation
param traffic_car_draw R0 position_fraction
param traffic_car_draw R1 whole_segment
local traffic_car_draw 013982,0139C7 R0 position
local traffic_car_draw 0139E3,013A10,013A1C,013A1F,013A28,013A33,013A67,013A7D,013AA8 R0 frame   # from the road's direction at the car, then the frame's column and row
local traffic_car_draw 013990,013993,0139C5 R1 seen_from    # position less the draw distance: the view sees it from there
local traffic_car_draw 013A18 R1 screen_x_quarter
local traffic_car_draw 0139DD R10 car_segment_record road_segment
local traffic_car_draw 0139F9 R10 segment_record road_segment
local traffic_car_draw 0139E7,013A4B R2 height_difference   # the road's height at the car first
local traffic_car_draw 013A52,013A57,013A61 R2 row
local traffic_car_draw 013A03 R3 object_height
local traffic_car_draw 013A52 t3 raw_row
local traffic_stopping_car_update 013AFD,013B12,013B16 R0 trailing_position
local traffic_stopping_car_update 013976,013B20,013B24 R0 position_fraction
local traffic_stopping_car_update 013B28 R1 whole_segment
local traffic_figure_update 013C76,013CA4 R0 position_fraction
local traffic_figure_update 013CB0,013CE1 R0 position
local traffic_figure_update 013C7A R1 whole_segment
local traffic_figure_update 013CC0 R1 seen_from
param traffic_out_of_view R0 position
local traffic_out_of_view 013D29 R10 stretch
local traffic_out_of_view 013D2E,013D31,013D36 R10 stretch stretch_ends   # past the count (013D2E "movz.hw [R10+], R9"): each stretch's top and bottom
local traffic_out_of_view 013D2E,013D3B R9 stretches_left
local traffic_out_of_view 013D31 t2 stretch_top
local traffic_out_of_view 013D36 t2 stretch_bottom
local fork_branch_draw 013E22,013E27,013E33,013E4D,013E51,013ED5 R19 view_record projected_segment   # the road's records of the segments in view (screen + 3000, 16 bytes each)
local fork_branch_draw 013E5D,013E64,013E68 R26 segment
local fork_branch_draw 013E6B,013EA1 R26 branch_distance   # from start_position, then * 8 (the curve's angle)
local fork_branch_draw 013F06,013F0D,013F11,013F1A,013F1D R26 segment
local fork_branch_draw 014030 R26 first_sprite
local fork_branch_draw 013E6B t3 distance_from_start
local fork_branch_draw 013E77,014019 R0 last_y
local fork_branch_draw 013E89,013ECF,01401C R2 last_x
local fork_branch_draw 013E8D,013E9A,01401F R4 last_scale
local fork_branch_draw 013EDE R1 piece_y
local fork_branch_draw 013EE7,013F4B R3 piece_x
local fork_branch_draw 013EEF,013EFC R5 piece_scale
local fork_branch_draw 013EEB R21 depth_layer
local fork_branch_draw 013ED2 R13 height_word              # fork_branch_sprite's (L5's names)
local fork_branch_draw 013ED2 R15 offset_palette
local fork_branch_draw 013E7B,013E86,013F6F,013FE0,013FEE R18 rows_to_fill
local fork_branch_draw 013F62,013F96,013F99,013FBC,013FBF,013FD6,013FD9,013FF6,013FF9,01400D,014010,014013,014016 R10 sprite sprite_words
local fork_branch_draw 013F7A R6 row_span
local fork_branch_draw 013F7D,013FDC R7 rows_done
local fork_branch_draw 013F6C,013FDE R8 rows_left
local fork_branch_draw 013F80,013FC2 R0 row_y
# ======== locals (batch L5) ========
014A64  table  unfinished_ending_actors  u32   # race_car_start_ending 0146DB-0146E2 "movea.w 14A60[PC], R10; mov.w [R10+], R0": past unfinished_ending_actor_count's count, its (handler, script) pairs, read with [R10+] at 0146FA, 0146FF
014A7C  table  ending_actors  u32   # the 16 lists ending_actor_lists points at, one after another: a 32-bit count, then its (handler, script) pairs (race_car_start_ending 0146E9-0146FF); 014A7C-01500B
01500C  table  goal_actor_scripts  u16   # the actors' scripts, which the lists' pairs point at (goal_actor script): goal_actor_run reads them a halfword at a time (goal_actor_script_words; "movz.hw [R10+], R5", 01484B); 156 scripts, 01500C-016AFF
param fork_branch_sprite R13 height_word      # sprite word 2 of fork_branch_draw's pieces: a height of 1 or-ed with the size step's height_bits (014092-014095)
param fork_branch_sprite R15 offset_palette   # sprite words 6 and 7: the size step's rom_offset and the stage's palette word (0140A2-0140BE)
local fork_branch_sprite 014095 R13 height_word
local race_car_occupant_update 01412C R9 animation              # race_car_occupant_animations by occupant, for animation_start
local race_car_occupant_update 01418D,014198,0141D1 R0 scale     # the car's width_scale, at most 100 (draw_object passes R0 on)
local rider_gesture_update 01421D R9 animation                  # rider_gesture_animations by rider (0: no gesture)
local rider_gesture_update 014240 R9 visible_mask               # FF: rider_gesture_check_place notes the place whatever the view
local rider_gesture_update 014276,014281,014291 R0 scale        # the car's width_scale, at most 100
param rider_gesture_check_place R9 visible_mask                 # FF where the gesture may show (rider_gesture_check_view: the screen's car's state and the car's view): masks gesture_shown
local rider_gesture_check_view 0142B9,0142C6 R9 visible_mask
local rider_gesture_check_view 0142F1 t4 gesture_shown
local rider_gesture_check_place 0142D6 R0 place                 # 0142D6 "mov.b 320[R25](R0), R0": the racer's place in the race (screen + 320 by player)
local rider_gesture_check_place 0142F1 t4 gesture_shown
param rider_gesture_place R0 scale                              # the car's width_scale, at most 100 (rider_gesture_update)
local rider_gesture_place 014307,014332 R3 rider                # the rider (model, model + 8), less the model at 014332: 0 the driver, 8 the passenger
local rider_gesture_place 01430B R6 x_offset
local rider_gesture_place 014313 R7 y_offset
local rider_gesture_place 014339 R11 seat_place car_part_place                 # the seat's x and y offsets for the car's view (race_car_rider_places by model)
local rider_gesture_place 014353 R9 y
local stage_end_sounds_update 014573,01457F R0 end_sound        # 24 when this screen's player leads, else 28
local fork_camera_update 01460A,014619,014645 R0 next_pitch_lift   # the view's pitch lift for this frame (car view_pitch_lift)
local race_car_start_ending 0146B3,0146B7,0146E7 R0 ending      # model * 2, + 1 when the car is not first: the list of ending_actor_lists
local race_car_start_ending 0146E2,0146F1,014709 R0 actor_count
local race_car_start_ending 0146E2,0146F1 R10 actor_list object_list_pair   # past the list's count (0146E2, 0146F1 "mov.w [R10+], R0"): its first (handler, script) pair
local race_car_start_ending 0146E9,0146FA,0146FF R10 actor_list   # the list's next (handler, script) pair
local race_car_start_ending 014711 R0 sound
local goal_actor_rider_place 0147B0 R11 piece sprite_piece     # the first piece of the car's frame (after its count): attributes, sprite, y_offset, x_offset
local goal_actor_rider_place 0147B3,0147B6 R11 piece
local goal_actor_rider_place 0147E2 R11 view_offsets car_part_place            # the rider record's x and y offsets for the view (its table at +0, 16 bytes a view)
local goal_actor_rider_place 0147B3,0147C1,0147C6,0147CA,0147CF R3 view   # the car's view: the piece's attributes bit 6 (mirrored, + 34) and its sprite's place among the body's pieces
local goal_actor_rider_place 0147DB,0147E5,014814,01481E R5 x_offset
local goal_actor_rider_place 0147D8,0147E8,014817,01482C R6 y
local goal_actor_rider_place 0147EF R9 animation
local goal_actor_run 01484B,01484E,014853,014858,01485E,014864,01486A,014870,014876,01487C,014882,014888,01488E,014894,01489A,0148A0 R5 step_flags   # the step's halfword of flags, shifted out from bit 15
local goal_actor_run 014846,01484B,0148BF,0148D6,0148EA,014900,014908,014910,014918,014920,01492D,01493A,014942,01494A,014952,014974,01497C,014988,0149F0,014A09 R10 script_word   # the next word of the script
local goal_actor_run 0148B6,01497C,01498B,0149F3,entry R0 step_value   # what the step last read in R0 (a sound, the command's routine, a repeat's count), passed on to draw_object
local goal_actor_run 0148AC t2 next_step                        # the script's place after this step (the next step's start)
local goal_actor_run 0149BA t2 step_end
local road_surface_update 016B72,016B76 R0 near_scroll          # near_scroll + 4FF: its page (>> 9) in the page set
local road_surface_update 016B38,016B53,entry R4 previous_line
local road_surface_update 016B38,016B53,entry R5 previous_x
local road_surface_update 016B38,016B53,entry R6 previous_depth
local road_surface_update 016B38,016B53 R13 stripe_count
local road_surface_update 016B38,016B53 R15 fraction_shift
local road_surface_update 016B38,016B53 R16 rounding
local road_surface_update 016B38,016B53 R18 max_depth
local road_surface_update 016BF9 t2 first_flag
local road_surface_update 016C07 t2 first_tiles_flag
local road_surface_update 016C15 t2 second_tiles_flag
local road_surface_start 016C35 R0 video_bits                   # video_registers[2] less the layer's bits (video_mask)
local road_surface_start 016C64,016C67 R0 mixer_bits
local road_surface_start 016CEC,016CF4 R19 palettes road_palette_lists             # stage_road_palettes by first_stage: the fades' list, then the palette list queued
param road_surface_lines R4 previous_line     # the line of the last point it filled to (a point: its line, x and depth)
param road_surface_lines R5 previous_x
param road_surface_lines R6 previous_depth
param road_surface_lines R13 stripe_count     # the segments left before the stripe bit (R14, 100) flips: two segments a stripe
param road_surface_lines R15 fraction_shift   # -C: the line tables' values in 20.12 back to whole ones
param road_surface_lines R16 rounding         # 800: a half in 20.12
param road_surface_lines R18 max_depth        # FF: the line select's largest depth (and, as a byte, the shift of one to the right that halves the sums of road_surface_halfway_lines)
local road_surface_lines 016D00 R10 view_segment projected_segment   # the segments in view (screen + 3000, 16 bytes each): typed where it starts only, the walk (a halfword at a time, then 8 to the next) goes on from there
local road_surface_lines 016D4D,016D81,016D8B,016D9D,016E39,016E59,016E63,016E70,016E73 R10 view_segment
local road_surface_lines 016D05,016D0A,016D10 R0 table_offset   # the line tables this frame writes (video_registers[2] bits 10-11 + 8)
local road_surface_lines 016D47,016E1D,016E3E,016E49,016E53 R0 line   # the line filled up to (E0: the bottom), then the pairs of lines left to clear
local road_surface_lines 016E0C,016E14 R0 line_select           # the point's depth, at most max_depth
local road_surface_lines 016D97,016E6A,entry R1 point_line      # the point's line on screen (its y plus sprite_origin_y)
local road_surface_lines 016D8E R2 point_x
local road_surface_lines 016D84 R3 point_depth
local road_surface_lines 016D13,016DBF,016DE6,016E04,016E09 R11 scroll_place line_scroll_values   # the place in the line scroll table, written downwards
local road_surface_lines 016D1F,016D51,016D6D,016D70,016D76,016E2D,016E31 R13 segment   # the first segment in view, then the segments left before the stripe bit flips (2 - segment & 3...): handed back as stripe_count
local road_surface_lines 016D33 R18 max_depth
local road_surface_lines 016D37,016DAC,016DD5,016DF1 R19 skip_state   # 1 before the first point, -1 while the stretch below it waits to be filled (skipped_line), 0 then
local road_surface_lines 016D41,016D67,016D88,016D91,016D9A,016E60,016E63,016E6D R26 point_entry road_points   # the points buffer (screen + 3800 by points_buffer)
local road_surface_lines 016DE6 R7 x_step
local road_surface_lines 016DE6 R8 depth_step
local road_surface_lines 016DA7,016DBC,016DFB R9 line_count     # the lines between the line filled up to and the point
local road_surface_lines 016D18 s4 scroll_bottom                # the line scroll table's end (its bottom line, near_scroll from it)
local road_surface_lines 016E39 t1 segment_scale                # the segment's first halfword (0: past the last segment in view)
local road_surface_lines 016E73 t1 remaining_scale
local road_surface_lines 016DFB t2 line_reached
local road_surface_lines 016DA7 t2 line_reached_first
local road_surface_lines 016E3E t5 pairs_left
param road_surface_halfway_lines R4 previous_line
param road_surface_halfway_lines R5 previous_x
param road_surface_halfway_lines R6 previous_depth
param road_surface_halfway_lines R13 stripe_count   # road_surface_lines' count; its low half then the first segment of the last frame's points (matched to this frame's, 016ED2-016EFE), then the segments left before the stripe bit flips, from its two low bits and the high half it came with
param road_surface_halfway_lines R15 fraction_shift
param road_surface_halfway_lines R16 rounding
param road_surface_halfway_lines R18 max_depth
local road_surface_halfway_lines 016E8C,016E91,016E97 R0 table_offset   # the line tables of the frame in between (video_registers[2] bits 10-11 + 4)
local road_surface_halfway_lines 016EAA,016FAA,016FCF,016FDA,016FE4 R0 line
local road_surface_halfway_lines 016F99,016FA1 R0 line_select
local road_surface_halfway_lines 016F2A R1 point_line          # the average of the two frames' lines (sha.w R18: halved)
local road_surface_halfway_lines 016F1E R2 point_x
local road_surface_halfway_lines 016F12 R3 point_depth
local road_surface_halfway_lines 016E9A,016F4C,016F73,016F91,016F96 R11 scroll_place line_scroll_values
local road_surface_halfway_lines 016EA7,016F39,016F62,016F7E R19 skip_state
local road_surface_halfway_lines 016ECF,016EDF R26 segment      # the first segment of this frame's points
local road_surface_halfway_lines 016F73 R7 x_step
local road_surface_halfway_lines 016F73 R8 depth_step
local road_surface_halfway_lines 016F34,016F49,016F88 R9 line_count
local road_surface_halfway_lines 016ED2 t1 last_frame_segment
local road_surface_halfway_lines 016F0C t1 last_depth          # the last frame's point: its depth, x and line
local road_surface_halfway_lines 016F18 t1 last_x
local road_surface_halfway_lines 016F24 t1 last_line
local road_surface_halfway_lines 016F88 t2 line_reached
local road_surface_halfway_lines 016F34 t2 line_reached_first
local road_surface_halfway_lines 016FCF t5 pairs_left
param road_surface_fill_lines R0 line            # the line filled up to: the lines go from it up to the point
param road_surface_fill_lines R1 point_line
param road_surface_fill_lines R2 point_x
param road_surface_fill_lines R3 point_depth
param road_surface_fill_lines R4 previous_line   # the last point's (below): hands back how far below the line it is
param road_surface_fill_lines R5 previous_x      # hands back the x it reached, in 20.12
param road_surface_fill_lines R6 previous_depth  # hands back the depth it reached, in 20.12
param road_surface_fill_lines R7 x_step
param road_surface_fill_lines R8 depth_step
param road_surface_fill_lines R15 fraction_shift
param road_surface_fill_lines R16 rounding
param road_surface_fill_lines R18 max_depth
local road_surface_fill_lines 017047,01704F,01708E,017096 R0 line_select
local road_surface_fill_lines 01701B,017062 R4 lines_done        # how far the last point is below the line filled up to
local road_surface_fill_lines 016FEE,017019,017020,017058,01705F,017067,01709F R9 line_count
local road_surface_fill_lines 017062 t2 lower_line
local road_surface_fill_lines 01701B t2 lower_line_clipped
param road_surface_fill_skipped_lines R5 previous_x
param road_surface_fill_skipped_lines R6 previous_depth
param road_surface_fill_skipped_lines R15 fraction_shift
param road_surface_fill_skipped_lines R16 rounding
param road_surface_fill_skipped_lines R18 max_depth
local road_surface_fill_skipped_lines 0170F1,0170F9 R0 line_select
local road_surface_fill_skipped_lines 0170CA,0170EB R11 scroll_place line_scroll_values
local road_surface_fill_skipped_lines 0170C2,0170FC R7 x_step    # skipped_x_step, 0 once the depth reaches max_depth
local road_surface_fill_skipped_lines 0170DA,017105 R9 line_count
local road_tiles_change_update 0172C9,0173F0 R0 halfword_count   # 16 halfwords of each page a frame
local road_tiles_change_update 0171F8,017220,01729C,0172B2,0172CD,0172E4,01731F,017347,0173C3,0173D9,0173F4,01740B R10 source_slot tile_page_places   # the object's list of source pages (field 18)
local road_tiles_change_update 017273,0172F4,01730C,01739A,01741A,017432 R10 table_source   # the data list's bytes for the road's page table
local road_tiles_change_update 0171FC,01722F,0172D1,0172E7,017323,017356,0173F8,01740E R11 target_slot tile_page_places   # the object's list of target pages (field 28)
local road_tiles_change_update 017280,017292,017300,017310,0173A7,0173B9,017426,017436 R11 table_place road_page_table_bytes   # the road's page table (its field 18), every other byte from table_half
local road_tiles_change_update 0172A4,0172AC,0173CB,0173D3 R11 page_numbers   # the data list's pages by the road's page set
local road_tiles_change_update 017212,017229,017339,017350 R13 target_page_numbers   # the data list's target pages by screen (+ 18)
local road_tiles_change_update 01728B,017294,0173B2,0173BB R8 row_bytes
local road_tiles_change_update 017217,017238,0172A9,0172BB,0172D5,0172EA,01733E,01735F,0173D0,0173E2,0173FC,017411 R9 page_count
local road_tiles_change_update 017285,017298,0173AC,0173BF R9 row_count
local road_tiles_change_update 017305,017312,01742B,017438 R9 byte_count
local race_background_update 017528 R0 state_routine
local race_background_update 017575,017578 R0 mixer_bits
local race_background_update 017589,017592 R0 background_inverted   # first_stage, then the stage's background inverted (FF: none)
local race_background_update 0175C9,0175D7,0176C9,0176D7 R0 page_number   # the tile pages' numbers in the list for queue_tile_pages (page_half * 10 + 1 on)
local race_background_update 01765C,017665,017815,017823,01782C R0 animation   # the upper animation (race_background_start_upper_animation)
local race_background_update 01768B,017696,01769C,01769F R0 new_background   # 2 * built_stage + the car's branch, or 2A + stage_background_branch
local race_background_update 0176B7,0176BB R0 page_half
local race_background_update 0176EB R0 page_word_set           # page_half * 2 + the branch: the page words of background_page_words
local race_background_update 01771A,01771E,017721,017727,0177CF R0 view_turn   # the car's view_yaw as 12 bits, made positive: how far the view has turned
local race_background_update 01784B,017855 R0 scroll_x
local race_background_update 017877,01787B,01788F R0 scroll_y
local race_background_update 017885 R1 scroll_y_limit          # 180 less screen road_top_line
local race_background_update 0176EE,0176F9 R1 branch
local race_background_update 01759C,0176A8 R10 tile_page_list  # the list for unpack_tile_pages and queue_tile_pages, in the object (+2C)
local race_background_update 0175A0,0175B4,0175D1,0176AC,0176D1 R11 tile_pages tile_page_entries   # the background's tile pages (background_tile_page_lists)
local race_background_update 01761D,01763E,01775D R19 palettes
local race_background_update 01762C,017788,01779A,0177A7,0177DF R19 fades
local race_background_update 0175CB,0175D9,0176CB,0176D9 R9 page_count
local race_background_update 0177B6 s4 view_turn_kept
local race_background_update 017598 t2 first_background
local race_background_update 017721 t4 signed_turn
local race_background_update 017727 t2 turn_back
local race_background_update 017877 t2 slope_scroll_y
local race_background_start_lower_animation 0178A0 R10 tile_pages
local race_background_lower_animation_cycle 0178E5,0178E9,0178EC R0 step
param race_background_start_upper_animation R0 animation        # 0 for stage 8 (backgrounds 7 and 8), 1 for stage 1C (background 26), 2 for background 25
local race_background_start_upper_animation 017923 R10 tile_pages
local race_background_upper_animation_cycle 017968,01796C,017974 R0 step
122B74  table  sprite_size_steps  sprite_size_step   # the sprites' size steps, 12 bytes each, by a piece's sprite (a multiple of 3: "movea.w 122B74(R26), R26" with R26 = sprite * 4, put_object_sprites 00EFB0, fork_branch_sprite 01407A, the road rows, race_car_put_sprite 009CC4)
1CF000  table  kanji_font  u8   # the kanji font of the unused text viewer, 32 bytes a character (kanji_character_rows): kanji_text_viewer_character_address 01B200-01B203 "add.w R13, R13; movea.w 1CF000(R13), R13": character * 8 on
01C5A2  data  test_mode_write_count_text   # E2PROM WRITE COUNT at cell FD10 (test_mode_menu_show_write_count 01C43E "movea.b 1C5A2[PC], R10", for test_mode_draw_texts)
constant test_mode_memory_test 3FFF8 LOW_ROM_TESTED_BYTES    # 01C60C "mov.w #3FFF8, R0": the bytes test_mode_memory_test_checksum sums from 000000 (IC37 and IC40), up to the checksums at 03FFF8
constant test_mode_memory_test FF000 HIGH_ROM_TESTED_BYTES   # 01C64A "mov.w #FF000, R0": the bytes it sums from 100000 (IC36 and IC39), 100000-1FEFFF
local set_up_background 017A1A,017A1D,017A28,017A2B R0 mixer_bits
local set_up_background 017A17,017A25 R11 mixer_address
param race_background_start_objects R0 stage   # the stage whose background objects start (first_stage, route_stage); + 1F during a change within the stage
local race_background_start_objects 017BDB,017BF6 R0 objects_left
local race_background_start_objects 017BD8 R10 object_list object_list_pair   # past the count (017BD8 "mov.w [R10+], R0"): the first (handler, data) pair
local race_background_start_objects 017BD2,017BE7,017BEC R10 object_list   # stage_background_object_lists's list: a count (bytes), then (handler, data) pairs
local race_background_start_objects 017BDB t4 entry_count
local palette_cycle_update 017C8A,017C8E,017C95,017C98 R10 palette_list palette_cycle_steps
local palette_cycle_update 017C8E,017C98 R19 palettes
local sunset_fade_start 017CFB,017D11 R17 fade_slot fade_objects   # the object's fades (+18), one a slot
local sunset_fade_start 017CF2,017D14 R18 fades_left
local sunset_fade_start 017D0B R21 fade_object
local sunset_fade_start 017CF2 t2 fade_count
local sunset_fade_wait 017D1F,017D34 R0 all_flags   # the fades' flags or-ed: bit 0 while one runs
local sunset_fade_wait 017D2A,017D5C R1 fade object
local sunset_fade_wait 017D31 R1 fade_flags
local sunset_fade_wait 017D22,017D2A,017D54,017D5C R10 fade_slot fade_objects
local sunset_fade_wait 017D26,017D41,017D58,017D67 R9 fades_left
local backdrop_far_update 017DB7,017DC1 R0 scroll_x   # the view's yaw, a quarter of it unless the background is changing
local backdrop_far_update 017E03,017E0B R0 minus_y   # background_scroll_y less FF less its height: its y negated
local backdrop_near_update 017E62,017E6C R0 scroll_x
local backdrop_near_update 017E74 R0 panorama_place   # where it is in the panorama: the scroll less panorama_x, 0-3FF
local backdrop_near_update 017EBB,017EC8,017EE2 R0 minus_y
local backdrop_near_update 017EB7,017EBE R1 height   # its height, less the road's top line at 017EBE
local backdrop_near_update 017ECE R1 y_change
local backdrop_landmark_update 017F44,017F4E R0 scroll_x
local backdrop_landmark_update 017F56 R0 panorama_place
local backdrop_landmark_update 017FA4,017FAF R0 scale
local backdrop_landmark_update 017F90,017F94 R0 approach   # the segments since approach_start
local backdrop_landmark_update 017FD2,017FDF,017FF9 R0 minus_y
local backdrop_landmark_update 017FCE,017FD5 R1 height
local backdrop_landmark_update 017FE5 R1 y_change
local backdrop_flashing_update 018057,018061 R0 scroll_x
local backdrop_flashing_update 0180B3,0180BB R0 minus_y
local backdrop_translucent_update 018117,018121 R0 scroll_x
local backdrop_translucent_update 018172,01817A R0 minus_y
local backdrop_off_screen 01818A R0 half_screen   # A0: half the screen's width
local backdrop_off_screen 018193 R1 centre_x   # x less A0: from the screen's middle
local backdrop_off_screen 0181A0 R2 minus_right_edge
param start_palette_fades R19 fade_list palette_fade_list # a palette_fade_list: its length, then the entries
local start_palette_fades 0184DE R0 blocks
local start_palette_fades 0184E1 R1 period
local start_palette_fades 0184D8 R10 from
local start_palette_fades 0184D8 R11 to
local start_palette_fades 0184D3,0184E7 R18 fades_left
local start_palette_fades 0184D3 t2 fade_count
param road_surface_fade_back R19 fade_list palette_fade_list
local road_surface_fade_back 0184FD R0 blocks
local road_surface_fade_back 018500 R1 period
local road_surface_fade_back 0184F7 R10 from   # the entry's to: the fade goes back
local road_surface_fade_back 0184F4 R11 to   # the entry's from
local road_surface_fade_back 0184EF,018506 R18 fades_left
local road_surface_fade_back 0184EF t2 fade_count
param race_background_fade_palettes R19 fade_list palette_fade_list
local race_background_fade_palettes 018532 R0 blocks
local race_background_fade_palettes 018535 R1 period
local race_background_fade_palettes 01852C R10 from
local race_background_fade_palettes 01852C R11 to
local race_background_fade_palettes 018527,01853B R17 fade_slot background_fades   # the watcher's fades (+80), one a slot
local race_background_fade_palettes 01850E,01853E R18 fades_left
local race_background_fade_palettes 018538 R21 fade_object
local race_background_fade_palettes 01850E t2 fade_count
local race_background_fade_watch_update 01854A,018560 R0 all_flags
local race_background_fade_watch_update 018556 R1 fade object
local race_background_fade_watch_update 01855D R1 fade_flags
local race_background_fade_watch_update 01854D,018556 R10 fade_slot background_fades
local race_background_fade_watch_update 018552,01856D R9 fades_left
param start_palette_fade R0 blocks
param start_palette_fade R1 period
param start_palette_fade R10 from
param start_palette_fade R11 to
local start_palette_fade 0185A6 R0 phase   # palette_fades_started modulo period: when in its period the fade first steps
param start_palette_fade R12 palette_offset
local palette_fade_prepare 0185E9,018604,01861C,018622,018628 R0 from_colour   # the from colour, its components shifted down in turn; at the end the last difference
local palette_fade_prepare 0185EC,018607 R1 to_colour
local palette_fade_prepare 0185D2,0185E9 R10 from
local palette_fade_prepare 0185D6,0185EC R11 to
local palette_fade_prepare 0185DE,018601,018619,01862B R13 difference_place palette_fade_differences
param palette_fade_step R0 from_colour   # what palette_fade_prepare leaves in R0 (only its upper bytes reach fade_kind's test)
local palette_fade_step 018652 R0 fade_kind
local palette_fade_step 0186CD,0186D3,0186D9,0186E2,0186EB,0186F4,018674,01869F R0 colour_step   # what the colour changes by: 1, 20, 400 for each component, up or down
local palette_fade_step 0186A8,0186B0,0186B8,0186CB,0186D1,0186D7,0186E0,0186E9,0186F2,01866C,018681,018689,018691 R10 difference_place palette_fade_differences
local palette_fade_step 0186BA,018670,018693 R11 colour_place palette_fade_colours
local palette_fade_step 0186C1 R19 upload   # the fade's upload record (+28) for queue_palette_list
local palette_fade_step 0186BD,018677,018696 R9 colours_left
local lcd_start 018720,018732,018744,01874B,018752,018758 R0 nibble   # the commands' high nibbles: 3, 3, 3, 2 (4 bits), 0, C
local lcd_start 018784,01878B,018798,01879B R0 to_send   # 40 and 0 (the custom characters' memory from 0), then each row of a custom character (negative ends them)
local lcd_start 018791,01879B R10 character_row
local lcd_start 018727,01872E,018739,018740 R9 wait_count
param lcd_write_character R0 character   # a character code, or a row of a custom character
local lcd_write_character 0187BE R0 low_nibble
local lcd_write_character 0187A3,0187A7,0187B4,0187B8 R9 wait_count
local lcd_write_character 0187AB s4 character_kept
param lcd_write_data_nibble R0 nibble   # in bits 4-7
local lcd_write_data_nibble 0187D2,0187D9 R9 wait_count
param lcd_command_nibble_after_pause R0 nibble
local lcd_command_nibble_after_pause 0187F0,0187F4 R9 wait_count
param lcd_write_command_nibble R0 nibble
local lcd_write_command_nibble 018809,018810 R9 wait_count
local lcd_refresh 01886F,018874 R0 send_step   # lcd_send_step halved: odd, a command is due
local lcd_refresh 01887A,01887E R0 nibble   # the command's nibble: 0 (home), or 4
local lcd_refresh 018863 t2 restart_frames
local lcd_refresh 01887A t1 half_step
local lcd_send_next_nibble 0188C5,0188DA R0 send_step
local lcd_send_next_nibble 0188DF R0 character_index   # (send step - 2) / 2: the character the nibble is of (odd steps the low nibble)
local lcd_send_next_nibble 01894B,018955,01895B R0 command_port   # the address command's nibble as the port byte of screen 1
local lcd_send_next_nibble 0188E9,0188F1,0188FB,01890D,0189A4 R0 screen_1_port   # the byte for the first screen's LCD port (C0000C)
local lcd_send_next_nibble 0188E3,0188F5,0188FE,018912,018958,018960,0189B2 R1 screen_2_port   # the byte for the second screen's LCD port (C8000C)
local lcd_send_next_nibble 018925,01892C,018973,01897A R9 wait_count
local lcd_send_next_nibble 0189C5 t2 init_step
local lcd_send_next_nibble 0188DA t1 current_step
local lcd_update 018A0C,018A23,018A2B,018A30 R0 scroll_width   # the characters the scroll moves: F, D when the DJ's face takes the first two
local lcd_update 018A80,018A8E R1 character
local lcd_update 0189D9,0189FA,018A17,018A28 R10 text_place   # the LCD text (screen + F10), + 2 past the DJ's face
local lcd_update 0189E4,0189F3 R11 mouth_shapes
local clear_lcd 018AF7,018AFC,018AFF R10 text_place
local lcd_race_info_update 018BE0,018BEC R0 countdown   # the player car's timer, then its seconds
local lcd_race_info_update 018D22 R0 racer
local lcd_race_info_update 018C3E,018C45 R0 page
local lcd_race_info_update 018D32,018D3D R0 character
local lcd_race_info_update 018BE9,018BEC R1 countdown_frames
local lcd_race_info_update 018D15,018D41 R10 text_place lcd_characters   # the order page's car numbers (screen + F18 on)
local lcd_race_info_update 018D71,018D9D R10 text_place   # screen + F1C for lcd_race_info_write_number (typed there as the screen's lcd_text fields)
local lcd_race_info_update 018D1A,018D22 R11 order_list race_order_players
local lcd_race_info_update 018D1E,018D44 R9 racers_left
local lcd_race_info_time 018CA6,018CAC,018CB8,018CC6,018CD2 R0 race_time   # the car's race_time / 10, divided down a digit at a time
local lcd_race_info_time 018CA9,018CAC,018CB5,018CB8,018CC3,018CC6,018CCF,018CD2 R1 digit
local lcd_race_info_time 018CB2,018CBE,018CCC,018CD8 R10 text_place lcd_characters
local lcd_race_info_average 018DCE R0 speed_sum
local lcd_race_info_average 018DDC R0 average_speed
local lcd_race_info_average 018DC9 R10 text_place
param lcd_race_info_write_number R0 speed   # shown_speed, maximum_speed or the average; divided down a digit at a time
param lcd_race_info_write_number R10 text_place   # where the number ends in the LCD text (written backwards)
local lcd_race_info_write_number 018DE3,018DE6,018DF1,018DF4 R1 digit
local lcd_race_info_write_number 018DDF R2 digit_zero   # 30, '0'
local car_radio_start 018F90 R0 player
local car_radio_start 018F88,018FA5 R9 racers_left
local car_radio_update 019068,01906C,0190B3,0190B7,0190C7,0190CB,0190D3,0190DA,0190E3,0190E7 R0 song_number   # the car's song (0-9, 10 Jingle Bell), then the sound car_radio_song hands back for it
local car_radio_update 019205,01920C,01921A R0 car_number
local car_radio_update 01926E,019274 R0 remark_choice   # random_number: a list of dj_remark_lists below E
local car_radio_update 019286 R0 remark_routine
local car_radio_update 019096,0190A5,0190BD,019109,019137,01915A,019197,0191C2 R0 sound
local car_radio_update 01911F,01916D R0 fade_level   # 3F, 7F for fade_out_music_at
local car_radio_update 0191F8,019232,019249 R0 message
local car_radio_update 0190F0 R10 title
local car_radio_update 019266,019280,019286,01928D R10 remark_list remark_routines
local car_radio_update 0190B3 t2 previous_song
local car_radio_dj_leader 0192AA R0 message
local car_radio_dj_own_car 0192B5 R0 message
local car_radio_dj_remark_2a 0192BC R0 message
local car_radio_dj_remark_2b 0192C3 R0 message
local car_radio_dj_remark_2d 0192CA R0 message
local car_radio_dj_remark_2f 0192D1 R0 message
local car_radio_dj_remark_2c 0192D8 R0 message
param car_radio_song R0 song_number
local car_radio_song 0192EB R0 song_sound   # the entry's top byte
local car_radio_song 0192E5,0192EE R10 song_entry   # radio_songs's entry: the sound in its top byte, the title's address below
param car_radio_show_title R10 title
local car_radio_show_title 019302 R21 title_object
local song_title_show 01939C R0 next_speed
local song_title_show 01936E,019376,019394,01939E,0193BA,0193BE,0193D3,0193D7 R3 position   # slide in the low half, y in the high, then plus x: where draw_text_at writes
local song_title_show 0193DB,0193DF,0193E5 R5 colour_step
local song_title_show 0193EC R5 colour
local song_title_show 01938A t3 new_time_left
param start_dj_message R0 message
local start_dj_message 01940B R0 sound
local start_dj_message 019405 R10 message_entry   # dj_messages's entry: the sound in its top byte, the mouth shapes below
local title_screen_update 019D86,019D9A,019DDF,019DF3,019DFC,019E10,019E4A,019E5E R0 object_index
local title_screen_update 019D83,019D9C,019DDC,019DF5,019DF9,019E12,019E47,019E60 R1 objects_left
local title_screen_update 019DBC t2 frames
local title_car_drive 019E6F,019E92,019F3F R0 model   # the car's model (title_car_records); one web with the state's routine the switch jumps through, which draw_object is handed and does not read
local title_car_drive 019F32 R2 bounce   # frames & 1: up a line every other frame
local title_car_drive 019E95 R9 animation
local title_car_driver_update 019F90 R9 animation
local title_car_passenger_update 019FB4 R9 animation
local title_rider_draw 01A005,01A00C R0 y
local title_palm_tree_update 01A0E6,01A174,01A181 R0 state_routine
local title_palm_tree_update 01A0FD R9 animation
local title_logo_update 01A190,01A1E8,01A1FE,01A212,01A21B,01A22F,01A245,01A25F,01A275,01A296 R0 object_index   # the seagulls' and pictures' index in the low byte; one web with the state's routine and what draw_object hands back (the upper bytes kept)
local title_logo_update 01A1FB,01A214,01A218,01A231 R1 objects_left
local title_logo_update 01A1AD R9 animation
local title_logo_copy_update 01A2A0,01A2F2,01A308,01A323 R0 state_routine
local title_logo_copy_update 01A2B9 R9 animation
local title_logo_car_update 01A32D,01A3C6,01A3DA R0 state_routine
local title_logo_car_update 01A35F,01A365 R0 model
local title_logo_car_update 01A380,01A3B0 R0 place_offset
local title_logo_car_update 01A368 R9 animation
local title_logo_stripe_update 01A3ED,01A435,01A464,01A472,01A493 R0 place_offset   # index * 4 into title_logo_stripe_places; one web with the state's routine, handed to draw_object
local title_logo_stripe_update 01A41F R9 animation
local title_board_palms_update 01A49D,01A501,01A50F,01A530 R0 state_routine
local title_board_palms_update 01A4B5 R9 animation
local title_seagull_fly 01A53A,01A579,01A5BA R0 place_offset   # index * 4 into title_seagull_places; one web with the state's routine, handed to draw_object
local title_seagull_fly 01A5C9,01A5ED R0 angle
local title_seagull_fly 01A63F,01A66C R0 x_angle
local title_seagull_fly 01A65A R3 y_wave
local title_seagull_fly 01A555 R9 animation
local title_picture_draw 01A676,01A67B R0 state_routine
local title_picture_draw 01A691,01A6C4 R0 picture_offset
local coin_prompt_update 01A76A,01A76F,01A774 R0 message
local coin_prompt_update 01A777 R1 piece_count
local coin_prompt_update 01A74C,01A758 R10 credits
local coin_prompt_update 01A751,01A75D R11 coin_units
local coin_prompt_update 01A77A R2 first_piece
local coin_prompt_car_drive 01A7C9,01A7F2 R0 palette   # the car's palette + 4; one web with the state's routine, handed to draw_object (01A97B, its draw, shared with coin_prompt_message_update, left to the web)
local coin_prompt_car_drive 01A7DC R9 animation
local coin_prompt_car_drive 01A829 t3 x
local coin_prompt_message_update 01A842,01A87F R0 car_colour   # one web with the state's routine, handed to draw_object
local coin_prompt_message_update 01A873 R9 animation
param coin_prompt_start_key_prompt R1 piece_count
param coin_prompt_start_key_prompt R2 first_piece
local ignition_key_prompt_update 01A8E6,01A950 R0 state_routine
local ignition_key_prompt_update 01A901,01A93F R0 piece_offset
local credit_display_update 01AA54,01AA60 R10 credits
local credit_display_update 01AA91,01AAAF R10 units   # the credits' units digit (the tens counted in R12)
local credit_display_update 01AA59,01AA65 R11 coin_units
local credit_display_update 01AA8F R11 coin_units_shown
local credit_display_update 01AA34,01AA6F,01AA78 R19 text
local credit_display_update 01AA85 s10 credits_kept
local credit_display_update 01AA87 s14 coin_units_kept
local credit_display_digit 01AB25,01AB51 R0 digit_kind
local credit_display_digit 01AB29 R9 animation
local demo_captions_run 01AE19 t3 frames_to_cue
local demo_captions_head_to_head 01AE30 R0 first_record
local demo_captions_head_to_head 01AE36,01AE46,01AE4B R0 record   # 3 + the machines linked (4 stand-alone): the head-to-head caption
local demo_captions_head_to_head 01AE2D R1 record_count
local demo_captions_checkpoint 01AE64 R0 first_record
local demo_captions_checkpoint 01AE61 R1 record_count
local demo_captions_music_select 01AE6E R0 first_record
local demo_captions_music_select 01AE6B R1 record_count
param demo_captions_start R0 first_record
param demo_captions_start R1 record_count
local demo_caption_update 01AE91,01AEF9 R0 state_routine
local demo_caption_update 01AEA9,01AEE7 R0 record_offset
local kanji_text_viewer_update 01B149 R4 text_number
local kanji_text_viewer_update 01B151 R3 cell
local kanji_text_viewer_update 01B172 R10 cursor_cell text_layer_cells   # the cursor: row 10's cell at the object's x (the digit being chosen), 2A on palette 60 every fourth frame
local kanji_text_viewer_update 01B185,01B1A7 R4 text_ended   # -1 from kanji_text_viewer_draw_line at the text's end
local kanji_text_viewer_update 01B188,01B1AA R5 line
local kanji_text_viewer_update 01B18B,01B1A7 R10 text
local kanji_text_viewer_update 01B1A4 R11 line_place   # the line's place on the bitmap layer, 16 rows a line
param kanji_text_viewer_draw_line R11 place
param kanji_text_viewer_draw_line R4 text_ended
param kanji_text_viewer_draw_line R10 text
local kanji_text_viewer_draw_line 01B1B1,01B1BA R13 character
param kanji_text_viewer_draw_character R11 place
param kanji_text_viewer_draw_character R13 rows
local kanji_text_viewer_draw_character 01B1CD,01B1D0,01B1D3,01B1D7,01B1DA,01B1DF,01B1E2 R12 bitmap_place
local kanji_text_viewer_draw_quarter 01B1E7,01B1FB R1 rows_left
param kanji_text_viewer_character_address R13 character   # hands back the address of its rows
param kanji_text_viewer_draw_number R3 cell text_layer_cells
param kanji_text_viewer_draw_number R4 number
local kanji_text_viewer_draw_number 01B20C,01B22A R5 tens
local kanji_text_viewer_draw_number 01B20F,01B21E R6 hundreds
local test_mode_start 01C2E7 R0 sound
local test_mode_start 01C35C R0 text_0_to_3
local test_mode_start 01C365 R0 text_8_to_11
local test_mode_start 01C35C R1 text_4_to_7
local test_mode_start 01C365 R1 text_12_to_15
local test_mode_start 01C36B R12 lcd_place
local test_mode_menu 01C3A4,01C3A7,01C3AF R0 cell_value   # carried from test_mode_clear_text through the drawing: test_mode_draw_texts writes with its upper byte
local test_mode_menu 01C3BB,01C3C4,01C3DC R0 heading   # test_mode_flags bit 0, the heading's index; then on to the drawing as its cell value
local test_mode_menu 01C3AA,01C3BE R10 text
local test_mode_menu 01C3D6 R10 cursor_cell
local test_mode_menu_run 01C3F1,01C3F6,01C405,01C41A R0 cursor
local test_mode_menu_run 01C414 R10 cursor_cell
local test_mode_menu_run 01F0AD t3 blink_timer   # (01F0AD, the blink every *_run of the test mode ends with)
param test_mode_menu_show_write_count R0 cell_value
local test_mode_menu_show_write_count 01C44D,01C459 R0 write_count
local test_mode_menu_show_write_count 01C452,01C459 R1 attribute   # 64: the number's colour
local test_mode_menu_show_write_count 01C43E R10 text
local test_mode_menu_show_write_count 01C446,01C459 R10 cell
local test_mode_menu_show_write_count 01C456 R2 digits
local test_mode_menu_toggle_continue 01C5C6,01C5CF R0 heading
local test_mode_menu_toggle_continue 01C5C9 R10 text
local test_mode_menu_toggle_continue 01C5BD t2 mode_flags
local test_mode_memory_test 01C5E3,01C602,01C6DA,01C6E8,01C77A,01C783,01C7B2,01C7BB,01C7EA,01C7F3,01C822,01C82D R0 cell_value   # what the drawing leaves in R0, for test_mode_memory_test_draw
local test_mode_memory_test 01C60C,01C613,01C64A,01C651,01C61D,01C622,01C62F,01C634,01C640,01C65B,01C660,01C66D,01C672,01C680 R0 rom_check   # the bytes to sum, then the even halfwords' check; its low byte then each chip's result (2 GOOD, 3 BAD), and the word what test_mode_memory_test_draw takes
local test_mode_memory_test 01C68A,01C691,01C6F2,01C6F9,01C732,01C74B,01C755,01C75A,01C78D,01C792,01C7C5,01C7CA,01C7FD,01C802,01C84C,01C853,01C8A0,01C8BC,01C8D9,01C8DE,01C907 R0 failures   # a test's R0: the bytes to test in, the failed bits it hands back out
local test_mode_memory_test 01C613,01C651 R1 odd_check
local test_mode_memory_test 01C605,01C643,01C683,01C6EB,01C74E,01C786,01C7BE,01C7F6,01C845,01C8D2 R10 memory_start
local test_mode_memory_test 01C69A,01C69F,01C6AC,01C6B1,01C6BF,01C6C4,01C6CF,01C6D4,01C702,01C707,01C714,01C719,01C727,01C72C,01C737,01C75F,01C764,01C76F,01C774,01C797,01C79C,01C7A7,01C7AC,01C7CF,01C7D4,01C7DF,01C7E4,01C807,01C80C,01C817,01C81C,01C86D,01C872,01C880,01C885,01C895,01C89A,01C8A7,01C8AC,01C8F6,01C8FB R1 chip_result
local test_mode_memory_test 01C616 t1 low_rom_check
local test_mode_memory_test 01C654 t1 high_rom_check
local test_mode_memory_test 01C697 t2 video_lane_0_failures
local test_mode_memory_test 01C6A8 t2 video_lane_1_failures
local test_mode_memory_test 01C6BA t2 video_lane_2_failures
local test_mode_memory_test 01C6FF t2 sprite_lane_0_failures
local test_mode_memory_test 01C710 t2 sprite_lane_1_failures
local test_mode_memory_test 01C722 t2 sprite_lane_2_failures
local test_mode_memory_test 01C732 t2 sprite_lane_3_failures
local test_mode_memory_test 01C87B t2 work_byte_1_failures
local test_mode_memory_test 01C88E t2 work_byte_2_failures
local test_mode_memory_test 01C8A0 t2 work_byte_3_failures
param test_mode_memory_test_draw R0 cell_value
local test_mode_memory_test_draw 01C95B R0 result_offset
local test_mode_memory_test_draw 01C965,01C96E,01C974,01C97A,01C980 R0 cell_contents   # the result's colour and characters on the text layer
local test_mode_memory_test_draw 01C93B R10 text
local test_mode_memory_test_draw 01C943,01C958 R10 result_place chip_test_results
local test_mode_memory_test_draw 01C954,01C986 R9 results_left
param test_mode_memory_test_checksum R10 memory_start program_halfwords
param test_mode_memory_test_checksum R0 byte_count   # hands back the even halfwords' check in its low half
param test_mode_memory_test_checksum R1 odd_check   # the odd halfwords' check, in its low half
local test_mode_memory_test_checksum 01C995,01C9A3,01C9A6,01C9AB R0 even_sum
local test_mode_memory_test_checksum 01C998,01C9AE,01C9B1,01C9B6 R1 odd_sum
local test_mode_memory_test_checksum 01C99B R2 shift   # FF: one to the right
local test_mode_memory_test_checksum 01C99E R3 polynomial   # 8810
local test_mode_memory_test_checksum 01C991,01C9B9 R9 pairs_left
param test_mode_memory_test_words R0 byte_count
param test_mode_memory_test_words R10 memory_start
local test_mode_memory_test_words 01C9CE,01CA1E R0 failures   # the bits that came back wrong
local test_mode_memory_test_words 01C9C3 R1 word_count
local test_mode_memory_test_words 01C9C7,01CA55 R2 pattern   # 01010101, a bit on each pass
local test_mode_memory_test_words 01C9D4,01CA06,01CA10,01CA4B R3 expected   # the pattern rotated by each word's address
local test_mode_memory_test_words 01C9D7,01CA09,01CA13,01CA4E R4 words_left
local test_mode_memory_test_words 01C9E3,01C9EA,01C9F1,01C9F8,01CA28,01CA2F,01CA36,01CA3D R5 address_bits
local test_mode_memory_test_words 01C9E0,01C9E8,01C9EF,01C9F6,01C9FD,01CA04,01CA25,01CA2D,01CA34,01CA3B,01CA42,01CA49 R6 rotation   # 6 less a step for each of the address's low groups of 3 bits that is not 0
local test_mode_memory_test_words 01C9E3 t4 low_17_bits
local test_mode_memory_test_words 01C9EA t4 low_14_bits
local test_mode_memory_test_words 01C9F1 t4 low_11_bits
local test_mode_memory_test_words 01C9F8 t4 low_8_bits
local test_mode_memory_test_words 01CA16 t2 found
local test_mode_memory_test_words 01CA28 t4 read_low_17_bits
local test_mode_memory_test_words 01CA2F t4 read_low_14_bits
local test_mode_memory_test_words 01CA36 t4 read_low_11_bits
local test_mode_memory_test_words 01CA3D t4 read_low_8_bits
local test_mode_memory_test_words 01CA0D,01CA16 R12 checked_address   # where the read back goes on, four bytes a step
param test_mode_memory_test_halfwords R0 size       # the bytes to test (its low half cleared for the failed bits it hands back: failures)
param test_mode_memory_test_halfwords R10 memory_start
local test_mode_memory_test_halfwords 01CA62 R1 halfword_count
local test_mode_memory_test_halfwords 01CA66,01CAF0 R2 pattern   # 0101, a bit on each pass
local test_mode_memory_test_halfwords 01CA71,01CAA2,01CAAC,01CAE6 R3 expected
local test_mode_memory_test_halfwords 01CA74,01CAA5,01CAAF,01CAE9 R4 halfwords_left
local test_mode_memory_test_halfwords 01CA7A,01CA86,01CA8D,01CA94,01CABE,01CACA,01CAD1,01CAD8 R5 address_bits
local test_mode_memory_test_halfwords 01CA7D,01CA84,01CA8B,01CA92,01CA99,01CAA0,01CAC1,01CAC8,01CACF,01CAD6,01CADD,01CAE4 R6 rotation
local test_mode_memory_test_halfwords 01CA86 t4 low_13_bits
local test_mode_memory_test_halfwords 01CA8D t4 low_10_bits
local test_mode_memory_test_halfwords 01CA94 t4 low_7_bits
local test_mode_memory_test_halfwords 01CAB2 t2 found
local test_mode_memory_test_halfwords 01CACA t4 read_low_13_bits
local test_mode_memory_test_halfwords 01CAD1 t4 read_low_10_bits
local test_mode_memory_test_halfwords 01CAD8 t4 read_low_7_bits
local test_mode_memory_test_halfwords 01CA6B,01CABA R0 failures
local test_mode_memory_test_halfwords 01CAA9,01CAB2 R12 checked_address   # where the read back goes on, two bytes a step
# ======== locals (batch L6) ========
# The test mode's text helpers, whose registers the pages pass on from one call to the next: R0 the
# character (a text cell's contents: the colour in its high byte, the character in its low byte; the colour
# carries on from one text to the next), R10 the text record being read or the text cell being written,
# R11 the cell. test_mode_clear_text hands back the count of cells it cleared (780), which the pages pass
# on as their first character (colour 07, character 80, until a text's colour code); the cursor's helpers
# (test_mode_set_cursor, test_mode_clear_cursor, test_mode_colour_line) take a colour and hand it back in
# the cells' high byte, a blank in that colour, which the pages keep as their character.
param test_mode_draw_texts R0 character
param test_mode_draw_texts R10 text test_mode_text_bytes   # a text record of the ROM (all its callers pass one), as bytes: its walk mixes halfwords (the lines' cells) and bytes (characters, colours)
local test_mode_draw_texts 01F0CA,01F0D1,01F0D9 R11 cell text_layer_cells
param test_mode_draw_instructions R0 character
local test_mode_draw_instructions 01F02C R10 text
param test_mode_blink_prompt R0 character
local test_mode_blink_prompt 01F052 t3 blink_timer
local test_mode_blink_prompt 01F058 R10 text
local test_mode_blink_prompt 01F064,01F076 R11 cell text_layer_cells
param test_mode_set_cursor R0 character
param test_mode_set_cursor R10 cell
local test_mode_set_cursor 01F093,01F097 R0 colour
local test_mode_clear_cursor 01F09A,01F0A3 R10 cell text_layer_cells
local test_mode_clear_cursor 01F0A6,01F0AA R0 colour
param test_mode_colour_line R0 colour
param test_mode_colour_line R10 cell text_layer_cells
local test_mode_colour_line 01F174 t3 character            # the cell's contents with its colour bits (9-11) cleared: 0 ends the line
local test_mode_clear_text 01F17D R0 cell_count            # 780: 30 rows of 64 cells
param test_mode_draw_number R0 number
param test_mode_draw_number R1 colour                       # the digits' colour in its low byte; it hands back the last digit's cell contents
param test_mode_draw_number R2 digit_count
param test_mode_draw_number R10 cell text_layer_cells
local test_mode_draw_number 01F10F R3 zero_character       # "0" in the colour: a digit's character is it + the digit
local test_mode_draw_number 01F113,01F116,01F119 R1 digit
param test_mode_draw_hex_number R0 number
param test_mode_draw_hex_number R1 colour
param test_mode_draw_hex_number R2 digit_count
param test_mode_draw_hex_number R10 cell text_layer_cells
local test_mode_draw_hex_number 01F13D R3 zero_character
local test_mode_draw_hex_number 01F141,01F144,01F14B,01F154 R1 digit
param test_mode_draw_count R0 number
param test_mode_draw_count R1 colours                      # the S's colour (the word's) in its low byte and the digits' in its second
param test_mode_draw_count R2 digit_count
param test_mode_draw_count R3 plural_offset                # how many cells from R10 the S of COIN(S), CREDIT(S), GAME(S) goes
param test_mode_draw_count R10 cell text_layer_cells
# The pages' blinking cursor: the menu loops' tail at 01F0AD, which every page's loop (and test_mode_menu_run) takes in; local lines are by the instruction, so these name it in all of them
local test_mode_volume_adjustment_select 01F0AD t3 blink_timer
local test_mode_volume_adjustment_select 01F0B9 t3 cursor_character
# The RAM tests: R0 the size of the RAM in bytes when they start, the bits found wrong (its low byte or
# halfword) when they end; R10 where the RAM starts
param test_mode_memory_test_bytes R0 size_then_wrong_bits
param test_mode_memory_test_bytes R10 ram_start
local test_mode_memory_test_bytes 01CAFA R1 byte_count
local test_mode_memory_test_bytes 01CAFD,01CB87 R2 pass_pattern
local test_mode_memory_test_bytes 01CB06,01CB38,01CB42,01CB7D R3 pattern
local test_mode_memory_test_bytes 01CB09,01CB3B,01CB45,01CB80 R4 bytes_left
local test_mode_memory_test_bytes 01CB15,01CB1C,01CB23,01CB2A,01CB5A,01CB61,01CB68,01CB6F R5 address_bits
local test_mode_memory_test_bytes 01CB12,01CB1A,01CB21,01CB28,01CB2F,01CB36,01CB57,01CB5F,01CB66,01CB6D,01CB74,01CB7B R6 turn   # how far the pattern turns for the next byte: 1 + the address's low groups of 3 bits that are 0
local test_mode_memory_test_bytes 01CB15 t3 address_low_15
local test_mode_memory_test_bytes 01CB1C t4 address_low_12
local test_mode_memory_test_bytes 01CB23 t4 address_low_9
local test_mode_memory_test_bytes 01CB2A t4 address_low_6
local test_mode_memory_test_bytes 01CB48 t2 read_byte
local test_mode_memory_test_bytes 01CB5A t3 checked_address_low_15
local test_mode_memory_test_bytes 01CB61 t4 checked_address_low_12
local test_mode_memory_test_bytes 01CB68 t4 checked_address_low_9
local test_mode_memory_test_bytes 01CB6F t4 checked_address_low_6
param test_mode_memory_test_nibbles R0 size         # the bytes to test (its low half cleared for the wrong bits it hands back: wrong_bits)
param test_mode_memory_test_nibbles R10 ram_start
local test_mode_memory_test_nibbles 01CB94 R1 halfword_count
local test_mode_memory_test_nibbles 01CB98,01CC78 R2 pass_pattern
local test_mode_memory_test_nibbles 01CBA3,01CBFF,01CC09,01CC6E R3 pattern
local test_mode_memory_test_nibbles 01CBA6,01CC02,01CC0C,01CC71 R4 halfwords_left
local test_mode_memory_test_nibbles 01CBB2,01CBBC,01CBC6,01CBD0,01CBDA,01CBE4,01CBEE,01CC21,01CC2B,01CC35,01CC3F,01CC49,01CC53,01CC5D R5 address_bits
local test_mode_memory_test_nibbles 01CBAF,01CBB7,01CBC1,01CBCB,01CBD5,01CBDF,01CBE9,01CBF3,01CBFD,01CC1E,01CC26,01CC30,01CC3A,01CC44,01CC4E,01CC58,01CC62,01CC6C R6 turn   # 1 + the address's low groups of 2 bits that are 0
local test_mode_memory_test_nibbles 01CBB2 t4 address_low_17
local test_mode_memory_test_nibbles 01CBBC t3 address_low_15
local test_mode_memory_test_nibbles 01CBC6 t3 address_low_13
local test_mode_memory_test_nibbles 01CBD0 t3 address_low_11
local test_mode_memory_test_nibbles 01CBDA t3 address_low_9
local test_mode_memory_test_nibbles 01CBE4 t3 address_low_7
local test_mode_memory_test_nibbles 01CBEE t3 address_low_5
local test_mode_memory_test_nibbles 01CC0F t2 read_halfword
local test_mode_memory_test_nibbles 01CC21 t4 checked_address_low_17
local test_mode_memory_test_nibbles 01CC2B t3 checked_address_low_15
local test_mode_memory_test_nibbles 01CC35 t3 checked_address_low_13
local test_mode_memory_test_nibbles 01CC3F t3 checked_address_low_11
local test_mode_memory_test_nibbles 01CC49 t3 checked_address_low_9
local test_mode_memory_test_nibbles 01CC53 t3 checked_address_low_7
local test_mode_memory_test_nibbles 01CC5D t3 checked_address_low_5
local test_mode_memory_test_nibbles 01CB9D,01CC17 R0 wrong_bits
local test_mode_memory_test_nibbles 01CC06,01CC0F R12 checked_address   # where the read back goes on, two bytes a step
local test_mode_memory_test_blink 01CC80,01CC91 R26 character   # NOW TESTING's character in palette 66, xored into its cell
local test_mode_memory_test_blink 01CC94 t2 cell
# The volume adjustment
local test_mode_volume_adjustment 01CDE0 R0 character
local test_mode_volume_adjustment 01CDE8,01CDF0 R0 character
local test_mode_volume_adjustment 01CE0B R0 character
local test_mode_volume_adjustment 01CDE3,01CDEB R10 text
local test_mode_volume_adjustment 01CE05 R10 cell
param test_mode_volume_adjustment_select R0 character
local test_mode_volume_adjustment_select 01CE28 R0 page_cursor
local test_mode_volume_adjustment_select 01CE3D R0 character
local test_mode_volume_adjustment_select 01CE59 R0 drawn_character   # the character the ADJUSTING texts are drawn with and leave (a variable of its own: the parameter is the character the page came in with)
local test_mode_volume_adjustment_select 01CE61,01CE69 R0 drawn_character
local test_mode_volume_adjustment_select 01CE7F R0 position      # the control's position, bit 0 cleared: the range's low end (the high end with bit 0 set)
local test_mode_volume_adjustment_select 01CE37 R10 cell
local test_mode_volume_adjustment_select 01CE5C,01CE64 R10 text
local test_mode_volume_adjustment_select 01CE6F R10 range volume_range
local test_mode_volume_adjustment_select 01CE82,01CE88 R10 range
local test_mode_volume_adjustment_select 01CE74,01CE7C R11 analog_input analog_positions
local test_mode_volume_adjustment_select 01CE79,01CE8B R9 controls_left
local test_mode_volume_adjustment_adjust 01CEA4,01CEBF R0 position   # a control's position; then what test_mode_volume_adjustment_draw hands back, the last one's in bar cells
local test_mode_volume_adjustment_adjust 01CE97,01CEA4 R10 analog_input analog_positions
local test_mode_volume_adjustment_adjust 01CE9C R11 range volume_range
local test_mode_volume_adjustment_adjust 01CEAF,01CEB9 R11 range
local test_mode_volume_adjustment_adjust 01CEA1,01CEBB R9 controls_left
param test_mode_volume_adjustment_draw R0 character
local test_mode_volume_adjustment_draw 01CEF7,01CEFA,01CF24,01CF27 R0 range_start   # the range's low end in bar cells (8 steps each)
local test_mode_volume_adjustment_draw 01CF5E R0 position_step                      # the control's position in bar cells: what the function hands back
local test_mode_volume_adjustment_draw 01CF11,01CF3E R0 range_character             # 6403: a block in green
local test_mode_volume_adjustment_draw 01CEFE,01CF01,01CF05,01CF08,01CF19,01CF2B,01CF2E,01CF32,01CF35,01CF46 R1 range_length
local test_mode_volume_adjustment_draw 01CEDB R10 text
local test_mode_volume_adjustment_draw 01CEE3,01CF0D,01CF16,01CF3A,01CF43,01CF62 R10 cell text_layer_cells
local test_mode_volume_adjustment_draw 01CEF4,01CF1D,01CF21,01CF4A,01CF58,01CF6C R9 controls_left
# The input test
01D26C  data  input_test_page_text           # INPUT TEST, MONITOR A, MONITOR B and the inputs' names, a text record of test_mode_draw_texts' (test_mode_input_test 01D114 "movea.b 1D26C[PC], R10"; its first line 1E F1 97 "INPUT TEST" 00 ... "TEST" 00 00 at 01D309)
local test_mode_input_test 01D111 R0 character
local test_mode_input_test 01D119 R0 character
local test_mode_input_test 01D114 R10 text
local test_mode_input_test_release 01D13B,entry R0 test_switches
param test_mode_input_test_draw R0 character
local test_mode_input_test_draw 01D177,01D182,01D18D,01D190,01D199,01D19C,01D19F R0 position   # the control's position, clamped to its range (volume_ranges) and scaled to 0-FF
local test_mode_input_test_draw 01D1D5 R0 bit                  # the switch's bit in its port (input_test_items)
local test_mode_input_test_draw 01D20F,01D222,01D255 R0 test_switches   # monitor A's SERVICE (bit 0) and TEST (bit 1), ports E and F (active low); then both monitors' (what the function hands back)
local test_mode_input_test_draw 01D22C R1 test_switches_b
local test_mode_input_test_draw 01D1B3 R1 colour
local test_mode_input_test_draw 01D185,01D193 R1 range_high    # the range's high end, then its width (less the low end)
local test_mode_input_test_draw 01D17A,01D196 R2 range_low      # the range's low end, then the position less it
local test_mode_input_test_draw 01D1B7 R2 digit_count
local test_mode_input_test_draw 01D151 R10 text
local test_mode_input_test_draw 01D159,01D1A2,01D1BA,01D1BD,01D1E1,01D1F7,01D238,01D24B R10 cell text_layer_cells
local test_mode_input_test_draw 01D160,01D1BA,01D1D2,01D1D5,01D1E1,01D1F7,01D207,01D238 R11 item input_test_bytes
local test_mode_input_test_draw 01D16A R13 range volume_range
local test_mode_input_test_draw 01D17A,01D185 R13 range
local test_mode_input_test_draw 01D1CB,01D1EB,01D20C R13 port_b io     # the same port of monitor B's I/O chip (C80000 on) as R12 of monitor A's
local test_mode_input_test_draw 01D174,01D1C0 R9 controls_left
# The output test
local test_mode_output_test 01D3E4 R0 character
local test_mode_output_test 01D3EC R0 character
local test_mode_output_test 01D40C R0 character
local test_mode_output_test 01D3E7 R10 text
local test_mode_output_test 01D406 R10 cell
local test_mode_output_test_run 01D439,01D46B,01D470,01D47F R0 page_cursor
local test_mode_output_test_run 01D48E R10 cell
local test_mode_output_test_draw 01D49A,01D4A6 R10 cell text_layer_cells
local test_mode_output_test_toggle 01D4D5 R11 output_variable port_output_bits   # the game's output byte the item's bit is in (port_d_outputs...)
# The sound test
01D7C6  table  sound_test_codes  u8          # the sound requests the sound test plays by number (test_mode_sound_test_play_a 01D711, test_mode_sound_test_play_b 01D756 "movz.bw 1D7C6[PC](R1), R0"): 121 codes (01 02 03 ... 8C 8D), closed by 0 at 01D83F
local test_mode_sound_test 01D620 R0 character
local test_mode_sound_test 01D628 R0 character
local test_mode_sound_test 01D648 R0 character
local test_mode_sound_test 01D623 R10 text
local test_mode_sound_test 01D642 R10 cell
local test_mode_sound_test_run 01D66C,01D671,01D680 R0 page_cursor
local test_mode_sound_test_run 01D6A0 R0 stop_request      # 1F: stops the monitor's sounds
local test_mode_sound_test_run 01D68F R10 cell
local test_mode_sound_test_draw 01D6C4,01D6D0,01D6D8,01D6E4 R0 number
local test_mode_sound_test_draw 01D6C9,01D6D0,01D6DD,01D6E4 R1 colour
local test_mode_sound_test_draw 01D6BD,01D6D0,01D6D3,01D6E4 R10 cell
local test_mode_sound_test_draw 01D6CD,01D6E1 R2 digit_count
local test_mode_sound_test_play_a 01D6F2,01D6FC,01D706 R0 sound_set_request   # D6, DA or D8: selects the sound set the sounds from number 40 on need
local test_mode_sound_test_play_a 01D711 R0 sound_code
local test_mode_sound_test_play_a 01D6E7,01D70F R1 sound_number
local test_mode_sound_test_play_a 01D70A s4 saved_sound_number
local test_mode_sound_test_play_b 01D737,01D741,01D74B R0 sound_set_request
local test_mode_sound_test_play_b 01D756 R0 sound_code
local test_mode_sound_test_play_b 01D72C,01D754 R1 sound_number
local test_mode_sound_test_play_b 01D74F s4 saved_sound_number
# The controls and the sound requests
local test_mode_read_controls 01F190 t1 port_e_a           # input port E of monitor A's I/O chip (C00008) and B's (C80008), active low
local test_mode_read_controls 01F197 t1 port_e_b
local test_mode_read_controls 01F1A5 t1 port_f_a
local test_mode_read_controls 01F1AC t1 port_f_b
local test_mode_read_controls 01F1B3 R2 port_f_pressed
local test_mode_read_controls 01F1BC R0 buttons
local test_mode_read_controls 01F1C4 R1 previous_buttons
local test_mode_read_controls 01F1E2 t2 flags_before        # test_mode_flags (and the three bytes after it) before bit 2 is turned
local test_mode_read_controls 01F1E8,01F1F9,01F1FC,01F1FF,01F21F R0 bank_then_count   # the converter's bank (test_mode_flags bit 2 as it was), then how many inputs are left to read (4 or 2)
local test_mode_read_controls 01F1EB,01F21C R10 converter_input   # the A/D converter's input (C00050 on, 2 bytes apart)
local test_mode_read_controls 01F1F3,01F219 R11 analog_input analog_positions
local test_mode_read_controls 01F202,01F212 R1 reading      # the input's 8 bits, the converter's bit 7 shifted in eight times
local test_mode_read_controls 01F209,01F215 R2 bits_left
local test_mode_read_controls 01F20C R3 converter_bits
local test_mode_send_sound 01F237 R0 read_index
local test_mode_send_sound 01F243 t2 inverted_request
local test_mode_send_sound 01F243 R1 inverted_command
param test_mode_queue_sound R0 request
local test_mode_queue_sound 01F26B R1 write_index
param test_mode_queue_sound_screen_2 R0 request          # (batch L6: it calls test_mode_queue_sound)
# The C.R.T. test
01D9C7  data  crt_test_first_page_text      # C.R.T. TEST 1/2 (test_mode_crt_test 01D853 "movea.b 1D9C7[PC], R10"): 18 F1 97 "C.R.T. TEST 1/2" 00 00
01D9DC  data  crt_test_second_page_text     # C.R.T. TEST 2/2 (test_mode_crt_test_grid 01D87D "movea.b 1D9DC[PC], R10"): 16 F1 97 " C.R.T. TEST 2/2 " 00 00
local test_mode_crt_test 01D840 R0 character
local test_mode_crt_test 01D858,01D85B R0 character
local test_mode_crt_test 01D853 R10 text
local test_mode_crt_test_grid 01D87A,01D882,entry R0 character
local test_mode_crt_test_grid 01D87D R10 text
param test_mode_crt_test_draw_bars R0 character
local test_mode_crt_test_draw_bars 01D8C0,01D8DA,01D8F5,01D8FA,01D900,01D907,01D913,01D91B,01D920,01D925 R0 drawn_character   # the frame's pieces (6C15-6C19), then the bars' (8001-8004)
local test_mode_crt_test_draw_bars 01D8B9,01D8CE,01D8D5,01D8E7,01D8F0,01D90E,01D918,01D91D,01D922,01D925 R10 cell text_layer_cells
local test_mode_crt_test_draw_bars 01D8C5,01D8D1 R9 cells_left
local test_mode_crt_test_draw_bars 01D8DC,01D8EC R9 rows_left
param test_mode_crt_test_draw_bar R0 character
param test_mode_crt_test_draw_bar R10 cell
local test_mode_crt_test_draw_bar 01D92A,01D948 R1 column_character   # the character in the column's palette (+ 200 a column)
local test_mode_crt_test_draw_bar 01D927,01D945 R11 column_cell text_layer_cells
local test_mode_crt_test_draw_bar 01D92D,01D94D R9 columns_left
param test_mode_crt_test_draw_grid R0 character
local test_mode_crt_test_draw_grid 01D95E,01D983,01D99D,01D9A0 R0 drawn_character   # the left edge (6C1B), the top edge (6C1D), the inside (6C1F)
local test_mode_crt_test_draw_grid 01D966,01D981,01D986 R1 far_edge_character       # the right edge (6C1C), the bottom edge (6C1E)
local test_mode_crt_test_draw_grid 01D957,01D973,01D97C,01D991,01D998,01D9B4 R10 cell text_layer_cells
local test_mode_crt_test_draw_grid 01D9A6,01D9AD R11 row_cell text_layer_cells
local test_mode_crt_test_draw_grid 01D9A9,01D9B0 R8 cells_left_in_row
local test_mode_crt_test_draw_grid 01D968,01D978,01D9A2,01D9B9 R9 rows_left
local test_mode_crt_test_draw_grid 01D988,01D994 R9 cells_left
# The game assignments
local test_mode_game_assignments 01D9F3 R0 character
local test_mode_game_assignments 01D9FB,01D9FE R0 character
local test_mode_game_assignments 01DA1E R0 character
local test_mode_game_assignments 01D9F6 R10 text
local test_mode_game_assignments 01DA18 R10 cell
local test_mode_game_assignments_run 01DA33,01DA38,01DA47 R0 page_cursor
local test_mode_game_assignments_run 01DA56 R10 cell
local test_mode_game_assignments_draw 01DA8C,01DA95 R0 number
local test_mode_game_assignments_draw 01DABA,01DABE R0 grey          # 60: the difficulty bar's cells past the level
local test_mode_game_assignments_draw 01DAD2,01DAE4,01DAF1 R0 seconds   # the stage's time_difficulty, then how many seconds it is either way
local test_mode_game_assignments_draw 01DB38,01DB3C R0 steering_on
local test_mode_game_assignments_draw 01DB48,01DB4C R0 advertise_on
local test_mode_game_assignments_draw 01DA8E,01DA95,01DAEA,01DAF1 R1 colour
local test_mode_game_assignments_draw 01DAD9,01DAE0 R1 sign_character   # + (642B) or - (642D)
local test_mode_game_assignments_draw 01DA92,01DAEE R2 digit_count
local test_mode_game_assignments_draw 01DA81,01DA95,01DA98,01DAB3,01DACF,01DAE7,01DAF1,01DAF4,01DAF7,01DB0B,01DB11,01DB17,01DB1D R10 cell text_layer_cells
local test_mode_game_assignments_draw 01DB3F,01DB4F R10 text
local test_mode_game_assignments_draw 01DAC1,01DB2F R11 row_cell
local test_mode_game_assignments_draw 01DAA1,01DAB6 R9 bar_cells_left
local test_mode_game_assignments_draw 01DACC,01DB34 R9 stages_left
local test_mode_game_assignments_draw 01DAA1 t3 bar_length     # game_difficulty * 2: two cells a level
local test_mode_game_assignments_time 01DB68 R1 stage_item       # the item under the cursor, 1-6: the stage's time_difficulty is the item's byte from time_difficulty - 1
local test_mode_game_assignments_time 01DB72,01DB79 R0 seconds
local test_mode_game_assignments_time entry R20 current_object &settings_magic   # the game assignments page keeps R20 at the settings (test_mode_game_assignments)
# The coin assignments. Their pages' item routines take in R1 what the page's loop left there (the
# page's item count, 3 or 4, when SERVICE has just moved the cursor) and pass it on unused:
# test_mode_coin_assignments_manual_draw keeps only its upper half, under the colours.
param test_mode_coin_assignments_draw R0 character
param test_mode_coin_assignments_draw R1 colours
local test_mode_coin_assignments_draw 01DDBC,01DDC5 R0 number
local test_mode_coin_assignments_draw 01DE25,01DE44,01DE4E R0 description_byte   # a line's coins, or what ends the lines (0, or negative before a text); then the text's characters in red (62)
local test_mode_coin_assignments_draw 01DE0D R0 credits
local test_mode_coin_assignments_draw 01DDBE,01DDC5,01DDE1,01DDF1,01DDFB,01DE06,01DE10,01DE1B R1 colours   # 64 (green) in its second byte; the line's characters pass through its low byte
local test_mode_coin_assignments_draw 01DDE6,01DDEE R10 cell text_layer_cells
local test_mode_coin_assignments_draw 01DDB1,01DDC5,01DDF8,01DE06,01DE09,01DE1B,01DE30,01DE39 R10 cell
local test_mode_coin_assignments_draw 01DDCC,01DE0D,01DE25,01DE4E R11 description coin_setting_description
local test_mode_coin_assignments_draw 01DDC2,01DE00,01DE15 R2 digit_count
local test_mode_coin_assignments_draw 01DE03,01DE18 R3 plural_offset
local test_mode_coin_assignments_draw 01DDDC,01DE23,01DE3E R9 lines_left
local test_mode_coin_assignments_show 01DD2B R0 character
local test_mode_coin_assignments_show 01DD33,01DD36 R0 character
local test_mode_coin_assignments_show 01DD4E R0 character
local test_mode_coin_assignments_show 01DD36 R1 colours
local test_mode_coin_assignments_show 01DD2E R10 text
local test_mode_coin_assignments_show 01DD48 R10 cell
param test_mode_coin_assignments_run R1 item_count          # what test_mode_coin_assignments_show left (the colours) until SERVICE moves the cursor: then 3 (the item table's 12 bytes / 4)
local test_mode_coin_assignments_run 01DD63,01DD68,01DD77 R0 page_cursor
local test_mode_coin_assignments_run 01DD86 R10 cell
local test_mode_coin_assignments_next_setting 01DE56,01DE5A,01DE62 R0 setting_number
param test_mode_coin_assignments_manual_start R1 item_count
local test_mode_coin_assignments_manual_start 01DEC7 R0 character
local test_mode_coin_assignments_manual_start 01DECF R0 character
local test_mode_coin_assignments_manual_start 01DED2 R0 coins_for_credit
local test_mode_coin_assignments_manual_start 01DEF2 R0 character
local test_mode_coin_assignments_manual_start 01DECA R10 text
local test_mode_coin_assignments_manual_start 01DEEC R10 cell
local test_mode_coin_assignments_manual_run 01DF08,01DF0D,01DF1C R0 page_cursor
local test_mode_coin_assignments_manual_run 01DF0F,01DF13,entry R1 item_count   # 4 (the item table's 16 bytes / 4)
local test_mode_coin_assignments_manual_run 01DF2B R10 cell
01E39E  data  no_bonus_adder_text           # "NO BONUS ADDER" (test_mode_coin_assignments_manual_draw 01DF79 "movea.b 1E39E[PC], R10", bonus_adder 0): 1E F5 9B, ten blanks to cover the longer text, then the words, 00 00
01E3BC  data  bonus_free_play_text          # "FREE PLAY" (test_mode_coin_assignments_manual_draw 01DF83 "movea.b 1E3BC[PC], R10", bonus_adder negative): 3C F5 9D "FREE PLAY" 00 00
01E3CB  data  bonus_adder_text              # "COINS GIVE 1 EXTRA COIN" after bonus_adder's digit (test_mode_coin_assignments_manual_draw 01DF9C "movea.b 1E3CB[PC], R10"): 22 F5 9B ... 00 00
param test_mode_coin_assignments_manual_draw R1 item_count
local test_mode_coin_assignments_manual_draw 01DF5D,01DFC2 R0 coins_for_credit   # coins_per_credit: drawn, then what the table divides by (and what the function hands back)
local test_mode_coin_assignments_manual_draw 01DF6F,01DF99 R0 shown_bonus
local test_mode_coin_assignments_manual_draw 01DFAB R0 shown_multiplier
local test_mode_coin_assignments_manual_draw 01DF61,01DF6C,01DF92,01DF99,01DFAF,01DFBA R1 colours
local test_mode_coin_assignments_manual_draw 01DFC6 R1 coins_for_bonus   # bonus_adder, signed: none when 0 or negative
local test_mode_coin_assignments_manual_draw 01DF66,01DF96,01DFB4 R2 digit_count
local test_mode_coin_assignments_manual_draw 01DFCA R2 multiplier
local test_mode_coin_assignments_manual_draw 01DF69,01DFB7 R3 plural_offset
local test_mode_coin_assignments_manual_draw 01DFCE,01DFD7,01DFE7 R3 counted_coins   # what the coins count for so far: each the multiplier, and the bonus coins
local test_mode_coin_assignments_manual_draw 01DFD1,01DFDE,01DFE4,01DFEA R4 toward_bonus  # the counted coins toward the next bonus coin (the bonus coins they make, then the rest carried on)
local test_mode_coin_assignments_manual_draw 01DFE1,01DFE4 R5 bonus_rest
local test_mode_coin_assignments_manual_draw 01DFED,01DFF3,01DFFB R5 credits      # at most 9
local test_mode_coin_assignments_manual_draw 01E006 R5 numerator                  # the coins toward the next credit, over coins_for_credit: drawn as a fraction
local test_mode_coin_assignments_manual_draw 01DFF0,01DFF3,01DFFE R6 leftover_coins
local test_mode_coin_assignments_manual_draw 01E001 s4 saved_leftover_coins
local test_mode_coin_assignments_manual_draw 01DFBD,01E003,01E00C,01E01B,01E026 R10 cell text_layer_cells
local test_mode_coin_assignments_manual_draw 01DF56,01DF6C,01DF8D,01DF99,01DFA4,01DFBA R10 cell
local test_mode_coin_assignments_manual_draw 01DF79,01DF83,01DF9C R10 text
local test_mode_coin_assignments_manual_draw 01DFD4,01E029 R9 rows_left      # one row for each of 1 to 9 coins
param test_mode_draw_two_digits R5 number
param test_mode_draw_two_digits R10 cell text_layer_cells
local test_mode_draw_two_digits 01E02E,01E031 R6 ones
param test_mode_coin_assignments_step_coin_to_credit R1 item_count
local test_mode_coin_assignments_step_coin_to_credit 01E04F R0 setting_offset   # 10: coins_per_credit's place in the settings
param test_mode_coin_assignments_step_value R0 setting_offset
param test_mode_coin_assignments_step_value R1 item_count
local test_mode_coin_assignments_step_value 01E053,01E057,01E05E R1 setting
param test_mode_coin_assignments_step_bonus_adder R1 item_count
local test_mode_coin_assignments_step_bonus_adder 01E073,01E07B,01E07D,01E08B R0 bonus
local test_mode_coin_assignments_step_bonus_adder 01E07D t2 next_bonus
param test_mode_coin_assignments_step_multiplier R1 item_count
local test_mode_coin_assignments_step_multiplier 01E09B R0 setting_offset    # 11: first_chute_multiplier's place in the settings
# The network assignments
local test_mode_network_assignments_start 01E453 R0 character
local test_mode_network_assignments_start 01E45B,01E490 R0 character
local test_mode_network_assignments_start 01E46F,01E473,01E47D,01E481 R0 hidden_colour   # 6E, the background's: PRIVILEGE MODE and CABINET ID hidden when stand-alone
local test_mode_network_assignments_start 01E4B0 R0 character
local test_mode_network_assignments_start 01E456 R10 text
local test_mode_network_assignments_start 01E468,01E476,01E4AA R10 cell
local test_mode_network_assignments_run 01E4C5,01E4DA,01E4DF,01E4EE,01E513 R0 page_cursor
local test_mode_network_assignments_run 01E4FD R10 cell
local test_mode_network_assignments_draw 01E528,01E52C R0 stand_alone_bit
local test_mode_network_assignments_draw 01E538 R0 privilege        # test_mode_privilege_mode: 0 SLAVE, 1 MASTER
local test_mode_network_assignments_draw 01E551,01E55A,01E569,01E56D,01E577,01E57B R0 cabinet_number_then_colour   # cabinet_id + 1; when stand-alone, 6E (hidden) put in its low byte for test_mode_colour_line
local test_mode_network_assignments_draw 01E553,01E55A R1 colour
local test_mode_network_assignments_draw 01E557 R2 digit_count
local test_mode_network_assignments_draw 01E52F,01E53D R10 text
local test_mode_network_assignments_draw 01E546,01E55A,01E562,01E570 R10 cell
param test_mode_network_assignments_toggle_communication R0 page_cursor
local test_mode_network_assignments_toggle_communication 01E584,01E587,01E59E,01E5A4,01E5B1,01E5BB,01E5BD R0 stand_alone_then_colour   # the new stand_alone (1, less 1 when it was set), then the labels' colour (60 shown, 6E hidden)
local test_mode_network_assignments_toggle_communication 01E587 t1 stand_alone_setting   # 1, STAND-ALONE
local test_mode_network_assignments_toggle_communication 01E5AF s4 saved_colour
local test_mode_network_assignments_toggle_communication 01E5A8,01E5B4 R10 cell
local test_mode_network_assignments_toggle_privilege_mode 01E5C3,01E5C8,01E5CC R0 privilege
local test_mode_network_assignments_toggle_privilege_mode 01E5C8 t2 stepped_privilege
# The bookkeeping
01EA5C  data  bookkeeping_first_page_text   # BOOKKEEPING 1/2 and its labels, a text record of test_mode_draw_texts' (test_mode_bookkeeping_start 01E6EE "movea.b 1EA5C[PC], R10"): 18 F1 97 "BOOKKEEPING 1/2" ... closed at 01EBB8
01EBB9  data  bookkeeping_second_page_text  # BOOKKEEPING 2/2, TIME HISTOGRAM and its stages, OutRunner of OutRunners (test_mode_bookkeeping_second_page_start 01E718 "movea.b 1EBB9[PC], R10"): 18 F1 97 "BOOKKEEPING 2/2" 00 ...
local test_mode_bookkeeping_start 01E6EB R0 character
local test_mode_bookkeeping_start 01E6F3,01E6F6 R0 character
local test_mode_bookkeeping_start 01E6EE R10 text
local test_mode_bookkeeping_second_page_start 01E715 R0 character
local test_mode_bookkeeping_second_page_start 01E71D,01E720 R0 character
local test_mode_bookkeeping_second_page_start 01E718 R10 text
local test_mode_bookkeeping_draw_totals 01E74E,01E75C R0 coins_a          # COIN CHUTE A: the coins of seat A's first chute (701F06)
local test_mode_bookkeeping_draw_totals 01E764,01E772 R0 coins_b
local test_mode_bookkeeping_draw_totals 01E77A R0 total_coins
local test_mode_bookkeeping_draw_totals 01E790 R0 coin_credits
local test_mode_bookkeeping_draw_totals 01E7AA R0 service_credits
local test_mode_bookkeeping_draw_totals 01E7C4 R0 total_credits
local test_mode_bookkeeping_draw_totals 01E7DA,01E829 R0 games_a
local test_mode_bookkeeping_draw_totals 01E7F1 R0 games_b
local test_mode_bookkeeping_draw_totals 01E80A R0 total_time
local test_mode_bookkeeping_draw_totals 01E816 R0 play_time_a
local test_mode_bookkeeping_draw_totals 01E822 R0 play_time_b
local test_mode_bookkeeping_draw_totals 01E844,01E847 R0 average_time
local test_mode_bookkeeping_draw_totals 01E84F,01E853 R0 longest_time
local test_mode_bookkeeping_draw_totals 01E85B,01E85F R0 shortest_time
local test_mode_bookkeeping_draw_totals 01E752,01E768 R4 coin_sum
local test_mode_bookkeeping_draw_totals 01E794,01E7AE R4 credit_sum
local test_mode_bookkeeping_draw_totals 01E755,01E75C,01E76B,01E772,01E77D,01E788,01E797,01E7A2,01E7B1,01E7BC,01E7C7,01E7D2,01E7DE,01E7E9,01E7F5,01E800 R1 colours
local test_mode_bookkeeping_draw_totals 01E831 R1 total_games
local test_mode_bookkeeping_draw_totals 01E831 t3 game_count
local test_mode_bookkeeping_draw_totals 01E759,01E76F,01E782,01E79C,01E7B6,01E7CC,01E7E3,01E7FA R2 digit_count
local test_mode_bookkeeping_draw_totals 01E785,01E79F,01E7B9,01E7CF,01E7E6,01E7FD R3 plural_offset   # negative: the S is before the number
local test_mode_bookkeeping_draw_totals 01E747,01E75C,01E75F,01E772,01E775,01E788,01E78B,01E7A2,01E7A5,01E7BC,01E7BF,01E7D2,01E7D5,01E7E9,01E7EC,01E800 R10 cell
local test_mode_bookkeeping_draw_totals 01E803,01E80E,01E811,01E81A,01E81D,01E826,01E837,01E847,01E84A,01E853,01E856,01E85F R11 time_cell
local test_mode_bookkeeping_draw_histogram 01E86D,01E87B R0 largest_count
local test_mode_bookkeeping_draw_histogram 01E8A1,01E8B1 R0 games              # how many games got as far as the stage
local test_mode_bookkeeping_draw_histogram 01E8E5,01E93A,01E94D,01E959 R0 car_then_time   # the record's car, by its colour (car_colour_names; negative: no record), then its time in hundredths and what is left of it digit by digit
local test_mode_bookkeeping_draw_histogram 01E8FE,01E904,01E90A,01E910,01E916,01E91C,01E925,01E92B R0 character
local test_mode_bookkeeping_draw_histogram 01E873 R1 stage_games
local test_mode_bookkeeping_draw_histogram 01E8AA,01E8B1 R1 colour
local test_mode_bookkeeping_draw_histogram 01E947,01E94D R1 rest_time
local test_mode_bookkeeping_draw_histogram 01E8AE R2 digit_count
local test_mode_bookkeeping_draw_histogram 01E93D R3 zero_character
local test_mode_bookkeeping_draw_histogram 01E882,01E890 R4 bar_scale       # 50000000 / the largest count: a count times it, over 2^26 and rounded, is its bar's blocks (at most 20)
local test_mode_bookkeeping_draw_histogram 01E8A4,01E8B4,01E8BB,01E8CA R5 bar_blocks
local test_mode_bookkeeping_draw_histogram 01E8BB t3 rounded_blocks
local test_mode_bookkeeping_draw_histogram 01E869,01E873 R10 stage_counts stage_game_counts
local test_mode_bookkeeping_draw_histogram 01E8A7,01E8B1 R10 number_cell
local test_mode_bookkeeping_draw_histogram 01E8C0,01E8C4 R10 bar_cell text_layer_cells
local test_mode_bookkeeping_draw_histogram 01E8D7,01E965 R10 row_cell text_layer_cells
local test_mode_bookkeeping_draw_histogram 01E893,01E8A1 R11 drawn_counts stage_game_counts
local test_mode_bookkeeping_draw_histogram 01E8DE R11 record backup_course_record   # the first course's (701F32): the reads after it are by its offset
local test_mode_bookkeeping_draw_histogram 01E8E5,01E925,01E92B,01E931,01E93A,01E962 R11 record
local test_mode_bookkeeping_draw_histogram 01E870,01E87E,01E89E,01E8D3 R9 stages_left
local test_mode_bookkeeping_draw_histogram 01E8E2,01E96A R9 records_left
constant test_mode_draw_duration 15180 SECONDS_PER_DAY       # 86400: "divux R2, R0" at 01E9AE with R2 = 15180 (01E9A7), the days of the time
constant test_mode_draw_duration E10 SECONDS_PER_HOUR        # 3600: "divux R2, R0" at 01E9CF, the hours of what is left
param test_mode_draw_duration R0 seconds
param test_mode_draw_duration R11 cell
local test_mode_draw_duration 01E9C3,01E9CF,01E9E1 R0 seconds_of_day
local test_mode_draw_duration 01E9E4 R0 seconds_of_hour
local test_mode_draw_duration 01E9A4,01E9AE,01E9C5,01E9CF R1 remainder
local test_mode_draw_duration 01E9B3,01E9C0,01E9D4,01E9E1 R1 colour
local test_mode_draw_duration 01E9B1,01E9D2 s4 saved_remainder
local test_mode_draw_duration 01E9BA,01E9C0,01E9DB,01E9E1 R10 number_cell
local test_mode_draw_duration 01E9B7,01E9D8 R2 digit_count
constant test_mode_draw_minutes_seconds 3C SECONDS_PER_MINUTE   # "divux R2, R0" at 01E9F0 with R2 = 3C: the minutes of the time
param test_mode_draw_minutes_seconds R0 seconds
param test_mode_draw_minutes_seconds R11 cell
local test_mode_draw_minutes_seconds 01E9E6,01E9F0 R1 remainder
local test_mode_draw_minutes_seconds 01E9F5,01EA02,01EA07,01EA11 R1 colour
local test_mode_draw_minutes_seconds 01E9F3 s4 saved_remainder
local test_mode_draw_minutes_seconds 01E9FC,01EA02,01EA0E,01EA11 R10 number_cell
local test_mode_draw_minutes_seconds 01E9F9,01EA0B R2 digit_count
param test_mode_duration_to_seconds R10 duration stored_duration   # a time kept as its seconds, minutes and hours (a byte each) and its days (a halfword after them): read from the days down
result test_mode_duration_to_seconds R0 seconds
local test_mode_duration_to_seconds 01EA1E,01EA2E,01EA44 R0 seconds
constant test_mode_split_minutes_seconds 3C SECONDS_PER_MINUTE   # "divux #3C, R0" at 01EA4E
param test_mode_split_minutes_seconds R0 seconds
param test_mode_split_minutes_seconds R10 stored_time stored_duration   # where it writes the seconds, then the minutes
local test_mode_split_minutes_seconds 01EA4B,01EA4E R1 remainder
# The backup data clear, the exit and the colours
local test_mode_backup_data_clear_start 01EDC4 R0 character
local test_mode_backup_data_clear_start 01EDCC,01EDE7 R0 character
local test_mode_backup_data_clear_start 01EDC7 R10 text
local test_mode_backup_data_clear_start 01EDE1 R10 cell
local test_mode_backup_data_clear_run 01EE01,01EE16,01EE3A,01EE45,entry R0 character   # the new page cursor, which test_mode_set_cursor takes as its character, then what it hands back
local test_mode_backup_data_clear_run 01EE54,01EE58 R0 hidden_colour     # 6E: greys SELECT BY SERVICE BUTTON out
local test_mode_backup_data_clear_run 01EE10 R10 cell
local test_mode_backup_data_clear_run 01EE40 R10 text
local test_mode_backup_data_clear_run 01EE4F R10 instructions_cell
01EF12  data  eeprom_caution_text           # CAUTION, YOU HAVE EXCEEDED THE EEPROM'S WRITING FREQUENCY LIMIT OF 10,000 TIMES. (test_mode_exit 01EEDC "movea.b 1EF12[PC], R10"): 20 F4 9D "CAUTION" 00 ... 00 00 00
constant test_mode_exit 2710 EEPROM_WRITE_LIMIT   # 10000: "cmp.h #2710, 60A[R24]" (eeprom_write_count), past it the CAUTION
local test_mode_exit 01EEC1 t2 flags_before        # test_mode_flags (and the three bytes after it) before bit 1 is cleared
local test_mode_exit 01EED9 R0 character
local test_mode_exit 01EEE1 R0 character
local test_mode_exit 01EEDC R10 text
local test_mode_set_up_colours 01EF91,01EF94,01EFA7,01EFAA R0 halfword_count
local test_mode_set_up_colours 01F00D,01F01A R0 tile_row      # a row of eight pixels of the tile's colour: 11111111, 22222222, 33333333, 44444444
local test_mode_set_up_colours 01F010 R1 tile_step
local test_mode_set_up_colours 01EFBE,01F000 R0 level         # 0-31
local test_mode_set_up_colours 01EFD2,01EFDE,01EFEA R1 level_colour   # the level in red, then green, then blue
local test_mode_set_up_colours 01EFDB,01EFE7,01EFF3 R2 white
local test_mode_set_up_colours 01EFC5,01EFD8,01EFE4 R10 screen_2_colour io
local test_mode_set_up_colours 01EFCB,01EFD5,01EFE1 R11 screen_1_colour io
local test_mode_set_up_colours 01F006,01F020 R10 tile_place tile_pixel_words
local test_mode_set_up_colours 01F01D,01F023 R8 rows_left
local test_mode_set_up_colours 01EFC1,01F002 R9 levels_left
local test_mode_set_up_colours 01F017,01F027 R9 tiles_left
01F2BC  data  exit_prompt_text              # PUSH TEST BUTTON TO EXIT (test_mode_show_exit_prompt 01F034 "movea.b 1F2BC[PC], 708[R24]": test_mode_blink_address): 8E FC 99 " PUSH " 9D "TEST " 99 "BUTTON TO EXIT" 00 00
01F2DE  data  continue_prompt_text          # PUSH TEST BUTTON TO CONTINUE (test_mode_show_continue_prompt 01F043 "movea.b 1F2DE[PC], 708[R24]"): 8C FC 99 "PUSH " 9D "TEST " 99 "BUTTON TO CONTINUE" 00 00
# The interrupts
local int_vector_40 03F576,03F57C,03F582,03F588,03F5C5,entry R0 tile_bank_bits   # chip 0's port H: 2 bits for each of tile_banks-tile_banks[3]; check_test_button takes it on (what queue_seat_inputs or the interrupted code left in R0 when not written)
local int_vector_40 03F610 R0 screen_vblank_counter vblank_count
local vblank_update_scrolls 03F6B0 R0 running_layer   # the first tilemap of the screen whose task was running (its index * 2)
local vblank_update_scrolls 03F6B6 R1 other_layer
local vblank_update_scrolls 03F6C9,03F6F2,03F72B,03F754 R2 old_scroll
local vblank_update_scrolls 03F6CE,03F6DC,03F6F7,03F705,03F730,03F73E,03F759,03F767 R3 new_scroll
local vblank_update_scrolls 03F77D R0 control_byte     # video_registers[2]'s second byte, for 31FF05
local int_vector_43 03F7C4 t2 interrupts_left
local int_vector_44 03F843 t2 received_kind      # the link board's message kind (its byte at 800010, swapped with 0)
local int_vector_44 03F843 R0 message_kind
local int_vector_44 03F840,03F88B R1 timer_period
local send_sound_requests 03F8DE R10 command_offset   # 100 for screen 2: SOUND_COMMAND_2 and its second command byte are 100 bytes after screen 1's
local send_sound_requests 03F8E1,03F8E6,03F8E9 R0 queue
local send_sound_requests 03F901,03F906,03F909 R0 second_queue
local count_total_time 03F92C,03F952,01130D R0 time_count
local count_total_time 03F938 R7 total_time bookkeeping_count32   # the bookkeeping's TOTAL TIME (701F10), its copy 7C bytes on
local update_lamps 03F971 t2 checkpoint_timer
local update_lamps 03F98F t2 leader_timer
local update_lamps 03F9D8 t2 checkpoint_2_timer
local update_lamps 03F9F6 t2 leader_2_timer
local update_lamps 03F9B1,03F9C6,03FA18,03FA2D R0 port_d
local update_lamps 03FA39,03FA48 R10 screen_block
local update_lamps 03FA40,03FA4F R11 port_g
param update_button_lamps R10 screen_block
param update_button_lamps R11 port_g port_output_bits
local update_button_lamps 03FA54,03FA6D,03FA82,03FA87,03FAA0,03FAB5,03FABA R0 lamps   # the port G image's byte: bit 0 the DJ/MUSIC lamp, bit 1 the << >> lamp
local update_button_lamps 03FA8A R1 arrows_mode
# The pages' loops nothing else names (in no batch: count.py misses a function's last parameter): the
# character they take on to test_mode_blink_prompt
param test_mode_memory_test_run R0 character
param test_mode_input_test_run R0 character
param test_mode_crt_test_bars_run R0 character
param test_mode_crt_test_grid_run R0 character
param test_mode_bookkeeping_wait R0 character
param test_mode_bookkeeping_second_page_wait R0 character

# ======== locals (the merge: functions no batch had, the fills of string moves, shared sites) ========
param wheel_effect_1_surface_1_inner R13 surface # the roadside surface's record (ROADSIDE_SURFACE)
param wheel_effect_1_surface_1_outer R13 surface
param wheel_effect_2_surface_1_inner R13 surface
param wheel_effect_2_surface_1_outer R13 surface
param animation_start R9 animation               # the animation's number: sprite_animations[animation]
param bookkeeping_increment8 R7 counter_address bookkeeping_count8  # the counter's byte (its backup's 7C on)
param print_text_layer_list R19 text_record text_layer_record # print_text_layer's: the list's next string, then past it
param free_object_slot R21 object                # the object whose slot (bits 8-15 of its address) is freed
param set_tyre_noise_on_road R0 tyre_noise       # set_tyre_noise's
param road_object_stream_fork R10 branch_streams # the table of the branches' streams, after the command
param start_song_title R10 song_title            # the song title's record (x, then the text)
param start_dj_message_if_quiet R0 dj_message    # start_dj_message's
param check_test_button R0 leftover              # only its upper bytes go on, under switches_pressed
local lcd_update 018A51 r26 space_character      # the fill of the LCD text: spaces
local test_mode_memory_test 01C5F3 r26 blank_result     # memory_test_results cleared
local test_mode_coin_assignments_draw 01DDD2 r26 blank_cell
local test_mode_set_up_colours 01EF73 r26 background_colour  # 733 in every colour of both palettes
local test_mode_clear_text 01F182 r26 blank_cell        # the whole text layer cleared
local test_mode_menu_run 01F0B9 t1 blink_cell           # the cursor-blink tail the test mode's pages share: the cell that blinks (test_mode_blink_address)
local test_mode_menu_run 01F0B9 t3 cursor_character
param road_row_hit_check R15 next_hit_box
param road_row_pair_crash_check R15 next_hit_box

# ======== data below 0x10000 the code uses by its address ========
# (each a value the C used as a number: an instruction names it, absolute or PC-relative)
00010C  data  signature_text                # the program's 48-byte signature, "Miyu Tsukamoto O..." (signature_checksum 0000FC: its crc16)
0004C0  data  default_settings              # "S32A" and the defaults load_settings copies over the settings (40 halfwords to settings_magic) when they are bad
000C98  data  second_task_start_frame       # the interrupt frame the second task starts from: boot and second_task copy 3E halfwords of it to 21FF84 (PC 0006B0, PSW 00040000)
000F70  data  isdn_connection_objects       # game mode 8's list for start_object_list: the count (1), then isdn_connection_object_handlers
001A78  data  car_presentation_objects      # game mode 3's list: the count (3), then car_presentation_object_handlers
001AE8  data  staff_credits_texts           # staff_credits_code_show's texts, "OutRunners" MAIN STAFF and on (place, then the characters)
001D70  data  car_name_letter_palette_steps # car_name_letter_update's palette list (object_palette_steps: 18 19 1A 1B 1C 1B 1A 19, then -12 back)
002CB8  data  ranking_objects               # game_mode_ranking and ranking_update's list: the count (2), then the handlers
002D58  data  name_entry_objects            # name_entry_update's list: the count (4), then name_entry_object_handlers
00346C  data  player_car_objects            # game_mode_play's list at the race's start (steps 5, 27...): the count (1), then player_car_object_handlers (the screen's car, player_car_update)
003474  data  race_objects                  # game_mode_play's list when the race starts (step 23): the count (19), then race_object_handlers
0034C4  data  demo_race_objects             # the same for the demo's race (demo_flags bit 8): the count (9), then demo_race_object_handlers
0034EC  data  route_map_objects             # game_mode_play's list for the route map (game step 12): the count (1), then route_map_object_handlers
003504  data  meaning_of_the_light_title    # a song title (song_title_record: x 48, then "Meaning of the Light"), which game_mode_play starts
005014  data  thank_you_lcd_text            # "Thank you for your playing.", which route_map_update keeps scrolling on the LCD (screen lcd_scroll_request)
006DCC  data  welcome_letter_palette_steps  # welcome_letter_show's palette list (object_palette_steps: 18 19 1A 1B 1C 1B 1A 19, then -12 back)
006E18  data  transmission_panel_palette_steps  # the automatic and manual panels' palette list (object_palette_steps: 2A8 2A9 2AA 2AB 2AC 2AD 2AC 2AB 2AA 2A9, then -16 back)
006EB0  data  entry_lcd_text                # "Entry:", which car_select_entries_run copies to the LCD's text (screen F12)
006EB6  data  mega_driver_title             # a song title (song_title_record: x 6C, then "Mega Driver"), which car_select_run starts

# ======== stack slots ========
local traffic_car_draw 0139B6 s4 saved_position      # kept across draw_object
local traffic_car_draw 0139B8 s8 saved_seen_from

# ======== source files: the files of src/ and the stretches of the program each takes (decompile.source_files) ========
# The files by subject: system/, video/, engine/, race/, objects/, scenes/. A stretch is a run of functions the
# original's linker laid out together; a file may take several, and the comment of its first line is its
# description.
000000  file  system/main               # the machine's main program: the boot and its checks, the second task, the frame wait, the start of a game, a screen and the board, the reset
00013C  file  system/settings           # the settings in the EEPROM: loading, checking and saving them, and the EEPROM's serial lines
0006B0  file  system/main               # the second task, the frame wait and the start of a game, a screen and the board
0009F9  file  system/inputs             # the controls: the switches and the analog inputs (wheel, pedals), each seat's inputs and the screens' new presses
000D7D  file  race/link                 # the link between the cabinets: the ISDN connection, the network check at boot, the race's entries and progress, the course records, the records sent and received
001000  file  scenes/game_modes         # the game modes: the title, the power on, the car presentation, the demo race, the ranking and the game itself
0010CD  file  scenes/attract            # the attract mode's scenes: the bar picture, the cabinet lamps, the car presentation and its car name, the staff credits code, the demo race's captions
001440  file  scenes/game_modes         # the power on, the restart, the car presentation and the demo race's steps
0015D8  file  scenes/attract            # the cabinet lamps, the car presentation, the staff credits code and the car's name
001D84  file  scenes/ranking            # the ranking: the course records, OutRunner of OutRunners, its titles, banners and record lines, and the traffic passing behind them
001DCC  file  scenes/game_modes         # the ranking's game mode
001E89  file  scenes/name_entry         # the name entry after a record: the certificate, the letters' drum, the LCD, the car, the drivers and the course's name
00247A  file  scenes/ranking            # the ranking's objects and its background
002E74  file  scenes/game_modes         # the game: its steps from the car select to the goal and the route map, and clearing the screen and the race
003520  file  scenes/route_map          # the route map after the race: the car, the signs, the landmarks, the legs of the route, the stage results and the GAME OVER banner
005030  file  scenes/car_select         # the car select: the attendant and the turntable, the cars, the transmission, the flags of the other cabinets' choices, the countdown and the entry traffic
006EF0  file  race/player_car           # the screen's car each frame: its place, the view, the rivals' warning, the crash physics
009590  file  race/race_cars            # the cars of the race drawn as the screen's view sees them: the body, the spray, the pieces
00A00C  file  race/physics              # the car's physics: the gears and torque curves, the controls, driving along the road, the engine, the road's drag and its edges, the wheels' effects
00BFC1  file  race/hud                  # the race's display: the rev meter, the speedometer, the gear, the place, the lap timer, the time left, the stage and goal messages, the race result, the checkpoint board
00D0C8  file  race/link                 # the network check at boot, the race's entries and progress, the course records, the records sent and received
00EAE4  file  engine/sprites            # drawing an object: its draw modes, its sprites from its animation's frame, the rows of sprites along the road
00FCBC  file  race/course               # the course: its segments built ahead of the car, the road projected for the view
010634  file  video/video               # the video chips set up and cleared: the screens, the tile layers, the sprite chip and its lists, the mixer, the I/O chips
010DC4  file  video/unpack              # unpacking the tile pages and the lists of packed blocks, a step each frame
011018  file  system/coins              # the coins and credits, and the bookkeeping
011594  file  video/palettes            # the palettes: the boot's, the stages', the upload queue, the screen fades and the palette fades
0117E4  file  video/text                # the text: the fonts, the text layer's strings, numbers in hexadecimal and BCD, text in sprites
011C60  file  engine/objects            # the objects: the object loop, starting and freeing objects and their lists, the random numbers
011E88  file  system/sound              # the sound requests to the sound program: sounds, the engine and tyre noise, the music's fade
0120AC  file  race/hits                 # the angles of a vector, the hit boxes and the checks of the car against the road's objects and the traffic
0126FC  file  objects/scenery           # the road's objects: the streams that start them along the course, the scenery, the signs, the start gate and flagmen, the goal parades, the fork's branch
01376C  file  objects/traffic           # the traffic: its cars, convoys, people and their hits
013DC4  file  objects/scenery           # the branch of the road the car did not take after a fork
014108  file  objects/race_people       # the race's people and moments: the cars' occupants and their gestures, the opening, the stage end, the camera at the forks, the goal's actors
016B00  file  objects/road_surface      # the road's surface drawn line by line, and its tiles' changes
017524  file  objects/backgrounds       # the backgrounds: their layers and animations, the palette cycles, the sunset, the backdrops
0184D0  file  video/palettes            # the palette fades
0186FC  file  system/lcd                # the cabinets' LCD: its driver and the race's information on it
018F74  file  objects/car_radio         # the car radio: the songs, the DJ and his messages, the songs' titles
019CAC  file  scenes/title              # the title screen: the cars and riders, the palms, the logo, the seagull, the pictures
01A6CF  file  scenes/coin_prompts       # the prompts for coins and the ignition key, and the credits shown
01ADE8  file  scenes/attract            # the demo race's captions
01AFDC  file  scenes/kanji_text_viewer  # a viewer of kanji texts nothing starts (unused)
01C241  file  system/test_mode          # the test mode: its menu and pages (memory, volume, input, output, sound, CRT, game, coins, network, bookkeeping, backup clear) and their drawing
03F500  file  system/interrupts         # the interrupts: the VBLANK (the tasks, the mixer and scrolls, the test button, the sound requests, the lamps), the timers and the link
03FFF0  file  system/main               # the reset

# ======== the 79 fields named after their offset ========
struct road_segment 20     # a segment of the course's ring (screen + 2000, 128 of them, build_offset & FFF): player_car_build_segment writes it
field road_segment 00 heading u16        # the heading angle's high half (car heading_angle)
field road_segment 02 pitch u16          # the pitch angle's high half (car pitch_angle)
field road_segment 04 x u32              # where it is in the world (car next_x, next_z, next_y)
field road_segment 08 z u32
field road_segment 0C y u32
field road_segment 10 width u16          # the road's width
field road_segment 12 half_width u16
field road_segment 14 width_code u8      # the course run's width code (0 at a fork)
field road_segment 15 road_event u8      # car road_event at the segment
field object 02 flags_upper u16          # bits 16-31 of the object's flags word, which the draw routines read and write with flags and flags_high as one word
field object 14 parent u32 object        # the object that started it (race_background_start_objects; families name it presentation, panel, leader)
field object 18 parameter u32            # what the list or the road's stream that starts it gives it (road_object_stream_start_object: the entry's parameter; families read their record there)
field object 80 list_data u32            # the data the object list that starts it gives it (object_lists: data -> field 80)
field race 0B master_time_difficulty s8[6]    # the time difficulty the master cabinet sends, a byte a checkpoint as time_difficulty holds them (link_send_records, link_take_master_settings, which move the last four as one word; race_progress_update reads them by checkpoint)
field race 5A link_pad_5A u8             # sent with the record (link_send_records); nothing else reads or writes it
field race 5B link_pad_5B u8
local clear_published_car entry R20 car_object object.player_car   # the screen's car's object (player_car_update calls it)

# ======== records reached through pointers (mem_access) ========
struct view 20             # a view of the screen's ring of eight (screen + 600 + 20 * slot): player_car_publish writes this frame's, and the screen draws the one shown_view names
field view 00 x u32                      # where the view is in the world (car view_x, view_y, view_z)
field view 04 y u32
field view 08 z u32
field view 0C pitch u16                  # its angles (car view_pitch, view_yaw)
field view 0E yaw u16
field view 10 window_offset u16          # the window's first segment in the ring (its offset from screen + 2000)
field view 12 horizon_line u16           # the horizon's line on screen (screen horizon_line)
struct projected_segment 10   # a segment of the road as the screen shows it (screen + 3000, one for each segment in view, scale 0 after the last): player_car_project_road writes them
field projected_segment 00 scale u16     # the segment's scale by its depth (0: not shown)
field projected_segment 02 width u16     # the road's width on screen
field projected_segment 04 x u16         # the road's centre on screen
field projected_segment 06 y u16
field projected_segment 08 depth_layer u16   # the depth layer its sprites go in (depth_layers_by_depth)
field projected_segment 0C width_code u8     # the segment's width code and road event (road_segment 14, 15)
field projected_segment 0D road_event u8

# ======== records reached through pointers (batch M1) ========
# The coins: each seat's credits, the coin meters' pulses and the coin chutes' entries (update_coins, pulse_coin_meter,
# add_service_credit, insert_coin)
struct seat_credits 8          # a seat's credits, 8 bytes a seat: seat1_credits (20E0A0) and seat2_credits (20E0A8); add_service_credit takes it in R10, insert_coin from its chute's entry (coin_chute_variant credits)
field seat_credits 00 credits u8          # the credits, up to 9 (seat1_credits, seat2_credits)
field seat_credits 01 coin_units u8       # the coin units toward the next credit: a credit each coins_per_credit (seat1_coin_units, seat2_coin_units)
field seat_credits 02 bonus_units u8      # the coin units toward the next bonus unit: one unit more each bonus_adder (insert_coin)
field seat_credits 04 bookkeeping_byte u8      # seat1_bookkeeping_byte, seat2_bookkeeping_byte (check_game_start takes a credit: "dec.b [R2]" 00089B, "mov.b #0, 2[R2]" 00089D)
struct coin_meter 3            # a coin meter's pulse: coin_meters (20E080), 3 bytes for each chute's meter (seat 1's first and second, then seat 2's); pulse_coin_meter drives it
# coin_meter 00: the vertical blanks its bit stays on (low byte), then off (high byte): 6 and 6 at a pulse; pulse_coin_meter reads and writes the two as one halfword (the C reads and writes its two bytes)
field coin_meter 00 frames_on u8          # the first of them, counted down first
field coin_meter 01 frames_off u8         # then the second
field coin_meter 02 pulses_owed u8        # the pulses still owed: insert_coin adds one a coin (coin_chute_variant pulses_owed)
struct coin_chute 30 rom       # a coin chute's entry: seat1_first_chute_entry (0114D4) and the three after it, 30 bytes apart; insert_coin reads it in R19
field coin_chute 00 switch_bit u32        # the chute's switch: its bit in switches_released (2-5)
field coin_chute 04 coin_sounds u32 seat_sound_counts       # the address of the seat's pending coin sounds (seat1_coin_sounds, seat2_coin_sounds): one more a coin
struct coin_chute_variant 14 rom   # the rest of a coin chute's entry, twice from its 8: the chute alone (chute_entry_offset 0) and the chutes shared (14); insert_coin goes on with the one chute_entry_offset picks
field coin_chute_variant 00 credits u32 seat_credits   # the seat's credits (seat1_credits, seat2_credits)
field coin_chute_variant 04 pulses_owed u32 coin_meter+2   # its coin meter's pulses owed (20E082, 20E085, 20E088, 20E08B; the second chute's meter counts the first's when shared)
field coin_chute_variant 08 counter u32 bookkeeping_count16   # the address of the bookkeeping's coin count for the chute (701F06-701F0C, bookkeeping_increment16)
field coin_chute_variant 0C coin_units u32 chute_unit_settings    # the address of the chute's coin units: first_chute_multiplier (20E611) or second_chute_multiplier (20E612)
field coin_chute_variant 10 event_code u8   # the byte insert_coin writes to C00074: 11 a first chute's coin, 10 a second's
local insert_coin 011260 R19 chute_entry coin_chute_variant   # "add.w R0, R19": past the entry's first 8 bytes, chute_entry_offset on
# The settings: a copy of them and its checksum, twice (load_settings checks each against its crc16)
struct settings_copy 3C        # the settings from settings_checksum (20E608) and their backup from backup_settings_checksum (20E644): the copy load_settings keeps reads its write count through R10
field settings_copy 00 checksum u16       # the crc16 of the 3A bytes after it (settings_checksum, backup_settings_checksum)
field settings_copy 02 write_count u16    # the EEPROM's saves (eeprom_write_count, backup_eeprom_write_count)
local load_settings 000268,000281 R10 settings settings_copy   # settings_checksum, backup_settings_checksum: the copy whose checksum held
# The seats' inputs
struct seat_inputs 4           # a seat's buttons and analog inputs for the coming frame: seat_1_buttons (20E121) and seat_2_buttons (20E126), which pack_seat_inputs writes, or on ISDN those the link brought (race link_buttons); queue_screen_inputs reads the four at once
field seat_inputs 00 buttons u8           # bit 6 START, 4-5 the shift up and down, 0-3 the others
field seat_inputs 01 wheel u8             # the wheel (analog_inputs inverted), the gas and the brake
field seat_inputs 02 gas u8
field seat_inputs 03 brake u8
local queue_screen_inputs 000C22 R11 seat_record seat_inputs   # on ISDN: the race_copy's link_buttons ("movea.b 2C[20[R10]], R11")
param queue_screen_inputs R12 io_chip
# The cabinet's LCD
local lcd_update 018A5B R11 lcd_scroll text_characters   # screen lcd_scroll: the text it scrolls in, a character every 5 frames
# ======== the board's registers batch M1's files print as numbers (I/O chips at C00000 and C80000, sound RAM, link board) ========
# The two I/O chips (315-5296), one for each screen and seat: C00000 the first's, C80000 the second's, a register each two bytes
C00000  io  IO_1_PORT_A  u8            # port A: the seat's buttons, active low (pack_seat_inputs: the high bits into 0-3, the low two into 4-5, the shift)
C80000  io  IO_2_PORT_A  u8
C00008  io  IO_1_PORT_E  u8         # port E: SERVICE (bit 0), TEST (1), the coin chutes (2-3), START (4), active low (read_switches_and_analog, pack_seat_inputs)
C80008  io  IO_2_PORT_E  u8
C0000A  io  IO_1_PORT_F  u8         # port F: bits 4-5 count as SERVICE and TEST too (read_switches_and_analog); the second chip's bit 7 is the EEPROM's data out (eeprom_read_word)
C8000A  io  IO_2_PORT_F  u8
C0000C  io  IO_1_PORT_G  u8                # port G: the cabinet LCD's data nibble (bits 4-7), its enable strobe (bit 3) and register select, and the DJ/MUSIC and << >> lamps (bits 0-1, port_g_outputs)
C8000C  io  IO_2_PORT_G  u8
C8000E  io  IO_2_PORT_H  u8              # the second chip's port H: the EEPROM's lines (bit 7 data in, 6 clock, 5 chip select; eeprom_set_lines sets bit 4 too)
C0001C  io  IO_1_CNT  u8                  # the chip's CNT outputs: bit 1 the screen on (6 on, 4 off), bit 2 the sound CPU out of reset (start_sound_program)
C8001C  io  IO_2_CNT  u8                  # the second chip's: bit 1 its screen on (86 on, 80 off)
C00060  io  ANALOG_BANK  u8               # the A/D converter's bank of inputs for the next reading (read_switches_and_analog: the other screen's turn)
# The bookkeeping in the sound board's shared RAM (the seats' credits and the block's checksum) and the sound program's start
701F00  io  BOOKKEEPING_CHECKSUM  u16     # the bookkeeping's checksum (701F02-701F7D: bookkeeping_checksum)
701F74  io  BOOKKEEPING_SEAT_1_CREDITS  u16   # seat 1's credits and coin units (write_bookkeeping_credits from seat1_credits; init_coins takes the credits back)
701F76  io  BOOKKEEPING_SEAT_1_BYTE  u16      # the halfword at seat1_bookkeeping_byte (bytes 4-5 of the seat's credit record), kept the same way
701F78  io  BOOKKEEPING_SEAT_2_CREDITS  u16
701F7A  io  BOOKKEEPING_SEAT_2_BYTE  u16
701FF0  io  BOOKKEEPING_BACKUP_SEAT_1_CREDITS  u16   # their copy in the bookkeeping's backup (7C on): seat 1's two halfwords (write_bookkeeping_credits, bookkeeping_clear_credits)
701FF2  io  BOOKKEEPING_BACKUP_SEAT_1_BYTE  u16
701FF4  io  BOOKKEEPING_BACKUP_SEAT_2_CREDITS  u16
701FF6  io  BOOKKEEPING_BACKUP_SEAT_2_BYTE  u16
701FFF  io  SOUND_PROGRAM_HOLD  u8        # the sound program's main loop waits while it is not 0 (sound_main_loop); start_sound_program clears it
# The link board (800000 on, a byte in each halfword; 801000 and 801002 its controls)
801000  io  LINK_BOARD_ON  u8            # 1 the link board on, 0 off (network_check, network_check_isdn)
801002  io  LINK_BOARD_FLAGS  u8          # bit 0 this program's flag, bit 7 the board's (network_check_wait_board waits for it)
800000  io  LINK_MACHINE_COUNT  u8        # the machines on the link, which the board writes there (network_check_join, network_check_wait_isdn); first the greeting V70
800002  io  LINK_MACHINE_NUMBER  u8       # this machine's number on the link (network_check_join, network_check_result)
800004  io  LINK_MASTER  u8               # this machine's role: link_master (network_check), read back as MASTER or SLAVE (network_check_result)
800006  io  LINK_RECORDS_SENT  u8         # FF once the program has written its records for the board (network_check, link_send_records)
80000C  io  LINK_BOARD_ERROR  u8          # the board's error byte (link_lost) and self-test result (network_check_four_ics)
80000E  io  LINK_SECOND_BUFFER  u8        # set: the records are at 800720, not 800020 (link_receive_records)
8006E1  io  LINK_ISDN_RECORDS_READY  u8   # ISDN mode: the board has the eight records at 800600 (link_take_master_settings)
80000A  io  LINK_ENTRIES_CLOSED  u8      # the host writes 1 when a race's entries close (race_entries_update) and when its own game starts (game_mode_play, not on ISDN)
# The text layer
31F736  io  MACHINE_ID_TEXT_CELL  u16     # the text layer's cell after THIS MACHINE ID IS (machine_id_text, row 14): network_check_result writes the board's machine number there
# ======== records reached through pointers (batch M2) ========
# A request of the screen's ring of tile pages to unpack (screen + C00 + 8 * place, 64 of them: unpack_queue;
# unpack_read_place and unpack_write_place the places): queue_tile_pages writes it ("mov.w R1, [R11+]" 010FF9,
# "movea.w 300000(R0), [R11+]" 011002), as does the unused queue_unpack_list ("mov.d [R10+], [R11+]" 010FC0),
# and unpack_queued_step takes it ("mov.w [R11+], R10; mov.w [R11+], R11" 010F22); census 208C00-218DFC
struct unpack_request 8
field unpack_request 00 source u32 packed_bytes   # the packed data (unpack's format)
field unpack_request 04 destination u32 unpacked_bytes   # where it unpacks in video RAM (a tile page: 300000 + 400 * page)
# A list of packed blocks for the unused unpack_list and queue_unpack_list: 8-byte entries, the packed data and
# where to unpack it ("mov.w [R10+], R12; mov.w [R10+], R11" 010F66), closed by a negative entry ("test.w [R10]"
# 010F75, 010FCA); nothing passes one (unpack_list carries its pointer in R12 across unpack: untyped)
struct packed_block_entry 8 rom
field packed_block_entry 00 source u32 packed_bytes
field packed_block_entry 04 destination u32
# Packed data for unpack and unpack_queued_step, read a byte at a time ([R10+]: the flag bits, the bytes copied, a
# match's offset and length; a match's halfword "mov.h [R10+], R2" 010E27, 010EEB); census ROM 109E0C-122979
elements packed_bytes u8
# A list of tile pages for unpack_tile_pages and queue_tile_pages: 32-bit entries, the page in the top byte (the
# page at 300000 + 400 * page) and the address of its packed data below, closed by a negative entry ("test.w
# [R10]" 010FA1, 011011; "mov.w [R10+], R0" 010F7A, 010FE9); in the program ROM (boot_tile_pages_5d,
# background_tile_page_lists' lists) or put together in work RAM (race_background page_list); census
# 01AD34-210BC0 (unpack_tile_pages carries its pointer in R12 across unpack: untyped)
elements tile_page_entries u32
# A string for the text layer (print_text_layer; the unused print_text_layer_list and the two erases): the low
# half of the first cell's address ("mov.h [R19+], R18" 01187B, after "movea.b 31F000, R18"), the attribute
# ("mov.b [R19+], R9; shl.h #8, R9" 01187E), then the characters closed by 0 ("mov.b [R19+], R9" 011884,
# 01188E: text_characters); census ROM 00DF84-00E009 (network_check_text and the link's texts). The unused
# print_text_layer_halfwords reads the same two fields, then characters of a halfword each (0118E2, 0118EF)
struct text_layer_record 3 rom
field text_layer_record 00 cell u16             # the first cell's address in video RAM, less 310000
field text_layer_record 02 attribute u8         # the cells' high byte (their palette)
field text_layer_record 03 characters u8[]      # the cells' low bytes, closed by 0
local print_text_layer 01187E R19 text_record text_characters
local print_text_layer_list 011868 R19 text_record text_layer_record   # what print_text_layer hands back: the list's next string
elements text_halfword_characters u16           # print_text_layer_halfwords' characters, ORed with the attribute
local print_text_layer_halfwords 0118DC R19 text_record text_halfword_characters
local network_check_blink_text entry R20 current_object text_layer_record   # the text record its caller points R20 at (not an object): its cell and attribute, then
local network_check_blink_text 00D702,00D708 R20 current_object text_characters   # its characters, closed by 0
# A string draw_text draws in sprites: its place (32 bits, x in the low half and y in the high half: "mov.w
# [R19+], R3; rot.w #10, R3" 011A62), the attribute or-ed into the sprites' ("or.h [R19+], R5" 011A6F), then the
# characters closed by 0 ("movea.b 6[R19], R18" 011A32, draw_text_sprites: text_characters); census
# 00D04C-212C80: the program ROM's (the HUD's, the credits line's, staff_credits_texts) and work RAM's (the
# objects' own: lap_timer_update's at 80, name_entry_update's at 9A and A4)
struct sprite_text_record 6 rom
field sprite_text_record 00 x u16            # place's low half: staff_credits_texts end at a negative one (staff_credits_code_show "test.h [R18]" 0018FA)
field sprite_text_record 02 y u16            # the place's high half: draw_text reads the two as one word ("mov.w [R19+], R3" 011A62, then "rot.w #10, R3") and turns it round (y, x)
field sprite_text_record 04 attribute u16
field sprite_text_record 06 characters u8[]
local draw_text 011A32 R18 text text_characters
# A block of colours for upload_palette (queue_palette's record): its place in the screen's palette RAM (the low
# half of the address, "mov.h [R19+], R18" 011624), its length in bytes ("movz.hw [R19+], R9; shl.h #FB, R9"
# 011627: 32-byte blocks), then the colours ("mov.d [R19+], [R18+]" 01162E-01163A: palette_colours); census ROM
# 03153C-1598C8 (boot_palette_9e00, scene_palettes' records)
struct palette_block 4 rom
field palette_block 00 place u16
field palette_block 02 length u16
field palette_block 04 colours u16[]
local upload_palette 011627 R19 colour_block palette_colours
# A list of colour blocks for upload_palette_list (queue_palette_list's record): its length in bytes ("mov.w
# [R19+], R9; shl.w #FD, R9" 011652: 8 a block), then the blocks (palette_block_entry); census 01AD64-214B28:
# the program ROM's and work RAM's (a palette_fade's own at 28)
struct palette_block_list 4 rom
field palette_block_list 00 length u16
field palette_block_list 02 length_high u16   # the length's high half, 0 in every list: upload_palette_list reads the two as one word ("mov.w [R19+], R9" 011652), where a fade's own list (palette_fade upload_length, "mov.h #8, 28[R21]" 01858E) has only its low half written
field palette_block_list 04 entries palette_block_entry[]   # the list's blocks, its length's bytes of them (upload_palette_list)
# One of them: the colours' address ("mov.w [R19+], R17" 011659), their place in the palette (the low half of the
# address, "mov.h [R19+], R18" 01165C) and how many blocks of 16 colours ("movz.hw [R19+], R8" 01165F; the copy
# reads the same 32 bytes for each: "mov.d [R17], [R18+]" 011662 to "mov.d 18[R17], [R18+]" 011670)
struct palette_block_entry 8 rom
field palette_block_entry 00 colours u32 palette_colours
field palette_block_entry 04 place u16
field palette_block_entry 06 blocks u16
local upload_palette_list 011652 R19 colour_list palette_block_entry
# The palette fade lists' entries: after the list's length (palette_fade_list), "mov.w [R19+], R18; divu.w #C, R18"
local start_palette_fades 0184D0 R19 fade_list palette_fade_entry
local road_surface_fade_back 0184EC R19 fade_list palette_fade_entry
local race_background_fade_palettes 01850B R19 fade_list palette_fade_entry
# int_vector_40 puts R25 back from the stack ("pop R25" 03F53C) after the two screens' mixers: the screen
# block it interrupted, whose skip_scroll_update and index it reads next
local int_vector_40 03F53C R25 screen screen
# The board's registers these files reach (batch M2). The two I/O chips (315-5296), C00000 for screen 1 and its
# mirror C80000 for screen 2, a register every other byte: ports A-H at 00-0E, CNT at 1C, the ports' directions
# at 1E (runtime/src/io.c)
C00006  io  IO_1_PORT_D  u8       # outputs (update_lamps from port_d_outputs): the coin meters, the CHECK POINT, START and RACE LEADER lamps, the wheel motor
C0000E  io  IO_1_PORT_H  u8       # outputs: the external tile banks, two bits each (int_vector_40 from tile_banks)
C0001E  io  IO_1_DIRECTION  u8    # a bit a port, set for an output: C8, ports D, G and H (init_io_chips)
C80006  io  IO_2_PORT_D  u8       # screen 2's seat: as IO_1_PORT_D (port_d_outputs[1])
C8001E  io  IO_2_DIRECTION  u8    # C8, as chip 1's
# The interrupt controller (D00000): IRQ 0 the VBLANK, 1 its end, 2 the sound CPU, 3 timer 0, 4 timer 1
D00007  io  IRQ_ACKNOWLEDGE  u8        # the pending interrupts: a write keeps only the bits it sets (FE takes IRQ 0, FD 1, FB 2, F7 3, EF 4; 0 all, boot)
D00008  io  IRQ_TIMER_0  u16           # timer 0's count, which starts it (int_vector_40 and int_vector_43 for the LCD; second_task 39)
D0000A  io  IRQ_TIMER_1  u16           # timer 1's count, which starts it (the link's: int_vector_44 1 or 168; second_task 1)
# Video RAM's registers and the sprite chip's
31FF00  io  VIDEO_CONTROL  u16         # the video control register: bit 9 flips the screen (flip_screen), bits 12-15 cleared by reset_tile_layers (init_video 0800, video_control_default); the first of the 72 halfwords int_vector_40 sends from video_registers
31FF05  io  VIDEO_LINE_CONTROL_HIGH  u8   # the high byte of the line control register (31FF04): the line tables' place in video RAM, 400 a step, which vblank_update_scrolls moves every frame (bits 2-3)
500000  io  SPRITE_RENDER_REQUEST  u16  # the sprite chip's first control register: bit 0 draws a sprite frame, bit 1 erases; init_sprite_chip writes 0 (sprite_control_mode) and leaves it to the automatic mode (500006 = 0: every frame)
# The link board (800000): its memory a byte in each halfword, then its registers at 801000
800010  io  LINK_MESSAGE_KIND  u8      # in ISDN mode the kind of the board's message, cleared as it is taken (int_vector_44: 3 a message of race records); the board's greeting Z80 starts here at the network check
# The bookkeeping in the RAM shared with the sound board (the block 701F02-701F7D, its backup 7C on)
701F10  io  BOOKKEEPING_TOTAL_TIME  u16   # TOTAL TIME, in seconds, its low halfword (count_total_time; game_mode_play's game_start_time); its backup at 701F8C. The bookkeeping is kept as halfwords (bookkeeping_checksum sums it by halfwords): a word two of them, the low one first
701F12  io  BOOKKEEPING_TOTAL_TIME_HIGH  u16   # its high halfword
# ======== records reached through pointers (batch M3) ========
struct depth_list 4        # a depth layer's list of sprite groups (screen depth_lists: screen + 5000 + 4 * layer, 416 layers; the object's depth_layer, the segment's projected_segment depth_layer): draw_object and the road rows link each group in at its head, finish_sprite_list chains the layers into the sprite list and empties them
field depth_list 00 head u16             # a jump to the layer's newest group (8000 | its first entry's number), which jumps on to the one drawn before it; 0: the layer is empty (draw_object 00EB1C "movz.hw [R11], R2", 00EB3A "mov.h R12, [R11]"; finish_sprite_list 00F3D6 "xch.h R2, [R11]")
field depth_list 02 tail u16             # the low half of the address of the oldest group's last entry, where finish_sprite_list writes the jump on to the next layer (draw_object 00EB11 "mov.h R10, 2[R11]" into an empty layer; finish_sprite_list 00F3E4 "mov.h 2[R11], R10")
# A list of the DJ's remarks (dj_remark_lists): the routines car_radio_update runs one at a time through
# routine_list_jump (019286 "mov.w [R10+], R0"), closed by 0 (019289 "test.w [R10]")
elements remark_routines u32
# A list of objects to start (stage_background_object_lists for race_background_start_objects, ending_actor_lists and unfinished_ending_actor_count
# for race_car_start_ending): a 32-bit count, then these pairs, read with [R10+] (017BE7, 017BEC; 0146FA, 0146FF)
struct object_list_pair 8 rom
field object_list_pair 00 handler u32           # -> the new object's handler (4)
field object_list_pair 04 data u32              # -> its list_data (80; goal_actor script)
# A list of handlers to start objects with (start_object_list: the object_handlers_* tables, after their 32-bit count),
# read with "mov.w [R10+], 4[R21]" (011E35)
elements object_handlers u32
# Sprite RAM entries 2 and 3 (the sprite list's start: entry 2 jumps to screen 1's list, which ends with a jump to entry
# 3, which jumps to screen 2's, which ends with a jump to entry 4, the end): finish_sprite_list writes them from its
# sprite_list_switches record (00F4C0, 00F4C8): 8700/8D00 (screen 1's halfway copies) or 8A00/8400 (its lists) into
# entry 2, 9A00/9400 or 9700/9D00 into entry 3
400020  io  SPRITE_SCREEN_1_LIST_JUMP  u16
400030  io  SPRITE_SCREEN_2_LIST_JUMP  u16
# ======== records reached through pointers (batch M4) ========
# A control's range in the settings (volume_ranges, 20E638 on: six controls, two bytes each), which the
# VOLUME ADJUSTMENT sets and the inputs are scaled between: test_mode_volume_adjustment_select 01CE82
# "mov.b R0, [R10+]" the position with bit 0 cleared, 01CE88 with it set; test_mode_volume_adjustment_adjust
# 01CEA7-01CEB6 "cmp.b R0, [R11]" each end widened to take the position; test_mode_input_test_draw 01D17A
# "movz.bh [R13+], R2" the low end, 01D185 the high end (read_switches_and_analog scales between them)
struct volume_range 2
field volume_range 00 low u8
field volume_range 01 high u8
# A coin/credit setting's description (coin_setting_descriptions by coin_setting), read a byte at a time:
# pairs of coins and credits ("movz.bw [R11+], R0" 01DE25, 01DE0D), closed by 0, or by a negative byte and a
# text (FREE PLAY, MANUAL SETTING) closed by 0 (01DE4E "mov.b [R11+], R0")
elements coin_setting_description u8
# An item of a ring of the turntable's scenery (its group's item_list, closed by a negative angle): its angle
# round the turntable (005854 "movz.hw [R10+], R0"), the ring's radius (0057E4 "movz.hw [R10+], R2") and its
# height (00580F "movs.hw [R10+], R2"); turntable_scenery_show skips the radius and height of an item on the
# near side (00584A "add.w #2, R10") and keeps the next item's place across turntable_draw (005830, 005835)
struct turntable_scenery_item 6 rom
field turntable_scenery_item 00 angle u16
field turntable_scenery_item 02 radius u16
field turntable_scenery_item 04 height s16
# A screen's lamps among the game's variables: GAME_VARIABLES + 4 * the screen's index ("movea.w [R24](R0),
# R10" with R0 the index: game_mode_play 003014, 003077, 0031F8, 0033E9), the two screens' lamps being 4 bytes
# apart (checkpoint_lamp 20E0C0 and checkpoint_lamp_2 20E0C4, leader_lamp 20E0C8 and leader_lamp_2 20E0CC):
# each lamp four bytes, its state, blinks, period and timer, which game_mode_play sets 32 bits at a time
# ("mov.w #2, C0[R10]", "mov.w #8, C8[R10]"): each byte has its field, and the four together theirs
# (checkpoint_all, leader_all), which those 32-bit stores write
struct screen_lamps CC
# screen_lamps C0: the checkpoint lamp's four bytes, which game_mode_play and entry_invitation_step set at once (the C writes its four bytes)
field screen_lamps C0 checkpoint u8           # its state (checkpoint_lamp, checkpoint_lamp_2)
field screen_lamps C1 checkpoint_blinks u8    # checkpoint_lamp_blinks: FF blinks for good
field screen_lamps C2 checkpoint_period u8    # checkpoint_lamp_period
field screen_lamps C3 checkpoint_timer u8     # checkpoint_lamp_timer
# screen_lamps C8: the race leader lamp's four bytes (the C writes its four bytes)
field screen_lamps C8 leader u8               # its state (leader_lamp, leader_lamp_2)
field screen_lamps C9 leader_blinks u8
field screen_lamps CA leader_period u8
field screen_lamps CB leader_timer u8
# The board's registers the test mode and the scenes reach by their address. The second screen's I/O chip
# (C80000) and mixer (690000) are the first's (C00000, 610000) for screen 2, register for register
610040 io MIXER_1_OFFSET_0_RED u32    # mixer register 40 (with 42 in the 32 bits): colour offset 0's red and green (step_screen_fade fades through 40, 42, 44); test_mode_start clears 40-4B 32 bits at a time
610044 io MIXER_1_OFFSET_0_BLUE u32   # register 44, colour offset 0's blue, with 46 (the second colour offset's red, as MAME's segas32 mixes them)
610048 io MIXER_1_OFFSET_1_GREEN u32  # registers 48 and 4A, the second colour offset's green and blue
690040 io MIXER_2_OFFSET_0_RED u32    # the same registers of screen 2's mixer
690044 io MIXER_2_OFFSET_0_BLUE u32
690048 io MIXER_2_OFFSET_1_GREEN u32
609C00 io BACKGROUND_COLOUR_1 u16     # the background colour of screen 1's palette: the test mode's blue (733, test_mode_set_up_colours, test_mode_crt_test_grid_run), black for the C.R.T. TEST (test_mode_crt_test)
689C00 io BACKGROUND_COLOUR_2 u16     # ... and of screen 2's
701F06 io BOOKKEEPING_CHUTE_A_COINS u16   # COIN CHUTE A: the coins of seat A's first chute (insert_coin, test_mode_bookkeeping_draw_totals)
701F20 io BOOKKEEPING_LONGEST_PLAY u16    # LONGEST play, in seconds (game_mode_play through bookkeeping_set16)
701F22 io BOOKKEEPING_SHORTEST_PLAY u16   # SHORTEST play
D80000 io RANDOM_NUMBER u8         # the board's random numbers (bar_picture_bar_start: a byte each for speed_x and speed_y)
# ======== records reached through pointers (batch M5) ========
# A car's hit box in the screen's list from screen + 514 (after the count, screen hit_box_count at 510), 18 bytes
# each car of the race: player_car_build_hit_boxes writes the player (012275 "mov.h R1, [R11+]") and
# player_car_write_hit_box the rest (0122AD-0122DF); screen own_hit_box points at the screen's own car's
# (012270 "mov.w R11, 500[R25]"), which road_row_hit_check, player_car_check_car_hits and traffic_hit_check read
struct car_hit_box 12
field car_hit_box 00 player u16            # the car's player (012275)
field car_hit_box 02 record u32 race       # its race_copy record, 20FC00 + 80 * player (0122AD "mov.w R12, [R11+]")
field car_hit_box 06 first_segment u16     # the record's segment (0122B0 "mov.h R1, [R11+]")
field car_hit_box 08 last_segment u16      # 4 segments on (0122B3-0122B6)
field car_hit_box 0A along_start u16       # the record's segment_fraction plus the model's box (car_hit_box_sizes, 0122CA-0122D3)
field car_hit_box 0C along_end u16
field car_hit_box 0E across_start u16      # the record's road_x plus the model's box (0122D6-0122DF)
field car_hit_box 10 across_end u16
# An entry of a model's crash table (car crash_table, right after the model's crash_physics record), 16 bytes an
# entry by the impact (player_car_update 007D8B "and.h #1F0, R5", 007D90 "add.w R5, R19"; 007E91, 007E96)
struct crash_entry 10 rom
field crash_entry 00 animation u16[2]      # the crash animation by the side hit (007F04 "movz.hw 0[R19](R8), R9", plus player_car_view_height) -> object animation
field crash_entry 04 speed_factor u16      # a scenery hit's: the speed lost times it / 256 (007D93 "movz.hw 4[R19], R8") -> speed_change
field crash_entry 06 push u16[2]           # a scenery hit's sideways push by the side hit (007DAB "mov.h 6[R19](R8), CE[R20]"); a car's or the traffic's hit takes push[1] as its push factor (007EC3 "movs.hw 8[R19], R9")
field crash_entry 0A bounce_speed u16      # 007DB3, 007EDD "mov.h A[R19], CC[R20]" -> bounce_speed
field crash_entry 0C hit_sound u8          # the sound at the hit (007EFA "movz.hw C[R19], R0", then request_sound)
field crash_entry 0D crash_sound u8        # the sound 10 frames on (007EED "mov.b D[R19], 134[R23]": car crash_sound)
field crash_entry 0E car_speed_factor u16  # a car's or the traffic's hit: the speeds' difference times it / 256 (007E99 "movz.hw E[R19], R8")
local player_car_update 007E0F R10 other_record race   # the other car's race_copy record (007E0F "movea.b 1C00[R24](R10), R10": 20FC00 + 80 * its player)
# The start of a stage's course (stage_courses; car course): the stage command (-4, then the stage's level and
# number, as player_car_build_segment reads it) and the first run (its length, pitch and heading steps, width code
# and road event); player_car_start_course takes the first road width from it (00FCDF "movz.bw 8[R11], R0").
# Census ROM 03CCA0-03EA5C: all 31 start FFFC, the level 0-5, the stage 0-1E, width code 5 (4 for stage 1C)
struct course_start 0A rom
field course_start 00 stage_command s16
field course_start 02 stage_level u8
field course_start 03 stage u8
field course_start 04 run_length s16
field course_start 06 pitch_step s8
field course_start 07 heading_step s8
field course_start 08 width_code u8
field course_start 09 road_event u8
# A place of a car's part for one of the car's views (race_car_rider_places by model: 16 bytes a view, the driver's,
# the passenger's and the two sprays' places; race_car_draw_part 009C77 "add.w R4, R11" by the view, 009C7A "test.w
# [R11]": none when its 32 bits are 0, 009C7E-009C81 "add.h [R11+], R17/R18")
struct car_part_place 4 rom
field car_part_place 00 x u16
field car_part_place 02 y u16
local race_car_draw_part 009C77 R11 places car_part_place   # the place for the car's view
# A place in the order the cars passed a checkpoint (screen checkpoint_order, screen + 390, 8 a checkpoint):
# checkpoint_board_update 00CC57 "movea.w 390[R25](R0), 14[R20]" (passing_order), 00CC5F "movz.bw [14[R20]], R21"
struct checkpoint_pass 1
field checkpoint_pass 00 player u8
local player_car_drive 00A44A,00A4B9 R11 segment_record road_segment   # the next segment (00A44A "mov.w R12, R11"), or the race_copy's (00A4B9 "add.h R6, R11", ISDN)
local player_car_place_view 00A68D,00A74B R11 segment_record road_segment   # moved by the view's shift (00A68D "and.h #AFFF, R11"), then the next (00A74B)
C00074  io  EVENT_CODE  u8                 # not mapped by the board: the game writes a code of what happened there, bit 1 the seat: a checkpoint passed 8 + 2 * index + the stage level's parity (lap_timer_update), a game's start 1/3 (game_start_c00074_bytes) and end 0/2 then 8/A, a coin (insert_coin), 13 0 0 1F at start-up (initialise_game)
# ======== records reached through pointers (the merge) ========
# The eight sprite list buffers in sprite RAM (init_sprite_lists writes an end, FFFF, at each): each screen's two
# lists, which the frames take in turn (sprite_list_buffers), and their halfway copies 3000 on (the entries
# sprite_list_switches makes entries 2 and 3 jump to: 8400 and 8A00 screen 1's lists, 8700 and 8D00 their
# copies; 9400, 9A00, 9700 and 9D00 screen 2's)
404000  io  SPRITE_LIST_1_A  u16
407000  io  SPRITE_LIST_1_A_HALFWAY  u16
40A000  io  SPRITE_LIST_1_B  u16
40D000  io  SPRITE_LIST_1_B_HALFWAY  u16
414000  io  SPRITE_LIST_2_A  u16
417000  io  SPRITE_LIST_2_A_HALFWAY  u16
41A000  io  SPRITE_LIST_2_B  u16
41D000  io  SPRITE_LIST_2_B_HALFWAY  u16
# ======== R27 and R28 as locals: what the functions keep in them ========
param race_car_draw_spray R27 spray race_car_spray                     # the spray's 16 bytes in the race car (+C0 or +D0): its frame at C, which sides at D, its kind at E, its effect at 8
param note_road_crest R27 crest_y
param note_road_crest R28 crest_layer
param road_row_hit_check R27 hit_kind                    # into the car's object (player_car hit_kind): 0 a crash, 3 slowed
local car_select_entries_run 005F85 R27 lcd_text_end lcd_characters   # where the string move left off in the LCD's text
local race_car_draw 0098FB,00991C R27 first_rider race_car_rider
local race_car_draw 009900,00991C R28 second_rider race_car_rider
local race_car_draw 0099D7,0099E9,0099F3 R27 spray
local race_car_draw 0099DC,0099E9 R28 other_spray
local network_check_toggle_memory_text 00D732,00D741 R27 next_cell text_layer_cells
local draw_object_smoothed 00F160,00F1C3,00F1C6,00F1C9,00F1CF R27 sprite_place
local draw_object_smoothed 00F15C,00F189,00F18C,00F21C,00F308 R28 previous_place
local draw_object_smoothed 00F227,00F2FF R27 entry_word     # the halfword that goes into the sprite entry and its copy: the piece's attributes, then the palette
param draw_object_smoothed R12 last_frame
param draw_object_smoothed R14 last_size_step
local road_row_draw 00F625,00F8CD,00F8D7 R27 sprite_place
local road_row_draw 00F8F0,00F8F6,00F8FC R27 sprite_place sprite_place_words   # the blank places after the last item, a word at a time
local road_row_draw 00F61E,00F635,00F644,00F647,00F8D2,00F8DA R28 previous_sprites sprite_words   # the sprite list (in the sprite RAM, or the one being put together in the work RAM), or 100000 in the program ROM when there is none to step from (board() reads those as the bus does)
param road_row_draw R12 last_piece
param road_row_draw R14 step_height
local road_row_pair_draw 00F973,00FC7E,00FC88 R27 sprite_place
local road_row_pair_draw 00FCA1,00FCA7,00FCAD R27 sprite_place sprite_place_words
local road_row_pair_draw 00F96C,00F983,00F992,00F995,00FC83,00FC8B R28 previous_sprites sprite_words
param road_row_pair_draw R12 last_piece
param road_row_pair_draw R14 step_height
local player_car_project_road 01015F,0101A1,0101CE,0101DC,0101FB R27 segment_y
local player_car_project_road 010166,010185,010202 R28 segment_depth
local player_car_project_road 01023D R27 crest_y
local player_car_project_road 010240 R28 crest_layer
param player_car_project_road R12 matrix_yx
param player_car_project_road R14 matrix_yz
local start_object 011D4A R27 free_index                 # the search of the slots' bytes: the first free one's index (7C: none), and its byte
local start_object 011D4A R28 free_flag object_slot_flags
local reserve_object_slot 011DF2 R27 free_index
local reserve_object_slot 011DF2 R28 free_flag object_slot_flags
local fork_sign_hit_check 0122E3 R27 hit_kind
local road_row_crash_check 0122E8 R27 hit_kind
local road_row_pair_crash_check 0123AF R27 hit_kind
local road_row_pair_crash_check 012446 R28 mirrored_across_start
local road_row_pair_crash_check_unflipped 01248C R27 hit_kind
local road_row_pair_crash_check_unflipped 012529 R28 mirrored_across_end
local fork_branch_draw 013E4A R27 segment_position
local fork_branch_draw 014022 R27 depth_list depth_list
local fork_branch_draw 014037 R28 layer_head
local fork_branch_sprite 014072 R27 piece_attributes   # "mov.h 2[R26], R27": the first piece's word 0, its attributes (the sprite word is read at 014076)
local road_surface_halfway_lines 016EAE R27 points   # points_buffer, the half of the points buffer this frame wrote
local road_surface_halfway_lines 016EC3,016ECF,016EDC,016F09,016F15,016F21 R27 points road_points
local road_surface_halfway_lines 016EB5 R28 last_frame_points   # the other half's (points_buffer ^ 60)
local road_surface_halfway_lines 016EC9,016ED2,016EE8,016F0C,016F18,016F24 R28 last_frame_points road_points
local road_tiles_change_update 0172DE,017405 R27 target_end
local road_tiles_change_update 0172DE,017405 R28 source_end
local lcd_update 018A91,018AC2 R27 text_end lcd_characters
local test_mode_memory_test_blink 01CC85,01CC94 R27 next_cell text_layer_cells
local test_mode_set_up_colours 01EFAE,01EFBB,01EFFC R27 palette_place

# ======== memory reached through pointers (the pilot of the round) ========
elements object_words u32 ram                   # an object's 0x100 bytes as words: start_object clears them (011D6A-011DC7, "mov.w R0, [R26+]" and the like)
elements object_slot_flags u8 ram              # the object slots' bytes (object_area slots) from the one a search found: start_object and reserve_object_slot set it (011D54, 011DFB "not.b #0, [R28]")

# ======== memory reached through pointers (batch N1) ========
# race/link.c. The text layer's cells (31F000-31FFFF in the video RAM, 64 a row: a halfword each, the character and its
# colour), a cell at a time: network_check_blink_text 00D710 "xor.h R18, [R19+]" (from 31F000 or the text record's
# cell), network_check_clear_status_line 00D724 "mov.h #0, [R0+]" (row 24), network_check_toggle_memory_text 00D741
# "xor.h R26, [R27+]" (row 24 from column 8)
# Each player's car number, a byte each (car_numbers, 20E030-20E037): link_take_master_settings 00D902 "mov.b [R10],
# [R11+]" from each race_copy record's car_number
elements player_car_numbers u8 ram
# The players of a race in race order, a byte each (race_order to race_order_4_7, bytes 20-27 of a race record):
# race_progress_update 00DB99 and 00DBBD "movz.bw [R13+], R2" (the host's record), its sort 00DC83 "movz.bw [R16+],
# R6", 00DCBD "mov.b R6, -2[R16]", 00DCC7 "mov.b R4, [-R16]" (the screen's own record), 00DD04 "movz.bw [R13+], R2";
# players_not_ready 00DEE3 "movz.bw [R0+], R2"
# The record_serial of each player's race_copy record a screen has seen, a byte a player (screen name_entries_seen,
# 328-32F): course_records_update 00DF0B "cmp.b [R10+], 11[R11]", 00DF12 "mov.b 11[R11], -1[R10]"
elements seen_record_serials u8 ram
# A race record's words, two at a time: link_receive_records 00E854-00E8D0 "mov.d [R10+], [R11+]", 32 a pass (two records; alone
# this machine's two, 20FB00, in ISDN mode the eight at 21E000; into race_copy, 20FC00). What goes into race_copy goes
# through the instruction's temporary (block_00-block_F8), which the types do not follow: those writes stay mem_write32
elements race_record_words u32 ram
# A race record's bytes as the link board's memory holds them (a byte in each halfword): link_copy_records_in 00E67C
# on "movt.hb [R10+], [R11+]", the first 70 of each record and then 11 to the next (into 20FC00, or 21E000 in ISDN mode)
elements race_record_bytes u8 ram
# A course's record in the backup, the sound program's RAM (701F32, ten of them, and the copy at 701FAE): as
# course_record, the car's model, the name's three letters and the time; course_records_update 00DF4D "mov.w [R12],
# [R13+]" copies the model and the name as one word, 00DF51 "mov.h 4[R12], [R13+]" the time. Kept as halfwords, as
# the bookkeeping is (bookkeeping_checksum sums it by halfwords, the link moves the records by halfwords into the race
# records, where the race's fields read them: a demo race's racer_copy segment, attract.txt frame 1657): the model
# and the first letter are the first one's two halves, as the V70 holds them on any processor
field backup_course_record 00 model_and_initial u16   # the car's model (its low byte: negative, none) and the name's first letter
field backup_course_record 02 name_rest u16           # the name's other two letters
# The link board's race records link_receive_records hands to link_copy_records_in (800020, or 800720): a device's
# memory, untyped
local link_receive_records 00E660,00E677 R10 source
# players_not_ready: the host's racer_count (1F), then the players in race order after it
local players_not_ready 00DED9 R0 race
local players_not_ready 00DEE0,00DEE3 R0 race race_order_players
# ======== memory reached through pointers (batch N2) ========
# The video side (video.c, palettes.c, unpack.c, text.c, main.c, interrupts.c): what their pointers reach.
# The screen's block: the two rings of sound requests after their places (queue_sound and the unused
# request_second_sound fill them; send_sound_requests "mov.b [R0](R1), 700700[R10]" 03F8EE, 03F90E sends one a frame)
field screen 802 sound_queue u8[20]                 # the requests of the ring of 32 (sound_queue_read, sound_queue_write)
field screen 842 second_sound_queue u8[20]          # the second ring's (second_sound_queue_read, second_sound_queue_write)
elements stage_length_list u16 ram                  # the screen's stage_lengths, then branch_road_length (14A), which init_screen writes in turn ("mov.h R8, [R11+]" 013DB6, from 700[R25])
elements palette_upload_queue u32 ram               # the screen's queue of palette uploads at 900, as queue_palette_upload reads it ("cmp.w #80, [R18]", "mov.w R19, [R18](R9)" 0115E3): [0] the count (palette_upload_count), [1]-[80] the uploads (a colour block; a list with bit 31); upload_queued_palettes walks it ("mov.w [R10+]" 0115F0, 0115F3)
local upload_queued_palettes 0115F0,0115F3 R10 upload_queue palette_upload_queue   # past the count: the uploads (its 0115EB line keeps palette_upload_count)
elements mixer_colour_offsets u16 ram               # mixer_values' colour offset 0 (registers 40, 42, 44: red, green, blue, at 1A0 of the screen), which step_screen_fade sets to the fade's level for the channels fade_channels has ("mov.h R9, [R19+]" 011725)
local step_screen_fade 01170E R19 mixer_register     # screen + 19F: colour_offset_mode ("mov.b #C0, [R19+]" 011713); the line with 011713,011725 types the colour offsets after it
elements palette_fade_colours u16 ram               # a palette fade's 16 colours as they step (the object's 34-53): palette_fade_prepare "mov.h R0, [R12+]" 0185EF, palette_fade_step "add.h R0, [R11+]" 0186BA; queued through the object's record at 28
elements palette_fade_differences s8 ram            # for each of the fade's 16 colours, how far its red, green and blue still are from the second palette's (the object's 54-83): palette_fade_prepare "mov.b R2, [R13+]" 018601, palette_fade_step "test.b [R10]" 01867B, a step a frame toward 0
elements background_fades u32 ram object            # the palette fades a race_background_fade_watch keeps, a word each from its 80: race_background_fade_palettes "mov.w R21, [R17+]" 01853B; race_background_fade_watch_update "mov.w [R10+], R1" 018556, 0 once one has ended ("mov.w #0, -4[R10]" 018568)
elements unpacked_bytes u8 board                    # what unpack and unpack_queued_step write a byte at a time, a tile page in video RAM (300000 + 400 * page; census 300400-317BFF): a packed byte ("mov.b [R10+], [R11+]" 010DCC, 010E6C) or one a match copies from further back in it ("mov.b [R2+], [R11+]" 010E1D); unpack_list, which takes any address, is unused
elements text_layer_cells u16 board                 # cells of the text layer (31F000-31FEFF, 64 a row): the character in the low byte, the attribute (palette) in the high byte; print_text_layer "mov.h R9, [R18+]" 01188B, print_hex_digits "mov.h R0, [-R11]" 011950, the unused erases and print_text_layer_halfwords
elements text_layer_font_words u16 board            # the text layer's characters in video RAM (318000 on, 32 bytes each), by the video RAM's 16-bit words: four 4-bit pixels a word, a row of eight two of them (load_shadowed_text_font "rvbyt R6, [R18+]" 011854 writes a row at a time, its two words)
elements boot_register_values u8 rom                # the bytes the reset copies a byte at a time ("mov.b [R10+], [R11+]" 000026): 0000A4-0000B3 to E00000 (which the board does not map), 0000B8-0000C3 to the interrupt controller (D00000)
elements cleared_ram_words u32 ram                  # work RAM the reset clears 8 bytes at a time ("mov.d R0, [R10+]" 000554 on: 21E000-21E3FF, 21F000-21FFFF, the game's variables 20E000-20FFFF), and second_task the variables again after the test mode (0007C2)
elements port_output_bits u8 ram                    # a seat's image of an I/O chip's output port (port_d_outputs, port_g_outputs: a byte each screen): update_button_lamps sets the DJ/MUSIC and << >> lamps ("mov.b [R11], R0" 03FA54); the output test reads and flips an output's bit in the 32 bits from its byte ("test1 R0, [R12]" 01D4B2, "not1 R0, [R11]" 01D4DC; the bit below 8), which the C reads and writes as the four bytes they are, in their order and at any address (a 32-bit access from 20E093 or 20E095 before)
elements vblank_count u8 ram                        # the vertical blanks a screen's task has had (screen_1_vblanks, screen_2_vblanks by screen_vblank_counters): int_vector_40 "inc.b [R0]" 03F618
# A 32-bit value of the bookkeeping (in the RAM the sound program shares, 701F02-701F7D) and its backup 7C on:
# count_total_time adds a second to TOTAL TIME ("cmp.w #FFFFFFFF, [R7]", "inc.w [R7]", "inc.w 7C[R7]" 011301-011310)
# The tile layers' scroll registers in video RAM (MAME's segas32_v.cpp: 31FF10 + 8 * layer the x scroll, its
# fraction in the first halfword and its integer part in the second, then the y scroll), which
# vblank_update_scrolls writes from video_registers for NBG0 or NBG1 and NBG2 or NBG3 (+ 8 * the screen's index)
31FF10 io NBG0_SCROLL_X u16    # NBG0's x scroll, and NBG1's 8 bytes on (vblank_update_scrolls by the screen's layer), by the video RAM's 16-bit words: the 16.16 the game keeps, the fraction's word first, which the chip does not read, then the pixels' (31FF12: the video's register 0x12)
31FF14 io NBG0_SCROLL_Y u16    # NBG0's y scroll, and NBG1's 8 bytes on, the same way (the pixels at 31FF16)
31FF20 io NBG2_SCROLL_X u16    # NBG2's x scroll, and NBG3's 8 bytes on, the same way (the pixels at 31FF22)
31FF24 io NBG2_SCROLL_Y u16    # NBG2's y scroll, and NBG3's 8 bytes on, the same way (the pixels at 31FF26)
# ======== memory reached through pointers (batch N3) ========
# The sprite lists in sprite RAM (400000-41FFFF), a halfword at a time: entries of 8 words, as MAME's segas32_v.cpp
# reads them: word 0 the command and its attributes (bits 15-14: 00 a sprite, 01 a clip, 10 a jump to entry n,
# 8000 | n, 11 the end; bit 7 flips it up and down, bit 6 across: the flags' bits 6-7), 1 the source's height and
# width, 2 the height on the screen (and bits 16-19 of the graphics' address), 3 the width on the screen (bit 11
# screen 2's sprite layer, sprite_screen_bit; bits 13 and 15 the bank), 4 y, 5 x, 6 the graphics' offset in the
# bank, 7 the palette and priority. Every word goes into the list and its halfway copy 3000 bytes on (element
# 6144: the list the board shows between two frames, init_sprite_lists): put_object_sprites 00F003-00F040 "mov.h R0,
# 3000[R10]", "mov.h R0, [R10+]"; draw_object 00EB1F "mov.w R2, [R10]" and 00EB27 the jump to the layer's last
# group, 32 bits (the jump and a word 0, its offsets unused); road_row_draw writes words 0-1 and 6-7 32 bits at a
# time (00F7D1 "mov.w R0, 3000[R10]", 00F880 "mov.w R7, 3000[R10]"), fork_branch_draw too (013F90-014016)
# A place in the screen's ring of sprite places (screen next_sprite_place: 20C000 and 21C000, 16 bytes a place,
# wrapping at & EFFF): what an object or a road row's item was drawn with last frame, for the halfway copy of its
# sprites (the average of the two frames'). draw_object_smoothed (the object's previous_place) keeps its zoom there
# (00F1C3-00F1CC "mov.h R3, [R27+]", read back from 00F189 "movz.hw [R28+], R7"); road_row_draw and road_row_pair_draw
# keep each item's sprite size, place and graphics (00F7D9 "mov.h R7, 8[R27]", 00F7E3 "mov.h R3, [R27]"), and blank
# the four places after the last (blank_sprite_places, 00F8ED "mov.w R26, [R27+]"); 00F726 "mov.w #F800F800, 4[R27]"
# marks an item off the screen
struct sprite_place 10
# sprite_place 00: height and width at once (the blank after a row's last item), which the C writes as its two fields
field sprite_place 00 height u16          # draw_object_smoothed: height_scale; the road rows: the sprite's height (word 2 less its bits)
field sprite_place 02 width u16           # width_scale; the sprite's width (word 3 less its bits)
# sprite_place 04: y and x at once: F800F800 off the screen, which the C writes as its two fields
field sprite_place 04 y u16
field sprite_place 06 x u16
field sprite_place 08 rom_offset u16      # the road rows: the graphics' offset (word 6): the halfway copy is drawn only when it is the same sprite as last frame's
field sprite_place 0A mirror_x u16        # road_row_pair_draw: the mirrored item's x (its second sprite)
# The same places a word at a time, as the road rows blank the four after their last item (00F8ED-00F8FF,
# 00FC9E-00FCB0 "mov.w R26, [R27+]; and.h R21, R27": moved within the ring's page, which the record's type does not
# follow)
elements sprite_place_words u16 ram
# A frame of an animation (sprite_animation frames): its piece count, then its pieces (sprite_piece, 8 bytes each),
# a halfword at a time: fork_branch_sprite reads its first piece's attributes and sprite straight from the frame
# (014072 "mov.h 2[R26], R27", 014076 "movz.hw 4[R26], R26")
field sprite_frame 02 piece_words u16[]
local fork_branch_sprite 01406E R26 frames sprite_frame   # "mov.w 4[R26], R26": the first frame of animation 74
param fork_branch_sprite R12 size_and_attributes
param fork_branch_sprite R14 width_bits
# An object list (object_area list, next_list: 200200 and 200300, the two lists of screen 1), its entries after the
# count a halfword each, the low half of an object's address, 0 at the end: run_objects 011CE4 "mov.h [R22+], R20"
elements object_links u16 ram
# A list of objects to start, at its start: its 32-bit count, then the objects (start_object_list: their handlers,
# object_handlers, 011E2C "mov.w [R10+], R8"; race_car_start_ending and race_background_start_objects: the
# (handler, data) pairs, object_list_pair, 0146F1 and 017BD8 "mov.w [R10+], R0", for stage_background_object_lists
# the pairs' length in bytes)
struct object_start_list 4 rom
field object_start_list 00 count u32
local race_car_start_ending 0146E9 R10 actor_list object_start_list   # "mov.w 14A20[PC](R0), R10": ending_actor_lists's list
local race_background_start_objects 017BD2 R10 object_list object_start_list   # "mov.w 181B8[PC](R0), R10": stage_background_object_lists's list
# A screen's two tilemaps' page selects in the copy of the video registers (video_registers, 20E240 on, sent to
# 31FF40): screen 1's NBG0 at 20E240 and NBG2 8 on, screen 2's NBG1 at 20E244 and NBG3 8 on (the other screen's in
# between); a layer's upper two pages in its first word, its lower two in the second, a byte a page (MAME's
# segas32_v.cpp). set_up_background 0179B9 "mov.w [R19+], [R11]", 0179BD "mov.w [R19+], 8[R11]"; race_background_update
# 01756B "mov.w 17AE0[PC](R0), [R11]", 01783F "mov.w [R10+], [20[R20]]"; race_background_lower_animation_cycle 0178F3
# "mov.h ..., 2[20[R20]]", race_background_upper_animation_cycle 01797B "mov.h ..., [20[R20]]"
struct tilemap_pages C
field tilemap_pages 00 upper_pages u16
field tilemap_pages 02 lower_pages u16
field tilemap_pages 08 second_upper_pages u16
field tilemap_pages 0A second_lower_pages u16
local race_background_update 01755D R11 page_word_address   # "mov.w [R10+], R11": the tilemap's page selects (race_background_layer_setup page_word_address): named here, or the C names it after its type
local set_up_background 0179B6 R11 pages_address   # "mov.w [R10+], R11": background_registers pages_address: named here, or the C names it after its type
# A screen's two tilemaps' tile banks (tile_banks, 20E2B0 for screen 1: NBG0, NBG2 2 on; 20E2B1 for screen 2: NBG1,
# NBG3): set_up_background 0179C5 "mov.b [R19+], [R11]", 0179C9 "mov.b [R19+], 2[R11]"; race_background_update
# 0175EC, 01776B "mov.b ..., [24[R20]]"
struct tilemap_banks 3
field tilemap_banks 00 tile_bank u8
field tilemap_banks 02 second_tile_bank u8
local set_up_background 0179C2 R11 tile_banks_address   # "mov.w [R10+], R11": background_registers tile_banks_address: named here, or the C names it after its type
# A halfword of the video registers' copies (video_registers, sent to 31FF00 on: a tilemap's zoom steps at F50 on, 200
# 1:1, and its zoom centre at F30 on, MAME's segas32_v.cpp) or of the tilemaps' scroll targets (scroll_targets,
# 20E290 on, which the vertical blank moves into the scroll registers F10 on: 20E292 NBG0's x, 20E296 its y), one
# register each: set_up_background 017A06 "mov.h #0, [R11]" and the like; race_background_update 01785E "mov.h R0,
# [18[R20]]", 017897 "mov.h R0, [1C[R20]]"
# Two of the mixer's register copies (screen mixer_values, screen + 160 on: registers 22 and 26 for screen 1's two
# tilemaps, 24 and 28 for screen 2's), read and written 32 bits at a time for the low four bits of the first (the
# layer's priority): set_up_background 017A1A "mov.w [R11], R0" ... 017A25 "mov.w R0, [R11+]"; race_background_update
# 017575 "mov.w [R10], R0", 017580 "mov.w R0, [R10]"
# The road's palettes at a change of background (background_road_palettes): the address of the road's fade list
# (into screen road_palette_fades), then the fades to start (start_palette_fades, a palette_fade_list):
# race_background_update 0177A7 "mov.w [R19+], 208[R25]"
struct road_palette_record 4 rom
field road_palette_record 00 road_fades u32 palette_fade_list   # the road's fades (screen road_palette_fades)
field road_palette_record 04 fades palette_fade_list[]   # then the fades to start, a palette_fade_list (start_palette_fades)
# A stage's road palettes (stage_road_palettes): the address of the road's fade list (into screen
# road_palette_fades), then its palette list: road_surface_start 016CF4 "mov.w [R19+], 208[R25]", then
# queue_palette_list with what follows
struct stage_road_palette_record 4 rom
field stage_road_palette_record 00 road_fades u32 palette_fade_list   # the road's fades (screen road_palette_fades)
field stage_road_palette_record 04 palettes palette_block_list[]   # then the palette list to upload (queue_palette_list)
# The palette fades a sunset_fade started, an object each from its + 18 (sunset_fade fades, count of them):
# sunset_fade_start 017D11 "mov.w R21, [R17+]", sunset_fade_wait 017D2A "mov.w [R10+], R1", 017D3C "mov.w #0, -4[R10]"
elements fade_objects u32 ram object
# A race's racers (the race record's racer_count, then race_order: a player each), a byte at a time: screen
# traffic_racer_list (host_record + 1F) for traffic_spawner_update (013867 "movz.bw [R10+], R9", 01386A "movz.bw
# [R10+], R0"), car_radio_start's walk from the host record (018F88, 018F90)
local car_radio_start 018F88,018F90 R10 race racer_numbers   # past the count: the racers
# The stretches of road the race's players see (screen + F84: visible_stretch_count, then each stretch's top and
# bottom), a halfword at a time: traffic_spawner_update 013886 "mov.h R8, [R11+]", traffic_out_of_view 013D31
# "cmp.h [R10+], R0"
elements stretch_ends u16 ram
# ======== memory reached through pointers (batch N4) ========
# The tile layers' registers as the scenes keep the addresses of them in their objects (route_map, ranking_background,
# title_screen, car_select: copied from route_map_registers, ranking_background_registers, title_screen_layer_setups
# and car_select_tilemap_setups by screen) and write through them: census 20E212-20E2B1
# The tile layer's line tables in video RAM the car select writes (car_select rowscroll_address and rowselect_address:
# 31C000 and 31C400 for screen 1, four pages 800 apart)
elements line_selects u16 board   # the tilemap row a line shows (car_select_run fills 98 on, a line each; census 31C400-31DFBE)
# The text layer (31F000-31FEFF: 64 cells a row, 80 bytes; each cell the attribute (palette) in the high byte and the
# character in the low), which the test mode draws on cell by cell
# test_mode_draw_count's cell (R10) as a record of one cell, so that its write R3 cells on stays an address: as text_layer_cells
# (which its callers' cells would give it) the C indexed TEXT_CELLS(*p_cell)[plural_offset] with plural_offset FFFFFFFE or
# FFFFFFFD (the bookkeeping's TOTAL lines: the S two or three cells back), 4G cells on in C
# test_mode_blink_address holds the cursor's cell (test_mode_set_cursor) on the pages with a cursor, and the prompt's text
# record (test_mode_show_exit_prompt, test_mode_show_continue_prompt) on those with a prompt, which test_mode_blink_prompt reads
# The rest of the test mode's memories: its texts, the memory test, the volume adjustment, the output test, the bookkeeping
# A text record of the test mode (test_mode_draw_texts; the prompts test_mode_blink_prompt blinks: PUSH TEST BUTTON TO
# EXIT at 01F2BC, TO CONTINUE at 01F2DE): lines of a cell (the low half of its address in the text layer) and characters
# closed by 0, a 0 cell after the last. test_mode_blink_prompt reads the first line's cell (01F05E "movz.hw [R10], R11")
# to see whether the prompt is shown; test_mode_draw_texts walks the lines a halfword and bytes at a time (untyped: its
# reads print ROM16 and ROM8, as all its callers pass records of the program ROM)
elements chip_test_results u8 ram     # the memory test's result for a chip (memory_test_results, 20E716 on, 25 chips): 0 not yet, 1 testing, 2 good, 3 bad (test_mode_memory_test_draw 01C958 "movz.bw [R10+], R0")
elements program_halfwords u16        # the program ROM as test_mode_memory_test_checksum sums it, a halfword at a time (000000-03FFF7 and 100000-1FEFFF)
elements analog_positions u8 ram      # a control's position as the test mode reads it from the A/D converter (test_mode_analog_inputs, 20E710 on: the two wheels, gas pedals and brakes): test_mode_read_controls writes them, the volume adjustment reads them
# The bookkeeping in the RAM the sound program shares (701F00 on): the TIME HISTOGRAM's counts and the courses' records
elements stage_game_counts u16 board  # how many games ended at a stage (701F24 on, seven: PRE-STAGE, STAGE 1-5, COMPLETE), which test_mode_bookkeeping_draw_histogram walks twice
struct backup_course_record 6 board   # a course's record as the backup keeps it (701F32 on, ten: AUSTRALIA to KENYA), laid out as course_record: load_course_records copies it into course_records, test_mode_bookkeeping_draw_histogram shows it; a negative model: none
field backup_course_record 04 time u16        # in hundredths
scoped global test_mode_blink_prompt 20E708 test_mode_prompt_text u32 test_mode_text_bytes   # test_mode_blink_address as the prompt pages use it: a text record of the ROM (test_mode_show_exit_prompt 01F2BC, test_mode_show_continue_prompt 01F2DE), not a cell
elements tile_pixel_words u16 board   # a tile's pixels in video RAM, by its 16-bit words: four of 4 bits a word, a row of eight two of them (test_mode_set_up_colours writes the four solid tiles from 318020 a row at a time, its two words)
# The scenes' own (route map, car select, ranking, name entry, attract)
elements player_place u8 ram          # a player's place in the race (screen places, 0 first): stage_result_line place_address (screen + 320 + player), the final place it draws big
elements racer_numbers u8 ram      # the race's order in its race record from racer_count (race 1F: the count, then the players at 20 on): car_select_entries race_order, which car_select_entries_run walks a byte at a time (005FD9 "movz.bw [R10+], R8", 005FE0 "movz.bw [R10+], R0")
elements object_tile_pages u32 ram    # a list of tile pages an object puts together in itself for queue_tile_pages (ranking_background page_list, 4 entries and FFFFFFFF from B0): the page in the top byte, the packed data's address below (as tile_page_entries)
elements course_record_bytes u8 ram   # a byte of a course's record in course_records (20E300 + 6 * course, the layout of course_record): ranking_record_start reads the name's letters from 20E301 (00271E, 00272E "mov.b [R11+], R4")
elements floor_line_offsets u16 ram   # the car select floor's 120 line offsets, 1/64 pixels (screen + 3800 on): car_select_skew_floor adds a growing step to each and car_select_update_rowscroll copies them, shifted, into the line scroll table
elements name_letters u8 ram          # the name entry's name, a letter a byte (name_entry name, A0 on, three letters and a 0), as name_entry_lcd_update reads it
elements item_place_words u16 ram     # a turntable scenery item's place as it was last drawn (turntable_scenery item_places, from 80: two halfwords an item of its item_list, the low half of its previous_place and its flags bit 5), for draw mode 0A's halfway copy: turntable_scenery_show puts them into the object before turntable_draw and keeps them after (005837-00584D); an item on the near side gets 0 flags (005845 "mov.h #0, 2[R11]")
# The board's registers these files print as numbers
C00050 io ANALOG_INPUTS u8               # the A/D converter's first input, the rest a register every 2 bytes: a write starts the conversion and eight reads shift the reading out, bit 7 first (test_mode_read_controls, read_switches_and_analog: C00050 + 4 * the bank)
701F14 io BOOKKEEPING_GAMES_A u16        # NUMBER OF GAME(S) A, B at 701F16: the games each seat started (game_mode_play by the screen's index, bookkeeping_increment16; test_mode_bookkeeping_draw_totals)
701F24 io BOOKKEEPING_HISTOGRAM u16      # the TIME HISTOGRAM: how many games ended at PRE-STAGE, then STAGE 1-5 and COMPLETE, seven halfwords (stage_game_counts)
701F32 io BOOKKEEPING_COURSE_RECORDS u16 # the courses' records, ten of 6 bytes (backup_course_record): the first one's model and initial
# ======== memory reached through pointers (batch N5) ========
# The road's surface (road_surface_lines, road_surface_halfway_lines, road_surface_fill_lines,
# road_surface_fill_skipped_lines, road_tiles_change_update, road_surface_start, road_surface_update)
elements road_points u16 ram                  # the points buffer (screen + 3800, its two halves by points_buffer): the first segment in view's number, then each point's depth, x and line (road_surface_lines "mov.h R3, [R26+]" 016D88...), closed by FFFF (016E7C)
elements line_scroll_values u16 board         # a tilemap's line scroll table in the video RAM (the road's: line_scroll_table, 31C000 on), a halfword a line, written from the bottom line up ("mov.h R2, [-R11]" 016E09; road_surface_fill_skipped_lines downwards, "mov.h R0, [R11+]" 0170EB)
param road_surface_fill_lines R11 line_scroll_place line_scroll_values   # the line scroll table's place it fills up from ("mov.h R0, [-R11]" 017041, 017088), handed back
elements tile_page_places u32 ram             # road_tiles_change's lists of the four tile pages it copies from (object 18) and to (object 28): their addresses in the video RAM (300000 + 400 * page; "mov.w R0, [R10+]" 0171F8-017220)
elements road_page_table_bytes u8 ram         # the road's page table (road_surface 18), every other byte from table_half: road_tiles_change_update writes its half a byte at a time ("mov.b [R12+], [R11]" then 2 on, 017280-017292)
elements tiles_change_flags u8 ram            # the road's flag a road_tiles_change goes by (road_tiles_change flag: road_surface first_tiles_flag 0A or second_tiles_flag 0B), read until it turns off (017319 "test.b [3C[R20]]")
elements page_select u16 ram             # a tilemap's page word in video_registers, as its two halfwords (20E248 for screen 1's road, 20E24C screen 2's: road_surface_layer_setup page_register), its four pages a byte each; road_surface_update writes it each frame (016B8A "mov.w -24[R20](R0), [54[R20]]")
elements video_register_words u16 ram         # the copy of a tilemap's scroll register in the game's variables (scroll_targets: 20E2A2, 20E2A6 for screen 1's road), which the VBLANK sends (road_surface_start "mov.h #160, [R0]" 016C40, "mov.h #0, [R0]" 016C49)
elements tile_bank_values u8 ram              # a tilemap's tile bank in tile_banks (20E2B2, 20E2B3: road_surface_start "mov.b #0, [R11]" 016C55)
elements mixer_register_copies u16 ram        # a screen's mixer register copies (screen mixer_values: 186 for screen 1's road, 188 screen 2's), two of them read and written as one word (road_surface_start 016C64-016C6E: the road's priority 8 into the low four bits)
elements road_palette_lists u32               # a stage's road palettes (stage_road_palettes): the address of its fade list ("mov.w [R19+], 208[R25]" 016CF4: screen road_palette_fades), then its palette list (queue_palette_list)
# The race cars' riders and sprays (race_car_draw, race_car_draw_spray): 16 bytes each in the race car, from 90
struct race_car_rider 10      # a rider of the car, 16 bytes in the race car: the driver at 90, the passenger at A0 (race_cars_start 0095C8-009643, race_car_draw first_rider and second_rider)
field race_car_rider 00 places u32 car_part_place   # its places by the car's view (race_car_rider_places by model; race_car_draw "mov.w [R27], R11" -> race_car_draw_part)
field race_car_rider 04 animation u16     # its animation (race_car_driver_animations, race_car_passenger_animations), plus the car's view
field race_car_rider 06 palette u16       # its palette
field race_car_rider 08 gesture_mask u8   # the gesture bits it shows (race_car gesture_shown): drawn when none of them is set
field race_car_rider 0A frame u8          # the frame it is at (1 on to frames, 0 while the car stands)
field race_car_rider 0B frames u8         # how many frames it has
struct race_car_spray 10      # a spray at the car's wheels, 16 bytes in the race car: spray 2 at C0, spray 1 at D0 (race_cars_start 00964A-009680; race_car_draw_spray R27)
field race_car_spray 00 animations u32 spray_animation_numbers   # its animation by its kind (race_car_spray_2_animations, race_car_spray_1_animations)
field race_car_spray 04 places u32 car_part_place   # its places by the car's view (race_car_rider_places + 8 or + C)
field race_car_spray 08 effect u32 wheel_effect_values   # the race record's wheel effect it shows (race wheel_effect_2 for spray 2, wheel_effect_1 for spray 1)
field race_car_spray 0C frame u8          # the frame it is at (0: none shown)
field race_car_spray 0D side u8           # its side's bit (2, 1): shown while race wheel_effect_sides has it
field race_car_spray 0E kind u8           # the effect it shows (dust, smoke, water...)
elements spray_animation_numbers u16          # a spray's animation by its kind (race_car_spray_2_animations 009F2C, race_car_spray_1_animations 009F4C: race_car_draw_spray 009C64 "movz.hw [0[R27]](R0), R12")
elements wheel_effect_values u8 ram           # a race record's wheel effect (race wheel_effect_1, wheel_effect_2), read by the spray that shows it (race_car_draw_spray 009C33 "movz.bw [8[R27]], R2")
elements sprite_words u16 board               # a sprite entry's words in the screen's sprite list (sprite RAM 404000 on), a halfword each (MAME segas32_v.cpp: 0 the command and its flags, 1 the source's size, 2 the height and 3 the width with their bits, 4 y, 5 x, 6 the sprite ROM offset, 7 the palette); the list's copy is 3000 bytes on (1800 halfwords): race_car_put_sprite writes both ("mov.h R0, 3000[R10]; mov.h R0, [R10+]"); race_car_draw links a group in with the entry's first two halfwords at once
# The players in race order (race race_order, 20 on): race_cars_start, checkpoint_board_update and player_car_check_place
# (from host_record + 1F: the count, then the players), player_car_build_hit_boxes, lcd_race_info_update walk them
elements race_order_players u8 ram            # a race record's players in race order, a byte each (race race_order)
local race_cars_start 009597,0095A0 R10 race race_order_players   # "movz.bw [R10+], R0" (009597: past racer_count), "movz.bw [R10+], R1" (0095A0): each racer
local checkpoint_board_update 00CBDF,00CBE2 R10 race race_order_players   # the same walk (00CBDF past racer_count, 00CBE2 each racer)
local player_car_check_place 007462 R10 race race_order_players   # "movz.bw [R10+], R9" (007462): past racer_count, then the players by place ([R10](R9))
local player_car_build_hit_boxes 012238,01225D R10 racer_list race_order_players   # "movea.b 20[308[R25]], R10" then "movz.bw [R10+], R1" (01225D)
# The cars' hit boxes (screen + 514 on, 12 bytes each, and the screen's car's own from 5AE): player_car_write_hit_box
# writes a box from its record on (R11 two bytes in), player_car_build_hit_boxes the player before it
local player_car_build_hit_boxes 01225A,012291 R11 hit_box car_hit_box   # the first box ("mov.w R0, [R11+]" 01225A: past hit_box_count), then the next one player_car_write_hit_box hands back
local player_car_write_hit_box 0122BC R19 box_size item_hit_box   # car_hit_box_sizes by the model ("movea.w 126BC[PC](R2), R19"), read a bound at a time ("add.h [R19+], R15" 0122CA-0122DC)
param player_car_write_hit_box R12 racer_copy
# The race's display: the texts objects keep for draw_text_at, and the checkpoint counts
elements object_text_characters u8 ram        # a text an object keeps for draw_text_at (lap_timer, goal, checkpoint_board's rows), a character each: time_to_text writes it from its end back ("mov.b R1, [-R10]"), closed by 0
elements checkpoint_counts u8 ram             # a player's count of the checkpoints passed (screen checkpoints_passed + player: checkpoint_board checkpoint_count)
# The torque curves (screen + 1300, 200 bytes a gear): player_car_build_torque_curves writes them, player_car_drive reads the gear's
elements torque_curve_forces u16 ram          # a gear's drive force by the speed (>> 8), a halfword each (player_car_build_torque_curves "mov.h R4, [R10+]" 00A081; player_car_drive "movea.b 1300[R25](R1), R2" 00A1DE by the gear)
# The bookkeeping in the RAM the sound program shares (701F02-701F7D) and its backup 7C on (701F7E-701FF9): a counter's
# address (R7) reaches both
struct bookkeeping_count16 7E board   # a 16-bit count of the bookkeeping (the coins by chute 701F06-701F0C, the games by seat, the longest and shortest play 701F20, 701F22) and its backup's
field bookkeeping_count16 00 value u16
field bookkeeping_count16 7C backup u16
struct bookkeeping_count32 80 board   # a 32-bit count of the bookkeeping (the play time by seat, 701F18 + 4 * index) and its backup's: two halfwords, the low one first, as the bookkeeping is kept
field bookkeeping_count32 00 value u16[2]
field bookkeeping_count32 7C backup u16[2]
struct bookkeeping_count8 7D board    # an 8-bit one (bookkeeping_increment8, bookkeeping_add8, bookkeeping_set8: none in use) and its backup's
field bookkeeping_count8 00 value u8
field bookkeeping_count8 7C backup u8
elements bookkeeping_halfwords u16 board      # the bookkeeping's 3E halfwords (701F02) or its backup's (701F7E), which bookkeeping_checksum sums ("xor.h [R2+], R0")
elements seat_sound_counts u8 ram             # a seat's pending coin or service sounds (seat1_coin_sounds-seat2_service_sounds: coin_chute coin_sounds, add_service_credit R11)
elements chute_unit_settings u8 ram           # a chute's coin units in the settings (first_chute_multiplier, second_chute_multiplier: coin_chute_variant coin_units)
# The analog inputs (read_switches_and_analog, link_send_seat_inputs)
elements analog_values u8 ram                 # the analog inputs, a byte each: raw (analog_raw) and scaled (analog_inputs), from 4 * the screen's turn (4 on screen 1's, 2 on screen 2's)
elements analog_calibration_bytes u8 ram      # the analog inputs' calibration in the settings, a low and a high byte each (20E638 on: analog_calibration_addresses)
field screen 130 input_ring u32[8]            # the screen's ring of eight frames of inputs (queue_screen_inputs at input_write_place, take_screen_inputs at input_read_place)
# The sound requests and the RAM the sound program shares
elements music_fade_delays u8 board           # byte 18 of a screen's first music track in the RAM the sound program shares (music_fade_addresses: 700918, 70F118), the delay of its fade out
# The cabinet LCD's text (screen F10-F1F) and the settings' words
elements lcd_characters u8 ram                # the LCD's text (screen lcd_text, F10 on), a character each: lcd_race_info_update writes the order page's car numbers from F18
elements settings_words u16 ram               # the settings (20E600 on) as the EEPROM holds them, a word each (eeprom_read_settings "mov.h R0, [R11+]" 00034C, eeprom_write_settings "mov.h [R10+], R0" 0003AD)
# The time digits (time_digits_draw): three records of 8 bytes in the object, the units at 80, the tens at 88, the hundreds at 90
struct time_digit 8           # a digit of the time (time_digits units_flip-units_remaining, tens_..., hundreds_...)
field time_digit 00 flip s8               # 0 still; 1 squeezing shut (the width 40 less a frame), FF opening again as the new digit
field time_digit 01 digit u8              # the digit shown
field time_digit 02 width u16             # its width (object width_scale), 40 a frame from 100
field time_digit 04 remaining u32         # the digits from it up when it last changed (0: a leading zero, left out)
# The road's segments (player_car_project_road copies the width code and the road event as one halfword: "mov.h 14[R18], C[R19]" 0101F1)
# road_segment 14: the width code (low byte) and the road event (high byte) at once (the C reads and writes its two bytes)

# ======== memory reached through pointers (batch P1) ========
# The system's files (test_mode.c, sound.c, main.c, interrupts.c, coins.c, lcd.c) and the video's (video.c,
# palettes.c, unpack.c): what their pointers reach, R12 and R20 typed where the code sets them.
# The test mode: the text layer's cells (text_layer_cells) the pages draw through R12, a cell at a time
local test_mode_memory_test_draw 01C94D,01C96B R12 text_place text_layer_cells   # 31F000, then each chip's cell ("mov.h [R11+], R12": memory_test_result_cells), four cells of its result ("mov.h R0, [R12+]" 01C971-01C983)
param test_mode_memory_test_draw R12 text_place
local test_mode_coin_assignments_draw 01DDD5,01DE1E R12 line_cell text_layer_cells   # 31F522, the first line's cell, then the next line's (80 bytes on, 01DE1E); the text after the lines a cell at a time ("mov.h R0, [R12+]" 01DE4B)
param test_mode_coin_assignments_draw R12 line_cell
local test_mode_bookkeeping_draw_histogram 01E956 R12 cell text_layer_cells   # the record's time, a digit at a time: "add.w [R13+], R12" moves to the next digit's cell by time_digit_step cell_step (2, 4 or 6: whole cells)
param test_mode_bookkeeping_draw_histogram R12 cell
param test_mode_bookkeeping_draw_histogram R0 last_character
# The memory test's walk of the sound RAM (test_mode_memory_test_nibbles takes the video RAM and the sprite RAM, two
# memories; test_mode_memory_test_words the work RAM, but its read of a wrong word back, -4[R12] after the last one,
# would be element -1 of 220000, which ram() takes as 200000: both stay untyped)
elements tested_sound_ram_bytes u8 board    # the sound RAM as test_mode_memory_test_bytes writes and reads it, a byte at a time (700000-701FFE: test_mode_memory_test passes 700000 and 1FFF bytes; "mov.b R3, [R12+]" 01CB0C, "cmp.b R3, [R12+]" 01CB48, "xor.b -1[R12], R0" 01CB50)
local test_mode_memory_test_bytes 01CB03,01CB3F R12 tested_address tested_sound_ram_bytes   # "mov.w R10, R12": the RAM's start, for the writes and then for the reads
# The volume adjustment and the input test: the calibration (volume_ranges, 20E638: a low and a high byte each) and
# the controls' positions (test_mode_analog_inputs, 20E710), a byte at a time through R12
local test_mode_volume_adjustment_draw 01CEEF R12 calibration analog_calibration_bytes   # "movea.b 638[R24], R12": each control's range ("movz.bw [R12+], R0", "movz.bw [R12+], R1" 01CEF7-01CF2B)
local test_mode_volume_adjustment_draw 01CF53 R12 analog_input analog_positions   # "movea.b 710[R24], R12": each control's position ("movz.bw [R12+], R0" 01CF5B)
param test_mode_volume_adjustment_draw R12 last_analog_input
local test_mode_input_test_draw 01D165 R12 analog_input analog_positions   # "movea.b 710[R24], R12": each control's position ("movz.bw [R12+], R0" 01D177)
local test_mode_input_test_draw 01D1C4,01D1D2,01D209,01D215 R12 port_a io   # monitor A's I/O chip (C00000), then the port of the switch in its low byte (input_test_items), 8 (port E) and A (port F)
param test_mode_input_test_draw R12 last_port
param test_mode_input_test_draw R14 last_bar_cells
local test_mode_output_test_draw 01D4AC R12 output_bits port_output_bits   # "add.w R24, R12": the output's byte in the game's variables (port_d_outputs, port_g_outputs), its bit tested ("test1 R0, [R12]" 01D4B2)
# The game assignments: the time difficulty a byte a stage, and the settings' backup copy 3C bytes on
elements time_difficulty_seconds u8 ram     # the seconds each stage's time gets, a byte each (time_difficulty, 20E632 on: PRE-STAGE, STAGE 1-4, FINAL STAGE), which test_mode_game_assignments_draw walks ("movz.bw [R12+], R0" 01DAD2)
local test_mode_game_assignments_draw 01DAC8 R12 difficulty_seconds time_difficulty_seconds   # "movea.b 32[R20], R12": time_difficulty
param test_mode_game_assignments_draw R12 difficulty_seconds
param test_mode_game_assignments_draw R0 character
struct backed_up_setting 3D          # a setting (a byte of the settings in settings_magic's page, 20E600) and its copy in the backup 3C bytes on (from backup_settings_checksum, the copy load_settings keeps): the pages' EXIT compares each setting of test_mode_setting_places with its copy ("cmp.b [R20], 3C[R20]")
field backed_up_setting 00 value u8
field backed_up_setting 3C backup u8
local test_mode_game_assignments_exit 01DBB3 R20 current_object backed_up_setting   # "mov.b [R10+], R20": the setting's low byte (test_mode_setting_places) into R20 (settings_magic's page)
local test_mode_coin_assignments_exit 01E0B5 R20 current_object backed_up_setting
local test_mode_network_assignments_exit 01E5FC R20 current_object backed_up_setting
# The bookkeeping in the RAM the sound program shares, as the first bookkeeping page reads it through R20 (701F00;
# the counts are halfwords and the times words, kept with their backup 7C on: bookkeeping_count16, bookkeeping_count32)
struct bookkeeping_block 7E board    # 701F00: the checksum, then the bookkeeping (701F02-701F7D) that bookkeeping_checksum sums
field bookkeeping_block 00 checksum u16          # BOOKKEEPING_CHECKSUM
field bookkeeping_block 02 coin_credits u16      # COIN CREDIT: the credits the coins gave (update_coins: bookkeeping_add16 at 701F02)
field bookkeeping_block 04 service_credits u16   # SERVICE CREDIT
field bookkeeping_block 06 chute_a_coins u16     # COIN CHUTE A (BOOKKEEPING_CHUTE_A_COINS: the coins of seat A's first chute)
field bookkeeping_block 0A chute_b_coins u16     # COIN CHUTE B (seat B's first chute: coin_chute_variant counter 701F0A)
field bookkeeping_block 10 total_time u16[2]     # TOTAL TIME, seconds (BOOKKEEPING_TOTAL_TIME): two halfwords, the low one first
field bookkeeping_block 14 games_a u16           # NUMBER OF GAME(S) A (BOOKKEEPING_GAMES_A)
field bookkeeping_block 16 games_b u16           # NUMBER OF GAME(S) B
field bookkeeping_block 18 play_time_a u16[2]    # GAME PLAY TIME A, seconds (bookkeeping_count32 by the screen's index)
field bookkeeping_block 1C play_time_b u16[2]    # GAME PLAY TIME B
field bookkeeping_block 20 longest_play u16      # LONGEST (BOOKKEEPING_LONGEST_PLAY)
field bookkeeping_block 22 shortest_play u16     # SHORTEST (BOOKKEEPING_SHORTEST_PLAY)
local test_mode_bookkeeping_draw_totals 01E740 R20 current_object bookkeeping_block   # "movea.b 701F00, R20"
# The coins: the port D outputs a coin meter's bit is in (update_coins passes them in R12) and the seats' credits
# in the bookkeeping (write_bookkeeping_credits writes four halfwords from R12)
local update_coins 011190,0111A0,0111B6,0111C6 R12 r12 port_output_bits   # "movea.b 92[R24], R12", "movea.b 93[R24], R12": port_d_outputs for seat 1's meters, port_d_outputs[1] for seat 2's (pulse_coin_meter "or.b R0, [R12]", "and.b R0, [R12]")
local pulse_coin_meter 0111FF,01120C R12 meter_bits bookkeeping_halfwords   # 701F74 (BOOKKEEPING_SEAT_1_CREDITS) and 701FF0 in the backup: write_bookkeeping_credits "mov.h A0[R24], [R12+]" 011213-011225
param pulse_coin_meter R12 meter_bits
# The course: init_screen adds up each road's lengths walking its stream of 6-byte entries (stage_courses), R12 the entry
struct course_entry 6 rom            # an entry of a course's stream (car course): a section's length, or a command when negative (FFFF goes on at the address after it; FFFE a fork and FFFA end the road; FFFC, a stage's command, is 4 bytes long)
field course_entry 00 length u16                 # init_screen "movz.hw [R12], R0" 013D7B, then "add.w #6, R12"
field course_entry 02 jump u32 course_entry      # FFFF's: where the course goes on ("mov.w [-R12], R12" 013DAC)
local init_screen 013D6F,013D7E,013DAC,013DB1 R12 course_place course_bytes   # the road's first entry (stage_courses, "mov.w [R10+], R12"), the next one ("add.w #6, R12"), where an FFFF entry goes on ("mov.w [-R12], R12" 013DAC), and the one after a stage's 4-byte command ("sub.w #2, R12" 013DB1)
local init_screen 013D7B R0 length   # the entry's first halfword: a section's length, or a command when negative
# The unused unpack_list carries its list's next entry in R12 across unpack
local unpack_list 010F6C R12 r12 packed_block_entry   # "xch.w R10, R12": the next entry (8 bytes on)
# ======== memory reached through pointers (batch P2) ========
# The network check's link board in R12 (800000: network_check 00D142 "movea.b 800000, R12", network_check_again
# 00D0D6). wait_for_frame calls unpack_queued_step, which sets R12, only while the screen unpacks tiles (screen
# unpack_state), none of which is under way at the check: what the calls that wait for a frame (wait_for_frame,
# network_check_wait_board, network_check_wait_isdn, network_check_four_ics through network_check_halt) hand back in
# R12 is the board still, as the code after them reads it
local network_check 00D1F7 R12 r12 io    # network_check_wait_board (then network_check_greeting reads the greetings at 800000 and 800010)
local network_check 00D20B R12 r12 io    # network_check_wait_board (then the self-test byte 80000C cleared)
local network_check 00D213 R12 r12 io    # network_check_four_ics (then link_master into 800004)
local network_check 00D232 R12 r12 io    # network_check_wait_board (then network_check_five_ics)
local network_check 00D240 R12 r12 io    # wait_for_frame, the wait for the board's flag (then 800002 to 800E20, FF at 800006, the waits on 800008 and 80000C)
local network_check_isdn 00D2E6 R12 r12 io       # network_check_wait_isdn (then network_check_join)
local network_check_five_ics 00D825 R12 r12 io   # network_check_four_ics (then the self-test byte again)
# A course's record in course_records (20E300 + 6 * course: course_records_update 00DF23 "movea.b 300[R24](R8),
# R12", the course record_course * 6), laid out as course_record (the ROM's defaults) and backup_course_record
# (the backup's, 701F32), the name's three letters at 01-03: course_records_update writes the name as a byte and a
# halfword (as the race record's record_name and record_name_rest) and copies the model and the name to the backup
# as one word
struct course_record_entry 6   # a course's record in course_records (20E300 + 6 * course) as course_records_update writes it, the name as a byte and a halfword (course_record_copy: the same record, as load_course_records copies it)
field course_record_entry 00 model u8      # the car's model (00DF33 "mov.b 12[R11], 0[R12]": race record_model)
field course_record_entry 01 name u8       # the name's first letter (00DF39 "mov.b 13[R11], 1[R12]": race record_name)
field course_record_entry 02 name_rest u16 # its other two (00DF3F "mov.h 14[R11], 2[R12]": race record_name_rest)
field course_record_entry 04 time u16      # in hundredths (00DF29 "cmp.h R1, 4[R12]": the race's finish_time at or under it replaces it)
local course_records_update 00DF23 R12 record_entry course_record_entry
param course_records_update R12 record_entry
# The view the car hands on (player_car_publish, clear_published_car: R12 = screen + 600 + 20 * view_ring_slot)
local player_car_publish 00755F R12 view view    # ISDN: the first view ("movea.b 600[R25], R12")
local player_car_publish 007584 R12 view view    # the next of the ring ("movea.b 600[R25](R0), R12")
local clear_published_car 007696 R12 view view
field view 14 segment_remaining u16      # the rest of the car's segment (car segment_remaining): player_car_publish 0075DF "mov.h 3A[R23], 14[R12]", clear_published_car clears it; nothing reads it back
# The race cars' hit boxes: each racer's race_copy record (player_car_build_hit_boxes 01227B "movea.b 1C00[R24](R1),
# R12": 20FC00 + 80 * its player), and the screen's list of boxes from 514 (player_car_check_car_hits 01259C "mov.w
# [R14+], R5" past hit_box_count, then a box of 18 bytes at a time: [R14+] through its fields, the rest skipped)
local player_car_build_hit_boxes 01227B R12 racer_copy race
local player_car_check_car_hits 01259C R14 r14 car_hit_box
local player_car_check_car_hits 012577,01259C,0125A4,0125AC,0125B6,0125B9,0125D6,0125D9,0125DC,0125DF,01260E,01261A,012622 R14 other_hit_box   # the screen's hit boxes (510), the other cars'
# The next segment of the ring ((segment + 20) & AFFF in the page, R12): player_car_drive works out the length of
# the car's segment from the two headings, player_car_world_position (which gets it from player_car_drive or
# player_car_place_on_road) the height and the heading between them, player_car_place_view the view's ("or.h #2000,
# R12; and.h #AFFF, R12" after the view's shift) and, twelve segments on (+180), where the view looks
local player_car_drive 00A41A R12 next_segment road_segment
local player_car_drive 00A4C0 R12 next_segment road_segment   # ISDN: the race_copy's segment's next
param player_car_drive R12 next_segment
local player_car_place_on_road 0077CE R12 next_segment road_segment
local player_car_place_view 00A696 R12 view_segment road_segment   # after the view's shift (the and.h #AFFF at 00A69B goes into the read of its y)
local player_car_place_view 00A724 R12 far_segment road_segment   # twelve segments on
local player_car_place_view 00A754 R12 far_segment road_segment   # twelve segments on from the next
param player_car_place_view R12 view_segment
# The race car's object in R12 (race_cars_start 0096B8 "mov.h R21, R12": the page from before, the low half the car's
# object), which its riders and their gestures keep as their car, and whose player they take (009719, 00973D "mov.b 9[R12], B[R21]")
local race_cars_start 0096B8 R12 r12 object.race_car
# ======== memory reached through pointers (batch P3) ========
# draw_object_between_segments and the modes from the road's edge: R12 the record of the segment after the object's
# (its scale, x and y for the fraction between the two)
local draw_object_between_segments 00EB9B R12 r12 projected_segment   # "movea.b 3000[R25](R0), R12" (projected_offset + 10): the next segment's
local draw_object_from_road_edge 00EC42 R12 r12 projected_segment
local draw_object_from_road_edge_unshifted 00ECF4 R12 r12 projected_segment
local draw_object_from_road_edge_doubled 00EDA9 R12 r12 projected_segment
# The road's line select table in the video RAM (road_surface line_select_table: 31C400 on for screen 1's road, a
# halfword a line, the depth's tilemap row plus the stripe in r14), written from the bottom line up ("mov.h R0,
# [-R12]"); the lines above the road's top are cleared two at a time
local road_surface_lines 016D1A,016DC2,016E1A,016E43 R12 select_place line_selects   # "movea.w [5C[R20]](R0), R12" (016D1A): the bottom line's place; "sub.w R9, R12" (016DC2) past skipped lines; "mov.h R0, [-R12]" (016E1A) a line's select; "mov.h #0, [-R12]" (016E43) the line above the road
local road_surface_lines 016E51 R12 select_place line_selects   # two lines' selects at once, as it clears the lines above the road ("test.w [-R12]" 016E51; "mov.w #0, [R12]" 016E4D)
param road_surface_lines R12 select_place
param road_surface_lines R14 stripe
local road_surface_halfway_lines 016E9F,016F4F,016FA7,016FD4 R12 select_place line_selects
local road_surface_halfway_lines 016FE2 R12 select_place line_selects   # two lines' selects at once ("test.w [-R12]" 016FE2; "mov.w #0, [R12]" 016FDE)
param road_surface_halfway_lines R12 select_place
param road_surface_halfway_lines R14 stripe
local road_surface_fill_lines 017055,01709C R12 select_place line_selects   # "mov.h R0, [-R12]": a line's select, up from where road_surface_lines left R12
param road_surface_fill_lines R12 select_place
param road_surface_fill_lines R14 stripe
local road_surface_fill_skipped_lines 0170CE,017102 R12 select_place line_selects   # "mov.w 78[R20], R12" (skipped_select_place), then "mov.h R0, [R12+]" down the skipped lines
param road_surface_fill_skipped_lines R12 select_place
param road_surface_fill_skipped_lines R14 stripe
# The rider records of the goal scene's car (race_car_rider: goal_actor_driver_start + 90, goal_actor_passenger_start
# + A0 of the scene's race car), which goal_actor_rider_place reads through R12
local goal_actor_rider_place entry R12 r12 race_car_rider   # its places by view ("mov.w [R12], R11"), animation (4), palette (6) and frame (A)
# race_background_update's list of tile pages, in the object (+2C), built through R12
local race_background_update 0175BB,0175D4,0176B4,0176D4 R12 r12 object_tile_pages   # "mov.w R10, R12" (the list), then "mov.w R1, [R12+]" a page at a time; "not.w #0, [R12]" closes it
# game_mode_play waits for the screen's player in the host's race order (race_order_players, as race_cars_start)
local game_mode_play 002F3D,002F48 R10 race race_order_players   # the host's race_copy race_order: "movz.bw [R10+], R0" (002F3D: past racer_count), "cmp.b R1, [R10+]" (002F48): each racer
# The courses' records in work RAM (course_records, 20E300 on, ten of 6 bytes), laid out as course_record:
# load_course_records fills them through R12 from the backup (backup_course_record) or the defaults
# (default_course_records), a field at a time ("mov.b [R10+], [R12+]") or the model and name at once ("mov.w [R11+],
# [R12+]" 001D9C)
struct course_record_copy 6   # a course's record in course_records (20E300 + 6 * course) as load_course_records copies it, the name as three bytes (course_record_entry: the same record, as course_records_update writes it)
field course_record_copy 00 model u8
field course_record_copy 01 name u8[3]
field course_record_copy 04 time u16      # in hundredths
local load_course_records 001D93,001DA0,001DC0 R12 record_copy course_record_copy   # "movea.b 300[R24], R12": the first course's; after a record's time ("mov.h [R11+], [R12+]" 001DA0, "mov.h [R10+], [R12+]" 001DC0) the next one's
local load_course_records 001D9C R12 record_copy course_record_copy+4   # "mov.w [R11+], [R12+]": past the model and the name
local load_course_records 001DB0 R12 record_copy course_record_copy+1   # "and.b #7, [R12+]": past the model
local load_course_records 001DB4 R12 record_copy course_record_copy+2
local load_course_records 001DB8 R12 record_copy course_record_copy+3
local load_course_records 001DBC R12 record_copy course_record_copy+4
# The unused kanji text viewer's drawing on the bitmap layer (VIDEO_RAM + 1040 on, 100 bytes a row)
elements bitmap_layer_words u16 board   # the bitmap layer's pixels in the video RAM, by its 16-bit words: four 4-bit pixels a word, a character's row of eight two of them (kanji_text_viewer_draw_quarter writes a row at a time: "rvbyt 1A6340(R0), [R12]" 01B1ED)
local kanji_text_viewer_draw_quarter entry R12 bitmap_place bitmap_layer_words   # the quarter's first row (kanji_text_viewer_draw_character: place, + 4, + 800, + 804)
local kanji_text_viewer_draw_quarter 01B1F6 R12 bitmap_place bitmap_layer_words   # "movea.b 100[R12], R12": the next row
param kanji_text_viewer_draw_quarter R12 bitmap_place

# ======== animation numbers by name (the sprite naming) ========
# The animations (sprite_animations) the functions start by a number, where the number is only that animation in
# the function (animation_start's R9, the field it goes into, or the one a handler compares with)
constant time_digits_start 3 TIME_DIGITS
constant stage_result_line_draw 4 PLACE_NUMBER
constant place_count_update 5 PLACE_COUNT
constant rev_meter_update 6 REV_METER
constant shift_up_hint_update E SHIFT_UP_HINT
constant speed_unit_update 10 SPEED_UNIT_KMH
constant speedometer_update 12 SPEED_DIGITS
constant lap_timer_update 2D LAP_TIMER
constant stage_indicator_start 2E STAGE_INDICATOR
constant extend_time_message_start 33 EXTEND_TIME
constant branch_arrow_update 34 BRANCH_ARROW_LEFT
constant branch_arrow_update 35 BRANCH_ARROW_RIGHT
constant checkpoint_board_draw_row 36 CHECKPOINT_BOARD_ROW
constant goal_update 2F5 CONGRATULATIONS
constant race_result_verdict_start 2F6 WINNER
constant race_result_verdict_start 2F7 LOSER
constant race_result_start 2F8 RACE_PLACES
constant race_car_draw 2F CRASH_TEXT                  # crash_text_animation
constant race_car_draw 44 ACCELERATION_SMOKE          # in R12 for race_car_put_frame
constant west_east_panel_update 39 WEST_EAST_PANEL
constant route_map_direction_sign_show 39 WEST_EAST_PANEL
constant title_palm_tree_update 59 PALM_TREE
constant title_board_palms_update 25A TITLE_BOARD_PALMS
constant title_seagull_fly 25B TITLE_SEAGULL
constant title_logo_update 25D TITLE_LOGO
constant title_logo_copy_update 25E TITLE_LOGO_COPY
constant title_logo_stripe_update 25F TITLE_LOGO_STRIPE
constant road_crosser_update 165 SWORDFISH                 # compared with the record's animation
constant traffic_figure_update 165 SWORDFISH
constant traffic_figure_update 185 CYCLIST
constant traffic_figure_update 258 ELEPHANT
constant santa_sleigh_update 3A0 SANTA_SLEIGH
constant santa_sleigh_update 3A2 ORCA
constant goal_parade_rightward_update 3A2 ORCA
constant goal_parade_leftward_update 3A2 ORCA
constant choice_flag_start 1B CHOICE_FLAG
constant stacked_choice_flag_start 1B CHOICE_FLAG
constant car_attendant_run 266 ATTENDANT_WALKING
constant car_attendant_run 267 AUTOMATIC_POSE
constant car_attendant_run 268 MANUAL_POSE
constant car_attendant_run 269 STANDING
constant car_caption_show 26E CAR_CAPTION_LETTERS
constant entry_countdown_start 26F ENTRY_COUNTDOWN_DIGITS
constant waiting_banner_show 28B WAITING_BANNER
constant waiting_banner_show 28D WAIT_A_MINUTE_BANNER
constant route_map_wait_banner_show 28D WAIT_A_MINUTE_BANNER
constant select_car_heading_show 2B5 SELECT_CAR_HEADING
constant automatic_panel_show 2BD AUTOMATIC_PANEL
constant manual_panel_show 2BE MANUAL_PANEL
constant transmission_label_start_automatic 2C1 NOVICE_LABEL
constant transmission_label_start_manual 2C9 GEARS_LABEL
constant car_gears_caption_show 2D1 CAR_GEARS_CAPTION
constant ranking_title_left_update 2D2 RANKING_TITLE_LEFT
constant ranking_title_right_update 2D3 RANKING_TITLE_RIGHT
constant name_entry_letter_update 2DE NAME_ENTRY_FONT
constant ranking_record_character_update 2DE NAME_ENTRY_FONT
constant game_over_banner_show 2F4 GAME_OVER_BANNER
constant route_map_leg_show 306 ROUTE_MAP_LEG
constant car_name_letter_update 346 CAR_NAME_FONT
constant welcome_letter_show 346 CAR_NAME_FONT
local bookkeeping_clear_credits 0113BB R12 bookkeeping_place
param show_title_on_credit R12 screen_block
param wheel_effect_1_surface_2_inner R14 surface
param wheel_effect_1_surface_2_outer R14 surface
param wheel_effect_2_surface_2_inner R14 surface
param wheel_effect_2_surface_2_outer R14 surface
param write_bookkeeping_credits R12 bookkeeping_place
