Вторая программа для TASM 5 в режиме Ideal. Проверка на корректность ввода с клавиатуры не производится.
title N88931612
ideal
p686
model flat,stdcall
includelib 'import32.lib'
includelib 'imp32i.lib'
procdesc ExitProcess winapi :dword
extrn scanf: near
extrn printf: near
extrn _getch: near
dataseg
PromptA db 'Введите A: ',0
PromptB db 'Введите B: ',0
Result1 db 'График функции не проходит через заданную точку',0
Result2 db 'График функции проходит через заданную точку',0
QuitPrompt db 13,10,10,'Для завершения работы нажмите любую клавишу... ',0
fInput db '%f',0
A dd ?
B dd ?
IntBuf dw ?
codeseg
Start:
push offset PromptA
call printf
add esp,4
push offset A
push offset fInput
call scanf
add esp,8
push offset PromptB
call printf
add esp,4
push offset B
push offset fInput
call scanf
add esp,8
finit
fld [A]
fld st
fmul
mov [IntBuf],5
fimul [IntBuf]
fld [A]
mov [IntBuf],7
fimul [IntBuf]
fsub
mov [IntBuf],2
fiadd [IntBuf]
fld [B]
fucomi st(1)
mov eax,offset Result2
je ResYes
mov eax,offset Result1
ResYes:
push eax
call printf
add esp,4
push offset QuitPrompt
call printf
add esp,4
call _getch
call ExitProcess,0
end Start
P.S. Библиотека imp32i.lib из комплекта Tasm 5 plus.