User:CytricAcid/Beginner's Guide To ACE/US Red and Blue Guide: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(→Get a ×255 item stack: Moved some non-essential screenshots (or placeholders thereof) to the right, and moved inessential details to the notes, so that the section fits in one screen (on my laptop).) |
(→3. Setting up our first code: Changed Full Heal ×2 to Full Heal ×3 to avoid potentially unsafe filler code.) |
||
Line 186: | Line 186: | ||
* (Any non-Key item) ×(any)<ref group="note">In fact, this also works with Key items, but it would be harder to see the effect.</ref> |
* (Any non-Key item) ×(any)<ref group="note">In fact, this also works with Key items, but it would be harder to see the effect.</ref> |
||
* Antidote ×43 |
* Antidote ×43 |
||
* Full Heal ×3<ref group="note">An earlier version of this setup used ×2 instead of ×3, which corresponds to the assembly instruction <code>ld [bc], a</code>. That is not a universally safe filler (it depends on the value of <code>bc</code>), although with the Tentacool setup described on this page it should be safe (in the case of 5 Pokémon in the party, only barely safe thanks to the Antidote (<code>dec bc</code>) changing the address written from $FFB8 to $FFB7).</ref> |
|||
* Full Heal/Revive ×2 |
|||
* TM01 ×(any) |
* TM01 ×(any) |
||
{{Explanation|title=ASM translation|contents= |
{{Explanation|title=ASM translation|contents= |
||
Line 193: | Line 193: | ||
! Item slot !! Item stack !! Hex !! ASM !! Comments |
! Item slot !! Item stack !! Hex !! ASM !! Comments |
||
{{!}}- |
{{!}}- |
||
{{!}} rowspan=2 {{!}} 3rd {{!}}{{!}} rowspan=2 {{!}} Antidote<br />×43 {{!}}{{!}} 0B {{!}}{{!}} |
{{!}} rowspan=2 {{!}} 3rd {{!}}{{!}} rowspan=2 {{!}} Antidote<br />×43 {{!}}{{!}} 0B {{!}}{{!}} dec bc {{!}}{{!}} Filler |
||
{{!}}- |
{{!}}- |
||
{{!}} 2B {{!}}{{!}} '''dec hl''' {{!}}{{!}} hl = $D321 (the quantity of the second item) |
{{!}} 2B {{!}}{{!}} '''dec hl''' {{!}}{{!}} hl = $D321 (the quantity of the second item) |
||
{{!}}- |
{{!}}- |
||
{{!}} rowspan=2 {{!}} 4th {{!}}{{!}} rowspan=2 {{!}} Full Heal<br /> |
{{!}} rowspan=2 {{!}} 4th {{!}}{{!}} rowspan=2 {{!}} Full Heal<br />×3 {{!}}{{!}} 34 {{!}}{{!}} '''inc [hl]''' {{!}}{{!}} Increases the quantity of the second item |
||
{{!}}- |
{{!}}- |
||
{{!}} |
{{!}} 03 {{!}}{{!}} inc bc {{!}}{{!}} Filler |
||
{{!}}- |
{{!}}- |
||
{{!}} 5th {{!}}{{!}} TM01 {{!}}{{!}} C9 {{!}}{{!}} '''ret''' {{!}}{{!}} Returns control to the calling routine |
{{!}} 5th {{!}}{{!}} TM01 {{!}}{{!}} C9 {{!}}{{!}} '''ret''' {{!}}{{!}} Returns control to the calling routine |
||
Line 205: | Line 205: | ||
* {{color|red|If you ever start making your own codes, always remember to end it with a <code>ret</code> instruction. Otherwise the game will continue to execute the remainder of your inventory (and possibly more data following that) as assembly code, which is likely to cause a crash, and potentially worse.}} |
* {{color|red|If you ever start making your own codes, always remember to end it with a <code>ret</code> instruction. Otherwise the game will continue to execute the remainder of your inventory (and possibly more data following that) as assembly code, which is likely to cause a crash, and potentially worse.}} |
||
** That is, unless you know what you are doing and have a good reason not to (e.g. you ended the code with a <code>jp</code> to another function instead). |
** That is, unless you know what you are doing and have a good reason not to (e.g. you ended the code with a <code>jp</code> to another function instead). |
||
* As can be seen above, the "Antidote" in "Antidote ×43" and the " |
* As can be seen above, the "Antidote" in "Antidote ×43" and the "×3" in "Full Heal ×3" are fillers, i.e. you can replace them with "(Something) ×43" and "Full Heal ×(some amount)" respectively as long as the replacement bytes correspond to useless assembly instructions that don't actively mess up the rest of the code. |
||
}} |
}} |
||