Pushok icon

square equations

Pushok | PRO | 03/08/11 05:23:38 PM UTC | 0 ⭐ | 484 👁️ | Never ⏰ | []
ASM (NASM) |

0 B

|

None

|

0 👍

/

0 👎

.386
.model flat,stdcall
option   casemap:none
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\shell32.inc
    include \masm32\macros\macros.asm
    include \masm32\include\msvcrt.inc
 
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib
    includelib \masm32\lib\shell32.lib
    includelib  \masm32\lib\msvcrt.lib
    P proto :DWORD, :DWORD
.DATA
    Info db "%d,%d,%d",0
    Answ db "x1 = %d.%d, x2 = %d.%d",0
    _a dword ?
    _b dword ?
    _c dword ?
    _d dword ?
    _pr dword ?
    _aa_1 dword ?
    _as_1 dword ?
    _aa_2 dword ?
    _as_2 dword ?
.CODE
START:
    push offset _c
    push offset _b
    push offset _a
    push offset Info
    call crt_scanf
    mov eax,_b
    mul _b
    mov ebx,eax
    mov eax,4
    mul _a
    mul _c
    sub ebx,eax
    mov _d,ebx
    cmp _d,0
    jl EXIT
    push offset _d
    call crt_sqrt
    mov _d,eax
    neg _b
    mov ebx,_b
    mov _pr,ebx
    add _pr,eax
    push edx
    xor edx,edx
    mov eax,2
    mul _a
    mov ebx,eax
    mov eax,_pr
    div ebx
    mov _aa_1,eax
    mov _as_1,edx
    mov eax,_d
    sub _b,eax
    xor edx,edx
    mov eax,2
    mul _a
    mov ebx,eax
    mov eax,_b
    div ebx
    mov _aa_2,eax
    mov _as_2,ebx
    pop edx
    push _aa_1
    push _as_1
    push _aa_2
    push _as_2
    push offset Answ
    call crt_printf
EXIT:
    invoke  ExitProcess, 0
END  START

Comments