From 6fe0418dc0987aae070532814c3bd544df2276c6 Mon Sep 17 00:00:00 2001 From: jeboo Date: Fri, 20 Mar 2026 11:25:31 -0400 Subject: [PATCH 1/2] shield HW math from potential IRQ corruption --- patches/ips/credits.ips | Bin 11621 -> 11626 bytes patches/ips/disableable_etanks.ips | Bin 1036 -> 1038 bytes patches/ips/horizontal_door_fix.ips | Bin 41 -> 43 bytes patches/src/credits.asm | 5 +++++ patches/src/disableable_etanks.asm | 2 ++ patches/src/horizontal_door_fix.asm | 8 +++++--- 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/patches/ips/credits.ips b/patches/ips/credits.ips index b76371a7257cf1d3e1ef9e01b54cd9a4592d746e..bf7ae15dfc46514855e7ae56275bb8e6d86abe45 100644 GIT binary patch delta 266 zcmaDF^(tz@E5_!HuP-Voc2wNz{!(ARdi8RNR~$eDaw zStb6>wfjp&7NsyK+`6`2%!#2@X1$0LgObIy`zKB;l>yO9#TMBhWM^2s6k}L{t_Eb@ zt*E6Utx8M9S`}6bes5J-xstI}O`&gctcovV#pG2gnmlYkvxGn<0##4Gry|Fpe*OMT z6NdfnlUY=?lwcg7SP8>1DUe&ZRvnf4Ag~`KV+K+dplYpr>Dqpl2lsccST3P-{_6eN VJ}|!0{VQPJ37-j@*Qsu22LP`Ud|Lnj delta 285 zcmaDA^)zb2E5^EwuP-XeH{a_1QeVG%^>T?;v1by`B!INY1@@(47noQ7%2vpnd{dvbz`@8oqVnud%(gM>iF0hRW%I59j@Seeq#=EUHU z;gNAj0c0N6s-sdL1okUkzdzH2VZYO4PE{=>7zZd;!f;Fq)*05-;hEC2ui diff --git a/patches/ips/disableable_etanks.ips b/patches/ips/disableable_etanks.ips index dfa0f2c29d0a92eb52e2772ddf7f3a31b2a94bd0..72b6f5de8b004eecc960d68a4032ce095e4111d1 100644 GIT binary patch delta 85 zcmeC-=;N4B#3(YcIEL~6#0!*!+V@gb@I#03a;@ delta 82 zcmeC<=;4@9#3(eeIEL}>#0!*-2f+Q4^aRB literal 41 xcmWG=3~}~gV(DODR+#XWiRA$Uv(MD8Or;YTcq)3CoDw2_Rju}U+~Vr*1^@&44kiEq diff --git a/patches/src/credits.asm b/patches/src/credits.asm index e56c7c42a3..dd5c5b027e 100644 --- a/patches/src/credits.asm +++ b/patches/src/credits.asm @@ -208,6 +208,7 @@ assert pc() <= !bank_8b_free_space_end org !bank_df_free_space_start ;; Draw full time as HH:mm:ss.hh draw_full_time: + sei ; disable interrupts phx phb pea $7f7f : plb : plb @@ -222,6 +223,7 @@ draw_full_time: bne .non_zero plb plx + cli ; enable interrupts rtl .non_zero: jsr adjust_time_fps @@ -279,6 +281,7 @@ draw_full_time: plb plx + cli ; enable interrupts rtl adjust_time_fps: @@ -378,6 +381,7 @@ inner_loop: ;; Draw 5-digit value to credits tilemap ;; A = number to draw, Y = row address draw_value: + sei ; disable interrupts phx phb pea $7f7f : plb : plb @@ -397,6 +401,7 @@ draw_value: .end: plb plx + cli ; enable interrupts rtl draw_three: diff --git a/patches/src/disableable_etanks.asm b/patches/src/disableable_etanks.asm index 0b7c548148..0ed12524e1 100644 --- a/patches/src/disableable_etanks.asm +++ b/patches/src/disableable_etanks.asm @@ -443,6 +443,7 @@ org !bank_83_free_space_start etank_do_some_math: php + sei ; disable interrupts rep #$30 lda $0755 @@ -485,6 +486,7 @@ etank_do_some_math: lda $809CCE,X ; There's a nice table here of E-Tank tile offsets that are convenient for our purposes sta !etank_hud_tile_offset + cli ; enable interrupts plp rtl diff --git a/patches/src/horizontal_door_fix.asm b/patches/src/horizontal_door_fix.asm index 12b814ab85..bb8ef046c2 100644 --- a/patches/src/horizontal_door_fix.asm +++ b/patches/src/horizontal_door_fix.asm @@ -14,22 +14,24 @@ lorom !bank_84_free_space_end = $84f5a0 org $848488 - jsr clr_ints + jmp clr_ints +clr_ret: org $8484e0 jmp set_ints +set_ret: org !bank_84_free_space_start clr_ints: sei ; disable IRQ sta $4202 ; replaced code - rts + jmp clr_ret set_ints: cli ; enable IRQ plx ; replaced code ply plb - jmp $84e3 + jmp set_ret warnpc !bank_84_free_space_end From dfb1449c845dbc9688d2a65ca30296a6f8978106 Mon Sep 17 00:00:00 2001 From: jeboo Date: Fri, 20 Mar 2026 20:01:43 -0400 Subject: [PATCH 2/2] remove unnecessary credits fix --- patches/ips/credits.ips | Bin 11626 -> 11621 bytes patches/src/credits.asm | 5 ----- 2 files changed, 5 deletions(-) diff --git a/patches/ips/credits.ips b/patches/ips/credits.ips index bf7ae15dfc46514855e7ae56275bb8e6d86abe45..b76371a7257cf1d3e1ef9e01b54cd9a4592d746e 100644 GIT binary patch delta 285 zcmaDA^)zb2E5^EwuP-XeH{a_1QeVG%^>T?;v1by`B!INY1@@(47noQ7%2vpnd{dvbz`@8oqVnud%(gM>iF0hRW%I59j@Seeq#=EUHU z;gNAj0c0N6s-sdL1okUkzdzH2VZYO4PE{=>7zZd;!f;Fq)*05-;hEC2ui delta 266 zcmaDF^(tz@E5_!HuP-Voc2wNz{!(ARdi8RNR~$eDaw zStb6>wfjp&7NsyK+`6`2%!#2@X1$0LgObIy`zKB;l>yO9#TMBhWM^2s6k}L{t_Eb@ zt*E6Utx8M9S`}6bes5J-xstI}O`&gctcovV#pG2gnmlYkvxGn<0##4Gry|Fpe*OMT z6NdfnlUY=?lwcg7SP8>1DUe&ZRvnf4Ag~`KV+K+dplYpr>Dqpl2lsccST3P-{_6eN VJ}|!0{VQPJ37-j@*Qsu22LP`Ud|Lnj diff --git a/patches/src/credits.asm b/patches/src/credits.asm index dd5c5b027e..e56c7c42a3 100644 --- a/patches/src/credits.asm +++ b/patches/src/credits.asm @@ -208,7 +208,6 @@ assert pc() <= !bank_8b_free_space_end org !bank_df_free_space_start ;; Draw full time as HH:mm:ss.hh draw_full_time: - sei ; disable interrupts phx phb pea $7f7f : plb : plb @@ -223,7 +222,6 @@ draw_full_time: bne .non_zero plb plx - cli ; enable interrupts rtl .non_zero: jsr adjust_time_fps @@ -281,7 +279,6 @@ draw_full_time: plb plx - cli ; enable interrupts rtl adjust_time_fps: @@ -381,7 +378,6 @@ inner_loop: ;; Draw 5-digit value to credits tilemap ;; A = number to draw, Y = row address draw_value: - sei ; disable interrupts phx phb pea $7f7f : plb : plb @@ -401,7 +397,6 @@ draw_value: .end: plb plx - cli ; enable interrupts rtl draw_three: