Created newhud.asm which contains most of the code related to drawing the hud. Optimized hud code as much as I could. Significantly less lag than v29.

Compasses.asm got almost completely rewritten.
This commit is contained in:
Myramong
2018-09-14 15:15:22 -03:00
parent 78e3bb48f9
commit 90ed9ed7da
8 changed files with 407 additions and 262 deletions

View File

@@ -96,7 +96,6 @@ incsrc shopkeeper.asm
incsrc bookofmudora.asm
incsrc crypto.asm
incsrc tablets.asm
incsrc rupeelimit.asm
incsrc fairyfixes.asm
incsrc rngfixes.asm
incsrc medallions.asm
@@ -158,7 +157,6 @@ org $A48000 ; code bank - PUT NEW CODE HERE
incsrc glitched.asm
incsrc hardmode.asm
incsrc goalitem.asm
incsrc compasses.asm
incsrc openmode.asm
incsrc quickswap.asm
incsrc endingsequence.asm
@@ -172,6 +170,8 @@ incsrc playername.asm
incsrc decryption.asm
incsrc inverted.asm
incsrc invertedmaps.asm
incsrc newhud.asm
incsrc compasses.asm
warnpc $A58000
;org $228000 ; contrib area

View File

@@ -1,128 +1,129 @@
;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space (Callee Preserved)
; $7F5010 - Scratch Space
;--------------------------------------------------------------------------------
!GOAL_COUNTER = "$7EF418"
; The number of items in a dungeon never changes. use this macro instead of
; HexToDec when drawing the "??/XX" item counter
; %DrawConstantNumber(1,4) draws 14
;--------------------------------------------------------------------------------
macro DrawConstantNumber(digit1,digit2)
LDA.w #$2490+<digit1> : STA $7EC79A
LDA.w #$2490+<digit2> : STA $7EC79C
endmacro
;--------------------------------------------------------------------------------
DrawDungeonCompassCounts:
LDA $1B : AND.w #$00FF : BNE + : RTL : + ; Skip if outdoors
LDA $040C : CMP.w #$00FF : BNE + : RTL : + ; Skip if not in a dungeon
LDA.l CompassMode : AND.w #$00FF : BNE + : RTL : + ; Item Counts
PHX
LDX $040C ; Load dungeon ID to X
LDX $1B : BNE + : RTL : + ; Skip if outdoors
LDX $040C : CPX.b #$FF : BNE + : RTL : + ; Skip if not in a dungeon
CMP.w #$0002 : BEQ ++ ; if CompassMode==2, we don't check for the compass
LDA $7EF364 : AND .item_masks, X ; Load compass values to A, mask with dungeon item masks
BNE + : BRL .done : + ; skip if we don't have compass
++
CMP.w #$0002 : BEQ ++ ; if CompassMode==2, we don't check for the compass
LDA $7EF364 : AND.l .item_masks, X ; Load compass values to A, mask with dungeon item masks
BNE + : RTL : + ; skip if we don't have compass
++
LDA $040C
CMP.w #$0000 : BNE + ; Sewer Passage, use Hyrule Castle counts
LDA $7EF434 : AND.w #$00F0 : LSR #4
BRL ++
+ : CMP.w #$0002 : BNE + ; Hyrule Castle
LDA $7EF434 : AND.w #$00F0 : LSR #4
BRL ++
+ : CMP.w #$0004 : BNE + ; Eastern Palace
LDA $7EF436 : AND.w #$0007
BRL ++
+ : CMP.w #$0006 : BNE + ; Desert Palace
LDA $7EF435 : AND.w #$00E0 : LSR #5
BRL ++
+ : CMP.w #$0008 : BNE + ; Agahnim's Tower
LDA $7EF435 : AND.w #$0002
BRL ++
+ : CMP.w #$000A : BNE + ; Swamp Palace
LDA $7EF439 : AND.w #$000F
BRL ++
+ : CMP.w #$000C : BNE + ; Dark Palace
LDA $7EF434 : AND.w #$000F
BRA ++
+ : CMP.w #$000E : BNE + ; Misery Mire
LDA $7EF438 : AND.w #$000F
BRA ++
+ : CMP.w #$0010 : BNE + ; Skull Woods
LDA $7EF437 : AND.w #$00F0 : LSR #4
BRA ++
+ : CMP.w #$0012 : BNE + ; Ice Palace
LDA $7EF438 : AND.w #$00F0 : LSR #4
BRA ++
+ : CMP.w #$0014 : BNE + ; Tower of Hera
LDA $7EF435 : AND.w #$001C : LSR #2
BRA ++
+ : CMP.w #$0016 : BNE + ; Thieves' Town
LDA $7EF437 : AND.w #$000F
BRA ++
+ : CMP.w #$0018 : BNE + ; Turtle Rock
LDA $7EF439 : AND.w #$00F0 : LSR #4
BRA ++
+ : CMP.w #$001A : BNE + ; Ganon's Tower
LDA $7EF436 : AND.w #$00F8 : LSR #3
BRA ++
+ : ++
JSL.l HexToDec
JMP (CompassCountDungeonHandlers, X) : .return_spot
;LDX.b #$00 ; check the width on this
LDA $7F5006 : AND.w #$00FF : ORA #$2400 : STA $7EC794
LDA $7F5007 : AND.w #$00FF : ORA #$2400 : STA $7EC796
; we switch to 8-bit A in the jump before this
JSR HudHexToDec2Digit
REP #$20
LDA.w #$2830 : STA $7EC798
LDX.b $06 : TXA : ORA #$2400 : STA $7EC794 ; Draw the item count
LDX.b $07 : TXA : ORA #$2400 : STA $7EC796
LDA $040C
CMP.w #$0000 : BNE + ; Sewer Passage, use Hyrule Castle counts
LDA.w #$0008
BRL ++
+ : CMP.w #$0002 : BNE + ; Hyrule Castle
LDA.w #$0008
BRL ++
+ : CMP.w #$0004 : BNE + ; Eastern Palace
LDA.w #$0006
BRL ++
+ : CMP.w #$0006 : BNE + ; Desert Palace
LDA.w #$0006
BRL ++
+ : CMP.w #$0008 : BNE + ; Agahnim's Tower
LDA.w #$0002
BRL ++
+ : CMP.w #$000A : BNE + ; Swamp Palace
LDA.w #$000A
BRL ++
+ : CMP.w #$000C : BNE + ; Dark Palace
LDA.w #$000E
BRA ++
+ : CMP.w #$000E : BNE + ; Misery Mire
LDA.w #$0008
BRA ++
+ : CMP.w #$0010 : BNE + ; Skull Woods
LDA.w #$0008
BRA ++
+ : CMP.w #$0012 : BNE + ; Ice Palace
LDA.w #$0008
BRA ++
+ : CMP.w #$0014 : BNE + ; Tower of Hera
LDA.w #$0006
BRA ++
+ : CMP.w #$0016 : BNE + ; Thieves' Town
LDA.w #$0008
BRA ++
+ : CMP.w #$0018 : BNE + ; Turtle Rock
LDA.w #$000C
BRA ++
+ : CMP.w #$001A : BNE + ; Ganon's Tower
LDA.w #$001B
BRA ++
+ : ++
JSL.l HexToDec
LDA.w #$2830 : STA $7EC798 ; draw the slash
LDA $7F5006 : AND.w #$00FF : ORA #$2400 : STA $7EC79A
LDA $7F5007 : AND.w #$00FF : ORA #$2400 : STA $7EC79C
.done
PLX
.done
RTL
.item_masks ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004
CompassCountDungeonHandlers: ; pointers to functions that handle dungeon-specific code
dw CompassCount_Escape, CompassCount_Escape ; (hyrule castle, sewers)
dw CompassCount_Eastern, CompassCount_Desert, CompassCount_Agah
dw CompassCount_Swamp, CompassCount_PoD, CompassCount_Mire
dw CompassCount_Skull, CompassCount_Ice, CompassCount_Hera
dw CompassCount_Thieves, CompassCount_Trock, CompassCount_Gt
}
CompassCount_Escape:
%DrawConstantNumber(0,8)
SEP #$20
LDA $7EF434 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Eastern:
%DrawConstantNumber(0,6)
SEP #$20
LDA $7EF436 : AND.b #$07
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Desert:
%DrawConstantNumber(0,6)
SEP #$20
LDA $7EF435 : LSR #5
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Agah:
%DrawConstantNumber(0,2)
SEP #$20
LDA $7EF435 : AND.b #$02
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Swamp:
%DrawConstantNumber(1,0)
SEP #$20
LDA $7EF439 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_PoD:
%DrawConstantNumber(1,4)
SEP #$20
LDA $7EF434 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Mire:
%DrawConstantNumber(0,8)
SEP #$20
LDA $7EF438 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Skull:
%DrawConstantNumber(0,8)
SEP #$20
LDA $7EF437 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Ice:
%DrawConstantNumber(0,8)
SEP #$20
LDA $7EF438 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Hera:
%DrawConstantNumber(0,6)
SEP #$20
LDA $7EF435 : AND.b #$1C : LSR #2
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Thieves:
%DrawConstantNumber(0,8)
SEP #$20
LDA $7EF437 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Trock:
%DrawConstantNumber(1,2)
SEP #$20
LDA $7EF439 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Gt:
%DrawConstantNumber(2,7)
SEP #$20
LDA $7EF436 : LSR #3
JMP DrawDungeonCompassCounts_return_spot
;--------------------------------------------------------------------------------
; $7EF434 - hhhhdddd - item locations checked
; h - hyrule castle/sewers

View File

@@ -16,12 +16,10 @@ OnPrepFileSelect:
RTL
;--------------------------------------------------------------------------------
OnDrawHud:
JSL.l Draw4DigitRupees
JSL.l DrawChallengeTimer
JSL.l DrawGoalIndicator
JSL.l DrawDungeonCompassCounts
JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter
JSL.l NewDrawHud
JSL.l SwapSpriteIfNecissary
RTL
JML.l ReturnFromOnDrawHud
;--------------------------------------------------------------------------------
;OnDungeonEntrance:
; STA $7EC172 ; thing we wrote over

View File

@@ -2,39 +2,9 @@
; $7F5010 - Scratch Space (Callee Preserved)
;--------------------------------------------------------------------------------
!GOAL_COUNTER = "$7EF418"
!DRAW_ADDRESS = "$7EC72A"
DrawGoalIndicator:
LDA.l GoalItemRequirement : AND.w #$00FF : BNE + : RTL : + ; Star Meter
PHX
LDX.w #$0000
LDA.l GoalItemIcon : STA !DRAW_ADDRESS, X : INX #2 ; draw star icon and move the cursor
LDA.l !GOAL_COUNTER
AND.w #$00FF
JSL.l HexToDec
LDA $7F5005 : AND.w #$00FF : ORA.w #$2400 : STA !DRAW_ADDRESS, X : INX #2 ; draw 100's digit and move the cursor
LDA $7F5006 : AND.w #$00FF : ORA.w #$2400 : STA !DRAW_ADDRESS, X : INX #2 ; draw 10's digit and move the cursor
LDA $7F5007 : AND.w #$00FF : ORA.w #$2400 : STA !DRAW_ADDRESS, X : INX #2 ; draw 1's and move the cursor
LDA.l GoalItemRequirement : AND.w #$00FF : CMP.w #$00FF : BEQ .skip
LDA.w #$2830 : STA !DRAW_ADDRESS, X : INX #2 ; draw slash and move the cursor
LDA.l GoalItemRequirement
AND.w #$00FF
JSL.l HexToDec
LDA $7F5005 : AND.w #$00FF : ORA.w #$2400 : STA !DRAW_ADDRESS, X : INX #2 ; draw 100's digit and move the cursor
LDA $7F5006 : AND.w #$00FF : ORA.w #$2400 : STA !DRAW_ADDRESS, X : INX #2 ; draw 10's digit and move the cursor
LDA $7F5007 : AND.w #$00FF : ORA.w #$2400 : STA !DRAW_ADDRESS, X : INX #2 ; draw 1's and move the cursor
BRA .done
.skip
LDA.w #$207F
STA !DRAW_ADDRESS, X : INX #2
STA !DRAW_ADDRESS, X : INX #2
STA !DRAW_ADDRESS, X : INX #2
.done
PLX
RTL
!GOAL_DRAW_ADDRESS = "$7EC72A"
;--------------------------------------------------------------------------------
; DrawGoalIndicator moved to newhud.asm
;--------------------------------------------------------------------------------
GoalItemGanonCheck:
LDA $0E20, X : CMP.b #$D6 : BNE .success ; skip if not ganon

View File

@@ -225,9 +225,6 @@ JSL.l LoadBombCount16
org $0DDEB3 ; <- 6DEB3 - equipment.asm : 328 (LDA $7EF33F, X)
JSL.l IsItemAvailable
;--------------------------------------------------------------------------------
org $0DFC5B ; <- 6FC5B - headsup_display.asm : 839 (LDA .mp_tilemap+0, X : STA $7EC746)
JSL.l DrawMagicMeter : JMP.w + : NOP #21 : +
;--------------------------------------------------------------------------------
;================================================================================
; Inverted Mode
@@ -1198,22 +1195,10 @@ JSL.l RNG_Trinexx
;================================================================================
; HUD Changes
;--------------------------------------------------------------------------------
org $0DFC77 ; <- 6FC77 - headsup_display.asm : 845
NOP #$2D ; #45
org $0DFC77 ; <- 6FC77 - yes these are both the correct address - kkat
JSL.l OnDrawHud
BRA $27
org $0DFCAE ; <- 6FCAE
JSL.l DrawBombCount ; nudge bomb digits right
BRA +
NOP #$14 : + ; #20
org $0DFCD2 ; <- 6FCD2
JSL.l DrawArrowCount
BRA +
NOP #$14 : + ; #20
org $0DFC4C ; <- 6FC4C - headsup_display.asm : 836 (LDA $7EF36E : AND.w #$00FF : ADD.w #$0007 : AND.w #$FFF8 : TAX)
JML.l OnDrawHud
NOP #199
ReturnFromOnDrawHud:
;org $0DFD0A ; <- 6FD0A - headsup_display.asm : 900
@@ -1224,7 +1209,7 @@ STA $7EC726 ; key icon blank
org $0DFC37 ; <- 6FC37 - headsup_display.asm : 828 (LDA.w #$28F7)
JSL.l DrawMagicHeader
NOP #17
BRA + : NOP #15 : +
;--------------------------------------------------------------------------------
org $0DFB29 ; <- headsup_display.asm : 688 (LDA.b #$86 : STA $7EC71E)
;LDA.b #$86 : STA $7EC720 ; nudge silver arrow right - remember to update this in newit
@@ -1394,12 +1379,6 @@ JSL.l HUDRebuildIndoor : NOP #4
org $029A35 ; <- 11A35 : Bank02.asm:4789 - (JSL HUD.RebuildIndoor.palace)
JSL.l HUDRebuildIndoorHole
;--------------------------------------------------------------------------------
org $0DFCEC ; <- 6FCEC : headsup_display.asm:887 - (LDA.w #$007F : STA $05)
LDA.w #$7F7F : STA $04 ; Have both key digits default to blank
org $0DFD02 ; <- 6FD02 ; headsup_display.asm:900 - (LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC764)
JSL.l DrawKeyIcon : NOP #8
;--------------------------------------------------------------------------------
;================================================================================
; Pendant / Crystal Fixes

274
newhud.asm Normal file
View File

@@ -0,0 +1,274 @@
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 + : BRL .done : + ; Star Meter
LDA.l !GOAL_COUNTER
JSR HudHexToDec3Digit
REP #$20
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
LDA.l GoalItemRequirement : AND.w #$00FF : CMP.w #$00FF : BEQ .skip
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDA.l GoalItemRequirement
AND.w #$00FF
JSR HudHexToDec4Digit
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
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 #$00FF : BEQ + ; skip if CompassMode is 0. Saves
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
.in_dungeon
JSR HudHexToDec2Digit : REP #$20
; if 10s digit is 0, draw transparent tile instead of 0
LDX.b $06 : TXA : CPX.b #$90 : BNE +
LDA.w #$007F
+
ORA.w #$2400 : STA !KEY_DIGITS_ADDRESS
; 1s digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !KEY_DIGITS_ADDRESS+2
BRA .done_keys
.not_in_dungeon
REP #$20
;in the overworld, draw transparent tiles instead of key count
LDA.w #$247F : STA !KEY_DIGITS_ADDRESS : STA !KEY_DIGITS_ADDRESS+2
STA !KEY_ICON_ADDRESS
.done_keys
;--------------------------------------------------------------------------------
; Draw Magic Meter
!INFINITE_MAGIC = "$7F50CA"
!DrawMagicMeter_mp_tilemap = "$0DFE0F"
;--------------------------------------------------------------------------------
LDA $7EF36E : 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 + : BRL .green : +
SEP #$20 : LDA.b #$80 : STA $7EF36E : REP #$30 ; set magic to max
LDX.w #$0080 ; load full magic meter graphics
LDA $1A : AND.w #$000C : LSR #2
BEQ .red
CMP.w #0001 : BEQ .yellow
CMP.w #0002 : BNE + : BRL .green : +
.blue
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA $7EC806
RTL
.red
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA $7EC806
RTL
.yellow
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA $7EC806
RTL
.orange
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA $7EC806
RTL
.green
LDA !DrawMagicMeter_mp_tilemap+0, X : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : STA $7EC806
RTL
;================================================================================
; 16-bit A, 8-bit X
; in: A(b) - Byte to Convert
; out: $04 - $07 (high - low)
;================================================================================
HudHexToDec4Digit:
LDY.b #$90
-
CMP.w #1000 : !BLT +
INY
!SUB.w #1000 : BRA -
+
STY $04 : LDY #$90 ; Store 1000s digit & reset Y
-
CMP.w #100 : !BLT +
INY
!SUB.w #100 : BRA -
+
STY $05 : LDY #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
!SUB.w #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit & reset Y
-
CMP.w #1 : !BLT +
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
;================================================================================
; 8-bit registers
; 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
!SUB.b #100 : BRA -
+
STY $05 : LDY.b #$90 ; Store 100s digit and reset Y
-
CMP.b #10 : !BLT +
INY
!SUB.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
; in: A(b) - Byte to Convert
; out: $06 - $07 (high - low)
;================================================================================
HudHexToDec2Digit:
LDY.b #$90
-
CMP.b #10 : !BLT +
INY
!SUB.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

View File

@@ -242,42 +242,6 @@ RTL
;$388 = Turtle Rock
;$389 = Ganon's Tower
;--------------------------------------------------------------------------------
!INFINITE_BOMBS = "$7F50C9"
DrawBombCount:
LDA !INFINITE_BOMBS : BNE .infinite
.finite
REP #$30
; $04 & $05 are set by the game's own HexToDecimal code, immediately before this
LDA.b $04 : AND #$00FF : ORA #$2400 : STA $7EC75A ; Draw bombs 10 digit
LDA.b $05 : AND #$00FF : ORA #$2400 : STA $7EC75C ; Draw bombs 1 digit
RTL
.infinite
REP #$30
LDA.w #$2431 : STA $7EC75A ; infinity symbol (left half)
INC A : STA $7EC75C ; infinity symbol (right half)
RTL
!INFINITE_ARROWS = "$7F50C8"
DrawArrowCount:
LDA.l ArrowMode : BNE +
LDA !INFINITE_ARROWS : BNE .infinite
.finite
; $04 & $05 are set by the game's own HexToDecimal code, immediately before this
REP #$30
LDA.b $04 : AND #$00FF : ORA #$2400 : STA $7EC760 ; Draw arrows 10 digit
LDA.b $05 : AND #$00FF : ORA #$2400 : STA $7EC762 ; Draw arrows 1 digit
RTL
.infinite
REP #$30
LDA.w #$2431 : STA $7EC760 ; infinity symbol (left half)
INC A : STA $7EC762 ; infinity symbol (right half)
RTL
+
REP #$30
RTL
DrawBootsInMenuLocation:
LDA.l HUDDungeonItems : BNE +
LDA.w #$1608 : STA $00
@@ -286,47 +250,6 @@ DrawBootsInMenuLocation:
LDA.w #$1588 : STA $00
RTL
;--------------------------------------------------------------------------------
!INFINITE_MAGIC = "$7F50CA"
!DrawMagicMeter_mp_tilemap = "$0DFE0F"
DrawMagicMeter:
LDA !INFINITE_MAGIC : AND.w #$00FF : BNE + : BRL .green : +
SEP #$20 : LDA.b #$80 : STA $7EF36E : REP #$20 ; set magic to max
LDX.w #$0080 ; load full magic meter graphics
LDA $1A : AND.w #$000C : LSR #2
BEQ .red
CMP.w #0001 : BEQ .yellow
CMP.w #0002 : BNE + : BRL .green : +
.blue
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA $7EC806
RTL
.red
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA $7EC806
RTL
.yellow
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA $7EC806
RTL
.orange
LDA !DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA $7EC806
RTL
.green
LDA !DrawMagicMeter_mp_tilemap+0, X : STA $7EC746
LDA !DrawMagicMeter_mp_tilemap+2, X : STA $7EC786
LDA !DrawMagicMeter_mp_tilemap+4, X : STA $7EC7C6
LDA !DrawMagicMeter_mp_tilemap+6, X : STA $7EC806
RTL
;--------------------------------------------------------------------------------
DrawGlovesInMenuLocation:
LDA.l HUDDungeonItems : BNE +
LDA.w #$1610 : STA $00

View File

@@ -133,9 +133,9 @@ DrawChallengeTimer:
RTL
+
LDA.w #$247F : STA $7EC790
LDA.w #$247F : STA $7EC792
LDA.w #$247F : STA $7EC794
LDA.w #$247F : STA $7EC796
STA $7EC792
STA $7EC794
STA $7EC796
++
LDA.l TimerStyle : BNE + : RTL : + ; Hud Timer