Rankin/Wozniak Floating-Point Routines Revisited

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
DavidL
Posts: 31
Joined: 26 Nov 2016
Location: Dallas, Tejas

Rankin/Wozniak Floating-Point Routines Revisited

Post by DavidL »

Greetings All,

After completing a project applying the Rankin/Wozniak floating-point routines quite some time ago I finally spent the time to finish polishing, documenting, and blending in the Red Book documentation. Attached is the result. My project used the routines with cc65 so there are wrapper functions at the end of the file. When I last ran them everything appeared to work well but "it's been a while"...

If anyone has any interest in this please feel free to reply with comments, suggestions, and (especially) corrections. I believe I've incorporated all the known corrections from previous discussions here but I may have missed something, especially in trying to incorporate/update the Red Book documentation.

Ready! Fire! Aim! Or something like that... :wink:

Thanks,
Dave
Attachments
RanWozFp.s
(55.2 KiB) Downloaded 122 times
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by BigDumbDinosaur »

DavidL wrote:
After completing a project applying the Rankin/Wozniak floating-point routines quite some time ago I finally spent the time to finish polishing, documenting, and blending in the Red Book documentation. Attached is the result.

What kind of file is a .S file?
x86?  We ain't got no x86.  We don't NEED no stinking x86!
DavidL
Posts: 31
Joined: 26 Nov 2016
Location: Dallas, Tejas

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by DavidL »

BigDumbDinosaur wrote:
DavidL wrote:
After completing a project applying the Rankin/Wozniak floating-point routines quite some time ago I finally spent the time to finish polishing, documenting, and blending in the Red Book documentation. Attached is the result.

What kind of file is a .S file?
Oh, that's the assembly file for the cc65 assembler, ca65.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by BigDumbDinosaur »

DavidL wrote:
BigDumbDinosaur wrote:
DavidL wrote:
After completing a project applying the Rankin/Wozniak floating-point routines quite some time ago I finally spent the time to finish polishing, documenting, and blending in the Red Book documentation. Attached is the result.

What kind of file is a .S file?
Oh, that's the assembly file for the cc65 assembler, ca65.
Are you aware that there were some logic errors in the original that were subsequently corrected? If so, did you roll those fixes into the above code? If I correctly recall, we have both the original and the fixes in the code section of 6502.org.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
DavidL
Posts: 31
Joined: 26 Nov 2016
Location: Dallas, Tejas

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by DavidL »

BigDumbDinosaur wrote:
DavidL wrote:
BigDumbDinosaur wrote:
DavidL wrote:
After completing a project applying the Rankin/Wozniak floating-point routines quite some time ago I finally spent the time to finish polishing, documenting, and blending in the Red Book documentation. Attached is the result.

What kind of file is a .S file?
Oh, that's the assembly file for the cc65 assembler, ca65.
Are you aware that there were some logic errors in the original that were subsequently corrected? If so, did you roll those fixes into the above code? If I correctly recall, we have both the original and the fixes in the code section of 6502.org.
OP second paragraph, second sentence: "I believe I've incorporated all the known corrections from previous discussions here..." :wink:
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by BigDumbDinosaur »

DavidL wrote:
OP second paragraph, second sentence: "I believe I've incorporated all the known corrections from previous discussions here..." :wink:

I guess what the ophthalmologist said was true when he told me I can't see worth a damn. :shock:
x86?  We ain't got no x86.  We don't NEED no stinking x86!
DavidL
Posts: 31
Joined: 26 Nov 2016
Location: Dallas, Tejas

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by DavidL »

Wow, can't say I expected this - 10 days on and even the crickets don't care. :(
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by BigDumbDinosaur »

DavidL wrote:
Wow, can't say I expected this - 10 days on and even the crickets don't care. :(

Things ebb and flow around here. Many members have other hobby interests besides working with 65xx stuff and they may have had a look but don’t have the time at the moment to mess with it and report results. One indication of interest is the number of downloads on the file you’ve posted. Somebody is interested, I’d say.

Incidentally, around the time Rankin and Wozniak were writing this, MOS Technology developed a floating point package for the KIM called KIMath. KIMath uses binary-coded decimal instead of binary and hence doesn’t exhibit the decimal <—> binary hinkiness seen in binary FP implementations. Naturally, the code was larger and slower than the Rankin-Wozniak implementation.

Also, Charles.R. Bond wrote a BCD floating point package for the 6502 that uses Cordic functions to improve performance and decrease code size. A link to it is posted here in our code section.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by BigEd »

Thanks David for putting this together and sharing it. As BDD says, offerings are often a slow burn.

(Here's a previous thread about Charles Bond's package, thanks BDD for the reminder:
Calc65: a BCD floating point package
See also a later post in that thread for a further development of the package, and then further posts for more.)

(However, I wouldn't want to muddy the waters: this thread is about a binary floating point package, and the other is about a BCD package. Each has its place. It would be a disservice to this thread to argue the relative merits - I'm fairly sure there are existing threads which do that.)
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by BigDumbDinosaur »

BigEd wrote:
(However, I wouldn't want to muddy the waters: this thread is about a binary floating point package, and the other is about a BCD package.

I only mentioned KIMath as a matter of historical interest. Thinking about it reminded me of Bond's implementation.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by BigEd »

Appreciated!
User avatar
Sheep64
In Memoriam
Posts: 311
Joined: 11 Aug 2020
Location: A magnetic field

Re: Rankin/Wozniak Floating-Point Routines Revisited

Post by Sheep64 »

DavidL on Fri 20 May 2022 wrote:
Wow, can't say I expected this - 10 days on and even the crickets don't care. :(
BigEd on Fri 20 May 2022 wrote:
As BDD says, offerings are often a slow burn.
Your work exceeds one download per day and that is extremely popular on the 6502 Forum. Detailed feedback may take one month or more but I'll make a special effort to review your work.
Post Reply