Created
May 11, 2012 14:58
-
-
Save spellancer/2660288 to your computer and use it in GitHub Desktop.
Jeka
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 "Rezultat virageniya: ",0 | |
Message1 DB "Rezultat virageniya na kalkulatore: ",0 | |
nline db 13,10,0 | |
.DATA | |
x dd 0.4 | |
nom word 1 | |
nom1 dword 1 | |
dva word 2 | |
n dd 1.0 | |
eps dd 0.01 | |
pred dd 1.0 | |
pred1 dd 1.0 | |
v dd 0.0 | |
.DATA? | |
inbuf DB 100 DUP (?) | |
outbuf db 20 dup(?) | |
rez dq ? | |
Y 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 | |
mov AX,nom | |
idiv dva | |
cmp DX,0 | |
je con1 | |
FCHS | |
con1: | |
add nom,1 | |
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 | |
FLDLN2 | |
fld x | |
fld1 | |
fadd | |
FYL2X | |
fld x | |
fdiv | |
fstp Y | |
Invoke StdOut,ADDR Message | |
Invoke FloatToStr,rez,ADDR outbuf | |
Invoke StdOut,ADDR outbuf | |
Invoke StdOut,ADDR nline | |
Invoke StdOut,ADDR Message1 | |
Invoke FloatToStr,Y,ADDR outbuf | |
Invoke StdOut,ADDR outbuf | |
Invoke StdOut,ADDR nline | |
;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