Applesoft BASIC has no support for bitmap graphics. However, it does have support for simple shapes stored in shape tables. A shape table is made up of shapes:

shapes:
  .dcb nn            ; number of shapes
  .dcb shape0-shapes ; offset to first shape
  .dcb shape1-shapes ; offset to second shape
  .dcb shape2-shapes ; offset to third shape
; ...
Each shape is a nul-terminated string of bytecodes:
ccbbbaaa
||||||||
|||||+++- First instruction
||+++---- Second instruction
++------- Third instruction
Each instruction is made of three bits:
pdd
|||
|++- direction (0 up; 1 right; 2 down; 3 left)
+--- draw while moving in that direction

If, after shifting out an instruction, the result is 0, the interpreter goes to the next instruction. This means that the third instruction in a byte cannot move up or draw, and that if the third instruction is 00, then the second instruction cannot be "move up without drawing." I don't suggest moving up often in a shape table; most shape table tools generate a boustrophedon.

Once you store the address of your shape table into locations 233 and 232, you can use these commands to draw shapes:

  • SCALE= n: REM move n pixels for each instruction
  • ROT= n: REM rotate shape clockwise by n/64 circle
  • DRAW n AT x,y: REM draw a shape using current HCOLOR= setting
  • XDRAW n AT x,y: REM draw a shape using XOR

Log in or registerto write something here or to contact authors.