Guest User

Untitled

a guest
May 12th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 0.86 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <stdio.h>
  3. #include <tchar.h>
  4.  
  5. const char *coolstring = "The numeral for two is %i\n";
  6.  
  7. int GetNumber( DWORD num )
  8. {
  9.     _asm
  10.     {
  11.         PUSH EBP;
  12.         MOV EBP, ESP;
  13.  
  14.         PUSH EDX;
  15.         PUSH EBX;
  16.  
  17.         MOV EDX, 0;
  18.         MOV EBX, 16;
  19.     }
  20. _Loop:
  21.     _asm
  22.     {
  23.         ADD EDX, 1;
  24.         SUB EBX, 1;
  25.  
  26.         CMP EBX, 0;
  27.         JNZ _Loop;
  28.  
  29.         MOV EAX, [EBP+EDX];
  30.  
  31.         MOV ESP, EBP;
  32.  
  33.         POP EBX;
  34.         POP EDX;
  35.  
  36.         POP EBP;
  37.  
  38.         RETN;
  39.     }
  40. }
  41.  
  42. int main(int argc, _TCHAR* argv[])
  43. {
  44.     _asm
  45.     {
  46.         MOV EBP, ESP;
  47.  
  48.         PUSH ESI;
  49.         PUSH EDI;
  50.         PUSH EBP;
  51.  
  52.         MOV EDI, 0;
  53.         MOV ESI, 2;
  54.  
  55.     }
  56. _Loop:
  57.     _asm
  58.     {
  59.         PUSH 1;
  60.         CALL DWORD PTR [GetNumber];
  61.         ADD ESP, 4
  62.         ADD EDI, EAX;
  63.         SUB ESI, EAX;
  64.  
  65.         CMP ESI, 0;
  66.         JG _Loop;
  67.  
  68.         PUSH EDI;
  69.         PUSH coolstring;
  70.         CALL DWORD PTR [printf];
  71.  
  72.         MOV ESP, EBP;
  73.  
  74.         XOR EAX, EAX;
  75.         POP EDI;
  76.         POP ESI;
  77.         POP EBP;
  78.  
  79.         RETN;
  80.     }
  81. }
Add Comment
Please, Sign In to add comment