Dabbling with sprites in BASIC and the Sprite Editor

Here’s a simple walkthrough on how to play around with the freezer’s sprite editor and then use such sprites within BASIC:

  • Hold down RESTORE key for a second to enter the Freezer menu

  • Press S to enter the Sprite Editor

  • Use either a mouse on port 1 or keyboard controls (cursor keys and space) to draw your sprite

  • Information in the right pane shows that we are writing to SPRITE 0 located at $0600 (decimal 1536)

  • Press the HELP key to learn about various other keyboard shortcuts available

  • To save your sprite to memory, use the STORE SLOT function (F9, keys have changed in the latest version!), or skip one sprite forward/backward with PREV SPRITE / NEXT SPRITE

  • Pro-Tip: if your changes to an existing sprite went bad, you can use FETCH SLOT to get the unchanged sprite from frozen memory!

  • Press F3 and type YES to exit the sprite editor

  • Press F3 to exit the Freezer menu

  • Then in BASIC 65, make the sprite appear on the screen with:

    • SPRITE 0,1 (turn sprite 0 on)

    • MOVSPR 0,100,100 (move sprite 0 to 100,100)

  • You can then use BASIC 65’s SPRITE SAVE "MYSPRITES" to save your sprite

  • If you ever need to reload it, you can use SPRITE LOAD "MYSPRITES"

How to set the frame index of each sprite?

If you have goals of animating a sprite by switching between different frames of animation, BASIC 65 doesn’t provide any commands to help with switching frames, and you will have to POKE your way to success. On boot-up, you can set (and read) the frame-index for your sprite at the following addresses:

  • SPRITE 0 : POKE 4088, <frameidx> (24 by default)

  • SPRITE 1 : POKE 4089, <frameidx> (25 by default)

  • SPRITE 2 : POKE 4090, <frameidx> (26 by default)

  • SPRITE 3 : POKE 4091, <frameidx> (27 by default)

  • SPRITE 4 : POKE 4092, <frameidx> (28 by default)

  • SPRITE 5 : POKE 4093, <frameidx> (29 by default)

  • SPRITE 6 : POKE 4094, <frameidx> (30 by default)

  • SPRITE 7 : POKE 4095, <frameidx> (31 by default)

 

How to calculate where each frame’s data is in memory?

The formula is:

framedata = vicbase + frameidx * 64

For C65-mode, vicbase = 0

So since SPRITE 0 defaults to frameidx=24, this equates to 0 + 24 * 64 = 1536 = $0600