🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.misc
Article #906

Re: Floating point math

#906
From: Leonard Erickson
Date: Tue, 14 Apr 1992 21:41
32 lines
1824 bytes
lebowitz@krypton.Mankato.MSUS.EDU (Robert J. Lebowitz) writes:

>The assembly routine calculates a floating point value which it moves into
>a BASICA single precision variable (4 bytes long).  Turbo Pascal 6.0 does 
>have provisions for 4 byte long single precision variables using the 8087
>emulator, however I seem to be having problems passing a pointer to the 
>floating point variable to the assembly routine and getting back the correct
>value.  Question 1:  Are these two forms of 4 byte SP variables stored 
>differently?

The BASICA 4-byte real is *not* the same as the Turbo Pascal 4-byte real.
But it *is* quite similar to Turbo's 6-byte REAL!

I don't have code handy, but what you need to do is this:

BASICA value ABCD (A=MSB, D=LSB)
Turbo Pascal value BCDEFA (B=MSB, A=LSB, E & F =0)


So take the 4-byte from the assembly routine, move the MSB into the LSB
of a turbo real, move zeros into the two bytes before the LSB, and move
the remaining 3 bytes to the high end of the real.



The above is from memory of how I got a BASICA program to read Turbo
6-byte reals. 
-- 
Leonard Erickson		      leonard@qiclab.scn.rain.com
CIS: [70465,203]			 70465.203@compuserve.com
FIDO:   1:105/56	 Leonard.Erickson@f56.n105.z1.fidonet.org
(The CIS address is checked daily. The others infrequently)
Technical Details
Message-ID: <1992Apr14.214119.23327@qiclab.scn.rain.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!mips!cs.uoregon.edu!ogicse!qiclab!leonard
References: <LEBOWITZ.92Apr2173104@krypton.Mankato.MSUS.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!mips!cs.uoregon.edu!ogicse!qiclab!leonard
From: leonard@qiclab.scn.rain.com (Leonard Erickson)
Newsgroups: comp.sys.ibm.pc.misc
Subject: Re: Floating point math
Message-ID: <1992Apr14.214119.23327@qiclab.scn.rain.com>
Date: 14 Apr 92 21:41:19 GMT
References: <LEBOWITZ.92Apr2173104@krypton.Mankato.MSUS.EDU>
Reply-To: 70465.203@compuserve.com
Distribution: comp
Organization: SCN Research/Qic Laboratories of Tigard, Oregon.
Lines: 32