HomeHomeFAQSearchRegisterLog in

Share | 
 

 ASM Tutorial

View previous topic View next topic Go down 
AuthorMessage
Demonic722

avatar

Posts : 91
Group : Co-Forum Founder
Location : Chaos

PostSubject: ASM Tutorial   June 9th 2010, 8:51 pm

Action Replay: Action replay is a device used to "cheat the game". It can be used to unlock secret things in the game and get to places where you could never get to without an action replay. Making codes for the action replay is the hard part. You have to learn the assembly language (making difficult codes) for making codes and a "different" way for basic codes. Some codes can be made without the assembly language but the more advanced codes are made with assembly.

ARM9 ASM: ARM9 ASM is the assembly language used for Nintendo DS hacking. Certain things
in a code source does certain things. Below is a list of commands used for hacking (using asm):

Registers: Registers is like a dresser that you could use to put and take stuff out of. Registers that can be used freely: r0, r1, r2, r3, r4, r5, r8, r11, r12

Loading Commands:
•ldr=loads 32-bit write
•ldrh=loads 16-bit write
•ldrb=loads 8-bit write

Storing Commands:
•str=stores 32-bit write
•strh=stores 16-bit write
•strb=stores 8-bit write

*Additional Info on bit-writes*
Some Conversions:
•8bits=1byte
•4bits=half byte
•1byte=2digits

Bit Writes:
•8-bit writes=2XXXXXXX 000000YY
•16-bit writes=1XXXXXXX 0000YYYY
•32-bit writes=0XXXXXXX YYYYYYYY

•8-bit= writes up to 0-2 digits
•16-bit= writes up to 3-4 digits
•32-bit= writes up to 5-8 digits

*All Addresses on the Nintendo DS are 32-bit writes, they change on what you write to them.*

Other Commands You Need:
•mov=moves a register to another register (copies), or loads direct values (ex: mov r1, #2)
•add= adds a number to the value in a register (ex: add r1, #1)
•sub= subtracts a number of the value in a register (ex: sub r1, #1)
•subs= combination of cmp and sub
•cmp= compares a register to see if they are equal or not and whether or not to make the code continue or not (ex: cmp r1, r2)

Some cmp add-ons: b=branch
•blt=less than
•bgt=greater than
•beq=equal to
•bne=not equal
•bge=greater than or equal to
•ble=less than or equal to
•bxne lr=end if not equal

More Commands You Need:
•lsl= logical shift left (can be used to multiply)
•lsr= logical shift right (can be used to divide)
•tst= test a register to another
•bx lr/bx r14=end code

*There are more advanced commands*


Simple NDS Code: <Animal Crossing Wild World [U] [1.0]>
Code: Put 99,000 bells into Inventory Slot 1

ldr r0, Slot1 @loads slot 1 into register 0
ldrh r1, Item @loads item (99,000) into register 1
strh r1, [r0] @stores the money into slot 1 (register 0)
bx lr @end code

Slot1:
.long 0x21D88FE
Item:
.short 0x14FD

*The compiler would ignore anything after the @ so adding notes helps*

Analyzing the code [in depth]:
ldr r0, Slot1=load the 32bit Slot address, now r0 holds the slot
ldrh r1, Item=load the 16bit item, now r1 holds the money
strh r1, [r0]=store the 16bit item into the 32bit slot [store the money in the slot]
bx lr=end the code

The Literals:
Slot1=defines the name of the slot
.long 0x21D88FE=defines the slot 1 address [.long defines 32bit writes]
Item=defines the item
.short 0x14FD=defines the 99,000 money hex [.short defines 16bit writes]

Another Tutorial: http://siestacat.wordpress.com/learn-asm/

Tutorial By: Demonic


Last edited by Demonic on August 4th 2010, 8:07 pm; edited 4 times in total
Back to top Go down
TQX

avatar

Posts : 19
Group : Global Moderator
Location : Netherlands

PostSubject: Re: ASM Tutorial   June 10th 2010, 8:55 am

Thanks dude! Grin This is much appreciated Afro I have found this:


This example is ARM/Thumb assembly for CPUs such as the ARM7 and ARM9 available in GBA and NDS. The comments help the programmer understand the assembly code even better than the CPU does; the CPU will execute any instruction given to it without determining the consequences or raising concern. The responsibility of executing the right instructions falls soley on the programmer. This example brings to light what is meant by "human readable machine code." Compared to "0011010011101001100101..." the assembly is a lot more understandable.

That aside, assembly is not without its own faults. It is often very difficult for a novice (with no previous programming experience) to learn and understand. This is due to assembly's naturally low level; an assembly programmer talks to the machine in its own language (via a translator).

Programs that translate assembly into its machine code counter-part are called assemblers and are available for various target CPUs and platforms. The target CPU is what the assembler needs to output machine code for. The platform is the CPU/OS that a programmer will use to write the assembly and translate/assemble the code. Assembling code for a target that differs from the working platform called cross platform development.

Hacking assembly is just the opposite; a hacker will translate machine code into human-readable assembly to understand the code and make changes as necessary. A program which does this kind of translation is called a disassembler, which are just as widely available as assemblers. The trouble is, few disassemblers output assembly that can be assembled back into machine code by an assembler. For the purposes of this tutorial, doing so would be out of scope because it is not usually a requirement to rebuild an entire program just to hack it. Renegade64 contains a code assembler which is much closer to what a hacker will use when patching assembly.

Extra Image:

Website: http://www.bsfree.org/
Back to top Go down
MF Tlaxcala

avatar

Posts : 399
Group : Forum Founder
Location : Above Earth

PostSubject: Re: ASM Tutorial   June 10th 2010, 8:57 am

Stickyed this tutorail! Great work Smiley
Back to top Go down
http://nintendq.ephpbb.com
Demonic722

avatar

Posts : 91
Group : Co-Forum Founder
Location : Chaos

PostSubject: Re: ASM Tutorial   June 10th 2010, 8:25 pm

Yea, I actually made this for a school assignment and ended up posting it on here Razz
I hope this helps anyone who wants to learn ARM9 ASM.
Back to top Go down
Demonic722

avatar

Posts : 91
Group : Co-Forum Founder
Location : Chaos

PostSubject: Re: ASM Tutorial   June 10th 2010, 8:31 pm

Finding Addresses:ARM9:NDS Hacking:

For this tutorial I will demonstrate how to find a simple address to work on in Animal Crossing: Wild World

1. Download NO$GBA (or another emulator)
2. Download Emuhaste
3. Download Animal Crossing: Wild World [U] [1.0] Rom

4. Extract All
5. Open all programs
6. Play Animal Crossing until you can start moving around
7. Get some money in the game
8. On Emuhaste start snapshot
9. On Emuhaste search "=" since nothing changed

10. Add money to your wallet and search "+" because the value increased
11. Take money out and search "-" since the value decreased
12. Repeat the process until there's only one or little to no addresses left

Test the address that the amount of money your adding/subtracting is being written to.
Now for the ASM Source:


ldr r1, Wallet
ldr r2, Money
str r2,[r1]
bx lr

Wallet:
.long 0x21D891C
Money:
.short 0x1869F




023FF090 012FFF11
E0000000 00000016
E59F1008 E1DF20B8
E1C120B0 E12FFF1E
021D891C 0001869F
023FF090 E3520003

Simplified Version:
021D891C 0001869F

The code should look similar to this. 1869F in hexidecimal equals 99,999 in decimal so this code stores 99,999
or infinite money in your wallet. This is a very short code compared to others.


Emuhaste Commands:

+ searches for the address in which the value has increased
- searches for rhe address in which the value has decreased
= searches for the address in which the value remained constant (the same)
! searches for the address in which the value has changed

When searching for a specific name always type $[some word] first then find/search. EX: $apple

~Demonic~
Back to top Go down
Demonic722

avatar

Posts : 91
Group : Co-Forum Founder
Location : Chaos

PostSubject: Re: ASM Tutorial   June 10th 2010, 9:25 pm

Sorry for the triple post but I noticed someone already made a address finding tutorial Razz sorry lol..yu can take down that last post if ya like.
Back to top Go down
TQX

avatar

Posts : 19
Group : Global Moderator
Location : Netherlands

PostSubject: Re: ASM Tutorial   June 11th 2010, 10:24 am

Demonic wrote:
Sorry for the triple post but I noticed someone already made a address finding tutorial Razz sorry lol..yu can take down that last post if ya like.
That`s not needed, its also a good and a bit other tutorail Afro (it`s maybe even a lot easyer tutorail then the other one you are talking about Cheesy )
Back to top Go down
Demonic722

avatar

Posts : 91
Group : Co-Forum Founder
Location : Chaos

PostSubject: Re: ASM Tutorial   June 11th 2010, 3:17 pm

Eh, okay then lol Razz
If ya need anymore asm stuff I can write about only what I know Wink
Back to top Go down
TQX

avatar

Posts : 19
Group : Global Moderator
Location : Netherlands

PostSubject: Re: ASM Tutorial   June 12th 2010, 9:13 am

Demonic wrote:
Eh, okay then lol Razz
If ya need anymore asm stuff I can write about only what I know Wink
Sure, feel free to post other stuff if you want! Smiley
Back to top Go down
Demonic722

avatar

Posts : 91
Group : Co-Forum Founder
Location : Chaos

PostSubject: Re: ASM Tutorial   June 12th 2010, 9:55 am

ok then, I'll wait for a request since I'm not sure what should I post next Razz
Back to top Go down
AsPika2219

avatar

Posts : 27
Group : Advanced AR Hacker
Location : Kuching, Sarawak, Malaysia

PostSubject: Re: ASM Tutorial   June 16th 2010, 9:48 am

Thanks for tutorial! I will learn it right now! Cool
Back to top Go down
Sponsored content




PostSubject: Re: ASM Tutorial   

Back to top Go down
 

ASM Tutorial

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: Game Hacking :: Nintendo DS :: Help :: AR Code Creating Tutorials-