LoROM ;//[Item finder by Black Falcon] ;//[If there is any item in the room that hasn't been picked up yet, you'll get notified in the HUD] ;//[DEFAULT TILE POSITION IS THE SPACE BETWEEN XRAY & MINIMAP, READ ASM TO MOVE TO YOUR LIKING] ;==================================================================================================; ;//[ITEMFINDER TILES (FROM HUD @ 0D3200)] ;//[default are the e-tank tiles (orange highlight if item, grey if no item)] !item = #$2030 ;//tile to display if an item is present !noitem = #$1431 ;//tile to display if no item is present !blankitem = #$2C0F ;//tile to blank out !noitem !blanknoitem = #$2C0F ;//tile to blank out !item ;==================================================================================================; ;//[hijack point (b4 selected hud item highlighter & gfx update table)] org $809CA4 JSR FindItemer ;//[Free space ($8C bytes)] org $80CD8E FindItemer: PHA : PHX ;//highlighterstuff JSL ItemFinder PLX : PLA ;//ffutsrethgilhgih LDA $0A04 ;//vanilla RTS ;//return ItemFinder: SEP #$20 : LDA #$8F PHA : PLB : REP #$20 LDA !noitem : STA $18 ;//no item before check LDX $07BB ;// LDA $8F0014,x : STA $12 ;//reads out current PLM pointer LoopFinder: LDA ($12) : BEQ NoMoreItems ;//loads value stored at the pointer (no value, no item) CMP #$DF7D : BMI IncreaseItem ;//checks items CMP #$F0A0 : BPL NoMoreItems ;//checks custom PLMS LDA $12 : CLC : ADC #$0004 ;//we want to read out LO STA $14 LDA ($14) : AND #$00FF JSL CheckItems : BCS IncreaseItem ;//(SEC if item collected, CLC if not) LDA !item : STA $18 BRA MoreItems ;//still items to be found IncreaseItem: LDA $12 : CLC : ADC #$0006 STA $12 : BRA LoopFinder MoreItems: LDA !blankitem : STA $7EC67A ;//position of tile to blank out !noitem LDA $18 : STA $7EC63A : RTL ;//position of tile to display if an item is present NoMoreItems: LDA !blanknoitem : STA $7EC63A ;//position of tile to blank out !item LDA $18 : STA $7EC67A : RTL ;//position of tile to display if no item is present CheckItems: PHX : PHY : PHP : REP #$30 JSR $80818E ;//[Change nth bit to address offset and mask] LDA $7ED870,x ;// AND $05E7 : BNE ItemSec ;//check bits (SEC if item collected, CLC if not) ItemClc: PLP : PLY : PLX : CLC : RTL ItemSec: PLP : PLY : PLX : SEC : RTL ;==================================================================================================;