MEGA65 BASIC fun: Balloon sprite
#mega65 BASIC fun! @JudgeDrokk invited me to answer @HeadingtonBard’s question about #mega65 BASIC, so here’s an attempt! 🧵
If you just want to see an example of graphics in BASIC 65 (which is just a minor extension of BASIC 10 found on C128s), I cobbled this brief screen drawing demo together for the MEGA65 Welcome Guide. gist.github.com/dansanderson/d…
I assume by “balloon demo” that you’re referring to the sprite data demo on page 181 of the Commodore 64 Programmer’s Reference Guide. It shows how sprite data is represented in memory by slowly drawing a sprite of a balloon alongside its byte values. gist.github.com/dansanderson/1…
The C65’s VIC-IV chip has some nice sprite features not available in the C64’s VIC-II chip, but they are intended to be backwards compatible. C64’s balloon demo almost works. As is, it crashes the MEGA65!
The VIC-IV knows how to relocate sprite data in memory, including the sprite pointers themselves. When MEGA65 turns on, the sprite pointers are not in the C64 location of 2040 ($07f8
), but at 4088 ($0ff8
). Let’s just use that.
Balloon sets the sprite pointer to 13, which says to find the sprite data at address 13*64 = 832 ($0340)
, normally used by the C64 tape buffer. MEGA65 has other uses for that memory, so it crashes when we try to put sprite data there. Let’s try 127*64 = 8128 ($1fc0)
.
I chose $1fc0
because BASIC 65 ROM starts at $2000
, and I only need one sprite’s worth. A nice memory map doc: 65site.de/downloads/c65_…
Tada! C65 balloon!
BASIC 10/65 has some convenient sprite commands that BASIC 2 doesn’t. We could use them to replace a few POKEs, and we could load our sprite image from disk. Otherwise it’d be about the same. gist.github.com/dansanderson/c…
(Originally posted to Twitter on May 20, 2022. It received 65 likes and 4 retweets.)