This graphic utility will allow you to print any sprite created with the help of EASYsprite MAKER. Up to 255 sprites of different size and shape are allowed. The printer is 256 bytes of relocatable machine code that attaches itself to stream #3, so a sprite is printed with an ordinary PRINT #3: PRINT #3;CHR$ 16;CHR$ 4;AT 10,12;CHR$ 8; prints sprite 8 at row 10, column 12 in green ink. Colour, INVERSE, FLASH, BRIGHT and OVER are given as control characters before the AT, and the printing area can be limited by POKEing left, right, top and bottom limits.
Written by Eric Boisvert, ©1987 Byte Power, and published on the Fall 1987 (Issue 8) tape of Byte Power with its companions EASYsprite Maker (#59181) and EASYsprite Demo (#59178). The download holds all three: SPRITE, MAKER and DEMO.
Program Analysis
SPRITE: the installer
SPRITE asks for a load address (Enter gives 65112, the highest address that leaves the UDGs intact), loads the 256-byte SPRITE Mc block there and relocates it: line 30 reads 15 pairs from the DATA in line 40 and POKEs each absolute address inside the routine as AD plus an offset. It then prints the addresses the user needs: USR AD to open channel #3, AD+36 to close it again (back to the TS2040 printer), AD+124 for the sprite file address, and AD+174 to AD+192 for the minimum left column, maximum right column + 1, top and bottom + 1 limits.
MAKER: the sprite editor
EASYsprite Maker is a 10,630-byte machine-code editor at 54906 with a short BASIC part for tape handling (save at line 1000, load or merge at line 2000). Sprite files hold up to 255 sprites in up to 10,000 bytes, each up to 13 characters wide and 20 high. The editor is driven by an arrow moved with the joystick or Q, A, O, P and SPACE, shows the sprite at full size beside a magnified 16 × 16 pixel working area, and has number-key commands to move the working sector, compile (store) the sprite, flip it horizontally or vertically and scroll it a pixel at a time. Each sprite is stored as its height and width followed by its graphic data, character by character like UDG data.
DEMO: the demonstration
DEMO loads 2,978 bytes of sprite data and code at 62414 and is a BASIC tour of the printer in which a sprite host talks in speech balloons: a train crossing the screen, an aquarium of fish swimming at random, a boxing match, colour and attribute examples, and the printing area being narrowed by POKEs to 65286, 65292, 65298 and 65304 (the limit addresses for a printer loaded at 65112).
Notable Techniques
- Output through a new channel on stream #3 instead of a dedicated command, so all of BASIC’s
PRINTsyntax (AT, control codes, several items with#3between them) works with sprites. - Relocation done in BASIC from a table of offsets, so the code can be loaded anywhere.
- In the demo,
POKE 23681,xfollowed byPEEK 23681is used as a way to pass a negative or off-screen column throughAT, letting sprites slide in from the edge. - The demo uses
PEEK 23560(LAST K) to let a keypress end each section.
Potential Issues
- The magazine warns that all colour control characters must come before
AT; placed after it they are not handled. - The demo assumes the printer was loaded at 65112; its limit POKEs (65286–65304) are wrong for any other address.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.