LearnAsm.net

Learn Assembly Programming...
With ChibiAkumas!




6502 Resources

Resources related to these tutorials

6502 Cheatsheet - Commands and info
Cheatsheet for 6502 assembly development - contains 6502, 65C02 and 6280 opcodes - also some 65816
DevToos - My collection of 6502 Development tools and scripts
Download these to get started with my 6502 tutorials quickly and easily.
Sources.7z - All sourcecode for my tutorials
Download this to get all the source code for my tutorials

6502 Tutorials

Basic 6502 tutorials - lets learn how to start programming the 6502

Lesson 1 - Getting started with 6502 [6502]
Learn the basics of using VASM as an assembler, We'll cover the 'template' ASM file used by these tutorials, and look at the basic registers and numbers. Well also look at ADDition and SUBtraction, Jumping to subroutines (JSR), labels and moving data between registers with TXA,TYA,TAX,TAY. We'll also cover Loading and saving to and from memory.
[Documentation] [Video] [Forum]
Lesson 2 - Addressing modes on the 6502 [6502]
The 6502 has a wide variety of 'addressing modes' - Each addressing mode will change the way the final address a command loads from or saves to works, we can used fixed addresses, registers and many clever combinations!... we'll look at each with practical examples
[Documentation] [Video] [Forum]
Lesson 3 - Loops and Conditions [6502]
We'll cover starting a program with ORG, labels, SEI for disabling interrupts, symbols with EQU, INC and DEC for + or - 1...
Branches: BEQ BNE, BCS,BCC and many more! Compare with CMP, CPX, CPY... Jump with JMP, or subs with JSR... using BVC to simulate missing BRA
[Documentation] [Video] [Forum]
Lesson 4 - Stacks and Math [6502]
The Stack is a temporary store we can transfer data into with PHA/PLA or PHP/PLP.. we'll also look at negative numbers, Conditional assembly with IFDEF, macros, and using 16 bit on the 8 bit 6502... also we'll take a look at how to effect simple multiplication or division on the 6502
[Documentation] [Video] [Forum]
Lesson 5 - Bits and Shifts [6502]
Logical Operations AND, ORA and EOR... bit rotation with ROL, ROR, ASL and LSR... bit test with BIT.. doing nothing with NOP
[Documentation] [Video] [Forum]
Lesson 6 - Defined data, Aligned data... Lookup Tables, Vector Tables, and Self-modifying code! [6502]
Defining data with DB, DW and DS...reading values Lookup tables, jumping to locations in Vector Tables, Self Modifying code - code that rewrites itself!
[Documentation] [Video]

Advanced Series

More advanced topics - look at these after the main series

Lesson A1 - Extra commands in the 65c02 (Snes,Lynx & Apple II) and 6280 (PC Engine) processor [6502]
Many useful commands were added to the 6502. Lets learn about the extra commands that were added to the successor to the 65c02 and and 6280
[Documentation] [Video] [Forum]

Hello World

Get Hello World on your favorite 8 bit machine with a single ASM file!

Lesson H1 - Hello World on the BBC Micro! [BBC]
Lets learn how to make a simple 'Hello World' on the Classic BBC Micro, we'll learn how to write the code, compile it with VASM, convert it to a disk image, and load it on an emulator
[Documentation] [Video]
Lesson H2 - Hello World on the C64 [C64]
Lets learn how to make a simple 'Hello World' on the Commodore 64, we'll learn how to write the code, compile a .PRG with VASM, and load it on an emulator
[Documentation] [Video]
Lesson H3 - Hello World on the VIC-20 [VIC]
Lets learn how to make a simple 'Hello World' on the VIC-20, we'll learn how to write the code, compile a .PRG with VASM, and load it on an emulator
[Documentation] [Video]
Lesson H4 - Hello World on the Atari 800 / 5200 [A52] [A80]
Lets learn how to make a simple 'Hello World' on the Atari 800 or Atari 5200, we'll learn how to write the code, compile a ROM with VASM, and load it on an emulator
[Documentation] [Video]
Lesson H5 - Hello World on the Apple II [AP2]
Lets learn how to make a simple 'Hello World' on the Commodore 64, we'll learn how to write the code, compile it with VASM, transfer it to a disk image, and load it on an emulator
[Documentation] [Video]
Lesson H6 - Hello World on the Atari Lynx [LNX]
Lets learn how to make a simple 'Hello World' on the Atari Lynx, we'll learn how to write the code, compile an unencrypted object file (.o) with VASM, and load it on an emulator
[Documentation] [Video]
Lesson H7 - Hello World on the Nes / Famicom [NES]
Lets learn how to make a simple 'Hello World' on the Nintendo Entertainment system, or Nintendo Famicom, we'll learn how to write the code, compile a NES ROM with VASM, and load it on an emulator
[Documentation] [Video]
Lesson H8 - Hello World on the SNES / Super Famicom [SNS]
Lets learn how to make a simple 'Hello World' on the Super Nintendo Entertainment System (AKA Super Famicom), we'll learn how to write the code, compile a SFC ROM, and load it on an emulator
[Documentation] [Video]
Lesson H9 - Hello World on the PC Engine/TurboGrafx-16 Card [PCE]
Lets learn how to make a simple 'Hello World' on the PC Engine (sold as the TurboGrafx 16 in the west), we'll learn how to write the code, compile a .PCE ROM with VASM, and load it on an emulator
[Documentation] [Video]
Lesson H10 - Hello World on the Commodore PET [PET]
The PET is the predecessor of the VIC-20, it's only capable of 'text graphics' and cannot allow custom characters. Lets learn how to make the PET to say 'Hello'


Simple Series

Basic Tutorials doing common game programming tasks in a single ASM file

Lesson S1 - Bitmap Drawing on the BBC [BBC]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using the bitmap screen
[Documentation] [Video]
Lesson S2 - Bitmap Drawing on the C64 [C64]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using the bitmap screen... we'll test this in 2 and 4 color mode
[Documentation] [Video]
Lesson S3 - Bitmap Drawing on the VIC-20 [VIC]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using custom VIC 20 characters.
[Documentation] [Video]
Lesson S4 - Bitmap Drawing on the Atari 800 / 5200 [A52] [A80]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using the bitmap screen in 4 or 2 color
[Documentation] [Video]
Lesson S5 - Bitmap Drawing on the Apple II [A52] [A80]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using the bitmap screen.
[Documentation] [Video]
Lesson S6 - Bitmap Drawing on the Atari Lynx [LNX]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using the bitmap screen.
[Documentation] [Video]
Lesson S7 - Bitmap Drawing on the Nes / Famicom [NES]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using the Tile map.
[Documentation] [Video]
Lesson S8 - Bitmap Drawing on the SNES / Super Famicom [SNS]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using the Tile map.
[Documentation] [Video]
Lesson S9 - Bitmap Drawing on the on the PC Engine/TurboGrafx-16 Card [PCE]
Lets look at a simple example of drawing an 8x8 smiley, and a 48x48 bitmap of our mascot using the Tile map.
[Documentation] [Video]
Lesson S10 - Joystick Reading on the BBC [BBC]
We're going to extend the previous simple bitmap example, and add joystick reading to allow a player sprite to be moved around the screen.
Lets learn how to add some control to our game!
[Documentation] [Video]
Lesson S11 - Joystick reading on the C64 [C64]
Lets take our previous Bitmap Smiley example, and extend it out into a joystick controlled movable object - we could use this as the starting point for a simple game.
[Documentation] [Video]
Lesson S12 - Joystick Reading on the VIC-20 [VIC]
The VIC-20 uses a digital joystick, and we can read it's directions in from a pair of ports... Lets enhance our previous bitmap example, and make it move!
[Documentation] [Video]
Lesson S13 - Joystick Reading on the Atari 800 / 5200 [A52] [A80]
Joystick reading on the Atari is easy... or a pain!... it just depends if you're programing for the Atari 800 (which has a digital input via the PIA) or the 5200 (which has no PIA, so only has analog via the POKEY!) Either way, We'll figure it out... Here we go!
[Documentation] [Video]
Lesson S14 - Joystick Reading on the Apple II [AP2]
Reading the Apple II Joystick is a serious pain! We have to read a single bit from the ports - and wait until it changes to get the analog values, then convert them to digital. Lets figure it out!
[Documentation] [Video]
Lesson S15 - Joypad Reading on the Atari Lynx [LNX]
The Lynx makes joypad reading easy for us... we can just read the keypresses in from port $FCB0. Lets make it happen!
[Documentation] [Video]
Lesson S16 - Joypad Reading on the Nes / Famicom [NES]
The Famicom/NES have digital joysticks... we can read the buttons in, but we have to do this a single key at a time... Let get it working!
[Documentation] [Video]
Lesson S17 - Joypad Reading on the SNES / Super Famicom [SNS]
The Famicom/NES have digital joysticks... we can read the buttons in, but we have to do this a single key at a time... Let get it working!
[Documentation] [Video]
Lesson S18 - Bitmap Drawing on the on the PC Engine/TurboGrafx-16 Card [PCE]
The PC-Engine uses a single port with  4 bits to send the joypad buttons - it also supports up to 5 joypads via a multitap.
We'll need to reset the multitap, and read in Joypad 1 - Lets get started.
[Documentation] [Video]
Lesson S19 - Keypad Reading on the Commodore PET! [PET]
Let's use the keyboard to move a simple character block 'sprite' around the screen of the Commodore Pet!
[Documentation] [Video]
Lesson S20 - Sprite Clipping on the BBC [BBC]
We've looked before at drawing a bitmap to the screen, but there's a challenge! For many games we'll need to be able to draw sprites that are 'partially off' the screen, We'll clip off the offscreen part. Lets look at the upgraded code.
[Documentation] [Video]
Lesson S21 - Sprite Clipping on the C64 [C64]
We've looked before at drawing a bitmap to the screen, but we need to do better! For many games we'll need to be able to draw sprites that are 'partially off' the screen, We'll clip off the offscreen part. Lets look at the upgraded code.
[Documentation] [Video]
Lesson S22 - Sprite Clipping on the VIC-20 [VIC]
We've looked before at drawing a bitmap to the screen, but we need to do better! For many games we'll need to be able to draw sprites that are 'partially off' the screen, We'll clip off the offscreen part. Lets look at the upgraded code.
[Documentation] [Video]
Lesson S23 -Sprite Clipping on the Atari 800 / 5200 [A52] [A80]
Lets port our sprite clipping routine to the Atari systems, We'll 'upgrade' our previous sprite routine, so it can crop the sprites so they are partially offscreen.
[Documentation] [Video]
Lesson S24 - Sprite Clipping on the Apple II [AP2]
The Apple II screen is kind of Black and white - and Kind of color!... depending on the combination... lets learn what it all means, and get a smiley onscreen!
[Documentation] [Video]
Lesson S25 - Sprite Clipping on the Atari Lynx [LNX]
We drew a sprite to the screen before, now lets upgrade it with some sprite clipping.
[Documentation] [Video]
Lesson S26 -  Tile Bitmap Clipping on the NES [NES]
We drew our 'Chibiko' mascot on the NES using the tilemap before, this time we'll improve the code, allowing the image to be clipped. Lets have a go!
[Documentation] [Video]
Lesson S27 - Hardware Sprite Clipping on the NES [NES]
Using the Tilemap isn't so useful for moving objects, as we can't shift the co-ordinates at the pixel level,
This time, lets do the same as last time, but we'll make our 48x48 pixel sprite out of 6x6 hardware sprites for smooth moves!
[Documentation] [Video]
Lesson S28 -  Tile Bitmap Clipping on the SNES [SNS]
We drew our 'Chibiko' mascot on the SNES using the tilemap before, this time we'll improve the code, allowing the image to be clipped.
Lets have a go!
[Documentation] [Video]
Lesson S29 - Hardware Sprite Clipping on the SNES [SNS]
Using the Tilemap isn't so useful for moving objects, as we can't shift the co-ordinates at the pixel level,
This time, lets do the same as last time, but we'll make our 48x48 pixel sprite out of 6x6 hardware sprites for smooth moves!
[Documentation] [Video]
Lesson S30 - Tile Bitmap Clipping on the PC-Engine/Turbografix [PCE]
We drew our 'Chibiko' mascot on the PC-Engine using the tilemap before, this time we'll improve the code, allowing the image to be clipped.
Lets have a go!
[Documentation] [Video]
Lesson S31 - Hardware Sprite Clipping on the PC-Engine [PCE]
Using the Tilemap isn't so useful for moving objects, as we can't shift the co-ordinates at the pixel level,
This time, lets do the same as last time, but we'll make our 48x48 pixel sprite out of 3x3 hardware sprites (16 pixel square) for smooth moves!
[Documentation] [Video]
Lesson S32 - Char Block clipping on the Commodore PET! [PCE]
Lets alter our previous bitmap drawing routine, and allow it to be clipped so it can be partially offscreen.
[Documentation] [Video]

Platform Specific Series

Now we know the basics, lets look at the details of the platforms we're covering. We'll need to understand the hardware to figure out how to make it do what we need.

Lesson P1 - Bitmap Functions on the BBC [BBC]
In this lesson we'll take a look at the BBC screen layout, we'll learn how to set up the screen, calculate memory addresses for screen location and draw on the screen
[Documentation] [Video] [Forum]
Lesson P2 - Bitmap Functions on the Atari 800 / 5200 [A52] [A80]
In this lesson we'll take a look at the Atari 800 and 5200 screen, we'll learn how to set up the screen, calculate memory addresses for screen location and draw on the screen
[Documentation] [Video] [Forum]
Lesson P3 - Bitmap Functions on the Apple II [AP2]
In this lesson we'll take a look at the Apple II screen layout, we'll learn how to set up the screen, calculate memory addresses for screen location and draw on the screen, we'll also cover how the colors work on the Apple 2
[Documentation] [Video] [Forum]
Lesson P4 - Bitmap Functions on the Atari Lynx [LNX]
In this lesson we'll take a look at the Atari Lynx screen layout, we'll learn how to set up the screen, calculate memory addresses for screen location and draw on the screen.
[Documentation] [Video] [Forum]
Lesson P5 - Bitmap Functions on the PC Engine (TurboGrafx-16) [PCE]
In this lesson we'll take a look at the PC Engine Tilemap, we'll learn how to set up the screen, calculate memory addresses for screen location and draw on the screen with tiles.
[Documentation] [Video] [Forum]
Lesson P6 - Bitmap Functions on the NES / Famicom [NES]
In this lesson we'll take a look at the Nintendo Entertainment system / Famicom TileMap, we'll learn how to set up the screen, Define tiles, and draw them to the screen.
[Documentation] [Video] [Forum]
Lesson P7 - Bitmap Functions on the SNES / Super Famicom [SNS]
In this lesson we'll take a look at the Super Nintendo Entertainment System Tilemap, we'll learn how to set up the screen, Define Tiles and draw on the screen.
[Documentation] [Video] [Forum]
Lesson P8 - Bitmap Functions on the VIC-20 [VIC]
In this lesson we'll take a look at the VIC 20 screen layout, we'll learn how to set up the screen, define custom characters and draw on the screen.
[Documentation] [Video] [Forum]
Lesson P9 - Bitmap Functions on the C64 [C64]
In this lesson we'll take a look at the Commodore 64 screen layout, we'll learn how to set up the screen, Calculate locations and draw on the screen, we'll also learn how the 2 and 4 color modes work, and the addresses color attributes use.
[Documentation] [Video] [Forum]
Lesson P10 - Joystick Reading on the BBC [BBC]
Lets take a look at the BBC Joystick - we'll learn how to read the port, and convert to a 'digital' 4 direction input for easy programming
[Documentation] [Video] [Forum]
Lesson P11 - Joystick Reading on the Atari 800 / 5200 [A52] [A80]
The Atari 800 and 5200 are actually quite different when it comes to Joystick / Paddle reading, lets take
[Documentation] [Video] [Forum]
Lesson P12 - Joystick Reading on the Apple II [AP2]
Lets take a look at the Apple 2 Joystick- we'll learn how to read the port, and convert to a 'digital' 4 direction input for easy programming
[Documentation] [Video] [Forum]
Lesson P13 - Joystick Reading on the Atari Lynx [LNX]
In this lesson we'll take a look at the VIC 20 screen layout, we'll learn how to set up the screen, define custom characters and draw on the screen.
[Documentation] [Video] [Forum]
Lesson P14 - Joystick Reading on the PC Engine (TurboGrafx-16) [PCE]
Lets take a look at the PC-Engine Joypad, we'll learn how to read the Joypad ports and get the direction and fire buttons
[Documentation] [Video] [Forum]
Lesson P15 - Joystick Reading on the NES / Famicom and SNES [NES][SNS]
Lets take a look at the Nintendo Entertainment System and Super Nintendo Joypad, we'll learn how to read the Joypad ports and get the direction and fire buttons
[Documentation] [Video] [Forum]
Lesson P16 - Joystick Reading on the VIC-20 [VIC]
Lets take a look at reading joystick controls on the VIC20 and get the direction and fire buttons
[Documentation] [Video] [Forum]
Lesson P17 - Palette definitions on the BBC [BBC]
Lets learn about color definitions of the BBC Micro and how to select the visible colors from the BBC palette
[Documentation] [Video]
Lesson P18 - Palette definitions on the Atari 800 / 5200 [A52] [A80]
This tutorial will teach you how to set the Palette on the Atari computer 800 and Atari 5200 console
[Documentation] [Video]
Lesson P19 - Palette definitions on the Atari Lynx [LNX]
Learn how to set the Palette on the Atari Lynx
[Documentation] [Video]
Lesson P20 - Palette definitions on the PC Engine (TurboGrafx-16) [PCE]
This Tutorial will help you learn how to set the color Palette on the PC Engine or TurboGrafx 16
[Documentation] [Video]
Lesson P21 - Palette Definitions on the NES [NES]
Learn how to set the color Palette on the Nintendo Entertainment System or Nintendo Famicom
[Documentation] [Video]
Lesson P22 - Palette Definitions on the SNES / Super Famicom [SNS]
Learn how to set the color Palette on the Super NES
[Documentation] [Video]
Lesson P22 (z80) - Sound with the SN76489 on the BBC Micro [BBC]
Learn how to make sound on the BBC, this was a z80 tutorial, but covers the 6502 BBC as well
[Documentation] [Video]
Lesson P23 - Sound on the Atari 800 / 5200 [A52] [A80]
This tutorial will teach you how to make simple sounds on the Atari 800 and Atari 5200
[Documentation] [Video]
Lesson P23 (Z80) - Sound with the 'Beeper' on the Apple II [AP2]
Learn how to make simple sounds on the Apple II, this was a z80 tutorial, but covers the 6502 Apple 2 as well
[Documentation] [Video]
Lesson P24 - Sound on the Atari Lynx [LNX]
Learn how to make simple sounds on the Atari Lynx
[Documentation] [Video]
Lesson P25 - Sound on the PC Engine (TurboGrafx-16) [PCE]
Learn how to make simple sounds on the PC-Engine
[Documentation] [Video]
Lesson P26 - Sound on the NES / Famicom [NES]
Learn how to make simple sounds on the Nintendo Entertainment System or Famicom
[Documentation] [Video]
Lesson P27 - Sound on the SNES / Super Famicom: the SPC700 [SNS]
This Tutorial will help you learn how to make simple sounds on the Super Nintendo
[Documentation] [Video]
Lesson P28 - Sound on the SNES / Super Famicom: Writing ChibiSound [SNS]
Learn how to make simple sounds on the Super NES
[Documentation] [Video]
Lesson P29 - Sound on the on the VIC-20 [VIC]
Learn how to make simple sounds on the VIC 20
[Documentation] [Video]
Lesson P30 - Sound on the C64 [C64]
This Tutorial will help you learn how to make simple sounds on the Commodore 64
[Documentation] [Video]
Lesson P31 - Hardware Sprites on the Atari 800 / 5200 [A52] [A80]
Learn how to draw sprites on the Atari 800 Computer or Atari 5200 Console
[Documentation] [Video]
Lesson P32 - Hardware sprites on the Atari Lynx [LNX]
This Tutorial will help you learn how to use the sprite hardware to render sprites on the Atari Lynx
[Documentation] [Video]
Lesson P33 - Hardware Sprites on the PC Engine (TurboGrafx-16) [PCE]
Learn how to use sprites on the PC Engine
[Documentation] [Video] [Forum]
Lesson P34 - Hardware Sprites on the NES / Famicom [NES]
Lets learn how to use hardware sprites on the Nintendo Entertainment System or Famicom
[Documentation] [Video]
Lesson P35 - Hardware Sprites on the SNES / Super Famicom [SNS]
This tutorial will show you how to use sprites on the Super Nintendo Entertainment System (Super Nes)
[Documentation] [Video]
Lesson P36 - Hardware Sprites on the C64 [C64]
Learn how to make simple sounds on the C64
[Documentation] [Video]
Lesson P37 - Screen settings with the CRTC on the BBC Micro! [BBC]
The BBC Screen uses the same CRTC chip as the Amstrad CPC - and allows for reshaping and reconfiguration of the screen - lets take a look, and see what the settings do to the visible screen
[Documentation] [Video]
Lesson P38 - Character Block Graphics on the PET! [PET]
The PET does not have bitmap graphics, what it does have is the full combination of possibilities of a 2x2 'block' pixels defined as characters.
We can use these for simple graphics.
[Documentation] [Video]
Lesson P39 - Key reading on the PET [PET]
In this episode we'll learn how to read in from the keyboard,
We'll read in keys, and use them to simulate the Up,Down,Left,Right and Fire of a controller - we'll use this for games later!
[Documentation] [Video]
Lesson P39 - Key reading on the PET [PET]
In this episode we'll learn how to read in from the keyboard,
We'll read in keys, and use them to simulate the Up,Down,Left,Right and Fire of a controller - we'll use this for games later!
[Documentation] [Video]
Lesson P40 - Sound on the PET [PET]
While the PET didn't come with a speaker, it's possible to add one to the external IO port.
We can then use it to make simple beeps... Lets learn how!
[Documentation] [Video]
Lesson P41 - Multiple layers on the SNES [SNS]
We've learned how to use a single tilemap layer in the past, but the SNES is capable of much more!
This time we'll take a look at a more complex setup, with 3 layers... 2x 16 color and 1x 4 color.
[Documentation] [Video]
Lesson P42 - Color maths on the Super Nintendo [SNS]
Last time we used 3 layers, but the SNES has some tricks up its sleeve,
We can split these layers into two groups, then use 'color maths' to achieve transparency and masking effects... lets see it in action!
[Documentation] [Video]
Lesson P43 - Splitscreen scrolling and Sprite 0 Hit on the NES! [NES]
The NES only has one tilemap, but we can change the scroll midscreen to do a splitscreen effect.... unfortunately it's a bit tricky!
With Mapper 3 we can use a line IRQ to cause an interrupt midscreen to do the work... on other mappers, we may have to use the Sprite0Hit to detect the line.
[Documentation] [Video]
Lesson P44 - The NES Zapper! [NES]
The NES has a Lightgun... it detects light, and is also a gun!
Let's lock and load, and learn how to zap us some chibis!
[Documentation] [Video]