Now you could write FOR loops to change the X and Y coordinates of your sprite and smoothly animate it on the screen.
I tried this when I was 8 or 9 years old, and since then I've been hooked to coding 🤓
Now you could write FOR loops to change the X and Y coordinates of your sprite and smoothly animate it on the screen.
I tried this when I was 8 or 9 years old, and since then I've been hooked to coding 🤓
If you wanted to use more interesting artwork for your sprites, you'd have to convert a 24x21 bitmap data to its binary representation, then load it into memory.
The original Commodore 64 User Manual had a nice sample program to do this on pages 70 and 71:
https://www.commodore.ca/manuals/c64_users_guide/c64-users_guide-06-sprite_graphics.pdf
If you want to display something other than garbage, you need to move the sprite pointer to a free memory area and then write some bitmap data to it.
Let's use address 12800 ($3200 in hex). That's 200 * 64:
poke 2048,200
Now let's fill this area with some data:
10 p=12800
20 for i = 0 to 62
30 poke p+i,i+1
40 next
You should see the typical fractalish pattern of a binary sequence.
The pattern repeats 3 times horizontally because each line is 24 pixels wide (3 bytes).
This will change sprite 0 color to yellow:
poke 53287,7
There are 16 colors from 0 to 15. Sprites can also be displayed in multicolor mode (4 colors), but currently we're in high-res mode.
This will stretch sprite 0 vertically, doubling its height:
poke 53271,1
...and this will stretch it horizontally:
poke 53277,1
So far, we did not change the sprite pointers, so we're viewing raw memory, specifically addresses 0 to 63.
Page 0 holds various system variables, so the sprite will flicker as interrupts and basic routines write to it.
This will move the sprite 0 data pointer to the address range 64-127 ($40-$7F):
poke 2040,1
Blocks 2 ($80-BF) and 3 ($C0-FF) contain more interesting stuff: timer counters and variables that change when you move around the cursor.
The #C64 has 8 hardware sprites. You can play with them with a few POKEs:
rem turn on all 8 sprites
poke 53269,255
rem set sprite 0 x and y pos
poke 53248,50
poke 53249,60
(lowercase so you can directly paste into VICE)
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.