90C4B8: LDA $09D2 ;load item slot STA $12 ;store here LDA $8F ;buttons newly pressed every frame BIT $09B8 ;item cancel BEQ ONE STZ $0A04 ;we're here, because item cancel was just pressed, so BRA TWO ;disable the selected item ONE: LDA $8B ;controller input, buttons held BIT $09B8 ;again, item cancel BNE THREE STZ $16 ;auto cancel is not active BRA HERE THREE: LDA #$0001 ;turn auto cancel on STA $16 ;temp flag HERE: LDA $8F ;buttons newly pressed this frame BIT $09BA ;item cancel BEQ FOUR LDA $09D2 INC a CMP #$0006 ;check if selected item number exceeds the limit of 5 BMI FIVE ;Branch if minus, ie we are below the limit TWO: LDA #$0000 ;store zero to the selected item, when item cancel was just pressed/item limit exceeded FIVE: STA $09D2 ;Store to 'current item selected' SEVEN: ASL a TAX JSR ($C539,x) ;executes code - this handles the skip, sets carry if there's either no ammo, no grapple/xray, or simply no item has been selected BCC SIX LDA $09D2 INC a STA $09D2 ;count up one slot (= skip item when ammo is empty/item is not selected) CMP #$0006 ;but keep within 5 items, else quit! BMI SEVEN LDA #$0000 STA $09D2 ;if you run out of bounds, disable items BRA SEVEN SIX: LDA $16 ;0 if auto cancel off, 1 if on BEQ NINE ;check if auto cancel is on? LDA $09D2 ;puts selected item into the auto cancel array STA $0A04 BRA FOUR NINE: STZ $0A04 ;disable auto cancel FOUR: LDA $09D2 ;dunno how arm cannon opening is handled atm CMP $12 ;probably somewhere else BNE TEN ;only thing that I can tell is that this routine LDA $0AAA ;stores the flags needed to 'open' the arm cannon INC a CMP #$0003 ;branch if arm cannon sprite is fully opened (frame 3) BMI ELEVEN LDA #$0002 ELEVEN: STA $0AAA ;part of arm cannon opening animation (frame 2) BRA TWELVE TEN: LDA #$0001 ;same here (frame 1) STA $0AAA TWELVE: PLP RTS 90C539: C545 ;no item - stores zero to various offsets, resets samus's palette, CLC and RTS C551 ;missile - if missiles are empty, do the same as above, else SEC and RTS C564 ;super missile - same with supers C577 ;powerbomb - same with Powers C58A ;grapple - if grapple hasn't been collected SEC RTS else CLC RTS C5AE ;xray - same with xray