Advertisement
MaksNew

Untitled

Feb 16th, 2021
1,617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. format PE console
  2. entry start
  3.  
  4. include 'win32a.inc'
  5.  
  6. section '.data' data readable writable
  7.         formatNum db '%d', 0
  8.         a dd ?
  9.         b dd ?
  10.         c dd ?
  11.         d dd ?
  12.         what db "This program calculate ((a-8)*b+c)/d+4 ",0
  13.         strEnterA db 13,10,'Enter A: ',0
  14.         strEnterB db 13,10,'Enter B: ',0
  15.         strEnterC db 13,10,'Enter C: ',0
  16.         strEnterD db 13,10,'Enter D: ',0
  17.         result db 'Result: %d', 0
  18.         NULL = 0
  19. section  '.code' code readable executable
  20.  
  21.          start:
  22.                 push what
  23.                 call [printf]
  24.  
  25.                 push strEnterA;;1
  26.                 call [printf]
  27.  
  28.                 push a
  29.                 push formatNum
  30.                 call [scanf] ;
  31.  
  32.  
  33.                 sub [a], 8
  34.  
  35.                 push strEnterB;;2
  36.                 call [printf]
  37.  
  38.                 push b
  39.                 push formatNum
  40.                 call [scanf] ;
  41.  
  42.                 mov eax, [a]
  43.                 mul [b]
  44.  
  45.                 push eax
  46.                 push result
  47.                 call[printf];;;;;;  eax = (a-8)*b
  48.  
  49.                 push strEnterC
  50.                 call [printf]
  51.  
  52.                 push c
  53.                 push formatNum
  54.                 call [scanf] ;
  55.  
  56.                 add eax, [c]
  57.  
  58.                 push eax
  59.                 push result
  60.                 call[printf];;;;;;  eax должен быть =  (a-8)*b+c но это не так (?)
  61.  
  62.                 call[getch]
  63.  
  64.  
  65.                 push NULL
  66.                 call[ExitProcess]
  67.  
  68. section '.idata' import data readable
  69.  
  70.         library kernel, 'kernel32.dll', \
  71.                 msvcrt, 'msvcrt.dll'
  72.  
  73.         import kernel, \
  74.                ExitProcess, 'ExitProcess'
  75.         import msvcrt,\
  76.                printf, 'printf',\
  77.                getch, '_getch',\
  78.                scanf, 'scanf'
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement