lorom			;Super Metroid (JU) unheadered
	;Created March 29, 2010 by Flamestar666
		;Metroidconstruction.com
;____INFORMATION____
;this pretty little asm file is my first real public release. Pretty much this modifies the 'Air
;fool X-ray block 07 and 08. 07 is the actual hyperbeam block, and 08 is a block that must surround the area, that resets and restores your normal beam.

;The 07 should be set up 3 tiles high at minumum, and have 08 on the exit area (above, below, to the sides, etc)
;____END OF INFO____

;START OF BTS 07___________
org $9498BA		;Hi-jack point for Air-Fool X-ray 07

	DW $B700	;free space

org $94B700
	
	STZ $0CD0	;Disables charge beam (fixes lockup issue) (2 bytes)
	LDA $0B3F 	;Address for the speedboosters (2 bytes)
	BEQ CHECK	;Branches to CHECK if the speedboosters is not active
	RTS

CHECK:		;Check for the hyperbeam, if the hyperbeam is not active, continues to HYPER
	LDA $0A76 	;Hyperbeam address (2 bytes)
	BEQ HYPER 	;Branches to HYPER if = #$0000
	RTS
	
HYPER:		;Hyperbeam activator
	LDA $09A6	;Load load current beams + chargebeam into accumulator (2 bytes)
	STA $7EFA04	;stores the accumulator into this ram address
	LDA #$3C08 	;load this into accumulator (needed for Hyperbeam to work)
	STA $0A76 	;Hyperbeam address (2 bytes)
	LDA #$100B	;Sets the correct value for the Hyperbeam (2 bytes)
	STA $09A6	;Current beam addresses (2 bytes)
	JSR $90AC8D	;Resets the beam graphics and palettes (used to set the correct beam/color)
	RTS
;END OF BTS 07_____________
	
;START OF BTS 08___________	
org $9498BC		;Hi-jack point for Air-Fool X-ray 08

	DW $B800	;free space

org $94B800
	
	LDA $0A76	;Hyperbeam address (2 bytes)
	BNE CLEAR	;If not #$0000, jump to CLEAR
	RTS
	
CLEAR:		;Resets Palette, charge beam

	LDA $7EFA04	;Beam is stored here while hyperbeam is in use
	STA $09A6	;Restores stored current beam
	STZ $0A76 	;Disabled Hyperbeam
	STZ $0B62	;Fixes pallete issue with charge beam (light samus)
	STZ $0B18	;fixes yellow samus (charge beam bug)
	STZ $0CD0	;disabled charge beam (charge beam bug) 
	LDX #$9CA0	;Everything below to the next comment resets the palette
	PHB	
	STX $12
	LDA $0A74
	XBA
	REP #$01
	ADC $12
	TAX
	LDA #$001F
	LDY #$C180
	MVN $9B7E
	PLB			;End of pallette reset
	JSR $90AC8D	;Resets the beam graphics and palettes (used to set the correct beam/color)
	RTS
	
	;END OF BTS 08_____________
	
	
	;START OF BTS 09___________
org $9498BE		;Hi-jack point for Air-Fool X-ray 09

	DW $B900	;free space

org $94B900
	
	LDA $0B3F 	;Address for the speedboosters (2 bytes)
	BEQ ICE	;Branches to CHECK if the speedboosters is not active
	RTS

ICE:		;Ice activator
	LDA $09A6	;Load load current beams + chargebeam into accumulator (2 bytes)
	STA $7EFA04	;stores the accumulator into this ram address
	LDA #$1002	;Sets the correct value for the ice (2 bytes)
	STA $09A6	;Current beam addresses (2 bytes)
	JSR $90AC8D	;Resets the beam graphics and palettes (used to set the correct beam/color)
	RTS
;END OF BTS 09_____________

	;START OF BTS 0A___________
org $9498C0		;Hi-jack point for Air-Fool X-ray 0A

	DW $BA00	;free space

org $94BA00
	
	LDA $0B3F 	;Address for the speedboosters (2 bytes)
	BEQ WAVE	;Branches to CHECK if the speedboosters is not active
	RTS

WAVE:		;Wave activator
	LDA $09A6	;Load load current beams + chargebeam into accumulator (2 bytes)
	STA $7EFA04	;stores the accumulator into this ram address
	LDA #$1001	;Sets the correct value for the ice (2 bytes)
	STA $09A6	;Current beam addresses (2 bytes)
	JSR $90AC8D	;Resets the beam graphics and palettes (used to set the correct beam/color)
	RTS
;END OF BTS 0A_____________

	;START OF BTS 0B___________
org $9498C2		;Hi-jack point for Air-Fool X-ray 0B

	DW $BB00	;free space

org $94BB00
	
	LDA $0B3F 	;Address for the speedboosters (2 bytes)
	BEQ SPAZER	;Branches to CHECK if the speedboosters is not active
	RTS

SPAZER:		;SPazer activator
	LDA $09A6	;Load load current beams + chargebeam into accumulator (2 bytes)
	STA $7EFA04	;stores the accumulator into this ram address
	LDA #$1004	;Sets the correct value for the ice (2 bytes)
	STA $09A6	;Current beam addresses (2 bytes)
	JSR $90AC8D	;Resets the beam graphics and palettes (used to set the correct beam/color)
	RTS
;END OF BTS 0B_____________


	;START OF BTS 0C___________
org $9498C4		;Hi-jack point for Air-Fool X-ray 0C

	DW $BC00	;free space

org $94BC00
	
	LDA $0B3F 	;Address for the speedboosters (2 bytes)
	BEQ PLASMA	;Branches to CHECK if the speedboosters is not active
	RTS

PLASMA:		;Plasma activator
	LDA $09A6	;Load load current beams + chargebeam into accumulator (2 bytes)
	STA $7EFA04	;stores the accumulator into this ram address
	LDA #$1008	;Sets the correct value for the ice (2 bytes)
	STA $09A6	;Current beam addresses (2 bytes)
	JSR $90AC8D	;Resets the beam graphics and palettes (used to set the correct beam/color)
	RTS
;END OF BTS 0B_____________

