X-Button-Secret of Parallel Worlds

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

X-Button-Secret of Parallel Worlds

Post by XaserLE on Fri 5 Jul 2013 - 7:59

Because i couldn't find any resources on this trick but needed it for tests in my modified Gates of Darkness ROM, i wrote an own asm code for that this morning :-).
Pressing X and R together causes the BG2 (ZSNES, MathOnNapkins calls this BG1 in his Doc's) to disappear. Releasing the buttons enables BG2 (BG1). I made sure that it only works in dungeons. The normal function of the X button (view map) is disabled.

Here we go:


;this is for making BG2 disappear when pressing X and R together (parallel worlds x button secret), i use bank 0x3F for the whole code
;WRITTEN: by XaserLE
;THANKS TO: -MathOnNapkins' Zelda Doc's
; -wiiqwertyuiop for his Zelda Disassembly

; Layer Flags: xxxsabcd (i count BG from 1 to 4 - MathOnNapkins RAM-Map counts from 0 to 3)
; s - Sprite layer enabled
; a - (BG4 enabled)??
; b - BG3 enabled
; c - BG2 enabled
; d - (BG1 enabled)??


;header
lorom

ORG $0288FD ; go to the code that branches behin the dungeon map load if player didn't press X
BRA $1C ; make it always branch, so map isn't loaded anymore

ORG $068365 ; go to a originally JSL that is executed every frame
JSL $3FA600 ; overwrite it (originally JSL $099F91)

ORG $03FA600 ; go to expanded space to write our routine

LDA $1B ; load data that tells us whether we are in a building or not
AND #$01 ; are we in a building?
BEQ $12 ; if not, don't use the x-button-secret
LDA $F2 ; load unfiltered joypad 1 register (AXLR|????)
CMP #$50 ; X and R buttons pressed?
BNE $06 ; if not, go to enable BG2
LDA $1C ; load layer flags
AND #$FD ; disable BG2 (0xFD = 11111101)
BRA $04 ; go to store layer flags
LDA $1C ; load layer flags
ORA #$02 ; enable BG2 (0x02 = 00000010)
STA $1C ; store layer flags

JSL $099F91 ; at first execute original code

RTL

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Fri 5 Jul 2013 - 8:44

This is very well made. Z3 really needs the ASM people. PS Did you know, that Parallel Worlds also has a second X button secret. While X+R disables BG2 (I don't know why MoN would call this BG1), since the PW secret rooms have the effect BG2 on top, so obviously BG2 needs to be disabled.
 
But the X+L disables BG1 (also in dungeons only) to be able to see under indoor bridges for secrets.
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Fri 5 Jul 2013 - 17:23

Yeah i knew. There is a funny story about that. Because in normal dungeons, nothing happens, when you press X+R, but something happens if you press X+L, i thought, X+L is the secret combination for a long time. And in rooms that make use of BG2, i used X+L and the only thing i saw was the object on BG2 that i can walk through. But it didn't look well, so i was a little disappointed. Making the Hard Optional Puzzle and getting the second mushroom in PW was really hard that way. And then i saw a Let's Play from someone who had the same problem. He played PW normal, than the second quest, all the time without realizing, that he is pressing the wrong buttons :-D. In the last two parts he said: "Possibly i have a corrupted ROM, the BG2 should disappear, not BG1" :-D :-D
It needed a while till i noticed that X+R is the right combination.

MathOnNapkins only calls it BG1 because he counts from 0-3, not 1-4 like ZNES.
I can implement the X+L secret too, if this is wanted :-)

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Fri 5 Jul 2013 - 17:30

If only this could somehow be implemented after obtaining a certain item. I don't know if you can add this to the code (like check for mirror, for instance). Then we would have a new item in the game, the Lens of truth (replaces mirror). The ability to warp in the overworld can be turned off. Using the lens would still warp to the beginning of the dungeon (normal as mirror), but now you could also see hidden objects with X+R (or/and X+L).
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Fri 5 Jul 2013 - 18:58

This should be no problem. I am sure the slot for mirror is documented in MathOnNapkins RAM map and with this, it's only an LDA $MirrorSlot, CMP #$01, BNE $xx.
I take a look at this and reply if found it.

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Fri 5 Jul 2013 - 19:10

Possibly, but therefore i need the slot that holds the actual item and the problem is, which items should be changed? Maybe save the last used item and toggle these two, but this were a lot more complicated i think.

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Fri 5 Jul 2013 - 19:27

Long time i didn't mention that in PW all rooms have bg2 on top. I created a room in Gates of Darkness with this feature and that was quite hard. So it would be easier to make a synthesis between the asm and editing. The asm should contain in which rooms it work. This prevents graphical mistakes.

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Euclid on Fri 5 Jul 2013 - 21:56

Item being currently assigned to Y is held in $202, so I'd increment that value to the next available item. You might be able to use the same code as the game does when you use the last bomb (it automatically switches to the next item)

I believe in PW the code to do the X+L/R trick is around $0288FD, can't give any docs from PW since apparently it was too easy to document lol.
avatar
Euclid



Since : 2012-06-21

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Sat 6 Jul 2013 - 3:58

Thank you, really good advice, i will try this tomorrow :-).

"To easy to document" :-D

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Sat 6 Jul 2013 - 17:15

XaserLE wrote:This should be no problem. I am sure the slot for mirror is documented in MathOnNapkins RAM map and with this, it's only an LDA $MirrorSlot, CMP #$01, BNE $xx.
I take a look at this and reply if found it.
 
Sounds great, since I know, there were a lot of ideas of implementing the Lens of Truth. And the X+R actually makes it happen with no item. So with this edit, it would really look nice.

PS
I never thought it will actually display a bugged gfx, when used in a room, which was not meant to use this ability. To assign this feature to certain rooms only is probably much harder to do.
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Sun 7 Jul 2013 - 4:08

Oh no, to make it work in certain rooms is quite easy. The actual room you are is saved in a slot (like all other values of the game are), so there is only a little piece of code to paste and copy in the asm.

LDA $RoomSlot ;load actual room
CMP #$xx ;compare with room xx
BNE $.... ;go for next room test

and so on. If a room is equals one of them, you can exectute the code, otherwise return from the subroutine.

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Tue 9 Jul 2013 - 6:24

Decoded the asm into hex changes. The disabling of this layer (bg2) is actually usable to see under indoor bridges. So this actually eaquals to the PW X+L secret.
 
I was also trying to change the layer, that's been disabled to bg1, by altering the asm code, but with no luck. Vital orders.
BNE $06 ; if not, go to enable BG2
AND #$FD ; disable BG2 (0xFD = 11111101)
ORA #$02 ; enable BG2 (0x02 = 00000010)

if BNE is not 06, nothing works, while if AND is FC or FE, and ORA 01 or 03, it jut goes to a bug or no effect, rather to disable bg1.
bg1 should be 00000001, bg3 should be 00000100, but nothing worked.
---------------------------------
 
 
 
Disable bg2 with X+R
(can see under indoor bridges)
 
This eaquals to Parallel Worlds X+L secret.
 
 
maps are autodisabled indoors (no maps if X is pressed)
----------------------------------
 
108FD
F0 to 80
 
30366
91 9F 09 to 00 A6 3F
 
new code (rom must be expanded to 2MB)
1FA600
A5 1B 29 01 F0 12 A5 F2 C9 50 D0 06 A5 1C 29 FD 80 04 A5 1C 09 02 85 1C 22 91 9F 09 6B
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Tue 9 Jul 2013 - 10:00

Do you want the X+L secret? I could try to figure out which bits must be set.

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Tue 9 Jul 2013 - 10:25

The current code disables bg2, and I would just like to know how to disable the opposite, the bg1 (since then you can make some nice riddles, similar to PW secret rooms).
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Tue 9 Jul 2013 - 10:28

Ok i try to figure this out :-)

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Tue 9 Jul 2013 - 12:57

I am not sure, i get strange results with bg1, but all others work fine, can't explain this. It seems that the bg1 bit is reversed. 1 if disabled, 0 if enabled or so.

Try this code, by pressing X+R, bg2 is disappears. On X+L i toggle the last bit that should control bg1 and see what happens. Not sure if this is a problem of my special room where i tested it, maybe this works with normal rooms:


;this is for making BG2 disappear when pressing X and R together (parallel worlds x button secret), i use bank 0x3F for the whole code
;WRITTEN: by XaserLE
;THANKS TO: -MathOnNapkins' Zelda Doc's
; -wiiqwertyuiop for his Zelda Disassembly

; Layer Flags: xxxsabcd (i count BG from 1 to 4 - MathOnNapkins RAM-Map counts from 0 to 3)
; s - Sprite layer enabled
; a - BG4 enabled
; b - BG3 enabled
; c - BG2 enabled
; d - BG1 disabled


;header
lorom

ORG $0288FD ; go to the code that branches behind the dungeon map load if player didn't press X
BRA $1C ; make it always branch, so map isn't loaded anymore

ORG $068365 ; go to an originally JSL that is executed every frame
JSL $3FA600 ; overwrite it (originally JSL $099F91)

ORG $03FA600 ; go to expanded space to write our routine

LDA $1B ; load data that tells us whether we are in a building or not
AND #$01 ; are we in a building?
BEQ $24 ; if not, don't use the x-button-secret
;BG1 disable on pressing X+L
LDA $F2 ; load unfiltered joypad 1 register (AXLR|????)
CMP #$60 ; X and L buttons pressed?
BNE $06 ; if not, go to enable BG1
LDA $1C ; load layer flags
ORA #$01 ; disable BG1 (0x01 = 00000001)
BRA $04 ; go to store layer flags
LDA $1C ; load layer flags
AND #$FE ; enable BG1 (0xFE = 11111110)
STA $1C ; store layer flags
;BG2 disable on pressing X+R
LDA $F2 ; load unfiltered joypad 1 register (AXLR|????)
CMP #$50 ; X and R buttons pressed?
BNE $06 ; if not, go to enable BG2
LDA $1C ; load layer flags
AND #$FD ; disable BG2 (0xFD = 11111101)
BRA $04 ; go to store layer flags
LDA $1C ; load layer flags
ORA #$02 ; enable BG2 (0x02 = 00000010)
STA $1C ; store layer flags

JSL $099F91 ; at least execute original code

RTL

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Tue 9 Jul 2013 - 14:46

The X+L in this code actually makes a strange hybrid of the bg2 layer disableing, preserving some of the objects (but disableing sprites on bg2). I've also tried out other combinations, but bg1 is not responding. I guess we can just stick to bg2 disable then. I can also make puzzles with this, by hidding chests under bridges, or making a giant maze under the actual bg1 floor. So this feature is then needed to come through.
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Tue 9 Jul 2013 - 16:08

I keep trying to make it work on bg1. Really strange.

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Tue 9 Jul 2013 - 16:16

Meanwhile I was trying to add a Mirror to the original code. All works well indoors, but the bg2 is always disabled in the overword?

start of main code
LDA $1B ; load data that tells us whether we are in a building or not
AND #$01 ; are we in a building?
BEQ $12 ; if not, don't use the x-button-secret
LDA $F2 ; load unfiltered joypad 1 register (AXLR|????)
CMP #$50 ; X and R buttons pressed?
BNE $06 ; if not, go to enable BG2
LDA $7EF353 ; load ram mirror slot, added
CMP #$02 ; compare to value 02 (have mirror is 02, no mirror is 00), added
BNE $06 ; if not value 02, go to enable BG2, added
LDA $1C ; load layer flags
AND #$FD ; disable BG2 (0xFD = 11111101)
BRA $04 ; go to store layer flags
LDA $1C ; load layer flags
ORA #$02 ; enable BG2 (0x02 = 00000010)
STA $1C ; store layer flags

JSL $099F91 ; at first execute original code

RTL

avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Tue 9 Jul 2013 - 17:05

You need to increase the first BEQ $12 to BEQ $1A cause you've added 8 Bytes of code.

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Tue 9 Jul 2013 - 17:16

Thank you. It is now working Very Happy. My first wading into ASM has finally had a working result. I thought I need to increase the first branching from BNE 06 to 06+8 bytes. But the game blanked out.
 
Now I can implement the Lens of Truth Very Happy , and I can also change the item from mirror to a "static" item, such as Moonpearl for instance.


Last edited by Puzzledude on Tue 9 Jul 2013 - 17:21; edited 1 time in total
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Tue 9 Jul 2013 - 17:18

Glad to see this works for you :-)

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Wed 10 Jul 2013 - 7:41

I was just wandering about this.
 
LDA $F2 ; load unfiltered joypad 1 register (AXLR|????)
CMP #$50 ; X and R buttons pressed?
 
How does #$50 corespond to X+R? So how to make it L+R for instance, or only L, or only R, or only X.
 
 
EDIT
Found it by random. Razz 

CMP-buttons pressed
80-A (not recommended)
70-X+R+L
60-X+L
50-X+R
40-X
30-L+R
20-L
10-R
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by XaserLE on Wed 10 Jul 2013 - 10:20

Yeah, it is only bitwise. I should change this $50 to a binary digit so everyone can see what happens.
The register is:
AXLR|????
0101|0000 for example means that only A and L are pressed. In Hex this is 0x50.

XaserLE



Since : 2013-01-22

Back to top Go down

Re: X-Button-Secret of Parallel Worlds

Post by Puzzledude on Thu 11 Jul 2013 - 13:40

I've found out what the deal is with bg1. It is actually one of the Fx values. But this only works normally in rooms with the BG2= On top effect, while it destroys the rooms with the effect BG2=Normal (without pressing anything).
 
Euclid probably knew this and made those special secrets usually in separated caves (otherwise can lead to transition bug), and in certain rooms only. For instance in Saria's gardens. Emulator feature disables bg1 (brings bg2 to black blank) is Not eaqual if pressing X+R. While X+L is eaqual (partially) to emulator function disable bg2.
 
So only bg2, bg3 and bg5 (sprites) can be addressed normally (disabled the way they should be). Disableing bg1 is compatible only with rooms with On top effect.
 
I already have the Lens working, so don't need the bg1 feature, I just wanted to clear it out for everyone.
avatar
Puzzledude



Since : 2012-06-20

Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum