Jump to content


   (0 reviews)

About This File

When programming in assembly language, quite often you will need to do calculations that would normally require
floating point math.  Those subroutines are available, the same ones that BASIC uses, but they are very slow.  And
if you're programming in assembly, you're doing so because it's much faster than BASIC, so using those routines can
defeat the purpose, particularly if you need to do a lot of such calculations.

Ideally in assembly language you want to have most of your variables consisting of single bytes, not the five used
for floating point.  It's having to move all those bytes around and doing calculations involving all of them
that makes the floating point subroutines slow.  And if you're going for speed, you can make a tradeoff: increased
speed at the expense of accuracy.  A function involving a single byte can just be a lookup table.

Over the last several years I have developed a number of lookup tables and subroutines that enable some very fast
math on the 6502 and now 65c02. FASTMATH.BIN is many of them compiled into a single 8kb file that can be loaded into 
banked RAM.
These lookup tables and functions will work on all revisions of the X16 emulator, and indeed will work on any 65c02
system as long as the file is loaded at $A000.  The functions are all called through JMP redirects in page BF, and
those JMP table locations will not change if I do revisions on the code.  I'm pretty sure I killed all the bugs, but
some might have slipped through.

This is probably going to be the final revision of FASTMATH, barring some sneaky bug hiding in the code.  There's
only 6 bytes left anyhow.

The file fastmath.txt contains detailed information about each lookup table and function and how to use them.

The file FASTMATH.BIN is the binary that must be loaded into banked RAM.

Edited by Ed Minchau


  • Like 1

User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

  • Create New...

Important Information

Please review our Terms of Use