Merge pull request #192 from cassidoxa/hundo_mode
Add "completionist" goals and HUD item counter
This commit is contained in:
@@ -28,7 +28,7 @@ db #$20, #$19, #$08, #$31 ; year/month/day
|
||||
|
||||
;================================================================================
|
||||
!ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers)
|
||||
!ROM_VERSION_HIGH ?= 2 ;
|
||||
!ROM_VERSION_HIGH ?= 3 ;
|
||||
|
||||
org $00FFE0 ; Unused hardware vector
|
||||
RomVersion:
|
||||
@@ -156,6 +156,7 @@ incsrc darkroomitems.asm
|
||||
incsrc fastcredits.asm
|
||||
incsrc msu.asm
|
||||
incsrc dungeonmap.asm
|
||||
incsrc hextodec.asm
|
||||
if !FEATURE_NEW_TEXT
|
||||
incsrc textrenderer.asm
|
||||
endif
|
||||
|
||||
@@ -1,73 +1,9 @@
|
||||
DrawDungeonItemCounts:
|
||||
LDX.b IndoorsFlag : BNE + : RTL : + ; Skip if outdoors
|
||||
; extra hard safeties for getting dungeon ID to prevent crashes
|
||||
PHA
|
||||
LDA.w DungeonID : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
|
||||
PLA
|
||||
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
|
||||
|
||||
JSR.w DrawCompassCounts
|
||||
JSR.w DrawMapCounts
|
||||
.done
|
||||
RTL
|
||||
|
||||
DrawCompassCounts:
|
||||
PHX
|
||||
LDA.l CompassMode : AND.w #$00FF : BEQ .done
|
||||
BIT.w #$0002 : BNE + ; if CompassMode==2, we don't check for the compass
|
||||
LDA.l CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
|
||||
BEQ .done ; skip if we don't have compass
|
||||
+
|
||||
TXA : LSR : TAX
|
||||
LDA.l CompassTotalsWRAM, X : AND.w #$00FF
|
||||
SEP #$20
|
||||
JSR HudHexToDec2Digit
|
||||
REP #$20
|
||||
PHX
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9A
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9C
|
||||
PLX
|
||||
LDA.l DungeonLocationsChecked, X : AND.w #$00FF
|
||||
SEP #$20
|
||||
JSR HudHexToDec2Digit
|
||||
REP #$20
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$94 ; Draw the item count
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$96
|
||||
LDA.w #$2830 : STA.l HUDTileMapBuffer+$98 ; draw the slash
|
||||
.done
|
||||
PLX
|
||||
RTS
|
||||
|
||||
DrawMapCounts:
|
||||
PHX
|
||||
LDA.l MapHUDMode : AND.w #$00FF : BEQ .done
|
||||
BIT.w #$0002 : BNE + ; if MapHUDMode==2, we don't check for map
|
||||
LDA.l MapField : AND.l DungeonItemMasks, X ; Load map values to A, mask with dungeon item masks
|
||||
BEQ .done ; skip if we don't have map
|
||||
+
|
||||
TXA : LSR : TAX
|
||||
LDA.l MapTotalsWRAM, X : AND.w #$00FF
|
||||
SEP #$20
|
||||
JSR HudHexToDec2Digit
|
||||
REP #$20
|
||||
PHX
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$A6
|
||||
PLX
|
||||
LDA.l DungeonCollectedKeys, X : AND.w #$00FF
|
||||
SEP #$20
|
||||
JSR HudHexToDec2Digit
|
||||
REP #$20
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$A2
|
||||
LDA.w #$2830 : STA.l HUDTileMapBuffer+$A4 ; draw the slash
|
||||
.done
|
||||
PLX
|
||||
RTS
|
||||
|
||||
DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
|
||||
dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100
|
||||
dw $0080, $0040, $0020, $0010, $0008, $0004
|
||||
;--------------------------------------------------------------------------------
|
||||
InitDungeonCounts:
|
||||
PHB
|
||||
LDX.b #$0F
|
||||
-
|
||||
LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X
|
||||
@@ -78,5 +14,18 @@ InitDungeonCounts:
|
||||
LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X
|
||||
DEX
|
||||
BPL -
|
||||
|
||||
LDA.b #$7E
|
||||
PHA : PLB
|
||||
REP #$30
|
||||
LDA.l TotalItemCount
|
||||
JSL.l HUDHex4Digit_Long
|
||||
SEP #$20
|
||||
LDA.b Scrap04 : TAX : STX.w TotalItemCountTiles+$00
|
||||
LDA.b Scrap05 : TAX : STX.w TotalItemCountTiles+$02
|
||||
LDA.b Scrap06 : TAX : STX.w TotalItemCountTiles+$04
|
||||
LDA.b Scrap07 : TAX : STX.w TotalItemCountTiles+$06
|
||||
SEP #$10
|
||||
PLB
|
||||
RTL
|
||||
|
||||
|
||||
@@ -155,6 +155,7 @@ JML.l AllowStartFromExitReturn
|
||||
STZ.b SubSubModule
|
||||
STZ.w DeathReloadFlag
|
||||
STZ.w RespawnFlag
|
||||
INC.w UpdateHUD
|
||||
|
||||
JSL Equipment_SearchForEquippedItemLong
|
||||
JSL HUD_RebuildLong2
|
||||
|
||||
36
events.asm
36
events.asm
@@ -17,6 +17,7 @@ JML.l ReturnFromOnDrawHud
|
||||
OnDungeonEntrance:
|
||||
STA.l PegColor ; thing we wrote over
|
||||
JSL MaybeFlagDungeonTotalsEntrance
|
||||
INC.w UpdateHUD
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
OnPlayerDead:
|
||||
@@ -28,18 +29,19 @@ OnPlayerDead:
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
OnDungeonExit:
|
||||
PHA : PHP
|
||||
SEP #$20 ; set 8-bit accumulator
|
||||
JSL.l SQEGFix
|
||||
PLP : PLA
|
||||
PHA : PHP
|
||||
SEP #$20 ; set 8-bit accumulator
|
||||
JSL.l SQEGFix
|
||||
PLP : PLA
|
||||
|
||||
STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over
|
||||
STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over
|
||||
|
||||
PHA : PHP
|
||||
JSL.l HUD_RebuildLong
|
||||
JSL.l FloodGateResetInner
|
||||
JSL.l SetSilverBowMode
|
||||
PLP : PLA
|
||||
PHA : PHP
|
||||
JSL.l HUD_RebuildLong
|
||||
INC.w UpdateHUD
|
||||
JSL.l FloodGateResetInner
|
||||
JSL.l SetSilverBowMode
|
||||
PLP : PLA
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
OnQuit:
|
||||
@@ -77,6 +79,7 @@ RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
OnAga2Defeated:
|
||||
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
|
||||
LDA.b #$FF : STA.w DungeonID
|
||||
LDA.b #$01 : STA.l Aga2Duck
|
||||
JML.l IncrementAgahnim2Sword
|
||||
;--------------------------------------------------------------------------------
|
||||
@@ -193,12 +196,13 @@ OnLinkDamagedFromPitOutdoors:
|
||||
JML.l OHKOTimer ; make sure this is last
|
||||
;--------------------------------------------------------------------------------
|
||||
OnOWTransition:
|
||||
JSL.l FloodGateReset
|
||||
JSL.l StatTransitionCounter
|
||||
PHP
|
||||
SEP #$20 ; set 8-bit accumulator
|
||||
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
|
||||
PLP
|
||||
JSL.l FloodGateReset
|
||||
JSL.l StatTransitionCounter
|
||||
PHP
|
||||
SEP #$20 ; set 8-bit accumulator
|
||||
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
|
||||
INC.w UpdateHUD
|
||||
PLP
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
OnLoadDuckMap:
|
||||
|
||||
@@ -370,10 +370,10 @@ DrawPlayerFileShared:
|
||||
%fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4)
|
||||
++
|
||||
|
||||
LDA.l EquipmentSRAM+$0108 : AND.w #$00FF
|
||||
JSL.l HexToDec
|
||||
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26)
|
||||
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27)
|
||||
LDA.l EquipmentSRAM+$0130 : AND.w #$00FF
|
||||
JSL.l HUDHex2Digit_Long
|
||||
TYA : AND.w #$00FF : !ADD.w #$0210+!FS_COLOR_BW : %fs_draw8x8(11,26)
|
||||
TXA : AND.w #$00FF : !ADD.w #$0210+!FS_COLOR_BW : %fs_draw8x8(11,27)
|
||||
|
||||
; Boots
|
||||
%fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots)
|
||||
@@ -601,30 +601,30 @@ FileSelectItems:
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
FileSelectDrawHudBar:
|
||||
LDA.w #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
|
||||
LDA.l DisplayRupeesSRAM
|
||||
JSL.l HexToDec
|
||||
LDA.l HexToDecDigit2 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9)
|
||||
LDA.l HexToDecDigit3 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10)
|
||||
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11)
|
||||
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12)
|
||||
LDA.w #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
|
||||
LDA.l DisplayRupeesSRAM
|
||||
JSL.l HUDHex4Digit_Long
|
||||
LDA.b Scrap04 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9)
|
||||
LDA.b Scrap05 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10)
|
||||
LDA.b Scrap06 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11)
|
||||
LDA.b Scrap07 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12)
|
||||
|
||||
LDA.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
|
||||
LDA.l BombsEquipmentSRAM : AND.w #$00FF
|
||||
JSL.l HexToDec
|
||||
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14)
|
||||
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
|
||||
LDA.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
|
||||
LDA.l BombsEquipmentSRAM : AND.w #$00FF
|
||||
JSL.l HUDHex2Digit_Long
|
||||
TYA : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14)
|
||||
TXA : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
|
||||
|
||||
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
|
||||
LDA.w #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
|
||||
BRA ++
|
||||
+
|
||||
LDA.w #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
|
||||
++
|
||||
LDA.l CurrentArrowsSRAM : AND.w #$00FF
|
||||
JSL.l HexToDec
|
||||
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17)
|
||||
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18)
|
||||
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
|
||||
LDA.w #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
|
||||
BRA ++
|
||||
+
|
||||
LDA.w #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
|
||||
++
|
||||
LDA.l CurrentArrowsSRAM : AND.w #$00FF
|
||||
JSL.l HUDHex2Digit_Long
|
||||
TYA : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17)
|
||||
TXA : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18)
|
||||
RTS
|
||||
;--------------------------------------------------------------------------------
|
||||
AltBufferTable:
|
||||
|
||||
17
goalitem.asm
17
goalitem.asm
@@ -39,6 +39,8 @@ CheckGanonVulnerability:
|
||||
dw .crystals_and_bosses
|
||||
dw .bosses_only
|
||||
dw .all_dungeons_no_agahnim
|
||||
dw .all_items
|
||||
dw .completionist
|
||||
|
||||
; 00 = always vulnerable
|
||||
.vulnerable
|
||||
@@ -92,6 +94,21 @@ CheckGanonVulnerability:
|
||||
.bosses_only
|
||||
JMP CheckForCrystalBossesDefeated
|
||||
|
||||
; 09 = 100% item collection rate
|
||||
.all_items
|
||||
REP #$20
|
||||
LDA.l TotalItemCounter : CMP.l TotalItemCount
|
||||
SEP #$20
|
||||
RTS
|
||||
|
||||
; 0A = 100% item collection rate and all dungeons
|
||||
.completionist
|
||||
REP #$20
|
||||
LDA.l TotalItemCounter : CMP.l TotalItemCount
|
||||
SEP #$20
|
||||
BCC .fail
|
||||
BRA .all_dungeons
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
GetRequiredCrystalsForTower:
|
||||
BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over
|
||||
|
||||
215
hextodec.asm
Normal file
215
hextodec.asm
Normal file
@@ -0,0 +1,215 @@
|
||||
;===================================================================================================
|
||||
; New file because of the enormous table
|
||||
;===================================================================================================
|
||||
;--------------------------------------------------------------------------------
|
||||
; HexToDec
|
||||
; in: A(w) - Word to Convert
|
||||
; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
|
||||
;--------------------------------------------------------------------------------
|
||||
HexToDec:
|
||||
PHP
|
||||
REP #$30
|
||||
PHX
|
||||
PHA
|
||||
|
||||
CMP.w #1000
|
||||
BCS .over_1000
|
||||
|
||||
ASL
|
||||
TAX
|
||||
|
||||
LDA.l FastHexTable,X
|
||||
|
||||
SEP #$20
|
||||
|
||||
AND.b #$0F
|
||||
STA.l HexToDecDigit5
|
||||
|
||||
LDA.l FastHexTable,X
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
STA.l HexToDecDigit4
|
||||
|
||||
XBA
|
||||
AND.b #$0F
|
||||
STA.l HexToDecDigit3
|
||||
|
||||
REP #$20
|
||||
|
||||
LDA.l #$0000
|
||||
STA.l HexToDecDigit1
|
||||
|
||||
PLA
|
||||
PLX
|
||||
PLP
|
||||
RTL
|
||||
|
||||
;---------------------------------------------------------------------------------------------------
|
||||
|
||||
.over_1000
|
||||
; get remainder mod100
|
||||
STA.l $4204
|
||||
|
||||
SEP #$20
|
||||
LDA.b #100
|
||||
STA.l $4206
|
||||
|
||||
PHD
|
||||
PLD
|
||||
REP #$20
|
||||
XBA
|
||||
LDA.l $4216
|
||||
AND.w #$7F
|
||||
ASL
|
||||
TAX
|
||||
|
||||
SEP #$20
|
||||
LDA.l FastHexTable,X
|
||||
AND.b #$0F
|
||||
STA.l HexToDecDigit5
|
||||
|
||||
LDA.l FastHexTable,X
|
||||
AND.b #$F0
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
STA.l HexToDecDigit4
|
||||
|
||||
REP #$20
|
||||
|
||||
LDA.l $4214
|
||||
ASL
|
||||
TAX
|
||||
|
||||
LDA.l FastHexTable,X
|
||||
|
||||
SEP #$20
|
||||
|
||||
AND.b #$0F
|
||||
STA.l HexToDecDigit3
|
||||
|
||||
LDA.l FastHexTable,X
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
STA.l HexToDecDigit2
|
||||
|
||||
XBA
|
||||
AND.b #$0F
|
||||
STA.l HexToDecDigit1
|
||||
|
||||
REP #$20
|
||||
PLA
|
||||
PLX
|
||||
PLP
|
||||
RTL
|
||||
|
||||
;===================================================================================================
|
||||
|
||||
FastHexTable:
|
||||
dw $000, $001, $002, $003, $004, $005, $006, $007, $008, $009
|
||||
dw $010, $011, $012, $013, $014, $015, $016, $017, $018, $019
|
||||
dw $020, $021, $022, $023, $024, $025, $026, $027, $028, $029
|
||||
dw $030, $031, $032, $033, $034, $035, $036, $037, $038, $039
|
||||
dw $040, $041, $042, $043, $044, $045, $046, $047, $048, $049
|
||||
dw $050, $051, $052, $053, $054, $055, $056, $057, $058, $059
|
||||
dw $060, $061, $062, $063, $064, $065, $066, $067, $068, $069
|
||||
dw $070, $071, $072, $073, $074, $075, $076, $077, $078, $079
|
||||
dw $080, $081, $082, $083, $084, $085, $086, $087, $088, $089
|
||||
dw $090, $091, $092, $093, $094, $095, $096, $097, $098, $099
|
||||
dw $100, $101, $102, $103, $104, $105, $106, $107, $108, $109
|
||||
dw $110, $111, $112, $113, $114, $115, $116, $117, $118, $119
|
||||
dw $120, $121, $122, $123, $124, $125, $126, $127, $128, $129
|
||||
dw $130, $131, $132, $133, $134, $135, $136, $137, $138, $139
|
||||
dw $140, $141, $142, $143, $144, $145, $146, $147, $148, $149
|
||||
dw $150, $151, $152, $153, $154, $155, $156, $157, $158, $159
|
||||
dw $160, $161, $162, $163, $164, $165, $166, $167, $168, $169
|
||||
dw $170, $171, $172, $173, $174, $175, $176, $177, $178, $179
|
||||
dw $180, $181, $182, $183, $184, $185, $186, $187, $188, $189
|
||||
dw $190, $191, $192, $193, $194, $195, $196, $197, $198, $199
|
||||
dw $200, $201, $202, $203, $204, $205, $206, $207, $208, $209
|
||||
dw $210, $211, $212, $213, $214, $215, $216, $217, $218, $219
|
||||
dw $220, $221, $222, $223, $224, $225, $226, $227, $228, $229
|
||||
dw $230, $231, $232, $233, $234, $235, $236, $237, $238, $239
|
||||
dw $240, $241, $242, $243, $244, $245, $246, $247, $248, $249
|
||||
dw $250, $251, $252, $253, $254, $255, $256, $257, $258, $259
|
||||
dw $260, $261, $262, $263, $264, $265, $266, $267, $268, $269
|
||||
dw $270, $271, $272, $273, $274, $275, $276, $277, $278, $279
|
||||
dw $280, $281, $282, $283, $284, $285, $286, $287, $288, $289
|
||||
dw $290, $291, $292, $293, $294, $295, $296, $297, $298, $299
|
||||
dw $300, $301, $302, $303, $304, $305, $306, $307, $308, $309
|
||||
dw $310, $311, $312, $313, $314, $315, $316, $317, $318, $319
|
||||
dw $320, $321, $322, $323, $324, $325, $326, $327, $328, $329
|
||||
dw $330, $331, $332, $333, $334, $335, $336, $337, $338, $339
|
||||
dw $340, $341, $342, $343, $344, $345, $346, $347, $348, $349
|
||||
dw $350, $351, $352, $353, $354, $355, $356, $357, $358, $359
|
||||
dw $360, $361, $362, $363, $364, $365, $366, $367, $368, $369
|
||||
dw $370, $371, $372, $373, $374, $375, $376, $377, $378, $379
|
||||
dw $380, $381, $382, $383, $384, $385, $386, $387, $388, $389
|
||||
dw $390, $391, $392, $393, $394, $395, $396, $397, $398, $399
|
||||
dw $400, $401, $402, $403, $404, $405, $406, $407, $408, $409
|
||||
dw $410, $411, $412, $413, $414, $415, $416, $417, $418, $419
|
||||
dw $420, $421, $422, $423, $424, $425, $426, $427, $428, $429
|
||||
dw $430, $431, $432, $433, $434, $435, $436, $437, $438, $439
|
||||
dw $440, $441, $442, $443, $444, $445, $446, $447, $448, $449
|
||||
dw $450, $451, $452, $453, $454, $455, $456, $457, $458, $459
|
||||
dw $460, $461, $462, $463, $464, $465, $466, $467, $468, $469
|
||||
dw $470, $471, $472, $473, $474, $475, $476, $477, $478, $479
|
||||
dw $480, $481, $482, $483, $484, $485, $486, $487, $488, $489
|
||||
dw $490, $491, $492, $493, $494, $495, $496, $497, $498, $499
|
||||
dw $500, $501, $502, $503, $504, $505, $506, $507, $508, $509
|
||||
dw $510, $511, $512, $513, $514, $515, $516, $517, $518, $519
|
||||
dw $520, $521, $522, $523, $524, $525, $526, $527, $528, $529
|
||||
dw $530, $531, $532, $533, $534, $535, $536, $537, $538, $539
|
||||
dw $540, $541, $542, $543, $544, $545, $546, $547, $548, $549
|
||||
dw $550, $551, $552, $553, $554, $555, $556, $557, $558, $559
|
||||
dw $560, $561, $562, $563, $564, $565, $566, $567, $568, $569
|
||||
dw $570, $571, $572, $573, $574, $575, $576, $577, $578, $579
|
||||
dw $580, $581, $582, $583, $584, $585, $586, $587, $588, $589
|
||||
dw $590, $591, $592, $593, $594, $595, $596, $597, $598, $599
|
||||
dw $600, $601, $602, $603, $604, $605, $606, $607, $608, $609
|
||||
dw $610, $611, $612, $613, $614, $615, $616, $617, $618, $619
|
||||
dw $620, $621, $622, $623, $624, $625, $626, $627, $628, $629
|
||||
dw $630, $631, $632, $633, $634, $635, $636, $637, $638, $639
|
||||
dw $640, $641, $642, $643, $644, $645, $646, $647, $648, $649
|
||||
dw $650, $651, $652, $653, $654, $655, $656, $657, $658, $659
|
||||
dw $660, $661, $662, $663, $664, $665, $666, $667, $668, $669
|
||||
dw $670, $671, $672, $673, $674, $675, $676, $677, $678, $679
|
||||
dw $680, $681, $682, $683, $684, $685, $686, $687, $688, $689
|
||||
dw $690, $691, $692, $693, $694, $695, $696, $697, $698, $699
|
||||
dw $700, $701, $702, $703, $704, $705, $706, $707, $708, $709
|
||||
dw $710, $711, $712, $713, $714, $715, $716, $717, $718, $719
|
||||
dw $720, $721, $722, $723, $724, $725, $726, $727, $728, $729
|
||||
dw $730, $731, $732, $733, $734, $735, $736, $737, $738, $739
|
||||
dw $740, $741, $742, $743, $744, $745, $746, $747, $748, $749
|
||||
dw $750, $751, $752, $753, $754, $755, $756, $757, $758, $759
|
||||
dw $760, $761, $762, $763, $764, $765, $766, $767, $768, $769
|
||||
dw $770, $771, $772, $773, $774, $775, $776, $777, $778, $779
|
||||
dw $780, $781, $782, $783, $784, $785, $786, $787, $788, $789
|
||||
dw $790, $791, $792, $793, $794, $795, $796, $797, $798, $799
|
||||
dw $800, $801, $802, $803, $804, $805, $806, $807, $808, $809
|
||||
dw $810, $811, $812, $813, $814, $815, $816, $817, $818, $819
|
||||
dw $820, $821, $822, $823, $824, $825, $826, $827, $828, $829
|
||||
dw $830, $831, $832, $833, $834, $835, $836, $837, $838, $839
|
||||
dw $840, $841, $842, $843, $844, $845, $846, $847, $848, $849
|
||||
dw $850, $851, $852, $853, $854, $855, $856, $857, $858, $859
|
||||
dw $860, $861, $862, $863, $864, $865, $866, $867, $868, $869
|
||||
dw $870, $871, $872, $873, $874, $875, $876, $877, $878, $879
|
||||
dw $880, $881, $882, $883, $884, $885, $886, $887, $888, $889
|
||||
dw $890, $891, $892, $893, $894, $895, $896, $897, $898, $899
|
||||
dw $900, $901, $902, $903, $904, $905, $906, $907, $908, $909
|
||||
dw $910, $911, $912, $913, $914, $915, $916, $917, $918, $919
|
||||
dw $920, $921, $922, $923, $924, $925, $926, $927, $928, $929
|
||||
dw $930, $931, $932, $933, $934, $935, $936, $937, $938, $939
|
||||
dw $940, $941, $942, $943, $944, $945, $946, $947, $948, $949
|
||||
dw $950, $951, $952, $953, $954, $955, $956, $957, $958, $959
|
||||
dw $960, $961, $962, $963, $964, $965, $966, $967, $968, $969
|
||||
dw $970, $971, $972, $973, $974, $975, $976, $977, $978, $979
|
||||
dw $980, $981, $982, $983, $984, $985, $986, $987, $988, $989
|
||||
dw $990, $991, $992, $993, $994, $995, $996, $997, $998, $999
|
||||
|
||||
;===================================================================================================
|
||||
22
hooks.asm
22
hooks.asm
@@ -368,7 +368,6 @@ STA.l StalfosBombDamage
|
||||
;--------------------------------------------------------------------------------
|
||||
org $0AB76E ; <- 5376E - Bank0A.asm : 30 (JSL OverworldMap_InitGfx)
|
||||
JSL.l OnLoadDuckMap
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;================================================================================
|
||||
; Infinite Bombs / Arrows / Magic
|
||||
@@ -1358,9 +1357,7 @@ JSL.l DrawMagicHeader
|
||||
BRA + : NOP #15 : +
|
||||
;--------------------------------------------------------------------------------
|
||||
org $0DFB29 ; <- headsup_display.asm : 688 (LDA.b #$86 : STA $7EC71E)
|
||||
JSL.l DrawHUDArrows : BRA +
|
||||
NOP #18
|
||||
+
|
||||
BRA + : NOP #$16 : +
|
||||
;--------------------------------------------------------------------------------
|
||||
org $01CF67 ; <- CF67 - Bank01.asm : 11625 (STA $7EF36F)
|
||||
JSL.l DecrementSmallKeys
|
||||
@@ -1376,6 +1373,23 @@ MVN $217E
|
||||
;--------------------------------------------------------------------------------
|
||||
org $0DFB1F ; 6FB1F - headsup_display.asm : 681 (LDA $7EF340 : BEQ .hastNoBow)
|
||||
JSL.l CheckHUDSilverArrows
|
||||
;--------------------------------------------------------------------------------
|
||||
org $0DF1AB
|
||||
JSR.w RebuildHUD_update
|
||||
org $0DDFC8
|
||||
JSR.w RebuildHUD_update
|
||||
org $0DDB88 ; Don't rebuild HUD twice on icon refresh
|
||||
NOP #3 ; Not sure why this is here
|
||||
;--------------------------------------------------------------------------------
|
||||
org $07A205
|
||||
JSL.l RebuildHUD_update_long
|
||||
org $0AEF62
|
||||
JSL.l RebuildHUD_update_long
|
||||
;--------------------------------------------------------------------------------
|
||||
org $0DFFE1
|
||||
RebuildHUD_update_long:
|
||||
JSR.w RebuildHUD_update : RTL
|
||||
warnpc $0E8000
|
||||
|
||||
;================================================================================
|
||||
; 300 Rupee NPC
|
||||
|
||||
@@ -616,7 +616,6 @@ RTS
|
||||
RTL
|
||||
|
||||
.incrementVanillaKey
|
||||
LDA.l SmallKeyCounter : INC : STA.l SmallKeyCounter
|
||||
JSL.l UpdateKeys
|
||||
|
||||
.incrementKey
|
||||
@@ -689,6 +688,7 @@ Link_ReceiveItem_HUDRefresh:
|
||||
+
|
||||
|
||||
JSL.l HUD_RefreshIconLong ; thing we wrote over
|
||||
INC.w UpdateHUD
|
||||
JSL.l PostItemGet
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
@@ -703,6 +703,7 @@ HandleBombAbsorbtion:
|
||||
LDA.b #$04 : STA.w ItemCursor ; set selected item to bombs
|
||||
LDA.b #$01 : STA.w CurrentYItem ; set selected item to bombs
|
||||
JSL.l HUD_RebuildLong
|
||||
INC.w UpdateHUD
|
||||
+
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
580
newhud.asm
580
newhud.asm
@@ -1,264 +1,388 @@
|
||||
!InfiniteTile = $2431
|
||||
!BlankTile = $207F
|
||||
!SlashTile = $2830
|
||||
!PTile = $296C
|
||||
!CTile = $295F
|
||||
|
||||
NewDrawHud:
|
||||
PHB
|
||||
|
||||
SEP #$30
|
||||
;================================================================================
|
||||
; Draw bomb count
|
||||
;================================================================================
|
||||
REP #$10
|
||||
|
||||
LDA.l InfiniteBombs : BNE .infinite_bombs
|
||||
.finite_bombs
|
||||
LDA.l BombsEquipment ; bombs
|
||||
JSR HudHexToDec2Digit ;requires 8 bit registers!
|
||||
REP #$20
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDBombCount ; Draw bombs 10 digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDBombCount+2 ; Draw bombs 1 digit
|
||||
BRA +
|
||||
|
||||
.infinite_bombs
|
||||
REP #$20
|
||||
LDA.w #$2431 : STA.l HUDBombCount ; infinity (left half)
|
||||
INC A : STA.l HUDBombCount+2 ; infinity (right half)
|
||||
+
|
||||
LDA.b #$7E
|
||||
PHA : PLB
|
||||
|
||||
;================================================================================
|
||||
; Draw rupee counter
|
||||
;================================================================================
|
||||
|
||||
LDA.l DisplayRupees ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here
|
||||
JSR HudHexToDec4Digit
|
||||
LDX.b Scrap04 : TXA : ORA.w #$2400 : STA.l HUDRupees ; 1000s
|
||||
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDRupees+2 ; 100s
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDRupees+4 ; 10s
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDRupees+6 ; 1s
|
||||
|
||||
;================================================================================
|
||||
; Draw arrow count
|
||||
;================================================================================
|
||||
NewHUD_DrawBombs:
|
||||
LDA.l InfiniteBombs : BEQ .finite
|
||||
|
||||
SEP #$20
|
||||
LDA.l ArrowMode : BNE +
|
||||
LDA.l InfiniteArrows : BNE .infinite_arrows
|
||||
.finite_arrows
|
||||
LDA.l CurrentArrows ; arrows
|
||||
JSR HudHexToDec2Digit
|
||||
REP #$20
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDArrowCount ; Draw arrows 10 digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDArrowCount+2 ; Draw arrows 1 digit
|
||||
BRA +
|
||||
|
||||
.infinite_arrows
|
||||
REP #$20
|
||||
LDA.w #$2431 : STA.l HUDArrowCount ; infinity (left half)
|
||||
INC A : STA.l HUDArrowCount+2 ; infinity (right half)
|
||||
+
|
||||
|
||||
;================================================================================
|
||||
; Draw Goal Item Indicator
|
||||
;================================================================================
|
||||
.infinite
|
||||
LDY.w #!InfiniteTile+0
|
||||
LDX.w #!InfiniteTile+1
|
||||
BRA .draw
|
||||
|
||||
REP #$20
|
||||
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
|
||||
.finite
|
||||
LDA.w BombsEquipment
|
||||
JSR HUDHex2Digit
|
||||
|
||||
.draw
|
||||
STY.w HUDBombCount+0
|
||||
STX.w HUDBombCount+2
|
||||
|
||||
;================================================================================
|
||||
NewHUD_DrawRupees:
|
||||
REP #$20
|
||||
|
||||
LDA.w DisplayRupees
|
||||
JSR HUDHex4Digit
|
||||
|
||||
LDA.b Scrap04 : TAX : STX.w HUDRupees+0 ; 1000s
|
||||
LDA.b Scrap05 : TAX : STX.w HUDRupees+2 ; 100s
|
||||
LDA.b Scrap06 : TAX : STX.w HUDRupees+4 ; 10s
|
||||
LDA.b Scrap07 : TAX : STX.w HUDRupees+6 ; 1s
|
||||
|
||||
;================================================================================
|
||||
NewHUD_DrawArrows:
|
||||
SEP #$20
|
||||
|
||||
LDA.l ArrowMode : BNE NewHUD_DrawGoal
|
||||
LDA.l InfiniteArrows : BEQ .finite
|
||||
|
||||
.infinite
|
||||
LDY.w #!InfiniteTile+0
|
||||
LDX.w #!InfiniteTile+1
|
||||
BRA .draw
|
||||
|
||||
.finite
|
||||
LDA.w CurrentArrows
|
||||
JSR HUDHex2Digit
|
||||
|
||||
.draw
|
||||
STY.w HUDArrowCount+0
|
||||
STX.w HUDArrowCount+2
|
||||
|
||||
;================================================================================
|
||||
NewHUD_DrawGoal:
|
||||
LDA.w UpdateHUD : BEQ .no_goal
|
||||
|
||||
REP #$20
|
||||
|
||||
LDA.l GoalItemRequirement : BEQ .no_goal
|
||||
|
||||
LDA.l GoalItemIcon : STA.w HUDGoalIndicator
|
||||
LDA.w #!SlashTile : STA.w HUDGoalIndicator+8
|
||||
LDA.l GoalCounter
|
||||
JSR HudHexToDec4Digit
|
||||
JSR HUDHex4Digit
|
||||
|
||||
LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+2 ; draw 100's digit
|
||||
LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+4 ; draw 10's digit
|
||||
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+6 ; draw 1's digit
|
||||
|
||||
REP #$20
|
||||
|
||||
LDA.l GoalItemRequirement : CMP.w #$FFFF : BNE .real_goal
|
||||
|
||||
LDX.w #!BlankTile
|
||||
STX.w HUDGoalIndicator+10
|
||||
STX.w HUDGoalIndicator+12
|
||||
STX.w HUDGoalIndicator+14
|
||||
|
||||
.no_goal
|
||||
SEP #$20
|
||||
BRA NewHUD_DrawKeys
|
||||
|
||||
.real_goal
|
||||
JSR HUDHex4Digit
|
||||
|
||||
LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+10 ; draw 100's digit
|
||||
LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+12 ; draw 10's digit
|
||||
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+14 ; draw 1's digit
|
||||
|
||||
LDA.l GoalItemIcon : STA.l HUDGoalIndicator ; draw star icon
|
||||
|
||||
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+2 ; draw 100's digit
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+4 ; draw 10's digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+6 ; draw 1's digit
|
||||
|
||||
LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
|
||||
LDA.l GoalItemRequirement
|
||||
JSR HudHexToDec4Digit
|
||||
LDA.w #$2830 : STA.l HUDGoalIndicator+8 ; draw slash
|
||||
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+10 ; draw 100's digit
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+12 ; draw 10's digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+14 ; draw 1's digit
|
||||
BRA .done
|
||||
.skip
|
||||
LDA.w #$207F ; transparent tile
|
||||
STA.l HUDGoalIndicator+8
|
||||
STA.l HUDGoalIndicator+10
|
||||
STA.l HUDGoalIndicator+12
|
||||
.done
|
||||
|
||||
;================================================================================
|
||||
; Draw Dungeon Compass Counts
|
||||
NewHUD_DrawKeys:
|
||||
LDA.l CurrentSmallKeys
|
||||
CMP.b #$FF
|
||||
BNE .in_dungeon
|
||||
|
||||
LDY.w #!BlankTile
|
||||
STY.w HUDKeyIcon
|
||||
STY.w HUDKeyDigits+0
|
||||
STY.w HUDKeyDigits+2
|
||||
BRA NewHUD_DrawDungeonCounters
|
||||
|
||||
.in_dungeon
|
||||
JSR HUDHex2Digit
|
||||
CPY.w #$2490
|
||||
BNE .real_10s
|
||||
|
||||
LDY.w #!BlankTile
|
||||
|
||||
.real_10s
|
||||
STY.w HUDKeyDigits+0
|
||||
STX.w HUDKeyDigits+2
|
||||
|
||||
;================================================================================
|
||||
LDA.l CompassMode : ORA.l MapHUDMode : BIT #$0003 : BEQ +
|
||||
JSL.l DrawDungeonItemCounts ; compasses.asm
|
||||
NewHUD_DrawDungeonCounters:
|
||||
LDA.w UpdateHUD : BEQ NewHUD_DrawPrizeIcon
|
||||
LDA.l CompassMode : ORA.l MapHUDMode : BIT.b #$03 : BEQ NewHUD_DrawPrizeIcon
|
||||
LDX.b IndoorsFlag : BNE +
|
||||
JMP.w NewHUD_DrawMagicMeter
|
||||
+
|
||||
SEP #$30
|
||||
; extra hard safeties for getting dungeon ID to prevent crashes
|
||||
LDA.w DungeonID
|
||||
CMP.b #$1B : BCS NewHUD_DrawPrizeIcon ; Skip if not in a valid dungeon ID
|
||||
AND.b #$FE : TAX
|
||||
LSR : TAY
|
||||
PHX : PHY
|
||||
|
||||
JSR.w DrawCompassCounts
|
||||
SEP #$10
|
||||
PLY : PLX
|
||||
JSR.w DrawMapCounts
|
||||
|
||||
;================================================================================
|
||||
; Draw key count
|
||||
;================================================================================
|
||||
SEP #$20
|
||||
LDA.l CurrentSmallKeys : 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 Scrap06 : TXA : CPX.b #$90 : BNE +
|
||||
LDA.w #$007F
|
||||
+
|
||||
ORA.w #$2400 : STA.l HUDKeyDigits
|
||||
|
||||
; 1s digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDKeyDigits+2
|
||||
BRA .done_keys
|
||||
|
||||
.not_in_dungeon
|
||||
REP #$20
|
||||
|
||||
;in the overworld, draw transparent tiles instead of key count
|
||||
LDA.w #$247F : STA.l HUDKeyDigits : STA.l HUDKeyDigits+2
|
||||
STA.l HUDKeyIcon
|
||||
|
||||
.done_keys
|
||||
NewHUD_DrawPrizeIcon:
|
||||
REP #$10
|
||||
SEP #$20
|
||||
LDA.b GameMode
|
||||
CMP.b #$12 : BEQ .no_prize
|
||||
CMP.b #$0E : BEQ +
|
||||
LDA.w UpdateHUD : BEQ NewHUD_DrawItemCounter
|
||||
+
|
||||
LDA.w DungeonID
|
||||
CMP.b #$1A : BCS .no_prize
|
||||
CMP.b #$04 : BCC .no_prize
|
||||
CMP.b #$08 : BNE .dungeon
|
||||
|
||||
.no_prize
|
||||
LDY.w #!BlankTile
|
||||
BRA .draw_prize
|
||||
|
||||
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; Draw pendant/crystal icon
|
||||
;--------------------------------------------------------------------------------
|
||||
!P_ICON = $296C
|
||||
!C_ICON = $295F
|
||||
|
||||
SEP #$20
|
||||
LDA.b IndoorsFlag : BEQ .noprize
|
||||
|
||||
LDX.w DungeonID
|
||||
CPX #$1A : !BGE .noprize
|
||||
CPX #$04 : !BLT .noprize
|
||||
CPX #$08 : BEQ .noprize
|
||||
|
||||
LDA.b GameMode : CMP.b #$12 : BEQ .noprize
|
||||
|
||||
.dungeon
|
||||
SEP #$30
|
||||
TAX
|
||||
LSR
|
||||
TAY
|
||||
LDA.l MapMode
|
||||
REP #$20
|
||||
BEQ .drawprize
|
||||
|
||||
REP #$30
|
||||
BEQ .prize
|
||||
|
||||
LDA.l MapField
|
||||
AND.l DungeonItemMasks,X
|
||||
BEQ .noprize
|
||||
|
||||
.drawprize
|
||||
TXA : LSR : TAX
|
||||
LDA.l CrystalPendantFlags_2, X
|
||||
AND.w #$0040 : BNE .is_crystal
|
||||
BEQ .no_prize
|
||||
|
||||
LDA.w #!P_ICON
|
||||
BRA .doneprize
|
||||
.prize
|
||||
TYX
|
||||
LDA.l CrystalPendantFlags_2,X
|
||||
AND.w #$0040
|
||||
BNE .crystal
|
||||
|
||||
.is_crystal
|
||||
LDA.w #!C_ICON
|
||||
BRA .doneprize
|
||||
LDY.w #!PTile
|
||||
BRA .draw_prize
|
||||
|
||||
.noprize
|
||||
REP #$20
|
||||
LDA.w #$207F
|
||||
.crystal
|
||||
LDY.w #!CTile
|
||||
|
||||
.doneprize
|
||||
STA.l HUDPrizeIcon
|
||||
.draw_prize
|
||||
STY.w HUDPrizeIcon
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; Draw Magic Meter
|
||||
;================================================================================
|
||||
NewHUD_DrawItemCounter:
|
||||
REP #$20
|
||||
LDA.w UpdateHUD : BEQ NewHUD_DrawMagicMeter
|
||||
LDA.l ItemCounterHUD : AND.w #$00FF : BEQ NewHUD_DrawMagicMeter
|
||||
LDA.w #!SlashTile : STA.w HUDGoalIndicator+$08
|
||||
LDA.l TotalItemCount : CMP.w #1000 : BCS .item_four_digits
|
||||
LDA.w TotalItemCountTiles+$02 : STA.w HUDGoalIndicator+$0A
|
||||
LDA.w TotalItemCountTiles+$04 : STA.w HUDGoalIndicator+$0C
|
||||
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$0E
|
||||
|
||||
LDA.w TotalItemCounter
|
||||
JSR.w HUDHex4Digit
|
||||
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
|
||||
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
|
||||
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
|
||||
BRA NewHUD_DrawMagicMeter
|
||||
|
||||
.item_four_digits
|
||||
LDA.w TotalItemCountTiles+$00 : STA.w HUDGoalIndicator+$0A
|
||||
LDA.w TotalItemCountTiles+$02 : STA.w HUDGoalIndicator+$0C
|
||||
LDA.w TotalItemCountTiles+$04 : STA.w HUDGoalIndicator+$0E
|
||||
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$10
|
||||
|
||||
LDA.w TotalItemCounter
|
||||
JSR.w HUDHex4Digit
|
||||
LDA.b $04 : TAX : STX.w HUDGoalIndicator+$00
|
||||
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
|
||||
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
|
||||
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
|
||||
|
||||
|
||||
|
||||
;================================================================================
|
||||
DrawMagicMeter_mp_tilemap = $0DFE0F
|
||||
;--------------------------------------------------------------------------------
|
||||
LDA.l CurrentMagic : AND.w #$00FF ; crap we wrote over when placing the hook for OnDrawHud
|
||||
!ADD #$0007
|
||||
AND.w #$FFF8
|
||||
TAX ; end of crap
|
||||
|
||||
LDA.l InfiniteMagic : AND.w #$00FF : BNE + : JMP .green : +
|
||||
SEP #$20 : LDA.b #$80 : STA.l CurrentMagic : REP #$30 ; set magic to max
|
||||
LDX.w #$0080 ; load full magic meter graphics
|
||||
LDA.b FrameCounter : AND.w #$000C : LSR #2
|
||||
BEQ .red
|
||||
CMP.w #0001 : BEQ .yellow
|
||||
CMP.w #0002 : BNE + : JMP .green : +
|
||||
.blue
|
||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$46
|
||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$86
|
||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$C6
|
||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$06
|
||||
RTL
|
||||
.red
|
||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$46
|
||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$86
|
||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$C6
|
||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$06
|
||||
RTL
|
||||
.yellow
|
||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$46
|
||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$86
|
||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$C6
|
||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$0106
|
||||
RTL
|
||||
.orange
|
||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$46
|
||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$86
|
||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$C6
|
||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$0106
|
||||
RTL
|
||||
.green
|
||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : STA.l HUDTileMapBuffer+$46
|
||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : STA.l HUDTileMapBuffer+$86
|
||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : STA.l HUDTileMapBuffer+$C6
|
||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : STA.l HUDTileMapBuffer+$0106
|
||||
NewHUD_DrawMagicMeter:
|
||||
SEP #$31
|
||||
LDA.l CurrentMagic
|
||||
ADC.b #$06 ; carry set by above for +1 to get +7
|
||||
AND.b #$F8
|
||||
TAY
|
||||
|
||||
LDA.l InfiniteMagic
|
||||
BEQ .set_index
|
||||
|
||||
.infinite_magic
|
||||
LDA.b #$80
|
||||
STA.w CurrentMagic
|
||||
TAY
|
||||
|
||||
LDA.b FrameCounter
|
||||
REP #$30
|
||||
AND.w #$000C
|
||||
LSR
|
||||
BRA .recolor
|
||||
|
||||
.set_index ; this branch is always 0000 when taken
|
||||
REP #$30
|
||||
TDC
|
||||
.recolor
|
||||
TAX
|
||||
|
||||
LDA.l MagicMeterColorMasks,X
|
||||
|
||||
TYX
|
||||
TAY : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.w HUDTileMapBuffer+$046
|
||||
TYA : AND.l DrawMagicMeter_mp_tilemap+2,X : STA.w HUDTileMapBuffer+$086
|
||||
TYA : AND.l DrawMagicMeter_mp_tilemap+4,X : STA.w HUDTileMapBuffer+$0C6
|
||||
TYA : AND.l DrawMagicMeter_mp_tilemap+6,X : STA.w HUDTileMapBuffer+$106
|
||||
|
||||
;================================================================================
|
||||
NewHUD_DoneDrawing:
|
||||
STZ.w UpdateHUD
|
||||
PLB
|
||||
RTL
|
||||
|
||||
;================================================================================
|
||||
; 16-bit A, 8-bit X
|
||||
; in: A(b) - Byte to Convert
|
||||
; out: $04 - $07 (high - low)
|
||||
MagicMeterColorMasks:
|
||||
dw $FFFF ; green - KEEP GREEN FIRST
|
||||
dw $EFFF ; blue
|
||||
dw $E7FF ; red
|
||||
dw $EBFF ; yellow
|
||||
dw $E3FF ; orange
|
||||
|
||||
;================================================================================
|
||||
HudHexToDec4Digit:
|
||||
LDY.b #$90
|
||||
-
|
||||
CMP.w #1000 : !BLT +
|
||||
INY
|
||||
SBC.w #1000 : BRA -
|
||||
+
|
||||
STY.b Scrap04 : LDY.b #$90 ; Store 1000s digit & reset Y
|
||||
-
|
||||
CMP.w #100 : !BLT +
|
||||
INY
|
||||
SBC.w #100 : BRA -
|
||||
+
|
||||
STY.b Scrap05 : LDY.b #$90 ; Store 100s digit & reset Y
|
||||
-
|
||||
CMP.w #10 : !BLT +
|
||||
INY
|
||||
SBC.w #10 : BRA -
|
||||
+
|
||||
STY.b Scrap06 : LDY.b #$90 ; Store 10s digit & reset Y
|
||||
CMP.w #1 : !BLT +
|
||||
-
|
||||
INY
|
||||
DEC : BNE -
|
||||
+
|
||||
STY.b Scrap07 ; Store 1s digit
|
||||
DrawCompassCounts:
|
||||
LDA.l CompassMode : BEQ .done
|
||||
|
||||
; no compass needed if this bit is set
|
||||
BIT.b #$02 : BNE .draw_compass_count
|
||||
REP #$20
|
||||
LDA.l CompassField : AND.l DungeonItemMasks,X : BEQ .done
|
||||
|
||||
.draw_compass_count
|
||||
SEP #$20
|
||||
TYX : BNE .not_sewers
|
||||
INX
|
||||
|
||||
.not_sewers
|
||||
LDA.l DungeonLocationsChecked, X
|
||||
PHA
|
||||
|
||||
LDA.l CompassTotalsWRAM,X
|
||||
|
||||
JSR HUDHex2Digit
|
||||
STY.w HUDTileMapBuffer+$9A : STX.w HUDTileMapBuffer+$9C
|
||||
|
||||
LDX.w #!BlankTile : STX.w HUDTileMapBuffer+$92
|
||||
LDX.w #!SlashTile : STX.w HUDTileMapBuffer+$98
|
||||
|
||||
PLA
|
||||
JSR HUDHex2Digit
|
||||
STY.w HUDTileMapBuffer+$94 : STX.w HUDTileMapBuffer+$96
|
||||
|
||||
.done
|
||||
SEP #$20
|
||||
RTS
|
||||
;================================================================================
|
||||
DrawMapCounts:
|
||||
LDA.l MapHUDMode : BEQ .done
|
||||
|
||||
; no map needed if this bit is set
|
||||
BIT.b #$02 : BNE .draw_map_count
|
||||
REP #$20
|
||||
LDA.l MapField : AND.l DungeonItemMasks,X : BEQ .done
|
||||
|
||||
.draw_map_count
|
||||
SEP #$20
|
||||
TYX : BNE .not_sewers
|
||||
INX
|
||||
|
||||
.not_sewers
|
||||
LDA.l DungeonCollectedKeys, X
|
||||
PHA
|
||||
|
||||
LDA.l MapTotalsWRAM,X
|
||||
|
||||
JSR HUDHex2Digit
|
||||
STX.w HUDTileMapBuffer+$A6
|
||||
|
||||
LDX.w #!SlashTile : STX.w HUDTileMapBuffer+$A4
|
||||
|
||||
PLA
|
||||
JSR HUDHex2Digit
|
||||
STX.w HUDTileMapBuffer+$A2
|
||||
|
||||
.done
|
||||
SEP #$20
|
||||
RTS
|
||||
|
||||
;================================================================================
|
||||
; 8-bit registers
|
||||
; in: A(b) - Byte to Convert
|
||||
; out: $06 - $07 (high - low)
|
||||
; Exits with:
|
||||
; X - ones place tile
|
||||
; Y - tens place tile
|
||||
;===================================================================================================
|
||||
HUDHex2Digit:
|
||||
SEP #$30 ; clear high byte of X and Y and make it so they don't get B
|
||||
ASL : TAX
|
||||
|
||||
REP #$10
|
||||
|
||||
LDA.b #$24 : XBA ; tile props in high byte
|
||||
|
||||
LDA.l FastHexTable,X : LSR #4 : ORA.b #$90
|
||||
TAY
|
||||
|
||||
LDA.l FastHexTable,X : AND.b #$0F : ORA.b #$90
|
||||
TAX
|
||||
|
||||
RTS
|
||||
|
||||
;===================================================================================================
|
||||
|
||||
HUDHex4Digit:
|
||||
JSL HexToDec
|
||||
|
||||
REP #$30
|
||||
|
||||
LDA.l HexToDecDigit2 : ORA.w #$9090 : STA.b Scrap04
|
||||
LDA.l HexToDecDigit4 : ORA.w #$9090 : STA.b Scrap06
|
||||
|
||||
LDA.w #$2400
|
||||
|
||||
SEP #$20
|
||||
RTS
|
||||
|
||||
;================================================================================
|
||||
HudHexToDec2Digit:
|
||||
LDY.b #$90
|
||||
-
|
||||
CMP.b #10 : !BLT +
|
||||
INY
|
||||
SBC.b #10 : BRA -
|
||||
+
|
||||
STY.b Scrap06 : LDY.b #$90 ; Store 10s digit and reset Y
|
||||
CMP.b #1 : !BLT +
|
||||
-
|
||||
INY
|
||||
DEC : BNE -
|
||||
+
|
||||
STY.b Scrap07 ; Store 1s digit
|
||||
RTS
|
||||
HUDHex2Digit_Long:
|
||||
JSR HUDHex2Digit
|
||||
REP #$20
|
||||
RTL
|
||||
|
||||
HUDHex4Digit_Long:
|
||||
JSR HUDHex4Digit
|
||||
REP #$20
|
||||
RTL
|
||||
|
||||
38
newitems.asm
38
newitems.asm
@@ -873,26 +873,26 @@ RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
;Return BowEquipment but also draw silver arrows if you have the upgrade even if you don't have the bow
|
||||
CheckHUDSilverArrows:
|
||||
LDA.l ArrowMode : BEQ .normal
|
||||
.rupee_arrows
|
||||
JSL.l DrawHUDArrows
|
||||
LDA.l BowEquipment
|
||||
RTL
|
||||
.normal
|
||||
LDA.l BowEquipment : BNE +
|
||||
LDA.l BowTracking : AND.b #$40 : BEQ ++
|
||||
JSL.l DrawHUDArrows
|
||||
++
|
||||
LDA.l BowEquipment
|
||||
+
|
||||
RTL
|
||||
LDA.l ArrowMode : BNE .rupee_bow
|
||||
LDA.l BowEquipment : TAX : BEQ .nobow
|
||||
JSL.l DrawHUDArrows_normal
|
||||
TXA
|
||||
RTL
|
||||
.rupee_bow
|
||||
LDA.l BowEquipment : TAX
|
||||
JSL.l DrawHUDArrows_rupee_arrows
|
||||
TXA
|
||||
RTL
|
||||
.nobow
|
||||
JSL.l DrawHUDArrows_silverscheck
|
||||
TXA
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
DrawHUDArrows:
|
||||
LDA.l ArrowMode : BEQ .normal
|
||||
.rupee_arrows
|
||||
|
||||
LDA.l CurrentArrows : BEQ .none ; assuming silvers will increment this. if we go with something else, reorder these checks
|
||||
LDA.l BowEquipment : BNE +
|
||||
TXA : BNE +
|
||||
.silverscheck
|
||||
LDA.l BowTracking : AND.b #$40 : BNE .silver
|
||||
BRA .wooden
|
||||
+ CMP.b #03 : !BGE .silver
|
||||
@@ -902,8 +902,12 @@ LDA.l ArrowMode : BEQ .normal
|
||||
LDA.b #$20 : STA.l HUDTileMapBuffer+$21
|
||||
LDA.b #$A9 : STA.l HUDTileMapBuffer+$22
|
||||
LDA.b #$20 : STA.l HUDTileMapBuffer+$23
|
||||
.skip
|
||||
RTL
|
||||
.normal ; in normal arrow mode this function is only ever called for silvers
|
||||
.normal
|
||||
TXA
|
||||
CMP.b #$03 : BCS .silver
|
||||
BRA .wooden
|
||||
.silver
|
||||
LDA.b #$86 : STA.l HUDTileMapBuffer+$20 ; draw silver arrow marker
|
||||
LDA.b #$24 : STA.l HUDTileMapBuffer+$21
|
||||
|
||||
@@ -17,18 +17,20 @@ RTL
|
||||
;================================================================================
|
||||
HUDRebuildIndoorHole:
|
||||
PHA
|
||||
INC.w UpdateHUD
|
||||
LDA.l GenericKeys : BEQ .normal
|
||||
.generic
|
||||
PLA
|
||||
LDA.l CurrentGenericKeys ; generic key count
|
||||
JSL.l HUD_RebuildIndoor_Palace
|
||||
JSL.l HUD_RebuildIndoor_Palace
|
||||
RTL
|
||||
.normal
|
||||
PLA
|
||||
JSL.l HUD_RebuildIndoor_Palace
|
||||
JSL.l HUD_RebuildIndoor_Palace
|
||||
RTL
|
||||
;================================================================================
|
||||
HUDRebuildIndoor:
|
||||
INC.w UpdateHUD
|
||||
LDA.l GenericKeys : BEQ .normal
|
||||
.generic
|
||||
LDA.b #$00 : STA.l RoomDarkness
|
||||
@@ -687,3 +689,4 @@ RestoreMenu_SetSubModule:
|
||||
+
|
||||
LDA.b #$03 : STA.w SubModuleInterface
|
||||
RTL
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
5
ram.asm
5
ram.asm
@@ -354,6 +354,8 @@ DelayTimer = $7E1CE9 ;
|
||||
;
|
||||
TextID = $7E1CF0 ; Message ID and page. Word length.
|
||||
;
|
||||
UpdateHUD = $7E1E03 ; Flag used to mark HUD updates and avoid heavy code segments.
|
||||
;
|
||||
ToastBuffer = $7E1E0E ; Multiworld buffer. Word length.
|
||||
;
|
||||
MSUResumeTime = $7E1E6B ; Mirrored MSU block
|
||||
@@ -439,6 +441,7 @@ HUDArrowCount = $7EC760 ;
|
||||
HUDKeyDigits = $7EC764 ;
|
||||
;
|
||||
BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
|
||||
TotalItemCountTiles = $7ECB00 ; Cached total item count tiles for HUD. Four words high to low.
|
||||
|
||||
;================================================================================
|
||||
; Bank 7F
|
||||
@@ -525,7 +528,7 @@ OHKOFlag: skip 1 ; Any non-zero write sets OHKO mode
|
||||
SpriteSwapper: skip 1 ; Loads new link sprite and glove/armor palette. No gfx or
|
||||
; code currently in base ROM for this.
|
||||
BootsModifier: skip 1 ; $01 = Give dash ability
|
||||
skip 1 ; Unused
|
||||
OHKOCached: skip 1 ; "Old" OHKO flag state. Used to detect changes.
|
||||
; Crypto Block ($7F50D0 - $7F51FF)
|
||||
KeyBase: skip $10 ;
|
||||
y: skip 4 ;
|
||||
|
||||
@@ -11,6 +11,7 @@ LoadBombCount16:
|
||||
.infinite
|
||||
RTL
|
||||
StoreBombCount:
|
||||
INC.w UpdateHUD
|
||||
PHA : LDA.l InfiniteBombs : BEQ .finite
|
||||
.infinite
|
||||
PLA : LDA.b #$01 : RTL
|
||||
|
||||
@@ -83,6 +83,7 @@ IncrementSmallKeys:
|
||||
JSL.l UpdateKeys
|
||||
PHY : LDY.b #24 : JSL.l FullInventoryExternal : PLY
|
||||
JSL.l HUD_RebuildLong
|
||||
INC.w UpdateHUD
|
||||
PLX
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
@@ -102,6 +103,7 @@ IncrementSmallKeysNoPrimary:
|
||||
PLP
|
||||
+
|
||||
JSL.l HUD_RebuildLong
|
||||
INC.w UpdateHUD
|
||||
PLX
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
11
tables.asm
11
tables.asm
@@ -118,7 +118,9 @@ org $308038 ; PC 0x180038
|
||||
LampConeSewers:
|
||||
db #$01 ; #$00 = Off - #$01 = On (default)
|
||||
;--------------------------------------------------------------------------------
|
||||
; 0x180039 (Unused)
|
||||
org $308039 ; PC 0x180039
|
||||
ItemCounterHUD:
|
||||
db $00 ; $00 = Off | $01 = Display TotalItemCounter / TotalItemCount display on HUD
|
||||
;--------------------------------------------------------------------------------
|
||||
org $30803A ; PC 0x18003A-0x18003C
|
||||
MapHUDMode:
|
||||
@@ -144,6 +146,9 @@ db #$00
|
||||
; #$06 = Light Speed
|
||||
; #$07 = Require All Crystals and Crystal Bosses
|
||||
; #$08 = Require All Crystal Bosses only
|
||||
; #$09 = Require All Dungeons No Agahnim
|
||||
; #$0A = Require 100% Item Collection
|
||||
; #$0B = Require 100% Item Collection and All Dungeons
|
||||
;--------------------------------------------------------------------------------
|
||||
org $30803F ; PC 0x18003F
|
||||
HammerableGanon:
|
||||
@@ -928,6 +933,10 @@ org $308195 ; PC 0x180195
|
||||
ByrnaCaveSpikeDamage:
|
||||
db #$08 ; #$08 = 1 Heart (default) - #$02 = 1/4 Heart
|
||||
;--------------------------------------------------------------------------------
|
||||
org $308196 ; PC 0x180196-0x180197
|
||||
TotalItemCount: ; Total item count for HUD. Only counts items that use "item get" animation.
|
||||
dw $00D8 ; 216
|
||||
;--------------------------------------------------------------------------------
|
||||
; 0x180196 - 0x1801FF (unused)
|
||||
;================================================================================
|
||||
org $308200 ; PC 0x180200 - 0x18020B
|
||||
|
||||
37
timer.asm
37
timer.asm
@@ -110,19 +110,19 @@ dw #$003C, #$0000
|
||||
dw #$FFFF, #$7FFF
|
||||
;--------------------------------------------------------------------------------
|
||||
DrawChallengeTimer:
|
||||
LDA.l OHKOFlag : AND.w #$00FF : BEQ +
|
||||
LDA.w #$2807 : STA.l HUDTileMapBuffer+$90
|
||||
LDA.w #$280A : STA.l HUDTileMapBuffer+$92
|
||||
LDA.w #$280B : STA.l HUDTileMapBuffer+$94
|
||||
LDA.w #$280C : STA.l HUDTileMapBuffer+$96
|
||||
RTL
|
||||
+
|
||||
LDA.w #$247F : STA.l HUDTileMapBuffer+$90
|
||||
STA.l HUDTileMapBuffer+$92
|
||||
STA.l HUDTileMapBuffer+$94
|
||||
STA.l HUDTileMapBuffer+$96
|
||||
JSR.w CheckOHKO : BCC ++
|
||||
AND.w #$00FF : BEQ +
|
||||
LDA.w #$2807 : STA.l HUDTileMapBuffer+$90
|
||||
LDA.w #$280A : STA.l HUDTileMapBuffer+$92
|
||||
LDA.w #$280B : STA.l HUDTileMapBuffer+$94
|
||||
LDA.w #$280C : STA.l HUDTileMapBuffer+$96
|
||||
RTL
|
||||
+
|
||||
LDA.w #$247F : STA.l HUDTileMapBuffer+$90
|
||||
STA.l HUDTileMapBuffer+$92
|
||||
STA.l HUDTileMapBuffer+$94
|
||||
STA.l HUDTileMapBuffer+$96
|
||||
++
|
||||
|
||||
LDA.l TimerStyle : BNE + : RTL : + ; Hud Timer
|
||||
LDA.w #$2807 : STA.l HUDTileMapBuffer+$92
|
||||
LDA.l ClockStatus : AND.w #$0002 : BEQ + ; DNF / OKHO
|
||||
@@ -171,3 +171,16 @@ OHKOTimer:
|
||||
LDA.l CurrentHealth
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
CheckOHKO:
|
||||
SEP #$20
|
||||
LDA.l OHKOFlag : CMP.l OHKOCached : BNE .change
|
||||
REP #$20
|
||||
CLC
|
||||
RTS
|
||||
.change
|
||||
STA.l OHKOCached
|
||||
INC.w UpdateHUD
|
||||
REP #$20
|
||||
SEC
|
||||
RTS
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
@@ -562,102 +562,6 @@ SkipDrawEOR:
|
||||
.normal
|
||||
LDA.b ($08), Y : EOR.w Scrap04 ; thing we wrote over
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; HexToDec
|
||||
; in: A(w) - Word to Convert
|
||||
; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
|
||||
;--------------------------------------------------------------------------------
|
||||
HexToDec:
|
||||
PHA
|
||||
PHA
|
||||
LDA.w #$9090
|
||||
STA.b Scrap04 : STA.b Scrap06 ; temporarily store our decimal values here for speed
|
||||
PLA
|
||||
-
|
||||
CMP.w #1000 : !BLT +
|
||||
INC.b Scrap04
|
||||
!SUB.w #1000 : BRA -
|
||||
+ -
|
||||
CMP.w #100 : !BLT +
|
||||
INC.b Scrap05
|
||||
!SUB.w #100 : BRA -
|
||||
+ -
|
||||
CMP.w #10 : !BLT +
|
||||
INC.b Scrap06
|
||||
!SUB.w #10 : BRA -
|
||||
+ -
|
||||
CMP.w #1 : !BLT +
|
||||
INC.b Scrap07
|
||||
!SUB.w #1 : BRA -
|
||||
+
|
||||
LDA.b Scrap04 : STA.l HexToDecDigit2 ; move to digit storage
|
||||
LDA.b Scrap06 : STA.l HexToDecDigit4
|
||||
PLA
|
||||
RTL
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; CountBits
|
||||
; in: A(b) - Byte to count bits in
|
||||
; out: A(b) - sum of bits
|
||||
; caller is responsible for setting 8-bit mode and preserving X and Y
|
||||
;--------------------------------------------------------------------------------
|
||||
;CountBits:
|
||||
; PHX
|
||||
; TAX ; Save a copy of value
|
||||
; LSR #4 ; Shift down hi nybble, Leave <3> in C
|
||||
; PHA ; And save <7:4> in Stack
|
||||
; TXA ; Recover value
|
||||
; AND.b #$07 ; Put out <2:0> in X
|
||||
; TAX ; And save in X
|
||||
; LDA.l NybbleBitCounts, X ; Fetch count for <2:0>
|
||||
; PLX ; get <7:4>
|
||||
; ADC.l NybbleBitCounts, X ; Add count for S & C
|
||||
; PLX
|
||||
;RTL
|
||||
|
||||
; Look up table of bit counts in the values $00-$0F
|
||||
NybbleBitCounts:
|
||||
db #00, #01, #01, #02, #01, #02, #02, #03, #01, #02, #02, #03, #02, #03, #03, #04
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; HexToDec
|
||||
; in: A(w) - Word to Convert
|
||||
; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
|
||||
;--------------------------------------------------------------------------------
|
||||
;HexToDec:
|
||||
; PHA
|
||||
; PHA
|
||||
; LDA.w #$9090
|
||||
; STA.l HexToDecDigit1 : STA.l HexToDecDigit3 : STA.l HexToDecDigit4 ; clear digit storage
|
||||
; PLA
|
||||
; -
|
||||
; CMP.w #10000 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit1 : INC : STA.l HexToDecDigit1 : REP #$20 : PLA
|
||||
; !SUB.w #10000 : BRA -
|
||||
; + -
|
||||
; CMP.w #1000 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit2 : INC : STA.l HexToDecDigit2 : REP #$20 : PLA
|
||||
; !SUB.w #1000 : BRA -
|
||||
; + -
|
||||
; CMP.w #100 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit3 : INC : STA.l HexToDecDigit3 : REP #$20 : PLA
|
||||
; !SUB.w #100 : BRA -
|
||||
; + -
|
||||
; CMP.w #10 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit4 : INC : STA.l HexToDecDigit4 : REP #$20 : PLA
|
||||
; !SUB.w #10 : BRA -
|
||||
; + -
|
||||
; CMP.w #1 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit5 : INC : STA.l HexToDecDigit5 : REP #$20 : PLA
|
||||
; !SUB.w #1 : BRA -
|
||||
; +
|
||||
; PLA
|
||||
;RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; WriteVRAMStripe
|
||||
|
||||
@@ -70,6 +70,7 @@ AddAncillaLong = $099D04
|
||||
Ancilla_CheckIfAlreadyExistsLong = $099D1A
|
||||
Sprite_SetSpawnedCoords = $09AE64
|
||||
GiveRupeeGift = $09AD58
|
||||
Overworld_LoadOverlayAndMap = $0AB96C
|
||||
OverworldMap_InitGfx = $0ABA4F
|
||||
OverworldMap_DarkWorldTilemap = $0ABA99
|
||||
OverworldMap_LoadSprGfx = $0ABAB9
|
||||
@@ -101,6 +102,7 @@ DrawEquipment = $0DED29 ; returns short
|
||||
HUD_RebuildLong = $0DFA78
|
||||
HUD_RebuildIndoor_Palace = $0DFA88
|
||||
HUD_RebuildLong2 = $0DFA88
|
||||
RebuildHUD_update = $0DFAA5
|
||||
Messaging_Text = $0EEE10
|
||||
Overworld_TileAttr = $0FFD94
|
||||
Overworld_DrawPersistentMap16 = $1BC97C
|
||||
|
||||
Reference in New Issue
Block a user