;;; Kraid lint hitbox entry ;;; $A792B5 dw 0001, FFE8,FFFC,0004,0006,948B,94B5 ;$A792C3 dw 0001, FFF8,FFF8,0007,0007,948B,94B5 ;;; Kraid graph AI ;;; $A7AC21 20 AA AF JSR $AFAA [$A7:AFAA] ; Kraid's mouth projectile collision detection $A7AC24 20 37 B3 JSR $B337 [$A7:B337] ; Kraid palette handling $A7AC27 20 81 B1 JSR $B181 [$A7:B181] ; Kraid collision detection - projectiles $A7AC2A 20 F3 B0 JSR $B0F3 [$A7:B0F3] ; Kraid collision detection - Samus $A7AC2D AE 54 0E LDX $0E54 [$7E:0E54] $A7AC30 A5 B1 LDA $B1 [$7E:00B1] ;\ $A7AC32 38 SEC ;| $A7AC33 ED 1D 09 SBC $091D [$7E:091D] ;| $A7AC36 ED 7A 0F SBC $0F7A [$7E:0F7A] ;} BG2 X scroll offset = BG1 X scroll offset - Kraid right boundary $A7AC39 6D 82 0F ADC $0F82 [$7E:0F82] ;| $A7AC3C 85 B5 STA $B5 [$7E:00B5] ;/ $A7AC3E AD 15 09 LDA $0915 [$7E:0915] ;\ $A7AC41 38 SEC ;| $A7AC42 ED 7E 0F SBC $0F7E [$7E:0F7E] ;} BG2 Y scroll offset = BG1 Y position - Kraid Y position + 98h $A7AC45 69 98 00 ADC #$0098 ;| $A7AC48 85 B7 STA $B7 [$7E:00B7] ;/ $A7AC4A 6C A8 0F JMP ($0FA8)[$A7:C865] ; Execute Kraid instruction ;;; Kraid's mouth projectile collision detection ;;; $A7AFAA C2 30 REP #$30 $A7AFAC DA PHX $A7AFAD AD A8 0F LDA $0FA8 [$7E:0FA8] ;\ $A7AFB0 C9 37 C5 CMP #$C537 ;} If Kraid function >= $C537 (dying): return $A7AFB3 30 02 BMI $02 [$AFB7] ;/ $A7AFB5 FA PLX $A7AFB6 60 RTS $A7AFB7 AD AA 0F LDA $0FAA [$7E:0FAA] ;\ $A7AFBA 38 SEC ;| $A7AFBB E9 08 00 SBC #$0008 ;} A = [[$0FAA]-2] $A7AFBE AA TAX ;| $A7AFBF BD 06 00 LDA $0006,x[$A7:96D8] ;/ $A7AFC2 C9 FF FF CMP #$FFFF ;\ $A7AFC5 D0 06 BNE $06 [$AFCD] ;| $A7AFC7 A0 00 00 LDY #$0000 ;} If A == FFFFh (invulnerable): return $A7AFCA 4C 50 B0 JMP $B050 [$A7:B050] ;/ $A7AFCD AA TAX ; X = A $A7AFCE A9 01 00 LDA #$0001 ;\ $A7AFD1 8D B0 0F STA $0FB0 [$7E:0FB0] ;} $0FB0 = 1 $A7AFD4 A0 00 00 LDY #$0000 ; Clear Y $A7AFD7 BD 00 00 LDA $0000,x[$A7:97B0] ;\ $A7AFDA 18 CLC ;| $A7AFDB 6D 7A 0F ADC $0F7A [$7E:0F7A] ;} $16 = Kraid left boundary $A7AFDE 85 16 STA $16 [$7E:0016] ;/ $A7AFE0 BD 02 00 LDA $0002,x[$A7:97B2] ;\ $A7AFE3 18 CLC ;| $A7AFE4 6D 7E 0F ADC $0F7E [$7E:0F7E] ;} $14 = Kraid bottom boundary $A7AFE7 85 14 STA $14 [$7E:0014] ;/ $A7AFE9 BD 06 00 LDA $0006,x[$A7:97B6] ;\ $A7AFEC 18 CLC ;| $A7AFED 6D 7E 0F ADC $0F7E [$7E:0F7E] ;} $12 = Kraid top boundary $A7AFF0 85 12 STA $12 [$7E:0012] ;/ $A7AFF2 AD CE 0C LDA $0CCE [$7E:0CCE] ; A = projectile counter $A7AFF5 F0 59 BEQ $59 [$B050] ; If A == 0: return $A7AFF7 0A ASL A ;\ $A7AFF8 AA TAX ;} X = A*2 $A7AFF9 BD 78 0B LDA $0B78,x[$7E:0B7C] ;\ $A7AFFC 38 SEC ;| $A7AFFD FD C8 0B SBC $0BC8,x[$7E:0BCC] ;| $A7B000 3A DEC A ;| $A7B001 C5 12 CMP $12 [$7E:0012] ;| $A7B003 10 47 BPL $47 [$B04C] ;| $A7B005 BD 78 0B LDA $0B78,x[$7E:0B7C] ;| $A7B008 18 CLC ;| $A7B009 7D C8 0B ADC $0BC8,x[$7E:0BCC] ;| $A7B00C C5 14 CMP $14 [$7E:0014] ;| $A7B00E 30 3C BMI $3C [$B04C] ;| $A7B010 BD 64 0B LDA $0B64,x[$7E:0B66] ;} For each projectile within the boundaries of Kraid not an uncharged beam: $A7B013 18 CLC ;} (If charged beam: $7E780A |= 1) $A7B014 7D B4 0B ADC $0BB4,x[$7E:0BB6] ;| $A7B017 C5 16 CMP $16 [$7E:0016] ;| $A7B019 30 31 BMI $31 [$B04C] ;| $A7B01B BD 18 0C LDA $0C18,x[$7E:0C18] ;| $A7B01E 89 00 0F BIT #$0F00 ;| $A7B021 D0 10 BNE $10 [$B033] ;| $A7B023 89 10 00 BIT #$0010 ;| $A7B026 F0 24 BEQ $24 [$B04C] ;| $A7B028 AF 0A 78 7E LDA $7E780A[$7E:780A] ;| $A7B02C 09 01 00 ORA #$0001 ;| $A7B02F 8F 0A 78 7E STA $7E780A[$7E:780A] ;/ $A7B033 DA PHX $A7B034 8A TXA ;\ $A7B035 4A LSR A ;} Enemy-projectile collision detection index = X*2 $A7B036 8D A6 18 STA $18A6 [$7E:18A6] ;/ $A7B039 08 PHP $A7B03A 22 A7 A6 A0 JSL $A0A6A7[$A0:A6A7] ; Handles beam damage, freezing, and sound. Clears enemy hit flag $A7B03E 28 PLP $A7B03F FA PLX $A7B040 BD 04 0C LDA $0C04,x[$7E:0C04] ;\ $A7B043 09 10 00 ORA #$0010 ;} Kill projectile $A7B046 9D 04 0C STA $0C04,x[$7E:0C04] ;/ $A7B049 A0 01 00 LDY #$0001 ; Set Y $A7B04C CA DEX $A7B04D CA DEX $A7B04E 10 A9 BPL $A9 [$AFF9] $A7B050 FA PLX $A7B051 C0 00 00 CPY #$0000 $A7B054 D0 01 BNE $01 [$B057] $A7B056 60 RTS ; If Y set: $A7B057 A9 06 00 LDA #$0006 ;\ $A7B05A 8F 2A 78 7E STA $7E782A[$7E:782A] ;} $7E782A = 6 $A7B05E A9 02 00 LDA #$0002 ;\ $A7B061 8F 2C 78 7E STA $7E782C[$7E:782C] ;} $7E782C = 2 $A7B065 AF 0A 78 7E LDA $7E780A[$7E:780A] ;\ $A7B069 89 02 00 BIT #$0002 ;} If [$7E780A] has 2: $A7B06C F0 07 BEQ $07 [$B075] ;/ $A7B06E 09 04 00 ORA #$0004 ;\ $A7B071 8F 0A 78 7E STA $7E780A[$7E:780A] ;} $7E780A |= 4 $A7B075 AD 8C 0F LDA $0F8C [$7E:0F8C] ;\ $A7B078 C9 01 00 CMP #$0001 ;} If Kraid health >= 1: return $A7B07B 30 01 BMI $01 [$B07E] ;/ $A7B07D 60 RTS ; $A7B07E AD A8 0F LDA $0FA8 [$7E:0FA8] ;\ $A7B081 C9 60 C3 CMP #$C360 ;} If Kraid function >= $C360: return $A7B084 10 44 BPL $44 [$B0CA] ;/ $A7B086 A9 60 C3 LDA #$C360 ;\ $A7B089 8D A8 0F STA $0FA8 [$7E:0FA8] ;} Kraid function = $C360 $A7B08C A9 00 00 LDA #$0000 ;\ $A7B08F 8F 0A 78 7E STA $7E780A[$7E:780A] ;} $78780A = 0 $A7B093 AD 86 0F LDA $0F86 [$7E:0F86] ;\ $A7B096 09 00 04 ORA #$0400 ;} Set Kraid to ignore Samus/projectiles $A7B099 8D 86 0F STA $0F86 [$7E:0F86] ;/ $A7B09C A9 FF DF LDA #$DFFF ;\ $A7B09F 85 12 STA $12 [$7E:0012] ;} $12 = DFFFh (tile priority anti-mask) $A7B0A1 20 C6 AA JSR $AAC6 [$A7:AAC6] ;} Set up Kraid graphics with the tile priority cleared $A7B0A4 A2 00 00 LDX #$0000 ;\ ;| $A7B0A7 BD 86 0F LDA $0F86,x[$7E:0F86] ;| $A7B0AA 09 00 04 ORA #$0400 ;| $A7B0AD 9D 86 0F STA $0F86,x[$7E:0F86] ;| $A7B0B0 8A TXA ;} Set Kraid arm, lint and foot to ignore Samus/projectiles $A7B0B1 18 CLC ;| $A7B0B2 69 40 00 ADC #$0040 ;| $A7B0B5 AA TAX ;| $A7B0B6 E0 80 01 CPX #$0180 ;| $A7B0B9 30 EC BMI $EC [$B0A7] ;/ $A7B0BB AD AA 0F LDA $0FAA [$7E:0FAA] ;\ $A7B0BE C9 0E 97 CMP #$970E ;} If [$0FAA] < $970E: $A7B0C1 10 07 BPL $07 [$B0CA] ;/ $A7B0C3 18 CLC ;\ $A7B0C4 69 3C 00 ADC #$003C ;} $0FAA += 3Ch $A7B0C7 8D AA 0F STA $0FAA [$7E:0FAA] ;/ $A7B0CA 60 RTS ;;; Kraid collision detection - Samus ;;; $A7B0F3 AD A8 0F LDA $0FA8 [$7E:0FA8] ;\ $A7B0F6 C9 60 C3 CMP #$C360 ;} If Kraid function >= $C360: return $A7B0F9 10 64 BPL $64 [$B15F] ;/ $A7B0FB AD F6 0A LDA $0AF6 [$7E:0AF6] ;\ $A7B0FE 18 CLC ;| $A7B0FF 6D FE 0A ADC $0AFE [$7E:0AFE] ;} $12 = Samus right boundary $A7B102 85 12 STA $12 [$7E:0012] ;/ $A7B104 AD FA 0A LDA $0AFA [$7E:0AFA] ;\ $A7B107 38 SEC ;| $A7B108 ED 7E 0F SBC $0F7E [$7E:0F7E] ;| $A7B10B A2 00 00 LDX #$0000 ;| ;| $A7B10E DD 61 B1 CMP $B161,x[$A7:B161] ;| $A7B111 10 0B BPL $0B [$B11E] ;| $A7B113 DD 65 B1 CMP $B165,x[$A7:B165] ;} X = index of first entry >= Samus Y position - Kraid Y position $A7B116 10 06 BPL $06 [$B11E] ;| $A7B118 E8 INX ;| $A7B119 E8 INX ;| $A7B11A E8 INX ;| $A7B11B E8 INX ;| $A7B11C 80 F0 BRA $F0 [$B10E] ;/ $A7B11E BD 63 B1 LDA $B163,x[$A7:B173] ;\ $A7B121 18 CLC ;| $A7B122 6D 7A 0F ADC $0F7A [$7E:0F7A] ;| $A7B125 38 SEC ;} If Kraid X position + [$B163+X] >= Samus right boundary: return $A7B126 E5 12 SBC $12 [$7E:0012] ;| $A7B128 10 36 BPL $36 [$B160] ;/ $A7B12A AD F6 0A LDA $0AF6 [$82:0AF6] ;\ $A7B12D C9 28 00 CMP #$0028 ;} If Samus X position >= 40: $A7B130 30 0A BMI $0A [$B13C] ;/ $A7B132 38 SEC ;\ $A7B133 E9 08 00 SBC #$0008 ;} Samus X position -= 8 $A7B136 8D F6 0A STA $0AF6 [$82:0AF6] ;/ $A7B139 8D 10 0B STA $0B10 [$82:0B10] ; Previous Samus X position = Samus X position $A7B13C AD FA 0A LDA $0AFA [$82:0AFA] ;\ $A7B13F 38 SEC ;} A = Samus Y position - 8 $A7B140 E9 08 00 SBC #$0008 ;/ $A7B143 CF 08 78 7E CMP $7E7808[$7E:7808] ;\ $A7B147 10 04 BPL $04 [$B14D] ;} If A < [$7E7808]: $A7B149 AF 08 78 7E LDA $7E7808[$7E:7808] ; A = [$7E7808] $A7B14D 8D FA 0A STA $0AFA [$82:0AFA] ;\ $A7B150 8D 14 0B STA $0B14 [$82:0B14] ;} Samus Y position = previous Samus Y position = A $A7B153 20 A4 94 JSR $94A4 [$81:94A4] ; Knock Samus back $A7B156 AD A8 18 LDA $18A8 [$82:18A8] ;\ $A7B159 D0 05 BNE $05 [$B160] ;} If Samus invincibility timer == 0: $A7B15B 22 77 A4 A0 JSL $A0A477[$A0:A477] ; Normal enemy touch AI $A7B15F 60 RTS $A7B160 60 RTS $A7B161 dw 03FF,FFD0, 0010,FFD0, 0000,FFE0, FFE0,FFE8, FFD0,FFF8, FFB0,0000, FF90,0008, 8000,0008 ;;; Kraid collision detection - projectiles ;;; $A7B181 DA PHX $A7B182 AD A8 0F LDA $0FA8 [$7E:0FA8] ;\ $A7B185 C9 37 C5 CMP #$C537 ;} If Kraid function >= $C537: return $A7B188 30 02 BMI $02 [$B18C] ;/ $A7B18A FA PLX $A7B18B 60 RTS $A7B18C 9C B0 0F STZ $0FB0 [$7E:0FB0] ; $0FB0 = 0 $A7B18F AF 0A 78 7E LDA $7E780A[$7E:780A] ;\ $A7B193 29 FE FF AND #$FFFE ;} $7E780A &= !0001 $A7B196 8F 0A 78 7E STA $7E780A[$7E:780A] ;/ $A7B19A 64 30 STZ $30 [$7E:0030] ; $30 = 0 $A7B19C AD AA 0F LDA $0FAA [$7E:0FAA] ;\ $A7B19F 38 SEC ;| $A7B1A0 E9 08 00 SBC #$0008 ;| $A7B1A3 AA TAX ;} X = [[$0FAA]-4] $A7B1A4 BD 04 00 LDA $0004,x[$A7:96D6] ;| $A7B1A7 AA TAX ;/ $A7B1A8 BD 00 00 LDA $0000,x[$A7:9788] ;\ $A7B1AB 18 CLC ;| $A7B1AC 6D 7A 0F ADC $0F7A [$7E:0F7A] ;} $16 = Kraid left boundary $A7B1AF 85 16 STA $16 [$7E:0016] ;/ $A7B1B1 BD 02 00 LDA $0002,x[$A7:978A] ;\ $A7B1B4 18 CLC ;| $A7B1B5 6D 7E 0F ADC $0F7E [$7E:0F7E] ;} $14 = Kraid bottom boundary $A7B1B8 85 14 STA $14 [$7E:0014] ;/ $A7B1BA BD 06 00 LDA $0006,x[$A7:978E] ;\ $A7B1BD 18 CLC ;| $A7B1BE 6D 7E 0F ADC $0F7E [$7E:0F7E] ;} $12 = Kraid top boundary $A7B1C1 85 12 STA $12 [$7E:0012] ;/ $A7B1C3 AD CE 0C LDA $0CCE [$7E:0CCE] ; A = projectile counter $A7B1C6 F0 49 BEQ $49 [$B211] ; If A == 0: return $A7B1C8 0A ASL A ;\ $A7B1C9 AA TAX ;} X = A*2 $A7B1CA BD 78 0B LDA $0B78,x[$7E:0B7A] ;\ $A7B1CD 38 SEC ;| $A7B1CE FD C8 0B SBC $0BC8,x[$7E:0BCA] ;| $A7B1D1 3A DEC A ;} If projectile top boundary > Kraid top boundary: branch to $B238 $A7B1D2 C5 12 CMP $12 [$7E:0012] ;| $A7B1D4 10 62 BPL $62 [$B238] ;/ $A7B1D6 BD 78 0B LDA $0B78,x[$7E:0B7A] ;\ $A7B1D9 18 CLC ;| $A7B1DA 7D C8 0B ADC $0BC8,x[$7E:0BCA] ;} If projectile bottom boundary < Kraid bottom boundary: next! $A7B1DD C5 14 CMP $14 [$7E:0014] ;| $A7B1DF 30 2C BMI $2C [$B20D] ;/ $A7B1E1 BD 64 0B LDA $0B64,x[$7E:0B64] ;\ $A7B1E4 18 CLC ;| $A7B1E5 7D B4 0B ADC $0BB4,x[$7E:0BB4] ;} If projectile right boundary < Kraid left boundary: next! $A7B1E8 C5 16 CMP $16 [$7E:0016] ;| $A7B1EA 30 21 BMI $21 [$B20D] ;/ $A7B1EC 20 CB B0 JSR $B0CB [$A7:B0CB] ; Spawn explosion enemy projectile $A7B1EF BD 04 0C LDA $0C04,x[$7E:0C04] ;\ $A7B1F2 09 10 00 ORA #$0010 ;} Kill beam $A7B1F5 9D 04 0C STA $0C04,x[$7E:0C04] ;/ $A7B1F8 BD 18 0C LDA $0C18,x[$7E:0C18] ;\ $A7B1FB 89 10 00 BIT #$0010 ;} If charged beam $A7B1FE F0 0B BEQ $0B [$B20B] ;/ $A7B200 AF 0A 78 7E LDA $7E780A[$7E:780A] ;\ $A7B204 09 01 00 ORA #$0001 ;} $7E780A |= 1 $A7B207 8F 0A 78 7E STA $7E780A[$7E:780A] ;/ $A7B20B E6 30 INC $30 [$7E:0030] ; ++$30 $A7B20D CA DEX ;\ $A7B20E CA DEX ;} Next! $A7B20F 10 B9 BPL $B9 [$B1CA] ;/ $A7B211 FA PLX $A7B212 A4 30 LDY $30 [$7E:0030] ;\ $A7B214 C0 00 00 CPY #$0000 ;} If [$30] == 0: return $A7B217 F0 1E BEQ $1E [$B237] ;/ $A7B219 AD A8 0F LDA $0FA8 [$7E:0FA8] ;\ $A7B21C C9 A4 AE CMP #$AEA4 ;} If Kraid function == $AEA4: return $A7B21F D0 16 BNE $16 [$B237] ;/ $A7B221 A9 BF B6 LDA #$B6BF ;\ $A7B224 8D A8 0F STA $0FA8 [$7E:0FA8] ;} Kraid function = $B6BF $A7B227 AF 0A 78 7E LDA $7E780A[$7E:780A] ;\ $A7B22B 89 01 00 BIT #$0001 ;} If [$7E780A] hasn't 0001: return $A7B22E F0 07 BEQ $07 [$B237] ;/ $A7B230 09 02 03 ORA #$0302 ;\ $A7B233 8F 0A 78 7E STA $7E780A[$7E:780A] ;} $7E780A |= 0302h $A7B237 60 RTS $A7B238 BD 64 0B LDA $0B64,x[$7E:0B66] ;\ $A7B23B 18 CLC ;| $A7B23C 7D B4 0B ADC $0BB4,x[$7E:0BB6] ;} $12 = projectile right boundary $A7B23F 85 12 STA $12 [$7E:0012] ;/ $A7B241 BD 78 0B LDA $0B78,x[$7E:0B7A] ;\ $A7B244 38 SEC ;| $A7B245 ED 7E 0F SBC $0F7E [$7E:0F7E] ;| $A7B248 A0 00 00 LDY #$0000 ;| ;| $A7B24B D9 61 B1 CMP $B161,y[$A7:B161] ;| $A7B24E 10 0B BPL $0B [$B25B] ;| $A7B250 D9 65 B1 CMP $B165,y[$A7:B165] ;} Y = index of first entry >= projectile Y position - Kraid Y position $A7B253 10 06 BPL $06 [$B25B] ;| $A7B255 C8 INY ;| $A7B256 C8 INY ;| $A7B257 C8 INY ;| $A7B258 C8 INY ;| $A7B259 80 F0 BRA $F0 [$B24B] ;/ $A7B25B B9 63 B1 LDA $B163,y[$A7:B177] ;\ $A7B25E 18 CLC ;| $A7B25F 6D 7A 0F ADC $0F7A [$7E:0F7A] ;| $A7B262 38 SEC ;} If Kraid X position + [$B163+X] >= projectile right boundary: next! $A7B263 E5 12 SBC $12 [$7E:0012] ;| $A7B265 10 A6 BPL $A6 [$B20D] ;/ $A7B267 80 83 BRA $83 [$B1EC] ; Branch to $B1EC ;;; Kraid palette handling ;;; $A7B337 DA PHX $A7B338 5A PHY $A7B339 AD 8C 0F LDA $0F8C [$7E:0F8C] ;\ $A7B33C C9 01 00 CMP #$0001 ;} If Kraid health < 1: $A7B33F 10 06 BPL $06 [$B347] ;/ $A7B341 8F 2A 78 7E STA $7E782A[$7E:782A] ; $7E782A = Kraid health $A7B345 80 21 BRA $21 [$B368] $A7B347 AF 2A 78 7E LDA $7E782A[$7E:782A] ;\ Else (Kraid health >= 1): $A7B34B F0 21 BEQ $21 [$B36E] ;} If [$7E782A] == 0: return $A7B34D AF 2C 78 7E LDA $7E782C[$7E:782C] ;\ $A7B351 3A DEC A ;} --$7E782C $A7B352 8F 2C 78 7E STA $7E782C[$7E:782C] ;/ $A7B356 D0 16 BNE $16 [$B36E] ; If [7E782C] != 0: return $A7B358 A9 02 00 LDA #$0002 ;\ $A7B35B 8F 2C 78 7E STA $7E782C[$7E:782C] ;} $7E782C = 2 $A7B35F AF 2A 78 7E LDA $7E782A[$7E:782A] ;\ $A7B363 3A DEC A ;} --$7E782A $A7B364 8F 2A 78 7E STA $7E782A[$7E:782A] ;/ $A7B368 20 71 B3 JSR $B371 [$A7:B371] ; Kraid hurt flash handling $A7B36B 20 94 B3 JSR $B394 [$A7:B394] ; Kraid health-based palette handling $A7B36E 7A PLY $A7B36F FA PLX $A7B370 60 RTS ;;; Kraid hurt flash handling ;;; $A7B371 A0 00 00 LDY #$0000 ; Y = 0 $A7B374 AF 2A 78 7E LDA $7E782A[$7E:782A] ;\ $A7B378 89 01 00 BIT #$0001 ;} If [$7E782A] is even: $A7B37B D0 03 BNE $03 [$B380] ;/ $A7B37D A0 20 00 LDY #$0020 ; Y = 20h $A7B380 A2 00 00 LDX #$0000 $A7B383 B9 13 B5 LDA $B513,y[$A7:B513] ;\ $A7B386 9F E0 C1 7E STA $7EC1E0,x[$7E:C1E0] ;| $A7B38A E8 INX ;| $A7B38B E8 INX ;| $A7B38C C8 INY ;} Enemy colour palette line 7 = [$B513+Y..$B532+Y] $A7B38D C8 INY ;| $A7B38E E0 20 00 CPX #$0020 ;| $A7B391 30 F0 BMI $F0 [$B383] ;/ $A7B393 60 RTS ;;; Kraid health-based palette handling ;;; $A7B394 A0 00 00 LDY #$0000 ; Y = 0 $A7B397 AF 2A 78 7E LDA $7E782A[$7E:782A] ;\ $A7B39B 89 01 00 BIT #$0001 ;} If [$7E782A] is even: $A7B39E D0 18 BNE $18 [$B3B8] ;/ $A7B3A0 A2 0E 00 LDX #$000E ;\ $A7B3A3 AD 8C 0F LDA $0F8C [$7E:0F8C] ;| ;| $A7B3A6 DF 0C 78 7E CMP $7E780C,x[$7E:781A] ;| $A7B3AA 10 04 BPL $04 [$B3B0] ;| $A7B3AC CA DEX ;| $A7B3AD CA DEX ;| $A7B3AE D0 F6 BNE $F6 [$B3A6] ;| ;} (Current eighth of health) * 32 $A7B3B0 E8 INX ;| $A7B3B1 E8 INX ;| $A7B3B2 8A TXA ;| $A7B3B3 0A ASL A ;| $A7B3B4 0A ASL A ;| $A7B3B5 0A ASL A ;| $A7B3B6 0A ASL A ;| $A7B3B7 A8 TAY ;/ $A7B3B8 A2 00 00 LDX #$0000 $A7B3BB B9 D3 B3 LDA $B3D3,y[$A7:B3D3] ;\ $A7B3BE 9F E0 C0 7E STA $7EC0E0,x[$7E:C0E0] ;| $A7B3C2 B9 13 B5 LDA $B513,y[$A7:B513] ;| $A7B3C5 9F E0 C1 7E STA $7EC1E0,x[$7E:C1E0] ;| $A7B3C9 C8 INY ;} Area colour palette line 7 = [$B3D3+Y..$B3F2+Y] $A7B3CA C8 INY ;} Enemy colour palette line 7 = [$B513+Y..$B532+Y] $A7B3CB E8 INX ;| $A7B3CC E8 INX ;| $A7B3CD E0 20 00 CPX #$0020 ;| $A7B3D0 30 E9 BMI $E9 [$B3BB] ;/ $A7B3D2 60 RTS ;;; Area colour palette line 7 ;;; $A7B3D3 dw 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF $A7B3F3 dw 0000, 559D, 1816, 100D, 127A, 0E17, 0DD3, 0970, 092D, 04CA, 0486, 0023, 0443, 3E52, 4AD5, 0000 $A7B413 dw 3800, 559D, 1816, 100D, 1A9B, 1637, 11F3, 0D8F, 0D4C, 08E9, 04A6, 0043, 0443, 4273, 52F6, 0000 $A7B433 dw 3800, 559D, 1816, 100D, 22DB, 1A77, 1A12, 15AE, 116C, 0D09, 08A6, 0444, 0423, 4A94, 5B38, 0000 $A7B453 dw 3800, 559D, 1816, 100D, 2AFC, 2297, 1E32, 19CD, 158B, 1128, 08C6, 0464, 0423, 4EB5, 6359, 0000 $A7B473 dw 3800, 559D, 1816, 100D, 331D, 2AB7, 2A91, 1E0C, 19AA, 1148, 0CE5, 0484, 0023, 52B5, 677B, 0000 $A7B493 dw 3800, 559D, 1816, 100D, 3B3E, 32D7, 32B0, 222B, 1DC9, 1567, 0D05, 04A4, 0023, 56D6, 6F9C, 0000 $A7B4B3 dw 3800, 559D, 1816, 100D, 437E, 3717, 32B0, 2A4A, 21E9, 1987, 1105, 08A5, 0003, 5EF7, 77DE, 0000 $A7B4D3 dw 3800, 559D, 1816, 100D, 4B9F, 3F37, 36D0, 2E69, 2608, 1DA6, 1125, 08C5, 0003, 6318, 7FFF, 0000 ; $A7B4F3 dw 3800, 0807, 0404, 0000, 127A, 0E17, 0DD3, 0970, 092D, 04CA, 0486, 0023, 0443, 3E52, 4AD5, 0000 ;;; Enemy colour palette line 7 ;;; $A7B513 dw 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF, 7FFF $A7B533 dw 0000, 559D, 1816, 100D, 127A, 0E17, 0DD3, 0970, 092D, 04CA, 0486, 0023, 0443, 3E52, 4AD5, 0000 $A7B553 dw 3800, 559D, 1816, 100D, 1A9B, 1637, 11F3, 0D8F, 0D4C, 08E9, 04A6, 0043, 0443, 4273, 52F6, 0000 $A7B573 dw 3800, 559D, 1816, 100D, 22DB, 1A77, 1A12, 15AE, 116C, 0D09, 08A6, 0444, 0423, 4A94, 5B38, 0000 $A7B593 dw 3800, 559D, 1816, 100D, 2AFC, 2297, 1E32, 19CD, 158B, 1128, 08C6, 0464, 0423, 4EB5, 6359, 0000 $A7B5B3 dw 3800, 559D, 1816, 100D, 331D, 2AB7, 2A91, 1E0C, 19AA, 1148, 0CE5, 0484, 0023, 52B5, 677B, 0000 $A7B5D3 dw 3800, 559D, 1816, 100D, 3B3E, 32D7, 32B0, 222B, 1DC9, 1567, 0D05, 04A4, 0023, 56D6, 6F9C, 0000 $A7B5F3 dw 3800, 559D, 1816, 100D, 437E, 3717, 32B0, 2A4A, 21E9, 1987, 1105, 08A5, 0003, 5EF7, 77DE, 0000 $A7B613 dw 3800, 559D, 1816, 100D, 4B9F, 3F37, 36D0, 2E69, 2608, 1DA6, 1125, 08C5, 0003, 6318, 7FFF, 0000 ;;; Kraid arm graph AI ;;; $A7B7BD AD 15 09 LDA $0915 [$7E:0915] ;\ $A7B7C0 18 CLC ;| $A7B7C1 69 E0 00 ADC #$00E0 ;} $12 = BG1 Y position + E0h $A7B7C4 85 12 STA $12 [$7E:0012] ;/ $A7B7C6 AD 7E 0F LDA $0F7E [$7E:0F7E] ;\ $A7B7C9 38 SEC ;| $A7B7CA E9 2C 00 SBC #$002C ;} Kraid arm Y position = Kraid Y position - 2Ch $A7B7CD 8D BE 0F STA $0FBE [$7E:0FBE] ;/ $A7B7D0 A8 TAY $A7B7D1 AD C6 0F LDA $0FC6 [$7E:0FC6] ;\ $A7B7D4 09 00 01 ORA #$0100 ;| $A7B7D7 CC 15 09 CPY $0915 [$7E:0915] ;| $A7B7DA 30 07 BMI $07 [$B7E3] ;} If BG1 Y position <= Kraid arm Y position < BG1 Y position + E0h $A7B7DC C4 12 CPY $12 [$7E:0012] ;} Set Kraid arm visible $A7B7DE 10 03 BPL $03 [$B7E3] ;} Else: Set Kraid arm invisible $A7B7E0 29 FF FE AND #$FEFF ;| ;| $A7B7E3 8D C6 0F STA $0FC6 [$7E:0FC6] ;/ $A7B7E6 AD 7A 0F LDA $0F7A [$7E:0F7A] ;\ $A7B7E9 18 CLC ;| $A7B7EA 69 00 00 ADC #$0000 ;} Kraid arm X position = Kraid X position $A7B7ED 8D BA 0F STA $0FBA [$7E:0FBA] ;/ $A7B7F0 AF 0A 78 7E LDA $7E780A[$7E:780A] ;\ $A7B7F4 89 00 FF BIT #$FF00 ;} If [$7E780B] set: $A7B7F7 F0 07 BEQ $07 [$B800] ;/ $A7B7F9 AD D4 0F LDA $0FD4 [$82:0FD4] ;\ $A7B7FC 1A INC A ;} Increment Kraid arm instruction delay $A7B7FD 8D D4 0F STA $0FD4 [$82:0FD4] ;/ $A7B800 6B RTL ;;; Kraid top lint graph AI ;;; $A7B801 A2 80 00 LDX #$0080 ; X = Kraid top lint enemy index $A7B804 A9 FF 7F LDA #$7FFF ;\ $A7B807 9D 94 0F STA $0F94,x[$7E:1014] ;} Kraid top lint instruction delay = 7FFFh $A7B80A 4C 22 B8 JMP $B822 [$A7:B822] ; Kraid lint graph AI ;;; Kraid middle lint graph AI ;;; $A7B80D A2 C0 00 LDX #$00C0 ; X = Kraid middle lint enemy index $A7B810 A9 FF 7F LDA #$7FFF ;\ $A7B813 9D 94 0F STA $0F94,x[$7E:1054] ;} Kraid top lint instruction delay = 7FFFh $A7B816 4C 22 B8 JMP $B822 [$A7:B822] ; Kraid lint graph AI ;;; Kraid bottom lint graph AI ;;; $A7B819 A2 00 01 LDX #$0100 ; X = +Kraid bottom lint enemy index $A7B81C A9 FF 7F LDA #$7FFF ;\ $A7B81F 9D 94 0F STA $0F94,x[$7E:1094] ;} Kraid top lint instruction delay = 7FFFh ;;; Kraid lint graph AI ;;; ; Takes parameter: X = enemy index $A7B822 20 6A B9 JSR $B96A [$A7:B96A] ; $A7B825 AD 15 09 LDA $0915 [$7E:0915] ;\ $A7B828 18 CLC ;| $A7B829 69 E0 00 ADC #$00E0 ;} $12 = BG1 Y position + E0h $A7B82C 85 12 STA $12 [$7E:0012] ;/ $A7B82E 7C A8 0F JMP ($0FA8,x)[$A7:B831] ; Execute enemy function $A7B831 6B RTL ;;; $A7B96A BD 86 0F LDA $0F86,x[$7E:1006] ;\ $A7B96D 89 00 04 BIT #$0400 ;| $A7B970 F0 01 BEQ $01 [$B973] ;} If enemy set to ignore Samus/projectiles: return $A7B972 60 RTS ;/ $A7B973 AD A8 18 LDA $18A8 [$7E:18A8] ;\ $A7B976 D0 7D BNE $7D [$B9F5] ;} If Samus' invincibility timer is set: return $A7B978 BD 7A 0F LDA $0F7A,x[$7E:0FFA] ;\ $A7B97B 18 CLC ;| $A7B97C 6D B7 92 ADC $92B7 [$A7:92B7] ;| $A7B97F 38 SEC ;| $A7B980 E9 02 00 SBC #$0002 ;| $A7B983 85 12 STA $12 [$7E:0012] ;| $A7B985 AD F6 0A LDA $0AF6 [$7E:0AF6] ;| $A7B988 18 CLC ;| $A7B989 6D FE 0A ADC $0AFE [$7E:0AFE] ;} If not Samus left boundary < Kraid lint left boundary - 2 <= Samus right boundary: return $A7B98C C5 12 CMP $12 [$7E:0012] ;| $A7B98E 30 65 BMI $65 [$B9F5] ;| $A7B990 AD F6 0A LDA $0AF6 [$7E:0AF6] ;| $A7B993 38 SEC ;| $A7B994 ED FE 0A SBC $0AFE [$7E:0AFE] ;| $A7B997 C5 12 CMP $12 [$7E:0012] ;| $A7B999 10 5A BPL $5A [$B9F5] ;/ $A7B99B BD 7E 0F LDA $0F7E,x[$7E:107E] ;\ $A7B99E 18 CLC ;| $A7B99F 6D B9 92 ADC $92B9 [$A7:92B9] ;| $A7B9A2 18 CLC ;| $A7B9A3 69 02 00 ADC #$0002 ;| $A7B9A6 85 16 STA $16 [$7E:0016] ;} If Samus bottom boundary < Kraid lint top boundary + 2: return $A7B9A8 AD FA 0A LDA $0AFA [$7E:0AFA] ;| $A7B9AB 18 CLC ;| $A7B9AC 6D 00 0B ADC $0B00 [$7E:0B00] ;| $A7B9AF C5 16 CMP $16 [$7E:0016] ;| $A7B9B1 30 42 BMI $42 [$B9F5] ;/ $A7B9B3 BD 7E 0F LDA $0F7E,x[$7E:0FFE] ;\ $A7B9B6 18 CLC ;| $A7B9B7 6D BD 92 ADC $92BD [$A7:92BD] ;| $A7B9BA 38 SEC ;| $A7B9BB E9 02 00 SBC #$0002 ;| $A7B9BE 85 18 STA $18 [$7E:0018] ;} If Samus top boundary >= Kraid lint bottom boundary - 2: return $A7B9C0 AD FA 0A LDA $0AFA [$7E:0AFA] ;| $A7B9C3 38 SEC ;| $A7B9C4 ED 00 0B SBC $0B00 [$7E:0B00] ;| $A7B9C7 C5 18 CMP $18 [$7E:0018] ;| $A7B9C9 10 2A BPL $2A [$B9F5] ;/ $A7B9CB AD FE 0A LDA $0AFE [$7E:0AFE] ;\ $A7B9CE 18 CLC ;| $A7B9CF 69 10 00 ADC #$0010 ;| $A7B9D2 49 FF FF EOR #$FFFF ;} A = Samus movement distance X - Samus radius X - 11h $A7B9D5 18 CLC ;| $A7B9D6 6D 58 0B ADC $0B58 [$7E:0B58] ;/ $A7B9D9 C9 10 00 CMP #$0010 ;\ $A7B9DC 30 03 BMI $03 [$B9E1] ;} If A >= 10h: $A7B9DE A9 10 00 LDA #$0010 ; A = 10h $A7B9E1 8D 58 0B STA $0B58 [$7E:0B58] ; Samus movement distance X = A $A7B9E4 DA PHX $A7B9E5 08 PHP $A7B9E6 22 77 A4 A0 JSL $A0A477[$A0:A477] ; Normal enemy touch AI $A7B9EA 28 PLP $A7B9EB FA PLX $A7B9EC BD 86 0F LDA $0F86,x[$7E:1006] ;\ $A7B9EF 09 00 04 ORA #$0400 ;} Set enemy to ignore Samus/projectiles $A7B9F2 9D 86 0F STA $0F86,x[$7E:1006] ;/ $A7B9F5 60 RTS ;;; Kraid foot graph AI ;;; $A7B9F6 AD 7A 0F LDA $0F7A [$7E:0F7A] ;\ $A7B9F9 8D BA 10 STA $10BA [$7E:10BA] ;} Kraid foot X position = Kraid X position $A7B9FC AD 7E 0F LDA $0F7E [$7E:0F7E] ;\ $A7B9FF 18 CLC ;| $A7BA00 69 64 00 ADC #$0064 ;} Kraid foot Y position = Kraid Y position + 100 $A7BA03 8D BE 10 STA $10BE [$7E:10BE] ;/ $A7BA06 A8 TAY ; Y = Kraid foot Y position $A7BA07 38 SEC ;\ $A7BA08 E9 E0 00 SBC #$00E0 ;} X = Kraid foot Y position - E0h $A7BA0B AA TAX ;/ $A7BA0C AD C6 10 LDA $10C6 [$7E:10C6] ;\ $A7BA0F 29 FF FE AND #$FEFF ;| $A7BA12 CC 15 09 CPY $0915 [$7E:0915] ;| $A7BA15 10 05 BPL $05 [$BA1C] ;| $A7BA17 09 00 01 ORA #$0100 ;| $A7BA1A 80 08 BRA $08 [$BA24] ;} If Kraid foot Y position - E0h < BG1 Y position <= Kraid foot Y position: ;} Set Kraid foot visible $A7BA1C EC 15 09 CPX $0915 [$7E:0915] ;} Else: Set Kraid foot invisible $A7BA1F 30 03 BMI $03 [$BA24] ;| $A7BA21 09 00 01 ORA #$0100 ;| ;| $A7BA24 8D C6 10 STA $10C6 [$7E:10C6] ;/ $A7BA27 AE 54 0E LDX $0E54 [$7E:0E54] ; X = Kraid foot index $A7BA2A 6C E8 10 JMP ($10E8)[$A7:BA2D] ; Execute Kraid foot function ;;; Kraid fingernail_A graph AI ;;; $A7BD32 C2 30 REP #$30 $A7BD34 AD 8C 0F LDA $0F8C [$7E:0F8C] ;\ $A7BD37 C9 01 00 CMP #$0001 ;} If Kraid health >= 1: $A7BD3A 30 03 BMI $03 [$BD3F] ;/ $A7BD3C 6C 28 11 JMP ($1128)[$A7:B92D] ; Execute Kraid fingernail_A instruction $A7BD3F AD 06 11 LDA $1106 [$A0:1106] ;\ $A7BD42 09 00 03 ORA #$0300 ;} Set Kraid fingernail_A invisible and to delete $A7BD45 8D 06 11 STA $1106 [$A0:1106] ;/ $A7BD48 6B RTL ;;; Kraid fingernail_B graph AI ;;; $A7BD49 C2 30 REP #$30 $A7BD4B AD 8C 0F LDA $0F8C [$7E:0F8C] ;\ $A7BD4E C9 01 00 CMP #$0001 ;} If Kraid health >= 1: $A7BD51 30 03 BMI $03 [$BD56] ;/ $A7BD53 6C 68 11 JMP ($1168)[$A7:B92D] ; Execute Kraid fingernail_B instruction $A7BD56 AD 46 11 LDA $1146 [$A0:1146] ;\ $A7BD59 09 00 03 ORA #$0300 ;} Set Kraid fingernail_B invisible and to delete $A7BD5C 8D 46 11 STA $1146 [$A0:1146] ;/ $A7BD5F 6B RTL