VIC-20-ANIMATIONS-NO-HARDWARE-SPRITES-WE-WILL-USE-CHARACTERS -------------------------------------------------------------------------------------------------- TOOL: COMMODORE VIC-20 - BASIC 2 Language: BASIC Extra: - Author: Misel Zivanovic Note: (C) 5th JAN 2026 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- And here we are again...with some animated characters How to make them is easy with the knowledge we have so far. And we are still working with 8KB memory or better said what's left once the system reserved its bytes and the screen too. Which is living us with 6655 bytes. Enough for this example in which we wasted 15 characters! 1st 10 characters are the moving animation and the remaining 5 are representing shooting sequence. What can be mentioned here: With assembler you would basically need just 5 characters for everything. It could be done with the BASIC too, but it's just too slow to make it usable in the practice. Especially if you count everything else what would be needed to actually use this in a game. There are a few things which we could speed up a bit by using small assembler routines. Good location is $033c, dec 828. From that address there are like 200 bytes free and this amount of bytes is quite enough to speed a thing or few here. Probably the material for next lesson... --------------------------------------------------------------------------------------------------- How is this put together? In SPRDEF of C128 you can create 3x8 bytes character in the first row and 3x8 bytes in the 2nd row. That gives us in our case: ABCDEF We can't use the 3rd row because it is having only 5 bytes {3x5 bytes} That is why our transport device is created in first row, 3rd byte. {Actually bytes 17 to 24} Which means we have to take these 8 bytes and move them to the bottom! Also we use just 5 characters, not 6 {that's why there are only zero's. We don't need it, can be deleted} EXAMPLE: ABC DEF A data 21, 95, 123, 127, 243, 244, 63, 48 B data 64, 64, 0, 192, 0, 0, 0, 0 C data 52, 52, 52, 186, 186, 130, 170, 40 -> this is our wheel and must be moved to replace F D data 48, 124, 111, 105, 86, 239, 252, 252 E data 0, 16, 16, 168, 160, 0, 0, 0 F data 0, 0, 0, 0, 0, 0, 0, 0 C data 52, 52, 52, 186, 186, 130, 170, 40 FINAL RESULT: AB CD E {A} A data 21, 95, 123, 127, 243, 244, 63, 48 {B} B data 64, 64, 0, 192, 0, 0, 0, 0 {C} D data 48, 124, 111, 105, 86, 239, 252, 252 {D} E data 0, 16, 16, 168, 160, 0, 0, 0 {E} C data 52, 52, 52, 186, 186, 130, 170, 40 --------------------------------------------------------------------------------------------------- SOURCE CODE - ALL IN ONE - {can be copy/pasted into VICE VIC-20 Emulator} --------------------------------------------------------------------------------------------------- 50 a=643:b=644 51 poke51,0:poke52,24 52 poke55,0:poke56,24 53 poke a,0:poke b,24 54 clr 80 sys 58719 81 print "lived.ch, mzretro.ch" 82 print 83 print "sprite anim" 84 print "-------------" 85 print "press any key" 86 get a$:if a$="" then 86 87 rem 100 sys 58719:rem cls 101 poke 36869,254 102 rem top blue 103 rem also border 104 poke 36879,8+6+(0*16) 105 rem bottom yellow 106 poke 36878,7*16 107 rem 110 t=6144:s=32768 111 for a=0 to 1023 112 poket+a,peek(a+s) 113 next 114 forc=0 to 119:readd 115 poket+8+(c),d:next 150 rem 1st pos: 151 rem ab 152 rem cd 153 rem e 154 data 21,95,123,127,243,252,63,48 155 data 64,16,0,192,0,0,0,0 156 data 48,124,123,122,86,251,252,252 157 data 0,4,4,106,168,0,0,0 158 data 52,52,52,186,186,130,170,40 159 rem : 200 rem anim 201 rem fg 202 rem hi 203 rem j 204 data 0,21,95,123,127,243,252,63 205 data 16,64,0,0,192,0,0,0 206 data 48,48,124,123,122,86,251,252 207 data 0,0,4,4,106,168,0,0 208 data 252,52,52,186,186,186,130,40 209 rem 250 rem shooting: 251 rem kl 252 rem mn 253 rem op 254 data 21,95,123,127,243,244,63,48 255 data 64,64,0,192,0,0,0,0 256 data 48,124,111,105,86,239,252,252 257 data 0,16,16,168,160,0,0,0 258 data 52,52,52,186,186,130,170,40 300 rem cursor 301 poke 7424,0 302 poke 7425,85 303 poke 7426,109 304 poke 7427,56 305 poke 7428,109 306 poke 7429,56 307 poke 7430,109 308 poke 7431,85 400 rem middle cyan 401 for e=0 to 505 402 poke 38400+e,2+8 403 next 404 poke 646,2+8 405 rem anim start 453 sys 58753 454 print 455 print " ab" 456 print " cd" 457 print " e" 458 for a=0 to 250:next 459 sys 58753 460 print 461 print " fg" 462 print " hi" 463 print " j" 464 for a=0 to 250:next 465 sys 58753 466 print 467 print " kl" 468 print " mn" 469 print " o" 470 for a=0 to 125:next 471 goto 453 ---------------------------------------------------------------------------------------------------