User Tools

Site Tools


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

  • Fast sqrt (extracted from CSDB forums)- Graham



Floating point

Mathematics in assembly

The art of 3d

Also I strongly advise you 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

base/6502_6510_maths.txt · Last modified: 2018-02-11 22:59 by neils