Lorom org $9498B2 DW $B300 ;Write the Hijack point org $94B300 ;COMMENT THE NEXT THREE LINES IF YOU WANT SAMUS TO DIE TO USING THIS AT <5 ENERGY. LDA $09C2 CMP #$000F BMI $09 LDA $09D2 ;Load the value for Samus' currently selected HUD item CMP #$0000 ;Compare it to 0000 BNE SELECTED ;If it's not 0000 (nothing selected), go to the SELECTED subroutine RTS SELECTED: CMP #$0001 ;Compare Samus' currently selected HUD item to 0001, missiles BEQ MISSILES ;If a match, go to the subroutine for missiles. The following is the same with Super Missiles and Power Bombs. CMP #$0002 BEQ SMISSILES CMP #$0003 BEQ POWERBOMBS RTS ;If it doesn't match any of these, the subroutine just ends, so Grapple and X-Ray won't make a match. MISSILES: LDA $09C6 ;Load Samus' current missiles, CMP $09C8 ;And if they equal her maximum missiles, BEQ END ;End the subroutine LDA $05D5 ;If they don't, load from 05D5, the location in RAM we'll be using as a timer. CMP #$000F ;Compare it to 15 BEQ MISSILEUP ;If a match, go to the subroutine to increase missiles. INC A ;If not a match, increase the loaded number by one, STA $05D5 ;And store it back to the timer location. RTS MISSILEUP: JSR SUBEN ;Decrease energy INC $09C6 ;Increase Samus' current missiles by one STZ $05D5 ;Reset the timer by storing 0 to it. RTS SMISSILES: LDA $09CA ;Load Samus' current Smissiles, CMP $09CC ;And if they equal her maximum Smissiles, BEQ END ;End the subroutine LDA $05D5 ;If they don't, load from 05D5, the location in RAM we'll be using as a timer. CMP #$000F ;Compare it to 15 BEQ SMISSILEUP ;If a match, go to the subroutine to increase Smissiles. INC A ;If not a match, increase the loaded number by one, STA $05D5 ;And store it back to the timer location. RTS SMISSILEUP: JSR SUBEN ;Decrease energy INC $09CA ;Increase Samus' current Smissiles by one STZ $05D5 ;Reset the timer by storing 0 to it. RTS POWERBOMBS: LDA $09CE ;Load Samus' current PBs, CMP $09D0 ;And if they equal her maximum PBs, BEQ END ;End the subroutine LDA $05D5 ;If they don't, load from 05D5, the location in RAM we'll be using as a timer. CMP #$000F ;Compare it to 14 BEQ POWERBOMBUP ;If a match, go to the subroutine to increase PBs. INC A ;If not a match, increase the loaded number by one, STA $05D5 ;And store it back to the timer location. RTS POWERBOMBUP: JSR SUBEN ;Decrease energy INC $09CE ;Increase Samus' current PBs by one STZ $05D5 ;Reset the timer by storing 0 to it. RTS SUBEN: LDA $09C2 ;Load's Samus' current health SEC ;WHEE FLAGS (set carry for the maths) SBC #$0005 ;SuBtraCt 5 from samus' health STA $09C2 ;And write it back to the RAM. RTS END: RTS