Cancel flute transport

Go down

20140318

Post 

Cancel flute transport Empty 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:

Cancel flute transport All-in25

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
Conn

Cancel flute transport Image212

Since : 2013-06-30

Back to top Go down

Share this post on: reddit

Cancel flute transport :: Comments

qwertymodo

Post Sun 23 Nov 2014 - 19:06 by qwertymodo

Any chance you could change this so only B cancels? A is typically used as an affirmative selection, so it's weird to have A cancel, and I keep hitting it and cancelling instead of selecting like I want to.

Back to top Go down

TheRetromancer

Post Sun 23 Nov 2014 - 20:29 by TheRetromancer

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.

Back to top Go down

qwertymodo

Post Sun 23 Nov 2014 - 22:33 by qwertymodo

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... Sob

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

Back to top Go down

TheRetromancer

Post Sun 23 Nov 2014 - 22:39 by TheRetromancer

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?

Back to top Go down

qwertymodo

Post Mon 24 Nov 2014 - 0:29 by qwertymodo

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.

Back to top Go down

Conn

Post Mon 24 Nov 2014 - 3:06 by Conn

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

Back to top Go down

qwertymodo

Post Mon 24 Nov 2014 - 13:21 by qwertymodo

Man, I was so close too... being so exhausted that it takes 4 hours to make sense of 20 instructions is awful Sad

Thanks Conn Woot!!

Back to top Go down

Conn

Post Mon 24 Nov 2014 - 15:12 by 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



Back to top Go down

qwertymodo

Post Mon 24 Nov 2014 - 19:27 by qwertymodo

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.

Back to top Go down

Conn

Post Tue 25 Nov 2014 - 6:06 by Conn

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.

Back to top Go down

Conn

Post Fri 28 Nov 2014 - 19:19 by Conn

Some excellent news: I managed to do this by enabling flute-point 9 (which is not used in native zelda):

Cancel flute transport All-in13

Cancel flute transport All-in12

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

Back to top Go down

Conn

Post Fri 28 Nov 2014 - 22:52 by Conn

updated to v2, now the B is perfectly centered with the face (bit difficult as the face is 4 tiles, the B only 1, so I adjusted x and y with adding 4 pixels):
Cancel flute transport All-in14

Back to top Go down

qwertymodo

Post Sun 30 Nov 2014 - 14:36 by qwertymodo

Minor issue with the B button graphic, if you have the L2 (blue) armor, the B icon is red instead of yellow.

Back to top Go down

Conn

Post Sun 30 Nov 2014 - 15:36 by Conn

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.

Back to top Go down

avatar

Post Wed 29 Mar 2017 - 7:53 by lilpuddy31

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...

Back to top Go down

Back to top


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