Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

Line Printer paper is strongest at the perforations.


programming / comp.lang.asm.x86 / Re: I'm looking for a mathematical library in assembler for the 8088

SubjectAuthor
* I'm looking for a mathematical library in assembler for the 8088Ruud Baltissen
+* Re: I'm looking for a mathematical library in assembler for the 8088Bart
|+* Re: I'm looking for a mathematical library in assembler for the 8088Ruud Baltissen
||`* Re: I'm looking for a mathematical library in assembler for the 8088Robert Prins
|| +* Re: I'm looking for a mathematical library in assembler for the 8088Alex McDonald
|| |`- Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin
|| `- Re: I'm looking for a mathematical library in assembler for the 8088Ruud Baltissen
|+* Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin
||+* Re: I'm looking for a mathematical library in assembler for the 8088Sjouke Burry
|||+- Re: I'm looking for a mathematical library in assembler for the 8088Sjouke Burry
|||`- Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin
||`* Re: I'm looking for a mathematical library in assembler for the 8088Bart
|| `* Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin
||  `* Re: I'm looking for a mathematical library in assembler for the 8088Terje Mathisen
||   +- Re: I'm looking for a mathematical library in assembler for the 8088Bart
||   `* Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin
||    `* Re: I'm looking for a mathematical library in assembler for the 8088Ruud Baltissen
||     `- Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin
|`* Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin
| `* Re: I'm looking for a mathematical library in assembler for the 8088Bart
|  `- Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin
+- Re: I'm looking for a mathematical library in assembler for the 8088DJ Delorie
`- Re: I'm looking for a mathematical library in assembler for the 8088Rick C. Hodgin

1
Subject: I'm looking for a mathematical library in assembler for the 8088
From: Ruud Baltissen
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Tue, 17 Sep 2019 07:54 UTC
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rbaltis...@nospicedham.gmail.com (Ruud Baltissen)
Newsgroups: comp.lang.asm.x86
Subject: I'm looking for a mathematical library in assembler for the 8088
Date: Tue, 17 Sep 2019 00:54:34 -0700 (PDT)
Organization: A noiseless patient Spider
Lines: 21
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Tue, 17 Sep 2019 07:54:35 +0000
Injection-Info: reader02.eternal-september.org; posting-host="06f8c2ee155107d23dc95361d03c367a";
logging-data="31864"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LwFdTaA9NlcCkD2/3zf9Bpblv2KXDayY="
User-Agent: G2/1.0
Cancel-Lock: sha1:ehuwLAOCj5o/BU+YiN/Ehp7X/BM=
View all headers
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not just the PC. I'm also programming my own Pascal compiler that should run under that OS. It is able to compile itself, it only outputs macros and it is up to the assembler plus an INC file to turn it in a running program. So far I was able to create programs that run on a Commodore 64. I'm now busy now to create an INC file for the 8088. Outputting a string under my OS or MS-DOS goes fine. But I also need to fill the macros needed for the mathematical functions. I could invent the wheel twice but handling REALs is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can anybody help, please?

Any other library is welcome as well!

Thank you in advance!

Kind regards, Ruud Baltissen



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Bart
Newsgroups: comp.lang.asm.x86
Organization: virginmedia.com
Date: Wed, 18 Sep 2019 10:51 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: bc...@nospicedham.freeuk.com (Bart)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Wed, 18 Sep 2019 11:51:27 +0100
Organization: virginmedia.com
Lines: 12
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <S_ngF.326972$TY7.75648@fx29.am4>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="06f8c2ee155107d23dc95361d03c367a";
logging-data="3776"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nTnQi3ZSPxsB9xrdC0rVHjQB0nzD2dZA="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:78ogjT7VDZlPHnSR99OcSbFWMkc=
View all headers
On 17/09/2019 08:54, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not just the PC. I'm also programming my own Pascal compiler that should run under that OS. It is able to compile itself, it only outputs macros and it is up to the assembler plus an INC file to turn it in a running program. So far I was able to create programs that run on a Commodore 64. I'm now busy now to create an INC file for the 8088. Outputting a string under my OS or MS-DOS goes fine. But I also need to fill the macros needed for the mathematical functions. I could invent the wheel twice but handling REALs is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can anybody help, please?

Do these machines also have an 8087? That would help!

Otherwise, a software library operating to modern standards, and working with 64-bit IEEE, sounds like it's going be rather slow.



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Ruud Baltissen
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Wed, 18 Sep 2019 17:19 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rbaltis...@nospicedham.gmail.com (Ruud Baltissen)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Wed, 18 Sep 2019 10:19:08 -0700 (PDT)
Organization: A noiseless patient Spider
Lines: 13
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <2550c0b0-2cc9-4fc3-a0b3-c656f2b3e275@googlegroups.com>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com> <S_ngF.326972$TY7.75648@fx29.am4>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Wed, 18 Sep 2019 17:19:08 +0000
Injection-Info: reader02.eternal-september.org; posting-host="06f8c2ee155107d23dc95361d03c367a";
logging-data="15207"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187qm+IyR1UUXs2nFfVp2EnxwmrC0Yhc8c="
User-Agent: G2/1.0
Cancel-Lock: sha1:iwWmwuPtzZovjGi4LtUleCkNAKE=
View all headers
Hallo Bart,

Do these machines also have an 8087? That would help!

Some do. But that means some don't and thus we either need to emulate 8087 instructions or need to replace them with 8088 ones.
 
Otherwise, a software library operating to modern standards, and working
with 64-bit IEEE, sounds like it's going be rather slow.

For the moment I would be happy with a 16-bits library.

Kind regards, Ruud Baltissen



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Robert Prins
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Wed, 18 Sep 2019 22:47 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rob...@nospicedham.prino.org (Robert Prins)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Wed, 18 Sep 2019 22:47:31 +0000
Organization: A noiseless patient Spider
Lines: 24
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qlu1k5$3s5$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4>
<2550c0b0-2cc9-4fc3-a0b3-c656f2b3e275@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="06f8c2ee155107d23dc95361d03c367a";
logging-data="8628"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lYc4n7djpP1ksLRljZA64Ovler6J5f90="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.8.0
Cancel-Lock: sha1:zFmdhj2TrKoFr5jMttafZxodLzU=
View all headers
On 2019-09-18 17:19, Ruud Baltissen wrote:> Hallo Bart,
 >
 >> Do these machines also have an 8087? That would help!
 >
 > Some do. But that means some don't and thus we either need to emulate 8087
 > instructions or need to replace them with 8088 ones.
 >
 >> Otherwise, a software library operating to modern standards, and working
 >> with 64-bit IEEE, sounds like it's going be rather slow.
 >
 > For the moment I would be happy with a 16-bits library.

Borland/Turbo Pascal came with an x87 emulator in the RTL. A long time ago I
disassembled it, and included it in the archive. Look for, long wrapping URL:

https://archive.org/download/2012.11.24.ftp-garbo-mirror/2012.11.24.garbo.uwasa.fi.zip/garbo.uwasa.fi%2Fpub%2Fpc%2Fgarbo%2Fpc%2Fturbopa7%2Fbpl70v20.zip
Virtually uncommented raw disassembly in EM86.ASM. I also think that the
emulation wasn't complete.

Robert
--
Robert AH Prins
robert(a)prino(d)org



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: Liberty Software Foundation
Date: Wed, 18 Sep 2019 12:05 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Wed, 18 Sep 2019 08:05:45 -0400
Organization: Liberty Software Foundation
Lines: 36
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qlt6ij$npp$2@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="24538"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Q+cUWo9hCQhr9KG09yAJ/WP1sz+o3l54="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:p3/LnuMDo2IS1rbKc5XB/9JVox8=
View all headers
On 9/18/2019 6:51 AM, Bart wrote:
On 17/09/2019 08:54, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not just the PC. I'm also programming my own Pascal compiler that should run under that OS. It is able to compile itself, it only outputs macros and it is up to the assembler plus an INC file to turn it in a running program. So far I was able to create programs that run on a Commodore 64. I'm now busy now to create an INC file for the 8088. Outputting a string under my OS or MS-DOS goes fine. But I also need to fill the macros needed for the mathematical functions. I could invent the wheel twice but handling REALs is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can anybody help, please?

Do these machines also have an 8087? That would help!

Otherwise, a software library operating to modern standards, and working with 64-bit IEEE, sounds like it's going be rather slow.

I searched for it but couldn't find it.  There used to be an 8087.asm
app that worked with DOS.  It would install a software emulator for
the 8086/8088 CPUs so it would work with native x87 FPU instructions.
I may still have it on one of my Programmer's Heaven CDs from back in
the BBS days.

It was fully IEEE-754 compliant and could be adapted.  In fact, IIRC,
a version of that program was used to find the famous Pentium FDIV
bug, as the software version was reporting correctly, and the Pentium
was reporting incorrectly, over a particular range of inputs.

--
Rick C. Hodgin



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Alex McDonald
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Wed, 18 Sep 2019 22:26 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ale...@nospicedham.rivadpm.com (Alex McDonald)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Wed, 18 Sep 2019 23:26:44 +0100
Organization: A noiseless patient Spider
Lines: 33
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qluav5$qv2$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4>
<2550c0b0-2cc9-4fc3-a0b3-c656f2b3e275@googlegroups.com>
<qlu1k5$3s5$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="29447"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PaMnZbCC2BTwGAcDscBwY7FxRQhU+fGE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:Ml6P+YflyDQjeNHsY+TL0n3U3pU=
View all headers
On 18-Sep-19 23:47, Robert Prins wrote:
On 2019-09-18 17:19, Ruud Baltissen wrote:> Hallo Bart,
 >
 >> Do these machines also have an 8087? That would help!
 >
 > Some do. But that means some don't and thus we either need to emulate 8087
 > instructions or need to replace them with 8088 ones.
 >
 >> Otherwise, a software library operating to modern standards, and working
 >> with 64-bit IEEE, sounds like it's going be rather slow.
 >
 > For the moment I would be happy with a 16-bits library.

Borland/Turbo Pascal came with an x87 emulator in the RTL. A long time ago I
disassembled it, and included it in the archive. Look for, long wrapping URL:

https://archive.org/download/2012.11.24.ftp-garbo-mirror/2012.11.24.garbo.uwasa.fi.zip/garbo.uwasa.fi%2Fpub%2Fpc%2Fgarbo%2Fpc%2Fturbopa7%2Fbpl70v20.zip Virtually uncommented raw disassembly in EM86.ASM. I also think that the
emulation wasn't complete.

Robert

Try 8087.asm or m8087.asm http://annex.retroarchive.org/cdrom/psl-v2n6//PRGMMING/DOS/ASM/index.html

--
Alex



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Sjouke Burry
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Wed, 18 Sep 2019 22:58 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: burrynul...@nospicedham.ppllaanneett.nnll (Sjouke Burry)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 00:58:36 +0200
Organization: A noiseless patient Spider
Lines: 37
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <5d82b69d$0$26380$e4fe514c@textnews.kpn.nl>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com> <S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="12061"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DWkCvYqbzJa8Y2nLKuvNfQrNuyE29Yx8="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
Cancel-Lock: sha1:rOwQ9G/62CbKlimE4GShG94oe8k=
View all headers
On 18.09.19 14:05, Rick C. Hodgin wrote:
On 9/18/2019 6:51 AM, Bart wrote:
On 17/09/2019 08:54, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not
just the PC. I'm also programming my own Pascal compiler that should run
under that OS. It is able to compile itself, it only outputs macros and it
is up to the assembler plus an INC file to turn it in a running program. So
far I was able to create programs that run on a Commodore 64. I'm now busy
now to create an INC file for the 8088. Outputting a string under my OS or
MS-DOS goes fine. But I also need to fill the macros needed for the
mathematical functions. I could invent the wheel twice but handling REALs
is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can
anybody help, please?

Do these machines also have an 8087? That would help!

Otherwise, a software library operating to modern standards, and working with
64-bit IEEE, sounds like it's going be rather slow.

I searched for it but couldn't find it.  There used to be an 8087.asm
app that worked with DOS.  It would install a software emulator for
the 8086/8088 CPUs so it would work with native x87 FPU instructions.
I may still have it on one of my Programmer's Heaven CDs from back in
the BBS days.

It was fully IEEE-754 compliant and could be adapted.  In fact, IIRC,
a version of that program was used to find the famous Pentium FDIV
bug, as the software version was reporting correctly, and the Pentium
was reporting incorrectly, over a particular range of inputs.

On my dosmachines fortran(MS 5.1) and C(MS 6.00a) support
linking with FPU and without.



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Bart
Newsgroups: comp.lang.asm.x86
Organization: virginmedia.com
Date: Wed, 18 Sep 2019 23:50 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: bc...@nospicedham.freeuk.com (Bart)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 00:50:46 +0100
Organization: virginmedia.com
Lines: 47
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <tpzgF.372313$yH4.43945@fx18.am4>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="19651"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/SNrg/DFgZalVWkIVo0df4fAAaCdaKnos="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:23u2klQuGbxw8R0XvzpvdvZzVYA=
View all headers
On 18/09/2019 13:05, Rick C. Hodgin wrote:
On 9/18/2019 6:51 AM, Bart wrote:
On 17/09/2019 08:54, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not just the PC. I'm also programming my own Pascal compiler that should run under that OS. It is able to compile itself, it only outputs macros and it is up to the assembler plus an INC file to turn it in a running program. So far I was able to create programs that run on a Commodore 64. I'm now busy now to create an INC file for the 8088. Outputting a string under my OS or MS-DOS goes fine. But I also need to fill the macros needed for the mathematical functions. I could invent the wheel twice but handling REALs is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can anybody help, please?

Do these machines also have an 8087? That would help!

Otherwise, a software library operating to modern standards, and working with 64-bit IEEE, sounds like it's going be rather slow.

I searched for it but couldn't find it.  There used to be an 8087.asm
app that worked with DOS.  It would install a software emulator for
the 8086/8088 CPUs so it would work with native x87 FPU instructions.
I may still have it on one of my Programmer's Heaven CDs from back in
the BBS days.

It was fully IEEE-754 compliant and could be adapted.  In fact, IIRC,
a version of that program was used to find the famous Pentium FDIV
bug, as the software version was reporting correctly, and the Pentium
was reporting incorrectly, over a particular range of inputs.


If emulating 8087 then that puts extra demands on the emulation library, especially if emulating its internal 64-bit calculations.

When I was coding this stuff (sorry source code long since lost), I coded to my own specifications, and did little checking other than for divide-by-zero. To make it easier, and a bit faster, I think I arranged for the exponent+sign to fit exactly into the top byte of 32 bits.

(While an older version for the 8-bit Z80, which had very limited 16-bit capability, used a 24-bit format: 8-bit exponent/sign, and 16-bit mantissa.)



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Sjouke Burry
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Wed, 18 Sep 2019 23:52 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: burrynul...@nospicedham.ppllaanneett.nnll (Sjouke Burry)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 01:52:25 +0200
Organization: A noiseless patient Spider
Lines: 40
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <5d82c339$0$26415$e4fe514c@textnews.kpn.nl>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com> <S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me> <5d82b69d$0$26380$e4fe514c@textnews.kpn.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="19661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gVfL0LaLxkkbl/L0iD54wi22PwrNXxA0="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
Cancel-Lock: sha1:hobzdf/9U9+ZpW8poowX4VP8AoE=
View all headers
On 19.09.19 0:58, Sjouke Burry wrote:
On 18.09.19 14:05, Rick C. Hodgin wrote:
On 9/18/2019 6:51 AM, Bart wrote:
On 17/09/2019 08:54, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not
just the PC. I'm also programming my own Pascal compiler that should run
under that OS. It is able to compile itself, it only outputs macros and it
is up to the assembler plus an INC file to turn it in a running program. So
far I was able to create programs that run on a Commodore 64. I'm now busy
now to create an INC file for the 8088. Outputting a string under my OS or
MS-DOS goes fine. But I also need to fill the macros needed for the
mathematical functions. I could invent the wheel twice but handling REALs
is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can
anybody help, please?

Do these machines also have an 8087? That would help!

Otherwise, a software library operating to modern standards, and working with
64-bit IEEE, sounds like it's going be rather slow.

I searched for it but couldn't find it.  There used to be an 8087.asm
app that worked with DOS.  It would install a software emulator for
the 8086/8088 CPUs so it would work with native x87 FPU instructions.
I may still have it on one of my Programmer's Heaven CDs from back in
the BBS days.

It was fully IEEE-754 compliant and could be adapted.  In fact, IIRC,
a version of that program was used to find the famous Pentium FDIV
bug, as the software version was reporting correctly, and the Pentium
was reporting incorrectly, over a particular range of inputs.

On my dosmachines fortran(MS 5.1) and C(MS 6.00a) support
linking with FPU and without.

Oh, and with and without emulator.



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: DJ Delorie
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 19 Sep 2019 00:54 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: dj...@nospicedham.delorie.com (DJ Delorie)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Wed, 18 Sep 2019 20:54:04 -0400
Organization: A noiseless patient Spider
Lines: 4
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <xnpnjxgl77.fsf@delorie.com>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="2206"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kIoGWe+vEVRCFrxySAJpT1rk0KPAm96Y="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
Cancel-Lock: sha1:9SbyfFFiDaGsfI+0cppJ0BVlY4c=
View all headers

The DJGPP project includes an 80387 emulator if that helps, look for
v2misc/wmemu*.zip



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 19 Sep 2019 03:58 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Wed, 18 Sep 2019 23:58:38 -0400
Organization: A noiseless patient Spider
Lines: 50
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qluudf$d2h$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
<tpzgF.372313$yH4.43945@fx18.am4>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="23741"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GdaHXmRw/xD3snRqToKhqp5Xgck0BZBg="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:4NyVCJGhp2w7CTVnv5xOsyyS6lQ=
View all headers
On 9/18/2019 7:50 PM, Bart wrote:
On 18/09/2019 13:05, Rick C. Hodgin wrote:
I searched for it but couldn't find it.  There used to be an 8087.asm
app that worked with DOS.  It would install a software emulator for
the 8086/8088 CPUs so it would work with native x87 FPU instructions.
I may still have it on one of my Programmer's Heaven CDs from back in
the BBS days.

It was fully IEEE-754 compliant and could be adapted.  In fact, IIRC,
a version of that program was used to find the famous Pentium FDIV
bug, as the software version was reporting correctly, and the Pentium
was reporting incorrectly, over a particular range of inputs.

If emulating 8087 then that puts extra demands on the emulation library, especially if emulating its internal 64-bit calculations.

Yes.  The x86 CPU has a feature to allow software emulation of the
full x87 instruction set.  Whenever an x87 instruction is encountered
in x87 emulation mode, it signals an interrupt which dispatches to a
handler.  There the software simulates the operation, and then iret
back and it keeps going.  Slow, but it provides an easy x87 operation
when all you have is an 8086 or 8088.

The 80286, 80386, and 80486SX allowed those abilities as well.  All
CPUs 80486DX and later have built-in FPUs.

When I was coding this stuff (sorry source code long since lost), I coded to my own specifications, and did little checking other than for divide-by-zero. To make it easier, and a bit faster, I think I arranged for the exponent+sign to fit exactly into the top byte of 32 bits.

(While an older version for the 8-bit Z80, which had very limited 16-bit capability, used a 24-bit format: 8-bit exponent/sign, and 16-bit mantissa.)

IEEE-754 compliance is difficult.  If you don't go for 100% compliance
it's not so hard, but then it's really only good for what you want to
use it for.

Some people have used the emulation ability to install ISA support for
alternate hardware.  They re-purpose the x87 FPU opcodes to be their
own operations, which can access a card, send data to it, allow a co-
processor to handle some computation, read back the result, and then
maintain the alternate environment state.

Very flexible design if you don't need the FPU.

--
Rick C. Hodgin



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 19 Sep 2019 04:02 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 00:02:54 -0400
Organization: A noiseless patient Spider
Lines: 10
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qluuld$e09$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4>
<2550c0b0-2cc9-4fc3-a0b3-c656f2b3e275@googlegroups.com>
<qlu1k5$3s5$1@dont-email.me> <qluav5$qv2$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="23811"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19diEBweqGg4l5vxrgpwKdHtAxrQPKQDoQ="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:HRpMLyekl9doRE57kft+4JuYb3Q=
View all headers
On 9/18/2019 6:26 PM, Alex McDonald wrote:
Try 8087.asm or m8087.asm http://annex.retroarchive.org/cdrom/psl-v2n6//PRGMMING/DOS/ASM/index.html

Nice opcode macros, but it's not the actual emulation library source
code.

--
Rick C. Hodgin



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 19 Sep 2019 04:07 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 00:07:38 -0400
Organization: A noiseless patient Spider
Lines: 56
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qluuua$f2a$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
<5d82b69d$0$26380$e4fe514c@textnews.kpn.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="23882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pcZGuPZxRUpVCkQhInuABY3RduM4iaj8="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:9frnWiee7Xf7P0zLAEdSdpE9zaY=
View all headers
On 9/18/2019 6:58 PM, Sjouke Burry wrote:
On 18.09.19 14:05, Rick C. Hodgin wrote:
On 9/18/2019 6:51 AM, Bart wrote:
On 17/09/2019 08:54, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not
just the PC. I'm also programming my own Pascal compiler that should run
under that OS. It is able to compile itself, it only outputs macros and it
is up to the assembler plus an INC file to turn it in a running program. So
far I was able to create programs that run on a Commodore 64. I'm now busy
now to create an INC file for the 8088. Outputting a string under my OS or
MS-DOS goes fine. But I also need to fill the macros needed for the
mathematical functions. I could invent the wheel twice but handling REALs
is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can
anybody help, please?

Do these machines also have an 8087? That would help!

Otherwise, a software library operating to modern standards, and working with
64-bit IEEE, sounds like it's going be rather slow.

I searched for it but couldn't find it.  There used to be an 8087.asm
app that worked with DOS.  It would install a software emulator for
the 8086/8088 CPUs so it would work with native x87 FPU instructions.
I may still have it on one of my Programmer's Heaven CDs from back in
the BBS days.

It was fully IEEE-754 compliant and could be adapted.  In fact, IIRC,
a version of that program was used to find the famous Pentium FDIV
bug, as the software version was reporting correctly, and the Pentium
was reporting incorrectly, over a particular range of inputs.

On my dosmachines fortran(MS 5.1) and C(MS 6.00a) support
linking with FPU and without.

Yes.  It allowed function calls to be generated instead of x87/x387
opcodes.  IIRC, the emulated functionality wasn't fully IEEE-754
compliant.  Also, 80-bit support was later phased out, leaving only
32-bit and 64-bit support in the language, and (IIRC) the emulation
library, so code you have in MS 6.0 would no longer compile.

--
Rick C. Hodgin



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Thu, 19 Sep 2019 04:11 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 00:11:07 -0400
Organization: A noiseless patient Spider
Lines: 33
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qluv4s$fvn$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="23943"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19pgIMHixuLdedj6Ffop3hQzhtvcdiqsbA="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:/9dFTLXNyyr1UcF3oW3UtH70cvk=
View all headers
On 9/17/2019 3:54 AM, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not just the PC. I'm also programming my own Pascal compiler that should run under that OS. It is able to compile itself, it only outputs macros and it is up to the assembler plus an INC file to turn it in a running program. So far I was able to create programs that run on a Commodore 64. I'm now busy now to create an INC file for the 8088. Outputting a string under my OS or MS-DOS goes fine. But I also need to fill the macros needed for the mathematical functions. I could invent the wheel twice but handling REALs is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can anybody help, please?

Any other library is welcome as well!

Thank you in advance!

Kind regards, Ruud Baltissen


Soft CPU apps like Bochs are open source.  They include full x87
support, though to be honest it may be implemented via pass-thru
computation on the host CPU.

If you really want to tackle this project, read up on how the FPU
operates, how the CPU monitors the FPU instruction steam and sits
idly by while the FPU processes those opcodes.  When the FPU is
not present, how it signals an emulation interrupt.

In either case, creating your own library for each opcode would
be a decent task, but it is doable.  If you aren't looking to be
fully IEEE-754 compliant, it would be notably easier.  And if you
wanted to do something like what Bart did, and re-define the FPU
features on your soft-8088/8087 combo, then you have a lot of leg
room for feature sets.

--
Rick C. Hodgin



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Terje Mathisen
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Thu, 19 Sep 2019 06:21 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: terje.ma...@nospicedham.tmsw.no (Terje Mathisen)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 08:21:51 +0200
Organization: Aioe.org NNTP Server
Lines: 42
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qlv6q0$tbi$1@gioia.aioe.org>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
<tpzgF.372313$yH4.43945@fx18.am4> <qluudf$d2h$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="17945"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QfRKvVfWeejYPz4N2G7CuNRvrdA2BvbA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Firefox/52.0 SeaMonkey/2.49.4
Cancel-Lock: sha1:t0FAyOY7774YJ1cyngJQkh2eCzE=
View all headers
Rick C. Hodgin wrote:
On 9/18/2019 7:50 PM, Bart wrote:
On 18/09/2019 13:05, Rick C. Hodgin wrote:
I searched for it but couldn't find it.  There used to be an 8087.asm
app that worked with DOS.  It would install a software emulator for
the 8086/8088 CPUs so it would work with native x87 FPU instructions.
I may still have it on one of my Programmer's Heaven CDs from back in
the BBS days.

It was fully IEEE-754 compliant and could be adapted.  In fact, IIRC,
a version of that program was used to find the famous Pentium FDIV
bug, as the software version was reporting correctly, and the Pentium
was reporting incorrectly, over a particular range of inputs.

If emulating 8087 then that puts extra demands on the emulation library, especially if emulating its internal 64-bit calculations.

Yes.  The x86 CPU has a feature to allow software emulation of the
full x87 instruction set.  Whenever an x87 instruction is encountered
in x87 emulation mode, it signals an interrupt which dispatches to a
handler.  There the software simulates the operation, and then iret
back and it keeps going.  Slow, but it provides an easy x87 operation
when all you have is an 8086 or 8088.

The faster option was to compile the program so that each 8087 instruction was compiled into a CALL to the emulator routine:

If the 8087 hw was available, the emulator would patch the call site into the actual 8087 opcodes plus any NOPs needed to fill up the typically 3-byte call. If the opcode was in fact longer than the call, then the call would in fact be padded so that it could be replaced.

Since all this code was always single-threading there was no issue with patching running code, no risk of overwriting stuff that was currently running somewhere.

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Bart
Newsgroups: comp.lang.asm.x86
Organization: virginmedia.com
Date: Thu, 19 Sep 2019 10:42 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: bc...@nospicedham.freeuk.com (Bart)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 11:42:38 +0100
Organization: virginmedia.com
Lines: 30
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <CYIgF.1092652$GfB1.541548@fx36.am4>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
<tpzgF.372313$yH4.43945@fx18.am4> <qluudf$d2h$1@dont-email.me>
<qlv6q0$tbi$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="1193"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QcIVc4DLp5MCiCeHE2QqrwxU/0XQ6J8w="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:j3Z7EJZtqYi+CuKFgPrP4ASzuC0=
View all headers
On 19/09/2019 07:21, Terje Mathisen wrote:
Rick C. Hodgin wrote:

Yes.  The x86 CPU has a feature to allow software emulation of the
full x87 instruction set.  Whenever an x87 instruction is encountered
in x87 emulation mode, it signals an interrupt which dispatches to a
handler.  There the software simulates the operation, and then iret
back and it keeps going.  Slow, but it provides an easy x87 operation
when all you have is an 8086 or 8088.

The faster option was to compile the program so that each 8087 instruction was compiled into a CALL to the emulator routine:

If the 8087 hw was available, the emulator would patch the call site into the actual 8087 opcodes plus any NOPs needed to fill up the typically 3-byte call. If the opcode was in fact longer than the call, then the call would in fact be padded so that it could be replaced.


The OP mentioned a Pascal compiler. If so, then it might be easier to let that generate different output depending on whether an 8087 was available or not.

Alternatively, all code could use function calls for each FP op. Then one of two libraries for those calls could be included: either one that just uses the 8087, or one that does the software emulation.

If the software is expected to work well enough with emulation, then those call overheads will not be significant.



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: Liberty Software Foundation
Date: Thu, 19 Sep 2019 12:37 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 08:37:45 -0400
Organization: Liberty Software Foundation
Lines: 52
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qlvsql$59q$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
<tpzgF.372313$yH4.43945@fx18.am4> <qluudf$d2h$1@dont-email.me>
<qlv6q0$tbi$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="16565"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198VVsxD5cWrK6ysQdm5tDeNnx4TzCTF2A="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:ghgxo8AXo5ZQuwCi/XdYw0iSjcI=
View all headers
On 9/19/2019 2:21 AM, Terje Mathisen wrote:
Rick C. Hodgin wrote:
On 9/18/2019 7:50 PM, Bart wrote:
On 18/09/2019 13:05, Rick C. Hodgin wrote:
I searched for it but couldn't find it.  There used to be an 8087.asm
app that worked with DOS.  It would install a software emulator for
the 8086/8088 CPUs so it would work with native x87 FPU instructions.
I may still have it on one of my Programmer's Heaven CDs from back in
the BBS days.

It was fully IEEE-754 compliant and could be adapted.  In fact, IIRC,
a version of that program was used to find the famous Pentium FDIV
bug, as the software version was reporting correctly, and the Pentium
was reporting incorrectly, over a particular range of inputs.

If emulating 8087 then that puts extra demands on the emulation library, especially if emulating its internal 64-bit calculations.

Yes.  The x86 CPU has a feature to allow software emulation of the
full x87 instruction set.  Whenever an x87 instruction is encountered
in x87 emulation mode, it signals an interrupt which dispatches to a
handler.  There the software simulates the operation, and then iret
back and it keeps going.  Slow, but it provides an easy x87 operation
when all you have is an 8086 or 8088.

The faster option was to compile the program so that each 8087 instruction was compiled into a CALL to the emulator routine:

If the 8087 hw was available, the emulator would patch the call site into the actual 8087 opcodes plus any NOPs needed to fill up the typically 3-byte call. If the opcode was in fact longer than the call, then the call would in fact be padded so that it could be replaced.

Since all this code was always single-threading there was no issue with patching running code, no risk of overwriting stuff that was currently running somewhere.

In re-reading the OP, I think he's not looking to create an emulator,
but rather to write his OS + toolset and run it on real 8086/8 hardware.

If I were going to approach the OP's task, I would provide both the
hardware emulator, and the link-in support libraries to my compiler,
that way apps can run natively on the CPU if they don't have support
from a link-in support library (though it's arguable if it's his OS,
and the Pascal compiler is the only one available, what else would
there be?), but for those that do they can take advantage both ways.

I'm a "let's go all in" kind of guy (to use a phrase).

--
Rick C. Hodgin



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: Liberty Software Foundation
Date: Thu, 19 Sep 2019 12:41 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Thu, 19 Sep 2019 08:41:56 -0400
Organization: Liberty Software Foundation
Lines: 37
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qlvt2g$6mo$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6a092641dc4ba3fcabd24b77ad2802dd";
logging-data="16711"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Frm6PK0aCaJcOlfFTsfnylDPIOw/Uitc="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:cMCGNXjJ+6zyA9NhZ5lazvSbzlU=
View all headers
On 9/18/2019 6:51 AM, Bart wrote:
On 17/09/2019 08:54, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not just the PC. I'm also programming my own Pascal compiler that should run under that OS. It is able to compile itself, it only outputs macros and it is up to the assembler plus an INC file to turn it in a running program. So far I was able to create programs that run on a Commodore 64. I'm now busy now to create an INC file for the 8088. Outputting a string under my OS or MS-DOS goes fine. But I also need to fill the macros needed for the mathematical functions. I could invent the wheel twice but handling REALs is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can anybody help, please?

Do these machines also have an 8087? That would help!

Otherwise, a software library operating to modern standards, and working with 64-bit IEEE, sounds like it's going be rather slow.

Slow is a relative term.  The original 8086/8088 ran at 4.77 MHz.
Modern CPUs could run full emulation solely in software at probably
300 MHz if not faster.  BGB has a simulation using his verilog-
based logic that runs at 50 MHz, and that's simulating circuits.

For a long time I've wanted to re-purpose the x87 opcodes to have
a different kind of math library.  I've wanted to add arbitrary-
precision support in lieu of 80-bit reals.  Use real hardware for
32-bit and 64-bit, but when using 80-bit loads and operations on
80-bit loaded values, use GMP and MPFR.  Haven't gotten around to
it yet.  Too many other things to do first.

--
Rick C. Hodgin



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Ruud Baltissen
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Fri, 20 Sep 2019 14:35 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rbaltis...@nospicedham.gmail.com (Ruud Baltissen)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Fri, 20 Sep 2019 07:35:36 -0700 (PDT)
Organization: A noiseless patient Spider
Lines: 20
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <36e182ba-a6be-46e9-b3e9-8eee7511c39f@googlegroups.com>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <2550c0b0-2cc9-4fc3-a0b3-c656f2b3e275@googlegroups.com>
<qlu1k5$3s5$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Fri, 20 Sep 2019 14:35:37 +0000
Injection-Info: reader02.eternal-september.org; posting-host="99daa4455199d65508bc31ad0e91e2c8";
logging-data="19865"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xh48MfRqWV7n5YLkDLwXGVuYgCMxGCu8="
User-Agent: G2/1.0
Cancel-Lock: sha1:91U1DhQHew81Y7XstFzph4t886I=
View all headers
Hallo Robert,

Borland/Turbo Pascal came with an x87 emulator in the RTL. A long time ago I
disassembled it, and included it in the archive. Look for, long wrapping URL:

That looks very good and very well documented. My first impression was that I was looking at the disassembly of mathematical part of the BASIC of my Commodores. One idea is/was to convert the 6502 code into 8088 code and to start with that. As said, my Pascal compiler is able to generate programs for the C64 and that includes quite some mathematical functions. I most case I lean on subroutines of the Kernal and BASIC ROM of the C64. Translating these routines could be an option. But why inventing the wheel twice if there is a change I can find it around here some where?

Thank you very much!

Kind regards, Ruud Baltissen



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Ruud Baltissen
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Fri, 20 Sep 2019 14:52 UTC
References: 1 2 3 4 5 6 7
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rbaltis...@nospicedham.gmail.com (Ruud Baltissen)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Fri, 20 Sep 2019 07:52:30 -0700 (PDT)
Organization: A noiseless patient Spider
Lines: 21
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <7b826170-cc5f-4834-a041-a1cb3a738137@googlegroups.com>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
<tpzgF.372313$yH4.43945@fx18.am4> <qluudf$d2h$1@dont-email.me>
<qlv6q0$tbi$1@gioia.aioe.org> <qlvsql$59q$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Fri, 20 Sep 2019 14:52:31 +0000
Injection-Info: reader02.eternal-september.org; posting-host="99daa4455199d65508bc31ad0e91e2c8";
logging-data="25076"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+AZhVAtByEIBNDSaSTEgO9gnvO/grpWIw="
User-Agent: G2/1.0
Cancel-Lock: sha1:qkFBCwdtGp6imVyyjY7bX9SNwRY=
View all headers
Hallo Rick,

In re-reading the OP, I think he's not looking to create an emulator,
but rather to write his OS + toolset and run it on real 8086/8 hardware.

Correct.

(though it's arguable if it's his OS, and the Pascal compiler is the
only one available, what else would there be?)

At this moment my OS can boot, can start files and I'm busy implementing handling directories. First of all: it is slow but steady fun project.

This Pascal compiler should be one of it first tools. At this moment it runs under DOS and is only to produce programs containing "write" and "writeln" because so far only the macros for these statements have been filled with ML instructions. It can compile itself and only of all macros have been filled it should run under my own OS.

Kind regards, Ruud Baltissen



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: Liberty Software Foundation
Date: Fri, 20 Sep 2019 15:13 UTC
References: 1 2 3 4 5 6 7 8
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Fri, 20 Sep 2019 11:13:59 -0400
Organization: Liberty Software Foundation
Lines: 45
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qm2qbi$sk3$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlt6ij$npp$2@dont-email.me>
<tpzgF.372313$yH4.43945@fx18.am4> <qluudf$d2h$1@dont-email.me>
<qlv6q0$tbi$1@gioia.aioe.org> <qlvsql$59q$1@dont-email.me>
<7b826170-cc5f-4834-a041-a1cb3a738137@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="99daa4455199d65508bc31ad0e91e2c8";
logging-data="24615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JK3g1ciZktUQbLkvqo3gmhGrhnLO/8iE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:nvwmBiMLH8EGvAXjUZwfWfi12S4=
View all headers
On 9/20/2019 10:52 AM, Ruud Baltissen wrote:
Hallo Rick,

In re-reading the OP, I think he's not looking to create an emulator,
but rather to write his OS + toolset and run it on real 8086/8 hardware.

Correct.

(though it's arguable if it's his OS, and the Pascal compiler is the
only one available, what else would there be?)

At this moment my OS can boot, can start files and I'm busy implementing handling directories. First of all: it is slow but steady fun project.

This Pascal compiler should be one of it first tools. At this moment it runs under DOS and is only to produce programs containing "write" and "writeln" because so far only the macros for these statements have been filled with ML instructions. It can compile itself and only of all macros have been filled it should run under my own OS.

Kind regards, Ruud Baltissen

If you're interested in a fast and easy solution, the best thing
would be to create a reader for the existing Microsoft, Borland,
or someone else's 16-bit DOS soft-FPU libraries.  They should be
available almost everywhere.

Write a parser for accessing content in those .LIB files, and
then write a translator to translate from your Pascal calling
convention to the stdcall convention they likely use (or figure
out what they use by default), and you should be able to use
that existing asset.

Another option would be to create your own .COM file (flat, 64 KB
max size with those libraries), and add entry points into it, and
let the DOS compiler + linker do the work.  The .COM file is a
straight-forward format that might even be easier to use.  You
can place pseudo-opcode "markers" in your file so you can find
the entry points.  You can define them at the head of the .COM file,
etc.  Many possible solutions.

Existing assets like those old DOS libraries may be your best way
to go.  Just make sure you have a valid license to use them, or
that the software is defunct.  Digital Mars may be a way to go as
well, as they have old compilers that support DOS and pre-Win95
Windows.

--
Rick C. Hodgin



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Bart
Newsgroups: comp.lang.asm.x86
Organization: virginmedia.com
Date: Fri, 20 Sep 2019 19:48 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: bc...@nospicedham.freeuk.com (Bart)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Fri, 20 Sep 2019 20:48:22 +0100
Organization: virginmedia.com
Lines: 46
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <f2ahF.302361$sy.85175@fx10.am4>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlvt2g$6mo$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="99daa4455199d65508bc31ad0e91e2c8";
logging-data="30251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19viwvgJpxDB4xs8bA+pRYVpppv/nd1NuE="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:rzTYXbBSJ/lDt3YAgP5pWX1Zfrg=
View all headers
On 19/09/2019 13:41, Rick C. Hodgin wrote:
On 9/18/2019 6:51 AM, Bart wrote:
On 17/09/2019 08:54, Ruud Baltissen wrote:
Hello,

I'm working on my own OS, meant to run on various 8088 based machines, not just the PC. I'm also programming my own Pascal compiler that should run under that OS. It is able to compile itself, it only outputs macros and it is up to the assembler plus an INC file to turn it in a running program. So far I was able to create programs that run on a Commodore 64. I'm now busy now to create an INC file for the 8088. Outputting a string under my OS or MS-DOS goes fine. But I also need to fill the macros needed for the mathematical functions. I could invent the wheel twice but handling REALs is not easy. But Google wasn't my friend this time.

So I'm looking for a mathematical library in assembler for the 8088. Can anybody help, please?

Do these machines also have an 8087? That would help!

Otherwise, a software library operating to modern standards, and working with 64-bit IEEE, sounds like it's going be rather slow.

Slow is a relative term.  The original 8086/8088 ran at 4.77 MHz.
Modern CPUs could run full emulation solely in software at probably
300 MHz if not faster.  BGB has a simulation using his verilog-
based logic that runs at 50 MHz, and that's simulating circuits.

For a long time I've wanted to re-purpose the x87 opcodes to have
a different kind of math library.  I've wanted to add arbitrary-
precision support in lieu of 80-bit reals.  Use real hardware for
32-bit and 64-bit, but when using 80-bit loads and operations on
80-bit loaded values, use GMP and MPFR.  Haven't gotten around to
it yet.  Too many other things to do first.

Arbitrary-precision floating point is going to be much slower than even emulation of 8087. But in either case, overheads of using a function call are going to be insignificant.

So I can't see the need to re-use 8087 opcodes. In any case, those are designed to work with a small stack of 80-bit floating point values (in that the operands will often be implicit). Arbitrary precision numbers would have a different representation, and need to be put elsewhere, and the results also need to be placed elsewhere



Subject: Re: I'm looking for a mathematical library in assembler for the 8088
From: Rick C. Hodgin
Newsgroups: comp.lang.asm.x86
Organization: Liberty Software Foundation
Date: Fri, 20 Sep 2019 20:13 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: comp.lang.asm.x86
Subject: Re: I'm looking for a mathematical library in assembler for the 8088
Date: Fri, 20 Sep 2019 16:13:17 -0400
Organization: Liberty Software Foundation
Lines: 43
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <qm3bsp$46h$1@dont-email.me>
References: <424c13c9-b8a3-4e32-889c-569235ab44b6@googlegroups.com>
<S_ngF.326972$TY7.75648@fx29.am4> <qlvt2g$6mo$1@dont-email.me>
<f2ahF.302361$sy.85175@fx10.am4>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="a01c56d5546dbf4d9387201756d483b3";
logging-data="16377"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18TOkKpZFf18wk/LJBG4v5S8d+tgldF3Lw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:zqmGZDeV2xNCJ1h2Xo6M8VRoaqw=
View all headers
On 9/20/2019 3:48 PM, Bart wrote:
On 19/09/2019 13:41, Rick C. Hodgin wrote:
For a long time I've wanted to re-purpose the x87 opcodes to have
a different kind of math library.  I've wanted to add arbitrary-
precision support in lieu of 80-bit reals.  Use real hardware for
32-bit and 64-bit, but when using 80-bit loads and operations on
80-bit loaded values, use GMP and MPFR.  Haven't gotten around to
it yet.  Too many other things to do first.

Arbitrary-precision floating point is going to be much slower than even emulation of 8087.

I often tell the people I work with when it comes to the algorithms
we're writing and why we're writing them that way, "We don't build
bridges for sunny days.  We build bridges for hurricanes and 200 mph
winds and houses and trees slamming into them in the flood waters."
The same goes for our software algorithms.

Arbitrary precision emulation via hardware mechanisms would be a
nice feature in some cases.  GMP and MPFR are pretty fast, even
for arbitrary precision.  They're just many orders of magnitude
slower than hardware FPU ops, but they also have the benefit of
carrying their work out to far more significant digits.

It all depends on what you need.


But in either case, overheads of using a function call are going to be insignificant.

Agreed.

So I can't see the need to re-use 8087 opcodes. In any case, those are designed to work with a small stack of 80-bit floating point values (in that the operands will often be implicit). Arbitrary precision numbers would have a different representation, and need to be put elsewhere, and the results also need to be placed elsewhere

Absolutely.

--
Rick C. Hodgin



1
rocksolid light 0.8.3
clearneti2ptor