Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- format PE console
- entry start
- include 'win32ax.inc'
- include 'api\kernel32.inc'
- section '.data' data readable writeable
- x db 45
- y db 50
- r_1 dw ? ; = 47
- r_2 dw ? ; = 75
- section '.code' code readable executable
- start: mov eax, 0
- mov al, [x]
- mov bl, [y]
- add al, bl ; 1) 45 + 50 = 95
- shr al, 1 ; 2) 95 / 2 = 47 = r_1
- mov [r_1], ax
- ;------------------------
- mov eax, 0
- mov ebx, 0
- mov al, [x]
- mov bl, [y]
- mul bx ; 3) 50 * 45 = 2250
- mov bx, 30
- idiv bx ; 4) 2250/30 = 75 = r_2
- ;------------------------
- add ax, [r_1] ; 5) (r_1 + r_2) = (47 + 75) = 122 (answer)
- cinvoke printf, <"(x + y)/2 + (y * x)/30 = %d", 10, 0>, eax
- ;------------------------
- cinvoke scanf, <"%d", 10, 0>, 76313
- invoke ExitProcess, 0
- section '.idata' import data readable
- library kernel32, 'kernel32.dll',\
- msvcrt, 'msvcrt.dll'
- import msvcrt,\
- printf, 'printf',\
- scanf, 'scanf'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement