The Woz FP routines
The Woz FP routines
For a little project I need a single precision/4-byte solution. (It has to be 4 bytes for other reasons).
I'm probably going to just use the Woz routines, but was wondering if there is any merit in coding an IEEE-754 solution, given the recent thread. The numbers won't be exported in anything other than on-screen so a compatible binary format isn't required.
It's not for anything vaguely critical, just a little interpreter for a bit of fun.
So just wondering if anyone has used/is using the Woz routines on a daily basis if if they're happy with them..
Cheers,
-Gordon
I'm probably going to just use the Woz routines, but was wondering if there is any merit in coding an IEEE-754 solution, given the recent thread. The numbers won't be exported in anything other than on-screen so a compatible binary format isn't required.
It's not for anything vaguely critical, just a little interpreter for a bit of fun.
So just wondering if anyone has used/is using the Woz routines on a daily basis if if they're happy with them..
Cheers,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: The Woz FP routines
I haven't used them, but I would use them! I lack the sense of impending joy from implementing my own. In other words, I'd say it's worth implementing a floating point package if you really want to implement a floating point package. But not worth it as a means to an end. This is of course only my take on it!
Re: The Woz FP routines
For simple purpose, the Woz routines do work - after all, they shipped in millions of Apple ]['s. They have similar theoretical range and precision to IEEE-754 single precision - with some caveats.
Caveat 1: AFAIK, the Woz routines have no guard digits, and thereby have only a primitive treatment of rounding error. This could seriously hurt practical precision in some cases.
Caveat 2: the Woz format has no support whatsoever for Infinities or NaNs, so must treat overflow, range or other errors with exception traps instead of returning an interpretable value. Conversely, it does have a slightly extended dynamic range for representing finite values.
It would probably be good practice to design your interpreter in such a way that the Woz routines can be swapped out for something else later, in case you find a need or use for something more capable.
Caveat 1: AFAIK, the Woz routines have no guard digits, and thereby have only a primitive treatment of rounding error. This could seriously hurt practical precision in some cases.
Caveat 2: the Woz format has no support whatsoever for Infinities or NaNs, so must treat overflow, range or other errors with exception traps instead of returning an interpretable value. Conversely, it does have a slightly extended dynamic range for representing finite values.
It would probably be good practice to design your interpreter in such a way that the Woz routines can be swapped out for something else later, in case you find a need or use for something more capable.
Re: The Woz FP routines
Just as suggestion: why don't use the Microsoft 5 bytes f.p. implementation as in commodore line?
http://65xx.unet.bz/ - Hardware & Software 65XX family
Re: The Woz FP routines
Chromatix wrote:
For simple purpose, the Woz routines do work - after all, they shipped in millions of Apple ]['s. They have similar theoretical range and precision to IEEE-754 single precision - with some caveats.
Chromatix wrote:
Caveat 1: AFAIK, the Woz routines have no guard digits, and thereby have only a primitive treatment of rounding error. This could seriously hurt practical precision in some cases.
Caveat 2: the Woz format has no support whatsoever for Infinities or NaNs, so must treat overflow, range or other errors with exception traps instead of returning an interpretable value. Conversely, it does have a slightly extended dynamic range for representing finite values.
It would probably be good practice to design your interpreter in such a way that the Woz routines can be swapped out for something else later, in case you find a need or use for something more capable.
Caveat 2: the Woz format has no support whatsoever for Infinities or NaNs, so must treat overflow, range or other errors with exception traps instead of returning an interpretable value. Conversely, it does have a slightly extended dynamic range for representing finite values.
It would probably be good practice to design your interpreter in such a way that the Woz routines can be swapped out for something else later, in case you find a need or use for something more capable.
Thanks,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: The Woz FP routines
granati wrote:
Just as suggestion: why don't use the Microsoft 5 bytes f.p. implementation as in commodore line?
Cheers,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: The Woz FP routines
Note this fix needed for Woz and Rankin's LOG:
viewtopic.php?p=63993#p63993
viewtopic.php?p=63993#p63993
Re: The Woz FP routines
BTW, Microsoft's Basic came in a 4 byte version as well as the more commonly seen 5 byte version:
https://www.pagetable.com/?p=46
https://www.pagetable.com/?p=46
Re: The Woz FP routines
drogon wrote:
granati wrote:
Just as suggestion: why don't use the Microsoft 5 bytes f.p. implementation as in commodore line?
Cheers,
-Gordon
http://65xx.unet.bz/ - Hardware & Software 65XX family
Re: The Woz FP routines
I imagine there are code size/complexity/speed advantages if all objects are the same size.
Re: The Woz FP routines
granati wrote:
drogon wrote:
granati wrote:
Just as suggestion: why don't use the Microsoft 5 bytes f.p. implementation as in commodore line?
Cheers,
-Gordon
Cheers,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: The Woz FP routines
BigEd wrote:
BTW, Microsoft's Basic came in a 4 byte version as well as the more commonly seen 5 byte version:
https://www.pagetable.com/?p=46
https://www.pagetable.com/?p=46
Cheers,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: The Woz FP routines
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
Re: The Woz FP routines
It looks like there's also a 4-byte floating point package in the 6502 Software Gourmet Guide & Cookbook:
http://www.classiccmp.org/cini/books/Sc ... okbook.pdf
(Chapter 5, page 93 of the PDF)
(There's no text layer in this PDF! So lots of typing ahead, or some OCR and proof-reading.)
Edit: also at the Internet Archive, with text layer, here.
http://www.classiccmp.org/cini/books/Sc ... okbook.pdf
(Chapter 5, page 93 of the PDF)
(There's no text layer in this PDF! So lots of typing ahead, or some OCR and proof-reading.)
Edit: also at the Internet Archive, with text layer, here.
Last edited by BigEd on Sat Jan 21, 2023 8:01 pm, edited 1 time in total.
Re: The Woz FP routines
BigEd wrote:
It looks like there's also a 4-byte floating point package in the 6502 Software Gourmet Guide & Cookbook:
http://www.classiccmp.org/cini/books/Sc ... okbook.pdf
(Chapter 5, page 93 of the PDF)
(There's no text layer in this PDF! So lots of typing ahead, or some OCR and proof-reading.)
http://www.classiccmp.org/cini/books/Sc ... okbook.pdf
(Chapter 5, page 93 of the PDF)
(There's no text layer in this PDF! So lots of typing ahead, or some OCR and proof-reading.)
If you look at the code, the author does a curious thing.
You see a lot of this:
Code: Select all
LDX #LBL1
STA PAGE0, X
Code: Select all
LDX #LBL1
STA $0,X
Very odd.