// Program to reverse a string in Assembly
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char array[] = "This is shitty";
unsigned int len = 0;
len = strlen(array);
__asm
{
push esp
push ecx
push eax
push ebx
xor ecx, ecx
xor eax, eax
xor ebx, ebx
lea eax, array
up: mov bl, [eax + ecx]
push ebx
inc ecx
cmp ecx, len
jne up
down: pop ebx
mov [eax], bl
dec ecx
inc eax
cmp ecx, 0h
jnz down
pop ebx
pop eax
pop ecx
pop esp
}
cout << "New Array = " << array << endl;
return 0;
}
Machine - Intel x86
Exe Size - 220 KB
No comments:
Post a Comment