Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <stdio.h>
- #include <tchar.h>
- const char *coolstring = "The numeral for two is %i\n";
- int GetNumber( DWORD num )
- {
- _asm
- {
- PUSH EBP;
- MOV EBP, ESP;
- PUSH EDX;
- PUSH EBX;
- MOV EDX, 0;
- MOV EBX, 16;
- }
- _Loop:
- _asm
- {
- ADD EDX, 1;
- SUB EBX, 1;
- CMP EBX, 0;
- JNZ _Loop;
- MOV EAX, [EBP+EDX];
- MOV ESP, EBP;
- POP EBX;
- POP EDX;
- POP EBP;
- RETN;
- }
- }
- int main(int argc, _TCHAR* argv[])
- {
- _asm
- {
- MOV EBP, ESP;
- PUSH ESI;
- PUSH EDI;
- PUSH EBP;
- MOV EDI, 0;
- MOV ESI, 2;
- }
- _Loop:
- _asm
- {
- PUSH 1;
- CALL DWORD PTR [GetNumber];
- ADD ESP, 4
- ADD EDI, EAX;
- SUB ESI, EAX;
- CMP ESI, 0;
- JG _Loop;
- PUSH EDI;
- PUSH coolstring;
- CALL DWORD PTR [printf];
- MOV ESP, EBP;
- XOR EAX, EAX;
- POP EDI;
- POP ESI;
- POP EBP;
- RETN;
- }
- }
Add Comment
Please, Sign In to add comment