Coding

 Reply to this postStart new topic

ASM Crash

LINK/2012
post Feb 5 2012, 06:41 PM
Post #1


I will kill you

Posts: 126
Joined: 13-May 11



Ok guys, I'm trying to start injecting assembly into scm.

I'm using NASM to assemble the code.

I started with a very simple code:
CODE
mov eax, 0xB7CE50; 0xB7CE50 is money address
add [eax], dword 10000
ret


When NASM assembled:
CODE
66 B8 50 CE B7 00 67 66 81 00 10 27 00 00 C3


That seems a little strange for me, because I know that B8 is mov eax, and I didn't put anything before and this 66 appeared in the begining, the sequence 67 66 81 seemed strange too.

But ok, I put the code in Sanny:
CODE
{$CLEO}
0000:

while true
    wait 0
    0ADC:   test_cheat "MONEY"
    jf continue
    0AC6: 0@ = label @ASM offset
    0AA5: call 0@ num_params 0 pop 0
end

:ASM
hex
    66 B8 50 CE B7 00 67 66 81 00 10 27 00 00 C3
end


Compiled, play, typed MONEY and... CRASH! ermm.gif SHIT, I WAS SO EXCITED!

So, what is wrong? =/
I think that it's not my fault tongue.gif



This post has been edited by LINK2012: Feb 5 2012, 06:53 PM
Go to the top of the page
 
+Quote Post
Deji
post Feb 5 2012, 08:35 PM
Post #2


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Nice to see some advancement going on smile.gif

And I don't think it's your fault either...
CODE
66 B8 50 CE B7 00 67 66 81 00 10 27 00 00 C3


The 66 shouldn't be there. Remove it and try again smile.gif


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post Feb 5 2012, 09:36 PM
Post #3


I will kill you

Posts: 126
Joined: 13-May 11



Good! Now it is working!
I had to remove two 66, and a 67.
Thanks for that Deji smile.gif

EDITED: I setted NASM format to win32 and now it compiles well for San Andreas smile.gif

--
EDITED: The question that had here was compiler issue...
--

This post has been edited by LINK2012: Feb 9 2012, 01:45 PM
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members: