On
http://6502.org/source/
the Wozniak software for floating point computations in Apple format (?)can be found. I have coded alternative subroutines for the Commodore format. I think the Commodore version with 32 bits for the mantissa instead of the 23 bits used by Wozniak (24 bits including the "sign bit") is more praxis oriented. The same can be said by the FLOAT and the FIX subroutines that for the Wozniak software transform to/from 16 bits signed integer while I base this on 32 bit unsigned integers. An explication of the floating point concept and my code can be found on the "free-site"
http://www.geocities.com/matsr2007/
I hope Mike will include this later in http://6502.org/source/! When (if ever) he has done so I will close the "geocities" site as I do not normally maintain any "home page".
Does anybody have access to the original Commodore source code for corresponding tasks? It would be interesting to compare how this originally was coded by Microsoft (that provided the BASIC software for the PET).
Floating point math on 6502, Commodore style
Somewhere on my box at home, I have the Commodore 64 version of BASIC 2.0 source listing, generated from a ROM dump and disassembler. But this can also be found online too (it's where I got it from). Try http://www.tkk.fi/Misc/cbm/docs/c64-diss.html
Do get a ROM dump is the easy start, this one indeed finds in the Internet. The hard part is to extract some sensible portable code out of this dump!
I just udated
http://geocities.com/matsr2007/
to include a PET ROM dump in a format that is directly useable by an Assembler (".DB statements") + a desassembly of the part of the ROM where the code for these "Microsoft-computations" is positioned. I invite all "CBM hackers" to extract portable subroutines out of this!
I just udated
http://geocities.com/matsr2007/
to include a PET ROM dump in a format that is directly useable by an Assembler (".DB statements") + a desassembly of the part of the ROM where the code for these "Microsoft-computations" is positioned. I invite all "CBM hackers" to extract portable subroutines out of this!
ptorric wrote:
6502 float commodore is the same also in amiga version? (but larger, of course) i mean same format and same algorithms?
Code: Select all
FFP floating-point variables are defined within C by the float or FLOAT
directive. In assembly language they are simply defined by a DC.L/DS.L
statement. All FFP floating-point variables are defined as 32-bit entities
(longwords) with the following format:
_____________________________________________
| |
| MMMMMMMM MMMMMMMM MMMMMMMM EEEEEEE |
| 31 23 15 7 |
|_____________________________________________|
The mantissa is considered to be a binary fixed-point fraction; except for
0, it is always normalized (the mantissa is shifted over and the exponent
adjusted, so that the mantissa has a 1 bit in its highest position).
Thus, it represents a value of less than 1 but greater than or equal to
1/2.
The sign bit is reset (0) for a positive value and set (1) for a negative
value.
The exponent is the power of two needed to correctly position the mantissa
to reflect the number's true arithmetic value. It is held in excess-64
notation, which means that the two's-complement values are adjusted upward
by 64, thus changing $40 (-64) through $3F (+63) to $00 through $7F. This
facilitates comparisons among floating-point values.Actually ,scrolling through "http://www.woz.org/" I saw a statement of Mr Wozniak himself saying that Apple decided to go for the Microsoft floating point BASIC instead of for the system Wozniak was working at. This then means that my heading should have been "Commodore and Apple style, in fact Microsoft style". And considering that Wozniak only was using 32 bits I am convinced Apple was right. There are a lot of applications that need higher accuracy. Then 40 bits are better!
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re:
Mats wrote:
Do get a ROM dump is the easy start, this one indeed finds in the Internet. The hard part is to extract some sensible portable code out of this dump!
I just udated
http://geocities.com/matsr2007/
to include a PET ROM dump in a format that is directly useable by an Assembler (".DB statements") + a desassembly of the part of the ROM where the code for these "Microsoft-computations" is positioned. I invite all "CBM hackers" to extract portable subroutines out of this!
I just udated
http://geocities.com/matsr2007/
to include a PET ROM dump in a format that is directly useable by an Assembler (".DB statements") + a desassembly of the part of the ROM where the code for these "Microsoft-computations" is positioned. I invite all "CBM hackers" to extract portable subroutines out of this!
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Floating point math on 6502, Commodore style
Thanks Ed. So the same thing is in several different places. We have not heard from Mats in six years.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Floating point math on 6502, Commodore style
BigEd wrote:
There are some archive copies:
http://www.geocities.ws/matsr2007/
http://www.oocities.org/matsr2007/
And
http://web.archive.org/web/200910270419 ... matsr2007/
http://www.geocities.ws/matsr2007/
http://www.oocities.org/matsr2007/
And
http://web.archive.org/web/200910270419 ... matsr2007/
- The COMMODORE floating point format used for the PET computer deviates from the IEEE standard...
Also:
- Any application using at least a rudimentary amount of mathematics should use floating point.
Otherwise, it's a good posting that tries to explain a complicated topic. Unfortunately, the embedded links are broken.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Floating point math on 6502, Commodore style
BigDumbDinosaur wrote:
Unfortunately, the embedded links are broken.
Cheers
Ed