Merge pull request #50 from scawful/JaredMenuFixes

This commit is contained in:
Justin Scofield
2024-03-25 19:56:06 -04:00
committed by GitHub
12 changed files with 777 additions and 620 deletions

12
.gitignore vendored Normal file
View File

@@ -0,0 +1,12 @@
asar.exe
oos111.sfc
oos111x-1.bst
oos111x-2.bst
oos111x-3.bst
oos111x.bp
oos111x.cht
oos111x.cpu.sym
oos111x.sfc
oos111x.smp.sym
oos111x.srm
oos111x.sym

View File

@@ -14,13 +14,14 @@ pushpc
; update in game hud colors
org $1BD662 : dw hexto555($814f16), hexto555($552903)
org $1BD66A : dw hexto555($d51d00), hexto555($f9f9f9)
org $1DB672 : dw hexto555($d1a452), hexto555($f9f9f9)
org $1DB672 : dw hexto555($d0a050), hexto555($f9f9f9)
org $1DB67A : dw hexto555($5987e0), hexto555($f9f9f9)
org $1DB682 : dw hexto555($7b7b83), hexto555($bbbbbb)
org $1DB68A : dw hexto555($a58100), hexto555($dfb93f)
; Free ROM in Bank 00
org $0098AB : db $D8>>1
org $0098AB : db $6C
org $0098AC : db $64
; Module RunInterface 0E.01: Item Menu
org $00F877 : db Menu_Entry>>0
@@ -57,17 +58,18 @@ Menu_Entry:
RTL
}
.vectors
dw Menu_InitGraphics ; 00
dw Menu_UploadRight ; 01
dw Menu_UploadLeft ; 02
dw Menu_ScrollDown ; 03
dw Menu_ItemScreen ; 04
dw Menu_ScrollTo ; 05
dw Menu_StatsScreen ; 06
dw Menu_ScrollFrom ; 07
dw Menu_ScrollUp ; 08
dw Menu_CheckBottle ; 09
dw Menu_Exit ; 0A
dw Menu_InitGraphics ; 00
dw Menu_UploadRight ; 01
dw Menu_UploadLeft ; 02
dw Menu_ScrollDown ; 03
dw Menu_ItemScreen ; 04
dw Menu_ScrollTo ; 05
dw Menu_StatsScreen ; 06
dw Menu_ScrollFrom ; 07
dw Menu_ScrollUp ; 08
dw Menu_CheckBottle ; 09
dw Menu_Exit ; 0A
dw Menu_InitiateScrollDown ; 0B
; =========================================================
; 00 MENU INIT GRAPHICS
@@ -123,10 +125,10 @@ Menu_UploadLeft:
; INSERT PALETTE -------
LDX.w #$3E
.loop
LDA.w Menu_Palette, X
STA.l $7EC502, X
DEX : DEX
.loop
LDA.w Menu_Palette, X
STA.l $7EC502, X
DEX : DEX
BPL .loop
SEP #$30
@@ -158,11 +160,10 @@ Menu_ScrollDown:
INX : INX
LDA.w Menu_Scroll, X
STA.b $EA
CMP.w #$FF12 : BNE .loop
CMP.w #$FF12 : BNE .notDoneScrolling
JMP Menu_InitItemScreen
JMP Menu_InitItemScreen
.loop
.notDoneScrolling
STX.w MenuScrollLevelV
RTS
}
@@ -178,40 +179,39 @@ Menu_ItemScreen:
INC $0207
LDA.w $0202 : BEQ .no_inputs
; Scroll through joypad 1 inputs
ASL : TAY : LDA.b $F4
LSR : BCS .move_right
LSR : BCS .move_left
LSR : BCS .move_down
LSR : BCS .move_up
; Scroll through joypad 1 inputs
ASL : TAY : LDA.b $F4
LSR : BCS .move_right
LSR : BCS .move_left
LSR : BCS .move_down
LSR : BCS .move_up
BRA .no_inputs
.move_right
.move_right
JSR Menu_DeleteCursor
JSR Menu_FindNextItem
BRA .draw_cursor
.move_left
.move_left
JSR Menu_DeleteCursor
JSR Menu_FindPrevItem
BRA .draw_cursor
.move_down
.move_down
JSR Menu_DeleteCursor
JSR Menu_FindNextDownItem
BRA .draw_cursor
.move_up
.move_up
JSR Menu_DeleteCursor
JSR Menu_FindNextUpItem
BRA .draw_cursor
.draw_cursor
.draw_cursor
LDA.b #$20 : STA.w $012F ; cursor move sound effect
.no_inputs
.no_inputs
SEP #$30
LDA.w $0202
ASL : TAY
@@ -223,16 +223,15 @@ Menu_ItemScreen:
REP #$20
BEQ .no_delete
; Delete cursor
LDA.w #$20F5
STA.w $1108, X : STA.w $1148, X
STA.w $114E, X : STA.w $110E, X
STA.w $11C8, X : STA.w $1188, X
STA.w $118E, X : STA.w $11CE, X
BRA .done
; Delete cursor
LDA.w #$20F5
STA.w $1108, X : STA.w $1148, X
STA.w $114E, X : STA.w $110E, X
STA.w $11C8, X : STA.w $1188, X
STA.w $118E, X : STA.w $11CE, X
BRA .done
.no_delete
.no_delete
LDA.w #$3060 : STA.w $1108, X ; corner
LDA.w #$3070 : STA.w $1148, X
@@ -245,7 +244,7 @@ Menu_ItemScreen:
LDA.w #$7070 : STA.w $118E, X
LDA.w #$F060 : STA.w $11CE, X ; corner
.done
.done
JSR Menu_DrawItemName
SEP #$20
LDA.b #$22 : STA.w $0116
@@ -262,10 +261,9 @@ Menu_ScrollTo:
SEP #$20
JSR Menu_ScrollHorizontal
BCC .not_done
INC.w $0200
INC.w $0200
.not_done
.not_done
RTS
}
@@ -288,10 +286,9 @@ Menu_ScrollFrom:
{
JSR Menu_ScrollHorizontal
BCC .not_done
JMP Menu_InitItemScreen
JMP Menu_InitItemScreen
.not_done
.not_done
RTS
}
@@ -300,19 +297,17 @@ Menu_ScrollFrom:
Menu_ScrollUp:
{
JSL $0DFA58 ; HUD_Rebuild_Long
LDA.b #$12 : STA.w $012F ; play menu exit sound effect
SEP #$10
REP #$20
LDX.w MenuScrollLevelV
LDA.w Menu_Scroll, X
STA.b $EA : BNE .loop
STZ.b $E4
INC.w $0200
RTS
STA.b $EA : BNE .notDoneScrolling
STZ.b $E4
INC.w $0200
RTS
.loop
.notDoneScrolling
DEX : DEX : STX.w MenuScrollLevelV
RTS
}
@@ -377,8 +372,85 @@ Menu_Exit:
}
; =========================================================
; 0B MENU COPY TO RIGHT
Menu_InitiateScrollDown:
{
REP #$20
; Clear out the whole buffer.
LDX.b #$FE ; $1700-17FF
.loop
LDA.w #$387F
STA.w $1000, X
STA.w $1100, X
STA.w $1200, X
STA.w $1300, X
STA.w $1400, X
STA.w $1500, X
STA.w $1600, X
STA.w $1700, X
DEX : DEX
BNE .loop
; TODO: The BPL wasn't working so figure out why and
; fix it instead of doing this abomination.
STA.w $1000
STA.w $1100
STA.w $1200
STA.w $1300
STA.w $1400
STA.w $1500
STA.w $1600
STA.w $1700
SEP #$20
JSL $0DFA58 ; HUD_Rebuild_Long
; Draw one frame of the clock so it doesn't just
; pop in when scrolling down.
JSL DrawClockToHudLong
; The whole HUD fits on 4 rows so I'm only going to
; copy 4 here. Also we start 2 in because thats the
; left we need to go.
LDX.b #$3A
.loop1
LDA $7EC702, X : STA $1082, X
DEX : BNE .loop1
LDX.b #$3A
.loop2
LDA $7EC742, X : STA $10C2, X
DEX : BNE .loop2
LDX.b #$3A
.loop3
LDA $7EC782, X : STA $1102, X
DEX : BNE .loop3
LDX.b #$3A
.loop4
LDA $7EC7C2, X : STA $1142, X
DEX : BNE .loop4
LDA.b #$24 : STA.w $0116
LDA.b #$01 : STA.b $17
LDA.b #$08 : STA.w $0200
LDA.b #$12 : STA.w $012F ; play menu exit sound effect
RTS
}
menu_frame: incbin "tilemaps/menu_frame.tilemap"
quest_icons: incbin "tilemaps/quest_icons.tilemap"
incsrc "menu_map_names.asm"
incsrc "menu_hud.asm"
; =========================================================

View File

@@ -1,30 +1,31 @@
; =========================================================
; Tilemap Menu background
; This function is bled into via the previous menu.asm file.
Menu_DrawBackground:
{
REP #$30
LDX.w #$FE ; $1700-17FF
.loop
LDA.w menu_frame, X
STA.w $1000, X
LDA.w menu_frame+$100, X
STA.w $1100, X
LDA.w menu_frame+$200, X
STA.w $1200, X
LDA.w menu_frame+$300, X
STA.w $1300, X
LDA.w menu_frame+$400, X
STA.w $1400, X
LDA.w menu_frame+$500, X
STA.w $1500, X
LDA.w menu_frame+$600, X
STA.w $1600, X
LDA.w menu_frame+$700, X
STA.w $1700, X
.loop
LDA.w menu_frame, X
STA.w $1000, X
LDA.w menu_frame+$100, X
STA.w $1100, X
LDA.w menu_frame+$200, X
STA.w $1200, X
LDA.w menu_frame+$300, X
STA.w $1300, X
LDA.w menu_frame+$400, X
STA.w $1400, X
LDA.w menu_frame+$500, X
STA.w $1500, X
LDA.w menu_frame+$600, X
STA.w $1600, X
LDA.w menu_frame+$700, X
STA.w $1700, X
DEX : DEX
DEX : DEX
BPL .loop
RTS
@@ -39,22 +40,19 @@ DrawMenuItem:
STA.b $08
STY.b $00
LDA.b [$08]
AND.w #$00FF
LDA.b [$08] : AND.w #$00FF : BNE .not_zero
LDY.w #NothingGFX
BRA .draw
BNE .not_zero
.not_zero
LDY.w #NothingGFX
BRA .draw
.not_zero
DEC
ASL : ASL : ASL
ADC.b $00
TAY
.draw
.draw
LDA.w $0000,Y : STA.w $1108,X
LDA.w $0002,Y : STA.w $110A,X
LDA.w $0004,Y : STA.w $1148,X
@@ -63,7 +61,6 @@ DrawMenuItem:
RTS
}
; =========================================================
; Quest Icons Tilemap Draw Routine
@@ -71,21 +68,21 @@ Menu_DrawQuestIcons:
{
LDX.w #$10
.loop
LDA.w quest_icons, X
STA.w $1364, X
LDA.w quest_icons+$10, X
STA.w $13A4, X
LDA.w quest_icons+$20, X
STA.w $13E4, X
LDA.w quest_icons+$30, X
STA.w $1424, X
LDA.w quest_icons+$40, X
STA.w $1464, X
LDA.w quest_icons+$50, X
STA.w $14A4, X
LDA.w quest_icons+$60, X
STA.w $14E4, X
.loop
LDA.w quest_icons, X
STA.w $1364, X
LDA.w quest_icons+$10, X
STA.w $13A4, X
LDA.w quest_icons+$20, X
STA.w $13E4, X
LDA.w quest_icons+$30, X
STA.w $1424, X
LDA.w quest_icons+$40, X
STA.w $1464, X
LDA.w quest_icons+$50, X
STA.w $14A4, X
LDA.w quest_icons+$60, X
STA.w $14E4, X
DEX : DEX : BPL .loop
LDA.w #$20F5 : STA.w $13B4 : STA.w $13F4 : STA.w $1474 : STA.w $14B4
@@ -93,7 +90,6 @@ Menu_DrawQuestIcons:
RTS
}
; =========================================================
Menu_DrawTriforceIcons:
@@ -103,59 +99,67 @@ Menu_DrawTriforceIcons:
LDY.w #$3544
LSR : BCC +
STX.w $1366 : INX : STX.w $1368 : DEX
STY.w $13A6 : INY : STY.w $13A8 : DEY
STX.w $1366 : INX : STX.w $1368 : DEX
STY.w $13A6 : INY : STY.w $13A8 : DEY
+
+ LSR : BCC +
STX.w $136A : INX : STX.w $136C : DEX
STY.w $13AA : INY : STY.w $13AC : DEY
LSR : BCC +
STX.w $136A : INX : STX.w $136C : DEX
STY.w $13AA : INY : STY.w $13AC : DEY
+
+ LSR : BCC +
STX.w $136E : INX : STX.w $1370 : DEX
STY.w $13AE : INY : STY.w $13B0 : DEY
LSR : BCC +
STX.w $136E : INX : STX.w $1370 : DEX
STY.w $13AE : INY : STY.w $13B0 : DEY
+
LSR : BCC +
STX.w $13E4 : INX : STX.w $13E6 : DEX
STY.w $1424 : INY : STY.w $1426 : DEY
+
LSR : BCC +
STX.w $13E8 : INX : STX.w $13EA : DEX
STY.w $1428 : INY : STY.w $142A : DEY
+
LSR : BCC +
STX.w $13EC : INX : STX.w $13EE : DEX
STY.w $142C : INY : STY.w $142E : DEY
+
LSR : BCC +
STX.w $13F0 : INX : STX.w $13F2 : DEX
STY.w $1430 : INY : STY.w $1432 : DEY
+
+ LSR : BCC +
STX.w $13E4 : INX : STX.w $13E6 : DEX
STY.w $1424 : INY : STY.w $1426 : DEY
+ LSR : BCC +
STX.w $13E8 : INX : STX.w $13EA : DEX
STY.w $1428 : INY : STY.w $142A : DEY
+ LSR : BCC +
STX.w $13EC : INX : STX.w $13EE : DEX
STY.w $142C : INY : STY.w $142E : DEY
+ LSR : BCC +
STX.w $13F0 : INX : STX.w $13F2 : DEX
STY.w $1430 : INY : STY.w $1432 : DEY
+
RTS
}
; =========================================================
Menu_DrawPendantIcons:
{
LDA.l $7EF374
LSR : BCC +
LDX.w #$2502 : STX.w $14A4 : INX : STX.w $14A6
LDX.w #$2512 : STX.w $14E4 : INX : STX.w $14E6
LDX.w #$2502 : STX.w $14A4 : INX : STX.w $14A6
LDX.w #$2512 : STX.w $14E4 : INX : STX.w $14E6
+
+ LSR : BCC +
LDX.w #$3D00 : STX.w $14AA : INX : STX.w $14AC
LDX.w #$3D10 : STX.w $14EA : INX : STX.w $14EC
LSR : BCC +
LDX.w #$3D00 : STX.w $14AA : INX : STX.w $14AC
LDX.w #$3D10 : STX.w $14EA : INX : STX.w $14EC
+
+ LSR : BCC +
LDX.w #$2D06 : STX.w $14B0 : INX : STX.w $14B2
LDX.w #$2D16 : STX.w $14F0 : INX : STX.w $14F2
LSR : BCC +
LDX.w #$2D06 : STX.w $14B0 : INX : STX.w $14B2
LDX.w #$2D16 : STX.w $14F0 : INX : STX.w $14F2
+
+ RTS
RTS
}
; =========================================================
; V H O P P P T T T T T T T T T T <- tile format
@@ -178,20 +182,21 @@ Menu_DrawHeartPieces:
LDA.l $7EF36B
AND.w #$00FF
CMP.w #3 : BEQ .top_right
CMP.w #1 : BEQ .top_left
BCS .bottom_left
RTS
CMP.w #1 : BEQ .top_left
BCS .bottom_left
RTS
.top_right
.top_right
LDX.w #$64AD : STX.w $14A0
.bottom_left
.bottom_left
LDX.w #$24AE : STX.w $14DE
.top_left
.top_left
LDX.w #$24AD : STX.w $149E
RTS
}
; =========================================================
; TODO: Attach SRAM values to these for progression
@@ -240,24 +245,25 @@ DrawYItems:
JSR DrawMenuItem
LDA.l $7EF342 : AND.w #$00FF : CMP.w #$0000 : BEQ .no_hookshot
LDA.w GoldstarOrHookshot : BNE .spoof_hookshot
LDA #$0001 ; No goldstar, but hookshot
.spoof_hookshot
STA.w MenuItemValueSpoof : LDA.w #MenuItemValueSpoof
LDX.w #menu_offset(7,9)
LDY.w #HookGFX
JSR DrawMenuItem
.no_hookshot
LDA.w GoldstarOrHookshot : BNE .spoof_hookshot
LDA #$0001 ; No goldstar, but hookshot
.spoof_hookshot
STA.w MenuItemValueSpoof : LDA.w #MenuItemValueSpoof
LDX.w #menu_offset(7,9)
LDY.w #HookGFX
JSR DrawMenuItem
.no_hookshot
LDA.l $7EF343
AND.w #$00FF : CMP.w #$00 : BEQ .no_bomb
LDA.w #$0001
STA.w MenuItemValueSpoof
LDA.w #MenuItemValueSpoof
LDX.w #menu_offset(7,13)
LDY.w #BombsGFX
JSR DrawMenuItem
.no_bomb
LDA.w #$0001
STA.w MenuItemValueSpoof
LDA.w #MenuItemValueSpoof
LDX.w #menu_offset(7,13)
LDY.w #BombsGFX
JSR DrawMenuItem
.no_bomb
LDA.w #$7EF344
LDX.w #menu_offset(7,16)
@@ -303,33 +309,34 @@ DrawYItems:
; Row 3 -------------------------------------------------
LDA.l $7EF34C : CMP.w #$0000 : BEQ .no_ocarina
LDA.w $030F : BNE .spoof_ocarina
LDA #$0001 ; Multi-songs not unlocked yet
.spoof_ocarina
STA.w ShortSpoof : LDA.w #ShortSpoof
LDX.w #menu_offset(13,3)
LDY.w #OcarinaGFX
JSR DrawMenuItem
.no_ocarina
LDA.l $7EF34C : AND.w #$00FF : CMP.w #$0000 : BEQ .no_ocarina
LDA.w $030F : BNE .spoof_ocarina
LDA #$0001 ; Multi-songs not unlocked yet
.spoof_ocarina
STA.w ShortSpoof : LDA.w #ShortSpoof
LDX.w #menu_offset(13,3)
LDY.w #OcarinaGFX
JSR DrawMenuItem
.no_ocarina
LDA.l $7EF34E : AND.w #$00FF : CMP.w #$00 : BEQ .no_book
LDA.w #$01 : STA.w ShortSpoof : LDA.w #ShortSpoof
LDX.w #menu_offset(13,6)
LDY.w #BookGFX
JSR DrawMenuItem
.no_book
LDA.w #$01 : STA.w ShortSpoof : LDA.w #ShortSpoof
LDX.w #menu_offset(13,6)
LDY.w #BookGFX
JSR DrawMenuItem
.no_book
; LDA.l $7EF350 : CMP.w #$00 : BEQ .no_somaria
; LDA.w SomariaOrByrna : BNE .spoof_somaria
; .spoof_somaria
; LDA.w #$01 : STA.w ShortSpoof : LDA.w #ShortSpoof
LDA.w #$7EF350
LDX.w #menu_offset(13,9)
LDY.w #SomariaGFX
JSR DrawMenuItem
.no_somaria
; LDA.w SomariaOrByrna : BNE .spoof_somaria
; .spoof_somaria
; LDA.w #$01 : STA.w ShortSpoof : LDA.w #ShortSpoof
LDA.w #$7EF350
LDX.w #menu_offset(13,9)
LDY.w #SomariaGFX
JSR DrawMenuItem
.no_somaria
LDA.w #$7EF351
LDX.w #menu_offset(13,13)
@@ -436,74 +443,69 @@ Menu_DrawQuestItems:
Menu_DrawBigKey:
{
LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalace
LSR A : TAX
; Check if we have the big key in this palace
LDA $7EF366
LSR A : TAX
; Check if we have the big key in this palace
LDA $7EF366
.locateBigKeyFlag
.locateBigKeyFlag
ASL A : DEX : BPL .locateBigKeyFlag : BCC .dontHaveBigKey
JSR CheckPalaceItemPossession : LDA $02 : BEQ .noTreasureYet
SEP #$30
LDA.b #$7E : STA.b $0A
REP #$30
ASL A : DEX : BPL .locateBigKeyFlag : BCC .dontHaveBigKey
JSR CheckPalaceItemPossession : LDA $02 : BEQ .noTreasureYet
SEP #$30
LDA.b #$7E : STA.b $0A
REP #$30
LDA.w #$01
STA.w ShortSpoof
LDA.w #ShortSpoof
LDX.w #menu_offset(11,8)
LDY.w #TreasureChestGFX
JSR DrawMenuItem
LDA.w #$01
STA.w ShortSpoof
LDA.w #ShortSpoof
LDX.w #menu_offset(11,8)
LDY.w #TreasureChestGFX
JSR DrawMenuItem
.noTreasureYet
.noTreasureYet
SEP #$30
LDA.b #$7E : STA.b $0A
REP #$30
SEP #$30
LDA.b #$7E : STA.b $0A
REP #$30
LDA.w #$01
STA.w ShortSpoof
LDA.w #ShortSpoof
; Draw the big key (or big key with chest if we've gotten the treasure) icon
LDX.w #menu_offset(11,2)
LDY.w #BigKeyGFX
JSR DrawMenuItem
LDA.w #$01
STA.w ShortSpoof
LDA.w #ShortSpoof
; Draw the big key (or big key with chest if we've gotten the treasure) icon
LDX.w #menu_offset(11,2)
LDY.w #BigKeyGFX
JSR DrawMenuItem
.dontHaveBigKey
.notInPalace
.dontHaveBigKey
.notInPalace
LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalaceAgain
LSR A : TAX
; Check if we have the map in this dungeon
LDA $7EF368
LSR A : TAX
; Check if we have the map in this dungeon
LDA $7EF368
.locateMapFlag
.locateMapFlag
ASL A : DEX : BPL .locateMapFlag : BCC .dontHaveMap
LDA.w #$01
STA.w ShortSpoof
LDA.w #ShortSpoof
; Draw the big key (or big key with chest if we've gotten the treasure) icon
LDX.w #menu_offset(11,11)
LDY.w #MapGFX
JSR DrawMenuItem
ASL A : DEX : BPL .locateMapFlag : BCC .dontHaveMap
LDA.w #$01
STA.w ShortSpoof
LDA.w #ShortSpoof
; Draw the big key (or big key with chest if we've gotten the treasure) icon
LDX.w #menu_offset(11,11)
LDY.w #MapGFX
JSR DrawMenuItem
.dontHaveMap
.notInPalaceAgain
.dontHaveMap
.notInPalaceAgain
RTS
}
; =========================================================
; *$6EEB6-$6EEDB LOCAL
; $06EEB6-$06EEDB LOCAL
CheckPalaceItemPossession:
{
SEP #$30
@@ -533,63 +535,62 @@ CheckPalaceItemPossession:
; *$6EEDC-$6EEE0 JUMP LOCATION
.pool_CheckPalaceItemPossession:
{
.failure
.failure
STZ $02
STZ $03
RTS
.bow
.bow
LDA $7EF340
.no_item
.compare
.no_item
.compare
BEQ .failure
.success
.success
LDA.b #$01 : STA $02
STZ $03
RTS
.power_glove
.power_glove
LDA $7EF354 : BRA .compare
.hookshot
.hookshot
LDA $7EF342 : BRA .compare
.hammer
.hammer
LDA $7EF34B : BRA .compare
.cane_of_somaria
.cane_of_somaria
LDA $7EF350 : BRA .compare
.fire_rod
.fire_rod
LDA $7EF345 : BRA .compare
.blue_mail
.blue_mail
LDA $7EF35B : BRA .compare
.moon_pearl
.moon_pearl
LDA $7EF357 : BRA .compare
.titans_mitt
.titans_mitt
LDA $7EF354 : DEC A : BRA .compare
.mirror_shield
.mirror_shield
LDA $7EF35A : CMP.b #$03 : BEQ .success
@@ -598,7 +599,7 @@ CheckPalaceItemPossession:
RTS
.red_mail
.red_mail
LDA $7EF35B : CMP.b #$02 : BEQ .success
@@ -612,29 +613,29 @@ CheckPalaceItemPossession:
Menu_DrawBigChestKey:
{
LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalace
LSR A : TAX
LDA $7EF364
.locateCompassFlag
LSR A : TAX
LDA $7EF364
.locateCompassFlag
ASL A : DEX : BPL .locateCompassFlag
BCC .dontHaveCompass
SEP #$30
LDA.b #$7E : STA.b $0A
REP #$30
ASL A : DEX : BPL .locateCompassFlag
BCC .dontHaveCompass
SEP #$30
LDA.b #$7E : STA.b $0A
REP #$30
LDA.w #$01
STA.w ShortSpoof
LDA.w #ShortSpoof
LDX.w #menu_offset(11, 5)
LDY.w #BigChestKeyGFX
JSR DrawMenuItem
.dontHaveCompass
.notInPalace
LDA.w #$01
STA.w ShortSpoof
LDA.w #ShortSpoof
LDX.w #menu_offset(11, 5)
LDY.w #BigChestKeyGFX
JSR DrawMenuItem
.dontHaveCompass
.notInPalace
RTS
}
; =========================================================

View File

@@ -12,7 +12,7 @@ NothingGFX:
BowsGFX:
dw $28BA, $28E9, $28E8, $28CB ; Empty bow
dw $28BA, $28BB, $24CA, $28CB ; Bow and arrows
dw $28BA, $28BB, $28CA, $28CB ; Bow and arrows
dw $28BA, $28E9, $28E8, $28CB ; Empty silvers bow
dw $28BA, $28BB, $24CA, $28CB ; Silver bow and arrows
@@ -173,6 +173,8 @@ MirrorGFX:
; Collectibles
; ---------------------------------------------------------
; vhopppcc cccccccc
QuarterNoteGFX:
dw $30AA, $306B, $307A, $306A ; Gray Note
dw $2CAA, $2C6B, $2C7A, $2C6A ; Blue Note
@@ -218,7 +220,7 @@ SwordGFX:
dw $2C64, $2CCE, $2C75, $EC64 ; level one
dw $2C64, $2C65, $2C74, $2D26 ; level two
dw $3464, $3465, $3475, $3429 ; level three
dw $3464, $3465, $3475, $3429 ; level four
dw $3864, $3865, $3875, $3829 ; level four
; ---------------------------------------------------------

View File

@@ -70,11 +70,10 @@ HUD_Update:
; Branch if at full health
LDA $7EF36C : CMP $7EF36D : BEQ .healthUpdated
; Seems absurd to have a branch of zero bytes, right?
SEC : SBC #$04 : CMP $7EF36D : BCS .healthUpdated
; Seems absurd to have a branch of zero bytes, right?
SEC : SBC #$04 : CMP $7EF36D : BCS .healthUpdated
.healthUpdated
.healthUpdated
; A = actual health + 0x03;
LDA $7EF36D : CLC : ADC.b #$03
@@ -88,18 +87,17 @@ HUD_Update:
; filling in the full and partially filled hearts (actual health)
JSR HUD_UpdateHearts
.ignore_health ; *$6FC09 ALTERNATE ENTRY POINT ; reentry hook
.ignore_health ; *$6FC09 ALTERNATE ENTRY POINT ; reentry hook
REP #$30
; Magic amount indicator (normal, 1/2, or 1/4)
LDA $7EF37B : AND.w #$00FF : CMP.w #$0001 : BCC .normal_magic_meter
; draw 1/2 magic meter
LDA.w #$2851 : STA $7EC730
LDA.w #$28FA : STA $7EC732
; draw 1/2 magic meter
LDA.w #$2851 : STA $7EC730
LDA.w #$28FA : STA $7EC732
.normal_magic_meter
.normal_magic_meter
; check player magic (ranges from 0 to 0x7F)
; X = ((MP & 0xFF)) + 7) & 0xFFF8)
@@ -134,55 +132,56 @@ HUD_Update:
; Check if the user has bombs equipped
LDX $0202 : LDA $7EF33F, X : AND.w #$00FF
CPX.w #$0004 : BNE .not_bombs
; Number of bombs Link has.
LDA $7EF343 : AND.w #$00FF
JSR HexToDecimal
REP #$30
; Number of bombs Link has.
LDA $7EF343 : AND.w #$00FF
JSR HexToDecimal
REP #$30
; The tile index for the first bomb digit
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
; The tile index for the first bomb digit
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
; The tile index for the second bomb digit
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B2
; The tile index for the second bomb digit
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B2
.not_bombs
.not_bombs
; Check if the user has arrows equipped
LDX $0202 : LDA $7EF33F, X : AND.w #$00FF
CPX.w #$0001 : BNE .not_arrows
; Number of Arrows Link has.
LDA $7EF377 : AND.w #$00FF
; Number of Arrows Link has.
LDA $7EF377 : AND.w #$00FF
; converts hex to up to 3 decimal digits
JSR HexToDecimal
REP #$30
; converts hex to up to 3 decimal digits
JSR HexToDecimal
REP #$30
; The tile index for the first arrow digit
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
; The tile index for the first arrow digit
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
; The tile index for the second arrow digit
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B2
; The tile index for the second arrow digit
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B2
.not_arrows
.not_arrows
LDA.w #$007F : STA $05
; Load number of Keys Link has
LDA $7EF36F : AND.w #$00FF : CMP.w #$00FF : BEQ .no_keys
JSR HexToDecimal
.no_keys
JSR HexToDecimal
.no_keys
REP #$30
; The key digit, which is optionally drawn.
; Also check to see if the key spot is blank
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7A4
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7A4
CMP.w #$247F : BNE .dont_blank_key_icon
; TODO: Find the proper index of the key icon, this one is outdated.
; If the key digit is blank, also blank out the key icon.
STA $7EC724
; TODO: Find the proper index of the key icon, this one is outdated.
; If the key digit is blank, also blank out the key icon.
STA $7EC724
.dont_blank_key_icon
.dont_blank_key_icon
SEP #$30
RTL
}
@@ -216,77 +215,86 @@ MagicTilemap:
dw MostlyFull, Full, Full, Full
; =========================================================
; *$6FAFD-$6FB90 LOCAL
; $06FAFD-$06FB90 LOCAL
HUD_UpdateItemBox:
{
SEP #$30
; Dost thou haveth the the bow?
LDA $7EF340 : BEQ .no_bow
CMP.b #$03 : BCC .no_silver_arrows
; Check how many arrows the player has:
LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$03
BRA .draw_bow_item_icon
CMP.b #$03 : BCC .no_silver_arrows
.no_silver_arrows
; check how many arrows the player has
LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$03
BRA .draw_bow_item_icon
LDX.b #$02
LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$01
.no_silver_arrows
.draw_bow_item_icon
; Values of X correspond to how the icon will end up drawn:
; 0x01 - normal bow with no arrows
; 0x02 - normal bow with arrows
; 0x03 - silver bow with no silver arrows
; 0x04 - silver bow with silver arrows
TXA : STA $7EF340
LDX.b #$02
LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$01
.no_bow
.draw_bow_item_icon
; values of X correspond to how the icon will end up drawn:
; 0x01 - normal bow with no arrows
; 0x02 - normal bow with arrows
; 0x03 - silver bow with no silver arrows
; 0x04 - silver bow with silver arrows
TXA : STA $7EF340
REP #$30
LDX $0202 : BEQ .no_equipped_item
TXY
LDA.l Menu_AddressIndex-1, X
AND.w #$00FF : TAX
LDA.l $7EF300, X : AND.w #$00FF
TYX
.no_bow
REP #$30
LDX $0202 : BEQ .no_equipped_item
LDA $7EF33F, X : AND.w #$00FF
CPX.w #$0004 : BNE .bombs_not_equipped
LDA.w #$0001
CPX.w #$0004 : BNE .bombs_not_equipped
LDA.w #$0001
.bombs_not_equipped
CPX.w #$0006 : BNE .bottle1_not_equipped
JMP .load_bottle_content
.bombs_not_equipped
.bottle1_not_equipped
CPX.w #$000C : BNE .bottle2_not_equipped
LDA.w #$0002 : JMP .load_bottle_content
CPX.w #$0006 : BNE .bottle1_not_equipped
LDA.w #$0000 : JMP .load_bottle_content
.bottle2_not_equipped
CPX.w #$0012 : BNE .bottle3_not_equipped
LDA.w #$0003 : JMP .load_bottle_content
.bottle1_not_equipped
.bottle3_not_equipped
CPX.w #$0018 : BNE .bottle_not_equipped
LDA.w #$0004
CPX.w #$000C : BNE .bottle2_not_equipped
LDA.w #$0001 : JMP .load_bottle_content
.load_bottle_content
TXY : TAX : LDA $7EF35B, X : AND.w #$00FF : TYX
.bottle2_not_equipped
.bottle_not_equipped
CPX.w #$000D : BNE .flute_not_equipped
LDA $030F
CPX.w #$0012 : BNE .bottle3_not_equipped
LDA.w #$0002 : JMP .load_bottle_content
.flute_not_equipped
CPX.w #$0003 : BNE .hookshot_not_equipped
LDA.w GoldstarOrHookshot : BEQ .hookshot_not_equipped
SEC : SBC.b #$01
.bottle3_not_equipped
.hookshot_not_equipped
CPX.w #$0018 : BNE .bottle_not_equipped
LDA.w #$0003
JSR HUD_DrawItem
.load_bottle_content
.no_equipped_item
TXY : TAX : LDA $7EF35C, X : AND.w #$00FF : TYX
.bottle_not_equipped
CPX.w #$000D : BNE .flute_not_equipped
LDA $030F
.flute_not_equipped
CPX.w #$0003 : BNE .hookshot_not_equipped
LDA.w GoldstarOrHookshot : BEQ .hookshot_not_equipped
SEC : SBC.b #$01
.hookshot_not_equipped
JSR HUD_DrawItem
.no_equipped_item
RTS
}
@@ -385,14 +393,14 @@ pushpc
org $0DFA93
HudItems:
{
; bows, boomerang, hookshot, bombs, powder, bottle1
dw $F629, $F651, $F669, $F679, $F689, $F751
; hammer, lamp, fire rod, ice rod, mirror, bottle2
dw $F701, $F6F1, $F6A1, $F6B1, $F7C9, $F751
; flute, book, somaria, byrna, feather, bottle3
dw $F859, $F741, $F799, $F7A9, $F731, $F751
; deku, zora, wolf, bunny, stone, bottle4
dw $F6E1, $F821, $F6D1, $F7B9, $F811, $F751
; bows, boomerang, hookshot, bombs, powder, bottle1
dw $F629, $F651, $F669, $F679, $F689, $F751
; hammer, lamp, fire rod, ice rod, mirror, bottle2
dw $F701, $F6F1, $F6A1, $F6B1, $F7C1, $F751
; flute, book, somaria, byrna, feather, bottle3
dw $F859, $F741, $F799, $F7A9, $F729, $F751
; deku, zora, wolf, bunny, stone, bottle4
dw $F6E1, $F821, $F6D1, $F7B9, $F811, $F751
}
; F711
@@ -401,7 +409,7 @@ HudItems:
org $0DF629
dw $20F5, $20F5, $20F5, $20F5 ; No bow
dw $28BA, $28E9, $28E8, $28CB ; Empty bow
dw $28BA, $28BB, $24CA, $28CB ; Bow and arrows
dw $28BA, $28BB, $28CA, $28CB ; Bow and arrows
dw $28BA, $28E9, $28E8, $28CB ; Empty silvers bow
dw $28BA, $28BB, $24CA, $28CB ; Silver bow and arrows
@@ -546,10 +554,11 @@ FloorIndicator:
REP #$30
LDA $04A0 : AND.w #$00FF : BEQ .hide_indicator
INC A : CMP.w #$00C0 : BNE .dont_disable
; if the count up timer reaches 0x00BF frames
; disable the floor indicator during the next frame.
LDA.w #$0000
.dont_disable
; if the count up timer reaches 0x00BF frames
; disable the floor indicator during the next frame.
LDA.w #$0000
.dont_disable
STA $04A0
PHB : PHK : PLB
LDA.w #$251E : STA $7EC7F0

View File

@@ -7,7 +7,7 @@ Menu_Palette:
dw hexto555($f9f9f9)
dw hexto555($000000)
dw hexto555($000000) ; transparent
dw hexto555($d1a452)
dw hexto555($d0a050)
dw hexto555($f9f9f9)
dw hexto555($000000)
dw hexto555($000000) ; transparent

View File

@@ -4,32 +4,32 @@ Menu_CheckHScroll:
{
LDA.b $F4
BIT.b #$10 : BNE .leave_menu
LDA.b $F6
BIT.b #$20 : BNE .left
BIT.b #$10 : BNE .right
LDA.b $F6
BIT.b #$20 : BNE .left
BIT.b #$10 : BNE .right
RTS
RTS
.left
.left
REP #$20
LDA.w #$FFF8
BRA .merge
REP #$20
LDA.w #$FFF8
BRA .merge
.right
REP #$20
LDA.w #$0008
.right
REP #$20
LDA.w #$0008
.merge
STA.w MenuScrollHDirection
.merge
STA.w MenuScrollHDirection
SEP #$30
INC.w $0200
LDA.b #$06 : STA.w $012F
RTS
SEP #$30
INC.w $0200
LDA.b #$06 : STA.w $012F
RTS
.leave_menu
LDA.b #$08
STA.w $0200
.leave_menu
LDA.b #$0B : STA.w $0200
RTS
}

View File

@@ -32,8 +32,8 @@ Menu_AddressIndex:
db $7EF34C ; shovel 7EF34F
db $7EF34E ; Book
db $7EF350 ; Cane of Somaria
db $7EF351 ; Cane of Byrna
db $7EF350 ; Cane of Somaria / Cane of Byrna
db $7EF351 ; Fishing rod
db $7EF34D ; Roc's Feather
db $7EF35E ; Bottle 3
@@ -64,7 +64,7 @@ Menu_ItemCursorPositions:
dw menu_offset(12,2) ; shovel
dw menu_offset(12,5) ; feather
dw menu_offset(12,8) ; somaria
dw menu_offset(12,12) ; byrna
dw menu_offset(12,12) ; byrna / fishing rod
dw menu_offset(12,15) ; bunny hood
dw menu_offset(12,18) ; bottle3
@@ -167,24 +167,42 @@ Menu_InitItemScreen:
{
SEP #$30
LDY.w $0202 : BNE .all_good
; Loop through the SRM of each item to see if we have
; one of them so we can start with that one selected.
.lookForAlternateItem
LDY.b #$00
.loop
INY : CPY.b #$25 : BCS .bad
.loop
INY : CPY.b #$25 : BCS .bad
LDX.w Menu_AddressIndex-1, Y
LDA.l $7EF300, X
BEQ .loop
STY.w $0202
BRA .all_good
.bad
; If we made it here that means there are no items
; available but one was still selected. This should
; never happen under normal vanilla circumstances.
STZ.w $0202
STZ $0207
LDA.b #$04
STA.w $0200
RTS
.all_good
; Double check we still have the item that was selected.
; This is to prevent a bug where we can get stuck in an
; infinite loop later on.
LDX.w Menu_AddressIndex-1, Y
LDA.l $7EF300, X
BEQ .loop
STY.w $0202
BRA .all_good
.bad
STZ.w $0202
.all_good
STZ $0207
LDA.b #$04
STA.w $0200
RTS
CMP.b #$01 : BCC .lookForAlternateItem
STZ $0207
LDA.b #$04
STA.w $0200
RTS
}
; =========================================================
@@ -206,8 +224,8 @@ Menu_AddressLong:
db $4C ; shovel 4F
db $4E ; Book
db $50 ; Cane of Somaria
db $51 ; Cane of Byrna
db $50 ; Cane of Somaria / Cane of Byrna
db $51 ; Fishing Rod
db $4D ; Roc's Feather
db $5E ; Bottle 3
@@ -236,39 +254,36 @@ DoWeHaveThisItem_Override:
{
LDY $0202 : LDX.w Menu_AddressLong, Y
LDA.l $7EF33F, X : BNE .have_this_item
CLC
RTL
.have_this_item
CLC
RTL
.have_this_item
SEC
RTL
}
TryEquipNextItem_Override:
{
.keep_looking
JSR GotoNextItem_Local
.keep_looking
JSR GotoNextItem_Local
JSL DoWeHaveThisItem_Override : BCC .keep_looking
RTS
}
SearchForEquippedItem_Override:
{
SEP #$30
SEP #$30
LDY $0202 : LDX.w Menu_AddressLong-1, Y
LDA.l $7EF33F, X : CMP.b #$00 : BNE .item_available
LDY $0202 : LDX.w Menu_AddressLong-1, Y
LDA.l $7EF33F, X : CMP.b #$00 : BNE .item_available
; In this case we have no equippable items
STZ $0202 : STZ $0203 : STZ $0204
.we_have_that_item
.we_have_that_item
RTL
.item_available
; Is there an item currently equipped (in the HUD slot)?
LDA $0202
BNE .alreadyEquipped
; Is there an item currently equipped (in the HUD slot)?
LDA $0202 : BNE .alreadyEquipped
; If not, set the equipped item to the Bow and Arrow
; (even if we don't actually have it)
LDA.b #$01 : STA $0202
@@ -279,11 +294,12 @@ SearchForEquippedItem_Override:
; We're done if we have that item
.keep_looking
JSR GotoNextItem_Local
JSL DoWeHaveThisItem_Override : BCC .keep_looking
BCS .we_have_that_item
JSL DoWeHaveThisItem_Override : BCC .keep_looking
BCS .we_have_that_item
JMP TryEquipNextItem_Override
JMP TryEquipNextItem_Override
}
pushpc
org $0DDEB0
@@ -303,4 +319,6 @@ SearchForEquippedItem:
}
warnpc $0DE3C7
; =========================================================
pullpc

View File

@@ -99,6 +99,7 @@ Menu_ItemNames:
dw "__STONE_MASK__ "
dw "____BOTTLE____ "
Menu_MushroomLabel:
Menu_BottleItems:
dw "___MUSHROOM___ "
dw "_EMPTY_BOTTLE_ "
@@ -119,86 +120,116 @@ Menu_SongNames:
Menu_DrawItemName:
{
SEP #$30
; Double check that we have the item.
LDY.w $0202
LDX.w Menu_AddressIndex-1, Y
LDA.l $7EF300, X
CMP.b #$01 : BCS .haveItem
REP #$30
RTS
.haveItem
LDA.w $0202 : CMP.b #$03 : BEQ .goldstar
LDA.w $0202 : CMP.b #$0D : BEQ .ocarina
CMP.b #$05 : BEQ .mushroom
CMP.b #$0D : BEQ .ocarina
; Check if it's a bottle
LDA.w $0202 : CMP.b #$06 : BEQ .bottle_1
LDA.w $0202 : CMP.b #$0C : BEQ .bottle_2
LDA.w $0202 : CMP.b #$12 : BEQ .bottle_3
LDA.w $0202 : CMP.b #$18 : BEQ .bottle_4
CMP.b #$06 : BEQ .bottle_1
CMP.b #$0C : BEQ .bottle_2
CMP.b #$12 : BEQ .bottle_3
CMP.b #$18 : BEQ .bottle_4
.draw_item
REP #$30
LDA.w $0202 : BEQ .no_items
DEC : ASL #5 : TAX
LDY.w #$000
.draw_item
REP #$30
LDA.w $0202 : BEQ .no_items
DEC : ASL #5 : TAX
LDY.w #$000
.loop
LDA.w Menu_ItemNames, X ; Load your text character
STA.w $1692, Y ; <- into the buffer
INX : INX
INY : INY : CPY #$001C : BCC .loop
.no_items
RTS
.loop
LDA.w Menu_ItemNames, X ; Load your text character
STA.w $1692, Y ; <- into the buffer
INX : INX
INY : INY : CPY #$001C : BCC .loop
.no_items
RTS
; Draw Bottle Description
.bottle_1
REP #$30 : LDX #$0000 : JMP .draw_bottle
.bottle_2
REP #$30 : LDX #$0001 : JMP .draw_bottle
.bottle_3
REP #$30 : LDX #$0002 : JMP .draw_bottle
.bottle_4
REP #$30 : LDX #$0003
.draw_bottle
JSR DrawBottleNames
RTS
; Draw Bottle Description
.bottle_1
REP #$30 : LDX #$0000 : JMP .draw_bottle
.bottle_2
REP #$30 : LDX #$0001 : JMP .draw_bottle
.bottle_3
REP #$30 : LDX #$0002 : JMP .draw_bottle
.bottle_4
REP #$30 : LDX #$0003
.goldstar
LDA GoldstarOrHookshot : CMP.b #$02 : BNE .draw_item
JSR MaybeDrawGoldstarName
RTS
.draw_bottle
JSR DrawBottleNames
RTS
.ocarina
REP #$30
.goldstar
LDA GoldstarOrHookshot : CMP.b #$02 : BNE .draw_item
JSR DrawGoldstarName
RTS
; Check the timer and see if we should draw the item name
LDA $1A : AND.w #$00FF : CMP #$0080 : BCC .draw_item
.mushroom
LDA.l $7EF344 : CMP.b #$02 : BCS .draw_item
JSR DrawMushroomName
RTS
.ocarina
REP #$30
; Check the timer and see if we should draw the item name
LDA $1A : AND.w #$00FF : CMP #$0080 : BCC .draw_item
LDA $030F : BEQ .draw_item
LDA $030F : AND.w #$00FF : DEC : ASL #5 : TAX
LDY.w #$0000
.draw_ocarina_loop
LDA.w Menu_SongNames, X : STA.w $1692, Y
.draw_ocarina_loop
LDA.w Menu_SongNames, X : STA.w $1692, Y
INX #2 : INY #2 : CPY #$001C : BCC .draw_ocarina_loop
RTS
}
DrawBottleNames:
{
LDA.l $7EF35C, X : AND.w #$00FF
DEC : ASL #5 : TAX
LDY.w #$0000
.draw_bottle_loop
LDA.w Menu_BottleItems, X : STA.w $1692, Y
INX #2 : INY #2
.draw_bottle_loop
LDA.w Menu_BottleItems, X : STA.w $1692, Y
INX #2 : INY #2
CPY #$001C : BCC .draw_bottle_loop
RTS
}
MaybeDrawGoldstarName:
DrawGoldstarName:
{
REP #$30
LDX.w #$0000
LDY.w #$0000
.draw_goldstar_loop
LDA.w Menu_GoldstarLabel, X
.draw_goldstar_loop
LDA.w Menu_GoldstarLabel, X
STA.w $1692, X : INX #2 : INY #2 : CPY #$001C : BCC .draw_goldstar_loop
RTS
}
DrawMushroomName:
{
REP #$30
LDX.w #$0000
LDY.w #$0000
.draw_mushroom_loop
LDA.w Menu_MushroomLabel, X
STA.w $1692, X : INX #2 : INY #2 : CPY #$001C : BCC .draw_mushroom_loop
RTS
}
; =========================================================
DrawLocationName:

View File

@@ -128,7 +128,7 @@ namespace Oracle
; -------------------------------------------------------
incsrc "Util/all_items.asm"
incsrc "Dungeons/house_walls.asm"
;incsrc "Dungeons/house_walls.asm"
print ""
print "Finished applying patches"

View File

@@ -17,143 +17,161 @@ org $068361
JSL HUD_ClockDisplay ; $1CFF30
;originally JSL $09B06E, executed every frame
; =========================================================
; org $1CFF30
org $328000 ; Free space
HUD_ClockDisplay:
{
JSR RunClock
JSR DrawToHud
JSR DrawClockToHud
JSL $09B06E ; Restore Garnish_ExecuteUpperSlots_long
RTL
}
DrawToHud:
DrawClockToHudLong:
{
JSR DrawClockToHud
RTL
}
DrawClockToHud:
{
LDX #$00
.debut
LDY #$00 : LDA $7EE000,x
.debut2
CMP #$0A : BMI .draw
SBC #$0A : INY : BRA .debut2
.debut
LDY #$00 : LDA $7EE000,x
.draw
ADC #$90 : CPX #$01 : BEQ .minutes_low
STA.l !hud_hours_low
LDA #$30 : STA.l !hud_hours_low+1 ; white palette
BRA .continue_draw ; 04
.debut2
CMP #$0A : BMI .draw
SBC #$0A : INY : BRA .debut2
.minutes_low
STA.l !hud_min_low
LDA #$30 : STA.l !hud_min_low+1 ; white palette
.continue_draw
TYA
CLC : ADC #$90 : CPX #$01
BEQ .minutes_high
STA.l !hud_hours_high
LDA #$30 : STA.l !hud_hours_high+1 ; white palette
BRA .finish_draw ; 04
.draw
.minutes_high
STA.l !hud_min_high
LDA #$30 : STA.l !hud_min_high+1 ; white palette
.finish_draw
ADC #$90 : CPX #$01 : BEQ .minutes_low
STA.l !hud_hours_low
LDA #$30 : STA.l !hud_hours_low+1 ; white palette
BRA .continue_draw ; 04
.minutes_low
STA.l !hud_min_low
LDA #$30 : STA.l !hud_min_low+1 ; white palette
.continue_draw
TYA
CLC : ADC #$90 : CPX #$01 : BEQ .minutes_high
STA.l !hud_hours_high
LDA #$30 : STA.l !hud_hours_high+1 ; white palette
BRA .finish_draw ; 04
.minutes_high
STA.l !hud_min_high
LDA #$30 : STA.l !hud_min_high+1 ; white palette
.finish_draw
INX : CPX #$02 : BMI .debut
RTS
}
;--------------------------------
; =========================================================
RunClock:
{
LDA $10 ;checks current event in game
CMP #$07 ;dungeon/building?
BEQ .counter_increasing
CMP #$09 ;overworld?
BEQ .overworld
CMP #$0B
BEQ .overworld ;sub-area ? (under the bridge; zora domain...)
CMP #$0E ;dialog box?
BEQ .dialog
RTS
LDA $10 ;checks current event in game
CMP #$07 : BEQ .counter_increasing ;dungeon/building?
CMP #$09 : BEQ .overworld ;overworld?
CMP #$0B : BEQ .overworld ;sub-area ? (under the bridge; zora domain...)
CMP #$0E : BEQ .dialog ;dialog box?
RTS
.overworld
LDA $11
CMP #$23 ;hdma transfer? (warping)
BNE .mosaic
.mosaic
CMP #$0D ;mosaic ?
BMI .counter_increasing
RTS
.overworld
.dialog
LDA $11 ;which kind of dialog? (to prevent the counter from increasing if save menu or item menu openned)
CMP #$02 ;NPC/signs speech
BEQ .counter_increasing
RTS
LDA $11 : CMP #$23 : BNE .mosaic ;hdma transfer? (warping)
; Lol what?
.mosaic
CMP #$0D : BMI .counter_increasing ;mosaic ?
RTS
.dialog
LDA $11 ;which kind of dialog? (to prevent the counter from increasing if save menu or item menu openned)
CMP #$02 : BEQ .counter_increasing ;NPC/signs speech
RTS
.counter_increasing
; time speed (1,3,5,7,F,1F,3F,7F,FF)
; #$3F is almost 1 sec = 1 game minute
LDA $1A : AND #$3F ; 05
BEQ .increase_minutes
.end
; time speed (1,3,5,7,F,1F,3F,7F,FF)
; #$3F is almost 1 sec = 1 game minute
LDA $1A : AND #$3F : BEQ .increase_minutes ; 05
.end
RTS
.increase_minutes
LDA $7EE001 : INC A : STA $7EE001
CMP #$3C : BPL .increase_hours ; minutes = #60 ?
LDA $7EE001 : INC A : STA $7EE001
CMP #$3C : BPL .increase_hours ; minutes = #60 ?
RTS
.increase_hours
LDA #$00 : STA $7EE001
LDA $7EE000 : INC A : STA $7EE000
CMP #$18 ; hours = #24 ?
BPL .reset_hours
LDA #$00 : STA $7EE001
LDA $7EE000 : INC A : STA $7EE000
CMP #$18 : BPL .reset_hours ; hours = #24 ?
;check indoors/outdoors
LDA $1B : BEQ .outdoors0
RTS
RTS
.outdoors0
JSL rom_to_buff ;update buffer palette
JSL buff_to_eff ;update effective palette
.outdoors0
JSL rom_to_buff ;update buffer palette
JSL buff_to_eff ;update effective palette
;rain layer ?
LDA $8C : CMP #$9F : BEQ .skip_bg_updt0
LDA $8C : CMP #$9E : BEQ .skip_bg_updt0 ; canopy layer ?
CMP #$97 : BEQ .skip_bg_updt0 ; fog layer?
JSL $0BFE70 ;update background color
BRA .inc_hours_end
LDA $8C : CMP #$9E : BEQ .skip_bg_updt0 ; canopy layer ?
CMP #$97 : BEQ .skip_bg_updt0 ; fog layer?
JSL $0BFE70 ;update background color
BRA .inc_hours_end
.skip_bg_updt0 ;prevent the sub layer from disappearing ($1D zeroed)
.skip_bg_updt0 ;prevent the sub layer from disappearing ($1D zeroed)
JSL $0BFE72
.inc_hours_end
.inc_hours_end
RTS
.reset_hours
LDA #$00 : STA $7EE000
;check indoors/outdoors
LDA $1B : BEQ .outdoors1
LDA #$00 : STA $7EE000
;check indoors/outdoors
LDA $1B : BEQ .outdoors1
RTS
.outdoors1
JSL rom_to_buff
JSL buff_to_eff
LDA $8C : CMP #$9F ;rain layer ?
BEQ .skip_bg_updt1
JSL rom_to_buff
JSL buff_to_eff
LDA $8C : CMP #$9F : BEQ .skip_bg_updt1 ;rain layer ?
LDA $8C : CMP #$9E : BEQ .skip_bg_updt1 ; canopy layer ?
JSL $0BFE70 ;update background color
BRA .reset_end
JSL $0BFE70 ;update background color
BRA .reset_end
.skip_bg_updt1 ;prevent the sub layer from disappearing ($1D zeroed)
JSL $0BFE72
.skip_bg_updt1 ;prevent the sub layer from disappearing ($1D zeroed)
JSL $0BFE72
.reset_end
RTS
RTS
}
;-----------------------------------------------
; =========================================================
;----[ Day / Night system * palette effect ]----
;-----------------------------------------------
; =========================================================
!blue_value = $7EE010
!green_value = $7EE012
@@ -189,33 +207,36 @@ org $1BEF84
org $0EEE25 ; free space
LoadDayNightPaletteEffect:
{
STA.l !pal_color
STA.l !pal_color
CPX #$0041 : BPL .title_check
CPX #$0041 : BPL .title_check
STA $7EC300,X
RTL
.title_check
LDA $10 : AND #$00FF
CMP #$0002 ; title or file select screen ?
BPL .outin_check
; title or file select screen ?
LDA $10 : AND #$00FF : CMP #$0002 : BPL .outin_check
LDA.l !pal_color : STA $7EC300,X
RTL
.outin_check
LDA $1B : AND #$00FF : BEQ .outdoors2
LDA $1B : AND #$00FF : BEQ .outdoors2
LDA.l !pal_color
STA $7EC300,X
RTL
.outdoors2
PHX
JSL ColorSubEffect
PLX
STA.l $7EC300,X
RTL
PHX
JSL ColorSubEffect
PLX
STA.l $7EC300,X
RTL
}
;--------------------------------
; =========================================================
ColorSubEffect:
{
@@ -226,46 +247,40 @@ ColorSubEffect:
AND #$00FF
TAX
.do_blue
.do_blue
LDA.l !pal_color : AND #$7C00 : STA !blue_value
; substract amount to blue field based on a table
SEC : SBC.l blue_table, X : STA !temp_value
AND #$7C00 ; mask out everything except the blue bits
CMP !temp_value ; overflow ?
BEQ .no_blue_sign_change
CMP !temp_value : BEQ .no_blue_sign_change; overflow ?
.blue_sign_change
LDA #$0400 ; LDA smallest blue value
.blue_sign_change
LDA #$0400 ; LDA smallest blue value
.no_blue_sign_change
.no_blue_sign_change
STA.l !blue_value
do_green:
do_green:
LDA !pal_color : AND #$03E0 : STA !green_value
SEC : SBC.l green_table,x ; substract amount to blue field based on a table
STA.l !temp_value
; mask out everything except the green bits
AND #$03E0 : CMP !temp_value ; overflow ?
BEQ .no_green_sign_change
.green_sign_change
LDA #$0020 ; LDA smallest green value
AND #$03E0 : CMP !temp_value : BEQ .no_green_sign_change ; overflow ?
.green_sign_change
LDA #$0020 ; LDA smallest green value
.no_green_sign_change
.no_green_sign_change
STA.l !green_value
.do_red
.do_red
LDA.l !pal_color : AND #$001F : STA.l !red_value
SEC : SBC.l red_table,x ; substract amount to red field based on a table
STA.l !temp_value
AND #$001F ; mask out everything except the red bits
CMP !temp_value ; overflow ?
BEQ .no_red_sign_change
CMP !temp_value : BEQ .no_red_sign_change ; overflow ?
.red_sign_change
LDA #$0001 ; LDA smallest red value
.red_sign_change
LDA #$0001 ; LDA smallest red value
.no_red_sign_change
.no_red_sign_change
STA.l !red_value
LDA.l !blue_value
@@ -275,6 +290,8 @@ do_green:
RTL
}
; =========================================================
; color_sub_tables : 24 * 2 bytes each = 48 bytes (2 bytes = 1 color sub for each hour)
blue_table:
@@ -304,9 +321,9 @@ red_table:
BackgroundFix:
{
BEQ .no_effect ;BRAnch if A=#$0000 (transparent bg)
JSL ColorSubEffect
.no_effect:
JSL ColorSubEffect
.no_effect:
STA.l $7EC500
STA.l $7EC300
STA.l $7EC540
@@ -325,18 +342,15 @@ SubAreasFix:
rtl
}
GlovesFix:
{
STA.l !pal_color
LDA $1B
AND #$00FF
BEQ .outdoors3
LDA.l !pal_color
STA $7EC4FA
RTL
LDA $1B : AND #$00FF : BEQ .outdoors3
LDA.l !pal_color
STA $7EC4FA
RTL
.outdoors3:
.outdoors3:
PHX
JSL ColorSubEffect
PLX
@@ -346,22 +360,18 @@ GlovesFix:
CheckIfNight:
{
LDA $7EE000 : CMP.b #$06
BCC .night_time
LDA $7EE000 : CMP.b #$06 : BCC .night_time
.day_time
LDA.l $7EF3C5
.day_time
LDA.l $7EF3C5
RTL
.night_time
RTL
.night_time
LDA $7EE000 : CMP.b #$14
BCS .day_time
LDA.l $7EF3C5
CLC
ADC #$01
RTL
LDA $7EE000 : CMP.b #$14 : BCS .day_time
LDA.l $7EF3C5
CLC
ADC #$01
RTL
}
warnpc $0EF3F9 ; free space
@@ -402,7 +412,7 @@ org $2885F9
org $0ED601
JSL SubAreasFix
;--------------------------------
; =========================================================
; Gloves color loading routine
;$1B/EE1B C2 30 REP #$30
@@ -421,3 +431,5 @@ org $0ED601
org $1BEE2D
JSL GlovesFix
; =========================================================

View File

@@ -1,4 +1,4 @@
; ==============================
; =========================================================
; WRAM in Use
org $008000
base $7E0730 ; MAP16OVERFLOW free ram region
@@ -24,7 +24,7 @@ SomariaOrByrna: skip 1
base off
; ==============================
; =========================================================
; SRAM in Use
FishingRod = $7EF38A