Cancel flute transport
Zeldix :: Zelda III Hacking :: Patches :: Items
Page 1 of 1
20140318
Cancel flute transport
Information: On the flute warp select map, after calling the bird, it will transport you with A, Y and X but you can cancel with B (and return to the place from which you called the bird).
Rom: native
Screenshot:
Ips Patch: http://bszelda.zeldalegends.net/stuff/Con/flute_fix.zip
Inside the zip is next to flute_fix.ips (which enables the cancelling) also a "yellow_B.ips". This will enable the unused flute-point 9 sprite to Link's position while blinking to indicate the B-button press to cancel. All you need to do is editing the gfx for flute-point 9 into a "B" (address $3c7c0 in ripped gfx in zcompress)
Code address:
main code at 02/6c20
Rom: native
Screenshot:
Ips Patch: http://bszelda.zeldalegends.net/stuff/Con/flute_fix.zip
Inside the zip is next to flute_fix.ips (which enables the cancelling) also a "yellow_B.ips". This will enable the unused flute-point 9 sprite to Link's position while blinking to indicate the B-button press to cancel. All you need to do is editing the gfx for flute-point 9 into a "B" (address $3c7c0 in ripped gfx in zcompress)
Code address:
main code at 02/6c20
Last edited by Conn on Fri 28 Nov 2014 - 19:26; edited 3 times in total
Conn- Since : 2013-06-30
Cancel flute transport :: Comments
Shouldn't be too hard to change the pertinent bytes - just need to compile a list of what byte values equal which button presses, and just swap the values for whatever you want.
I have no doubt it's a trivial modification of a bitmask, I'm just feeling really stupid right now because I can't figure it out in the whole 20 lines of code. It's been a long week...
- Code:
flute_cancel_1:
lda $7F5006
cmp #$01
beq +
jsl $02EC39
+; lda #$00
sta $7F5006
rtl
flute_cancel_2:
lda $F2
ora $F0
and #$C0
bne +
jml $0AB79D
+; inc $0200
cmp #$80
beq +
rtl
+; lda #$01
sta $7F5006
rtl
Seems pretty simple to me...said the asm noob. The cmp values appear to be the button presses, though I don't know which is which. I suspect cmp #$80 is 'b'...but couldn't you just NOP out flute cancel 1 or 2 and see what the effect is?
I think I understand it now, but my brain is too shot to write it. It's the lda $F2; ora $F0 that or's the state of A/B and X/Y, so to accept on A but cancel on B, I have to add the code to check them separately, it's not as simple as modifying a single bitmask.
try
flute_cancel_2:
lda $F2
ora $F0
and #$C0
bne +
jml $0AB79D
+; inc $0200
lda $F0 ;only Change, add this to check if (only) B-button was pressed
cmp #$80
beq +
rtl
+; lda #$01
sta $7F5006
rtl
flute_cancel_2:
lda $F2
ora $F0
and #$C0
bne +
jml $0AB79D
+; inc $0200
lda $F0 ;only Change, add this to check if (only) B-button was pressed
cmp #$80
beq +
rtl
+; lda #$01
sta $7F5006
rtl
Man, I was so close too... being so exhausted that it takes 4 hours to make sense of 20 instructions is awful
Thanks Conn
Thanks Conn
Well I admit understanding this code is advanced asm...
Joypad ram
$F0: B-button=80 ; y=40
$F2: A-Button=80 ; x=40
Then there are select ($F0=20), start ($F0=10), L, R, directions and such.
So first we Need to check whether F0 or F2 has a value
lda $F2
Then we Need to check whether $F0 was pressed so we make the OR function
ora $f0 (if you make a lda $f0 you'd lose the $f2 value)
To understand the And $c0 you Need to get into bin (actually also to underand the OR function above):
a Byte has 8 bits; each bit can have the value 0 or 1. It depends on which bit is set to have the final hex value
bit0: 1 -> 01
bit1: 1 -> 02
bit2: 1 -> 04
bit3: 1 -> 08
bit4: 1 -> 10
bit5: 1 -> 20
bit6: 1 -> 40
bit7: 1 -> 80
so the max hex value ff would be in bin 1111 1111; FE 1111 1110 and so on
We AND with C0 which is 1100 000
The reason is that with this AND #$C0 we can check if bit 40 (X,Y) and bit 80 (A,B) are set, and can Zero all other button presses
C0: 1100 0000
AND
80: 1000 0000
= 80: 1000 0000
C0: 1100 0000
AND
40: 0100 0000
= 40: 0100 0000
-> all other Buttons, start, select, L,R, directions get zeroed by this function; e.g., start button 10
C0: 1100 0000
AND
10: 0001 0000
=00: 0000 0000
The code continues with
bne +; if not Zero continue to "+" (so wrong button presses have no effect)
cmp #$80, we compare whether A or B was pressed, if yes, finally store a 01 to a free ram to then in flutechange1 cancel the Transport
What I did was with placing the LDA $F0 before this cmp #$80 to disable the A press (which is on $F2=80) as cancel.
I know this bin-code (AND, OR) is difficult to understand but I hope I could explain it comprehensible
Joypad ram
$F0: B-button=80 ; y=40
$F2: A-Button=80 ; x=40
Then there are select ($F0=20), start ($F0=10), L, R, directions and such.
So first we Need to check whether F0 or F2 has a value
lda $F2
Then we Need to check whether $F0 was pressed so we make the OR function
ora $f0 (if you make a lda $f0 you'd lose the $f2 value)
To understand the And $c0 you Need to get into bin (actually also to underand the OR function above):
a Byte has 8 bits; each bit can have the value 0 or 1. It depends on which bit is set to have the final hex value
bit0: 1 -> 01
bit1: 1 -> 02
bit2: 1 -> 04
bit3: 1 -> 08
bit4: 1 -> 10
bit5: 1 -> 20
bit6: 1 -> 40
bit7: 1 -> 80
so the max hex value ff would be in bin 1111 1111; FE 1111 1110 and so on
We AND with C0 which is 1100 000
The reason is that with this AND #$C0 we can check if bit 40 (X,Y) and bit 80 (A,B) are set, and can Zero all other button presses
C0: 1100 0000
AND
80: 1000 0000
= 80: 1000 0000
C0: 1100 0000
AND
40: 0100 0000
= 40: 0100 0000
-> all other Buttons, start, select, L,R, directions get zeroed by this function; e.g., start button 10
C0: 1100 0000
AND
10: 0001 0000
=00: 0000 0000
The code continues with
bne +; if not Zero continue to "+" (so wrong button presses have no effect)
cmp #$80, we compare whether A or B was pressed, if yes, finally store a 01 to a free ram to then in flutechange1 cancel the Transport
What I did was with placing the LDA $F0 before this cmp #$80 to disable the A press (which is on $F2=80) as cancel.
I know this bin-code (AND, OR) is difficult to understand but I hope I could explain it comprehensible
Thanks, Conn for the explanation, I think last week just really left me too tired to think straight. All of that I understood, my problem was just a matter of figuring out the state immediately before entering the subroutine, e.g. where exactly were the controller values stored. Once I figured out that $F0 and $F2 were the high and low controller bytes, and after looking up which bit was which in each of those bytes, the rest made sense, but I just couldn't put a coherent thought together long enough to actually figure out what needed to be changed.
I came to the conclusion that your idea to make the cancel B-button only, is for the better, so I updated the patch archieve in the main post. Anybody who likes this, please redownload and -apply this patch (PU works also with this patch, SePH).
One nice idea is also, that you edit the flute map in HM and add at the bottom a yellow circle with B in it and write cancel next to it.
I dunno however whether this will work well as I think the normal world map and the flute map share the same tiles. It could be also possible to add this as sprites (as the flute Points Show up) but I do not know whether there's enough empty sprite tiles left (guess not)... it is however possible in PU as SePH renounces on the X-worldmap.
One nice idea is also, that you edit the flute map in HM and add at the bottom a yellow circle with B in it and write cancel next to it.
I dunno however whether this will work well as I think the normal world map and the flute map share the same tiles. It could be also possible to add this as sprites (as the flute Points Show up) but I do not know whether there's enough empty sprite tiles left (guess not)... it is however possible in PU as SePH renounces on the X-worldmap.
Some excellent news: I managed to do this by enabling flute-point 9 (which is not used in native zelda):
Link's position will get a yellow B while blinking. I attached the patch into main zip file
http://bszelda.zeldalegends.net/stuff/Con/flute_fix.zip
All you have to do is turning the flute point 9 circle into a "B" using zcompress (ripped gfx address $3c7c0) .
It is PU-compatible (be sure to re-apply the flute-fix to disable A for canceling and make it only B)
Also the all-in has been updated (with gfx change).
Last edited by Conn on Fri 28 Nov 2014 - 22:53; edited 1 time in total
Link's position will get a yellow B while blinking. I attached the patch into main zip file
http://bszelda.zeldalegends.net/stuff/Con/flute_fix.zip
All you have to do is turning the flute point 9 circle into a "B" using zcompress (ripped gfx address $3c7c0) .
It is PU-compatible (be sure to re-apply the flute-fix to disable A for canceling and make it only B)
Also the all-in has been updated (with gfx change).
Last edited by Conn on Fri 28 Nov 2014 - 22:53; edited 1 time in total
Minor issue with the B button graphic, if you have the L2 (blue) armor, the B icon is red instead of yellow.
mh, I couldn't reproduce the bug, but I changed the Palette used for this B where the yellow is definitively stabled.
This however means that you also Need to repixel it.
Redownload the patch from the main post and read the included word file how to make that.
Sent also a pu Version to seph per mail.
This however means that you also Need to repixel it.
Redownload the patch from the main post and read the included word file how to make that.
Sent also a pu Version to seph per mail.
Hey Conn, could you release a small patch that would change the '9' into the 'B' like you described? I really don't know anything about hacking to do it myself...
Permissions in this forum:
You cannot reply to topics in this forum