Parallel Worlds buggy staircases
Zeldix :: Zelda III Hacking :: Requests
Page 2 of 2
Page 2 of 2 • 1, 2
Re: Parallel Worlds buggy staircases
Ok, so here's a much cleaner and somewhat labeled disassembly of the relevant code path. Still digging through it, but if anybody else can help me make heads or tails of what it's trying to do (i.e. why it's trying to reset $212c to a hardcoded value), that would be quite helpful. If not, I'll keep plugging away at it. Basically, I need to figure out if there are any conditions where the sty $1C *should* get executed, so I can add in a conditional branch instead of just nop-ing it out entirely.
- Code:
seek($248000)
jsr check_module
jsl $89B06E
rtl
seek($248008)
check_module:
lda $10
cmp #$07
beq ++
cmp #$09
beq check_submodule
cmp #$0B
beq check_submodule
cmp #$0E
beq +
rts
check_submodule:
lda $11
cmp #$23
nop; nop; // bne #$00
cmp #$0D
bmi ++
rts
+; lda $11
cmp #$02
beq +
rts
+; nop
jsr unk_sub_1
inc
sta $7EE003
cmp #$03
beq +
rts
+; lda #$00
sta $7EE003
lda $7EE002
inc
sta $7EE002
cmp #$3C
bpl +
rts
+; lda #$00
sta $7EE002
increase_minutes:
lda $7EE001
inc
sta $7EE001
cmp #$3C
bpl increase_hours
rts
increase_hours:
lda #$00
sta $7EE001
lda $7EE000
inc
sta $7EE000
cmp #$18
bpl reset_hours
jsr sub_19
bcc +
rts
+; nop
nop
nop
jsl $82FF70
lda $8C
cmp #$9F
beq +
jsl $8BFE72
bra ++
+; jsl $8BFE72
+; rts
reset_hours:
lda #$00
sta $7EE000
lda $1B
beq +
rts
+; jsl $82FF74
jsl $82FF70
lda $8C
cmp #$9F
beq +
jsl $8BFE70
bra ++
+; jsl $8BFE72
+; rts
seek($248310)
unk_sub_1:
jsr unk_sub_2
jsr lens_of_truth_on
jsl $82FF8C
sep #$30
rts
seek($248320)
unk_sub_2:
lda $7EF273
inc
sta $7EF273
cmp #$3C
beq +
rts
+; lda #$00
sta $7EF273
lda $7EF272
inc
sta $7EF272
cmp #$3C
bpl +
rts
+; lda #$00
sta $7EF272
lda $7EF271
inc
sta $7EF271
cmp #$3C
bpl +
rts
+; lda #$00
sta $7EF271
lda $7EF270
inc
sta $7EF270
cmp #$63
bpl +
rts
+; lda #$63
sta $7EF270
rts
seek($248371)
lens_of_truth_on:
lda $1B
bne + // Check if indoors
rts // If outdoors, return
+; lda $F2 // Check joypad 1
and #$70 // Mask XLR
cmp #$50 // Check for X+R but not L
bne + // If so, continue
lda #$16 // #$16 = 0b00010110
sta $1C // BG1 off, BG2 on
rts // Return
+; cmp #$60 // If not pressing X+R
beq + // Check for X+L but not R
jsr lens_of_truth_off // Not pressing X+L, lens off
rts // Return
+; lda #$15 // #$15 = 0b00010101
sta $1C // BG1 on, BG2 off
rts // Return
seek($248390)
lens_of_truth_off:
ldy #$16 // BG1 off
ldx $0414 // Check Layer 2 type
lda $02894C,x // ??
bpl + // ??
ldy #$17 // BG1, BG2 on
lda #$00 // Load #$00
+; cpx #$02 // Check Layer 2 type
bne + // If "Dark Room", then
lda #$03 // Load #$03
+; sty $1C // Set BG enable flags <==NOP this to fix stairs, but breaks LoT
rts
Last edited by qwertymodo on Sat 21 May 2016 - 4:02; edited 1 time in total
qwertymodo- Since : 2014-10-21
Re: Parallel Worlds buggy staircases
Ok, so the bug was with the Lens of Truth code. Here's my initial attempt at a fix. One potential issue, the original code seemed to be returning a value in A, depending on the BG2 type (#$03 if "Dark Room", otherwise #$00), however, the only code that actually calls the subroutine immediately overwrites A without caring what's in it, so I'm going to go ahead and assume that code was vestigial, and in order to fit my fix into the same code space without having to relocate things, I'm not bothering to set A. I need to test more, but I've confirmed that the stairs are fixed, and the Lens of Truth functions normally.
- Code:
// pw_lens_of_truth_fix.asm
seek($248371)
lda $1B
bne + // Check if indoors
rts // If outdoors, return
+; lda $F2 // Check joypad 1
and #$70 // Mask XLR
cmp #$50 // Check for X+R but not L
bne + // If so, continue
lda $1C // Load layer enable flags
and #$FE // Disable BG1
sta $1C // Update layer enable flags
rts // Return
+; cmp #$60 // If not pressing X+R
beq + // Check for X+L but not R
jsr lens_of_truth_off // Not pressing X+L, lens off
rts // Return
+; lda $1C // Load layer enable flags
and #$7D // Disable BG2
sta $1C // Update layer enable flags
rts // Return
lens_of_truth_off:
lda $1C // Load layer enable flags
ora #$02 // Enable BG2
tay
ldx $0414 // Check Layer 2 type
lda $02894C,x // ??
bpl + // ??
tya
ora #$01 // Enable BG1
bra ++
+; tya
+; sta $1C // Set BG enable flags
rts // Return
qwertymodo- Since : 2014-10-21
Re: Parallel Worlds buggy staircases
I was just thinking about this when you posted the MoN's disassembly, since the only additional code checking for BGs is the X+R trick to disable a layer to find Parallel-tower-keys.Ok, so the bug was with the Lens of Truth code.
Puzzledude- Since : 2012-06-20
Page 2 of 2 • 1, 2
Similar topics
» ALTTP - Goddess of Wisdom, Parallel Worlds, & Parallel Worlds Remodel MSU-1 Patches
» Parallel Worlds ~ some asm hacks
» Worse Than Parallel Worlds
» Parallel Worlds Menu
» Parallel Worlds boomerang fix
» Parallel Worlds ~ some asm hacks
» Worse Than Parallel Worlds
» Parallel Worlds Menu
» Parallel Worlds boomerang fix
Zeldix :: Zelda III Hacking :: Requests
Page 2 of 2
Permissions in this forum:
You cannot reply to topics in this forum