C64 Sprites
Basic introduction to C64 Sprites
Old school.
Create your own SPRITE on paper. Download this PDF template to print. If you need to understand how the numbers add up, check this document that explains it well Sprite graphics C6 (PDF).
Example code that shows your Sprite creation on the C64 screen.
10 REM SHOW OF YOUR SPRITE 15 REM WITH YOUR C64 20 V=53248 22 PRINT CHR$(147): POKE V+21,0 25 POKE 53280,5: POKE 53281,1 30 POKE 2040,192 40 FOR Y = 0 TO 62 50 READ A: POKE (192*64)+Y,A 70 NEXT Y 75 POKE V+39,7 80 POKE V+23,1: POKE V+29,1 88 Y=50: X=24 90 POKE V+0,X: POKE V+1,Y 95 POKE V+21,1 100 Y=Y+1: X=X+1 110 IF Y = 255 THEN Y = 1: X=1 130 GOTO 90 10665 REM SPRITE DATA 10670 DATA 12,0,192,12,0,192 10680 DATA 3,3,0,3,3,0 10690 DATA 15,255,192,15,255,192 10700 DATA 60,252,240,60,252,240 10710 DATA 255,255,252,255,255,252 10720 DATA 207,255,204,207,255,204 10730 DATA 204,0,204,204,0,204 10740 DATA 3,207,0,3,207,0 10750 DATA 0,0,0,0,0,0 10760 DATA 0,0,0,0,0,0 10770 DATA 0,0,0
When done, type RUN and hit enter.
If you want to change color of the border or bacground you can change the numbers at "25" 25 POKE 53280,5: POKE 53281,1 POKE 53280 is the screen border POKE 53281 id the screen background Try change it to 25 POKE 53280,2: POKE 53281,6 if you want to change the color of the sprite, change "75" 75 POKE V+39,7 Try changing to ,1 (White) 75 POKE V+39,1
When testing use the RUN/STOP and RESTORE keys together to get your screen back to normal again.
Commodore 64 color codes
0 $00 black 1 $01 white 2 $02 red 3 $03 cyan 4 $04 purple 5 $05 green 6 $06 blue 7 $07 yellow 8 $08 orange 9 $09 brown 10 $0A pink 11 $0B dark grey 12 $0C grey 13 $0D light green 14 $0E light blue 15 $0F light grey
A little memory map overview for addresses, which can change colors using the BASIC-command POKE:
646 Textcolor 647 Color under position of cursor 53280 Color of screenframe (value of colors 0-15, higher numbers result in repeating) 53281 Color of screenbackground (normal mode) 53282 Color of screenbackground 1 (used in multicolor & extended color mode) 53283 Color of screenbackground 2 (used in multicolor & extended color mode) 53284 Color of screenbackground 3 (extended color mode) 53285 Sprite multicolor 1 (only in multicolor mode) 53286 Sprite multicolor 2 (only in multicolor mode) 53287 Color of sprite 0 53288 Color of sprite 1 53289 Color of sprite 2 53290 Color of sprite 3 53291 Color of sprite 4 53292 Color of sprite 5 53293 Color of sprite 6 53294 Color of sprite 7 55296-56295 Color-RAM - With these memory addresses the individual color of all 1000 chars within the screen matrix (25 lines by 40 columns) can be controlled; for example: POKE 55296,1 sets the first char at line 0 and column 0 with the color white.
Sprite Registers
Take a look at the code for the sprite earlier and then the SPRITE #0 column in this setup. If you want to take a deeper dive and understand what every line does, please check out this document.
Commodore 64 online User Manual (lemon64)
Spritemate (Great tool for creating sprites and code)
Teodor Bjerrang