User Tools

Site Tools


base:6502_6510_maths

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.

Comparison

Addition/Subtraction

Multiplication

Division

Square Root

  • Fast sqrt (extracted from CSDB forums)- Graham

Log

Trigonometrics

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:

Algorithms

Sorting

The sorting routines below are taken from www.6502.org.

Random Numbers

Number conversion

Packing/Crunching algos

base/6502_6510_maths.txt · Last modified: 2017-03-27 09:19 by shrydar