lorom

org $82F723
JSR Timerset

org $828991
DW hijack

org $82F900
hijack:
LDA $0A64	;Flag, samus is currently grappled
BNE Grappled
LDA $0A78	;7E:0A78 Pause time, ala energy tank and x-ray scope.
BNE EndHijack

LDA $7FFDE6	;7F:FDE6 anti abuse timer
CMP #$0017
BPL Initialize
CMP #$0000
BEQ EndHijack
DEC 
STA $7FFDE6	;7F:FDE6 anti abuse timer
LDA $09B6	;7E:09B6 Run button
TRB $8B		;reset 8B current held input
TRB $8F		;reset 8F new held input
LDA $09BA	;7E:09BA Switch Item
TRB $8B		;reset 8B current held input
TRB $8F		;reset 8F new held input
EndHijack:
JMP $8B44

Grappled:
LDA $09B8	;7E:09B8 Item Cancel
TRB $8B		;reset 8B current held input
TRB $8F		;reset 8F new held input
LDA $09BA	;7E:09BA Switch Item
TRB $8B		;reset 8B current held input
TRB $8F		;reset 8F new held input
BRA EndHijack

Initialize:
LDA #$0000
STA $7FFDE6
BRA EndHijack

Timerset:
STA $7FFDE8	;temporary holding place for A value
LDA #$0016	;loading timer value
STA $7FFDE6	;Store to timer
STZ $0A78	;Storing zero to time pause ram
LDA $7FFDE8	;Reload temp stored A value
RTS



org $888A2D
JSR Altset

org $88EE60
Altset:
STA $7FFDE8	;temporary holding place for A value
LDA #$0016	;loading timer value
STA $7FFDE6	;Store to timer
STZ $0A78	;Storing zero to time pause ram
LDA $7FFDE8	;Reload temp stored A value
RTS


;Runs while HUD is active
;$82/F723 9C 78 0A    STZ $0A78  [$82:0A78]   A:0006 X:0006 Y:0000 P:envmxdizc
;$DE/D95E 8D 78 0A    STA $0A78  [$90:0A78]   A:8000 X:0000 Y:0049 P:eNvmxdizc
;runs when starting xray
;$91/E21A 8D 78 0A    STA $0A78  [$91:0A78]   A:0001 X:0000 Y:0049 P:envmxdizC
;$91/CAFE 8D 78 0A    STA $0A78  [$91:0A78]   A:9101 X:0002 Y:0030 P:envMXdizc
;runs when ending xray
;$88/8A2D 9C 78 0A    STZ $0A78  [$88:0A78]   A:0001 X:4000 Y:0003 P:envmxdizc
