Difference between revisions of "6502"

From SizeCoding
Jump to: navigation, search
 
(2 intermediate revisions by 2 users not shown)
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
 +
 +
== 6502 Based Platforms ==
 +
*'''[[Atari 8Bit]]''' - Atari 8-Bit Family (Atari XL/XE, etc.)
 +
*'''[[Apple II]]''' - Apple II(e)
 +
*'''[[Commodore 64]]''' - Commodore 64
 +
*'''[[BBC Micro]]''' - Acorn BBC Micro/Master/Electron.
 +
*'''[[Atari Lynx]]''' - Atari Lynx Handheld
 +
 +
== 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 ===
Line 23: Line 64:
 
* Easy 6502 code tester https://skilldrick.github.io/easy6502/
 
* Easy 6502 code tester https://skilldrick.github.io/easy6502/
 
* Synthetic instructions https://wiki.nesdev.com/w/index.php/Synthetic_instructions#8-bit_rotate
 
* Synthetic instructions https://wiki.nesdev.com/w/index.php/Synthetic_instructions#8-bit_rotate
 
== 6502 Based Platforms ==
 
*'''[[Atari 8Bit]]''' - Atari 8-Bit Family (Atari XL/XE, etc.)
 
*'''[[Apple II]]''' - Apple II(e)
 
*'''[[Commodore 64]]''' - Commodore 64
 
*'''[[BBC Micro]]''' - Acorn BBC Micro/Master/Electron.
 
*'''[[Atari Lynx]]''' - Atari Lynx Handheld
 

Latest revision as of 13:55, 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

6502 Based Platforms

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