1. This forum is in read-only mode.

[AR] Giana Sisters (Red Crystals) - Filling a address to it’s ‘limit’

Discussion in 'Tutorials' started by anandjones, May 14, 2009.

  1. anandjones

    anandjones Well-Known Member

    Before you begin this tutorial, make sure you already know how to do simple AR codes. I will not answer any technical issues to do with the programs etc. here, post a topic in the forums. Make sure you have read this at least (which will steer you on the right track for making your first code).

    Here is a “pointer” example. It is not a pointer code in AR terms, however you can look at it as one memory address “pointing” and copying it’s value from one to another. The game that we will be using for this example will be Giana Sisters DS, a neat little Mario clone platformer. It is worth checking out if you haven’t done so already.

    What we will be doing here is that we will fill the “Red Crystals” that we currently have, to their total (from the total crystals address). Of course we could just find the current crystals address and input 999, but that would look weird (999/3 etc.).

    Step 1: Finding the Addresses

    First off, we need to: find the addresses of the current and total crystals.​

    [​IMG]

    For the current crystals, you can input the number of crystals you currently have collected, and then collect more and search again. For example; if you have 1 crystal, search 1, when you get another, search 2, and so on, until you only get a few addresses, and then test them, or you could use > or even !. If you did it correctly, you should have come up with 0A3012.

    For the totals address, you can just go on a level, search the total number of crystals you need (3 etc.), jump onto another level with a higher or lower total (2 etc.) and search that, and then repeat until you get a few addresses.

    [​IMG]

    If you guessed that both addresses are right next to each other in memory, you’d be correct. You should have came up with 0A3010.

    Step 2: Building the Code

    Now that we’ve found those two addresses that we need, we will start to build the code. We need to set the offset value to our total crystals address, which means for this example, we will use the D3 code type. This will set the total crystals address as the internal “pointer” register.
    D3000000 XXXXXXXX , XX being the address.
    Next, we will need to copy memory (bytes), using the 0F code type, which works in conjunction with the code types (D3, DC or B) to set the offset beforehand. Doing this will copy the bytes specified from the internal pointer register (0A3010 or the first line), to our current crystals address (0A3012).
    FXXXXXXX YYYYYYYY , XX being the address (current crystals), and YY being the number of bytes to copy. We should only do 1 byte, so 00000001.

    And then, we finish off with the terminator D2000000 00000000, which clears AR’s internal registers. If you followed correctly, the code should be:

    D3000000 020A3010
    F20A3012 00000001
    D2000000 00000000

    This means that it will copy only the total to the current variable, no more, no less. Test that out on hardware. Remember that no$gba isn’t a proper AR, so it will not work there (will bring up a ?). Alternative you can do this with other code types, such as this, which uses the DA and D7 code types (which are explained in the link below.

    DA000000 020A3010
    D7000000 020A3012
    D2000000 00000000

    Read this for more information.

    - Finished code on game -​

    [​IMG]

    http://anandjones.romulation.net/?page_id=22​