; CIRCUS 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=$C05A RESET=$C000 IRQ=$4CB7 ; PRG mapped at $C000-$FFFF (NROM, mirrored to the upper half) ; ; Pass 1 trace provenance (the audit trail behind every classification below): ; 29 further routine entries recovered from table references elsewhere in the image: ; $C0E4, $C108, $C25D, $C303, $C389, $C5C3, $CE6D, $EAC4, $ED42, $ED66, $EDE7, $EEC2, $EED0, $EED9, $F078, $F188, $F2DB, $F3B0, $F3C3, $F3D4, $F408, $F42E, $F540, $F571, $F588, $F5C6, $F601, $F649, $F7E4 ; entries seeded by hand after inspecting code-shaped but unreferenced blocks: ; $C000, $C01F, $C05A, $C0B8, $C0C3, $C0C5, $C0CB, $C0D0, $C0F9, $C107, $C1B7, $C1D5, $C1EA, $C250, $C2A5, $C2EB, $C342, $C3AA, $C3B8, $C3BE, $C3D6, $C3E0, $C3F5, $C402, $C444, $C454, $C488, $C4AA, $C4BA, $C4C8, $C4CD, $C4E3, $C505, $C53F, $C556, $C56F, $C58F, $C5B2, $C5CB, $C5EC, $C606, $C61D, $C62D, $C637, $C63A, $C643, $C662, $C677, $C67B, $C6A8, $C6C4, $C6D3, $C6F7, $C70D, $C720, $C73A, $C752, $C753, $C81A, $C835, $C889, $C897, $C8B5, $C8E2, $C8FC, $C925, $C991, $C9BD, $C9CE, $C9DD, $C9EC, $C9F2, $CA04, $CA25, $CA31, $CA3B, $CA4B, $CA5C, $CA63, $CAB1, $CAC1, $CB2D, $CB4B, $CB57, $CB7B, $CB88, $CBDA, $CC62, $CC7E, $CC8F, $CC94, $CCB6, $CCD0, $CCD9, $CD28, $CD2D, $CD61, $CD68, $CD80, $CDE7, $CEB7, $CEE3, $CF0D, $CF30, $CF49, $CF58, $CF88, $CF9D, $CFB3, $CFCE, $CFDE, $D078, $D090, $D0AD, $D102, $D10C, $D117, $D141, $D142, $D280, $D291, $D2C9, $D2FD, $D31E, $D342, $D389, $D3F3, $D436, $D453, $D491, $D4C4, $D4CE, $D4F3, $D53C, $D544, $D575, $D597, $D5F1, $D624, $D657, $D714, $D807, $D814, $D820, $D885, $DA05, $DA0F, $DA11, $DA19, $DA20, $DA3E, $DAAE, $DAE4, $DBB6, $DC1B, $DC38, $DCAB, $DCC0, $E484, $E4B3, $E52D, $E562, $E578, $E59A, $E5AC, $E5B0, $E618, $E61D, $E64C, $E661, $E685, $E693, $E6B0, $E6C9, $E6D8, $E79F, $E7BA, $E7EB, $E7FE, $E82B, $E838, $E88F, $E8CD, $E8FE, $E903, $E918, $E91F, $E969, $E97E, $E992, $E9B3, $E9BC, $F7E9, $F80D, $F835, $F87C, $F8C8, $F8EF, $F9D1, $FA12, $FA80, $FAA9 ; $C0D7-$C0E2 forced back to data: the only path into it is a branch that is always taken ; $C1CC-$C1D1 forced back to data: the only path into it is a branch that is always taken ; $C1D8-$C1E3 forced back to data: the only path into it is a branch that is always taken ; $C4A6-$C4A6 forced back to data: the only path into it is a branch that is always taken ; $C5A6-$C5AE forced back to data: the only path into it is a branch that is always taken ; $C65A-$C661 forced back to data: the only path into it is a branch that is always taken ; $C76E-$C78B forced back to data: the only path into it is a branch that is always taken ; $C792-$C801 forced back to data: the only path into it is a branch that is always taken ; $C928-$C929 forced back to data: the only path into it is a branch that is always taken ; $C932-$C942 forced back to data: the only path into it is a branch that is always taken ; $C9D3-$C9D4 forced back to data: the only path into it is a branch that is always taken ; $C9E7-$C9E7 forced back to data: the only path into it is a branch that is always taken ; $CA47-$CA4A forced back to data: the only path into it is a branch that is always taken ; $CBBC-$CBC5 forced back to data: the only path into it is a branch that is always taken ; $CCE6-$CD27 forced back to data: the only path into it is a branch that is always taken ; $CF3F-$CF40 forced back to data: the only path into it is a branch that is always taken ; $CFB7-$CFCD forced back to data: the only path into it is a branch that is always taken ; $CFDA-$CFDD forced back to data: the only path into it is a branch that is always taken ; $D158-$D159 forced back to data: the only path into it is a branch that is always taken ; $D170-$D177 forced back to data: the only path into it is a branch that is always taken ; $D18C-$D195 forced back to data: the only path into it is a branch that is always taken ; $D19C-$D19D forced back to data: the only path into it is a branch that is always taken ; $D32E-$D331 forced back to data: the only path into it is a branch that is always taken ; $D3AA-$D3C7 forced back to data: the only path into it is a branch that is always taken ; $D4C7-$D4C7 forced back to data: the only path into it is a branch that is always taken ; $D63B-$D64E forced back to data: the only path into it is a branch that is always taken ; $D670-$D713 forced back to data: the only path into it is a branch that is always taken ; $D724-$D73D forced back to data: the only path into it is a branch that is always taken ; $D80C-$D80D forced back to data: the only path into it is a branch that is always taken ; $DBAA-$DBAB forced back to data: the only path into it is a branch that is always taken ; $DC49-$DC49 forced back to data: the only path into it is a branch that is always taken ; $DD03-$DD15 forced back to data: the only path into it is a branch that is always taken ; $DDAE-$DE51 forced back to data: the only path into it is a branch that is always taken ; $DF5B-$DF73 forced back to data: the only path into it is a branch that is always taken ; $DF8D-$DFD1 forced back to data: the only path into it is a branch that is always taken ; $E3C4-$E41F forced back to data: the only path into it is a branch that is always taken ; $E428-$E43E forced back to data: the only path into it is a branch that is always taken ; $E459-$E483 forced back to data: the only path into it is a branch that is always taken ; $E6A0-$E6AF forced back to data: the only path into it is a branch that is always taken ; $E6DF-$E6E0 forced back to data: the only path into it is a branch that is always taken ; $E7E5-$E7E8 forced back to data: the only path into it is a branch that is always taken ; $E96E-$E975 forced back to data: the only path into it is a branch that is always taken ; $E97A-$E97D forced back to data: the only path into it is a branch that is always taken ; $E9B6-$E9BB forced back to data: the only path into it is a branch that is always taken ; $F878-$F87B forced back to data: the only path into it is a branch that is always taken ; $FABB-$FAD6 forced back to data: the only path into it is a branch that is always taken ; $FAE3-$FAF0 forced back to data: the only path into it is a branch that is always taken ; $FAF9-$FAFC forced back to data: the only path into it is a branch that is always taken ; $FB37-$FB4B forced back to data: the only path into it is a branch that is always taken ; $FBD1-$FC01 forced back to data: the only path into it is a branch that is always taken ; $FC08-$FC1C forced back to data: the only path into it is a branch that is always taken ; $FC23-$FC49 forced back to data: the only path into it is a branch that is always taken ; $FC86-$FC9F forced back to data: the only path into it is a branch that is always taken ; $FCB1-$FD5B forced back to data: the only path into it is a branch that is always taken ; $FD95-$FDA4 forced back to data: the only path into it is a branch that is always taken ; $FFC2-$FFC9 forced back to data: the only path into it is a branch that is always taken ; $FFD0-$FFE5 forced back to data: the only path into it is a branch that is always taken ; $FFF6-$FFFB forced back to data: the only path into it is a branch that is always taken ; indirect dispatch through zero page (not followed statically): ; jmp ($00E0) at $C4E0 ; .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 reads no RAM 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 decimal flag; disables ; interrupts. ; 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, D and I flags, the OAM shadow and the RAM ; fields it writes. ; ;=============================================================================== Reset: cld ; CPU:$C000 PRG:0000 D8 sei ; CPU:$C001 PRG:0001 78 ;=============================================================================== ; Routine: Reset_OnNonnegative ; Global: The routine reads the PPUSTATUS register. ; Local: Executes 2 instructions: loads A from the PPUSTATUS register; ; branches on non-negative to Reset_OnNonnegative. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_OnNonnegative: lda PPUSTATUS ; CPU:$C002 PRG:0002 AD 02 20 bpl Reset_OnNonnegative ; CPU:$C005 PRG:0005 10 FB ;=============================================================================== ; Routine: Reset_OnNonnegative_2 ; Global: The routine calls InitPpuForPowerOn, reads the PPUSTATUS register. ; Local: Executes 6 instructions: loads A from the PPUSTATUS register; ; branches on non-negative to Reset_OnNonnegative_2; calls InitPpuForPowerOn; loads X with ; $FF; 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: 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 OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_OnNonnegative_2: lda PPUSTATUS ; CPU:$C007 PRG:0007 AD 02 20 bpl Reset_OnNonnegative_2 ; CPU:$C00A PRG:000A 10 FB jsr InitPpuForPowerOn ; CPU:$C00C PRG:000C 20 B8 C0 ldx #$FF ; CPU:$C00F PRG:000F A2 FF txs ; CPU:$C011 PRG:0011 9A ldx #$10 ; CPU:$C012 PRG:0012 A2 10 ;=============================================================================== ; Routine: Reset_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: copies X into A; compares A with $07EF,x; ; branches on not equal to Reset_Loop; decrements X; branches on not ; equal to Reset_OnNonzero; branches on equal to Reset_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_OnNonzero: txa ; CPU:$C014 PRG:0014 8A cmp $07EF,x ; CPU:$C015 PRG:0015 DD EF 07 bne Reset_Loop ; CPU:$C018 PRG:0018 D0 05 dex ; CPU:$C01A PRG:001A CA bne Reset_OnNonzero ; CPU:$C01B PRG:001B D0 F7 beq Reset_Loop_2 ; CPU:$C01D PRG:001D F0 0E ;=============================================================================== ; Routine: Reset_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 with $57; 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 and Z flags, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_Loop: ldy #$57 ; CPU:$C01F PRG:001F A0 57 lda #$00 ; CPU:$C021 PRG:0021 A9 00 ;=============================================================================== ; Routine: Reset_OnNonzero_2 ; Global: The routine reads no RAM 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,y; increments Y; branches ; on not equal to Reset_OnNonzero_2; loads A with $02; stores A to Zp59. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_OnNonzero_2: sta a:Zp00,y ; CPU:$C023 PRG:0023 99 00 00 iny ; CPU:$C026 PRG:0026 C8 bne Reset_OnNonzero_2 ; CPU:$C027 PRG:0027 D0 FA lda #$02 ; CPU:$C029 PRG:0029 A9 02 sta Zp59 ; CPU:$C02B PRG:002B 85 59 ;=============================================================================== ; Routine: Reset_Loop_2 ; Global: The routine reads no RAM 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 $EF; loads A with $07; stores A ; to ZpE1; loads A with $00; stores A to ZpE0. ; 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, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_Loop_2: ldy #$EF ; CPU:$C02D PRG:002D A0 EF lda #$07 ; CPU:$C02F PRG:002F A9 07 sta ZpE1 ; CPU:$C031 PRG:0031 85 E1 lda #$00 ; CPU:$C033 PRG:0033 A9 00 sta ZpE0 ; CPU:$C035 PRG:0035 85 E0 ;=============================================================================== ; Routine: Reset_OnNonzero_3 ; Global: The routine reads no RAM 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 ((ZpE0),y); decrements Y; ; branches on not equal to Reset_OnNonzero_3; decrements ZpE1; branches on ; negative to Reset_Loop_3; branches on not equal to Reset_OnNonzero_3; 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 and Z flags, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_OnNonzero_3: sta (ZpE0),y ; CPU:$C037 PRG:0037 91 E0 dey ; CPU:$C039 PRG:0039 88 bne Reset_OnNonzero_3 ; CPU:$C03A PRG:003A D0 FB dec ZpE1 ; CPU:$C03C PRG:003C C6 E1 bmi Reset_Loop_3 ; CPU:$C03E PRG:003E 30 06 bne Reset_OnNonzero_3 ; CPU:$C040 PRG:0040 D0 F5 ldy #$56 ; CPU:$C042 PRG:0042 A0 56 bne Reset_OnNonzero_3 ; CPU:$C044 PRG:0044 D0 F1 ;=============================================================================== ; Routine: Reset_Loop_3 ; Global: The routine writes $0700. ; Local: Executes 3 instructions: stores A to Zp00; stores A to $0700; 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. Leaves $0700 changed. ; Clobbers: ; A, X and Y, the N and Z flags, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_Loop_3: sta Zp00 ; CPU:$C046 PRG:0046 85 00 sta $0700 ; CPU:$C048 PRG:0048 8D 00 07 ldx #$10 ; CPU:$C04B PRG:004B A2 10 ;=============================================================================== ; Routine: Reset_OnNonzero_4 ; Global: The routine calls InitGameHardware. ; Local: Executes 5 instructions: copies X into A; stores A to $07EF,x; ; decrements X; branches on not equal to Reset_OnNonzero_4; calls InitGameHardware. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== Reset_OnNonzero_4: txa ; CPU:$C04D PRG:004D 8A sta $07EF,x ; CPU:$C04E PRG:004E 9D EF 07 dex ; CPU:$C051 PRG:0051 CA bne Reset_OnNonzero_4 ; CPU:$C052 PRG:0052 D0 F9 jsr InitGameHardware ; CPU:$C054 PRG:0054 20 B8 C3 ;=============================================================================== ; Routine: WaitForInterruptLoop ; Global: The routine calls WaitForInterruptLoop. ; Local: Executes 1 instruction: calls WaitForInterruptLoop. ; 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. ; ;=============================================================================== WaitForInterruptLoop: jmp WaitForInterruptLoop ; CPU:$C057 PRG:0057 4C 57 C0 ;=============================================================================== ; Routine: NmiHandler ; Global: The routine calls InitPpuForPowerOn and RunMainStateHandler, writes the OAMADDR and ; OAMDMA registers, reads the PPUSTATUS register. ; Local: Executes 20 instructions: pushes A; copies X into A; pushes A; copies ; Y into A; pushes A; loads A from the PPUSTATUS register; 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. 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:$C05A PRG:005A 48 txa ; CPU:$C05B PRG:005B 8A pha ; CPU:$C05C PRG:005C 48 tya ; CPU:$C05D PRG:005D 98 pha ; CPU:$C05E PRG:005E 48 lda PPUSTATUS ; CPU:$C05F PRG:005F AD 02 20 lda Zp04 ; CPU:$C062 PRG:0062 A5 04 bne NmiHandler_Loop_3 ; CPU:$C064 PRG:0064 D0 23 lda #$00 ; CPU:$C066 PRG:0066 A9 00 sta OAMADDR ; CPU:$C068 PRG:0068 8D 03 20 lda #$02 ; CPU:$C06B PRG:006B A9 02 sta OAMDMA ; CPU:$C06D PRG:006D 8D 14 40 inc Zp04 ; CPU:$C070 PRG:0070 E6 04 jsr InitPpuForPowerOn ; CPU:$C072 PRG:0072 20 B8 C0 jsr RunMainStateHandler ; CPU:$C075 PRG:0075 20 B7 C1 lda ZpFB ; CPU:$C078 PRG:0078 A5 FB beq NmiHandler_Loop ; CPU:$C07A PRG:007A F0 06 dec ZpFB ; CPU:$C07C PRG:007C C6 FB lda #$00 ; CPU:$C07E PRG:007E A9 00 beq NmiHandler_Loop_2 ; CPU:$C080 PRG:0080 F0 02 ;=============================================================================== ; Routine: NmiHandler_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 from Zp54. ; 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. ; ;=============================================================================== NmiHandler_Loop: lda Zp54 ; CPU:$C082 PRG:0082 A5 54 ;=============================================================================== ; Routine: NmiHandler_Loop_2 ; Global: The routine writes the PPUMASK register. ; Local: Executes 2 instructions: stores A to the PPUMASK register; decrements ; Zp04. ; 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 PPUMASK register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== NmiHandler_Loop_2: sta PPUMASK ; CPU:$C084 PRG:0084 8D 01 20 dec Zp04 ; CPU:$C087 PRG:0087 C6 04 ;=============================================================================== ; Routine: NmiHandler_Loop_3 ; Global: The routine calls WritePpuCtrlMasked, SetActorSpriteIndex16 and MaskPpuCtrlBits, writes the ; PPUSCROLL registers, reads the PPUSTATUS register. ; Local: Executes 11 instructions: loads A from the PPUSTATUS register; loads ; A with $00; stores A to the PPUSCROLL register; stores A to the ; PPUSCROLL register; loads A with $7E; calls WritePpuCtrlMasked; 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 PPUSCROLL registers set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== NmiHandler_Loop_3: lda PPUSTATUS ; CPU:$C089 PRG:0089 AD 02 20 lda #$00 ; CPU:$C08C PRG:008C A9 00 sta PPUSCROLL ; CPU:$C08E PRG:008E 8D 05 20 sta PPUSCROLL ; CPU:$C091 PRG:0091 8D 05 20 lda #$7E ; CPU:$C094 PRG:0094 A9 7E jsr WritePpuCtrlMasked ; CPU:$C096 PRG:0096 20 C5 C0 jsr SetActorSpriteIndex16 ; CPU:$C099 PRG:0099 20 7C F8 lda Zp04 ; CPU:$C09C PRG:009C A5 04 beq NmiHandler_Loop_4 ; CPU:$C09E PRG:009E F0 05 jsr MaskPpuCtrlBits ; CPU:$C0A0 PRG:00A0 20 C3 C0 bne NmiHandler_Loop_5 ; CPU:$C0A3 PRG:00A3 D0 0D ;=============================================================================== ; Routine: NmiHandler_Loop_4 ; Global: The routine calls ReadControllerButtons, MaskPpuCtrlBits and AdvanceMainState. ; Local: Executes 5 instructions: increments Zp04; calls ReadControllerButtons; calls ; MaskPpuCtrlBits; calls AdvanceMainState; decrements Zp04. ; 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. ; ;=============================================================================== NmiHandler_Loop_4: inc Zp04 ; CPU:$C0A5 PRG:00A5 E6 04 jsr ReadControllerButtons ; CPU:$C0A7 PRG:00A7 20 02 C4 jsr MaskPpuCtrlBits ; CPU:$C0AA PRG:00AA 20 C3 C0 jsr AdvanceMainState ; CPU:$C0AD PRG:00AD 20 D0 C0 dec Zp04 ; CPU:$C0B0 PRG:00B0 C6 04 ;=============================================================================== ; Routine: NmiHandler_Loop_5 ; 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 6 instructions: pulls A; copies A into Y; pulls A; copies A ; into X; pulls A; 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: ; A, X and Y. ; ;=============================================================================== NmiHandler_Loop_5: pla ; CPU:$C0B2 PRG:00B2 68 tay ; CPU:$C0B3 PRG:00B3 A8 pla ; CPU:$C0B4 PRG:00B4 68 tax ; CPU:$C0B5 PRG:00B5 AA pla ; CPU:$C0B6 PRG:00B6 68 rti ; CPU:$C0B7 PRG:00B7 40 ;=============================================================================== ; Routine: InitPpuForPowerOn ; Global: The routine writes the PPUCTRL and PPUMASK registers. ; Local: Executes 5 instructions: loads A with $08; stores A to the PPUCTRL ; register; loads A with $00; 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 PPUCTRL and PPUMASK registers set. ; Clobbers: ; A, the N and Z flags, PPUCTRL, PPUMASK. ; ;=============================================================================== InitPpuForPowerOn: lda #$08 ; CPU:$C0B8 PRG:00B8 A9 08 sta PPUCTRL ; CPU:$C0BA PRG:00BA 8D 00 20 lda #$00 ; CPU:$C0BD PRG:00BD A9 00 sta PPUMASK ; CPU:$C0BF PRG:00BF 8D 01 20 rts ; CPU:$C0C2 PRG:00C2 60 ;=============================================================================== ; Routine: MaskPpuCtrlBits ; Global: The routine reads no RAM 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 $FE. ; 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, PPUCTRL. ; ;=============================================================================== MaskPpuCtrlBits: lda #$FE ; CPU:$C0C3 PRG:00C3 A9 FE ;=============================================================================== ; Routine: WritePpuCtrlMasked ; Global: The routine writes the PPUCTRL register. ; Local: Executes 3 instructions: ANDs A with Zp53; stores A to the PPUCTRL ; 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 PPUCTRL register set. ; Clobbers: ; no register, the N and Z flags, PPUCTRL. ; ;=============================================================================== WritePpuCtrlMasked: and Zp53 ; CPU:$C0C5 PRG:00C5 25 53 sta PPUCTRL ; CPU:$C0C7 PRG:00C7 8D 00 20 rts ; CPU:$C0CA PRG:00CA 60 ;=============================================================================== ; Routine: SetPpuMaskValue ; Global: The routine reads no RAM 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 $1E; stores A to Zp54; 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, Zp54. ; ;=============================================================================== SetPpuMaskValue: lda #$1E ; CPU:$C0CB PRG:00CB A9 1E sta Zp54 ; CPU:$C0CD PRG:00CD 85 54 rts ; CPU:$C0CF PRG:00CF 60 ;=============================================================================== ; Routine: AdvanceMainState ; Global: The routine calls DispatchHandlerPointerTable. ; Local: Executes 3 instructions: increments Zp09; loads A from Zp00; calls ; DispatchHandlerPointerTable. ; 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, Zp09, ZpE0, ZpE1. ; ;=============================================================================== AdvanceMainState: inc Zp09 ; CPU:$C0D0 PRG:00D0 E6 09 lda Zp00 ; CPU:$C0D2 PRG:00D2 A5 00 jsr DispatchHandlerPointerTable; CPU:$C0D4 PRG:00D4 20 CD C4 ; ---- data $C0D7-$C0E2 (12 bytes) ---- MainStateHandlerPointerTable: .byte $07, $C1, $07, $C1, $E9, $C0, $F9, $C0, $07, $C1, $1A, $C8 ; CPU:$C0D7 PRG:00D7 07 C1 07 C1 E9 C0 F9 C0 07 C1 1A C8 brk ; CPU:$C0E3 PRG:00E3 00 ;=============================================================================== ; Routine: StartScreenScriptZero ; Global: The routine reads no RAM 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 ((Zp07,x)); compares A with ; ((Zp08,x)); compares A with ((ZpA6,x)); ORs A with ((ZpF0,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: ; no register, the N, Z and C flags. ; ;=============================================================================== StartScreenScriptZero: cmp (Zp07,x) ; CPU:$C0E4 PRG:00E4 C1 07 cmp (Zp08,x) ; CPU:$C0E6 PRG:00E6 C1 08 cmp (ZpA6,x) ; CPU:$C0E8 PRG:00E8 C1 A6 ora (ZpF0,x) ; CPU:$C0EA PRG:00EA 01 F0 .byte $1A ; CPU:$C0EC PRG:00EC 1A -- nop (undocumented; ca65 cannot encode) jsr SelectActorSpriteCount ; CPU:$C0ED PRG:00ED 20 6D D7 lda Zp0A ; CPU:$C0F0 PRG:00F0 A5 0A beq StartScreenScriptOne_Loop ; CPU:$C0F2 PRG:00F2 F0 13 lda #$00 ; CPU:$C0F4 PRG:00F4 A9 00 jmp SetActorSlotAndClear ; CPU:$C0F6 PRG:00F6 4C 42 C3 ;=============================================================================== ; Routine: StartScreenScriptOne ; Global: The routine calls SetSoundScriptIndex. ; Local: Executes 3 instructions: loads A from Zp01; branches on not equal to ; StartScreenScriptOne_Loop; calls SetSoundScriptIndex. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp00, Zp64. ; ;=============================================================================== StartScreenScriptOne: lda Zp01 ; CPU:$C0F9 PRG:00F9 A5 01 bne StartScreenScriptOne_Loop ; CPU:$C0FB PRG:00FB D0 0A jmp SetSoundScriptIndex ; CPU:$C0FD PRG:00FD 4C 64 C5 ; ---- data $C100-$C106 (7 bytes) ---- .byte $A6, $01, $D0, $03, $4C, $63, $CA ; CPU:$C100 PRG:0100 A6 01 D0 03 4C 63 CA ;=============================================================================== ; Routine: StartScreenScriptOne_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: 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. ; ;=============================================================================== StartScreenScriptOne_Loop: rts ; CPU:$C107 PRG:0107 60 ;=============================================================================== ; Routine: UpdateActorRoundState ; Global: The routine calls ClearPpuCtrlBit1_OnNonzero, AdvanceActorCounter and AccumulateActorScore. ; Local: Executes 7 instructions: returns with RTS; calls ClearPpuCtrlBit1_OnNonzero; loads A ; from Zp63; compares A with $04; branches on not equal to UpdateActorRoundState_Loop; ; calls AdvanceActorCounter; 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 OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== UpdateActorRoundState: jsr ClearPpuCtrlBit1_OnNonzero ; CPU:$C108 PRG:0108 20 63 CA lda Zp63 ; CPU:$C10B PRG:010B A5 63 cmp #$04 ; CPU:$C10D PRG:010D C9 04 bne UpdateActorRoundState_Loop ; CPU:$C10F PRG:010F D0 06 jsr AdvanceActorCounter ; CPU:$C111 PRG:0111 20 AB D9 jsr AccumulateActorScore ; CPU:$C114 PRG:0114 20 B6 DB ;=============================================================================== ; Routine: UpdateActorRoundState_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 12 instructions: returns with RTS; loads X from Zp01; ; branches on equal to UpdateActorRoundState_Loop_3; decrements X; branches on equal to ; UpdateActorRoundState_Loop_4; decrements Zp02; 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, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== UpdateActorRoundState_Loop: ldx Zp01 ; CPU:$C117 PRG:0117 A6 01 beq UpdateActorRoundState_Loop_3 ; CPU:$C119 PRG:0119 F0 1D dex ; CPU:$C11B PRG:011B CA beq UpdateActorRoundState_Loop_4 ; CPU:$C11C PRG:011C F0 42 dec Zp02 ; CPU:$C11E PRG:011E C6 02 bne StartScreenScriptOne_Loop ; CPU:$C120 PRG:0120 D0 E5 ldx Zp63 ; CPU:$C122 PRG:0122 A6 63 inx ; CPU:$C124 PRG:0124 E8 cpx #$06 ; CPU:$C125 PRG:0125 E0 06 bne UpdateActorRoundState_Loop_2 ; CPU:$C127 PRG:0127 D0 02 ldx #$01 ; CPU:$C129 PRG:0129 A2 01 ;=============================================================================== ; Routine: UpdateActorRoundState_Loop_2 ; Global: The routine calls RunScreenScriptThree_Loop_2. ; Local: Executes 6 instructions: stores X to Zp63; increments Zp60; loads A ; with $00; stores A to ZpCC; stores A to Zp67; calls RunScreenScriptThree_Loop_2. ; 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. ; ;=============================================================================== UpdateActorRoundState_Loop_2: stx Zp63 ; CPU:$C12B PRG:012B 86 63 inc Zp60 ; CPU:$C12D PRG:012D E6 60 lda #$00 ; CPU:$C12F PRG:012F A9 00 sta ZpCC ; CPU:$C131 PRG:0131 85 CC sta Zp67 ; CPU:$C133 PRG:0133 85 67 jmp RunScreenScriptThree_Loop_2; CPU:$C135 PRG:0135 4C 40 C3 ;=============================================================================== ; Routine: UpdateActorRoundState_Loop_3 ; Global: The routine calls ComputeActorOffset and DrawActorTile. ; Local: Executes 10 instructions: calls ComputeActorOffset; calls DrawActorTile; loads X ; from Zp64; loads A from $C1B2,x; copies A into Y; loads X with $00; ; 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. ; ;=============================================================================== UpdateActorRoundState_Loop_3: jsr ComputeActorOffset ; CPU:$C138 PRG:0138 20 0D CF jsr DrawActorTile ; CPU:$C13B PRG:013B 20 49 CF ldx Zp64 ; CPU:$C13E PRG:013E A6 64 lda $C1B2,x ; CPU:$C140 PRG:0140 BD B2 C1 tay ; CPU:$C143 PRG:0143 A8 ldx #$00 ; CPU:$C144 PRG:0144 A2 00 lda Zp63 ; CPU:$C146 PRG:0146 A5 63 cmp #$03 ; CPU:$C148 PRG:0148 C9 03 beq UpdateActorRoundState_OnNonzero ; CPU:$C14A PRG:014A F0 02 ldx #$10 ; CPU:$C14C PRG:014C A2 10 ;=============================================================================== ; Routine: UpdateActorRoundState_OnNonzero ; Global: The routine calls NextActorSlot and ClearActorSprites. ; Local: Executes 9 instructions: loads A with $00; stores A to Zp80,x; calls ; NextActorSlot; decrements Y; branches on not equal to UpdateActorRoundState_OnNonzero; calls ; ClearActorSprites; 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 Y, the N, Z, C and V flags, Zp80, ZpCC, the OAM shadow, $0402. ; ;=============================================================================== UpdateActorRoundState_OnNonzero: lda #$00 ; CPU:$C14E PRG:014E A9 00 sta Zp80,x ; CPU:$C150 PRG:0150 95 80 jsr NextActorSlot ; CPU:$C152 PRG:0152 20 EC C9 dey ; CPU:$C155 PRG:0155 88 bne UpdateActorRoundState_OnNonzero ; CPU:$C156 PRG:0156 D0 F6 jsr ClearActorSprites ; CPU:$C158 PRG:0158 20 E4 D4 lda #$01 ; CPU:$C15B PRG:015B A9 01 sta ZpCC ; CPU:$C15D PRG:015D 85 CC rts ; CPU:$C15F PRG:015F 60 ;=============================================================================== ; Routine: UpdateActorRoundState_Loop_4 ; Global: The routine calls UpdateActorRow. ; Local: Executes 4 instructions: loads A from Zp09; shifts a right; branches ; on carry set to UpdateActorRoundState_Loop_5; calls UpdateActorRow. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== UpdateActorRoundState_Loop_4: lda Zp09 ; CPU:$C160 PRG:0160 A5 09 lsr a ; CPU:$C162 PRG:0162 4A bcs UpdateActorRoundState_Loop_5 ; CPU:$C163 PRG:0163 B0 03 jsr UpdateActorRow ; CPU:$C165 PRG:0165 20 6D CE ;=============================================================================== ; Routine: UpdateActorRoundState_Loop_5 ; Global: The routine reads $030B. ; Local: Executes 8 instructions: loads A from $030B; branches on not equal to ; UpdateActorRoundState_Loop_7; loads A from Zp09; ANDs A with $0F; branches on not equal ; to UpdateActorRoundState_Loop_6; loads A from Zp76; and 2 more instructions. ; Parameters: Reads $030B 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. ; ;=============================================================================== UpdateActorRoundState_Loop_5: lda $030B ; CPU:$C168 PRG:0168 AD 0B 03 bne UpdateActorRoundState_Loop_7 ; CPU:$C16B PRG:016B D0 14 lda Zp09 ; CPU:$C16D PRG:016D A5 09 and #$0F ; CPU:$C16F PRG:016F 29 0F bne UpdateActorRoundState_Loop_6 ; CPU:$C171 PRG:0171 D0 06 lda Zp76 ; CPU:$C173 PRG:0173 A5 76 eor #$01 ; CPU:$C175 PRG:0175 49 01 sta Zp76 ; CPU:$C177 PRG:0177 85 76 ;=============================================================================== ; Routine: UpdateActorRoundState_Loop_6 ; Global: The routine calls IsCoordinateBusy, reads $030B. ; Local: Executes 3 instructions: calls IsCoordinateBusy; branches on carry clear to ; UpdateActorRoundState_Loop_7; increments $030B. ; Parameters: Reads $030B 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. ; ;=============================================================================== UpdateActorRoundState_Loop_6: jsr IsCoordinateBusy ; CPU:$C179 PRG:0179 20 25 CA bcc UpdateActorRoundState_Loop_7 ; CPU:$C17C PRG:017C 90 03 inc $030B ; CPU:$C17E PRG:017E EE 0B 03 ;=============================================================================== ; Routine: UpdateActorRoundState_Loop_7 ; Global: The routine calls StartActorAction, AreAnyButtonsPressed, ResetActorIndex, PlaySoundEffectById and 2 more. ; Local: Executes 15 instructions: calls StartActorAction; calls AreAnyButtonsPressed; branches on ; equal to UpdateActorRoundState_Loop_8; calls ResetActorIndex; loads A with $47; calls ; PlaySoundEffectById; 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 OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== UpdateActorRoundState_Loop_7: jsr StartActorAction ; CPU:$C181 PRG:0181 20 DD C9 jsr AreAnyButtonsPressed ; CPU:$C184 PRG:0184 20 04 CA beq UpdateActorRoundState_Loop_8 ; CPU:$C187 PRG:0187 F0 1D jsr ResetActorIndex ; CPU:$C189 PRG:0189 20 4E D5 lda #$47 ; CPU:$C18C PRG:018C A9 47 jsr PlaySoundEffectById ; CPU:$C18E PRG:018E 20 0D F8 lda #$00 ; CPU:$C191 PRG:0191 A9 00 sta ZpEA ; CPU:$C193 PRG:0193 85 EA lda #$0A ; CPU:$C195 PRG:0195 A9 0A sta ZpEB ; CPU:$C197 PRG:0197 85 EB jsr SelectAttributeRow ; CPU:$C199 PRG:0199 20 C4 C6 jsr IsCoordinateBusy ; CPU:$C19C PRG:019C 20 25 CA bcc UpdateActorRoundState_OnCarryClear ; CPU:$C19F PRG:019F 90 04 lda #$02 ; CPU:$C1A1 PRG:01A1 A9 02 sta ZpCC ; CPU:$C1A3 PRG:01A3 85 CC ;=============================================================================== ; Routine: UpdateActorRoundState_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 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. ; ;=============================================================================== UpdateActorRoundState_OnCarryClear: rts ; CPU:$C1A5 PRG:01A5 60 ;=============================================================================== ; Routine: UpdateActorRoundState_Loop_8 ; Global: The routine calls IsCoordinateBusy and SetActorIndex20. ; Local: Executes 6 instructions: returns with RTS; calls IsCoordinateBusy; branches ; on carry clear to UpdateActorRoundState_OnCarryClear; loads A with $02; stores A to ZpCC; ; calls SetActorIndex20. ; 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, Zp01, Zp02, ZpCC. ; ;=============================================================================== UpdateActorRoundState_Loop_8: jsr IsCoordinateBusy ; CPU:$C1A6 PRG:01A6 20 25 CA bcc UpdateActorRoundState_OnCarryClear ; CPU:$C1A9 PRG:01A9 90 FA lda #$02 ; CPU:$C1AB PRG:01AB A9 02 sta ZpCC ; CPU:$C1AD PRG:01AD 85 CC jmp SetActorIndex20 ; CPU:$C1AF PRG:01AF 4C 50 C2 ; ---- data $C1B2-$C1B6 (5 bytes) ---- ; referenced by `lda $C1B2,x` at $C140 (operand $C1B2 falls inside this region) ActorStateSizeTable: .byte $05, $05, $02, $01, $04 ; CPU:$C1B2 PRG:01B2 05 05 02 01 04 ;=============================================================================== ; Routine: RunMainStateHandler ; Global: The routine calls DispatchMainStateHandler and DispatchSecondaryState. ; Local: Executes 7 instructions: loads A from Zp00; calls DispatchMainStateHandler; loads X ; from Zp00; loads A from $C1CC,x; branches on equal to RunMainStateHandler_OnNonzero; ; branches on negative to RunMainStateHandler_Loop; 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. ; ;=============================================================================== RunMainStateHandler: lda Zp00 ; CPU:$C1B7 PRG:01B7 A5 00 jsr DispatchMainStateHandler ; CPU:$C1B9 PRG:01B9 20 D5 C1 ldx Zp00 ; CPU:$C1BC PRG:01BC A6 00 lda $C1CC,x ; CPU:$C1BE PRG:01BE BD CC C1 beq RunMainStateHandler_OnNonzero ; CPU:$C1C1 PRG:01C1 F0 08 bmi RunMainStateHandler_Loop ; CPU:$C1C3 PRG:01C3 30 03 jmp DispatchSecondaryState ; CPU:$C1C5 PRG:01C5 4C 4B C6 ;=============================================================================== ; Routine: RunMainStateHandler_Loop ; Global: The routine calls CheckCoordinateMask. ; Local: Executes 1 instruction: calls CheckCoordinateMask. ; 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. ; ;=============================================================================== RunMainStateHandler_Loop: jmp CheckCoordinateMask ; CPU:$C1C8 PRG:01C8 4C 5D C4 ;=============================================================================== ; Routine: RunMainStateHandler_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: 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. ; ;=============================================================================== RunMainStateHandler_OnNonzero: rts ; CPU:$C1CB PRG:01CB 60 ; ---- data $C1CC-$C1D4 (9 bytes) ---- ; referenced by `lda $C1CC,x` at $C1BE (operand $C1CC falls inside this region) SecondaryStateActionTable: .byte $FF, $FF, $FF, $00, $00, $01, $01, $01, $01 ; CPU:$C1CC PRG:01CC FF FF FF 00 00 01 01 01 01 ;=============================================================================== ; Routine: DispatchMainStateHandler ; Global: The routine calls DispatchHandlerPointerTable. ; Local: Executes 1 instruction: calls DispatchHandlerPointerTable. ; 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, ZpE0, ZpE1. ; ;=============================================================================== DispatchMainStateHandler: jsr DispatchHandlerPointerTable; CPU:$C1D5 PRG:01D5 20 CD C4 ; ---- data $C1D8-$C1E4 (13 bytes) ---- SecondaryStateHandlerPointerTable: .byte $EA, $C1, $12, $C2, $3A, $C2, $5D, $C2, $7D, $C2, $F5, $C2, $03 ; CPU:$C1D8 PRG:01D8 EA C1 12 C2 3A C2 5D C2 7D C2 F5 C2 03 .byte $C3, $60 ; CPU:$C1E5 PRG:01E5 C3 60 -- dcp (Zp60,x) (undocumented; ca65 cannot encode) .byte $C3, $8B ; CPU:$C1E7 PRG:01E7 C3 8B -- dcp (Zp8B,x) (undocumented; ca65 cannot encode) ; ---- data $C1E9-$C1E9 (1 bytes) ---- .byte $C3 ; CPU:$C1E9 PRG:01E9 C3 ;=============================================================================== ; Routine: AdvanceActorSlot ; Global: The routine calls RunActorScreenScript and SaveActorIndexAndAdvance. ; Local: Executes 8 instructions: returns with RTS; loads X from Zp01; ; branches on equal to AdvanceActorSlot_OnZero; decrements X; branches on equal to ; AdvanceActorSlot_Loop; calls RunActorScreenScript; 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 OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== AdvanceActorSlot: ldx Zp01 ; CPU:$C1EA PRG:01EA A6 01 beq AdvanceActorSlot_OnZero ; CPU:$C1EC PRG:01EC F0 1E dex ; CPU:$C1EE PRG:01EE CA beq AdvanceActorSlot_Loop ; CPU:$C1EF PRG:01EF F0 08 jsr RunActorScreenScript ; CPU:$C1F1 PRG:01F1 20 AA C3 lda #$00 ; CPU:$C1F4 PRG:01F4 A9 00 jmp SaveActorIndexAndAdvance ; CPU:$C1F6 PRG:01F6 4C A7 C2 ;=============================================================================== ; Routine: AdvanceActorSlot_Loop ; Global: The routine calls ScrollScreenByLine, InitPpuForPowerOn, ClearSpritesAndSetMask, SetFadeCounter and 1 more. ; Local: Executes 8 instructions: returns with RTS; decrements Zp02; branches ; on not equal to RunMainStateHandler_OnNonzero; calls ScrollScreenByLine; calls InitPpuForPowerOn; calls ; ClearSpritesAndSetMask; 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 OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== AdvanceActorSlot_Loop: dec Zp02 ; CPU:$C1F9 PRG:01F9 C6 02 bne RunMainStateHandler_OnNonzero ; CPU:$C1FB PRG:01FB D0 CE jsr ScrollScreenByLine ; CPU:$C1FD PRG:01FD 20 BE C3 jsr InitPpuForPowerOn ; CPU:$C200 PRG:0200 20 B8 C0 jsr ClearSpritesAndSetMask ; CPU:$C203 PRG:0203 20 D6 C3 jsr SetFadeCounter ; CPU:$C206 PRG:0206 20 C8 C4 jmp SaveActorIndex_OnNonzero ; CPU:$C209 PRG:0209 4C 54 C2 ;=============================================================================== ; Routine: AdvanceActorSlot_OnZero ; Global: The routine calls ClearSpritesAndSetMask and SetActorIndex20. ; Local: Executes 2 instructions: calls ClearSpritesAndSetMask; calls SetActorIndex20. ; 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, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== AdvanceActorSlot_OnZero: jsr ClearSpritesAndSetMask ; CPU:$C20C PRG:020C 20 D6 C3 jmp SetActorIndex20 ; CPU:$C20F PRG:020F 4C 50 C2 ; ---- data $C212-$C24F (62 bytes) ---- .byte $A5, $01, $D0, $06, $20, $D9, $CC, $4C, $54, $C2, $20, $97, $D5, $A5, $09, $4A ; CPU:$C212 PRG:0212 A5 01 D0 06 20 D9 CC 4C 54 C2 20 97 D5 A5 09 4A .byte $90, $04, $C6, $02, $F0, $03, $4C, $8F, $C5, $A5, $0E, $D0, $08, $A9, $F0, $8D ; CPU:$C222 PRG:0222 90 04 C6 02 F0 03 4C 8F C5 A5 0E D0 08 A9 F0 8D .byte $00, $02, $4C, $A5, $C2, $4C, $70, $C4, $A6, $01, $F0, $03, $4C, $80, $D2, $20 ; CPU:$C232 PRG:0232 00 02 4C A5 C2 4C 70 C4 A6 01 F0 03 4C 80 D2 20 .byte $D0, $CC, $20, $D6, $C3, $20, $3E, $D7, $20, $CB, $C5, $20, $C8, $C4 ; CPU:$C242 PRG:0242 D0 CC 20 D6 C3 20 3E D7 20 CB C5 20 C8 C4 ;=============================================================================== ; Routine: SetActorIndex20 ; Global: The routine reads no RAM 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 $20. ; 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, Zp01, Zp02. ; ;=============================================================================== SetActorIndex20: lda #$20 ; CPU:$C250 PRG:0250 A9 20 ;=============================================================================== ; Routine: SaveActorIndex ; Global: The routine reads no RAM 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 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: ; no register, the N and Z flags, Zp01, Zp02. ; ;=============================================================================== SaveActorIndex: sta Zp02 ; CPU:$C252 PRG:0252 85 02 ;=============================================================================== ; Routine: SaveActorIndex_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 2 instructions: increments Zp01; 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, Zp01. ; ;=============================================================================== SaveActorIndex_OnNonzero: inc Zp01 ; CPU:$C254 PRG:0254 E6 01 rts ; CPU:$C256 PRG:0256 60 ;=============================================================================== ; Routine: SaveActorIndex_OnZero ; Global: The routine calls SetActorIndex20Two. ; Local: Executes 4 instructions: calls SetActorIndex20Two; 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, the N and Z flags, Zp00, Zp01, Zp02, Zp0A. ; ;=============================================================================== SaveActorIndex_OnZero: jsr SetActorIndex20Two ; CPU:$C257 PRG:0257 20 A5 C2 pla ; CPU:$C25A PRG:025A 68 pla ; CPU:$C25B PRG:025B 68 rts ; CPU:$C25C PRG:025C 60 ;=============================================================================== ; Routine: UpdateActorMovementStep ; Global: The routine calls ClearSpritesAndSetMask, SetActorIndex20, SetActorIndex20Two and SetSoundEffectIndex. ; Local: Executes 16 instructions: calls ClearSpritesAndSetMask; calls SetActorIndex20; increments ; Zp01; returns with RTS; calls SetActorIndex20Two; pulls 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: 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. ; ;=============================================================================== UpdateActorMovementStep: ldx Zp01 ; CPU:$C25D PRG:025D A6 01 beq UpdateActorMovementStep_Loop_2 ; CPU:$C25F PRG:025F F0 10 dec Zp02 ; CPU:$C261 PRG:0261 C6 02 beq SaveActorIndex_OnZero ; CPU:$C263 PRG:0263 F0 F2 lda #$08 ; CPU:$C265 PRG:0265 A9 08 and Zp02 ; CPU:$C267 PRG:0267 25 02 bne UpdateActorMovementStep_Loop ; CPU:$C269 PRG:0269 D0 03 jmp SetSoundEffectIndex ; CPU:$C26B PRG:026B 4C B2 C5 ;=============================================================================== ; Routine: UpdateActorMovementStep_Loop ; Global: The routine calls RunScreenScriptByIndex. ; Local: Executes 1 instruction: calls RunScreenScriptByIndex. ; 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. ; ;=============================================================================== UpdateActorMovementStep_Loop: jmp RunScreenScriptByIndex ; CPU:$C26E PRG:026E 4C C3 C5 ;=============================================================================== ; Routine: UpdateActorMovementStep_Loop_2 ; Global: The routine calls ClearSpritesAndSetMask, SetActorIndex20, ResetActorSlots and PlaySoundEffectPair. ; Local: Executes 19 instructions: calls ClearSpritesAndSetMask; calls SetActorIndex20; increments ; Zp01; returns with RTS; calls ResetActorSlots; calls PlaySoundEffectPair; 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. ; ;=============================================================================== UpdateActorMovementStep_Loop_2: jsr ResetActorSlots ; CPU:$C271 PRG:0271 20 3B CA jsr PlaySoundEffectPair ; CPU:$C274 PRG:0274 20 DA CB lda #$50 ; CPU:$C277 PRG:0277 A9 50 sta Zp02 ; CPU:$C279 PRG:0279 85 02 bne SaveActorIndex_OnNonzero ; CPU:$C27B PRG:027B D0 D7 ldx Zp01 ; CPU:$C27D PRG:027D A6 01 beq AdvanceActorSlot_OnZero ; CPU:$C27F PRG:027F F0 8B dex ; CPU:$C281 PRG:0281 CA beq ClearActorState_Loop_2 ; CPU:$C282 PRG:0282 F0 4E dex ; CPU:$C284 PRG:0284 CA beq ClearActorState_Loop ; CPU:$C285 PRG:0285 F0 2B lda Zp02 ; CPU:$C287 PRG:0287 A5 02 beq UpdateActorMovementStep_Loop_3 ; CPU:$C289 PRG:0289 F0 04 dec Zp02 ; CPU:$C28B PRG:028B C6 02 bne ClearActorState_OnNonzero ; CPU:$C28D PRG:028D D0 22 ;=============================================================================== ; Routine: UpdateActorMovementStep_Loop_3 ; Global: The routine calls IsCoordinateBusy, RunScreenScript, SelectActorSubSlot and SetFadeCounter. ; Local: Executes 9 instructions: calls IsCoordinateBusy; branches on carry clear to ; ClearActorState_OnNonzero; loads A with $87; calls RunScreenScript; calls SelectActorSubSlot; calls ; SetFadeCounter; 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. ; ;=============================================================================== UpdateActorMovementStep_Loop_3: jsr IsCoordinateBusy ; CPU:$C28F PRG:028F 20 25 CA bcc ClearActorState_OnNonzero ; CPU:$C292 PRG:0292 90 1D lda #$87 ; CPU:$C294 PRG:0294 A9 87 jsr RunScreenScript ; CPU:$C296 PRG:0296 20 E3 C4 jsr SelectActorSubSlot ; CPU:$C299 PRG:0299 20 35 C8 jsr SetFadeCounter ; CPU:$C29C PRG:029C 20 C8 C4 dec Zp60 ; CPU:$C29F PRG:029F C6 60 lda #$01 ; CPU:$C2A1 PRG:02A1 A9 01 sta Zp0A ; CPU:$C2A3 PRG:02A3 85 0A ;=============================================================================== ; Routine: SetActorIndex20Two ; Global: The routine reads no RAM 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 $20. ; 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, Zp00, Zp01, Zp02, Zp0A. ; ;=============================================================================== SetActorIndex20Two: lda #$20 ; CPU:$C2A5 PRG:02A5 A9 20 ;=============================================================================== ; Routine: SaveActorIndexAndAdvance ; Global: The routine reads no RAM 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 Zp02; increments 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, the N and Z flags, Zp00, Zp01, Zp02, Zp0A. ; ;=============================================================================== SaveActorIndexAndAdvance: sta Zp02 ; CPU:$C2A7 PRG:02A7 85 02 inc Zp00 ; CPU:$C2A9 PRG:02A9 E6 00 ;=============================================================================== ; Routine: ClearActorState ; Global: The routine reads no RAM 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 Zp0A; stores A ; to Zp01. ; 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, Zp01, Zp0A. ; ;=============================================================================== ClearActorState: lda #$00 ; CPU:$C2AB PRG:02AB A9 00 sta Zp0A ; CPU:$C2AD PRG:02AD 85 0A sta Zp01 ; CPU:$C2AF PRG:02AF 85 01 ;=============================================================================== ; Routine: ClearActorState_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: 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. ; ;=============================================================================== ClearActorState_OnNonzero: rts ; CPU:$C2B1 PRG:02B1 60 ;=============================================================================== ; Routine: ClearActorState_Loop ; Global: The routine calls RunScreenScript, AddToCoordinatePair, SetPpuVramAddressTwo, RunScreenScriptFive and 2 more. ; Local: Executes 14 instructions: returns with RTS; decrements Zp02; branches ; on not equal to ClearActorState_OnNonzero; loads A with $07; calls RunScreenScript; loads X ; with $E0; 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. ; ;=============================================================================== ClearActorState_Loop: dec Zp02 ; CPU:$C2B2 PRG:02B2 C6 02 bne ClearActorState_OnNonzero ; CPU:$C2B4 PRG:02B4 D0 FB lda #$07 ; CPU:$C2B6 PRG:02B6 A9 07 jsr RunScreenScript ; CPU:$C2B8 PRG:02B8 20 E3 C4 ldx #$E0 ; CPU:$C2BB PRG:02BB A2 E0 lda #$06 ; CPU:$C2BD PRG:02BD A9 06 jsr AddToCoordinatePair ; CPU:$C2BF PRG:02BF 20 3F C5 lda Zp61 ; CPU:$C2C2 PRG:02C2 A5 61 jsr SetPpuVramAddressTwo ; CPU:$C2C4 PRG:02C4 20 37 C6 jsr RunScreenScriptFive ; CPU:$C2C7 PRG:02C7 20 CB C5 jsr SetFadeCounter ; CPU:$C2CA PRG:02CA 20 C8 C4 lda #$80 ; CPU:$C2CD PRG:02CD A9 80 jmp SaveActorIndex ; CPU:$C2CF PRG:02CF 4C 52 C2 ;=============================================================================== ; Routine: ClearActorState_Loop_2 ; Global: The routine calls SetScrollTargetOnly, ClearPpuCtrlBit1 and RunScreenScriptWithOffset. ; Local: Executes 13 instructions: returns with RTS; decrements Zp02; branches ; on not equal to ClearActorState_OnNonzero; calls SetScrollTargetOnly; calls ClearPpuCtrlBit1; loads X ; with $01; 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. ; ;=============================================================================== ClearActorState_Loop_2: dec Zp02 ; CPU:$C2D2 PRG:02D2 C6 02 bne ClearActorState_OnNonzero ; CPU:$C2D4 PRG:02D4 D0 DB jsr SetScrollTargetOnly ; CPU:$C2D6 PRG:02D6 20 D0 CC jsr ClearPpuCtrlBit1 ; CPU:$C2D9 PRG:02D9 20 5C CA ldx #$01 ; CPU:$C2DC PRG:02DC A2 01 lda Zp03 ; CPU:$C2DE PRG:02DE A5 03 asl a ; CPU:$C2E0 PRG:02E0 0A asl a ; CPU:$C2E1 PRG:02E1 0A bpl ClearActorState_Loop_3 ; CPU:$C2E2 PRG:02E2 10 07 lda #$05 ; CPU:$C2E4 PRG:02E4 A9 05 jsr RunScreenScriptWithOffset ; CPU:$C2E6 PRG:02E6 20 AD C6 ldx #$50 ; CPU:$C2E9 PRG:02E9 A2 50 ;=============================================================================== ; Routine: ClearActorState_Loop_3 ; Global: The routine calls ClearDirectionFlags, SetFadeCounter and SaveActorIndex. ; Local: Executes 4 instructions: calls ClearDirectionFlags; calls SetFadeCounter; copies X ; into A; calls SaveActorIndex. ; 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. ; ;=============================================================================== ClearActorState_Loop_3: jsr ClearDirectionFlags ; CPU:$C2EB PRG:02EB 20 2D CB jsr SetFadeCounter ; CPU:$C2EE PRG:02EE 20 C8 C4 txa ; CPU:$C2F1 PRG:02F1 8A jmp SaveActorIndex ; CPU:$C2F2 PRG:02F2 4C 52 C2 ; ---- data $C2F5-$C302 (14 bytes) ---- .byte $20, $80, $D2, $A9, $08, $A6, $0B, $D0, $44, $A5, $0A, $D0, $A3, $60 ; CPU:$C2F5 PRG:02F5 20 80 D2 A9 08 A6 0B D0 44 A5 0A D0 A3 60 ;=============================================================================== ; Routine: RunScreenScriptThree ; Global: The routine calls RunScreenScriptWithOffset and RunScreenScript. ; Local: Executes 11 instructions: loads A from Zp00; stores A to Zp6E; loads ; X from Zp01; branches on equal to SetActorSlotAndClear_Loop; loads A with $04; calls ; RunScreenScriptWithOffset; 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. ; ;=============================================================================== RunScreenScriptThree: lda Zp00 ; CPU:$C303 PRG:0303 A5 00 sta Zp6E ; CPU:$C305 PRG:0305 85 6E ldx Zp01 ; CPU:$C307 PRG:0307 A6 01 beq SetActorSlotAndClear_Loop ; CPU:$C309 PRG:0309 F0 40 lda #$04 ; CPU:$C30B PRG:030B A9 04 jsr RunScreenScriptWithOffset ; CPU:$C30D PRG:030D 20 AD C6 lda Zp03 ; CPU:$C310 PRG:0310 A5 03 and #$20 ; CPU:$C312 PRG:0312 29 20 bne RunScreenScriptThree_Loop ; CPU:$C314 PRG:0314 D0 05 lda #$85 ; CPU:$C316 PRG:0316 A9 85 jsr RunScreenScript ; CPU:$C318 PRG:0318 20 E3 C4 ;=============================================================================== ; Routine: RunScreenScriptThree_Loop ; Global: The routine calls SaveActorIndexAndAdvance. ; Local: Executes 5 instructions: loads A with $06; stores A to Zp00; loads A ; with $00; stores A to Zp0E; calls SaveActorIndexAndAdvance. ; 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, Zp00, Zp01, Zp02, Zp0A, Zp0E. ; ;=============================================================================== RunScreenScriptThree_Loop: lda #$06 ; CPU:$C31B PRG:031B A9 06 sta Zp00 ; CPU:$C31D PRG:031D 85 00 lda #$00 ; CPU:$C31F PRG:031F A9 00 sta Zp0E ; CPU:$C321 PRG:0321 85 0E jmp SaveActorIndexAndAdvance ; CPU:$C323 PRG:0323 4C A7 C2 ;=============================================================================== ; Routine: RunScreenScriptThree_OnNonzero ; Global: The routine reads $0100. ; Local: Executes 3 instructions: loads A from $0100; branches on equal to ; RunScreenScriptThree_Loop_2; loads X with $80. ; Parameters: Reads $0100 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 and Z flags, Zp00, Zp01, Zp02, Zp03, Zp0A, Zp5F. ; ;=============================================================================== RunScreenScriptThree_OnNonzero: lda $0100 ; CPU:$C326 PRG:0326 AD 00 01 beq RunScreenScriptThree_Loop_2; CPU:$C329 PRG:0329 F0 15 ldx #$80 ; CPU:$C32B PRG:032B A2 80 ;=============================================================================== ; Routine: RunScreenScriptThree_OnNonzero_2 ; Global: The routine reads no RAM 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 Zp5F,x; loads Y from $00FF,x; ; stores A to $00FF,x; stores Y to Zp5F,x; decrements X; branches on ; not equal to RunScreenScriptThree_OnNonzero_2; 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 and Z flags, Zp00, Zp01, Zp02, Zp03, Zp0A, Zp5F. ; ;=============================================================================== RunScreenScriptThree_OnNonzero_2: lda Zp5F,x ; CPU:$C32D PRG:032D B5 5F ldy a:$00FF,x ; CPU:$C32F PRG:032F BC FF 00 sta a:$00FF,x ; CPU:$C332 PRG:0332 9D FF 00 sty Zp5F,x ; CPU:$C335 PRG:0335 94 5F dex ; CPU:$C337 PRG:0337 CA bne RunScreenScriptThree_OnNonzero_2 ; CPU:$C338 PRG:0338 D0 F3 lda Zp03 ; CPU:$C33A PRG:033A A5 03 eor #$80 ; CPU:$C33C PRG:033C 49 80 sta Zp03 ; CPU:$C33E PRG:033E 85 03 ;=============================================================================== ; Routine: RunScreenScriptThree_Loop_2 ; Global: The routine reads no RAM 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 $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, the N and Z flags, Zp00, Zp01, Zp02, Zp0A. ; ;=============================================================================== RunScreenScriptThree_Loop_2: lda #$04 ; CPU:$C340 PRG:0340 A9 04 ;=============================================================================== ; Routine: SetActorSlotAndClear ; Global: The routine calls ClearActorState. ; Local: Executes 4 instructions: stores A to Zp00; loads A with $20; stores A ; to Zp02; calls ClearActorState. ; 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, Zp00, Zp01, Zp02, Zp0A. ; ;=============================================================================== SetActorSlotAndClear: sta Zp00 ; CPU:$C342 PRG:0342 85 00 lda #$20 ; CPU:$C344 PRG:0344 A9 20 sta Zp02 ; CPU:$C346 PRG:0346 85 02 jmp ClearActorState ; CPU:$C348 PRG:0348 4C AB C2 ;=============================================================================== ; Routine: SetActorSlotAndClear_Loop ; Global: The routine calls ClearActorState, ClearSpritesAndSetMask, RunScreenScriptFive, SetFadeCounter and 1 more, ; reads $0100. ; Local: Executes 26 instructions: loads A from $0100; branches on equal to ; RunScreenScriptThree_Loop_2; loads X with $80; loads A from Zp5F,x; loads Y from ; $00FF,x; stores A to $00FF,x; and 20 more instructions. ; Parameters: Reads $0100 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. ; ;=============================================================================== SetActorSlotAndClear_Loop: jsr ClearSpritesAndSetMask ; CPU:$C34B PRG:034B 20 D6 C3 jsr RunScreenScriptFive ; CPU:$C34E PRG:034E 20 CB C5 jsr SetFadeCounter ; CPU:$C351 PRG:0351 20 C8 C4 inc Zp67 ; CPU:$C354 PRG:0354 E6 67 lda Zp60 ; CPU:$C356 PRG:0356 A5 60 bne RunScreenScriptThree_OnNonzero ; CPU:$C358 PRG:0358 D0 CC jsr ClearPpuCtrlBit1 ; CPU:$C35A PRG:035A 20 5C CA inc Zp01 ; CPU:$C35D PRG:035D E6 01 rts ; CPU:$C35F PRG:035F 60 ; ---- data $C360-$C388 (41 bytes) ---- .byte $A0, $00, $84, $67, $84, $66, $84, $6E, $AD, $00, $01, $D0, $09, $A5, $05, $29 ; CPU:$C360 PRG:0360 A0 00 84 67 84 66 84 6E AD 00 01 D0 09 A5 05 29 .byte $10, $F0, $03, $4C, $5D, $C4, $C6, $02, $D0, $1F, $AD, $00, $01, $F0, $03, $4C ; CPU:$C370 PRG:0370 10 F0 03 4C 5D C4 C6 02 D0 1F AD 00 01 F0 03 4C .byte $2B, $C3, $A5, $03, $29, $BF, $85, $03, $4C ; CPU:$C380 PRG:0380 2B C3 A5 03 29 BF 85 03 4C ;=============================================================================== ; Routine: StartScreenScriptFour ; Global: The routine calls CheckActorFrameFlags. ; Local: Executes 7 instructions: calls CheckActorFrameFlags; loads A from Zp00; stores A ; to Zp6E; loads X from Zp01; branches on equal to StartScreenScriptFour_Loop_2; ; 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, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StartScreenScriptFour: .byte $F4, $C0 ; CPU:$C389 PRG:0389 F4 C0 -- nop ZpC0,x (undocumented; ca65 cannot encode) jsr CheckActorFrameFlags ; CPU:$C38B PRG:038B 20 DF D5 lda Zp00 ; CPU:$C38E PRG:038E A5 00 sta Zp6E ; CPU:$C390 PRG:0390 85 6E ldx Zp01 ; CPU:$C392 PRG:0392 A6 01 beq StartScreenScriptFour_Loop_2 ; CPU:$C394 PRG:0394 F0 04 dex ; CPU:$C396 PRG:0396 CA beq StartScreenScriptFour_Loop ; CPU:$C397 PRG:0397 F0 00 ;=============================================================================== ; Routine: StartScreenScriptFour_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: 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. ; ;=============================================================================== StartScreenScriptFour_Loop: rts ; CPU:$C399 PRG:0399 60 ;=============================================================================== ; Routine: StartScreenScriptFour_Loop_2 ; Global: The routine calls SetAttributeColumn and SetActorIndex20. ; Local: Executes 8 instructions: clears the carry flag; loads X with $00; ; stores X to Zp0B; loads A from Zp61; increments X; calls SetAttributeColumn; ; 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, the RAM fields it writes. ; ;=============================================================================== StartScreenScriptFour_Loop_2: clc ; CPU:$C39A PRG:039A 18 ldx #$00 ; CPU:$C39B PRG:039B A2 00 stx Zp0B ; CPU:$C39D PRG:039D 86 0B lda Zp61 ; CPU:$C39F PRG:039F A5 61 inx ; CPU:$C3A1 PRG:03A1 E8 jsr SetAttributeColumn ; CPU:$C3A2 PRG:03A2 20 F3 C6 sta Zp61 ; CPU:$C3A5 PRG:03A5 85 61 jmp SetActorIndex20 ; CPU:$C3A7 PRG:03A7 4C 50 C2 ;=============================================================================== ; Routine: RunActorScreenScript ; Global: The routine calls DrawTitleScreenText, RunScreenScript, SetSoundEffectIndex and SetFadeCounter. ; Local: Executes 5 instructions: calls DrawTitleScreenText; loads A with $03; calls ; RunScreenScript; calls SetSoundEffectIndex; calls SetFadeCounter. ; 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. ; ;=============================================================================== RunActorScreenScript: jsr DrawTitleScreenText ; CPU:$C3AA PRG:03AA 20 53 C7 lda #$03 ; CPU:$C3AD PRG:03AD A9 03 jsr RunScreenScript ; CPU:$C3AF PRG:03AF 20 E3 C4 jsr SetSoundEffectIndex ; CPU:$C3B2 PRG:03B2 20 B2 C5 jmp SetFadeCounter ; CPU:$C3B5 PRG:03B5 4C C8 C4 ;=============================================================================== ; Routine: InitGameHardware ; Global: The routine calls ClearSpritesAndSetMask and InitApuAndPpu. ; Local: Executes 2 instructions: calls ClearSpritesAndSetMask; calls InitApuAndPpu. ; 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, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== InitGameHardware: jsr ClearSpritesAndSetMask ; CPU:$C3B8 PRG:03B8 20 D6 C3 jmp InitApuAndPpu ; CPU:$C3BB PRG:03BB 4C C1 C3 ;=============================================================================== ; Routine: ScrollScreenByLine ; Global: The routine calls ScrollScreenUp. ; Local: Executes 1 instruction: calls ScrollScreenUp. ; 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. ; ;=============================================================================== ScrollScreenByLine: jsr ScrollScreenUp ; CPU:$C3BE PRG:03BE 20 D9 CC ;=============================================================================== ; Routine: InitApuAndPpu ; Global: The routine calls SetPpuMaskValue, writes the APUSTATUS, JOY2 and PPUCTRL ; registers. ; Local: Executes 9 instructions: loads A with $1F; stores A to the APUSTATUS ; register; loads A with $C0; stores A to the JOY2 register; calls ; SetPpuMaskValue; loads A with $88; 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 the APUSTATUS, JOY2 and PPUCTRL registers set. ; Clobbers: ; A, the N and Z flags, Zp53, Zp54, PPUCTRL, APUSTATUS, JOY2. ; ;=============================================================================== InitApuAndPpu: lda #$1F ; CPU:$C3C1 PRG:03C1 A9 1F sta APUSTATUS ; CPU:$C3C3 PRG:03C3 8D 15 40 lda #$C0 ; CPU:$C3C6 PRG:03C6 A9 C0 sta JOY2 ; CPU:$C3C8 PRG:03C8 8D 17 40 jsr SetPpuMaskValue ; CPU:$C3CB PRG:03CB 20 CB C0 lda #$88 ; CPU:$C3CE PRG:03CE A9 88 sta Zp53 ; CPU:$C3D0 PRG:03D0 85 53 sta PPUCTRL ; CPU:$C3D2 PRG:03D2 8D 00 20 rts ; CPU:$C3D5 PRG:03D5 60 ;=============================================================================== ; Routine: ClearSpritesAndSetMask ; Global: The routine calls ClearOamBuffer and SetActorIndex20Three. ; Local: Executes 4 instructions: calls ClearOamBuffer; calls SetActorIndex20Three; loads A with ; $2C; branches on not equal to SetActorIndex20Three_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, ZpE0, ZpE1, ZpE2, the OAM shadow, ; PPUADDR, PPUDATA. ; ;=============================================================================== ClearSpritesAndSetMask: jsr ClearOamBuffer ; CPU:$C3D6 PRG:03D6 20 56 C5 jsr SetActorIndex20Three ; CPU:$C3D9 PRG:03D9 20 E0 C3 lda #$2C ; CPU:$C3DC PRG:03DC A9 2C bne SetActorIndex20Three_Loop ; CPU:$C3DE PRG:03DE D0 02 ;=============================================================================== ; Routine: SetActorIndex20Three ; Global: The routine reads no RAM 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 $20. ; 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, ZpE0, ZpE1, ZpE2, PPUADDR, PPUDATA. ; ;=============================================================================== SetActorIndex20Three: lda #$20 ; CPU:$C3E0 PRG:03E0 A9 20 ;=============================================================================== ; Routine: SetActorIndex20Three_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: stores A to ZpE1; loads Y with $04; loads A ; with $00; stores A to ZpE0; stores A to ZpE2. ; 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, ZpE0, ZpE1, ZpE2, PPUADDR, PPUDATA. ; ;=============================================================================== SetActorIndex20Three_Loop: sta ZpE1 ; CPU:$C3E2 PRG:03E2 85 E1 ldy #$04 ; CPU:$C3E4 PRG:03E4 A0 04 lda #$00 ; CPU:$C3E6 PRG:03E6 A9 00 sta ZpE0 ; CPU:$C3E8 PRG:03E8 85 E0 sta ZpE2 ; CPU:$C3EA PRG:03EA 85 E2 ;=============================================================================== ; Routine: SetActorIndex20Three_OnNonzero ; Global: The routine calls SetPpuVramAddressZero. ; Local: Executes 5 instructions: calls SetPpuVramAddressZero; increments ZpE1; decrements ; Y; branches on not equal to SetActorIndex20Three_OnNonzero; 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, ZpE1, ZpE2, PPUADDR, PPUDATA. ; ;=============================================================================== SetActorIndex20Three_OnNonzero: jsr SetPpuVramAddressZero ; CPU:$C3EC PRG:03EC 20 F5 C3 inc ZpE1 ; CPU:$C3EF PRG:03EF E6 E1 dey ; CPU:$C3F1 PRG:03F1 88 bne SetActorIndex20Three_OnNonzero ; CPU:$C3F2 PRG:03F2 D0 F8 rts ; CPU:$C3F4 PRG:03F4 60 ;=============================================================================== ; Routine: SetPpuVramAddressZero ; Global: The routine calls SetPpuVramAddress. ; Local: Executes 2 instructions: loads A with $00; calls SetPpuVramAddress. ; 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, ZpE2, PPUADDR, PPUDATA. ; ;=============================================================================== SetPpuVramAddressZero: lda #$00 ; CPU:$C3F5 PRG:03F5 A9 00 jsr SetPpuVramAddress ; CPU:$C3F7 PRG:03F7 20 BA C4 ;=============================================================================== ; Routine: SetPpuVramAddressZero_OnNonzero ; Global: The routine writes the PPUDATA register. ; Local: Executes 4 instructions: stores A to the PPUDATA register; decrements ; ZpE2; branches on not equal to SetPpuVramAddressZero_OnNonzero; 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, the N and Z flags, ZpE2, PPUDATA. ; ;=============================================================================== SetPpuVramAddressZero_OnNonzero: sta PPUDATA ; CPU:$C3FA PRG:03FA 8D 07 20 dec ZpE2 ; CPU:$C3FD PRG:03FD C6 E2 bne SetPpuVramAddressZero_OnNonzero ; CPU:$C3FF PRG:03FF D0 F9 rts ; CPU:$C401 PRG:0401 60 ;=============================================================================== ; Routine: ReadControllerButtons ; Global: The routine writes the JOY1 registers. ; Local: Executes 5 instructions: loads X with $01; stores X to the JOY1 ; register; decrements X; stores X to the JOY1 register; 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: 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 and C flags, the RAM fields it writes. ; ;=============================================================================== ReadControllerButtons: ldx #$01 ; CPU:$C402 PRG:0402 A2 01 stx JOY1 ; CPU:$C404 PRG:0404 8E 16 40 dex ; CPU:$C407 PRG:0407 CA stx JOY1 ; CPU:$C408 PRG:0408 8E 16 40 ldy #$08 ; CPU:$C40B PRG:040B A0 08 ;=============================================================================== ; Routine: ReadControllerButtons_OnNonzero ; Global: The routine calls SetMaskAndApply, reads the JOY1 and JOY2 registers. ; Local: Executes 29 instructions: loads A from the JOY1 register; stores A to ; ZpE7; shifts a right; ORs A with ZpE7; shifts a right; rotates ZpE4 ; left; 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 and C flags, Zp05, Zp07, Zp0E, ZpE4, ZpE5, ZpE7. ; ;=============================================================================== ReadControllerButtons_OnNonzero: lda JOY1 ; CPU:$C40D PRG:040D AD 16 40 sta ZpE7 ; CPU:$C410 PRG:0410 85 E7 lsr a ; CPU:$C412 PRG:0412 4A ora ZpE7 ; CPU:$C413 PRG:0413 05 E7 lsr a ; CPU:$C415 PRG:0415 4A rol ZpE4 ; CPU:$C416 PRG:0416 26 E4 lda JOY2 ; CPU:$C418 PRG:0418 AD 17 40 sta ZpE7 ; CPU:$C41B PRG:041B 85 E7 lsr a ; CPU:$C41D PRG:041D 4A ora ZpE7 ; CPU:$C41E PRG:041E 05 E7 lsr a ; CPU:$C420 PRG:0420 4A rol ZpE5 ; CPU:$C421 PRG:0421 26 E5 dey ; CPU:$C423 PRG:0423 88 bne ReadControllerButtons_OnNonzero ; CPU:$C424 PRG:0424 D0 E7 lda Zp05 ; CPU:$C426 PRG:0426 A5 05 and #$10 ; CPU:$C428 PRG:0428 29 10 eor Zp0E ; CPU:$C42A PRG:042A 45 0E sta Zp0E ; CPU:$C42C PRG:042C 85 0E lda Zp03 ; CPU:$C42E PRG:042E A5 03 and #$20 ; CPU:$C430 PRG:0430 29 20 beq ApplyCoordinateMask_Loop ; CPU:$C432 PRG:0432 F0 1A lda Zp03 ; CPU:$C434 PRG:0434 A5 03 and #$F0 ; CPU:$C436 PRG:0436 29 F0 cmp #$E0 ; CPU:$C438 PRG:0438 C9 E0 beq ApplyCoordinateMask_Loop_2 ; CPU:$C43A PRG:043A F0 16 lda ZpE4 ; CPU:$C43C PRG:043C A5 E4 jsr SetMaskAndApply ; CPU:$C43E PRG:043E 20 58 C4 inx ; CPU:$C441 PRG:0441 E8 lda ZpE4,x ; CPU:$C442 PRG:0442 B5 E4 ;=============================================================================== ; Routine: ApplyCoordinateMask ; Global: The routine reads no RAM 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; EORs A with Zp07,x; ANDs A ; with ZpE4,x; stores A to Zp05,x; stores Y to Zp07,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: ; Y, the N and Z flags, Zp05, Zp07. ; ;=============================================================================== ApplyCoordinateMask: tay ; CPU:$C444 PRG:0444 A8 eor Zp07,x ; CPU:$C445 PRG:0445 55 07 and ZpE4,x ; CPU:$C447 PRG:0447 35 E4 sta Zp05,x ; CPU:$C449 PRG:0449 95 05 sty Zp07,x ; CPU:$C44B PRG:044B 94 07 rts ; CPU:$C44D PRG:044D 60 ;=============================================================================== ; Routine: ApplyCoordinateMask_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 A with $FF; branches on not equal to ; ApplyCoordinateMask_Loop_3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp05, Zp07, ZpE4. ; ;=============================================================================== ApplyCoordinateMask_Loop: lda #$FF ; CPU:$C44E PRG:044E A9 FF bne ApplyCoordinateMask_Loop_3 ; CPU:$C450 PRG:0450 D0 02 ;=============================================================================== ; Routine: ApplyCoordinateMask_Loop_2 ; Global: The routine reads no RAM 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 $30. ; 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, Zp05, Zp07, ZpE4. ; ;=============================================================================== ApplyCoordinateMask_Loop_2: lda #$30 ; CPU:$C452 PRG:0452 A9 30 ;=============================================================================== ; Routine: ApplyCoordinateMask_Loop_3 ; Global: The routine reads no RAM 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: ANDs A with ZpE4; ORs A with ZpE5. ; 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: ; Y, the N and Z flags, Zp05, Zp07, ZpE4. ; ;=============================================================================== ApplyCoordinateMask_Loop_3: and ZpE4 ; CPU:$C454 PRG:0454 25 E4 ora ZpE5 ; CPU:$C456 PRG:0456 05 E5 ;=============================================================================== ; Routine: SetMaskAndApply ; Global: The routine calls ApplyCoordinateMask. ; Local: Executes 2 instructions: stores A to ZpE4; calls ApplyCoordinateMask. ; 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: ; Y, the N and Z flags, Zp05, Zp07, ZpE4. ; ;=============================================================================== SetMaskAndApply: sta ZpE4 ; CPU:$C458 PRG:0458 85 E4 jmp ApplyCoordinateMask ; CPU:$C45A PRG:045A 4C 44 C4 ;=============================================================================== ; Routine: CheckCoordinateMask ; Global: The routine calls SetActorSlotAndClear. ; Local: Executes 17 instructions: loads A from Zp05; ANDs A with $30; ; branches on equal to CheckCoordinateMask_Loop_2; loads X with $00; stores X to Zp02; ; loads X from 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, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== CheckCoordinateMask: lda Zp05 ; CPU:$C45D PRG:045D A5 05 and #$30 ; CPU:$C45F PRG:045F 29 30 beq CheckCoordinateMask_Loop_2 ; CPU:$C461 PRG:0461 F0 25 ldx #$00 ; CPU:$C463 PRG:0463 A2 00 stx Zp02 ; CPU:$C465 PRG:0465 86 02 ldx Zp00 ; CPU:$C467 PRG:0467 A6 00 dex ; CPU:$C469 PRG:0469 CA bne CheckCoordinateMask_Loop_3 ; CPU:$C46A PRG:046A D0 1D and #$20 ; CPU:$C46C PRG:046C 29 20 bne CheckCoordinateMask_Loop ; CPU:$C46E PRG:046E D0 10 lda #$00 ; CPU:$C470 PRG:0470 A9 00 sta Zp0E ; CPU:$C472 PRG:0472 85 0E ldx Zp50 ; CPU:$C474 PRG:0474 A6 50 lda $C4A6,x ; CPU:$C476 PRG:0476 BD A6 C4 sta Zp03 ; CPU:$C479 PRG:0479 85 03 lda #$03 ; CPU:$C47B PRG:047B A9 03 jmp SetActorSlotAndClear ; CPU:$C47D PRG:047D 4C 42 C3 ;=============================================================================== ; Routine: CheckCoordinateMask_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 4 instructions: increments Zp50; loads A from Zp50; ANDs A ; with $03; stores A to Zp50. ; 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, Zp50. ; ;=============================================================================== CheckCoordinateMask_Loop: inc Zp50 ; CPU:$C480 PRG:0480 E6 50 lda Zp50 ; CPU:$C482 PRG:0482 A5 50 and #$03 ; CPU:$C484 PRG:0484 29 03 sta Zp50 ; CPU:$C486 PRG:0486 85 50 ;=============================================================================== ; Routine: CheckCoordinateMask_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== CheckCoordinateMask_Loop_2: rts ; CPU:$C488 PRG:0488 60 ;=============================================================================== ; Routine: CheckCoordinateMask_Loop_3 ; Global: The routine calls InitPpuForPowerOn, ScrollScreenUp, ClearSpritesAndSetMask, SetSoundChannelCount and 3 more. ; Local: Executes 11 instructions: ANDs A with $10; stores A to Zp0E; calls ; InitPpuForPowerOn; calls ScrollScreenUp; calls ClearSpritesAndSetMask; calls SetSoundChannelCount; 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. ; ;=============================================================================== CheckCoordinateMask_Loop_3: and #$10 ; CPU:$C489 PRG:0489 29 10 sta Zp0E ; CPU:$C48B PRG:048B 85 0E jsr InitPpuForPowerOn ; CPU:$C48D PRG:048D 20 B8 C0 jsr ScrollScreenUp ; CPU:$C490 PRG:0490 20 D9 CC jsr ClearSpritesAndSetMask ; CPU:$C493 PRG:0493 20 D6 C3 jsr SetSoundChannelCount ; CPU:$C496 PRG:0496 20 8F C5 jsr RunActorScreenScript ; CPU:$C499 PRG:0499 20 AA C3 jsr MaskPpuCtrlBits ; CPU:$C49C PRG:049C 20 C3 C0 lda #$01 ; CPU:$C49F PRG:049F A9 01 sta Zp00 ; CPU:$C4A1 PRG:04A1 85 00 jmp ClearActorState ; CPU:$C4A3 PRG:04A3 4C AB C2 ; ---- data $C4A6-$C4A9 (4 bytes) ---- ; referenced by `lda $C4A6,x` at $C476 (operand $C4A6 falls inside this region) ActorPpuControlTable: .byte $40, $48, $60, $68 ; CPU:$C4A6 PRG:04A6 40 48 60 68 ;=============================================================================== ; Routine: SetPpuVramAddressOne ; Global: The routine calls SetPpuVramAddress. ; Local: Executes 2 instructions: calls SetPpuVramAddress; 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, ZpE2, PPUADDR, PPUDATA. ; ;=============================================================================== SetPpuVramAddressOne: jsr SetPpuVramAddress ; CPU:$C4AA PRG:04AA 20 BA C4 ldy #$00 ; CPU:$C4AD PRG:04AD A0 00 ;=============================================================================== ; Routine: SetPpuVramAddressOne_OnNonzero ; Global: The routine writes the PPUDATA register. ; Local: Executes 6 instructions: loads A from ((ZpE4),y); stores A to the ; PPUDATA register; increments Y; decrements ZpE2; branches on not ; equal to SetPpuVramAddressOne_OnNonzero; 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: ; A and Y, the N and Z flags, ZpE2, PPUDATA. ; ;=============================================================================== SetPpuVramAddressOne_OnNonzero: lda (ZpE4),y ; CPU:$C4AF PRG:04AF B1 E4 sta PPUDATA ; CPU:$C4B1 PRG:04B1 8D 07 20 iny ; CPU:$C4B4 PRG:04B4 C8 dec ZpE2 ; CPU:$C4B5 PRG:04B5 C6 E2 bne SetPpuVramAddressOne_OnNonzero ; CPU:$C4B7 PRG:04B7 D0 F6 rts ; CPU:$C4B9 PRG:04B9 60 ;=============================================================================== ; Routine: SetPpuVramAddress ; Global: The routine writes the PPUADDR registers, reads the PPUSTATUS ; register. ; Local: Executes 6 instructions: loads X from the PPUSTATUS register; loads X ; from ZpE1; stores X to the PPUADDR register; loads X from ZpE0; ; stores X to the PPUADDR 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 PPUADDR registers set. ; Clobbers: ; X, the N and Z flags, PPUADDR. ; ;=============================================================================== SetPpuVramAddress: ldx PPUSTATUS ; CPU:$C4BA PRG:04BA AE 02 20 ldx ZpE1 ; CPU:$C4BD PRG:04BD A6 E1 stx PPUADDR ; CPU:$C4BF PRG:04BF 8E 06 20 ldx ZpE0 ; CPU:$C4C2 PRG:04C2 A6 E0 stx PPUADDR ; CPU:$C4C4 PRG:04C4 8E 06 20 rts ; CPU:$C4C7 PRG:04C7 60 ;=============================================================================== ; Routine: SetFadeCounter ; Global: The routine reads no RAM 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 $07; stores A to ZpFB; 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, ZpFB. ; ;=============================================================================== SetFadeCounter: lda #$07 ; CPU:$C4C8 PRG:04C8 A9 07 sta ZpFB ; CPU:$C4CA PRG:04CA 85 FB rts ; CPU:$C4CC PRG:04CC 60 ;=============================================================================== ; Routine: DispatchHandlerPointerTable ; Global: The routine reads no RAM 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: shifts a left; copies A into Y; increments ; Y; pulls A; stores A to ZpE0; pulls A; 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 and C flags, ZpE0, ZpE1. ; ;=============================================================================== DispatchHandlerPointerTable: asl a ; CPU:$C4CD PRG:04CD 0A tay ; CPU:$C4CE PRG:04CE A8 iny ; CPU:$C4CF PRG:04CF C8 pla ; CPU:$C4D0 PRG:04D0 68 sta ZpE0 ; CPU:$C4D1 PRG:04D1 85 E0 pla ; CPU:$C4D3 PRG:04D3 68 sta ZpE1 ; CPU:$C4D4 PRG:04D4 85 E1 lda (ZpE0),y ; CPU:$C4D6 PRG:04D6 B1 E0 tax ; CPU:$C4D8 PRG:04D8 AA iny ; CPU:$C4D9 PRG:04D9 C8 lda (ZpE0),y ; CPU:$C4DA PRG:04DA B1 E0 sta ZpE1 ; CPU:$C4DC PRG:04DC 85 E1 stx ZpE0 ; CPU:$C4DE PRG:04DE 86 E0 jmp (ZpE0) ; CPU:$C4E0 PRG:04E0 6C E0 00 ;=============================================================================== ; Routine: RunScreenScript ; Global: The routine reads no RAM 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; shifts a left; copies A ; into Y; branches on carry clear to RunScreenScript_Loop; 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, the RAM fields it writes. ; ;=============================================================================== RunScreenScript: ldx #$FF ; CPU:$C4E3 PRG:04E3 A2 FF asl a ; CPU:$C4E5 PRG:04E5 0A tay ; CPU:$C4E6 PRG:04E6 A8 bcc RunScreenScript_Loop ; CPU:$C4E7 PRG:04E7 90 01 inx ; CPU:$C4E9 PRG:04E9 E8 ;=============================================================================== ; Routine: RunScreenScript_Loop ; Global: The routine calls RunScreenScriptRows. ; Local: Executes 11 instructions: loads A with $C2; stores A to ZpE4; loads A ; with $FF; stores A to ZpE5; loads A from ((ZpE4),y); stores A to ; ZpE2; 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. ; ;=============================================================================== RunScreenScript_Loop: lda #$C2 ; CPU:$C4EA PRG:04EA A9 C2 sta ZpE4 ; CPU:$C4EC PRG:04EC 85 E4 lda #$FF ; CPU:$C4EE PRG:04EE A9 FF sta ZpE5 ; CPU:$C4F0 PRG:04F0 85 E5 lda (ZpE4),y ; CPU:$C4F2 PRG:04F2 B1 E4 sta ZpE2 ; CPU:$C4F4 PRG:04F4 85 E2 iny ; CPU:$C4F6 PRG:04F6 C8 lda (ZpE4),y ; CPU:$C4F7 PRG:04F7 B1 E4 sta ZpE3 ; CPU:$C4F9 PRG:04F9 85 E3 txa ; CPU:$C4FB PRG:04FB 8A jmp RunScreenScriptRows ; CPU:$C4FC PRG:04FC 4C 05 C5 ; ---- data $C4FF-$C504 (6 bytes) ---- .byte $A9, $00, $F0, $02, $A9, $FF ; CPU:$C4FF PRG:04FF A9 00 F0 02 A9 FF ;=============================================================================== ; Routine: RunScreenScriptRows ; Global: The routine reads no RAM 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 ZpE4; 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. ; ;=============================================================================== RunScreenScriptRows: sta ZpE4 ; CPU:$C505 PRG:0505 85 E4 ldy #$00 ; CPU:$C507 PRG:0507 A0 00 ;=============================================================================== ; Routine: RunScreenScriptRows_OnZero ; Global: The routine calls SetPpuVramAddress. ; Local: Executes 7 instructions: loads A from ((ZpE2),y); stores A to ZpE0; ; increments Y; loads A from ((ZpE2),y); stores A to ZpE1; increments ; 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: 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, Zp01, ZpE0, ZpE1, PPUADDR, ; PPUDATA. ; ;=============================================================================== RunScreenScriptRows_OnZero: lda (ZpE2),y ; CPU:$C509 PRG:0509 B1 E2 sta ZpE0 ; CPU:$C50B PRG:050B 85 E0 iny ; CPU:$C50D PRG:050D C8 lda (ZpE2),y ; CPU:$C50E PRG:050E B1 E2 sta ZpE1 ; CPU:$C510 PRG:0510 85 E1 iny ; CPU:$C512 PRG:0512 C8 jsr SetPpuVramAddress ; CPU:$C513 PRG:0513 20 BA C4 ;=============================================================================== ; Routine: RunScreenScriptRows_OnZero_2 ; Global: The routine calls SetPpuVramAddress. ; Local: Executes 16 instructions: loads A from ((ZpE2),y); stores A to ZpE0; ; increments Y; loads A from ((ZpE2),y); stores A to ZpE1; increments ; 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, X and Y, the N, Z, C and V flags, Zp00, Zp01, ZpE0, ZpE1, PPUADDR, ; PPUDATA. ; ;=============================================================================== RunScreenScriptRows_OnZero_2: lda (ZpE2),y ; CPU:$C516 PRG:0516 B1 E2 iny ; CPU:$C518 PRG:0518 C8 cmp #$FD ; CPU:$C519 PRG:0519 C9 FD bcc RunScreenScriptRows_Loop ; CPU:$C51B PRG:051B 90 0A beq RunScreenScriptRows_Loop_3 ; CPU:$C51D PRG:051D F0 11 cmp #$FE ; CPU:$C51F PRG:051F C9 FE beq RunScreenScriptRows_OnZero ; CPU:$C521 PRG:0521 F0 E6 cmp #$FF ; CPU:$C523 PRG:0523 C9 FF beq RunScreenScriptRows_Loop_2 ; CPU:$C525 PRG:0525 F0 08 ;=============================================================================== ; Routine: RunScreenScriptRows_Loop ; Global: The routine calls RunScreenScriptRows_OnZero_2, writes the PPUDATA register. ; Local: Executes 3 instructions: ANDs A with ZpE4; stores A to the PPUDATA ; register; calls RunScreenScriptRows_OnZero_2. ; 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, Zp00, Zp01, ZpE0, ZpE1, PPUADDR, ; PPUDATA. ; ;=============================================================================== RunScreenScriptRows_Loop: and ZpE4 ; CPU:$C527 PRG:0527 25 E4 sta PPUDATA ; CPU:$C529 PRG:0529 8D 07 20 jmp RunScreenScriptRows_OnZero_2 ; CPU:$C52C PRG:052C 4C 16 C5 ;=============================================================================== ; Routine: RunScreenScriptRows_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== RunScreenScriptRows_Loop_2: rts ; CPU:$C52F PRG:052F 60 ;=============================================================================== ; Routine: RunScreenScriptRows_Loop_3 ; Global: The routine calls SetPpuVramAddress and RunScreenScriptRows_OnZero_2, writes the PPUDATA ; register. ; Local: Executes 25 instructions: loads A from ((ZpE2),y); stores A to ZpE0; ; increments Y; loads A from ((ZpE2),y); stores A to ZpE1; increments ; Y; and 19 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, Zp00, Zp01, ZpE0, ZpE1, PPUADDR, ; PPUDATA. ; ;=============================================================================== RunScreenScriptRows_Loop_3: lda (ZpE2),y ; CPU:$C530 PRG:0530 B1 E2 tax ; CPU:$C532 PRG:0532 AA iny ; CPU:$C533 PRG:0533 C8 lda (ZpE2),y ; CPU:$C534 PRG:0534 B1 E2 iny ; CPU:$C536 PRG:0536 C8 ;=============================================================================== ; Routine: RunScreenScriptRows_OnNonzero ; Global: The routine calls SetPpuVramAddress and RunScreenScriptRows_OnZero_2, writes the PPUDATA ; registers. ; Local: Executes 29 instructions: loads A from ((ZpE2),y); stores A to ZpE0; ; increments Y; loads A from ((ZpE2),y); stores A to ZpE1; increments ; Y; 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. Leaves the PPUDATA registers set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, Zp00, Zp01, ZpE0, ZpE1, PPUADDR, ; PPUDATA. ; ;=============================================================================== RunScreenScriptRows_OnNonzero: sta PPUDATA ; CPU:$C537 PRG:0537 8D 07 20 dex ; CPU:$C53A PRG:053A CA bne RunScreenScriptRows_OnNonzero ; CPU:$C53B PRG:053B D0 FA beq RunScreenScriptRows_OnZero_2 ; CPU:$C53D PRG:053D F0 D7 ;=============================================================================== ; Routine: AddToCoordinatePair ; Global: The routine reads no RAM 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; adds Zp00,x to A; ; stores A to Zp00,x; branches on carry clear to AddToCoordinatePair_Loop; increments ; Zp01,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: ; no register, the N, Z, C and V flags, Zp00, Zp01. ; ;=============================================================================== AddToCoordinatePair: clc ; CPU:$C53F PRG:053F 18 adc Zp00,x ; CPU:$C540 PRG:0540 75 00 sta Zp00,x ; CPU:$C542 PRG:0542 95 00 bcc AddToCoordinatePair_Loop ; CPU:$C544 PRG:0544 90 02 inc Zp01,x ; CPU:$C546 PRG:0546 F6 01 ;=============================================================================== ; Routine: AddToCoordinatePair_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: 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. ; ;=============================================================================== AddToCoordinatePair_Loop: rts ; CPU:$C548 PRG:0548 60 ; ---- data $C549-$C555 (13 bytes) ---- .byte $88, $B1, $E0, $91, $E2, $98, $D0, $F8, $60, $E6, $03, $E6, $02 ; CPU:$C549 PRG:0549 88 B1 E0 91 E2 98 D0 F8 60 E6 03 E6 02 ;=============================================================================== ; Routine: ClearOamBuffer ; Global: The routine reads no RAM 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 $F4; 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 and Z flags, the OAM shadow. ; ;=============================================================================== ClearOamBuffer: lda #$F4 ; CPU:$C556 PRG:0556 A9 F4 ldx #$00 ; CPU:$C558 PRG:0558 A2 00 ;=============================================================================== ; Routine: ClearOamBuffer_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 7 instructions: stores A to $0200,x; increments X; ; increments X; increments X; increments X; branches on not equal to ; ClearOamBuffer_OnNonzero; 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: ; X, the N and Z flags, the OAM shadow. ; ;=============================================================================== ClearOamBuffer_OnNonzero: sta $0200,x ; CPU:$C55A PRG:055A 9D 00 02 inx ; CPU:$C55D PRG:055D E8 inx ; CPU:$C55E PRG:055E E8 inx ; CPU:$C55F PRG:055F E8 inx ; CPU:$C560 PRG:0560 E8 bne ClearOamBuffer_OnNonzero ; CPU:$C561 PRG:0561 D0 F7 rts ; CPU:$C563 PRG:0563 60 ;=============================================================================== ; Routine: SetSoundScriptIndex ; Global: The routine reads no RAM 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 $5D; loads A from Zp03; ANDs A ; with $20; pushes the processor status; branches on equal to ; SetSoundScriptIndex_Loop; loads X with $5A. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp00, Zp64. ; ;=============================================================================== SetSoundScriptIndex: ldx #$5D ; CPU:$C564 PRG:0564 A2 5D lda Zp03 ; CPU:$C566 PRG:0566 A5 03 and #$20 ; CPU:$C568 PRG:0568 29 20 php ; CPU:$C56A PRG:056A 08 beq SetSoundScriptIndex_Loop ; CPU:$C56B PRG:056B F0 02 ldx #$5A ; CPU:$C56D PRG:056D A2 5A ;=============================================================================== ; Routine: SetSoundScriptIndex_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 $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, I and V flags, Zp00, Zp64. ; ;=============================================================================== SetSoundScriptIndex_Loop: lda #$00 ; CPU:$C56F PRG:056F A9 00 ;=============================================================================== ; Routine: SetSoundScriptIndex_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 4 instructions: stores A to Zp00,x; increments X; branches ; on not equal to SetSoundScriptIndex_OnNonzero; loads X with $FC. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, I and V flags, Zp00, Zp64. ; ;=============================================================================== SetSoundScriptIndex_OnNonzero: sta Zp00,x ; CPU:$C571 PRG:0571 95 00 inx ; CPU:$C573 PRG:0573 E8 bne SetSoundScriptIndex_OnNonzero ; CPU:$C574 PRG:0574 D0 FB ldx #$FC ; CPU:$C576 PRG:0576 A2 FC ;=============================================================================== ; Routine: SetSoundScriptIndex_OnNonzero_2 ; Global: The routine reads no RAM 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 $FEFA,x; stores A to Zp64,x; ; increments X; branches on not equal to SetSoundScriptIndex_OnNonzero_2; pulls the ; processor status; branches on not equal to SetSoundScriptIndex_Loop_2; 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 and X, the N, Z, I and V flags, Zp64. ; ;=============================================================================== SetSoundScriptIndex_OnNonzero_2: lda $FEFA,x ; CPU:$C578 PRG:0578 BD FA FE sta Zp64,x ; CPU:$C57B PRG:057B 95 64 inx ; CPU:$C57D PRG:057D E8 bne SetSoundScriptIndex_OnNonzero_2 ; CPU:$C57E PRG:057E D0 F8 plp ; CPU:$C580 PRG:0580 28 bne SetSoundScriptIndex_Loop_2 ; CPU:$C581 PRG:0581 D0 01 rts ; CPU:$C583 PRG:0583 60 ;=============================================================================== ; Routine: SetSoundScriptIndex_Loop_2 ; Global: The routine reads no RAM 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 $20. ; 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. ; ;=============================================================================== SetSoundScriptIndex_Loop_2: ldx #$20 ; CPU:$C584 PRG:0584 A2 20 ;=============================================================================== ; Routine: SetSoundScriptIndex_OnNonzero_3 ; Global: The routine reads no RAM 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 Zp5F,x; stores A to $00FF,x; ; decrements X; branches on not equal to SetSoundScriptIndex_OnNonzero_3; 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 and Z flags. ; ;=============================================================================== SetSoundScriptIndex_OnNonzero_3: lda Zp5F,x ; CPU:$C586 PRG:0586 B5 5F sta a:$00FF,x ; CPU:$C588 PRG:0588 9D FF 00 dex ; CPU:$C58B PRG:058B CA bne SetSoundScriptIndex_OnNonzero_3 ; CPU:$C58C PRG:058C D0 F8 rts ; CPU:$C58E PRG:058E 60 ;=============================================================================== ; Routine: SetSoundChannelCount ; Global: The routine reads no RAM 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 $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 and X, the N and Z flags, the OAM shadow. ; ;=============================================================================== SetSoundChannelCount: ldx #$07 ; CPU:$C58F PRG:058F A2 07 ;=============================================================================== ; Routine: SetSoundChannelCount_OnNonnegative ; Global: The routine writes $0200 and $0204. ; Local: Executes 9 instructions: loads A from $C5A6,x; stores A to $0200,x; ; decrements X; branches on non-negative to SetSoundChannelCount_OnNonnegative; loads X from ; Zp50; loads A from $C5AE,x; 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 $0200 and $0204 changed. ; Clobbers: ; A and X, the N and Z flags, the OAM shadow. ; ;=============================================================================== SetSoundChannelCount_OnNonnegative: lda $C5A6,x ; CPU:$C591 PRG:0591 BD A6 C5 sta $0200,x ; CPU:$C594 PRG:0594 9D 00 02 dex ; CPU:$C597 PRG:0597 CA bpl SetSoundChannelCount_OnNonnegative ; CPU:$C598 PRG:0598 10 F7 ldx Zp50 ; CPU:$C59A PRG:059A A6 50 lda $C5AE,x ; CPU:$C59C PRG:059C BD AE C5 sta $0200 ; CPU:$C59F PRG:059F 8D 00 02 sta $0204 ; CPU:$C5A2 PRG:05A2 8D 04 02 rts ; CPU:$C5A5 PRG:05A5 60 ; ---- data $C5A6-$C5B1 (12 bytes) ---- ; referenced by `lda $C5A6,x` at $C591 (operand $C5A6 falls inside this region) ; referenced by `lda $C5AE,x` at $C59C (operand $C5AE falls inside this region) ActorOamSpriteTemplate: .byte $00, $B0, $00, $4E, $00, $B1, $00, $56 ; CPU:$C5A6 PRG:05A6 00 B0 00 4E 00 B1 00 56 ActorSpriteYTable: .byte $A8, $B0, $B8, $C0 ; CPU:$C5AE PRG:05AE A8 B0 B8 C0 ;=============================================================================== ; Routine: SetSoundEffectIndex ; Global: The routine reads no RAM 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 $03; stores A to ZpEF. ; 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. ; ;=============================================================================== SetSoundEffectIndex: lda #$03 ; CPU:$C5B2 PRG:05B2 A9 03 sta ZpEF ; CPU:$C5B4 PRG:05B4 85 EF ;=============================================================================== ; Routine: SetSoundEffectIndex_OnNonnegative ; Global: The routine calls RunScreenScript. ; Local: Executes 7 instructions: loads A from ZpEF; clears the carry flag; ; adds $0E to A; calls RunScreenScript; decrements ZpEF; branches on ; non-negative to SetSoundEffectIndex_OnNonnegative; 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. ; ;=============================================================================== SetSoundEffectIndex_OnNonnegative: lda ZpEF ; CPU:$C5B6 PRG:05B6 A5 EF clc ; CPU:$C5B8 PRG:05B8 18 adc #$0E ; CPU:$C5B9 PRG:05B9 69 0E jsr RunScreenScript ; CPU:$C5BB PRG:05BB 20 E3 C4 dec ZpEF ; CPU:$C5BE PRG:05BE C6 EF bpl SetSoundEffectIndex_OnNonnegative ; CPU:$C5C0 PRG:05C0 10 F4 rts ; CPU:$C5C2 PRG:05C2 60 ;=============================================================================== ; Routine: RunScreenScriptByIndex ; Global: The routine calls RunScreenScript. ; Local: Executes 4 instructions: loads A from Zp50; clears the carry flag; ; adds $8E to A; calls RunScreenScript. ; 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. ; ;=============================================================================== RunScreenScriptByIndex: lda Zp50 ; CPU:$C5C3 PRG:05C3 A5 50 clc ; CPU:$C5C5 PRG:05C5 18 adc #$8E ; CPU:$C5C6 PRG:05C6 69 8E jmp RunScreenScript ; CPU:$C5C8 PRG:05C8 4C E3 C4 ;=============================================================================== ; Routine: RunScreenScriptFive ; Global: The routine calls SetPpuCtrlPatternBit, SetSoundVramAddress and RunScreenScript. ; Local: Executes 9 instructions: calls SetPpuCtrlPatternBit; calls SetSoundVramAddress; loads A with ; $00; calls RunScreenScript; loads A from Zp03; adds Zp03 to 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: 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. ; ;=============================================================================== RunScreenScriptFive: jsr SetPpuCtrlPatternBit ; CPU:$C5CB PRG:05CB 20 14 D7 jsr SetSoundVramAddress ; CPU:$C5CE PRG:05CE 20 75 D5 lda #$00 ; CPU:$C5D1 PRG:05D1 A9 00 jsr RunScreenScript ; CPU:$C5D3 PRG:05D3 20 E3 C4 lda Zp03 ; CPU:$C5D6 PRG:05D6 A5 03 adc Zp03 ; CPU:$C5D8 PRG:05D8 65 03 bpl RunScreenScriptFive_Loop ; CPU:$C5DA PRG:05DA 10 04 and #$40 ; CPU:$C5DC PRG:05DC 29 40 beq RunScreenScriptFive_Loop_2 ; CPU:$C5DE PRG:05DE F0 0C ;=============================================================================== ; Routine: RunScreenScriptFive_Loop ; Global: The routine calls RunScreenScript and WriteAttributeBytesHigh. ; Local: Executes 5 instructions: loads A with $02; calls RunScreenScript; loads A ; from Zp03; EORs A with $80; calls WriteAttributeBytesHigh. ; 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. ; ;=============================================================================== RunScreenScriptFive_Loop: lda #$02 ; CPU:$C5E0 PRG:05E0 A9 02 jsr RunScreenScript ; CPU:$C5E2 PRG:05E2 20 E3 C4 lda Zp03 ; CPU:$C5E5 PRG:05E5 A5 03 eor #$80 ; CPU:$C5E7 PRG:05E7 49 80 jsr WriteAttributeBytesHigh ; CPU:$C5E9 PRG:05E9 20 F7 C5 ;=============================================================================== ; Routine: RunScreenScriptFive_Loop_2 ; Global: The routine calls WriteScoreAttributeBytes, WriteAttributeBytesRow and WriteAttributeBytesLow. ; Local: Executes 4 instructions: calls WriteScoreAttributeBytes; calls WriteAttributeBytesRow; calls ; WriteAttributeBytesLow; loads A from 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. ; ;=============================================================================== RunScreenScriptFive_Loop_2: jsr WriteScoreAttributeBytes ; CPU:$C5EC PRG:05EC 20 7B C6 jsr WriteAttributeBytesRow ; CPU:$C5EF PRG:05EF 20 2D C6 jsr WriteAttributeBytesLow ; CPU:$C5F2 PRG:05F2 20 06 C6 lda Zp03 ; CPU:$C5F5 PRG:05F5 A5 03 ;=============================================================================== ; Routine: WriteAttributeBytesHigh ; Global: The routine calls WriteAttributeRun. ; Local: Executes 7 instructions: branches on negative to WriteAttributeBytesLow_Loop; loads A ; with $65; stores A to ZpE0; loads A with $20; stores A to ZpE1; ; loads Y with $5D; 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, ZpE0, ZpE1, PPUADDR, PPUDATA. ; ;=============================================================================== WriteAttributeBytesHigh: bmi WriteAttributeBytesLow_Loop; CPU:$C5F7 PRG:05F7 30 1A lda #$65 ; CPU:$C5F9 PRG:05F9 A9 65 sta ZpE0 ; CPU:$C5FB PRG:05FB 85 E0 lda #$20 ; CPU:$C5FD PRG:05FD A9 20 sta ZpE1 ; CPU:$C5FF PRG:05FF 85 E1 ldy #$5D ; CPU:$C601 PRG:0601 A0 5D jmp WriteAttributeRun ; CPU:$C603 PRG:0603 4C 1D C6 ;=============================================================================== ; Routine: WriteAttributeBytesLow ; Global: The routine calls WriteAttributeRun. ; Local: Executes 6 instructions: loads A with $6F; stores A to ZpE0; loads A ; with $20; stores A to ZpE1; loads Y with $57; calls WriteAttributeRun. ; 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, ZpE0, ZpE1, PPUADDR, PPUDATA. ; ;=============================================================================== WriteAttributeBytesLow: lda #$6F ; CPU:$C606 PRG:0606 A9 6F sta ZpE0 ; CPU:$C608 PRG:0608 85 E0 lda #$20 ; CPU:$C60A PRG:060A A9 20 sta ZpE1 ; CPU:$C60C PRG:060C 85 E1 ldy #$57 ; CPU:$C60E PRG:060E A0 57 jmp WriteAttributeRun ; CPU:$C610 PRG:0610 4C 1D C6 ;=============================================================================== ; Routine: WriteAttributeBytesLow_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: loads A with $85; stores A to ZpE0; loads A ; with $20; stores A to ZpE1; loads Y with $5A. ; 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, ZpE0, ZpE1, PPUADDR, PPUDATA. ; ;=============================================================================== WriteAttributeBytesLow_Loop: lda #$85 ; CPU:$C613 PRG:0613 A9 85 sta ZpE0 ; CPU:$C615 PRG:0615 85 E0 lda #$20 ; CPU:$C617 PRG:0617 A9 20 sta ZpE1 ; CPU:$C619 PRG:0619 85 E1 ldy #$5A ; CPU:$C61B PRG:061B A0 5A ;=============================================================================== ; Routine: WriteAttributeRun ; Global: The routine calls SetPpuVramAddress. ; Local: Executes 2 instructions: calls SetPpuVramAddress; 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, X and Y, the N, Z and C flags, PPUADDR, PPUDATA. ; ;=============================================================================== WriteAttributeRun: jsr SetPpuVramAddress ; CPU:$C61D PRG:061D 20 BA C4 ldx #$03 ; CPU:$C620 PRG:0620 A2 03 ;=============================================================================== ; Routine: WriteAttributeRun_OnNonzero ; Global: The routine calls WriteAttributeNibble. ; Local: Executes 6 instructions: loads A from Zp02,y; calls WriteAttributeNibble; ; decrements Y; decrements X; branches on not equal to WriteAttributeRun_OnNonzero; ; 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 and C flags, PPUDATA. ; ;=============================================================================== WriteAttributeRun_OnNonzero: lda a:Zp02,y ; CPU:$C622 PRG:0622 B9 02 00 jsr WriteAttributeNibble ; CPU:$C625 PRG:0625 20 3A C6 dey ; CPU:$C628 PRG:0628 88 dex ; CPU:$C629 PRG:0629 CA bne WriteAttributeRun_OnNonzero; CPU:$C62A PRG:062A D0 F6 rts ; CPU:$C62C PRG:062C 60 ;=============================================================================== ; Routine: WriteAttributeBytesRow ; Global: The routine reads no RAM 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 $7C; stores A to ZpE0; loads A ; with $20; stores A to ZpE1; loads A from Zp61. ; 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, ZpE0, ZpE1, PPUADDR, PPUDATA. ; ;=============================================================================== WriteAttributeBytesRow: lda #$7C ; CPU:$C62D PRG:062D A9 7C sta ZpE0 ; CPU:$C62F PRG:062F 85 E0 lda #$20 ; CPU:$C631 PRG:0631 A9 20 sta ZpE1 ; CPU:$C633 PRG:0633 85 E1 lda Zp61 ; CPU:$C635 PRG:0635 A5 61 ;=============================================================================== ; Routine: SetPpuVramAddressTwo ; Global: The routine calls SetPpuVramAddress. ; Local: Executes 1 instruction: calls SetPpuVramAddress. ; 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, PPUADDR, PPUDATA. ; ;=============================================================================== SetPpuVramAddressTwo: jsr SetPpuVramAddress ; CPU:$C637 PRG:0637 20 BA C4 ;=============================================================================== ; Routine: WriteAttributeNibble ; Global: The routine calls WriteAttributeByte. ; Local: Executes 7 instructions: pushes A; shifts a right; shifts a right; ; shifts a right; shifts a right; calls WriteAttributeByte; 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, Z and C flags, PPUDATA. ; ;=============================================================================== WriteAttributeNibble: pha ; CPU:$C63A PRG:063A 48 lsr a ; CPU:$C63B PRG:063B 4A lsr a ; CPU:$C63C PRG:063C 4A lsr a ; CPU:$C63D PRG:063D 4A lsr a ; CPU:$C63E PRG:063E 4A jsr WriteAttributeByte ; CPU:$C63F PRG:063F 20 43 C6 pla ; CPU:$C642 PRG:0642 68 ;=============================================================================== ; Routine: WriteAttributeByte ; Global: The routine writes the PPUDATA register. ; Local: Executes 3 instructions: ANDs A with $0F; ORs A with $30; stores A to ; the PPUDATA 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 PPUDATA register set. ; Clobbers: ; no register, the N and Z flags, PPUDATA. ; ;=============================================================================== WriteAttributeByte: and #$0F ; CPU:$C643 PRG:0643 29 0F ora #$30 ; CPU:$C645 PRG:0645 09 30 sta PPUDATA ; CPU:$C647 PRG:0647 8D 07 20 ;=============================================================================== ; Routine: WriteAttributeByte_OnCarrySet ; Global: The routine reads no RAM 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. ; ;=============================================================================== WriteAttributeByte_OnCarrySet: rts ; CPU:$C64A PRG:064A 60 ;=============================================================================== ; Routine: DispatchSecondaryState ; Global: The routine calls SetSoundVramAddress and DispatchHandlerPointerTable. ; Local: Executes 8 instructions: returns with RTS; calls SetSoundVramAddress; loads A ; from Zp03; rotates a right; branches on carry set to WriteAttributeByte_OnCarrySet; ; loads A from Zp09; 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, Zp7E, Zp7F, ZpE0, ZpE1, PPUADDR, ; PPUDATA. ; ;=============================================================================== DispatchSecondaryState: jsr SetSoundVramAddress ; CPU:$C64B PRG:064B 20 75 D5 lda Zp03 ; CPU:$C64E PRG:064E A5 03 ror a ; CPU:$C650 PRG:0650 6A bcs WriteAttributeByte_OnCarrySet ; CPU:$C651 PRG:0651 B0 F7 lda Zp09 ; CPU:$C653 PRG:0653 A5 09 and #$03 ; CPU:$C655 PRG:0655 29 03 jsr DispatchHandlerPointerTable; CPU:$C657 PRG:0657 20 CD C4 ; ---- data $C65A-$C661 (8 bytes) ---- ActorBehaviourPointerTable: .byte $06, $C6, $F5, $C5, $7B, $C6, $62, $C6 ; CPU:$C65A PRG:065A 06 C6 F5 C5 7B C6 62 C6 ;=============================================================================== ; Routine: SetAttributeMask ; Global: The routine reads no RAM 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 $1F; stores A to ZpE4; loads X ; with $01; loads A from Zp09; ANDs A with $20; branches on equal to ; SetAttributeMask_Loop; 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. ; ;=============================================================================== SetAttributeMask: lda #$1F ; CPU:$C662 PRG:0662 A9 1F sta ZpE4 ; CPU:$C664 PRG:0664 85 E4 ldx #$01 ; CPU:$C666 PRG:0666 A2 01 lda Zp09 ; CPU:$C668 PRG:0668 A5 09 and #$20 ; CPU:$C66A PRG:066A 29 20 beq SetAttributeMask_Loop ; CPU:$C66C PRG:066C F0 02 ldx #$81 ; CPU:$C66E PRG:066E A2 81 ;=============================================================================== ; Routine: SetAttributeMask_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 4 instructions: loads A from Zp03; ANDs A with $80; branches ; on equal to SetAttributeMask_Loop_2; 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, the RAM fields it writes. ; ;=============================================================================== SetAttributeMask_Loop: lda Zp03 ; CPU:$C670 PRG:0670 A5 03 and #$80 ; CPU:$C672 PRG:0672 29 80 beq SetAttributeMask_Loop_2 ; CPU:$C674 PRG:0674 F0 01 inx ; CPU:$C676 PRG:0676 E8 ;=============================================================================== ; Routine: SetAttributeMask_Loop_2 ; Global: The routine calls RunScreenScript. ; Local: Executes 2 instructions: copies X into A; calls RunScreenScript. ; 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. ; ;=============================================================================== SetAttributeMask_Loop_2: txa ; CPU:$C677 PRG:0677 8A jmp RunScreenScript ; CPU:$C678 PRG:0678 4C E3 C4 ;=============================================================================== ; Routine: WriteScoreAttributeBytes ; Global: The routine reads no RAM 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 with $9D; stores A to ZpE0; loads A ; with $20; stores A to ZpE1; loads A from Zp60; stores A to ZpE3; ; 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 RAM fields it writes. ; ;=============================================================================== WriteScoreAttributeBytes: lda #$9D ; CPU:$C67B PRG:067B A9 9D sta ZpE0 ; CPU:$C67D PRG:067D 85 E0 lda #$20 ; CPU:$C67F PRG:067F A9 20 sta ZpE1 ; CPU:$C681 PRG:0681 85 E1 lda Zp60 ; CPU:$C683 PRG:0683 A5 60 sta ZpE3 ; CPU:$C685 PRG:0685 85 E3 lda #$05 ; CPU:$C687 PRG:0687 A9 05 sta ZpE2 ; CPU:$C689 PRG:0689 85 E2 ldy #$19 ; CPU:$C68B PRG:068B A0 19 ;=============================================================================== ; Routine: WriteScoreAttributeBytes_OnNonnegative ; Global: The routine reads no RAM 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 ZpE3; branches on non-negative to ; WriteScoreAttributeBytes_Loop; 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, X and Y, the N, Z, C and V flags, Zp00, Zp01, ZpE2, ZpE3, PPUADDR, ; PPUDATA. ; ;=============================================================================== WriteScoreAttributeBytes_OnNonnegative: dec ZpE3 ; CPU:$C68D PRG:068D C6 E3 bpl WriteScoreAttributeBytes_Loop ; CPU:$C68F PRG:068F 10 02 ldy #$00 ; CPU:$C691 PRG:0691 A0 00 ;=============================================================================== ; Routine: WriteScoreAttributeBytes_Loop ; Global: The routine calls SetPpuVramAddress, writes the PPUDATA register. ; Local: Executes 13 instructions: decrements ZpE3; branches on non-negative ; to WriteScoreAttributeBytes_Loop; loads Y with $00; calls SetPpuVramAddress; stores Y to the ; PPUDATA register; loads X with $E0; 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, Zp00, Zp01, ZpE2, ZpE3, PPUADDR, ; PPUDATA. ; ;=============================================================================== WriteScoreAttributeBytes_Loop: jsr SetPpuVramAddress ; CPU:$C693 PRG:0693 20 BA C4 sty PPUDATA ; CPU:$C696 PRG:0696 8C 07 20 ldx #$E0 ; CPU:$C699 PRG:0699 A2 E0 lda #$01 ; CPU:$C69B PRG:069B A9 01 eor #$FF ; CPU:$C69D PRG:069D 49 FF sec ; CPU:$C69F PRG:069F 38 adc Zp00,x ; CPU:$C6A0 PRG:06A0 75 00 sta Zp00,x ; CPU:$C6A2 PRG:06A2 95 00 bcs WriteScoreAttributeBytes_Loop_2 ; CPU:$C6A4 PRG:06A4 B0 02 dec Zp01,x ; CPU:$C6A6 PRG:06A6 D6 01 ;=============================================================================== ; Routine: WriteScoreAttributeBytes_Loop_2 ; Global: The routine calls SetPpuVramAddress, writes the PPUDATA register. ; Local: Executes 16 instructions: decrements ZpE3; branches on non-negative ; to WriteScoreAttributeBytes_Loop; loads Y with $00; calls SetPpuVramAddress; stores Y to the ; PPUDATA register; loads X with $E0; 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. Leaves the PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, Zp00, Zp01, ZpE2, ZpE3, PPUADDR, ; PPUDATA. ; ;=============================================================================== WriteScoreAttributeBytes_Loop_2: dec ZpE2 ; CPU:$C6A8 PRG:06A8 C6 E2 bpl WriteScoreAttributeBytes_OnNonnegative ; CPU:$C6AA PRG:06AA 10 E1 rts ; CPU:$C6AC PRG:06AC 60 ;=============================================================================== ; Routine: RunScreenScriptWithOffset ; Global: The routine calls RunScreenScript, AddToCoordinatePair and SetPpuVramAddress, writes the ; PPUDATA register. ; Local: Executes 9 instructions: calls RunScreenScript; loads Y from Zp03; branches ; on non-negative to RunScreenScriptWithOffset_Loop; loads Y with $32; loads A with $07; ; loads X with $E0; 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 the PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== RunScreenScriptWithOffset: jsr RunScreenScript ; CPU:$C6AD PRG:06AD 20 E3 C4 ldy Zp03 ; CPU:$C6B0 PRG:06B0 A4 03 bpl RunScreenScriptWithOffset_Loop ; CPU:$C6B2 PRG:06B2 10 0F ldy #$32 ; CPU:$C6B4 PRG:06B4 A0 32 lda #$07 ; CPU:$C6B6 PRG:06B6 A9 07 ldx #$E0 ; CPU:$C6B8 PRG:06B8 A2 E0 jsr AddToCoordinatePair ; CPU:$C6BA PRG:06BA 20 3F C5 jsr SetPpuVramAddress ; CPU:$C6BD PRG:06BD 20 BA C4 sty PPUDATA ; CPU:$C6C0 PRG:06C0 8C 07 20 ;=============================================================================== ; Routine: RunScreenScriptWithOffset_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: 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. ; ;=============================================================================== RunScreenScriptWithOffset_Loop: rts ; CPU:$C6C3 PRG:06C3 60 ;=============================================================================== ; Routine: SelectAttributeRow ; Global: The routine reads no RAM 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 with $00; stores A to ZpE9; loads A ; from Zp03; shifts a left; branches on non-negative to SelectAttributeRow_Loop_2; ; loads A with $5D; 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. ; ;=============================================================================== SelectAttributeRow: lda #$00 ; CPU:$C6C4 PRG:06C4 A9 00 sta ZpE9 ; CPU:$C6C6 PRG:06C6 85 E9 lda Zp03 ; CPU:$C6C8 PRG:06C8 A5 03 asl a ; CPU:$C6CA PRG:06CA 0A bpl SelectAttributeRow_Loop_2 ; CPU:$C6CB PRG:06CB 10 25 lda #$5D ; CPU:$C6CD PRG:06CD A9 5D bcc SelectAttributeRow_Loop ; CPU:$C6CF PRG:06CF 90 02 lda #$5A ; CPU:$C6D1 PRG:06D1 A9 5A ;=============================================================================== ; Routine: SelectAttributeRow_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: stores A to ZpEC; loads Y with $00; stores Y ; to ZpED; loads X with $03; 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: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== SelectAttributeRow_Loop: sta ZpEC ; CPU:$C6D3 PRG:06D3 85 EC ldy #$00 ; CPU:$C6D5 PRG:06D5 A0 00 sty ZpED ; CPU:$C6D7 PRG:06D7 84 ED ldx #$03 ; CPU:$C6D9 PRG:06D9 A2 03 clc ; CPU:$C6DB PRG:06DB 18 ;=============================================================================== ; Routine: SelectAttributeRow_OnNonzero ; Global: The routine calls ComputeAttributeValue. ; Local: Executes 9 instructions: loads A from ((ZpEC),y); calls ComputeAttributeValue; ; stores A to ((ZpEC),y); increments Y; decrements X; branches on not ; equal to SelectAttributeRow_OnNonzero; 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. ; ;=============================================================================== SelectAttributeRow_OnNonzero: lda (ZpEC),y ; CPU:$C6DC PRG:06DC B1 EC jsr ComputeAttributeValue ; CPU:$C6DE PRG:06DE 20 F7 C6 sta (ZpEC),y ; CPU:$C6E1 PRG:06E1 91 EC iny ; CPU:$C6E3 PRG:06E3 C8 dex ; CPU:$C6E4 PRG:06E4 CA bne SelectAttributeRow_OnNonzero ; CPU:$C6E5 PRG:06E5 D0 F5 bcc ComputeAttributeValue_Loop_4 ; CPU:$C6E7 PRG:06E7 90 38 ldx #$02 ; CPU:$C6E9 PRG:06E9 A2 02 lda #$99 ; CPU:$C6EB PRG:06EB A9 99 ;=============================================================================== ; Routine: SelectAttributeRow_OnNonnegative ; Global: The routine reads no RAM 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 Zp57,x; decrements X; branches ; on non-negative to SelectAttributeRow_OnNonnegative. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no 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 and Z flags, Zp57. ; ;=============================================================================== SelectAttributeRow_OnNonnegative: sta Zp57,x ; CPU:$C6ED PRG:06ED 95 57 dex ; CPU:$C6EF PRG:06EF CA bpl SelectAttributeRow_OnNonnegative ; CPU:$C6F0 PRG:06F0 10 FB ;=============================================================================== ; Routine: SelectAttributeRow_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== SelectAttributeRow_Loop_2: rts ; CPU:$C6F2 PRG:06F2 60 ;=============================================================================== ; Routine: SetAttributeColumn ; Global: The routine reads no RAM 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 X to ZpE8; 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, C and V flags, ZpE8, ZpEE, ZpEF. ; ;=============================================================================== SetAttributeColumn: stx ZpE8 ; CPU:$C6F3 PRG:06F3 86 E8 ldx #$00 ; CPU:$C6F5 PRG:06F5 A2 00 ;=============================================================================== ; Routine: ComputeAttributeValue ; Global: The routine reads no RAM 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 ZpEF; ANDs A with $F0; stores A ; to ZpEE; EORs A with ZpEF; stores A to ZpEF; loads A from ZpE8,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, the N, Z, C and V flags, ZpEE, ZpEF. ; ;=============================================================================== ComputeAttributeValue: sta ZpEF ; CPU:$C6F7 PRG:06F7 85 EF and #$F0 ; CPU:$C6F9 PRG:06F9 29 F0 sta ZpEE ; CPU:$C6FB PRG:06FB 85 EE eor ZpEF ; CPU:$C6FD PRG:06FD 45 EF sta ZpEF ; CPU:$C6FF PRG:06FF 85 EF lda ZpE8,x ; CPU:$C701 PRG:0701 B5 E8 and #$0F ; CPU:$C703 PRG:0703 29 0F adc ZpEF ; CPU:$C705 PRG:0705 65 EF cmp #$0A ; CPU:$C707 PRG:0707 C9 0A bcc ComputeAttributeValue_Loop ; CPU:$C709 PRG:0709 90 02 adc #$05 ; CPU:$C70B PRG:070B 69 05 ;=============================================================================== ; Routine: ComputeAttributeValue_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 8 instructions: adds ZpEE to A; stores A to ZpEE; loads A ; from ZpE8,x; ANDs A with $F0; adds ZpEE to A; branches on carry set ; to ComputeAttributeValue_Loop_2; 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, ZpEE. ; ;=============================================================================== ComputeAttributeValue_Loop: adc ZpEE ; CPU:$C70D PRG:070D 65 EE sta ZpEE ; CPU:$C70F PRG:070F 85 EE lda ZpE8,x ; CPU:$C711 PRG:0711 B5 E8 and #$F0 ; CPU:$C713 PRG:0713 29 F0 adc ZpEE ; CPU:$C715 PRG:0715 65 EE bcs ComputeAttributeValue_Loop_2 ; CPU:$C717 PRG:0717 B0 04 cmp #$A0 ; CPU:$C719 PRG:0719 C9 A0 bcc ComputeAttributeValue_Loop_3 ; CPU:$C71B PRG:071B 90 03 ;=============================================================================== ; Routine: ComputeAttributeValue_Loop_2 ; Global: The routine reads no RAM 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: subtracts $A0 from A; sets 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: ; no register, the N, Z, C and V flags. ; ;=============================================================================== ComputeAttributeValue_Loop_2: sbc #$A0 ; CPU:$C71D PRG:071D E9 A0 sec ; CPU:$C71F PRG:071F 38 ;=============================================================================== ; Routine: ComputeAttributeValue_Loop_3 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ComputeAttributeValue_Loop_3: rts ; CPU:$C720 PRG:0720 60 ;=============================================================================== ; Routine: ComputeAttributeValue_Loop_4 ; Global: The routine calls SetAttributeColumn. ; Local: Executes 8 instructions: compares A with Zp62; branches on carry ; clear to ComputeAttributeValue_Loop_6; loads X with $04; loads A from Zp62; clears the ; carry flag; calls SetAttributeColumn; 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. ; ;=============================================================================== ComputeAttributeValue_Loop_4: cmp Zp62 ; CPU:$C721 PRG:0721 C5 62 bcc ComputeAttributeValue_Loop_6 ; CPU:$C723 PRG:0723 90 15 ldx #$04 ; CPU:$C725 PRG:0725 A2 04 lda Zp62 ; CPU:$C727 PRG:0727 A5 62 clc ; CPU:$C729 PRG:0729 18 jsr SetAttributeColumn ; CPU:$C72A PRG:072A 20 F3 C6 bcc ComputeAttributeValue_Loop_5 ; CPU:$C72D PRG:072D 90 02 lda #$FF ; CPU:$C72F PRG:072F A9 FF ;=============================================================================== ; Routine: ComputeAttributeValue_Loop_5 ; Global: The routine calls PlaySoundEffectById. ; Local: Executes 4 instructions: stores A to Zp62; increments Zp60; loads A ; with $06; calls PlaySoundEffectById. ; 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. ; ;=============================================================================== ComputeAttributeValue_Loop_5: sta Zp62 ; CPU:$C731 PRG:0731 85 62 inc Zp60 ; CPU:$C733 PRG:0733 E6 60 lda #$06 ; CPU:$C735 PRG:0735 A9 06 jsr PlaySoundEffectById ; CPU:$C737 PRG:0737 20 0D F8 ;=============================================================================== ; Routine: ComputeAttributeValue_Loop_6 ; Global: The routine reads no RAM 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 $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 Y, the N, Z and C flags. ; ;=============================================================================== ComputeAttributeValue_Loop_6: ldy #$02 ; CPU:$C73A PRG:073A A0 02 ;=============================================================================== ; Routine: ComputeAttributeValue_OnNonnegative ; Global: The routine reads no RAM 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 Zp57,y; compares A with ; ((ZpEC),y); branches on carry clear to ComputeAttributeValue_Loop_7; branches on not ; equal to ComputeAttributeValue_Loop_8; decrements Y; branches on non-negative to ; ComputeAttributeValue_OnNonnegative. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== ComputeAttributeValue_OnNonnegative: lda a:Zp57,y ; CPU:$C73C PRG:073C B9 57 00 cmp (ZpEC),y ; CPU:$C73F PRG:073F D1 EC bcc ComputeAttributeValue_Loop_7 ; CPU:$C741 PRG:0741 90 05 bne ComputeAttributeValue_Loop_8 ; CPU:$C743 PRG:0743 D0 0D dey ; CPU:$C745 PRG:0745 88 bpl ComputeAttributeValue_OnNonnegative ; CPU:$C746 PRG:0746 10 F4 ;=============================================================================== ; Routine: ComputeAttributeValue_Loop_7 ; Global: The routine reads no RAM 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 $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 Y, the N and Z flags. ; ;=============================================================================== ComputeAttributeValue_Loop_7: ldy #$02 ; CPU:$C748 PRG:0748 A0 02 ;=============================================================================== ; Routine: ComputeAttributeValue_OnNonnegative_2 ; Global: The routine reads no RAM 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 ((ZpEC),y); stores A to Zp57,y; ; decrements Y; branches on non-negative to ComputeAttributeValue_OnNonnegative_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== ComputeAttributeValue_OnNonnegative_2: lda (ZpEC),y ; CPU:$C74A PRG:074A B1 EC sta a:Zp57,y ; CPU:$C74C PRG:074C 99 57 00 dey ; CPU:$C74F PRG:074F 88 bpl ComputeAttributeValue_OnNonnegative_2 ; CPU:$C750 PRG:0750 10 F8 ;=============================================================================== ; Routine: ComputeAttributeValue_Loop_8 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ComputeAttributeValue_Loop_8: rts ; CPU:$C752 PRG:0752 60 ;=============================================================================== ; Routine: DrawTitleScreenText ; Global: The routine calls RunScreenScript and SetPpuMaskValue. ; Local: Executes 7 instructions: loads A with $0A; calls RunScreenScript; loads A ; with $09; calls RunScreenScript; calls SetPpuMaskValue; 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: 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. ; ;=============================================================================== DrawTitleScreenText: lda #$0A ; CPU:$C753 PRG:0753 A9 0A jsr RunScreenScript ; CPU:$C755 PRG:0755 20 E3 C4 lda #$09 ; CPU:$C758 PRG:0758 A9 09 jsr RunScreenScript ; CPU:$C75A PRG:075A 20 E3 C4 jsr SetPpuMaskValue ; CPU:$C75D PRG:075D 20 CB C0 lda #$00 ; CPU:$C760 PRG:0760 A9 00 rts ; CPU:$C762 PRG:0762 60 ; ---- data $C763-$C819 (183 bytes) ---- MenuTextTable: .byte $8B, $21, $43, $4F, $4E, $54, $49, $4E, $55, $45, $FF, $6C, $20, $48, $49, $16 ; CPU:$C763 PRG:0763 8B 21 43 4F 4E 54 49 4E 55 45 FF 6C 20 48 49 16 .byte $FE, $76, $20, $53, $54, $41, $47, $45, $16, $FE, $8C, $20, $F0, $F1, $D3, $84 ; CPU:$C773 PRG:0773 FE 76 20 53 54 41 47 45 16 FE 8C 20 F0 F1 D3 84 .byte $8F, $16, $FE, $62, $20, $31, $50, $16, $FF, $82, $20, $32, $50, $16, $FF, $EB ; CPU:$C783 PRG:0783 8F 16 FE 62 20 31 50 16 FF 82 20 32 50 16 FF EB .byte $21, $53, $54, $41, $47, $45, $00, $00, $00, $FF, $6B, $22, $50, $4C, $41, $59 ; CPU:$C793 PRG:0793 21 53 54 41 47 45 00 00 00 FF 6B 22 50 4C 41 59 .byte $00, $53, $45, $4C, $45, $43, $54, $FE, $AA, $20, $3A, $00, $31, $39, $38, $36 ; CPU:$C7A3 PRG:07A3 00 53 45 4C 45 43 54 FE AA 20 3A 00 31 39 38 36 .byte $00, $4B, $4F, $4E, $41, $4D, $49, $FE, $0A, $22, $00, $42, $59, $40, $53, $4F ; CPU:$C7B3 PRG:07B3 00 4B 4F 4E 41 4D 49 FE 0A 22 00 42 59 40 53 4F .byte $46, $54, $40, $50, $52, $4F, $FE, $AC, $22, $31, $00, $50, $4C, $41, $59, $45 ; CPU:$C7C3 PRG:07C3 46 54 40 50 52 4F FE AC 22 31 00 50 4C 41 59 45 .byte $52, $00, $00, $41, $FF, $CC, $22, $31, $00, $50, $4C, $41, $59, $45, $52, $00 ; CPU:$C7D3 PRG:07D3 52 00 00 41 FF CC 22 31 00 50 4C 41 59 45 52 00 .byte $00, $42, $FF, $EC, $22, $32, $00, $50, $4C, $41, $59, $45, $52, $53, $00, $41 ; CPU:$C7E3 PRG:07E3 00 42 FF EC 22 32 00 50 4C 41 59 45 52 53 00 41 .byte $FF, $0C, $23, $32, $00, $50, $4C, $41, $59, $45, $52, $53, $00, $42, $FF, $8A ; CPU:$C7F3 PRG:07F3 FF 0C 23 32 00 50 4C 41 59 45 52 53 00 42 FF 8A .byte $21, $47, $41, $4D, $45, $00, $00, $4F, $56, $45, $52, $FE, $EB, $21, $50, $4C ; CPU:$C803 PRG:0803 21 47 41 4D 45 00 00 4F 56 45 52 FE EB 21 50 4C .byte $41, $59, $45, $52, $00, $31, $FF ; CPU:$C813 PRG:0813 41 59 45 52 00 31 FF ;=============================================================================== ; Routine: SaveActorCoordinates ; Global: The routine reads no RAM 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 Zp07; stores A to Zp0C; loads A ; from Zp05; stores A to Zp0D. ; 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. ; ;=============================================================================== SaveActorCoordinates: lda Zp07 ; CPU:$C81A PRG:081A A5 07 sta Zp0C ; CPU:$C81C PRG:081C 85 0C lda Zp05 ; CPU:$C81E PRG:081E A5 05 sta Zp0D ; CPU:$C820 PRG:0820 85 0D ;=============================================================================== ; Routine: UpdateActorBehaviour ; Global: The routine calls ClearPpuCtrlBit1_OnNonzero, CheckControllerState, DispatchObjectAction and StartActorScript. ; Local: Executes 5 instructions: calls ClearPpuCtrlBit1_OnNonzero; calls CheckControllerState; branches on ; carry set to UpdateActorBehaviour_Loop; calls DispatchObjectAction; calls StartActorScript. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== UpdateActorBehaviour: jsr ClearPpuCtrlBit1_OnNonzero ; CPU:$C822 PRG:0822 20 63 CA jsr CheckControllerState ; CPU:$C825 PRG:0825 20 B1 CA bcs UpdateActorBehaviour_Loop ; CPU:$C828 PRG:0828 B0 06 jsr DispatchObjectAction ; CPU:$C82A PRG:082A 20 F3 D3 jsr StartActorScript ; CPU:$C82D PRG:082D 20 91 C9 ;=============================================================================== ; Routine: UpdateActorBehaviour_Loop ; Global: The routine calls StartActorAction. ; Local: Executes 3 instructions: calls StartActorAction; 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: ; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== UpdateActorBehaviour_Loop: jsr StartActorAction ; CPU:$C830 PRG:0830 20 DD C9 clc ; CPU:$C833 PRG:0833 18 rts ; CPU:$C834 PRG:0834 60 ;=============================================================================== ; Routine: SelectActorSubSlot ; Global: The routine reads no RAM 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 Y with $01; loads X from Zp63; ; decrements X; stores X to Zp64; compares X with $01; branches on ; equal to SelectActorSubSlot_Loop; 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. ; ;=============================================================================== SelectActorSubSlot: ldy #$01 ; CPU:$C835 PRG:0835 A0 01 ldx Zp63 ; CPU:$C837 PRG:0837 A6 63 dex ; CPU:$C839 PRG:0839 CA stx Zp64 ; CPU:$C83A PRG:083A 86 64 cpx #$01 ; CPU:$C83C PRG:083C E0 01 beq SelectActorSubSlot_Loop ; CPU:$C83E PRG:083E F0 05 cpx #$04 ; CPU:$C840 PRG:0840 E0 04 beq SelectActorSubSlot_Loop ; CPU:$C842 PRG:0842 F0 01 dey ; CPU:$C844 PRG:0844 88 ;=============================================================================== ; Routine: SelectActorSubSlot_Loop ; Global: The routine calls UpdateActorHitFlag, StartObjectScreenScript and ClearOamBuffer, writes $032F. ; Local: Executes 11 instructions: stores Y to Zp65; loads A with $04; stores ; A to $032F; loads Y with $00; stores Y to Zp0E; calls UpdateActorHitFlag; 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. Leaves $032F changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== SelectActorSubSlot_Loop: sty Zp65 ; CPU:$C845 PRG:0845 84 65 lda #$04 ; CPU:$C847 PRG:0847 A9 04 sta $032F ; CPU:$C849 PRG:0849 8D 2F 03 ldy #$00 ; CPU:$C84C PRG:084C A0 00 sty Zp0E ; CPU:$C84E PRG:084E 84 0E jsr UpdateActorHitFlag ; CPU:$C850 PRG:0850 20 89 C8 jsr StartObjectScreenScript ; CPU:$C853 PRG:0853 20 FD D2 jsr ClearOamBuffer ; CPU:$C856 PRG:0856 20 56 C5 ldx #$F0 ; CPU:$C859 PRG:0859 A2 F0 lda #$07 ; CPU:$C85B PRG:085B A9 07 sta Zp79 ; CPU:$C85D PRG:085D 85 79 ;=============================================================================== ; Routine: SelectActorSubSlot_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 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: 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, Zp79, Zp7C, Zp7D, Zp80. ; ;=============================================================================== SelectActorSubSlot_OnNonzero: ldy #$08 ; CPU:$C85F PRG:085F A0 08 ;=============================================================================== ; Routine: SelectActorSubSlot_OnNonzero_2 ; Global: The routine reads no RAM 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 Y with $08; loads A with $00; stores ; A to Zp80,x; increments X; decrements Y; branches on not equal to ; SelectActorSubSlot_OnNonzero_2; 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, Zp79, Zp7C, Zp7D, Zp80. ; ;=============================================================================== SelectActorSubSlot_OnNonzero_2: lda #$00 ; CPU:$C861 PRG:0861 A9 00 sta Zp80,x ; CPU:$C863 PRG:0863 95 80 inx ; CPU:$C865 PRG:0865 E8 dey ; CPU:$C866 PRG:0866 88 bne SelectActorSubSlot_OnNonzero_2 ; CPU:$C867 PRG:0867 D0 F8 txa ; CPU:$C869 PRG:0869 8A clc ; CPU:$C86A PRG:086A 18 adc #$08 ; CPU:$C86B PRG:086B 69 08 tax ; CPU:$C86D PRG:086D AA dec Zp79 ; CPU:$C86E PRG:086E C6 79 bne SelectActorSubSlot_OnNonzero ; CPU:$C870 PRG:0870 D0 ED ldx #$04 ; CPU:$C872 PRG:0872 A2 04 stx Zp7D ; CPU:$C874 PRG:0874 86 7D ldx #$03 ; CPU:$C876 PRG:0876 A2 03 ldy #$00 ; CPU:$C878 PRG:0878 A0 00 sty Zp7C ; CPU:$C87A PRG:087A 84 7C ;=============================================================================== ; Routine: SelectActorSubSlot_OnNonzero_3 ; Global: The routine reads no RAM 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 with $00; stores A to ((Zp7C),y); ; decrements Y; branches on not equal to SelectActorSubSlot_OnNonzero_3; increments Zp7D; ; 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: Returns with RTS; the registers it loaded still hold the values it ; computed. ; Clobbers: ; A, X and Y, the N and Z flags, Zp7D. ; ;=============================================================================== SelectActorSubSlot_OnNonzero_3: lda #$00 ; CPU:$C87C PRG:087C A9 00 sta (Zp7C),y ; CPU:$C87E PRG:087E 91 7C dey ; CPU:$C880 PRG:0880 88 bne SelectActorSubSlot_OnNonzero_3 ; CPU:$C881 PRG:0881 D0 F9 inc Zp7D ; CPU:$C883 PRG:0883 E6 7D dex ; CPU:$C885 PRG:0885 CA bne SelectActorSubSlot_OnNonzero_3 ; CPU:$C886 PRG:0886 D0 F4 rts ; CPU:$C888 PRG:0888 60 ;=============================================================================== ; Routine: UpdateActorHitFlag ; Global: The routine reads no RAM 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: tests the bits of Zp03; branches on overflow ; clear to UpdateActorHitFlag_Loop_2; loads A from Zp6F; branches on equal to ; UpdateActorHitFlag_Loop; loads A with $00; stores A to Zp6F; 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. ; ;=============================================================================== UpdateActorHitFlag: bit Zp03 ; CPU:$C889 PRG:0889 24 03 bvc UpdateActorHitFlag_Loop_2 ; CPU:$C88B PRG:088B 50 26 lda Zp6F ; CPU:$C88D PRG:088D A5 6F beq UpdateActorHitFlag_Loop ; CPU:$C88F PRG:088F F0 06 lda #$00 ; CPU:$C891 PRG:0891 A9 00 sta Zp6F ; CPU:$C893 PRG:0893 85 6F beq UpdateActorHitFlag_Loop_3 ; CPU:$C895 PRG:0895 F0 1E ;=============================================================================== ; Routine: UpdateActorHitFlag_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 14 instructions: loads A from Zp6E; compares A with $06; ; branches on equal to UpdateActorHitFlag_Loop_4; loads Y from Zp64; branches on not ; equal to UpdateActorHitFlag_Loop_3; increments Zp66; 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. ; ;=============================================================================== UpdateActorHitFlag_Loop: lda Zp6E ; CPU:$C897 PRG:0897 A5 6E cmp #$06 ; CPU:$C899 PRG:0899 C9 06 beq UpdateActorHitFlag_Loop_4 ; CPU:$C89B PRG:089B F0 24 ldy Zp64 ; CPU:$C89D PRG:089D A4 64 bne UpdateActorHitFlag_Loop_3 ; CPU:$C89F PRG:089F D0 14 inc Zp66 ; CPU:$C8A1 PRG:08A1 E6 66 lda Zp66 ; CPU:$C8A3 PRG:08A3 A5 66 cmp #$02 ; CPU:$C8A5 PRG:08A5 C9 02 bcs UpdateActorHitFlag_Loop_3 ; CPU:$C8A7 PRG:08A7 B0 0C bit Zp03 ; CPU:$C8A9 PRG:08A9 24 03 bvc UpdateActorHitFlag_Loop_3 ; CPU:$C8AB PRG:08AB 50 08 lda Zp03 ; CPU:$C8AD PRG:08AD A5 03 and #$08 ; CPU:$C8AF PRG:08AF 29 08 beq UpdateActorHitFlag_Loop_3 ; CPU:$C8B1 PRG:08B1 F0 02 ;=============================================================================== ; Routine: UpdateActorHitFlag_Loop_2 ; Global: The routine reads no RAM 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 Zp66. ; 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. ; ;=============================================================================== UpdateActorHitFlag_Loop_2: inc Zp66 ; CPU:$C8B3 PRG:08B3 E6 66 ;=============================================================================== ; Routine: UpdateActorHitFlag_Loop_3 ; Global: The routine reads no RAM 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 Y with $00; stores Y to Zp6B; stores Y ; to Zp6D; stores Y to ZpAD; stores Y to ZpAB; branches on equal to ; UpdateActorHitFlag_Loop_8. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== UpdateActorHitFlag_Loop_3: ldy #$00 ; CPU:$C8B5 PRG:08B5 A0 00 sty Zp6B ; CPU:$C8B7 PRG:08B7 84 6B sty Zp6D ; CPU:$C8B9 PRG:08B9 84 6D sty ZpAD ; CPU:$C8BB PRG:08BB 84 AD sty ZpAB ; CPU:$C8BD PRG:08BD 84 AB beq UpdateActorHitFlag_Loop_8 ; CPU:$C8BF PRG:08BF F0 21 ;=============================================================================== ; Routine: UpdateActorHitFlag_Loop_4 ; Global: The routine reads no RAM 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 Zp69; loads Y from Zp63; ; compares Y with $04; branches on not equal to UpdateActorHitFlag_Loop_5; compares A ; with $03; branches on carry set to UpdateActorHitFlag_Loop_7; 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. ; ;=============================================================================== UpdateActorHitFlag_Loop_4: lda Zp69 ; CPU:$C8C1 PRG:08C1 A5 69 ldy Zp63 ; CPU:$C8C3 PRG:08C3 A4 63 cpy #$04 ; CPU:$C8C5 PRG:08C5 C0 04 bne UpdateActorHitFlag_Loop_5 ; CPU:$C8C7 PRG:08C7 D0 0A cmp #$03 ; CPU:$C8C9 PRG:08C9 C9 03 bcs UpdateActorHitFlag_Loop_7 ; CPU:$C8CB PRG:08CB B0 0C cmp #$02 ; CPU:$C8CD PRG:08CD C9 02 bcs UpdateActorHitFlag_Loop_6 ; CPU:$C8CF PRG:08CF B0 06 dec Zp6B ; CPU:$C8D1 PRG:08D1 C6 6B ;=============================================================================== ; Routine: UpdateActorHitFlag_Loop_5 ; Global: The routine reads no RAM 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 $02; branches on carry set ; to UpdateActorHitFlag_Loop_7. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== UpdateActorHitFlag_Loop_5: cmp #$02 ; CPU:$C8D3 PRG:08D3 C9 02 bcs UpdateActorHitFlag_Loop_7 ; CPU:$C8D5 PRG:08D5 B0 02 ;=============================================================================== ; Routine: UpdateActorHitFlag_Loop_6 ; Global: The routine reads no RAM 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 Zp6B. ; 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. ; ;=============================================================================== UpdateActorHitFlag_Loop_6: dec Zp6B ; CPU:$C8D7 PRG:08D7 C6 6B ;=============================================================================== ; Routine: UpdateActorHitFlag_Loop_7 ; Global: The routine reads no RAM 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 $05; branches on not equal ; to UpdateActorHitFlag_Loop_8; loads A from ZpAB; shifts a right; stores A to Zp6B. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== UpdateActorHitFlag_Loop_7: cpy #$05 ; CPU:$C8D9 PRG:08D9 C0 05 bne UpdateActorHitFlag_Loop_8 ; CPU:$C8DB PRG:08DB D0 05 lda ZpAB ; CPU:$C8DD PRG:08DD A5 AB lsr a ; CPU:$C8DF PRG:08DF 4A sta Zp6B ; CPU:$C8E0 PRG:08E0 85 6B ;=============================================================================== ; Routine: UpdateActorHitFlag_Loop_8 ; Global: The routine writes $0388 and $03FF. ; Local: Executes 12 instructions: loads Y with $00; stores Y to Zp9B; stores ; Y to Zp6A; stores Y to ZpCF; stores Y to Zp0F; stores Y to ZpDE; ; 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. Leaves $0388 and $03FF changed. ; Clobbers: ; A, X and Y, the N and Z flags, the RAM fields it writes. ; ;=============================================================================== UpdateActorHitFlag_Loop_8: ldy #$00 ; CPU:$C8E2 PRG:08E2 A0 00 sty Zp9B ; CPU:$C8E4 PRG:08E4 84 9B sty Zp6A ; CPU:$C8E6 PRG:08E6 84 6A sty ZpCF ; CPU:$C8E8 PRG:08E8 84 CF sty Zp0F ; CPU:$C8EA PRG:08EA 84 0F sty ZpDE ; CPU:$C8EC PRG:08EC 84 DE sty ZpDF ; CPU:$C8EE PRG:08EE 84 DF sty ZpCD ; CPU:$C8F0 PRG:08F0 84 CD sty $0388 ; CPU:$C8F2 PRG:08F2 8C 88 03 sty $03FF ; CPU:$C8F5 PRG:08F5 8C FF 03 ldy #$01 ; CPU:$C8F8 PRG:08F8 A0 01 sty ZpB8 ; CPU:$C8FA PRG:08FA 84 B8 ;=============================================================================== ; Routine: ResetActorSprites ; Global: The routine reads no RAM 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; loads X 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 and X, the N and Z flags, ZpD9. ; ;=============================================================================== ResetActorSprites: lda #$00 ; CPU:$C8FC PRG:08FC A9 00 ldx #$04 ; CPU:$C8FE PRG:08FE A2 04 ;=============================================================================== ; Routine: ResetActorSprites_OnNonnegative ; Global: The routine reads no RAM 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 ZpD9,x; decrements X; branches ; on non-negative to ResetActorSprites_OnNonnegative; 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, ZpD9. ; ;=============================================================================== ResetActorSprites_OnNonnegative: sta ZpD9,x ; CPU:$C900 PRG:0900 95 D9 dex ; CPU:$C902 PRG:0902 CA bpl ResetActorSprites_OnNonnegative ; CPU:$C903 PRG:0903 10 FB rts ; CPU:$C905 PRG:0905 60 ;=============================================================================== ; Routine: LoadActorScriptPointer ; Global: The routine reads no RAM 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 Zp64; shifts a left; copies A ; into X; loads A from $C928,x; stores A to Zp7C; loads A from ; $C929,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, X and Y, the N, Z, C and V flags, Zp70, Zp79, Zp7A, Zp7C, Zp7D, ; Zp8C. ; ;=============================================================================== LoadActorScriptPointer: lda Zp64 ; CPU:$C906 PRG:0906 A5 64 asl a ; CPU:$C908 PRG:0908 0A tax ; CPU:$C909 PRG:0909 AA lda $C928,x ; CPU:$C90A PRG:090A BD 28 C9 sta Zp7C ; CPU:$C90D PRG:090D 85 7C lda $C929,x ; CPU:$C90F PRG:090F BD 29 C9 sta Zp7D ; CPU:$C912 PRG:0912 85 7D ldy #$00 ; CPU:$C914 PRG:0914 A0 00 lda (Zp7C),y ; CPU:$C916 PRG:0916 B1 7C sta Zp79 ; CPU:$C918 PRG:0918 85 79 lda Zp7C ; CPU:$C91A PRG:091A A5 7C clc ; CPU:$C91C PRG:091C 18 adc #$01 ; CPU:$C91D PRG:091D 69 01 sta Zp7C ; CPU:$C91F PRG:091F 85 7C bcc LoadActorScriptPointer_Loop; CPU:$C921 PRG:0921 90 02 inc Zp7D ; CPU:$C923 PRG:0923 E6 7D ;=============================================================================== ; Routine: LoadActorScriptPointer_Loop ; Global: The routine calls ResetSpriteState. ; Local: Executes 1 instruction: calls ResetSpriteState. ; 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, Zp70, Zp79, Zp7A, Zp8C. ; ;=============================================================================== LoadActorScriptPointer_Loop: jmp ResetSpriteState ; CPU:$C925 PRG:0925 4C DE CF ; ---- data $C928-$C990 (105 bytes) ---- ; referenced by `lda $C928,x` at $C90A (operand $C928 falls inside this region) ; referenced by `lda $C929,x` at $C90F (operand $C929 falls inside this region) ActorSpriteRecordPointerTable: .byte $32, $C9, $43, $C9, $54, $C9, $6F, $C9, $80, $C9, $02, $07, $01, $06, $68, $A6 ; CPU:$C928 PRG:0928 32 C9 43 C9 54 C9 6F C9 80 C9 02 07 01 06 68 A6 .byte $30, $00, $00, $07, $01, $08, $80, $BE, $28, $00, $1A, $02, $07, $01, $06, $20 ; CPU:$C938 PRG:0938 30 00 00 07 01 08 80 BE 28 00 1A 02 07 01 06 20 .byte $68, $40, $00, $03, $07, $00, $12, $B8, $F4, $00, $01, $1F, $04, $07, $01, $06 ; CPU:$C948 PRG:0948 68 40 00 03 07 00 12 B8 F4 00 01 1F 04 07 01 06 .byte $20, $A0, $3C, $00, $03, $07, $01, $09, $38, $B8, $38, $00, $20, $04, $00, $09 ; CPU:$C958 PRG:0958 20 A0 3C 00 03 07 01 09 38 B8 38 00 20 04 00 09 .byte $5C, $B8, $04, $00, $09, $80, $B8, $02, $07, $01, $06, $20, $A1, $2A, $00, $00 ; CPU:$C968 PRG:0968 5C B8 04 00 09 80 B8 02 07 01 06 20 A1 2A 00 00 .byte $07, $01, $13, $38, $B5, $20, $00, $10, $02, $07, $01, $06, $20, $4A, $16, $00 ; CPU:$C978 PRG:0978 07 01 13 38 B5 20 00 10 02 07 01 06 20 4A 16 00 .byte $06, $07, $00, $12, $B8, $F4, $00, $01, $1F ; CPU:$C988 PRG:0988 06 07 00 12 B8 F4 00 01 1F ;=============================================================================== ; Routine: StartActorScript ; Global: The routine calls SetActorIndexZero, reads $0406. ; Local: Executes 6 instructions: tests the bits of Zp03; branches on overflow ; clear to StartActorScript_Loop; loads Y from $0406; branches on not equal to ; StartActorScript_Loop; increments $0406; calls SetActorIndexZero. ; Parameters: Reads $0406 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 RAM fields it writes. ; ;=============================================================================== StartActorScript: bit Zp03 ; CPU:$C991 PRG:0991 24 03 bvc StartActorScript_Loop ; CPU:$C993 PRG:0993 50 0B ldy $0406 ; CPU:$C995 PRG:0995 AC 06 04 bne StartActorScript_Loop ; CPU:$C998 PRG:0998 D0 06 inc $0406 ; CPU:$C99A PRG:099A EE 06 04 jmp SetActorIndexZero ; CPU:$C99D PRG:099D 4C 51 CB ;=============================================================================== ; Routine: StartActorScript_Loop ; Global: The routine calls ComputeActorOffset, DrawActorTile, CheckActorStateFlags, AreAnyButtonsPressed and 1 more. ; Local: Executes 12 instructions: calls ComputeActorOffset; calls DrawActorTile; tests the ; bits of Zp03; branches on overflow clear to StartActorScript_Loop_2; calls ; CheckActorStateFlags; loads X from Zp0F; 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 RAM fields it writes. ; ;=============================================================================== StartActorScript_Loop: jsr ComputeActorOffset ; CPU:$C9A0 PRG:09A0 20 0D CF jsr DrawActorTile ; CPU:$C9A3 PRG:09A3 20 49 CF bit Zp03 ; CPU:$C9A6 PRG:09A6 24 03 bvc StartActorScript_Loop_2 ; CPU:$C9A8 PRG:09A8 50 13 jsr CheckActorStateFlags ; CPU:$C9AA PRG:09AA 20 44 D5 ldx Zp0F ; CPU:$C9AD PRG:09AD A6 0F bne StartActorScript_Loop_2 ; CPU:$C9AF PRG:09AF D0 0C jsr AreAnyButtonsPressed ; CPU:$C9B1 PRG:09B1 20 04 CA bne StartActorScript_Loop_2 ; CPU:$C9B4 PRG:09B4 D0 07 inc Zp0F ; CPU:$C9B6 PRG:09B6 E6 0F inc ZpCF ; CPU:$C9B8 PRG:09B8 E6 CF jmp ResetActorSlotsTwo ; CPU:$C9BA PRG:09BA 4C DC DC ;=============================================================================== ; Routine: StartActorScript_Loop_2 ; Global: The routine reads no RAM 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 from Zp52; increments X; compares X ; with $06; branches on carry clear to StartActorScript_Loop_3; 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: 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 RAM fields it writes. ; ;=============================================================================== StartActorScript_Loop_2: ldx Zp52 ; CPU:$C9BD PRG:09BD A6 52 inx ; CPU:$C9BF PRG:09BF E8 cpx #$06 ; CPU:$C9C0 PRG:09C0 E0 06 bcc StartActorScript_Loop_3 ; CPU:$C9C2 PRG:09C2 90 02 ldx #$00 ; CPU:$C9C4 PRG:09C4 A2 00 ;=============================================================================== ; Routine: StartActorScript_Loop_3 ; Global: The routine calls DispatchActorState and UpdateRingActor. ; Local: Executes 3 instructions: stores X to Zp52; calls DispatchActorState; calls ; UpdateRingActor. ; 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 RAM fields it writes. ; ;=============================================================================== StartActorScript_Loop_3: stx Zp52 ; CPU:$C9C6 PRG:09C6 86 52 jsr DispatchActorState ; CPU:$C9C8 PRG:09C8 20 CE C9 jmp UpdateRingActor ; CPU:$C9CB PRG:09CB 4C 32 CD ;=============================================================================== ; Routine: DispatchActorState ; Global: The routine calls DispatchHandlerPointerTable. ; Local: Executes 2 instructions: loads A from Zp64; calls DispatchHandlerPointerTable. ; 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, ZpE0, ZpE1. ; ;=============================================================================== DispatchActorState: lda Zp64 ; CPU:$C9CE PRG:09CE A5 64 jsr DispatchHandlerPointerTable; CPU:$C9D0 PRG:09D0 20 CD C4 ; ---- data $C9D3-$C9DC (10 bytes) ---- ActorUpdateHandlerPointerTable: .byte $32, $E5, $D9, $E9, $41, $EC, $8F, $EF, $63, $F1 ; CPU:$C9D3 PRG:09D3 32 E5 D9 E9 41 EC 8F EF 63 F1 ;=============================================================================== ; Routine: StartActorAction ; Global: The routine calls StartActorUpdate. ; Local: Executes 4 instructions: loads X from Zp64; loads A from $C9E7,x; ; stores A to Zp79; calls StartActorUpdate. ; 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. ; ;=============================================================================== StartActorAction: ldx Zp64 ; CPU:$C9DD PRG:09DD A6 64 lda $C9E7,x ; CPU:$C9DF PRG:09DF BD E7 C9 sta Zp79 ; CPU:$C9E2 PRG:09E2 85 79 jmp StartActorUpdate ; CPU:$C9E4 PRG:09E4 4C 01 D0 ; ---- data $C9E7-$C9EB (5 bytes) ---- ; referenced by `lda $C9E7,x` at $C9DF (operand $C9E7 falls inside this region) ActorObjectTypeTable: .byte $07, $07, $04, $02, $06 ; CPU:$C9E7 PRG:09E7 07 07 04 02 06 ;=============================================================================== ; Routine: NextActorSlot ; Global: The routine reads no RAM 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 ; $10 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. ; ;=============================================================================== NextActorSlot: txa ; CPU:$C9EC PRG:09EC 8A clc ; CPU:$C9ED PRG:09ED 18 adc #$10 ; CPU:$C9EE PRG:09EE 69 10 tax ; CPU:$C9F0 PRG:09F0 AA rts ; CPU:$C9F1 PRG:09F1 60 ;=============================================================================== ; Routine: PreviousActorSlot ; Global: The routine reads no RAM 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; sets the carry flag; ; subtracts $10 from 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. ; ;=============================================================================== PreviousActorSlot: txa ; CPU:$C9F2 PRG:09F2 8A sec ; CPU:$C9F3 PRG:09F3 38 sbc #$10 ; CPU:$C9F4 PRG:09F4 E9 10 tax ; CPU:$C9F6 PRG:09F6 AA rts ; CPU:$C9F7 PRG:09F7 60 ; ---- data $C9F8-$CA03 (12 bytes) ---- .byte $98, $18, $69, $10, $A8, $60, $98, $38, $E9, $10, $A8, $60 ; CPU:$C9F8 PRG:09F8 98 18 69 10 A8 60 98 38 E9 10 A8 60 ;=============================================================================== ; Routine: AreAnyButtonsPressed ; Global: The routine reads $0343, $0342, $0341 and $0340. ; Local: Executes 5 instructions: loads A from $0343; ORs A with $0342; ORs A ; with $0341; ORs A with $0340; returns with RTS. ; Parameters: Reads $0343, $0342, $0341 and $0340 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. ; ;=============================================================================== AreAnyButtonsPressed: lda $0343 ; CPU:$CA04 PRG:0A04 AD 43 03 ora $0342 ; CPU:$CA07 PRG:0A07 0D 42 03 ora $0341 ; CPU:$CA0A PRG:0A0A 0D 41 03 ora $0340 ; CPU:$CA0D PRG:0A0D 0D 40 03 rts ; CPU:$CA10 PRG:0A10 60 ;=============================================================================== ; Routine: ResetScrollPosition ; Global: The routine writes the PPUADDR registers, reads the PPUSTATUS ; register. ; Local: Executes 8 instructions: loads A from the PPUSTATUS register; 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; ; 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 the PPUADDR registers set. ; Clobbers: ; A, the N and Z flags, PPUADDR. ; ;=============================================================================== ResetScrollPosition: lda PPUSTATUS ; CPU:$CA11 PRG:0A11 AD 02 20 lda #$3F ; CPU:$CA14 PRG:0A14 A9 3F sta PPUADDR ; CPU:$CA16 PRG:0A16 8D 06 20 lda #$00 ; CPU:$CA19 PRG:0A19 A9 00 sta PPUADDR ; CPU:$CA1B PRG:0A1B 8D 06 20 sta PPUADDR ; CPU:$CA1E PRG:0A1E 8D 06 20 sta PPUADDR ; CPU:$CA21 PRG:0A21 8D 06 20 rts ; CPU:$CA24 PRG:0A24 60 ;=============================================================================== ; Routine: IsCoordinateBusy ; Global: The routine reads no RAM 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 Zp45; branches on not equal to ; IsCoordinateBusy_OnNonzero. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== IsCoordinateBusy: lda Zp45 ; CPU:$CA25 PRG:0A25 A5 45 bne IsCoordinateBusy_OnNonzero ; CPU:$CA27 PRG:0A27 D0 06 ;=============================================================================== ; Routine: IsCoordinateBusy_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 4 instructions: loads A from Zp12; branches on not equal to ; IsCoordinateBusy_OnNonzero; 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. ; ;=============================================================================== IsCoordinateBusy_OnZero: lda Zp12 ; CPU:$CA29 PRG:0A29 A5 12 bne IsCoordinateBusy_OnNonzero ; CPU:$CA2B PRG:0A2B D0 02 sec ; CPU:$CA2D PRG:0A2D 38 rts ; CPU:$CA2E PRG:0A2E 60 ;=============================================================================== ; Routine: IsCoordinateBusy_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 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. ; ;=============================================================================== IsCoordinateBusy_OnNonzero: clc ; CPU:$CA2F PRG:0A2F 18 rts ; CPU:$CA30 PRG:0A30 60 ;=============================================================================== ; Routine: IsRingInPlay ; Global: The routine reads no RAM 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 Zp12; branches on not equal to ; IsCoordinateBusy_OnNonzero; sets the carry flag; returns with RTS; clears the carry ; flag; returns with RTS; 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. ; ;=============================================================================== IsRingInPlay: lda Zp34 ; CPU:$CA31 PRG:0A31 A5 34 bne IsCoordinateBusy_OnNonzero ; CPU:$CA33 PRG:0A33 D0 FA lda Zp23 ; CPU:$CA35 PRG:0A35 A5 23 bne IsCoordinateBusy_OnNonzero ; CPU:$CA37 PRG:0A37 D0 F6 beq IsCoordinateBusy_OnZero ; CPU:$CA39 PRG:0A39 F0 EE ;=============================================================================== ; Routine: ResetActorSlots ; Global: The routine reads no RAM 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, X and Y, the N, Z and C flags, the RAM fields it writes. ; ;=============================================================================== ResetActorSlots: ldx #$03 ; CPU:$CA3B PRG:0A3B A2 03 ;=============================================================================== ; Routine: ResetActorSlots_OnNonnegative ; Global: The routine calls PlaySoundEffectById. ; Local: Executes 5 instructions: loads A from $CA47,x; calls PlaySoundEffectById; ; decrements X; branches on non-negative to ResetActorSlots_OnNonnegative; 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 and C flags, the RAM fields it writes. ; ;=============================================================================== ResetActorSlots_OnNonnegative: lda $CA47,x ; CPU:$CA3D PRG:0A3D BD 47 CA jsr PlaySoundEffectById ; CPU:$CA40 PRG:0A40 20 0D F8 dex ; CPU:$CA43 PRG:0A43 CA bpl ResetActorSlots_OnNonnegative ; CPU:$CA44 PRG:0A44 10 F7 rts ; CPU:$CA46 PRG:0A46 60 ; ---- data $CA47-$CA4A (4 bytes) ---- ; referenced by `lda $CA47,x` at $CA3D (operand $CA47 falls inside this region) SoundEffectNoteTable: .byte $C0, $80, $40, $00 ; CPU:$CA47 PRG:0A47 C0 80 40 00 ;=============================================================================== ; Routine: SetPpuCtrlBit2 ; Global: The routine reads no RAM 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 Zp53; ORs 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: Falls through to the next routine in the source; it has no return ; of its own. ; Clobbers: ; A, the N and Z flags, Zp53, PPUCTRL. ; ;=============================================================================== SetPpuCtrlBit2: lda Zp53 ; CPU:$CA4B PRG:0A4B A5 53 ora #$04 ; CPU:$CA4D PRG:0A4D 09 04 ;=============================================================================== ; Routine: WritePpuCtrl ; Global: The routine writes the PPUCTRL register. ; Local: Executes 3 instructions: stores A to Zp53; stores A to the PPUCTRL ; 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 PPUCTRL register set. ; Clobbers: ; no register, Zp53, PPUCTRL. ; ;=============================================================================== WritePpuCtrl: sta Zp53 ; CPU:$CA4F PRG:0A4F 85 53 sta PPUCTRL ; CPU:$CA51 PRG:0A51 8D 00 20 rts ; CPU:$CA54 PRG:0A54 60 ;=============================================================================== ; Routine: ClearPpuCtrlBit2 ; Global: The routine calls WritePpuCtrl. ; Local: Executes 3 instructions: loads A from Zp53; ANDs A with $FB; calls ; WritePpuCtrl. ; 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, Zp53, PPUCTRL. ; ;=============================================================================== ClearPpuCtrlBit2: lda Zp53 ; CPU:$CA55 PRG:0A55 A5 53 and #$FB ; CPU:$CA57 PRG:0A57 29 FB jmp WritePpuCtrl ; CPU:$CA59 PRG:0A59 4C 4F CA ;=============================================================================== ; Routine: ClearPpuCtrlBit1 ; Global: The routine calls WritePpuCtrl. ; Local: Executes 3 instructions: loads A from Zp53; ANDs A with $FE; calls ; WritePpuCtrl. ; 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, Zp53, PPUCTRL. ; ;=============================================================================== ClearPpuCtrlBit1: lda Zp53 ; CPU:$CA5C PRG:0A5C A5 53 and #$FE ; CPU:$CA5E PRG:0A5E 29 FE jmp WritePpuCtrl ; CPU:$CA60 PRG:0A60 4C 4F CA ;=============================================================================== ; Routine: ClearPpuCtrlBit1_OnNonzero ; Global: The routine calls ResetSpriteCounter, writes $0410, reads the PPUSTATUS ; register, reads $032F. ; Local: Executes 12 instructions: loads A from the PPUSTATUS register; ANDs A ; with $40; branches on not equal to ClearPpuCtrlBit1_OnNonzero; stores A to $0410; ; calls ResetSpriteCounter; loads A from $032F; and 6 more instructions. ; Parameters: Reads $032F 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 $0410 changed. ; Clobbers: ; A and X, the N, Z, C and V flags, the OAM shadow and the RAM fields it ; writes. ; ;=============================================================================== ClearPpuCtrlBit1_OnNonzero: lda PPUSTATUS ; CPU:$CA63 PRG:0A63 AD 02 20 and #$40 ; CPU:$CA66 PRG:0A66 29 40 bne ClearPpuCtrlBit1_OnNonzero ; CPU:$CA68 PRG:0A68 D0 F9 sta $0410 ; CPU:$CA6A PRG:0A6A 8D 10 04 jsr ResetSpriteCounter ; CPU:$CA6D PRG:0A6D 20 CE CF lda $032F ; CPU:$CA70 PRG:0A70 AD 2F 03 beq ClearPpuCtrlBit1_OnNonzero_2 ; CPU:$CA73 PRG:0A73 F0 0B dec $032F ; CPU:$CA75 PRG:0A75 CE 2F 03 bne ClearPpuCtrlBit1_Loop_2 ; CPU:$CA78 PRG:0A78 D0 36 lda #$00 ; CPU:$CA7A PRG:0A7A A9 00 sta ZpFB ; CPU:$CA7C PRG:0A7C 85 FB beq ClearPpuCtrlBit1_Loop_2 ; CPU:$CA7E PRG:0A7E F0 30 ;=============================================================================== ; Routine: ClearPpuCtrlBit1_OnNonzero_2 ; Global: The routine reads the PPUSTATUS register, reads $0410. ; Local: Executes 6 instructions: loads A from the PPUSTATUS register; ANDs A ; with $40; branches on not equal to ClearPpuCtrlBit1_Loop; decrements $0410; ; branches on not equal to ClearPpuCtrlBit1_OnNonzero_2. ; Parameters: Reads $0410 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, Zp53, $0410, PPUCTRL, PPUSCROLL. ; ;=============================================================================== ClearPpuCtrlBit1_OnNonzero_2: lda PPUSTATUS ; CPU:$CA80 PRG:0A80 AD 02 20 and #$40 ; CPU:$CA83 PRG:0A83 29 40 bne ClearPpuCtrlBit1_Loop ; CPU:$CA85 PRG:0A85 D0 06 nop ; CPU:$CA87 PRG:0A87 EA dec $0410 ; CPU:$CA88 PRG:0A88 CE 10 04 bne ClearPpuCtrlBit1_OnNonzero_2 ; CPU:$CA8B PRG:0A8B D0 F3 ;=============================================================================== ; Routine: ClearPpuCtrlBit1_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 $1A. ; 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, Zp53, PPUCTRL, PPUSCROLL. ; ;=============================================================================== ClearPpuCtrlBit1_Loop: ldx #$1A ; CPU:$CA8D PRG:0A8D A2 1A ;=============================================================================== ; Routine: ClearPpuCtrlBit1_OnNonzero_3 ; Global: The routine writes the PPUSCROLL and PPUCTRL registers, reads the ; PPUSTATUS register. ; Local: Executes 16 instructions: decrements X; branches on not equal to ; ClearPpuCtrlBit1_OnNonzero_3; loads X from Zp6A; loads A from Zp6B; shifts a right; ; loads A from Zp53; 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 PPUSCROLL and PPUCTRL ; registers set. ; Clobbers: ; A and X, the N, Z, C and V flags, Zp53, PPUCTRL, PPUSCROLL. ; ;=============================================================================== ClearPpuCtrlBit1_OnNonzero_3: dex ; CPU:$CA8F PRG:0A8F CA bne ClearPpuCtrlBit1_OnNonzero_3 ; CPU:$CA90 PRG:0A90 D0 FD ldx Zp6A ; CPU:$CA92 PRG:0A92 A6 6A lda Zp6B ; CPU:$CA94 PRG:0A94 A5 6B lsr a ; CPU:$CA96 PRG:0A96 4A lda Zp53 ; CPU:$CA97 PRG:0A97 A5 53 and #$FC ; CPU:$CA99 PRG:0A99 29 FC adc #$00 ; CPU:$CA9B PRG:0A9B 69 00 sta Zp53 ; CPU:$CA9D PRG:0A9D 85 53 lda PPUSTATUS ; CPU:$CA9F PRG:0A9F AD 02 20 nop ; CPU:$CAA2 PRG:0AA2 EA stx PPUSCROLL ; CPU:$CAA3 PRG:0AA3 8E 05 20 ldx #$00 ; CPU:$CAA6 PRG:0AA6 A2 00 stx PPUSCROLL ; CPU:$CAA8 PRG:0AA8 8E 05 20 lda Zp53 ; CPU:$CAAB PRG:0AAB A5 53 sta PPUCTRL ; CPU:$CAAD PRG:0AAD 8D 00 20 ;=============================================================================== ; Routine: ClearPpuCtrlBit1_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ClearPpuCtrlBit1_Loop_2: rts ; CPU:$CAB0 PRG:0AB0 60 ;=============================================================================== ; Routine: CheckControllerState ; Global: The routine reads $030C. ; Local: Executes 8 instructions: loads X from $030C; decrements X; branches ; on equal to CheckControllerState_Loop_2; decrements X; branches on equal to CheckControllerState_Loop_3; ; loads A from Zp0E; and 2 more instructions. ; Parameters: Reads $030C 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. ; ;=============================================================================== CheckControllerState: ldx $030C ; CPU:$CAB1 PRG:0AB1 AE 0C 03 dex ; CPU:$CAB4 PRG:0AB4 CA beq CheckControllerState_Loop_2; CPU:$CAB5 PRG:0AB5 F0 0C dex ; CPU:$CAB7 PRG:0AB7 CA beq CheckControllerState_Loop_3; CPU:$CAB8 PRG:0AB8 F0 50 lda Zp0E ; CPU:$CABA PRG:0ABA A5 0E beq CheckControllerState_Loop ; CPU:$CABC PRG:0ABC F0 03 inc $030C ; CPU:$CABE PRG:0ABE EE 0C 03 ;=============================================================================== ; Routine: CheckControllerState_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: 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. ; ;=============================================================================== CheckControllerState_Loop: clc ; CPU:$CAC1 PRG:0AC1 18 rts ; CPU:$CAC2 PRG:0AC2 60 ;=============================================================================== ; Routine: CheckControllerState_Loop_2 ; Global: The routine calls PlaySoundEffectById, reads $030C and $0310. ; Local: Executes 6 instructions: increments $030C; increments $0310; loads A ; with $16; calls PlaySoundEffectById; loads A with $C0; calls PlaySoundEffectById. ; Parameters: Reads $030C and $0310 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 and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== CheckControllerState_Loop_2: inc $030C ; CPU:$CAC3 PRG:0AC3 EE 0C 03 inc $0310 ; CPU:$CAC6 PRG:0AC6 EE 10 03 lda #$16 ; CPU:$CAC9 PRG:0AC9 A9 16 jsr PlaySoundEffectById ; CPU:$CACB PRG:0ACB 20 0D F8 lda #$C0 ; CPU:$CACE PRG:0ACE A9 C0 jsr PlaySoundEffectById ; CPU:$CAD0 PRG:0AD0 20 0D F8 ;=============================================================================== ; Routine: CheckControllerState_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 A with $2E. ; 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, Zp79, Zp8C, Zp8E, the OAM shadow. ; ;=============================================================================== CheckControllerState_OnNonzero: lda #$2E ; CPU:$CAD3 PRG:0AD3 A9 2E ;=============================================================================== ; Routine: CheckControllerState_OnNonzero_2 ; Global: The routine reads no RAM 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: stores A to Zp8E; loads A with $05; stores A ; to Zp79; loads A with $60; stores A to Zp8C; loads X 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: 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, Zp79, Zp8C, Zp8E, the OAM shadow. ; ;=============================================================================== CheckControllerState_OnNonzero_2: sta Zp8E ; CPU:$CAD5 PRG:0AD5 85 8E lda #$05 ; CPU:$CAD7 PRG:0AD7 A9 05 sta Zp79 ; CPU:$CAD9 PRG:0AD9 85 79 lda #$60 ; CPU:$CADB PRG:0ADB A9 60 sta Zp8C ; CPU:$CADD PRG:0ADD 85 8C ldx #$04 ; CPU:$CADF PRG:0ADF A2 04 ldy #$00 ; CPU:$CAE1 PRG:0AE1 A0 00 ;=============================================================================== ; Routine: CheckControllerState_OnNonzero_3 ; Global: The routine reads no RAM 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 Zp8E; stores A to $0200,x; ; increments X; loads A from $CB28,y; stores A to $0200,x; increments ; 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, X and Y, the N, Z, C and V flags, Zp79, Zp8C, the OAM shadow. ; ;=============================================================================== CheckControllerState_OnNonzero_3: lda Zp8E ; CPU:$CAE3 PRG:0AE3 A5 8E sta $0200,x ; CPU:$CAE5 PRG:0AE5 9D 00 02 inx ; CPU:$CAE8 PRG:0AE8 E8 lda $CB28,y ; CPU:$CAE9 PRG:0AE9 B9 28 CB sta $0200,x ; CPU:$CAEC PRG:0AEC 9D 00 02 iny ; CPU:$CAEF PRG:0AEF C8 inx ; CPU:$CAF0 PRG:0AF0 E8 lda #$01 ; CPU:$CAF1 PRG:0AF1 A9 01 sta $0200,x ; CPU:$CAF3 PRG:0AF3 9D 00 02 inx ; CPU:$CAF6 PRG:0AF6 E8 lda Zp8C ; CPU:$CAF7 PRG:0AF7 A5 8C sta $0200,x ; CPU:$CAF9 PRG:0AF9 9D 00 02 inx ; CPU:$CAFC PRG:0AFC E8 lda Zp8C ; CPU:$CAFD PRG:0AFD A5 8C clc ; CPU:$CAFF PRG:0AFF 18 adc #$08 ; CPU:$CB00 PRG:0B00 69 08 sta Zp8C ; CPU:$CB02 PRG:0B02 85 8C dec Zp79 ; CPU:$CB04 PRG:0B04 C6 79 bne CheckControllerState_OnNonzero_3 ; CPU:$CB06 PRG:0B06 D0 DB ;=============================================================================== ; Routine: CheckControllerState_OnNonzero_4 ; Global: The routine reads no RAM 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. ; ;=============================================================================== CheckControllerState_OnNonzero_4: sec ; CPU:$CB08 PRG:0B08 38 rts ; CPU:$CB09 PRG:0B09 60 ;=============================================================================== ; Routine: CheckControllerState_Loop_3 ; Global: The routine reads no RAM field, writes none and calls nothing - it ; is a straight-line sequence whose only effect is on the registers ; and the flags. ; Local: Executes 38 instructions: loads A with $2E; stores A to Zp8E; loads A ; with $05; stores A to Zp79; loads A with $60; stores A to Zp8C; and ; 32 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, Zp79, Zp8C, Zp8E, the OAM shadow, ; $030C, $0310. ; ;=============================================================================== CheckControllerState_Loop_3: lda Zp0E ; CPU:$CB0A PRG:0B0A A5 0E beq CheckControllerState_Loop_4; CPU:$CB0C PRG:0B0C F0 0E lda Zp09 ; CPU:$CB0E PRG:0B0E A5 09 and #$0F ; CPU:$CB10 PRG:0B10 29 0F bne CheckControllerState_OnNonzero_4 ; CPU:$CB12 PRG:0B12 D0 F4 lda Zp09 ; CPU:$CB14 PRG:0B14 A5 09 and #$10 ; CPU:$CB16 PRG:0B16 29 10 bne CheckControllerState_OnNonzero ; CPU:$CB18 PRG:0B18 D0 B9 beq CheckControllerState_Loop_5; CPU:$CB1A PRG:0B1A F0 08 ;=============================================================================== ; Routine: CheckControllerState_Loop_4 ; Global: The routine writes $030C and $0310. ; Local: Executes 31 instructions: stores A to Zp8E; loads A with $05; stores ; A to Zp79; loads A with $60; stores A to Zp8C; loads X with $04; ; 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. Leaves $030C and $0310 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, Zp79, Zp8C, Zp8E, the OAM shadow, ; $030C, $0310. ; ;=============================================================================== CheckControllerState_Loop_4: lda #$00 ; CPU:$CB1C PRG:0B1C A9 00 sta $030C ; CPU:$CB1E PRG:0B1E 8D 0C 03 sta $0310 ; CPU:$CB21 PRG:0B21 8D 10 03 ;=============================================================================== ; Routine: CheckControllerState_Loop_5 ; Global: The routine reads no RAM field, writes none and calls nothing - it ; is a straight-line sequence whose only effect is on the registers ; and the flags. ; Local: Executes 30 instructions: stores A to Zp8E; loads A with $05; stores ; A to Zp79; loads A with $60; stores A to Zp8C; loads X with $04; ; and 24 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, Zp79, Zp8C, Zp8E, the OAM shadow. ; ;=============================================================================== CheckControllerState_Loop_5: lda #$F4 ; CPU:$CB24 PRG:0B24 A9 F4 bne CheckControllerState_OnNonzero_2 ; CPU:$CB26 PRG:0B26 D0 AD .byte $5B, $6A, $6B ; CPU:$CB28 PRG:0B28 5B 6A 6B -- sre $6B6A,y (undocumented; ca65 cannot encode) .byte $7A ; CPU:$CB2B PRG:0B2B 7A -- nop (undocumented; ca65 cannot encode) ; ---- data $CB2C-$CB2C (1 bytes) ---- .byte $7B ; CPU:$CB2C PRG:0B2C 7B ;=============================================================================== ; Routine: ClearDirectionFlags ; Global: The routine writes $0340, $0341 and $0342. ; Local: Executes 8 instructions: stores X to ZpF9; loads A with $00; stores A ; to $0340; stores A to $0341; stores A to $0342; loads X with $05; ; 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 $0340, $0341 and $0342 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, ZpF9, $0340, $0341, $0342, $0343. ; ;=============================================================================== ClearDirectionFlags: stx ZpF9 ; CPU:$CB2D PRG:0B2D 86 F9 lda #$00 ; CPU:$CB2F PRG:0B2F A9 00 sta $0340 ; CPU:$CB31 PRG:0B31 8D 40 03 sta $0341 ; CPU:$CB34 PRG:0B34 8D 41 03 sta $0342 ; CPU:$CB37 PRG:0B37 8D 42 03 ldx #$05 ; CPU:$CB3A PRG:0B3A A2 05 ldy #$02 ; CPU:$CB3C PRG:0B3C A0 02 lda Zp66 ; CPU:$CB3E PRG:0B3E A5 66 ;=============================================================================== ; Routine: ClearDirectionFlags_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 7 instructions: sets the carry flag; subtracts $04 from A; ; branches on equal to ClearDirectionFlags_Loop; branches on negative to ClearDirectionFlags_Loop; ; decrements X; 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: ; X and Y, the N, Z, C and V flags, $0343. ; ;=============================================================================== ClearDirectionFlags_OnNonzero: sec ; CPU:$CB40 PRG:0B40 38 sbc #$04 ; CPU:$CB41 PRG:0B41 E9 04 beq ClearDirectionFlags_Loop ; CPU:$CB43 PRG:0B43 F0 06 bmi ClearDirectionFlags_Loop ; CPU:$CB45 PRG:0B45 30 04 dex ; CPU:$CB47 PRG:0B47 CA dey ; CPU:$CB48 PRG:0B48 88 bne ClearDirectionFlags_OnNonzero ; CPU:$CB49 PRG:0B49 D0 F5 ;=============================================================================== ; Routine: ClearDirectionFlags_Loop ; Global: The routine writes $0343. ; Local: Executes 3 instructions: stores X to $0343; loads X from ZpF9; ; 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 $0343 changed. ; Clobbers: ; X, the N and Z flags, $0343. ; ;=============================================================================== ClearDirectionFlags_Loop: stx $0343 ; CPU:$CB4B PRG:0B4B 8E 43 03 ldx ZpF9 ; CPU:$CB4E PRG:0B4E A6 F9 rts ; CPU:$CB50 PRG:0B50 60 ;=============================================================================== ; Routine: SetActorIndexZero ; Global: The routine reads no RAM 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 $00; branches on equal to ; SetActorIndexOne_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SetActorIndexZero: ldy #$00 ; CPU:$CB51 PRG:0B51 A0 00 beq SetActorIndexOne_Loop ; CPU:$CB53 PRG:0B53 F0 02 ;=============================================================================== ; Routine: SetActorIndexOne ; Global: The routine reads no RAM 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 RAM fields it writes. ; ;=============================================================================== SetActorIndexOne: ldy #$01 ; CPU:$CB55 PRG:0B55 A0 01 ;=============================================================================== ; Routine: SetActorIndexOne_Loop ; Global: The routine writes the APUPULSE2TIMERLO, APUPULSE2TIMERHI, ; APUTRIANGLETIMERLO and APUTRIANGLETIMERHI registers. ; Local: Executes 13 instructions: loads A with $00; stores A to the ; APUPULSE2TIMERLO register; stores A to the APUPULSE2TIMERHI ; register; stores A to the APUTRIANGLETIMERLO register; stores A to ; the APUTRIANGLETIMERHI register; loads X from Zp63; 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 APUPULSE2TIMERLO, ; APUPULSE2TIMERHI and APUTRIANGLETIMERLO registers set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== SetActorIndexOne_Loop: lda #$00 ; CPU:$CB57 PRG:0B57 A9 00 sta APUPULSE2TIMERLO ; CPU:$CB59 PRG:0B59 8D 06 40 sta APUPULSE2TIMERHI ; CPU:$CB5C PRG:0B5C 8D 07 40 sta APUTRIANGLETIMERLO ; CPU:$CB5F PRG:0B5F 8D 0A 40 sta APUTRIANGLETIMERHI ; CPU:$CB62 PRG:0B62 8D 0B 40 ldx Zp63 ; CPU:$CB65 PRG:0B65 A6 63 cpx #$05 ; CPU:$CB67 PRG:0B67 E0 05 beq SetActorIndexOne_Loop_2 ; CPU:$CB69 PRG:0B69 F0 0A cpx #$03 ; CPU:$CB6B PRG:0B6B E0 03 beq SetActorIndexOne_Loop_3 ; CPU:$CB6D PRG:0B6D F0 09 cpx #$02 ; CPU:$CB6F PRG:0B6F E0 02 beq SetActorIndexOne_Loop_3 ; CPU:$CB71 PRG:0B71 F0 05 bne SetActorIndexOne_Loop_4 ; CPU:$CB73 PRG:0B73 D0 06 ;=============================================================================== ; Routine: SetActorIndexOne_Loop_2 ; Global: The routine reads no RAM 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; adds $0A 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, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== SetActorIndexOne_Loop_2: clc ; CPU:$CB75 PRG:0B75 18 adc #$0A ; CPU:$CB76 PRG:0B76 69 0A ;=============================================================================== ; Routine: SetActorIndexOne_Loop_3 ; Global: The routine reads no RAM 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; adds $0A 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, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== SetActorIndexOne_Loop_3: clc ; CPU:$CB78 PRG:0B78 18 adc #$0A ; CPU:$CB79 PRG:0B79 69 0A ;=============================================================================== ; Routine: SetActorIndexOne_Loop_4 ; Global: The routine reads no RAM 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 A into X; compares Y with $01; ; branches on equal to SetActorIndexOne_Loop_5; loads A from $CBBC,x; branches on ; not equal to SetActorIndexOne_Loop_6. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SetActorIndexOne_Loop_4: tax ; CPU:$CB7B PRG:0B7B AA cpy #$01 ; CPU:$CB7C PRG:0B7C C0 01 beq SetActorIndexOne_Loop_5 ; CPU:$CB7E PRG:0B7E F0 05 lda $CBBC,x ; CPU:$CB80 PRG:0B80 BD BC CB bne SetActorIndexOne_Loop_6 ; CPU:$CB83 PRG:0B83 D0 03 ;=============================================================================== ; Routine: SetActorIndexOne_Loop_5 ; Global: The routine reads no RAM 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 $CBBD,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 and C flags, the RAM fields it writes. ; ;=============================================================================== SetActorIndexOne_Loop_5: lda $CBBD,x ; CPU:$CB85 PRG:0B85 BD BD CB ;=============================================================================== ; Routine: SetActorIndexOne_Loop_6 ; Global: The routine calls PlaySoundEffectById, writes the APUPULSE2CTRL and ; APUTRIANGLECTRL registers. ; Local: Executes 20 instructions: stores A to Zp2E; stores A to Zp3F; loads A ; from $CBBE,x; stores A to Zp26; loads A from $CBBF,x; stores A to ; Zp37; 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 APUPULSE2CTRL and APUTRIANGLECTRL registers ; set. ; Clobbers: ; A, X and Y, the N, Z and C flags, the RAM fields it writes. ; ;=============================================================================== SetActorIndexOne_Loop_6: sta Zp2E ; CPU:$CB88 PRG:0B88 85 2E sta Zp3F ; CPU:$CB8A PRG:0B8A 85 3F lda $CBBE,x ; CPU:$CB8C PRG:0B8C BD BE CB sta Zp26 ; CPU:$CB8F PRG:0B8F 85 26 lda $CBBF,x ; CPU:$CB91 PRG:0B91 BD BF CB sta Zp37 ; CPU:$CB94 PRG:0B94 85 37 lda $CBC0,x ; CPU:$CB96 PRG:0B96 BD C0 CB sta Zp30 ; CPU:$CB99 PRG:0B99 85 30 lda $CBC1,x ; CPU:$CB9B PRG:0B9B BD C1 CB sta Zp31 ; CPU:$CB9E PRG:0B9E 85 31 lda $CBC2,x ; CPU:$CBA0 PRG:0BA0 BD C2 CB sta APUPULSE2CTRL ; CPU:$CBA3 PRG:0BA3 8D 04 40 lda $CBC3,x ; CPU:$CBA6 PRG:0BA6 BD C3 CB sta APUTRIANGLECTRL ; CPU:$CBA9 PRG:0BA9 8D 08 40 lda $CBC4,x ; CPU:$CBAC PRG:0BAC BD C4 CB stx ZpF9 ; CPU:$CBAF PRG:0BAF 86 F9 jsr PlaySoundEffectById ; CPU:$CBB1 PRG:0BB1 20 0D F8 ldx ZpF9 ; CPU:$CBB4 PRG:0BB4 A6 F9 lda $CBC5,x ; CPU:$CBB6 PRG:0BB6 BD C5 CB jmp PlaySoundEffectById ; CPU:$CBB9 PRG:0BB9 4C 0D F8 ; ---- data $CBBC-$CBD9 (30 bytes) ---- ; referenced by `lda $CBBC,x` at $CB80 (operand $CBBC falls inside this region) ; referenced by `lda $CBBD,x` at $CB85 (operand $CBBD falls inside this region) ; referenced by `lda $CBBE,x` at $CB8C (operand $CBBE falls inside this region) ; referenced by `lda $CBBF,x` at $CB91 (operand $CBBF falls inside this region) ; referenced by `lda $CBC0,x` at $CB96 (operand $CBC0 falls inside this region) ; referenced by `lda $CBC1,x` at $CB9B (operand $CBC1 falls inside this region) ; ... and 4 further references from decoded code SoundEffectDefinitionTable: .byte $07, $05, $7A, $20, $02, $05, $7A, $20, $4E, $8F, $07, $05, $BA, $2E, $02, $05 ; CPU:$CBBC PRG:0BBC 07 05 7A 20 02 05 7A 20 4E 8F 07 05 BA 2E 02 05 .byte $BA, $2E, $50, $91, $04, $03, $FA, $24, $00, $07, $FA, $24, $52, $93 ; CPU:$CBCC PRG:0BCC BA 2E 50 91 04 03 FA 24 00 07 FA 24 52 93 ;=============================================================================== ; Routine: PlaySoundEffectPair ; Global: The routine calls PlaySoundEffectById. ; Local: Executes 4 instructions: loads A with $54; calls PlaySoundEffectById; loads A ; with $D5; calls PlaySoundEffectById. ; 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. ; ;=============================================================================== PlaySoundEffectPair: lda #$54 ; CPU:$CBDA PRG:0BDA A9 54 jsr PlaySoundEffectById ; CPU:$CBDC PRG:0BDC 20 0D F8 lda #$D5 ; CPU:$CBDF PRG:0BDF A9 D5 jmp PlaySoundEffectById ; CPU:$CBE1 PRG:0BE1 4C 0D F8 ;=============================================================================== ; Routine: PackCoordinateBytes ; Global: The routine reads no RAM field, writes none and calls nothing - it ; is a straight-line sequence whose only effect is on the registers ; and the flags. ; Local: Executes 34 instructions: copies X into A; pushes A; copies Y into A; ; pushes A; loads A with $00; stores A to Zp7F; 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, the N, Z, C and V flags, Zp7E, Zp7F. ; ;=============================================================================== PackCoordinateBytes: txa ; CPU:$CBE4 PRG:0BE4 8A pha ; CPU:$CBE5 PRG:0BE5 48 tya ; CPU:$CBE6 PRG:0BE6 98 pha ; CPU:$CBE7 PRG:0BE7 48 lda #$00 ; CPU:$CBE8 PRG:0BE8 A9 00 sta Zp7F ; CPU:$CBEA PRG:0BEA 85 7F sta Zp7E ; CPU:$CBEC PRG:0BEC 85 7E lda Zp8E ; CPU:$CBEE PRG:0BEE A5 8E and #$F8 ; CPU:$CBF0 PRG:0BF0 29 F8 asl a ; CPU:$CBF2 PRG:0BF2 0A rol Zp7F ; CPU:$CBF3 PRG:0BF3 26 7F asl a ; CPU:$CBF5 PRG:0BF5 0A rol Zp7F ; CPU:$CBF6 PRG:0BF6 26 7F sta Zp7E ; CPU:$CBF8 PRG:0BF8 85 7E lda Zp8D ; CPU:$CBFA PRG:0BFA A5 8D and #$01 ; CPU:$CBFC PRG:0BFC 29 01 asl a ; CPU:$CBFE PRG:0BFE 0A asl a ; CPU:$CBFF PRG:0BFF 0A clc ; CPU:$CC00 PRG:0C00 18 adc #$20 ; CPU:$CC01 PRG:0C01 69 20 adc Zp7F ; CPU:$CC03 PRG:0C03 65 7F sta Zp7F ; CPU:$CC05 PRG:0C05 85 7F lda Zp8C ; CPU:$CC07 PRG:0C07 A5 8C lsr a ; CPU:$CC09 PRG:0C09 4A lsr a ; CPU:$CC0A PRG:0C0A 4A lsr a ; CPU:$CC0B PRG:0C0B 4A clc ; CPU:$CC0C PRG:0C0C 18 adc Zp7E ; CPU:$CC0D PRG:0C0D 65 7E sta Zp7E ; CPU:$CC0F PRG:0C0F 85 7E pla ; CPU:$CC11 PRG:0C11 68 tay ; CPU:$CC12 PRG:0C12 A8 pla ; CPU:$CC13 PRG:0C13 68 tax ; CPU:$CC14 PRG:0C14 AA rts ; CPU:$CC15 PRG:0C15 60 ;=============================================================================== ; Routine: LoadActorPosition ; Global: The routine reads no RAM 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 $0501,x; stores A to Zp77; ; loads A from $0502,x; stores A to Zp78. ; 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, Zp77, Zp78, Zp7A. ; ;=============================================================================== LoadActorPosition: lda $0501,x ; CPU:$CC16 PRG:0C16 BD 01 05 sta Zp77 ; CPU:$CC19 PRG:0C19 85 77 lda $0502,x ; CPU:$CC1B PRG:0C1B BD 02 05 sta Zp78 ; CPU:$CC1E PRG:0C1E 85 78 ;=============================================================================== ; Routine: ComputeActorFacing ; Global: The routine calls WrapActorCoordinate. ; Local: Executes 14 instructions: loads A from Zp6B; ANDs A with $01; stores ; A to Zp7A; loads A from Zp78; ANDs A with $01; stores A to Zp78; ; 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, the N, Z, C and V flags, Zp77, Zp78, Zp7A. ; ;=============================================================================== ComputeActorFacing: lda Zp6B ; CPU:$CC20 PRG:0C20 A5 6B and #$01 ; CPU:$CC22 PRG:0C22 29 01 sta Zp7A ; CPU:$CC24 PRG:0C24 85 7A lda Zp78 ; CPU:$CC26 PRG:0C26 A5 78 and #$01 ; CPU:$CC28 PRG:0C28 29 01 sta Zp78 ; CPU:$CC2A PRG:0C2A 85 78 cmp Zp7A ; CPU:$CC2C PRG:0C2C C5 7A bne ComputeActorFacing_Loop_2 ; CPU:$CC2E PRG:0C2E D0 10 lda Zp77 ; CPU:$CC30 PRG:0C30 A5 77 cmp Zp6A ; CPU:$CC32 PRG:0C32 C5 6A bcs ComputeActorFacing_Loop ; CPU:$CC34 PRG:0C34 B0 05 jsr WrapActorCoordinate ; CPU:$CC36 PRG:0C36 20 50 CC sec ; CPU:$CC39 PRG:0C39 38 rts ; CPU:$CC3A PRG:0C3A 60 ;=============================================================================== ; Routine: ComputeActorFacing_Loop ; Global: The routine calls ClampActorCoordinate. ; Local: Executes 3 instructions: calls ClampActorCoordinate; 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: ; no register, the N, Z, C and V flags, Zp77. ; ;=============================================================================== ComputeActorFacing_Loop: jsr ClampActorCoordinate ; CPU:$CC3B PRG:0C3B 20 5B CC clc ; CPU:$CC3E PRG:0C3E 18 rts ; CPU:$CC3F PRG:0C3F 60 ;=============================================================================== ; Routine: ComputeActorFacing_Loop_2 ; Global: The routine calls WrapActorCoordinate. ; Local: Executes 6 instructions: loads A from Zp77; compares A with Zp6A; ; branches on carry set to ComputeActorFacing_Loop_3; calls WrapActorCoordinate; 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: ; A, the N, Z, C and V flags, Zp77. ; ;=============================================================================== ComputeActorFacing_Loop_2: lda Zp77 ; CPU:$CC40 PRG:0C40 A5 77 cmp Zp6A ; CPU:$CC42 PRG:0C42 C5 6A bcs ComputeActorFacing_Loop_3 ; CPU:$CC44 PRG:0C44 B0 05 jsr WrapActorCoordinate ; CPU:$CC46 PRG:0C46 20 50 CC clc ; CPU:$CC49 PRG:0C49 18 rts ; CPU:$CC4A PRG:0C4A 60 ;=============================================================================== ; Routine: ComputeActorFacing_Loop_3 ; Global: The routine calls ClampActorCoordinate. ; Local: Executes 3 instructions: calls ClampActorCoordinate; 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 N, Z, C and V flags, Zp77. ; ;=============================================================================== ComputeActorFacing_Loop_3: jsr ClampActorCoordinate ; CPU:$CC4B PRG:0C4B 20 5B CC sec ; CPU:$CC4E PRG:0C4E 38 rts ; CPU:$CC4F PRG:0C4F 60 ;=============================================================================== ; Routine: WrapActorCoordinate ; Global: The routine reads no RAM 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; sets the carry flag; ; subtracts Zp6A from A; clears the carry flag; adds Zp77 to A; ; stores A to Zp77; 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, Zp77. ; ;=============================================================================== WrapActorCoordinate: lda #$00 ; CPU:$CC50 PRG:0C50 A9 00 sec ; CPU:$CC52 PRG:0C52 38 sbc Zp6A ; CPU:$CC53 PRG:0C53 E5 6A clc ; CPU:$CC55 PRG:0C55 18 adc Zp77 ; CPU:$CC56 PRG:0C56 65 77 sta Zp77 ; CPU:$CC58 PRG:0C58 85 77 rts ; CPU:$CC5A PRG:0C5A 60 ;=============================================================================== ; Routine: ClampActorCoordinate ; Global: The routine reads no RAM 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; subtracts Zp6A from A; ; stores A to Zp77; 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: ; no register, the N, Z, C and V flags, Zp77. ; ;=============================================================================== ClampActorCoordinate: sec ; CPU:$CC5B PRG:0C5B 38 sbc Zp6A ; CPU:$CC5C PRG:0C5C E5 6A sta Zp77 ; CPU:$CC5E PRG:0C5E 85 77 clc ; CPU:$CC60 PRG:0C60 18 rts ; CPU:$CC61 PRG:0C61 60 ;=============================================================================== ; Routine: StoreActorBox ; Global: The routine reads no RAM 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 Zp8F; stores A to $03C8,y; ; loads A from Zp8D; stores A to $03C9,y; loads A from Zp73,x; clears ; 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: Returns with RTS; the registers it loaded still hold the values it ; computed. ; Clobbers: ; A, the N, Z, C and V flags, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== StoreActorBox: lda Zp8F ; CPU:$CC62 PRG:0C62 A5 8F sta $03C8,y ; CPU:$CC64 PRG:0C64 99 C8 03 lda Zp8D ; CPU:$CC67 PRG:0C67 A5 8D sta $03C9,y ; CPU:$CC69 PRG:0C69 99 C9 03 lda Zp73,x ; CPU:$CC6C PRG:0C6C B5 73 clc ; CPU:$CC6E PRG:0C6E 18 adc Zp8E ; CPU:$CC6F PRG:0C6F 65 8E sta $03CA,y ; CPU:$CC71 PRG:0C71 99 CA 03 lda Zp74,x ; CPU:$CC74 PRG:0C74 B5 74 clc ; CPU:$CC76 PRG:0C76 18 adc Zp8C ; CPU:$CC77 PRG:0C77 65 8C sta $03CB,y ; CPU:$CC79 PRG:0C79 99 CB 03 sec ; CPU:$CC7C PRG:0C7C 38 rts ; CPU:$CC7D PRG:0C7D 60 ;=============================================================================== ; Routine: CheckActorBoxOverlap ; Global: The routine calls ComputeBoxOverlap. ; Local: Executes 4 instructions: stores X to ZpF8; loads X with $00; calls ; ComputeBoxOverlap; branches on carry clear to CheckActorBoxOverlapTwo_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, ZpF8, $03CD. ; ;=============================================================================== CheckActorBoxOverlap: stx ZpF8 ; CPU:$CC7E PRG:0C7E 86 F8 ldx #$00 ; CPU:$CC80 PRG:0C80 A2 00 jsr ComputeBoxOverlap ; CPU:$CC82 PRG:0C82 20 94 CC bcc CheckActorBoxOverlapTwo_Loop ; CPU:$CC85 PRG:0C85 90 05 ;=============================================================================== ; Routine: CheckActorBoxOverlapTwo ; Global: The routine calls ComputeBoxOverlap. ; Local: Executes 2 instructions: loads X with $01; calls ComputeBoxOverlap. ; 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, $03CD. ; ;=============================================================================== CheckActorBoxOverlapTwo: ldx #$01 ; CPU:$CC87 PRG:0C87 A2 01 jsr ComputeBoxOverlap ; CPU:$CC89 PRG:0C89 20 94 CC ;=============================================================================== ; Routine: CheckActorBoxOverlapTwo_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 from ZpF8; 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. ; ;=============================================================================== CheckActorBoxOverlapTwo_Loop: ldx ZpF8 ; CPU:$CC8C PRG:0C8C A6 F8 rts ; CPU:$CC8E PRG:0C8E 60 ;=============================================================================== ; Routine: CheckActorBoxOverlapThree ; Global: The routine calls CheckActorBoxOverlapTwo. ; Local: Executes 2 instructions: stores X to ZpF8; calls CheckActorBoxOverlapTwo. ; 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, ZpF8, $03CD. ; ;=============================================================================== CheckActorBoxOverlapThree: stx ZpF8 ; CPU:$CC8F PRG:0C8F 86 F8 jmp CheckActorBoxOverlapTwo ; CPU:$CC91 PRG:0C91 4C 87 CC ;=============================================================================== ; Routine: ComputeBoxOverlap ; Global: The routine writes $03CD, reads $03CD. ; Local: Executes 13 instructions: loads A from $03D0,x; clears the carry ; flag; adds $03C8,x to A; stores A to $03CD; loads A from $03D2,x; ; clears the carry flag; and 7 more instructions. ; Parameters: Reads $03CD 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 $03CD changed. ; Clobbers: ; A, the N, Z, C and V flags, $03CD. ; ;=============================================================================== ComputeBoxOverlap: lda $03D0,x ; CPU:$CC94 PRG:0C94 BD D0 03 clc ; CPU:$CC97 PRG:0C97 18 adc $03C8,x ; CPU:$CC98 PRG:0C98 7D C8 03 sta $03CD ; CPU:$CC9B PRG:0C9B 8D CD 03 lda $03D2,x ; CPU:$CC9E PRG:0C9E BD D2 03 clc ; CPU:$CCA1 PRG:0CA1 18 adc $03D0,x ; CPU:$CCA2 PRG:0CA2 7D D0 03 sec ; CPU:$CCA5 PRG:0CA5 38 sbc $03CA,x ; CPU:$CCA6 PRG:0CA6 FD CA 03 bcc ComputeBoxOverlap_Loop ; CPU:$CCA9 PRG:0CA9 90 07 cmp $03CD ; CPU:$CCAB PRG:0CAB CD CD 03 beq ComputeBoxOverlap_Loop_2 ; CPU:$CCAE PRG:0CAE F0 04 bcc ComputeBoxOverlap_Loop_2 ; CPU:$CCB0 PRG:0CB0 90 02 ;=============================================================================== ; Routine: ComputeBoxOverlap_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: 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. ; ;=============================================================================== ComputeBoxOverlap_Loop: clc ; CPU:$CCB2 PRG:0CB2 18 rts ; CPU:$CCB3 PRG:0CB3 60 ;=============================================================================== ; Routine: ComputeBoxOverlap_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ComputeBoxOverlap_Loop_2: sec ; CPU:$CCB4 PRG:0CB4 38 rts ; CPU:$CCB5 PRG:0CB5 60 ;=============================================================================== ; Routine: SetScrollTarget ; Global: The routine calls SetPpuCtrlForScroll, reads $CCE6 and $CCE7. ; Local: Executes 12 instructions: calls SetPpuCtrlForScroll; loads A from $CCE6; stores ; A to ZpE4; loads A from $CCE7; stores A to ZpE5; loads A with $00; ; and 6 more instructions. ; Parameters: Reads $CCE6 and $CCE7 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, the RAM fields it writes. ; ;=============================================================================== SetScrollTarget: jsr SetPpuCtrlForScroll ; CPU:$CCB6 PRG:0CB6 20 1E D3 lda $CCE6 ; CPU:$CCB9 PRG:0CB9 AD E6 CC sta ZpE4 ; CPU:$CCBC PRG:0CBC 85 E4 lda $CCE7 ; CPU:$CCBE PRG:0CBE AD E7 CC sta ZpE5 ; CPU:$CCC1 PRG:0CC1 85 E5 lda #$00 ; CPU:$CCC3 PRG:0CC3 A9 00 sta ZpE0 ; CPU:$CCC5 PRG:0CC5 85 E0 lda #$3F ; CPU:$CCC7 PRG:0CC7 A9 3F sta ZpE1 ; CPU:$CCC9 PRG:0CC9 85 E1 lda #$20 ; CPU:$CCCB PRG:0CCB A9 20 sta ZpE2 ; CPU:$CCCD PRG:0CCD 85 E2 rts ; CPU:$CCCF PRG:0CCF 60 ;=============================================================================== ; Routine: SetScrollTargetOnly ; Global: The routine calls SetScrollTarget. ; Local: Executes 1 instruction: calls SetScrollTarget. ; 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, the RAM fields it writes. ; ;=============================================================================== SetScrollTargetOnly: jsr SetScrollTarget ; CPU:$CCD0 PRG:0CD0 20 B6 CC ;=============================================================================== ; Routine: ClearVramToAttribute ; Global: The routine calls SetPpuVramAddressOne and ResetScrollPosition. ; Local: Executes 2 instructions: calls SetPpuVramAddressOne; calls ResetScrollPosition. ; 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, ZpE2, PPUADDR, PPUDATA. ; ;=============================================================================== ClearVramToAttribute: jsr SetPpuVramAddressOne ; CPU:$CCD3 PRG:0CD3 20 AA C4 jmp ResetScrollPosition ; CPU:$CCD6 PRG:0CD6 4C 11 CA ;=============================================================================== ; Routine: ScrollScreenUp ; Global: The routine calls SetScrollTarget, AddToCoordinatePair and ClearVramToAttribute. ; Local: Executes 5 instructions: calls SetScrollTarget; loads X with $E4; loads A ; with $20; calls AddToCoordinatePair; calls ClearVramToAttribute. ; 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. ; ;=============================================================================== ScrollScreenUp: jsr SetScrollTarget ; CPU:$CCD9 PRG:0CD9 20 B6 CC ldx #$E4 ; CPU:$CCDC PRG:0CDC A2 E4 lda #$20 ; CPU:$CCDE PRG:0CDE A9 20 jsr AddToCoordinatePair ; CPU:$CCE0 PRG:0CE0 20 3F C5 jmp ClearVramToAttribute ; CPU:$CCE3 PRG:0CE3 4C D3 CC ; ---- data $CCE6-$CD27 (66 bytes) ---- ; referenced by `lda $CCE6` at $CCB9 (operand $CCE6 falls inside this region) ; referenced by `lda $CCE7` at $CCBE (operand $CCE7 falls inside this region) ScreenParameterPointerTable: .byte $E8, $CC, $0F, $30, $15, $2C, $0F, $30, $16, $19, $0F, $30, $16, $10, $0F, $30 ; CPU:$CCE6 PRG:0CE6 E8 CC 0F 30 15 2C 0F 30 16 19 0F 30 16 10 0F 30 .byte $16, $28, $0F, $36, $03, $06, $0F, $30, $10, $17, $0F, $36, $15, $2C, $0F, $30 ; CPU:$CCF6 PRG:0CF6 16 28 0F 36 03 06 0F 30 10 17 0F 36 15 2C 0F 30 .byte $27, $16, $0F, $30, $16, $2C, $0F, $30, $16, $3C, $0F, $30, $16, $10, $0F, $16 ; CPU:$CD06 PRG:0D06 27 16 0F 30 16 2C 0F 30 16 3C 0F 30 16 10 0F 16 .byte $2C, $29, $0F, $30, $12, $17, $0F, $30, $10, $17, $0F, $2C, $16, $36, $0F, $30 ; CPU:$CD16 PRG:0D16 2C 29 0F 30 12 17 0F 30 10 17 0F 2C 16 36 0F 30 .byte $27, $16 ; CPU:$CD26 PRG:0D26 27 16 ;=============================================================================== ; Routine: IsActorTypeOne ; Global: The routine reads no RAM 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 Zp63; compares 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, Z and C flags. ; ;=============================================================================== IsActorTypeOne: lda Zp63 ; CPU:$CD28 PRG:0D28 A5 63 cmp #$01 ; CPU:$CD2A PRG:0D2A C9 01 rts ; CPU:$CD2C PRG:0D2C 60 ;=============================================================================== ; Routine: GetActorTypeIndex ; Global: The routine reads no RAM 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 Zp63; compares X 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: ; X, the N, Z and C flags. ; ;=============================================================================== GetActorTypeIndex: ldx Zp63 ; CPU:$CD2D PRG:0D2D A6 63 cpx #$01 ; CPU:$CD2F PRG:0D2F E0 01 rts ; CPU:$CD31 PRG:0D31 60 ;=============================================================================== ; Routine: UpdateRingActor ; Global: The routine calls SetRingCoordinate, CheckRingHit and CheckActorBoxOverlapFive. ; Local: Executes 12 instructions: loads X with $90; stores X to ZpF9; loads A ; from Zp63; compares A with $02; branches on equal to UpdateRingActor_Loop; ; compares A with $05; 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 RAM fields it writes. ; ;=============================================================================== UpdateRingActor: ldx #$90 ; CPU:$CD32 PRG:0D32 A2 90 stx ZpF9 ; CPU:$CD34 PRG:0D34 86 F9 lda Zp63 ; CPU:$CD36 PRG:0D36 A5 63 cmp #$02 ; CPU:$CD38 PRG:0D38 C9 02 beq UpdateRingActor_Loop ; CPU:$CD3A PRG:0D3A F0 11 cmp #$05 ; CPU:$CD3C PRG:0D3C C9 05 beq UpdateRingActor_Loop_2 ; CPU:$CD3E PRG:0D3E F0 11 lda #$00 ; CPU:$CD40 PRG:0D40 A9 00 ldy #$B0 ; CPU:$CD42 PRG:0D42 A0 B0 jsr SetRingCoordinate ; CPU:$CD44 PRG:0D44 20 61 CD jsr CheckRingHit ; CPU:$CD47 PRG:0D47 20 68 CD jmp CheckActorBoxOverlapFive ; CPU:$CD4A PRG:0D4A 4C E8 CD ;=============================================================================== ; Routine: UpdateRingActor_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 with $68; branches on not equal to ; UpdateRingActor_Loop_3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 RAM fields it writes. ; ;=============================================================================== UpdateRingActor_Loop: ldy #$68 ; CPU:$CD4D PRG:0D4D A0 68 bne UpdateRingActor_Loop_3 ; CPU:$CD4F PRG:0D4F D0 02 ;=============================================================================== ; Routine: UpdateRingActor_Loop_2 ; Global: The routine reads no RAM 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 $78. ; 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 RAM fields it writes. ; ;=============================================================================== UpdateRingActor_Loop_2: ldy #$78 ; CPU:$CD51 PRG:0D51 A0 78 ;=============================================================================== ; Routine: UpdateRingActor_Loop_3 ; Global: The routine calls SetRingCoordinate, CheckRingHit, CheckActorBoxOverlapFour and CheckActorBoxOverlapFive. ; Local: Executes 5 instructions: loads A with $04; calls SetRingCoordinate; calls ; CheckRingHit; calls CheckActorBoxOverlapFour; calls CheckActorBoxOverlapFive. ; 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 RAM fields it writes. ; ;=============================================================================== UpdateRingActor_Loop_3: lda #$04 ; CPU:$CD53 PRG:0D53 A9 04 jsr SetRingCoordinate ; CPU:$CD55 PRG:0D55 20 61 CD jsr CheckRingHit ; CPU:$CD58 PRG:0D58 20 68 CD jsr CheckActorBoxOverlapFour ; CPU:$CD5B PRG:0D5B 20 C7 CD jmp CheckActorBoxOverlapFive ; CPU:$CD5E PRG:0D5E 4C E8 CD ;=============================================================================== ; Routine: SetRingCoordinate ; Global: The routine writes $0594 and $0593. ; Local: Executes 2 instructions: stores A to $0594; stores Y to $0593. ; 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 $0594 and $0593 changed. ; Clobbers: ; no register, $0593, $0594. ; ;=============================================================================== SetRingCoordinate: sta $0594 ; CPU:$CD61 PRG:0D61 8D 94 05 sty $0593 ; CPU:$CD64 PRG:0D64 8C 93 05 ;=============================================================================== ; Routine: SetRingCoordinate_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: 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. ; ;=============================================================================== SetRingCoordinate_OnNonzero: rts ; CPU:$CD67 PRG:0D67 60 ;=============================================================================== ; Routine: CheckRingHit ; Global: The routine reads $0590. ; Local: Executes 13 instructions: returns with RTS; loads A from Zp52; ; compares A with $03; branches on not equal to SetRingCoordinate_OnNonzero; loads A ; from Zp6C; branches on not equal to SetRingCoordinate_OnNonzero; and 7 more ; instructions. ; Parameters: Reads $0590 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 RAM fields it writes. ; ;=============================================================================== CheckRingHit: lda Zp52 ; CPU:$CD68 PRG:0D68 A5 52 cmp #$03 ; CPU:$CD6A PRG:0D6A C9 03 bne SetRingCoordinate_OnNonzero; CPU:$CD6C PRG:0D6C D0 F9 lda Zp6C ; CPU:$CD6E PRG:0D6E A5 6C bne SetRingCoordinate_OnNonzero; CPU:$CD70 PRG:0D70 D0 F5 lda $0590 ; CPU:$CD72 PRG:0D72 AD 90 05 bne CheckRingHit_Loop_3 ; CPU:$CD75 PRG:0D75 D0 29 ldx Zp69 ; CPU:$CD77 PRG:0D77 A6 69 ldy Zp63 ; CPU:$CD79 PRG:0D79 A4 63 cpy #$05 ; CPU:$CD7B PRG:0D7B C0 05 bne CheckRingHit_Loop ; CPU:$CD7D PRG:0D7D D0 01 dex ; CPU:$CD7F PRG:0D7F CA ;=============================================================================== ; Routine: CheckRingHit_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 9 instructions: returns with RTS; copies X into A; branches ; on not equal to SetRingCoordinate_OnNonzero; compares Y with $05; branches on not ; equal to CheckRingHit_Loop_2; loads X from Zp68; 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, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== CheckRingHit_Loop: txa ; CPU:$CD80 PRG:0D80 8A bne SetRingCoordinate_OnNonzero; CPU:$CD81 PRG:0D81 D0 E4 cpy #$05 ; CPU:$CD83 PRG:0D83 C0 05 bne CheckRingHit_Loop_2 ; CPU:$CD85 PRG:0D85 D0 08 ldx Zp68 ; CPU:$CD87 PRG:0D87 A6 68 cpx #$A0 ; CPU:$CD89 PRG:0D89 E0 A0 bcs SetRingCoordinate_OnNonzero; CPU:$CD8B PRG:0D8B B0 DA ldx #$A0 ; CPU:$CD8D PRG:0D8D A2 A0 ;=============================================================================== ; Routine: CheckRingHit_Loop_2 ; Global: The routine calls FlipActorFacing, writes $0591. ; Local: Executes 3 instructions: stores X to $0591; loads X with $90; calls ; FlipActorFacing. ; 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 $0591 changed. ; Clobbers: ; A, X and Y, the N, Z, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== CheckRingHit_Loop_2: stx $0591 ; CPU:$CD8F PRG:0D8F 8E 91 05 ldx #$90 ; CPU:$CD92 PRG:0D92 A2 90 jsr FlipActorFacing ; CPU:$CD94 PRG:0D94 20 6E F0 ;=============================================================================== ; Routine: CheckRingHit_OnCarryClear ; Global: The routine writes $0590. ; Local: Executes 4 instructions: loads A with $FF; stores A to $0590; loads X ; with $90; branches on not equal to CheckRingHit_Loop_7. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 $0590 changed. ; Clobbers: ; A, X and Y, the N, Z, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== CheckRingHit_OnCarryClear: lda #$FF ; CPU:$CD97 PRG:0D97 A9 FF sta $0590 ; CPU:$CD99 PRG:0D99 8D 90 05 ldx #$90 ; CPU:$CD9C PRG:0D9C A2 90 bne CheckRingHit_Loop_7 ; CPU:$CD9E PRG:0D9E D0 24 ;=============================================================================== ; Routine: CheckRingHit_Loop_3 ; Global: The routine writes $0590. ; Local: Executes 14 instructions: loads A with $FF; stores A to $0590; loads ; X with $90; branches on not equal to CheckRingHit_Loop_7; loads X from Zp69; ; decrements 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: Leaves through one of its branches rather than a return; the caller ; resumes at the branch target. Leaves $0590 changed. ; Clobbers: ; A, X and Y, the N, Z, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== CheckRingHit_Loop_3: ldx Zp69 ; CPU:$CDA0 PRG:0DA0 A6 69 dex ; CPU:$CDA2 PRG:0DA2 CA bne CheckRingHit_OnCarryClear ; CPU:$CDA3 PRG:0DA3 D0 F2 ldx Zp68 ; CPU:$CDA5 PRG:0DA5 A6 68 lda Zp63 ; CPU:$CDA7 PRG:0DA7 A5 63 cmp #$05 ; CPU:$CDA9 PRG:0DA9 C9 05 bne CheckRingHit_Loop_4 ; CPU:$CDAB PRG:0DAB D0 06 cpx #$F0 ; CPU:$CDAD PRG:0DAD E0 F0 bcc CheckRingHit_OnCarryClear ; CPU:$CDAF PRG:0DAF 90 E6 bcs CheckRingHit_Loop_5 ; CPU:$CDB1 PRG:0DB1 B0 04 ;=============================================================================== ; Routine: CheckRingHit_Loop_4 ; Global: The routine writes $0590. ; Local: Executes 16 instructions: loads A with $FF; stores A to $0590; loads ; X with $90; branches on not equal to CheckRingHit_Loop_7; loads X from Zp69; ; decrements 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. Leaves $0590 changed. ; Clobbers: ; A, X and Y, the N, Z, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== CheckRingHit_Loop_4: cpx #$80 ; CPU:$CDB3 PRG:0DB3 E0 80 bcc CheckRingHit_OnCarryClear ; CPU:$CDB5 PRG:0DB5 90 E0 ;=============================================================================== ; Routine: CheckRingHit_Loop_5 ; Global: The routine writes $0590. ; Local: Executes 5 instructions: loads A with $00; stores A to $0590; loads X ; from Zp65; branches on not equal to CheckRingHit_Loop_6; loads A with $67. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 $0590 changed. ; Clobbers: ; A, X and Y, the N, Z, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== CheckRingHit_Loop_5: lda #$00 ; CPU:$CDB7 PRG:0DB7 A9 00 sta $0590 ; CPU:$CDB9 PRG:0DB9 8D 90 05 ldx Zp65 ; CPU:$CDBC PRG:0DBC A6 65 bne CheckRingHit_Loop_6 ; CPU:$CDBE PRG:0DBE D0 02 lda #$67 ; CPU:$CDC0 PRG:0DC0 A9 67 ;=============================================================================== ; Routine: CheckRingHit_Loop_6 ; Global: The routine reads no RAM 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 $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, X and Y, the N, Z, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== CheckRingHit_Loop_6: ldx #$90 ; CPU:$CDC2 PRG:0DC2 A2 90 ;=============================================================================== ; Routine: CheckRingHit_Loop_7 ; Global: The routine calls InitActorSpriteDraw. ; Local: Executes 1 instruction: calls InitActorSpriteDraw. ; 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 RAM fields it writes. ; ;=============================================================================== CheckRingHit_Loop_7: jmp InitActorSpriteDraw ; CPU:$CDC4 PRG:0DC4 4C 26 ED ;=============================================================================== ; Routine: CheckActorBoxOverlapFour ; Global: The routine calls LoadActorPosition. ; Local: Executes 11 instructions: returns with RTS; loads X with $90; loads A ; from $0500,x; branches on equal to SetRingCoordinate_OnNonzero; calls LoadActorPosition; ; branches on carry set to CheckActorBoxOverlapFour_OnCarryClear; 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 X, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== CheckActorBoxOverlapFour: ldx #$90 ; CPU:$CDC7 PRG:0DC7 A2 90 lda $0500,x ; CPU:$CDC9 PRG:0DC9 BD 00 05 beq SetRingCoordinate_OnNonzero; CPU:$CDCC PRG:0DCC F0 99 jsr LoadActorPosition ; CPU:$CDCE PRG:0DCE 20 16 CC bcs CheckActorBoxOverlapFour_OnCarryClear ; CPU:$CDD1 PRG:0DD1 B0 14 ldx #$00 ; CPU:$CDD3 PRG:0DD3 A2 00 adc #$10 ; CPU:$CDD5 PRG:0DD5 69 10 sta Zp84 ; CPU:$CDD7 PRG:0DD7 85 84 bcc CheckActorBoxOverlapFour_Loop ; CPU:$CDD9 PRG:0DD9 90 02 ldx #$01 ; CPU:$CDDB PRG:0DDB A2 01 ;=============================================================================== ; Routine: CheckActorBoxOverlapFour_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: stores X to Zp85; loads A with $7F; stores A ; to Zp83; loads A with $01; stores A to Zp80. ; 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, Zp80, Zp83, Zp85. ; ;=============================================================================== CheckActorBoxOverlapFour_Loop: stx Zp85 ; CPU:$CDDD PRG:0DDD 86 85 lda #$7F ; CPU:$CDDF PRG:0DDF A9 7F sta Zp83 ; CPU:$CDE1 PRG:0DE1 85 83 lda #$01 ; CPU:$CDE3 PRG:0DE3 A9 01 sta Zp80 ; CPU:$CDE5 PRG:0DE5 85 80 ;=============================================================================== ; Routine: CheckActorBoxOverlapFour_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 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. ; ;=============================================================================== CheckActorBoxOverlapFour_OnCarryClear: rts ; CPU:$CDE7 PRG:0DE7 60 ;=============================================================================== ; Routine: CheckActorBoxOverlapFive ; Global: The routine calls LoadActorPosition. ; Local: Executes 20 instructions: returns with RTS; loads X with $90; loads A ; from $0500,x; branches on equal to CheckActorBoxOverlapFour_OnCarryClear; calls LoadActorPosition; ; branches on carry set to CheckActorBoxOverlapFour_OnCarryClear; 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, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== CheckActorBoxOverlapFive: ldx #$90 ; CPU:$CDE8 PRG:0DE8 A2 90 lda $0500,x ; CPU:$CDEA PRG:0DEA BD 00 05 beq CheckActorBoxOverlapFour_OnCarryClear ; CPU:$CDED PRG:0DED F0 F8 jsr LoadActorPosition ; CPU:$CDEF PRG:0DEF 20 16 CC bcs CheckActorBoxOverlapFour_OnCarryClear ; CPU:$CDF2 PRG:0DF2 B0 F3 lda Zp74 ; CPU:$CDF4 PRG:0DF4 A5 74 cmp #$20 ; CPU:$CDF6 PRG:0DF6 C9 20 bcc CheckActorBoxOverlapFour_OnCarryClear ; CPU:$CDF8 PRG:0DF8 90 ED lda ZpCB ; CPU:$CDFA PRG:0DFA A5 CB bne CheckActorBoxOverlapFour_OnCarryClear ; CPU:$CDFC PRG:0DFC D0 E9 lda Zp73 ; CPU:$CDFE PRG:0DFE A5 73 clc ; CPU:$CE00 PRG:0E00 18 adc #$18 ; CPU:$CE01 PRG:0E01 69 18 ldy Zp64 ; CPU:$CE03 PRG:0E03 A4 64 cpy #$00 ; CPU:$CE05 PRG:0E05 C0 00 bne CheckActorBoxOverlapFive_Loop ; CPU:$CE07 PRG:0E07 D0 05 lda Zp83 ; CPU:$CE09 PRG:0E09 A5 83 clc ; CPU:$CE0B PRG:0E0B 18 adc #$0C ; CPU:$CE0C PRG:0E0C 69 0C ;=============================================================================== ; Routine: CheckActorBoxOverlapFive_Loop ; Global: The routine calls SetActorScreenRowThree and SetActorScreenRowFour. ; Local: Executes 11 instructions: returns with RTS; compares A with $0503,x; ; branches on carry clear to CheckActorBoxOverlapFour_OnCarryClear; subtracts $04 from A; compares ; A with $0503,x; branches on carry set to CheckActorBoxOverlapFour_OnCarryClear; 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. ; ;=============================================================================== CheckActorBoxOverlapFive_Loop: cmp $0503,x ; CPU:$CE0E PRG:0E0E DD 03 05 bcc CheckActorBoxOverlapFour_OnCarryClear ; CPU:$CE11 PRG:0E11 90 D4 sbc #$04 ; CPU:$CE13 PRG:0E13 E9 04 cmp $0503,x ; CPU:$CE15 PRG:0E15 DD 03 05 bcs CheckActorBoxOverlapFour_OnCarryClear ; CPU:$CE18 PRG:0E18 B0 CD jsr SetActorScreenRowThree ; CPU:$CE1A PRG:0E1A 20 03 E9 ldy Zp64 ; CPU:$CE1D PRG:0E1D A4 64 cpy #$00 ; CPU:$CE1F PRG:0E1F C0 00 bne CheckActorBoxOverlapFive_Loop_2 ; CPU:$CE21 PRG:0E21 D0 03 jsr SetActorScreenRowFour ; CPU:$CE23 PRG:0E23 20 1F E9 ;=============================================================================== ; Routine: CheckActorBoxOverlapFive_Loop_2 ; Global: The routine calls SetActorBoxTargetHigh and SetActorBoxTargetLow. ; Local: Executes 5 instructions: returns with RTS; calls SetActorBoxTargetHigh; loads Y ; from Zp65; branches on equal to CheckActorBoxOverlapFive_Loop_3; calls SetActorBoxTargetLow. ; 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. ; ;=============================================================================== CheckActorBoxOverlapFive_Loop_2: jsr SetActorBoxTargetHigh ; CPU:$CE26 PRG:0E26 20 9E CE ldy Zp65 ; CPU:$CE29 PRG:0E29 A4 65 beq CheckActorBoxOverlapFive_Loop_3 ; CPU:$CE2B PRG:0E2B F0 03 jsr SetActorBoxTargetLow ; CPU:$CE2D PRG:0E2D 20 8E CE ;=============================================================================== ; Routine: CheckActorBoxOverlapFive_Loop_3 ; Global: The routine calls CheckActorBoxOverlapThree. ; Local: Executes 10 instructions: returns with RTS; calls CheckActorBoxOverlapThree; branches ; on carry clear to CheckActorBoxOverlapFour_OnCarryClear; loads X with $90; loads A from $0503,x; ; clears the carry flag; 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. ; ;=============================================================================== CheckActorBoxOverlapFive_Loop_3: jsr CheckActorBoxOverlapThree ; CPU:$CE30 PRG:0E30 20 8F CC bcc CheckActorBoxOverlapFour_OnCarryClear ; CPU:$CE33 PRG:0E33 90 B2 ldx #$90 ; CPU:$CE35 PRG:0E35 A2 90 lda $0503,x ; CPU:$CE37 PRG:0E37 BD 03 05 clc ; CPU:$CE3A PRG:0E3A 18 adc #$EA ; CPU:$CE3B PRG:0E3B 69 EA ldy Zp65 ; CPU:$CE3D PRG:0E3D A4 65 bne CheckActorBoxOverlapFive_Loop_4 ; CPU:$CE3F PRG:0E3F D0 02 adc #$01 ; CPU:$CE41 PRG:0E41 69 01 ;=============================================================================== ; Routine: CheckActorBoxOverlapFive_Loop_4 ; Global: The routine calls GetActorTypeIndex. ; Local: Executes 9 instructions: stores A to Zp73; calls GetActorTypeIndex; branches ; on not equal to CheckActorBoxOverlapFive_Loop_5; clears the carry flag; adds $08 to A; ; stores A to Zp83; 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. ; ;=============================================================================== CheckActorBoxOverlapFive_Loop_4: sta Zp73 ; CPU:$CE43 PRG:0E43 85 73 jsr GetActorTypeIndex ; CPU:$CE45 PRG:0E45 20 2D CD bne CheckActorBoxOverlapFive_Loop_5 ; CPU:$CE48 PRG:0E48 D0 0A clc ; CPU:$CE4A PRG:0E4A 18 adc #$08 ; CPU:$CE4B PRG:0E4B 69 08 sta Zp83 ; CPU:$CE4D PRG:0E4D 85 83 sec ; CPU:$CE4F PRG:0E4F 38 sbc #$18 ; CPU:$CE50 PRG:0E50 E9 18 sta Zp73 ; CPU:$CE52 PRG:0E52 85 73 ;=============================================================================== ; Routine: CheckActorBoxOverlapFive_Loop_5 ; Global: The routine calls AddToActorScore_Loop_9, ResetActorSlots and PlaySoundEffectPair, writes $030B. ; Local: Executes 11 instructions: calls AddToActorScore_Loop_9; loads A with $00; stores A ; to ZpDF; calls ResetActorSlots; calls PlaySoundEffectPair; loads A with $0A; 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 $030B changed. ; Clobbers: ; A, X and Y, the N, Z and C flags, the RAM fields it writes. ; ;=============================================================================== CheckActorBoxOverlapFive_Loop_5: jsr AddToActorScore_Loop_9 ; CPU:$CE54 PRG:0E54 20 38 DC lda #$00 ; CPU:$CE57 PRG:0E57 A9 00 sta ZpDF ; CPU:$CE59 PRG:0E59 85 DF jsr ResetActorSlots ; CPU:$CE5B PRG:0E5B 20 3B CA jsr PlaySoundEffectPair ; CPU:$CE5E PRG:0E5E 20 DA CB lda #$0A ; CPU:$CE61 PRG:0E61 A9 0A sta Zp76 ; CPU:$CE63 PRG:0E63 85 76 lda #$00 ; CPU:$CE65 PRG:0E65 A9 00 sta $030B ; CPU:$CE67 PRG:0E67 8D 0B 03 inc Zp0B ; CPU:$CE6A PRG:0E6A E6 0B rts ; CPU:$CE6C PRG:0E6C 60 ;=============================================================================== ; Routine: UpdateActorRow ; Global: The routine calls LoadActorPosition and IsActorTypeOne. ; Local: Executes 11 instructions: loads X with $90; calls LoadActorPosition; adds $0C ; to A; compares A with Zp74; branches on equal to UpdateActorRow_Loop_2; branches ; on carry clear to UpdateActorRow_Loop; 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 X, the N, Z, C and V flags, Zp74, Zp77, Zp78, Zp7A, Zp84. ; ;=============================================================================== UpdateActorRow: ldx #$90 ; CPU:$CE6D PRG:0E6D A2 90 jsr LoadActorPosition ; CPU:$CE6F PRG:0E6F 20 16 CC adc #$0C ; CPU:$CE72 PRG:0E72 69 0C cmp Zp74 ; CPU:$CE74 PRG:0E74 C5 74 beq UpdateActorRow_Loop_2 ; CPU:$CE76 PRG:0E76 F0 15 bcc UpdateActorRow_Loop ; CPU:$CE78 PRG:0E78 90 0A inc Zp74 ; CPU:$CE7A PRG:0E7A E6 74 jsr IsActorTypeOne ; CPU:$CE7C PRG:0E7C 20 28 CD bne UpdateActorRow_Loop_2 ; CPU:$CE7F PRG:0E7F D0 0C inc Zp84 ; CPU:$CE81 PRG:0E81 E6 84 rts ; CPU:$CE83 PRG:0E83 60 ;=============================================================================== ; Routine: UpdateActorRow_Loop ; Global: The routine calls IsActorTypeOne. ; Local: Executes 4 instructions: decrements Zp74; calls IsActorTypeOne; branches on ; not equal to UpdateActorRow_Loop_2; decrements Zp84. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp74, Zp84. ; ;=============================================================================== UpdateActorRow_Loop: dec Zp74 ; CPU:$CE84 PRG:0E84 C6 74 jsr IsActorTypeOne ; CPU:$CE86 PRG:0E86 20 28 CD bne UpdateActorRow_Loop_2 ; CPU:$CE89 PRG:0E89 D0 02 dec Zp84 ; CPU:$CE8B PRG:0E8B C6 84 ;=============================================================================== ; Routine: UpdateActorRow_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== UpdateActorRow_Loop_2: rts ; CPU:$CE8D PRG:0E8D 60 ;=============================================================================== ; Routine: SetActorBoxTargetLow ; Global: The routine calls StoreActorBoxTarget, writes $03C9, reads $0591. ; Local: Executes 7 instructions: loads A with $20; stores A to $03C9; loads A ; from $0591; clears the carry flag; adds $08 to A; stores A to Zp77; ; and 1 more instruction. ; Parameters: Reads $0591 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. Leaves $03C9 changed. ; Clobbers: ; A, the N, Z, C and V flags, Zp77, Zp78, Zp7A, $03C9, $03CB. ; ;=============================================================================== SetActorBoxTargetLow: lda #$20 ; CPU:$CE8E PRG:0E8E A9 20 sta $03C9 ; CPU:$CE90 PRG:0E90 8D C9 03 lda $0591 ; CPU:$CE93 PRG:0E93 AD 91 05 clc ; CPU:$CE96 PRG:0E96 18 adc #$08 ; CPU:$CE97 PRG:0E97 69 08 sta Zp77 ; CPU:$CE99 PRG:0E99 85 77 jmp StoreActorBoxTarget ; CPU:$CE9B PRG:0E9B 4C AB CE ;=============================================================================== ; Routine: SetActorBoxTargetHigh ; Global: The routine writes $03C9, reads $0591. ; Local: Executes 6 instructions: loads A with $18; stores A to $03C9; loads A ; with $08; clears the carry flag; adds $0591 to A; stores A to Zp77. ; Parameters: Reads $0591 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. Leaves $03C9 changed. ; Clobbers: ; A, the N, Z, C and V flags, Zp77, Zp78, Zp7A, $03C9, $03CB. ; ;=============================================================================== SetActorBoxTargetHigh: lda #$18 ; CPU:$CE9E PRG:0E9E A9 18 sta $03C9 ; CPU:$CEA0 PRG:0EA0 8D C9 03 lda #$08 ; CPU:$CEA3 PRG:0EA3 A9 08 clc ; CPU:$CEA5 PRG:0EA5 18 adc $0591 ; CPU:$CEA6 PRG:0EA6 6D 91 05 sta Zp77 ; CPU:$CEA9 PRG:0EA9 85 77 ;=============================================================================== ; Routine: StoreActorBoxTarget ; Global: The routine calls ComputeActorFacing, writes $03CB, reads $0592. ; Local: Executes 5 instructions: loads A from $0592; stores A to Zp78; calls ; ComputeActorFacing; stores A to $03CB; returns with RTS. ; Parameters: Reads $0592 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 $03CB changed. ; Clobbers: ; A, the N, Z, C and V flags, Zp77, Zp78, Zp7A, $03CB. ; ;=============================================================================== StoreActorBoxTarget: lda $0592 ; CPU:$CEAB PRG:0EAB AD 92 05 sta Zp78 ; CPU:$CEAE PRG:0EAE 85 78 jsr ComputeActorFacing ; CPU:$CEB0 PRG:0EB0 20 20 CC sta $03CB ; CPU:$CEB3 PRG:0EB3 8D CB 03 rts ; CPU:$CEB6 PRG:0EB6 60 ;=============================================================================== ; Routine: DrawActorBox ; Global: The routine calls ComputeActorOffset, SetActorBoxFlag, ResetActorBoxIndex, ClearActorBoxFlag and 2 more, ; reads $CFB8 and $CFB7. ; Local: Executes 16 instructions: calls ComputeActorOffset; calls SetActorBoxFlag; loads A ; from $CFB8; stores A to Zp7D; loads A from $CFB7; stores A to Zp7C; ; and 10 more instructions. ; Parameters: Reads $CFB8 and $CFB7 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 and V flags, the RAM fields it writes. ; ;=============================================================================== DrawActorBox: jsr ComputeActorOffset ; CPU:$CEB7 PRG:0EB7 20 0D CF jsr SetActorBoxFlag ; CPU:$CEBA PRG:0EBA 20 9D CF lda $CFB8 ; CPU:$CEBD PRG:0EBD AD B8 CF sta Zp7D ; CPU:$CEC0 PRG:0EC0 85 7D lda $CFB7 ; CPU:$CEC2 PRG:0EC2 AD B7 CF sta Zp7C ; CPU:$CEC5 PRG:0EC5 85 7C jsr ResetActorBoxIndex ; CPU:$CEC7 PRG:0EC7 20 E3 CE jsr ClearActorBoxFlag ; CPU:$CECA PRG:0ECA 20 B3 CF lda $CFB8 ; CPU:$CECD PRG:0ECD AD B8 CF sta Zp7D ; CPU:$CED0 PRG:0ED0 85 7D lda $CFB7 ; CPU:$CED2 PRG:0ED2 AD B7 CF sta Zp7C ; CPU:$CED5 PRG:0ED5 85 7C jsr ResetActorBoxIndex ; CPU:$CED7 PRG:0ED7 20 E3 CE jsr ClearActorBoxFlag ; CPU:$CEDA PRG:0EDA 20 B3 CF jsr QueueOamSprite ; CPU:$CEDD PRG:0EDD 20 58 CF jmp StartOamSpriteList ; CPU:$CEE0 PRG:0EE0 4C 80 D2 ;=============================================================================== ; Routine: ResetActorBoxIndex ; Global: The routine reads no RAM 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 $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, Zp77, PPUADDR, PPUDATA. ; ;=============================================================================== ResetActorBoxIndex: ldy #$00 ; CPU:$CEE3 PRG:0EE3 A0 00 ;=============================================================================== ; Routine: SetActorBoxVramAddress ; Global: The routine writes the PPUADDR registers, reads the PPUSTATUS ; register. ; Local: Executes 5 instructions: loads A from the PPUSTATUS register; loads A ; from Zp78; stores A to the PPUADDR register; loads A from Zp77; ; 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: 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, Zp77, PPUADDR, PPUDATA. ; ;=============================================================================== SetActorBoxVramAddress: lda PPUSTATUS ; CPU:$CEE5 PRG:0EE5 AD 02 20 lda Zp78 ; CPU:$CEE8 PRG:0EE8 A5 78 sta PPUADDR ; CPU:$CEEA PRG:0EEA 8D 06 20 lda Zp77 ; CPU:$CEED PRG:0EED A5 77 sta PPUADDR ; CPU:$CEEF PRG:0EEF 8D 06 20 ;=============================================================================== ; Routine: ReadActorBoxByte ; Global: The routine reads no RAM 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 ((Zp7C),y); increments Y; ; copies A into X; increments X; branches on not equal to ReadActorBoxByte_Loop; ; 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, Zp77, PPUDATA. ; ;=============================================================================== ReadActorBoxByte: lda (Zp7C),y ; CPU:$CEF2 PRG:0EF2 B1 7C iny ; CPU:$CEF4 PRG:0EF4 C8 tax ; CPU:$CEF5 PRG:0EF5 AA inx ; CPU:$CEF6 PRG:0EF6 E8 bne ReadActorBoxByte_Loop ; CPU:$CEF7 PRG:0EF7 D0 01 rts ; CPU:$CEF9 PRG:0EF9 60 ;=============================================================================== ; Routine: ReadActorBoxByte_Loop ; Global: The routine calls ReadActorBoxByte, writes the PPUDATA register. ; Local: Executes 4 instructions: increments X; branches on equal to ReadActorBoxByte_Loop_2; ; stores A to the PPUDATA register; calls ReadActorBoxByte. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, Zp77, PPUADDR, PPUDATA. ; ;=============================================================================== ReadActorBoxByte_Loop: inx ; CPU:$CEFA PRG:0EFA E8 beq ReadActorBoxByte_Loop_2 ; CPU:$CEFB PRG:0EFB F0 06 sta PPUDATA ; CPU:$CEFD PRG:0EFD 8D 07 20 jmp ReadActorBoxByte ; CPU:$CF00 PRG:0F00 4C F2 CE ;=============================================================================== ; Routine: ReadActorBoxByte_Loop_2 ; Global: The routine calls SetActorBoxVramAddress. ; Local: Executes 5 instructions: loads A from Zp77; clears the carry flag; ; adds $20 to A; stores A to Zp77; calls SetActorBoxVramAddress. ; 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, Zp77, PPUADDR, PPUDATA. ; ;=============================================================================== ReadActorBoxByte_Loop_2: lda Zp77 ; CPU:$CF03 PRG:0F03 A5 77 clc ; CPU:$CF05 PRG:0F05 18 adc #$20 ; CPU:$CF06 PRG:0F06 69 20 sta Zp77 ; CPU:$CF08 PRG:0F08 85 77 jmp SetActorBoxVramAddress ; CPU:$CF0A PRG:0F0A 4C E5 CE ;=============================================================================== ; Routine: ComputeActorOffset ; Global: The routine writes $040F. ; Local: Executes 19 instructions: loads A from Zp64; shifts a left; copies A ; into X; sets the carry flag; loads A from $CF3F,x; subtracts Zp6A ; from A; 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 $040F changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, Zp68, Zp69, $040E, $040F. ; ;=============================================================================== ComputeActorOffset: lda Zp64 ; CPU:$CF0D PRG:0F0D A5 64 asl a ; CPU:$CF0F PRG:0F0F 0A tax ; CPU:$CF10 PRG:0F10 AA sec ; CPU:$CF11 PRG:0F11 38 lda $CF3F,x ; CPU:$CF12 PRG:0F12 BD 3F CF sbc Zp6A ; CPU:$CF15 PRG:0F15 E5 6A sta Zp68 ; CPU:$CF17 PRG:0F17 85 68 lda $CF40,x ; CPU:$CF19 PRG:0F19 BD 40 CF sbc Zp6B ; CPU:$CF1C PRG:0F1C E5 6B sta Zp69 ; CPU:$CF1E PRG:0F1E 85 69 tay ; CPU:$CF20 PRG:0F20 A8 ldx #$00 ; CPU:$CF21 PRG:0F21 A2 00 stx $040F ; CPU:$CF23 PRG:0F23 8E 0F 04 lda Zp6A ; CPU:$CF26 PRG:0F26 A5 6A cmp #$80 ; CPU:$CF28 PRG:0F28 C9 80 tya ; CPU:$CF2A PRG:0F2A 98 bcc ComputeActorOffset_OnNonzero ; CPU:$CF2B PRG:0F2B 90 03 clc ; CPU:$CF2D PRG:0F2D 18 adc #$01 ; CPU:$CF2E PRG:0F2E 69 01 ;=============================================================================== ; Routine: ComputeActorOffset_OnNonzero ; Global: The routine reads $040F. ; Local: Executes 5 instructions: compares A with $0A; branches on carry clear ; to ComputeActorOffset_Loop; subtracts $0A from A; increments $040F; branches on ; not equal to ComputeActorOffset_OnNonzero. ; Parameters: Reads $040F 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: ; no register, the N, Z, C and V flags, $040E, $040F. ; ;=============================================================================== ComputeActorOffset_OnNonzero: cmp #$0A ; CPU:$CF30 PRG:0F30 C9 0A bcc ComputeActorOffset_Loop ; CPU:$CF32 PRG:0F32 90 07 sbc #$0A ; CPU:$CF34 PRG:0F34 E9 0A inc $040F ; CPU:$CF36 PRG:0F36 EE 0F 04 bne ComputeActorOffset_OnNonzero ; CPU:$CF39 PRG:0F39 D0 F5 ;=============================================================================== ; Routine: ComputeActorOffset_Loop ; Global: The routine writes $040E. ; Local: Executes 2 instructions: stores A to $040E; 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 $040E changed. ; Clobbers: ; no register, $040E. ; ;=============================================================================== ComputeActorOffset_Loop: sta $040E ; CPU:$CF3B PRG:0F3B 8D 0E 04 rts ; CPU:$CF3E PRG:0F3E 60 ; ---- data $CF3F-$CF48 (10 bytes) ---- ; referenced by `lda $CF3F,x` at $CF12 (operand $CF3F falls inside this region) ; referenced by `lda $CF40,x` at $CF19 (operand $CF40 falls inside this region) ActorTargetPositionTable: .byte $00, $0A, $00, $07, $00, $08, $00, $14, $00, $05 ; CPU:$CF3F PRG:0F3F 00 0A 00 07 00 08 00 14 00 05 ;=============================================================================== ; Routine: DrawActorTile ; Global: The routine calls SetActorBoxFlag and QueueOamSprite. ; Local: Executes 5 instructions: loads A from Zp6A; compares A with $80; ; branches on carry set to DrawActorTile_Loop; calls SetActorBoxFlag; calls QueueOamSprite. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp77, Zp78, $0700. ; ;=============================================================================== DrawActorTile: lda Zp6A ; CPU:$CF49 PRG:0F49 A5 6A cmp #$80 ; CPU:$CF4B PRG:0F4B C9 80 bcs DrawActorTile_Loop ; CPU:$CF4D PRG:0F4D B0 06 jsr SetActorBoxFlag ; CPU:$CF4F PRG:0F4F 20 9D CF jmp QueueOamSprite ; CPU:$CF52 PRG:0F52 4C 58 CF ;=============================================================================== ; Routine: DrawActorTile_Loop ; Global: The routine calls ClearActorBoxFlag. ; Local: Executes 1 instruction: calls ClearActorBoxFlag. ; 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, Zp77, Zp78, $0700. ; ;=============================================================================== DrawActorTile_Loop: jsr ClearActorBoxFlag ; CPU:$CF55 PRG:0F55 20 B3 CF ;=============================================================================== ; Routine: QueueOamSprite ; Global: The routine reads $040F. ; Local: Executes 23 instructions: loads X from Zp51; loads A with $01; stores ; A to $0700,x; increments X; loads A from Zp78; stores A to $0700,x; ; and 17 more instructions. ; Parameters: Reads $040F 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, $0700. ; ;=============================================================================== QueueOamSprite: ldx Zp51 ; CPU:$CF58 PRG:0F58 A6 51 lda #$01 ; CPU:$CF5A PRG:0F5A A9 01 sta $0700,x ; CPU:$CF5C PRG:0F5C 9D 00 07 inx ; CPU:$CF5F PRG:0F5F E8 lda Zp78 ; CPU:$CF60 PRG:0F60 A5 78 sta $0700,x ; CPU:$CF62 PRG:0F62 9D 00 07 inx ; CPU:$CF65 PRG:0F65 E8 lda Zp77 ; CPU:$CF66 PRG:0F66 A5 77 clc ; CPU:$CF68 PRG:0F68 18 adc #$21 ; CPU:$CF69 PRG:0F69 69 21 sta $0700,x ; CPU:$CF6B PRG:0F6B 9D 00 07 inx ; CPU:$CF6E PRG:0F6E E8 lda #$02 ; CPU:$CF6F PRG:0F6F A9 02 sta $0700,x ; CPU:$CF71 PRG:0F71 9D 00 07 inx ; CPU:$CF74 PRG:0F74 E8 lda #$FF ; CPU:$CF75 PRG:0F75 A9 FF sta $0700,x ; CPU:$CF77 PRG:0F77 9D 00 07 inx ; CPU:$CF7A PRG:0F7A E8 lda $040F ; CPU:$CF7B PRG:0F7B AD 0F 04 and #$0F ; CPU:$CF7E PRG:0F7E 29 0F beq QueueOamSprite_Loop ; CPU:$CF80 PRG:0F80 F0 04 ora #$30 ; CPU:$CF82 PRG:0F82 09 30 bne QueueOamSprite_Loop_2 ; CPU:$CF84 PRG:0F84 D0 02 ;=============================================================================== ; Routine: QueueOamSprite_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 $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 and Z flags, $0700. ; ;=============================================================================== QueueOamSprite_Loop: lda #$00 ; CPU:$CF86 PRG:0F86 A9 00 ;=============================================================================== ; Routine: QueueOamSprite_Loop_2 ; Global: The routine reads $040E. ; Local: Executes 10 instructions: stores A to $0700,x; increments X; loads A ; from $040E; ANDs A with $0F; ORs A with $30; stores A to $0700,x; ; and 4 more instructions. ; Parameters: Reads $040E 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 and Z flags, $0700. ; ;=============================================================================== QueueOamSprite_Loop_2: sta $0700,x ; CPU:$CF88 PRG:0F88 9D 00 07 inx ; CPU:$CF8B PRG:0F8B E8 lda $040E ; CPU:$CF8C PRG:0F8C AD 0E 04 and #$0F ; CPU:$CF8F PRG:0F8F 29 0F ora #$30 ; CPU:$CF91 PRG:0F91 09 30 sta $0700,x ; CPU:$CF93 PRG:0F93 9D 00 07 inx ; CPU:$CF96 PRG:0F96 E8 lda #$00 ; CPU:$CF97 PRG:0F97 A9 00 sta $0700,x ; CPU:$CF99 PRG:0F99 9D 00 07 rts ; CPU:$CF9C PRG:0F9C 60 ;=============================================================================== ; Routine: SetActorBoxFlag ; Global: The routine reads no RAM 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, the N, Z, C and V flags, Zp77, Zp78. ; ;=============================================================================== SetActorBoxFlag: lda #$01 ; CPU:$CF9D PRG:0F9D A9 01 ;=============================================================================== ; Routine: SetActorBoxFlag_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 12 instructions: stores A to Zp77; loads A from Zp6B; ANDs A ; with $01; EORs A with Zp77; shifts a left; shifts a left; 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, Zp77, Zp78. ; ;=============================================================================== SetActorBoxFlag_OnZero: sta Zp77 ; CPU:$CF9F PRG:0F9F 85 77 lda Zp6B ; CPU:$CFA1 PRG:0FA1 A5 6B and #$01 ; CPU:$CFA3 PRG:0FA3 29 01 eor Zp77 ; CPU:$CFA5 PRG:0FA5 45 77 asl a ; CPU:$CFA7 PRG:0FA7 0A asl a ; CPU:$CFA8 PRG:0FA8 0A clc ; CPU:$CFA9 PRG:0FA9 18 adc #$23 ; CPU:$CFAA PRG:0FAA 69 23 sta Zp78 ; CPU:$CFAC PRG:0FAC 85 78 lda #$41 ; CPU:$CFAE PRG:0FAE A9 41 sta Zp77 ; CPU:$CFB0 PRG:0FB0 85 77 rts ; CPU:$CFB2 PRG:0FB2 60 ;=============================================================================== ; Routine: ClearActorBoxFlag ; Global: The routine reads no RAM 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 A to Zp77; loads A from Zp6B; ANDs A ; with $01; EORs A with Zp77; shifts a left; shifts a left; 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, the N, Z, C and V flags, Zp77, Zp78. ; ;=============================================================================== ClearActorBoxFlag: lda #$00 ; CPU:$CFB3 PRG:0FB3 A9 00 beq SetActorBoxFlag_OnZero ; CPU:$CFB5 PRG:0FB5 F0 E8 ; ---- data $CFB7-$CFCD (23 bytes) ---- ; referenced by `lda $CFB8` at $CEBD (operand $CFB8 falls inside this region) ; referenced by `lda $CFB7` at $CEC2 (operand $CFB7 falls inside this region) ; referenced by `lda $CFB8` at $CECD (operand $CFB8 falls inside this region) ; referenced by `lda $CFB7` at $CED2 (operand $CFB7 falls inside this region) ScreenScriptData: .byte $B9, $CF, $10, $11, $11, $11, $11, $12, $FE, $3B, $00, $00, $30, $5B, $7A, $FE ; CPU:$CFB7 PRG:0FB7 B9 CF 10 11 11 11 11 12 FE 3B 00 00 30 5B 7A FE .byte $20, $21, $21, $21, $21, $22, $FF ; CPU:$CFC7 PRG:0FC7 20 21 21 21 21 22 FF ;=============================================================================== ; Routine: ResetSpriteCounter ; Global: The routine reads no RAM 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 and Z flags, the OAM shadow. ; ;=============================================================================== ResetSpriteCounter: ldx #$03 ; CPU:$CFCE PRG:0FCE A2 03 ;=============================================================================== ; Routine: ResetSpriteCounter_OnNonnegative ; Global: The routine reads no RAM 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 $CFDA,x; stores A to $0200,x; ; decrements X; branches on non-negative to ResetSpriteCounter_OnNonnegative; 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 and Z flags, the OAM shadow. ; ;=============================================================================== ResetSpriteCounter_OnNonnegative: lda $CFDA,x ; CPU:$CFD0 PRG:0FD0 BD DA CF sta $0200,x ; CPU:$CFD3 PRG:0FD3 9D 00 02 dex ; CPU:$CFD6 PRG:0FD6 CA bpl ResetSpriteCounter_OnNonnegative ; CPU:$CFD7 PRG:0FD7 10 F7 rts ; CPU:$CFD9 PRG:0FD9 60 ; ---- data $CFDA-$CFDD (4 bytes) ---- ; referenced by `lda $CFDA,x` at $CFD0 (operand $CFDA falls inside this region) ActorOamSpriteTemplateAlt: .byte $26, $5A, $02, $EC ; CPU:$CFDA PRG:0FDA 26 5A 02 EC ;=============================================================================== ; Routine: ResetSpriteState ; Global: The routine reads no RAM 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 $00; stores X to Zp8C; 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, Zp70, Zp79, Zp7A, Zp8C. ; ;=============================================================================== ResetSpriteState: ldx #$00 ; CPU:$CFDE PRG:0FDE A2 00 stx Zp8C ; CPU:$CFE0 PRG:0FE0 86 8C ldy #$00 ; CPU:$CFE2 PRG:0FE2 A0 00 ;=============================================================================== ; Routine: ResetSpriteState_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 3 instructions: loads A from ((Zp7C),y); increments Y; ; stores A to Zp7A. ; 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, Zp70, Zp79, Zp7A, Zp8C. ; ;=============================================================================== ResetSpriteState_OnNonzero: lda (Zp7C),y ; CPU:$CFE4 PRG:0FE4 B1 7C iny ; CPU:$CFE6 PRG:0FE6 C8 sta Zp7A ; CPU:$CFE7 PRG:0FE7 85 7A ;=============================================================================== ; Routine: ResetSpriteState_OnNonzero_2 ; Global: The routine calls NextActorSlot. ; Local: Executes 15 instructions: loads A from ((Zp7C),y); increments Y; ; stores A to Zp7A; loads A from ((Zp7C),y); increments Y; stores A ; to Zp70,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, X and Y, the N, Z, C and V flags, Zp70, Zp79, Zp7A, Zp8C. ; ;=============================================================================== ResetSpriteState_OnNonzero_2: lda (Zp7C),y ; CPU:$CFE9 PRG:0FE9 B1 7C iny ; CPU:$CFEB PRG:0FEB C8 sta Zp70,x ; CPU:$CFEC PRG:0FEC 95 70 inx ; CPU:$CFEE PRG:0FEE E8 dec Zp7A ; CPU:$CFEF PRG:0FEF C6 7A bne ResetSpriteState_OnNonzero_2 ; CPU:$CFF1 PRG:0FF1 D0 F6 dec Zp79 ; CPU:$CFF3 PRG:0FF3 C6 79 beq ResetSpriteState_OnZero ; CPU:$CFF5 PRG:0FF5 F0 09 ldx Zp8C ; CPU:$CFF7 PRG:0FF7 A6 8C jsr NextActorSlot ; CPU:$CFF9 PRG:0FF9 20 EC C9 stx Zp8C ; CPU:$CFFC PRG:0FFC 86 8C bne ResetSpriteState_OnNonzero ; CPU:$CFFE PRG:0FFE D0 E4 ;=============================================================================== ; Routine: ResetSpriteState_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 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. ; ;=============================================================================== ResetSpriteState_OnZero: rts ; CPU:$D000 PRG:1000 60 ;=============================================================================== ; Routine: StartActorUpdate ; Global: The routine reads no RAM 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; loads A from Zp70; ; branches on equal to ResetSpriteState_OnZero; loads X with $00; stores X to Zp78. ; 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. ; ;=============================================================================== StartActorUpdate: lda Zp70 ; CPU:$D001 PRG:1001 A5 70 beq ResetSpriteState_OnZero ; CPU:$D003 PRG:1003 F0 FB ldx #$00 ; CPU:$D005 PRG:1005 A2 00 stx Zp78 ; CPU:$D007 PRG:1007 86 78 ;=============================================================================== ; Routine: ReadActorUpdateRecord ; Global: The routine writes $030F and $0316. ; Local: Executes 42 instructions: loads A with $00; stores A to $030F; stores ; A to $0316; loads X from Zp78; loads A from Zp70,x; stores A to ; Zp89; 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 $030F and $0316 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== ReadActorUpdateRecord: lda #$00 ; CPU:$D009 PRG:1009 A9 00 sta $030F ; CPU:$D00B PRG:100B 8D 0F 03 sta $0316 ; CPU:$D00E PRG:100E 8D 16 03 ldx Zp78 ; CPU:$D011 PRG:1011 A6 78 lda Zp70,x ; CPU:$D013 PRG:1013 B5 70 sta Zp89 ; CPU:$D015 PRG:1015 85 89 lda Zp71,x ; CPU:$D017 PRG:1017 B5 71 sta Zp8A ; CPU:$D019 PRG:1019 85 8A lda Zp72,x ; CPU:$D01B PRG:101B B5 72 beq ReadActorUpdateRecord_Loop_5 ; CPU:$D01D PRG:101D F0 7A sta Zp8B ; CPU:$D01F PRG:101F 85 8B lda Zp73,x ; CPU:$D021 PRG:1021 B5 73 sta Zp8C ; CPU:$D023 PRG:1023 85 8C lda Zp74,x ; CPU:$D025 PRG:1025 B5 74 sta Zp8D ; CPU:$D027 PRG:1027 85 8D lda Zp75,x ; CPU:$D029 PRG:1029 B5 75 and #$01 ; CPU:$D02B PRG:102B 29 01 sta Zp8E ; CPU:$D02D PRG:102D 85 8E lda Zp77,x ; CPU:$D02F PRG:102F B5 77 sta Zp8F ; CPU:$D031 PRG:1031 85 8F lda Zp76,x ; CPU:$D033 PRG:1033 B5 76 asl a ; CPU:$D035 PRG:1035 0A tay ; CPU:$D036 PRG:1036 A8 lda $D158,y ; CPU:$D037 PRG:1037 B9 58 D1 sta Zp7C ; CPU:$D03A PRG:103A 85 7C lda $D159,y ; CPU:$D03C PRG:103C B9 59 D1 sta Zp7D ; CPU:$D03F PRG:103F 85 7D stx Zp78 ; CPU:$D041 PRG:1041 86 78 ldy #$00 ; CPU:$D043 PRG:1043 A0 00 lda Zp8A ; CPU:$D045 PRG:1045 A5 8A sta Zp77 ; CPU:$D047 PRG:1047 85 77 bpl ReadActorUpdateRecord_Loop_3 ; CPU:$D049 PRG:1049 10 45 lda (Zp7C),y ; CPU:$D04B PRG:104B B1 7C iny ; CPU:$D04D PRG:104D C8 sta Zp7A ; CPU:$D04E PRG:104E 85 7A inc Zp77 ; CPU:$D050 PRG:1050 E6 77 beq ReadActorUpdateRecord_Loop_2 ; CPU:$D052 PRG:1052 F0 24 lda Zp64 ; CPU:$D054 PRG:1054 A5 64 cmp #$00 ; CPU:$D056 PRG:1056 C9 00 bne ReadActorUpdateRecord_Loop ; CPU:$D058 PRG:1058 D0 05 lda #$01 ; CPU:$D05A PRG:105A A9 01 sta $030F ; CPU:$D05C PRG:105C 8D 0F 03 ;=============================================================================== ; Routine: ReadActorUpdateRecord_Loop ; Global: The routine calls ReadActorUpdateRecord_Loop_4. ; Local: Executes 14 instructions: loads A from ((Zp7C),y); increments Y; ; stores A to Zp7B; clears the carry flag; adds Zp7A to A; stores A ; to Zp77; 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. ; ;=============================================================================== ReadActorUpdateRecord_Loop: lda (Zp7C),y ; CPU:$D05F PRG:105F B1 7C iny ; CPU:$D061 PRG:1061 C8 sta Zp7B ; CPU:$D062 PRG:1062 85 7B clc ; CPU:$D064 PRG:1064 18 adc Zp7A ; CPU:$D065 PRG:1065 65 7A sta Zp77 ; CPU:$D067 PRG:1067 85 77 lda Zp8F ; CPU:$D069 PRG:1069 A5 8F sec ; CPU:$D06B PRG:106B 38 sbc Zp77 ; CPU:$D06C PRG:106C E5 77 beq ReadActorUpdateRecord_Loop_4 ; CPU:$D06E PRG:106E F0 26 clc ; CPU:$D070 PRG:1070 18 adc Zp7B ; CPU:$D071 PRG:1071 65 7B sta Zp7B ; CPU:$D073 PRG:1073 85 7B jmp ReadActorUpdateRecord_Loop_4 ; CPU:$D075 PRG:1075 4C 96 D0 ;=============================================================================== ; Routine: ReadActorUpdateRecord_Loop_2 ; Global: The routine calls ReadActorUpdateRecord_Loop_4. ; Local: Executes 13 instructions: loads A from ((Zp7C),y); increments Y; ; clears the carry flag; adds Zp7A to A; stores A to Zp7A; loads A ; with $00; 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. ; ;=============================================================================== ReadActorUpdateRecord_Loop_2: lda (Zp7C),y ; CPU:$D078 PRG:1078 B1 7C iny ; CPU:$D07A PRG:107A C8 clc ; CPU:$D07B PRG:107B 18 adc Zp7A ; CPU:$D07C PRG:107C 65 7A sta Zp7A ; CPU:$D07E PRG:107E 85 7A lda #$00 ; CPU:$D080 PRG:1080 A9 00 sta Zp7B ; CPU:$D082 PRG:1082 85 7B lda Zp8F ; CPU:$D084 PRG:1084 A5 8F sec ; CPU:$D086 PRG:1086 38 sbc Zp7A ; CPU:$D087 PRG:1087 E5 7A beq ReadActorUpdateRecord_Loop_4 ; CPU:$D089 PRG:1089 F0 0B sta Zp7B ; CPU:$D08B PRG:108B 85 7B jmp ReadActorUpdateRecord_Loop_4 ; CPU:$D08D PRG:108D 4C 96 D0 ;=============================================================================== ; Routine: ReadActorUpdateRecord_Loop_3 ; Global: The routine reads no RAM 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 Zp7A; loads A with $00; stores A ; to Zp7B. ; 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. ; ;=============================================================================== ReadActorUpdateRecord_Loop_3: sta Zp7A ; CPU:$D090 PRG:1090 85 7A lda #$00 ; CPU:$D092 PRG:1092 A9 00 sta Zp7B ; CPU:$D094 PRG:1094 85 7B ;=============================================================================== ; Routine: ReadActorUpdateRecord_Loop_4 ; Global: The routine calls StoreActorUpdateValue. ; Local: Executes 1 instruction: calls StoreActorUpdateValue. ; 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. ; ;=============================================================================== ReadActorUpdateRecord_Loop_4: jsr StoreActorUpdateValue ; CPU:$D096 PRG:1096 20 AD D0 ;=============================================================================== ; Routine: ReadActorUpdateRecord_Loop_5 ; Global: The routine calls ReadActorUpdateRecord, writes $0316. ; Local: Executes 9 instructions: decrements Zp79; branches on equal to ; ReadActorUpdateRecord_Loop_6; loads A from Zp78; clears the carry flag; adds $10 to A; ; stores A to Zp78; 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 $0316 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== ReadActorUpdateRecord_Loop_5: dec Zp79 ; CPU:$D099 PRG:1099 C6 79 beq ReadActorUpdateRecord_Loop_6 ; CPU:$D09B PRG:109B F0 0F lda Zp78 ; CPU:$D09D PRG:109D A5 78 clc ; CPU:$D09F PRG:109F 18 adc #$10 ; CPU:$D0A0 PRG:10A0 69 10 sta Zp78 ; CPU:$D0A2 PRG:10A2 85 78 lda #$00 ; CPU:$D0A4 PRG:10A4 A9 00 sta $0316 ; CPU:$D0A6 PRG:10A6 8D 16 03 jmp ReadActorUpdateRecord ; CPU:$D0A9 PRG:10A9 4C 09 D0 ;=============================================================================== ; Routine: ReadActorUpdateRecord_Loop_6 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ReadActorUpdateRecord_Loop_6: rts ; CPU:$D0AC PRG:10AC 60 ;=============================================================================== ; Routine: StoreActorUpdateValue ; Global: The routine reads no RAM 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 Zp8B; loads A from Zp89; ; branches on equal to StoreObjectScriptValue_OnNonzero. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp77, Zp7A, Zp7B, the OAM shadow, ; $0316, $0317. ; ;=============================================================================== StoreActorUpdateValue: ldx Zp8B ; CPU:$D0AD PRG:10AD A6 8B lda Zp89 ; CPU:$D0AF PRG:10AF A5 89 beq StoreObjectScriptValue_OnNonzero ; CPU:$D0B1 PRG:10B1 F0 75 ;=============================================================================== ; Routine: StoreActorUpdateValue_OnNonzero ; Global: The routine calls ReadObjectScriptByte and AdvanceObjectScript, reads $0316. ; Local: Executes 12 instructions: loads A from ((Zp7C),y); clears the carry ; flag; adds Zp8D to A; calls ReadObjectScriptByte; stores A to $0203,x; ; increments Y; and 6 more instructions. ; Parameters: Reads $0316 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, Zp77, Zp7A, Zp7B, the OAM shadow, ; $0316, $0317. ; ;=============================================================================== StoreActorUpdateValue_OnNonzero: lda (Zp7C),y ; CPU:$D0B3 PRG:10B3 B1 7C clc ; CPU:$D0B5 PRG:10B5 18 adc Zp8D ; CPU:$D0B6 PRG:10B6 65 8D jsr ReadObjectScriptByte ; CPU:$D0B8 PRG:10B8 20 0C D1 sta $0203,x ; CPU:$D0BB PRG:10BB 9D 03 02 iny ; CPU:$D0BE PRG:10BE C8 lda (Zp7C),y ; CPU:$D0BF PRG:10BF B1 7C iny ; CPU:$D0C1 PRG:10C1 C8 sta $0201,x ; CPU:$D0C2 PRG:10C2 9D 01 02 lda $0316 ; CPU:$D0C5 PRG:10C5 AD 16 03 bne StoreActorUpdateValue_Loop ; CPU:$D0C8 PRG:10C8 D0 03 jsr AdvanceObjectScript ; CPU:$D0CA PRG:10CA 20 42 D1 ;=============================================================================== ; Routine: StoreActorUpdateValue_Loop ; Global: The routine calls ReadObjectScriptByte, AdvanceObjectScript and StoreSpriteAttribute, reads $0316 and ; $0317. ; Local: Executes 16 instructions: loads A from ((Zp7C),y); clears the carry ; flag; adds Zp8D to A; calls ReadObjectScriptByte; stores A to $0203,x; ; increments Y; and 10 more instructions. ; Parameters: Reads $0316 and $0317 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, Zp77, Zp7A, Zp7B, the OAM shadow, ; $0316, $0317. ; ;=============================================================================== StoreActorUpdateValue_Loop: cmp #$02 ; CPU:$D0CD PRG:10CD C9 02 bne StoreActorUpdateValue_Loop_2 ; CPU:$D0CF PRG:10CF D0 06 lda $0317 ; CPU:$D0D1 PRG:10D1 AD 17 03 jmp StoreSpriteAttribute ; CPU:$D0D4 PRG:10D4 4C DA D0 ;=============================================================================== ; Routine: StoreActorUpdateValue_Loop_2 ; Global: The routine calls ReadObjectScriptByte, AdvanceObjectScript and StoreSpriteAttribute, reads $0316 and ; $0317. ; Local: Executes 18 instructions: loads A from ((Zp7C),y); clears the carry ; flag; adds Zp8D to A; calls ReadObjectScriptByte; stores A to $0203,x; ; increments Y; and 12 more instructions. ; Parameters: Reads $0316 and $0317 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, Zp77, Zp7A, Zp7B, the OAM shadow, ; $0316, $0317. ; ;=============================================================================== StoreActorUpdateValue_Loop_2: lda (Zp7C),y ; CPU:$D0D7 PRG:10D7 B1 7C iny ; CPU:$D0D9 PRG:10D9 C8 ;=============================================================================== ; Routine: StoreSpriteAttribute ; Global: The routine calls ReadObjectScriptByte, AdvanceObjectScript and StoreSpriteAttribute, reads $0316 and ; $0317. ; Local: Executes 23 instructions: loads A from ((Zp7C),y); clears the carry ; flag; adds Zp8D to A; calls ReadObjectScriptByte; stores A to $0203,x; ; increments Y; and 17 more instructions. ; Parameters: Reads $0316 and $0317 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, Zp77, Zp7A, Zp7B, the OAM shadow, ; $0316, $0317. ; ;=============================================================================== StoreSpriteAttribute: sta $0202,x ; CPU:$D0DA PRG:10DA 9D 02 02 lda Zp77 ; CPU:$D0DD PRG:10DD A5 77 beq StoreSpriteAttribute_Loop ; CPU:$D0DF PRG:10DF F0 04 lda #$F8 ; CPU:$D0E1 PRG:10E1 A9 F8 bne StoreSpriteAttribute_Loop_2; CPU:$D0E3 PRG:10E3 D0 05 ;=============================================================================== ; Routine: StoreSpriteAttribute_Loop ; Global: The routine calls ReadObjectScriptByte, AdvanceObjectScript and StoreSpriteAttribute, reads $0316 and ; $0317. ; Local: Executes 26 instructions: loads A from ((Zp7C),y); clears the carry ; flag; adds Zp8D to A; calls ReadObjectScriptByte; stores A to $0203,x; ; increments Y; and 20 more instructions. ; Parameters: Reads $0316 and $0317 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, Zp77, Zp7A, Zp7B, the OAM shadow, ; $0316, $0317. ; ;=============================================================================== StoreSpriteAttribute_Loop: lda (Zp7C),y ; CPU:$D0E5 PRG:10E5 B1 7C clc ; CPU:$D0E7 PRG:10E7 18 adc Zp8C ; CPU:$D0E8 PRG:10E8 65 8C ;=============================================================================== ; Routine: StoreSpriteAttribute_Loop_2 ; Global: The routine calls ReadObjectScriptByte, AdvanceObjectScript and StoreSpriteAttribute, reads $0316, ; $0317 and $030F. ; Local: Executes 37 instructions: loads A from ((Zp7C),y); clears the carry ; flag; adds Zp8D to A; calls ReadObjectScriptByte; stores A to $0203,x; ; increments Y; and 31 more instructions. ; Parameters: Reads $0316, $0317 and $030F 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, Zp77, Zp7A, Zp7B, the OAM shadow, ; $0316, $0317. ; ;=============================================================================== StoreSpriteAttribute_Loop_2: iny ; CPU:$D0EA PRG:10EA C8 sta $0200,x ; CPU:$D0EB PRG:10EB 9D 00 02 lda Zp7A ; CPU:$D0EE PRG:10EE A5 7A cmp #$03 ; CPU:$D0F0 PRG:10F0 C9 03 bcs StoreSpriteAttribute_Loop_3; CPU:$D0F2 PRG:10F2 B0 0E lda $030F ; CPU:$D0F4 PRG:10F4 AD 0F 03 beq StoreSpriteAttribute_Loop_3; CPU:$D0F7 PRG:10F7 F0 09 lda $0200,x ; CPU:$D0F9 PRG:10F9 BD 00 02 sec ; CPU:$D0FC PRG:10FC 38 sbc #$10 ; CPU:$D0FD PRG:10FD E9 10 sta $0200,x ; CPU:$D0FF PRG:10FF 9D 00 02 ;=============================================================================== ; Routine: StoreSpriteAttribute_Loop_3 ; Global: The routine calls ReadObjectScriptByte, AdvanceObjectScript and StoreSpriteAttribute, reads $0316, ; $0317 and $030F. ; Local: Executes 44 instructions: loads A from ((Zp7C),y); clears the carry ; flag; adds Zp8D to A; calls ReadObjectScriptByte; stores A to $0203,x; ; increments Y; and 38 more instructions. ; Parameters: Reads $0316, $0317 and $030F 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, Zp77, Zp7A, Zp7B, the OAM shadow, ; $0316, $0317. ; ;=============================================================================== StoreSpriteAttribute_Loop_3: inx ; CPU:$D102 PRG:1102 E8 inx ; CPU:$D103 PRG:1103 E8 inx ; CPU:$D104 PRG:1104 E8 inx ; CPU:$D105 PRG:1105 E8 dec Zp7A ; CPU:$D106 PRG:1106 C6 7A bne StoreActorUpdateValue_OnNonzero ; CPU:$D108 PRG:1108 D0 A9 beq StoreObjectScriptValue_Loop; CPU:$D10A PRG:110A F0 2D ;=============================================================================== ; Routine: ReadObjectScriptByte ; Global: The routine reads no RAM 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: pushes A; loads A from ((Zp7C),y); branches ; on negative to ReadObjectScriptByte_Loop; branches on carry clear to ReadObjectScriptByte_Loop_3; ; branches on carry set to ReadObjectScriptByte_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no 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, Zp77. ; ;=============================================================================== ReadObjectScriptByte: pha ; CPU:$D10C PRG:110C 48 lda (Zp7C),y ; CPU:$D10D PRG:110D B1 7C bmi ReadObjectScriptByte_Loop ; CPU:$D10F PRG:110F 30 04 bcc ReadObjectScriptByte_Loop_3; CPU:$D111 PRG:1111 90 0D bcs ReadObjectScriptByte_Loop_2; CPU:$D113 PRG:1113 B0 02 ;=============================================================================== ; Routine: ReadObjectScriptByte_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: branches on carry set to ReadObjectScriptByte_Loop_3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp77. ; ;=============================================================================== ReadObjectScriptByte_Loop: bcs ReadObjectScriptByte_Loop_3; CPU:$D115 PRG:1115 B0 09 ;=============================================================================== ; Routine: ReadObjectScriptByte_Loop_2 ; Global: The routine calls StoreObjectScriptValue. ; Local: Executes 4 instructions: loads A from Zp8E; ANDs A with $01; EORs A ; with $01; calls StoreObjectScriptValue. ; 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, Zp77. ; ;=============================================================================== ReadObjectScriptByte_Loop_2: lda Zp8E ; CPU:$D117 PRG:1117 A5 8E and #$01 ; CPU:$D119 PRG:1119 29 01 eor #$01 ; CPU:$D11B PRG:111B 49 01 jmp StoreObjectScriptValue ; CPU:$D11D PRG:111D 4C 24 D1 ;=============================================================================== ; Routine: ReadObjectScriptByte_Loop_3 ; Global: The routine reads no RAM 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 Zp8E; ANDs 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, the N and Z flags, Zp77. ; ;=============================================================================== ReadObjectScriptByte_Loop_3: lda Zp8E ; CPU:$D120 PRG:1120 A5 8E and #$01 ; CPU:$D122 PRG:1122 29 01 ;=============================================================================== ; Routine: StoreObjectScriptValue ; Global: The routine reads no RAM 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 Zp77; 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, Zp77. ; ;=============================================================================== StoreObjectScriptValue: sta Zp77 ; CPU:$D124 PRG:1124 85 77 pla ; CPU:$D126 PRG:1126 68 rts ; CPU:$D127 PRG:1127 60 ;=============================================================================== ; Routine: StoreObjectScriptValue_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 10 instructions: loads A with $F4; stores A to $0200,x; ; increments X; increments X; increments X; increments 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 and X, the N and Z flags, Zp7A, Zp7B, the OAM shadow. ; ;=============================================================================== StoreObjectScriptValue_OnNonzero: lda #$F4 ; CPU:$D128 PRG:1128 A9 F4 sta $0200,x ; CPU:$D12A PRG:112A 9D 00 02 inx ; CPU:$D12D PRG:112D E8 inx ; CPU:$D12E PRG:112E E8 inx ; CPU:$D12F PRG:112F E8 inx ; CPU:$D130 PRG:1130 E8 lda Zp7A ; CPU:$D131 PRG:1131 A5 7A beq StoreObjectScriptValue_Loop; CPU:$D133 PRG:1133 F0 04 dec Zp7A ; CPU:$D135 PRG:1135 C6 7A bne StoreObjectScriptValue_OnNonzero ; CPU:$D137 PRG:1137 D0 EF ;=============================================================================== ; Routine: StoreObjectScriptValue_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 14 instructions: loads A with $F4; stores A to $0200,x; ; increments X; increments X; increments X; increments 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: 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, Zp7A, Zp7B, the OAM shadow. ; ;=============================================================================== StoreObjectScriptValue_Loop: lda Zp7B ; CPU:$D139 PRG:1139 A5 7B beq StoreObjectScriptValue_Loop_2 ; CPU:$D13B PRG:113B F0 04 dec Zp7B ; CPU:$D13D PRG:113D C6 7B bpl StoreObjectScriptValue_OnNonzero ; CPU:$D13F PRG:113F 10 E7 ;=============================================================================== ; Routine: StoreObjectScriptValue_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== StoreObjectScriptValue_Loop_2: rts ; CPU:$D141 PRG:1141 60 ;=============================================================================== ; Routine: AdvanceObjectScript ; Global: The routine writes $0317, reads $0316. ; Local: Executes 7 instructions: increments $0316; loads A from ((Zp7C),y); ; compares A with $FF; branches on equal to AdvanceObjectScript_Loop; increments ; $0316; loads A from ((Zp7C),y); and 1 more instruction. ; Parameters: Reads $0316 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 $0317 changed. ; Clobbers: ; A and Y, the N, Z and C flags, $0316, $0317. ; ;=============================================================================== AdvanceObjectScript: inc $0316 ; CPU:$D142 PRG:1142 EE 16 03 lda (Zp7C),y ; CPU:$D145 PRG:1145 B1 7C cmp #$FF ; CPU:$D147 PRG:1147 C9 FF beq AdvanceObjectScript_Loop ; CPU:$D149 PRG:1149 F0 08 inc $0316 ; CPU:$D14B PRG:114B EE 16 03 lda (Zp7C),y ; CPU:$D14E PRG:114E B1 7C sta $0317 ; CPU:$D150 PRG:1150 8D 17 03 ;=============================================================================== ; Routine: AdvanceObjectScript_Loop ; Global: The routine reads $0316. ; Local: Executes 3 instructions: loads A from $0316; increments Y; returns ; with RTS. ; Parameters: Reads $0316 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 and Z flags. ; ;=============================================================================== AdvanceObjectScript_Loop: lda $0316 ; CPU:$D153 PRG:1153 AD 16 03 iny ; CPU:$D156 PRG:1156 C8 rts ; CPU:$D157 PRG:1157 60 ; ---- data $D158-$D1C3 (108 bytes) ---- ; referenced by `lda $D158,y` at $D037 (operand $D158 falls inside this region) ; referenced by `lda $D159,y` at $D03C (operand $D159 falls inside this region) ObjectScriptPointerTable: .byte $03, $DD, $16, $DD, $F0, $DC, $29, $DD, $3C, $DD, $4F, $DD, $62, $DD, $75, $DD ; CPU:$D158 PRG:1158 03 DD 16 DD F0 DC 29 DD 3C DD 4F DD 62 DD 75 DD .byte $88, $DD, $9B, $DD, $1B, $E2, $34, $E2, $AE, $DD, $D9, $DD, $04, $DE, $2B, $DE ; CPU:$D168 PRG:1168 88 DD 9B DD 1B E2 34 E2 AE DD D9 DD 04 DE 2B DE .byte $52, $DE, $8C, $DE, $C6, $DE, $00, $DF, $0D, $DF, $1A, $DF, $27, $DF, $34, $DF ; CPU:$D178 PRG:1178 52 DE 8C DE C6 DE 00 DF 0D DF 1A DF 27 DF 34 DF .byte $41, $DF, $4E, $DF, $5B, $DF, $74, $DF, $8D, $DF, $A6, $DF, $BF, $DF, $D2, $DF ; CPU:$D188 PRG:1188 41 DF 4E DF 5B DF 74 DF 8D DF A6 DF BF DF D2 DF .byte $16, $E0, $3B, $E0, $09, $E0, $89, $E0, $A7, $E0, $BF, $E0, $D4, $E0, $E6, $E0 ; CPU:$D198 PRG:1198 16 E0 3B E0 09 E0 89 E0 A7 E0 BF E0 D4 E0 E6 E0 .byte $FB, $E0, $10, $E1, $2E, $E1, $46, $E1, $5E, $E1, $76, $E1, $94, $E1, $A9, $E1 ; CPU:$D1A8 PRG:11A8 FB E0 10 E1 2E E1 46 E1 5E E1 76 E1 94 E1 A9 E1 .byte $BE, $E1, $D0, $E1, $E5, $E1, $FD, $E1, $85, $E0, $60, $E0 ; CPU:$D1B8 PRG:11B8 BE E1 D0 E1 E5 E1 FD E1 85 E0 60 E0 ;=============================================================================== ; Routine: LoadObjectSpriteScript ; Global: The routine calls PackCoordinateBytes and ResetObjectSpriteIndex. ; Local: Executes 13 instructions: calls PackCoordinateBytes; copies X into A; pushes A; ; loads A from Zp8F; shifts a left; copies A into X; 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 RAM fields it writes. ; ;=============================================================================== LoadObjectSpriteScript: jsr PackCoordinateBytes ; CPU:$D1C4 PRG:11C4 20 E4 CB txa ; CPU:$D1C7 PRG:11C7 8A pha ; CPU:$D1C8 PRG:11C8 48 lda Zp8F ; CPU:$D1C9 PRG:11C9 A5 8F asl a ; CPU:$D1CB PRG:11CB 0A tax ; CPU:$D1CC PRG:11CC AA lda $D2DD,x ; CPU:$D1CD PRG:11CD BD DD D2 sta Zp7C ; CPU:$D1D0 PRG:11D0 85 7C lda $D2DE,x ; CPU:$D1D2 PRG:11D2 BD DE D2 sta Zp7D ; CPU:$D1D5 PRG:11D5 85 7D pla ; CPU:$D1D7 PRG:11D7 68 tax ; CPU:$D1D8 PRG:11D8 AA jsr ResetObjectSpriteIndex ; CPU:$D1D9 PRG:11D9 20 E4 D1 ;=============================================================================== ; Routine: LoadObjectSpriteScript_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 4 instructions: stores X to Zp51; loads A with $00; 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 and Z flags, Zp51, $0700. ; ;=============================================================================== LoadObjectSpriteScript_OnZero: stx Zp51 ; CPU:$D1DC PRG:11DC 86 51 lda #$00 ; CPU:$D1DE PRG:11DE A9 00 sta $0700,x ; CPU:$D1E0 PRG:11E0 9D 00 07 rts ; CPU:$D1E3 PRG:11E3 60 ;=============================================================================== ; Routine: ResetObjectSpriteIndex ; Global: The routine reads no RAM 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 X to Zp51; loads A with $00; stores A ; to $0700,x; returns with RTS; loads Y with $00; loads X from Zp51. ; 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 RAM fields it writes. ; ;=============================================================================== ResetObjectSpriteIndex: ldy #$00 ; CPU:$D1E4 PRG:11E4 A0 00 ldx Zp51 ; CPU:$D1E6 PRG:11E6 A6 51 ;=============================================================================== ; Routine: WriteObjectSpriteBytes ; Global: The routine reads no RAM 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 Zp51; loads A with $00; stores ; A to $0700,x; returns with RTS; loads A from Zp7E; stores A to ; Zp79; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== WriteObjectSpriteBytes: lda Zp7E ; CPU:$D1E8 PRG:11E8 A5 7E sta Zp79 ; CPU:$D1EA PRG:11EA 85 79 lda Zp7F ; CPU:$D1EC PRG:11EC A5 7F sta Zp7A ; CPU:$D1EE PRG:11EE 85 7A lda (Zp7C),y ; CPU:$D1F0 PRG:11F0 B1 7C beq LoadObjectSpriteScript_OnZero ; CPU:$D1F2 PRG:11F2 F0 E8 sta $0700,x ; CPU:$D1F4 PRG:11F4 9D 00 07 iny ; CPU:$D1F7 PRG:11F7 C8 lda (Zp7C),y ; CPU:$D1F8 PRG:11F8 B1 7C beq WriteObjectSpriteBytes_Loop; CPU:$D1FA PRG:11FA F0 21 stx Zp8C ; CPU:$D1FC PRG:11FC 86 8C sty Zp8E ; CPU:$D1FE PRG:11FE 84 8E ldx #$00 ; CPU:$D200 PRG:1200 A2 00 stx Zp77 ; CPU:$D202 PRG:1202 86 77 ldy #$05 ; CPU:$D204 PRG:1204 A0 05 ;=============================================================================== ; Routine: WriteObjectSpriteBytes_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 13 instructions: shifts a left; rotates Zp77 left; ; decrements Y; branches on not equal to WriteObjectSpriteBytes_OnNonzero; clears the carry ; flag; adds Zp7E 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, X and Y, the N, Z, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== WriteObjectSpriteBytes_OnNonzero: asl a ; CPU:$D206 PRG:1206 0A rol Zp77 ; CPU:$D207 PRG:1207 26 77 dey ; CPU:$D209 PRG:1209 88 bne WriteObjectSpriteBytes_OnNonzero ; CPU:$D20A PRG:120A D0 FA clc ; CPU:$D20C PRG:120C 18 adc Zp7E ; CPU:$D20D PRG:120D 65 7E sta Zp79 ; CPU:$D20F PRG:120F 85 79 lda #$00 ; CPU:$D211 PRG:1211 A9 00 adc Zp7F ; CPU:$D213 PRG:1213 65 7F adc Zp77 ; CPU:$D215 PRG:1215 65 77 sta Zp7A ; CPU:$D217 PRG:1217 85 7A ldx Zp8C ; CPU:$D219 PRG:1219 A6 8C ldy Zp8E ; CPU:$D21B PRG:121B A4 8E ;=============================================================================== ; Routine: WriteObjectSpriteBytes_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 21 instructions: increments Y; loads A from ((Zp7C),y); ; branches on equal to WriteObjectSpriteBytes_Loop_3; stores X to Zp8C; stores Y to Zp8E; ; stores A to Zp77; 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: 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 RAM fields it writes. ; ;=============================================================================== WriteObjectSpriteBytes_Loop: iny ; CPU:$D21D PRG:121D C8 lda (Zp7C),y ; CPU:$D21E PRG:121E B1 7C beq WriteObjectSpriteBytes_Loop_3 ; CPU:$D220 PRG:1220 F0 33 stx Zp8C ; CPU:$D222 PRG:1222 86 8C sty Zp8E ; CPU:$D224 PRG:1224 84 8E sta Zp77 ; CPU:$D226 PRG:1226 85 77 lda #$20 ; CPU:$D228 PRG:1228 A9 20 sta Zp7B ; CPU:$D22A PRG:122A 85 7B lda Zp79 ; CPU:$D22C PRG:122C A5 79 and #$E0 ; CPU:$D22E PRG:122E 29 E0 sta Zp78 ; CPU:$D230 PRG:1230 85 78 lda Zp79 ; CPU:$D232 PRG:1232 A5 79 and #$1F ; CPU:$D234 PRG:1234 29 1F clc ; CPU:$D236 PRG:1236 18 adc Zp77 ; CPU:$D237 PRG:1237 65 77 bit Zp7B ; CPU:$D239 PRG:1239 24 7B php ; CPU:$D23B PRG:123B 08 ldx #$00 ; CPU:$D23C PRG:123C A2 00 plp ; CPU:$D23E PRG:123E 28 beq WriteObjectSpriteBytes_Loop_2 ; CPU:$D23F PRG:123F F0 02 ldx #$04 ; CPU:$D241 PRG:1241 A2 04 ;=============================================================================== ; Routine: WriteObjectSpriteBytes_Loop_2 ; Global: The routine reads no RAM 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 X to Zp77; ANDs A with $1F; ORs A ; with Zp78; stores A to Zp79; loads A from Zp7A; EORs A with Zp77; ; 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 RAM fields it writes. ; ;=============================================================================== WriteObjectSpriteBytes_Loop_2: stx Zp77 ; CPU:$D243 PRG:1243 86 77 and #$1F ; CPU:$D245 PRG:1245 29 1F ora Zp78 ; CPU:$D247 PRG:1247 05 78 sta Zp79 ; CPU:$D249 PRG:1249 85 79 lda Zp7A ; CPU:$D24B PRG:124B A5 7A eor Zp77 ; CPU:$D24D PRG:124D 45 77 sta Zp7A ; CPU:$D24F PRG:124F 85 7A ldx Zp8C ; CPU:$D251 PRG:1251 A6 8C ldy Zp8E ; CPU:$D253 PRG:1253 A4 8E ;=============================================================================== ; Routine: WriteObjectSpriteBytes_Loop_3 ; Global: The routine reads no RAM 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: increments X; loads A from Zp7A; stores A ; to $0700,x; increments X; loads A from Zp79; 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: 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 RAM fields it writes. ; ;=============================================================================== WriteObjectSpriteBytes_Loop_3: inx ; CPU:$D255 PRG:1255 E8 lda Zp7A ; CPU:$D256 PRG:1256 A5 7A sta $0700,x ; CPU:$D258 PRG:1258 9D 00 07 inx ; CPU:$D25B PRG:125B E8 lda Zp79 ; CPU:$D25C PRG:125C A5 79 sta $0700,x ; CPU:$D25E PRG:125E 9D 00 07 iny ; CPU:$D261 PRG:1261 C8 lda (Zp7C),y ; CPU:$D262 PRG:1262 B1 7C sta Zp7B ; CPU:$D264 PRG:1264 85 7B inx ; CPU:$D266 PRG:1266 E8 sta $0700,x ; CPU:$D267 PRG:1267 9D 00 07 lda Zp8B ; CPU:$D26A PRG:126A A5 8B inx ; CPU:$D26C PRG:126C E8 sta $0700,x ; CPU:$D26D PRG:126D 9D 00 07 ;=============================================================================== ; Routine: WriteObjectSpriteBytes_OnNonzero_2 ; Global: The routine calls WriteObjectSpriteBytes. ; Local: Executes 9 instructions: increments Y; loads A from ((Zp7C),y); ; increments X; stores A to $0700,x; decrements Zp7B; branches on not ; equal to WriteObjectSpriteBytes_OnNonzero_2; 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 RAM fields it writes. ; ;=============================================================================== WriteObjectSpriteBytes_OnNonzero_2: iny ; CPU:$D270 PRG:1270 C8 lda (Zp7C),y ; CPU:$D271 PRG:1271 B1 7C inx ; CPU:$D273 PRG:1273 E8 sta $0700,x ; CPU:$D274 PRG:1274 9D 00 07 dec Zp7B ; CPU:$D277 PRG:1277 C6 7B bne WriteObjectSpriteBytes_OnNonzero_2 ; CPU:$D279 PRG:1279 D0 F5 iny ; CPU:$D27B PRG:127B C8 inx ; CPU:$D27C PRG:127C E8 jmp WriteObjectSpriteBytes ; CPU:$D27D PRG:127D 4C E8 D1 ;=============================================================================== ; Routine: StartOamSpriteList ; Global: The routine reads no RAM 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, Zp51, $0700, PPUCTRL, PPUADDR, ; PPUDATA. ; ;=============================================================================== StartOamSpriteList: ldx #$00 ; CPU:$D280 PRG:1280 A2 00 ;=============================================================================== ; Routine: ProcessOamSpriteList ; Global: The routine reads no RAM 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 $0700,x; branches on equal to ; ProcessOamSpriteList_Loop_4; compares A with $01; branches on equal to ProcessOamSpriteList_Loop; loads ; A from Zp53; ORs 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 and C flags, Zp51, $0700, PPUCTRL, PPUADDR, ; PPUDATA. ; ;=============================================================================== ProcessOamSpriteList: lda $0700,x ; CPU:$D282 PRG:1282 BD 00 07 beq ProcessOamSpriteList_Loop_4; CPU:$D285 PRG:1285 F0 46 cmp #$01 ; CPU:$D287 PRG:1287 C9 01 beq ProcessOamSpriteList_Loop ; CPU:$D289 PRG:1289 F0 06 lda Zp53 ; CPU:$D28B PRG:128B A5 53 ora #$04 ; CPU:$D28D PRG:128D 09 04 bne ProcessOamSpriteList_Loop_2; CPU:$D28F PRG:128F D0 04 ;=============================================================================== ; Routine: ProcessOamSpriteList_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 A from Zp53; ANDs A with $7B. ; 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, Zp51, $0700, PPUCTRL, PPUADDR, ; PPUDATA. ; ;=============================================================================== ProcessOamSpriteList_Loop: lda Zp53 ; CPU:$D291 PRG:1291 A5 53 and #$7B ; CPU:$D293 PRG:1293 29 7B ;=============================================================================== ; Routine: ProcessOamSpriteList_Loop_2 ; Global: The routine writes the PPUCTRL and PPUADDR registers, reads the ; PPUSTATUS register. ; Local: Executes 15 instructions: stores A to the PPUCTRL register; loads A ; from the PPUSTATUS register; increments X; loads A from $0700,x; ; stores A to the PPUADDR register; increments 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. Leaves the PPUCTRL and PPUADDR ; registers set. ; Clobbers: ; A, X and Y, the N, Z and C flags, Zp51, $0700, PPUCTRL, PPUADDR, ; PPUDATA. ; ;=============================================================================== ProcessOamSpriteList_Loop_2: sta PPUCTRL ; CPU:$D295 PRG:1295 8D 00 20 lda PPUSTATUS ; CPU:$D298 PRG:1298 AD 02 20 inx ; CPU:$D29B PRG:129B E8 lda $0700,x ; CPU:$D29C PRG:129C BD 00 07 sta PPUADDR ; CPU:$D29F PRG:129F 8D 06 20 inx ; CPU:$D2A2 PRG:12A2 E8 lda $0700,x ; CPU:$D2A3 PRG:12A3 BD 00 07 sta PPUADDR ; CPU:$D2A6 PRG:12A6 8D 06 20 inx ; CPU:$D2A9 PRG:12A9 E8 lda $0700,x ; CPU:$D2AA PRG:12AA BD 00 07 tay ; CPU:$D2AD PRG:12AD A8 inx ; CPU:$D2AE PRG:12AE E8 lda $0700,x ; CPU:$D2AF PRG:12AF BD 00 07 cmp #$FF ; CPU:$D2B2 PRG:12B2 C9 FF bne ProcessOamSpriteList_OnNonzero_2 ; CPU:$D2B4 PRG:12B4 D0 0C ;=============================================================================== ; Routine: ProcessOamSpriteList_OnNonzero ; Global: The routine writes the PPUDATA register. ; Local: Executes 6 instructions: increments X; loads A from $0700,x; stores A ; to the PPUDATA register; decrements Y; branches on not equal to ; ProcessOamSpriteList_OnNonzero; branches on equal to ProcessOamSpriteList_Loop_3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z and C flags, Zp51, $0700, PPUCTRL, PPUADDR, ; PPUDATA. ; ;=============================================================================== ProcessOamSpriteList_OnNonzero: inx ; CPU:$D2B6 PRG:12B6 E8 lda $0700,x ; CPU:$D2B7 PRG:12B7 BD 00 07 sta PPUDATA ; CPU:$D2BA PRG:12BA 8D 07 20 dey ; CPU:$D2BD PRG:12BD 88 bne ProcessOamSpriteList_OnNonzero ; CPU:$D2BE PRG:12BE D0 F6 beq ProcessOamSpriteList_Loop_3; CPU:$D2C0 PRG:12C0 F0 07 ;=============================================================================== ; Routine: ProcessOamSpriteList_OnNonzero_2 ; Global: The routine writes the PPUDATA register. ; Local: Executes 4 instructions: increments X; stores A to the PPUDATA ; register; decrements Y; branches on not equal to ProcessOamSpriteList_OnNonzero_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z and C flags, Zp51, $0700, PPUCTRL, PPUADDR, ; PPUDATA. ; ;=============================================================================== ProcessOamSpriteList_OnNonzero_2: inx ; CPU:$D2C2 PRG:12C2 E8 sta PPUDATA ; CPU:$D2C3 PRG:12C3 8D 07 20 dey ; CPU:$D2C6 PRG:12C6 88 bne ProcessOamSpriteList_OnNonzero_2 ; CPU:$D2C7 PRG:12C7 D0 F9 ;=============================================================================== ; Routine: ProcessOamSpriteList_Loop_3 ; Global: The routine calls ProcessOamSpriteList. ; Local: Executes 2 instructions: increments X; calls ProcessOamSpriteList. ; 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, Zp51, $0700, PPUCTRL, PPUADDR, ; PPUDATA. ; ;=============================================================================== ProcessOamSpriteList_Loop_3: inx ; CPU:$D2C9 PRG:12C9 E8 jmp ProcessOamSpriteList ; CPU:$D2CA PRG:12CA 4C 82 D2 ;=============================================================================== ; Routine: ProcessOamSpriteList_Loop_4 ; Global: The routine writes $0700, writes the PPUCTRL register. ; Local: Executes 8 instructions: loads A with $00; stores A to Zp51; stores A ; to $0700; loads A from Zp53; ANDs A with $7B; stores A to the ; PPUCTRL 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: Returns with RTS; the registers it loaded still hold the values it ; computed. Leaves $0700 changed. ; Clobbers: ; A, the N and Z flags, Zp51, $0700, PPUCTRL. ; ;=============================================================================== ProcessOamSpriteList_Loop_4: lda #$00 ; CPU:$D2CD PRG:12CD A9 00 sta Zp51 ; CPU:$D2CF PRG:12CF 85 51 sta $0700 ; CPU:$D2D1 PRG:12D1 8D 00 07 lda Zp53 ; CPU:$D2D4 PRG:12D4 A5 53 and #$7B ; CPU:$D2D6 PRG:12D6 29 7B sta PPUCTRL ; CPU:$D2D8 PRG:12D8 8D 00 20 clc ; CPU:$D2DB PRG:12DB 18 rts ; CPU:$D2DC PRG:12DC 60 ; ---- data $D2DD-$D2FC (32 bytes) ---- ; referenced by `lda $D2DD,x` at $D1CD (operand $D2DD falls inside this region) ; referenced by `lda $D2DE,x` at $D1D2 (operand $D2DE falls inside this region) ObjectUpdateRoutinePointerTable: .byte $4D, $E2, $72, $E2, $83, $E2, $91, $E2, $9F, $E2, $B6, $E2, $D5, $E2, $F9, $E2 ; CPU:$D2DD PRG:12DD 4D E2 72 E2 83 E2 91 E2 9F E2 B6 E2 D5 E2 F9 E2 .byte $1D, $E3, $3A, $E3, $5E, $E3, $6B, $E3, $78, $E3, $89, $E3, $9A, $E3, $AF, $E3 ; CPU:$D2ED PRG:12ED 1D E3 3A E3 5E E3 6B E3 78 E3 89 E3 9A E3 AF E3 ;=============================================================================== ; Routine: StartObjectScreenScript ; Global: The routine calls LoadObjectScriptPointer, DrawActorBox and SetSoundVramAddress, writes the ; PPUMASK and PPUCTRL registers, reads the PPUSTATUS register. ; Local: Executes 15 instructions: loads A with $00; stores A to the PPUMASK ; register; loads A from Zp64; shifts a left; 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: Returns with RTS; the registers it loaded still hold the values it ; computed. Leaves the PPUMASK and PPUCTRL registers set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StartObjectScreenScript: lda #$00 ; CPU:$D2FD PRG:12FD A9 00 sta PPUMASK ; CPU:$D2FF PRG:12FF 8D 01 20 lda Zp64 ; CPU:$D302 PRG:1302 A5 64 asl a ; CPU:$D304 PRG:1304 0A asl a ; CPU:$D305 PRG:1305 0A tax ; CPU:$D306 PRG:1306 AA jsr LoadObjectScriptPointer ; CPU:$D307 PRG:1307 20 42 D3 ldx Zp89 ; CPU:$D30A PRG:130A A6 89 jsr LoadObjectScriptPointer ; CPU:$D30C PRG:130C 20 42 D3 jsr DrawActorBox ; CPU:$D30F PRG:130F 20 B7 CE jsr SetSoundVramAddress ; CPU:$D312 PRG:1312 20 75 D5 lda #$00 ; CPU:$D315 PRG:1315 A9 00 sta PPUCTRL ; CPU:$D317 PRG:1317 8D 00 20 lda PPUSTATUS ; CPU:$D31A PRG:131A AD 02 20 rts ; CPU:$D31D PRG:131D 60 ;=============================================================================== ; Routine: SetPpuCtrlForScroll ; Global: The routine writes the PPUCTRL register. ; Local: Executes 8 instructions: loads A with $1E; stores A to Zp54; loads A ; with $E7; ANDs A with Zp53; ORs A with $08; stores A to Zp53; 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 the PPUCTRL register set. ; Clobbers: ; A, the N and Z flags, Zp53, Zp54, PPUCTRL. ; ;=============================================================================== SetPpuCtrlForScroll: lda #$1E ; CPU:$D31E PRG:131E A9 1E sta Zp54 ; CPU:$D320 PRG:1320 85 54 lda #$E7 ; CPU:$D322 PRG:1322 A9 E7 and Zp53 ; CPU:$D324 PRG:1324 25 53 ora #$08 ; CPU:$D326 PRG:1326 09 08 sta Zp53 ; CPU:$D328 PRG:1328 85 53 sta PPUCTRL ; CPU:$D32A PRG:132A 8D 00 20 rts ; CPU:$D32D PRG:132D 60 ; ---- data $D32E-$D341 (20 bytes) ---- ; referenced by `ldy $D32E,x` at $D342 (operand $D32E falls inside this region) ; referenced by `lda $D32E,x` at $D346 (operand $D32E falls inside this region) ScreenStateScriptPointerTable: .byte $AA, $D3, $B9, $D3, $E1, $D3, $C8, $D3, $AA, $D3, $B9, $D3, $AA, $D3, $B9, $D3 ; CPU:$D32E PRG:132E AA D3 B9 D3 E1 D3 C8 D3 AA D3 B9 D3 AA D3 B9 D3 .byte $EA, $D3, $C8, $D3 ; CPU:$D33E PRG:133E EA D3 C8 D3 ;=============================================================================== ; Routine: LoadObjectScriptPointer ; Global: The routine reads no RAM 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 Y from $D32E,x; increments X; loads A ; from $D32E,x; increments X; stores X to Zp89; stores Y to Zp7C; 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 and C flags, the RAM fields it writes. ; ;=============================================================================== LoadObjectScriptPointer: ldy $D32E,x ; CPU:$D342 PRG:1342 BC 2E D3 inx ; CPU:$D345 PRG:1345 E8 lda $D32E,x ; CPU:$D346 PRG:1346 BD 2E D3 inx ; CPU:$D349 PRG:1349 E8 stx Zp89 ; CPU:$D34A PRG:134A 86 89 sty Zp7C ; CPU:$D34C PRG:134C 84 7C sta Zp7D ; CPU:$D34E PRG:134E 85 7D ldy #$00 ; CPU:$D350 PRG:1350 A0 00 lda (Zp7C),y ; CPU:$D352 PRG:1352 B1 7C sta Zp8A ; CPU:$D354 PRG:1354 85 8A and #$0F ; CPU:$D356 PRG:1356 29 0F sta Zp79 ; CPU:$D358 PRG:1358 85 79 iny ; CPU:$D35A PRG:135A C8 sty Zp7B ; CPU:$D35B PRG:135B 84 7B bne LoadObjectScriptPointer_Loop ; CPU:$D35D PRG:135D D0 06 ;=============================================================================== ; Routine: LoadObjectScriptPointer_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 3 instructions: loads Y from Zp7B; loads A from Zp8A; ; branches on negative to LoadObjectScriptPointer_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp79, Zp7B, Zp7E, Zp7F, PPUADDR, ; PPUDATA. ; ;=============================================================================== LoadObjectScriptPointer_OnNonzero: ldy Zp7B ; CPU:$D35F PRG:135F A4 7B lda Zp8A ; CPU:$D361 PRG:1361 A5 8A bmi LoadObjectScriptPointer_Loop_2 ; CPU:$D363 PRG:1363 30 10 ;=============================================================================== ; Routine: LoadObjectScriptPointer_Loop ; Global: The routine writes the PPUADDR registers, reads the PPUSTATUS ; register. ; Local: Executes 11 instructions: loads Y from Zp7B; loads A from Zp8A; ; branches on negative to LoadObjectScriptPointer_Loop_2; loads A from the PPUSTATUS ; register; loads A from ((Zp7C),y); copies A into 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. Leaves the PPUADDR registers set. ; Clobbers: ; A, X and Y, the N, Z and C flags, Zp79, Zp7B, Zp7E, Zp7F, PPUADDR, ; PPUDATA. ; ;=============================================================================== LoadObjectScriptPointer_Loop: lda PPUSTATUS ; CPU:$D365 PRG:1365 AD 02 20 lda (Zp7C),y ; CPU:$D368 PRG:1368 B1 7C tax ; CPU:$D36A PRG:136A AA iny ; CPU:$D36B PRG:136B C8 lda (Zp7C),y ; CPU:$D36C PRG:136C B1 7C sta PPUADDR ; CPU:$D36E PRG:136E 8D 06 20 stx PPUADDR ; CPU:$D371 PRG:1371 8E 06 20 iny ; CPU:$D374 PRG:1374 C8 ;=============================================================================== ; Routine: LoadObjectScriptPointer_Loop_2 ; Global: The routine calls ResetObjectSpriteIndexTwo, writes the PPUADDR registers, reads the ; PPUSTATUS register. ; Local: Executes 21 instructions: loads Y from Zp7B; loads A from Zp8A; ; branches on negative to LoadObjectScriptPointer_Loop_2; loads A from the PPUSTATUS ; register; loads A from ((Zp7C),y); copies A into X; 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: 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 and C flags, Zp79, Zp7B, Zp7E, Zp7F, PPUADDR, ; PPUDATA. ; ;=============================================================================== LoadObjectScriptPointer_Loop_2: lda (Zp7C),y ; CPU:$D375 PRG:1375 B1 7C sta Zp7E ; CPU:$D377 PRG:1377 85 7E iny ; CPU:$D379 PRG:1379 C8 lda (Zp7C),y ; CPU:$D37A PRG:137A B1 7C sta Zp7F ; CPU:$D37C PRG:137C 85 7F iny ; CPU:$D37E PRG:137E C8 sty Zp7B ; CPU:$D37F PRG:137F 84 7B jsr ResetObjectSpriteIndexTwo ; CPU:$D381 PRG:1381 20 89 D3 dec Zp79 ; CPU:$D384 PRG:1384 C6 79 bne LoadObjectScriptPointer_OnNonzero ; CPU:$D386 PRG:1386 D0 D7 ;=============================================================================== ; Routine: LoadObjectScriptPointer_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 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. ; ;=============================================================================== LoadObjectScriptPointer_OnZero: rts ; CPU:$D388 PRG:1388 60 ;=============================================================================== ; Routine: ResetObjectSpriteIndexTwo ; Global: The routine reads no RAM 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: returns with RTS; 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: Returns with RTS; the registers it loaded still hold the values it ; computed. ; Clobbers: ; A, X and Y, the N, Z and C flags, PPUDATA. ; ;=============================================================================== ResetObjectSpriteIndexTwo: ldy #$00 ; CPU:$D389 PRG:1389 A0 00 ;=============================================================================== ; Routine: ResetObjectSpriteIndexTwo_OnNonzero ; Global: The routine writes the PPUDATA register. ; Local: Executes 7 instructions: returns with RTS; loads A from ((Zp7E),y); ; compares A with $5A; branches on equal to LoadObjectScriptPointer_OnZero; compares A with ; $57; branches on equal to ResetObjectSpriteIndexTwo_Loop; 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z and C flags, PPUDATA. ; ;=============================================================================== ResetObjectSpriteIndexTwo_OnNonzero: lda (Zp7E),y ; CPU:$D38B PRG:138B B1 7E cmp #$5A ; CPU:$D38D PRG:138D C9 5A beq LoadObjectScriptPointer_OnZero ; CPU:$D38F PRG:138F F0 F7 cmp #$57 ; CPU:$D391 PRG:1391 C9 57 beq ResetObjectSpriteIndexTwo_Loop ; CPU:$D393 PRG:1393 F0 06 sta PPUDATA ; CPU:$D395 PRG:1395 8D 07 20 ;=============================================================================== ; Routine: ResetObjectSpriteIndexTwo_OnZero ; Global: The routine writes the PPUDATA register. ; Local: Executes 9 instructions: returns with RTS; loads A from ((Zp7E),y); ; compares A with $5A; branches on equal to LoadObjectScriptPointer_OnZero; compares A with ; $57; branches on equal to ResetObjectSpriteIndexTwo_Loop; 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 the PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z and C flags, PPUDATA. ; ;=============================================================================== ResetObjectSpriteIndexTwo_OnZero: iny ; CPU:$D398 PRG:1398 C8 bne ResetObjectSpriteIndexTwo_OnNonzero ; CPU:$D399 PRG:1399 D0 F0 ;=============================================================================== ; Routine: ResetObjectSpriteIndexTwo_Loop ; Global: The routine writes the PPUDATA register. ; Local: Executes 14 instructions: returns with RTS; loads A from ((Zp7E),y); ; compares A with $5A; branches on equal to LoadObjectScriptPointer_OnZero; compares A with ; $57; branches on equal to ResetObjectSpriteIndexTwo_Loop; 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. Leaves the PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z and C flags, PPUDATA. ; ;=============================================================================== ResetObjectSpriteIndexTwo_Loop: iny ; CPU:$D39B PRG:139B C8 lda (Zp7E),y ; CPU:$D39C PRG:139C B1 7E tax ; CPU:$D39E PRG:139E AA iny ; CPU:$D39F PRG:139F C8 lda (Zp7E),y ; CPU:$D3A0 PRG:13A0 B1 7E ;=============================================================================== ; Routine: ResetObjectSpriteIndexTwo_OnNonzero_2 ; Global: The routine writes the PPUDATA registers. ; Local: Executes 18 instructions: returns with RTS; loads A from ((Zp7E),y); ; compares A with $5A; branches on equal to LoadObjectScriptPointer_OnZero; compares A with ; $57; branches on equal to ResetObjectSpriteIndexTwo_Loop; 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. Leaves the PPUDATA registers set. ; Clobbers: ; A, X and Y, the N, Z and C flags, PPUDATA. ; ;=============================================================================== ResetObjectSpriteIndexTwo_OnNonzero_2: sta PPUDATA ; CPU:$D3A2 PRG:13A2 8D 07 20 dex ; CPU:$D3A5 PRG:13A5 CA bne ResetObjectSpriteIndexTwo_OnNonzero_2 ; CPU:$D3A6 PRG:13A6 D0 FA beq ResetObjectSpriteIndexTwo_OnZero ; CPU:$D3A8 PRG:13A8 F0 EE ; ---- data $D3AA-$D3C8 (31 bytes) ---- ScreenStateScriptRecords: .byte $86, $E0, $20, $C4, $E3, $77, $E4, $59, $E4, $63, $E4, $6D, $E4, $28, $E4, $86 ; CPU:$D3AA PRG:13AA 86 E0 20 C4 E3 77 E4 59 E4 63 E4 6D E4 28 E4 86 .byte $E0, $24, $C4, $E3, $77, $E4, $59, $E4, $63, $E4, $6D, $E4, $28, $E4, $06 ; CPU:$D3BA PRG:13BA E0 24 C4 E3 77 E4 59 E4 63 E4 6D E4 28 E4 06 rts ; CPU:$D3C9 PRG:13C9 60 ; ---- data $D3CA-$D3F2 (41 bytes) ---- ScreenStateScriptRecordsAlt: .byte $22, $C4, $E3, $00, $23, $6D, $E4, $C0, $23, $3F, $E4, $60, $26, $C4, $E3, $00 ; CPU:$D3CA PRG:13CA 22 C4 E3 00 23 6D E4 C0 23 3F E4 60 26 C4 E3 00 .byte $27, $6D, $E4, $C0, $27, $3F, $E4, $02, $00, $22, $20, $E4, $00, $26, $20, $E4 ; CPU:$D3DA PRG:13DA 27 6D E4 C0 27 3F E4 02 00 22 20 E4 00 26 20 E4 .byte $02, $E0, $20, $24, $E4, $E0, $24, $24, $E4 ; CPU:$D3EA PRG:13EA 02 E0 20 24 E4 E0 24 24 E4 ;=============================================================================== ; Routine: DispatchObjectAction ; Global: The routine calls AdvanceObjectScriptIndex, reads $0327. ; Local: Executes 12 instructions: loads Y with $00; loads X from Zp64; ; branches on equal to DispatchObjectAction_Loop_5; decrements X; branches on equal to ; DispatchObjectAction_Loop_7; decrements X; and 6 more instructions. ; Parameters: Reads $0327 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. ; ;=============================================================================== DispatchObjectAction: ldy #$00 ; CPU:$D3F3 PRG:13F3 A0 00 ldx Zp64 ; CPU:$D3F5 PRG:13F5 A6 64 beq DispatchObjectAction_Loop_5; CPU:$D3F7 PRG:13F7 F0 40 dex ; CPU:$D3F9 PRG:13F9 CA beq DispatchObjectAction_Loop_7; CPU:$D3FA PRG:13FA F0 61 dex ; CPU:$D3FC PRG:13FC CA beq DispatchObjectAction_Loop_2; CPU:$D3FD PRG:13FD F0 20 dex ; CPU:$D3FF PRG:13FF CA beq DispatchObjectAction_Loop ; CPU:$D400 PRG:1400 F0 08 ldx $0327 ; CPU:$D402 PRG:1402 AE 27 03 beq DispatchObjectAction_Loop_4; CPU:$D405 PRG:1405 F0 2F jmp AdvanceObjectScriptIndex ; CPU:$D407 PRG:1407 4C 8E D4 ;=============================================================================== ; Routine: DispatchObjectAction_Loop ; Global: The routine reads $038E and $0323. ; Local: Executes 11 instructions: loads X from $038E; branches on equal to ; DispatchObjectAction_Loop_4; loads X from $0323; branches on equal to DispatchObjectAction_Loop_4; ; decrements X; branches on equal to AdvanceObjectScriptIndex_Loop_3; and 5 more ; instructions. ; Parameters: Reads $038E and $0323 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. ; ;=============================================================================== DispatchObjectAction_Loop: ldx $038E ; CPU:$D40A PRG:140A AE 8E 03 beq DispatchObjectAction_Loop_4; CPU:$D40D PRG:140D F0 27 ldx $0323 ; CPU:$D40F PRG:140F AE 23 03 beq DispatchObjectAction_Loop_4; CPU:$D412 PRG:1412 F0 22 dex ; CPU:$D414 PRG:1414 CA beq AdvanceObjectScriptIndex_Loop_3 ; CPU:$D415 PRG:1415 F0 7A dex ; CPU:$D417 PRG:1417 CA beq AdvanceObjectScriptIndex_Loop_2 ; CPU:$D418 PRG:1418 F0 76 dex ; CPU:$D41A PRG:141A CA beq AdvanceObjectScriptIndex_Loop ; CPU:$D41B PRG:141B F0 72 bne DispatchObjectAction_Loop_12 ; CPU:$D41D PRG:141D D0 6E ;=============================================================================== ; Routine: DispatchObjectAction_Loop_2 ; Global: The routine reads no RAM 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 ZpDF; branches on not equal to ; DispatchObjectAction_Loop_4; copies A into Y; 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: 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. ; ;=============================================================================== DispatchObjectAction_Loop_2: lda ZpDF ; CPU:$D41F PRG:141F A5 DF bne DispatchObjectAction_Loop_4; CPU:$D421 PRG:1421 D0 13 tay ; CPU:$D423 PRG:1423 A8 ldx #$02 ; CPU:$D424 PRG:1424 A2 02 ;=============================================================================== ; Routine: DispatchObjectAction_OnNonnegative ; Global: The routine reads no RAM 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 ZpD9,x; branches on equal to ; DispatchObjectAction_Loop_3; 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. ; ;=============================================================================== DispatchObjectAction_OnNonnegative: lda ZpD9,x ; CPU:$D426 PRG:1426 B5 D9 beq DispatchObjectAction_Loop_3; CPU:$D428 PRG:1428 F0 01 iny ; CPU:$D42A PRG:142A C8 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_3 ; Global: The routine reads no RAM 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 ZpD9,x; branches on equal to ; DispatchObjectAction_Loop_3; increments Y; decrements X; branches on non-negative to ; DispatchObjectAction_OnNonnegative; copies Y into 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. ; ;=============================================================================== DispatchObjectAction_Loop_3: dex ; CPU:$D42B PRG:142B CA bpl DispatchObjectAction_OnNonnegative ; CPU:$D42C PRG:142C 10 F8 tya ; CPU:$D42E PRG:142E 98 beq DispatchObjectAction_Loop_4; CPU:$D42F PRG:142F F0 05 dey ; CPU:$D431 PRG:1431 88 beq AdvanceObjectScriptIndex_Loop_3 ; CPU:$D432 PRG:1432 F0 5D bne DispatchObjectAction_Loop_9; CPU:$D434 PRG:1434 D0 47 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_4 ; Global: The routine calls CheckGameTimer. ; Local: Executes 1 instruction: calls CheckGameTimer. ; 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, $0325, $0338, ; $0339, $0402. ; ;=============================================================================== DispatchObjectAction_Loop_4: jmp CheckGameTimer ; CPU:$D436 PRG:1436 4C CE D4 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_5 ; Global: The routine calls CheckGameTimer, reads $033F and $0321. ; Local: Executes 8 instructions: calls CheckGameTimer; loads X from $033F; branches ; on not equal to DispatchObjectAction_Loop_11; loads X from $0321; branches on not equal ; to DispatchObjectAction_Loop_9; loads A from ZpDF; and 2 more instructions. ; Parameters: Reads $033F and $0321 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. ; ;=============================================================================== DispatchObjectAction_Loop_5: ldx $033F ; CPU:$D439 PRG:1439 AE 3F 03 bne DispatchObjectAction_Loop_11 ; CPU:$D43C PRG:143C D0 48 ldx $0321 ; CPU:$D43E PRG:143E AE 21 03 bne DispatchObjectAction_Loop_9; CPU:$D441 PRG:1441 D0 3A lda ZpDF ; CPU:$D443 PRG:1443 A5 DF bne DispatchObjectAction_Loop_4; CPU:$D445 PRG:1445 D0 EF ldx #$02 ; CPU:$D447 PRG:1447 A2 02 ;=============================================================================== ; Routine: DispatchObjectAction_OnNonnegative_2 ; Global: The routine calls CheckGameTimer. ; Local: Executes 7 instructions: calls CheckGameTimer; loads A from ZpD9,x; ; branches on equal to DispatchObjectAction_Loop_6; increments Y; compares X with $02; ; branches on not equal to DispatchObjectAction_Loop_6; 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. ; ;=============================================================================== DispatchObjectAction_OnNonnegative_2: lda ZpD9,x ; CPU:$D449 PRG:1449 B5 D9 beq DispatchObjectAction_Loop_6; CPU:$D44B PRG:144B F0 06 iny ; CPU:$D44D PRG:144D C8 cpx #$02 ; CPU:$D44E PRG:144E E0 02 bne DispatchObjectAction_Loop_6; CPU:$D450 PRG:1450 D0 01 iny ; CPU:$D452 PRG:1452 C8 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_6 ; Global: The routine calls CheckGameTimer and AdvanceObjectScriptIndex_Loop_3. ; Local: Executes 13 instructions: calls CheckGameTimer; loads A from ZpD9,x; ; branches on equal to DispatchObjectAction_Loop_6; increments Y; compares X with $02; ; branches on not equal to DispatchObjectAction_Loop_6; 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. ; ;=============================================================================== DispatchObjectAction_Loop_6: dex ; CPU:$D453 PRG:1453 CA bpl DispatchObjectAction_OnNonnegative_2 ; CPU:$D454 PRG:1454 10 F3 tya ; CPU:$D456 PRG:1456 98 beq DispatchObjectAction_Loop_4; CPU:$D457 PRG:1457 F0 DD dey ; CPU:$D459 PRG:1459 88 jmp AdvanceObjectScriptIndex_Loop_3 ; CPU:$D45A PRG:145A 4C 91 D4 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_7 ; Global: The routine calls CheckGameTimer. ; Local: Executes 5 instructions: calls CheckGameTimer; loads A from ZpDF; branches ; on not equal to DispatchObjectAction_Loop_4; copies A into Y; loads X 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, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== DispatchObjectAction_Loop_7: lda ZpDF ; CPU:$D45D PRG:145D A5 DF bne DispatchObjectAction_Loop_4; CPU:$D45F PRG:145F D0 D5 tay ; CPU:$D461 PRG:1461 A8 ldx #$04 ; CPU:$D462 PRG:1462 A2 04 ;=============================================================================== ; Routine: DispatchObjectAction_OnNonnegative_3 ; Global: The routine calls CheckGameTimer. ; Local: Executes 7 instructions: calls CheckGameTimer; loads A from ZpD9,x; ; branches on equal to DispatchObjectAction_Loop_8; increments Y; compares X with $02; ; branches on carry set to DispatchObjectAction_Loop_8; 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. ; ;=============================================================================== DispatchObjectAction_OnNonnegative_3: lda ZpD9,x ; CPU:$D464 PRG:1464 B5 D9 beq DispatchObjectAction_Loop_8; CPU:$D466 PRG:1466 F0 06 iny ; CPU:$D468 PRG:1468 C8 cpx #$02 ; CPU:$D469 PRG:1469 E0 02 bcs DispatchObjectAction_Loop_8; CPU:$D46B PRG:146B B0 01 iny ; CPU:$D46D PRG:146D C8 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_8 ; Global: The routine calls CheckGameTimer. ; Local: Executes 17 instructions: calls CheckGameTimer; loads A from ZpD9,x; ; branches on equal to DispatchObjectAction_Loop_8; increments Y; compares X with $02; ; branches on carry set to DispatchObjectAction_Loop_8; 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. ; ;=============================================================================== DispatchObjectAction_Loop_8: dex ; CPU:$D46E PRG:146E CA bpl DispatchObjectAction_OnNonnegative_3 ; CPU:$D46F PRG:146F 10 F3 tya ; CPU:$D471 PRG:1471 98 beq DispatchObjectAction_Loop_4; CPU:$D472 PRG:1472 F0 C2 dey ; CPU:$D474 PRG:1474 88 beq AdvanceObjectScriptIndex_Loop_3 ; CPU:$D475 PRG:1475 F0 1A dey ; CPU:$D477 PRG:1477 88 beq AdvanceObjectScriptIndex_Loop_2 ; CPU:$D478 PRG:1478 F0 16 dey ; CPU:$D47A PRG:147A 88 bne DispatchObjectAction_Loop_10 ; CPU:$D47B PRG:147B D0 04 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_9 ; Global: The routine reads no RAM 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 $FD; branches on negative to ; DispatchObjectAction_Loop_11. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== DispatchObjectAction_Loop_9: ldy #$FD ; CPU:$D47D PRG:147D A0 FD bmi DispatchObjectAction_Loop_11 ; CPU:$D47F PRG:147F 30 05 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_10 ; Global: The routine reads no RAM 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 Y; branches on equal to AdvanceObjectScriptIndex_Loop; ; loads Y 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 and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== DispatchObjectAction_Loop_10: dey ; CPU:$D481 PRG:1481 88 beq AdvanceObjectScriptIndex_Loop ; CPU:$D482 PRG:1482 F0 0B ldy #$FF ; CPU:$D484 PRG:1484 A0 FF ;=============================================================================== ; Routine: DispatchObjectAction_Loop_11 ; Global: The routine calls PlaySoundEffectById. ; Local: Executes 4 instructions: loads A with $05; calls PlaySoundEffectById; increments ; Y; 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: 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. ; ;=============================================================================== DispatchObjectAction_Loop_11: lda #$05 ; CPU:$D486 PRG:1486 A9 05 jsr PlaySoundEffectById ; CPU:$D488 PRG:1488 20 0D F8 iny ; CPU:$D48B PRG:148B C8 iny ; CPU:$D48C PRG:148C C8 ;=============================================================================== ; Routine: DispatchObjectAction_Loop_12 ; Global: The routine reads no RAM 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 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 OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== DispatchObjectAction_Loop_12: iny ; CPU:$D48D PRG:148D C8 ;=============================================================================== ; Routine: AdvanceObjectScriptIndex ; Global: The routine reads no RAM 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 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 OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== AdvanceObjectScriptIndex: iny ; CPU:$D48E PRG:148E C8 ;=============================================================================== ; Routine: AdvanceObjectScriptIndex_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: 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: 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. ; ;=============================================================================== AdvanceObjectScriptIndex_Loop: iny ; CPU:$D48F PRG:148F C8 ;=============================================================================== ; Routine: AdvanceObjectScriptIndex_Loop_2 ; Global: The routine reads no RAM 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 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 OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== AdvanceObjectScriptIndex_Loop_2: iny ; CPU:$D490 PRG:1490 C8 ;=============================================================================== ; Routine: AdvanceObjectScriptIndex_Loop_3 ; Global: The routine calls ResetActorSprites and SelectAttributeRow, writes $0321, $0327, $033F ; and $0324, reads $0324. ; Local: Executes 17 instructions: calls ResetActorSprites; stores A to $0321; stores A ; to $0327; stores A to $033F; stores Y to $0324; loads A from ; $D4C7,y; and 11 more instructions. ; Parameters: Reads $0324 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 $0321, $0327 and $033F ; changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== AdvanceObjectScriptIndex_Loop_3: jsr ResetActorSprites ; CPU:$D491 PRG:1491 20 FC C8 sta $0321 ; CPU:$D494 PRG:1494 8D 21 03 sta $0327 ; CPU:$D497 PRG:1497 8D 27 03 sta $033F ; CPU:$D49A PRG:149A 8D 3F 03 sty $0324 ; CPU:$D49D PRG:149D 8C 24 03 lda $D4C7,y ; CPU:$D4A0 PRG:14A0 B9 C7 D4 sta ZpEA ; CPU:$D4A3 PRG:14A3 85 EA lda #$00 ; CPU:$D4A5 PRG:14A5 A9 00 sta ZpEB ; CPU:$D4A7 PRG:14A7 85 EB jsr SelectAttributeRow ; CPU:$D4A9 PRG:14A9 20 C4 C6 lda Zp64 ; CPU:$D4AC PRG:14AC A5 64 cmp #$03 ; CPU:$D4AE PRG:14AE C9 03 beq AdvanceObjectScriptIndex_Loop_4 ; CPU:$D4B0 PRG:14B0 F0 09 ldy $0324 ; CPU:$D4B2 PRG:14B2 AC 24 03 beq AdvanceObjectScriptIndex_Loop_5 ; CPU:$D4B5 PRG:14B5 F0 0D cpy #$03 ; CPU:$D4B7 PRG:14B7 C0 03 bcc AdvanceObjectScriptIndex_Loop_5 ; CPU:$D4B9 PRG:14B9 90 09 ;=============================================================================== ; Routine: AdvanceObjectScriptIndex_Loop_4 ; Global: The routine writes $0402 and $0325. ; Local: Executes 4 instructions: loads Y with $01; stores Y to $0402; ; decrements Y; stores Y to $0325. ; 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 $0402 and $0325 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow, $0325, $0338, ; $0339, $0402. ; ;=============================================================================== AdvanceObjectScriptIndex_Loop_4: ldy #$01 ; CPU:$D4BB PRG:14BB A0 01 sty $0402 ; CPU:$D4BD PRG:14BD 8C 02 04 dey ; CPU:$D4C0 PRG:14C0 88 sty $0325 ; CPU:$D4C1 PRG:14C1 8C 25 03 ;=============================================================================== ; Routine: AdvanceObjectScriptIndex_Loop_5 ; Global: The routine calls CheckGameTimer. ; Local: Executes 1 instruction: calls CheckGameTimer. ; 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, $0325, $0338, ; $0339, $0402. ; ;=============================================================================== AdvanceObjectScriptIndex_Loop_5: jmp CheckGameTimer ; CPU:$D4C4 PRG:14C4 4C CE D4 ; ---- data $D4C7-$D4CD (7 bytes) ---- ; referenced by `lda $D4C7,y` at $D4A0 (operand $D4C7 falls inside this region) ObjectStepSizeTable: .byte $01, $02, $04, $05, $08, $10, $50 ; CPU:$D4C7 PRG:14C7 01 02 04 05 08 10 50 ;=============================================================================== ; Routine: CheckGameTimer ; Global: The routine writes $0325, reads $0402 and $0325. ; Local: Executes 7 instructions: loads A from $0402; branches on equal to ; ClearActorSprites_Loop; loads A from $0325; branches on not equal to CheckGameTimer_Loop; ; loads A with $1F; stores A to $0325; and 1 more instruction. ; Parameters: Reads $0402 and $0325 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 $0325 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow, $0325, $0338, ; $0339, $0402. ; ;=============================================================================== CheckGameTimer: lda $0402 ; CPU:$D4CE PRG:14CE AD 02 04 beq ClearActorSprites_Loop ; CPU:$D4D1 PRG:14D1 F0 20 lda $0325 ; CPU:$D4D3 PRG:14D3 AD 25 03 bne CheckGameTimer_Loop ; CPU:$D4D6 PRG:14D6 D0 07 lda #$1F ; CPU:$D4D8 PRG:14D8 A9 1F sta $0325 ; CPU:$D4DA PRG:14DA 8D 25 03 bne ClearActorSprites_Loop_2 ; CPU:$D4DD PRG:14DD D0 15 ;=============================================================================== ; Routine: CheckGameTimer_Loop ; Global: The routine reads $0325. ; Local: Executes 2 instructions: decrements $0325; branches on not equal to ; ClearActorSprites_Loop. ; Parameters: Reads $0325 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 and Z flags, the OAM shadow, $0325, $0402. ; ;=============================================================================== CheckGameTimer_Loop: dec $0325 ; CPU:$D4DF PRG:14DF CE 25 03 bne ClearActorSprites_Loop ; CPU:$D4E2 PRG:14E2 D0 0F ;=============================================================================== ; Routine: ClearActorSprites ; Global: The routine writes $0402. ; Local: Executes 6 instructions: loads Y with $18; loads A with $F4; stores A ; to $0200,y; stores A to $0204,y; loads A with $00; stores A to ; $0402. ; 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 $0402 changed. ; Clobbers: ; A and Y, the N and Z flags, the OAM shadow, $0402. ; ;=============================================================================== ClearActorSprites: ldy #$18 ; CPU:$D4E4 PRG:14E4 A0 18 lda #$F4 ; CPU:$D4E6 PRG:14E6 A9 F4 sta $0200,y ; CPU:$D4E8 PRG:14E8 99 00 02 sta $0204,y ; CPU:$D4EB PRG:14EB 99 04 02 lda #$00 ; CPU:$D4EE PRG:14EE A9 00 sta $0402 ; CPU:$D4F0 PRG:14F0 8D 02 04 ;=============================================================================== ; Routine: ClearActorSprites_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: 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. ; ;=============================================================================== ClearActorSprites_Loop: rts ; CPU:$D4F3 PRG:14F3 60 ;=============================================================================== ; Routine: ClearActorSprites_Loop_2 ; Global: The routine reads no RAM 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 Y from Zp64; compares Y with $03; ; branches on equal to ClearActorSprites_Loop_4; loads A from Zp73; clears the carry ; flag; adds $F4 to 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: 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, $0338, $0339. ; ;=============================================================================== ClearActorSprites_Loop_2: ldy Zp64 ; CPU:$D4F4 PRG:14F4 A4 64 cpy #$03 ; CPU:$D4F6 PRG:14F6 C0 03 beq ClearActorSprites_Loop_4 ; CPU:$D4F8 PRG:14F8 F0 13 lda Zp73 ; CPU:$D4FA PRG:14FA A5 73 clc ; CPU:$D4FC PRG:14FC 18 adc #$F4 ; CPU:$D4FD PRG:14FD 69 F4 cpy #$04 ; CPU:$D4FF PRG:14FF C0 04 bne ClearActorSprites_Loop_3 ; CPU:$D501 PRG:1501 D0 02 adc #$2C ; CPU:$D503 PRG:1503 69 2C ;=============================================================================== ; Routine: ClearActorSprites_Loop_3 ; Global: The routine writes $0339 and $0338. ; Local: Executes 3 instructions: stores A to $0339; loads A from Zp74; stores ; A to $0338. ; 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 $0339 and $0338 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow, $0338, $0339. ; ;=============================================================================== ClearActorSprites_Loop_3: sta $0339 ; CPU:$D505 PRG:1505 8D 39 03 lda Zp74 ; CPU:$D508 PRG:1508 A5 74 sta $0338 ; CPU:$D50A PRG:150A 8D 38 03 ;=============================================================================== ; Routine: ClearActorSprites_Loop_4 ; Global: The routine reads $0339 and $0324. ; Local: Executes 9 instructions: loads Y with $18; loads A from $0339; stores ; A to $0200,y; stores A to $0204,y; loads X from $0324; loads A from ; $D53D,x; and 3 more instructions. ; Parameters: Reads $0339 and $0324 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. ; ;=============================================================================== ClearActorSprites_Loop_4: ldy #$18 ; CPU:$D50D PRG:150D A0 18 lda $0339 ; CPU:$D50F PRG:150F AD 39 03 sta $0200,y ; CPU:$D512 PRG:1512 99 00 02 sta $0204,y ; CPU:$D515 PRG:1515 99 04 02 ldx $0324 ; CPU:$D518 PRG:1518 AE 24 03 lda $D53D,x ; CPU:$D51B PRG:151B BD 3D D5 sta $0201,y ; CPU:$D51E PRG:151E 99 01 02 beq ClearActorSprites_Loop_5 ; CPU:$D521 PRG:1521 F0 02 lda #$03 ; CPU:$D523 PRG:1523 A9 03 ;=============================================================================== ; Routine: ClearActorSprites_Loop_5 ; Global: The routine reads $0338. ; Local: Executes 9 instructions: stores A to $0205,y; loads A with $03; ; stores A to $0202,y; stores A to $0206,y; loads A from $0338; ; stores A to $0203,y; and 3 more instructions. ; Parameters: Reads $0338 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, the N, Z, C and V flags, the OAM shadow. ; ;=============================================================================== ClearActorSprites_Loop_5: sta $0205,y ; CPU:$D525 PRG:1525 99 05 02 lda #$03 ; CPU:$D528 PRG:1528 A9 03 sta $0202,y ; CPU:$D52A PRG:152A 99 02 02 sta $0206,y ; CPU:$D52D PRG:152D 99 06 02 lda $0338 ; CPU:$D530 PRG:1530 AD 38 03 sta $0203,y ; CPU:$D533 PRG:1533 99 03 02 clc ; CPU:$D536 PRG:1536 18 adc #$08 ; CPU:$D537 PRG:1537 69 08 sta $0207,y ; CPU:$D539 PRG:1539 99 07 02 ;=============================================================================== ; Routine: ClearActorSprites_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: 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. ; ;=============================================================================== ClearActorSprites_OnNonzero: rts ; CPU:$D53C PRG:153C 60 ; ---- data $D53D-$D543 (7 bytes) ---- ; referenced by `lda $D53D,x` at $D51B (operand $D53D falls inside this region) ObjectSpriteTileTable: .byte $A7, $12, $22, $23, $94, $A4, $EF ; CPU:$D53D PRG:153D A7 12 22 23 94 A4 EF ;=============================================================================== ; Routine: CheckActorStateFlags ; Global: The routine reads no RAM 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: returns with RTS; loads A from Zp0F; ; branches on not equal to ClearActorSprites_OnNonzero; loads A from Zp09; ANDs A with ; $0F; branches on not equal to ClearActorSprites_OnNonzero. ; 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. ; ;=============================================================================== CheckActorStateFlags: lda Zp0F ; CPU:$D544 PRG:1544 A5 0F bne ClearActorSprites_OnNonzero; CPU:$D546 PRG:1546 D0 F4 lda Zp09 ; CPU:$D548 PRG:1548 A5 09 and #$0F ; CPU:$D54A PRG:154A 29 0F bne ClearActorSprites_OnNonzero; CPU:$D54C PRG:154C D0 EE ;=============================================================================== ; Routine: ResetActorIndex ; Global: The routine reads no RAM 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: returns with RTS; 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: 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. ; ;=============================================================================== ResetActorIndex: ldx #$00 ; CPU:$D54E PRG:154E A2 00 ;=============================================================================== ; Routine: ResetActorIndex_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 8 instructions: returns with RTS; decrements $0341,x; ; branches on non-negative to ResetActorIndex_Loop; loads A with $09; stores A to ; $0341,x; increments 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: 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. ; ;=============================================================================== ResetActorIndex_OnNonzero: dec $0341,x ; CPU:$D550 PRG:1550 DE 41 03 bpl ResetActorIndex_Loop ; CPU:$D553 PRG:1553 10 0A lda #$09 ; CPU:$D555 PRG:1555 A9 09 sta $0341,x ; CPU:$D557 PRG:1557 9D 41 03 inx ; CPU:$D55A PRG:155A E8 cpx #$03 ; CPU:$D55B PRG:155B E0 03 bne ResetActorIndex_OnNonzero ; CPU:$D55D PRG:155D D0 F1 ;=============================================================================== ; Routine: ResetActorIndex_Loop ; Global: The routine calls SetActorIndexOne, reads $0343 and $0401. ; Local: Executes 10 instructions: returns with RTS; loads A from $0343; ; branches on not equal to ClearActorSprites_OnNonzero; loads A from Zp00; compares A ; with $05; branches on not equal to ClearActorSprites_OnNonzero; and 4 more ; instructions. ; Parameters: Reads $0343 and $0401 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 RAM fields it writes. ; ;=============================================================================== ResetActorIndex_Loop: lda $0343 ; CPU:$D55F PRG:155F AD 43 03 bne ClearActorSprites_OnNonzero; CPU:$D562 PRG:1562 D0 D8 lda Zp00 ; CPU:$D564 PRG:1564 A5 00 cmp #$05 ; CPU:$D566 PRG:1566 C9 05 bne ClearActorSprites_OnNonzero; CPU:$D568 PRG:1568 D0 D2 lda $0401 ; CPU:$D56A PRG:156A AD 01 04 bne ClearActorSprites_OnNonzero; CPU:$D56D PRG:156D D0 CD inc $0401 ; CPU:$D56F PRG:156F EE 01 04 jmp SetActorIndexOne ; CPU:$D572 PRG:1572 4C 55 CB ;=============================================================================== ; Routine: SetSoundVramAddress ; Global: The routine writes the PPUADDR registers, reads the PPUSTATUS ; register. ; Local: Executes 10 instructions: loads A with $40; stores A to Zp7E; loads A ; with $03; stores A to Zp7F; loads A from the PPUSTATUS register; ; loads A with $20; 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 and Y, the N and Z flags, Zp7E, Zp7F, PPUADDR, PPUDATA. ; ;=============================================================================== SetSoundVramAddress: lda #$40 ; CPU:$D575 PRG:1575 A9 40 sta Zp7E ; CPU:$D577 PRG:1577 85 7E lda #$03 ; CPU:$D579 PRG:1579 A9 03 sta Zp7F ; CPU:$D57B PRG:157B 85 7F lda PPUSTATUS ; CPU:$D57D PRG:157D AD 02 20 lda #$20 ; CPU:$D580 PRG:1580 A9 20 sta PPUADDR ; CPU:$D582 PRG:1582 8D 06 20 lda #$92 ; CPU:$D585 PRG:1585 A9 92 sta PPUADDR ; CPU:$D587 PRG:1587 8D 06 20 ldy #$03 ; CPU:$D58A PRG:158A A0 03 ;=============================================================================== ; Routine: SetSoundVramAddress_OnNonnegative ; Global: The routine writes the PPUDATA register. ; Local: Executes 6 instructions: loads A from ((Zp7E),y); ORs A with $30; ; stores A to the PPUDATA register; decrements Y; branches on ; non-negative to SetSoundVramAddress_OnNonnegative; 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: ; A and Y, the N and Z flags, PPUDATA. ; ;=============================================================================== SetSoundVramAddress_OnNonnegative: lda (Zp7E),y ; CPU:$D58C PRG:158C B1 7E ora #$30 ; CPU:$D58E PRG:158E 09 30 sta PPUDATA ; CPU:$D590 PRG:1590 8D 07 20 dey ; CPU:$D593 PRG:1593 88 bpl SetSoundVramAddress_OnNonnegative ; CPU:$D594 PRG:1594 10 F6 rts ; CPU:$D596 PRG:1596 60 ;=============================================================================== ; Routine: UpdateFrameCounter ; Global: The routine writes $0302, reads $0302. ; Local: Executes 8 instructions: loads A from Zp09; ANDs A with $07; branches ; on not equal to CheckActorFrameFlags_Loop; increments $0302; loads A from $0302; ; EORs A with $03; and 2 more instructions. ; Parameters: Reads $0302 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 $0302 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== UpdateFrameCounter: lda Zp09 ; CPU:$D597 PRG:1597 A5 09 and #$07 ; CPU:$D599 PRG:1599 29 07 bne CheckActorFrameFlags_Loop ; CPU:$D59B PRG:159B D0 54 inc $0302 ; CPU:$D59D PRG:159D EE 02 03 lda $0302 ; CPU:$D5A0 PRG:15A0 AD 02 03 eor #$03 ; CPU:$D5A3 PRG:15A3 49 03 bne UpdateFrameCounter_Loop ; CPU:$D5A5 PRG:15A5 D0 03 sta $0302 ; CPU:$D5A7 PRG:15A7 8D 02 03 ;=============================================================================== ; Routine: UpdateFrameCounter_Loop ; Global: The routine calls ResetScroll, reads $D64D and $D64E. ; Local: Executes 13 instructions: shifts a left; copies A into Y; loads A ; from $D63B,y; stores A to Zp7C; loads A from $D63C,y; stores A to ; Zp7D; and 7 more instructions. ; Parameters: Reads $D64D and $D64E 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 and V flags, the RAM fields it writes. ; ;=============================================================================== UpdateFrameCounter_Loop: asl a ; CPU:$D5AA PRG:15AA 0A tay ; CPU:$D5AB PRG:15AB A8 lda $D63B,y ; CPU:$D5AC PRG:15AC B9 3B D6 sta Zp7C ; CPU:$D5AF PRG:15AF 85 7C lda $D63C,y ; CPU:$D5B1 PRG:15B1 B9 3C D6 sta Zp7D ; CPU:$D5B4 PRG:15B4 85 7D lda $D64D ; CPU:$D5B6 PRG:15B6 AD 4D D6 sta Zp7E ; CPU:$D5B9 PRG:15B9 85 7E lda $D64E ; CPU:$D5BB PRG:15BB AD 4E D6 sta Zp7F ; CPU:$D5BE PRG:15BE 85 7F jsr ResetScroll ; CPU:$D5C0 PRG:15C0 20 57 D6 ldy #$00 ; CPU:$D5C3 PRG:15C3 A0 00 ldx #$0C ; CPU:$D5C5 PRG:15C5 A2 0C ;=============================================================================== ; Routine: UpdateFrameCounter_OnNonzero ; Global: The routine writes the PPUDATA register. ; Local: Executes 7 instructions: loads A from ((Zp7E),y); stores A to the ; PPUDATA register; increments Y; decrements X; branches on not equal ; to UpdateFrameCounter_OnNonzero; loads Y 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: Leaves through one of its branches rather than a return; the caller ; resumes at the branch target. Leaves the PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== UpdateFrameCounter_OnNonzero: lda (Zp7E),y ; CPU:$D5C7 PRG:15C7 B1 7E sta PPUDATA ; CPU:$D5C9 PRG:15C9 8D 07 20 iny ; CPU:$D5CC PRG:15CC C8 dex ; CPU:$D5CD PRG:15CD CA bne UpdateFrameCounter_OnNonzero ; CPU:$D5CE PRG:15CE D0 F7 ldy #$00 ; CPU:$D5D0 PRG:15D0 A0 00 ldx #$04 ; CPU:$D5D2 PRG:15D2 A2 04 ;=============================================================================== ; Routine: UpdateFrameCounter_OnNonzero_2 ; Global: The routine writes the PPUDATA register. ; Local: Executes 6 instructions: loads A from ((Zp7C),y); stores A to the ; PPUDATA register; increments Y; decrements X; branches on not equal ; to UpdateFrameCounter_OnNonzero_2; branches on equal to ResetActorCounter_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== UpdateFrameCounter_OnNonzero_2: lda (Zp7C),y ; CPU:$D5D4 PRG:15D4 B1 7C sta PPUDATA ; CPU:$D5D6 PRG:15D6 8D 07 20 iny ; CPU:$D5D9 PRG:15D9 C8 dex ; CPU:$D5DA PRG:15DA CA bne UpdateFrameCounter_OnNonzero_2 ; CPU:$D5DB PRG:15DB D0 F7 beq ResetActorCounter_Loop ; CPU:$D5DD PRG:15DD F0 45 ;=============================================================================== ; Routine: CheckActorFrameFlags ; Global: The routine reads no RAM 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: tests the bits of Zp03; branches on overflow ; clear to CheckActorFrameFlags_Loop; loads A from ZpCC; branches on equal to ; CheckActorFrameFlags_Loop; compares A with $02; branches on equal to CheckActorFrameFlags_Loop_3; 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. ; ;=============================================================================== CheckActorFrameFlags: bit Zp03 ; CPU:$D5DF PRG:15DF 24 03 bvc CheckActorFrameFlags_Loop ; CPU:$D5E1 PRG:15E1 50 0E lda ZpCC ; CPU:$D5E3 PRG:15E3 A5 CC beq CheckActorFrameFlags_Loop ; CPU:$D5E5 PRG:15E5 F0 0A cmp #$02 ; CPU:$D5E7 PRG:15E7 C9 02 beq CheckActorFrameFlags_Loop_3; CPU:$D5E9 PRG:15E9 F0 11 lda Zp09 ; CPU:$D5EB PRG:15EB A5 09 and #$03 ; CPU:$D5ED PRG:15ED 29 03 beq CheckActorFrameFlags_Loop_2; CPU:$D5EF PRG:15EF F0 01 ;=============================================================================== ; Routine: CheckActorFrameFlags_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: 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. ; ;=============================================================================== CheckActorFrameFlags_Loop: rts ; CPU:$D5F1 PRG:15F1 60 ;=============================================================================== ; Routine: CheckActorFrameFlags_Loop_2 ; Global: The routine reads no RAM 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 $04; loads Y with $00; loads A ; from Zp09; ANDs A with $04; branches on not equal to CheckActorFrameFlags_Loop_4. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== CheckActorFrameFlags_Loop_2: ldx #$04 ; CPU:$D5F2 PRG:15F2 A2 04 ldy #$00 ; CPU:$D5F4 PRG:15F4 A0 00 lda Zp09 ; CPU:$D5F6 PRG:15F6 A5 09 and #$04 ; CPU:$D5F8 PRG:15F8 29 04 bne CheckActorFrameFlags_Loop_4; CPU:$D5FA PRG:15FA D0 02 ;=============================================================================== ; Routine: CheckActorFrameFlags_Loop_3 ; Global: The routine reads no RAM 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 and C flags, the RAM fields it writes. ; ;=============================================================================== CheckActorFrameFlags_Loop_3: ldx #$10 ; CPU:$D5FC PRG:15FC A2 10 ;=============================================================================== ; Routine: CheckActorFrameFlags_Loop_4 ; Global: The routine calls LoadSoundPointer and ResetScroll, reads $D64F and $D650. ; Local: Executes 10 instructions: loads A from $D64F; stores A to Zp7C; loads ; A from $D650; stores A to Zp7D; stores X to Zp77; stores Y to Zp78; ; and 4 more instructions. ; Parameters: Reads $D64F and $D650 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 and C flags, the RAM fields it writes. ; ;=============================================================================== CheckActorFrameFlags_Loop_4: lda $D64F ; CPU:$D5FE PRG:15FE AD 4F D6 sta Zp7C ; CPU:$D601 PRG:1601 85 7C lda $D650 ; CPU:$D603 PRG:1603 AD 50 D6 sta Zp7D ; CPU:$D606 PRG:1606 85 7D stx Zp77 ; CPU:$D608 PRG:1608 86 77 sty Zp78 ; CPU:$D60A PRG:160A 84 78 jsr LoadSoundPointer ; CPU:$D60C PRG:160C 20 65 D6 jsr ResetScroll ; CPU:$D60F PRG:160F 20 57 D6 ldx #$10 ; CPU:$D612 PRG:1612 A2 10 ldy #$00 ; CPU:$D614 PRG:1614 A0 00 ;=============================================================================== ; Routine: CheckActorFrameFlags_OnNonzero ; Global: The routine writes the PPUDATA register. ; Local: Executes 6 instructions: loads A from ((Zp7E),y); stores A to the ; PPUDATA register; increments Y; decrements X; compares X with Zp77; ; branches on equal to ResetActorCounter_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z and C flags, ZpFA, PPUADDR, PPUDATA. ; ;=============================================================================== CheckActorFrameFlags_OnNonzero: lda (Zp7E),y ; CPU:$D616 PRG:1616 B1 7E sta PPUDATA ; CPU:$D618 PRG:1618 8D 07 20 iny ; CPU:$D61B PRG:161B C8 dex ; CPU:$D61C PRG:161C CA cpx Zp77 ; CPU:$D61D PRG:161D E4 77 beq ResetActorCounter_Loop_2 ; CPU:$D61F PRG:161F F0 06 ;=============================================================================== ; Routine: ResetActorCounter ; Global: The routine writes the PPUDATA register. ; Local: Executes 8 instructions: loads A from ((Zp7E),y); stores A to the ; PPUDATA register; increments Y; decrements X; compares X with Zp77; ; branches on equal to ResetActorCounter_Loop_2; 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z and C flags, ZpFA, PPUADDR, PPUDATA. ; ;=============================================================================== ResetActorCounter: txa ; CPU:$D621 PRG:1621 8A bne CheckActorFrameFlags_OnNonzero ; CPU:$D622 PRG:1622 D0 F2 ;=============================================================================== ; Routine: ResetActorCounter_Loop ; Global: The routine calls ResetScrollPosition. ; Local: Executes 1 instruction: calls ResetScrollPosition. ; 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, PPUADDR. ; ;=============================================================================== ResetActorCounter_Loop: jmp ResetScrollPosition ; CPU:$D624 PRG:1624 4C 11 CA ;=============================================================================== ; Routine: ResetActorCounter_Loop_2 ; Global: The routine reads no RAM 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 ZpFA; 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, ZpFA, PPUADDR, PPUDATA. ; ;=============================================================================== ResetActorCounter_Loop_2: sty ZpFA ; CPU:$D627 PRG:1627 84 FA ldy #$00 ; CPU:$D629 PRG:1629 A0 00 ;=============================================================================== ; Routine: ResetActorCounter_OnNonzero ; Global: The routine calls ResetActorCounter, writes the PPUDATA register. ; Local: Executes 8 instructions: loads A from ((Zp7C),y); stores A to the ; PPUDATA register; increments Y; decrements X; compares X with Zp78; ; branches on not equal to ResetActorCounter_OnNonzero; 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 PPUDATA register set. ; Clobbers: ; A, X and Y, the N, Z and C flags, ZpFA, PPUADDR, PPUDATA. ; ;=============================================================================== ResetActorCounter_OnNonzero: lda (Zp7C),y ; CPU:$D62B PRG:162B B1 7C sta PPUDATA ; CPU:$D62D PRG:162D 8D 07 20 iny ; CPU:$D630 PRG:1630 C8 dex ; CPU:$D631 PRG:1631 CA cpx Zp78 ; CPU:$D632 PRG:1632 E4 78 bne ResetActorCounter_OnNonzero; CPU:$D634 PRG:1634 D0 F5 ldy ZpFA ; CPU:$D636 PRG:1636 A4 FA jmp ResetActorCounter ; CPU:$D638 PRG:1638 4C 21 D6 ; ---- data $D63B-$D656 (28 bytes) ---- ; referenced by `lda $D63B,y` at $D5AC (operand $D63B falls inside this region) ; referenced by `lda $D63C,y` at $D5B1 (operand $D63C falls inside this region) ; referenced by `lda $D64D` at $D5B6 (operand $D64D falls inside this region) ; referenced by `lda $D64E` at $D5BB (operand $D64E falls inside this region) ; referenced by `lda $D64F` at $D5FE (operand $D64F falls inside this region) ; referenced by `lda $D650` at $D603 (operand $D650 falls inside this region) ; ... and 2 further references from decoded code ObjectDefinitionPointerTable: .byte $41, $D6, $45, $D6, $49, $D6, $0F, $16, $2C, $28, $0F, $2C, $28, $16, $0F, $28 ; CPU:$D63B PRG:163B 41 D6 45 D6 49 D6 0F 16 2C 28 0F 2C 28 16 0F 28 .byte $16, $2C, $08, $CD, $51, $D6, $0F, $14, $30, $29, $E8, $CC ; CPU:$D64B PRG:164B 16 2C 08 CD 51 D6 0F 14 30 29 E8 CC ;=============================================================================== ; Routine: ResetScroll ; Global: The routine writes the PPUADDR registers, reads the PPUSTATUS ; register. ; Local: Executes 6 instructions: loads A from the PPUSTATUS register; loads A ; with $3F; stores A to the PPUADDR register; loads A with $00; ; stores A to the PPUADDR 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 PPUADDR registers set. ; Clobbers: ; A, the N and Z flags, PPUADDR. ; ;=============================================================================== ResetScroll: lda PPUSTATUS ; CPU:$D657 PRG:1657 AD 02 20 lda #$3F ; CPU:$D65A PRG:165A A9 3F sta PPUADDR ; CPU:$D65C PRG:165C 8D 06 20 lda #$00 ; CPU:$D65F PRG:165F A9 00 sta PPUADDR ; CPU:$D661 PRG:1661 8D 06 20 rts ; CPU:$D664 PRG:1664 60 ;=============================================================================== ; Routine: LoadSoundPointer ; Global: The routine reads $D655 and $D656. ; Local: Executes 5 instructions: loads A from $D655; stores A to Zp7E; loads ; A from $D656; stores A to Zp7F; returns with RTS. ; Parameters: Reads $D655 and $D656 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, Zp7E, Zp7F. ; ;=============================================================================== LoadSoundPointer: lda $D655 ; CPU:$D665 PRG:1665 AD 55 D6 sta Zp7E ; CPU:$D668 PRG:1668 85 7E lda $D656 ; CPU:$D66A PRG:166A AD 56 D6 sta Zp7F ; CPU:$D66D PRG:166D 85 7F rts ; CPU:$D66F PRG:166F 60 ; ---- data $D670-$D713 (164 bytes) ---- ScreenLayoutScript: .byte $E7, $20, $00, $90, $A0, $80, $90, $A0, $80, $90, $A0, $80, $90, $A0, $80, $90 ; CPU:$D670 PRG:1670 E7 20 00 90 A0 80 90 A0 80 90 A0 80 90 A0 80 90 .byte $A0, $80, $90, $00, $FE, $07, $21, $A0, $FE, $18, $21, $80, $FE, $27, $21, $90 ; CPU:$D680 PRG:1680 A0 80 90 00 FE 07 21 A0 FE 18 21 80 FE 27 21 90 .byte $00, $00, $00, $B0, $B1, $B2, $B3, $B4, $B5, $B6, $B7, $FE, $38, $21, $90, $FE ; CPU:$D690 PRG:1690 00 00 00 B0 B1 B2 B3 B4 B5 B6 B7 FE 38 21 90 FE .byte $47, $21, $80, $00, $00, $00, $C0, $C1, $C2, $C3, $C4, $C5, $C6, $C7, $FE, $58 ; CPU:$D6A0 PRG:16A0 47 21 80 00 00 00 C0 C1 C2 C3 C4 C5 C6 C7 FE 58 .byte $21, $A0, $FE, $67, $21, $A0, $00, $00, $00, $00, $B0, $B1, $B8, $B9, $DE, $DF ; CPU:$D6B0 PRG:16B0 21 A0 FE 67 21 A0 00 00 00 00 B0 B1 B8 B9 DE DF .byte $BC, $D0, $D1, $00, $00, $00, $80, $FE, $87, $21, $90, $00, $00, $00, $00, $C0 ; CPU:$D6C0 PRG:16C0 BC D0 D1 00 00 00 80 FE 87 21 90 00 00 00 00 C0 .byte $C1, $C8, $C9, $EE, $EF, $CC, $E0, $E1, $00, $00, $00, $90, $FE, $A7, $21, $80 ; CPU:$D6D0 PRG:16D0 C1 C8 C9 EE EF CC E0 E1 00 00 00 90 FE A7 21 80 .byte $FE, $B8, $21, $A0, $FE, $C7, $21, $00, $90, $80, $A0, $90, $80, $A0, $90, $80 ; CPU:$D6E0 PRG:16E0 FE B8 21 A0 FE C7 21 00 90 80 A0 90 80 A0 90 80 .byte $A0, $90, $80, $A0, $90, $80, $A0, $90, $00, $FF, $C8, $23, $00, $C0, $FD, $04 ; CPU:$D6F0 PRG:16F0 A0 90 80 A0 90 80 A0 90 00 FF C8 23 00 C0 FD 04 .byte $F0, $30, $00, $00, $CC, $FD, $04, $00, $33, $00, $00, $CC, $FD, $04, $F0, $33 ; CPU:$D700 PRG:1700 F0 30 00 00 CC FD 04 00 33 00 00 CC FD 04 F0 33 .byte $FD, $19, $00, $FF ; CPU:$D710 PRG:1710 FD 19 00 FF ;=============================================================================== ; Routine: SetPpuCtrlPatternBit ; Global: The routine calls RunScreenScript, SetPpuCtrlBit2 and ClearPpuCtrlBit2. ; Local: Executes 6 instructions: loads A with $0C; calls RunScreenScript; calls ; SetPpuCtrlBit2; loads A with $0D; calls RunScreenScript; calls ClearPpuCtrlBit2. ; 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. ; ;=============================================================================== SetPpuCtrlPatternBit: lda #$0C ; CPU:$D714 PRG:1714 A9 0C jsr RunScreenScript ; CPU:$D716 PRG:1716 20 E3 C4 jsr SetPpuCtrlBit2 ; CPU:$D719 PRG:1719 20 4B CA lda #$0D ; CPU:$D71C PRG:171C A9 0D jsr RunScreenScript ; CPU:$D71E PRG:171E 20 E3 C4 jmp ClearPpuCtrlBit2 ; CPU:$D721 PRG:1721 4C 55 CA ; ---- data $D724-$D76C (73 bytes) ---- RoundSetupScript: .byte $42, $20, $FD, $1C, $24, $FE, $A2, $20, $FD, $1C, $29, $FF, $41, $20, $23, $26 ; CPU:$D724 PRG:1724 42 20 FD 1C 24 FE A2 20 FD 1C 29 FF 41 20 23 26 .byte $26, $28, $FE, $5E, $20, $25, $27, $27, $2A, $FF, $A2, $00, $8E, $B2, $03, $8E ; CPU:$D734 PRG:1734 26 28 FE 5E 20 25 27 27 2A FF A2 00 8E B2 03 8E .byte $41, $03, $8E, $42, $03, $8E, $43, $03, $8E, $B1, $03, $86, $6D, $86, $6A, $86 ; CPU:$D744 PRG:1744 41 03 8E 42 03 8E 43 03 8E B1 03 86 6D 86 6A 86 .byte $6B, $86, $66, $A2, $02, $AD, $B0, $03, $4A, $90, $02, $A2, $04, $86, $63, $A9 ; CPU:$D754 PRG:1754 6B 86 66 A2 02 AD B0 03 4A 90 02 A2 04 86 63 A9 .byte $00, $85, $61, $EE, $B0, $03, $4C, $35, $C8 ; CPU:$D764 PRG:1764 00 85 61 EE B0 03 4C 35 C8 ;=============================================================================== ; Routine: SelectActorSpriteCount ; Global: The routine reads no RAM 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 $06; loads A from Zp63; ; compares A with $04; branches on equal to SelectActorSpriteCount_Loop; 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, I and V flags, the OAM shadow and the RAM ; fields it writes. ; ;=============================================================================== SelectActorSpriteCount: ldx #$06 ; CPU:$D76D PRG:176D A2 06 lda Zp63 ; CPU:$D76F PRG:176F A5 63 cmp #$04 ; CPU:$D771 PRG:1771 C9 04 beq SelectActorSpriteCount_Loop; CPU:$D773 PRG:1773 F0 02 ldx #$03 ; CPU:$D775 PRG:1775 A2 03 ;=============================================================================== ; Routine: SelectActorSpriteCount_Loop ; Global: The routine reads $03B1 and $03B2. ; Local: Executes 10 instructions: compares X with Zp6B; branches on equal to ; SelectActorSpriteCount_Loop_5; loads A with $00; loads Y from $03B1; branches on not ; equal to SelectActorSpriteCount_Loop_4; loads Y from $03B2; and 4 more instructions. ; Parameters: Reads $03B1 and $03B2 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. ; ;=============================================================================== SelectActorSpriteCount_Loop: cpx Zp6B ; CPU:$D777 PRG:1777 E4 6B beq SelectActorSpriteCount_Loop_5 ; CPU:$D779 PRG:1779 F0 46 lda #$00 ; CPU:$D77B PRG:177B A9 00 ldy $03B1 ; CPU:$D77D PRG:177D AC B1 03 bne SelectActorSpriteCount_Loop_4 ; CPU:$D780 PRG:1780 D0 32 ldy $03B2 ; CPU:$D782 PRG:1782 AC B2 03 lda $D7C5,y ; CPU:$D785 PRG:1785 B9 C5 D7 cpx #$06 ; CPU:$D788 PRG:1788 E0 06 beq SelectActorSpriteCount_Loop_2 ; CPU:$D78A PRG:178A F0 03 lda $D7E7,y ; CPU:$D78C PRG:178C B9 E7 D7 ;=============================================================================== ; Routine: SelectActorSpriteCount_Loop_2 ; Global: The routine writes $03B3 and $03B4. ; Local: Executes 7 instructions: stores A to $03B3; stores A to $03B4; ; increments Y; loads A from $D7C5,y; compares X with $06; branches ; on equal to SelectActorSpriteCount_Loop_3; 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 $03B3 and $03B4 changed. ; Clobbers: ; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM ; fields it writes. ; ;=============================================================================== SelectActorSpriteCount_Loop_2: sta $03B3 ; CPU:$D78F PRG:178F 8D B3 03 sta $03B4 ; CPU:$D792 PRG:1792 8D B4 03 iny ; CPU:$D795 PRG:1795 C8 lda $D7C5,y ; CPU:$D796 PRG:1796 B9 C5 D7 cpx #$06 ; CPU:$D799 PRG:1799 E0 06 beq SelectActorSpriteCount_Loop_3 ; CPU:$D79B PRG:179B F0 03 lda $D7E7,y ; CPU:$D79D PRG:179D B9 E7 D7 ;=============================================================================== ; Routine: SelectActorSpriteCount_Loop_3 ; Global: The routine writes $03B1 and $03B2, reads $03B4. ; Local: Executes 9 instructions: stores A to $03B1; increments Y; stores Y to ; $03B2; loads A from Zp05; ANDs A with $30; stores A to Zp77; and 3 ; more instructions. ; Parameters: Reads $03B4 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. Leaves $03B1 and $03B2 changed. ; Clobbers: ; A, X and Y, the N, Z, C, I and V flags, the OAM shadow and the RAM ; fields it writes. ; ;=============================================================================== SelectActorSpriteCount_Loop_3: sta $03B1 ; CPU:$D7A0 PRG:17A0 8D B1 03 iny ; CPU:$D7A3 PRG:17A3 C8 sty $03B2 ; CPU:$D7A4 PRG:17A4 8C B2 03 lda Zp05 ; CPU:$D7A7 PRG:17A7 A5 05 and #$30 ; CPU:$D7A9 PRG:17A9 29 30 sta Zp77 ; CPU:$D7AB PRG:17AB 85 77 lda $03B4 ; CPU:$D7AD PRG:17AD AD B4 03 and #$CF ; CPU:$D7B0 PRG:17B0 29 CF ora Zp77 ; CPU:$D7B2 PRG:17B2 05 77 ;=============================================================================== ; Routine: SelectActorSpriteCount_Loop_4 ; Global: The routine calls UpdateActorBehaviour, reads $03B3 and $03B1. ; Local: Executes 5 instructions: stores A to Zp0D; loads A from $03B3; stores ; A to Zp0C; decrements $03B1; calls UpdateActorBehaviour. ; Parameters: Reads $03B3 and $03B1 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. ; ;=============================================================================== SelectActorSpriteCount_Loop_4: sta Zp0D ; CPU:$D7B4 PRG:17B4 85 0D lda $03B3 ; CPU:$D7B6 PRG:17B6 AD B3 03 sta Zp0C ; CPU:$D7B9 PRG:17B9 85 0C dec $03B1 ; CPU:$D7BB PRG:17BB CE B1 03 jmp UpdateActorBehaviour ; CPU:$D7BE PRG:17BE 4C 22 C8 ;=============================================================================== ; Routine: SelectActorSpriteCount_Loop_5 ; Global: The routine reads no RAM 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: increments Zp0A; 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: ; no register, the N and Z flags, Zp0A. ; ;=============================================================================== SelectActorSpriteCount_Loop_5: inc Zp0A ; CPU:$D7C1 PRG:17C1 E6 0A clc ; CPU:$D7C3 PRG:17C3 18 rts ; CPU:$D7C4 PRG:17C4 60 ; ---- data $D7C5-$D806 (66 bytes) ---- ; referenced by `lda $D7C5,y` at $D785 (operand $D7C5 falls inside this region) ; referenced by `lda $D7E7,y` at $D78C (operand $D7E7 falls inside this region) ; referenced by `lda $D7C5,y` at $D796 (operand $D7C5 falls inside this region) ; referenced by `lda $D7E7,y` at $D79D (operand $D7E7 falls inside this region) RingMovementParameterTable: .byte $00, $7A, $80, $0E, $00, $62, $02, $26, $82, $22, $00, $56, $02, $40, $82, $18 ; CPU:$D7C5 PRG:17C5 00 7A 80 0E 00 62 02 26 82 22 00 56 02 40 82 18 .byte $02, $9A, $00, $28, $80, $08, $00, $28, $00, $14, $00, $04, $02, $82, $82, $16 ; CPU:$D7D5 PRG:17D5 02 9A 00 28 80 08 00 28 00 14 00 04 02 82 82 16 .byte $00, $B4, $01, $90, $81, $10, $01, $50, $81, $10, $01, $80, $81, $10, $01, $60 ; CPU:$D7E5 PRG:17E5 00 B4 01 90 81 10 01 50 81 10 01 80 81 10 01 60 .byte $81, $10, $01, $80, $00, $20, $81, $10, $01, $60, $81, $10, $01, $88, $81, $10 ; CPU:$D7F5 PRG:17F5 81 10 01 80 00 20 81 10 01 60 81 10 01 88 81 10 .byte $01, $40 ; CPU:$D805 PRG:1805 01 40 ;=============================================================================== ; Routine: DispatchActorHandler ; Global: The routine calls DispatchHandlerPointerTable. ; Local: Executes 2 instructions: loads A from Zp64; calls DispatchHandlerPointerTable. ; 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, ZpE0, ZpE1. ; ;=============================================================================== DispatchActorHandler: lda Zp64 ; CPU:$D807 PRG:1807 A5 64 jsr DispatchHandlerPointerTable; CPU:$D809 PRG:1809 20 CD C4 ; ---- data $D80C-$D80D (2 bytes) ---- ActorActionHandlerPointerTable: .byte $14, $D8 ; CPU:$D80C PRG:180C 14 D8 sta $51D8 ; CPU:$D80E PRG:180E 8D D8 51 cmp $D95F,y ; CPU:$D811 PRG:1811 D9 5F D9 ;=============================================================================== ; Routine: CheckActorScreenScript ; Global: The routine calls CheckActorScrollRange and SelectActorScriptEntry. ; Local: Executes 5 instructions: calls CheckActorScrollRange; branches on carry set to ; CheckActorScreenScript_Loop; loads A with $30; stores A to Zp77; calls SelectActorScriptEntry. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== CheckActorScreenScript: jsr CheckActorScrollRange ; CPU:$D814 PRG:1814 20 05 DA bcs CheckActorScreenScript_Loop; CPU:$D817 PRG:1817 B0 07 lda #$30 ; CPU:$D819 PRG:1819 A9 30 sta Zp77 ; CPU:$D81B PRG:181B 85 77 jmp SelectActorScriptEntry ; CPU:$D81D PRG:181D 4C E4 D8 ;=============================================================================== ; Routine: CheckActorScreenScript_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 8 instructions: loads X from ZpDF; branches on equal to ; CheckActorScreenScript_Loop_2; loads X from ZpDE; decrements X; branches on equal to ; CheckActorScreenScript_Loop_3; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== CheckActorScreenScript_Loop: ldx ZpDF ; CPU:$D820 PRG:1820 A6 DF beq CheckActorScreenScript_Loop_2 ; CPU:$D822 PRG:1822 F0 0A ldx ZpDE ; CPU:$D824 PRG:1824 A6 DE dex ; CPU:$D826 PRG:1826 CA beq CheckActorScreenScript_Loop_3 ; CPU:$D827 PRG:1827 F0 16 dex ; CPU:$D829 PRG:1829 CA beq CheckActorScreenScript_Loop_6 ; CPU:$D82A PRG:182A F0 34 bne CheckActorScreenScript_OnNegative ; CPU:$D82C PRG:182C D0 0B ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_2 ; Global: The routine reads no RAM 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 Zp0C; ANDs A with $03; copies A ; into X; decrements X; branches on equal to CheckActorScreenScript_Loop_3; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== CheckActorScreenScript_Loop_2: lda Zp0C ; CPU:$D82E PRG:182E A5 0C and #$03 ; CPU:$D830 PRG:1830 29 03 tax ; CPU:$D832 PRG:1832 AA dex ; CPU:$D833 PRG:1833 CA beq CheckActorScreenScript_Loop_3 ; CPU:$D834 PRG:1834 F0 09 dex ; CPU:$D836 PRG:1836 CA beq CheckActorScreenScript_Loop_6 ; CPU:$D837 PRG:1837 F0 27 ;=============================================================================== ; Routine: CheckActorScreenScript_OnNegative ; Global: The routine reads no RAM 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 ZpCE; branches ; on equal to CheckActorScreenScript_Loop_10. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== CheckActorScreenScript_OnNegative: lda #$00 ; CPU:$D839 PRG:1839 A9 00 sta ZpCE ; CPU:$D83B PRG:183B 85 CE beq CheckActorScreenScript_Loop_10 ; CPU:$D83D PRG:183D F0 46 ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_3 ; Global: The routine calls SetActorAttributeC0. ; Local: Executes 8 instructions: loads A with $00; stores A to ZpCE; branches ; on equal to CheckActorScreenScript_Loop_10; loads A from Zp63; compares A with $02; ; branches on not equal to CheckActorScreenScript_Loop_4; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== CheckActorScreenScript_Loop_3: lda Zp63 ; CPU:$D83F PRG:183F A5 63 cmp #$02 ; CPU:$D841 PRG:1841 C9 02 bne CheckActorScreenScript_Loop_4 ; CPU:$D843 PRG:1843 D0 05 jsr SetActorAttributeC0 ; CPU:$D845 PRG:1845 20 F7 D9 bcc CheckActorScreenScript_Loop_11 ; CPU:$D848 PRG:1848 90 3F ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_4 ; Global: The routine calls SetActorAttributeC0 and AddToActorCoordinate, reads $0405. ; Local: Executes 14 instructions: loads A with $00; stores A to ZpCE; ; branches on equal to CheckActorScreenScript_Loop_10; loads A from Zp63; compares A with ; $02; branches on not equal to CheckActorScreenScript_Loop_4; and 8 more instructions. ; Parameters: Reads $0405 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, the RAM fields it writes. ; ;=============================================================================== CheckActorScreenScript_Loop_4: lda #$01 ; CPU:$D84A PRG:184A A9 01 sta Zp56 ; CPU:$D84C PRG:184C 85 56 jsr AddToActorCoordinate ; CPU:$D84E PRG:184E 20 EE F7 ldx $0405 ; CPU:$D851 PRG:1851 AE 05 04 beq CheckActorScreenScript_Loop_5 ; CPU:$D854 PRG:1854 F0 02 dec Zp74,x ; CPU:$D856 PRG:1856 D6 74 ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_5 ; Global: The routine calls SetActorAttributeC0 and AddToActorCoordinate, reads $0405. ; Local: Executes 18 instructions: loads A with $00; stores A to ZpCE; ; branches on equal to CheckActorScreenScript_Loop_10; loads A from Zp63; compares A with ; $02; branches on not equal to CheckActorScreenScript_Loop_4; and 12 more instructions. ; Parameters: Reads $0405 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, the RAM fields it writes. ; ;=============================================================================== CheckActorScreenScript_Loop_5: lda #$FF ; CPU:$D858 PRG:1858 A9 FF sta ZpCE ; CPU:$D85A PRG:185A 85 CE lda #$01 ; CPU:$D85C PRG:185C A9 01 bne CheckActorScreenScript_Loop_10 ; CPU:$D85E PRG:185E D0 25 ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_6 ; Global: The routine calls SetActorAttributeC0 and AddToActorCoordinate, reads $0405. ; Local: Executes 23 instructions: loads A with $00; stores A to ZpCE; ; branches on equal to CheckActorScreenScript_Loop_10; loads A from Zp63; compares A with ; $02; branches on not equal to CheckActorScreenScript_Loop_4; and 17 more instructions. ; Parameters: Reads $0405 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, the RAM fields it writes. ; ;=============================================================================== CheckActorScreenScript_Loop_6: lda Zp63 ; CPU:$D860 PRG:1860 A5 63 cmp #$02 ; CPU:$D862 PRG:1862 C9 02 beq CheckActorScreenScript_Loop_7 ; CPU:$D864 PRG:1864 F0 04 cmp #$03 ; CPU:$D866 PRG:1866 C9 03 bne CheckActorScreenScript_Loop_8 ; CPU:$D868 PRG:1868 D0 05 ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_7 ; Global: The routine calls SetActorAttributeC0, AddToActorCoordinate and SetActorAttribute80, reads $0405. ; Local: Executes 25 instructions: loads A with $00; stores A to ZpCE; ; branches on equal to CheckActorScreenScript_Loop_10; loads A from Zp63; compares A with ; $02; branches on not equal to CheckActorScreenScript_Loop_4; and 19 more instructions. ; Parameters: Reads $0405 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, the RAM fields it writes. ; ;=============================================================================== CheckActorScreenScript_Loop_7: jsr SetActorAttribute80 ; CPU:$D86A PRG:186A 20 FB D9 bcc CheckActorScreenScript_Loop_11 ; CPU:$D86D PRG:186D 90 1A ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_8 ; Global: The routine calls SetActorAttributeC0, AddToActorCoordinate, SetActorAttribute80 and SubtractFromActorCoordinate, reads ; $0405. ; Local: Executes 32 instructions: loads A with $00; stores A to ZpCE; ; branches on equal to CheckActorScreenScript_Loop_10; loads A from Zp63; compares A with ; $02; branches on not equal to CheckActorScreenScript_Loop_4; and 26 more instructions. ; Parameters: Reads $0405 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, the RAM fields it writes. ; ;=============================================================================== CheckActorScreenScript_Loop_8: lda #$01 ; CPU:$D86F PRG:186F A9 01 sta Zp56 ; CPU:$D871 PRG:1871 85 56 jsr SubtractFromActorCoordinate; CPU:$D873 PRG:1873 20 FC F7 bmi CheckActorScreenScript_OnNegative ; CPU:$D876 PRG:1876 30 C1 ldx $0405 ; CPU:$D878 PRG:1878 AE 05 04 beq CheckActorScreenScript_Loop_9 ; CPU:$D87B PRG:187B F0 02 inc Zp74,x ; CPU:$D87D PRG:187D F6 74 ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_9 ; Global: The routine reads no RAM 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 ZpCE; 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, ZpC9, ZpCA, ZpCE. ; ;=============================================================================== CheckActorScreenScript_Loop_9: lda #$FF ; CPU:$D87F PRG:187F A9 FF sta ZpCE ; CPU:$D881 PRG:1881 85 CE lda #$02 ; CPU:$D883 PRG:1883 A9 02 ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_10 ; Global: The routine reads no RAM 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 ZpCA; stores A to ZpC9. ; 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, ZpC9, ZpCA. ; ;=============================================================================== CheckActorScreenScript_Loop_10: sta ZpCA ; CPU:$D885 PRG:1885 85 CA sta ZpC9 ; CPU:$D887 PRG:1887 85 C9 ;=============================================================================== ; Routine: CheckActorScreenScript_Loop_11 ; Global: The routine reads no RAM 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. ; ;=============================================================================== CheckActorScreenScript_Loop_11: rts ; CPU:$D889 PRG:1889 60 ; ---- data $D88A-$D8DC (83 bytes) ---- .byte $4C, $24, $D8, $20, $05, $DA, $90, $4E, $A5, $74, $C9, $40, $90, $1F, $A5, $DF ; CPU:$D88A PRG:188A 4C 24 D8 20 05 DA 90 4E A5 74 C9 40 90 1F A5 DF .byte $D0, $EE, $A5, $0C, $29, $02, $F0, $8C, $A6, $74, $E0, $10, $90, $B8, $A5, $09 ; CPU:$D89A PRG:189A D0 EE A5 0C 29 02 F0 8C A6 74 E0 10 90 B8 A5 09 .byte $4A, $90, $02, $C6, $74, $A9, $02, $85, $CA, $A9, $00, $F0, $D0, $A5, $DF, $D0 ; CPU:$D8AA PRG:18AA 4A 90 02 C6 74 A9 02 85 CA A9 00 F0 D0 A5 DF D0 .byte $CF, $A5, $0C, $29, $02, $D0, $E1, $A5, $0C, $29, $01, $D0, $03, $4C, $4E, $D9 ; CPU:$D8BA PRG:18BA CF A5 0C 29 02 D0 E1 A5 0C 29 01 D0 03 4C 4E D9 .byte $A6, $74, $E0, $40, $B0, $0D, $A5, $09, $4A, $90, $02, $E6, $74, $A9, $01, $85 ; CPU:$D8CA PRG:18CA A6 74 E0 40 B0 0D A5 09 4A 90 02 E6 74 A9 01 85 .byte $CA, $D0, $D6 ; CPU:$D8DA PRG:18DA CA D0 D6 ;=============================================================================== ; Routine: CheckActorScreenScript_OnCarrySet ; Global: The routine calls CheckActorScreenScript_Loop_5. ; Local: Executes 1 instruction: calls CheckActorScreenScript_Loop_5. ; 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. ; ;=============================================================================== CheckActorScreenScript_OnCarrySet: jmp CheckActorScreenScript_Loop_5 ; CPU:$D8DD PRG:18DD 4C 58 D8 ; ---- data $D8E0-$D8E3 (4 bytes) ---- .byte $A9, $10, $85, $77 ; CPU:$D8E0 PRG:18E0 A9 10 85 77 ;=============================================================================== ; Routine: SelectActorScriptEntry ; Global: The routine calls CheckActorScreenScript_Loop_5. ; Local: Executes 9 instructions: calls CheckActorScreenScript_Loop_5; loads A from ZpDF; branches ; on equal to SelectActorScriptEntry_Loop; loads X from ZpDE; decrements X; branches on ; equal to SelectActorScriptEntry_Loop_7; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorScriptEntry: lda ZpDF ; CPU:$D8E4 PRG:18E4 A5 DF beq SelectActorScriptEntry_Loop; CPU:$D8E6 PRG:18E6 F0 0A ldx ZpDE ; CPU:$D8E8 PRG:18E8 A6 DE dex ; CPU:$D8EA PRG:18EA CA beq SelectActorScriptEntry_Loop_7 ; CPU:$D8EB PRG:18EB F0 37 dex ; CPU:$D8ED PRG:18ED CA beq SelectActorScriptEntry_Loop_2 ; CPU:$D8EE PRG:18EE F0 0F bne SelectActorScriptEntry_Loop_12 ; CPU:$D8F0 PRG:18F0 D0 5C ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop ; Global: The routine calls CheckActorScreenScript_Loop_5. ; Local: Executes 9 instructions: calls CheckActorScreenScript_Loop_5; loads A from Zp0C; ANDs A ; with $03; copies A into X; decrements X; branches on equal to ; SelectActorScriptEntry_Loop_7; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorScriptEntry_Loop: lda Zp0C ; CPU:$D8F2 PRG:18F2 A5 0C and #$03 ; CPU:$D8F4 PRG:18F4 29 03 tax ; CPU:$D8F6 PRG:18F6 AA dex ; CPU:$D8F7 PRG:18F7 CA beq SelectActorScriptEntry_Loop_7 ; CPU:$D8F8 PRG:18F8 F0 2A dex ; CPU:$D8FA PRG:18FA CA beq SelectActorScriptEntry_Loop_2 ; CPU:$D8FB PRG:18FB F0 02 bne SelectActorScriptEntry_Loop_12 ; CPU:$D8FD PRG:18FD D0 4F ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_2 ; Global: The routine calls CheckActorScreenScript_Loop_5 and CheckActorScreenScript_Loop_6. ; Local: Executes 5 instructions: calls CheckActorScreenScript_Loop_5; loads X from Zp74; compares ; X with Zp77; branches on carry set to SelectActorScriptEntry_Loop_3; calls CheckActorScreenScript_Loop_6. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorScriptEntry_Loop_2: ldx Zp74 ; CPU:$D8FF PRG:18FF A6 74 cpx Zp77 ; CPU:$D901 PRG:1901 E4 77 bcs SelectActorScriptEntry_Loop_3 ; CPU:$D903 PRG:1903 B0 03 jmp CheckActorScreenScript_Loop_6 ; CPU:$D905 PRG:1905 4C 60 D8 ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_3 ; Global: The routine calls CheckActorScreenScript_Loop_5, GetActorTypeIndex and SetActorAttribute80. ; Local: Executes 5 instructions: calls CheckActorScreenScript_Loop_5; calls GetActorTypeIndex; branches on ; equal to SelectActorScriptEntry_Loop_4; calls SetActorAttribute80; branches on carry clear to ; SelectActorScriptEntry_Loop_6. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorScriptEntry_Loop_3: jsr GetActorTypeIndex ; CPU:$D908 PRG:1908 20 2D CD beq SelectActorScriptEntry_Loop_4 ; CPU:$D90B PRG:190B F0 05 jsr SetActorAttribute80 ; CPU:$D90D PRG:190D 20 FB D9 bcc SelectActorScriptEntry_Loop_6 ; CPU:$D910 PRG:1910 90 0E ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_4 ; Global: The routine calls CheckActorScreenScript_Loop_5. ; Local: Executes 5 instructions: calls CheckActorScreenScript_Loop_5; decrements Zp74; compares X ; with $03; branches on not equal to SelectActorScriptEntry_Loop_5; decrements ZpBF. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorScriptEntry_Loop_4: dec Zp74 ; CPU:$D912 PRG:1912 C6 74 cpx #$03 ; CPU:$D914 PRG:1914 E0 03 bne SelectActorScriptEntry_Loop_5 ; CPU:$D916 PRG:1916 D0 02 dec ZpBF ; CPU:$D918 PRG:1918 C6 BF ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_5 ; Global: The routine calls CheckActorScreenScript_Loop_5. ; Local: Executes 4 instructions: calls CheckActorScreenScript_Loop_5; compares X with $01; ; branches on not equal to SelectActorScriptEntry_Loop_6; decrements Zp84. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorScriptEntry_Loop_5: cpx #$01 ; CPU:$D91A PRG:191A E0 01 bne SelectActorScriptEntry_Loop_6 ; CPU:$D91C PRG:191C D0 02 dec Zp84 ; CPU:$D91E PRG:191E C6 84 ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_6 ; Global: The routine calls CheckActorScreenScript_Loop_5. ; Local: Executes 3 instructions: calls CheckActorScreenScript_Loop_5; loads A with $02; branches ; on not equal to SelectActorScriptEntry_Loop_11. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorScriptEntry_Loop_6: lda #$02 ; CPU:$D920 PRG:1920 A9 02 bne SelectActorScriptEntry_Loop_11 ; CPU:$D922 PRG:1922 D0 21 ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_7 ; Global: The routine calls CheckActorScreenScript_Loop_5 and SetActorAttributeB4. ; Local: Executes 9 instructions: calls CheckActorScreenScript_Loop_5; loads X from Zp74; compares ; X with $E8; branches on carry set to CheckActorScreenScript_OnCarrySet; loads X from Zp63; ; compares X with $02; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorScriptEntry_Loop_7: ldx Zp74 ; CPU:$D924 PRG:1924 A6 74 cpx #$E8 ; CPU:$D926 PRG:1926 E0 E8 bcs CheckActorScreenScript_OnCarrySet ; CPU:$D928 PRG:1928 B0 B3 ldx Zp63 ; CPU:$D92A PRG:192A A6 63 cpx #$02 ; CPU:$D92C PRG:192C E0 02 bne SelectActorScriptEntry_Loop_8 ; CPU:$D92E PRG:192E D0 05 jsr SetActorAttributeB4 ; CPU:$D930 PRG:1930 20 F3 D9 bcc SelectActorScriptEntry_Loop_10 ; CPU:$D933 PRG:1933 90 0E ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_8 ; Global: The routine reads no RAM 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 Zp74; compares X with $03; ; branches on not equal to SelectActorScriptEntry_Loop_9; increments ZpBF. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp74, Zp84, ZpBF, ZpC9, ZpCA, ZpCE. ; ;=============================================================================== SelectActorScriptEntry_Loop_8: inc Zp74 ; CPU:$D935 PRG:1935 E6 74 cpx #$03 ; CPU:$D937 PRG:1937 E0 03 bne SelectActorScriptEntry_Loop_9 ; CPU:$D939 PRG:1939 D0 02 inc ZpBF ; CPU:$D93B PRG:193B E6 BF ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_9 ; Global: The routine reads no RAM 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 X with $01; branches on not equal ; to SelectActorScriptEntry_Loop_10; increments Zp84. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp84, ZpC9, ZpCA, ZpCE. ; ;=============================================================================== SelectActorScriptEntry_Loop_9: cpx #$01 ; CPU:$D93D PRG:193D E0 01 bne SelectActorScriptEntry_Loop_10 ; CPU:$D93F PRG:193F D0 02 inc Zp84 ; CPU:$D941 PRG:1941 E6 84 ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_10 ; Global: The routine reads no RAM 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, the N and Z flags, ZpC9, ZpCA, ZpCE. ; ;=============================================================================== SelectActorScriptEntry_Loop_10: lda #$01 ; CPU:$D943 PRG:1943 A9 01 ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_11 ; Global: The routine reads no RAM 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 ZpCA; loads A with $00; stores A ; to ZpCE; stores A to ZpC9; 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, ZpC9, ZpCA, ZpCE. ; ;=============================================================================== SelectActorScriptEntry_Loop_11: sta ZpCA ; CPU:$D945 PRG:1945 85 CA lda #$00 ; CPU:$D947 PRG:1947 A9 00 sta ZpCE ; CPU:$D949 PRG:1949 85 CE sta ZpC9 ; CPU:$D94B PRG:194B 85 C9 rts ; CPU:$D94D PRG:194D 60 ;=============================================================================== ; Routine: SelectActorScriptEntry_Loop_12 ; Global: The routine calls CheckActorScreenScript_OnNegative. ; Local: Executes 1 instruction: calls CheckActorScreenScript_OnNegative. ; 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. ; ;=============================================================================== SelectActorScriptEntry_Loop_12: jmp CheckActorScreenScript_OnNegative ; CPU:$D94E PRG:194E 4C 39 D8 ; ---- data $D951-$D9AA (90 bytes) ---- ; referenced by `cmp $D95F,y` at $D811 (operand $D95F falls inside this region) .byte $20, $05, $DA, $90, $03, $4C, $20, $D8, $A9, $3C, $85, $77, $D0, $85, $A6, $0C ; CPU:$D951 PRG:1951 20 05 DA 90 03 4C 20 D8 A9 3C 85 77 D0 85 A6 0C .byte $AD, $20, $03, $0D, $1F, $03, $D0, $08, $A5, $CD, $05, $DF, $F0, $02, $A6, $C9 ; CPU:$D961 PRG:1961 AD 20 03 0D 1F 03 D0 08 A5 CD 05 DF F0 02 A6 C9 .byte $86, $0C, $A5, $AF, $D0, $4D, $A5, $0F, $D0, $1C, $A5, $B8, $D0, $06, $A5, $DE ; CPU:$D971 PRG:1971 86 0C A5 AF D0 4D A5 0F D0 1C A5 B8 D0 06 A5 DE .byte $A6, $DF, $D0, $02, $A5, $0C, $29, $03, $0A, $AA, $BD, $BC, $D9, $85, $56, $BD ; CPU:$D981 PRG:1981 A6 DF D0 02 A5 0C 29 03 0A AA BD BC D9 85 56 BD .byte $BD, $D9, $85, $C9, $85, $CA, $20, $05, $DA, $B0, $1D, $A9, $02, $85, $CA, $A5 ; CPU:$D991 PRG:1991 BD D9 85 C9 85 CA 20 05 DA B0 1D A9 02 85 CA A5 .byte $74, $69, $01, $AA, $69, $10, $B0, $02, $86, $74 ; CPU:$D9A1 PRG:19A1 74 69 01 AA 69 10 B0 02 86 74 ;=============================================================================== ; Routine: AdvanceActorCounter ; Global: The routine reads no RAM 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 Zp84; ; adds $01 to A; stores A to Zp84; branches on carry clear to ; AdvanceActorCounter_Loop; 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: 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, Zp80, Zp84. ; ;=============================================================================== AdvanceActorCounter: clc ; CPU:$D9AB PRG:19AB 18 lda Zp84 ; CPU:$D9AC PRG:19AC A5 84 adc #$01 ; CPU:$D9AE PRG:19AE 69 01 sta Zp84 ; CPU:$D9B0 PRG:19B0 85 84 bcc AdvanceActorCounter_Loop ; CPU:$D9B2 PRG:19B2 90 04 lda #$00 ; CPU:$D9B4 PRG:19B4 A9 00 sta Zp80 ; CPU:$D9B6 PRG:19B6 85 80 ;=============================================================================== ; Routine: AdvanceActorCounter_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: 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. ; ;=============================================================================== AdvanceActorCounter_Loop: rts ; CPU:$D9B8 PRG:19B8 60 ; ---- data $D9B9-$D9F2 (58 bytes) ---- .byte $4C, $EE, $F7 ; CPU:$D9B9 PRG:19B9 4C EE F7 ObjectCoordinatePointerTable: .byte $02, $00, $03, $01, $01, $02, $02, $00, $A5, $80, $F0, $F0, $A5 ; CPU:$D9BC PRG:19BC 02 00 03 01 01 02 02 00 A5 80 F0 F0 A5 .byte $84, $18, $69, $02, $85, $84, $B0, $11, $AD, $90, $05, $F0, $E2, $A5, $84, $69 ; CPU:$D9C9 PRG:19C9 84 18 69 02 85 84 B0 11 AD 90 05 F0 E2 A5 84 69 .byte $08, $C9, $F0, $90, $DA, $A9, $00, $F0, $04, $A9, $00, $85, $80, $85, $B8, $A5 ; CPU:$D9D9 PRG:19D9 08 C9 F0 90 DA A9 00 F0 04 A9 00 85 80 85 B8 A5 .byte $DF, $D0, $CC, $A5, $0F, $D0, $C8, $4C, $31, $F1 ; CPU:$D9E9 PRG:19E9 DF D0 CC A5 0F D0 C8 4C 31 F1 ;=============================================================================== ; Routine: SetActorAttributeB4 ; Global: The routine reads no RAM 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 $B4; branches on not equal to ; SetActorAttribute80_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, $032D. ; ;=============================================================================== SetActorAttributeB4: lda #$B4 ; CPU:$D9F3 PRG:19F3 A9 B4 bne SetActorAttribute80_Loop ; CPU:$D9F5 PRG:19F5 D0 06 ;=============================================================================== ; Routine: SetActorAttributeC0 ; Global: The routine reads no RAM 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 $C0; branches on not equal to ; SetActorAttribute80_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, $032D. ; ;=============================================================================== SetActorAttributeC0: lda #$C0 ; CPU:$D9F7 PRG:19F7 A9 C0 bne SetActorAttribute80_Loop ; CPU:$D9F9 PRG:19F9 D0 02 ;=============================================================================== ; Routine: SetActorAttribute80 ; Global: The routine reads no RAM 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, the N, Z, C and V flags, $032D. ; ;=============================================================================== SetActorAttribute80: lda #$80 ; CPU:$D9FB PRG:19FB A9 80 ;=============================================================================== ; Routine: SetActorAttribute80_Loop ; Global: The routine writes $032D, reads $032D. ; Local: Executes 4 instructions: clears the carry flag; adds $032D to A; ; stores A to $032D; returns with RTS. ; Parameters: Reads $032D 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 $032D changed. ; Clobbers: ; no register, the N, Z, C and V flags, $032D. ; ;=============================================================================== SetActorAttribute80_Loop: clc ; CPU:$D9FD PRG:19FD 18 adc $032D ; CPU:$D9FE PRG:19FE 6D 2D 03 sta $032D ; CPU:$DA01 PRG:1A01 8D 2D 03 rts ; CPU:$DA04 PRG:1A04 60 ;=============================================================================== ; Routine: CheckActorScrollRange ; Global: The routine reads no RAM 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 Zp69; branches on not equal to ; CheckActorScrollRange_Loop; loads A from Zp68; compares A with $C0; branches on carry ; clear to CheckActorScrollRange_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== CheckActorScrollRange: lda Zp69 ; CPU:$DA05 PRG:1A05 A5 69 bne CheckActorScrollRange_Loop ; CPU:$DA07 PRG:1A07 D0 06 lda Zp68 ; CPU:$DA09 PRG:1A09 A5 68 cmp #$C0 ; CPU:$DA0B PRG:1A0B C9 C0 bcc CheckActorScrollRange_Loop_2 ; CPU:$DA0D PRG:1A0D 90 01 ;=============================================================================== ; Routine: CheckActorScrollRange_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: sets 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: ; no register, the C flag. ; ;=============================================================================== CheckActorScrollRange_Loop: sec ; CPU:$DA0F PRG:1A0F 38 ;=============================================================================== ; Routine: CheckActorScrollRange_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== CheckActorScrollRange_Loop_2: rts ; CPU:$DA10 PRG:1A10 60 ;=============================================================================== ; Routine: StartActorScoreUpdate ; Global: The routine calls StartActorScore, reads $038E. ; Local: Executes 3 instructions: loads A from $038E; branches on equal to ; StartActorScoreUpdate_Loop; calls StartActorScore. ; Parameters: Reads $038E 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. ; ;=============================================================================== StartActorScoreUpdate: lda $038E ; CPU:$DA11 PRG:1A11 AD 8E 03 beq StartActorScoreUpdate_Loop ; CPU:$DA14 PRG:1A14 F0 03 jmp StartActorScore ; CPU:$DA16 PRG:1A16 4C 01 DB ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop ; Global: The routine calls ClearActorScore. ; Local: Executes 3 instructions: loads A from ZpCD; branches on equal to ; StartActorScoreUpdate_Loop_2; calls ClearActorScore. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== StartActorScoreUpdate_Loop: lda ZpCD ; CPU:$DA19 PRG:1A19 A5 CD beq StartActorScoreUpdate_Loop_2 ; CPU:$DA1B PRG:1A1B F0 03 jmp ClearActorScore ; CPU:$DA1D PRG:1A1D 4C 31 DB ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_2 ; Global: The routine calls ClearCarry. ; Local: Executes 6 instructions: loads A from ZpDF; branches on not equal to ; StartActorScoreUpdate_Loop_6; loads A from Zp0D; ANDs A with $C0; branches on not equal ; to StartActorScoreUpdate_Loop_3; calls ClearCarry. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== StartActorScoreUpdate_Loop_2: lda ZpDF ; CPU:$DA20 PRG:1A20 A5 DF bne StartActorScoreUpdate_Loop_6 ; CPU:$DA22 PRG:1A22 D0 4D lda Zp0D ; CPU:$DA24 PRG:1A24 A5 0D and #$C0 ; CPU:$DA26 PRG:1A26 29 C0 bne StartActorScoreUpdate_Loop_3 ; CPU:$DA28 PRG:1A28 D0 03 jmp ClearCarry ; CPU:$DA2A PRG:1A2A 4C FD DA ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_3 ; Global: The routine calls GetActorTypeIndex, writes $0313 and $031F. ; Local: Executes 7 instructions: loads A with $01; stores A to $0313; stores ; A to $031F; loads A with $02; calls GetActorTypeIndex; branches on equal to ; StartActorScoreUpdate_Loop_4; 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 $0313 and $031F changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StartActorScoreUpdate_Loop_3: lda #$01 ; CPU:$DA2D PRG:1A2D A9 01 sta $0313 ; CPU:$DA2F PRG:1A2F 8D 13 03 sta $031F ; CPU:$DA32 PRG:1A32 8D 1F 03 lda #$02 ; CPU:$DA35 PRG:1A35 A9 02 jsr GetActorTypeIndex ; CPU:$DA37 PRG:1A37 20 2D CD beq StartActorScoreUpdate_Loop_4 ; CPU:$DA3A PRG:1A3A F0 02 lda #$03 ; CPU:$DA3C PRG:1A3C A9 03 ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_4 ; Global: The routine calls PlaySoundEffectById and IsActorTypeOne, writes $03A2, $03A0, $03A3 ; and $03A7. ; Local: Executes 14 instructions: calls PlaySoundEffectById; loads A from Zp64; shifts a ; left; copies A into Y; loads A from $DBAA,y; stores A to $03A2; 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. Leaves $03A2, $03A0 and $03A3 ; changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StartActorScoreUpdate_Loop_4: jsr PlaySoundEffectById ; CPU:$DA3E PRG:1A3E 20 0D F8 lda Zp64 ; CPU:$DA41 PRG:1A41 A5 64 asl a ; CPU:$DA43 PRG:1A43 0A tay ; CPU:$DA44 PRG:1A44 A8 lda $DBAA,y ; CPU:$DA45 PRG:1A45 B9 AA DB sta $03A2 ; CPU:$DA48 PRG:1A48 8D A2 03 lda $DBAB,y ; CPU:$DA4B PRG:1A4B B9 AB DB sta $03A0 ; CPU:$DA4E PRG:1A4E 8D A0 03 lda Zp73 ; CPU:$DA51 PRG:1A51 A5 73 sta $03A3 ; CPU:$DA53 PRG:1A53 8D A3 03 jsr IsActorTypeOne ; CPU:$DA56 PRG:1A56 20 28 CD bne StartActorScoreUpdate_Loop_5 ; CPU:$DA59 PRG:1A59 D0 05 lda Zp83 ; CPU:$DA5B PRG:1A5B A5 83 sta $03A7 ; CPU:$DA5D PRG:1A5D 8D A7 03 ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_5 ; Global: The routine writes $03A1. ; Local: Executes 8 instructions: loads A with $00; stores A to $03A1; ; increments ZpCB; loads A from Zp0C; ANDs A with $03; stores A to ; ZpDE; 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 $03A1 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StartActorScoreUpdate_Loop_5: lda #$00 ; CPU:$DA60 PRG:1A60 A9 00 sta $03A1 ; CPU:$DA62 PRG:1A62 8D A1 03 inc ZpCB ; CPU:$DA65 PRG:1A65 E6 CB lda Zp0C ; CPU:$DA67 PRG:1A67 A5 0C and #$03 ; CPU:$DA69 PRG:1A69 29 03 sta ZpDE ; CPU:$DA6B PRG:1A6B 85 DE inc ZpDF ; CPU:$DA6D PRG:1A6D E6 DF bne StartActorScoreUpdate_Loop_7 ; CPU:$DA6F PRG:1A6F D0 05 ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_6 ; Global: The routine writes $031F. ; Local: Executes 2 instructions: loads A with $00; stores A to $031F. ; 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 $031F changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StartActorScoreUpdate_Loop_6: lda #$00 ; CPU:$DA71 PRG:1A71 A9 00 sta $031F ; CPU:$DA73 PRG:1A73 8D 1F 03 ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_7 ; Global: The routine writes $03A1 and $03A2, reads $03A1, $03A0 and $03A2. ; Local: Executes 17 instructions: loads A from $03A1; sets the carry flag; ; subtracts $03A0 from A; stores A to $03A1; loads A from $03A2; ; subtracts $00 from A; and 11 more instructions. ; Parameters: Reads $03A1, $03A0 and $03A2 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 $03A1 and $03A2 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StartActorScoreUpdate_Loop_7: lda $03A1 ; CPU:$DA76 PRG:1A76 AD A1 03 sec ; CPU:$DA79 PRG:1A79 38 sbc $03A0 ; CPU:$DA7A PRG:1A7A ED A0 03 sta $03A1 ; CPU:$DA7D PRG:1A7D 8D A1 03 lda $03A2 ; CPU:$DA80 PRG:1A80 AD A2 03 sbc #$00 ; CPU:$DA83 PRG:1A83 E9 00 sta $03A2 ; CPU:$DA85 PRG:1A85 8D A2 03 bpl StartActorScoreUpdate_Loop_10 ; CPU:$DA88 PRG:1A88 10 29 lda #$00 ; CPU:$DA8A PRG:1A8A A9 00 sta ZpCB ; CPU:$DA8C PRG:1A8C 85 CB sta ZpBE ; CPU:$DA8E PRG:1A8E 85 BE lda Zp73 ; CPU:$DA90 PRG:1A90 A5 73 ldy Zp63 ; CPU:$DA92 PRG:1A92 A4 63 cpy #$03 ; CPU:$DA94 PRG:1A94 C0 03 beq StartActorScoreUpdate_Loop_8 ; CPU:$DA96 PRG:1A96 F0 04 cpy #$04 ; CPU:$DA98 PRG:1A98 C0 04 bne StartActorScoreUpdate_Loop_9 ; CPU:$DA9A PRG:1A9A D0 12 ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_8 ; Global: The routine calls ResetActorSlots and SetActorPointerNine. ; Local: Executes 8 instructions: loads Y from ZpB8; branches on not equal to ; StartActorScoreUpdate_Loop_9; compares A with $C0; branches on carry clear to StartActorScoreUpdate_Loop_10; ; loads Y with $02; stores Y to Zp0F; 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. ; ;=============================================================================== StartActorScoreUpdate_Loop_8: ldy ZpB8 ; CPU:$DA9C PRG:1A9C A4 B8 bne StartActorScoreUpdate_Loop_9 ; CPU:$DA9E PRG:1A9E D0 0E cmp #$C0 ; CPU:$DAA0 PRG:1AA0 C9 C0 bcc StartActorScoreUpdate_Loop_10 ; CPU:$DAA2 PRG:1AA2 90 0F ldy #$02 ; CPU:$DAA4 PRG:1AA4 A0 02 sty Zp0F ; CPU:$DAA6 PRG:1AA6 84 0F jsr ResetActorSlots ; CPU:$DAA8 PRG:1AA8 20 3B CA jmp SetActorPointerNine ; CPU:$DAAB PRG:1AAB 4C 95 DC ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_9 ; Global: The routine reads $03A3. ; Local: Executes 2 instructions: compares A with $03A3; branches on carry set ; to SetActorScorePointer_Loop_2. ; Parameters: Reads $03A3 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, Zp73, Zp76, Zp83, Zp86, ZpDE, ZpDF. ; ;=============================================================================== StartActorScoreUpdate_Loop_9: cmp $03A3 ; CPU:$DAAE PRG:1AAE CD A3 03 bcs SetActorScorePointer_Loop_2; CPU:$DAB1 PRG:1AB1 B0 31 ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_10 ; Global: The routine calls IsActorTypeOne, reads $03A2. ; Local: Executes 15 instructions: loads A from Zp73; sets the carry flag; ; subtracts $03A2 from A; stores A to Zp73; calls IsActorTypeOne; branches ; on not equal to StartActorScoreUpdate_Loop_11; and 9 more instructions. ; Parameters: Reads $03A2 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, C and V flags, Zp73, Zp76, Zp83, Zp86. ; ;=============================================================================== StartActorScoreUpdate_Loop_10: lda Zp73 ; CPU:$DAB3 PRG:1AB3 A5 73 sec ; CPU:$DAB5 PRG:1AB5 38 sbc $03A2 ; CPU:$DAB6 PRG:1AB6 ED A2 03 sta Zp73 ; CPU:$DAB9 PRG:1AB9 85 73 jsr IsActorTypeOne ; CPU:$DABB PRG:1ABB 20 28 CD bne StartActorScoreUpdate_Loop_11 ; CPU:$DABE PRG:1ABE D0 12 lda #$00 ; CPU:$DAC0 PRG:1AC0 A9 00 sta Zp76 ; CPU:$DAC2 PRG:1AC2 85 76 lda Zp83 ; CPU:$DAC4 PRG:1AC4 A5 83 sec ; CPU:$DAC6 PRG:1AC6 38 sbc $03A2 ; CPU:$DAC7 PRG:1AC7 ED A2 03 sta Zp83 ; CPU:$DACA PRG:1ACA 85 83 lda #$1C ; CPU:$DACC PRG:1ACC A9 1C sta Zp86 ; CPU:$DACE PRG:1ACE 85 86 bne ClearCarry_Loop ; CPU:$DAD0 PRG:1AD0 D0 2D ;=============================================================================== ; Routine: StartActorScoreUpdate_Loop_11 ; Global: The routine reads no RAM 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 Zp64; compares A with $03; ; branches on equal to SetActorScorePointer_Loop; 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, the N, Z and C flags, Zp76. ; ;=============================================================================== StartActorScoreUpdate_Loop_11: lda Zp64 ; CPU:$DAD2 PRG:1AD2 A5 64 cmp #$03 ; CPU:$DAD4 PRG:1AD4 C9 03 beq SetActorScorePointer_Loop ; CPU:$DAD6 PRG:1AD6 F0 07 lda #$02 ; CPU:$DAD8 PRG:1AD8 A9 02 ;=============================================================================== ; Routine: SetActorScorePointer ; Global: The routine calls ClearCarry_Loop. ; Local: Executes 2 instructions: stores A to Zp76; calls ClearCarry_Loop. ; 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 C flag, Zp76. ; ;=============================================================================== SetActorScorePointer: sta Zp76 ; CPU:$DADA PRG:1ADA 85 76 jmp ClearCarry_Loop ; CPU:$DADC PRG:1ADC 4C FF DA ;=============================================================================== ; Routine: SetActorScorePointer_Loop ; Global: The routine calls SetActorScorePointer. ; Local: Executes 2 instructions: loads A with $02; calls SetActorScorePointer. ; 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 and C flags, Zp76. ; ;=============================================================================== SetActorScorePointer_Loop: lda #$02 ; CPU:$DADF PRG:1ADF A9 02 jmp SetActorScorePointer ; CPU:$DAE1 PRG:1AE1 4C DA DA ;=============================================================================== ; Routine: SetActorScorePointer_Loop_2 ; Global: The routine calls IsActorTypeOne, reads $03A3 and $03A7. ; Local: Executes 8 instructions: loads A from $03A3; stores A to Zp73; loads ; A with $01; stores A to Zp76; calls IsActorTypeOne; branches on not equal ; to SetActorScorePointer_Loop_3; and 2 more instructions. ; Parameters: Reads $03A3 and $03A7 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 and C flags, Zp73, Zp76, Zp83, ZpDE, ZpDF. ; ;=============================================================================== SetActorScorePointer_Loop_2: lda $03A3 ; CPU:$DAE4 PRG:1AE4 AD A3 03 sta Zp73 ; CPU:$DAE7 PRG:1AE7 85 73 lda #$01 ; CPU:$DAE9 PRG:1AE9 A9 01 sta Zp76 ; CPU:$DAEB PRG:1AEB 85 76 jsr IsActorTypeOne ; CPU:$DAED PRG:1AED 20 28 CD bne SetActorScorePointer_Loop_3; CPU:$DAF0 PRG:1AF0 D0 05 lda $03A7 ; CPU:$DAF2 PRG:1AF2 AD A7 03 sta Zp83 ; CPU:$DAF5 PRG:1AF5 85 83 ;=============================================================================== ; Routine: SetActorScorePointer_Loop_3 ; Global: The routine reads no RAM 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 Y with $00; stores Y to ZpDE; 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: Falls through to the next routine in the source; it has no return ; of its own. ; Clobbers: ; Y, the N and Z flags, ZpDE, ZpDF. ; ;=============================================================================== SetActorScorePointer_Loop_3: ldy #$00 ; CPU:$DAF7 PRG:1AF7 A0 00 sty ZpDE ; CPU:$DAF9 PRG:1AF9 84 DE sty ZpDF ; CPU:$DAFB PRG:1AFB 84 DF ;=============================================================================== ; Routine: ClearCarry ; Global: The routine reads no RAM 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. ; ;=============================================================================== ClearCarry: clc ; CPU:$DAFD PRG:1AFD 18 rts ; CPU:$DAFE PRG:1AFE 60 ;=============================================================================== ; Routine: ClearCarry_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: 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. ; ;=============================================================================== ClearCarry_Loop: sec ; CPU:$DAFF PRG:1AFF 38 rts ; CPU:$DB00 PRG:1B00 60 ;=============================================================================== ; Routine: StartActorScore ; Global: The routine calls PlaySoundEffectById, reads $0320. ; Local: Executes 8 instructions: increments $0320; loads A with $01; calls ; PlaySoundEffectById; loads Y with $00; loads A from Zp64; compares A with $03; ; and 2 more instructions. ; Parameters: Reads $0320 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. ; ;=============================================================================== StartActorScore: inc $0320 ; CPU:$DB01 PRG:1B01 EE 20 03 lda #$01 ; CPU:$DB04 PRG:1B04 A9 01 jsr PlaySoundEffectById ; CPU:$DB06 PRG:1B06 20 0D F8 ldy #$00 ; CPU:$DB09 PRG:1B09 A0 00 lda Zp64 ; CPU:$DB0B PRG:1B0B A5 64 cmp #$03 ; CPU:$DB0D PRG:1B0D C9 03 beq StartActorScore_Loop ; CPU:$DB0F PRG:1B0F F0 02 ldy #$02 ; CPU:$DB11 PRG:1B11 A0 02 ;=============================================================================== ; Routine: StartActorScore_Loop ; Global: The routine writes $03A6, $03A4, $03A7, $03A5 and 1 more. ; Local: Executes 12 instructions: loads A from $DBB2,y; stores A to $03A6; ; loads A from $DBB3,y; stores A to $03A4; loads A from Zp73; stores ; A to $03A7; 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 $03A6, $03A4 and $03A7 ; changed. ; Clobbers: ; A and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StartActorScore_Loop: lda $DBB2,y ; CPU:$DB13 PRG:1B13 B9 B2 DB sta $03A6 ; CPU:$DB16 PRG:1B16 8D A6 03 lda $DBB3,y ; CPU:$DB19 PRG:1B19 B9 B3 DB sta $03A4 ; CPU:$DB1C PRG:1B1C 8D A4 03 lda Zp73 ; CPU:$DB1F PRG:1B1F A5 73 sta $03A7 ; CPU:$DB21 PRG:1B21 8D A7 03 ldy #$00 ; CPU:$DB24 PRG:1B24 A0 00 sty $03A5 ; CPU:$DB26 PRG:1B26 8C A5 03 iny ; CPU:$DB29 PRG:1B29 C8 sty $0388 ; CPU:$DB2A PRG:1B2A 8C 88 03 inc ZpCD ; CPU:$DB2D PRG:1B2D E6 CD bne ClearActorScore_Loop ; CPU:$DB2F PRG:1B2F D0 05 ;=============================================================================== ; Routine: ClearActorScore ; Global: The routine writes $0320. ; Local: Executes 2 instructions: loads A with $00; stores A to $0320. ; 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 $0320 changed. ; Clobbers: ; A and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== ClearActorScore: lda #$00 ; CPU:$DB31 PRG:1B31 A9 00 sta $0320 ; CPU:$DB33 PRG:1B33 8D 20 03 ;=============================================================================== ; Routine: ClearActorScore_Loop ; Global: The routine calls DecrementActorScore, writes $038E and $0388, reads $03A7. ; Local: Executes 14 instructions: loads A with $00; stores A to $038E; calls ; DecrementActorScore; branches on non-negative to ClearActorScore_Loop_3; loads A with $00; ; stores A to $0388; and 8 more instructions. ; Parameters: Reads $03A7 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 $038E and $0388 changed. ; Clobbers: ; A and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== ClearActorScore_Loop: lda #$00 ; CPU:$DB36 PRG:1B36 A9 00 sta $038E ; CPU:$DB38 PRG:1B38 8D 8E 03 jsr DecrementActorScore ; CPU:$DB3B PRG:1B3B 20 97 DB bpl ClearActorScore_Loop_3 ; CPU:$DB3E PRG:1B3E 10 1B lda #$00 ; CPU:$DB40 PRG:1B40 A9 00 sta $0388 ; CPU:$DB42 PRG:1B42 8D 88 03 lda Zp63 ; CPU:$DB45 PRG:1B45 A5 63 cmp #$05 ; CPU:$DB47 PRG:1B47 C9 05 beq ClearActorScore_Loop_3 ; CPU:$DB49 PRG:1B49 F0 10 lda Zp73 ; CPU:$DB4B PRG:1B4B A5 73 cmp $03A7 ; CPU:$DB4D PRG:1B4D CD A7 03 bcc ClearActorScore_Loop_2 ; CPU:$DB50 PRG:1B50 90 04 ldy #$01 ; CPU:$DB52 PRG:1B52 A0 01 sty Zp76 ; CPU:$DB54 PRG:1B54 84 76 ;=============================================================================== ; Routine: ClearActorScore_Loop_2 ; Global: The routine reads $03A3. ; Local: Executes 2 instructions: compares A with $03A3; branches on carry set ; to ClearActorScore_Loop_7. ; Parameters: Reads $03A3 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, the RAM fields it writes. ; ;=============================================================================== ClearActorScore_Loop_2: cmp $03A3 ; CPU:$DB56 PRG:1B56 CD A3 03 bcs ClearActorScore_Loop_7 ; CPU:$DB59 PRG:1B59 B0 27 ;=============================================================================== ; Routine: ClearActorScore_Loop_3 ; Global: The routine reads $03A6 and $0388. ; Local: Executes 12 instructions: loads A from Zp73; sets the carry flag; ; subtracts $03A6 from A; stores A to Zp73; loads Y from Zp63; ; compares Y with $05; and 6 more instructions. ; Parameters: Reads $03A6 and $0388 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, Zp73, Zp76. ; ;=============================================================================== ClearActorScore_Loop_3: lda Zp73 ; CPU:$DB5B PRG:1B5B A5 73 sec ; CPU:$DB5D PRG:1B5D 38 sbc $03A6 ; CPU:$DB5E PRG:1B5E ED A6 03 sta Zp73 ; CPU:$DB61 PRG:1B61 85 73 ldy Zp63 ; CPU:$DB63 PRG:1B63 A4 63 cpy #$05 ; CPU:$DB65 PRG:1B65 C0 05 beq ClearActorScore_Loop_4 ; CPU:$DB67 PRG:1B67 F0 0B lda $0388 ; CPU:$DB69 PRG:1B69 AD 88 03 beq ClearActorScore_Loop_6 ; CPU:$DB6C PRG:1B6C F0 12 lda #$02 ; CPU:$DB6E PRG:1B6E A9 02 sta Zp76 ; CPU:$DB70 PRG:1B70 85 76 beq ClearActorScore_Loop_6 ; CPU:$DB72 PRG:1B72 F0 0C ;=============================================================================== ; Routine: ClearActorScore_Loop_4 ; Global: The routine reads no RAM 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 $02; loads Y from Zp73; ; compares Y with $70; branches on carry clear to ClearActorScore_Loop_5; adds $01 ; 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 and Y, the N, Z, C and V flags, Zp76. ; ;=============================================================================== ClearActorScore_Loop_4: lda #$02 ; CPU:$DB74 PRG:1B74 A9 02 ldy Zp73 ; CPU:$DB76 PRG:1B76 A4 73 cpy #$70 ; CPU:$DB78 PRG:1B78 C0 70 bcc ClearActorScore_Loop_5 ; CPU:$DB7A PRG:1B7A 90 02 adc #$01 ; CPU:$DB7C PRG:1B7C 69 01 ;=============================================================================== ; Routine: ClearActorScore_Loop_5 ; Global: The routine reads no RAM 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 Zp76. ; 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 C flag, Zp76. ; ;=============================================================================== ClearActorScore_Loop_5: sta Zp76 ; CPU:$DB7E PRG:1B7E 85 76 ;=============================================================================== ; Routine: ClearActorScore_Loop_6 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ClearActorScore_Loop_6: sec ; CPU:$DB80 PRG:1B80 38 rts ; CPU:$DB81 PRG:1B81 60 ;=============================================================================== ; Routine: ClearActorScore_Loop_7 ; Global: The routine reads $03A3. ; Local: Executes 2 instructions: loads A from $03A3; stores A to Zp73. ; Parameters: Reads $03A3 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, the N and Z flags, Zp73, ZpCD, ZpDE, ZpDF, $0323, $0386. ; ;=============================================================================== ClearActorScore_Loop_7: lda $03A3 ; CPU:$DB82 PRG:1B82 AD A3 03 sta Zp73 ; CPU:$DB85 PRG:1B85 85 73 ;=============================================================================== ; Routine: ClearActorScoreState ; Global: The routine writes $0386 and $0323. ; Local: Executes 8 instructions: loads A with $00; stores A to ZpDF; stores A ; to ZpDE; stores A to ZpCD; stores A to $0386; stores A to $0323; ; 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 $0386 and $0323 changed. ; Clobbers: ; A, the N and Z flags, ZpCD, ZpDE, ZpDF, $0323, $0386. ; ;=============================================================================== ClearActorScoreState: lda #$00 ; CPU:$DB87 PRG:1B87 A9 00 sta ZpDF ; CPU:$DB89 PRG:1B89 85 DF sta ZpDE ; CPU:$DB8B PRG:1B8B 85 DE sta ZpCD ; CPU:$DB8D PRG:1B8D 85 CD sta $0386 ; CPU:$DB8F PRG:1B8F 8D 86 03 sta $0323 ; CPU:$DB92 PRG:1B92 8D 23 03 clc ; CPU:$DB95 PRG:1B95 18 rts ; CPU:$DB96 PRG:1B96 60 ;=============================================================================== ; Routine: DecrementActorScore ; Global: The routine writes $03A5 and $03A6, reads $03A5, $03A4 and $03A6. ; Local: Executes 8 instructions: loads A from $03A5; sets the carry flag; ; subtracts $03A4 from A; stores A to $03A5; loads A from $03A6; ; subtracts $00 from A; and 2 more instructions. ; Parameters: Reads $03A5, $03A4 and $03A6 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 $03A5 and $03A6 changed. ; Clobbers: ; A, the N, Z, C and V flags, $03A5, $03A6. ; ;=============================================================================== DecrementActorScore: lda $03A5 ; CPU:$DB97 PRG:1B97 AD A5 03 sec ; CPU:$DB9A PRG:1B9A 38 sbc $03A4 ; CPU:$DB9B PRG:1B9B ED A4 03 sta $03A5 ; CPU:$DB9E PRG:1B9E 8D A5 03 lda $03A6 ; CPU:$DBA1 PRG:1BA1 AD A6 03 sbc #$00 ; CPU:$DBA4 PRG:1BA4 E9 00 sta $03A6 ; CPU:$DBA6 PRG:1BA6 8D A6 03 rts ; CPU:$DBA9 PRG:1BA9 60 ; ---- data $DBAA-$DBB5 (12 bytes) ---- ; referenced by `lda $DBAA,y` at $DA45 (operand $DBAA falls inside this region) ; referenced by `lda $DBAB,y` at $DA4B (operand $DBAB falls inside this region) ; referenced by `lda $DBB2,y` at $DB13 (operand $DBB2 falls inside this region) ; referenced by `lda $DBB3,y` at $DB19 (operand $DBB3 falls inside this region) ActorCoordinateTable: .byte $04, $1A, $04, $1A, $04, $1C, $04, $1C ; CPU:$DBAA PRG:1BAA 04 1A 04 1A 04 1C 04 1C ItemCoordinateTable: .byte $03, $25, $06, $25 ; CPU:$DBB2 PRG:1BB2 03 25 06 25 ;=============================================================================== ; Routine: AccumulateActorScore ; Global: The routine calls AddToActorScore, reads $0313. ; Local: Executes 11 instructions: loads X from ZpCA; loads Y from Zp64; ; compares Y with $03; branches on equal to AccumulateActorScore_Loop; copies X into ; A; ANDs A with $03; and 5 more instructions. ; Parameters: Reads $0313 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, Zp76, Zp86, $0313, $0336, $038B, ; $038C. ; ;=============================================================================== AccumulateActorScore: ldx ZpCA ; CPU:$DBB6 PRG:1BB6 A6 CA ldy Zp64 ; CPU:$DBB8 PRG:1BB8 A4 64 cpy #$03 ; CPU:$DBBA PRG:1BBA C0 03 beq AccumulateActorScore_Loop ; CPU:$DBBC PRG:1BBC F0 10 txa ; CPU:$DBBE PRG:1BBE 8A and #$03 ; CPU:$DBBF PRG:1BBF 29 03 beq AddToActorScore_Loop_9 ; CPU:$DBC1 PRG:1BC1 F0 75 lda $0313 ; CPU:$DBC3 PRG:1BC3 AD 13 03 bne AddToActorScore_Loop ; CPU:$DBC6 PRG:1BC6 D0 12 lda $DC52,x ; CPU:$DBC8 PRG:1BC8 BD 52 DC jmp AddToActorScore ; CPU:$DBCB PRG:1BCB 4C D1 DB ;=============================================================================== ; Routine: AccumulateActorScore_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 from $DC55,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, C and V flags, Zp76, Zp86, $0313, $0336, $038B, ; $038C. ; ;=============================================================================== AccumulateActorScore_Loop: lda $DC55,x ; CPU:$DBCE PRG:1BCE BD 55 DC ;=============================================================================== ; Routine: AddToActorScore ; Global: The routine writes $0336, reads $0336. ; Local: Executes 4 instructions: clears the carry flag; adds $0336 to A; ; stores A to $0336; branches on carry clear to AddToActorScore_Loop_7. ; Parameters: Reads $0336 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 $0336 changed. ; Clobbers: ; A and X, the N, Z, C and V flags, Zp76, Zp86, $0313, $0336, $038B, ; $038C. ; ;=============================================================================== AddToActorScore: clc ; CPU:$DBD1 PRG:1BD1 18 adc $0336 ; CPU:$DBD2 PRG:1BD2 6D 36 03 sta $0336 ; CPU:$DBD5 PRG:1BD5 8D 36 03 bcc AddToActorScore_Loop_7 ; CPU:$DBD8 PRG:1BD8 90 52 ;=============================================================================== ; Routine: AddToActorScore_Loop ; Global: The routine writes $0313. ; Local: Executes 6 instructions: loads A with $00; stores A to $0313; ; compares Y with $03; branches on equal to AddToActorScore_Loop_2; compares X with ; $02; branches on equal to AddToActorScore_Loop_8. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 $0313 changed. ; Clobbers: ; A and X, the N, Z and C flags, Zp76, Zp86, $0313, $038B, $038C. ; ;=============================================================================== AddToActorScore_Loop: lda #$00 ; CPU:$DBDA PRG:1BDA A9 00 sta $0313 ; CPU:$DBDC PRG:1BDC 8D 13 03 cpy #$03 ; CPU:$DBDF PRG:1BDF C0 03 beq AddToActorScore_Loop_2 ; CPU:$DBE1 PRG:1BE1 F0 04 cpx #$02 ; CPU:$DBE3 PRG:1BE3 E0 02 beq AddToActorScore_Loop_8 ; CPU:$DBE5 PRG:1BE5 F0 46 ;=============================================================================== ; Routine: AddToActorScore_Loop_2 ; Global: The routine writes $038B, reads $038B. ; Local: Executes 6 instructions: increments $038B; loads A from $038B; ANDs A ; with $03; EORs A with $03; branches on not equal to AddToActorScore_Loop_3; ; stores A to $038B. ; Parameters: Reads $038B 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 $038B changed. ; Clobbers: ; A and X, the N, Z and C flags, Zp76, Zp86, $038B. ; ;=============================================================================== AddToActorScore_Loop_2: inc $038B ; CPU:$DBE7 PRG:1BE7 EE 8B 03 lda $038B ; CPU:$DBEA PRG:1BEA AD 8B 03 and #$03 ; CPU:$DBED PRG:1BED 29 03 eor #$03 ; CPU:$DBEF PRG:1BEF 49 03 bne AddToActorScore_Loop_3 ; CPU:$DBF1 PRG:1BF1 D0 03 sta $038B ; CPU:$DBF3 PRG:1BF3 8D 8B 03 ;=============================================================================== ; Routine: AddToActorScore_Loop_3 ; Global: The routine reads no RAM 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 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, Zp76, Zp86. ; ;=============================================================================== AddToActorScore_Loop_3: tax ; CPU:$DBF6 PRG:1BF6 AA ;=============================================================================== ; Routine: AddToActorScore_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 16 instructions: compares Y with $01; branches on equal to ; AddToActorScore_Loop_6; compares Y with $02; branches on equal to AddToActorScore_Loop_6; ; compares Y with $04; branches on equal to AddToActorScore_Loop_6; 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 and C flags, Zp76, Zp86. ; ;=============================================================================== AddToActorScore_OnNonzero: cpy #$01 ; CPU:$DBF7 PRG:1BF7 C0 01 beq AddToActorScore_Loop_6 ; CPU:$DBF9 PRG:1BF9 F0 2C cpy #$02 ; CPU:$DBFB PRG:1BFB C0 02 beq AddToActorScore_Loop_6 ; CPU:$DBFD PRG:1BFD F0 28 cpy #$04 ; CPU:$DBFF PRG:1BFF C0 04 beq AddToActorScore_Loop_6 ; CPU:$DC01 PRG:1C01 F0 24 lda ZpDF ; CPU:$DC03 PRG:1C03 A5 DF ora Zp0F ; CPU:$DC05 PRG:1C05 05 0F bne AddToActorScore_Loop_4 ; CPU:$DC07 PRG:1C07 D0 0E lda Zp00 ; CPU:$DC09 PRG:1C09 A5 00 cmp #$08 ; CPU:$DC0B PRG:1C0B C9 08 beq AddToActorScore_Loop_4 ; CPU:$DC0D PRG:1C0D F0 08 lda Zp76 ; CPU:$DC0F PRG:1C0F A5 76 eor #$01 ; CPU:$DC11 PRG:1C11 49 01 and #$01 ; CPU:$DC13 PRG:1C13 29 01 sta Zp76 ; CPU:$DC15 PRG:1C15 85 76 ;=============================================================================== ; Routine: AddToActorScore_Loop_4 ; Global: The routine reads no RAM 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 Y with $03; branches on equal to ; AddToActorScore_Loop_5. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp86. ; ;=============================================================================== AddToActorScore_Loop_4: cpy #$03 ; CPU:$DC17 PRG:1C17 C0 03 beq AddToActorScore_Loop_5 ; CPU:$DC19 PRG:1C19 F0 06 ;=============================================================================== ; Routine: AddToActorScore_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 A from $DC49,x; stores A to Zp86; ; 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, Zp86. ; ;=============================================================================== AddToActorScore_OnZero: lda $DC49,x ; CPU:$DC1B PRG:1C1B BD 49 DC sta Zp86 ; CPU:$DC1E PRG:1C1E 85 86 rts ; CPU:$DC20 PRG:1C20 60 ;=============================================================================== ; Routine: AddToActorScore_Loop_5 ; Global: The routine reads no RAM 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 $DC4C,x; stores A to Zp86; ; 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, Zp86. ; ;=============================================================================== AddToActorScore_Loop_5: lda $DC4C,x ; CPU:$DC21 PRG:1C21 BD 4C DC sta Zp86 ; CPU:$DC24 PRG:1C24 85 86 rts ; CPU:$DC26 PRG:1C26 60 ;=============================================================================== ; Routine: AddToActorScore_Loop_6 ; Global: The routine reads no RAM 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 $DC4F,x; stores A to Zp76. ; 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, Zp76. ; ;=============================================================================== AddToActorScore_Loop_6: lda $DC4F,x ; CPU:$DC27 PRG:1C27 BD 4F DC sta Zp76 ; CPU:$DC2A PRG:1C2A 85 76 ;=============================================================================== ; Routine: AddToActorScore_Loop_7 ; Global: The routine reads no RAM 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. ; ;=============================================================================== AddToActorScore_Loop_7: rts ; CPU:$DC2C PRG:1C2C 60 ;=============================================================================== ; Routine: AddToActorScore_Loop_8 ; Global: The routine calls AddToActorScore_Loop_3, reads $038C. ; Local: Executes 4 instructions: increments $038C; loads A from $038C; ANDs A ; with $01; calls AddToActorScore_Loop_3. ; Parameters: Reads $038C 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 and C flags, Zp76, Zp86, $038C. ; ;=============================================================================== AddToActorScore_Loop_8: inc $038C ; CPU:$DC2D PRG:1C2D EE 8C 03 lda $038C ; CPU:$DC30 PRG:1C30 AD 8C 03 and #$01 ; CPU:$DC33 PRG:1C33 29 01 jmp AddToActorScore_Loop_3 ; CPU:$DC35 PRG:1C35 4C F6 DB ;=============================================================================== ; Routine: AddToActorScore_Loop_9 ; Global: The routine writes $0313. ; Local: Executes 35 instructions: compares Y with $01; branches on equal to ; AddToActorScore_Loop_6; compares Y with $02; branches on equal to AddToActorScore_Loop_6; ; compares Y with $04; branches on equal to AddToActorScore_Loop_6; and 29 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 $0313 changed. ; Clobbers: ; A, X and Y, the N, Z and C flags, Zp76, Zp86, $0313. ; ;=============================================================================== AddToActorScore_Loop_9: ldx #$01 ; CPU:$DC38 PRG:1C38 A2 01 stx $0313 ; CPU:$DC3A PRG:1C3A 8E 13 03 ldx #$00 ; CPU:$DC3D PRG:1C3D A2 00 ldy Zp64 ; CPU:$DC3F PRG:1C3F A4 64 cpy #$00 ; CPU:$DC41 PRG:1C41 C0 00 bne AddToActorScore_OnNonzero ; CPU:$DC43 PRG:1C43 D0 B2 stx Zp76 ; CPU:$DC45 PRG:1C45 86 76 beq AddToActorScore_OnZero ; CPU:$DC47 PRG:1C47 F0 D2 ; ---- data $DC49-$DC49 (1 bytes) ---- ; referenced by `lda $DC49,x` at $DC1B (operand $DC49 falls inside this region) ObjectTimerConstant: .byte $1A ; CPU:$DC49 PRG:1C49 1A .byte $1B, $1C, $10 ; CPU:$DC4A PRG:1C4A 1B 1C 10 -- slo $101C,y (undocumented; ca65 cannot encode) ora (Zp12),y ; CPU:$DC4D PRG:1C4D 11 12 .byte $03, $04 ; CPU:$DC4F PRG:1C4F 03 04 -- slo (Zp04,x) (undocumented; ca65 cannot encode) ora Zp00 ; CPU:$DC51 PRG:1C51 05 00 .byte $20, $10, $20 ; CPU:$DC53 PRG:1C53 20 10 20 -- data, not a call bmi SelectActorBehaviour_Loop_2; CPU:$DC56 PRG:1C56 30 10 ;=============================================================================== ; Routine: SelectActorBehaviour ; Global: The routine reads no RAM 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 Zp0F; decrements X; branches on ; equal to SetActorPointerNine_Loop; decrements X; branches on equal to SelectActorBehaviour_Loop_3; ; 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, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorBehaviour: ldx Zp0F ; CPU:$DC58 PRG:1C58 A6 0F dex ; CPU:$DC5A PRG:1C5A CA beq SetActorPointerNine_Loop ; CPU:$DC5B PRG:1C5B F0 3E dex ; CPU:$DC5D PRG:1C5D CA beq SelectActorBehaviour_Loop_3; CPU:$DC5E PRG:1C5E F0 0C dex ; CPU:$DC60 PRG:1C60 CA beq SelectActorBehaviour_Loop ; CPU:$DC61 PRG:1C61 F0 02 bne SelectActorBehaviourTwo_Loop ; CPU:$DC63 PRG:1C63 D0 4E ;=============================================================================== ; Routine: SelectActorBehaviour_Loop ; Global: The routine calls IsCoordinateBusy. ; Local: Executes 1 instruction: calls IsCoordinateBusy. ; 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. ; ;=============================================================================== SelectActorBehaviour_Loop: jsr IsCoordinateBusy ; CPU:$DC65 PRG:1C65 20 25 CA ;=============================================================================== ; Routine: SelectActorBehaviour_Loop_2 ; Global: The routine reads no RAM 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: branches on carry clear to SelectActorBehaviourTwo_Loop_2; ; branches on carry set to SelectActorBehaviourTwo_Loop_4. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorBehaviour_Loop_2: bcc SelectActorBehaviourTwo_Loop_2 ; CPU:$DC68 PRG:1C68 90 56 bcs SelectActorBehaviourTwo_Loop_4 ; CPU:$DC6A PRG:1C6A B0 5A ;=============================================================================== ; Routine: SelectActorBehaviour_Loop_3 ; Global: The routine calls IsCoordinateBusy and PlaySoundEffectById, writes $0314, reads $0314. ; Local: Executes 13 instructions: loads X from Zp64; compares X with $03; ; branches on equal to SelectActorBehaviour_Loop_4; compares X with $01; branches on not ; equal to SelectActorBehaviour_Loop_4; loads A from $0314; and 7 more instructions. ; Parameters: Reads $0314 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 $0314 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorBehaviour_Loop_3: ldx Zp64 ; CPU:$DC6C PRG:1C6C A6 64 cpx #$03 ; CPU:$DC6E PRG:1C6E E0 03 beq SelectActorBehaviour_Loop_4; CPU:$DC70 PRG:1C70 F0 18 cpx #$01 ; CPU:$DC72 PRG:1C72 E0 01 bne SelectActorBehaviour_Loop_4; CPU:$DC74 PRG:1C74 D0 14 lda $0314 ; CPU:$DC76 PRG:1C76 AD 14 03 beq SelectActorBehaviour_Loop_4; CPU:$DC79 PRG:1C79 F0 0F jsr IsCoordinateBusy ; CPU:$DC7B PRG:1C7B 20 25 CA bcc SelectActorBehaviourTwo_Loop_2 ; CPU:$DC7E PRG:1C7E 90 40 lda #$08 ; CPU:$DC80 PRG:1C80 A9 08 jsr PlaySoundEffectById ; CPU:$DC82 PRG:1C82 20 0D F8 lda #$00 ; CPU:$DC85 PRG:1C85 A9 00 sta $0314 ; CPU:$DC87 PRG:1C87 8D 14 03 ;=============================================================================== ; Routine: SelectActorBehaviour_Loop_4 ; Global: The routine reads no RAM 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 Zp73; clears the carry flag; ; adds $02 to A; stores A to Zp73; compares A with $C0; branches on ; carry clear to SelectActorBehaviourTwo_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorBehaviour_Loop_4: lda Zp73 ; CPU:$DC8A PRG:1C8A A5 73 clc ; CPU:$DC8C PRG:1C8C 18 adc #$02 ; CPU:$DC8D PRG:1C8D 69 02 sta Zp73 ; CPU:$DC8F PRG:1C8F 85 73 cmp #$C0 ; CPU:$DC91 PRG:1C91 C9 C0 bcc SelectActorBehaviourTwo_Loop_2 ; CPU:$DC93 PRG:1C93 90 2B ;=============================================================================== ; Routine: SetActorPointerNine ; Global: The routine reads no RAM 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 $09; stores A to Zp76; branches ; on not equal to ResetActorSlotsTwo_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SetActorPointerNine: lda #$09 ; CPU:$DC95 PRG:1C95 A9 09 sta Zp76 ; CPU:$DC97 PRG:1C97 85 76 bne ResetActorSlotsTwo_Loop ; CPU:$DC99 PRG:1C99 D0 44 ;=============================================================================== ; Routine: SetActorPointerNine_Loop ; Global: The routine calls ResetActorSlots, reads $0314. ; Local: Executes 7 instructions: calls ResetActorSlots; increments $0314; loads A ; from Zp64; compares A with $03; branches on not equal to ResetActorSlotsTwo_Loop; ; loads A with $08; and 1 more instruction. ; Parameters: Reads $0314 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, the RAM fields it writes. ; ;=============================================================================== SetActorPointerNine_Loop: jsr ResetActorSlots ; CPU:$DC9B PRG:1C9B 20 3B CA inc $0314 ; CPU:$DC9E PRG:1C9E EE 14 03 lda Zp64 ; CPU:$DCA1 PRG:1CA1 A5 64 cmp #$03 ; CPU:$DCA3 PRG:1CA3 C9 03 bne ResetActorSlotsTwo_Loop ; CPU:$DCA5 PRG:1CA5 D0 38 lda #$08 ; CPU:$DCA7 PRG:1CA7 A9 08 bne ResetActorSlotsTwo_Loop_2 ; CPU:$DCA9 PRG:1CA9 D0 3B ;=============================================================================== ; Routine: SelectActorBehaviourTwo ; Global: The routine reads no RAM 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 from Zp0F; decrements X; branches on ; equal to SelectActorBehaviourTwo_Loop_5; decrements X; branches on equal to SelectActorBehaviourTwo_Loop_3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorBehaviourTwo: ldx Zp0F ; CPU:$DCAB PRG:1CAB A6 0F dex ; CPU:$DCAD PRG:1CAD CA beq SelectActorBehaviourTwo_Loop_5 ; CPU:$DCAE PRG:1CAE F0 24 dex ; CPU:$DCB0 PRG:1CB0 CA beq SelectActorBehaviourTwo_Loop_3 ; CPU:$DCB1 PRG:1CB1 F0 0E ;=============================================================================== ; Routine: SelectActorBehaviourTwo_Loop ; Global: The routine calls IsRingInPlay. ; Local: Executes 6 instructions: calls IsRingInPlay; branches on carry clear to ; SelectActorBehaviourTwo_Loop_2; loads A with $00; stores A to Zp0F; loads A with $01; ; stores A to Zp0A. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorBehaviourTwo_Loop: jsr IsRingInPlay ; CPU:$DCB3 PRG:1CB3 20 31 CA bcc SelectActorBehaviourTwo_Loop_2 ; CPU:$DCB6 PRG:1CB6 90 08 lda #$00 ; CPU:$DCB8 PRG:1CB8 A9 00 sta Zp0F ; CPU:$DCBA PRG:1CBA 85 0F lda #$01 ; CPU:$DCBC PRG:1CBC A9 01 sta Zp0A ; CPU:$DCBE PRG:1CBE 85 0A ;=============================================================================== ; Routine: SelectActorBehaviourTwo_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== SelectActorBehaviourTwo_Loop_2: rts ; CPU:$DCC0 PRG:1CC0 60 ;=============================================================================== ; Routine: SelectActorBehaviourTwo_Loop_3 ; Global: The routine calls IsCoordinateBusy. ; Local: Executes 3 instructions: returns with RTS; calls IsCoordinateBusy; branches ; on carry clear to SelectActorBehaviourTwo_Loop_2. ; 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. ; ;=============================================================================== SelectActorBehaviourTwo_Loop_3: jsr IsCoordinateBusy ; CPU:$DCC1 PRG:1CC1 20 25 CA bcc SelectActorBehaviourTwo_Loop_2 ; CPU:$DCC4 PRG:1CC4 90 FA ;=============================================================================== ; Routine: SelectActorBehaviourTwo_Loop_4 ; Global: The routine calls PlaySoundEffectById. ; Local: Executes 6 instructions: loads A with $0B; calls PlaySoundEffectById; loads A ; with $4C; calls PlaySoundEffectById; loads A with $8D; branches on not equal ; to ResetActorSlotsTwo_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorBehaviourTwo_Loop_4: lda #$0B ; CPU:$DCC6 PRG:1CC6 A9 0B jsr PlaySoundEffectById ; CPU:$DCC8 PRG:1CC8 20 0D F8 lda #$4C ; CPU:$DCCB PRG:1CCB A9 4C jsr PlaySoundEffectById ; CPU:$DCCD PRG:1CCD 20 0D F8 lda #$8D ; CPU:$DCD0 PRG:1CD0 A9 8D bne ResetActorSlotsTwo_Loop_2 ; CPU:$DCD2 PRG:1CD2 D0 12 ;=============================================================================== ; Routine: SelectActorBehaviourTwo_Loop_5 ; Global: The routine reads no RAM 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 $1E; stores A to Zp76; loads A ; with $1D; stores A to Zp86. ; 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. ; ;=============================================================================== SelectActorBehaviourTwo_Loop_5: lda #$1E ; CPU:$DCD4 PRG:1CD4 A9 1E sta Zp76 ; CPU:$DCD6 PRG:1CD6 85 76 lda #$1D ; CPU:$DCD8 PRG:1CD8 A9 1D sta Zp86 ; CPU:$DCDA PRG:1CDA 85 86 ;=============================================================================== ; Routine: ResetActorSlotsTwo ; Global: The routine calls ResetActorSlots. ; Local: Executes 1 instruction: calls ResetActorSlots. ; 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. ; ;=============================================================================== ResetActorSlotsTwo: jsr ResetActorSlots ; CPU:$DCDC PRG:1CDC 20 3B CA ;=============================================================================== ; Routine: ResetActorSlotsTwo_Loop ; Global: The routine calls PlaySoundEffectById. ; Local: Executes 3 instructions: loads A with $09; calls PlaySoundEffectById; loads A ; with $CA. ; 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. ; ;=============================================================================== ResetActorSlotsTwo_Loop: lda #$09 ; CPU:$DCDF PRG:1CDF A9 09 jsr PlaySoundEffectById ; CPU:$DCE1 PRG:1CE1 20 0D F8 lda #$CA ; CPU:$DCE4 PRG:1CE4 A9 CA ;=============================================================================== ; Routine: ResetActorSlotsTwo_Loop_2 ; Global: The routine calls PlaySoundEffectById. ; Local: Executes 5 instructions: calls PlaySoundEffectById; increments Zp0F; loads A ; with $02; stores A to ZpCC; 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 and C flags, the RAM fields it writes. ; ;=============================================================================== ResetActorSlotsTwo_Loop_2: jsr PlaySoundEffectById ; CPU:$DCE6 PRG:1CE6 20 0D F8 inc Zp0F ; CPU:$DCE9 PRG:1CE9 E6 0F lda #$02 ; CPU:$DCEB PRG:1CEB A9 02 sta ZpCC ; CPU:$DCED PRG:1CED 85 CC rts ; CPU:$DCEF PRG:1CEF 60 ; ---- data $DCF0-$E483 (1940 bytes) ---- .byte $00, $50, $02, $00, $00, $66, $08, $00, $76, $10, $08, $51, $00, $08, $67, $08 ; CPU:$DCF0 PRG:1CF0 00 50 02 00 00 66 08 00 76 10 08 51 00 08 67 08 .byte $08, $77, $10, $00, $07, $02, $00, $00, $6C, $08, $00, $7C, $10, $08, $09, $00 ; CPU:$DD00 PRG:1D00 08 77 10 00 07 02 00 00 6C 08 00 7C 10 08 09 00 .byte $08, $6D, $08, $08, $7D, $10, $00, $5E, $02, $00, $00, $6E, $08, $00, $7E, $10 ; CPU:$DD10 PRG:1D10 08 6D 08 08 7D 10 00 5E 02 00 00 6E 08 00 7E 10 .byte $08, $5F, $00, $08, $6F, $08, $08, $7F, $10, $00, $50, $02, $00, $00, $60, $08 ; CPU:$DD20 PRG:1D20 08 5F 00 08 6F 08 08 7F 10 00 50 02 00 00 60 08 .byte $00, $70, $10, $08, $51, $00, $08, $61, $08, $08, $71, $10, $00, $50, $02, $00 ; CPU:$DD30 PRG:1D30 00 70 10 08 51 00 08 61 08 08 71 10 00 50 02 00 .byte $00, $62, $08, $00, $72, $10, $08, $51, $00, $08, $63, $08, $08, $73, $10, $00 ; CPU:$DD40 PRG:1D40 00 62 08 00 72 10 08 51 00 08 63 08 08 73 10 00 .byte $50, $02, $00, $00, $64, $08, $00, $74, $10, $08, $51, $00, $08, $65, $08, $08 ; CPU:$DD50 PRG:1D50 50 02 00 00 64 08 00 74 10 08 51 00 08 65 08 08 .byte $75, $10, $00, $0E, $02, $00, $00, $1E, $08, $00, $2E, $10, $08, $0F, $00, $08 ; CPU:$DD60 PRG:1D60 75 10 00 0E 02 00 00 1E 08 00 2E 10 08 0F 00 08 .byte $1F, $08, $08, $2F, $10, $00, $3C, $02, $00, $00, $4C, $08, $00, $5C, $10, $08 ; CPU:$DD70 PRG:1D70 1F 08 08 2F 10 00 3C 02 00 00 4C 08 00 5C 10 08 .byte $3D, $00, $08, $4D, $08, $08, $5D, $10, $00, $0E, $02, $00, $00, $3E, $08, $00 ; CPU:$DD80 PRG:1D80 3D 00 08 4D 08 08 5D 10 00 0E 02 00 00 3E 08 00 .byte $4E, $10, $08, $0F, $00, $08, $3F, $08, $08, $4F, $10, $00, $58, $02, $00, $00 ; CPU:$DD90 PRG:1D90 4E 10 08 0F 00 08 3F 08 08 4F 10 00 58 02 00 00 .byte $68, $08, $00, $78, $10, $08, $59, $00, $08, $69, $08, $08, $79, $10, $08, $02 ; CPU:$DDA0 PRG:1DA0 68 08 00 78 10 08 59 00 08 69 08 08 79 10 08 02 .byte $00, $17, $FF, $03, $00, $08, $0D, $00, $E8, $04, $08, $03, $F0, $02, $18, $03 ; CPU:$DDB0 PRG:1DB0 00 17 FF 03 00 08 0D 00 E8 04 08 03 F0 02 18 03 .byte $F8, $00, $17, $03, $08, $00, $17, $03, $10, $02, $18, $83, $28, $04, $08, $83 ; CPU:$DDC0 PRG:1DC0 F8 00 17 03 08 00 17 03 10 02 18 83 28 04 08 83 .byte $30, $00, $17, $83, $18, $00, $17, $83, $20, $08, $02, $00, $19, $FF, $03, $00 ; CPU:$DDD0 PRG:1DD0 30 00 17 83 18 00 17 83 20 08 02 00 19 FF 03 00 .byte $08, $0D, $00, $E8, $04, $0A, $03, $F0, $02, $1A, $03, $F8, $00, $19, $03, $08 ; CPU:$DDE0 PRG:1DE0 08 0D 00 E8 04 0A 03 F0 02 1A 03 F8 00 19 03 08 .byte $00, $19, $03, $10, $02, $1A, $83, $28, $04, $0A, $83, $30, $00, $19, $83, $18 ; CPU:$DDF0 PRG:1DF0 00 19 03 10 02 1A 83 28 04 0A 83 30 00 19 83 18 .byte $00, $19, $83, $20, $07, $02, $00, $08, $FF, $43, $00, $02, $18, $43, $08, $04 ; CPU:$DE00 PRG:1E00 00 19 83 20 07 02 00 08 FF 43 00 02 18 43 08 04 .byte $17, $43, $10, $04, $17, $43, $18, $04, $17, $43, $20, $02, $18, $C3, $38, $00 ; CPU:$DE10 PRG:1E10 17 43 10 04 17 43 18 04 17 43 20 02 18 C3 38 00 .byte $08, $C3, $40, $04, $17, $C3, $28, $04, $17, $C3, $30, $07, $02, $00, $0A, $FF ; CPU:$DE20 PRG:1E20 08 C3 40 04 17 C3 28 04 17 C3 30 07 02 00 0A FF .byte $43, $00, $02, $1A, $43, $08, $04, $19, $43, $10, $04, $19, $43, $18, $04, $19 ; CPU:$DE30 PRG:1E30 43 00 02 1A 43 08 04 19 43 10 04 19 43 18 04 19 .byte $43, $20, $02, $1A, $C3, $38, $00, $0A, $C3, $40, $04, $19, $C3, $28, $04, $19 ; CPU:$DE40 PRG:1E40 43 20 02 1A C3 38 00 0A C3 40 04 19 C3 28 04 19 .byte $C3, $30, $00, $CA, $01, $00, $00, $DA, $08, $00, $00, $10, $08, $CB, $00, $08 ; CPU:$DE50 PRG:1E50 C3 30 00 CA 01 00 00 DA 08 00 00 10 08 CB 00 08 .byte $DB, $08, $08, $EB, $10, $10, $CC, $00, $10, $DC, $08, $10, $EC, $10, $18, $00 ; CPU:$DE60 PRG:1E60 DB 08 08 EB 10 10 CC 00 10 DC 08 10 EC 10 18 00 .byte $F8, $18, $DD, $00, $18, $ED, $08, $18, $FD, $10, $20, $BD, $F8, $20, $CD, $00 ; CPU:$DE70 PRG:1E70 F8 18 DD 00 18 ED 08 18 FD 10 20 BD F8 20 CD 00 .byte $20, $DE, $08, $20, $EE, $10, $28, $BE, $F8, $28, $CE, $00, $00, $D5, $01, $00 ; CPU:$DE80 PRG:1E80 20 DE 08 20 EE 10 28 BE F8 28 CE 00 00 D5 01 00 .byte $00, $E5, $08, $00, $F5, $10, $08, $D6, $00, $08, $E6, $08, $08, $F6, $10, $10 ; CPU:$DE90 PRG:1E90 00 E5 08 00 F5 10 08 D6 00 08 E6 08 08 F6 10 10 .byte $D7, $00, $10, $E7, $08, $10, $F7, $10, $18, $D9, $F8, $18, $D8, $00, $18, $E8 ; CPU:$DEA0 PRG:1EA0 D7 00 10 E7 08 10 F7 10 18 D9 F8 18 D8 00 18 E8 .byte $08, $18, $F8, $10, $20, $B8, $F8, $20, $C8, $00, $20, $E9, $08, $20, $F9, $10 ; CPU:$DEB0 PRG:1EB0 08 18 F8 10 20 B8 F8 20 C8 00 20 E9 08 20 F9 10 .byte $28, $B9, $F8, $28, $C9, $00, $00, $D0, $01, $00, $00, $E0, $08, $00, $00, $10 ; CPU:$DEC0 PRG:1EC0 28 B9 F8 28 C9 00 00 D0 01 00 00 E0 08 00 00 10 .byte $08, $D1, $00, $08, $E1, $08, $08, $F1, $10, $10, $D2, $00, $10, $E2, $08, $10 ; CPU:$DED0 PRG:1ED0 08 D1 00 08 E1 08 08 F1 10 10 D2 00 10 E2 08 10 .byte $F2, $10, $18, $C3, $F8, $18, $D3, $00, $18, $E3, $08, $18, $00, $10, $20, $C4 ; CPU:$DEE0 PRG:1EE0 F2 10 18 C3 F8 18 D3 00 18 E3 08 18 00 10 20 C4 .byte $F8, $20, $D4, $00, $20, $E4, $08, $20, $F4, $10, $28, $C5, $F8, $28, $C6, $00 ; CPU:$DEF0 PRG:1EF0 F8 20 D4 00 20 E4 08 20 F4 10 28 C5 F8 28 C6 00 .byte $00, $10, $01, $00, $00, $20, $08, $08, $11, $00, $08, $21, $08, $00, $10, $01 ; CPU:$DF00 PRG:1F00 00 10 01 00 00 20 08 08 11 00 08 21 08 00 10 01 .byte $00, $00, $52, $08, $08, $11, $00, $08, $53, $08, $00, $10, $01, $00, $00, $34 ; CPU:$DF10 PRG:1F10 00 00 52 08 08 11 00 08 53 08 00 10 01 00 00 34 .byte $08, $08, $11, $00, $08, $35, $08, $00, $10, $02, $00, $00, $20, $08, $08, $11 ; CPU:$DF20 PRG:1F20 08 08 11 00 08 35 08 00 10 02 00 00 20 08 08 11 .byte $00, $08, $21, $08, $00, $10, $02, $00, $00, $52, $08, $08, $11, $00, $08, $53 ; CPU:$DF30 PRG:1F30 00 08 21 08 00 10 02 00 00 52 08 08 11 00 08 53 .byte $08, $00, $10, $02, $00, $00, $34, $08, $08, $11, $00, $08, $35, $08, $00, $26 ; CPU:$DF40 PRG:1F40 08 00 10 02 00 00 34 08 08 11 00 08 35 08 00 26 .byte $02, $00, $00, $2C, $08, $08, $1D, $00, $08, $2D, $08, $00, $30, $00, $00, $00 ; CPU:$DF50 PRG:1F50 02 00 00 2C 08 08 1D 00 08 2D 08 00 30 00 00 00 .byte $40, $08, $08, $31, $00, $08, $41, $08, $10, $32, $00, $10, $42, $08, $18, $33 ; CPU:$DF60 PRG:1F60 40 08 08 31 00 08 41 08 10 32 00 10 42 08 18 33 .byte $00, $18, $43, $08, $00, $38, $00, $00, $00, $48, $08, $08, $39, $00, $08, $49 ; CPU:$DF70 PRG:1F70 00 18 43 08 00 38 00 00 00 48 08 08 39 00 08 49 .byte $08, $10, $3A, $00, $10, $4A, $08, $18, $3B, $00, $18, $4B, $08, $00, $44, $00 ; CPU:$DF80 PRG:1F80 08 10 3A 00 10 4A 08 18 3B 00 18 4B 08 00 44 00 .byte $00, $00, $54, $08, $08, $45, $00, $08, $55, $08, $10, $46, $00, $10, $56, $08 ; CPU:$DF90 PRG:1F90 00 00 54 08 08 45 00 08 55 08 10 46 00 10 56 08 .byte $18, $47, $00, $18, $57, $08, $00, $8C, $00, $00, $00, $9C, $08, $08, $8D, $00 ; CPU:$DFA0 PRG:1FA0 18 47 00 18 57 08 00 8C 00 00 00 9C 08 08 8D 00 .byte $08, $9D, $08, $10, $8E, $00, $10, $9E, $08, $18, $8F, $00, $18, $9F, $08, $00 ; CPU:$DFB0 PRG:1FB0 08 9D 08 10 8E 00 10 9E 08 18 8F 00 18 9F 08 00 .byte $04, $02, $00, $00, $14, $08, $00, $24, $10, $08, $05, $00, $08, $15, $08, $08 ; CPU:$DFC0 PRG:1FC0 04 02 00 00 14 08 00 24 10 08 05 00 08 15 08 08 .byte $25, $10, $00, $01, $01, $00, $00, $01, $08, $00, $01, $10, $00, $01, $18, $00 ; CPU:$DFD0 PRG:1FD0 25 10 00 01 01 00 00 01 08 00 01 10 00 01 18 00 .byte $01, $20, $00, $01, $28, $00, $01, $30, $00, $01, $38, $00, $01, $40, $08, $06 ; CPU:$DFE0 PRG:1FE0 01 20 00 01 28 00 01 30 00 01 38 00 01 40 08 06 .byte $00, $08, $06, $08, $08, $06, $10, $08, $06, $18, $08, $06, $20, $08, $06, $28 ; CPU:$DFF0 PRG:1FF0 00 08 06 08 08 06 10 08 06 18 08 06 20 08 06 28 .byte $08, $06, $30, $08, $06, $38, $08, $06, $40, $00, $0B, $02, $00, $00, $1B, $08 ; CPU:$E000 PRG:2000 08 06 30 08 06 38 08 06 40 00 0B 02 00 00 1B 08 .byte $08, $0C, $00, $08, $1C, $08, $00, $85, $FF, $03, $00, $00, $86, $03, $08, $00 ; CPU:$E010 PRG:2010 08 0C 00 08 1C 08 00 85 FF 03 00 00 86 03 08 00 .byte $85, $83, $10, $08, $88, $03, $00, $08, $87, $03, $08, $08, $88, $83, $10, $10 ; CPU:$E020 PRG:2020 85 83 10 08 88 03 00 08 87 03 08 08 88 83 10 10 .byte $85, $43, $00, $10, $86, $43, $08, $10, $85, $C3, $10, $00, $89, $FF, $03, $00 ; CPU:$E030 PRG:2030 85 43 00 10 86 43 08 10 85 C3 10 00 89 FF 03 00 .byte $00, $96, $C3, $08, $00, $97, $C3, $10, $08, $8A, $03, $00, $08, $95, $03, $08 ; CPU:$E040 PRG:2040 00 96 C3 08 00 97 C3 10 08 8A 03 00 08 95 03 08 .byte $08, $8A, $C3, $10, $10, $97, $03, $00, $10, $96, $03, $08, $10, $89, $C3, $10 ; CPU:$E050 PRG:2050 08 8A C3 10 10 97 03 00 10 96 03 08 10 89 C3 10 .byte $00, $97, $FF, $43, $00, $00, $96, $43, $08, $00, $89, $83, $10, $08, $8A, $43 ; CPU:$E060 PRG:2060 00 97 FF 43 00 00 96 43 08 00 89 83 10 08 8A 43 .byte $00, $08, $95, $43, $08, $08, $8A, $83, $10, $10, $89, $43, $00, $10, $96, $83 ; CPU:$E070 PRG:2070 00 08 95 43 08 08 8A 83 10 10 89 43 00 10 96 83 .byte $08, $10, $97, $83, $10, $00, $F3, $03, $00, $09, $00, $00, $C0, $03, $00, $F8 ; CPU:$E080 PRG:2080 08 10 97 83 10 00 F3 03 00 09 00 00 C0 03 00 F8 .byte $C1, $00, $F0, $C2, $00, $F0, $F0, $08, $E8, $C0, $08, $E0, $C1, $08, $D8, $C2 ; CPU:$E090 PRG:2090 C1 00 F0 C2 00 F0 F0 08 E8 C0 08 E0 C1 08 D8 C2 .byte $08, $D8, $F0, $10, $D0, $C0, $10, $07, $00, $00, $FB, $03, $00, $F8, $FB, $04 ; CPU:$E0A0 PRG:20A0 08 D8 F0 10 D0 C0 10 07 00 00 FB 03 00 F8 FB 04 .byte $F0, $FB, $08, $E8, $FB, $0C, $E0, $FB, $10, $D8, $FB, $14, $D0, $FB, $18, $06 ; CPU:$E0B0 PRG:20B0 F0 FB 08 E8 FB 0C E0 FB 10 D8 FB 14 D0 FB 18 06 .byte $00, $00, $B2, $03, $00, $F8, $B2, $06, $F0, $B2, $0C, $E8, $B2, $12, $E0, $B2 ; CPU:$E0C0 PRG:20C0 00 00 B2 03 00 F8 B2 06 F0 B2 0C E8 B2 12 E0 B2 .byte $18, $D8, $B2, $1E, $05, $00, $00, $B4, $03, $00, $F8, $B4, $08, $F0, $B4, $10 ; CPU:$E0D0 PRG:20D0 18 D8 B2 1E 05 00 00 B4 03 00 F8 B4 08 F0 B4 10 .byte $E8, $B4, $18, $E0, $B4, $20, $06, $00, $00, $B3, $03, $00, $FA, $B3, $08, $F4 ; CPU:$E0E0 PRG:20E0 E8 B4 18 E0 B4 20 06 00 00 B3 03 00 FA B3 08 F4 .byte $B3, $10, $EE, $B3, $18, $E8, $B3, $20, $E2, $B3, $28, $06, $00, $00, $B7, $03 ; CPU:$E0F0 PRG:20F0 B3 10 EE B3 18 E8 B3 20 E2 B3 28 06 00 00 B7 03 .byte $00, $FC, $B7, $08, $F8, $B7, $10, $F4, $B7, $18, $F0, $B7, $20, $EC, $B7, $28 ; CPU:$E100 PRG:2100 00 FC B7 08 F8 B7 10 F4 B7 18 F0 B7 20 EC B7 28 .byte $09, $00, $00, $C7, $03, $00, $00, $BA, $08, $00, $BB, $10, $F8, $BC, $10, $F8 ; CPU:$E110 PRG:2110 09 00 00 C7 03 00 00 BA 08 00 BB 10 F8 BC 10 F8 .byte $C7, $18, $F8, $BA, $20, $F8, $BB, $28, $F0, $BC, $28, $F0, $C7, $30, $07, $00 ; CPU:$E120 PRG:2120 C7 18 F8 BA 20 F8 BB 28 F0 BC 28 F0 C7 30 07 00 .byte $00, $AC, $03, $00, $00, $8B, $08, $00, $9B, $10, $FC, $AC, $18, $FC, $8B, $20 ; CPU:$E130 PRG:2130 00 AC 03 00 00 8B 08 00 9B 10 FC AC 18 FC 8B 20 .byte $FC, $9B, $28, $F8, $AC, $30, $07, $00, $00, $AB, $03, $00, $00, $AB, $08, $00 ; CPU:$E140 PRG:2140 FC 9B 28 F8 AC 30 07 00 00 AB 03 00 00 AB 08 00 .byte $AB, $10, $00, $AB, $18, $00, $AB, $20, $00, $AB, $28, $00, $AB, $30, $07, $00 ; CPU:$E150 PRG:2150 AB 10 00 AB 18 00 AB 20 00 AB 28 00 AB 30 07 00 .byte $00, $AC, $43, $00, $00, $8B, $08, $00, $9B, $10, $04, $AC, $18, $04, $8B, $20 ; CPU:$E160 PRG:2160 00 AC 43 00 00 8B 08 00 9B 10 04 AC 18 04 8B 20 .byte $04, $9B, $28, $08, $AC, $30, $09, $00, $00, $C7, $43, $00, $00, $BA, $08, $00 ; CPU:$E170 PRG:2170 04 9B 28 08 AC 30 09 00 00 C7 43 00 00 BA 08 00 .byte $BB, $10, $08, $BC, $10, $08, $C7, $18, $08, $BA, $20, $08, $BB, $28, $10, $BC ; CPU:$E180 PRG:2180 BB 10 08 BC 10 08 C7 18 08 BA 20 08 BB 28 10 BC .byte $28, $10, $C7, $30, $06, $00, $00, $B7, $43, $00, $04, $B7, $08, $08, $B7, $10 ; CPU:$E190 PRG:2190 28 10 C7 30 06 00 00 B7 43 00 04 B7 08 08 B7 10 .byte $0C, $B7, $18, $10, $B7, $20, $14, $B7, $28, $06, $00, $00, $B3, $43, $00, $06 ; CPU:$E1A0 PRG:21A0 0C B7 18 10 B7 20 14 B7 28 06 00 00 B3 43 00 06 .byte $B3, $08, $0C, $B3, $10, $12, $B3, $18, $18, $B3, $20, $1E, $B3, $28, $05, $00 ; CPU:$E1B0 PRG:21B0 B3 08 0C B3 10 12 B3 18 18 B3 20 1E B3 28 05 00 .byte $00, $B4, $43, $00, $08, $B4, $08, $10, $B4, $10, $18, $B4, $18, $20, $B4, $20 ; CPU:$E1C0 PRG:21C0 00 B4 43 00 08 B4 08 10 B4 10 18 B4 18 20 B4 20 .byte $06, $00, $00, $B2, $43, $00, $08, $B2, $06, $10, $B2, $0C, $18, $B2, $12, $20 ; CPU:$E1D0 PRG:21D0 06 00 00 B2 43 00 08 B2 06 10 B2 0C 18 B2 12 20 .byte $B2, $18, $28, $B2, $1E, $07, $00, $00, $FB, $43, $00, $08, $FB, $04, $10, $FB ; CPU:$E1E0 PRG:21E0 B2 18 28 B2 1E 07 00 00 FB 43 00 08 FB 04 10 FB .byte $08, $18, $FB, $0C, $20, $FB, $10, $28, $FB, $14, $30, $FB, $18, $09, $00, $00 ; CPU:$E1F0 PRG:21F0 08 18 FB 0C 20 FB 10 28 FB 14 30 FB 18 09 00 00 .byte $C0, $43, $00, $08, $C1, $00, $10, $C2, $00, $10, $F0, $08, $18, $C0, $08, $20 ; CPU:$E200 PRG:2200 C0 43 00 08 C1 00 10 C2 00 10 F0 08 18 C0 08 20 .byte $C1, $08, $28, $C2, $08, $28, $F0, $10, $30, $C0, $10, $00, $82, $FF, $02, $00 ; CPU:$E210 PRG:2210 C1 08 28 C2 08 28 F0 10 30 C0 10 00 82 FF 02 00 .byte $00, $92, $02, $08, $00, $A2, $02, $10, $08, $83, $02, $00, $08, $93, $02, $08 ; CPU:$E220 PRG:2220 00 92 02 08 00 A2 02 10 08 83 02 00 08 93 02 08 .byte $08, $A3, $02, $10, $00, $80, $FF, $02, $00, $00, $90, $02, $08, $00, $A0, $02 ; CPU:$E230 PRG:2230 08 A3 02 10 00 80 FF 02 00 00 90 02 08 00 A0 02 .byte $10, $08, $81, $02, $00, $08, $91, $02, $08, $08, $A1, $02, $10, $01, $00, $00 ; CPU:$E240 PRG:2240 10 08 81 02 00 08 91 02 08 08 A1 02 10 01 00 00 .byte $05, $0B, $0C, $0D, $0E, $0F, $01, $01, $00, $05, $1B, $1C, $1D, $1E, $1F, $01 ; CPU:$E250 PRG:2250 05 0B 0C 0D 0E 0F 01 01 00 05 1B 1C 1D 1E 1F 01 .byte $02, $00, $05, $1B, $1C, $1D, $1E, $1F, $01, $03, $00, $05, $2B, $2C, $2D, $2E ; CPU:$E260 PRG:2260 02 00 05 1B 1C 1D 1E 1F 01 03 00 05 2B 2C 2D 2E .byte $2F, $00, $01, $00, $00, $04, $67, $EA, $EB, $EC, $01, $01, $00, $04, $67, $FA ; CPU:$E270 PRG:2270 2F 00 01 00 00 04 67 EA EB EC 01 01 00 04 67 FA .byte $FB, $FC, $00, $01, $00, $00, $02, $CA, $CB, $01, $01, $00, $03, $DA, $DB, $DC ; CPU:$E280 PRG:2280 FB FC 00 01 00 00 02 CA CB 01 01 00 03 DA DB DC .byte $00, $01, $00, $00, $02, $67, $BE, $01, $01, $00, $03, $CD, $CE, $CF, $00, $01 ; CPU:$E290 PRG:2290 00 01 00 00 02 67 BE 01 01 00 03 CD CE CF 00 01 .byte $00, $00, $06, $D4, $D5, $D6, $D7, $D5, $D8, $01, $01, $02, $02, $D2, $E7, $01 ; CPU:$E2A0 PRG:22A0 00 00 06 D4 D5 D6 D7 D5 D8 01 01 02 02 D2 E7 01 .byte $02, $02, $02, $D2, $E7, $00, $02, $00, $00, $02, $62, $72, $02, $00, $01, $02 ; CPU:$E2B0 PRG:22B0 02 02 02 D2 E7 00 02 00 00 02 62 72 02 00 01 02 .byte $63, $73, $02, $00, $02, $02, $64, $74, $02, $00, $03, $02, $65, $75, $02, $00 ; CPU:$E2C0 PRG:22C0 63 73 02 00 02 02 64 74 02 00 03 02 65 75 02 00 .byte $04, $02, $66, $76, $00, $02, $00, $00, $03, $81, $91, $A1, $02, $00, $01, $03 ; CPU:$E2D0 PRG:22D0 04 02 66 76 00 02 00 00 03 81 91 A1 02 00 01 03 .byte $82, $92, $A2, $02, $00, $02, $03, $83, $93, $A3, $02, $00, $FF, $03, $67, $67 ; CPU:$E2E0 PRG:22E0 82 92 A2 02 00 02 03 83 93 A3 02 00 FF 03 67 67 .byte $67, $02, $00, $03, $03, $67, $67, $67, $00, $02, $00, $00, $03, $67, $94, $67 ; CPU:$E2F0 PRG:22F0 67 02 00 03 03 67 67 67 00 02 00 00 03 67 94 67 .byte $02, $00, $01, $03, $85, $95, $A5, $02, $00, $02, $03, $86, $96, $A6, $02, $00 ; CPU:$E300 PRG:2300 02 00 01 03 85 95 A5 02 00 02 03 86 96 A6 02 00 .byte $03, $03, $87, $97, $A7, $02, $00, $04, $03, $67, $67, $67, $00, $02, $00, $00 ; CPU:$E310 PRG:2310 03 03 87 97 A7 02 00 04 03 67 67 67 00 02 00 00 .byte $03, $88, $98, $A8, $02, $00, $01, $03, $89, $99, $A9, $02, $00, $02, $03, $8A ; CPU:$E320 PRG:2320 03 88 98 A8 02 00 01 03 89 99 A9 02 00 02 03 8A .byte $9A, $AA, $02, $00, $03, $03, $8B, $9B, $AB, $00, $02, $00, $00, $03, $8C, $9C ; CPU:$E330 PRG:2330 9A AA 02 00 03 03 8B 9B AB 00 02 00 00 03 8C 9C .byte $AC, $02, $00, $01, $03, $8D, $9D, $AD, $02, $00, $02, $03, $8E, $9E, $AE, $02 ; CPU:$E340 PRG:2340 AC 02 00 01 03 8D 9D AD 02 00 02 03 8E 9E AE 02 .byte $00, $03, $03, $67, $9F, $67, $02, $00, $FF, $03, $67, $67, $67, $00, $02, $00 ; CPU:$E350 PRG:2350 00 03 03 67 9F 67 02 00 FF 03 67 67 67 00 02 00 .byte $00, $02, $E2, $F2, $02, $00, $01, $02, $E2, $F2, $00, $02, $00, $00, $02, $E4 ; CPU:$E360 PRG:2360 00 02 E2 F2 02 00 01 02 E2 F2 00 02 00 00 02 E4 .byte $F4, $02, $00, $01, $02, $E4, $F4, $00, $01, $00, $00, $04, $E2, $E3, $E3, $E2 ; CPU:$E370 PRG:2370 F4 02 00 01 02 E4 F4 00 01 00 00 04 E2 E3 E3 E2 .byte $01, $01, $00, $04, $F2, $F3, $F3, $F2, $00, $01, $00, $00, $04, $E4, $E5, $E5 ; CPU:$E380 PRG:2380 01 01 00 04 F2 F3 F3 F2 00 01 00 00 04 E4 E5 E5 .byte $E4, $01, $01, $00, $04, $F4, $F3, $F3, $F4, $00, $01, $00, $00, $06, $E2, $E3 ; CPU:$E390 PRG:2390 E4 01 01 00 04 F4 F3 F3 F4 00 01 00 00 06 E2 E3 .byte $E3, $E3, $E3, $E2, $01, $01, $00, $06, $F2, $F3, $F3, $F3, $F3, $F2, $00, $01 ; CPU:$E3A0 PRG:23A0 E3 E3 E3 E2 01 01 00 06 F2 F3 F3 F3 F3 F2 00 01 .byte $00, $00, $06, $E4, $E5, $E5, $E5, $E5, $E4, $01, $01, $00, $06, $F4, $F3, $F3 ; CPU:$E3B0 PRG:23B0 00 00 06 E4 E5 E5 E5 E5 E4 01 01 00 06 F4 F3 F3 .byte $F3, $F3, $F4, $00, $57, $0A, $5F, $3C, $3D, $3E, $3F, $57, $12, $5F, $57, $0A ; CPU:$E3C0 PRG:23C0 F3 F3 F4 00 57 0A 5F 3C 3D 3E 3F 57 12 5F 57 0A .byte $5E, $68, $69, $6A, $6B, $57, $1C, $5E, $78, $00, $00, $7B, $57, $12, $5E, $61 ; CPU:$E3D0 PRG:23D0 5E 68 69 6A 6B 57 1C 5E 78 00 00 7B 57 12 5E 61 .byte $60, $61, $60, $61, $60, $61, $60, $61, $60, $6C, $6D, $00, $6F, $61, $60, $61 ; CPU:$E3E0 PRG:23E0 60 61 60 61 60 61 60 61 60 6C 6D 00 6F 61 60 61 .byte $60, $61, $60, $61, $60, $61, $60, $61, $60, $61, $60, $61, $60, $61, $60, $71 ; CPU:$E3F0 PRG:23F0 60 61 60 61 60 61 60 61 60 61 60 61 60 61 60 71 .byte $70, $71, $70, $71, $70, $71, $70, $71, $70, $7C, $7D, $7E, $7F, $71, $70, $71 ; CPU:$E400 PRG:2400 70 71 70 71 70 71 70 71 70 7C 7D 7E 7F 71 70 71 .byte $70, $71, $70, $71, $70, $71, $70, $71, $70, $71, $70, $71, $70, $71, $70, $5A ; CPU:$E410 PRG:2410 70 71 70 71 70 71 70 71 70 71 70 71 70 71 70 5A .byte $57, $20, $A4, $5A, $57, $20, $E8, $5A, $57, $08, $00, $57, $08, $A0, $0F, $0F ; CPU:$E420 PRG:2420 57 20 A4 5A 57 20 E8 5A 57 08 00 57 08 A0 0F 0F .byte $8B, $2E, $57, $04, $0F, $57, $08, $55, $57, $18, $55, $57, $08, $05, $5A, $57 ; CPU:$E430 PRG:2430 8B 2E 57 04 0F 57 08 55 57 18 55 57 08 05 5A 57 .byte $08, $00, $57, $08, $A0, $57, $08, $00, $57, $08, $AA, $57, $08, $AA, $0F, $0F ; CPU:$E440 PRG:2440 08 00 57 08 A0 57 08 00 57 08 AA 57 08 AA 0F 0F .byte $8B, $2E, $57, $04, $0F, $57, $10, $55, $5A, $57, $20, $67, $57, $20, $77, $57 ; CPU:$E450 PRG:2450 8B 2E 57 04 0F 57 10 55 5A 57 20 67 57 20 77 57 .byte $40, $67, $5A, $57, $20, $67, $57, $20, $77, $57, $40, $67, $5A, $57, $40, $67 ; CPU:$E460 PRG:2460 40 67 5A 57 20 67 57 20 77 57 40 67 5A 57 40 67 .byte $57, $20, $77, $57, $60, $67, $5A, $57, $20, $79, $57, $20, $77, $57, $20, $18 ; CPU:$E470 PRG:2470 57 20 77 57 60 67 5A 57 20 79 57 20 77 57 20 18 .byte $57, $20, $67, $5A ; CPU:$E480 PRG:2480 57 20 67 5A ;=============================================================================== ; Routine: UpdateActorScroll ; Global: The routine calls DecrementActorScore, reads $0218. ; Local: Executes 9 instructions: loads Y from Zp9B; branches on equal to ; UpdateActorScroll_OnNonzero_2; decrements Y; branches on equal to UpdateActorScroll_Loop_2; calls ; DecrementActorScore; branches on non-negative to UpdateActorScroll_Loop; and 3 more ; instructions. ; Parameters: Reads $0218 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. ; ;=============================================================================== UpdateActorScroll: ldy Zp9B ; CPU:$E484 PRG:2484 A4 9B beq UpdateActorScroll_OnNonzero_2 ; CPU:$E486 PRG:2486 F0 2B dey ; CPU:$E488 PRG:2488 88 beq UpdateActorScroll_Loop_2 ; CPU:$E489 PRG:2489 F0 29 jsr DecrementActorScore ; CPU:$E48B PRG:248B 20 97 DB bpl UpdateActorScroll_Loop ; CPU:$E48E PRG:248E 10 07 lda $0218 ; CPU:$E490 PRG:2490 AD 18 02 cmp #$B0 ; CPU:$E493 PRG:2493 C9 B0 bcs UpdateActorScroll_OnNonzero; CPU:$E495 PRG:2495 B0 13 ;=============================================================================== ; Routine: UpdateActorScroll_Loop ; Global: The routine calls LoadActorScreenRow, SelectActorSpriteIndex and StoreActorBoxTargetTwo, writes $0218, ; reads $0218 and $03A6. ; Local: Executes 7 instructions: loads A from $0218; sets the carry flag; ; subtracts $03A6 from A; stores A to $0218; calls LoadActorScreenRow; calls ; SelectActorSpriteIndex; and 1 more instruction. ; Parameters: Reads $0218 and $03A6 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. Leaves $0218 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== UpdateActorScroll_Loop: lda $0218 ; CPU:$E497 PRG:2497 AD 18 02 sec ; CPU:$E49A PRG:249A 38 sbc $03A6 ; CPU:$E49B PRG:249B ED A6 03 sta $0218 ; CPU:$E49E PRG:249E 8D 18 02 jsr LoadActorScreenRow ; CPU:$E4A1 PRG:24A1 20 21 E5 jsr SelectActorSpriteIndex ; CPU:$E4A4 PRG:24A4 20 09 E5 jmp StoreActorBoxTargetTwo ; CPU:$E4A7 PRG:24A7 4C E0 E4 ;=============================================================================== ; Routine: UpdateActorScroll_OnNonzero ; Global: The routine writes $0218. ; Local: Executes 4 instructions: loads A with $F4; stores A to $0218; loads A ; with $00; stores A to Zp9B. ; 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 $0218 changed. ; Clobbers: ; A, the N and Z flags, Zp9B, the OAM shadow. ; ;=============================================================================== UpdateActorScroll_OnNonzero: lda #$F4 ; CPU:$E4AA PRG:24AA A9 F4 sta $0218 ; CPU:$E4AC PRG:24AC 8D 18 02 lda #$00 ; CPU:$E4AF PRG:24AF A9 00 sta Zp9B ; CPU:$E4B1 PRG:24B1 85 9B ;=============================================================================== ; Routine: UpdateActorScroll_OnNonzero_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== UpdateActorScroll_OnNonzero_2: rts ; CPU:$E4B3 PRG:24B3 60 ;=============================================================================== ; Routine: UpdateActorScroll_Loop_2 ; Global: The routine calls PlaySoundEffectById and LoadActorScreenRow, writes $03A6, $03A4 and ; $03A5. ; Local: Executes 13 instructions: returns with RTS; loads A from ZpDF; ; branches on not equal to UpdateActorScroll_OnNonzero_2; loads A with $04; calls ; PlaySoundEffectById; loads A with $04; 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. Leaves $03A6, $03A4 and $03A5 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== UpdateActorScroll_Loop_2: lda ZpDF ; CPU:$E4B4 PRG:24B4 A5 DF bne UpdateActorScroll_OnNonzero_2 ; CPU:$E4B6 PRG:24B6 D0 FB lda #$04 ; CPU:$E4B8 PRG:24B8 A9 04 jsr PlaySoundEffectById ; CPU:$E4BA PRG:24BA 20 0D F8 lda #$04 ; CPU:$E4BD PRG:24BD A9 04 sta $03A6 ; CPU:$E4BF PRG:24BF 8D A6 03 lda #$13 ; CPU:$E4C2 PRG:24C2 A9 13 sta $03A4 ; CPU:$E4C4 PRG:24C4 8D A4 03 lda #$00 ; CPU:$E4C7 PRG:24C7 A9 00 sta $03A5 ; CPU:$E4C9 PRG:24C9 8D A5 03 jsr LoadActorScreenRow ; CPU:$E4CC PRG:24CC 20 21 E5 ldy #$02 ; CPU:$E4CF PRG:24CF A0 02 ;=============================================================================== ; Routine: UpdateActorScroll_OnNonnegative ; Global: The routine reads no RAM 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 $E4DD,y; stores A to $0218,y; ; decrements Y; branches on non-negative to UpdateActorScroll_OnNonnegative; increments ; Zp9B; 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, Zp9B, the OAM shadow. ; ;=============================================================================== UpdateActorScroll_OnNonnegative: lda $E4DD,y ; CPU:$E4D1 PRG:24D1 B9 DD E4 sta $0218,y ; CPU:$E4D4 PRG:24D4 99 18 02 dey ; CPU:$E4D7 PRG:24D7 88 bpl UpdateActorScroll_OnNonnegative ; CPU:$E4D8 PRG:24D8 10 F7 inc Zp9B ; CPU:$E4DA PRG:24DA E6 9B rts ; CPU:$E4DC PRG:24DC 60 ; ---- data $E4DD-$E4DF (3 bytes) ---- ; referenced by `lda $E4DD,y` at $E4D1 (operand $E4DD falls inside this region) ActorOamSpriteBytes: .byte $B0, $02, $03 ; CPU:$E4DD PRG:24DD B0 02 03 ;=============================================================================== ; Routine: StoreActorBoxTargetTwo ; Global: The routine calls SetActorScreenRowFour, CheckActorBoxOverlap and SetActorScreenRowThree, writes $0218, ; $03C8, $03C9, $03CA and 1 more, reads $0218 and $021B. ; Local: Executes 18 instructions: loads A with $F4; stores A to $0218; loads ; A with $00; stores A to Zp9B; returns with RTS; calls SetActorScreenRowFour; and ; 12 more instructions. ; Parameters: Reads $0218 and $021B 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 $0218, $03C8 and $03C9 changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the OAM shadow and the RAM fields ; it writes. ; ;=============================================================================== StoreActorBoxTargetTwo: jsr SetActorScreenRowFour ; CPU:$E4E0 PRG:24E0 20 1F E9 lda #$08 ; CPU:$E4E3 PRG:24E3 A9 08 sta $03C8 ; CPU:$E4E5 PRG:24E5 8D C8 03 sta $03C9 ; CPU:$E4E8 PRG:24E8 8D C9 03 lda $0218 ; CPU:$E4EB PRG:24EB AD 18 02 sta $03CA ; CPU:$E4EE PRG:24EE 8D CA 03 lda $021B ; CPU:$E4F1 PRG:24F1 AD 1B 02 sta $03CB ; CPU:$E4F4 PRG:24F4 8D CB 03 jsr CheckActorBoxOverlap ; CPU:$E4F7 PRG:24F7 20 7E CC bcs StoreActorBoxTargetTwo_Loop; CPU:$E4FA PRG:24FA B0 08 jsr SetActorScreenRowThree ; CPU:$E4FC PRG:24FC 20 03 E9 jsr CheckActorBoxOverlap ; CPU:$E4FF PRG:24FF 20 7E CC bcc UpdateActorScroll_OnNonzero_2 ; CPU:$E502 PRG:2502 90 AF ;=============================================================================== ; Routine: StoreActorBoxTargetTwo_Loop ; Global: The routine writes $0218, reads $033F. ; Local: Executes 7 instructions: loads A with $F4; stores A to $0218; loads A ; with $00; stores A to Zp9B; returns with RTS; increments $033F; and ; 1 more instruction. ; Parameters: Reads $033F 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 $0218 changed. ; Clobbers: ; A and Y, the N and Z flags, Zp9B, Zp9D, the OAM shadow, $033F. ; ;=============================================================================== StoreActorBoxTargetTwo_Loop: inc $033F ; CPU:$E504 PRG:2504 EE 3F 03 bne UpdateActorScroll_OnNonzero; CPU:$E507 PRG:2507 D0 A1 ;=============================================================================== ; Routine: SelectActorSpriteIndex ; Global: The routine writes $0219. ; Local: Executes 11 instructions: returns with RTS; loads A from Zp09; ANDs A ; with $03; branches on not equal to UpdateActorScroll_OnNonzero_2; increments Zp9D; loads ; A from Zp9D; 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 $0219 changed. ; Clobbers: ; A and Y, the N and Z flags, Zp9D, the OAM shadow. ; ;=============================================================================== SelectActorSpriteIndex: lda Zp09 ; CPU:$E509 PRG:2509 A5 09 and #$03 ; CPU:$E50B PRG:250B 29 03 bne UpdateActorScroll_OnNonzero_2 ; CPU:$E50D PRG:250D D0 A4 inc Zp9D ; CPU:$E50F PRG:250F E6 9D lda Zp9D ; CPU:$E511 PRG:2511 A5 9D and #$03 ; CPU:$E513 PRG:2513 29 03 tay ; CPU:$E515 PRG:2515 A8 lda $E51D,y ; CPU:$E516 PRG:2516 B9 1D E5 sta $0219 ; CPU:$E519 PRG:2519 8D 19 02 rts ; CPU:$E51C PRG:251C 60 ; ---- data $E51D-$E520 (4 bytes) ---- ; referenced by `lda $E51D,y` at $E516 (operand $E51D falls inside this region) ActorOamSpriteTileTable: .byte $02, $36, $13, $37 ; CPU:$E51D PRG:251D 02 36 13 37 ;=============================================================================== ; Routine: LoadActorScreenRow ; Global: The routine calls LoadActorPosition, writes $021B. ; Local: Executes 6 instructions: loads X from Zp9C; calls LoadActorPosition; clears ; the carry flag; adds $08 to A; stores A to $021B; 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 $021B changed. ; Clobbers: ; A and X, the N, Z, C and V flags, Zp77, Zp78, Zp7A, the OAM shadow. ; ;=============================================================================== LoadActorScreenRow: ldx Zp9C ; CPU:$E521 PRG:2521 A6 9C jsr LoadActorPosition ; CPU:$E523 PRG:2523 20 16 CC clc ; CPU:$E526 PRG:2526 18 adc #$08 ; CPU:$E527 PRG:2527 69 08 sta $021B ; CPU:$E529 PRG:2529 8D 1B 02 rts ; CPU:$E52C PRG:252C 60 ;=============================================================================== ; Routine: AdvanceActorScriptIndex ; Global: The routine calls LoadActorScriptPointer. ; Local: Executes 2 instructions: increments ZpCF; calls LoadActorScriptPointer. ; 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. ; ;=============================================================================== AdvanceActorScriptIndex: inc ZpCF ; CPU:$E52D PRG:252D E6 CF jmp LoadActorScriptPointer ; CPU:$E52F PRG:252F 4C 06 C9 ; ---- data $E532-$E561 (48 bytes) ---- .byte $A6, $CF, $F0, $F7, $A5, $0F, $F0, $03, $4C, $AB, $DC, $20, $07, $D8, $20, $11 ; CPU:$E532 PRG:2532 A6 CF F0 F7 A5 0F F0 03 4C AB DC 20 07 D8 20 11 .byte $DA, $B0, $03, $20, $B6, $DB, $20, $1D, $E6, $20, $BA, $E7, $20, $9F, $E7, $20 ; CPU:$E542 PRG:2542 DA B0 03 20 B6 DB 20 1D E6 20 BA E7 20 9F E7 20 .byte $B0, $E5, $20, $38, $E8, $20, $84, $E4, $A5, $52, $D0, $23, $A2, $20, $A0, $02 ; CPU:$E552 PRG:2552 B0 E5 20 38 E8 20 84 E4 A5 52 D0 23 A2 20 A0 02 ;=============================================================================== ; Routine: FlipActorSprite ; Global: The routine calls InitActorSpriteDraw. ; Local: Executes 9 instructions: loads A from $0500,x; branches on equal to ; FlipActorSprite_Loop; loads A from $0504,x; EORs A with $01; stores A to ; $0504,x; 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: 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 RAM fields it writes. ; ;=============================================================================== FlipActorSprite: lda $0500,x ; CPU:$E562 PRG:2562 BD 00 05 beq FlipActorSprite_Loop ; CPU:$E565 PRG:2565 F0 11 lda $0504,x ; CPU:$E567 PRG:2567 BD 04 05 eor #$01 ; CPU:$E56A PRG:256A 49 01 sta $0504,x ; CPU:$E56C PRG:256C 9D 04 05 lda #$FF ; CPU:$E56F PRG:256F A9 FF sty ZpFA ; CPU:$E571 PRG:2571 84 FA jsr InitActorSpriteDraw ; CPU:$E573 PRG:2573 20 26 ED ldy ZpFA ; CPU:$E576 PRG:2576 A4 FA ;=============================================================================== ; Routine: FlipActorSprite_Loop ; Global: The routine calls NextActorSlot and FlipActorSprite. ; Local: Executes 4 instructions: decrements Y; branches on equal to FlipActorSprite_Loop_2; ; calls NextActorSlot; calls FlipActorSprite. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 RAM fields it writes. ; ;=============================================================================== FlipActorSprite_Loop: dey ; CPU:$E578 PRG:2578 88 beq FlipActorSprite_Loop_2 ; CPU:$E579 PRG:2579 F0 06 jsr NextActorSlot ; CPU:$E57B PRG:257B 20 EC C9 jsr FlipActorSprite ; CPU:$E57E PRG:257E 20 62 E5 ;=============================================================================== ; Routine: FlipActorSprite_Loop_2 ; Global: The routine reads no RAM 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 Zp52; compares A with $05; ; branches on not equal to FlipActorSprite_Loop_3; 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: 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 RAM fields it writes. ; ;=============================================================================== FlipActorSprite_Loop_2: lda Zp52 ; CPU:$E581 PRG:2581 A5 52 cmp #$05 ; CPU:$E583 PRG:2583 C9 05 bne FlipActorSprite_Loop_3 ; CPU:$E585 PRG:2585 D0 0C ldx #$10 ; CPU:$E587 PRG:2587 A2 10 ;=============================================================================== ; Routine: FlipActorSprite_OnNonnegative ; Global: The routine calls CheckActorOnScreen and PreviousActorSlot. ; Local: Executes 4 instructions: calls CheckActorOnScreen; branches on carry set to ; FlipActorSprite_Loop_4; calls PreviousActorSlot; branches on non-negative to FlipActorSprite_OnNonnegative. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 RAM fields it writes. ; ;=============================================================================== FlipActorSprite_OnNonnegative: jsr CheckActorOnScreen ; CPU:$E589 PRG:2589 20 9A E5 bcs FlipActorSprite_Loop_4 ; CPU:$E58C PRG:258C B0 06 jsr PreviousActorSlot ; CPU:$E58E PRG:258E 20 F2 C9 bpl FlipActorSprite_OnNonnegative ; CPU:$E591 PRG:2591 10 F6 ;=============================================================================== ; Routine: FlipActorSprite_Loop_3 ; Global: The routine reads no RAM 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. ; ;=============================================================================== FlipActorSprite_Loop_3: rts ; CPU:$E593 PRG:2593 60 ;=============================================================================== ; Routine: FlipActorSprite_Loop_4 ; Global: The routine reads no RAM 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; loads Y with $67; branches ; on not equal to CheckActorAtEdge_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 RAM fields it writes. ; ;=============================================================================== FlipActorSprite_Loop_4: lda #$00 ; CPU:$E594 PRG:2594 A9 00 ldy #$67 ; CPU:$E596 PRG:2596 A0 67 bne CheckActorAtEdge_Loop_2 ; CPU:$E598 PRG:2598 D0 67 ;=============================================================================== ; Routine: CheckActorOnScreen ; Global: The routine calls LoadActorPosition. ; Local: Executes 8 instructions: loads A from $0500,x; branches on equal to ; CheckActorOnScreen_Loop; calls LoadActorPosition; branches on carry clear to CheckActorOnScreen_Loop; ; compares A with $20; branches on carry clear to CheckActorOnScreen_Loop; 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, Zp77, Zp78, Zp7A. ; ;=============================================================================== CheckActorOnScreen: lda $0500,x ; CPU:$E59A PRG:259A BD 00 05 beq CheckActorOnScreen_Loop ; CPU:$E59D PRG:259D F0 0D jsr LoadActorPosition ; CPU:$E59F PRG:259F 20 16 CC bcc CheckActorOnScreen_Loop ; CPU:$E5A2 PRG:25A2 90 08 cmp #$20 ; CPU:$E5A4 PRG:25A4 C9 20 bcc CheckActorOnScreen_Loop ; CPU:$E5A6 PRG:25A6 90 04 cmp #$D0 ; CPU:$E5A8 PRG:25A8 C9 D0 bcc CheckActorOnScreen_Loop_2 ; CPU:$E5AA PRG:25AA 90 02 ;=============================================================================== ; Routine: CheckActorOnScreen_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: 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. ; ;=============================================================================== CheckActorOnScreen_Loop: clc ; CPU:$E5AC PRG:25AC 18 rts ; CPU:$E5AD PRG:25AD 60 ;=============================================================================== ; Routine: CheckActorOnScreen_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== CheckActorOnScreen_Loop_2: sec ; CPU:$E5AE PRG:25AE 38 rts ; CPU:$E5AF PRG:25AF 60 ;=============================================================================== ; Routine: CheckActorAtEdge ; Global: The routine reads no RAM 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 with $00; stores A to Zp6C; loads A ; from ZpCA; compares A with $02; branches on equal to CheckActorAtEdge_Loop_4; ; loads A from Zp6A; 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 RAM fields it writes. ; ;=============================================================================== CheckActorAtEdge: lda #$00 ; CPU:$E5B0 PRG:25B0 A9 00 sta Zp6C ; CPU:$E5B2 PRG:25B2 85 6C lda ZpCA ; CPU:$E5B4 PRG:25B4 A5 CA cmp #$02 ; CPU:$E5B6 PRG:25B6 C9 02 beq CheckActorAtEdge_Loop_4 ; CPU:$E5B8 PRG:25B8 F0 62 lda Zp6A ; CPU:$E5BA PRG:25BA A5 6A cmp #$E0 ; CPU:$E5BC PRG:25BC C9 E0 bcc CheckActorAtEdge_Loop_3 ; CPU:$E5BE PRG:25BE 90 58 cmp #$E8 ; CPU:$E5C0 PRG:25C0 C9 E8 bcs CheckActorAtEdge_Loop_3 ; CPU:$E5C2 PRG:25C2 B0 54 lda #$01 ; CPU:$E5C4 PRG:25C4 A9 01 sta Zp6C ; CPU:$E5C6 PRG:25C6 85 6C ldx #$00 ; CPU:$E5C8 PRG:25C8 A2 00 lda $0500,x ; CPU:$E5CA PRG:25CA BD 00 05 beq CheckActorAtEdge_Loop ; CPU:$E5CD PRG:25CD F0 02 ldx #$10 ; CPU:$E5CF PRG:25CF A2 10 ;=============================================================================== ; Routine: CheckActorAtEdge_Loop ; Global: The routine calls FlipActorFacing. ; Local: Executes 21 instructions: loads A from Zp98; branches on not equal to ; CheckActorAtEdge_Loop_4; increments Zp98; loads A from Zp6A; ANDs A with $F8; ; stores A to $0501,x; 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: 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 RAM fields it writes. ; ;=============================================================================== CheckActorAtEdge_Loop: lda Zp98 ; CPU:$E5D1 PRG:25D1 A5 98 bne CheckActorAtEdge_Loop_4 ; CPU:$E5D3 PRG:25D3 D0 47 inc Zp98 ; CPU:$E5D5 PRG:25D5 E6 98 lda Zp6A ; CPU:$E5D7 PRG:25D7 A5 6A and #$F8 ; CPU:$E5D9 PRG:25D9 29 F8 sta $0501,x ; CPU:$E5DB PRG:25DB 9D 01 05 clc ; CPU:$E5DE PRG:25DE 18 adc #$08 ; CPU:$E5DF PRG:25DF 69 08 sta $0521,x ; CPU:$E5E1 PRG:25E1 9D 21 05 jsr FlipActorFacing ; CPU:$E5E4 PRG:25E4 20 6E F0 sta $0522,x ; CPU:$E5E7 PRG:25E7 9D 22 05 lda #$C0 ; CPU:$E5EA PRG:25EA A9 C0 sta $0503,x ; CPU:$E5EC PRG:25EC 9D 03 05 lda #$B0 ; CPU:$E5EF PRG:25EF A9 B0 sta $0523,x ; CPU:$E5F1 PRG:25F1 9D 23 05 lda #$01 ; CPU:$E5F4 PRG:25F4 A9 01 sta $0504,x ; CPU:$E5F6 PRG:25F6 9D 04 05 lda #$02 ; CPU:$E5F9 PRG:25F9 A9 02 sta $0524,x ; CPU:$E5FB PRG:25FB 9D 24 05 lda #$FF ; CPU:$E5FE PRG:25FE A9 FF tay ; CPU:$E600 PRG:2600 A8 ;=============================================================================== ; Routine: CheckActorAtEdge_Loop_2 ; Global: The routine calls InitActorSpriteDraw. ; Local: Executes 12 instructions: stores A to $0500,x; stores A to $0520,x; ; copies Y into A; pushes A; stores X to ZpF9; calls InitActorSpriteDraw; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== CheckActorAtEdge_Loop_2: sta $0500,x ; CPU:$E601 PRG:2601 9D 00 05 sta $0520,x ; CPU:$E604 PRG:2604 9D 20 05 tya ; CPU:$E607 PRG:2607 98 pha ; CPU:$E608 PRG:2608 48 stx ZpF9 ; CPU:$E609 PRG:2609 86 F9 jsr InitActorSpriteDraw ; CPU:$E60B PRG:260B 20 26 ED lda ZpF9 ; CPU:$E60E PRG:260E A5 F9 clc ; CPU:$E610 PRG:2610 18 adc #$20 ; CPU:$E611 PRG:2611 69 20 tax ; CPU:$E613 PRG:2613 AA pla ; CPU:$E614 PRG:2614 68 jmp InitActorSpriteDraw ; CPU:$E615 PRG:2615 4C 26 ED ;=============================================================================== ; Routine: CheckActorAtEdge_Loop_3 ; Global: The routine reads no RAM 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 Zp98. ; 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, Zp98. ; ;=============================================================================== CheckActorAtEdge_Loop_3: lda #$00 ; CPU:$E618 PRG:2618 A9 00 sta Zp98 ; CPU:$E61A PRG:261A 85 98 ;=============================================================================== ; Routine: CheckActorAtEdge_Loop_4 ; Global: The routine reads no RAM 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. ; ;=============================================================================== CheckActorAtEdge_Loop_4: rts ; CPU:$E61C PRG:261C 60 ;=============================================================================== ; Routine: ComputeActorEdge ; Global: The routine reads no RAM 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 Zp74; compares A with $40; ; branches on carry set to ComputeActorEdge_OnCarrySet; loads A from Zp90; branches on ; not equal to ComputeActorEdge_Loop; loads Y with $20; 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. ; ;=============================================================================== ComputeActorEdge: lda Zp74 ; CPU:$E61D PRG:261D A5 74 cmp #$40 ; CPU:$E61F PRG:261F C9 40 bcs ComputeActorEdge_OnCarrySet; CPU:$E621 PRG:2621 B0 0E lda Zp90 ; CPU:$E623 PRG:2623 A5 90 bne ComputeActorEdge_Loop ; CPU:$E625 PRG:2625 D0 06 ldy #$20 ; CPU:$E627 PRG:2627 A0 20 ldx #$40 ; CPU:$E629 PRG:2629 A2 40 bne ComputeActorEdge_Loop_3 ; CPU:$E62B PRG:262B D0 09 ;=============================================================================== ; Routine: ComputeActorEdge_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 A from ZpB0; branches on equal to ; ComputeActorEdge_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== ComputeActorEdge_Loop: lda ZpB0 ; CPU:$E62D PRG:262D A5 B0 beq ComputeActorEdge_Loop_2 ; CPU:$E62F PRG:262F F0 01 ;=============================================================================== ; Routine: ComputeActorEdge_OnCarrySet ; Global: The routine reads no RAM 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. ; ;=============================================================================== ComputeActorEdge_OnCarrySet: rts ; CPU:$E631 PRG:2631 60 ;=============================================================================== ; Routine: ComputeActorEdge_Loop_2 ; Global: The routine reads no RAM 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: returns with RTS; loads Y with $40; loads X ; with $20. ; 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. ; ;=============================================================================== ComputeActorEdge_Loop_2: ldy #$40 ; CPU:$E632 PRG:2632 A0 40 ldx #$20 ; CPU:$E634 PRG:2634 A2 20 ;=============================================================================== ; Routine: ComputeActorEdge_Loop_3 ; Global: The routine reads no RAM 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: returns with RTS; stores Y to Zp8C; loads A ; from ZpCA; branches on equal to ComputeActorEdge_Loop_4; shifts a right; branches ; on carry set to ComputeActorEdge_Loop_4; 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. ; ;=============================================================================== ComputeActorEdge_Loop_3: sty Zp8C ; CPU:$E636 PRG:2636 84 8C lda ZpCA ; CPU:$E638 PRG:2638 A5 CA beq ComputeActorEdge_Loop_4 ; CPU:$E63A PRG:263A F0 10 lsr a ; CPU:$E63C PRG:263C 4A bcs ComputeActorEdge_Loop_4 ; CPU:$E63D PRG:263D B0 0D rts ; CPU:$E63F PRG:263F 60 ; ---- data $E640-$E64B (12 bytes) ---- .byte $A5, $6A, $C9, $F0, $D0, $EB, $A9, $00, $85, $77, $F0, $13 ; CPU:$E640 PRG:2640 A5 6A C9 F0 D0 EB A9 00 85 77 F0 13 ;=============================================================================== ; Routine: ComputeActorEdge_Loop_4 ; Global: The routine calls ComputeActorTileIndex. ; Local: Executes 7 instructions: returns with RTS; calls ComputeActorTileIndex; loads A ; from Zp70,x; branches on equal to ComputeActorEdge_Loop_5; loads A from Zp74,x; ; compares A with Zp7B; 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. ; ;=============================================================================== ComputeActorEdge_Loop_4: jsr ComputeActorTileIndex ; CPU:$E64C PRG:264C 20 B0 E6 lda Zp70,x ; CPU:$E64F PRG:264F B5 70 beq ComputeActorEdge_Loop_5 ; CPU:$E651 PRG:2651 F0 06 lda Zp74,x ; CPU:$E653 PRG:2653 B5 74 cmp Zp7B ; CPU:$E655 PRG:2655 C5 7B bcs ComputeActorEdge_OnCarrySet; CPU:$E657 PRG:2657 B0 D8 ;=============================================================================== ; Routine: ComputeActorEdge_Loop_5 ; Global: The routine reads no RAM 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 Zp6D; loads A with $00; branches ; on equal to ComputeActorEdge_Loop_6; 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: 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. ; ;=============================================================================== ComputeActorEdge_Loop_5: inc Zp6D ; CPU:$E659 PRG:2659 E6 6D lda #$00 ; CPU:$E65B PRG:265B A9 00 beq ComputeActorEdge_Loop_6 ; CPU:$E65D PRG:265D F0 02 lda #$01 ; CPU:$E65F PRG:265F A9 01 ;=============================================================================== ; Routine: ComputeActorEdge_Loop_6 ; Global: The routine reads no RAM 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 Zp78; loads X from Zp8C; 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. ; ;=============================================================================== ComputeActorEdge_Loop_6: sta Zp78 ; CPU:$E661 PRG:2661 85 78 ldx Zp8C ; CPU:$E663 PRG:2663 A6 8C ldy #$00 ; CPU:$E665 PRG:2665 A0 00 ;=============================================================================== ; Routine: ComputeActorEdge_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 15 instructions: loads A from $E6A0,y; stores A to Zp70,x; ; loads A from $E6A8,y; stores A to Zp80,x; increments X; increments ; 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: 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. ; ;=============================================================================== ComputeActorEdge_OnCarryClear: lda $E6A0,y ; CPU:$E667 PRG:2667 B9 A0 E6 sta Zp70,x ; CPU:$E66A PRG:266A 95 70 lda $E6A8,y ; CPU:$E66C PRG:266C B9 A8 E6 sta Zp80,x ; CPU:$E66F PRG:266F 95 80 inx ; CPU:$E671 PRG:2671 E8 iny ; CPU:$E672 PRG:2672 C8 cpy #$08 ; CPU:$E673 PRG:2673 C0 08 bcc ComputeActorEdge_OnCarryClear ; CPU:$E675 PRG:2675 90 F0 ldx Zp8C ; CPU:$E677 PRG:2677 A6 8C lda Zp78 ; CPU:$E679 PRG:2679 A5 78 beq ComputeActorEdge_Loop_7 ; CPU:$E67B PRG:267B F0 08 lda #$00 ; CPU:$E67D PRG:267D A9 00 sta Zp74,x ; CPU:$E67F PRG:267F 95 74 lda #$0C ; CPU:$E681 PRG:2681 A9 0C sta Zp84,x ; CPU:$E683 PRG:2683 95 84 ;=============================================================================== ; Routine: ComputeActorEdge_Loop_7 ; Global: The routine reads no RAM 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 Zp77; branches on equal to ; ComputeActorEdge_Loop_8; loads A from Zp68; branches on equal to ComputeActorEdge_Loop_8; loads A ; with $FE; stores A to Zp71,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, the N, Z and C flags, Zp71, Zp72, Zp81, Zp82. ; ;=============================================================================== ComputeActorEdge_Loop_7: lda Zp77 ; CPU:$E685 PRG:2685 A5 77 beq ComputeActorEdge_Loop_8 ; CPU:$E687 PRG:2687 F0 0A lda Zp68 ; CPU:$E689 PRG:2689 A5 68 beq ComputeActorEdge_Loop_8 ; CPU:$E68B PRG:268B F0 06 lda #$FE ; CPU:$E68D PRG:268D A9 FE sta Zp71,x ; CPU:$E68F PRG:268F 95 71 sta Zp81,x ; CPU:$E691 PRG:2691 95 81 ;=============================================================================== ; Routine: ComputeActorEdge_Loop_8 ; Global: The routine reads no RAM 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 X with $20; branches on equal to ; ComputeActorEdge_Loop_9; loads A with $D8; stores A to Zp72,x; loads A with $44; ; stores A to Zp82,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, Zp72, Zp82. ; ;=============================================================================== ComputeActorEdge_Loop_8: cpx #$20 ; CPU:$E693 PRG:2693 E0 20 beq ComputeActorEdge_Loop_9 ; CPU:$E695 PRG:2695 F0 08 lda #$D8 ; CPU:$E697 PRG:2697 A9 D8 sta Zp72,x ; CPU:$E699 PRG:2699 95 72 lda #$44 ; CPU:$E69B PRG:269B A9 44 sta Zp82,x ; CPU:$E69D PRG:269D 95 82 ;=============================================================================== ; Routine: ComputeActorEdge_Loop_9 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ComputeActorEdge_Loop_9: rts ; CPU:$E69F PRG:269F 60 ; ---- data $E6A0-$E6AF (16 bytes) ---- ; referenced by `lda $E6A0,y` at $E667 (operand $E6A0 falls inside this region) ; referenced by `lda $E6A8,y` at $E66C (operand $E6A8 falls inside this region) ObjectInitialValueTable: .byte $01, $FF, $B0, $78, $F3, $00, $0C, $0A ; CPU:$E6A0 PRG:26A0 01 FF B0 78 F3 00 0C 0A ObjectInitialStateTable: .byte $01, $FF, $20, $68, $FF, $00, $0E, $09 ; CPU:$E6A8 PRG:26A8 01 FF 20 68 FF 00 0E 09 ;=============================================================================== ; Routine: ComputeActorTileIndex ; Global: The routine calls ComputeActorRowOffset and MultiplyActorValueBy16. ; Local: Executes 13 instructions: calls ComputeActorRowOffset; stores A to Zp77; loads A ; from Zp64; shifts a left; shifts a left; calls MultiplyActorValueBy16; 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 Y, the N, Z, C and V flags, Zp77, Zp7B. ; ;=============================================================================== ComputeActorTileIndex: jsr ComputeActorRowOffset ; CPU:$E6B0 PRG:26B0 20 C9 E6 sta Zp77 ; CPU:$E6B3 PRG:26B3 85 77 lda Zp64 ; CPU:$E6B5 PRG:26B5 A5 64 asl a ; CPU:$E6B7 PRG:26B7 0A asl a ; CPU:$E6B8 PRG:26B8 0A jsr MultiplyActorValueBy16 ; CPU:$E6B9 PRG:26B9 20 E9 F7 adc Zp77 ; CPU:$E6BC PRG:26BC 65 77 tay ; CPU:$E6BE PRG:26BE A8 lda $E6DF,y ; CPU:$E6BF PRG:26BF B9 DF E6 sta Zp7B ; CPU:$E6C2 PRG:26C2 85 7B and #$03 ; CPU:$E6C4 PRG:26C4 29 03 sta Zp77 ; CPU:$E6C6 PRG:26C6 85 77 rts ; CPU:$E6C8 PRG:26C8 60 ;=============================================================================== ; Routine: ComputeActorRowOffset ; Global: The routine reads no RAM 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 Zp6D; ANDs A with $0F; stores A ; to Zp77; loads Y from Zp66; decrements Y; compares Y with $03; 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, Zp77. ; ;=============================================================================== ComputeActorRowOffset: lda Zp6D ; CPU:$E6C9 PRG:26C9 A5 6D and #$0F ; CPU:$E6CB PRG:26CB 29 0F sta Zp77 ; CPU:$E6CD PRG:26CD 85 77 ldy Zp66 ; CPU:$E6CF PRG:26CF A4 66 dey ; CPU:$E6D1 PRG:26D1 88 cpy #$03 ; CPU:$E6D2 PRG:26D2 C0 03 bcc ComputeActorRowOffset_Loop ; CPU:$E6D4 PRG:26D4 90 02 ldy #$03 ; CPU:$E6D6 PRG:26D6 A0 03 ;=============================================================================== ; Routine: ComputeActorRowOffset_Loop ; Global: The routine calls MultiplyActorValueBy16. ; Local: Executes 4 instructions: copies Y into A; calls MultiplyActorValueBy16; adds Zp77 ; to 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, the N, Z, C and V flags. ; ;=============================================================================== ComputeActorRowOffset_Loop: tya ; CPU:$E6D8 PRG:26D8 98 jsr MultiplyActorValueBy16 ; CPU:$E6D9 PRG:26D9 20 E9 F7 adc Zp77 ; CPU:$E6DC PRG:26DC 65 77 rts ; CPU:$E6DE PRG:26DE 60 ; ---- data $E6DF-$E79E (192 bytes) ---- ; referenced by `lda $E6DF,y` at $E6BF (operand $E6DF falls inside this region) ActorMovementParameterTable: .byte $70, $40, $70, $20, $70, $11, $10, $70, $20, $30, $50, $60, $30, $20, $70, $10 ; CPU:$E6DF PRG:26DF 70 40 70 20 70 11 10 70 20 30 50 60 30 20 70 10 .byte $90, $70, $71, $A0, $70, $60, $90, $70, $61, $A0, $60, $60, $08, $E8, $11, $80 ; CPU:$E6EF PRG:26EF 90 70 71 A0 70 60 90 70 61 A0 60 60 08 E8 11 80 .byte $A0, $61, $60, $08, $E8, $11, $A0, $60, $60, $A1, $60, $B0, $50, $09, $E8, $10 ; CPU:$E6FF PRG:26FF A0 61 60 08 E8 11 A0 60 60 A1 60 B0 50 09 E8 10 .byte $B1, $50, $50, $09, $E8, $10, $B1, $40, $B0, $41, $C0, $08, $E9, $10, $B0, $40 ; CPU:$E70F PRG:270F B1 50 50 09 E8 10 B1 40 B0 41 C0 08 E9 10 B0 40 .byte $80, $A0, $68, $80, $68, $90, $50, $60, $B0, $A0, $68, $99, $98, $60, $B0, $C0 ; CPU:$E71F PRG:271F 80 A0 68 80 68 90 50 60 B0 A0 68 99 98 60 B0 C0 .byte $80, $A0, $B8, $99, $98, $C0, $99, $50, $C0, $C8, $68, $99, $E7, $60, $B0, $C8 ; CPU:$E72F PRG:272F 80 A0 B8 99 98 C0 99 50 C0 C8 68 99 E7 60 B0 C8 .byte $80, $68, $99, $E7, $98, $D0, $C0, $68, $99, $C0, $D0, $68, $99, $E7, $B0, $D0 ; CPU:$E73F PRG:273F 80 68 99 E7 98 D0 C0 68 99 C0 D0 68 99 E7 B0 D0 .byte $80, $68, $99, $E7, $98, $68, $99, $E7, $80, $68, $D0, $99, $D0, $68, $99, $E7 ; CPU:$E74F PRG:274F 80 68 99 E7 98 68 99 E7 80 68 D0 99 D0 68 99 E7 .byte $D0, $80, $B8, $80, $D0, $90, $D0, $80, $C8, $C0, $90, $C8, $90, $D0, $A0, $88 ; CPU:$E75F PRG:275F D0 80 B8 80 D0 90 D0 80 C8 C0 90 C8 90 D0 A0 88 .byte $B0, $C0, $B0, $B0, $C8, $B0, $B8, $C0, $B0, $B0, $C8, $B0, $B8, $C0, $B0, $B8 ; CPU:$E76F PRG:276F B0 C0 B0 B0 C8 B0 B8 C0 B0 B0 C8 B0 B8 C0 B0 B8 .byte $C8, $C8, $C8, $D0, $C8, $C8, $C8, $D0, $C8, $C8, $C8, $D0, $C8, $C8, $C8, $D0 ; CPU:$E77F PRG:277F C8 C8 C8 D0 C8 C8 C8 D0 C8 C8 C8 D0 C8 C8 C8 D0 .byte $C8, $C8, $C8, $D0, $C8, $C8, $D0, $D0, $C8, $D0, $D0, $C8, $D0, $D0, $C8, $D0 ; CPU:$E78F PRG:278F C8 C8 C8 D0 C8 C8 D0 D0 C8 D0 D0 C8 D0 D0 C8 D0 ;=============================================================================== ; Routine: SetActorSpriteLimit ; Global: The routine reads no RAM 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; ANDs A with $07; branches ; on not equal to SetActorSpriteLimit_Loop_2; loads Y with $04; loads X with $20. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp76. ; ;=============================================================================== SetActorSpriteLimit: lda Zp09 ; CPU:$E79F PRG:279F A5 09 and #$07 ; CPU:$E7A1 PRG:27A1 29 07 bne SetActorSpriteLimit_Loop_2 ; CPU:$E7A3 PRG:27A3 D0 14 ldy #$04 ; CPU:$E7A5 PRG:27A5 A0 04 ldx #$20 ; CPU:$E7A7 PRG:27A7 A2 20 ;=============================================================================== ; Routine: SetActorSpriteLimit_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 5 instructions: loads A from Zp70,x; branches on equal to ; SetActorSpriteLimit_Loop; loads A from Zp76,x; EORs A with $01; stores A to Zp76,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, Z, C and V flags, Zp76. ; ;=============================================================================== SetActorSpriteLimit_OnNonzero: lda Zp70,x ; CPU:$E7A9 PRG:27A9 B5 70 beq SetActorSpriteLimit_Loop ; CPU:$E7AB PRG:27AB F0 06 lda Zp76,x ; CPU:$E7AD PRG:27AD B5 76 eor #$01 ; CPU:$E7AF PRG:27AF 49 01 sta Zp76,x ; CPU:$E7B1 PRG:27B1 95 76 ;=============================================================================== ; Routine: SetActorSpriteLimit_Loop ; Global: The routine calls NextActorSlot. ; Local: Executes 8 instructions: loads A from Zp70,x; branches on equal to ; SetActorSpriteLimit_Loop; loads A from Zp76,x; EORs A with $01; stores A to Zp76,x; ; calls NextActorSlot; 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, Zp76. ; ;=============================================================================== SetActorSpriteLimit_Loop: jsr NextActorSlot ; CPU:$E7B3 PRG:27B3 20 EC C9 dey ; CPU:$E7B6 PRG:27B6 88 bne SetActorSpriteLimit_OnNonzero ; CPU:$E7B7 PRG:27B7 D0 F0 ;=============================================================================== ; Routine: SetActorSpriteLimit_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== SetActorSpriteLimit_Loop_2: rts ; CPU:$E7B9 PRG:27B9 60 ;=============================================================================== ; Routine: AccumulateActorPosition ; Global: The routine reads no RAM 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 ZpCA; ANDs A with ZpCE; copies ; A into Y; loads A from $E7E5,y; clears the carry flag; adds Zp9A to ; 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. ; ;=============================================================================== AccumulateActorPosition: lda ZpCA ; CPU:$E7BA PRG:27BA A5 CA and ZpCE ; CPU:$E7BC PRG:27BC 25 CE tay ; CPU:$E7BE PRG:27BE A8 lda $E7E5,y ; CPU:$E7BF PRG:27BF B9 E5 E7 clc ; CPU:$E7C2 PRG:27C2 18 adc Zp9A ; CPU:$E7C3 PRG:27C3 65 9A sta Zp9A ; CPU:$E7C5 PRG:27C5 85 9A bcc UpdateActorVerticalPosition_Loop_6 ; CPU:$E7C7 PRG:27C7 90 62 lda $E7E8,y ; CPU:$E7C9 PRG:27C9 B9 E8 E7 sta Zp77 ; CPU:$E7CC PRG:27CC 85 77 ldy #$03 ; CPU:$E7CE PRG:27CE A0 03 ldx #$20 ; CPU:$E7D0 PRG:27D0 A2 20 ;=============================================================================== ; Routine: AccumulateActorPosition_OnNonnegative ; Global: The routine calls UpdateActorVerticalPosition, NextActorSlot, SetActorScreenRowSeven and SetActorScreenRowSix. ; Local: Executes 8 instructions: stores Y to ZpFA; calls UpdateActorVerticalPosition; loads Y ; from ZpFA; calls NextActorSlot; decrements Y; branches on non-negative ; to AccumulateActorPosition_OnNonnegative; 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. ; ;=============================================================================== AccumulateActorPosition_OnNonnegative: sty ZpFA ; CPU:$E7D2 PRG:27D2 84 FA jsr UpdateActorVerticalPosition; CPU:$E7D4 PRG:27D4 20 EB E7 ldy ZpFA ; CPU:$E7D7 PRG:27D7 A4 FA jsr NextActorSlot ; CPU:$E7D9 PRG:27D9 20 EC C9 dey ; CPU:$E7DC PRG:27DC 88 bpl AccumulateActorPosition_OnNonnegative ; CPU:$E7DD PRG:27DD 10 F3 jsr SetActorScreenRowSeven ; CPU:$E7DF PRG:27DF 20 BC E9 jmp SetActorScreenRowSix ; CPU:$E7E2 PRG:27E2 4C 7E E9 ; ---- data $E7E5-$E7EA (6 bytes) ---- ; referenced by `lda $E7E5,y` at $E7BF (operand $E7E5 falls inside this region) ; referenced by `lda $E7E8,y` at $E7C9 (operand $E7E8 falls inside this region) ObjectStepLimitTable: .byte $5F, $B0, $94, $FF, $FE, $01 ; CPU:$E7E5 PRG:27E5 5F B0 94 FF FE 01 ;=============================================================================== ; Routine: UpdateActorVerticalPosition ; Global: The routine reads no RAM 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 Zp70,x; branches on equal to ; UpdateActorVerticalPosition_Loop_6; loads A from Zp74,x; clears the carry flag; adds Zp77 to ; A; stores A to Zp74,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 and X, the N, Z, C and V flags, Zp6D, Zp70, Zp74, Zp75, $03FF. ; ;=============================================================================== UpdateActorVerticalPosition: lda Zp70,x ; CPU:$E7EB PRG:27EB B5 70 beq UpdateActorVerticalPosition_Loop_6 ; CPU:$E7ED PRG:27ED F0 3C lda Zp74,x ; CPU:$E7EF PRG:27EF B5 74 clc ; CPU:$E7F1 PRG:27F1 18 adc Zp77 ; CPU:$E7F2 PRG:27F2 65 77 sta Zp74,x ; CPU:$E7F4 PRG:27F4 95 74 lda Zp77 ; CPU:$E7F6 PRG:27F6 A5 77 bmi UpdateActorVerticalPosition_Loop ; CPU:$E7F8 PRG:27F8 30 04 bcc UpdateActorVerticalPosition_Loop_6 ; CPU:$E7FA PRG:27FA 90 2F bcs UpdateActorVerticalPosition_Loop_2 ; CPU:$E7FC PRG:27FC B0 0C ;=============================================================================== ; Routine: UpdateActorVerticalPosition_Loop ; Global: The routine calls CheckActorScriptEnd. ; Local: Executes 6 instructions: branches on carry set to UpdateActorVerticalPosition_Loop_6; calls ; CheckActorScriptEnd; copies X into A; ANDs A with $10; branches on not equal ; to UpdateActorVerticalPosition_Loop_5; branches on equal to UpdateActorVerticalPosition_Loop_3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp6D, Zp70, Zp75, $03FF. ; ;=============================================================================== UpdateActorVerticalPosition_Loop: bcs UpdateActorVerticalPosition_Loop_6 ; CPU:$E7FE PRG:27FE B0 2B jsr CheckActorScriptEnd ; CPU:$E800 PRG:2800 20 2C E8 txa ; CPU:$E803 PRG:2803 8A and #$10 ; CPU:$E804 PRG:2804 29 10 bne UpdateActorVerticalPosition_Loop_5 ; CPU:$E806 PRG:2806 D0 1B beq UpdateActorVerticalPosition_Loop_3 ; CPU:$E808 PRG:2808 F0 0A ;=============================================================================== ; Routine: UpdateActorVerticalPosition_Loop_2 ; Global: The routine calls CheckActorScriptEnd. ; Local: Executes 5 instructions: calls CheckActorScriptEnd; copies X into A; decrements ; Zp6D; ANDs A with $10; branches on equal to UpdateActorVerticalPosition_Loop_5. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp6D, Zp70, Zp75, $03FF. ; ;=============================================================================== UpdateActorVerticalPosition_Loop_2: jsr CheckActorScriptEnd ; CPU:$E80A PRG:280A 20 2C E8 txa ; CPU:$E80D PRG:280D 8A dec Zp6D ; CPU:$E80E PRG:280E C6 6D and #$10 ; CPU:$E810 PRG:2810 29 10 beq UpdateActorVerticalPosition_Loop_5 ; CPU:$E812 PRG:2812 F0 0F ;=============================================================================== ; Routine: UpdateActorVerticalPosition_Loop_3 ; Global: The routine reads no RAM 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 Zp71,x; compares A with $FE; ; branches on not equal to UpdateActorVerticalPosition_Loop_4. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp70, Zp75. ; ;=============================================================================== UpdateActorVerticalPosition_Loop_3: lda Zp71,x ; CPU:$E814 PRG:2814 B5 71 cmp #$FE ; CPU:$E816 PRG:2816 C9 FE bne UpdateActorVerticalPosition_Loop_4 ; CPU:$E818 PRG:2818 D0 00 ;=============================================================================== ; Routine: UpdateActorVerticalPosition_Loop_4 ; Global: The routine calls UpdateActorVerticalPosition_Loop_5. ; Local: Executes 5 instructions: loads A with $00; calls UpdateActorVerticalPosition_Loop_5; copies X ; into A; EORs A with $10; 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, Zp70, Zp75. ; ;=============================================================================== UpdateActorVerticalPosition_Loop_4: lda #$00 ; CPU:$E81A PRG:281A A9 00 jsr UpdateActorVerticalPosition_Loop_5 ; CPU:$E81C PRG:281C 20 23 E8 txa ; CPU:$E81F PRG:281F 8A eor #$10 ; CPU:$E820 PRG:2820 49 10 tax ; CPU:$E822 PRG:2822 AA ;=============================================================================== ; Routine: UpdateActorVerticalPosition_Loop_5 ; Global: The routine reads no RAM 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 Zp70,x; loads ; A with $01; stores A to Zp75,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, Zp70, Zp75. ; ;=============================================================================== UpdateActorVerticalPosition_Loop_5: lda #$00 ; CPU:$E823 PRG:2823 A9 00 sta Zp70,x ; CPU:$E825 PRG:2825 95 70 lda #$01 ; CPU:$E827 PRG:2827 A9 01 sta Zp75,x ; CPU:$E829 PRG:2829 95 75 ;=============================================================================== ; Routine: UpdateActorVerticalPosition_Loop_6 ; Global: The routine reads no RAM 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. ; ;=============================================================================== UpdateActorVerticalPosition_Loop_6: rts ; CPU:$E82B PRG:282B 60 ;=============================================================================== ; Routine: CheckActorScriptEnd ; Global: The routine writes $03FF. ; Local: Executes 5 instructions: loads A from Zp71,x; compares A with $FE; ; branches on not equal to CheckActorScriptEnd_Loop; loads A with $00; stores A to ; $03FF. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads 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 $03FF changed. ; Clobbers: ; A, the N, Z and C flags, $03FF. ; ;=============================================================================== CheckActorScriptEnd: lda Zp71,x ; CPU:$E82C PRG:282C B5 71 cmp #$FE ; CPU:$E82E PRG:282E C9 FE bne CheckActorScriptEnd_Loop ; CPU:$E830 PRG:2830 D0 05 lda #$00 ; CPU:$E832 PRG:2832 A9 00 sta $03FF ; CPU:$E834 PRG:2834 8D FF 03 ;=============================================================================== ; Routine: CheckActorScriptEnd_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: 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. ; ;=============================================================================== CheckActorScriptEnd_Loop: rts ; CPU:$E837 PRG:2837 60 ;=============================================================================== ; Routine: SetActorSpriteFlags ; Global: The routine calls SetActorScreenRowFour and SetActorSpriteLimitTwo. ; Local: Executes 4 instructions: loads A with $02; stores A to Zp7B; calls ; SetActorScreenRowFour; calls SetActorSpriteLimitTwo. ; 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. ; ;=============================================================================== SetActorSpriteFlags: lda #$02 ; CPU:$E838 PRG:2838 A9 02 sta Zp7B ; CPU:$E83A PRG:283A 85 7B jsr SetActorScreenRowFour ; CPU:$E83C PRG:283C 20 1F E9 jmp SetActorSpriteLimitTwo ; CPU:$E83F PRG:283F 4C 45 E8 ;=============================================================================== ; Routine: ResetActorScreenRow ; Global: The routine calls SetActorScreenRowThree. ; Local: Executes 1 instruction: calls SetActorScreenRowThree. ; 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. ; ;=============================================================================== ResetActorScreenRow: jsr SetActorScreenRowThree ; CPU:$E842 PRG:2842 20 03 E9 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo ; Global: The routine reads no RAM 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 $02; loads X with $20. ; 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. ; ;=============================================================================== SetActorSpriteLimitTwo: ldy #$02 ; CPU:$E845 PRG:2845 A0 02 ldx #$20 ; CPU:$E847 PRG:2847 A2 20 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_OnNonzero ; Global: The routine calls StoreActorBoxTargetThree and CheckActorBoxOverlapThree, reads $0343. ; Local: Executes 15 instructions: loads A from $0500,x; branches on equal to ; SetActorSpriteLimitTwo_Loop_4; calls StoreActorBoxTargetThree; branches on carry set to SetActorSpriteLimitTwo_Loop_4; loads ; A from ZpDF; branches on equal to SetActorSpriteLimitTwo_Loop_3; and 9 more ; instructions. ; Parameters: Reads $0343 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. ; ;=============================================================================== SetActorSpriteLimitTwo_OnNonzero: lda $0500,x ; CPU:$E849 PRG:2849 BD 00 05 beq SetActorSpriteLimitTwo_Loop_4 ; CPU:$E84C PRG:284C F0 41 jsr StoreActorBoxTargetThree ; CPU:$E84E PRG:284E 20 2E E9 bcs SetActorSpriteLimitTwo_Loop_4 ; CPU:$E851 PRG:2851 B0 3C lda ZpDF ; CPU:$E853 PRG:2853 A5 DF beq SetActorSpriteLimitTwo_Loop_3 ; CPU:$E855 PRG:2855 F0 33 jsr CheckActorBoxOverlapThree ; CPU:$E857 PRG:2857 20 8F CC bcc SetActorSpriteLimitTwo_Loop_4 ; CPU:$E85A PRG:285A 90 33 lda #$01 ; CPU:$E85C PRG:285C A9 01 sta ZpDB ; CPU:$E85E PRG:285E 85 DB lda $0343 ; CPU:$E860 PRG:2860 AD 43 03 lsr a ; CPU:$E863 PRG:2863 4A bcs SetActorSpriteLimitTwo_Loop; CPU:$E864 PRG:2864 B0 04 lda #$03 ; CPU:$E866 PRG:2866 A9 03 bne SetActorSpriteLimitTwo_Loop_2 ; CPU:$E868 PRG:2868 D0 02 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop ; Global: The routine calls StoreActorBoxTargetThree and CheckActorBoxOverlapThree, reads $0343. ; Local: Executes 16 instructions: loads A from $0500,x; branches on equal to ; SetActorSpriteLimitTwo_Loop_4; calls StoreActorBoxTargetThree; branches on carry set to SetActorSpriteLimitTwo_Loop_4; loads ; A from ZpDF; branches on equal to SetActorSpriteLimitTwo_Loop_3; and 10 more ; instructions. ; Parameters: Reads $0343 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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop: lda #$07 ; CPU:$E86A PRG:286A A9 07 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_2 ; Global: The routine calls StoreActorBoxTargetThree and CheckActorBoxOverlapThree, reads $0343, $0342 and ; $0218. ; Local: Executes 30 instructions: loads A from $0500,x; branches on equal to ; SetActorSpriteLimitTwo_Loop_4; calls StoreActorBoxTargetThree; branches on carry set to SetActorSpriteLimitTwo_Loop_4; loads ; A from ZpDF; branches on equal to SetActorSpriteLimitTwo_Loop_3; and 24 more ; instructions. ; Parameters: Reads $0343, $0342 and $0218 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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_2: cmp $0342 ; CPU:$E86C PRG:286C CD 42 03 bne SetActorSpriteLimitTwo_Loop_3 ; CPU:$E86F PRG:286F D0 19 lda $0218 ; CPU:$E871 PRG:2871 AD 18 02 cmp #$F4 ; CPU:$E874 PRG:2874 C9 F4 bne SetActorSpriteLimitTwo_Loop_3 ; CPU:$E876 PRG:2876 D0 12 lda ZpCA ; CPU:$E878 PRG:2878 A5 CA cmp #$02 ; CPU:$E87A PRG:287A C9 02 bne SetActorSpriteLimitTwo_Loop_3 ; CPU:$E87C PRG:287C D0 0C lda ZpD0 ; CPU:$E87E PRG:287E A5 D0 ora Zp9B ; CPU:$E880 PRG:2880 05 9B bne SetActorSpriteLimitTwo_Loop_3 ; CPU:$E882 PRG:2882 D0 06 lda #$01 ; CPU:$E884 PRG:2884 A9 01 sta Zp9B ; CPU:$E886 PRG:2886 85 9B stx Zp9C ; CPU:$E888 PRG:2888 86 9C ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_3 ; Global: The routine calls StoreActorBoxTargetThree, CheckActorBoxOverlapThree and CheckActorBoxOverlap, reads $0343, ; $0342 and $0218. ; Local: Executes 32 instructions: loads A from $0500,x; branches on equal to ; SetActorSpriteLimitTwo_Loop_4; calls StoreActorBoxTargetThree; branches on carry set to SetActorSpriteLimitTwo_Loop_4; loads ; A from ZpDF; branches on equal to SetActorSpriteLimitTwo_Loop_3; and 26 more ; instructions. ; Parameters: Reads $0343, $0342 and $0218 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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_3: jsr CheckActorBoxOverlap ; CPU:$E88A PRG:288A 20 7E CC bcs SetActorSpriteLimitTwo_Loop_12 ; CPU:$E88D PRG:288D B0 6F ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_4 ; Global: The routine calls StoreActorBoxTargetThree, CheckActorBoxOverlapThree, CheckActorBoxOverlap and NextActorSlot, reads ; $0343, $0342 and $0218. ; Local: Executes 36 instructions: loads A from $0500,x; branches on equal to ; SetActorSpriteLimitTwo_Loop_4; calls StoreActorBoxTargetThree; branches on carry set to SetActorSpriteLimitTwo_Loop_4; loads ; A from ZpDF; branches on equal to SetActorSpriteLimitTwo_Loop_3; and 30 more ; instructions. ; Parameters: Reads $0343, $0342 and $0218 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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_4: dey ; CPU:$E88F PRG:288F 88 beq SetActorSpriteLimitTwo_Loop_5 ; CPU:$E890 PRG:2890 F0 05 jsr NextActorSlot ; CPU:$E892 PRG:2892 20 EC C9 bne SetActorSpriteLimitTwo_OnNonzero ; CPU:$E895 PRG:2895 D0 B2 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_5 ; Global: The routine reads no RAM 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 $02; stores A to Zp79; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_5: lda #$02 ; CPU:$E897 PRG:2897 A9 02 sta Zp79 ; CPU:$E899 PRG:2899 85 79 ldy #$03 ; CPU:$E89B PRG:289B A0 03 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_OnNonnegative ; Global: The routine reads no RAM 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 $E97A,y; stores A to Zp8C,y; ; decrements Y; branches on non-negative to SetActorSpriteLimitTwo_OnNonnegative; loads X with ; $20. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SetActorSpriteLimitTwo_OnNonnegative: lda $E97A,y ; CPU:$E89D PRG:289D B9 7A E9 sta a:Zp8C,y ; CPU:$E8A0 PRG:28A0 99 8C 00 dey ; CPU:$E8A3 PRG:28A3 88 bpl SetActorSpriteLimitTwo_OnNonnegative ; CPU:$E8A4 PRG:28A4 10 F7 ldx #$20 ; CPU:$E8A6 PRG:28A6 A2 20 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_OnNonzero_2 ; Global: The routine reads no RAM 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 Zp75,x; branches on not equal ; to SetActorSpriteLimitTwo_Loop_9; loads Y with $36; loads A from Zp71,x; compares A with ; $FF; branches on equal to SetActorSpriteLimitTwo_Loop_6; 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. ; ;=============================================================================== SetActorSpriteLimitTwo_OnNonzero_2: lda Zp75,x ; CPU:$E8A8 PRG:28A8 B5 75 bne SetActorSpriteLimitTwo_Loop_9 ; CPU:$E8AA PRG:28AA D0 2B ldy #$36 ; CPU:$E8AC PRG:28AC A0 36 lda Zp71,x ; CPU:$E8AE PRG:28AE B5 71 cmp #$FF ; CPU:$E8B0 PRG:28B0 C9 FF beq SetActorSpriteLimitTwo_Loop_6 ; CPU:$E8B2 PRG:28B2 F0 02 ldy #$26 ; CPU:$E8B4 PRG:28B4 A0 26 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_6 ; Global: The routine calls StoreActorBoxTargetFour and CheckActorBoxOverlapThree. ; Local: Executes 18 instructions: loads A from Zp75,x; branches on not equal ; to SetActorSpriteLimitTwo_Loop_9; loads Y with $36; loads A from Zp71,x; compares A with ; $FF; branches on equal to SetActorSpriteLimitTwo_Loop_6; 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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_6: sty Zp8E ; CPU:$E8B6 PRG:28B6 84 8E jsr StoreActorBoxTargetFour ; CPU:$E8B8 PRG:28B8 20 69 E9 lda ZpDF ; CPU:$E8BB PRG:28BB A5 DF beq SetActorSpriteLimitTwo_Loop_8 ; CPU:$E8BD PRG:28BD F0 13 jsr CheckActorBoxOverlapThree ; CPU:$E8BF PRG:28BF 20 8F CC bcc SetActorSpriteLimitTwo_Loop_9 ; CPU:$E8C2 PRG:28C2 90 13 lda #$00 ; CPU:$E8C4 PRG:28C4 A9 00 cpx #$20 ; CPU:$E8C6 PRG:28C6 E0 20 beq SetActorSpriteLimitTwo_Loop_7 ; CPU:$E8C8 PRG:28C8 F0 03 clc ; CPU:$E8CA PRG:28CA 18 adc #$01 ; CPU:$E8CB PRG:28CB 69 01 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_7 ; Global: The routine calls StoreActorBoxTargetFour and CheckActorBoxOverlapThree. ; Local: Executes 21 instructions: loads A from Zp75,x; branches on not equal ; to SetActorSpriteLimitTwo_Loop_9; loads Y with $36; loads A from Zp71,x; compares A with ; $FF; branches on equal to SetActorSpriteLimitTwo_Loop_6; 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: 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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_7: tax ; CPU:$E8CD PRG:28CD AA lda #$01 ; CPU:$E8CE PRG:28CE A9 01 sta ZpD9,x ; CPU:$E8D0 PRG:28D0 95 D9 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_8 ; Global: The routine calls StoreActorBoxTargetFour, CheckActorBoxOverlapThree and CheckActorBoxOverlap. ; Local: Executes 23 instructions: loads A from Zp75,x; branches on not equal ; to SetActorSpriteLimitTwo_Loop_9; loads Y with $36; loads A from Zp71,x; compares A with ; $FF; branches on equal to SetActorSpriteLimitTwo_Loop_6; 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 and V flags, the RAM fields it writes. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_8: jsr CheckActorBoxOverlap ; CPU:$E8D2 PRG:28D2 20 7E CC bcs SetActorSpriteLimitTwo_Loop_12 ; CPU:$E8D5 PRG:28D5 B0 27 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_9 ; Global: The routine calls StoreActorBoxTargetFour, CheckActorBoxOverlapThree and CheckActorBoxOverlap. ; Local: Executes 30 instructions: loads A from Zp75,x; branches on not equal ; to SetActorSpriteLimitTwo_Loop_9; loads Y with $36; loads A from Zp71,x; compares A with ; $FF; branches on equal to SetActorSpriteLimitTwo_Loop_6; and 24 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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_9: dec Zp79 ; CPU:$E8D7 PRG:28D7 C6 79 beq SetActorSpriteLimitTwo_Loop_10 ; CPU:$E8D9 PRG:28D9 F0 07 txa ; CPU:$E8DB PRG:28DB 8A clc ; CPU:$E8DC PRG:28DC 18 adc #$20 ; CPU:$E8DD PRG:28DD 69 20 tax ; CPU:$E8DF PRG:28DF AA bne SetActorSpriteLimitTwo_OnNonzero_2 ; CPU:$E8E0 PRG:28E0 D0 C6 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_10 ; Global: The routine calls ResetActorScreenRow. ; Local: Executes 3 instructions: decrements Zp7B; branches on equal to ; SetActorSpriteLimitTwo_Loop_11; calls ResetActorScreenRow. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_10: dec Zp7B ; CPU:$E8E2 PRG:28E2 C6 7B beq SetActorSpriteLimitTwo_Loop_11 ; CPU:$E8E4 PRG:28E4 F0 03 jmp ResetActorScreenRow ; CPU:$E8E6 PRG:28E6 4C 42 E8 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_11 ; Global: The routine calls SetActorScreenRowFive and CheckActorBoxOverlap, writes $0321 and $03FF. ; Local: Executes 9 instructions: loads A from ZpD0; branches on equal to ; SetActorSpriteLimitTwo_Loop_13; calls SetActorScreenRowFive; calls CheckActorBoxOverlap; branches on carry clear ; to SetActorSpriteLimitTwo_Loop_13; loads X with $01; 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 $0321 and $03FF changed. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_11: lda ZpD0 ; CPU:$E8E9 PRG:28E9 A5 D0 beq SetActorSpriteLimitTwo_Loop_13 ; CPU:$E8EB PRG:28EB F0 15 jsr SetActorScreenRowFive ; CPU:$E8ED PRG:28ED 20 5C E9 jsr CheckActorBoxOverlap ; CPU:$E8F0 PRG:28F0 20 7E CC bcc SetActorSpriteLimitTwo_Loop_13 ; CPU:$E8F3 PRG:28F3 90 0D ldx #$01 ; CPU:$E8F5 PRG:28F5 A2 01 stx $0321 ; CPU:$E8F7 PRG:28F7 8E 21 03 stx $03FF ; CPU:$E8FA PRG:28FA 8E FF 03 rts ; CPU:$E8FD PRG:28FD 60 ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_12 ; Global: The routine reads no RAM 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 Zp0F. ; 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, Zp0F. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_12: lda #$01 ; CPU:$E8FE PRG:28FE A9 01 sta Zp0F ; CPU:$E900 PRG:2900 85 0F ;=============================================================================== ; Routine: SetActorSpriteLimitTwo_Loop_13 ; Global: The routine reads no RAM 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. ; ;=============================================================================== SetActorSpriteLimitTwo_Loop_13: rts ; CPU:$E902 PRG:2902 60 ;=============================================================================== ; Routine: SetActorScreenRowThree ; Global: The routine reads no RAM 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 $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, C and V flags, Zp8F, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorScreenRowThree: ldy #$03 ; CPU:$E903 PRG:2903 A0 03 ;=============================================================================== ; Routine: SetActorScreenRowThree_OnNonnegative ; Global: The routine reads no RAM 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 $E96E,y; stores A to Zp8C,y; ; decrements Y; branches on non-negative to SetActorScreenRowThree_OnNonnegative; loads A from ; Zp61; compares A with $05; 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, Zp8F, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorScreenRowThree_OnNonnegative: lda $E96E,y ; CPU:$E905 PRG:2905 B9 6E E9 sta a:Zp8C,y ; CPU:$E908 PRG:2908 99 8C 00 dey ; CPU:$E90B PRG:290B 88 bpl SetActorScreenRowThree_OnNonnegative ; CPU:$E90C PRG:290C 10 F7 lda Zp61 ; CPU:$E90E PRG:290E A5 61 cmp #$05 ; CPU:$E910 PRG:2910 C9 05 bne SetActorScreenRowThree_Loop; CPU:$E912 PRG:2912 D0 04 lda #$10 ; CPU:$E914 PRG:2914 A9 10 sta Zp8F ; CPU:$E916 PRG:2916 85 8F ;=============================================================================== ; Routine: SetActorScreenRowThree_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, X and Y, the N, Z, C and V flags, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorScreenRowThree_Loop: ldx #$00 ; CPU:$E918 PRG:2918 A2 00 ;=============================================================================== ; Routine: SetActorScreenRowThree_OnNonzero ; Global: The routine calls StoreActorBox. ; Local: Executes 2 instructions: loads Y with $08; calls StoreActorBox. ; 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, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorScreenRowThree_OnNonzero: ldy #$08 ; CPU:$E91A PRG:291A A0 08 jmp StoreActorBox ; CPU:$E91C PRG:291C 4C 62 CC ;=============================================================================== ; Routine: SetActorScreenRowFour ; Global: The routine calls StoreActorBox. ; Local: Executes 3 instructions: loads Y with $08; calls StoreActorBox; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== SetActorScreenRowFour: ldy #$03 ; CPU:$E91F PRG:291F A0 03 ;=============================================================================== ; Routine: SetActorScreenRowFour_OnNonnegative ; Global: The routine calls StoreActorBox. ; Local: Executes 8 instructions: loads Y with $08; calls StoreActorBox; loads A ; from $E972,y; stores A to Zp8C,y; decrements Y; branches on ; non-negative to SetActorScreenRowFour_OnNonnegative; 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. ; ;=============================================================================== SetActorScreenRowFour_OnNonnegative: lda $E972,y ; CPU:$E921 PRG:2921 B9 72 E9 sta a:Zp8C,y ; CPU:$E924 PRG:2924 99 8C 00 dey ; CPU:$E927 PRG:2927 88 bpl SetActorScreenRowFour_OnNonnegative ; CPU:$E928 PRG:2928 10 F7 ldx #$10 ; CPU:$E92A PRG:292A A2 10 bne SetActorScreenRowThree_OnNonzero ; CPU:$E92C PRG:292C D0 EC ;=============================================================================== ; Routine: StoreActorBoxTargetThree ; Global: The routine writes $03C8, $03C9 and $03CA. ; Local: Executes 15 instructions: loads A with $1C; stores A to $03C8; loads ; A with $0A; stores A to $03C9; clears the carry flag; loads A from ; $0503,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. Leaves $03C8, $03C9 and $03CA ; changed. ; Clobbers: ; A, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== StoreActorBoxTargetThree: lda #$1C ; CPU:$E92E PRG:292E A9 1C sta $03C8 ; CPU:$E930 PRG:2930 8D C8 03 lda #$0A ; CPU:$E933 PRG:2933 A9 0A sta $03C9 ; CPU:$E935 PRG:2935 8D C9 03 clc ; CPU:$E938 PRG:2938 18 lda $0503,x ; CPU:$E939 PRG:2939 BD 03 05 adc #$08 ; CPU:$E93C PRG:293C 69 08 sta $03CA ; CPU:$E93E PRG:293E 8D CA 03 clc ; CPU:$E941 PRG:2941 18 lda $0501,x ; CPU:$E942 PRG:2942 BD 01 05 adc #$07 ; CPU:$E945 PRG:2945 69 07 sta Zp77 ; CPU:$E947 PRG:2947 85 77 lda $0502,x ; CPU:$E949 PRG:2949 BD 02 05 bcc StoreActorBoxTargetThree_Loop ; CPU:$E94C PRG:294C 90 02 eor #$01 ; CPU:$E94E PRG:294E 49 01 ;=============================================================================== ; Routine: StoreActorBoxTargetThree_Loop ; Global: The routine calls ComputeActorFacing, writes $03CB. ; Local: Executes 5 instructions: stores A to Zp78; calls ComputeActorFacing; branches ; on carry set to StoreActorBoxTargetThree_Loop_2; stores A to $03CB; 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: Leaves through one of its branches rather than a return; the caller ; resumes at the branch target. Leaves $03CB changed. ; Clobbers: ; A, the N, Z, C and V flags, Zp77, Zp78, Zp7A, $03CB. ; ;=============================================================================== StoreActorBoxTargetThree_Loop: sta Zp78 ; CPU:$E950 PRG:2950 85 78 jsr ComputeActorFacing ; CPU:$E952 PRG:2952 20 20 CC bcs StoreActorBoxTargetThree_Loop_2 ; CPU:$E955 PRG:2955 B0 04 sta $03CB ; CPU:$E957 PRG:2957 8D CB 03 clc ; CPU:$E95A PRG:295A 18 ;=============================================================================== ; Routine: StoreActorBoxTargetThree_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== StoreActorBoxTargetThree_Loop_2: rts ; CPU:$E95B PRG:295B 60 ;=============================================================================== ; Routine: SetActorScreenRowFive ; Global: The routine reads no RAM 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 $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, C and V flags, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorScreenRowFive: ldy #$03 ; CPU:$E95C PRG:295C A0 03 ;=============================================================================== ; Routine: SetActorScreenRowFive_OnNonnegative ; Global: The routine reads no RAM 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 $E976,y; stores A to Zp8C,y; ; decrements Y; branches on non-negative to SetActorScreenRowFive_OnNonnegative; loads X with ; $60. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorScreenRowFive_OnNonnegative: lda $E976,y ; CPU:$E95E PRG:295E B9 76 E9 sta a:Zp8C,y ; CPU:$E961 PRG:2961 99 8C 00 dey ; CPU:$E964 PRG:2964 88 bpl SetActorScreenRowFive_OnNonnegative ; CPU:$E965 PRG:2965 10 F7 ldx #$60 ; CPU:$E967 PRG:2967 A2 60 ;=============================================================================== ; Routine: StoreActorBoxTargetFour ; Global: The routine calls StoreActorBox. ; Local: Executes 2 instructions: loads Y with $00; calls StoreActorBox. ; 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, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== StoreActorBoxTargetFour: ldy #$00 ; CPU:$E969 PRG:2969 A0 00 jmp StoreActorBox ; CPU:$E96B PRG:296B 4C 62 CC ; ---- data $E96E-$E97D (16 bytes) ---- ; referenced by `lda $E97A,y` at $E89D (operand $E97A falls inside this region) ; referenced by `lda $E96E,y` at $E905 (operand $E96E falls inside this region) ; referenced by `lda $E972,y` at $E921 (operand $E972 falls inside this region) ; referenced by `lda $E976,y` at $E95E (operand $E976 falls inside this region) ObjectStateInitialTables: .byte $02, $0C, $01, $15, $07, $16, $04, $08, $04, $08, $04, $08, $0B, $02, $36, $04 ; CPU:$E96E PRG:296E 02 0C 01 15 07 16 04 08 04 08 04 08 0B 02 36 04 ;=============================================================================== ; Routine: SetActorScreenRowSix ; Global: The routine reads no RAM 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 $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 Y, the N, Z, C and V flags, ZpD0, ZpD4. ; ;=============================================================================== SetActorScreenRowSix: ldy #$05 ; CPU:$E97E PRG:297E A0 05 ;=============================================================================== ; Routine: SetActorScreenRowSix_OnNonnegative ; Global: The routine reads $03FF. ; Local: Executes 8 instructions: loads A from $E9B6,y; stores A to $00D1,y; ; decrements Y; branches on non-negative to SetActorScreenRowSix_OnNonnegative; loads A from ; $03FF; branches on equal to SetActorScreenRowSix_Loop; and 2 more instructions. ; Parameters: Reads $03FF 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, ZpD0, ZpD4. ; ;=============================================================================== SetActorScreenRowSix_OnNonnegative: lda $E9B6,y ; CPU:$E980 PRG:2980 B9 B6 E9 sta a:$00D1,y ; CPU:$E983 PRG:2983 99 D1 00 dey ; CPU:$E986 PRG:2986 88 bpl SetActorScreenRowSix_OnNonnegative ; CPU:$E987 PRG:2987 10 F7 lda $03FF ; CPU:$E989 PRG:2989 AD FF 03 beq SetActorScreenRowSix_Loop ; CPU:$E98C PRG:298C F0 04 lda #$00 ; CPU:$E98E PRG:298E A9 00 beq SetActorScreenRowSix_Loop_4; CPU:$E990 PRG:2990 F0 21 ;=============================================================================== ; Routine: SetActorScreenRowSix_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 Y with $40. ; 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, ZpD0, ZpD4. ; ;=============================================================================== SetActorScreenRowSix_Loop: ldy #$40 ; CPU:$E992 PRG:2992 A0 40 ;=============================================================================== ; Routine: SetActorScreenRowSix_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 5 instructions: loads A from Zp70,y; branches on equal to ; SetActorScreenRowSix_Loop_2; loads A from Zp71,y; compares A with $FE; branches on ; equal to SetActorScreenRowSix_Loop_3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, ZpD0, ZpD4. ; ;=============================================================================== SetActorScreenRowSix_OnNonzero: lda a:Zp70,y ; CPU:$E994 PRG:2994 B9 70 00 beq SetActorScreenRowSix_Loop_2; CPU:$E997 PRG:2997 F0 07 lda a:Zp71,y ; CPU:$E999 PRG:2999 B9 71 00 cmp #$FE ; CPU:$E99C PRG:299C C9 FE beq SetActorScreenRowSix_Loop_3; CPU:$E99E PRG:299E F0 09 ;=============================================================================== ; Routine: SetActorScreenRowSix_Loop_2 ; Global: The routine reads no RAM 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 Zp70,y; branches on equal to ; SetActorScreenRowSix_Loop_2; loads A from Zp71,y; compares A with $FE; branches on ; equal to SetActorScreenRowSix_Loop_3; copies Y into 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, the N, Z, C and V flags, ZpD0, ZpD4. ; ;=============================================================================== SetActorScreenRowSix_Loop_2: tya ; CPU:$E9A0 PRG:29A0 98 sec ; CPU:$E9A1 PRG:29A1 38 sbc #$20 ; CPU:$E9A2 PRG:29A2 E9 20 tay ; CPU:$E9A4 PRG:29A4 A8 bne SetActorScreenRowSix_OnNonzero ; CPU:$E9A5 PRG:29A5 D0 ED beq SetActorScreenRowSix_Loop_4; CPU:$E9A7 PRG:29A7 F0 0A ;=============================================================================== ; Routine: SetActorScreenRowSix_Loop_3 ; Global: The routine reads no RAM 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 Zp74,y; clears the carry flag; ; adds $03 to A; stores A to ZpD4; 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, the N, Z, C and V flags, ZpD0, ZpD4. ; ;=============================================================================== SetActorScreenRowSix_Loop_3: lda a:Zp74,y ; CPU:$E9A9 PRG:29A9 B9 74 00 clc ; CPU:$E9AC PRG:29AC 18 adc #$03 ; CPU:$E9AD PRG:29AD 69 03 sta ZpD4 ; CPU:$E9AF PRG:29AF 85 D4 lda #$01 ; CPU:$E9B1 PRG:29B1 A9 01 ;=============================================================================== ; Routine: SetActorScreenRowSix_Loop_4 ; Global: The routine reads no RAM 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 ZpD0; 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, ZpD0. ; ;=============================================================================== SetActorScreenRowSix_Loop_4: sta ZpD0 ; CPU:$E9B3 PRG:29B3 85 D0 rts ; CPU:$E9B5 PRG:29B5 60 ; ---- data $E9B6-$E9BB (6 bytes) ---- ; referenced by `lda $E9B6,y` at $E980 (operand $E9B6 falls inside this region) RoundStateInitialTable: .byte $04, $A0, $70, $F6, $00, $22 ; CPU:$E9B6 PRG:29B6 04 A0 70 F6 00 22 ;=============================================================================== ; Routine: SetActorScreenRowSeven ; Global: The routine reads no RAM 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 $40. ; 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. ; ;=============================================================================== SetActorScreenRowSeven: ldy #$40 ; CPU:$E9BC PRG:29BC A0 40 ;=============================================================================== ; Routine: SetActorScreenRowSeven_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 7 instructions: loads A from Zp70,y; branches on equal to ; SetActorScreenRowSeven_Loop; loads A from Zp74,y; clears the carry flag; adds $0C to ; A; stores A to Zp84,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. ; ;=============================================================================== SetActorScreenRowSeven_OnNonzero: lda a:Zp70,y ; CPU:$E9BE PRG:29BE B9 70 00 beq SetActorScreenRowSeven_Loop; CPU:$E9C1 PRG:29C1 F0 0B lda a:Zp74,y ; CPU:$E9C3 PRG:29C3 B9 74 00 clc ; CPU:$E9C6 PRG:29C6 18 adc #$0C ; CPU:$E9C7 PRG:29C7 69 0C sta a:Zp84,y ; CPU:$E9C9 PRG:29C9 99 84 00 lda #$01 ; CPU:$E9CC PRG:29CC A9 01 ;=============================================================================== ; Routine: SetActorScreenRowSeven_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 14 instructions: loads A from Zp70,y; branches on equal to ; SetActorScreenRowSeven_Loop; loads A from Zp74,y; clears the carry flag; adds $0C to ; A; stores A to Zp84,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, the N, Z, C and V flags. ; ;=============================================================================== SetActorScreenRowSeven_Loop: sta a:Zp80,y ; CPU:$E9CE PRG:29CE 99 80 00 tya ; CPU:$E9D1 PRG:29D1 98 sec ; CPU:$E9D2 PRG:29D2 38 sbc #$20 ; CPU:$E9D3 PRG:29D3 E9 20 tay ; CPU:$E9D5 PRG:29D5 A8 bne SetActorScreenRowSeven_OnNonzero ; CPU:$E9D6 PRG:29D6 D0 E6 rts ; CPU:$E9D8 PRG:29D8 60 ; ---- data $E9D9-$EABF (231 bytes) ---- .byte $A6, $CF, $D0, $03, $4C, $2D, $E5, $A5, $0F, $F0, $03, $4C, $58, $DC, $20, $07 ; CPU:$E9D9 PRG:29D9 A6 CF D0 03 4C 2D E5 A5 0F F0 03 4C 58 DC 20 07 .byte $D8, $20, $11, $DA, $B0, $03, $20, $B6, $DB, $20, $D0, $EB, $20, $82, $EA, $A5 ; CPU:$E9E9 PRG:29E9 D8 20 11 DA B0 03 20 B6 DB 20 D0 EB 20 82 EA A5 .byte $03, $29, $08, $D0, $06, $A5, $74, $C9, $80, $B0, $1B, $AD, $04, $04, $C9, $03 ; CPU:$E9F9 PRG:29F9 03 29 08 D0 06 A5 74 C9 80 B0 1B AD 04 04 C9 03 .byte $B0, $14, $20, $B0, $E6, $8D, $03, $04, $A0, $05, $A2, $20, $B5, $70, $F0, $07 ; CPU:$EA09 PRG:2A09 B0 14 20 B0 E6 8D 03 04 A0 05 A2 20 B5 70 F0 07 .byte $B5, $74, $C5, $7B, $90, $01, $60, $20, $EC, $C9, $88, $D0, $EF, $AD, $03, $04 ; CPU:$EA19 PRG:2A19 B5 74 C5 7B 90 01 60 20 EC C9 88 D0 EF AD 03 04 .byte $4A, $90, $0D, $A2, $20, $A0, $02, $A5, $69, $D0, $09, $A9, $00, $8D, $03, $04 ; CPU:$EA29 PRG:2A29 4A 90 0D A2 20 A0 02 A5 69 D0 09 A9 00 8D 03 04 .byte $A2, $40, $A0, $03, $B5, $70, $F0, $08, $88, $F0, $31, $20, $EC, $C9, $D0, $F4 ; CPU:$EA39 PRG:2A39 A2 40 A0 03 B5 70 F0 08 88 F0 31 20 EC C9 D0 F4 .byte $E6, $6D, $EE, $04, $04, $86, $F9, $A0, $00, $B9, $76, $EA, $95, $70, $E8, $C8 ; CPU:$EA49 PRG:2A49 E6 6D EE 04 04 86 F9 A0 00 B9 76 EA 95 70 E8 C8 .byte $C0, $07, $90, $F5, $A6, $F9, $AD, $03, $04, $F0, $04, $A9, $16, $95, $76, $8A ; CPU:$EA59 PRG:2A59 C0 07 90 F5 A6 F9 AD 03 04 F0 04 A9 16 95 76 8A .byte $20, $E4, $F7, $38, $E9, $02, $A8, $B9, $7D, $EA, $95, $72, $60, $01, $04, $38 ; CPU:$EA69 PRG:2A69 20 E4 F7 38 E9 02 A8 B9 7D EA 95 72 60 01 04 38 .byte $70, $F7, $00, $13, $38, $48, $58, $68, $78, $A0, $05, $84, $79, $A2, $20, $86 ; CPU:$EA79 PRG:2A79 70 F7 00 13 38 48 58 68 78 A0 05 84 79 A2 20 86 .byte $F9, $B5, $70, $F0, $0F, $A5, $79, $C9, $04, $B0, $06, $20, $23, $EB, $4C, $9D ; CPU:$EA89 PRG:2A89 F9 B5 70 F0 0F A5 79 C9 04 B0 06 20 23 EB 4C 9D .byte $EA, $20, $A8, $EA, $C6, $79, $F0, $D4, $A6, $F9, $20, $EC, $C9, $D0, $E0, $A9 ; CPU:$EA99 PRG:2A99 EA 20 A8 EA C6 79 F0 D4 A6 F9 20 EC C9 D0 E0 A9 .byte $02, $85, $77, $20, $67, $EB, $BD, $0A, $06, $D0, $3F, $B5, $74, $85, $77, $E9 ; CPU:$EAA9 PRG:2AA9 02 85 77 20 67 EB BD 0A 06 D0 3F B5 74 85 77 E9 .byte $12, $85, $78, $A0, $03, $A2, $40 ; CPU:$EAB9 PRG:2AB9 12 85 78 A0 03 A2 40 ;=============================================================================== ; Routine: SetActorScreenRowSeven_OnNonzero_2 ; Global: The routine reads no RAM 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 Zp70,x; branches on equal to ; CheckActorHitBox_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SetActorScreenRowSeven_OnNonzero_2: lda Zp70,x ; CPU:$EAC0 PRG:2AC0 B5 70 beq CheckActorHitBox_Loop ; CPU:$EAC2 PRG:2AC2 F0 0A ;=============================================================================== ; Routine: CheckActorHitBox ; Global: The routine reads no RAM 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 Zp70,x; branches on equal to ; CheckActorHitBox_Loop; loads A from Zp74,x; compares A with Zp77; branches on ; carry set to CheckActorHitBox_Loop; compares A with Zp78; 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. ; ;=============================================================================== CheckActorHitBox: lda Zp74,x ; CPU:$EAC4 PRG:2AC4 B5 74 cmp Zp77 ; CPU:$EAC6 PRG:2AC6 C5 77 bcs CheckActorHitBox_Loop ; CPU:$EAC8 PRG:2AC8 B0 04 cmp Zp78 ; CPU:$EACA PRG:2ACA C5 78 bcs CheckActorHitBox_Loop_3 ; CPU:$EACC PRG:2ACC B0 0D ;=============================================================================== ; Routine: CheckActorHitBox_Loop ; Global: The routine calls NextActorSlot. ; Local: Executes 11 instructions: loads A from Zp70,x; branches on equal to ; CheckActorHitBox_Loop; loads A from Zp74,x; compares A with Zp77; branches on ; carry set to CheckActorHitBox_Loop; compares A with Zp78; 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. ; ;=============================================================================== CheckActorHitBox_Loop: dey ; CPU:$EACE PRG:2ACE 88 beq CheckActorHitBox_Loop_2 ; CPU:$EACF PRG:2ACF F0 05 jsr NextActorSlot ; CPU:$EAD1 PRG:2AD1 20 EC C9 bne SetActorScreenRowSeven_OnNonzero_2 ; CPU:$EAD4 PRG:2AD4 D0 EA ;=============================================================================== ; Routine: CheckActorHitBox_Loop_2 ; Global: The routine calls AddToActorHitCount. ; Local: Executes 2 instructions: loads A with $40; calls AddToActorHitCount. ; 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, Zp76, $0609, $060E. ; ;=============================================================================== CheckActorHitBox_Loop_2: lda #$40 ; CPU:$EAD6 PRG:2AD6 A9 40 jmp AddToActorHitCount ; CPU:$EAD8 PRG:2AD8 4C 98 EB ;=============================================================================== ; Routine: CheckActorHitBox_Loop_3 ; Global: The routine reads no RAM field, writes none and calls nothing - it ; is a straight-line sequence whose only effect is on the registers ; and the flags. ; Local: Executes 22 instructions: loads X from ZpF9; increments $060A,x; ; loads A with $04; stores A to $060C,x; loads A with $00; stores A ; to $060B,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: 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, Zp73, Zp76, $060A, $060B, $060C, ; $060D. ; ;=============================================================================== CheckActorHitBox_Loop_3: ldx ZpF9 ; CPU:$EADB PRG:2ADB A6 F9 inc $060A,x ; CPU:$EADD PRG:2ADD FE 0A 06 lda #$04 ; CPU:$EAE0 PRG:2AE0 A9 04 sta $060C,x ; CPU:$EAE2 PRG:2AE2 9D 0C 06 lda #$00 ; CPU:$EAE5 PRG:2AE5 A9 00 sta $060B,x ; CPU:$EAE7 PRG:2AE7 9D 0B 06 lda #$19 ; CPU:$EAEA PRG:2AEA A9 19 sta Zp76,x ; CPU:$EAEC PRG:2AEC 95 76 lda Zp73,x ; CPU:$EAEE PRG:2AEE B5 73 sta $060D,x ; CPU:$EAF0 PRG:2AF0 9D 0D 06 ldx ZpF9 ; CPU:$EAF3 PRG:2AF3 A6 F9 lda $060B,x ; CPU:$EAF5 PRG:2AF5 BD 0B 06 sec ; CPU:$EAF8 PRG:2AF8 38 sbc #$38 ; CPU:$EAF9 PRG:2AF9 E9 38 sta $060B,x ; CPU:$EAFB PRG:2AFB 9D 0B 06 lda $060C,x ; CPU:$EAFE PRG:2AFE BD 0C 06 sbc #$00 ; CPU:$EB01 PRG:2B01 E9 00 sta $060C,x ; CPU:$EB03 PRG:2B03 9D 0C 06 bpl CheckActorHitBox_Loop_4 ; CPU:$EB06 PRG:2B06 10 07 lda Zp73,x ; CPU:$EB08 PRG:2B08 B5 73 cmp $060D,x ; CPU:$EB0A PRG:2B0A DD 0D 06 bcs CheckActorHitBox_Loop_5 ; CPU:$EB0D PRG:2B0D B0 09 ;=============================================================================== ; Routine: CheckActorHitBox_Loop_4 ; Global: The routine reads no RAM 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 Zp73,x; sets the carry flag; ; subtracts $060C,x from A; stores A to Zp73,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, Zp73. ; ;=============================================================================== CheckActorHitBox_Loop_4: lda Zp73,x ; CPU:$EB0F PRG:2B0F B5 73 sec ; CPU:$EB11 PRG:2B11 38 sbc $060C,x ; CPU:$EB12 PRG:2B12 FD 0C 06 sta Zp73,x ; CPU:$EB15 PRG:2B15 95 73 rts ; CPU:$EB17 PRG:2B17 60 ;=============================================================================== ; Routine: CheckActorHitBox_Loop_5 ; Global: The routine reads no RAM 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 $060D,x; stores A to Zp73,x; ; loads A with $00; stores A to $060A,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, Zp73, $060A. ; ;=============================================================================== CheckActorHitBox_Loop_5: lda $060D,x ; CPU:$EB18 PRG:2B18 BD 0D 06 sta Zp73,x ; CPU:$EB1B PRG:2B1B 95 73 lda #$00 ; CPU:$EB1D PRG:2B1D A9 00 sta $060A,x ; CPU:$EB1F PRG:2B1F 9D 0A 06 rts ; CPU:$EB22 PRG:2B22 60 ; ---- data $EB23-$EB97 (117 bytes) ---- .byte $B5, $74, $E9, $10, $85, $77, $69, $20, $85, $78, $A0, $02, $A2, $20, $B5, $70 ; CPU:$EB23 PRG:2B23 B5 74 E9 10 85 77 69 20 85 78 A0 02 A2 20 B5 70 .byte $F0, $0A, $B5, $74, $C5, $77, $90, $04, $C5, $78, $90, $17, $88, $F0, $04, $A2 ; CPU:$EB33 PRG:2B33 F0 0A B5 74 C5 77 90 04 C5 78 90 17 88 F0 04 A2 .byte $30, $D0, $EB, $20, $5A, $EB, $A6, $F9, $A9, $01, $85, $77, $20, $67, $EB, $A9 ; CPU:$EB43 PRG:2B43 30 D0 EB 20 5A EB A6 F9 A9 01 85 77 20 67 EB A9 .byte $20, $D0, $42, $A5, $F9, $D0, $09, $AD, $05, $04, $C5, $F9, $D0, $05, $A9, $00 ; CPU:$EB53 PRG:2B53 20 D0 42 A5 F9 D0 09 AD 05 04 C5 F9 D0 05 A9 00 .byte $8D, $05, $04, $60, $A5, $C9, $25, $CE, $A8, $B9, $CA, $EB, $48, $A5, $79, $C9 ; CPU:$EB63 PRG:2B63 8D 05 04 60 A5 C9 25 CE A8 B9 CA EB 48 A5 79 C9 .byte $04, $B0, $05, $68, $B9, $CD, $EB, $48, $68, $7D, $08, $06, $9D, $08, $06, $90 ; CPU:$EB73 PRG:2B73 04 B0 05 68 B9 CD EB 48 68 7D 08 06 9D 08 06 90 .byte $11, $B5, $74, $E5, $77, $95, $74, $B0, $0B, $A9, $00, $95, $70, $95, $75, $CE ; CPU:$EB83 PRG:2B83 11 B5 74 E5 77 95 74 B0 0B A9 00 95 70 95 75 CE .byte $04, $04, $68, $68, $60 ; CPU:$EB93 PRG:2B93 04 04 68 68 60 ;=============================================================================== ; Routine: AddToActorHitCount ; Global: The routine reads no RAM 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 X from ZpF9; clears the carry flag; ; adds $0609,x to A; stores A to $0609,x; branches on carry clear to ; AddToActorHitCount_Loop_3; loads A from $060E,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, Zp76, $0609, $060E. ; ;=============================================================================== AddToActorHitCount: ldx ZpF9 ; CPU:$EB98 PRG:2B98 A6 F9 clc ; CPU:$EB9A PRG:2B9A 18 adc $0609,x ; CPU:$EB9B PRG:2B9B 7D 09 06 sta $0609,x ; CPU:$EB9E PRG:2B9E 9D 09 06 bcc AddToActorHitCount_Loop_3 ; CPU:$EBA1 PRG:2BA1 90 20 lda $060E,x ; CPU:$EBA3 PRG:2BA3 BD 0E 06 clc ; CPU:$EBA6 PRG:2BA6 18 adc #$01 ; CPU:$EBA7 PRG:2BA7 69 01 cmp #$03 ; CPU:$EBA9 PRG:2BA9 C9 03 bcc AddToActorHitCount_Loop ; CPU:$EBAB PRG:2BAB 90 02 lda #$00 ; CPU:$EBAD PRG:2BAD A9 00 ;=============================================================================== ; Routine: AddToActorHitCount_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: stores A to $060E,x; copies A into Y; loads ; A from $EBC4,y; loads X from Zp79; compares X with $04; branches on ; carry set to AddToActorHitCount_Loop_2; 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, Zp76, $060E. ; ;=============================================================================== AddToActorHitCount_Loop: sta $060E,x ; CPU:$EBAF PRG:2BAF 9D 0E 06 tay ; CPU:$EBB2 PRG:2BB2 A8 lda $EBC4,y ; CPU:$EBB3 PRG:2BB3 B9 C4 EB ldx Zp79 ; CPU:$EBB6 PRG:2BB6 A6 79 cpx #$04 ; CPU:$EBB8 PRG:2BB8 E0 04 bcs AddToActorHitCount_Loop_2 ; CPU:$EBBA PRG:2BBA B0 03 lda $EBC7,y ; CPU:$EBBC PRG:2BBC B9 C7 EB ;=============================================================================== ; Routine: AddToActorHitCount_Loop_2 ; Global: The routine reads no RAM 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 ZpF9; stores A to Zp76,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, Zp76. ; ;=============================================================================== AddToActorHitCount_Loop_2: ldx ZpF9 ; CPU:$EBBF PRG:2BBF A6 F9 sta Zp76,x ; CPU:$EBC1 PRG:2BC1 95 76 ;=============================================================================== ; Routine: AddToActorHitCount_Loop_3 ; Global: The routine reads no RAM 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. ; ;=============================================================================== AddToActorHitCount_Loop_3: rts ; CPU:$EBC3 PRG:2BC3 60 ; ---- data $EBC4-$EC93 (208 bytes) ---- ; referenced by `lda $EBC4,y` at $EBB3 (operand $EBC4 falls inside this region) ; referenced by `lda $EBC7,y` at $EBBC (operand $EBC7 falls inside this region) ObjectSpriteRowTable: .byte $16, $17, $18 ; CPU:$EBC4 PRG:2BC4 16 17 18 ObjectSpriteRowTableAlt: .byte $13, $14, $15, $C0, $FF, $80, $80, $FF, $40, $20, $03, $E9, $A0 ; CPU:$EBC7 PRG:2BC7 13 14 15 C0 FF 80 80 FF 40 20 03 E9 A0 .byte $03, $B9, $15, $EC, $99, $8C, $00, $88, $10, $F7, $A2, $20, $20, $69, $E9, $A9 ; CPU:$EBD4 PRG:2BD4 03 B9 15 EC 99 8C 00 88 10 F7 A2 20 20 69 E9 A9 .byte $05, $85, $79, $86, $F9, $B5, $70, $F0, $1D, $20, $6C, $CC, $A5, $DF, $F0, $11 ; CPU:$EBE4 PRG:2BE4 05 85 79 86 F9 B5 70 F0 1D 20 6C CC A5 DF F0 11 .byte $20, $8F, $CC, $90, $11, $8A, $20, $E4, $F7, $AA, $CA, $CA, $A9, $01, $9D, $D9 ; CPU:$EBF4 PRG:2BF4 20 8F CC 90 11 8A 20 E4 F7 AA CA CA A9 01 9D D9 .byte $00, $20, $7E, $CC, $B0, $0F, $C6, $79, $F0, $B5, $A6, $F9, $20, $EC, $C9, $D0 ; CPU:$EC04 PRG:2C04 00 20 7E CC B0 0F C6 79 F0 B5 A6 F9 20 EC C9 D0 .byte $D2, $02, $06, $04, $0C, $A9, $10, $8D, $14, $03, $4C, $FE, $E8, $A2, $FF, $8E ; CPU:$EC14 PRG:2C14 D2 02 06 04 0C A9 10 8D 14 03 4C FE E8 A2 FF 8E .byte $06, $05, $8E, $16, $05, $8E, $26, $05, $E8, $86, $BE, $86, $B9, $86, $B3, $86 ; CPU:$EC24 PRG:2C24 06 05 8E 16 05 8E 26 05 E8 86 BE 86 B9 86 B3 86 .byte $87, $86, $97, $E8, $86, $B8, $A2, $38, $86, $BF, $4C, $2D, $E5, $A6, $CF, $F0 ; CPU:$EC34 PRG:2C34 87 86 97 E8 86 B8 A2 38 86 BF 4C 2D E5 A6 CF F0 .byte $DC, $A5, $0F, $F0, $06, $20, $58, $DC, $4C, $60, $EC, $20, $07, $D8, $20, $11 ; CPU:$EC44 PRG:2C44 DC A5 0F F0 06 20 58 DC 4C 60 EC 20 07 D8 20 11 .byte $DA, $B0, $03, $20, $B6, $DB, $20, $5F, $EE, $20, $D9, $EE, $20, $42, $ED, $20 ; CPU:$EC54 PRG:2C54 DA B0 03 20 B6 DB 20 5F EE 20 D9 EE 20 42 ED 20 .byte $A1, $EC, $A2, $20, $BC, $06, $05, $10, $1C, $20, $F2, $C9, $10, $F6, $A5, $52 ; CPU:$EC64 PRG:2C64 A1 EC A2 20 BC 06 05 10 1C 20 F2 C9 10 F6 A5 52 .byte $C9, $05, $D0, $10, $A9, $00, $85, $6C, $A2, $20, $20, $9A, $E5, $B0, $0C, $20 ; CPU:$EC74 PRG:2C74 C9 05 D0 10 A9 00 85 6C A2 20 20 9A E5 B0 0C 20 .byte $F2, $C9, $10, $F6, $60, $A9, $00, $85, $51, $E6, $6C, $A9, $FF, $9D, $06, $05 ; CPU:$EC84 PRG:2C84 F2 C9 10 F6 60 A9 00 85 51 E6 6C A9 FF 9D 06 05 ;=============================================================================== ; Routine: ClearActorSpriteRecord ; Global: The routine reads no RAM 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 $0500,x; ; stores A to $0505,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 RAM fields it writes. ; ;=============================================================================== ClearActorSpriteRecord: lda #$00 ; CPU:$EC94 PRG:2C94 A9 00 sta $0500,x ; CPU:$EC96 PRG:2C96 9D 00 05 sta $0505,x ; CPU:$EC99 PRG:2C99 9D 05 05 ;=============================================================================== ; Routine: StartActorSpriteDraw ; Global: The routine calls InitActorSpriteDraw. ; Local: Executes 2 instructions: loads A with $67; calls InitActorSpriteDraw. ; 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 RAM fields it writes. ; ;=============================================================================== StartActorSpriteDraw: lda #$67 ; CPU:$EC9C PRG:2C9C A9 67 jmp InitActorSpriteDraw ; CPU:$EC9E PRG:2C9E 4C 26 ED ; ---- data $ECA1-$ED20 (128 bytes) ---- .byte $A5, $69, $F0, $2F, $C9, $01, $D0, $06, $A5, $68, $C9, $18, $90, $25, $A5, $52 ; CPU:$ECA1 PRG:2CA1 A5 69 F0 2F C9 01 D0 06 A5 68 C9 18 90 25 A5 52 .byte $C9, $04, $D0, $1F, $A2, $90, $BD, $00, $05, $F0, $06, $20, $16, $CC, $B0, $01 ; CPU:$ECB1 PRG:2CB1 C9 04 D0 1F A2 90 BD 00 05 F0 06 20 16 CC B0 01 .byte $60, $A5, $C9, $C9, $02, $F0, $0C, $A2, $20, $BD, $00, $05, $F0, $06, $20, $F2 ; CPU:$ECC1 PRG:2CC1 60 A5 C9 C9 02 F0 0C A2 20 BD 00 05 F0 06 20 F2 .byte $C9, $10, $F6, $60, $20, $B0, $E6, $86, $8C, $A2, $20, $E4, $8C, $F0, $14, $BD ; CPU:$ECD1 PRG:2CD1 C9 10 F6 60 20 B0 E6 86 8C A2 20 E4 8C F0 14 BD .byte $00, $05, $F0, $0F, $20, $16, $CC, $B0, $06, $C5, $7B, $B0, $E6, $90, $04, $C9 ; CPU:$ECE1 PRG:2CE1 00 05 F0 0F 20 16 CC B0 06 C5 7B B0 E6 90 04 C9 .byte $21, $90, $E0, $20, $F2, $C9, $10, $E3, $A6, $8C, $A5, $6A, $29, $F8, $9D, $01 ; CPU:$ECF1 PRG:2CF1 21 90 E0 20 F2 C9 10 E3 A6 8C A5 6A 29 F8 9D 01 .byte $05, $A5, $6B, $29, $01, $49, $01, $9D, $02, $05, $A9, $B8, $9D, $03, $05, $A9 ; CPU:$ED01 PRG:2D01 05 A5 6B 29 01 49 01 9D 02 05 A9 B8 9D 03 05 A9 .byte $06, $9D, $04, $05, $A9, $01, $9D, $05, $05, $E6, $6D, $A9, $FF, $9D, $06, $05 ; CPU:$ED11 PRG:2D11 06 9D 04 05 A9 01 9D 05 05 E6 6D A9 FF 9D 06 05 ;=============================================================================== ; Routine: HideActorSprite ; Global: The routine reads no RAM 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 $FF; stores A to $0500,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 RAM fields it writes. ; ;=============================================================================== HideActorSprite: lda #$FF ; CPU:$ED21 PRG:2D21 A9 FF sta $0500,x ; CPU:$ED23 PRG:2D23 9D 00 05 ;=============================================================================== ; Routine: InitActorSpriteDraw ; Global: The routine reads no RAM 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 X to ZpF9; stores A to Zp8B; loads A ; with $04; stores A to Zp79; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== InitActorSpriteDraw: stx ZpF9 ; CPU:$ED26 PRG:2D26 86 F9 sta Zp8B ; CPU:$ED28 PRG:2D28 85 8B lda #$04 ; CPU:$ED2A PRG:2D2A A9 04 sta Zp79 ; CPU:$ED2C PRG:2D2C 85 79 ldy #$00 ; CPU:$ED2E PRG:2D2E A0 00 ;=============================================================================== ; Routine: InitActorSpriteDraw_OnNonzero ; Global: The routine calls LoadObjectSpriteScript. ; Local: Executes 9 instructions: loads A from $0501,x; stores A to Zp8C,y; ; increments Y; increments X; decrements Zp79; branches on not equal ; to InitActorSpriteDraw_OnNonzero; 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, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== InitActorSpriteDraw_OnNonzero: lda $0501,x ; CPU:$ED30 PRG:2D30 BD 01 05 sta a:Zp8C,y ; CPU:$ED33 PRG:2D33 99 8C 00 iny ; CPU:$ED36 PRG:2D36 C8 inx ; CPU:$ED37 PRG:2D37 E8 dec Zp79 ; CPU:$ED38 PRG:2D38 C6 79 bne InitActorSpriteDraw_OnNonzero ; CPU:$ED3A PRG:2D3A D0 F4 jsr LoadObjectSpriteScript ; CPU:$ED3C PRG:2D3C 20 C4 D1 ldx ZpF9 ; CPU:$ED3F PRG:2D3F A6 F9 rts ; CPU:$ED41 PRG:2D41 60 ;=============================================================================== ; Routine: UpdateActorSprites ; Global: The routine calls SetActorSpriteLimitThree, FindActiveActorSprite and MoveActorSpriteThree. ; Local: Executes 6 instructions: calls SetActorSpriteLimitThree; calls FindActiveActorSprite; loads A from ; Zp52; compares A with $03; branches on carry set to SetActorSpriteLimitThree_Loop_2; calls ; MoveActorSpriteThree. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 RAM fields it writes. ; ;=============================================================================== UpdateActorSprites: jsr SetActorSpriteLimitThree ; CPU:$ED42 PRG:2D42 20 51 ED jsr FindActiveActorSprite ; CPU:$ED45 PRG:2D45 20 FE ED lda Zp52 ; CPU:$ED48 PRG:2D48 A5 52 cmp #$03 ; CPU:$ED4A PRG:2D4A C9 03 bcs SetActorSpriteLimitThree_Loop_2 ; CPU:$ED4C PRG:2D4C B0 17 jmp MoveActorSpriteThree ; CPU:$ED4E PRG:2D4E 4C 28 EE ;=============================================================================== ; Routine: SetActorSpriteLimitThree ; Global: The routine reads no RAM 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 $02; 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 and V flags, the RAM fields it writes. ; ;=============================================================================== SetActorSpriteLimitThree: ldy #$02 ; CPU:$ED51 PRG:2D51 A0 02 ldx #$10 ; CPU:$ED53 PRG:2D53 A2 10 ;=============================================================================== ; Routine: SetActorSpriteLimitThree_OnNonzero ; Global: The routine calls ClearActorSpriteRecords. ; Local: Executes 5 instructions: loads A from Zp70,x; branches on equal to ; SetActorSpriteLimitThree_Loop; stores Y to ZpFA; calls ClearActorSpriteRecords; loads Y from ZpFA. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SetActorSpriteLimitThree_OnNonzero: lda Zp70,x ; CPU:$ED55 PRG:2D55 B5 70 beq SetActorSpriteLimitThree_Loop ; CPU:$ED57 PRG:2D57 F0 07 sty ZpFA ; CPU:$ED59 PRG:2D59 84 FA jsr ClearActorSpriteRecords ; CPU:$ED5B PRG:2D5B 20 66 ED ldy ZpFA ; CPU:$ED5E PRG:2D5E A4 FA ;=============================================================================== ; Routine: SetActorSpriteLimitThree_Loop ; Global: The routine calls ClearActorSpriteRecords. ; Local: Executes 8 instructions: loads A from Zp70,x; branches on equal to ; SetActorSpriteLimitThree_Loop; stores Y to ZpFA; calls ClearActorSpriteRecords; loads Y from ZpFA; ; loads X with $20; 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. ; ;=============================================================================== SetActorSpriteLimitThree_Loop: ldx #$20 ; CPU:$ED60 PRG:2D60 A2 20 dey ; CPU:$ED62 PRG:2D62 88 bne SetActorSpriteLimitThree_OnNonzero ; CPU:$ED63 PRG:2D63 D0 F0 ;=============================================================================== ; Routine: SetActorSpriteLimitThree_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== SetActorSpriteLimitThree_Loop_2: rts ; CPU:$ED65 PRG:2D65 60 ;=============================================================================== ; Routine: ClearActorSpriteRecords ; Global: The routine calls MoveActorSprite, AdvanceActorSpriteOffset and InitActorSpriteRecord. ; Local: Executes 17 instructions: loads A from Zp77,x; branches on not equal ; to ClearActorSpriteRecords_OnZero_2; calls MoveActorSprite; calls AdvanceActorSpriteOffset; loads A from ZpDE; ; branches on equal to ClearActorSpriteRecords_OnZero; 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. ; ;=============================================================================== ClearActorSpriteRecords: lda Zp77,x ; CPU:$ED66 PRG:2D66 B5 77 bne ClearActorSpriteRecords_OnZero_2 ; CPU:$ED68 PRG:2D68 D0 23 jsr MoveActorSprite ; CPU:$ED6A PRG:2D6A 20 B3 ED jsr AdvanceActorSpriteOffset ; CPU:$ED6D PRG:2D6D 20 0A EE lda ZpDE ; CPU:$ED70 PRG:2D70 A5 DE beq ClearActorSpriteRecords_OnZero ; CPU:$ED72 PRG:2D72 F0 18 lda #$00 ; CPU:$ED74 PRG:2D74 A9 00 sta Zp70,x ; CPU:$ED76 PRG:2D76 95 70 lda Zp74,x ; CPU:$ED78 PRG:2D78 B5 74 sta Zp77 ; CPU:$ED7A PRG:2D7A 85 77 ldx #$20 ; CPU:$ED7C PRG:2D7C A2 20 jsr InitActorSpriteRecord ; CPU:$ED7E PRG:2D7E 20 C2 EE lda #$02 ; CPU:$ED81 PRG:2D81 A9 02 ldy ZpDE ; CPU:$ED83 PRG:2D83 A4 DE dey ; CPU:$ED85 PRG:2D85 88 beq ClearActorSpriteRecords_Loop ; CPU:$ED86 PRG:2D86 F0 02 lda #$01 ; CPU:$ED88 PRG:2D88 A9 01 ;=============================================================================== ; Routine: ClearActorSpriteRecords_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: stores A to Zp77,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: ; no register, Zp77. ; ;=============================================================================== ClearActorSpriteRecords_Loop: sta Zp77,x ; CPU:$ED8A PRG:2D8A 95 77 ;=============================================================================== ; Routine: ClearActorSpriteRecords_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 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. ; ;=============================================================================== ClearActorSpriteRecords_OnZero: rts ; CPU:$ED8C PRG:2D8C 60 ;=============================================================================== ; Routine: ClearActorSpriteRecords_OnZero_2 ; Global: The routine calls MoveActorSpriteTwo. ; Local: Executes 14 instructions: returns with RTS; loads Y from Zp77,x; ; branches on equal to ClearActorSpriteRecords_OnZero; loads Y with $00; calls MoveActorSpriteTwo; ; loads Y from Zp77,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 Y, the N, Z, C and V flags, Zp70, Zp74, Zp76, $0608, $0609. ; ;=============================================================================== ClearActorSpriteRecords_OnZero_2: ldy Zp77,x ; CPU:$ED8D PRG:2D8D B4 77 beq ClearActorSpriteRecords_OnZero ; CPU:$ED8F PRG:2D8F F0 FB ldy #$00 ; CPU:$ED91 PRG:2D91 A0 00 jsr MoveActorSpriteTwo ; CPU:$ED93 PRG:2D93 20 E7 ED ldy Zp77,x ; CPU:$ED96 PRG:2D96 B4 77 lda Zp74,x ; CPU:$ED98 PRG:2D98 B5 74 cpy #$01 ; CPU:$ED9A PRG:2D9A C0 01 beq ClearActorSpriteRecords_Loop_2 ; CPU:$ED9C PRG:2D9C F0 09 sec ; CPU:$ED9E PRG:2D9E 38 sbc #$02 ; CPU:$ED9F PRG:2D9F E9 02 sta Zp74,x ; CPU:$EDA1 PRG:2DA1 95 74 bcs ClearActorSpriteRecords_OnZero ; CPU:$EDA3 PRG:2DA3 B0 E7 bcc ClearActorSpriteRecords_Loop_3 ; CPU:$EDA5 PRG:2DA5 90 07 ;=============================================================================== ; Routine: ClearActorSpriteRecords_Loop_2 ; Global: The routine reads no RAM 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; clears the carry flag; ; adds $02 to A; stores A to Zp74,x; branches on carry clear to ; ClearActorSpriteRecords_OnZero. ; 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, Zp70, Zp74. ; ;=============================================================================== ClearActorSpriteRecords_Loop_2: clc ; CPU:$EDA7 PRG:2DA7 18 adc #$02 ; CPU:$EDA8 PRG:2DA8 69 02 sta Zp74,x ; CPU:$EDAA PRG:2DAA 95 74 bcc ClearActorSpriteRecords_OnZero ; CPU:$EDAC PRG:2DAC 90 DE ;=============================================================================== ; Routine: ClearActorSpriteRecords_Loop_3 ; Global: The routine reads no RAM 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 Zp70,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, Zp70. ; ;=============================================================================== ClearActorSpriteRecords_Loop_3: lda #$00 ; CPU:$EDAE PRG:2DAE A9 00 sta Zp70,x ; CPU:$EDB0 PRG:2DB0 95 70 rts ; CPU:$EDB2 PRG:2DB2 60 ;=============================================================================== ; Routine: MoveActorSprite ; Global: The routine calls AddToActorSpriteOffset. ; Local: Executes 6 instructions: loads A from Zp0F; branches on not equal to ; AddToActorSpriteOffset_Loop; loads A with $20; calls AddToActorSpriteOffset; branches on carry clear ; to AddToActorSpriteOffset_Loop; loads Y from ZpCA. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp76, $0608, $0609. ; ;=============================================================================== MoveActorSprite: lda Zp0F ; CPU:$EDB3 PRG:2DB3 A5 0F bne AddToActorSpriteOffset_Loop; CPU:$EDB5 PRG:2DB5 D0 43 lda #$20 ; CPU:$EDB7 PRG:2DB7 A9 20 jsr AddToActorSpriteOffset ; CPU:$EDB9 PRG:2DB9 20 F3 ED bcc AddToActorSpriteOffset_Loop; CPU:$EDBC PRG:2DBC 90 3C ldy ZpCA ; CPU:$EDBE PRG:2DBE A4 CA ;=============================================================================== ; Routine: AdvanceActorSpriteRow ; Global: The routine reads no RAM 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: branches on equal to AddToActorSpriteOffset_Loop; decrements Y; ; branches on equal to AdvanceActorSpriteRow_Loop; increments $0608,x; loads A from ; $0608,x; compares A with $03; 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 and C flags, Zp76, $0608. ; ;=============================================================================== AdvanceActorSpriteRow: beq AddToActorSpriteOffset_Loop; CPU:$EDC0 PRG:2DC0 F0 38 dey ; CPU:$EDC2 PRG:2DC2 88 beq AdvanceActorSpriteRow_Loop ; CPU:$EDC3 PRG:2DC3 F0 0E inc $0608,x ; CPU:$EDC5 PRG:2DC5 FE 08 06 lda $0608,x ; CPU:$EDC8 PRG:2DC8 BD 08 06 cmp #$03 ; CPU:$EDCB PRG:2DCB C9 03 bcc AdvanceActorSpriteRow_Loop_2 ; CPU:$EDCD PRG:2DCD 90 0E lda #$00 ; CPU:$EDCF PRG:2DCF A9 00 beq AdvanceActorSpriteRow_Loop_2 ; CPU:$EDD1 PRG:2DD1 F0 0A ;=============================================================================== ; Routine: AdvanceActorSpriteRow_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 4 instructions: decrements $0608,x; loads A from $0608,x; ; branches on non-negative to AdvanceActorSpriteRow_Loop_2; 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 and Y, the N and Z flags, Zp76, $0608. ; ;=============================================================================== AdvanceActorSpriteRow_Loop: dec $0608,x ; CPU:$EDD3 PRG:2DD3 DE 08 06 lda $0608,x ; CPU:$EDD6 PRG:2DD6 BD 08 06 bpl AdvanceActorSpriteRow_Loop_2 ; CPU:$EDD9 PRG:2DD9 10 02 lda #$02 ; CPU:$EDDB PRG:2DDB A9 02 ;=============================================================================== ; Routine: AdvanceActorSpriteRow_Loop_2 ; Global: The routine reads no RAM 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 $0608,x; copies A into Y; loads ; A from $EDFB,y; stores A to Zp76,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 and Z flags, Zp76, $0608. ; ;=============================================================================== AdvanceActorSpriteRow_Loop_2: sta $0608,x ; CPU:$EDDD PRG:2DDD 9D 08 06 tay ; CPU:$EDE0 PRG:2DE0 A8 lda $EDFB,y ; CPU:$EDE1 PRG:2DE1 B9 FB ED sta Zp76,x ; CPU:$EDE4 PRG:2DE4 95 76 rts ; CPU:$EDE6 PRG:2DE6 60 ;=============================================================================== ; Routine: MoveActorSpriteTwo ; Global: The routine calls AddToActorSpriteOffset and AdvanceActorSpriteRow. ; Local: Executes 5 instructions: loads A with $40; calls AddToActorSpriteOffset; branches ; on carry clear to AddToActorSpriteOffset_Loop; loads Y from Zp77,x; calls AdvanceActorSpriteRow. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp76, $0608, $0609. ; ;=============================================================================== MoveActorSpriteTwo: lda #$40 ; CPU:$EDE7 PRG:2DE7 A9 40 jsr AddToActorSpriteOffset ; CPU:$EDE9 PRG:2DE9 20 F3 ED bcc AddToActorSpriteOffset_Loop; CPU:$EDEC PRG:2DEC 90 0C ldy Zp77,x ; CPU:$EDEE PRG:2DEE B4 77 jmp AdvanceActorSpriteRow ; CPU:$EDF0 PRG:2DF0 4C C0 ED ;=============================================================================== ; Routine: AddToActorSpriteOffset ; Global: The routine reads no RAM 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; adds $0609,x to A; ; stores A to $0609,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: ; no register, the N, Z, C and V flags, $0609. ; ;=============================================================================== AddToActorSpriteOffset: clc ; CPU:$EDF3 PRG:2DF3 18 adc $0609,x ; CPU:$EDF4 PRG:2DF4 7D 09 06 sta $0609,x ; CPU:$EDF7 PRG:2DF7 9D 09 06 ;=============================================================================== ; Routine: AddToActorSpriteOffset_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: 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. ; ;=============================================================================== AddToActorSpriteOffset_Loop: rts ; CPU:$EDFA PRG:2DFA 60 ; ---- data $EDFB-$EDFD (3 bytes) ---- ; referenced by `lda $EDFB,y` at $EDE1 (operand $EDFB falls inside this region) ObjectTypeTable: .byte $20, $21, $35 ; CPU:$EDFB PRG:2DFB 20 21 35 ;=============================================================================== ; Routine: FindActiveActorSprite ; Global: The routine calls MoveActorSpriteTwo. ; Local: Executes 28 instructions: returns with RTS; loads Y from Zp77,x; ; branches on equal to ClearActorSpriteRecords_OnZero; loads Y with $00; calls MoveActorSpriteTwo; ; loads Y from Zp77,x; 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, Zp70, Zp74, Zp76, Zp84, $0608, ; $0609. ; ;=============================================================================== FindActiveActorSprite: ldx #$30 ; CPU:$EDFE PRG:2DFE A2 30 lda Zp70,x ; CPU:$EE00 PRG:2E00 B5 70 beq AddToActorSpriteOffset_Loop; CPU:$EE02 PRG:2E02 F0 F6 lda Zp75,x ; CPU:$EE04 PRG:2E04 B5 75 bne AddToActorSpriteOffset_Loop; CPU:$EE06 PRG:2E06 D0 F2 beq ClearActorSpriteRecords_OnZero_2 ; CPU:$EE08 PRG:2E08 F0 83 ;=============================================================================== ; Routine: AdvanceActorSpriteOffset ; Global: The routine reads no RAM 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 Zp84; compares A with ZpBF; ; branches on equal to AdvanceActorSpriteOffset_Loop_2; branches on carry clear to AdvanceActorSpriteOffset_Loop; ; decrements Zp84; loads A from Zp84; 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, the N, Z and C flags, Zp84. ; ;=============================================================================== AdvanceActorSpriteOffset: lda Zp84 ; CPU:$EE0A PRG:2E0A A5 84 cmp ZpBF ; CPU:$EE0C PRG:2E0C C5 BF beq AdvanceActorSpriteOffset_Loop_2 ; CPU:$EE0E PRG:2E0E F0 17 bcc AdvanceActorSpriteOffset_Loop ; CPU:$EE10 PRG:2E10 90 0B dec Zp84 ; CPU:$EE12 PRG:2E12 C6 84 lda Zp84 ; CPU:$EE14 PRG:2E14 A5 84 cmp ZpBF ; CPU:$EE16 PRG:2E16 C5 BF beq AdvanceActorSpriteOffset_Loop_2 ; CPU:$EE18 PRG:2E18 F0 0D dec Zp84 ; CPU:$EE1A PRG:2E1A C6 84 rts ; CPU:$EE1C PRG:2E1C 60 ;=============================================================================== ; Routine: AdvanceActorSpriteOffset_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: increments Zp84; loads A from Zp84; compares ; A with ZpBF; branches on equal to AdvanceActorSpriteOffset_Loop_2; increments Zp84. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp84. ; ;=============================================================================== AdvanceActorSpriteOffset_Loop: inc Zp84 ; CPU:$EE1D PRG:2E1D E6 84 lda Zp84 ; CPU:$EE1F PRG:2E1F A5 84 cmp ZpBF ; CPU:$EE21 PRG:2E21 C5 BF beq AdvanceActorSpriteOffset_Loop_2 ; CPU:$EE23 PRG:2E23 F0 02 inc Zp84 ; CPU:$EE25 PRG:2E25 E6 84 ;=============================================================================== ; Routine: AdvanceActorSpriteOffset_Loop_2 ; Global: The routine reads no RAM 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. ; ;=============================================================================== AdvanceActorSpriteOffset_Loop_2: rts ; CPU:$EE27 PRG:2E27 60 ;=============================================================================== ; Routine: MoveActorSpriteThree ; Global: The routine calls GetActorSpriteSlot. ; Local: Executes 17 instructions: returns with RTS; calls GetActorSpriteSlot; loads A ; from $0500,x; branches on equal to AdvanceActorSpriteOffset_Loop_2; loads A from $0509,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, X and Y, the N, Z, C, I and V flags, the RAM fields it writes. ; ;=============================================================================== MoveActorSpriteThree: jsr GetActorSpriteSlot ; CPU:$EE28 PRG:2E28 20 DA F7 lda $0500,x ; CPU:$EE2B PRG:2E2B BD 00 05 beq AdvanceActorSpriteOffset_Loop_2 ; CPU:$EE2E PRG:2E2E F0 F7 lda $0509,x ; CPU:$EE30 PRG:2E30 BD 09 05 clc ; CPU:$EE33 PRG:2E33 18 adc #$80 ; CPU:$EE34 PRG:2E34 69 80 sta $0509,x ; CPU:$EE36 PRG:2E36 9D 09 05 bcc AdvanceActorSpriteOffset_Loop_2 ; CPU:$EE39 PRG:2E39 90 EC lda $0501,x ; CPU:$EE3B PRG:2E3B BD 01 05 sec ; CPU:$EE3E PRG:2E3E 38 sbc #$02 ; CPU:$EE3F PRG:2E3F E9 02 sta $0501,x ; CPU:$EE41 PRG:2E41 9D 01 05 bcs MoveActorSpriteThree_Loop ; CPU:$EE44 PRG:2E44 B0 08 lda $0502,x ; CPU:$EE46 PRG:2E46 BD 02 05 eor #$01 ; CPU:$EE49 PRG:2E49 49 01 sta $0502,x ; CPU:$EE4B PRG:2E4B 9D 02 05 ;=============================================================================== ; Routine: MoveActorSpriteThree_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 6 instructions: loads Y from $0504,x; increments Y; copies Y ; into A; compares Y with $0A; branches on carry clear to MoveActorSpriteThree_Loop_2; ; loads A 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: 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 RAM fields it writes. ; ;=============================================================================== MoveActorSpriteThree_Loop: ldy $0504,x ; CPU:$EE4E PRG:2E4E BC 04 05 iny ; CPU:$EE51 PRG:2E51 C8 tya ; CPU:$EE52 PRG:2E52 98 cpy #$0A ; CPU:$EE53 PRG:2E53 C0 0A bcc MoveActorSpriteThree_Loop_2; CPU:$EE55 PRG:2E55 90 02 lda #$06 ; CPU:$EE57 PRG:2E57 A9 06 ;=============================================================================== ; Routine: MoveActorSpriteThree_Loop_2 ; Global: The routine calls HideActorSprite. ; Local: Executes 2 instructions: stores A to $0504,x; calls HideActorSprite. ; 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 RAM fields it writes. ; ;=============================================================================== MoveActorSpriteThree_Loop_2: sta $0504,x ; CPU:$EE59 PRG:2E59 9D 04 05 jmp HideActorSprite ; CPU:$EE5C PRG:2E5C 4C 21 ED ; ---- data $EE5F-$EEC1 (99 bytes) ---- .byte $A5, $BE, $05, $87, $D0, $2A, $A5, $80, $F0, $26, $A9, $08, $85, $77, $20, $74 ; CPU:$EE5F PRG:2E5F A5 BE 05 87 D0 2A A5 80 F0 26 A9 08 85 77 20 74 .byte $EF, $A2, $20, $BD, $06, $05, $10, $0F, $BD, $00, $05, $F0, $0A, $20, $53, $EF ; CPU:$EE6F PRG:2E6F EF A2 20 BD 06 05 10 0F BD 00 05 F0 0A 20 53 EF .byte $B0, $05, $20, $8F, $CC, $B0, $0A, $20, $F2, $C9, $10, $E7, $A9, $00, $85, $BE ; CPU:$EE7F PRG:2E7F B0 05 20 8F CC B0 0A 20 F2 C9 10 E7 A9 00 85 BE .byte $60, $E6, $BE, $A9, $67, $9D, $06, $05, $A2, $30, $20, $C2, $EE, $A5, $CA, $F0 ; CPU:$EE8F PRG:2E8F 60 E6 BE A9 67 9D 06 05 A2 30 20 C2 EE A5 CA F0 .byte $15, $38, $E9, $01, $F0, $08, $A9, $01, $85, $77, $A9, $02, $D0, $0E, $A9, $02 ; CPU:$EE9F PRG:2E9F 15 38 E9 01 F0 08 A9 01 85 77 A9 02 D0 0E A9 02 .byte $85, $77, $A9, $01, $D0, $06, $A9, $02, $85, $77, $A9, $00, $85, $A7, $A5, $77 ; CPU:$EEAF PRG:2EAF 85 77 A9 01 D0 06 A9 02 85 77 A9 00 85 A7 A5 77 .byte $85, $87, $60 ; CPU:$EEBF PRG:2EBF 85 87 60 ;=============================================================================== ; Routine: InitActorSpriteRecord ; Global: The routine reads no RAM 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 $01; stores A to Zp70,x; loads ; A with $B8; stores A to Zp73,x; loads A from Zp77; stores A to ; Zp74,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: Falls through to the next routine in the source; it has no return ; of its own. ; Clobbers: ; A, the N and Z flags, Zp70, Zp73, Zp74, Zp75, Zp76, Zp77. ; ;=============================================================================== InitActorSpriteRecord: lda #$01 ; CPU:$EEC2 PRG:2EC2 A9 01 sta Zp70,x ; CPU:$EEC4 PRG:2EC4 95 70 lda #$B8 ; CPU:$EEC6 PRG:2EC6 A9 B8 sta Zp73,x ; CPU:$EEC8 PRG:2EC8 95 73 lda Zp77 ; CPU:$EECA PRG:2ECA A5 77 sta Zp74,x ; CPU:$EECC PRG:2ECC 95 74 lda #$00 ; CPU:$EECE PRG:2ECE A9 00 ;=============================================================================== ; Routine: SetActorSpriteRecord ; Global: The routine reads no RAM 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 Zp75,x; stores A to Zp77,x; ; loads A with $20; stores A to Zp76,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, Zp75, Zp76, Zp77. ; ;=============================================================================== SetActorSpriteRecord: sta Zp75,x ; CPU:$EED0 PRG:2ED0 95 75 sta Zp77,x ; CPU:$EED2 PRG:2ED2 95 77 lda #$20 ; CPU:$EED4 PRG:2ED4 A9 20 sta Zp76,x ; CPU:$EED6 PRG:2ED6 95 76 rts ; CPU:$EED8 PRG:2ED8 60 ;=============================================================================== ; Routine: SelectActorSpriteRecord ; Global: The routine reads no RAM 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 ZpB3; branches on not equal to ; SelectActorSpriteRecord_Loop; loads A from ZpDF; branches on not equal to SelectActorSpriteRecord_Loop_2; ; loads A from ZpBE; branches on equal to SelectActorSpriteRecord_Loop_6; 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. ; ;=============================================================================== SelectActorSpriteRecord: ldx ZpB3 ; CPU:$EED9 PRG:2ED9 A6 B3 bne SelectActorSpriteRecord_Loop ; CPU:$EEDB PRG:2EDB D0 0C lda ZpDF ; CPU:$EEDD PRG:2EDD A5 DF bne SelectActorSpriteRecord_Loop_2 ; CPU:$EEDF PRG:2EDF D0 09 lda ZpBE ; CPU:$EEE1 PRG:2EE1 A5 BE beq SelectActorSpriteRecord_Loop_6 ; CPU:$EEE3 PRG:2EE3 F0 53 ldx #$01 ; CPU:$EEE5 PRG:2EE5 A2 01 stx Zp0F ; CPU:$EEE7 PRG:2EE7 86 0F ;=============================================================================== ; Routine: SelectActorSpriteRecord_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: 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. ; ;=============================================================================== SelectActorSpriteRecord_Loop: rts ; CPU:$EEE9 PRG:2EE9 60 ;=============================================================================== ; Routine: SelectActorSpriteRecord_Loop_2 ; Global: The routine calls SetActorScreenRowThree, SetActorRowOne and CheckActorBoxOverlapThree. ; Local: Executes 9 instructions: calls SetActorScreenRowThree; loads X with $10; loads A ; from Zp70,x; branches on equal to SelectActorSpriteRecord_Loop_3; loads A with $00; ; stores A to Zp77; 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. ; ;=============================================================================== SelectActorSpriteRecord_Loop_2: jsr SetActorScreenRowThree ; CPU:$EEEA PRG:2EEA 20 03 E9 ldx #$10 ; CPU:$EEED PRG:2EED A2 10 lda Zp70,x ; CPU:$EEEF PRG:2EEF B5 70 beq SelectActorSpriteRecord_Loop_3 ; CPU:$EEF1 PRG:2EF1 F0 0C lda #$00 ; CPU:$EEF3 PRG:2EF3 A9 00 sta Zp77 ; CPU:$EEF5 PRG:2EF5 85 77 jsr SetActorRowOne ; CPU:$EEF7 PRG:2EF7 20 74 EF jsr CheckActorBoxOverlapThree ; CPU:$EEFA PRG:2EFA 20 8F CC bcs SelectActorSpriteRecord_Loop_6 ; CPU:$EEFD PRG:2EFD B0 39 ;=============================================================================== ; Routine: SelectActorSpriteRecord_Loop_3 ; Global: The routine reads no RAM 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 Zp73; compares A with $A4; ; branches on carry clear to SelectActorSpriteRecord_Loop_4; loads A with $01; stores A to ; ZpB3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SelectActorSpriteRecord_Loop_3: lda Zp73 ; CPU:$EEFF PRG:2EFF A5 73 cmp #$A4 ; CPU:$EF01 PRG:2F01 C9 A4 bcc SelectActorSpriteRecord_Loop_4 ; CPU:$EF03 PRG:2F03 90 04 lda #$01 ; CPU:$EF05 PRG:2F05 A9 01 sta ZpB3 ; CPU:$EF07 PRG:2F07 85 B3 ;=============================================================================== ; Routine: SelectActorSpriteRecord_Loop_4 ; Global: The routine calls SetActorScreenRowThree. ; Local: Executes 2 instructions: calls SetActorScreenRowThree; loads X with $20. ; 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. ; ;=============================================================================== SelectActorSpriteRecord_Loop_4: jsr SetActorScreenRowThree ; CPU:$EF09 PRG:2F09 20 03 E9 ldx #$20 ; CPU:$EF0C PRG:2F0C A2 20 ;=============================================================================== ; Routine: SelectActorSpriteRecord_OnNonnegative ; Global: The routine calls CheckActorSpriteOverlap, CheckActorBoxOverlapThree and GetActorSpriteSlotTwo. ; Local: Executes 15 instructions: loads A from $0500,x; branches on equal to ; SelectActorSpriteRecord_Loop_5; calls CheckActorSpriteOverlap; branches on carry set to SelectActorSpriteRecord_Loop_5; stores ; X to ZpF9; calls CheckActorBoxOverlapThree; 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. ; ;=============================================================================== SelectActorSpriteRecord_OnNonnegative: lda $0500,x ; CPU:$EF0E PRG:2F0E BD 00 05 beq SelectActorSpriteRecord_Loop_5 ; CPU:$EF11 PRG:2F11 F0 1C jsr CheckActorSpriteOverlap ; CPU:$EF13 PRG:2F13 20 53 EF bcs SelectActorSpriteRecord_Loop_5 ; CPU:$EF16 PRG:2F16 B0 17 stx ZpF9 ; CPU:$EF18 PRG:2F18 86 F9 jsr CheckActorBoxOverlapThree ; CPU:$EF1A PRG:2F1A 20 8F CC bcc SelectActorSpriteRecord_Loop_5 ; CPU:$EF1D PRG:2F1D 90 10 txa ; CPU:$EF1F PRG:2F1F 8A jsr GetActorSpriteSlotTwo ; CPU:$EF20 PRG:2F20 20 DF F7 lda #$01 ; CPU:$EF23 PRG:2F23 A9 01 sta ZpD9,x ; CPU:$EF25 PRG:2F25 95 D9 ldx ZpF9 ; CPU:$EF27 PRG:2F27 A6 F9 lda Zp73 ; CPU:$EF29 PRG:2F29 A5 73 cmp #$A4 ; CPU:$EF2B PRG:2F2B C9 A4 bcs SelectActorSpriteRecord_Loop_8 ; CPU:$EF2D PRG:2F2D B0 0E ;=============================================================================== ; Routine: SelectActorSpriteRecord_Loop_5 ; Global: The routine calls CheckActorSpriteOverlap, CheckActorBoxOverlapThree, GetActorSpriteSlotTwo and PreviousActorSlot. ; Local: Executes 19 instructions: loads A from $0500,x; branches on equal to ; SelectActorSpriteRecord_Loop_5; calls CheckActorSpriteOverlap; branches on carry set to SelectActorSpriteRecord_Loop_5; stores ; X to ZpF9; calls CheckActorBoxOverlapThree; 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, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorSpriteRecord_Loop_5: jsr PreviousActorSlot ; CPU:$EF2F PRG:2F2F 20 F2 C9 bpl SelectActorSpriteRecord_OnNonnegative ; CPU:$EF32 PRG:2F32 10 DA ldx #$00 ; CPU:$EF34 PRG:2F34 A2 00 beq SelectActorSpriteRecord_Loop_7 ; CPU:$EF36 PRG:2F36 F0 02 ;=============================================================================== ; Routine: SelectActorSpriteRecord_Loop_6 ; Global: The routine reads no RAM 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 $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: ; X, the N and Z flags, ZpB8. ; ;=============================================================================== SelectActorSpriteRecord_Loop_6: ldx #$01 ; CPU:$EF38 PRG:2F38 A2 01 ;=============================================================================== ; Routine: SelectActorSpriteRecord_Loop_7 ; Global: The routine reads no RAM 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 X to ZpB8; 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, ZpB8. ; ;=============================================================================== SelectActorSpriteRecord_Loop_7: stx ZpB8 ; CPU:$EF3A PRG:2F3A 86 B8 rts ; CPU:$EF3C PRG:2F3C 60 ;=============================================================================== ; Routine: SelectActorSpriteRecord_Loop_8 ; Global: The routine calls InitActorSpriteRecord. ; Local: Executes 13 instructions: loads X with $01; stores X to ZpB8; returns ; with RTS; loads A with $67; stores A to $0506,x; loads X with $A0; ; 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. ; ;=============================================================================== SelectActorSpriteRecord_Loop_8: lda #$67 ; CPU:$EF3D PRG:2F3D A9 67 sta $0506,x ; CPU:$EF3F PRG:2F3F 9D 06 05 ldx #$A0 ; CPU:$EF42 PRG:2F42 A2 A0 stx Zp73 ; CPU:$EF44 PRG:2F44 86 73 ldx #$10 ; CPU:$EF46 PRG:2F46 A2 10 jsr InitActorSpriteRecord ; CPU:$EF48 PRG:2F48 20 C2 EE lda #$00 ; CPU:$EF4B PRG:2F4B A9 00 sta ZpDE ; CPU:$EF4D PRG:2F4D 85 DE sta ZpB3 ; CPU:$EF4F PRG:2F4F 85 B3 beq SelectActorSpriteRecord_Loop_6 ; CPU:$EF51 PRG:2F51 F0 E5 ;=============================================================================== ; Routine: CheckActorSpriteOverlap ; Global: The routine calls LoadActorPosition, writes $03C9 and $03CB. ; Local: Executes 13 instructions: loads A with $10; stores A to $03C9; calls ; LoadActorPosition; branches on carry set to CheckActorSpriteOverlap_Loop; loads A from $0504,x; ; 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. Leaves $03C9 and $03CB changed. ; Clobbers: ; A and Y, the N, Z, C and V flags, Zp77, Zp78, Zp7A, $03C9, $03CB. ; ;=============================================================================== CheckActorSpriteOverlap: lda #$10 ; CPU:$EF53 PRG:2F53 A9 10 sta $03C9 ; CPU:$EF55 PRG:2F55 8D C9 03 jsr LoadActorPosition ; CPU:$EF58 PRG:2F58 20 16 CC bcs CheckActorSpriteOverlap_Loop ; CPU:$EF5B PRG:2F5B B0 12 lda $0504,x ; CPU:$EF5D PRG:2F5D BD 04 05 sec ; CPU:$EF60 PRG:2F60 38 sbc #$06 ; CPU:$EF61 PRG:2F61 E9 06 tay ; CPU:$EF63 PRG:2F63 A8 lda $EF70,y ; CPU:$EF64 PRG:2F64 B9 70 EF clc ; CPU:$EF67 PRG:2F67 18 adc Zp77 ; CPU:$EF68 PRG:2F68 65 77 sta $03CB ; CPU:$EF6A PRG:2F6A 8D CB 03 bcs CheckActorSpriteOverlap_Loop ; CPU:$EF6D PRG:2F6D B0 00 ;=============================================================================== ; Routine: CheckActorSpriteOverlap_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: 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. ; ;=============================================================================== CheckActorSpriteOverlap_Loop: rts ; CPU:$EF6F PRG:2F6F 60 ; ---- data $EF70-$EF73 (4 bytes) ---- ; referenced by `lda $EF70,y` at $EF64 (operand $EF70 falls inside this region) ObjectOffsetTable: .byte $00, $06, $04, $02 ; CPU:$EF70 PRG:2F70 00 06 04 02 ;=============================================================================== ; Routine: SetActorRowOne ; Global: The routine reads no RAM 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, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorRowOne: ldy #$01 ; CPU:$EF74 PRG:2F74 A0 01 ;=============================================================================== ; Routine: SetActorRowOne_OnNonnegative ; Global: The routine reads no RAM 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 $EF8D,y; loads X from Zp77; ; branches on not equal to SetActorRowOne_Loop; loads A from $EF8D,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, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorRowOne_OnNonnegative: lda $EF8D,y ; CPU:$EF76 PRG:2F76 B9 8D EF ldx Zp77 ; CPU:$EF79 PRG:2F79 A6 77 bne SetActorRowOne_Loop ; CPU:$EF7B PRG:2F7B D0 03 lda $EF8D,y ; CPU:$EF7D PRG:2F7D B9 8D EF ;=============================================================================== ; Routine: SetActorRowOne_Loop ; Global: The routine calls StoreActorBox. ; Local: Executes 10 instructions: loads A from $EF8D,y; loads X from Zp77; ; branches on not equal to SetActorRowOne_Loop; loads A from $EF8D,y; stores A ; to Zp8C,y; decrements 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, $03C8, $03C9, $03CA, $03CB. ; ;=============================================================================== SetActorRowOne_Loop: sta a:Zp8C,y ; CPU:$EF80 PRG:2F80 99 8C 00 dey ; CPU:$EF83 PRG:2F83 88 bpl SetActorRowOne_OnNonnegative ; CPU:$EF84 PRG:2F84 10 F0 ldy Zp77 ; CPU:$EF86 PRG:2F86 A4 77 ldx #$10 ; CPU:$EF88 PRG:2F88 A2 10 jmp StoreActorBox ; CPU:$EF8A PRG:2F8A 4C 62 CC ; ---- data $EF8D-$F06D (225 bytes) ---- ; referenced by `lda $EF8D,y` at $EF76 (operand $EF8D falls inside this region) ; referenced by `lda $EF8D,y` at $EF7D (operand $EF8D falls inside this region) .byte $00, $18, $A6, $CF, $F0, $1F, $A5, $0F, $D0, $15, $20, $11, $DA, $20, $78, $F0 ; CPU:$EF8D PRG:2F8D 00 18 A6 CF F0 1F A5 0F D0 15 20 11 DA 20 78 F0 .byte $20, $C7, $EF, $20, $B5, $F0, $20, $8C, $F0, $20, $07, $D8, $4C, $B6, $DB, $20 ; CPU:$EF9D PRG:2F9D 20 C7 EF 20 B5 F0 20 8C F0 20 07 D8 4C B6 DB 20 .byte $58, $DC, $4C, $A6, $EF, $E6, $CF, $A2, $00, $86, $AF, $8E, $23, $03, $E8, $86 ; CPU:$EFAD PRG:2FAD 58 DC 4C A6 EF E6 CF A2 00 86 AF 8E 23 03 E8 86 .byte $B8, $A5, $6D, $29, $FC, $85, $6D, $4C, $06, $C9, $A5, $69, $C9, $02, $90, $2B ; CPU:$EFBD PRG:2FBD B8 A5 6D 29 FC 85 6D 4C 06 C9 A5 69 C9 02 90 2B .byte $A5, $92, $F0, $0B, $A5, $6A, $29, $F8, $C5, $94, $F0, $1F, $C6, $92, $60, $20 ; CPU:$EFCD PRG:2FCD A5 92 F0 0B A5 6A 29 F8 C5 94 F0 1F C6 92 60 20 .byte $C9, $E6, $A8, $B9, $27, $F0, $29, $F0, $85, $94, $A5, $6A, $29, $F8, $C5, $94 ; CPU:$EFDD PRG:2FDD C9 E6 A8 B9 27 F0 29 F0 85 94 A5 6A 29 F8 C5 94 .byte $D0, $09, $20, $F9, $EF, $E6, $6D, $E6, $6D, $E6, $92, $60, $A2, $20, $BD, $00 ; CPU:$EFED PRG:2FED D0 09 20 F9 EF E6 6D E6 6D E6 92 60 A2 20 BD 00 .byte $05, $F0, $06, $20, $F2, $C9, $10, $F6, $60, $20, $67, $F0, $B9, $27, $F0, $29 ; CPU:$EFFD PRG:2FFD 05 F0 06 20 F2 C9 10 F6 60 20 67 F0 B9 27 F0 29 .byte $03, $84, $8E, $A8, $B9, $23, $F0, $9D, $04, $05, $A4, $8E, $C8, $B9, $27, $F0 ; CPU:$F00D PRG:300D 03 84 8E A8 B9 23 F0 9D 04 05 A4 8E C8 B9 27 F0 .byte $9D, $03, $05, $4C, $1C, $ED, $0E, $0C, $0A, $0E, $78, $98, $B8, $98, $68, $90 ; CPU:$F01D PRG:301D 9D 03 05 4C 1C ED 0E 0C 0A 0E 78 98 B8 98 68 90 .byte $B8, $98, $78, $98, $B8, $90, $78, $90, $B8, $90, $79, $98, $B8, $90, $79, $90 ; CPU:$F02D PRG:302D B8 98 78 98 B8 90 78 90 B8 90 79 98 B8 90 79 90 .byte $C9, $98, $79, $90, $B8, $98, $68, $98, $C9, $98, $59, $98, $C9, $98, $7A, $98 ; CPU:$F03D PRG:303D C9 98 79 90 B8 98 68 98 C9 98 59 98 C9 98 7A 98 .byte $B9, $98, $68, $90, $B9, $78, $78, $98, $BA, $90, $4A, $98, $AA, $98, $6A, $98 ; CPU:$F04D PRG:304D B9 98 68 90 B9 78 78 98 BA 90 4A 98 AA 98 6A 98 .byte $B9, $90, $68, $98, $AA, $78, $58, $98, $C8, $98, $A5, $6A, $29, $F8, $9D, $01 ; CPU:$F05D PRG:305D B9 90 68 98 AA 78 58 98 C8 98 A5 6A 29 F8 9D 01 .byte $05 ; CPU:$F06D PRG:306D 05 ;=============================================================================== ; Routine: FlipActorFacing ; Global: The routine reads no RAM 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 Zp6B; ANDs A with $01; EORs A ; with $01; stores A to $0502,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, $0502. ; ;=============================================================================== FlipActorFacing: lda Zp6B ; CPU:$F06E PRG:306E A5 6B and #$01 ; CPU:$F070 PRG:3070 29 01 eor #$01 ; CPU:$F072 PRG:3072 49 01 sta $0502,x ; CPU:$F074 PRG:3074 9D 02 05 rts ; CPU:$F077 PRG:3077 60 ;=============================================================================== ; Routine: SetActorSlot32 ; Global: The routine reads no RAM 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 $20. ; 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 RAM fields it writes. ; ;=============================================================================== SetActorSlot32: ldx #$20 ; CPU:$F078 PRG:3078 A2 20 ;=============================================================================== ; Routine: SetActorSlot32_OnNonnegative ; Global: The routine calls CheckActorOnScreen and PreviousActorSlot. ; Local: Executes 4 instructions: calls CheckActorOnScreen; branches on carry set to ; SetActorSlot32_Loop; calls PreviousActorSlot; branches on non-negative to SetActorSlot32_OnNonnegative. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 RAM fields it writes. ; ;=============================================================================== SetActorSlot32_OnNonnegative: jsr CheckActorOnScreen ; CPU:$F07A PRG:307A 20 9A E5 bcs SetActorSlot32_Loop ; CPU:$F07D PRG:307D B0 06 jsr PreviousActorSlot ; CPU:$F07F PRG:307F 20 F2 C9 bpl SetActorSlot32_OnNonnegative ; CPU:$F082 PRG:3082 10 F6 ;=============================================================================== ; Routine: SetActorSlot32_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 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. ; ;=============================================================================== SetActorSlot32_OnZero: rts ; CPU:$F084 PRG:3084 60 ;=============================================================================== ; Routine: SetActorSlot32_Loop ; Global: The routine calls ClearActorSpriteRecord. ; Local: Executes 4 instructions: returns with RTS; loads A from Zp6B; ; branches on equal to SetActorSlot32_OnZero; calls ClearActorSpriteRecord. ; 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 RAM fields it writes. ; ;=============================================================================== SetActorSlot32_Loop: lda Zp6B ; CPU:$F085 PRG:3085 A5 6B beq SetActorSlot32_OnZero ; CPU:$F087 PRG:3087 F0 FB jmp ClearActorSpriteRecord ; CPU:$F089 PRG:3089 4C 94 EC ; ---- data $F08C-$F187 (252 bytes) ---- ; referenced by `asl $F0CA,x` at $C1ED (operand $F0CA falls inside this region) .byte $A5, $90, $F0, $0E, $CE, $A7, $00, $D0, $EF, $A9, $00, $85, $A8, $85, $90, $4C ; CPU:$F08C PRG:308C A5 90 F0 0E CE A7 00 D0 EF A9 00 85 A8 85 90 4C .byte $A8, $F0, $A5, $A8, $F0, $E2, $A9, $03, $85, $A7, $E6, $90, $A6, $91, $BD, $04 ; CPU:$F09C PRG:309C A8 F0 A5 A8 F0 E2 A9 03 85 A7 E6 90 A6 91 BD 04 .byte $05, $49, $01, $9D, $04, $05, $4C, $21, $ED, $20, $D1, $D9, $20, $03, $E9, $A2 ; CPU:$F0AC PRG:30AC 05 49 01 9D 04 05 4C 21 ED 20 D1 D9 20 03 E9 A2 .byte $20, $BD, $00, $05, $F0, $2C, $A5, $CB, $0D, $88, $03, $D0, $1B, $20, $02, $F1 ; CPU:$F0BC PRG:30BC 20 BD 00 05 F0 2C A5 CB 0D 88 03 D0 1B 20 02 F1 .byte $B0, $20, $20, $8F, $CC, $90, $1B, $A5, $73, $18, $69, $14, $DD, $03, $05, $90 ; CPU:$F0CC PRG:30CC B0 20 20 8F CC 90 1B A5 73 18 69 14 DD 03 05 90 .byte $11, $E9, $04, $DD, $03, $05, $90, $5D, $20, $F4, $F0, $B0, $05, $20, $7E, $CC ; CPU:$F0DC PRG:30DC 11 E9 04 DD 03 05 90 5D 20 F4 F0 B0 05 20 7E CC .byte $B0, $43, $20, $F2, $C9, $10, $CA, $60, $A9, $0B, $8D, $C8, $03, $A9, $05, $18 ; CPU:$F0EC PRG:30EC B0 43 20 F2 C9 10 CA 60 A9 0B 8D C8 03 A9 05 18 .byte $7D, $03, $05, $8D, $CA, $03, $A9, $00, $8D, $CB, $03, $BD, $04, $05, $38, $E9 ; CPU:$F0FC PRG:30FC 7D 03 05 8D CA 03 A9 00 8D CB 03 BD 04 05 38 E9 .byte $0A, $4A, $A8, $B9, $2E, $F1, $8D, $C9, $03, $BD, $01, $05, $18, $6D, $CB, $03 ; CPU:$F10C PRG:310C 0A 4A A8 B9 2E F1 8D C9 03 BD 01 05 18 6D CB 03 .byte $85, $77, $BD, $02, $05, $69, $00, $29, $01, $85, $78, $20, $20, $CC, $8D, $CB ; CPU:$F11C PRG:311C 85 77 BD 02 05 69 00 29 01 85 78 20 20 CC 8D CB .byte $03, $60, $0C, $1C, $2C, $A0, $10, $8C, $14, $03, $A0, $00, $84, $B8, $A0, $01 ; CPU:$F12C PRG:312C 03 60 0C 1C 2C A0 10 8C 14 03 A0 00 84 B8 A0 01 .byte $84, $AF, $84, $0F, $60, $A5, $74, $8D, $38, $03, $A5, $73, $18, $69, $0E, $8D ; CPU:$F13C PRG:313C 84 AF 84 0F 60 A5 74 8D 38 03 A5 73 18 69 0E 8D .byte $39, $03, $A5, $A8, $D0, $03, $EE, $23, $03, $A9, $00, $85, $CD, $86, $91, $A9 ; CPU:$F14C PRG:314C 39 03 A5 A8 D0 03 EE 23 03 A9 00 85 CD 86 91 A9 .byte $01, $85, $A8, $8D, $8E, $03, $60, $A5, $CF, $20, $CD, $C4, $72, $F1, $86, $F1 ; CPU:$F15C PRG:315C 01 85 A8 8D 8E 03 60 A5 CF 20 CD C4 72 F1 86 F1 .byte $CF, $F1, $49, $F6, $55, $F6, $A2, $00, $86, $87, $A2, $00, $86, $D0, $86, $D3 ; CPU:$F16C PRG:316C CF F1 49 F6 55 F6 A2 00 86 87 A2 00 86 D0 86 D3 .byte $86, $AA, $A2, $20, $20, $88, $F1, $4C, $06, $C9, $A2, $40 ; CPU:$F17C PRG:317C 86 AA A2 20 20 88 F1 4C 06 C9 A2 40 ;=============================================================================== ; Routine: InitActorSpriteRecordTwo ; Global: The routine calls ComputeActorSpriteBase. ; Local: Executes 7 instructions: stores X to Zp7C; stores X to Zp8D; loads A ; from ZpAD; shifts a right; stores A to ZpF8; calls ComputeActorSpriteBase; 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 RAM fields it writes. ; ;=============================================================================== InitActorSpriteRecordTwo: stx Zp7C ; CPU:$F188 PRG:3188 86 7C stx Zp8D ; CPU:$F18A PRG:318A 86 8D lda ZpAD ; CPU:$F18C PRG:318C A5 AD lsr a ; CPU:$F18E PRG:318E 4A sta ZpF8 ; CPU:$F18F PRG:318F 85 F8 jsr ComputeActorSpriteBase ; CPU:$F191 PRG:3191 20 58 F7 ldy #$0C ; CPU:$F194 PRG:3194 A0 0C ;=============================================================================== ; Routine: InitActorSpriteRecordTwo_OnNonnegative ; Global: The routine reads no RAM 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 $F1B5,y; loads X from ZpCF; ; branches on equal to InitActorSpriteRecordTwo_Loop; loads A from $F1C2,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, I and V flags, the RAM fields it writes. ; ;=============================================================================== InitActorSpriteRecordTwo_OnNonnegative: lda $F1B5,y ; CPU:$F196 PRG:3196 B9 B5 F1 ldx ZpCF ; CPU:$F199 PRG:3199 A6 CF beq InitActorSpriteRecordTwo_Loop ; CPU:$F19B PRG:319B F0 03 lda $F1C2,y ; CPU:$F19D PRG:319D B9 C2 F1 ;=============================================================================== ; Routine: InitActorSpriteRecordTwo_Loop ; Global: The routine calls StartActorSpriteMovement and ComputeActorSpriteSlot_OnCarryClear. ; Local: Executes 14 instructions: loads A from $F1B5,y; loads X from ZpCF; ; branches on equal to InitActorSpriteRecordTwo_Loop; loads A from $F1C2,y; loads X from ; Zp8D; stores A to Zp7C,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: 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 RAM fields it writes. ; ;=============================================================================== InitActorSpriteRecordTwo_Loop: ldx Zp8D ; CPU:$F1A0 PRG:31A0 A6 8D sta Zp7C,x ; CPU:$F1A2 PRG:31A2 95 7C dec Zp8D ; CPU:$F1A4 PRG:31A4 C6 8D dey ; CPU:$F1A6 PRG:31A6 88 bpl InitActorSpriteRecordTwo_OnNonnegative ; CPU:$F1A7 PRG:31A7 10 ED jsr StartActorSpriteMovement ; CPU:$F1A9 PRG:31A9 20 DB F2 inc ZpCF ; CPU:$F1AC PRG:31AC E6 CF inc ZpAD ; CPU:$F1AE PRG:31AE E6 AD inc ZpAD ; CPU:$F1B0 PRG:31B0 E6 AD jmp ComputeActorSpriteSlot_OnCarryClear ; CPU:$F1B2 PRG:31B2 4C 72 F6 ; ---- data $F1B5-$F1CE (26 bytes) ---- ; referenced by `lda $F1B5,y` at $F196 (operand $F1B5 falls inside this region) ; referenced by `lda $F1C2,y` at $F19D (operand $F1C2 falls inside this region) ; referenced by `lda $F1C7,y` at $F735 (operand $F1C7 falls inside this region) SoundChannelParameterTable: .byte $01, $FE, $3C, $3C, $50, $00, $23, $09, $00, $08, $01, $00, $08 ; CPU:$F1B5 PRG:31B5 01 FE 3C 3C 50 00 23 09 00 08 01 00 08 SoundChannelParameterTableAlt: .byte $01, $FE, $6C ; CPU:$F1C2 PRG:31C2 01 FE 6C .byte $3C, $D0, $00, $2C, $09, $00, $08, $02, $00, $05 ; CPU:$F1C5 PRG:31C5 3C D0 00 2C 09 00 08 02 00 05 ;=============================================================================== ; Routine: FindActorSpriteRecord ; Global: The routine calls ComputeActorSpriteSlot. ; Local: Executes 8 instructions: loads A from ZpD0; calls ComputeActorSpriteSlot; loads Y ; with $00; stores Y to ZpD2; loads A from ZpD0; compares A with ; Zp87; 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 RAM fields it writes. ; ;=============================================================================== FindActorSpriteRecord: lda ZpD0 ; CPU:$F1CF PRG:31CF A5 D0 jsr ComputeActorSpriteSlot ; CPU:$F1D1 PRG:31D1 20 66 F6 ldy #$00 ; CPU:$F1D4 PRG:31D4 A0 00 sty ZpD2 ; CPU:$F1D6 PRG:31D6 84 D2 lda ZpD0 ; CPU:$F1D8 PRG:31D8 A5 D0 cmp Zp87 ; CPU:$F1DA PRG:31DA C5 87 bne FindActorSpriteRecord_Loop ; CPU:$F1DC PRG:31DC D0 01 iny ; CPU:$F1DE PRG:31DE C8 ;=============================================================================== ; Routine: FindActorSpriteRecord_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: stores Y to Zp88; loads A from Zp70,x; ; branches on equal to FindActorSpriteRecord_Loop_5; loads A from Zp7F,x; branches on ; non-negative to FindActorSpriteRecord_Loop_2; 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: 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 RAM fields it writes. ; ;=============================================================================== FindActorSpriteRecord_Loop: sty Zp88 ; CPU:$F1DF PRG:31DF 84 88 lda Zp70,x ; CPU:$F1E1 PRG:31E1 B5 70 beq FindActorSpriteRecord_Loop_5 ; CPU:$F1E3 PRG:31E3 F0 30 lda Zp7F,x ; CPU:$F1E5 PRG:31E5 B5 7F bpl FindActorSpriteRecord_Loop_2 ; CPU:$F1E7 PRG:31E7 10 04 lda #$00 ; CPU:$F1E9 PRG:31E9 A9 00 beq FindActorSpriteRecord_Loop_3 ; CPU:$F1EB PRG:31EB F0 06 ;=============================================================================== ; Routine: FindActorSpriteRecord_Loop_2 ; Global: The routine reads no RAM 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 $10; branches on carry clear ; to FindActorSpriteRecord_Loop_3; loads A 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== FindActorSpriteRecord_Loop_2: cmp #$10 ; CPU:$F1ED PRG:31ED C9 10 bcc FindActorSpriteRecord_Loop_3 ; CPU:$F1EF PRG:31EF 90 02 lda #$0F ; CPU:$F1F1 PRG:31F1 A9 0F ;=============================================================================== ; Routine: FindActorSpriteRecord_Loop_3 ; Global: The routine reads no RAM 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 ZpF8; loads X with $06; 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: 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 RAM fields it writes. ; ;=============================================================================== FindActorSpriteRecord_Loop_3: sta ZpF8 ; CPU:$F1F3 PRG:31F3 85 F8 ldx #$06 ; CPU:$F1F5 PRG:31F5 A2 06 ldy #$08 ; CPU:$F1F7 PRG:31F7 A0 08 ;=============================================================================== ; Routine: FindActorSpriteRecord_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 5 instructions: compares A with $F226,y; branches on carry ; set to FindActorSpriteRecord_Loop_4; decrements Y; decrements X; branches on not equal ; to FindActorSpriteRecord_OnNonzero. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 RAM fields it writes. ; ;=============================================================================== FindActorSpriteRecord_OnNonzero: cmp $F226,y ; CPU:$F1F9 PRG:31F9 D9 26 F2 bcs FindActorSpriteRecord_Loop_4 ; CPU:$F1FC PRG:31FC B0 04 dey ; CPU:$F1FE PRG:31FE 88 dex ; CPU:$F1FF PRG:31FF CA bne FindActorSpriteRecord_OnNonzero ; CPU:$F200 PRG:3200 D0 F7 ;=============================================================================== ; Routine: FindActorSpriteRecord_Loop_4 ; Global: The routine calls ProcessActorSpriteState. ; Local: Executes 9 instructions: loads X from Zp7C; stores Y to Zp79,x; loads ; Y from ZpF8; loads A from $F22F,y; clears the carry flag; adds ; Zp78,x to 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: 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 RAM fields it writes. ; ;=============================================================================== FindActorSpriteRecord_Loop_4: ldx Zp7C ; CPU:$F202 PRG:3202 A6 7C sty Zp79,x ; CPU:$F204 PRG:3204 94 79 ldy ZpF8 ; CPU:$F206 PRG:3206 A4 F8 lda $F22F,y ; CPU:$F208 PRG:3208 B9 2F F2 clc ; CPU:$F20B PRG:320B 18 adc Zp78,x ; CPU:$F20C PRG:320C 75 78 sta Zp78,x ; CPU:$F20E PRG:320E 95 78 bcc FindActorSpriteRecord_Loop_5 ; CPU:$F210 PRG:3210 90 03 jsr ProcessActorSpriteState ; CPU:$F212 PRG:3212 20 3F F2 ;=============================================================================== ; Routine: FindActorSpriteRecord_Loop_5 ; Global: The routine calls SelectActorSpriteSlotIndex and SelectActorSpriteTypeTwo. ; Local: Executes 4 instructions: loads A from Zp0F; branches on not equal to ; FindActorSpriteRecord_Loop_6; calls SelectActorSpriteSlotIndex; calls SelectActorSpriteTypeTwo. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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 RAM fields it writes. ; ;=============================================================================== FindActorSpriteRecord_Loop_5: lda Zp0F ; CPU:$F215 PRG:3215 A5 0F bne FindActorSpriteRecord_Loop_6 ; CPU:$F217 PRG:3217 D0 06 jsr SelectActorSpriteSlotIndex ; CPU:$F219 PRG:3219 20 42 F3 jsr SelectActorSpriteTypeTwo ; CPU:$F21C PRG:321C 20 CD F6 ;=============================================================================== ; Routine: FindActorSpriteRecord_Loop_6 ; Global: The routine reads no RAM 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 ZpD0; EORs A with $01; stores A ; to ZpD0; 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, ZpD0. ; ;=============================================================================== FindActorSpriteRecord_Loop_6: lda ZpD0 ; CPU:$F21F PRG:321F A5 D0 eor #$01 ; CPU:$F221 PRG:3221 49 01 sta ZpD0 ; CPU:$F223 PRG:3223 85 D0 rts ; CPU:$F225 PRG:3225 60 ; ---- data $F226-$F23E (25 bytes) ---- ; referenced by `cmp $F226,y` at $F1F9 (operand $F226 falls inside this region) ; referenced by `lda $F22F,y` at $F208 (operand $F22F falls inside this region) RingSpawnThresholdTable: .byte $00, $00, $00, $01, $03, $05, $07, $09, $0C, $1C, $20, $28, $20, $28, $28, $30 ; CPU:$F226 PRG:3226 00 00 00 01 03 05 07 09 0C 1C 20 28 20 28 28 30 .byte $30, $38, $30, $38, $40, $40, $48, $54, $5C ; CPU:$F236 PRG:3236 30 38 30 38 40 40 48 54 5C ;=============================================================================== ; Routine: ProcessActorSpriteState ; Global: The routine reads no RAM 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 X from Zp7C; loads A from Zp7A,x; ; compares A with $00; branches on equal to ProcessActorSpriteState_Loop_5; compares A with ; $01; branches on equal to ProcessActorSpriteState_Loop_6; 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. ; ;=============================================================================== ProcessActorSpriteState: ldx Zp7C ; CPU:$F23F PRG:323F A6 7C lda Zp7A,x ; CPU:$F241 PRG:3241 B5 7A cmp #$00 ; CPU:$F243 PRG:3243 C9 00 beq ProcessActorSpriteState_Loop_5 ; CPU:$F245 PRG:3245 F0 41 cmp #$01 ; CPU:$F247 PRG:3247 C9 01 beq ProcessActorSpriteState_Loop_6 ; CPU:$F249 PRG:3249 F0 45 cmp #$02 ; CPU:$F24B PRG:324B C9 02 beq ProcessActorSpriteState_Loop ; CPU:$F24D PRG:324D F0 08 lda #$02 ; CPU:$F24F PRG:324F A9 02 sta Zp7A,x ; CPU:$F251 PRG:3251 95 7A lda #$00 ; CPU:$F253 PRG:3253 A9 00 sta Zp7B,x ; CPU:$F255 PRG:3255 95 7B ;=============================================================================== ; Routine: ProcessActorSpriteState_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 8 instructions: loads A from Zp7B,x; branches on equal to ; ProcessActorSpriteState_Loop_2; loads A from Zp7C,x; compares A with Zp79,x; branches on ; carry clear to ProcessActorSpriteState_Loop_2; loads A with $00; 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. ; ;=============================================================================== ProcessActorSpriteState_Loop: lda Zp7B,x ; CPU:$F257 PRG:3257 B5 7B beq ProcessActorSpriteState_Loop_2 ; CPU:$F259 PRG:3259 F0 0C lda Zp7C,x ; CPU:$F25B PRG:325B B5 7C cmp Zp79,x ; CPU:$F25D PRG:325D D5 79 bcc ProcessActorSpriteState_Loop_2 ; CPU:$F25F PRG:325F 90 06 lda #$00 ; CPU:$F261 PRG:3261 A9 00 sta Zp7A,x ; CPU:$F263 PRG:3263 95 7A beq ProcessActorSpriteState_Loop_10 ; CPU:$F265 PRG:3265 F0 57 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_2 ; Global: The routine reads no RAM 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: increments ZpD2; loads A from Zp76,x; sets ; the carry flag; subtracts $01 from A; stores A to Zp76,x; compares ; A with $2A; 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. ; ;=============================================================================== ProcessActorSpriteState_Loop_2: inc ZpD2 ; CPU:$F267 PRG:3267 E6 D2 lda Zp76,x ; CPU:$F269 PRG:3269 B5 76 sec ; CPU:$F26B PRG:326B 38 sbc #$01 ; CPU:$F26C PRG:326C E9 01 sta Zp76,x ; CPU:$F26E PRG:326E 95 76 cmp #$2A ; CPU:$F270 PRG:3270 C9 2A bne ProcessActorSpriteState_Loop_3 ; CPU:$F272 PRG:3272 D0 06 lda #$01 ; CPU:$F274 PRG:3274 A9 01 sta Zp7B,x ; CPU:$F276 PRG:3276 95 7B bne ProcessActorSpriteState_Loop_4 ; CPU:$F278 PRG:3278 D0 04 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_3 ; Global: The routine reads no RAM 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 $2B; branches on not equal ; to ProcessActorSpriteState_Loop_10. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== ProcessActorSpriteState_Loop_3: cmp #$2B ; CPU:$F27A PRG:327A C9 2B bne ProcessActorSpriteState_Loop_10 ; CPU:$F27C PRG:327C D0 40 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_4 ; Global: The routine calls ProcessActorSpriteState_Loop_10. ; Local: Executes 5 instructions: sets the carry flag; loads A from Zp74,x; ; subtracts $03 from A; stores A to Zp74,x; calls ProcessActorSpriteState_Loop_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 and V flags, the RAM fields it writes. ; ;=============================================================================== ProcessActorSpriteState_Loop_4: sec ; CPU:$F27E PRG:327E 38 lda Zp74,x ; CPU:$F27F PRG:327F B5 74 sbc #$03 ; CPU:$F281 PRG:3281 E9 03 sta Zp74,x ; CPU:$F283 PRG:3283 95 74 jmp ProcessActorSpriteState_Loop_10 ; CPU:$F285 PRG:3285 4C BE F2 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_5 ; Global: The routine reads no RAM 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 $01; stores A to Zp7A,x; loads ; A with $00; stores A to Zp7B,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 RAM fields it writes. ; ;=============================================================================== ProcessActorSpriteState_Loop_5: lda #$01 ; CPU:$F288 PRG:3288 A9 01 sta Zp7A,x ; CPU:$F28A PRG:328A 95 7A lda #$00 ; CPU:$F28C PRG:328C A9 00 sta Zp7B,x ; CPU:$F28E PRG:328E 95 7B ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_6 ; Global: The routine reads no RAM 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 Zp7B,x; branches on equal to ; ProcessActorSpriteState_Loop_7; loads A from Zp7C,x; compares A with Zp79,x; branches on ; carry clear to ProcessActorSpriteState_Loop_7; loads A with $03; 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. ; ;=============================================================================== ProcessActorSpriteState_Loop_6: lda Zp7B,x ; CPU:$F290 PRG:3290 B5 7B beq ProcessActorSpriteState_Loop_7 ; CPU:$F292 PRG:3292 F0 0C lda Zp7C,x ; CPU:$F294 PRG:3294 B5 7C cmp Zp79,x ; CPU:$F296 PRG:3296 D5 79 bcc ProcessActorSpriteState_Loop_7 ; CPU:$F298 PRG:3298 90 06 lda #$03 ; CPU:$F29A PRG:329A A9 03 sta Zp7A,x ; CPU:$F29C PRG:329C 95 7A bne ProcessActorSpriteState_Loop_10 ; CPU:$F29E PRG:329E D0 1E ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_7 ; Global: The routine reads no RAM 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: increments ZpD2; loads A from Zp76,x; ; clears the carry flag; adds $01 to A; stores A to Zp76,x; compares ; A with $2C; 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. ; ;=============================================================================== ProcessActorSpriteState_Loop_7: inc ZpD2 ; CPU:$F2A0 PRG:32A0 E6 D2 lda Zp76,x ; CPU:$F2A2 PRG:32A2 B5 76 clc ; CPU:$F2A4 PRG:32A4 18 adc #$01 ; CPU:$F2A5 PRG:32A5 69 01 sta Zp76,x ; CPU:$F2A7 PRG:32A7 95 76 cmp #$2C ; CPU:$F2A9 PRG:32A9 C9 2C bne ProcessActorSpriteState_Loop_8 ; CPU:$F2AB PRG:32AB D0 06 lda #$01 ; CPU:$F2AD PRG:32AD A9 01 sta Zp7B,x ; CPU:$F2AF PRG:32AF 95 7B bne ProcessActorSpriteState_Loop_9 ; CPU:$F2B1 PRG:32B1 D0 04 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_8 ; Global: The routine reads no RAM 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 $2B; branches on not equal ; to ProcessActorSpriteState_Loop_10. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== ProcessActorSpriteState_Loop_8: cmp #$2B ; CPU:$F2B3 PRG:32B3 C9 2B bne ProcessActorSpriteState_Loop_10 ; CPU:$F2B5 PRG:32B5 D0 07 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_9 ; Global: The routine reads no RAM 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; loads A from Zp74,x; ; adds $03 to A; stores A to Zp74,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 RAM fields it writes. ; ;=============================================================================== ProcessActorSpriteState_Loop_9: clc ; CPU:$F2B7 PRG:32B7 18 lda Zp74,x ; CPU:$F2B8 PRG:32B8 B5 74 adc #$03 ; CPU:$F2BA PRG:32BA 69 03 sta Zp74,x ; CPU:$F2BC PRG:32BC 95 74 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_10 ; Global: The routine calls StartActorSpriteMovement and ProcessActorSpriteState_Loop_12. ; Local: Executes 12 instructions: calls StartActorSpriteMovement; loads X from Zp7C; loads A ; from Zp76,x; sets the carry flag; subtracts $2B from A; branches on ; equal to ProcessActorSpriteState_Loop_11; 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. ; ;=============================================================================== ProcessActorSpriteState_Loop_10: jsr StartActorSpriteMovement ; CPU:$F2BE PRG:32BE 20 DB F2 ldx Zp7C ; CPU:$F2C1 PRG:32C1 A6 7C lda Zp76,x ; CPU:$F2C3 PRG:32C3 B5 76 sec ; CPU:$F2C5 PRG:32C5 38 sbc #$2B ; CPU:$F2C6 PRG:32C6 E9 2B beq ProcessActorSpriteState_Loop_11 ; CPU:$F2C8 PRG:32C8 F0 0C bpl ProcessActorSpriteState_Loop_12 ; CPU:$F2CA PRG:32CA 10 0C sta Zp77 ; CPU:$F2CC PRG:32CC 85 77 sec ; CPU:$F2CE PRG:32CE 38 lda #$00 ; CPU:$F2CF PRG:32CF A9 00 sbc Zp77 ; CPU:$F2D1 PRG:32D1 E5 77 jmp ProcessActorSpriteState_Loop_12 ; CPU:$F2D3 PRG:32D3 4C D8 F2 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_11 ; Global: The routine reads no RAM 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 and Z flags, Zp7C. ; ;=============================================================================== ProcessActorSpriteState_Loop_11: lda #$00 ; CPU:$F2D6 PRG:32D6 A9 00 ;=============================================================================== ; Routine: ProcessActorSpriteState_Loop_12 ; Global: The routine reads no RAM 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 Zp7C,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, Zp7C. ; ;=============================================================================== ProcessActorSpriteState_Loop_12: sta Zp7C,x ; CPU:$F2D8 PRG:32D8 95 7C rts ; CPU:$F2DA PRG:32DA 60 ;=============================================================================== ; Routine: StartActorSpriteMovement ; Global: The routine reads no RAM 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 X from Zp7C; loads A from Zp70,x; ; stores A to Zp80,x; loads A with $01; stores A to Zp81,x; loads A ; from Zp72,x; 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. ; ;=============================================================================== StartActorSpriteMovement: ldx Zp7C ; CPU:$F2DB PRG:32DB A6 7C lda Zp70,x ; CPU:$F2DD PRG:32DD B5 70 sta Zp80,x ; CPU:$F2DF PRG:32DF 95 80 lda #$01 ; CPU:$F2E1 PRG:32E1 A9 01 sta Zp81,x ; CPU:$F2E3 PRG:32E3 95 81 lda Zp72,x ; CPU:$F2E5 PRG:32E5 B5 72 sec ; CPU:$F2E7 PRG:32E7 38 sbc #$04 ; CPU:$F2E8 PRG:32E8 E9 04 sta Zp82,x ; CPU:$F2EA PRG:32EA 95 82 lda #$34 ; CPU:$F2EC PRG:32EC A9 34 sta Zp86,x ; CPU:$F2EE PRG:32EE 95 86 lda Zp76,x ; CPU:$F2F0 PRG:32F0 B5 76 sec ; CPU:$F2F2 PRG:32F2 38 sbc #$23 ; CPU:$F2F3 PRG:32F3 E9 23 asl a ; CPU:$F2F5 PRG:32F5 0A tay ; CPU:$F2F6 PRG:32F6 A8 lda #$02 ; CPU:$F2F7 PRG:32F7 A9 02 sta Zp79 ; CPU:$F2F9 PRG:32F9 85 79 ;=============================================================================== ; Routine: StartActorSpriteMovement_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 13 instructions: loads A from $F320,y; stores A to Zp77; ; clears the carry flag; adds Zp73,x to A; stores A to Zp83,x; ; increments 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, Z, C and V flags, Zp77, Zp79, Zp83. ; ;=============================================================================== StartActorSpriteMovement_OnNonzero: lda $F320,y ; CPU:$F2FB PRG:32FB B9 20 F3 sta Zp77 ; CPU:$F2FE PRG:32FE 85 77 clc ; CPU:$F300 PRG:3300 18 adc Zp73,x ; CPU:$F301 PRG:3301 75 73 sta Zp83,x ; CPU:$F303 PRG:3303 95 83 iny ; CPU:$F305 PRG:3305 C8 inx ; CPU:$F306 PRG:3306 E8 dec Zp79 ; CPU:$F307 PRG:3307 C6 79 bne StartActorSpriteMovement_OnNonzero ; CPU:$F309 PRG:3309 D0 F0 lda Zp77 ; CPU:$F30B PRG:330B A5 77 bpl StartActorSpriteMovement_Loop ; CPU:$F30D PRG:330D 10 04 bcs StartActorSpriteMovement_Loop_3 ; CPU:$F30F PRG:330F B0 08 bcc StartActorSpriteMovement_Loop_2 ; CPU:$F311 PRG:3311 90 02 ;=============================================================================== ; Routine: StartActorSpriteMovement_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: branches on carry clear to StartActorSpriteMovement_Loop_3. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp83. ; ;=============================================================================== StartActorSpriteMovement_Loop: bcc StartActorSpriteMovement_Loop_3 ; CPU:$F313 PRG:3313 90 04 ;=============================================================================== ; Routine: StartActorSpriteMovement_Loop_2 ; Global: The routine reads no RAM 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 ; StartActorSpriteMovement_Loop_4. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp83. ; ;=============================================================================== StartActorSpriteMovement_Loop_2: lda #$01 ; CPU:$F315 PRG:3315 A9 01 bne StartActorSpriteMovement_Loop_4 ; CPU:$F317 PRG:3317 D0 02 ;=============================================================================== ; Routine: StartActorSpriteMovement_Loop_3 ; Global: The routine reads no RAM 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 and Z flags, Zp83. ; ;=============================================================================== StartActorSpriteMovement_Loop_3: lda #$00 ; CPU:$F319 PRG:3319 A9 00 ;=============================================================================== ; Routine: StartActorSpriteMovement_Loop_4 ; Global: The routine reads no RAM 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: EORs A with Zp73,x; stores A to Zp83,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: ; no register, the N and Z flags, Zp83. ; ;=============================================================================== StartActorSpriteMovement_Loop_4: eor Zp73,x ; CPU:$F31B PRG:331B 55 73 sta Zp83,x ; CPU:$F31D PRG:331D 95 83 ;=============================================================================== ; Routine: StartActorSpriteMovement_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 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. ; ;=============================================================================== StartActorSpriteMovement_OnZero: rts ; CPU:$F31F PRG:331F 60 ; ---- data $F320-$F341 (34 bytes) ---- ; referenced by `lda $F320,y` at $F2FB (operand $F320 falls inside this region) ObjectStepTable: .byte $10, $CC, $17, $CE, $20, $D3, $25, $DA, $2B, $DF, $2D, $E9, $32, $F0, $34, $F8 ; CPU:$F320 PRG:3320 10 CC 17 CE 20 D3 25 DA 2B DF 2D E9 32 F0 34 F8 .byte $35, $FE, $34, $05, $32, $0D, $2D, $14, $2A, $1D, $25, $23, $1F, $2A, $15, $32 ; CPU:$F330 PRG:3330 35 FE 34 05 32 0D 2D 14 2A 1D 25 23 1F 2A 15 32 .byte $10, $33 ; CPU:$F340 PRG:3340 10 33 ;=============================================================================== ; Routine: SelectActorSpriteSlotIndex ; Global: The routine calls DispatchActorSpriteState. ; Local: Executes 6 instructions: returns with RTS; loads A from Zp0F; ; branches on not equal to StartActorSpriteMovement_OnZero; loads X from Zp87; branches on ; non-negative to SelectActorSpriteSlotIndex_Loop; calls DispatchActorSpriteState. ; 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. ; ;=============================================================================== SelectActorSpriteSlotIndex: lda Zp0F ; CPU:$F342 PRG:3342 A5 0F bne StartActorSpriteMovement_OnZero ; CPU:$F344 PRG:3344 D0 D9 ldx Zp87 ; CPU:$F346 PRG:3346 A6 87 bpl SelectActorSpriteSlotIndex_Loop ; CPU:$F348 PRG:3348 10 03 jmp DispatchActorSpriteState ; CPU:$F34A PRG:334A 4C 79 F4 ;=============================================================================== ; Routine: SelectActorSpriteSlotIndex_Loop ; Global: The routine calls DispatchActorSpriteState. ; Local: Executes 5 instructions: returns with RTS; loads A from Zp0D; ANDs A ; with $C0; branches on equal to SelectActorSpriteSlotIndex_Loop_2; calls DispatchActorSpriteState. ; 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. ; ;=============================================================================== SelectActorSpriteSlotIndex_Loop: lda Zp0D ; CPU:$F34D PRG:334D A5 0D and #$C0 ; CPU:$F34F PRG:334F 29 C0 beq SelectActorSpriteSlotIndex_Loop_2 ; CPU:$F351 PRG:3351 F0 03 jmp DispatchActorSpriteState ; CPU:$F353 PRG:3353 4C 79 F4 ;=============================================================================== ; Routine: SelectActorSpriteSlotIndex_Loop_2 ; Global: The routine calls ComputeActorSpriteTarget, UpdateActorSpriteState, CheckActorSpriteType, ComputeActorSpriteRow and 1 more. ; Local: Executes 10 instructions: returns with RTS; calls ComputeActorSpriteTarget; loads A ; from Zp88; branches on equal to StartActorSpriteMovement_OnZero; loads A from ZpD2; ; branches on equal to StartActorSpriteMovement_OnZero; 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. ; ;=============================================================================== SelectActorSpriteSlotIndex_Loop_2: jsr ComputeActorSpriteTarget ; CPU:$F356 PRG:3356 20 6D F3 lda Zp88 ; CPU:$F359 PRG:3359 A5 88 beq StartActorSpriteMovement_OnZero ; CPU:$F35B PRG:335B F0 C2 lda ZpD2 ; CPU:$F35D PRG:335D A5 D2 beq StartActorSpriteMovement_OnZero ; CPU:$F35F PRG:335F F0 BE jsr UpdateActorSpriteState ; CPU:$F361 PRG:3361 20 D4 F3 jsr CheckActorSpriteType ; CPU:$F364 PRG:3364 20 9A F3 jsr ComputeActorSpriteRow ; CPU:$F367 PRG:3367 20 B0 F3 jmp ComputeActorSpriteTargetTwo; CPU:$F36A PRG:336A 4C C3 F3 ;=============================================================================== ; Routine: ComputeActorSpriteTarget ; Global: The routine calls ComputeActorSpriteSlot. ; Local: Executes 12 instructions: loads A from Zp87; calls ComputeActorSpriteSlot; loads A ; with $01; stores A to Zp56; loads Y with $48; loads A from Zp76,x; ; 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. ; ;=============================================================================== ComputeActorSpriteTarget: lda Zp87 ; CPU:$F36D PRG:336D A5 87 jsr ComputeActorSpriteSlot ; CPU:$F36F PRG:336F 20 66 F6 lda #$01 ; CPU:$F372 PRG:3372 A9 01 sta Zp56 ; CPU:$F374 PRG:3374 85 56 ldy #$48 ; CPU:$F376 PRG:3376 A0 48 lda Zp76,x ; CPU:$F378 PRG:3378 B5 76 cmp #$2B ; CPU:$F37A PRG:337A C9 2B beq ComputeActorSpriteTarget_Loop ; CPU:$F37C PRG:337C F0 05 bcc ComputeActorSpriteTarget_Loop_2 ; CPU:$F37E PRG:337E 90 06 iny ; CPU:$F380 PRG:3380 C8 iny ; CPU:$F381 PRG:3381 C8 iny ; CPU:$F382 PRG:3382 C8 ;=============================================================================== ; Routine: ComputeActorSpriteTarget_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 3 instructions: increments Y; increments Y; 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: 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, Zp6A, Zp6B, Zp70, Zp74, Zp77, ; Zp80. ; ;=============================================================================== ComputeActorSpriteTarget_Loop: iny ; CPU:$F383 PRG:3383 C8 iny ; CPU:$F384 PRG:3384 C8 iny ; CPU:$F385 PRG:3385 C8 ;=============================================================================== ; Routine: ComputeActorSpriteTarget_Loop_2 ; Global: The routine calls ComputeActorSpriteValue_Loop_2. ; Local: Executes 7 instructions: stores Y to Zp77; loads A from Zp74,x; ; compares A with Zp77; branches on equal to CheckActorSpriteType_Loop_3; branches on ; carry clear to ComputeActorSpriteTarget_Loop_3; decrements Zp74; 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, Zp6A, Zp6B, Zp70, Zp74, Zp77, ; Zp80. ; ;=============================================================================== ComputeActorSpriteTarget_Loop_2: sty Zp77 ; CPU:$F386 PRG:3386 84 77 lda Zp74,x ; CPU:$F388 PRG:3388 B5 74 cmp Zp77 ; CPU:$F38A PRG:338A C5 77 beq CheckActorSpriteType_Loop_3; CPU:$F38C PRG:338C F0 21 bcc ComputeActorSpriteTarget_Loop_3 ; CPU:$F38E PRG:338E 90 05 dec Zp74 ; CPU:$F390 PRG:3390 C6 74 jmp ComputeActorSpriteValue_Loop_2 ; CPU:$F392 PRG:3392 4C 88 F5 ;=============================================================================== ; Routine: ComputeActorSpriteTarget_Loop_3 ; Global: The routine calls ComputeActorSpriteValue. ; Local: Executes 2 instructions: increments Zp74; calls ComputeActorSpriteValue. ; 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, Zp6A, Zp6B, Zp74. ; ;=============================================================================== ComputeActorSpriteTarget_Loop_3: inc Zp74 ; CPU:$F395 PRG:3395 E6 74 jmp ComputeActorSpriteValue ; CPU:$F397 PRG:3397 4C 71 F5 ;=============================================================================== ; Routine: CheckActorSpriteType ; Global: The routine reads no RAM 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 Zp7C; loads A from Zp7C,x; ; copies A into Y; loads A from Zp71,x; compares A with $FF; branches ; on equal to CheckActorSpriteType_Loop; 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 and C flags, Zp73. ; ;=============================================================================== CheckActorSpriteType: ldx Zp7C ; CPU:$F39A PRG:339A A6 7C lda Zp7C,x ; CPU:$F39C PRG:339C B5 7C tay ; CPU:$F39E PRG:339E A8 lda Zp71,x ; CPU:$F39F PRG:339F B5 71 cmp #$FF ; CPU:$F3A1 PRG:33A1 C9 FF beq CheckActorSpriteType_Loop ; CPU:$F3A3 PRG:33A3 F0 05 lda $F794,y ; CPU:$F3A5 PRG:33A5 B9 94 F7 bne CheckActorSpriteType_Loop_2; CPU:$F3A8 PRG:33A8 D0 03 ;=============================================================================== ; Routine: CheckActorSpriteType_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 from $F79D,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, Zp73. ; ;=============================================================================== CheckActorSpriteType_Loop: lda $F79D,y ; CPU:$F3AA PRG:33AA B9 9D F7 ;=============================================================================== ; Routine: CheckActorSpriteType_Loop_2 ; Global: The routine reads no RAM 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 Zp73. ; 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, Zp73. ; ;=============================================================================== CheckActorSpriteType_Loop_2: sta Zp73 ; CPU:$F3AD PRG:33AD 85 73 ;=============================================================================== ; Routine: CheckActorSpriteType_Loop_3 ; Global: The routine reads no RAM 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. ; ;=============================================================================== CheckActorSpriteType_Loop_3: rts ; CPU:$F3AF PRG:33AF 60 ;=============================================================================== ; Routine: ComputeActorSpriteRow ; Global: The routine reads no RAM 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 Zp7C; loads A from Zp76,x; ; loads Y with $06; compares A with $2C; branches on carry clear to ; ComputeActorSpriteRow_Loop; increments 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 and C flags, Zp76. ; ;=============================================================================== ComputeActorSpriteRow: ldx Zp7C ; CPU:$F3B0 PRG:33B0 A6 7C lda Zp76,x ; CPU:$F3B2 PRG:33B2 B5 76 ldy #$06 ; CPU:$F3B4 PRG:33B4 A0 06 cmp #$2C ; CPU:$F3B6 PRG:33B6 C9 2C bcc ComputeActorSpriteRow_Loop ; CPU:$F3B8 PRG:33B8 90 06 iny ; CPU:$F3BA PRG:33BA C8 cmp #$2E ; CPU:$F3BB PRG:33BB C9 2E bcc ComputeActorSpriteRow_Loop ; CPU:$F3BD PRG:33BD 90 01 iny ; CPU:$F3BF PRG:33BF C8 ;=============================================================================== ; Routine: ComputeActorSpriteRow_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: stores Y to Zp76; 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, Zp76. ; ;=============================================================================== ComputeActorSpriteRow_Loop: sty Zp76 ; CPU:$F3C0 PRG:33C0 84 76 rts ; CPU:$F3C2 PRG:33C2 60 ;=============================================================================== ; Routine: ComputeActorSpriteTargetTwo ; Global: The routine reads no RAM 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 X from Zp7C; loads A from Zp83,x; ; clears the carry flag; adds $02 to A; stores A to Zp73; loads A ; from Zp84,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: Returns with RTS; the registers it loaded still hold the values it ; computed. ; Clobbers: ; A and X, the N, Z, C and V flags, Zp73, Zp74. ; ;=============================================================================== ComputeActorSpriteTargetTwo: ldx Zp7C ; CPU:$F3C3 PRG:33C3 A6 7C lda Zp83,x ; CPU:$F3C5 PRG:33C5 B5 83 clc ; CPU:$F3C7 PRG:33C7 18 adc #$02 ; CPU:$F3C8 PRG:33C8 69 02 sta Zp73 ; CPU:$F3CA PRG:33CA 85 73 lda Zp84,x ; CPU:$F3CC PRG:33CC B5 84 sec ; CPU:$F3CE PRG:33CE 38 sbc #$0E ; CPU:$F3CF PRG:33CF E9 0E sta Zp74 ; CPU:$F3D1 PRG:33D1 85 74 rts ; CPU:$F3D3 PRG:33D3 60 ;=============================================================================== ; Routine: UpdateActorSpriteState ; Global: The routine calls SetActorSpriteParam0D and SetActorSpriteParam0E. ; Local: Executes 15 instructions: calls SetActorSpriteParam0D; calls SetActorSpriteParam0E; loads X ; from Zp7C; loads A from Zp0C; ANDs A with $03; branches on equal to ; AdvanceActorSpriteTimer_Loop_3; 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. ; ;=============================================================================== UpdateActorSpriteState: jsr SetActorSpriteParam0D ; CPU:$F3D4 PRG:33D4 20 2E F4 jsr SetActorSpriteParam0E ; CPU:$F3D7 PRG:33D7 20 32 F4 ldx Zp7C ; CPU:$F3DA PRG:33DA A6 7C lda Zp0C ; CPU:$F3DC PRG:33DC A5 0C and #$03 ; CPU:$F3DE PRG:33DE 29 03 beq AdvanceActorSpriteTimer_Loop_3 ; CPU:$F3E0 PRG:33E0 F0 4B eor #$03 ; CPU:$F3E2 PRG:33E2 49 03 beq AdvanceActorSpriteTimer_Loop_3 ; CPU:$F3E4 PRG:33E4 F0 47 lda Zp79,x ; CPU:$F3E6 PRG:33E6 B5 79 sta Zp78 ; CPU:$F3E8 PRG:33E8 85 78 cmp #$02 ; CPU:$F3EA PRG:33EA C9 02 bcs UpdateActorSpriteState_Loop; CPU:$F3EC PRG:33EC B0 06 lda #$40 ; CPU:$F3EE PRG:33EE A9 40 sta Zp77 ; CPU:$F3F0 PRG:33F0 85 77 bne UpdateActorSpriteState_OnZero ; CPU:$F3F2 PRG:33F2 D0 10 ;=============================================================================== ; Routine: UpdateActorSpriteState_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 8 instructions: loads A from Zp0C; ANDs A with $01; branches ; on not equal to AdvanceActorSpriteTimer_Loop; loads A from Zp7A,x; compares A with $01; ; branches on equal to AdvanceActorSpriteTimer_Loop_2; 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, Zp7D, Zp7E, Zp7F. ; ;=============================================================================== UpdateActorSpriteState_Loop: lda Zp0C ; CPU:$F3F4 PRG:33F4 A5 0C and #$01 ; CPU:$F3F6 PRG:33F6 29 01 bne AdvanceActorSpriteTimer_Loop ; CPU:$F3F8 PRG:33F8 D0 1B lda Zp7A,x ; CPU:$F3FA PRG:33FA B5 7A cmp #$01 ; CPU:$F3FC PRG:33FC C9 01 beq AdvanceActorSpriteTimer_Loop_2 ; CPU:$F3FE PRG:33FE F0 1F cmp #$02 ; CPU:$F400 PRG:3400 C9 02 bne AdvanceActorSpriteTimer_Loop_3 ; CPU:$F402 PRG:3402 D0 29 ;=============================================================================== ; Routine: UpdateActorSpriteState_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 2 instructions: loads A from Zp7E,x; adds $40 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, Zp7E, Zp7F. ; ;=============================================================================== UpdateActorSpriteState_OnZero: lda Zp7E,x ; CPU:$F404 PRG:3404 B5 7E adc #$40 ; CPU:$F406 PRG:3406 69 40 ;=============================================================================== ; Routine: AdvanceActorSpriteTimer ; Global: The routine reads no RAM 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: stores A to Zp7E,x; branches on carry clear ; to AdvanceActorSpriteTimer_Loop_3; loads A from Zp7F,x; compares A with $0F; branches on ; carry set to AdvanceActorSpriteTimer_Loop_3; increments Zp7F,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 and C flags, Zp7E, Zp7F. ; ;=============================================================================== AdvanceActorSpriteTimer: sta Zp7E,x ; CPU:$F408 PRG:3408 95 7E bcc AdvanceActorSpriteTimer_Loop_3 ; CPU:$F40A PRG:340A 90 21 lda Zp7F,x ; CPU:$F40C PRG:340C B5 7F cmp #$0F ; CPU:$F40E PRG:340E C9 0F bcs AdvanceActorSpriteTimer_Loop_3 ; CPU:$F410 PRG:3410 B0 1B inc Zp7F,x ; CPU:$F412 PRG:3412 F6 7F rts ; CPU:$F414 PRG:3414 60 ;=============================================================================== ; Routine: AdvanceActorSpriteTimer_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 14 instructions: loads A from Zp7E,x; adds $40 to A; stores ; A to Zp7E,x; branches on carry clear to AdvanceActorSpriteTimer_Loop_3; loads A from ; Zp7F,x; compares A with $0F; 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, the N, Z, C and V flags, Zp7D, Zp7E, Zp7F. ; ;=============================================================================== AdvanceActorSpriteTimer_Loop: lda Zp7A,x ; CPU:$F415 PRG:3415 B5 7A cmp #$01 ; CPU:$F417 PRG:3417 C9 01 beq UpdateActorSpriteState_OnZero ; CPU:$F419 PRG:3419 F0 E9 cmp #$02 ; CPU:$F41B PRG:341B C9 02 bne AdvanceActorSpriteTimer_Loop_3 ; CPU:$F41D PRG:341D D0 0E ;=============================================================================== ; Routine: AdvanceActorSpriteTimer_Loop_2 ; Global: The routine reads no RAM 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 Zp7D,x; adds $40 to A; stores A ; to Zp7D,x; branches on carry clear to AdvanceActorSpriteTimer_Loop_3; loads A from ; Zp7F,x; branches on equal to AdvanceActorSpriteTimer_Loop_3; 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, Zp7D, Zp7F. ; ;=============================================================================== AdvanceActorSpriteTimer_Loop_2: lda Zp7D,x ; CPU:$F41F PRG:341F B5 7D adc #$40 ; CPU:$F421 PRG:3421 69 40 sta Zp7D,x ; CPU:$F423 PRG:3423 95 7D bcc AdvanceActorSpriteTimer_Loop_3 ; CPU:$F425 PRG:3425 90 06 lda Zp7F,x ; CPU:$F427 PRG:3427 B5 7F beq AdvanceActorSpriteTimer_Loop_3 ; CPU:$F429 PRG:3429 F0 02 dec Zp7F,x ; CPU:$F42B PRG:342B D6 7F ;=============================================================================== ; Routine: AdvanceActorSpriteTimer_Loop_3 ; Global: The routine reads no RAM 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. ; ;=============================================================================== AdvanceActorSpriteTimer_Loop_3: rts ; CPU:$F42D PRG:342D 60 ;=============================================================================== ; Routine: SetActorSpriteParam0D ; Global: The routine reads no RAM 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 $0D; branches on not equal to ; SetActorSpriteParam0E_Loop. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp70, Zp7B. ; ;=============================================================================== SetActorSpriteParam0D: lda #$0D ; CPU:$F42E PRG:342E A9 0D bne SetActorSpriteParam0E_Loop ; CPU:$F430 PRG:3430 D0 02 ;=============================================================================== ; Routine: SetActorSpriteParam0E ; Global: The routine reads no RAM 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 $0E. ; 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, Zp70, Zp7B. ; ;=============================================================================== SetActorSpriteParam0E: lda #$0E ; CPU:$F432 PRG:3432 A9 0E ;=============================================================================== ; Routine: SetActorSpriteParam0E_Loop ; Global: The routine calls DivideActorValueBy16. ; Local: Executes 12 instructions: clears the carry flag; adds Zp7C to A; ; copies A into X; loads A from Zp70,x; stores A to Zp7B; ANDs A with ; $F0; 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, Zp70, Zp7B. ; ;=============================================================================== SetActorSpriteParam0E_Loop: clc ; CPU:$F434 PRG:3434 18 adc Zp7C ; CPU:$F435 PRG:3435 65 7C tax ; CPU:$F437 PRG:3437 AA lda Zp70,x ; CPU:$F438 PRG:3438 B5 70 sta Zp7B ; CPU:$F43A PRG:343A 85 7B and #$F0 ; CPU:$F43C PRG:343C 29 F0 jsr DivideActorValueBy16 ; CPU:$F43E PRG:343E 20 E4 F7 tay ; CPU:$F441 PRG:3441 A8 lda Zp7B ; CPU:$F442 PRG:3442 A5 7B sbc $F7A6,y ; CPU:$F444 PRG:3444 F9 A6 F7 bcs SetActorSpriteParam0E_Loop_2 ; CPU:$F447 PRG:3447 B0 02 lda #$00 ; CPU:$F449 PRG:3449 A9 00 ;=============================================================================== ; Routine: SetActorSpriteParam0E_Loop_2 ; Global: The routine reads no RAM 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 Zp70,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, Zp70. ; ;=============================================================================== SetActorSpriteParam0E_Loop_2: sta Zp70,x ; CPU:$F44B PRG:344B 95 70 rts ; CPU:$F44D PRG:344D 60 ;=============================================================================== ; Routine: SetActorSpriteParam0E_OnCarrySet ; Global: The routine reads $0327. ; Local: Executes 8 instructions: loads A with $00; stores A to ZpD6; loads A ; from ZpD5; stores A to Zp87; compares A with ZpC7; branches on ; equal to SetActorSpriteParam0E_Loop_3; and 2 more instructions. ; Parameters: Reads $0327 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, the RAM fields it writes. ; ;=============================================================================== SetActorSpriteParam0E_OnCarrySet: lda #$00 ; CPU:$F44E PRG:344E A9 00 sta ZpD6 ; CPU:$F450 PRG:3450 85 D6 lda ZpD5 ; CPU:$F452 PRG:3452 A5 D5 sta Zp87 ; CPU:$F454 PRG:3454 85 87 cmp ZpC7 ; CPU:$F456 PRG:3456 C5 C7 beq SetActorSpriteParam0E_Loop_3 ; CPU:$F458 PRG:3458 F0 05 inc ZpAB ; CPU:$F45A PRG:345A E6 AB inc $0327 ; CPU:$F45C PRG:345C EE 27 03 ;=============================================================================== ; Routine: SetActorSpriteParam0E_Loop_3 ; Global: The routine calls ComputeActorSpriteSlot. ; Local: Executes 10 instructions: calls ComputeActorSpriteSlot; loads A from Zp7B,x; ; branches on equal to SetActorSpriteParam0E_Loop_4; loads A from Zp76,x; compares A with ; $2B; branches on carry set to SetActorSpriteParam0E_Loop_4; 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 and X, the N, Z, C and V flags, Zp7A, Zp7B, Zp7C, ZpD3. ; ;=============================================================================== SetActorSpriteParam0E_Loop_3: jsr ComputeActorSpriteSlot ; CPU:$F45F PRG:345F 20 66 F6 lda Zp7B,x ; CPU:$F462 PRG:3462 B5 7B beq SetActorSpriteParam0E_Loop_4 ; CPU:$F464 PRG:3464 F0 0E lda Zp76,x ; CPU:$F466 PRG:3466 B5 76 cmp #$2B ; CPU:$F468 PRG:3468 C9 2B bcs SetActorSpriteParam0E_Loop_4 ; CPU:$F46A PRG:346A B0 08 lda #$01 ; CPU:$F46C PRG:346C A9 01 sta Zp7A,x ; CPU:$F46E PRG:346E 95 7A lda #$00 ; CPU:$F470 PRG:3470 A9 00 sta Zp7B,x ; CPU:$F472 PRG:3472 95 7B ;=============================================================================== ; Routine: SetActorSpriteParam0E_Loop_4 ; Global: The routine reads no RAM 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 ZpD3; 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, ZpD3. ; ;=============================================================================== SetActorSpriteParam0E_Loop_4: lda #$00 ; CPU:$F474 PRG:3474 A9 00 sta ZpD3 ; CPU:$F476 PRG:3476 85 D3 rts ; CPU:$F478 PRG:3478 60 ;=============================================================================== ; Routine: DispatchActorSpriteState ; Global: The routine calls ComputeActorSpriteSlot, ResetActorScreenState and ComputeActorSpriteRowTwo, reads $0327 and ; $0388. ; Local: Executes 34 instructions: loads A with $00; stores A to ZpD6; loads A ; from ZpD5; stores A to Zp87; compares A with ZpC7; branches on ; equal to SetActorSpriteParam0E_Loop_3; and 28 more instructions. ; Parameters: Reads $0327 and $0388 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 RAM fields it writes. ; ;=============================================================================== DispatchActorSpriteState: ldx ZpD3 ; CPU:$F479 PRG:3479 A6 D3 beq DispatchActorSpriteState_Loop_5 ; CPU:$F47B PRG:347B F0 41 dex ; CPU:$F47D PRG:347D CA beq DispatchActorSpriteState_Loop_2 ; CPU:$F47E PRG:347E F0 26 lda $0388 ; CPU:$F480 PRG:3480 AD 88 03 bne DispatchActorSpriteState_Loop ; CPU:$F483 PRG:3483 D0 10 jsr ResetActorScreenState ; CPU:$F485 PRG:3485 20 01 F6 bcs DispatchActorSpriteState_Loop_4 ; CPU:$F488 PRG:3488 B0 33 jsr ComputeActorSpriteRowTwo ; CPU:$F48A PRG:348A 20 12 F6 bcc DispatchActorSpriteState_Loop ; CPU:$F48D PRG:348D 90 06 lda Zp0C ; CPU:$F48F PRG:348F A5 0C and #$03 ; CPU:$F491 PRG:3491 29 03 sta ZpD6 ; CPU:$F493 PRG:3493 85 D6 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop ; Global: The routine calls ComputeActorSpriteSlot, ResetActorSpriteState, StartActorScoreUpdate and AdvanceActorSpriteValue_Loop_2, reads ; $0327. ; Local: Executes 28 instructions: loads A with $00; stores A to ZpD6; loads A ; from ZpD5; stores A to Zp87; compares A with ZpC7; branches on ; equal to SetActorSpriteParam0E_Loop_3; and 22 more instructions. ; Parameters: Reads $0327 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 RAM fields it writes. ; ;=============================================================================== DispatchActorSpriteState_Loop: jsr ResetActorSpriteState ; CPU:$F495 PRG:3495 20 C6 F5 bcs SetActorSpriteParam0E_OnCarrySet ; CPU:$F498 PRG:3498 B0 B4 jsr StartActorScoreUpdate ; CPU:$F49A PRG:349A 20 11 DA lda ZpD6 ; CPU:$F49D PRG:349D A5 D6 beq DispatchActorSpriteState_Loop_4 ; CPU:$F49F PRG:349F F0 1C sta ZpAF ; CPU:$F4A1 PRG:34A1 85 AF jmp AdvanceActorSpriteValue_Loop_2 ; CPU:$F4A3 PRG:34A3 4C 5D F5 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop_2 ; Global: The routine calls ComputeActorSpriteSlot, ResetActorSpriteState, ComputeActorSpriteRowTwo, ResetActorScreenState and 2 more, ; reads $0327. ; Local: Executes 29 instructions: loads A with $00; stores A to ZpD6; loads A ; from ZpD5; stores A to Zp87; compares A with ZpC7; branches on ; equal to SetActorSpriteParam0E_Loop_3; and 23 more instructions. ; Parameters: Reads $0327 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 RAM fields it writes. ; ;=============================================================================== DispatchActorSpriteState_Loop_2: jsr ResetActorSpriteState ; CPU:$F4A6 PRG:34A6 20 C6 F5 bcs SetActorSpriteParam0E_OnCarrySet ; CPU:$F4A9 PRG:34A9 B0 A3 jsr ComputeActorSpriteRowTwo ; CPU:$F4AB PRG:34AB 20 12 F6 bcs DispatchActorSpriteState_Loop_3 ; CPU:$F4AE PRG:34AE B0 0B jsr ResetActorScreenState ; CPU:$F4B0 PRG:34B0 20 01 F6 bcs DispatchActorSpriteState_Loop_4 ; CPU:$F4B3 PRG:34B3 B0 08 jsr AdvanceActorSpriteValue ; CPU:$F4B5 PRG:34B5 20 40 F5 jmp DecrementActorTimer ; CPU:$F4B8 PRG:34B8 4C 1D F5 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop_3 ; Global: The routine reads no RAM 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 ZpD3. ; 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, ZpD3. ; ;=============================================================================== DispatchActorSpriteState_Loop_3: inc ZpD3 ; CPU:$F4BB PRG:34BB E6 D3 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop_4 ; Global: The routine reads no RAM 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. ; ;=============================================================================== DispatchActorSpriteState_Loop_4: rts ; CPU:$F4BD PRG:34BD 60 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop_5 ; Global: The routine calls PlaySoundEffectById and ComputeActorSpriteSlot. ; Local: Executes 15 instructions: loads A with $03; calls PlaySoundEffectById; loads A ; with $02; stores A to Zp76; loads A from Zp87; stores A to ZpC7; ; 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. ; ;=============================================================================== DispatchActorSpriteState_Loop_5: lda #$03 ; CPU:$F4BE PRG:34BE A9 03 jsr PlaySoundEffectById ; CPU:$F4C0 PRG:34C0 20 0D F8 lda #$02 ; CPU:$F4C3 PRG:34C3 A9 02 sta Zp76 ; CPU:$F4C5 PRG:34C5 85 76 lda Zp87 ; CPU:$F4C7 PRG:34C7 A5 87 sta ZpC7 ; CPU:$F4C9 PRG:34C9 85 C7 jsr ComputeActorSpriteSlot ; CPU:$F4CB PRG:34CB 20 66 F6 lda #$FE ; CPU:$F4CE PRG:34CE A9 FE sta Zp87 ; CPU:$F4D0 PRG:34D0 85 87 lda Zp7A,x ; CPU:$F4D2 PRG:34D2 B5 7A sta ZpAF ; CPU:$F4D4 PRG:34D4 85 AF beq DispatchActorSpriteState_Loop_6 ; CPU:$F4D6 PRG:34D6 F0 06 eor #$03 ; CPU:$F4D8 PRG:34D8 49 03 beq DispatchActorSpriteState_Loop_6 ; CPU:$F4DA PRG:34DA F0 02 lda Zp79,x ; CPU:$F4DC PRG:34DC B5 79 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop_6 ; Global: The routine reads no RAM 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: copies A into Y; loads A from Zp7B,x; ; branches on not equal to DispatchActorSpriteState_Loop_8; loads A from Zp7A,x; compares A ; with $02; branches on not equal to DispatchActorSpriteState_Loop_8; 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 Y, the N, Z, C and V flags, ZpAE, ZpD3, $03A0, $03A2. ; ;=============================================================================== DispatchActorSpriteState_Loop_6: tay ; CPU:$F4DE PRG:34DE A8 lda Zp7B,x ; CPU:$F4DF PRG:34DF B5 7B bne DispatchActorSpriteState_Loop_8 ; CPU:$F4E1 PRG:34E1 D0 12 lda Zp7A,x ; CPU:$F4E3 PRG:34E3 B5 7A cmp #$02 ; CPU:$F4E5 PRG:34E5 C9 02 bne DispatchActorSpriteState_Loop_8 ; CPU:$F4E7 PRG:34E7 D0 0C lda Zp7C,x ; CPU:$F4E9 PRG:34E9 B5 7C cmp #$06 ; CPU:$F4EB PRG:34EB C9 06 bcc DispatchActorSpriteState_Loop_7 ; CPU:$F4ED PRG:34ED 90 04 ldy #$00 ; CPU:$F4EF PRG:34EF A0 00 beq DispatchActorSpriteState_Loop_8 ; CPU:$F4F1 PRG:34F1 F0 02 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop_7 ; Global: The routine reads no RAM 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 $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 Y, the N, Z, C and V flags, ZpAE, ZpD3, $03A0, $03A2. ; ;=============================================================================== DispatchActorSpriteState_Loop_7: ldy #$02 ; CPU:$F4F3 PRG:34F3 A0 02 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop_8 ; Global: The routine reads no RAM 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 $F514,y; stores A to ZpAE; ; loads A from Zp7C,x; shifts a left; loads Y from Zp7B,x; branches ; on not equal to DispatchActorSpriteState_Loop_9; 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, ZpAE, ZpD3, $03A0, $03A2. ; ;=============================================================================== DispatchActorSpriteState_Loop_8: lda $F514,y ; CPU:$F4F5 PRG:34F5 B9 14 F5 sta ZpAE ; CPU:$F4F8 PRG:34F8 85 AE lda Zp7C,x ; CPU:$F4FA PRG:34FA B5 7C asl a ; CPU:$F4FC PRG:34FC 0A ldy Zp7B,x ; CPU:$F4FD PRG:34FD B4 7B bne DispatchActorSpriteState_Loop_9 ; CPU:$F4FF PRG:34FF D0 03 clc ; CPU:$F501 PRG:3501 18 adc #$12 ; CPU:$F502 PRG:3502 69 12 ;=============================================================================== ; Routine: DispatchActorSpriteState_Loop_9 ; Global: The routine writes $03A2 and $03A0. ; Local: Executes 7 instructions: copies A into Y; loads A from $F7B6,y; ; stores A to $03A2; loads A from $F7B7,y; stores A to $03A0; ; increments ZpD3; 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 $03A2 and $03A0 changed. ; Clobbers: ; A and Y, the N and Z flags, ZpD3, $03A0, $03A2. ; ;=============================================================================== DispatchActorSpriteState_Loop_9: tay ; CPU:$F504 PRG:3504 A8 lda $F7B6,y ; CPU:$F505 PRG:3505 B9 B6 F7 sta $03A2 ; CPU:$F508 PRG:3508 8D A2 03 lda $F7B7,y ; CPU:$F50B PRG:350B B9 B7 F7 sta $03A0 ; CPU:$F50E PRG:350E 8D A0 03 inc ZpD3 ; CPU:$F511 PRG:3511 E6 D3 rts ; CPU:$F513 PRG:3513 60 ; ---- data $F514-$F51C (9 bytes) ---- ; referenced by `lda $F514,y` at $F4F5 (operand $F514 falls inside this region) BitMaskTable: .byte $00, $20, $40, $60, $80, $A0, $C0, $E0, $FF ; CPU:$F514 PRG:3514 00 20 40 60 80 A0 C0 E0 FF ;=============================================================================== ; Routine: DecrementActorTimer ; Global: The routine writes $03A1 and $03A2, reads $03A1, $03A0 and $03A2. ; Local: Executes 10 instructions: loads X with $00; sets the carry flag; ; loads A from $03A1; subtracts $03A0 from A; stores A to $03A1; ; loads A from $03A2; and 4 more instructions. ; Parameters: Reads $03A1, $03A0 and $03A2 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 $03A1 and $03A2 changed. ; Clobbers: ; A and X, the N, Z, C and V flags, Zp73, ZpCB, $03A1, $03A2. ; ;=============================================================================== DecrementActorTimer: ldx #$00 ; CPU:$F51D PRG:351D A2 00 sec ; CPU:$F51F PRG:351F 38 lda $03A1 ; CPU:$F520 PRG:3520 AD A1 03 sbc $03A0 ; CPU:$F523 PRG:3523 ED A0 03 sta $03A1 ; CPU:$F526 PRG:3526 8D A1 03 lda $03A2 ; CPU:$F529 PRG:3529 AD A2 03 sbc #$00 ; CPU:$F52C PRG:352C E9 00 sta $03A2 ; CPU:$F52E PRG:352E 8D A2 03 bmi DecrementActorTimer_Loop ; CPU:$F531 PRG:3531 30 02 ldx #$01 ; CPU:$F533 PRG:3533 A2 01 ;=============================================================================== ; Routine: DecrementActorTimer_Loop ; Global: The routine reads $03A2. ; Local: Executes 5 instructions: stores X to ZpCB; loads A from Zp73; sets ; the carry flag; subtracts $03A2 from A; stores A to Zp73. ; Parameters: Reads $03A2 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, the N, Z, C and V flags, Zp73, ZpCB. ; ;=============================================================================== DecrementActorTimer_Loop: stx ZpCB ; CPU:$F535 PRG:3535 86 CB lda Zp73 ; CPU:$F537 PRG:3537 A5 73 sec ; CPU:$F539 PRG:3539 38 sbc $03A2 ; CPU:$F53A PRG:353A ED A2 03 sta Zp73 ; CPU:$F53D PRG:353D 85 73 ;=============================================================================== ; Routine: DecrementActorTimer_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 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. ; ;=============================================================================== DecrementActorTimer_OnZero: rts ; CPU:$F53F PRG:353F 60 ;=============================================================================== ; Routine: AdvanceActorSpriteValue ; Global: The routine reads no RAM 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: returns with RTS; loads A from ZpAE; ; branches on equal to DecrementActorTimer_OnZero; compares A with $FF; branches on ; equal to AdvanceActorSpriteValue_Loop; adds ZpD7 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: 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. ; ;=============================================================================== AdvanceActorSpriteValue: lda ZpAE ; CPU:$F540 PRG:3540 A5 AE beq DecrementActorTimer_OnZero ; CPU:$F542 PRG:3542 F0 FB cmp #$FF ; CPU:$F544 PRG:3544 C9 FF beq AdvanceActorSpriteValue_Loop ; CPU:$F546 PRG:3546 F0 06 adc ZpD7 ; CPU:$F548 PRG:3548 65 D7 sta ZpD7 ; CPU:$F54A PRG:354A 85 D7 bcc DecrementActorTimer_OnZero ; CPU:$F54C PRG:354C 90 F1 ;=============================================================================== ; Routine: AdvanceActorSpriteValue_Loop ; Global: The routine calls ComputeActorSpriteSlot. ; Local: Executes 7 instructions: loads A from Zp87; calls ComputeActorSpriteSlot; loads Y ; from Zp7F,x; compares Y with $05; branches on carry clear to ; AdvanceActorSpriteValue_Loop_2; loads A with $02; 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. ; ;=============================================================================== AdvanceActorSpriteValue_Loop: lda Zp87 ; CPU:$F54E PRG:354E A5 87 jsr ComputeActorSpriteSlot ; CPU:$F550 PRG:3550 20 66 F6 ldy Zp7F,x ; CPU:$F553 PRG:3553 B4 7F cpy #$05 ; CPU:$F555 PRG:3555 C0 05 bcc AdvanceActorSpriteValue_Loop_2 ; CPU:$F557 PRG:3557 90 04 lda #$02 ; CPU:$F559 PRG:3559 A9 02 bne AdvanceActorSpriteValue_Loop_3 ; CPU:$F55B PRG:355B D0 02 ;=============================================================================== ; Routine: AdvanceActorSpriteValue_Loop_2 ; Global: The routine reads no RAM 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, Zp56, Zp6A, Zp6B, Zp70, Zp74, ; Zp80. ; ;=============================================================================== AdvanceActorSpriteValue_Loop_2: lda #$01 ; CPU:$F55D PRG:355D A9 01 ;=============================================================================== ; Routine: AdvanceActorSpriteValue_Loop_3 ; Global: The routine reads no RAM 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 Zp56; loads A from ZpAF; ; compares A with $01; branches on equal to ComputeActorSpriteValue_Loop_2; loads A from ; Zp74; sets the carry flag; 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, Zp56, Zp6A, Zp6B, Zp70, Zp74, ; Zp80. ; ;=============================================================================== AdvanceActorSpriteValue_Loop_3: sta Zp56 ; CPU:$F55F PRG:355F 85 56 lda ZpAF ; CPU:$F561 PRG:3561 A5 AF cmp #$01 ; CPU:$F563 PRG:3563 C9 01 beq ComputeActorSpriteValue_Loop_2 ; CPU:$F565 PRG:3565 F0 21 lda Zp74 ; CPU:$F567 PRG:3567 A5 74 sec ; CPU:$F569 PRG:3569 38 sbc Zp56 ; CPU:$F56A PRG:356A E5 56 bcc AdvanceActorSpriteValue_Loop_4 ; CPU:$F56C PRG:356C 90 02 sta Zp74 ; CPU:$F56E PRG:356E 85 74 ;=============================================================================== ; Routine: AdvanceActorSpriteValue_Loop_4 ; Global: The routine reads no RAM 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. ; ;=============================================================================== AdvanceActorSpriteValue_Loop_4: rts ; CPU:$F570 PRG:3570 60 ;=============================================================================== ; Routine: ComputeActorSpriteValue ; Global: The routine calls SubtractFromActorCoordinate. ; Local: Executes 4 instructions: calls SubtractFromActorCoordinate; branches on negative to ; ComputeActorSpriteValue_Loop; loads Y with $04; loads X with $20. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp6A, Zp6B, Zp74. ; ;=============================================================================== ComputeActorSpriteValue: jsr SubtractFromActorCoordinate; CPU:$F571 PRG:3571 20 FC F7 bmi ComputeActorSpriteValue_Loop ; CPU:$F574 PRG:3574 30 11 ldy #$04 ; CPU:$F576 PRG:3576 A0 04 ldx #$20 ; CPU:$F578 PRG:3578 A2 20 ;=============================================================================== ; Routine: ComputeActorSpriteValue_OnNonzero ; Global: The routine calls NextActorSlot. ; Local: Executes 7 instructions: loads A from Zp74,x; clears the carry flag; ; adds Zp56 to A; stores A to Zp74,x; calls NextActorSlot; 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 and Y, the N, Z, C and V flags, Zp74. ; ;=============================================================================== ComputeActorSpriteValue_OnNonzero: lda Zp74,x ; CPU:$F57A PRG:357A B5 74 clc ; CPU:$F57C PRG:357C 18 adc Zp56 ; CPU:$F57D PRG:357D 65 56 sta Zp74,x ; CPU:$F57F PRG:357F 95 74 jsr NextActorSlot ; CPU:$F581 PRG:3581 20 EC C9 dey ; CPU:$F584 PRG:3584 88 bne ComputeActorSpriteValue_OnNonzero ; CPU:$F585 PRG:3585 D0 F3 ;=============================================================================== ; Routine: ComputeActorSpriteValue_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: 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. ; ;=============================================================================== ComputeActorSpriteValue_Loop: rts ; CPU:$F587 PRG:3587 60 ;=============================================================================== ; Routine: ComputeActorSpriteValue_Loop_2 ; Global: The routine calls CheckActorScrollRange. ; Local: Executes 9 instructions: calls CheckActorScrollRange; branches on carry set to ; ComputeActorSpriteValue_Loop_4; clears the carry flag; loads A from Zp74; adds Zp56 to A; ; copies A into X; 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, Zp6A, Zp6B, Zp70, Zp74, Zp80. ; ;=============================================================================== ComputeActorSpriteValue_Loop_2: jsr CheckActorScrollRange ; CPU:$F588 PRG:3588 20 05 DA bcs ComputeActorSpriteValue_Loop_4 ; CPU:$F58B PRG:358B B0 0D clc ; CPU:$F58D PRG:358D 18 lda Zp74 ; CPU:$F58E PRG:358E A5 74 adc Zp56 ; CPU:$F590 PRG:3590 65 56 tax ; CPU:$F592 PRG:3592 AA adc #$10 ; CPU:$F593 PRG:3593 69 10 bcs ComputeActorSpriteValue_Loop_3 ; CPU:$F595 PRG:3595 B0 02 stx Zp74 ; CPU:$F597 PRG:3597 86 74 ;=============================================================================== ; Routine: ComputeActorSpriteValue_Loop_3 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ComputeActorSpriteValue_Loop_3: rts ; CPU:$F599 PRG:3599 60 ;=============================================================================== ; Routine: ComputeActorSpriteValue_Loop_4 ; Global: The routine calls AddToActorCoordinate. ; Local: Executes 3 instructions: calls AddToActorCoordinate; loads Y with $04; loads X ; with $20. ; 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, Zp6A, Zp6B, Zp70, Zp74, Zp80. ; ;=============================================================================== ComputeActorSpriteValue_Loop_4: jsr AddToActorCoordinate ; CPU:$F59A PRG:359A 20 EE F7 ldy #$04 ; CPU:$F59D PRG:359D A0 04 ldx #$20 ; CPU:$F59F PRG:359F A2 20 ;=============================================================================== ; Routine: ComputeActorSpriteValue_OnNonzero_2 ; Global: The routine reads no RAM 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 Zp70,x; branches on equal to ; ComputeActorSpriteValue_Loop_5; loads A from Zp74,x; sets the carry flag; subtracts Zp56 ; from A; stores A to Zp74,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 and Y, the N, Z, C and V flags, Zp70, Zp74, Zp80. ; ;=============================================================================== ComputeActorSpriteValue_OnNonzero_2: lda Zp70,x ; CPU:$F5A1 PRG:35A1 B5 70 beq ComputeActorSpriteValue_Loop_5 ; CPU:$F5A3 PRG:35A3 F0 1A lda Zp74,x ; CPU:$F5A5 PRG:35A5 B5 74 sec ; CPU:$F5A7 PRG:35A7 38 sbc Zp56 ; CPU:$F5A8 PRG:35A8 E5 56 sta Zp74,x ; CPU:$F5AA PRG:35AA 95 74 lda Zp74,x ; CPU:$F5AC PRG:35AC B5 74 cmp #$08 ; CPU:$F5AE PRG:35AE C9 08 bcs ComputeActorSpriteValue_Loop_5 ; CPU:$F5B0 PRG:35B0 B0 0D txa ; CPU:$F5B2 PRG:35B2 8A and #$10 ; CPU:$F5B3 PRG:35B3 29 10 bne ComputeActorSpriteValue_Loop_5 ; CPU:$F5B5 PRG:35B5 D0 08 lda #$00 ; CPU:$F5B7 PRG:35B7 A9 00 sta Zp70,x ; CPU:$F5B9 PRG:35B9 95 70 sta Zp80,x ; CPU:$F5BB PRG:35BB 95 80 beq ComputeActorSpriteValue_Loop_5 ; CPU:$F5BD PRG:35BD F0 00 ;=============================================================================== ; Routine: ComputeActorSpriteValue_Loop_5 ; Global: The routine calls NextActorSlot. ; Local: Executes 20 instructions: loads A from Zp70,x; branches on equal to ; ComputeActorSpriteValue_Loop_5; loads A from Zp74,x; sets the carry flag; subtracts Zp56 ; from A; stores A to Zp74,x; 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 Y, the N, Z, C and V flags, Zp70, Zp74, Zp80. ; ;=============================================================================== ComputeActorSpriteValue_Loop_5: jsr NextActorSlot ; CPU:$F5BF PRG:35BF 20 EC C9 dey ; CPU:$F5C2 PRG:35C2 88 bne ComputeActorSpriteValue_OnNonzero_2 ; CPU:$F5C3 PRG:35C3 D0 DC rts ; CPU:$F5C5 PRG:35C5 60 ;=============================================================================== ; Routine: ResetActorSpriteState ; Global: The routine calls SetActorScreenRowThree. ; Local: Executes 3 instructions: calls SetActorScreenRowThree; loads A with $01; stores A ; to ZpD5. ; 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. ; ;=============================================================================== ResetActorSpriteState: jsr SetActorScreenRowThree ; CPU:$F5C6 PRG:35C6 20 03 E9 lda #$01 ; CPU:$F5C9 PRG:35C9 A9 01 sta ZpD5 ; CPU:$F5CB PRG:35CB 85 D5 ;=============================================================================== ; Routine: ResetActorSpriteState_OnNonnegative ; Global: The routine reads no RAM 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 ZpD5; loads Y from ZpD3; ; decrements Y; branches on not equal to ResetActorSpriteState_Loop; compares A with ; ZpC7; branches on equal to ResetActorSpriteState_Loop_2. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== ResetActorSpriteState_OnNonnegative: lda ZpD5 ; CPU:$F5CD PRG:35CD A5 D5 ldy ZpD3 ; CPU:$F5CF PRG:35CF A4 D3 dey ; CPU:$F5D1 PRG:35D1 88 bne ResetActorSpriteState_Loop ; CPU:$F5D2 PRG:35D2 D0 04 cmp ZpC7 ; CPU:$F5D4 PRG:35D4 C5 C7 beq ResetActorSpriteState_Loop_2 ; CPU:$F5D6 PRG:35D6 F0 23 ;=============================================================================== ; Routine: ResetActorSpriteState_Loop ; Global: The routine calls GetActorSpriteSlot, StoreActorBox and CheckActorBoxOverlap. ; Local: Executes 23 instructions: loads A from ZpD5; loads Y from ZpD3; ; decrements Y; branches on not equal to ResetActorSpriteState_Loop; compares A with ; ZpC7; branches on equal to ResetActorSpriteState_Loop_2; 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 and V flags, the RAM fields it writes. ; ;=============================================================================== ResetActorSpriteState_Loop: sec ; CPU:$F5D8 PRG:35D8 38 rol a ; CPU:$F5D9 PRG:35D9 2A adc #$02 ; CPU:$F5DA PRG:35DA 69 02 jsr GetActorSpriteSlot ; CPU:$F5DC PRG:35DC 20 DA F7 lda Zp70,x ; CPU:$F5DF PRG:35DF B5 70 beq ResetActorSpriteState_Loop_2 ; CPU:$F5E1 PRG:35E1 F0 18 lda Zp75,x ; CPU:$F5E3 PRG:35E3 B5 75 bne ResetActorSpriteState_Loop_2 ; CPU:$F5E5 PRG:35E5 D0 14 ldy #$08 ; CPU:$F5E7 PRG:35E7 A0 08 sty Zp8D ; CPU:$F5E9 PRG:35E9 84 8D sty Zp8F ; CPU:$F5EB PRG:35EB 84 8F ldy #$00 ; CPU:$F5ED PRG:35ED A0 00 sty Zp8E ; CPU:$F5EF PRG:35EF 84 8E sty Zp8C ; CPU:$F5F1 PRG:35F1 84 8C jsr StoreActorBox ; CPU:$F5F3 PRG:35F3 20 62 CC jsr CheckActorBoxOverlap ; CPU:$F5F6 PRG:35F6 20 7E CC bcs ResetActorSpriteState_OnCarryClear ; CPU:$F5F9 PRG:35F9 B0 05 ;=============================================================================== ; Routine: ResetActorSpriteState_Loop_2 ; Global: The routine calls GetActorSpriteSlot, StoreActorBox and CheckActorBoxOverlap. ; Local: Executes 26 instructions: loads A from ZpD5; loads Y from ZpD3; ; decrements Y; branches on not equal to ResetActorSpriteState_Loop; compares A with ; ZpC7; branches on equal to ResetActorSpriteState_Loop_2; 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. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== ResetActorSpriteState_Loop_2: dec ZpD5 ; CPU:$F5FB PRG:35FB C6 D5 bpl ResetActorSpriteState_OnNonnegative ; CPU:$F5FD PRG:35FD 10 CE clc ; CPU:$F5FF PRG:35FF 18 ;=============================================================================== ; Routine: ResetActorSpriteState_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 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. ; ;=============================================================================== ResetActorSpriteState_OnCarryClear: rts ; CPU:$F600 PRG:3600 60 ;=============================================================================== ; Routine: ResetActorScreenState ; Global: The routine calls ClearActorScoreState. ; Local: Executes 9 instructions: returns with RTS; loads A from Zp73; ; compares A with $C0; branches on carry clear to ResetActorSpriteState_OnCarryClear; loads A ; with $00; stores A to Zp87; 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 and C flags, the RAM fields it writes. ; ;=============================================================================== ResetActorScreenState: lda Zp73 ; CPU:$F601 PRG:3601 A5 73 cmp #$C0 ; CPU:$F603 PRG:3603 C9 C0 bcc ResetActorSpriteState_OnCarryClear ; CPU:$F605 PRG:3605 90 F9 lda #$00 ; CPU:$F607 PRG:3607 A9 00 sta Zp87 ; CPU:$F609 PRG:3609 85 87 inc Zp0F ; CPU:$F60B PRG:360B E6 0F inc ZpCF ; CPU:$F60D PRG:360D E6 CF jmp ClearActorScoreState ; CPU:$F60F PRG:360F 4C 87 DB ;=============================================================================== ; Routine: ComputeActorSpriteRowTwo ; Global: The routine reads no RAM 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 Zp73; compares A with $AC; ; branches on carry clear to ComputeActorSpriteRowTwo_Loop_4; loads X with $30. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== ComputeActorSpriteRowTwo: lda Zp73 ; CPU:$F612 PRG:3612 A5 73 cmp #$AC ; CPU:$F614 PRG:3614 C9 AC bcc ComputeActorSpriteRowTwo_Loop_4 ; CPU:$F616 PRG:3616 90 27 ldx #$30 ; CPU:$F618 PRG:3618 A2 30 ;=============================================================================== ; Routine: ComputeActorSpriteRowTwo_OnNonnegative ; Global: The routine calls LoadActorPosition. ; Local: Executes 7 instructions: loads A from $0500,x; branches on equal to ; ComputeActorSpriteRowTwo_Loop_3; calls LoadActorPosition; branches on carry clear to ComputeActorSpriteRowTwo_Loop; ; compares A with $E8; branches on carry set to ComputeActorSpriteRowTwo_Loop_2; 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, the RAM fields it writes. ; ;=============================================================================== ComputeActorSpriteRowTwo_OnNonnegative: lda $0500,x ; CPU:$F61A PRG:361A BD 00 05 beq ComputeActorSpriteRowTwo_Loop_3 ; CPU:$F61D PRG:361D F0 1B jsr LoadActorPosition ; CPU:$F61F PRG:361F 20 16 CC bcc ComputeActorSpriteRowTwo_Loop ; CPU:$F622 PRG:3622 90 06 cmp #$E8 ; CPU:$F624 PRG:3624 C9 E8 bcs ComputeActorSpriteRowTwo_Loop_2 ; CPU:$F626 PRG:3626 B0 0B bcc ComputeActorSpriteRowTwo_Loop_3 ; CPU:$F628 PRG:3628 90 10 ;=============================================================================== ; Routine: ComputeActorSpriteRowTwo_Loop ; Global: The routine calls LoadActorPosition. ; Local: Executes 12 instructions: loads A from $0500,x; branches on equal to ; ComputeActorSpriteRowTwo_Loop_3; calls LoadActorPosition; branches on carry clear to ComputeActorSpriteRowTwo_Loop; ; compares A with $E8; branches on carry set to ComputeActorSpriteRowTwo_Loop_2; 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, C and V flags, the RAM fields it writes. ; ;=============================================================================== ComputeActorSpriteRowTwo_Loop: sec ; CPU:$F62A PRG:362A 38 sbc #$00 ; CPU:$F62B PRG:362B E9 00 bcc ComputeActorSpriteRowTwo_Loop_2 ; CPU:$F62D PRG:362D 90 04 cmp Zp74 ; CPU:$F62F PRG:362F C5 74 bcs ComputeActorSpriteRowTwo_Loop_3 ; CPU:$F631 PRG:3631 B0 07 ;=============================================================================== ; Routine: ComputeActorSpriteRowTwo_Loop_2 ; Global: The routine calls LoadActorPosition. ; Local: Executes 16 instructions: loads A from $0500,x; branches on equal to ; ComputeActorSpriteRowTwo_Loop_3; calls LoadActorPosition; branches on carry clear to ComputeActorSpriteRowTwo_Loop; ; compares A with $E8; branches on carry set to ComputeActorSpriteRowTwo_Loop_2; 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, the RAM fields it writes. ; ;=============================================================================== ComputeActorSpriteRowTwo_Loop_2: clc ; CPU:$F633 PRG:3633 18 adc #$18 ; CPU:$F634 PRG:3634 69 18 cmp Zp74 ; CPU:$F636 PRG:3636 C5 74 bcs ComputeActorSpriteRowTwo_Loop_5 ; CPU:$F638 PRG:3638 B0 07 ;=============================================================================== ; Routine: ComputeActorSpriteRowTwo_Loop_3 ; Global: The routine calls LoadActorPosition and PreviousActorSlot. ; Local: Executes 18 instructions: loads A from $0500,x; branches on equal to ; ComputeActorSpriteRowTwo_Loop_3; calls LoadActorPosition; branches on carry clear to ComputeActorSpriteRowTwo_Loop; ; compares A with $E8; branches on carry set to ComputeActorSpriteRowTwo_Loop_2; 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, the RAM fields it writes. ; ;=============================================================================== ComputeActorSpriteRowTwo_Loop_3: jsr PreviousActorSlot ; CPU:$F63A PRG:363A 20 F2 C9 bpl ComputeActorSpriteRowTwo_OnNonnegative ; CPU:$F63D PRG:363D 10 DB ;=============================================================================== ; Routine: ComputeActorSpriteRowTwo_Loop_4 ; Global: The routine reads no RAM 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. ; ;=============================================================================== ComputeActorSpriteRowTwo_Loop_4: clc ; CPU:$F63F PRG:363F 18 rts ; CPU:$F640 PRG:3640 60 ;=============================================================================== ; Routine: ComputeActorSpriteRowTwo_Loop_5 ; Global: The routine calls ClearActorScoreState, reads $038E. ; Local: Executes 4 instructions: calls ClearActorScoreState; increments $038E; sets the ; carry flag; returns with RTS. ; Parameters: Reads $038E 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, ZpCD, ZpDE, ZpDF, $0323, $0386, $038E. ; ;=============================================================================== ComputeActorSpriteRowTwo_Loop_5: jsr ClearActorScoreState ; CPU:$F641 PRG:3641 20 87 DB inc $038E ; CPU:$F644 PRG:3644 EE 8E 03 sec ; CPU:$F647 PRG:3647 38 rts ; CPU:$F648 PRG:3648 60 ;=============================================================================== ; Routine: SelectActorSpriteIndexTwo ; Global: The routine calls FindActorSpriteRecord and SelectActorBehaviour. ; Local: Executes 8 instructions: loads Y from ZpAB; loads A from $F65B,y; ; stores A to ZpAB; shifts a left; stores A to ZpAD; increments ZpCF; ; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorSpriteIndexTwo: ldy ZpAB ; CPU:$F649 PRG:3649 A4 AB lda $F65B,y ; CPU:$F64B PRG:364B B9 5B F6 sta ZpAB ; CPU:$F64E PRG:364E 85 AB asl a ; CPU:$F650 PRG:3650 0A sta ZpAD ; CPU:$F651 PRG:3651 85 AD inc ZpCF ; CPU:$F653 PRG:3653 E6 CF jsr FindActorSpriteRecord ; CPU:$F655 PRG:3655 20 CF F1 jmp SelectActorBehaviour ; CPU:$F658 PRG:3658 4C 58 DC ; ---- data $F65B-$F665 (11 bytes) ---- ; referenced by `lda $F65B,y` at $F64B (operand $F65B falls inside this region) ObjectStateTransitionTable: .byte $00, $00, $02, $02, $04, $04, $06, $06, $06, $A5, $C7 ; CPU:$F65B PRG:365B 00 00 02 02 04 04 06 06 06 A5 C7 ;=============================================================================== ; Routine: ComputeActorSpriteSlot ; Global: The routine calls MultiplyActorValueBy16. ; Local: Executes 6 instructions: ANDs A with $01; shifts a left; adds $02 to ; A; calls MultiplyActorValueBy16; stores A to Zp7C; 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: ; X, the N, Z, C and V flags, Zp7C. ; ;=============================================================================== ComputeActorSpriteSlot: and #$01 ; CPU:$F666 PRG:3666 29 01 asl a ; CPU:$F668 PRG:3668 0A adc #$02 ; CPU:$F669 PRG:3669 69 02 jsr MultiplyActorValueBy16 ; CPU:$F66B PRG:366B 20 E9 F7 sta Zp7C ; CPU:$F66E PRG:366E 85 7C tax ; CPU:$F670 PRG:3670 AA ;=============================================================================== ; Routine: ComputeActorSpriteSlot_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 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. ; ;=============================================================================== ComputeActorSpriteSlot_OnZero: rts ; CPU:$F671 PRG:3671 60 ;=============================================================================== ; Routine: ComputeActorSpriteSlot_OnCarryClear ; Global: The routine calls MultiplyActorValueBy16 and ComputeActorSpriteSlot. ; Local: Executes 14 instructions: loads A from ZpAA; ANDs A with $03; calls ; MultiplyActorValueBy16; stores A to Zp8C; loads A from ZpAD; shifts a right; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== ComputeActorSpriteSlot_OnCarryClear: lda ZpAA ; CPU:$F672 PRG:3672 A5 AA and #$03 ; CPU:$F674 PRG:3674 29 03 jsr MultiplyActorValueBy16 ; CPU:$F676 PRG:3676 20 E9 F7 sta Zp8C ; CPU:$F679 PRG:3679 85 8C lda ZpAD ; CPU:$F67B PRG:367B A5 AD lsr a ; CPU:$F67D PRG:367D 4A eor #$01 ; CPU:$F67E PRG:367E 49 01 jsr ComputeActorSpriteSlot ; CPU:$F680 PRG:3680 20 66 F6 ldy #$00 ; CPU:$F683 PRG:3683 A0 00 lda Zp74,x ; CPU:$F685 PRG:3685 B5 74 clc ; CPU:$F687 PRG:3687 18 adc Zp6A ; CPU:$F688 PRG:3688 65 6A bcc ComputeActorSpriteSlot_Loop; CPU:$F68A PRG:368A 90 01 iny ; CPU:$F68C PRG:368C C8 ;=============================================================================== ; Routine: ComputeActorSpriteSlot_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 4 instructions: clears the carry flag; adds $20 to A; ; branches on carry clear to ComputeActorSpriteSlot_Loop_2; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== ComputeActorSpriteSlot_Loop: clc ; CPU:$F68D PRG:368D 18 adc #$20 ; CPU:$F68E PRG:368E 69 20 bcc ComputeActorSpriteSlot_Loop_2 ; CPU:$F690 PRG:3690 90 01 iny ; CPU:$F692 PRG:3692 C8 ;=============================================================================== ; Routine: ComputeActorSpriteSlot_Loop_2 ; Global: The routine calls InitActorSpriteDraw. ; Local: Executes 15 instructions: loads X from Zp8C; stores A to $0501,x; ; stores Y to Zp8E; copies Y into A; EORs A with Zp6B; 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: 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 RAM fields it writes. ; ;=============================================================================== ComputeActorSpriteSlot_Loop_2: ldx Zp8C ; CPU:$F693 PRG:3693 A6 8C sta $0501,x ; CPU:$F695 PRG:3695 9D 01 05 sty Zp8E ; CPU:$F698 PRG:3698 84 8E tya ; CPU:$F69A PRG:369A 98 eor Zp6B ; CPU:$F69B PRG:369B 45 6B and #$01 ; CPU:$F69D PRG:369D 29 01 sta $0502,x ; CPU:$F69F PRG:369F 9D 02 05 lda #$C0 ; CPU:$F6A2 PRG:36A2 A9 C0 sta $0503,x ; CPU:$F6A4 PRG:36A4 9D 03 05 lda #$05 ; CPU:$F6A7 PRG:36A7 A9 05 sta $0504,x ; CPU:$F6A9 PRG:36A9 9D 04 05 inc ZpAA ; CPU:$F6AC PRG:36AC E6 AA lda #$FF ; CPU:$F6AE PRG:36AE A9 FF sta $0500,x ; CPU:$F6B0 PRG:36B0 9D 00 05 jmp InitActorSpriteDraw ; CPU:$F6B3 PRG:36B3 4C 26 ED ;=============================================================================== ; Routine: ComputeActorSpriteSlot_OnZero_2 ; Global: The routine calls GetActorSpriteSlot and StartActorSpriteDraw. ; Local: Executes 11 instructions: returns with RTS; loads A from ZpAA; clears ; the carry flag; adds $01 to A; ANDs A with $03; calls GetActorSpriteSlot; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== ComputeActorSpriteSlot_OnZero_2: lda ZpAA ; CPU:$F6B6 PRG:36B6 A5 AA clc ; CPU:$F6B8 PRG:36B8 18 adc #$01 ; CPU:$F6B9 PRG:36B9 69 01 and #$03 ; CPU:$F6BB PRG:36BB 29 03 jsr GetActorSpriteSlot ; CPU:$F6BD PRG:36BD 20 DA F7 lda $0500,x ; CPU:$F6C0 PRG:36C0 BD 00 05 beq ComputeActorSpriteSlot_OnZero ; CPU:$F6C3 PRG:36C3 F0 AC lda #$00 ; CPU:$F6C5 PRG:36C5 A9 00 sta $0500,x ; CPU:$F6C7 PRG:36C7 9D 00 05 jmp StartActorSpriteDraw ; CPU:$F6CA PRG:36CA 4C 9C EC ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo ; Global: The routine calls MultiplyActorValueBy16, ComputeActorSpriteSlot, InitActorSpriteDraw, GetActorSpriteSlot and 1 more. ; Local: Executes 49 instructions: returns with RTS; loads A from ZpAA; ANDs A ; with $03; calls MultiplyActorValueBy16; stores A to Zp8C; loads A from ZpAD; and ; 43 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 RAM fields it writes. ; ;=============================================================================== SelectActorSpriteTypeTwo: lda Zp69 ; CPU:$F6CD PRG:36CD A5 69 cmp #$01 ; CPU:$F6CF PRG:36CF C9 01 bcc SelectActorSpriteTypeTwo_Loop_2 ; CPU:$F6D1 PRG:36D1 90 0A beq SelectActorSpriteTypeTwo_Loop ; CPU:$F6D3 PRG:36D3 F0 02 bcs SelectActorSpriteTypeTwo_Loop_3 ; CPU:$F6D5 PRG:36D5 B0 0C ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo_Loop ; Global: The routine calls MultiplyActorValueBy16, ComputeActorSpriteSlot, InitActorSpriteDraw, GetActorSpriteSlot and 1 more. ; Local: Executes 47 instructions: returns with RTS; loads A from ZpAA; ANDs A ; with $03; calls MultiplyActorValueBy16; stores A to Zp8C; loads A from ZpAD; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorSpriteTypeTwo_Loop: lda Zp68 ; CPU:$F6D7 PRG:36D7 A5 68 cmp #$0A ; CPU:$F6D9 PRG:36D9 C9 0A bcs SelectActorSpriteTypeTwo_Loop_3 ; CPU:$F6DB PRG:36DB B0 06 ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo_Loop_2 ; Global: The routine calls MultiplyActorValueBy16, ComputeActorSpriteSlot, InitActorSpriteDraw, GetActorSpriteSlot and 1 more. ; Local: Executes 47 instructions: returns with RTS; loads A from ZpAA; ANDs A ; with $03; calls MultiplyActorValueBy16; stores A to Zp8C; loads A from ZpAD; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorSpriteTypeTwo_Loop_2: lda #$00 ; CPU:$F6DD PRG:36DD A9 00 sta ZpB0 ; CPU:$F6DF PRG:36DF 85 B0 sta ZpC0 ; CPU:$F6E1 PRG:36E1 85 C0 ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo_Loop_3 ; Global: The routine calls MultiplyActorValueBy16, ComputeActorSpriteSlot, InitActorSpriteDraw, GetActorSpriteSlot and 1 more. ; Local: Executes 50 instructions: returns with RTS; loads A from ZpAA; ANDs A ; with $03; calls MultiplyActorValueBy16; stores A to Zp8C; loads A from ZpAD; and ; 44 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 RAM fields it writes. ; ;=============================================================================== SelectActorSpriteTypeTwo_Loop_3: lda ZpAD ; CPU:$F6E3 PRG:36E3 A5 AD lsr a ; CPU:$F6E5 PRG:36E5 4A bcc SelectActorSpriteTypeTwo_Loop_4 ; CPU:$F6E6 PRG:36E6 90 07 inc ZpAD ; CPU:$F6E8 PRG:36E8 E6 AD cmp #$08 ; CPU:$F6EA PRG:36EA C9 08 bcc ComputeActorSpriteSlot_OnCarryClear ; CPU:$F6EC PRG:36EC 90 84 ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo_OnCarrySet ; Global: The routine reads no RAM 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. ; ;=============================================================================== SelectActorSpriteTypeTwo_OnCarrySet: rts ; CPU:$F6EE PRG:36EE 60 ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo_Loop_4 ; Global: The routine calls GetActorSpriteSlot and StartActorSpriteDraw. ; Local: Executes 27 instructions: returns with RTS; loads A from ZpAA; clears ; the carry flag; adds $01 to A; ANDs A with $03; calls GetActorSpriteSlot; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorSpriteTypeTwo_Loop_4: sta ZpF8 ; CPU:$F6EF PRG:36EF 85 F8 asl a ; CPU:$F6F1 PRG:36F1 0A tay ; CPU:$F6F2 PRG:36F2 A8 ldx Zp6B ; CPU:$F6F3 PRG:36F3 A6 6B inx ; CPU:$F6F5 PRG:36F5 E8 stx Zp7B ; CPU:$F6F6 PRG:36F6 86 7B lda $F745,y ; CPU:$F6F8 PRG:36F8 B9 45 F7 sta Zp78 ; CPU:$F6FB PRG:36FB 85 78 cmp #$FF ; CPU:$F6FD PRG:36FD C9 FF beq ComputeActorSpriteSlot_OnZero_2 ; CPU:$F6FF PRG:36FF F0 B5 cmp Zp7B ; CPU:$F701 PRG:3701 C5 7B bne SelectActorSpriteTypeTwo_Loop_5 ; CPU:$F703 PRG:3703 D0 07 lda $F744,y ; CPU:$F705 PRG:3705 B9 44 F7 sta Zp77 ; CPU:$F708 PRG:3708 85 77 cmp Zp6A ; CPU:$F70A PRG:370A C5 6A ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo_Loop_5 ; Global: The routine calls ComputeActorSpriteSlot and ComputeActorFacing. ; Local: Executes 13 instructions: returns with RTS; branches on carry set to ; SelectActorSpriteTypeTwo_OnCarrySet; loads A from ZpF8; calls ComputeActorSpriteSlot; increments ZpAD; calls ; ComputeActorFacing; 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, I and V flags, the RAM fields it writes. ; ;=============================================================================== SelectActorSpriteTypeTwo_Loop_5: bcs SelectActorSpriteTypeTwo_OnCarrySet ; CPU:$F70C PRG:370C B0 E0 lda ZpF8 ; CPU:$F70E PRG:370E A5 F8 jsr ComputeActorSpriteSlot ; CPU:$F710 PRG:3710 20 66 F6 inc ZpAD ; CPU:$F713 PRG:3713 E6 AD jsr ComputeActorFacing ; CPU:$F715 PRG:3715 20 20 CC sta Zp74,x ; CPU:$F718 PRG:3718 95 74 lda #$3C ; CPU:$F71A PRG:371A A9 3C sta Zp73,x ; CPU:$F71C PRG:371C 95 73 lda #$3C ; CPU:$F71E PRG:371E A9 3C cpx #$20 ; CPU:$F720 PRG:3720 E0 20 beq SelectActorSpriteTypeTwo_Loop_6 ; CPU:$F722 PRG:3722 F0 02 lda #$6C ; CPU:$F724 PRG:3724 A9 6C ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo_Loop_6 ; Global: The routine calls ComputeActorSpriteBase. ; Local: Executes 7 instructions: stores A to Zp72,x; loads A with $01; stores ; A to Zp70,x; loads A with $FE; stores A to Zp71,x; calls ComputeActorSpriteBase; ; 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 RAM fields it writes. ; ;=============================================================================== SelectActorSpriteTypeTwo_Loop_6: sta Zp72,x ; CPU:$F726 PRG:3726 95 72 lda #$01 ; CPU:$F728 PRG:3728 A9 01 sta Zp70,x ; CPU:$F72A PRG:372A 95 70 lda #$FE ; CPU:$F72C PRG:372C A9 FE sta Zp71,x ; CPU:$F72E PRG:372E 95 71 jsr ComputeActorSpriteBase ; CPU:$F730 PRG:3730 20 58 F7 ldy #$07 ; CPU:$F733 PRG:3733 A0 07 ;=============================================================================== ; Routine: SelectActorSpriteTypeTwo_OnNonnegative ; Global: The routine calls StartActorSpriteMovement and ComputeActorSpriteSlot_OnZero_2. ; Local: Executes 7 instructions: loads A from $F1C7,y; stores A to Zp7C,x; ; decrements X; decrements Y; branches on non-negative to SelectActorSpriteTypeTwo_OnNonnegative; ; calls StartActorSpriteMovement; 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 RAM fields it writes. ; ;=============================================================================== SelectActorSpriteTypeTwo_OnNonnegative: lda $F1C7,y ; CPU:$F735 PRG:3735 B9 C7 F1 sta Zp7C,x ; CPU:$F738 PRG:3738 95 7C dex ; CPU:$F73A PRG:373A CA dey ; CPU:$F73B PRG:373B 88 bpl SelectActorSpriteTypeTwo_OnNonnegative ; CPU:$F73C PRG:373C 10 F7 jsr StartActorSpriteMovement ; CPU:$F73E PRG:373E 20 DB F2 jmp ComputeActorSpriteSlot_OnZero_2 ; CPU:$F741 PRG:3741 4C B6 F6 ; ---- data $F744-$F757 (20 bytes) ---- ; referenced by `lda $F745,y` at $F6F8 (operand $F745 falls inside this region) ; referenced by `lda $F744,y` at $F705 (operand $F744 falls inside this region) ObjectPositionTable: .byte $50, $00, $D0, $00, $50, $01, $D0, $01, $50, $02, $D0, $02, $50, $03, $D0, $03 ; CPU:$F744 PRG:3744 50 00 D0 00 50 01 D0 01 50 02 D0 02 50 03 D0 03 .byte $50, $04, $FF, $FF ; CPU:$F754 PRG:3754 50 04 FF FF ;=============================================================================== ; Routine: ComputeActorSpriteBase ; Global: The routine reads no RAM 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 Y from Zp66; decrements Y; copies Y ; into A; ANDs A with $03; copies A into Y; loads A from $F76C,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: Returns with RTS; the registers it loaded still hold the values it ; computed. ; Clobbers: ; A and Y, the N, Z, C and V flags, Zp7F. ; ;=============================================================================== ComputeActorSpriteBase: ldy Zp66 ; CPU:$F758 PRG:3758 A4 66 dey ; CPU:$F75A PRG:375A 88 tya ; CPU:$F75B PRG:375B 98 and #$03 ; CPU:$F75C PRG:375C 29 03 tay ; CPU:$F75E PRG:375E A8 lda $F76C,y ; CPU:$F75F PRG:375F B9 6C F7 clc ; CPU:$F762 PRG:3762 18 adc ZpF8 ; CPU:$F763 PRG:3763 65 F8 tay ; CPU:$F765 PRG:3765 A8 lda $F770,y ; CPU:$F766 PRG:3766 B9 70 F7 sta Zp7F,x ; CPU:$F769 PRG:3769 95 7F rts ; CPU:$F76B PRG:376B 60 ; ---- data $F76C-$F7D9 (110 bytes) ---- ; referenced by `lda $F794,y` at $F3A5 (operand $F794 falls inside this region) ; referenced by `lda $F79D,y` at $F3AA (operand $F79D falls inside this region) ; referenced by `sbc $F7A6,y` at $F444 (operand $F7A6 falls inside this region) ; referenced by `lda $F7B6,y` at $F505 (operand $F7B6 falls inside this region) ; referenced by `lda $F7B7,y` at $F50B (operand $F7B7 falls inside this region) ; referenced by `lda $F76C,y` at $F75F (operand $F76C falls inside this region) ; ... and 1 further references from decoded code RingParameterTable: .byte $00, $09, $12, $1B, $0A, $0A, $0B, $0A, $0A, $0A, $0A, $0E, $0A, $0B, $0B, $0A ; CPU:$F76C PRG:376C 00 09 12 1B 0A 0A 0B 0A 0A 0A 0A 0E 0A 0B 0B 0A .byte $0A, $0D, $0D, $0E, $0E, $0B, $0A, $0F, $0B, $0E, $0A, $0E, $0A, $0F, $0C, $0F ; CPU:$F77C PRG:377C 0A 0D 0D 0E 0E 0B 0A 0F 0B 0E 0A 0E 0A 0F 0C 0F .byte $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0A, $68, $68, $66, $64, $5D, $5B, $53, $4D ; CPU:$F78C PRG:378C 0F 0F 0F 0F 0F 0F 0F 0A 68 68 66 64 5D 5B 53 4D .byte $46, $78, $78, $73, $74, $6C, $64, $5E, $55, $4B, $10, $0F, $0E, $0D, $0C, $0B ; CPU:$F79C PRG:379C 46 78 78 73 74 6C 64 5E 55 4B 10 0F 0E 0D 0C 0B .byte $0A, $09, $08, $07, $06, $05, $04, $03, $02, $01, $00, $20, $00, $1E, $00, $1C ; CPU:$F7AC PRG:37AC 0A 09 08 07 06 05 04 03 02 01 00 20 00 1E 00 1C .byte $01, $26, $01, $24, $01, $22, $01, $20, $01, $22, $01, $24, $00, $20, $00, $21 ; CPU:$F7BC PRG:37BC 01 26 01 24 01 22 01 20 01 22 01 24 00 20 00 21 .byte $00, $22, $00, $23, $00, $24, $00, $25, $00, $26, $00, $27, $00, $28 ; CPU:$F7CC PRG:37CC 00 22 00 23 00 24 00 25 00 26 00 27 00 28 ;=============================================================================== ; Routine: GetActorSpriteSlot ; Global: The routine calls MultiplyActorValueBy16. ; Local: Executes 3 instructions: calls MultiplyActorValueBy16; 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: ; X, the N, Z and C flags. ; ;=============================================================================== GetActorSpriteSlot: jsr MultiplyActorValueBy16 ; CPU:$F7DA PRG:37DA 20 E9 F7 tax ; CPU:$F7DD PRG:37DD AA rts ; CPU:$F7DE PRG:37DE 60 ;=============================================================================== ; Routine: GetActorSpriteSlotTwo ; Global: The routine calls DivideActorValueBy16. ; Local: Executes 3 instructions: calls DivideActorValueBy16; 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: ; X, the N, Z and C flags. ; ;=============================================================================== GetActorSpriteSlotTwo: jsr DivideActorValueBy16 ; CPU:$F7DF PRG:37DF 20 E4 F7 tax ; CPU:$F7E2 PRG:37E2 AA rts ; CPU:$F7E3 PRG:37E3 60 ;=============================================================================== ; Routine: DivideActorValueBy16 ; Global: The routine reads no RAM 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: shifts a right; shifts a right; shifts a ; right; shifts a right; 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 and C flags. ; ;=============================================================================== DivideActorValueBy16: lsr a ; CPU:$F7E4 PRG:37E4 4A lsr a ; CPU:$F7E5 PRG:37E5 4A lsr a ; CPU:$F7E6 PRG:37E6 4A lsr a ; CPU:$F7E7 PRG:37E7 4A rts ; CPU:$F7E8 PRG:37E8 60 ;=============================================================================== ; Routine: MultiplyActorValueBy16 ; Global: The routine reads no RAM 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: shifts a left; shifts a left; shifts a left; ; shifts a left; 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 and C flags. ; ;=============================================================================== MultiplyActorValueBy16: asl a ; CPU:$F7E9 PRG:37E9 0A asl a ; CPU:$F7EA PRG:37EA 0A asl a ; CPU:$F7EB PRG:37EB 0A asl a ; CPU:$F7EC PRG:37EC 0A rts ; CPU:$F7ED PRG:37ED 60 ;=============================================================================== ; Routine: AddToActorCoordinate ; Global: The routine reads no RAM 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: clears the carry flag; loads A from Zp6A; ; adds Zp56 to A; stores A to Zp6A; loads A from Zp6B; adds $00 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: Returns with RTS; the registers it loaded still hold the values it ; computed. ; Clobbers: ; A, the N, Z, C and V flags, Zp6A, Zp6B. ; ;=============================================================================== AddToActorCoordinate: clc ; CPU:$F7EE PRG:37EE 18 lda Zp6A ; CPU:$F7EF PRG:37EF A5 6A adc Zp56 ; CPU:$F7F1 PRG:37F1 65 56 sta Zp6A ; CPU:$F7F3 PRG:37F3 85 6A lda Zp6B ; CPU:$F7F5 PRG:37F5 A5 6B adc #$00 ; CPU:$F7F7 PRG:37F7 69 00 sta Zp6B ; CPU:$F7F9 PRG:37F9 85 6B rts ; CPU:$F7FB PRG:37FB 60 ;=============================================================================== ; Routine: SubtractFromActorCoordinate ; Global: The routine reads no RAM 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 Zp6A; ; subtracts Zp56 from A; copies A into X; loads A from Zp6B; ; subtracts $00 from 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: 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, Zp6A, Zp6B. ; ;=============================================================================== SubtractFromActorCoordinate: sec ; CPU:$F7FC PRG:37FC 38 lda Zp6A ; CPU:$F7FD PRG:37FD A5 6A sbc Zp56 ; CPU:$F7FF PRG:37FF E5 56 tax ; CPU:$F801 PRG:3801 AA lda Zp6B ; CPU:$F802 PRG:3802 A5 6B sbc #$00 ; CPU:$F804 PRG:3804 E9 00 bmi SubtractFromActorCoordinate_Loop ; CPU:$F806 PRG:3806 30 04 stx Zp6A ; CPU:$F808 PRG:3808 86 6A sta Zp6B ; CPU:$F80A PRG:380A 85 6B ;=============================================================================== ; Routine: SubtractFromActorCoordinate_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: 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. ; ;=============================================================================== SubtractFromActorCoordinate_Loop: rts ; CPU:$F80C PRG:380C 60 ;=============================================================================== ; Routine: PlaySoundEffectById ; Global: The routine reads no RAM field, writes none and calls nothing - it ; is a straight-line sequence whose only effect is on the registers ; and the flags. ; Local: Executes 23 instructions: stores X to Zp4F; stores Y to Zp40; stores ; A to Zp2F; shifts a right; shifts a right; shifts a right; 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 and C flags, the RAM fields it writes. ; ;=============================================================================== PlaySoundEffectById: stx Zp4F ; CPU:$F80D PRG:380D 86 4F sty Zp40 ; CPU:$F80F PRG:380F 84 40 sta Zp2F ; CPU:$F811 PRG:3811 85 2F lsr a ; CPU:$F813 PRG:3813 4A lsr a ; CPU:$F814 PRG:3814 4A lsr a ; CPU:$F815 PRG:3815 4A lsr a ; CPU:$F816 PRG:3816 4A and #$0C ; CPU:$F817 PRG:3817 29 0C sta Zp1E ; CPU:$F819 PRG:3819 85 1E lsr a ; CPU:$F81B PRG:381B 4A lsr a ; CPU:$F81C PRG:381C 4A tay ; CPU:$F81D PRG:381D A8 ldx $F878,y ; CPU:$F81E PRG:381E BE 78 F8 lda Zp2F ; CPU:$F821 PRG:3821 A5 2F and #$3F ; CPU:$F823 PRG:3823 29 3F beq PlaySoundEffectById_Loop_3 ; CPU:$F825 PRG:3825 F0 36 cmp Zp02,x ; CPU:$F827 PRG:3827 D5 02 bcc PlaySoundEffectById_Loop_5 ; CPU:$F829 PRG:3829 90 48 bne PlaySoundEffectById_Loop ; CPU:$F82B PRG:382B D0 08 cmp #$0E ; CPU:$F82D PRG:382D C9 0E bcc PlaySoundEffectById_Loop_5 ; CPU:$F82F PRG:382F 90 42 cmp #$14 ; CPU:$F831 PRG:3831 C9 14 bcs PlaySoundEffectById_Loop_5 ; CPU:$F833 PRG:3833 B0 3E ;=============================================================================== ; Routine: PlaySoundEffectById_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 20 instructions: stores A to Zp2F; loads Y with $00; stores ; Y to Zp02,x; shifts a left; copies A into Y; loads A from $FAD1,y; ; 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 and C flags, the RAM fields it writes. ; ;=============================================================================== PlaySoundEffectById_Loop: sta Zp2F ; CPU:$F835 PRG:3835 85 2F ldy #$00 ; CPU:$F837 PRG:3837 A0 00 sty Zp02,x ; CPU:$F839 PRG:3839 94 02 asl a ; CPU:$F83B PRG:383B 0A tay ; CPU:$F83C PRG:383C A8 lda $FAD1,y ; CPU:$F83D PRG:383D B9 D1 FA sta Zp03,x ; CPU:$F840 PRG:3840 95 03 sta ZpF2 ; CPU:$F842 PRG:3842 85 F2 lda $FAD2,y ; CPU:$F844 PRG:3844 B9 D2 FA sta Zp04,x ; CPU:$F847 PRG:3847 95 04 sta ZpF3 ; CPU:$F849 PRG:3849 85 F3 ldy #$01 ; CPU:$F84B PRG:384B A0 01 sty Zp00,x ; CPU:$F84D PRG:384D 94 00 dey ; CPU:$F84F PRG:384F 88 sty Zp08,x ; CPU:$F850 PRG:3850 94 08 lda (ZpF2),y ; CPU:$F852 PRG:3852 B1 F2 and #$F0 ; CPU:$F854 PRG:3854 29 F0 cmp #$20 ; CPU:$F856 PRG:3856 C9 20 beq PlaySoundEffectById_Loop_2 ; CPU:$F858 PRG:3858 F0 01 iny ; CPU:$F85A PRG:385A C8 ;=============================================================================== ; Routine: PlaySoundEffectById_Loop_2 ; Global: The routine reads no RAM 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 Y to Zp0A,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 and C flags, Zp02, Zp0A, APUPULSE1CTRL, ; APUPULSE1SWEEP. ; ;=============================================================================== PlaySoundEffectById_Loop_2: sty Zp0A,x ; CPU:$F85B PRG:385B 94 0A ;=============================================================================== ; Routine: PlaySoundEffectById_Loop_3 ; Global: The routine reads no RAM 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 $00; loads Y from Zp1E; ; compares Y with $08; branches on equal to PlaySoundEffectById_Loop_4; loads A with ; $30. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp02, APUPULSE1CTRL, APUPULSE1SWEEP. ; ;=============================================================================== PlaySoundEffectById_Loop_3: lda #$00 ; CPU:$F85D PRG:385D A9 00 ldy Zp1E ; CPU:$F85F PRG:385F A4 1E cpy #$08 ; CPU:$F861 PRG:3861 C0 08 beq PlaySoundEffectById_Loop_4 ; CPU:$F863 PRG:3863 F0 02 lda #$30 ; CPU:$F865 PRG:3865 A9 30 ;=============================================================================== ; Routine: PlaySoundEffectById_Loop_4 ; Global: The routine reads no RAM 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 APUPULSE1CTRL,y; stores A to ; APUPULSE1SWEEP,y; loads A from Zp2F; ANDs A with $3F; stores A to ; Zp02,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 and Z flags, Zp02, APUPULSE1CTRL, APUPULSE1SWEEP. ; ;=============================================================================== PlaySoundEffectById_Loop_4: sta APUPULSE1CTRL,y ; CPU:$F867 PRG:3867 99 00 40 sta APUPULSE1SWEEP,y ; CPU:$F86A PRG:386A 99 01 40 lda Zp2F ; CPU:$F86D PRG:386D A5 2F and #$3F ; CPU:$F86F PRG:386F 29 3F sta Zp02,x ; CPU:$F871 PRG:3871 95 02 ;=============================================================================== ; Routine: PlaySoundEffectById_Loop_5 ; Global: The routine reads no RAM 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 Zp4F; loads Y from Zp40; ; 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. ; ;=============================================================================== PlaySoundEffectById_Loop_5: ldx Zp4F ; CPU:$F873 PRG:3873 A6 4F ldy Zp40 ; CPU:$F875 PRG:3875 A4 40 rts ; CPU:$F877 PRG:3877 60 ; ---- data $F878-$F87B (4 bytes) ---- ; referenced by `ldx $F878,y` at $F81E (operand $F878 falls inside this region) SoundChannelStateOffsetTable: .byte $10, $21, $32, $43 ; CPU:$F878 PRG:3878 10 21 32 43 ;=============================================================================== ; Routine: SetActorSpriteIndex16 ; Global: The routine reads no RAM 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 $10; 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. ; ;=============================================================================== SetActorSpriteIndex16: ldx #$10 ; CPU:$F87C PRG:387C A2 10 ldy #$00 ; CPU:$F87E PRG:387E A0 00 ;=============================================================================== ; Routine: SetActorSpriteIndex16_OnCarryClear ; Global: The routine calls UpdateSoundChannels. ; Local: Executes 5 instructions: stores X to ZpF4; stores Y to ZpF5; loads A ; from Zp02,x; branches on equal to SetActorSpriteIndex16_Loop; calls UpdateSoundChannels. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== SetActorSpriteIndex16_OnCarryClear: stx ZpF4 ; CPU:$F880 PRG:3880 86 F4 sty ZpF5 ; CPU:$F882 PRG:3882 84 F5 lda Zp02,x ; CPU:$F884 PRG:3884 B5 02 beq SetActorSpriteIndex16_Loop ; CPU:$F886 PRG:3886 F0 03 jsr UpdateSoundChannels ; CPU:$F888 PRG:3888 20 C8 F8 ;=============================================================================== ; Routine: SetActorSpriteIndex16_Loop ; Global: The routine calls UpdateSoundChannels. ; Local: Executes 11 instructions: stores X to ZpF4; stores Y to ZpF5; loads A ; from Zp02,x; branches on equal to SetActorSpriteIndex16_Loop; calls UpdateSoundChannels; loads A ; from ZpF4; 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. ; ;=============================================================================== SetActorSpriteIndex16_Loop: lda ZpF4 ; CPU:$F88B PRG:388B A5 F4 clc ; CPU:$F88D PRG:388D 18 adc #$11 ; CPU:$F88E PRG:388E 69 11 cmp #$54 ; CPU:$F890 PRG:3890 C9 54 bne SetActorSpriteIndex16_Loop_2 ; CPU:$F892 PRG:3892 D0 01 rts ; CPU:$F894 PRG:3894 60 ;=============================================================================== ; Routine: SetActorSpriteIndex16_Loop_2 ; Global: The routine calls UpdateSoundChannels. ; Local: Executes 17 instructions: stores X to ZpF4; stores Y to ZpF5; loads A ; from Zp02,x; branches on equal to SetActorSpriteIndex16_Loop; calls UpdateSoundChannels; loads A ; from ZpF4; 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. ; ;=============================================================================== SetActorSpriteIndex16_Loop_2: tax ; CPU:$F895 PRG:3895 AA lda ZpF5 ; CPU:$F896 PRG:3896 A5 F5 clc ; CPU:$F898 PRG:3898 18 adc #$04 ; CPU:$F899 PRG:3899 69 04 tay ; CPU:$F89B PRG:389B A8 bcc SetActorSpriteIndex16_OnCarryClear ; CPU:$F89C PRG:389C 90 E2 ;=============================================================================== ; Routine: SetActorSpriteIndex16_OnNonnegative ; Global: The routine reads no RAM 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 Zp02,x; copies Y into A; loads X ; from ZpF5; compares X with $08; branches on equal to SetActorSpriteIndex16_Loop_3; ; loads A with $30. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp02, APUPULSE1CTRL. ; ;=============================================================================== SetActorSpriteIndex16_OnNonnegative: sty Zp02,x ; CPU:$F89E PRG:389E 94 02 tya ; CPU:$F8A0 PRG:38A0 98 ldx ZpF5 ; CPU:$F8A1 PRG:38A1 A6 F5 cpx #$08 ; CPU:$F8A3 PRG:38A3 E0 08 beq SetActorSpriteIndex16_Loop_3 ; CPU:$F8A5 PRG:38A5 F0 02 lda #$30 ; CPU:$F8A7 PRG:38A7 A9 30 ;=============================================================================== ; Routine: SetActorSpriteIndex16_Loop_3 ; Global: The routine reads no RAM 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 APUPULSE1CTRL,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, APUPULSE1CTRL. ; ;=============================================================================== SetActorSpriteIndex16_Loop_3: sta APUPULSE1CTRL,x ; CPU:$F8A9 PRG:38A9 9D 00 40 rts ; CPU:$F8AC PRG:38AC 60 ;=============================================================================== ; Routine: SetActorSpriteIndex16_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 22 instructions: stores Y to Zp02,x; copies Y into A; loads ; X from ZpF5; compares X with $08; branches on equal to SetActorSpriteIndex16_Loop_3; ; loads A with $30; 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. ; ;=============================================================================== SetActorSpriteIndex16_OnZero: iny ; CPU:$F8AD PRG:38AD C8 lda (ZpF6),y ; CPU:$F8AE PRG:38AE B1 F6 sta Zp03,x ; CPU:$F8B0 PRG:38B0 95 03 iny ; CPU:$F8B2 PRG:38B2 C8 lda (ZpF6),y ; CPU:$F8B3 PRG:38B3 B1 F6 sta Zp04,x ; CPU:$F8B5 PRG:38B5 95 04 iny ; CPU:$F8B7 PRG:38B7 C8 tya ; CPU:$F8B8 PRG:38B8 98 clc ; CPU:$F8B9 PRG:38B9 18 adc ZpF6 ; CPU:$F8BA PRG:38BA 65 F6 sta Zp06,x ; CPU:$F8BC PRG:38BC 95 06 lda #$00 ; CPU:$F8BE PRG:38BE A9 00 adc ZpF7 ; CPU:$F8C0 PRG:38C0 65 F7 sta Zp07,x ; CPU:$F8C2 PRG:38C2 95 07 ;=============================================================================== ; Routine: SetActorSpriteIndex16_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 24 instructions: stores Y to Zp02,x; copies Y into A; loads ; X from ZpF5; compares X with $08; branches on equal to SetActorSpriteIndex16_Loop_3; ; loads A with $30; 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. ; ;=============================================================================== SetActorSpriteIndex16_OnNonzero: lda #$01 ; CPU:$F8C4 PRG:38C4 A9 01 sta Zp00,x ; CPU:$F8C6 PRG:38C6 95 00 ;=============================================================================== ; Routine: UpdateSoundChannels ; Global: The routine reads $0310. ; Local: Executes 36 instructions: stores Y to Zp02,x; copies Y into A; loads ; X from ZpF5; compares X with $08; branches on equal to SetActorSpriteIndex16_Loop_3; ; loads A with $30; and 30 more instructions. ; Parameters: Reads $0310 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 RAM fields it writes. ; ;=============================================================================== UpdateSoundChannels: ldy #$00 ; CPU:$F8C8 PRG:38C8 A0 00 lda Zp03,x ; CPU:$F8CA PRG:38CA B5 03 sta ZpF6 ; CPU:$F8CC PRG:38CC 85 F6 lda Zp04,x ; CPU:$F8CE PRG:38CE B5 04 sta ZpF7 ; CPU:$F8D0 PRG:38D0 85 F7 dec Zp00,x ; CPU:$F8D2 PRG:38D2 D6 00 beq WriteSoundChannelRegisters_Loop_3 ; CPU:$F8D4 PRG:38D4 F0 1C lda $0310 ; CPU:$F8D6 PRG:38D6 AD 10 03 beq WriteSoundChannelRegisters_Loop_2 ; CPU:$F8D9 PRG:38D9 F0 14 lda Zp02,x ; CPU:$F8DB PRG:38DB B5 02 cmp #$16 ; CPU:$F8DD PRG:38DD C9 16 beq WriteSoundChannelRegisters_Loop ; CPU:$F8DF PRG:38DF F0 0D ;=============================================================================== ; Routine: WriteSoundChannelRegisters ; Global: The routine reads no RAM 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: increments Zp00,x; copies Y into A; stores A ; to Zp08,x; loads X from ZpF5; stores A to APUPULSE1TIMERLO,x; ; stores A to APUPULSE1TIMERHI,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, Zp00, Zp08, APUPULSE1TIMERLO, ; APUPULSE1TIMERHI. ; ;=============================================================================== WriteSoundChannelRegisters: inc Zp00,x ; CPU:$F8E1 PRG:38E1 F6 00 tya ; CPU:$F8E3 PRG:38E3 98 sta Zp08,x ; CPU:$F8E4 PRG:38E4 95 08 ldx ZpF5 ; CPU:$F8E6 PRG:38E6 A6 F5 sta APUPULSE1TIMERLO,x ; CPU:$F8E8 PRG:38E8 9D 02 40 sta APUPULSE1TIMERHI,x ; CPU:$F8EB PRG:38EB 9D 03 40 ;=============================================================================== ; Routine: WriteSoundChannelRegisters_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: 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. ; ;=============================================================================== WriteSoundChannelRegisters_Loop: rts ; CPU:$F8EE PRG:38EE 60 ;=============================================================================== ; Routine: WriteSoundChannelRegisters_Loop_2 ; Global: The routine calls CheckActorSoundState. ; Local: Executes 1 instruction: calls CheckActorSoundState. ; 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, Zp09, Zp0C, ZpF6, ZpF7, ; APUPULSE1CTRL. ; ;=============================================================================== WriteSoundChannelRegisters_Loop_2: jmp CheckActorSoundState ; CPU:$F8EF PRG:38EF 4C 75 F9 ;=============================================================================== ; Routine: WriteSoundChannelRegisters_Loop_3 ; Global: The routine calls CheckActorSoundState, reads $0310. ; Local: Executes 52 instructions: stores Y to Zp02,x; copies Y into A; loads ; X from ZpF5; compares X with $08; branches on equal to SetActorSpriteIndex16_Loop_3; ; loads A with $30; and 46 more instructions. ; Parameters: Reads $0310 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 RAM fields it writes. ; ;=============================================================================== WriteSoundChannelRegisters_Loop_3: lda (ZpF6),y ; CPU:$F8F2 PRG:38F2 B1 F6 cmp #$FD ; CPU:$F8F4 PRG:38F4 C9 FD bcc WriteSoundChannelRegisters_Loop_5 ; CPU:$F8F6 PRG:38F6 90 20 bne WriteSoundChannelRegisters_Loop_4 ; CPU:$F8F8 PRG:38F8 D0 08 lda Zp0A,x ; CPU:$F8FA PRG:38FA B5 0A ora #$80 ; CPU:$F8FC PRG:38FC 09 80 sta Zp0A,x ; CPU:$F8FE PRG:38FE 95 0A bne SetActorSpriteIndex16_OnZero ; CPU:$F900 PRG:3900 D0 AB ;=============================================================================== ; Routine: WriteSoundChannelRegisters_Loop_4 ; Global: The routine calls CheckActorSoundState, reads $0310. ; Local: Executes 63 instructions: stores Y to Zp02,x; copies Y into A; loads ; X from ZpF5; compares X with $08; branches on equal to SetActorSpriteIndex16_Loop_3; ; loads A with $30; and 57 more instructions. ; Parameters: Reads $0310 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 RAM fields it writes. ; ;=============================================================================== WriteSoundChannelRegisters_Loop_4: cmp #$FE ; CPU:$F902 PRG:3902 C9 FE beq SetActorSpriteIndex16_OnZero ; CPU:$F904 PRG:3904 F0 A7 lda Zp0A,x ; CPU:$F906 PRG:3906 B5 0A bpl SetActorSpriteIndex16_OnNonnegative ; CPU:$F908 PRG:3908 10 94 and #$7F ; CPU:$F90A PRG:390A 29 7F sta Zp0A,x ; CPU:$F90C PRG:390C 95 0A lda Zp06,x ; CPU:$F90E PRG:390E B5 06 sta Zp03,x ; CPU:$F910 PRG:3910 95 03 lda Zp07,x ; CPU:$F912 PRG:3912 B5 07 sta Zp04,x ; CPU:$F914 PRG:3914 95 04 bne SetActorSpriteIndex16_OnNonzero ; CPU:$F916 PRG:3916 D0 AC ;=============================================================================== ; Routine: WriteSoundChannelRegisters_Loop_5 ; Global: The routine calls ResumeSoundChannel. ; Local: Executes 4 instructions: loads A from Zp0A,x; ANDs A with $7F; ; branches on equal to WriteSoundChannelRegisters_Loop_6; calls ResumeSoundChannel. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== WriteSoundChannelRegisters_Loop_5: lda Zp0A,x ; CPU:$F918 PRG:3918 B5 0A and #$7F ; CPU:$F91A PRG:391A 29 7F beq WriteSoundChannelRegisters_Loop_6 ; CPU:$F91C PRG:391C F0 03 jmp ResumeSoundChannel ; CPU:$F91E PRG:391E 4C C9 F9 ;=============================================================================== ; Routine: WriteSoundChannelRegisters_Loop_6 ; Global: The routine reads no RAM 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 ((ZpF6),y); ANDs A with $F0; ; compares A with $20; branches on not equal to WriteSoundChannelRegisters_Loop_7; loads A ; from ((ZpF6),y); ANDs A with $0F; 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. ; ;=============================================================================== WriteSoundChannelRegisters_Loop_6: lda (ZpF6),y ; CPU:$F921 PRG:3921 B1 F6 and #$F0 ; CPU:$F923 PRG:3923 29 F0 cmp #$20 ; CPU:$F925 PRG:3925 C9 20 bne WriteSoundChannelRegisters_Loop_7 ; CPU:$F927 PRG:3927 D0 13 lda (ZpF6),y ; CPU:$F929 PRG:3929 B1 F6 and #$0F ; CPU:$F92B PRG:392B 29 0F sta Zp01,x ; CPU:$F92D PRG:392D 95 01 iny ; CPU:$F92F PRG:392F C8 lda (ZpF6),y ; CPU:$F930 PRG:3930 B1 F6 ldx ZpF5 ; CPU:$F932 PRG:3932 A6 F5 sta APUPULSE1CTRL,x ; CPU:$F934 PRG:3934 9D 00 40 ldx ZpF4 ; CPU:$F937 PRG:3937 A6 F4 sta Zp09,x ; CPU:$F939 PRG:3939 95 09 iny ; CPU:$F93B PRG:393B C8 ;=============================================================================== ; Routine: WriteSoundChannelRegisters_Loop_7 ; Global: The routine reads no RAM 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 Zp01,x; stores A to Zp00,x; ; loads A from Zp09,x; ANDs A with $10; branches on equal to ; WriteSoundChannelRegisters_Loop_9; loads A from Zp09,x; 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 RAM fields it writes. ; ;=============================================================================== WriteSoundChannelRegisters_Loop_7: lda Zp01,x ; CPU:$F93C PRG:393C B5 01 sta Zp00,x ; CPU:$F93E PRG:393E 95 00 lda Zp09,x ; CPU:$F940 PRG:3940 B5 09 and #$10 ; CPU:$F942 PRG:3942 29 10 beq WriteSoundChannelRegisters_Loop_9 ; CPU:$F944 PRG:3944 F0 1C lda Zp09,x ; CPU:$F946 PRG:3946 B5 09 and #$F0 ; CPU:$F948 PRG:3948 29 F0 sta Zp09,x ; CPU:$F94A PRG:394A 95 09 lda (ZpF6),y ; CPU:$F94C PRG:394C B1 F6 cmp #$F8 ; CPU:$F94E PRG:394E C9 F8 bne WriteSoundChannelRegisters_Loop_8 ; CPU:$F950 PRG:3950 D0 03 iny ; CPU:$F952 PRG:3952 C8 lda (ZpF6),y ; CPU:$F953 PRG:3953 B1 F6 ;=============================================================================== ; Routine: WriteSoundChannelRegisters_Loop_8 ; Global: The routine reads no RAM 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 a right; shifts a right; shifts a ; right; shifts a right; ORs A with Zp09,x; stores A to Zp09,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, C and V flags, the RAM fields it writes. ; ;=============================================================================== WriteSoundChannelRegisters_Loop_8: lsr a ; CPU:$F955 PRG:3955 4A lsr a ; CPU:$F956 PRG:3956 4A lsr a ; CPU:$F957 PRG:3957 4A lsr a ; CPU:$F958 PRG:3958 4A ora Zp09,x ; CPU:$F959 PRG:3959 15 09 sta Zp09,x ; CPU:$F95B PRG:395B 95 09 ldx ZpF5 ; CPU:$F95D PRG:395D A6 F5 sta APUPULSE1CTRL,x ; CPU:$F95F PRG:395F 9D 00 40 ;=============================================================================== ; Routine: WriteSoundChannelRegisters_Loop_9 ; Global: The routine calls ShiftActorValueRight_Loop and StoreActorValue. ; Local: Executes 9 instructions: loads A from ((ZpF6),y); ANDs A with $07; ; stores A to ZpF0; increments Y; loads A from ((ZpF6),y); stores A ; to ZpF1; 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 RAM fields it writes. ; ;=============================================================================== WriteSoundChannelRegisters_Loop_9: lda (ZpF6),y ; CPU:$F962 PRG:3962 B1 F6 and #$07 ; CPU:$F964 PRG:3964 29 07 sta ZpF0 ; CPU:$F966 PRG:3966 85 F0 iny ; CPU:$F968 PRG:3968 C8 lda (ZpF6),y ; CPU:$F969 PRG:3969 B1 F6 sta ZpF1 ; CPU:$F96B PRG:396B 85 F1 ldx ZpF4 ; CPU:$F96D PRG:396D A6 F4 jsr ShiftActorValueRight_Loop ; CPU:$F96F PRG:396F 20 80 FA jmp StoreActorValue ; CPU:$F972 PRG:3972 4C A9 FA ;=============================================================================== ; Routine: CheckActorSoundState ; Global: The routine reads no RAM 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 Zp0A,x; branches on not equal ; to CheckActorSoundState_Loop; 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, Zp09, Zp0C, ZpF6, ZpF7, ; APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState: lda Zp0A,x ; CPU:$F975 PRG:3975 B5 0A bne CheckActorSoundState_Loop ; CPU:$F977 PRG:3977 D0 01 rts ; CPU:$F979 PRG:3979 60 ;=============================================================================== ; Routine: CheckActorSoundState_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 4 instructions: loads A from ZpF5; compares A with $08; ; branches on not equal to CheckActorSoundState_Loop_2; 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, Zp09, Zp0C, ZpF6, ZpF7, ; APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState_Loop: lda ZpF5 ; CPU:$F97A PRG:397A A5 F5 cmp #$08 ; CPU:$F97C PRG:397C C9 08 bne CheckActorSoundState_Loop_2; CPU:$F97E PRG:397E D0 01 rts ; CPU:$F980 PRG:3980 60 ;=============================================================================== ; Routine: CheckActorSoundState_Loop_2 ; Global: The routine reads no RAM 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 ZpF6; branches on not equal to ; CheckActorSoundState_Loop_3; decrements ZpF7. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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, Zp09, Zp0C, ZpF6, ZpF7, ; APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState_Loop_2: lda ZpF6 ; CPU:$F981 PRG:3981 A5 F6 bne CheckActorSoundState_Loop_3; CPU:$F983 PRG:3983 D0 02 dec ZpF7 ; CPU:$F985 PRG:3985 C6 F7 ;=============================================================================== ; Routine: CheckActorSoundState_Loop_3 ; Global: The routine reads no RAM 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: decrements ZpF6; loads Y with $00; loads A ; from ((ZpF6),y); ANDs A with $F0; compares A with $C0; branches on ; not equal to CheckActorSoundState_Loop_4; 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, Zp09, Zp0C, ZpF6, APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState_Loop_3: dec ZpF6 ; CPU:$F987 PRG:3987 C6 F6 ldy #$00 ; CPU:$F989 PRG:3989 A0 00 lda (ZpF6),y ; CPU:$F98B PRG:398B B1 F6 and #$F0 ; CPU:$F98D PRG:398D 29 F0 cmp #$C0 ; CPU:$F98F PRG:398F C9 C0 bne CheckActorSoundState_Loop_4; CPU:$F991 PRG:3991 D0 01 rts ; CPU:$F993 PRG:3993 60 ;=============================================================================== ; Routine: CheckActorSoundState_Loop_4 ; Global: The routine reads no RAM 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 Zp09,x; ANDs A with $10; ; branches on not equal to CheckActorSoundState_Loop_5; 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, Zp09, Zp0C, APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState_Loop_4: lda Zp09,x ; CPU:$F994 PRG:3994 B5 09 and #$10 ; CPU:$F996 PRG:3996 29 10 bne CheckActorSoundState_Loop_5; CPU:$F998 PRG:3998 D0 01 rts ; CPU:$F99A PRG:399A 60 ;=============================================================================== ; Routine: CheckActorSoundState_Loop_5 ; Global: The routine reads no RAM 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 Zp0C,x; sets the carry flag; ; subtracts $01 from A; stores A to Zp0C,x; compares A with Zp00,x; ; branches on not equal to CheckActorSoundState_Loop_6; 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 X, the N, Z, C and V flags, Zp09, Zp0C, APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState_Loop_5: lda Zp0C,x ; CPU:$F99B PRG:399B B5 0C sec ; CPU:$F99D PRG:399D 38 sbc #$01 ; CPU:$F99E PRG:399E E9 01 sta Zp0C,x ; CPU:$F9A0 PRG:39A0 95 0C cmp Zp00,x ; CPU:$F9A2 PRG:39A2 D5 00 bne CheckActorSoundState_Loop_6; CPU:$F9A4 PRG:39A4 D0 08 sec ; CPU:$F9A6 PRG:39A6 38 sbc Zp10,x ; CPU:$F9A7 PRG:39A7 F5 10 bcc CheckActorSoundState_Loop_7; CPU:$F9A9 PRG:39A9 90 08 beq CheckActorSoundState_Loop_7; CPU:$F9AB PRG:39AB F0 06 rts ; CPU:$F9AD PRG:39AD 60 ;=============================================================================== ; Routine: CheckActorSoundState_Loop_6 ; Global: The routine reads no RAM 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; subtracts $01 from A; ; stores A to Zp0C,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, C and V flags, Zp09, Zp0C, APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState_Loop_6: sec ; CPU:$F9AE PRG:39AE 38 sbc #$01 ; CPU:$F9AF PRG:39AF E9 01 sta Zp0C,x ; CPU:$F9B1 PRG:39B1 95 0C ;=============================================================================== ; Routine: CheckActorSoundState_Loop_7 ; Global: The routine reads no RAM 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 Zp09,x; ANDs A with $0F; sets ; the carry flag; subtracts $01 from A; branches on non-negative to ; CheckActorSoundState_Loop_8; 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, Zp09, APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState_Loop_7: lda Zp09,x ; CPU:$F9B3 PRG:39B3 B5 09 and #$0F ; CPU:$F9B5 PRG:39B5 29 0F sec ; CPU:$F9B7 PRG:39B7 38 sbc #$01 ; CPU:$F9B8 PRG:39B8 E9 01 bpl CheckActorSoundState_Loop_8; CPU:$F9BA PRG:39BA 10 01 rts ; CPU:$F9BC PRG:39BC 60 ;=============================================================================== ; Routine: CheckActorSoundState_Loop_8 ; Global: The routine reads no RAM 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 Zp09,x; subtracts $01 from A; ; stores A to Zp09,x; loads X from ZpF5; stores A to APUPULSE1CTRL,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 X, the N, Z, C and V flags, Zp09, APUPULSE1CTRL. ; ;=============================================================================== CheckActorSoundState_Loop_8: lda Zp09,x ; CPU:$F9BD PRG:39BD B5 09 sbc #$01 ; CPU:$F9BF PRG:39BF E9 01 sta Zp09,x ; CPU:$F9C1 PRG:39C1 95 09 ldx ZpF5 ; CPU:$F9C3 PRG:39C3 A6 F5 sta APUPULSE1CTRL,x ; CPU:$F9C5 PRG:39C5 9D 00 40 rts ; CPU:$F9C8 PRG:39C8 60 ;=============================================================================== ; Routine: ResumeSoundChannel ; Global: The routine calls WriteSoundChannelRegisters, reads $0310. ; Local: Executes 3 instructions: loads A from $0310; branches on equal to ; ResumeSoundChannel_Loop; calls WriteSoundChannelRegisters. ; Parameters: Reads $0310 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. ; ;=============================================================================== ResumeSoundChannel: lda $0310 ; CPU:$F9C9 PRG:39C9 AD 10 03 beq ResumeSoundChannel_Loop ; CPU:$F9CC PRG:39CC F0 03 jmp WriteSoundChannelRegisters ; CPU:$F9CE PRG:39CE 4C E1 F8 ;=============================================================================== ; Routine: ResumeSoundChannel_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 26 instructions: loads A from ((ZpF6),y); ANDs A with $F0; ; compares A with $D0; branches on not equal to ResumeSoundChannel_Loop_2; loads A ; from ((ZpF6),y); ANDs A with $0F; 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. ; Clobbers: ; A, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== ResumeSoundChannel_Loop: lda (ZpF6),y ; CPU:$F9D1 PRG:39D1 B1 F6 and #$F0 ; CPU:$F9D3 PRG:39D3 29 F0 cmp #$D0 ; CPU:$F9D5 PRG:39D5 C9 D0 bne ResumeSoundChannel_Loop_2 ; CPU:$F9D7 PRG:39D7 D0 26 lda (ZpF6),y ; CPU:$F9D9 PRG:39D9 B1 F6 and #$0F ; CPU:$F9DB PRG:39DB 29 0F sta Zp0D,x ; CPU:$F9DD PRG:39DD 95 0D iny ; CPU:$F9DF PRG:39DF C8 lda (ZpF6),y ; CPU:$F9E0 PRG:39E0 B1 F6 sta Zp05,x ; CPU:$F9E2 PRG:39E2 95 05 ldx ZpF5 ; CPU:$F9E4 PRG:39E4 A6 F5 sta APUPULSE1CTRL,x ; CPU:$F9E6 PRG:39E6 9D 00 40 iny ; CPU:$F9E9 PRG:39E9 C8 cpx #$08 ; CPU:$F9EA PRG:39EA E0 08 beq ResumeSoundChannel_Loop_3 ; CPU:$F9EC PRG:39EC F0 24 lda (ZpF6),y ; CPU:$F9EE PRG:39EE B1 F6 lsr a ; CPU:$F9F0 PRG:39F0 4A lsr a ; CPU:$F9F1 PRG:39F1 4A lsr a ; CPU:$F9F2 PRG:39F2 4A lsr a ; CPU:$F9F3 PRG:39F3 4A ldx ZpF4 ; CPU:$F9F4 PRG:39F4 A6 F4 sta Zp0F,x ; CPU:$F9F6 PRG:39F6 95 0F lda (ZpF6),y ; CPU:$F9F8 PRG:39F8 B1 F6 and #$0F ; CPU:$F9FA PRG:39FA 29 0F sta Zp10,x ; CPU:$F9FC PRG:39FC 95 10 iny ; CPU:$F9FE PRG:39FE C8 ;=============================================================================== ; Routine: ResumeSoundChannel_Loop_2 ; Global: The routine reads no RAM 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 X from ZpF5; compares X with $08; ; branches on equal to ResumeSoundChannel_Loop_3; loads A from ((ZpF6),y); compares A ; with $F0; branches on not equal to ResumeSoundChannel_Loop_3; 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. ; ;=============================================================================== ResumeSoundChannel_Loop_2: ldx ZpF5 ; CPU:$F9FF PRG:39FF A6 F5 cpx #$08 ; CPU:$FA01 PRG:3A01 E0 08 beq ResumeSoundChannel_Loop_3 ; CPU:$FA03 PRG:3A03 F0 0D lda (ZpF6),y ; CPU:$FA05 PRG:3A05 B1 F6 cmp #$F0 ; CPU:$FA07 PRG:3A07 C9 F0 bne ResumeSoundChannel_Loop_3 ; CPU:$FA09 PRG:3A09 D0 07 iny ; CPU:$FA0B PRG:3A0B C8 lda (ZpF6),y ; CPU:$FA0C PRG:3A0C B1 F6 sta APUPULSE1SWEEP,x ; CPU:$FA0E PRG:3A0E 9D 01 40 iny ; CPU:$FA11 PRG:3A11 C8 ;=============================================================================== ; Routine: ResumeSoundChannel_Loop_3 ; Global: The routine reads no RAM 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 ((ZpF6),y); ANDs A with $F0; ; compares A with $E0; branches on not equal to ResumeSoundChannel_Loop_4; loads A ; from ((ZpF6),y); ANDs A with $0F; 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. ; ;=============================================================================== ResumeSoundChannel_Loop_3: lda (ZpF6),y ; CPU:$FA12 PRG:3A12 B1 F6 and #$F0 ; CPU:$FA14 PRG:3A14 29 F0 cmp #$E0 ; CPU:$FA16 PRG:3A16 C9 E0 bne ResumeSoundChannel_Loop_4 ; CPU:$FA18 PRG:3A18 D0 09 lda (ZpF6),y ; CPU:$FA1A PRG:3A1A B1 F6 and #$0F ; CPU:$FA1C PRG:3A1C 29 0F ldx ZpF4 ; CPU:$FA1E PRG:3A1E A6 F4 sta Zp0B,x ; CPU:$FA20 PRG:3A20 95 0B iny ; CPU:$FA22 PRG:3A22 C8 ;=============================================================================== ; Routine: ResumeSoundChannel_Loop_4 ; Global: The routine calls StoreActorValue. ; Local: Executes 8 instructions: calls StoreActorValue; decrements Y; loads A from ; ((ZpF6),y); ANDs A with $0F; stores A to ZpF0; branches on equal to ; ResumeSoundChannel_Loop_5; 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. ; ;=============================================================================== ResumeSoundChannel_Loop_4: jsr StoreActorValue ; CPU:$FA23 PRG:3A23 20 A9 FA dey ; CPU:$FA26 PRG:3A26 88 lda (ZpF6),y ; CPU:$FA27 PRG:3A27 B1 F6 and #$0F ; CPU:$FA29 PRG:3A29 29 0F sta ZpF0 ; CPU:$FA2B PRG:3A2B 85 F0 beq ResumeSoundChannel_Loop_5 ; CPU:$FA2D PRG:3A2D F0 0B lda Zp0D,x ; CPU:$FA2F PRG:3A2F B5 0D clc ; CPU:$FA31 PRG:3A31 18 ;=============================================================================== ; Routine: ResumeSoundChannel_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 4 instructions: adds Zp0D,x to A; decrements ZpF0; branches ; on not equal to ResumeSoundChannel_OnNonzero; branches on equal to ResumeSoundChannel_Loop_6. ; Parameters: Takes its input from the registers and the immediate values in ; the code; it reads no zero-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. ; ;=============================================================================== ResumeSoundChannel_OnNonzero: adc Zp0D,x ; CPU:$FA32 PRG:3A32 75 0D dec ZpF0 ; CPU:$FA34 PRG:3A34 C6 F0 bne ResumeSoundChannel_OnNonzero ; CPU:$FA36 PRG:3A36 D0 FA beq ResumeSoundChannel_Loop_6 ; CPU:$FA38 PRG:3A38 F0 02 ;=============================================================================== ; Routine: ResumeSoundChannel_Loop_5 ; Global: The routine reads no RAM 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 Zp0D,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 RAM fields it writes. ; ;=============================================================================== ResumeSoundChannel_Loop_5: lda Zp0D,x ; CPU:$FA3A PRG:3A3A B5 0D ;=============================================================================== ; Routine: ResumeSoundChannel_Loop_6 ; Global: The routine reads no RAM 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 A to Zp00,x; clears the carry flag; ; adds Zp0F,x to A; stores A to Zp0C,x; loads A from Zp05,x; stores A ; to Zp09,x; 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, X and Y, the N, Z, C and V flags, the RAM fields it writes. ; ;=============================================================================== ResumeSoundChannel_Loop_6: sta Zp00,x ; CPU:$FA3C PRG:3A3C 95 00 clc ; CPU:$FA3E PRG:3A3E 18 adc Zp0F,x ; CPU:$FA3F PRG:3A3F 75 0F sta Zp0C,x ; CPU:$FA41 PRG:3A41 95 0C lda Zp05,x ; CPU:$FA43 PRG:3A43 B5 05 sta Zp09,x ; CPU:$FA45 PRG:3A45 95 09 ldx ZpF5 ; CPU:$FA47 PRG:3A47 A6 F5 sta APUPULSE1CTRL,x ; CPU:$FA49 PRG:3A49 9D 00 40 lda (ZpF6),y ; CPU:$FA4C PRG:3A4C B1 F6 lsr a ; CPU:$FA4E PRG:3A4E 4A lsr a ; CPU:$FA4F PRG:3A4F 4A lsr a ; CPU:$FA50 PRG:3A50 4A lsr a ; CPU:$FA51 PRG:3A51 4A cmp #$0C ; CPU:$FA52 PRG:3A52 C9 0C bne ResumeSoundChannel_Loop_8 ; CPU:$FA54 PRG:3A54 D0 0C lda #$00 ; CPU:$FA56 PRG:3A56 A9 00 cpx #$08 ; CPU:$FA58 PRG:3A58 E0 08 beq ResumeSoundChannel_Loop_7 ; CPU:$FA5A PRG:3A5A F0 02 lda #$30 ; CPU:$FA5C PRG:3A5C A9 30 ;=============================================================================== ; Routine: ResumeSoundChannel_Loop_7 ; Global: The routine reads no RAM 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 APUPULSE1CTRL,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, APUPULSE1CTRL. ; ;=============================================================================== ResumeSoundChannel_Loop_7: sta APUPULSE1CTRL,x ; CPU:$FA5E PRG:3A5E 9D 00 40 rts ; CPU:$FA61 PRG:3A61 60 ;=============================================================================== ; Routine: ResumeSoundChannel_Loop_8 ; Global: The routine reads no RAM 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 ZpF4; shifts a left; copies A ; into Y; loads A from $FABB,y; stores A to ZpF0; increments 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 and C flags, Zp08, ZpF0, ZpF1, APUPULSE1TIMERLO, ; APUPULSE1TIMERHI. ; ;=============================================================================== ResumeSoundChannel_Loop_8: ldx ZpF4 ; CPU:$FA62 PRG:3A62 A6 F4 asl a ; CPU:$FA64 PRG:3A64 0A tay ; CPU:$FA65 PRG:3A65 A8 lda $FABB,y ; CPU:$FA66 PRG:3A66 B9 BB FA sta ZpF0 ; CPU:$FA69 PRG:3A69 85 F0 iny ; CPU:$FA6B PRG:3A6B C8 lda $FABB,y ; CPU:$FA6C PRG:3A6C B9 BB FA sta ZpF1 ; CPU:$FA6F PRG:3A6F 85 F1 ldy Zp0B,x ; CPU:$FA71 PRG:3A71 B4 0B ;=============================================================================== ; Routine: ShiftActorValueRight ; Global: The routine calls ShiftActorValueRight. ; Local: Executes 7 instructions: copies Y into A; compares A with $04; ; branches on equal to ShiftActorValueRight_Loop; shifts ZpF0 right; rotates ZpF1 ; right; increments 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 and C flags, Zp08, ZpF0, ZpF1, APUPULSE1TIMERLO, ; APUPULSE1TIMERHI. ; ;=============================================================================== ShiftActorValueRight: tya ; CPU:$FA73 PRG:3A73 98 cmp #$04 ; CPU:$FA74 PRG:3A74 C9 04 beq ShiftActorValueRight_Loop ; CPU:$FA76 PRG:3A76 F0 08 lsr ZpF0 ; CPU:$FA78 PRG:3A78 46 F0 ror ZpF1 ; CPU:$FA7A PRG:3A7A 66 F1 iny ; CPU:$FA7C PRG:3A7C C8 jmp ShiftActorValueRight ; CPU:$FA7D PRG:3A7D 4C 73 FA ;=============================================================================== ; Routine: ShiftActorValueRight_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 12 instructions: loads A from ZpF0; ORs A with $08; stores A ; to ZpF0; compares A with Zp08,x; branches on not equal to ShiftActorValueRight_Loop_2; ; loads A from Zp09,x; 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, Zp08, ZpF0, APUPULSE1TIMERLO, ; APUPULSE1TIMERHI. ; ;=============================================================================== ShiftActorValueRight_Loop: lda ZpF0 ; CPU:$FA80 PRG:3A80 A5 F0 ora #$08 ; CPU:$FA82 PRG:3A82 09 08 sta ZpF0 ; CPU:$FA84 PRG:3A84 85 F0 cmp Zp08,x ; CPU:$FA86 PRG:3A86 D5 08 bne ShiftActorValueRight_Loop_2; CPU:$FA88 PRG:3A88 D0 0E lda Zp09,x ; CPU:$FA8A PRG:3A8A B5 09 and #$10 ; CPU:$FA8C PRG:3A8C 29 10 beq ShiftActorValueRight_Loop_3; CPU:$FA8E PRG:3A8E F0 0A ldx ZpF5 ; CPU:$FA90 PRG:3A90 A6 F5 cpx #$08 ; CPU:$FA92 PRG:3A92 E0 08 beq ShiftActorValueRight_Loop_3; CPU:$FA94 PRG:3A94 F0 04 bne ShiftActorValueRight_Loop_4; CPU:$FA96 PRG:3A96 D0 09 ;=============================================================================== ; Routine: ShiftActorValueRight_Loop_2 ; Global: The routine reads no RAM 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 Zp08,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, Zp08, APUPULSE1TIMERLO, APUPULSE1TIMERHI. ; ;=============================================================================== ShiftActorValueRight_Loop_2: sta Zp08,x ; CPU:$FA98 PRG:3A98 95 08 ;=============================================================================== ; Routine: ShiftActorValueRight_Loop_3 ; Global: The routine reads no RAM 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 ZpF0; loads X from ZpF5; stores ; A to APUPULSE1TIMERHI,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, APUPULSE1TIMERLO, APUPULSE1TIMERHI. ; ;=============================================================================== ShiftActorValueRight_Loop_3: lda ZpF0 ; CPU:$FA9A PRG:3A9A A5 F0 ldx ZpF5 ; CPU:$FA9C PRG:3A9C A6 F5 sta APUPULSE1TIMERHI,x ; CPU:$FA9E PRG:3A9E 9D 03 40 ;=============================================================================== ; Routine: ShiftActorValueRight_Loop_4 ; Global: The routine reads no RAM 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 X from ZpF5; loads A from ZpF1; stores ; A to APUPULSE1TIMERLO,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 X, the N and Z flags, APUPULSE1TIMERLO. ; ;=============================================================================== ShiftActorValueRight_Loop_4: ldx ZpF5 ; CPU:$FAA1 PRG:3AA1 A6 F5 lda ZpF1 ; CPU:$FAA3 PRG:3AA3 A5 F1 sta APUPULSE1TIMERLO,x ; CPU:$FAA5 PRG:3AA5 9D 02 40 rts ; CPU:$FAA8 PRG:3AA8 60 ;=============================================================================== ; Routine: StoreActorValue ; Global: The routine reads no RAM 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: increments Y; copies Y into A; clears the ; carry flag; adds ZpF6 to A; loads X from ZpF4; stores A to Zp03,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, X and Y, the N, Z, C and V flags, Zp03, Zp04. ; ;=============================================================================== StoreActorValue: iny ; CPU:$FAA9 PRG:3AA9 C8 tya ; CPU:$FAAA PRG:3AAA 98 clc ; CPU:$FAAB PRG:3AAB 18 adc ZpF6 ; CPU:$FAAC PRG:3AAC 65 F6 ldx ZpF4 ; CPU:$FAAE PRG:3AAE A6 F4 sta Zp03,x ; CPU:$FAB0 PRG:3AB0 95 03 bcc StoreActorValue_Loop ; CPU:$FAB2 PRG:3AB2 90 06 lda ZpF7 ; CPU:$FAB4 PRG:3AB4 A5 F7 adc #$00 ; CPU:$FAB6 PRG:3AB6 69 00 sta Zp04,x ; CPU:$FAB8 PRG:3AB8 95 04 ;=============================================================================== ; Routine: StoreActorValue_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: 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. ; ;=============================================================================== StoreActorValue_Loop: rts ; CPU:$FABA PRG:3ABA 60 ; ---- data $FABB-$FAD6 (28 bytes) ---- ; referenced by `lda $FAD1,y` at $F83D (operand $FAD1 falls inside this region) ; referenced by `lda $FAD2,y` at $F844 (operand $FAD2 falls inside this region) ; referenced by `lda $FABB,y` at $FA66 (operand $FABB falls inside this region) ; referenced by `lda $FABB,y` at $FA6C (operand $FABB falls inside this region) SoundSequencePointerTable: .byte $06, $AE, $06, $4E, $05, $F4, $05, $9E, $05, $4E, $05, $01, $04, $B9, $04, $76 ; CPU:$FABB PRG:3ABB 06 AE 06 4E 05 F4 05 9E 05 4E 05 01 04 B9 04 76 .byte $04, $36, $03, $F9, $03, $C0 ; CPU:$FACB PRG:3ACB 04 36 03 F9 03 C0 SoundNotePeriodTable: .byte $03, $8A, $18, $FB, $37, $FB ; CPU:$FAD1 PRG:3AD1 03 8A 18 FB 37 FB .byte $4C, $FB, $FF ; CPU:$FAD7 PRG:3AD7 4C FB FF -- data, not a call ; ---- data $FADA-$FFFC (1315 bytes) ---- ; referenced by `lda $FEFA,x` at $C578 (operand $FEFA falls inside this region) ; referenced by `jmp $FFFB` at $FAD7 (operand $FFFB falls inside this region) .byte $FA, $5F, $FB, $7E, $FB, $91, $FB, $98, $FB, $D1, $FB, $DC, $FB, $ED, $FB, $08 ; CPU:$FADA PRG:3ADA FA 5F FB 7E FB 91 FB 98 FB D1 FB DC FB ED FB 08 .byte $FC, $23, $FC, $31, $FC, $3F, $FD, $A5, $FD, $25, $FE, $BF, $FE, $18, $FF, $B1 ; CPU:$FAEA PRG:3AEA FC 23 FC 31 FC 3F FD A5 FD 25 FE BF FE 18 FF B1 .byte $FC, $DD, $FC, $A0, $FC, $24, $B0, $E0, $60, $F0, $50, $F0, $40, $F0, $30, $E0 ; CPU:$FAFA PRG:3AFA FC DD FC A0 FC 24 B0 E0 60 F0 50 F0 40 F0 30 E0 .byte $20, $00, $00, $A0, $20, $00, $00, $70, $20, $00, $00, $30, $20, $FF, $21, $B0 ; CPU:$FB0A PRG:3B0A 20 00 00 A0 20 00 00 70 20 00 00 30 20 FF 21 B0 .byte $F1, $70, $F1, $50, $F1, $50, $F1, $78, $C1, $70, $C1, $58, $91, $70, $81, $70 ; CPU:$FB1A PRG:3B1A F1 70 F1 50 F1 50 F1 78 C1 70 C1 58 91 70 81 70 .byte $91, $60, $81, $48, $A1, $38, $91, $4B, $71, $2B, $51, $28, $FF, $23, $70, $F0 ; CPU:$FB2A PRG:3B2A 91 60 81 48 A1 38 91 4B 71 2B 51 28 FF 23 70 F0 .byte $87, $D0, $78, $24, $B0, $F0, $87, $D0, $6C, $D0, $5B, $22, $B0, $C0, $55, $B0 ; CPU:$FB3A PRG:3B3A 87 D0 78 24 B0 F0 87 D0 6C D0 5B 22 B0 C0 55 B0 .byte $4F, $FF, $21, $B0, $F0, $D0, $F0, $C0, $F0, $B0, $F0, $98, $F0, $88, $F0, $78 ; CPU:$FB4A PRG:3B4A 4F FF 21 B0 F0 D0 F0 C0 F0 B0 F0 98 F0 88 F0 78 .byte $C0, $6C, $B0, $58, $FF, $23, $B0, $00, $00, $00, $00, $23, $8F, $00, $6A, $00 ; CPU:$FB5A PRG:3B5A C0 6C B0 58 FF 23 B0 00 00 00 00 23 8F 00 6A 00 .byte $47, $00, $3F, $22, $B0, $F0, $38, $A0, $35, $F0, $2F, $21, $86, $00, $2A, $00 ; CPU:$FB6A PRG:3B6A 47 00 3F 22 B0 F0 38 A0 35 F0 2F 21 86 00 2A 00 .byte $28, $00, $23, $FF, $24, $E4, $D0, $8E, $F0, $6A, $F0, $54, $F0, $47, $D0, $8E ; CPU:$FB7A PRG:3B7A 28 00 23 FF 24 E4 D0 8E F0 6A F0 54 F0 47 D0 8E .byte $F0, $6A, $F0, $54, $F0, $47, $FF, $21, $70, $F0, $39, $D0, $4A, $FF, $21, $B0 ; CPU:$FB8A PRG:3B8A F0 6A F0 54 F0 47 FF 21 70 F0 39 D0 4A FF 21 B0 .byte $F0, $40, $F0, $43, $F0, $45, $F0, $55, $F0, $55, $F0, $5A, $F0, $60, $F0, $65 ; CPU:$FB9A PRG:3B9A F0 40 F0 43 F0 45 F0 55 F0 55 F0 5A F0 60 F0 65 .byte $F0, $6A, $F0, $70, $F0, $78, $F0, $80, $F0, $88, $F0, $90, $F0, $98, $F0, $A0 ; CPU:$FBAA PRG:3BAA F0 6A F0 70 F0 78 F0 80 F0 88 F0 90 F0 98 F0 A0 .byte $F0, $AA, $F0, $B5, $F0, $C0, $F0, $D0, $F0, $E0, $F0, $F0, $F1, $00, $F1, $10 ; CPU:$FBBA PRG:3BBA F0 AA F0 B5 F0 C0 F0 D0 F0 E0 F0 F0 F1 00 F1 10 .byte $F1, $28, $F1, $40, $F1, $60, $FF, $23, $70, $F2, $50, $00, $00, $22, $B0, $F1 ; CPU:$FBCA PRG:3BCA F1 28 F1 40 F1 60 FF 23 70 F2 50 00 00 22 B0 F1 .byte $F0, $FF, $23, $30, $F0, $0A, $00, $00, $22, $30, $F0, $0D, $2F, $30, $00, $00 ; CPU:$FBDA PRG:3BDA F0 FF 23 30 F0 0A 00 00 22 30 F0 0D 2F 30 00 00 .byte $00, $00, $FF, $D4, $46, $22, $E0, $01, $21, $01, $D6, $46, $22, $E1, $72, $40 ; CPU:$FBEA PRG:3BEA 00 00 FF D4 46 22 E0 01 21 01 D6 46 22 E1 72 40 .byte $02, $50, $42, $00, $E2, $91, $C1, $B1, $C1, $F0, $9C, $E1, $03, $FF, $D4, $46 ; CPU:$FBFA PRG:3BFA 02 50 42 00 E2 91 C1 B1 C1 F0 9C E1 03 FF D4 46 .byte $22, $E1, $01, $21, $01, $D6, $46, $22, $E2, $72, $40, $02, $50, $42, $00, $E3 ; CPU:$FC0A PRG:3C0A 22 E1 01 21 01 D6 46 22 E2 72 40 02 50 42 00 E3 .byte $91, $C1, $B1, $C1, $F0, $94, $E1, $03, $FF, $D6, $20, $E2, $43, $43, $03, $03 ; CPU:$FC1A PRG:3C1A 91 C1 B1 C1 F0 94 E1 03 FF D6 20 E2 43 43 03 03 .byte $E3, $91, $C1, $71, $C1, $03, $FF, $FD, $86, $FC, $61, $71, $70, $60, $41, $71 ; CPU:$FC2A PRG:3C2A E3 91 C1 71 C1 03 FF FD 86 FC 61 71 70 60 41 71 .byte $61, $60, $40, $21, $61, $41, $E2, $B1, $E1, $11, $21, $43, $C1, $FD, $86, $FC ; CPU:$FC3A PRG:3C3A 61 60 40 21 61 41 E2 B1 E1 11 21 43 C1 FD 86 FC .byte $21, $B1, $91, $71, $61, $41, $21, $11, $21, $41, $60, $70, $61, $41, $21, $E2 ; CPU:$FC4A PRG:3C4A 21 B1 91 71 61 41 21 11 21 41 60 70 61 41 21 E2 .byte $90, $B0, $E1, $10, $20, $40, $60, $71, $71, $71, $71, $70, $60, $73, $81, $91 ; CPU:$FC5A PRG:3C5A 90 B0 E1 10 20 40 60 71 71 71 71 70 60 73 81 91 .byte $91, $90, $70, $60, $70, $95, $91, $B1, $B1, $E0, $22, $E1, $B0, $91, $91, $90 ; CPU:$FC6A PRG:3C6A 91 90 70 60 70 95 91 B1 B1 E0 22 E1 B0 91 91 90 .byte $70, $61, $71, $71, $11, $41, $21, $21, $21, $FE, $31, $FC, $E2, $B0, $E1, $10 ; CPU:$FC7A PRG:3C7A 70 61 71 71 11 41 21 21 21 FE 31 FC E2 B0 E1 10 .byte $21, $21, $20, $10, $20, $40, $61, $61, $60, $50, $60, $70, $91, $91, $90, $80 ; CPU:$FC8A PRG:3C8A 21 21 20 10 20 40 61 61 60 50 60 70 91 91 90 80 .byte $90, $E0, $20, $E1, $95, $FF, $25, $48, $00, $A0, $00, $86, $00, $71, $00, $86 ; CPU:$FC9A PRG:3C9A 90 E0 20 E1 95 FF 25 48 00 A0 00 86 00 71 00 86 .byte $00, $71, $2F, $42, $00, $55, $FF, $27, $B0, $00, $00, $FD, $BC, $FC, $FD, $BC ; CPU:$FCAA PRG:3CAA 00 71 2F 42 00 55 FF 27 B0 00 00 FD BC FC FD BC .byte $FC, $FF, $26, $B0, $50, $21, $60, $20, $70, $21, $60, $20, $2F, $B0, $00, $00 ; CPU:$FCBA PRG:3CBA FC FF 26 B0 50 21 60 20 70 21 60 20 2F B0 00 00 .byte $26, $B0, $50, $21, $60, $20, $50, $21, $40, $20, $2F, $B0, $00, $00, $00, $00 ; CPU:$FCCA PRG:3CCA 26 B0 50 21 60 20 50 21 40 20 2F B0 00 00 00 00 .byte $00, $00, $FF, $25, $30, $30, $07, $40, $08, $50, $07, $60, $08, $70, $07, $90 ; CPU:$FCDA PRG:3CDA 00 00 FF 25 30 30 07 40 08 50 07 60 08 70 07 90 .byte $08, $B0, $07, $C0, $08, $C0, $07, $D0, $07, $D0, $08, $D0, $07, $E0, $08, $E0 ; CPU:$FCEA PRG:3CEA 08 B0 07 C0 08 C0 07 D0 07 D0 08 D0 07 E0 08 E0 .byte $07, $E0, $08, $E0, $07, $E0, $08, $E0, $07, $E0, $08, $D0, $07, $D0, $08, $D0 ; CPU:$FCFA PRG:3CFA 07 E0 08 E0 07 E0 08 E0 07 E0 08 D0 07 D0 08 D0 .byte $07, $D0, $08, $D0, $07, $E0, $08, $E0, $07, $E0, $08, $E0, $07, $D0, $08, $C0 ; CPU:$FD0A PRG:3D0A 07 D0 08 D0 07 E0 08 E0 07 E0 08 E0 07 D0 08 C0 .byte $08, $C0, $08, $B0, $07, $B0, $08, $A0, $07, $A0, $08, $A0, $07, $A0, $08, $A0 ; CPU:$FD1A PRG:3D1A 08 C0 08 B0 07 B0 08 A0 07 A0 08 A0 07 A0 08 A0 .byte $07, $90, $08, $80, $07, $80, $08, $70, $07, $60, $08, $50, $07, $40, $08, $30 ; CPU:$FD2A PRG:3D2A 07 90 08 80 07 80 08 70 07 60 08 50 07 40 08 30 .byte $07, $F8, $20, $08, $FF, $E2, $C1, $FD, $95, $FD, $21, $91, $11, $91, $11, $91 ; CPU:$FD3A PRG:3D3A 07 F8 20 08 FF E2 C1 FD 95 FD 21 91 11 91 11 91 .byte $21, $91, $21, $91, $E3, $B1, $E2, $81, $41, $81, $91, $90, $70, $61, $41, $FD ; CPU:$FD4A PRG:3D4A 21 91 21 91 E3 B1 E2 81 41 81 91 90 70 61 41 FD .byte $95, $FD, $21, $21, $71, $61, $41, $21, $11, $E3, $B1, $91, $61, $73, $91, $E2 ; CPU:$FD5A PRG:3D5A 95 FD 21 21 71 61 41 21 11 E3 B1 91 61 73 91 E2 .byte $71, $61, $C5, $11, $91, $21, $91, $41, $91, $51, $91, $61, $91, $11, $91, $21 ; CPU:$FD6A PRG:3D6A 71 61 C5 11 91 21 91 41 91 51 91 61 91 11 91 21 .byte $90, $80, $91, $61, $71, $70, $90, $B1, $71, $61, $E1, $21, $E2, $21, $20, $30 ; CPU:$FD7A PRG:3D7A 90 80 91 61 71 70 90 B1 71 61 E1 21 E2 21 20 30 .byte $40, $50, $60, $70, $93, $61, $61, $61, $FE, $3F, $FD, $21, $91, $21, $91, $21 ; CPU:$FD8A PRG:3D8A 40 50 60 70 93 61 61 61 FE 3F FD 21 91 21 91 21 .byte $91, $21, $91, $21, $60, $50, $61, $91, $21, $91, $FF, $FD, $0F, $FE, $21, $10 ; CPU:$FD9A PRG:3D9A 91 21 91 21 60 50 61 91 21 91 FF FD 0F FE 21 10 .byte $20, $41, $01, $E2, $B1, $A1, $B1, $E1, $41, $26, $C0, $FD, $0F, $FE, $21, $01 ; CPU:$FDAA PRG:3DAA 20 41 01 E2 B1 A1 B1 E1 41 26 C0 FD 0F FE 21 01 .byte $E2, $B1, $91, $79, $C1, $70, $50, $40, $20, $43, $72, $70, $E1, $41, $01, $E2 ; CPU:$FDBA PRG:3DBA E2 B1 91 79 C1 70 50 40 20 43 72 70 E1 41 01 E2 .byte $71, $41, $91, $71, $51, $40, $57, $C0, $23, $52, $50, $E1, $21, $E2, $B1, $91 ; CPU:$FDCA PRG:3DCA 71 41 91 71 51 40 57 C0 23 52 50 E1 21 E2 B1 91 .byte $51, $41, $51, $61, $90, $74, $70, $50, $40, $20, $43, $72, $70, $E1, $71, $51 ; CPU:$FDDA PRG:3DDA 51 41 51 61 90 74 70 50 40 20 43 72 70 E1 71 51 .byte $41, $11, $41, $21, $11, $20, $E2, $95, $C0, $B1, $E1, $21, $01, $E2, $B1, $E1 ; CPU:$FDEA PRG:3DEA 41 11 41 21 11 20 E2 95 C0 B1 E1 21 01 E2 B1 E1 .byte $01, $41, $21, $01, $E2, $B0, $E1, $07, $C0, $E2, $B0, $90, $80, $91, $A0, $B0 ; CPU:$FDFA PRG:3DFA 01 41 21 01 E2 B0 E1 07 C0 E2 B0 90 80 91 A0 B0 .byte $E1, $00, $FE, $A5, $FD, $E1, $11, $21, $41, $21, $72, $20, $E2, $B1, $71, $B1 ; CPU:$FE0A PRG:3E0A E1 00 FE A5 FD E1 11 21 41 21 72 20 E2 B1 71 B1 .byte $91, $81, $91, $E1, $45, $41, $61, $51, $41, $31, $FF, $FD, $B9, $FE, $FD, $B9 ; CPU:$FE1A PRG:3E1A 91 81 91 E1 45 41 61 51 41 31 FF FD B9 FE FD B9 .byte $FE, $FD, $A7, $FE, $FD, $A7, $FE, $FD, $B0, $FE, $FD, $B0, $FE, $FD, $B9, $FE ; CPU:$FE2A PRG:3E2A FE FD A7 FE FD A7 FE FD B0 FE FD B0 FE FD B9 FE .byte $71, $21, $41, $61, $FD, $B9, $FE, $FD, $B9, $FE, $FD, $A7, $FE, $FD, $A7, $FE ; CPU:$FE3A PRG:3E3A 71 21 41 61 FD B9 FE FD B9 FE FD A7 FE FD A7 FE .byte $FD, $B0, $FE, $FD, $B0, $FE, $FD, $B9, $FE, $E2, $73, $C3, $01, $71, $41, $71 ; CPU:$FE4A PRG:3E4A FD B0 FE FD B0 FE FD B9 FE E2 73 C3 01 71 41 71 .byte $01, $71, $41, $71, $21, $91, $51, $91, $21, $91, $51, $91, $E3, $71, $E2, $51 ; CPU:$FE5A PRG:3E5A 01 71 41 71 21 91 51 91 21 91 51 91 E3 71 E2 51 .byte $21, $51, $E3, $71, $E2, $51, $21, $51, $01, $71, $61, $71, $01, $71, $61, $71 ; CPU:$FE6A PRG:3E6A 21 51 E3 71 E2 51 21 51 01 71 61 71 01 71 61 71 .byte $01, $71, $61, $71, $11, $91, $71, $91, $21, $91, $51, $91, $31, $E1, $01, $E3 ; CPU:$FE7A PRG:3E7A 01 71 61 71 11 91 71 91 21 91 51 91 31 E1 01 E3 .byte $91, $E1, $01, $E3, $71, $E2, $71, $41, $71, $E3, $71, $E2, $51, $21, $51, $01 ; CPU:$FE8A PRG:3E8A 91 E1 01 E3 71 E2 71 41 71 E3 71 E2 51 21 51 01 .byte $71, $41, $71, $21, $E1, $01, $E2, $61, $E1, $01, $FE, $25, $FE, $E2, $91, $E1 ; CPU:$FE9A PRG:3E9A 71 41 71 21 E1 01 E2 61 E1 01 FE 25 FE E2 91 E1 .byte $11, $E2, $41, $E1, $11, $FF, $E2, $91, $E1, $01, $E2, $21, $E1, $01, $FF, $E2 ; CPU:$FEAA PRG:3EAA 11 E2 41 E1 11 FF E2 91 E1 01 E2 21 E1 01 FF E2 .byte $71, $B1, $21, $B1, $FF, $E1, $03, $FD, $01, $FF, $13, $23, $47, $23, $C3, $13 ; CPU:$FEBA PRG:3EBA 71 B1 21 B1 FF E1 03 FD 01 FF 13 23 47 23 C3 13 .byte $23, $97, $73, $C3, $E1, $03, $FD, $01, $FF, $63, $93, $97, $73, $E1, $67, $43 ; CPU:$FECA PRG:3ECA 23 97 73 C3 E1 03 FD 01 FF 63 93 97 73 E1 67 43 .byte $47, $23, $E2, $73, $C3, $FD, $0C, $FF, $47, $73, $47, $73, $E1, $2F, $03, $FD ; CPU:$FEDA PRG:3EDA 47 23 E2 73 C3 FD 0C FF 47 73 47 73 E1 2F 03 FD .byte $0C, $FF, $E1, $03, $23, $43, $71, $71, $72, $C0, $52, $C0, $41, $41, $42, $C0 ; CPU:$FEEA PRG:3EEA 0C FF E1 03 23 43 71 71 72 C0 52 C0 41 41 42 C0 .byte $22, $C0, $E1, $03, $FE, $BF, $FE, $E2, $B3, $B7, $93, $C3, $83, $93, $B7, $93 ; CPU:$FEFA PRG:3EFA 22 C0 E1 03 FE BF FE E2 B3 B7 93 C3 83 93 B7 93 .byte $C3, $FF, $E2, $73, $57, $73, $57, $73, $E1, $4F, $23, $E2, $73, $FF, $C7, $FD ; CPU:$FF0A PRG:3F0A C3 FF E2 73 57 73 57 73 E1 4F 23 E2 73 FF C7 FD .byte $64, $FF, $E2, $23, $53, $53, $73, $B3, $B3, $23, $73, $73, $73, $B3, $B3, $23 ; CPU:$FF1A PRG:3F1A 64 FF E2 23 53 53 73 B3 B3 23 73 73 73 B3 B3 23 .byte $B3, $B3, $FD, $64, $FF, $E2, $33, $93, $93, $43, $73, $73, $03, $43, $43, $23 ; CPU:$FF2A PRG:3F2A B3 B3 FD 64 FF E2 33 93 93 43 73 73 03 43 43 23 .byte $63, $63, $73, $C7, $FD, $74, $FF, $03, $43, $43, $E3, $73, $E2, $43, $43, $03 ; CPU:$FF3A PRG:3F3A 63 63 73 C7 FD 74 FF 03 43 43 E3 73 E2 43 43 03 .byte $43, $43, $E3, $73, $E2, $43, $43, $FD, $74, $FF, $E1, $03, $E2, $B3, $A3, $97 ; CPU:$FF4A PRG:3F4A 43 43 E3 73 E2 43 43 FD 74 FF E1 03 E2 B3 A3 97 .byte $83, $73, $E3, $73, $E2, $73, $03, $FE, $18, $FF, $E2, $93, $E1, $03, $03, $E2 ; CPU:$FF5A PRG:3F5A 83 73 E3 73 E2 73 03 FE 18 FF E2 93 E1 03 03 E2 .byte $23, $E1, $03, $03, $E2, $93, $E1, $03, $03, $FF, $23, $73, $73, $E3, $73, $E2 ; CPU:$FF6A PRG:3F6A 23 E1 03 03 E2 93 E1 03 03 FF 23 73 73 E3 73 E2 .byte $73, $73, $23, $73, $73, $E3, $73, $E2, $73, $73, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FF7A PRG:3F7A 73 73 23 73 73 E3 73 E2 73 73 FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FF8A PRG:3F8A FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FF9A PRG:3F9A FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FFAA PRG:3FAA FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $6E, $C7, $86, $C7, $8C, $C7, $9D, $C7 ; CPU:$FFBA PRG:3FBA FF FF FF FF FF FF FF FF 6E C7 86 C7 8C C7 9D C7 .byte $02, $C8, $0F, $C8, $74, $C7, $92, $C7, $CA, $C7, $70, $D6, $FA, $D6, $63, $C7 ; CPU:$FFCA PRG:3FCA 02 C8 0F C8 74 C7 92 C7 CA C7 70 D6 FA D6 63 C7 .byte $24, $D7, $30, $D7, $CA, $C7, $D8, $C7, $E6, $C7, $F4, $C7, $FF, $FF, $FF, $FF ; CPU:$FFDA PRG:3FDA 24 D7 30 D7 CA C7 D8 C7 E6 C7 F4 C7 FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $04, $01, $02, $01 ; CPU:$FFEA PRG:3FEA FF FF FF FF FF FF FF FF FF FF FF FF 04 01 02 01 .byte $5A, $C0, $00 ; CPU:$FFFA PRG:3FFA 5A C0 00 cpy #$B7 ; CPU:$FFFD PRG:3FFD C0 B7 ; ---- data $FFFF-$FFFF (1 bytes) ---- .byte $4C ; CPU:$FFFF PRG:3FFF 4C