AnyCPU
http://anycpu.org/forum/

Question: Floating Point for 8 Bit Systems
http://anycpu.org/forum/viewtopic.php?f=25&t=1109
Page 1 of 1

Author:  mmruzek [ Sun Mar 03, 2024 12:21 pm ]
Post subject:  Question: Floating Point for 8 Bit Systems

Given an 8-Bit homebrew computer with more or less some of the basic assembly language instructions, and a 64KB memory space, what would be a reasonable approach to a model or system for handling floating point numbers? I'm thinking along of the lines of 16 bit, which I see described as half precision

https://en.wikipedia.org/wiki/Half-prec ... int_format

Can anyone point to good reference or discussion on how to code a simple floating point number system? (The simpler the better!) It's also quite fascinating to me the different numbering and coding systems people have devised to represent data, like audio codecs. Thanks! Michael

Author:  robfinch [ Sun Mar 03, 2024 4:18 pm ]
Post subject:  Re: Question: Floating Point for 8 Bit Systems

Did you have a look at these routines for the 6502?
http://6502.org/source/floats/wozfp1.txt

I have used these in the past. It is a two's complement significand representation instead of sign-magnitude.
It is for 32-bit floating-point IIRC. But the same approach could be used for 16-bit.
The code is reasonably short, probably okay for a micro-controller.

Author:  oldben [ Sun Mar 03, 2024 5:26 pm ]
Post subject:  Re: Question: Floating Point for 8 Bit Systems

Microsoft switched from a 4 byte floating point to a 5 byte floating point with a later version of Basic.

Author:  mmruzek [ Sun Mar 03, 2024 11:22 pm ]
Post subject:  Re: Question: Floating Point for 8 Bit Systems

robfinch wrote:
Did you have a look at these routines for the 6502?
http://6502.org/source/floats/wozfp1.txt

I have used these in the past. It is a two's complement significand representation instead of sign-magnitude.
It is for 32-bit floating-point IIRC. But the same approach could be used for 16-bit.
The code is reasonably short, probably okay for a micro-controller.



Thanks Rob. That's just the kind of jump-start I was looking for! I always enjoy looking at code like that.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/