Advertisement
Guest User

Mega Man X3 Zero NPC Introduction Disassembly

a guest
Sep 4th, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $03/A822 A6 01       LDX $01    [$00:0CC9]   A:0102 X:0002 Y:0000 P:envMXdIzc ;Main pointer to get which Zero event (00-16)
  2. $03/A824 7C 27 A8    JMP ($A827,x)[$03:xxxx] A:0102 X:0000 Y:0000 P:envMXdIZc
  3.  
  4. 00 (3F A8) - Zero Introduction with Spycopter           (03:A83F to 03:AA02)
  5. 02 (02 AA) - X captured by Mac                  (03:AA02 to 03:AD0F)
  6. 04 (0F AD) - Rescue X from Mac                  (03:AD0F to 03:AEF9)
  7. 06 (F9 AE) - Zero teleport after Maoh the Giant defeated    (03:AEF9 to 03:AFD5)
  8. 08 (D5 AF) - Zero power cell damaged when defeated in a level   (03:AFD5 to 03:B020)
  9. 0A (20 B0) - Dr. Cain lab pinpoint Doppler's Lab        (03:B020 to 03:B0DC)
  10. 0C (DC B0) - REX-2000 Event                 (03:B0DC to 03:BC1C)
  11. 0E (1C B2) - Damaged by Mosquitus               (03:BC1C to 03:B373)
  12. 10 (73 B3) - Z-Saber to Sigma's Wall                (03:B373 to 03:B53D)
  13. 12 (3D B5) - Fall from ceiling and slash Sigma Virus        (03:B53D to 03:BA33)
  14. 14 (33 BA) - Standing on Cliff                  (03:BA33 to 03:BA5E)
  15. 16 (5E BA
  16. ) - Credits Roll                    (03:BA5E to 03:BA9D)
  17.  
  18.  
  19.  
  20. $03/A83F A6 02       LDX $02    [$00:0CCA]   A:0102 X:00xx Y:0000 P:envMXdIZc ;Loads which sub-event for Spy Copter
  21. $03/A841 7C 44 A8    JMP ($A844,x)[$03:xxxx] A:0102 X:00xx Y:0000 P:envMXdIZc
  22.  
  23. 5C A8
  24. B1 A8
  25. D6 A8
  26. 0B A9
  27. 26 A9
  28. 70 A9
  29. 91 A9
  30. D1 BA
  31.  
  32. B4 A9
  33. CF A9
  34. EE A9
  35. FF A9
  36.  
  37.  
  38. 03:BB11 - Used by various NPCs (JMP short)      [PC NPCs should have their own setup in their event area]
  39. 03:BB04 - Used by various NPCs (JMP short)      [PC NPCs should have their own setup in their event area]
  40. 03:BB37 - Load Zero NPC sprites (JSR short)     [Will be compressed down to a universal routine]
  41. 03:BB49 - Load Zero Z-Saber NPC sprites (JSR Short) [Will be compressed down to a universal routine]
  42. 03:BAF6 - Load Fall Velocity of NPCs (JSR short)    [PC NPCs should have their own setup in their event area]
  43.  
  44.  
  45. Event #00 is generally used to preset the NPC object:
  46.     --> Graphics, palette, sprite assembly, height
  47.  
  48. -----------------------------
  49. Zero Introduction Spycopter
  50. -----------------------------
  51. Sub-event #00 ;Sets Zero's sprite data up & palette, Z-Saber palette, Zero's jump velocity, distance and height.
  52. -----------------------------
  53. $03/A85C E6 02       INC $02    [$00:0CCA]   A:0102 X:0000 Y:0000 P:EnvMXdIzc ;Increase Zero Introduction Spycopter Event to 02
  54. $03/A85E E6 02       INC $02    [$00:0CCA]   A:0102 X:0000 Y:0000 P:EnvMXdIzc ;Increase Zero Introduction Spycopter Event to 02
  55. $03/A860 A9 30       LDA #$30                A:0102 X:0000 Y:0000 P:EnvMXdIzc ;Set base VRAM location of Zero
  56. $03/A862 85 18       STA $18    [$00:0CE0]   A:0130 X:0000 Y:0000 P:EnvMXdIzc ;Store to NPC RAM $7E:0CE0
  57. $03/A864 20 37 BB    JSR $BB37  [$00:BB37]   A:0130 X:0000 Y:0000 P:EnvMXdIzc ;Load Zero's normal sprite setup [MUST BE MADE INTO A UNIVERSAL ROUTINE]
  58. $03/A867 A9 52       LDA #$52                A:01B4 X:0000 Y:0000 P:EnvMXdIzc ;Animation for Zero jumping up onto Spycopter
  59. $03/A869 22 67 B9 04 JSL $04B967[$04:B967]   A:0152 X:0000 Y:0000 P:EnvMXdIzc ;Load animation routine
  60. $03/A86D 22 A2 BC 04 JSL $04BCA2[$04:BCA2]   A:CF80 X:00DE Y:0002 P:EnvMXdIzc ;Load VRAM data storage (Gets graphics and stores to VRAM)
  61. $03/A871 A9 3C       LDA #$3C                A:6410 X:00AD Y:0008 P:EnvMXdIzc ;Set palette of Zero using RAM address
  62. $03/A873 85 11       STA $11    [$00:0CD9]   A:643C X:00AD Y:0008 P:EnvMXdIzc ;Store to NPC RAM $7E:0CD9
  63. $03/A875 C2 10       REP #$10                A:643C X:00AD Y:0008 P:EnvMXdIzc ;Set to 16-bit reading on X/Y only
  64. $03/A877 A2 50 00    LDX #$0050              A:643C X:00AD Y:0008 P:EnvMxdIzc ;Load RAM storage of Zero's palette
  65. $03/A87A A0 D0 00    LDY #$00D0              A:643C X:0050 Y:0008 P:EnvMxdIzc ;Load pointer to Zero's palette
  66. $03/A87D 22 4A 80 01 JSL $01804A[$01:804A]   A:643C X:0050 Y:00D0 P:EnvMxdIzc ;Load palette storage routine
  67. $03/A881 A2 70 00    LDX #$0070              A:1001 X:00E0 Y:0000 P:EnvMxdIzc ;Load RAM storage of Z-Saber palette
  68. $03/A884 A0 D2 00    LDY #$00D2              A:1001 X:0070 Y:0000 P:EnvMxdIzc ;Load pointer to Z-Saber palette
  69. $03/A887 22 4A 80 01 JSL $01804A[$01:804A]   A:1001 X:0070 Y:00D2 P:EnvMxdIzc ;Load palette storage routine
  70. $03/A88B C2 20       REP #$20                A:1001 X:0000 Y:0000 P:envMxdIzc ;Set to 16-bit reading on A/X/Y
  71. $03/A88D AD 5D 1E    LDA $1E5D  [$06:1E5D]   A:1001 X:0000 Y:0000 P:envmxdIzc ;Load X coordinate of screen
  72. $03/A890 18          CLC                     A:0922 X:0000 Y:0000 P:envmxdIzc ;Clear carry flag
  73. $03/A891 69 00 01    ADC #$0100              A:0922 X:0000 Y:0000 P:envmxdIzc ;Add #$0100 to current 'A' value
  74. $03/A894 85 05       STA $05    [$00:0CCD]   A:0A22 X:0000 Y:0000 P:envmxdIzc ;Store to PC NPC RAM at $7E:0CCD (PC NPC X coordinate)
  75. $03/A896 AD 60 1E    LDA $1E60  [$06:1E60]   A:0A22 X:0000 Y:0000 P:envmxdIzc ;Load Y coordinate of screen
  76. $03/A899 18          CLC                     A:0100 X:0000 Y:0000 P:envmxdIzc ;Clear carry flag
  77. $03/A89A 69 E0 00    ADC #$00E0              A:0100 X:0000 Y:0000 P:envmxdIzc ;Add #$00E0 to current 'A' value
  78. $03/A89D 85 08       STA $08    [$00:0CD0]   A:01E0 X:0000 Y:0000 P:envmxdIzc ;Store to PC NPC RAM at $7E:0CD0 (PC NPC Y coordinate)
  79. $03/A89F A9 00 07    LDA #$0700              A:01E0 X:0000 Y:0000 P:envmxdIzc ;Load velocity of Zero's jump             [Change to #$0710 for better landing]
  80. $03/A8A2 85 1C       STA $1C    [$00:0CE4]   A:0700 X:0000 Y:0000 P:envmxdIzc ;Store to PC NPC RAM at $7E:0CE4 (PC NPC Velocity)
  81. $03/A8A4 A9 00 FF    LDA #$FF00              A:0700 X:0000 Y:0000 P:envmxdIzc ;Load distance of Zero's jump (Maybe speed?)  [Change to #$FE80 for better landing]
  82. $03/A8A7 85 1A       STA $1A    [$00:0CE2]   A:FF00 X:0000 Y:0000 P:eNvmxdIzc ;Store to PC NPC RAM at $7E:0CE2 (PC NPC jump speed/distance)
  83. $03/A8A9 A9 40 00    LDA #$0040              A:FF00 X:0000 Y:0000 P:eNvmxdIzc ;Load height of Zero's jump
  84. $03/A8AC 85 1E       STA $1E    [$00:0CE6]   A:0040 X:0000 Y:0000 P:envmxdIzc ;Store to PC NPC RAM at $7E:0CE6 (PC NPC jump height)
  85. $03/A8AE E2 30       SEP #$30                A:0040 X:0000 Y:0000 P:envmxdIzc ;Set to 8-bit reading on A/X/Y
  86. $03/A8B0 6B          RTL                     A:0040 X:0000 Y:0000 P:envMXdIzc ;Return long
  87. -----------------------------
  88. Sub-event #02 ;Zero flying up to land on Spycopter
  89. -----------------------------
  90. $03/A8B1 22 F8 D6 02 JSL $02D6F8[$02:D6F8]   A:0102 X:0002 Y:0000 P:envMXdIzc ;Routine to check for NPC's landing on objects or structures
  91. $03/A8B5 24 1D       BIT $1D    [$00:0CE5]   A:D901 X:0002 Y:0000 P:envMXdIzc ;Bit test with high byte of PC NPC's jump velocity
  92. $03/A8B7 10 19       BPL $19    [$A8D2]      A:D901 X:0002 Y:0000 P:envMXdIZc ;If not correct, BPL to $03/A8D2
  93. $03/A8B9 C2 20       REP #$20                A:8101 X:0002 Y:0000 P:eNVMXdIzc ;Set to 16-bit reading on A/X/Y
  94. $03/A8BB A5 08       LDA $08    [$00:0CD0]   A:8101 X:0002 Y:0000 P:eNVmXdIzc ;Load Y coordinate of PC NPC from $7E:0CD0
  95. $03/A8BD C9 78 01    CMP #$0178              A:0181 X:0002 Y:0000 P:enVmXdIzc ;Check for value of #$0178
  96. $03/A8C0 E2 20       SEP #$20                A:0181 X:0002 Y:0000 P:enVmXdIzC ;Set to 8-bit reading on A/X/Y
  97. $03/A8C2 30 0E       BMI $0E    [$A8D2]      A:0181 X:0002 Y:0000 P:enVMXdIzC ;If <= #$0178, BMI to $03/A8D2 to ignore event increase and loop event
  98. $03/A8C4 E6 02       INC $02    [$00:0CCA]   A:0181 X:0002 Y:0000 P:enVMXdIzC ;Increase Zero Introduction Spycopter Event to 04
  99. $03/A8C6 E6 02       INC $02    [$00:0CCA]   A:0181 X:0002 Y:0000 P:enVMXdIzC ;Increase Zero Introduction Spycopter Event to 04
  100. $03/A8C8 A9 6F       LDA #$6F                A:0181 X:0002 Y:0000 P:enVMXdIzC ;Load animation for Zero landing on Spycopter
  101. $03/A8CA 22 67 B9 04 JSL $04B967[$04:B967]   A:016F X:0002 Y:0000 P:enVMXdIzC ;Load animation routine (Generally used for single frame loading)
  102. $03/A8CE 22 A2 BC 04 JSL $04BCA2[$04:BCA2]   A:D080 X:00DE Y:0002 P:enVMXdIzC ;Load VRAM data storage (Force an update: Gets graphics & stores to VRAM)
  103. $03/A8D2 5C 36 D6 02 JMP $02D636[$02:D636]   A:6410 X:0001 Y:0008 P:enVMXdIzC ;Sets various data for sprite objects & screen then loop events
  104.  
  105.  
  106. It seems that 22 67 B9 04 etc.. needs to be loaded as a prerequisite when first loading the NPC graphics
  107. Otherwise after that it's redundant. (NEED FURTHER TESTING)
  108.  
  109. 22 67 B9 04 \ ;Can be replaced with 4C 04 BB then 4C 11 BB anytime after the first animation(?). This does the same thing but checks if it NEEDS to update.
  110. 22 A2 BC 04 | ;What's happening right now is it FORCES an update and is generally used for single frames from an animation.
  111. 5C 36 D6 02 / ;The 4C 11 BB/4C 04 BB will animate and object from any point in the given frame #.
  112.  
  113.  
  114. -----------------------------
  115. Sub-event #04 ;Zero landing on Spycopter
  116. -----------------------------
  117. $03/A8D6 C2 30       REP #$30                A:0102 X:0004 Y:0000 P:envMXdIzc ;Set to 16-bit reading on A/X/Y
  118. $03/A8D8 AE 57 1F    LDX $1F57  [$06:1F57]   A:0102 X:0004 Y:0000 P:envmxdIzc ;Load base RAM for large Spycopter that X/Zero are on
  119. $03/A8DB BD 05 00    LDA $0005,x[$06:0D1D]   A:0102 X:0D18 Y:0000 P:envmxdIzc ;Load X coordinates of Spycopter
  120. $03/A8DE 18          CLC                     A:09DE X:0D18 Y:0000 P:envmxdIzc ;Clear carry flag
  121. $03/A8DF 69 18 00    ADC #$0018              A:09DE X:0D18 Y:0000 P:envmxdIzc ;ADC #$0018 to current 'A' value
  122. $03/A8E2 85 05       STA $05    [$00:0CCD]   A:09F6 X:0D18 Y:0000 P:envmxdIzc ;Store to PC NPC RAM at $7E:0CCD (PC NPC X coordinate)
  123. $03/A8E4 BD 08 00    LDA $0008,x[$06:0D20]   A:09F6 X:0D18 Y:0000 P:envmxdIzc ;Load Y coordinates of Spycopter
  124. $03/A8E7 85 08       STA $08    [$00:0CD0]   A:0180 X:0D18 Y:0000 P:envmxdIzc ;Store to PC NPC RAM at $7E:0CD0 (PC NPC Y coordinate)
  125. $03/A8E9 AD 5D 1E    LDA $1E5D  [$06:1E5D]   A:0180 X:0D18 Y:0000 P:envmxdIzc ;Load X coordinates of screen
  126. $03/A8EC C9 D0 09    CMP #$09D0              A:095E X:0D18 Y:0000 P:envmxdIzc ;Check for #$09D0
  127. $03/A8EF 10 05       BPL $05    [$A8F6]      A:095E X:0D18 Y:0000 P:eNvmxdIzc ;If >= #$09D0, BPL to $03/A8F6
  128. $03/A8F1 E2 30       SEP #$30                A:095E X:0D18 Y:0000 P:eNvmxdIzc ;Set to 8-bit reading on A/X/Y
  129. $03/A8F3 4C 11 BB    JMP $BB11  [$03:BB11]   A:095E X:0018 Y:0000 P:eNvMXdIzc ;Load routine for NPC consistent animation data update/storing VRAM if needed. [MAKE UNIVERSAL]
  130.  
  131. $03/A8F6 A9 00 06    LDA #$0600              A:09D0 X:0D18 Y:0000 P:envmxdIZC ;Load distance of Zero's jump (Maybe speed?)
  132. $03/A8F9 85 1A       STA $1A    [$00:0CE2]   A:0600 X:0D18 Y:0000 P:envmxdIzC ;Store to PC NPC RAM at $7E:0CE2 (PC NPC jump speed/distance)
  133. $03/A8FB A9 80 03    LDA #$0380              A:0600 X:0D18 Y:0000 P:envmxdIzC ;Load velocity of Zero's jump
  134. $03/A8FE 85 1C       STA $1C    [$00:0CE4]   A:0380 X:0D18 Y:0000 P:envmxdIzC ;Store to PC NPC RAM at $7E:0CE4 (PC NPC Velocity)
  135. $03/A900 E2 30       SEP #$30                A:0380 X:0D18 Y:0000 P:envmxdIzC ;Set to 8-bit reading on A/X/Y
  136. $03/A902 E6 02       INC $02    [$00:0CCA]   A:0380 X:0018 Y:0000 P:envMXdIzC ;Increase Introduction Spycopter Event to 06
  137. $03/A904 E6 02       INC $02    [$00:0CCA]   A:0380 X:0018 Y:0000 P:envMXdIzC ;Increase Introduction Spycopter Event to 06
  138. $03/A906 A9 72       LDA #$72                A:0380 X:0018 Y:0000 P:envMXdIzC ;Load Zero kicking off wall animation
  139. $03/A908 4C 04 BB    JMP $BB04  [$03:BB04]   A:0372 X:0018 Y:0000 P:envMXdIzC ;Load routine for NPC consistent single frame VRAM storage/update next frame VRAM if needed. [MAKE UNIVERSAL]
  140.  
  141.  
  142. $03:BB04 ;Routine to check if animation data needs to be updated or not.
  143.     ;Loads Animation Data routine (04:B967) [JSL]
  144.     ;Loads ??? (03:BB1E) [JSR] ;Loads current frame of PC NPC and checks whether it needs a VRAM update per frame for animation
  145.         --> ;If frame VRAM data does not need to be updated, it skips the update and stores the value back to the current frame's location
  146.         --> ;Seems to be used for animations where the PC NPC transitions from ground to air or vice versa
  147.     ;Sets various data for sprite objects & screen (02:D636) [JMP]
  148.  
  149. $03:BB11 ;Routine to check if VRAM needs to update or not.
  150.     ;Load VRAM data storage (Force an update: Gets graphics & stores to VRAM) (04:B94A) [JSL]
  151.     ;Loads ??? (03:BB1E) [JSR] ;Loads current frame of PC NPC and checks whether it needs a VRAM update per frame for animation
  152.         --> ;If frame VRAM data does not need to be updated, it skips the update and stores the value back to the current frame's location
  153.         --> ;Seems to be used for animations where the PC NPC transitions from ground to air or vice versa
  154.     ;Sets various data for sprite objects & screen (02:D636) [JMP]
  155. -----------------------------
  156. Sub-event #06 ;Check for ??? then load Zero's Z-Saber sprite assembly data and animation
  157. -----------------------------
  158. $03/A90B 22 F8 D6 02 JSL $02D6F8[$02:D6F8]   A:0102 X:0006 Y:0000 P:EnvMXdIzc ;Routine to check for NPC's landing on objects or structures
  159. $03/A90F A5 0F       LDA $0F    [$00:0CD7]   A:7D01 X:0006 Y:0000 P:EnvMXdIzc ;Load flag to check if NPC needs to update their VRAM data
  160. $03/A911 30 03       BMI $03    [$A916]      A:7D00 X:0006 Y:0000 P:EnvMXdIzc ;Check if >= 80(?), if so, BMI to $03/A916
  161. $03/A913 4C 11 BB    JMP $BB11  [$03:BB11]   A:7D00 X:0006 Y:0000 P:EnvMXdIzc ;Load routine for NPC consistent animation data update/storing VRAM if needed. [MAKE UNIVERSAL]
  162.  
  163. $03/A916 E6 02       INC $02    [$00:0CCA]   A:7381 X:0006 Y:0000 P:eNvMXdIzc ;Increase Introduction Spycopter Event to 08
  164. $03/A918 E6 02       INC $02    [$00:0CCA]   A:7381 X:0006 Y:0000 P:envMXdIzc ;Increase Introduction Spycopter Event to 08
  165. $03/A91A 64 1A       STZ $1A    [$00:0CE2]   A:7381 X:0006 Y:0000 P:envMXdIzc ;Store 00 to PC NPC RAM at $7E:0CE2 (PC NPC jump speed/distance)
  166. $03/A91C 64 1B       STZ $1B    [$00:0CE3]   A:7381 X:0006 Y:0000 P:envMXdIzc ;Store 00 to PC NPC RAM at $7E:0CE4 (PC NPC Velocity)
  167. $03/A91E 20 49 BB    JSR $BB49  [$03:BB49]   A:7381 X:0006 Y:0000 P:EnvMXdIzc ;Load Zero's Z-Saber Sprite data setup [MUST BE MADE INTO A UNIVERSAL ROUTINE]
  168. $03/A921 A9 0E       LDA #$0E                A:73B4 X:0006 Y:0000 P:eNvMXdIzc ;Load Zero using Z-Saber animation
  169. $03/A923 4C 04 BB    JMP $BB04  [$03:BB04]   A:730E X:0006 Y:0000 P:envMXdIzc ;Load routine for NPC consistent single frame VRAM storage/update next frame VRAM if needed. [MAKE UNIVERSAL]
  170.  
  171. 03:BAF6 - Fall velocity for NPC (Used in various locations for NPCs falling)
  172. -----------------------------
  173. Sub-event #08 ;Draw Z-Saber object
  174. -----------------------------
  175. $03/A926 22 F8 D6 02 JSL $02D6F8[$02:D6F8]   A:0102 X:0008 Y:0000 P:envMXdIzc ;Routine to check for NPC's landing on objects or structures
  176. $03/A92A 20 F6 BA    JSR $BAF6  [$03:BAF6]   A:7101 X:0008 Y:0000 P:envMXdIzc ;Set fall velocity for NPC
  177. $03/A92D 24 0F       BIT $0F    [$00:0CD7]   A:FA80 X:0008 Y:0000 P:eNvMXdIzC ;Load flag to check if NPC needs to update their VRAM data
  178. $03/A92F 30 33       BMI $33    [$A964]      A:FA80 X:0008 Y:0000 P:envMXdIZC If >(?) 80, BMI to $03/A964
  179. $03/A931 50 2C       BVC $2C    [$A95F]      A:FA80 X:0008 Y:0000 P:envMXdIZC ;If <= 80(?), BMI to $03/A95F
  180.  
  181.     --- This whole section should be in it's own universal routine so the Z-Saber can be drawn on the fly --- [May need to check on this just to be sure]
  182. --- Same should be done for Sigma Wall event. Seems pointless to have separate code for each event to draw the same specifics --- [May need to check on this just to be sure]
  183. ---------------------------------------------------------------------------------------------------------------------------------
  184. $03/A933 22 C4 D8 02 JSL $02D8C4[$02:D8C4]   A:FA80 X:0008 Y:0000 P:enVMXdIZC ;Check various missile objects to test if Z-Saber can be drawn
  185. $03/A937 D0 26       BNE $26    [$A95F]      A:0000 X:10D8 Y:0000 P:enVMxdIZC ;If > 00, jump to $03/A95F to update animation
  186. $03/A939 FE 00 00    INC $0000,x[$06:10D8]   A:0000 X:10D8 Y:0000 P:enVMxdIZC ;Increase missile object RAM at $7E:0000,x to state that it's ACTIVE
  187. $03/A93C A9 02       LDA #$02                A:0000 X:10D8 Y:0000 P:enVMxdIzC ;Set Z-Saber event to 02 so it's active
  188. $03/A93E 9D 0A 00    STA $000A,x[$06:10E2]   A:0002 X:10D8 Y:0000 P:enVMxdIzC ;Store to missile object RAM at $7E:000A,x so it loads the proper event start
  189. $03/A941 A9 82       LDA #$82                A:0002 X:10D8 Y:0000 P:enVMxdIzC ;Load Z-Saber type to use (+80 = NPC usage) [80 = X's Z-Saber, 82 = Zero's Z-Saber)
  190. $03/A943 9D 0B 00    STA $000B,x[$06:10E3]   A:0082 X:10D8 Y:0000 P:eNVMxdIzC ;Store to missile object RAM at $7E:000B,x so it loads the proper graphical setup
  191. $03/A946 A9 28       LDA #$28                A:0082 X:10D8 Y:0000 P:eNVMxdIzC ;Load Z-Saber palette RAM location
  192. $03/A948 9D 18 00    STA $0018,x[$06:10F0]   A:0028 X:10D8 Y:0000 P:enVMxdIzC ;Store to $7E:0018,x so it sets the proper palette data for object
  193. $03/A94B A5 11       LDA $11    [$00:0CD9]   A:0028 X:10D8 Y:0000 P:enVMxdIzC ;Load palette of NPC
  194. $03/A94D 29 70       AND #$70                A:003C X:10D8 Y:0000 P:enVMxdIzC ;AND #$70
  195. $03/A94F 09 0E       ORA #$0E                A:0030 X:10D8 Y:0000 P:enVMxdIzC ;ORA with #$0E
  196. $03/A951 9D 11 00    STA $0011,x[$06:10E9]   A:003E X:10D8 Y:0000 P:enVMxdIzC ;Store new palette setup to missile object RAM at $7E:0011,x so it loads above proper BG layers
  197. $03/A954 A9 07       LDA #$07                A:003E X:10D8 Y:0000 P:enVMxdIzC ;Load animation of Z-Saber
  198. $03/A956 9D 3C 00    STA $003C,x[$06:1114]   A:0007 X:10D8 Y:0000 P:enVMxdIzC ;Store to missile object RAM at $7E:003C,x so it loads proper animation
  199. $03/A959 8D 44 1F    STA $1F44  [$06:1F44]   A:0007 X:10D8 Y:0000 P:enVMxdIzC ;Store to $7E:1F44 so it gets proper animation
  200. $03/A95C 9E 12 00    STZ $0012,x[$06:10EA]   A:0007 X:10D8 Y:0000 P:enVMxdIzC ;STZ to missile object RAM at $7E:0012,x so it loads above other sprites
  201.  
  202. $03/A95F E2 30       SEP #$30                A:FA80 X:0008 Y:0000 P:EnvMXdIzc ;Set to 8-bit reading on A/X/Y
  203. $03/A961 4C 11 BB    JMP $BB11  [$03:BB11]   A:FA80 X:0008 Y:0000 P:EnvMXdIzc ;Load routine for NPC consistent animation data update/storing VRAM if needed. [MAKE UNIVERSAL]
  204.  
  205. $03/A964 E6 02       INC $02    [$00:0CCA]   A:FA80 X:0008 Y:0000 P:eNvMXdIzC ;Increase Introduction Spycopter Event to 0A
  206. $03/A966 E6 02       INC $02    [$00:0CCA]   A:FA80 X:0008 Y:0000 P:envMXdIzC ;Increase Introduction Spycopter Event to 0A
  207. $03/A968 20 37 BB    JSR $BB37  [$03:BB37]   A:FA80 X:0008 Y:0000 P:EnvMXdIzc ;Load Zero's normal sprite setup [MUST BE MADE INTO A UNIVERSAL ROUTINE]
  208. $03/A96B A9 55       LDA #$55                A:FAB4 X:0008 Y:0000 P:eNvMXdIzC ;Load Zero falling animation [Change to A9 57 for better animation transition]
  209. $03/A96D 4C 04 BB    JMP $BB04  [$03:BB04]   A:FA55 X:0008 Y:0000 P:envMXdIzC ;Load routine for NPC consistent single frame VRAM storage/update next frame VRAM if needed. [MAKE UNIVERSAL]
  210. -----------------------------
  211. Sub-event #0A ;Spycopter breaking with NPC Zero falling/landing
  212. -----------------------------
  213.     -- This is for Zero falling from Spycopter --
  214. $03/A970 20 F6 BA    JSR $BAF6  [$03:BAF6]   A:0102 X:000A Y:0000 P:envMXdIzc ;Set fall velocity for NPC
  215. $03/A973 22 F8 D6 02 JSL $02D6F8[$02:D6F8]   A:FA80 X:000A Y:0000 P:envMXdIZC ;Routine to check for NPC's landing on objects or structures
  216. $03/A977 22 F7 C0 04 JSL $04C0F7[$04:C0F7]   A:F901 X:000A Y:0000 P:envMXdIZC ;Detects PC landing on ground sets their air or ground byte
  217. $03/A97B A5 2B       LDA $2B    [$00:0CF3]   A:0000 X:00C8 Y:00F9 P:envMXdIZC ;Load byte to determine if NPC is on ground or in air
  218. $03/A97D 89 04       BIT #$04                A:0000 X:00C8 Y:00F9 P:envMXdIZC ;BIT #$04 (On ground)
  219. $03/A97F D0 03       BNE $03    [$A984]      A:0000 X:00C8 Y:00F9 P:envMXdIZC ;If == #$04, BNE to $03/A984
  220. $03/A981 4C 11 BB    JMP $BB11  [$03:BB11]   A:0000 X:00C8 Y:00F9 P:envMXdIZC ;Load routine for NPC consistent animation data update/storing VRAM if needed. [MAKE UNIVERSAL]
  221.  
  222.     -- This is for when Zero lands on the ground --
  223. $03/A984 E6 02       INC $02    [$00:0CCA]   A:0404 X:00C8 Y:00A6 P:envMXdIzC ;Increase Introduction Spycopter Event to 0C
  224. $03/A986 E6 02       INC $02    [$00:0CCA]   A:0404 X:00C8 Y:00A6 P:envMXdIzC ;Increase Introduction Spycopter Event to 0C
  225. $03/A988 A9 3C       LDA #$3C                A:0404 X:00C8 Y:00A6 P:envMXdIzC ;Load delay timer before dialogue box can load up
  226. $03/A98A 85 3C       STA $3C    [$00:0D04]   A:043C X:00C8 Y:00A6 P:envMXdIzC ;Store to NPC RAM at $7E:0D04
  227. $03/A98C A9 50       LDA #$50                A:043C X:00C8 Y:00A6 P:envMXdIzC ;Load animation for Zero landing on ground
  228. $03/A98E 4C 04 BB    JMP $BB04  [$03:BB04]   A:0450 X:00C8 Y:00A6 P:EnvMXdIzc ;Load routine for NPC consistent single frame VRAM storage/update next frame VRAM if needed. [MAKE UNIVERSAL]
  229. -----------------------------
  230. Sub-event #0C ;Initiate data to draw dialogue box
  231. -----------------------------
  232. $03/A991 C6 3C       DEC $3C    [$00:0D04]   A:0402 X:000C Y:0000 P:envMXdIzc ;Decrease delay timer from $7E:0D04
  233. $03/A993 F0 08       BEQ $08    [$A99D]      A:0402 X:000C Y:0000 P:envMXdIzc ;Check if == 00, if so, BEQ to $03/A99D
  234. $03/A995 22 4A B9 04 JSL $04B94A[$04:B94A]   A:0402 X:000C Y:0000 P:envMXdIzc ;Load alternate force VRAM update? (Can be changed to 04:BCA2 and it works just fine still?)
  235. $03/A999 5C 36 D6 02 JMP $02D636[$02:D636]   A:0402 X:000C Y:0000 P:envMXdIzc ;Routine to check for NPC's landing on objects or structures
  236.  
  237. $03/A99D E6 02       INC $02    [$00:0CCA]   A:0402 X:000C Y:0000 P:envMXdIZc ;Increase Introduction Spycopter Event to 0E
  238. $03/A99F E6 02       INC $02    [$00:0CCA]   A:0402 X:000C Y:0000 P:envMXdIzc ;Increase Introduction Spycopter Event to 0E
  239. $03/A9A1 A9 3C       LDA #$3C                A:0402 X:000C Y:0000 P:envMXdIzc ;Load delay timer before Zero teleports out after dialogue
  240. $03/A9A3 85 3C       STA $3C    [$00:0D04]   A:043C X:000C Y:0000 P:envMXdIzc ;Store to NPC RAM at $7E:0D04
  241. $03/A9A5 A9 30       LDA #$30                A:043C X:000C Y:0000 P:envMXdIzc ;Load which dialogue to use
  242. $03/A9A7 22 B1 FC 02 JSL $02FCB1[$02:FCB1]   A:0430 X:000C Y:0000 P:envMXdIzc ;Load routine to draw dialogue box and dialogue itself
  243. $03/A9AB A9 50       LDA #$50                A:0001 X:0018 Y:0000 P:envMXdIZc ;Load frame to use after Zero NPC is done talking
  244. $03/A9AD 85 43       STA $43    [$00:0D0B]   A:0050 X:0018 Y:0000 P:envMXdIzc ;Store to NPC RAM at $7E:0D0B
  245. $03/A9AF A9 87       LDA #$87                A:0050 X:0018 Y:0000 P:envMXdIzc ;Load frame for Zero Talking
  246. $03/A9B1 4C 04 BB    JMP $BB04  [$03:BB04]   A:0087 X:0018 Y:0000 P:EnvMXdIzc ;Load routine for NPC consistent single frame VRAM storage/update next frame VRAM if needed. [MAKE UNIVERSAL]
  247. -----------------------------
  248. Sub-event #0E ;Initate dialogue and animation updating
  249. [Different location than the other pieces]
  250. -----------------------------
  251. $03/BAD1 AD 3F 1F    LDA $1F3F  [$06:1F3F]   A:0402 X:000E Y:0000 P:envMXdIzc ;Check for 'Event lock'
  252. $03/BAD4 10 18       BPL $18    [$BAEE]      A:0480 X:000E Y:0000 P:eNvMXdIzc ;If value <= 7F, BPL to $03/BAEE
  253. $03/BAD6 AD 51 1F    LDA $1F51  [$06:1F51]   A:0480 X:000E Y:0000 P:eNvMXdIzc ;Load NPC talk animation bit
  254. $03/BAD9 D0 07       BNE $07    [$BAE2]      A:0400 X:000E Y:0000 P:envMXdIZc ;If > 00, BNE to $03/BAE2
  255. $03/BADB AD 50 1F    LDA $1F50  [$06:1F50]   A:0400 X:000E Y:0000 P:envMXdIZc ;Check for NPC allowed to talk animation bit
  256. $03/BADE C9 01       CMP #$01                A:0400 X:000E Y:0000 P:envMXdIZc ;Check if #$01
  257. $03/BAE0 F0 04       BEQ $04    [$BAE6]      A:0400 X:000E Y:0000 P:eNvMXdIzc ;If so, BEQ to $03/BAE6
  258. $03/BAE2 A5 0F       LDA $0F    [$00:0CD7]   A:0400 X:000E Y:0000 P:eNvMXdIzc ;Load flag to check if NPC needs to update their VRAM data
  259. $03/BAE4 F0 04       BEQ $04    [$BAEA]      A:0400 X:000E Y:0000 P:envMXdIZc ;If == 00, BEQ to $03/BAEA to update
  260. $03/BAE6 22 4A B9 04 JSL $04B94A[$04:B94A]   A:0400 X:000E Y:0000 P:envMXdIZc ;Load alternate force VRAM update? (Can be changed to 04:BCA2 and it works just fine still?)
  261. $03/BAEA 5C 36 D6 02 JMP $02D636[$02:D636]   A:0400 X:000E Y:0000 P:envMXdIZc ;Sets various data for sprite objects & screen then loop events
  262.  
  263. $03/BAEE E6 02       INC $02    [$00:0CCA]   A:0480 X:000E Y:0000 P:eNvMXdIzc ;Increase Introduction Spycopter Event to 10
  264. $03/BAF0 E6 02       INC $02    [$00:0CCA]   A:0480 X:000E Y:0000 P:envMXdIzc ;Increase Introduction Spycopter Event to 10
  265. $03/BAF2 A5 43       LDA $43    [$00:0D0B]   A:0480 X:000E Y:0000 P:envMXdIzc ;Load frame to load after talking
  266. $03/BAF4 80 0E       BRA $0E    [$BB04]      A:0450 X:000E Y:0000 P:envMXdIzc ;BRA to $03/BB04 to force update animations
  267.  
  268. $03/BB04 E2 30       SEP #$30                A:0450 X:000E Y:0000 P:envMXdIzc
  269. $03/BB06 22 67 B9 04 JSL $04B967[$04:B967]   A:0450 X:000E Y:0000 P:envMXdIzc ;Load animation routine (Generally used for single frame loading)
  270. $03/BB0A 20 1E BB    JSR $BB1E  [$03:BB1E]   A:CE80 X:00DE Y:0002 P:envMXdIzc ;Loads current frame of PC NPC and checks whether it needs a VRAM update per frame for animation
  271. $03/BB0D 5C 36 D6 02 JMP $02D636[$02:D636]   A:CEA8 X:00DE Y:0002 P:eNvMXdIzC ;Sets various data for sprite objects & screen then loop events
  272. -----------------------------
  273. Sub-event #10 ;Zero end dialogue
  274. -----------------------------
  275. $03/A9B4 C6 3C       DEC $3C    [$00:0D04]   A:0402 X:0010 Y:0000 P:envMXdIzc ;Decrease delay timer from $7E:0D04
  276. $03/A9B6 F0 08       BEQ $08    [$A9C0]      A:0402 X:0010 Y:0000 P:envMXdIzc ;If == 00, BEQ to $03/A9C0
  277. $03/A9B8 22 4A B9 04 JSL $04B94A[$04:B94A]   A:0402 X:0010 Y:0000 P:envMXdIzc ;Load alternate force VRAM update? (Can be changed to 04:BCA2 and it works just fine still?)
  278. $03/A9BC 5C 36 D6 02 JMP $02D636[$02:D636]   A:0402 X:0010 Y:0000 P:envMXdIzc ;Sets various data for sprite objects & screen then loop events
  279.  
  280. $03/A9C0 E6 02       INC $02    [$00:0CCA]   A:0402 X:0010 Y:0000 P:envMXdIZc ;Increase Introduction Spycopter Event to 12
  281. $03/A9C2 E6 02       INC $02    [$00:0CCA]   A:0402 X:0010 Y:0000 P:envMXdIzc ;Increase Introduction Spycopter Event to 12
  282. $03/A9C4 A9 11       LDA #$11                A:0402 X:0010 Y:0000 P:envMXdIzc ;Load teleport out SFX
  283. $03/A9C6 22 2B 80 01 JSL $01802B[$01:802B]   A:0411 X:0010 Y:0000 P:envMXdIzc ;Load routine for SFX
  284. $03/A9CA A9 7F       LDA #$7F                A:0412 X:0010 Y:0000 P:envMXdIzc ;Load Zero begin teleporting out animation
  285. $03/A9CC 4C 04 BB    JMP $BB04  [$03:BB04]   A:047F X:0010 Y:0000 P:envMXdIzc ;Load routine for NPC consistent single frame VRAM storage/update next frame VRAM if needed. [MAKE UNIVERSAL]
  286.  
  287. -----------------------------
  288. Sub-event #12 ;Begin Zero teleport
  289. -----------------------------
  290. $03/A9CF A5 0F       LDA $0F    [$00:0CD7]   A:0402 X:0012 Y:0000 P:envMXdIzc ;Load flag to check if NPC needs to update their VRAM data
  291. $03/A9D1 30 03       BMI $03    [$A9D6]      A:0400 X:0012 Y:0000 P:envMXdIZc If so, BMI to $03/A9D1
  292. $03/A9D3 4C 11 BB    JMP $BB11  [$03:BB11]   A:0400 X:0012 Y:0000 P:envMXdIZc ;Load routine for NPC consistent animation data update/storing VRAM if needed. [MAKE UNIVERSAL]
  293.  
  294. $03/A9D6 E6 02       INC $02    [$00:0CCA]   A:0480 X:0012 Y:0000 P:eNvMXdIzc ;Increase Introduction Spycopter Event to 14
  295. $03/A9D8 E6 02       INC $02    [$00:0CCA]   A:0480 X:0012 Y:0000 P:envMXdIzc ;Increase Introduction Spycopter Event to 14
  296. $03/A9DA C2 20       REP #$20                A:0480 X:0012 Y:0000 P:envMXdIzc ;Set to 16-bit reading on A/X/Y
  297. $03/A9DC A9 A6 0A    LDA #$0AA6              A:0480 X:0012 Y:0000 P:envmXdIzc ;Load velocity of Zero
  298. $03/A9DF 85 1C       STA $1C    [$00:0CE4]   A:0AA6 X:0012 Y:0000 P:envmXdIzc ;Store to PC NPC RAM at $7E:0CE4 (PC NPC Velocity)
  299. $03/A9E1 E2 20       SEP #$20                A:0AA6 X:0012 Y:0000 P:envmXdIzc ;Set to 8-bit reading on A/X/Y
  300. $03/A9E3 A9 10       LDA #$10                A:0AA6 X:0012 Y:0000 P:envMXdIzc ;Load teleport out SFX #2
  301. $03/A9E5 22 2B 80 01 JSL $01802B[$01:802B]   A:0A10 X:0012 Y:0000 P:envMXdIzc ;Load routine for SFX
  302. $03/A9E9 A9 7D       LDA #$7D                A:0A14 X:0012 Y:0000 P:EnvMXdIzc ;Load Zero teleport out animation
  303. $03/A9EB 4C 04 BB    JMP $BB04  [$03:BB04]   A:0A7D X:0012 Y:0000 P:EnvMXdIzc ;Load routine for NPC consistent single frame VRAM storage/update next frame VRAM if needed. [MAKE UNIVERSAL]
  304.  
  305. -----------------------------
  306. Sub-event #14 ;Zero teleporting out
  307. -----------------------------
  308. $03/A9EE 22 12 D8 02 JSL $02D812[$02:D812]   A:0402 X:0014 Y:0000 P:envMXdIzc ;Load routine to move NPC off screen with Velocity only?
  309. $03/A9F2 A5 0E       LDA $0E    [$00:0CD6]   A:A604 X:0014 Y:0000 P:envMXdIzc ;Load whether NPC is still active from NPC RAM $7E:0CD6
  310. $03/A9F4 F0 04       BEQ $04    [$A9FA]      A:A681 X:0014 Y:0000 P:eNvMXdIzc ;If == 00 (Not active), BEQ to $03/A9FA
  311. $03/A9F6 5C 36 D6 02 JMP $02D636[$02:D636]   A:A681 X:0014 Y:0000 P:eNvMXdIzc ;Sets various data for sprite objects & screen then loop events
  312.  
  313. $03/A9FA E6 02       INC $02    [$00:0002]   A:0000 X:0000 Y:0000 P:EnvMXdIzc ;Increase Introduction Spycopter Event to 16
  314. $03/A9FC E6 02       INC $02    [$00:0002]   A:0000 X:0000 Y:0000 P:EnvMXdIzc ;Increase Introduction Spycopter Event to 16
  315. $03/A9FE 6B          RTL                     A:0000 X:0000 Y:0000 P:EnvMXdIzc ;Return long
  316. -----------------------------
  317. Sub-event #16 ;End Introduction event
  318. -----------------------------
  319. $03/A9FF 64 00       STZ $00    [$00:0CC8]   A:0402 X:0016 Y:0000 P:envMXdIzc ;Store 00 to NPC RAM at $7E:0CC8 so NPC is removed from screen
  320. $03/AA01 6B          RTL                     A:0402 X:0016 Y:0000 P:envMXdIzc ;Return long
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement