Created
May 11, 2012 15:07
-
-
Save spellancer/2660335 to your computer and use it in GitHub Desktop.
laba 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Template for console application | |
.586 | |
.MODEL flat, stdcall | |
OPTION CASEMAP:NONE | |
Include kernel32.inc | |
Include masm32.inc | |
IncludeLib kernel32.lib | |
IncludeLib masm32.lib | |
.CONST | |
MsgExit DB "Press Enter to Exit",0AH,0DH,0 | |
Message DB "Result(eps = 0.001): ",13,10,0 | |
nline db 13,10,0 | |
msg DB "Check: 0.364431 ",13,10,0 | |
.DATA | |
x dd 0.4 | |
nom word 1 | |
nom1 dword 1 | |
dva word 2 | |
dv dd 2.0 | |
n dd 1.0 | |
eps dd 0.001 | |
pred dd 1.0 | |
pred1 dd 1.0 | |
v dd 0.0 | |
.DATA? | |
inbuf DB 100 DUP (?) | |
outbuf db 20 dup(?) | |
rez dq ? | |
.CODE | |
Start: | |
finit | |
cycl: | |
mov EAX,0 | |
mov EDX,0 | |
fld pred | |
fst pred1 | |
fld1 | |
mov ECX,nom1 | |
cycle1: | |
fld x | |
fmul | |
loop cycle1 | |
add nom1,1 | |
fld1 | |
fld n | |
fadd | |
fst n | |
fld n | |
fld1 | |
fadd | |
fmul | |
mov AX,nom | |
idiv dva | |
cmp DX,0 | |
je con1 | |
FCHS | |
con1: | |
add nom,1 | |
fmul | |
fld dv | |
fdiv | |
fadd | |
fst pred | |
fld pred1 | |
fsub | |
fabs | |
fcom eps | |
fstsw AX | |
and AX,0700h ; auaaeyai aeou N0, N1, N2 | |
cmp AH,1h | |
je output | |
fstp v | |
jmp cycl | |
output: | |
fld pred | |
fstp rez | |
Invoke StdOut,ADDR Message | |
Invoke FloatToStr,rez,ADDR outbuf | |
Invoke StdOut,ADDR outbuf | |
Invoke StdOut,ADDR nline | |
Invoke StdOut,ADDR msg | |
;Invoke FloatToStr,pred,ADDR outbuf | |
;Invoke StdOut,ADDR outbuf | |
;Invoke StdOut,ADDR nline | |
; | |
; Add you statements | |
; | |
XOR EAX,EAX | |
Invoke StdOut,ADDR MsgExit | |
Invoke StdIn,ADDR inbuf,LengthOf inbuf | |
Invoke ExitProcess,0 | |
End Start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment