186 lines
2.6 KiB
Text
186 lines
2.6 KiB
Text
|
.486
|
||
|
.model flat
|
||
|
extrn __fltused:near
|
||
|
extrn __ftol:near
|
||
|
public _main
|
||
|
_TEXT segment
|
||
|
_main:
|
||
|
push ebx
|
||
|
push esi
|
||
|
push edi
|
||
|
push ebp
|
||
|
mov ebp,esp
|
||
|
sub esp,24
|
||
|
cmp dword ptr (20)[ebp],1
|
||
|
jg L2
|
||
|
fld dword ptr (L4)
|
||
|
fstp dword ptr (-16)[ebp]
|
||
|
jmp L3
|
||
|
L2:
|
||
|
mov edi,dword ptr (24)[ebp]
|
||
|
mov edi,dword ptr (4)[edi]
|
||
|
push edi
|
||
|
call _atof
|
||
|
add esp,4
|
||
|
fstp dword ptr (-20)[ebp]
|
||
|
fld dword ptr (-20)[ebp]
|
||
|
fdiv dword ptr (L5)
|
||
|
fstp dword ptr (-16)[ebp]
|
||
|
L3:
|
||
|
mov dword ptr (-4)[ebp],0
|
||
|
L6:
|
||
|
mov edi,dword ptr (-4)[ebp]
|
||
|
lea esi,(1)[edi]
|
||
|
mov dword ptr (-4)[ebp],esi
|
||
|
fld dword ptr (L4)
|
||
|
fstp dword ptr (_f)[edi*4]
|
||
|
L7:
|
||
|
cmp dword ptr (-4)[ebp],127
|
||
|
jle L6
|
||
|
mov dword ptr (-8)[ebp],0
|
||
|
jmp L11
|
||
|
L10:
|
||
|
mov edi,dword ptr (-12)[ebp]
|
||
|
lea edi,(_f)[edi*4]
|
||
|
fld dword ptr [edi]
|
||
|
fadd dword ptr (L13)
|
||
|
fstp dword ptr [edi]
|
||
|
inc dword ptr (-8)[ebp]
|
||
|
L11:
|
||
|
call _getchar
|
||
|
add esp,0
|
||
|
mov dword ptr (-12)[ebp],eax
|
||
|
cmp eax,-1
|
||
|
jne L10
|
||
|
lea edi,(L14)
|
||
|
push edi
|
||
|
call _printf
|
||
|
add esp,4
|
||
|
mov dword ptr (-4)[ebp],0
|
||
|
L15:
|
||
|
mov edi,dword ptr (-4)[ebp]
|
||
|
fld dword ptr (_f)[edi*4]
|
||
|
fstp dword ptr (-24)[ebp]
|
||
|
fld dword ptr (L4)
|
||
|
fcomp dword ptr (-24)[ebp]
|
||
|
fstsw ax
|
||
|
sahf
|
||
|
je L19
|
||
|
fld dword ptr (-24)[ebp]
|
||
|
mov edi,dword ptr (-8)[ebp]
|
||
|
push edi
|
||
|
fild dword ptr 0[esp]
|
||
|
add esp,4
|
||
|
fdivp st(1),st
|
||
|
fld dword ptr (-16)[ebp]
|
||
|
fcompp
|
||
|
fstsw ax
|
||
|
sahf
|
||
|
ja L19
|
||
|
cmp dword ptr (-4)[ebp],32
|
||
|
jg L21
|
||
|
mov edi,dword ptr (-4)[ebp]
|
||
|
push edi
|
||
|
lea edi,(L23)
|
||
|
push edi
|
||
|
call _printf
|
||
|
add esp,8
|
||
|
jmp L22
|
||
|
L21:
|
||
|
mov edi,dword ptr (-4)[ebp]
|
||
|
push edi
|
||
|
lea edi,(L24)
|
||
|
push edi
|
||
|
call _printf
|
||
|
add esp,8
|
||
|
L22:
|
||
|
fld dword ptr (L5)
|
||
|
mov edi,dword ptr (-4)[ebp]
|
||
|
fmul dword ptr (_f)[edi*4]
|
||
|
mov edi,dword ptr (-8)[ebp]
|
||
|
push edi
|
||
|
fild dword ptr 0[esp]
|
||
|
add esp,4
|
||
|
fdivp st(1),st
|
||
|
sub esp,8
|
||
|
fstp qword ptr [esp]
|
||
|
lea edi,(L25)
|
||
|
push edi
|
||
|
call _printf
|
||
|
add esp,12
|
||
|
L19:
|
||
|
L16:
|
||
|
inc dword ptr (-4)[ebp]
|
||
|
cmp dword ptr (-4)[ebp],127
|
||
|
jle L15
|
||
|
mov eax,0
|
||
|
L1:
|
||
|
mov esp,ebp
|
||
|
pop ebp
|
||
|
pop edi
|
||
|
pop esi
|
||
|
pop ebx
|
||
|
ret
|
||
|
_TEXT ends
|
||
|
extrn _printf:near
|
||
|
_TEXT segment
|
||
|
_TEXT ends
|
||
|
extrn _getchar:near
|
||
|
_TEXT segment
|
||
|
_TEXT ends
|
||
|
extrn _atof:near
|
||
|
_TEXT segment
|
||
|
_TEXT ends
|
||
|
_DATA segment
|
||
|
public _f
|
||
|
align 4
|
||
|
_f label byte
|
||
|
db 512 dup (0)
|
||
|
_DATA ends
|
||
|
_TEXT segment
|
||
|
align 1
|
||
|
L25 label byte
|
||
|
db 9
|
||
|
db 37
|
||
|
db 46
|
||
|
db 49
|
||
|
db 102
|
||
|
db 10
|
||
|
db 0
|
||
|
align 1
|
||
|
L24 label byte
|
||
|
db 37
|
||
|
db 99
|
||
|
db 0
|
||
|
align 1
|
||
|
L23 label byte
|
||
|
db 37
|
||
|
db 48
|
||
|
db 51
|
||
|
db 111
|
||
|
db 0
|
||
|
align 1
|
||
|
L14 label byte
|
||
|
db 99
|
||
|
db 104
|
||
|
db 97
|
||
|
db 114
|
||
|
db 9
|
||
|
db 102
|
||
|
db 114
|
||
|
db 101
|
||
|
db 113
|
||
|
db 10
|
||
|
db 0
|
||
|
align 4
|
||
|
L13 label byte
|
||
|
dd 03f800000H
|
||
|
align 4
|
||
|
L5 label byte
|
||
|
dd 042c80000H
|
||
|
align 4
|
||
|
L4 label byte
|
||
|
dd 00H
|
||
|
_TEXT ends
|
||
|
end
|