6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Mar 19, 2024 3:14 am

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Tue Feb 06, 2007 11:03 am 
Offline

Joined: Sun Aug 24, 2003 7:17 pm
Posts: 111
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).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Feb 06, 2007 4:49 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 08, 2007 12:18 pm 
Offline

Joined: Sun Aug 24, 2003 7:17 pm
Posts: 111
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!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 26, 2007 7:59 pm 
Offline
User avatar

Joined: Sun Feb 13, 2005 9:58 am
Posts: 85
6502 float commodore is the same also in amiga version? (but larger, of course) i mean same format and same algorithms?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Feb 27, 2007 2:59 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
No; the Amiga version conforms to IEEE 754 (mathieee.library and mathieeedoub.library) and is not related, as far as I know, to the format used by the PET kernels (of which the VIC-20/C64/C128 kernels belong).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Feb 27, 2007 3:05 am 
Offline

Joined: Mon Oct 16, 2006 8:28 am
Posts: 106
ptorric wrote:
6502 float commodore is the same also in amiga version? (but larger, of course) i mean same format and same algorithms?


Nope, I'm afraid. The mathieee#?.library use the ieee single and double precision formats, which are not the same as Commodore's. The FFP versions of the math libraries use the following format, which is also different from the 6 byte CBM format (cut'n'paste from the RKM):

Code:
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 19, 2007 7:23 pm 
Offline

Joined: Sun Aug 24, 2003 7:17 pm
Posts: 111
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!


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Wed Dec 24, 2014 10:04 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8406
Location: Southern California
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!

Mats, when I click on the link now, I just get a message that Geocities closed in 2009. Have you moved your material to another site?

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 25, 2014 5:43 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10753
Location: England
There are some archive copies:
http://www.geocities.ws/matsr2007/
http://www.oocities.org/matsr2007/
And
http://web.archive.org/web/200910270419 ... matsr2007/


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 25, 2014 8:19 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8406
Location: Southern California
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?


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 26, 2014 11:24 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8099
Location: Midwestern USA
BigEd wrote:

From his article:

    The COMMODORE floating point format used for the PET computer deviates from the IEEE standard...

One could incorrectly deduce from this statement that the IEEE-754 standard predated Commodore's (actually, Microsoft's) excess-128 notation. Although seminal work on IEEE-754 began in 1977, the standard wasn't ratified until 1985, some seven years after excess-128 notation was introduced with PET BASIC 1.0.

Also:

    Any application using at least a rudimentary amount of mathematics should use floating point.

I disagree. A surprisingly large amount of computation can be accomplished with integer arithmetic, especially at the operating system level. Even procedures such as converting between UNIX time_t format and Gregorian notation can be accomplished with integer arithmetic. In developing the software that models my 816NIX filesystem, I used 64 bit integer arithmetic, with final results rounded to 32 bits, since the filesystem architecture itself is 32 bit.

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!


Top
 Profile  
Reply with quote  
PostPosted: Sat Dec 27, 2014 8:46 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10753
Location: England
BigDumbDinosaur wrote:
Unfortunately, the embedded links are broken.

They all seem fine for me. If you find a broken link, try the usual tactics to resolve it to an archived or relocated copy. If it's still problematic, ask for help with the usual tactics: describe your problem and what you've tried to do.

Cheers
Ed


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: