Merge branch 'sram_rework' into dr_sram
This commit is contained in:
139
newhud.asm
139
newhud.asm
@@ -1,115 +1,49 @@
|
||||
NewDrawHud:
|
||||
SEP #$30
|
||||
;================================================================================
|
||||
; Draw bomb count
|
||||
!BOMBCOUNT_DRAW_ADDRESS = "$7EC75A"
|
||||
!INFINITE_BOMBS = "$7F50C9"
|
||||
;================================================================================
|
||||
|
||||
LDA !INFINITE_BOMBS : BNE .infinite_bombs
|
||||
.finite_bombs
|
||||
LDA.l $7EF343 ; bombs
|
||||
JSR HudHexToDec2Digit ;requires 8 bit registers!
|
||||
REP #$20
|
||||
LDX.b $06 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS ; Draw bombs 10 digit
|
||||
LDX.b $07 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; Draw bombs 1 digit
|
||||
BRA +
|
||||
|
||||
.infinite_bombs
|
||||
REP #$20
|
||||
LDA.w #$2431 : STA !BOMBCOUNT_DRAW_ADDRESS ; infinity (left half)
|
||||
INC A : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; infinity (right half)
|
||||
+
|
||||
|
||||
;================================================================================
|
||||
; Draw rupee counter
|
||||
!RUPEE_DRAW_ADDRESS = "$7EC750"
|
||||
;================================================================================
|
||||
|
||||
LDA.l $7EF362 ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here
|
||||
JSR HudHexToDec4Digit
|
||||
LDX.b $04 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS ; 1000s
|
||||
LDX.b $05 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+2 ; 100s
|
||||
LDX.b $06 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+4 ; 10s
|
||||
LDX.b $07 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+6 ; 1s
|
||||
|
||||
;================================================================================
|
||||
; Draw arrow count
|
||||
!ARROWCOUNT_DRAW_ADDRESS = "$7EC760"
|
||||
!INFINITE_ARROWS = "$7F50C8"
|
||||
;================================================================================
|
||||
|
||||
SEP #$20
|
||||
LDA.l ArrowMode : BNE +
|
||||
LDA !INFINITE_ARROWS : BNE .infinite_arrows
|
||||
.finite_arrows
|
||||
LDA.l $7EF377 ; arrows
|
||||
JSR HudHexToDec2Digit
|
||||
REP #$20
|
||||
LDX.b $06 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS ; Draw arrows 10 digit
|
||||
LDX.b $07 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS+2 ; Draw arrows 1 digit
|
||||
BRA +
|
||||
|
||||
.infinite_arrows
|
||||
REP #$20
|
||||
LDA.w #$2431 : STA !ARROWCOUNT_DRAW_ADDRESS ; infinity (left half)
|
||||
INC A : STA !ARROWCOUNT_DRAW_ADDRESS+2 ; infinity (right half)
|
||||
+
|
||||
|
||||
;================================================================================
|
||||
; Draw Goal Item Indicator
|
||||
!GOAL_COUNTER = "$7EF418"
|
||||
!GOAL_DRAW_ADDRESS = "$7EC72A"
|
||||
;================================================================================
|
||||
|
||||
SEP #$20
|
||||
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
|
||||
|
||||
LDA.l !GOAL_COUNTER
|
||||
JSR HudHexToDec3Digit
|
||||
NewDrawHud:
|
||||
REP #$20
|
||||
|
||||
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
|
||||
|
||||
LDA.l GoalCounter
|
||||
JSR HudHexToDec4Digit
|
||||
|
||||
LDA.l GoalItemIcon : STA !GOAL_DRAW_ADDRESS ; draw star icon
|
||||
|
||||
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
|
||||
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
|
||||
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
|
||||
|
||||
SEP #$20
|
||||
LDA.l GoalItemRequirement : CMP.b #$FF : BEQ .skip
|
||||
|
||||
|
||||
LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
|
||||
LDA.l GoalItemRequirement
|
||||
JSR HudHexToDec3Digit
|
||||
REP #$20
|
||||
JSR HudHexToDec4Digit
|
||||
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
|
||||
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
|
||||
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
|
||||
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
|
||||
BRA .done
|
||||
.skip
|
||||
REP #$20
|
||||
LDA.w #$207F ; transparent tile
|
||||
STA !GOAL_DRAW_ADDRESS+8
|
||||
STA !GOAL_DRAW_ADDRESS+10
|
||||
STA !GOAL_DRAW_ADDRESS+12
|
||||
.done
|
||||
|
||||
|
||||
;================================================================================
|
||||
; Draw Dungeon Compass Counts
|
||||
;================================================================================
|
||||
REP #$20
|
||||
LDA.l CompassMode : AND #$003F : BEQ + ; skip if CompassMode is 0.
|
||||
JSL.l DrawDungeonCompassCounts ; compasses.asm
|
||||
+
|
||||
|
||||
;================================================================================
|
||||
; Draw key count
|
||||
!KEYS = "$7EF36F"
|
||||
!KEY_DIGITS_ADDRESS = "$7EC764"
|
||||
!KEY_ICON_ADDRESS = "$7EC726"
|
||||
;================================================================================
|
||||
SEP #$20
|
||||
LDA.l !KEYS : CMP.b #$FF : BEQ .not_in_dungeon
|
||||
LDA.l CurrentSmallKeys : CMP.b #$FF : BEQ .not_in_dungeon
|
||||
.in_dungeon
|
||||
JSR HudHexToDec2Digit : REP #$20
|
||||
|
||||
@@ -132,9 +66,6 @@ SEP #$30
|
||||
|
||||
.done_keys
|
||||
|
||||
|
||||
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; Draw pendant/crystal icon
|
||||
;--------------------------------------------------------------------------------
|
||||
@@ -156,7 +87,7 @@ SEP #$30
|
||||
REP #$20
|
||||
BEQ .drawprize
|
||||
|
||||
LDA.l $7EF368
|
||||
LDA.l MapField
|
||||
AND.l DungeonItemMasks,X
|
||||
BEQ .noprize
|
||||
|
||||
@@ -184,13 +115,13 @@ SEP #$30
|
||||
!INFINITE_MAGIC = "$7F50CA"
|
||||
!DrawMagicMeter_mp_tilemap = "$0DFE0F"
|
||||
;--------------------------------------------------------------------------------
|
||||
LDA $7EF36E : AND #$00FF ; crap we wrote over when placing the hook for OnDrawHud
|
||||
LDA CurrentMagic : AND #$00FF ; crap we wrote over when placing the hook for OnDrawHud
|
||||
!ADD #$0007
|
||||
AND #$FFF8
|
||||
TAX ; end of crap
|
||||
|
||||
LDA !INFINITE_MAGIC : AND.w #$00FF : BNE + : JMP .green : +
|
||||
SEP #$20 : LDA.b #$80 : STA $7EF36E : REP #$30 ; set magic to max
|
||||
SEP #$20 : LDA.b #$80 : STA CurrentMagic : REP #$30 ; set magic to max
|
||||
LDX.w #$0080 ; load full magic meter graphics
|
||||
LDA $1A : AND.w #$000C : LSR #2
|
||||
BEQ .red
|
||||
@@ -265,27 +196,27 @@ RTS
|
||||
; in: A(b) - Byte to Convert
|
||||
; out: $05 - $07 (high - low)
|
||||
;================================================================================
|
||||
HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one...
|
||||
LDY.b #$90
|
||||
-
|
||||
CMP.b #100 : !BLT +
|
||||
INY
|
||||
SBC.b #100 : BRA -
|
||||
+
|
||||
STY $05 : LDY.b #$90 ; Store 100s digit and reset Y
|
||||
-
|
||||
CMP.b #10 : !BLT +
|
||||
INY
|
||||
SBC.b #10 : BRA -
|
||||
+
|
||||
STY $06 : LDY #$90 ; Store 10s digit and reset Y
|
||||
CMP.b #1 : !BLT +
|
||||
-
|
||||
INY
|
||||
DEC : BNE -
|
||||
+
|
||||
STY $07 ; Store 1s digit
|
||||
RTS
|
||||
;HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one...
|
||||
; LDY.b #$90
|
||||
; -
|
||||
; CMP.b #100 : !BLT +
|
||||
; INY
|
||||
; SBC.b #100 : BRA -
|
||||
; +
|
||||
; STY $05 : LDY.b #$90 ; Store 100s digit and reset Y
|
||||
; -
|
||||
; CMP.b #10 : !BLT +
|
||||
; INY
|
||||
; SBC.b #10 : BRA -
|
||||
; +
|
||||
; STY $06 : LDY #$90 ; Store 10s digit and reset Y
|
||||
; CMP.b #1 : !BLT +
|
||||
; -
|
||||
; INY
|
||||
; DEC : BNE -
|
||||
; +
|
||||
; STY $07 ; Store 1s digit
|
||||
;RTS
|
||||
|
||||
;================================================================================
|
||||
; 8-bit registers
|
||||
|
||||
Reference in New Issue
Block a user