;$11E669-$11E6C1 ;AI Initialization org $A3E669 LDX $0E54 LDA $0F92, X ;Get orientation AND #$0003 ASL A TAY LDA $E2CC, Y ;E25C, E278, E294, E2B0 STA $0F92, X ;Set graphic AI LDA #$804D STA $0F8E, X ;Advanced hit box pointer. Probably unused, Geemers are simple squares LDA #$0001 STA $0F94, X ;Start graphic AI immediately LDA #$E6C1 STA $0FB2, X ;Main AI pointer initialized to E6C1 LDA $0FB4, X ;'Speed' from SMILE. Intended to be 0000 - 001F or 00FF XBA LSR LSR STA $0FA8, X ;Horizontal and STA $0FAA, X ;Vertical speeds. LDA $0F86, X AND #$0003 BNE + LDA $0FA8, X ;Swap X speed if initially moving left (0) EOR #$FFFF INC A STA $0FA8, X RTL + CMP #$0002 BNE + LDA $0FAA, X ;Swap Y speed if initially moving up (2) EOR #$FFFF INC A STA $0FAA, X + RTL ;Right is probably 1, down is probably 3. ;E785: Falling org $A3E785 LDA $7E7802, X ;Uh. Not sure when this was initialized. STA $12 LDA $7E7804, X STA $14 JSL $A0C786 ;Vertical motion BCS + ;Branch if no collision LDA $7E780A,X STA $12 LDA $7E780C,X STA $14 JSL $A0C6AB BCC ++ + LDA #$0000 STA $7E7802, X STA $7E7804, X STA $7E780A, X STA $7E780C, X STA $7E7808, X ;Clear speeds LDA $7E7806, X STA $0FB2, X ;Restore previous AI RTL ++ LDA $7E7804, X CMP #$0004 ;Cap speed at 4 pixels per frame BPL + LDA $7E7802, X CLC ADC #$8000 STA $7E7802, X LDA $7E7804, X ADC #$0000 STA $7E7804, X ;Accelerate due to gravity + RTL print "Must be before a3e7f2: ", pc org $A3E7F2 ;Just in case the previous code is too long LDA $1840 CMP #$001E BNE + LDA $183E CMP #$0014 BNE + LDA $0FB2, X STA $7E7806, X LDA #$E785 STA $0FB2, X + STZ $12 STZ $14 LDA $0FAA, X BPL + DEC $14 + STA $13 LDA $14 BPL + DEC A BRA ++ + INC A ++ STA $14 JSL $A0C786 ;Vertical movement BCC +++ ;Branch if no roof/ceiling hit LDA #$0000 STA $7E7808, X JSR $E8A5 ;This is new... Scales speed according to slope currently traversing and puts into $14.$12 JSL $A0C6AB ;Horizontal movement BCS + JSL $A0C8AD RTL + ;and so on org $A3F650 ;First free space available in the bank... ouch ;Check if frozen (LDA $0F9E,X : BEQ + : LDA #$0004 : STA $0F8A,X : STZ $0CF4 : LDA $0F78,X : TAX : LDA $A0001E,X : STA $1784 : JML [$1784] : + ...) ;Enemy stun effect (LDA $0F78,X : TAX : LDA $A0000D,X : AND #$00FF : BNE + : LDA #$0004 : LDX $0E54 : STA $0F9C,X : STZ $0F8A,X) ;Compare grapple length to target length, adjust speed if necessary LDA $0F9E,X : BEQ + : LDA #$0004 : STA $0F8A,X : STZ $0CF4 : JML $A0957E + LDA #$0004 : STA $0F9C,X : STZ $0F8A,X LDA $0CFE SEC SBC $0CF6 BMI + TAY LDA $0CFB AND #$00FF ASL TAX LDA $A0B3C3,X JSL SignedMultiplicationExtra LSR LSR LSR LSR BIT #$0800 BEQ + ORA #$F000 + PHA LDA $A0B443,X JSL SignedMultiplicationExtra LSR LSR LSR LSR BIT #$0800 BEQ + ORA #$F000 + LDX $0E54 CLC ADC $7E7803,X STA $7E7803,X BPL + SEP #$20 LDA #$FF STA $7E7805,X + REP #$21 PLA ADC $7E780B,X STA $7E780B,X BPL + SEP #$20 LDA #$FF STA $7E780D,X + REP #$20 JMP $E785