Nov 21, 2012 at 9:24 PM
Join Date: Aug 23, 2012
Location:
Posts: 3
You can write Cave Story hacks in C.
But you still need to know assembly.
Does anyone have a C to assembly translator?
That would be great. Then I wouldn't have to bother with the define statements.
*I hope this post is in the right forum
But you still need to know assembly.
Code:
#DEFINE
int asciiToNumber(int asciiValue) {="offset 421900 | push ebp | mov ebp, esp"
asciiValue=[ebp+8]
}="mov esp,ebp | pop ebp | retn"
"int *pointerToNumber = "="mov eax, "
"char "=
"digit0 = "="movzx edx, byte "
*pointerToNumber=[eax]
"int c = 0"="xor ecx, ecx"
"c += (digit - 0x30) * 1000"="sub edx, 30 | imul edx, edx, ~1000 | add ecx, edx"
"digit = *(pointerToNumber + 1)"="movzx edx, byte [eax + 1]"
"digit = *(pointerToNumber + 2)"="movzx edx, byte [eax + 2]"
"digit = *(pointerToNumber + 3)"="movzx edx, byte [eax + 3]"
"#def #"=
"c += (digit - 0x30) * 100"="sub edx, 30 | imul edx, edx, ~100 | add ecx, edx"
"c += (digit - 0x30) * 10"="sub edx, 30 | imul edx, edx, ~10 | add ecx, edx"
"c += digit - 0x30"="sub edx, 30 | add ecx, edx"
"return c"="mov eax, ecx | retn"
#ENDDEFINE
int asciiToNumber(int asciiValue) {
int c = 0;
int *pointerToNumber = asciiValue;
char digit = *pointerToNumber;
c += (digit - 0x30) * 1000;
digit = *(pointerToNumber + 1);
c += (digit - 0x30) * 100;
digit = *(pointerToNumber + 2);
c += (digit - 0x30) * 10;
digit = *(pointerToNumber + 3);
c += digit - 0x30;
return c;
}
Does anyone have a C to assembly translator?
That would be great. Then I wouldn't have to bother with the define statements.
*I hope this post is in the right forum