format PE console
include 'C:\Users\NanoBytes\Desktop\BOLT v3\bin\INCLUDE\win32ax.inc'
include 'C:\Users\NanoBytes\Desktop\BOLT v3\bin\INCLUDE\BOLT.inc'
Memory DD ?
Library DD ?
Return DD ?
Index DD ?
proc write_BOLT
mov ebp,esp
mov eax,[ebp+8]
stdcall getString,eax
stdcall print
mov esp,ebp
ret
endp
proc writeLn_BOLT
mov ebp,esp
setString "\n"
call loadString
stdcall getString,eax
call loadString
push eax
mov eax,dword[ebp+8]
pop ebx
stdcall addString,eax,ebx
mov dword[ebp+8],eax
sub esp,0
mov eax,dword[ebp+8]
stdcall getString,eax
call loadString
stdcall getString,eax
call loadString
push eax
push ebp
call write_BOLT
pop ebp
add esp,4
add esp,0
mov esp,ebp
ret
endp
proc getNumber_BOLT
mov ebp,esp
invoke GetProcAddress, [Library], "gets"
stdcall eax,String
call atof
mov esp,ebp
ret
endp
proc round_BOLT
mov ebp,esp
sub esp,4
invoke HeapAlloc,<invoke GetProcessHeap>,HEAP_ZERO_MEMORY,8
add esp,4
mov dword[ebp+-4],eax
sub esp,4
setString "10"
call atof
add esp,4
mov eax,[ebp+8]
fld qword[eax]
sub esp,4
setString "1"
call atof
add esp,4
fsubp st1, st0
sub esp,4
call fpow
add esp,4
cmp al,1
mov eax,dword[ebp+-4]
fstp qword[eax]
mov eax,[ebp+-4]
FLD qword[eax]
mov eax,[ebp+12]
FLD qword[eax]
fmul st0, st1
frndint
fxch
fdivp st1,st0
mov eax,dword[ebp+-4]
FSTP qword[eax]
mov eax,[ebp+-4]
fld qword[eax]
sub esp,4
setString "0"
call atof
add esp,4
xor eax,eax
fcomip st1
sete al
fcomp
fcomp
mov [Index],eax
fild [Index]
cmp al,1
cmp al,1
jne Label_8
mov eax,[ebp+-4]
fld qword[eax]
fabs
cmp al,1
mov eax,dword[ebp+-4]
fstp qword[eax]
jmp Label_9
Label_8:
Label_9:
mov eax,[ebp+-4]
fld qword[eax]
cmp al,1
mov esp,ebp
ret
mov esp,ebp
fldz
ret
endp
start:
invoke AllocConsole
invoke GetProcessHeap
mov [Memory],eax
invoke LoadLibrary,"MSVCRT.dll"
mov [Library],eax
mov ebp,esp
FSTCW word[esp+2]
or word[esp+2], 0C00h
FLDCW word[esp+2]
invoke GetProcAddress, [Library], "time"
mov ebx,eax
stdcall ebx,0
push eax
invoke GetProcAddress, [Library], "srand"
mov ebx,eax
pop eax
stdcall ebx,eax
invoke GetProcAddress, [Library], "rand"
stdcall eax
sub esp,0
setString "Enter the angle you want to find the sine of (deg): "
call loadString
stdcall getString,eax
call loadString
push eax
push ebp
call write_BOLT
pop ebp
add esp,4
add esp,0
sub esp,4
invoke HeapAlloc,<invoke GetProcessHeap>,HEAP_ZERO_MEMORY,8
add esp,4
mov dword[ebp+-4],eax
sub esp,4
push ebp
call getNumber_BOLT
pop ebp
add esp,0
add esp,4
cmp al,1
mov eax,dword[ebp+-4]
fstp qword[eax]
sub esp,8
invoke HeapAlloc,<invoke GetProcessHeap>,HEAP_ZERO_MEMORY,8
add esp,8
mov dword[ebp+-8],eax
mov eax,[ebp+-4]
fld qword[eax]
sub esp,8
setString "0.01745329"
call atof
add esp,8
fmulp st1, st0
cmp al,1
mov eax,dword[ebp+-8]
fstp qword[eax]
sub esp,12
invoke HeapAlloc,<invoke GetProcessHeap>,HEAP_ZERO_MEMORY,8
add esp,12
mov dword[ebp+-12],eax
sub esp,12
setString "0"
call atof
add esp,12
cmp al,1
mov eax,dword[ebp+-12]
fstp qword[eax]
sub esp,16
invoke HeapAlloc,<invoke GetProcessHeap>,HEAP_ZERO_MEMORY,8
add esp,16
mov dword[ebp+-16],eax
sub esp,16
setString "1"
call atof
add esp,16
cmp al,1
mov eax,dword[ebp+-16]
fstp qword[eax]
sub esp,16
setString "15"
call atof
add esp,16
cmp al,1
sub esp,20
invoke HeapAlloc,<invoke GetProcessHeap>,HEAP_ZERO_MEMORY,8
add esp,20
mov dword[ebp+-20],eax
mov eax,dword[ebp+-20]
fld qword[eax]
fld1
faddp st1, st0
mov eax,dword[ebp+-20]
fstp qword[eax]
sub esp,24
fistp dword[esp]
inc dword[esp]
pop eax
mov ecx,eax
Label_10:
push ecx
cmp ecx,1
jle Label_11
mov eax,[ebp+-16]
fld qword[eax]
mov eax,[ebp+-8]
fld qword[eax]
mov eax,[ebp+-20]
fld qword[eax]
sub esp,24
setString "2"
call atof
add esp,24
fmulp st1, st0
sub esp,24
setString "1"
call atof
add esp,24
fsubp st1, st0
sub esp,24
call fpow
add esp,24
mov eax,[ebp+-20]
fld qword[eax]
sub esp,24
setString "2"
call atof
add esp,24
fmulp st1, st0
sub esp,24
setString "1"
call atof
add esp,24
fsubp st1, st0
fld1
fxch
@@:
fld1
fcomip st,st1
jae @f
fld st
fld1
fsubp
fxch
fmulp st2,st
jmp @b
@@:
fstp st
fdivp st1, st0
fmulp st1, st0
cmp al,1
mov eax,dword[ebp+-12]
fld qword[eax]
faddp st1, st0
mov eax,dword[ebp+-12]
fstp qword[eax]
sub esp,24
setString "1"
call atof
add esp,24
fchs
cmp al,1
mov eax,dword[ebp+-16]
fld qword[eax]
fmulp st1, st0
mov eax,dword[ebp+-16]
fstp qword[eax]
pop ecx
cmp ecx,1
jle Label_11
dec ecx
mov eax,dword[ebp+-20]
fld qword[eax]
fld1
faddp st1, st0
mov eax,dword[ebp+-20]
fstp qword[eax]
jmp Label_10
Label_11:
add esp,16
sub esp,16
mov eax,[ebp+-12]
fld qword[eax]
cmp al,1
sub esp,16
invoke HeapAlloc,<invoke GetProcessHeap>,HEAP_ZERO_MEMORY,8
add esp,16
fstp qword[eax]
push eax
sub esp,16
setString "8"
call atof
add esp,16
cmp al,1
sub esp,16
invoke HeapAlloc,<invoke GetProcessHeap>,HEAP_ZERO_MEMORY,8
add esp,16
fstp qword[eax]
push eax
push ebp
call round_BOLT
pop ebp
add esp,8
add esp,16
cmp al,1
mov eax,dword[ebp+-12]
fstp qword[eax]
sub esp,16
sub esp,16
setString "The sine of "
call loadString
add esp,16
push eax
mov eax,[ebp+-4]
fld qword[eax]
cmp al,1
sub esp,16
call ftoa
call loadString
add esp,16
pop ebx
sub esp,16
stdcall addString,ebx,eax
add esp,16
push eax
sub esp,16
setString " degrees is "
call loadString
add esp,16
pop ebx
sub esp,16
stdcall addString,ebx,eax
add esp,16
push eax
mov eax,[ebp+-12]
fld qword[eax]
cmp al,1
sub esp,16
call ftoa
call loadString
add esp,16
pop ebx
sub esp,16
stdcall addString,ebx,eax
add esp,16
sub esp,16
stdcall getString,eax
call loadString
add esp,16
push eax
push ebp
call writeLn_BOLT
pop ebp
add esp,4
add esp,16
call halt
invoke FreeLibrary,[Library]
invoke ExitProcess,0
.end start