• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Code: ASM Resource Thread

anonyboy

Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-C
286
Posts
10
Years

Berry System in FireRed!


First of all, before you implement my system you need to insert:
JPAN's save block hack: http://www.pokecommunity.com/showpost.php?p=6993092&postcount=206
ShinyQuagsire's berry bag hack: http://www.pokecommunity.com/showthread.php?t=295749
My code assumes that you've got all of this already implemented.


How to insert:

There's a lot of work to do before you can get this running. Trust me it was more work to create.
Compile each of the following routines and insert them into free space (KEEP TRACK OF WHERE YOU INSERT):

GetTreeData:
Spoiler:


getYeild
Spoiler:


setTime:
Spoiler:


setTreeData:
Spoiler:


Now, once you've compiled those routines into free space you will need to insert their pointers (not in reverse hex) into this script. Remember to add 1 to the pointer.
You'll notice that I've added comments, which in PKSV, are signified by the apostrophe. I.e
Code:
 'This is a comment

I've made sure to add comments everywhere there is a callasm command to one of my routines. You'll also notice that the names I call these routines are identical to the names I gave the spoilers. You need to match the call to the pointer to the name of the routine!

The PKSV script (sorry no XSE version, convert it yourself :P):

Spoiler:


Usage:
After you've compiled the script, write down the offset of it as well. You will need to remember it.
Here is how you'll be using the script:
Code:
#dyn 0x740000
#org @start
setvar 0x8000 0x[max berry yield]
setvar 0x8001 0x[min berry yield]
setvar LASTRESULT 0x[Tree ID]
jump 0x8[Offset where you compiled the above script]

Every tree should have a unique Tree ID. So if you want two trees, one can be 0x0, and the other can be 0x1. Set the tree ID to lastresult and then jump the script that handles the complicated stuff.


System Mechanics:
The beauty of the system is that it uses only temporary variables and derives their values from the RAM. Meaning you can go ahead and use those variables for anything, without having to save them for just the tree. Incase you are interested here's how the data is stored and the variable's significance:

Code:
General variables:
var 0x8000: Max berry yield for tree
var 0x8001: Minimum berry yield for tree
var 0x8005: Current stage
var 0x8006: Time planted
var 0x8007: Was watered
var 0x8008: Times watered
var 0x8009: ID of berry

RAM Data storage:
[Current Stage: 1 byte]
[Time planted: 2 bytes]
[Watered: 1 byte]
[times watered: 1 byte]
[ID of plant: 1 bytes]


System Algorithm:
The system works identical to that of DPPT. The only complication is that FR does not have an RTC. So I used play time to obtain as clock. The current system has 5 phases, each phase lasts 20 minutes playtime. You can Increase or decrease this time by going to the "getTreeData" routine, finding my comment in all caps and changing the constant 0x14 (20) to some other hex number you'd want.
Link to DPPT berry system: http://bulbapedia.bulbagarden.net/wiki/Berry#Formula
Could you make it work with prime-dialga's RTC? If you can would you please post the routines?
 

Blah

Free supporter
1,924
Posts
11
Years
Could you make it work with prime-dialga's RTC? If you can would you please post the routines?

Why would you introduce an RTC? The berry phases are already time based, an RTC isn't necessary. Also adding an RTC makes the 24 hour "fail" effect. Which is, if you visit the berries right after 24 hours or just before, the system will interpret it as though you went back in time or no time has passed. That's because you'd have to convert your standard time HH:MM into a Minutes halfword.
That being said, if YOU absolutely wanted to use your own RTC to manage these, you would have to expand the tree data to take in a date as well which in itself is more space taken in a precious save block.

Trust me when I say, the best way to handle this is using play time as a timer.
Infact, I would say the only things you'd ever use an RTC for in game are for these effects:

- Day based events (Like DPPT, Drifloon appears every Friday)
- Seasons
- yeah that's it

Day/Night imo should be handled by the ingame timer. That way, while playing throughout the game you can experience the full array of pallettes and time pass in the Player's perspective. It also prevents it having to be night time all day because you can only play at 8pm for personal reasons.

Timing based events are also more easily handled via play time as well. You can record the time which the player starts their task, and then set a goal time, and in the end compare the goal time to the actual time.

I hope I got my point across to you. Maybe I will make a routines to get the current play time. But the idea is that my system is standalone, it doesn't require you to have an RTC, and even if you have one it will still work.
 

anonyboy

Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-C
286
Posts
10
Years
Why would you introduce an RTC? The berry phases are already time based, an RTC isn't necessary. Also adding an RTC makes the 24 hour "fail" effect. Which is, if you visit the berries right after 24 hours or just before, the system will interpret it as though you went back in time or no time has passed. That's because you'd have to convert your standard time HH:MM into a Minutes halfword.
That being said, if YOU absolutely wanted to use your own RTC to manage these, you would have to expand the tree data to take in a date as well which in itself is more space taken in a precious save block.

Trust me when I say, the best way to handle this is using play time as a timer.
Infact, I would say the only things you'd ever use an RTC for in game are for these effects:

- Day based events (Like DPPT, Drifloon appears every Friday)
- Seasons
- yeah that's it

Day/Night imo should be handled by the ingame timer. That way, while playing throughout the game you can experience the full array of pallettes and time pass in the Player's perspective. It also prevents it having to be night time all day because you can only play at 8pm for personal reasons.

Timing based events are also more easily handled via play time as well. You can record the time which the player starts their task, and then set a goal time, and in the end compare the goal time to the actual time.

I hope I got my point across to you. Maybe I will make a routines to get the current play time. But the idea is that my system is standalone, it doesn't require you to have an RTC, and even if you have one it will still work.
Well you make a great point... i'll probably insert this system into my EM Remake...
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
My idea in Beauty in FR, was not achieved in contest but a certain script will add +10 of your beauty with that routine.
GSC Happiness
In GSC, there's an NPC that will enhances your Pokemons Happiness by haircut, can you Portit in FR?

Altered Forme Giratina wild appearance
In Platinum, instead of From Left-Right, Altered foe giratina appears at the top. Can you make it?

RSE Choose starter style of RSE
Well, In RSE, theres a very unique style of choosing Pokemon, it has a background right? So can you port it in FR?

Castform Changes but based on time
In Emerald, Castform will change its form depending on what is the weather, If you can make a routine for Castform changes in weather, it will be generally useful, in my request, a certain pokemon changes its form depending on a time that DNS installed.

Dive completely working
Someone posted here for a routine of Dive in FR(U) but he is uncertain what to do now... Then a tutorial but a signpost consuming Dive in German rom. Can you make it that dive actually works like RSE in FR.

Thats all xD

Ok, this one's for Christos, who requested this on IRC.

Smooth Rock (and potentially similar items, but you guys can work that out)

This routine hijacks the "setsandstorm" battle command, and makes it check your held item's effect byte. Mine was 0x48, but that's easily changeable.

Here's the routine! (This is for FR btw)
EDIT: just realized my routine was a bit unoptimized. Here's the fixed one.
Code:
.text
.align 2
.thumb
.thumb_func
.global smoothrock

main:
mov r0, #0x3
strb r0, [r1, #0x5]
push {r0-r3}
ldr r0, .items
ldr r1, .struct
ldr r2, .bank
ldrb r2, [r2]
mov r3, #0x58
mul r2, r3
add r1, r2
add r1, #0x2E
ldrh r1, [r1]
mov r2, #0x2C
mul r1, r2
add r0, r1
ldrb r0, [r0, #0x12]
cmp r0, #0x48
bne original
pop {r0-r3}
ldr r0, .weatherturns
mov r1, #0x8
strb r1, [r0, #0x0]
b return

original:
pop {r0-r3}
ldr r0, .weatherturns
mov r1, #0x5
strb r1, [r0, #0x0]

return:
ldr r0, .return
bx r0

.align 2
.items: .word 0x083DB028
.struct: .word 0x02023BE4
.bank: .word 0x02023D6B
.weatherturns: .word 0x02023F48
.return: .word 0x08028CD7
(insert 01 48 00 47 C0 46 XX XX XX 08 at 08028CCA, where XX XX XX is your reversed pointer + 1)

What does this code really does?
 
Last edited by a moderator:

Blah

Free supporter
1,924
Posts
11
Years
Well you make a great point... i'll probably insert this system into my EM Remake...

Of course I make a good point :P

My idea in Beauty in FR, was not achieved in contest but a certain script will add +10 of your beauty with that routine.
GSC Happiness
In GSC, there's an NPC that will enhances your Pokemons Happiness by haircut, can you Portit in FR?

Altered Forme Giratina wild appearance
In Platinum, instead of From Left-Right, Altered foe giratina appears at the top. Can you make it?

RSE Choose starter style of RSE
Well, In RSE, theres a very unique style of choosing Pokemon, it has a background right? So can you port it in FR?

Castform Changes but based on time
In Emerald, Castform will change its form depending on what is the weather, If you can make a routine for Castform changes in weather, it will be generally useful, in my request, a certain pokemon changes its form depending on a time that DNS installed.

Dive completely working
Someone posted here for a routine of Dive in FR(U) but he is uncertain what to do now... Then a tutorial but a signpost consuming Dive in German rom. Can you make it that dive actually works like RSE in FR.

Thats all xD

- Happiness: It's already done by a script in FireRed. Gary's little sister does it.

- Garatina wild appearance is too specific and graphic based (I don't really do graphical ASM)

- This is also heavy graphics based...hmm..part of me wants to do it, part of me knows I don't like graphics.
I'll put that request as pending (no promises).

-Time based form changes are too specific. As I've said in my first post, I don't want to do anything too specific. It would be useless to 95% of us.

- Dive: I'll look into it!
edit for dive: http://www.pokecommunity.com/showpost.php?p=6756585&postcount=2
It's already done.

What does this code really does?

It's smooth rock. It makes sandstorm last longer.
 
Last edited:

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
- Happiness: It's already done by a script in FireRed. Gary's little sister does it.

- Garatina wild appearance is too specific and graphic based (I don't really do graphical ASM)

- This is also heavy graphics based...hmm..part of me wants to do it, part of me knows I don't like graphics.
I'll put that request as pending (no promises).

-Time based form changes are too specific. As I've said in my first post, I don't want to do anything too specific. It would be useless to 95% of us.

- Dive: I'll look into it!

Yes! A DIve! Thanks to it! Ill think of so many features that you can make an ASM, not a graphical base ahahaha



It's smooth rock. It makes sandstorm last longer.

Is that an Item?
 
Last edited:

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
Bulbapedia said:
In a Triple Battle, three Pokémon on each side
are sent out at once. There are restrictions as
to which Pokémon can attack which opponent.
The Pokémon in the middle can attack all three
on the other side, but the ones on either side
cannot attack the Pokémon on the far side of
the opposite end. However, there are some
exceptions to this rule, through the use of
moves such as Pluck or Aura Sphere . The
Pokémon Pansage, Pansear , and Panpour were
introduced to showcase this new feature. The
position of each Pokémon can be changed
during the battle; however, a turn will be used
up.
Can you make a Triple battle in FR?
 

daniilS

busy trying to do stuff not done yet
409
Posts
10
Years
  • Age 24
  • Seen Jan 29, 2024
Change Sprite without changing its dex number
... ...I do mean Rotom's forms, An Item effect(For Arceus forme) and/or script (for rotom forme)

If you read back a little, you can see I actually published a routine for index changing (Rotom) and will soonly publish a rewritten Arceus routine.
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
sorry for that,
I realized now that my request is for grapgics, sorry again, and thanks for answering my question about Smooth rock

Forgive me if my ideas include Graphic editing

Check Pokemon type in a certain Slot routine
this routine will work like checkflag, if you have a Water pokemon at 2nd slot then it will go to new pointer.
Or any other method in scripting

Pocket Routine
In FR there are 2 Pockets in Bag, the Berry and TM Pocket, can you duplicate one of it and make a new one so that some items will be stored in that new pocket
 
Last edited:
35
Posts
10
Years
  • Age 37
  • Seen Jul 27, 2016
can you make something like safari zone in x/y, forcing wild pokemons have 2-3 perfect ivs??
 

Red John

Progressing Assembly hacker
137
Posts
9
Years
I have a request here. Can you make a naming routine kinda like Gary naming routine? Would be useful to name teams. And can you create a way so wild pokemons can have a nickname? I mean it would be for special pokemons, like N's Pokemons.
 
33
Posts
10
Years
  • Age 28
  • Seen Sep 23, 2022
Can you make some sort of routine where certain trainers like Gym Leaders prevent you from challenging them if you have more pokémon than them or are overleveled?
Ex: Brock has 3 Pokémons at levels 12, 13, 14.
The player cannot challenge him with more than 3 pokémons in the party.
The player cannot challenge him with any pokémons above level 14.
(Optional) The player cannot challenge him if the total of its pokémons levels exceed 39.

Most people just plain overgrind and try to steamroll hacks with raw power so I really want to break this tradition and make a difficult hack where grinding is a bad option.

If you could also make the Exp. Share work like it's XY counterpart it would be great too.
(No overleveling, no easy mode problems)


And I'm just theorizing here, but Mega Evolutions basically are form changes. If we could make an held item that triggers a form change mid-battle we would have something pretty similar to it.
(No, Arceus plates do not work that way, before anyone asks. It's the Ability that makes him shift)

And if we had an held item that triggers form changes mid-battle when activated by a key item...

daniilS requested that I let him do mega evolutions. It seems like he's already started and is eager to do it (so I'm going to let him handle it :P).

My bad. I was reading the thread while planning my post. Did daniilS make any sort of thread on the subject?


Excellent thread, a lot of helpful things here.

I was actually searching for some way to make certain pokémon uncatchable and now I can!
...Except not. Err, how do I do ASM? Do I need a tool for that? Got a link to any good tutorials? Is that a cookie? Can I eat it?
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
To anyone made all of FBI Routines, it would be great if you can share here tymhe compiled version... Sorry if this thread is offensive to others... Im having a problem with Hackmews tool, while Andreas compiler,.I dont know how to compile in that tool, and lastly, Karatekids Tool, the download link is broken in his thread
 

Blah

Free supporter
1,924
Posts
11
Years
sorry for that,
I realized now that my request is for grapgics, sorry again, and thanks for answering my question about Smooth rock

Forgive me if my ideas include Graphic editing

Check Pokemon type in a certain Slot routine
this routine will work like checkflag, if you have a Water pokemon at 2nd slot then it will go to new pointer.
Or any other method in scripting

Pocket Routine
In FR there are 2 Pockets in Bag, the Berry and TM Pocket, can you duplicate one of it and make a new one so that some items will be stored in that new pocket

I already made a routine that does this. In fact the one I did is more powerful, it checks your entire party, and returns the slot of a Pokemon of a certain type. So all you need to do then is to use a check to see if the return matches the slot you wanted.

For bags, this is actually not easy. IF I have time I will look at it, but as far as I know bags are rather complicated. You need to worry about space, storage and managing item uses. That being said, I can probably make a second bag as it's similar to something I just did. We'll see is all I can say.

can you make something like safari zone in x/y, forcing wild pokemons have 2-3 perfect ivs??

Why though? You can't even check your Pokemon's IVs in FireRed and people playing Hacks probably aren't going to farm perfect IV Pokemon. If you can give me a good reason to do this, I'll consider. But right now, I see it as kind of pointless.

I have a request here. Can you make a naming routine kinda like Gary naming routine? Would be useful to name teams. And can you create a way so wild pokemons can have a nickname? I mean it would be for special pokemons, like N's Pokemons.
Hi, for naming routine, I'll look into it. I can't promise that the overworld that walks around will be perfect, but we'll see :P

Can you make some sort of routine where certain trainers like Gym Leaders prevent you from challenging them if you have more pokémon than them or are overleveled?
Ex: Brock has 3 Pokémons at levels 12, 13, 14.
The player cannot challenge him with more than 3 pokémons in the party.
The player cannot challenge him with any pokémons above level 14.
(Optional) The player cannot challenge him if the total of its pokémons levels exceed 39.

Most people just plain overgrind and try to steamroll hacks with raw power so I really want to break this tradition and make a difficult hack where grinding is a bad option.

If you could also make the Exp. Share work like it's XY counterpart it would be great too.
(No overleveling, no easy mode problems)


And I'm just theorizing here, but Mega Evolutions basically are form changes. If we could make an held item that triggers a form change mid-battle we would have something pretty similar to it.
(No, Arceus plates do not work that way, before anyone asks. It's the Ability that makes him shift)

And if we had an held item that triggers form changes mid-battle when activated by a key item...



My bad. I was reading the thread while planning my post. Did daniilS make any sort of thread on the subject?


Excellent thread, a lot of helpful things here.

I was actually searching for some way to make certain pokémon uncatchable and now I can!
...Except not. Err, how do I do ASM? Do I need a tool for that? Got a link to any good tutorials? Is that a cookie? Can I eat it?

I'll start by answering your last question. Read HackMew's tutorial on ASM, he explains how to compile and the execution for this first tutorial is quite easy. I personally wouldn't bother with his part two, that was a rather large step between part one and two. If you have questions, there's an Assembly help thread in the beginner's lounge.

For your suggestions:
- Make gym leader decline if you have less/more Pokemon. Use "countpokemon" it's a scripting command and checks how many Pokemon you have returning 0-6 in variable 0x800D (Lastresult)

- Level checker. I made a more powerful version of a "party checker" it's lying around in my research folders. I'll post it as soon as I find it!

- I will do your optional request as well, simply because I already have code that's of similar structure :D

-Experience share, I took a look at it now and, this is quite the request. I will try to give it a shot, but I'm not sure if I can do it easily without a lot of time.

daniilS has not made a thread, as far as I know. I think he's going to complete it first, you can talk to him about that I suppose.


To anyone made all of FBI Routines, it would be great if you can share here tymhe compiled version... Sorry if this thread is offensive to others... Im having a problem with Hackmews tool, while Andreas compiler,.I dont know how to compile in that tool, and lastly, Karatekids Tool, the download link is broken in his thread
Sorry, from now on I'll post compiled versions too. The older ones you need to work something out :P
 

Blah

Free supporter
1,924
Posts
11
Years

Pokemon Storage (outside the PC)


Basically, in it's current state, this is effectively a storage system. It stores Pokemon and can be interacted with by the player to withdraw or deposit Pokemon. It's standalone from the PC storage system and is also much smaller (I've limited it to 6, but it can go upto 47). Some things that you will be able to do with this routine (and conjunction with some smaller ones) include:
- Extra Pokemon storage, you can possibly get a little over 1 box worth
- Flash back battles (complete swap between stored Pokemon and party Pokemon with capabilities to swap back)
- Carry a party of greater than 6 Pokemon (you can use the 2nd party for HM slaves, or whatever)
- Trade evolver guy! He will take your Pokemon and then when you come back it can be evolved! (silent evolution ftw!)
- Separate Daycare holding larger amount of Pokemon at once

I've tested it thoroughly and there doesn't seem to be any problems. I will be adding more and more features into this because I believe that it has the potential to become a very useful feature.
Currently planning to add:
- Party swap completely all in one go (this will actually be in the very near future..maybe today even :P)
- Partial swapping (believe it or not, this is hard because there's no graphical support)
- Suggest me more :D

How to insert:

Compile into free space the following routine:
Spoiler:


Here's a compiled version:
Code:
11 B5 38 48 01 68 00 29 32 D0 37 48 01 38 01 78 06 29 65 D0 01 30 50 22 51 43 40 18 34 49 09 78 32 4A 64 23 59 43 89 18 50 22 32 4B 00 F0 59 F8 2F 49 09 78 05 29 0B D0 05 22 52 1A 64 23 5A 43 2A 48 59 43 40 18 1B 18 19 1C 2A 4B 00 F0 49 F8 29 48 00 21 64 22 29 4B 00 F0 43 F8 22 48 01 38 02 78 27 49 0B 78 01 32 02 70 01 3B 0B 70 37 E0 23 48 00 78 06 28 33 D0 1C 49 64 22 50 43 40 18 04 1C 19 4B 1A 49 09 78 50 22 51 43 C9 18 19 4B 00 F0 27 F8 20 1C 1B 4B 00 F0 23 F8 14 48 00 78 05 28 0B D0 05 22 12 1A 50 23 5A 43 0E 49 58 43 40 18 1B 18 19 1C 0F 4B 00 F0 13 F8 0A 48 C8 21 49 00 40 18 00 21 50 22 0C 4B 00 F0 0A F8 06 48 01 38 02 78 0A 49 0B 78 01 3A 02 70 01 33 0B 70 1F BD 18 47 B8 70 03 02 01 C0 03 02 84 42 02 02 C0 70 03 02 09 0B 04 08 78 44 02 02 D9 5E 1E 08 29 40 02 02 7D E4 03 08

Usage:

The routine itself manages party storage and storage extraction. What you need to do is determine which one it performs.
If you want to remove a Pokemon from the party and into storage, setvar 0x8000 anything but zero
if you want to remove a Pokemon from storage, setvar 0x8000 0x0
Which variable you used can be changed, as always, by editing the pointer at the bottom of the routine.
The next thing is variable 0x8004. I use this variable to determine the slot of extraction for both the Party and the Storage system.
If I wanted to take the 3rd Pokemon in the party and put it in storage:
setvar 0x8004 0x2
setvar 0x8000 0x1
callasm 0x[routine] +1

The reason for this is to support easy use of special 0x9F. Though you can use copyvar, I suppose.

Finally, the routine writes to RAM a counter, which keeps track of how many Pokemon are in the storage.
This is written at 0x203C000, and can be retrieved by using the "copybyte" scripting command. For example:
copybyte 0x20370D0 0x203C000 'puts the storage counter into variable 0x800D (lastresult).

I tried to keep it simple, and do the work inside the routine, hopefully that paid off.
Here's a very poor sample script. Poor because it handles all the cases, but it doesn't display the system's full potential :P

Spoiler:


That's it for now. Keep an eye out for "addons" for this routine in the future :)
Sorry for the double post. I like seperate posts for my routines to keep the first post's links neat :x
 
Last edited:

DarkenedEclipse

Project Oak
207
Posts
9
Years
Question of clarification as I'm just starting to learn lol:
1. Register's data is determined by the pushed registries?
2. What are some of the variables like .VAR and what do they mean? How are they defined?
3. An ASM routine retrieves certain data from the ROM's RAM?
4. Once the data is popped the routine is done?

Sorry if these are simple questions, I am very new to this lol and I got a lot of questions XD
 

Turtl3Skulll

Blue Turtl3
76
Posts
10
Years
Question of clarification as I'm just starting to learn lol:
1. Register's data is determined by the pushed registries?
2. What are some of the variables like .VAR and what do they mean? How are they defined?
3. An ASM routine retrieves certain data from the ROM's RAM?
4. Once the data is popped the routine is done?

Sorry if these are simple questions, I am very new to this lol and I got a lot of questions XD

Read this, it should give you a basic understanding of everything you're asking:

http://interdpth.arc-nova.org/PJs s...t Code Hacking Primer Series - ASM guides.htm

Here are some shorter tutorials by memebers of PC.



Since you are new to this, you may need to read through them a couple of times before you begin to grasp them.
 

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years
I have a request. I am working on a *cough, cough*secret Christmas hack.*cough, cough* And the main character is a pokemon. So obviously I would like to be able to use him in fight but something that is pushing me away from that is when you send out a pokemon the trainer flys off the edge throwing a pokeball. Hopefully this sint too much graphical since its not adding any graphics. But could you make a routine that if a certain pokemon is in the front of your party and not fainted it doesnt slide the backsprite out, and doesnt say soandso sent out Arceus?
 

Blah

Free supporter
1,924
Posts
11
Years
Question of clarification as I'm just starting to learn lol:
1. Register's data is determined by the pushed registries?
2. What are some of the variables like .VAR and what do they mean? How are they defined?
3. An ASM routine retrieves certain data from the ROM's RAM?
4. Once the data is popped the routine is done?

Sorry if these are simple questions, I am very new to this lol and I got a lot of questions XD
You had the right thread before, lol. It goes in the ASM help thread. This is my resource thread :P
1. A registers data depends on what's been put into it, and how the things inside it have been manipulated. There's a lot of ways to manipulate the contents of registers too. Pushing doesn't set value to a register, no.
2. .VAR is a label. Normally, you use it as a replacement for typing out the entire address. Technically you can just do ldr rx =(address), it's the same as ldr rx, .VAR
3. An ASM routine can do that, but ASM is mainly used to manipulate game mechanics via game code. You can manipulate the RAM in scripts, though much less efficiently and much slower.
4. Once the data is popped, the routine goes back to the pointer in the link register. Though for scripts and such, once the routine which you call via callasm pops the pc (program counter) it's generally done (unless you pushed it again prior).



Pokemon Storage Addon: Full Party Swap


So last time I did just a quick swap one Pokemon at a time. Here I made some code basically "mass-swap" the storage and the current Player's party all at the same time.

How to insert:

Compile and insert into free space the following routine:
Spoiler:


Here is a compiled version:
Code:
3F B5 00 23 06 2B 0F D0 20 48 50 21 59 43 40 18 20 4A 64 21 59 43 89 18 50 22 08 B4 1E 4C 00 F0 34 F8 08 BC 01 33 ED E7 00 23 06 2B 18 D0 19 48 64 21 59 43 40 18 16 4A 50 21 59 43 89 18 50 22 08 B4 15 4C 00 F0 21 F8 08 BC 12 48 64 21 59 43 40 18 08 B4 11 4C 00 F0 18 F8 08 BC 01 33 E4 E7 0B 48 0A 49 F0 22 52 00 0B 4C 00 F0 0E F8 08 48 01 38 00 78 0A 49 08 70 0A 48 00 78 04 4A 01 3A 10 70 08 48 09 78 01 70 3F BD 20 47 2C 40 02 02 01 C0 03 02 84 42 02 02 09 0B 04 08 7D E4 03 08 B8 70 03 02 29 40 02 02

Usage:
Just callasm to the routine +1. Be careful though, always check that the storage isn't empy. You can swap out your entire party for no Pokemon and create a nice little bugged questionmark when you open the Pokemon menu (the one in my avatar :3).

This time instead of a script I present to you a video :D

Link in case embedded fails: https://www.youtube.com/watch?v=haPE6iohJMY
 
Last edited:
Back
Top