FPU, asm, and Trig. 
Author Message
 FPU, asm, and Trig.

My program   http://www.*-*-*.com/ ;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;" ?

--

  Web <URL: http://www.*-*-*.com/ ; - FAQqish topics, acronyms & links.
  PAS, EXE in <URL: http://www.*-*-*.com/ ; - see 00index.txt.
  Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)



Wed, 18 Jun 1902 08:00:00 GMT  
 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.


Wed, 18 Jun 1902 08:00:00 GMT  
 FPU, asm, and Trig.
On Thu, 15 Oct 1998 16:54:54 +0100, Dr John Stockton

Quote:

> 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



Wed, 18 Jun 1902 08:00:00 GMT  
 FPU, asm, and Trig.

10:56:30 in comp.lang.Pascal.borland, Horst Kraemer

Quote:

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

>> 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.

--

  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)



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Re-entrant FPU code

2. (FPU) EXTENDED type read by C program

3. FPU Emulator in TP

4. FPU code generation

5. FPU used in IRQ handler

6. protected mode,fpu,graphics

7. FPU and Int08 - Possible explanation?

8. Using FPU code in TP7

9. FPU Emulator

10. 80bit data moves using the FPU.

11. inline-assembler & fpu

12. Inverse Trig Functions in BP & TP

 

 
Powered by phpBB® Forum Software