Home » Archimedes archive » Archimedes World » AW-1991-08.adf » TurtleGRFX/TurtleGRFX

TurtleGRFX/TurtleGRFX

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1991-08.adf
Filename: TurtleGRFX/TurtleGRFX
Read OK:
File size: 7095 bytes
Load address: FFFFFB40
Exec address: AAD60697
File contents
   10REM>TurtleGRFX
   20
   30REM   Program: TurtleGRFX v2.01 10-Mar-1991
   40REM   Author:  Copyright (C) I.M.Kinghan 1991
   50REM   Purpose: Turtle Graphics library for BBC BASIC
   60
   70REM   Correspondence to:
   80REM   Mike Kinghan,
   90REM   149 Campbell Road,
  100REM   Cowley,
  110REM   Oxford OX4 3NX
  120
  130REM==================== Synopsis ========================================
  140
  150REM      The routines in this library are tools for creating
  160REM   graphics programs in the style originated by the Logo
  170REM   language. Shapes may generated by issuing directions to a
  180REM   drawing agent called "the Turtle". The routines provide
  190REM   the vocabulary of directives. Shapes of remarkable intricacy
  200REM   and beauty, including fractals, can be created by recursive
  210REM   routines.
  220
  230REM      The routines do not faithfully mimic those of the Logo
  240REM   language, but provide a fuller and more powerful set of tools.
  250REM   In particular, a number or procedures are provided for rec-
  260REM   ording and saving shapes generated by the Turtle, so that they
  270REM   may be reproduced more quickly and economically than they could
  280REM   be recreated, and so that they can easily be transformed using
  290REM   a stored "template".
  300
  310REM      The routines are presented in five classes:
  320
  330REM   1. Turtle Disposition Routines - related to whether the
  340REM      Turtle is visible or not, its pen action, and the like.
  350
  360REM   2. Turtle Action Routines - related to moving the Turtle.
  370
  380REM   3. Turtle-stack Routines - related to recording Turtle-states.
  390
  400REM   4. Stored Turtle-state Routines - related to retrieving and
  410REM      manipulating stored Turtle-states.
  420
  430REM   5. Internal Library Routines - not recommended for user programs.
  440
  450REM      In addition, the library supports direct keyboard control
  460REM   of the Turtle via commands corresponding to the library routines.
  470REM   See PROCtrun.
  480
  490REM================== Important Notes ===================================
  500
  510REM   *  The library contains all of its own documentation. The gives
  520REM   secure version control but has drawbacks. When the library is
  530REM   is loaded its internal documentation occupies a large amount of
  540REM   memory. When the documentation is consulted, it is fragmented
  550REM   by the source code. A procedure PROC@help is provided to remove
  560REM   these nuisances by creating compact help files with source code
  570REM   stripped out and a compact working version of the library with
  580REM   comments stripped out. Find PROC@help below and consult the
  590REM   notes which accompany it. N.B. PROC@help is liable to be harmed
  600REM   by any editing of this source file: in particular it makes use
  610REM   of the strings "REM","REM>" and "REM+".
  620
  630REM   *  The Turtle must be initialised by calling  PROCtstart
  640REM   before any of the other library routines.
  650
  660REM   *  The library reserves all variable names beginning
  670REM   with "_" followed by a capital letter. It is useful for
  680REM   programs to interrogate some of the library variables,
  690REM   but none of them may be written to.
  700
  710REM   *  To function correctly the Turtle needs to know what
  720REM   graphics plot actions and colours you select. To provide
  730REM   the Turtle with this information, you must always use the
  740REM   library routine  PROCtgcol(action%,colour%)  instead of the
  750REM   BASIC command  GCOL(action%,colour%).
  760
  770REM   *  The Turtle's position is given in BASIC graphics coordinates;
  780REM   its orientation is given in degrees clockwise of due North
  790REM   i.e. the direction of increasing vertical coordinates. The
  800REM   position can be read by interrogating the library variables
  810REM   _TurtleX (horizontal) and _TurtleY (vertical). The orientation
  820REM   can be read from the library variable _TurtleAngle.
  830
  840REM   *  When the Turtle-stack is in use to record the Turtle's
  850REM   positions and orientations, the stack pointer is held in
  860REM   the library variable _TurtleGen%, which may be read to find
  870REM   the current stack-pointer.
  880
  890REM   *  Routines with names beginning "@" are called internally be
  900REM   the library and are not recommended for programmers' use.
  910
  920REM   *  Turtle actions are considerably slower when the Turtle is
  930REM   visible than when it is invisible, due to the overhead of
  940REM   erasing and redrawing the Turtle from place to place. It is
  950REM   suggested that the visible Turtle be used only during program
  960REM   development when it is necessary to see exactly what the
  970REM   Turtle is doing. The procedures  PROCtwatchon  and PROCtwatchoff
  980REM   are provided to assist in this.
  990
 1000REM   *  All routines are implemented as procedures. It will be seen
 1010REM   that in association with each procedure a function is defined
 1020REM   which simply executes the procedure and returns 0. These functions
 1030REM   are used by PROCtrun to provide direct keyboard control of the
 1040REM   Turtle.
 1050
 1060REM======================== Version Control ===========================
 1070
 1080REM v1.00 26-Jan-91:
 1090REM       * Original version.
 1100REM v2.00 19-Feb-91
 1110REM      * New procedure PROCtbear: Set the Turtle on absolute bearing.
 1120REM      * New procedure PROCtrun: Keyboard control of turtle.
 1130REM      * New procedure PROC@help: creates compact help files and
 1140REM      compact version of the library.
 1150REM      * PROCtrecord modified to be true inverse of PROCtrestore,
 1160REM      i.e. now updates Turtle stack-pointer in Full Ascending mode.
 1170REM      * Function variant introduced for each procedure: used by
 1180REM      PROCtrun.
 1190REM      * Turtle angle 0 changed from due East to due North.
 1200REM      * PROCtturn, PROCtalign modified so that Turtle angle is always
 1210REM      expressed as positive.
 1220REM      * Bug fix to PROCtturn. Turns were always truncated to integer
 1230REM      degrees.
 1240REM      * Internal fatal errors no longer terminate BASIC.
 1250REM      * Redundant range checking removed from PROCtmemset and
 1260REM      PROCtmemmove.
 1270REM      * Documentation corrected and extended.
 1280REM v2.01 10-Mar-91
 1290REM      * Bug fix in FNtstoreplot and FNtstorecol. Integer paremeter r%
 1300REM      changed to real r.
 1310REM      * Bug fix in PROCtdo. Global variable x made local.
 1320REM      * Bug fix in PROCtrun. "PROCstart" should be "PROCtstart";
 1330REM      "PROCshow" should be "PROCtshow"
 1340REM      * Minor error in screen output of PROC@help. "HelpA"
 1350REM      should be "TGRFXHelpA"; "HelpB" should be "TGRFXHelpB"
 1360REM      * Additional "REM+"s (directives to PROC@help) inserted to
 1370REM      improve format of help files.
 1380
 1390REM+==================== Routines =====================================
 1400REM+
 1410REM+  PROCtstart
 1420REM+
 1430REM+  Initialises the Turtle.
 1440REM+  The Turtle is placed in the middle of the screen pointing
 1450REM+  due North. It is invisible; its "pen" is off; its plot-
 1460REM+  actions and colours, both foreground and background, are set to 0;
 1470REM+  no Turtle-stack exists.
 1480REM+
 1490DEFPROCtstart
 1500_Height%=1024
 1510_Width%=1280
 1520_TLength%=64
 1530_THalf%=_TLength% DIV 2
 1540_TWing=SQR(_THalf%^2*2)
 1550_TurtleAngle=0
 1560_TurtleX=(_Width% DIV 2)-1
 1570_TurtleY=(_Height% DIV 2)-1
 1580MOVE _TurtleX,_TurtleY
 1590_TurtleOn%=FALSE
 1600_TurtlePenOn%=FALSE
 1610_TurtleStack%=FALSE
 1620_TurtleWatchOn%=FALSE
 1630_TurtleFCol%=0
 1640_TurtleBCol%=0
 1650_TurtleFPlot%=0
 1660_TurtleBPlot%=0
 1670ENDPROC
 1680
 1690DEFFNtstart: PROCtstart: =0
 1700
 1710REM+=====================================================================
 1720REM+============= Turtle Disposition Routines ===========================
 1730REM+=====================================================================
 1740REM+
 1750REM+  PROCtshow
 1760REM+
 1770REM+  Makes the Turtle visible.
 1780REM+
 1790DEFPROCtshow
 1800IF NOT _TurtleOn% THEN
 1810   PROC@tdraw
 1820   _TurtleOn%=TRUE
 1830ENDIF
 1840ENDPROC
 1850
 1860DEFFNtshow: PROCtshow: =0
 1870
 1880REM+=====================================================================
 1890REM+
 1900REM+  PROCthide
 1910REM+
 1920REM+  Makes the Turtle invisible.
 1930REM+
 1940DEFPROCthide
 1950IF _TurtleOn% THEN
 1960   PROC@tdraw
 1970   _TurtleOn%=FALSE
 1980ENDIF
 1990ENDPROC
 2000
 2010DEFFNthide: PROCthide: =0
 2020
 2030REM+=====================================================================
 2040REM+
 2050REM+  PROCtgcol(action%,colour%)
 2060REM+
 2070REM+  Sets the graphics plot-actions and colours and informs the
 2080REM+  Turtle of the settings. The foreground plot-action and colour
 2090REM+  as last set by this routine can be read from the library
 2100REM+  variables _TurtleFPlot% and _TurtleFCol%; the background
 2110REM+  values can be read from _TurtleBPlot% and _TurtleBCol%.
 2120REM+
 2130REM+  N.B. In this release of the library, the Turtle only needs to
 2140REM+  know what foreground plot-action and colour are in force so
 2150REM+  that it can be correctly redrawn when it is visible. In the
 2160REM+  interest of speed, however, the Turtle restores these values
 2170REM+  automatically only when it is obliged to by a Turtle-redraw:
 2180REM+  at other times it uses whatever values are in force, even if
 2190REM+  they have been directly set by GCOL(action% colour%) rather
 2200REM+  than through PROCtgcol(action%,colour%). It is therefore
 2210REM+  recommended that PROCtgcol should always be used in TurtleGRFX
 2220REM+  programs instead the BASIC command GCOL, otherwise the Turtle
 2230REM+  is liable to restore values which are "out of date".
 2240REM+
 2250DEFPROCtgcol(action%,colour%)
 2260action%=ABS(action% MOD 8)
 2270colour%=ABS(colour% MOD 256)
 2280GCOL action%,colour%
 2290IF colour%<128
 2300   _TurtleFPlot%=action%
 2310   _TurtleFCol%=colour%
 2320ELSE
 2330   _TurtleBPlot%=action%
 2340   _TurtleBCol%=colour%
 2350ENDIF
 2360ENDPROC
 2370
 2380DEFFNtgcol(action%,colour%): PROCtgcol(action%,colour%): =0
 2390
 2400REM+=====================================================================
 2410REM+
 2420REM+  PROCtpen(n%)
 2430REM+
 2440REM+  Sets the Turtle's pen.
 2450REM+  When n%=0, the Turtle will not draw its movements, otherwise
 2460REM+  it will draw its movements using the current forground colour
 2470REM+  and plot-action.
 2480REM+
 2490DEFPROCtpen(n%)
 2500IF n%<>0 THEN _TurtlePenOn%=TRUE ELSE _TurtlePenOn%=FALSE
 2510ENDPROC
 2520
 2530DEFFNtpen(n%): PROCtpen(n%): =0
 2540
 2550REM+=====================================================================
 2560REM+
 2570REM+  PROCtwatchon
 2580REM+
 2590REM+  Makes the Turtle visible and causes it to wait for a keystroke
 2600REM+  whenever it is redrawn. For use in debugging.
 2610REM+
 2620DEFPROCtwatchon
 2630PROCtshow
 2640_TurtleWatchOn%=TRUE
 2650ENDPROC
 2660
 2670DEFFNtwatchon: PROCtwatchon: =0
 2680
 2690REM+=====================================================================
 2700REM+
 2710REM+  PROCtwatchoff
 2720REM+
 2730REM+  Cancels PROCtwatchon, if it is in force, and makes the Turtle
 2740REM+  invisible; otherwise has no effect.
 2750REM+
 2760DEFPROCtwatchoff
 2770IF _TurtleWatchOn% THEN
 2780   _TurtleWatchOn%=FALSE
 2790   PROCthide
 2800ENDIF
 2810ENDPROC
 2820
 2830DEFFNtwatchoff: PROCtwatchoff: =0
 2840
 2850REM+=====================================================================
 2860REM+================== Turtle Action Routines ===========================
 2870REM+=====================================================================
 2880REM+
 2890REM+  PROCthome
 2900REM+
 2910REM+  Replaces the Turtle at its starting position.
 2920REM+
 2930DEFPROCthome
 2940IF _TurtleOn% THEN PROC@tdraw
 2950_TurtleAngle=0
 2960_TurtleX=(_Width% DIV 2)-1
 2970_TurtleY=(_Height% DIV 2)-1
 2980MOVE _TurtleX,_TurtleY
 2990IF _TurtleOn% THEN PROC@tdraw
 3000ENDPROC
 3010
 3020DEFFNthome: PROCthome: =0
 3030
 3040REM+=====================================================================
 3050REM+
 3060REM+  PROCtjump(x,y,alpha)
 3070REM+
 3080REM+  Places the Turtle directly as position <x,y>
 3090REM+  with orientation alpha.
 3100REM+
 3110DEFPROCtjump(x,y,alpha)
 3120IF _TurtleOn% THEN PROC@tdraw
 3130_TurtleX=x
 3140_TurtleY=y
 3150_TurtleAngle=alpha
 3160MOVE INT(_TurtleX+0.5),INT(_TurtleY+0.5)
 3170IF _TurtleOn% THEN PROC@tdraw
 3180ENDPROC
 3190
 3200DEFFNtjump(x,y,alpha): PROCtjump(x,y,alpha): =0
 3210
 3220REM+=====================================================================
 3230REM+
 3240REM+  PROCtgo(n)
 3250REM+
 3260REM+  Advances the Turtle by n graphics units in its current direction.
 3270REM+
 3280DEFPROCtgo(n)
 3290IF _TurtleOn% THEN PROC@tdraw
 3300_TurtleX+=n*SIN RAD _TurtleAngle
 3310_TurtleY+=n*COS RAD _TurtleAngle
 3320IF _TurtlePenOn% THEN
 3330   DRAW INT(_TurtleX+0.5),INT(_TurtleY+0.5)
 3340ELSE
 3350   MOVE INT(_TurtleX+0.5),INT(_TurtleY+0.5)
 3360ENDIF
 3370IF _TurtleOn% THEN PROC@tdraw
 3380ENDPROC
 3390
 3400DEFFNtgo(n): PROCtgo(n): =0
 3410
 3420REM+=====================================================================
 3430REM+
 3440REM+  PROCtto(x,y)
 3450REM+
 3460REM+  Orients the Turtle toward <x,y> and advances it to that position.
 3470REM+
 3480DEFPROCtto(x,y)
 3490PROCtalign(_TurtleX,_TurtleY,x,y)
 3500IF _TurtleOn% THEN PROC@tdraw
 3510IF _TurtlePenOn% THEN
 3520  DRAW INT(x+0.5),INT(y+0.5)
 3530ELSE
 3540  MOVE INT(x+0.5),INT(y+0.5)
 3550ENDIF
 3560_TurtleX=x
 3570_TurtleY=y
 3580IF _TurtleOn% THEN PROC@tdraw
 3590ENDPROC
 3600
 3610DEFFNtto(x,y): PROCtto(x,y): =0
 3620
 3630REM+=====================================================================
 3640REM+
 3650REM+  PROCtturn(n)
 3660REM+
 3670REM+  Turns the turtle by n degrees - clockwise when n is positive,
 3680REM+  anticlockwise when n is negative.
 3690REM+
 3700DEFPROCtturn(n)
 3710IF _TurtleOn% THEN PROC@tdraw
 3720_TurtleAngle+=n
 3730IF ABS(_TurtleAngle)>360 THEN _TurtleAngle-=(360*(_TurtleAngle DIV 360))
 3740IF _TurtleAngle<0 THEN _TurtleAngle+=360
 3750IF _TurtleOn% THEN PROC@tdraw
 3760ENDPROC
 3770
 3780DEFFNtturn(n): PROCtturn(n): =0
 3790
 3800REM+=====================================================================
 3810REM+
 3820REM+  PROCtbear(n)
 3830REM+
 3840REM+  Orients the Turtle on a bearing n degrees clockwise of due
 3850REM+  North, without changing its position.
 3860REM+
 3870DEFPROCtbear(n)
 3880IF _TurtleOn% THEN PROC@tdraw
 3890IF ABS(n)>360 THEN n-=(360*(n DIV 360))
 3900IF n<0 THEN n+=360
 3910_TurtleAngle=n
 3920IF _TurtleOn% THEN PROC@tdraw
 3930ENDPROC
 3940
 3950DEFFNtbear(n): PROCtbear(n): =0
 3960
 3970REM+=====================================================================
 3980REM+
 3990REM+  PROCtplot
 4000REM+
 4010REM+  Causes the Turtle to plot its current position using the
 4020REM+  current Turtle pen-value and plot-action.
 4030REM+
 4040DEFPROCtplot
 4050IF _TurtlePenOn% THEN
 4060   POINT INT(_TurtleX+0.5),INT(_TurtleY+0.5)
 4070ENDIF
 4080ENDPROC
 4090
 4100DEFFNtplot: PROCtplot: =0
 4110
 4120REM+=====================================================================
 4130REM+
 4140REM+  PROCtalign(x1,y1,x2,y2)
 4150REM+
 4160REM+  Aligns the Turtle with the line <<x1,y1>,<x2,y2>>, oriented
 4170REM+  toward <x2,y2>. The Turtle's position is not changed.
 4180REM+
 4190DEFPROCtalign(x1,y1,x2,y2)
 4200LOCAL xdif,ydif
 4210xdif=x1-x2
 4220ydif=y1-y2
 4230IF xdif>0 OR ydif>0
 4240   IF _TurtleOn% THEN PROC@tdraw
 4250   CASE TRUE OF
 4260   WHEN  ydif<>0
 4270      _TurtleAngle=DEG ATN(xdif/ydif)
 4280      CASE TRUE OF
 4290      WHEN ydif>0
 4300         _TurtleAngle+=180
 4310      WHEN xdif>0
 4320         _TurtleAngle+=360
 4330      ENDCASE
 4340   OTHERWISE
 4350      IF xdif<0 THEN
 4360         _TurtleAngle=90
 4370      ELSE
 4380         _TurtleAngle=270
 4390      ENDIF
 4400   ENDCASE
 4410   IF _TurtleOn% THEN PROC@tdraw
 4420ENDIF
 4430ENDPROC
 4440
 4450DEFFNtalign(x1,y1,x2,y2): PROCtalign(x1,y1,x2,y2): =0
 4460
 4470REM+=====================================================================
 4480REM+
 4490REM+  PROCtpoint(x,y)
 4500REM+
 4510REM+  Orients the Turtle toward <x,y> without changing its position.
 4520REM+
 4530DEFPROCtpoint(x,y)
 4540PROCtalign(_TurtleX,_TurtleY,x,y)
 4550ENDPROC
 4560
 4570DEFFNtpoint(x,y): PROCtpoint(x,y): =0
 4580
 4590REM+=====================================================================
 4600REM+
 4610REM+  PROCtdo(a(),s%,e%,n%)
 4620REM+
 4630REM+  See Stored Turtle-state Routines.
 4640REM+
 4650REM+=====================================================================
 4660REM+=================== Turtle Stack Routines ===========================
 4670
 4680REM+  N.B.  Routines for manipulating the Turtle-stack can easily
 4690REM+  result in garbage being stored and should be used with care.
 4700
 4710REM+=====================================================================
 4720REM+
 4730REM+  PROCtstack(n%)
 4740REM+
 4750REM+  Allocates Turtle-stack for recording up to n% Turtle-states,
 4760REM+  where a Turtle-state = <TurtleX,TurtleY,TurtleAngle,
 4770REM+  TurtleFCol%,TurtleFPlot%>. The stack-pointer is
 4780REM+  initialised to -1. The stack pointer is incremented before a
 4790REM+  Turtle-state is recorded and decremented after a Turtle-state
 4800REM+  is retrieved.
 4810REM+
 4820REM+  By recording Turtle-states on the stack, a shape generated
 4830REM+  by the Turtle may be stored, in order to be reproduced
 4840REM+  rapidly at later time, perhaps after a transformation has
 4850REM+  been applied.
 4860REM+
 4870REM+  The Turtle-stack may also be used to operate the Turtle
 4880REM+  recursively.
 4890REM+
 4900REM+  In some cases it is convenient to have a Turtle-stack which is
 4910REM+  local to a (possibly recursive) routine. Obviously PROCtstack
 4920REM+  does not provide this. Within the routine you should use the
 4930REM+  code:
 4940REM+
 4950REM+  LOCAL _TurtleStack()
 4960REM+  DIM _TurtleStack(n%,3)
 4970REM+  _TurtleGen%=-1
 4980REM+  _TurtleStack%=TRUE
 4990REM+
 5000DEFPROCtstack(n%)
 5010IF _TurtleStack% THEN PROC@terror(0,"tstack")
 5020DIM _TurtleStack(n%,3)
 5030_TurtleGen%=-1
 5040_TurtleStack%=TRUE
 5050ENDPROC
 5060
 5070DEFFNtstack(n%): PROCtstack(n%): =0
 5080
 5090REM+=====================================================================
 5100REM+
 5110REM+  PROCtmemset(n%)
 5120REM+
 5130REM+  Sets the Turtle-stack pointer to position n%
 5140REM+  Remember that PROCtrecord will first increment the stack-pointer.
 5150REM+
 5160DEFPROCtmemset(n%)
 5170IF NOT _TurtleStack% THEN PROC@terror(1,"tmemset")
 5180_TurtleGen%=n%
 5190ENDPROC
 5200
 5210DEFFNtmemset(n%): PROCtmemset(n%): =0
 5220
 5230REM+=====================================================================
 5240REM+
 5250REM+  PROCtmemmove(n%)
 5260REM+
 5270REM+  Moves the Turtle-stack pointer forward n% positions
 5280REM+  (if n% is positive) or backward n% positions (if n% is
 5290REM+  not positive)
 5300REM+  Remember that PROCtrecord will first increment the stack-pointer.
 5310REM+
 5320DEFPROCtmemmove(n%)
 5330LOCAL p%
 5340IF NOT _TurtleStack% THEN PROC@terror(1,"tmemmove")
 5350p%=_TurtleGen%+n%
 5360_TurtleGen%=p%
 5370ENDPROC
 5380
 5390DEFFNtmemmove(n%): PROCtmemmove(n%): =0
 5400
 5410REM+=====================================================================
 5420REM+
 5430REM+  PROCtrecord
 5440REM+
 5450REM+  Increments the Turtle-stack pointer, then records
 5460REM+  the current Turtle-state on the stack.
 5470REM+
 5480DEFPROCtrecord
 5490IF NOT _TurtleStack% THEN PROC@terror(1,"trecord")
 5500_TurtleGen%+=1
 5510IF _TurtleGen%<0 OR _TurtleGen%>DIM(_TurtleStack(),1) THEN PROC@terror(2,"trecord")
 5520_TurtleStack(_TurtleGen%,0)=_TurtleX
 5530_TurtleStack(_TurtleGen%,1)=_TurtleY
 5540_TurtleStack(_TurtleGen%,2)=_TurtleAngle
 5550_TurtleStack(_TurtleGen%,3)=_TurtleFCol%<<3+_TurtleFPlot%
 5560ENDPROC
 5570
 5580DEFFNtrecord: PROCtrecord: =0
 5590
 5600REM+=====================================================================
 5610REM+================ Stored Turtle-state Routines =======================
 5620REM+=====================================================================
 5630REM+
 5640REM+  PROCtgetstack(a(),s1%,s2%,e%)
 5650REM+
 5660REM+  Copys a segment of the Turtle-stack into a(), which must be
 5670REM+  declared with the form DIM a(n%,3). The segment copied begins
 5680REM+  at position s2% and ends at position e%. IF e% precedes s2%,
 5690REM+  then the segment is copied in reverse. Positions in a() are
 5700REM+  occupied starting at s1%. This routine effectively saves
 5710REM+  a shape generated by the Turtle, along with the associated
 5720REM+  orientations, colours and plot-actions. The contents of the
 5730REM+  target array may be manipulated to alter the shape, the colours
 5740REM+  or the plot-actions. The stack may be freed for recording
 5750REM+  further shapes.
 5760REM+
 5770REM+  The format of in which Turtle-states are held and transferred is
 5780REM+
 5790REM+     a(n%,0)=TurtleX
 5800REM+     a(n%,1)=TurtleY
 5810REM+     a(n%,2)=TurtleAngle
 5820REM+     a(n%,3)=TurtleFCol%<<3+TurtleFPlot%
 5830REM+
 5840REM+  Routines are provided for independently setting the colour or
 5850REM+  plot-action in a value of type a(n%,3)
 5860REM+
 5870DEFPROCtgetstack(a(),s1%,s2%,e%)
 5880LOCAL e2%,step%
 5890e2%=s1%+ABS(e%-s2%)-1
 5900IF NOT _TurtleStack% THEN PROC@terror(1,"tgetstack")
 5910IF DIM(a())<>2 THEN PROC@terror(3,"tgetstack")
 5920IF DIM(a(),2)<3 THEN PROC@terror(3,"tgetstack")
 5930IF s2%<0 OR s2%>DIM(_TurtleStack(),1) THEN PROC@terror(2,"tgetstack")
 5940IF e%<0 OR e%>DIM(_TurtleStack(),1) THEN PROC@terror(2,"tgetstack")
 5950IF s1%<0 OR s1%>DIM(a(),1) THEN PROC@terror(4,"tgetstack")
 5960IF e2%>DIM(a(),1) THEN PROC@terror(4,"tgetstack")
 5970IF e%<s1% THEN step%=1 ELSE step%=-1
 5980FOR s2%=s2% TO e% STEP step%
 5990   a(s1%,0)=_TurtleStack(s1%,0)
 6000   a(s1%,1)=_TurtleStack(s1%,1)
 6010   a(s1%,2)=_TurtleStack(s1%,2)
 6020   a(s1%,3)=_TurtleStack(s1%,3)
 6030   s1%+=1
 6040NEXT
 6050ENDPROC
 6060
 6070DEFFNtgetstack(a(),s1%,s2%,e%): PROCtgetstack(a(),s1%,s2%,e%): =0
 6080
 6090REM+=====================================================================
 6100REM+
 6110REM+  PROCtstorecol(r,col%)
 6120REM+
 6130REM+  This routine assumes that r is used to hold a Turtle colour and
 6140REM+  plot-action in Turtle-stack format (see PROCtgetstack), and
 6150REM+  sets the stored colour to col%
 6160REM+
 6170REM+  N.B. BASIC treats colour values MOD the range of the current
 6180REM+  graphics mode.
 6190REM+
 6200DEFPROCtstorecol(RETURN r,col%)
 6210r=(r MOD 8)+col%<<3
 6220ENDPROC
 6230
 6240DEFFNtstorecol(r,col%): PROCtstorecol(r,col%): =0
 6250
 6260REM+=====================================================================
 6270REM+
 6280REM+  PROCtstoreplot(r,plot%)
 6290REM+
 6300REM+  This routine assumes that r is used to hold a Turtle colour and
 6310REM+  plot-action in Turtle-stack format (see PROCtgetstack), and
 6320REM+  sets the stored plot-action to plot%
 6330REM+
 6340DEFPROCtstoreplot(RETURN r,plot%)
 6350IF plot%>7 THEN PROC@terror(5,"tstoreplot")
 6360r=(r DIV 8)+plot%
 6370ENDPROC
 6380
 6390DEFFNtstoreplot(r,plot%): PROCtstoreplot(r,plot%): =0
 6400
 6410REM+=====================================================================
 6420REM+
 6430REM+  PROCtrestore
 6440REM+
 6450REM+  When Turtle-stack is active, this routine restores the
 6460REM+  Turtle's state from the current position in the stack, then
 6470REM+  decrements the stack pointer.
 6480REM+
 6490DEFPROCtrestore
 6500IF NOT _TurtleStack% THEN PROC@terror(1,"trestore")
 6510IF _TurtleGen%<0 OR _TurtleGen%>DIM(_TurtleStack(),1) THEN PROC@terror(2,"trestore")
 6520PROCtgcol(_TurtleStack(_TurtleGen%,3) MOD 8,_TurtleStack(_TurtleGen%,3) DIV 8)
 6530PROCtjump(_TurtleStack(_TurtleGen%,0),_TurtleStack(_TurtleGen%,1),_TurtleStack(_TurtleGen%,2))
 6540_TurtleGen%-=1
 6550ENDPROC
 6560
 6570DEFFNtrestore: PROCtrestore: =0
 6580
 6590REM+=====================================================================
 6600REM+
 6610REM+  PROCtdo(a(),s%,e%,n%)
 6620REM+
 6630REM+  This routine assumes that a() is an array in Turtle-stack
 6640REM+  format, i.e. as populated by PROCtgetstack. It causes the
 6650REM+  Turtle to track the shape stored in a(), starting at position
 6660REM+  s% and continuing to position e%, or until a position is
 6670REM+  reached where the stored X-coordinate - a(n,0) - is outside
 6680REM+  the graphics coordinates range [-32768,+32767]. (This allows
 6690REM+  user programs to terminate the stored shape by inserting an
 6700REM+  excessive value at the desired position). If e% precedes s%
 6710REM+  then the stored shape will be tracked in reverse.
 6720REM+
 6730REM+  If the parameter n% is > 0, then the Turtle will use the
 6740REM+  stored plot-action and colour at each position, otherwise
 6750REM+  it will ignore them and use the values last set by PROCtgcol.
 6760REM+  The Turtle's pen is set on for the duration of the routine.
 6770REM+  On entry, the Turtle's plot-action and colour are saved and
 6780REM+  on exit they are restored.
 6790REM+
 6800REM+  N.B. The routine does not trap graphically invalid Y-coordinates.
 6810REM+
 6820DEFPROCtdo(a(),s%,e%,n%)
 6830LOCAL start%,end%,step%,pen%,action%,colour%,x%
 6840pen%=_TurtlePenOn%
 6850action%=_TurtleFPlot%
 6860colour%=_TurtleFCol%
 6870IF DIM(a())<>2 THEN PROC@terror(3,"tdo")
 6880IF DIM(a(),2)<3 THEN PROC@terror(3,"tdo")
 6890IF s%<0 OR s%>DIM(a(),1) THEN PROC@terror(4,"tdo")
 6900IF e%<0 OR e%>DIM(a(),1) THEN PROC@terror(4,"tdo")
 6910IF e%>=s% THEN
 6920   start%=s%
 6930   end%=e%
 6940   step%=1
 6950ELSE
 6960   start%=e%
 6970   end%=s%
 6980   step%=-1
 6990ENDIF
 7000PROCtjump(a(start%,0),a(start%,1),_TurtleAngle)
 7010PROCtpen(1)
 7020IF n%>0 THEN
 7030   PROCtgcol(a(start%,3) MOD 8,a(start%,3) DIV 8)
 7040ENDIF
 7050PROCtplot
 7060CASE TRUE OF
 7070WHEN n%>0
 7080   x=a(start%,0)
 7090   WHILE start%<>end% AND x>=-32768 AND x<=32767
 7100      start%+=step%
 7110      x=a(start%,0)
 7120      PROCtto(x,a(start%,1))
 7130      PROCtgcol(a(start%,3) MOD 8,a(start%,3) DIV 8)
 7140   ENDWHILE
 7150OTHERWISE
 7160   x=a(start%,0)
 7170   WHILE start%<>end% AND x>=-32768 AND x<=32767
 7180      start%+=step%
 7190      x=a(start%,0)
 7200      PROCtto(x,a(start%,1))
 7210   ENDWHILE
 7220ENDCASE
 7230_TurtlePenOn%=pen%
 7240_TurtleFPlot%=action%
 7250_TurtleFCol%=colour%
 7260ENDPROC
 7270
 7280DEFFNtdo(a(),s%,e%,n%): PROCtdo(a(),s%,e%,n%): =0
 7290
 7300REM+=====================================================================
 7310REM+==================== Internal Library Routines ======================
 7320REM+=====================================================================
 7330REM+
 7340REM+  PROC@tdraw
 7350REM+
 7360REM+  Draws the Turtle.
 7370REM+
 7380DEFPROC@tdraw
 7390LOCAL xpix%,ypix%
 7400xpix%=INT(_TurtleX+0.5)
 7410ypix%=INT(_TurtleY+0.5)
 7420GCOL 4,0
 7430DRAW xpix%+_TWing*SIN RAD (_TurtleAngle+225),ypix%+_TWing*COS RAD (_TurtleAngle+225)
 7440DRAW xpix%+_THalf%*SIN RAD _TurtleAngle,ypix%+_THalf%*COS RAD _TurtleAngle
 7450DRAW xpix%+_TWing*SIN RAD (_TurtleAngle+135),ypix%+_TWing*COS RAD (_TurtleAngle+135)
 7460DRAW xpix%,ypix%
 7470IF _TurtleWatchOn% THEN _C%=GET
 7480GCOL _TurtleFPlot%,_TurtleFCol%
 7490ENDPROC
 7500
 7510REM+=====================================================================
 7520REM+
 7530REM+  PROC@terror
 7540REM+
 7550REM+  Issues an untrappable error when necessary.
 7560REM+
 7570DEFPROC@terror(n%,errproc$)
 7580LOCAL prefix$
 7590prefix$="Fatal error in TurtleGRFX: PROC"+errproc$
 7600CASE n% OF
 7610WHEN 0
 7620   ERROR 0,prefix$+" - called twice"
 7630WHEN 1
 7640   ERROR 0,prefix$+" - no Turtle-stack allocated"
 7650WHEN 2
 7660   ERROR 0,prefix$+" - out of Turtle-stack range"
 7670WHEN 3
 7680   ERROR 0,prefix$+" - user array is not Turtle-stack form"
 7690WHEN 4
 7700   ERROR 0,prefix$+" - out of user array range"
 7710WHEN 5
 7720   ERROR 0,prefix$+" - out of plot action range (0-7)"
 7730ENDCASE
 7740ENDPROC
 7750
 7760REM+=====================================================================
 7770REM+==================== Turtle Interpreter =============================
 7780REM+=====================================================================
 7790REM+
 7800REM+  PROCtrun
 7810REM+
 7820REM+     This procedure should be called from the BASIC prompt to
 7830REM+  initiate direct keyboard control of the Turtle. PROCtrun
 7840REM+  executes PROCtstart and PROCtshow to start the Turtle and make
 7850REM+  it visible, then issues the prompt "t?". You may then enter any
 7860REM+  string s$ such that "PROCt"+s$ evaluates to a valid TurtleGRFX
 7870REM+  procedure call, and this call will be executed. The "t?" prompt
 7880REM+  continues to be issued until a null string is entered, at which
 7890REM+  point the procedure terminates. For example:
 7900REM+
 7910REM+     t?turn(90)<ENTER>          (turns Turtle 90 degrees)
 7920REM+     t?tgo(100)<ENTER>          (advances Turtle 100 units)
 7930REM+     t?<ENTER>                  (returns to BASIC)
 7940REM+
 7950DEFPROCtrun
 7960LOCAL dummy%
 7970PROCtstart
 7980PROCtshow
 7990LINEINPUT "t",com$
 8000WHILE com$>""
 8010   dummy%=EVAL("FNt"+com$)
 8020   LINEINPUT "t",com$
 8030ENDWHILE
 8040ENDPROC
 8050
 8060REM+=====================================================================
 8070REM+==================== Make Help files ================================
 8080REM+=====================================================================
 8090REM+
 8100REM+  PROC@help
 8110REM+
 8120REM+  The procedure creates compact help files and a compact working
 8130REM+  version of the library. Select your TurtleGRFX directory, then
 8140REM+  enter BASIC and load TurtleGRFX. Type "PROC@help" from the
 8150REM+  BASIC prompt. This will create the following files on the
 8160REM+  current directory:
 8170REM+
 8180REM+  TGRFXRun.......Working version of the library without comments.
 8190REM+  TGRFXHelpA.....Compact help file in ASCII format.
 8200REM+  TGRFXHelpB.....Compact help file in BASIC format.
 8210REM+  DeleteMe.......Transient command file.
 8220REM+
 8230REM+  The help files contain the procedure call formats for all
 8240REM+  the routines and the associated comments.
 8250REM+
 8260DEFPROC@help
 8270LOCAL channel%
 8280channel%=OPENOUT("DeleteMe")
 8290CLOSE#channel%
 8300*SETTYPE DeleteMe COMMAND
 8310channel%=OPENOUT("DeleteMe")
 8320BPUT#channel%,"LISTO %01000"
 8330BPUT#channel%,"*SPOOL TGRFXHelp"
 8340BPUT#channel%,"LIST IFREM+"
 8350BPUT#channel%,"*SPOOL"
 8360BPUT#channel%,"*SPOOL TGRFXRunA"
 8370BPUT#channel%,"LIST"
 8380BPUT#channel%,"*SPOOL"
 8390BPUT#channel%,"NEW"
 8400BPUT#channel%,"10  PROCCleanUp(""TGRFXRunA"",""TGRFXRun"",""REM"")"
 8410BPUT#channel%,"20  PROCCleanUp(""TGRFXHelp"",""TGRFXHelpA"",""REM>"")"
 8420BPUT#channel%,"30  END"
 8430BPUT#channel%,"40  DEFPROCCleanUp(infile$,outfile$,s$)"
 8440BPUT#channel%,"50  l%=LEN(s$)"
 8450BPUT#channel%,"60  in%=OPENIN(infile$)"
 8460BPUT#channel%,"70  out%=OPENOUT(outfile$)"
 8470BPUT#channel%,"80  WHILE NOT EOF#in%"
 8480BPUT#channel%,"90  line$=GET$#in%"
 8490BPUT#channel%,"100 CASE TRUE OF"
 8500BPUT#channel%,"110 WHEN line$="""""
 8510BPUT#channel%,"120 WHEN LEFT$(line$,l%)=s$"
 8520BPUT#channel%,"130 WHEN LEFT$(line$,5)="">LIST"""
 8530BPUT#channel%,"140 WHEN LEFT$(line$,7)="">*SPOOL"""
 8540BPUT#channel%,"150 OTHERWISE"
 8550BPUT#channel%,"160 BPUT#out%,line$"
 8560BPUT#channel%,"170 ENDCASE"
 8570BPUT#channel%,"180 ENDWHILE"
 8580BPUT#channel%,"190 CLOSE#in%: CLOSE#out%"
 8590BPUT#channel%,"200 ENDPROC"
 8600BPUT#channel%,"RUN"
 8610BPUT#channel%,"QUIT"
 8620BPUT#channel%,"*DELETE TGRFXHelp"
 8630BPUT#channel%,"*SETTYPE TGRFXHelpA TEXT"
 8640BPUT#channel%,"*BASIC -load TGRFXHelpA"
 8650BPUT#channel%,"SAVE ""TGRFXHelpB"""
 8660BPUT#channel%,"QUIT"
 8670BPUT#channel%,"*DELETE TGRFXRunA"
 8680BPUT#channel%,"*BASIC -load TGRFXRun"
 8690BPUT#channel%,"SAVE ""TGRFXRun"""
 8700BPUT#channel%,"QUIT"
 8710BPUT#channel%,"|"
 8720BPUT#channel%,"| Help files created on current directory."
 8730BPUT#channel%,"| ASCII help = TGRFXHelpA, BASIC help = TGRFXHelpB."
 8740BPUT#channel%,"|"
 8750BPUT#channel%,"| Runtime version TGRFXRun created on current directory"
 8760CLOSE#channel%
 8770*DeleteMe
 8780ENDPROC
 8790
 8800REM+=====================================================================
 8810REM+============================ END ====================================

�>TurtleGRFX

-�   Program: TurtleGRFX v2.01 10-Mar-1991
(/�   Author:  Copyright (C) I.M.Kinghan 1991
26�   Purpose: Turtle Graphics library for BBC BASIC
<
F�   Correspondence to:
P�   Mike Kinghan,
Z�   149 Campbell Road,
d�   Cowley,
n�   Oxford OX4 3NX
x
�K�==================== Synopsis ========================================
�
�>�      The routines in this library are tools for creating
�=�   graphics programs in the style originated by the Logo
�A�   language. Shapes may generated by issuing directions to a
�?�   drawing agent called "the Turtle". The routines provide
�D�   the vocabulary of directives. Shapes of remarkable intricacy
�C�   and beauty, including fractals, can be created by recursive
��   routines.
�
�A�      The routines do not faithfully mimic those of the Logo
�F�   language, but provide a fuller and more powerful set of tools.
�C�   In particular, a number or procedures are provided for rec-
F�   ording and saving shapes generated by the Turtle, so that they
G�   may be reproduced more quickly and economically than they could
F�   be recreated, and so that they can easily be transformed using
"�   a stored "template".
,
66�      The routines are presented in five classes:
@
J?�   1. Turtle Disposition Routines - related to whether the
TB�      Turtle is visible or not, its pen action, and the like.
^
hA�   2. Turtle Action Routines - related to moving the Turtle.
r
|F�   3. Turtle-stack Routines - related to recording Turtle-states.
�
�C�   4. Stored Turtle-state Routines - related to retrieving and
�-�      manipulating stored Turtle-states.
�
�I�   5. Internal Library Routines - not recommended for user programs.
�
�D�      In addition, the library supports direct keyboard control
�I�   of the Turtle via commands corresponding to the library routines.
��   See PROCtrun.
�
�K�================== Important Notes ===================================
�
�G�   *  The library contains all of its own documentation. The gives
E�   secure version control but has drawbacks. When the library is
G�   is loaded its internal documentation occupies a large amount of
E�   memory. When the documentation is consulted, it is fragmented
&G�   by the source code. A procedure PROC@help is provided to remove
0G�   these nuisances by creating compact help files with source code
:F�   stripped out and a compact working version of the library with
DC�   comments stripped out. Find PROC@help below and consult the
NG�   notes which accompany it. N.B. PROC@help is liable to be harmed
XF�   by any editing of this source file: in particular it makes use
b/�   of the strings "REM","REM>" and "REM+".
l
v@�   *  The Turtle must be initialised by calling  PROCtstart
�1�   before any of the other library routines.
�
�<�   *  The library reserves all variable names beginning
�?�   with "_" followed by a capital letter. It is useful for
�>�   programs to interrogate some of the library variables,
�+�   but none of them may be written to.
�
�>�   *  To function correctly the Turtle needs to know what
�@�   graphics plot actions and colours you select. To provide
�A�   the Turtle with this information, you must always use the
�C�   library routine  PROCtgcol(action%,colour%)  instead of the
�-�   BASIC command  GCOL(action%,colour%).
�
H�   *  The Turtle's position is given in BASIC graphics coordinates;
B�   its orientation is given in degrees clockwise of due North
B�   i.e. the direction of increasing vertical coordinates. The
 C�   position can be read by interrogating the library variables
*F�   _TurtleX (horizontal) and _TurtleY (vertical). The orientation
4;�   can be read from the library variable _TurtleAngle.
>
HA�   *  When the Turtle-stack is in use to record the Turtle's
R@�   positions and orientations, the stack pointer is held in
\C�   the library variable _TurtleGen%, which may be read to find
f"�   the current stack-pointer.
p
zE�   *  Routines with names beginning "@" are called internally be
�A�   the library and are not recommended for programmers' use.
�
�D�   *  Turtle actions are considerably slower when the Turtle is
�A�   visible than when it is invisible, due to the overhead of
�C�   erasing and redrawing the Turtle from place to place. It is
�E�   suggested that the visible Turtle be used only during program
�@�   development when it is necessary to see exactly what the
�H�   Turtle is doing. The procedures  PROCtwatchon  and PROCtwatchoff
�'�   are provided to assist in this.
�
�F�   *  All routines are implemented as procedures. It will be seen
�E�   that in association with each procedure a function is defined
�J�   which simply executes the procedure and returns 0. These functions
F�   are used by PROCtrun to provide direct keyboard control of the
�   Turtle.

$I�======================== Version Control ===========================
.
8� v1.00 26-Jan-91:
B�       * Original version.
L� v2.00 19-Feb-91
VI�      * New procedure PROCtbear: Set the Turtle on absolute bearing.
`@�      * New procedure PROCtrun: Keyboard control of turtle.
jD�      * New procedure PROC@help: creates compact help files and
t*�      compact version of the library.
~E�      * PROCtrecord modified to be true inverse of PROCtrestore,
�H�      i.e. now updates Turtle stack-pointer in Full Ascending mode.
�D�      * Function variant introduced for each procedure: used by
��      PROCtrun.
�?�      * Turtle angle 0 changed from due East to due North.
�J�      * PROCtturn, PROCtalign modified so that Turtle angle is always
�!�      expressed as positive.
�I�      * Bug fix to PROCtturn. Turns were always truncated to integer
��      degrees.
�=�      * Internal fatal errors no longer terminate BASIC.
�B�      * Redundant range checking removed from PROCtmemset and
��      PROCtmemmove.
�2�      * Documentation corrected and extended.
� v2.01 10-Mar-91

J�      * Bug fix in FNtstoreplot and FNtstorecol. Integer paremeter r%
�      changed to real r.
>�      * Bug fix in PROCtdo. Global variable x made local.
(E�      * Bug fix in PROCtrun. "PROCstart" should be "PROCtstart";
2+�      "PROCshow" should be "PROCtshow"
<?�      * Minor error in screen output of PROC@help. "HelpA"
FA�      should be "TGRFXHelpA"; "HelpB" should be "TGRFXHelpB"
PE�      * Additional "REM+"s (directives to PROC@help) inserted to
Z(�      improve format of help files.
d
nI�+==================== Routines =====================================
x�+
��+  PROCtstart
��+
��+  Initialises the Turtle.
�A�+  The Turtle is placed in the middle of the screen pointing
�?�+  due North. It is invisible; its "pen" is off; its plot-
�J�+  actions and colours, both foreground and background, are set to 0;
��+  no Turtle-stack exists.
��+
���tstart
�_Height%=1024
�_Width%=1280
�_TLength%=64
�_THalf%=_TLength% � 2
_TWing=�(_THalf%^2*2)
_TurtleAngle=0
_TurtleX=(_Width% � 2)-1
"_TurtleY=(_Height% � 2)-1
,� _TurtleX,_TurtleY
6_TurtleOn%=�
@_TurtlePenOn%=�
J_TurtleStack%=�
T_TurtleWatchOn%=�
^_TurtleFCol%=0
h_TurtleBCol%=0
r_TurtleFPlot%=0
|_TurtleBPlot%=0
��
�
�ݤtstart: �tstart: =0
�
�K�+=====================================================================
�K�+============= Turtle Disposition Routines ===========================
�K�+=====================================================================
��+
��+  PROCtshow
��+
�!�+  Makes the Turtle visible.
��+
���tshow
� � _TurtleOn% �
   �@tdraw
   _TurtleOn%=�
&�
0�
:
Dݤtshow: �tshow: =0
N
XK�+=====================================================================
b�+
l�+  PROCthide
v�+
�#�+  Makes the Turtle invisible.
��+
���thide
�� _TurtleOn% �
�   �@tdraw
�   _TurtleOn%=�
��
��
�
�ݤthide: �thide: =0
�
�K�+=====================================================================
��+
"�+  PROCtgcol(action%,colour%)
�+
B�+  Sets the graphics plot-actions and colours and informs the
 E�+  Turtle of the settings. The foreground plot-action and colour
*@�+  as last set by this routine can be read from the library
4@�+  variables _TurtleFPlot% and _TurtleFCol%; the background
>?�+  values can be read from _TurtleBPlot% and _TurtleBCol%.
H�+
RE�+  N.B. In this release of the library, the Turtle only needs to
\C�+  know what foreground plot-action and colour are in force so
fC�+  that it can be correctly redrawn when it is visible. In the
pD�+  interest of speed, however, the Turtle restores these values
zD�+  automatically only when it is obliged to by a Turtle-redraw:
�D�+  at other times it uses whatever values are in force, even if
�C�+  they have been directly set by GCOL(action% colour%) rather
�@�+  than through PROCtgcol(action%,colour%). It is therefore
�F�+  recommended that PROCtgcol should always be used in TurtleGRFX
�E�+  programs instead the BASIC command GCOL, otherwise the Turtle
�<�+  is liable to restore values which are "out of date".
��+
���tgcol(action%,colour%)
�action%=�(action% � 8)
�colour%=�(colour% � 256)
�� action%,colour%
�� colour%<128
�   _TurtleFPlot%=action%
	   _TurtleFCol%=colour%
	�
	   _TurtleBPlot%=action%
	$   _TurtleBCol%=colour%
	.�
	8�
	B
	L9ݤtgcol(action%,colour%): �tgcol(action%,colour%): =0
	V
	`K�+=====================================================================
	j�+
	t�+  PROCtpen(n%)
	~�+
	��+  Sets the Turtle's pen.
	�D�+  When n%=0, the Turtle will not draw its movements, otherwise
	�E�+  it will draw its movements using the current forground colour
	��+  and plot-action.
	��+
	���tpen(n%)
	�/� n%<>0 � _TurtlePenOn%=� � _TurtlePenOn%=�
	��
	�
	�ݤtpen(n%): �tpen(n%): =0
	�
	�K�+=====================================================================
�+

�+  PROCtwatchon
�+
F�+  Makes the Turtle visible and causes it to wait for a keystroke
(5�+  whenever it is redrawn. For use in debugging.
2�+
<��twatchon
F
�tshow
P_TurtleWatchOn%=�
Z�
d
nݤtwatchon: �twatchon: =0
x
�K�+=====================================================================
��+
��+  PROCtwatchoff
��+
�E�+  Cancels PROCtwatchon, if it is in force, and makes the Turtle
�+�+  invisible; otherwise has no effect.
��+
���twatchoff
�� _TurtleWatchOn% �
�   _TurtleWatchOn%=�
�
   �thide
��
��

ݤtwatchoff: �twatchoff: =0

"K�+=====================================================================
,K�+================== Turtle Action Routines ===========================
6K�+=====================================================================
@�+
J�+  PROCthome
T�+
^5�+  Replaces the Turtle at its starting position.
h�+
r��thome
|� _TurtleOn% � �@tdraw
�_TurtleAngle=0
�_TurtleX=(_Width% � 2)-1
�_TurtleY=(_Height% � 2)-1
�� _TurtleX,_TurtleY
�� _TurtleOn% � �@tdraw
��
�
�ݤthome: �thome: =0
�
�K�+=====================================================================
��+
��+  PROCtjump(x,y,alpha)
��+
4�+  Places the Turtle directly as position <x,y>
�+  with orientation alpha.
�+
&��tjump(x,y,alpha)
0� _TurtleOn% � �@tdraw
:_TurtleX=x
D_TurtleY=y
N_TurtleAngle=alpha
X%� �(_TurtleX+0.5),�(_TurtleY+0.5)
b� _TurtleOn% � �@tdraw
l�
v
�-ݤtjump(x,y,alpha): �tjump(x,y,alpha): =0
�
�K�+=====================================================================
��+
��+  PROCtgo(n)
��+
�I�+  Advances the Turtle by n graphics units in its current direction.
��+
���tgo(n)
�� _TurtleOn% � �@tdraw
� _TurtleX+=n*� � _TurtleAngle
� _TurtleY+=n*� � _TurtleAngle
�� _TurtlePenOn% �

(   � �(_TurtleX+0.5),�(_TurtleY+0.5)

�

(   � �(_TurtleX+0.5),�(_TurtleY+0.5)

 �

*� _TurtleOn% � �@tdraw

4�

>

Hݤtgo(n): �tgo(n): =0

R

\K�+=====================================================================

f�+

p�+  PROCtto(x,y)

z�+

�I�+  Orients the Turtle toward <x,y> and advances it to that position.

��+

���tto(x,y)

�"�talign(_TurtleX,_TurtleY,x,y)

�� _TurtleOn% � �@tdraw

�� _TurtlePenOn% �

�  � �(x+0.5),�(y+0.5)

��

�  � �(x+0.5),�(y+0.5)

��

�_TurtleX=x

�_TurtleY=y

�� _TurtleOn% � �@tdraw
�

ݤtto(x,y): �tto(x,y): =0
$
.K�+=====================================================================
8�+
B�+  PROCtturn(n)
L�+
VE�+  Turns the turtle by n degrees - clockwise when n is positive,
`)�+  anticlockwise when n is negative.
j�+
t��tturn(n)
~� _TurtleOn% � �@tdraw
�_TurtleAngle+=n
�D� �(_TurtleAngle)>360 � _TurtleAngle-=(360*(_TurtleAngle � 360))
�(� _TurtleAngle<0 � _TurtleAngle+=360
�� _TurtleOn% � �@tdraw
��
�
�ݤtturn(n): �tturn(n): =0
�
�K�+=====================================================================
��+
��+  PROCtbear(n)
��+
B�+  Orients the Turtle on a bearing n degrees clockwise of due

-�+  North, without changing its position.
�+
��tbear(n)
(� _TurtleOn% � �@tdraw
2#� �(n)>360 � n-=(360*(n � 360))
<� n<0 � n+=360
F_TurtleAngle=n
P� _TurtleOn% � �@tdraw
Z�
d
nݤtbear(n): �tbear(n): =0
x
�K�+=====================================================================
��+
��+  PROCtplot
��+
�@�+  Causes the Turtle to plot its current position using the
�1�+  current Turtle pen-value and plot-action.
��+
���tplot
�� _TurtlePenOn% �
�)   Ȓ �(_TurtleX+0.5),�(_TurtleY+0.5)
��
��
�
ݤtplot: �tplot: =0

K�+=====================================================================
"�+
,�+  PROCtalign(x1,y1,x2,y2)
6�+
@C�+  Aligns the Turtle with the line <<x1,y1>,<x2,y2>>, oriented
J=�+  toward <x2,y2>. The Turtle's position is not changed.
T�+
^��talign(x1,y1,x2,y2)
h� xdif,ydif
rxdif=x1-x2
|ydif=y1-y2
�� xdif>0 � ydif>0
�   � _TurtleOn% � �@tdraw
�
   Ȏ � �
�   �  ydif<>0
�%      _TurtleAngle=� �(xdif/ydif)
�      Ȏ � �
�      � ydif>0
�         _TurtleAngle+=180
�      � xdif>0
�         _TurtleAngle+=360
�      �
�   
�      � xdif<0 �
         _TurtleAngle=90
      �
         _TurtleAngle=270
&      �
0   �
:   � _TurtleOn% � �@tdraw
D�
N�
X
b3ݤtalign(x1,y1,x2,y2): �talign(x1,y1,x2,y2): =0
l
vK�+=====================================================================
��+
��+  PROCtpoint(x,y)
��+
�F�+  Orients the Turtle toward <x,y> without changing its position.
��+
���tpoint(x,y)
�"�talign(_TurtleX,_TurtleY,x,y)
��
�
�#ݤtpoint(x,y): �tpoint(x,y): =0
�
�K�+=====================================================================
��+
�+  PROCtdo(a(),s%,e%,n%)
�+
)�+  See Stored Turtle-state Routines.
 �+
*K�+=====================================================================
4K�+=================== Turtle Stack Routines ===========================
>
HC�+  N.B.  Routines for manipulating the Turtle-stack can easily
RD�+  result in garbage being stored and should be used with care.
\
fK�+=====================================================================
p�+
z�+  PROCtstack(n%)
��+
�D�+  Allocates Turtle-stack for recording up to n% Turtle-states,
�<�+  where a Turtle-state = <TurtleX,TurtleY,TurtleAngle,
�7�+  TurtleFCol%,TurtleFPlot%>. The stack-pointer is
�D�+  initialised to -1. The stack pointer is incremented before a
�E�+  Turtle-state is recorded and decremented after a Turtle-state
��+  is retrieved.
��+
�B�+  By recording Turtle-states on the stack, a shape generated
�>�+  by the Turtle may be stored, in order to be reproduced
�A�+  rapidly at later time, perhaps after a transformation has
��+  been applied.
��+
?�+  The Turtle-stack may also be used to operate the Turtle
�+  recursively.
�+
$F�+  In some cases it is convenient to have a Turtle-stack which is
.E�+  local to a (possibly recursive) routine. Obviously PROCtstack
8D�+  does not provide this. Within the routine you should use the
B
�+  code:
L�+
V�+  LOCAL _TurtleStack()
`�+  DIM _TurtleStack(n%,3)
j�+  _TurtleGen%=-1
t�+  _TurtleStack%=TRUE
~�+
���tstack(n%)
�*� _TurtleStack% � �@terror(0,"tstack")
�� _TurtleStack(n%,3)
�_TurtleGen%=-1
�_TurtleStack%=�
��
�
�!ݤtstack(n%): �tstack(n%): =0
�
�K�+=====================================================================
��+
��+  PROCtmemset(n%)
�+

4�+  Sets the Turtle-stack pointer to position n%
I�+  Remember that PROCtrecord will first increment the stack-pointer.
�+
(��tmemset(n%)
2-� � _TurtleStack% � �@terror(1,"tmemset")
<_TurtleGen%=n%
F�
P
Z#ݤtmemset(n%): �tmemset(n%): =0
d
nK�+=====================================================================
x�+
��+  PROCtmemmove(n%)
��+
�;�+  Moves the Turtle-stack pointer forward n% positions
�>�+  (if n% is positive) or backward n% positions (if n% is
��+  not positive)
�I�+  Remember that PROCtrecord will first increment the stack-pointer.
��+
���tmemmove(n%)
�� p%
�.� � _TurtleStack% � �@terror(1,"tmemmove")
�p%=_TurtleGen%+n%
�_TurtleGen%=p%
��

%ݤtmemmove(n%): �tmemmove(n%): =0

"K�+=====================================================================
,�+
6�+  PROCtrecord
@�+
J9�+  Increments the Turtle-stack pointer, then records
T.�+  the current Turtle-state on the stack.
^�+
h
��trecord
r-� � _TurtleStack% � �@terror(1,"trecord")
|_TurtleGen%+=1
�M� _TurtleGen%<0 � _TurtleGen%>�(_TurtleStack(),1) � �@terror(2,"trecord")
�(_TurtleStack(_TurtleGen%,0)=_TurtleX
�(_TurtleStack(_TurtleGen%,1)=_TurtleY
�,_TurtleStack(_TurtleGen%,2)=_TurtleAngle
�=_TurtleStack(_TurtleGen%,3)=_TurtleFCol%<<3+_TurtleFPlot%
��
�
�ݤtrecord: �trecord: =0
�
�K�+=====================================================================
�K�+================ Stored Turtle-state Routines =======================
�K�+=====================================================================
��+
%�+  PROCtgetstack(a(),s1%,s2%,e%)
�+
C�+  Copys a segment of the Turtle-stack into a(), which must be
&E�+  declared with the form DIM a(n%,3). The segment copied begins
0D�+  at position s2% and ends at position e%. IF e% precedes s2%,
:C�+  then the segment is copied in reverse. Positions in a() are
D@�+  occupied starting at s1%. This routine effectively saves
NB�+  a shape generated by the Turtle, along with the associated
XC�+  orientations, colours and plot-actions. The contents of the
bG�+  target array may be manipulated to alter the shape, the colours
lA�+  or the plot-actions. The stack may be freed for recording
v�+  further shapes.
��+
�H�+  The format of in which Turtle-states are held and transferred is
��+
��+     a(n%,0)=TurtleX
��+     a(n%,1)=TurtleY
��+     a(n%,2)=TurtleAngle
�.�+     a(n%,3)=TurtleFCol%<<3+TurtleFPlot%
��+
�E�+  Routines are provided for independently setting the colour or
�.�+  plot-action in a value of type a(n%,3)
��+
���tgetstack(a(),s1%,s2%,e%)
�� e2%,step%
e2%=s1%+�(e%-s2%)-1
/� � _TurtleStack% � �@terror(1,"tgetstack")
)� �(a())<>2 � �@terror(3,"tgetstack")
 *� �(a(),2)<3 � �@terror(3,"tgetstack")
*?� s2%<0 � s2%>�(_TurtleStack(),1) � �@terror(2,"tgetstack")
4=� e%<0 � e%>�(_TurtleStack(),1) � �@terror(2,"tgetstack")
>4� s1%<0 � s1%>�(a(),1) � �@terror(4,"tgetstack")
H,� e2%>�(a(),1) � �@terror(4,"tgetstack")
R!� e%<s1% � step%=1 � step%=-1
\� s2%=s2% � e% � step%
f#   a(s1%,0)=_TurtleStack(s1%,0)
p#   a(s1%,1)=_TurtleStack(s1%,1)
z#   a(s1%,2)=_TurtleStack(s1%,2)
�#   a(s1%,3)=_TurtleStack(s1%,3)
�
   s1%+=1
��
��
�
�?ݤtgetstack(a(),s1%,s2%,e%): �tgetstack(a(),s1%,s2%,e%): =0
�
�K�+=====================================================================
��+
��+  PROCtstorecol(r,col%)
��+
�G�+  This routine assumes that r is used to hold a Turtle colour and
�C�+  plot-action in Turtle-stack format (see PROCtgetstack), and
&�+  sets the stored colour to col%
�+
D�+  N.B. BASIC treats colour values MOD the range of the current
$�+  graphics mode.
.�+
8��tstorecol(� r,col%)
Br=(r � 8)+col%<<3
L�
V
`/ݤtstorecol(r,col%): �tstorecol(r,col%): =0
j
tK�+=====================================================================
~�+
��+  PROCtstoreplot(r,plot%)
��+
�G�+  This routine assumes that r is used to hold a Turtle colour and
�C�+  plot-action in Turtle-stack format (see PROCtgetstack), and
�,�+  sets the stored plot-action to plot%
��+
���tstoreplot(� r,plot%)
�(� plot%>7 � �@terror(5,"tstoreplot")
�r=(r � 8)+plot%
��
�
�3ݤtstoreplot(r,plot%): �tstoreplot(r,plot%): =0


K�+=====================================================================
�+
�+  PROCtrestore
(�+
2>�+  When Turtle-stack is active, this routine restores the
<C�+  Turtle's state from the current position in the stack, then
F%�+  decrements the stack pointer.
P�+
Z��trestore
d.� � _TurtleStack% � �@terror(1,"trestore")
nN� _TurtleGen%<0 � _TurtleGen%>�(_TurtleStack(),1) � �@terror(2,"trestore")
xK�tgcol(_TurtleStack(_TurtleGen%,3) � 8,_TurtleStack(_TurtleGen%,3) � 8)
�_�tjump(_TurtleStack(_TurtleGen%,0),_TurtleStack(_TurtleGen%,1),_TurtleStack(_TurtleGen%,2))
�_TurtleGen%-=1
��
�
�ݤtrestore: �trestore: =0
�
�K�+=====================================================================
��+
��+  PROCtdo(a(),s%,e%,n%)
��+
�A�+  This routine assumes that a() is an array in Turtle-stack
�A�+  format, i.e. as populated by PROCtgetstack. It causes the
�E�+  Turtle to track the shape stored in a(), starting at position
@�+  s% and continuing to position e%, or until a position is
C�+  reached where the stored X-coordinate - a(n,0) - is outside
D�+  the graphics coordinates range [-32768,+32767]. (This allows
"C�+  user programs to terminate the stored shape by inserting an
,C�+  excessive value at the desired position). If e% precedes s%
69�+  then the stored shape will be tracked in reverse.
@�+
J@�+  If the parameter n% is > 0, then the Turtle will use the
TA�+  stored plot-action and colour at each position, otherwise
^E�+  it will ignore them and use the values last set by PROCtgcol.
hC�+  The Turtle's pen is set on for the duration of the routine.
rC�+  On entry, the Turtle's plot-action and colour are saved and
|"�+  on exit they are restored.
��+
�I�+  N.B. The routine does not trap graphically invalid Y-coordinates.
��+
���tdo(a(),s%,e%,n%)
�/� start%,end%,step%,pen%,action%,colour%,x%
�pen%=_TurtlePenOn%
�action%=_TurtleFPlot%
�colour%=_TurtleFCol%
�#� �(a())<>2 � �@terror(3,"tdo")
�$� �(a(),2)<3 � �@terror(3,"tdo")
�,� s%<0 � s%>�(a(),1) � �@terror(4,"tdo")
�,� e%<0 � e%>�(a(),1) � �@terror(4,"tdo")
�� e%>=s% �
   start%=s%
   end%=e%
   step%=1
&�
0   start%=e%
:   end%=s%
D   step%=-1
N�
X0�tjump(a(start%,0),a(start%,1),_TurtleAngle)
b�tpen(1)
l� n%>0 �
v.   �tgcol(a(start%,3) � 8,a(start%,3) � 8)
��
�
�tplot
�
Ȏ � �
�
� n%>0
�   x=a(start%,0)
�-   ȕ start%<>end% � x>=-32768 � x<=32767
�      start%+=step%
�      x=a(start%,0)
�      �tto(x,a(start%,1))
�1      �tgcol(a(start%,3) � 8,a(start%,3) � 8)
�   �
�
�   x=a(start%,0)
-   ȕ start%<>end% � x>=-32768 � x<=32767
      start%+=step%
      x=a(start%,0)
       �tto(x,a(start%,1))
*   �
4�
>_TurtlePenOn%=pen%
H_TurtleFPlot%=action%
R_TurtleFCol%=colour%
\�
f
p/ݤtdo(a(),s%,e%,n%): �tdo(a(),s%,e%,n%): =0
z
�K�+=====================================================================
�K�+==================== Internal Library Routines ======================
�K�+=====================================================================
��+
��+  PROC@tdraw
��+
��+  Draws the Turtle.
��+
���@tdraw
�� xpix%,ypix%
�xpix%=�(_TurtleX+0.5)
�ypix%=�(_TurtleY+0.5)
�	� 4,0
M� xpix%+_TWing*� � (_TurtleAngle+225),ypix%+_TWing*� � (_TurtleAngle+225)
C� xpix%+_THalf%*� � _TurtleAngle,ypix%+_THalf%*� � _TurtleAngle
M� xpix%+_TWing*� � (_TurtleAngle+135),ypix%+_TWing*� � (_TurtleAngle+135)
$� xpix%,ypix%
.� _TurtleWatchOn% � _C%=�
8 � _TurtleFPlot%,_TurtleFCol%
B�
L
VK�+=====================================================================
`�+
j�+  PROC@terror
t�+
~3�+  Issues an untrappable error when necessary.
��+
���@terror(n%,errproc$)
�
� prefix$
�6prefix$="Fatal error in TurtleGRFX: PROC"+errproc$
�Ȏ n% �
�� 0
�$   � 0,prefix$+" - called twice"
�� 1
�1   � 0,prefix$+" - no Turtle-stack allocated"
�� 2
�1   � 0,prefix$+" - out of Turtle-stack range"
�� 3
;   � 0,prefix$+" - user array is not Turtle-stack form"

� 4
/   � 0,prefix$+" - out of user array range"
� 5
(6   � 0,prefix$+" - out of plot action range (0-7)"
2�
<�
F
PK�+=====================================================================
ZK�+==================== Turtle Interpreter =============================
dK�+=====================================================================
n�+
x�+  PROCtrun
��+
�C�+     This procedure should be called from the BASIC prompt to
�@�+  initiate direct keyboard control of the Turtle. PROCtrun
�F�+  executes PROCtstart and PROCtshow to start the Turtle and make
�G�+  it visible, then issues the prompt "t?". You may then enter any
�F�+  string s$ such that "PROCt"+s$ evaluates to a valid TurtleGRFX
�G�+  procedure call, and this call will be executed. The "t?" prompt
�G�+  continues to be issued until a null string is entered, at which
�4�+  point the procedure terminates. For example:
��+
�?�+     t?turn(90)<ENTER>          (turns Turtle 90 degrees)
�A�+     t?tgo(100)<ENTER>          (advances Turtle 100 units)
�8�+     t?<ENTER>                  (returns to BASIC)
�+

��trun
� dummy%
"�tstart
,
�tshow
6�� "t",com$
@ȕ com$>""
J   dummy%=�("FNt"+com$)
T   �� "t",com$
^�
h�
r
|K�+=====================================================================
�K�+==================== Make Help files ================================
�K�+=====================================================================
��+
��+  PROC@help
��+
�F�+  The procedure creates compact help files and a compact working
�F�+  version of the library. Select your TurtleGRFX directory, then
�B�+  enter BASIC and load TurtleGRFX. Type "PROC@help" from the
�A�+  BASIC prompt. This will create the following files on the
��+  current directory:
��+
�G�+  TGRFXRun.......Working version of the library without comments.
�9�+  TGRFXHelpA.....Compact help file in ASCII format.
 9�+  TGRFXHelpB.....Compact help file in BASIC format.
 .�+  DeleteMe.......Transient command file.
 �+
 &A�+  The help files contain the procedure call formats for all
 01�+  the routines and the associated comments.
 :�+
 D��@help
 N� channel%
 Xchannel%=�("DeleteMe")
 b�#channel%
 l*SETTYPE DeleteMe COMMAND
 vchannel%=�("DeleteMe")
 ��#channel%,"LISTO %01000"
 �!�#channel%,"*SPOOL TGRFXHelp"
 ��#channel%,"LIST IFREM+"
 ��#channel%,"*SPOOL"
 �!�#channel%,"*SPOOL TGRFXRunA"
 ��#channel%,"LIST"
 ��#channel%,"*SPOOL"
 ��#channel%,"NEW"
 �D�#channel%,"10  PROCCleanUp(""TGRFXRunA"",""TGRFXRun"",""REM"")"
 �G�#channel%,"20  PROCCleanUp(""TGRFXHelp"",""TGRFXHelpA"",""REM>"")"
 ��#channel%,"30  END"
 �8�#channel%,"40  DEFPROCCleanUp(infile$,outfile$,s$)"
 ��#channel%,"50  l%=LEN(s$)"
!(�#channel%,"60  in%=OPENIN(infile$)"
!+�#channel%,"70  out%=OPENOUT(outfile$)"
!&�#channel%,"80  WHILE NOT EOF#in%"
! #�#channel%,"90  line$=GET$#in%"
!*!�#channel%,"100 CASE TRUE OF"
!4$�#channel%,"110 WHEN line$="""""
!>,�#channel%,"120 WHEN LEFT$(line$,l%)=s$"
!H2�#channel%,"130 WHEN LEFT$(line$,5)="">LIST"""
!R4�#channel%,"140 WHEN LEFT$(line$,7)="">*SPOOL"""
!\�#channel%,"150 OTHERWISE"
!f$�#channel%,"160 BPUT#out%,line$"
!p�#channel%,"170 ENDCASE"
!z�#channel%,"180 ENDWHILE"
!�*�#channel%,"190 CLOSE#in%: CLOSE#out%"
!��#channel%,"200 ENDPROC"
!��#channel%,"RUN"
!��#channel%,"QUIT"
!�"�#channel%,"*DELETE TGRFXHelp"
!�)�#channel%,"*SETTYPE TGRFXHelpA TEXT"
!�(�#channel%,"*BASIC -load TGRFXHelpA"
!�$�#channel%,"SAVE ""TGRFXHelpB"""
!��#channel%,"QUIT"
!�"�#channel%,"*DELETE TGRFXRunA"
!�&�#channel%,"*BASIC -load TGRFXRun"
!�"�#channel%,"SAVE ""TGRFXRun"""
!��#channel%,"QUIT"
"�#channel%,"|"
";�#channel%,"| Help files created on current directory."
"D�#channel%,"| ASCII help = TGRFXHelpA, BASIC help = TGRFXHelpB."
"$�#channel%,"|"
".H�#channel%,"| Runtime version TGRFXRun created on current directory"
"8�#channel%
"B
*DeleteMe
"L�
"V
"`K�+=====================================================================
"jK�+============================ END ====================================
�
00000000  0d 00 0a 10 f4 3e 54 75  72 74 6c 65 47 52 46 58  |.....>TurtleGRFX|
00000010  0d 00 14 04 0d 00 1e 2d  f4 20 20 20 50 72 6f 67  |.......-.   Prog|
00000020  72 61 6d 3a 20 54 75 72  74 6c 65 47 52 46 58 20  |ram: TurtleGRFX |
00000030  76 32 2e 30 31 20 31 30  2d 4d 61 72 2d 31 39 39  |v2.01 10-Mar-199|
00000040  31 0d 00 28 2f f4 20 20  20 41 75 74 68 6f 72 3a  |1..(/.   Author:|
00000050  20 20 43 6f 70 79 72 69  67 68 74 20 28 43 29 20  |  Copyright (C) |
00000060  49 2e 4d 2e 4b 69 6e 67  68 61 6e 20 31 39 39 31  |I.M.Kinghan 1991|
00000070  0d 00 32 36 f4 20 20 20  50 75 72 70 6f 73 65 3a  |..26.   Purpose:|
00000080  20 54 75 72 74 6c 65 20  47 72 61 70 68 69 63 73  | Turtle Graphics|
00000090  20 6c 69 62 72 61 72 79  20 66 6f 72 20 42 42 43  | library for BBC|
000000a0  20 42 41 53 49 43 0d 00  3c 04 0d 00 46 1a f4 20  | BASIC..<...F.. |
000000b0  20 20 43 6f 72 72 65 73  70 6f 6e 64 65 6e 63 65  |  Correspondence|
000000c0  20 74 6f 3a 0d 00 50 15  f4 20 20 20 4d 69 6b 65  | to:..P..   Mike|
000000d0  20 4b 69 6e 67 68 61 6e  2c 0d 00 5a 1a f4 20 20  | Kinghan,..Z..  |
000000e0  20 31 34 39 20 43 61 6d  70 62 65 6c 6c 20 52 6f  | 149 Campbell Ro|
000000f0  61 64 2c 0d 00 64 0f f4  20 20 20 43 6f 77 6c 65  |ad,..d..   Cowle|
00000100  79 2c 0d 00 6e 16 f4 20  20 20 4f 78 66 6f 72 64  |y,..n..   Oxford|
00000110  20 4f 58 34 20 33 4e 58  0d 00 78 04 0d 00 82 4b  | OX4 3NX..x....K|
00000120  f4 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.===============|
00000130  3d 3d 3d 3d 3d 20 53 79  6e 6f 70 73 69 73 20 3d  |===== Synopsis =|
00000140  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00000160  3d 3d 3d 3d 3d 3d 3d 0d  00 8c 04 0d 00 96 3e f4  |=======.......>.|
00000170  20 20 20 20 20 20 54 68  65 20 72 6f 75 74 69 6e  |      The routin|
00000180  65 73 20 69 6e 20 74 68  69 73 20 6c 69 62 72 61  |es in this libra|
00000190  72 79 20 61 72 65 20 74  6f 6f 6c 73 20 66 6f 72  |ry are tools for|
000001a0  20 63 72 65 61 74 69 6e  67 0d 00 a0 3d f4 20 20  | creating...=.  |
000001b0  20 67 72 61 70 68 69 63  73 20 70 72 6f 67 72 61  | graphics progra|
000001c0  6d 73 20 69 6e 20 74 68  65 20 73 74 79 6c 65 20  |ms in the style |
000001d0  6f 72 69 67 69 6e 61 74  65 64 20 62 79 20 74 68  |originated by th|
000001e0  65 20 4c 6f 67 6f 0d 00  aa 41 f4 20 20 20 6c 61  |e Logo...A.   la|
000001f0  6e 67 75 61 67 65 2e 20  53 68 61 70 65 73 20 6d  |nguage. Shapes m|
00000200  61 79 20 67 65 6e 65 72  61 74 65 64 20 62 79 20  |ay generated by |
00000210  69 73 73 75 69 6e 67 20  64 69 72 65 63 74 69 6f  |issuing directio|
00000220  6e 73 20 74 6f 20 61 0d  00 b4 3f f4 20 20 20 64  |ns to a...?.   d|
00000230  72 61 77 69 6e 67 20 61  67 65 6e 74 20 63 61 6c  |rawing agent cal|
00000240  6c 65 64 20 22 74 68 65  20 54 75 72 74 6c 65 22  |led "the Turtle"|
00000250  2e 20 54 68 65 20 72 6f  75 74 69 6e 65 73 20 70  |. The routines p|
00000260  72 6f 76 69 64 65 0d 00  be 44 f4 20 20 20 74 68  |rovide...D.   th|
00000270  65 20 76 6f 63 61 62 75  6c 61 72 79 20 6f 66 20  |e vocabulary of |
00000280  64 69 72 65 63 74 69 76  65 73 2e 20 53 68 61 70  |directives. Shap|
00000290  65 73 20 6f 66 20 72 65  6d 61 72 6b 61 62 6c 65  |es of remarkable|
000002a0  20 69 6e 74 72 69 63 61  63 79 0d 00 c8 43 f4 20  | intricacy...C. |
000002b0  20 20 61 6e 64 20 62 65  61 75 74 79 2c 20 69 6e  |  and beauty, in|
000002c0  63 6c 75 64 69 6e 67 20  66 72 61 63 74 61 6c 73  |cluding fractals|
000002d0  2c 20 63 61 6e 20 62 65  20 63 72 65 61 74 65 64  |, can be created|
000002e0  20 62 79 20 72 65 63 75  72 73 69 76 65 0d 00 d2  | by recursive...|
000002f0  11 f4 20 20 20 72 6f 75  74 69 6e 65 73 2e 0d 00  |..   routines...|
00000300  dc 04 0d 00 e6 41 f4 20  20 20 20 20 20 54 68 65  |.....A.      The|
00000310  20 72 6f 75 74 69 6e 65  73 20 64 6f 20 6e 6f 74  | routines do not|
00000320  20 66 61 69 74 68 66 75  6c 6c 79 20 6d 69 6d 69  | faithfully mimi|
00000330  63 20 74 68 6f 73 65 20  6f 66 20 74 68 65 20 4c  |c those of the L|
00000340  6f 67 6f 0d 00 f0 46 f4  20 20 20 6c 61 6e 67 75  |ogo...F.   langu|
00000350  61 67 65 2c 20 62 75 74  20 70 72 6f 76 69 64 65  |age, but provide|
00000360  20 61 20 66 75 6c 6c 65  72 20 61 6e 64 20 6d 6f  | a fuller and mo|
00000370  72 65 20 70 6f 77 65 72  66 75 6c 20 73 65 74 20  |re powerful set |
00000380  6f 66 20 74 6f 6f 6c 73  2e 0d 00 fa 43 f4 20 20  |of tools....C.  |
00000390  20 49 6e 20 70 61 72 74  69 63 75 6c 61 72 2c 20  | In particular, |
000003a0  61 20 6e 75 6d 62 65 72  20 6f 72 20 70 72 6f 63  |a number or proc|
000003b0  65 64 75 72 65 73 20 61  72 65 20 70 72 6f 76 69  |edures are provi|
000003c0  64 65 64 20 66 6f 72 20  72 65 63 2d 0d 01 04 46  |ded for rec-...F|
000003d0  f4 20 20 20 6f 72 64 69  6e 67 20 61 6e 64 20 73  |.   ording and s|
000003e0  61 76 69 6e 67 20 73 68  61 70 65 73 20 67 65 6e  |aving shapes gen|
000003f0  65 72 61 74 65 64 20 62  79 20 74 68 65 20 54 75  |erated by the Tu|
00000400  72 74 6c 65 2c 20 73 6f  20 74 68 61 74 20 74 68  |rtle, so that th|
00000410  65 79 0d 01 0e 47 f4 20  20 20 6d 61 79 20 62 65  |ey...G.   may be|
00000420  20 72 65 70 72 6f 64 75  63 65 64 20 6d 6f 72 65  | reproduced more|
00000430  20 71 75 69 63 6b 6c 79  20 61 6e 64 20 65 63 6f  | quickly and eco|
00000440  6e 6f 6d 69 63 61 6c 6c  79 20 74 68 61 6e 20 74  |nomically than t|
00000450  68 65 79 20 63 6f 75 6c  64 0d 01 18 46 f4 20 20  |hey could...F.  |
00000460  20 62 65 20 72 65 63 72  65 61 74 65 64 2c 20 61  | be recreated, a|
00000470  6e 64 20 73 6f 20 74 68  61 74 20 74 68 65 79 20  |nd so that they |
00000480  63 61 6e 20 65 61 73 69  6c 79 20 62 65 20 74 72  |can easily be tr|
00000490  61 6e 73 66 6f 72 6d 65  64 20 75 73 69 6e 67 0d  |ansformed using.|
000004a0  01 22 1c f4 20 20 20 61  20 73 74 6f 72 65 64 20  |."..   a stored |
000004b0  22 74 65 6d 70 6c 61 74  65 22 2e 0d 01 2c 04 0d  |"template"...,..|
000004c0  01 36 36 f4 20 20 20 20  20 20 54 68 65 20 72 6f  |.66.      The ro|
000004d0  75 74 69 6e 65 73 20 61  72 65 20 70 72 65 73 65  |utines are prese|
000004e0  6e 74 65 64 20 69 6e 20  66 69 76 65 20 63 6c 61  |nted in five cla|
000004f0  73 73 65 73 3a 0d 01 40  04 0d 01 4a 3f f4 20 20  |sses:..@...J?.  |
00000500  20 31 2e 20 54 75 72 74  6c 65 20 44 69 73 70 6f  | 1. Turtle Dispo|
00000510  73 69 74 69 6f 6e 20 52  6f 75 74 69 6e 65 73 20  |sition Routines |
00000520  2d 20 72 65 6c 61 74 65  64 20 74 6f 20 77 68 65  |- related to whe|
00000530  74 68 65 72 20 74 68 65  0d 01 54 42 f4 20 20 20  |ther the..TB.   |
00000540  20 20 20 54 75 72 74 6c  65 20 69 73 20 76 69 73  |   Turtle is vis|
00000550  69 62 6c 65 20 6f 72 20  6e 6f 74 2c 20 69 74 73  |ible or not, its|
00000560  20 70 65 6e 20 61 63 74  69 6f 6e 2c 20 61 6e 64  | pen action, and|
00000570  20 74 68 65 20 6c 69 6b  65 2e 0d 01 5e 04 0d 01  | the like...^...|
00000580  68 41 f4 20 20 20 32 2e  20 54 75 72 74 6c 65 20  |hA.   2. Turtle |
00000590  41 63 74 69 6f 6e 20 52  6f 75 74 69 6e 65 73 20  |Action Routines |
000005a0  2d 20 72 65 6c 61 74 65  64 20 74 6f 20 6d 6f 76  |- related to mov|
000005b0  69 6e 67 20 74 68 65 20  54 75 72 74 6c 65 2e 0d  |ing the Turtle..|
000005c0  01 72 04 0d 01 7c 46 f4  20 20 20 33 2e 20 54 75  |.r...|F.   3. Tu|
000005d0  72 74 6c 65 2d 73 74 61  63 6b 20 52 6f 75 74 69  |rtle-stack Routi|
000005e0  6e 65 73 20 2d 20 72 65  6c 61 74 65 64 20 74 6f  |nes - related to|
000005f0  20 72 65 63 6f 72 64 69  6e 67 20 54 75 72 74 6c  | recording Turtl|
00000600  65 2d 73 74 61 74 65 73  2e 0d 01 86 04 0d 01 90  |e-states........|
00000610  43 f4 20 20 20 34 2e 20  53 74 6f 72 65 64 20 54  |C.   4. Stored T|
00000620  75 72 74 6c 65 2d 73 74  61 74 65 20 52 6f 75 74  |urtle-state Rout|
00000630  69 6e 65 73 20 2d 20 72  65 6c 61 74 65 64 20 74  |ines - related t|
00000640  6f 20 72 65 74 72 69 65  76 69 6e 67 20 61 6e 64  |o retrieving and|
00000650  0d 01 9a 2d f4 20 20 20  20 20 20 6d 61 6e 69 70  |...-.      manip|
00000660  75 6c 61 74 69 6e 67 20  73 74 6f 72 65 64 20 54  |ulating stored T|
00000670  75 72 74 6c 65 2d 73 74  61 74 65 73 2e 0d 01 a4  |urtle-states....|
00000680  04 0d 01 ae 49 f4 20 20  20 35 2e 20 49 6e 74 65  |....I.   5. Inte|
00000690  72 6e 61 6c 20 4c 69 62  72 61 72 79 20 52 6f 75  |rnal Library Rou|
000006a0  74 69 6e 65 73 20 2d 20  6e 6f 74 20 72 65 63 6f  |tines - not reco|
000006b0  6d 6d 65 6e 64 65 64 20  66 6f 72 20 75 73 65 72  |mmended for user|
000006c0  20 70 72 6f 67 72 61 6d  73 2e 0d 01 b8 04 0d 01  | programs.......|
000006d0  c2 44 f4 20 20 20 20 20  20 49 6e 20 61 64 64 69  |.D.      In addi|
000006e0  74 69 6f 6e 2c 20 74 68  65 20 6c 69 62 72 61 72  |tion, the librar|
000006f0  79 20 73 75 70 70 6f 72  74 73 20 64 69 72 65 63  |y supports direc|
00000700  74 20 6b 65 79 62 6f 61  72 64 20 63 6f 6e 74 72  |t keyboard contr|
00000710  6f 6c 0d 01 cc 49 f4 20  20 20 6f 66 20 74 68 65  |ol...I.   of the|
00000720  20 54 75 72 74 6c 65 20  76 69 61 20 63 6f 6d 6d  | Turtle via comm|
00000730  61 6e 64 73 20 63 6f 72  72 65 73 70 6f 6e 64 69  |ands correspondi|
00000740  6e 67 20 74 6f 20 74 68  65 20 6c 69 62 72 61 72  |ng to the librar|
00000750  79 20 72 6f 75 74 69 6e  65 73 2e 0d 01 d6 15 f4  |y routines......|
00000760  20 20 20 53 65 65 20 50  52 4f 43 74 72 75 6e 2e  |   See PROCtrun.|
00000770  0d 01 e0 04 0d 01 ea 4b  f4 3d 3d 3d 3d 3d 3d 3d  |.......K.=======|
00000780  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 20 49 6d 70 6f  |=========== Impo|
00000790  72 74 61 6e 74 20 4e 6f  74 65 73 20 3d 3d 3d 3d  |rtant Notes ====|
000007a0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
000007b0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 0d  |===============.|
000007c0  01 f4 04 0d 01 fe 47 f4  20 20 20 2a 20 20 54 68  |......G.   *  Th|
000007d0  65 20 6c 69 62 72 61 72  79 20 63 6f 6e 74 61 69  |e library contai|
000007e0  6e 73 20 61 6c 6c 20 6f  66 20 69 74 73 20 6f 77  |ns all of its ow|
000007f0  6e 20 64 6f 63 75 6d 65  6e 74 61 74 69 6f 6e 2e  |n documentation.|
00000800  20 54 68 65 20 67 69 76  65 73 0d 02 08 45 f4 20  | The gives...E. |
00000810  20 20 73 65 63 75 72 65  20 76 65 72 73 69 6f 6e  |  secure version|
00000820  20 63 6f 6e 74 72 6f 6c  20 62 75 74 20 68 61 73  | control but has|
00000830  20 64 72 61 77 62 61 63  6b 73 2e 20 57 68 65 6e  | drawbacks. When|
00000840  20 74 68 65 20 6c 69 62  72 61 72 79 20 69 73 0d  | the library is.|
00000850  02 12 47 f4 20 20 20 69  73 20 6c 6f 61 64 65 64  |..G.   is loaded|
00000860  20 69 74 73 20 69 6e 74  65 72 6e 61 6c 20 64 6f  | its internal do|
00000870  63 75 6d 65 6e 74 61 74  69 6f 6e 20 6f 63 63 75  |cumentation occu|
00000880  70 69 65 73 20 61 20 6c  61 72 67 65 20 61 6d 6f  |pies a large amo|
00000890  75 6e 74 20 6f 66 0d 02  1c 45 f4 20 20 20 6d 65  |unt of...E.   me|
000008a0  6d 6f 72 79 2e 20 57 68  65 6e 20 74 68 65 20 64  |mory. When the d|
000008b0  6f 63 75 6d 65 6e 74 61  74 69 6f 6e 20 69 73 20  |ocumentation is |
000008c0  63 6f 6e 73 75 6c 74 65  64 2c 20 69 74 20 69 73  |consulted, it is|
000008d0  20 66 72 61 67 6d 65 6e  74 65 64 0d 02 26 47 f4  | fragmented..&G.|
000008e0  20 20 20 62 79 20 74 68  65 20 73 6f 75 72 63 65  |   by the source|
000008f0  20 63 6f 64 65 2e 20 41  20 70 72 6f 63 65 64 75  | code. A procedu|
00000900  72 65 20 50 52 4f 43 40  68 65 6c 70 20 69 73 20  |re PROC@help is |
00000910  70 72 6f 76 69 64 65 64  20 74 6f 20 72 65 6d 6f  |provided to remo|
00000920  76 65 0d 02 30 47 f4 20  20 20 74 68 65 73 65 20  |ve..0G.   these |
00000930  6e 75 69 73 61 6e 63 65  73 20 62 79 20 63 72 65  |nuisances by cre|
00000940  61 74 69 6e 67 20 63 6f  6d 70 61 63 74 20 68 65  |ating compact he|
00000950  6c 70 20 66 69 6c 65 73  20 77 69 74 68 20 73 6f  |lp files with so|
00000960  75 72 63 65 20 63 6f 64  65 0d 02 3a 46 f4 20 20  |urce code..:F.  |
00000970  20 73 74 72 69 70 70 65  64 20 6f 75 74 20 61 6e  | stripped out an|
00000980  64 20 61 20 63 6f 6d 70  61 63 74 20 77 6f 72 6b  |d a compact work|
00000990  69 6e 67 20 76 65 72 73  69 6f 6e 20 6f 66 20 74  |ing version of t|
000009a0  68 65 20 6c 69 62 72 61  72 79 20 77 69 74 68 0d  |he library with.|
000009b0  02 44 43 f4 20 20 20 63  6f 6d 6d 65 6e 74 73 20  |.DC.   comments |
000009c0  73 74 72 69 70 70 65 64  20 6f 75 74 2e 20 46 69  |stripped out. Fi|
000009d0  6e 64 20 50 52 4f 43 40  68 65 6c 70 20 62 65 6c  |nd PROC@help bel|
000009e0  6f 77 20 61 6e 64 20 63  6f 6e 73 75 6c 74 20 74  |ow and consult t|
000009f0  68 65 0d 02 4e 47 f4 20  20 20 6e 6f 74 65 73 20  |he..NG.   notes |
00000a00  77 68 69 63 68 20 61 63  63 6f 6d 70 61 6e 79 20  |which accompany |
00000a10  69 74 2e 20 4e 2e 42 2e  20 50 52 4f 43 40 68 65  |it. N.B. PROC@he|
00000a20  6c 70 20 69 73 20 6c 69  61 62 6c 65 20 74 6f 20  |lp is liable to |
00000a30  62 65 20 68 61 72 6d 65  64 0d 02 58 46 f4 20 20  |be harmed..XF.  |
00000a40  20 62 79 20 61 6e 79 20  65 64 69 74 69 6e 67 20  | by any editing |
00000a50  6f 66 20 74 68 69 73 20  73 6f 75 72 63 65 20 66  |of this source f|
00000a60  69 6c 65 3a 20 69 6e 20  70 61 72 74 69 63 75 6c  |ile: in particul|
00000a70  61 72 20 69 74 20 6d 61  6b 65 73 20 75 73 65 0d  |ar it makes use.|
00000a80  02 62 2f f4 20 20 20 6f  66 20 74 68 65 20 73 74  |.b/.   of the st|
00000a90  72 69 6e 67 73 20 22 52  45 4d 22 2c 22 52 45 4d  |rings "REM","REM|
00000aa0  3e 22 20 61 6e 64 20 22  52 45 4d 2b 22 2e 0d 02  |>" and "REM+"...|
00000ab0  6c 04 0d 02 76 40 f4 20  20 20 2a 20 20 54 68 65  |l...v@.   *  The|
00000ac0  20 54 75 72 74 6c 65 20  6d 75 73 74 20 62 65 20  | Turtle must be |
00000ad0  69 6e 69 74 69 61 6c 69  73 65 64 20 62 79 20 63  |initialised by c|
00000ae0  61 6c 6c 69 6e 67 20 20  50 52 4f 43 74 73 74 61  |alling  PROCtsta|
00000af0  72 74 0d 02 80 31 f4 20  20 20 62 65 66 6f 72 65  |rt...1.   before|
00000b00  20 61 6e 79 20 6f 66 20  74 68 65 20 6f 74 68 65  | any of the othe|
00000b10  72 20 6c 69 62 72 61 72  79 20 72 6f 75 74 69 6e  |r library routin|
00000b20  65 73 2e 0d 02 8a 04 0d  02 94 3c f4 20 20 20 2a  |es........<.   *|
00000b30  20 20 54 68 65 20 6c 69  62 72 61 72 79 20 72 65  |  The library re|
00000b40  73 65 72 76 65 73 20 61  6c 6c 20 76 61 72 69 61  |serves all varia|
00000b50  62 6c 65 20 6e 61 6d 65  73 20 62 65 67 69 6e 6e  |ble names beginn|
00000b60  69 6e 67 0d 02 9e 3f f4  20 20 20 77 69 74 68 20  |ing...?.   with |
00000b70  22 5f 22 20 66 6f 6c 6c  6f 77 65 64 20 62 79 20  |"_" followed by |
00000b80  61 20 63 61 70 69 74 61  6c 20 6c 65 74 74 65 72  |a capital letter|
00000b90  2e 20 49 74 20 69 73 20  75 73 65 66 75 6c 20 66  |. It is useful f|
00000ba0  6f 72 0d 02 a8 3e f4 20  20 20 70 72 6f 67 72 61  |or...>.   progra|
00000bb0  6d 73 20 74 6f 20 69 6e  74 65 72 72 6f 67 61 74  |ms to interrogat|
00000bc0  65 20 73 6f 6d 65 20 6f  66 20 74 68 65 20 6c 69  |e some of the li|
00000bd0  62 72 61 72 79 20 76 61  72 69 61 62 6c 65 73 2c  |brary variables,|
00000be0  0d 02 b2 2b f4 20 20 20  62 75 74 20 6e 6f 6e 65  |...+.   but none|
00000bf0  20 6f 66 20 74 68 65 6d  20 6d 61 79 20 62 65 20  | of them may be |
00000c00  77 72 69 74 74 65 6e 20  74 6f 2e 0d 02 bc 04 0d  |written to......|
00000c10  02 c6 3e f4 20 20 20 2a  20 20 54 6f 20 66 75 6e  |..>.   *  To fun|
00000c20  63 74 69 6f 6e 20 63 6f  72 72 65 63 74 6c 79 20  |ction correctly |
00000c30  74 68 65 20 54 75 72 74  6c 65 20 6e 65 65 64 73  |the Turtle needs|
00000c40  20 74 6f 20 6b 6e 6f 77  20 77 68 61 74 0d 02 d0  | to know what...|
00000c50  40 f4 20 20 20 67 72 61  70 68 69 63 73 20 70 6c  |@.   graphics pl|
00000c60  6f 74 20 61 63 74 69 6f  6e 73 20 61 6e 64 20 63  |ot actions and c|
00000c70  6f 6c 6f 75 72 73 20 79  6f 75 20 73 65 6c 65 63  |olours you selec|
00000c80  74 2e 20 54 6f 20 70 72  6f 76 69 64 65 0d 02 da  |t. To provide...|
00000c90  41 f4 20 20 20 74 68 65  20 54 75 72 74 6c 65 20  |A.   the Turtle |
00000ca0  77 69 74 68 20 74 68 69  73 20 69 6e 66 6f 72 6d  |with this inform|
00000cb0  61 74 69 6f 6e 2c 20 79  6f 75 20 6d 75 73 74 20  |ation, you must |
00000cc0  61 6c 77 61 79 73 20 75  73 65 20 74 68 65 0d 02  |always use the..|
00000cd0  e4 43 f4 20 20 20 6c 69  62 72 61 72 79 20 72 6f  |.C.   library ro|
00000ce0  75 74 69 6e 65 20 20 50  52 4f 43 74 67 63 6f 6c  |utine  PROCtgcol|
00000cf0  28 61 63 74 69 6f 6e 25  2c 63 6f 6c 6f 75 72 25  |(action%,colour%|
00000d00  29 20 20 69 6e 73 74 65  61 64 20 6f 66 20 74 68  |)  instead of th|
00000d10  65 0d 02 ee 2d f4 20 20  20 42 41 53 49 43 20 63  |e...-.   BASIC c|
00000d20  6f 6d 6d 61 6e 64 20 20  47 43 4f 4c 28 61 63 74  |ommand  GCOL(act|
00000d30  69 6f 6e 25 2c 63 6f 6c  6f 75 72 25 29 2e 0d 02  |ion%,colour%)...|
00000d40  f8 04 0d 03 02 48 f4 20  20 20 2a 20 20 54 68 65  |.....H.   *  The|
00000d50  20 54 75 72 74 6c 65 27  73 20 70 6f 73 69 74 69  | Turtle's positi|
00000d60  6f 6e 20 69 73 20 67 69  76 65 6e 20 69 6e 20 42  |on is given in B|
00000d70  41 53 49 43 20 67 72 61  70 68 69 63 73 20 63 6f  |ASIC graphics co|
00000d80  6f 72 64 69 6e 61 74 65  73 3b 0d 03 0c 42 f4 20  |ordinates;...B. |
00000d90  20 20 69 74 73 20 6f 72  69 65 6e 74 61 74 69 6f  |  its orientatio|
00000da0  6e 20 69 73 20 67 69 76  65 6e 20 69 6e 20 64 65  |n is given in de|
00000db0  67 72 65 65 73 20 63 6c  6f 63 6b 77 69 73 65 20  |grees clockwise |
00000dc0  6f 66 20 64 75 65 20 4e  6f 72 74 68 0d 03 16 42  |of due North...B|
00000dd0  f4 20 20 20 69 2e 65 2e  20 74 68 65 20 64 69 72  |.   i.e. the dir|
00000de0  65 63 74 69 6f 6e 20 6f  66 20 69 6e 63 72 65 61  |ection of increa|
00000df0  73 69 6e 67 20 76 65 72  74 69 63 61 6c 20 63 6f  |sing vertical co|
00000e00  6f 72 64 69 6e 61 74 65  73 2e 20 54 68 65 0d 03  |ordinates. The..|
00000e10  20 43 f4 20 20 20 70 6f  73 69 74 69 6f 6e 20 63  | C.   position c|
00000e20  61 6e 20 62 65 20 72 65  61 64 20 62 79 20 69 6e  |an be read by in|
00000e30  74 65 72 72 6f 67 61 74  69 6e 67 20 74 68 65 20  |terrogating the |
00000e40  6c 69 62 72 61 72 79 20  76 61 72 69 61 62 6c 65  |library variable|
00000e50  73 0d 03 2a 46 f4 20 20  20 5f 54 75 72 74 6c 65  |s..*F.   _Turtle|
00000e60  58 20 28 68 6f 72 69 7a  6f 6e 74 61 6c 29 20 61  |X (horizontal) a|
00000e70  6e 64 20 5f 54 75 72 74  6c 65 59 20 28 76 65 72  |nd _TurtleY (ver|
00000e80  74 69 63 61 6c 29 2e 20  54 68 65 20 6f 72 69 65  |tical). The orie|
00000e90  6e 74 61 74 69 6f 6e 0d  03 34 3b f4 20 20 20 63  |ntation..4;.   c|
00000ea0  61 6e 20 62 65 20 72 65  61 64 20 66 72 6f 6d 20  |an be read from |
00000eb0  74 68 65 20 6c 69 62 72  61 72 79 20 76 61 72 69  |the library vari|
00000ec0  61 62 6c 65 20 5f 54 75  72 74 6c 65 41 6e 67 6c  |able _TurtleAngl|
00000ed0  65 2e 0d 03 3e 04 0d 03  48 41 f4 20 20 20 2a 20  |e...>...HA.   * |
00000ee0  20 57 68 65 6e 20 74 68  65 20 54 75 72 74 6c 65  | When the Turtle|
00000ef0  2d 73 74 61 63 6b 20 69  73 20 69 6e 20 75 73 65  |-stack is in use|
00000f00  20 74 6f 20 72 65 63 6f  72 64 20 74 68 65 20 54  | to record the T|
00000f10  75 72 74 6c 65 27 73 0d  03 52 40 f4 20 20 20 70  |urtle's..R@.   p|
00000f20  6f 73 69 74 69 6f 6e 73  20 61 6e 64 20 6f 72 69  |ositions and ori|
00000f30  65 6e 74 61 74 69 6f 6e  73 2c 20 74 68 65 20 73  |entations, the s|
00000f40  74 61 63 6b 20 70 6f 69  6e 74 65 72 20 69 73 20  |tack pointer is |
00000f50  68 65 6c 64 20 69 6e 0d  03 5c 43 f4 20 20 20 74  |held in..\C.   t|
00000f60  68 65 20 6c 69 62 72 61  72 79 20 76 61 72 69 61  |he library varia|
00000f70  62 6c 65 20 5f 54 75 72  74 6c 65 47 65 6e 25 2c  |ble _TurtleGen%,|
00000f80  20 77 68 69 63 68 20 6d  61 79 20 62 65 20 72 65  | which may be re|
00000f90  61 64 20 74 6f 20 66 69  6e 64 0d 03 66 22 f4 20  |ad to find..f". |
00000fa0  20 20 74 68 65 20 63 75  72 72 65 6e 74 20 73 74  |  the current st|
00000fb0  61 63 6b 2d 70 6f 69 6e  74 65 72 2e 0d 03 70 04  |ack-pointer...p.|
00000fc0  0d 03 7a 45 f4 20 20 20  2a 20 20 52 6f 75 74 69  |..zE.   *  Routi|
00000fd0  6e 65 73 20 77 69 74 68  20 6e 61 6d 65 73 20 62  |nes with names b|
00000fe0  65 67 69 6e 6e 69 6e 67  20 22 40 22 20 61 72 65  |eginning "@" are|
00000ff0  20 63 61 6c 6c 65 64 20  69 6e 74 65 72 6e 61 6c  | called internal|
00001000  6c 79 20 62 65 0d 03 84  41 f4 20 20 20 74 68 65  |ly be...A.   the|
00001010  20 6c 69 62 72 61 72 79  20 61 6e 64 20 61 72 65  | library and are|
00001020  20 6e 6f 74 20 72 65 63  6f 6d 6d 65 6e 64 65 64  | not recommended|
00001030  20 66 6f 72 20 70 72 6f  67 72 61 6d 6d 65 72 73  | for programmers|
00001040  27 20 75 73 65 2e 0d 03  8e 04 0d 03 98 44 f4 20  |' use........D. |
00001050  20 20 2a 20 20 54 75 72  74 6c 65 20 61 63 74 69  |  *  Turtle acti|
00001060  6f 6e 73 20 61 72 65 20  63 6f 6e 73 69 64 65 72  |ons are consider|
00001070  61 62 6c 79 20 73 6c 6f  77 65 72 20 77 68 65 6e  |ably slower when|
00001080  20 74 68 65 20 54 75 72  74 6c 65 20 69 73 0d 03  | the Turtle is..|
00001090  a2 41 f4 20 20 20 76 69  73 69 62 6c 65 20 74 68  |.A.   visible th|
000010a0  61 6e 20 77 68 65 6e 20  69 74 20 69 73 20 69 6e  |an when it is in|
000010b0  76 69 73 69 62 6c 65 2c  20 64 75 65 20 74 6f 20  |visible, due to |
000010c0  74 68 65 20 6f 76 65 72  68 65 61 64 20 6f 66 0d  |the overhead of.|
000010d0  03 ac 43 f4 20 20 20 65  72 61 73 69 6e 67 20 61  |..C.   erasing a|
000010e0  6e 64 20 72 65 64 72 61  77 69 6e 67 20 74 68 65  |nd redrawing the|
000010f0  20 54 75 72 74 6c 65 20  66 72 6f 6d 20 70 6c 61  | Turtle from pla|
00001100  63 65 20 74 6f 20 70 6c  61 63 65 2e 20 49 74 20  |ce to place. It |
00001110  69 73 0d 03 b6 45 f4 20  20 20 73 75 67 67 65 73  |is...E.   sugges|
00001120  74 65 64 20 74 68 61 74  20 74 68 65 20 76 69 73  |ted that the vis|
00001130  69 62 6c 65 20 54 75 72  74 6c 65 20 62 65 20 75  |ible Turtle be u|
00001140  73 65 64 20 6f 6e 6c 79  20 64 75 72 69 6e 67 20  |sed only during |
00001150  70 72 6f 67 72 61 6d 0d  03 c0 40 f4 20 20 20 64  |program...@.   d|
00001160  65 76 65 6c 6f 70 6d 65  6e 74 20 77 68 65 6e 20  |evelopment when |
00001170  69 74 20 69 73 20 6e 65  63 65 73 73 61 72 79 20  |it is necessary |
00001180  74 6f 20 73 65 65 20 65  78 61 63 74 6c 79 20 77  |to see exactly w|
00001190  68 61 74 20 74 68 65 0d  03 ca 48 f4 20 20 20 54  |hat the...H.   T|
000011a0  75 72 74 6c 65 20 69 73  20 64 6f 69 6e 67 2e 20  |urtle is doing. |
000011b0  54 68 65 20 70 72 6f 63  65 64 75 72 65 73 20 20  |The procedures  |
000011c0  50 52 4f 43 74 77 61 74  63 68 6f 6e 20 20 61 6e  |PROCtwatchon  an|
000011d0  64 20 50 52 4f 43 74 77  61 74 63 68 6f 66 66 0d  |d PROCtwatchoff.|
000011e0  03 d4 27 f4 20 20 20 61  72 65 20 70 72 6f 76 69  |..'.   are provi|
000011f0  64 65 64 20 74 6f 20 61  73 73 69 73 74 20 69 6e  |ded to assist in|
00001200  20 74 68 69 73 2e 0d 03  de 04 0d 03 e8 46 f4 20  | this........F. |
00001210  20 20 2a 20 20 41 6c 6c  20 72 6f 75 74 69 6e 65  |  *  All routine|
00001220  73 20 61 72 65 20 69 6d  70 6c 65 6d 65 6e 74 65  |s are implemente|
00001230  64 20 61 73 20 70 72 6f  63 65 64 75 72 65 73 2e  |d as procedures.|
00001240  20 49 74 20 77 69 6c 6c  20 62 65 20 73 65 65 6e  | It will be seen|
00001250  0d 03 f2 45 f4 20 20 20  74 68 61 74 20 69 6e 20  |...E.   that in |
00001260  61 73 73 6f 63 69 61 74  69 6f 6e 20 77 69 74 68  |association with|
00001270  20 65 61 63 68 20 70 72  6f 63 65 64 75 72 65 20  | each procedure |
00001280  61 20 66 75 6e 63 74 69  6f 6e 20 69 73 20 64 65  |a function is de|
00001290  66 69 6e 65 64 0d 03 fc  4a f4 20 20 20 77 68 69  |fined...J.   whi|
000012a0  63 68 20 73 69 6d 70 6c  79 20 65 78 65 63 75 74  |ch simply execut|
000012b0  65 73 20 74 68 65 20 70  72 6f 63 65 64 75 72 65  |es the procedure|
000012c0  20 61 6e 64 20 72 65 74  75 72 6e 73 20 30 2e 20  | and returns 0. |
000012d0  54 68 65 73 65 20 66 75  6e 63 74 69 6f 6e 73 0d  |These functions.|
000012e0  04 06 46 f4 20 20 20 61  72 65 20 75 73 65 64 20  |..F.   are used |
000012f0  62 79 20 50 52 4f 43 74  72 75 6e 20 74 6f 20 70  |by PROCtrun to p|
00001300  72 6f 76 69 64 65 20 64  69 72 65 63 74 20 6b 65  |rovide direct ke|
00001310  79 62 6f 61 72 64 20 63  6f 6e 74 72 6f 6c 20 6f  |yboard control o|
00001320  66 20 74 68 65 0d 04 10  0f f4 20 20 20 54 75 72  |f the.....   Tur|
00001330  74 6c 65 2e 0d 04 1a 04  0d 04 24 49 f4 3d 3d 3d  |tle.......$I.===|
00001340  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00001350  3d 3d 3d 3d 3d 20 56 65  72 73 69 6f 6e 20 43 6f  |===== Version Co|
00001360  6e 74 72 6f 6c 20 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |ntrol ==========|
00001370  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00001380  3d 0d 04 2e 04 0d 04 38  16 f4 20 76 31 2e 30 30  |=......8.. v1.00|
00001390  20 32 36 2d 4a 61 6e 2d  39 31 3a 0d 04 42 1f f4  | 26-Jan-91:..B..|
000013a0  20 20 20 20 20 20 20 2a  20 4f 72 69 67 69 6e 61  |       * Origina|
000013b0  6c 20 76 65 72 73 69 6f  6e 2e 0d 04 4c 15 f4 20  |l version...L.. |
000013c0  76 32 2e 30 30 20 31 39  2d 46 65 62 2d 39 31 0d  |v2.00 19-Feb-91.|
000013d0  04 56 49 f4 20 20 20 20  20 20 2a 20 4e 65 77 20  |.VI.      * New |
000013e0  70 72 6f 63 65 64 75 72  65 20 50 52 4f 43 74 62  |procedure PROCtb|
000013f0  65 61 72 3a 20 53 65 74  20 74 68 65 20 54 75 72  |ear: Set the Tur|
00001400  74 6c 65 20 6f 6e 20 61  62 73 6f 6c 75 74 65 20  |tle on absolute |
00001410  62 65 61 72 69 6e 67 2e  0d 04 60 40 f4 20 20 20  |bearing...`@.   |
00001420  20 20 20 2a 20 4e 65 77  20 70 72 6f 63 65 64 75  |   * New procedu|
00001430  72 65 20 50 52 4f 43 74  72 75 6e 3a 20 4b 65 79  |re PROCtrun: Key|
00001440  62 6f 61 72 64 20 63 6f  6e 74 72 6f 6c 20 6f 66  |board control of|
00001450  20 74 75 72 74 6c 65 2e  0d 04 6a 44 f4 20 20 20  | turtle...jD.   |
00001460  20 20 20 2a 20 4e 65 77  20 70 72 6f 63 65 64 75  |   * New procedu|
00001470  72 65 20 50 52 4f 43 40  68 65 6c 70 3a 20 63 72  |re PROC@help: cr|
00001480  65 61 74 65 73 20 63 6f  6d 70 61 63 74 20 68 65  |eates compact he|
00001490  6c 70 20 66 69 6c 65 73  20 61 6e 64 0d 04 74 2a  |lp files and..t*|
000014a0  f4 20 20 20 20 20 20 63  6f 6d 70 61 63 74 20 76  |.      compact v|
000014b0  65 72 73 69 6f 6e 20 6f  66 20 74 68 65 20 6c 69  |ersion of the li|
000014c0  62 72 61 72 79 2e 0d 04  7e 45 f4 20 20 20 20 20  |brary...~E.     |
000014d0  20 2a 20 50 52 4f 43 74  72 65 63 6f 72 64 20 6d  | * PROCtrecord m|
000014e0  6f 64 69 66 69 65 64 20  74 6f 20 62 65 20 74 72  |odified to be tr|
000014f0  75 65 20 69 6e 76 65 72  73 65 20 6f 66 20 50 52  |ue inverse of PR|
00001500  4f 43 74 72 65 73 74 6f  72 65 2c 0d 04 88 48 f4  |OCtrestore,...H.|
00001510  20 20 20 20 20 20 69 2e  65 2e 20 6e 6f 77 20 75  |      i.e. now u|
00001520  70 64 61 74 65 73 20 54  75 72 74 6c 65 20 73 74  |pdates Turtle st|
00001530  61 63 6b 2d 70 6f 69 6e  74 65 72 20 69 6e 20 46  |ack-pointer in F|
00001540  75 6c 6c 20 41 73 63 65  6e 64 69 6e 67 20 6d 6f  |ull Ascending mo|
00001550  64 65 2e 0d 04 92 44 f4  20 20 20 20 20 20 2a 20  |de....D.      * |
00001560  46 75 6e 63 74 69 6f 6e  20 76 61 72 69 61 6e 74  |Function variant|
00001570  20 69 6e 74 72 6f 64 75  63 65 64 20 66 6f 72 20  | introduced for |
00001580  65 61 63 68 20 70 72 6f  63 65 64 75 72 65 3a 20  |each procedure: |
00001590  75 73 65 64 20 62 79 0d  04 9c 14 f4 20 20 20 20  |used by.....    |
000015a0  20 20 50 52 4f 43 74 72  75 6e 2e 0d 04 a6 3f f4  |  PROCtrun....?.|
000015b0  20 20 20 20 20 20 2a 20  54 75 72 74 6c 65 20 61  |      * Turtle a|
000015c0  6e 67 6c 65 20 30 20 63  68 61 6e 67 65 64 20 66  |ngle 0 changed f|
000015d0  72 6f 6d 20 64 75 65 20  45 61 73 74 20 74 6f 20  |rom due East to |
000015e0  64 75 65 20 4e 6f 72 74  68 2e 0d 04 b0 4a f4 20  |due North....J. |
000015f0  20 20 20 20 20 2a 20 50  52 4f 43 74 74 75 72 6e  |     * PROCtturn|
00001600  2c 20 50 52 4f 43 74 61  6c 69 67 6e 20 6d 6f 64  |, PROCtalign mod|
00001610  69 66 69 65 64 20 73 6f  20 74 68 61 74 20 54 75  |ified so that Tu|
00001620  72 74 6c 65 20 61 6e 67  6c 65 20 69 73 20 61 6c  |rtle angle is al|
00001630  77 61 79 73 0d 04 ba 21  f4 20 20 20 20 20 20 65  |ways...!.      e|
00001640  78 70 72 65 73 73 65 64  20 61 73 20 70 6f 73 69  |xpressed as posi|
00001650  74 69 76 65 2e 0d 04 c4  49 f4 20 20 20 20 20 20  |tive....I.      |
00001660  2a 20 42 75 67 20 66 69  78 20 74 6f 20 50 52 4f  |* Bug fix to PRO|
00001670  43 74 74 75 72 6e 2e 20  54 75 72 6e 73 20 77 65  |Ctturn. Turns we|
00001680  72 65 20 61 6c 77 61 79  73 20 74 72 75 6e 63 61  |re always trunca|
00001690  74 65 64 20 74 6f 20 69  6e 74 65 67 65 72 0d 04  |ted to integer..|
000016a0  ce 13 f4 20 20 20 20 20  20 64 65 67 72 65 65 73  |...      degrees|
000016b0  2e 0d 04 d8 3d f4 20 20  20 20 20 20 2a 20 49 6e  |....=.      * In|
000016c0  74 65 72 6e 61 6c 20 66  61 74 61 6c 20 65 72 72  |ternal fatal err|
000016d0  6f 72 73 20 6e 6f 20 6c  6f 6e 67 65 72 20 74 65  |ors no longer te|
000016e0  72 6d 69 6e 61 74 65 20  42 41 53 49 43 2e 0d 04  |rminate BASIC...|
000016f0  e2 42 f4 20 20 20 20 20  20 2a 20 52 65 64 75 6e  |.B.      * Redun|
00001700  64 61 6e 74 20 72 61 6e  67 65 20 63 68 65 63 6b  |dant range check|
00001710  69 6e 67 20 72 65 6d 6f  76 65 64 20 66 72 6f 6d  |ing removed from|
00001720  20 50 52 4f 43 74 6d 65  6d 73 65 74 20 61 6e 64  | PROCtmemset and|
00001730  0d 04 ec 18 f4 20 20 20  20 20 20 50 52 4f 43 74  |.....      PROCt|
00001740  6d 65 6d 6d 6f 76 65 2e  0d 04 f6 32 f4 20 20 20  |memmove....2.   |
00001750  20 20 20 2a 20 44 6f 63  75 6d 65 6e 74 61 74 69  |   * Documentati|
00001760  6f 6e 20 63 6f 72 72 65  63 74 65 64 20 61 6e 64  |on corrected and|
00001770  20 65 78 74 65 6e 64 65  64 2e 0d 05 00 15 f4 20  | extended...... |
00001780  76 32 2e 30 31 20 31 30  2d 4d 61 72 2d 39 31 0d  |v2.01 10-Mar-91.|
00001790  05 0a 4a f4 20 20 20 20  20 20 2a 20 42 75 67 20  |..J.      * Bug |
000017a0  66 69 78 20 69 6e 20 46  4e 74 73 74 6f 72 65 70  |fix in FNtstorep|
000017b0  6c 6f 74 20 61 6e 64 20  46 4e 74 73 74 6f 72 65  |lot and FNtstore|
000017c0  63 6f 6c 2e 20 49 6e 74  65 67 65 72 20 70 61 72  |col. Integer par|
000017d0  65 6d 65 74 65 72 20 72  25 0d 05 14 1d f4 20 20  |emeter r%.....  |
000017e0  20 20 20 20 63 68 61 6e  67 65 64 20 74 6f 20 72  |    changed to r|
000017f0  65 61 6c 20 72 2e 0d 05  1e 3e f4 20 20 20 20 20  |eal r....>.     |
00001800  20 2a 20 42 75 67 20 66  69 78 20 69 6e 20 50 52  | * Bug fix in PR|
00001810  4f 43 74 64 6f 2e 20 47  6c 6f 62 61 6c 20 76 61  |OCtdo. Global va|
00001820  72 69 61 62 6c 65 20 78  20 6d 61 64 65 20 6c 6f  |riable x made lo|
00001830  63 61 6c 2e 0d 05 28 45  f4 20 20 20 20 20 20 2a  |cal...(E.      *|
00001840  20 42 75 67 20 66 69 78  20 69 6e 20 50 52 4f 43  | Bug fix in PROC|
00001850  74 72 75 6e 2e 20 22 50  52 4f 43 73 74 61 72 74  |trun. "PROCstart|
00001860  22 20 73 68 6f 75 6c 64  20 62 65 20 22 50 52 4f  |" should be "PRO|
00001870  43 74 73 74 61 72 74 22  3b 0d 05 32 2b f4 20 20  |Ctstart";..2+.  |
00001880  20 20 20 20 22 50 52 4f  43 73 68 6f 77 22 20 73  |    "PROCshow" s|
00001890  68 6f 75 6c 64 20 62 65  20 22 50 52 4f 43 74 73  |hould be "PROCts|
000018a0  68 6f 77 22 0d 05 3c 3f  f4 20 20 20 20 20 20 2a  |how"..<?.      *|
000018b0  20 4d 69 6e 6f 72 20 65  72 72 6f 72 20 69 6e 20  | Minor error in |
000018c0  73 63 72 65 65 6e 20 6f  75 74 70 75 74 20 6f 66  |screen output of|
000018d0  20 50 52 4f 43 40 68 65  6c 70 2e 20 22 48 65 6c  | PROC@help. "Hel|
000018e0  70 41 22 0d 05 46 41 f4  20 20 20 20 20 20 73 68  |pA"..FA.      sh|
000018f0  6f 75 6c 64 20 62 65 20  22 54 47 52 46 58 48 65  |ould be "TGRFXHe|
00001900  6c 70 41 22 3b 20 22 48  65 6c 70 42 22 20 73 68  |lpA"; "HelpB" sh|
00001910  6f 75 6c 64 20 62 65 20  22 54 47 52 46 58 48 65  |ould be "TGRFXHe|
00001920  6c 70 42 22 0d 05 50 45  f4 20 20 20 20 20 20 2a  |lpB"..PE.      *|
00001930  20 41 64 64 69 74 69 6f  6e 61 6c 20 22 52 45 4d  | Additional "REM|
00001940  2b 22 73 20 28 64 69 72  65 63 74 69 76 65 73 20  |+"s (directives |
00001950  74 6f 20 50 52 4f 43 40  68 65 6c 70 29 20 69 6e  |to PROC@help) in|
00001960  73 65 72 74 65 64 20 74  6f 0d 05 5a 28 f4 20 20  |serted to..Z(.  |
00001970  20 20 20 20 69 6d 70 72  6f 76 65 20 66 6f 72 6d  |    improve form|
00001980  61 74 20 6f 66 20 68 65  6c 70 20 66 69 6c 65 73  |at of help files|
00001990  2e 0d 05 64 04 0d 05 6e  49 f4 2b 3d 3d 3d 3d 3d  |...d...nI.+=====|
000019a0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 20  |=============== |
000019b0  52 6f 75 74 69 6e 65 73  20 3d 3d 3d 3d 3d 3d 3d  |Routines =======|
000019c0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
000019d0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 0d 05  |==============..|
000019e0  78 06 f4 2b 0d 05 82 12  f4 2b 20 20 50 52 4f 43  |x..+.....+  PROC|
000019f0  74 73 74 61 72 74 0d 05  8c 06 f4 2b 0d 05 96 1f  |tstart.....+....|
00001a00  f4 2b 20 20 49 6e 69 74  69 61 6c 69 73 65 73 20  |.+  Initialises |
00001a10  74 68 65 20 54 75 72 74  6c 65 2e 0d 05 a0 41 f4  |the Turtle....A.|
00001a20  2b 20 20 54 68 65 20 54  75 72 74 6c 65 20 69 73  |+  The Turtle is|
00001a30  20 70 6c 61 63 65 64 20  69 6e 20 74 68 65 20 6d  | placed in the m|
00001a40  69 64 64 6c 65 20 6f 66  20 74 68 65 20 73 63 72  |iddle of the scr|
00001a50  65 65 6e 20 70 6f 69 6e  74 69 6e 67 0d 05 aa 3f  |een pointing...?|
00001a60  f4 2b 20 20 64 75 65 20  4e 6f 72 74 68 2e 20 49  |.+  due North. I|
00001a70  74 20 69 73 20 69 6e 76  69 73 69 62 6c 65 3b 20  |t is invisible; |
00001a80  69 74 73 20 22 70 65 6e  22 20 69 73 20 6f 66 66  |its "pen" is off|
00001a90  3b 20 69 74 73 20 70 6c  6f 74 2d 0d 05 b4 4a f4  |; its plot-...J.|
00001aa0  2b 20 20 61 63 74 69 6f  6e 73 20 61 6e 64 20 63  |+  actions and c|
00001ab0  6f 6c 6f 75 72 73 2c 20  62 6f 74 68 20 66 6f 72  |olours, both for|
00001ac0  65 67 72 6f 75 6e 64 20  61 6e 64 20 62 61 63 6b  |eground and back|
00001ad0  67 72 6f 75 6e 64 2c 20  61 72 65 20 73 65 74 20  |ground, are set |
00001ae0  74 6f 20 30 3b 0d 05 be  1f f4 2b 20 20 6e 6f 20  |to 0;.....+  no |
00001af0  54 75 72 74 6c 65 2d 73  74 61 63 6b 20 65 78 69  |Turtle-stack exi|
00001b00  73 74 73 2e 0d 05 c8 06  f4 2b 0d 05 d2 0c dd f2  |sts......+......|
00001b10  74 73 74 61 72 74 0d 05  dc 11 5f 48 65 69 67 68  |tstart...._Heigh|
00001b20  74 25 3d 31 30 32 34 0d  05 e6 10 5f 57 69 64 74  |t%=1024...._Widt|
00001b30  68 25 3d 31 32 38 30 0d  05 f0 10 5f 54 4c 65 6e  |h%=1280...._TLen|
00001b40  67 74 68 25 3d 36 34 0d  05 fa 19 5f 54 48 61 6c  |gth%=64...._THal|
00001b50  66 25 3d 5f 54 4c 65 6e  67 74 68 25 20 81 20 32  |f%=_TLength% . 2|
00001b60  0d 06 04 19 5f 54 57 69  6e 67 3d b6 28 5f 54 48  |...._TWing=.(_TH|
00001b70  61 6c 66 25 5e 32 2a 32  29 0d 06 0e 12 5f 54 75  |alf%^2*2)...._Tu|
00001b80  72 74 6c 65 41 6e 67 6c  65 3d 30 0d 06 18 1c 5f  |rtleAngle=0...._|
00001b90  54 75 72 74 6c 65 58 3d  28 5f 57 69 64 74 68 25  |TurtleX=(_Width%|
00001ba0  20 81 20 32 29 2d 31 0d  06 22 1d 5f 54 75 72 74  | . 2)-1.."._Turt|
00001bb0  6c 65 59 3d 28 5f 48 65  69 67 68 74 25 20 81 20  |leY=(_Height% . |
00001bc0  32 29 2d 31 0d 06 2c 17  ec 20 5f 54 75 72 74 6c  |2)-1..,.. _Turtl|
00001bd0  65 58 2c 5f 54 75 72 74  6c 65 59 0d 06 36 10 5f  |eX,_TurtleY..6._|
00001be0  54 75 72 74 6c 65 4f 6e  25 3d a3 0d 06 40 13 5f  |TurtleOn%=...@._|
00001bf0  54 75 72 74 6c 65 50 65  6e 4f 6e 25 3d a3 0d 06  |TurtlePenOn%=...|
00001c00  4a 13 5f 54 75 72 74 6c  65 53 74 61 63 6b 25 3d  |J._TurtleStack%=|
00001c10  a3 0d 06 54 15 5f 54 75  72 74 6c 65 57 61 74 63  |...T._TurtleWatc|
00001c20  68 4f 6e 25 3d a3 0d 06  5e 12 5f 54 75 72 74 6c  |hOn%=...^._Turtl|
00001c30  65 46 43 6f 6c 25 3d 30  0d 06 68 12 5f 54 75 72  |eFCol%=0..h._Tur|
00001c40  74 6c 65 42 43 6f 6c 25  3d 30 0d 06 72 13 5f 54  |tleBCol%=0..r._T|
00001c50  75 72 74 6c 65 46 50 6c  6f 74 25 3d 30 0d 06 7c  |urtleFPlot%=0..||
00001c60  13 5f 54 75 72 74 6c 65  42 50 6c 6f 74 25 3d 30  |._TurtleBPlot%=0|
00001c70  0d 06 86 05 e1 0d 06 90  04 0d 06 9a 19 dd a4 74  |...............t|
00001c80  73 74 61 72 74 3a 20 f2  74 73 74 61 72 74 3a 20  |start: .tstart: |
00001c90  3d 30 0d 06 a4 04 0d 06  ae 4b f4 2b 3d 3d 3d 3d  |=0.......K.+====|
00001ca0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00001ce0  3d 0d 06 b8 4b f4 2b 3d  3d 3d 3d 3d 3d 3d 3d 3d  |=...K.+=========|
00001cf0  3d 3d 3d 3d 20 54 75 72  74 6c 65 20 44 69 73 70  |==== Turtle Disp|
00001d00  6f 73 69 74 69 6f 6e 20  52 6f 75 74 69 6e 65 73  |osition Routines|
00001d10  20 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  | ===============|
00001d20  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 0d 06 c2 4b  |============...K|
00001d30  f4 2b 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.+==============|
00001d40  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00001d70  3d 3d 3d 3d 3d 3d 3d 0d  06 cc 06 f4 2b 0d 06 d6  |=======.....+...|
00001d80  11 f4 2b 20 20 50 52 4f  43 74 73 68 6f 77 0d 06  |..+  PROCtshow..|
00001d90  e0 06 f4 2b 0d 06 ea 21  f4 2b 20 20 4d 61 6b 65  |...+...!.+  Make|
00001da0  73 20 74 68 65 20 54 75  72 74 6c 65 20 76 69 73  |s the Turtle vis|
00001db0  69 62 6c 65 2e 0d 06 f4  06 f4 2b 0d 06 fe 0b dd  |ible......+.....|
00001dc0  f2 74 73 68 6f 77 0d 07  08 14 e7 20 ac 20 5f 54  |.tshow..... . _T|
00001dd0  75 72 74 6c 65 4f 6e 25  20 8c 0d 07 12 0e 20 20  |urtleOn% .....  |
00001de0  20 f2 40 74 64 72 61 77  0d 07 1c 13 20 20 20 5f  | .@tdraw....   _|
00001df0  54 75 72 74 6c 65 4f 6e  25 3d b9 0d 07 26 05 cd  |TurtleOn%=...&..|
00001e00  0d 07 30 05 e1 0d 07 3a  04 0d 07 44 17 dd a4 74  |..0....:...D...t|
00001e10  73 68 6f 77 3a 20 f2 74  73 68 6f 77 3a 20 3d 30  |show: .tshow: =0|
00001e20  0d 07 4e 04 0d 07 58 4b  f4 2b 3d 3d 3d 3d 3d 3d  |..N...XK.+======|
00001e30  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00001e60  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 0d  |===============.|
00001e70  07 62 06 f4 2b 0d 07 6c  11 f4 2b 20 20 50 52 4f  |.b..+..l..+  PRO|
00001e80  43 74 68 69 64 65 0d 07  76 06 f4 2b 0d 07 80 23  |Cthide..v..+...#|
00001e90  f4 2b 20 20 4d 61 6b 65  73 20 74 68 65 20 54 75  |.+  Makes the Tu|
00001ea0  72 74 6c 65 20 69 6e 76  69 73 69 62 6c 65 2e 0d  |rtle invisible..|
00001eb0  07 8a 06 f4 2b 0d 07 94  0b dd f2 74 68 69 64 65  |....+......thide|
00001ec0  0d 07 9e 12 e7 20 5f 54  75 72 74 6c 65 4f 6e 25  |..... _TurtleOn%|
00001ed0  20 8c 0d 07 a8 0e 20 20  20 f2 40 74 64 72 61 77  | .....   .@tdraw|
00001ee0  0d 07 b2 13 20 20 20 5f  54 75 72 74 6c 65 4f 6e  |....   _TurtleOn|
00001ef0  25 3d a3 0d 07 bc 05 cd  0d 07 c6 05 e1 0d 07 d0  |%=..............|
00001f00  04 0d 07 da 17 dd a4 74  68 69 64 65 3a 20 f2 74  |.......thide: .t|
00001f10  68 69 64 65 3a 20 3d 30  0d 07 e4 04 0d 07 ee 4b  |hide: =0.......K|
00001f20  f4 2b 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.+==============|
00001f30  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00001f60  3d 3d 3d 3d 3d 3d 3d 0d  07 f8 06 f4 2b 0d 08 02  |=======.....+...|
00001f70  22 f4 2b 20 20 50 52 4f  43 74 67 63 6f 6c 28 61  |".+  PROCtgcol(a|
00001f80  63 74 69 6f 6e 25 2c 63  6f 6c 6f 75 72 25 29 0d  |ction%,colour%).|
00001f90  08 0c 06 f4 2b 0d 08 16  42 f4 2b 20 20 53 65 74  |....+...B.+  Set|
00001fa0  73 20 74 68 65 20 67 72  61 70 68 69 63 73 20 70  |s the graphics p|
00001fb0  6c 6f 74 2d 61 63 74 69  6f 6e 73 20 61 6e 64 20  |lot-actions and |
00001fc0  63 6f 6c 6f 75 72 73 20  61 6e 64 20 69 6e 66 6f  |colours and info|
00001fd0  72 6d 73 20 74 68 65 0d  08 20 45 f4 2b 20 20 54  |rms the.. E.+  T|
00001fe0  75 72 74 6c 65 20 6f 66  20 74 68 65 20 73 65 74  |urtle of the set|
00001ff0  74 69 6e 67 73 2e 20 54  68 65 20 66 6f 72 65 67  |tings. The foreg|
00002000  72 6f 75 6e 64 20 70 6c  6f 74 2d 61 63 74 69 6f  |round plot-actio|
00002010  6e 20 61 6e 64 20 63 6f  6c 6f 75 72 0d 08 2a 40  |n and colour..*@|
00002020  f4 2b 20 20 61 73 20 6c  61 73 74 20 73 65 74 20  |.+  as last set |
00002030  62 79 20 74 68 69 73 20  72 6f 75 74 69 6e 65 20  |by this routine |
00002040  63 61 6e 20 62 65 20 72  65 61 64 20 66 72 6f 6d  |can be read from|
00002050  20 74 68 65 20 6c 69 62  72 61 72 79 0d 08 34 40  | the library..4@|
00002060  f4 2b 20 20 76 61 72 69  61 62 6c 65 73 20 5f 54  |.+  variables _T|
00002070  75 72 74 6c 65 46 50 6c  6f 74 25 20 61 6e 64 20  |urtleFPlot% and |
00002080  5f 54 75 72 74 6c 65 46  43 6f 6c 25 3b 20 74 68  |_TurtleFCol%; th|
00002090  65 20 62 61 63 6b 67 72  6f 75 6e 64 0d 08 3e 3f  |e background..>?|
000020a0  f4 2b 20 20 76 61 6c 75  65 73 20 63 61 6e 20 62  |.+  values can b|
000020b0  65 20 72 65 61 64 20 66  72 6f 6d 20 5f 54 75 72  |e read from _Tur|
000020c0  74 6c 65 42 50 6c 6f 74  25 20 61 6e 64 20 5f 54  |tleBPlot% and _T|
000020d0  75 72 74 6c 65 42 43 6f  6c 25 2e 0d 08 48 06 f4  |urtleBCol%...H..|
000020e0  2b 0d 08 52 45 f4 2b 20  20 4e 2e 42 2e 20 49 6e  |+..RE.+  N.B. In|
000020f0  20 74 68 69 73 20 72 65  6c 65 61 73 65 20 6f 66  | this release of|
00002100  20 74 68 65 20 6c 69 62  72 61 72 79 2c 20 74 68  | the library, th|
00002110  65 20 54 75 72 74 6c 65  20 6f 6e 6c 79 20 6e 65  |e Turtle only ne|
00002120  65 64 73 20 74 6f 0d 08  5c 43 f4 2b 20 20 6b 6e  |eds to..\C.+  kn|
00002130  6f 77 20 77 68 61 74 20  66 6f 72 65 67 72 6f 75  |ow what foregrou|
00002140  6e 64 20 70 6c 6f 74 2d  61 63 74 69 6f 6e 20 61  |nd plot-action a|
00002150  6e 64 20 63 6f 6c 6f 75  72 20 61 72 65 20 69 6e  |nd colour are in|
00002160  20 66 6f 72 63 65 20 73  6f 0d 08 66 43 f4 2b 20  | force so..fC.+ |
00002170  20 74 68 61 74 20 69 74  20 63 61 6e 20 62 65 20  | that it can be |
00002180  63 6f 72 72 65 63 74 6c  79 20 72 65 64 72 61 77  |correctly redraw|
00002190  6e 20 77 68 65 6e 20 69  74 20 69 73 20 76 69 73  |n when it is vis|
000021a0  69 62 6c 65 2e 20 49 6e  20 74 68 65 0d 08 70 44  |ible. In the..pD|
000021b0  f4 2b 20 20 69 6e 74 65  72 65 73 74 20 6f 66 20  |.+  interest of |
000021c0  73 70 65 65 64 2c 20 68  6f 77 65 76 65 72 2c 20  |speed, however, |
000021d0  74 68 65 20 54 75 72 74  6c 65 20 72 65 73 74 6f  |the Turtle resto|
000021e0  72 65 73 20 74 68 65 73  65 20 76 61 6c 75 65 73  |res these values|
000021f0  0d 08 7a 44 f4 2b 20 20  61 75 74 6f 6d 61 74 69  |..zD.+  automati|
00002200  63 61 6c 6c 79 20 6f 6e  6c 79 20 77 68 65 6e 20  |cally only when |
00002210  69 74 20 69 73 20 6f 62  6c 69 67 65 64 20 74 6f  |it is obliged to|
00002220  20 62 79 20 61 20 54 75  72 74 6c 65 2d 72 65 64  | by a Turtle-red|
00002230  72 61 77 3a 0d 08 84 44  f4 2b 20 20 61 74 20 6f  |raw:...D.+  at o|
00002240  74 68 65 72 20 74 69 6d  65 73 20 69 74 20 75 73  |ther times it us|
00002250  65 73 20 77 68 61 74 65  76 65 72 20 76 61 6c 75  |es whatever valu|
00002260  65 73 20 61 72 65 20 69  6e 20 66 6f 72 63 65 2c  |es are in force,|
00002270  20 65 76 65 6e 20 69 66  0d 08 8e 43 f4 2b 20 20  | even if...C.+  |
00002280  74 68 65 79 20 68 61 76  65 20 62 65 65 6e 20 64  |they have been d|
00002290  69 72 65 63 74 6c 79 20  73 65 74 20 62 79 20 47  |irectly set by G|
000022a0  43 4f 4c 28 61 63 74 69  6f 6e 25 20 63 6f 6c 6f  |COL(action% colo|
000022b0  75 72 25 29 20 72 61 74  68 65 72 0d 08 98 40 f4  |ur%) rather...@.|
000022c0  2b 20 20 74 68 61 6e 20  74 68 72 6f 75 67 68 20  |+  than through |
000022d0  50 52 4f 43 74 67 63 6f  6c 28 61 63 74 69 6f 6e  |PROCtgcol(action|
000022e0  25 2c 63 6f 6c 6f 75 72  25 29 2e 20 49 74 20 69  |%,colour%). It i|
000022f0  73 20 74 68 65 72 65 66  6f 72 65 0d 08 a2 46 f4  |s therefore...F.|
00002300  2b 20 20 72 65 63 6f 6d  6d 65 6e 64 65 64 20 74  |+  recommended t|
00002310  68 61 74 20 50 52 4f 43  74 67 63 6f 6c 20 73 68  |hat PROCtgcol sh|
00002320  6f 75 6c 64 20 61 6c 77  61 79 73 20 62 65 20 75  |ould always be u|
00002330  73 65 64 20 69 6e 20 54  75 72 74 6c 65 47 52 46  |sed in TurtleGRF|
00002340  58 0d 08 ac 45 f4 2b 20  20 70 72 6f 67 72 61 6d  |X...E.+  program|
00002350  73 20 69 6e 73 74 65 61  64 20 74 68 65 20 42 41  |s instead the BA|
00002360  53 49 43 20 63 6f 6d 6d  61 6e 64 20 47 43 4f 4c  |SIC command GCOL|
00002370  2c 20 6f 74 68 65 72 77  69 73 65 20 74 68 65 20  |, otherwise the |
00002380  54 75 72 74 6c 65 0d 08  b6 3c f4 2b 20 20 69 73  |Turtle...<.+  is|
00002390  20 6c 69 61 62 6c 65 20  74 6f 20 72 65 73 74 6f  | liable to resto|
000023a0  72 65 20 76 61 6c 75 65  73 20 77 68 69 63 68 20  |re values which |
000023b0  61 72 65 20 22 6f 75 74  20 6f 66 20 64 61 74 65  |are "out of date|
000023c0  22 2e 0d 08 c0 06 f4 2b  0d 08 ca 1c dd f2 74 67  |"......+......tg|
000023d0  63 6f 6c 28 61 63 74 69  6f 6e 25 2c 63 6f 6c 6f  |col(action%,colo|
000023e0  75 72 25 29 0d 08 d4 1a  61 63 74 69 6f 6e 25 3d  |ur%)....action%=|
000023f0  94 28 61 63 74 69 6f 6e  25 20 83 20 38 29 0d 08  |.(action% . 8)..|
00002400  de 1c 63 6f 6c 6f 75 72  25 3d 94 28 63 6f 6c 6f  |..colour%=.(colo|
00002410  75 72 25 20 83 20 32 35  36 29 0d 08 e8 15 e6 20  |ur% . 256)..... |
00002420  61 63 74 69 6f 6e 25 2c  63 6f 6c 6f 75 72 25 0d  |action%,colour%.|
00002430  08 f2 11 e7 20 63 6f 6c  6f 75 72 25 3c 31 32 38  |.... colour%<128|
00002440  0d 08 fc 1c 20 20 20 5f  54 75 72 74 6c 65 46 50  |....   _TurtleFP|
00002450  6c 6f 74 25 3d 61 63 74  69 6f 6e 25 0d 09 06 1b  |lot%=action%....|
00002460  20 20 20 5f 54 75 72 74  6c 65 46 43 6f 6c 25 3d  |   _TurtleFCol%=|
00002470  63 6f 6c 6f 75 72 25 0d  09 10 05 cc 0d 09 1a 1c  |colour%.........|
00002480  20 20 20 5f 54 75 72 74  6c 65 42 50 6c 6f 74 25  |   _TurtleBPlot%|
00002490  3d 61 63 74 69 6f 6e 25  0d 09 24 1b 20 20 20 5f  |=action%..$.   _|
000024a0  54 75 72 74 6c 65 42 43  6f 6c 25 3d 63 6f 6c 6f  |TurtleBCol%=colo|
000024b0  75 72 25 0d 09 2e 05 cd  0d 09 38 05 e1 0d 09 42  |ur%.......8....B|
000024c0  04 0d 09 4c 39 dd a4 74  67 63 6f 6c 28 61 63 74  |...L9..tgcol(act|
000024d0  69 6f 6e 25 2c 63 6f 6c  6f 75 72 25 29 3a 20 f2  |ion%,colour%): .|
000024e0  74 67 63 6f 6c 28 61 63  74 69 6f 6e 25 2c 63 6f  |tgcol(action%,co|
000024f0  6c 6f 75 72 25 29 3a 20  3d 30 0d 09 56 04 0d 09  |lour%): =0..V...|
00002500  60 4b f4 2b 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |`K.+============|
00002510  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00002540  3d 3d 3d 3d 3d 3d 3d 3d  3d 0d 09 6a 06 f4 2b 0d  |=========..j..+.|
00002550  09 74 14 f4 2b 20 20 50  52 4f 43 74 70 65 6e 28  |.t..+  PROCtpen(|
00002560  6e 25 29 0d 09 7e 06 f4  2b 0d 09 88 1e f4 2b 20  |n%)..~..+.....+ |
00002570  20 53 65 74 73 20 74 68  65 20 54 75 72 74 6c 65  | Sets the Turtle|
00002580  27 73 20 70 65 6e 2e 0d  09 92 44 f4 2b 20 20 57  |'s pen....D.+  W|
00002590  68 65 6e 20 6e 25 3d 30  2c 20 74 68 65 20 54 75  |hen n%=0, the Tu|
000025a0  72 74 6c 65 20 77 69 6c  6c 20 6e 6f 74 20 64 72  |rtle will not dr|
000025b0  61 77 20 69 74 73 20 6d  6f 76 65 6d 65 6e 74 73  |aw its movements|
000025c0  2c 20 6f 74 68 65 72 77  69 73 65 0d 09 9c 45 f4  |, otherwise...E.|
000025d0  2b 20 20 69 74 20 77 69  6c 6c 20 64 72 61 77 20  |+  it will draw |
000025e0  69 74 73 20 6d 6f 76 65  6d 65 6e 74 73 20 75 73  |its movements us|
000025f0  69 6e 67 20 74 68 65 20  63 75 72 72 65 6e 74 20  |ing the current |
00002600  66 6f 72 67 72 6f 75 6e  64 20 63 6f 6c 6f 75 72  |forground colour|
00002610  0d 09 a6 18 f4 2b 20 20  61 6e 64 20 70 6c 6f 74  |.....+  and plot|
00002620  2d 61 63 74 69 6f 6e 2e  0d 09 b0 06 f4 2b 0d 09  |-action......+..|
00002630  ba 0e dd f2 74 70 65 6e  28 6e 25 29 0d 09 c4 2f  |....tpen(n%).../|
00002640  e7 20 6e 25 3c 3e 30 20  8c 20 5f 54 75 72 74 6c  |. n%<>0 . _Turtl|
00002650  65 50 65 6e 4f 6e 25 3d  b9 20 8b 20 5f 54 75 72  |ePenOn%=. . _Tur|
00002660  74 6c 65 50 65 6e 4f 6e  25 3d a3 0d 09 ce 05 e1  |tlePenOn%=......|
00002670  0d 09 d8 04 0d 09 e2 1d  dd a4 74 70 65 6e 28 6e  |..........tpen(n|
00002680  25 29 3a 20 f2 74 70 65  6e 28 6e 25 29 3a 20 3d  |%): .tpen(n%): =|
00002690  30 0d 09 ec 04 0d 09 f6  4b f4 2b 3d 3d 3d 3d 3d  |0.......K.+=====|
000026a0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
000026e0  0d 0a 00 06 f4 2b 0d 0a  0a 14 f4 2b 20 20 50 52  |.....+.....+  PR|
000026f0  4f 43 74 77 61 74 63 68  6f 6e 0d 0a 14 06 f4 2b  |OCtwatchon.....+|
00002700  0d 0a 1e 46 f4 2b 20 20  4d 61 6b 65 73 20 74 68  |...F.+  Makes th|
00002710  65 20 54 75 72 74 6c 65  20 76 69 73 69 62 6c 65  |e Turtle visible|
00002720  20 61 6e 64 20 63 61 75  73 65 73 20 69 74 20 74  | and causes it t|
00002730  6f 20 77 61 69 74 20 66  6f 72 20 61 20 6b 65 79  |o wait for a key|
00002740  73 74 72 6f 6b 65 0d 0a  28 35 f4 2b 20 20 77 68  |stroke..(5.+  wh|
00002750  65 6e 65 76 65 72 20 69  74 20 69 73 20 72 65 64  |enever it is red|
00002760  72 61 77 6e 2e 20 46 6f  72 20 75 73 65 20 69 6e  |rawn. For use in|
00002770  20 64 65 62 75 67 67 69  6e 67 2e 0d 0a 32 06 f4  | debugging...2..|
00002780  2b 0d 0a 3c 0e dd f2 74  77 61 74 63 68 6f 6e 0d  |+..<...twatchon.|
00002790  0a 46 0a f2 74 73 68 6f  77 0d 0a 50 15 5f 54 75  |.F..tshow..P._Tu|
000027a0  72 74 6c 65 57 61 74 63  68 4f 6e 25 3d b9 0d 0a  |rtleWatchOn%=...|
000027b0  5a 05 e1 0d 0a 64 04 0d  0a 6e 1d dd a4 74 77 61  |Z....d...n...twa|
000027c0  74 63 68 6f 6e 3a 20 f2  74 77 61 74 63 68 6f 6e  |tchon: .twatchon|
000027d0  3a 20 3d 30 0d 0a 78 04  0d 0a 82 4b f4 2b 3d 3d  |: =0..x....K.+==|
000027e0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00002820  3d 3d 3d 0d 0a 8c 06 f4  2b 0d 0a 96 15 f4 2b 20  |===.....+.....+ |
00002830  20 50 52 4f 43 74 77 61  74 63 68 6f 66 66 0d 0a  | PROCtwatchoff..|
00002840  a0 06 f4 2b 0d 0a aa 45  f4 2b 20 20 43 61 6e 63  |...+...E.+  Canc|
00002850  65 6c 73 20 50 52 4f 43  74 77 61 74 63 68 6f 6e  |els PROCtwatchon|
00002860  2c 20 69 66 20 69 74 20  69 73 20 69 6e 20 66 6f  |, if it is in fo|
00002870  72 63 65 2c 20 61 6e 64  20 6d 61 6b 65 73 20 74  |rce, and makes t|
00002880  68 65 20 54 75 72 74 6c  65 0d 0a b4 2b f4 2b 20  |he Turtle...+.+ |
00002890  20 69 6e 76 69 73 69 62  6c 65 3b 20 6f 74 68 65  | invisible; othe|
000028a0  72 77 69 73 65 20 68 61  73 20 6e 6f 20 65 66 66  |rwise has no eff|
000028b0  65 63 74 2e 0d 0a be 06  f4 2b 0d 0a c8 0f dd f2  |ect......+......|
000028c0  74 77 61 74 63 68 6f 66  66 0d 0a d2 17 e7 20 5f  |twatchoff..... _|
000028d0  54 75 72 74 6c 65 57 61  74 63 68 4f 6e 25 20 8c  |TurtleWatchOn% .|
000028e0  0d 0a dc 18 20 20 20 5f  54 75 72 74 6c 65 57 61  |....   _TurtleWa|
000028f0  74 63 68 4f 6e 25 3d a3  0d 0a e6 0d 20 20 20 f2  |tchOn%=.....   .|
00002900  74 68 69 64 65 0d 0a f0  05 cd 0d 0a fa 05 e1 0d  |thide...........|
00002910  0b 04 04 0d 0b 0e 1f dd  a4 74 77 61 74 63 68 6f  |.........twatcho|
00002920  66 66 3a 20 f2 74 77 61  74 63 68 6f 66 66 3a 20  |ff: .twatchoff: |
00002930  3d 30 0d 0b 18 04 0d 0b  22 4b f4 2b 3d 3d 3d 3d  |=0......"K.+====|
00002940  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00002980  3d 0d 0b 2c 4b f4 2b 3d  3d 3d 3d 3d 3d 3d 3d 3d  |=..,K.+=========|
00002990  3d 3d 3d 3d 3d 3d 3d 3d  3d 20 54 75 72 74 6c 65  |========= Turtle|
000029a0  20 41 63 74 69 6f 6e 20  52 6f 75 74 69 6e 65 73  | Action Routines|
000029b0  20 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  | ===============|
000029c0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 0d 0b 36 4b  |============..6K|
000029d0  f4 2b 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.+==============|
000029e0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00002a10  3d 3d 3d 3d 3d 3d 3d 0d  0b 40 06 f4 2b 0d 0b 4a  |=======..@..+..J|
00002a20  11 f4 2b 20 20 50 52 4f  43 74 68 6f 6d 65 0d 0b  |..+  PROCthome..|
00002a30  54 06 f4 2b 0d 0b 5e 35  f4 2b 20 20 52 65 70 6c  |T..+..^5.+  Repl|
00002a40  61 63 65 73 20 74 68 65  20 54 75 72 74 6c 65 20  |aces the Turtle |
00002a50  61 74 20 69 74 73 20 73  74 61 72 74 69 6e 67 20  |at its starting |
00002a60  70 6f 73 69 74 69 6f 6e  2e 0d 0b 68 06 f4 2b 0d  |position...h..+.|
00002a70  0b 72 0b dd f2 74 68 6f  6d 65 0d 0b 7c 1a e7 20  |.r...thome..|.. |
00002a80  5f 54 75 72 74 6c 65 4f  6e 25 20 8c 20 f2 40 74  |_TurtleOn% . .@t|
00002a90  64 72 61 77 0d 0b 86 12  5f 54 75 72 74 6c 65 41  |draw...._TurtleA|
00002aa0  6e 67 6c 65 3d 30 0d 0b  90 1c 5f 54 75 72 74 6c  |ngle=0...._Turtl|
00002ab0  65 58 3d 28 5f 57 69 64  74 68 25 20 81 20 32 29  |eX=(_Width% . 2)|
00002ac0  2d 31 0d 0b 9a 1d 5f 54  75 72 74 6c 65 59 3d 28  |-1...._TurtleY=(|
00002ad0  5f 48 65 69 67 68 74 25  20 81 20 32 29 2d 31 0d  |_Height% . 2)-1.|
00002ae0  0b a4 17 ec 20 5f 54 75  72 74 6c 65 58 2c 5f 54  |.... _TurtleX,_T|
00002af0  75 72 74 6c 65 59 0d 0b  ae 1a e7 20 5f 54 75 72  |urtleY..... _Tur|
00002b00  74 6c 65 4f 6e 25 20 8c  20 f2 40 74 64 72 61 77  |tleOn% . .@tdraw|
00002b10  0d 0b b8 05 e1 0d 0b c2  04 0d 0b cc 17 dd a4 74  |...............t|
00002b20  68 6f 6d 65 3a 20 f2 74  68 6f 6d 65 3a 20 3d 30  |home: .thome: =0|
00002b30  0d 0b d6 04 0d 0b e0 4b  f4 2b 3d 3d 3d 3d 3d 3d  |.......K.+======|
00002b40  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00002b70  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 0d  |===============.|
00002b80  0b ea 06 f4 2b 0d 0b f4  1c f4 2b 20 20 50 52 4f  |....+.....+  PRO|
00002b90  43 74 6a 75 6d 70 28 78  2c 79 2c 61 6c 70 68 61  |Ctjump(x,y,alpha|
00002ba0  29 0d 0b fe 06 f4 2b 0d  0c 08 34 f4 2b 20 20 50  |).....+...4.+  P|
00002bb0  6c 61 63 65 73 20 74 68  65 20 54 75 72 74 6c 65  |laces the Turtle|
00002bc0  20 64 69 72 65 63 74 6c  79 20 61 73 20 70 6f 73  | directly as pos|
00002bd0  69 74 69 6f 6e 20 3c 78  2c 79 3e 0d 0c 12 1f f4  |ition <x,y>.....|
00002be0  2b 20 20 77 69 74 68 20  6f 72 69 65 6e 74 61 74  |+  with orientat|
00002bf0  69 6f 6e 20 61 6c 70 68  61 2e 0d 0c 1c 06 f4 2b  |ion alpha......+|
00002c00  0d 0c 26 16 dd f2 74 6a  75 6d 70 28 78 2c 79 2c  |..&...tjump(x,y,|
00002c10  61 6c 70 68 61 29 0d 0c  30 1a e7 20 5f 54 75 72  |alpha)..0.. _Tur|
00002c20  74 6c 65 4f 6e 25 20 8c  20 f2 40 74 64 72 61 77  |tleOn% . .@tdraw|
00002c30  0d 0c 3a 0e 5f 54 75 72  74 6c 65 58 3d 78 0d 0c  |..:._TurtleX=x..|
00002c40  44 0e 5f 54 75 72 74 6c  65 59 3d 79 0d 0c 4e 16  |D._TurtleY=y..N.|
00002c50  5f 54 75 72 74 6c 65 41  6e 67 6c 65 3d 61 6c 70  |_TurtleAngle=alp|
00002c60  68 61 0d 0c 58 25 ec 20  a8 28 5f 54 75 72 74 6c  |ha..X%. .(_Turtl|
00002c70  65 58 2b 30 2e 35 29 2c  a8 28 5f 54 75 72 74 6c  |eX+0.5),.(_Turtl|
00002c80  65 59 2b 30 2e 35 29 0d  0c 62 1a e7 20 5f 54 75  |eY+0.5)..b.. _Tu|
00002c90  72 74 6c 65 4f 6e 25 20  8c 20 f2 40 74 64 72 61  |rtleOn% . .@tdra|
00002ca0  77 0d 0c 6c 05 e1 0d 0c  76 04 0d 0c 80 2d dd a4  |w..l....v....-..|
00002cb0  74 6a 75 6d 70 28 78 2c  79 2c 61 6c 70 68 61 29  |tjump(x,y,alpha)|
00002cc0  3a 20 f2 74 6a 75 6d 70  28 78 2c 79 2c 61 6c 70  |: .tjump(x,y,alp|
00002cd0  68 61 29 3a 20 3d 30 0d  0c 8a 04 0d 0c 94 4b f4  |ha): =0.......K.|
00002ce0  2b 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |+===============|
00002cf0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00002d20  3d 3d 3d 3d 3d 3d 0d 0c  9e 06 f4 2b 0d 0c a8 12  |======.....+....|
00002d30  f4 2b 20 20 50 52 4f 43  74 67 6f 28 6e 29 0d 0c  |.+  PROCtgo(n)..|
00002d40  b2 06 f4 2b 0d 0c bc 49  f4 2b 20 20 41 64 76 61  |...+...I.+  Adva|
00002d50  6e 63 65 73 20 74 68 65  20 54 75 72 74 6c 65 20  |nces the Turtle |
00002d60  62 79 20 6e 20 67 72 61  70 68 69 63 73 20 75 6e  |by n graphics un|
00002d70  69 74 73 20 69 6e 20 69  74 73 20 63 75 72 72 65  |its in its curre|
00002d80  6e 74 20 64 69 72 65 63  74 69 6f 6e 2e 0d 0c c6  |nt direction....|
00002d90  06 f4 2b 0d 0c d0 0c dd  f2 74 67 6f 28 6e 29 0d  |..+......tgo(n).|
00002da0  0c da 1a e7 20 5f 54 75  72 74 6c 65 4f 6e 25 20  |.... _TurtleOn% |
00002db0  8c 20 f2 40 74 64 72 61  77 0d 0c e4 20 5f 54 75  |. .@tdraw... _Tu|
00002dc0  72 74 6c 65 58 2b 3d 6e  2a b5 20 b2 20 5f 54 75  |rtleX+=n*. . _Tu|
00002dd0  72 74 6c 65 41 6e 67 6c  65 0d 0c ee 20 5f 54 75  |rtleAngle... _Tu|
00002de0  72 74 6c 65 59 2b 3d 6e  2a 9b 20 b2 20 5f 54 75  |rtleY+=n*. . _Tu|
00002df0  72 74 6c 65 41 6e 67 6c  65 0d 0c f8 15 e7 20 5f  |rtleAngle..... _|
00002e00  54 75 72 74 6c 65 50 65  6e 4f 6e 25 20 8c 0d 0d  |TurtlePenOn% ...|
00002e10  02 28 20 20 20 df 20 a8  28 5f 54 75 72 74 6c 65  |.(   . .(_Turtle|
00002e20  58 2b 30 2e 35 29 2c a8  28 5f 54 75 72 74 6c 65  |X+0.5),.(_Turtle|
00002e30  59 2b 30 2e 35 29 0d 0d  0c 05 cc 0d 0d 16 28 20  |Y+0.5)........( |
00002e40  20 20 ec 20 a8 28 5f 54  75 72 74 6c 65 58 2b 30  |  . .(_TurtleX+0|
00002e50  2e 35 29 2c a8 28 5f 54  75 72 74 6c 65 59 2b 30  |.5),.(_TurtleY+0|
00002e60  2e 35 29 0d 0d 20 05 cd  0d 0d 2a 1a e7 20 5f 54  |.5).. ....*.. _T|
00002e70  75 72 74 6c 65 4f 6e 25  20 8c 20 f2 40 74 64 72  |urtleOn% . .@tdr|
00002e80  61 77 0d 0d 34 05 e1 0d  0d 3e 04 0d 0d 48 19 dd  |aw..4....>...H..|
00002e90  a4 74 67 6f 28 6e 29 3a  20 f2 74 67 6f 28 6e 29  |.tgo(n): .tgo(n)|
00002ea0  3a 20 3d 30 0d 0d 52 04  0d 0d 5c 4b f4 2b 3d 3d  |: =0..R...\K.+==|
00002eb0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00002ef0  3d 3d 3d 0d 0d 66 06 f4  2b 0d 0d 70 14 f4 2b 20  |===..f..+..p..+ |
00002f00  20 50 52 4f 43 74 74 6f  28 78 2c 79 29 0d 0d 7a  | PROCtto(x,y)..z|
00002f10  06 f4 2b 0d 0d 84 49 f4  2b 20 20 4f 72 69 65 6e  |..+...I.+  Orien|
00002f20  74 73 20 74 68 65 20 54  75 72 74 6c 65 20 74 6f  |ts the Turtle to|
00002f30  77 61 72 64 20 3c 78 2c  79 3e 20 61 6e 64 20 61  |ward <x,y> and a|
00002f40  64 76 61 6e 63 65 73 20  69 74 20 74 6f 20 74 68  |dvances it to th|
00002f50  61 74 20 70 6f 73 69 74  69 6f 6e 2e 0d 0d 8e 06  |at position.....|
00002f60  f4 2b 0d 0d 98 0e dd f2  74 74 6f 28 78 2c 79 29  |.+......tto(x,y)|
00002f70  0d 0d a2 22 f2 74 61 6c  69 67 6e 28 5f 54 75 72  |...".talign(_Tur|
00002f80  74 6c 65 58 2c 5f 54 75  72 74 6c 65 59 2c 78 2c  |tleX,_TurtleY,x,|
00002f90  79 29 0d 0d ac 1a e7 20  5f 54 75 72 74 6c 65 4f  |y)..... _TurtleO|
00002fa0  6e 25 20 8c 20 f2 40 74  64 72 61 77 0d 0d b6 15  |n% . .@tdraw....|
00002fb0  e7 20 5f 54 75 72 74 6c  65 50 65 6e 4f 6e 25 20  |. _TurtlePenOn% |
00002fc0  8c 0d 0d c0 19 20 20 df  20 a8 28 78 2b 30 2e 35  |.....  . .(x+0.5|
00002fd0  29 2c a8 28 79 2b 30 2e  35 29 0d 0d ca 05 cc 0d  |),.(y+0.5)......|
00002fe0  0d d4 19 20 20 ec 20 a8  28 78 2b 30 2e 35 29 2c  |...  . .(x+0.5),|
00002ff0  a8 28 79 2b 30 2e 35 29  0d 0d de 05 cd 0d 0d e8  |.(y+0.5)........|
00003000  0e 5f 54 75 72 74 6c 65  58 3d 78 0d 0d f2 0e 5f  |._TurtleX=x...._|
00003010  54 75 72 74 6c 65 59 3d  79 0d 0d fc 1a e7 20 5f  |TurtleY=y..... _|
00003020  54 75 72 74 6c 65 4f 6e  25 20 8c 20 f2 40 74 64  |TurtleOn% . .@td|
00003030  72 61 77 0d 0e 06 05 e1  0d 0e 10 04 0d 0e 1a 1d  |raw.............|
00003040  dd a4 74 74 6f 28 78 2c  79 29 3a 20 f2 74 74 6f  |..tto(x,y): .tto|
00003050  28 78 2c 79 29 3a 20 3d  30 0d 0e 24 04 0d 0e 2e  |(x,y): =0..$....|
00003060  4b f4 2b 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |K.+=============|
00003070  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
000030a0  3d 3d 3d 3d 3d 3d 3d 3d  0d 0e 38 06 f4 2b 0d 0e  |========..8..+..|
000030b0  42 14 f4 2b 20 20 50 52  4f 43 74 74 75 72 6e 28  |B..+  PROCtturn(|
000030c0  6e 29 0d 0e 4c 06 f4 2b  0d 0e 56 45 f4 2b 20 20  |n)..L..+..VE.+  |
000030d0  54 75 72 6e 73 20 74 68  65 20 74 75 72 74 6c 65  |Turns the turtle|
000030e0  20 62 79 20 6e 20 64 65  67 72 65 65 73 20 2d 20  | by n degrees - |
000030f0  63 6c 6f 63 6b 77 69 73  65 20 77 68 65 6e 20 6e  |clockwise when n|
00003100  20 69 73 20 70 6f 73 69  74 69 76 65 2c 0d 0e 60  | is positive,..`|
00003110  29 f4 2b 20 20 61 6e 74  69 63 6c 6f 63 6b 77 69  |).+  anticlockwi|
00003120  73 65 20 77 68 65 6e 20  6e 20 69 73 20 6e 65 67  |se when n is neg|
00003130  61 74 69 76 65 2e 0d 0e  6a 06 f4 2b 0d 0e 74 0e  |ative...j..+..t.|
00003140  dd f2 74 74 75 72 6e 28  6e 29 0d 0e 7e 1a e7 20  |..tturn(n)..~.. |
00003150  5f 54 75 72 74 6c 65 4f  6e 25 20 8c 20 f2 40 74  |_TurtleOn% . .@t|
00003160  64 72 61 77 0d 0e 88 13  5f 54 75 72 74 6c 65 41  |draw...._TurtleA|
00003170  6e 67 6c 65 2b 3d 6e 0d  0e 92 44 e7 20 94 28 5f  |ngle+=n...D. .(_|
00003180  54 75 72 74 6c 65 41 6e  67 6c 65 29 3e 33 36 30  |TurtleAngle)>360|
00003190  20 8c 20 5f 54 75 72 74  6c 65 41 6e 67 6c 65 2d  | . _TurtleAngle-|
000031a0  3d 28 33 36 30 2a 28 5f  54 75 72 74 6c 65 41 6e  |=(360*(_TurtleAn|
000031b0  67 6c 65 20 81 20 33 36  30 29 29 0d 0e 9c 28 e7  |gle . 360))...(.|
000031c0  20 5f 54 75 72 74 6c 65  41 6e 67 6c 65 3c 30 20  | _TurtleAngle<0 |
000031d0  8c 20 5f 54 75 72 74 6c  65 41 6e 67 6c 65 2b 3d  |. _TurtleAngle+=|
000031e0  33 36 30 0d 0e a6 1a e7  20 5f 54 75 72 74 6c 65  |360..... _Turtle|
000031f0  4f 6e 25 20 8c 20 f2 40  74 64 72 61 77 0d 0e b0  |On% . .@tdraw...|
00003200  05 e1 0d 0e ba 04 0d 0e  c4 1d dd a4 74 74 75 72  |............ttur|
00003210  6e 28 6e 29 3a 20 f2 74  74 75 72 6e 28 6e 29 3a  |n(n): .tturn(n):|
00003220  20 3d 30 0d 0e ce 04 0d  0e d8 4b f4 2b 3d 3d 3d  | =0.......K.+===|
00003230  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003270  3d 3d 0d 0e e2 06 f4 2b  0d 0e ec 14 f4 2b 20 20  |==.....+.....+  |
00003280  50 52 4f 43 74 62 65 61  72 28 6e 29 0d 0e f6 06  |PROCtbear(n)....|
00003290  f4 2b 0d 0f 00 42 f4 2b  20 20 4f 72 69 65 6e 74  |.+...B.+  Orient|
000032a0  73 20 74 68 65 20 54 75  72 74 6c 65 20 6f 6e 20  |s the Turtle on |
000032b0  61 20 62 65 61 72 69 6e  67 20 6e 20 64 65 67 72  |a bearing n degr|
000032c0  65 65 73 20 63 6c 6f 63  6b 77 69 73 65 20 6f 66  |ees clockwise of|
000032d0  20 64 75 65 0d 0f 0a 2d  f4 2b 20 20 4e 6f 72 74  | due...-.+  Nort|
000032e0  68 2c 20 77 69 74 68 6f  75 74 20 63 68 61 6e 67  |h, without chang|
000032f0  69 6e 67 20 69 74 73 20  70 6f 73 69 74 69 6f 6e  |ing its position|
00003300  2e 0d 0f 14 06 f4 2b 0d  0f 1e 0e dd f2 74 62 65  |......+......tbe|
00003310  61 72 28 6e 29 0d 0f 28  1a e7 20 5f 54 75 72 74  |ar(n)..(.. _Turt|
00003320  6c 65 4f 6e 25 20 8c 20  f2 40 74 64 72 61 77 0d  |leOn% . .@tdraw.|
00003330  0f 32 23 e7 20 94 28 6e  29 3e 33 36 30 20 8c 20  |.2#. .(n)>360 . |
00003340  6e 2d 3d 28 33 36 30 2a  28 6e 20 81 20 33 36 30  |n-=(360*(n . 360|
00003350  29 29 0d 0f 3c 12 e7 20  6e 3c 30 20 8c 20 6e 2b  |))..<.. n<0 . n+|
00003360  3d 33 36 30 0d 0f 46 12  5f 54 75 72 74 6c 65 41  |=360..F._TurtleA|
00003370  6e 67 6c 65 3d 6e 0d 0f  50 1a e7 20 5f 54 75 72  |ngle=n..P.. _Tur|
00003380  74 6c 65 4f 6e 25 20 8c  20 f2 40 74 64 72 61 77  |tleOn% . .@tdraw|
00003390  0d 0f 5a 05 e1 0d 0f 64  04 0d 0f 6e 1d dd a4 74  |..Z....d...n...t|
000033a0  62 65 61 72 28 6e 29 3a  20 f2 74 62 65 61 72 28  |bear(n): .tbear(|
000033b0  6e 29 3a 20 3d 30 0d 0f  78 04 0d 0f 82 4b f4 2b  |n): =0..x....K.+|
000033c0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003400  3d 3d 3d 3d 3d 0d 0f 8c  06 f4 2b 0d 0f 96 11 f4  |=====.....+.....|
00003410  2b 20 20 50 52 4f 43 74  70 6c 6f 74 0d 0f a0 06  |+  PROCtplot....|
00003420  f4 2b 0d 0f aa 40 f4 2b  20 20 43 61 75 73 65 73  |.+...@.+  Causes|
00003430  20 74 68 65 20 54 75 72  74 6c 65 20 74 6f 20 70  | the Turtle to p|
00003440  6c 6f 74 20 69 74 73 20  63 75 72 72 65 6e 74 20  |lot its current |
00003450  70 6f 73 69 74 69 6f 6e  20 75 73 69 6e 67 20 74  |position using t|
00003460  68 65 0d 0f b4 31 f4 2b  20 20 63 75 72 72 65 6e  |he...1.+  curren|
00003470  74 20 54 75 72 74 6c 65  20 70 65 6e 2d 76 61 6c  |t Turtle pen-val|
00003480  75 65 20 61 6e 64 20 70  6c 6f 74 2d 61 63 74 69  |ue and plot-acti|
00003490  6f 6e 2e 0d 0f be 06 f4  2b 0d 0f c8 0b dd f2 74  |on......+......t|
000034a0  70 6c 6f 74 0d 0f d2 15  e7 20 5f 54 75 72 74 6c  |plot..... _Turtl|
000034b0  65 50 65 6e 4f 6e 25 20  8c 0d 0f dc 29 20 20 20  |ePenOn% ....)   |
000034c0  c8 92 20 a8 28 5f 54 75  72 74 6c 65 58 2b 30 2e  |.. .(_TurtleX+0.|
000034d0  35 29 2c a8 28 5f 54 75  72 74 6c 65 59 2b 30 2e  |5),.(_TurtleY+0.|
000034e0  35 29 0d 0f e6 05 cd 0d  0f f0 05 e1 0d 0f fa 04  |5)..............|
000034f0  0d 10 04 17 dd a4 74 70  6c 6f 74 3a 20 f2 74 70  |......tplot: .tp|
00003500  6c 6f 74 3a 20 3d 30 0d  10 0e 04 0d 10 18 4b f4  |lot: =0.......K.|
00003510  2b 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |+===============|
00003520  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003550  3d 3d 3d 3d 3d 3d 0d 10  22 06 f4 2b 0d 10 2c 1f  |======.."..+..,.|
00003560  f4 2b 20 20 50 52 4f 43  74 61 6c 69 67 6e 28 78  |.+  PROCtalign(x|
00003570  31 2c 79 31 2c 78 32 2c  79 32 29 0d 10 36 06 f4  |1,y1,x2,y2)..6..|
00003580  2b 0d 10 40 43 f4 2b 20  20 41 6c 69 67 6e 73 20  |+..@C.+  Aligns |
00003590  74 68 65 20 54 75 72 74  6c 65 20 77 69 74 68 20  |the Turtle with |
000035a0  74 68 65 20 6c 69 6e 65  20 3c 3c 78 31 2c 79 31  |the line <<x1,y1|
000035b0  3e 2c 3c 78 32 2c 79 32  3e 3e 2c 20 6f 72 69 65  |>,<x2,y2>>, orie|
000035c0  6e 74 65 64 0d 10 4a 3d  f4 2b 20 20 74 6f 77 61  |nted..J=.+  towa|
000035d0  72 64 20 3c 78 32 2c 79  32 3e 2e 20 54 68 65 20  |rd <x2,y2>. The |
000035e0  54 75 72 74 6c 65 27 73  20 70 6f 73 69 74 69 6f  |Turtle's positio|
000035f0  6e 20 69 73 20 6e 6f 74  20 63 68 61 6e 67 65 64  |n is not changed|
00003600  2e 0d 10 54 06 f4 2b 0d  10 5e 19 dd f2 74 61 6c  |...T..+..^...tal|
00003610  69 67 6e 28 78 31 2c 79  31 2c 78 32 2c 79 32 29  |ign(x1,y1,x2,y2)|
00003620  0d 10 68 0f ea 20 78 64  69 66 2c 79 64 69 66 0d  |..h.. xdif,ydif.|
00003630  10 72 0e 78 64 69 66 3d  78 31 2d 78 32 0d 10 7c  |.r.xdif=x1-x2..||
00003640  0e 79 64 69 66 3d 79 31  2d 79 32 0d 10 86 15 e7  |.ydif=y1-y2.....|
00003650  20 78 64 69 66 3e 30 20  84 20 79 64 69 66 3e 30  | xdif>0 . ydif>0|
00003660  0d 10 90 1d 20 20 20 e7  20 5f 54 75 72 74 6c 65  |....   . _Turtle|
00003670  4f 6e 25 20 8c 20 f2 40  74 64 72 61 77 0d 10 9a  |On% . .@tdraw...|
00003680  0d 20 20 20 c8 8e 20 b9  20 ca 0d 10 a4 11 20 20  |.   .. . .....  |
00003690  20 c9 20 20 79 64 69 66  3c 3e 30 0d 10 ae 25 20  | .  ydif<>0...% |
000036a0  20 20 20 20 20 5f 54 75  72 74 6c 65 41 6e 67 6c  |     _TurtleAngl|
000036b0  65 3d 9d 20 99 28 78 64  69 66 2f 79 64 69 66 29  |e=. .(xdif/ydif)|
000036c0  0d 10 b8 10 20 20 20 20  20 20 c8 8e 20 b9 20 ca  |....      .. . .|
000036d0  0d 10 c2 12 20 20 20 20  20 20 c9 20 79 64 69 66  |....      . ydif|
000036e0  3e 30 0d 10 cc 1e 20 20  20 20 20 20 20 20 20 5f  |>0....         _|
000036f0  54 75 72 74 6c 65 41 6e  67 6c 65 2b 3d 31 38 30  |TurtleAngle+=180|
00003700  0d 10 d6 12 20 20 20 20  20 20 c9 20 78 64 69 66  |....      . xdif|
00003710  3e 30 0d 10 e0 1e 20 20  20 20 20 20 20 20 20 5f  |>0....         _|
00003720  54 75 72 74 6c 65 41 6e  67 6c 65 2b 3d 33 36 30  |TurtleAngle+=360|
00003730  0d 10 ea 0b 20 20 20 20  20 20 cb 0d 10 f4 08 20  |....      ..... |
00003740  20 20 7f 0d 10 fe 14 20  20 20 20 20 20 e7 20 78  |  .....      . x|
00003750  64 69 66 3c 30 20 8c 0d  11 08 1c 20 20 20 20 20  |dif<0 .....     |
00003760  20 20 20 20 5f 54 75 72  74 6c 65 41 6e 67 6c 65  |    _TurtleAngle|
00003770  3d 39 30 0d 11 12 0b 20  20 20 20 20 20 cc 0d 11  |=90....      ...|
00003780  1c 1d 20 20 20 20 20 20  20 20 20 5f 54 75 72 74  |..         _Turt|
00003790  6c 65 41 6e 67 6c 65 3d  32 37 30 0d 11 26 0b 20  |leAngle=270..&. |
000037a0  20 20 20 20 20 cd 0d 11  30 08 20 20 20 cb 0d 11  |     ...0.   ...|
000037b0  3a 1d 20 20 20 e7 20 5f  54 75 72 74 6c 65 4f 6e  |:.   . _TurtleOn|
000037c0  25 20 8c 20 f2 40 74 64  72 61 77 0d 11 44 05 cd  |% . .@tdraw..D..|
000037d0  0d 11 4e 05 e1 0d 11 58  04 0d 11 62 33 dd a4 74  |..N....X...b3..t|
000037e0  61 6c 69 67 6e 28 78 31  2c 79 31 2c 78 32 2c 79  |align(x1,y1,x2,y|
000037f0  32 29 3a 20 f2 74 61 6c  69 67 6e 28 78 31 2c 79  |2): .talign(x1,y|
00003800  31 2c 78 32 2c 79 32 29  3a 20 3d 30 0d 11 6c 04  |1,x2,y2): =0..l.|
00003810  0d 11 76 4b f4 2b 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |..vK.+==========|
00003820  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003850  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 0d 11 80 06 f4  |===========.....|
00003860  2b 0d 11 8a 17 f4 2b 20  20 50 52 4f 43 74 70 6f  |+.....+  PROCtpo|
00003870  69 6e 74 28 78 2c 79 29  0d 11 94 06 f4 2b 0d 11  |int(x,y).....+..|
00003880  9e 46 f4 2b 20 20 4f 72  69 65 6e 74 73 20 74 68  |.F.+  Orients th|
00003890  65 20 54 75 72 74 6c 65  20 74 6f 77 61 72 64 20  |e Turtle toward |
000038a0  3c 78 2c 79 3e 20 77 69  74 68 6f 75 74 20 63 68  |<x,y> without ch|
000038b0  61 6e 67 69 6e 67 20 69  74 73 20 70 6f 73 69 74  |anging its posit|
000038c0  69 6f 6e 2e 0d 11 a8 06  f4 2b 0d 11 b2 11 dd f2  |ion......+......|
000038d0  74 70 6f 69 6e 74 28 78  2c 79 29 0d 11 bc 22 f2  |tpoint(x,y)...".|
000038e0  74 61 6c 69 67 6e 28 5f  54 75 72 74 6c 65 58 2c  |talign(_TurtleX,|
000038f0  5f 54 75 72 74 6c 65 59  2c 78 2c 79 29 0d 11 c6  |_TurtleY,x,y)...|
00003900  05 e1 0d 11 d0 04 0d 11  da 23 dd a4 74 70 6f 69  |.........#..tpoi|
00003910  6e 74 28 78 2c 79 29 3a  20 f2 74 70 6f 69 6e 74  |nt(x,y): .tpoint|
00003920  28 78 2c 79 29 3a 20 3d  30 0d 11 e4 04 0d 11 ee  |(x,y): =0.......|
00003930  4b f4 2b 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |K.+=============|
00003940  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003970  3d 3d 3d 3d 3d 3d 3d 3d  0d 11 f8 06 f4 2b 0d 12  |========.....+..|
00003980  02 1d f4 2b 20 20 50 52  4f 43 74 64 6f 28 61 28  |...+  PROCtdo(a(|
00003990  29 2c 73 25 2c 65 25 2c  6e 25 29 0d 12 0c 06 f4  |),s%,e%,n%).....|
000039a0  2b 0d 12 16 29 f4 2b 20  20 53 65 65 20 53 74 6f  |+...).+  See Sto|
000039b0  72 65 64 20 54 75 72 74  6c 65 2d 73 74 61 74 65  |red Turtle-state|
000039c0  20 52 6f 75 74 69 6e 65  73 2e 0d 12 20 06 f4 2b  | Routines... ..+|
000039d0  0d 12 2a 4b f4 2b 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |..*K.+==========|
000039e0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003a10  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 0d 12 34 4b f4  |===========..4K.|
00003a20  2b 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |+===============|
00003a30  3d 3d 3d 3d 20 54 75 72  74 6c 65 20 53 74 61 63  |==== Turtle Stac|
00003a40  6b 20 52 6f 75 74 69 6e  65 73 20 3d 3d 3d 3d 3d  |k Routines =====|
00003a50  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00003a60  3d 3d 3d 3d 3d 3d 0d 12  3e 04 0d 12 48 43 f4 2b  |======..>...HC.+|
00003a70  20 20 4e 2e 42 2e 20 20  52 6f 75 74 69 6e 65 73  |  N.B.  Routines|
00003a80  20 66 6f 72 20 6d 61 6e  69 70 75 6c 61 74 69 6e  | for manipulatin|
00003a90  67 20 74 68 65 20 54 75  72 74 6c 65 2d 73 74 61  |g the Turtle-sta|
00003aa0  63 6b 20 63 61 6e 20 65  61 73 69 6c 79 0d 12 52  |ck can easily..R|
00003ab0  44 f4 2b 20 20 72 65 73  75 6c 74 20 69 6e 20 67  |D.+  result in g|
00003ac0  61 72 62 61 67 65 20 62  65 69 6e 67 20 73 74 6f  |arbage being sto|
00003ad0  72 65 64 20 61 6e 64 20  73 68 6f 75 6c 64 20 62  |red and should b|
00003ae0  65 20 75 73 65 64 20 77  69 74 68 20 63 61 72 65  |e used with care|
00003af0  2e 0d 12 5c 04 0d 12 66  4b f4 2b 3d 3d 3d 3d 3d  |...\...fK.+=====|
00003b00  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003b40  0d 12 70 06 f4 2b 0d 12  7a 16 f4 2b 20 20 50 52  |..p..+..z..+  PR|
00003b50  4f 43 74 73 74 61 63 6b  28 6e 25 29 0d 12 84 06  |OCtstack(n%)....|
00003b60  f4 2b 0d 12 8e 44 f4 2b  20 20 41 6c 6c 6f 63 61  |.+...D.+  Alloca|
00003b70  74 65 73 20 54 75 72 74  6c 65 2d 73 74 61 63 6b  |tes Turtle-stack|
00003b80  20 66 6f 72 20 72 65 63  6f 72 64 69 6e 67 20 75  | for recording u|
00003b90  70 20 74 6f 20 6e 25 20  54 75 72 74 6c 65 2d 73  |p to n% Turtle-s|
00003ba0  74 61 74 65 73 2c 0d 12  98 3c f4 2b 20 20 77 68  |tates,...<.+  wh|
00003bb0  65 72 65 20 61 20 54 75  72 74 6c 65 2d 73 74 61  |ere a Turtle-sta|
00003bc0  74 65 20 3d 20 3c 54 75  72 74 6c 65 58 2c 54 75  |te = <TurtleX,Tu|
00003bd0  72 74 6c 65 59 2c 54 75  72 74 6c 65 41 6e 67 6c  |rtleY,TurtleAngl|
00003be0  65 2c 0d 12 a2 37 f4 2b  20 20 54 75 72 74 6c 65  |e,...7.+  Turtle|
00003bf0  46 43 6f 6c 25 2c 54 75  72 74 6c 65 46 50 6c 6f  |FCol%,TurtleFPlo|
00003c00  74 25 3e 2e 20 54 68 65  20 73 74 61 63 6b 2d 70  |t%>. The stack-p|
00003c10  6f 69 6e 74 65 72 20 69  73 0d 12 ac 44 f4 2b 20  |ointer is...D.+ |
00003c20  20 69 6e 69 74 69 61 6c  69 73 65 64 20 74 6f 20  | initialised to |
00003c30  2d 31 2e 20 54 68 65 20  73 74 61 63 6b 20 70 6f  |-1. The stack po|
00003c40  69 6e 74 65 72 20 69 73  20 69 6e 63 72 65 6d 65  |inter is increme|
00003c50  6e 74 65 64 20 62 65 66  6f 72 65 20 61 0d 12 b6  |nted before a...|
00003c60  45 f4 2b 20 20 54 75 72  74 6c 65 2d 73 74 61 74  |E.+  Turtle-stat|
00003c70  65 20 69 73 20 72 65 63  6f 72 64 65 64 20 61 6e  |e is recorded an|
00003c80  64 20 64 65 63 72 65 6d  65 6e 74 65 64 20 61 66  |d decremented af|
00003c90  74 65 72 20 61 20 54 75  72 74 6c 65 2d 73 74 61  |ter a Turtle-sta|
00003ca0  74 65 0d 12 c0 15 f4 2b  20 20 69 73 20 72 65 74  |te.....+  is ret|
00003cb0  72 69 65 76 65 64 2e 0d  12 ca 06 f4 2b 0d 12 d4  |rieved......+...|
00003cc0  42 f4 2b 20 20 42 79 20  72 65 63 6f 72 64 69 6e  |B.+  By recordin|
00003cd0  67 20 54 75 72 74 6c 65  2d 73 74 61 74 65 73 20  |g Turtle-states |
00003ce0  6f 6e 20 74 68 65 20 73  74 61 63 6b 2c 20 61 20  |on the stack, a |
00003cf0  73 68 61 70 65 20 67 65  6e 65 72 61 74 65 64 0d  |shape generated.|
00003d00  12 de 3e f4 2b 20 20 62  79 20 74 68 65 20 54 75  |..>.+  by the Tu|
00003d10  72 74 6c 65 20 6d 61 79  20 62 65 20 73 74 6f 72  |rtle may be stor|
00003d20  65 64 2c 20 69 6e 20 6f  72 64 65 72 20 74 6f 20  |ed, in order to |
00003d30  62 65 20 72 65 70 72 6f  64 75 63 65 64 0d 12 e8  |be reproduced...|
00003d40  41 f4 2b 20 20 72 61 70  69 64 6c 79 20 61 74 20  |A.+  rapidly at |
00003d50  6c 61 74 65 72 20 74 69  6d 65 2c 20 70 65 72 68  |later time, perh|
00003d60  61 70 73 20 61 66 74 65  72 20 61 20 74 72 61 6e  |aps after a tran|
00003d70  73 66 6f 72 6d 61 74 69  6f 6e 20 68 61 73 0d 12  |sformation has..|
00003d80  f2 15 f4 2b 20 20 62 65  65 6e 20 61 70 70 6c 69  |...+  been appli|
00003d90  65 64 2e 0d 12 fc 06 f4  2b 0d 13 06 3f f4 2b 20  |ed......+...?.+ |
00003da0  20 54 68 65 20 54 75 72  74 6c 65 2d 73 74 61 63  | The Turtle-stac|
00003db0  6b 20 6d 61 79 20 61 6c  73 6f 20 62 65 20 75 73  |k may also be us|
00003dc0  65 64 20 74 6f 20 6f 70  65 72 61 74 65 20 74 68  |ed to operate th|
00003dd0  65 20 54 75 72 74 6c 65  0d 13 10 14 f4 2b 20 20  |e Turtle.....+  |
00003de0  72 65 63 75 72 73 69 76  65 6c 79 2e 0d 13 1a 06  |recursively.....|
00003df0  f4 2b 0d 13 24 46 f4 2b  20 20 49 6e 20 73 6f 6d  |.+..$F.+  In som|
00003e00  65 20 63 61 73 65 73 20  69 74 20 69 73 20 63 6f  |e cases it is co|
00003e10  6e 76 65 6e 69 65 6e 74  20 74 6f 20 68 61 76 65  |nvenient to have|
00003e20  20 61 20 54 75 72 74 6c  65 2d 73 74 61 63 6b 20  | a Turtle-stack |
00003e30  77 68 69 63 68 20 69 73  0d 13 2e 45 f4 2b 20 20  |which is...E.+  |
00003e40  6c 6f 63 61 6c 20 74 6f  20 61 20 28 70 6f 73 73  |local to a (poss|
00003e50  69 62 6c 79 20 72 65 63  75 72 73 69 76 65 29 20  |ibly recursive) |
00003e60  72 6f 75 74 69 6e 65 2e  20 4f 62 76 69 6f 75 73  |routine. Obvious|
00003e70  6c 79 20 50 52 4f 43 74  73 74 61 63 6b 0d 13 38  |ly PROCtstack..8|
00003e80  44 f4 2b 20 20 64 6f 65  73 20 6e 6f 74 20 70 72  |D.+  does not pr|
00003e90  6f 76 69 64 65 20 74 68  69 73 2e 20 57 69 74 68  |ovide this. With|
00003ea0  69 6e 20 74 68 65 20 72  6f 75 74 69 6e 65 20 79  |in the routine y|
00003eb0  6f 75 20 73 68 6f 75 6c  64 20 75 73 65 20 74 68  |ou should use th|
00003ec0  65 0d 13 42 0d f4 2b 20  20 63 6f 64 65 3a 0d 13  |e..B..+  code:..|
00003ed0  4c 06 f4 2b 0d 13 56 1c  f4 2b 20 20 4c 4f 43 41  |L..+..V..+  LOCA|
00003ee0  4c 20 5f 54 75 72 74 6c  65 53 74 61 63 6b 28 29  |L _TurtleStack()|
00003ef0  0d 13 60 1e f4 2b 20 20  44 49 4d 20 5f 54 75 72  |..`..+  DIM _Tur|
00003f00  74 6c 65 53 74 61 63 6b  28 6e 25 2c 33 29 0d 13  |tleStack(n%,3)..|
00003f10  6a 16 f4 2b 20 20 5f 54  75 72 74 6c 65 47 65 6e  |j..+  _TurtleGen|
00003f20  25 3d 2d 31 0d 13 74 1a  f4 2b 20 20 5f 54 75 72  |%=-1..t..+  _Tur|
00003f30  74 6c 65 53 74 61 63 6b  25 3d 54 52 55 45 0d 13  |tleStack%=TRUE..|
00003f40  7e 06 f4 2b 0d 13 88 10  dd f2 74 73 74 61 63 6b  |~..+......tstack|
00003f50  28 6e 25 29 0d 13 92 2a  e7 20 5f 54 75 72 74 6c  |(n%)...*. _Turtl|
00003f60  65 53 74 61 63 6b 25 20  8c 20 f2 40 74 65 72 72  |eStack% . .@terr|
00003f70  6f 72 28 30 2c 22 74 73  74 61 63 6b 22 29 0d 13  |or(0,"tstack")..|
00003f80  9c 18 de 20 5f 54 75 72  74 6c 65 53 74 61 63 6b  |... _TurtleStack|
00003f90  28 6e 25 2c 33 29 0d 13  a6 12 5f 54 75 72 74 6c  |(n%,3)...._Turtl|
00003fa0  65 47 65 6e 25 3d 2d 31  0d 13 b0 13 5f 54 75 72  |eGen%=-1...._Tur|
00003fb0  74 6c 65 53 74 61 63 6b  25 3d b9 0d 13 ba 05 e1  |tleStack%=......|
00003fc0  0d 13 c4 04 0d 13 ce 21  dd a4 74 73 74 61 63 6b  |.......!..tstack|
00003fd0  28 6e 25 29 3a 20 f2 74  73 74 61 63 6b 28 6e 25  |(n%): .tstack(n%|
00003fe0  29 3a 20 3d 30 0d 13 d8  04 0d 13 e2 4b f4 2b 3d  |): =0.......K.+=|
00003ff0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00004030  3d 3d 3d 3d 0d 13 ec 06  f4 2b 0d 13 f6 17 f4 2b  |====.....+.....+|
00004040  20 20 50 52 4f 43 74 6d  65 6d 73 65 74 28 6e 25  |  PROCtmemset(n%|
00004050  29 0d 14 00 06 f4 2b 0d  14 0a 34 f4 2b 20 20 53  |).....+...4.+  S|
00004060  65 74 73 20 74 68 65 20  54 75 72 74 6c 65 2d 73  |ets the Turtle-s|
00004070  74 61 63 6b 20 70 6f 69  6e 74 65 72 20 74 6f 20  |tack pointer to |
00004080  70 6f 73 69 74 69 6f 6e  20 6e 25 0d 14 14 49 f4  |position n%...I.|
00004090  2b 20 20 52 65 6d 65 6d  62 65 72 20 74 68 61 74  |+  Remember that|
000040a0  20 50 52 4f 43 74 72 65  63 6f 72 64 20 77 69 6c  | PROCtrecord wil|
000040b0  6c 20 66 69 72 73 74 20  69 6e 63 72 65 6d 65 6e  |l first incremen|
000040c0  74 20 74 68 65 20 73 74  61 63 6b 2d 70 6f 69 6e  |t the stack-poin|
000040d0  74 65 72 2e 0d 14 1e 06  f4 2b 0d 14 28 11 dd f2  |ter......+..(...|
000040e0  74 6d 65 6d 73 65 74 28  6e 25 29 0d 14 32 2d e7  |tmemset(n%)..2-.|
000040f0  20 ac 20 5f 54 75 72 74  6c 65 53 74 61 63 6b 25  | . _TurtleStack%|
00004100  20 8c 20 f2 40 74 65 72  72 6f 72 28 31 2c 22 74  | . .@terror(1,"t|
00004110  6d 65 6d 73 65 74 22 29  0d 14 3c 12 5f 54 75 72  |memset")..<._Tur|
00004120  74 6c 65 47 65 6e 25 3d  6e 25 0d 14 46 05 e1 0d  |tleGen%=n%..F...|
00004130  14 50 04 0d 14 5a 23 dd  a4 74 6d 65 6d 73 65 74  |.P...Z#..tmemset|
00004140  28 6e 25 29 3a 20 f2 74  6d 65 6d 73 65 74 28 6e  |(n%): .tmemset(n|
00004150  25 29 3a 20 3d 30 0d 14  64 04 0d 14 6e 4b f4 2b  |%): =0..d...nK.+|
00004160  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
000041a0  3d 3d 3d 3d 3d 0d 14 78  06 f4 2b 0d 14 82 18 f4  |=====..x..+.....|
000041b0  2b 20 20 50 52 4f 43 74  6d 65 6d 6d 6f 76 65 28  |+  PROCtmemmove(|
000041c0  6e 25 29 0d 14 8c 06 f4  2b 0d 14 96 3b f4 2b 20  |n%).....+...;.+ |
000041d0  20 4d 6f 76 65 73 20 74  68 65 20 54 75 72 74 6c  | Moves the Turtl|
000041e0  65 2d 73 74 61 63 6b 20  70 6f 69 6e 74 65 72 20  |e-stack pointer |
000041f0  66 6f 72 77 61 72 64 20  6e 25 20 70 6f 73 69 74  |forward n% posit|
00004200  69 6f 6e 73 0d 14 a0 3e  f4 2b 20 20 28 69 66 20  |ions...>.+  (if |
00004210  6e 25 20 69 73 20 70 6f  73 69 74 69 76 65 29 20  |n% is positive) |
00004220  6f 72 20 62 61 63 6b 77  61 72 64 20 6e 25 20 70  |or backward n% p|
00004230  6f 73 69 74 69 6f 6e 73  20 28 69 66 20 6e 25 20  |ositions (if n% |
00004240  69 73 0d 14 aa 15 f4 2b  20 20 6e 6f 74 20 70 6f  |is.....+  not po|
00004250  73 69 74 69 76 65 29 0d  14 b4 49 f4 2b 20 20 52  |sitive)...I.+  R|
00004260  65 6d 65 6d 62 65 72 20  74 68 61 74 20 50 52 4f  |emember that PRO|
00004270  43 74 72 65 63 6f 72 64  20 77 69 6c 6c 20 66 69  |Ctrecord will fi|
00004280  72 73 74 20 69 6e 63 72  65 6d 65 6e 74 20 74 68  |rst increment th|
00004290  65 20 73 74 61 63 6b 2d  70 6f 69 6e 74 65 72 2e  |e stack-pointer.|
000042a0  0d 14 be 06 f4 2b 0d 14  c8 12 dd f2 74 6d 65 6d  |.....+......tmem|
000042b0  6d 6f 76 65 28 6e 25 29  0d 14 d2 08 ea 20 70 25  |move(n%)..... p%|
000042c0  0d 14 dc 2e e7 20 ac 20  5f 54 75 72 74 6c 65 53  |..... . _TurtleS|
000042d0  74 61 63 6b 25 20 8c 20  f2 40 74 65 72 72 6f 72  |tack% . .@terror|
000042e0  28 31 2c 22 74 6d 65 6d  6d 6f 76 65 22 29 0d 14  |(1,"tmemmove")..|
000042f0  e6 15 70 25 3d 5f 54 75  72 74 6c 65 47 65 6e 25  |..p%=_TurtleGen%|
00004300  2b 6e 25 0d 14 f0 12 5f  54 75 72 74 6c 65 47 65  |+n%...._TurtleGe|
00004310  6e 25 3d 70 25 0d 14 fa  05 e1 0d 15 04 04 0d 15  |n%=p%...........|
00004320  0e 25 dd a4 74 6d 65 6d  6d 6f 76 65 28 6e 25 29  |.%..tmemmove(n%)|
00004330  3a 20 f2 74 6d 65 6d 6d  6f 76 65 28 6e 25 29 3a  |: .tmemmove(n%):|
00004340  20 3d 30 0d 15 18 04 0d  15 22 4b f4 2b 3d 3d 3d  | =0......"K.+===|
00004350  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00004390  3d 3d 0d 15 2c 06 f4 2b  0d 15 36 13 f4 2b 20 20  |==..,..+..6..+  |
000043a0  50 52 4f 43 74 72 65 63  6f 72 64 0d 15 40 06 f4  |PROCtrecord..@..|
000043b0  2b 0d 15 4a 39 f4 2b 20  20 49 6e 63 72 65 6d 65  |+..J9.+  Increme|
000043c0  6e 74 73 20 74 68 65 20  54 75 72 74 6c 65 2d 73  |nts the Turtle-s|
000043d0  74 61 63 6b 20 70 6f 69  6e 74 65 72 2c 20 74 68  |tack pointer, th|
000043e0  65 6e 20 72 65 63 6f 72  64 73 0d 15 54 2e f4 2b  |en records..T..+|
000043f0  20 20 74 68 65 20 63 75  72 72 65 6e 74 20 54 75  |  the current Tu|
00004400  72 74 6c 65 2d 73 74 61  74 65 20 6f 6e 20 74 68  |rtle-state on th|
00004410  65 20 73 74 61 63 6b 2e  0d 15 5e 06 f4 2b 0d 15  |e stack...^..+..|
00004420  68 0d dd f2 74 72 65 63  6f 72 64 0d 15 72 2d e7  |h...trecord..r-.|
00004430  20 ac 20 5f 54 75 72 74  6c 65 53 74 61 63 6b 25  | . _TurtleStack%|
00004440  20 8c 20 f2 40 74 65 72  72 6f 72 28 31 2c 22 74  | . .@terror(1,"t|
00004450  72 65 63 6f 72 64 22 29  0d 15 7c 12 5f 54 75 72  |record")..|._Tur|
00004460  74 6c 65 47 65 6e 25 2b  3d 31 0d 15 86 4d e7 20  |tleGen%+=1...M. |
00004470  5f 54 75 72 74 6c 65 47  65 6e 25 3c 30 20 84 20  |_TurtleGen%<0 . |
00004480  5f 54 75 72 74 6c 65 47  65 6e 25 3e de 28 5f 54  |_TurtleGen%>.(_T|
00004490  75 72 74 6c 65 53 74 61  63 6b 28 29 2c 31 29 20  |urtleStack(),1) |
000044a0  8c 20 f2 40 74 65 72 72  6f 72 28 32 2c 22 74 72  |. .@terror(2,"tr|
000044b0  65 63 6f 72 64 22 29 0d  15 90 28 5f 54 75 72 74  |ecord")...(_Turt|
000044c0  6c 65 53 74 61 63 6b 28  5f 54 75 72 74 6c 65 47  |leStack(_TurtleG|
000044d0  65 6e 25 2c 30 29 3d 5f  54 75 72 74 6c 65 58 0d  |en%,0)=_TurtleX.|
000044e0  15 9a 28 5f 54 75 72 74  6c 65 53 74 61 63 6b 28  |..(_TurtleStack(|
000044f0  5f 54 75 72 74 6c 65 47  65 6e 25 2c 31 29 3d 5f  |_TurtleGen%,1)=_|
00004500  54 75 72 74 6c 65 59 0d  15 a4 2c 5f 54 75 72 74  |TurtleY...,_Turt|
00004510  6c 65 53 74 61 63 6b 28  5f 54 75 72 74 6c 65 47  |leStack(_TurtleG|
00004520  65 6e 25 2c 32 29 3d 5f  54 75 72 74 6c 65 41 6e  |en%,2)=_TurtleAn|
00004530  67 6c 65 0d 15 ae 3d 5f  54 75 72 74 6c 65 53 74  |gle...=_TurtleSt|
00004540  61 63 6b 28 5f 54 75 72  74 6c 65 47 65 6e 25 2c  |ack(_TurtleGen%,|
00004550  33 29 3d 5f 54 75 72 74  6c 65 46 43 6f 6c 25 3c  |3)=_TurtleFCol%<|
00004560  3c 33 2b 5f 54 75 72 74  6c 65 46 50 6c 6f 74 25  |<3+_TurtleFPlot%|
00004570  0d 15 b8 05 e1 0d 15 c2  04 0d 15 cc 1b dd a4 74  |...............t|
00004580  72 65 63 6f 72 64 3a 20  f2 74 72 65 63 6f 72 64  |record: .trecord|
00004590  3a 20 3d 30 0d 15 d6 04  0d 15 e0 4b f4 2b 3d 3d  |: =0.......K.+==|
000045a0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
000045e0  3d 3d 3d 0d 15 ea 4b f4  2b 3d 3d 3d 3d 3d 3d 3d  |===...K.+=======|
000045f0  3d 3d 3d 3d 3d 3d 3d 3d  3d 20 53 74 6f 72 65 64  |========= Stored|
00004600  20 54 75 72 74 6c 65 2d  73 74 61 74 65 20 52 6f  | Turtle-state Ro|
00004610  75 74 69 6e 65 73 20 3d  3d 3d 3d 3d 3d 3d 3d 3d  |utines =========|
00004620  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 0d 15  |==============..|
00004630  f4 4b f4 2b 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.K.+============|
00004640  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00004670  3d 3d 3d 3d 3d 3d 3d 3d  3d 0d 15 fe 06 f4 2b 0d  |=========.....+.|
00004680  16 08 25 f4 2b 20 20 50  52 4f 43 74 67 65 74 73  |..%.+  PROCtgets|
00004690  74 61 63 6b 28 61 28 29  2c 73 31 25 2c 73 32 25  |tack(a(),s1%,s2%|
000046a0  2c 65 25 29 0d 16 12 06  f4 2b 0d 16 1c 43 f4 2b  |,e%).....+...C.+|
000046b0  20 20 43 6f 70 79 73 20  61 20 73 65 67 6d 65 6e  |  Copys a segmen|
000046c0  74 20 6f 66 20 74 68 65  20 54 75 72 74 6c 65 2d  |t of the Turtle-|
000046d0  73 74 61 63 6b 20 69 6e  74 6f 20 61 28 29 2c 20  |stack into a(), |
000046e0  77 68 69 63 68 20 6d 75  73 74 20 62 65 0d 16 26  |which must be..&|
000046f0  45 f4 2b 20 20 64 65 63  6c 61 72 65 64 20 77 69  |E.+  declared wi|
00004700  74 68 20 74 68 65 20 66  6f 72 6d 20 44 49 4d 20  |th the form DIM |
00004710  61 28 6e 25 2c 33 29 2e  20 54 68 65 20 73 65 67  |a(n%,3). The seg|
00004720  6d 65 6e 74 20 63 6f 70  69 65 64 20 62 65 67 69  |ment copied begi|
00004730  6e 73 0d 16 30 44 f4 2b  20 20 61 74 20 70 6f 73  |ns..0D.+  at pos|
00004740  69 74 69 6f 6e 20 73 32  25 20 61 6e 64 20 65 6e  |ition s2% and en|
00004750  64 73 20 61 74 20 70 6f  73 69 74 69 6f 6e 20 65  |ds at position e|
00004760  25 2e 20 49 46 20 65 25  20 70 72 65 63 65 64 65  |%. IF e% precede|
00004770  73 20 73 32 25 2c 0d 16  3a 43 f4 2b 20 20 74 68  |s s2%,..:C.+  th|
00004780  65 6e 20 74 68 65 20 73  65 67 6d 65 6e 74 20 69  |en the segment i|
00004790  73 20 63 6f 70 69 65 64  20 69 6e 20 72 65 76 65  |s copied in reve|
000047a0  72 73 65 2e 20 50 6f 73  69 74 69 6f 6e 73 20 69  |rse. Positions i|
000047b0  6e 20 61 28 29 20 61 72  65 0d 16 44 40 f4 2b 20  |n a() are..D@.+ |
000047c0  20 6f 63 63 75 70 69 65  64 20 73 74 61 72 74 69  | occupied starti|
000047d0  6e 67 20 61 74 20 73 31  25 2e 20 54 68 69 73 20  |ng at s1%. This |
000047e0  72 6f 75 74 69 6e 65 20  65 66 66 65 63 74 69 76  |routine effectiv|
000047f0  65 6c 79 20 73 61 76 65  73 0d 16 4e 42 f4 2b 20  |ely saves..NB.+ |
00004800  20 61 20 73 68 61 70 65  20 67 65 6e 65 72 61 74  | a shape generat|
00004810  65 64 20 62 79 20 74 68  65 20 54 75 72 74 6c 65  |ed by the Turtle|
00004820  2c 20 61 6c 6f 6e 67 20  77 69 74 68 20 74 68 65  |, along with the|
00004830  20 61 73 73 6f 63 69 61  74 65 64 0d 16 58 43 f4  | associated..XC.|
00004840  2b 20 20 6f 72 69 65 6e  74 61 74 69 6f 6e 73 2c  |+  orientations,|
00004850  20 63 6f 6c 6f 75 72 73  20 61 6e 64 20 70 6c 6f  | colours and plo|
00004860  74 2d 61 63 74 69 6f 6e  73 2e 20 54 68 65 20 63  |t-actions. The c|
00004870  6f 6e 74 65 6e 74 73 20  6f 66 20 74 68 65 0d 16  |ontents of the..|
00004880  62 47 f4 2b 20 20 74 61  72 67 65 74 20 61 72 72  |bG.+  target arr|
00004890  61 79 20 6d 61 79 20 62  65 20 6d 61 6e 69 70 75  |ay may be manipu|
000048a0  6c 61 74 65 64 20 74 6f  20 61 6c 74 65 72 20 74  |lated to alter t|
000048b0  68 65 20 73 68 61 70 65  2c 20 74 68 65 20 63 6f  |he shape, the co|
000048c0  6c 6f 75 72 73 0d 16 6c  41 f4 2b 20 20 6f 72 20  |lours..lA.+  or |
000048d0  74 68 65 20 70 6c 6f 74  2d 61 63 74 69 6f 6e 73  |the plot-actions|
000048e0  2e 20 54 68 65 20 73 74  61 63 6b 20 6d 61 79 20  |. The stack may |
000048f0  62 65 20 66 72 65 65 64  20 66 6f 72 20 72 65 63  |be freed for rec|
00004900  6f 72 64 69 6e 67 0d 16  76 17 f4 2b 20 20 66 75  |ording..v..+  fu|
00004910  72 74 68 65 72 20 73 68  61 70 65 73 2e 0d 16 80  |rther shapes....|
00004920  06 f4 2b 0d 16 8a 48 f4  2b 20 20 54 68 65 20 66  |..+...H.+  The f|
00004930  6f 72 6d 61 74 20 6f 66  20 69 6e 20 77 68 69 63  |ormat of in whic|
00004940  68 20 54 75 72 74 6c 65  2d 73 74 61 74 65 73 20  |h Turtle-states |
00004950  61 72 65 20 68 65 6c 64  20 61 6e 64 20 74 72 61  |are held and tra|
00004960  6e 73 66 65 72 72 65 64  20 69 73 0d 16 94 06 f4  |nsferred is.....|
00004970  2b 0d 16 9e 1a f4 2b 20  20 20 20 20 61 28 6e 25  |+.....+     a(n%|
00004980  2c 30 29 3d 54 75 72 74  6c 65 58 0d 16 a8 1a f4  |,0)=TurtleX.....|
00004990  2b 20 20 20 20 20 61 28  6e 25 2c 31 29 3d 54 75  |+     a(n%,1)=Tu|
000049a0  72 74 6c 65 59 0d 16 b2  1e f4 2b 20 20 20 20 20  |rtleY.....+     |
000049b0  61 28 6e 25 2c 32 29 3d  54 75 72 74 6c 65 41 6e  |a(n%,2)=TurtleAn|
000049c0  67 6c 65 0d 16 bc 2e f4  2b 20 20 20 20 20 61 28  |gle.....+     a(|
000049d0  6e 25 2c 33 29 3d 54 75  72 74 6c 65 46 43 6f 6c  |n%,3)=TurtleFCol|
000049e0  25 3c 3c 33 2b 54 75 72  74 6c 65 46 50 6c 6f 74  |%<<3+TurtleFPlot|
000049f0  25 0d 16 c6 06 f4 2b 0d  16 d0 45 f4 2b 20 20 52  |%.....+...E.+  R|
00004a00  6f 75 74 69 6e 65 73 20  61 72 65 20 70 72 6f 76  |outines are prov|
00004a10  69 64 65 64 20 66 6f 72  20 69 6e 64 65 70 65 6e  |ided for indepen|
00004a20  64 65 6e 74 6c 79 20 73  65 74 74 69 6e 67 20 74  |dently setting t|
00004a30  68 65 20 63 6f 6c 6f 75  72 20 6f 72 0d 16 da 2e  |he colour or....|
00004a40  f4 2b 20 20 70 6c 6f 74  2d 61 63 74 69 6f 6e 20  |.+  plot-action |
00004a50  69 6e 20 61 20 76 61 6c  75 65 20 6f 66 20 74 79  |in a value of ty|
00004a60  70 65 20 61 28 6e 25 2c  33 29 0d 16 e4 06 f4 2b  |pe a(n%,3).....+|
00004a70  0d 16 ee 1f dd f2 74 67  65 74 73 74 61 63 6b 28  |......tgetstack(|
00004a80  61 28 29 2c 73 31 25 2c  73 32 25 2c 65 25 29 0d  |a(),s1%,s2%,e%).|
00004a90  16 f8 0f ea 20 65 32 25  2c 73 74 65 70 25 0d 17  |.... e2%,step%..|
00004aa0  02 17 65 32 25 3d 73 31  25 2b 94 28 65 25 2d 73  |..e2%=s1%+.(e%-s|
00004ab0  32 25 29 2d 31 0d 17 0c  2f e7 20 ac 20 5f 54 75  |2%)-1.../. . _Tu|
00004ac0  72 74 6c 65 53 74 61 63  6b 25 20 8c 20 f2 40 74  |rtleStack% . .@t|
00004ad0  65 72 72 6f 72 28 31 2c  22 74 67 65 74 73 74 61  |error(1,"tgetsta|
00004ae0  63 6b 22 29 0d 17 16 29  e7 20 de 28 61 28 29 29  |ck")...). .(a())|
00004af0  3c 3e 32 20 8c 20 f2 40  74 65 72 72 6f 72 28 33  |<>2 . .@terror(3|
00004b00  2c 22 74 67 65 74 73 74  61 63 6b 22 29 0d 17 20  |,"tgetstack").. |
00004b10  2a e7 20 de 28 61 28 29  2c 32 29 3c 33 20 8c 20  |*. .(a(),2)<3 . |
00004b20  f2 40 74 65 72 72 6f 72  28 33 2c 22 74 67 65 74  |.@terror(3,"tget|
00004b30  73 74 61 63 6b 22 29 0d  17 2a 3f e7 20 73 32 25  |stack")..*?. s2%|
00004b40  3c 30 20 84 20 73 32 25  3e de 28 5f 54 75 72 74  |<0 . s2%>.(_Turt|
00004b50  6c 65 53 74 61 63 6b 28  29 2c 31 29 20 8c 20 f2  |leStack(),1) . .|
00004b60  40 74 65 72 72 6f 72 28  32 2c 22 74 67 65 74 73  |@terror(2,"tgets|
00004b70  74 61 63 6b 22 29 0d 17  34 3d e7 20 65 25 3c 30  |tack")..4=. e%<0|
00004b80  20 84 20 65 25 3e de 28  5f 54 75 72 74 6c 65 53  | . e%>.(_TurtleS|
00004b90  74 61 63 6b 28 29 2c 31  29 20 8c 20 f2 40 74 65  |tack(),1) . .@te|
00004ba0  72 72 6f 72 28 32 2c 22  74 67 65 74 73 74 61 63  |rror(2,"tgetstac|
00004bb0  6b 22 29 0d 17 3e 34 e7  20 73 31 25 3c 30 20 84  |k")..>4. s1%<0 .|
00004bc0  20 73 31 25 3e de 28 61  28 29 2c 31 29 20 8c 20  | s1%>.(a(),1) . |
00004bd0  f2 40 74 65 72 72 6f 72  28 34 2c 22 74 67 65 74  |.@terror(4,"tget|
00004be0  73 74 61 63 6b 22 29 0d  17 48 2c e7 20 65 32 25  |stack")..H,. e2%|
00004bf0  3e de 28 61 28 29 2c 31  29 20 8c 20 f2 40 74 65  |>.(a(),1) . .@te|
00004c00  72 72 6f 72 28 34 2c 22  74 67 65 74 73 74 61 63  |rror(4,"tgetstac|
00004c10  6b 22 29 0d 17 52 21 e7  20 65 25 3c 73 31 25 20  |k")..R!. e%<s1% |
00004c20  8c 20 73 74 65 70 25 3d  31 20 8b 20 73 74 65 70  |. step%=1 . step|
00004c30  25 3d 2d 31 0d 17 5c 1a  e3 20 73 32 25 3d 73 32  |%=-1..\.. s2%=s2|
00004c40  25 20 b8 20 65 25 20 88  20 73 74 65 70 25 0d 17  |% . e% . step%..|
00004c50  66 23 20 20 20 61 28 73  31 25 2c 30 29 3d 5f 54  |f#   a(s1%,0)=_T|
00004c60  75 72 74 6c 65 53 74 61  63 6b 28 73 31 25 2c 30  |urtleStack(s1%,0|
00004c70  29 0d 17 70 23 20 20 20  61 28 73 31 25 2c 31 29  |)..p#   a(s1%,1)|
00004c80  3d 5f 54 75 72 74 6c 65  53 74 61 63 6b 28 73 31  |=_TurtleStack(s1|
00004c90  25 2c 31 29 0d 17 7a 23  20 20 20 61 28 73 31 25  |%,1)..z#   a(s1%|
00004ca0  2c 32 29 3d 5f 54 75 72  74 6c 65 53 74 61 63 6b  |,2)=_TurtleStack|
00004cb0  28 73 31 25 2c 32 29 0d  17 84 23 20 20 20 61 28  |(s1%,2)...#   a(|
00004cc0  73 31 25 2c 33 29 3d 5f  54 75 72 74 6c 65 53 74  |s1%,3)=_TurtleSt|
00004cd0  61 63 6b 28 73 31 25 2c  33 29 0d 17 8e 0d 20 20  |ack(s1%,3)....  |
00004ce0  20 73 31 25 2b 3d 31 0d  17 98 05 ed 0d 17 a2 05  | s1%+=1.........|
00004cf0  e1 0d 17 ac 04 0d 17 b6  3f dd a4 74 67 65 74 73  |........?..tgets|
00004d00  74 61 63 6b 28 61 28 29  2c 73 31 25 2c 73 32 25  |tack(a(),s1%,s2%|
00004d10  2c 65 25 29 3a 20 f2 74  67 65 74 73 74 61 63 6b  |,e%): .tgetstack|
00004d20  28 61 28 29 2c 73 31 25  2c 73 32 25 2c 65 25 29  |(a(),s1%,s2%,e%)|
00004d30  3a 20 3d 30 0d 17 c0 04  0d 17 ca 4b f4 2b 3d 3d  |: =0.......K.+==|
00004d40  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00004d80  3d 3d 3d 0d 17 d4 06 f4  2b 0d 17 de 1d f4 2b 20  |===.....+.....+ |
00004d90  20 50 52 4f 43 74 73 74  6f 72 65 63 6f 6c 28 72  | PROCtstorecol(r|
00004da0  2c 63 6f 6c 25 29 0d 17  e8 06 f4 2b 0d 17 f2 47  |,col%).....+...G|
00004db0  f4 2b 20 20 54 68 69 73  20 72 6f 75 74 69 6e 65  |.+  This routine|
00004dc0  20 61 73 73 75 6d 65 73  20 74 68 61 74 20 72 20  | assumes that r |
00004dd0  69 73 20 75 73 65 64 20  74 6f 20 68 6f 6c 64 20  |is used to hold |
00004de0  61 20 54 75 72 74 6c 65  20 63 6f 6c 6f 75 72 20  |a Turtle colour |
00004df0  61 6e 64 0d 17 fc 43 f4  2b 20 20 70 6c 6f 74 2d  |and...C.+  plot-|
00004e00  61 63 74 69 6f 6e 20 69  6e 20 54 75 72 74 6c 65  |action in Turtle|
00004e10  2d 73 74 61 63 6b 20 66  6f 72 6d 61 74 20 28 73  |-stack format (s|
00004e20  65 65 20 50 52 4f 43 74  67 65 74 73 74 61 63 6b  |ee PROCtgetstack|
00004e30  29 2c 20 61 6e 64 0d 18  06 26 f4 2b 20 20 73 65  |), and...&.+  se|
00004e40  74 73 20 74 68 65 20 73  74 6f 72 65 64 20 63 6f  |ts the stored co|
00004e50  6c 6f 75 72 20 74 6f 20  63 6f 6c 25 0d 18 10 06  |lour to col%....|
00004e60  f4 2b 0d 18 1a 44 f4 2b  20 20 4e 2e 42 2e 20 42  |.+...D.+  N.B. B|
00004e70  41 53 49 43 20 74 72 65  61 74 73 20 63 6f 6c 6f  |ASIC treats colo|
00004e80  75 72 20 76 61 6c 75 65  73 20 4d 4f 44 20 74 68  |ur values MOD th|
00004e90  65 20 72 61 6e 67 65 20  6f 66 20 74 68 65 20 63  |e range of the c|
00004ea0  75 72 72 65 6e 74 0d 18  24 16 f4 2b 20 20 67 72  |urrent..$..+  gr|
00004eb0  61 70 68 69 63 73 20 6d  6f 64 65 2e 0d 18 2e 06  |aphics mode.....|
00004ec0  f4 2b 0d 18 38 19 dd f2  74 73 74 6f 72 65 63 6f  |.+..8...tstoreco|
00004ed0  6c 28 f8 20 72 2c 63 6f  6c 25 29 0d 18 42 15 72  |l(. r,col%)..B.r|
00004ee0  3d 28 72 20 83 20 38 29  2b 63 6f 6c 25 3c 3c 33  |=(r . 8)+col%<<3|
00004ef0  0d 18 4c 05 e1 0d 18 56  04 0d 18 60 2f dd a4 74  |..L....V...`/..t|
00004f00  73 74 6f 72 65 63 6f 6c  28 72 2c 63 6f 6c 25 29  |storecol(r,col%)|
00004f10  3a 20 f2 74 73 74 6f 72  65 63 6f 6c 28 72 2c 63  |: .tstorecol(r,c|
00004f20  6f 6c 25 29 3a 20 3d 30  0d 18 6a 04 0d 18 74 4b  |ol%): =0..j...tK|
00004f30  f4 2b 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.+==============|
00004f40  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00004f70  3d 3d 3d 3d 3d 3d 3d 0d  18 7e 06 f4 2b 0d 18 88  |=======..~..+...|
00004f80  1f f4 2b 20 20 50 52 4f  43 74 73 74 6f 72 65 70  |..+  PROCtstorep|
00004f90  6c 6f 74 28 72 2c 70 6c  6f 74 25 29 0d 18 92 06  |lot(r,plot%)....|
00004fa0  f4 2b 0d 18 9c 47 f4 2b  20 20 54 68 69 73 20 72  |.+...G.+  This r|
00004fb0  6f 75 74 69 6e 65 20 61  73 73 75 6d 65 73 20 74  |outine assumes t|
00004fc0  68 61 74 20 72 20 69 73  20 75 73 65 64 20 74 6f  |hat r is used to|
00004fd0  20 68 6f 6c 64 20 61 20  54 75 72 74 6c 65 20 63  | hold a Turtle c|
00004fe0  6f 6c 6f 75 72 20 61 6e  64 0d 18 a6 43 f4 2b 20  |olour and...C.+ |
00004ff0  20 70 6c 6f 74 2d 61 63  74 69 6f 6e 20 69 6e 20  | plot-action in |
00005000  54 75 72 74 6c 65 2d 73  74 61 63 6b 20 66 6f 72  |Turtle-stack for|
00005010  6d 61 74 20 28 73 65 65  20 50 52 4f 43 74 67 65  |mat (see PROCtge|
00005020  74 73 74 61 63 6b 29 2c  20 61 6e 64 0d 18 b0 2c  |tstack), and...,|
00005030  f4 2b 20 20 73 65 74 73  20 74 68 65 20 73 74 6f  |.+  sets the sto|
00005040  72 65 64 20 70 6c 6f 74  2d 61 63 74 69 6f 6e 20  |red plot-action |
00005050  74 6f 20 70 6c 6f 74 25  0d 18 ba 06 f4 2b 0d 18  |to plot%.....+..|
00005060  c4 1b dd f2 74 73 74 6f  72 65 70 6c 6f 74 28 f8  |....tstoreplot(.|
00005070  20 72 2c 70 6c 6f 74 25  29 0d 18 ce 28 e7 20 70  | r,plot%)...(. p|
00005080  6c 6f 74 25 3e 37 20 8c  20 f2 40 74 65 72 72 6f  |lot%>7 . .@terro|
00005090  72 28 35 2c 22 74 73 74  6f 72 65 70 6c 6f 74 22  |r(5,"tstoreplot"|
000050a0  29 0d 18 d8 13 72 3d 28  72 20 81 20 38 29 2b 70  |)....r=(r . 8)+p|
000050b0  6c 6f 74 25 0d 18 e2 05  e1 0d 18 ec 04 0d 18 f6  |lot%............|
000050c0  33 dd a4 74 73 74 6f 72  65 70 6c 6f 74 28 72 2c  |3..tstoreplot(r,|
000050d0  70 6c 6f 74 25 29 3a 20  f2 74 73 74 6f 72 65 70  |plot%): .tstorep|
000050e0  6c 6f 74 28 72 2c 70 6c  6f 74 25 29 3a 20 3d 30  |lot(r,plot%): =0|
000050f0  0d 19 00 04 0d 19 0a 4b  f4 2b 3d 3d 3d 3d 3d 3d  |.......K.+======|
00005100  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00005130  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 0d  |===============.|
00005140  19 14 06 f4 2b 0d 19 1e  14 f4 2b 20 20 50 52 4f  |....+.....+  PRO|
00005150  43 74 72 65 73 74 6f 72  65 0d 19 28 06 f4 2b 0d  |Ctrestore..(..+.|
00005160  19 32 3e f4 2b 20 20 57  68 65 6e 20 54 75 72 74  |.2>.+  When Turt|
00005170  6c 65 2d 73 74 61 63 6b  20 69 73 20 61 63 74 69  |le-stack is acti|
00005180  76 65 2c 20 74 68 69 73  20 72 6f 75 74 69 6e 65  |ve, this routine|
00005190  20 72 65 73 74 6f 72 65  73 20 74 68 65 0d 19 3c  | restores the..<|
000051a0  43 f4 2b 20 20 54 75 72  74 6c 65 27 73 20 73 74  |C.+  Turtle's st|
000051b0  61 74 65 20 66 72 6f 6d  20 74 68 65 20 63 75 72  |ate from the cur|
000051c0  72 65 6e 74 20 70 6f 73  69 74 69 6f 6e 20 69 6e  |rent position in|
000051d0  20 74 68 65 20 73 74 61  63 6b 2c 20 74 68 65 6e  | the stack, then|
000051e0  0d 19 46 25 f4 2b 20 20  64 65 63 72 65 6d 65 6e  |..F%.+  decremen|
000051f0  74 73 20 74 68 65 20 73  74 61 63 6b 20 70 6f 69  |ts the stack poi|
00005200  6e 74 65 72 2e 0d 19 50  06 f4 2b 0d 19 5a 0e dd  |nter...P..+..Z..|
00005210  f2 74 72 65 73 74 6f 72  65 0d 19 64 2e e7 20 ac  |.trestore..d.. .|
00005220  20 5f 54 75 72 74 6c 65  53 74 61 63 6b 25 20 8c  | _TurtleStack% .|
00005230  20 f2 40 74 65 72 72 6f  72 28 31 2c 22 74 72 65  | .@terror(1,"tre|
00005240  73 74 6f 72 65 22 29 0d  19 6e 4e e7 20 5f 54 75  |store")..nN. _Tu|
00005250  72 74 6c 65 47 65 6e 25  3c 30 20 84 20 5f 54 75  |rtleGen%<0 . _Tu|
00005260  72 74 6c 65 47 65 6e 25  3e de 28 5f 54 75 72 74  |rtleGen%>.(_Turt|
00005270  6c 65 53 74 61 63 6b 28  29 2c 31 29 20 8c 20 f2  |leStack(),1) . .|
00005280  40 74 65 72 72 6f 72 28  32 2c 22 74 72 65 73 74  |@terror(2,"trest|
00005290  6f 72 65 22 29 0d 19 78  4b f2 74 67 63 6f 6c 28  |ore")..xK.tgcol(|
000052a0  5f 54 75 72 74 6c 65 53  74 61 63 6b 28 5f 54 75  |_TurtleStack(_Tu|
000052b0  72 74 6c 65 47 65 6e 25  2c 33 29 20 83 20 38 2c  |rtleGen%,3) . 8,|
000052c0  5f 54 75 72 74 6c 65 53  74 61 63 6b 28 5f 54 75  |_TurtleStack(_Tu|
000052d0  72 74 6c 65 47 65 6e 25  2c 33 29 20 81 20 38 29  |rtleGen%,3) . 8)|
000052e0  0d 19 82 5f f2 74 6a 75  6d 70 28 5f 54 75 72 74  |..._.tjump(_Turt|
000052f0  6c 65 53 74 61 63 6b 28  5f 54 75 72 74 6c 65 47  |leStack(_TurtleG|
00005300  65 6e 25 2c 30 29 2c 5f  54 75 72 74 6c 65 53 74  |en%,0),_TurtleSt|
00005310  61 63 6b 28 5f 54 75 72  74 6c 65 47 65 6e 25 2c  |ack(_TurtleGen%,|
00005320  31 29 2c 5f 54 75 72 74  6c 65 53 74 61 63 6b 28  |1),_TurtleStack(|
00005330  5f 54 75 72 74 6c 65 47  65 6e 25 2c 32 29 29 0d  |_TurtleGen%,2)).|
00005340  19 8c 12 5f 54 75 72 74  6c 65 47 65 6e 25 2d 3d  |..._TurtleGen%-=|
00005350  31 0d 19 96 05 e1 0d 19  a0 04 0d 19 aa 1d dd a4  |1...............|
00005360  74 72 65 73 74 6f 72 65  3a 20 f2 74 72 65 73 74  |trestore: .trest|
00005370  6f 72 65 3a 20 3d 30 0d  19 b4 04 0d 19 be 4b f4  |ore: =0.......K.|
00005380  2b 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |+===============|
00005390  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
000053c0  3d 3d 3d 3d 3d 3d 0d 19  c8 06 f4 2b 0d 19 d2 1d  |======.....+....|
000053d0  f4 2b 20 20 50 52 4f 43  74 64 6f 28 61 28 29 2c  |.+  PROCtdo(a(),|
000053e0  73 25 2c 65 25 2c 6e 25  29 0d 19 dc 06 f4 2b 0d  |s%,e%,n%).....+.|
000053f0  19 e6 41 f4 2b 20 20 54  68 69 73 20 72 6f 75 74  |..A.+  This rout|
00005400  69 6e 65 20 61 73 73 75  6d 65 73 20 74 68 61 74  |ine assumes that|
00005410  20 61 28 29 20 69 73 20  61 6e 20 61 72 72 61 79  | a() is an array|
00005420  20 69 6e 20 54 75 72 74  6c 65 2d 73 74 61 63 6b  | in Turtle-stack|
00005430  0d 19 f0 41 f4 2b 20 20  66 6f 72 6d 61 74 2c 20  |...A.+  format, |
00005440  69 2e 65 2e 20 61 73 20  70 6f 70 75 6c 61 74 65  |i.e. as populate|
00005450  64 20 62 79 20 50 52 4f  43 74 67 65 74 73 74 61  |d by PROCtgetsta|
00005460  63 6b 2e 20 49 74 20 63  61 75 73 65 73 20 74 68  |ck. It causes th|
00005470  65 0d 19 fa 45 f4 2b 20  20 54 75 72 74 6c 65 20  |e...E.+  Turtle |
00005480  74 6f 20 74 72 61 63 6b  20 74 68 65 20 73 68 61  |to track the sha|
00005490  70 65 20 73 74 6f 72 65  64 20 69 6e 20 61 28 29  |pe stored in a()|
000054a0  2c 20 73 74 61 72 74 69  6e 67 20 61 74 20 70 6f  |, starting at po|
000054b0  73 69 74 69 6f 6e 0d 1a  04 40 f4 2b 20 20 73 25  |sition...@.+  s%|
000054c0  20 61 6e 64 20 63 6f 6e  74 69 6e 75 69 6e 67 20  | and continuing |
000054d0  74 6f 20 70 6f 73 69 74  69 6f 6e 20 65 25 2c 20  |to position e%, |
000054e0  6f 72 20 75 6e 74 69 6c  20 61 20 70 6f 73 69 74  |or until a posit|
000054f0  69 6f 6e 20 69 73 0d 1a  0e 43 f4 2b 20 20 72 65  |ion is...C.+  re|
00005500  61 63 68 65 64 20 77 68  65 72 65 20 74 68 65 20  |ached where the |
00005510  73 74 6f 72 65 64 20 58  2d 63 6f 6f 72 64 69 6e  |stored X-coordin|
00005520  61 74 65 20 2d 20 61 28  6e 2c 30 29 20 2d 20 69  |ate - a(n,0) - i|
00005530  73 20 6f 75 74 73 69 64  65 0d 1a 18 44 f4 2b 20  |s outside...D.+ |
00005540  20 74 68 65 20 67 72 61  70 68 69 63 73 20 63 6f  | the graphics co|
00005550  6f 72 64 69 6e 61 74 65  73 20 72 61 6e 67 65 20  |ordinates range |
00005560  5b 2d 33 32 37 36 38 2c  2b 33 32 37 36 37 5d 2e  |[-32768,+32767].|
00005570  20 28 54 68 69 73 20 61  6c 6c 6f 77 73 0d 1a 22  | (This allows.."|
00005580  43 f4 2b 20 20 75 73 65  72 20 70 72 6f 67 72 61  |C.+  user progra|
00005590  6d 73 20 74 6f 20 74 65  72 6d 69 6e 61 74 65 20  |ms to terminate |
000055a0  74 68 65 20 73 74 6f 72  65 64 20 73 68 61 70 65  |the stored shape|
000055b0  20 62 79 20 69 6e 73 65  72 74 69 6e 67 20 61 6e  | by inserting an|
000055c0  0d 1a 2c 43 f4 2b 20 20  65 78 63 65 73 73 69 76  |..,C.+  excessiv|
000055d0  65 20 76 61 6c 75 65 20  61 74 20 74 68 65 20 64  |e value at the d|
000055e0  65 73 69 72 65 64 20 70  6f 73 69 74 69 6f 6e 29  |esired position)|
000055f0  2e 20 49 66 20 65 25 20  70 72 65 63 65 64 65 73  |. If e% precedes|
00005600  20 73 25 0d 1a 36 39 f4  2b 20 20 74 68 65 6e 20  | s%..69.+  then |
00005610  74 68 65 20 73 74 6f 72  65 64 20 73 68 61 70 65  |the stored shape|
00005620  20 77 69 6c 6c 20 62 65  20 74 72 61 63 6b 65 64  | will be tracked|
00005630  20 69 6e 20 72 65 76 65  72 73 65 2e 0d 1a 40 06  | in reverse...@.|
00005640  f4 2b 0d 1a 4a 40 f4 2b  20 20 49 66 20 74 68 65  |.+..J@.+  If the|
00005650  20 70 61 72 61 6d 65 74  65 72 20 6e 25 20 69 73  | parameter n% is|
00005660  20 3e 20 30 2c 20 74 68  65 6e 20 74 68 65 20 54  | > 0, then the T|
00005670  75 72 74 6c 65 20 77 69  6c 6c 20 75 73 65 20 74  |urtle will use t|
00005680  68 65 0d 1a 54 41 f4 2b  20 20 73 74 6f 72 65 64  |he..TA.+  stored|
00005690  20 70 6c 6f 74 2d 61 63  74 69 6f 6e 20 61 6e 64  | plot-action and|
000056a0  20 63 6f 6c 6f 75 72 20  61 74 20 65 61 63 68 20  | colour at each |
000056b0  70 6f 73 69 74 69 6f 6e  2c 20 6f 74 68 65 72 77  |position, otherw|
000056c0  69 73 65 0d 1a 5e 45 f4  2b 20 20 69 74 20 77 69  |ise..^E.+  it wi|
000056d0  6c 6c 20 69 67 6e 6f 72  65 20 74 68 65 6d 20 61  |ll ignore them a|
000056e0  6e 64 20 75 73 65 20 74  68 65 20 76 61 6c 75 65  |nd use the value|
000056f0  73 20 6c 61 73 74 20 73  65 74 20 62 79 20 50 52  |s last set by PR|
00005700  4f 43 74 67 63 6f 6c 2e  0d 1a 68 43 f4 2b 20 20  |OCtgcol...hC.+  |
00005710  54 68 65 20 54 75 72 74  6c 65 27 73 20 70 65 6e  |The Turtle's pen|
00005720  20 69 73 20 73 65 74 20  6f 6e 20 66 6f 72 20 74  | is set on for t|
00005730  68 65 20 64 75 72 61 74  69 6f 6e 20 6f 66 20 74  |he duration of t|
00005740  68 65 20 72 6f 75 74 69  6e 65 2e 0d 1a 72 43 f4  |he routine...rC.|
00005750  2b 20 20 4f 6e 20 65 6e  74 72 79 2c 20 74 68 65  |+  On entry, the|
00005760  20 54 75 72 74 6c 65 27  73 20 70 6c 6f 74 2d 61  | Turtle's plot-a|
00005770  63 74 69 6f 6e 20 61 6e  64 20 63 6f 6c 6f 75 72  |ction and colour|
00005780  20 61 72 65 20 73 61 76  65 64 20 61 6e 64 0d 1a  | are saved and..|
00005790  7c 22 f4 2b 20 20 6f 6e  20 65 78 69 74 20 74 68  ||".+  on exit th|
000057a0  65 79 20 61 72 65 20 72  65 73 74 6f 72 65 64 2e  |ey are restored.|
000057b0  0d 1a 86 06 f4 2b 0d 1a  90 49 f4 2b 20 20 4e 2e  |.....+...I.+  N.|
000057c0  42 2e 20 54 68 65 20 72  6f 75 74 69 6e 65 20 64  |B. The routine d|
000057d0  6f 65 73 20 6e 6f 74 20  74 72 61 70 20 67 72 61  |oes not trap gra|
000057e0  70 68 69 63 61 6c 6c 79  20 69 6e 76 61 6c 69 64  |phically invalid|
000057f0  20 59 2d 63 6f 6f 72 64  69 6e 61 74 65 73 2e 0d  | Y-coordinates..|
00005800  1a 9a 06 f4 2b 0d 1a a4  17 dd f2 74 64 6f 28 61  |....+......tdo(a|
00005810  28 29 2c 73 25 2c 65 25  2c 6e 25 29 0d 1a ae 2f  |(),s%,e%,n%).../|
00005820  ea 20 73 74 61 72 74 25  2c 65 6e 64 25 2c 73 74  |. start%,end%,st|
00005830  65 70 25 2c 70 65 6e 25  2c 61 63 74 69 6f 6e 25  |ep%,pen%,action%|
00005840  2c 63 6f 6c 6f 75 72 25  2c 78 25 0d 1a b8 16 70  |,colour%,x%....p|
00005850  65 6e 25 3d 5f 54 75 72  74 6c 65 50 65 6e 4f 6e  |en%=_TurtlePenOn|
00005860  25 0d 1a c2 19 61 63 74  69 6f 6e 25 3d 5f 54 75  |%....action%=_Tu|
00005870  72 74 6c 65 46 50 6c 6f  74 25 0d 1a cc 18 63 6f  |rtleFPlot%....co|
00005880  6c 6f 75 72 25 3d 5f 54  75 72 74 6c 65 46 43 6f  |lour%=_TurtleFCo|
00005890  6c 25 0d 1a d6 23 e7 20  de 28 61 28 29 29 3c 3e  |l%...#. .(a())<>|
000058a0  32 20 8c 20 f2 40 74 65  72 72 6f 72 28 33 2c 22  |2 . .@terror(3,"|
000058b0  74 64 6f 22 29 0d 1a e0  24 e7 20 de 28 61 28 29  |tdo")...$. .(a()|
000058c0  2c 32 29 3c 33 20 8c 20  f2 40 74 65 72 72 6f 72  |,2)<3 . .@terror|
000058d0  28 33 2c 22 74 64 6f 22  29 0d 1a ea 2c e7 20 73  |(3,"tdo")...,. s|
000058e0  25 3c 30 20 84 20 73 25  3e de 28 61 28 29 2c 31  |%<0 . s%>.(a(),1|
000058f0  29 20 8c 20 f2 40 74 65  72 72 6f 72 28 34 2c 22  |) . .@terror(4,"|
00005900  74 64 6f 22 29 0d 1a f4  2c e7 20 65 25 3c 30 20  |tdo")...,. e%<0 |
00005910  84 20 65 25 3e de 28 61  28 29 2c 31 29 20 8c 20  |. e%>.(a(),1) . |
00005920  f2 40 74 65 72 72 6f 72  28 34 2c 22 74 64 6f 22  |.@terror(4,"tdo"|
00005930  29 0d 1a fe 0e e7 20 65  25 3e 3d 73 25 20 8c 0d  |)..... e%>=s% ..|
00005940  1b 08 10 20 20 20 73 74  61 72 74 25 3d 73 25 0d  |...   start%=s%.|
00005950  1b 12 0e 20 20 20 65 6e  64 25 3d 65 25 0d 1b 1c  |...   end%=e%...|
00005960  0e 20 20 20 73 74 65 70  25 3d 31 0d 1b 26 05 cc  |.   step%=1..&..|
00005970  0d 1b 30 10 20 20 20 73  74 61 72 74 25 3d 65 25  |..0.   start%=e%|
00005980  0d 1b 3a 0e 20 20 20 65  6e 64 25 3d 73 25 0d 1b  |..:.   end%=s%..|
00005990  44 0f 20 20 20 73 74 65  70 25 3d 2d 31 0d 1b 4e  |D.   step%=-1..N|
000059a0  05 cd 0d 1b 58 30 f2 74  6a 75 6d 70 28 61 28 73  |....X0.tjump(a(s|
000059b0  74 61 72 74 25 2c 30 29  2c 61 28 73 74 61 72 74  |tart%,0),a(start|
000059c0  25 2c 31 29 2c 5f 54 75  72 74 6c 65 41 6e 67 6c  |%,1),_TurtleAngl|
000059d0  65 29 0d 1b 62 0c f2 74  70 65 6e 28 31 29 0d 1b  |e)..b..tpen(1)..|
000059e0  6c 0c e7 20 6e 25 3e 30  20 8c 0d 1b 76 2e 20 20  |l.. n%>0 ...v.  |
000059f0  20 f2 74 67 63 6f 6c 28  61 28 73 74 61 72 74 25  | .tgcol(a(start%|
00005a00  2c 33 29 20 83 20 38 2c  61 28 73 74 61 72 74 25  |,3) . 8,a(start%|
00005a10  2c 33 29 20 81 20 38 29  0d 1b 80 05 cd 0d 1b 8a  |,3) . 8)........|
00005a20  0a f2 74 70 6c 6f 74 0d  1b 94 0a c8 8e 20 b9 20  |..tplot...... . |
00005a30  ca 0d 1b 9e 0a c9 20 6e  25 3e 30 0d 1b a8 14 20  |...... n%>0.... |
00005a40  20 20 78 3d 61 28 73 74  61 72 74 25 2c 30 29 0d  |  x=a(start%,0).|
00005a50  1b b2 2d 20 20 20 c8 95  20 73 74 61 72 74 25 3c  |..-   .. start%<|
00005a60  3e 65 6e 64 25 20 80 20  78 3e 3d 2d 33 32 37 36  |>end% . x>=-3276|
00005a70  38 20 80 20 78 3c 3d 33  32 37 36 37 0d 1b bc 17  |8 . x<=32767....|
00005a80  20 20 20 20 20 20 73 74  61 72 74 25 2b 3d 73 74  |      start%+=st|
00005a90  65 70 25 0d 1b c6 17 20  20 20 20 20 20 78 3d 61  |ep%....      x=a|
00005aa0  28 73 74 61 72 74 25 2c  30 29 0d 1b d0 1d 20 20  |(start%,0)....  |
00005ab0  20 20 20 20 f2 74 74 6f  28 78 2c 61 28 73 74 61  |    .tto(x,a(sta|
00005ac0  72 74 25 2c 31 29 29 0d  1b da 31 20 20 20 20 20  |rt%,1))...1     |
00005ad0  20 f2 74 67 63 6f 6c 28  61 28 73 74 61 72 74 25  | .tgcol(a(start%|
00005ae0  2c 33 29 20 83 20 38 2c  61 28 73 74 61 72 74 25  |,3) . 8,a(start%|
00005af0  2c 33 29 20 81 20 38 29  0d 1b e4 08 20 20 20 ce  |,3) . 8)....   .|
00005b00  0d 1b ee 05 7f 0d 1b f8  14 20 20 20 78 3d 61 28  |.........   x=a(|
00005b10  73 74 61 72 74 25 2c 30  29 0d 1c 02 2d 20 20 20  |start%,0)...-   |
00005b20  c8 95 20 73 74 61 72 74  25 3c 3e 65 6e 64 25 20  |.. start%<>end% |
00005b30  80 20 78 3e 3d 2d 33 32  37 36 38 20 80 20 78 3c  |. x>=-32768 . x<|
00005b40  3d 33 32 37 36 37 0d 1c  0c 17 20 20 20 20 20 20  |=32767....      |
00005b50  73 74 61 72 74 25 2b 3d  73 74 65 70 25 0d 1c 16  |start%+=step%...|
00005b60  17 20 20 20 20 20 20 78  3d 61 28 73 74 61 72 74  |.      x=a(start|
00005b70  25 2c 30 29 0d 1c 20 1d  20 20 20 20 20 20 f2 74  |%,0).. .      .t|
00005b80  74 6f 28 78 2c 61 28 73  74 61 72 74 25 2c 31 29  |to(x,a(start%,1)|
00005b90  29 0d 1c 2a 08 20 20 20  ce 0d 1c 34 05 cb 0d 1c  |)..*.   ...4....|
00005ba0  3e 16 5f 54 75 72 74 6c  65 50 65 6e 4f 6e 25 3d  |>._TurtlePenOn%=|
00005bb0  70 65 6e 25 0d 1c 48 19  5f 54 75 72 74 6c 65 46  |pen%..H._TurtleF|
00005bc0  50 6c 6f 74 25 3d 61 63  74 69 6f 6e 25 0d 1c 52  |Plot%=action%..R|
00005bd0  18 5f 54 75 72 74 6c 65  46 43 6f 6c 25 3d 63 6f  |._TurtleFCol%=co|
00005be0  6c 6f 75 72 25 0d 1c 5c  05 e1 0d 1c 66 04 0d 1c  |lour%..\....f...|
00005bf0  70 2f dd a4 74 64 6f 28  61 28 29 2c 73 25 2c 65  |p/..tdo(a(),s%,e|
00005c00  25 2c 6e 25 29 3a 20 f2  74 64 6f 28 61 28 29 2c  |%,n%): .tdo(a(),|
00005c10  73 25 2c 65 25 2c 6e 25  29 3a 20 3d 30 0d 1c 7a  |s%,e%,n%): =0..z|
00005c20  04 0d 1c 84 4b f4 2b 3d  3d 3d 3d 3d 3d 3d 3d 3d  |....K.+=========|
00005c30  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00005c60  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 0d 1c 8e 4b  |============...K|
00005c70  f4 2b 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.+==============|
00005c80  3d 3d 3d 3d 3d 3d 20 49  6e 74 65 72 6e 61 6c 20  |====== Internal |
00005c90  4c 69 62 72 61 72 79 20  52 6f 75 74 69 6e 65 73  |Library Routines|
00005ca0  20 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  | ===============|
00005cb0  3d 3d 3d 3d 3d 3d 3d 0d  1c 98 4b f4 2b 3d 3d 3d  |=======...K.+===|
00005cc0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00005d00  3d 3d 0d 1c a2 06 f4 2b  0d 1c ac 12 f4 2b 20 20  |==.....+.....+  |
00005d10  50 52 4f 43 40 74 64 72  61 77 0d 1c b6 06 f4 2b  |PROC@tdraw.....+|
00005d20  0d 1c c0 19 f4 2b 20 20  44 72 61 77 73 20 74 68  |.....+  Draws th|
00005d30  65 20 54 75 72 74 6c 65  2e 0d 1c ca 06 f4 2b 0d  |e Turtle......+.|
00005d40  1c d4 0c dd f2 40 74 64  72 61 77 0d 1c de 11 ea  |.....@tdraw.....|
00005d50  20 78 70 69 78 25 2c 79  70 69 78 25 0d 1c e8 19  | xpix%,ypix%....|
00005d60  78 70 69 78 25 3d a8 28  5f 54 75 72 74 6c 65 58  |xpix%=.(_TurtleX|
00005d70  2b 30 2e 35 29 0d 1c f2  19 79 70 69 78 25 3d a8  |+0.5)....ypix%=.|
00005d80  28 5f 54 75 72 74 6c 65  59 2b 30 2e 35 29 0d 1c  |(_TurtleY+0.5)..|
00005d90  fc 09 e6 20 34 2c 30 0d  1d 06 4d df 20 78 70 69  |... 4,0...M. xpi|
00005da0  78 25 2b 5f 54 57 69 6e  67 2a b5 20 b2 20 28 5f  |x%+_TWing*. . (_|
00005db0  54 75 72 74 6c 65 41 6e  67 6c 65 2b 32 32 35 29  |TurtleAngle+225)|
00005dc0  2c 79 70 69 78 25 2b 5f  54 57 69 6e 67 2a 9b 20  |,ypix%+_TWing*. |
00005dd0  b2 20 28 5f 54 75 72 74  6c 65 41 6e 67 6c 65 2b  |. (_TurtleAngle+|
00005de0  32 32 35 29 0d 1d 10 43  df 20 78 70 69 78 25 2b  |225)...C. xpix%+|
00005df0  5f 54 48 61 6c 66 25 2a  b5 20 b2 20 5f 54 75 72  |_THalf%*. . _Tur|
00005e00  74 6c 65 41 6e 67 6c 65  2c 79 70 69 78 25 2b 5f  |tleAngle,ypix%+_|
00005e10  54 48 61 6c 66 25 2a 9b  20 b2 20 5f 54 75 72 74  |THalf%*. . _Turt|
00005e20  6c 65 41 6e 67 6c 65 0d  1d 1a 4d df 20 78 70 69  |leAngle...M. xpi|
00005e30  78 25 2b 5f 54 57 69 6e  67 2a b5 20 b2 20 28 5f  |x%+_TWing*. . (_|
00005e40  54 75 72 74 6c 65 41 6e  67 6c 65 2b 31 33 35 29  |TurtleAngle+135)|
00005e50  2c 79 70 69 78 25 2b 5f  54 57 69 6e 67 2a 9b 20  |,ypix%+_TWing*. |
00005e60  b2 20 28 5f 54 75 72 74  6c 65 41 6e 67 6c 65 2b  |. (_TurtleAngle+|
00005e70  31 33 35 29 0d 1d 24 11  df 20 78 70 69 78 25 2c  |135)..$.. xpix%,|
00005e80  79 70 69 78 25 0d 1d 2e  1d e7 20 5f 54 75 72 74  |ypix%..... _Turt|
00005e90  6c 65 57 61 74 63 68 4f  6e 25 20 8c 20 5f 43 25  |leWatchOn% . _C%|
00005ea0  3d a5 0d 1d 38 20 e6 20  5f 54 75 72 74 6c 65 46  |=...8 . _TurtleF|
00005eb0  50 6c 6f 74 25 2c 5f 54  75 72 74 6c 65 46 43 6f  |Plot%,_TurtleFCo|
00005ec0  6c 25 0d 1d 42 05 e1 0d  1d 4c 04 0d 1d 56 4b f4  |l%..B....L...VK.|
00005ed0  2b 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |+===============|
00005ee0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00005f10  3d 3d 3d 3d 3d 3d 0d 1d  60 06 f4 2b 0d 1d 6a 13  |======..`..+..j.|
00005f20  f4 2b 20 20 50 52 4f 43  40 74 65 72 72 6f 72 0d  |.+  PROC@terror.|
00005f30  1d 74 06 f4 2b 0d 1d 7e  33 f4 2b 20 20 49 73 73  |.t..+..~3.+  Iss|
00005f40  75 65 73 20 61 6e 20 75  6e 74 72 61 70 70 61 62  |ues an untrappab|
00005f50  6c 65 20 65 72 72 6f 72  20 77 68 65 6e 20 6e 65  |le error when ne|
00005f60  63 65 73 73 61 72 79 2e  0d 1d 88 06 f4 2b 0d 1d  |cessary......+..|
00005f70  92 1a dd f2 40 74 65 72  72 6f 72 28 6e 25 2c 65  |....@terror(n%,e|
00005f80  72 72 70 72 6f 63 24 29  0d 1d 9c 0d ea 20 70 72  |rrproc$)..... pr|
00005f90  65 66 69 78 24 0d 1d a6  36 70 72 65 66 69 78 24  |efix$...6prefix$|
00005fa0  3d 22 46 61 74 61 6c 20  65 72 72 6f 72 20 69 6e  |="Fatal error in|
00005fb0  20 54 75 72 74 6c 65 47  52 46 58 3a 20 50 52 4f  | TurtleGRFX: PRO|
00005fc0  43 22 2b 65 72 72 70 72  6f 63 24 0d 1d b0 0b c8  |C"+errproc$.....|
00005fd0  8e 20 6e 25 20 ca 0d 1d  ba 07 c9 20 30 0d 1d c4  |. n% ...... 0...|
00005fe0  24 20 20 20 85 20 30 2c  70 72 65 66 69 78 24 2b  |$   . 0,prefix$+|
00005ff0  22 20 2d 20 63 61 6c 6c  65 64 20 74 77 69 63 65  |" - called twice|
00006000  22 0d 1d ce 07 c9 20 31  0d 1d d8 31 20 20 20 85  |"..... 1...1   .|
00006010  20 30 2c 70 72 65 66 69  78 24 2b 22 20 2d 20 6e  | 0,prefix$+" - n|
00006020  6f 20 54 75 72 74 6c 65  2d 73 74 61 63 6b 20 61  |o Turtle-stack a|
00006030  6c 6c 6f 63 61 74 65 64  22 0d 1d e2 07 c9 20 32  |llocated"..... 2|
00006040  0d 1d ec 31 20 20 20 85  20 30 2c 70 72 65 66 69  |...1   . 0,prefi|
00006050  78 24 2b 22 20 2d 20 6f  75 74 20 6f 66 20 54 75  |x$+" - out of Tu|
00006060  72 74 6c 65 2d 73 74 61  63 6b 20 72 61 6e 67 65  |rtle-stack range|
00006070  22 0d 1d f6 07 c9 20 33  0d 1e 00 3b 20 20 20 85  |"..... 3...;   .|
00006080  20 30 2c 70 72 65 66 69  78 24 2b 22 20 2d 20 75  | 0,prefix$+" - u|
00006090  73 65 72 20 61 72 72 61  79 20 69 73 20 6e 6f 74  |ser array is not|
000060a0  20 54 75 72 74 6c 65 2d  73 74 61 63 6b 20 66 6f  | Turtle-stack fo|
000060b0  72 6d 22 0d 1e 0a 07 c9  20 34 0d 1e 14 2f 20 20  |rm"..... 4.../  |
000060c0  20 85 20 30 2c 70 72 65  66 69 78 24 2b 22 20 2d  | . 0,prefix$+" -|
000060d0  20 6f 75 74 20 6f 66 20  75 73 65 72 20 61 72 72  | out of user arr|
000060e0  61 79 20 72 61 6e 67 65  22 0d 1e 1e 07 c9 20 35  |ay range"..... 5|
000060f0  0d 1e 28 36 20 20 20 85  20 30 2c 70 72 65 66 69  |..(6   . 0,prefi|
00006100  78 24 2b 22 20 2d 20 6f  75 74 20 6f 66 20 70 6c  |x$+" - out of pl|
00006110  6f 74 20 61 63 74 69 6f  6e 20 72 61 6e 67 65 20  |ot action range |
00006120  28 30 2d 37 29 22 0d 1e  32 05 cb 0d 1e 3c 05 e1  |(0-7)"..2....<..|
00006130  0d 1e 46 04 0d 1e 50 4b  f4 2b 3d 3d 3d 3d 3d 3d  |..F...PK.+======|
00006140  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00006170  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 0d  |===============.|
00006180  1e 5a 4b f4 2b 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.ZK.+===========|
00006190  3d 3d 3d 3d 3d 3d 3d 3d  3d 20 54 75 72 74 6c 65  |========= Turtle|
000061a0  20 49 6e 74 65 72 70 72  65 74 65 72 20 3d 3d 3d  | Interpreter ===|
000061b0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
000061c0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 0d 1e 64 4b f4 2b  |==========..dK.+|
000061d0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00006210  3d 3d 3d 3d 3d 0d 1e 6e  06 f4 2b 0d 1e 78 10 f4  |=====..n..+..x..|
00006220  2b 20 20 50 52 4f 43 74  72 75 6e 0d 1e 82 06 f4  |+  PROCtrun.....|
00006230  2b 0d 1e 8c 43 f4 2b 20  20 20 20 20 54 68 69 73  |+...C.+     This|
00006240  20 70 72 6f 63 65 64 75  72 65 20 73 68 6f 75 6c  | procedure shoul|
00006250  64 20 62 65 20 63 61 6c  6c 65 64 20 66 72 6f 6d  |d be called from|
00006260  20 74 68 65 20 42 41 53  49 43 20 70 72 6f 6d 70  | the BASIC promp|
00006270  74 20 74 6f 0d 1e 96 40  f4 2b 20 20 69 6e 69 74  |t to...@.+  init|
00006280  69 61 74 65 20 64 69 72  65 63 74 20 6b 65 79 62  |iate direct keyb|
00006290  6f 61 72 64 20 63 6f 6e  74 72 6f 6c 20 6f 66 20  |oard control of |
000062a0  74 68 65 20 54 75 72 74  6c 65 2e 20 50 52 4f 43  |the Turtle. PROC|
000062b0  74 72 75 6e 0d 1e a0 46  f4 2b 20 20 65 78 65 63  |trun...F.+  exec|
000062c0  75 74 65 73 20 50 52 4f  43 74 73 74 61 72 74 20  |utes PROCtstart |
000062d0  61 6e 64 20 50 52 4f 43  74 73 68 6f 77 20 74 6f  |and PROCtshow to|
000062e0  20 73 74 61 72 74 20 74  68 65 20 54 75 72 74 6c  | start the Turtl|
000062f0  65 20 61 6e 64 20 6d 61  6b 65 0d 1e aa 47 f4 2b  |e and make...G.+|
00006300  20 20 69 74 20 76 69 73  69 62 6c 65 2c 20 74 68  |  it visible, th|
00006310  65 6e 20 69 73 73 75 65  73 20 74 68 65 20 70 72  |en issues the pr|
00006320  6f 6d 70 74 20 22 74 3f  22 2e 20 59 6f 75 20 6d  |ompt "t?". You m|
00006330  61 79 20 74 68 65 6e 20  65 6e 74 65 72 20 61 6e  |ay then enter an|
00006340  79 0d 1e b4 46 f4 2b 20  20 73 74 72 69 6e 67 20  |y...F.+  string |
00006350  73 24 20 73 75 63 68 20  74 68 61 74 20 22 50 52  |s$ such that "PR|
00006360  4f 43 74 22 2b 73 24 20  65 76 61 6c 75 61 74 65  |OCt"+s$ evaluate|
00006370  73 20 74 6f 20 61 20 76  61 6c 69 64 20 54 75 72  |s to a valid Tur|
00006380  74 6c 65 47 52 46 58 0d  1e be 47 f4 2b 20 20 70  |tleGRFX...G.+  p|
00006390  72 6f 63 65 64 75 72 65  20 63 61 6c 6c 2c 20 61  |rocedure call, a|
000063a0  6e 64 20 74 68 69 73 20  63 61 6c 6c 20 77 69 6c  |nd this call wil|
000063b0  6c 20 62 65 20 65 78 65  63 75 74 65 64 2e 20 54  |l be executed. T|
000063c0  68 65 20 22 74 3f 22 20  70 72 6f 6d 70 74 0d 1e  |he "t?" prompt..|
000063d0  c8 47 f4 2b 20 20 63 6f  6e 74 69 6e 75 65 73 20  |.G.+  continues |
000063e0  74 6f 20 62 65 20 69 73  73 75 65 64 20 75 6e 74  |to be issued unt|
000063f0  69 6c 20 61 20 6e 75 6c  6c 20 73 74 72 69 6e 67  |il a null string|
00006400  20 69 73 20 65 6e 74 65  72 65 64 2c 20 61 74 20  | is entered, at |
00006410  77 68 69 63 68 0d 1e d2  34 f4 2b 20 20 70 6f 69  |which...4.+  poi|
00006420  6e 74 20 74 68 65 20 70  72 6f 63 65 64 75 72 65  |nt the procedure|
00006430  20 74 65 72 6d 69 6e 61  74 65 73 2e 20 46 6f 72  | terminates. For|
00006440  20 65 78 61 6d 70 6c 65  3a 0d 1e dc 06 f4 2b 0d  | example:.....+.|
00006450  1e e6 3f f4 2b 20 20 20  20 20 74 3f 74 75 72 6e  |..?.+     t?turn|
00006460  28 39 30 29 3c 45 4e 54  45 52 3e 20 20 20 20 20  |(90)<ENTER>     |
00006470  20 20 20 20 20 28 74 75  72 6e 73 20 54 75 72 74  |     (turns Turt|
00006480  6c 65 20 39 30 20 64 65  67 72 65 65 73 29 0d 1e  |le 90 degrees)..|
00006490  f0 41 f4 2b 20 20 20 20  20 74 3f 74 67 6f 28 31  |.A.+     t?tgo(1|
000064a0  30 30 29 3c 45 4e 54 45  52 3e 20 20 20 20 20 20  |00)<ENTER>      |
000064b0  20 20 20 20 28 61 64 76  61 6e 63 65 73 20 54 75  |    (advances Tu|
000064c0  72 74 6c 65 20 31 30 30  20 75 6e 69 74 73 29 0d  |rtle 100 units).|
000064d0  1e fa 38 f4 2b 20 20 20  20 20 74 3f 3c 45 4e 54  |..8.+     t?<ENT|
000064e0  45 52 3e 20 20 20 20 20  20 20 20 20 20 20 20 20  |ER>             |
000064f0  20 20 20 20 20 28 72 65  74 75 72 6e 73 20 74 6f  |     (returns to|
00006500  20 42 41 53 49 43 29 0d  1f 04 06 f4 2b 0d 1f 0e  | BASIC).....+...|
00006510  0a dd f2 74 72 75 6e 0d  1f 18 0c ea 20 64 75 6d  |...trun..... dum|
00006520  6d 79 25 0d 1f 22 0b f2  74 73 74 61 72 74 0d 1f  |my%.."..tstart..|
00006530  2c 0a f2 74 73 68 6f 77  0d 1f 36 0f 86 e8 20 22  |,..tshow..6... "|
00006540  74 22 2c 63 6f 6d 24 0d  1f 40 0e c8 95 20 63 6f  |t",com$..@... co|
00006550  6d 24 3e 22 22 0d 1f 4a  1b 20 20 20 64 75 6d 6d  |m$>""..J.   dumm|
00006560  79 25 3d a0 28 22 46 4e  74 22 2b 63 6f 6d 24 29  |y%=.("FNt"+com$)|
00006570  0d 1f 54 12 20 20 20 86  e8 20 22 74 22 2c 63 6f  |..T.   .. "t",co|
00006580  6d 24 0d 1f 5e 05 ce 0d  1f 68 05 e1 0d 1f 72 04  |m$..^....h....r.|
00006590  0d 1f 7c 4b f4 2b 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |..|K.+==========|
000065a0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
000065d0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 0d 1f 86 4b f4  |===========...K.|
000065e0  2b 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |+===============|
000065f0  3d 3d 3d 3d 3d 20 4d 61  6b 65 20 48 65 6c 70 20  |===== Make Help |
00006600  66 69 6c 65 73 20 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |files ==========|
00006610  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00006620  3d 3d 3d 3d 3d 3d 0d 1f  90 4b f4 2b 3d 3d 3d 3d  |======...K.+====|
00006630  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00006670  3d 0d 1f 9a 06 f4 2b 0d  1f a4 11 f4 2b 20 20 50  |=.....+.....+  P|
00006680  52 4f 43 40 68 65 6c 70  0d 1f ae 06 f4 2b 0d 1f  |ROC@help.....+..|
00006690  b8 46 f4 2b 20 20 54 68  65 20 70 72 6f 63 65 64  |.F.+  The proced|
000066a0  75 72 65 20 63 72 65 61  74 65 73 20 63 6f 6d 70  |ure creates comp|
000066b0  61 63 74 20 68 65 6c 70  20 66 69 6c 65 73 20 61  |act help files a|
000066c0  6e 64 20 61 20 63 6f 6d  70 61 63 74 20 77 6f 72  |nd a compact wor|
000066d0  6b 69 6e 67 0d 1f c2 46  f4 2b 20 20 76 65 72 73  |king...F.+  vers|
000066e0  69 6f 6e 20 6f 66 20 74  68 65 20 6c 69 62 72 61  |ion of the libra|
000066f0  72 79 2e 20 53 65 6c 65  63 74 20 79 6f 75 72 20  |ry. Select your |
00006700  54 75 72 74 6c 65 47 52  46 58 20 64 69 72 65 63  |TurtleGRFX direc|
00006710  74 6f 72 79 2c 20 74 68  65 6e 0d 1f cc 42 f4 2b  |tory, then...B.+|
00006720  20 20 65 6e 74 65 72 20  42 41 53 49 43 20 61 6e  |  enter BASIC an|
00006730  64 20 6c 6f 61 64 20 54  75 72 74 6c 65 47 52 46  |d load TurtleGRF|
00006740  58 2e 20 54 79 70 65 20  22 50 52 4f 43 40 68 65  |X. Type "PROC@he|
00006750  6c 70 22 20 66 72 6f 6d  20 74 68 65 0d 1f d6 41  |lp" from the...A|
00006760  f4 2b 20 20 42 41 53 49  43 20 70 72 6f 6d 70 74  |.+  BASIC prompt|
00006770  2e 20 54 68 69 73 20 77  69 6c 6c 20 63 72 65 61  |. This will crea|
00006780  74 65 20 74 68 65 20 66  6f 6c 6c 6f 77 69 6e 67  |te the following|
00006790  20 66 69 6c 65 73 20 6f  6e 20 74 68 65 0d 1f e0  | files on the...|
000067a0  1a f4 2b 20 20 63 75 72  72 65 6e 74 20 64 69 72  |..+  current dir|
000067b0  65 63 74 6f 72 79 3a 0d  1f ea 06 f4 2b 0d 1f f4  |ectory:.....+...|
000067c0  47 f4 2b 20 20 54 47 52  46 58 52 75 6e 2e 2e 2e  |G.+  TGRFXRun...|
000067d0  2e 2e 2e 2e 57 6f 72 6b  69 6e 67 20 76 65 72 73  |....Working vers|
000067e0  69 6f 6e 20 6f 66 20 74  68 65 20 6c 69 62 72 61  |ion of the libra|
000067f0  72 79 20 77 69 74 68 6f  75 74 20 63 6f 6d 6d 65  |ry without comme|
00006800  6e 74 73 2e 0d 1f fe 39  f4 2b 20 20 54 47 52 46  |nts....9.+  TGRF|
00006810  58 48 65 6c 70 41 2e 2e  2e 2e 2e 43 6f 6d 70 61  |XHelpA.....Compa|
00006820  63 74 20 68 65 6c 70 20  66 69 6c 65 20 69 6e 20  |ct help file in |
00006830  41 53 43 49 49 20 66 6f  72 6d 61 74 2e 0d 20 08  |ASCII format.. .|
00006840  39 f4 2b 20 20 54 47 52  46 58 48 65 6c 70 42 2e  |9.+  TGRFXHelpB.|
00006850  2e 2e 2e 2e 43 6f 6d 70  61 63 74 20 68 65 6c 70  |....Compact help|
00006860  20 66 69 6c 65 20 69 6e  20 42 41 53 49 43 20 66  | file in BASIC f|
00006870  6f 72 6d 61 74 2e 0d 20  12 2e f4 2b 20 20 44 65  |ormat.. ...+  De|
00006880  6c 65 74 65 4d 65 2e 2e  2e 2e 2e 2e 2e 54 72 61  |leteMe.......Tra|
00006890  6e 73 69 65 6e 74 20 63  6f 6d 6d 61 6e 64 20 66  |nsient command f|
000068a0  69 6c 65 2e 0d 20 1c 06  f4 2b 0d 20 26 41 f4 2b  |ile.. ...+. &A.+|
000068b0  20 20 54 68 65 20 68 65  6c 70 20 66 69 6c 65 73  |  The help files|
000068c0  20 63 6f 6e 74 61 69 6e  20 74 68 65 20 70 72 6f  | contain the pro|
000068d0  63 65 64 75 72 65 20 63  61 6c 6c 20 66 6f 72 6d  |cedure call form|
000068e0  61 74 73 20 66 6f 72 20  61 6c 6c 0d 20 30 31 f4  |ats for all. 01.|
000068f0  2b 20 20 74 68 65 20 72  6f 75 74 69 6e 65 73 20  |+  the routines |
00006900  61 6e 64 20 74 68 65 20  61 73 73 6f 63 69 61 74  |and the associat|
00006910  65 64 20 63 6f 6d 6d 65  6e 74 73 2e 0d 20 3a 06  |ed comments.. :.|
00006920  f4 2b 0d 20 44 0b dd f2  40 68 65 6c 70 0d 20 4e  |.+. D...@help. N|
00006930  0e ea 20 63 68 61 6e 6e  65 6c 25 0d 20 58 1a 63  |.. channel%. X.c|
00006940  68 61 6e 6e 65 6c 25 3d  ae 28 22 44 65 6c 65 74  |hannel%=.("Delet|
00006950  65 4d 65 22 29 0d 20 62  0e d9 23 63 68 61 6e 6e  |eMe"). b..#chann|
00006960  65 6c 25 0d 20 6c 1d 2a  53 45 54 54 59 50 45 20  |el%. l.*SETTYPE |
00006970  44 65 6c 65 74 65 4d 65  20 43 4f 4d 4d 41 4e 44  |DeleteMe COMMAND|
00006980  0d 20 76 1a 63 68 61 6e  6e 65 6c 25 3d ae 28 22  |. v.channel%=.("|
00006990  44 65 6c 65 74 65 4d 65  22 29 0d 20 80 1d d5 23  |DeleteMe"). ...#|
000069a0  63 68 61 6e 6e 65 6c 25  2c 22 4c 49 53 54 4f 20  |channel%,"LISTO |
000069b0  25 30 31 30 30 30 22 0d  20 8a 21 d5 23 63 68 61  |%01000". .!.#cha|
000069c0  6e 6e 65 6c 25 2c 22 2a  53 50 4f 4f 4c 20 54 47  |nnel%,"*SPOOL TG|
000069d0  52 46 58 48 65 6c 70 22  0d 20 94 1c d5 23 63 68  |RFXHelp". ...#ch|
000069e0  61 6e 6e 65 6c 25 2c 22  4c 49 53 54 20 49 46 52  |annel%,"LIST IFR|
000069f0  45 4d 2b 22 0d 20 9e 17  d5 23 63 68 61 6e 6e 65  |EM+". ...#channe|
00006a00  6c 25 2c 22 2a 53 50 4f  4f 4c 22 0d 20 a8 21 d5  |l%,"*SPOOL". .!.|
00006a10  23 63 68 61 6e 6e 65 6c  25 2c 22 2a 53 50 4f 4f  |#channel%,"*SPOO|
00006a20  4c 20 54 47 52 46 58 52  75 6e 41 22 0d 20 b2 15  |L TGRFXRunA". ..|
00006a30  d5 23 63 68 61 6e 6e 65  6c 25 2c 22 4c 49 53 54  |.#channel%,"LIST|
00006a40  22 0d 20 bc 17 d5 23 63  68 61 6e 6e 65 6c 25 2c  |". ...#channel%,|
00006a50  22 2a 53 50 4f 4f 4c 22  0d 20 c6 14 d5 23 63 68  |"*SPOOL". ...#ch|
00006a60  61 6e 6e 65 6c 25 2c 22  4e 45 57 22 0d 20 d0 44  |annel%,"NEW". .D|
00006a70  d5 23 63 68 61 6e 6e 65  6c 25 2c 22 31 30 20 20  |.#channel%,"10  |
00006a80  50 52 4f 43 43 6c 65 61  6e 55 70 28 22 22 54 47  |PROCCleanUp(""TG|
00006a90  52 46 58 52 75 6e 41 22  22 2c 22 22 54 47 52 46  |RFXRunA"",""TGRF|
00006aa0  58 52 75 6e 22 22 2c 22  22 52 45 4d 22 22 29 22  |XRun"",""REM"")"|
00006ab0  0d 20 da 47 d5 23 63 68  61 6e 6e 65 6c 25 2c 22  |. .G.#channel%,"|
00006ac0  32 30 20 20 50 52 4f 43  43 6c 65 61 6e 55 70 28  |20  PROCCleanUp(|
00006ad0  22 22 54 47 52 46 58 48  65 6c 70 22 22 2c 22 22  |""TGRFXHelp"",""|
00006ae0  54 47 52 46 58 48 65 6c  70 41 22 22 2c 22 22 52  |TGRFXHelpA"",""R|
00006af0  45 4d 3e 22 22 29 22 0d  20 e4 18 d5 23 63 68 61  |EM>"")". ...#cha|
00006b00  6e 6e 65 6c 25 2c 22 33  30 20 20 45 4e 44 22 0d  |nnel%,"30  END".|
00006b10  20 ee 38 d5 23 63 68 61  6e 6e 65 6c 25 2c 22 34  | .8.#channel%,"4|
00006b20  30 20 20 44 45 46 50 52  4f 43 43 6c 65 61 6e 55  |0  DEFPROCCleanU|
00006b30  70 28 69 6e 66 69 6c 65  24 2c 6f 75 74 66 69 6c  |p(infile$,outfil|
00006b40  65 24 2c 73 24 29 22 0d  20 f8 1f d5 23 63 68 61  |e$,s$)". ...#cha|
00006b50  6e 6e 65 6c 25 2c 22 35  30 20 20 6c 25 3d 4c 45  |nnel%,"50  l%=LE|
00006b60  4e 28 73 24 29 22 0d 21  02 28 d5 23 63 68 61 6e  |N(s$)".!.(.#chan|
00006b70  6e 65 6c 25 2c 22 36 30  20 20 69 6e 25 3d 4f 50  |nel%,"60  in%=OP|
00006b80  45 4e 49 4e 28 69 6e 66  69 6c 65 24 29 22 0d 21  |ENIN(infile$)".!|
00006b90  0c 2b d5 23 63 68 61 6e  6e 65 6c 25 2c 22 37 30  |.+.#channel%,"70|
00006ba0  20 20 6f 75 74 25 3d 4f  50 45 4e 4f 55 54 28 6f  |  out%=OPENOUT(o|
00006bb0  75 74 66 69 6c 65 24 29  22 0d 21 16 26 d5 23 63  |utfile$)".!.&.#c|
00006bc0  68 61 6e 6e 65 6c 25 2c  22 38 30 20 20 57 48 49  |hannel%,"80  WHI|
00006bd0  4c 45 20 4e 4f 54 20 45  4f 46 23 69 6e 25 22 0d  |LE NOT EOF#in%".|
00006be0  21 20 23 d5 23 63 68 61  6e 6e 65 6c 25 2c 22 39  |! #.#channel%,"9|
00006bf0  30 20 20 6c 69 6e 65 24  3d 47 45 54 24 23 69 6e  |0  line$=GET$#in|
00006c00  25 22 0d 21 2a 21 d5 23  63 68 61 6e 6e 65 6c 25  |%".!*!.#channel%|
00006c10  2c 22 31 30 30 20 43 41  53 45 20 54 52 55 45 20  |,"100 CASE TRUE |
00006c20  4f 46 22 0d 21 34 24 d5  23 63 68 61 6e 6e 65 6c  |OF".!4$.#channel|
00006c30  25 2c 22 31 31 30 20 57  48 45 4e 20 6c 69 6e 65  |%,"110 WHEN line|
00006c40  24 3d 22 22 22 22 22 0d  21 3e 2c d5 23 63 68 61  |$=""""".!>,.#cha|
00006c50  6e 6e 65 6c 25 2c 22 31  32 30 20 57 48 45 4e 20  |nnel%,"120 WHEN |
00006c60  4c 45 46 54 24 28 6c 69  6e 65 24 2c 6c 25 29 3d  |LEFT$(line$,l%)=|
00006c70  73 24 22 0d 21 48 32 d5  23 63 68 61 6e 6e 65 6c  |s$".!H2.#channel|
00006c80  25 2c 22 31 33 30 20 57  48 45 4e 20 4c 45 46 54  |%,"130 WHEN LEFT|
00006c90  24 28 6c 69 6e 65 24 2c  35 29 3d 22 22 3e 4c 49  |$(line$,5)="">LI|
00006ca0  53 54 22 22 22 0d 21 52  34 d5 23 63 68 61 6e 6e  |ST""".!R4.#chann|
00006cb0  65 6c 25 2c 22 31 34 30  20 57 48 45 4e 20 4c 45  |el%,"140 WHEN LE|
00006cc0  46 54 24 28 6c 69 6e 65  24 2c 37 29 3d 22 22 3e  |FT$(line$,7)="">|
00006cd0  2a 53 50 4f 4f 4c 22 22  22 0d 21 5c 1e d5 23 63  |*SPOOL""".!\..#c|
00006ce0  68 61 6e 6e 65 6c 25 2c  22 31 35 30 20 4f 54 48  |hannel%,"150 OTH|
00006cf0  45 52 57 49 53 45 22 0d  21 66 24 d5 23 63 68 61  |ERWISE".!f$.#cha|
00006d00  6e 6e 65 6c 25 2c 22 31  36 30 20 42 50 55 54 23  |nnel%,"160 BPUT#|
00006d10  6f 75 74 25 2c 6c 69 6e  65 24 22 0d 21 70 1c d5  |out%,line$".!p..|
00006d20  23 63 68 61 6e 6e 65 6c  25 2c 22 31 37 30 20 45  |#channel%,"170 E|
00006d30  4e 44 43 41 53 45 22 0d  21 7a 1d d5 23 63 68 61  |NDCASE".!z..#cha|
00006d40  6e 6e 65 6c 25 2c 22 31  38 30 20 45 4e 44 57 48  |nnel%,"180 ENDWH|
00006d50  49 4c 45 22 0d 21 84 2a  d5 23 63 68 61 6e 6e 65  |ILE".!.*.#channe|
00006d60  6c 25 2c 22 31 39 30 20  43 4c 4f 53 45 23 69 6e  |l%,"190 CLOSE#in|
00006d70  25 3a 20 43 4c 4f 53 45  23 6f 75 74 25 22 0d 21  |%: CLOSE#out%".!|
00006d80  8e 1c d5 23 63 68 61 6e  6e 65 6c 25 2c 22 32 30  |...#channel%,"20|
00006d90  30 20 45 4e 44 50 52 4f  43 22 0d 21 98 14 d5 23  |0 ENDPROC".!...#|
00006da0  63 68 61 6e 6e 65 6c 25  2c 22 52 55 4e 22 0d 21  |channel%,"RUN".!|
00006db0  a2 15 d5 23 63 68 61 6e  6e 65 6c 25 2c 22 51 55  |...#channel%,"QU|
00006dc0  49 54 22 0d 21 ac 22 d5  23 63 68 61 6e 6e 65 6c  |IT".!.".#channel|
00006dd0  25 2c 22 2a 44 45 4c 45  54 45 20 54 47 52 46 58  |%,"*DELETE TGRFX|
00006de0  48 65 6c 70 22 0d 21 b6  29 d5 23 63 68 61 6e 6e  |Help".!.).#chann|
00006df0  65 6c 25 2c 22 2a 53 45  54 54 59 50 45 20 54 47  |el%,"*SETTYPE TG|
00006e00  52 46 58 48 65 6c 70 41  20 54 45 58 54 22 0d 21  |RFXHelpA TEXT".!|
00006e10  c0 28 d5 23 63 68 61 6e  6e 65 6c 25 2c 22 2a 42  |.(.#channel%,"*B|
00006e20  41 53 49 43 20 2d 6c 6f  61 64 20 54 47 52 46 58  |ASIC -load TGRFX|
00006e30  48 65 6c 70 41 22 0d 21  ca 24 d5 23 63 68 61 6e  |HelpA".!.$.#chan|
00006e40  6e 65 6c 25 2c 22 53 41  56 45 20 22 22 54 47 52  |nel%,"SAVE ""TGR|
00006e50  46 58 48 65 6c 70 42 22  22 22 0d 21 d4 15 d5 23  |FXHelpB""".!...#|
00006e60  63 68 61 6e 6e 65 6c 25  2c 22 51 55 49 54 22 0d  |channel%,"QUIT".|
00006e70  21 de 22 d5 23 63 68 61  6e 6e 65 6c 25 2c 22 2a  |!.".#channel%,"*|
00006e80  44 45 4c 45 54 45 20 54  47 52 46 58 52 75 6e 41  |DELETE TGRFXRunA|
00006e90  22 0d 21 e8 26 d5 23 63  68 61 6e 6e 65 6c 25 2c  |".!.&.#channel%,|
00006ea0  22 2a 42 41 53 49 43 20  2d 6c 6f 61 64 20 54 47  |"*BASIC -load TG|
00006eb0  52 46 58 52 75 6e 22 0d  21 f2 22 d5 23 63 68 61  |RFXRun".!.".#cha|
00006ec0  6e 6e 65 6c 25 2c 22 53  41 56 45 20 22 22 54 47  |nnel%,"SAVE ""TG|
00006ed0  52 46 58 52 75 6e 22 22  22 0d 21 fc 15 d5 23 63  |RFXRun""".!...#c|
00006ee0  68 61 6e 6e 65 6c 25 2c  22 51 55 49 54 22 0d 22  |hannel%,"QUIT"."|
00006ef0  06 12 d5 23 63 68 61 6e  6e 65 6c 25 2c 22 7c 22  |...#channel%,"|"|
00006f00  0d 22 10 3b d5 23 63 68  61 6e 6e 65 6c 25 2c 22  |.".;.#channel%,"|
00006f10  7c 20 48 65 6c 70 20 66  69 6c 65 73 20 63 72 65  || Help files cre|
00006f20  61 74 65 64 20 6f 6e 20  63 75 72 72 65 6e 74 20  |ated on current |
00006f30  64 69 72 65 63 74 6f 72  79 2e 22 0d 22 1a 44 d5  |directory.".".D.|
00006f40  23 63 68 61 6e 6e 65 6c  25 2c 22 7c 20 41 53 43  |#channel%,"| ASC|
00006f50  49 49 20 68 65 6c 70 20  3d 20 54 47 52 46 58 48  |II help = TGRFXH|
00006f60  65 6c 70 41 2c 20 42 41  53 49 43 20 68 65 6c 70  |elpA, BASIC help|
00006f70  20 3d 20 54 47 52 46 58  48 65 6c 70 42 2e 22 0d  | = TGRFXHelpB.".|
00006f80  22 24 12 d5 23 63 68 61  6e 6e 65 6c 25 2c 22 7c  |"$..#channel%,"||
00006f90  22 0d 22 2e 48 d5 23 63  68 61 6e 6e 65 6c 25 2c  |".".H.#channel%,|
00006fa0  22 7c 20 52 75 6e 74 69  6d 65 20 76 65 72 73 69  |"| Runtime versi|
00006fb0  6f 6e 20 54 47 52 46 58  52 75 6e 20 63 72 65 61  |on TGRFXRun crea|
00006fc0  74 65 64 20 6f 6e 20 63  75 72 72 65 6e 74 20 64  |ted on current d|
00006fd0  69 72 65 63 74 6f 72 79  22 0d 22 38 0e d9 23 63  |irectory"."8..#c|
00006fe0  68 61 6e 6e 65 6c 25 0d  22 42 0d 2a 44 65 6c 65  |hannel%."B.*Dele|
00006ff0  74 65 4d 65 0d 22 4c 05  e1 0d 22 56 04 0d 22 60  |teMe."L..."V.."`|
00007000  4b f4 2b 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |K.+=============|
00007010  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00007040  3d 3d 3d 3d 3d 3d 3d 3d  0d 22 6a 4b f4 2b 3d 3d  |========."jK.+==|
00007050  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
00007060  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 20 45 4e 44 20 3d  |========== END =|
00007070  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00007090  3d 3d 3d 0d ff                                    |===..|
00007095