Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Created September 26, 2018 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topherPedersen/cd3896be8112b5562a18a88eb1dfd9f6 to your computer and use it in GitHub Desktop.
Save topherPedersen/cd3896be8112b5562a18a88eb1dfd9f6 to your computer and use it in GitHub Desktop.
"hello, world" in 6502 Assembly Language for the Atari 2600 (Code Example from "Making Games for the Atari 2600" by Steven Hugg)
processor 6502
include "vcs.h"
include "macro.h"
seg Code
org $f000 ; start code at $f000
Start sei ; disable interrupts
cld ; disable BCD math mode
ldx #$ff ; init stack pointer to $FF
txs ; transfer X register to S register
lda #0 ; set A register to zero
ldx #$ff ; set X to #$ff
ZeroZP sta $0,X ; store A register at address ($0 + X)
dex ; decrement X by one
bne ZeroZP ; branch until X is zero
; Make Background Red
lda #$30 ; load value into A ($30 is deep red)
sta COLUBK ; store A into background color register
jmp Start ; goto start of program
org $fffc
.word Start ; reset vector at $fffc
.word Start ; interrupt vector at $fffe (unused in VCS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment