Difference between revisions of "6502"

From SizeCoding
Jump to: navigation, search
m (Childishbeat moved page 6502 based CPUs to 6502: Less verbose)
Line 15: Line 15:
 
=== Zero page ===
 
=== Zero page ===
 
When using the 6502 for sizecoding, you'll mostly be working from zeropage
 
When using the 6502 for sizecoding, you'll mostly be working from zeropage
 +
 +
== Generic 6502 sinus table generator ==
 +
<syntaxhighlight lang="">
 +
ldx #0
 +
ldy #$3f
 +
make_sine:
 +
value_lo
 +
lda #0
 +
clc
 +
delta_lo
 +
adc #0
 +
sta value_lo+1
 +
value_hi
 +
lda #0
 +
delta_hi
 +
adc #0
 +
sta value_hi+1
 +
 +
sta sintab+$c0,x
 +
sta sintab+$80,y
 +
eor #$7f
 +
sta sintab+$40,x
 +
sta sintab+$00,y
 +
 +
lda delta_lo+1
 +
adc #8
 +
sta delta_lo+1
 +
bcc nothing
 +
inc delta_hi+1
 +
nothing
 +
inx
 +
dey
 +
bpl make_sine
 +
</syntaxhighlight>
  
 
=== General 6502 Resources ===
 
=== General 6502 Resources ===

Revision as of 12:54, 8 April 2024

Introduction

Wanting to start sizecoding on a 6502 platform in this day and age can be tough.

6502.jpg

So here is a bit of help to get you started:

The 6502 processor

The 6502 processor can be seen as the 8-bit micro ARM chip. It has only has 3 registers (Accumulator, X and Y registers) and a handful of instructions to work with.

Adressing modes

To be added.

Zero page

When using the 6502 for sizecoding, you'll mostly be working from zeropage

Generic 6502 sinus table generator

	ldx #0
	ldy #$3f
make_sine:
value_lo
			lda #0
			clc
delta_lo
			adc #0
			sta value_lo+1
value_hi
			lda #0
delta_hi
			adc #0
			sta value_hi+1
 
			sta sintab+$c0,x
			sta sintab+$80,y
			eor #$7f
			sta sintab+$40,x
			sta sintab+$00,y
 
			lda delta_lo+1
			adc #8
			sta delta_lo+1
			bcc nothing
			inc delta_hi+1
nothing
			inx
			dey
			bpl make_sine

General 6502 Resources

6502 Based Platforms