2 byte compass counts

This commit is contained in:
aerinon
2023-08-30 12:33:27 -06:00
parent cd67d27798
commit d09aea3ff9
10 changed files with 156 additions and 121 deletions

View File

@@ -185,10 +185,7 @@ DrHudDungeonItemsAdditions:
tya : !add #$003c : tay
+ lda CompassField : and.l $0098c0, x : beq + ; must have compass
phx ; total chest counts
txa : lsr : tax
sep #$30
lda.l TotalLocations, x : !sub DungeonLocationsChecked, x : JSR HudHexToDec2DigitCopy
rep #$30
lda.l CompassTotalsWRAM, x : !sub DungeonLocationsChecked, x : JSR HudHexToDec2DigitCopy
lda $06 : jsr ConvertToDisplay2 : sta $1644, y : iny #2
lda $07 : jsr ConvertToDisplay2 : sta $1644, y
plx
@@ -252,11 +249,7 @@ ConvertToDisplay2:
++ lda #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
CountAbsorbedKeys:
jsl IncrementSmallKeysNoPrimary : phx
lda $040c : cmp #$ff : beq +
lsr : tax
lda DungeonAbsorbedKeys, x : inc : sta DungeonAbsorbedKeys, x
+ plx : rtl
JML IncrementSmallKeysNoPrimary
;================================================================================
; 8-bit registers

View File

@@ -131,7 +131,7 @@ JML.l InitializeSaveFile_checksum_done
OnFileLoad:
REP #$10 ; set 16 bit index registers
JSL.l EnableForceBlank ; what we wrote over
REP #$20 : LDA.l $30F010 : STA.l MultiClientFlagsWRAM+1 : SEP #$20
REP #$20 : LDA.l TotalItemCount : STA.l MultiClientFlagsWRAM+1 : SEP #$20
LDA MultiClientFlagsROM : STA.l MultiClientFlagsWRAM
LDA.b #$07 : STA.w BG34NBA ; Restore screen 3 to normal tile area

View File

@@ -77,10 +77,12 @@ JML $80D463 ; The original target of the jump table that we hijacked
InitDungeonCounts:
PHB
LDX.b #$0F
REP #$20
-
LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X
DEX
BPL -
SEP #$20
LDX.b #$0F
-
LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X

View File

@@ -216,10 +216,10 @@ DungeonIncrement:
CPY.b #$32 : BEQ .ballchain_bigkey
+
CMP.b #$04 : BCS +
LDA.l SewersLocations : INC : STA.l SewersLocations : STA.l HCLocations
REP #$20 : LDA.l SewersLocations : INC : STA.l SewersLocations : STA.l HCLocations : SEP #$20
BRA .done
+
LSR : TAX : LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
TAX : REP #$20 : LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X : SEP #$20
CPX.b #$0D : BNE +
LDA.l BigKeyField : BIT.b #$04 : BNE ++
LDA.l PreGTBKLocations : INC : STA.l PreGTBKLocations

View File

@@ -221,14 +221,14 @@ RevealPotItem:
LDA.l RoomPotData, X : BIT $0A : BNE .obtained
ORA $0A : STA RoomPotData, X
; increment dungeon counts
SEP #$30
LDA $040C : CMP #$FF : BEQ +
CMP.b #$00 : BNE ++
INC #2 ; treat sewers as HC
++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
SEP #$10
LDX.w $040C : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
INC.w UpdateHUD
; Could increment GT Tower Pre Big Key but we aren't showing that stat right now
+ REP #$30
+ REP #$10
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
.obtained
PLY : PLX
@@ -314,17 +314,17 @@ IncrementCountsForSubstitute:
LDA.b $A0 : ASL : TAX
LDA.l RoomPotData, X : BIT $0A : BNE .obtained
ORA $0A : STA RoomPotData, X
SEP #$30
LDA $040C : CMP #$FF : BEQ +
CMP.b #$00 : BNE ++
INC #2 ; treat sewers as HC
++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
SEP #$10
LDX.w $040C : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
INC.w UpdateHUD
; Could increment GT Tower Pre Big Key but we aren't showing that stat right now
+ REP #$30
+
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
.obtained
SEP #$30 : PLX
SEP #$20 : PLX
RTS
ClearSpriteData:
@@ -514,15 +514,15 @@ IncrementCountForMinor:
LDA.b $A0 : ASL : TAX
LDA.l SpriteDropData, X : BIT $0A : BNE .obtained
ORA $0A : STA SpriteDropData, X
SEP #$30
SEP #$10
JSR SetupEnemyDropIndicator
LDA $040C : CMP #$FF : BEQ +
CMP.b #$00 : BNE ++
INC #2 ; treat sewers as HC
++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
LDX.w $040C : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
INC.w UpdateHUD
; Could increment GT Tower Pre Big Key but we aren't showing that stat right now
+ REP #$30
+ REP #$10
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
.obtained
SEP #$30 : PLX

View File

@@ -88,7 +88,10 @@ PHX
; see if hyrule castle has been completely cleared
.hyrule_castle
LDA.l CompassTotalsWRAM, X : SEC : SBC DungeonLocationsChecked, X : BEQ .fail
REP #$20
LDA.l CompassTotalsWRAM, X : SEC : SBC.l DungeonLocationsChecked, X
SEP #$20
BEQ .fail
CLC : BRA .done
.fail

View File

@@ -78,10 +78,14 @@ NewHUD_DrawGoal:
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+6 ; draw 1's digit
REP #$20
LDX.w #!BlankTile
LDA.w GoalCounter
CMP.w #100 : BCS .req : STX.w HUDGoalIndicator+$02
CMP.w #10 : BCS .req : STX.w HUDGoalIndicator+$04
.req
LDA.l GoalItemRequirement : CMP.w #$FFFF : BNE .real_goal
LDX.w #!BlankTile
STX.w HUDGoalIndicator+10
STX.w HUDGoalIndicator+12
STX.w HUDGoalIndicator+14
@@ -197,8 +201,11 @@ NewHUD_DrawPrizeIcon:
;================================================================================
NewHUD_DrawItemCounter:
REP #$20
LDA.w UpdateHUD : BEQ NewHUD_DrawMagicMeter
LDA.l ItemCounterHUD : AND.w #$00FF : BEQ NewHUD_DrawMagicMeter
LDA.w UpdateHUD : BNE .continue
.early_exit
JMP NewHUD_DrawMagicMeter
.continue
LDA.l ItemCounterHUD : AND.w #$00FF : BEQ .early_exit
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
@@ -210,6 +217,10 @@ NewHUD_DrawItemCounter:
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
REP #$20 : LDA.w TotalItemCounter
LDX.w #!BlankTile
CMP.w #100 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$02
CMP.w #10 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$04
BRA NewHUD_DrawMagicMeter
.item_four_digits
@@ -224,6 +235,11 @@ NewHUD_DrawItemCounter:
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
REP #$20 : LDA.w TotalItemCounter
LDX.w #!BlankTile
CMP.w #1000 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$00
CMP.w #100 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$02
CMP.w #10 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$04
;================================================================================
DrawMagicMeter_mp_tilemap = $0DFE0F
@@ -275,37 +291,65 @@ MagicMeterColorMasks:
dw $EBFF ; yellow
dw $E3FF ; orange
; todo: re-do this section
;================================================================================
DrawCompassCounts:
LDA.l CompassMode : AND #$0F : BEQ .done
LDA.l CompassMode : AND.b #$0F : BNE .continue
.early_exit
JMP .done
.continue
; no compass needed if this bit is set
BIT.b #$02 : BNE .draw_compass_count
TYX : LDA.l ExistsTransfer, X : TAX : LDA.l CompassExists, X : BEQ .draw_compass_count
REP #$20
LDA.l CompassField : AND.l DungeonItemMasks,X : BEQ .done
LDX.w DungeonID : LDA.l CompassField : AND.l DungeonItemMasks,X : BEQ .early_exit
.draw_compass_count
SEP #$20
TYX : BNE .not_sewers
INX
.draw_compass_count
LDX.w DungeonID
CPX.b #$00 : BNE .not_sewers
INX #2
.not_sewers
.not_sewers
REP #$20
LDA.l DungeonLocationsChecked, X
PHA
LDA.w #!SlashTile : STA.w HUDTileMapBuffer+$98 ; always slash
LDA.l CompassTotalsWRAM,X
CMP.w #100 : BCS .three_digits
CMP.w #10 : BCS .two_digits
JSR HUDHex2Digit
STY.w HUDTileMapBuffer+$9A : STX.w HUDTileMapBuffer+$9C
LDX.w #!BlankTile : STX.w HUDTileMapBuffer+$92
LDX.w #!SlashTile : STX.w HUDTileMapBuffer+$98
LDA.l CompassTotalsOneDigit, X : STA.w HUDTileMapBuffer+$9C
PLA
JSR HUDHex2Digit
STY.w HUDTileMapBuffer+$94 : STX.w HUDTileMapBuffer+$96
STX.w HUDTileMapBuffer+$96
BRA .done
.two_digits
LDA.l CompassTotalsTensDigit, X : STA.w HUDTileMapBuffer+$9A
LDA.l CompassTotalsOneDigit, X : STA.w HUDTileMapBuffer+$9C
PLA
JSR HUDHex2Digit
CPY.w #$2490 : BEQ +
STY.w HUDTileMapBuffer+$94
+ STX.w HUDTileMapBuffer+$96
BRA .done
.three_digits
LDA.l CompassTotalsHundredsDigit, X : STA.w HUDTileMapBuffer+$9A
LDA.l CompassTotalsTensDigit, X : STA.w HUDTileMapBuffer+$9C
LDA.l CompassTotalsOneDigit, X : STA.w HUDTileMapBuffer+$9E
PLA : PHA
JSR HUDHex4Digit
LDA.b Scrap05 : TAX : STX.w HUDTileMapBuffer+$92
LDA.b Scrap06 : TAX : STX.w HUDTileMapBuffer+$94
LDA.b Scrap07 : TAX : STX.w HUDTileMapBuffer+$96
REP #$20 : PLA
LDX.w #!BlankTile
CMP.w #100 : BCS .done
STX.w HUDTileMapBuffer+$92
CMP.w #10 : BCS .done
STX.w HUDTileMapBuffer+$94
.done
SEP #$20

View File

@@ -609,9 +609,9 @@ RxStatus: skip 1 ;
TxBuffer: skip $7F ;
TxStatus: skip 1 ;
skip $10 ; Unused
CompassTotalsWRAM: skip $10 ; \ Compass and map dungeon HUD display totals. Placed in WRAM
CompassTotalsWRAM: skip $20 ; \ Compass and map dungeon HUD display totals. Placed in WRAM
MapTotalsWRAM: skip $10 ; / on boot for tracking.
skip $30 ; Reserved for general dungeon tracking data. May have over
skip $20 ; Reserved for general dungeon tracking data. May have over
; allocated here. Feel free to reassign.
MapCompassFlag: skip 2 ; Used to flag overworld map drawing.
skip $3E ; Unused
@@ -1004,7 +1004,7 @@ endmacro
%assertRAM(TxBuffer, $7F5380)
%assertRAM(TxStatus, $7F53FF)
%assertRAM(CompassTotalsWRAM, $7F5410)
%assertRAM(MapTotalsWRAM, $7F5420)
%assertRAM(MapTotalsWRAM, $7F5430)
%assertRAM(MapCompassFlag, $7F5460)
%assertRAM(DialogBuffer, $7F5700)
%assertRAM(MiniGameTime, $7FFE00)

View File

@@ -327,38 +327,22 @@ skip 40 ; Unused
ServiceSequence: ; See servicerequest.asm
ServiceSequenceRx: skip 8 ; Service sequence receive
ServiceSequenceTx: skip 8 ; Service sequence transmit
DungeonAbsorbedKeys: ; \ Absorbed key counters (integers)
SewerAbsorbedKeys: skip 1 ; | Sewer Passage
HCAbsorbedKeys: skip 1 ; | Hyrule Castle
EPAbsorbedKeys: skip 1 ; | Eastern Palace
DPAbsorbedKeys: skip 1 ; | Desert Palace
CTAbsorbedKeys: skip 1 ; | Agahnim's Tower
SPAbsorbedKeys: skip 1 ; | Swamp Palace
PDAbsorbedKeys: skip 1 ; | Palace of Darkness
MMAbsorbedKeys: skip 1 ; | Misery Mire
SWAbsorbedKeys: skip 1 ; | Skull Woods
IPAbsorbedKeys: skip 1 ; | Ice Palace
THAbsorbedKeys: skip 1 ; | Tower of Hera
TTAbsorbedKeys: skip 1 ; | Thieves' Town
TRAbsorbedKeys: skip 1 ; | Turtle Rock
GTAbsorbedKeys: skip 1 ; / Ganon's Tower
skip 2 ; Reserved for previous table
DungeonLocationsChecked: ; \ Dungeon locations checked counters (integers)
SewersLocations: skip 1 ; | Sewer Passage
HCLocations: skip 1 ; | Hyrule Castle
EPLocations: skip 1 ; | Eastern Palace
DPLocations: skip 1 ; | Desert Palace
CTLocations: skip 1 ; | Agahnim's Tower
SPLocations: skip 1 ; | Swamp Palace
PDLocations: skip 1 ; | Palace of Darkness
MMLocations: skip 1 ; | Misery Mire
SWLocations: skip 1 ; | Skull Woods
IPLocations: skip 1 ; | Ice Palace
THLocations: skip 1 ; | Tower of Hera
TTLocations: skip 1 ; | Thieves' Town
TRLocations: skip 1 ; | Turtle Rock
GTLocations: skip 1 ; / Ganon's Tower:
skip 2 ; Reserved for previous table
DungeonLocationsChecked: ; \ Dungeon locations checked counters (integers, word size)
SewersLocations: skip 2 ; | Sewer Passage
HCLocations: skip 2 ; | Hyrule Castle
EPLocations: skip 2 ; | Eastern Palace
DPLocations: skip 2 ; | Desert Palace
CTLocations: skip 2 ; | Agahnim's Tower
SPLocations: skip 2 ; | Swamp Palace
PDLocations: skip 2 ; | Palace of Darkness
MMLocations: skip 2 ; | Misery Mire
SWLocations: skip 2 ; | Skull Woods
IPLocations: skip 2 ; | Ice Palace
THLocations: skip 2 ; | Tower of Hera
TTLocations: skip 2 ; | Thieves' Town
TRLocations: skip 2 ; | Turtle Rock
GTLocations: skip 2 ; / Ganon's Tower:
skip 4 ; Reserved for previous table
skip 16 ; Currently occupied by multiworld stuff in DR, can be reclaimed
DungeonCollectedKeys: ; \ Chest Key Counters. Only counts keys placed in chests. (integers)
SewerCollectedKeys: skip 1 ; | Sewer Passage
@@ -393,6 +377,8 @@ RoomPotData: skip 592 ; Table for expanded pot shuffle. One word per
SpriteDropData: skip 592 ; Table for expanded drop shuffle. One word per room.
PurchaseCounts: skip 96 ; Keeps track of shop purchases
PrivateBlockPersistent: skip 513 ; Reserved for 3rd party developers
skip 231
DungeonLocationsCheckedBCD:
;================================================================================
; Direct SRAM Assignments ($700000 - $7080000)
@@ -607,36 +593,21 @@ endmacro
%assertSRAM(ServiceSequenceRx, $7EF4A0)
%assertSRAM(ServiceSequenceTx, $7EF4A8)
;--------------------------------------------------------------------------------
%assertSRAM(DungeonAbsorbedKeys, $7EF4B0)
%assertSRAM(SewerAbsorbedKeys, $7EF4B0)
%assertSRAM(HCAbsorbedKeys, $7EF4B1)
%assertSRAM(EPAbsorbedKeys, $7EF4B2)
%assertSRAM(DPAbsorbedKeys, $7EF4B3)
%assertSRAM(CTAbsorbedKeys, $7EF4B4)
%assertSRAM(SPAbsorbedKeys, $7EF4B5)
%assertSRAM(PDAbsorbedKeys, $7EF4B6)
%assertSRAM(MMAbsorbedKeys, $7EF4B7)
%assertSRAM(SWAbsorbedKeys, $7EF4B8)
%assertSRAM(IPAbsorbedKeys, $7EF4B9)
%assertSRAM(THAbsorbedKeys, $7EF4BA)
%assertSRAM(TTAbsorbedKeys, $7EF4BB)
%assertSRAM(TRAbsorbedKeys, $7EF4BC)
%assertSRAM(GTAbsorbedKeys, $7EF4BD)
%assertSRAM(DungeonLocationsChecked, $7EF4C0)
%assertSRAM(SewersLocations, $7EF4C0)
%assertSRAM(HCLocations, $7EF4C1)
%assertSRAM(EPLocations, $7EF4C2)
%assertSRAM(DPLocations, $7EF4C3)
%assertSRAM(CTLocations, $7EF4C4)
%assertSRAM(SPLocations, $7EF4C5)
%assertSRAM(PDLocations, $7EF4C6)
%assertSRAM(MMLocations, $7EF4C7)
%assertSRAM(SWLocations, $7EF4C8)
%assertSRAM(IPLocations, $7EF4C9)
%assertSRAM(THLocations, $7EF4CA)
%assertSRAM(TTLocations, $7EF4CB)
%assertSRAM(TRLocations, $7EF4CC)
%assertSRAM(GTLocations, $7EF4CD)
%assertSRAM(DungeonLocationsChecked, $7EF4B0)
%assertSRAM(SewersLocations, $7EF4B0)
%assertSRAM(HCLocations, $7EF4B2)
%assertSRAM(EPLocations, $7EF4B4)
%assertSRAM(DPLocations, $7EF4B6)
%assertSRAM(CTLocations, $7EF4B8)
%assertSRAM(SPLocations, $7EF4BA)
%assertSRAM(PDLocations, $7EF4BC)
%assertSRAM(MMLocations, $7EF4BE)
%assertSRAM(SWLocations, $7EF4C0)
%assertSRAM(IPLocations, $7EF4C2)
%assertSRAM(THLocations, $7EF4C4)
%assertSRAM(TTLocations, $7EF4C6)
%assertSRAM(TRLocations, $7EF4C8)
%assertSRAM(GTLocations, $7EF4CA)
%assertSRAM(DungeonCollectedKeys, $7EF4E0)
%assertSRAM(SewerCollectedKeys, $7EF4E0)
%assertSRAM(HCCollectedKeys, $7EF4E1)

View File

@@ -2757,9 +2757,10 @@ CrystalPendantFlags_3:
db $07 ; Turtle Rock
db $00 ; Ganons Tower
; 00 - No Prize. 01 - 07 Crystal Number 08 - Green Pendant 09 - Blue Pendant, 0A - Red Pendant
org $B0F000 ; PC 0x187000-0x18700F
CompassTotalsROM:
db $08, $08, $06, $06, $02, $0A, $0E, $08, $08, $08, $06, $08, $0C, $1B, $00, $00
;--------------------------------------------------------------------------------
; 0x187000 - 18700F (unused)
;--------------------------------------------------------------------------------
org $B0F010
ChestKeys: ; PC 0x187010-0x18701F
@@ -2784,10 +2785,31 @@ org $B0F032 ; PC 0x187032
RomSpeed:
db $01 ; $01 = FastROM (default) | $00 = SlowROM
org $B0F033 ; PC 0x187033
;--------------------------------------------------------------------------------
; 0x187033 - 18703F (unused)
;--------------------------------------------------------------------------------
org $B0F040 ; PC 0x187040
CompassTotalsROM:
dw $0008, $0008, $0006, $0006, $0002, $000A, $000E, $0008
dw $0008, $0008, $0006, $0008, $000C, $001B, $0000, $0000
org $B0F060 ; PC 0x187060
CompassTotalsHundredsDigit:
dw !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile
dw !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile
org $B0F080 ; PC 0x187080
CompassTotalsTensDigit:
dw !BlankTile, !BlankTile, !BlankTile, !BlankTile, !BlankTile, $2491, $2491, !BlankTile
dw !BlankTile, !BlankTile, !BlankTile, !BlankTile, $2491, $2492, !BlankTile, !BlankTile
org $B0F0A0 ; PC 0x1870A0
CompassTotalsOneDigit:
dw $2498, $2498, $2496, $2496, $2492, $2490, $2494, $2498
dw $2498, $2498, $2496, $2498, $2492, $2497, $2490, $2490
org $B0F0C0 ; PC 0x1870C0
;--------------------------------------------------------------------------------
; 0x187033 - 187FFF (unused)
; 0x1870C0 - 187FFF (unused)
;--------------------------------------------------------------------------------
pushpc