; $A0F5: Initialisation AI - enemy $E13F/$E17F (Ridley) { $A6:A0F5 AE 9F 07 LDX $079F [$7E:079F] ; Region number (2 = Norfair) $A6:A0F8 BF 28 D8 7E LDA $7ED828,x[$7E:D82E] ; Boss bit table $A6:A0FC 29 01 00 AND #$0001 ; First boss bit of current Region (Ridley, in this case) $A6:A0FF F0 0D BEQ $0D [$A10E] ; Is this if she's dead? { $A6:A101 AD 86 0F LDA $0F86 [$7E:0F86] ; Property bits of Ridley $A6:A104 29 FF FF AND #$FFFF $A6:A107 09 00 07 ORA #$0700 $A6:A10A 8D 86 0F STA $0F86 [$7E:0F86] ; Property bits of Ridley $A6:A10D 6B RTL } $A6:A10E 8B PHB $A6:A10F F4 7E 7E PEA $7E7E $A6:A112 AB PLB $A6:A113 AB PLB ; STZ $2000-$2FFE { $A6:A114 A9 00 00 LDA #$0000 $A6:A117 A2 FE 0F LDX #$0FFE $A6:A11A 9D 00 20 STA $2000,x[$7E:2FFE] $A6:A11D CA DEX $A6:A11E CA DEX $A6:A11F 10 F9 BPL $F9 [$A11A] } $A6:A121 AB PLB $A6:A122 22 E2 A7 90 JSL $90A7E2[$90:A7E2] ; Clear automap $A6:A126 9C B4 0F STZ $0FB4 [$7E:0FB4] $A6:A129 9C B6 0F STZ $0FB6 [$7E:0FB6] ; Set PLM instruction? $A6:A12C A9 38 E5 LDA #$E538 ; Initialization PLM $A6:A12F 20 67 D4 JSR $D467 [$A6:D467] $A6:A132 A9 00 0E LDA #$0E00 $A6:A135 8D 96 0F STA $0F96 [$7E:0F96] ; Palette $A6:A138 8F 18 78 7E STA $7E7818[$7E:7818] $A6:A13C AD 88 0F LDA $0F88 [$7E:0F88] $A6:A13F 09 04 00 ORA #$0004 $A6:A142 8D 88 0F STA $0F88 [$7E:0F88] $A6:A145 A9 00 00 LDA #$0000 $A6:A148 8F 02 78 7E STA $7E7802[$7E:7802] $A6:A14C 8F 1A 78 7E STA $7E781A[$7E:781A] $A6:A150 9C 3E 18 STZ $183E [$7E:183E] $A6:A153 9C 40 18 STZ $1840 [$7E:1840] $A6:A156 20 D6 D2 JSR $D2D6 [$A6:D2D6] ; Initialize tail stuff? $A6:A159 20 FD D9 JSR $D9FD [$A6:D9FD] ; Store DA71 to 7E:780A, 1 to 7E:780C $A6:A15C AD 9F 07 LDA $079F [$7E:079F] ; Region number (2 = Norfair) $A6:A15F C9 02 00 CMP #$0002 $A6:A162 F0 03 BEQ $03 [$A167] $A6:A164 4C EE A1 JMP $A1EE [$A6:A1EE] $A6:A167 AD 86 0F LDA $0F86 [$7E:0F86] ; Property bits of Ridley $A6:A16A 09 00 14 ORA #$1400 $A6:A16D 8D 86 0F STA $0F86 [$7E:0F86] ; Property bits of Ridley $A6:A170 A9 60 00 LDA #$0060 $A6:A173 8D 7A 0F STA $0F7A [$7E:0F7A] ; Ridley's X position $A6:A176 A9 8A 01 LDA #$018A $A6:A179 8D 7E 0F STA $0F7E [$7E:0F7E] ; Ridley's Y position $A6:A17C A9 F3 B2 LDA #$B2F3 ; Startup liftoff, facing right $A6:A17F A9 5B A3 LDA #$A35B ; Startup 1st run $A6:A182 8D A8 0F STA $0FA8 [$7E:0FA8] $A6:A185 9C AA 0F STZ $0FAA [$7E:0FAA] ; X speed (1/100 pixels) $A6:A188 9C AC 0F STZ $0FAC [$7E:0FAC] ; Y speed (1/100 pixels) $A6:A18B A9 05 00 LDA #$0005 $A6:A18E 8D 9A 0F STA $0F9A [$7E:0F9A] $A6:A191 A9 00 00 LDA #$0000 $A6:A194 8F 02 78 7E STA $7E7802[$7E:7802] $A6:A198 1A INC A $A6:A199 8F 04 78 7E STA $7E7804[$7E:7804] ; Set if Ridley is active $A6:A19D A9 40 00 LDA #$0040 $A6:A1A0 8F 00 80 7E STA $7E8000[$7E:8000] $A6:A1A4 A9 A0 01 LDA #$01A0 $A6:A1A7 8F 02 80 7E STA $7E8002[$7E:8002] $A6:A1AB A9 40 00 LDA #$0040 $A6:A1AE 8F 04 80 7E STA $7E8004[$7E:8004] $A6:A1B2 A9 E0 00 LDA #$00E0 $A6:A1B5 8F 06 80 7E STA $7E8006[$7E:8006] $A6:A1B9 A9 02 00 LDA #$0002 $A6:A1BC 8F 20 78 7E STA $7E7820[$7E:7820] ; Ridley's direction (0 = left, 2 = right) $A6:A1C0 A9 78 00 LDA #$0078 $A6:A1C3 8F 38 78 7E STA $7E7838[$7E:7838] $A6:A1C7 A0 CF E1 LDY #$E1CF $A6:A1CA A2 40 01 LDX #$0140 $A6:A1CD A9 20 00 LDA #$0020 $A6:A1D0 22 F6 D2 A9 JSL $A9D2F6[$A9:D2F6] $A6:A1D4 A2 E2 00 LDX #$00E2 $A6:A1D7 A2 00 00 LDX #$0000 $A6:A1DA A0 0F 00 LDY #$000F $A6:A1DD A9 00 00 LDA #$0000 $A6:A1E0 9F E2 C2 7E STA $7EC2E2,x[$7E:C2E2] $A6:A1E4 9F E2 C3 7E STA $7EC3E2,x[$7E:C3E2] $A6:A1E8 E8 INX $A6:A1E9 E8 INX $A6:A1EA 88 DEY $A6:A1EB D0 F3 BNE $F3 [$A1E0] $A6:A1ED 6B RTL $A6:A1EE AD 86 0F LDA $0F86 [$7E:0F86] ; Property bits of Ridley $A6:A1F1 09 00 14 ORA #$1400 $A6:A1F4 8D 86 0F STA $0F86 [$7E:0F86] ; Property bits of Ridley $A6:A1F7 A9 BA 00 LDA #$00BA $A6:A1FA 8D 7A 0F STA $0F7A [$7E:0F7A] ; Ridley's X position $A6:A1FD A9 A9 00 LDA #$00A9 $A6:A200 8D 7E 0F STA $0F7E [$7E:0F7E] ; Ridley's Y position $A6:A203 A9 00 00 LDA #$0000 $A6:A206 8D 3F 09 STA $093F [$7E:093F] $A6:A209 8F 20 78 7E STA $7E7820[$7E:7820] ; Ridley's direction (0 = left, 2 = right) $A6:A20D 8F 04 78 7E STA $7E7804[$7E:7804] ; Set if Ridley is active $A6:A211 1A INC A $A6:A212 8F 02 20 7E STA $7E2002[$7E:2002] $A6:A216 A9 0F 00 LDA #$000F $A6:A219 8F 38 78 7E STA $7E7838[$7E:7838] $A6:A21D A9 5B A3 LDA #$A35B ; Startup 1st run $A6:A220 8D A8 0F STA $0FA8 [$7E:0FA8] $A6:A223 9C AA 0F STZ $0FAA [$7E:0FAA] ; X speed (1/100 pixels) $A6:A226 9C AC 0F STZ $0FAC [$7E:0FAC] ; Y speed (1/100 pixels) $A6:A229 A9 E0 FF LDA #$FFE0 $A6:A22C 8F 00 80 7E STA $7E8000[$7E:8000] $A6:A230 A9 B0 00 LDA #$00B0 $A6:A233 8F 02 80 7E STA $7E8002[$7E:8002] $A6:A237 A9 28 00 LDA #$0028 $A6:A23A 8F 04 80 7E STA $7E8004[$7E:8004] $A6:A23E A9 E0 00 LDA #$00E0 $A6:A241 8F 06 80 7E STA $7E8006[$7E:8006] $A6:A245 A0 6F E1 LDY #$E16F $A6:A248 A2 40 01 LDX #$0140 $A6:A24B A9 20 00 LDA #$0020 $A6:A24E 22 F6 D2 A9 JSL $A9D2F6[$A9:D2F6] $A6:A252 A2 E2 01 LDX #$01E2 $A6:A255 A0 0F 00 LDY #$000F $A6:A258 A9 00 00 LDA #$0000 $A6:A25B 9F 00 C2 7E STA $7EC200,x[$7E:C3E2] $A6:A25F E8 INX $A6:A260 E8 INX $A6:A261 88 DEY $A6:A262 D0 F7 BNE $F7 [$A25B] $A6:A264 A9 31 BF LDA #$BF31 $A6:A267 8F 06 78 7E STA $7E7806[$7E:7806] $A6:A26B A9 01 00 LDA #$0001 $A6:A26E 8F 08 78 7E STA $7E7808[$7E:7808] $A6:A272 A9 9C BE LDA #$BE9C $A6:A275 8F 00 88 7E STA $7E8800[$7E:8800] $A6:A279 A9 05 00 LDA #$0005 $A6:A27C 8F 0E 78 7E STA $7E780E[$7E:780E] $A6:A280 A9 00 00 LDA #$0000 ; \ $A6:A283 22 C1 8F 80 JSL $808FC1[$80:8FC1] ; } Queue music track 0 $A6:A287 6B RTL } ; $B227: Main AI - enemy $E17F (Ridley) { $A6:B227 AF 08 80 7E LDA $7E8008[$7E:8008] $A6:B22B 38 SEC $A6:B22C E9 04 00 SBC #$0004 $A6:B22F 10 03 BPL $03 [$B234] $A6:B231 A9 00 00 LDA #$0000 $A6:B234 8F 08 80 7E STA $7E8008[$7E:8008] $A6:B238 20 B4 BC JSR $BCB4 [$A6:BCB4] $A6:B23B 20 2C BD JSR $BD2C [$A6:BD2C] ; Powerbomb check/reaction $A6:B23E F4 43 B2 PEA $B243 $A6:B241 6C A8 0F JMP ($0FA8)[$A6:A35B] $A6:B244 AF 04 78 7E LDA $7E7804[$7E:7804] ; Set if Ridley is active $A6:B248 F0 21 BEQ $21 [$B26B] $A6:B24A 20 DA D4 JSR $D4DA [$A6:D4DA] $A6:B24D 20 6B D8 JSR $D86B [$A6:D86B] ; Handles movement and main body wall collisions $A6:B250 20 7D D9 JSR $D97D [$A6:D97D] ; Handle wing flapping $A6:B253 20 F5 CA JSR $CAF5 [$A6:CAF5] ; Run Tail AI: Sound, control AI, X/Y positions, tail extension, hurt Samus $A6:B256 20 88 E0 JSR $E088 [$A6:E088] ; Tail tip kills projectiles $A6:B259 20 2A DB JSR $DB2A [$A6:DB2A] ; Draw tail $A6:B25C 20 D8 DA JSR $DAD8 [$A6:DAD8] ; Drawing routine for Ridley's wings $A6:B25F 20 0C DA JSR $DA0C [$A6:DA0C] ; Animate Ridley's ribs $A6:B262 AF 36 78 7E LDA $7E7836[$7E:7836] ; Set if Ridley is holding Samus $A6:B266 F0 03 BEQ $03 [$B26B] $A6:B268 20 E1 B9 JSR $B9E1 [$A6:B9E1] ; If holding Samus, move Samus to Ridley's claws $A6:B26B 20 74 D4 JSR $D474 [$A6:D474] ; Determine and set Ridley's speed & palette $A6:B26E 6B RTL } ; $B28A: X-ray AI - enemy $E17F (Ridley) { $A6:B28A A9 00 00 LDA #$0000 $A6:B28D 8F 08 80 7E STA $7E8008[$7E:8008] $A6:B291 A9 01 00 LDA #$0001 $A6:B294 8D A4 0F STA $0FA4 [$7E:0FA4] } ; $B297: Hurt AI - enemy $E17F (Ridley) { $A6:B297 AD A4 0F LDA $0FA4 [$7E:0FA4] $A6:B29A 29 01 00 AND #$0001 $A6:B29D D0 1B BNE $1B [$B2BA] $A6:B29F 20 B4 BC JSR $BCB4 [$A6:BCB4] $A6:B2A2 20 2C BD JSR $BD2C [$A6:BD2C] ; Powerbomb check/reaction $A6:B2A5 F4 AA B2 PEA $B2AA $A6:B2A8 6C A8 0F JMP ($0FA8)[$A6:A478] $A6:B2AB AF 04 78 7E LDA $7E7804[$7E:7804] ; Set if Ridley is active $A6:B2AF F0 38 BEQ $38 [$B2E9] $A6:B2B1 20 6B D8 JSR $D86B [$A6:D86B] ; Handles movement and main body wall collisions $A6:B2B4 20 7D D9 JSR $D97D [$A6:D97D] ; Handle wing flapping $A6:B2B7 20 F5 CA JSR $CAF5 [$A6:CAF5] ; Run Tail AI: Sound, control AI, X/Y positions, tail extension, hurt Samus $A6:B2BA 20 88 E0 JSR $E088 [$A6:E088] ; Tail tip kills projectiles $A6:B2BD 20 DA D4 JSR $D4DA [$A6:D4DA] $A6:B2C0 20 2A DB JSR $DB2A [$A6:DB2A] ; Draw tail $A6:B2C3 20 D8 DA JSR $DAD8 [$A6:DAD8] ; Drawing routine for Ridley's wings $A6:B2C6 20 74 D4 JSR $D474 [$A6:D474] ; Determine and set Ridley's speed & palette $A6:B2C9 20 0C DA JSR $DA0C [$A6:DA0C] ; Animate Ridley's ribs $A6:B2CC AF 08 80 7E LDA $7E8008[$7E:8008] $A6:B2D0 18 CLC $A6:B2D1 69 01 00 ADC #$0001 $A6:B2D4 CD 88 B2 CMP $B288 [$A6:B288] $A6:B2D7 30 03 BMI $03 [$B2DC] $A6:B2D9 AD 88 B2 LDA $B288 [$A6:B288] $A6:B2DC 8F 08 80 7E STA $7E8008[$7E:8008] $A6:B2E0 AF 08 80 7E LDA $7E8008[$7E:8008] $A6:B2E4 CD 88 B2 CMP $B288 [$A6:B288] $A6:B2E7 30 09 BMI $09 [$B2F2] $A6:B2E9 AF 36 78 7E LDA $7E7836[$7E:7836] ; Set if Ridley is holding Samus $A6:B2ED F0 03 BEQ $03 [$B2F2] $A6:B2EF ; .. Code missing .. $A6:B2F2 6B RTL ; Data used here { $A6:B288 db 08, 00 } } ; $DF8A: Enemy shot - enemy $E13F/$E17F (Ridley) { $A6:DF8A AD 9F 07 LDA $079F [$7E:079F] ; Region number (2 = Norfair) $A6:DF8D C9 02 00 CMP #$0002 $A6:DF90 F0 1A BEQ $1A [$DFAC] $A6:DF92 ; ..Code missing.. $A6:DFAC 22 A7 A6 A0 JSL $A0A6A7[$A0:A6A7] $A6:DFB0 80 04 BRA $04 [$DFB6] } ; $DFB2: Power bomb reaction - enemy $E13F/$E17F (Ridley) { $A6:DFB2 22 B7 A5 A0 JSL $A0A5B7[$A0:A5B7] } ; $DFB6: Ridley reaction { $A6:DFB6 6B RTL }