The Commodore 64 links in my previous posting led me to download and skim the Commodore 64 Programmer's Reference Guide. I came across the following passage which brought back rich memories of spending hours and hours of school time designing sprites and writing programming code in exercise books. I used to actually do design mock-ups on a Lite-Brite then translate to DATA statements using the method described below. This is also where I learned binary. Oh, and what C64 programmer could forget peek and poke?
[Of course, being only 10 or 12 years old, I couldn't do the awesome stuff that Sean Huxter was doing. He was my programming idol; an absolute genius (still is). His page only shows some GEOS stuff that he did, but doesn't mention the Spy vs. Spy 3, Q-Bert clone (don't remember what he called it), and Infocom-style games that he made. I still can't believe that I lived in the same town and spent time with someone so gifted.]
CREATING A SPRITE... STEP BY STEP
To make this as easy as possible for you, we've put together this simple step
by step guide to help you draw your own sprites.
STEP 1:
Write the spritemaking program shown here ON A PIECE OF PAPER... note
that line 100 starts a special DATA section of your program which will
contain the 63 numbers you need to create your sprite.
STEP 2:
Color in the pixels on the spritemaking grid on Page 162 (or use a piece
of graph paper... remember, a sprite has 24 squares across and 21 squares
down). We suggest you use a pencil and draw lightly so you can reuse this
grid. You can create any image you like, but for our example we'll draw
a simple box.
STEP 3:
Look at the first EIGHT pixels. Each column of pixels has a number (128,
64, 32, 16, 8, 4, 2, 1). The special type of addition we are going to
show you is a type of BINARY ARITHMETIC which is used by most computers
as a special way of counting. Here's a close-up view of the first eight
pixels in the top left hand corner of the sprite:
|128| 64| 32| 16| 8| 4| 2| 1|
+---+---+---+---+---+---+---+---+
|@@@|@@@|@@@|@@@|@@@|@@@|@@@|@@@|
|@@@|@@@|@@@|@@@|@@@|@@@|@@@|@@@|
+---+---+---+---+---+---+---+---+
[...]
STEP 8:
CRUNCH YOUR PROGRAM INTO A SMALLER SPACE BY RUNNING TOGETHER ALL THE DATA
STATEMENTS, AS SHOWN IN THE SAMPLE PROGRAM BELOW. Note that we asked you
to write your sprite program on a piece of paper. We did this for a good
reason. The DATA STATEMENT LINES 100-120 in the program in STEP 1 are
only there to help you see which numbers relate to which groups of pixels
in your sprite. Your final program should be "crunched" like this:
start tok64 page165.prg
10 print"{clear}":poke53280,5:poke53281,6
20 v=53248:pokev+34,3
30 poke 53269,4:poke2042,13
40 forn=0to62:readq:poke832+n,q:next
100 data255,255,255,128,0,1,128,0,1,128,0,1,144,0,1,144,0,1,144,0,1,144,0
101 data1,144,0,1,144,0,1,144,0,1,144,0,1,144,0,1,144,0,1,128,0,1,128,0,1
102 data128,0,1,128,0,1,128,0,1,128,0,1,255,255,255
200 x=200:y=100:poke53252,x:poke53253,y
stop tok64