Kodewerx

Our culture has advanced beyond all that you could possibly comprehend with one hundred percent of your brain.
It is currently Thu Mar 28, 2024 5:42 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 23 posts ] 
Author Message
 Post subject: Custom ASM AR DS Codes
PostPosted: Sun Dec 10, 2006 6:25 am 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
Yeah, in Kenobi's AR DS Codetypes thing, that Is possible, but how do you convert them. Like if I had:
[code]
mov r0, #0x099
ldr r1, 0x00000001
strb r0, [r1]
;Please ignore syntax errors, I'm doing this quickly
[/code]
how could I put that in AR format?

Thanks!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 10, 2006 6:57 am 
Offline
Krew (Admin)
Krew (Admin)
User avatar

Joined: Sun Oct 01, 2006 9:26 pm
Posts: 3768
Title: All in a day's work.
Use an ARM assembler. I'm partial to GNU AS, which you can find in DevKitPro's DevKitAdv.

_________________
I have to return some video tapes.

Feed me a stray cat.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 10, 2006 7:32 am 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
I get this huge mass of data, and I can't figure out how much of it to use.
My code

[code]push {r0-r3}
mov r0, #0x2700
ldr r1, =0x020da7ee
strh r0, [r1]
mov r2, #0x2700
ldr r3, =0x020da7f0
strh r2, [r3]
pop {r0-r3}[/code]

Looking at the disassembaly in IDA didn't help much, I'm using arm-eabi-as, too.
Thanks
De


Last edited by DimondEdge on Sun Dec 10, 2006 8:54 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 10, 2006 7:37 am 
Offline
Komrade
Komrade
User avatar

Joined: Mon Oct 02, 2006 5:56 pm
Posts: 1978
Title: Mr. Bitches
Your BBcode isn't working; might want to check you don't have HTML enabled. ;)

_________________
Image
Image
<EggWerx> MetalOverlord: Dsman and lemmayoshi will be used for taco meat, ask mo he knows me.
jleemero wrote:
Being required to learn Java for a Comp Sci MAJOR is like being required to shit on a lawnmower to be an astronaut.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 10, 2006 11:12 am 
Offline
Kommunist
Kommunist

Joined: Tue Oct 10, 2006 9:32 am
Posts: 445
I changed your asm code to :

Code:
push  {r0,r1}
mov   r0, #0x2700
ldr   r1, =0x020da7ee
strh  r0, [r1]
add r1,#0x2
strh  r0, [r1]
pop   {r0-r1}
bx r14


Which gives, once 'translated' to asm :

Code:
E92D0003
E3A00C27
E59F1010
E1C100B0
E2811002
E1C100B0
E8BD0003
E12FFF1E
020DA7EE


So the AR code should look like this :
Code:
E0000000 00000024
E92D0003 E3A00C27
E59F1010 E1C100B0
E2811002 E1C100B0
E8BD0003 E12FFF1E
020DA7EE 00000000


(and don't forget to use the hack's activator before it).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 10, 2006 2:23 pm 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
But how do you "translate" the asm? Just compiling it dosen't seem to work.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 10, 2006 5:01 pm 
Offline
Kommunist
Kommunist

Joined: Thu Nov 09, 2006 10:15 am
Posts: 4
And while j'all on the subject, where do i learn me some o' this ASM?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Dec 10, 2006 10:58 pm 
Offline
Kommunist
Kommunist

Joined: Tue Oct 10, 2006 9:32 am
Posts: 445
DimondEdge wrote:
But how do you "translate" the asm? Just compiling it dosen't seem to work.


I use no$gba debugger version. I mainly use it to hack stuff (as it has breakpoints support and stuff like that), but I also found it useful when it comes to making custom asm routines. I write my code 'on the fly' by manually entering the instructions which the debugger compiles automatically.
Unfortunatly this proggy isn't free (the freeware version doesn't offer debugging features), so you have to 'buy' it for 15$.

But I guess any free arm assembler will do the trick.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 11, 2006 11:10 am 
Offline
Krew (Admin)
Krew (Admin)
User avatar

Joined: Sun Oct 01, 2006 9:26 pm
Posts: 3768
Title: All in a day's work.
Parasyte wrote:
Use an ARM assembler. I'm partial to GNU AS, which you can find in DevKitPro's DevKitAdv.

_________________
I have to return some video tapes.

Feed me a stray cat.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 11, 2006 2:16 pm 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
kenobi wrote:
I use no$gba debugger version. I mainly use it to hack stuff (as it has breakpoints support and stuff like that), but I also found it useful when it comes to making custom asm routines. I write my code 'on the fly' by manually entering the instructions which the debugger compiles automatically.
Unfortunatly this proggy isn't free (the freeware version doesn't offer debugging features), so you have to 'buy' it for 15$.

But I guess any free arm assembler will do the trick.


Cool! I actually just recived my copy, so I'll try it. Thanks!

_________________
<Insomniak`> Stupid fucking Google
<Insomniak`> "The" is a common word, and was not included in your search
<Insomniak`> "Who" is a common word, and was not included in your search


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 11, 2006 4:08 pm 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
I get to
ldr r1, =0x020da7ee
and it says paramiter fail. What's wrong? (no$gba)

_________________
<Insomniak`> Stupid fucking Google
<Insomniak`> "The" is a common word, and was not included in your search
<Insomniak`> "Who" is a common word, and was not included in your search


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 11, 2006 4:42 pm 
Offline
Komrade
Komrade
User avatar

Joined: Mon Oct 02, 2006 5:56 pm
Posts: 1978
Title: Mr. Bitches
Parasyte (prediction) wrote:
No$hitGBA sucks ass. Martin Kroth can go to hell.

_________________
Image
Image
<EggWerx> MetalOverlord: Dsman and lemmayoshi will be used for taco meat, ask mo he knows me.
jleemero wrote:
Being required to learn Java for a Comp Sci MAJOR is like being required to shit on a lawnmower to be an astronaut.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Dec 12, 2006 12:06 am 
Offline
Kommunist
Kommunist

Joined: Wed Oct 11, 2006 4:59 pm
Posts: 19
DimondEdge wrote:
I get to
ldr r1, =0x020da7ee
and it says paramiter fail. What's wrong? (no$gba)


Okay, somewhere down below, after your written code, assemble something like

Code:
mov r0, 0xFE
mov r0, 0xFD
mov r0, 0xFC


Now, right beside the said assembled instructions will be the values they corrospond to.
Code:
E3A000FE
E3A000FD
E3A000FC


Now. Where you want ldr r1, =0x020DA7EE, first assemble ldr r1, =0xE3A000FE.

Once you are done that, go back to the instruction, and reassemble it as ldr r1, =0x020DA7EE.

This should take care of that problem. The big thing, is if you assemble by hand like this, you need to know how many instructions down you wish to do this, and load the mov r0, 0xFE, etc... there. (If your code actually does use mov r0, 0xFE, then don't use that as a planned data item, but rather, use some instruction not being used as code.)

I have done this before, in manually writing smaller code segments. If you need to write a larger code segment, then you are better off using an assembler for this purpose.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Dec 12, 2006 9:05 am 
Offline
Krew (Admin)
Krew (Admin)
User avatar

Joined: Sun Oct 01, 2006 9:26 pm
Posts: 3768
Title: All in a day's work.
You may be better off learning to use a real assembler, given such circumstances!!
Parasyte wrote:
Parasyte wrote:
Use an ARM assembler. I'm partial to GNU AS, which you can find in DevKitPro's DevKitAdv.

Dualscreenman wrote:
Parasyte (prediction) wrote:
No$hitGBA sucks ass. Martin Kroth can go to hell.

_________________
I have to return some video tapes.

Feed me a stray cat.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Dec 12, 2006 1:53 pm 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
Parasyte wrote:
You may be better off learning to use a real assembler, given such circumstances!!


I tried arm-eabi-as, I get a 3-400 byte output. Is there a flag or something to set?

_________________
<Insomniak`> Stupid fucking Google
<Insomniak`> "The" is a common word, and was not included in your search
<Insomniak`> "Who" is a common word, and was not included in your search


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Dec 12, 2006 6:04 pm 
Offline
Krew (Admin)
Krew (Admin)
User avatar

Joined: Sun Oct 01, 2006 9:26 pm
Posts: 3768
Title: All in a day's work.
Assemble it like this:

Code:
arm-eabi-as -o source.o source.s
arm-eabi-objcopy -O binary source.o source.bin


Taking Kenobi's code for example (which is weird; he assembled it as ARM, when it looks more like Thumb), source.s will look something like this:
Code:
    .text
    .org 0
    .arm

_start:
    stmfd   sp!, {r0,r1}
    mov     r0, #0x2700
    ldr     r1, =0x020DA7EE
    strh    r0, [r1]
    strh    r0, [r1,#2]
    ldmfd   sp!, {r0,r1}
    bx      lr

    .pool


Or if you really do want Thumb:
Code:
    .text
    .org 0
    .thumb

_start:
    push    {r0,r1}
    mov     r0, #0x27
    lsl     r0, #8
    ldr     r1, =0x020DA7EE
    strh    r0, [r1]
    add     r1, #2
    strh    r0, [r1]
    pop     {r0,r1}
    bx      lr

    .align 2
    .pool

_________________
I have to return some video tapes.

Feed me a stray cat.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Dec 12, 2006 6:20 pm 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
Ah. Ok. Thanks for the help!

_________________
<Insomniak`> Stupid fucking Google
<Insomniak`> "The" is a common word, and was not included in your search
<Insomniak`> "Who" is a common word, and was not included in your search


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 13, 2006 12:12 am 
Offline
Krew (Moderator)
Krew (Moderator)
User avatar

Joined: Mon Oct 02, 2006 7:05 pm
Posts: 494
Location: In Time
Title: Algorithm Strategist
You won't find help like that anywhere else on the net. You know it, we know it, and you need to let everyone else know it too.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 13, 2006 4:19 pm 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
Hmz... I'm still not getting something... I've assembled it, but I don't know where to get the actual things kenobi was showing me. Am I missing something? Should I debug it with VBA or my Xport or something?

_________________
<Insomniak`> Stupid fucking Google
<Insomniak`> "The" is a common word, and was not included in your search
<Insomniak`> "Who" is a common word, and was not included in your search


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 13, 2006 6:10 pm 
Offline
Krew (Admin)
Krew (Admin)
User avatar

Joined: Sun Oct 01, 2006 9:26 pm
Posts: 3768
Title: All in a day's work.
open source.bin in a hex editor, like Hex Workshop. You then need to adjust the endianness (though this can probably be done by GNU AS, directly) which is a matter of byte swapping each 32-bit word. You can do this manually by hand, or through the tools menu in Hex Workshop. Finally, copy each of the 32-bit words, and write them into DS memory using the proper AR code types. And there you go.

_________________
I have to return some video tapes.

Feed me a stray cat.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Dec 15, 2006 8:18 pm 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
My out put "source.bin" is
Code:
03B427200002034908800231088003BC70470000EEA70D02

I cant find the byte swap thing in the tools. Also, changing to Big Endian, everything just
stays the same...

_________________
<Insomniak`> Stupid fucking Google
<Insomniak`> "The" is a common word, and was not included in your search
<Insomniak`> "Who" is a common word, and was not included in your search


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Dec 15, 2006 8:59 pm 
Offline
Krew (Admin)
Krew (Admin)
User avatar

Joined: Sun Oct 01, 2006 9:26 pm
Posts: 3768
Title: All in a day's work.
Tools -> Operations -> Byte Flip

That appears to be Thumb binary, so you will want to byte flip as 16-bit, instead of 32-bit.

_________________
I have to return some video tapes.

Feed me a stray cat.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Dec 16, 2006 7:03 am 
Offline
Kommunist
Kommunist

Joined: Sun Nov 19, 2006 11:23 am
Posts: 37
Location: At my computer... -_-
So then I just use that with the ASM activator? Cool!

_________________
<Insomniak`> Stupid fucking Google
<Insomniak`> "The" is a common word, and was not included in your search
<Insomniak`> "Who" is a common word, and was not included in your search


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 132 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group