User Tools

Site Tools


This is an old revision of the document!

6502/6510 Maths

This is where you find pure math routines, i.e. not algorithms dependent of the workings of the graphics chip such as line drawing (which you find in the VIC section instead). Since the material in here does not really relate to other hardware than the 6502/6510, it is also useful for other systems which are based on 6502/6510 CPUs.

Math Operations

The only mathematical operations included in the 6502/6510 set of instructions are addition and subtraction. In order to do things like multiplication, division, roots, squares and so on, you have to write code for it.






Square Root



Floating point

Mathematics in assembly

The art of 3d

You may also want to read Stephen Judd's awesome series titled “A different perspective” about 3d coding in C= Hacking:



The sorting routines below are taken from

Also see the page on sprites for some sorting routines optimised for sprite multiplexers.

Random Numbers

Number conversion

Packing/Crunching algos

For actual crunching software and usage of crunching software, see the cross development section or the tools for native development section instead.

base/6502_6510_maths.1639153015.txt.gz · Last modified: 2021-12-10 17:16 by kruthers