From 63e8d5687bf4323162837d5d2caa4ead3b567980 Mon Sep 17 00:00:00 2001 From: Kara Alexandra Date: Sat, 13 Dec 2025 21:22:14 -0600 Subject: [PATCH] Fix timer and add drop-to-ganon mode --- timer.asm | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/timer.asm b/timer.asm index b1b31ad..06dfa95 100644 --- a/timer.asm +++ b/timer.asm @@ -7,25 +7,25 @@ !FRAMES_PER_HOUR = 60*60*60 ;-------------------------------------------------------------------------------- macro DecIncr(value) - LDA.w : INC + LDA.l : INC CMP.w #$000A : !BLT ?noIncr - LDA.w +2 : INC : STA.w +2 + LDA.l +2 : INC : STA.l +2 LDA.w #$0000 ?noIncr: - STA.w + STA.l endmacro ;-------------------------------------------------------------------------------- macro Sub32(minuend,subtrahend,result) LDA.l !SUB.l ; perform subtraction on the LSBs - STA.w + STA.l LDA.l +2 ; do the same for the MSBs, with carry SBC.l +2 ; set according to the previous result - STA.w +2 + STA.l +2 endmacro ;-------------------------------------------------------------------------------- macro Blt32(value1,value2) - LDA.w +2 + LDA.l +2 CMP.l +2 !BLT ?done BNE ?done @@ -50,7 +50,7 @@ CalculateTimer: %Sub32(ChallengeTimer,NMIFrames,ClockBuffer) ++ - %Blt32(ClockBuffer,.halfCycle) : !BLT + + %Blt32(ClockBuffer,.halfCycle) : !BGE +++ : JMP + : +++ LDA.l TimeoutBehavior : AND.w #$00FF : BNE ++ ; DNF LDA.w #$0002 : STA.l ClockStatus ; Set DNF Mode LDA.l NMIFrames : STA.l ChallengeTimer @@ -66,6 +66,17 @@ CalculateTimer: LDA.l NMIFrames : STA.l ChallengeTimer LDA.l NMIFrames+2 : STA.l ChallengeTimer+2 RTS + ++ CMP.w #$0004 : BNE ++ ; Drop Into Ganon + LDA.w $048E + BEQ .already_ganon + LDA.w #$0002 : STA.l ClockStatus ; Set DNF Mode + LDA.w #$0011 : STA.b GameMode + SEP #$20 + LDA.b #$7B + STA.w $010E + REP #$20 + .already_ganon + RTS ++ ; End Game SEP #$30 JSL ActivateGoal @@ -133,6 +144,13 @@ DrawChallengeTimer: LDA.w #$247F : STA.l HUDTileMapBuffer+$98 STA.l HUDTileMapBuffer+$9A BRA +++ + ++ CMP.w #$0004 : BNE ++ ; Ganon + LDA.w #$247F : STA.l HUDTileMapBuffer+$92 + STA.l HUDTileMapBuffer+$94 + STA.l HUDTileMapBuffer+$96 + STA.l HUDTileMapBuffer+$98 + STA.l HUDTileMapBuffer+$9A + BRA +++ ++ ; OHKO LDA.w #$280A : STA.l HUDTileMapBuffer+$94 LDA.w #$280B : STA.l HUDTileMapBuffer+$96