Crystal in a box

Go down

Crystal in a box Empty Crystal in a box

Post by Euclid Sun 26 Jan 2014 - 1:05

This requires a 2 part hack.

1. Crystal needs to pop up correctly and link needs to be able to move after that
2. Item needs to be added to the inventory + item dialog needs to pop up.

Now for the first part, all you need to do is edit $09/8607 (offset 0x48607 unheadered) from D0 to 80 - this enables the crystal to "pop" out of the box correctly.

I need Conn's help with the second part, I've noticed he already did some stuff to the code. If - in that spot - code is added there to handle the dialog box and STA of 7EF37A (OR with current dungeon number) - the crystal can then be retrieved from the box.

Code:


$09/8602 AD D8 02    LDA $02D8  [$09:02D8]  A:0707 X:0004 Y:0001 P:envMXdizC
$09/8605 C9 20      CMP #$20                A:0720 X:0004 Y:0001 P:envMXdizC
$09/8607 D0 02      BNE $02    [$860B]      A:0720 X:0004 Y:0001 P:envMXdiZC <--- change to BRA to stop the crystal animation from freezing.
$09/8609 A0 02      LDY #$02                A:0720 X:0004 Y:0001 P:envMXdiZC
$09/860B 98          TYA                    A:0720 X:0004 Y:0002 P:envMXdizC
$09/860C 8D E4 02    STA $02E4  [$09:02E4]  A:0702 X:0004 Y:0002 P:envMXdizC
$09/860F DA          PHX                    A:0702 X:0004 Y:0002 P:envMXdizC
$09/8610 AC D8 02    LDY $02D8  [$09:02D8]  A:0702 X:0004 Y:0002 P:envMXdizC
$09/8613 D0 15      BNE $15    [$862A]      A:0702 X:0004 Y:0020 P:envMXdizC
$09/862A 98          TYA                    A:0702 X:0004 Y:0020 P:envMXdizC
$09/862B 0A          ASL A                  A:0720 X:0004 Y:0020 P:envMXdizC
$09/862C AA          TAX                    A:0740 X:0004 Y:0020 P:envMXdizc
$09/862D BD E8 84    LDA $84E8,x[$09:8528]  A:0740 X:0040 Y:0020 P:envMXdizc
$09/8630 85 00      STA $00    [$00:0000]  A:077A X:0040 Y:0020 P:envMXdizc
$09/8632 BD E9 84    LDA $84E9,x[$09:8529]  A:077A X:0040 Y:0020 P:envMXdizc
$09/8635 85 01      STA $01    [$00:0001]  A:07F3 X:0040 Y:0020 P:eNvMXdizc
$09/8637 A9 7E      LDA #$7E                A:07F3 X:0040 Y:0020 P:eNvMXdizc
$09/8639 85 02      STA $02    [$00:0002]  A:077E X:0040 Y:0020 P:envMXdizc
$09/863B 22 00 90 22 JSL $229000[$22:9000]  A:077E X:0040 Y:0020 P:envMXdizc  <-------- custom ASM

$22/9000 B9 80 85    LDA $8580,y[$09:85A0]  A:077E X:0040 Y:0020 P:envMXdizc
$22/9003 10 01      BPL $01    [$9006]      A:07FF X:0040 Y:0020 P:eNvMXdizc
$22/9005 6B          RTL                    A:07FF X:0040 Y:0020 P:eNvMXdizc

$09/863F EA          NOP                    A:07FF X:0040 Y:0020 P:eNvMXdizc
Euclid
Euclid

Crystal in a box Image212

Since : 2012-06-21

Back to top Go down

Crystal in a box Empty Re: Crystal in a box

Post by Conn Sun 26 Jan 2014 - 7:50

Code:
$09/863B 22 00 90 22 JSL $229000[$22:9000]  A:077E X:0040 Y:0020 P:envMXdizc  <-------- custom ASM

*lol, this jsl leads to all items I hacked and rehacked and rehacked... and rehacked, to store the new items to the memory. I hope I am able to stuff more code there to help you out Wink

Code:
$22/9000 B9 80 85    LDA $8580,y[$09:85A0]
This is normally the value of the item that is stored to it's ram Location (e.g., 01=blue boomerang, 02=red boomerang, 03=green boomerang).
In above code, the Crystal has FF which is negative ($22/9003 10 01      BPL $01), so there is no save to  7EF37A.

My idea were to somehow check whether a Crystal is collected; X is always 40 for every Crystal (to get F37A, I think)... I could modify my hack (but due to the persitent rehacking it got a bit "fragile") to check if x=40 and if yes, store another number to 7ef37a. the last Crystal must be a "7F" - we can make it linear and check the former value, I just tested some values, like
if 00 store now 01 (one Crystal)
if 01, store now 03 (two crystals)
if 03, store now 07 (3 crystals)
if 07 store now 0f (4 crystals)
if 0f, store now 4f (5 crystals
if 4f, store now 7e (6 crystals
if 7e, store now 7f (7 crystals)
Since only the number is shown in the menu and not the specific Crystal (as in ALTTP), we could do it this way

The monologue of the crystals is handled on a different Location which I can also rehack... just tell me which monologue you Need.

Edit:
I think best is something like this:
Code:
$09/863B 22 00 90 22 JSL $229000 -> Change this to another free address, e.g., 11/7000 (snes: 22/F000), so we don't get into the fragile overstuffed Region.
$22/f000:
cpx $40; check if X=40, if yes branch 5 Bytes and skip the new item store code (cpy $20 should also work)
BEQ 05
jsl 22/9000
RTL
lda $7ef37a
cmp 00,01,03,07,0f,4f,7e
sta next value
RTL



Last edited by Conn on Sun 26 Jan 2014 - 8:41; edited 3 times in total
Conn
Conn

Crystal in a box Image212

Since : 2013-06-30

Back to top Go down

Crystal in a box Empty Re: Crystal in a box

Post by Conn Sun 26 Jan 2014 - 8:38

As for the item dialogue, I found this:

Code:
$08/C5C1 B9 DD C2    LDA $C2DD,y[$08:C31D]  A:0040 X:0004 Y:0040 P:envmXdizc

At 08/c31d (pc: 04/431d) you find ff ff (that skips the monologue). You can easily Change this to your desired monologue (in hex); e.g., 68 00 is deku seed monologue.
Conn
Conn

Crystal in a box Image212

Since : 2013-06-30

Back to top Go down

Crystal in a box Empty Re: Crystal in a box

Post by Conn Sun 26 Jan 2014 - 9:26

That's great and also nice that you know about the arithmetics (with bitwise "or" - never learned this I have to admit). I just know that the last value for AST tablets is FF since there are 8 instead of 7 crystals in ALTTP (where the last Crystal is 7F). But since the exact Position of the crystals is unnecessary for PU, we really can renounce on this bit Operation and just Count in numbers (and thus can give more crystals).

The only Thing I Need to know is the Location of your code then (e.g., if you use 22/F000 I could easily overwrite it when we work parallel) and of course the value of the last Crystal when you know it (if it stays 7f, or will be 07, 09.
Conn
Conn

Crystal in a box Image212

Since : 2013-06-30

Back to top Go down

Crystal in a box Empty Re: Crystal in a box

Post by Euclid Sun 26 Jan 2014 - 19:08

We can have a chest with an alternative - ie if you have 7 crystals when yoiu open this chest you get item X otherwise get item Y
Euclid
Euclid

Crystal in a box Image212

Since : 2012-06-21

Back to top Go down

Crystal in a box Empty Re: Crystal in a box

Post by Conn Sun 26 Jan 2014 - 19:27

The one ring falls away, since you can glide with the feather through the bumpers. The Joker will be moved (if I remember correctly).

I think next easiest items are the firemushroom (D9) or lift4 (D8). Both you miss on the hard way. We could also couple it to Ganon created batcave Event... Smile

I think it'll be the fire-mushroom. Easy way to Ganon is blockable by distant torches. So if you don't have it, you've gone the hard way, right?

Btw: how many rings were at Lord of the rings? 9 human, 7 dwarfes, 3 elves? But 19 are too many I guess ^^
Conn
Conn

Crystal in a box Image212

Since : 2013-06-30

Back to top Go down

Back to top

- Similar topics

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