The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Help Thread ASM & Disassembly

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Closed Thread
 
Thread Tools
  #51   Link to this post, but load the entire thread.  
Old December 26th, 2014 (8:24 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by joexv View Post
Ohhh.. Ok.
So inorder to check a new flag it would be
Code:
	push {r0-r4}
	mov r0, #0x40
	lsl r0, r0, #0x2
	ldr r1, =(0x806E6D0 +1)
	cmp r0, #0x0
To check flag 0x160 right?
If so how then would I stop the script if its not set?
Would it be?
Code:
beq noscript @wheres noscript is another hunk a code
Actually you need a linker still. All you've done is load into r1 a pointer. Now to go to that pointer, you need bx r1. Though like I said that doesn't write anything to the lr so you don't have a return spot. To fix this we had the "bl linker".
__________________
...
  #52   Link to this post, but load the entire thread.  
Old December 26th, 2014 (8:33 PM).
Joexv's Avatar
Joexv Joexv is offline
ManMadeOfGouda
joexv.github.io
 
Join Date: Oct 2012
Location: Oregon
Age: 25
Gender: Male
Nature: Sassy
Posts: 1,035
Quote:
Originally Posted by FBI agent View Post
Actually you need a linker still. All you've done is load into r1 a pointer. Now to go to that pointer, you need bx r1. Though like I said that doesn't write anything to the lr so you don't have a return spot. To fix this we had the "bl linker".
OK so to add a flag to the white out routine it would be:
Code:
.text
.align 2
.thumb
.thumb_func

main:	
	push {r0-r3, lr}
       mov r2, #0xBF @flag to check divided by 4
	lsl r2, r2, #0x2
	ldr r3, =(0x806E6D0 +1)
	bl linker
	cmp r2, #0x0
	ldr r0, =(0x2023E8A)
	ldrb r1, [r0]
	cmp r1, #0x1
	bhi setZero
	b end

linker:
	bx r3
	

setZero:
	cmp r1, #0x5
	beq end
	mov r1, #0x0
	strb r1, [r0]

end:
	pop {r0-r1, pc}
Correct? Sorry about asking so many questions this is really confusing...
__________________
New living flesh vessel who dis?
  #53   Link to this post, but load the entire thread.  
Old December 26th, 2014 (8:47 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by joexv View Post
OK so to add a flag to the white out routine it would be:
Code:
.text
.align 2
.thumb
.thumb_func

main:	
	push {r0-r3, lr}
       mov r2, #0xBF @flag to check divided by 4
	lsl r2, r2, #0x2
	ldr r3, =(0x806E6D0 +1)
	bl linker
	cmp r2, #0x0
	ldr r0, =(0x2023E8A)
	ldrb r1, [r0]
	cmp r1, #0x1
	bhi setZero
	b end

linker:
	bx r3
	

setZero:
	cmp r1, #0x5
	beq end
	mov r1, #0x0
	strb r1, [r0]

end:
	pop {r0-r1, pc}
Correct? Sorry about asking so many questions this is really confusing...
No there's a lot more wrong now. I'll just fix it for you and you can see what's wrong for yourself.

Code:
.text
.align 2
.thumb
.thumb_func

main:	
	push {r0-r3, lr}
        mov r0, #0xBF @flag to check divided by 4
	lsl r0, r0, #0x2
	ldr r3, =(0x806E6D0 +1)
	bl linker
	cmp r0, #0x0 @with flag magic you don't need this cmp even, but nvm that
	beq end
	ldr r0, =(0x2023E8A)
	ldrb r1, [r0]
	cmp r1, #0x1
	ble end

setZero:
	cmp r1, #0x5
	beq end
	mov r1, #0x0
	strb r1, [r0]

end:
	pop {r0-r3, pc}

linker:
	bx r3
You can owe me back with a ROM base with all the Pokemon, moves and abilities inserted.
__________________
...
  #54   Link to this post, but load the entire thread.  
Old December 29th, 2014 (8:15 AM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
I do not know whether this should be here but...well Mr. FBI Agent posted a silent evolution code in his thread. Well i am learning the way of third generation battle mechanism and found a way to call a ASM in battle. So, my question is that if i adjust the party slot value in the variable and then call the ASM 1, would it change anything?
__________________
  #55   Link to this post, but load the entire thread.  
Old December 29th, 2014 (5:14 PM).
TheRabbit TheRabbit is offline
Banned
 
Join Date: Jul 2014
Gender: Male
Posts: 69
I posted this in the ASM resource thread but didn't get an answer.

Does anyone know of an ASM routine where I can change which events give you a trainer star in FR? Or if this requires ASM at all?
  #56   Link to this post, but load the entire thread.  
Old December 30th, 2014 (9:46 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by TheRabbit View Post
I posted this in the ASM resource thread but didn't get an answer.

Does anyone know of an ASM routine where I can change which events give you a trainer star in FR? Or if this requires ASM at all?
Someone did answer it actually. The stickers in your card are determined by a few variables being certain values. Take a look at the script at 0x1B2938, and play around with the non-temporary variables in that script.

Quote:
Originally Posted by Knight of Duty View Post
I do not know whether this should be here but...well Mr. FBI Agent posted a silent evolution code in his thread. Well i am learning the way of third generation battle mechanism and found a way to call a ASM in battle. So, my question is that if i adjust the party slot value in the variable and then call the ASM 1, would it change anything?
Yeah, it would evolve your Pokemon. It's not that simple though. The sprite isn't updated, so you will need to update the sprite in battle yourself.
__________________
...
  #57   Link to this post, but load the entire thread.  
Old December 30th, 2014 (11:02 AM).
TheRabbit TheRabbit is offline
Banned
 
Join Date: Jul 2014
Gender: Male
Posts: 69
Quote:
Originally Posted by FBI agent View Post
Someone did answer it actually. The stickers in your card are determined by a few variables being certain values. Take a look at the script at 0x1B2938, and play around with the non-temporary variables in that script.
I'm not talking about stickers though. That script isn't related to the Dodrio game, or completing the pokedex. Those are just the random dumb stickers you get for hatching a certain amount of eggs and stuff. I'm referring to the events that add a star to your card and completely change the color.
  #58   Link to this post, but load the entire thread.  
Old January 1st, 2015 (4:18 AM).
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
Hello, I don't quite understand something about certain routine. It's KDS's Wide Lens(FR) routine. Here's the code:
Spoiler:
At 1E050: 00 4A 10 47 XX+1 XX XX 08
ZZ is the mystery byte of your item.
.text
.align 2
.thumb
.thumb_func

ldr r0, =0x2023d6b
ldrb r0, [r0, #0x0]
mul r0, r5
add r0, r0, r7
add r0, #0x2e
ldrh r0, [r0, #0x0]
bl geteffect
cmp r0, #0xZZ
bne noboost

mov r0, #0x6E
mul r0, r4
mov r1, #0x64
bl divide
lsl r0, r0, #0x10
lsr r4, r0, #0x10

noboost:
mov r0, #0x0
str r0, [sp, #0x0]
mov r0, #0x13
mov r1, #0x0
ldr r2, return
bx r2

divide:
ldr r2, divider
bx r2

geteffect:
ldr r1, getbyte
bx r1

.align 2
getbyte: .word 0x0809A925
divider: .word 0x081E4019
return: .word 0x0801E059


So the first thing is "At 1E050: 00 4A 10 47 XX+1 XX XX 08". Does it mean that if I inserted the code into, say 0078D540, I'm supposed to go to the offset "1E050" and change the XX bytes to "79(because 78+1?) D5 40"?

Another thing is that "mystery byte". I'm supposed to change the "0xZZ" in the code to...what exactly? I'm thinking about indices of items. For example there's a ??????? item with the index 112 (70 in hex). So I put 0x70 and everything's fine?

The last thing I'm confused is where exactly is this item. Is it in the place of the ??????? item that I was talking about before? Or do I have to do something else to place it there?

I'd be very glad if someone could explain this to me. Thanks in advance.
  #59   Link to this post, but load the entire thread.  
Old January 1st, 2015 (7:17 AM).
daniilS's Avatar
daniilS daniilS is offline
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 23
Gender: Male
Posts: 409
Quote:
Originally Posted by DizzyEgg View Post
Hello, I don't quite understand something about certain routine. It's KDS's Wide Lens(FR) routine. Here's the code:
Spoiler:
At 1E050: 00 4A 10 47 XX+1 XX XX 08
ZZ is the mystery byte of your item.
.text
.align 2
.thumb
.thumb_func

ldr r0, =0x2023d6b
ldrb r0, [r0, #0x0]
mul r0, r5
add r0, r0, r7
add r0, #0x2e
ldrh r0, [r0, #0x0]
bl geteffect
cmp r0, #0xZZ
bne noboost

mov r0, #0x6E
mul r0, r4
mov r1, #0x64
bl divide
lsl r0, r0, #0x10
lsr r4, r0, #0x10

noboost:
mov r0, #0x0
str r0, [sp, #0x0]
mov r0, #0x13
mov r1, #0x0
ldr r2, return
bx r2

divide:
ldr r2, divider
bx r2

geteffect:
ldr r1, getbyte
bx r1

.align 2
getbyte: .word 0x0809A925
divider: .word 0x081E4019
return: .word 0x0801E059


So the first thing is "At 1E050: 00 4A 10 47 XX+1 XX XX 08". Does it mean that if I inserted the code into, say 0078D540, I'm supposed to go to the offset "1E050" and change the XX bytes to "79(because 78+1?) D5 40"?
You'd have to reverse the bytes, making 41 D5 78.

Another thing is that "mystery byte". I'm supposed to change the "0xZZ" in the code to...what exactly? I'm thinking about indices of items. For example there's a ??????? item with the index 112 (70 in hex). So I put 0x70 and everything's fine?
I think you have to change the item's mystery byte with an item editor and change ZZ to what you put there.

The last thing I'm confused is where exactly is this item. Is it in the place of the ??????? item that I was talking about before?
Yes.
Or do I have to do something else to place it there?
Yes, you have to change the item's mystery byte like I said.

I'd be very glad if someone could explain this to me. Thanks in advance.
Replies are in bold.
__________________
  #60   Link to this post, but load the entire thread.  
Old January 1st, 2015 (11:27 AM).
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
Hello, I've got another problem and I still don't understand basic things. Help would be appreciated.
So, I tried to insert this routine. Now, the routine consists of two parts. I inserted the first one, the item check routine, to offset 0x78D310. However I had some trouble with the other one. Here's the code
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global heatrock

main:
ldr r1, .address
mov r0, #0x4
strb r0, [r1, #0x5]
push {r0-r3}
bl itemcheck
cmp r0, #0x4A @change this number to your desired held item effect number.
bne original
pop {r0-r3}
ldr r0, .weatherturns
mov r1, #0x8
strb r1, [r0, #0x0]
b return

itemcheck:
ldr r0, .routine
bx r0

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

return:
ldr r0, .return
bx r0

.align 2
.address: .word 0x02023E82
.routine: .word 0x08800001
.weatherturns: .word 0x02023F48
.return: .word 0x0802B313

@ insert 00 49 08 47 XX XX XX 08 at 0802B304


The first thing is
Quote:
#0x4A @change this number to your desired held item effect number.
I tried many item editors, but there's no such thing as "effect number". There's mystery bytes, index, special, but no effect number. So, my question is what do I write here?

Another thing is that the author of the routine wrote
Quote:
If you look closely, you'll notice .routine: .word 0x08800001 in every one of the rock routines(there were 4, I chose heat rock one). Change the address to the address you inserted your first routine (the item check routine) at.
I thought I knew what I should do however I was wrong.
Quote:
.routine: .word 0x08800001
The problem is my offset was 0x78D310. And that would mean that there's one digit missing. So, my second question is how do I write the offset here. Do I write it "0x8myoffset" or "0xmyoffset"? Oh and also do I reverse the order or is reversing only necessary to pointers?

There's something else. Let's assume I inserted both routines. Where is this item? Does the place depend on the "effect number"? Also, what's the index of this new item? How would I give it to player if I don't know the index? Besides, do I have to write a script to make this item work or is it unnecessary?
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
  #61   Link to this post, but load the entire thread.  
Old January 1st, 2015 (1:18 PM).
HidoranBlaze's Avatar
HidoranBlaze HidoranBlaze is offline
 
Join Date: Apr 2013
Age: 26
Gender: Male
Posts: 252
Quote:
Originally Posted by DizzyEgg View Post
Hello, I've got another problem and I still don't understand basic things. Help would be appreciated.
So, I tried to insert this routine. Now, the routine consists of two parts. I inserted the first one, the item check routine, to offset 0x78D310. However I had some trouble with the other one. Here's the code
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global heatrock

main:
ldr r1, .address
mov r0, #0x4
strb r0, [r1, #0x5]
push {r0-r3}
bl itemcheck
cmp r0, #0x4A @change this number to your desired held item effect number.
bne original
pop {r0-r3}
ldr r0, .weatherturns
mov r1, #0x8
strb r1, [r0, #0x0]
b return

itemcheck:
ldr r0, .routine
bx r0

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

return:
ldr r0, .return
bx r0

.align 2
.address: .word 0x02023E82
.routine: .word 0x08800001
.weatherturns: .word 0x02023F48
.return: .word 0x0802B313

@ insert 00 49 08 47 XX XX XX 08 at 0802B304


The first thing is I tried many item editors, but there's no such thing as "effect number". There's mystery bytes, index, special, but no effect number. So, my question is what do I write here?

Another thing is that the author of the routine wrote I thought I knew what I should do however I was wrong.
The problem is my offset was 0x78D310. And that would mean that there's one digit missing. So, my second question is how do I write the offset here. Do I write it "0x8myoffset" or "0xmyoffset"? Oh and also do I reverse the order or is reversing only necessary to pointers?

There's something else. Let's assume I inserted both routines. Where is this item? Does the place depend on the "effect number"? Also, what's the index of this new item? How would I give it to player if I don't know the index? Besides, do I have to write a script to make this item work or is it unnecessary?
Ah, sorry. I'm using LSA's item editor atm, so I'm used to that. In other editors, you'll probably want to edit the first special byte. Should be the same for KDS's routine as well; he said mystery byte, but I think he meant the first special byte, since that's if I'm not mistaken, the 18th byte in the item data structure that we all love. You'll want to use an unused number of course; don't give Heat Rock the special byte 22 in hex for example, or you'll end up with a second Soul Dew. For your second question, its .routine: .word 0x08myoffset. Don't reverse the order btw.
Also, I think you're a bit confused. It's not really "Where is this item?", because you're making a new one :p. What you want to do is open up your item editor, find an unused item index (the ????? slots) and make your new item. Name it Heat Rock, give it your desired special byte, etc. Also, you don't need to write a script for this item, because my ASMAGIX will automatically make it work. Enjoy your 8 turns of Sunny Day :D.

EDIT: Also, XX XX XX is just the reversed pointer to the location of your heat rock routine. For example, if you inserted it at 0x800000, you'd put 01 00 80.
  #62   Link to this post, but load the entire thread.  
Old January 3rd, 2015 (11:39 AM).
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
I've got a big problem. I found that routine. It's supposed to change the EVs of trainers' pokemon. However there are many things I don't understand about it...I'm looking for someone who could explain it to me in detail. My rom is fire red.
So, the first part is actually simple and it's about inserting a routine. But something's strange...The author says:
Quote:
The bulk of this code is at xF90000- that part doesn't have to go there, it can be moved to wherever you have free space. Just make sure you change Method_Addr to whatever you change the offset to + 1.
Basically all of the code is at F90000 and I insert it at the exact place in my rom. However there are also two bytes (that aren't 00 in the compiled routine) and I don't know what to do with them. Should I copy them and paste into my rom(at the same offset) or just ignore them?
Moving on
Quote:
You will also need to find x1000 bytes of space, and change the .EV_Table variable in the method to point to it (I used xF00000). This is where the spreads will go. The method gives you 256 spreads to use- this is not full control, but it is more than you are likely to need (the Emerald Battle Frontier only uses around 36 IIRC). The EV Spread table format is:...
To make things less complicated I didn't change the .EV_Table and decided to also use 0xF00000.
I don't understand, however, how I'm supposed to "point to it". Is it done by pointers? If so where do I insert those? At what offset?
Then...
Quote:
To assign an EV spread to a trainer's pokemon, set the value that was formerly their IVs to which slot in the table you want that pokemon to use. If you are using A-Trainer, this value is erroneously marked as AI Value. Note that the method only works for trainers with custom movesets and items- if they use default movesets or items, it will only affect IVs. It will still work if you manually give the trainer the moves it would have by default or explicitly define their mons as being empty-handed though.
Alright, I checked it in A-trainer and there is a value called "AI value". But I have no idea how to set it to a slot in the table. I tried looking for pokemon's offsets but there are only trainers' ones.
Could anyone help me, please?
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
  #63   Link to this post, but load the entire thread.  
Old January 4th, 2015 (2:12 AM). Edited January 4th, 2015 by ShyRayq.
ShyRayq's Avatar
ShyRayq ShyRayq is offline
Unprofessional Unprofessional
 
Join Date: Aug 2007
Gender: Male
Nature: Adamant
Posts: 1,855
Quote:
Originally Posted by DizzyEgg View Post
I've got a big problem. I found that routine. It's supposed to change the EVs of trainers' pokemon. However there are many things I don't understand about it...I'm looking for someone who could explain it to me in detail. My rom is fire red.
So, the first part is actually simple and it's about inserting a routine. But something's strange...The author says:
Basically all of the code is at F90000 and I insert it at the exact place in my rom. However there are also two bytes (that aren't 00 in the compiled routine) and I don't know what to do with them. Should I copy them and paste into my rom(at the same offset) or just ignore them?
Moving on To make things less complicated I didn't change the .EV_Table and decided to also use 0xF00000.
I don't understand, however, how I'm supposed to "point to it". Is it done by pointers? If so where do I insert those? At what offset?
Then...Alright, I checked it in A-trainer and there is a value called "AI value". But I have no idea how to set it to a slot in the table. I tried looking for pokemon's offsets but there are only trainers' ones.
Could anyone help me, please?
Okay, this is just from a vague memory of looking at that thread so bear with me:
1. Do you mean there are 00 00s originally at F90000? Or do you mean that they're part of the ASM bin. file? If the first, leave them alone and paste it a few bytes below or go to a new offset. The quote says you can literally post the code anywhere. If the second, just paste it along with the rest of the code.

2. Okay so make your table. Let's say you put it at 0x900000. In the ASM code itself, near the bottom, there should be a place that says: .EV_Table variable: . After that, put a space and write .word 0x08 and then the offset to your table, in this case .word 0x08900000.

3. In your EV spread table (which can have 255 entries), make your spread. How to do so should be listed in the thread. Now, say it is the first entry in your list. Go into A-Trainer or whatever trainer editor you use and go to the Pokemon that will use that particular EV spread. Go to the "AI Value" or corresponding value and type in 01 or just 1. If the EV spread was the second entry, type in 02 or 2. And so on and so forth.
(In A-Trainer, Go to "Pokemon Data" and its the "AI Value", In Jambo's Unnamed Trainer Editor, its the "IVs" section next to the Pokemon's Level)

Hope this helped a bit.
__________________
3DS Friend Code: 5069-3944-3902
IGN: Peter; (X, Y, OR, AS, S, M, US, UM)
Friend Safari: (Fighting) Throh, Meditite, Breloom
Living Pokedex Complete: Y, C, R, LG, E, D, Pl, HG, B, B2, X, Y, OR, AS, M, UM, LGP, Sw, LA
Big thanks especially to DestinedJagold, Xerneas_X, Elements1, ~RNC~ and ThePoke Man

PM me if you want to trade, or add my FC.
  #64   Link to this post, but load the entire thread.  
Old January 11th, 2015 (7:45 PM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
Well, yesterday i tried to do something and realised i do not understand a few things, such as bit shifting and swi. Can anyone clarify those?
__________________
  #65   Link to this post, but load the entire thread.  
Old January 12th, 2015 (7:39 PM). Edited January 12th, 2015 by AkameTheBulbasaur.
AkameTheBulbasaur's Avatar
AkameTheBulbasaur AkameTheBulbasaur is offline
Akame Marukawa of Iyotono
 
Join Date: May 2013
Location: A place :D
Age: 25
Gender: Male
Nature: Docile
Posts: 408
I found this routine somewhere, and I've tried to find it again , but I cannot find it anywhere! Who made this routine? and how can I figure out how to use it!

Spoiler:
.text
.align 2
.thumb
.thumb_func


main:
push {r0-r4, lr}
ldr r1, =(0x20370C0) @var 0x8004
ldrb r1, [r1]
mov r2, #0x64
mul r1, r1, r2
ldr r0, =(0x2024284)
add r0, r0, r1 @slot
mov r4, r0 @save slot
mov r1, #0x2E
ldr r3, =(0x803FBE8 +1)
bl linker
cmp r0, #0x1
beq setZero
mov r0, #0x1
b setNew

setZero:
mov r0, #0x0

setNew:
lsl r0, r0, #0x18
lsr r0, r0, #0x18
ldr r2, =(0x20370D0) @set inverse
strb r0, [r2]
mov r0, r4
mov r1, #0x2E
ldr r3, =(0x804037C +1)
bl linker
pop {r0-r4, pc}

linker:
bx r3

.align 2
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
  #66   Link to this post, but load the entire thread.  
Old January 12th, 2015 (7:51 PM).
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
Quote:
Originally Posted by AkameTheBulbasaur View Post
I found this routine somewhere, and I've tried to find it again , but I cannot find it anywhere! Who made this routine? and how can I figure out how to use it!

Spoiler:
.text
.align 2
.thumb
.thumb_func


main:
push {r0-r4, lr}
ldr r1, =(0x20370C0) @var 0x8004
ldrb r1, [r1]
mov r2, #0x64
mul r1, r1, r2
ldr r0, =(0x2024284)
add r0, r0, r1 @slot
mov r4, r0 @save slot
mov r1, #0x2E
ldr r3, =(0x803FBE8 +1)
bl linker
cmp r0, #0x1
beq setZero
mov r0, #0x1
b setNew

setZero:
mov r0, #0x0

setNew:
lsl r0, r0, #0x18
lsr r0, r0, #0x18
ldr r2, =(0x20370D0) @set inverse
strb r0, [r2]
mov r0, r4
mov r1, #0x2E
ldr r3, =(0x804037C +1)
bl linker
pop {r0-r4, pc}

linker:
bx r3

.align 2
That's FBI agent's ability switcher. Its explanation is in his post.
__________________
  #67   Link to this post, but load the entire thread.  
Old January 12th, 2015 (8:52 PM).
AkameTheBulbasaur's Avatar
AkameTheBulbasaur AkameTheBulbasaur is offline
Akame Marukawa of Iyotono
 
Join Date: May 2013
Location: A place :D
Age: 25
Gender: Male
Nature: Docile
Posts: 408
Thank you! I looked everywhere for that. I didn't want to use it willy-nilly without knowing who made it/who to give credit to.
__________________
"The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
  #68   Link to this post, but load the entire thread.  
Old January 14th, 2015 (7:17 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by AkameTheBulbasaur View Post
Thank you! I looked everywhere for that. I didn't want to use it willy-nilly without knowing who made it/who to give credit to.
You can probably tell if it's me depending on the word "linker" and how I assign variables using their direct address. Most people name "linker" something else and they use a .VAR or something for variables :D



Quote:
Originally Posted by Knight of Duty View Post
Well, yesterday i tried to do something and realised i do not understand a few things, such as bit shifting and swi. Can anyone clarify those?
Bit shifting is just binary manipulation and swi are software interrupts. SWI commands can be read up on at gbatek, there's quite a few and the technical details are very important.

I reccomend you read ShinyQuagsire's tutorial if you're just starting off and want to learn about bit shifting. Once you've got a handle on that, you can come back and read the rest of this post.

Bit shifting is just a binary manipulation and works just as it does on paper. There are two types of possible shifts, a left shift and a right shift. The left shift takes the current value in binary form and appends a zero to it, it then removes the leading bit. The right shift takes the current value in binary form and prefix's a 0 to it and removes the trailing bit.

Keeping in mind registers can only hold 32 bits (4-bytes)
Code:
mov r0, #0x1
lsl r0, r0, #0x1
After the mov instruction r0 would contain "00000001" in hex (which in this case is also the binary representation). Doing that lsl r0, r0, #0x1 command, as I explained, would then yield "00000010" in binary or "00000002" in hex.

Lets try something a little more complicated.

Code:
mov r0, #0x10
lsr r0, r0, #0x2
Here r0 after the mov instruction would contain '00000010" in hex, or "00010000" in binary. Now if we apply the lsr on the binary form we remove two trailing bits and prefix two zeros. That would give us: "00000100" or 0x4 in hex.

You'll notice that I'm showing you 8 bit values for the binary representation of a register which is supposed to contain 32 bits (4 bytes). That's because I'm way too lazy to type all of those zeros, and it doesn't matter for the small values we used :D
__________________
...
  #69   Link to this post, but load the entire thread.  
Old January 14th, 2015 (8:12 AM).
MadHacker151 MadHacker151 is offline
 
Join Date: Jan 2015
Posts: 29
This is an extremely stupid question but... Well, I'm used xse scripts like this- (extremely basic script)
Spoiler:

#dynamic 0x(Offset)
#org @start
lock
faceplayer
msgbox @1 0x6
release
end

#org @1
= Hi.\nWhat is your name?


Simple xse script, but what is this.. an ASM script? -
Spoiler:

.text
.align 2
.thumb
.thumb_func


main:
push {r0-r4, lr}
ldr r1, =(0x20370C0) @var 0x8004
ldrb r1, [r1]
mov r2, #0x64
mul r1, r1, r2
ldr r0, =(0x2024284)
add r0, r0, r1 @slot
mov r4, r0 @save slot
mov r1, #0x2E
ldr r3, =(0x803FBE8 +1)
bl linker
cmp r0, #0x1
beq setZero
mov r0, #0x1
b setNew

setZero:
mov r0, #0x0

setNew:
lsl r0, r0, #0x18
lsr r0, r0, #0x18
ldr r2, =(0x20370D0) @set inverse
strb r0, [r2]
mov r0, r4
mov r1, #0x2E
ldr r3, =(0x804037C +1)
bl linker
pop {r0-r4, pc}

linker:
bx r3

.align 2


That was just a random script I found on this thread... Anyway, what would you exactly call this type of script, and what program would you insert it in? XSE, or something else...

Again, sorry for the stupidest question on here but I just started learning scripting.... haha.
  #70   Link to this post, but load the entire thread.  
Old January 14th, 2015 (2:57 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by MadHacker151 View Post
This is an extremely stupid question but... Well, I'm used xse scripts like this- (extremely basic script)
Spoiler:

#dynamic 0x(Offset)
#org @start
lock
faceplayer
msgbox @1 0x6
release
end

#org @1
= Hi.\nWhat is your name?


Simple xse script, but what is this.. an ASM script? -
Spoiler:

.text
.align 2
.thumb
.thumb_func


main:
push {r0-r4, lr}
ldr r1, =(0x20370C0) @var 0x8004
ldrb r1, [r1]
mov r2, #0x64
mul r1, r1, r2
ldr r0, =(0x2024284)
add r0, r0, r1 @slot
mov r4, r0 @save slot
mov r1, #0x2E
ldr r3, =(0x803FBE8 +1)
bl linker
cmp r0, #0x1
beq setZero
mov r0, #0x1
b setNew

setZero:
mov r0, #0x0

setNew:
lsl r0, r0, #0x18
lsr r0, r0, #0x18
ldr r2, =(0x20370D0) @set inverse
strb r0, [r2]
mov r0, r4
mov r1, #0x2E
ldr r3, =(0x804037C +1)
bl linker
pop {r0-r4, pc}

linker:
bx r3

.align 2


That was just a random script I found on this thread... Anyway, what would you exactly call this type of script, and what program would you insert it in? XSE, or something else...

Again, sorry for the stupidest question on here but I just started learning scripting.... haha.
That's an assembly program. It's different from scripts and it definitely doesn't use XSE to compile. I suggest first learning some more complicated scripts and experience the ROM hacking world a little more before coming back to this topic.

I could explain it to you now, but I feel like it would confuse you even more. If you're interested there are tutorials about ASM in the tutorials section of this forum.
__________________
...
  #71   Link to this post, but load the entire thread.  
Old January 14th, 2015 (5:14 PM).
MadHacker151 MadHacker151 is offline
 
Join Date: Jan 2015
Posts: 29
Quote:
Originally Posted by FBI agent View Post
That's an assembly program. It's different from scripts and it definitely doesn't use XSE to compile. I suggest first learning some more complicated scripts and experience the ROM hacking world a little more before coming back to this topic.

I could explain it to you now, but I feel like it would confuse you even more. If you're interested there are tutorials about ASM in the tutorials section of this forum.
I have actually read and now know the concept of asm and what the basic things do, registers and such. I just don't know exacty what you use to compile these assembly scripts, and how they work. If possible, I'd love it if you could explain (in a basic way) what to use to compile assembly scripts and very briefly what an example script does :) To much to ask? Hehe... I feel I could understand you explaining asm to me if I re-read the explanation for a while, I feel if would really help a lot.

-Thanks
  #72   Link to this post, but load the entire thread.  
Old January 14th, 2015 (5:19 PM).
Danny0317's Avatar
Danny0317 Danny0317 is offline
Fluorite's back, brah
 
Join Date: Jun 2013
Age: 23
Gender: Male
Nature: Hasty
Posts: 1,067
Quote:
Originally Posted by MadHacker151 View Post
I have actually read and now know the concept of asm and what the basic things do, registers and such. I just don't know exacty what you use to compile these assembly scripts, and how they work. If possible, I'd love it if you could explain (in a basic way) what to use to compile assembly scripts and very briefly what an example script does :) To much to ask? Hehe... I feel I could understand you explaining asm to me if I re-read the explanation for a while, I feel if would really help a lot.

-Thanks
http://www.pokecommunity.com/showthread.php?t=313906

Btw, in ASM, it's a routine, not a script.
__________________
  #73   Link to this post, but load the entire thread.  
Old January 14th, 2015 (5:26 PM).
MadHacker151 MadHacker151 is offline
 
Join Date: Jan 2015
Posts: 29
Quote:
Originally Posted by Dark Sneasel View Post
Btw, in ASM, it's a routine, not a script.
Haha... Exactly as I said, I'm used to *scripts* like for xse. Well, I wasnt sure of the exact "thing" you would call an assembly routine, now I know...
  #74   Link to this post, but load the entire thread.  
Old January 15th, 2015 (6:49 PM).
Lance32497's Avatar
Lance32497 Lance32497 is offline
LanceKoijer of Pokemon_Addicts
 
Join Date: Aug 2014
Location: Criscanto town-Ginoa Region xD
Gender: Male
Nature: Adamant
Posts: 792
So, I'm here to ask many questions lol.

WHAT ARE REGISTERS FOR AND HOW THEY WILL ACT WHEN THE ROUTINE RUNS
★I'm a bit uncertain on how registers work when the routine has been called and I still dont know what register I will push in order for me to create a routine. I also dont know how will I use them when they are pushed. To make it short, what are registers for?★

HOW ASM'ers HERE KNOW WHAT RAM OFFSET WILL BE USED AND HOW THEY CAN LOCATE THE HEXES THAT NEED TO BE REPLACED
★Most of FBI routines have RAM OFFSET(correct me if I am wrong: like 0x02aaaaaaa: something like that) at the end. How they know what that ram offset does and importance in the routine they created. And After they made the routine, they will replace some bytes in Hex Editor in order to call that, and one thing I observed is they often used 00 00 48 blah blah then the reversed offset of the routine which is unknown to me what these bytes before the reversed +1 pointer of the routine do to execute the routine.★
WHAT WILL I START AS A BEGINNER?
★Since I am Beginner, I know that I need to master all the codes given by JPANs and HACKMEWs tutorial, but what would be the routine's function I start to create, do I need to study first how to change the status of a pokemon when routine has been called?★
that's all.
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
  #75   Link to this post, but load the entire thread.  
Old January 16th, 2015 (1:37 PM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Quote:
Originally Posted by Lance32497 View Post
So, I'm here to ask many questions lol.

WHAT ARE REGISTERS FOR AND HOW THEY WILL ACT WHEN THE ROUTINE RUNS
★I'm a bit uncertain on how registers work when the routine has been called and I still dont know what register I will push in order for me to create a routine. I also dont know how will I use them when they are pushed. To make it short, what are registers for?★

HOW ASM'ers HERE KNOW WHAT RAM OFFSET WILL BE USED AND HOW THEY CAN LOCATE THE HEXES THAT NEED TO BE REPLACED
★Most of FBI routines have RAM OFFSET(correct me if I am wrong: like 0x02aaaaaaa: something like that) at the end. How they know what that ram offset does and importance in the routine they created. And After they made the routine, they will replace some bytes in Hex Editor in order to call that, and one thing I observed is they often used 00 00 48 blah blah then the reversed offset of the routine which is unknown to me what these bytes before the reversed +1 pointer of the routine do to execute the routine.★
WHAT WILL I START AS A BEGINNER?
★Since I am Beginner, I know that I need to master all the codes given by JPANs and HACKMEWs tutorial, but what would be the routine's function I start to create, do I need to study first how to change the status of a pokemon when routine has been called?★
that's all.
1) I sense knowledge gaps in your questions. Did you actually read any ASM tutorials thoroughly? Try reading Jpan's thumb tutorial, he explains what each register is, in terms of functionality. Registers are just like 4 byte memory storage, which you can apply transformations to via ASM instructions such as sub, add, mul, mov ect. Some registers are special though, in the sense that you can't use all of these operations on them and they are expected to hold certain values. The program counter is an example of this. Normally you shouldn't use a register without pushing/popping it, save for the first 4 registers (r0-r3) in SAFE function calls. I say safe, because calling your own function from another existing function without proper preparation may mess up the yield of the function you're branching from.

2) When searching for things there's a kinda weird process which I use. First I check Knizz's IDA to see if he's discovered it already. If he hasn't, or if the address is DMA I would try to find where in the ROM the change occurs. Sometimes you get lucky and the DMA address has an easy algorithm to find the DMA address. Normally this isn't the case, and sometimes the game uses malloc. Then I backtrack and follow until I find where the change is done in RAM. Somethings are harder to find than others, but normally it's a similar process.

The Byte replacements you're talking about is normally just a hex version of instructions like this:
Code:
ldr rX, =(0xInsertion address +1)
bx rX
It's basically just like a jump in scripting. Though you'll notice, like jump, it doesn't store a return address, so we need to make our routine return manually by having a bx ect ourselves.

3) For Hackmew's tutorial, I would only read the first one. The second one doesn't really teach anything, and is too big of a technical jump for a beginner (not to mention his algorithm for shinies isn't very good). For starting off, I'd read Jpan's tutorial for a technical reference, then HackMew's first or ShinyQuagsire's tutorial are both similar. From there, you're rather screwed, because no one has a tutorial which would act as a good second step :D
__________________
...
Closed Thread

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:24 AM.