• Please review our updated Terms and Rules here

String to floating point conversion in ML for 8088

Ruud

Veteran Member
Joined
Nov 30, 2009
Messages
962
Location
Heerlen, NL
Hello,

I know how to convert a number like 286.75 into FP by hand. One of the two main problems I have is 1) converting the fraction into FP using 8088 instructions and 2) how to handle E-numbers like 1.23456 E 14 when the exponent is large.

If I google on the subject I get a lot of hits that point to the way it is in done in Python, C, etc. i.e. using their interna functions. The very few ones I found so far use ML used 8087 instructions. I even tried Turbo Debugger to see how Turbo Pascal does it, only to find out that still outputs FPU code and while stepping through the program, the emulated code is executed under water.

The one solution I have now is looking at the source code of the ROMs of the C64 to see how it was done there. A problem, the comments are not always clear or it was not understood well by the author. I think that given time, I will solve it. But OTOH in this case it is stupid to invent the wheel twice IMHO. Real code or a good document is welcome!

Thank you very much in advance for any help!
 

daver2

Veteran Member
Joined
Jun 19, 2012
Messages
9,340
Location
UK - Worcester

davide78

Experienced Member
Joined
Oct 2, 2019
Messages
61
Location
Italy
The UCR Standard Library for 80x86 Assembly Language Programmers contains some routines to do floating point computations, including conversion to/from strings.


Documentation may be found in the 1st edition of "The art of assembly programming". The website that used to host the free edition of the book seems to be defunct, but there should be other sources out it in the web. If not, I have a copy that I can share.
 

Ruud

Veteran Member
Joined
Nov 30, 2009
Messages
962
Location
Heerlen, NL

Ruud

Veteran Member
Joined
Nov 30, 2009
Messages
962
Location
Heerlen, NL
The UCR Standard Library for 80x86 Assembly Language Programmers contains some routines to do floating point computations, including conversion to/from strings.


Documentation may be found in the 1st edition of "The art of assembly programming". The website that used to host the free edition of the book seems to be defunct, but there should be other sources out it in the web. If not, I have a copy that I can share.
I just happen to have have the HTML and PDF version. I read about the UCR Standard Library but it didn't ring a bell at all. So thank you very much!

I also seem to have the source codes and executables that go with each chapter. If you or anyone is interested, PM me, or better: visit my site to obtain my private email address.

EDIT: I just found out what I have is part of the ZIP that contains the above FP.ASM. So grab the complete ZIP and you have both!
 
Last edited:
Top