; Modifies the bomb blocks to be revealed by any beam / missile (except maybe Grapple).

!FreeSpace = $84F1D3 ; Some freespace in bank $84.

lorom

; Internal defines, do not change

!ProjectileBeam = $0000
!ProjectileMissile = $0100
!ProjectileSuper = $0200
!ProjectileBomb = $0500
!ProjectilePower = $0300

ProjectileIndex = $7E0DDE
ProjectileType = $7E0C18

PlmInstructionPtr = $7E1D27

PlmDelete = $8486BC

; Bomb block PLM init
org $84CEDA
BombBlock:
	LDX.w ProjectileIndex
	BMI .Delete				; Add a semicolon before the BMI to make Grapple Beam reveal bomb blocks.
	LDA.w ProjectileType,x
	AND #$0F00
	CMP.w #!ProjectileBomb
	BEQ .Bomb
	JMP CheckOther

; Commented out of Xkas support.
; warnpc $84CEED

org $84CEED
.Delete

org $84CEF4
.PowerBomb

org $84CF0C
.Bomb

reset bytes

org !FreeSpace
CheckOther:
	CMP.w #!ProjectilePower
	BEQ .PowerBomb
	LDA.w #SpawnBombBlockPlm
	STA.w PlmInstructionPtr,y
RTS

.PowerBomb
JMP BombBlock_PowerBomb

SpawnBombBlockPlm:
	dw $0001, DrawBombBlock
	dw PlmDelete

DrawBombBlock:
	dw $0001, $F058
	dw $0000

print "Freespace use: ",bytes," bytes"
print "Freespace use end: $",pc
