Board index » delphi » FPU, asm, and Trig.

FPU, asm, and Trig.

My program  http://www.merlyn.demon.co.uk/programs/fsincos.pas works  in
BP7 DOS & DPMI modes, crashes in BPW, and is, I am told, rejected by
Delphi 2.0 -

"Unfortunately the compiler complains with "Invalid registercombination"
(roughly translated from my german Delphi-version).
Here is the code I used:
procedure FSinCos(var S, C : extended ; A : extended) ; assembler ;
asm  fld [A] ; db $CD,$35,$FB { >287: => fsincos; fpatan is CD35F3 } ;
  les di,[C] ; fstp es:tbyte ptr[di] ;
(**********************************^ stops here **********)"

The full source of the subroutines is

procedure FSinCos(var S, C : extended ; A : extended) ; assembler ;
asm  fld [A] ; db $CD,$35,$FB { >287: => fsincos; fpatan is CD35F3 } ;
  les di,[C] ; fstp es:tbyte ptr[di] ;
  les di,[S] ; fstp es:tbyte ptr[di] ;
  end {FSinCos} ;

function FTan(A : extended) : extended ; assembler ;
asm  fld [A] ; db $CD,$35,$FB { >287: => fsincos; fpatan is CD35F3 } ;
  FDIV  end {FTan} ;  (* OK? *)

function FCot(A : extended) : extended ; assembler ;
asm  fld [A] ; db $CD,$35,$FB { >287: => fsincos; fpatan is CD35F3 } ;
  FDIVR  end {FCot} ;  (* OK? *)

Comments?   Corrections?

BTW, has anyone got a way for a BP7 DOS/DPMI program to switch between
25- and 43/50- line modes without "uses Crt;" ?

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v4.00    MIME.
  Web <URL: http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
  PAS, EXE in <URL: http://www.merlyn.demon.co.uk/programs/> - see 00index.txt.
  Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)

 

Re:FPU, asm, and Trig.


Dr John Stockton schrieb:

Quote
> BTW, has anyone got a way for a BP7 DOS/DPMI program to switch between
> 25- and 43/50- line modes without "uses Crt;" ?

Maybe by directly calling function 00 of Int 10h. This is a guess, I have no idea
whether it works in DPMI.

Re:FPU, asm, and Trig.


On Thu, 15 Oct 1998 16:54:54 +0100, Dr John Stockton

Quote
<j...@merlyn.demon.co.uk> wrote:
> My program  http://www.merlyn.demon.co.uk/programs/fsincos.pas works  in
> BP7 DOS & DPMI modes, crashes in BPW, and is, I am told, rejected by
> Delphi 2.0 -

> "Unfortunately the compiler complains with "Invalid registercombination"
> (roughly translated from my german Delphi-version).

[...]

Quote
> The full source of the subroutines is
> procedure FSinCos(var S, C : extended ; A : extended) ; assembler ;
> asm  fld [A] ; db $CD,$35,$FB { >287: => fsincos; fpatan is CD35F3 } ;
>   les di,[C] ; fstp es:tbyte ptr[di] ;
>   les di,[S] ; fstp es:tbyte ptr[di] ;
>   end {FSinCos} ;

In a Windows program you cannot use emulator opcodes CD xx... (INT xx
params) because the Borland emulator is not used under Windows. BPW
generates genuine FPU opcodes. Thus instead of

        CD 35 FB  use   D9 FB

You may use the regular opcode in a DOS or DPMI program, too, because
the procedure can't run without FPU anyway, as the emulator doesn't
support fsincos.

Regards
Horst

Re:FPU, asm, and Trig.


JRS:  In article <36269004.36698...@news.snafu.de> of Fri, 16 Oct 1998
10:56:30 in comp.lang.pascal.borland, Horst Kraemer

Quote
<horst.krae...@snafu.de> wrote:
>On Thu, 15 Oct 1998 16:54:54 +0100, Dr John Stockton
><j...@merlyn.demon.co.uk> wrote:

>> My program  http://www.merlyn.demon.co.uk/programs/fsincos.pas works  in
>> BP7 DOS & DPMI modes, crashes in BPW, and is, I am told, rejected by
>> Delphi 2.0 -

>> "Unfortunately the compiler complains with "Invalid registercombination"
>> (roughly translated from my german Delphi-version).

>[...]

>> The full source of the subroutines is

>> procedure FSinCos(var S, C : extended ; A : extended) ; assembler ;
>> asm  fld [A] ; db $CD,$35,$FB { >287: => fsincos; fpatan is CD35F3 } ;
>>   les di,[C] ; fstp es:tbyte ptr[di] ;
>>   les di,[S] ; fstp es:tbyte ptr[di] ;
>>   end {FSinCos} ;

>In a Windows program you cannot use emulator opcodes CD xx... (INT xx
>params) because the Borland emulator is not used under Windows. BPW
>generates genuine FPU opcodes. Thus instead of

>       CD 35 FB  use   D9 FB

>You may use the regular opcode in a DOS or DPMI program, too, because
>the procedure can't run without FPU anyway, as the emulator doesn't
>support fsincos.

Soon I shall upload the revised-as-you-say version, which is OK DOS,
DPMI, WINDOWS.  Don't know about Delphi.

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v4.00    MIME.
  Web <URL: http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
  PAS, EXE in <URL: http://www.merlyn.demon.co.uk/programs/> - see 00index.txt.
  Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)

Other Threads