Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added patches/ips/door_irq_fix.ips
Binary file not shown.
Binary file modified patches/ips/escape.ips
Binary file not shown.
84 changes: 84 additions & 0 deletions patches/src/door_irq_fix.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
;;; $83D7: Spawn hard-coded PLM ;;;
; certain maprando conditions can cause the hw door math to be interrupted by IRQ.
; this code wraps the doormath section with a disable irq.

lorom

org $8483d7
phb
phy
phx
phk
plb
ldy #$004e
loop:
lda $1c37,y
beq found
dey
dey
bpl loop
lda $06,s
clc
adc #$0004
sta $06,s
sec
bra finished
found:
sep #$20
lda $08,s
pha
plb
tyx
ldy #$0002
sei
lda ($06,s),y
sta $4202
lda $07a5
sta $4203
ldy #$0001
lda ($06,s),y
rep #$20
and #$00FF
clc
adc $4216
asl a
cli
sta $1c87,x
ldy #$0003
lda ($06,s),y
txy
tax
lda $06,s
clc
adc #$0004
sta $06,s
phk
plb
txa
sta $1c37,y
tyx
tay
lda #$0000
sta $1dc7,x
sta $7edf0c,x
lda #$8469
sta $1cd7,x
lda $0002,y
sta $1d27,x
lda #$0001
sta $7ede1c,x
lda #$8da0
sta $7ede6c,x
stz $1d77,x
stx $1c27
tyx
ldy $1c27
jsr ($0000,x)
clc
finished:
plx
ply
plb
rtl

assert pc() <= $848469
2 changes: 2 additions & 0 deletions patches/src/escape.asm
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ org !bank_84_free_space_start
PLB ;/
TYX ;\
LDY #$0002 ;|
sei ; (Disable interrupts)
LDA ($06,s),y ;|
STA $4202 ;|
LDA $07A5 ;|
Expand All @@ -585,6 +586,7 @@ org !bank_84_free_space_start
CLC ;|
ADC $4216 ;|
ASL A ;|
cli ; (Enable interrupts)
STA $1C87,x ;/

LDY #$0005 ;
Expand Down
1 change: 1 addition & 0 deletions rust/maprando/src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ impl Patcher<'_> {
"transition_reveal",
"wall_doors",
"self_check",
"door_irq_fix",
];

if self.settings.other_settings.ultra_low_qol {
Expand Down
Loading