Skip to content

Instantly share code, notes, and snippets.

@jeff-1amstudios
Last active July 6, 2016 14:58
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 jeff-1amstudios/254ad8c3bbd1a4c752f0933db4624f27 to your computer and use it in GitHub Desktop.
Save jeff-1amstudios/254ad8c3bbd1a4c752f0933db4624f27 to your computer and use it in GitHub Desktop.
C64 sprite initialization example
* = $2000 ; we store data at $2000 (8192 decimal)
!bin my-sprite-data.spr
* = $c000 ; code starts at $c0000
sprite_0_setup
lda #128 ; set A=128
sta $07f8 ; store 128 in sprite #0 data pointer, data will be read by VIC-II from memory location 128*64 ($2000)
lda $d015 ; $d015 is the sprite-enable register
ora #%00000001 ; enable sprite #0
sta $d015
lda #3 ; set A=3
sta $d027 ; set foreground color of sprite #0 to 3
lda #130 ; set A=130
sta $d000 ; sprite X position = 130
lda #190 ; set A=190
sta $d001 ; sprite Y position = 190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment