Fast HUD via kan
This commit is contained in:
@@ -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,68 +1,3 @@
|
||||
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
|
||||
|
||||
@@ -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
|
||||
TXA : AND.w #$00FF : !ADD.w #$0210+!FS_COLOR_BW : %fs_draw8x8(11,26)
|
||||
TYA : 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:
|
||||
|
||||
@@ -40,7 +40,7 @@ CheckGanonVulnerability:
|
||||
dw .bosses_only
|
||||
dw .all_dungeons_no_agahnim
|
||||
dw .all_items
|
||||
dw .all_items_all_dungeons
|
||||
dw .completionist
|
||||
|
||||
; 00 = always vulnerable
|
||||
.vulnerable
|
||||
@@ -102,7 +102,7 @@ CheckGanonVulnerability:
|
||||
RTS
|
||||
|
||||
; 0A = 100% item collection rate and all dungeons
|
||||
.all_items_all_dungeons
|
||||
.completionist
|
||||
REP #$20
|
||||
LDA.l TotalItemCounter : CMP.l TotalItemCount
|
||||
SEP #$20
|
||||
|
||||
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
|
||||
|
||||
;===================================================================================================
|
||||
565
newhud.asm
565
newhud.asm
@@ -1,296 +1,339 @@
|
||||
!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:
|
||||
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.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
|
||||
CPX.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:
|
||||
LDA.b GameMode
|
||||
CMP.b #$12
|
||||
BEQ .no_prize
|
||||
|
||||
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
|
||||
|
||||
LDA.l MapField
|
||||
AND.l DungeonItemMasks,X
|
||||
BEQ .noprize
|
||||
|
||||
.drawprize
|
||||
TXA : LSR : TAX
|
||||
LDA.l CrystalPendantFlags_2, X
|
||||
AND.w #$0040 : BNE .is_crystal
|
||||
SEP #$20
|
||||
BEQ .no_prize
|
||||
|
||||
LDA.w #!P_ICON
|
||||
BRA .doneprize
|
||||
TYX
|
||||
LDA.l CrystalPendantFlags_2,X
|
||||
AND.b #$40
|
||||
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 pendant/crystal icon
|
||||
;--------------------------------------------------------------------------------
|
||||
LDA.l ItemCounterHUD : AND.w #$00FF : BNE + : JMP.w .item_counter_done : +
|
||||
LDA.w #$2830 : STA.l HUDGoalIndicator+8 ; draw slash
|
||||
LDA.l TotalItemCount : CMP.w #1000 : BCC .item_three_digits
|
||||
JSR.w HudHexToDec4Digit
|
||||
LDX.b Scrap04 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+10 ; 1000's digit
|
||||
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+12 ; 100's digit
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+14 ; 10's digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+16 ; 1's digit
|
||||
|
||||
LDA.l TotalItemCounter
|
||||
JSR.w HudHexToDec4Digit
|
||||
LDX.b Scrap04 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+0 ; 1000's digit
|
||||
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+2 ; 100's digit
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+4 ; 10's digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+6 ; 1's digit
|
||||
BRA .item_counter_done
|
||||
.item_three_digits
|
||||
JSR.w HudHexToDec4Digit
|
||||
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+10 ; 100's digit
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+12 ; 10's digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+14 ; 1's digit
|
||||
|
||||
LDA.l TotalItemCounter
|
||||
JSR.w HudHexToDec4Digit
|
||||
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+2 ; 100's digit
|
||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+4 ; 10's digit
|
||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+6 ; 1's digit
|
||||
.item_counter_done
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; Draw Magic Meter
|
||||
;================================================================================
|
||||
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.l 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.l HUDTileMapBuffer+$046
|
||||
TYA : AND.l DrawMagicMeter_mp_tilemap+2,X : STA.l HUDTileMapBuffer+$086
|
||||
TYA : AND.l DrawMagicMeter_mp_tilemap+4,X : STA.l HUDTileMapBuffer+$0C6
|
||||
TYA : AND.l DrawMagicMeter_mp_tilemap+6,X : STA.l HUDTileMapBuffer+$106
|
||||
|
||||
;================================================================================
|
||||
NewHUD_DoneDrawing:
|
||||
PLB
|
||||
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
|
||||
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
|
||||
RTS
|
||||
MagicMeterColorMasks:
|
||||
dw $FFFF ; green - KEEP GREEN FIRST
|
||||
dw $EFFF ; blue
|
||||
dw $E7FF ; red
|
||||
dw $EBFF ; yellow
|
||||
dw $E3FF ; orange
|
||||
|
||||
;================================================================================
|
||||
; 8-bit registers
|
||||
; in: A(b) - Byte to Convert
|
||||
; out: $06 - $07 (high - low)
|
||||
;================================================================================
|
||||
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
|
||||
DrawCompassCounts:
|
||||
LDA.l CompassMode : BEQ .done
|
||||
|
||||
; no compass needed if this bit is set
|
||||
BIT.b #$02 : BNE .draw_compass_count
|
||||
LDA.l CompassField : AND.l DungeonItemMasks,X : BEQ .done
|
||||
|
||||
.draw_compass_count
|
||||
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 #!SlashTile : STX.w HUDTileMapBuffer+$98
|
||||
|
||||
PLA
|
||||
JSR HUDHex2Digit
|
||||
STY.w HUDTileMapBuffer+$94 : STX.w HUDTileMapBuffer+$96
|
||||
|
||||
.done
|
||||
RTS
|
||||
;================================================================================
|
||||
DrawMapCounts:
|
||||
LDA.l MapHUDMode : BEQ .done
|
||||
|
||||
; no map needed if this bit is set
|
||||
BIT.b #$02 : BNE .draw_map_count
|
||||
LDA.l MapField : AND.l DungeonItemMasks,X : BEQ .done
|
||||
|
||||
.draw_map_count
|
||||
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
|
||||
RTS
|
||||
;================================================================================
|
||||
; 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
|
||||
|
||||
;================================================================================
|
||||
HUDHex2Digit_Long:
|
||||
JSR HUDHex2Digit
|
||||
REP #$20
|
||||
RTL
|
||||
|
||||
HUDHex4Digit_Long:
|
||||
JSR HUDHex4Digit
|
||||
REP #$20
|
||||
RTL
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user