Difference between revisions of "6502"
From SizeCoding
(65 intermediate revisions by 9 users not shown) | |||
Line 7: | Line 7: | ||
=== The 6502 processor === | === The 6502 processor === | ||
− | The 6502 processor can be seen as the | + | The 6502 processor can be seen as the 8-bit micro ARM chip. |
− | It has only has 3 registers ( | + | It has only has 3 registers (Accumulator, X and Y registers) and a handful of instructions to work with. |
− | === | + | === Adressing modes === |
To be added. | To be added. | ||
Line 16: | Line 16: | ||
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=""> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | <syntaxhighlight lang=" | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
ldx #0 | ldx #0 | ||
ldy #$3f | ldy #$3f | ||
Line 76: | Line 40: | ||
sta value_hi+1 | sta value_hi+1 | ||
− | sta | + | sta sintab+$c0,x |
− | sta | + | sta sintab+$80,y |
eor #$7f | eor #$7f | ||
− | sta | + | sta sintab+$40,x |
− | sta | + | sta sintab+$00,y |
lda delta_lo+1 | lda delta_lo+1 | ||
Line 91: | Line 55: | ||
dey | dey | ||
bpl make_sine | bpl make_sine | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | + | === General 6502 Resources === |
− | * | + | * 6502.org http://www.6502.org/ |
+ | * 6502 instruction reference http://www.6502.org/tutorials/6502opcodes.html | ||
+ | * 6502 books http://retro.hansotten.nl/6502-sbc/ | ||
+ | * 6502 Assembler tutorial https://dwheeler.com/6502/oneelkruns/asm1step.html | ||
+ | * Easy 6502 code tester https://skilldrick.github.io/easy6502/ | ||
+ | * Synthetic instructions https://wiki.nesdev.com/w/index.php/Synthetic_instructions#8-bit_rotate |
Latest revision as of 12:55, 8 April 2024
Contents
Introduction
Wanting to start sizecoding on a 6502 platform in this day and age can be tough.
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
- 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
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.org http://www.6502.org/
- 6502 instruction reference http://www.6502.org/tutorials/6502opcodes.html
- 6502 books http://retro.hansotten.nl/6502-sbc/
- 6502 Assembler tutorial https://dwheeler.com/6502/oneelkruns/asm1step.html
- Easy 6502 code tester https://skilldrick.github.io/easy6502/
- Synthetic instructions https://wiki.nesdev.com/w/index.php/Synthetic_instructions#8-bit_rotate