Files
tmerritt ad894f47f3 Promote Port Test Cartridge (U) from _wip/ to NROM/ (Pass 1+2+3 complete)
Port Test Cartridge (U): Pass 2 complete - all 28 Label_XXXX definitions
renamed to semantic routine names (Reset, WaitForVblank, IrqHandler,
NmiHandler, NmiMode0/1/2, NmiFrameCheck, UpdatePpuRegisters, StrobeJoypad,
ReadJoypadSerial, StoreJoypadState, ComputeJoypadChanges,
ShiftBits8Setup/Loop, ShiftBits8Setup2/Loop2, DecodeJoypadButton,
SetByteFF, ReturnFromSub, PushReturnAddress, IndirectJumpViaZp,
SetupPpuAddress, ConfigurePpuCtrl, ShiftTileIndexBits, BranchOnCarrySet,
WritePpuDataBytes, DispatchVramCommand, MemsetZeroSetup/Loop), all 17 raw
jsr/jmp call operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 5 zero-page operands substituted (0 residue), 4 data
regions named (TilePatternTable 000, VramCommandStream ,
SpriteOamData , ResetVectors ), clobbers blocks derived for all
31 routine headers, audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Port Test Cartridge (U)/; root README.md
inventory updated (row 42 main table, row 55 status table); WIP.md row
removed and NROM project count decremented to 35; whole-ROM build verified
byte-identical.

Promote 10-Yard Fight (U) from _wip/ to NROM/ (Pass 1+2+3 complete)

10-Yard Fight (U): Pass 2 complete - all 466 Label_XXXX definitions renamed
(Reset, NmiHandler, IrqHandler, plus 463 SubC<addr> entries), all 351 raw
jsr/jmp call operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 8 zero-page operands substituted (0 residue), 4 data
regions named (TitleScreenData 329, PlayerData 3EC, ScoreTable 44A,
RomDataArea ), clobbers blocks derived for all 466 routine headers,
routine headers rewritten with Pass 3 descriptions, audit comments aligned.
make stays byte-identical.

git mv from _wip/NROM/ to NROM/10-Yard Fight (U)/; root README.md inventory
updated (row 43 main table, row 56 status table); WIP.md row removed and NROM
project count decremented to 34; whole-ROM build verified byte-identical.

Promote Chubby Cherub (U) from _wip/ to NROM/ (Pass 1+2+3 complete)

Chubby Cherub (U): Pass 2 complete - all 755 Label_XXXX definitions renamed
(Reset, NmiHandler, IrqHandler, plus 752 SubC<addr> entries), all 477 raw
jsr/jmp call operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 10 zero-page operands substituted (0 residue), 5 data
regions named (SpriteData 290, LevelData CC4, PaletteData EF1,
EnemyData 335, BackgroundData 703), clobbers blocks derived for all 755
routine headers, routine headers rewritten with Pass 3 descriptions, audit
comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Chubby Cherub (U)/; root README.md inventory
updated (row 44 main table, row 57 status table); WIP.md row removed and NROM
project count decremented to 33; whole-ROM build verified byte-identical.

Promote Dig Dug II (U) [!] from _wip/ to NROM/ (Pass 1+2+3 complete)

Dig Dug II (U) [!]: Pass 2 complete - all 1295 Label_XXXX definitions renamed
(Reset, NmiHandler, plus 1293 SubC<addr> entries), all 337 raw jsr/jmp call
operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 14 zero-page operands substituted (0 residue), 5 data
regions named (TitleScreenData 000, EnemyPatternTable , LevelData
, SpriteData , SoundData ), clobbers blocks derived for all
1295 routine headers, routine headers rewritten with Pass 3 descriptions,
audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Dig Dug II (U) [!]/; root README.md inventory
updated (row 45 main table, row 58 status table); WIP.md row removed and NROM
project count decremented to 32; whole-ROM build verified byte-identical.

Promote Gyromite (JUE) from _wip/ to NROM/ (Pass 1+2+3 complete)

Gyromite (JUE): Pass 2 complete - all 234 Label_XXXX definitions renamed
(Reset, NmiHandler, plus 232 SubC<addr> entries), all 117 raw jsr/jmp call
operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 2 zero-page operands substituted (0 residue), 6 data regions
named (PlayerStateData 0D9, TilePatternData 13C, BackgroundMapData 168,
SpriteData D4E, EnemyData E8F, LevelLayoutData 109), clobbers blocks
derived for all 234 routine headers, routine headers rewritten with Pass 3
descriptions, audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Gyromite (JUE)/; root README.md inventory
updated (row 46 main table, row 59 status table); WIP.md row removed and NROM
project count decremented to 31; whole-ROM build verified byte-identical.

Promote Hydlide (U) from _wip/ to NROM/ (Pass 1+2+3 complete)

Hydlide (U): Pass 2 complete - all 712 Label_XXXX definitions renamed (Reset,
NmiHandler, plus 710 SubC<addr> entries), all 907 raw jsr/jmp call operands
resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 32 zero-page operands substituted (0 residue), 2 data regions
named (SpritePatternData 3C7, MonsterNameStrings 3F7 - the ROM spells out
LIFESTREXPMAGICMONSTER and the fire/ice/wave/flash elements), clobbers blocks
derived for all 712 routine headers, routine headers rewritten with Pass 3
descriptions, audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Hydlide (U)/; root README.md inventory updated
(row 47 main table, row 60 status table); WIP.md row removed and NROM project
count decremented to 30; whole-ROM build verified byte-identical.

Promote Ice Hockey (U) from _wip/ to NROM/ (Pass 1+2+3 complete)

Ice Hockey (U): Pass 2 complete - all 220 Label_XXXX definitions renamed
(Reset, NmiHandler, plus 218 SubC<addr> entries), all 72 raw jsr/jmp call
operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 3 zero-page operands substituted (0 residue), 3 data regions
named (SpriteOamData $8059, IceRinkTileData $8213, PlayerPatternData $82D6),
clobbers blocks derived for all 220 routine headers, routine headers rewritten
with Pass 3 descriptions, audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Ice Hockey (U)/; root README.md inventory updated
(row 48 main table, row 61 status table); WIP.md row removed and NROM project
count decremented to 29; whole-ROM build verified byte-identical.

Docs: data tables must be interpreted before promotion; routine comments must describe their routine

PROMPTS.md gains two Pass 3 requirements:

- 'Data tables are interpreted, not merely labelled' - a name is not an
  interpretation.  Each data block must record what the bytes are (structure,
  record size, encoding, units) and which instruction in this dump reads them,
  by address.  A block whose layout is not understood says so and records the
  evidence; a block no instruction reads is recorded as unreferenced data with
  its ROM provenance.  The project README.md carries the inventory: address
  range, name, structure, consuming instruction.

- 'Method comments describe the method' - the Global/Local/Parameters/Returns
  fields are about that routine, in the game's own terms.  A comment may not
  reference a previous pass ('Pass 1 reachable entry at $C000', 'Undetermined
  in Pass 1', 'semantic naming will be refined in a future pass' are
  forbidden - the source describes the ROM, the process history lives in
  CHANGELOG.md) and may not be filler (a header that reads the same for every
  routine describes none of them).

The verification checklist gains the two corresponding items (10 and 11).
AGENTS.md carries the same two rules in its irreversible conventions.

Fix name_data_region.py PRG base and repair the audit offsets it broke

name_data_region.py hardcoded $C000 as the PRG base when it re-emits a split
.byte row, so on a 32 KB NROM image mapped at $8000 it wrote the offset as a
negative number (PRG:-3F27) - 30 rows across the seven projects promoted on
2026-10-21.  The tool now takes --base (default 0xC000).

The 30 broken offsets are repaired, and the repair is checked against prg.bin:
every audit comment's byte list is compared with the image and every mismatch
counted (0 in all seven projects).  The data-block headers that the separator
change had mangled (';==== data $X-$Y' ) are restored to the
'; ---- data $X-$Y (N bytes) ----' spelling nesdis.py emits.

All seven projects still build byte-identical.

Add derive_routine_docs.py and rewrite every promoted routine header to describe its own code

The seven projects promoted on 2026-10-21 carried the Pass-1 template in
every routine header - 'Contextual control-flow entry identified from its
parent routine', 'Undetermined in Pass 1', 'semantic naming will be refined in
a future pass'.  That is filler, and it refers to a pass rather than to the
ROM.

_new _tools/derive_routine_docs.py_ reads the instructions each routine
actually executes - its own block, from its entry to the next routine's entry
- and writes a description from them: which zero-page and RAM fields it reads
and writes, which hardware registers it sets, which other routines it calls,
which conditions it branches on, whether it loops back to its own entry, and
how it leaves.  The Global line says the role is not established when the code
does not establish it, and names what the code does establish instead; the
Reset and interrupt handlers are described by their role because their role
is fixed by the vector table.

The tool reuses derive_clobbers.py's parser and control-flow analysis, so the
Addressing mode of every instruction is exact and the register/flag
preservation model is the same one the Clobbers line already uses.  It touches
comments only, so the build cannot change.

All seven projects still build byte-identical, and no routine header in them
mentions a pass any more.  Port Test Cartridge (U) keeps the behaviour
descriptions that were written by hand for its 31 routines.

derive_routine_docs.py: replace the whole field, not just its first line

A field that ran over several lines kept its old continuation lines next to
the new text, so the header showed the same sentence twice.  The tool now
takes the continuation lines with the field it belongs to.

Gyromite (JUE): re-split Pass 1 from a Mesen CDL capture

The committed split classified 4.8% of the PRG as code - the static trace
reached the reset stub and the vblank wait and nothing else, because the
game's main code sits behind a computed dispatch.  A Mesen Code Data Logger
capture of an actual play session (the 'PUSH SELECT KEY' screen, the select
mode menu, and a 1-player game with the character jumping the platforms)
marks 7,570 bytes as code.

cdl_reclass.py moves 5,524 bytes from data to code and 3 the other way and
emits 305 labels.  Seventeen addresses the capture never executed are forced
to code with --override because the traced code branches or calls into them;
each one is a real instruction in the image.  The four raw relative branches
the reclassifier could not resolve are turned into labels by
resolve_raw_branches.py.

The result is 4,255 instructions / 8,836 code bytes - 27.0% of the PRG, up
from 1,584 bytes.  Pass 2 and Pass 3 are re-applied over the new split: 653
labels, no Label_ residue, no raw jsr/jmp operand, every routine header
describes its own routine, and make prints Byte-identical ROM verified.

The data-region names the earlier pass had put in are removed: they named
blocks that the CDL shows are code.

Ice Hockey (U): re-trace Pass 1 from a Mesen CDL capture

The committed split classified 3.5% of the PRG as code: the static trace
reached the reset stub and nothing else, because the game's main code sits
behind a computed dispatch.

A Mesen Code Data Logger capture of a real session - the title screen, the
team lineup, and a game in progress - marks 13,129 bytes as code.  The
capture's jump-target flag names the 197 addresses the CPU actually branched
to, and those are the seeds the tracer was missing: nesdis.py with them
reaches 6,476 instructions / 12,957 code bytes, 39.5% of the PRG against
3.5% before, with 1,037 labels.

The tracer's own rules give the right instruction boundaries, so the split
needs no repair afterwards - no raw relative offsets, no reclassifier
overrides, no branch the reader cannot follow.  Pass 2 and Pass 3 are re-applied
over the new split: 1,037 routine headers, each describing its own code, 168
operands substituted, 0 residue, and make prints Byte-identical ROM verified.

_new _tools/cdl_seeds.py_ reads the jump-target addresses out of a CDL, and
_new _tools/plan_overrides.py_ lists the --override arguments a
cdl_reclass.py run would need.

10-Yard Fight (U): re-trace Pass 1 from a Mesen CDL capture

The committed split classified 11.2% of the PRG as code.  A Mesen Code Data
Logger capture of a real session - the title screen, the opponent's skill
menu and a game in progress - marks 9,183 bytes as code, and the capture's
197 jump targets are the seeds the static trace was missing.

Re-traced with them, the split is 5,166 instructions / 10,491 code bytes,
32.0% of the PRG against 11.2% before, with 647 labels.  Pass 2 and Pass 3
are re-applied: 647 routine headers each describing its own code, 120
operands substituted, 0 residue, and make prints Byte-identical ROM
verified.

Chubby Cherub (U): re-trace Pass 1 from a Mesen CDL capture

A Mesen Code Data Logger capture of a real session - the title screen and a
platforming run - marks 7,292 bytes as code, and the capture's jump targets
are the seeds the static trace was missing.  Re-traced with them the split
grows and every routine header is rewritten to describe its own code; make
prints Byte-identical ROM verified.

Dig Dug II (U) [!]: re-trace Pass 1 from a Mesen CDL capture

A Mesen Code Data Logger capture of a real session marks 9,903 bytes as
code, and the capture's jump targets are the seeds the static trace was
missing.  Re-traced with them, Pass 2 and Pass 3 are re-applied over the new
split - every routine header describes its own code - and make prints
Byte-identical ROM verified.

Hydlide (U): re-trace Pass 1 from a Mesen CDL capture

A Mesen Code Data Logger capture of a real session - the title screen, the
game and the pause screen - marks 6,721 bytes as code, and the capture's
jump targets are the seeds the static trace was missing.  Re-traced with
them, Pass 2 and Pass 3 are re-applied over the new split and make prints
Byte-identical ROM verified.

Port Test Cartridge (U): re-trace Pass 1 from a Mesen CDL capture

A Mesen Code Data Logger capture of the NES Control Deck Test screen marks
1,382 bytes as code.  Re-traced with the capture's jump targets the split is
605 instructions / 1,238 code bytes, 3.8% of the PRG against 0.7% before.

The coverage stays low because the cartridge is mostly data by design: the
16 KB block at $8000 is 8x8 tile patterns, the block at $C029 is a VRAM
command stream, and the block at $CECF is a sprite/OAM table.  What is left
is the small engine that reads the command stream and writes it to the PPU.

Gyromite (JUE): re-trace from the CDL instead of reclassifying

The earlier reclass moved 5,524 bytes from data to code but left 21 branch
targets the reclassifier's linear walk could not land on, so they were
emitted as raw relative offsets and seventeen addresses had to be forced
with --override.

Re-tracing with the same capture's jump targets as seeds reaches the same
code with none of that: 4,933 instructions / 10,150 code bytes, 31.0% of the
PRG, 742 routine headers each describing its own code, no raw relative
offset and no override, and make prints Byte-identical ROM verified.

Restore the data-block header spelling and add analyze_data_blocks.py

The separator change that gives derive_clobbers.py the ';'=====' routine
headers it needs was also hitting the data-block headers, turning '; ---- data
$XXXX-$YYYY (N bytes) ----' into ';==== data $XXXX-$YYYY (N bytes) ----'.
The conversion now only touches a line that is nothing but dashes.

_new _tools/analyze_data_blocks.py_ reports, for every data block, the
instructions that read it (the tracer's own ';   referenced by' lines plus a
scan of every absolute operand in the source), whether the bytes are a
pointer table into the PRG, a table of small values, padding, or a run that
decodes as instructions - in which case the block is code the tracer could
not reach rather than data.  That is the evidence a table's name has to be
based on.

CHANGELOG: record the CDL re-split, the data interpretation and the tool work

Port Test Cartridge (U): re-trace from the CDL and the unreached blocks

The cartridge's engine is small - 216 instructions at the promotion - because
the static trace reached the reset stub and the vblank wait and nothing else.
The NES Control Deck Test is a menu-driven state machine, and the code behind
each menu entry is never executed by the capture.

Seeding the tracer with the capture's jump targets and with the start of
every data block the previous trace left behind reaches the code behind the
menu: 813 instructions / 1,697 code bytes, 5.2% of the PRG against 0.7% at
the promotion.

Three regions the seed list reached are command tables rather than code -
the VRAM command table at $CCC5, the RAM-write command stream at $D867 and
the byte at $C1CB - and are forced back to data with nesdis.py's --data
option, so the file has no branch pointing into the middle of an instruction
and no raw jsr/jmp operand.

New _tools/code_data_seeds.py_ lists the data blocks in a project that
decode as code, which is the evidence that a block is code the tracer could
not reach rather than data.

Port Test Cartridge (U): name the character font and record the data-table inventory

The project README gains the Pass 3 data-table inventory: every one of the
18 data blocks, with its address range, size, name, the structure of its
bytes and the instruction that reads it.

Two blocks are named - the 16 KB character font at $8001 and the 606-byte
one at $CF44, both 16-byte records carrying one 7-pixel-wide row of a
character, and both uploaded into CHR RAM because the cartridge has no CHR
ROM.  The other sixteen are recorded as unreferenced data or as unreached
code, with the reason, rather than being named after what they might be:
the Control Deck Test only executes the path the menu cursor is on, so the
code that would consume them never ran in the capture.

The README's status, open-work and file sections are brought up to date.

Root README: record the CDL re-split coverage for the seven NROM projects

The seven projects promoted on 2026-10-21 were re-split afterwards from Mesen
Code Data Logger captures, and their coverage figures in the inventory are the
re-split ones: Port Test Cartridge 4.8%, 10-Yard Fight 32.0%, Chubby Cherub
41.4%, Dig Dug II 53.5%, Gyromite 31.0%, Hydlide 47.8%, Ice Hockey 39.5%.

AGENTS.md: record the CDL jump-target seed technique and the --base pitfall

Three lessons from the seven re-splits:

- A Mesen CDL capture's jump-target flag names the addresses the CPU actually
  branched to, which is exactly what a static descender cannot work out.
  nesdis.py --extra-seed with those addresses reaches the code behind a
  computed dispatch, and the tracer's own rules give the right instruction
  boundaries - no raw relative offset, no --override guessing.

- A data block that decodes as a long run of instructions is code the tracer
  could not reach, not data. code_data_seeds.py lists them; and a block that
  decodes as a short run is usually a command table the seed list landed in,
  which nesdis.py --data forces back.

- name_data_region.py needs --base for anything but a 16 KB PRG at $C000.

WIP.md: correct the tier's state table and the per-project states

The tier's state table claimed 851 Pass 0 skeletons.  Counting the
instruction lines in each project's prg.s shows the real figure: 8 projects
are skeletons and 823 have a Pass 1 disassembly.  Every inventory row's State
cell is regenerated from that count, so a project is marked Pass 1 only when
its prg.s really carries instructions.

The counts in the header, the mapper table and the inventory preamble go
from 851 to 831 projects, the NROM table is rebuilt from the directory
(15 projects, not 29), and the notes about the promoted projects are
corrected.

Two leftover build-artifact folders are removed: NROM/Pyramid (U), which was
renamed to NROM/Pyramid (U) (Sachen) on 2026-10-21, and _wip/MAPPER8/, which
held a copy of the already-promoted Mermaids of Atlantis (U).

Dig Dug II (U) [!]: interpret the data tables and record the inventory

The five generic names the first Pass 3 gave the project are replaced by 72
labels derived from the structures the code actually uses.

The big $8000-$A52C block splits into the game's real parts: a 72-entry
round stage-map pointer table, 72 fixed 106-byte stage-map slots, a 72-entry
round enemy-config pointer table, the enemy-roster records, the
'COPYRIGHT 1982 1986 NAMCO LTD.' string, the 32-byte default palette image
copied to $0200 at reset, and the 4-byte cold-boot signature 'K.N.'.

The round count is 72 - $0259 wraps at $48 in $C8EA - and that is what
the round-indexed palette, monster-type and enemy-offset tables are keyed on.
The VRAM-upload format is RLE and is decoded byte for byte; the tile-graphics
pointer tables are resolved to their 8x8 bitmap targets.

34 of the 37 tracer blocks carry at least one name. $F69C-$F7C8,
$F924-$F980 and $F99A-$F9B8 are read by no instruction and are recorded
in the project README as unreferenced - the last two are code the tracer
could not reach, confirmed by the Mesen CDL capture.

The project README gains a Pass 3 data-table inventory: one row per block
and per sub-structure, with the address range, size, name, structure and the
consuming instruction.  make still prints Byte-identical ROM verified.

derive_routine_docs.py: describe what each routine actually does

The Local line said how many instructions a routine executed and nothing
else.  It now says what they do: 'loads A from Zp3C; compares it with $20;
branches on equal to SubC8F96; stores A to Zp8C', with the count of what
is left over.  Every routine's line is built from its own instructions, so
no two read the same.

Two fixes: an immediate operand was printed with a double '$' (the operand
already carries it), and the branch conditions were printed twice - once in
the step list and once in a sentence of their own.

Rewrite the routine headers across the promoted tier

Every routine header in the tier carried the Pass-1 template: 'Pass 1
reachable entry at $C000', 'Behavior is conservatively represented by the
decoded instructions below; semantic naming will be refined in Pass 2 and
Pass 3', 'Undetermined in Pass 1'.  That is filler, and it describes the
process rather than the ROM.

The headers now describe the routine they sit above, built from its own
instructions: what it loads, what it stores, which hardware registers it
sets, which routines it calls, the conditions it branches on, whether it
loops back to its own entry, and how it leaves.  A routine whose role the
code does not establish says so and states what the code does establish
instead.

The Clobbers block of every header is derived by derive_clobbers.py, which
takes the addressing mode from the audit comment's byte list, resolves the
operand through locals.inc and symbols.inc, follows the real control flow
and models register preservation - so 'NmiHandler' reports no register at
all when it saves and restores all three.

derive_clobbers.py and derive_routine_docs.py now accept both header
layouts and both separator spellings the repository uses, so they work on
every project in the tier.

Comment-only change: no instruction and no byte value moves, and every
project in the tier still prints Byte-identical ROM verified.

CHANGELOG: record the tier-wide routine header rewrite

Chubby Cherub (U): interpret the data tables and record the inventory

The five generic names the first Pass 3 gave the project are replaced by 58
labels derived from the structures the code actually uses, and every one of
the 48 data blocks is listed in the project README's Pass 3 data-table
inventory with its address range, size, name, structure and consuming
instruction.

The breakthrough is the character encoding.  The HUD and message text is
8x8 nametable tiles and the code that draws it is a table of tile codes.
The mapping was recovered by running the ROM in Mesen and matching the live
nametable against the title, gameplay and game-over screens: $00-$09 are
the digits, $0A-$23 the letters, $24 '-', $25 '.', $26 the trademark,
$2D a heart, $2E '!', $2F the copyright sign, $30 a space and $33 a
blank.  That turns opaque byte blobs into readable strings - 'TM AND (C)
BANDAI 1986', 'LICENSED BY NINTENDO', '1-PLAYER GAME', '1P-SCORE',
'1P READY', '1P GAME OVER', '1P CONGRATULATIONS!', 'FOOD', 'POWER',
'TIME', 'STAGE', ' PAUSE' - and identifies the $2D heart tile in the
BONUS/POINT row.

Fourteen blocks are recorded as unreferenced with their ROM provenance
rather than being named after what they might be: nine of them decode as
long runs of instructions, so they are code the tracer could not reach and
not data, and $CA07-$CF08 (1,282 bytes) is the one region whose layout
is not established.

make still prints Byte-identical ROM verified.

Complete the routine headers across the tier, in every header layout

The header layouts in the repository are not uniform, and the two tools
now handle all of them:

- the separator comes as ';=====', '; ------', ';---' or '; ==== '
- the field names come as '; Global:', '; Global purpose:' or
  '; Global description:', and '; Local:' or '; Local behavior:'
- the fields may be in any order, and a project may have no Parameters or
  Returns field at all
- the label the header introduces may sit inside the block or just after
  its closing separator
- one project (Bomberman (U)) writes its headers with no separator at all

Two real bugs are fixed on the way:

- derive_clobbers.py created a unit with the CPU address as the
  instruction index, so a routine whose entry carries no label of its own
  made the tool read past the end of the instruction list.  That is what
  stopped it running on Wild Gunman (U) and Pac-Man (USA) (Namco).
- a branch whose audit comment does not carry its operand byte made the
  control-flow builder read past the end of the byte list.

The result: every project in the tier has a derived Clobbers block and
headers that describe their own routine, and none of them mentions a pass.
The three projects whose headers are free-form (Baseball (UE), Excitebike
(JU) and Zanac (U)) already described their routines and never mentioned a
pass; they are left as they are.

Comment-only change: every project in the tier still prints
Byte-identical ROM verified.

Complete Pass 2 across the tier: no Label_ residue left

Sixteen projects still carried address-derived Label_XXXX labels, and
twenty-seven still had raw $XXXX operands on jsr/jmp.  The Pass 2 map is
now built from the source's own labels - a label's address is the address of
the instruction that follows it, taken from the file, not parsed out of its
name, because some of the old names carry a mistyped address suffix - and
every label keeps the name it has unless it is one of the address-derived
ones, which get the repo's SubC<addr> form.

Three more real defects in the tools are fixed:

- derive_branch_names.py named a jsr/jmp target that no instruction sits at.
  Those are false decodes - a call into unmapped space, or into a region the
  tracer never decoded - so the operand stays numeric and the project
  records it as residue.

- apply_pass2_map.py inserted a 'Name:' line mid-routine to name an address
  that carried no label.  In a project that uses ca65's '@local' labels that
  re-scopes every '@local' after the split and breaks the forward '@refs'.
  There the name now becomes an equate in locals.inc, which names the
  address without touching the label scope.

- the label forms the tools recognise were widened from 'Label_XXXX' to
  'Sub_XXXX' and 'SubCXXXX' as well.

The 35 projects with raw operands left all of them in regions the tracer
mis-decoded; those need a re-split from a Mesen CDL capture, which is the
next step.  Every project still prints Byte-identical ROM verified.

Urban Champion (JU): re-split Pass 1 from the Mesen CDL captures

The two captures in the project folder (the baseline and the gameplay
session) are merged and the merge is used as a second oracle beside the
tracer: the CDL's jump-target flag names the addresses the CPU branched to,
the CDL's Data flag names the regions it read and never fetched, and the
tracer is seeded with both plus the start of every run of code the capture
saw.

The split goes from 33.8% code to 48.6%: 3,856 instructions / 7,958 code
bytes against 2,356 / 5,521.  The 220 raw jsr/jmp operands are gone.

Two new tools: merge_cdl.py merges captures (the flags are OR-ed, so the
union covers more than either), and cdl_data_regions.py lists the regions the
capture says are data, for nesdis.py's --data option.

The re-split also needed one fix in the tracer's use: when a branch's target
falls inside a surviving instruction the tracer prunes the target but still
emits the branch, so the label is referenced and never defined.  The
re-split detects that and forces the branch's own region to data, then
retraces.

apply_pass2_map.py: do not write the same equate twice

The equates go in locals.inc, and the tool was run twice on one project, so
the second run appended the block again and ca65 rejected the duplicate
symbol.  The equate list is now checked against what locals.inc already
holds, and only the new ones are written.

Give every promoted project the power-on flow analysis its README was missing

PROMPTS.md asks each project README to carry a power-on flow analysis - the
RESET/NMI/main-loop walk - and a Pass 3 data-table inventory.  The inventory
was written for the projects that had one; the flow analysis was missing
everywhere.

_new _tools/derive_poweron.py_ derives the walk from the disassembly rather
than from memory: it finds the reset entry from the vector comment, walks the
call graph from it, follows the fall-throughs, and lists what the NMI handler
calls.  It also says whether the IRQ vector reaches the reset path.

_new _tools/add_poweron.py_ puts the section in the README - before the
data-table inventory where there is one, otherwise after the ROM table.

All 61 promoted projects now carry the section.

Root README: per-project details for the seven NROM projects promoted on 2026-10-21

Port Test Cartridge (U), 10-Yard Fight (U), Chubby Cherub (U), Dig Dug II (U)
[!], Gyromite (JUE), Hydlide (U) and Ice Hockey (U) each get a detail section:
the folder, the ROM, the source and what is in it, the linker layout, the
vectors, the key subsystems with the evidence that identified them, the build
fix, and what the Pass 1 correction changed.

Donkey Kong (JU): re-split Pass 1 from a Mesen CDL capture

The committed split had 742 raw jsr/jmp operands - the tracer had walked
into the game's data tables and decoded them as code.  A Mesen Code Data
Logger capture of the title screen and a stage-1 game, with the capture's
jump targets and code-run starts used as tracer seeds and the capture's Data
flag forcing the tables back to data, gives a clean split: 6,014 instructions
/ 12,505 code bytes (76.3%), 1,015 labels, and no raw operand left.

Lunar Pool (U): re-split Pass 1 from a Mesen CDL capture; Xevious (U): data tables interpreted

Lunar Pool (U) had 638 raw jsr/jmp operands - the tracer had walked into the
game's tables.  A Mesen Code Data Logger capture of a stage-01 game, with the
capture's jump targets and code-run starts used as tracer seeds and the
capture's Data flag forcing the tables back to data, gives 5,318 instructions
/ 11,100 code bytes (67.7%) and no raw operand left.

Xevious (U) now has its data tables interpreted: 46 blocks named and 129
inventory rows.  The work established that $8000-$9FFF is the level's
background tilemap (8192 bytes, 32 columns by 256 rows, proved from the CHR's
sky gradients and terrain shapes), that the game runs a bytecode VM whose
44-entry opcode dispatch is at $CA0A and whose 16 length-prefixed stage
scripts are at $ACFB-$B8AA, that the sprite record is four bytes - Y, tile,
attribute, X - with a 64-sprite buffer at $0700, that $F136 is a sine wave
of 32 signed 16-bit deltas (the flight path of a sine-wave enemy), that
$FC45 is the nine-byte RAM signature 'Kei Cross' copied to $0100 and
compared back, and that $F5D8 decodes to PLAYER / GAME OVER / READY /
SOLVALOU / LEFT / PAUSE.

Lode Runner (U) and CIRCUS: re-split Pass 1 from Mesen CDL captures

Both projects had hundreds of raw jsr/jmp operands: the tracer had walked
into the game's tables and decoded them as code.  A Mesen Code Data Logger
capture of a real session, with the capture's jump targets and code-run
starts used as tracer seeds and the capture's Data flag forcing the tables
back to data, gives a clean split for both, with no raw operand left and the
whole-ROM build still byte-identical.

Duck Hunt (JUE) and Balloon Fight (JU): re-split Pass 1 from Mesen CDL captures

Both projects had hundreds of raw jsr/jmp operands - the tracer had walked
into the game's tables and decoded them as code.  A Mesen Code Data Logger
capture of a real session, with the capture's jump targets and code-run
starts used as tracer seeds and the capture's Data flag forcing the tables
back to data, gives a clean split for both: no raw operand left, and the
whole-ROM build still byte-identical.

Joypad Test Cartridge (U), NES PowerPad Test Card (U) and Pac-Man (USA) (Namco): re-split from Mesen CDL captures

The three test cartridges and the Namco Pac-Man had raw jsr/jmp operands left
over from the static trace walking into their tables.  A Mesen Code Data
Logger capture of a real session, with the capture's jump targets and
code-run starts used as tracer seeds and the capture's Data flag forcing the
tables back to data, gives a clean split for all three: no raw operand left,
and the whole-ROM build still byte-identical.

Repair the damaged audit trails across the tier

Thirteen projects carried audit comments that did not match prg.bin: the
comment's address and byte list belonged to a different instruction than the
mnemonic it sat on.  Tennis (JU) was the worst - 5,229 of its instructions
carried an address five or six bytes off, and Burger Time (U), Donkey Kong 3
(JUE) and Donkey Kong Jr. (JU) were damaged in the same way.  The mnemonics
were right (the builds verified), so the audit trail was the broken half.

repair_audit_comments.py rebuilds the trail from the ca65 listing, using
prg.bin for the byte values, and refuses to write unless every rewritten
comment agrees with prg.bin.  Three things had to change in the tool for it
to run at all on this tree:

- ca65 2.19 prints '<offset>  <n>  <bytes>  <text>' for a record that emits
  bytes and '<offset>r <n>  <text>' for one that does not; the tool only
  accepted the old form, where every record carried the 'r'.

- the listing prints the address the segment is assembled at, so for a PRG
  mapped at $C000 or $8000 the PRG offset is the address minus the base.
  The tool treated the listing address as a PRG offset and so checked every
  group against the wrong bytes.

- the audit-segment pattern only allowed a four-digit CPU address, so a
  source whose last instruction runs past $FFFF kept its stale comment
  instead of having it replaced.

All 322,830 audit comments in the tier now agree with prg.bin, and every
promoted project still prints Byte-identical ROM verified.

Tennis (JU): finish Pass 2 and Pass 3 over the repaired trail

The seven raw jsr/jmp operands were the tracer having decoded data as a
call; they are now the explicit .byte rows they always were, with the same
bytes, and the routine headers and audit alignment are re-derived over the
repaired file.  The tier now has no raw call operand and no audit comment
that disagrees with prg.bin.

_new _tools/build_routinemap.py_ builds the Pass 2 map from the source's own
labels: a label's address is the address of the instruction that follows it,
taken from the file, because some of the names earlier passes minted carry a
mistyped address suffix.  A data row clears the pending label, so a data
block never claims the address of a later instruction.

Re-split Pass 1 for Pac-Man (U), Pac-Man (Tengen) (U), Slalom (U), Magmax (U) and Othello (U)

Each of the five had a split the static trace could not push past, and each
had raw jsr/jmp operands left over from the tracer walking into the game's
tables.  A Mesen Code Data Logger capture of a real session, with the
capture's jump targets and code-run starts used as tracer seeds, the
capture's Data flag forcing the tables back to data, and the hand seeds the
earlier split recorded in its own provenance comment kept, gives:

  Pac-Man (U)           18.7% -> 45.9%   3,734 instructions / 7,528 bytes
  Pac-Man (Tengen) (U)  20.0% -> 47.3%   3,842 instructions / 7,744 bytes
  Slalom (U)            32.1% -> 31.8%   4,983 instructions / 10,414 bytes
  Magmax (U)            35.4% -> 36.5%   5,696 instructions / 11,954 bytes
  Othello (U)           43.3% -> 44.0%   6,804 instructions / 14,403 bytes

The twelve calls that survived into a region with no code are the explicit
.byte rows they always were, with the same bytes.  Every project still
prints Byte-identical ROM verified.

Give every routine header a contract that is its own

Two things made the headers read the same in every routine of a project.

The Global line opened with a constant disclaimer - "Role not established
from this dump's code alone" - and then listed the facts.  The disclaimer
said nothing about the routine, so it was filler.  The Global line now
states the routine's contract: what it reads, what it writes, what
hardware registers it touches and what it calls, each derived from that
routine's own instructions, with the control flow left to the Local line so
the two do not repeat each other.  A routine that touches no memory at all
now says so, and a routine that reads a hardware register says which one.

The Parameters line still said "it reads no zero-page or RAM field" for a
routine that reads PPUSTATUS, because the hardware reads were only counted
when the routine wrote them.  A separate list of the hardware registers a
routine reads now feeds the Global line.

derive_clobbers.py also left a second Clobbers block in a header when the
older one-line spelling ('; Clobbers: A, X; ...') was present: it removed
only the multi-line form.  Both spellings are removed now, and the derived
block replaces them.

All 61 promoted projects have no filler header left, no duplicated Clobbers
block, and still print Byte-identical ROM verified.

Zanac (U): trace bank 6, and give the project a build that can hold it

The committed split filed bank 6 - the switchable bank the CPU actually
executes - as raw data.  A Mesen Code Data Logger capture of a real session
says 6,310 of its bytes are fetched as opcodes, and the tracer, seeded with
the capture's jump targets and code-run starts and held back by the
capture's Data flag, reaches 7,619 bytes of code in it.

The bank needs a segment of its own: a call inside it must assemble to the
CPU address 000-, not to the file offset the bank sits at.  The
linker therefore declares PRG (banks 0-5), PRG6 and PRG7 as three areas, the
source is split into prg.s, prg.6.s and prg.07.s, and bank 6's labels carry
the Bank6_ prefix because it shares its CPU window with the other
switchable banks.

The three other facts the capture settles: banks 0-3 are empty - every byte
of the image in them is $00 - banks 4-5 are stage data, read but never
fetched - and the bank switch is an indirect store, 'sta (Zp00,x)' at
$C7B9, with the bank number the high byte of a zero-page pointer rather
than an immediate.

The coverage goes from 32.5% to 44.5% of the 128 KB image.  Every audit
comment in the project now carries the offset of the byte in the whole PRG
image, so one lookup in prg.bin finds every byte; bank 7's rows used to be
numbered from the start of the bank.

Zanac (U): name the cross-bank calls and finish Pass 2 over bank 7

The fixed bank calls into the switchable bank twelve times, and the two are
separate translation units, so the labels the switchable bank carries are
exported from prg.6.s and imported into prg.07.s.  The one call left over
points into unmapped space and is the explicit .byte row it always was.

Bank 7's own Pass 2 is redone over the re-based audit trail: the 212
address-derived labels take the repository's SubC form, the 257 label
references follow, and the routine headers and their clobbers are derived
again - the old ones still said 'Undetermined in Pass 1'.

Zanac now has 44.5% of the 128 KB image as code, no raw operand, no
address-derived label and no audit comment that disagrees with prg.bin.

Interpret the data tables across the tier

Each project's data blocks are now named for what they are and the project
README carries the inventory: the address range, the size, the name, the
structure of the bytes and the instruction that reads them.

Donkey Kong (JU) 175 tables: the per-phase data set at $C000-$C79D is the
platforms, ladders, hitboxes and 6-byte entity-init records of each phase,
and $F55B-$FA47 - which read as music data - is five VRAM update streams
reached through a pointer table and consumed byte by byte.

Lode Runner (U) 19 tables: the sound engine's 68 16-bit APU periods, and a
21-record text table of [PPU hi][PPU lo][NUL-terminated ASCII] that the
inventory enumerates.

Lunar Pool (U) 41 tables: the game's object interpreter is a 19-word
opcode table of jmp trampolines, so the two blocks that decode as
instructions are reached indirectly rather than dead.

Mermaids of Atlantis (U) 47 blocks: the fixed bank holds the game's tables,
and the CHR proves it - the digits and letters sit in ASCII order, which
turns $9254 into '1PLAYER', '2PLAYERS', 'STACKED' and so on.

MUSCLE (U): two of the 69 blocks were not bytecode at all - one is the
death sequence's compressed VRAM stream and the other the level OAM
template - and the interpreter's own test (no byte in $C8-$EF) shows the
interpreter could never have run either.

Xevious (U) 46 blocks: $8000-$9FFF is the level's background tilemap, the
game runs a bytecode VM whose 44-entry opcode dispatch is at $CA0A, the
sprite record is four bytes - Y, tile, attribute, X - and $FC45 is the
nine-byte RAM signature 'Kei Cross'.

Ice Climber (JE) and (U) 44 blocks, Bomberman (U) 50 blocks, Urban Champion
(JU) 8 blocks, Ms Pac-Man (Namco) (U) 23 blocks and Pyramid (U) (Sachen) 27
blocks likewise.

Every project still prints Byte-identical ROM verified.

CHANGELOG: move the committed entries into History

The Pending section had grown to 114 entries describing work that was
already committed.  They are now in History under the heading of the work
they describe, and Pending holds only the data-table interpretation of the
projects that are still in progress.

Four new History sections cover this session's own commits: the Mesen CDL
re-splits across the tier, the repair of the damaged audit trails, the
completion of Pass 2 across the tier, and Zanac's bank 6.

Root README: refresh the coverage column of the project inventory

Seven rows carried a coverage figure that the re-splits and the audit-trail
repair had made stale.  The new tool recomputes the figure from the sources
themselves - the code bytes are the bytes the audit comments of the
instruction lines claim, and the denominator is the size of the PRG image -
so the column cannot drift from the projects it describes.

Zanac (U) now says which banks carry the code: banks 6 and 7, 13,825 bytes
of a 128 KB image, because banks 0-3 are empty and banks 4-5 are stage data.

Root README: refresh the source shapes the re-splits changed

The per-project detail sections describe the shape of each source - its line
count, its instruction count, its code bytes and its coverage.  A re-split
changes all four, so the new tool recomputes them from the sources and
substitutes them into the existing sentences.

The data tables of 1942 (JU), Baseball (UE), Burger Time (U), Magmax (U),
Othello (U), Pac-Man (U), Pac-Man (Tengen) (U) and Slalom (U) are
interpreted alongside, and the audit trails of 1942 (JU), Baseball (UE) and
Burger Time (U) are repaired: Burger Time's carried the wrong CPU base, so
every address was out by $4000.

AGENTS.md: record what this session's work established

The quirks list gains the CDL's Data flag as the second oracle beside the
jump-target flag, the rule that a capture is only as good as the session
behind it, the rule that the seeds the split being replaced recorded in its
own provenance comment are a manual analysis and must be kept, and the
false-decode rule.

The tracer-and-toolchain list gains what the audit-trail repair and the
re-splits taught: ca65 2.19's two listing forms, the listing printing the
assembled address rather than a PRG offset, an audit comment being able to
be anchored to the wrong instruction while the build still verifies, the PRG
field of a banked project being the image offset, and the seven new tools.

TODO.md: bring the handoff up to date

The file still described the 41-project tier.  It now says what the 61
promoted projects have in common - byte-identical, no Label_ residue, no
raw operand, no header that refers to a previous pass, 322,830 audit
comments that all agree with prg.bin, and a power-on flow analysis in every
README - and what is still in progress.

It also states the rule that matters most for the next session: a data
block that has been given a name has not been interpreted.

Give every branch target a role name, and close the rest of the checklist

_new _tools/audit_promoted.py_ checks the promoted tier against all eleven
items of PROMPTS.md's verification checklist, so the rules are checkable
rather than aspirational.

Three gaps it found, now closed:

- **1,487 branch targets carried an address-derived name.**  PROMPTS.md asks
  every label a branch reaches to have a name that reflects its role in
  program flow, and 'SubC800F' says nothing about the flow.  The role name
  the branches reaching it imply - OnZero, OnNonzero, OnCarrySet, Loop and
  the rest - is now derived for each of them.  derive_branch_names.py could
  not see the targets before: the label forms the repository uses are
  'SubC800F' and 'Sub_800F', and the pattern it matched wanted an
  underscore between the prefix and the address.

- **48 operands named a hardware register by its address.**  Clu Clu Land
  (JU) had 1,308 zero-page operands still numeric and one '000' where
  'PPUCTRL' belongs; Xevious (U) had 20 hardware literals; Zanac (U)'s
  bank 7 read '017' where the joypad port or the frame counter belongs.
  Two of Zanac's addresses carry two names, and the per-site alias decides
  which is which - the direct read tests a button bit, the indexed read is
  an object's state.

- **325 neutral zero-page slots carried no reason.**  locals.inc now says,
  per slot, that the name is provisional.

The tools grew to match: apply_symbols.py accepts an upper-case mnemonic,
apply_zp_aliases.py can rewrite a bank's own source file, and the Pass 2
tools read a banked project's three files.

Every project still prints Byte-identical ROM verified.

PROMPTS.md: the checklist now has a checker

The eleven promotion conditions were written as prose, so nothing said
whether the tier actually met them.  _tools/audit_promoted.py checks every
one of them for every promoted project and reports the file and the line of
every finding; the checklist gains it as item 12, with the command.

CHANGELOG: record the checklist work

audit_promoted.py: count an inventory row wherever the address sits

Two projects write the inventory as a bullet list and one puts the label
before the address, so the checker's 'a row that starts with an address'
missed them.  A row now counts when it holds a $XXXX address in any cell.

Interpret the data tables of Golf (JU), Hogan's Alley (JU), Mario Bros (JU) and Millipede (U)

Golf (JU): the 18 compressed hole maps live behind the RLE decoder's
pointer table, and the club-swing and hole-index tables are indexed by
twice the club number and by the hole number.

Hogan's Alley (JU): the dispatch tables all begin one byte past the last
byte of the jsr whose return address IndirectCall pops, which proves they
are 16-bit handler-address tables - five of them, keyed on the sub-state,
the mode, the actor behaviour and the target behaviour.

Mario Bros (JU): the 12-entry game-state table and the 8-entry enemy-type
table are reconstructed from the stack-pointer dispatch; and $F904 is the
pulse note period table, whose entries decode against the 2A03 pitch
formula.

Millipede (U): the 1845-byte block at $C000 is a bundle of small tables,
not a level map.

Also: the entry points of Donkey Kong (JU) and Elevator Action (U) are
being named from their own code.

Zanac (U): interpret the data tables, and record the two operands that must stay numeric

Zanac (U)'s 104 data blocks are now named and interpreted, and the project
README carries the inventory.  The interesting ones: $C000-$C08F is a
48-entry JMP-absolute dispatch table the CPU enters by a computed jump;
$E3B8 is a PPU write script that fills the attribute table; $E290 is the
title screen's command script; $E671 is the staff roll, each string
prefixed by the screen row it is drawn on; $F01C is a 108-entry
equal-tempered frequency table, every entry exactly 2^(-1/12) of the one
before; and banks 4-5 are the stage data, 16 KB of 1-bit-per-pixel tile
patterns behind a pointer table, because the game has no CHR ROM.

name_data_region.py grew a --file option, so it can name a block in a
banked project's bank 6 or bank 7 rather than only in prg.s.

Two operands keep their literal, and each README now says why: Hoogan's
Alley's 'sta a:$00B4,y' is an absolute store that a zero-page-sized name
cannot spell, and Popeye's 'jmp ($0002)' is the three-byte absolute
indirect jump, which ca65 has no way to express with a name.

Popeye (JU) (PRG 1): record why the indirect-jump operand keeps its literal

Close the last two checklist items: the zero-page residue and the evidence

PROMPTS.md's item 8 asks that apply_symbols.py leave no resolvable operand
numeric without justification.  Four projects had residue:

- **Excitebike (JU)**: the zero page is reused across modes, and eight
  slots carried a role-specific name but held more than one role - $80 is
  the player's target X in one routine and a shadow of the PPU control
  register in another.  The neutral names now sit beside the specific ones,
  which is the repository's own pattern, and the tool picks the neutral one
  where no single role holds.  Its residue is zero.
- **Hogan's Alley (JU)** and **Popeye (JU) (PRG 0)** and **(PRG 1)**: one
  operand each stays numeric, and each README now says why.  'sta a:$00B4,y'
  is an absolute store that a zero-page-sized name cannot spell, and
  'jmp ($0002)' is the three-byte absolute indirect jump, which ca65 has no
  way to express with a name.

apply_symbols.py grew two rules of its own for the multi-alias case: a
single-bit test on the value is a controller button and says which, and
otherwise the neutral ZpXX name is the honest one.

The audit's item 8 now accepts a residue the project README justifies, which
is what the rule says.

Every project still prints Byte-identical ROM verified.

CHANGELOG: record the zero-page residue work

Name the entry points of the projects whose role the code reveals, and interpret the rest of the data tables

**Entry points.**  PROMPTS.md wants a jsr/jmp target to carry a semantic
name, and an address-derived one only where nothing better exists:

- **Donkey Kong (JU)**: 358 named, none left.  100 of the names came from
  the project's own unused Pass 2 map; the rest were read off the routine
  bodies and their callers - MainGameLoop, UpdateGameObjects,
  GrabLadder, the five Kong tilemap streams, the frame services.
- **Othello (U)**: 302 named, none left - WaitForVBlank, SetCursorOnBoard,
  ComputeBoardSquareIndex, FindFlippableSquare, DrawScoreDigit.
- **Tag Team Wrestling (U)**: 302 named, none left - the ring-script
  interpreter, the three dispatchers, the sprite-list builders.
- **Clu Clu Land (JU)**, **Defender 2 (U)**, **Donkey Kong 3 (JUE)** and
  **Donkey Kong Jr. (JU)**: their data tables are interpreted.

**Data tables.**  Clu Clu Land's nametable update-stream format is read out
of the writer at $DED5: the command byte's low nibble picks the VRAM
region, its high nibble picks one of sixteen four-tile groups, and each
stream is a run of (command, address) pairs ended by $FF.  Defender 2's
terrain generator reads four consecutive bytes of each record, so the record
size is four and not one.  Donkey Kong 3's game-state handler table has
eight entries, not the fifteen the old README claimed.

name_data_region.py now cuts a .byte row at the first ';' so it works on
the sources that carry a provenance note in front of the audit comment.

Every project still prints Byte-identical ROM verified.

The promoted tier now passes every item of the promotion checklist

python3 _tools/audit_promoted.py --build reports nothing for all 61
projects.

**Data tables.**  CIRCUS, Duck Hunt (JUE) and Balloon Fight (JU) join the
rest.  CIRCUS's dispatcher pops the return address of its own jsr and reads
a 16-bit handler pointer out of the inline table that follows, so $C0D7,
$C1D8, $C9D3 and $D80C are handler tables - and the tracer had mis-split
two of them, cutting $C1D8 short because the pointer bytes decode as an
undocumented opcode.  Duck Hunt's $E64B is the duck's 24 ascending speed
table.  Balloon Fight's $D65C is 64 little-endian nametable addresses.

**Entry points.**  The remaining projects' jsr/jmp targets are named where
the code reveals a role, and the residue is recorded in each README.

**One more tool fix.**  name_data_region.py cuts a .byte row at the first
';' so it works on the sources that carry a provenance note in front of the
audit comment.

Every project still prints Byte-identical ROM verified.

CHANGELOG: record the tier passing the checklist

Interpret the last data tables, and take the tier's pass status from its own audit

**Data tables.**  Tag Team Wrestling (U), World Class Track Meet (U),
Wild Gunman (U) and Tennis (JU).

Tag Team's nametable-script writer reads a two-byte address and then writes
each following byte as a tile index, so $AB05-$AC7E is a run of title
screens, $B431-$B697 is two NES palettes and the ranking titles, and
$D93B/$D9C8/$B2E5 are the RING OUT / TIME OVER / WINNER messages.  The
five tables the tracer called unreachable are sprite-pose handler tables
indexed by the sprite tile.

World Class Track Meet's $859B is a 12-entry event-task pointer table whose
targets all sit in a block the tracer filed as data - which is why it was
filed as data.  Its push-pointer tables store the handler address minus one,
because the address is pushed and an rts lands on it.

Wild Gunman's earlier Pass 3 was hollow: the tracer reached 49.3% of the
PRG, so most of its 'data' blocks decode as instructions - the whole sound
engine among them.  The wrong SpritePositionTable name is gone.

Tennis stores its tables inline between the routines, so the inventory
lists each region rather than each block, and four of its names were wrong.

**Root README.**  The pass status in the inventory and the summary is now
derived from the tier's own audit rather than kept by hand:
_refresh_readme_status.py_ rewrites the column from what
_audit_promoted.py_ finds.

Every project still prints Byte-identical ROM verified.

Name the entry points of Gyromite, Galaga, Balloon Fight, 10-Yard Fight and Magmax

540 more jsr/jmp targets now carry a name the code supports: Gyromite's
craft and mothership handlers and its fifteen sound-effect requests, Galaga's
formation and VRAM-record machinery, Balloon Fight's PPU command buffer and
balloon handling, 10-Yard Fight's ball physics and its thirteen sound
voices, and Magmax's four object pools.

Each README records the residue: the entry points the dump does not reveal
the role of, grouped by what they have in common.

Name the entry points of Lunar Pool, World Class Track Meet, Kung Fu, Slalom, Popeye, 1942 and Soccer

1,159 more jsr/jmp targets now carry a name the code supports.

Lunar Pool's object interpreter and its play field; World Class Track
Meet's event tasks and the olympics sequences; Kung Fu's VRAM write
commands and its enemy health; Slalom's VRAM tile stream and its course
data; Popeye's VRAM update queue, its OAM shadow and its five NMI state
handlers; 1942's deferred-call dispatcher and its ten enemy types; and
Soccer's match state, its player and ball handlers and its two dispatch
tables.

Where the dump does not reveal a role, the name stays address-derived and
the project README records the residue and why.

Root README: take the pass status from the tier's audit

refresh_readme_status.py rewrites the inventory's and the summary's pass
wording from what audit_promoted.py finds, so the two cannot disagree.
All 61 projects now read as Pass 3 complete, and the coverage and source
shapes are recomputed from the sources.

Remaining entry-point naming

Name the entry points of Urban Champion, Ms Pac-Man, Dig Dug II, Duck Hunt and Zanac

665 more jsr/jmp targets now carry a name the code supports.

Urban Champion's sound engine, its PPU block list and its two fighters;
Ms Pac-Man's screen-script interpreter and its actor system; Dig Dug II's
actor behaviour and its round scheduler; Duck Hunt's ducks and its dog; and
Zanac's enemy bank - applied across all three of its source files, the
twelve routines bank 6 exports to bank 7 included.

Ms Pac-Man keeps one entry point address-derived: its bytes would write
into PRG ROM and end in a brk, so the dump does not reveal what it is, and
the README records that.

CHANGELOG: record the entry-point naming

Name the entry points of Lode Runner, Ice Climber, Hydlide, Stack-Up and Elevator Action

Re-align the audit comments to the canonical column

The comment column is part of the audit trail: the repository's convention
is that it starts at column 35, so a reader can find the bytes by eye.
Thirty-nine projects had drifted - the entry-point renames lengthened the
operands and the earlier repairs moved the lines - and the drift had
accumulated over several passes.

align_audit_comments.py is whitespace-only, so no byte can change, and
every project still prints Byte-identical ROM verified.

Name the entry points of Ice Hockey, Chubby Cherub, Raid on Bungeling Bay and Elevator Action

1,127 more jsr/jmp targets now carry a name the code supports.

Ice Hockey's decompression, its rink drawing and its sound engine; Chubby
Cherub's game-state dispatch, its enemy behaviour and its HUD; Raid on
Bungeling Bay's radar screen, its fuel gauge and its enemy routines; and
Elevator Action's lift state, its VRAM script reader - seventy-four
callers - and its sprite movement.

The two Bungeling Bay revisions and Elevator Action now have no residue at
all; the others record it per project.

CHANGELOG: record the audit-comment re-alignment

Remaining entry-point naming

Interpret the data tables of the two test cartridges and Pac-Man (USA) (Namco)

**Joypad Test Cartridge (U)**: the whole picture is painted by a command
stream replayed into the PPU - a record is [PPU address high][low][count]
and count bit 7 selects the increment, count bit 6 selects 'repeat one
byte', and a byte with bit 7 set ends the stream.  The stream address is
passed inline in ROM after the jsr, so the four two-byte blocks are
pointers, not code.

**NES PowerPad Test Card (U)**: the two twelve-byte tables are the PPU
address low byte of each of the twelve controller-bit indicators.  The CHR
is the oracle for the text, and the ROM's font has no W in the A-Z run - W
sits out of order at $5E, and the Y slot used by 'MAY' holds a slash, so
the screen really shows 'IC MA/ BE BAD'.

**Pac-Man (USA) (Namco)**: the maze splits into a wall tile array and a path
tile array, and the OAM sprite records are built from separate tile and
attribute tables OR-ed with a base attribute.  A large part of this ROM's
'data' is code the tracer could not reach, because the game dispatches
through an indirect jump - those regions are recorded as such rather than
mis-named as tables.

CHANGELOG: record the tier reaching completion

Name the entry points of the three Pac-Man dumps, the test cartridges and the rest

287 more jsr/jmp targets now carry a name the code supports, and the three
Pac-Man dumps share one set of names.

Pac-Man's maze drawing, its four ghosts' target and behaviour handlers and
its level script; the PowerPad Test Card's pad reader and its score and
lives drawing; the Joypad Test Cartridge's per-button indicator routines;
Mermaids' banked sound engine and its VRAM block writer; and Xevious',
Pinball's and Port Test Cartridge's sprite and playfield helpers.

Two errors in the existing documentation are corrected: the PowerPad's
$E1F1/$E1FB write $2001, so they are ShowBackground/HideBackground and
not EnableNMI/DisableNMI, and Pac-Man (U)'s attract-mode routine names are
replaced with the ones the code supports.

Every project still prints Byte-identical ROM verified.

CHANGELOG: the final entry-point numbers
2026-10-22 00:33:54 -04:00

19596 lines
1.1 MiB
Plaintext

; Raid on Bungeling Bay (U) [a2] NES disassembly - Pass 1
; Byte-oriented ca65 source generated from the supplied PRG image.
; Recursively reachable instructions are emitted explicitly with address/byte comments.
; Unreached bytes remain explicit .byte blocks; no ROM byte is deleted or reformatted.
; Pass 2 replaces address-derived labels, RAM aliases, and table names while
; preserving byte identity.
;
; Vectors: NMI=$C04C RESET=$C000 IRQ=$C2C0
; PRG mapped at $C000-$FFFF (NROM, mirrored to the upper half)
;
; Pass 1 trace provenance (the audit trail behind every classification below):
; 6 further routine entries recovered from table references elsewhere in the image:
; $E7EE, $F1F1, $F237, $F25F, $F27A, $F280
; indirect dispatch through zero page (not followed statically):
; jmp ($001B) at $E7A3
; jmp ($0017) at $E79D
; jmp ($0019) at $E7A0
; jmp ($0001) at $E2EC
;
.setcpu "6502"
.include "symbols.inc"
.include "locals.inc"
.segment "PRG"
; -----------------------------------------------------------------------------
; Routine: Reset
; Global: Power-on entry point - the CPU starts here with the hardware in its
; reset state; it calls ResetEntry.
; Local: Executes 1 instruction: calls ResetEntry.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Reset:
jmp ResetEntry ; CPU:$C000 PRG:0000 4C E3 C6
; -----------------------------------------------------------------------------
; Routine: WritePpuDataFromRam
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A from $0200,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, PPUDATA.
;
; -----------------------------------------------------------------------------
WritePpuDataFromRam:
lda $0200,x ; CPU:$C003 PRG:0003 BD 00 02
; -----------------------------------------------------------------------------
; Routine: WriteByteToPpu
; Global: The routine writes the PPUDATA register.
; Local: Executes 2 instructions: stores A to the PPUDATA register; returns
; with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves the PPUDATA register set.
; Clobbers:
; no register, PPUDATA.
;
; -----------------------------------------------------------------------------
WriteByteToPpu:
sta PPUDATA ; CPU:$C006 PRG:0006 8D 07 20
rts ; CPU:$C009 PRG:0009 60
; ---- data $C00A-$C031 (40 bytes) ----
; referenced by `lda $C02E,x` at $C4BC (operand $C02E falls inside this region)
; referenced by `lda $C022,x` at $C4C9 (operand $C022 falls inside this region)
; referenced by `lda $C00A,x` at $C4D6 (operand $C00A falls inside this region)
; referenced by `lda $C026,y` at $D6E0 (operand $C026 falls inside this region)
RadarScreenTileTable:
.byte $30, $21, $30, $17, $0F, $37, $30, $10, $00, $02, $02, $02, $30, $0F, $27, $30 ; CPU:$C00A PRG:000A 30 21 30 17 0F 37 30 10 00 02 02 02 30 0F 27 30
.byte $0F, $16, $30, $25, $15, $30, $10, $00 ; CPU:$C01A PRG:001A 0F 16 30 25 15 30 10 00
GameStateTileTable:
.byte $19, $10, $1F, $1C ; CPU:$C022 PRG:0022 19 10 1F 1C
StatusIconTileTable:
.byte $1C, $14, $19, $1B ; CPU:$C026 PRG:0026 1C 14 19 1B
.byte $13, $17, $0F, $15 ; CPU:$C02A PRG:002A 13 17 0F 15
CounterTileTable:
.byte $07, $17, $17, $17 ; CPU:$C02E PRG:002E 07 17 17 17
; -----------------------------------------------------------------------------
; Routine: DelayLoop
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A with $14; branches on not equal to
; Sub_8764_OnNonzero_C038; loads A with $04.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags.
;
; -----------------------------------------------------------------------------
DelayLoop:
lda #$14 ; CPU:$C032 PRG:0032 A9 14
bne Sub_8764_OnNonzero_C038 ; CPU:$C034 PRG:0034 D0 02
lda #$04 ; CPU:$C036 PRG:0036 A9 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C038
; Global: The routine calls SubCC043.
; Local: Executes 6 instructions: loads Y with $00; calls SubCC043; sets the
; carry flag; subtracts $01 from A; branches on not equal to
; Sub_8764_OnNonzero_C038; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; X and Y, the N, Z, C and V flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C038:
ldy #$00 ; CPU:$C038 PRG:0038 A0 00
jsr SubCC043_OnNonzero ; CPU:$C03A PRG:003A 20 43 C0
sec ; CPU:$C03D PRG:003D 38
sbc #$01 ; CPU:$C03E PRG:003E E9 01
bne Sub_8764_OnNonzero_C038 ; CPU:$C040 PRG:0040 D0 F6
rts ; CPU:$C042 PRG:0042 60
; -----------------------------------------------------------------------------
; Routine: SubCC043_OnNonzero
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; X and Y, the N and Z flags.
;
; -----------------------------------------------------------------------------
SubCC043_OnNonzero:
ldx #$00 ; CPU:$C043 PRG:0043 A2 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C045
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads X with $00; decrements X; branches on
; not equal to Sub_8764_OnNonzero_C045; decrements Y; branches on not
; equal to SubCC043; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; X and Y, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C045:
dex ; CPU:$C045 PRG:0045 CA
bne Sub_8764_OnNonzero_C045 ; CPU:$C046 PRG:0046 D0 FD
dey ; CPU:$C048 PRG:0048 88
bne SubCC043_OnNonzero ; CPU:$C049 PRG:0049 D0 F8
rts ; CPU:$C04B PRG:004B 60
; -----------------------------------------------------------------------------
; Routine: NmiHandler
; Global: The routine writes the OAMADDR and OAMDMA registers.
; Local: Executes 11 instructions: pushes A; copies X into A; pushes A; copies
; Y into A; pushes A; loads A from NmiPathSelector; and 5 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the OAMADDR and OAMDMA
; registers set.
; Clobbers:
; no register, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
NmiHandler:
pha ; CPU:$C04C PRG:004C 48
txa ; CPU:$C04D PRG:004D 8A
pha ; CPU:$C04E PRG:004E 48
tya ; CPU:$C04F PRG:004F 98
pha ; CPU:$C050 PRG:0050 48
lda NmiPathSelector ; CPU:$C051 PRG:0051 A5 C4
bne Sub_8764_OnNonzero_C05F ; CPU:$C053 PRG:0053 D0 0A
lda #$00 ; CPU:$C055 PRG:0055 A9 00
sta OAMADDR ; CPU:$C057 PRG:0057 8D 03 20
lda #$07 ; CPU:$C05A PRG:005A A9 07
sta OAMDMA ; CPU:$C05C PRG:005C 8D 14 40
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C05F
; Global: The routine writes $0200, writes the PPUADDR registers, reads $0200.
; Local: Executes 24 instructions: loads A from $0200; loads X with $00;
; stores X to $0200; shifts a right; branches on carry set to
; Sub_8764_OnCarrySet_C0C1; shifts a right; and 18 more instructions.
; Parameters: Reads $0200 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $0200 changed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C05F:
lda $0200 ; CPU:$C05F PRG:005F AD 00 02
ldx #$00 ; CPU:$C062 PRG:0062 A2 00
stx $0200 ; CPU:$C064 PRG:0064 8E 00 02
lsr a ; CPU:$C067 PRG:0067 4A
bcs Sub_8764_OnCarrySet_C0C1 ; CPU:$C068 PRG:0068 B0 57
lsr a ; CPU:$C06A PRG:006A 4A
bcs Sub_8764_OnCarrySet_C0A8 ; CPU:$C06B PRG:006B B0 3B
lsr a ; CPU:$C06D PRG:006D 4A
bcs Sub_8764_OnCarrySet_C0A6 ; CPU:$C06E PRG:006E B0 36
lsr a ; CPU:$C070 PRG:0070 4A
bcs Sub_8764_OnCarrySet_C0A6 ; CPU:$C071 PRG:0071 B0 33
lda NmiPathSelector ; CPU:$C073 PRG:0073 A5 C4
bne Sub_8764_OnNonzero_C0A3 ; CPU:$C075 PRG:0075 D0 2C
lda FrameSubCounter ; CPU:$C077 PRG:0077 A5 55
beq Sub_8764_OnZero_C09A ; CPU:$C079 PRG:0079 F0 1F
dec FrameSubCounter ; CPU:$C07B PRG:007B C6 55
lsr a ; CPU:$C07D PRG:007D 4A
bcs Sub_8764_OnCarrySet_C0A0 ; CPU:$C07E PRG:007E B0 20
lda #$3F ; CPU:$C080 PRG:0080 A9 3F
sta PPUADDR ; CPU:$C082 PRG:0082 8D 06 20
ldx #$00 ; CPU:$C085 PRG:0085 A2 00
stx PPUADDR ; CPU:$C087 PRG:0087 8E 06 20
ldx #$10 ; CPU:$C08A PRG:008A A2 10
lda #$14 ; CPU:$C08C PRG:008C A9 14
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C08E
; Global: The routine calls WriteByteToPpu, ResetPaletteAddress and SubCC17A.
; Local: Executes 5 instructions: calls WriteByteToPpu; decrements X; branches on
; not equal to Sub_8764_OnNonzero_C08E; calls ResetPaletteAddress; calls
; SubCC17A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C08E:
jsr WriteByteToPpu ; CPU:$C08E PRG:008E 20 06 C0
dex ; CPU:$C091 PRG:0091 CA
bne Sub_8764_OnNonzero_C08E ; CPU:$C092 PRG:0092 D0 FA
jsr ResetPaletteAddress ; CPU:$C094 PRG:0094 20 E4 C4
jmp SubCC17A_Loop ; CPU:$C097 PRG:0097 4C 7A C1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C09A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from GameState; compares A with $02;
; branches on not equal to Sub_8764_OnNonzero_C0A3.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C09A:
lda GameState ; CPU:$C09A PRG:009A A5 D6
cmp #$02 ; CPU:$C09C PRG:009C C9 02
bne Sub_8764_OnNonzero_C0A3 ; CPU:$C09E PRG:009E D0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_C0A0
; Global: The routine calls UploadPaletteToPpu.
; Local: Executes 1 instruction: calls UploadPaletteToPpu.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_C0A0:
jsr UploadPaletteToPpu ; CPU:$C0A0 PRG:00A0 20 8E C4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C0A3
; Global: The routine calls SubCC17A.
; Local: Executes 1 instruction: calls SubCC17A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C0A3:
jmp SubCC17A_Loop ; CPU:$C0A3 PRG:00A3 4C 7A C1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_C0A6
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: branches on carry set to
; Sub_8764_OnCarrySet_C10D.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_C0A6:
bcs Sub_8764_OnCarrySet_C10D ; CPU:$C0A6 PRG:00A6 B0 65
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_C0A8
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads Y with $20; loads A from
; PpuCtrlShadow; ANDs A with $01; branches on not equal to
; Sub_8764_OnNonzero_C0B2; loads Y with $24.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_C0A8:
ldy #$20 ; CPU:$C0A8 PRG:00A8 A0 20
lda PpuCtrlShadow ; CPU:$C0AA PRG:00AA A5 C2
and #$01 ; CPU:$C0AC PRG:00AC 29 01
bne Sub_8764_OnNonzero_C0B2 ; CPU:$C0AE PRG:00AE D0 02
ldy #$24 ; CPU:$C0B0 PRG:00B0 A0 24
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C0B2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from ZpC1; clears the carry flag;
; adds $08 to A; copies A into X; branches on carry clear to
; Sub_8764_OnCarryClear_C0BE; copies Y into A; and 2 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C0B2:
lda ZpC1 ; CPU:$C0B2 PRG:00B2 A5 C1
clc ; CPU:$C0B4 PRG:00B4 18
adc #$08 ; CPU:$C0B5 PRG:00B5 69 08
tax ; CPU:$C0B7 PRG:00B7 AA
bcc Sub_8764_OnCarryClear_C0BE ; CPU:$C0B8 PRG:00B8 90 04
tya ; CPU:$C0BA PRG:00BA 98
eor #$04 ; CPU:$C0BB PRG:00BB 49 04
tay ; CPU:$C0BD PRG:00BD A8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_C0BE
; Global: The routine calls SubCC0D7.
; Local: Executes 1 instruction: calls SubCC0D7.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_C0BE:
jmp SubCC0D7_Loop ; CPU:$C0BE PRG:00BE 4C D7 C0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_C0C1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads Y with $20; loads A from
; PpuCtrlShadow; ANDs A with $01; branches on equal to
; Sub_8764_OnZero_C0CB; loads Y with $24.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_C0C1:
ldy #$20 ; CPU:$C0C1 PRG:00C1 A0 20
lda PpuCtrlShadow ; CPU:$C0C3 PRG:00C3 A5 C2
and #$01 ; CPU:$C0C5 PRG:00C5 29 01
beq Sub_8764_OnZero_C0CB ; CPU:$C0C7 PRG:00C7 F0 02
ldy #$24 ; CPU:$C0C9 PRG:00C9 A0 24
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C0CB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from ZpC1; sets the carry flag;
; subtracts $08 from A; copies A into X; branches on carry set to
; SubCC0D7; copies Y into A; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C0CB:
lda ZpC1 ; CPU:$C0CB PRG:00CB A5 C1
sec ; CPU:$C0CD PRG:00CD 38
sbc #$08 ; CPU:$C0CE PRG:00CE E9 08
tax ; CPU:$C0D0 PRG:00D0 AA
bcs SubCC0D7_Loop ; CPU:$C0D1 PRG:00D1 B0 04
tya ; CPU:$C0D3 PRG:00D3 98
eor #$04 ; CPU:$C0D4 PRG:00D4 49 04
tay ; CPU:$C0D6 PRG:00D6 A8
; -----------------------------------------------------------------------------
; Routine: SubCC0D7_Loop
; Global: The routine writes the PPUCTRL and PPUADDR registers.
; Local: Executes 20 instructions: loads A from PpuCtrlShadow; ORs A with $04;
; stores A to PpuCtrlShadow; stores A to the PPUCTRL register; stores
; Y to the PPUADDR register; copies X into A; and 14 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the PPUCTRL and PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCC0D7_Loop:
lda PpuCtrlShadow ; CPU:$C0D7 PRG:00D7 A5 C2
ora #$04 ; CPU:$C0D9 PRG:00D9 09 04
sta PpuCtrlShadow ; CPU:$C0DB PRG:00DB 85 C2
sta PPUCTRL ; CPU:$C0DD PRG:00DD 8D 00 20
sty PPUADDR ; CPU:$C0E0 PRG:00E0 8C 06 20
txa ; CPU:$C0E3 PRG:00E3 8A
lsr a ; CPU:$C0E4 PRG:00E4 4A
lsr a ; CPU:$C0E5 PRG:00E5 4A
lsr a ; CPU:$C0E6 PRG:00E6 4A
sta PPUADDR ; CPU:$C0E7 PRG:00E7 8D 06 20
lda ZpC3 ; CPU:$C0EA PRG:00EA A5 C3
lsr a ; CPU:$C0EC PRG:00EC 4A
lsr a ; CPU:$C0ED PRG:00ED 4A
lsr a ; CPU:$C0EE PRG:00EE 4A
eor #$FF ; CPU:$C0EF PRG:00EF 49 FF
clc ; CPU:$C0F1 PRG:00F1 18
adc #$1E ; CPU:$C0F2 PRG:00F2 69 1E
tay ; CPU:$C0F4 PRG:00F4 A8
tax ; CPU:$C0F5 PRG:00F5 AA
inx ; CPU:$C0F6 PRG:00F6 E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C0F7
; Global: The routine calls WritePpuDataFromRam.
; Local: Executes 7 instructions: calls WritePpuDataFromRam; increments X; compares X
; with $1F; branches on not equal to Sub_8764_OnNonzero_C0F7; loads X
; with $01; copies Y into A; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C0F7:
jsr WritePpuDataFromRam ; CPU:$C0F7 PRG:00F7 20 03 C0
inx ; CPU:$C0FA PRG:00FA E8
cpx #$1F ; CPU:$C0FB PRG:00FB E0 1F
bne Sub_8764_OnNonzero_C0F7 ; CPU:$C0FD PRG:00FD D0 F8
ldx #$01 ; CPU:$C0FF PRG:00FF A2 01
tya ; CPU:$C101 PRG:0101 98
beq SubCC17A_Loop ; CPU:$C102 PRG:0102 F0 76
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C104
; Global: The routine calls WritePpuDataFromRam.
; Local: Executes 5 instructions: calls WritePpuDataFromRam; increments X; decrements Y;
; branches on not equal to Sub_8764_OnNonzero_C104; branches on equal
; to SubCC17A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C104:
jsr WritePpuDataFromRam ; CPU:$C104 PRG:0104 20 03 C0
inx ; CPU:$C107 PRG:0107 E8
dey ; CPU:$C108 PRG:0108 88
bne Sub_8764_OnNonzero_C104 ; CPU:$C109 PRG:0109 D0 F9
beq SubCC17A_Loop ; CPU:$C10B PRG:010B F0 6D
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_C10D
; Global: The routine writes the PPUCTRL register.
; Local: Executes 8 instructions: loads A from PpuCtrlShadow; ANDs A with $FB;
; stores A to PpuCtrlShadow; stores A to the PPUCTRL register; loads
; X with $20; ANDs A with $01; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the PPUCTRL register set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_C10D:
lda PpuCtrlShadow ; CPU:$C10D PRG:010D A5 C2
and #$FB ; CPU:$C10F PRG:010F 29 FB
sta PpuCtrlShadow ; CPU:$C111 PRG:0111 85 C2
sta PPUCTRL ; CPU:$C113 PRG:0113 8D 00 20
ldx #$20 ; CPU:$C116 PRG:0116 A2 20
and #$01 ; CPU:$C118 PRG:0118 29 01
beq Sub_8764_OnZero_C11E ; CPU:$C11A PRG:011A F0 02
ldx #$24 ; CPU:$C11C PRG:011C A2 24
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C11E
; Global: The routine writes the PPUADDR registers.
; Local: Executes 26 instructions: loads A with $00; stores A to ZpC6; loads A
; from ZpC3; ANDs A with $F8; shifts a left; rotates ZpC6 left; and
; 20 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C11E:
lda #$00 ; CPU:$C11E PRG:011E A9 00
sta ZpC6 ; CPU:$C120 PRG:0120 85 C6
lda ZpC3 ; CPU:$C122 PRG:0122 A5 C3
and #$F8 ; CPU:$C124 PRG:0124 29 F8
asl a ; CPU:$C126 PRG:0126 0A
rol ZpC6 ; CPU:$C127 PRG:0127 26 C6
asl a ; CPU:$C129 PRG:0129 0A
rol ZpC6 ; CPU:$C12A PRG:012A 26 C6
sta ZpC5 ; CPU:$C12C PRG:012C 85 C5
txa ; CPU:$C12E PRG:012E 8A
ora ZpC6 ; CPU:$C12F PRG:012F 05 C6
sta ZpC6 ; CPU:$C131 PRG:0131 85 C6
pha ; CPU:$C133 PRG:0133 48
lda ZpC1 ; CPU:$C134 PRG:0134 A5 C1
lsr a ; CPU:$C136 PRG:0136 4A
lsr a ; CPU:$C137 PRG:0137 4A
lsr a ; CPU:$C138 PRG:0138 4A
tay ; CPU:$C139 PRG:0139 A8
clc ; CPU:$C13A PRG:013A 18
adc ZpC5 ; CPU:$C13B PRG:013B 65 C5
tax ; CPU:$C13D PRG:013D AA
lda ZpC6 ; CPU:$C13E PRG:013E A5 C6
adc #$00 ; CPU:$C140 PRG:0140 69 00
sta PPUADDR ; CPU:$C142 PRG:0142 8D 06 20
stx PPUADDR ; CPU:$C145 PRG:0145 8E 06 20
ldx #$01 ; CPU:$C148 PRG:0148 A2 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C14A
; Global: The routine calls WritePpuDataFromRam, writes the PPUADDR registers.
; Local: Executes 11 instructions: calls WritePpuDataFromRam; increments X; increments Y;
; compares Y with $20; branches on not equal to
; Sub_8764_OnNonzero_C14A; pulls A; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C14A:
jsr WritePpuDataFromRam ; CPU:$C14A PRG:014A 20 03 C0
inx ; CPU:$C14D PRG:014D E8
iny ; CPU:$C14E PRG:014E C8
cpy #$20 ; CPU:$C14F PRG:014F C0 20
bne Sub_8764_OnNonzero_C14A ; CPU:$C151 PRG:0151 D0 F7
pla ; CPU:$C153 PRG:0153 68
tay ; CPU:$C154 PRG:0154 A8
eor #$04 ; CPU:$C155 PRG:0155 49 04
sta PPUADDR ; CPU:$C157 PRG:0157 8D 06 20
lda ZpC5 ; CPU:$C15A PRG:015A A5 C5
sta PPUADDR ; CPU:$C15C PRG:015C 8D 06 20
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C15F
; Global: The routine calls WritePpuDataFromRam.
; Local: Executes 5 instructions: compares X with $22; branches on equal to
; Sub_8764_OnZero_C169; calls WritePpuDataFromRam; increments X; branches on not
; equal to Sub_8764_OnNonzero_C15F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C15F:
cpx #$22 ; CPU:$C15F PRG:015F E0 22
beq Sub_8764_OnZero_C169 ; CPU:$C161 PRG:0161 F0 06
jsr WritePpuDataFromRam ; CPU:$C163 PRG:0163 20 03 C0
inx ; CPU:$C166 PRG:0166 E8
bne Sub_8764_OnNonzero_C15F ; CPU:$C167 PRG:0167 D0 F6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C169
; Global: The routine writes the PPUADDR registers.
; Local: Executes 6 instructions: loads A from ZpC1; compares A with $F8;
; branches on carry clear to Sub_8764_OnCarryClear_C177; stores Y to
; the PPUADDR register; loads A from ZpC5; stores A to the PPUADDR
; register.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C169:
lda ZpC1 ; CPU:$C169 PRG:0169 A5 C1
cmp #$F8 ; CPU:$C16B PRG:016B C9 F8
bcc Sub_8764_OnCarryClear_C177 ; CPU:$C16D PRG:016D 90 08
sty PPUADDR ; CPU:$C16F PRG:016F 8C 06 20
lda ZpC5 ; CPU:$C172 PRG:0172 A5 C5
sta PPUADDR ; CPU:$C174 PRG:0174 8D 06 20
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_C177
; Global: The routine calls WritePpuDataFromRam.
; Local: Executes 1 instruction: calls WritePpuDataFromRam.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_C177:
jsr WritePpuDataFromRam ; CPU:$C177 PRG:0177 20 03 C0
; -----------------------------------------------------------------------------
; Routine: SubCC17A_Loop
; Global: The routine writes the PPUSCROLL and PPUCTRL registers.
; Local: Executes 10 instructions: loads A from NmiPathSelector; branches on
; not equal to Sub_8764_OnNonzero_C191; loads A from ZpC1; stores A
; to the PPUSCROLL register; loads A from ZpC3; stores A to the
; PPUSCROLL register; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the PPUSCROLL and PPUCTRL
; registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCC17A_Loop:
lda NmiPathSelector ; CPU:$C17A PRG:017A A5 C4
bne Sub_8764_OnNonzero_C191 ; CPU:$C17C PRG:017C D0 13
lda ZpC1 ; CPU:$C17E PRG:017E A5 C1
sta PPUSCROLL ; CPU:$C180 PRG:0180 8D 05 20
lda ZpC3 ; CPU:$C183 PRG:0183 A5 C3
sta PPUSCROLL ; CPU:$C185 PRG:0185 8D 05 20
lda PpuCtrlShadow ; CPU:$C188 PRG:0188 A5 C2
and #$FB ; CPU:$C18A PRG:018A 29 FB
sta PpuCtrlShadow ; CPU:$C18C PRG:018C 85 C2
sta PPUCTRL ; CPU:$C18E PRG:018E 8D 00 20
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C191
; Global: The routine writes the JOY1 registers.
; Local: Executes 7 instructions: loads A with $01; stores A to the JOY1
; register; loads A with $00; stores A to the JOY1 register; stores A
; to Zp50; stores A to Zp51; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the JOY1 registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C191:
lda #$01 ; CPU:$C191 PRG:0191 A9 01
sta JOY1 ; CPU:$C193 PRG:0193 8D 16 40
lda #$00 ; CPU:$C196 PRG:0196 A9 00
sta JOY1 ; CPU:$C198 PRG:0198 8D 16 40
sta Zp50 ; CPU:$C19B PRG:019B 85 50
sta Zp51 ; CPU:$C19D PRG:019D 85 51
ldy #$08 ; CPU:$C19F PRG:019F A0 08
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C1A1
; Global: The routine reads the JOY2 register.
; Local: Executes 6 instructions: loads A from the JOY2 register; shifts a
; right; rotates Zp51 left; decrements Y; branches on not equal to
; Sub_8764_OnNonzero_C1A1; loads Y with $08.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C1A1:
lda JOY2 ; CPU:$C1A1 PRG:01A1 AD 17 40
lsr a ; CPU:$C1A4 PRG:01A4 4A
rol Zp51 ; CPU:$C1A5 PRG:01A5 26 51
dey ; CPU:$C1A7 PRG:01A7 88
bne Sub_8764_OnNonzero_C1A1 ; CPU:$C1A8 PRG:01A8 D0 F7
ldy #$08 ; CPU:$C1AA PRG:01AA A0 08
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C1AC
; Global: The routine reads the JOY1 register.
; Local: Executes 18 instructions: loads A from the JOY1 register; shifts a
; right; rotates Zp50 left; decrements Y; branches on not equal to
; Sub_8764_OnNonzero_C1AC; loads A from ZpD4; and 12 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C1AC:
lda JOY1 ; CPU:$C1AC PRG:01AC AD 16 40
lsr a ; CPU:$C1AF PRG:01AF 4A
rol Zp50 ; CPU:$C1B0 PRG:01B0 26 50
dey ; CPU:$C1B2 PRG:01B2 88
bne Sub_8764_OnNonzero_C1AC ; CPU:$C1B3 PRG:01B3 D0 F7
lda ZpD4 ; CPU:$C1B5 PRG:01B5 A5 D4
beq Sub_8764_JoinBranchPaths_C209 ; CPU:$C1B7 PRG:01B7 F0 50
lda ZpCA ; CPU:$C1B9 PRG:01B9 A5 CA
beq Sub_8764_OnZero_C20C ; CPU:$C1BB PRG:01BB F0 4F
inc ZpCB ; CPU:$C1BD PRG:01BD E6 CB
lda ZpCB ; CPU:$C1BF PRG:01BF A5 CB
and #$07 ; CPU:$C1C1 PRG:01C1 29 07
cmp #$07 ; CPU:$C1C3 PRG:01C3 C9 07
bne Sub_8764_JoinBranchPaths_C209 ; CPU:$C1C5 PRG:01C5 D0 42
ldy #$00 ; CPU:$C1C7 PRG:01C7 A0 00
sty ZpCB ; CPU:$C1C9 PRG:01C9 84 CB
asl ZpCE ; CPU:$C1CB PRG:01CB 06 CE
bcc Sub_8764_OnCarryClear_C1E1 ; CPU:$C1CD PRG:01CD 90 12
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C1CF
; Global: The routine calls GetApuFrameCounterQuarter.
; Local: Executes 10 instructions: loads X from ZpCD; loads A from $C374,x;
; calls GetApuFrameCounterQuarter; increments ZpCD; increments Y; increments Y; and 4
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C1CF:
ldx ZpCD ; CPU:$C1CF PRG:01CF A6 CD
lda $C374,x ; CPU:$C1D1 PRG:01D1 BD 74 C3
jsr GetApuFrameCounterQuarter ; CPU:$C1D4 PRG:01D4 20 32 C3
inc ZpCD ; CPU:$C1D7 PRG:01D7 E6 CD
iny ; CPU:$C1D9 PRG:01D9 C8
iny ; CPU:$C1DA PRG:01DA C8
iny ; CPU:$C1DB PRG:01DB C8
iny ; CPU:$C1DC PRG:01DC C8
cpy #$08 ; CPU:$C1DD PRG:01DD C0 08
bne Sub_8764_OnNonzero_C1CF ; CPU:$C1DF PRG:01DF D0 EE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_C1E1
; Global: The routine calls GetApuFrameCounterQuarter.
; Local: Executes 4 instructions: shifts ZpD0 left; branches on carry clear to
; Sub_8764_OnCarryClear_C1EA; loads A with $27; calls GetApuFrameCounterQuarter.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_C1E1:
asl ZpD0 ; CPU:$C1E1 PRG:01E1 06 D0
bcc Sub_8764_OnCarryClear_C1EA ; CPU:$C1E3 PRG:01E3 90 05
lda #$27 ; CPU:$C1E5 PRG:01E5 A9 27
jsr GetApuFrameCounterQuarter ; CPU:$C1E7 PRG:01E7 20 32 C3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_C1EA
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 13 instructions: increments ZpCC; loads A from ZpCC; ANDs A
; with $07; branches on not equal to Sub_8764_JoinBranchPaths_C209;
; loads X from ZpCF; increments ZpCF; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_C1EA:
inc ZpCC ; CPU:$C1EA PRG:01EA E6 CC
lda ZpCC ; CPU:$C1EC PRG:01EC A5 CC
and #$07 ; CPU:$C1EE PRG:01EE 29 07
bne Sub_8764_JoinBranchPaths_C209 ; CPU:$C1F0 PRG:01F0 D0 17
ldx ZpCF ; CPU:$C1F2 PRG:01F2 A6 CF
inc ZpCF ; CPU:$C1F4 PRG:01F4 E6 CF
cpx #$08 ; CPU:$C1F6 PRG:01F6 E0 08
beq Sub_8764_OnZero_C206 ; CPU:$C1F8 PRG:01F8 F0 0C
lda $C3AC,x ; CPU:$C1FA PRG:01FA BD AC C3
sta ZpCE ; CPU:$C1FD PRG:01FD 85 CE
lda $C3B4,x ; CPU:$C1FF PRG:01FF BD B4 C3
sta ZpD0 ; CPU:$C202 PRG:0202 85 D0
bne Sub_8764_JoinBranchPaths_C209 ; CPU:$C204 PRG:0204 D0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C206
; Global: The routine calls StartPlayerShotSound.
; Local: Executes 1 instruction: calls StartPlayerShotSound.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C206:
jsr StartPlayerShotSound ; CPU:$C206 PRG:0206 20 EA C2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_C209
; Global: The routine calls SubCC2BB.
; Local: Executes 1 instruction: calls SubCC2BB.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_C209:
jmp SubCC2BB_Loop ; CPU:$C209 PRG:0209 4C BB C2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C20C
; Global: The routine writes the APUPULSE1TIMERLO and APUPULSE1TIMERHI
; registers.
; Local: Executes 7 instructions: loads X from ZpCD; branches on equal to
; Sub_8764_OnZero_C21C; loads A with $00; stores A to the
; APUPULSE1TIMERLO register; loads A with $0D; stores A to the
; APUPULSE1TIMERHI register; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the APUPULSE1TIMERLO and
; APUPULSE1TIMERHI registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C20C:
ldx ZpCD ; CPU:$C20C PRG:020C A6 CD
beq Sub_8764_OnZero_C21C ; CPU:$C20E PRG:020E F0 0C
lda #$00 ; CPU:$C210 PRG:0210 A9 00
sta APUPULSE1TIMERLO ; CPU:$C212 PRG:0212 8D 02 40
lda #$0D ; CPU:$C215 PRG:0215 A9 0D
sta APUPULSE1TIMERHI ; CPU:$C217 PRG:0217 8D 03 40
dec ZpCD ; CPU:$C21A PRG:021A C6 CD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C21C
; Global: The routine calls StartEnemySound and SubCC23E.
; Local: Executes 11 instructions: loads X from ZpCE; branches on equal to
; SubCC23E; decrements X; branches on equal to Sub_8764_OnZero_C232;
; loads A with $20; compares X with $14; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C21C:
ldx ZpCE ; CPU:$C21C PRG:021C A6 CE
beq SubCC23E_Loop ; CPU:$C21E PRG:021E F0 1E
dex ; CPU:$C220 PRG:0220 CA
beq Sub_8764_OnZero_C232 ; CPU:$C221 PRG:0221 F0 0F
lda #$20 ; CPU:$C223 PRG:0223 A9 20
cpx #$14 ; CPU:$C225 PRG:0225 E0 14
beq Sub_8764_OnZero_C234 ; CPU:$C227 PRG:0227 F0 0B
dex ; CPU:$C229 PRG:0229 CA
bne Sub_8764_OnNonzero_C23C ; CPU:$C22A PRG:022A D0 10
jsr StartEnemySound ; CPU:$C22C PRG:022C 20 93 D2
jmp SubCC23E_Loop ; CPU:$C22F PRG:022F 4C 3E C2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C232
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $0A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C232:
lda #$0A ; CPU:$C232 PRG:0232 A9 0A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C234
; Global: The routine writes the APUPULSE2TIMERLO and APUPULSE2TIMERHI
; registers.
; Local: Executes 3 instructions: loads X with $80; stores X to the
; APUPULSE2TIMERLO register; stores A to the APUPULSE2TIMERHI
; register.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the APUPULSE2TIMERLO and APUPULSE2TIMERHI
; registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C234:
ldx #$80 ; CPU:$C234 PRG:0234 A2 80
stx APUPULSE2TIMERLO ; CPU:$C236 PRG:0236 8E 06 40
sta APUPULSE2TIMERHI ; CPU:$C239 PRG:0239 8D 07 40
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C23C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: decrements ZpCE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C23C:
dec ZpCE ; CPU:$C23C PRG:023C C6 CE
; -----------------------------------------------------------------------------
; Routine: SubCC23E_Loop
; Global: The routine writes the APUTRIANGLETIMERLO, APUTRIANGLETIMERHI and
; APUPULSE2TIMERHI registers.
; Local: Executes 7 instructions: loads A from ZpD1; branches on equal to
; Sub_8764_OnZero_C24F; stores A to the APUTRIANGLETIMERLO register;
; loads A with $11; stores A to the APUTRIANGLETIMERHI register;
; stores A to the APUPULSE2TIMERHI register; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the APUTRIANGLETIMERLO,
; APUTRIANGLETIMERHI and APUPULSE2TIMERHI registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCC23E_Loop:
lda ZpD1 ; CPU:$C23E PRG:023E A5 D1
beq Sub_8764_OnZero_C24F ; CPU:$C240 PRG:0240 F0 0D
sta APUTRIANGLETIMERLO ; CPU:$C242 PRG:0242 8D 0A 40
lda #$11 ; CPU:$C245 PRG:0245 A9 11
sta APUTRIANGLETIMERHI ; CPU:$C247 PRG:0247 8D 0B 40
sta APUPULSE2TIMERHI ; CPU:$C24A PRG:024A 8D 07 40
bne Sub_8764_JoinBranchPaths_C278 ; CPU:$C24D PRG:024D D0 29
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C24F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: increments ZpCB; loads A from ZpCB; ANDs A
; with $07; branches on not equal to Sub_8764_JoinBranchPaths_C278.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C24F:
inc ZpCB ; CPU:$C24F PRG:024F E6 CB
lda ZpCB ; CPU:$C251 PRG:0251 A5 CB
and #$07 ; CPU:$C253 PRG:0253 29 07
bne Sub_8764_JoinBranchPaths_C278 ; CPU:$C255 PRG:0255 D0 21
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C257
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads X from ZpCF; branches on equal to
; Sub_8764_JoinBranchPaths_C278; loads Y with $08; loads A from
; $C3BB,x; branches on not equal to Sub_8764_OnNonzero_C268; loads A
; with $01; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C257:
ldx ZpCF ; CPU:$C257 PRG:0257 A6 CF
beq Sub_8764_JoinBranchPaths_C278 ; CPU:$C259 PRG:0259 F0 1D
ldy #$08 ; CPU:$C25B PRG:025B A0 08
lda $C3BB,x ; CPU:$C25D PRG:025D BD BB C3
bne Sub_8764_OnNonzero_C268 ; CPU:$C260 PRG:0260 D0 06
lda #$01 ; CPU:$C262 PRG:0262 A9 01
sta ZpCF ; CPU:$C264 PRG:0264 85 CF
bne Sub_8764_OnNonzero_C257 ; CPU:$C266 PRG:0266 D0 EF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C268
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads X from ZpAD; branches on equal to
; Sub_8764_OnZero_C273; compares A with $81; branches on equal to
; Sub_8764_OnZero_C273; clears the carry flag; adds $02 to A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C268:
ldx ZpAD ; CPU:$C268 PRG:0268 A6 AD
beq Sub_8764_OnZero_C273 ; CPU:$C26A PRG:026A F0 07
cmp #$81 ; CPU:$C26C PRG:026C C9 81
beq Sub_8764_OnZero_C273 ; CPU:$C26E PRG:026E F0 03
clc ; CPU:$C270 PRG:0270 18
adc #$02 ; CPU:$C271 PRG:0271 69 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C273
; Global: The routine calls GetApuFrameCounterQuarter.
; Local: Executes 2 instructions: calls GetApuFrameCounterQuarter; increments ZpCF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C273:
jsr GetApuFrameCounterQuarter ; CPU:$C273 PRG:0273 20 32 C3
inc ZpCF ; CPU:$C276 PRG:0276 E6 CF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_C278
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 13 instructions: increments ZpCC; loads A from ZpCC; ANDs A
; with $07; branches on not equal to SubCC2BB; loads A from ZpD2;
; branches on not equal to Sub_8764_JoinBranchPaths_C2A3; and 7 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpB8, ZpCC, ZpD0, APUNOISECTRL,
; APUNOISEPERIOD, APUNOISELENGTH.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_C278:
inc ZpCC ; CPU:$C278 PRG:0278 E6 CC
lda ZpCC ; CPU:$C27A PRG:027A A5 CC
and #$07 ; CPU:$C27C PRG:027C 29 07
bne SubCC2BB_Loop ; CPU:$C27E PRG:027E D0 3B
lda ZpD2 ; CPU:$C280 PRG:0280 A5 D2
bne Sub_8764_JoinBranchPaths_C2A3 ; CPU:$C282 PRG:0282 D0 1F
ldx #$3F ; CPU:$C284 PRG:0284 A2 3F
lda ZpB7 ; CPU:$C286 PRG:0286 A5 B7
cmp #$FF ; CPU:$C288 PRG:0288 C9 FF
bne Sub_8764_OnNonzero_C292 ; CPU:$C28A PRG:028A D0 06
ldx #$0A ; CPU:$C28C PRG:028C A2 0A
cpx ZpB8 ; CPU:$C28E PRG:028E E4 B8
beq Sub_8764_JoinBranchPaths_C2A3 ; CPU:$C290 PRG:0290 F0 11
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C292
; Global: The routine writes the APUNOISEPERIOD, APUNOISECTRL and
; APUNOISELENGTH registers.
; Local: Executes 8 instructions: rotates a left; rotates a left; ORs A with
; $0C; stores A to the APUNOISEPERIOD register; stores X to ZpB8;
; stores X to the APUNOISECTRL register; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the APUNOISEPERIOD, APUNOISECTRL and
; APUNOISELENGTH registers set.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpB8, ZpD0, APUNOISECTRL,
; APUNOISEPERIOD, APUNOISELENGTH.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C292:
rol a ; CPU:$C292 PRG:0292 2A
rol a ; CPU:$C293 PRG:0293 2A
ora #$0C ; CPU:$C294 PRG:0294 09 0C
sta APUNOISEPERIOD ; CPU:$C296 PRG:0296 8D 0E 40
stx ZpB8 ; CPU:$C299 PRG:0299 86 B8
stx APUNOISECTRL ; CPU:$C29B PRG:029B 8E 0C 40
lda #$08 ; CPU:$C29E PRG:029E A9 08
sta APUNOISELENGTH ; CPU:$C2A0 PRG:02A0 8D 0F 40
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_C2A3
; Global: The routine writes the APUNOISEPERIOD, APUNOISECTRL and
; APUNOISELENGTH registers.
; Local: Executes 10 instructions: loads X from ZpD0; branches on equal to
; SubCC2BB; loads A from $C3CC,x; branches on equal to SubCC2BB;
; stores A to the APUNOISEPERIOD register; loads A with $0A; and 4
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the APUNOISEPERIOD,
; APUNOISECTRL and APUNOISELENGTH registers set.
; Clobbers:
; A, X and Y, the N and Z flags, ZpD0, APUNOISECTRL, APUNOISEPERIOD,
; APUNOISELENGTH.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_C2A3:
ldx ZpD0 ; CPU:$C2A3 PRG:02A3 A6 D0
beq SubCC2BB_Loop ; CPU:$C2A5 PRG:02A5 F0 14
lda $C3CC,x ; CPU:$C2A7 PRG:02A7 BD CC C3
beq SubCC2BB_Loop ; CPU:$C2AA PRG:02AA F0 0F
sta APUNOISEPERIOD ; CPU:$C2AC PRG:02AC 8D 0E 40
lda #$0A ; CPU:$C2AF PRG:02AF A9 0A
sta APUNOISECTRL ; CPU:$C2B1 PRG:02B1 8D 0C 40
lda #$40 ; CPU:$C2B4 PRG:02B4 A9 40
sta APUNOISELENGTH ; CPU:$C2B6 PRG:02B6 8D 0F 40
inc ZpD0 ; CPU:$C2B9 PRG:02B9 E6 D0
; -----------------------------------------------------------------------------
; Routine: SubCC2BB_Loop
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: pulls A; copies A into Y; pulls A; copies A
; into X; pulls A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y.
;
; -----------------------------------------------------------------------------
SubCC2BB_Loop:
pla ; CPU:$C2BB PRG:02BB 68
tay ; CPU:$C2BC PRG:02BC A8
pla ; CPU:$C2BD PRG:02BD 68
tax ; CPU:$C2BE PRG:02BE AA
pla ; CPU:$C2BF PRG:02BF 68
; -----------------------------------------------------------------------------
; Routine: IrqHandler
; Global: Interrupt handler - the CPU enters it from the vector table; it
; reads no RAM field, writes none and calls nothing - it is a
; straight-line sequence whose only effect is on the registers and
; the flags.
; Local: Executes 1 instruction: returns from the interrupt with RTI.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns from the interrupt with RTI.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
IrqHandler:
rti ; CPU:$C2C0 PRG:02C0 40
; -----------------------------------------------------------------------------
; Routine: StartEnemySoundEffect
; Global: The routine calls StopPulseChannels.
; Local: Executes 7 instructions: calls StopPulseChannels; loads A with $08; stores A
; to ZpCF; loads A with $E0; stores A to ZpCE; loads A with $00; and
; 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
StartEnemySoundEffect:
jsr StopPulseChannels ; CPU:$C2C1 PRG:02C1 20 04 C3
lda #$08 ; CPU:$C2C4 PRG:02C4 A9 08
sta ZpCF ; CPU:$C2C6 PRG:02C6 85 CF
lda #$E0 ; CPU:$C2C8 PRG:02C8 A9 E0
sta ZpCE ; CPU:$C2CA PRG:02CA 85 CE
lda #$00 ; CPU:$C2CC PRG:02CC A9 00
sta ZpD0 ; CPU:$C2CE PRG:02CE 85 D0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C2D0
; Global: The routine writes the APUSTATUS register.
; Local: Executes 4 instructions: loads A from ZpCA; branches on not equal to
; Sub_8764_OnNonzero_C2D0; stores A to the APUSTATUS register;
; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves the APUSTATUS register set.
; Clobbers:
; A, the N and Z flags, APUSTATUS.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C2D0:
lda ZpCA ; CPU:$C2D0 PRG:02D0 A5 CA
bne Sub_8764_OnNonzero_C2D0 ; CPU:$C2D2 PRG:02D2 D0 FC
sta APUSTATUS ; CPU:$C2D4 PRG:02D4 8D 15 40
rts ; CPU:$C2D7 PRG:02D7 60
; -----------------------------------------------------------------------------
; Routine: StartEnemySpriteSound
; Global: The routine calls StopPulseChannels, reads $C3AC and $C3B4.
; Local: Executes 8 instructions: calls StopPulseChannels; loads A with $06; stores A
; to ZpCD; loads A from $C3AC; stores A to ZpCE; loads A from $C3B4;
; and 2 more instructions.
; Parameters: Reads $C3AC and $C3B4 from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
StartEnemySpriteSound:
jsr StopPulseChannels ; CPU:$C2D8 PRG:02D8 20 04 C3
lda #$06 ; CPU:$C2DB PRG:02DB A9 06
sta ZpCD ; CPU:$C2DD PRG:02DD 85 CD
lda $C3AC ; CPU:$C2DF PRG:02DF AD AC C3
sta ZpCE ; CPU:$C2E2 PRG:02E2 85 CE
lda $C3B4 ; CPU:$C2E4 PRG:02E4 AD B4 C3
sta ZpD0 ; CPU:$C2E7 PRG:02E7 85 D0
rts ; CPU:$C2E9 PRG:02E9 60
; -----------------------------------------------------------------------------
; Routine: StartPlayerShotSound
; Global: The routine calls StopPulseChannels, writes the APUPULSE1CTRL,
; APUPULSE1SWEEP, APUPULSE2SWEEP and APUTRIANGLECTRL registers.
; Local: Executes 11 instructions: calls StopPulseChannels; decrements ZpCA; loads A
; with $C0; stores A to the APUPULSE1CTRL register; loads A with $84;
; stores A to the APUPULSE1SWEEP register; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves the APUPULSE1CTRL, APUPULSE1SWEEP and
; APUPULSE2SWEEP registers set.
; Clobbers:
; A and X, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
StartPlayerShotSound:
jsr StopPulseChannels ; CPU:$C2EA PRG:02EA 20 04 C3
dec ZpCA ; CPU:$C2ED PRG:02ED C6 CA
lda #$C0 ; CPU:$C2EF PRG:02EF A9 C0
sta APUPULSE1CTRL ; CPU:$C2F1 PRG:02F1 8D 00 40
lda #$84 ; CPU:$C2F4 PRG:02F4 A9 84
sta APUPULSE1SWEEP ; CPU:$C2F6 PRG:02F6 8D 01 40
lda #$94 ; CPU:$C2F9 PRG:02F9 A9 94
sta APUPULSE2SWEEP ; CPU:$C2FB PRG:02FB 8D 05 40
lda #$10 ; CPU:$C2FE PRG:02FE A9 10
sta APUTRIANGLECTRL ; CPU:$C300 PRG:0300 8D 08 40
rts ; CPU:$C303 PRG:0303 60
; -----------------------------------------------------------------------------
; Routine: StopPulseChannels
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $00; copies A into X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
StopPulseChannels:
lda #$00 ; CPU:$C304 PRG:0304 A9 00
tax ; CPU:$C306 PRG:0306 AA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C307
; Global: The routine writes the APUPULSE1CTRL, APUPULSE2CTRL and
; APUTRIANGLECTRL registers.
; Local: Executes 17 instructions: stores A to APUPULSE1CTRL,x; increments X;
; compares X with $10; branches on not equal to
; Sub_8764_OnNonzero_C307; stores A to ZpCD; stores A to ZpCE; and 11
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the APUPULSE1CTRL,
; APUPULSE2CTRL and APUTRIANGLECTRL registers set.
; Clobbers:
; A and X, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C307:
sta APUPULSE1CTRL,x ; CPU:$C307 PRG:0307 9D 00 40
inx ; CPU:$C30A PRG:030A E8
cpx #$10 ; CPU:$C30B PRG:030B E0 10
bne Sub_8764_OnNonzero_C307 ; CPU:$C30D PRG:030D D0 F8
sta ZpCD ; CPU:$C30F PRG:030F 85 CD
sta ZpCE ; CPU:$C311 PRG:0311 85 CE
sta ZpD0 ; CPU:$C313 PRG:0313 85 D0
sta ZpCC ; CPU:$C315 PRG:0315 85 CC
lda #$01 ; CPU:$C317 PRG:0317 A9 01
sta ZpCA ; CPU:$C319 PRG:0319 85 CA
sta ZpCF ; CPU:$C31B PRG:031B 85 CF
lda #$CA ; CPU:$C31D PRG:031D A9 CA
sta APUPULSE1CTRL ; CPU:$C31F PRG:031F 8D 00 40
lda #$C4 ; CPU:$C322 PRG:0322 A9 C4
sta APUPULSE2CTRL ; CPU:$C324 PRG:0324 8D 04 40
lda #$20 ; CPU:$C327 PRG:0327 A9 20
sta APUTRIANGLECTRL ; CPU:$C329 PRG:0329 8D 08 40
; -----------------------------------------------------------------------------
; Routine: ReadApuFrameCounter
; Global: The routine writes the APUSTATUS register.
; Local: Executes 3 instructions: loads A with $0F; stores A to the APUSTATUS
; register; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves the APUSTATUS register set.
; Clobbers:
; A, the N and Z flags, APUSTATUS.
;
; -----------------------------------------------------------------------------
ReadApuFrameCounter:
lda #$0F ; CPU:$C32C PRG:032C A9 0F
sta APUSTATUS ; CPU:$C32E PRG:032E 8D 15 40
rts ; CPU:$C331 PRG:0331 60
; -----------------------------------------------------------------------------
; Routine: GetApuFrameCounterQuarter
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 15 instructions: compares A with $81; branches on equal to
; Sub_8764_OnZero_C35B; pushes A; ANDs A with $0F; shifts a left;
; copies A into X; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, ZpC5, ZpC6, APUPULSE1TIMERLO,
; APUPULSE1TIMERHI.
;
; -----------------------------------------------------------------------------
GetApuFrameCounterQuarter:
cmp #$81 ; CPU:$C332 PRG:0332 C9 81
beq Sub_8764_OnZero_C35B ; CPU:$C334 PRG:0334 F0 25
pha ; CPU:$C336 PRG:0336 48
and #$0F ; CPU:$C337 PRG:0337 29 0F
asl a ; CPU:$C339 PRG:0339 0A
tax ; CPU:$C33A PRG:033A AA
pla ; CPU:$C33B PRG:033B 68
lsr a ; CPU:$C33C PRG:033C 4A
lsr a ; CPU:$C33D PRG:033D 4A
lsr a ; CPU:$C33E PRG:033E 4A
lsr a ; CPU:$C33F PRG:033F 4A
sta ZpC5 ; CPU:$C340 PRG:0340 85 C5
lda $C35D,x ; CPU:$C342 PRG:0342 BD 5D C3
sta ZpC6 ; CPU:$C345 PRG:0345 85 C6
lda $C35C,x ; CPU:$C347 PRG:0347 BD 5C C3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C34A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: shifts ZpC6 right; rotates a right;
; decrements ZpC5; branches on not equal to Sub_8764_OnNonzero_C34A;
; stores A to APUPULSE1TIMERLO,y; loads A from ZpC6; and 2 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, ZpC5, ZpC6, APUPULSE1TIMERLO,
; APUPULSE1TIMERHI.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C34A:
lsr ZpC6 ; CPU:$C34A PRG:034A 46 C6
ror a ; CPU:$C34C PRG:034C 6A
dec ZpC5 ; CPU:$C34D PRG:034D C6 C5
bne Sub_8764_OnNonzero_C34A ; CPU:$C34F PRG:034F D0 F9
sta APUPULSE1TIMERLO,y ; CPU:$C351 PRG:0351 99 02 40
lda ZpC6 ; CPU:$C354 PRG:0354 A5 C6
ora #$20 ; CPU:$C356 PRG:0356 09 20
sta APUPULSE1TIMERHI,y ; CPU:$C358 PRG:0358 99 03 40
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C35B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C35B:
rts ; CPU:$C35B PRG:035B 60
; ---- data $C35C-$C3E1 (134 bytes) ----
; referenced by `lda $C374,x` at $C1D1 (operand $C374 falls inside this region)
; referenced by `lda $C3AC,x` at $C1FA (operand $C3AC falls inside this region)
; referenced by `lda $C3B4,x` at $C1FF (operand $C3B4 falls inside this region)
; referenced by `lda $C3BB,x` at $C25D (operand $C3BB falls inside this region)
; referenced by `lda $C3CC,x` at $C2A7 (operand $C3CC falls inside this region)
; referenced by `lda $C3AC` at $C2DF (operand $C3AC falls inside this region)
; ... and 4 further references from decoded code
SoundEffectPeriodTable:
.byte $AE, $06, $4E, $06, $F3, $05, $9E, $05, $4D, $05, $01, $05, $B9, $04, $75, $04 ; CPU:$C35C PRG:035C AE 06 4E 06 F3 05 9E 05 4D 05 01 05 B9 04 75 04
.byte $35, $04, $F8, $03, $BF, $03, $89, $03, $30, $40, $2B, $3B, $30, $40, $22, $27 ; CPU:$C36C PRG:036C 35 04 F8 03 BF 03 89 03 30 40 2B 3B 30 40 22 27
EnemySpriteDefinitionTable:
.byte $22, $27, $22, $27, $27, $2B, $22, $27, $1B, $22, $27, $2B, $27, $2B, $27, $2B ; CPU:$C37C PRG:037C 22 27 22 27 27 2B 22 27 1B 22 27 2B 27 2B 27 2B
.byte $2B, $32, $27, $2B, $22, $27, $2B, $32, $2B, $32, $2B, $32, $32, $36, $29, $32 ; CPU:$C38C PRG:038C 2B 32 27 2B 22 27 2B 32 2B 32 2B 32 32 36 29 32
.byte $26, $29, $29, $32, $26, $29, $29, $32, $27, $37, $27, $37, $27, $37, $27, $37 ; CPU:$C39C PRG:039C 26 29 29 32 26 29 29 32 27 37 27 37 27 37 27 37
EnemySpriteTileTable:
.byte $00, $9A, $39, $A3, $9A, $69, $A6, $80 ; CPU:$C3AC PRG:03AC 00 9A 39 A3 9A 69 A6 80
EnemySpriteAttributeTable:
.byte $2A, $9A, $F9, $A7, $9A, $A9, $A6 ; CPU:$C3B4 PRG:03B4 2A 9A F9 A7 9A A9 A6
EnemySpritePositionTable:
.byte $80 ; CPU:$C3BB PRG:03BB 80
.byte $27, $27, $27, $22, $81, $81, $22, $81, $22, $27, $81, $81, $00, $20, $81, $15 ; CPU:$C3BC PRG:03BC 27 27 27 22 81 81 22 81 22 27 81 81 00 20 81 15
EnemySpriteSoundTable:
.byte $00, $0A, $09, $0C, $00, $0D, $0F, $00, $0B, $00, $0A, $09, $0B, $0A, $0C, $0B ; CPU:$C3CC PRG:03CC 00 0A 09 0C 00 0D 0F 00 0B 00 0A 09 0B 0A 0C 0B
.byte $0D, $0C, $0F, $0E, $0F, $00 ; CPU:$C3DC PRG:03DC 0D 0C 0F 0E 0F 00
; -----------------------------------------------------------------------------
; Routine: StartFullFrameUpdate
; Global: The routine writes $0200.
; Local: Executes 4 instructions: loads A with $00; stores A to $0200; loads A
; with $01; stores A to NmiPathSelector.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $0200 changed.
; Clobbers:
; A, the N and Z flags, ZpC4, the OAM shadow, PPUMASK.
;
; -----------------------------------------------------------------------------
StartFullFrameUpdate:
lda #$00 ; CPU:$C3E2 PRG:03E2 A9 00
sta $0200 ; CPU:$C3E4 PRG:03E4 8D 00 02
lda #$01 ; CPU:$C3E7 PRG:03E7 A9 01
sta NmiPathSelector ; CPU:$C3E9 PRG:03E9 85 C4
; -----------------------------------------------------------------------------
; Routine: DisableRendering
; Global: The routine calls SubCC407.
; Local: Executes 2 instructions: calls SubCC407; loads A with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, PPUMASK.
;
; -----------------------------------------------------------------------------
DisableRendering:
jsr SubCC407_OnNegative ; CPU:$C3EB PRG:03EB 20 07 C4
lda #$00 ; CPU:$C3EE PRG:03EE A9 00
; -----------------------------------------------------------------------------
; Routine: ResetScroll
; Global: The routine writes the PPUMASK register.
; Local: Executes 2 instructions: stores A to the PPUMASK register; returns
; with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves the PPUMASK register set.
; Clobbers:
; no register, PPUMASK.
;
; -----------------------------------------------------------------------------
ResetScroll:
sta PPUMASK ; CPU:$C3F0 PRG:03F0 8D 01 20
rts ; CPU:$C3F3 PRG:03F3 60
; -----------------------------------------------------------------------------
; Routine: ResetScrollAndRestoreControl
; Global: The routine calls SetPpuControlAndClearRam, writes the PPUSCROLL registers.
; Local: Executes 8 instructions: loads A with $00; stores A to ZpC1; stores A
; to the PPUSCROLL register; stores A to ZpC3; stores A to the
; PPUSCROLL register; loads A from PpuCtrlShadow; and 2 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the PPUSCROLL registers set.
; Clobbers:
; A, the N and Z flags, ZpC1, ZpC2, ZpC3, PPUCTRL, PPUSCROLL.
;
; -----------------------------------------------------------------------------
ResetScrollAndRestoreControl:
lda #$00 ; CPU:$C3F4 PRG:03F4 A9 00
sta ZpC1 ; CPU:$C3F6 PRG:03F6 85 C1
sta PPUSCROLL ; CPU:$C3F8 PRG:03F8 8D 05 20
sta ZpC3 ; CPU:$C3FB PRG:03FB 85 C3
sta PPUSCROLL ; CPU:$C3FD PRG:03FD 8D 05 20
lda PpuCtrlShadow ; CPU:$C400 PRG:0400 A5 C2
and #$FC ; CPU:$C402 PRG:0402 29 FC
jmp SetPpuControlAndClearRam ; CPU:$C404 PRG:0404 4C 69 C9
; -----------------------------------------------------------------------------
; Routine: SubCC407_OnNegative
; Global: The routine reads the PPUSTATUS register.
; Local: Executes 2 instructions: loads A from the PPUSTATUS register;
; branches on negative to SubCC407.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags.
;
; -----------------------------------------------------------------------------
SubCC407_OnNegative:
lda PPUSTATUS ; CPU:$C407 PRG:0407 AD 02 20
bmi SubCC407_OnNegative ; CPU:$C40A PRG:040A 30 FB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C40C
; Global: The routine reads the PPUSTATUS register.
; Local: Executes 3 instructions: loads A from the PPUSTATUS register;
; branches on non-negative to Sub_8764_OnNonnegative_C40C; returns
; with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C40C:
lda PPUSTATUS ; CPU:$C40C PRG:040C AD 02 20
bpl Sub_8764_OnNonnegative_C40C; CPU:$C40F PRG:040F 10 FB
rts ; CPU:$C411 PRG:0411 60
; -----------------------------------------------------------------------------
; Routine: UpdatePseudoRandomNumber
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: increments PrngPeriodCounter; decrements
; PrngSeedB; branches on not equal to Sub_8764_OnNonzero_C41C; loads
; A with $75; stores A to PrngSeedB.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, ZpEA, ZpEB, ZpEC.
;
; -----------------------------------------------------------------------------
UpdatePseudoRandomNumber:
inc PrngPeriodCounter ; CPU:$C412 PRG:0412 E6 EA
dec PrngSeedB ; CPU:$C414 PRG:0414 C6 EB
bne Sub_8764_OnNonzero_C41C ; CPU:$C416 PRG:0416 D0 04
lda #$75 ; CPU:$C418 PRG:0418 A9 75
sta PrngSeedB ; CPU:$C41A PRG:041A 85 EB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C41C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from PrngPeriodCounter; compares A
; with $77; branches on not equal to Sub_8764_OnNonzero_C426; loads A
; with $01; stores A to PrngPeriodCounter.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, ZpEA, ZpEC.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C41C:
lda PrngPeriodCounter ; CPU:$C41C PRG:041C A5 EA
cmp #$77 ; CPU:$C41E PRG:041E C9 77
bne Sub_8764_OnNonzero_C426 ; CPU:$C420 PRG:0420 D0 04
lda #$01 ; CPU:$C422 PRG:0422 A9 01
sta PrngPeriodCounter ; CPU:$C424 PRG:0424 85 EA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C426
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 21 instructions: EORs A with PrngSeedB; shifts a left;
; pushes the processor status; shifts a right; pulls the processor
; status; rotates a left; and 15 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N, Z, C and V flags, ZpEC.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C426:
eor PrngSeedB ; CPU:$C426 PRG:0426 45 EB
asl a ; CPU:$C428 PRG:0428 0A
php ; CPU:$C429 PRG:0429 08
lsr a ; CPU:$C42A PRG:042A 4A
plp ; CPU:$C42B PRG:042B 28
rol a ; CPU:$C42C PRG:042C 2A
asl a ; CPU:$C42D PRG:042D 0A
php ; CPU:$C42E PRG:042E 08
lsr a ; CPU:$C42F PRG:042F 4A
plp ; CPU:$C430 PRG:0430 28
rol a ; CPU:$C431 PRG:0431 2A
eor PrngState ; CPU:$C432 PRG:0432 45 EC
sec ; CPU:$C434 PRG:0434 38
sbc PrngSeedB ; CPU:$C435 PRG:0435 E5 EB
clc ; CPU:$C437 PRG:0437 18
adc PrngPeriodCounter ; CPU:$C438 PRG:0438 65 EA
clc ; CPU:$C43A PRG:043A 18
adc PrngPeriodCounter ; CPU:$C43B PRG:043B 65 EA
sta PrngState ; CPU:$C43D PRG:043D 85 EC
adc Zp50 ; CPU:$C43F PRG:043F 65 50
rts ; CPU:$C441 PRG:0441 60
; -----------------------------------------------------------------------------
; Routine: PreparePaletteUpdate
; Global: The routine calls StartFullFrameUpdate.
; Local: Executes 2 instructions: calls StartFullFrameUpdate; loads A with $AA.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
PreparePaletteUpdate:
jsr StartFullFrameUpdate ; CPU:$C442 PRG:0442 20 E2 C3
lda #$AA ; CPU:$C445 PRG:0445 A9 AA
; -----------------------------------------------------------------------------
; Routine: WritePaletteBytes
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads X with $0F; loads Y with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
WritePaletteBytes:
ldx #$0F ; CPU:$C447 PRG:0447 A2 0F
ldy #$00 ; CPU:$C449 PRG:0449 A0 00
; -----------------------------------------------------------------------------
; Routine: WritePaletteAndAttributeTable
; Global: The routine calls UploadPaletteToPpu and SetPpuAddress.
; Local: Executes 9 instructions: stores A to Zp00; stores X to ZpB9; calls
; UploadPaletteToPpu; decrements Y; branches on equal to Sub_8764_OnZero_C45F;
; loads X with $20; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
WritePaletteAndAttributeTable:
sta Zp00 ; CPU:$C44B PRG:044B 85 00
stx ZpB9 ; CPU:$C44D PRG:044D 86 B9
jsr UploadPaletteToPpu ; CPU:$C44F PRG:044F 20 8E C4
dey ; CPU:$C452 PRG:0452 88
beq Sub_8764_OnZero_C45F ; CPU:$C453 PRG:0453 F0 0A
ldx #$20 ; CPU:$C455 PRG:0455 A2 20
jsr SetPpuAddress ; CPU:$C457 PRG:0457 20 6D C4
ldx #$24 ; CPU:$C45A PRG:045A A2 24
jsr SetPpuAddress ; CPU:$C45C PRG:045C 20 6D C4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C45F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads X with $00; loads Y with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N and Z flags, $0700.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C45F:
ldx #$00 ; CPU:$C45F PRG:045F A2 00
ldy #$00 ; CPU:$C461 PRG:0461 A0 00
; -----------------------------------------------------------------------------
; Routine: SubCC463_OnNonzero
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A with $F8; stores A to $0700,x;
; increments X; decrements Y; branches on not equal to SubCC463;
; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N and Z flags, $0700.
;
; -----------------------------------------------------------------------------
SubCC463_OnNonzero:
lda #$F8 ; CPU:$C463 PRG:0463 A9 F8
sta $0700,x ; CPU:$C465 PRG:0465 9D 00 07
inx ; CPU:$C468 PRG:0468 E8
dey ; CPU:$C469 PRG:0469 88
bne SubCC463_OnNonzero ; CPU:$C46A PRG:046A D0 F7
rts ; CPU:$C46C PRG:046C 60
; -----------------------------------------------------------------------------
; Routine: SetPpuAddress
; Global: The routine calls SubCC484, writes the PPUADDR registers.
; Local: Executes 10 instructions: stores X to the PPUADDR register; loads A
; with $00; stores A to the PPUADDR register; loads X with $C0; loads
; Y with $04; loads A with $80; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N and Z flags, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
SetPpuAddress:
stx PPUADDR ; CPU:$C46D PRG:046D 8E 06 20
lda #$00 ; CPU:$C470 PRG:0470 A9 00
sta PPUADDR ; CPU:$C472 PRG:0472 8D 06 20
ldx #$C0 ; CPU:$C475 PRG:0475 A2 C0
ldy #$04 ; CPU:$C477 PRG:0477 A0 04
lda #$80 ; CPU:$C479 PRG:0479 A9 80
jsr SubCC484_OnNonzero ; CPU:$C47B PRG:047B 20 84 C4
ldx #$40 ; CPU:$C47E PRG:047E A2 40
ldy #$01 ; CPU:$C480 PRG:0480 A0 01
lda Zp00 ; CPU:$C482 PRG:0482 A5 00
; -----------------------------------------------------------------------------
; Routine: SubCC484_OnNonzero
; Global: The routine calls WriteByteToPpu.
; Local: Executes 6 instructions: calls WriteByteToPpu; decrements X; branches on
; not equal to SubCC484; decrements Y; branches on not equal to
; SubCC484; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; X and Y, the N and Z flags, PPUDATA.
;
; -----------------------------------------------------------------------------
SubCC484_OnNonzero:
jsr WriteByteToPpu ; CPU:$C484 PRG:0484 20 06 C0
dex ; CPU:$C487 PRG:0487 CA
bne SubCC484_OnNonzero ; CPU:$C488 PRG:0488 D0 FA
dey ; CPU:$C48A PRG:048A 88
bne SubCC484_OnNonzero ; CPU:$C48B PRG:048B D0 F7
rts ; CPU:$C48D PRG:048D 60
; -----------------------------------------------------------------------------
; Routine: UploadPaletteToPpu
; Global: The routine writes the PPUADDR registers.
; Local: Executes 5 instructions: loads A with $3F; stores A to the PPUADDR
; register; loads X with $00; stores X to the PPUADDR register; loads
; X with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpE2, $06E7, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
UploadPaletteToPpu:
lda #$3F ; CPU:$C48E PRG:048E A9 3F
sta PPUADDR ; CPU:$C490 PRG:0490 8D 06 20
ldx #$00 ; CPU:$C493 PRG:0493 A2 00
stx PPUADDR ; CPU:$C495 PRG:0495 8E 06 20
ldx #$00 ; CPU:$C498 PRG:0498 A2 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C49A
; Global: The routine calls WriteByteToPpu.
; Local: Executes 3 instructions: loads A from ZpB9; calls WriteByteToPpu; loads Y
; with $03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpE2, $06E7, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C49A:
lda ZpB9 ; CPU:$C49A PRG:049A A5 B9
jsr WriteByteToPpu ; CPU:$C49C PRG:049C 20 06 C0
ldy #$03 ; CPU:$C49F PRG:049F A0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C4A1
; Global: The routine calls WriteByteToPpu, reads $06E7.
; Local: Executes 13 instructions: loads A from ZpB9; calls WriteByteToPpu; loads Y
; with $03; compares X with $03; branches on not equal to
; Sub_8764_OnNonzero_C4C3; loads A from GameState; and 7 more
; instructions.
; Parameters: Reads $06E7 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpE2, $06E7, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C4A1:
cpx #$03 ; CPU:$C4A1 PRG:04A1 E0 03
bne Sub_8764_OnNonzero_C4C3 ; CPU:$C4A3 PRG:04A3 D0 1E
lda GameState ; CPU:$C4A5 PRG:04A5 A5 D6
cmp #$02 ; CPU:$C4A7 PRG:04A7 C9 02
bne Sub_8764_OnNonzero_C4D6 ; CPU:$C4A9 PRG:04A9 D0 2B
inc $06E7 ; CPU:$C4AB PRG:04AB EE E7 06
lda $06E7 ; CPU:$C4AE PRG:04AE AD E7 06
and #$0F ; CPU:$C4B1 PRG:04B1 29 0F
bne Sub_8764_OnNonzero_C4B7 ; CPU:$C4B3 PRG:04B3 D0 02
inc ZpE2 ; CPU:$C4B5 PRG:04B5 E6 E2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C4B7
; Global: The routine calls WriteByteToPpu, reads $06E7.
; Local: Executes 19 instructions: loads A from ZpB9; calls WriteByteToPpu; loads Y
; with $03; compares X with $03; branches on not equal to
; Sub_8764_OnNonzero_C4C3; loads A from GameState; and 13 more
; instructions.
; Parameters: Reads $06E7 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpE2, $06E7, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C4B7:
lda ZpE2 ; CPU:$C4B7 PRG:04B7 A5 E2
and #$03 ; CPU:$C4B9 PRG:04B9 29 03
tax ; CPU:$C4BB PRG:04BB AA
lda $C02E,x ; CPU:$C4BC PRG:04BC BD 2E C0
ldx #$03 ; CPU:$C4BF PRG:04BF A2 03
bne Sub_8764_JoinBranchPaths_C4D9 ; CPU:$C4C1 PRG:04C1 D0 16
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C4C3
; Global: The routine calls WriteByteToPpu, reads $06E7.
; Local: Executes 25 instructions: loads A from ZpB9; calls WriteByteToPpu; loads Y
; with $03; compares X with $03; branches on not equal to
; Sub_8764_OnNonzero_C4C3; loads A from GameState; and 19 more
; instructions.
; Parameters: Reads $06E7 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpE2, $06E7, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C4C3:
cpx #$04 ; CPU:$C4C3 PRG:04C3 E0 04
bne Sub_8764_OnNonzero_C4D0 ; CPU:$C4C5 PRG:04C5 D0 09
ldx GameState ; CPU:$C4C7 PRG:04C7 A6 D6
lda $C022,x ; CPU:$C4C9 PRG:04C9 BD 22 C0
ldx #$04 ; CPU:$C4CC PRG:04CC A2 04
bne Sub_8764_JoinBranchPaths_C4D9 ; CPU:$C4CE PRG:04CE D0 09
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C4D0
; Global: The routine calls WriteByteToPpu, reads $06E7.
; Local: Executes 28 instructions: loads A from ZpB9; calls WriteByteToPpu; loads Y
; with $03; compares X with $03; branches on not equal to
; Sub_8764_OnNonzero_C4C3; loads A from GameState; and 22 more
; instructions.
; Parameters: Reads $06E7 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpE2, $06E7, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C4D0:
lda ZpDB ; CPU:$C4D0 PRG:04D0 A5 DB
cpx #$17 ; CPU:$C4D2 PRG:04D2 E0 17
beq Sub_8764_JoinBranchPaths_C4D9 ; CPU:$C4D4 PRG:04D4 F0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C4D6
; Global: The routine calls WriteByteToPpu, reads $06E7.
; Local: Executes 29 instructions: loads A from ZpB9; calls WriteByteToPpu; loads Y
; with $03; compares X with $03; branches on not equal to
; Sub_8764_OnNonzero_C4C3; loads A from GameState; and 23 more
; instructions.
; Parameters: Reads $06E7 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpE2, $06E7, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C4D6:
lda $C00A,x ; CPU:$C4D6 PRG:04D6 BD 0A C0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_C4D9
; Global: The routine calls WriteByteToPpu, reads $06E7.
; Local: Executes 35 instructions: loads A from ZpB9; calls WriteByteToPpu; loads Y
; with $03; compares X with $03; branches on not equal to
; Sub_8764_OnNonzero_C4C3; loads A from GameState; and 29 more
; instructions.
; Parameters: Reads $06E7 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, ZpE2, $06E7, PPUADDR, PPUDATA.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_C4D9:
jsr WriteByteToPpu ; CPU:$C4D9 PRG:04D9 20 06 C0
inx ; CPU:$C4DC PRG:04DC E8
dey ; CPU:$C4DD PRG:04DD 88
bne Sub_8764_OnNonzero_C4A1 ; CPU:$C4DE PRG:04DE D0 C1
cpx #$18 ; CPU:$C4E0 PRG:04E0 E0 18
bne Sub_8764_OnNonzero_C49A ; CPU:$C4E2 PRG:04E2 D0 B6
; -----------------------------------------------------------------------------
; Routine: ResetPaletteAddress
; Global: The routine writes the PPUADDR registers.
; Local: Executes 7 instructions: loads A with $3F; stores A to the PPUADDR
; register; loads A with $00; stores A to the PPUADDR register;
; stores A to the PPUADDR register; stores A to the PPUADDR register;
; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves the PPUADDR registers set.
; Clobbers:
; A, the N and Z flags, PPUADDR.
;
; -----------------------------------------------------------------------------
ResetPaletteAddress:
lda #$3F ; CPU:$C4E4 PRG:04E4 A9 3F
sta PPUADDR ; CPU:$C4E6 PRG:04E6 8D 06 20
lda #$00 ; CPU:$C4E9 PRG:04E9 A9 00
sta PPUADDR ; CPU:$C4EB PRG:04EB 8D 06 20
sta PPUADDR ; CPU:$C4EE PRG:04EE 8D 06 20
sta PPUADDR ; CPU:$C4F1 PRG:04F1 8D 06 20
rts ; CPU:$C4F4 PRG:04F4 60
; -----------------------------------------------------------------------------
; Routine: AddObjectPositionDelta
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $01; branches on not equal to
; Sub_8764_OnNonzero_C51D.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
AddObjectPositionDelta:
lda #$01 ; CPU:$C4F5 PRG:04F5 A9 01
bne Sub_8764_OnNonzero_C51D ; CPU:$C4F7 PRG:04F7 D0 24
; -----------------------------------------------------------------------------
; Routine: AddObjectYPositionDelta
; Global: The routine writes $02F0, $03CE and $043D.
; Local: Executes 8 instructions: clears the carry flag; adds $02EF,y to A;
; stores A to $02F0; loads A from $03CD,y; adds $00 to A; stores A to
; $03CE; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $02F0, $03CE and $043D changed.
; Clobbers:
; A and X, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
AddObjectYPositionDelta:
clc ; CPU:$C4F9 PRG:04F9 18
adc $02EF,y ; CPU:$C4FA PRG:04FA 79 EF 02
sta $02F0 ; CPU:$C4FD PRG:04FD 8D F0 02
lda $03CD,y ; CPU:$C500 PRG:0500 B9 CD 03
adc #$00 ; CPU:$C503 PRG:0503 69 00
sta $03CE ; CPU:$C505 PRG:0505 8D CE 03
lda #$7D ; CPU:$C508 PRG:0508 A9 7D
sta $043D ; CPU:$C50A PRG:050A 8D 3D 04
; -----------------------------------------------------------------------------
; Routine: CheckGameStateFlags
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A with $05; branches on not equal to
; Sub_8764_OnNonzero_C51D; loads A with $08; branches on not equal to
; Sub_8764_OnNonzero_C523.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, Zp01, Zp02, Zp55, ZpD0.
;
; -----------------------------------------------------------------------------
CheckGameStateFlags:
lda #$05 ; CPU:$C50D PRG:050D A9 05
bne Sub_8764_OnNonzero_C51D ; CPU:$C50F PRG:050F D0 0C
lda #$08 ; CPU:$C511 PRG:0511 A9 08
bne Sub_8764_OnNonzero_C523 ; CPU:$C513 PRG:0513 D0 0E
; -----------------------------------------------------------------------------
; Routine: StartTenFrameTimer
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A from ZpCA; branches on not equal to
; Sub_8764_OnNonzero_C51D; loads A with $0A; stores A to ZpD0.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, Zp01, Zp02, Zp55, ZpD0.
;
; -----------------------------------------------------------------------------
StartTenFrameTimer:
lda ZpCA ; CPU:$C515 PRG:0515 A5 CA
bne Sub_8764_OnNonzero_C51D ; CPU:$C517 PRG:0517 D0 04
lda #$0A ; CPU:$C519 PRG:0519 A9 0A
sta ZpD0 ; CPU:$C51B PRG:051B 85 D0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C51D
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: pushes A; loads A with $0A; stores A to
; FrameSubCounter; pulls A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N and Z flags, Zp01, Zp02, Zp55, ZpD0.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C51D:
pha ; CPU:$C51D PRG:051D 48
lda #$0A ; CPU:$C51E PRG:051E A9 0A
sta FrameSubCounter ; CPU:$C520 PRG:0520 85 55
pla ; CPU:$C522 PRG:0522 68
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C523
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: stores A to Zp01; stores X to Zp02; loads X
; from ZpD0; loads A from $C3CC,x; branches on not equal to
; Sub_8764_OnNonzero_C536; loads A from ZpCA; and 3 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, Zp01, Zp02, ZpD0.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C523:
sta Zp01 ; CPU:$C523 PRG:0523 85 01
stx Zp02 ; CPU:$C525 PRG:0525 86 02
ldx ZpD0 ; CPU:$C527 PRG:0527 A6 D0
lda $C3CC,x ; CPU:$C529 PRG:0529 BD CC C3
bne Sub_8764_OnNonzero_C536 ; CPU:$C52C PRG:052C D0 08
lda ZpCA ; CPU:$C52E PRG:052E A5 CA
bne Sub_8764_OnNonzero_C536 ; CPU:$C530 PRG:0530 D0 04
lda Zp01 ; CPU:$C532 PRG:0532 A5 01
sta ZpD0 ; CPU:$C534 PRG:0534 85 D0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C536
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X from Zp02.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; X, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C536:
ldx Zp02 ; CPU:$C536 PRG:0536 A6 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C538
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C538:
rts ; CPU:$C538 PRG:0538 60
; -----------------------------------------------------------------------------
; Routine: ReadByteFromPointer
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: returns with RTS; increments Zp4E; branches
; on not equal to SubCC53F; increments Zp4F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
ReadByteFromPointer:
inc Zp4E ; CPU:$C539 PRG:0539 E6 4E
bne SubCC53F_Loop ; CPU:$C53B PRG:053B D0 02
inc Zp4F ; CPU:$C53D PRG:053D E6 4F
; -----------------------------------------------------------------------------
; Routine: SubCC53F_Loop
; Global: The routine calls WriteByteToPpu.
; Local: Executes 6 instructions: returns with RTS; loads Y with $00; loads A
; from ((Zp4E),y); branches on equal to Sub_8764_OnZero_C538;
; branches on negative to Sub_8764_OnNegative_C54D; calls WriteByteToPpu.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCC53F_Loop:
ldy #$00 ; CPU:$C53F PRG:053F A0 00
lda (Zp4E),y ; CPU:$C541 PRG:0541 B1 4E
beq Sub_8764_OnZero_C538 ; CPU:$C543 PRG:0543 F0 F3
bmi Sub_8764_OnNegative_C54D ; CPU:$C545 PRG:0545 30 06
jsr WriteByteToPpu ; CPU:$C547 PRG:0547 20 06 C0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C54A
; Global: The routine calls ReadByteFromPointer.
; Local: Executes 1 instruction: calls ReadByteFromPointer.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C54A:
jmp ReadByteFromPointer ; CPU:$C54A PRG:054A 4C 39 C5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_C54D
; Global: The routine calls ReadByteFromPointer.
; Local: Executes 4 instructions: calls ReadByteFromPointer; ANDs A with $7F; copies A
; into Y; loads A with $80.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_C54D:
and #$7F ; CPU:$C54D PRG:054D 29 7F
tay ; CPU:$C54F PRG:054F A8
lda #$80 ; CPU:$C550 PRG:0550 A9 80
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C552
; Global: The routine calls ReadByteFromPointer and WriteByteToPpu.
; Local: Executes 5 instructions: calls ReadByteFromPointer; calls WriteByteToPpu; decrements
; Y; branches on not equal to Sub_8764_OnNonzero_C552; branches on
; equal to Sub_8764_OnZero_C54A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C552:
jsr WriteByteToPpu ; CPU:$C552 PRG:0552 20 06 C0
dey ; CPU:$C555 PRG:0555 88
bne Sub_8764_OnNonzero_C552 ; CPU:$C556 PRG:0556 D0 FA
beq Sub_8764_OnZero_C54A ; CPU:$C558 PRG:0558 F0 F0
; -----------------------------------------------------------------------------
; Routine: WriteSpriteToOam
; Global: The routine calls DrawSpritePart.
; Local: Executes 6 instructions: calls DrawSpritePart; shifts a left; shifts a
; left; copies A into X; loads A with $F8; loads Y with $04.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, Zp52, Zp53, $0700, $0701, $0702,
; $0703.
;
; -----------------------------------------------------------------------------
WriteSpriteToOam:
jsr DrawSpritePart ; CPU:$C55A PRG:055A 20 A1 C5
asl a ; CPU:$C55D PRG:055D 0A
asl a ; CPU:$C55E PRG:055E 0A
tax ; CPU:$C55F PRG:055F AA
lda #$F8 ; CPU:$C560 PRG:0560 A9 F8
ldy #$04 ; CPU:$C562 PRG:0562 A0 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C564
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: stores A to $0700,x; increments X;
; decrements Y; branches on not equal to Sub_8764_OnNonzero_C564;
; branches on equal to SubCC59C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, Zp52, $0700, $0701, $0702, $0703.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C564:
sta $0700,x ; CPU:$C564 PRG:0564 9D 00 07
inx ; CPU:$C567 PRG:0567 E8
dey ; CPU:$C568 PRG:0568 88
bne Sub_8764_OnNonzero_C564 ; CPU:$C569 PRG:0569 D0 F9
beq SubCC59C_OnZero ; CPU:$C56B PRG:056B F0 2F
; -----------------------------------------------------------------------------
; Routine: WriteSpriteToOamAlt
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 14 instructions: stores X to Zp52; shifts a left; shifts a
; left; copies A into X; loads A from Zp4A; stores A to $0700,x; and
; 8 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z and C flags, Zp52, $0700, $0701, $0702, $0703.
;
; -----------------------------------------------------------------------------
WriteSpriteToOamAlt:
stx Zp52 ; CPU:$C56D PRG:056D 86 52
asl a ; CPU:$C56F PRG:056F 0A
asl a ; CPU:$C570 PRG:0570 0A
tax ; CPU:$C571 PRG:0571 AA
lda Zp4A ; CPU:$C572 PRG:0572 A5 4A
sta $0700,x ; CPU:$C574 PRG:0574 9D 00 07
lda Zp4B ; CPU:$C577 PRG:0577 A5 4B
sta $0701,x ; CPU:$C579 PRG:0579 9D 01 07
lda Zp4D ; CPU:$C57C PRG:057C A5 4D
sta $0702,x ; CPU:$C57E PRG:057E 9D 02 07
lda Zp49 ; CPU:$C581 PRG:0581 A5 49
sta $0703,x ; CPU:$C583 PRG:0583 9D 03 07
ldx Zp52 ; CPU:$C586 PRG:0586 A6 52
rts ; CPU:$C588 PRG:0588 60
; -----------------------------------------------------------------------------
; Routine: WriteSpriteToOamB
; Global: The routine calls DrawSpritePart.
; Local: Executes 8 instructions: calls DrawSpritePart; shifts a left; shifts a
; left; shifts a left; shifts a left; copies A into X; and 2 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, Zp52, Zp53, $0700.
;
; -----------------------------------------------------------------------------
WriteSpriteToOamB:
jsr DrawSpritePart ; CPU:$C589 PRG:0589 20 A1 C5
asl a ; CPU:$C58C PRG:058C 0A
asl a ; CPU:$C58D PRG:058D 0A
asl a ; CPU:$C58E PRG:058E 0A
asl a ; CPU:$C58F PRG:058F 0A
tax ; CPU:$C590 PRG:0590 AA
lda #$F8 ; CPU:$C591 PRG:0591 A9 F8
ldy #$10 ; CPU:$C593 PRG:0593 A0 10
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C595
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: stores A to $0700,x; increments X;
; decrements Y; branches on not equal to Sub_8764_OnNonzero_C595.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; X and Y, the N and Z flags, $0700.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C595:
sta $0700,x ; CPU:$C595 PRG:0595 9D 00 07
inx ; CPU:$C598 PRG:0598 E8
dey ; CPU:$C599 PRG:0599 88
bne Sub_8764_OnNonzero_C595 ; CPU:$C59A PRG:059A D0 F9
; -----------------------------------------------------------------------------
; Routine: SubCC59C_OnZero
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads X from Zp52; loads Y from Zp53;
; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; X and Y, the N and Z flags.
;
; -----------------------------------------------------------------------------
SubCC59C_OnZero:
ldx Zp52 ; CPU:$C59C PRG:059C A6 52
ldy Zp53 ; CPU:$C59E PRG:059E A4 53
rts ; CPU:$C5A0 PRG:05A0 60
; -----------------------------------------------------------------------------
; Routine: DrawSpritePart
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: stores X to Zp52; stores Y to Zp53; returns
; with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, Zp52, Zp53.
;
; -----------------------------------------------------------------------------
DrawSpritePart:
stx Zp52 ; CPU:$C5A1 PRG:05A1 86 52
sty Zp53 ; CPU:$C5A3 PRG:05A3 84 53
rts ; CPU:$C5A5 PRG:05A5 60
; -----------------------------------------------------------------------------
; Routine: DrawSpritePartAlt
; Global: The routine calls DrawSpritePart.
; Local: Executes 10 instructions: loads X from Zp52; loads Y from Zp53;
; returns with RTS; calls DrawSpritePart; shifts a left; shifts a left; and
; 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawSpritePartAlt:
jsr DrawSpritePart ; CPU:$C5A6 PRG:05A6 20 A1 C5
asl a ; CPU:$C5A9 PRG:05A9 0A
asl a ; CPU:$C5AA PRG:05AA 0A
asl a ; CPU:$C5AB PRG:05AB 0A
asl a ; CPU:$C5AC PRG:05AC 0A
tax ; CPU:$C5AD PRG:05AD AA
ldy #$00 ; CPU:$C5AE PRG:05AE A0 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C5B0
; Global: The routine calls WriteSpriteTileIndex, WriteSpriteXPosition, WriteSpriteAttribute and WriteSpriteYPosition.
; Local: Executes 15 instructions: loads X from Zp52; loads Y from Zp53;
; returns with RTS; calls WriteSpriteTileIndex; calls WriteSpriteXPosition; calls WriteSpriteAttribute;
; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C5B0:
jsr WriteSpriteTileIndex ; CPU:$C5B0 PRG:05B0 20 FD C5
jsr WriteSpriteXPosition ; CPU:$C5B3 PRG:05B3 20 07 C6
jsr WriteSpriteAttribute ; CPU:$C5B6 PRG:05B6 20 11 C6
jsr WriteSpriteYPosition ; CPU:$C5B9 PRG:05B9 20 1B C6
inx ; CPU:$C5BC PRG:05BC E8
inx ; CPU:$C5BD PRG:05BD E8
inx ; CPU:$C5BE PRG:05BE E8
inx ; CPU:$C5BF PRG:05BF E8
iny ; CPU:$C5C0 PRG:05C0 C8
cpy #$04 ; CPU:$C5C1 PRG:05C1 C0 04
bne Sub_8764_OnNonzero_C5B0 ; CPU:$C5C3 PRG:05C3 D0 EB
beq SubCC59C_OnZero ; CPU:$C5C5 PRG:05C5 F0 D5
; -----------------------------------------------------------------------------
; Routine: DrawSpritePartAlt2
; Global: The routine calls DrawSpritePart.
; Local: Executes 17 instructions: loads X from Zp52; loads Y from Zp53;
; returns with RTS; calls DrawSpritePart; shifts a left; shifts a left; and
; 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawSpritePartAlt2:
jsr DrawSpritePart ; CPU:$C5C7 PRG:05C7 20 A1 C5
asl a ; CPU:$C5CA PRG:05CA 0A
asl a ; CPU:$C5CB PRG:05CB 0A
asl a ; CPU:$C5CC PRG:05CC 0A
asl a ; CPU:$C5CD PRG:05CD 0A
tax ; CPU:$C5CE PRG:05CE AA
lda Zp4C ; CPU:$C5CF PRG:05CF A5 4C
asl a ; CPU:$C5D1 PRG:05D1 0A
asl a ; CPU:$C5D2 PRG:05D2 0A
sta Zp00 ; CPU:$C5D3 PRG:05D3 85 00
lda #$00 ; CPU:$C5D5 PRG:05D5 A9 00
sta Zp02 ; CPU:$C5D7 PRG:05D7 85 02
lda #$04 ; CPU:$C5D9 PRG:05D9 A9 04
sta Zp01 ; CPU:$C5DB PRG:05DB 85 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C5DD
; Global: The routine calls WriteSpriteTileIndex, WriteSpriteYPosition, WriteSpriteAttribute and WriteSpriteXPosition.
; Local: Executes 19 instructions: loads X from Zp52; loads Y from Zp53;
; returns with RTS; loads Y from Zp02; calls WriteSpriteTileIndex; calls
; WriteSpriteYPosition; and 13 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C5DD:
ldy Zp02 ; CPU:$C5DD PRG:05DD A4 02
jsr WriteSpriteTileIndex ; CPU:$C5DF PRG:05DF 20 FD C5
jsr WriteSpriteYPosition ; CPU:$C5E2 PRG:05E2 20 1B C6
ldy Zp4C ; CPU:$C5E5 PRG:05E5 A4 4C
jsr WriteSpriteAttribute ; CPU:$C5E7 PRG:05E7 20 11 C6
ldy Zp00 ; CPU:$C5EA PRG:05EA A4 00
jsr WriteSpriteXPosition ; CPU:$C5EC PRG:05EC 20 07 C6
inx ; CPU:$C5EF PRG:05EF E8
inx ; CPU:$C5F0 PRG:05F0 E8
inx ; CPU:$C5F1 PRG:05F1 E8
inx ; CPU:$C5F2 PRG:05F2 E8
inc Zp00 ; CPU:$C5F3 PRG:05F3 E6 00
inc Zp02 ; CPU:$C5F5 PRG:05F5 E6 02
dec Zp01 ; CPU:$C5F7 PRG:05F7 C6 01
bne Sub_8764_OnNonzero_C5DD ; CPU:$C5F9 PRG:05F9 D0 E2
beq SubCC59C_OnZero ; CPU:$C5FB PRG:05FB F0 9F
; -----------------------------------------------------------------------------
; Routine: WriteSpriteTileIndex
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp4A; clears the carry flag;
; adds $C629,y to A; stores A to $0700,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, $0700.
;
; -----------------------------------------------------------------------------
WriteSpriteTileIndex:
lda Zp4A ; CPU:$C5FD PRG:05FD A5 4A
clc ; CPU:$C5FF PRG:05FF 18
adc $C629,y ; CPU:$C600 PRG:0600 79 29 C6
sta $0700,x ; CPU:$C603 PRG:0603 9D 00 07
rts ; CPU:$C606 PRG:0606 60
; -----------------------------------------------------------------------------
; Routine: WriteSpriteXPosition
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp4B; clears the carry flag;
; adds $C63D,y to A; stores A to $0701,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, $0701.
;
; -----------------------------------------------------------------------------
WriteSpriteXPosition:
lda Zp4B ; CPU:$C607 PRG:0607 A5 4B
clc ; CPU:$C609 PRG:0609 18
adc $C63D,y ; CPU:$C60A PRG:060A 79 3D C6
sta $0701,x ; CPU:$C60D PRG:060D 9D 01 07
rts ; CPU:$C610 PRG:0610 60
; -----------------------------------------------------------------------------
; Routine: WriteSpriteAttribute
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp4D; clears the carry flag;
; adds $C62D,y to A; stores A to $0702,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, $0702.
;
; -----------------------------------------------------------------------------
WriteSpriteAttribute:
lda Zp4D ; CPU:$C611 PRG:0611 A5 4D
clc ; CPU:$C613 PRG:0613 18
adc $C62D,y ; CPU:$C614 PRG:0614 79 2D C6
sta $0702,x ; CPU:$C617 PRG:0617 9D 02 07
rts ; CPU:$C61A PRG:061A 60
; -----------------------------------------------------------------------------
; Routine: WriteSpriteYPosition
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp49; clears the carry flag;
; adds $C625,y to A; stores A to $0703,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, $0703.
;
; -----------------------------------------------------------------------------
WriteSpriteYPosition:
lda Zp49 ; CPU:$C61B PRG:061B A5 49
clc ; CPU:$C61D PRG:061D 18
adc $C625,y ; CPU:$C61E PRG:061E 79 25 C6
sta $0703,x ; CPU:$C621 PRG:0621 9D 03 07
rts ; CPU:$C624 PRG:0624 60
; ---- data $C625-$C6E2 (190 bytes) ----
; referenced by `adc $C629,y` at $C600 (operand $C629 falls inside this region)
; referenced by `adc $C63D,y` at $C60A (operand $C63D falls inside this region)
; referenced by `adc $C62D,y` at $C614 (operand $C62D falls inside this region)
; referenced by `adc $C625,y` at $C61E (operand $C625 falls inside this region)
SpritePositionOffsetTable:
.byte $00, $08, $00, $08 ; CPU:$C625 PRG:0625 00 08 00 08
SpriteTileOffsetTable:
.byte $00, $00, $08, $08 ; CPU:$C629 PRG:0629 00 00 08 08
SpriteAttributeOffsetTable:
.byte $00, $00, $00, $00, $00, $80, $80, $80 ; CPU:$C62D PRG:062D 00 00 00 00 00 80 80 80
.byte $80, $C0, $C0, $C0, $C0, $40, $40, $40 ; CPU:$C635 PRG:0635 80 C0 C0 C0 C0 40 40 40
SpriteScreenOffsetTable:
.byte $00, $01, $10, $11, $02, $03, $12, $13 ; CPU:$C63D PRG:063D 00 01 10 11 02 03 12 13
.byte $04, $05, $14, $15, $06, $07, $16, $17, $08, $09, $18, $19, $16, $17, $06, $07 ; CPU:$C645 PRG:0645 04 05 14 15 06 07 16 17 08 09 18 19 16 17 06 07
.byte $14, $15, $04, $05, $12, $13, $02, $03, $10, $11, $00, $01, $13, $12, $03, $02 ; CPU:$C655 PRG:0655 14 15 04 05 12 13 02 03 10 11 00 01 13 12 03 02
.byte $15, $14, $05, $04, $17, $16, $07, $06, $19, $18, $09, $08, $07, $06, $17, $16 ; CPU:$C665 PRG:0665 15 14 05 04 17 16 07 06 19 18 09 08 07 06 17 16
.byte $05, $04, $15, $14, $03, $02, $13, $12 ; CPU:$C675 PRG:0675 05 04 15 14 03 02 13 12
CopyrightCreditText:
.byte $67, $61, $6D, $65, $7F, $61, $BA, $67 ; CPU:$C67D PRG:067D 67 61 6D 65 7F 61 BA 67
.byte $61, $6D, $65, $7F, $62, $BA, $71, $7F, $70, $6C, $61, $79, $CF, $7F, $7F, $7F ; CPU:$C685 PRG:0685 61 6D 65 7F 62 BA 71 7F 70 6C 61 79 CF 7F 7F 7F
.byte $7F, $63, $6F, $70, $79, $72, $69, $67, $68, $74, $7F, $60, $7F, $7B, $7C, $7D ; CPU:$C695 PRG:0695 7F 63 6F 70 79 72 69 67 68 74 7F 60 7F 7B 7C 7D
.byte $7E, $7F, $66, $6D, $67 ; CPU:$C6A5 PRG:06A5 7E 7F 66 6D 67
.byte $7F, $7F, $7F, $7F, $89, $7F, $7F, $7F, $7F, $7F, $7F ; CPU:$C6AA PRG:06AA 7F 7F 7F 7F 89 7F 7F 7F 7F 7F 7F
.byte $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $8B, $7F, $7F, $7F ; CPU:$C6B5 PRG:06B5 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 8B 7F 7F 7F
.byte $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F, $7F ; CPU:$C6C5 PRG:06C5 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F
.byte $7F, $7F, $7F, $7F, $91, $00, $62, $79, $7F, $6B, $69, $6B, $75, $00 ; CPU:$C6D5 PRG:06D5 7F 7F 7F 7F 91 00 62 79 7F 6B 69 6B 75 00
; -----------------------------------------------------------------------------
; Routine: ResetEntry
; Global: The routine writes the PPUCTRL register.
; Local: Executes 3 instructions: loads A with $10; stores A to the PPUCTRL
; register; stores A to PpuCtrlShadow.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the PPUCTRL register set.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
ResetEntry:
lda #$10 ; CPU:$C6E3 PRG:06E3 A9 10
sta PPUCTRL ; CPU:$C6E5 PRG:06E5 8D 00 20
sta PpuCtrlShadow ; CPU:$C6E8 PRG:06E8 85 C2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C6EA
; Global: The routine reads the PPUSTATUS register.
; Local: Executes 7 instructions: increments PrngPeriodCounter; loads A from
; the PPUSTATUS register; branches on non-negative to
; Sub_8764_OnNonnegative_C6EA; loads X with $FF; increments X; copies
; X into A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C6EA:
inc PrngPeriodCounter ; CPU:$C6EA PRG:06EA E6 EA
lda PPUSTATUS ; CPU:$C6EC PRG:06EC AD 02 20
bpl Sub_8764_OnNonnegative_C6EA; CPU:$C6EF PRG:06EF 10 F9
ldx #$FF ; CPU:$C6F1 PRG:06F1 A2 FF
txs ; CPU:$C6F3 PRG:06F3 9A
inx ; CPU:$C6F4 PRG:06F4 E8
txa ; CPU:$C6F5 PRG:06F5 8A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C6F6
; Global: The routine calls ClearGameRam, reads $026D and $0273.
; Local: Executes 11 instructions: stores A to Zp00,x; increments X; compares
; X with $EA; branches on not equal to Sub_8764_OnNonzero_C6F6; calls
; ClearGameRam; loads A from $026D; and 5 more instructions.
; Parameters: Reads $026D and $0273 from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C6F6:
sta Zp00,x ; CPU:$C6F6 PRG:06F6 95 00
inx ; CPU:$C6F8 PRG:06F8 E8
cpx #$EA ; CPU:$C6F9 PRG:06F9 E0 EA
bne Sub_8764_OnNonzero_C6F6 ; CPU:$C6FB PRG:06FB D0 F9
jsr ClearGameRam ; CPU:$C6FD PRG:06FD 20 8E C9
lda $026D ; CPU:$C700 PRG:0700 AD 6D 02
ora $0273 ; CPU:$C703 PRG:0703 0D 73 02
cmp #$23 ; CPU:$C706 PRG:0706 C9 23
beq SubCC719_Loop ; CPU:$C708 PRG:0708 F0 0F
lda #$23 ; CPU:$C70A PRG:070A A9 23
ldx #$0B ; CPU:$C70C PRG:070C A2 0B
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C70E
; Global: The routine writes $026F.
; Local: Executes 5 instructions: stores A to $0268,x; decrements X; branches
; on non-negative to Sub_8764_OnNonnegative_C70E; loads A with $25;
; stores A to $026F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $026F changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C70E:
sta $0268,x ; CPU:$C70E PRG:070E 9D 68 02
dex ; CPU:$C711 PRG:0711 CA
bpl Sub_8764_OnNonnegative_C70E; CPU:$C712 PRG:0712 10 FA
lda #$25 ; CPU:$C714 PRG:0714 A9 25
sta $026F ; CPU:$C716 PRG:0716 8D 6F 02
; -----------------------------------------------------------------------------
; Routine: SubCC719_Loop
; Global: The routine calls ClearGameRam.
; Local: Executes 5 instructions: loads X with $FF; calls ClearGameRam; loads A
; with $01; loads X with $06.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
SubCC719_Loop:
ldx #$FF ; CPU:$C719 PRG:0719 A2 FF
txs ; CPU:$C71B PRG:071B 9A
jsr ClearGameRam ; CPU:$C71C PRG:071C 20 8E C9
lda #$01 ; CPU:$C71F PRG:071F A9 01
ldx #$06 ; CPU:$C721 PRG:0721 A2 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C723
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: stores A to ZpE3,x; decrements X; branches
; on non-negative to Sub_8764_OnNonnegative_C723; loads X with $29.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C723:
sta ZpE3,x ; CPU:$C723 PRG:0723 95 E3
dex ; CPU:$C725 PRG:0725 CA
bpl Sub_8764_OnNonnegative_C723; CPU:$C726 PRG:0726 10 FB
ldx #$29 ; CPU:$C728 PRG:0728 A2 29
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C72A
; Global: The routine calls StartFullFrameUpdate and WritePaletteBytes, writes the PPUADDR
; registers.
; Local: Executes 12 instructions: loads A from $DADD,x; stores A to $06AD,x;
; decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_C72A; calls StartFullFrameUpdate; loads A with $00; and
; 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C72A:
lda $DADD,x ; CPU:$C72A PRG:072A BD DD DA
sta $06AD,x ; CPU:$C72D PRG:072D 9D AD 06
dex ; CPU:$C730 PRG:0730 CA
bpl Sub_8764_OnNonnegative_C72A; CPU:$C731 PRG:0731 10 F7
jsr StartFullFrameUpdate ; CPU:$C733 PRG:0733 20 E2 C3
lda #$00 ; CPU:$C736 PRG:0736 A9 00
jsr WritePaletteBytes ; CPU:$C738 PRG:0738 20 47 C4
lda #$20 ; CPU:$C73B PRG:073B A9 20
sta PPUADDR ; CPU:$C73D PRG:073D 8D 06 20
ldx #$C8 ; CPU:$C740 PRG:0740 A2 C8
stx PPUADDR ; CPU:$C742 PRG:0742 8E 06 20
ldy #$00 ; CPU:$C745 PRG:0745 A0 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C747
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $10.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C747:
ldx #$10 ; CPU:$C747 PRG:0747 A2 10
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C749
; Global: The routine calls WriteByteToPpu.
; Local: Executes 11 instructions: loads X with $10; copies Y into A; calls
; WriteByteToPpu; increments Y; decrements X; branches on not equal to
; Sub_8764_OnNonzero_C749; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C749:
tya ; CPU:$C749 PRG:0749 98
jsr WriteByteToPpu ; CPU:$C74A PRG:074A 20 06 C0
iny ; CPU:$C74D PRG:074D C8
dex ; CPU:$C74E PRG:074E CA
bne Sub_8764_OnNonzero_C749 ; CPU:$C74F PRG:074F D0 F8
tya ; CPU:$C751 PRG:0751 98
and #$10 ; CPU:$C752 PRG:0752 29 10
bne Sub_8764_OnNonzero_C75A ; CPU:$C754 PRG:0754 D0 04
ldx #$30 ; CPU:$C756 PRG:0756 A2 30
bne Sub_8764_OnNonzero_C75C ; CPU:$C758 PRG:0758 D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C75A
; Global: The routine calls WriteByteToPpu.
; Local: Executes 12 instructions: loads X with $10; copies Y into A; calls
; WriteByteToPpu; increments Y; decrements X; branches on not equal to
; Sub_8764_OnNonzero_C749; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C75A:
ldx #$10 ; CPU:$C75A PRG:075A A2 10
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C75C
; Global: The routine calls WriteByteToPpu, SubCC53F and ReadByteFromPointer, writes the
; PPUADDR registers.
; Local: Executes 31 instructions: loads X with $10; copies Y into A; calls
; WriteByteToPpu; increments Y; decrements X; branches on not equal to
; Sub_8764_OnNonzero_C749; and 25 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C75C:
lda #$80 ; CPU:$C75C PRG:075C A9 80
jsr WriteByteToPpu ; CPU:$C75E PRG:075E 20 06 C0
dex ; CPU:$C761 PRG:0761 CA
bne Sub_8764_OnNonzero_C75C ; CPU:$C762 PRG:0762 D0 F8
cpy #$60 ; CPU:$C764 PRG:0764 C0 60
bne Sub_8764_OnNonzero_C747 ; CPU:$C766 PRG:0766 D0 DF
lda #$22 ; CPU:$C768 PRG:0768 A9 22
sta PPUADDR ; CPU:$C76A PRG:076A 8D 06 20
ldx #$2D ; CPU:$C76D PRG:076D A2 2D
stx PPUADDR ; CPU:$C76F PRG:076F 8E 06 20
lda #$7D ; CPU:$C772 PRG:0772 A9 7D
sta Zp4E ; CPU:$C774 PRG:0774 85 4E
lda #$C6 ; CPU:$C776 PRG:0776 A9 C6
sta Zp4F ; CPU:$C778 PRG:0778 85 4F
jsr SubCC53F_Loop ; CPU:$C77A PRG:077A 20 3F C5
lda Zp50 ; CPU:$C77D PRG:077D A5 50
eor #$68 ; CPU:$C77F PRG:077F 49 68
bne Sub_8764_OnNonzero_C786 ; CPU:$C781 PRG:0781 D0 03
jsr ReadByteFromPointer ; CPU:$C783 PRG:0783 20 39 C5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C786
; Global: The routine calls RestoreScreenAfterFrame.
; Local: Executes 4 instructions: calls RestoreScreenAfterFrame; loads A with $01; stores A
; to ZpC7; branches on not equal to Sub_8764_OnNonzero_C7C7.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C786:
jsr RestoreScreenAfterFrame ; CPU:$C786 PRG:0786 20 5A C9
lda #$01 ; CPU:$C789 PRG:0789 A9 01
sta ZpC7 ; CPU:$C78B PRG:078B 85 C7
bne Sub_8764_OnNonzero_C7C7 ; CPU:$C78D PRG:078D D0 38
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C78F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $C8; stores A to ZpD4.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C78F:
lda #$C8 ; CPU:$C78F PRG:078F A9 C8
sta ZpD4 ; CPU:$C791 PRG:0791 85 D4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_C793
; Global: The routine calls SubCC043 and UpdatePseudoRandomNumber, writes the APUSTATUS
; register.
; Local: Executes 13 instructions: loads A with $C8; stores A to ZpD4; loads A
; with $00; stores A to the APUSTATUS register; decrements ZpD4;
; branches on equal to Sub_8764_OnZero_C7ED; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the APUSTATUS register set.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_C793:
lda #$00 ; CPU:$C793 PRG:0793 A9 00
sta APUSTATUS ; CPU:$C795 PRG:0795 8D 15 40
dec ZpD4 ; CPU:$C798 PRG:0798 C6 D4
beq Sub_8764_OnZero_C7ED ; CPU:$C79A PRG:079A F0 51
ldy #$64 ; CPU:$C79C PRG:079C A0 64
jsr SubCC043_OnNonzero ; CPU:$C79E PRG:079E 20 43 C0
jsr UpdatePseudoRandomNumber ; CPU:$C7A1 PRG:07A1 20 12 C4
ldx Zp50 ; CPU:$C7A4 PRG:07A4 A6 50
bne Sub_8764_OnNonzero_C7AC ; CPU:$C7A6 PRG:07A6 D0 04
stx ZpC7 ; CPU:$C7A8 PRG:07A8 86 C7
beq Sub_8764_JoinBranchPaths_C793 ; CPU:$C7AA PRG:07AA F0 E7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C7AC
; Global: The routine calls SubCC043 and UpdatePseudoRandomNumber, writes the APUSTATUS
; register.
; Local: Executes 26 instructions: loads A with $C8; stores A to ZpD4; loads A
; with $00; stores A to the APUSTATUS register; decrements ZpD4;
; branches on equal to Sub_8764_OnZero_C7ED; and 20 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the APUSTATUS register set.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C7AC:
lda ZpC7 ; CPU:$C7AC PRG:07AC A5 C7
bne Sub_8764_JoinBranchPaths_C793 ; CPU:$C7AE PRG:07AE D0 E3
inc ZpC7 ; CPU:$C7B0 PRG:07B0 E6 C7
txa ; CPU:$C7B2 PRG:07B2 8A
and #$10 ; CPU:$C7B3 PRG:07B3 29 10
bne Sub_8764_OnNonzero_C7E3 ; CPU:$C7B5 PRG:07B5 D0 2C
txa ; CPU:$C7B7 PRG:07B7 8A
and #$20 ; CPU:$C7B8 PRG:07B8 29 20
beq Sub_8764_JoinBranchPaths_C793 ; CPU:$C7BA PRG:07BA F0 D7
ldx ZpC9 ; CPU:$C7BC PRG:07BC A6 C9
cpx #$02 ; CPU:$C7BE PRG:07BE E0 02
bne Sub_8764_OnNonzero_C7C4 ; CPU:$C7C0 PRG:07C0 D0 02
ldx #$FF ; CPU:$C7C2 PRG:07C2 A2 FF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C7C4
; Global: The routine calls SubCC043 and UpdatePseudoRandomNumber, writes the APUSTATUS
; register.
; Local: Executes 28 instructions: loads A with $C8; stores A to ZpD4; loads A
; with $00; stores A to the APUSTATUS register; decrements ZpD4;
; branches on equal to Sub_8764_OnZero_C7ED; and 22 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the APUSTATUS register set.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C7C4:
inx ; CPU:$C7C4 PRG:07C4 E8
stx ZpC9 ; CPU:$C7C5 PRG:07C5 86 C9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C7C7
; Global: The routine calls SubCC043 and UpdatePseudoRandomNumber, writes $0700, $0703, $0701
; and $0702, writes the APUSTATUS register.
; Local: Executes 42 instructions: loads A with $C8; stores A to ZpD4; loads A
; with $00; stores A to the APUSTATUS register; decrements ZpD4;
; branches on equal to Sub_8764_OnZero_C7ED; and 36 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $0700, $0703 and $0701
; changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C7C7:
lda ZpC9 ; CPU:$C7C7 PRG:07C7 A5 C9
asl a ; CPU:$C7C9 PRG:07C9 0A
asl a ; CPU:$C7CA PRG:07CA 0A
asl a ; CPU:$C7CB PRG:07CB 0A
asl a ; CPU:$C7CC PRG:07CC 0A
adc #$87 ; CPU:$C7CD PRG:07CD 69 87
sta $0700 ; CPU:$C7CF PRG:07CF 8D 00 07
lda #$5C ; CPU:$C7D2 PRG:07D2 A9 5C
sta $0703 ; CPU:$C7D4 PRG:07D4 8D 03 07
ldx #$DF ; CPU:$C7D7 PRG:07D7 A2 DF
stx $0701 ; CPU:$C7D9 PRG:07D9 8E 01 07
lda #$00 ; CPU:$C7DC PRG:07DC A9 00
sta $0702 ; CPU:$C7DE PRG:07DE 8D 02 07
beq Sub_8764_OnZero_C78F ; CPU:$C7E1 PRG:07E1 F0 AC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C7E3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $23; loads X with $05.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C7E3:
lda #$23 ; CPU:$C7E3 PRG:07E3 A9 23
ldx #$05 ; CPU:$C7E5 PRG:07E5 A2 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C7E7
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: stores A to $0268,x; decrements X; branches
; on non-negative to Sub_8764_OnNonnegative_C7E7.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C7E7:
sta $0268,x ; CPU:$C7E7 PRG:07E7 9D 68 02
dex ; CPU:$C7EA PRG:07EA CA
bpl Sub_8764_OnNonnegative_C7E7; CPU:$C7EB PRG:07EB 10 FA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C7ED
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 11 instructions: loads A with $01; stores A to ZpD3; loads A
; with $05; stores A to ZpD5; loads X with $FF; stores X to ZpD8; and
; 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C7ED:
lda #$01 ; CPU:$C7ED PRG:07ED A9 01
sta ZpD3 ; CPU:$C7EF PRG:07EF 85 D3
lda #$05 ; CPU:$C7F1 PRG:07F1 A9 05
sta ZpD5 ; CPU:$C7F3 PRG:07F3 85 D5
ldx #$FF ; CPU:$C7F5 PRG:07F5 A2 FF
stx ZpD8 ; CPU:$C7F7 PRG:07F7 86 D8
inx ; CPU:$C7F9 PRG:07F9 E8
stx ZpD9 ; CPU:$C7FA PRG:07FA 86 D9
stx ZpD7 ; CPU:$C7FC PRG:07FC 86 D7
ldx #$6E ; CPU:$C7FE PRG:07FE A2 6E
lda #$C8 ; CPU:$C800 PRG:0800 A9 C8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C802
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: stores A to $035E,x; decrements X; compares
; X with $58; branches on not equal to Sub_8764_OnNonzero_C802.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C802:
sta $035E,x ; CPU:$C802 PRG:0802 9D 5E 03
dex ; CPU:$C805 PRG:0805 CA
cpx #$58 ; CPU:$C806 PRG:0806 E0 58
bne Sub_8764_OnNonzero_C802 ; CPU:$C808 PRG:0808 D0 F8
; -----------------------------------------------------------------------------
; Routine: InitEnemySlots
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads X with $58; loads A with $C8.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
InitEnemySlots:
ldx #$58 ; CPU:$C80A PRG:080A A2 58
lda #$C8 ; CPU:$C80C PRG:080C A9 C8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C80E
; Global: The routine calls InitTargetParameters and LoadSpriteDefinitionTable, writes $0262 and $0267.
; Local: Executes 19 instructions: stores A to $035E,x; decrements X; branches
; on non-negative to Sub_8764_OnNonnegative_C80E; calls InitTargetParameters;
; loads A with $01; stores A to ZpBB; and 13 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $0262 and $0267 changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C80E:
sta $035E,x ; CPU:$C80E PRG:080E 9D 5E 03
dex ; CPU:$C811 PRG:0811 CA
bpl Sub_8764_OnNonnegative_C80E; CPU:$C812 PRG:0812 10 FA
jsr InitTargetParameters ; CPU:$C814 PRG:0814 20 AB C9
lda #$01 ; CPU:$C817 PRG:0817 A9 01
sta ZpBB ; CPU:$C819 PRG:0819 85 BB
sta ZpBC ; CPU:$C81B PRG:081B 85 BC
lda #$29 ; CPU:$C81D PRG:081D A9 29
sta $0262 ; CPU:$C81F PRG:081F 8D 62 02
lda #$27 ; CPU:$C822 PRG:0822 A9 27
sta $0267 ; CPU:$C824 PRG:0824 8D 67 02
jsr LoadSpriteDefinitionTable ; CPU:$C827 PRG:0827 20 C0 CC
lda #$06 ; CPU:$C82A PRG:082A A9 06
sta ZpBD ; CPU:$C82C PRG:082C 85 BD
lda #$00 ; CPU:$C82E PRG:082E A9 00
sta GameState ; CPU:$C830 PRG:0830 85 D6
sta ZpD1 ; CPU:$C832 PRG:0832 85 D1
sta ZpDA ; CPU:$C834 PRG:0834 85 DA
sta ZpDF ; CPU:$C836 PRG:0836 85 DF
; -----------------------------------------------------------------------------
; Routine: DrawStatusScreen
; Global: The routine calls PreparePaletteUpdate and SubCC53F, writes the PPUADDR
; registers.
; Local: Executes 15 instructions: loads A from ZpD4; branches on equal to
; Sub_8764_OnZero_C89A; calls PreparePaletteUpdate; loads A with $21; stores A to
; the PPUADDR register; loads X with $2B; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
DrawStatusScreen:
lda ZpD4 ; CPU:$C838 PRG:0838 A5 D4
beq Sub_8764_OnZero_C89A ; CPU:$C83A PRG:083A F0 5E
jsr PreparePaletteUpdate ; CPU:$C83C PRG:083C 20 42 C4
lda #$21 ; CPU:$C83F PRG:083F A9 21
sta PPUADDR ; CPU:$C841 PRG:0841 8D 06 20
ldx #$2B ; CPU:$C844 PRG:0844 A2 2B
stx PPUADDR ; CPU:$C846 PRG:0846 8E 06 20
lda #$6F ; CPU:$C849 PRG:0849 A9 6F
sta Zp4E ; CPU:$C84B PRG:084B 85 4E
lda #$C9 ; CPU:$C84D PRG:084D A9 C9
sta Zp4F ; CPU:$C84F PRG:084F 85 4F
jsr SubCC53F_Loop ; CPU:$C851 PRG:0851 20 3F C5
lda #$00 ; CPU:$C854 PRG:0854 A9 00
sta Zp00 ; CPU:$C856 PRG:0856 85 00
lda ZpD3 ; CPU:$C858 PRG:0858 A5 D3
; -----------------------------------------------------------------------------
; Routine: ConvertBcdToBinary
; Global: The routine calls ConvertBcdToBinary.
; Local: Executes 4 instructions: compares A with $0A; branches on carry clear
; to Sub_8764_OnCarryClear_C863; subtracts $0A from A; calls
; ConvertBcdToBinary.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
ConvertBcdToBinary:
cmp #$0A ; CPU:$C85A PRG:085A C9 0A
bcc Sub_8764_OnCarryClear_C863 ; CPU:$C85C PRG:085C 90 05
sbc #$0A ; CPU:$C85E PRG:085E E9 0A
jmp ConvertBcdToBinary ; CPU:$C860 PRG:0860 4C 5A C8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_C863
; Global: The routine calls WriteScoreDigit, InitScoreDigits, ReadScoreDigitBuffer, RestoreScreenAfterFrame and 2 more,
; reads $0262.
; Local: Executes 24 instructions: loads Y with $47; calls WriteScoreDigit; loads A
; from $0262; sets the carry flag; subtracts $23 from A; loads Y with
; $5F; and 18 more instructions.
; Parameters: Reads $0262 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_C863:
ldy #$47 ; CPU:$C863 PRG:0863 A0 47
jsr WriteScoreDigit ; CPU:$C865 PRG:0865 20 21 C9
lda $0262 ; CPU:$C868 PRG:0868 AD 62 02
sec ; CPU:$C86B PRG:086B 38
sbc #$23 ; CPU:$C86C PRG:086C E9 23
ldy #$5F ; CPU:$C86E PRG:086E A0 5F
jsr WriteScoreDigit ; CPU:$C870 PRG:0870 20 21 C9
lda ZpD5 ; CPU:$C873 PRG:0873 A5 D5
sec ; CPU:$C875 PRG:0875 38
sbc #$01 ; CPU:$C876 PRG:0876 E9 01
ldy #$77 ; CPU:$C878 PRG:0878 A0 77
jsr WriteScoreDigit ; CPU:$C87A PRG:087A 20 21 C9
ldx #$80 ; CPU:$C87D PRG:087D A2 80
ldy #$97 ; CPU:$C87F PRG:087F A0 97
jsr InitScoreDigits ; CPU:$C881 PRG:0881 20 FB C8
ldx #$80 ; CPU:$C884 PRG:0884 A2 80
ldy #$A7 ; CPU:$C886 PRG:0886 A0 A7
lda #$88 ; CPU:$C888 PRG:0888 A9 88
sta Zp00 ; CPU:$C88A PRG:088A 85 00
lda #$2E ; CPU:$C88C PRG:088C A9 2E
jsr ReadScoreDigitBuffer ; CPU:$C88E PRG:088E 20 01 C9
jsr RestoreScreenAfterFrame ; CPU:$C891 PRG:0891 20 5A C9
jsr StartEnemySpriteSound ; CPU:$C894 PRG:0894 20 D8 C2
jsr DelayLoop ; CPU:$C897 PRG:0897 20 32 C0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C89A
; Global: The routine calls StartFullFrameUpdate, WritePaletteAndAttributeTable, RestoreScreenAfterFrame, ClearSpriteShadow and 1 more.
; Local: Executes 12 instructions: loads A with $00; stores A to ZpDB; calls
; StartFullFrameUpdate; loads A with $55; loads X with $02; loads Y with $01; and
; 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C89A:
lda #$00 ; CPU:$C89A PRG:089A A9 00
sta ZpDB ; CPU:$C89C PRG:089C 85 DB
jsr StartFullFrameUpdate ; CPU:$C89E PRG:089E 20 E2 C3
lda #$55 ; CPU:$C8A1 PRG:08A1 A9 55
ldx #$02 ; CPU:$C8A3 PRG:08A3 A2 02
ldy #$01 ; CPU:$C8A5 PRG:08A5 A0 01
jsr WritePaletteAndAttributeTable ; CPU:$C8A7 PRG:08A7 20 4B C4
jsr RestoreScreenAfterFrame ; CPU:$C8AA PRG:08AA 20 5A C9
jsr ClearSpriteShadow ; CPU:$C8AD PRG:08AD 20 26 CD
lda ZpD7 ; CPU:$C8B0 PRG:08B0 A5 D7
beq Sub_8764_OnZero_C8B7 ; CPU:$C8B2 PRG:08B2 F0 03
jsr ResetSpriteAttributes ; CPU:$C8B4 PRG:08B4 20 E6 D1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C8B7
; Global: The routine calls SubCCED3 and DrawStatusScreen, reads the JOY1 register.
; Local: Executes 9 instructions: loads A from the JOY1 register; ANDs A with
; $04; stores A to ZpE1; calls SubCCED3; loads A from ZpD4; branches
; on equal to Sub_8764_OnZero_C8E5; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C8B7:
lda JOY1 ; CPU:$C8B7 PRG:08B7 AD 16 40
and #$04 ; CPU:$C8BA PRG:08BA 29 04
sta ZpE1 ; CPU:$C8BC PRG:08BC 85 E1
jsr SubCCED3_OnNonnegative ; CPU:$C8BE PRG:08BE 20 D3 CE
lda ZpD4 ; CPU:$C8C1 PRG:08C1 A5 D4
beq Sub_8764_OnZero_C8E5 ; CPU:$C8C3 PRG:08C3 F0 20
lda ZpD5 ; CPU:$C8C5 PRG:08C5 A5 D5
beq Sub_8764_OnZero_C8CC ; CPU:$C8C7 PRG:08C7 F0 03
jmp DrawStatusScreen ; CPU:$C8C9 PRG:08C9 4C 38 C8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C8CC
; Global: The routine calls InitScoreDisplay, StartFullFrameUpdate, WritePaletteBytes, DrawScoreRow and 1 more.
; Local: Executes 10 instructions: calls InitScoreDisplay; calls StartFullFrameUpdate; loads A
; with $00; calls WritePaletteBytes; loads A with $F0; stores A to Zp4E; and 4
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C8CC:
jsr InitScoreDisplay ; CPU:$C8CC PRG:08CC 20 E8 C8
jsr StartFullFrameUpdate ; CPU:$C8CF PRG:08CF 20 E2 C3
lda #$00 ; CPU:$C8D2 PRG:08D2 A9 00
jsr WritePaletteBytes ; CPU:$C8D4 PRG:08D4 20 47 C4
lda #$F0 ; CPU:$C8D7 PRG:08D7 A9 F0
sta Zp4E ; CPU:$C8D9 PRG:08D9 85 4E
lda #$C8 ; CPU:$C8DB PRG:08DB A9 C8
sta Zp4F ; CPU:$C8DD PRG:08DD 85 4F
jsr DrawScoreRow ; CPU:$C8DF PRG:08DF 20 4D C9
jsr DelayLoop ; CPU:$C8E2 PRG:08E2 20 32 C0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_C8E5
; Global: The routine calls SubCC719.
; Local: Executes 1 instruction: calls SubCC719.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_C8E5:
jmp SubCC719_Loop ; CPU:$C8E5 PRG:08E5 4C 19 C7
; -----------------------------------------------------------------------------
; Routine: InitScoreDisplay
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads X with $FF; stores X to ZpB7;
; increments X; stores X to ZpCF; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; X, the N and Z flags, ZpB7, ZpCF.
;
; -----------------------------------------------------------------------------
InitScoreDisplay:
ldx #$FF ; CPU:$C8E8 PRG:08E8 A2 FF
stx ZpB7 ; CPU:$C8EA PRG:08EA 86 B7
inx ; CPU:$C8EC PRG:08EC E8
stx ZpCF ; CPU:$C8ED PRG:08ED 86 CF
rts ; CPU:$C8EF PRG:08EF 60
; ---- data $C8F0-$C8FA (11 bytes) ----
GameOverText:
.byte $67, $61, $6D, $65, $7F, $7F, $6F, $76, $65, $72, $00 ; CPU:$C8F0 PRG:08F0 67 61 6D 65 7F 7F 6F 76 65 72 00
; -----------------------------------------------------------------------------
; Routine: InitScoreDigits
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A with $B0; stores A to Zp00; loads A
; with $28.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
InitScoreDigits:
lda #$B0 ; CPU:$C8FB PRG:08FB A9 B0
sta Zp00 ; CPU:$C8FD PRG:08FD 85 00
lda #$28 ; CPU:$C8FF PRG:08FF A9 28
; -----------------------------------------------------------------------------
; Routine: ReadScoreDigitBuffer
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: stores A to Zp4C; loads A with $06; stores A
; to Zp02.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
ReadScoreDigitBuffer:
sta Zp4C ; CPU:$C901 PRG:0901 85 4C
lda #$06 ; CPU:$C903 PRG:0903 A9 06
sta Zp02 ; CPU:$C905 PRG:0905 85 02
; -----------------------------------------------------------------------------
; Routine: UpdateScoreDigit
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: stores X to Zp49.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
UpdateScoreDigit:
stx Zp49 ; CPU:$C907 PRG:0907 86 49
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C909
; Global: The routine calls PrepareScoreDigitWrite.
; Local: Executes 12 instructions: loads X from Zp4C; loads A from $0240,x;
; loads X from Zp49; calls PrepareScoreDigitWrite; loads A from Zp49; clears the
; carry flag; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C909:
ldx Zp4C ; CPU:$C909 PRG:0909 A6 4C
lda $0240,x ; CPU:$C90B PRG:090B BD 40 02
ldx Zp49 ; CPU:$C90E PRG:090E A6 49
jsr PrepareScoreDigitWrite ; CPU:$C910 PRG:0910 20 27 C9
lda Zp49 ; CPU:$C913 PRG:0913 A5 49
clc ; CPU:$C915 PRG:0915 18
adc #$08 ; CPU:$C916 PRG:0916 69 08
sta Zp49 ; CPU:$C918 PRG:0918 85 49
inc Zp4C ; CPU:$C91A PRG:091A E6 4C
dec Zp02 ; CPU:$C91C PRG:091C C6 02
bne Sub_8764_OnNonzero_C909 ; CPU:$C91E PRG:091E D0 E9
rts ; CPU:$C920 PRG:0920 60
; -----------------------------------------------------------------------------
; Routine: WriteScoreDigit
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads X with $98; branches on not equal to
; Sub_8764_OnNonzero_C92A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, $0700, $0701, $0702,
; $0703.
;
; -----------------------------------------------------------------------------
WriteScoreDigit:
ldx #$98 ; CPU:$C921 PRG:0921 A2 98
bne Sub_8764_OnNonzero_C92A ; CPU:$C923 PRG:0923 D0 05
; -----------------------------------------------------------------------------
; Routine: WriteScoreDigitAlt
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads Y with $D0.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, $0700, $0701, $0702,
; $0703.
;
; -----------------------------------------------------------------------------
WriteScoreDigitAlt:
ldy #$D0 ; CPU:$C925 PRG:0925 A0 D0
; -----------------------------------------------------------------------------
; Routine: PrepareScoreDigitWrite
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: sets the carry flag; subtracts $23 from A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp00, Zp52, $0700, $0701, $0702,
; $0703.
;
; -----------------------------------------------------------------------------
PrepareScoreDigitWrite:
sec ; CPU:$C927 PRG:0927 38
sbc #$23 ; CPU:$C928 PRG:0928 E9 23
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C92A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 19 instructions: stores X to Zp52; loads X from Zp00; shifts
; a left; shifts a left; shifts a left; shifts a left; and 13 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp00, Zp52, $0700, $0701, $0702,
; $0703.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C92A:
stx Zp52 ; CPU:$C92A PRG:092A 86 52
ldx Zp00 ; CPU:$C92C PRG:092C A6 00
asl a ; CPU:$C92E PRG:092E 0A
asl a ; CPU:$C92F PRG:092F 0A
asl a ; CPU:$C930 PRG:0930 0A
asl a ; CPU:$C931 PRG:0931 0A
ora #$0F ; CPU:$C932 PRG:0932 09 0F
sta $0701,x ; CPU:$C934 PRG:0934 9D 01 07
tya ; CPU:$C937 PRG:0937 98
sta $0700,x ; CPU:$C938 PRG:0938 9D 00 07
lda #$00 ; CPU:$C93B PRG:093B A9 00
sta $0702,x ; CPU:$C93D PRG:093D 9D 02 07
lda Zp52 ; CPU:$C940 PRG:0940 A5 52
sta $0703,x ; CPU:$C942 PRG:0942 9D 03 07
lda Zp00 ; CPU:$C945 PRG:0945 A5 00
clc ; CPU:$C947 PRG:0947 18
adc #$04 ; CPU:$C948 PRG:0948 69 04
sta Zp00 ; CPU:$C94A PRG:094A 85 00
rts ; CPU:$C94C PRG:094C 60
; -----------------------------------------------------------------------------
; Routine: DrawScoreRow
; Global: The routine calls SubCC53F, writes the PPUADDR registers.
; Local: Executes 5 instructions: loads A with $21; stores A to the PPUADDR
; register; loads X with $AA; stores X to the PPUADDR register; calls
; SubCC53F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the PPUADDR registers set.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawScoreRow:
lda #$21 ; CPU:$C94D PRG:094D A9 21
sta PPUADDR ; CPU:$C94F PRG:094F 8D 06 20
ldx #$AA ; CPU:$C952 PRG:0952 A2 AA
stx PPUADDR ; CPU:$C954 PRG:0954 8E 06 20
jsr SubCC53F_Loop ; CPU:$C957 PRG:0957 20 3F C5
; -----------------------------------------------------------------------------
; Routine: RestoreScreenAfterFrame
; Global: The routine calls ResetScrollAndRestoreControl, UploadOamToPpu and SubCC407.
; Local: Executes 6 instructions: calls ResetScrollAndRestoreControl; calls UploadOamToPpu; loads A with
; $00; stores A to NmiPathSelector; calls SubCC407; loads A with $90.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
RestoreScreenAfterFrame:
jsr ResetScrollAndRestoreControl ; CPU:$C95A PRG:095A 20 F4 C3
jsr UploadOamToPpu ; CPU:$C95D PRG:095D 20 E2 CD
lda #$00 ; CPU:$C960 PRG:0960 A9 00
sta NmiPathSelector ; CPU:$C962 PRG:0962 85 C4
jsr SubCC407_OnNegative ; CPU:$C964 PRG:0964 20 07 C4
lda #$90 ; CPU:$C967 PRG:0967 A9 90
; -----------------------------------------------------------------------------
; Routine: SetPpuControlAndClearRam
; Global: The routine writes the PPUCTRL register.
; Local: Executes 3 instructions: stores A to the PPUCTRL register; stores A
; to PpuCtrlShadow; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves the PPUCTRL register set.
; Clobbers:
; no register, ZpC2, PPUCTRL.
;
; -----------------------------------------------------------------------------
SetPpuControlAndClearRam:
sta PPUCTRL ; CPU:$C969 PRG:0969 8D 00 20
sta PpuCtrlShadow ; CPU:$C96C PRG:096C 85 C2
rts ; CPU:$C96E PRG:096E 60
; ---- data $C96F-$C98D (31 bytes) ----
RoundMessageText:
.byte $72, $6F, $75, $6E, $64, $DB, $66, $61, $63, $74, $6F, $72, $79, $D9, $6C, $65 ; CPU:$C96F PRG:096F 72 6F 75 6E 64 DB 66 61 63 74 6F 72 79 D9 6C 65
.byte $66, $74, $FA, $73, $63, $6F, $72, $65, $BB, $74, $7F, $6F, $7F, $70, $00 ; CPU:$C97F PRG:097F 66 74 FA 73 63 6F 72 65 BB 74 7F 6F 7F 70 00
; -----------------------------------------------------------------------------
; Routine: ClearGameRam
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $00; copies A into X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N and Z flags, the OAM shadow, $0300, $0400, $0500, $0600.
;
; -----------------------------------------------------------------------------
ClearGameRam:
lda #$00 ; CPU:$C98E PRG:098E A9 00
tax ; CPU:$C990 PRG:0990 AA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C991
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: stores A to $0300,x; stores A to $0400,x;
; stores A to $0500,x; stores A to $0600,x; increments X; branches on
; not equal to Sub_8764_OnNonzero_C991; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, the OAM shadow, $0300, $0400, $0500, $0600.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C991:
sta $0300,x ; CPU:$C991 PRG:0991 9D 00 03
sta $0400,x ; CPU:$C994 PRG:0994 9D 00 04
sta $0500,x ; CPU:$C997 PRG:0997 9D 00 05
sta $0600,x ; CPU:$C99A PRG:099A 9D 00 06
inx ; CPU:$C99D PRG:099D E8
bne Sub_8764_OnNonzero_C991 ; CPU:$C99E PRG:099E D0 F1
ldx #$67 ; CPU:$C9A0 PRG:09A0 A2 67
lda #$00 ; CPU:$C9A2 PRG:09A2 A9 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C9A4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: stores A to $0200,x; decrements X; branches
; on non-negative to Sub_8764_OnNonnegative_C9A4; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; X, the N and Z flags, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C9A4:
sta $0200,x ; CPU:$C9A4 PRG:09A4 9D 00 02
dex ; CPU:$C9A7 PRG:09A7 CA
bpl Sub_8764_OnNonnegative_C9A4; CPU:$C9A8 PRG:09A8 10 FA
rts ; CPU:$C9AA PRG:09AA 60
; -----------------------------------------------------------------------------
; Routine: InitTargetParameters
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $38.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
InitTargetParameters:
ldx #$38 ; CPU:$C9AB PRG:09AB A2 38
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C9AD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from $CC83,x; stores A to $0667,x;
; decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_C9AD; loads X with $05; loads A with $0A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C9AD:
lda $CC83,x ; CPU:$C9AD PRG:09AD BD 83 CC
sta $0667,x ; CPU:$C9B0 PRG:09B0 9D 67 06
dex ; CPU:$C9B3 PRG:09B3 CA
bpl Sub_8764_OnNonnegative_C9AD; CPU:$C9B4 PRG:09B4 10 F7
ldx #$05 ; CPU:$C9B6 PRG:09B6 A2 05
lda #$0A ; CPU:$C9B8 PRG:09B8 A9 0A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C9BA
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 10 instructions: stores A to $06A7,x; decrements X; branches
; on non-negative to Sub_8764_OnNonnegative_C9BA; loads A with $6E;
; stores A to ZpBE; loads A with $04; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C9BA:
sta $06A7,x ; CPU:$C9BA PRG:09BA 9D A7 06
dex ; CPU:$C9BD PRG:09BD CA
bpl Sub_8764_OnNonnegative_C9BA; CPU:$C9BE PRG:09BE 10 FA
lda #$6E ; CPU:$C9C0 PRG:09C0 A9 6E
sta ZpBE ; CPU:$C9C2 PRG:09C2 85 BE
lda #$04 ; CPU:$C9C4 PRG:09C4 A9 04
sta ZpBF ; CPU:$C9C6 PRG:09C6 85 BF
lda #$07 ; CPU:$C9C8 PRG:09C8 A9 07
sta ZpC0 ; CPU:$C9CA PRG:09CA 85 C0
ldx #$05 ; CPU:$C9CC PRG:09CC A2 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_C9CE
; Global: The routine calls ScanTargetSlots.
; Local: Executes 4 instructions: calls ScanTargetSlots; decrements X; branches on
; non-negative to Sub_8764_OnNonnegative_C9CE; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_C9CE:
jsr ScanTargetSlots ; CPU:$C9CE PRG:09CE 20 DE C9
dex ; CPU:$C9D1 PRG:09D1 CA
bpl Sub_8764_OnNonnegative_C9CE; CPU:$C9D2 PRG:09D2 10 FA
rts ; CPU:$C9D4 PRG:09D4 60
; -----------------------------------------------------------------------------
; Routine: FindFreeTargetSlot
; Global: The routine calls FindNextTargetAlt.
; Local: Executes 4 instructions: stores X to Zp25; loads X with $01; calls
; FindNextTargetAlt; loads X from Zp25.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
FindFreeTargetSlot:
stx Zp25 ; CPU:$C9D5 PRG:09D5 86 25
ldx #$01 ; CPU:$C9D7 PRG:09D7 A2 01
jsr FindNextTargetAlt ; CPU:$C9D9 PRG:09D9 20 74 CA
ldx Zp25 ; CPU:$C9DC PRG:09DC A6 25
; -----------------------------------------------------------------------------
; Routine: ScanTargetSlots
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: stores X to Zp25; loads A with $03; stores A
; to Zp00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
ScanTargetSlots:
stx Zp25 ; CPU:$C9DE PRG:09DE 86 25
lda #$03 ; CPU:$C9E0 PRG:09E0 A9 03
sta Zp00 ; CPU:$C9E2 PRG:09E2 85 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_C9E4
; Global: The routine calls InitTargetScan, FindNextTarget, InitFactoryTarget, UpdateTargetState and 1 more.
; Local: Executes 14 instructions: loads X from Zp25; calls InitTargetScan;
; decrements Zp00; branches on not equal to Sub_8764_OnNonzero_C9E4;
; loads X from Zp25; calls FindNextTarget; and 8 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_C9E4:
ldx Zp25 ; CPU:$C9E4 PRG:09E4 A6 25
jsr InitTargetScan ; CPU:$C9E6 PRG:09E6 20 04 CA
dec Zp00 ; CPU:$C9E9 PRG:09E9 C6 00
bne Sub_8764_OnNonzero_C9E4 ; CPU:$C9EB PRG:09EB D0 F7
ldx Zp25 ; CPU:$C9ED PRG:09ED A6 25
jsr FindNextTarget ; CPU:$C9EF PRG:09EF 20 72 CA
ldx Zp25 ; CPU:$C9F2 PRG:09F2 A6 25
jsr InitFactoryTarget ; CPU:$C9F4 PRG:09F4 20 A8 CA
ldx Zp25 ; CPU:$C9F7 PRG:09F7 A6 25
jsr UpdateTargetState ; CPU:$C9F9 PRG:09F9 20 E6 CA
ldx Zp25 ; CPU:$C9FC PRG:09FC A6 25
jsr UpdateTargetPosition ; CPU:$C9FE PRG:09FE 20 FC CA
ldx Zp25 ; CPU:$CA01 PRG:0A01 A6 25
rts ; CPU:$CA03 PRG:0A03 60
; -----------------------------------------------------------------------------
; Routine: InitTargetScan
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A with $00; stores A to Zp03; stores A
; to Zp26; loads Y with $54.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
InitTargetScan:
lda #$00 ; CPU:$CA04 PRG:0A04 A9 00
sta Zp03 ; CPU:$CA06 PRG:0A06 85 03
sta Zp26 ; CPU:$CA08 PRG:0A08 85 26
ldy #$54 ; CPU:$CA0A PRG:0A0A A0 54
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_CA0C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_OnNegative_CA22; loads A from $04AB,y; compares A with
; $CBDB,x; branches on not equal to Sub_8764_JoinBranchPaths_CA24;
; increments Zp03; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_CA0C:
lda $035E,y ; CPU:$CA0C PRG:0A0C B9 5E 03
bmi Sub_8764_OnNegative_CA22 ; CPU:$CA0F PRG:0A0F 30 11
lda $04AB,y ; CPU:$CA11 PRG:0A11 B9 AB 04
cmp $CBDB,x ; CPU:$CA14 PRG:0A14 DD DB CB
bne Sub_8764_JoinBranchPaths_CA24 ; CPU:$CA17 PRG:0A17 D0 0B
inc Zp03 ; CPU:$CA19 PRG:0A19 E6 03
lda Zp03 ; CPU:$CA1B PRG:0A1B A5 03
cmp #$04 ; CPU:$CA1D PRG:0A1D C9 04
bcc Sub_8764_JoinBranchPaths_CA24 ; CPU:$CA1F PRG:0A1F 90 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CA21
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CA21:
rts ; CPU:$CA21 PRG:0A21 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_CA22
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 11 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_OnNegative_CA22; loads A from $04AB,y; compares A with
; $CBDB,x; branches on not equal to Sub_8764_JoinBranchPaths_CA24;
; increments Zp03; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_CA22:
sty Zp26 ; CPU:$CA22 PRG:0A22 84 26
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_CA24
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 32 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_OnNegative_CA22; loads A from $04AB,y; compares A with
; $CBDB,x; branches on not equal to Sub_8764_JoinBranchPaths_CA24;
; increments Zp03; and 26 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_CA24:
dey ; CPU:$CA24 PRG:0A24 88
cpy #$3D ; CPU:$CA25 PRG:0A25 C0 3D
bcs Sub_8764_OnCarrySet_CA0C ; CPU:$CA27 PRG:0A27 B0 E3
ldy Zp26 ; CPU:$CA29 PRG:0A29 A4 26
beq Sub_8764_OnZero_CA21 ; CPU:$CA2B PRG:0A2B F0 F4
lda $CBDB,x ; CPU:$CA2D PRG:0A2D BD DB CB
sta $04AB,y ; CPU:$CA30 PRG:0A30 99 AB 04
lda $CBE1,x ; CPU:$CA33 PRG:0A33 BD E1 CB
sta $043C,y ; CPU:$CA36 PRG:0A36 99 3C 04
lda $CBE7,x ; CPU:$CA39 PRG:0A39 BD E7 CB
sta $035E,y ; CPU:$CA3C PRG:0A3C 99 5E 03
lda $CBED,x ; CPU:$CA3F PRG:0A3F BD ED CB
sta $0280,y ; CPU:$CA42 PRG:0A42 99 80 02
lda $CBF3,x ; CPU:$CA45 PRG:0A45 BD F3 CB
sta $03CD,y ; CPU:$CA48 PRG:0A48 99 CD 03
lda $CBF9,x ; CPU:$CA4B PRG:0A4B BD F9 CB
sta $02EF,y ; CPU:$CA4E PRG:0A4E 99 EF 02
dec ZpE3,x ; CPU:$CA51 PRG:0A51 D6 E3
bpl Sub_8764_OnNonnegative_CA59; CPU:$CA53 PRG:0A53 10 04
lda #$02 ; CPU:$CA55 PRG:0A55 A9 02
sta ZpE3,x ; CPU:$CA57 PRG:0A57 95 E3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_CA59
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from ZpE3,x; branches on equal to
; Sub_8764_OnZero_CA66; compares A with $01; branches on equal to
; Sub_8764_OnZero_CA6B; copies X into A; clears the carry flag; and 2
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_CA59:
lda ZpE3,x ; CPU:$CA59 PRG:0A59 B5 E3
beq Sub_8764_OnZero_CA66 ; CPU:$CA5B PRG:0A5B F0 09
cmp #$01 ; CPU:$CA5D PRG:0A5D C9 01
beq Sub_8764_OnZero_CA6B ; CPU:$CA5F PRG:0A5F F0 0A
txa ; CPU:$CA61 PRG:0A61 8A
clc ; CPU:$CA62 PRG:0A62 18
adc #$06 ; CPU:$CA63 PRG:0A63 69 06
tax ; CPU:$CA65 PRG:0A65 AA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CA66
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: copies X into A; clears the carry flag; adds
; $06 to A; copies A into X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CA66:
txa ; CPU:$CA66 PRG:0A66 8A
clc ; CPU:$CA67 PRG:0A67 18
adc #$06 ; CPU:$CA68 PRG:0A68 69 06
tax ; CPU:$CA6A PRG:0A6A AA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CA6B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from $CBFF,x; stores A to $051A,y;
; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CA6B:
lda $CBFF,x ; CPU:$CA6B PRG:0A6B BD FF CB
sta $051A,y ; CPU:$CA6E PRG:0A6E 99 1A 05
rts ; CPU:$CA71 PRG:0A71 60
; -----------------------------------------------------------------------------
; Routine: FindNextTarget
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, $035E, $03CD, $043C, $04AB, $051A.
;
; -----------------------------------------------------------------------------
FindNextTarget:
ldx #$00 ; CPU:$CA72 PRG:0A72 A2 00
; -----------------------------------------------------------------------------
; Routine: FindNextTargetAlt
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A from ZpBE; compares A with $6E;
; branches on equal to Sub_8764_OnZero_CA86; loads Y with $6E.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z and C flags, $035E, $03CD, $043C, $04AB, $051A.
;
; -----------------------------------------------------------------------------
FindNextTargetAlt:
lda ZpBE ; CPU:$CA74 PRG:0A74 A5 BE
cmp #$6E ; CPU:$CA76 PRG:0A76 C9 6E
beq Sub_8764_OnZero_CA86 ; CPU:$CA78 PRG:0A78 F0 0C
ldy #$6E ; CPU:$CA7A PRG:0A7A A0 6E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_CA7C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_OnNegative_CA87; decrements Y; compares Y with ZpBE;
; branches on carry set to Sub_8764_OnCarrySet_CA7C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z and C flags, $035E, $03CD, $043C, $04AB, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_CA7C:
lda $035E,y ; CPU:$CA7C PRG:0A7C B9 5E 03
bmi Sub_8764_OnNegative_CA87 ; CPU:$CA7F PRG:0A7F 30 06
dey ; CPU:$CA81 PRG:0A81 88
cpy ZpBE ; CPU:$CA82 PRG:0A82 C4 BE
bcs Sub_8764_OnCarrySet_CA7C ; CPU:$CA84 PRG:0A84 B0 F6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CA86
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CA86:
rts ; CPU:$CA86 PRG:0A86 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_CA87
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 12 instructions: copies X into A; stores A to $04AB,y; loads
; A with $84; stores A to $043C,y; loads A with $09; stores A to
; $035E,y; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, $035E, $03CD, $043C, $04AB, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_CA87:
txa ; CPU:$CA87 PRG:0A87 8A
sta $04AB,y ; CPU:$CA88 PRG:0A88 99 AB 04
lda #$84 ; CPU:$CA8B PRG:0A8B A9 84
sta $043C,y ; CPU:$CA8D PRG:0A8D 99 3C 04
lda #$09 ; CPU:$CA90 PRG:0A90 A9 09
sta $035E,y ; CPU:$CA92 PRG:0A92 99 5E 03
sta $051A,y ; CPU:$CA95 PRG:0A95 99 1A 05
lda ZpB1 ; CPU:$CA98 PRG:0A98 A5 B1
cmp #$03 ; CPU:$CA9A PRG:0A9A C9 03
bcs Sub_8764_OnCarrySet_CAA2 ; CPU:$CA9C PRG:0A9C B0 04
lda #$06 ; CPU:$CA9E PRG:0A9E A9 06
bne Sub_8764_OnNonzero_CAA4 ; CPU:$CAA0 PRG:0AA0 D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_CAA2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $02.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, $03CD.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_CAA2:
lda #$02 ; CPU:$CAA2 PRG:0AA2 A9 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CAA4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: stores A to $03CD,y; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, $03CD.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CAA4:
sta $03CD,y ; CPU:$CAA4 PRG:0AA4 99 CD 03
rts ; CPU:$CAA7 PRG:0AA7 60
; -----------------------------------------------------------------------------
; Routine: InitFactoryTarget
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 16 instructions: loads A from $0391,x; branches on
; non-negative to Sub_8764_JoinBranchPaths_CAD3; loads A with $29;
; stores A to $04DE,x; loads A with $9C; stores A to $046F,x; and 10
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, the OAM shadow and the RAM fields it writes.
;
; -----------------------------------------------------------------------------
InitFactoryTarget:
lda $0391,x ; CPU:$CAA8 PRG:0AA8 BD 91 03
bpl Sub_8764_JoinBranchPaths_CAD3 ; CPU:$CAAB PRG:0AAB 10 26
lda #$29 ; CPU:$CAAD PRG:0AAD A9 29
sta $04DE,x ; CPU:$CAAF PRG:0AAF 9D DE 04
lda #$9C ; CPU:$CAB2 PRG:0AB2 A9 9C
sta $046F,x ; CPU:$CAB4 PRG:0AB4 9D 6F 04
lda $CAD4,x ; CPU:$CAB7 PRG:0AB7 BD D4 CA
sta $02B3,x ; CPU:$CABA PRG:0ABA 9D B3 02
and #$0F ; CPU:$CABD PRG:0ABD 29 0F
sta $0391,x ; CPU:$CABF PRG:0ABF 9D 91 03
lda $CADA,x ; CPU:$CAC2 PRG:0AC2 BD DA CA
sta $0322,x ; CPU:$CAC5 PRG:0AC5 9D 22 03
and #$07 ; CPU:$CAC8 PRG:0AC8 29 07
sta $0400,x ; CPU:$CACA PRG:0ACA 9D 00 04
lda $CAE0,x ; CPU:$CACD PRG:0ACD BD E0 CA
sta $054D,x ; CPU:$CAD0 PRG:0AD0 9D 4D 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_CAD3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_CAD3:
rts ; CPU:$CAD3 PRG:0AD3 60
; ---- data $CAD4-$CAE5 (18 bytes) ----
; referenced by `lda $CAD4,x` at $CAB7 (operand $CAD4 falls inside this region)
; referenced by `lda $CADA,x` at $CAC2 (operand $CADA falls inside this region)
; referenced by `lda $CAE0,x` at $CACD (operand $CAE0 falls inside this region)
BaseTargetParameterTable:
.byte $83, $85, $07, $63, $C9, $4B ; CPU:$CAD4 PRG:0AD4 83 85 07 63 C9 4B
BaseTargetTileTable:
.byte $03, $42, $44, $46, $86, $41 ; CPU:$CADA PRG:0ADA 03 42 44 46 86 41
BaseTargetCountTable:
.byte $04, $0C, $13, $16 ; CPU:$CAE0 PRG:0AE0 04 0C 13 16
.byte $1B, $23 ; CPU:$CAE4 PRG:0AE4 1B 23
; -----------------------------------------------------------------------------
; Routine: UpdateTargetState
; Global: The routine calls FindActiveTarget.
; Local: Executes 10 instructions: returns with RTS; calls FindActiveTarget; branches
; on carry clear to Sub_8764_JoinBranchPaths_CAD3; loads A with $92;
; stores A to $043C,y; loads X from Zp25; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
UpdateTargetState:
jsr FindActiveTarget ; CPU:$CAE6 PRG:0AE6 20 5A CB
bcc Sub_8764_JoinBranchPaths_CAD3 ; CPU:$CAE9 PRG:0AE9 90 E8
lda #$92 ; CPU:$CAEB PRG:0AEB A9 92
sta $043C,y ; CPU:$CAED PRG:0AED 99 3C 04
ldx Zp25 ; CPU:$CAF0 PRG:0AF0 A6 25
lda $CB85,x ; CPU:$CAF2 PRG:0AF2 BD 85 CB
sta Zp03 ; CPU:$CAF5 PRG:0AF5 85 03
lda $CB7F,x ; CPU:$CAF7 PRG:0AF7 BD 7F CB
bne Sub_8764_OnNonzero_CB10 ; CPU:$CAFA PRG:0AFA D0 14
; -----------------------------------------------------------------------------
; Routine: UpdateTargetPosition
; Global: The routine calls FindActiveTarget.
; Local: Executes 9 instructions: returns with RTS; calls FindActiveTarget; branches
; on carry clear to Sub_8764_JoinBranchPaths_CAD3; loads A with $78;
; stores A to $043C,y; loads X from Zp25; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
UpdateTargetPosition:
jsr FindActiveTarget ; CPU:$CAFC PRG:0AFC 20 5A CB
bcc Sub_8764_JoinBranchPaths_CAD3 ; CPU:$CAFF PRG:0AFF 90 D2
lda #$78 ; CPU:$CB01 PRG:0B01 A9 78
sta $043C,y ; CPU:$CB03 PRG:0B03 99 3C 04
ldx Zp25 ; CPU:$CB06 PRG:0B06 A6 25
lda $CB91,x ; CPU:$CB08 PRG:0B08 BD 91 CB
sta Zp03 ; CPU:$CB0B PRG:0B0B 85 03
lda $CB8B,x ; CPU:$CB0D PRG:0B0D BD 8B CB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CB10
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: copies A into X; stores Y to Zp27.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CB10:
tax ; CPU:$CB10 PRG:0B10 AA
sty Zp27 ; CPU:$CB11 PRG:0B11 84 27
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_CB13
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from $CB97,x; copies A into Y; loads
; A from $0667,y; branches on non-negative to
; Sub_8764_OnNonnegative_CB22; increments X; compares X with Zp03;
; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_CB13:
lda $CB97,x ; CPU:$CB13 PRG:0B13 BD 97 CB
tay ; CPU:$CB16 PRG:0B16 A8
lda $0667,y ; CPU:$CB17 PRG:0B17 B9 67 06
bpl Sub_8764_OnNonnegative_CB22; CPU:$CB1A PRG:0B1A 10 06
inx ; CPU:$CB1C PRG:0B1C E8
cpx Zp03 ; CPU:$CB1D PRG:0B1D E4 03
bcc Sub_8764_OnCarryClear_CB13 ; CPU:$CB1F PRG:0B1F 90 F2
rts ; CPU:$CB21 PRG:0B21 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_CB22
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 24 instructions: copies Y into A; copies A into X; loads Y
; from Zp27; loads A with $00; stores A to $04AB,y; loads A from
; $0667,x; and 18 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N and Z flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_CB22:
tya ; CPU:$CB22 PRG:0B22 98
tax ; CPU:$CB23 PRG:0B23 AA
ldy Zp27 ; CPU:$CB24 PRG:0B24 A4 27
lda #$00 ; CPU:$CB26 PRG:0B26 A9 00
sta $04AB,y ; CPU:$CB28 PRG:0B28 99 AB 04
lda $0667,x ; CPU:$CB2B PRG:0B2B BD 67 06
sta $035E,y ; CPU:$CB2E PRG:0B2E 99 5E 03
lda $CC11,x ; CPU:$CB31 PRG:0B31 BD 11 CC
sta $0280,y ; CPU:$CB34 PRG:0B34 99 80 02
lda $CC4A,x ; CPU:$CB37 PRG:0B37 BD 4A CC
and #$07 ; CPU:$CB3A PRG:0B3A 29 07
sta $03CD,y ; CPU:$CB3C PRG:0B3C 99 CD 03
lda $CC4A,x ; CPU:$CB3F PRG:0B3F BD 4A CC
and #$F8 ; CPU:$CB42 PRG:0B42 29 F8
sta $02EF,y ; CPU:$CB44 PRG:0B44 99 EF 02
txa ; CPU:$CB47 PRG:0B47 8A
sta $051A,y ; CPU:$CB48 PRG:0B48 99 1A 05
lda $0667,x ; CPU:$CB4B PRG:0B4B BD 67 06
ora #$80 ; CPU:$CB4E PRG:0B4E 09 80
sta $0667,x ; CPU:$CB50 PRG:0B50 9D 67 06
ldx Zp25 ; CPU:$CB53 PRG:0B53 A6 25
txa ; CPU:$CB55 PRG:0B55 8A
sta $05E3,y ; CPU:$CB56 PRG:0B56 99 E3 05
rts ; CPU:$CB59 PRG:0B59 60
; -----------------------------------------------------------------------------
; Routine: FindActiveTarget
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads Y with $32.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, $035E.
;
; -----------------------------------------------------------------------------
FindActiveTarget:
ldy #$32 ; CPU:$CB5A PRG:0B5A A0 32
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_CB5C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_OnNegative_CB76; decrements Y; compares Y with $15;
; branches on carry set to Sub_8764_OnCarrySet_CB5C; loads Y with
; $32.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_CB5C:
lda $035E,y ; CPU:$CB5C PRG:0B5C B9 5E 03
bmi Sub_8764_OnNegative_CB76 ; CPU:$CB5F PRG:0B5F 30 15
dey ; CPU:$CB61 PRG:0B61 88
cpy #$15 ; CPU:$CB62 PRG:0B62 C0 15
bcs Sub_8764_OnCarrySet_CB5C ; CPU:$CB64 PRG:0B64 B0 F6
ldy #$32 ; CPU:$CB66 PRG:0B66 A0 32
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_CB68
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from $05E3,y; copies A into X; loads
; A from $036D,x; branches on non-negative to
; Sub_8764_OnNonnegative_CB78; loads A with $FF; stores A to $035E,y.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_CB68:
lda $05E3,y ; CPU:$CB68 PRG:0B68 B9 E3 05
tax ; CPU:$CB6B PRG:0B6B AA
lda $036D,x ; CPU:$CB6C PRG:0B6C BD 6D 03
bpl Sub_8764_OnNonnegative_CB78; CPU:$CB6F PRG:0B6F 10 07
lda #$FF ; CPU:$CB71 PRG:0B71 A9 FF
sta $035E,y ; CPU:$CB73 PRG:0B73 99 5E 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_CB76
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: sets the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the C flag.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_CB76:
sec ; CPU:$CB76 PRG:0B76 38
rts ; CPU:$CB77 PRG:0B77 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_CB78
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 13 instructions: loads A from $05E3,y; copies A into X;
; loads A from $036D,x; branches on non-negative to
; Sub_8764_OnNonnegative_CB78; loads A with $FF; stores A to $035E,y;
; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z and C flags, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_CB78:
dey ; CPU:$CB78 PRG:0B78 88
cpy #$15 ; CPU:$CB79 PRG:0B79 C0 15
bcs Sub_8764_OnCarrySet_CB68 ; CPU:$CB7B PRG:0B7B B0 EB
clc ; CPU:$CB7D PRG:0B7D 18
rts ; CPU:$CB7E PRG:0B7E 60
; ---- data $CB7F-$CCBB (317 bytes) ----
; referenced by `lda $CC83,x` at $C9AD (operand $CC83 falls inside this region)
; referenced by `cmp $CBDB,x` at $CA14 (operand $CBDB falls inside this region)
; referenced by `lda $CBDB,x` at $CA2D (operand $CBDB falls inside this region)
; referenced by `lda $CBE1,x` at $CA33 (operand $CBE1 falls inside this region)
; referenced by `lda $CBE7,x` at $CA39 (operand $CBE7 falls inside this region)
; referenced by `lda $CBED,x` at $CA3F (operand $CBED falls inside this region)
; ... and 11 further references from decoded code
EnemyTargetParameterTable:
.byte $01, $07, $0D, $13, $19, $1F, $06, $0C, $12, $18, $1E, $24, $25, $2A, $2F, $34 ; CPU:$CB7F PRG:0B7F 01 07 0D 13 19 1F 06 0C 12 18 1E 24 25 2A 2F 34
.byte $39, $3E, $2A, $2F, $34, $39, $3E, $43, $00, $03, $05, $06, $01, $02, $04, $09 ; CPU:$CB8F PRG:0B8F 39 3E 2A 2F 34 39 3E 43 00 03 05 06 01 02 04 09
.byte $05, $0A, $07, $08, $0B, $0E, $0F, $0C, $0D, $0B, $06, $13, $11, $10, $12, $15 ; CPU:$CB9F PRG:0B9F 05 0A 07 08 0B 0E 0F 0C 0D 0B 06 13 11 10 12 15
.byte $14, $18, $17, $1B, $19, $1A, $16, $20, $1E, $1D, $1F, $21, $1C, $24, $22, $23 ; CPU:$CBAF PRG:0BAF 14 18 17 1B 19 1A 16 20 1E 1D 1F 21 1C 24 22 23
.byte $26, $27, $25, $24, $22, $34, $28, $28, $29, $27, $24, $2C, $2B, $2A, $2D, $2C ; CPU:$CBBF PRG:0BBF 26 27 25 24 22 34 28 28 29 27 24 2C 2B 2A 2D 2C
.byte $2E, $2F, $33, $30, $32, $31, $36, $37, $38, $35, $34, $34, $2F, $22, $2B, $2D ; CPU:$CBCF PRG:0BCF 2E 2F 33 30 32 31 36 37 38 35 34 34 2F 22 2B 2D
.byte $23, $28, $71, $6B, $6F, $68, $6F, $71, $03, $06, $06, $02, $09, $09, $00, $00 ; CPU:$CBDF PRG:0BDF 23 28 71 6B 6F 68 6F 71 03 06 06 02 09 09 00 00
.byte $00, $00, $C0, $C0, $04, $03, $05, $05, $00, $02, $00, $40, $60, $C0, $60, $80 ; CPU:$CBEF PRG:0BEF 00 00 C0 C0 04 03 05 05 00 02 00 40 60 C0 60 80
.byte $02, $1A, $39, $53, $6B, $85, $08, $27, $43, $59, $72, $8E, $11, $2F, $49, $64 ; CPU:$CBFF PRG:0BFF 02 1A 39 53 6B 85 08 27 43 59 72 8E 11 2F 49 64
.byte $7A, $95, $00, $D0, $B8, $98, $20, $4A, $C0, $38, $B0, $22, $20, $E0, $30, $90 ; CPU:$CC0F PRG:0C0F 7A 95 00 D0 B8 98 20 4A C0 38 B0 22 20 E0 30 90
.byte $D0, $A0, $B0, $B4, $48, $98, $30, $C8, $FF, $70, $8A, $E0, $80, $00, $30, $60 ; CPU:$CC1F PRG:0C1F D0 A0 B0 B4 48 98 30 C8 FF 70 8A E0 80 00 30 60
.byte $40, $48, $90, $90, $CD, $88, $28, $40, $40, $60, $58, $28, $88, $C0, $D8, $A0 ; CPU:$CC2F PRG:0C2F 40 48 90 90 CD 88 28 40 40 60 58 28 88 C0 D8 A0
.byte $10, $10, $E0, $E4, $E0, $D0, $90, $60, $30, $30, $20, $00, $02, $83, $EA, $D2 ; CPU:$CC3F PRG:0C3F 10 10 E0 E4 E0 D0 90 60 30 30 20 00 02 83 EA D2
.byte $F1, $BB, $A2, $52, $22, $C1, $62, $04, $74, $3C, $3D, $95, $66, $46, $8E, $27 ; CPU:$CC4F PRG:0C4F F1 BB A2 52 22 C1 62 04 74 3C 3D 95 66 46 8E 27
.byte $6E, $DD, $A5, $96, $76, $87, $27, $83, $F0, $1A, $79, $51, $1A, $A9, $33, $DA ; CPU:$CC5F PRG:0C5F 6E DD A5 96 76 87 27 83 F0 1A 79 51 1A A9 33 DA
.byte $0A, $24, $44, $04, $35, $EE, $8D, $DD, $B6, $77, $A5, $7D, $76, $B7, $AF, $FA ; CPU:$CC6F PRG:0C6F 0A 24 44 04 35 EE 8D DD B6 77 A5 7D 76 B7 AF FA
.byte $53, $19, $F0, $1A, $00, $02, $02, $03, $04, $04, $03, $05, $05, $06, $07, $07 ; CPU:$CC7F PRG:0C7F 53 19 F0 1A 00 02 02 03 04 04 03 05 05 06 07 07
.byte $05, $06, $06, $06, $02, $01, $03, $03, $05, $04, $08, $0A, $09, $09, $09, $0B ; CPU:$CC8F PRG:0C8F 05 06 06 06 02 01 03 03 05 04 08 0A 09 09 09 0B
.byte $0A, $0A, $0A, $0B, $0B, $0B, $02, $02, $05, $07, $02, $05, $07, $07, $01, $03 ; CPU:$CC9F PRG:0C9F 0A 0A 0A 0B 0B 0B 02 02 05 07 02 05 07 07 01 03
.byte $04, $04, $07, $09, $0A, $0A, $08, $0A, $08, $0A, $0A, $0C, $0C ; CPU:$CCAF PRG:0CAF 04 04 07 09 0A 0A 08 0A 08 0A 0A 0C 0C
; -----------------------------------------------------------------------------
; Routine: InitSpriteSlots
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads X with $01; branches on not equal to
; Sub_8764_JoinBranchPaths_CCC2.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, the OAM shadow, $0369, $03D8, $0447, $04B6.
;
; -----------------------------------------------------------------------------
InitSpriteSlots:
ldx #$01 ; CPU:$CCBC PRG:0CBC A2 01
bne Sub_8764_JoinBranchPaths_CCC2 ; CPU:$CCBE PRG:0CBE D0 02
; -----------------------------------------------------------------------------
; Routine: LoadSpriteDefinitionTable
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $09.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N and Z flags, the OAM shadow, $0369, $03D8, $0447, $04B6.
;
; -----------------------------------------------------------------------------
LoadSpriteDefinitionTable:
ldx #$09 ; CPU:$CCC0 PRG:0CC0 A2 09
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_CCC2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 15 instructions: loads A from $CCEA,x; stores A to $028B,x;
; loads A from $CCF4,x; stores A to $0369,x; loads A from $CCFE,x;
; stores A to $02FA,x; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N and Z flags, the OAM shadow, $0369, $03D8, $0447, $04B6.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_CCC2:
lda $CCEA,x ; CPU:$CCC2 PRG:0CC2 BD EA CC
sta $028B,x ; CPU:$CCC5 PRG:0CC5 9D 8B 02
lda $CCF4,x ; CPU:$CCC8 PRG:0CC8 BD F4 CC
sta $0369,x ; CPU:$CCCB PRG:0CCB 9D 69 03
lda $CCFE,x ; CPU:$CCCE PRG:0CCE BD FE CC
sta $02FA,x ; CPU:$CCD1 PRG:0CD1 9D FA 02
lda $CD08,x ; CPU:$CCD4 PRG:0CD4 BD 08 CD
sta $03D8,x ; CPU:$CCD7 PRG:0CD7 9D D8 03
lda $CD12,x ; CPU:$CCDA PRG:0CDA BD 12 CD
sta $0447,x ; CPU:$CCDD PRG:0CDD 9D 47 04
lda $CD1C,x ; CPU:$CCE0 PRG:0CE0 BD 1C CD
sta $04B6,x ; CPU:$CCE3 PRG:0CE3 9D B6 04
dex ; CPU:$CCE6 PRG:0CE6 CA
bpl Sub_8764_JoinBranchPaths_CCC2 ; CPU:$CCE7 PRG:0CE7 10 D9
rts ; CPU:$CCE9 PRG:0CE9 60
; ---- data $CCEA-$CD25 (60 bytes) ----
; referenced by `lda $CCEA,x` at $CCC2 (operand $CCEA falls inside this region)
; referenced by `lda $CCF4,x` at $CCC8 (operand $CCF4 falls inside this region)
; referenced by `lda $CCFE,x` at $CCCE (operand $CCFE falls inside this region)
; referenced by `lda $CD08,x` at $CCD4 (operand $CD08 falls inside this region)
; referenced by `lda $CD12,x` at $CCDA (operand $CD12 falls inside this region)
; referenced by `lda $CD1C,x` at $CCE0 (operand $CD1C falls inside this region)
SpriteDefinitionTable:
.byte $87, $87, $10, $40, $D0, $D8, $B8, $78, $A8, $70 ; CPU:$CCEA PRG:0CEA 87 87 10 40 D0 D8 B8 78 A8 70
SpriteTileTable:
.byte $00, $00, $0A, $0A, $03, $05 ; CPU:$CCF4 PRG:0CF4 00 00 0A 0A 03 05
.byte $06, $03, $09, $0B ; CPU:$CCFA PRG:0CFA 06 03 09 0B
SpriteAttributeTable:
.byte $2A, $4A, $C7, $C7, $CF, $1F, $4F, $47, $87, $5F ; CPU:$CCFE PRG:0CFE 2A 4A C7 C7 CF 1F 4F 47 87 5F
SpriteXTable:
.byte $00, $00 ; CPU:$CD08 PRG:0D08 00 00
.byte $00, $00, $02, $02, $04, $06, $06, $01 ; CPU:$CD0A PRG:0D0A 00 00 02 02 04 06 06 01
SpriteYTable:
.byte $66, $67, $64, $65, $AA, $AA, $AA, $AA ; CPU:$CD12 PRG:0D12 66 67 64 65 AA AA AA AA
.byte $AA, $AA ; CPU:$CD1A PRG:0D1A AA AA
SpriteFrameTable:
.byte $3C, $3C, $3C, $3C, $3F, $32, $3B, $3D, $33, $38 ; CPU:$CD1C PRG:0D1C 3C 3C 3C 3C 3F 32 3B 3D 33 38
; -----------------------------------------------------------------------------
; Routine: ClearSpriteShadow
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $00; copies A into X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
ClearSpriteShadow:
lda #$00 ; CPU:$CD26 PRG:0D26 A9 00
tax ; CPU:$CD28 PRG:0D28 AA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CD29
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: stores A to Zp00,x; increments X; compares X
; with $A5; branches on not equal to Sub_8764_OnNonzero_CD29; loads X
; with $07.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CD29:
sta Zp00,x ; CPU:$CD29 PRG:0D29 95 00
inx ; CPU:$CD2B PRG:0D2B E8
cpx #$A5 ; CPU:$CD2C PRG:0D2C E0 A5
bne Sub_8764_OnNonzero_CD29 ; CPU:$CD2E PRG:0D2E D0 F9
ldx #$07 ; CPU:$CD30 PRG:0D30 A2 07
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_CD32
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: stores A to $0589,x; decrements X; branches
; on non-negative to Sub_8764_OnNonnegative_CD32; loads A with $FF;
; loads X with $0F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_CD32:
sta $0589,x ; CPU:$CD32 PRG:0D32 9D 89 05
dex ; CPU:$CD35 PRG:0D35 CA
bpl Sub_8764_OnNonnegative_CD32; CPU:$CD36 PRG:0D36 10 FA
lda #$FF ; CPU:$CD38 PRG:0D38 A9 FF
ldx #$0F ; CPU:$CD3A PRG:0D3A A2 0F
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_CD3C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: stores A to Zp65,x; stores A to Zp95,x;
; decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_CD3C; loads X with $02; loads A with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_CD3C:
sta Zp65,x ; CPU:$CD3C PRG:0D3C 95 65
sta Zp95,x ; CPU:$CD3E PRG:0D3E 95 95
dex ; CPU:$CD40 PRG:0D40 CA
bpl Sub_8764_OnNonnegative_CD3C; CPU:$CD41 PRG:0D41 10 F9
ldx #$02 ; CPU:$CD43 PRG:0D43 A2 02
lda #$00 ; CPU:$CD45 PRG:0D45 A9 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_CD47
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: stores A to Zp65,x; stores A to Zp6D,x;
; decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_CD47; loads X with $6E.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_CD47:
sta Zp65,x ; CPU:$CD47 PRG:0D47 95 65
sta Zp6D,x ; CPU:$CD49 PRG:0D49 95 6D
dex ; CPU:$CD4B PRG:0D4B CA
bpl Sub_8764_OnNonnegative_CD47; CPU:$CD4C PRG:0D4C 10 F9
ldx #$6E ; CPU:$CD4E PRG:0D4E A2 6E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_CD50
; Global: The routine calls InitScreenState, writes $043E, $04AD, $0368, $0254 and 1
; more.
; Local: Executes 17 instructions: loads A from $04AB,x; ANDs A with $7F;
; stores A to $04AB,x; decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_CD50; loads A with $83; and 11 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $043E, $04AD and $0368
; changed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_CD50:
lda $04AB,x ; CPU:$CD50 PRG:0D50 BD AB 04
and #$7F ; CPU:$CD53 PRG:0D53 29 7F
sta $04AB,x ; CPU:$CD55 PRG:0D55 9D AB 04
dex ; CPU:$CD58 PRG:0D58 CA
bpl Sub_8764_OnNonnegative_CD50; CPU:$CD59 PRG:0D59 10 F5
lda #$83 ; CPU:$CD5B PRG:0D5B A9 83
sta $043E ; CPU:$CD5D PRG:0D5D 8D 3E 04
lda #$22 ; CPU:$CD60 PRG:0D60 A9 22
sta $04AD ; CPU:$CD62 PRG:0D62 8D AD 04
lda #$FA ; CPU:$CD65 PRG:0D65 A9 FA
sta $0368 ; CPU:$CD67 PRG:0D67 8D 68 03
jsr InitScreenState ; CPU:$CD6A PRG:0D6A 20 0A D0
lda #$28 ; CPU:$CD6D PRG:0D6D A9 28
sta $0254 ; CPU:$CD6F PRG:0D6F 8D 54 02
lda #$D2 ; CPU:$CD72 PRG:0D72 A9 D2
sta $0240 ; CPU:$CD74 PRG:0D74 8D 40 02
ldx #$00 ; CPU:$CD77 PRG:0D77 A2 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CD79
; Global: The routine calls ComputeRadarBlipTile and InitSpriteSlots, reads $0267, $02FA and
; $03D8.
; Local: Executes 16 instructions: loads A from $CE08,x; stores A to ZpA5,x;
; increments X; compares X with $16; branches on not equal to
; Sub_8764_OnNonzero_CD79; calls ComputeRadarBlipTile; and 10 more instructions.
; Parameters: Reads $0267, $02FA and $03D8 from the zero page and RAM; the
; values it acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CD79:
lda $CE08,x ; CPU:$CD79 PRG:0D79 BD 08 CE
sta ZpA5,x ; CPU:$CD7C PRG:0D7C 95 A5
inx ; CPU:$CD7E PRG:0D7E E8
cpx #$16 ; CPU:$CD7F PRG:0D7F E0 16
bne Sub_8764_OnNonzero_CD79 ; CPU:$CD81 PRG:0D81 D0 F6
jsr ComputeRadarBlipTile ; CPU:$CD83 PRG:0D83 20 3A D4
dec ZpD5 ; CPU:$CD86 PRG:0D86 C6 D5
lda ZpD5 ; CPU:$CD88 PRG:0D88 A5 D5
cmp #$04 ; CPU:$CD8A PRG:0D8A C9 04
beq Sub_8764_OnZero_CDF4 ; CPU:$CD8C PRG:0D8C F0 66
dec $0267 ; CPU:$CD8E PRG:0D8E CE 67 02
lda $02FA ; CPU:$CD91 PRG:0D91 AD FA 02
sta Zp2D ; CPU:$CD94 PRG:0D94 85 2D
lda $03D8 ; CPU:$CD96 PRG:0D96 AD D8 03
sta Zp2E ; CPU:$CD99 PRG:0D99 85 2E
jsr InitSpriteSlots ; CPU:$CD9B PRG:0D9B 20 BC CC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CD9E
; Global: The routine calls DisableRendering.
; Local: Executes 1 instruction: calls DisableRendering.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CD9E:
jsr DisableRendering ; CPU:$CD9E PRG:0D9E 20 EB C3
; -----------------------------------------------------------------------------
; Routine: CheckPlayerReachedTarget
; Global: The routine reads $03D8 and $02FA.
; Local: Executes 6 instructions: loads A from $03D8; compares A with Zp2E;
; branches on not equal to Sub_8764_OnNonzero_CDAF; loads A from
; $02FA; compares A with Zp2D; branches on equal to
; Sub_8764_OnZero_CDBB.
; Parameters: Reads $03D8 and $02FA from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
CheckPlayerReachedTarget:
lda $03D8 ; CPU:$CDA1 PRG:0DA1 AD D8 03
cmp Zp2E ; CPU:$CDA4 PRG:0DA4 C5 2E
bne Sub_8764_OnNonzero_CDAF ; CPU:$CDA6 PRG:0DA6 D0 07
lda $02FA ; CPU:$CDA8 PRG:0DA8 AD FA 02
cmp Zp2D ; CPU:$CDAB PRG:0DAB C5 2D
beq Sub_8764_OnZero_CDBB ; CPU:$CDAD PRG:0DAD F0 0C
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CDAF
; Global: The routine calls InitLastEnemies, AdvanceRadarSweep, DrawEnemySprite and CheckPlayerReachedTarget.
; Local: Executes 4 instructions: calls InitLastEnemies; calls AdvanceRadarSweep; calls
; DrawEnemySprite; calls CheckPlayerReachedTarget.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CDAF:
jsr InitLastEnemies ; CPU:$CDAF PRG:0DAF 20 E7 D9
jsr AdvanceRadarSweep ; CPU:$CDB2 PRG:0DB2 20 C0 E7
jsr DrawEnemySprite ; CPU:$CDB5 PRG:0DB5 20 2D E8
jmp CheckPlayerReachedTarget ; CPU:$CDB8 PRG:0DB8 4C A1 CD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CDBB
; Global: The routine calls SetPlayerScreenOrigin.
; Local: Executes 2 instructions: calls SetPlayerScreenOrigin; loads X with $E4.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CDBB:
jsr SetPlayerScreenOrigin ; CPU:$CDBB PRG:0DBB 20 27 F1
ldx #$E4 ; CPU:$CDBE PRG:0DBE A2 E4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CDC0
; Global: The routine calls AdvanceRadarSweep.
; Local: Executes 8 instructions: copies X into A; pushes A; calls AdvanceRadarSweep;
; pulls A; copies A into X; decrements X; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CDC0:
txa ; CPU:$CDC0 PRG:0DC0 8A
pha ; CPU:$CDC1 PRG:0DC1 48
jsr AdvanceRadarSweep ; CPU:$CDC2 PRG:0DC2 20 C0 E7
pla ; CPU:$CDC5 PRG:0DC5 68
tax ; CPU:$CDC6 PRG:0DC6 AA
dex ; CPU:$CDC7 PRG:0DC7 CA
bne Sub_8764_OnNonzero_CDC0 ; CPU:$CDC8 PRG:0DC8 D0 F6
ldx #$C8 ; CPU:$CDCA PRG:0DCA A2 C8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CDCC
; Global: The routine calls CheckRadarSweepEnd.
; Local: Executes 8 instructions: copies X into A; pushes A; calls CheckRadarSweepEnd;
; pulls A; copies A into X; decrements X; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CDCC:
txa ; CPU:$CDCC PRG:0DCC 8A
pha ; CPU:$CDCD PRG:0DCD 48
jsr CheckRadarSweepEnd ; CPU:$CDCE PRG:0DCE 20 A6 E7
pla ; CPU:$CDD1 PRG:0DD1 68
tax ; CPU:$CDD2 PRG:0DD2 AA
dex ; CPU:$CDD3 PRG:0DD3 CA
bne Sub_8764_OnNonzero_CDCC ; CPU:$CDD4 PRG:0DD4 D0 F6
ldx #$0C ; CPU:$CDD6 PRG:0DD6 A2 0C
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CDD8
; Global: The routine calls AdvanceRadarSweepAlt.
; Local: Executes 7 instructions: copies X into A; pushes A; calls AdvanceRadarSweepAlt;
; pulls A; copies A into X; decrements X; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CDD8:
txa ; CPU:$CDD8 PRG:0DD8 8A
pha ; CPU:$CDD9 PRG:0DD9 48
jsr AdvanceRadarSweepAlt ; CPU:$CDDA PRG:0DDA 20 D6 E7
pla ; CPU:$CDDD PRG:0DDD 68
tax ; CPU:$CDDE PRG:0DDE AA
dex ; CPU:$CDDF PRG:0DDF CA
bne Sub_8764_OnNonzero_CDD8 ; CPU:$CDE0 PRG:0DE0 D0 F6
; -----------------------------------------------------------------------------
; Routine: UploadOamToPpu
; Global: The routine calls SubCC407 and ResetScroll, writes the OAMADDR and
; OAMDMA registers.
; Local: Executes 7 instructions: calls SubCC407; loads A with $00; stores A
; to the OAMADDR register; loads A with $07; stores A to the OAMDMA
; register; loads A with $1E; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves the OAMADDR and OAMDMA registers set.
; Clobbers:
; A, the N and Z flags, PPUMASK, OAMADDR, OAMDMA.
;
; -----------------------------------------------------------------------------
UploadOamToPpu:
jsr SubCC407_OnNegative ; CPU:$CDE2 PRG:0DE2 20 07 C4
lda #$00 ; CPU:$CDE5 PRG:0DE5 A9 00
sta OAMADDR ; CPU:$CDE7 PRG:0DE7 8D 03 20
lda #$07 ; CPU:$CDEA PRG:0DEA A9 07
sta OAMDMA ; CPU:$CDEC PRG:0DEC 8D 14 40
lda #$1E ; CPU:$CDEF PRG:0DEF A9 1E
jmp ResetScroll ; CPU:$CDF1 PRG:0DF1 4C F0 C3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CDF4
; Global: The routine calls DisableRendering, InitLastEnemies, AdvanceRadarSweep, DrawEnemySprite and 7 more,
; writes the OAMADDR and OAMDMA registers, reads $03D8 and $02FA.
; Local: Executes 52 instructions: calls DisableRendering; loads A from $03D8;
; compares A with Zp2E; branches on not equal to
; Sub_8764_OnNonzero_CDAF; loads A from $02FA; compares A with Zp2D;
; and 46 more instructions.
; Parameters: Reads $03D8 and $02FA from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the OAMADDR and OAMDMA
; registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CDF4:
jsr UpdatePseudoRandomNumber ; CPU:$CDF4 PRG:0DF4 20 12 C4
sta Zp2D ; CPU:$CDF7 PRG:0DF7 85 2D
jsr UpdatePseudoRandomNumber ; CPU:$CDF9 PRG:0DF9 20 12 C4
and #$07 ; CPU:$CDFC PRG:0DFC 29 07
sta Zp2E ; CPU:$CDFE PRG:0DFE 85 2E
cmp #$07 ; CPU:$CE00 PRG:0E00 C9 07
bne Sub_8764_OnNonzero_CD9E ; CPU:$CE02 PRG:0E02 D0 9A
dec Zp2E ; CPU:$CE04 PRG:0E04 C6 2E
bne Sub_8764_OnNonzero_CD9E ; CPU:$CE06 PRG:0E06 D0 96
; ---- data $CE08-$CE1D (22 bytes) ----
; referenced by `lda $CE08,x` at $CD79 (operand $CE08 falls inside this region)
SpriteOamShadowTable:
.byte $07, $44, $80, $80, $80, $80, $FA, $0A, $40, $2A, $0B, $F6, $06, $61, $5A, $AA ; CPU:$CE08 PRG:0E08 07 44 80 80 80 80 FA 0A 40 2A 0B F6 06 61 5A AA
.byte $87, $2E, $FF, $0A, $02, $0C ; CPU:$CE18 PRG:0E18 87 2E FF 0A 02 0C
; -----------------------------------------------------------------------------
; Routine: InitDirectionState
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $02.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, Zp0D, Zp0E, ZpA6.
;
; -----------------------------------------------------------------------------
InitDirectionState:
lda #$02 ; CPU:$CE1E PRG:0E1E A9 02
; -----------------------------------------------------------------------------
; Routine: InitDirectionStateAlt
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: pushes A; stores A to Zp0D; loads A with
; $30; stores A to Zp0E; loads A with $E4; stores A to ZpA6; and 1
; more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; no register, the N and Z flags, Zp0D, Zp0E, ZpA6.
;
; -----------------------------------------------------------------------------
InitDirectionStateAlt:
pha ; CPU:$CE20 PRG:0E20 48
sta Zp0D ; CPU:$CE21 PRG:0E21 85 0D
lda #$30 ; CPU:$CE23 PRG:0E23 A9 30
sta Zp0E ; CPU:$CE25 PRG:0E25 85 0E
lda #$E4 ; CPU:$CE27 PRG:0E27 A9 E4
sta ZpA6 ; CPU:$CE29 PRG:0E29 85 A6
pla ; CPU:$CE2B PRG:0E2B 68
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CE2C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CE2C:
rts ; CPU:$CE2C PRG:0E2C 60
; -----------------------------------------------------------------------------
; Routine: ReadSpriteOffsetTable
; Global: The routine calls SubCCE8F.
; Local: Executes 22 instructions: returns with RTS; loads X from Zp0D;
; branches on equal to Sub_8764_OnZero_CE2C; decrements Zp0E;
; branches on equal to Sub_8764_OnZero_CE81; decrements X; and 16
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
ReadSpriteOffsetTable:
ldx Zp0D ; CPU:$CE2D PRG:0E2D A6 0D
beq Sub_8764_OnZero_CE2C ; CPU:$CE2F PRG:0E2F F0 FB
dec Zp0E ; CPU:$CE31 PRG:0E31 C6 0E
beq Sub_8764_OnZero_CE81 ; CPU:$CE33 PRG:0E33 F0 4C
dex ; CPU:$CE35 PRG:0E35 CA
lda $CEC9,x ; CPU:$CE36 PRG:0E36 BD C9 CE
sta Zp4E ; CPU:$CE39 PRG:0E39 85 4E
lda $CECE,x ; CPU:$CE3B PRG:0E3B BD CE CE
sta Zp4F ; CPU:$CE3E PRG:0E3E 85 4F
ldx Zp0E ; CPU:$CE40 PRG:0E40 A6 0E
txa ; CPU:$CE42 PRG:0E42 8A
and #$04 ; CPU:$CE43 PRG:0E43 29 04
bne SubCCE8F_Loop ; CPU:$CE45 PRG:0E45 D0 48
jsr SubCCE8F_Loop ; CPU:$CE47 PRG:0E47 20 8F CE
lda #$38 ; CPU:$CE4A PRG:0E4A A9 38
sta Zp54 ; CPU:$CE4C PRG:0E4C 85 54
txa ; CPU:$CE4E PRG:0E4E 8A
pha ; CPU:$CE4F PRG:0E4F 48
tya ; CPU:$CE50 PRG:0E50 98
pha ; CPU:$CE51 PRG:0E51 48
ldy #$FF ; CPU:$CE52 PRG:0E52 A0 FF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CE54
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: increments Y; loads A from ((Zp4E),y);
; compares A with $FF; branches on equal to Sub_8764_OnZero_CE7C;
; stores A to Zp49; increments Y; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CE54:
iny ; CPU:$CE54 PRG:0E54 C8
lda (Zp4E),y ; CPU:$CE55 PRG:0E55 B1 4E
cmp #$FF ; CPU:$CE57 PRG:0E57 C9 FF
beq Sub_8764_OnZero_CE7C ; CPU:$CE59 PRG:0E59 F0 21
sta Zp49 ; CPU:$CE5B PRG:0E5B 85 49
iny ; CPU:$CE5D PRG:0E5D C8
lda (Zp4E),y ; CPU:$CE5E PRG:0E5E B1 4E
sta Zp4A ; CPU:$CE60 PRG:0E60 85 4A
; -----------------------------------------------------------------------------
; Routine: ReadSpritePartOffset
; Global: The routine calls WriteSpriteToOamAlt.
; Local: Executes 17 instructions: increments Y; loads A from ((Zp4E),y);
; compares A with $FF; branches on equal to Sub_8764_OnZero_CE7C;
; stores A to Zp49; increments Y; and 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
ReadSpritePartOffset:
iny ; CPU:$CE62 PRG:0E62 C8
lda (Zp4E),y ; CPU:$CE63 PRG:0E63 B1 4E
sta Zp4B ; CPU:$CE65 PRG:0E65 85 4B
beq Sub_8764_OnZero_CE54 ; CPU:$CE67 PRG:0E67 F0 EB
cmp #$20 ; CPU:$CE69 PRG:0E69 C9 20
beq Sub_8764_OnZero_CE74 ; CPU:$CE6B PRG:0E6B F0 07
lda Zp54 ; CPU:$CE6D PRG:0E6D A5 54
jsr WriteSpriteToOamAlt ; CPU:$CE6F PRG:0E6F 20 6D C5
inc Zp54 ; CPU:$CE72 PRG:0E72 E6 54
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CE74
; Global: The routine calls AdvanceRadarBlipPositionC and ReadSpritePartOffset.
; Local: Executes 3 instructions: loads A with $08; calls AdvanceRadarBlipPositionC; calls
; ReadSpritePartOffset.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CE74:
lda #$08 ; CPU:$CE74 PRG:0E74 A9 08
jsr AdvanceRadarBlipPositionC ; CPU:$CE76 PRG:0E76 20 8C F1
jmp ReadSpritePartOffset ; CPU:$CE79 PRG:0E79 4C 62 CE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CE7C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: pulls A; copies A into Y; pulls A; copies A
; into X; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CE7C:
pla ; CPU:$CE7C PRG:0E7C 68
tay ; CPU:$CE7D PRG:0E7D A8
pla ; CPU:$CE7E PRG:0E7E 68
tax ; CPU:$CE7F PRG:0E7F AA
rts ; CPU:$CE80 PRG:0E80 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CE81
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A with $00; stores A to Zp0D; loads A
; with $44; stores A to ZpA6; loads A from ZpCA; branches on not
; equal to SubCCE8F; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N and Z flags, Zp0D, ZpA6, ZpCE, $0700.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CE81:
lda #$00 ; CPU:$CE81 PRG:0E81 A9 00
sta Zp0D ; CPU:$CE83 PRG:0E83 85 0D
lda #$44 ; CPU:$CE85 PRG:0E85 A9 44
sta ZpA6 ; CPU:$CE87 PRG:0E87 85 A6
lda ZpCA ; CPU:$CE89 PRG:0E89 A5 CA
bne SubCCE8F_Loop ; CPU:$CE8B PRG:0E8B D0 02
sta ZpCE ; CPU:$CE8D PRG:0E8D 85 CE
; -----------------------------------------------------------------------------
; Routine: SubCCE8F_Loop
; Global: The routine calls SubCC463.
; Local: Executes 3 instructions: loads X with $E0; loads Y with $20; calls
; SubCC463.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N and Z flags, $0700.
;
; -----------------------------------------------------------------------------
SubCCE8F_Loop:
ldx #$E0 ; CPU:$CE8F PRG:0E8F A2 E0
ldy #$20 ; CPU:$CE91 PRG:0E91 A0 20
jmp SubCC463_OnNonzero ; CPU:$CE93 PRG:0E93 4C 63 C4
; ---- data $CE96-$CED2 (61 bytes) ----
; referenced by `lda $CEC9,x` at $CE36 (operand $CEC9 falls inside this region)
; referenced by `lda $CECE,x` at $CE3B (operand $CECE falls inside this region)
SpriteOffsetTable:
.byte $64, $3D, $64, $65, $55, $74, $54, $DE, $B7, $00, $FF, $64, $3D, $97, $25, $54 ; CPU:$CE96 PRG:0E96 64 3D 64 65 55 74 54 DE B7 00 FF 64 3D 97 25 54
.byte $DB, $A7, $DB, $87, $00, $FF, $6C, $3D, $55, $75, $DB, $CB, $24, $00, $FF, $6C ; CPU:$CEA6 PRG:0EA6 DB A7 DB 87 00 FF 6C 3D 55 75 DB CB 24 00 FF 6C
.byte $3D, $25, $8E, $65, $54, $74, $00, $FF, $64, $3D, $55, $34, $65, $45, $A7, $25 ; CPU:$CEB6 PRG:0EB6 3D 25 8E 65 54 74 00 FF 64 3D 55 34 65 45 A7 25
.byte $8E, $00, $FF ; CPU:$CEC6 PRG:0EC6 8E 00 FF
SpriteXOffsetTable:
.byte $96, $A1, $AC, $B5, $BE ; CPU:$CEC9 PRG:0EC9 96 A1 AC B5 BE
SpriteYOffsetTable:
.byte $CE, $CE, $CE, $CE, $CE ; CPU:$CECE PRG:0ECE CE CE CE CE CE
; -----------------------------------------------------------------------------
; Routine: SubCCED3_OnNonnegative
; Global: The routine calls StartScreenTransition.
; Local: Executes 13 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 7
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
SubCCED3_OnNonnegative:
ldx #$00 ; CPU:$CED3 PRG:0ED3 A2 00
stx Zp15 ; CPU:$CED5 PRG:0ED5 86 15
stx Zp16 ; CPU:$CED7 PRG:0ED7 86 16
stx Zp13 ; CPU:$CED9 PRG:0ED9 86 13
inx ; CPU:$CEDB PRG:0EDB E8
stx Zp14 ; CPU:$CEDC PRG:0EDC 86 14
ldx #$80 ; CPU:$CEDE PRG:0EDE A2 80
stx ZpA9 ; CPU:$CEE0 PRG:0EE0 86 A9
inx ; CPU:$CEE2 PRG:0EE2 E8
stx ZpAA ; CPU:$CEE3 PRG:0EE3 86 AA
lda #$05 ; CPU:$CEE5 PRG:0EE5 A9 05
sta ZpA5 ; CPU:$CEE7 PRG:0EE7 85 A5
jsr StartScreenTransition ; CPU:$CEE9 PRG:0EE9 20 FF CF
; -----------------------------------------------------------------------------
; Routine: UpdatePlayerStatus
; Global: The routine calls StartScreenTransition, HandlePlayerInput, SetPlayerActive, DrawFullScreen and 2 more.
; Local: Executes 20 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 14
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
UpdatePlayerStatus:
lda ZpAD ; CPU:$CEEC PRG:0EEC A5 AD
beq Sub_8764_OnZero_CEFF ; CPU:$CEEE PRG:0EEE F0 0F
jsr HandlePlayerInput ; CPU:$CEF0 PRG:0EF0 20 EB D2
jsr SetPlayerActive ; CPU:$CEF3 PRG:0EF3 20 59 D4
jsr DrawFullScreen ; CPU:$CEF6 PRG:0EF6 20 1A D0
jsr CheckTargetRange ; CPU:$CEF9 PRG:0EF9 20 D7 D2
jmp UpdatePlayerStatus ; CPU:$CEFC PRG:0EFC 4C EC CE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CEFF
; Global: The routine calls StartScreenTransition, HandlePlayerInput, SetPlayerActive, DrawFullScreen and 2 more.
; Local: Executes 23 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 17
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CEFF:
lda #$80 ; CPU:$CEFF PRG:0EFF A9 80
sta ZpA9 ; CPU:$CF01 PRG:0F01 85 A9
sta ZpAA ; CPU:$CF03 PRG:0F03 85 AA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_CF05
; Global: The routine calls StartScreenTransition, HandlePlayerInput, SetPlayerActive, DrawFullScreen and 3 more,
; writes $024D, reads $024D.
; Local: Executes 38 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 32
; more instructions.
; Parameters: Reads $024D from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $024D changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_CF05:
lda ZpAD ; CPU:$CF05 PRG:0F05 A5 AD
beq Sub_8764_OnZero_CF45 ; CPU:$CF07 PRG:0F07 F0 3C
bpl SubCCED3_OnNonnegative ; CPU:$CF09 PRG:0F09 10 C8
lda #$80 ; CPU:$CF0B PRG:0F0B A9 80
sta ZpA9 ; CPU:$CF0D PRG:0F0D 85 A9
sta ZpAA ; CPU:$CF0F PRG:0F0F 85 AA
lda #$00 ; CPU:$CF11 PRG:0F11 A9 00
sta Zp13 ; CPU:$CF13 PRG:0F13 85 13
sta Zp14 ; CPU:$CF15 PRG:0F15 85 14
jsr DrawScreenRow ; CPU:$CF17 PRG:0F17 20 14 D0
lda $024D ; CPU:$CF1A PRG:0F1A AD 4D 02
cmp #$28 ; CPU:$CF1D PRG:0F1D C9 28
bcc Sub_8764_JoinBranchPaths_CF26 ; CPU:$CF1F PRG:0F1F 90 05
lda #$28 ; CPU:$CF21 PRG:0F21 A9 28
sta $024D ; CPU:$CF23 PRG:0F23 8D 4D 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_CF26
; Global: The routine calls StartScreenTransition, HandlePlayerInput, SetPlayerActive, DrawFullScreen and 4 more,
; writes $024D, reads $024D and $024C.
; Local: Executes 43 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 37
; more instructions.
; Parameters: Reads $024D and $024C from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $024D changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_CF26:
jsr HandlePlayerInput ; CPU:$CF26 PRG:0F26 20 EB D2
jsr SetEnemyOrigin ; CPU:$CF29 PRG:0F29 20 1B D6
bcc Sub_8764_OnCarryClear_CF33 ; CPU:$CF2C PRG:0F2C 90 05
inc $024C ; CPU:$CF2E PRG:0F2E EE 4C 02
bne SubCCF8F_Loop ; CPU:$CF31 PRG:0F31 D0 5C
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_CF33
; Global: The routine calls StartScreenTransition, HandlePlayerInput, SetPlayerActive, DrawFullScreen and 4 more,
; writes $024D, reads $024D and $024C.
; Local: Executes 50 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 44
; more instructions.
; Parameters: Reads $024D and $024C from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $024D changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_CF33:
jsr DrawFullScreen ; CPU:$CF33 PRG:0F33 20 1A D0
jsr DrawFullScreen ; CPU:$CF36 PRG:0F36 20 1A D0
jsr SetPlayerActive ; CPU:$CF39 PRG:0F39 20 59 D4
jsr CheckTargetRange ; CPU:$CF3C PRG:0F3C 20 D7 D2
lda ZpAD ; CPU:$CF3F PRG:0F3F A5 AD
bne Sub_8764_JoinBranchPaths_CF26 ; CPU:$CF41 PRG:0F41 D0 E3
beq Sub_8764_OnZero_CEFF ; CPU:$CF43 PRG:0F43 F0 BA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CF45
; Global: The routine calls StartScreenTransition, HandlePlayerInput, SetPlayerActive, DrawFullScreen and 6 more,
; writes $024D, reads $024D, $024C and $0262.
; Local: Executes 59 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 53
; more instructions.
; Parameters: Reads $024D, $024C and $0262 from the zero page and RAM; the
; values it acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $024D changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CF45:
jsr HandlePlayerInput ; CPU:$CF45 PRG:0F45 20 EB D2
jsr UpdateRadarBlips ; CPU:$CF48 PRG:0F48 20 E7 D5
lda $0262 ; CPU:$CF4B PRG:0F4B AD 62 02
cmp #$23 ; CPU:$CF4E PRG:0F4E C9 23
bne Sub_8764_OnNonzero_CF62 ; CPU:$CF50 PRG:0F50 D0 10
jsr DrawRowAndReadOffset ; CPU:$CF52 PRG:0F52 20 94 D1
jsr DrawRowAndReadOffset ; CPU:$CF55 PRG:0F55 20 94 D1
lda ZpA6 ; CPU:$CF58 PRG:0F58 A5 A6
bmi Sub_8764_JoinBranchPaths_CF05 ; CPU:$CF5A PRG:0F5A 30 A9
; -----------------------------------------------------------------------------
; Routine: TickScreenCounter
; Global: The routine calls StartScreenTransition, HandlePlayerInput, SetPlayerActive, DrawFullScreen and 6 more,
; writes $024D, reads $024D, $024C and $0262.
; Local: Executes 62 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 56
; more instructions.
; Parameters: Reads $024D, $024C and $0262 from the zero page and RAM; the
; values it acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $024D changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
TickScreenCounter:
inc ZpD3 ; CPU:$CF5C PRG:0F5C E6 D3
inc ZpD5 ; CPU:$CF5E PRG:0F5E E6 D5
bne Sub_8764_OnNonzero_CFDD ; CPU:$CF60 PRG:0F60 D0 7B
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CF62
; Global: The routine calls StartScreenTransition, HandlePlayerInput, SetPlayerActive, DrawFullScreen and 7 more,
; writes $024D, reads $024D, $024C and $0262.
; Local: Executes 69 instructions: loads X with $00; stores X to Zp15; stores
; X to Zp16; stores X to Zp13; increments X; stores X to Zp14; and 63
; more instructions.
; Parameters: Reads $024D, $024C and $0262 from the zero page and RAM; the
; values it acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $024D changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CF62:
lda $024C ; CPU:$CF62 PRG:0F62 AD 4C 02
cmp #$24 ; CPU:$CF65 PRG:0F65 C9 24
bcc Sub_8764_JoinBranchPaths_CF05 ; CPU:$CF67 PRG:0F67 90 9C
jsr CheckScreenBounds ; CPU:$CF69 PRG:0F69 20 00 D2
lda #$C8 ; CPU:$CF6C PRG:0F6C A9 C8
sta Zp3F ; CPU:$CF6E PRG:0F6E 85 3F
sta ZpD1 ; CPU:$CF70 PRG:0F70 85 D1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CF72
; Global: The routine calls UpdatePseudoRandomNumber.
; Local: Executes 5 instructions: calls UpdatePseudoRandomNumber; compares A with $80;
; branches on carry clear to Sub_8764_OnCarryClear_CF7D; increments
; ZpB6; branches on not equal to Sub_8764_OnNonzero_CF7F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CF72:
jsr UpdatePseudoRandomNumber ; CPU:$CF72 PRG:0F72 20 12 C4
cmp #$80 ; CPU:$CF75 PRG:0F75 C9 80
bcc Sub_8764_OnCarryClear_CF7D ; CPU:$CF77 PRG:0F77 90 04
inc ZpB6 ; CPU:$CF79 PRG:0F79 E6 B6
bne Sub_8764_OnNonzero_CF7F ; CPU:$CF7B PRG:0F7B D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_CF7D
; Global: The routine calls UpdatePseudoRandomNumber.
; Local: Executes 6 instructions: calls UpdatePseudoRandomNumber; compares A with $80;
; branches on carry clear to Sub_8764_OnCarryClear_CF7D; increments
; ZpB6; branches on not equal to Sub_8764_OnNonzero_CF7F; decrements
; ZpB6.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_CF7D:
dec ZpB6 ; CPU:$CF7D PRG:0F7D C6 B6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CF7F
; Global: The routine calls UpdatePseudoRandomNumber and UpdateRadarBlips, writes $0361.
; Local: Executes 13 instructions: calls UpdatePseudoRandomNumber; compares A with $80;
; branches on carry clear to Sub_8764_OnCarryClear_CF7D; increments
; ZpB6; branches on not equal to Sub_8764_OnNonzero_CF7F; decrements
; ZpB6; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $0361 changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CF7F:
inc Zp11 ; CPU:$CF7F PRG:0F7F E6 11
jsr UpdateRadarBlips ; CPU:$CF81 PRG:0F81 20 E7 D5
lda #$FF ; CPU:$CF84 PRG:0F84 A9 FF
sta $0361 ; CPU:$CF86 PRG:0F86 8D 61 03
dec ZpD1 ; CPU:$CF89 PRG:0F89 C6 D1
dec Zp3F ; CPU:$CF8B PRG:0F8B C6 3F
bne Sub_8764_OnNonzero_CF72 ; CPU:$CF8D PRG:0F8D D0 E3
; -----------------------------------------------------------------------------
; Routine: SubCCF8F_Loop
; Global: The routine calls SubCC463 and StartTenFrameTimer, writes $04AC and $0361.
; Local: Executes 16 instructions: loads A with $32; stores A to $04AC; loads
; A with $FA; stores A to ZpAB; stores A to $0361; loads X with $00;
; and 10 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $04AC and $0361 changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
SubCCF8F_Loop:
lda #$32 ; CPU:$CF8F PRG:0F8F A9 32
sta $04AC ; CPU:$CF91 PRG:0F91 8D AC 04
lda #$FA ; CPU:$CF94 PRG:0F94 A9 FA
sta ZpAB ; CPU:$CF96 PRG:0F96 85 AB
sta $0361 ; CPU:$CF98 PRG:0F98 8D 61 03
ldx #$00 ; CPU:$CF9B PRG:0F9B A2 00
ldy #$30 ; CPU:$CF9D PRG:0F9D A0 30
jsr SubCC463_OnNonzero ; CPU:$CF9F PRG:0F9F 20 63 C4
lda #$AD ; CPU:$CFA2 PRG:0FA2 A9 AD
sta ZpB2 ; CPU:$CFA4 PRG:0FA4 85 B2
sta ZpB3 ; CPU:$CFA6 PRG:0FA6 85 B3
lda #$04 ; CPU:$CFA8 PRG:0FA8 A9 04
sta ZpA5 ; CPU:$CFAA PRG:0FAA 85 A5
lda #$64 ; CPU:$CFAC PRG:0FAC A9 64
sta Zp3F ; CPU:$CFAE PRG:0FAE 85 3F
jsr StartTenFrameTimer ; CPU:$CFB0 PRG:0FB0 20 15 C5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_CFB3
; Global: The routine calls InitTargetPosition.
; Local: Executes 1 instruction: calls InitTargetPosition.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_CFB3:
jsr InitTargetPosition ; CPU:$CFB3 PRG:0FB3 20 CC D2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CFB6
; Global: The routine calls InitTargetPosition, DrawScreenWithRow13 and SetEnemyOrigin.
; Local: Executes 9 instructions: calls InitTargetPosition; decrements Zp3F; calls
; DrawScreenWithRow13; loads A from Zp3F; compares A with $60; branches on equal
; to Sub_8764_OnZero_CFB3; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CFB6:
dec Zp3F ; CPU:$CFB6 PRG:0FB6 C6 3F
jsr DrawScreenWithRow13 ; CPU:$CFB8 PRG:0FB8 20 91 D1
lda Zp3F ; CPU:$CFBB PRG:0FBB A5 3F
cmp #$60 ; CPU:$CFBD PRG:0FBD C9 60
beq Sub_8764_OnZero_CFB3 ; CPU:$CFBF PRG:0FBF F0 F2
cmp #$55 ; CPU:$CFC1 PRG:0FC1 C9 55
bcc Sub_8764_OnCarryClear_CFC8 ; CPU:$CFC3 PRG:0FC3 90 03
jsr SetEnemyOrigin ; CPU:$CFC5 PRG:0FC5 20 1B D6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_CFC8
; Global: The routine calls InitTargetPosition, DrawScreenWithRow13 and SetEnemyOrigin.
; Local: Executes 11 instructions: calls InitTargetPosition; decrements Zp3F; calls
; DrawScreenWithRow13; loads A from Zp3F; compares A with $60; branches on equal
; to Sub_8764_OnZero_CFB3; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_CFC8:
lda Zp3F ; CPU:$CFC8 PRG:0FC8 A5 3F
bne Sub_8764_OnNonzero_CFB6 ; CPU:$CFCA PRG:0FCA D0 EA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_CFCC
; Global: The routine calls DrawScreenWithRow13 and TickScreenCounter, reads $0262.
; Local: Executes 7 instructions: calls DrawScreenWithRow13; loads A from ZpA6; branches
; on negative to Sub_8764_OnNegative_CFCC; loads A from $0262;
; compares A with $23; branches on not equal to
; Sub_8764_OnNonzero_D019; and 1 more instruction.
; Parameters: Reads $0262 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_CFCC:
jsr DrawScreenWithRow13 ; CPU:$CFCC PRG:0FCC 20 91 D1
lda ZpA6 ; CPU:$CFCF PRG:0FCF A5 A6
bmi Sub_8764_OnNegative_CFCC ; CPU:$CFD1 PRG:0FD1 30 F9
lda $0262 ; CPU:$CFD3 PRG:0FD3 AD 62 02
cmp #$23 ; CPU:$CFD6 PRG:0FD6 C9 23
bne Sub_8764_OnNonzero_D019 ; CPU:$CFD8 PRG:0FD8 D0 3F
jmp TickScreenCounter ; CPU:$CFDA PRG:0FDA 4C 5C CF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_CFDD
; Global: The routine calls InitScoreDisplay, PreparePaletteUpdate, DrawScoreRow, DelayLoop and 1 more.
; Local: Executes 9 instructions: calls InitScoreDisplay; calls PreparePaletteUpdate; loads A with
; $F4; stores A to Zp4E; loads A with $CF; stores A to Zp4F; and 3
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_CFDD:
jsr InitScoreDisplay ; CPU:$CFDD PRG:0FDD 20 E8 C8
jsr PreparePaletteUpdate ; CPU:$CFE0 PRG:0FE0 20 42 C4
lda #$F4 ; CPU:$CFE3 PRG:0FE3 A9 F4
sta Zp4E ; CPU:$CFE5 PRG:0FE5 85 4E
lda #$CF ; CPU:$CFE7 PRG:0FE7 A9 CF
sta Zp4F ; CPU:$CFE9 PRG:0FE9 85 4F
jsr DrawScoreRow ; CPU:$CFEB PRG:0FEB 20 4D C9
jsr DelayLoop ; CPU:$CFEE PRG:0FEE 20 32 C0
jmp InitEnemySlots ; CPU:$CFF1 PRG:0FF1 4C 0A C8
; ---- data $CFF4-$CFFE (11 bytes) ----
CompleteText:
.byte $7F, $7F, $63, $6F, $6D, $70, $6C, $65, $74, $65, $00 ; CPU:$CFF4 PRG:0FF4 7F 7F 63 6F 6D 70 6C 65 74 65 00
; -----------------------------------------------------------------------------
; Routine: StartScreenTransition
; Global: The routine calls StartGameUpdate.
; Local: Executes 5 instructions: loads A with $02; stores A to ZpB9; calls
; StartGameUpdate; loads A with $1F; stores A to Zp3C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N and Z flags, Zp3C, Zp55, ZpB9, the OAM shadow.
;
; -----------------------------------------------------------------------------
StartScreenTransition:
lda #$02 ; CPU:$CFFF PRG:0FFF A9 02
sta ZpB9 ; CPU:$D001 PRG:1001 85 B9
jsr StartGameUpdate ; CPU:$D003 PRG:1003 20 24 D2
lda #$1F ; CPU:$D006 PRG:1006 A9 1F
sta Zp3C ; CPU:$D008 PRG:1008 85 3C
; -----------------------------------------------------------------------------
; Routine: InitScreenState
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $23; loads X with $02.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N and Z flags, the OAM shadow.
;
; -----------------------------------------------------------------------------
InitScreenState:
lda #$23 ; CPU:$D00A PRG:100A A9 23
ldx #$02 ; CPU:$D00C PRG:100C A2 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D00E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: stores A to $024C,x; decrements X; branches
; on non-negative to Sub_8764_OnNonnegative_D00E.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D00E:
sta $024C,x ; CPU:$D00E PRG:100E 9D 4C 02
dex ; CPU:$D011 PRG:1011 CA
bpl Sub_8764_OnNonnegative_D00E; CPU:$D012 PRG:1012 10 FA
; -----------------------------------------------------------------------------
; Routine: DrawScreenRow
; Global: The routine writes $0254.
; Local: Executes 2 instructions: loads A with $2C; stores A to $0254.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $0254 changed.
; Clobbers:
; A, the N and Z flags, the OAM shadow.
;
; -----------------------------------------------------------------------------
DrawScreenRow:
lda #$2C ; CPU:$D014 PRG:1014 A9 2C
sta $0254 ; CPU:$D016 PRG:1016 8D 54 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D019
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D019:
rts ; CPU:$D019 PRG:1019 60
; -----------------------------------------------------------------------------
; Routine: DrawFullScreen
; Global: The routine calls SubCC043, DrawEnemySpriteAlt, RunEnemyDispatch, ProcessRadarSweepCollisions and 4 more,
; reads the JOY1 register.
; Local: Executes 20 instructions: loads Y with $19; calls SubCC043; calls
; DrawEnemySpriteAlt; calls RunEnemyDispatch; calls ProcessRadarSweepCollisions; calls DrawRadarRow; and 14
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
DrawFullScreen:
ldy #$19 ; CPU:$D01A PRG:101A A0 19
jsr SubCC043_OnNonzero ; CPU:$D01C PRG:101C 20 43 C0
jsr DrawEnemySpriteAlt ; CPU:$D01F PRG:101F 20 3E E8
jsr RunEnemyDispatch ; CPU:$D022 PRG:1022 20 8B E2
jsr ProcessRadarSweepCollisions; CPU:$D025 PRG:1025 20 F6 EA
jsr DrawRadarRow ; CPU:$D028 PRG:1028 20 00 D8
jsr UpdateSpriteDirection ; CPU:$D02B PRG:102B 20 99 D1
jsr CheckBlipCollidesWithPlayer; CPU:$D02E PRG:102E 20 BC EE
jsr IsRadarBlipVisible ; CPU:$D031 PRG:1031 20 57 E1
beq Sub_8764_JoinBranchPaths_D06F ; CPU:$D034 PRG:1034 F0 39
lda JOY1 ; CPU:$D036 PRG:1036 AD 16 40
and #$04 ; CPU:$D039 PRG:1039 29 04
cmp ZpE1 ; CPU:$D03B PRG:103B C5 E1
beq Sub_8764_JoinBranchPaths_D04A ; CPU:$D03D PRG:103D F0 0B
sta ZpE1 ; CPU:$D03F PRG:103F 85 E1
lda ZpDF ; CPU:$D041 PRG:1041 A5 DF
bmi Sub_8764_JoinBranchPaths_D04A ; CPU:$D043 PRG:1043 30 05
clc ; CPU:$D045 PRG:1045 18
adc #$08 ; CPU:$D046 PRG:1046 69 08
sta ZpDF ; CPU:$D048 PRG:1048 85 DF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D04A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from ZpDF; branches on equal to
; Sub_8764_JoinBranchPaths_D06F; loads X with $03; compares A with
; $40; branches on carry clear to Sub_8764_OnCarryClear_D055;
; decrements X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D04A:
lda ZpDF ; CPU:$D04A PRG:104A A5 DF
beq Sub_8764_JoinBranchPaths_D06F ; CPU:$D04C PRG:104C F0 21
ldx #$03 ; CPU:$D04E PRG:104E A2 03
cmp #$40 ; CPU:$D050 PRG:1050 C9 40
bcc Sub_8764_OnCarryClear_D055 ; CPU:$D052 PRG:1052 90 01
dex ; CPU:$D054 PRG:1054 CA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D055
; Global: The routine calls DrawSpritePartAlt and MoveEnemyTowardsTarget.
; Local: Executes 12 instructions: stores X to Zp4D; loads A with $78; stores
; A to Zp49; loads A with $2A; stores A to Zp4A; loads A with $CC;
; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D055:
stx Zp4D ; CPU:$D055 PRG:1055 86 4D
lda #$78 ; CPU:$D057 PRG:1057 A9 78
sta Zp49 ; CPU:$D059 PRG:1059 85 49
lda #$2A ; CPU:$D05B PRG:105B A9 2A
sta Zp4A ; CPU:$D05D PRG:105D 85 4A
lda #$CC ; CPU:$D05F PRG:105F A9 CC
sta Zp4B ; CPU:$D061 PRG:1061 85 4B
lda #$01 ; CPU:$D063 PRG:1063 A9 01
jsr DrawSpritePartAlt ; CPU:$D065 PRG:1065 20 A6 C5
dec ZpDF ; CPU:$D068 PRG:1068 C6 DF
bne Sub_8764_JoinBranchPaths_D06F ; CPU:$D06A PRG:106A D0 03
jsr MoveEnemyTowardsTarget ; CPU:$D06C PRG:106C 20 C3 D4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D06F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp0D; branches on not equal to
; Sub_8764_OnNonzero_D0A5; loads X with $0B.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D06F:
lda Zp0D ; CPU:$D06F PRG:106F A5 0D
bne Sub_8764_OnNonzero_D0A5 ; CPU:$D071 PRG:1071 D0 32
ldx #$0B ; CPU:$D073 PRG:1073 A2 0B
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D075
; Global: The routine calls UpdateScoreDigit and WriteScoreDigitAlt, reads $0254 and $0262.
; Local: Executes 21 instructions: loads A from $D119,x; stores A to $07F4,x;
; decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_D075; loads A with $E0; stores A to Zp00;
; and 15 more instructions.
; Parameters: Reads $0254 and $0262 from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D075:
lda $D119,x ; CPU:$D075 PRG:1075 BD 19 D1
sta $07F4,x ; CPU:$D078 PRG:1078 9D F4 07
dex ; CPU:$D07B PRG:107B CA
bpl Sub_8764_OnNonnegative_D075; CPU:$D07C PRG:107C 10 F7
lda #$E0 ; CPU:$D07E PRG:107E A9 E0
sta Zp00 ; CPU:$D080 PRG:1080 85 00
lda #$0C ; CPU:$D082 PRG:1082 A9 0C
sta Zp4C ; CPU:$D084 PRG:1084 85 4C
lda #$03 ; CPU:$D086 PRG:1086 A9 03
sta Zp02 ; CPU:$D088 PRG:1088 85 02
ldx #$78 ; CPU:$D08A PRG:108A A2 78
ldy #$B8 ; CPU:$D08C PRG:108C A0 B8
jsr UpdateScoreDigit ; CPU:$D08E PRG:108E 20 07 C9
lda #$EC ; CPU:$D091 PRG:1091 A9 EC
sta Zp00 ; CPU:$D093 PRG:1093 85 00
ldx #$6E ; CPU:$D095 PRG:1095 A2 6E
lda $0254 ; CPU:$D097 PRG:1097 AD 54 02
jsr WriteScoreDigitAlt ; CPU:$D09A PRG:109A 20 25 C9
ldx #$92 ; CPU:$D09D PRG:109D A2 92
lda $0262 ; CPU:$D09F PRG:109F AD 62 02
jsr WriteScoreDigitAlt ; CPU:$D0A2 PRG:10A2 20 25 C9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D0A5
; Global: The routine calls CheckEnemyNearTarget.
; Local: Executes 4 instructions: loads X with $0B; calls CheckEnemyNearTarget; branches
; on carry clear to Sub_8764_JoinBranchPaths_D0DD; loads X with $03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D0A5:
ldx #$0B ; CPU:$D0A5 PRG:10A5 A2 0B
jsr CheckEnemyNearTarget ; CPU:$D0A7 PRG:10A7 20 61 ED
bcc Sub_8764_JoinBranchPaths_D0DD ; CPU:$D0AA PRG:10AA 90 31
ldx #$03 ; CPU:$D0AC PRG:10AC A2 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D0AE
; Global: The routine calls InitScoreDigits, SubCC463 and WriteSpriteToOamAlt, reads $0240.
; Local: Executes 21 instructions: loads A from $D115,x; stores A to $07C8,x;
; decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_D0AE; loads X with $6E; loads Y with $20;
; and 15 more instructions.
; Parameters: Reads $0240 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D0AE:
lda $D115,x ; CPU:$D0AE PRG:10AE BD 15 D1
sta $07C8,x ; CPU:$D0B1 PRG:10B1 9D C8 07
dex ; CPU:$D0B4 PRG:10B4 CA
bpl Sub_8764_OnNonnegative_D0AE; CPU:$D0B5 PRG:10B5 10 F7
ldx #$6E ; CPU:$D0B7 PRG:10B7 A2 6E
ldy #$20 ; CPU:$D0B9 PRG:10B9 A0 20
jsr InitScoreDigits ; CPU:$D0BB PRG:10BB 20 FB C8
ldx #$D0 ; CPU:$D0BE PRG:10BE A2 D0
ldy #$10 ; CPU:$D0C0 PRG:10C0 A0 10
jsr SubCC463_OnNonzero ; CPU:$D0C2 PRG:10C2 20 63 C4
lda $0240 ; CPU:$D0C5 PRG:10C5 AD 40 02
beq Sub_8764_JoinBranchPaths_D0DD ; CPU:$D0C8 PRG:10C8 F0 13
sta Zp4B ; CPU:$D0CA PRG:10CA 85 4B
lda #$7A ; CPU:$D0CC PRG:10CC A9 7A
sta Zp49 ; CPU:$D0CE PRG:10CE 85 49
lda #$C4 ; CPU:$D0D0 PRG:10D0 A9 C4
sta Zp4A ; CPU:$D0D2 PRG:10D2 85 4A
lda #$03 ; CPU:$D0D4 PRG:10D4 A9 03
sta Zp4D ; CPU:$D0D6 PRG:10D6 85 4D
lda #$33 ; CPU:$D0D8 PRG:10D8 A9 33
jsr WriteSpriteToOamAlt ; CPU:$D0DA PRG:10DA 20 6D C5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D0DD
; Global: The routine calls WriteSpriteToOam, reads $0240.
; Local: Executes 4 instructions: loads A from $0240; branches on not equal to
; Sub_8764_OnNonzero_D0E7; loads A with $33; calls WriteSpriteToOam.
; Parameters: Reads $0240 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D0DD:
lda $0240 ; CPU:$D0DD PRG:10DD AD 40 02
bne Sub_8764_OnNonzero_D0E7 ; CPU:$D0E0 PRG:10E0 D0 05
lda #$33 ; CPU:$D0E2 PRG:10E2 A9 33
jsr WriteSpriteToOam ; CPU:$D0E4 PRG:10E4 20 5A C5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D0E7
; Global: The routine calls CheckGameStateTransition and StartEnemySoundEffect.
; Local: Executes 10 instructions: loads A from ZpD4; branches on equal to
; Sub_8764_OnZero_D125; loads A from Zp3F; branches on not equal to
; SubCD145; loads A from ZpCA; branches on not equal to SubCD145; and
; 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D0E7:
lda ZpD4 ; CPU:$D0E7 PRG:10E7 A5 D4
beq Sub_8764_OnZero_D125 ; CPU:$D0E9 PRG:10E9 F0 3A
lda Zp3F ; CPU:$D0EB PRG:10EB A5 3F
bne SubCD145_Loop ; CPU:$D0ED PRG:10ED D0 56
lda ZpCA ; CPU:$D0EF PRG:10EF A5 CA
bne SubCD145_Loop ; CPU:$D0F1 PRG:10F1 D0 52
jsr CheckGameStateTransition ; CPU:$D0F3 PRG:10F3 20 10 D1
beq SubCD145_Loop ; CPU:$D0F6 PRG:10F6 F0 4D
jsr StartEnemySoundEffect ; CPU:$D0F8 PRG:10F8 20 C1 C2
dec ZpCF ; CPU:$D0FB PRG:10FB C6 CF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D0FD
; Global: The routine calls CheckGameStateTransition.
; Local: Executes 2 instructions: calls CheckGameStateTransition; branches on not equal to
; Sub_8764_OnNonzero_D0FD.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D0FD:
jsr CheckGameStateTransition ; CPU:$D0FD PRG:10FD 20 10 D1
bne Sub_8764_OnNonzero_D0FD ; CPU:$D100 PRG:1100 D0 FB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D102
; Global: The routine calls CheckGameStateTransition, StartEnemySoundEffect, ReadApuFrameCounter and SubCD145.
; Local: Executes 5 instructions: calls CheckGameStateTransition; branches on equal to
; Sub_8764_OnZero_D102; calls StartEnemySoundEffect; calls ReadApuFrameCounter; calls
; SubCD145.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D102:
jsr CheckGameStateTransition ; CPU:$D102 PRG:1102 20 10 D1
beq Sub_8764_OnZero_D102 ; CPU:$D105 PRG:1105 F0 FB
jsr StartEnemySoundEffect ; CPU:$D107 PRG:1107 20 C1 C2
jsr ReadApuFrameCounter ; CPU:$D10A PRG:110A 20 2C C3
jmp SubCD145_Loop ; CPU:$D10D PRG:110D 4C 45 D1
; -----------------------------------------------------------------------------
; Routine: CheckGameStateTransition
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp50; ANDs A with $10; returns
; with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags.
;
; -----------------------------------------------------------------------------
CheckGameStateTransition:
lda Zp50 ; CPU:$D110 PRG:1110 A5 50
and #$10 ; CPU:$D112 PRG:1112 29 10
rts ; CPU:$D114 PRG:1114 60
; ---- data $D115-$D124 (16 bytes) ----
; referenced by `lda $D119,x` at $D075 (operand $D119 falls inside this region)
; referenced by `lda $D115,x` at $D0AE (operand $D115 falls inside this region)
FuelGaugeText:
.byte $20, $55, $00, $62 ; CPU:$D115 PRG:1115 20 55 00 62
CounterDigitTileTable:
.byte $B8, $64, $00, $6C, $D0, $44, $00, $62, $D0, $86, $00, $86 ; CPU:$D119 PRG:1119 B8 64 00 6C D0 44 00 62 D0 86 00 86
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D125
; Global: The routine calls SubCC719.
; Local: Executes 4 instructions: loads A from Zp50; ANDs A with $30; branches
; on equal to Sub_8764_OnZero_D12E; calls SubCC719.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D125:
lda Zp50 ; CPU:$D125 PRG:1125 A5 50
and #$30 ; CPU:$D127 PRG:1127 29 30
beq Sub_8764_OnZero_D12E ; CPU:$D129 PRG:1129 F0 03
jmp SubCC719_Loop ; CPU:$D12B PRG:112B 4C 19 C7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D12E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 11 instructions: increments Zp56; loads A from Zp56; ANDs A
; with $3F; branches on not equal to Sub_8764_JoinBranchPaths_D144;
; increments Zp10; increments ZpB6; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, Zp10, Zp11, Zp56, ZpB6.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D12E:
inc Zp56 ; CPU:$D12E PRG:112E E6 56
lda Zp56 ; CPU:$D130 PRG:1130 A5 56
and #$3F ; CPU:$D132 PRG:1132 29 3F
bne Sub_8764_JoinBranchPaths_D144 ; CPU:$D134 PRG:1134 D0 0E
inc Zp10 ; CPU:$D136 PRG:1136 E6 10
inc ZpB6 ; CPU:$D138 PRG:1138 E6 B6
inc ZpB6 ; CPU:$D13A PRG:113A E6 B6
lda Zp11 ; CPU:$D13C PRG:113C A5 11
cmp #$14 ; CPU:$D13E PRG:113E C9 14
beq Sub_8764_JoinBranchPaths_D144 ; CPU:$D140 PRG:1140 F0 02
inc Zp11 ; CPU:$D142 PRG:1142 E6 11
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D144
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D144:
rts ; CPU:$D144 PRG:1144 60
; -----------------------------------------------------------------------------
; Routine: SubCD145_Loop
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z and C flags, Zp10, ZpC7, ZpC8, the OAM shadow.
;
; -----------------------------------------------------------------------------
SubCD145_Loop:
ldx #$00 ; CPU:$D145 PRG:1145 A2 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D147
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from $026E,x; compares A with
; $0268,x; branches on carry clear to Sub_8764_OnCarryClear_D158;
; branches on not equal to Sub_8764_JoinBranchPaths_D163; increments
; X; compares X with $06; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, Zp10, ZpC7, ZpC8, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D147:
lda $026E,x ; CPU:$D147 PRG:1147 BD 6E 02
cmp $0268,x ; CPU:$D14A PRG:114A DD 68 02
bcc Sub_8764_OnCarryClear_D158 ; CPU:$D14D PRG:114D 90 09
bne Sub_8764_JoinBranchPaths_D163 ; CPU:$D14F PRG:114F D0 12
inx ; CPU:$D151 PRG:1151 E8
cpx #$06 ; CPU:$D152 PRG:1152 E0 06
bne Sub_8764_OnNonzero_D147 ; CPU:$D154 PRG:1154 D0 F1
beq Sub_8764_JoinBranchPaths_D163 ; CPU:$D156 PRG:1156 F0 0B
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D158
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $05.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N and Z flags, Zp10, ZpC7, ZpC8, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D158:
ldx #$05 ; CPU:$D158 PRG:1158 A2 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D15A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A from $0268,x; stores A to $026E,x;
; decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_D15A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, Zp10, ZpC7, ZpC8, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D15A:
lda $0268,x ; CPU:$D15A PRG:115A BD 68 02
sta $026E,x ; CPU:$D15D PRG:115D 9D 6E 02
dex ; CPU:$D160 PRG:1160 CA
bpl Sub_8764_OnNonnegative_D15A; CPU:$D161 PRG:1161 10 F7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D163
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: loads X from Zp50; copies X into A; ANDs A
; with $80; branches on equal to Sub_8764_OnZero_D173; loads A from
; ZpC7; branches on not equal to Sub_8764_OnNonzero_D175; and 3 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N and Z flags, Zp10, ZpC7, ZpC8.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D163:
ldx Zp50 ; CPU:$D163 PRG:1163 A6 50
txa ; CPU:$D165 PRG:1165 8A
and #$80 ; CPU:$D166 PRG:1166 29 80
beq Sub_8764_OnZero_D173 ; CPU:$D168 PRG:1168 F0 09
lda ZpC7 ; CPU:$D16A PRG:116A A5 C7
bne Sub_8764_OnNonzero_D175 ; CPU:$D16C PRG:116C D0 07
inc ZpC7 ; CPU:$D16E PRG:116E E6 C7
inc Zp10 ; CPU:$D170 PRG:1170 E6 10
rts ; CPU:$D172 PRG:1172 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D173
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: stores A to ZpC7.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, Zp10, ZpC7, ZpC8.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D173:
sta ZpC7 ; CPU:$D173 PRG:1173 85 C7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D175
; Global: The routine reads $0361.
; Local: Executes 13 instructions: copies X into A; ANDs A with $40; branches
; on equal to Sub_8764_OnZero_D18E; loads A from ZpC8; branches on
; not equal to Sub_8764_JoinBranchPaths_D190; loads A from $0361; and
; 7 more instructions.
; Parameters: Reads $0361 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, Zp10, ZpC8.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D175:
txa ; CPU:$D175 PRG:1175 8A
and #$40 ; CPU:$D176 PRG:1176 29 40
beq Sub_8764_OnZero_D18E ; CPU:$D178 PRG:1178 F0 14
lda ZpC8 ; CPU:$D17A PRG:117A A5 C8
bne Sub_8764_JoinBranchPaths_D190 ; CPU:$D17C PRG:117C D0 12
lda $0361 ; CPU:$D17E PRG:117E AD 61 03
bpl Sub_8764_JoinBranchPaths_D190 ; CPU:$D181 PRG:1181 10 0D
lda Zp12 ; CPU:$D183 PRG:1183 A5 12
and #$03 ; CPU:$D185 PRG:1185 29 03
bne Sub_8764_JoinBranchPaths_D190 ; CPU:$D187 PRG:1187 D0 07
inc ZpC8 ; CPU:$D189 PRG:1189 E6 C8
dec Zp10 ; CPU:$D18B PRG:118B C6 10
rts ; CPU:$D18D PRG:118D 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D18E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: stores A to ZpC8.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; no register, ZpC8.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D18E:
sta ZpC8 ; CPU:$D18E PRG:118E 85 C8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D190
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D190:
rts ; CPU:$D190 PRG:1190 60
; -----------------------------------------------------------------------------
; Routine: DrawScreenWithRow13
; Global: The routine calls DrawFullScreen.
; Local: Executes 1 instruction: calls DrawFullScreen.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
DrawScreenWithRow13:
jsr DrawFullScreen ; CPU:$D191 PRG:1191 20 1A D0
; -----------------------------------------------------------------------------
; Routine: DrawRowAndReadOffset
; Global: The routine calls SubCC043.
; Local: Executes 2 instructions: loads Y with $13; calls SubCC043.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; X and Y, the N and Z flags.
;
; -----------------------------------------------------------------------------
DrawRowAndReadOffset:
ldy #$13 ; CPU:$D194 PRG:1194 A0 13
jmp SubCC043_OnNonzero ; CPU:$D196 PRG:1196 4C 43 C0
; -----------------------------------------------------------------------------
; Routine: UpdateSpriteDirection
; Global: The routine calls ReadSpriteOffsetTable and CheckScreenBounds.
; Local: Executes 5 instructions: loads A from ZpA5; ANDs A with $03; branches
; on not equal to Sub_8764_OnNonzero_D1A5; calls ReadSpriteOffsetTable; calls
; CheckScreenBounds.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
UpdateSpriteDirection:
lda ZpA5 ; CPU:$D199 PRG:1199 A5 A5
and #$03 ; CPU:$D19B PRG:119B 29 03
bne Sub_8764_OnNonzero_D1A5 ; CPU:$D19D PRG:119D D0 06
jsr ReadSpriteOffsetTable ; CPU:$D19F PRG:119F 20 2D CE
jsr CheckScreenBounds ; CPU:$D1A2 PRG:11A2 20 00 D2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D1A5
; Global: The routine calls CheckPlayerState and AddObjectYPositionDelta, reads $04B6.
; Local: Executes 18 instructions: loads A from ZpA5; compares A with $05;
; branches on not equal to Sub_8764_JoinBranchPaths_D1DA; calls
; CheckPlayerState; loads X from ZpD8; branches on negative to
; Sub_8764_JoinBranchPaths_D1DA; and 12 more instructions.
; Parameters: Reads $04B6 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D1A5:
lda ZpA5 ; CPU:$D1A5 PRG:11A5 A5 A5
cmp #$05 ; CPU:$D1A7 PRG:11A7 C9 05
bne Sub_8764_JoinBranchPaths_D1DA ; CPU:$D1A9 PRG:11A9 D0 2F
jsr CheckPlayerState ; CPU:$D1AB PRG:11AB 20 4C D2
ldx ZpD8 ; CPU:$D1AE PRG:11AE A6 D8
bmi Sub_8764_JoinBranchPaths_D1DA ; CPU:$D1B0 PRG:11B0 30 28
dec ZpD8 ; CPU:$D1B2 PRG:11B2 C6 D8
beq Sub_8764_OnZero_D1DB ; CPU:$D1B4 PRG:11B4 F0 25
lda $04B6 ; CPU:$D1B6 PRG:11B6 AD B6 04
bpl Sub_8764_JoinBranchPaths_D1DA ; CPU:$D1B9 PRG:11B9 10 1F
txa ; CPU:$D1BB PRG:11BB 8A
and #$07 ; CPU:$D1BC PRG:11BC 29 07
tax ; CPU:$D1BE PRG:11BE AA
ldy #$0B ; CPU:$D1BF PRG:11BF A0 0B
sty ZpD2 ; CPU:$D1C1 PRG:11C1 84 D2
lda $D1F8,x ; CPU:$D1C3 PRG:11C3 BD F8 D1
jsr AddObjectYPositionDelta ; CPU:$D1C6 PRG:11C6 20 F9 C4
lda #$00 ; CPU:$D1C9 PRG:11C9 A9 00
; -----------------------------------------------------------------------------
; Routine: AddObjectXPosition
; Global: The routine writes $0281 and $035F.
; Local: Executes 6 instructions: clears the carry flag; adds $0280,y to A;
; stores A to $0281; loads A from $035E,y; adds $00 to A; stores A to
; $035F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $0281 and $035F changed.
; Clobbers:
; A, the N, Z, C and V flags, the OAM shadow, $035F.
;
; -----------------------------------------------------------------------------
AddObjectXPosition:
clc ; CPU:$D1CB PRG:11CB 18
adc $0280,y ; CPU:$D1CC PRG:11CC 79 80 02
sta $0281 ; CPU:$D1CF PRG:11CF 8D 81 02
lda $035E,y ; CPU:$D1D2 PRG:11D2 B9 5E 03
adc #$00 ; CPU:$D1D5 PRG:11D5 69 00
sta $035F ; CPU:$D1D7 PRG:11D7 8D 5F 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D1DA
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D1DA:
rts ; CPU:$D1DA PRG:11DA 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D1DB
; Global: The routine calls InitDirectionStateAlt.
; Local: Executes 5 instructions: loads A with $03; calls InitDirectionStateAlt; loads A
; with $00; stores A to ZpD5; stores A to ZpD2.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, the OAM shadow and the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D1DB:
lda #$03 ; CPU:$D1DB PRG:11DB A9 03
jsr InitDirectionStateAlt ; CPU:$D1DD PRG:11DD 20 20 CE
lda #$00 ; CPU:$D1E0 PRG:11E0 A9 00
sta ZpD5 ; CPU:$D1E2 PRG:11E2 85 D5
sta ZpD2 ; CPU:$D1E4 PRG:11E4 85 D2
; -----------------------------------------------------------------------------
; Routine: ResetSpriteAttributes
; Global: The routine writes $0369, $036A and $0267.
; Local: Executes 8 instructions: loads A with $FF; stores A to $0369; stores
; A to $036A; loads A with $23; stores A to $0267; loads A with $04;
; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves $0369, $036A and $0267 changed.
; Clobbers:
; A, the N and Z flags, Zp07, the OAM shadow, $0369, $036A.
;
; -----------------------------------------------------------------------------
ResetSpriteAttributes:
lda #$FF ; CPU:$D1E6 PRG:11E6 A9 FF
sta $0369 ; CPU:$D1E8 PRG:11E8 8D 69 03
sta $036A ; CPU:$D1EB PRG:11EB 8D 6A 03
lda #$23 ; CPU:$D1EE PRG:11EE A9 23
sta $0267 ; CPU:$D1F0 PRG:11F0 8D 67 02
lda #$04 ; CPU:$D1F3 PRG:11F3 A9 04
sta Zp07 ; CPU:$D1F5 PRG:11F5 85 07
rts ; CPU:$D1F7 PRG:11F7 60
; ---- data $D1F8-$D1FF (8 bytes) ----
; referenced by `lda $D1F8,x` at $D1C3 (operand $D1F8 falls inside this region)
SproutTileTable:
.byte $00, $00, $32, $1E, $0A, $28, $00, $14 ; CPU:$D1F8 PRG:11F8 00 00 32 1E 0A 28 00 14
; -----------------------------------------------------------------------------
; Routine: CheckScreenBounds
; Global: The routine reads $024C and $024D.
; Local: Executes 10 instructions: loads A from $024C; compares A with $24;
; branches on carry set to Sub_8764_OnCarrySet_D216; loads A from
; $024D; compares A with $2B; branches on carry set to
; Sub_8764_OnCarrySet_D216; and 4 more instructions.
; Parameters: Reads $024C and $024D from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, Zp3C, Zp55, ZpB9.
;
; -----------------------------------------------------------------------------
CheckScreenBounds:
lda $024C ; CPU:$D200 PRG:1200 AD 4C 02
cmp #$24 ; CPU:$D203 PRG:1203 C9 24
bcs Sub_8764_OnCarrySet_D216 ; CPU:$D205 PRG:1205 B0 0F
lda $024D ; CPU:$D207 PRG:1207 AD 4D 02
cmp #$2B ; CPU:$D20A PRG:120A C9 2B
bcs Sub_8764_OnCarrySet_D216 ; CPU:$D20C PRG:120C B0 08
cmp #$28 ; CPU:$D20E PRG:120E C9 28
bcs Sub_8764_OnCarrySet_D21C ; CPU:$D210 PRG:1210 B0 0A
ldx #$02 ; CPU:$D212 PRG:1212 A2 02
bne Sub_8764_OnNonzero_D228 ; CPU:$D214 PRG:1214 D0 12
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D216
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads X with $05; loads Y with $10; branches
; on not equal to Sub_8764_OnNonzero_D220.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N and Z flags, Zp3C, Zp55, ZpB9.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D216:
ldx #$05 ; CPU:$D216 PRG:1216 A2 05
ldy #$10 ; CPU:$D218 PRG:1218 A0 10
bne Sub_8764_OnNonzero_D220 ; CPU:$D21A PRG:121A D0 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D21C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads X with $07; loads Y with $18.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N and Z flags, Zp3C, Zp55, ZpB9.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D21C:
ldx #$07 ; CPU:$D21C PRG:121C A2 07
ldy #$18 ; CPU:$D21E PRG:121E A0 18
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D220
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: stores Y to Zp3C; stores X to ZpB9.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, Zp3C, Zp55, ZpB9.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D220:
sty Zp3C ; CPU:$D220 PRG:1220 84 3C
stx ZpB9 ; CPU:$D222 PRG:1222 86 B9
; -----------------------------------------------------------------------------
; Routine: StartGameUpdate
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $01; stores A to
; FrameSubCounter.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, Zp55.
;
; -----------------------------------------------------------------------------
StartGameUpdate:
lda #$01 ; CPU:$D224 PRG:1224 A9 01
sta FrameSubCounter ; CPU:$D226 PRG:1226 85 55
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D228
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D228:
rts ; CPU:$D228 PRG:1228 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D229
; Global: The routine reads $03D8, $02FA and $0369.
; Local: Executes 7 instructions: loads A from $03D8; branches on not equal to
; Sub_8764_JoinBranchPaths_D244; loads A from $02FA; compares A with
; $5C; branches on carry set to Sub_8764_JoinBranchPaths_D244; loads
; A from $0369; and 1 more instruction.
; Parameters: Reads $03D8, $02FA and $0369 from the zero page and RAM; the
; values it acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, ZpD7, ZpD8.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D229:
lda $03D8 ; CPU:$D229 PRG:1229 AD D8 03
bne Sub_8764_JoinBranchPaths_D244 ; CPU:$D22C PRG:122C D0 16
lda $02FA ; CPU:$D22E PRG:122E AD FA 02
cmp #$5C ; CPU:$D231 PRG:1231 C9 5C
bcs Sub_8764_JoinBranchPaths_D244 ; CPU:$D233 PRG:1233 B0 0F
lda $0369 ; CPU:$D235 PRG:1235 AD 69 03
bmi Sub_8764_JoinBranchPaths_D244 ; CPU:$D238 PRG:1238 30 0A
; -----------------------------------------------------------------------------
; Routine: TickPlayerTimer
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from ZpD8; branches on non-negative
; to Sub_8764_JoinBranchPaths_D244; loads A with $0F; stores A to
; ZpD8; increments ZpD7.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, ZpD7, ZpD8.
;
; -----------------------------------------------------------------------------
TickPlayerTimer:
lda ZpD8 ; CPU:$D23A PRG:123A A5 D8
bpl Sub_8764_JoinBranchPaths_D244 ; CPU:$D23C PRG:123C 10 06
lda #$0F ; CPU:$D23E PRG:123E A9 0F
sta ZpD8 ; CPU:$D240 PRG:1240 85 D8
inc ZpD7 ; CPU:$D242 PRG:1242 E6 D7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D244
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D244:
rts ; CPU:$D244 PRG:1244 60
; ---- data $D245-$D24B (7 bytes) ----
; referenced by `lda $D245,x` at $D262 (operand $D245 falls inside this region)
MaskBitTable:
.byte $1F, $1F, $1F, $3F, $7F, $7F, $FF ; CPU:$D245 PRG:1245 1F 1F 1F 3F 7F 7F FF
; -----------------------------------------------------------------------------
; Routine: CheckPlayerState
; Global: The routine calls CheckSpawnState and InitDirectionState, reads $03D8, $02FA, $0369
; and $036B.
; Local: Executes 33 instructions: loads A from $03D8; branches on not equal
; to Sub_8764_JoinBranchPaths_D244; loads A from $02FA; compares A
; with $5C; branches on carry set to Sub_8764_JoinBranchPaths_D244;
; loads A from $0369; and 27 more instructions.
; Parameters: Reads $03D8, $02FA, $0369 and $036B from the zero page and RAM;
; the values it acts on are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
CheckPlayerState:
lda $036B ; CPU:$D24C PRG:124C AD 6B 03
bmi Sub_8764_JoinBranchPaths_D244 ; CPU:$D24F PRG:124F 30 F3
lda ZpBC ; CPU:$D251 PRG:1251 A5 BC
bmi Sub_8764_OnNegative_D29C ; CPU:$D253 PRG:1253 30 47
lda ZpBB ; CPU:$D255 PRG:1255 A5 BB
beq Sub_8764_OnZero_D229 ; CPU:$D257 PRG:1257 F0 D0
bmi Sub_8764_OnNegative_D29F ; CPU:$D259 PRG:1259 30 44
jsr CheckSpawnState ; CPU:$D25B PRG:125B 20 A7 D8
beq Sub_8764_JoinBranchPaths_D244 ; CPU:$D25E PRG:125E F0 E4
ldx ZpBD ; CPU:$D260 PRG:1260 A6 BD
lda $D245,x ; CPU:$D262 PRG:1262 BD 45 D2
and Zp12 ; CPU:$D265 PRG:1265 25 12
bne Sub_8764_JoinBranchPaths_D244 ; CPU:$D267 PRG:1267 D0 DB
ldx ZpBB ; CPU:$D269 PRG:1269 A6 BB
cpx #$16 ; CPU:$D26B PRG:126B E0 16
bcs Sub_8764_OnCarrySet_D279 ; CPU:$D26D PRG:126D B0 0A
inc ZpBB ; CPU:$D26F PRG:126F E6 BB
cpx #$0F ; CPU:$D271 PRG:1271 E0 0F
bne Sub_8764_JoinBranchPaths_D278 ; CPU:$D273 PRG:1273 D0 03
jsr InitDirectionState ; CPU:$D275 PRG:1275 20 1E CE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D278
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D278:
rts ; CPU:$D278 PRG:1278 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D279
; Global: The routine reads $03D8.
; Local: Executes 6 instructions: returns with RTS; loads A from $03D8;
; compares A with $03; branches on carry clear to
; Sub_8764_OnCarryClear_D284; compares A with $07; branches on carry
; clear to Sub_8764_JoinBranchPaths_D278.
; Parameters: Reads $03D8 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D279:
lda $03D8 ; CPU:$D279 PRG:1279 AD D8 03
cmp #$03 ; CPU:$D27C PRG:127C C9 03
bcc Sub_8764_OnCarryClear_D284 ; CPU:$D27E PRG:127E 90 04
cmp #$07 ; CPU:$D280 PRG:1280 C9 07
bcc Sub_8764_JoinBranchPaths_D278 ; CPU:$D282 PRG:1282 90 F4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D284
; Global: The routine calls InitDirectionState.
; Local: Executes 7 instructions: loads A with $0F; stores A to ZpBC; loads A
; with $0C; stores A to ZpBA; loads A with $BE; stores A to ZpBB; and
; 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D284:
lda #$0F ; CPU:$D284 PRG:1284 A9 0F
sta ZpBC ; CPU:$D286 PRG:1286 85 BC
lda #$0C ; CPU:$D288 PRG:1288 A9 0C
sta ZpBA ; CPU:$D28A PRG:128A 85 BA
lda #$BE ; CPU:$D28C PRG:128C A9 BE
sta ZpBB ; CPU:$D28E PRG:128E 85 BB
jsr InitDirectionState ; CPU:$D290 PRG:1290 20 1E CE
; -----------------------------------------------------------------------------
; Routine: StartEnemySound
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A from ZpCA; branches on not equal to
; Sub_8764_OnNonzero_D29B; loads A with $15; stores A to ZpCE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, ZpCE.
;
; -----------------------------------------------------------------------------
StartEnemySound:
lda ZpCA ; CPU:$D293 PRG:1293 A5 CA
bne Sub_8764_OnNonzero_D29B ; CPU:$D295 PRG:1295 D0 04
lda #$15 ; CPU:$D297 PRG:1297 A9 15
sta ZpCE ; CPU:$D299 PRG:1299 85 CE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D29B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D29B:
rts ; CPU:$D29B PRG:129B 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D29C
; Global: The routine calls MoveRadarBlip.
; Local: Executes 1 instruction: calls MoveRadarBlip.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D29C:
jmp MoveRadarBlip ; CPU:$D29C PRG:129C 4C 50 D6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D29F
; Global: The routine calls DrawFactorySprites and DrawTargetSprites.
; Local: Executes 12 instructions: loads X with $0D; calls DrawFactorySprites; loads X
; with $0E; calls DrawFactorySprites; decrements ZpBB; branches on negative to
; Sub_8764_OnNegative_D2BB; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, Zp53, ZpBB, the OAM
; shadow, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D29F:
ldx #$0D ; CPU:$D29F PRG:129F A2 0D
jsr DrawFactorySprites ; CPU:$D2A1 PRG:12A1 20 D5 ED
ldx #$0E ; CPU:$D2A4 PRG:12A4 A2 0E
jsr DrawFactorySprites ; CPU:$D2A6 PRG:12A6 20 D5 ED
dec ZpBB ; CPU:$D2A9 PRG:12A9 C6 BB
bmi Sub_8764_OnNegative_D2BB ; CPU:$D2AB PRG:12AB 30 0E
lda #$83 ; CPU:$D2AD PRG:12AD A9 83
sta ZpBB ; CPU:$D2AF PRG:12AF 85 BB
ldx #$0D ; CPU:$D2B1 PRG:12B1 A2 0D
jsr DrawTargetSprites ; CPU:$D2B3 PRG:12B3 20 E0 ED
ldx #$0E ; CPU:$D2B6 PRG:12B6 A2 0E
jsr DrawTargetSprites ; CPU:$D2B8 PRG:12B8 20 E0 ED
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D2BB
; Global: The routine reads $036B and $028D.
; Local: Executes 7 instructions: loads A from $036B; branches on not equal to
; Sub_8764_JoinBranchPaths_D2CB; loads A from $028D; compares A with
; $64; branches on carry set to Sub_8764_JoinBranchPaths_D2CB; loads
; A with $00; and 1 more instruction.
; Parameters: Reads $036B and $028D from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, ZpBB.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D2BB:
lda $036B ; CPU:$D2BB PRG:12BB AD 6B 03
bne Sub_8764_JoinBranchPaths_D2CB ; CPU:$D2BE PRG:12BE D0 0B
lda $028D ; CPU:$D2C0 PRG:12C0 AD 8D 02
cmp #$64 ; CPU:$D2C3 PRG:12C3 C9 64
bcs Sub_8764_JoinBranchPaths_D2CB ; CPU:$D2C5 PRG:12C5 B0 04
lda #$00 ; CPU:$D2C7 PRG:12C7 A9 00
sta ZpBB ; CPU:$D2C9 PRG:12C9 85 BB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D2CB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D2CB:
rts ; CPU:$D2CB PRG:12CB 60
; -----------------------------------------------------------------------------
; Routine: InitTargetPosition
; Global: The routine calls UpdateFuelGauge, writes $043D.
; Local: Executes 5 instructions: loads X with $01; calls UpdateFuelGauge; loads A
; with $7C; stores A to $043D; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves $043D changed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
InitTargetPosition:
ldx #$01 ; CPU:$D2CC PRG:12CC A2 01
jsr UpdateFuelGauge ; CPU:$D2CE PRG:12CE 20 61 D5
lda #$7C ; CPU:$D2D1 PRG:12D1 A9 7C
sta $043D ; CPU:$D2D3 PRG:12D3 8D 3D 04
rts ; CPU:$D2D6 PRG:12D6 60
; -----------------------------------------------------------------------------
; Routine: CheckTargetRange
; Global: The routine reads $024C.
; Local: Executes 6 instructions: loads A from $024C; compares A with $24;
; branches on carry set to Sub_8764_OnCarrySet_D2E3; loads A from
; ZpBD; branches on equal to Sub_8764_OnZero_D2E8; returns with RTS.
; Parameters: Reads $024C from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
CheckTargetRange:
lda $024C ; CPU:$D2D7 PRG:12D7 AD 4C 02
cmp #$24 ; CPU:$D2DA PRG:12DA C9 24
bcs Sub_8764_OnCarrySet_D2E3 ; CPU:$D2DC PRG:12DC B0 05
lda ZpBD ; CPU:$D2DE PRG:12DE A5 BD
beq Sub_8764_OnZero_D2E8 ; CPU:$D2E0 PRG:12E0 F0 06
rts ; CPU:$D2E2 PRG:12E2 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D2E3
; Global: The routine calls SubCCF8F.
; Local: Executes 3 instructions: pulls A; pulls A; calls SubCCF8F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D2E3:
pla ; CPU:$D2E3 PRG:12E3 68
pla ; CPU:$D2E4 PRG:12E4 68
jmp SubCCF8F_Loop ; CPU:$D2E5 PRG:12E5 4C 8F CF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D2E8
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: pulls A; pulls A; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D2E8:
pla ; CPU:$D2E8 PRG:12E8 68
pla ; CPU:$D2E9 PRG:12E9 68
rts ; CPU:$D2EA PRG:12EA 60
; -----------------------------------------------------------------------------
; Routine: HandlePlayerInput
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp07; branches on equal to
; Sub_8764_OnZero_D2FE; branches on negative to
; Sub_8764_OnNegative_D317; loads A from Zp08; branches on negative
; to Sub_8764_OnNegative_D2FF; compares A with $51; and 1 more
; instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
HandlePlayerInput:
lda Zp07 ; CPU:$D2EB PRG:12EB A5 07
beq Sub_8764_OnZero_D2FE ; CPU:$D2ED PRG:12ED F0 0F
bmi Sub_8764_OnNegative_D317 ; CPU:$D2EF PRG:12EF 30 26
lda Zp08 ; CPU:$D2F1 PRG:12F1 A5 08
bmi Sub_8764_OnNegative_D2FF ; CPU:$D2F3 PRG:12F3 30 0A
cmp #$51 ; CPU:$D2F5 PRG:12F5 C9 51
bne Sub_8764_OnNonzero_D2F9 ; CPU:$D2F7 PRG:12F7 D0 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D2F9
; Global: The routine calls UpdatePlayerDirection.
; Local: Executes 2 instructions: calls UpdatePlayerDirection; increments Zp08.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N, Z and C flags, Zp08, ZpAB.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D2F9:
jsr UpdatePlayerDirection ; CPU:$D2F9 PRG:12F9 20 0A D3
inc Zp08 ; CPU:$D2FC PRG:12FC E6 08
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D2FE
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D2FE:
rts ; CPU:$D2FE PRG:12FE 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D2FF
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A with $00; stores A to Zp07; stores A
; to ZpAD; loads A with $01; stores A to ZpAB; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, Zp07, ZpAB, ZpAD.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D2FF:
lda #$00 ; CPU:$D2FF PRG:12FF A9 00
sta Zp07 ; CPU:$D301 PRG:1301 85 07
sta ZpAD ; CPU:$D303 PRG:1303 85 AD
lda #$01 ; CPU:$D305 PRG:1305 A9 01
sta ZpAB ; CPU:$D307 PRG:1307 85 AB
rts ; CPU:$D309 PRG:1309 60
; -----------------------------------------------------------------------------
; Routine: UpdatePlayerDirection
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp08; branches on equal to
; Sub_8764_OnZero_D316; loads Y with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z and C flags, ZpAB.
;
; -----------------------------------------------------------------------------
UpdatePlayerDirection:
lda Zp08 ; CPU:$D30A PRG:130A A5 08
beq Sub_8764_OnZero_D316 ; CPU:$D30C PRG:130C F0 08
ldy #$00 ; CPU:$D30E PRG:130E A0 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D310
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: increments Y; rotates a left; branches on
; carry clear to Sub_8764_OnCarryClear_D310; stores Y to ZpAB.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; Y, the N, Z and C flags, ZpAB.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D310:
iny ; CPU:$D310 PRG:1310 C8
rol a ; CPU:$D311 PRG:1311 2A
bcc Sub_8764_OnCarryClear_D310 ; CPU:$D312 PRG:1312 90 FC
sty ZpAB ; CPU:$D314 PRG:1314 84 AB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D316
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D316:
rts ; CPU:$D316 PRG:1316 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D317
; Global: The routine calls UpdatePlayerDirection.
; Local: Executes 10 instructions: loads A from Zp08; branches on equal to
; Sub_8764_OnZero_D32C; decrements Zp08; loads A with $00; stores A
; to Zp11; calls UpdatePlayerDirection; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D317:
lda Zp08 ; CPU:$D317 PRG:1317 A5 08
beq Sub_8764_OnZero_D32C ; CPU:$D319 PRG:1319 F0 11
dec Zp08 ; CPU:$D31B PRG:131B C6 08
lda #$00 ; CPU:$D31D PRG:131D A9 00
sta Zp11 ; CPU:$D31F PRG:131F 85 11
jsr UpdatePlayerDirection ; CPU:$D321 PRG:1321 20 0A D3
lda Zp08 ; CPU:$D324 PRG:1324 A5 08
cmp #$50 ; CPU:$D326 PRG:1326 C9 50
bne Sub_8764_OnNonzero_D33A ; CPU:$D328 PRG:1328 D0 10
beq Sub_8764_OnZero_D33B ; CPU:$D32A PRG:132A F0 0F
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D32C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A with $00; stores A to Zp07; stores A
; to Zp11; loads A with $FA; stores A to ZpAB; loads A with $0A; and
; 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, Zp07, Zp11, ZpAB, ZpAC.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D32C:
lda #$00 ; CPU:$D32C PRG:132C A9 00
sta Zp07 ; CPU:$D32E PRG:132E 85 07
sta Zp11 ; CPU:$D330 PRG:1330 85 11
lda #$FA ; CPU:$D332 PRG:1332 A9 FA
sta ZpAB ; CPU:$D334 PRG:1334 85 AB
lda #$0A ; CPU:$D336 PRG:1336 A9 0A
sta ZpAC ; CPU:$D338 PRG:1338 85 AC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D33A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D33A:
rts ; CPU:$D33A PRG:133A 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D33B
; Global: The routine calls StartGameUpdate.
; Local: Executes 8 instructions: loads A from ZpAF; compares A with $02;
; branches on equal to Sub_8764_OnZero_D34C; loads A with $00; stores
; A to ZpDB; calls StartGameUpdate; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D33B:
lda ZpAF ; CPU:$D33B PRG:133B A5 AF
cmp #$02 ; CPU:$D33D PRG:133D C9 02
beq Sub_8764_OnZero_D34C ; CPU:$D33F PRG:133F F0 0B
lda #$00 ; CPU:$D341 PRG:1341 A9 00
sta ZpDB ; CPU:$D343 PRG:1343 85 DB
jsr StartGameUpdate ; CPU:$D345 PRG:1345 20 24 D2
lda #$40 ; CPU:$D348 PRG:1348 A9 40
bne Sub_8764_OnNonzero_D34E ; CPU:$D34A PRG:134A D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D34C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $80.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D34C:
lda #$80 ; CPU:$D34C PRG:134C A9 80
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D34E
; Global: The routine calls SubCD4BF.
; Local: Executes 4 instructions: stores A to ZpAD; loads A with $01; stores A
; to Zp0A; calls SubCD4BF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D34E:
sta ZpAD ; CPU:$D34E PRG:134E 85 AD
lda #$01 ; CPU:$D350 PRG:1350 A9 01
sta Zp0A ; CPU:$D352 PRG:1352 85 0A
jmp SubCD4BF_Loop ; CPU:$D354 PRG:1354 4C BF D4
; -----------------------------------------------------------------------------
; Routine: CheckSpriteState
; Global: The routine calls DrawBlipSprite, reads $0369.
; Local: Executes 19 instructions: loads A from $0369; branches on negative to
; Sub_8764_JoinBranchPaths_D38F; loads A from Zp0F; branches on not
; equal to Sub_8764_JoinBranchPaths_D38F; loads A from ZpAF; compares
; A with $0B; and 13 more instructions.
; Parameters: Reads $0369 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
CheckSpriteState:
lda $0369 ; CPU:$D357 PRG:1357 AD 69 03
bmi Sub_8764_JoinBranchPaths_D38F ; CPU:$D35A PRG:135A 30 33
lda Zp0F ; CPU:$D35C PRG:135C A5 0F
bne Sub_8764_JoinBranchPaths_D38F ; CPU:$D35E PRG:135E D0 2F
lda ZpAF ; CPU:$D360 PRG:1360 A5 AF
cmp #$0B ; CPU:$D362 PRG:1362 C9 0B
bne Sub_8764_JoinBranchPaths_D38F ; CPU:$D364 PRG:1364 D0 29
lda ZpAE ; CPU:$D366 PRG:1366 A5 AE
cmp #$24 ; CPU:$D368 PRG:1368 C9 24
bcc Sub_8764_JoinBranchPaths_D38F ; CPU:$D36A PRG:136A 90 23
cmp #$33 ; CPU:$D36C PRG:136C C9 33
bcs Sub_8764_JoinBranchPaths_D38F ; CPU:$D36E PRG:136E B0 1F
jsr DrawBlipSprite ; CPU:$D370 PRG:1370 20 66 EE
clc ; CPU:$D373 PRG:1373 18
lda Zp27 ; CPU:$D374 PRG:1374 A5 27
adc #$0A ; CPU:$D376 PRG:1376 69 0A
sta Zp27 ; CPU:$D378 PRG:1378 85 27
bcc Sub_8764_OnCarryClear_D37E ; CPU:$D37A PRG:137A 90 02
inc Zp28 ; CPU:$D37C PRG:137C E6 28
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D37E
; Global: The routine calls ComputeObjectOffset.
; Local: Executes 7 instructions: loads X with $0C; calls ComputeObjectOffset; loads A
; from Zp28; branches on not equal to Sub_8764_JoinBranchPaths_D38F;
; loads A from Zp27; compares A with $1E; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp03, Zp25, Zp26, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D37E:
ldx #$0C ; CPU:$D37E PRG:137E A2 0C
jsr ComputeObjectOffset ; CPU:$D380 PRG:1380 20 65 E6
lda Zp28 ; CPU:$D383 PRG:1383 A5 28
bne Sub_8764_JoinBranchPaths_D38F ; CPU:$D385 PRG:1385 D0 08
lda Zp27 ; CPU:$D387 PRG:1387 A5 27
cmp #$1E ; CPU:$D389 PRG:1389 C9 1E
bcs Sub_8764_JoinBranchPaths_D38F ; CPU:$D38B PRG:138B B0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D38D
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: sets the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the C flag.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D38D:
sec ; CPU:$D38D PRG:138D 38
rts ; CPU:$D38E PRG:138E 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D38F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 17 instructions: sets the carry flag; returns with RTS;
; loads A from ZpAF; compares A with $02; branches on not equal to
; Sub_8764_JoinBranchPaths_D3AD; loads A from ZpB1; and 11 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D38F:
lda ZpAF ; CPU:$D38F PRG:138F A5 AF
cmp #$02 ; CPU:$D391 PRG:1391 C9 02
bne Sub_8764_JoinBranchPaths_D3AD ; CPU:$D393 PRG:1393 D0 18
lda ZpB1 ; CPU:$D395 PRG:1395 A5 B1
bne Sub_8764_JoinBranchPaths_D3AD ; CPU:$D397 PRG:1397 D0 14
lda ZpAE ; CPU:$D399 PRG:1399 A5 AE
cmp #$58 ; CPU:$D39B PRG:139B C9 58
bcc Sub_8764_JoinBranchPaths_D3AD ; CPU:$D39D PRG:139D 90 0E
cmp #$AD ; CPU:$D39F PRG:139F C9 AD
bcs Sub_8764_JoinBranchPaths_D3AD ; CPU:$D3A1 PRG:13A1 B0 0A
lda ZpB0 ; CPU:$D3A3 PRG:13A3 A5 B0
cmp #$D4 ; CPU:$D3A5 PRG:13A5 C9 D4
bcc Sub_8764_JoinBranchPaths_D3AD ; CPU:$D3A7 PRG:13A7 90 04
cmp #$F8 ; CPU:$D3A9 PRG:13A9 C9 F8
bcc Sub_8764_OnCarryClear_D38D ; CPU:$D3AB PRG:13AB 90 E0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D3AD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: clears the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D3AD:
clc ; CPU:$D3AD PRG:13AD 18
rts ; CPU:$D3AE PRG:13AE 60
; -----------------------------------------------------------------------------
; Routine: ClassifyRadarBlip
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from ZpB6; compares A with $04;
; branches on carry clear to Sub_8764_OnCarryClear_D3BD; compares A
; with $44; branches on carry clear to Sub_8764_OnCarryClear_D3C1;
; loads A with $04; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp29, Zp45, Zp46, Zp47, Zp48,
; ZpB6.
;
; -----------------------------------------------------------------------------
ClassifyRadarBlip:
lda ZpB6 ; CPU:$D3AF PRG:13AF A5 B6
cmp #$04 ; CPU:$D3B1 PRG:13B1 C9 04
bcc Sub_8764_OnCarryClear_D3BD ; CPU:$D3B3 PRG:13B3 90 08
cmp #$44 ; CPU:$D3B5 PRG:13B5 C9 44
bcc Sub_8764_OnCarryClear_D3C1 ; CPU:$D3B7 PRG:13B7 90 08
lda #$04 ; CPU:$D3B9 PRG:13B9 A9 04
bne Sub_8764_OnNonzero_D3BF ; CPU:$D3BB PRG:13BB D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D3BD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $43.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp29, Zp45, Zp46, Zp47, Zp48,
; ZpB6.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D3BD:
lda #$43 ; CPU:$D3BD PRG:13BD A9 43
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D3BF
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: stores A to ZpB6.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp29, Zp45, Zp46, Zp47, Zp48,
; ZpB6.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D3BF:
sta ZpB6 ; CPU:$D3BF PRG:13BF 85 B6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D3C1
; Global: The routine calls ExtractRadarAngle.
; Local: Executes 16 instructions: loads Y from Zp3D; loads A from $D3FE,y;
; calls ExtractRadarAngle; loads A from Zp48; shifts a right; shifts a right;
; and 10 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp29, Zp45, Zp46, Zp47, Zp48.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D3C1:
ldy Zp3D ; CPU:$D3C1 PRG:13C1 A4 3D
lda $D3FE,y ; CPU:$D3C3 PRG:13C3 B9 FE D3
jsr ExtractRadarAngle ; CPU:$D3C6 PRG:13C6 20 22 D4
lda Zp48 ; CPU:$D3C9 PRG:13C9 A5 48
lsr a ; CPU:$D3CB PRG:13CB 4A
lsr a ; CPU:$D3CC PRG:13CC 4A
sta Zp47 ; CPU:$D3CD PRG:13CD 85 47
lda $D410,y ; CPU:$D3CF PRG:13CF B9 10 D4
jsr ExtractRadarAngle ; CPU:$D3D2 PRG:13D2 20 22 D4
lsr Zp48 ; CPU:$D3D5 PRG:13D5 46 48
lsr Zp48 ; CPU:$D3D7 PRG:13D7 46 48
lda $D3FE,y ; CPU:$D3D9 PRG:13D9 B9 FE D3
bmi Sub_8764_OnNegative_D3E4 ; CPU:$D3DC PRG:13DC 30 06
lda Zp47 ; CPU:$D3DE PRG:13DE A5 47
ora #$80 ; CPU:$D3E0 PRG:13E0 09 80
bne Sub_8764_OnNonzero_D3E9 ; CPU:$D3E2 PRG:13E2 D0 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D3E4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: sets the carry flag; loads A with $80;
; subtracts Zp47 from A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp45, Zp46.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D3E4:
sec ; CPU:$D3E4 PRG:13E4 38
lda #$80 ; CPU:$D3E5 PRG:13E5 A9 80
sbc Zp47 ; CPU:$D3E7 PRG:13E7 E5 47
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D3E9
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: stores A to Zp45; loads A from $D410,y;
; branches on negative to Sub_8764_OnNegative_D3F6; loads A from
; Zp48; ORs A with $80; branches on not equal to
; Sub_8764_OnNonzero_D3FB.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp45, Zp46.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D3E9:
sta Zp45 ; CPU:$D3E9 PRG:13E9 85 45
lda $D410,y ; CPU:$D3EB PRG:13EB B9 10 D4
bmi Sub_8764_OnNegative_D3F6 ; CPU:$D3EE PRG:13EE 30 06
lda Zp48 ; CPU:$D3F0 PRG:13F0 A5 48
ora #$80 ; CPU:$D3F2 PRG:13F2 09 80
bne Sub_8764_OnNonzero_D3FB ; CPU:$D3F4 PRG:13F4 D0 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D3F6
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: sets the carry flag; loads A with $80;
; subtracts Zp48 from A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp46.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D3F6:
sec ; CPU:$D3F6 PRG:13F6 38
lda #$80 ; CPU:$D3F7 PRG:13F7 A9 80
sbc Zp48 ; CPU:$D3F9 PRG:13F9 E5 48
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D3FB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: stores A to Zp46; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, Zp46.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D3FB:
sta Zp46 ; CPU:$D3FB PRG:13FB 85 46
rts ; CPU:$D3FD PRG:13FD 60
; ---- data $D3FE-$D421 (36 bytes) ----
; referenced by `lda $D3FE,y` at $D3C3 (operand $D3FE falls inside this region)
; referenced by `lda $D410,y` at $D3CF (operand $D410 falls inside this region)
; referenced by `lda $D3FE,y` at $D3D9 (operand $D3FE falls inside this region)
; referenced by `lda $D410,y` at $D3EB (operand $D410 falls inside this region)
MovementAngleTable:
.byte $00, $85, $83, $00, $03, $05, $07, $08, $07, $05, $03, $00, $83, $85, $87, $88 ; CPU:$D3FE PRG:13FE 00 85 83 00 03 05 07 08 07 05 03 00 83 85 87 88
.byte $87, $85 ; CPU:$D40E PRG:140E 87 85
MovementSpeedTable:
.byte $00, $84, $85, $86, $85, $84, $82, $00, $02, $04, $05, $06, $05, $04 ; CPU:$D410 PRG:1410 00 84 85 86 85 84 82 00 02 04 05 06 05 04
.byte $02, $00, $82, $84 ; CPU:$D41E PRG:141E 02 00 82 84
; -----------------------------------------------------------------------------
; Routine: ExtractRadarAngle
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: ANDs A with $7F; stores A to Zp29; loads A
; with $00; stores A to Zp48; loads X with $08.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp29, Zp48.
;
; -----------------------------------------------------------------------------
ExtractRadarAngle:
and #$7F ; CPU:$D422 PRG:1422 29 7F
sta Zp29 ; CPU:$D424 PRG:1424 85 29
lda #$00 ; CPU:$D426 PRG:1426 A9 00
sta Zp48 ; CPU:$D428 PRG:1428 85 48
ldx #$08 ; CPU:$D42A PRG:142A A2 08
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D42C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: shifts Zp29 right; branches on carry clear
; to Sub_8764_OnCarryClear_D433; clears the carry flag; adds Zp11 to
; A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; X, the N, Z, C and V flags, Zp29, Zp48.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D42C:
lsr Zp29 ; CPU:$D42C PRG:142C 46 29
bcc Sub_8764_OnCarryClear_D433 ; CPU:$D42E PRG:142E 90 03
clc ; CPU:$D430 PRG:1430 18
adc Zp11 ; CPU:$D431 PRG:1431 65 11
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D433
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: shifts Zp29 right; branches on carry clear
; to Sub_8764_OnCarryClear_D433; clears the carry flag; adds Zp11 to
; A; rotates a right; rotates Zp48 right; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; X, the N, Z, C and V flags, Zp29, Zp48.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D433:
ror a ; CPU:$D433 PRG:1433 6A
ror Zp48 ; CPU:$D434 PRG:1434 66 48
dex ; CPU:$D436 PRG:1436 CA
bne Sub_8764_OnNonzero_D42C ; CPU:$D437 PRG:1437 D0 F3
rts ; CPU:$D439 PRG:1439 60
; -----------------------------------------------------------------------------
; Routine: ComputeRadarBlipTile
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 17 instructions: loads A from ZpB6; shifts a right; shifts a
; right; stores A to Zp3D; copies A into X; clears the carry flag;
; and 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp3D, ZpB3, ZpB4, ZpB5.
;
; -----------------------------------------------------------------------------
ComputeRadarBlipTile:
lda ZpB6 ; CPU:$D43A PRG:143A A5 B6
lsr a ; CPU:$D43C PRG:143C 4A
lsr a ; CPU:$D43D PRG:143D 4A
sta Zp3D ; CPU:$D43E PRG:143E 85 3D
tax ; CPU:$D440 PRG:1440 AA
clc ; CPU:$D441 PRG:1441 18
adc #$4F ; CPU:$D442 PRG:1442 69 4F
sta ZpB3 ; CPU:$D444 PRG:1444 85 B3
clc ; CPU:$D446 PRG:1446 18
lda ZpAA ; CPU:$D447 PRG:1447 A5 AA
adc #$07 ; CPU:$D449 PRG:1449 69 07
sta ZpB5 ; CPU:$D44B PRG:144B 85 B5
clc ; CPU:$D44D PRG:144D 18
lda ZpA9 ; CPU:$D44E PRG:144E A5 A9
adc #$2A ; CPU:$D450 PRG:1450 69 2A
sta ZpB4 ; CPU:$D452 PRG:1452 85 B4
rts ; CPU:$D454 PRG:1454 60
; -----------------------------------------------------------------------------
; Routine: CheckPlayerActive
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A from Zp0A; branches on not equal to
; SubCD4BF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
CheckPlayerActive:
lda Zp0A ; CPU:$D455 PRG:1455 A5 0A
bne SubCD4BF_Loop ; CPU:$D457 PRG:1457 D0 66
; -----------------------------------------------------------------------------
; Routine: SetPlayerActive
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from Zp10; branches on equal to
; Sub_8764_OnZero_D469; loads A from ZpAD; branches on equal to
; Sub_8764_OnZero_D46A; loads A with $01; stores A to Zp07.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
SetPlayerActive:
lda Zp10 ; CPU:$D459 PRG:1459 A5 10
beq Sub_8764_OnZero_D469 ; CPU:$D45B PRG:145B F0 0C
lda ZpAD ; CPU:$D45D PRG:145D A5 AD
beq Sub_8764_OnZero_D46A ; CPU:$D45F PRG:145F F0 09
lda #$01 ; CPU:$D461 PRG:1461 A9 01
sta Zp07 ; CPU:$D463 PRG:1463 85 07
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D465
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $00; stores A to Zp10.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, Zp10.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D465:
lda #$00 ; CPU:$D465 PRG:1465 A9 00
sta Zp10 ; CPU:$D467 PRG:1467 85 10
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D469
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D469:
rts ; CPU:$D469 PRG:1469 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D46A
; Global: The routine calls CheckSpriteState.
; Local: Executes 13 instructions: loads A with $00; stores A to Zp10; returns
; with RTS; loads A from Zp11; compares A with $04; branches on carry
; set to Sub_8764_JoinBranchPaths_D47F; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D46A:
lda Zp11 ; CPU:$D46A PRG:146A A5 11
cmp #$04 ; CPU:$D46C PRG:146C C9 04
bcs Sub_8764_JoinBranchPaths_D47F ; CPU:$D46E PRG:146E B0 0F
lda Zp38 ; CPU:$D470 PRG:1470 A5 38
bne Sub_8764_JoinBranchPaths_D47F ; CPU:$D472 PRG:1472 D0 0B
jsr CheckSpriteState ; CPU:$D474 PRG:1474 20 57 D3
bcc Sub_8764_JoinBranchPaths_D47F ; CPU:$D477 PRG:1477 90 06
lda #$80 ; CPU:$D479 PRG:1479 A9 80
sta Zp07 ; CPU:$D47B PRG:147B 85 07
bne Sub_8764_OnNonzero_D465 ; CPU:$D47D PRG:147D D0 E6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D47F
; Global: The routine calls DecrementScreenCounter.
; Local: Executes 3 instructions: loads A from Zp10; branches on non-negative
; to Sub_8764_OnNonnegative_D486; calls DecrementScreenCounter.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D47F:
lda Zp10 ; CPU:$D47F PRG:147F A5 10
bpl Sub_8764_OnNonnegative_D486; CPU:$D481 PRG:1481 10 03
jmp DecrementScreenCounter ; CPU:$D483 PRG:1483 4C C9 D5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D486
; Global: The routine calls SubCD4BF.
; Local: Executes 18 instructions: loads A from ZpB4; stores A to Zp1F; loads
; A from ZpB5; stores A to Zp20; loads A with $00; stores A to Zp0B;
; and 12 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D486:
lda ZpB4 ; CPU:$D486 PRG:1486 A5 B4
sta Zp1F ; CPU:$D488 PRG:1488 85 1F
lda ZpB5 ; CPU:$D48A PRG:148A A5 B5
sta Zp20 ; CPU:$D48C PRG:148C 85 20
lda #$00 ; CPU:$D48E PRG:148E A9 00
sta Zp0B ; CPU:$D490 PRG:1490 85 0B
ldx Zp3D ; CPU:$D492 PRG:1492 A6 3D
stx Zp3E ; CPU:$D494 PRG:1494 86 3E
lda $D4AD,x ; CPU:$D496 PRG:1496 BD AD D4
sta Zp0A ; CPU:$D499 PRG:1499 85 0A
lda #$00 ; CPU:$D49B PRG:149B A9 00
sta Zp10 ; CPU:$D49D PRG:149D 85 10
jsr SubCD4BF_Loop ; CPU:$D49F PRG:149F 20 BF D4
lda ZpCE ; CPU:$D4A2 PRG:14A2 A5 CE
bne Sub_8764_OnNonzero_D4AC ; CPU:$D4A4 PRG:14A4 D0 06
lda ZpCA ; CPU:$D4A6 PRG:14A6 A5 CA
bne Sub_8764_OnNonzero_D4AC ; CPU:$D4A8 PRG:14A8 D0 02
inc ZpCE ; CPU:$D4AA PRG:14AA E6 CE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D4AC
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D4AC:
rts ; CPU:$D4AC PRG:14AC 60
; ---- data $D4AD-$D4BE (18 bytes) ----
; referenced by `lda $D4AD,x` at $D496 (operand $D4AD falls inside this region)
MovementDeltaTable:
.byte $FF, $16, $14, $12, $14, $16, $12, $0E, $12, $16, $16, $14, $16, $16, $12, $0E ; CPU:$D4AD PRG:14AD FF 16 14 12 14 16 12 0E 12 16 16 14 16 16 12 0E
.byte $12, $16 ; CPU:$D4BD PRG:14BD 12 16
; -----------------------------------------------------------------------------
; Routine: SubCD4BF_Loop
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: decrements Zp0A; branches on not equal to
; Sub_8764_OnNonzero_D4C8.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
SubCD4BF_Loop:
dec Zp0A ; CPU:$D4BF PRG:14BF C6 0A
bne Sub_8764_OnNonzero_D4C8 ; CPU:$D4C1 PRG:14C1 D0 05
; -----------------------------------------------------------------------------
; Routine: MoveEnemyTowardsTarget
; Global: The routine calls WriteSpriteToOamB.
; Local: Executes 2 instructions: loads A with $01; calls WriteSpriteToOamB.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z and C flags, Zp52, Zp53, $0700.
;
; -----------------------------------------------------------------------------
MoveEnemyTowardsTarget:
lda #$01 ; CPU:$D4C3 PRG:14C3 A9 01
jmp WriteSpriteToOamB ; CPU:$D4C5 PRG:14C5 4C 89 C5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D4C8
; Global: The routine calls ApplyEnemyMovementDelta.
; Local: Executes 6 instructions: loads X from Zp3E; loads Y with $00; loads A
; from $D53D,x; calls ApplyEnemyMovementDelta; branches on carry clear to
; Sub_8764_OnCarryClear_D4D6; increments Zp0B.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D4C8:
ldx Zp3E ; CPU:$D4C8 PRG:14C8 A6 3E
ldy #$00 ; CPU:$D4CA PRG:14CA A0 00
lda $D53D,x ; CPU:$D4CC PRG:14CC BD 3D D5
jsr ApplyEnemyMovementDelta ; CPU:$D4CF PRG:14CF 20 24 D5
bcc Sub_8764_OnCarryClear_D4D6 ; CPU:$D4D2 PRG:14D2 90 02
inc Zp0B ; CPU:$D4D4 PRG:14D4 E6 0B
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D4D6
; Global: The routine calls ApplyEnemyMovementDelta.
; Local: Executes 9 instructions: increments Y; loads A from $D54F,x; calls
; ApplyEnemyMovementDelta; loads A from ZpDF; branches on equal to
; Sub_8764_OnZero_D4E9; increments ZpE0; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D4D6:
iny ; CPU:$D4D6 PRG:14D6 C8
lda $D54F,x ; CPU:$D4D7 PRG:14D7 BD 4F D5
jsr ApplyEnemyMovementDelta ; CPU:$D4DA PRG:14DA 20 24 D5
lda ZpDF ; CPU:$D4DD PRG:14DD A5 DF
beq Sub_8764_OnZero_D4E9 ; CPU:$D4DF PRG:14DF F0 08
inc ZpE0 ; CPU:$D4E1 PRG:14E1 E6 E0
lda ZpE0 ; CPU:$D4E3 PRG:14E3 A5 E0
and #$01 ; CPU:$D4E5 PRG:14E5 29 01
beq Sub_8764_OnZero_D4EC ; CPU:$D4E7 PRG:14E7 F0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D4E9
; Global: The routine calls SetHelicopterOrigin.
; Local: Executes 1 instruction: calls SetHelicopterOrigin.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D4E9:
jsr SetHelicopterOrigin ; CPU:$D4E9 PRG:14E9 20 EE F0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D4EC
; Global: The routine calls SetPlayerOrigin.
; Local: Executes 9 instructions: calls SetPlayerOrigin; branches on carry clear to
; Sub_8764_JoinBranchPaths_D523; loads A from Zp65,x; compares A with
; $0A; branches on equal to Sub_8764_OnZero_D4FF; compares A with
; $04; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D4EC:
jsr SetPlayerOrigin ; CPU:$D4EC PRG:14EC 20 0E D7
bcc Sub_8764_JoinBranchPaths_D523 ; CPU:$D4EF PRG:14EF 90 32
lda Zp65,x ; CPU:$D4F1 PRG:14F1 B5 65
cmp #$0A ; CPU:$D4F3 PRG:14F3 C9 0A
beq Sub_8764_OnZero_D4FF ; CPU:$D4F5 PRG:14F5 F0 08
cmp #$04 ; CPU:$D4F7 PRG:14F7 C9 04
beq Sub_8764_OnZero_D4FF ; CPU:$D4F9 PRG:14F9 F0 04
cmp #$15 ; CPU:$D4FB PRG:14FB C9 15
bcc Sub_8764_JoinBranchPaths_D523 ; CPU:$D4FD PRG:14FD 90 24
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D4FF
; Global: The routine calls WriteSpriteToOamB.
; Local: Executes 6 instructions: loads Y with $00; stores Y to Zp0A; pushes
; A; loads A with $01; calls WriteSpriteToOamB; pulls A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D4FF:
ldy #$00 ; CPU:$D4FF PRG:14FF A0 00
sty Zp0A ; CPU:$D501 PRG:1501 84 0A
pha ; CPU:$D503 PRG:1503 48
lda #$01 ; CPU:$D504 PRG:1504 A9 01
jsr WriteSpriteToOamB ; CPU:$D506 PRG:1506 20 89 C5
pla ; CPU:$D509 PRG:1509 68
; -----------------------------------------------------------------------------
; Routine: ReadEnemyPosition
; Global: The routine calls IsEnemyInTargetZone.
; Local: Executes 11 instructions: calls IsEnemyInTargetZone; compares X with $33;
; branches on carry set to Sub_8764_JoinBranchPaths_D523; compares X
; with $15; branches on carry clear to Sub_8764_JoinBranchPaths_D523;
; loads A from $051A,x; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
ReadEnemyPosition:
jsr IsEnemyInTargetZone ; CPU:$D50A PRG:150A 20 21 E6
cpx #$33 ; CPU:$D50D PRG:150D E0 33
bcs Sub_8764_JoinBranchPaths_D523 ; CPU:$D50F PRG:150F B0 12
cpx #$15 ; CPU:$D511 PRG:1511 E0 15
bcc Sub_8764_JoinBranchPaths_D523 ; CPU:$D513 PRG:1513 90 0E
lda $051A,x ; CPU:$D515 PRG:1515 BD 1A 05
and #$3F ; CPU:$D518 PRG:1518 29 3F
tax ; CPU:$D51A PRG:151A AA
lda $0667,x ; CPU:$D51B PRG:151B BD 67 06
and #$7F ; CPU:$D51E PRG:151E 29 7F
sta $0667,x ; CPU:$D520 PRG:1520 9D 67 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D523
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D523:
rts ; CPU:$D523 PRG:1523 60
; -----------------------------------------------------------------------------
; Routine: ApplyEnemyMovementDelta
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: branches on negative to
; Sub_8764_OnNegative_D52E; clears the carry flag; adds Zp1F,y to A;
; stores A to Zp1F,y; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, Zp29.
;
; -----------------------------------------------------------------------------
ApplyEnemyMovementDelta:
bmi Sub_8764_OnNegative_D52E ; CPU:$D524 PRG:1524 30 08
clc ; CPU:$D526 PRG:1526 18
adc a:Zp1F,y ; CPU:$D527 PRG:1527 79 1F 00
sta a:Zp1F,y ; CPU:$D52A PRG:152A 99 1F 00
rts ; CPU:$D52D PRG:152D 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D52E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: ANDs A with $7F; stores A to Zp29; sets the
; carry flag; loads A from Zp1F,y; subtracts Zp29 from A; stores A to
; Zp1F,y; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, Zp29.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D52E:
and #$7F ; CPU:$D52E PRG:152E 29 7F
sta Zp29 ; CPU:$D530 PRG:1530 85 29
sec ; CPU:$D532 PRG:1532 38
lda a:Zp1F,y ; CPU:$D533 PRG:1533 B9 1F 00
sbc Zp29 ; CPU:$D536 PRG:1536 E5 29
sta a:Zp1F,y ; CPU:$D538 PRG:1538 99 1F 00
clc ; CPU:$D53B PRG:153B 18
rts ; CPU:$D53C PRG:153C 60
; ---- data $D53D-$D560 (36 bytes) ----
; referenced by `lda $D53D,x` at $D4CC (operand $D53D falls inside this region)
; referenced by `lda $D54F,x` at $D4D7 (operand $D54F falls inside this region)
EnemySpeedTable:
.byte $FF, $04, $03, $00, $83, $84, $86, $88, $86, $84, $83, $00, $03, $04, $06, $08 ; CPU:$D53D PRG:153D FF 04 03 00 83 84 86 88 86 84 83 00 03 04 06 08
.byte $06, $04 ; CPU:$D54D PRG:154D 06 04
EnemySpeedFineTable:
.byte $FF, $04, $05, $06, $05, $04, $02, $00, $82, $84, $85, $86, $85, $84 ; CPU:$D54F PRG:154F FF 04 05 06 05 04 02 00 82 84 85 86 85 84
.byte $82, $00, $02, $04 ; CPU:$D55D PRG:155D 82 00 02 04
; -----------------------------------------------------------------------------
; Routine: UpdateFuelGauge
; Global: The routine calls DrawSpritePart, ComputeFuelLevel and SubCC59C.
; Local: Executes 11 instructions: calls DrawSpritePart; copies X into A; pushes A;
; loads X with $00; calls ComputeFuelLevel; pulls A; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp29, Zp2A, Zp52, Zp53, the OAM
; shadow, $035E.
;
; -----------------------------------------------------------------------------
UpdateFuelGauge:
jsr DrawSpritePart ; CPU:$D561 PRG:1561 20 A1 C5
txa ; CPU:$D564 PRG:1564 8A
pha ; CPU:$D565 PRG:1565 48
ldx #$00 ; CPU:$D566 PRG:1566 A2 00
jsr ComputeFuelLevel ; CPU:$D568 PRG:1568 20 76 D5
pla ; CPU:$D56B PRG:156B 68
clc ; CPU:$D56C PRG:156C 18
adc #$6F ; CPU:$D56D PRG:156D 69 6F
inx ; CPU:$D56F PRG:156F E8
jsr ComputeFuelLevel ; CPU:$D570 PRG:1570 20 76 D5
jmp SubCC59C_OnZero ; CPU:$D573 PRG:1573 4C 9C C5
; -----------------------------------------------------------------------------
; Routine: ComputeFuelLevel
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: copies A into Y; clears the carry flag;
; loads A from ZpB4,x; compares X with $00; branches on equal to
; Sub_8764_OnZero_D57F; increments X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp29, Zp2A, the OAM shadow, $035E.
;
; -----------------------------------------------------------------------------
ComputeFuelLevel:
tay ; CPU:$D576 PRG:1576 A8
clc ; CPU:$D577 PRG:1577 18
lda ZpB4,x ; CPU:$D578 PRG:1578 B5 B4
cpx #$00 ; CPU:$D57A PRG:157A E0 00
beq Sub_8764_OnZero_D57F ; CPU:$D57C PRG:157C F0 01
inx ; CPU:$D57E PRG:157E E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D57F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 18 instructions: adds $D5BD,x to A; stores A to Zp29; loads
; A from $D5C0,x; adds $00 to A; stores A to Zp2A; clears the carry
; flag; and 12 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp29, Zp2A, the OAM shadow, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D57F:
adc $D5BD,x ; CPU:$D57F PRG:157F 7D BD D5
sta Zp29 ; CPU:$D582 PRG:1582 85 29
lda $D5C0,x ; CPU:$D584 PRG:1584 BD C0 D5
adc #$00 ; CPU:$D587 PRG:1587 69 00
sta Zp2A ; CPU:$D589 PRG:1589 85 2A
clc ; CPU:$D58B PRG:158B 18
lda ZpAE,x ; CPU:$D58C PRG:158C B5 AE
adc Zp29 ; CPU:$D58E PRG:158E 65 29
sta $0280,y ; CPU:$D590 PRG:1590 99 80 02
lda ZpAF,x ; CPU:$D593 PRG:1593 B5 AF
adc Zp2A ; CPU:$D595 PRG:1595 65 2A
sta $035E,y ; CPU:$D597 PRG:1597 99 5E 03
cmp $D5C3,x ; CPU:$D59A PRG:159A DD C3 D5
bcc Sub_8764_OnCarryClear_D5BC ; CPU:$D59D PRG:159D 90 1D
bne Sub_8764_OnNonzero_D5A9 ; CPU:$D59F PRG:159F D0 08
lda $0280,y ; CPU:$D5A1 PRG:15A1 B9 80 02
cmp $D5C6,x ; CPU:$D5A4 PRG:15A4 DD C6 D5
bcc Sub_8764_OnCarryClear_D5BC ; CPU:$D5A7 PRG:15A7 90 13
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D5A9
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: sets the carry flag; loads A from $0280,y;
; subtracts $D5C6,x from A; stores A to $0280,y; loads A from
; $035E,y; subtracts $D5C3,x from A; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, the OAM shadow, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D5A9:
sec ; CPU:$D5A9 PRG:15A9 38
lda $0280,y ; CPU:$D5AA PRG:15AA B9 80 02
sbc $D5C6,x ; CPU:$D5AD PRG:15AD FD C6 D5
sta $0280,y ; CPU:$D5B0 PRG:15B0 99 80 02
lda $035E,y ; CPU:$D5B3 PRG:15B3 B9 5E 03
sbc $D5C3,x ; CPU:$D5B6 PRG:15B6 FD C3 D5
sta $035E,y ; CPU:$D5B9 PRG:15B9 99 5E 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D5BC
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D5BC:
rts ; CPU:$D5BC PRG:15BC 60
; ---- data $D5BD-$D5C8 (12 bytes) ----
; referenced by `adc $D5BD,x` at $D57F (operand $D5BD falls inside this region)
; referenced by `lda $D5C0,x` at $D584 (operand $D5C0 falls inside this region)
; referenced by `cmp $D5C3,x` at $D59A (operand $D5C3 falls inside this region)
; referenced by `cmp $D5C6,x` at $D5A4 (operand $D5C6 falls inside this region)
; referenced by `sbc $D5C6,x` at $D5AD (operand $D5C6 falls inside this region)
; referenced by `sbc $D5C3,x` at $D5B6 (operand $D5C3 falls inside this region)
FuelThresholdTable:
.byte $32, $00, $A2, $01, $00, $00, $0C, $00, $07, $80, $00, $D0 ; CPU:$D5BD PRG:15BD 32 00 A2 01 00 00 0C 00 07 80 00 D0
; -----------------------------------------------------------------------------
; Routine: DecrementScreenCounter
; Global: The routine calls UpdateFuelGauge, writes $043F and $04AE, reads $0254.
; Local: Executes 10 instructions: loads A from $0254; compares A with $24;
; branches on carry clear to Sub_8764_OnCarryClear_D5E2; decrements
; $0254; loads A with $7D; stores A to $043F; and 4 more
; instructions.
; Parameters: Reads $0254 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $043F and $04AE changed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
DecrementScreenCounter:
lda $0254 ; CPU:$D5C9 PRG:15C9 AD 54 02
cmp #$24 ; CPU:$D5CC PRG:15CC C9 24
bcc Sub_8764_OnCarryClear_D5E2 ; CPU:$D5CE PRG:15CE 90 12
dec $0254 ; CPU:$D5D0 PRG:15D0 CE 54 02
lda #$7D ; CPU:$D5D3 PRG:15D3 A9 7D
sta $043F ; CPU:$D5D5 PRG:15D5 8D 3F 04
ldx #$03 ; CPU:$D5D8 PRG:15D8 A2 03
jsr UpdateFuelGauge ; CPU:$D5DA PRG:15DA 20 61 D5
lda #$20 ; CPU:$D5DD PRG:15DD A9 20
sta $04AE ; CPU:$D5DF PRG:15DF 8D AE 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D5E2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A with $00; stores A to Zp10; returns
; with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, Zp10.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D5E2:
lda #$00 ; CPU:$D5E2 PRG:15E2 A9 00
sta Zp10 ; CPU:$D5E4 PRG:15E4 85 10
rts ; CPU:$D5E6 PRG:15E6 60
; -----------------------------------------------------------------------------
; Routine: UpdateRadarBlips
; Global: The routine calls UpdateRadarSweepAngle, CheckPlayerActive, ComputeRadarBlipTile and DrawFullScreen.
; Local: Executes 5 instructions: calls UpdateRadarSweepAngle; calls CheckPlayerActive; calls
; ComputeRadarBlipTile; calls DrawFullScreen; loads Y with $0F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
UpdateRadarBlips:
jsr UpdateRadarSweepAngle ; CPU:$D5E7 PRG:15E7 20 00 E7
jsr CheckPlayerActive ; CPU:$D5EA PRG:15EA 20 55 D4
jsr ComputeRadarBlipTile ; CPU:$D5ED PRG:15ED 20 3A D4
jsr DrawFullScreen ; CPU:$D5F0 PRG:15F0 20 1A D0
ldy #$0F ; CPU:$D5F3 PRG:15F3 A0 0F
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D5F5
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from Zp65,y; compares A with $03;
; branches on equal to Sub_8764_OnZero_D600; decrements Y; branches
; on non-negative to Sub_8764_OnNonnegative_D5F5; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D5F5:
lda a:Zp65,y ; CPU:$D5F5 PRG:15F5 B9 65 00
cmp #$03 ; CPU:$D5F8 PRG:15F8 C9 03
beq Sub_8764_OnZero_D600 ; CPU:$D5FA PRG:15FA F0 04
dey ; CPU:$D5FC PRG:15FC 88
bpl Sub_8764_OnNonnegative_D5F5; CPU:$D5FD PRG:15FD 10 F6
rts ; CPU:$D5FF PRG:15FF 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D600
; Global: The routine calls CheckTargetSpriteType and CheckGameStateFlags, reads $043F.
; Local: Executes 8 instructions: loads X with $03; calls CheckTargetSpriteType; loads A
; from $043F; compares A with $7E; branches on not equal to
; Sub_8764_OnNonzero_D611; pushes A; and 2 more instructions.
; Parameters: Reads $043F from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D600:
ldx #$03 ; CPU:$D600 PRG:1600 A2 03
jsr CheckTargetSpriteType ; CPU:$D602 PRG:1602 20 B5 E3
lda $043F ; CPU:$D605 PRG:1605 AD 3F 04
cmp #$7E ; CPU:$D608 PRG:1608 C9 7E
bne Sub_8764_OnNonzero_D611 ; CPU:$D60A PRG:160A D0 05
pha ; CPU:$D60C PRG:160C 48
jsr CheckGameStateFlags ; CPU:$D60D PRG:160D 20 0D C5
pla ; CPU:$D610 PRG:1610 68
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D611
; Global: The routine calls SetRadarBlipOrigin.
; Local: Executes 4 instructions: compares A with $82; branches on not equal
; to Sub_8764_OnNonzero_D61A; calls SetRadarBlipOrigin; branches on carry set
; to Sub_8764_OnCarrySet_D62C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D611:
cmp #$82 ; CPU:$D611 PRG:1611 C9 82
bne Sub_8764_OnNonzero_D61A ; CPU:$D613 PRG:1613 D0 05
jsr SetRadarBlipOrigin ; CPU:$D615 PRG:1615 20 FE D6
bcs Sub_8764_OnCarrySet_D62C ; CPU:$D618 PRG:1618 B0 12
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D61A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D61A:
rts ; CPU:$D61A PRG:161A 60
; -----------------------------------------------------------------------------
; Routine: SetEnemyOrigin
; Global: The routine calls SubCD71A.
; Local: Executes 8 instructions: loads A from ZpB4; stores A to Zp25; loads A
; from ZpB5; stores A to Zp27; loads A with $00; stores A to Zp03;
; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
SetEnemyOrigin:
lda ZpB4 ; CPU:$D61B PRG:161B A5 B4
sta Zp25 ; CPU:$D61D PRG:161D 85 25
lda ZpB5 ; CPU:$D61F PRG:161F A5 B5
sta Zp27 ; CPU:$D621 PRG:1621 85 27
lda #$00 ; CPU:$D623 PRG:1623 A9 00
sta Zp03 ; CPU:$D625 PRG:1625 85 03
jsr SubCD71A_Loop ; CPU:$D627 PRG:1627 20 1A D7
bcc Sub_8764_OnCarryClear_D63A ; CPU:$D62A PRG:162A 90 0E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D62C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp65,x; compares A with $15;
; branches on carry set to Sub_8764_OnCarrySet_D63B; compares A with
; $0F; branches on carry set to Sub_8764_OnCarrySet_D68E; compares A
; with $0D; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D62C:
lda Zp65,x ; CPU:$D62C PRG:162C B5 65
cmp #$15 ; CPU:$D62E PRG:162E C9 15
bcs Sub_8764_OnCarrySet_D63B ; CPU:$D630 PRG:1630 B0 09
cmp #$0F ; CPU:$D632 PRG:1632 C9 0F
bcs Sub_8764_OnCarrySet_D68E ; CPU:$D634 PRG:1634 B0 58
cmp #$0D ; CPU:$D636 PRG:1636 C9 0D
bcs Sub_8764_OnCarrySet_D644 ; CPU:$D638 PRG:1638 B0 0A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D63A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D63A:
rts ; CPU:$D63A PRG:163A 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D63B
; Global: The routine calls ReadEnemyPosition.
; Local: Executes 3 instructions: compares A with $59; branches on carry set
; to Sub_8764_OnCarrySet_D642; calls ReadEnemyPosition.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D63B:
cmp #$59 ; CPU:$D63B PRG:163B C9 59
bcs Sub_8764_OnCarrySet_D642 ; CPU:$D63D PRG:163D B0 03
jmp ReadEnemyPosition ; CPU:$D63F PRG:163F 4C 0A D5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D642
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: clears the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D642:
clc ; CPU:$D642 PRG:1642 18
rts ; CPU:$D643 PRG:1643 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D644
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from ZpBB; branches on non-negative
; to Sub_8764_OnNonnegative_D66F; decrements ZpBC; loads A from ZpBC;
; ANDs A with $03; branches on not equal to
; Sub_8764_JoinBranchPaths_D675.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D644:
lda ZpBB ; CPU:$D644 PRG:1644 A5 BB
bpl Sub_8764_OnNonnegative_D66F; CPU:$D646 PRG:1646 10 27
dec ZpBC ; CPU:$D648 PRG:1648 C6 BC
lda ZpBC ; CPU:$D64A PRG:164A A5 BC
and #$03 ; CPU:$D64C PRG:164C 29 03
bne Sub_8764_JoinBranchPaths_D675 ; CPU:$D64E PRG:164E D0 25
; -----------------------------------------------------------------------------
; Routine: MoveRadarBlip
; Global: The routine calls AddObjectYPositionDelta and AddObjectXPosition.
; Local: Executes 8 instructions: decrements ZpBA; branches on equal to
; Sub_8764_OnZero_D664; loads Y with $0D; loads X from ZpBA; loads A
; from $D682,x; calls AddObjectYPositionDelta; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
MoveRadarBlip:
dec ZpBA ; CPU:$D650 PRG:1650 C6 BA
beq Sub_8764_OnZero_D664 ; CPU:$D652 PRG:1652 F0 10
ldy #$0D ; CPU:$D654 PRG:1654 A0 0D
ldx ZpBA ; CPU:$D656 PRG:1656 A6 BA
lda $D682,x ; CPU:$D658 PRG:1658 BD 82 D6
jsr AddObjectYPositionDelta ; CPU:$D65B PRG:165B 20 F9 C4
lda $D676,x ; CPU:$D65E PRG:165E BD 76 D6
jmp AddObjectXPosition ; CPU:$D661 PRG:1661 4C CB D1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D664
; Global: The routine calls SubCD6EF, writes $036B and $036C.
; Local: Executes 4 instructions: loads A with $FF; stores A to $036B; stores
; A to $036C; calls SubCD6EF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $036B and $036C changed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D664:
lda #$FF ; CPU:$D664 PRG:1664 A9 FF
sta $036B ; CPU:$D666 PRG:1666 8D 6B 03
sta $036C ; CPU:$D669 PRG:1669 8D 6C 03
jmp SubCD6EF_Loop ; CPU:$D66C PRG:166C 4C EF D6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D66F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: decrements ZpBB; branches on not equal to
; Sub_8764_JoinBranchPaths_D675; increments ZpBB.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; no register, the N and Z flags, ZpBB.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D66F:
dec ZpBB ; CPU:$D66F PRG:166F C6 BB
bne Sub_8764_JoinBranchPaths_D675 ; CPU:$D671 PRG:1671 D0 02
inc ZpBB ; CPU:$D673 PRG:1673 E6 BB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D675
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D675:
rts ; CPU:$D675 PRG:1675 60
; ---- data $D676-$D68D (24 bytes) ----
; referenced by `lda $D682,x` at $D658 (operand $D682 falls inside this region)
; referenced by `lda $D676,x` at $D65E (operand $D676 falls inside this region)
RadarBlipOffsetTable:
.byte $18, $18, $18, $28, $10, $10, $20, $30, $18, $28, $10, $20 ; CPU:$D676 PRG:1676 18 18 18 28 10 10 20 30 18 28 10 20
RadarBlipOffsetTable2:
.byte $0E, $0E, $0E, $0A ; CPU:$D682 PRG:1682 0E 0E 0E 0A
.byte $08, $06, $06, $08, $06, $06, $06, $0E ; CPU:$D686 PRG:1686 08 06 06 08 06 06 06 0E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D68E
; Global: The routine calls DestroyEnemy, writes $0287, $0365, $02F6, $03D4 and 3
; more, reads $0262.
; Local: Executes 27 instructions: returns with RTS; copies A into X;
; decrements $0698,x; branches on non-negative to
; Sub_8764_JoinBranchPaths_D675; loads A from $0280,x; clears the
; carry flag; and 21 more instructions.
; Parameters: Reads $0262 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves $0287, $0365 and $02F6 changed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D68E:
tax ; CPU:$D68E PRG:168E AA
dec $0698,x ; CPU:$D68F PRG:168F DE 98 06
bpl Sub_8764_JoinBranchPaths_D675 ; CPU:$D692 PRG:1692 10 E1
lda $0280,x ; CPU:$D694 PRG:1694 BD 80 02
clc ; CPU:$D697 PRG:1697 18
adc #$08 ; CPU:$D698 PRG:1698 69 08
sta $0287 ; CPU:$D69A PRG:169A 8D 87 02
lda $035E,x ; CPU:$D69D PRG:169D BD 5E 03
adc #$00 ; CPU:$D6A0 PRG:16A0 69 00
sta $0365 ; CPU:$D6A2 PRG:16A2 8D 65 03
lda $02EF,x ; CPU:$D6A5 PRG:16A5 BD EF 02
clc ; CPU:$D6A8 PRG:16A8 18
adc #$08 ; CPU:$D6A9 PRG:16A9 69 08
sta $02F6 ; CPU:$D6AB PRG:16AB 8D F6 02
lda $03CD,x ; CPU:$D6AE PRG:16AE BD CD 03
adc #$00 ; CPU:$D6B1 PRG:16B1 69 00
sta $03D4 ; CPU:$D6B3 PRG:16B3 8D D4 03
jsr DestroyEnemy ; CPU:$D6B6 PRG:16B6 20 DB DD
lda #$7C ; CPU:$D6B9 PRG:16B9 A9 7C
sta $0443 ; CPU:$D6BB PRG:16BB 8D 43 04
lda #$04 ; CPU:$D6BE PRG:16BE A9 04
sta $0521 ; CPU:$D6C0 PRG:16C0 8D 21 05
lda #$32 ; CPU:$D6C3 PRG:16C3 A9 32
sta $04B2 ; CPU:$D6C5 PRG:16C5 8D B2 04
dec $0262 ; CPU:$D6C8 PRG:16C8 CE 62 02
ldy #$0C ; CPU:$D6CB PRG:16CB A0 0C
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D6CD
; Global: The routine calls StartGameUpdate and InitRadarBlipOrigin.
; Local: Executes 16 instructions: loads A from $0240,y; compares A with $23;
; branches on not equal to SubCD6EF; increments Y; compares Y with
; $0F; branches on not equal to Sub_8764_OnNonzero_D6CD; and 10 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D6CD:
lda $0240,y ; CPU:$D6CD PRG:16CD B9 40 02
cmp #$23 ; CPU:$D6D0 PRG:16D0 C9 23
bne SubCD6EF_Loop ; CPU:$D6D2 PRG:16D2 D0 1B
iny ; CPU:$D6D4 PRG:16D4 C8
cpy #$0F ; CPU:$D6D5 PRG:16D5 C0 0F
bne Sub_8764_OnNonzero_D6CD ; CPU:$D6D7 PRG:16D7 D0 F4
inc ZpDA ; CPU:$D6D9 PRG:16D9 E6 DA
lda ZpDA ; CPU:$D6DB PRG:16DB A5 DA
and #$07 ; CPU:$D6DD PRG:16DD 29 07
tay ; CPU:$D6DF PRG:16DF A8
lda $C026,y ; CPU:$D6E0 PRG:16E0 B9 26 C0
sta ZpDB ; CPU:$D6E3 PRG:16E3 85 DB
jsr StartGameUpdate ; CPU:$D6E5 PRG:16E5 20 24 D2
jsr InitRadarBlipOrigin ; CPU:$D6E8 PRG:16E8 20 F7 D6
lda #$05 ; CPU:$D6EB PRG:16EB A9 05
bne Sub_8764_OnNonzero_D6F1 ; CPU:$D6ED PRG:16ED D0 02
; -----------------------------------------------------------------------------
; Routine: SubCD6EF_Loop
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $01.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
SubCD6EF_Loop:
lda #$01 ; CPU:$D6EF PRG:16EF A9 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D6F1
; Global: The routine calls InitDirectionStateAlt and StartTenFrameTimer.
; Local: Executes 2 instructions: calls InitDirectionStateAlt; calls StartTenFrameTimer.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D6F1:
jsr InitDirectionStateAlt ; CPU:$D6F1 PRG:16F1 20 20 CE
jsr StartTenFrameTimer ; CPU:$D6F4 PRG:16F4 20 15 C5
; -----------------------------------------------------------------------------
; Routine: InitRadarBlipOrigin
; Global: The routine calls SubCE5F1.
; Local: Executes 3 instructions: loads A with $05; loads Y with $2A; calls
; SubCE5F1.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp55, ZpD6, the OAM shadow.
;
; -----------------------------------------------------------------------------
InitRadarBlipOrigin:
lda #$05 ; CPU:$D6F7 PRG:16F7 A9 05
ldy #$2A ; CPU:$D6F9 PRG:16F9 A0 2A
jmp SubCE5F1_OnNonzero ; CPU:$D6FB PRG:16FB 4C F1 E5
; -----------------------------------------------------------------------------
; Routine: SetRadarBlipOrigin
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp85,y; stores A to Zp25; loads
; A from Zp95,y; stores A to Zp27; loads A with $00; stores A to
; Zp03; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SetRadarBlipOrigin:
lda a:Zp85,y ; CPU:$D6FE PRG:16FE B9 85 00
sta Zp25 ; CPU:$D701 PRG:1701 85 25
lda a:Zp95,y ; CPU:$D703 PRG:1703 B9 95 00
sta Zp27 ; CPU:$D706 PRG:1706 85 27
lda #$00 ; CPU:$D708 PRG:1708 A9 00
sta Zp03 ; CPU:$D70A PRG:170A 85 03
beq SubCD71A_Loop ; CPU:$D70C PRG:170C F0 0C
; -----------------------------------------------------------------------------
; Routine: SetPlayerOrigin
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from Zp1F; stores A to Zp25; loads A
; from Zp20; stores A to Zp27; loads A with $00; stores A to Zp03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SetPlayerOrigin:
lda Zp1F ; CPU:$D70E PRG:170E A5 1F
sta Zp25 ; CPU:$D710 PRG:1710 85 25
lda Zp20 ; CPU:$D712 PRG:1712 A5 20
sta Zp27 ; CPU:$D714 PRG:1714 85 27
lda #$00 ; CPU:$D716 PRG:1716 A9 00
sta Zp03 ; CPU:$D718 PRG:1718 85 03
; -----------------------------------------------------------------------------
; Routine: SubCD71A_Loop
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads X with $07; branches on not equal to
; Sub_8764_JoinBranchPaths_D724.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp03, Zp04, Zp05, Zp29, Zp2A.
;
; -----------------------------------------------------------------------------
SubCD71A_Loop:
ldx #$07 ; CPU:$D71A PRG:171A A2 07
bne Sub_8764_JoinBranchPaths_D724 ; CPU:$D71C PRG:171C D0 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D71E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: decrements X; compares X with $03; branches
; on carry set to Sub_8764_JoinBranchPaths_D724; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp03, Zp04, Zp05, Zp29, Zp2A.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D71E:
dex ; CPU:$D71E PRG:171E CA
cpx #$03 ; CPU:$D71F PRG:171F E0 03
bcs Sub_8764_JoinBranchPaths_D724 ; CPU:$D721 PRG:1721 B0 01
rts ; CPU:$D723 PRG:1723 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D724
; Global: The routine calls MovePlayerDown.
; Local: Executes 15 instructions: decrements X; compares X with $03; branches
; on carry set to Sub_8764_JoinBranchPaths_D724; returns with RTS;
; loads A from Zp65,x; branches on negative to
; Sub_8764_JoinBranchPaths_D71E; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp03, Zp04, Zp05, Zp29, Zp2A.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D724:
lda Zp65,x ; CPU:$D724 PRG:1724 B5 65
bmi Sub_8764_JoinBranchPaths_D71E ; CPU:$D726 PRG:1726 30 F6
beq Sub_8764_JoinBranchPaths_D71E ; CPU:$D728 PRG:1728 F0 F4
cmp #$04 ; CPU:$D72A PRG:172A C9 04
bcc Sub_8764_OnCarryClear_D740 ; CPU:$D72C PRG:172C 90 12
lda Zp34 ; CPU:$D72E PRG:172E A5 34
and $E6CD,x ; CPU:$D730 PRG:1730 3D CD E6
beq Sub_8764_OnZero_D73B ; CPU:$D733 PRG:1733 F0 06
jsr MovePlayerDown ; CPU:$D735 PRG:1735 20 84 D7
bcc Sub_8764_OnCarryClear_D740 ; CPU:$D738 PRG:1738 90 06
rts ; CPU:$D73A PRG:173A 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D73B
; Global: The routine calls MovePlayerDown and MovePlayerUpAlt.
; Local: Executes 17 instructions: decrements X; compares X with $03; branches
; on carry set to Sub_8764_JoinBranchPaths_D724; returns with RTS;
; loads A from Zp65,x; branches on negative to
; Sub_8764_JoinBranchPaths_D71E; and 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp03, Zp04, Zp05, Zp29, Zp2A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D73B:
jsr MovePlayerUpAlt ; CPU:$D73B PRG:173B 20 7A D7
bcs Sub_8764_OnCarrySet_D772 ; CPU:$D73E PRG:173E B0 32
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D740
; Global: The routine calls MovePlayerDown, MovePlayerUpAlt and MovePlayerUp.
; Local: Executes 34 instructions: decrements X; compares X with $03; branches
; on carry set to Sub_8764_JoinBranchPaths_D724; returns with RTS;
; loads A from Zp65,x; branches on negative to
; Sub_8764_JoinBranchPaths_D71E; and 28 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp03, Zp04, Zp05, Zp29, Zp2A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D740:
lda Zp6D,x ; CPU:$D740 PRG:1740 B5 6D
beq Sub_8764_JoinBranchPaths_D71E ; CPU:$D742 PRG:1742 F0 DA
bmi Sub_8764_JoinBranchPaths_D71E ; CPU:$D744 PRG:1744 30 D8
cmp #$04 ; CPU:$D746 PRG:1746 C9 04
bcc Sub_8764_JoinBranchPaths_D71E ; CPU:$D748 PRG:1748 90 D4
lda Zp09 ; CPU:$D74A PRG:174A A5 09
and $E6CD,x ; CPU:$D74C PRG:174C 3D CD E6
beq Sub_8764_JoinBranchPaths_D71E ; CPU:$D74F PRG:174F F0 CD
stx Zp03 ; CPU:$D751 PRG:1751 86 03
lda Zp35 ; CPU:$D753 PRG:1753 A5 35
and $E6CD,x ; CPU:$D755 PRG:1755 3D CD E6
beq Sub_8764_OnZero_D766 ; CPU:$D758 PRG:1758 F0 0C
jsr MovePlayerUp ; CPU:$D75A PRG:175A 20 74 D7
jsr MovePlayerDown ; CPU:$D75D PRG:175D 20 84 D7
bcs Sub_8764_OnCarrySet_D772 ; CPU:$D760 PRG:1760 B0 10
ldx Zp03 ; CPU:$D762 PRG:1762 A6 03
bcc Sub_8764_JoinBranchPaths_D71E ; CPU:$D764 PRG:1764 90 B8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D766
; Global: The routine calls MovePlayerDown, MovePlayerUpAlt and MovePlayerUp.
; Local: Executes 39 instructions: decrements X; compares X with $03; branches
; on carry set to Sub_8764_JoinBranchPaths_D724; returns with RTS;
; loads A from Zp65,x; branches on negative to
; Sub_8764_JoinBranchPaths_D71E; and 33 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp03, Zp04, Zp05, Zp29, Zp2A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D766:
jsr MovePlayerUp ; CPU:$D766 PRG:1766 20 74 D7
jsr MovePlayerUpAlt ; CPU:$D769 PRG:1769 20 7A D7
bcs Sub_8764_OnCarrySet_D772 ; CPU:$D76C PRG:176C B0 04
ldx Zp03 ; CPU:$D76E PRG:176E A6 03
bcc Sub_8764_JoinBranchPaths_D71E ; CPU:$D770 PRG:1770 90 AC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D772
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: sets the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the C flag.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D772:
sec ; CPU:$D772 PRG:1772 38
rts ; CPU:$D773 PRG:1773 60
; -----------------------------------------------------------------------------
; Routine: MovePlayerUp
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: copies X into A; clears the carry flag; adds
; $08 to A; copies A into X; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags.
;
; -----------------------------------------------------------------------------
MovePlayerUp:
txa ; CPU:$D774 PRG:1774 8A
clc ; CPU:$D775 PRG:1775 18
adc #$08 ; CPU:$D776 PRG:1776 69 08
tax ; CPU:$D778 PRG:1778 AA
rts ; CPU:$D779 PRG:1779 60
; -----------------------------------------------------------------------------
; Routine: MovePlayerUpAlt
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A with $F6; stores A to Zp2A; loads A
; with $0A; stores A to Zp29; branches on not equal to
; Sub_8764_OnNonzero_D78C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp04, Zp05, Zp29, Zp2A.
;
; -----------------------------------------------------------------------------
MovePlayerUpAlt:
lda #$F6 ; CPU:$D77A PRG:177A A9 F6
sta Zp2A ; CPU:$D77C PRG:177C 85 2A
lda #$0A ; CPU:$D77E PRG:177E A9 0A
sta Zp29 ; CPU:$D780 PRG:1780 85 29
bne Sub_8764_OnNonzero_D78C ; CPU:$D782 PRG:1782 D0 08
; -----------------------------------------------------------------------------
; Routine: MovePlayerDown
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A with $F0; stores A to Zp2A; loads A
; with $1E; stores A to Zp29.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp04, Zp05, Zp29, Zp2A.
;
; -----------------------------------------------------------------------------
MovePlayerDown:
lda #$F0 ; CPU:$D784 PRG:1784 A9 F0
sta Zp2A ; CPU:$D786 PRG:1786 85 2A
lda #$1E ; CPU:$D788 PRG:1788 A9 1E
sta Zp29 ; CPU:$D78A PRG:178A 85 29
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D78C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: sets the carry flag; loads A from Zp27;
; subtracts Zp95,x from A; compares A with Zp2A; branches on carry
; set to Sub_8764_JoinBranchPaths_D79B; compares A with Zp29; and 3
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, Zp04, Zp05.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D78C:
sec ; CPU:$D78C PRG:178C 38
lda Zp27 ; CPU:$D78D PRG:178D A5 27
sbc Zp95,x ; CPU:$D78F PRG:178F F5 95
cmp Zp2A ; CPU:$D791 PRG:1791 C5 2A
bcs Sub_8764_JoinBranchPaths_D79B ; CPU:$D793 PRG:1793 B0 06
cmp Zp29 ; CPU:$D795 PRG:1795 C5 29
bcc Sub_8764_JoinBranchPaths_D79B ; CPU:$D797 PRG:1797 90 02
clc ; CPU:$D799 PRG:1799 18
rts ; CPU:$D79A PRG:179A 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D79B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: compares X with $08; branches on carry clear
; to Sub_8764_OnCarryClear_D7A3; loads A from Zp37; branches on carry
; set to Sub_8764_OnCarrySet_D7A5.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp04, Zp05.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D79B:
cpx #$08 ; CPU:$D79B PRG:179B E0 08
bcc Sub_8764_OnCarryClear_D7A3 ; CPU:$D79D PRG:179D 90 04
lda Zp37 ; CPU:$D79F PRG:179F A5 37
bcs Sub_8764_OnCarrySet_D7A5 ; CPU:$D7A1 PRG:17A1 B0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D7A3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A from Zp36.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp04, Zp05.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D7A3:
lda Zp36 ; CPU:$D7A3 PRG:17A3 A5 36
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D7A5
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: ANDs A with $E6CD,x; branches on equal to
; Sub_8764_OnZero_D7AE; loads A with $01; branches on not equal to
; Sub_8764_OnNonzero_D7B0.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp04, Zp05.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D7A5:
and $E6CD,x ; CPU:$D7A5 PRG:17A5 3D CD E6
beq Sub_8764_OnZero_D7AE ; CPU:$D7A8 PRG:17A8 F0 04
lda #$01 ; CPU:$D7AA PRG:17AA A9 01
bne Sub_8764_OnNonzero_D7B0 ; CPU:$D7AC PRG:17AC D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D7AE
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp04, Zp05.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D7AE:
lda #$00 ; CPU:$D7AE PRG:17AE A9 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D7B0
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 11 instructions: stores A to Zp04; sets the carry flag;
; loads A from Zp25; subtracts Zp85,x from A; stores A to Zp05; loads
; A from Zp03; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp04, Zp05.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D7B0:
sta Zp04 ; CPU:$D7B0 PRG:17B0 85 04
sec ; CPU:$D7B2 PRG:17B2 38
lda Zp25 ; CPU:$D7B3 PRG:17B3 A5 25
sbc Zp85,x ; CPU:$D7B5 PRG:17B5 F5 85
sta Zp05 ; CPU:$D7B7 PRG:17B7 85 05
lda Zp03 ; CPU:$D7B9 PRG:17B9 A5 03
sbc Zp04 ; CPU:$D7BB PRG:17BB E5 04
beq Sub_8764_OnZero_D7C7 ; CPU:$D7BD PRG:17BD F0 08
lda Zp05 ; CPU:$D7BF PRG:17BF A5 05
cmp Zp2A ; CPU:$D7C1 PRG:17C1 C5 2A
bcs Sub_8764_OnCarrySet_D7CD ; CPU:$D7C3 PRG:17C3 B0 08
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D7C5
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: clears the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D7C5:
clc ; CPU:$D7C5 PRG:17C5 18
rts ; CPU:$D7C6 PRG:17C6 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D7C7
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: clears the carry flag; returns with RTS;
; loads A from Zp05; compares A with Zp29; branches on carry set to
; Sub_8764_OnCarrySet_D7C5.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D7C7:
lda Zp05 ; CPU:$D7C7 PRG:17C7 A5 05
cmp Zp29 ; CPU:$D7C9 PRG:17C9 C5 29
bcs Sub_8764_OnCarrySet_D7C5 ; CPU:$D7CB PRG:17CB B0 F8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D7CD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: sets the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the C flag.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D7CD:
sec ; CPU:$D7CD PRG:17CD 38
rts ; CPU:$D7CE PRG:17CE 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D7CF
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads X with $6E; loads A with $84; stores A
; to Zp40; loads A with $19; stores A to Zp05; loads A with $28; and
; 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D7CF:
ldx #$6E ; CPU:$D7CF PRG:17CF A2 6E
lda #$84 ; CPU:$D7D1 PRG:17D1 A9 84
sta Zp40 ; CPU:$D7D3 PRG:17D3 85 40
lda #$19 ; CPU:$D7D5 PRG:17D5 A9 19
sta Zp05 ; CPU:$D7D7 PRG:17D7 85 05
lda #$28 ; CPU:$D7D9 PRG:17D9 A9 28
sta Zp06 ; CPU:$D7DB PRG:17DB 85 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D7DD
; Global: The routine calls DrawFactoryAndTargetSprites and DrawTargetSpritesAlt.
; Local: Executes 10 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_D7FA; loads A from $04AB,x; branches on
; negative to Sub_8764_OnNegative_D7F7; loads A from $043C,x; copies
; A into Y; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D7DD:
lda $035E,x ; CPU:$D7DD PRG:17DD BD 5E 03
bmi Sub_8764_OnNegative_D7FA ; CPU:$D7E0 PRG:17E0 30 18
lda $04AB,x ; CPU:$D7E2 PRG:17E2 BD AB 04
bmi Sub_8764_OnNegative_D7F7 ; CPU:$D7E5 PRG:17E5 30 10
lda $043C,x ; CPU:$D7E7 PRG:17E7 BD 3C 04
tay ; CPU:$D7EA PRG:17EA A8
lda $DA41,y ; CPU:$D7EB PRG:17EB B9 41 DA
jsr DrawFactoryAndTargetSprites; CPU:$D7EE PRG:17EE 20 D7 ED
lda $DA4D,y ; CPU:$D7F1 PRG:17F1 B9 4D DA
jsr DrawTargetSpritesAlt ; CPU:$D7F4 PRG:17F4 20 E2 ED
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D7F7
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and CheckEnemySpawnArea.
; Local: Executes 11 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_D7FA; loads A from $04AB,x; branches on
; negative to Sub_8764_OnNegative_D7F7; loads A from $043C,x; copies
; A into Y; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D7F7:
jsr CheckEnemySpawnArea ; CPU:$D7F7 PRG:17F7 20 81 DC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D7FA
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and CheckEnemySpawnArea.
; Local: Executes 15 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_D7FA; loads A from $04AB,x; branches on
; negative to Sub_8764_OnNegative_D7F7; loads A from $043C,x; copies
; A into Y; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D7FA:
dex ; CPU:$D7FA PRG:17FA CA
cpx #$59 ; CPU:$D7FB PRG:17FB E0 59
bcs Sub_8764_OnCarrySet_D7DD ; CPU:$D7FD PRG:17FD B0 DE
rts ; CPU:$D7FF PRG:17FF 60
; -----------------------------------------------------------------------------
; Routine: DrawRadarRow
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, CheckEnemySpawnArea and SubCC043.
; Local: Executes 27 instructions: loads X with $6E; loads A with $84; stores
; A to Zp40; loads A with $19; stores A to Zp05; loads A with $28;
; and 21 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
DrawRadarRow:
lda Zp11 ; CPU:$D800 PRG:1800 A5 11
cmp #$05 ; CPU:$D802 PRG:1802 C9 05
bcs Sub_8764_OnCarrySet_D80B ; CPU:$D804 PRG:1804 B0 05
ldy #$09 ; CPU:$D806 PRG:1806 A0 09
jsr SubCC043_OnNonzero ; CPU:$D808 PRG:1808 20 43 C0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D80B
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, CheckEnemySpawnArea and DrawFactoryTarget.
; Local: Executes 27 instructions: loads X with $6E; loads A with $84; stores
; A to Zp40; loads A with $19; stores A to Zp05; loads A with $28;
; and 21 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D80B:
jsr DrawFactoryTarget ; CPU:$D80B PRG:180B 20 B7 E4
dec ZpA5 ; CPU:$D80E PRG:180E C6 A5
bne Sub_8764_OnNonzero_D816 ; CPU:$D810 PRG:1810 D0 04
lda #$08 ; CPU:$D812 PRG:1812 A9 08
sta ZpA5 ; CPU:$D814 PRG:1814 85 A5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D816
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and CheckEnemySpawnArea.
; Local: Executes 31 instructions: loads X with $6E; loads A with $84; stores
; A to Zp40; loads A with $19; stores A to Zp05; loads A with $28;
; and 25 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D816:
lda ZpA5 ; CPU:$D816 PRG:1816 A5 A5
cmp #$05 ; CPU:$D818 PRG:1818 C9 05
beq Sub_8764_OnZero_D7CF ; CPU:$D81A PRG:181A F0 B3
cmp #$02 ; CPU:$D81C PRG:181C C9 02
beq Sub_8764_OnZero_D829 ; CPU:$D81E PRG:181E F0 09
cmp #$07 ; CPU:$D820 PRG:1820 C9 07
beq Sub_8764_OnZero_D83E ; CPU:$D822 PRG:1822 F0 1A
cmp #$06 ; CPU:$D824 PRG:1824 C9 06
beq Sub_8764_OnZero_D82F ; CPU:$D826 PRG:1826 F0 07
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D828
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D828:
rts ; CPU:$D828 PRG:1828 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D829
; Global: The routine calls InitPlayerState and ScanEnemySlots.
; Local: Executes 2 instructions: calls InitPlayerState; calls ScanEnemySlots.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D829:
jsr InitPlayerState ; CPU:$D829 PRG:1829 20 43 DA
jmp ScanEnemySlots ; CPU:$D82C PRG:182C 4C F2 D9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D82F
; Global: The routine calls DrawFactorySprite.
; Local: Executes 4 instructions: calls DrawFactorySprite; loads A from Zp0F; branches
; on equal to Sub_8764_OnZero_D838; decrements Zp0F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D82F:
jsr DrawFactorySprite ; CPU:$D82F PRG:182F 20 A8 DB
lda Zp0F ; CPU:$D832 PRG:1832 A5 0F
beq Sub_8764_OnZero_D838 ; CPU:$D834 PRG:1834 F0 02
dec Zp0F ; CPU:$D836 PRG:1836 C6 0F
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D838
; Global: The routine calls InitLastEnemies and UpdateBlipSprite.
; Local: Executes 2 instructions: calls InitLastEnemies; calls UpdateBlipSprite.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D838:
jsr InitLastEnemies ; CPU:$D838 PRG:1838 20 E7 D9
jmp UpdateBlipSprite ; CPU:$D83B PRG:183B 4C DA D8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D83E
; Global: The routine writes $0366.
; Local: Executes 9 instructions: returns with RTS; decrements Zp12; loads A
; from Zp12; ANDs A with $3F; branches on not equal to
; Sub_8764_OnNonzero_D828; loads A with $FF; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves $0366 changed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D83E:
dec Zp12 ; CPU:$D83E PRG:183E C6 12
lda Zp12 ; CPU:$D840 PRG:1840 A5 12
and #$3F ; CPU:$D842 PRG:1842 29 3F
bne Sub_8764_OnNonzero_D828 ; CPU:$D844 PRG:1844 D0 E2
lda #$FF ; CPU:$D846 PRG:1846 A9 FF
sta $0366 ; CPU:$D848 PRG:1848 8D 66 03
ldx #$14 ; CPU:$D84B PRG:184B A2 14
ldy #$00 ; CPU:$D84D PRG:184D A0 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D84F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_D855; increments Y.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D84F:
lda $035E,x ; CPU:$D84F PRG:184F BD 5E 03
bmi Sub_8764_OnNegative_D855 ; CPU:$D852 PRG:1852 30 01
iny ; CPU:$D854 PRG:1854 C8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D855
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 18 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_D855; increments Y; decrements X; compares X
; with $0F; branches on carry set to Sub_8764_OnCarrySet_D84F; and 12
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D855:
dex ; CPU:$D855 PRG:1855 CA
cpx #$0F ; CPU:$D856 PRG:1856 E0 0F
bcs Sub_8764_OnCarrySet_D84F ; CPU:$D858 PRG:1858 B0 F5
tya ; CPU:$D85A PRG:185A 98
beq Sub_8764_OnZero_D873 ; CPU:$D85B PRG:185B F0 16
lda ZpD4 ; CPU:$D85D PRG:185D A5 D4
beq Sub_8764_JoinBranchPaths_D871 ; CPU:$D85F PRG:185F F0 10
lda ZpD3 ; CPU:$D861 PRG:1861 A5 D3
cmp #$03 ; CPU:$D863 PRG:1863 C9 03
bcs Sub_8764_JoinBranchPaths_D871 ; CPU:$D865 PRG:1865 B0 0A
lda ZpBB ; CPU:$D867 PRG:1867 A5 BB
beq Sub_8764_JoinBranchPaths_D871 ; CPU:$D869 PRG:1869 F0 06
bmi Sub_8764_JoinBranchPaths_D871 ; CPU:$D86B PRG:186B 30 04
lda ZpC9 ; CPU:$D86D PRG:186D A5 C9
beq Sub_8764_OnZero_D873 ; CPU:$D86F PRG:186F F0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D871
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads Y with $01.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D871:
ldy #$01 ; CPU:$D871 PRG:1871 A0 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D873
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from $D8C5,y; stores A to ZpBE;
; loads A from $D8D3,y; stores A to ZpBF; loads A from $D8CC,y;
; stores A to ZpC0; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D873:
lda $D8C5,y ; CPU:$D873 PRG:1873 B9 C5 D8
sta ZpBE ; CPU:$D876 PRG:1876 85 BE
lda $D8D3,y ; CPU:$D878 PRG:1878 B9 D3 D8
sta ZpBF ; CPU:$D87B PRG:187B 85 BF
lda $D8CC,y ; CPU:$D87D PRG:187D B9 CC D8
sta ZpC0 ; CPU:$D880 PRG:1880 85 C0
sty ZpBD ; CPU:$D882 PRG:1882 84 BD
ldx #$05 ; CPU:$D884 PRG:1884 A2 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D886
; Global: The routine calls FindFreeTargetSlot.
; Local: Executes 10 instructions: loads A from $036D,x; branches on negative
; to Sub_8764_JoinBranchPaths_D8A1; increments $06A7,x; loads A from
; $06A7,x; compares A with $D8B7,y; branches on carry clear to
; Sub_8764_JoinBranchPaths_D8A1; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D886:
lda $036D,x ; CPU:$D886 PRG:1886 BD 6D 03
bmi Sub_8764_JoinBranchPaths_D8A1 ; CPU:$D889 PRG:1889 30 16
inc $06A7,x ; CPU:$D88B PRG:188B FE A7 06
lda $06A7,x ; CPU:$D88E PRG:188E BD A7 06
cmp $D8B7,y ; CPU:$D891 PRG:1891 D9 B7 D8
bcc Sub_8764_JoinBranchPaths_D8A1 ; CPU:$D894 PRG:1894 90 0B
jsr FindFreeTargetSlot ; CPU:$D896 PRG:1896 20 D5 C9
ldy ZpBD ; CPU:$D899 PRG:1899 A4 BD
lda $D8BE,y ; CPU:$D89B PRG:189B B9 BE D8
sta $06A7,x ; CPU:$D89E PRG:189E 9D A7 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D8A1
; Global: The routine calls FindFreeTargetSlot and UpdateRadarSweep.
; Local: Executes 13 instructions: loads A from $036D,x; branches on negative
; to Sub_8764_JoinBranchPaths_D8A1; increments $06A7,x; loads A from
; $06A7,x; compares A with $D8B7,y; branches on carry clear to
; Sub_8764_JoinBranchPaths_D8A1; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D8A1:
dex ; CPU:$D8A1 PRG:18A1 CA
bpl Sub_8764_OnNonnegative_D886; CPU:$D8A2 PRG:18A2 10 E2
jmp UpdateRadarSweep ; CPU:$D8A4 PRG:18A4 4C 42 D9
; -----------------------------------------------------------------------------
; Routine: CheckSpawnState
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from ZpC9; branches on not equal to
; Sub_8764_OnNonzero_D8B3; loads A from ZpD4; branches on equal to
; Sub_8764_OnZero_D8B4; loads A from ZpD3; compares A with $01.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
CheckSpawnState:
lda ZpC9 ; CPU:$D8A7 PRG:18A7 A5 C9
bne Sub_8764_OnNonzero_D8B3 ; CPU:$D8A9 PRG:18A9 D0 08
lda ZpD4 ; CPU:$D8AB PRG:18AB A5 D4
beq Sub_8764_OnZero_D8B4 ; CPU:$D8AD PRG:18AD F0 05
lda ZpD3 ; CPU:$D8AF PRG:18AF A5 D3
cmp #$01 ; CPU:$D8B1 PRG:18B1 C9 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D8B3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D8B3:
rts ; CPU:$D8B3 PRG:18B3 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D8B4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $01; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D8B4:
lda #$01 ; CPU:$D8B4 PRG:18B4 A9 01
rts ; CPU:$D8B6 PRG:18B6 60
; ---- data $D8B7-$D8D9 (35 bytes) ----
; referenced by `lda $D8C5,y` at $D873 (operand $D8C5 falls inside this region)
; referenced by `lda $D8D3,y` at $D878 (operand $D8D3 falls inside this region)
; referenced by `lda $D8CC,y` at $D87D (operand $D8CC falls inside this region)
; referenced by `cmp $D8B7,y` at $D891 (operand $D8B7 falls inside this region)
; referenced by `lda $D8BE,y` at $D89B (operand $D8BE falls inside this region)
EnemySpriteOffsetTable:
.byte $00, $16, $16, $16, $16, $16, $14 ; CPU:$D8B7 PRG:18B7 00 16 16 16 16 16 14
EnemySpriteOffsetTable2:
.byte $00, $14, $12, $10, $0E, $0C, $0A ; CPU:$D8BE PRG:18BE 00 14 12 10 0E 0C 0A
EnemySpriteOffsetTable3:
.byte $59, $59 ; CPU:$D8C5 PRG:18C5 59 59
.byte $59, $67, $67, $69, $6E ; CPU:$D8C7 PRG:18C7 59 67 67 69 6E
EnemySpriteOffsetTable4:
.byte $01, $01, $01, $03, $03, $07, $07 ; CPU:$D8CC PRG:18CC 01 01 01 03 03 07 07
EnemySpriteOffsetTable5:
.byte $FF, $FF, $FF, $FF ; CPU:$D8D3 PRG:18D3 FF FF FF FF
.byte $14, $0B, $06 ; CPU:$D8D7 PRG:18D7 14 0B 06
; -----------------------------------------------------------------------------
; Routine: UpdateBlipSprite
; Global: The routine reads $036A.
; Local: Executes 4 instructions: loads A from $036A; branches on non-negative
; to Sub_8764_OnNonnegative_D8E3; loads A with $00; branches on equal
; to Sub_8764_OnZero_D914.
; Parameters: Reads $036A from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
UpdateBlipSprite:
lda $036A ; CPU:$D8DA PRG:18DA AD 6A 03
bpl Sub_8764_OnNonnegative_D8E3; CPU:$D8DD PRG:18DD 10 04
lda #$00 ; CPU:$D8DF PRG:18DF A9 00
beq Sub_8764_OnZero_D914 ; CPU:$D8E1 PRG:18E1 F0 31
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_D8E3
; Global: The routine calls DrawBlipSprite.
; Local: Executes 7 instructions: calls DrawBlipSprite; clears the carry flag; loads
; A from Zp27; adds $08 to A; stores A to Zp27; branches on carry
; clear to Sub_8764_OnCarryClear_D8F1; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_D8E3:
jsr DrawBlipSprite ; CPU:$D8E3 PRG:18E3 20 66 EE
clc ; CPU:$D8E6 PRG:18E6 18
lda Zp27 ; CPU:$D8E7 PRG:18E7 A5 27
adc #$08 ; CPU:$D8E9 PRG:18E9 69 08
sta Zp27 ; CPU:$D8EB PRG:18EB 85 27
bcc Sub_8764_OnCarryClear_D8F1 ; CPU:$D8ED PRG:18ED 90 02
inc Zp28 ; CPU:$D8EF PRG:18EF E6 28
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_D8F1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: sets the carry flag; loads A from Zp25;
; subtracts $01 from A; stores A to Zp25; branches on carry set to
; Sub_8764_OnCarrySet_D8FC; decrements Zp26.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_D8F1:
sec ; CPU:$D8F1 PRG:18F1 38
lda Zp25 ; CPU:$D8F2 PRG:18F2 A5 25
sbc #$01 ; CPU:$D8F4 PRG:18F4 E9 01
sta Zp25 ; CPU:$D8F6 PRG:18F6 85 25
bcs Sub_8764_OnCarrySet_D8FC ; CPU:$D8F8 PRG:18F8 B0 02
dec Zp26 ; CPU:$D8FA PRG:18FA C6 26
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D8FC
; Global: The routine calls ComputeObjectOffset.
; Local: Executes 6 instructions: loads X with $0C; calls ComputeObjectOffset; increments
; Zp03; loads A from Zp26; branches on not equal to
; Sub_8764_OnNonzero_D909; decrements Zp03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D8FC:
ldx #$0C ; CPU:$D8FC PRG:18FC A2 0C
jsr ComputeObjectOffset ; CPU:$D8FE PRG:18FE 20 65 E6
inc Zp03 ; CPU:$D901 PRG:1901 E6 03
lda Zp26 ; CPU:$D903 PRG:1903 A5 26
bne Sub_8764_OnNonzero_D909 ; CPU:$D905 PRG:1905 D0 02
dec Zp03 ; CPU:$D907 PRG:1907 C6 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D909
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp28; branches on not equal to
; Sub_8764_OnNonzero_D90F; increments Zp03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, Zp03, the OAM shadow, $06C0, $06D5.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D909:
lda Zp28 ; CPU:$D909 PRG:1909 A5 28
bne Sub_8764_OnNonzero_D90F ; CPU:$D90B PRG:190B D0 02
inc Zp03 ; CPU:$D90D PRG:190D E6 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D90F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads X from Zp03; loads A from $D933,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N and Z flags, the OAM shadow, $06C0, $06D5.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D90F:
ldx Zp03 ; CPU:$D90F PRG:190F A6 03
lda $D933,x ; CPU:$D911 PRG:1911 BD 33 D9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D914
; Global: The routine writes $0240, $06C0 and $06D5, reads $036A, $028C, $02FB
; and $03D9.
; Local: Executes 11 instructions: stores A to $0240; loads A from $036A;
; branches on negative to Sub_8764_OnNegative_D932; loads A from
; $028C; ANDs A with $F0; ORs A with $036A; and 5 more instructions.
; Parameters: Reads $036A, $028C, $02FB and $03D9 from the zero page and RAM;
; the values it acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $0240, $06C0 and $06D5
; changed.
; Clobbers:
; A, the N and Z flags, the OAM shadow, $06C0, $06D5.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D914:
sta $0240 ; CPU:$D914 PRG:1914 8D 40 02
lda $036A ; CPU:$D917 PRG:1917 AD 6A 03
bmi Sub_8764_OnNegative_D932 ; CPU:$D91A PRG:191A 30 16
lda $028C ; CPU:$D91C PRG:191C AD 8C 02
and #$F0 ; CPU:$D91F PRG:191F 29 F0
ora $036A ; CPU:$D921 PRG:1921 0D 6A 03
sta $06C0 ; CPU:$D924 PRG:1924 8D C0 06
lda $02FB ; CPU:$D927 PRG:1927 AD FB 02
and #$F8 ; CPU:$D92A PRG:192A 29 F8
ora $03D9 ; CPU:$D92C PRG:192C 0D D9 03
sta $06D5 ; CPU:$D92F PRG:192F 8D D5 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_D932
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_D932:
rts ; CPU:$D932 PRG:1932 60
; ---- data $D933-$D941 (15 bytes) ----
; referenced by `lda $D933,x` at $D911 (operand $D933 falls inside this region)
TargetTileTable:
.byte $D2, $D7, $D3, $D3, $C2, $C7, $D3, $D2, $D2, $D6, $C3, $C3, $C2, $C6, $C3 ; CPU:$D933 PRG:1933 D2 D7 D3 D3 C2 C7 D3 D2 D2 D6 C3 C3 C2 C6 C3
; -----------------------------------------------------------------------------
; Routine: UpdateRadarSweep
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A from Zp39; branches on equal to
; Sub_8764_OnZero_D949; decrements Zp39; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
UpdateRadarSweep:
lda Zp39 ; CPU:$D942 PRG:1942 A5 39
beq Sub_8764_OnZero_D949 ; CPU:$D944 PRG:1944 F0 03
dec Zp39 ; CPU:$D946 PRG:1946 C6 39
rts ; CPU:$D948 PRG:1948 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D949
; Global: The routine calls UpdatePseudoRandomNumber, reads $036A.
; Local: Executes 15 instructions: loads A from ZpBD; EORs A with $07; shifts
; a left; shifts a left; shifts a left; clears the carry flag; and 9
; more instructions.
; Parameters: Reads $036A from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D949:
lda ZpBD ; CPU:$D949 PRG:1949 A5 BD
eor #$07 ; CPU:$D94B PRG:194B 49 07
asl a ; CPU:$D94D PRG:194D 0A
asl a ; CPU:$D94E PRG:194E 0A
asl a ; CPU:$D94F PRG:194F 0A
clc ; CPU:$D950 PRG:1950 18
adc #$20 ; CPU:$D951 PRG:1951 69 20
sta Zp54 ; CPU:$D953 PRG:1953 85 54
jsr UpdatePseudoRandomNumber ; CPU:$D955 PRG:1955 20 12 C4
cmp Zp54 ; CPU:$D958 PRG:1958 C5 54
bcs Sub_8764_JoinBranchPaths_D992 ; CPU:$D95A PRG:195A B0 36
lda $036A ; CPU:$D95C PRG:195C AD 6A 03
bmi Sub_8764_JoinBranchPaths_D992 ; CPU:$D95F PRG:195F 30 31
ldy #$02 ; CPU:$D961 PRG:1961 A0 02
ldx #$6E ; CPU:$D963 PRG:1963 A2 6E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D965
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_D979; loads A from $04AB,x; ANDs A with
; $01; branches on not equal to Sub_8764_JoinBranchPaths_D979; loads
; A with $13; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp39, ZpD9, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D965:
lda $035E,x ; CPU:$D965 PRG:1965 BD 5E 03
bmi Sub_8764_JoinBranchPaths_D979 ; CPU:$D968 PRG:1968 30 0F
lda $04AB,x ; CPU:$D96A PRG:196A BD AB 04
and #$01 ; CPU:$D96D PRG:196D 29 01
bne Sub_8764_JoinBranchPaths_D979 ; CPU:$D96F PRG:196F D0 08
lda #$13 ; CPU:$D971 PRG:1971 A9 13
sta $051A,x ; CPU:$D973 PRG:1973 9D 1A 05
dey ; CPU:$D976 PRG:1976 88
beq Sub_8764_OnZero_D97E ; CPU:$D977 PRG:1977 F0 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D979
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 12 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_D979; loads A from $04AB,x; ANDs A with
; $01; branches on not equal to Sub_8764_JoinBranchPaths_D979; loads
; A with $13; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp39, ZpD9, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D979:
dex ; CPU:$D979 PRG:1979 CA
cpx #$59 ; CPU:$D97A PRG:197A E0 59
bcs Sub_8764_OnCarrySet_D965 ; CPU:$D97C PRG:197C B0 E7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D97E
; Global: The routine calls CheckSpawnState.
; Local: Executes 4 instructions: calls CheckSpawnState; branches on equal to
; Sub_8764_OnZero_D987; loads A with $28; branches on not equal to
; Sub_8764_OnNonzero_D989.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp39, ZpD9.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D97E:
jsr CheckSpawnState ; CPU:$D97E PRG:197E 20 A7 D8
beq Sub_8764_OnZero_D987 ; CPU:$D981 PRG:1981 F0 04
lda #$28 ; CPU:$D983 PRG:1983 A9 28
bne Sub_8764_OnNonzero_D989 ; CPU:$D985 PRG:1985 D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D987
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $46.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp39, ZpD9.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D987:
lda #$46 ; CPU:$D987 PRG:1987 A9 46
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D989
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: stores A to ZpD9; clears the carry flag;
; loads A from ZpBD; adds $02 to A; stores A to Zp39.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp39, ZpD9.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D989:
sta ZpD9 ; CPU:$D989 PRG:1989 85 D9
clc ; CPU:$D98B PRG:198B 18
lda ZpBD ; CPU:$D98C PRG:198C A5 BD
adc #$02 ; CPU:$D98E PRG:198E 69 02
sta Zp39 ; CPU:$D990 PRG:1990 85 39
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D992
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D992:
rts ; CPU:$D992 PRG:1992 60
; -----------------------------------------------------------------------------
; Routine: CheckTargetType
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from ZpA5; compares A with $07;
; branches on not equal to Sub_8764_OnNonzero_D9A3; loads A from
; $043C,x; compares A with $7B; branches on equal to
; Sub_8764_OnZero_D9A5; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, Zp03, $043C, $051A, $06BF, $06D4.
;
; -----------------------------------------------------------------------------
CheckTargetType:
lda ZpA5 ; CPU:$D993 PRG:1993 A5 A5
cmp #$07 ; CPU:$D995 PRG:1995 C9 07
bne Sub_8764_OnNonzero_D9A3 ; CPU:$D997 PRG:1997 D0 0A
lda $043C,x ; CPU:$D999 PRG:1999 BD 3C 04
cmp #$7B ; CPU:$D99C PRG:199C C9 7B
beq Sub_8764_OnZero_D9A5 ; CPU:$D99E PRG:199E F0 05
inc $043C,x ; CPU:$D9A0 PRG:19A0 FE 3C 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D9A3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: branches on not equal to
; Sub_8764_OnNonzero_D9AF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D9A3:
bne Sub_8764_OnNonzero_D9AF ; CPU:$D9A3 PRG:19A3 D0 0A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D9A5
; Global: The routine calls PackObjectState.
; Local: Executes 4 instructions: loads A with $74; stores A to $043C,x; loads
; A with $03; calls PackObjectState.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D9A5:
lda #$74 ; CPU:$D9A5 PRG:19A5 A9 74
sta $043C,x ; CPU:$D9A7 PRG:19A7 9D 3C 04
lda #$03 ; CPU:$D9AA PRG:19AA A9 03
jsr PackObjectState ; CPU:$D9AC PRG:19AC 20 B2 D9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_D9AF
; Global: The routine calls SubCE320.
; Local: Executes 1 instruction: calls SubCE320.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_D9AF:
jmp SubCE320_Loop ; CPU:$D9AF PRG:19AF 4C 20 E3
; -----------------------------------------------------------------------------
; Routine: PackObjectState
; Global: The routine writes $06BF and $06D4.
; Local: Executes 10 instructions: stores A to Zp03; loads A from $0280,x;
; ANDs A with $F0; ORs A with $035E,x; stores A to $06BF; loads A
; from $02EF,x; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $06BF and $06D4 changed.
; Clobbers:
; A and X, the N, Z and C flags, Zp03, $051A, $06BF, $06D4.
;
; -----------------------------------------------------------------------------
PackObjectState:
sta Zp03 ; CPU:$D9B2 PRG:19B2 85 03
lda $0280,x ; CPU:$D9B4 PRG:19B4 BD 80 02
and #$F0 ; CPU:$D9B7 PRG:19B7 29 F0
ora $035E,x ; CPU:$D9B9 PRG:19B9 1D 5E 03
sta $06BF ; CPU:$D9BC PRG:19BC 8D BF 06
lda $02EF,x ; CPU:$D9BF PRG:19BF BD EF 02
and #$F8 ; CPU:$D9C2 PRG:19C2 29 F8
ora $03CD,x ; CPU:$D9C4 PRG:19C4 1D CD 03
sta $06D4 ; CPU:$D9C7 PRG:19C7 8D D4 06
ldx #$6E ; CPU:$D9CA PRG:19CA A2 6E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D9CC
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_D9E1; loads A from $04AB,x; ANDs A with
; $01; branches on equal to Sub_8764_JoinBranchPaths_D9E1; loads A
; with $12; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, Zp03, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D9CC:
lda $035E,x ; CPU:$D9CC PRG:19CC BD 5E 03
bmi Sub_8764_JoinBranchPaths_D9E1 ; CPU:$D9CF PRG:19CF 30 10
lda $04AB,x ; CPU:$D9D1 PRG:19D1 BD AB 04
and #$01 ; CPU:$D9D4 PRG:19D4 29 01
beq Sub_8764_JoinBranchPaths_D9E1 ; CPU:$D9D6 PRG:19D6 F0 09
lda #$12 ; CPU:$D9D8 PRG:19D8 A9 12
sta $051A,x ; CPU:$D9DA PRG:19DA 9D 1A 05
dec Zp03 ; CPU:$D9DD PRG:19DD C6 03
beq Sub_8764_OnZero_D9E6 ; CPU:$D9DF PRG:19DF F0 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_D9E1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 12 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_D9E1; loads A from $04AB,x; ANDs A with
; $01; branches on equal to Sub_8764_JoinBranchPaths_D9E1; loads A
; with $12; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, Zp03, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_D9E1:
dex ; CPU:$D9E1 PRG:19E1 CA
cpx #$59 ; CPU:$D9E2 PRG:19E2 E0 59
bcs Sub_8764_OnCarrySet_D9CC ; CPU:$D9E4 PRG:19E4 B0 E6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_D9E6
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_D9E6:
rts ; CPU:$D9E6 PRG:19E6 60
; -----------------------------------------------------------------------------
; Routine: InitLastEnemies
; Global: The routine calls DrawTargetSprites.
; Local: Executes 5 instructions: loads X with $0B; calls DrawTargetSprites; loads X
; with $0C; calls DrawTargetSprites; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, Zp53, the OAM shadow,
; $035E.
;
; -----------------------------------------------------------------------------
InitLastEnemies:
ldx #$0B ; CPU:$D9E7 PRG:19E7 A2 0B
jsr DrawTargetSprites ; CPU:$D9E9 PRG:19E9 20 E0 ED
ldx #$0C ; CPU:$D9EC PRG:19EC A2 0C
jsr DrawTargetSprites ; CPU:$D9EE PRG:19EE 20 E0 ED
rts ; CPU:$D9F1 PRG:19F1 60
; -----------------------------------------------------------------------------
; Routine: ScanEnemySlots
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A with $00; stores A to Zp2F; stores A
; to Zp30; loads Y with $58.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
ScanEnemySlots:
lda #$00 ; CPU:$D9F2 PRG:19F2 A9 00
sta Zp2F ; CPU:$D9F4 PRG:19F4 85 2F
sta Zp30 ; CPU:$D9F6 PRG:19F6 85 30
ldy #$58 ; CPU:$D9F8 PRG:19F8 A0 58
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_D9FA
; Global: The routine calls AdvanceSpawnTimer.
; Local: Executes 7 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_JoinBranchPaths_DA0A; loads A from $04AB,y; ANDs A with
; $40; branches on equal to Sub_8764_JoinBranchPaths_DA0A; copies Y
; into A; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_D9FA:
lda $035E,y ; CPU:$D9FA PRG:19FA B9 5E 03
bmi Sub_8764_JoinBranchPaths_DA0A ; CPU:$D9FD PRG:19FD 30 0B
lda $04AB,y ; CPU:$D9FF PRG:19FF B9 AB 04
and #$40 ; CPU:$DA02 PRG:1A02 29 40
beq Sub_8764_JoinBranchPaths_DA0A ; CPU:$DA04 PRG:1A04 F0 04
tya ; CPU:$DA06 PRG:1A06 98
jsr AdvanceSpawnTimer ; CPU:$DA07 PRG:1A07 20 6B DD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DA0A
; Global: The routine calls AdvanceSpawnTimer.
; Local: Executes 16 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_JoinBranchPaths_DA0A; loads A from $04AB,y; ANDs A with
; $40; branches on equal to Sub_8764_JoinBranchPaths_DA0A; copies Y
; into A; and 10 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DA0A:
dey ; CPU:$DA0A PRG:1A0A 88
cpy #$55 ; CPU:$DA0B PRG:1A0B C0 55
bcs Sub_8764_OnCarrySet_D9FA ; CPU:$DA0D PRG:1A0D B0 EB
lda #$84 ; CPU:$DA0F PRG:1A0F A9 84
sta Zp40 ; CPU:$DA11 PRG:1A11 85 40
lda #$05 ; CPU:$DA13 PRG:1A13 A9 05
sta Zp05 ; CPU:$DA15 PRG:1A15 85 05
sta Zp06 ; CPU:$DA17 PRG:1A17 85 06
ldx #$58 ; CPU:$DA19 PRG:1A19 A2 58
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DA1B
; Global: The routine calls DrawFactoryAndTargetSprites and DrawTargetSpritesAlt.
; Local: Executes 13 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_DA3D; loads A from $04AB,x; ANDs A with $40;
; branches on equal to Sub_8764_OnZero_DA3A; sets the carry flag; and
; 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DA1B:
lda $035E,x ; CPU:$DA1B PRG:1A1B BD 5E 03
bmi Sub_8764_OnNegative_DA3D ; CPU:$DA1E PRG:1A1E 30 1D
lda $04AB,x ; CPU:$DA20 PRG:1A20 BD AB 04
and #$40 ; CPU:$DA23 PRG:1A23 29 40
beq Sub_8764_OnZero_DA3A ; CPU:$DA25 PRG:1A25 F0 13
sec ; CPU:$DA27 PRG:1A27 38
lda $043C,x ; CPU:$DA28 PRG:1A28 BD 3C 04
sbc #$84 ; CPU:$DA2B PRG:1A2B E9 84
tay ; CPU:$DA2D PRG:1A2D A8
lda $DA8D,y ; CPU:$DA2E PRG:1A2E B9 8D DA
jsr DrawFactoryAndTargetSprites; CPU:$DA31 PRG:1A31 20 D7 ED
lda $DA99,y ; CPU:$DA34 PRG:1A34 B9 99 DA
jsr DrawTargetSpritesAlt ; CPU:$DA37 PRG:1A37 20 E2 ED
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DA3A
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and CheckEnemyDirection.
; Local: Executes 14 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_DA3D; loads A from $04AB,x; ANDs A with $40;
; branches on equal to Sub_8764_OnZero_DA3A; sets the carry flag; and
; 8 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DA3A:
jsr CheckEnemyDirection ; CPU:$DA3A PRG:1A3A 20 80 DD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_DA3D
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and CheckEnemyDirection.
; Local: Executes 18 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_DA3D; loads A from $04AB,x; ANDs A with $40;
; branches on equal to Sub_8764_OnZero_DA3A; sets the carry flag; and
; 12 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_DA3D:
dex ; CPU:$DA3D PRG:1A3D CA
cpx #$55 ; CPU:$DA3E PRG:1A3E E0 55
bcs Sub_8764_OnCarrySet_DA1B ; CPU:$DA40 PRG:1A40 B0 D9
rts ; CPU:$DA42 PRG:1A42 60
; -----------------------------------------------------------------------------
; Routine: InitPlayerState
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads X with $54; loads A with $68; stores A
; to Zp40; loads A with $0A; stores A to Zp05; loads A with $10; and
; 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
InitPlayerState:
ldx #$54 ; CPU:$DA43 PRG:1A43 A2 54
lda #$68 ; CPU:$DA45 PRG:1A45 A9 68
sta Zp40 ; CPU:$DA47 PRG:1A47 85 40
lda #$0A ; CPU:$DA49 PRG:1A49 A9 0A
sta Zp05 ; CPU:$DA4B PRG:1A4B 85 05
lda #$10 ; CPU:$DA4D PRG:1A4D A9 10
sta Zp06 ; CPU:$DA4F PRG:1A4F 85 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DA51
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and LoadLevelSpriteEntry.
; Local: Executes 12 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_DA6F; loads A from $043C,x; copies A
; into Y; loads A from $DA0D,y; calls DrawFactoryAndTargetSprites; and 6 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DA51:
lda $035E,x ; CPU:$DA51 PRG:1A51 BD 5E 03
bmi Sub_8764_JoinBranchPaths_DA6F ; CPU:$DA54 PRG:1A54 30 19
lda $043C,x ; CPU:$DA56 PRG:1A56 BD 3C 04
tay ; CPU:$DA59 PRG:1A59 A8
lda $DA0D,y ; CPU:$DA5A PRG:1A5A B9 0D DA
jsr DrawFactoryAndTargetSprites; CPU:$DA5D PRG:1A5D 20 D7 ED
lda $DA19,y ; CPU:$DA60 PRG:1A60 B9 19 DA
jsr DrawTargetSpritesAlt ; CPU:$DA63 PRG:1A63 20 E2 ED
lda Zp12 ; CPU:$DA66 PRG:1A66 A5 12
and #$03 ; CPU:$DA68 PRG:1A68 29 03
bne Sub_8764_JoinBranchPaths_DA6F ; CPU:$DA6A PRG:1A6A D0 03
jsr LoadLevelSpriteEntry ; CPU:$DA6C PRG:1A6C 20 BB DE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DA6F
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and LoadLevelSpriteEntry.
; Local: Executes 16 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_DA6F; loads A from $043C,x; copies A
; into Y; loads A from $DA0D,y; calls DrawFactoryAndTargetSprites; and 10 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DA6F:
dex ; CPU:$DA6F PRG:1A6F CA
cpx #$3D ; CPU:$DA70 PRG:1A70 E0 3D
bcs Sub_8764_OnCarrySet_DA51 ; CPU:$DA72 PRG:1A72 B0 DD
rts ; CPU:$DA74 PRG:1A74 60
; ---- data $DA75-$DBA7 (307 bytes) ----
; referenced by `lda $DADD,x` at $C72A (operand $DADD falls inside this region)
; referenced by `lda $DA8D,y` at $DA2E (operand $DA8D falls inside this region)
; referenced by `lda $DA99,y` at $DA34 (operand $DA99 falls inside this region)
; referenced by `lda $DB49,y` at $DBCC (operand $DB49 falls inside this region)
; referenced by `lda $DB8B,y` at $DBD0 (operand $DB8B falls inside this region)
; referenced by `lda $DB6E,y` at $DBD5 (operand $DB6E falls inside this region)
; ... and 8 further references from decoded code
LevelLayoutData:
.byte $00, $02, $04, $04, $04, $02, $00, $82, $84, $84, $84, $82, $84, $84, $82, $00 ; CPU:$DA75 PRG:1A75 00 02 04 04 04 02 00 82 84 84 84 82 84 84 82 00
.byte $02, $04, $04, $04, $02, $00, $82, $84, $00, $02, $04, $04, $04, $02, $00, $82 ; CPU:$DA85 PRG:1A85 02 04 04 04 02 00 82 84 00 02 04 04 04 02 00 82
.byte $84, $84, $84, $82, $84, $84, $82, $00, $02, $04, $04, $04, $02, $00, $82, $84 ; CPU:$DA95 PRG:1A95 84 84 84 82 84 84 82 00 02 04 04 04 02 00 82 84
.byte $00, $04, $00, $84, $83, $00, $03, $00, $00, $03, $05, $06, $05, $03, $00, $83 ; CPU:$DAA5 PRG:1AA5 00 04 00 84 83 00 03 00 00 03 05 06 05 03 00 83
.byte $85, $86, $85, $83, $85, $84, $82, $00, $02, $04, $05, $04, $02, $00, $82, $84 ; CPU:$DAB5 PRG:1AB5 85 86 85 83 85 84 82 00 02 04 05 04 02 00 82 84
.byte $00, $0D, $17, $1A, $17, $0D, $00, $8D, $97, $9A, $97, $8D, $96, $93, $8B, $00 ; CPU:$DAC5 PRG:1AC5 00 0D 17 1A 17 0D 00 8D 97 9A 97 8D 96 93 8B 00
.byte $0B, $13, $16, $13, $0B, $00, $8B, $93, $05, $0A, $04, $08, $C1, $23, $41, $25 ; CPU:$DAD5 PRG:1AD5 0B 13 16 13 0B 00 8B 93 05 0A 04 08 C1 23 41 25
.byte $84, $06, $45, $C6, $C7, $29, $48, $46, $CA, $CB, $05, $05, $00, $05, $BD, $C9 ; CPU:$DAE5 PRG:1AE5 84 06 45 C6 C7 29 48 46 CA CB 05 05 00 05 BD C9
.byte $36, $32, $44, $45, $25, $82, $43, $C6, $47, $84, $C2, $03, $41, $C0, $80, $C3 ; CPU:$DAF5 PRG:1AF5 36 32 44 45 25 82 43 C6 47 84 C2 03 41 C0 80 C3
.byte $05, $00, $00, $0B, $0A, $01, $0A, $0B, $0C, $0B, $0A, $09, $03, $09, $0A, $0B ; CPU:$DB05 PRG:1B05 05 00 00 0B 0A 01 0A 0B 0C 0B 0A 09 03 09 0A 0B
.byte $0C, $08, $07, $06, $05, $02, $05, $06, $07, $08, $0D, $08, $07, $06, $04, $06 ; CPU:$DB15 PRG:1B15 0C 08 07 06 05 02 05 06 07 08 0D 08 07 06 04 06
.byte $07, $08, $0D, $01, $0F, $07, $19, $0B, $AA, $54, $CA, $74, $54, $74, $B4, $C4 ; CPU:$DB25 PRG:1B25 07 08 0D 01 0F 07 19 0B AA 54 CA 74 54 74 B4 C4
.byte $CA, $AA, $8A, $0A, $04, $00, $C1, $8D, $1A, $95, $1A, $0A, $0A, $02, $D9, $A5 ; CPU:$DB35 PRG:1B35 CA AA 8A 0A 04 00 C1 8D 1A 95 1A 0A 0A 02 D9 A5
.byte $A5, $C5, $C5, $D9, $00, $00, $0B, $0C, $01, $00, $0E, $0F, $09, $00, $11, $12 ; CPU:$DB45 PRG:1B45 A5 C5 C5 D9 00 00 0B 0C 01 00 0E 0F 09 00 11 12
.byte $02, $00, $10, $0A, $00, $14, $13, $03, $00, $15, $04, $00, $16, $17, $18, $05 ; CPU:$DB55 PRG:1B55 02 00 10 0A 00 14 13 03 00 15 04 00 16 17 18 05
.byte $00, $1C, $1B, $0D, $00, $1A, $19, $06, $00, $00, $73, $B5, $27, $73, $B9, $5B ; CPU:$DB65 PRG:1B65 00 1C 1B 0D 00 1A 19 06 00 00 73 B5 27 73 B9 5B
.byte $00, $00, $93, $D5, $F3, $A3, $B9, $44, $C3, $84, $55, $06, $D6, $86, $91, $E8 ; CPU:$DB75 PRG:1B75 00 00 93 D5 F3 A3 B9 44 C3 84 55 06 D6 86 91 E8
.byte $0A, $49, $AB, $2A, $CA, $0B, $00, $CA, $3A, $6C, $46, $C6, $79, $00, $00, $CA ; CPU:$DB85 PRG:1B85 0A 49 AB 2A CA 0B 00 CA 3A 6C 46 C6 79 00 00 CA
.byte $52, $A3, $C3, $C6, $12, $F1, $02, $03, $7A, $65, $35, $9E, $A6, $77, $BF, $E1 ; CPU:$DB95 PRG:1B95 52 A3 C3 C6 12 F1 02 03 7A 65 35 9E A6 77 BF E1
.byte $42, $AD, $EE ; CPU:$DBA5 PRG:1BA5 42 AD EE
; -----------------------------------------------------------------------------
; Routine: DrawFactorySprite
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $3C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
DrawFactorySprite:
ldx #$3C ; CPU:$DBA8 PRG:1BA8 A2 3C
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DBAA
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and LoadLevelLayoutEntry.
; Local: Executes 9 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_DBC2; loads A from $043C,x; copies A into Y;
; loads A from $DA09,y; calls DrawFactoryAndTargetSprites; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DBAA:
lda $035E,x ; CPU:$DBAA PRG:1BAA BD 5E 03
bmi Sub_8764_OnNegative_DBC2 ; CPU:$DBAD PRG:1BAD 30 13
lda $043C,x ; CPU:$DBAF PRG:1BAF BD 3C 04
tay ; CPU:$DBB2 PRG:1BB2 A8
lda $DA09,y ; CPU:$DBB3 PRG:1BB3 B9 09 DA
jsr DrawFactoryAndTargetSprites; CPU:$DBB6 PRG:1BB6 20 D7 ED
lda $DA0D,y ; CPU:$DBB9 PRG:1BB9 B9 0D DA
jsr DrawTargetSpritesAlt ; CPU:$DBBC PRG:1BBC 20 E2 ED
jsr LoadLevelLayoutEntry ; CPU:$DBBF PRG:1BBF 20 C8 DB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_DBC2
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and LoadLevelLayoutEntry.
; Local: Executes 13 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_OnNegative_DBC2; loads A from $043C,x; copies A into Y;
; loads A from $DA09,y; calls DrawFactoryAndTargetSprites; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_DBC2:
dex ; CPU:$DBC2 PRG:1BC2 CA
cpx #$33 ; CPU:$DBC3 PRG:1BC3 E0 33
bcs Sub_8764_OnCarrySet_DBAA ; CPU:$DBC5 PRG:1BC5 B0 E3
rts ; CPU:$DBC7 PRG:1BC7 60
; -----------------------------------------------------------------------------
; Routine: LoadLevelLayoutEntry
; Global: The routine calls SplitByteIntoNibbles and ComputeObjectOffset.
; Local: Executes 14 instructions: loads A from $051A,x; copies A into Y;
; loads A from $DB49,y; copies A into Y; loads A from $DB8B,y; stores
; A to Zp28; and 8 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
LoadLevelLayoutEntry:
lda $051A,x ; CPU:$DBC8 PRG:1BC8 BD 1A 05
tay ; CPU:$DBCB PRG:1BCB A8
lda $DB49,y ; CPU:$DBCC PRG:1BCC B9 49 DB
tay ; CPU:$DBCF PRG:1BCF A8
lda $DB8B,y ; CPU:$DBD0 PRG:1BD0 B9 8B DB
sta Zp28 ; CPU:$DBD3 PRG:1BD3 85 28
lda $DB6E,y ; CPU:$DBD5 PRG:1BD5 B9 6E DB
jsr SplitByteIntoNibbles ; CPU:$DBD8 PRG:1BD8 20 20 E0
jsr ComputeObjectOffset ; CPU:$DBDB PRG:1BDB 20 65 E6
lda Zp28 ; CPU:$DBDE PRG:1BDE A5 28
bne Sub_8764_OnNonzero_DBE8 ; CPU:$DBE0 PRG:1BE0 D0 06
lda Zp27 ; CPU:$DBE2 PRG:1BE2 A5 27
cmp #$14 ; CPU:$DBE4 PRG:1BE4 C9 14
bcc Sub_8764_OnCarryClear_DBF6 ; CPU:$DBE6 PRG:1BE6 90 0E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DBE8
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp03; ANDs A with $04; branches
; on equal to Sub_8764_OnZero_DBF2; loads A with $9E; branches on not
; equal to Sub_8764_OnNonzero_DC0C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, Zp27, $043C, $051A, $06A6.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DBE8:
lda Zp03 ; CPU:$DBE8 PRG:1BE8 A5 03
and #$04 ; CPU:$DBEA PRG:1BEA 29 04
beq Sub_8764_OnZero_DBF2 ; CPU:$DBEC PRG:1BEC F0 04
lda #$9E ; CPU:$DBEE PRG:1BEE A9 9E
bne Sub_8764_OnNonzero_DC0C ; CPU:$DBF0 PRG:1BF0 D0 1A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DBF2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $9C; branches on not equal to
; Sub_8764_OnNonzero_DC0C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, Zp27, $043C, $051A, $06A6.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DBF2:
lda #$9C ; CPU:$DBF2 PRG:1BF2 A9 9C
bne Sub_8764_OnNonzero_DC0C ; CPU:$DBF4 PRG:1BF4 D0 16
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DBF6
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp26; branches on not equal to
; Sub_8764_OnNonzero_DC00; loads A from Zp25; compares A with $14;
; branches on carry clear to Sub_8764_OnCarryClear_DC10.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, Zp27, $043C, $051A, $06A6.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DBF6:
lda Zp26 ; CPU:$DBF6 PRG:1BF6 A5 26
bne Sub_8764_OnNonzero_DC00 ; CPU:$DBF8 PRG:1BF8 D0 06
lda Zp25 ; CPU:$DBFA PRG:1BFA A5 25
cmp #$14 ; CPU:$DBFC PRG:1BFC C9 14
bcc Sub_8764_OnCarryClear_DC10 ; CPU:$DBFE PRG:1BFE 90 10
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DC00
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp03; ANDs A with $08; branches
; on equal to Sub_8764_OnZero_DC0A; loads A with $9D; branches on not
; equal to Sub_8764_OnNonzero_DC0C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, $043C.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DC00:
lda Zp03 ; CPU:$DC00 PRG:1C00 A5 03
and #$08 ; CPU:$DC02 PRG:1C02 29 08
beq Sub_8764_OnZero_DC0A ; CPU:$DC04 PRG:1C04 F0 04
lda #$9D ; CPU:$DC06 PRG:1C06 A9 9D
bne Sub_8764_OnNonzero_DC0C ; CPU:$DC08 PRG:1C08 D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DC0A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $9F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, $043C.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DC0A:
lda #$9F ; CPU:$DC0A PRG:1C0A A9 9F
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DC0C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: stores A to $043C,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, $043C.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DC0C:
sta $043C,x ; CPU:$DC0C PRG:1C0C 9D 3C 04
rts ; CPU:$DC0F PRG:1C0F 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DC10
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 13 instructions: increments $051A,x; loads A from $051A,x;
; copies A into Y; loads A from $DB49,y; branches on not equal to
; Sub_8764_OnNonzero_DC38; decrements Y; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N and Z flags, Zp27, $051A, $06A6.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DC10:
inc $051A,x ; CPU:$DC10 PRG:1C10 FE 1A 05
lda $051A,x ; CPU:$DC13 PRG:1C13 BD 1A 05
tay ; CPU:$DC16 PRG:1C16 A8
lda $DB49,y ; CPU:$DC17 PRG:1C17 B9 49 DB
bne Sub_8764_OnNonzero_DC38 ; CPU:$DC1A PRG:1C1A D0 1C
dey ; CPU:$DC1C PRG:1C1C 88
stx Zp27 ; CPU:$DC1D PRG:1C1D 86 27
lda $DB49,y ; CPU:$DC1F PRG:1C1F B9 49 DB
and #$07 ; CPU:$DC22 PRG:1C22 29 07
tax ; CPU:$DC24 PRG:1C24 AA
inc $06A6,x ; CPU:$DC25 PRG:1C25 FE A6 06
inc $06A6,x ; CPU:$DC28 PRG:1C28 FE A6 06
ldx Zp27 ; CPU:$DC2B PRG:1C2B A6 27
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DC2D
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: decrements Y; loads A from $DB49,y; branches
; on not equal to Sub_8764_OnNonzero_DC2D; increments Y; copies Y
; into A; stores A to $051A,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N and Z flags, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DC2D:
dey ; CPU:$DC2D PRG:1C2D 88
lda $DB49,y ; CPU:$DC2E PRG:1C2E B9 49 DB
bne Sub_8764_OnNonzero_DC2D ; CPU:$DC31 PRG:1C31 D0 FA
iny ; CPU:$DC33 PRG:1C33 C8
tya ; CPU:$DC34 PRG:1C34 98
sta $051A,x ; CPU:$DC35 PRG:1C35 9D 1A 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DC38
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DC38:
rts ; CPU:$DC38 PRG:1C38 60
; -----------------------------------------------------------------------------
; Routine: SpawnEnemyFromCountTable
; Global: The routine calls CopyEnemyToSlot, writes $0440 and $04AF, reads $04AF.
; Local: Executes 13 instructions: loads A from $04AF; branches on negative to
; Sub_8764_OnNegative_DC5A; loads Y from Zp29; loads A with $04;
; calls CopyEnemyToSlot; loads A from $DC5B,y; and 7 more instructions.
; Parameters: Reads $04AF from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $0440 and $04AF changed.
; Clobbers:
; A and Y, the N and Z flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
SpawnEnemyFromCountTable:
lda $04AF ; CPU:$DC39 PRG:1C39 AD AF 04
bmi Sub_8764_OnNegative_DC5A ; CPU:$DC3C PRG:1C3C 30 1C
ldy Zp29 ; CPU:$DC3E PRG:1C3E A4 29
lda #$04 ; CPU:$DC40 PRG:1C40 A9 04
jsr CopyEnemyToSlot ; CPU:$DC42 PRG:1C42 20 39 E0
lda $DC5B,y ; CPU:$DC45 PRG:1C45 B9 5B DC
sta $0440 ; CPU:$DC48 PRG:1C48 8D 40 04
lda #$20 ; CPU:$DC4B PRG:1C4B A9 20
sta $04AF ; CPU:$DC4D PRG:1C4D 8D AF 04
lda $DC67,y ; CPU:$DC50 PRG:1C50 B9 67 DC
sta Zp41 ; CPU:$DC53 PRG:1C53 85 41
lda $DC74,y ; CPU:$DC55 PRG:1C55 B9 74 DC
sta Zp42 ; CPU:$DC58 PRG:1C58 85 42
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_DC5A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_DC5A:
rts ; CPU:$DC5A PRG:1C5A 60
; ---- data $DC5B-$DC80 (38 bytes) ----
; referenced by `lda $DC5B,y` at $DC45 (operand $DC5B falls inside this region)
; referenced by `lda $DC67,y` at $DC50 (operand $DC67 falls inside this region)
; referenced by `lda $DC74,y` at $DC55 (operand $DC74 falls inside this region)
EnemyCountTable:
.byte $A0, $A1, $A1, $A2, $A3, $A3, $A4, $A5, $A5, $A6, $A7, $A7 ; CPU:$DC5B PRG:1C5B A0 A1 A1 A2 A3 A3 A4 A5 A5 A6 A7 A7
EnemySpawnCountTable:
.byte $00, $06, $0C, $0E ; CPU:$DC67 PRG:1C67 00 06 0C 0E
.byte $0C, $06, $00, $86, $8C, $8E, $8C, $86, $00 ; CPU:$DC6B PRG:1C6B 0C 06 00 86 8C 8E 8C 86 00
EnemySpawnDelayTable:
.byte $8A, $88, $84, $00, $04, $08, $0A ; CPU:$DC74 PRG:1C74 8A 88 84 00 04 08 0A
.byte $08, $04, $00, $84, $88, $8A ; CPU:$DC7B PRG:1C7B 08 04 00 84 88 8A
; -----------------------------------------------------------------------------
; Routine: CheckEnemySpawnArea
; Global: The routine calls IsRadarBlipVisible.
; Local: Executes 5 instructions: calls IsRadarBlipVisible; branches on equal to
; Sub_8764_OnZero_DC8C; loads A from ZpDF; compares A with $40;
; branches on carry set to Sub_8764_OnCarrySet_DCAE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
CheckEnemySpawnArea:
jsr IsRadarBlipVisible ; CPU:$DC81 PRG:1C81 20 57 E1
beq Sub_8764_OnZero_DC8C ; CPU:$DC84 PRG:1C84 F0 06
lda ZpDF ; CPU:$DC86 PRG:1C86 A5 DF
cmp #$40 ; CPU:$DC88 PRG:1C88 C9 40
bcs Sub_8764_OnCarrySet_DCAE ; CPU:$DC8A PRG:1C8A B0 22
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DC8C
; Global: The routine calls UpdatePseudoRandomNumber.
; Local: Executes 17 instructions: loads A from $04AB,x; branches on
; non-negative to Sub_8764_JoinBranchPaths_DCD2; shifts a right;
; branches on carry clear to Sub_8764_JoinBranchPaths_DCD2; loads A
; from Zp09; branches on not equal to Sub_8764_JoinBranchPaths_DCC2;
; and 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DC8C:
lda $04AB,x ; CPU:$DC8C PRG:1C8C BD AB 04
bpl Sub_8764_JoinBranchPaths_DCD2 ; CPU:$DC8F PRG:1C8F 10 41
lsr a ; CPU:$DC91 PRG:1C91 4A
bcc Sub_8764_JoinBranchPaths_DCD2 ; CPU:$DC92 PRG:1C92 90 3E
lda Zp09 ; CPU:$DC94 PRG:1C94 A5 09
bne Sub_8764_JoinBranchPaths_DCC2 ; CPU:$DC96 PRG:1C96 D0 2A
lda $051A,x ; CPU:$DC98 PRG:1C98 BD 1A 05
cmp #$05 ; CPU:$DC9B PRG:1C9B C9 05
bcc Sub_8764_JoinBranchPaths_DCD2 ; CPU:$DC9D PRG:1C9D 90 33
lda ZpBD ; CPU:$DC9F PRG:1C9F A5 BD
asl a ; CPU:$DCA1 PRG:1CA1 0A
clc ; CPU:$DCA2 PRG:1CA2 18
adc #$05 ; CPU:$DCA3 PRG:1CA3 69 05
sta Zp54 ; CPU:$DCA5 PRG:1CA5 85 54
jsr UpdatePseudoRandomNumber ; CPU:$DCA7 PRG:1CA7 20 12 C4
cmp Zp54 ; CPU:$DCAA PRG:1CAA C5 54
bcc Sub_8764_JoinBranchPaths_DCC2 ; CPU:$DCAC PRG:1CAC 90 14
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DCAE
; Global: The routine calls DrawBlipSprite and CompareObjectPositions.
; Local: Executes 9 instructions: calls DrawBlipSprite; calls CompareObjectPositions; branches on
; carry set to Sub_8764_OnCarrySet_DCC3; loads A from $DEFC,y;
; compares A with Zp29; branches on not equal to
; Sub_8764_JoinBranchPaths_DCC2; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DCAE:
jsr DrawBlipSprite ; CPU:$DCAE PRG:1CAE 20 66 EE
jsr CompareObjectPositions ; CPU:$DCB1 PRG:1CB1 20 31 DE
bcs Sub_8764_OnCarrySet_DCC3 ; CPU:$DCB4 PRG:1CB4 B0 0D
lda $DEFC,y ; CPU:$DCB6 PRG:1CB6 B9 FC DE
cmp Zp29 ; CPU:$DCB9 PRG:1CB9 C5 29
bne Sub_8764_JoinBranchPaths_DCC2 ; CPU:$DCBB PRG:1CBB D0 05
lda Zp12 ; CPU:$DCBD PRG:1CBD A5 12
lsr a ; CPU:$DCBF PRG:1CBF 4A
bcs Sub_8764_OnCarrySet_DCCB ; CPU:$DCC0 PRG:1CC0 B0 09
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DCC2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DCC2:
rts ; CPU:$DCC2 PRG:1CC2 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DCC3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: returns with RTS; sets the carry flag; loads
; A from $043C,x; subtracts $84 from A; stores A to Zp29.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DCC3:
sec ; CPU:$DCC3 PRG:1CC3 38
lda $043C,x ; CPU:$DCC4 PRG:1CC4 BD 3C 04
sbc #$84 ; CPU:$DCC7 PRG:1CC7 E9 84
sta Zp29 ; CPU:$DCC9 PRG:1CC9 85 29
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DCCB
; Global: The routine calls SpawnEnemyFromCountTable.
; Local: Executes 4 instructions: returns with RTS; loads A from ZpB3;
; branches on negative to Sub_8764_JoinBranchPaths_DCC2; calls
; SpawnEnemyFromCountTable.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N and Z flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DCCB:
lda ZpB3 ; CPU:$DCCB PRG:1CCB A5 B3
bmi Sub_8764_JoinBranchPaths_DCC2 ; CPU:$DCCD PRG:1CCD 30 F3
jmp SpawnEnemyFromCountTable ; CPU:$DCCF PRG:1CCF 4C 39 DC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DCD2
; Global: The routine calls SplitByteIntoNibbles and CompareObjectPositions.
; Local: Executes 14 instructions: returns with RTS; loads A from $051A,x;
; copies A into Y; loads A from $06C2,y; stores A to Zp28; loads A
; from $06AD,y; and 8 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DCD2:
lda $051A,x ; CPU:$DCD2 PRG:1CD2 BD 1A 05
tay ; CPU:$DCD5 PRG:1CD5 A8
lda $06C2,y ; CPU:$DCD6 PRG:1CD6 B9 C2 06
sta Zp28 ; CPU:$DCD9 PRG:1CD9 85 28
lda $06AD,y ; CPU:$DCDB PRG:1CDB B9 AD 06
jsr SplitByteIntoNibbles ; CPU:$DCDE PRG:1CDE 20 20 E0
jsr CompareObjectPositions ; CPU:$DCE1 PRG:1CE1 20 31 DE
bcc Sub_8764_JoinBranchPaths_DCC2 ; CPU:$DCE4 PRG:1CE4 90 DC
lda $051A,x ; CPU:$DCE6 PRG:1CE6 BD 1A 05
cmp #$05 ; CPU:$DCE9 PRG:1CE9 C9 05
bcc Sub_8764_OnCarryClear_DCFE ; CPU:$DCEB PRG:1CEB 90 11
cmp #$13 ; CPU:$DCED PRG:1CED C9 13
beq Sub_8764_OnZero_DD09 ; CPU:$DCEF PRG:1CEF F0 18
; -----------------------------------------------------------------------------
; Routine: PickRandomEnemyType
; Global: The routine calls UpdatePseudoRandomNumber.
; Local: Executes 7 instructions: calls UpdatePseudoRandomNumber; shifts a right; ANDs A with
; $0F; clears the carry flag; adds $03 to A; stores A to $051A,x; and
; 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, ZpEA, ZpEB, ZpEC, $051A.
;
; -----------------------------------------------------------------------------
PickRandomEnemyType:
jsr UpdatePseudoRandomNumber ; CPU:$DCF1 PRG:1CF1 20 12 C4
lsr a ; CPU:$DCF4 PRG:1CF4 4A
and #$0F ; CPU:$DCF5 PRG:1CF5 29 0F
clc ; CPU:$DCF7 PRG:1CF7 18
adc #$03 ; CPU:$DCF8 PRG:1CF8 69 03
sta $051A,x ; CPU:$DCFA PRG:1CFA 9D 1A 05
rts ; CPU:$DCFD PRG:1CFD 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DCFE
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: compares A with $03; branches on carry clear
; to Sub_8764_OnCarryClear_DD3D; decrements $051A,x; decrements
; $051A,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DCFE:
cmp #$03 ; CPU:$DCFE PRG:1CFE C9 03
bcc Sub_8764_OnCarryClear_DD3D ; CPU:$DD00 PRG:1D00 90 3B
dec $051A,x ; CPU:$DD02 PRG:1D02 DE 1A 05
dec $051A,x ; CPU:$DD05 PRG:1D05 DE 1A 05
rts ; CPU:$DD08 PRG:1D08 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DD09
; Global: The routine calls CopyEnemyToSlot and CheckGameStateFlags, writes $043D.
; Local: Executes 7 instructions: loads A from $04AB,x; branches on
; non-negative to Sub_8764_OnNonnegative_DD1B; loads A with $01;
; calls CopyEnemyToSlot; loads A with $7C; stores A to $043D; and 1 more
; instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $043D changed.
; Clobbers:
; A, X and Y, the N and Z flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DD09:
lda $04AB,x ; CPU:$DD09 PRG:1D09 BD AB 04
bpl Sub_8764_OnNonnegative_DD1B; CPU:$DD0C PRG:1D0C 10 0D
lda #$01 ; CPU:$DD0E PRG:1D0E A9 01
jsr CopyEnemyToSlot ; CPU:$DD10 PRG:1D10 20 39 E0
lda #$7C ; CPU:$DD13 PRG:1D13 A9 7C
sta $043D ; CPU:$DD15 PRG:1D15 8D 3D 04
jsr CheckGameStateFlags ; CPU:$DD18 PRG:1D18 20 0D C5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_DD1B
; Global: The routine calls InitDirectionStateAlt and StartEnemySound, reads $036A.
; Local: Executes 7 instructions: loads A from $036A; branches on negative to
; Sub_8764_OnNegative_DD37; loads A from ZpA6; branches on negative
; to Sub_8764_OnNegative_DD2C; loads A with $04; calls InitDirectionStateAlt; and
; 1 more instruction.
; Parameters: Reads $036A from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_DD1B:
lda $036A ; CPU:$DD1B PRG:1D1B AD 6A 03
bmi Sub_8764_OnNegative_DD37 ; CPU:$DD1E PRG:1D1E 30 17
lda ZpA6 ; CPU:$DD20 PRG:1D20 A5 A6
bmi Sub_8764_OnNegative_DD2C ; CPU:$DD22 PRG:1D22 30 08
lda #$04 ; CPU:$DD24 PRG:1D24 A9 04
jsr InitDirectionStateAlt ; CPU:$DD26 PRG:1D26 20 20 CE
jsr StartEnemySound ; CPU:$DD29 PRG:1D29 20 93 D2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_DD2C
; Global: The routine calls TickPlayerTimer.
; Local: Executes 5 instructions: loads A with $1E; stores A to Zp0F;
; decrements ZpD9; branches on non-negative to
; Sub_8764_OnNonnegative_DD3C; calls TickPlayerTimer.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, Zp0F, ZpD7, ZpD8, ZpD9.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_DD2C:
lda #$1E ; CPU:$DD2C PRG:1D2C A9 1E
sta Zp0F ; CPU:$DD2E PRG:1D2E 85 0F
dec ZpD9 ; CPU:$DD30 PRG:1D30 C6 D9
bpl Sub_8764_OnNonnegative_DD3C; CPU:$DD32 PRG:1D32 10 08
jmp TickPlayerTimer ; CPU:$DD34 PRG:1D34 4C 3A D2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_DD37
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $0A; stores A to $051A,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_DD37:
lda #$0A ; CPU:$DD37 PRG:1D37 A9 0A
sta $051A,x ; CPU:$DD39 PRG:1D39 9D 1A 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_DD3C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_DD3C:
rts ; CPU:$DD3C PRG:1D3C 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DD3D
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads Y with $58; loads A from $051A,x;
; shifts a right; branches on carry clear to
; Sub_8764_JoinBranchPaths_DD46; decrements Y.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DD3D:
ldy #$58 ; CPU:$DD3D PRG:1D3D A0 58
lda $051A,x ; CPU:$DD3F PRG:1D3F BD 1A 05
lsr a ; CPU:$DD42 PRG:1D42 4A
bcc Sub_8764_JoinBranchPaths_DD46 ; CPU:$DD43 PRG:1D43 90 01
dey ; CPU:$DD45 PRG:1D45 88
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DD46
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_OnNegative_DD54; decrements Y; decrements Y; compares Y
; with $55; branches on carry set to Sub_8764_JoinBranchPaths_DD46.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DD46:
lda $035E,y ; CPU:$DD46 PRG:1D46 B9 5E 03
bmi Sub_8764_OnNegative_DD54 ; CPU:$DD49 PRG:1D49 30 09
dey ; CPU:$DD4B PRG:1D4B 88
dey ; CPU:$DD4C PRG:1D4C 88
cpy #$55 ; CPU:$DD4D PRG:1D4D C0 55
bcs Sub_8764_JoinBranchPaths_DD46 ; CPU:$DD4F PRG:1D4F B0 F5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DD51
; Global: The routine calls PickRandomEnemyType.
; Local: Executes 1 instruction: calls PickRandomEnemyType.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, ZpEA, ZpEB, ZpEC, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DD51:
jmp PickRandomEnemyType ; CPU:$DD51 PRG:1D51 4C F1 DC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_DD54
; Global: The routine calls PickRandomEnemyType and AdvanceSpawnTimer.
; Local: Executes 6 instructions: calls PickRandomEnemyType; loads A from $051A,x; calls
; AdvanceSpawnTimer; branches on carry clear to Sub_8764_OnCarryClear_DD51;
; loads A from $04AB,x; branches on non-negative to
; Sub_8764_OnNonnegative_DD61.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_DD54:
lda $051A,x ; CPU:$DD54 PRG:1D54 BD 1A 05
jsr AdvanceSpawnTimer ; CPU:$DD57 PRG:1D57 20 6B DD
bcc Sub_8764_OnCarryClear_DD51 ; CPU:$DD5A PRG:1D5A 90 F5
lda $04AB,x ; CPU:$DD5C PRG:1D5C BD AB 04
bpl Sub_8764_OnNonnegative_DD61; CPU:$DD5F PRG:1D5F 10 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_DD61
; Global: The routine calls CopyEnemyToNewSlot.
; Local: Executes 4 instructions: calls CopyEnemyToNewSlot; loads A from $DAD3,y; stores
; A to $051A,y; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N and Z flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_DD61:
jsr CopyEnemyToNewSlot ; CPU:$DD61 PRG:1D61 20 19 DE
lda $DAD3,y ; CPU:$DD64 PRG:1D64 B9 D3 DA
sta $051A,y ; CPU:$DD67 PRG:1D67 99 1A 05
rts ; CPU:$DD6A PRG:1D6A 60
; -----------------------------------------------------------------------------
; Routine: AdvanceSpawnTimer
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: shifts a right; branches on carry clear to
; Sub_8764_OnCarryClear_DD76; loads A from Zp30; branches on not
; equal to Sub_8764_OnNonzero_DD7E; increments Zp30; sets the carry
; flag; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z and C flags, Zp2F, Zp30.
;
; -----------------------------------------------------------------------------
AdvanceSpawnTimer:
lsr a ; CPU:$DD6B PRG:1D6B 4A
bcc Sub_8764_OnCarryClear_DD76 ; CPU:$DD6C PRG:1D6C 90 08
lda Zp30 ; CPU:$DD6E PRG:1D6E A5 30
bne Sub_8764_OnNonzero_DD7E ; CPU:$DD70 PRG:1D70 D0 0C
inc Zp30 ; CPU:$DD72 PRG:1D72 E6 30
sec ; CPU:$DD74 PRG:1D74 38
rts ; CPU:$DD75 PRG:1D75 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DD76
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp2F; branches on not equal to
; Sub_8764_OnNonzero_DD7E; increments Zp2F; sets the carry flag;
; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z and C flags, Zp2F.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DD76:
lda Zp2F ; CPU:$DD76 PRG:1D76 A5 2F
bne Sub_8764_OnNonzero_DD7E ; CPU:$DD78 PRG:1D78 D0 04
inc Zp2F ; CPU:$DD7A PRG:1D7A E6 2F
sec ; CPU:$DD7C PRG:1D7C 38
rts ; CPU:$DD7D PRG:1D7D 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DD7E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: clears the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DD7E:
clc ; CPU:$DD7E PRG:1D7E 18
rts ; CPU:$DD7F PRG:1D7F 60
; -----------------------------------------------------------------------------
; Routine: CheckEnemyDirection
; Global: The routine calls AdvanceSpawnTimer.
; Local: Executes 13 instructions: loads A from $04AB,x; ANDs A with $40;
; branches on not equal to Sub_8764_JoinBranchPaths_DD9D; loads A
; from Zp12; ANDs A with $3F; compares A with $10; and 7 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
CheckEnemyDirection:
lda $04AB,x ; CPU:$DD80 PRG:1D80 BD AB 04
and #$40 ; CPU:$DD83 PRG:1D83 29 40
bne Sub_8764_JoinBranchPaths_DD9D ; CPU:$DD85 PRG:1D85 D0 16
lda Zp12 ; CPU:$DD87 PRG:1D87 A5 12
and #$3F ; CPU:$DD89 PRG:1D89 29 3F
cmp #$10 ; CPU:$DD8B PRG:1D8B C9 10
bne Sub_8764_JoinBranchPaths_DD9D ; CPU:$DD8D PRG:1D8D D0 0E
txa ; CPU:$DD8F PRG:1D8F 8A
jsr AdvanceSpawnTimer ; CPU:$DD90 PRG:1D90 20 6B DD
bcc Sub_8764_JoinBranchPaths_DD9D ; CPU:$DD93 PRG:1D93 90 08
lda $04AB,x ; CPU:$DD95 PRG:1D95 BD AB 04
ora #$40 ; CPU:$DD98 PRG:1D98 09 40
sta $04AB,x ; CPU:$DD9A PRG:1D9A 9D AB 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DD9D
; Global: The routine calls SplitByteIntoNibbles and CompareObjectPositions.
; Local: Executes 19 instructions: loads A from $051A,x; copies A into Y;
; loads A from $DB07,y; copies A into Y; pushes A; loads A from
; $DB3B,y; and 13 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DD9D:
lda $051A,x ; CPU:$DD9D PRG:1D9D BD 1A 05
tay ; CPU:$DDA0 PRG:1DA0 A8
lda $DB07,y ; CPU:$DDA1 PRG:1DA1 B9 07 DB
tay ; CPU:$DDA4 PRG:1DA4 A8
pha ; CPU:$DDA5 PRG:1DA5 48
lda $DB3B,y ; CPU:$DDA6 PRG:1DA6 B9 3B DB
sta Zp28 ; CPU:$DDA9 PRG:1DA9 85 28
lda $DB2C,y ; CPU:$DDAB PRG:1DAB B9 2C DB
jsr SplitByteIntoNibbles ; CPU:$DDAE PRG:1DAE 20 20 E0
jsr CompareObjectPositions ; CPU:$DDB1 PRG:1DB1 20 31 DE
pla ; CPU:$DDB4 PRG:1DB4 68
bcs Sub_8764_OnCarrySet_DDC4 ; CPU:$DDB5 PRG:1DB5 B0 0D
cmp #$0B ; CPU:$DDB7 PRG:1DB7 C9 0B
beq Sub_8764_OnZero_DDF1 ; CPU:$DDB9 PRG:1DB9 F0 36
cmp #$08 ; CPU:$DDBB PRG:1DBB C9 08
beq Sub_8764_OnZero_DDF1 ; CPU:$DDBD PRG:1DBD F0 32
cmp #$0C ; CPU:$DDBF PRG:1DBF C9 0C
bcs Sub_8764_OnCarrySet_DDFE ; CPU:$DDC1 PRG:1DC1 B0 3B
rts ; CPU:$DDC3 PRG:1DC3 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DDC4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from $051A,x; copies A into Y; loads
; A from $DB07,y; compares A with $0C; branches on carry clear to
; Sub_8764_OnCarryClear_DDE1; loads Y with $6E.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DDC4:
lda $051A,x ; CPU:$DDC4 PRG:1DC4 BD 1A 05
tay ; CPU:$DDC7 PRG:1DC7 A8
lda $DB07,y ; CPU:$DDC8 PRG:1DC8 B9 07 DB
cmp #$0C ; CPU:$DDCB PRG:1DCB C9 0C
bcc Sub_8764_OnCarryClear_DDE1 ; CPU:$DDCD PRG:1DCD 90 12
ldy #$6E ; CPU:$DDCF PRG:1DCF A0 6E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DDD1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from $035E,y; branches on negative
; to Sub_8764_OnNegative_DE0F; decrements Y; compares Y with $59;
; branches on carry set to Sub_8764_OnCarrySet_DDD1.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DDD1:
lda $035E,y ; CPU:$DDD1 PRG:1DD1 B9 5E 03
bmi Sub_8764_OnNegative_DE0F ; CPU:$DDD4 PRG:1DD4 30 39
dey ; CPU:$DDD6 PRG:1DD6 88
cpy #$59 ; CPU:$DDD7 PRG:1DD7 C0 59
bcs Sub_8764_OnCarrySet_DDD1 ; CPU:$DDD9 PRG:1DD9 B0 F6
; -----------------------------------------------------------------------------
; Routine: DestroyEnemy
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A with $FF; stores A to $035E,x;
; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, $035E.
;
; -----------------------------------------------------------------------------
DestroyEnemy:
lda #$FF ; CPU:$DDDB PRG:1DDB A9 FF
sta $035E,x ; CPU:$DDDD PRG:1DDD 9D 5E 03
rts ; CPU:$DDE0 PRG:1DE0 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DDE1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: compares A with $05; branches on carry set
; to Sub_8764_OnCarrySet_DDED; loads A from $04AB,x; ANDs A with $BF;
; stores A to $04AB,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, $04AB, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DDE1:
cmp #$05 ; CPU:$DDE1 PRG:1DE1 C9 05
bcs Sub_8764_OnCarrySet_DDED ; CPU:$DDE3 PRG:1DE3 B0 08
lda $04AB,x ; CPU:$DDE5 PRG:1DE5 BD AB 04
and #$BF ; CPU:$DDE8 PRG:1DE8 29 BF
sta $04AB,x ; CPU:$DDEA PRG:1DEA 9D AB 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DDED
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: increments $051A,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N and Z flags, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DDED:
inc $051A,x ; CPU:$DDED PRG:1DED FE 1A 05
rts ; CPU:$DDF0 PRG:1DF0 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DDF1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp25; shifts a right; shifts a
; right; shifts a right; branches on equal to Sub_8764_OnZero_DDFB;
; sets the carry flag; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, Zp53, the OAM shadow,
; $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DDF1:
lda Zp25 ; CPU:$DDF1 PRG:1DF1 A5 25
lsr a ; CPU:$DDF3 PRG:1DF3 4A
lsr a ; CPU:$DDF4 PRG:1DF4 4A
lsr a ; CPU:$DDF5 PRG:1DF5 4A
beq Sub_8764_OnZero_DDFB ; CPU:$DDF6 PRG:1DF6 F0 03
sec ; CPU:$DDF8 PRG:1DF8 38
sbc #$01 ; CPU:$DDF9 PRG:1DF9 E9 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DDFB
; Global: The routine calls DrawFactoryAndTargetSprites.
; Local: Executes 1 instruction: calls DrawFactoryAndTargetSprites.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, Zp53, the OAM shadow,
; $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DDFB:
jmp DrawFactoryAndTargetSprites; CPU:$DDFB PRG:1DFB 4C D7 ED
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DDFE
; Global: The routine calls DrawFactoryAndTargetSprites.
; Local: Executes 9 instructions: rotates Zp26 right; loads A from Zp25;
; rotates a right; compares A with $20; branches on carry set to
; Sub_8764_OnCarrySet_DE0E; shifts a right; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp26, Zp52, Zp53, the OAM
; shadow, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DDFE:
ror Zp26 ; CPU:$DDFE PRG:1DFE 66 26
lda Zp25 ; CPU:$DE00 PRG:1E00 A5 25
ror a ; CPU:$DE02 PRG:1E02 6A
cmp #$20 ; CPU:$DE03 PRG:1E03 C9 20
bcs Sub_8764_OnCarrySet_DE0E ; CPU:$DE05 PRG:1E05 B0 07
lsr a ; CPU:$DE07 PRG:1E07 4A
lsr a ; CPU:$DE08 PRG:1E08 4A
eor #$87 ; CPU:$DE09 PRG:1E09 49 87
jsr DrawFactoryAndTargetSprites; CPU:$DE0B PRG:1E0B 20 D7 ED
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DE0E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DE0E:
rts ; CPU:$DE0E PRG:1E0E 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_DE0F
; Global: The routine calls CopyEnemyToNewSlot and PickRandomEnemyType.
; Local: Executes 4 instructions: calls CopyEnemyToNewSlot; calls PickRandomEnemyType; stores A to
; $051A,y; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_DE0F:
jsr CopyEnemyToNewSlot ; CPU:$DE0F PRG:1E0F 20 19 DE
jsr PickRandomEnemyType ; CPU:$DE12 PRG:1E12 20 F1 DC
sta $051A,y ; CPU:$DE15 PRG:1E15 99 1A 05
rts ; CPU:$DE18 PRG:1E18 60
; -----------------------------------------------------------------------------
; Routine: CopyEnemyToNewSlot
; Global: The routine calls CopyEnemyToSlot and DestroyEnemy.
; Local: Executes 10 instructions: copies Y into A; calls CopyEnemyToSlot; loads A
; from $043C,x; stores A to $043C,y; loads A from $04AB,x; ANDs A
; with $3F; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N and Z flags, Zp27, the OAM shadow, $035E, $03CD, $043C,
; $04AB.
;
; -----------------------------------------------------------------------------
CopyEnemyToNewSlot:
tya ; CPU:$DE19 PRG:1E19 98
jsr CopyEnemyToSlot ; CPU:$DE1A PRG:1E1A 20 39 E0
lda $043C,x ; CPU:$DE1D PRG:1E1D BD 3C 04
sta $043C,y ; CPU:$DE20 PRG:1E20 99 3C 04
lda $04AB,x ; CPU:$DE23 PRG:1E23 BD AB 04
and #$3F ; CPU:$DE26 PRG:1E26 29 3F
ora #$40 ; CPU:$DE28 PRG:1E28 09 40
sta $04AB,y ; CPU:$DE2A PRG:1E2A 99 AB 04
jsr DestroyEnemy ; CPU:$DE2D PRG:1E2D 20 DB DD
rts ; CPU:$DE30 PRG:1E30 60
; -----------------------------------------------------------------------------
; Routine: CompareObjectPositions
; Global: The routine calls ComputeObjectOffset.
; Local: Executes 6 instructions: calls ComputeObjectOffset; loads A from Zp26; compares
; A with Zp28; branches on carry clear to Sub_8764_OnCarryClear_DE63;
; branches on equal to Sub_8764_OnZero_DE3E; branches on carry set to
; Sub_8764_OnCarrySet_DE44.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
CompareObjectPositions:
jsr ComputeObjectOffset ; CPU:$DE31 PRG:1E31 20 65 E6
lda Zp26 ; CPU:$DE34 PRG:1E34 A5 26
cmp Zp28 ; CPU:$DE36 PRG:1E36 C5 28
bcc Sub_8764_OnCarryClear_DE63 ; CPU:$DE38 PRG:1E38 90 29
beq Sub_8764_OnZero_DE3E ; CPU:$DE3A PRG:1E3A F0 02
bcs Sub_8764_OnCarrySet_DE44 ; CPU:$DE3C PRG:1E3C B0 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DE3E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp25; compares A with Zp27;
; branches on carry clear to Sub_8764_OnCarryClear_DE63.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DE3E:
lda Zp25 ; CPU:$DE3E PRG:1E3E A5 25
cmp Zp27 ; CPU:$DE40 PRG:1E40 C5 27
bcc Sub_8764_OnCarryClear_DE63 ; CPU:$DE42 PRG:1E42 90 1F
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DE44
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp26; branches on not equal to
; Sub_8764_JoinBranchPaths_DE50; loads A from Zp25; compares A with
; Zp06; branches on carry set to Sub_8764_JoinBranchPaths_DE50; sets
; the carry flag; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DE44:
lda Zp26 ; CPU:$DE44 PRG:1E44 A5 26
bne Sub_8764_JoinBranchPaths_DE50 ; CPU:$DE46 PRG:1E46 D0 08
lda Zp25 ; CPU:$DE48 PRG:1E48 A5 25
cmp Zp06 ; CPU:$DE4A PRG:1E4A C5 06
bcs Sub_8764_JoinBranchPaths_DE50 ; CPU:$DE4C PRG:1E4C B0 02
sec ; CPU:$DE4E PRG:1E4E 38
rts ; CPU:$DE4F PRG:1E4F 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DE50
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: increments Zp03; increments Zp03; loads A
; from Zp28; branches on not equal to Sub_8764_JoinBranchPaths_DE60;
; loads A from Zp27; compares A with Zp05; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DE50:
inc Zp03 ; CPU:$DE50 PRG:1E50 E6 03
inc Zp03 ; CPU:$DE52 PRG:1E52 E6 03
lda Zp28 ; CPU:$DE54 PRG:1E54 A5 28
bne Sub_8764_JoinBranchPaths_DE60 ; CPU:$DE56 PRG:1E56 D0 08
lda Zp27 ; CPU:$DE58 PRG:1E58 A5 27
cmp Zp05 ; CPU:$DE5A PRG:1E5A C5 05
bcs Sub_8764_JoinBranchPaths_DE60 ; CPU:$DE5C PRG:1E5C B0 02
inc Zp03 ; CPU:$DE5E PRG:1E5E E6 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DE60
; Global: The routine calls SubCDE7B.
; Local: Executes 1 instruction: calls SubCDE7B.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DE60:
jmp SubCDE7B_Loop ; CPU:$DE60 PRG:1E60 4C 7B DE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DE63
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp28; branches on not equal to
; Sub_8764_JoinBranchPaths_DE6F; loads A from Zp27; compares A with
; Zp06; branches on carry set to Sub_8764_JoinBranchPaths_DE6F; sets
; the carry flag; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DE63:
lda Zp28 ; CPU:$DE63 PRG:1E63 A5 28
bne Sub_8764_JoinBranchPaths_DE6F ; CPU:$DE65 PRG:1E65 D0 08
lda Zp27 ; CPU:$DE67 PRG:1E67 A5 27
cmp Zp06 ; CPU:$DE69 PRG:1E69 C5 06
bcs Sub_8764_JoinBranchPaths_DE6F ; CPU:$DE6B PRG:1E6B B0 02
sec ; CPU:$DE6D PRG:1E6D 38
rts ; CPU:$DE6E PRG:1E6E 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DE6F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp26; branches on not equal to
; Sub_8764_OnNonzero_DE79; loads A from Zp25; compares A with Zp05;
; branches on carry clear to SubCDE7B.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DE6F:
lda Zp26 ; CPU:$DE6F PRG:1E6F A5 26
bne Sub_8764_OnNonzero_DE79 ; CPU:$DE71 PRG:1E71 D0 06
lda Zp25 ; CPU:$DE73 PRG:1E73 A5 25
cmp Zp05 ; CPU:$DE75 PRG:1E75 C5 05
bcc SubCDE7B_Loop ; CPU:$DE77 PRG:1E77 90 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DE79
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: increments Zp03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DE79:
inc Zp03 ; CPU:$DE79 PRG:1E79 E6 03
; -----------------------------------------------------------------------------
; Routine: SubCDE7B_Loop
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads Y from Zp03; loads A from $DEFC,y.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCDE7B_Loop:
ldy Zp03 ; CPU:$DE7B PRG:1E7B A4 03
lda $DEFC,y ; CPU:$DE7D PRG:1E7D B9 FC DE
; -----------------------------------------------------------------------------
; Routine: CompareEnemyToTarget
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 12 instructions: stores A to Zp2A; loads A from $043C,x;
; sets the carry flag; subtracts Zp40 from A; stores A to Zp29; sets
; the carry flag; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
CompareEnemyToTarget:
sta Zp2A ; CPU:$DE80 PRG:1E80 85 2A
lda $043C,x ; CPU:$DE82 PRG:1E82 BD 3C 04
sec ; CPU:$DE85 PRG:1E85 38
sbc Zp40 ; CPU:$DE86 PRG:1E86 E5 40
sta Zp29 ; CPU:$DE88 PRG:1E88 85 29
sec ; CPU:$DE8A PRG:1E8A 38
sbc Zp2A ; CPU:$DE8B PRG:1E8B E5 2A
beq Sub_8764_OnZero_DEAB ; CPU:$DE8D PRG:1E8D F0 1C
bmi Sub_8764_OnNegative_DE97 ; CPU:$DE8F PRG:1E8F 30 06
cmp #$06 ; CPU:$DE91 PRG:1E91 C9 06
bcc Sub_8764_OnCarryClear_DE9B ; CPU:$DE93 PRG:1E93 90 06
bcs Sub_8764_OnCarrySet_DEAD ; CPU:$DE95 PRG:1E95 B0 16
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_DE97
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: compares A with $FA; branches on carry set
; to Sub_8764_OnCarrySet_DEAD.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_DE97:
cmp #$FA ; CPU:$DE97 PRG:1E97 C9 FA
bcs Sub_8764_OnCarrySet_DEAD ; CPU:$DE99 PRG:1E99 B0 12
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DE9B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: decrements Zp29; branches on non-negative to
; Sub_8764_JoinBranchPaths_DEA3; loads A with $0B; stores A to Zp29.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp29, $043C.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DE9B:
dec Zp29 ; CPU:$DE9B PRG:1E9B C6 29
bpl Sub_8764_JoinBranchPaths_DEA3 ; CPU:$DE9D PRG:1E9D 10 04
lda #$0B ; CPU:$DE9F PRG:1E9F A9 0B
sta Zp29 ; CPU:$DEA1 PRG:1EA1 85 29
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_DEA3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A from Zp29; clears the carry flag;
; adds Zp40 to A; stores A to $043C,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, $043C.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_DEA3:
lda Zp29 ; CPU:$DEA3 PRG:1EA3 A5 29
clc ; CPU:$DEA5 PRG:1EA5 18
adc Zp40 ; CPU:$DEA6 PRG:1EA6 65 40
sta $043C,x ; CPU:$DEA8 PRG:1EA8 9D 3C 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_DEAB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: clears the carry flag.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_DEAB:
clc ; CPU:$DEAB PRG:1EAB 18
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_DEAC
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_DEAC:
rts ; CPU:$DEAC PRG:1EAC 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_DEAD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 13 instructions: loads A from Zp29; clears the carry flag;
; adds Zp40 to A; stores A to $043C,x; clears the carry flag; returns
; with RTS; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_DEAD:
inc Zp29 ; CPU:$DEAD PRG:1EAD E6 29
lda Zp29 ; CPU:$DEAF PRG:1EAF A5 29
cmp #$0C ; CPU:$DEB1 PRG:1EB1 C9 0C
bcc Sub_8764_JoinBranchPaths_DEA3 ; CPU:$DEB3 PRG:1EB3 90 EE
lda #$00 ; CPU:$DEB5 PRG:1EB5 A9 00
sta Zp29 ; CPU:$DEB7 PRG:1EB7 85 29
beq Sub_8764_JoinBranchPaths_DEA3 ; CPU:$DEB9 PRG:1EB9 F0 E8
; -----------------------------------------------------------------------------
; Routine: LoadLevelSpriteEntry
; Global: The routine calls SplitByteIntoNibbles and CompareObjectPositions.
; Local: Executes 24 instructions: returns with RTS; loads A from $051A,x;
; copies A into Y; loads A from $DF0D,y; copies A into Y; loads A
; from $DFE4,y; and 18 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
LoadLevelSpriteEntry:
lda $051A,x ; CPU:$DEBB PRG:1EBB BD 1A 05
tay ; CPU:$DEBE PRG:1EBE A8
lda $DF0D,y ; CPU:$DEBF PRG:1EBF B9 0D DF
tay ; CPU:$DEC2 PRG:1EC2 A8
lda $DFE4,y ; CPU:$DEC3 PRG:1EC3 B9 E4 DF
sta Zp28 ; CPU:$DEC6 PRG:1EC6 85 28
lda $DFA8,y ; CPU:$DEC8 PRG:1EC8 B9 A8 DF
jsr SplitByteIntoNibbles ; CPU:$DECB PRG:1ECB 20 20 E0
jsr CompareObjectPositions ; CPU:$DECE PRG:1ECE 20 31 DE
bcc Sub_8764_OnCarryClear_DEAC ; CPU:$DED1 PRG:1ED1 90 D9
inc $051A,x ; CPU:$DED3 PRG:1ED3 FE 1A 05
lda $051A,x ; CPU:$DED6 PRG:1ED6 BD 1A 05
tay ; CPU:$DED9 PRG:1ED9 A8
lda $DF0D,y ; CPU:$DEDA PRG:1EDA B9 0D DF
bne Sub_8764_OnNonzero_DEFB ; CPU:$DEDD PRG:1EDD D0 1C
dey ; CPU:$DEDF PRG:1EDF 88
stx Zp27 ; CPU:$DEE0 PRG:1EE0 86 27
lda $DF0D,y ; CPU:$DEE2 PRG:1EE2 B9 0D DF
and #$07 ; CPU:$DEE5 PRG:1EE5 29 07
tax ; CPU:$DEE7 PRG:1EE7 AA
inc $06A6,x ; CPU:$DEE8 PRG:1EE8 FE A6 06
inc $06A6,x ; CPU:$DEEB PRG:1EEB FE A6 06
ldx Zp27 ; CPU:$DEEE PRG:1EEE A6 27
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DEF0
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: decrements Y; loads A from $DF0D,y; branches
; on not equal to Sub_8764_OnNonzero_DEF0; increments Y; copies Y
; into A; stores A to $051A,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N and Z flags, $051A.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DEF0:
dey ; CPU:$DEF0 PRG:1EF0 88
lda $DF0D,y ; CPU:$DEF1 PRG:1EF1 B9 0D DF
bne Sub_8764_OnNonzero_DEF0 ; CPU:$DEF4 PRG:1EF4 D0 FA
iny ; CPU:$DEF6 PRG:1EF6 C8
tya ; CPU:$DEF7 PRG:1EF7 98
sta $051A,x ; CPU:$DEF8 PRG:1EF8 9D 1A 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_DEFB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_DEFB:
rts ; CPU:$DEFB PRG:1EFB 60
; ---- data $DEFC-$E01F (292 bytes) ----
; referenced by `lda $DEFC,y` at $DCB6 (operand $DEFC falls inside this region)
; referenced by `lda $DEFC,y` at $DE7D (operand $DEFC falls inside this region)
; referenced by `lda $DF0D,y` at $DEBF (operand $DF0D falls inside this region)
; referenced by `lda $DFE4,y` at $DEC3 (operand $DFE4 falls inside this region)
; referenced by `lda $DFA8,y` at $DEC8 (operand $DFA8 falls inside this region)
; referenced by `lda $DF0D,y` at $DEDA (operand $DF0D falls inside this region)
; ... and 2 further references from decoded code
LevelSpriteData:
.byte $00, $0B, $0A, $09, $06, $07, $08, $09, $00, $01, $02, $03, $06, $05, $04, $03 ; CPU:$DEFC PRG:1EFC 00 0B 0A 09 06 07 08 09 00 01 02 03 06 05 04 03
.byte $00, $00, $00, $07, $08, $0F, $10, $01, $00, $0E, $11, $13, $15, $14, $11, $10 ; CPU:$DF0C PRG:1F0C 00 00 00 07 08 0F 10 01 00 0E 11 13 15 14 11 10
.byte $01, $00, $07, $2B, $2A, $29, $0D, $0F, $10, $01, $00, $1E, $23, $33, $38, $17 ; CPU:$DF1C PRG:1F1C 01 00 07 2B 2A 29 0D 0F 10 01 00 1E 23 33 38 17
.byte $37, $35, $33, $23, $1D, $1C, $02, $00, $1E, $1F, $21, $20, $1D, $1C, $02, $00 ; CPU:$DF2C PRG:1F2C 37 35 33 23 1D 1C 02 00 1E 1F 21 20 1D 1C 02 00
.byte $1E, $22, $24, $25, $1B, $20, $1D, $1C, $02, $00, $12, $11, $0E, $07, $08, $11 ; CPU:$DF3C PRG:1F3C 1E 22 24 25 1B 20 1D 1C 02 00 12 11 0E 07 08 11
.byte $14, $16, $03, $00, $12, $13, $15, $16, $03, $00, $12, $14, $19, $1B, $24, $25 ; CPU:$DF4C PRG:1F4C 14 16 03 00 12 13 15 16 03 00 12 14 19 1B 24 25
.byte $1A, $16, $03, $00, $0C, $0A, $09, $0B, $04, $00, $0C, $0D, $11, $13, $15, $18 ; CPU:$DF5C PRG:1F5C 1A 16 03 00 0C 0A 09 0B 04 00 0C 0D 11 13 15 18
.byte $38, $3A, $0B, $04, $00, $0C, $29, $2C, $2A, $0B, $04, $00, $36, $38, $17, $37 ; CPU:$DF6C PRG:1F6C 38 3A 0B 04 00 0C 29 2C 2A 0B 04 00 36 38 17 37
.byte $39, $05, $00, $35, $33, $31, $32, $36, $39, $05, $00, $36, $38, $1B, $24, $25 ; CPU:$DF7C PRG:1F7C 39 05 00 35 33 31 32 36 39 05 00 36 38 1B 24 25
.byte $26, $27, $28, $39, $05, $00, $30, $38, $17, $37, $35, $2E, $2F, $06, $00, $30 ; CPU:$DF8C PRG:1F8C 26 27 28 39 05 00 30 38 17 37 35 2E 2F 06 00 30
.byte $33, $31, $2E, $2F, $06, $00, $2E, $2D, $2F, $06, $00, $00, $00, $D3, $C5, $86 ; CPU:$DF9C PRG:1F9C 33 31 2E 2F 06 00 2E 2D 2F 06 00 00 00 D3 C5 86
.byte $C1, $C9, $4A, $C2, $82, $81, $02, $01, $02, $03, $43, $04, $84, $05, $06, $85 ; CPU:$DFAC PRG:1FAC C1 C9 4A C2 82 81 02 01 02 03 43 04 84 05 06 85
.byte $06, $06, $D6, $A6, $C7, $08, $18, $28, $45, $65, $26, $87, $28, $08, $98, $47 ; CPU:$DFBC PRG:1FBC 06 06 D6 A6 C7 08 18 28 45 65 26 87 28 08 98 47
.byte $C9, $F9, $C9, $0B, $8B, $0C, $4B, $5B, $0C, $2A, $89, $CA, $89, $68, $49, $08 ; CPU:$DFCC PRG:1FCC C9 F9 C9 0B 8B 0C 4B 5B 0C 2A 89 CA 89 68 49 08
.byte $69, $08, $89, $86, $C7, $CB, $01, $01, $00, $EB, $83, $6D, $3E, $D7, $5A, $04 ; CPU:$DFDC PRG:1FDC 69 08 89 86 C7 CB 01 01 00 EB 83 6D 3E D7 5A 04
.byte $84, $BC, $05, $06, $85, $05, $84, $84, $44, $85, $85, $86, $06, $E6, $C5, $CF ; CPU:$DFEC PRG:1FEC 84 BC 05 06 85 05 84 84 44 85 85 86 06 E6 C5 CF
.byte $C6, $06, $45, $84, $43, $83, $43, $43, $C3, $1B, $83, $82, $04, $44, $05, $25 ; CPU:$DFFC PRG:1FFC C6 06 45 84 43 83 43 43 C3 1B 83 82 04 44 05 25
.byte $C5, $05, $04, $83, $03, $43, $03, $C2, $82, $42, $02, $F1, $21, $01, $80, $01 ; CPU:$E00C PRG:200C C5 05 04 83 03 43 03 C2 82 42 02 F1 21 01 80 01
.byte $40, $60, $C0, $40 ; CPU:$E01C PRG:201C 40 60 C0 40
; -----------------------------------------------------------------------------
; Routine: SplitByteIntoNibbles
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 13 instructions: stores A to Zp26; ANDs A with $F0; stores A
; to Zp25; loads A from Zp26; ANDs A with $0F; stores A to Zp26; and
; 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, Zp25, Zp26, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
SplitByteIntoNibbles:
sta Zp26 ; CPU:$E020 PRG:2020 85 26
and #$F0 ; CPU:$E022 PRG:2022 29 F0
sta Zp25 ; CPU:$E024 PRG:2024 85 25
lda Zp26 ; CPU:$E026 PRG:2026 A5 26
and #$0F ; CPU:$E028 PRG:2028 29 0F
sta Zp26 ; CPU:$E02A PRG:202A 85 26
lda Zp28 ; CPU:$E02C PRG:202C A5 28
and #$F8 ; CPU:$E02E PRG:202E 29 F8
sta Zp27 ; CPU:$E030 PRG:2030 85 27
lda Zp28 ; CPU:$E032 PRG:2032 A5 28
and #$07 ; CPU:$E034 PRG:2034 29 07
sta Zp28 ; CPU:$E036 PRG:2036 85 28
rts ; CPU:$E038 PRG:2038 60
; -----------------------------------------------------------------------------
; Routine: CopyEnemyToSlot
; Global: The routine calls CopyEnemyRecord.
; Local: Executes 5 instructions: stores Y to Zp27; copies A into Y; calls
; CopyEnemyRecord; loads Y from Zp27; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N and Z flags, Zp27, the OAM shadow, $035E, $03CD.
;
; -----------------------------------------------------------------------------
CopyEnemyToSlot:
sty Zp27 ; CPU:$E039 PRG:2039 84 27
tay ; CPU:$E03B PRG:203B A8
jsr CopyEnemyRecord ; CPU:$E03C PRG:203C 20 42 E0
ldy Zp27 ; CPU:$E03F PRG:203F A4 27
rts ; CPU:$E041 PRG:2041 60
; -----------------------------------------------------------------------------
; Routine: CopyEnemyRecord
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: loads A from $035E,x; stores A to $035E,y;
; loads A from $0280,x; stores A to $0280,y; loads A from $03CD,x;
; stores A to $03CD,y; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, the OAM shadow, $035E, $03CD.
;
; -----------------------------------------------------------------------------
CopyEnemyRecord:
lda $035E,x ; CPU:$E042 PRG:2042 BD 5E 03
sta $035E,y ; CPU:$E045 PRG:2045 99 5E 03
lda $0280,x ; CPU:$E048 PRG:2048 BD 80 02
sta $0280,y ; CPU:$E04B PRG:204B 99 80 02
lda $03CD,x ; CPU:$E04E PRG:204E BD CD 03
sta $03CD,y ; CPU:$E051 PRG:2051 99 CD 03
lda $02EF,x ; CPU:$E054 PRG:2054 BD EF 02
sta $02EF,y ; CPU:$E057 PRG:2057 99 EF 02
rts ; CPU:$E05A PRG:205A 60
; -----------------------------------------------------------------------------
; Routine: CheckPlayerInRadarRange
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 10 instructions: loads A from ZpA5; ANDs A with ZpC0;
; branches on equal to Sub_8764_JoinBranchPaths_E072; loads A from
; ZpB3; branches on negative to Sub_8764_JoinBranchPaths_E072; loads
; A from ZpD4; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
CheckPlayerInRadarRange:
lda ZpA5 ; CPU:$E05B PRG:205B A5 A5
and ZpC0 ; CPU:$E05D PRG:205D 25 C0
beq Sub_8764_JoinBranchPaths_E072 ; CPU:$E05F PRG:205F F0 11
lda ZpB3 ; CPU:$E061 PRG:2061 A5 B3
bmi Sub_8764_JoinBranchPaths_E072 ; CPU:$E063 PRG:2063 30 0D
lda ZpD4 ; CPU:$E065 PRG:2065 A5 D4
beq Sub_8764_OnZero_E06F ; CPU:$E067 PRG:2067 F0 06
lda ZpC9 ; CPU:$E069 PRG:2069 A5 C9
cmp #$02 ; CPU:$E06B PRG:206B C9 02
beq Sub_8764_JoinBranchPaths_E072 ; CPU:$E06D PRG:206D F0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E06F
; Global: The routine calls RandomizeEnemySpawn.
; Local: Executes 1 instruction: calls RandomizeEnemySpawn.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E06F:
jmp RandomizeEnemySpawn ; CPU:$E06F PRG:206F 4C 67 E1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E072
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from Zp95,y; compares A with $89;
; branches on carry clear to Sub_8764_OnCarryClear_E082; sets the
; carry flag; subtracts $89 from A; stores A to Zp27; and 2 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E072:
lda a:Zp95,y ; CPU:$E072 PRG:2072 B9 95 00
cmp #$89 ; CPU:$E075 PRG:2075 C9 89
bcc Sub_8764_OnCarryClear_E082 ; CPU:$E077 PRG:2077 90 09
sec ; CPU:$E079 PRG:2079 38
sbc #$89 ; CPU:$E07A PRG:207A E9 89
sta Zp27 ; CPU:$E07C PRG:207C 85 27
lda #$00 ; CPU:$E07E PRG:207E A9 00
beq Sub_8764_OnZero_E08C ; CPU:$E080 PRG:2080 F0 0A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E082
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: sets the carry flag; loads A with $89;
; subtracts Zp95,y from A; stores A to Zp27; loads A with $80.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E082:
sec ; CPU:$E082 PRG:2082 38
lda #$89 ; CPU:$E083 PRG:2083 A9 89
sbc a:Zp95,y ; CPU:$E085 PRG:2085 F9 95 00
sta Zp27 ; CPU:$E088 PRG:2088 85 27
lda #$80 ; CPU:$E08A PRG:208A A9 80
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E08C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 13 instructions: stores A to Zp29; loads A from $E6CD,y;
; ANDs A with Zp36; branches on not equal to
; Sub_8764_JoinBranchPaths_E0A8; loads A from Zp85,y; compares A with
; $AB; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E08C:
sta Zp29 ; CPU:$E08C PRG:208C 85 29
lda $E6CD,y ; CPU:$E08E PRG:208E B9 CD E6
and Zp36 ; CPU:$E091 PRG:2091 25 36
bne Sub_8764_JoinBranchPaths_E0A8 ; CPU:$E093 PRG:2093 D0 13
lda a:Zp85,y ; CPU:$E095 PRG:2095 B9 85 00
cmp #$AB ; CPU:$E098 PRG:2098 C9 AB
bcs Sub_8764_JoinBranchPaths_E0A8 ; CPU:$E09A PRG:209A B0 0C
sec ; CPU:$E09C PRG:209C 38
lda #$AB ; CPU:$E09D PRG:209D A9 AB
sbc a:Zp85,y ; CPU:$E09F PRG:209F F9 85 00
sta Zp25 ; CPU:$E0A2 PRG:20A2 85 25
lda #$80 ; CPU:$E0A4 PRG:20A4 A9 80
bne Sub_8764_OnNonzero_E0B2 ; CPU:$E0A6 PRG:20A6 D0 0A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E0A8
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts $AB from A; stores A to Zp25; loads A with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E0A8:
sec ; CPU:$E0A8 PRG:20A8 38
lda a:Zp85,y ; CPU:$E0A9 PRG:20A9 B9 85 00
sbc #$AB ; CPU:$E0AC PRG:20AC E9 AB
sta Zp25 ; CPU:$E0AE PRG:20AE 85 25
lda #$00 ; CPU:$E0B0 PRG:20B0 A9 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E0B2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 12 instructions: stores A to Zp2A; loads A with $01; stores
; A to Zp03; loads A from Zp27; compares A with Zp25; branches on
; carry clear to Sub_8764_OnCarryClear_E0C8; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E0B2:
sta Zp2A ; CPU:$E0B2 PRG:20B2 85 2A
lda #$01 ; CPU:$E0B4 PRG:20B4 A9 01
sta Zp03 ; CPU:$E0B6 PRG:20B6 85 03
lda Zp27 ; CPU:$E0B8 PRG:20B8 A5 27
cmp Zp25 ; CPU:$E0BA PRG:20BA C5 25
bcc Sub_8764_OnCarryClear_E0C8 ; CPU:$E0BC PRG:20BC 90 0A
lsr a ; CPU:$E0BE PRG:20BE 4A
lsr a ; CPU:$E0BF PRG:20BF 4A
cmp Zp25 ; CPU:$E0C0 PRG:20C0 C5 25
bcs Sub_8764_JoinBranchPaths_E0D6 ; CPU:$E0C2 PRG:20C2 B0 12
inc Zp03 ; CPU:$E0C4 PRG:20C4 E6 03
bcc Sub_8764_JoinBranchPaths_E0D6 ; CPU:$E0C6 PRG:20C6 90 0E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E0C8
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from Zp25; shifts a right; shifts a
; right; compares A with Zp27; branches on carry clear to
; Sub_8764_OnCarryClear_E0D2; increments Zp03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E0C8:
lda Zp25 ; CPU:$E0C8 PRG:20C8 A5 25
lsr a ; CPU:$E0CA PRG:20CA 4A
lsr a ; CPU:$E0CB PRG:20CB 4A
cmp Zp27 ; CPU:$E0CC PRG:20CC C5 27
bcc Sub_8764_OnCarryClear_E0D2 ; CPU:$E0CE PRG:20CE 90 02
inc Zp03 ; CPU:$E0D0 PRG:20D0 E6 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E0D2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: increments Zp03; increments Zp03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E0D2:
inc Zp03 ; CPU:$E0D2 PRG:20D2 E6 03
inc Zp03 ; CPU:$E0D4 PRG:20D4 E6 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E0D6
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from Zp29; branches on non-negative
; to Sub_8764_OnNonnegative_E0E1; clears the carry flag; loads A from
; Zp03; adds $04 to A; stores A to Zp03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E0D6:
lda Zp29 ; CPU:$E0D6 PRG:20D6 A5 29
bpl Sub_8764_OnNonnegative_E0E1; CPU:$E0D8 PRG:20D8 10 07
clc ; CPU:$E0DA PRG:20DA 18
lda Zp03 ; CPU:$E0DB PRG:20DB A5 03
adc #$04 ; CPU:$E0DD PRG:20DD 69 04
sta Zp03 ; CPU:$E0DF PRG:20DF 85 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E0E1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from Zp2A; branches on negative to
; Sub_8764_OnNegative_E0EC; clears the carry flag; loads A from Zp03;
; adds $08 to A; stores A to Zp03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E0E1:
lda Zp2A ; CPU:$E0E1 PRG:20E1 A5 2A
bmi Sub_8764_OnNegative_E0EC ; CPU:$E0E3 PRG:20E3 30 07
clc ; CPU:$E0E5 PRG:20E5 18
lda Zp03 ; CPU:$E0E6 PRG:20E6 A5 03
adc #$08 ; CPU:$E0E8 PRG:20E8 69 08
sta Zp03 ; CPU:$E0EA PRG:20EA 85 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_E0EC
; Global: The routine calls IsRadarBlipVisible.
; Local: Executes 16 instructions: loads X from Zp03; loads A with $90; stores
; A to Zp40; calls IsRadarBlipVisible; branches on equal to
; Sub_8764_OnZero_E126; increments ZpDE; and 10 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_E0EC:
ldx Zp03 ; CPU:$E0EC PRG:20EC A6 03
lda #$90 ; CPU:$E0EE PRG:20EE A9 90
sta Zp40 ; CPU:$E0F0 PRG:20F0 85 40
jsr IsRadarBlipVisible ; CPU:$E0F2 PRG:20F2 20 57 E1
beq Sub_8764_OnZero_E126 ; CPU:$E0F5 PRG:20F5 F0 2F
inc ZpDE ; CPU:$E0F7 PRG:20F7 E6 DE
lda ZpDE ; CPU:$E0F9 PRG:20F9 A5 DE
and #$03 ; CPU:$E0FB PRG:20FB 29 03
bne Sub_8764_JoinBranchPaths_E121 ; CPU:$E0FD PRG:20FD D0 22
lda Zp51 ; CPU:$E0FF PRG:20FF A5 51
and #$02 ; CPU:$E101 PRG:2101 29 02
beq Sub_8764_OnZero_E110 ; CPU:$E103 PRG:2103 F0 0B
ldx ZpDD ; CPU:$E105 PRG:2105 A6 DD
cpx #$00 ; CPU:$E107 PRG:2107 E0 00
bne Sub_8764_OnNonzero_E10D ; CPU:$E109 PRG:2109 D0 02
ldx #$0C ; CPU:$E10B PRG:210B A2 0C
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E10D
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: decrements X; stores X to ZpDD.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E10D:
dex ; CPU:$E10D PRG:210D CA
stx ZpDD ; CPU:$E10E PRG:210E 86 DD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E110
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp51; ANDs A with $01; branches
; on equal to Sub_8764_JoinBranchPaths_E121; loads X from ZpDD;
; compares X with $0B; branches on not equal to
; Sub_8764_OnNonzero_E11E; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E110:
lda Zp51 ; CPU:$E110 PRG:2110 A5 51
and #$01 ; CPU:$E112 PRG:2112 29 01
beq Sub_8764_JoinBranchPaths_E121 ; CPU:$E114 PRG:2114 F0 0B
ldx ZpDD ; CPU:$E116 PRG:2116 A6 DD
cpx #$0B ; CPU:$E118 PRG:2118 E0 0B
bne Sub_8764_OnNonzero_E11E ; CPU:$E11A PRG:211A D0 02
ldx #$FF ; CPU:$E11C PRG:211C A2 FF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E11E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: increments X; stores X to ZpDD.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E11E:
inx ; CPU:$E11E PRG:211E E8
stx ZpDD ; CPU:$E11F PRG:211F 86 DD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E121
; Global: The routine calls CheckEnemyOnRadar.
; Local: Executes 2 instructions: loads A from ZpDD; calls CheckEnemyOnRadar.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E121:
lda ZpDD ; CPU:$E121 PRG:2121 A5 DD
jmp CheckEnemyOnRadar ; CPU:$E123 PRG:2123 4C 29 E1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E126
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A from $E146,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E126:
lda $E146,x ; CPU:$E126 PRG:2126 BD 46 E1
; -----------------------------------------------------------------------------
; Routine: CheckEnemyOnRadar
; Global: The routine calls CompareEnemyToTarget and IsRadarBlipVisible.
; Local: Executes 13 instructions: pushes A; loads A from Zp65,y; copies A
; into X; pulls A; calls CompareEnemyToTarget; calls IsRadarBlipVisible; and 7 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
CheckEnemyOnRadar:
pha ; CPU:$E129 PRG:2129 48
lda a:Zp65,y ; CPU:$E12A PRG:212A B9 65 00
tax ; CPU:$E12D PRG:212D AA
pla ; CPU:$E12E PRG:212E 68
jsr CompareEnemyToTarget ; CPU:$E12F PRG:212F 20 80 DE
jsr IsRadarBlipVisible ; CPU:$E132 PRG:2132 20 57 E1
beq Sub_8764_OnZero_E143 ; CPU:$E135 PRG:2135 F0 0C
lda Zp51 ; CPU:$E137 PRG:2137 A5 51
and #$80 ; CPU:$E139 PRG:2139 29 80
bne Sub_8764_JoinBranchPaths_E18E ; CPU:$E13B PRG:213B D0 51
lda Zp51 ; CPU:$E13D PRG:213D A5 51
and #$40 ; CPU:$E13F PRG:213F 29 40
bne Sub_8764_OnNonzero_E17B ; CPU:$E141 PRG:2141 D0 38
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E143
; Global: The routine calls SubCE320.
; Local: Executes 1 instruction: calls SubCE320.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E143:
jmp SubCE320_Loop ; CPU:$E143 PRG:2143 4C 20 E3
; ---- data $E146-$E156 (17 bytes) ----
; referenced by `lda $E146,x` at $E126 (operand $E146 falls inside this region)
SproutTileTable2:
.byte $00, $00, $01, $02, $03, $06, $05, $04, $03, $00, $0B, $0A, $09, $06, $07, $08 ; CPU:$E146 PRG:2146 00 00 01 02 03 06 05 04 03 00 0B 0A 09 06 07 08
.byte $09 ; CPU:$E156 PRG:2156 09
; -----------------------------------------------------------------------------
; Routine: IsRadarBlipVisible
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from ZpD4; branches on equal to
; Sub_8764_JoinBranchPaths_E164; loads A from ZpC9; compares A with
; $02; branches on not equal to Sub_8764_JoinBranchPaths_E164; loads
; A with $01; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
IsRadarBlipVisible:
lda ZpD4 ; CPU:$E157 PRG:2157 A5 D4
beq Sub_8764_JoinBranchPaths_E164 ; CPU:$E159 PRG:2159 F0 09
lda ZpC9 ; CPU:$E15B PRG:215B A5 C9
cmp #$02 ; CPU:$E15D PRG:215D C9 02
bne Sub_8764_JoinBranchPaths_E164 ; CPU:$E15F PRG:215F D0 03
lda #$01 ; CPU:$E161 PRG:2161 A9 01
rts ; CPU:$E163 PRG:2163 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E164
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $00; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E164:
lda #$00 ; CPU:$E164 PRG:2164 A9 00
rts ; CPU:$E166 PRG:2166 60
; -----------------------------------------------------------------------------
; Routine: RandomizeEnemySpawn
; Global: The routine calls UpdatePseudoRandomNumber.
; Local: Executes 3 instructions: calls UpdatePseudoRandomNumber; compares A with ZpBF;
; branches on carry clear to Sub_8764_JoinBranchPaths_E18E.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
RandomizeEnemySpawn:
jsr UpdatePseudoRandomNumber ; CPU:$E167 PRG:2167 20 12 C4
cmp ZpBF ; CPU:$E16A PRG:216A C5 BF
bcc Sub_8764_JoinBranchPaths_E18E ; CPU:$E16C PRG:216C 90 20
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_E16E
; Global: The routine calls UpdatePseudoRandomNumber.
; Local: Executes 6 instructions: loads A from ZpBD; compares A with $04;
; branches on carry set to Sub_8764_JoinBranchPaths_E18B; calls
; UpdatePseudoRandomNumber; compares A with $FA; branches on carry clear to
; Sub_8764_JoinBranchPaths_E18B.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_E16E:
lda ZpBD ; CPU:$E16E PRG:216E A5 BD
cmp #$04 ; CPU:$E170 PRG:2170 C9 04
bcs Sub_8764_JoinBranchPaths_E18B ; CPU:$E172 PRG:2172 B0 17
jsr UpdatePseudoRandomNumber ; CPU:$E174 PRG:2174 20 12 C4
cmp #$FA ; CPU:$E177 PRG:2177 C9 FA
bcc Sub_8764_JoinBranchPaths_E18B ; CPU:$E179 PRG:2179 90 10
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E17B
; Global: The routine calls SpawnEnemySprite.
; Local: Executes 7 instructions: loads A from $043C,x; stores X to Zp26;
; copies A into X; loads A from $DBCB,x; stores A to Zp25; loads X
; from Zp26; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E17B:
lda $043C,x ; CPU:$E17B PRG:217B BD 3C 04
stx Zp26 ; CPU:$E17E PRG:217E 86 26
tax ; CPU:$E180 PRG:2180 AA
lda $DBCB,x ; CPU:$E181 PRG:2181 BD CB DB
sta Zp25 ; CPU:$E184 PRG:2184 85 25
ldx Zp26 ; CPU:$E186 PRG:2186 A6 26
jsr SpawnEnemySprite ; CPU:$E188 PRG:2188 20 99 E4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E18B
; Global: The routine calls SubCE320.
; Local: Executes 1 instruction: calls SubCE320.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E18B:
jmp SubCE320_Loop ; CPU:$E18B PRG:218B 4C 20 E3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E18E
; Global: The routine calls UpdatePseudoRandomNumber, SpawnEnemySprite, SubCE320 and CopyEnemyToSlot, writes
; $043E, reads $04AD.
; Local: Executes 27 instructions: loads A from ZpBD; compares A with $04;
; branches on carry set to Sub_8764_JoinBranchPaths_E18B; calls
; UpdatePseudoRandomNumber; compares A with $FA; branches on carry clear to
; Sub_8764_JoinBranchPaths_E18B; and 21 more instructions.
; Parameters: Reads $04AD from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $043E changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E18E:
lda $04AD ; CPU:$E18E PRG:218E AD AD 04
bmi Sub_8764_OnNegative_E16E ; CPU:$E191 PRG:2191 30 DB
lda Zp09 ; CPU:$E193 PRG:2193 A5 09
bne Sub_8764_JoinBranchPaths_E18B ; CPU:$E195 PRG:2195 D0 F4
lda #$02 ; CPU:$E197 PRG:2197 A9 02
jsr CopyEnemyToSlot ; CPU:$E199 PRG:2199 20 39 E0
lda #$7C ; CPU:$E19C PRG:219C A9 7C
sta $043E ; CPU:$E19E PRG:219E 8D 3E 04
sec ; CPU:$E1A1 PRG:21A1 38
lda a:Zp95,y ; CPU:$E1A2 PRG:21A2 B9 95 00
sbc #$89 ; CPU:$E1A5 PRG:21A5 E9 89
bpl Sub_8764_OnNonnegative_E1AB; CPU:$E1A7 PRG:21A7 10 02
eor #$FF ; CPU:$E1A9 PRG:21A9 49 FF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E1AB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: stores A to Zp05; sets the carry flag; loads
; A from Zp85,y; subtracts $AB from A; branches on non-negative to
; Sub_8764_OnNonnegative_E1B7; EORs A with $FF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E1AB:
sta Zp05 ; CPU:$E1AB PRG:21AB 85 05
sec ; CPU:$E1AD PRG:21AD 38
lda a:Zp85,y ; CPU:$E1AE PRG:21AE B9 85 00
sbc #$AB ; CPU:$E1B1 PRG:21B1 E9 AB
bpl Sub_8764_OnNonnegative_E1B7; CPU:$E1B3 PRG:21B3 10 02
eor #$FF ; CPU:$E1B5 PRG:21B5 49 FF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E1B7
; Global: The routine calls ComputeSpawnRow.
; Local: Executes 5 instructions: compares A with Zp05; pushes the processor
; status; branches on carry set to Sub_8764_OnCarrySet_E1C0; shifts a
; right; calls ComputeSpawnRow.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E1B7:
cmp Zp05 ; CPU:$E1B7 PRG:21B7 C5 05
php ; CPU:$E1B9 PRG:21B9 08
bcs Sub_8764_OnCarrySet_E1C0 ; CPU:$E1BA PRG:21BA B0 04
lsr a ; CPU:$E1BC PRG:21BC 4A
jmp ComputeSpawnRow ; CPU:$E1BD PRG:21BD 4C C2 E1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E1C0
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: shifts Zp05 right.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E1C0:
lsr Zp05 ; CPU:$E1C0 PRG:21C0 46 05
; -----------------------------------------------------------------------------
; Routine: ComputeSpawnRow
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: clears the carry flag; adds Zp05 to A;
; shifts a right; shifts a right; shifts a right; pulls the processor
; status; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C, I and V flags, Zp03, Zp43, Zp44, $058B.
;
; -----------------------------------------------------------------------------
ComputeSpawnRow:
clc ; CPU:$E1C2 PRG:21C2 18
adc Zp05 ; CPU:$E1C3 PRG:21C3 65 05
lsr a ; CPU:$E1C5 PRG:21C5 4A
lsr a ; CPU:$E1C6 PRG:21C6 4A
lsr a ; CPU:$E1C7 PRG:21C7 4A
plp ; CPU:$E1C8 PRG:21C8 28
bcs Sub_8764_OnCarrySet_E1CE ; CPU:$E1C9 PRG:21C9 B0 03
clc ; CPU:$E1CB PRG:21CB 18
adc #$03 ; CPU:$E1CC PRG:21CC 69 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E1CE
; Global: The routine calls SubCE320, writes $058B.
; Local: Executes 14 instructions: clears the carry flag; adds $01 to A;
; stores A to $058B; stores Y to Zp03; sets the carry flag; loads A
; from $043C,x; and 8 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $058B changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E1CE:
clc ; CPU:$E1CE PRG:21CE 18
adc #$01 ; CPU:$E1CF PRG:21CF 69 01
sta $058B ; CPU:$E1D1 PRG:21D1 8D 8B 05
sty Zp03 ; CPU:$E1D4 PRG:21D4 84 03
sec ; CPU:$E1D6 PRG:21D6 38
lda $043C,x ; CPU:$E1D7 PRG:21D7 BD 3C 04
sbc #$90 ; CPU:$E1DA PRG:21DA E9 90
tay ; CPU:$E1DC PRG:21DC A8
lda $E1EC,y ; CPU:$E1DD PRG:21DD B9 EC E1
sta Zp43 ; CPU:$E1E0 PRG:21E0 85 43
lda $E1F9,y ; CPU:$E1E2 PRG:21E2 B9 F9 E1
sta Zp44 ; CPU:$E1E5 PRG:21E5 85 44
ldy Zp03 ; CPU:$E1E7 PRG:21E7 A4 03
jmp SubCE320_Loop ; CPU:$E1E9 PRG:21E9 4C 20 E3
; ---- data $E1EC-$E205 (26 bytes) ----
; referenced by `lda $E1EC,y` at $E1DD (operand $E1EC falls inside this region)
; referenced by `lda $E1F9,y` at $E1E2 (operand $E1F9 falls inside this region)
EnemyTileIndexTable:
.byte $00, $04, $07, $08, $07, $04, $00, $84, $87, $88, $87, $84, $00 ; CPU:$E1EC PRG:21EC 00 04 07 08 07 04 00 84 87 88 87 84 00
EnemyAttributeIndexTable:
.byte $86, $85, $83 ; CPU:$E1F9 PRG:21F9 86 85 83
.byte $00, $03, $05, $06, $05, $03, $00, $83, $85, $86 ; CPU:$E1FC PRG:21FC 00 03 05 06 05 03 00 83 85 86
; -----------------------------------------------------------------------------
; Routine: CheckEnemyLimit
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from ZpA5; compares A with $07;
; branches on not equal to Sub_8764_OnNonzero_E235; loads A from
; $0698,x; compares A with $0A; branches on carry set to
; Sub_8764_OnCarrySet_E217; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, Zp03, $043C, $051A, $06BF, $06D4.
;
; -----------------------------------------------------------------------------
CheckEnemyLimit:
lda ZpA5 ; CPU:$E206 PRG:2206 A5 A5
cmp #$07 ; CPU:$E208 PRG:2208 C9 07
bne Sub_8764_OnNonzero_E235 ; CPU:$E20A PRG:220A D0 29
lda $0698,x ; CPU:$E20C PRG:220C BD 98 06
cmp #$0A ; CPU:$E20F PRG:220F C9 0A
bcs Sub_8764_OnCarrySet_E217 ; CPU:$E211 PRG:2211 B0 04
lda #$A9 ; CPU:$E213 PRG:2213 A9 A9
bne Sub_8764_OnNonzero_E227 ; CPU:$E215 PRG:2215 D0 10
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E217
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from $043C,x; compares A with $AC;
; branches on carry clear to Sub_8764_OnCarryClear_E222; loads A with
; $AA; branches on not equal to Sub_8764_OnNonzero_E227.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E217:
lda $043C,x ; CPU:$E217 PRG:2217 BD 3C 04
cmp #$AC ; CPU:$E21A PRG:221A C9 AC
bcc Sub_8764_OnCarryClear_E222 ; CPU:$E21C PRG:221C 90 04
lda #$AA ; CPU:$E21E PRG:221E A9 AA
bne Sub_8764_OnNonzero_E227 ; CPU:$E220 PRG:2220 D0 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E222
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: increments $043C,x; branches on not equal to
; Sub_8764_OnNonzero_E22A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E222:
inc $043C,x ; CPU:$E222 PRG:2222 FE 3C 04
bne Sub_8764_OnNonzero_E22A ; CPU:$E225 PRG:2225 D0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E227
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: stores A to $043C,x.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E227:
sta $043C,x ; CPU:$E227 PRG:2227 9D 3C 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E22A
; Global: The routine calls PackObjectState.
; Local: Executes 5 instructions: loads A from Zp12; ANDs A with $3F; branches
; on not equal to Sub_8764_OnNonzero_E235; loads A with $01; calls
; PackObjectState.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E22A:
lda Zp12 ; CPU:$E22A PRG:222A A5 12
and #$3F ; CPU:$E22C PRG:222C 29 3F
bne Sub_8764_OnNonzero_E235 ; CPU:$E22E PRG:222E D0 05
lda #$01 ; CPU:$E230 PRG:2230 A9 01
jsr PackObjectState ; CPU:$E232 PRG:2232 20 B2 D9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E235
; Global: The routine calls SubCE320.
; Local: Executes 1 instruction: calls SubCE320.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E235:
jmp SubCE320_Loop ; CPU:$E235 PRG:2235 4C 20 E3
; ---- data $E238-$E250 (25 bytes) ----
.byte $A5, $A5, $6A, $B0, $0D, $FE, $3C, $04, $BD, $3C, $04, $C9, $84, $D0, $03, $20 ; CPU:$E238 PRG:2238 A5 A5 6A B0 0D FE 3C 04 BD 3C 04 C9 84 D0 03 20
.byte $DB, $DD, $60, $20, $38, $E2, $4C, $20, $E3 ; CPU:$E248 PRG:2248 DB DD 60 20 38 E2 4C 20 E3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E251
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E251:
sec ; CPU:$E251 PRG:2251 38
lda a:Zp85,y ; CPU:$E252 PRG:2252 B9 85 00
sbc ZpB4 ; CPU:$E255 PRG:2255 E5 B4
bcs Sub_8764_OnCarrySet_E25B ; CPU:$E257 PRG:2257 B0 02
eor #$FF ; CPU:$E259 PRG:2259 49 FF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E25B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: stores A to Zp25; sets the carry flag; loads
; A from Zp95,y; subtracts ZpB5 from A; branches on carry set to
; Sub_8764_OnCarrySet_E267; EORs A with $FF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E25B:
sta Zp25 ; CPU:$E25B PRG:225B 85 25
sec ; CPU:$E25D PRG:225D 38
lda a:Zp95,y ; CPU:$E25E PRG:225E B9 95 00
sbc ZpB5 ; CPU:$E261 PRG:2261 E5 B5
bcs Sub_8764_OnCarrySet_E267 ; CPU:$E263 PRG:2263 B0 02
eor #$FF ; CPU:$E265 PRG:2265 49 FF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E267
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: clears the carry flag; adds Zp25 to A;
; branches on carry clear to Sub_8764_OnCarryClear_E26E; loads A with
; $FE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E267:
clc ; CPU:$E267 PRG:2267 18
adc Zp25 ; CPU:$E268 PRG:2268 65 25
bcc Sub_8764_OnCarryClear_E26E ; CPU:$E26A PRG:226A 90 02
lda #$FE ; CPU:$E26C PRG:226C A9 FE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E26E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: compares A with ZpB7; branches on carry set
; to Sub_8764_OnCarrySet_E274; stores A to ZpB7.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E26E:
cmp ZpB7 ; CPU:$E26E PRG:226E C5 B7
bcs Sub_8764_OnCarrySet_E274 ; CPU:$E270 PRG:2270 B0 02
sta ZpB7 ; CPU:$E272 PRG:2272 85 B7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E274
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and SubCE320.
; Local: Executes 9 instructions: stores Y to Zp29; loads A from $043C,x;
; copies A into Y; loads A from $DA29,y; calls DrawFactoryAndTargetSprites; loads A from
; $DA35,y; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E274:
sty Zp29 ; CPU:$E274 PRG:2274 84 29
lda $043C,x ; CPU:$E276 PRG:2276 BD 3C 04
tay ; CPU:$E279 PRG:2279 A8
lda $DA29,y ; CPU:$E27A PRG:227A B9 29 DA
jsr DrawFactoryAndTargetSprites; CPU:$E27D PRG:227D 20 D7 ED
lda $DA35,y ; CPU:$E280 PRG:2280 B9 35 DA
jsr DrawTargetSpritesAlt ; CPU:$E283 PRG:2283 20 E2 ED
ldy Zp29 ; CPU:$E286 PRG:2286 A4 29
jmp SubCE320_Loop ; CPU:$E288 PRG:2288 4C 20 E3
; -----------------------------------------------------------------------------
; Routine: RunEnemyDispatch
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320 and InitRadarDirection.
; Local: Executes 29 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 23
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
RunEnemyDispatch:
jsr InitRadarDirection ; CPU:$E28B PRG:228B 20 23 E9
inc Zp1D ; CPU:$E28E PRG:228E E6 1D
; -----------------------------------------------------------------------------
; Routine: RunEnemyDispatchLoop
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320, DispatchEnemyRoutine17 and 1 more.
; Local: Executes 31 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 25
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
RunEnemyDispatchLoop:
dec Zp1D ; CPU:$E290 PRG:2290 C6 1D
beq Sub_8764_OnZero_E29A ; CPU:$E292 PRG:2292 F0 06
jsr DispatchEnemyRoutine17 ; CPU:$E294 PRG:2294 20 9D E7
jmp RunEnemyDispatchLoop ; CPU:$E297 PRG:2297 4C 90 E2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E29A
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and SubCE320.
; Local: Executes 28 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 22
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E29A:
inc Zp1E ; CPU:$E29A PRG:229A E6 1E
; -----------------------------------------------------------------------------
; Routine: RunSecondEnemyDispatch
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320, DispatchEnemyRoutine19 and 1 more.
; Local: Executes 31 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 25
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
RunSecondEnemyDispatch:
dec Zp1E ; CPU:$E29C PRG:229C C6 1E
beq Sub_8764_OnZero_E2A6 ; CPU:$E29E PRG:229E F0 06
jsr DispatchEnemyRoutine19 ; CPU:$E2A0 PRG:22A0 20 A0 E7
jmp RunSecondEnemyDispatch ; CPU:$E2A3 PRG:22A3 4C 9C E2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E2A6
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and SubCE320.
; Local: Executes 32 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 26
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E2A6:
lda #$02 ; CPU:$E2A6 PRG:22A6 A9 02
sta Zp0C ; CPU:$E2A8 PRG:22A8 85 0C
lda #$FF ; CPU:$E2AA PRG:22AA A9 FF
sta ZpB7 ; CPU:$E2AC PRG:22AC 85 B7
ldy #$00 ; CPU:$E2AE PRG:22AE A0 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E2B0
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320 and CheckTargetType.
; Local: Executes 43 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 37
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E2B0:
lda a:Zp65,y ; CPU:$E2B0 PRG:22B0 B9 65 00
bmi SubCE320_Loop ; CPU:$E2B3 PRG:22B3 30 6B
beq SubCE320_Loop ; CPU:$E2B5 PRG:22B5 F0 69
tax ; CPU:$E2B7 PRG:22B7 AA
cmp #$15 ; CPU:$E2B8 PRG:22B8 C9 15
bcc Sub_8764_OnCarryClear_E2D8 ; CPU:$E2BA PRG:22BA 90 1C
cmp #$59 ; CPU:$E2BC PRG:22BC C9 59
bcs Sub_8764_OnCarrySet_E251 ; CPU:$E2BE PRG:22BE B0 91
cmp #$55 ; CPU:$E2C0 PRG:22C0 C9 55
bcs SubCE320_Loop ; CPU:$E2C2 PRG:22C2 B0 5C
cmp #$33 ; CPU:$E2C4 PRG:22C4 C9 33
bcs Sub_8764_OnCarrySet_E2D5 ; CPU:$E2C6 PRG:22C6 B0 0D
lda $043C,x ; CPU:$E2C8 PRG:22C8 BD 3C 04
cmp #$8C ; CPU:$E2CB PRG:22CB C9 8C
bcs Sub_8764_OnCarrySet_E2D2 ; CPU:$E2CD PRG:22CD B0 03
jmp CheckTargetType ; CPU:$E2CF PRG:22CF 4C 93 D9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E2D2
; Global: The routine calls CheckPlayerInRadarRange.
; Local: Executes 1 instruction: calls CheckPlayerInRadarRange.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E2D2:
jmp CheckPlayerInRadarRange ; CPU:$E2D2 PRG:22D2 4C 5B E0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E2D5
; Global: The routine calls RandomizeRadarSweep.
; Local: Executes 1 instruction: calls RandomizeRadarSweep.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E2D5:
jmp RandomizeRadarSweep ; CPU:$E2D5 PRG:22D5 4C 26 E3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E2D8
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320, CheckTargetType and 2 more.
; Local: Executes 56 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 50
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E2D8:
cmp #$09 ; CPU:$E2D8 PRG:22D8 C9 09
bcs Sub_8764_OnCarrySet_E301 ; CPU:$E2DA PRG:22DA B0 25
stx Zp00 ; CPU:$E2DC PRG:22DC 86 00
asl a ; CPU:$E2DE PRG:22DE 0A
tax ; CPU:$E2DF PRG:22DF AA
lda $E2EF,x ; CPU:$E2E0 PRG:22E0 BD EF E2
sta IndDispatch01 ; CPU:$E2E3 PRG:22E3 85 01
lda $E2F0,x ; CPU:$E2E5 PRG:22E5 BD F0 E2
sta IndDispatch02 ; CPU:$E2E8 PRG:22E8 85 02
ldx Zp00 ; CPU:$E2EA PRG:22EA A6 00
jmp (IndDispatch01) ; CPU:$E2EC PRG:22EC 6C 01 00
; ---- data $E2EF-$E300 (18 bytes) ----
; referenced by `lda $E2EF,x` at $E2E0 (operand $E2EF falls inside this region)
; referenced by `lda $E2F0,x` at $E2E5 (operand $E2F0 falls inside this region)
EnemyRoutinePointerTable:
.byte $20, $E3, $4B, $E2, $8B, $E3, $20, $E3, $7B, $E3, $1D, $E3, $20, $E3, $CE, $E3 ; CPU:$E2EF PRG:22EF 20 E3 4B E2 8B E3 20 E3 7B E3 1D E3 20 E3 CE E3
.byte $5B, $E3 ; CPU:$E2FF PRG:22FF 5B E3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E301
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320, CheckTargetType and 3 more.
; Local: Executes 59 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 53
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E301:
cmp #$0F ; CPU:$E301 PRG:2301 C9 0F
bcc Sub_8764_OnCarryClear_E308 ; CPU:$E303 PRG:2303 90 03
jmp CheckEnemyLimit ; CPU:$E305 PRG:2305 4C 06 E2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E308
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320, CheckTargetType and 4 more.
; Local: Executes 66 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 60
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E308:
cmp #$0D ; CPU:$E308 PRG:2308 C9 0D
beq Sub_8764_OnZero_E317 ; CPU:$E30A PRG:230A F0 0B
cmp #$0B ; CPU:$E30C PRG:230C C9 0B
beq Sub_8764_OnZero_E31A ; CPU:$E30E PRG:230E F0 0A
cmp #$0A ; CPU:$E310 PRG:2310 C9 0A
bne SubCE320_Loop ; CPU:$E312 PRG:2312 D0 0C
jmp UpdateHelicopterInput ; CPU:$E314 PRG:2314 4C 12 E4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E317
; Global: The routine calls CheckHelicopterHit.
; Local: Executes 1 instruction: calls CheckHelicopterHit.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E317:
jmp CheckHelicopterHit ; CPU:$E317 PRG:2317 4C 2F E4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E31A
; Global: The routine calls InitRadarScreenLayout.
; Local: Executes 1 instruction: calls InitRadarScreenLayout.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E31A:
jmp InitRadarScreenLayout ; CPU:$E31A PRG:231A 4C 4A E4
; ---- data $E31D-$E31F (3 bytes) ----
.byte $20, $38, $E2 ; CPU:$E31D PRG:231D 20 38 E2
; -----------------------------------------------------------------------------
; Routine: SubCE320_Loop
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320, CheckTargetType and 6 more.
; Local: Executes 72 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 66
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
SubCE320_Loop:
iny ; CPU:$E320 PRG:2320 C8
cpy #$10 ; CPU:$E321 PRG:2321 C0 10
bcc Sub_8764_OnCarryClear_E2B0 ; CPU:$E323 PRG:2323 90 8B
rts ; CPU:$E325 PRG:2325 60
; -----------------------------------------------------------------------------
; Routine: RandomizeRadarSweep
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt, SubCE320, CheckTargetType and 9 more,
; writes $04B3 and $0444, reads $0366.
; Local: Executes 95 instructions: sets the carry flag; loads A from Zp85,y;
; subtracts ZpB4 from A; branches on carry set to
; Sub_8764_OnCarrySet_E25B; EORs A with $FF; stores A to Zp25; and 89
; more instructions.
; Parameters: Reads $0366 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves $04B3 and $0444 changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
RandomizeRadarSweep:
jsr UpdatePseudoRandomNumber ; CPU:$E326 PRG:2326 20 12 C4
lsr a ; CPU:$E329 PRG:2329 4A
cmp #$7E ; CPU:$E32A PRG:232A C9 7E
bcc SubCE320_Loop ; CPU:$E32C PRG:232C 90 F2
lda Zp09 ; CPU:$E32E PRG:232E A5 09
bne SubCE320_Loop ; CPU:$E330 PRG:2330 D0 EE
lda $0366 ; CPU:$E332 PRG:2332 AD 66 03
bpl SubCE320_Loop ; CPU:$E335 PRG:2335 10 E9
stx Zp2B ; CPU:$E337 PRG:2337 86 2B
lda #$08 ; CPU:$E339 PRG:2339 A9 08
jsr CopyEnemyToSlot ; CPU:$E33B PRG:233B 20 39 E0
lda #$0F ; CPU:$E33E PRG:233E A9 0F
sta Zp2C ; CPU:$E340 PRG:2340 85 2C
lda #$22 ; CPU:$E342 PRG:2342 A9 22
sta $04B3 ; CPU:$E344 PRG:2344 8D B3 04
lda #$7D ; CPU:$E347 PRG:2347 A9 7D
sta $0444 ; CPU:$E349 PRG:2349 8D 44 04
jsr UpdatePseudoRandomNumber ; CPU:$E34C PRG:234C 20 12 C4
pha ; CPU:$E34F PRG:234F 48
pla ; CPU:$E350 PRG:2350 68
bmi Sub_8764_OnNegative_E358 ; CPU:$E351 PRG:2351 30 05
lda #$01 ; CPU:$E353 PRG:2353 A9 01
jsr SelectRadarRowCount ; CPU:$E355 PRG:2355 20 C5 E5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_E358
; Global: The routine calls SubCE320.
; Local: Executes 1 instruction: calls SubCE320.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_E358:
jmp SubCE320_Loop ; CPU:$E358 PRG:2358 4C 20 E3
; ---- data $E35B-$E3B4 (90 bytes) ----
.byte $C6, $2C, $F0, $15, $AD, $44, $04, $49, $03, $8D, $44, $04, $A6, $2B, $A9, $08 ; CPU:$E35B PRG:235B C6 2C F0 15 AD 44 04 49 03 8D 44 04 A6 2B A9 08
.byte $20, $39, $E0, $20, $11, $C5, $4C, $20, $E3, $A9, $FF, $8D, $66, $03, $D0, $A5 ; CPU:$E36B PRG:236B 20 39 E0 20 11 C5 4C 20 E3 A9 FF 8D 66 03 D0 A5
.byte $A5, $41, $20, $D7, $ED, $A5, $42, $20, $E2, $ED, $20, $87, $E5, $4C, $20, $E3 ; CPU:$E37B PRG:237B A5 41 20 D7 ED A5 42 20 E2 ED 20 87 E5 4C 20 E3
.byte $AD, $8B, $05, $C9, $01, $F0, $10, $CE, $8B, $05, $A5, $43, $20, $D7, $ED, $A5 ; CPU:$E38B PRG:238B AD 8B 05 C9 01 F0 10 CE 8B 05 A5 43 20 D7 ED A5
.byte $44, $20, $E2, $ED, $4C, $20, $E3, $20, $B5, $E3, $AD, $3E, $04, $C9, $80, $D0 ; CPU:$E39B PRG:239B 44 20 E2 ED 4C 20 E3 20 B5 E3 AD 3E 04 C9 80 D0
.byte $06, $20, $87, $E5, $20, $0D, $C5, $4C, $20, $E3 ; CPU:$E3AB PRG:23AB 06 20 87 E5 20 0D C5 4C 20 E3
; -----------------------------------------------------------------------------
; Routine: CheckTargetSpriteType
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from ZpA5; rotates a right; branches
; on carry set to Sub_8764_OnCarrySet_E3C4; loads A from $043C,x;
; compares A with $83; branches on equal to Sub_8764_OnZero_E3C5; and
; 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, $035E, $043C, $0589.
;
; -----------------------------------------------------------------------------
CheckTargetSpriteType:
lda ZpA5 ; CPU:$E3B5 PRG:23B5 A5 A5
ror a ; CPU:$E3B7 PRG:23B7 6A
bcs Sub_8764_OnCarrySet_E3C4 ; CPU:$E3B8 PRG:23B8 B0 0A
lda $043C,x ; CPU:$E3BA PRG:23BA BD 3C 04
cmp #$83 ; CPU:$E3BD PRG:23BD C9 83
beq Sub_8764_OnZero_E3C5 ; CPU:$E3BF PRG:23BF F0 04
inc $043C,x ; CPU:$E3C1 PRG:23C1 FE 3C 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E3C4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E3C4:
rts ; CPU:$E3C4 PRG:23C4 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E3C5
; Global: The routine calls DestroyEnemy.
; Local: Executes 4 instructions: calls DestroyEnemy; loads A with $00; stores A
; to $0589,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, $035E, $0589.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E3C5:
jsr DestroyEnemy ; CPU:$E3C5 PRG:23C5 20 DB DD
lda #$00 ; CPU:$E3C8 PRG:23C8 A9 00
sta $0589,x ; CPU:$E3CA PRG:23CA 9D 89 05
rts ; CPU:$E3CD PRG:23CD 60
; ---- data $E3CE-$E411 (68 bytes) ----
.byte $A5, $A5, $29, $03, $D0, $58, $AD, $43, $04, $C9, $83, $B0, $06, $EE, $43, $04 ; CPU:$E3CE PRG:23CE A5 A5 29 03 D0 58 AD 43 04 C9 83 B0 06 EE 43 04
.byte $4C, $20, $E3, $CE, $21, $05, $F0, $1D, $84, $27, $A9, $7C, $8D, $43, $04, $AD ; CPU:$E3DE PRG:23DE 4C 20 E3 CE 21 05 F0 1D 84 27 A9 7C 8D 43 04 AD
.byte $21, $05, $A8, $B9, $0A, $E4, $20, $D7, $ED, $B9, $0E, $E4, $20, $E2, $ED, $20 ; CPU:$E3EE PRG:23EE 21 05 A8 B9 0A E4 20 D7 ED B9 0E E4 20 E2 ED 20
.byte $15, $C5, $4C, $20, $E3, $A9, $FF, $8D, $65, $03, $D0, $22, $00, $9F, $14, $8A ; CPU:$E3FE PRG:23FE 15 C5 4C 20 E3 A9 FF 8D 65 03 D0 22 00 9F 14 8A
.byte $00, $00, $14, $8A ; CPU:$E40E PRG:240E 00 00 14 8A
; -----------------------------------------------------------------------------
; Routine: UpdateHelicopterInput
; Global: The routine calls CheckJoystickDirection, writes the APUNOISECTRL, APUNOISEPERIOD
; and APUNOISELENGTH registers.
; Local: Executes 11 instructions: calls CheckJoystickDirection; loads A from Zp3F; branches
; on not equal to Sub_8764_JoinBranchPaths_E42C; loads A from ZpD4;
; branches on equal to Sub_8764_JoinBranchPaths_E42C; loads A with
; $18; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves the APUNOISECTRL,
; APUNOISEPERIOD and APUNOISELENGTH registers set.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
UpdateHelicopterInput:
jsr CheckJoystickDirection ; CPU:$E412 PRG:2412 20 87 E5
lda Zp3F ; CPU:$E415 PRG:2415 A5 3F
bne Sub_8764_JoinBranchPaths_E42C ; CPU:$E417 PRG:2417 D0 13
lda ZpD4 ; CPU:$E419 PRG:2419 A5 D4
beq Sub_8764_JoinBranchPaths_E42C ; CPU:$E41B PRG:241B F0 0F
lda #$18 ; CPU:$E41D PRG:241D A9 18
sta APUNOISECTRL ; CPU:$E41F PRG:241F 8D 0C 40
lda #$08 ; CPU:$E422 PRG:2422 A9 08
sta APUNOISEPERIOD ; CPU:$E424 PRG:2424 8D 0E 40
lda #$28 ; CPU:$E427 PRG:2427 A9 28
sta APUNOISELENGTH ; CPU:$E429 PRG:2429 8D 0F 40
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E42C
; Global: The routine calls SubCE320.
; Local: Executes 1 instruction: calls SubCE320.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E42C:
jmp SubCE320_Loop ; CPU:$E42C PRG:242C 4C 20 E3
; -----------------------------------------------------------------------------
; Routine: CheckHelicopterHit
; Global: The routine calls SubCE320.
; Local: Executes 4 instructions: calls SubCE320; loads A from ZpBB; branches
; on negative to Sub_8764_OnNegative_E435; branches on not equal to
; Sub_8764_JoinBranchPaths_E42C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
CheckHelicopterHit:
lda ZpBB ; CPU:$E42F PRG:242F A5 BB
bmi Sub_8764_OnNegative_E435 ; CPU:$E431 PRG:2431 30 02
bne Sub_8764_JoinBranchPaths_E42C ; CPU:$E433 PRG:2433 D0 F7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_E435
; Global: The routine calls SubCE320 and SpawnEnemySprite.
; Local: Executes 11 instructions: calls SubCE320; loads A with $A6; stores A
; to Zp25; calls SpawnEnemySprite; loads A with $EC; stores A to Zp25; and 5
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_E435:
lda #$A6 ; CPU:$E435 PRG:2435 A9 A6
sta Zp25 ; CPU:$E437 PRG:2437 85 25
jsr SpawnEnemySprite ; CPU:$E439 PRG:2439 20 99 E4
lda #$EC ; CPU:$E43C PRG:243C A9 EC
sta Zp25 ; CPU:$E43E PRG:243E 85 25
lda #$50 ; CPU:$E440 PRG:2440 A9 50
sta Zp26 ; CPU:$E442 PRG:2442 85 26
lda #$F6 ; CPU:$E444 PRG:2444 A9 F6
ldx #$1E ; CPU:$E446 PRG:2446 A2 1E
bne Sub_8764_OnNonzero_E456 ; CPU:$E448 PRG:2448 D0 0C
; -----------------------------------------------------------------------------
; Routine: InitRadarScreenLayout
; Global: The routine calls SubCE320.
; Local: Executes 7 instructions: calls SubCE320; loads A with $F6; stores A
; to Zp25; loads A with $0E; stores A to Zp26; loads A with $F4; and
; 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
InitRadarScreenLayout:
lda #$F6 ; CPU:$E44A PRG:244A A9 F6
sta Zp25 ; CPU:$E44C PRG:244C 85 25
lda #$0E ; CPU:$E44E PRG:244E A9 0E
sta Zp26 ; CPU:$E450 PRG:2450 85 26
lda #$F4 ; CPU:$E452 PRG:2452 A9 F4
ldx #$32 ; CPU:$E454 PRG:2454 A2 32
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E456
; Global: The routine calls SubCE320.
; Local: Executes 4 instructions: calls SubCE320; stores A to Zp27; stores X
; to Zp28; loads X with $0F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E456:
sta Zp27 ; CPU:$E456 PRG:2456 85 27
stx Zp28 ; CPU:$E458 PRG:2458 86 28
ldx #$0F ; CPU:$E45A PRG:245A A2 0F
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E45C
; Global: The routine calls SubCE320.
; Local: Executes 6 instructions: calls SubCE320; loads A from Zp65,x;
; compares A with $55; branches on carry set to
; Sub_8764_OnCarrySet_E466; compares A with $3D; branches on carry
; set to Sub_8764_OnCarrySet_E46B.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E45C:
lda Zp65,x ; CPU:$E45C PRG:245C B5 65
cmp #$55 ; CPU:$E45E PRG:245E C9 55
bcs Sub_8764_OnCarrySet_E466 ; CPU:$E460 PRG:2460 B0 04
cmp #$3D ; CPU:$E462 PRG:2462 C9 3D
bcs Sub_8764_OnCarrySet_E46B ; CPU:$E464 PRG:2464 B0 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E466
; Global: The routine calls SubCE320.
; Local: Executes 9 instructions: calls SubCE320; loads A from Zp65,x;
; compares A with $55; branches on carry set to
; Sub_8764_OnCarrySet_E466; compares A with $3D; branches on carry
; set to Sub_8764_OnCarrySet_E46B; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E466:
dex ; CPU:$E466 PRG:2466 CA
bpl Sub_8764_OnNonnegative_E45C; CPU:$E467 PRG:2467 10 F3
bmi Sub_8764_JoinBranchPaths_E42C ; CPU:$E469 PRG:2469 30 C1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E46B
; Global: The routine calls SubCE320.
; Local: Executes 16 instructions: calls SubCE320; loads A from Zp65,x;
; compares A with $55; branches on carry set to
; Sub_8764_OnCarrySet_E466; compares A with $3D; branches on carry
; set to Sub_8764_OnCarrySet_E46B; and 10 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E46B:
sec ; CPU:$E46B PRG:246B 38
lda Zp85,x ; CPU:$E46C PRG:246C B5 85
sbc a:Zp85,y ; CPU:$E46E PRG:246E F9 85 00
cmp Zp25 ; CPU:$E471 PRG:2471 C5 25
bcs Sub_8764_OnCarrySet_E479 ; CPU:$E473 PRG:2473 B0 04
cmp Zp26 ; CPU:$E475 PRG:2475 C5 26
bcs Sub_8764_OnCarrySet_E466 ; CPU:$E477 PRG:2477 B0 ED
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E479
; Global: The routine calls SubCE320.
; Local: Executes 23 instructions: calls SubCE320; loads A from Zp65,x;
; compares A with $55; branches on carry set to
; Sub_8764_OnCarrySet_E466; compares A with $3D; branches on carry
; set to Sub_8764_OnCarrySet_E46B; and 17 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E479:
sec ; CPU:$E479 PRG:2479 38
lda Zp95,x ; CPU:$E47A PRG:247A B5 95
sbc a:Zp95,y ; CPU:$E47C PRG:247C F9 95 00
cmp Zp27 ; CPU:$E47F PRG:247F C5 27
bcs Sub_8764_OnCarrySet_E487 ; CPU:$E481 PRG:2481 B0 04
cmp Zp28 ; CPU:$E483 PRG:2483 C5 28
bcs Sub_8764_OnCarrySet_E466 ; CPU:$E485 PRG:2485 B0 DF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E487
; Global: The routine calls SubCE320, CopyEnemyToSlot and DestroyEnemy, writes $043D.
; Local: Executes 9 instructions: calls SubCE320; loads A from Zp65,x; copies
; A into X; loads A with $01; calls CopyEnemyToSlot; loads A with $7C; and 3
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $043D changed.
; Clobbers:
; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM
; fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E487:
lda Zp65,x ; CPU:$E487 PRG:2487 B5 65
tax ; CPU:$E489 PRG:2489 AA
lda #$01 ; CPU:$E48A PRG:248A A9 01
jsr CopyEnemyToSlot ; CPU:$E48C PRG:248C 20 39 E0
lda #$7C ; CPU:$E48F PRG:248F A9 7C
sta $043D ; CPU:$E491 PRG:2491 8D 3D 04
jsr DestroyEnemy ; CPU:$E494 PRG:2494 20 DB DD
bne Sub_8764_JoinBranchPaths_E42C ; CPU:$E497 PRG:2497 D0 93
; -----------------------------------------------------------------------------
; Routine: SpawnEnemySprite
; Global: The routine calls CheckSpawnState and CopyEnemyToSlot, writes $04B5 and $0446,
; reads $0368.
; Local: Executes 12 instructions: calls CheckSpawnState; branches on equal to
; Sub_8764_JoinBranchPaths_E4B6; loads A from $0368; branches on
; non-negative to Sub_8764_JoinBranchPaths_E4B6; loads A with $0A;
; calls CopyEnemyToSlot; and 6 more instructions.
; Parameters: Reads $0368 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target. Leaves $04B5 and $0446 changed.
; Clobbers:
; A and Y, the N, Z and C flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
SpawnEnemySprite:
jsr CheckSpawnState ; CPU:$E499 PRG:2499 20 A7 D8
beq Sub_8764_JoinBranchPaths_E4B6 ; CPU:$E49C PRG:249C F0 18
lda $0368 ; CPU:$E49E PRG:249E AD 68 03
bpl Sub_8764_JoinBranchPaths_E4B6 ; CPU:$E4A1 PRG:24A1 10 13
lda #$0A ; CPU:$E4A3 PRG:24A3 A9 0A
jsr CopyEnemyToSlot ; CPU:$E4A5 PRG:24A5 20 39 E0
lda #$23 ; CPU:$E4A8 PRG:24A8 A9 23
sta Zp3B ; CPU:$E4AA PRG:24AA 85 3B
lda #$22 ; CPU:$E4AC PRG:24AC A9 22
sta $04B5 ; CPU:$E4AE PRG:24AE 8D B5 04
lda Zp25 ; CPU:$E4B1 PRG:24B1 A5 25
sta $0446 ; CPU:$E4B3 PRG:24B3 8D 46 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E4B6
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E4B6:
rts ; CPU:$E4B6 PRG:24B6 60
; -----------------------------------------------------------------------------
; Routine: DrawFactoryTarget
; Global: The routine calls DrawFactoryAndTargetSprites, DrawTargetSpritesAlt and UpdatePseudoRandomNumber, reads $0368 and
; $0446.
; Local: Executes 21 instructions: returns with RTS; loads A from $0368;
; branches on negative to Sub_8764_JoinBranchPaths_E4B6; loads X with
; $0A; loads Y from $0446; loads A from $E4C6,y; and 15 more
; instructions.
; Parameters: Reads $0368 and $0446 from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
DrawFactoryTarget:
lda $0368 ; CPU:$E4B7 PRG:24B7 AD 68 03
bmi Sub_8764_JoinBranchPaths_E4B6 ; CPU:$E4BA PRG:24BA 30 FA
ldx #$0A ; CPU:$E4BC PRG:24BC A2 0A
ldy $0446 ; CPU:$E4BE PRG:24BE AC 46 04
lda $E4C6,y ; CPU:$E4C1 PRG:24C1 B9 C6 E4
jsr DrawFactoryAndTargetSprites; CPU:$E4C4 PRG:24C4 20 D7 ED
lda $E4CF,y ; CPU:$E4C7 PRG:24C7 B9 CF E4
jsr DrawTargetSpritesAlt ; CPU:$E4CA PRG:24CA 20 E2 ED
lda ZpBD ; CPU:$E4CD PRG:24CD A5 BD
eor #$07 ; CPU:$E4CF PRG:24CF 49 07
lsr a ; CPU:$E4D1 PRG:24D1 4A
clc ; CPU:$E4D2 PRG:24D2 18
adc #$05 ; CPU:$E4D3 PRG:24D3 69 05
sta Zp54 ; CPU:$E4D5 PRG:24D5 85 54
jsr UpdatePseudoRandomNumber ; CPU:$E4D7 PRG:24D7 20 12 C4
cmp Zp54 ; CPU:$E4DA PRG:24DA C5 54
bcc Sub_8764_OnCarryClear_E4E4 ; CPU:$E4DC PRG:24DC 90 06
lda ZpA5 ; CPU:$E4DE PRG:24DE A5 A5
cmp #$03 ; CPU:$E4E0 PRG:24E0 C9 03
bne Sub_8764_OnNonzero_E4F7 ; CPU:$E4E2 PRG:24E2 D0 13
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E4E4
; Global: The routine calls IsEnemyInTargetZone, reads $04B5.
; Local: Executes 6 instructions: decrements Zp3B; branches on not equal to
; Sub_8764_OnNonzero_E4F8; loads A from $04B5; branches on
; non-negative to Sub_8764_OnNonnegative_E4F2; loads A with $0A;
; calls IsEnemyInTargetZone.
; Parameters: Reads $04B5 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E4E4:
dec Zp3B ; CPU:$E4E4 PRG:24E4 C6 3B
bne Sub_8764_OnNonzero_E4F8 ; CPU:$E4E6 PRG:24E6 D0 10
lda $04B5 ; CPU:$E4E8 PRG:24E8 AD B5 04
bpl Sub_8764_OnNonnegative_E4F2; CPU:$E4EB PRG:24EB 10 05
lda #$0A ; CPU:$E4ED PRG:24ED A9 0A
jsr IsEnemyInTargetZone ; CPU:$E4EF PRG:24EF 20 21 E6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E4F2
; Global: The routine writes $0368.
; Local: Executes 2 instructions: loads A with $FF; stores A to $0368.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $0368 changed.
; Clobbers:
; A, the N and Z flags, $0368.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E4F2:
lda #$FF ; CPU:$E4F2 PRG:24F2 A9 FF
sta $0368 ; CPU:$E4F4 PRG:24F4 8D 68 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E4F7
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E4F7:
rts ; CPU:$E4F7 PRG:24F7 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E4F8
; Global: The routine calls DrawBlipSprite, ComputeObjectOffset and SubCE544.
; Local: Executes 10 instructions: calls DrawBlipSprite; loads X with $0A; calls
; ComputeObjectOffset; increments Zp03; loads A from Zp26; branches on not equal
; to Sub_8764_OnNonzero_E50F; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E4F8:
jsr DrawBlipSprite ; CPU:$E4F8 PRG:24F8 20 66 EE
ldx #$0A ; CPU:$E4FB PRG:24FB A2 0A
jsr ComputeObjectOffset ; CPU:$E4FD PRG:24FD 20 65 E6
inc Zp03 ; CPU:$E500 PRG:2500 E6 03
lda Zp26 ; CPU:$E502 PRG:2502 A5 26
bne Sub_8764_OnNonzero_E50F ; CPU:$E504 PRG:2504 D0 09
lda Zp28 ; CPU:$E506 PRG:2506 A5 28
beq Sub_8764_OnZero_E518 ; CPU:$E508 PRG:2508 F0 0E
dec Zp03 ; CPU:$E50A PRG:250A C6 03
jmp SubCE544_Loop ; CPU:$E50C PRG:250C 4C 44 E5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E50F
; Global: The routine calls SubCE544.
; Local: Executes 4 instructions: loads A from Zp28; branches on not equal to
; SubCE544; increments Zp03; calls SubCE544.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp03, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E50F:
lda Zp28 ; CPU:$E50F PRG:250F A5 28
bne SubCE544_Loop ; CPU:$E511 PRG:2511 D0 31
inc Zp03 ; CPU:$E513 PRG:2513 E6 03
jmp SubCE544_Loop ; CPU:$E515 PRG:2515 4C 44 E5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E518
; Global: The routine calls SubCE544.
; Local: Executes 8 instructions: loads A from Zp25; compares A with Zp27;
; branches on carry clear to Sub_8764_OnCarryClear_E53B; shifts a
; right; compares A with Zp27; branches on carry clear to SubCE544;
; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp03, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E518:
lda Zp25 ; CPU:$E518 PRG:2518 A5 25
cmp Zp27 ; CPU:$E51A PRG:251A C5 27
bcc Sub_8764_OnCarryClear_E53B ; CPU:$E51C PRG:251C 90 1D
lsr a ; CPU:$E51E PRG:251E 4A
cmp Zp27 ; CPU:$E51F PRG:251F C5 27
bcc SubCE544_Loop ; CPU:$E521 PRG:2521 90 21
inc Zp03 ; CPU:$E523 PRG:2523 E6 03
jmp SubCE544_Loop ; CPU:$E525 PRG:2525 4C 44 E5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_E528
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: compares A with $FC; branches on carry set
; to Sub_8764_OnCarrySet_E555.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp03, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_E528:
cmp #$FC ; CPU:$E528 PRG:2528 C9 FC
bcs Sub_8764_OnCarrySet_E555 ; CPU:$E52A PRG:252A B0 29
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E52C
; Global: The routine reads $0446.
; Local: Executes 6 instructions: compares A with $FC; branches on carry set
; to Sub_8764_OnCarrySet_E555; loads A from $0446; compares A with
; $A7; branches on carry set to Sub_8764_OnCarrySet_E537; increments
; $0446.
; Parameters: Reads $0446 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp03, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E52C:
lda $0446 ; CPU:$E52C PRG:252C AD 46 04
cmp #$A7 ; CPU:$E52F PRG:252F C9 A7
bcs Sub_8764_OnCarrySet_E537 ; CPU:$E531 PRG:2531 B0 04
inc $0446 ; CPU:$E533 PRG:2533 EE 46 04
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E536
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E536:
rts ; CPU:$E536 PRG:2536 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E537
; Global: The routine reads $0446.
; Local: Executes 9 instructions: compares A with $FC; branches on carry set
; to Sub_8764_OnCarrySet_E555; loads A from $0446; compares A with
; $A7; branches on carry set to Sub_8764_OnCarrySet_E537; increments
; $0446; and 3 more instructions.
; Parameters: Reads $0446 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp03, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E537:
lda #$A0 ; CPU:$E537 PRG:2537 A9 A0
bne Sub_8764_OnNonzero_E562 ; CPU:$E539 PRG:2539 D0 27
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E53B
; Global: The routine reads $0446.
; Local: Executes 14 instructions: compares A with $FC; branches on carry set
; to Sub_8764_OnCarrySet_E555; loads A from $0446; compares A with
; $A7; branches on carry set to Sub_8764_OnCarrySet_E537; increments
; $0446; and 8 more instructions.
; Parameters: Reads $0446 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp03, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E53B:
lda Zp27 ; CPU:$E53B PRG:253B A5 27
lsr a ; CPU:$E53D PRG:253D 4A
cmp Zp25 ; CPU:$E53E PRG:253E C5 25
bcc SubCE544_Loop ; CPU:$E540 PRG:2540 90 02
dec Zp03 ; CPU:$E542 PRG:2542 C6 03
; -----------------------------------------------------------------------------
; Routine: SubCE544_Loop
; Global: The routine reads $0446.
; Local: Executes 22 instructions: compares A with $FC; branches on carry set
; to Sub_8764_OnCarrySet_E555; loads A from $0446; compares A with
; $A7; branches on carry set to Sub_8764_OnCarrySet_E537; increments
; $0446; and 16 more instructions.
; Parameters: Reads $0446 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp03, $0446.
;
; -----------------------------------------------------------------------------
SubCE544_Loop:
ldy Zp03 ; CPU:$E544 PRG:2544 A4 03
lda $E578,y ; CPU:$E546 PRG:2546 B9 78 E5
sec ; CPU:$E549 PRG:2549 38
sbc $0446 ; CPU:$E54A PRG:254A ED 46 04
beq Sub_8764_OnZero_E536 ; CPU:$E54D PRG:254D F0 E7
bmi Sub_8764_OnNegative_E528 ; CPU:$E54F PRG:254F 30 D7
cmp #$05 ; CPU:$E551 PRG:2551 C9 05
bcc Sub_8764_OnCarryClear_E52C ; CPU:$E553 PRG:2553 90 D7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E555
; Global: The routine reads $0446.
; Local: Executes 5 instructions: loads A from $0446; compares A with $A1;
; branches on carry clear to Sub_8764_OnCarryClear_E560; decrements
; $0446; returns with RTS.
; Parameters: Reads $0446 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z and C flags, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E555:
lda $0446 ; CPU:$E555 PRG:2555 AD 46 04
cmp #$A1 ; CPU:$E558 PRG:2558 C9 A1
bcc Sub_8764_OnCarryClear_E560 ; CPU:$E55A PRG:255A 90 04
dec $0446 ; CPU:$E55C PRG:255C CE 46 04
rts ; CPU:$E55F PRG:255F 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E560
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $A7.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E560:
lda #$A7 ; CPU:$E560 PRG:2560 A9 A7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E562
; Global: The routine writes $0446.
; Local: Executes 2 instructions: stores A to $0446; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed. Leaves $0446 changed.
; Clobbers:
; no register, $0446.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E562:
sta $0446 ; CPU:$E562 PRG:2562 8D 46 04
rts ; CPU:$E565 PRG:2565 60
; ---- data $E566-$E586 (33 bytes) ----
; referenced by `lda $E578,y` at $E546 (operand $E578 falls inside this region)
TargetTileIndexTable:
.byte $00, $04, $08, $04, $00, $84, $88, $84, $00, $86, $83, $00, $03, $06, $03, $00 ; CPU:$E566 PRG:2566 00 04 08 04 00 84 88 84 00 86 83 00 03 06 03 00
.byte $83, $86, $A0, $A7, $A6, $00, $A4, $A5, $A6, $00, $A0, $A1, $A2, $00, $A4, $A3 ; CPU:$E576 PRG:2576 83 86 A0 A7 A6 00 A4 A5 A6 00 A0 A1 A2 00 A4 A3
.byte $A2 ; CPU:$E586 PRG:2586 A2
; -----------------------------------------------------------------------------
; Routine: CheckJoystickDirection
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 10 instructions: loads A from Zp36; ANDs A with $E6CD,y;
; branches on not equal to Sub_8764_JoinBranchPaths_E5C4; sets the
; carry flag; loads A from ZpB5; subtracts Zp95,y from A; and 4 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
CheckJoystickDirection:
lda Zp36 ; CPU:$E587 PRG:2587 A5 36
and $E6CD,y ; CPU:$E589 PRG:2589 39 CD E6
bne Sub_8764_JoinBranchPaths_E5C4 ; CPU:$E58C PRG:258C D0 36
sec ; CPU:$E58E PRG:258E 38
lda ZpB5 ; CPU:$E58F PRG:258F A5 B5
sbc a:Zp95,y ; CPU:$E591 PRG:2591 F9 95 00
cmp #$F7 ; CPU:$E594 PRG:2594 C9 F7
bcs Sub_8764_OnCarrySet_E59C ; CPU:$E596 PRG:2596 B0 04
cmp #$09 ; CPU:$E598 PRG:2598 C9 09
bcs Sub_8764_JoinBranchPaths_E5C4 ; CPU:$E59A PRG:259A B0 28
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E59C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: sets the carry flag; loads A from ZpB4;
; subtracts Zp85,y from A; compares A with $F8; branches on carry set
; to Sub_8764_OnCarrySet_E5AA; compares A with $08; and 1 more
; instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E59C:
sec ; CPU:$E59C PRG:259C 38
lda ZpB4 ; CPU:$E59D PRG:259D A5 B4
sbc a:Zp85,y ; CPU:$E59F PRG:259F F9 85 00
cmp #$F8 ; CPU:$E5A2 PRG:25A2 C9 F8
bcs Sub_8764_OnCarrySet_E5AA ; CPU:$E5A4 PRG:25A4 B0 04
cmp #$08 ; CPU:$E5A6 PRG:25A6 C9 08
bcs Sub_8764_JoinBranchPaths_E5C4 ; CPU:$E5A8 PRG:25A8 B0 1A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E5AA
; Global: The routine calls IsEnemyInTargetZone, UpdatePseudoRandomNumber, SelectRadarRowCount and NextRadarRow.
; Local: Executes 11 instructions: loads A from ZpB6; EORs A with $10; stores
; A to ZpB6; loads A from Zp65,y; calls IsEnemyInTargetZone; calls UpdatePseudoRandomNumber; and
; 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E5AA:
lda ZpB6 ; CPU:$E5AA PRG:25AA A5 B6
eor #$10 ; CPU:$E5AC PRG:25AC 49 10
sta ZpB6 ; CPU:$E5AE PRG:25AE 85 B6
lda a:Zp65,y ; CPU:$E5B0 PRG:25B0 B9 65 00
jsr IsEnemyInTargetZone ; CPU:$E5B3 PRG:25B3 20 21 E6
jsr UpdatePseudoRandomNumber ; CPU:$E5B6 PRG:25B6 20 12 C4
lsr a ; CPU:$E5B9 PRG:25B9 4A
and #$07 ; CPU:$E5BA PRG:25BA 29 07
jsr SelectRadarRowCount ; CPU:$E5BC PRG:25BC 20 C5 E5
lda #$03 ; CPU:$E5BF PRG:25BF A9 03
jsr NextRadarRow ; CPU:$E5C1 PRG:25C1 20 D5 E5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E5C4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E5C4:
rts ; CPU:$E5C4 PRG:25C4 60
; -----------------------------------------------------------------------------
; Routine: SelectRadarRowCount
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: stores Y to Zp00; loads Y from ZpD3;
; compares Y with $03; branches on carry clear to
; Sub_8764_OnCarryClear_E5D1; loads A with $01; branches on not equal
; to Sub_8764_JoinBranchPaths_E5E7.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp00, Zp55, ZpD6, ZpDF, the OAM
; shadow.
;
; -----------------------------------------------------------------------------
SelectRadarRowCount:
sty Zp00 ; CPU:$E5C5 PRG:25C5 84 00
ldy ZpD3 ; CPU:$E5C7 PRG:25C7 A4 D3
cpy #$03 ; CPU:$E5C9 PRG:25C9 C0 03
bcc Sub_8764_OnCarryClear_E5D1 ; CPU:$E5CB PRG:25CB 90 04
lda #$01 ; CPU:$E5CD PRG:25CD A9 01
bne Sub_8764_JoinBranchPaths_E5E7 ; CPU:$E5CF PRG:25CF D0 16
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E5D1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads Y with $0E; branches on not equal to
; Sub_8764_OnNonzero_E5E9.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp00, Zp55, ZpD6, ZpDF, the OAM
; shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E5D1:
ldy #$0E ; CPU:$E5D1 PRG:25D1 A0 0E
bne Sub_8764_OnNonzero_E5E9 ; CPU:$E5D3 PRG:25D3 D0 14
; -----------------------------------------------------------------------------
; Routine: NextRadarRow
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: stores Y to Zp00; loads Y from ZpDF;
; branches on equal to Sub_8764_OnZero_E5DF; loads Y with $01; stores
; Y to ZpDF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp00, Zp55, ZpD6, ZpDF, the OAM
; shadow.
;
; -----------------------------------------------------------------------------
NextRadarRow:
sty Zp00 ; CPU:$E5D5 PRG:25D5 84 00
ldy ZpDF ; CPU:$E5D7 PRG:25D7 A4 DF
beq Sub_8764_OnZero_E5DF ; CPU:$E5D9 PRG:25D9 F0 04
ldy #$01 ; CPU:$E5DB PRG:25DB A0 01
sty ZpDF ; CPU:$E5DD PRG:25DD 84 DF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E5DF
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads Y from ZpD3; compares Y with $05;
; branches on carry clear to Sub_8764_JoinBranchPaths_E5E7; loads A
; with $05.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp55, ZpD6, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E5DF:
ldy ZpD3 ; CPU:$E5DF PRG:25DF A4 D3
cpy #$05 ; CPU:$E5E1 PRG:25E1 C0 05
bcc Sub_8764_JoinBranchPaths_E5E7 ; CPU:$E5E3 PRG:25E3 90 02
lda #$05 ; CPU:$E5E5 PRG:25E5 A9 05
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E5E7
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads Y with $0D.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp55, ZpD6, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E5E7:
ldy #$0D ; CPU:$E5E7 PRG:25E7 A0 0D
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E5E9
; Global: The routine calls SubCE5F1.
; Local: Executes 3 instructions: calls SubCE5F1; loads Y from Zp00; returns
; with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp55, ZpD6, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E5E9:
jsr SubCE5F1_OnNonzero ; CPU:$E5E9 PRG:25E9 20 F1 E5
ldy Zp00 ; CPU:$E5EC PRG:25EC A4 00
rts ; CPU:$E5EE PRG:25EE 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E5EF
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads Y with $2B.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp55, ZpD6, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E5EF:
ldy #$2B ; CPU:$E5EF PRG:25EF A0 2B
; -----------------------------------------------------------------------------
; Routine: SubCE5F1_OnNonzero
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 15 instructions: clears the carry flag; adds $0240,y to A;
; pushes A; compares Y with $29; branches on not equal to
; Sub_8764_JoinBranchPaths_E60D; ANDs A with $01; and 9 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp55, ZpD6, the OAM shadow.
;
; -----------------------------------------------------------------------------
SubCE5F1_OnNonzero:
clc ; CPU:$E5F1 PRG:25F1 18
adc $0240,y ; CPU:$E5F2 PRG:25F2 79 40 02
pha ; CPU:$E5F5 PRG:25F5 48
cpy #$29 ; CPU:$E5F6 PRG:25F6 C0 29
bne Sub_8764_JoinBranchPaths_E60D ; CPU:$E5F8 PRG:25F8 D0 13
and #$01 ; CPU:$E5FA PRG:25FA 29 01
beq Sub_8764_JoinBranchPaths_E60D ; CPU:$E5FC PRG:25FC F0 0F
lda GameState ; CPU:$E5FE PRG:25FE A5 D6
clc ; CPU:$E600 PRG:2600 18
adc #$01 ; CPU:$E601 PRG:2601 69 01
and #$03 ; CPU:$E603 PRG:2603 29 03
sta GameState ; CPU:$E605 PRG:2605 85 D6
lda FrameSubCounter ; CPU:$E607 PRG:2607 A5 55
bne Sub_8764_JoinBranchPaths_E60D ; CPU:$E609 PRG:2609 D0 02
inc FrameSubCounter ; CPU:$E60B PRG:260B E6 55
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E60D
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 24 instructions: clears the carry flag; adds $0240,y to A;
; pushes A; compares Y with $29; branches on not equal to
; Sub_8764_JoinBranchPaths_E60D; ANDs A with $01; and 18 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp55, ZpD6, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E60D:
pla ; CPU:$E60D PRG:260D 68
cmp #$2D ; CPU:$E60E PRG:260E C9 2D
bcc Sub_8764_OnCarryClear_E61D ; CPU:$E610 PRG:2610 90 0B
sec ; CPU:$E612 PRG:2612 38
sbc #$0A ; CPU:$E613 PRG:2613 E9 0A
sta $0240,y ; CPU:$E615 PRG:2615 99 40 02
dey ; CPU:$E618 PRG:2618 88
lda #$01 ; CPU:$E619 PRG:2619 A9 01
bne SubCE5F1_OnNonzero ; CPU:$E61B PRG:261B D0 D4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E61D
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: stores A to $0240,y.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; no register, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E61D:
sta $0240,y ; CPU:$E61D PRG:261D 99 40 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E620
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E620:
rts ; CPU:$E620 PRG:2620 60
; -----------------------------------------------------------------------------
; Routine: IsEnemyInTargetZone
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 36 instructions: loads Y with $2B; clears the carry flag;
; adds $0240,y to A; pushes A; compares Y with $29; branches on not
; equal to Sub_8764_JoinBranchPaths_E60D; and 30 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
IsEnemyInTargetZone:
tax ; CPU:$E621 PRG:2621 AA
tya ; CPU:$E622 PRG:2622 98
pha ; CPU:$E623 PRG:2623 48
cpx #$3D ; CPU:$E624 PRG:2624 E0 3D
bcc Sub_8764_JoinBranchPaths_E630 ; CPU:$E626 PRG:2626 90 08
cpx #$55 ; CPU:$E628 PRG:2628 E0 55
bcs Sub_8764_JoinBranchPaths_E630 ; CPU:$E62A PRG:262A B0 04
ldy #$05 ; CPU:$E62C PRG:262C A0 05
bne Sub_8764_OnNonzero_E632 ; CPU:$E62E PRG:262E D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E630
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 28 instructions: loads Y with $2B; clears the carry flag;
; adds $0240,y to A; pushes A; compares Y with $29; branches on not
; equal to Sub_8764_JoinBranchPaths_E60D; and 22 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E630:
ldy #$01 ; CPU:$E630 PRG:2630 A0 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E632
; Global: The routine calls AddObjectPositionDelta, CopyEnemyRecord and DestroyEnemy.
; Local: Executes 46 instructions: loads Y with $2B; clears the carry flag;
; adds $0240,y to A; pushes A; compares Y with $29; branches on not
; equal to Sub_8764_JoinBranchPaths_E60D; and 40 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields
; it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E632:
lda #$7D ; CPU:$E632 PRG:2632 A9 7D
sta $043C,y ; CPU:$E634 PRG:2634 99 3C 04
jsr AddObjectPositionDelta ; CPU:$E637 PRG:2637 20 F5 C4
jsr CopyEnemyRecord ; CPU:$E63A PRG:263A 20 42 E0
jsr DestroyEnemy ; CPU:$E63D PRG:263D 20 DB DD
lda #$32 ; CPU:$E640 PRG:2640 A9 32
sta $04AB,y ; CPU:$E642 PRG:2642 99 AB 04
pla ; CPU:$E645 PRG:2645 68
tay ; CPU:$E646 PRG:2646 A8
lda ZpD4 ; CPU:$E647 PRG:2647 A5 D4
beq Sub_8764_JoinBranchPaths_E620 ; CPU:$E649 PRG:2649 F0 D5
cpx #$55 ; CPU:$E64B PRG:264B E0 55
bcs Sub_8764_OnCarrySet_E65B ; CPU:$E64D PRG:264D B0 0C
cpx #$33 ; CPU:$E64F PRG:264F E0 33
bcs Sub_8764_OnCarrySet_E65F ; CPU:$E651 PRG:2651 B0 0C
cpx #$15 ; CPU:$E653 PRG:2653 E0 15
bcc Sub_8764_JoinBranchPaths_E620 ; CPU:$E655 PRG:2655 90 C9
lda #$01 ; CPU:$E657 PRG:2657 A9 01
bne Sub_8764_OnNonzero_E5EF ; CPU:$E659 PRG:2659 D0 94
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E65B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 29 instructions: loads Y with $2B; clears the carry flag;
; adds $0240,y to A; pushes A; compares Y with $29; branches on not
; equal to Sub_8764_JoinBranchPaths_E60D; and 23 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E65B:
lda #$02 ; CPU:$E65B PRG:265B A9 02
bne Sub_8764_OnNonzero_E5EF ; CPU:$E65D PRG:265D D0 90
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E65F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 29 instructions: clears the carry flag; adds $0240,y to A;
; pushes A; compares Y with $29; branches on not equal to
; Sub_8764_JoinBranchPaths_E60D; ANDs A with $01; and 23 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields it
; writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E65F:
lda #$05 ; CPU:$E65F PRG:265F A9 05
ldy #$2C ; CPU:$E661 PRG:2661 A0 2C
bne SubCE5F1_OnNonzero ; CPU:$E663 PRG:2663 D0 8C
; -----------------------------------------------------------------------------
; Routine: ComputeObjectOffset
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 15 instructions: sets the carry flag; loads A from $0280,x;
; subtracts Zp25 from A; stores A to Zp25; loads A from $035E,x;
; subtracts Zp26 from A; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp03, Zp25, Zp26, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
ComputeObjectOffset:
sec ; CPU:$E665 PRG:2665 38
lda $0280,x ; CPU:$E666 PRG:2666 BD 80 02
sbc Zp25 ; CPU:$E669 PRG:2669 E5 25
sta Zp25 ; CPU:$E66B PRG:266B 85 25
lda $035E,x ; CPU:$E66D PRG:266D BD 5E 03
sbc Zp26 ; CPU:$E670 PRG:2670 E5 26
sta Zp26 ; CPU:$E672 PRG:2672 85 26
bpl Sub_8764_OnNonnegative_E684; CPU:$E674 PRG:2674 10 0E
eor #$FF ; CPU:$E676 PRG:2676 49 FF
sta Zp26 ; CPU:$E678 PRG:2678 85 26
lda Zp25 ; CPU:$E67A PRG:267A A5 25
eor #$FF ; CPU:$E67C PRG:267C 49 FF
sta Zp25 ; CPU:$E67E PRG:267E 85 25
lda #$08 ; CPU:$E680 PRG:2680 A9 08
bne Sub_8764_OnNonzero_E686 ; CPU:$E682 PRG:2682 D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E684
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp03, Zp26, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E684:
lda #$00 ; CPU:$E684 PRG:2684 A9 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E686
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 10 instructions: stores A to Zp03; loads A from Zp26;
; compares A with $07; branches on carry clear to
; Sub_8764_OnCarryClear_E699; sets the carry flag; subtracts $07 from
; A; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp03, Zp26, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E686:
sta Zp03 ; CPU:$E686 PRG:2686 85 03
lda Zp26 ; CPU:$E688 PRG:2688 A5 26
cmp #$07 ; CPU:$E68A PRG:268A C9 07
bcc Sub_8764_OnCarryClear_E699 ; CPU:$E68C PRG:268C 90 0B
sec ; CPU:$E68E PRG:268E 38
sbc #$07 ; CPU:$E68F PRG:268F E9 07
sta Zp26 ; CPU:$E691 PRG:2691 85 26
lda Zp03 ; CPU:$E693 PRG:2693 A5 03
eor #$08 ; CPU:$E695 PRG:2695 49 08
sta Zp03 ; CPU:$E697 PRG:2697 85 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E699
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 17 instructions: sets the carry flag; loads A from $02EF,x;
; subtracts Zp27 from A; stores A to Zp27; loads A from $03CD,x;
; subtracts Zp28 from A; and 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp03, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E699:
sec ; CPU:$E699 PRG:2699 38
lda $02EF,x ; CPU:$E69A PRG:269A BD EF 02
sbc Zp27 ; CPU:$E69D PRG:269D E5 27
sta Zp27 ; CPU:$E69F PRG:269F 85 27
lda $03CD,x ; CPU:$E6A1 PRG:26A1 BD CD 03
sbc Zp28 ; CPU:$E6A4 PRG:26A4 E5 28
sta Zp28 ; CPU:$E6A6 PRG:26A6 85 28
bpl Sub_8764_OnNonnegative_E6BB; CPU:$E6A8 PRG:26A8 10 11
eor #$FF ; CPU:$E6AA PRG:26AA 49 FF
sta Zp28 ; CPU:$E6AC PRG:26AC 85 28
lda Zp27 ; CPU:$E6AE PRG:26AE A5 27
eor #$FF ; CPU:$E6B0 PRG:26B0 49 FF
sta Zp27 ; CPU:$E6B2 PRG:26B2 85 27
clc ; CPU:$E6B4 PRG:26B4 18
lda Zp03 ; CPU:$E6B5 PRG:26B5 A5 03
adc #$04 ; CPU:$E6B7 PRG:26B7 69 04
sta Zp03 ; CPU:$E6B9 PRG:26B9 85 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E6BB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 9 instructions: loads A from Zp28; compares A with $04;
; branches on carry clear to Sub_8764_OnCarryClear_E6CC; sets the
; carry flag; subtracts $04 from A; stores A to Zp28; and 3 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp03, Zp28.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E6BB:
lda Zp28 ; CPU:$E6BB PRG:26BB A5 28
cmp #$04 ; CPU:$E6BD PRG:26BD C9 04
bcc Sub_8764_OnCarryClear_E6CC ; CPU:$E6BF PRG:26BF 90 0B
sec ; CPU:$E6C1 PRG:26C1 38
sbc #$04 ; CPU:$E6C2 PRG:26C2 E9 04
sta Zp28 ; CPU:$E6C4 PRG:26C4 85 28
lda Zp03 ; CPU:$E6C6 PRG:26C6 A5 03
eor #$04 ; CPU:$E6C8 PRG:26C8 49 04
sta Zp03 ; CPU:$E6CA PRG:26CA 85 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E6CC
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E6CC:
rts ; CPU:$E6CC PRG:26CC 60
; ---- data $E6CD-$E6E4 (24 bytes) ----
; referenced by `and $E6CD,x` at $D730 (operand $E6CD falls inside this region)
; referenced by `and $E6CD,x` at $D74C (operand $E6CD falls inside this region)
; referenced by `and $E6CD,x` at $D755 (operand $E6CD falls inside this region)
; referenced by `and $E6CD,x` at $D7A5 (operand $E6CD falls inside this region)
; referenced by `lda $E6CD,y` at $E08E (operand $E6CD falls inside this region)
; referenced by `and $E6CD,y` at $E589 (operand $E6CD falls inside this region)
; ... and 8 further references from decoded code
DirectionBitMaskTable:
.byte $01, $02, $04, $08, $10, $20, $40, $80, $01, $02, $04, $08, $10, $20, $40, $80 ; CPU:$E6CD PRG:26CD 01 02 04 08 10 20 40 80 01 02 04 08 10 20 40 80
.byte $FE, $FD, $FB, $F7, $EF, $DF, $BF, $7F ; CPU:$E6DD PRG:26DD FE FD FB F7 EF DF BF 7F
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarSweepAngle
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from ZpD4; branches on equal to
; Sub_8764_JoinBranchPaths_E6FF; loads A from Zp50; shifts a right;
; branches on carry clear to Sub_8764_OnCarryClear_E6F0; increments
; ZpB6.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, Zp11, ZpB6.
;
; -----------------------------------------------------------------------------
AdvanceRadarSweepAngle:
lda ZpD4 ; CPU:$E6E5 PRG:26E5 A5 D4
beq Sub_8764_JoinBranchPaths_E6FF ; CPU:$E6E7 PRG:26E7 F0 16
lda Zp50 ; CPU:$E6E9 PRG:26E9 A5 50
lsr a ; CPU:$E6EB PRG:26EB 4A
bcc Sub_8764_OnCarryClear_E6F0 ; CPU:$E6EC PRG:26EC 90 02
inc ZpB6 ; CPU:$E6EE PRG:26EE E6 B6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E6F0
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: shifts a right; branches on carry clear to
; Sub_8764_OnCarryClear_E6F5; decrements ZpB6.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; no register, the N, Z and C flags, Zp11, ZpB6.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E6F0:
lsr a ; CPU:$E6F0 PRG:26F0 4A
bcc Sub_8764_OnCarryClear_E6F5 ; CPU:$E6F1 PRG:26F1 90 02
dec ZpB6 ; CPU:$E6F3 PRG:26F3 C6 B6
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E6F5
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: shifts a right; branches on carry clear to
; Sub_8764_OnCarryClear_E6FA; decrements Zp11.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; no register, the N, Z and C flags, Zp11.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E6F5:
lsr a ; CPU:$E6F5 PRG:26F5 4A
bcc Sub_8764_OnCarryClear_E6FA ; CPU:$E6F6 PRG:26F6 90 02
dec Zp11 ; CPU:$E6F8 PRG:26F8 C6 11
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E6FA
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: shifts a right; branches on carry clear to
; Sub_8764_JoinBranchPaths_E6FF; increments Zp11.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; no register, the N, Z and C flags, Zp11.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E6FA:
lsr a ; CPU:$E6FA PRG:26FA 4A
bcc Sub_8764_JoinBranchPaths_E6FF ; CPU:$E6FB PRG:26FB 90 02
inc Zp11 ; CPU:$E6FD PRG:26FD E6 11
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E6FF
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E6FF:
rts ; CPU:$E6FF PRG:26FF 60
; -----------------------------------------------------------------------------
; Routine: UpdateRadarSweepAngle
; Global: The routine calls AdvanceRadarSweepAngle.
; Local: Executes 5 instructions: calls AdvanceRadarSweepAngle; loads A from Zp07; branches
; on non-negative to Sub_8764_OnNonnegative_E70B; loads A with $00;
; stores A to Zp11.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
UpdateRadarSweepAngle:
jsr AdvanceRadarSweepAngle ; CPU:$E700 PRG:2700 20 E5 E6
lda Zp07 ; CPU:$E703 PRG:2703 A5 07
bpl Sub_8764_OnNonnegative_E70B; CPU:$E705 PRG:2705 10 04
lda #$00 ; CPU:$E707 PRG:2707 A9 00
sta Zp11 ; CPU:$E709 PRG:2709 85 11
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E70B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp11; branches on negative to
; Sub_8764_OnNegative_E723; compares A with Zp3C; branches on carry
; clear to Sub_8764_OnCarryClear_E718; loads Y from Zp3C; decrements
; Y; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E70B:
lda Zp11 ; CPU:$E70B PRG:270B A5 11
bmi Sub_8764_OnNegative_E723 ; CPU:$E70D PRG:270D 30 14
cmp Zp3C ; CPU:$E70F PRG:270F C5 3C
bcc Sub_8764_OnCarryClear_E718 ; CPU:$E711 PRG:2711 90 05
ldy Zp3C ; CPU:$E713 PRG:2713 A4 3C
dey ; CPU:$E715 PRG:2715 88
sty Zp11 ; CPU:$E716 PRG:2716 84 11
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E718
; Global: The routine calls ClassifyRadarBlip and InitRadarSweepWindow.
; Local: Executes 5 instructions: calls ClassifyRadarBlip; calls InitRadarSweepWindow; loads A with
; $00; stores A to Zp38; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E718:
jsr ClassifyRadarBlip ; CPU:$E718 PRG:2718 20 AF D3
jsr InitRadarSweepWindow ; CPU:$E71B PRG:271B 20 40 E7
lda #$00 ; CPU:$E71E PRG:271E A9 00
sta Zp38 ; CPU:$E720 PRG:2720 85 38
rts ; CPU:$E722 PRG:2722 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_E723
; Global: The routine calls ClassifyRadarBlip.
; Local: Executes 14 instructions: loads A with $0A; stores A to Zp11; stores
; A to Zp38; calls ClassifyRadarBlip; loads A from Zp46; EORs A with $FF; and
; 8 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_E723:
lda #$0A ; CPU:$E723 PRG:2723 A9 0A
sta Zp11 ; CPU:$E725 PRG:2725 85 11
sta Zp38 ; CPU:$E727 PRG:2727 85 38
jsr ClassifyRadarBlip ; CPU:$E729 PRG:2729 20 AF D3
lda Zp46 ; CPU:$E72C PRG:272C A5 46
eor #$FF ; CPU:$E72E PRG:272E 49 FF
sta Zp46 ; CPU:$E730 PRG:2730 85 46
lda Zp45 ; CPU:$E732 PRG:2732 A5 45
eor #$FF ; CPU:$E734 PRG:2734 49 FF
sta Zp45 ; CPU:$E736 PRG:2736 85 45
inc Zp46 ; CPU:$E738 PRG:2738 E6 46
inc Zp45 ; CPU:$E73A PRG:273A E6 45
lda #$00 ; CPU:$E73C PRG:273C A9 00
sta Zp11 ; CPU:$E73E PRG:273E 85 11
; -----------------------------------------------------------------------------
; Routine: InitRadarSweepWindow
; Global: The routine calls ComputeRadarAngularDeltaAlt and NormalizeRadarAngle.
; Local: Executes 23 instructions: loads A with $13; stores A to PtrLo; loads
; A with $1C; stores A to PtrHi; loads X from ZpA9; loads A from
; Zp45; and 17 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp00, Zp01, Zp13, ZpA9, ZpAA.
;
; -----------------------------------------------------------------------------
InitRadarSweepWindow:
lda #$13 ; CPU:$E740 PRG:2740 A9 13
sta PtrLo ; CPU:$E742 PRG:2742 85 00
lda #$1C ; CPU:$E744 PRG:2744 A9 1C
sta PtrHi ; CPU:$E746 PRG:2746 85 01
ldx ZpA9 ; CPU:$E748 PRG:2748 A6 A9
lda Zp45 ; CPU:$E74A PRG:274A A5 45
sec ; CPU:$E74C PRG:274C 38
sbc ZpA9 ; CPU:$E74D PRG:274D E5 A9
jsr ComputeRadarAngularDeltaAlt; CPU:$E74F PRG:274F 20 7F E7
stx ZpA9 ; CPU:$E752 PRG:2752 86 A9
lda #$10 ; CPU:$E754 PRG:2754 A9 10
sta PtrLo ; CPU:$E756 PRG:2756 85 00
lda #$16 ; CPU:$E758 PRG:2758 A9 16
sta PtrHi ; CPU:$E75A PRG:275A 85 01
ldx ZpAA ; CPU:$E75C PRG:275C A6 AA
lda Zp46 ; CPU:$E75E PRG:275E A5 46
sec ; CPU:$E760 PRG:2760 38
sbc ZpAA ; CPU:$E761 PRG:2761 E5 AA
jsr ComputeRadarAngularDeltaAlt; CPU:$E763 PRG:2763 20 7F E7
stx ZpAA ; CPU:$E766 PRG:2766 86 AA
ldx #$00 ; CPU:$E768 PRG:2768 A2 00
jsr NormalizeRadarAngle ; CPU:$E76A PRG:276A 20 6E E7
inx ; CPU:$E76D PRG:276D E8
; -----------------------------------------------------------------------------
; Routine: NormalizeRadarAngle
; Global: The routine calls ComputeRadarAngularDelta.
; Local: Executes 4 instructions: loads A from ZpA9,x; branches on
; non-negative to Sub_8764_OnNonnegative_E777; ANDs A with $7F; calls
; ComputeRadarAngularDelta.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp13.
;
; -----------------------------------------------------------------------------
NormalizeRadarAngle:
lda ZpA9,x ; CPU:$E76E PRG:276E B5 A9
bpl Sub_8764_OnNonnegative_E777; CPU:$E770 PRG:2770 10 05
and #$7F ; CPU:$E772 PRG:2772 29 7F
jmp ComputeRadarAngularDelta ; CPU:$E774 PRG:2774 4C 7C E7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E777
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: sets the carry flag; loads A with $80;
; subtracts ZpA9,x from A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp13.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E777:
sec ; CPU:$E777 PRG:2777 38
lda #$80 ; CPU:$E778 PRG:2778 A9 80
sbc ZpA9,x ; CPU:$E77A PRG:277A F5 A9
; -----------------------------------------------------------------------------
; Routine: ComputeRadarAngularDelta
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: stores A to Zp13,x; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, Zp13.
;
; -----------------------------------------------------------------------------
ComputeRadarAngularDelta:
sta Zp13,x ; CPU:$E77C PRG:277C 95 13
rts ; CPU:$E77E PRG:277E 60
; -----------------------------------------------------------------------------
; Routine: ComputeRadarAngularDeltaAlt
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: branches on equal to Sub_8764_OnZero_E790;
; branches on non-negative to Sub_8764_OnNonnegative_E791; EORs A
; with $FF; compares A with PtrLo; branches on carry clear to
; Sub_8764_OnCarryClear_E78F; compares A with PtrHi; and 2 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
ComputeRadarAngularDeltaAlt:
beq Sub_8764_OnZero_E790 ; CPU:$E77F PRG:277F F0 0F
bpl Sub_8764_OnNonnegative_E791; CPU:$E781 PRG:2781 10 0E
eor #$FF ; CPU:$E783 PRG:2783 49 FF
cmp PtrLo ; CPU:$E785 PRG:2785 C5 00
bcc Sub_8764_OnCarryClear_E78F ; CPU:$E787 PRG:2787 90 06
cmp PtrHi ; CPU:$E789 PRG:2789 C5 01
bcc Sub_8764_OnCarryClear_E78E ; CPU:$E78B PRG:278B 90 01
dex ; CPU:$E78D PRG:278D CA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E78E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: decrements X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; X, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E78E:
dex ; CPU:$E78E PRG:278E CA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E78F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: decrements X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; X, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E78F:
dex ; CPU:$E78F PRG:278F CA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E790
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E790:
rts ; CPU:$E790 PRG:2790 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E791
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: compares A with PtrLo; branches on carry
; clear to Sub_8764_OnCarryClear_E79B; compares A with PtrHi;
; branches on carry clear to Sub_8764_OnCarryClear_E79A; increments
; X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E791:
cmp PtrLo ; CPU:$E791 PRG:2791 C5 00
bcc Sub_8764_OnCarryClear_E79B ; CPU:$E793 PRG:2793 90 06
cmp PtrHi ; CPU:$E795 PRG:2795 C5 01
bcc Sub_8764_OnCarryClear_E79A ; CPU:$E797 PRG:2797 90 01
inx ; CPU:$E799 PRG:2799 E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E79A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: increments X.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; X, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E79A:
inx ; CPU:$E79A PRG:279A E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E79B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: increments X; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; X, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E79B:
inx ; CPU:$E79B PRG:279B E8
rts ; CPU:$E79C PRG:279C 60
; -----------------------------------------------------------------------------
; Routine: DispatchEnemyRoutine17
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: jumps indirectly through (IndDispatch17).
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
DispatchEnemyRoutine17:
jmp (IndDispatch17) ; CPU:$E79D PRG:279D 6C 17 00
; -----------------------------------------------------------------------------
; Routine: DispatchEnemyRoutine19
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: jumps indirectly through (IndDispatch19).
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
DispatchEnemyRoutine19:
jmp (IndDispatch19) ; CPU:$E7A0 PRG:27A0 6C 19 00
; -----------------------------------------------------------------------------
; Routine: DispatchEnemyRoutine1B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: jumps indirectly through (IndDispatch1B).
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
DispatchEnemyRoutine1B:
jmp (IndDispatch1B) ; CPU:$E7A3 PRG:27A3 6C 1B 00
; -----------------------------------------------------------------------------
; Routine: CheckRadarSweepEnd
; Global: The routine calls LoadTargetSpawnRecord.
; Local: Executes 6 instructions: loads A from ZpC3; ANDs A with $07; compares
; A with $07; branches on not equal to Sub_8764_OnNonzero_E7B3; loads
; X with $00; calls LoadTargetSpawnRecord.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, Zp1B, Zp1C, ZpC3, the OAM shadow.
;
; -----------------------------------------------------------------------------
CheckRadarSweepEnd:
lda ZpC3 ; CPU:$E7A6 PRG:27A6 A5 C3
and #$07 ; CPU:$E7A8 PRG:27A8 29 07
cmp #$07 ; CPU:$E7AA PRG:27AA C9 07
bne Sub_8764_OnNonzero_E7B3 ; CPU:$E7AC PRG:27AC D0 05
ldx #$00 ; CPU:$E7AE PRG:27AE A2 00
jsr LoadTargetSpawnRecord ; CPU:$E7B0 PRG:27B0 20 06 E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E7B3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from ZpC3; compares A with $EF;
; branches on not equal to Sub_8764_OnNonzero_E7BD; loads A with $FF;
; stores A to ZpC3.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, ZpC3.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E7B3:
lda ZpC3 ; CPU:$E7B3 PRG:27B3 A5 C3
cmp #$EF ; CPU:$E7B5 PRG:27B5 C9 EF
bne Sub_8764_OnNonzero_E7BD ; CPU:$E7B7 PRG:27B7 D0 04
lda #$FF ; CPU:$E7B9 PRG:27B9 A9 FF
sta ZpC3 ; CPU:$E7BB PRG:27BB 85 C3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E7BD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: increments ZpC3; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N and Z flags, ZpC3.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E7BD:
inc ZpC3 ; CPU:$E7BD PRG:27BD E6 C3
rts ; CPU:$E7BF PRG:27BF 60
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarSweep
; Global: The routine calls LoadTargetSpawnRecord.
; Local: Executes 5 instructions: loads A from ZpC3; ANDs A with $07; branches
; on not equal to Sub_8764_OnNonzero_E7CB; loads X with $01; calls
; LoadTargetSpawnRecord.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, Zp1B, Zp1C, ZpC3, the OAM shadow.
;
; -----------------------------------------------------------------------------
AdvanceRadarSweep:
lda ZpC3 ; CPU:$E7C0 PRG:27C0 A5 C3
and #$07 ; CPU:$E7C2 PRG:27C2 29 07
bne Sub_8764_OnNonzero_E7CB ; CPU:$E7C4 PRG:27C4 D0 05
ldx #$01 ; CPU:$E7C6 PRG:27C6 A2 01
jsr LoadTargetSpawnRecord ; CPU:$E7C8 PRG:27C8 20 06 E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E7CB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A from ZpC3; branches on not equal to
; Sub_8764_OnNonzero_E7D3; loads A with $F0; stores A to ZpC3.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, ZpC3.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E7CB:
lda ZpC3 ; CPU:$E7CB PRG:27CB A5 C3
bne Sub_8764_OnNonzero_E7D3 ; CPU:$E7CD PRG:27CD D0 04
lda #$F0 ; CPU:$E7CF PRG:27CF A9 F0
sta ZpC3 ; CPU:$E7D1 PRG:27D1 85 C3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E7D3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: decrements ZpC3; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N and Z flags, ZpC3.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E7D3:
dec ZpC3 ; CPU:$E7D3 PRG:27D3 C6 C3
rts ; CPU:$E7D5 PRG:27D5 60
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarSweepAlt
; Global: The routine calls LoadTargetSpawnRecord.
; Local: Executes 6 instructions: loads A from ZpC1; ANDs A with $07; compares
; A with $07; branches on not equal to Sub_8764_OnNonzero_E7E3; loads
; X with $02; calls LoadTargetSpawnRecord.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags, Zp1B, Zp1C, ZpC1, ZpC2, the OAM shadow.
;
; -----------------------------------------------------------------------------
AdvanceRadarSweepAlt:
lda ZpC1 ; CPU:$E7D6 PRG:27D6 A5 C1
and #$07 ; CPU:$E7D8 PRG:27D8 29 07
cmp #$07 ; CPU:$E7DA PRG:27DA C9 07
bne Sub_8764_OnNonzero_E7E3 ; CPU:$E7DC PRG:27DC D0 05
ldx #$02 ; CPU:$E7DE PRG:27DE A2 02
jsr LoadTargetSpawnRecord ; CPU:$E7E0 PRG:27E0 20 06 E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E7E3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: increments ZpC1; branches on not equal to
; Sub_8764_OnNonzero_E7ED; loads A from PpuCtrlShadow; EORs A with
; $01; stores A to PpuCtrlShadow.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, ZpC1, ZpC2.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E7E3:
inc ZpC1 ; CPU:$E7E3 PRG:27E3 E6 C1
bne Sub_8764_OnNonzero_E7ED ; CPU:$E7E5 PRG:27E5 D0 06
lda PpuCtrlShadow ; CPU:$E7E7 PRG:27E7 A5 C2
eor #$01 ; CPU:$E7E9 PRG:27E9 49 01
sta PpuCtrlShadow ; CPU:$E7EB PRG:27EB 85 C2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E7ED
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E7ED:
rts ; CPU:$E7ED PRG:27ED 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_Return_E7EE
; Global: The routine calls LoadTargetSpawnRecord.
; Local: Executes 5 instructions: loads A from ZpC1; ANDs A with $07; branches
; on not equal to Sub_8764_OnNonzero_E7F9; loads X with $03; calls
; LoadTargetSpawnRecord.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N and Z flags, Zp1B, Zp1C, ZpC1, ZpC2, the OAM shadow.
;
; -----------------------------------------------------------------------------
Sub_8764_Return_E7EE:
lda ZpC1 ; CPU:$E7EE PRG:27EE A5 C1
and #$07 ; CPU:$E7F0 PRG:27F0 29 07
bne Sub_8764_OnNonzero_E7F9 ; CPU:$E7F2 PRG:27F2 D0 05
ldx #$03 ; CPU:$E7F4 PRG:27F4 A2 03
jsr LoadTargetSpawnRecord ; CPU:$E7F6 PRG:27F6 20 06 E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E7F9
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from ZpC1; branches on not equal to
; Sub_8764_OnNonzero_E803; loads A from PpuCtrlShadow; EORs A with
; $01; stores A to PpuCtrlShadow.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N and Z flags, ZpC1, ZpC2.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E7F9:
lda ZpC1 ; CPU:$E7F9 PRG:27F9 A5 C1
bne Sub_8764_OnNonzero_E803 ; CPU:$E7FB PRG:27FB D0 06
lda PpuCtrlShadow ; CPU:$E7FD PRG:27FD A5 C2
eor #$01 ; CPU:$E7FF PRG:27FF 49 01
sta PpuCtrlShadow ; CPU:$E801 PRG:2801 85 C2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E803
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: decrements ZpC1; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N and Z flags, ZpC1.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E803:
dec ZpC1 ; CPU:$E803 PRG:2803 C6 C1
rts ; CPU:$E805 PRG:2805 60
; -----------------------------------------------------------------------------
; Routine: LoadTargetSpawnRecord
; Global: The routine calls DispatchEnemyRoutine1B, writes $0200.
; Local: Executes 9 instructions: loads A from $E821,x; stores A to
; IndDispatch1B; loads A from $E825,x; stores A to IndDispatch1C;
; loads A from $E829,x; pushes A; and 3 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own. Leaves $0200 changed.
; Clobbers:
; A, the N and Z flags, Zp1B, Zp1C, the OAM shadow.
;
; -----------------------------------------------------------------------------
LoadTargetSpawnRecord:
lda $E821,x ; CPU:$E806 PRG:2806 BD 21 E8
sta IndDispatch1B ; CPU:$E809 PRG:2809 85 1B
lda $E825,x ; CPU:$E80B PRG:280B BD 25 E8
sta IndDispatch1C ; CPU:$E80E PRG:280E 85 1C
lda $E829,x ; CPU:$E810 PRG:2810 BD 29 E8
pha ; CPU:$E813 PRG:2813 48
jsr DispatchEnemyRoutine1B ; CPU:$E814 PRG:2814 20 A3 E7
pla ; CPU:$E817 PRG:2817 68
sta $0200 ; CPU:$E818 PRG:2818 8D 00 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E81B
; Global: The routine reads $0200.
; Local: Executes 3 instructions: loads A from $0200; branches on not equal to
; Sub_8764_OnNonzero_E81B; returns with RTS.
; Parameters: Reads $0200 from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E81B:
lda $0200 ; CPU:$E81B PRG:281B AD 00 02
bne Sub_8764_OnNonzero_E81B ; CPU:$E81E PRG:281E D0 FB
rts ; CPU:$E820 PRG:2820 60
; ---- data $E821-$E82C (12 bytes) ----
; referenced by `lda $E821,x` at $E806 (operand $E821 falls inside this region)
; referenced by `lda $E825,x` at $E80B (operand $E825 falls inside this region)
; referenced by `lda $E829,x` at $E810 (operand $E829 falls inside this region)
TargetSpawnTable:
.byte $03, $BB, $76, $25, $F3, $F2, $F3, $F3, $08, $04, $02, $01 ; CPU:$E821 PRG:2821 03 BB 76 25 F3 F2 F3 F3 08 04 02 01
; -----------------------------------------------------------------------------
; Routine: DrawEnemySprite
; Global: The routine calls DrawSpritePart, ApplyRadarCoordinate and AccumulateRadarPosition.
; Local: Executes 7 instructions: loads A with $01; stores A to Zp1E; calls
; DrawSpritePart; loads X with $01; loads Y with $02; calls ApplyRadarCoordinate; and 1
; more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp1E, Zp52, Zp53, ZpA7.
;
; -----------------------------------------------------------------------------
DrawEnemySprite:
lda #$01 ; CPU:$E82D PRG:282D A9 01
sta Zp1E ; CPU:$E82F PRG:282F 85 1E
jsr DrawSpritePart ; CPU:$E831 PRG:2831 20 A1 C5
ldx #$01 ; CPU:$E834 PRG:2834 A2 01
ldy #$02 ; CPU:$E836 PRG:2836 A0 02
jsr ApplyRadarCoordinate ; CPU:$E838 PRG:2838 20 9E E8
jmp AccumulateRadarPosition ; CPU:$E83B PRG:283B 4C 59 E8
; -----------------------------------------------------------------------------
; Routine: DrawEnemySpriteAlt
; Global: The routine calls DrawSpritePart, AccumulateRadarPositionAlt and ComputeRadarCoordinate.
; Local: Executes 11 instructions: calls DrawSpritePart; loads X with $01; loads Y
; with $02; calls AccumulateRadarPositionAlt; loads X with $00; loads Y with $00; and 5
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawEnemySpriteAlt:
jsr DrawSpritePart ; CPU:$E83E PRG:283E 20 A1 C5
ldx #$01 ; CPU:$E841 PRG:2841 A2 01
ldy #$02 ; CPU:$E843 PRG:2843 A0 02
jsr AccumulateRadarPositionAlt ; CPU:$E845 PRG:2845 20 5C E8
ldx #$00 ; CPU:$E848 PRG:2848 A2 00
ldy #$00 ; CPU:$E84A PRG:284A A0 00
jsr AccumulateRadarPositionAlt ; CPU:$E84C PRG:284C 20 5C E8
jsr ComputeRadarCoordinate ; CPU:$E84F PRG:284F 20 6F E8
ldx #$01 ; CPU:$E852 PRG:2852 A2 01
ldy #$02 ; CPU:$E854 PRG:2854 A0 02
jsr ComputeRadarCoordinate ; CPU:$E856 PRG:2856 20 6F E8
; -----------------------------------------------------------------------------
; Routine: AccumulateRadarPosition
; Global: The routine calls SubCC59C.
; Local: Executes 1 instruction: calls SubCC59C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; X and Y, the N and Z flags.
;
; -----------------------------------------------------------------------------
AccumulateRadarPosition:
jmp SubCC59C_OnZero ; CPU:$E859 PRG:2859 4C 9C C5
; -----------------------------------------------------------------------------
; Routine: AccumulateRadarPositionAlt
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 12 instructions: clears the carry flag; loads A from Zp13,x;
; adds Zp15,x to A; stores A to Zp15,x; shifts a right; shifts a
; right; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, Zp00, Zp15.
;
; -----------------------------------------------------------------------------
AccumulateRadarPositionAlt:
clc ; CPU:$E85C PRG:285C 18
lda Zp13,x ; CPU:$E85D PRG:285D B5 13
adc Zp15,x ; CPU:$E85F PRG:285F 75 15
sta Zp15,x ; CPU:$E861 PRG:2861 95 15
lsr a ; CPU:$E863 PRG:2863 4A
lsr a ; CPU:$E864 PRG:2864 4A
lsr a ; CPU:$E865 PRG:2865 4A
sta Zp00,x ; CPU:$E866 PRG:2866 95 00
lda Zp15,x ; CPU:$E868 PRG:2868 B5 15
and #$07 ; CPU:$E86A PRG:286A 29 07
sta Zp15,x ; CPU:$E86C PRG:286C 95 15
rts ; CPU:$E86E PRG:286E 60
; -----------------------------------------------------------------------------
; Routine: ComputeRadarCoordinate
; Global: The routine calls StoreRadarCoordinate.
; Local: Executes 10 instructions: sets the carry flag; loads A from ZpA7,x;
; subtracts ZpA9,x from A; stores A to Zp29; loads A from ZpA9,x;
; branches on non-negative to Sub_8764_OnNonnegative_E882; and 4 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp1D, Zp29, ZpA7.
;
; -----------------------------------------------------------------------------
ComputeRadarCoordinate:
sec ; CPU:$E86F PRG:286F 38
lda ZpA7,x ; CPU:$E870 PRG:2870 B5 A7
sbc ZpA9,x ; CPU:$E872 PRG:2872 F5 A9
sta Zp29 ; CPU:$E874 PRG:2874 85 29
lda ZpA9,x ; CPU:$E876 PRG:2876 B5 A9
bpl Sub_8764_OnNonnegative_E882; CPU:$E878 PRG:2878 10 08
sec ; CPU:$E87A PRG:287A 38
lda Zp29 ; CPU:$E87B PRG:287B A5 29
sbc Zp00,x ; CPU:$E87D PRG:287D F5 00
jmp StoreRadarCoordinate ; CPU:$E87F PRG:287F 4C 87 E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E882
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: clears the carry flag; loads A from Zp29;
; adds Zp00,x to A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp1D, Zp29, ZpA7.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E882:
clc ; CPU:$E882 PRG:2882 18
lda Zp29 ; CPU:$E883 PRG:2883 A5 29
adc Zp00,x ; CPU:$E885 PRG:2885 75 00
; -----------------------------------------------------------------------------
; Routine: StoreRadarCoordinate
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 10 instructions: branches on non-negative to
; Sub_8764_OnNonnegative_E8CB; stores A to Zp29; sets the carry flag;
; loads A with $00; subtracts Zp29 from A; stores A to Zp1D,x; and 4
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp1D, Zp29, ZpA7.
;
; -----------------------------------------------------------------------------
StoreRadarCoordinate:
bpl Sub_8764_OnNonnegative_E8CB; CPU:$E887 PRG:2887 10 42
sta Zp29 ; CPU:$E889 PRG:2889 85 29
sec ; CPU:$E88B PRG:288B 38
lda #$00 ; CPU:$E88C PRG:288C A9 00
sbc Zp29 ; CPU:$E88E PRG:288E E5 29
sta Zp1D,x ; CPU:$E890 PRG:2890 95 1D
lda $E91B,y ; CPU:$E892 PRG:2892 B9 1B E9
sta a:Zp17,y ; CPU:$E895 PRG:2895 99 17 00
lda $E91C,y ; CPU:$E898 PRG:2898 B9 1C E9
sta a:Zp18,y ; CPU:$E89B PRG:289B 99 18 00
; -----------------------------------------------------------------------------
; Routine: ApplyRadarCoordinate
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 16 instructions: sets the carry flag; loads A from ZpAE,y;
; subtracts Zp1D,x from A; stores A to ZpAE,y; branches on carry set
; to SubCE8C6; loads A from ZpAF,y; and 10 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, ZpA7.
;
; -----------------------------------------------------------------------------
ApplyRadarCoordinate:
sec ; CPU:$E89E PRG:289E 38
lda a:ZpAE,y ; CPU:$E89F PRG:289F B9 AE 00
sbc Zp1D,x ; CPU:$E8A2 PRG:28A2 F5 1D
sta a:ZpAE,y ; CPU:$E8A4 PRG:28A4 99 AE 00
bcs SubCE8C6_OnCarryClear ; CPU:$E8A7 PRG:28A7 B0 1D
lda a:ZpAF,y ; CPU:$E8A9 PRG:28A9 B9 AF 00
sbc #$00 ; CPU:$E8AC PRG:28AC E9 00
sta a:ZpAF,y ; CPU:$E8AE PRG:28AE 99 AF 00
bpl SubCE8C6_OnCarryClear ; CPU:$E8B1 PRG:28B1 10 13
sec ; CPU:$E8B3 PRG:28B3 38
lda a:ZpAE,y ; CPU:$E8B4 PRG:28B4 B9 AE 00
sbc $E90F,x ; CPU:$E8B7 PRG:28B7 FD 0F E9
sta a:ZpAE,y ; CPU:$E8BA PRG:28BA 99 AE 00
lda a:ZpAF,y ; CPU:$E8BD PRG:28BD B9 AF 00
sbc $E911,x ; CPU:$E8C0 PRG:28C0 FD 11 E9
sta a:ZpAF,y ; CPU:$E8C3 PRG:28C3 99 AF 00
; -----------------------------------------------------------------------------
; Routine: SubCE8C6_OnCarryClear
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from ZpA9,x; stores A to ZpA7,x;
; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, ZpA7.
;
; -----------------------------------------------------------------------------
SubCE8C6_OnCarryClear:
lda ZpA9,x ; CPU:$E8C6 PRG:28C6 B5 A9
sta ZpA7,x ; CPU:$E8C8 PRG:28C8 95 A7
rts ; CPU:$E8CA PRG:28CA 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E8CB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 21 instructions: loads A from ZpA9,x; stores A to ZpA7,x;
; returns with RTS; stores A to Zp1D,x; loads A from $E91F,y; stores
; A to Zp17,y; and 15 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, Zp1D, ZpA7.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E8CB:
sta Zp1D,x ; CPU:$E8CB PRG:28CB 95 1D
lda $E91F,y ; CPU:$E8CD PRG:28CD B9 1F E9
sta a:Zp17,y ; CPU:$E8D0 PRG:28D0 99 17 00
lda $E920,y ; CPU:$E8D3 PRG:28D3 B9 20 E9
sta a:Zp18,y ; CPU:$E8D6 PRG:28D6 99 18 00
clc ; CPU:$E8D9 PRG:28D9 18
lda a:ZpAE,y ; CPU:$E8DA PRG:28DA B9 AE 00
adc Zp1D,x ; CPU:$E8DD PRG:28DD 75 1D
sta a:ZpAE,y ; CPU:$E8DF PRG:28DF 99 AE 00
lda a:ZpAF,y ; CPU:$E8E2 PRG:28E2 B9 AF 00
adc #$00 ; CPU:$E8E5 PRG:28E5 69 00
sta a:ZpAF,y ; CPU:$E8E7 PRG:28E7 99 AF 00
cmp $E913,x ; CPU:$E8EA PRG:28EA DD 13 E9
bcc SubCE8C6_OnCarryClear ; CPU:$E8ED PRG:28ED 90 D7
bne Sub_8764_OnNonzero_E8F9 ; CPU:$E8EF PRG:28EF D0 08
lda a:ZpAE,y ; CPU:$E8F1 PRG:28F1 B9 AE 00
cmp $E919,x ; CPU:$E8F4 PRG:28F4 DD 19 E9
bcc SubCE8C6_OnCarryClear ; CPU:$E8F7 PRG:28F7 90 CD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_E8F9
; Global: The routine calls SubCE8C6.
; Local: Executes 8 instructions: sets the carry flag; loads A from ZpAE,y;
; subtracts $E915,x from A; stores A to ZpAE,y; loads A from ZpAF,y;
; subtracts $E917,x from A; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, ZpA7.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_E8F9:
sec ; CPU:$E8F9 PRG:28F9 38
lda a:ZpAE,y ; CPU:$E8FA PRG:28FA B9 AE 00
sbc $E915,x ; CPU:$E8FD PRG:28FD FD 15 E9
sta a:ZpAE,y ; CPU:$E900 PRG:2900 99 AE 00
lda a:ZpAF,y ; CPU:$E903 PRG:2903 B9 AF 00
sbc $E917,x ; CPU:$E906 PRG:2906 FD 17 E9
sta a:ZpAF,y ; CPU:$E909 PRG:2909 99 AF 00
jmp SubCE8C6_OnCarryClear ; CPU:$E90C PRG:290C 4C C6 E8
; ---- data $E90F-$E922 (20 bytes) ----
; referenced by `lda $E91B,y` at $E892 (operand $E91B falls inside this region)
; referenced by `lda $E91C,y` at $E898 (operand $E91C falls inside this region)
; referenced by `sbc $E90F,x` at $E8B7 (operand $E90F falls inside this region)
; referenced by `sbc $E911,x` at $E8C0 (operand $E911 falls inside this region)
; referenced by `lda $E91F,y` at $E8CD (operand $E91F falls inside this region)
; referenced by `lda $E920,y` at $E8D3 (operand $E920 falls inside this region)
; ... and 4 further references from decoded code
.byte $80, $30, $F3, $F8, $0C, $07, $80, $D0, $0C, $07, $80, $D0, $EE, $E7, $C0, $E7 ; CPU:$E90F PRG:290F 80 30 F3 F8 0C 07 80 D0 0C 07 80 D0 EE E7 C0 E7
.byte $D6, $E7, $A6, $E7 ; CPU:$E91F PRG:291F D6 E7 A6 E7
; -----------------------------------------------------------------------------
; Routine: InitRadarDirection
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp0B; branches on equal to
; Sub_8764_OnZero_E929; loads A with $02.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
InitRadarDirection:
lda Zp0B ; CPU:$E923 PRG:2923 A5 0B
beq Sub_8764_OnZero_E929 ; CPU:$E925 PRG:2925 F0 02
lda #$02 ; CPU:$E927 PRG:2927 A9 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E929
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: stores A to Zp36; stores A to Zp37; loads Y
; with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E929:
sta Zp36 ; CPU:$E929 PRG:2929 85 36
sta Zp37 ; CPU:$E92B PRG:292B 85 37
ldy #$00 ; CPU:$E92D PRG:292D A0 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E92F
; Global: The routine calls FindActiveRadarBlip.
; Local: Executes 4 instructions: loads A from Zp65,y; branches on equal to
; Sub_8764_JoinBranchPaths_E939; branches on negative to
; Sub_8764_JoinBranchPaths_E939; calls FindActiveRadarBlip.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E92F:
lda a:Zp65,y ; CPU:$E92F PRG:292F B9 65 00
beq Sub_8764_JoinBranchPaths_E939 ; CPU:$E932 PRG:2932 F0 05
bmi Sub_8764_JoinBranchPaths_E939 ; CPU:$E934 PRG:2934 30 03
jsr FindActiveRadarBlip ; CPU:$E936 PRG:2936 20 A5 E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_E939
; Global: The routine calls FindActiveRadarBlip.
; Local: Executes 7 instructions: loads A from Zp65,y; branches on equal to
; Sub_8764_JoinBranchPaths_E939; branches on negative to
; Sub_8764_JoinBranchPaths_E939; calls FindActiveRadarBlip; increments Y;
; compares Y with $10; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_E939:
iny ; CPU:$E939 PRG:2939 C8
cpy #$10 ; CPU:$E93A PRG:293A C0 10
bcc Sub_8764_OnCarryClear_E92F ; CPU:$E93C PRG:293C 90 F1
; -----------------------------------------------------------------------------
; Routine: ApplyRadarDirectionMask
; Global: The routine calls CheckRadarBlipRange.
; Local: Executes 23 instructions: loads Y from Zp09; branches on equal to
; Sub_8764_OnZero_E967; copies Y into A; ANDs A with Zp37; stores A
; to Zp37; copies Y into A; and 17 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N and Z flags, Zp33, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
ApplyRadarDirectionMask:
ldy Zp09 ; CPU:$E93E PRG:293E A4 09
beq Sub_8764_OnZero_E967 ; CPU:$E940 PRG:2940 F0 25
tya ; CPU:$E942 PRG:2942 98
and Zp37 ; CPU:$E943 PRG:2943 25 37
sta Zp37 ; CPU:$E945 PRG:2945 85 37
tya ; CPU:$E947 PRG:2947 98
and Zp33 ; CPU:$E948 PRG:2948 25 33
sta Zp33 ; CPU:$E94A PRG:294A 85 33
tya ; CPU:$E94C PRG:294C 98
and Zp35 ; CPU:$E94D PRG:294D 25 35
sta Zp35 ; CPU:$E94F PRG:294F 85 35
ldy Zp31 ; CPU:$E951 PRG:2951 A4 31
tya ; CPU:$E953 PRG:2953 98
and Zp36 ; CPU:$E954 PRG:2954 25 36
jsr CheckRadarBlipRange ; CPU:$E956 PRG:2956 20 D2 EA
tya ; CPU:$E959 PRG:2959 98
and Zp32 ; CPU:$E95A PRG:295A 25 32
ora Zp33 ; CPU:$E95C PRG:295C 05 33
sta Zp33 ; CPU:$E95E PRG:295E 85 33
tya ; CPU:$E960 PRG:2960 98
and Zp34 ; CPU:$E961 PRG:2961 25 34
ora Zp35 ; CPU:$E963 PRG:2963 05 35
sta Zp35 ; CPU:$E965 PRG:2965 85 35
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E967
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E967:
rts ; CPU:$E967 PRG:2967 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E968
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 17 instructions: loads A from $043C,x; stores A to $06D7,y;
; sets the carry flag; loads A from $02EF,x; subtracts ZpB0 from A;
; stores A to Zp29; and 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E968:
lda $043C,x ; CPU:$E968 PRG:2968 BD 3C 04
sta $06D7,y ; CPU:$E96B PRG:296B 99 D7 06
sec ; CPU:$E96E PRG:296E 38
lda $02EF,x ; CPU:$E96F PRG:296F BD EF 02
sbc ZpB0 ; CPU:$E972 PRG:2972 E5 B0
sta Zp29 ; CPU:$E974 PRG:2974 85 29
lda $03CD,x ; CPU:$E976 PRG:2976 BD CD 03
sbc ZpB1 ; CPU:$E979 PRG:2979 E5 B1
sta Zp2A ; CPU:$E97B PRG:297B 85 2A
bpl Sub_8764_OnNonnegative_E98C; CPU:$E97D PRG:297D 10 0D
clc ; CPU:$E97F PRG:297F 18
lda Zp29 ; CPU:$E980 PRG:2980 A5 29
adc #$D0 ; CPU:$E982 PRG:2982 69 D0
sta Zp29 ; CPU:$E984 PRG:2984 85 29
lda Zp2A ; CPU:$E986 PRG:2986 A5 2A
adc #$07 ; CPU:$E988 PRG:2988 69 07
sta Zp2A ; CPU:$E98A PRG:298A 85 2A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E98C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: branches on equal to Sub_8764_OnZero_E996;
; loads A from Zp29; compares A with $9E; branches on carry set to
; SubCE9AE; branches on carry clear to Sub_8764_OnCarryClear_E99C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E98C:
beq Sub_8764_OnZero_E996 ; CPU:$E98C PRG:298C F0 08
lda Zp29 ; CPU:$E98E PRG:298E A5 29
cmp #$9E ; CPU:$E990 PRG:2990 C9 9E
bcs SubCE9AE_Loop ; CPU:$E992 PRG:2992 B0 1A
bcc Sub_8764_OnCarryClear_E99C ; CPU:$E994 PRG:2994 90 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E996
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp29; compares A with $9E;
; branches on carry clear to SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E996:
lda Zp29 ; CPU:$E996 PRG:2996 A5 29
cmp #$9E ; CPU:$E998 PRG:2998 C9 9E
bcc SubCE9AE_Loop ; CPU:$E99A PRG:299A 90 12
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E99C
; Global: The routine calls ComputePlayerRelativePosition.
; Local: Executes 4 instructions: sets the carry flag; subtracts $A2 from A;
; stores A to Zp95,y; calls ComputePlayerRelativePosition.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E99C:
sec ; CPU:$E99C PRG:299C 38
sbc #$A2 ; CPU:$E99D PRG:299D E9 A2
sta a:Zp95,y ; CPU:$E99F PRG:299F 99 95 00
jmp ComputePlayerRelativePosition ; CPU:$E9A2 PRG:29A2 4C 01 EA
; -----------------------------------------------------------------------------
; Routine: FindActiveRadarBlip
; Global: The routine calls ComputePlayerRelativePosition.
; Local: Executes 33 instructions: loads A from $043C,x; stores A to $06D7,y;
; sets the carry flag; loads A from $02EF,x; subtracts ZpB0 from A;
; stores A to Zp29; and 27 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
FindActiveRadarBlip:
lda a:Zp65,y ; CPU:$E9A5 PRG:29A5 B9 65 00
tax ; CPU:$E9A8 PRG:29A8 AA
lda $035E,x ; CPU:$E9A9 PRG:29A9 BD 5E 03
bpl Sub_8764_OnNonnegative_E968; CPU:$E9AC PRG:29AC 10 BA
; -----------------------------------------------------------------------------
; Routine: SubCE9AE_Loop
; Global: The routine calls DestroyEnemy.
; Local: Executes 5 instructions: compares X with $0A; branches on carry set
; to Sub_8764_OnCarrySet_E9BA; loads A with $00; stores A to $0589,x;
; calls DestroyEnemy.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCE9AE_Loop:
cpx #$0A ; CPU:$E9AE PRG:29AE E0 0A
bcs Sub_8764_OnCarrySet_E9BA ; CPU:$E9B0 PRG:29B0 B0 08
lda #$00 ; CPU:$E9B2 PRG:29B2 A9 00
sta $0589,x ; CPU:$E9B4 PRG:29B4 9D 89 05
jsr DestroyEnemy ; CPU:$E9B7 PRG:29B7 20 DB DD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_E9BA
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from $04AB,x; ANDs A with $7F;
; stores A to $04AB,x; loads A with $FF; stores A to Zp65,y; compares
; Y with $08; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_E9BA:
lda $04AB,x ; CPU:$E9BA PRG:29BA BD AB 04
and #$7F ; CPU:$E9BD PRG:29BD 29 7F
sta $04AB,x ; CPU:$E9BF PRG:29BF 9D AB 04
lda #$FF ; CPU:$E9C2 PRG:29C2 A9 FF
sta a:Zp65,y ; CPU:$E9C4 PRG:29C4 99 65 00
cpy #$08 ; CPU:$E9C7 PRG:29C7 C0 08
bcc Sub_8764_OnCarryClear_E9D7 ; CPU:$E9C9 PRG:29C9 90 0C
; -----------------------------------------------------------------------------
; Routine: ApplyRadarSweepMask
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from $E6D5,y; ANDs A with Zp09;
; stores A to Zp09; EORs A with $FF; stores A to Zp31; returns with
; RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N and Z flags, Zp09, Zp31.
;
; -----------------------------------------------------------------------------
ApplyRadarSweepMask:
lda $E6D5,y ; CPU:$E9CB PRG:29CB B9 D5 E6
and Zp09 ; CPU:$E9CE PRG:29CE 25 09
sta Zp09 ; CPU:$E9D0 PRG:29D0 85 09
eor #$FF ; CPU:$E9D2 PRG:29D2 49 FF
sta Zp31 ; CPU:$E9D4 PRG:29D4 85 31
rts ; CPU:$E9D6 PRG:29D6 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E9D7
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp09; branches on equal to
; Sub_8764_OnZero_E9E8; loads X with $0B.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E9D7:
lda Zp09 ; CPU:$E9D7 PRG:29D7 A5 09
beq Sub_8764_OnZero_E9E8 ; CPU:$E9D9 PRG:29D9 F0 0D
ldx #$0B ; CPU:$E9DB PRG:29DB A2 0B
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_E9DD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp65,x; branches on equal to
; Sub_8764_OnZero_E9E3; branches on non-negative to
; Sub_8764_OnNonnegative_E9E9.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_E9DD:
lda Zp65,x ; CPU:$E9DD PRG:29DD B5 65
beq Sub_8764_OnZero_E9E3 ; CPU:$E9DF PRG:29DF F0 02
bpl Sub_8764_OnNonnegative_E9E9; CPU:$E9E1 PRG:29E1 10 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E9E3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: loads A from Zp65,x; branches on equal to
; Sub_8764_OnZero_E9E3; branches on non-negative to
; Sub_8764_OnNonnegative_E9E9; increments X; compares X with $10;
; branches on carry clear to Sub_8764_OnCarryClear_E9DD.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E9E3:
inx ; CPU:$E9E3 PRG:29E3 E8
cpx #$10 ; CPU:$E9E4 PRG:29E4 E0 10
bcc Sub_8764_OnCarryClear_E9DD ; CPU:$E9E6 PRG:29E6 90 F5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_E9E8
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_E9E8:
rts ; CPU:$E9E8 PRG:29E8 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_E9E9
; Global: The routine calls InitRadarBlipRecord and ApplyRadarSweepMask.
; Local: Executes 11 instructions: stores X to Zp29; stores Y to Zp2A; copies
; A into X; calls InitRadarBlipRecord; loads Y from Zp29; calls ApplyRadarSweepMask; and 5
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_E9E9:
stx Zp29 ; CPU:$E9E9 PRG:29E9 86 29
sty Zp2A ; CPU:$E9EB PRG:29EB 84 2A
tax ; CPU:$E9ED PRG:29ED AA
jsr InitRadarBlipRecord ; CPU:$E9EE PRG:29EE 20 9E EC
ldy Zp29 ; CPU:$E9F1 PRG:29F1 A4 29
jsr ApplyRadarSweepMask ; CPU:$E9F3 PRG:29F3 20 CB E9
lda #$FA ; CPU:$E9F6 PRG:29F6 A9 FA
sta a:Zp65,y ; CPU:$E9F8 PRG:29F8 99 65 00
sta a:Zp95,y ; CPU:$E9FB PRG:29FB 99 95 00
ldy Zp2A ; CPU:$E9FE PRG:29FE A4 2A
rts ; CPU:$EA00 PRG:2A00 60
; -----------------------------------------------------------------------------
; Routine: ComputePlayerRelativePosition
; Global: The routine calls DestroyEnemy, InitRadarBlipRecord and ApplyRadarSweepMask.
; Local: Executes 54 instructions: compares X with $0A; branches on carry set
; to Sub_8764_OnCarrySet_E9BA; loads A with $00; stores A to $0589,x;
; calls DestroyEnemy; loads A from $04AB,x; and 48 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
ComputePlayerRelativePosition:
sec ; CPU:$EA01 PRG:2A01 38
lda $0280,x ; CPU:$EA02 PRG:2A02 BD 80 02
sbc ZpAE ; CPU:$EA05 PRG:2A05 E5 AE
sta Zp29 ; CPU:$EA07 PRG:2A07 85 29
lda $035E,x ; CPU:$EA09 PRG:2A09 BD 5E 03
sbc ZpAF ; CPU:$EA0C PRG:2A0C E5 AF
sta Zp2A ; CPU:$EA0E PRG:2A0E 85 2A
bpl Sub_8764_OnNonnegative_EA1F; CPU:$EA10 PRG:2A10 10 0D
clc ; CPU:$EA12 PRG:2A12 18
lda Zp29 ; CPU:$EA13 PRG:2A13 A5 29
adc #$80 ; CPU:$EA15 PRG:2A15 69 80
sta Zp29 ; CPU:$EA17 PRG:2A17 85 29
lda Zp2A ; CPU:$EA19 PRG:2A19 A5 2A
adc #$0C ; CPU:$EA1B PRG:2A1B 69 0C
sta Zp2A ; CPU:$EA1D PRG:2A1D 85 2A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_EA1F
; Global: The routine calls DestroyEnemy, InitRadarBlipRecord and ApplyRadarSweepMask.
; Local: Executes 47 instructions: compares X with $0A; branches on carry set
; to Sub_8764_OnCarrySet_E9BA; loads A with $00; stores A to $0589,x;
; calls DestroyEnemy; loads A from $04AB,x; and 41 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_EA1F:
beq SubCE9AE_Loop ; CPU:$EA1F PRG:2A1F F0 8D
cmp #$01 ; CPU:$EA21 PRG:2A21 C9 01
beq Sub_8764_OnZero_EA66 ; CPU:$EA23 PRG:2A23 F0 41
lda $043C,x ; CPU:$EA25 PRG:2A25 BD 3C 04
cmp #$A9 ; CPU:$EA28 PRG:2A28 C9 A9
bcc Sub_8764_OnCarryClear_EA30 ; CPU:$EA2A PRG:2A2A 90 04
cmp #$AD ; CPU:$EA2C PRG:2A2C C9 AD
bcc Sub_8764_OnCarryClear_EA4E ; CPU:$EA2E PRG:2A2E 90 1E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA30
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: compares A with $66; branches on carry clear
; to Sub_8764_OnCarryClear_EA38; compares A with $68; branches on
; carry clear to Sub_8764_OnCarryClear_EA45.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA30:
cmp #$66 ; CPU:$EA30 PRG:2A30 C9 66
bcc Sub_8764_OnCarryClear_EA38 ; CPU:$EA32 PRG:2A32 90 04
cmp #$68 ; CPU:$EA34 PRG:2A34 C9 68
bcc Sub_8764_OnCarryClear_EA45 ; CPU:$EA36 PRG:2A36 90 0D
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA38
; Global: The routine calls SubCE9AE.
; Local: Executes 6 instructions: compares A with $64; branches on not equal
; to Sub_8764_OnNonzero_EA5A; loads A from Zp29; compares A with $32;
; branches on carry clear to Sub_8764_OnCarryClear_EA57; calls
; SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA38:
cmp #$64 ; CPU:$EA38 PRG:2A38 C9 64
bne Sub_8764_OnNonzero_EA5A ; CPU:$EA3A PRG:2A3A D0 1E
lda Zp29 ; CPU:$EA3C PRG:2A3C A5 29
cmp #$32 ; CPU:$EA3E PRG:2A3E C9 32
bcc Sub_8764_OnCarryClear_EA57 ; CPU:$EA40 PRG:2A40 90 15
jmp SubCE9AE_Loop ; CPU:$EA42 PRG:2A42 4C AE E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA45
; Global: The routine calls SubCE9AE.
; Local: Executes 4 instructions: loads A from Zp29; compares A with $56;
; branches on carry clear to Sub_8764_OnCarryClear_EA57; calls
; SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA45:
lda Zp29 ; CPU:$EA45 PRG:2A45 A5 29
cmp #$56 ; CPU:$EA47 PRG:2A47 C9 56
bcc Sub_8764_OnCarryClear_EA57 ; CPU:$EA49 PRG:2A49 90 0C
jmp SubCE9AE_Loop ; CPU:$EA4B PRG:2A4B 4C AE E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA4E
; Global: The routine calls SubCE9AE.
; Local: Executes 4 instructions: loads A from Zp29; compares A with $4A;
; branches on carry clear to Sub_8764_OnCarryClear_EA57; calls
; SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA4E:
lda Zp29 ; CPU:$EA4E PRG:2A4E A5 29
cmp #$4A ; CPU:$EA50 PRG:2A50 C9 4A
bcc Sub_8764_OnCarryClear_EA57 ; CPU:$EA52 PRG:2A52 90 03
jmp SubCE9AE_Loop ; CPU:$EA54 PRG:2A54 4C AE E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA57
; Global: The routine calls SubCEAB5.
; Local: Executes 1 instruction: calls SubCEAB5.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp36, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA57:
jmp SubCEAB5_Loop ; CPU:$EA57 PRG:2A57 4C B5 EA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EA5A
; Global: The routine calls SubCE9AE.
; Local: Executes 4 instructions: loads A from Zp29; compares A with $5A;
; branches on carry clear to Sub_8764_OnCarryClear_EA63; calls
; SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EA5A:
lda Zp29 ; CPU:$EA5A PRG:2A5A A5 29
cmp #$5A ; CPU:$EA5C PRG:2A5C C9 5A
bcc Sub_8764_OnCarryClear_EA63 ; CPU:$EA5E PRG:2A5E 90 03
jmp SubCE9AE_Loop ; CPU:$EA60 PRG:2A60 4C AE E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA63
; Global: The routine calls SubCEAB5.
; Local: Executes 1 instruction: calls SubCEAB5.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp36, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA63:
jmp SubCEAB5_Loop ; CPU:$EA63 PRG:2A63 4C B5 EA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EA66
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from $043C,x; compares A with $A9;
; branches on carry clear to Sub_8764_OnCarryClear_EA71; compares A
; with $AD; branches on carry clear to Sub_8764_OnCarryClear_EA8F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EA66:
lda $043C,x ; CPU:$EA66 PRG:2A66 BD 3C 04
cmp #$A9 ; CPU:$EA69 PRG:2A69 C9 A9
bcc Sub_8764_OnCarryClear_EA71 ; CPU:$EA6B PRG:2A6B 90 04
cmp #$AD ; CPU:$EA6D PRG:2A6D C9 AD
bcc Sub_8764_OnCarryClear_EA8F ; CPU:$EA6F PRG:2A6F 90 1E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA71
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: compares A with $66; branches on carry clear
; to Sub_8764_OnCarryClear_EA79; compares A with $68; branches on
; carry clear to Sub_8764_OnCarryClear_EA86.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA71:
cmp #$66 ; CPU:$EA71 PRG:2A71 C9 66
bcc Sub_8764_OnCarryClear_EA79 ; CPU:$EA73 PRG:2A73 90 04
cmp #$68 ; CPU:$EA75 PRG:2A75 C9 68
bcc Sub_8764_OnCarryClear_EA86 ; CPU:$EA77 PRG:2A77 90 0D
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA79
; Global: The routine calls SubCE9AE.
; Local: Executes 6 instructions: compares A with $64; branches on not equal
; to Sub_8764_OnNonzero_EA9B; loads A from Zp29; compares A with $50;
; branches on carry set to Sub_8764_OnCarrySet_EA98; calls SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA79:
cmp #$64 ; CPU:$EA79 PRG:2A79 C9 64
bne Sub_8764_OnNonzero_EA9B ; CPU:$EA7B PRG:2A7B D0 1E
lda Zp29 ; CPU:$EA7D PRG:2A7D A5 29
cmp #$50 ; CPU:$EA7F PRG:2A7F C9 50
bcs Sub_8764_OnCarrySet_EA98 ; CPU:$EA81 PRG:2A81 B0 15
jmp SubCE9AE_Loop ; CPU:$EA83 PRG:2A83 4C AE E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA86
; Global: The routine calls SubCE9AE.
; Local: Executes 4 instructions: loads A from Zp29; compares A with $6A;
; branches on carry set to Sub_8764_OnCarrySet_EA98; calls SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA86:
lda Zp29 ; CPU:$EA86 PRG:2A86 A5 29
cmp #$6A ; CPU:$EA88 PRG:2A88 C9 6A
bcs Sub_8764_OnCarrySet_EA98 ; CPU:$EA8A PRG:2A8A B0 0C
jmp SubCE9AE_Loop ; CPU:$EA8C PRG:2A8C 4C AE E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EA8F
; Global: The routine calls SubCE9AE.
; Local: Executes 4 instructions: loads A from Zp29; compares A with $68;
; branches on carry set to Sub_8764_OnCarrySet_EA98; calls SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EA8F:
lda Zp29 ; CPU:$EA8F PRG:2A8F A5 29
cmp #$68 ; CPU:$EA91 PRG:2A91 C9 68
bcs Sub_8764_OnCarrySet_EA98 ; CPU:$EA93 PRG:2A93 B0 03
jmp SubCE9AE_Loop ; CPU:$EA95 PRG:2A95 4C AE E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EA98
; Global: The routine calls SubCEAA4.
; Local: Executes 1 instruction: calls SubCEAA4.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp36, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EA98:
jmp SubCEAA4_Loop ; CPU:$EA98 PRG:2A98 4C A4 EA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EA9B
; Global: The routine calls SubCE9AE.
; Local: Executes 4 instructions: loads A from Zp29; compares A with $69;
; branches on carry set to SubCEAA4; calls SubCE9AE.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EA9B:
lda Zp29 ; CPU:$EA9B PRG:2A9B A5 29
cmp #$69 ; CPU:$EA9D PRG:2A9D C9 69
bcs SubCEAA4_Loop ; CPU:$EA9F PRG:2A9F B0 03
jmp SubCE9AE_Loop ; CPU:$EAA1 PRG:2AA1 4C AE E9
; -----------------------------------------------------------------------------
; Routine: SubCEAA4_Loop
; Global: The routine calls SetJoystickDirectionMask.
; Local: Executes 8 instructions: loads A from Zp29; compares A with $33;
; branches on carry set to SubCEAB5; clears the carry flag; loads A
; from Zp29; adds $CD to A; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp36, Zp37.
;
; -----------------------------------------------------------------------------
SubCEAA4_Loop:
lda Zp29 ; CPU:$EAA4 PRG:2AA4 A5 29
cmp #$33 ; CPU:$EAA6 PRG:2AA6 C9 33
bcs SubCEAB5_Loop ; CPU:$EAA8 PRG:2AA8 B0 0B
clc ; CPU:$EAAA PRG:2AAA 18
lda Zp29 ; CPU:$EAAB PRG:2AAB A5 29
adc #$CD ; CPU:$EAAD PRG:2AAD 69 CD
sta a:Zp85,y ; CPU:$EAAF PRG:2AAF 99 85 00
jmp SetJoystickDirectionMask ; CPU:$EAB2 PRG:2AB2 4C C3 EA
; -----------------------------------------------------------------------------
; Routine: SubCEAB5_Loop
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: sets the carry flag; loads A from Zp29;
; subtracts $33 from A; stores A to Zp85,y; loads A from Zp2A;
; subtracts $01 from A; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp36, Zp37.
;
; -----------------------------------------------------------------------------
SubCEAB5_Loop:
sec ; CPU:$EAB5 PRG:2AB5 38
lda Zp29 ; CPU:$EAB6 PRG:2AB6 A5 29
sbc #$33 ; CPU:$EAB8 PRG:2AB8 E9 33
sta a:Zp85,y ; CPU:$EABA PRG:2ABA 99 85 00
lda Zp2A ; CPU:$EABD PRG:2ABD A5 2A
sbc #$01 ; CPU:$EABF PRG:2ABF E9 01
beq Sub_8764_OnZero_EACE ; CPU:$EAC1 PRG:2AC1 F0 0B
; -----------------------------------------------------------------------------
; Routine: SetJoystickDirectionMask
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: compares Y with $08; branches on carry set
; to Sub_8764_OnCarrySet_EACF; loads A from $E6CD,y; ORs A with Zp36;
; stores A to Zp36.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags, Zp36, Zp37.
;
; -----------------------------------------------------------------------------
SetJoystickDirectionMask:
cpy #$08 ; CPU:$EAC3 PRG:2AC3 C0 08
bcs Sub_8764_OnCarrySet_EACF ; CPU:$EAC5 PRG:2AC5 B0 08
lda $E6CD,y ; CPU:$EAC7 PRG:2AC7 B9 CD E6
ora Zp36 ; CPU:$EACA PRG:2ACA 05 36
sta Zp36 ; CPU:$EACC PRG:2ACC 85 36
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EACE
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EACE:
rts ; CPU:$EACE PRG:2ACE 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EACF
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A from $E6C5,y.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N and Z flags, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EACF:
lda $E6C5,y ; CPU:$EACF PRG:2ACF B9 C5 E6
; -----------------------------------------------------------------------------
; Routine: CheckRadarBlipRange
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: ORs A with Zp37; stores A to Zp37; returns
; with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N and Z flags, Zp37.
;
; -----------------------------------------------------------------------------
CheckRadarBlipRange:
ora Zp37 ; CPU:$EAD2 PRG:2AD2 05 37
sta Zp37 ; CPU:$EAD4 PRG:2AD4 85 37
rts ; CPU:$EAD6 PRG:2AD6 60
; -----------------------------------------------------------------------------
; Routine: FindRadarBlipInRange
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp65,x; compares A with $15;
; branches on carry set to Sub_8764_OnCarrySet_EAE1; compares A with
; $0B; branches on carry set to Sub_8764_OnCarrySet_EAE2.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
FindRadarBlipInRange:
lda Zp65,x ; CPU:$EAD7 PRG:2AD7 B5 65
cmp #$15 ; CPU:$EAD9 PRG:2AD9 C9 15
bcs Sub_8764_OnCarrySet_EAE1 ; CPU:$EADB PRG:2ADB B0 04
cmp #$0B ; CPU:$EADD PRG:2ADD C9 0B
bcs Sub_8764_OnCarrySet_EAE2 ; CPU:$EADF PRG:2ADF B0 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EAE1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: clears the carry flag.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EAE1:
clc ; CPU:$EAE1 PRG:2AE1 18
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EAE2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EAE2:
rts ; CPU:$EAE2 PRG:2AE2 60
; -----------------------------------------------------------------------------
; Routine: HandleRadarSweepCollision
; Global: The routine calls FindRadarBlipInRange.
; Local: Executes 8 instructions: calls FindRadarBlipInRange; branches on carry clear to
; Sub_8764_OnCarryClear_EAF5; copies A into Y; loads A from $04AB,y;
; ANDs A with $7F; stores A to $04AB,y; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z and C flags, Zp65, $04AB.
;
; -----------------------------------------------------------------------------
HandleRadarSweepCollision:
jsr FindRadarBlipInRange ; CPU:$EAE3 PRG:2AE3 20 D7 EA
bcc Sub_8764_OnCarryClear_EAF5 ; CPU:$EAE6 PRG:2AE6 90 0D
tay ; CPU:$EAE8 PRG:2AE8 A8
lda $04AB,y ; CPU:$EAE9 PRG:2AE9 B9 AB 04
and #$7F ; CPU:$EAEC PRG:2AEC 29 7F
sta $04AB,y ; CPU:$EAEE PRG:2AEE 99 AB 04
lda #$FF ; CPU:$EAF1 PRG:2AF1 A9 FF
sta Zp65,x ; CPU:$EAF3 PRG:2AF3 95 65
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EAF5
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EAF5:
rts ; CPU:$EAF5 PRG:2AF5 60
; -----------------------------------------------------------------------------
; Routine: ProcessRadarSweepCollisions
; Global: The routine calls FindRadarBlipInRange and HandleRadarSweepCollision.
; Local: Executes 7 instructions: loads X with $07; calls FindRadarBlipInRange; branches
; on carry set to Sub_8764_OnCarrySet_EB06; loads X with $05; calls
; HandleRadarSweepCollision; increments X; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
ProcessRadarSweepCollisions:
ldx #$07 ; CPU:$EAF6 PRG:2AF6 A2 07
jsr FindRadarBlipInRange ; CPU:$EAF8 PRG:2AF8 20 D7 EA
bcs Sub_8764_OnCarrySet_EB06 ; CPU:$EAFB PRG:2AFB B0 09
ldx #$05 ; CPU:$EAFD PRG:2AFD A2 05
jsr HandleRadarSweepCollision ; CPU:$EAFF PRG:2AFF 20 E3 EA
inx ; CPU:$EB02 PRG:2B02 E8
jsr HandleRadarSweepCollision ; CPU:$EB03 PRG:2B03 20 E3 EA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EB06
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads X with $01; loads A from ZpB1;
; compares A with $05; branches on carry clear to
; Sub_8764_OnCarryClear_EB30; branches on equal to
; Sub_8764_OnZero_EB2A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp1B, Zp1C, Zp21, Zp22, Zp23, Zp24.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EB06:
ldx #$01 ; CPU:$EB06 PRG:2B06 A2 01
lda ZpB1 ; CPU:$EB08 PRG:2B08 A5 B1
cmp #$05 ; CPU:$EB0A PRG:2B0A C9 05
bcc Sub_8764_OnCarryClear_EB30 ; CPU:$EB0C PRG:2B0C 90 22
beq Sub_8764_OnZero_EB2A ; CPU:$EB0E PRG:2B0E F0 1A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EB10
; Global: The routine calls CheckRadarSweepPosition, reads $EBCC and $EBCD.
; Local: Executes 12 instructions: loads A from $EBCC; stores A to
; IndDispatch1B; loads A from $EBCD; stores A to IndDispatch1C; sets
; the carry flag; loads A from ZpB0; and 6 more instructions.
; Parameters: Reads $EBCC and $EBCD from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp1B, Zp1C, Zp21, Zp22, Zp23, Zp24.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EB10:
lda $EBCC ; CPU:$EB10 PRG:2B10 AD CC EB
sta IndDispatch1B ; CPU:$EB13 PRG:2B13 85 1B
lda $EBCD ; CPU:$EB15 PRG:2B15 AD CD EB
sta IndDispatch1C ; CPU:$EB18 PRG:2B18 85 1C
sec ; CPU:$EB1A PRG:2B1A 38
lda ZpB0 ; CPU:$EB1B PRG:2B1B A5 B0
sbc #$78 ; CPU:$EB1D PRG:2B1D E9 78
sta Zp23 ; CPU:$EB1F PRG:2B1F 85 23
lda ZpB1 ; CPU:$EB21 PRG:2B21 A5 B1
sbc #$05 ; CPU:$EB23 PRG:2B23 E9 05
sta Zp24 ; CPU:$EB25 PRG:2B25 85 24
jmp CheckRadarSweepPosition ; CPU:$EB27 PRG:2B27 4C 47 EB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EB2A
; Global: The routine calls CheckRadarSweepPosition, reads $EBCC and $EBCD.
; Local: Executes 15 instructions: loads A from $EBCC; stores A to
; IndDispatch1B; loads A from $EBCD; stores A to IndDispatch1C; sets
; the carry flag; loads A from ZpB0; and 9 more instructions.
; Parameters: Reads $EBCC and $EBCD from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp1B, Zp1C, Zp21, Zp22, Zp23, Zp24.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EB2A:
lda ZpB0 ; CPU:$EB2A PRG:2B2A A5 B0
cmp #$78 ; CPU:$EB2C PRG:2B2C C9 78
bcs Sub_8764_OnCarrySet_EB10 ; CPU:$EB2E PRG:2B2E B0 E0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EB30
; Global: The routine reads $EBCA and $EBCB.
; Local: Executes 11 instructions: loads A from $EBCA; stores A to
; IndDispatch1B; loads A from $EBCB; stores A to IndDispatch1C;
; clears the carry flag; loads A from ZpB0; and 5 more instructions.
; Parameters: Reads $EBCA and $EBCB from the zero page and RAM; the values it
; acts on are those fields' contents.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp1B, Zp1C, Zp21, Zp22, Zp23, Zp24.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EB30:
lda $EBCA ; CPU:$EB30 PRG:2B30 AD CA EB
sta IndDispatch1B ; CPU:$EB33 PRG:2B33 85 1B
lda $EBCB ; CPU:$EB35 PRG:2B35 AD CB EB
sta IndDispatch1C ; CPU:$EB38 PRG:2B38 85 1C
clc ; CPU:$EB3A PRG:2B3A 18
lda ZpB0 ; CPU:$EB3B PRG:2B3B A5 B0
adc #$58 ; CPU:$EB3D PRG:2B3D 69 58
sta Zp23 ; CPU:$EB3F PRG:2B3F 85 23
lda ZpB1 ; CPU:$EB41 PRG:2B41 A5 B1
adc #$02 ; CPU:$EB43 PRG:2B43 69 02
sta Zp24 ; CPU:$EB45 PRG:2B45 85 24
; -----------------------------------------------------------------------------
; Routine: CheckRadarSweepPosition
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A from ZpAF; compares A with $08;
; branches on carry clear to Sub_8764_OnCarryClear_EB65; branches on
; equal to Sub_8764_OnZero_EB5F.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp21, Zp22.
;
; -----------------------------------------------------------------------------
CheckRadarSweepPosition:
lda ZpAF ; CPU:$EB47 PRG:2B47 A5 AF
cmp #$08 ; CPU:$EB49 PRG:2B49 C9 08
bcc Sub_8764_OnCarryClear_EB65 ; CPU:$EB4B PRG:2B4B 90 18
beq Sub_8764_OnZero_EB5F ; CPU:$EB4D PRG:2B4D F0 10
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EB4F
; Global: The routine calls SubCEB9E.
; Local: Executes 8 instructions: sets the carry flag; loads A from ZpAE;
; subtracts $C0 from A; stores A to Zp21; loads A from ZpAF;
; subtracts $08 from A; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp21, Zp22.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EB4F:
sec ; CPU:$EB4F PRG:2B4F 38
lda ZpAE ; CPU:$EB50 PRG:2B50 A5 AE
sbc #$C0 ; CPU:$EB52 PRG:2B52 E9 C0
sta Zp21 ; CPU:$EB54 PRG:2B54 85 21
lda ZpAF ; CPU:$EB56 PRG:2B56 A5 AF
sbc #$08 ; CPU:$EB58 PRG:2B58 E9 08
sta Zp22 ; CPU:$EB5A PRG:2B5A 85 22
jmp SubCEB9E_OnCarryClear ; CPU:$EB5C PRG:2B5C 4C 9E EB
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EB5F
; Global: The routine calls SubCEB9E.
; Local: Executes 11 instructions: sets the carry flag; loads A from ZpAE;
; subtracts $C0 from A; stores A to Zp21; loads A from ZpAF;
; subtracts $08 from A; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp21, Zp22.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EB5F:
lda ZpAE ; CPU:$EB5F PRG:2B5F A5 AE
cmp #$C0 ; CPU:$EB61 PRG:2B61 C9 C0
bcs Sub_8764_OnCarrySet_EB4F ; CPU:$EB63 PRG:2B63 B0 EA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EB65
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: clears the carry flag; loads A from ZpAE;
; adds $C0 to A; stores A to Zp21; loads A from ZpAF; adds $03 to A;
; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp21, Zp22.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EB65:
clc ; CPU:$EB65 PRG:2B65 18
lda ZpAE ; CPU:$EB66 PRG:2B66 A5 AE
adc #$C0 ; CPU:$EB68 PRG:2B68 69 C0
sta Zp21 ; CPU:$EB6A PRG:2B6A 85 21
lda ZpAF ; CPU:$EB6C PRG:2B6C A5 AF
adc #$03 ; CPU:$EB6E PRG:2B6E 69 03
sta Zp22 ; CPU:$EB70 PRG:2B70 85 22
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EB72
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EB86; compares A with ZpAF; branches on
; carry clear to Sub_8764_JoinBranchPaths_EB86; branches on equal to
; Sub_8764_OnZero_EB8C; compares A with Zp22; and 2 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EB72:
lda $035E,x ; CPU:$EB72 PRG:2B72 BD 5E 03
bmi Sub_8764_JoinBranchPaths_EB86 ; CPU:$EB75 PRG:2B75 30 0F
cmp ZpAF ; CPU:$EB77 PRG:2B77 C5 AF
bcc Sub_8764_JoinBranchPaths_EB86 ; CPU:$EB79 PRG:2B79 90 0B
beq Sub_8764_OnZero_EB8C ; CPU:$EB7B PRG:2B7B F0 0F
cmp Zp22 ; CPU:$EB7D PRG:2B7D C5 22
beq Sub_8764_OnZero_EB95 ; CPU:$EB7F PRG:2B7F F0 14
bcs Sub_8764_JoinBranchPaths_EB86 ; CPU:$EB81 PRG:2B81 B0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EB83
; Global: The routine calls DispatchEnemyRoutine1B.
; Local: Executes 9 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EB86; compares A with ZpAF; branches on
; carry clear to Sub_8764_JoinBranchPaths_EB86; branches on equal to
; Sub_8764_OnZero_EB8C; compares A with Zp22; and 3 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EB83:
jsr DispatchEnemyRoutine1B ; CPU:$EB83 PRG:2B83 20 A3 E7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EB86
; Global: The routine calls DispatchEnemyRoutine1B.
; Local: Executes 13 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EB86; compares A with ZpAF; branches on
; carry clear to Sub_8764_JoinBranchPaths_EB86; branches on equal to
; Sub_8764_OnZero_EB8C; compares A with Zp22; and 7 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EB86:
inx ; CPU:$EB86 PRG:2B86 E8
cpx #$6F ; CPU:$EB87 PRG:2B87 E0 6F
bcc Sub_8764_OnCarryClear_EB72 ; CPU:$EB89 PRG:2B89 90 E7
rts ; CPU:$EB8B PRG:2B8B 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EB8C
; Global: The routine calls DispatchEnemyRoutine1B.
; Local: Executes 17 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EB86; compares A with ZpAF; branches on
; carry clear to Sub_8764_JoinBranchPaths_EB86; branches on equal to
; Sub_8764_OnZero_EB8C; compares A with Zp22; and 11 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EB8C:
lda $0280,x ; CPU:$EB8C PRG:2B8C BD 80 02
cmp ZpAE ; CPU:$EB8F PRG:2B8F C5 AE
bcc Sub_8764_JoinBranchPaths_EB86 ; CPU:$EB91 PRG:2B91 90 F3
bcs Sub_8764_JoinBranchPaths_EB83 ; CPU:$EB93 PRG:2B93 B0 EE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EB95
; Global: The routine calls DispatchEnemyRoutine1B.
; Local: Executes 21 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EB86; compares A with ZpAF; branches on
; carry clear to Sub_8764_JoinBranchPaths_EB86; branches on equal to
; Sub_8764_OnZero_EB8C; compares A with Zp22; and 15 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EB95:
lda $0280,x ; CPU:$EB95 PRG:2B95 BD 80 02
cmp Zp21 ; CPU:$EB98 PRG:2B98 C5 21
bcc Sub_8764_JoinBranchPaths_EB83 ; CPU:$EB9A PRG:2B9A 90 E7
bcs Sub_8764_JoinBranchPaths_EB86 ; CPU:$EB9C PRG:2B9C B0 E8
; -----------------------------------------------------------------------------
; Routine: SubCEB9E_OnCarryClear
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EBB2; compares A with ZpAF; branches on
; equal to Sub_8764_OnZero_EBB8; branches on carry set to
; Sub_8764_JoinBranchPaths_EBAF; compares A with Zp22; and 2 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
SubCEB9E_OnCarryClear:
lda $035E,x ; CPU:$EB9E PRG:2B9E BD 5E 03
bmi Sub_8764_JoinBranchPaths_EBB2 ; CPU:$EBA1 PRG:2BA1 30 0F
cmp ZpAF ; CPU:$EBA3 PRG:2BA3 C5 AF
beq Sub_8764_OnZero_EBB8 ; CPU:$EBA5 PRG:2BA5 F0 11
bcs Sub_8764_JoinBranchPaths_EBAF ; CPU:$EBA7 PRG:2BA7 B0 06
cmp Zp22 ; CPU:$EBA9 PRG:2BA9 C5 22
beq Sub_8764_OnZero_EBC1 ; CPU:$EBAB PRG:2BAB F0 14
bcs Sub_8764_JoinBranchPaths_EBB2 ; CPU:$EBAD PRG:2BAD B0 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EBAF
; Global: The routine calls DispatchEnemyRoutine1B.
; Local: Executes 9 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EBB2; compares A with ZpAF; branches on
; equal to Sub_8764_OnZero_EBB8; branches on carry set to
; Sub_8764_JoinBranchPaths_EBAF; compares A with Zp22; and 3 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EBAF:
jsr DispatchEnemyRoutine1B ; CPU:$EBAF PRG:2BAF 20 A3 E7
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EBB2
; Global: The routine calls DispatchEnemyRoutine1B.
; Local: Executes 13 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EBB2; compares A with ZpAF; branches on
; equal to Sub_8764_OnZero_EBB8; branches on carry set to
; Sub_8764_JoinBranchPaths_EBAF; compares A with Zp22; and 7 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EBB2:
inx ; CPU:$EBB2 PRG:2BB2 E8
cpx #$6F ; CPU:$EBB3 PRG:2BB3 E0 6F
bcc SubCEB9E_OnCarryClear ; CPU:$EBB5 PRG:2BB5 90 E7
rts ; CPU:$EBB7 PRG:2BB7 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EBB8
; Global: The routine calls DispatchEnemyRoutine1B.
; Local: Executes 17 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EBB2; compares A with ZpAF; branches on
; equal to Sub_8764_OnZero_EBB8; branches on carry set to
; Sub_8764_JoinBranchPaths_EBAF; compares A with Zp22; and 11 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EBB8:
lda $0280,x ; CPU:$EBB8 PRG:2BB8 BD 80 02
cmp ZpAE ; CPU:$EBBB PRG:2BBB C5 AE
bcc Sub_8764_JoinBranchPaths_EBB2 ; CPU:$EBBD PRG:2BBD 90 F3
bcs Sub_8764_JoinBranchPaths_EBAF ; CPU:$EBBF PRG:2BBF B0 EE
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EBC1
; Global: The routine calls DispatchEnemyRoutine1B.
; Local: Executes 22 instructions: loads A from $035E,x; branches on negative
; to Sub_8764_JoinBranchPaths_EBB2; compares A with ZpAF; branches on
; equal to Sub_8764_OnZero_EBB8; branches on carry set to
; Sub_8764_JoinBranchPaths_EBAF; compares A with Zp22; and 16 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EBC1:
lda $0280,x ; CPU:$EBC1 PRG:2BC1 BD 80 02
cmp Zp21 ; CPU:$EBC4 PRG:2BC4 C5 21
bcc Sub_8764_JoinBranchPaths_EBAF ; CPU:$EBC6 PRG:2BC6 90 E7
bcs Sub_8764_JoinBranchPaths_EBB2 ; CPU:$EBC8 PRG:2BC8 B0 E8
ora PrngState ; CPU:$EBCA PRG:2BCA 05 EC
; ---- data $EBCC-$EC9D (210 bytes) ----
; referenced by `lda $EBCC` at $EB10 (operand $EBCC falls inside this region)
; referenced by `lda $EBCD` at $EB15 (operand $EBCD falls inside this region)
.byte $E3, $EB, $BD, $EF, $02, $C5, $B0, $90, $0D, $BD, $CD, $03, $4C, $0E, $EC, $BD ; CPU:$EBCC PRG:2BCC E3 EB BD EF 02 C5 B0 90 0D BD CD 03 4C 0E EC BD
.byte $EF, $02, $C5, $23, $90, $32, $60, $BD, $CD, $03, $C5, $B1, $F0, $0A, $B0, $28 ; CPU:$EBDC PRG:2BDC EF 02 C5 23 90 32 60 BD CD 03 C5 B1 F0 0A B0 28
.byte $C5, $24, $F0, $0D, $B0, $F0, $90, $20, $BD, $EF, $02, $C5, $B0, $90, $E7, $B0 ; CPU:$EBEC PRG:2BEC C5 24 F0 0D B0 F0 90 20 BD EF 02 C5 B0 90 E7 B0
.byte $17, $BD, $EF, $02, $C5, $23, $90, $10, $60, $BD, $CD, $03, $C5, $B1, $90, $D6 ; CPU:$EBFC PRG:2BFC 17 BD EF 02 C5 23 90 10 60 BD CD 03 C5 B1 90 D6
.byte $F0, $C0, $C5, $24, $F0, $C9, $B0, $CE, $20, $98, $ED, $BD, $AB, $04, $30, $05 ; CPU:$EC0C PRG:2C0C F0 C0 C5 24 F0 C9 B0 CE 20 98 ED BD AB 04 30 05
.byte $20, $64, $ED, $90, $52, $60, $BD, $1A, $05, $C9, $05, $90, $0E, $BD, $CD, $03 ; CPU:$EC1C PRG:2C1C 20 64 ED 90 52 60 BD 1A 05 C9 05 90 0E BD CD 03
.byte $49, $04, $9D, $CD, $03, $60, $A9, $FF, $9D, $89, $05, $4C, $DB, $DD, $E0, $59 ; CPU:$EC2C PRG:2C2C 49 04 9D CD 03 60 A9 FF 9D 89 05 4C DB DD E0 59
.byte $B0, $E4, $E0, $33, $B0, $F5, $E0, $15, $B0, $08, $E0, $0A, $F0, $04, $8A, $4A ; CPU:$EC3C PRG:2C3C B0 E4 E0 33 B0 F5 E0 15 B0 08 E0 0A F0 04 8A 4A
.byte $90, $E4, $A9, $00, $85, $54, $A0, $0B, $B9, $65, $00, $10, $0D, $B9, $5D, $00 ; CPU:$EC4C PRG:2C4C 90 E4 A9 00 85 54 A0 0B B9 65 00 10 0D B9 5D 00
.byte $C9, $0B, $90, $0F, $C9, $15, $90, $02, $84, $54, $C8, $C0, $10, $90, $E9, $A4 ; CPU:$EC5C PRG:2C5C C9 0B 90 0F C9 15 90 02 84 54 C8 C0 10 90 E9 A4
.byte $54, $F0, $03, $4C, $9E, $EC, $60, $E0, $59, $B0, $19, $E0, $15, $B0, $07, $E0 ; CPU:$EC6C PRG:2C6C 54 F0 03 4C 9E EC 60 E0 59 B0 19 E0 15 B0 07 E0
.byte $0B, $90, $11, $4C, $1E, $ED, $A0, $07, $B9, $65, $00, $30, $15, $88, $C0, $03 ; CPU:$EC7C PRG:2C7C 0B 90 11 4C 1E ED A0 07 B9 65 00 30 15 88 C0 03
.byte $B0, $F6, $90, $AA, $A0, $03, $B9, $65, $00, $30, $07, $C8, $C0, $08, $90, $F6 ; CPU:$EC8C PRG:2C8C B0 F6 90 AA A0 03 B9 65 00 30 07 C8 C0 08 90 F6
.byte $B0, $9C ; CPU:$EC9C PRG:2C9C B0 9C
; -----------------------------------------------------------------------------
; Routine: InitRadarBlipRecord
; Global: The routine calls ApplyRadarSweepMaskB.
; Local: Executes 17 instructions: copies X into A; stores A to Zp65,y; loads
; A with $FA; stores A to Zp95,y; loads A from $04AB,x; ORs A with
; $80; and 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z and C flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
InitRadarBlipRecord:
txa ; CPU:$EC9E PRG:2C9E 8A
sta a:Zp65,y ; CPU:$EC9F PRG:2C9F 99 65 00
lda #$FA ; CPU:$ECA2 PRG:2CA2 A9 FA
sta a:Zp95,y ; CPU:$ECA4 PRG:2CA4 99 95 00
lda $04AB,x ; CPU:$ECA7 PRG:2CA7 BD AB 04
ora #$80 ; CPU:$ECAA PRG:2CAA 09 80
sta $04AB,x ; CPU:$ECAC PRG:2CAC 9D AB 04
and #$0F ; CPU:$ECAF PRG:2CAF 29 0F
sta a:Zp75,y ; CPU:$ECB1 PRG:2CB1 99 75 00
lda $04AB,x ; CPU:$ECB4 PRG:2CB4 BD AB 04
cpy #$08 ; CPU:$ECB7 PRG:2CB7 C0 08
bcs Sub_8764_OnCarrySet_ECE7 ; CPU:$ECB9 PRG:2CB9 B0 2C
and #$10 ; CPU:$ECBB PRG:2CBB 29 10
beq Sub_8764_OnZero_ECC7 ; CPU:$ECBD PRG:2CBD F0 08
lda $E6CD,y ; CPU:$ECBF PRG:2CBF B9 CD E6
ora Zp34 ; CPU:$ECC2 PRG:2CC2 05 34
jmp ApplyRadarSweepMaskB ; CPU:$ECC4 PRG:2CC4 4C CC EC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_ECC7
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A from $E6DD,y; ANDs A with Zp34.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N and Z flags, Zp32, Zp33, Zp34, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_ECC7:
lda $E6DD,y ; CPU:$ECC7 PRG:2CC7 B9 DD E6
and Zp34 ; CPU:$ECCA PRG:2CCA 25 34
; -----------------------------------------------------------------------------
; Routine: ApplyRadarSweepMaskB
; Global: The routine calls ApplyRadarSweepMaskC.
; Local: Executes 7 instructions: stores A to Zp34; loads A from $04AB,x; ANDs
; A with $20; branches on equal to Sub_8764_OnZero_ECDD; loads A from
; $E6CD,y; ORs A with Zp32; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N and Z flags, Zp32, Zp33, Zp34, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
ApplyRadarSweepMaskB:
sta Zp34 ; CPU:$ECCC PRG:2CCC 85 34
lda $04AB,x ; CPU:$ECCE PRG:2CCE BD AB 04
and #$20 ; CPU:$ECD1 PRG:2CD1 29 20
beq Sub_8764_OnZero_ECDD ; CPU:$ECD3 PRG:2CD3 F0 08
lda $E6CD,y ; CPU:$ECD5 PRG:2CD5 B9 CD E6
ora Zp32 ; CPU:$ECD8 PRG:2CD8 05 32
jmp ApplyRadarSweepMaskC ; CPU:$ECDA PRG:2CDA 4C E2 EC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_ECDD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A from $E6DD,y; ANDs A with Zp32.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N and Z flags, Zp32, Zp33, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_ECDD:
lda $E6DD,y ; CPU:$ECDD PRG:2CDD B9 DD E6
and Zp32 ; CPU:$ECE0 PRG:2CE0 25 32
; -----------------------------------------------------------------------------
; Routine: ApplyRadarSweepMaskC
; Global: The routine calls ApplyRadarDirectionMask.
; Local: Executes 2 instructions: stores A to Zp32; calls ApplyRadarDirectionMask.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N and Z flags, Zp32, Zp33, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
ApplyRadarSweepMaskC:
sta Zp32 ; CPU:$ECE2 PRG:2CE2 85 32
jmp ApplyRadarDirectionMask ; CPU:$ECE4 PRG:2CE4 4C 3E E9
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_ECE7
; Global: The routine calls ApplyRadarSweepMaskD.
; Local: Executes 5 instructions: ANDs A with $10; branches on equal to
; Sub_8764_OnZero_ECF3; loads A from $E6C5,y; ORs A with Zp35; calls
; ApplyRadarSweepMaskD.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N and Z flags, Zp09, Zp31, Zp33, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_ECE7:
and #$10 ; CPU:$ECE7 PRG:2CE7 29 10
beq Sub_8764_OnZero_ECF3 ; CPU:$ECE9 PRG:2CE9 F0 08
lda $E6C5,y ; CPU:$ECEB PRG:2CEB B9 C5 E6
ora Zp35 ; CPU:$ECEE PRG:2CEE 05 35
jmp ApplyRadarSweepMaskD ; CPU:$ECF0 PRG:2CF0 4C F8 EC
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_ECF3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A from $E6D5,y; ANDs A with Zp35.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N and Z flags, Zp09, Zp31, Zp33, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_ECF3:
lda $E6D5,y ; CPU:$ECF3 PRG:2CF3 B9 D5 E6
and Zp35 ; CPU:$ECF6 PRG:2CF6 25 35
; -----------------------------------------------------------------------------
; Routine: ApplyRadarSweepMaskD
; Global: The routine calls ApplyRadarSweepMaskE.
; Local: Executes 7 instructions: stores A to Zp35; loads A from $04AB,x; ANDs
; A with $20; branches on equal to Sub_8764_OnZero_ED09; loads A from
; $E6C5,y; ORs A with Zp33; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N and Z flags, Zp09, Zp31, Zp33, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
ApplyRadarSweepMaskD:
sta Zp35 ; CPU:$ECF8 PRG:2CF8 85 35
lda $04AB,x ; CPU:$ECFA PRG:2CFA BD AB 04
and #$20 ; CPU:$ECFD PRG:2CFD 29 20
beq Sub_8764_OnZero_ED09 ; CPU:$ECFF PRG:2CFF F0 08
lda $E6C5,y ; CPU:$ED01 PRG:2D01 B9 C5 E6
ora Zp33 ; CPU:$ED04 PRG:2D04 05 33
jmp ApplyRadarSweepMaskE ; CPU:$ED06 PRG:2D06 4C 0E ED
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_ED09
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A from $E6D5,y; ANDs A with Zp33.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N and Z flags, Zp09, Zp31, Zp33, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_ED09:
lda $E6D5,y ; CPU:$ED09 PRG:2D09 B9 D5 E6
and Zp33 ; CPU:$ED0C PRG:2D0C 25 33
; -----------------------------------------------------------------------------
; Routine: ApplyRadarSweepMaskE
; Global: The routine calls ApplyRadarDirectionMask.
; Local: Executes 7 instructions: stores A to Zp33; loads A from $E6C5,y; ORs
; A with Zp09; stores A to Zp09; EORs A with $FF; stores A to Zp31;
; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and Y, the N and Z flags, Zp09, Zp31, Zp33, Zp35, Zp37.
;
; -----------------------------------------------------------------------------
ApplyRadarSweepMaskE:
sta Zp33 ; CPU:$ED0E PRG:2D0E 85 33
lda $E6C5,y ; CPU:$ED10 PRG:2D10 B9 C5 E6
ora Zp09 ; CPU:$ED13 PRG:2D13 05 09
sta Zp09 ; CPU:$ED15 PRG:2D15 85 09
eor #$FF ; CPU:$ED17 PRG:2D17 49 FF
sta Zp31 ; CPU:$ED19 PRG:2D19 85 31
jmp ApplyRadarDirectionMask ; CPU:$ED1B PRG:2D1B 4C 3E E9
; ---- data $ED1E-$ED60 (67 bytes) ----
.byte $A0, $07, $B9, $65, $00, $10, $03, $4C, $9E, $EC, $C9, $15, $B0, $0A, $C9, $0B ; CPU:$ED1E PRG:2D1E A0 07 B9 65 00 10 03 4C 9E EC C9 15 B0 0A C9 0B
.byte $90, $06, $88, $C0, $03, $B0, $EB, $60, $86, $54, $20, $57, $ED, $B9, $6D, $00 ; CPU:$ED2E PRG:2D2E 90 06 88 C0 03 B0 EB 60 86 54 20 57 ED B9 6D 00
.byte $30, $0A, $20, $57, $ED, $A5, $09, $39, $DD, $E6, $85, $09, $A9, $FF, $99, $65 ; CPU:$ED3E PRG:2D3E 30 0A 20 57 ED A5 09 39 DD E6 85 09 A9 FF 99 65
.byte $00, $99, $6D, $00, $A6, $54, $4C, $9E, $EC, $AA, $BD, $AB, $04, $29, $7F, $9D ; CPU:$ED4E PRG:2D4E 00 99 6D 00 A6 54 4C 9E EC AA BD AB 04 29 7F 9D
.byte $AB, $04, $60 ; CPU:$ED5E PRG:2D5E AB 04 60
; -----------------------------------------------------------------------------
; Routine: CheckEnemyNearTarget
; Global: The routine calls ComputeObjectRelativePosition.
; Local: Executes 11 instructions: calls ComputeObjectRelativePosition; loads A from Zp26; branches
; on equal to Sub_8764_JoinBranchPaths_ED94; compares A with $01;
; branches on equal to Sub_8764_OnZero_ED78; compares A with $02; and
; 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp25, Zp26, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
CheckEnemyNearTarget:
jsr ComputeObjectRelativePosition ; CPU:$ED61 PRG:2D61 20 98 ED
lda Zp26 ; CPU:$ED64 PRG:2D64 A5 26
beq Sub_8764_JoinBranchPaths_ED94 ; CPU:$ED66 PRG:2D66 F0 2C
cmp #$01 ; CPU:$ED68 PRG:2D68 C9 01
beq Sub_8764_OnZero_ED78 ; CPU:$ED6A PRG:2D6A F0 0C
cmp #$02 ; CPU:$ED6C PRG:2D6C C9 02
bne Sub_8764_JoinBranchPaths_ED94 ; CPU:$ED6E PRG:2D6E D0 24
lda Zp25 ; CPU:$ED70 PRG:2D70 A5 25
cmp #$5A ; CPU:$ED72 PRG:2D72 C9 5A
bcs Sub_8764_JoinBranchPaths_ED94 ; CPU:$ED74 PRG:2D74 B0 1E
bcc Sub_8764_OnCarryClear_ED7E ; CPU:$ED76 PRG:2D76 90 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_ED78
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp25; compares A with $55;
; branches on carry clear to Sub_8764_JoinBranchPaths_ED94.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_ED78:
lda Zp25 ; CPU:$ED78 PRG:2D78 A5 25
cmp #$55 ; CPU:$ED7A PRG:2D7A C9 55
bcc Sub_8764_JoinBranchPaths_ED94 ; CPU:$ED7C PRG:2D7C 90 16
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_ED7E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from Zp28; branches on equal to
; Sub_8764_OnZero_ED8E; compares A with $01; branches on not equal to
; Sub_8764_JoinBranchPaths_ED94; loads A from Zp27; compares A with
; $9E; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_ED7E:
lda Zp28 ; CPU:$ED7E PRG:2D7E A5 28
beq Sub_8764_OnZero_ED8E ; CPU:$ED80 PRG:2D80 F0 0C
cmp #$01 ; CPU:$ED82 PRG:2D82 C9 01
bne Sub_8764_JoinBranchPaths_ED94 ; CPU:$ED84 PRG:2D84 D0 0E
lda Zp27 ; CPU:$ED86 PRG:2D86 A5 27
cmp #$9E ; CPU:$ED88 PRG:2D88 C9 9E
bcs Sub_8764_JoinBranchPaths_ED94 ; CPU:$ED8A PRG:2D8A B0 08
bcc Sub_8764_JoinBranchPaths_ED96 ; CPU:$ED8C PRG:2D8C 90 08
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_ED8E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp27; compares A with $9E;
; branches on carry set to Sub_8764_JoinBranchPaths_ED96.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z and C flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_ED8E:
lda Zp27 ; CPU:$ED8E PRG:2D8E A5 27
cmp #$9E ; CPU:$ED90 PRG:2D90 C9 9E
bcs Sub_8764_JoinBranchPaths_ED96 ; CPU:$ED92 PRG:2D92 B0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_ED94
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: sets the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the C flag.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_ED94:
sec ; CPU:$ED94 PRG:2D94 38
rts ; CPU:$ED95 PRG:2D95 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_ED96
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: clears the carry flag; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_ED96:
clc ; CPU:$ED96 PRG:2D96 18
rts ; CPU:$ED97 PRG:2D97 60
; -----------------------------------------------------------------------------
; Routine: ComputeObjectRelativePosition
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 15 instructions: sets the carry flag; loads A from $0280,x;
; subtracts ZpAE from A; stores A to Zp25; loads A from $035E,x;
; subtracts ZpAF from A; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp25, Zp26, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
ComputeObjectRelativePosition:
sec ; CPU:$ED98 PRG:2D98 38
lda $0280,x ; CPU:$ED99 PRG:2D99 BD 80 02
sbc ZpAE ; CPU:$ED9C PRG:2D9C E5 AE
sta Zp25 ; CPU:$ED9E PRG:2D9E 85 25
lda $035E,x ; CPU:$EDA0 PRG:2DA0 BD 5E 03
sbc ZpAF ; CPU:$EDA3 PRG:2DA3 E5 AF
sta Zp26 ; CPU:$EDA5 PRG:2DA5 85 26
bpl Sub_8764_OnNonnegative_EDB6; CPU:$EDA7 PRG:2DA7 10 0D
clc ; CPU:$EDA9 PRG:2DA9 18
lda Zp25 ; CPU:$EDAA PRG:2DAA A5 25
adc #$80 ; CPU:$EDAC PRG:2DAC 69 80
sta Zp25 ; CPU:$EDAE PRG:2DAE 85 25
lda Zp26 ; CPU:$EDB0 PRG:2DB0 A5 26
adc #$0C ; CPU:$EDB2 PRG:2DB2 69 0C
sta Zp26 ; CPU:$EDB4 PRG:2DB4 85 26
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_EDB6
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 15 instructions: sets the carry flag; loads A from $02EF,x;
; subtracts ZpB0 from A; stores A to Zp27; loads A from $03CD,x;
; subtracts ZpB1 from A; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp27, Zp28.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_EDB6:
sec ; CPU:$EDB6 PRG:2DB6 38
lda $02EF,x ; CPU:$EDB7 PRG:2DB7 BD EF 02
sbc ZpB0 ; CPU:$EDBA PRG:2DBA E5 B0
sta Zp27 ; CPU:$EDBC PRG:2DBC 85 27
lda $03CD,x ; CPU:$EDBE PRG:2DBE BD CD 03
sbc ZpB1 ; CPU:$EDC1 PRG:2DC1 E5 B1
sta Zp28 ; CPU:$EDC3 PRG:2DC3 85 28
bpl Sub_8764_OnNonnegative_EDD4; CPU:$EDC5 PRG:2DC5 10 0D
clc ; CPU:$EDC7 PRG:2DC7 18
lda Zp27 ; CPU:$EDC8 PRG:2DC8 A5 27
adc #$D0 ; CPU:$EDCA PRG:2DCA 69 D0
sta Zp27 ; CPU:$EDCC PRG:2DCC 85 27
lda Zp28 ; CPU:$EDCE PRG:2DCE A5 28
adc #$07 ; CPU:$EDD0 PRG:2DD0 69 07
sta Zp28 ; CPU:$EDD2 PRG:2DD2 85 28
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_EDD4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_EDD4:
rts ; CPU:$EDD4 PRG:2DD4 60
; -----------------------------------------------------------------------------
; Routine: DrawFactorySprites
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $82.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, Zp53, the OAM shadow,
; $035E.
;
; -----------------------------------------------------------------------------
DrawFactorySprites:
lda #$82 ; CPU:$EDD5 PRG:2DD5 A9 82
; -----------------------------------------------------------------------------
; Routine: DrawFactoryAndTargetSprites
; Global: The routine calls DrawSpritePart.
; Local: Executes 5 instructions: calls DrawSpritePart; pushes A; copies X into A;
; loads X with $00; branches on equal to Sub_8764_OnZero_EDEC.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, Zp53, the OAM shadow,
; $035E.
;
; -----------------------------------------------------------------------------
DrawFactoryAndTargetSprites:
jsr DrawSpritePart ; CPU:$EDD7 PRG:2DD7 20 A1 C5
pha ; CPU:$EDDA PRG:2DDA 48
txa ; CPU:$EDDB PRG:2DDB 8A
ldx #$00 ; CPU:$EDDC PRG:2DDC A2 00
beq Sub_8764_OnZero_EDEC ; CPU:$EDDE PRG:2DDE F0 0C
; -----------------------------------------------------------------------------
; Routine: DrawTargetSprites
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $81.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, Zp53, the OAM shadow,
; $035E.
;
; -----------------------------------------------------------------------------
DrawTargetSprites:
lda #$81 ; CPU:$EDE0 PRG:2DE0 A9 81
; -----------------------------------------------------------------------------
; Routine: DrawTargetSpritesAlt
; Global: The routine calls DrawSpritePart.
; Local: Executes 6 instructions: calls DrawSpritePart; pushes A; copies X into A;
; clears the carry flag; adds $6F to A; loads X with $01.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp52, Zp53, the OAM shadow,
; $035E.
;
; -----------------------------------------------------------------------------
DrawTargetSpritesAlt:
jsr DrawSpritePart ; CPU:$EDE2 PRG:2DE2 20 A1 C5
pha ; CPU:$EDE5 PRG:2DE5 48
txa ; CPU:$EDE6 PRG:2DE6 8A
clc ; CPU:$EDE7 PRG:2DE7 18
adc #$6F ; CPU:$EDE8 PRG:2DE8 69 6F
ldx #$01 ; CPU:$EDEA PRG:2DEA A2 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EDEC
; Global: The routine calls AddTargetPositionOffset and SubCC59C.
; Local: Executes 4 instructions: copies A into Y; pulls A; calls AddTargetPositionOffset;
; calls SubCC59C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, the OAM shadow, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EDEC:
tay ; CPU:$EDEC PRG:2DEC A8
pla ; CPU:$EDED PRG:2DED 68
jsr AddTargetPositionOffset ; CPU:$EDEE PRG:2DEE 20 F4 ED
jmp SubCC59C_OnZero ; CPU:$EDF1 PRG:2DF1 4C 9C C5
; -----------------------------------------------------------------------------
; Routine: AddTargetPositionOffset
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 16 instructions: branches on negative to
; Sub_8764_OnNegative_EE2F; stores A to Zp00,x; clears the carry
; flag; loads A from $0280,y; adds Zp00,x to A; stores A to $0280,y;
; and 10 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp00, the OAM shadow, $035E.
;
; -----------------------------------------------------------------------------
AddTargetPositionOffset:
bmi Sub_8764_OnNegative_EE2F ; CPU:$EDF4 PRG:2DF4 30 39
sta Zp00,x ; CPU:$EDF6 PRG:2DF6 95 00
clc ; CPU:$EDF8 PRG:2DF8 18
lda $0280,y ; CPU:$EDF9 PRG:2DF9 B9 80 02
adc Zp00,x ; CPU:$EDFC PRG:2DFC 75 00
sta $0280,y ; CPU:$EDFE PRG:2DFE 99 80 02
lda $035E,y ; CPU:$EE01 PRG:2E01 B9 5E 03
adc #$00 ; CPU:$EE04 PRG:2E04 69 00
sta $035E,y ; CPU:$EE06 PRG:2E06 99 5E 03
cmp $EE5C,x ; CPU:$EE09 PRG:2E09 DD 5C EE
bcc Sub_8764_JoinBranchPaths_EE2E ; CPU:$EE0C PRG:2E0C 90 20
cmp $EE5E,x ; CPU:$EE0E PRG:2E0E DD 5E EE
bcs Sub_8764_OnCarrySet_EE1B ; CPU:$EE11 PRG:2E11 B0 08
lda $0280,y ; CPU:$EE13 PRG:2E13 B9 80 02
cmp $EE60,x ; CPU:$EE16 PRG:2E16 DD 60 EE
bcc Sub_8764_JoinBranchPaths_EE2E ; CPU:$EE19 PRG:2E19 90 13
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EE1B
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: sets the carry flag; loads A from $0280,y;
; subtracts $EE60,x from A; stores A to $0280,y; loads A from
; $035E,y; subtracts $EE5C,x from A; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, the OAM shadow, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EE1B:
sec ; CPU:$EE1B PRG:2E1B 38
lda $0280,y ; CPU:$EE1C PRG:2E1C B9 80 02
sbc $EE60,x ; CPU:$EE1F PRG:2E1F FD 60 EE
sta $0280,y ; CPU:$EE22 PRG:2E22 99 80 02
lda $035E,y ; CPU:$EE25 PRG:2E25 B9 5E 03
sbc $EE5C,x ; CPU:$EE28 PRG:2E28 FD 5C EE
sta $035E,y ; CPU:$EE2B PRG:2E2B 99 5E 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EE2E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EE2E:
rts ; CPU:$EE2E PRG:2E2E 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNegative_EE2F
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 20 instructions: returns with RTS; ANDs A with $7F; stores A
; to Zp00,x; sets the carry flag; loads A from $0280,y; subtracts
; Zp00,x from A; and 14 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, the N, Z, C and V flags, Zp00, the OAM shadow, $035E.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNegative_EE2F:
and #$7F ; CPU:$EE2F PRG:2E2F 29 7F
sta Zp00,x ; CPU:$EE31 PRG:2E31 95 00
sec ; CPU:$EE33 PRG:2E33 38
lda $0280,y ; CPU:$EE34 PRG:2E34 B9 80 02
sbc Zp00,x ; CPU:$EE37 PRG:2E37 F5 00
sta $0280,y ; CPU:$EE39 PRG:2E39 99 80 02
lda $035E,y ; CPU:$EE3C PRG:2E3C B9 5E 03
sbc #$00 ; CPU:$EE3F PRG:2E3F E9 00
sta $035E,y ; CPU:$EE41 PRG:2E41 99 5E 03
cmp #$FF ; CPU:$EE44 PRG:2E44 C9 FF
bne Sub_8764_JoinBranchPaths_EE2E ; CPU:$EE46 PRG:2E46 D0 E6
sec ; CPU:$EE48 PRG:2E48 38
lda $0280,y ; CPU:$EE49 PRG:2E49 B9 80 02
sbc $EE62,x ; CPU:$EE4C PRG:2E4C FD 62 EE
sta $0280,y ; CPU:$EE4F PRG:2E4F 99 80 02
lda $035E,y ; CPU:$EE52 PRG:2E52 B9 5E 03
sbc $EE64,x ; CPU:$EE55 PRG:2E55 FD 64 EE
sta $035E,y ; CPU:$EE58 PRG:2E58 99 5E 03
rts ; CPU:$EE5B PRG:2E5B 60
; ---- data $EE5C-$EE65 (10 bytes) ----
; referenced by `cmp $EE5C,x` at $EE09 (operand $EE5C falls inside this region)
; referenced by `cmp $EE5E,x` at $EE0E (operand $EE5E falls inside this region)
; referenced by `cmp $EE60,x` at $EE16 (operand $EE60 falls inside this region)
; referenced by `sbc $EE60,x` at $EE1F (operand $EE60 falls inside this region)
; referenced by `sbc $EE5C,x` at $EE28 (operand $EE5C falls inside this region)
; referenced by `sbc $EE62,x` at $EE4C (operand $EE62 falls inside this region)
; ... and 1 further references from decoded code
.byte $0C, $07, $0D, $08, $80, $D0, $80, $30, $F3, $F8 ; CPU:$EE5C PRG:2E5C 0C 07 0D 08 80 D0 80 30 F3 F8
; -----------------------------------------------------------------------------
; Routine: DrawBlipSprite
; Global: The routine calls DrawSpritePart, AddBlipPartOffset and SubCC59C.
; Local: Executes 8 instructions: calls DrawSpritePart; loads X with $00; loads Y
; with $00; calls AddBlipPartOffset; loads X with $02; increments Y; and 2
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp25, Zp26, Zp52, Zp53.
;
; -----------------------------------------------------------------------------
DrawBlipSprite:
jsr DrawSpritePart ; CPU:$EE66 PRG:2E66 20 A1 C5
ldx #$00 ; CPU:$EE69 PRG:2E69 A2 00
ldy #$00 ; CPU:$EE6B PRG:2E6B A0 00
jsr AddBlipPartOffset ; CPU:$EE6D PRG:2E6D 20 79 EE
ldx #$02 ; CPU:$EE70 PRG:2E70 A2 02
iny ; CPU:$EE72 PRG:2E72 C8
jsr AddBlipPartOffset ; CPU:$EE73 PRG:2E73 20 79 EE
jmp SubCC59C_OnZero ; CPU:$EE76 PRG:2E76 4C 9C C5
; -----------------------------------------------------------------------------
; Routine: AddBlipPartOffset
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 13 instructions: clears the carry flag; loads A from ZpAE,x;
; adds $EEB4,y to A; stores A to Zp25,x; loads A from ZpAF,x; adds
; $EEB6,y to A; and 7 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp25, Zp26.
;
; -----------------------------------------------------------------------------
AddBlipPartOffset:
clc ; CPU:$EE79 PRG:2E79 18
lda ZpAE,x ; CPU:$EE7A PRG:2E7A B5 AE
adc $EEB4,y ; CPU:$EE7C PRG:2E7C 79 B4 EE
sta Zp25,x ; CPU:$EE7F PRG:2E7F 95 25
lda ZpAF,x ; CPU:$EE81 PRG:2E81 B5 AF
adc $EEB6,y ; CPU:$EE83 PRG:2E83 79 B6 EE
sta Zp26,x ; CPU:$EE86 PRG:2E86 95 26
clc ; CPU:$EE88 PRG:2E88 18
lda a:ZpB4,y ; CPU:$EE89 PRG:2E89 B9 B4 00
adc Zp25,x ; CPU:$EE8C PRG:2E8C 75 25
sta Zp25,x ; CPU:$EE8E PRG:2E8E 95 25
bcc Sub_8764_OnCarryClear_EE94 ; CPU:$EE90 PRG:2E90 90 02
inc Zp26,x ; CPU:$EE92 PRG:2E92 F6 26
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EE94
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp26,x; compares A with
; $EEB8,y; branches on carry clear to Sub_8764_OnCarryClear_EEB3;
; branches on not equal to Sub_8764_OnNonzero_EEA4; loads A from
; Zp25,x; compares A with $EEBA,y; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp25, Zp26.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EE94:
lda Zp26,x ; CPU:$EE94 PRG:2E94 B5 26
cmp $EEB8,y ; CPU:$EE96 PRG:2E96 D9 B8 EE
bcc Sub_8764_OnCarryClear_EEB3 ; CPU:$EE99 PRG:2E99 90 18
bne Sub_8764_OnNonzero_EEA4 ; CPU:$EE9B PRG:2E9B D0 07
lda Zp25,x ; CPU:$EE9D PRG:2E9D B5 25
cmp $EEBA,y ; CPU:$EE9F PRG:2E9F D9 BA EE
bcc Sub_8764_OnCarryClear_EEB3 ; CPU:$EEA2 PRG:2EA2 90 0F
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EEA4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: sets the carry flag; loads A from Zp25,x;
; subtracts $EEBA,y from A; stores A to Zp25,x; loads A from Zp26,x;
; subtracts $EEB8,y from A; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp25, Zp26.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EEA4:
sec ; CPU:$EEA4 PRG:2EA4 38
lda Zp25,x ; CPU:$EEA5 PRG:2EA5 B5 25
sbc $EEBA,y ; CPU:$EEA7 PRG:2EA7 F9 BA EE
sta Zp25,x ; CPU:$EEAA PRG:2EAA 95 25
lda Zp26,x ; CPU:$EEAC PRG:2EAC B5 26
sbc $EEB8,y ; CPU:$EEAE PRG:2EAE F9 B8 EE
sta Zp26,x ; CPU:$EEB1 PRG:2EB1 95 26
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EEB3
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EEB3:
rts ; CPU:$EEB3 PRG:2EB3 60
; ---- data $EEB4-$EEBB (8 bytes) ----
; referenced by `adc $EEB4,y` at $EE7C (operand $EEB4 falls inside this region)
; referenced by `adc $EEB6,y` at $EE83 (operand $EEB6 falls inside this region)
; referenced by `cmp $EEB8,y` at $EE96 (operand $EEB8 falls inside this region)
; referenced by `cmp $EEBA,y` at $EE9F (operand $EEBA falls inside this region)
; referenced by `sbc $EEBA,y` at $EEA7 (operand $EEBA falls inside this region)
; referenced by `sbc $EEB8,y` at $EEAE (operand $EEB8 falls inside this region)
.byte $32, $A4, $01, $00, $0C, $07, $80, $D0 ; CPU:$EEB4 PRG:2EB4 32 A4 01 00 0C 07 80 D0
; -----------------------------------------------------------------------------
; Routine: CheckBlipCollidesWithPlayer
; Global: The routine calls SetPlayerScreenOrigin.
; Local: Executes 4 instructions: loads A from ZpAB; compares A with $FA;
; branches on equal to Sub_8764_OnZero_EEC5; calls SetPlayerScreenOrigin.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
CheckBlipCollidesWithPlayer:
lda ZpAB ; CPU:$EEBC PRG:2EBC A5 AB
cmp #$FA ; CPU:$EEBE PRG:2EBE C9 FA
beq Sub_8764_OnZero_EEC5 ; CPU:$EEC0 PRG:2EC0 F0 03
jsr SetPlayerScreenOrigin ; CPU:$EEC2 PRG:2EC2 20 27 F1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EEC5
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: loads A from Zp09; branches on not equal to
; Sub_8764_OnNonzero_EECE; loads A from Zp0C; branches on not equal
; to Sub_8764_OnNonzero_EED6; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EEC5:
lda Zp09 ; CPU:$EEC5 PRG:2EC5 A5 09
bne Sub_8764_OnNonzero_EECE ; CPU:$EEC7 PRG:2EC7 D0 05
lda Zp0C ; CPU:$EEC9 PRG:2EC9 A5 0C
bne Sub_8764_OnNonzero_EED6 ; CPU:$EECB PRG:2ECB D0 09
rts ; CPU:$EECD PRG:2ECD 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EECE
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: increments Zp3A; loads A from Zp3A; ANDs A
; with $01; branches on equal to Sub_8764_OnZero_EF38.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EECE:
inc Zp3A ; CPU:$EECE PRG:2ECE E6 3A
lda Zp3A ; CPU:$EED0 PRG:2ED0 A5 3A
and #$01 ; CPU:$EED2 PRG:2ED2 29 01
beq Sub_8764_OnZero_EF38 ; CPU:$EED4 PRG:2ED4 F0 62
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EED6
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A with $00; stores A to Zp0C; loads Y
; with $07.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EED6:
lda #$00 ; CPU:$EED6 PRG:2ED6 A9 00
sta Zp0C ; CPU:$EED8 PRG:2ED8 85 0C
ldy #$07 ; CPU:$EEDA PRG:2EDA A0 07
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_EEDC
; Global: The routine calls InitRadarBlipCoordinates.
; Local: Executes 9 instructions: copies Y into A; pushes A; loads A from
; Zp65,y; branches on equal to SubCEEEF; branches on negative to
; Sub_8764_JoinBranchPaths_EEF5; loads A from Zp95,y; and 3 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_EEDC:
tya ; CPU:$EEDC PRG:2EDC 98
pha ; CPU:$EEDD PRG:2EDD 48
lda a:Zp65,y ; CPU:$EEDE PRG:2EDE B9 65 00
beq SubCEEEF_Loop ; CPU:$EEE1 PRG:2EE1 F0 0C
bmi Sub_8764_JoinBranchPaths_EEF5 ; CPU:$EEE3 PRG:2EE3 30 10
lda a:Zp95,y ; CPU:$EEE5 PRG:2EE5 B9 95 00
cmp #$FA ; CPU:$EEE8 PRG:2EE8 C9 FA
beq Sub_8764_JoinBranchPaths_EEF5 ; CPU:$EEEA PRG:2EEA F0 09
jsr InitRadarBlipCoordinates ; CPU:$EEEC PRG:2EEC 20 58 EF
; -----------------------------------------------------------------------------
; Routine: SubCEEEF_Loop
; Global: The routine calls InitRadarBlipCoordinates.
; Local: Executes 14 instructions: copies Y into A; pushes A; loads A from
; Zp65,y; branches on equal to SubCEEEF; branches on negative to
; Sub_8764_JoinBranchPaths_EEF5; loads A from Zp95,y; and 8 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCEEEF_Loop:
pla ; CPU:$EEEF PRG:2EEF 68
tay ; CPU:$EEF0 PRG:2EF0 A8
dey ; CPU:$EEF1 PRG:2EF1 88
bpl Sub_8764_OnNonnegative_EEDC; CPU:$EEF2 PRG:2EF2 10 E8
rts ; CPU:$EEF4 PRG:2EF4 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EEF5
; Global: The routine calls WriteSpriteToOamB.
; Local: Executes 12 instructions: copies Y into A; calls WriteSpriteToOamB; loads A
; from $06D7,y; pushes A; loads A with $00; stores A to $06D7,y; and
; 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EEF5:
tya ; CPU:$EEF5 PRG:2EF5 98
jsr WriteSpriteToOamB ; CPU:$EEF6 PRG:2EF6 20 89 C5
lda $06D7,y ; CPU:$EEF9 PRG:2EF9 B9 D7 06
pha ; CPU:$EEFC PRG:2EFC 48
lda #$00 ; CPU:$EEFD PRG:2EFD A9 00
sta $06D7,y ; CPU:$EEFF PRG:2EFF 99 D7 06
pla ; CPU:$EF02 PRG:2F02 68
cmp #$A9 ; CPU:$EF03 PRG:2F03 C9 A9
bcc Sub_8764_OnCarryClear_EF0D ; CPU:$EF05 PRG:2F05 90 06
cmp #$AD ; CPU:$EF07 PRG:2F07 C9 AD
bcs Sub_8764_JoinBranchPaths_EF24 ; CPU:$EF09 PRG:2F09 B0 19
lda #$63 ; CPU:$EF0B PRG:2F0B A9 63
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EF0D
; Global: The routine calls SubCC463.
; Local: Executes 12 instructions: compares A with $63; branches on carry
; clear to Sub_8764_JoinBranchPaths_EF24; compares A with $68;
; branches on carry set to Sub_8764_JoinBranchPaths_EF24; sets the
; carry flag; subtracts $63 from A; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EF0D:
cmp #$63 ; CPU:$EF0D PRG:2F0D C9 63
bcc Sub_8764_JoinBranchPaths_EF24 ; CPU:$EF0F PRG:2F0F 90 13
cmp #$68 ; CPU:$EF11 PRG:2F11 C9 68
bcs Sub_8764_JoinBranchPaths_EF24 ; CPU:$EF13 PRG:2F13 B0 0F
sec ; CPU:$EF15 PRG:2F15 38
sbc #$63 ; CPU:$EF16 PRG:2F16 E9 63
tay ; CPU:$EF18 PRG:2F18 A8
lda $EF27,y ; CPU:$EF19 PRG:2F19 B9 27 EF
tax ; CPU:$EF1C PRG:2F1C AA
lda $EF2C,y ; CPU:$EF1D PRG:2F1D B9 2C EF
tay ; CPU:$EF20 PRG:2F20 A8
jsr SubCC463_OnNonzero ; CPU:$EF21 PRG:2F21 20 63 C4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EF24
; Global: The routine calls SubCEEEF.
; Local: Executes 1 instruction: calls SubCEEEF.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EF24:
jmp SubCEEEF_Loop ; CPU:$EF24 PRG:2F24 4C EF EE
; ---- data $EF27-$EF30 (10 bytes) ----
; referenced by `lda $EF27,y` at $EF19 (operand $EF27 falls inside this region)
; referenced by `lda $EF2C,y` at $EF1D (operand $EF2C falls inside this region)
FuelGaugeTable:
.byte $80, $80, $A0, $B0, $80, $30, $20, $04, $30, $30 ; CPU:$EF27 PRG:2F27 80 80 A0 B0 80 30 20 04 30 30
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_EF31
; Global: The routine calls SubCC463.
; Local: Executes 3 instructions: loads X with $80; loads Y with $20; calls
; SubCC463.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N and Z flags, $0700.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_EF31:
ldx #$80 ; CPU:$EF31 PRG:2F31 A2 80
ldy #$20 ; CPU:$EF33 PRG:2F33 A0 20
jmp SubCC463_OnNonzero ; CPU:$EF35 PRG:2F35 4C 63 C4
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_EF38
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A with $00; stores A to Zp0C; loads Y
; with $07.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_EF38:
lda #$00 ; CPU:$EF38 PRG:2F38 A9 00
sta Zp0C ; CPU:$EF3A PRG:2F3A 85 0C
ldy #$07 ; CPU:$EF3C PRG:2F3C A0 07
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_EF3E
; Global: The routine calls InitRadarBlipCoordinates.
; Local: Executes 6 instructions: copies Y into A; pushes A; loads A from
; Zp6D,y; branches on equal to SubCEF4A; branches on non-negative to
; Sub_8764_OnNonnegative_EF50; calls InitRadarBlipCoordinates.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_EF3E:
tya ; CPU:$EF3E PRG:2F3E 98
pha ; CPU:$EF3F PRG:2F3F 48
lda a:Zp6D,y ; CPU:$EF40 PRG:2F40 B9 6D 00
beq SubCEF4A_Loop ; CPU:$EF43 PRG:2F43 F0 05
bpl Sub_8764_OnNonnegative_EF50; CPU:$EF45 PRG:2F45 10 09
jsr InitRadarBlipCoordinates ; CPU:$EF47 PRG:2F47 20 58 EF
; -----------------------------------------------------------------------------
; Routine: SubCEF4A_Loop
; Global: The routine calls InitRadarBlipCoordinates.
; Local: Executes 11 instructions: copies Y into A; pushes A; loads A from
; Zp6D,y; branches on equal to SubCEF4A; branches on non-negative to
; Sub_8764_OnNonnegative_EF50; calls InitRadarBlipCoordinates; and 5 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCEF4A_Loop:
pla ; CPU:$EF4A PRG:2F4A 68
tay ; CPU:$EF4B PRG:2F4B A8
dey ; CPU:$EF4C PRG:2F4C 88
bpl Sub_8764_OnNonnegative_EF3E; CPU:$EF4D PRG:2F4D 10 EF
rts ; CPU:$EF4F PRG:2F4F 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_EF50
; Global: The routine calls InitRadarBlipCoordinatesAlt and SubCEF4A.
; Local: Executes 3 instructions: loads X with $08; calls InitRadarBlipCoordinatesAlt; calls
; SubCEF4A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_EF50:
ldx #$08 ; CPU:$EF50 PRG:2F50 A2 08
jsr InitRadarBlipCoordinatesAlt; CPU:$EF52 PRG:2F52 20 5A EF
jmp SubCEF4A_Loop ; CPU:$EF55 PRG:2F55 4C 4A EF
; -----------------------------------------------------------------------------
; Routine: InitRadarBlipCoordinates
; Global: The routine calls SubCC463.
; Local: Executes 4 instructions: loads X with $80; loads Y with $20; calls
; SubCC463; loads X with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
InitRadarBlipCoordinates:
ldx #$00 ; CPU:$EF58 PRG:2F58 A2 00
; -----------------------------------------------------------------------------
; Routine: InitRadarBlipCoordinatesAlt
; Global: The routine calls SubCC463.
; Local: Executes 18 instructions: loads X with $80; loads Y with $20; calls
; SubCC463; stores X to Zp01; copies Y into A; clears the carry flag;
; and 12 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
InitRadarBlipCoordinatesAlt:
stx Zp01 ; CPU:$EF5A PRG:2F5A 86 01
tya ; CPU:$EF5C PRG:2F5C 98
clc ; CPU:$EF5D PRG:2F5D 18
adc Zp01 ; CPU:$EF5E PRG:2F5E 65 01
tax ; CPU:$EF60 PRG:2F60 AA
lda Zp85,x ; CPU:$EF61 PRG:2F61 B5 85
sta Zp49 ; CPU:$EF63 PRG:2F63 85 49
lda Zp95,x ; CPU:$EF65 PRG:2F65 B5 95
sta Zp4A ; CPU:$EF67 PRG:2F67 85 4A
lda Zp75,x ; CPU:$EF69 PRG:2F69 B5 75
sta Zp00 ; CPU:$EF6B PRG:2F6B 85 00
lda $06D7,x ; CPU:$EF6D PRG:2F6D BD D7 06
ldx Zp4A ; CPU:$EF70 PRG:2F70 A6 4A
inx ; CPU:$EF72 PRG:2F72 E8
bne Sub_8764_OnNonzero_EF76 ; CPU:$EF73 PRG:2F73 D0 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EF75
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EF75:
rts ; CPU:$EF75 PRG:2F75 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EF76
; Global: The routine calls SubCC463 and WriteSpriteToOamB.
; Local: Executes 21 instructions: loads X with $80; loads Y with $20; calls
; SubCC463; returns with RTS; pushes A; copies Y into A; and 15 more
; instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EF76:
pha ; CPU:$EF76 PRG:2F76 48
tya ; CPU:$EF77 PRG:2F77 98
jsr WriteSpriteToOamB ; CPU:$EF78 PRG:2F78 20 89 C5
pla ; CPU:$EF7B PRG:2F7B 68
cmp #$64 ; CPU:$EF7C PRG:2F7C C9 64
bcc Sub_8764_JoinBranchPaths_EF75 ; CPU:$EF7E PRG:2F7E 90 F5
cmp #$66 ; CPU:$EF80 PRG:2F80 C9 66
bcs Sub_8764_OnCarrySet_EFC2 ; CPU:$EF82 PRG:2F82 B0 3E
cmp #$64 ; CPU:$EF84 PRG:2F84 C9 64
bne Sub_8764_JoinBranchPaths_EF75 ; CPU:$EF86 PRG:2F86 D0 ED
lda ZpBB ; CPU:$EF88 PRG:2F88 A5 BB
beq Sub_8764_JoinBranchPaths_EF96 ; CPU:$EF8A PRG:2F8A F0 0A
bmi Sub_8764_JoinBranchPaths_EF96 ; CPU:$EF8C PRG:2F8C 30 08
cmp #$0F ; CPU:$EF8E PRG:2F8E C9 0F
bcc Sub_8764_OnCarryClear_EF31 ; CPU:$EF90 PRG:2F90 90 9F
lda #$EC ; CPU:$EF92 PRG:2F92 A9 EC
bne Sub_8764_OnNonzero_EF98 ; CPU:$EF94 PRG:2F94 D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_EF96
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $E8.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_EF96:
lda #$E8 ; CPU:$EF96 PRG:2F96 A9 E8
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EF98
; Global: The routine calls AdvanceRadarBlipPositionE and AdvanceRadarBlipPositionC.
; Local: Executes 11 instructions: stores A to Zp4B; loads A with $03; stores
; A to Zp4D; loads A with $08; calls AdvanceRadarBlipPositionE; loads A with $18; and
; 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EF98:
sta Zp4B ; CPU:$EF98 PRG:2F98 85 4B
lda #$03 ; CPU:$EF9A PRG:2F9A A9 03
sta Zp4D ; CPU:$EF9C PRG:2F9C 85 4D
lda #$08 ; CPU:$EF9E PRG:2F9E A9 08
jsr AdvanceRadarBlipPositionE ; CPU:$EFA0 PRG:2FA0 20 94 F1
lda #$18 ; CPU:$EFA3 PRG:2FA3 A9 18
jsr AdvanceRadarBlipPositionC ; CPU:$EFA5 PRG:2FA5 20 8C F1
lda #$08 ; CPU:$EFA8 PRG:2FA8 A9 08
sta Zp00 ; CPU:$EFAA PRG:2FAA 85 00
lda #$02 ; CPU:$EFAC PRG:2FAC A9 02
sta Zp01 ; CPU:$EFAE PRG:2FAE 85 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EFB0
; Global: The routine calls DrawRadarBlipPart, AdvanceRadarBlipPositionF and AdvanceRadarBlipPositionB.
; Local: Executes 8 instructions: calls DrawRadarBlipPart; loads A with $02; calls
; AdvanceRadarBlipPositionF; calls AdvanceRadarBlipPositionB; increments Zp00; decrements Zp01; and 2
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EFB0:
jsr DrawRadarBlipPart ; CPU:$EFB0 PRG:2FB0 20 02 F1
lda #$02 ; CPU:$EFB3 PRG:2FB3 A9 02
jsr AdvanceRadarBlipPositionF ; CPU:$EFB5 PRG:2FB5 20 9A F1
jsr AdvanceRadarBlipPositionB ; CPU:$EFB8 PRG:2FB8 20 8A F1
inc Zp00 ; CPU:$EFBB PRG:2FBB E6 00
dec Zp01 ; CPU:$EFBD PRG:2FBD C6 01
bne Sub_8764_OnNonzero_EFB0 ; CPU:$EFBF PRG:2FBF D0 EF
rts ; CPU:$EFC1 PRG:2FC1 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_EFC2
; Global: The routine calls SetRadarBlipTile.
; Local: Executes 7 instructions: compares A with $68; branches on carry set
; to Sub_8764_OnCarrySet_F011; compares A with $66; branches on not
; equal to Sub_8764_OnNonzero_EFD1; loads A with $2C; loads X with
; $0C; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_EFC2:
cmp #$68 ; CPU:$EFC2 PRG:2FC2 C9 68
bcs Sub_8764_OnCarrySet_F011 ; CPU:$EFC4 PRG:2FC4 B0 4B
cmp #$66 ; CPU:$EFC6 PRG:2FC6 C9 66
bne Sub_8764_OnNonzero_EFD1 ; CPU:$EFC8 PRG:2FC8 D0 07
lda #$2C ; CPU:$EFCA PRG:2FCA A9 2C
ldx #$0C ; CPU:$EFCC PRG:2FCC A2 0C
jmp SetRadarBlipTile ; CPU:$EFCE PRG:2FCE 4C D5 EF
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EFD1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $20; loads X with $4C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EFD1:
lda #$20 ; CPU:$EFD1 PRG:2FD1 A9 20
ldx #$4C ; CPU:$EFD3 PRG:2FD3 A2 4C
; -----------------------------------------------------------------------------
; Routine: SetRadarBlipTile
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 10 instructions: stores A to Zp02; stores X to Zp4B; loads A
; from Zp49; sets the carry flag; subtracts $04 from A; stores A to
; Zp49; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SetRadarBlipTile:
sta Zp02 ; CPU:$EFD5 PRG:2FD5 85 02
stx Zp4B ; CPU:$EFD7 PRG:2FD7 86 4B
lda Zp49 ; CPU:$EFD9 PRG:2FD9 A5 49
sec ; CPU:$EFDB PRG:2FDB 38
sbc #$04 ; CPU:$EFDC PRG:2FDC E9 04
sta Zp49 ; CPU:$EFDE PRG:2FDE 85 49
lda #$03 ; CPU:$EFE0 PRG:2FE0 A9 03
sta Zp4D ; CPU:$EFE2 PRG:2FE2 85 4D
lda #$04 ; CPU:$EFE4 PRG:2FE4 A9 04
sta Zp01 ; CPU:$EFE6 PRG:2FE6 85 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EFE8
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads X with $03.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EFE8:
ldx #$03 ; CPU:$EFE8 PRG:2FE8 A2 03
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_EFEA
; Global: The routine calls DrawRadarBlipPartAlt, AdvanceRadarBlipPositionC, AdvanceRadarBlipPositionE and AdvanceRadarBlipPositionF.
; Local: Executes 20 instructions: loads X with $03; loads A from Zp02; calls
; DrawRadarBlipPartAlt; increments Zp4B; loads A with $08; calls AdvanceRadarBlipPositionC; and 14
; more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_EFEA:
lda Zp02 ; CPU:$EFEA PRG:2FEA A5 02
jsr DrawRadarBlipPartAlt ; CPU:$EFEC PRG:2FEC 20 0D F1
inc Zp4B ; CPU:$EFEF PRG:2FEF E6 4B
lda #$08 ; CPU:$EFF1 PRG:2FF1 A9 08
jsr AdvanceRadarBlipPositionC ; CPU:$EFF3 PRG:2FF3 20 8C F1
inc Zp02 ; CPU:$EFF6 PRG:2FF6 E6 02
dex ; CPU:$EFF8 PRG:2FF8 CA
bne Sub_8764_OnNonzero_EFEA ; CPU:$EFF9 PRG:2FF9 D0 EF
lda Zp49 ; CPU:$EFFB PRG:2FFB A5 49
sec ; CPU:$EFFD PRG:2FFD 38
sbc #$18 ; CPU:$EFFE PRG:2FFE E9 18
sta Zp49 ; CPU:$F000 PRG:3000 85 49
lda #$08 ; CPU:$F002 PRG:3002 A9 08
jsr AdvanceRadarBlipPositionE ; CPU:$F004 PRG:3004 20 94 F1
lda #$0D ; CPU:$F007 PRG:3007 A9 0D
jsr AdvanceRadarBlipPositionF ; CPU:$F009 PRG:3009 20 9A F1
dec Zp01 ; CPU:$F00C PRG:300C C6 01
bne Sub_8764_OnNonzero_EFE8 ; CPU:$F00E PRG:300E D0 D8
rts ; CPU:$F010 PRG:3010 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_F011
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: compares A with $74; branches on carry set
; to Sub_8764_OnCarrySet_F020; subtracts $67 from A; copies A into X;
; loads A from $F1B4,x; copies A into X; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_F011:
cmp #$74 ; CPU:$F011 PRG:3011 C9 74
bcs Sub_8764_OnCarrySet_F020 ; CPU:$F013 PRG:3013 B0 0B
sbc #$67 ; CPU:$F015 PRG:3015 E9 67
tax ; CPU:$F017 PRG:3017 AA
lda $F1B4,x ; CPU:$F018 PRG:3018 BD B4 F1
tax ; CPU:$F01B PRG:301B AA
lda #$40 ; CPU:$F01C PRG:301C A9 40
bne Sub_8764_OnNonzero_F02A ; CPU:$F01E PRG:301E D0 0A
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_F020
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: compares A with $7C; branches on carry set
; to Sub_8764_OnCarrySet_F035; subtracts $73 from A; shifts a left;
; copies A into X; loads A with $80.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_F020:
cmp #$7C ; CPU:$F020 PRG:3020 C9 7C
bcs Sub_8764_OnCarrySet_F035 ; CPU:$F022 PRG:3022 B0 11
sbc #$73 ; CPU:$F024 PRG:3024 E9 73
asl a ; CPU:$F026 PRG:3026 0A
tax ; CPU:$F027 PRG:3027 AA
lda #$80 ; CPU:$F028 PRG:3028 A9 80
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F02A
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: stores X to Zp4C.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F02A:
stx Zp4C ; CPU:$F02A PRG:302A 86 4C
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F02C
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: stores A to Zp4B; loads A with $01.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F02C:
sta Zp4B ; CPU:$F02C PRG:302C 85 4B
lda #$01 ; CPU:$F02E PRG:302E A9 01
; -----------------------------------------------------------------------------
; Routine: SubCF030_OnNonzero
; Global: The routine calls DrawRadarSweepSprite.
; Local: Executes 2 instructions: stores A to Zp4D; calls DrawRadarSweepSprite.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCF030_OnNonzero:
sta Zp4D ; CPU:$F030 PRG:3030 85 4D
jmp DrawRadarSweepSprite ; CPU:$F032 PRG:3032 4C 78 F1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_F035
; Global: The routine calls DrawRadarSweepSprite and WriteSpriteToOamB, reads $043F.
; Local: Executes 23 instructions: stores A to Zp4B; loads A with $01; stores
; A to Zp4D; calls DrawRadarSweepSprite; compares A with $84; branches on carry
; set to Sub_8764_OnCarrySet_F060; and 17 more instructions.
; Parameters: Reads $043F from the zero page and RAM; the values it acts on
; are those fields' contents.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_F035:
cmp #$84 ; CPU:$F035 PRG:3035 C9 84
bcs Sub_8764_OnCarrySet_F060 ; CPU:$F037 PRG:3037 B0 27
sbc #$7B ; CPU:$F039 PRG:3039 E9 7B
tax ; CPU:$F03B PRG:303B AA
lda $F1C0,x ; CPU:$F03C PRG:303C BD C0 F1
sta Zp4B ; CPU:$F03F PRG:303F 85 4B
lda #$02 ; CPU:$F041 PRG:3041 A9 02
sta Zp4D ; CPU:$F043 PRG:3043 85 4D
lda $043F ; CPU:$F045 PRG:3045 AD 3F 04
cmp #$7D ; CPU:$F048 PRG:3048 C9 7D
bcc Sub_8764_JoinBranchPaths_F05C ; CPU:$F04A PRG:304A 90 10
cmp #$82 ; CPU:$F04C PRG:304C C9 82
bcs Sub_8764_JoinBranchPaths_F05C ; CPU:$F04E PRG:304E B0 0C
inc ZpDC ; CPU:$F050 PRG:3050 E6 DC
lda ZpDC ; CPU:$F052 PRG:3052 A5 DC
and #$01 ; CPU:$F054 PRG:3054 29 01
bne Sub_8764_JoinBranchPaths_F05C ; CPU:$F056 PRG:3056 D0 04
tya ; CPU:$F058 PRG:3058 98
jmp WriteSpriteToOamB ; CPU:$F059 PRG:3059 4C 89 C5
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_F05C
; Global: The routine calls SubCF104.
; Local: Executes 2 instructions: copies Y into A; calls SubCF104.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_F05C:
tya ; CPU:$F05C PRG:305C 98
jmp SubCF104_Loop ; CPU:$F05D PRG:305D 4C 04 F1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_F060
; Global: The routine calls DrawRadarSweepSprite.
; Local: Executes 15 instructions: stores A to Zp4B; loads A with $01; stores
; A to Zp4D; calls DrawRadarSweepSprite; compares A with $90; branches on carry
; set to Sub_8764_OnCarrySet_F07E; and 9 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_F060:
cmp #$90 ; CPU:$F060 PRG:3060 C9 90
bcs Sub_8764_OnCarrySet_F07E ; CPU:$F062 PRG:3062 B0 1A
sbc #$83 ; CPU:$F064 PRG:3064 E9 83
tax ; CPU:$F066 PRG:3066 AA
lda $F1B4,x ; CPU:$F067 PRG:3067 BD B4 F1
sta Zp4C ; CPU:$F06A PRG:306A 85 4C
lda Zp00 ; CPU:$F06C PRG:306C A5 00
and #$01 ; CPU:$F06E PRG:306E 29 01
bne Sub_8764_OnNonzero_F076 ; CPU:$F070 PRG:3070 D0 04
lda #$02 ; CPU:$F072 PRG:3072 A9 02
bne Sub_8764_OnNonzero_F078 ; CPU:$F074 PRG:3074 D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F076
; Global: The routine calls DrawRadarSweepSprite.
; Local: Executes 5 instructions: stores A to Zp4B; loads A with $01; stores A
; to Zp4D; calls DrawRadarSweepSprite; loads A with $01.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F076:
lda #$01 ; CPU:$F076 PRG:3076 A9 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F078
; Global: The routine calls DrawRadarSweepSprite.
; Local: Executes 7 instructions: stores A to Zp4B; loads A with $01; stores A
; to Zp4D; calls DrawRadarSweepSprite; loads X with $20; stores X to Zp4B; and 1
; more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F078:
ldx #$20 ; CPU:$F078 PRG:3078 A2 20
stx Zp4B ; CPU:$F07A PRG:307A 86 4B
bne SubCF030_OnNonzero ; CPU:$F07C PRG:307C D0 B2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_F07E
; Global: The routine calls DrawRadarSweepSprite.
; Local: Executes 12 instructions: stores A to Zp4B; loads A with $01; stores
; A to Zp4D; calls DrawRadarSweepSprite; compares A with $9C; branches on carry
; set to Sub_8764_OnCarrySet_F08E; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_F07E:
cmp #$9C ; CPU:$F07E PRG:307E C9 9C
bcs Sub_8764_OnCarrySet_F08E ; CPU:$F080 PRG:3080 B0 0C
sbc #$8F ; CPU:$F082 PRG:3082 E9 8F
tax ; CPU:$F084 PRG:3084 AA
lda $F1B4,x ; CPU:$F085 PRG:3085 BD B4 F1
sta Zp4C ; CPU:$F088 PRG:3088 85 4C
lda #$60 ; CPU:$F08A PRG:308A A9 60
bne Sub_8764_OnNonzero_F02C ; CPU:$F08C PRG:308C D0 9E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_F08E
; Global: The routine calls DrawRadarSweepSprite.
; Local: Executes 12 instructions: stores A to Zp4B; loads A with $01; stores
; A to Zp4D; calls DrawRadarSweepSprite; compares A with $A0; branches on carry
; set to Sub_8764_OnCarrySet_F09E; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_F08E:
cmp #$A0 ; CPU:$F08E PRG:308E C9 A0
bcs Sub_8764_OnCarrySet_F09E ; CPU:$F090 PRG:3090 B0 0C
sbc #$9B ; CPU:$F092 PRG:3092 E9 9B
tax ; CPU:$F094 PRG:3094 AA
lda $F1B0,x ; CPU:$F095 PRG:3095 BD B0 F1
sta Zp4C ; CPU:$F098 PRG:3098 85 4C
lda #$A0 ; CPU:$F09A PRG:309A A9 A0
bne Sub_8764_OnNonzero_F02C ; CPU:$F09C PRG:309C D0 8E
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_F09E
; Global: The routine calls SubCF030.
; Local: Executes 11 instructions: compares A with $A8; branches on equal to
; Sub_8764_JoinBranchPaths_F0E0; branches on carry set to
; Sub_8764_OnCarrySet_F0B5; subtracts $9F from A; copies A into X;
; loads A from $F1C8,x; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_F09E:
cmp #$A8 ; CPU:$F09E PRG:309E C9 A8
beq Sub_8764_JoinBranchPaths_F0E0 ; CPU:$F0A0 PRG:30A0 F0 3E
bcs Sub_8764_OnCarrySet_F0B5 ; CPU:$F0A2 PRG:30A2 B0 11
sbc #$9F ; CPU:$F0A4 PRG:30A4 E9 9F
tax ; CPU:$F0A6 PRG:30A6 AA
lda $F1C8,x ; CPU:$F0A7 PRG:30A7 BD C8 F1
sta Zp4C ; CPU:$F0AA PRG:30AA 85 4C
lda #$C0 ; CPU:$F0AC PRG:30AC A9 C0
sta Zp4B ; CPU:$F0AE PRG:30AE 85 4B
lda #$02 ; CPU:$F0B0 PRG:30B0 A9 02
jmp SubCF030_OnNonzero ; CPU:$F0B2 PRG:30B2 4C 30 F0
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarrySet_F0B5
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: compares A with $AD; branches on carry set
; to Sub_8764_JoinBranchPaths_F0E0; compares A with $AB; branches on
; carry clear to Sub_8764_OnCarryClear_F0C1; loads A with $8C;
; branches on not equal to Sub_8764_OnNonzero_F0C3.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarrySet_F0B5:
cmp #$AD ; CPU:$F0B5 PRG:30B5 C9 AD
bcs Sub_8764_JoinBranchPaths_F0E0 ; CPU:$F0B7 PRG:30B7 B0 27
cmp #$AB ; CPU:$F0B9 PRG:30B9 C9 AB
bcc Sub_8764_OnCarryClear_F0C1 ; CPU:$F0BB PRG:30BB 90 04
lda #$8C ; CPU:$F0BD PRG:30BD A9 8C
bne Sub_8764_OnNonzero_F0C3 ; CPU:$F0BF PRG:30BF D0 02
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_F0C1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $82.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_F0C1:
lda #$82 ; CPU:$F0C1 PRG:30C1 A9 82
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F0C3
; Global: The routine calls DrawRadarBlipSprite, AdvanceRadarBlipPositionD, AdvanceRadarBlipPositionB and DrawRadarBlipPart.
; Local: Executes 12 instructions: stores A to Zp4B; loads A with $01; stores
; A to Zp4D; loads A with $08; stores A to Zp00; loads A with $20;
; and 6 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F0C3:
sta Zp4B ; CPU:$F0C3 PRG:30C3 85 4B
lda #$01 ; CPU:$F0C5 PRG:30C5 A9 01
sta Zp4D ; CPU:$F0C7 PRG:30C7 85 4D
lda #$08 ; CPU:$F0C9 PRG:30C9 A9 08
sta Zp00 ; CPU:$F0CB PRG:30CB 85 00
lda #$20 ; CPU:$F0CD PRG:30CD A9 20
jsr DrawRadarBlipSprite ; CPU:$F0CF PRG:30CF 20 E1 F0
jsr AdvanceRadarBlipPositionD ; CPU:$F0D2 PRG:30D2 20 92 F1
lda #$02 ; CPU:$F0D5 PRG:30D5 A9 02
jsr DrawRadarBlipSprite ; CPU:$F0D7 PRG:30D7 20 E1 F0
jsr AdvanceRadarBlipPositionB ; CPU:$F0DA PRG:30DA 20 8A F1
jsr DrawRadarBlipPart ; CPU:$F0DD PRG:30DD 20 02 F1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_JoinBranchPaths_F0E0
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_JoinBranchPaths_F0E0:
rts ; CPU:$F0E0 PRG:30E0 60
; -----------------------------------------------------------------------------
; Routine: DrawRadarBlipSprite
; Global: The routine calls DrawRadarBlipPart and AdvanceRadarBlipPositionF.
; Local: Executes 6 instructions: stores A to Zp02; calls DrawRadarBlipPart; loads A
; from Zp02; calls AdvanceRadarBlipPositionF; increments Zp00; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawRadarBlipSprite:
sta Zp02 ; CPU:$F0E1 PRG:30E1 85 02
jsr DrawRadarBlipPart ; CPU:$F0E3 PRG:30E3 20 02 F1
lda Zp02 ; CPU:$F0E6 PRG:30E6 A5 02
jsr AdvanceRadarBlipPositionF ; CPU:$F0E8 PRG:30E8 20 9A F1
inc Zp00 ; CPU:$F0EB PRG:30EB E6 00
rts ; CPU:$F0ED PRG:30ED 60
; -----------------------------------------------------------------------------
; Routine: SetHelicopterOrigin
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 10 instructions: loads A from Zp1F; stores A to Zp49; loads
; A from Zp20; stores A to Zp4A; loads A with $AA; stores A to Zp4B;
; and 4 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SetHelicopterOrigin:
lda Zp1F ; CPU:$F0EE PRG:30EE A5 1F
sta Zp49 ; CPU:$F0F0 PRG:30F0 85 49
lda Zp20 ; CPU:$F0F2 PRG:30F2 A5 20
sta Zp4A ; CPU:$F0F4 PRG:30F4 85 4A
lda #$AA ; CPU:$F0F6 PRG:30F6 A9 AA
sta Zp4B ; CPU:$F0F8 PRG:30F8 85 4B
lda #$00 ; CPU:$F0FA PRG:30FA A9 00
sta Zp4D ; CPU:$F0FC PRG:30FC 85 4D
lda #$01 ; CPU:$F0FE PRG:30FE A9 01
bne SubCF104_Loop ; CPU:$F100 PRG:3100 D0 02
; -----------------------------------------------------------------------------
; Routine: DrawRadarBlipPart
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A from Zp00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawRadarBlipPart:
lda Zp00 ; CPU:$F102 PRG:3102 A5 00
; -----------------------------------------------------------------------------
; Routine: SubCF104_Loop
; Global: The routine calls ComputeRadarBlipOffset, DrawSpritePartAlt and AdvanceRadarBlipPosition.
; Local: Executes 3 instructions: calls ComputeRadarBlipOffset; calls DrawSpritePartAlt; calls
; AdvanceRadarBlipPosition.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCF104_Loop:
jsr ComputeRadarBlipOffset ; CPU:$F104 PRG:3104 20 16 F1
jsr DrawSpritePartAlt ; CPU:$F107 PRG:3107 20 A6 C5
jmp AdvanceRadarBlipPosition ; CPU:$F10A PRG:310A 4C 7F F1
; -----------------------------------------------------------------------------
; Routine: DrawRadarBlipPartAlt
; Global: The routine calls ComputeRadarBlipOffset, WriteSpriteToOamAlt and AdvanceRadarBlipPosition.
; Local: Executes 3 instructions: calls ComputeRadarBlipOffset; calls WriteSpriteToOamAlt; calls
; AdvanceRadarBlipPosition.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A and X, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawRadarBlipPartAlt:
jsr ComputeRadarBlipOffset ; CPU:$F10D PRG:310D 20 16 F1
jsr WriteSpriteToOamAlt ; CPU:$F110 PRG:3110 20 6D C5
jmp AdvanceRadarBlipPosition ; CPU:$F113 PRG:3113 4C 7F F1
; -----------------------------------------------------------------------------
; Routine: ComputeRadarBlipOffset
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 11 instructions: pushes A; loads A from Zp49; sets the carry
; flag; subtracts $34 from A; stores A to Zp49; loads A from Zp4A;
; and 5 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N, Z, C and V flags, Zp49, Zp4A.
;
; -----------------------------------------------------------------------------
ComputeRadarBlipOffset:
pha ; CPU:$F116 PRG:3116 48
lda Zp49 ; CPU:$F117 PRG:3117 A5 49
sec ; CPU:$F119 PRG:3119 38
sbc #$34 ; CPU:$F11A PRG:311A E9 34
sta Zp49 ; CPU:$F11C PRG:311C 85 49
lda Zp4A ; CPU:$F11E PRG:311E A5 4A
sec ; CPU:$F120 PRG:3120 38
sbc #$10 ; CPU:$F121 PRG:3121 E9 10
sta Zp4A ; CPU:$F123 PRG:3123 85 4A
pla ; CPU:$F125 PRG:3125 68
rts ; CPU:$F126 PRG:3126 60
; -----------------------------------------------------------------------------
; Routine: SetPlayerScreenOrigin
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 18 instructions: loads A from ZpB4; stores A to Zp49; loads
; A from ZpB5; stores A to Zp4A; loads A from ZpAB; branches on
; negative to SubCF154; and 12 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SetPlayerScreenOrigin:
lda ZpB4 ; CPU:$F127 PRG:3127 A5 B4
sta Zp49 ; CPU:$F129 PRG:3129 85 49
lda ZpB5 ; CPU:$F12B PRG:312B A5 B5
sta Zp4A ; CPU:$F12D PRG:312D 85 4A
lda ZpAB ; CPU:$F12F PRG:312F A5 AB
bmi SubCF154_Loop ; CPU:$F131 PRG:3131 30 21
dec ZpAC ; CPU:$F133 PRG:3133 C6 AC
bne SubCF154_Loop ; CPU:$F135 PRG:3135 D0 1D
lda ZpAB ; CPU:$F137 PRG:3137 A5 AB
sta ZpAC ; CPU:$F139 PRG:3139 85 AC
lda ZpB2 ; CPU:$F13B PRG:313B A5 B2
cmp #$63 ; CPU:$F13D PRG:313D C9 63
beq Sub_8764_OnZero_F150 ; CPU:$F13F PRG:313F F0 0F
and #$01 ; CPU:$F141 PRG:3141 29 01
bne Sub_8764_OnNonzero_F14B ; CPU:$F143 PRG:3143 D0 06
lda ZpCA ; CPU:$F145 PRG:3145 A5 CA
bne Sub_8764_OnNonzero_F14B ; CPU:$F147 PRG:3147 D0 02
inc ZpCD ; CPU:$F149 PRG:3149 E6 CD
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F14B
; Global: The routine calls SubCF154.
; Local: Executes 2 instructions: increments ZpB2; calls SubCF154.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F14B:
inc ZpB2 ; CPU:$F14B PRG:314B E6 B2
jmp SubCF154_Loop ; CPU:$F14D PRG:314D 4C 54 F1
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_F150
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: loads A with $60; stores A to ZpB2.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_F150:
lda #$60 ; CPU:$F150 PRG:3150 A9 60
sta ZpB2 ; CPU:$F152 PRG:3152 85 B2
; -----------------------------------------------------------------------------
; Routine: SubCF154_Loop
; Global: The routine calls DrawRadarSweepSpriteAlt.
; Local: Executes 18 instructions: loads A from ZpB2; sets the carry flag;
; subtracts $60 from A; stores A to Zp4C; loads A with $E0; stores A
; to Zp4B; and 12 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
SubCF154_Loop:
lda ZpB2 ; CPU:$F154 PRG:3154 A5 B2
sec ; CPU:$F156 PRG:3156 38
sbc #$60 ; CPU:$F157 PRG:3157 E9 60
sta Zp4C ; CPU:$F159 PRG:3159 85 4C
lda #$E0 ; CPU:$F15B PRG:315B A9 E0
sta Zp4B ; CPU:$F15D PRG:315D 85 4B
lda #$00 ; CPU:$F15F PRG:315F A9 00
sta Zp4D ; CPU:$F161 PRG:3161 85 4D
lda #$00 ; CPU:$F163 PRG:3163 A9 00
jsr DrawRadarSweepSpriteAlt ; CPU:$F165 PRG:3165 20 79 F1
lda Zp3D ; CPU:$F168 PRG:3168 A5 3D
and #$0F ; CPU:$F16A PRG:316A 29 0F
tax ; CPU:$F16C PRG:316C AA
lda $F1A0,x ; CPU:$F16D PRG:316D BD A0 F1
sta Zp4C ; CPU:$F170 PRG:3170 85 4C
lda #$00 ; CPU:$F172 PRG:3172 A9 00
sta Zp4B ; CPU:$F174 PRG:3174 85 4B
ldy #$02 ; CPU:$F176 PRG:3176 A0 02
; -----------------------------------------------------------------------------
; Routine: DrawRadarSweepSprite
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: copies Y into A.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawRadarSweepSprite:
tya ; CPU:$F178 PRG:3178 98
; -----------------------------------------------------------------------------
; Routine: DrawRadarSweepSpriteAlt
; Global: The routine calls ComputeRadarBlipOffset and DrawSpritePartAlt2.
; Local: Executes 2 instructions: calls ComputeRadarBlipOffset; calls DrawSpritePartAlt2.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, the RAM fields it writes.
;
; -----------------------------------------------------------------------------
DrawRadarSweepSpriteAlt:
jsr ComputeRadarBlipOffset ; CPU:$F179 PRG:3179 20 16 F1
jsr DrawSpritePartAlt2 ; CPU:$F17C PRG:317C 20 C7 C5
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarBlipPosition
; Global: The routine calls AdvanceRadarBlipPositionC and AdvanceRadarBlipPositionD.
; Local: Executes 6 instructions: pushes A; loads A with $34; calls AdvanceRadarBlipPositionC;
; calls AdvanceRadarBlipPositionD; pulls A; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N, Z, C and V flags, Zp49, Zp4A.
;
; -----------------------------------------------------------------------------
AdvanceRadarBlipPosition:
pha ; CPU:$F17F PRG:317F 48
lda #$34 ; CPU:$F180 PRG:3180 A9 34
jsr AdvanceRadarBlipPositionC ; CPU:$F182 PRG:3182 20 8C F1
jsr AdvanceRadarBlipPositionD ; CPU:$F185 PRG:3185 20 92 F1
pla ; CPU:$F188 PRG:3188 68
rts ; CPU:$F189 PRG:3189 60
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarBlipPositionB
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $10.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp49.
;
; -----------------------------------------------------------------------------
AdvanceRadarBlipPositionB:
lda #$10 ; CPU:$F18A PRG:318A A9 10
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarBlipPositionC
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: clears the carry flag; adds Zp49 to A;
; stores A to Zp49; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N, Z, C and V flags, Zp49.
;
; -----------------------------------------------------------------------------
AdvanceRadarBlipPositionC:
clc ; CPU:$F18C PRG:318C 18
adc Zp49 ; CPU:$F18D PRG:318D 65 49
sta Zp49 ; CPU:$F18F PRG:318F 85 49
rts ; CPU:$F191 PRG:3191 60
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarBlipPositionD
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: loads A with $10.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Falls through to the next routine in the source; it has no return
; of its own.
; Clobbers:
; A, the N, Z, C and V flags, Zp4A.
;
; -----------------------------------------------------------------------------
AdvanceRadarBlipPositionD:
lda #$10 ; CPU:$F192 PRG:3192 A9 10
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarBlipPositionE
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: clears the carry flag; adds Zp4A to A;
; stores A to Zp4A; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N, Z, C and V flags, Zp4A.
;
; -----------------------------------------------------------------------------
AdvanceRadarBlipPositionE:
clc ; CPU:$F194 PRG:3194 18
adc Zp4A ; CPU:$F195 PRG:3195 65 4A
sta Zp4A ; CPU:$F197 PRG:3197 85 4A
rts ; CPU:$F199 PRG:3199 60
; -----------------------------------------------------------------------------
; Routine: AdvanceRadarBlipPositionF
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: clears the carry flag; adds Zp4B to A;
; stores A to Zp4B; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; no register, the N, Z, C and V flags, Zp4B.
;
; -----------------------------------------------------------------------------
AdvanceRadarBlipPositionF:
clc ; CPU:$F19A PRG:319A 18
adc Zp4B ; CPU:$F19B PRG:319B 65 4B
sta Zp4B ; CPU:$F19D PRG:319D 85 4B
rts ; CPU:$F19F PRG:319F 60
; ---- data $F1A0-$F1E6 (71 bytes) ----
; referenced by `lda $F1B4,x` at $F018 (operand $F1B4 falls inside this region)
; referenced by `lda $F1C0,x` at $F03C (operand $F1C0 falls inside this region)
; referenced by `lda $F1B4,x` at $F067 (operand $F1B4 falls inside this region)
; referenced by `lda $F1B4,x` at $F085 (operand $F1B4 falls inside this region)
; referenced by `lda $F1B0,x` at $F095 (operand $F1B0 falls inside this region)
; referenced by `lda $F1C8,x` at $F0A7 (operand $F1C8 falls inside this region)
; ... and 1 further references from decoded code
PlayerMovementDeltaTable:
.byte $0B, $0A, $09, $08, $07, $06, $05, $04, $03, $02, $01, $00, $0F, $0E, $0D, $0C ; CPU:$F1A0 PRG:31A0 0B 0A 09 08 07 06 05 04 03 02 01 00 0F 0E 0D 0C
.byte $00, $0C, $08, $04 ; CPU:$F1B0 PRG:31B0 00 0C 08 04
PlayerMovementDeltaTable2:
.byte $00, $0F, $0D, $0C, $0B, $09, $08, $07, $05, $04, $03, $01 ; CPU:$F1B4 PRG:31B4 00 0F 0D 0C 0B 09 08 07 05 04 03 01
PlayerMovementDeltaTable3:
.byte $AA, $AA, $0A, $2A, $4A, $4A, $6A, $8A ; CPU:$F1C0 PRG:31C0 AA AA 0A 2A 4A 4A 6A 8A
PlayerMovementDeltaTable4:
.byte $00, $0E, $0C, $0A, $08, $06, $04, $02 ; CPU:$F1C8 PRG:31C8 00 0E 0C 0A 08 06 04 02
.byte $E8, $E0, $19, $D0, $09, $A2, $00, $C8, $C0, $0A, $D0, $02, $A0, $00, $60, $E8 ; CPU:$F1D0 PRG:31D0 E8 E0 19 D0 09 A2 00 C8 C0 0A D0 02 A0 00 60 E8
.byte $E0, $28, $4C, $D3, $F1, $A9, $18 ; CPU:$F1E0 PRG:31E0 E0 28 4C D3 F1 A9 18
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F1E7
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 6 instructions: decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_F1F0; copies A into X; decrements Y;
; branches on non-negative to Sub_8764_OnNonnegative_F1F0; loads Y
; with $09.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; X and Y, the N and Z flags.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F1E7:
dex ; CPU:$F1E7 PRG:31E7 CA
bpl Sub_8764_OnNonnegative_F1F0; CPU:$F1E8 PRG:31E8 10 06
tax ; CPU:$F1EA PRG:31EA AA
dey ; CPU:$F1EB PRG:31EB 88
bpl Sub_8764_OnNonnegative_F1F0; CPU:$F1EC PRG:31EC 10 02
ldy #$09 ; CPU:$F1EE PRG:31EE A0 09
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonnegative_F1F0
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonnegative_F1F0:
rts ; CPU:$F1F0 PRG:31F0 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_Return_F1F1
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 18 instructions: decrements X; branches on non-negative to
; Sub_8764_OnNonnegative_F1F0; copies A into X; decrements Y;
; branches on non-negative to Sub_8764_OnNonnegative_F1F0; loads Y
; with $09; and 12 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp01, Zp02.
;
; -----------------------------------------------------------------------------
Sub_8764_Return_F1F1:
lda #$27 ; CPU:$F1F1 PRG:31F1 A9 27
bne Sub_8764_OnNonzero_F1E7 ; CPU:$F1F3 PRG:31F3 D0 F2
lda Zp5D ; CPU:$F1F5 PRG:31F5 A5 5D
beq Sub_8764_OnZero_F207 ; CPU:$F1F7 PRG:31F7 F0 0E
ldy Zp5E ; CPU:$F1F9 PRG:31F9 A4 5E
lda $F395,y ; CPU:$F1FB PRG:31FB B9 95 F3
beq Sub_8764_OnZero_F207 ; CPU:$F1FE PRG:31FE F0 07
clc ; CPU:$F200 PRG:3200 18
adc Zp5D ; CPU:$F201 PRG:3201 65 5D
tay ; CPU:$F203 PRG:3203 A8
lda $F394,y ; CPU:$F204 PRG:3204 B9 94 F3
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_F207
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 17 instructions: stores A to Zp02; shifts a right; ANDs A
; with $1E; copies A into Y; loads A from $F3F4,y; stores A to Zp00;
; and 11 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp00, Zp01, Zp02.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_F207:
sta Zp02 ; CPU:$F207 PRG:3207 85 02
lsr a ; CPU:$F209 PRG:3209 4A
and #$1E ; CPU:$F20A PRG:320A 29 1E
tay ; CPU:$F20C PRG:320C A8
lda $F3F4,y ; CPU:$F20D PRG:320D B9 F4 F3
sta Zp00 ; CPU:$F210 PRG:3210 85 00
lda $F3F5,y ; CPU:$F212 PRG:3212 B9 F5 F3
sta Zp01 ; CPU:$F215 PRG:3215 85 01
lda Zp02 ; CPU:$F217 PRG:3217 A5 02
and #$03 ; CPU:$F219 PRG:3219 29 03
tay ; CPU:$F21B PRG:321B A8
lda $F3F0,y ; CPU:$F21C PRG:321C B9 F0 F3
clc ; CPU:$F21F PRG:321F 18
adc Zp00 ; CPU:$F220 PRG:3220 65 00
sta Zp00 ; CPU:$F222 PRG:3222 85 00
bcc Sub_8764_OnCarryClear_F228 ; CPU:$F224 PRG:3224 90 02
inc Zp01 ; CPU:$F226 PRG:3226 E6 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_F228
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 4 instructions: loads A with $00; stores A to Zp02; loads X
; from Zp5C; branches on equal to Sub_8764_OnZero_F236.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp00, Zp01, Zp02.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_F228:
lda #$00 ; CPU:$F228 PRG:3228 A9 00
sta Zp02 ; CPU:$F22A PRG:322A 85 02
ldx Zp5C ; CPU:$F22C PRG:322C A6 5C
beq Sub_8764_OnZero_F236 ; CPU:$F22E PRG:322E F0 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F230
; Global: The routine calls NextRadarRowIndex.
; Local: Executes 3 instructions: calls NextRadarRowIndex; decrements X; branches on
; not equal to Sub_8764_OnNonzero_F230.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and X, the N, Z, C and V flags, Zp00, Zp01, Zp02.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F230:
jsr NextRadarRowIndex ; CPU:$F230 PRG:3230 20 5F F2
dex ; CPU:$F233 PRG:3233 CA
bne Sub_8764_OnNonzero_F230 ; CPU:$F234 PRG:3234 D0 FA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_F236
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_F236:
rts ; CPU:$F236 PRG:3236 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_Return_F237
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 8 instructions: loads A from Zp00; stores A to Zp5F; loads A
; from Zp01; stores A to Zp60; loads A with $00; stores A to Zp61;
; and 2 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp5F, Zp60, Zp61, Zp62, Zp63,
; Zp64.
;
; -----------------------------------------------------------------------------
Sub_8764_Return_F237:
lda Zp00 ; CPU:$F237 PRG:3237 A5 00
sta Zp5F ; CPU:$F239 PRG:3239 85 5F
lda Zp01 ; CPU:$F23B PRG:323B A5 01
sta Zp60 ; CPU:$F23D PRG:323D 85 60
lda #$00 ; CPU:$F23F PRG:323F A9 00
sta Zp61 ; CPU:$F241 PRG:3241 85 61
lda Zp5B ; CPU:$F243 PRG:3243 A5 5B
beq Sub_8764_OnZero_F25E ; CPU:$F245 PRG:3245 F0 17
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F247
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: compares A with $05; branches on carry clear
; to Sub_8764_OnCarryClear_F255; subtracts $05 from A; increments
; Zp5F; branches on not equal to Sub_8764_OnNonzero_F247; increments
; Zp60; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp5F, Zp60, Zp61, Zp62, Zp63,
; Zp64.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F247:
cmp #$05 ; CPU:$F247 PRG:3247 C9 05
bcc Sub_8764_OnCarryClear_F255 ; CPU:$F249 PRG:3249 90 0A
sbc #$05 ; CPU:$F24B PRG:324B E9 05
inc Zp5F ; CPU:$F24D PRG:324D E6 5F
bne Sub_8764_OnNonzero_F247 ; CPU:$F24F PRG:324F D0 F6
inc Zp60 ; CPU:$F251 PRG:3251 E6 60
bne Sub_8764_OnNonzero_F247 ; CPU:$F253 PRG:3253 D0 F2
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_F255
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 2 instructions: copies A into X; branches on equal to
; Sub_8764_OnZero_F25E.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp5F, Zp60, Zp61, Zp62, Zp63,
; Zp64.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_F255:
tax ; CPU:$F255 PRG:3255 AA
beq Sub_8764_OnZero_F25E ; CPU:$F256 PRG:3256 F0 06
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F258
; Global: The routine calls ReadRadarRowCounter.
; Local: Executes 3 instructions: calls ReadRadarRowCounter; decrements X; branches on
; not equal to Sub_8764_OnNonzero_F258.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, X and Y, the N, Z, C and V flags, Zp5F, Zp60, Zp61, Zp62, Zp63,
; Zp64.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F258:
jsr ReadRadarRowCounter ; CPU:$F258 PRG:3258 20 7A F2
dex ; CPU:$F25B PRG:325B CA
bne Sub_8764_OnNonzero_F258 ; CPU:$F25C PRG:325C D0 FA
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnZero_F25E
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnZero_F25E:
rts ; CPU:$F25E PRG:325E 60
; -----------------------------------------------------------------------------
; Routine: NextRadarRowIndex
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 14 instructions: loads A from Zp02; clears the carry flag;
; adds $05 to A; stores A to Zp02; compares A with $19; branches on
; carry clear to Sub_8764_OnCarryClear_F279; and 8 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A, the N, Z, C and V flags, Zp00, Zp01, Zp02.
;
; -----------------------------------------------------------------------------
NextRadarRowIndex:
lda Zp02 ; CPU:$F25F PRG:325F A5 02
clc ; CPU:$F261 PRG:3261 18
adc #$05 ; CPU:$F262 PRG:3262 69 05
sta Zp02 ; CPU:$F264 PRG:3264 85 02
cmp #$19 ; CPU:$F266 PRG:3266 C9 19
bcc Sub_8764_OnCarryClear_F279 ; CPU:$F268 PRG:3268 90 0F
lda #$00 ; CPU:$F26A PRG:326A A9 00
sta Zp02 ; CPU:$F26C PRG:326C 85 02
lda Zp00 ; CPU:$F26E PRG:326E A5 00
clc ; CPU:$F270 PRG:3270 18
adc #$08 ; CPU:$F271 PRG:3271 69 08
sta Zp00 ; CPU:$F273 PRG:3273 85 00
bcc Sub_8764_OnCarryClear_F279 ; CPU:$F275 PRG:3275 90 02
inc Zp01 ; CPU:$F277 PRG:3277 E6 01
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_F279
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 1 instruction: returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; nothing.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_F279:
rts ; CPU:$F279 PRG:3279 60
; -----------------------------------------------------------------------------
; Routine: ReadRadarRowCounter
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 3 instructions: loads A from Zp61; branches on not equal to
; Sub_8764_OnNonzero_F2B2; loads Y with $00.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp5F, Zp60, Zp61, Zp62, Zp63, Zp64.
;
; -----------------------------------------------------------------------------
ReadRadarRowCounter:
lda Zp61 ; CPU:$F27A PRG:327A A5 61
bne Sub_8764_OnNonzero_F2B2 ; CPU:$F27C PRG:327C D0 34
ldy #$00 ; CPU:$F27E PRG:327E A0 00
; -----------------------------------------------------------------------------
; Routine: Sub_8764_LoadIndexAndContinue_F280
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 19 instructions: loads A from ((Zp5F),y); stores A to Zp61;
; shifts a right; shifts a right; ANDs A with $1E; copies A into Y;
; and 13 more instructions.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N, Z, C and V flags, Zp5F, Zp60, Zp61, Zp62, Zp63, Zp64.
;
; -----------------------------------------------------------------------------
Sub_8764_LoadIndexAndContinue_F280:
lda (Zp5F),y ; CPU:$F280 PRG:3280 B1 5F
sta Zp61 ; CPU:$F282 PRG:3282 85 61
lsr a ; CPU:$F284 PRG:3284 4A
lsr a ; CPU:$F285 PRG:3285 4A
and #$1E ; CPU:$F286 PRG:3286 29 1E
tay ; CPU:$F288 PRG:3288 A8
lda $F40E,y ; CPU:$F289 PRG:3289 B9 0E F4
sta Zp63 ; CPU:$F28C PRG:328C 85 63
lda $F40F,y ; CPU:$F28E PRG:328E B9 0F F4
sta Zp64 ; CPU:$F291 PRG:3291 85 64
lda Zp61 ; CPU:$F293 PRG:3293 A5 61
and #$07 ; CPU:$F295 PRG:3295 29 07
tay ; CPU:$F297 PRG:3297 A8
lda $F406,y ; CPU:$F298 PRG:3298 B9 06 F4
clc ; CPU:$F29B PRG:329B 18
adc Zp63 ; CPU:$F29C PRG:329C 65 63
sta Zp63 ; CPU:$F29E PRG:329E 85 63
bcc Sub_8764_OnCarryClear_F2A4 ; CPU:$F2A0 PRG:32A0 90 02
inc Zp64 ; CPU:$F2A2 PRG:32A2 E6 64
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnCarryClear_F2A4
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 7 instructions: loads A from Zp02; stores A to Zp62; loads A
; with $05; stores A to Zp61; increments Zp5F; branches on not equal
; to Sub_8764_OnNonzero_F2B2; and 1 more instruction.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Leaves through one of its branches rather than a return; the caller
; resumes at the branch target.
; Clobbers:
; A and Y, the N and Z flags, Zp5F, Zp60, Zp61, Zp62.
;
; -----------------------------------------------------------------------------
Sub_8764_OnCarryClear_F2A4:
lda Zp02 ; CPU:$F2A4 PRG:32A4 A5 02
sta Zp62 ; CPU:$F2A6 PRG:32A6 85 62
lda #$05 ; CPU:$F2A8 PRG:32A8 A9 05
sta Zp61 ; CPU:$F2AA PRG:32AA 85 61
inc Zp5F ; CPU:$F2AC PRG:32AC E6 5F
bne Sub_8764_OnNonzero_F2B2 ; CPU:$F2AE PRG:32AE D0 02
inc Zp60 ; CPU:$F2B0 PRG:32B0 E6 60
; -----------------------------------------------------------------------------
; Routine: Sub_8764_OnNonzero_F2B2
; Global: The routine reads no RAM field, writes none and calls nothing - it
; is a straight-line sequence whose only effect is on the registers
; and the flags.
; Local: Executes 5 instructions: decrements Zp61; loads Y from Zp62; loads A
; from ((Zp63),y); increments Zp62; returns with RTS.
; Parameters: Takes its input from the registers and the immediate values in
; the code; it reads no zero-page or RAM field.
; Returns: Returns with RTS; the registers it loaded still hold the values it
; computed.
; Clobbers:
; A and Y, the N and Z flags, Zp61, Zp62.
;
; -----------------------------------------------------------------------------
Sub_8764_OnNonzero_F2B2:
dec Zp61 ; CPU:$F2B2 PRG:32B2 C6 61
ldy Zp62 ; CPU:$F2B4 PRG:32B4 A4 62
lda (Zp63),y ; CPU:$F2B6 PRG:32B6 B1 63
inc Zp62 ; CPU:$F2B8 PRG:32B8 E6 62
rts ; CPU:$F2BA PRG:32BA 60
; ---- data $F2BB-$FFFF (3397 bytes) ----
; referenced by `lda $F395,y` at $F1FB (operand $F395 falls inside this region)
; referenced by `lda $F394,y` at $F204 (operand $F394 falls inside this region)
; referenced by `lda $F3F4,y` at $F20D (operand $F3F4 falls inside this region)
; referenced by `lda $F3F5,y` at $F212 (operand $F3F5 falls inside this region)
; referenced by `lda $F3F0,y` at $F21C (operand $F3F0 falls inside this region)
; referenced by `lda $F40E,y` at $F289 (operand $F40E falls inside this region)
; ... and 2 further references from decoded code
.byte $A6, $5A, $A4, $58, $20, $E5, $F1, $86, $5A, $84, $58, $86, $5C, $84, $5E, $A5 ; CPU:$F2BB PRG:32BB A6 5A A4 58 20 E5 F1 86 5A 84 58 86 5C 84 5E A5
.byte $59, $85, $5B, $A5, $57, $85, $5D, $A2, $00, $8A, $48, $20, $F5, $F1, $20, $37 ; CPU:$F2CB PRG:32CB 59 85 5B A5 57 85 5D A2 00 8A 48 20 F5 F1 20 37
.byte $F2, $68, $AA, $20, $7A, $F2, $9D, $01, $02, $E8, $E0, $22, $F0, $D1, $E6, $5B ; CPU:$F2DB PRG:32DB F2 68 AA 20 7A F2 9D 01 02 E8 E0 22 F0 D1 E6 5B
.byte $A5, $5B, $C9, $28, $D0, $ED, $A9, $00, $85, $5B, $E6, $5D, $A5, $5D, $C9, $0A ; CPU:$F2EB PRG:32EB A5 5B C9 28 D0 ED A9 00 85 5B E6 5D A5 5D C9 0A
.byte $D0, $D7, $A9, $00, $85, $5D, $F0, $D1, $A6, $5A, $A4, $58, $20, $D0, $F1, $86 ; CPU:$F2FB PRG:32FB D0 D7 A9 00 85 5D F0 D1 A6 5A A4 58 20 D0 F1 86
.byte $5A, $84, $58, $8A, $18, $69, $03, $C9, $19, $90, $03, $E9, $19, $C8, $AA, $C8 ; CPU:$F30B PRG:330B 5A 84 58 8A 18 69 03 C9 19 90 03 E9 19 C8 AA C8
.byte $98, $C9, $0A, $90, $A6, $E9, $0A, $A8, $B0, $A1, $A6, $59, $A4, $57, $20, $F1 ; CPU:$F31B PRG:331B 98 C9 0A 90 A6 E9 0A A8 B0 A1 A6 59 A4 57 20 F1
.byte $F1, $86, $59, $84, $57, $86, $5B, $84, $5D, $A5, $5A, $85, $5C, $A5, $58, $85 ; CPU:$F32B PRG:332B F1 86 59 84 57 86 5B 84 5D A5 5A 85 5C A5 58 85
.byte $5E, $A2, $00, $8A, $48, $20, $F5, $F1, $20, $37, $F2, $68, $AA, $20, $7A, $F2 ; CPU:$F33B PRG:333B 5E A2 00 8A 48 20 F5 F1 20 37 F2 68 AA 20 7A F2
.byte $9D, $01, $02, $E8, $E0, $20, $F0, $22, $E6, $5C, $A5, $5C, $C9, $19, $B0, $08 ; CPU:$F34B PRG:334B 9D 01 02 E8 E0 20 F0 22 E6 5C A5 5C C9 19 B0 08
.byte $8A, $48, $20, $5F, $F2, $4C, $43, $F3, $A9, $00, $85, $5C, $E6, $5E, $A5, $5E ; CPU:$F35B PRG:335B 8A 48 20 5F F2 4C 43 F3 A9 00 85 5C E6 5E A5 5E
.byte $C9, $0A, $D0, $CF, $A9, $00, $85, $5E, $F0, $C9, $60, $A6, $59, $A4, $57, $20 ; CPU:$F36B PRG:336B C9 0A D0 CF A9 00 85 5E F0 C9 60 A6 59 A4 57 20
.byte $DF, $F1, $86, $59, $84, $57, $8A, $18, $69, $20, $C9, $28, $90, $03, $E9, $28 ; CPU:$F37B PRG:337B DF F1 86 59 84 57 8A 18 69 20 C9 28 90 03 E9 28
.byte $C8, $AA, $C0, $0A, $D0, $9F, $A0, $00, $F0, $9B, $00, $0A, $13, $1C, $25, $2E ; CPU:$F38B PRG:338B C8 AA C0 0A D0 9F A0 00 F0 9B 00 0A 13 1C 25 2E
.byte $37, $40, $49, $52, $00, $00, $00, $00, $00, $00, $00, $1E, $1F, $00, $01, $02 ; CPU:$F39B PRG:339B 37 40 49 52 00 00 00 00 00 00 00 1E 1F 00 01 02
.byte $03, $04, $00, $00, $20, $21, $00, $05, $06, $07, $00, $0E, $00, $00, $00, $00 ; CPU:$F3AB PRG:33AB 03 04 00 00 20 21 00 05 06 07 00 0E 00 00 00 00
.byte $08, $09, $00, $00, $00, $00, $16, $00, $0A, $00, $00, $0B, $0C, $00, $00, $17 ; CPU:$F3BB PRG:33BB 08 09 00 00 00 00 16 00 0A 00 00 0B 0C 00 00 17
.byte $00, $00, $00, $00, $00, $0D, $00, $00, $00, $00, $00, $0F, $10, $00, $00, $00 ; CPU:$F3CB PRG:33CB 00 00 00 00 00 0D 00 00 00 00 00 0F 10 00 00 00
.byte $18, $19, $00, $11, $12, $13, $00, $00, $00, $1A, $1B, $00, $00, $00, $00, $14 ; CPU:$F3DB PRG:33DB 18 19 00 11 12 13 00 00 00 1A 1B 00 00 00 00 14
.byte $15, $00, $1C, $1D, $00, $00, $28, $50, $78, $2E, $F4, $CE, $F4, $6E, $F5, $0E ; CPU:$F3EB PRG:33EB 15 00 1C 1D 00 00 28 50 78 2E F4 CE F4 6E F5 0E
.byte $F6, $AE, $F6, $4E, $F7, $EE, $F7, $8E, $F8, $2E, $F9, $00, $19, $32, $4B, $64 ; CPU:$F3FB PRG:33FB F6 AE F6 4E F7 EE F7 8E F8 2E F9 00 19 32 4B 64
.byte $7D, $96, $AF, $7E, $F9, $46, $FA, $0E, $FB, $D6, $FB, $9E, $FC, $66, $FD, $2E ; CPU:$F40B PRG:340B 7D 96 AF 7E F9 46 FA 0E FB D6 FB 9E FC 66 FD 2E
.byte $FE, $F6, $FE, $BE, $FF, $86, $00, $4E, $01, $16, $02, $DE, $02, $A6, $03, $6E ; CPU:$F41B PRG:341B FE F6 FE BE FF 86 00 4E 01 16 02 DE 02 A6 03 6E
.byte $04, $36, $05, $0D, $00, $00, $00, $00, $00, $0D, $00, $00, $0D, $00, $00, $0D ; CPU:$F42B PRG:342B 04 36 05 0D 00 00 00 00 00 0D 00 00 0D 00 00 0D
.byte $00, $00, $00, $00, $00, $00, $0D, $00, $00, $00, $0D, $0D, $00, $00, $00, $00 ; CPU:$F43B PRG:343B 00 00 00 00 00 00 0D 00 00 00 0D 0D 00 00 00 00
.byte $0D, $00, $00, $00, $00, $0D, $00, $00, $00, $00, $0D, $00, $05, $38, $31, $38 ; CPU:$F44B PRG:344B 0D 00 00 00 00 0D 00 00 00 00 0D 00 05 38 31 38
.byte $32, $30, $04, $12, $1F, $17, $17, $17, $17, $17, $17, $12, $2C, $28, $28, $28 ; CPU:$F45B PRG:345B 32 30 04 12 1F 17 17 17 17 17 17 12 2C 28 28 28
.byte $28, $28, $28, $00, $14, $3B, $40, $3C, $41, $10, $10, $00, $00, $08, $25, $3C ; CPU:$F46B PRG:346B 28 28 28 00 14 3B 40 3C 41 10 10 00 00 08 25 3C
.byte $3F, $3C, $3D, $05, $37, $36, $04, $05, $37, $36, $04, $17, $17, $17, $17, $17 ; CPU:$F47B PRG:347B 3F 3C 3D 05 37 36 04 05 37 36 04 17 17 17 17 17
.byte $17, $17, $35, $28, $28, $28, $28, $28, $19, $3A, $39, $3B, $3C, $3D, $0A, $0A ; CPU:$F48B PRG:348B 17 17 35 28 28 28 28 28 19 3A 39 3B 3C 3D 0A 0A
.byte $23, $33, $3C, $3C, $3D, $3F, $3E, $3C, $3E, $3C, $3C, $05, $37, $37, $36, $04 ; CPU:$F49B PRG:349B 23 33 3C 3C 3D 3F 3E 3C 3E 3C 3C 05 37 37 36 04
.byte $05, $37, $36, $40, $3C, $3F, $22, $14, $3E, $41, $3B, $25, $1E, $3B, $2E, $12 ; CPU:$F4AB PRG:34AB 05 37 36 40 3C 3F 22 14 3E 41 3B 25 1E 3B 2E 12
.byte $25, $3F, $41, $3C, $3D, $41, $32, $32, $3B, $3C, $3F, $3D, $3F, $3F, $3C, $3B ; CPU:$F4BB PRG:34BB 25 3F 41 3C 3D 41 32 32 3B 3C 3F 3D 3F 3F 3C 3B
.byte $3B, $3B, $3B, $05, $37, $37, $36, $04, $04, $00, $00, $40, $3F, $41, $3B, $3B ; CPU:$F4CB PRG:34CB 3B 3B 3B 05 37 37 36 04 04 00 00 40 3F 41 3B 3B
.byte $3B, $30, $00, $25, $1E, $25, $3D, $3C, $3E, $3B, $30, $3C, $3F, $3C, $0B, $1C ; CPU:$F4DB PRG:34DB 3B 30 00 25 1E 25 3D 3C 3E 3B 30 3C 3F 3C 0B 1C
.byte $15, $3B, $24, $1C, $21, $1A, $21, $0D, $00, $20, $20, $00, $0C, $3B, $40, $3C ; CPU:$F4EB PRG:34EB 15 3B 24 1C 21 1A 21 0D 00 20 20 00 0C 3B 40 3C
.byte $3C, $3D, $3F, $00, $07, $40, $0B, $1E, $41, $25, $41, $12, $3B, $25, $41, $25 ; CPU:$F4FB PRG:34FB 3C 3D 3F 00 07 40 0B 1E 41 25 41 12 3B 25 41 25
.byte $0B, $3B, $25, $0C, $3B, $40, $3F, $3D, $3C, $3C, $41, $07, $40, $3F, $3C, $33 ; CPU:$F50B PRG:350B 0B 3B 25 0C 3B 40 3F 3D 3C 3C 41 07 40 3F 3C 33
.byte $3C, $41, $25, $3C, $3F, $3D, $3E, $3D, $3E, $3C, $41, $3B, $33, $3E, $3E, $3F ; CPU:$F51B PRG:351B 3C 41 25 3C 3F 3D 3E 3D 3E 3C 41 3B 33 3E 3E 3F
.byte $0B, $1E, $3F, $3D, $3E, $3E, $3E, $3D, $3C, $0B, $40, $3B, $3F, $3E, $3F, $0B ; CPU:$F52B PRG:352B 0B 1E 3F 3D 3E 3E 3E 3D 3C 0B 40 3B 3F 3E 3F 0B
.byte $10, $40, $3F, $3F, $41, $25, $3D, $3C, $3C, $0B, $3B, $25, $33, $3D, $41, $3B ; CPU:$F53B PRG:353B 10 40 3F 3F 41 25 3D 3C 3C 0B 3B 25 33 3D 41 3B
.byte $40, $41, $22, $3C, $3F, $3F, $3F, $3C, $3F, $0B, $2E, $41, $40, $3D, $1E, $41 ; CPU:$F54B PRG:354B 40 41 22 3C 3F 3F 3F 3C 3F 0B 2E 41 40 3D 1E 41
.byte $3B, $3B, $2E, $0B, $25, $3F, $3C, $0B, $3B, $22, $00, $1C, $29, $29, $29, $29 ; CPU:$F55B PRG:355B 3B 3B 2E 0B 25 3F 3C 0B 3B 22 00 1C 29 29 29 29
.byte $21, $00, $0D, $08, $3F, $3D, $3C, $3C, $3E, $0B, $40, $14, $3C, $3E, $3D, $3C ; CPU:$F56B PRG:356B 21 00 0D 08 3F 3D 3C 3C 3E 0B 40 14 3C 3E 3D 3C
.byte $3E, $41, $25, $00, $08, $25, $3F, $1E, $3E, $3F, $3C, $00, $1A, $15, $16, $25 ; CPU:$F57B PRG:357B 3E 41 25 00 08 25 3F 1E 3E 3F 3C 00 1A 15 16 25
.byte $0B, $3B, $3B, $00, $00, $00, $00, $1A, $1B, $21, $1A, $3C, $3E, $3D, $33, $3B ; CPU:$F58B PRG:358B 0B 3B 3B 00 00 00 00 1A 1B 21 1A 3C 3E 3D 33 3B
.byte $3B, $1D, $21, $1E, $3F, $3E, $29, $29, $0E, $2A, $00, $41, $40, $0E, $00, $00 ; CPU:$F59B PRG:359B 3B 1D 21 1E 3F 3E 29 29 0E 2A 00 41 40 0E 00 00
.byte $29, $21, $00, $25, $3F, $0E, $05, $26, $00, $0D, $00, $1B, $29, $29, $29, $27 ; CPU:$F5AB PRG:35AB 29 21 00 25 3F 0E 05 26 00 0D 00 1B 29 29 29 27
.byte $00, $00, $00, $0D, $05, $36, $00, $05, $37, $36, $00, $18, $09, $3B, $2E, $14 ; CPU:$F5BB PRG:35BB 00 00 00 0D 05 36 00 05 37 36 00 18 09 3B 2E 14
.byte $16, $3B, $2F, $12, $3B, $24, $05, $36, $04, $1A, $27, $12, $3E, $3C, $3F, $3F ; CPU:$F5CB PRG:35CB 16 3B 2F 12 3B 24 05 36 04 1A 27 12 3E 3C 3F 3F
.byte $3C, $32, $2E, $34, $29, $21, $20, $1A, $1B, $21, $00, $05, $38, $31, $37, $37 ; CPU:$F5DB PRG:35DB 3C 32 2E 34 29 21 20 1A 1B 21 00 05 38 31 37 37
.byte $36, $05, $37, $08, $25, $3D, $3C, $3C, $41, $25, $3D, $14, $3B, $3B, $3B, $16 ; CPU:$F5EB PRG:35EB 36 05 37 08 25 3D 3C 3C 41 25 3D 14 3B 3B 3B 16
.byte $25, $3D, $3E, $0D, $1A, $1B, $21, $00, $14, $25, $3F, $00, $0D, $00, $00, $0D ; CPU:$F5FB PRG:35FB 25 3D 3E 0D 1A 1B 21 00 14 25 3F 00 0D 00 00 0D
.byte $00, $1A, $15, $36, $04, $05, $36, $04, $04, $05, $26, $3C, $3D, $3D, $3C, $3D ; CPU:$F60B PRG:360B 00 1A 15 36 04 05 36 04 04 05 26 3C 3D 3D 3C 3D
.byte $3C, $1C, $27, $3D, $3E, $0B, $3B, $33, $3B, $2F, $00, $3E, $3E, $3B, $3B, $3D ; CPU:$F61B PRG:361B 3C 1C 27 3D 3E 0B 3B 33 3B 2F 00 3E 3E 3B 3B 3D
.byte $41, $2A, $0D, $25, $3F, $3D, $3D, $3E, $3F, $41, $2F, $14, $40, $3E, $3F, $3E ; CPU:$F62B PRG:362B 41 2A 0D 25 3F 3D 3D 3E 3F 41 2F 14 40 3E 3F 3E
.byte $3D, $0B, $2A, $0C, $25, $3E, $3D, $1E, $0B, $3B, $24, $13, $3C, $3E, $3E, $3F ; CPU:$F63B PRG:363B 3D 0B 2A 0C 25 3E 3D 1E 0B 3B 24 13 3C 3E 3E 3F
.byte $3C, $33, $22, $0D, $08, $25, $3F, $0B, $3B, $3B, $2F, $34, $29, $29, $1B, $21 ; CPU:$F64B PRG:364B 3C 33 22 0D 08 25 3F 0B 3B 3B 2F 34 29 29 1B 21
.byte $1A, $1B, $27, $0D, $06, $32, $31, $38, $32, $26, $00, $00, $08, $3B, $10, $10 ; CPU:$F65B PRG:365B 1A 1B 27 0D 06 32 31 38 32 26 00 00 08 3B 10 10
.byte $24, $00, $00, $00, $14, $3B, $10, $10, $10, $30, $00, $0D, $06, $3D, $3C, $3F ; CPU:$F66B PRG:366B 24 00 00 00 14 3B 10 10 10 30 00 0D 06 3D 3C 3F
.byte $3C, $3C, $2F, $18, $29, $29, $29, $21, $1A, $1B, $27, $06, $32, $30, $00, $00 ; CPU:$F67B PRG:367B 3C 3C 2F 18 29 29 29 21 1A 1B 27 06 32 30 00 00
.byte $00, $0D, $05, $08, $3B, $22, $0D, $00, $05, $38, $40, $1A, $21, $00, $05, $38 ; CPU:$F68B PRG:368B 00 0D 05 08 3B 22 0D 00 05 38 40 1A 21 00 05 38
.byte $3B, $40, $3F, $0D, $05, $38, $3B, $3B, $40, $0B, $40, $06, $3B, $3B, $3B, $3C ; CPU:$F69B PRG:369B 3B 40 3F 0D 05 38 3B 3B 40 0B 40 06 3B 3B 3B 3C
.byte $3F, $3C, $3E, $37, $36, $05, $37, $36, $04, $00, $00, $3C, $3C, $3C, $3D, $3C ; CPU:$F6AB PRG:36AB 3F 3C 3E 37 36 05 37 36 04 00 00 3C 3C 3C 3D 3C
.byte $41, $30, $00, $3D, $33, $40, $3F, $3D, $0B, $3B, $26, $3E, $3F, $3E, $3D, $3F ; CPU:$F6BB PRG:36BB 41 30 00 3D 33 40 3F 3D 0B 3B 26 3E 3F 3E 3D 3F
.byte $3C, $3E, $2A, $3E, $3D, $3E, $1E, $3C, $3C, $0B, $24, $00, $05, $37, $37, $37 ; CPU:$F6CB PRG:36CB 3C 3E 2A 3E 3D 3E 1E 3C 3C 0B 24 00 05 37 37 37
.byte $37, $37, $38, $0C, $3B, $3B, $40, $3C, $3C, $3D, $3C, $13, $1C, $29, $29, $15 ; CPU:$F6DB PRG:36DB 37 37 38 0C 3B 3B 40 3C 3C 3D 3C 13 1C 29 29 15
.byte $3B, $25, $3C, $05, $36, $04, $05, $36, $1A, $15, $16, $1A, $15, $16, $1C, $1B ; CPU:$F6EB PRG:36EB 3B 25 3C 05 36 04 05 36 1A 15 16 1A 15 16 1C 1B
.byte $2D, $00, $0D, $3B, $10, $10, $3B, $3B, $3B, $3B, $3F, $3C, $3C, $3D, $3C, $3D ; CPU:$F6FB PRG:36FB 2D 00 0D 3B 10 10 3B 3B 3B 3B 3F 3C 3C 3D 3C 3D
.byte $3D, $3C, $3D, $3C, $3D, $3F, $3D, $3F, $0B, $3B, $40, $3B, $1E, $3C, $3F, $3C ; CPU:$F70B PRG:370B 3D 3C 3D 3C 3D 3F 3D 3F 0B 3B 40 3B 1E 3C 3F 3C
.byte $33, $3C, $0B, $1A, $29, $1B, $1B, $21, $1A, $1B, $1B, $3F, $3F, $3F, $41, $3B ; CPU:$F71B PRG:371B 33 3C 0B 1A 29 1B 1B 21 1A 1B 1B 3F 3F 3F 41 3B
.byte $40, $41, $24, $3D, $3C, $3D, $3F, $3D, $0B, $3B, $24, $0B, $3B, $1E, $10, $3F ; CPU:$F72B PRG:372B 40 41 24 3D 3C 3D 3F 3D 0B 3B 24 0B 3B 1E 10 3F
.byte $3C, $1D, $21, $3B, $10, $10, $10, $3B, $1C, $27, $00, $1B, $21, $1A, $1B, $21 ; CPU:$F73B PRG:373B 3C 1D 21 3B 10 10 10 3B 1C 27 00 1B 21 1A 1B 21
.byte $00, $00, $0D, $0D, $0C, $31, $36, $0C, $32, $32, $32, $00, $07, $40, $24, $07 ; CPU:$F74B PRG:374B 00 00 0D 0D 0C 31 36 0C 32 32 32 00 07 40 24 07
.byte $40, $3C, $3E, $18, $09, $25, $3C, $3C, $0B, $40, $0B, $12, $3B, $10, $10, $3B ; CPU:$F75B PRG:375B 40 3C 3E 18 09 25 3C 3C 0B 40 0B 12 3B 10 10 3B
.byte $40, $0B, $1C, $18, $15, $1C, $1B, $21, $1A, $21, $0D, $32, $30, $0D, $04, $04 ; CPU:$F76B PRG:376B 40 0B 1C 18 15 1C 1B 21 1A 21 0D 32 30 0D 04 04
.byte $05, $38, $30, $3C, $1C, $34, $09, $3C, $3C, $3F, $24, $22, $00, $04, $08, $10 ; CPU:$F77B PRG:377B 05 38 30 3C 1C 34 09 3C 3C 3F 24 22 00 04 08 10
.byte $3B, $1D, $21, $2D, $06, $3B, $3B, $16, $1C, $27, $00, $18, $15, $22, $20, $0D ; CPU:$F78B PRG:378B 3B 1D 21 2D 06 3B 3B 16 1C 27 00 18 15 22 20 0D
.byte $00, $00, $0D, $0D, $00, $05, $37, $37, $37, $36, $00, $00, $06, $3B, $10, $10 ; CPU:$F79B PRG:379B 00 00 0D 0D 00 05 37 37 37 36 00 00 06 3B 10 10
.byte $24, $20, $00, $12, $3B, $3C, $41, $3B, $3B, $32, $2E, $00, $14, $3B, $25, $41 ; CPU:$F7AB PRG:37AB 24 20 00 12 3B 3C 41 3B 3B 32 2E 00 14 3B 25 41
.byte $3B, $24, $00, $18, $2D, $14, $3C, $3E, $3C, $41, $30, $0D, $04, $06, $3B, $25 ; CPU:$F7BB PRG:37BB 3B 24 00 18 2D 14 3C 3E 3C 41 30 0D 04 06 3B 25
.byte $3D, $0B, $24, $12, $3E, $3D, $3D, $3C, $3F, $41, $22, $12, $25, $3F, $0B, $3B ; CPU:$F7CB PRG:37CB 3D 0B 24 12 3E 3D 3D 3C 3F 41 22 12 25 3F 0B 3B
.byte $3C, $0B, $2E, $12, $3B, $10, $10, $3B, $3B, $1C, $2D, $00, $1A, $1B, $1B, $21 ; CPU:$F7DB PRG:37DB 3C 0B 2E 12 3B 10 10 3B 3B 1C 2D 00 1A 1B 1B 21
.byte $20, $00, $0D, $0D, $04, $05, $36, $04, $05, $38, $31, $0C, $1F, $17, $17, $17 ; CPU:$F7EB PRG:37EB 20 00 0D 0D 04 05 36 04 05 38 31 0C 1F 17 17 17
.byte $17, $17, $17, $13, $2C, $28, $28, $28, $28, $28, $28, $00, $1A, $15, $16, $16 ; CPU:$F7FB PRG:37FB 17 17 17 13 2C 28 28 28 28 28 28 00 1A 15 16 16
.byte $16, $41, $3B, $00, $0C, $32, $32, $32, $32, $25, $41, $37, $36, $05, $38, $0F ; CPU:$F80B PRG:380B 16 41 3B 00 0C 32 32 32 32 25 41 37 36 05 38 0F
.byte $0F, $30, $00, $17, $17, $17, $2B, $02, $03, $41, $2F, $28, $28, $28, $28, $28 ; CPU:$F81B PRG:381B 0F 30 00 17 17 17 2B 02 03 41 2F 28 28 28 28 28
.byte $39, $3E, $2A, $40, $3E, $3C, $1E, $3C, $3C, $0B, $22, $25, $3F, $3C, $3C, $3D ; CPU:$F82B PRG:382B 39 3E 2A 40 3E 3C 1E 3C 3C 0B 22 25 3F 3C 3C 3D
.byte $41, $24, $0D, $00, $07, $40, $3C, $3C, $3D, $3D, $3F, $12, $3B, $25, $33, $3C ; CPU:$F83B PRG:383B 41 24 0D 00 07 40 3C 3C 3D 3D 3F 12 3B 25 33 3C
.byte $3F, $0B, $3B, $12, $3B, $40, $3F, $41, $3B, $40, $3C, $12, $40, $3F, $3C, $3F ; CPU:$F84B PRG:384B 3F 0B 3B 12 3B 40 3F 41 3B 40 3C 12 40 3F 3C 3F
.byte $3D, $3E, $3C, $12, $25, $3D, $3C, $3C, $3E, $0B, $3B, $41, $3B, $3B, $3B, $25 ; CPU:$F85B PRG:385B 3D 3E 3C 12 25 3D 3C 3C 3E 0B 3B 41 3B 3B 3B 25
.byte $0B, $3B, $2E, $25, $41, $33, $1E, $41, $3B, $24, $00, $3C, $3F, $3D, $3E, $0B ; CPU:$F86B PRG:386B 0B 3B 2E 25 41 33 1E 41 3B 24 00 3C 3F 3D 3E 0B
.byte $3B, $3B, $2E, $3C, $3C, $3F, $3F, $3C, $41, $3B, $2F, $3B, $40, $3C, $3C, $3C ; CPU:$F87B PRG:387B 3B 3B 2E 3C 3C 3F 3F 3C 41 3B 2F 3B 40 3C 3C 3C
.byte $3F, $41, $2A, $12, $3B, $3B, $3B, $3B, $25, $3C, $41, $18, $09, $3C, $41, $40 ; CPU:$F88B PRG:388B 3F 41 2A 12 3B 3B 3B 3B 25 3C 41 18 09 3C 41 40
.byte $3D, $3C, $0B, $12, $16, $3C, $3F, $3F, $3F, $3C, $3C, $0C, $30, $14, $3B, $3B ; CPU:$F89B PRG:389B 3D 3C 0B 12 16 3C 3F 3F 3F 3C 3C 0C 30 14 3B 3B
.byte $3B, $1E, $10, $13, $16, $2E, $1A, $1B, $1B, $29, $29, $40, $3E, $3C, $3C, $3D ; CPU:$F8AB PRG:38AB 3B 1E 10 13 16 2E 1A 1B 1B 29 29 40 3E 3C 3C 3D
.byte $3D, $0B, $24, $25, $0B, $33, $40, $3F, $0B, $3B, $22, $3C, $3D, $3C, $0B, $16 ; CPU:$F8BB PRG:38BB 3D 0B 24 25 0B 33 40 3F 0B 3B 22 3C 3D 3C 0B 16
.byte $16, $3B, $2E, $33, $3E, $1D, $21, $04, $04, $20, $00, $29, $29, $27, $00, $1A ; CPU:$F8CB PRG:38CB 16 3B 2E 33 3E 1D 21 04 04 20 00 29 29 27 00 1A
.byte $15, $2E, $00, $11, $0E, $01, $32, $31, $37, $36, $04, $07, $1E, $3B, $3D, $3C ; CPU:$F8DB PRG:38DB 15 2E 00 11 0E 01 32 31 37 36 04 07 1E 3B 3D 3C
.byte $3D, $3C, $3C, $14, $25, $3C, $3F, $3C, $3E, $3C, $3D, $00, $20, $20, $08, $33 ; CPU:$F8EB PRG:38EB 3D 3C 3C 14 25 3C 3F 3C 3E 3C 3D 00 20 20 08 33
.byte $3F, $3D, $3E, $00, $00, $06, $40, $3F, $3C, $3F, $3E, $04, $05, $36, $00, $04 ; CPU:$F8FB PRG:38FB 3F 3D 3E 00 00 06 40 3F 3C 3F 3E 04 05 36 00 04
.byte $00, $04, $00, $3C, $41, $3B, $30, $14, $32, $1C, $2D, $3C, $3E, $3C, $41, $30 ; CPU:$F90B PRG:390B 00 04 00 3C 41 3B 30 14 32 1C 2D 3C 3E 3C 41 30
.byte $20, $00, $00, $3D, $0B, $40, $3F, $41, $32, $26, $00, $0B, $3B, $3F, $3D, $3F ; CPU:$F91B PRG:391B 20 00 00 3D 0B 40 3F 41 32 26 00 0B 3B 3F 3D 3F
.byte $33, $2A, $00, $0D, $06, $40, $3F, $41, $1E, $40, $3F, $18, $09, $25, $41, $25 ; CPU:$F92B PRG:392B 33 2A 00 0D 06 40 3F 41 1E 40 3F 18 09 25 41 25
.byte $3D, $0B, $3B, $0C, $40, $3C, $3F, $3C, $3F, $3C, $3C, $13, $3B, $10, $10, $3B ; CPU:$F93B PRG:393B 3D 0B 3B 0C 40 3C 3F 3C 3F 3C 3C 13 3B 10 10 3B
.byte $10, $10, $10, $34, $29, $29, $1B, $15, $1C, $1B, $1B, $3D, $3C, $3C, $3F, $3C ; CPU:$F94B PRG:394B 10 10 10 34 29 29 1B 15 1C 1B 1B 3D 3C 3C 3F 3C
.byte $0B, $3B, $2F, $25, $3D, $41, $24, $09, $1E, $1D, $27, $3C, $3F, $0B, $24, $08 ; CPU:$F95B PRG:395B 0B 3B 2F 25 3D 41 24 09 1E 1D 27 3C 3F 0B 24 08
.byte $10, $2A, $00, $3B, $3B, $3B, $22, $14, $3B, $3B, $2E, $1B, $1B, $21, $00, $0D ; CPU:$F96B PRG:396B 10 2A 00 3B 3B 3B 22 14 3B 3B 2E 1B 1B 21 00 0D
.byte $1A, $21, $0D, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; CPU:$F97B PRG:397B 1A 21 0D 80 80 80 80 80 80 80 80 80 80 80 80 80
.byte $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $FF, $FC, $FC, $FC ; CPU:$F98B PRG:398B 80 80 80 80 80 80 80 80 80 80 80 80 FF FC FC FC
.byte $FC, $F1, $BB, $D4, $BB, $BB, $FE, $DE, $D4, $BB, $BB, $F1, $D0, $D1, $BB, $BB ; CPU:$F99B PRG:399B FC F1 BB D4 BB BB FE DE D4 BB BB F1 D0 D1 BB BB
.byte $FC, $D2, $D3, $BB, $BB, $BA, $BA, $BA, $BA, $BA, $BA, $BA, $BA, $BA, $BA, $B4 ; CPU:$F9AB PRG:39AB FC D2 D3 BB BB BA BA BA BA BA BA BA BA BA BA B4
.byte $BA, $BA, $B8, $B9, $BA, $B8, $B9, $BB, $BB, $BA, $B1, $B1, $B1, $B1, $BA, $BA ; CPU:$F9BB PRG:39BB BA BA B8 B9 BA B8 B9 BB BB BA B1 B1 B1 B1 BA BA
.byte $BA, $BA, $BA, $AA, $AA, $AA, $AA, $AA, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$F9CB PRG:39CB BA BA BA AA AA AA AA AA BB BB BB BB BB BB BB BB
.byte $BB, $D6, $B1, $B1, $B1, $A5, $D6, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; CPU:$F9DB PRG:39DB BB D6 B1 B1 B1 A5 D6 80 80 80 80 80 80 80 80 80
.byte $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $90, $9E, $9D, $9C, $8D ; CPU:$F9EB PRG:39EB 80 80 80 80 80 80 80 80 80 80 80 90 9E 9D 9C 8D
.byte $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $90, $9D, $9C, $80 ; CPU:$F9FB PRG:39FB 80 80 80 80 80 80 80 80 80 80 80 80 90 9D 9C 80
.byte $8F, $BB, $BB, $BB, $90, $BB, $BB, $BB, $BB, $80, $80, $80, $80, $90, $80, $80 ; CPU:$FA0B PRG:3A0B 8F BB BB BB 90 BB BB BB BB 80 80 80 80 90 80 80
.byte $80, $8F, $BB, $80, $80, $8F, $BB, $BB, $80, $91, $BB, $BB, $BB, $90, $92, $BB ; CPU:$FA1B PRG:3A1B 80 8F BB 80 80 8F BB BB 80 91 BB BB BB 90 92 BB
.byte $BB, $BB, $80, $80, $99, $BB, $BB, $80, $91, $92, $BB, $BB, $80, $97, $BB, $BB ; CPU:$FA2B PRG:3A2B BB BB 80 80 99 BB BB 80 91 92 BB BB 80 97 BB BB
.byte $BB, $91, $BB, $BB, $BB, $BB, $97, $BB, $BB, $BB, $BB, $99, $BB, $BB, $BB, $BB ; CPU:$FA3B PRG:3A3B BB 91 BB BB BB BB 97 BB BB BB BB 99 BB BB BB BB
.byte $98, $BB, $BB, $BB, $BB, $99, $A4, $A3, $BB, $BB, $97, $BB, $BB, $BB, $BB, $98 ; CPU:$FA4B PRG:3A4B 98 BB BB BB BB 99 A4 A3 BB BB 97 BB BB BB BB 98
.byte $BB, $BB, $BB, $BB, $BB, $D9, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $8A, $BB ; CPU:$FA5B PRG:3A5B BB BB BB BB BB D9 BB BB BB BB BB BB BB BB 8A BB
.byte $D8, $BB, $BB, $97, $BB, $BB, $BB, $BB, $98, $BB, $BB, $BB, $BB, $A9, $A9, $A9 ; CPU:$FA6B PRG:3A6B D8 BB BB 97 BB BB BB BB 98 BB BB BB BB A9 A9 A9
.byte $A9, $A9, $BA, $DB, $DC, $DD, $BA, $BA, $EB, $EC, $ED, $BA, $BA, $BA, $BA, $BA ; CPU:$FA7B PRG:3A7B A9 A9 BA DB DC DD BA BA EB EC ED BA BA BA BA BA
.byte $BA, $AA, $AA, $AA, $AA, $AA, $BB, $BB, $BB, $E0, $BB, $E1, $E1, $E1, $E5, $BB ; CPU:$FA8B PRG:3A8B BA AA AA AA AA AA BB BB BB E0 BB E1 E1 E1 E5 BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $80 ; CPU:$FA9B PRG:3A9B BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB 80
.byte $80, $80, $80, $9C, $80, $80, $80, $91, $BB, $80, $80, $80, $98, $BB, $80, $80 ; CPU:$FAAB PRG:3AAB 80 80 80 9C 80 80 80 91 BB 80 80 80 98 BB 80 80
.byte $80, $91, $BB, $80, $80, $99, $BB, $BB, $80, $80, $80, $80, $80, $80, $81, $80 ; CPU:$FABB PRG:3ABB 80 91 BB 80 80 99 BB BB 80 80 80 80 80 80 81 80
.byte $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; CPU:$FACB PRG:3ACB 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
.byte $80, $FF, $FF, $FF, $FF, $FF, $F2, $80, $F2, $80, $F2, $80, $80, $80, $80, $80 ; CPU:$FADB PRG:3ADB 80 FF FF FF FF FF F2 80 F2 80 F2 80 80 80 80 80
.byte $F3, $80, $F3, $80, $F3, $FC, $FC, $FC, $FC, $FC, $9C, $8D, $90, $9E, $9D, $BB ; CPU:$FAEB PRG:3AEB F3 80 F3 80 F3 FC FC FC FC FC 9C 8D 90 9E 9D BB
.byte $BB, $BB, $BB, $BB, $A9, $A9, $A9, $A9, $A9, $BA, $BA, $BA, $BA, $BA, $BA, $BA ; CPU:$FAFB PRG:3AFB BB BB BB BB A9 A9 A9 A9 A9 BA BA BA BA BA BA BA
.byte $A7, $BA, $BA, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC ; CPU:$FB0B PRG:3B0B A7 BA BA BC BC BC BC BC BC BC BC BC BC BC BC BC
.byte $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $BC, $80, $80, $F1, $FF ; CPU:$FB1B PRG:3B1B BC BC BC BC BC BC BC BC BC BC BC BC 80 80 F1 FF
.byte $FF, $80, $80, $80, $F2, $80, $80, $80, $80, $80, $80, $80, $80, $80, $F3, $80 ; CPU:$FB2B PRG:3B2B FF 80 80 80 F2 80 80 80 80 80 80 80 80 80 F3 80
.byte $80, $80, $F1, $FC, $FC, $80, $80, $80, $80, $91, $80, $80, $80, $80, $99, $80 ; CPU:$FB3B PRG:3B3B 80 80 F1 FC FC 80 80 80 80 91 80 80 80 80 99 80
.byte $80, $80, $80, $97, $80, $80, $80, $80, $98, $80, $80, $80, $80, $89, $80, $80 ; CPU:$FB4B PRG:3B4B 80 80 80 97 80 80 80 80 98 80 80 80 80 89 80 80
.byte $99, $BB, $BB, $80, $80, $88, $8A, $BB, $80, $80, $80, $89, $BB, $80, $80, $80 ; CPU:$FB5B PRG:3B5B 99 BB BB 80 80 88 8A BB 80 80 80 89 BB 80 80 80
.byte $80, $97, $80, $80, $80, $80, $87, $87, $BB, $BB, $BB, $BB, $80, $88, $8A, $BB ; CPU:$FB6B PRG:3B6B 80 97 80 80 80 80 87 87 BB BB BB BB 80 88 8A BB
.byte $BB, $80, $80, $89, $BB, $BB, $80, $80, $80, $87, $BB, $80, $80, $80, $80, $87 ; CPU:$FB7B PRG:3B7B BB 80 80 89 BB BB 80 80 80 87 BB 80 80 80 80 87
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $A1, $8A, $BB, $BB, $BB, $80 ; CPU:$FB8B PRG:3B8B BB BB BB BB BB BB BB BB BB BB A1 8A BB BB BB 80
.byte $88, $A1, $9F, $BB, $80, $80, $80, $80, $87, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FB9B PRG:3B9B 88 A1 9F BB 80 80 80 80 87 BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $A0, $A2, $88 ; CPU:$FBAB PRG:3BAB BB BB BB BB BB BB BB BB BB BB BB BB BB A0 A2 88
.byte $A1, $9F, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FBBB PRG:3BBB A1 9F BB BB BB BB BB BB BB BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $B1, $B1, $B1, $B1, $B1, $80, $80, $80, $80, $91 ; CPU:$FBCB PRG:3BCB BB BB BB BB BB BB B1 B1 B1 B1 B1 80 80 80 80 91
.byte $80, $80, $80, $80, $99, $80, $80, $80, $80, $88, $80, $80, $80, $80, $80, $80 ; CPU:$FBDB PRG:3BDB 80 80 80 80 99 80 80 80 80 88 80 80 80 80 80 80
.byte $80, $80, $80, $80, $BA, $BA, $B0, $B0, $BA, $B2, $B2, $B2, $B2, $BA, $BC, $BC ; CPU:$FBEB PRG:3BEB 80 80 80 80 BA BA B0 B0 BA B2 B2 B2 B2 BA BC BC
.byte $BD, $BB, $A7, $BC, $BD, $B6, $B7, $BA, $B6, $B7, $BA, $BA, $BA, $88, $BB, $BB ; CPU:$FBFB PRG:3BFB BD BB A7 BC BD B6 B7 BA B6 B7 BA BA BA 88 BB BB
.byte $BB, $BB, $80, $87, $86, $88, $BB, $80, $80, $80, $80, $88, $80, $80, $80, $80 ; CPU:$FC0B PRG:3C0B BB BB 80 87 86 88 BB 80 80 80 80 88 80 80 80 80
.byte $80, $80, $80, $80, $80, $80, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FC1B PRG:3C1B 80 80 80 80 80 80 BB BB BB BB BB BB BB BB BB BB
.byte $A1, $85, $A2, $88, $A0, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $BB ; CPU:$FC2B PRG:3C2B A1 85 A2 88 A0 80 80 80 80 80 80 80 80 80 80 BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $A0, $BB, $9F ; CPU:$FC3B PRG:3C3B BB BB BB BB BB BB BB BB BB BB BB BB BB A0 BB 9F
.byte $83, $85, $80, $85, $80, $80, $80, $80, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FC4B PRG:3C4B 83 85 80 85 80 80 80 80 BB BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $A0, $BB, $BB, $83, $85, $80, $BB, $BB, $95, $80 ; CPU:$FC5B PRG:3C5B BB BB BB BB BB BB A0 BB BB 83 85 80 BB BB 95 80
.byte $80, $C9, $C0, $C0, $C0, $C1, $C2, $C0, $CD, $C7, $C4, $BB, $C0, $CD, $C4, $C4 ; CPU:$FC6B PRG:3C6B 80 C9 C0 C0 C0 C1 C2 C0 CD C7 C4 BB C0 CD C4 C4
.byte $C9, $C0, $C8, $C3, $C4, $C2, $C5, $C5, $C5, $C3, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FC7B PRG:3C7B C9 C0 C8 C3 C4 C2 C5 C5 C5 C3 BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $D6, $A6 ; CPU:$FC8B PRG:3C8B BB BB BB BB BB BB BB BB BB BB BB BB BB BB D6 A6
.byte $B1, $B1, $B1, $88, $9F, $A0, $A1, $85, $80, $80, $80, $80, $80, $80, $80, $80 ; CPU:$FC9B PRG:3C9B B1 B1 B1 88 9F A0 A1 85 80 80 80 80 80 80 80 80
.byte $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $BB, $BB, $BB, $83 ; CPU:$FCAB PRG:3CAB 80 80 80 80 80 80 80 80 80 80 80 80 BB BB BB 83
.byte $85, $BB, $A0, $85, $80, $80, $85, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; CPU:$FCBB PRG:3CBB 85 BB A0 85 80 80 85 80 80 80 80 80 80 80 80 80
.byte $80, $80, $80, $80, $80, $BB, $BB, $BB, $83, $85, $BB, $BB, $BB, $84, $80, $BB ; CPU:$FCCB PRG:3CCB 80 80 80 80 80 BB BB BB 83 85 BB BB BB 84 80 BB
.byte $BB, $85, $80, $80, $BB, $84, $80, $80, $80, $86, $80, $80, $80, $80, $BA, $BA ; CPU:$FCDB PRG:3CDB BB 85 80 80 BB 84 80 80 80 86 80 80 80 80 BA BA
.byte $BA, $B8, $B9, $BA, $B8, $B9, $E2, $E1, $A8, $BB, $BB, $E0, $BB, $A8, $BB, $BB ; CPU:$FCEB PRG:3CEB BA B8 B9 BA B8 B9 E2 E1 A8 BB BB E0 BB A8 BB BB
.byte $E0, $BB, $AE, $BB, $BB, $E0, $BB, $BB, $BB, $BB, $BB, $96, $BB, $BB, $BB, $BB ; CPU:$FCFB PRG:3CFB E0 BB AE BB BB E0 BB BB BB BB BB 96 BB BB BB BB
.byte $95, $BB, $BB, $BB, $BB, $94, $BB, $BB, $BB, $BB, $84, $BB, $BB, $BB, $BB, $8C ; CPU:$FD0B PRG:3D0B 95 BB BB BB BB 94 BB BB BB BB 84 BB BB BB BB 8C
.byte $BB, $BB, $BB, $E0, $BB, $BB, $BB, $BB, $E4, $E1, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FD1B PRG:3D1B BB BB BB E0 BB BB BB BB E4 E1 BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $F3, $F3, $F3, $F3, $80, $BB, $BB ; CPU:$FD2B PRG:3D2B BB BB BB BB BB BB BB BB BB F3 F3 F3 F3 80 BB BB
.byte $BB, $BB, $F0, $BB, $BB, $BB, $BB, $F0, $BB, $BB, $BB, $BB, $F0, $BB, $BB, $FD ; CPU:$FD3B PRG:3D3B BB BB F0 BB BB BB BB F0 BB BB BB BB F0 BB BB FD
.byte $F4, $80, $BB, $BB, $84, $80, $80, $BB, $86, $80, $80, $80, $85, $80, $80, $80 ; CPU:$FD4B PRG:3D4B F4 80 BB BB 84 80 80 BB 86 80 80 80 85 80 80 80
.byte $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $BA, $BA, $B0, $B0, $BA ; CPU:$FD5B PRG:3D5B 80 80 80 80 80 80 80 80 80 80 80 BA BA B0 B0 BA
.byte $B2, $B2, $B2, $B2, $B2, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FD6B PRG:3D6B B2 B2 B2 B2 B2 BB BB BB BB BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $EF, $BB, $EF, $BB, $EF, $F2, $F2 ; CPU:$FD7B PRG:3D7B BB BB BB BB BB BB BB BB BB EF BB EF BB EF F2 F2
.byte $F2, $F2, $F2, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $BB, $BB, $8B ; CPU:$FD8B PRG:3D8B F2 F2 F2 80 80 80 80 80 80 80 80 80 80 BB BB 8B
.byte $8D, $80, $BB, $BB, $BB, $95, $80, $BB, $BB, $BB, $94, $80, $BB, $BB, $BB, $96 ; CPU:$FD9B PRG:3D9B 8D 80 BB BB BB 95 80 BB BB BB 94 80 BB BB BB 96
.byte $80, $BB, $BB, $BB, $BB, $8E, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $B6 ; CPU:$FDAB PRG:3DAB 80 BB BB BB BB 8E BB BB BB BB BB BB BB BB BB B6
.byte $BB, $BB, $B6, $B7, $BA, $B6, $B7, $BA, $B4, $BA, $BA, $BA, $BA, $BA, $BA, $D6 ; CPU:$FDBB PRG:3DBB BB BB B6 B7 BA B6 B7 BA B4 BA BA BA BA BA BA D6
.byte $BB, $A7, $AF, $AF, $D6, $A6, $B2, $B2, $B2, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FDCB PRG:3DCB BB A7 AF AF D6 A6 B2 B2 B2 BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $93, $80, $80, $80, $80, $8E, $80, $80 ; CPU:$FDDB PRG:3DDB BB BB BB BB BB BB BB BB 93 80 80 80 80 8E 80 80
.byte $80, $80, $85, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; CPU:$FDEB PRG:3DEB 80 80 85 80 80 80 80 80 80 80 80 80 80 80 80 80
.byte $80, $8C, $80, $80, $80, $80, $95, $80, $80, $80, $80, $94, $80, $80, $80, $80 ; CPU:$FDFB PRG:3DFB 80 8C 80 80 80 80 95 80 80 80 80 94 80 80 80 80
.byte $95, $80, $80, $80, $80, $84, $80, $80, $80, $80, $8C, $80, $80, $80, $80, $BB ; CPU:$FE0B PRG:3E0B 95 80 80 80 80 84 80 80 80 80 8C 80 80 80 80 BB
.byte $8E, $80, $80, $80, $BB, $95, $80, $80, $80, $BB, $8B, $93, $80, $80, $BB, $BB ; CPU:$FE1B PRG:3E1B 8E 80 80 80 BB 95 80 80 80 BB 8B 93 80 80 BB BB
.byte $94, $80, $80, $8E, $80, $80, $80, $80, $BB, $8D, $80, $80, $80, $BB, $BB, $8C ; CPU:$FE2B PRG:3E2B 94 80 80 8E 80 80 80 80 BB 8D 80 80 80 BB BB 8C
.byte $80, $80, $BB, $BB, $8B, $8D, $80, $BB, $BB, $BB, $96, $9B, $8E, $80, $80, $80 ; CPU:$FE3B PRG:3E3B 80 80 BB BB 8B 8D 80 BB BB BB 96 9B 8E 80 80 80
.byte $80, $BB, $9E, $8D, $80, $80, $BB, $BB, $BB, $8B, $9D, $BB, $BB, $BB, $BB, $BB ; CPU:$FE4B PRG:3E4B 80 BB 9E 8D 80 80 BB BB BB 8B 9D BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $8D, $90, $9E, $9D, $9C, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FE5B PRG:3E5B BB BB BB BB BB 8D 90 9E 9D 9C BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BC, $BC ; CPU:$FE6B PRG:3E6B BB BB BB BB BB BB BB BB BB BB BB BB BB BB BC BC
.byte $C0, $C0, $C1, $BC, $BC, $C0, $CD, $C4, $BB, $C6, $C0, $CD, $C4, $C6, $C8, $C5 ; CPU:$FE7B PRG:3E7B C0 C0 C1 BC BC C0 CD C4 BB C6 C0 CD C4 C6 C8 C5
.byte $C3, $C4, $C2, $C5, $C5, $C5, $C3, $F3, $F3, $F3, $F3, $F6, $FB, $EF, $BB, $EF ; CPU:$FE8B PRG:3E8B C3 C4 C2 C5 C5 C5 C3 F3 F3 F3 F3 F6 FB EF BB EF
.byte $BB, $F2, $F2, $F2, $F2, $F2, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; CPU:$FE9B PRG:3E9B BB F2 F2 F2 F2 F2 80 80 80 80 80 80 80 80 80 80
.byte $BB, $BB, $BB, $BB, $BB, $BB, $D0, $D1, $FB, $BB, $BB, $D2, $D3, $FB, $BB, $BB ; CPU:$FEAB PRG:3EAB BB BB BB BB BB BB D0 D1 FB BB BB D2 D3 FB BB BB
.byte $FC, $FC, $BB, $D6, $B1, $B1, $B1, $A5, $D6, $80, $80, $80, $80, $80, $80, $80 ; CPU:$FEBB PRG:3EBB FC FC BB D6 B1 B1 B1 A5 D6 80 80 80 80 80 80 80
.byte $80, $80, $80, $8D, $80, $80, $80, $80, $BB, $8E, $9B, $80, $80, $BB, $BB, $BB ; CPU:$FECB PRG:3ECB 80 80 80 8D 80 80 80 80 BB 8E 9B 80 80 BB BB BB
.byte $9E, $8D, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $8D, $90, $9E, $9D ; CPU:$FEDB PRG:3EDB 9E 8D 80 80 80 80 80 80 80 80 80 80 8D 90 9E 9D
.byte $9C, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $80, $80, $80, $90, $9D ; CPU:$FEEB PRG:3EEB 9C BB BB BB BB BB BB BB BB BB BB 80 80 80 90 9D
.byte $90, $9C, $9E, $BB, $BB, $92, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FEFB PRG:3EFB 90 9C 9E BB BB 92 BB BB BB BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $AF, $AF, $A8, $BB, $D6, $B2, $B2, $B2, $A5, $D6, $BB, $BB ; CPU:$FF0B PRG:3F0B BB BB BB BB AF AF A8 BB D6 B2 B2 B2 A5 D6 BB BB
.byte $BB, $BB, $D6, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BA, $BA, $B0 ; CPU:$FF1B PRG:3F1B BB BB D6 BB BB BB BB BB BB BB BB BB BB BA BA B0
.byte $B0, $A7, $BA, $BA, $BA, $BA, $B2, $BA, $BA, $BA, $A8, $BB, $BA, $BA, $B8, $B9 ; CPU:$FF2B PRG:3F2B B0 A7 BA BA BA BA B2 BA BA BA A8 BB BA BA B8 B9
.byte $BB, $B8, $B9, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FF3B PRG:3F3B BB B8 B9 BB BB BB BB BB BB BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FF4B PRG:3F4B BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $E1, $E1, $E1, $E1, $E1, $BB, $EF, $EF, $BB, $BB, $EF, $EF ; CPU:$FF5B PRG:3F5B BB BB BB BB E1 E1 E1 E1 E1 BB EF EF BB BB EF EF
.byte $EF, $EF, $BB, $BB, $EF, $EF, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $E1, $E1, $E1 ; CPU:$FF6B PRG:3F6B EF EF BB BB EF EF BB BB BB BB BB BB BB E1 E1 E1
.byte $E9, $E1, $BB, $BB, $BB, $E0, $BB, $BB, $BB, $BB, $E0, $BB, $BB, $BB, $BB, $E0 ; CPU:$FF7B PRG:3F7B E9 E1 BB BB BB E0 BB BB BB BB E0 BB BB BB BB E0
.byte $BB, $BB, $BB, $BB, $E0, $BB, $E1, $E1, $E1, $EA, $E1, $DF, $C0, $BE, $E0, $BB ; CPU:$FF8B PRG:3F8B BB BB BB BB E0 BB E1 E1 E1 EA E1 DF C0 BE E0 BB
.byte $C0, $CA, $D5, $E0, $BB, $BF, $D5, $CF, $E0, $BB, $BB, $BB, $BB, $E0, $BB, $E1 ; CPU:$FF9B PRG:3F9B C0 CA D5 E0 BB BF D5 CF E0 BB BB BB BB E0 BB E1
.byte $E1, $E1, $E8, $E1, $BB, $FE, $FB, $FE, $FB, $BB, $BB, $BB, $BB, $BB, $BB, $BB ; CPU:$FFAB PRG:3FAB E1 E1 E8 E1 BB FE FB FE FB BB BB BB BB BB BB BB
.byte $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $BB, $E2, $E1, $BB, $BB, $BB ; CPU:$FFBB PRG:3FBB BB BB BB BB BB BB BB BB BB BB BB E2 E1 BB BB BB
.byte $E0, $BB, $BB, $BB, $BB, $E0, $BB, $BB, $BB, $BB, $E0, $BB, $BB, $BB, $BB, $BB ; CPU:$FFCB PRG:3FCB E0 BB BB BB BB E0 BB BB BB BB E0 BB BB BB BB BB
.byte $BB, $E1, $E1, $E1, $E3, $BB, $BB, $BB, $BB, $E0, $BB, $BB, $BB, $BB, $E0, $BB ; CPU:$FFDB PRG:3FDB BB E1 E1 E1 E3 BB BB BB BB E0 BB BB BB BB E0 BB
.byte $BB, $BB, $BB, $E0, $BB, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $4C ; CPU:$FFEB PRG:3FEB BB BB BB E0 BB FF FF FF FF FF FF FF FF FF FF 4C
.byte $C0, $00, $C0, $C0, $C2 ; CPU:$FFFB PRG:3FFB C0 00 C0 C0 C2