begin
library A6;
integer GP0;

   procedure claim plotter buffer (plotter);
         integer plotter;
   kdf9 2/0/0/0;
   SET 16; SET 5; OUT; ={plotter}; exit 
   algol 

   procedure free plotter buffer (GP0);
         value GP0; integer GP0;
   kdf9 2/0/0/0;
   {GP0}; SET6; OUT; exit 
   algol 

   procedure next (direction, GP0);
         value direction, GP0; integer direction, GP0;
   kdf9 2/1/0/1;
   {direction}; =V0;
   {GP0};   =C15;
   SETAV0; DUP; =I15; =M15;
   POCQ15;
   exit 
   algol 

   procedure move (steps, direction);
         value steps, direction; integer steps, direction;
   begin
   integer length;
   for length := 1 step 1 until steps do
      begin
      next(direction, GP0);
      end 
   end move;

integer stop drawing, start drawing;
integer up, down, left, right, up left, up right, down left, down right;

start drawing := 16;
stop drawing := 32;

up := 1;
down := 2;
right := 4;
left := 8;

down left := down + left;
down right := down + right;

up left := up + left;
up right := up + right;

claim plotter buffer(GP0);

next(stop drawing, GP0);

move(2000, up left);

next(start drawing, GP0);

move(1000, left);

move(1000, up);

move(1000, right);

move(1000, down);

move(1000, up left);

next(stop drawing, GP0);

move(1000, down);

next(start drawing, GP0);

move(1000, up right);

free plotter buffer (GP0);
end
|