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

Exponentiation

Square Root

Log

Trigonometrics

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:

Algorithms

Sorting

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

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.txt · Last modified: 2023-08-21 00:49 by repose