Pushok

square equations

Mar 8th, 2011
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .386
  2. .model flat,stdcall
  3. option   casemap:none
  4.     include \masm32\include\masm32.inc
  5.     include \masm32\include\gdi32.inc
  6.     include \masm32\include\user32.inc
  7.     include \masm32\include\kernel32.inc
  8.     include \masm32\include\shell32.inc
  9.     include \masm32\macros\macros.asm
  10.     include \masm32\include\msvcrt.inc
  11.  
  12.     includelib \masm32\lib\masm32.lib
  13.     includelib \masm32\lib\gdi32.lib
  14.     includelib \masm32\lib\user32.lib
  15.     includelib \masm32\lib\kernel32.lib
  16.     includelib \masm32\lib\shell32.lib
  17.     includelib  \masm32\lib\msvcrt.lib
  18.     P proto :DWORD, :DWORD
  19. .DATA
  20.     Info db "%d,%d,%d",0
  21.     Answ db "x1 = %d.%d, x2 = %d.%d",0
  22.     _a dword ?
  23.     _b dword ?
  24.     _c dword ?
  25.     _d dword ?
  26.     _pr dword ?
  27.     _aa_1 dword ?
  28.     _as_1 dword ?
  29.     _aa_2 dword ?
  30.     _as_2 dword ?
  31. .CODE
  32. START:
  33.     push offset _c
  34.     push offset _b
  35.     push offset _a
  36.     push offset Info
  37.     call crt_scanf
  38.     mov eax,_b
  39.     mul _b
  40.     mov ebx,eax
  41.     mov eax,4
  42.     mul _a
  43.     mul _c
  44.     sub ebx,eax
  45.     mov _d,ebx
  46.     cmp _d,0
  47.     jl EXIT
  48.     push offset _d
  49.     call crt_sqrt
  50.     mov _d,eax
  51.     neg _b
  52.     mov ebx,_b
  53.     mov _pr,ebx
  54.     add _pr,eax
  55.     push edx
  56.     xor edx,edx
  57.     mov eax,2
  58.     mul _a
  59.     mov ebx,eax
  60.     mov eax,_pr
  61.     div ebx
  62.     mov _aa_1,eax
  63.     mov _as_1,edx
  64.     mov eax,_d
  65.     sub _b,eax
  66.     xor edx,edx
  67.     mov eax,2
  68.     mul _a
  69.     mov ebx,eax
  70.     mov eax,_b
  71.     div ebx
  72.     mov _aa_2,eax
  73.     mov _as_2,ebx
  74.     pop edx
  75.     push _aa_1
  76.     push _as_1
  77.     push _aa_2
  78.     push _as_2
  79.     push offset Answ
  80.     call crt_printf
  81. EXIT:
  82.     invoke  ExitProcess, 0
  83. END  START
Advertisement
Add Comment
Please, Sign In to add comment