lorom

org $828957

JSR $F720		;let's hi-jack the main game loop...

org $82F720	;make sure this is free space

LDA $008D	;unused ram to use as counter
CMP #$002C	;change this to change how fast samus heals. smaller values = faster
BEQ Heal		;branch to the healing section
INC $008D	;if the counter hadn't reached chosen value yet, increase it
STZ $0590	;original code that was replaced by that JSR
RTS		;return

Heal:		;heal routine part 1
STZ $008D	;reset timer
LDA $09C2	
CMP $09C4	;make sure samus doesn't have full health
BMI HealReally	;if health is less than max health, go to really heal
STZ $0590
RTS

HealReally:	;heal routine part 2
INC $09C2	;heal 1 unit of energy. add more INCs of this to heal faster
STZ $0590	;original code that was replaced by JSR
RTS		;return