Creating a BLITZ string with string concatenation?

I’ve been enjoying the “Mathographics” demonstrations by Robert Dixon after coming across a few examples in the pages of Format magazine.

I thought this would also be a fun excuse to learn about the nifty BLITZ command in SAM BASIC.

In order to speed things along, I wondered if it would be possible to build the string “manually” instead of actually running all the drawing commands and using RECORD TO. The Complete Guide to SAM BASIC suggests it’s just a matter of data and control codes but after looking at the stored bytes that doesn’t seem to be the whole story!

LENGTH(0,anim$) is very handy, but I can’t quite tell how the coordinate bytes are stored, and the code for PLOT (for example) seems to vary depending on its position within the string.

Is this documented anywhere? Seems likely there’s a Format article out there somewhere that will explain it, but if so I haven’t found it yet! Any ideas? (And do you reckon it would actually be faster?)

Nice. LCD created some wacky animations using Blitz, see Pacman on Fred 34. As to the encoding, I am not aware of any documentation. A simple example looked consistent enough:

plot at 0,0
draw 10,10

Resulted in a string containing:

1 0 173
2 10 163

So that makes 1 a plot and 2 a draw with the coordinates converted from user origin (left bottom = 0,0) to quicker coordinates with origin at left top of screen.

To view the string I'm using some simple basic:

for i=0 to len a$: print i,code (a$(i)): next i

And unless you are creating the string in something that is not basic, I doubt it will be much faster. Also remember that when you save a basic program, the values of variables are saved. You can also save an array independently.

In reply to by Stefan Drissen

Thanks very much Stefan, that's much clearer now.

I think my confusion was due to me expecting that the larger values (e.g. 173, 163) represent the tokenised BASIC keywords for plot and draw (i.e. like they are on ZX Spectrum).

I like the idea of saving the string arrays. A bit like saving/loading modern SVGs I suppose (or, as I think others have pointed out elsewhere, the drawing routines from adventure games).

Don't know if I can come up with anything as bonkers as that Pacman demo but it will be fun to try.

Thanks!