Thread: [Tutorial] HackMew's Knowledge
View Single Post
  #112    
Old February 3rd, 2013 (06:46 AM).
FBI agent's Avatar
FBI agent FBI agent is offline
If my PM box is full, VM instead :x
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 818
Quote originally posted by Chaos Rush:
I decided to take a crack at HackMew's ASM challenge, and I succeeded!


Spoiler:
This is what I modified the routine to:
Code:
.text
.align 2
.thumb
.thumb_func
.global lesson1

main:
	push {r0-r1, lr}
	ldr r0, .PLAYER_DATA
	ldr r0, [r0]
	ldr r1, .VAR
	ldrh r0, [r0, #0xC]
	strh r0, [r1]	
	ldr r0, .PLAYER_DATA
	ldr r0, [r0]
	ldr r1, .NEXT
	ldrh r0, [r0, #0xA]
	strh r0, [r1]
	pop {r0-r1, pc}


.align 2
.PLAYER_DATA:
	.word 0x0300500C
.VAR:
	.word 0x020270B6 + (0x800D * 2)
.NEXT:
	.word 0x020270B8 + (0x8000 * 2)
And the XSE script:
Code:
#dynamic 0x800000
#org @main
callasm YourASMoffset
buffernumber 0x0 LASTRESULT
buffernumber 0x1 0x8000
msgbox @msg MSG_FACE
end


#org @msg
= Your Trainer ID is [buffer2].\nYour Secret ID is [buffer1].


Going to do my best to get ASM down...
Spoiler tags, pls!
Also, you don't need to load player data twice.
It should till work without doing this the second time:
ldr r0, .PLAYER_DATA
ldr r0, [r0]

EDIT: I lied, the way you did it, you did need to load it twice (or subtract :D).
__________________
...

My name forum name is FBI Agent, though you can call me FBI because it's shorter.

Some of my stuff:
ASM request/resource thread
ASM tutorials thread
ASM Workshop
Reply With Quote