Skip to content

Instantly share code, notes, and snippets.

@dgellow
Created December 27, 2015 16:01
Show Gist options
  • Save dgellow/78278aca7108e2038e32 to your computer and use it in GitHub Desktop.
Save dgellow/78278aca7108e2038e32 to your computer and use it in GitHub Desktop.
C64 hello world. Assemble with `dasm`. https://twitter.com/dgellow/status/681142655213027328
processor 6502 ; define processor family for dasm
org $C000 ; memory location for our code
clear = $e544 ; clear screen
drawchar = $ffd2 ; draw value in regA
main:
jsr clear
jsr drawmsg
return:
rts
msg:
.byte "HELLO YOU#"
rts
drawmsg:
ldx #0 ; regX keeps msg index
jsr drawmsghelper
rts
drawmsghelper:
lda msg,x
cmp #35 ; test regA with char '#'
beq return
jsr drawchar
inx
jmp drawmsghelper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment