home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / logo / labybug / ladybg.lst < prev    next >
File List  |  1984-04-20  |  141KB  |  6,403 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  LADYBUG GRAPHICS
  18.  
  19.  IBM/PC REFERENCE MANUAL
  20.  
  21.  VERSION 1.0D
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  21 April 1984
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  David N. Smith
  38.  
  39.  44 Ole Musket Lane
  40.  Danbury, CT 06810
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  (c) Copyright 1983 and 1984 by David N. Smith
  51.  All Rights Reserved.
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  PREFACE
  74.  
  75.  
  76.  LadyBug is an implementation of LOGO Turtle Graphics.  It is
  77.  distributed as "User-Supported" software which means that you do
  78.  not have to pay for it.  You can copy it, give it away, or do
  79.  anything else with it except sell it.
  80.  
  81.  If you find that it is useful, you are invited to make a donation
  82.  of $35 to the author.  The donation is voluntary and in no way
  83.  should be considered as payment for software or services.
  84.  
  85.  Under no circumstances should school teachers feel any obligation
  86.  to make a donation.  One teacher said she has $100 per year for
  87.  software, shared between three teachers, and that she would send
  88.  a donation when they raised money from selling candy.  If that is
  89.  your kind of circumstance, please accept LadyBug with the
  90.  author's compliments.
  91.  
  92.  The author is:
  93.  
  94.     David N. Smith
  95.     44 Ole Musket Lane
  96.     Danbury, CT 06810
  97.  
  98.  The author can also be reached by US mail or EMAIL on CompuServe
  99.  to userid 73145,153.  Please do not phone.
  100.  
  101.  
  102.  
  103.  DISCLAIMER
  104.  
  105.  LADYBUG COMES WITH NO WARRANTIES OF ANY KIND; IT IS AVAILABLE AS
  106.  IS. The author would like to know of problems that users have but
  107.  makes no promise or guarantee that any problem will be fixed.
  108.  Please don't feel that a donation is necessary to report a
  109.  problem or suggest an improvement; it isn't!  In fact, exactly
  110.  the opposite might be true.
  111.  
  112.  IN NO EVENT WILL THE AUTHOR BE LIABLE FOR ANY DAMAGES, INCLUDING
  113.  ANY LOST PROFITS, LOST SAVINGS, FAILURE TO EDUCATE, OR OTHER
  114.  INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF OR
  115.  INABILITY TO USE THIS PROGRAM, EVEN IF THE AUTHOR HAS BEEN
  116.  ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY
  117.  ANY OTHER PARTY.
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                             Page i
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                                            Preface
  137.  
  138.  
  139.  COPYING LADYBUG
  140.  
  141.  Educational institutions, clubs, and other nonprofit organiza-
  142.  tions as well as individuals are granted permission to freely
  143.  copy LadyBug and its documentation and share them with their
  144.  members or students, or individuals with their friends, so long
  145.  as:
  146.  
  147.  1.  No price is charged for the software or documentation.
  148.      However, clubs and other nonprofit organizations may charge a
  149.      distribution fee of up to $6 to cover expenses.
  150.  
  151.  2.  Neither the program nor its documentation are modified in any
  152.      way and are distributed together.
  153.  
  154.  Other organizations, and individuals, are allowed to copy LadyBug
  155.  only if done without charge and so long as the other rules above
  156.  are followed.
  157.  
  158.  Educational institutions, clubs, and other nonprofit organiza-
  159.  tions may make printed copies of this document for distribution
  160.  to members, or students of the institution, provided that any
  161.  price charged does not exceed the actual cost of the duplication
  162.  of the copy, and provided that the document is reproduced in its
  163.  entirety including all copyright and restrictive notices.
  164.  
  165.  NOTICE: LadyBug is NOT in the public domain.  The author retains
  166.  ownership of the program and its copyright.
  167.  
  168.  
  169.  
  170.  USER SUPPORTED SOFTWARE
  171.  
  172.  User-supported software was conceived by Andrew Fluegelman of
  173.  Headlands Press for PC-TALK.  He used the name FreeWare(tm).  Jim
  174.  Button, distributor of PC-FILE, coined the term user-supported
  175.  software.
  176.  
  177.  User-supported does NOT mean that the user must support herself.
  178.  It means that the user herself supports the idea of freely
  179.  distributed software.
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                            Page ii
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                                            Preface
  203.  
  204.  
  205.  SOURCE
  206.  
  207.  LadyBug is written in Basic and then compiled.  Source is NOT
  208.  distributed nor is it available.
  209.  
  210.  
  211.  
  212.  HOW TO GET LADYBUG
  213.  
  214.  If you do not have LadyBug, or if your copy is not current, you
  215.  can get a new copy by sending the author a diskette and a postage
  216.  paid mailer.  You get LadyBug with documentation on disk.  In any
  217.  case, please mark LADYBUG on the OUTSIDE of the envelope.  Send
  218.  no money; LadyBug is free.
  219.  
  220.  LadyBug is available from an ever increasing list of other
  221.  sources.  In particular the Young Peoples LOGO Association
  222.  distributes LadyBug as well as hundreds of procedures written in
  223.  LOGO.  Chapter 1 gives their address.
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                           Page iii
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  TABLE OF CONTENTS
  272.  
  273.  
  274.  1. ABOUT LADYBUG AND LOGO.................................  1
  275.    1.1. LadyBug Features...................................  2
  276.    1.2. LadyBug Requirements...............................  2
  277.    1.3. Additions and Changes From Version 0.9.............  3
  278.    1.4. Changes made in Version 1.0........................  3
  279.    1.5. Why not LadyBug?...................................  4
  280.    1.6. LadyBug Procedure Library..........................  4
  281.    1.7. Thanks To ---......................................  4
  282.  
  283.  2. RUNNING LADYBUG........................................  5
  284.    2.1. Before You Run LadyBug.............................  5
  285.    2.2. Starting...........................................  5
  286.    2.3. LadyBug Function Keys..............................  5
  287.    2.4. Trying Things......................................  6
  288.    2.5. Setting Up a LadyBug Diskette......................  7
  289.    2.6. If Something Goes Wrong............................  8
  290.  
  291.  3. THE WORKSPACE..........................................  9
  292.  
  293.  4. THE LADYBUG SCREENS....................................  10
  294.    4.1. The Graphics Screen................................  10
  295.    4.2. The Text Screen....................................  11
  296.    4.3. The Editing Screen.................................  11
  297.    4.4. Using Two Displays.................................  11
  298.  
  299.  5. THINGS WHICH MAKE UP COMMANDS..........................  12
  300.    5.1. Words..............................................  12
  301.    5.2. Numbers............................................  12
  302.    5.3. Lists..............................................  12
  303.    5.4. Strings............................................  13
  304.    5.5. About Capital Letters..............................  13
  305.    5.6. Expressions........................................  13
  306.  
  307.  6. GRAPHICS COMMANDS......................................  14
  308.    6.1. BACK length    (Abbreviated BK)....................  14
  309.    6.2. BACKGROUND color    (Abbreviated BG)...............  14
  310.    6.3. CLEARSCREEN    (Abbreviated CS)....................  15
  311.    6.4. CLIP...............................................  15
  312.    6.5. DRAW...............................................  15
  313.    6.6. FORWARD length   (Abbreviated FD)..................  16
  314.    6.7. HIDEBUG    (Abbreviated HB)........................  16
  315.    6.8. HIDETURTLE    (Abbreviated HT).....................  16
  316.    6.9. HOME...............................................  16
  317.    6.10. LEFT angle   (Abbreviated LT).....................  16
  318.    6.11. NOCLIP............................................  17
  319.    6.12. NODRAW   (Abbreviated ND).........................  17
  320.    6.13. NOWRAP............................................  17
  321.    6.14. NOWINDOW..........................................  17
  322.    6.15. PAINT paintcolor bordercolor......................  18
  323.    6.16. PALETTE palettenumber.............................  18
  324.    6.17. PENCOLOR color   (Abbreviated PC).................  18
  325.  
  326.  
  327.                                                            Page iv
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                  Table of Contents
  335.  
  336.  
  337.    6.18. PENDOWN   (Abbreviated PD)........................  19
  338.    6.19. PENUP   (Abbreviated PU)..........................  19
  339.    6.20. RIGHT angle   (Abbreviated RT)....................  19
  340.    6.21. SETHEADING angle   (Abbreviated SETH).............  19
  341.    6.22. SETBG color.......................................  20
  342.    6.23. SETPAL palette....................................  20
  343.    6.24. SETPC color.......................................  20
  344.    6.25. SETSCRUNCH n   (Also: .SETSCRUNCH)................  20
  345.    6.26. SETX xcoord.......................................  20
  346.    6.27. SETXY xcoord ycoord...............................  21
  347.    6.28. SETY ycoord.......................................  21
  348.    6.29. SHOWBUG   (Abbreviated SB)........................  21
  349.    6.30. SHOWTURTLE   (Abbreviated ST).....................  21
  350.    6.31. WINDOW............................................  22
  351.    6.32. WRAP..............................................  22
  352.  
  353.  7. SOUNDS.................................................  23
  354.    7.1. BEEP...............................................  23
  355.    7.2. PLAY string........................................  23
  356.    7.3. TONE frequency n...................................  24
  357.  
  358.  8. INPUT AND OUTPUT.......................................  25
  359.    8.1. CLEARINPUT.........................................  25
  360.    8.2. PRINT word   (Abbreviated PR)......................  25
  361.    8.3. PRINT1 word   (Abbreviated PR1)....................  25
  362.    8.4. TYPE word..........................................  26
  363.  
  364.  9. TEXT MODE..............................................  27
  365.    9.1. CLEARTEXT   (Abbreviated CT).......................  27
  366.    9.2. CURSOR column row..................................  27
  367.    9.3. SETWIDTH columns...................................  28
  368.    9.4. TEXTCOLUMNS columns   (Abbreviated TCOLS)..........  28
  369.  
  370.  10. CONTROL COMMANDS......................................  29
  371.    10.1. EDIT procname ...   (Abbreviated ED)..............  29
  372.    10.2. EDIT ALL..........................................  29
  373.    10.3. END...............................................  29
  374.    10.4. ERROR message.....................................  30
  375.    10.5. FOREVER list......................................  30
  376.    10.6. GOODBYE   (Abbreviated BYE).......................  30
  377.    10.7. IF condition THEN action..........................  30
  378.    10.8. IF condition [action].............................  31
  379.    10.9. IF condition THEN action1 ELSE action2............  31
  380.    10.10. IF condition [action1] [action2].................  32
  381.    10.11. IFFALSE list.....................................  32
  382.    10.12. IFTRUE list......................................  32
  383.    10.13. LOCAL variablename...............................  33
  384.    10.14. MAKE "variablename value.........................  34
  385.    10.15. OUTPUT value   (Abbreviated OP)..................  34
  386.    10.16. RANDOMIZE number.................................  35
  387.    10.17. REPEAT number list...............................  35
  388.    10.18. RUN list.........................................  35
  389.    10.19. STOP.............................................  36
  390.    10.20. TEST condition...................................  36
  391.  
  392.  
  393.                                                             Page v
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                                  Table of Contents
  401.  
  402.  
  403.    10.21. TOPLEVEL.........................................  36
  404.    10.22. WAIT time........................................  36
  405.    10.23. WHILE condition list.............................  36
  406.  
  407.  11. MANAGING THE WORKSPACE................................  37
  408.    11.1. CATALOG   (Abbreviated CAT).......................  37
  409.    11.2. CLEARWS...........................................  37
  410.    11.3. DEFINE "name list.................................  37
  411.    11.4. EDIT procname ....................................  38
  412.    11.5. EDIT ALL..........................................  38
  413.    11.6. ERASE procedurename...............................  38
  414.    11.7. ERASE ALL.........................................  38
  415.    11.8. ERASEFILE filename................................  39
  416.    11.9. ERNAME variablename...............................  39
  417.    11.10. ERNAME ALL.......................................  39
  418.    11.11. LOAD filename....................................  39
  419.    11.12. PRINTOUT name   (Abbreviated PO).................  39
  420.    11.13. READ filename....................................  40
  421.    11.14. SAVE filename....................................  40
  422.    11.15. TO procname inputs...............................  40
  423.  
  424.  12. RUNNING AND DEBUGGING PROCEDURES......................  41
  425.    12.1. Running Procedures................................  41
  426.    12.2. Pausing Procedures................................  41
  427.    12.3. Editing Active Procedures.........................  42
  428.    12.4. CONTINUE    (Abbreviated CO)......................  42
  429.    12.5. NOTRACE...........................................  42
  430.    12.6. PAUSE.............................................  42
  431.    12.7. TOPLEVEL..........................................  43
  432.    12.8. TRACE.............................................  43
  433.    12.9. ;  (comment)......................................  43
  434.  
  435.  13. NUMBERS AND COMPUTATIONS..............................  44
  436.    13.1. Numbers...........................................  44
  437.    13.2. Numeric and Mathematical Values...................  44
  438.    13.3. Other Words.......................................  47
  439.    13.4. Expressions Resulting in Numbers..................  48
  440.    13.5. Expressions Resulting in True or False............  49
  441.    13.6. Procedures........................................  50
  442.  
  443.  14. WORKSPACES WITH TOOLS.................................  52
  444.    14.1. AND  t/f  t/f.....................................  52
  445.    14.2. FOREVER list......................................  52
  446.    14.3. MAX value1 value2.................................  52
  447.    14.4. MIN value1 value2.................................  52
  448.    14.5. OR  t/f  t/f......................................  53
  449.    14.6. WAIT time.........................................  53
  450.    14.7. WHILE [condition] [commands]......................  53
  451.    14.8. XOR  t/f  t/f.....................................  53
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                                            Page vi
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                                  Table of Contents
  467.  
  468.  
  469.  15. INTRODUCTION TO THE LADYBUG EDITOR....................  54
  470.    15.1. About the Editor..................................  54
  471.    15.2. Invoking the Editor...............................  54
  472.    15.3. The LadyBug Editor Keys...........................  55
  473.  
  474.  16. HINTS ON USING LADYBUG................................  57
  475.    16.1. Printing the Screen On an IBM or Epson Printer....  57
  476.    16.2. Printing the Screen On Other Printers.............  57
  477.    16.3. The READ Command..................................  57
  478.    16.4. Tailoring LadyBug: The Profile....................  58
  479.    16.5. Performance Hints.................................  58
  480.  
  481.  APPENDIX A. ABOUT THE LADYBUG EDITOR......................  59
  482.    A.1. The LadyBug Editor Keys............................  59
  483.  
  484.  APPENDIX B. THE PLAY COMMAND..............................  62
  485.    B.1. Music Commands.....................................  62
  486.    B.2. Examples of Play Statements........................  65
  487.  
  488.  APPENDIX C. A GUIDE TO EXAMPLE PROCEDURES.................  66
  489.    C.1. BCAKE..............................................  66
  490.    C.2. C..................................................  66
  491.    C.3. DYNA...............................................  66
  492.    C.4. DRAGON.............................................  67
  493.    C.5. DUOPOLY............................................  67
  494.    C.6. HILBERT............................................  67
  495.    C.7. INSPI..............................................  67
  496.    C.8. LUDWIG.............................................  68
  497.    C.9. MISC...............................................  68
  498.    C.10. POLY..............................................  68
  499.    C.11. POLYSPI...........................................  69
  500.    C.12. RAIL..............................................  69
  501.    C.13. SLINKY............................................  69
  502.    C.14. SNOWFLAK..........................................  70
  503.    C.15. SPIRO.............................................  70
  504.    C.16. SOUNDS............................................  70
  505.    C.17. SPINSQ............................................  71
  506.    C.18. TREES.............................................  71
  507.  
  508.  APPENDIX D. FORMAT AND CONTENTS OF SAVED WORKSPACES.......  72
  509.  
  510.  APPENDIX E. REDEFINING THE NAMES OF PRIMITIVES............  73
  511.    E.1. .PRIMSYN [list]....................................  73
  512.  
  513.  APPENDIX F. HACKERS ONLY..................................  74
  514.    F.1. .DEBUG.............................................  74
  515.    F.2. .STACK.............................................  74
  516.    F.3. .SYMTAB............................................  74
  517.    F.4. Names that return values...........................  74
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                                                           Page vii
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                                  Table of Contents
  533.  
  534.  
  535.  APPENDIX G. ERROR MESSAGES................................  76
  536.  
  537.  APPENDIX H. LIMITS AND CAPACITIES.........................  79
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.                                                          Page viii
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  1. ABOUT LADYBUG AND LOGO
  602.  
  603.  
  604.  LadyBug is a graphics language based on LOGO Turtle Graphics.  It
  605.  contains most of the graphics commands, procedure making
  606.  commands, and control commands from the Apple II(1)
  607.  implementation of LOGO done by Terrapin, Inc.  with additions for
  608.  compatibility with IBM Logo.
  609.  
  610.  Apple LOGO is described in the book LOGO FOR THE APPLE II by
  611.  Harold Abelson, published by McGraw-Hill in 1982.  It is very
  612.  similar to other versions for the Apple II, IBM PC, Texas
  613.  Instruments, and TRS-80(2) computers.
  614.  
  615.  This manual describes the LadyBug language but is not an
  616.  introduction to LOGO.  We highly recommend the book LOGO FOR THE
  617.  APPLE II for its very understandable presentation of LOGO and for
  618.  its many examples.
  619.  
  620.  DISCOVERING APPLE LOGO by David D. Thornburg is another very
  621.  readable, although less complete, introduction to LOGO.  It was
  622.  published by Addison-Wesley in 1983.
  623.  
  624.  For children, or adults who are going to work with children, the
  625.  book LEARNING WITH LOGO, Daniel Watt, McGraw-Hill, 1983, is
  626.  highly recommended.  It is written by a person who is both an
  627.  elementary teacher, and who has worked with the LOGO group at MIT
  628.  for many years.
  629.  
  630.  The book TURTLE GEOMETRY, Abelson and diSessa, MIT Press, 1980 is
  631.  recommended for adults and advanced High School students.  It
  632.  takes the form of a college text book on mathematics using Turtle
  633.  Graphics as the mechanism.
  634.  
  635.  A good source of ideas and programs is the YOUNG PEOPLES' LOGO
  636.  ASSOCIATION, 1208 Hillsdale Drive, Richardson, TX 75081.  On
  637.  CompuServe, YPLA can be reached at 70130,250 and on the Source
  638.  they are T10143.  YPLA publishes a monthly newsletter and has a
  639.  large library of public domain LOGO software for a wide variety
  640.  of machines.
  641.  
  642.  Of course, MINDSTORMS, Seymour Pappert, Basic Books, 1980 is the
  643.  ultimate source of WHY LOGO.
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  ____________________
  652.  
  653.  (1) Apple II is a Trademark of Apple, Inc.
  654.  (2) TRS-80 is a Trademark of Tandy.
  655.  
  656.  
  657.                                                             Page 1
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                             About LadyBug and LOGO
  665.  
  666.  
  667.  1.1. LADYBUG FEATURES
  668.  
  669.  LadyBug is a version of LOGO patterned after the Apple II
  670.  implementation developed by Terrapin, Inc. and with additions to
  671.  make it compatible with many IBM LOGO commands.
  672.  
  673.  LadyBug features include:
  674.  
  675.  -   Sounds; a PLAY statement and a TONE statement.
  676.  -   Major graphics support (32 primitives).
  677.  -   Painting of areas.
  678.  -   Clipping of drawings (as well as wraparound).
  679.  -   Support for using both displays if both are present.
  680.  -   Text mode support of the whole screen.
  681.  
  682.  -   A fast full screen editor.
  683.  -   Procedure control commands (24 primitives).
  684.  -   Workspace management (14 primitives).
  685.  -   Pausing and resuming procedures.
  686.  -   Tracing of procedures.
  687.  
  688.  -   Floating point and integer arithmetic.
  689.  -   32 builtin graphics and mathematical functions.
  690.  -   6 arithmetic operations and 6 relational operations.
  691.  
  692.  -   Interactive HELP facility.
  693.  -   Workspaces of tools and procedures.
  694.  
  695.  The major features missing (compared to Apple LOGO) are:
  696.  
  697.  -   Many list manipulation primitives.
  698.  -   Variable numbers of parameters to primitives.
  699.  -   Saving screen images.  (Procedures can be saved though).
  700.  
  701.  
  702.  
  703.  1.2. LADYBUG REQUIREMENTS
  704.  
  705.  LadyBug requires a system with at least:
  706.  
  707.  -   128K of memory.
  708.  -   One single sided disk drive.
  709.  -   A graphics adaptor.
  710.  -   A graphics display of any kind.  Color is supported only on a
  711.      color display; 80 column editing is supported only on a high
  712.      resolution monitor.  A color TV set will work but colors will
  713.      not be accurate.
  714.  -   DOS 1.1, 2.0, or 2.1.  (DOS 1.0 has not been tested.)
  715.  -   An IBM PC  or compatible machine.
  716.  
  717.  The distribution diskette is double sided and requires DOS 1.1 or
  718.  later.  Files for execution of LadyBug can be copied to a single
  719.  sided diskette.
  720.  
  721.  
  722.  
  723.                                                             Page 2
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                                             About LadyBug and LOGO
  731.  
  732.  
  733.  The IBM Monochrome Display is also supported, if present, for
  734.  editing and when in text mode.  References in this document to
  735.  "the Monochrome display" refer to the IBM Monochrome Display and
  736.  not to a black and white graphics monitor.
  737.  
  738.  
  739.  
  740.  1.3. ADDITIONS AND CHANGES FROM VERSION 0.9
  741.  
  742.  The changes made in version 1.0, as compared to version 0.9,
  743.  include:
  744.  
  745.  -   returning values from procedures;
  746.  -   help key;
  747.  -   pausing procedures and then continuing;
  748.  -   SETSCRUNCH to adjust aspect ratios;
  749.  -   TEST, IFTRUE, and IFFALSE commands;
  750.  -   some list support;
  751.  -   some IBM LOGO syntax compatibility;
  752.  -   expanded limits for the size of procedures, number of lines
  753.      to edit, and sizes of constants;
  754.  -   text screen support;
  755.  -   tools workspaces; and
  756.  -   many new builtin functions.
  757.  
  758.  Many smaller changes have also been made.  In addition the manual
  759.  has been expanded with additional information, examples, and an
  760.  index.
  761.  
  762.  
  763.  
  764.  1.4. CHANGES MADE IN VERSION 1.0
  765.  
  766.  
  767.  -   .PRIMSYN command for adding synonyms for primitive commands.
  768.  -   Many fixes to problems.  These are listed in the file
  769.      STATUS.LST on the distribution diskette.
  770.  
  771.  If other enhancements are made after this document is prepared,
  772.  they will be given in the file STATUS.LST on the distribution
  773.  diskette.
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.                                                             Page 3
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                                             About LadyBug and LOGO
  797.  
  798.  
  799.  1.5. WHY NOT LADYBUG?
  800.  
  801.  LadyBug was written as an introduction to LOGO and Turtle
  802.  Graphics for the author's children prior to the availability of a
  803.  commercial version of LOGO for the PC.  Thoughts of distribution
  804.  came later as others asked for copies and suggested that it be
  805.  further distributed.
  806.  
  807.  The author recommends that those with a serious need for LOGO
  808.  investigate the use of a commercial version of LOGO rather than
  809.  LadyBug.  There are several reasons:
  810.  
  811.  -   LadyBug is slower.
  812.  -   LadyBug doesn't do as much.
  813.  -   LadyBug is not supported in the same sense the commercial
  814.      versions are supported.  If you have a bug, then you might
  815.      have a bug forever.
  816.  -   LadyBug will not grow and progress significantly with time.
  817.  -   LadyBug is not as well documented.
  818.  
  819.  In particular, the IBM version of LOGO is a very powerful
  820.  implementation which also runs under PC/DOS.  It stores
  821.  workspaces in a manner similar to LadyBug; conversion to it
  822.  should not be difficult.
  823.  
  824.  
  825.  
  826.  1.6. LADYBUG PROCEDURE LIBRARY
  827.  
  828.  There is not much of a library now except as described in the
  829.  Tools chapter and in the Appendix on example procedures.  I hope
  830.  that LadyBug users will contribute procedures to a library so
  831.  that other users can share their efforts.  Contribute them either
  832.  to the author or to the Young Peoples LOGO Association.
  833.  
  834.  
  835.  
  836.  1.7. THANKS TO ---
  837.  
  838.  Thanks to the inventors of LOGO for inventing it.
  839.  
  840.  Thanks to my children for playing with LadyBug.
  841.  
  842.  Thanks to ReadiWriter, a very powerful text formatter, for making
  843.  it so easy to do a document this complex.  In particular, the
  844.  indexing was a breeze; without a program like ReadiWriter there
  845.  wouldn't have been an index.
  846.  
  847.  Thanks to all of those who have made suggestions, found bugs, and
  848.  helped out in many other ways.
  849.  
  850.  And thanks to my wife for putting up with me while I wrote
  851.  LadyBug.
  852.  
  853.  
  854.  
  855.                                                             Page 4
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  2. RUNNING LADYBUG
  866.  
  867.  
  868.  
  869.  2.1. BEFORE YOU RUN LADYBUG
  870.  
  871.  The LadyBug diskette should be backed up.  Never run the only one
  872.  you have if you value being able to run LadyBug tomorrow.
  873.  
  874.  LadyBug is initially distributed on double sided diskettes.  If
  875.  you have single sided drives you should get someone with double
  876.  sided drives to copy the files onto diskettes formatted for
  877.  single sided use.
  878.  
  879.  Although LadyBug will run with the diskette setup as distributed,
  880.  a section below describes how to set up working disks in order to
  881.  maximize the amount of working space and to make them self
  882.  booting.
  883.  
  884.  
  885.  
  886.  2.2. STARTING
  887.  
  888.  Boot DOS up.  Put the LadyBug diskette into the A: drive.  See
  889.  the DOS manual for information about how to make the LadyBug
  890.  diskette contain enough of DOS to boot up itself.  With an
  891.  AUTOEXEC.BAT file on the diskette you can have LadyBug start up
  892.  automatically when the machine is turned on.
  893.  
  894.  Type "LADYBUG".  After a few seconds you will be in LadyBug
  895.  command mode.
  896.  
  897.  
  898.  
  899.  2.3. LADYBUG FUNCTION KEYS
  900.  
  901.  The LadyBug function keys control how LadyBug programs run or
  902.  stop them from running.  They may be used any time that LadyBug
  903.  is running.  When LadyBug is waiting for input you will have to
  904.  press the enter key before the action takes effect.  (In the
  905.  editor, the function keys have different meanings.)
  906.  
  907.  F1
  908.      Stop a running procedure and return to the command level from
  909.      which it was invoked.
  910.  
  911.  F3
  912.      Display the help menu.
  913.  
  914.  F5
  915.      Pause execution of a procedure or command and re-enter
  916.      LadyBug command mode.  Procedures and commands can be run and
  917.      then the paused command can be restarted by typing CONTINUE
  918.      (or CO).  F1 will stop procedures invoked from a pause level
  919.  
  920.  
  921.                                                             Page 5
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                                    Running LadyBug
  929.  
  930.  
  931.      and return to that pause level.  Procedures or commands run
  932.      from a pause level can themselves be paused, etc.
  933.  
  934.  F9
  935.      Switch on or off TRACE mode.  When it is on, each command
  936.      that is executed is displayed and LadyBug pauses for you to
  937.      press any key.
  938.  
  939.  F10
  940.      Hide or unhide the display of the LadyBug herself.  (She
  941.      looks like an arrow due to the radiation armor she wears!)
  942.      PROCEDURES RUN FASTER TWO OR THREE TIMES FASTER WHEN SHE IS
  943.      HIDDEN but are easier to understand when she is visible.
  944.  
  945.  
  946.  
  947.  2.4. TRYING THINGS
  948.  
  949.  The procedure POLY is already defined when LadyBug starts up.
  950.  (POLY is a simple and commonly used illustration of LOGO.)  To
  951.  try something, type DRAW.  DRAW tells LadyBug you want to do
  952.  graphics; it clears the screen and positions the LadyBug at the
  953.  center of the screen.  Then type one of these:
  954.  
  955.     poly 100 100
  956.     poly 100 144
  957.     poly 100 162
  958.  
  959.  Press F1 to stop the drawing; it will continue to run, retracing
  960.  its path, until you stop it.  If you press F10 while the figure
  961.  is being drawn then the LadyBug hides.  Press it again to get her
  962.  back.
  963.  
  964.  Type DRAW to clear the screen and to reset the LadyBug to her
  965.  home position.
  966.  
  967.  There are many examples which come with LadyBug; they are briefly
  968.  described in appendix C.  Try this:
  969.  
  970.     read "polyspi
  971.     clip
  972.     polyspi 5 144 5
  973.  
  974.  Press F1 to stop it.  Then try:
  975.  
  976.     draw
  977.     polyspi 1 45 1
  978.  
  979.  Or try:
  980.  
  981.     draw
  982.     polyspi 5 175 5
  983.  
  984.  POLY is a three statement procedure.  POLYSPI is too.  The wide
  985.  
  986.  
  987.                                                             Page 6
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                                                    Running LadyBug
  995.  
  996.  
  997.  variations in each come from minor changes in how far a line is
  998.  drawn and how much of a turn is then made.  It is difficult to
  999.  believe that the three POLYSPI drawings come from the SAME
  1000.  trivial program.
  1001.  
  1002.  
  1003.  
  1004.  2.5. SETTING UP A LADYBUG DISKETTE
  1005.  
  1006.  LadyBug will run from the diskette it is distributed on.
  1007.  However, this diskette has files on it which are not needed for
  1008.  running LadyBug.  The following procedure describes how to build
  1009.  a diskette which holds only those things you need.
  1010.  
  1011.  1.  Format a diskette with the DOS FORMAT command.  Use the /S
  1012.      option if you want it to automatically startup when you turn
  1013.      on the machine.
  1014.  
  1015.  2.  Put the diskette from step one into the B: drive.  Put the
  1016.      LadyBug diskette into the A: drive.
  1017.  
  1018.  3.  Issue these commands:
  1019.  
  1020.         copy a:*.exe b:
  1021.         copy a:help*.bug b:
  1022.         copy a:profile.bug b:
  1023.  
  1024.      These files should take about 100K leaving about 60K on a DOS
  1025.      1.1 single sided diskette, 80K on a DOS 2.0 single sided
  1026.      diskette, 220K on a DOS 1.1 double sided diskette, and 260K
  1027.      on a DOS 2.0 double sided diskette.
  1028.  
  1029.      Files with an extension of BUG contain LadyBug procedures.
  1030.      The ones copied above are necessary for LadyBug to function
  1031.      properly.  Other BUG files contain tools or demonstration
  1032.      programs and can be copied as needed.  If you want them all,
  1033.      type:
  1034.  
  1035.         copy a:*.bug b:
  1036.  
  1037.  4.  If you want the diskette to automatically start LadyBug when
  1038.      the power is turned on, you need to create an AUTOEXEC.BAT
  1039.      file.  The DOS manual describes how to do this.  The file
  1040.      should contain the following lines:
  1041.  
  1042.         date
  1043.         time
  1044.         ladybug
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.                                                             Page 7
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                                                    Running LadyBug
  1061.  
  1062.  
  1063.  2.6. IF SOMETHING GOES WRONG
  1064.  
  1065.  The appendix "Error Messages" lists the error messages that
  1066.  LadyBug puts out.  Two of these messages indicate a problem
  1067.  within LadyBug.  Hopefully these will never be printed but if
  1068.  they are it is very important that you communicate them to the
  1069.  author.  These are:
  1070.  
  1071.     FATAL ERROR n AT m
  1072.     INTERNAL ERROR n
  1073.  
  1074.  The "n" and "m" are numbers which vary from error to error and
  1075.  which are very important in determining what happened.
  1076.  
  1077.  LadyBug will almost always recover from these errors and allow
  1078.  you to continue without loss of data.  However, it is recommended
  1079.  that you stop LadyBug as soon as you can afterwards and reload a
  1080.  fresh copy.  Also, do not save the workspace (except into a new
  1081.  file) without examining it to make sure the error did not cause
  1082.  damage to it.
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.                                                             Page 8
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  3. THE WORKSPACE
  1130.  
  1131.  
  1132.  LadyBug provides a work area in which you keep variables and
  1133.  procedures.  This work area is called a "workspace".
  1134.  
  1135.  The workspace initially contains only the procedure POLY.  Many
  1136.  LadyBug commands add to, modify things in, or remove things from
  1137.  the workspace.
  1138.  
  1139.     COMMAND    ACTION
  1140.     CLEARWS    Delete everything in the workspace
  1141.     EDIT       Add or change procedures
  1142.     ERASE      Delete a procedure or all procedures
  1143.     ERNAME     Delete a variable or all variables
  1144.     LOAD       Load things from another workspace
  1145.     SAVE       Save the workspace on disk
  1146.     TO         Define a procedure
  1147.  
  1148.  These commands are described elsewhere in this manual.
  1149.  
  1150.  As you work you add things to your current workspace.  When you
  1151.  are done you can either type BYE and leave LadyBug without saving
  1152.  the workspace or you can type SAVE and save it first.  SAVE
  1153.  requires that you name the workspace.  When you next start you
  1154.  can READ (or LOAD) that workspace and continue.
  1155.  
  1156.  You can have several workspaces for several projects or classes.
  1157.  If you have students, each can have her own workspace.
  1158.  
  1159.  The things that can go into a workspace are:
  1160.  
  1161.  Procedures
  1162.      Procedures are lists of commands that you want to run.  They
  1163.      have names, such as "poly", "fred", or "butterfly", that you
  1164.      make up.  Later on we will talk about how to create
  1165.      procedures.
  1166.  
  1167.  Variables
  1168.      Variables are named values.  Variables have names, such as
  1169.      "x", "fred", or "length", that you also make up.  Variables
  1170.      often are written with a semicolon like this:
  1171.  
  1172.         :x    :fred    :length
  1173.  
  1174.      The semicolon asks LadyBug to get the current value of the
  1175.      variable and use it.  We will see these in some examples
  1176.      before we get back to discussing variables in more detail.
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.                                                             Page 9
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  4. THE LADYBUG SCREENS
  1196.  
  1197.  
  1198.  This chapter describes the different views of LadyBug seen on the
  1199.  screen.
  1200.  
  1201.  The TEXT SCREEN shows text.  When the text screen is current,
  1202.  LadyBug is said to be in "Text Mode".
  1203.  
  1204.  The GRAPHICS SCREEN shows graphics.  When the graphics screen is
  1205.  current, LadyBug is said to be in "Graphics Mode".
  1206.  
  1207.  The EDIT SCREEN shows procedures which can be changed.  When the
  1208.  edit screen is current, LadyBug is said to be "in the editor".
  1209.  
  1210.  
  1211.  
  1212.  4.1. THE GRAPHICS SCREEN
  1213.  
  1214.  When LadyBug starts up it is in text mode.  To get into graphics
  1215.  mode, type "DRAW".  In graphics mode, commands which draw are
  1216.  allowed.  Commands which display text do so in a small area at
  1217.  the bottom of the screen.(3) If you forget to type DRAW, LadyBug
  1218.  will automatically switch to the graphics screen when you issue
  1219.  any command which needs it.
  1220.  
  1221.  Graphics mode is re-entered each time you give the DRAW command.
  1222.  
  1223.  The graphics screen is 300 units high by 500 units wide.  The
  1224.  center is the origin.(4)
  1225.  
  1226.  The LadyBug starts at the center of the screen facing towards the
  1227.  top of the screen.  This direction has a heading of zero.  Turns
  1228.  to the right are considered positive and to the left are
  1229.  considered negative.
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  ____________________
  1242.  
  1243.  (3) This area is two lines of up to 80 characters total.
  1244.  (4) Note that the coordinates of the LadyBug screen do not map
  1245.  exactly to the coordinates of the computers screen.  This is
  1246.  because there is nothing magic about the number of dots on the
  1247.  computers screen; different modes and different computers can
  1248.  have differing numbers of dots.
  1249.  
  1250.  
  1251.                                                            Page 10
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                                                The LadyBug Screens
  1259.  
  1260.  
  1261.  150  +----+----+----+----+----+----+----+----+----+----+
  1262.       |                                                 |
  1263.       |                                                 |
  1264.  100  +                                                 +
  1265.       |                                                 |
  1266.       |                                                 |
  1267.   50  +                                                 +
  1268.       |                                                 |
  1269.       |                                                 |
  1270.   0   +                        + (center)               +
  1271.       |                                                 |
  1272.       |                                                 |
  1273.  -50  +                                                 +
  1274.       |                                                 |
  1275.       |                                                 |
  1276.  -100 +                                                 +
  1277.       |                                                 |
  1278.       |                                                 |
  1279.  -150 +----+----+----+----+----+----+----+----+----+----+
  1280.     -250 -200 -150 -100  -50   0    50  100  150  200  250
  1281.  
  1282.                   Graphics Screen Coordinates
  1283.  
  1284.  
  1285.  
  1286.  4.2. THE TEXT SCREEN
  1287.  
  1288.  In text mode, LadyBug does not allow graphics but does allow a
  1289.  full screen of text.  Text mode is entered with the NODRAW
  1290.  command.
  1291.  
  1292.  
  1293.  
  1294.  4.3. THE EDITING SCREEN
  1295.  
  1296.  The editing screen replaces whichever screen is active when the
  1297.  EDIT or TO commands are given.  When editing ends, the previous
  1298.  screen type is restored but the screen is clear.
  1299.  
  1300.  
  1301.  
  1302.  4.4. USING TWO DISPLAYS
  1303.  
  1304.  If present, the IBM Monochrome display is used as the text screen
  1305.  and the editing screen.  The graphics display always contains the
  1306.  graphics screen.
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.                                                            Page 11
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  5. THINGS WHICH MAKE UP COMMANDS
  1328.  
  1329.  
  1330.  This chapter describes the kinds of things which are used in
  1331.  LadyBug commands.
  1332.  
  1333.  
  1334.  
  1335.  5.1. WORDS
  1336.  
  1337.  Words are groups of characters separated from each other by
  1338.  blanks.
  1339.  
  1340.  Examples:
  1341.  
  1342.     fred  *****  $129.50
  1343.  
  1344.  Each of "fred", "*****", and "$129.50" are words.
  1345.  
  1346.  Some special words, such as those starting with a left bracket
  1347.  ("[") or a quote mark may contain blanks; see below.
  1348.  
  1349.  
  1350.  
  1351.  5.2. NUMBERS
  1352.  
  1353.  Numbers are special kinds of words.  Numeric values come in two
  1354.  types: integer, and floating point.
  1355.  
  1356.  Integer numbers have only whole number values.  These values must
  1357.  be in the range of -32768 to 32767.  Floating point numbers have
  1358.  whole number and fractional values and an optional exponent.
  1359.  
  1360.  Examples:
  1361.  
  1362.     1    954    1.2    1.2e12
  1363.  
  1364.  Numbers are described in more detail later.
  1365.  
  1366.  
  1367.  
  1368.  5.3. LISTS
  1369.  
  1370.  Lists start with a left bracket and end with a right bracket.
  1371.  Examples of lists include:
  1372.  
  1373.     [This is a list of words]
  1374.     [ [This is a list] [of lists] ]
  1375.  
  1376.  Within a list, the number of left and right brackets are counted.
  1377.  The end of the list occurs after the right bracket which
  1378.  corresponds to the starting left bracket.  If a line ends before
  1379.  the ending bracket, it is assumed to be present.
  1380.  
  1381.  
  1382.  
  1383.                                                            Page 12
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                                      Things Which Make Up Commands
  1391.  
  1392.  
  1393.  5.4. STRINGS
  1394.  
  1395.  Strings are words which start with a quote mark.  Examples of
  1396.  strings are:
  1397.  
  1398.     "frank
  1399.     "(
  1400.  
  1401.  Strings may contain characters, such as a left parenthesis, which
  1402.  would otherwise be taken as something else.  Strings can also
  1403.  contain blanks:
  1404.  
  1405.  Example:
  1406.  
  1407.     "'This is a string with blanks'
  1408.  
  1409.  The second character is an apostrophe; this means that every
  1410.  character up to the next apostrophe (or the end of the line) is a
  1411.  part of the word.
  1412.  
  1413.  Strings may not contain left ([) or right (]) brackets.
  1414.  
  1415.  
  1416.  
  1417.  5.5. ABOUT CAPITAL LETTERS
  1418.  
  1419.  In this document command names are shown in capital letters.
  1420.  LadyBug will accept either capitals or lowercase for any command
  1421.  name, file identifier, procedure, variable, or other word special
  1422.  to LadyBug.
  1423.  
  1424.  
  1425.  
  1426.  5.6. EXPRESSIONS
  1427.  
  1428.  Numbers, and variables with numbers as their values, can be
  1429.  combined into expressions.  Everywhere that LadyBug is looking
  1430.  for a number you can write an expression.  Expressions will be
  1431.  described in detail later in this manual.
  1432.  
  1433.  Examples:
  1434.  
  1435.     2 + 4
  1436.     2 + :a
  1437.     4 * sin :angle
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.                                                            Page 13
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  6. GRAPHICS COMMANDS
  1460.  
  1461.  
  1462.  This section describes the LadyBug graphics commands.  These
  1463.  commands move and turn the LadyBug, paint areas, and control
  1464.  which colors are used.
  1465.  
  1466.  If issued in text mode, they cause graphics mode to be entered.
  1467.  The text on the text screen is lost.  Exceptions are WINDOW,
  1468.  NOWINDOW, WRAP, NOWRAP, CLIP, NOCLIP, and SETSCRUNCH which do not
  1469.  cause graphics mode to be entered, and NODRAW which terminates
  1470.  graphics mode and starts up text mode.
  1471.  
  1472.  
  1473.  
  1474.  6.1. BACK LENGTH    (ABBREVIATED BK)
  1475.  
  1476.            Takes one number as input.  Moves the LadyBug
  1477.            backwards, that is in the opposite way from which it is
  1478.            facing, the distance given by the number.  The distance
  1479.            must be between -3000 and +3000.  Negative numbers mean
  1480.            to move in the opposite direction (i.e. forward).
  1481.  
  1482.            Examples:
  1483.  
  1484.               back 50
  1485.               back :a + 1
  1486.               bk 2
  1487.               bk -50
  1488.  
  1489.  
  1490.  
  1491.  6.2. BACKGROUND COLOR    (ABBREVIATED BG)
  1492.  
  1493.            Takes a number from 0 through 15 as input.  Sets the
  1494.            color according to the following table:
  1495.  
  1496.                 0   Black           8   Gray
  1497.                 1   Blue            9   Light Blue
  1498.                 2   Green          10   Light Green
  1499.                 3   Cyan           11   Light Cyan
  1500.                 4   Red            12   Light Red
  1501.                 5   Magenta        13   Light Magenta
  1502.                 6   Brown          14   Yellow
  1503.                 7   White          15   High-intensity White
  1504.  
  1505.            The change takes place immediately for the entire
  1506.            screen.  Until you set a background, it is black.
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.                                                            Page 14
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                                                  Graphics Commands
  1523.  
  1524.  
  1525.            Examples:
  1526.  
  1527.               background 8
  1528.               bg 0
  1529.  
  1530.  
  1531.  
  1532.  6.3. CLEARSCREEN    (ABBREVIATED CS)
  1533.  
  1534.            Takes no inputs.  Clears the graphics screen but does
  1535.            not change LadyBug's position or direction.
  1536.  
  1537.            NOTE:  In some LOGO systems CLEARSCREEN also puts the
  1538.            LadyBug back at the home position.  For this function,
  1539.            see the DRAW command.
  1540.  
  1541.  
  1542.  
  1543.  6.4. CLIP
  1544.  
  1545.            Takes no inputs.  Tells Ladybug that lines drawn by the
  1546.            LadyBug are to be trimmed at the edge of the screen.
  1547.            If WRAP has previously been given, it is turned off.
  1548.            (That is, CLIP also does a NOWRAP.)  See WRAP for more
  1549.            information.
  1550.  
  1551.            The screen acts like a window onto a large flat sheet
  1552.            on which the LadyBug draws.  Only that part which is
  1553.            visible through the window is seen.
  1554.  
  1555.            Try:
  1556.  
  1557.               clip
  1558.               draw
  1559.               poly 250 170
  1560.  
  1561.  
  1562.  
  1563.  6.5. DRAW
  1564.  
  1565.            Takes no inputs.  Exits from the text mode and enters
  1566.            graphics mode.  Clears the graphics screen and resets
  1567.            LadyBug to her home position and direction.  (Also see
  1568.            the HOME command.)
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.                                                            Page 15
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                                                  Graphics Commands
  1589.  
  1590.  
  1591.  6.6. FORWARD LENGTH   (ABBREVIATED FD)
  1592.  
  1593.            Takes one number as input.  Moves the LadyBug forward,
  1594.            that is in the direction it is facing, the distance
  1595.            given by the number.  The distance must be between
  1596.            -3000 and +3000.  Negative numbers mean to move in the
  1597.            opposite direction (i.e. backward).
  1598.  
  1599.            Examples:
  1600.  
  1601.               forward 50
  1602.               fd 50
  1603.               fd -30
  1604.  
  1605.  
  1606.  
  1607.  6.7. HIDEBUG    (ABBREVIATED HB)
  1608.  
  1609.            Takes no inputs.  Makes the LadyBug disappear from the
  1610.            screen.  May also be written as HIDETURTLE (abbreviated
  1611.            as HT).  See also SHOWBUG in this chapter.
  1612.  
  1613.  
  1614.  
  1615.  6.8. HIDETURTLE    (ABBREVIATED HT)
  1616.  
  1617.            Takes no inputs.  Makes the LadyBug disappear from the
  1618.            screen.
  1619.  
  1620.  
  1621.  
  1622.  6.9. HOME
  1623.  
  1624.            Takes no inputs.  Moves the LadyBug to the center of
  1625.            the screen and points her straight up.  If the pen is
  1626.            down the LadyBug will draw as she goes home.
  1627.  
  1628.  
  1629.  
  1630.  6.10. LEFT ANGLE   (ABBREVIATED LT)
  1631.  
  1632.            Takes one input, an angle.  If positive, it rotates the
  1633.            LadyBug that many degrees counterclockwise.  If
  1634.            negative, it rotates the LadyBug that many degrees
  1635.            clockwise.  The angle can exceed +359 or be smaller
  1636.            than -359; if it does, the angle is taken modulo 360.
  1637.            The maximum value is +32000 and the minumum value is
  1638.            -32000.
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.                                                            Page 16
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                                                  Graphics Commands
  1655.  
  1656.  
  1657.            Example:
  1658.  
  1659.               left 90
  1660.               left -90
  1661.  
  1662.            Try:
  1663.  
  1664.               repeat 36 [left 10]
  1665.  
  1666.  
  1667.  
  1668.  6.11. NOCLIP
  1669.  
  1670.            Takes no inputs.  Tells LadyBug that an attempt to pass
  1671.            the edge of the screen will not cause the LadyBug's
  1672.            path to be clipped.  See WRAP and CLIP for more
  1673.            information.
  1674.  
  1675.  
  1676.  
  1677.  6.12. NODRAW   (ABBREVIATED ND)
  1678.  
  1679.            Takes no inputs.  Exits from graphics mode and enters
  1680.            text mode.  Clears the screen.  Places the cursor in
  1681.            the upper left corner.
  1682.  
  1683.            With two screens, the graphics screen is unchanged; the
  1684.            text screen is enabled for output commands.  See the
  1685.            chapter "The LadyBug Screens" on page 10 for more
  1686.            information about screens.
  1687.  
  1688.  
  1689.  
  1690.  6.13. NOWRAP
  1691.  
  1692.            Takes no inputs.  Tells Ladybug that an attempt to pass
  1693.            the edge of the screen will not cause the LadyBug to
  1694.            wrap around to the other side.  See WRAP and CLIP for
  1695.            more information.
  1696.  
  1697.  
  1698.  
  1699.  6.14. NOWINDOW
  1700.  
  1701.            Same as NOCLIP in this chapter.
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.                                                            Page 17
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                                                  Graphics Commands
  1721.  
  1722.  
  1723.  6.15. PAINT PAINTCOLOR BORDERCOLOR
  1724.  
  1725.            Paint the area under and around the LadyBug with the
  1726.            painting color.  Painting is done in each direction
  1727.            until the border color is reached (or the edge is
  1728.            reached).
  1729.  
  1730.            If the border color is the same as the pen color, and
  1731.            the pen is down, the dot under the pen acts like a
  1732.            border and no painting occurs.  To be safe, lift the
  1733.            pen and move forward a slight amount.
  1734.  
  1735.            Paint colors and border colors are the same as pen
  1736.            colors; see PENCOLOR for information about colors.
  1737.  
  1738.  
  1739.  
  1740.  6.16. PALETTE PALETTENUMBER
  1741.  
  1742.            Takes one input, a zero or a one.  Sets the palette
  1743.            number.  A palette is a set of colors from which the
  1744.            allowable pen colors and painting colors are selected.
  1745.            There are two palettes with fixed colors.  See PENCOLOR
  1746.            for information on the colors in each palette.
  1747.  
  1748.  
  1749.  
  1750.  6.17. PENCOLOR COLOR   (ABBREVIATED PC)
  1751.  
  1752.            Takes one input, a number from 0 to 3.  The number is
  1753.            the color of the lines that the LadyBug will draw.  The
  1754.            colors are:
  1755.  
  1756.                        --- Palette ---
  1757.               COLOR       0       1
  1758.                 1       Green   Cyan
  1759.                 2       Red     Magenta
  1760.                 3       Brown   White
  1761.  
  1762.            A color of zero is the same color as the background.
  1763.            (See the BACKGROUND command.)  Until you select a
  1764.            background, Ladybug uses a black background.
  1765.  
  1766.            Until you select a pen color, LadyBug uses color 3.
  1767.  
  1768.            Palettes are selected with the PALETTE command; until
  1769.            you select a palette, Ladybug uses palette one.
  1770.  
  1771.            Example:
  1772.  
  1773.               pencolor 2
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.                                                            Page 18
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                                                  Graphics Commands
  1787.  
  1788.  
  1789.  6.18. PENDOWN   (ABBREVIATED PD)
  1790.  
  1791.            Takes no inputs.  When the pen is down, the LadyBug
  1792.            draws when she moves.
  1793.  
  1794.  
  1795.  
  1796.  6.19. PENUP   (ABBREVIATED PU)
  1797.  
  1798.            Takes no inputs.  When the pen is up the LadyBug does
  1799.            not draw when she moves.
  1800.  
  1801.            Example:
  1802.  
  1803.               penup
  1804.               forward 20
  1805.               pendown
  1806.  
  1807.  
  1808.  
  1809.  6.20. RIGHT ANGLE   (ABBREVIATED RT)
  1810.  
  1811.            Takes one input, an angle.  If positive, it rotates the
  1812.            LadyBug that many degrees clockwise.  If negative, it
  1813.            rotates the LadyBug that many degrees counterclockwise.
  1814.            The angle can exceed +359 or be smaller than -359; if
  1815.            it does, the angle is taken modulo 360.  The maximum
  1816.            value is +32000 and the minimum value is -32000.
  1817.  
  1818.            Example:
  1819.  
  1820.               right 47
  1821.  
  1822.            Try:
  1823.  
  1824.               repeat 10 [right 10 left 10]
  1825.  
  1826.  
  1827.  
  1828.  6.21. SETHEADING ANGLE   (ABBREVIATED SETH)
  1829.  
  1830.            Takes one input, an angle from -32000 to +32000.  The
  1831.            angle is taken modulo 360 so that it ranges from -359
  1832.            to +359.  The LadyBug is rotated so that it points in
  1833.            the direction given.  An angle of zero is straight up
  1834.            and increasing numbers are clockwise.
  1835.  
  1836.            Examples:
  1837.  
  1838.               setheading 45
  1839.               seth -90
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.                                                            Page 19
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                                                  Graphics Commands
  1853.  
  1854.  
  1855.  6.22. SETBG COLOR
  1856.  
  1857.            Same as BACKGROUND in this chapter.
  1858.  
  1859.  
  1860.  
  1861.  6.23. SETPAL PALETTE
  1862.  
  1863.            Same as PALETTE in this chapter.
  1864.  
  1865.  
  1866.  
  1867.  6.24. SETPC COLOR
  1868.  
  1869.            Same as PENCOLOR in this chapter.
  1870.  
  1871.  
  1872.  
  1873.  6.25. SETSCRUNCH N   (ALSO: .SETSCRUNCH)
  1874.  
  1875.            Adjust the aspect ratio of screen drawings.  Initially
  1876.            it is 1.0 but can be set to any value from 0.1 to 10.
  1877.            The value is used to adjust the distance actually moved
  1878.            left-to-right relative to that requested.
  1879.  
  1880.            For example, with a value of 1.0, a FORWARD 10 moves
  1881.            the same distance left-and-right as up-and-down.  With
  1882.            a value of 0.8, a FORWARD 10 would move only 8 units
  1883.            left-or-right.
  1884.  
  1885.            Scrunch is necessary since different displays and
  1886.            printers do not have the same number of dots per inch
  1887.            in each direction.
  1888.  
  1889.            You may need to experiment with SETSCRUNCH in order to
  1890.            find the best value for your screen and printer.  (You
  1891.            may need to run with values which distort pictures on
  1892.            your screen in order to have printed pictures look
  1893.            right.)  Once you have found a value you like, you
  1894.            might want to put it into your PROFILE.BUG file.
  1895.  
  1896.  
  1897.  
  1898.  6.26. SETX XCOORD
  1899.  
  1900.            Takes one input, an x coordinate.  Positions the
  1901.            LadyBug at the position, drawing a line if the pen is
  1902.            down.
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.                                                            Page 20
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                                                  Graphics Commands
  1919.  
  1920.  
  1921.  6.27. SETXY XCOORD YCOORD
  1922.  
  1923.            Takes two inputs, x and y coordinates.  Positions the
  1924.            LadyBug at the new position, drawing a line if the pen
  1925.            is down.
  1926.  
  1927.            Examples:
  1928.  
  1929.               setxy 0 0
  1930.               setxy  ( :a + 10 )  ( :b + 1 )
  1931.  
  1932.  
  1933.  
  1934.  6.28. SETY YCOORD
  1935.  
  1936.            Takes one input, an y coordinate.  Positions the
  1937.            LadyBug at the position, drawing a line if the pen is
  1938.            down.
  1939.  
  1940.            Try:
  1941.  
  1942.               to xy
  1943.               setx  250 - random 500
  1944.               sety  150 - random 300
  1945.               xy
  1946.               end
  1947.               xy
  1948.  
  1949.  
  1950.  
  1951.  6.29. SHOWBUG   (ABBREVIATED SB)
  1952.  
  1953.            Takes no inputs.  Makes the LadyBug appear on the
  1954.            screen.  May also be written SHOWTURTLE (abbreviated
  1955.            ST).
  1956.  
  1957.  
  1958.  
  1959.  6.30. SHOWTURTLE   (ABBREVIATED ST)
  1960.  
  1961.            Takes no inputs.  Makes the LadyBug appear on the
  1962.            screen.
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.                                                            Page 21
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                                                  Graphics Commands
  1985.  
  1986.  
  1987.  6.31. WINDOW
  1988.  
  1989.            Same as CLIP in this chapter.
  1990.  
  1991.  
  1992.  
  1993.  6.32. WRAP
  1994.  
  1995.            Takes no inputs.  Causes the LadyBug to "wrap around"
  1996.            when it is moved past an edge.  For example, a path
  1997.            that goes off the top of the screen will continue at
  1998.            the bottom of the screen.
  1999.  
  2000.            This is the default condition.  The NOWRAP, CLIP, and
  2001.            NOCLIP statements also affect what happens when the
  2002.            LadyBug tries to go off of the edge.
  2003.  
  2004.            Try:
  2005.  
  2006.               wrap
  2007.               draw
  2008.               poly 200 170
  2009.  
  2010.            If neither WRAP nor CLIP is in effect, the LadyBug
  2011.            bumps into the edge of the screen.  Drawings will be
  2012.            distorted.
  2013.  
  2014.            Try:
  2015.  
  2016.               nowrap
  2017.               noclip
  2018.               draw
  2019.               penup fd 100 pendown
  2020.               poly 150 170
  2021.  
  2022.            WRAP is slowest, CLIP the next fastest, and NOWRAP with
  2023.            NOCLIP is faster still.  The performance effects are
  2024.            not major but are measurable.
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.                                                            Page 22
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  7. SOUNDS
  2054.  
  2055.  
  2056.  This section describes Ladybug commands for making sounds with
  2057.  the PC speaker.
  2058.  
  2059.  
  2060.  
  2061.  7.1. BEEP
  2062.  
  2063.            Play one short note on the speaker.
  2064.  
  2065.  
  2066.  
  2067.  7.2. PLAY STRING
  2068.  
  2069.            Takes one input, a string.  Play a series of notes on
  2070.            the speaker.
  2071.  
  2072.            This sections describes only a part of the PLAY
  2073.            command.  The appendix "The Play Command" on page 62
  2074.            describes PLAY completely.
  2075.  
  2076.            The PLAY statement is the word "PLAY" followed by a
  2077.            string which contains special music commands.  These
  2078.            commands define notes to play, or tell PLAY how to play
  2079.            the notes.
  2080.  
  2081.            Note: Spaces and capitalization in the PLAY statement
  2082.            are optional.
  2083.  
  2084.  
  2085.            A TO G WITH OPTIONAL '#', '+', OR '-'
  2086.  
  2087.            Play the note given.  Append a # or + if the note is a
  2088.            sharp or a - if it is a flat.
  2089.  
  2090.  
  2091.            L N
  2092.  
  2093.            Set the default length of all notes which follow.  For
  2094.            example, L1 means that all notes are whole notes, L2
  2095.            means half notes, and L4 means quarter notes.  The
  2096.            default is L4.
  2097.  
  2098.  
  2099.            O N
  2100.  
  2101.            Set octave n as the current octave.  All notes given as
  2102.            letters are in this octave.  The default octave is 4.
  2103.            The value of n may be 0 through 7.
  2104.  
  2105.            An octave has the notes C, D, E, F, G, H, A and B in
  2106.            it, in that order.  The octave does NOT start with the
  2107.  
  2108.  
  2109.                                                            Page 23
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                                                             Sounds
  2117.  
  2118.  
  2119.            note A.
  2120.            P N
  2121.  
  2122.            Pause for n time units.  The meaning of the value of n
  2123.            is the same as in the L command.  The value of n may
  2124.            range from 1 to 64.
  2125.  
  2126.            Examples:
  2127.  
  2128.               play "ggga
  2129.               play "l4abcde
  2130.               play "'L4 abc L8 abc'
  2131.  
  2132.            Try:
  2133.  
  2134.               load "ludwig
  2135.               ludwig
  2136.  
  2137.  
  2138.  
  2139.  7.3. TONE FREQUENCY N
  2140.  
  2141.            Takes two inputs, a frequency and a time.  Produces a
  2142.            sound with the given frequency and for "n" clock ticks.
  2143.            The clock ticks 18.2 times per second.
  2144.  
  2145.            Examples:
  2146.  
  2147.               tone 2000 20
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.                                                            Page 24
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  8. INPUT AND OUTPUT
  2186.  
  2187.  
  2188.  This chapter describes statements which write data, or clear the
  2189.  input buffer.  Additional words are described in the chapter
  2190.  "Numbers and Computations" which starts on page 44.  These words
  2191.  include:
  2192.  
  2193.     STICK n          Joystick position
  2194.     PADDLE n         Joystick position
  2195.     PADDLEBUTTON n   Joystick button pushed?
  2196.     RC? and KEYP     Anything already typed?
  2197.     READCHARACTER    Read a character
  2198.     READCHAR         Read a character
  2199.     RC               Read a character
  2200.     REQUEST          Read a line of characters
  2201.     RQ               Read a line of characters
  2202.     STICKBUTTON n    Joystick button pushed?
  2203.  
  2204.  
  2205.  
  2206.  8.1. CLEARINPUT
  2207.  
  2208.            Takes no inputs.  Clears the input buffer of text typed
  2209.            but not yet read.
  2210.  
  2211.  
  2212.  
  2213.  8.2. PRINT WORD   (ABBREVIATED PR)
  2214.  
  2215.            Takes one input which it prints on the current output
  2216.            device.
  2217.  
  2218.            In graphics mode the line appears near the bottom of
  2219.            the screen and replaces any previously printed line.
  2220.  
  2221.            In text mode the line is printed below any other line,
  2222.            with the screen scrolling if necessary, and the cursor
  2223.            moves to the next line.
  2224.  
  2225.  
  2226.  
  2227.  8.3. PRINT1 WORD   (ABBREVIATED PR1)
  2228.  
  2229.            Takes one input which it prints on the current output
  2230.            device.  Leaves the cursor on the same line.
  2231.            Equivalent to TYPE in this chapter.
  2232.  
  2233.            In graphics mode the line appears near the bottom of
  2234.            the screen and replaces any previously printed line.
  2235.            Several PRINT1 commands in a row add to the same line.
  2236.  
  2237.            In text mode the line is printed at the current cursor
  2238.            position.  The cursor moves to the next line with the
  2239.  
  2240.  
  2241.                                                            Page 25
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.                                                   Input and Output
  2249.  
  2250.  
  2251.            screen scrolling if necessary.
  2252.  
  2253.  
  2254.  
  2255.  8.4. TYPE WORD
  2256.  
  2257.            Takes one input which it prints on the current output
  2258.            device.  Leaves the cursor on the same line.
  2259.            Equivalent to PRINT1 in this chapter.
  2260.  
  2261.            In graphics mode the line appears near the bottom of
  2262.            the screen and replaces any previously printed line.
  2263.            Several PRINT1 commands in a row add to the same line.
  2264.  
  2265.            In text mode the line is printed at the current cursor
  2266.            position.  The cursor moves to the next line with the
  2267.            screen scrolling if necessary.
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.                                                            Page 26
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  9. TEXT MODE
  2318.  
  2319.  
  2320.  This chapter describes statements which control the screen in
  2321.  text mode.  If these commands are given while in graphics mode,
  2322.  then text mode is entered.
  2323.  
  2324.  Text mode is also entered with the NODRAW command which is
  2325.  described in the chapter "Graphics Commands" which starts on page
  2326.  .
  2327.  
  2328.  The PRINT, PRINT1, and TYPE commands described in the previous
  2329.  chapter have special actions in text mode.
  2330.  
  2331.  
  2332.  
  2333.  9.1. CLEARTEXT   (ABBREVIATED CT)
  2334.  
  2335.            Takes no inputs.  Clears the text screen.  Moves the
  2336.            cursor to the top left corner.  Exits from graphics
  2337.            mode and enters text mode.
  2338.  
  2339.  
  2340.  
  2341.  9.2. CURSOR COLUMN ROW
  2342.  
  2343.            Takes two inputs which are a column and row position.
  2344.            The cursor is positioned at that place on the text
  2345.            screen.  The allowed values of the numbers depend upon
  2346.            which screen size is in use.
  2347.  
  2348.            The column may be in the range 1 to 40 (or 1 to 80
  2349.            depending upon the number of text columns) and the row
  2350.            may be 1 to 25.
  2351.  
  2352.            Example:
  2353.  
  2354.               to showmenu
  2355.               cursor  1  1  type "'Select from one of these:'
  2356.               cursor  5  4  type "'1 - Print the data'
  2357.               cursor  5  6  type "'2 - Erase the data'
  2358.               cursor  5  8  type "'3 - Plot the data'
  2359.               cursor  5 10  type "'4 - Save the data'
  2360.               end
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.                                                            Page 27
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.                                                          Text Mode
  2381.  
  2382.  
  2383.  9.3. SETWIDTH COLUMNS
  2384.  
  2385.            Same as TEXTCOLUMNS in this chapter.
  2386.  
  2387.  
  2388.  
  2389.  9.4. TEXTCOLUMNS COLUMNS   (ABBREVIATED TCOLS)
  2390.  
  2391.            Takes one input, either the number 40 or the number 80.
  2392.            Sets the screen width for text mode on the graphics
  2393.            monitor.  If the text screen is on the Monochrome
  2394.            display it always has a width of 80 and the value
  2395.            specified on this command is ignored.  The command is
  2396.            valid anytime but it takes effect only when in text
  2397.            mode and only when text mode is displayed on the
  2398.            graphics device.
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.                                                            Page 28
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  10. CONTROL COMMANDS
  2450.  
  2451.  
  2452.  This chapter describes commands which are used to define
  2453.  variables and procedures.
  2454.  
  2455.  
  2456.  
  2457.  10.1. EDIT PROCNAME ...   (ABBREVIATED ED)
  2458.  
  2459.            Takes a variable number of inputs.  Enters the full
  2460.            screen editor to edit the procedures.  The chapter
  2461.            "Introduction to the LadyBug Editor" on page 54
  2462.            describes this command and how to use the editor.
  2463.  
  2464.            Since the EDIT command takes a variable number of
  2465.            inputs, other commands cannot be on the same line
  2466.            behind it.
  2467.  
  2468.            Examples:
  2469.  
  2470.               edit poly
  2471.               ed poly polyspi square
  2472.  
  2473.  
  2474.  
  2475.  10.2. EDIT ALL
  2476.  
  2477.            Edit all procedures at one time.
  2478.  
  2479.  
  2480.  
  2481.  10.3. END
  2482.  
  2483.            In the full screen editor, END marks the end of a
  2484.            procedure which is entered from the editor.  It may be
  2485.            omitted from the last procedure but must be present if
  2486.            there is more than one procedure in the editors space.
  2487.  
  2488.            Following a TO command, END marks the end of the
  2489.            procedure begin defined.  It must be given and it must
  2490.            be on a line by itself.
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.                                                            Page 29
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.                                                   Control Commands
  2513.  
  2514.  
  2515.  10.4. ERROR MESSAGE
  2516.  
  2517.            Takes one input, a string.  Issues an error message
  2518.            with the string as the text and then terminates the
  2519.            currently active procedure set.  (See the chapter
  2520.            "Running and Debugging Procedures" on page 41.)
  2521.  
  2522.            Example:
  2523.  
  2524.               to move :d
  2525.               if :d > 100 [error "'Too far to move']
  2526.               fd :d
  2527.               end
  2528.  
  2529.  
  2530.  
  2531.  10.5. FOREVER LIST
  2532.  
  2533.            See chapter "Workspaces with Tools" on page 52.
  2534.  
  2535.  
  2536.  
  2537.  10.6. GOODBYE   (ABBREVIATED BYE)
  2538.  
  2539.            Exit to DOS from LadyBug.
  2540.  
  2541.  
  2542.  
  2543.  10.7. IF CONDITION THEN ACTION
  2544.  
  2545.            Test the condition.  If it is "true", then perform the
  2546.            action.  The action consists of all of the words
  2547.            remaining on the line.
  2548.  
  2549.            The condition is a word or expression which returns
  2550.            "true" or "false".
  2551.  
  2552.            The action is one or more LadyBug commands excepting an
  2553.            IF command with an ELSE clause.
  2554.  
  2555.            Example:
  2556.  
  2557.               if :x > 0 then fd 100
  2558.  
  2559.               if :ready then fd 50 rt 45 fd 100 rt 45 fd 50
  2560.  
  2561.            Also see the TEST command.
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.                                                            Page 30
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.                                                   Control Commands
  2579.  
  2580.  
  2581.  10.8. IF CONDITION [ACTION]
  2582.  
  2583.            Test the condition.  If it is "true", then perform the
  2584.            action (which is a list).  The action consists of the
  2585.            words in the list.
  2586.  
  2587.            The condition is a word or expression which returns
  2588.            "true" or "false".
  2589.  
  2590.            The action is one or more LadyBug commands including
  2591.            other IF commands.
  2592.  
  2593.            Examples:
  2594.  
  2595.               if :x > 0 [fd 100]
  2596.  
  2597.               if :ready [fd 50  rt 45  fd 100  rt 45  fd 50]
  2598.  
  2599.               make "alist [fd 10  rt 90  fd 90 rt 10]
  2600.               if :a > :b  :alist
  2601.  
  2602.            Also see the TEST command.
  2603.  
  2604.  
  2605.  
  2606.  10.9. IF CONDITION THEN ACTION1 ELSE ACTION2
  2607.  
  2608.            Test the condition.  If the result is "true", then
  2609.            perform action1; if it is "false", then perform
  2610.            action2.  Action1 consists of the words between the
  2611.            THEN and the ELSE.  Action2 consists of the words
  2612.            following the ELSE.  Neither action can be an IF/THEN
  2613.            or an IF/THEN/ELSE command.
  2614.  
  2615.            The condition is a word or expression which returns
  2616.            "true" or "false".
  2617.  
  2618.            The actions are one or more LadyBug commands.
  2619.  
  2620.            Example:
  2621.  
  2622.               if :x > 0 then fd 100 else fd 50
  2623.  
  2624.               if :ready then fd 50 rt 45 else bk 20 lt 10
  2625.  
  2626.            Also see the TEST command.
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.                                                            Page 31
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.                                                   Control Commands
  2645.  
  2646.  
  2647.  10.10. IF CONDITION [ACTION1] [ACTION2]
  2648.  
  2649.            Test the condition.  If it is "true", then perform
  2650.            action1; if it is "false", then perform action2.  The
  2651.            actions consist of the words in the lists.  The actions
  2652.            can contain other IF commands.
  2653.  
  2654.            The condition is a word or expression which returns
  2655.            "true" or "false".
  2656.  
  2657.            The actions are one or more LadyBug commands.
  2658.  
  2659.            Example:
  2660.  
  2661.               if :x > 0  [fd 100]  [fd 50]
  2662.  
  2663.               if :ready  [fd 50 rt 45]  [bk 20 lt 10]
  2664.  
  2665.            Also see the TEST command.
  2666.  
  2667.  
  2668.  
  2669.  10.11. IFFALSE LIST
  2670.  
  2671.            Takes one input, a list.  Tests the condition set by
  2672.            the most recently executed TEST command.  If it was
  2673.            "false" then the list is executed.
  2674.  
  2675.            Example:
  2676.  
  2677.               test :a > 7
  2678.               iffalse [fd 5 rt 5]
  2679.  
  2680.  
  2681.  
  2682.  10.12. IFTRUE LIST
  2683.  
  2684.            Takes one input, a list.  Tests the condition set by
  2685.            the most recently executed TEST command.  If it was
  2686.            "true" then the list is executed.
  2687.  
  2688.            Example:
  2689.  
  2690.               test :a > 7
  2691.               iftrue [fd 5]
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.                                                            Page 32
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.                                                   Control Commands
  2711.  
  2712.  
  2713.  10.13. LOCAL VARIABLENAME
  2714.  
  2715.            Defines a variable as being local to the current
  2716.            procedure.  It is available to any procedures which are
  2717.            called from the procedure in which it is defined unless
  2718.            they too make the name local or have an input variable
  2719.            with the same name.
  2720.  
  2721.            The variable has a null (empty) value until some value
  2722.            is assigned with the MAKE command.  See the MAKE
  2723.            command for more information about how LadyBug searches
  2724.            for variables.
  2725.  
  2726.            The LOCAL command should always be used in procedures
  2727.            which use variables for 'personal' reasons, such as
  2728.            temporarily holding the results of some calculation.
  2729.  
  2730.            Example:
  2731.  
  2732.               local "saveit
  2733.  
  2734.            A longer example:
  2735.  
  2736.               to a
  2737.               make "fred 1     <--- sets variable 'fred' to 1
  2738.               print :fred      <--- prints the value '1'
  2739.               b                <--- calls procedure 'b'
  2740.               print :fred      <--- prints the value '2'
  2741.               end
  2742.  
  2743.               to b
  2744.               make "fred 2     <--- sets same 'fred' as in 'a'
  2745.               local "fred      <--- makes a new local 'fred'
  2746.               make "fred 3     <--- sets the new 'fred' to 3
  2747.               print :fred      <--- prints the value '3'
  2748.               c                <--- call procedure 'c'
  2749.               end              <--- returns to procedure 'a'
  2750.  
  2751.               to c
  2752.               print :fred      <--- prints the value '3'
  2753.               end
  2754.  
  2755.            If "a" is invoked, the four values printed are 1, 3, 3,
  2756.            and 2 in that order.  After "a" is through, the
  2757.            variable "fred" still has the value 2.
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.                                                            Page 33
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.                                                   Control Commands
  2777.  
  2778.  
  2779.  10.14. MAKE "VARIABLENAME VALUE
  2780.  
  2781.            Takes two inputs, a word which will be a variable name,
  2782.            and a value.  The value may be an expression, a list,
  2783.            or a string.  MAKE assigns the value to a variable with
  2784.            the name given.  The value may be referenced by using
  2785.            the variable name with a colon on the front.
  2786.  
  2787.            If there already is a variable with the name given, the
  2788.            value replaces its current value.  If there is not
  2789.            already such a variable, one is created and given the
  2790.            value.
  2791.  
  2792.            Examples:
  2793.  
  2794.               make "a 7
  2795.               make "b 3 * :a
  2796.               make "c ( :a / :b ) + 2
  2797.  
  2798.            NOTE:  At any time that LadyBug is looking for a
  2799.            variable, the variables created by the current
  2800.            procedure are examined first.  If one with the needed
  2801.            name is not found, LadyBug then looks at variables
  2802.            created by the procedure which called the current one.
  2803.            If it has such a variable, it is used.  If not, then
  2804.            variables in the procedure that called that one are
  2805.            examined, etc.  Finally, variables which are not a part
  2806.            of any procedure but which are a part of the workspace
  2807.            are examined.  If no variable is found, then MAKE
  2808.            creates a new variable.
  2809.  
  2810.            Variables CREATED by MAKE are global.  That is, they
  2811.            will still exist after all active procedures terminate
  2812.            and will be saved when the workspace is saved.
  2813.  
  2814.            See the LOCAL command for information about another way
  2815.            to create variables and for information about the scope
  2816.            of variables in procedures which call one another.
  2817.  
  2818.  
  2819.  
  2820.  10.15. OUTPUT VALUE   (ABBREVIATED OP)
  2821.  
  2822.            Takes one input.  Causes the current procedure to stop.
  2823.            The value is output to the calling procedure.
  2824.  
  2825.            Examples:
  2826.  
  2827.               output 2
  2828.               output ( :a + 4 ) / 3
  2829.               op [2 3 4]
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.                                                            Page 34
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.                                                   Control Commands
  2843.  
  2844.  
  2845.  10.16. RANDOMIZE NUMBER
  2846.  
  2847.            Takes one input, an integer.  Sets the "seed" of the
  2848.            random number generator to this value.  Each time the
  2849.            same seed is used, successive calls to RANDOM will
  2850.            return the same sequence of random numbers.
  2851.  
  2852.            Examples:
  2853.  
  2854.               randomize 2127
  2855.               randomize :seed + 1173
  2856.  
  2857.  
  2858.  
  2859.  10.17. REPEAT NUMBER LIST
  2860.  
  2861.            Takes two inputs, a number and a list.  RUNs the
  2862.            commands in the list "number" times.
  2863.  
  2864.            Examples:
  2865.  
  2866.               repeat 4 [forward 100 right 90]
  2867.               repeat :n :alist
  2868.  
  2869.            Try:
  2870.  
  2871.               repeat 5 [fd 100 rt 144]
  2872.               repeat 36 [fd 10 rt 10]
  2873.  
  2874.  
  2875.  
  2876.  10.18. RUN LIST
  2877.  
  2878.            Takes one input, a list.  Executes the list as if the
  2879.            body were typed as a command line.
  2880.  
  2881.            Example:
  2882.  
  2883.               run [fd 10  rt 5]
  2884.  
  2885.            Example:
  2886.  
  2887.               make  "b  [fd 10  rt 5]
  2888.               run  :b
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.                                                            Page 35
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.                                                   Control Commands
  2909.  
  2910.  
  2911.  10.19. STOP
  2912.  
  2913.            Takes no inputs.  Causes the current procedure to stop
  2914.            and return control to the procedure which called it, if
  2915.            any, else to the command prompt.  No value is output.
  2916.  
  2917.  
  2918.  
  2919.  10.20. TEST CONDITION
  2920.  
  2921.            Takes one input, a condition.  The condition is a word
  2922.            or expression which returns "true" or "false".  The
  2923.            condition is evaluated and the result is remembered
  2924.            until changed by another TEST command.  The result can
  2925.            be tested by the IFTRUE and IFFALSE commands.
  2926.  
  2927.            Example:
  2928.  
  2929.               test
  2930.               iftrue [fd 10 rt 90]
  2931.  
  2932.  
  2933.  
  2934.  10.21. TOPLEVEL
  2935.  
  2936.            Takes no inputs.  Stops all active commands, procedures
  2937.            and PAUSEs.  Returns to the command prompt.
  2938.  
  2939.  
  2940.  
  2941.  10.22. WAIT TIME
  2942.  
  2943.            See chapter "Workspaces With Tools" on page 52.
  2944.  
  2945.  
  2946.  
  2947.  10.23. WHILE CONDITION LIST
  2948.  
  2949.            See chapter "Workspaces With Tools" on page 52.
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.                                                            Page 36
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  11. MANAGING THE WORKSPACE
  2978.  
  2979.  
  2980.  This chapter describes statements which are used to control and
  2981.  manage the workspace.
  2982.  
  2983.  
  2984.  
  2985.  11.1. CATALOG   (ABBREVIATED CAT)
  2986.  
  2987.            Takes no inputs.  Prints the names of files contained
  2988.            on the current disk.  In graphics mode, the current
  2989.            screen is cleared and the catalog is displayed as if
  2990.            temporarily in text mode.
  2991.  
  2992.  
  2993.  
  2994.  11.2. CLEARWS
  2995.  
  2996.            Takes no inputs.  Clears all variables and procedures
  2997.            from the workspace.
  2998.  
  2999.  
  3000.  
  3001.  11.3. DEFINE "NAME LIST
  3002.  
  3003.            Takes two inputs which define a procedure.  The first
  3004.            is the name of the procedure and the second is the body
  3005.            of the procedure.  If a procedure already exists with
  3006.            the name given, the old one is deleted.
  3007.  
  3008.            The body of the procedure is a list of lists.  Each
  3009.            sublist is one line of the procedure.  The first
  3010.            sublist contains the names of the inputs to the
  3011.            procedure.
  3012.  
  3013.            Example:
  3014.  
  3015.               to tri :s
  3016.                  repeat 3 [fd :s rt 120]
  3017.               end
  3018.  
  3019.               can be defined as:
  3020.  
  3021.               define "tri [[:s][repeat 3 [fd :s rt 120]]]
  3022.  
  3023.            If there are no inputs then the first sublist is empty:
  3024.  
  3025.            Example:
  3026.  
  3027.               to circ
  3028.               fd 10
  3029.               rt 10
  3030.               circ
  3031.  
  3032.  
  3033.                                                            Page 37
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.                                             Managing the Workspace
  3041.  
  3042.  
  3043.               end
  3044.  
  3045.            can be defined as:
  3046.  
  3047.               define "circ [[][fd 10][rt 10][circ]]
  3048.  
  3049.  
  3050.  
  3051.  11.4. EDIT PROCNAME ...
  3052.  
  3053.            Takes a variable number of inputs.  Enters the full
  3054.            screen editor to edit the procedures.  The chapter
  3055.            "Introduction to the LadyBug Editor" on page 54
  3056.            describes this command and how to use the editor.
  3057.  
  3058.            Examples:
  3059.  
  3060.               edit poly
  3061.               ed poly polyspi square
  3062.  
  3063.  
  3064.  
  3065.  11.5. EDIT ALL
  3066.  
  3067.            Edit all procedures at one time.
  3068.  
  3069.  
  3070.  
  3071.  11.6. ERASE PROCEDURENAME
  3072.  
  3073.            Delete the procedure named.
  3074.  
  3075.            Example:
  3076.  
  3077.               erase "poly
  3078.  
  3079.            NOTE:  ERASE can be used to delete a procedure from
  3080.            within itself without disturbing the currently
  3081.            executing copy of the procedure.
  3082.  
  3083.  
  3084.  
  3085.  11.7. ERASE ALL
  3086.  
  3087.            Delete all procedures.
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.                                                            Page 38
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.                                             Managing the Workspace
  3107.  
  3108.  
  3109.  11.8. ERASEFILE FILENAME
  3110.  
  3111.            Erase the disk file named.
  3112.  
  3113.            Example:
  3114.  
  3115.               erasefile "b:crawlie.bug
  3116.  
  3117.  
  3118.  
  3119.  11.9. ERNAME VARIABLENAME
  3120.  
  3121.            Delete the variable named.  If there are more than one
  3122.            with the same name, ERNAME deletes the most recently
  3123.            defined variable.
  3124.  
  3125.            Example:
  3126.  
  3127.               ername "bart
  3128.  
  3129.  
  3130.  
  3131.  11.10. ERNAME ALL
  3132.  
  3133.            Delete all variables.
  3134.  
  3135.  
  3136.  
  3137.  11.11. LOAD FILENAME
  3138.  
  3139.            Same as READ in this chapter.
  3140.  
  3141.  
  3142.  
  3143.  11.12. PRINTOUT NAME   (ABBREVIATED PO)
  3144.  
  3145.            Print the value of the variable and/or definition of
  3146.            the procedure with the name given.
  3147.  
  3148.            Example:
  3149.  
  3150.               printout "elephant
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.                                                            Page 39
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.                                             Managing the Workspace
  3173.  
  3174.  
  3175.  11.13. READ FILENAME
  3176.  
  3177.            Load the named workspace and add its variables and
  3178.            procedures to the workspace.  If no file extension is
  3179.            given, .BUG is used.
  3180.  
  3181.            Examples:
  3182.  
  3183.               read "polyspi
  3184.               read "b:circ.lgo
  3185.  
  3186.            See the chapter "Hints on Using LadyBug" on page 57 for
  3187.            more information about uses of READ.
  3188.  
  3189.  
  3190.  
  3191.  11.14. SAVE FILENAME
  3192.  
  3193.            Save the current workspace in the file named.  If no
  3194.            file extension is given, the default of BUG is used.
  3195.  
  3196.            Example:
  3197.  
  3198.               save "bobby
  3199.               save "b:whoops.2
  3200.  
  3201.            The appendix "Format and Contents of Saved Workspaces"
  3202.            on page  describes the format of the workspace as it is
  3203.            saved on disk.
  3204.  
  3205.  
  3206.  
  3207.  11.15. TO PROCNAME INPUTS...
  3208.  
  3209.            Takes one or more inputs.  The first is the name of a
  3210.            procedure which is to be defined.  If a procedure with
  3211.            the same name already exists the old definition is
  3212.            deleted.
  3213.  
  3214.            The remaining inputs are the names of inputs to the new
  3215.            procedure.
  3216.  
  3217.            Lines read after the TO command become lines in the new
  3218.            procedure.  A line containing the word END alone, ends
  3219.            the definition of the new procedure.
  3220.  
  3221.            Example:
  3222.  
  3223.               to poly :dist :angle
  3224.               fd :dist
  3225.               rt :angle
  3226.               poly :dist :angle
  3227.               end
  3228.  
  3229.  
  3230.  
  3231.                                                            Page 40
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  12. RUNNING AND DEBUGGING PROCEDURES
  3242.  
  3243.  
  3244.  This chapter describes how to run procedures and describes some
  3245.  commands which help debug them.
  3246.  
  3247.  
  3248.  
  3249.  12.1. RUNNING PROCEDURES
  3250.  
  3251.  Procedures are groups of commands which are saved under a name
  3252.  for later execution.  Procedures are created with the LadyBug
  3253.  editor, with the TO command, or with the DEFINE command.
  3254.  
  3255.  A procedure is run by giving its name instead of the name of a
  3256.  command.
  3257.  
  3258.  Example:
  3259.  
  3260.     to moveup
  3261.     forward 20
  3262.     end
  3263.  
  3264.  This defines a procedure named MOVEUP.  The procedure can be run
  3265.  by typing its name, MOVEUP.  In effect, procedures are new
  3266.  commands and the term "command" often is used to refer to
  3267.  procedures as well as primitive, or builtin, commands.
  3268.  
  3269.  Procedures can invoke, or call, other procedures.  When several
  3270.  procedures are active at one time, the group is often called a
  3271.  "nest" of procedures or a "nested group" or procedures.
  3272.  
  3273.  Inputs to procedures can be any value or expression with one
  3274.  exception: an input must not refer to another procedure.  That
  3275.  is, you cannot run one procedure in order to directly define an
  3276.  input for another.
  3277.  
  3278.  
  3279.  
  3280.  12.2. PAUSING PROCEDURES
  3281.  
  3282.  Procedures, as well as commands like REPEAT which have a list of
  3283.  other commands in them, can be temporarily stopped with the pause
  3284.  key, F5, or with a PAUSE command imbedded in them.
  3285.  
  3286.  When a procedure has been paused, LadyBug accepts commands and
  3287.  will execute any command.  It indicates that some other command
  3288.  has been paused by printing the word "pause" instead of a
  3289.  question mark for a command prompt.
  3290.  
  3291.  It is possible to run other procedures while a procedure is
  3292.  paused.  The new procedure or procedure nest can itself be
  3293.  paused.  Then yet another procedure can be run, and that one
  3294.  paused, and so on subject only to the restriction of 40 active
  3295.  
  3296.  
  3297.                                                            Page 41
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.                                   Running and Debugging Procedures
  3305.  
  3306.  
  3307.  procedures, repeat commands, pauses, loads, and active expression
  3308.  evaluations at one time.
  3309.  
  3310.  The group or nest of procedures that is suspended by a PAUSE or
  3311.  by F5 is called a "Procedure set".  The F1 key terminates only
  3312.  the currently active procedure set.  Thus, if you use F1 to
  3313.  terminate a procedure run while another is paused, only it will
  3314.  be terminated.  The TOPLEVEL command terminates all procedure
  3315.  sets.  (The .STACK command described in the appendix "Hackers
  3316.  Only" on page 74 will display the stack of active procedures,
  3317.  expressions, pauses, etc.)
  3318.  
  3319.  
  3320.  
  3321.  12.3. EDITING ACTIVE PROCEDURES
  3322.  
  3323.  It is possible to edit a procedure which is active.  Either the
  3324.  EDIT command can be in a procedure or the EDIT command can be
  3325.  given after the running procedure has been paused.
  3326.  
  3327.  However, the changes made to the procedure do not affect any
  3328.  currently active execution of that procedure.
  3329.  
  3330.  
  3331.  
  3332.  12.4. CONTINUE    (ABBREVIATED CO)
  3333.  
  3334.            The continue command resumes execution of a paused
  3335.            procedure set.
  3336.  
  3337.  
  3338.  
  3339.  12.5. NOTRACE
  3340.  
  3341.            Turn off tracing.  When tracing is active the F9 key
  3342.            will also turn off tracing.
  3343.  
  3344.  
  3345.  
  3346.  12.6. PAUSE
  3347.  
  3348.            Pause the current nest of procedures.  The F5 key will
  3349.            also pause the current procedure nest.
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.                                                            Page 42
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.                                   Running and Debugging Procedures
  3371.  
  3372.  
  3373.  12.7. TOPLEVEL
  3374.  
  3375.            Terminate all active procedures in all active procedure
  3376.            sets, and all active commands.  Return to the top level
  3377.            command prompt.
  3378.  
  3379.  
  3380.  
  3381.  12.8. TRACE
  3382.  
  3383.            Turn on tracing.  When trace is on, each command that
  3384.            is executed from any source, procedure or command
  3385.            prompt, is shown and LadyBug pauses for a key to be
  3386.            pressed.
  3387.  
  3388.            F9 also turns on and off tracing.
  3389.  
  3390.  
  3391.  
  3392.  12.9. ;  (COMMENT)
  3393.  
  3394.            Any line which starts with a semicolon is a comment
  3395.            line.  The contents of the line are ignored.
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.                                                            Page 43
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  13. NUMBERS AND COMPUTATIONS
  3440.  
  3441.  
  3442.  This section describes numbers and how to compute with them.
  3443.  
  3444.  
  3445.  
  3446.  13.1. NUMBERS
  3447.  
  3448.  Numeric values come in two types: integer, and floating point.
  3449.  
  3450.  Integer numbers have only whole number values.  These values must
  3451.  be in the range of -32768 to 32767.
  3452.  
  3453.  Floating point numbers have whole number and fractional values
  3454.  and an optional exponent.  Their value in the computer may range
  3455.  from 2.9x10**(-39) to 1.7x10**38 (where the 10**(-39) means
  3456.  "times ten to the -39 power" and 10**38 means "times ten to the
  3457.  38th power".)
  3458.  
  3459.  When you enter floating point numbers into the computer, they
  3460.  must have one of the forms, for example:
  3461.  
  3462.      1.   .2   1.2   1E2   1.E2   .2E2   1.2E2   1.2E-2   1.2e2
  3463.  
  3464.  Each may also have a sign.  The "e" or "E" separates the number
  3465.  from its power of ten.
  3466.  
  3467.  
  3468.  
  3469.  13.2. NUMERIC AND MATHEMATICAL VALUES
  3470.  
  3471.  ABS number
  3472.      Returns the absolute value of the number.
  3473.  
  3474.  ARCTAN tangent
  3475.      Returns the angle which has the tangent given.
  3476.  
  3477.  ASC string
  3478.      Takes one input, a string or word.  Returns a number from 0
  3479.      to 255 which is the ASCII code for the first character of the
  3480.      string or word.
  3481.  
  3482.  BACKGROUND   (Abbreviated BG)
  3483.      The background color.
  3484.  
  3485.  CHAR expression
  3486.      Takes one input, a number from 0 to 255.  Returns the ASCII
  3487.      character which corresponds to that number.
  3488.  
  3489.  COS angle
  3490.      Returns the cosine of the angle in degrees.
  3491.  
  3492.  
  3493.  
  3494.  
  3495.                                                            Page 44
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.                                           Numbers and Computations
  3503.  
  3504.  
  3505.  EXP power
  3506.      Returns the mathematical quantity 'e' raised to the power
  3507.      given.
  3508.  
  3509.  HEADING
  3510.      The (integer) angle that the LadyBug is currently facing.
  3511.      The value ranges from -359 to 359.
  3512.  
  3513.  INTEGER number
  3514.      Returns the integer which is equal to or just smaller than
  3515.      the number given.  If the number is negative the result is
  3516.      smaller when it is "further away" from zero.
  3517.  
  3518.  LOG number
  3519.      Returns the logarithm of the number taken to base 10.
  3520.  
  3521.  NUMBER? word
  3522.      Takes one input.  Returns "true" if the word represents a
  3523.      number and "false" if it does not.
  3524.  
  3525.  PALETTE
  3526.      The palette number.
  3527.  
  3528.  PENCOLOR  (Abbreviated PC)
  3529.      The color of the pen.
  3530.  
  3531.  RANDOM range
  3532.      Returns a random number in the range 0 to 'range'.  (See the
  3533.      RANDOMIZE statement for more information.)
  3534.  
  3535.  RUN list/word/string
  3536.      Takes one input, a list, string, or word.  RUNs the input and
  3537.      returns it's output.
  3538.  
  3539.      Example:
  3540.  
  3541.         make "x [2 + 3]
  3542.         print run :x
  3543.  
  3544.      The example prints the number "5".
  3545.  
  3546.  SCRUNCH
  3547.      The value of the aspect ratio adjustment.  See the SETSCRUNCH
  3548.      command.
  3549.  
  3550.  SENTENCE word/list word/list    (Abbreviated SE)
  3551.      Takes two inputs, words or lists.  Forms a list of the words
  3552.      or the components of the lists, and returns the new list.
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.                                                            Page 45
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.                                           Numbers and Computations
  3569.  
  3570.  
  3571.      Examples:
  3572.  
  3573.         make "x sentence [a b] [c d]
  3574.         make "x sentence joe [frank bob]
  3575.  
  3576.  SIGN number
  3577.      Returns +1 if number is positive, 0 if number is zero, and -1
  3578.      if number if negative.
  3579.  
  3580.  SIN angle
  3581.      Returns the sine of the angle in degrees.
  3582.  
  3583.  SQRT number
  3584.      Returns the square root of the number.
  3585.  
  3586.  TAN angle
  3587.      Returns the tangent of the angle in degrees.
  3588.  
  3589.  THING word
  3590.      Takes one input, a word which is the name of a variable.
  3591.      Returns the value of that variable.  The following are
  3592.      exactly equivalent:
  3593.  
  3594.      Example:
  3595.  
  3596.         :elephant
  3597.         thing "elephant
  3598.  
  3599.      Example:
  3600.  
  3601.         make "a "apple
  3602.         make "b "a
  3603.         print thing :b
  3604.  
  3605.      prints "apple".
  3606.  
  3607.  WORD word1 word2
  3608.      Takes two inputs and combines them into one word.
  3609.  
  3610.      Example:
  3611.  
  3612.         make "x word "a "b
  3613.  
  3614.      The variable x is set to "ab".
  3615.  
  3616.  XCOR
  3617.      The current x coordinate of the LadyBug.
  3618.  
  3619.  YCOR
  3620.      The current y coordinate of the LadyBug.
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.                                                            Page 46
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.                                           Numbers and Computations
  3635.  
  3636.  
  3637.  Examples:
  3638.  
  3639.     GIVEN                 PRINTS
  3640.     print abs -7          7
  3641.     print integer 7.7     7
  3642.     print integer -3.3    -4
  3643.     print log 100         10
  3644.     print random 10       2.32    (example result)
  3645.     print sign 4          1
  3646.     print sign -4         -1
  3647.     print sqrt 4          2
  3648.  
  3649.  
  3650.  
  3651.  13.3. OTHER WORDS
  3652.  
  3653.  The following words return values.  Some take one input.
  3654.  
  3655.  STICK n    (or PADDLE n)
  3656.      Takes a number from 0 to 3 which corresponds to one of four
  3657.      joysticks and returns a number from 0 to 255 which represents
  3658.      it's setting.  The range of values will depend upon the
  3659.      particular joystick used.
  3660.  
  3661.  STICKBUTTON n    (or PADDLEBUTTON n)
  3662.      Takes a number from 0 to 3 which corresponds to one of four
  3663.      joysticks and returns TRUE or FALSE depending upon whether or
  3664.      not the button on the particular joystick has been pressed
  3665.      since the last time PADDLEBUTTON was used.
  3666.  
  3667.  RC?  or  KEYP
  3668.      Takes no inputs.  Outputs TRUE if a keyboard character is
  3669.      pending, that is, if the character input buffer is not empty.
  3670.      Otherwise it outputs FALSE.
  3671.  
  3672.  READCHARACTER   (Abbreviated READCHAR or RC)
  3673.      Takes no inputs.  Outputs the least recent character in the
  3674.      character buffer, or waits for a keyboard character to be
  3675.      typed if the buffer is empty.
  3676.  
  3677.  REQUEST   (Abbreviated RQ)
  3678.      Takes no inputs.  Waits for a keyboard line to be typed and
  3679.      outputs the line.  The line is terminated by pressing the
  3680.      enter key.  Until the enter key is pressed, the backspace key
  3681.      will move back over and delete characters that have been
  3682.      typed in response to REQUEST, the back arrow key will move
  3683.      back over and allow insertions and deletions with the Ins and
  3684.      Del keys, and the ESC key will delete everything typed so
  3685.      far.
  3686.  
  3687.  PENUP?  and  PENDOWN?
  3688.      Neither takes an input.  Both return either "true" or "false"
  3689.      depending upon whether the pen is up or down.
  3690.  
  3691.  
  3692.  
  3693.                                                            Page 47
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.                                           Numbers and Computations
  3701.  
  3702.  
  3703.  SHOWING?  and  HIDDEN?
  3704.      Neither takes an input.  Both return either "true" or "false"
  3705.      depending upon whether the LadyBug is showing or hidden.
  3706.  
  3707.  
  3708.  
  3709.  13.4. EXPRESSIONS RESULTING IN NUMBERS
  3710.  
  3711.  Numbers can be combined into expressions.  Expressions are
  3712.  evaluated from left to right with no operator hierarchy.
  3713.  Parentheses may be used to group operations which should be
  3714.  performed first.
  3715.  
  3716.  Expressions are taken, word by word, with only blanks separating
  3717.  words.  Operators, numbers, and parentheses must be separated by
  3718.  blanks to be properly recognized.  For example, this is invalid:
  3719.  
  3720.     FORWARD 3+4
  3721.  
  3722.  but this is valid:
  3723.  
  3724.     FORWARD 3 + 4
  3725.  
  3726.  Expressions may occur anywhere that LadyBug is looking for a
  3727.  number or a truth value.  Even though an expression may have many
  3728.  words in it, it is still considered as one input.
  3729.  
  3730.  Unless noted, operations on integers result in integers and
  3731.  operations on floating point numbers result in floating point
  3732.  numbers.  When one operand of two given for an operator is
  3733.  integer, it is converted to floating point.
  3734.  
  3735.  The operators taking two values are:
  3736.  
  3737.  +     (plus)
  3738.      Returns the sum of two numbers.
  3739.  
  3740.  -     (minus)
  3741.      Returns the difference of two numbers.
  3742.  
  3743.  *     (times)
  3744.      Returns the product of two numbers.
  3745.  
  3746.  /     (divide)
  3747.      Returns the result of dividing the first number by the second
  3748.      number.  If both are integers, they are converted to floating
  3749.      point before the divide is done.
  3750.  
  3751.  ^     (power)
  3752.      Returns the first number raised to the power given by the
  3753.      second number.  The second number must be an integer or
  3754.      LadyBug signals an error.
  3755.  
  3756.  
  3757.  
  3758.  
  3759.                                                            Page 48
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.                                           Numbers and Computations
  3767.  
  3768.  
  3769.  \     (mod)
  3770.      Returns the remainder from dividing the first number by the
  3771.      second number.  If either is floating point, it is rounded to
  3772.      an integer first.
  3773.  
  3774.  Examples:
  3775.  
  3776.     forward 3 * ( 2 + 5 )
  3777.     right 5 * :x
  3778.     right ( 5 * :x )
  3779.     make "x  :x + 1
  3780.     print integer 100 * sin 4 + :angle
  3781.     print integer ( 100 * sin ( 4 + :angle ) )
  3782.  
  3783.  The last two lines are evaluated the same way.
  3784.  
  3785.  
  3786.  
  3787.  13.5. EXPRESSIONS RESULTING IN TRUE OR FALSE
  3788.  
  3789.  Relational expressions result in "true" or "false".  They have
  3790.  the following form:
  3791.  
  3792.     value1 op value2
  3793.  
  3794.  where the values are numbers, variables, or expressions and "op"
  3795.  is one of the following relational operators:
  3796.  
  3797.  <
  3798.      Returns 'true' if value1 is less than value2.
  3799.  
  3800.  <=
  3801.      Returns 'true' if value1 is less than or equal to value2.
  3802.  
  3803.  >
  3804.      Returns 'true' if value1 is greater than value2.
  3805.  
  3806.  >=
  3807.      Returns 'true' if value1 is greater than or equal to value2.
  3808.  
  3809.  <>
  3810.      Returns 'true' if value1 is not equal to value2.
  3811.  
  3812.  =
  3813.      Returns 'true' if value1 is equal to value2.
  3814.  
  3815.  Conditionals can be combined with AND and OR.  See the chapter
  3816.  "Workspace With Tools" on page 52.
  3817.  
  3818.  In addition:
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.                                                            Page 49
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.                                           Numbers and Computations
  3833.  
  3834.  
  3835.  NOT value
  3836.      Returns "true" when the value is "false" and "false" when the
  3837.      value is "true".
  3838.  
  3839.  Examples:
  3840.  
  3841.     GIVEN                 PRINTS
  3842.     print 2 < 3           true
  3843.     print 3 > 2           false
  3844.     print 2 <= 3          true
  3845.     print 2 <> 3          true
  3846.     print not 2 < 3       false
  3847.  
  3848.  Examples:
  3849.  
  3850.     if :a + 2 > 17 [ ... ]
  3851.     test ( sin 2 * :b ) <= .5
  3852.  
  3853.  
  3854.  
  3855.  13.6. PROCEDURES
  3856.  
  3857.  Procedures can be invoked from within expressions and can return
  3858.  values.  When LadyBug finds a word in an expression it looks
  3859.  first to see if the word is a number.  If not, it looks to see if
  3860.  the word is one of the special words described in this chapter.
  3861.  If not, it looks to see if the word is the name of a procedure in
  3862.  the workspace.
  3863.  
  3864.  If the word is the name of a procedure, the procedure is invoked.
  3865.  The procedure must terminate with an OUTPUT command which
  3866.  specifies a value suitable for the context in which it was
  3867.  invoked.  (For example, if the procedure follows a plus sign, it
  3868.  would be expected to return a number.)
  3869.  
  3870.  Example:
  3871.  
  3872.     to inc :v
  3873.     return :v + 1
  3874.     end
  3875.  
  3876.     print 5 + v 6
  3877.  
  3878.  The procedure adds one to its input.  It is invoked in the PRINT
  3879.  command with an input of 6.  The returned value, a 7, is added to
  3880.  the 5 and a 12 is printed.
  3881.  
  3882.  LadyBug has the restriction that a procedure cannot be started
  3883.  when the inputs to another procedure are being evaluated.  The
  3884.  following, for example, is invalid:
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.                                                            Page 50
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.                                           Numbers and Computations
  3899.  
  3900.  
  3901.  Example:
  3902.  
  3903.     print 5 + v v 6
  3904.  
  3905.  If allowed, it would increment the 6 twice.
  3906.  
  3907.  
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.  
  3914.  
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.                                                            Page 51
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  14. WORKSPACES WITH TOOLS
  3968.  
  3969.  
  3970.  This chapter describes procedures which are in the workspace
  3971.  named TOOLS.  An appendix describes other workspaces which
  3972.  contain example procedures.
  3973.  
  3974.  
  3975.  
  3976.  14.1. AND  T/F  T/F
  3977.  
  3978.            Takes two inputs, both expressions which evaluate to
  3979.            "true" or "false".  Returns "true" only if both inputs
  3980.            are "true".
  3981.  
  3982.            Example:
  3983.  
  3984.               print and :a < 2 :b > 4
  3985.  
  3986.            Example:
  3987.  
  3988.               if  and  :a > 3  :a < 10   [fd :a]
  3989.  
  3990.  
  3991.  
  3992.  14.2. FOREVER LIST
  3993.  
  3994.            Takes one input, a list.  RUNs the list over and over,
  3995.            forever.
  3996.  
  3997.            Example:
  3998.  
  3999.               forever [fd 1 rt 1]
  4000.  
  4001.  
  4002.  
  4003.  14.3. MAX VALUE1 VALUE2
  4004.  
  4005.            Takes, two inputs, both expressions which return some
  4006.            value.  Returns the largest of the two.
  4007.  
  4008.  
  4009.  
  4010.  14.4. MIN VALUE1 VALUE2
  4011.  
  4012.            Takes, two inputs, both expressions which return some
  4013.            value.  Returns the smallest of the two.
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.                                                            Page 52
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.                                              Workspaces With Tools
  4031.  
  4032.  
  4033.  14.5. OR  T/F  T/F
  4034.  
  4035.            Takes two inputs, both expressions which evaluate to
  4036.            "true" or "false".  Returns "true" if either input is
  4037.            "true".
  4038.  
  4039.            Example:
  4040.  
  4041.               if  or  :a > 3  :a < 10   [fd :a]
  4042.  
  4043.  
  4044.  
  4045.  14.6. WAIT TIME
  4046.  
  4047.            Takes one input, a time in seconds.  LadyBug pauses for
  4048.            this length of time.
  4049.  
  4050.  
  4051.  
  4052.  14.7. WHILE [CONDITION] [COMMANDS]
  4053.  
  4054.            Takes two inputs, a condition and commands.  Each input
  4055.            is given as a list.  The condition is an expression
  4056.            which returns "true" or "false".  The condition is
  4057.            evaluated and, if true, the list of commands is RUN.
  4058.            The condition is again evaluated and the list RUN.
  4059.            This is repeated so long as the condition remains true.
  4060.  
  4061.            Example:
  4062.  
  4063.               while [heading < 200]  [fd 10 rt 10]
  4064.  
  4065.  
  4066.  
  4067.  14.8. XOR  T/F  T/F
  4068.  
  4069.            Takes two inputs, both expressions which evaluate to
  4070.            "true" or "false".  Returns "false" if both inputs are
  4071.            the same and "true" if different.
  4072.  
  4073.            Example:
  4074.  
  4075.               if  xor  :a > 3  :a < 10   [fd :a]
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.                                                            Page 53
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  15. INTRODUCTION TO THE LADYBUG EDITOR
  4100.  
  4101.  
  4102.  This chapter describes the basics of using the LadyBug full
  4103.  screen editor.  The appendix "About the LadyBug Editor" on page
  4104.  59 describes additional features of the editor.
  4105.  
  4106.  
  4107.  
  4108.  15.1. ABOUT THE EDITOR
  4109.  
  4110.  The LadyBug Editor is a full screen editor for LadyBug
  4111.  procedures.  It displays one or more procedures totalling up to
  4112.  500 lines long and with lines up to 254 characters long.  It uses
  4113.  the IBM Monochrome Display or 40 or 80 column graphics display.
  4114.  
  4115.  The screen is a window onto the file.  The window can move up,
  4116.  down, left and right.  Lines which are longer than the screen are
  4117.  partly displayed.  If you insert data, characters seem to be lost
  4118.  off of the end of the line; they are not lost but are just no
  4119.  longer displayed.  Move the cursor off of the screen to the right
  4120.  and they will reappear as the window moves.
  4121.  
  4122.  If memory becomes nearly full, the LadyBug Editor tells you and
  4123.  lets you continue editing but won't let you add more lines.
  4124.  
  4125.  
  4126.  
  4127.  15.2. INVOKING THE EDITOR
  4128.  
  4129.  Command: EDIT procname1 ...   (Abbreviated ED)
  4130.       or: EDIT ALL
  4131.  
  4132.  Takes a variable number of inputs each of which is a procedure
  4133.  name or a vaiable name which has as a value a procedure name.
  4134.  Enters the full screen editor to edit the procedures.
  4135.  
  4136.  The procedures named are displayed, each ending with an END
  4137.  command.  If ALL is given, all procedures are edited.  Lines may
  4138.  be changed, added, deleted, or moved.  When multiple procedures
  4139.  are being edited, lines may be moved between procedures.
  4140.  
  4141.  If a procedure is deleted in the editor, or its name is changed,
  4142.  it is not deleted from the workspace.  Only those procedures
  4143.  which are still in the editors space when you terminate editing
  4144.  are moved back to the workspace.  New procedures created within
  4145.  the editor are added to the workspace when you edit from the
  4146.  editor.  Use the ERASE statement to delete procedures from the
  4147.  workspace.
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.                                                            Page 54
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.                                 Introduction to the LadyBug Editor
  4163.  
  4164.  
  4165.  15.3. THE LADYBUG EDITOR KEYS
  4166.  
  4167.  The following list defines the meaning of each key.
  4168.  
  4169.  Backspace
  4170.       Backspace over and delete the previous character.
  4171.  
  4172.  Character keys, shifted and unshifted.
  4173.       Enter the character into the current line.  If in insert
  4174.       mode, put it at the cursor position and slide the characters
  4175.       under and to the right of the cursor to the right.  If in
  4176.       replace mode, replace the character under the cursor.
  4177.  
  4178.  Cursor keys (arrows on numeric keypad)
  4179.       Move the cursor up, down, left, or right one position.  If
  4180.       the cursor would move off of the screen in a direction in
  4181.       which there is more data, then scroll the screen one
  4182.       character in that direction.
  4183.  
  4184.  Del
  4185.       Delete the character under the cursor.  Slide the characters
  4186.       at its right to the left one position.
  4187.  
  4188.  End
  4189.       Position the cursor past the end of current line.
  4190.  
  4191.  Enter key
  4192.       Put a new line in the file and position the cursor at the
  4193.       front of it.
  4194.  
  4195.  F5
  4196.       Clear the current line and position the cursor at the left
  4197.       edge.
  4198.  
  4199.  F6
  4200.       Clear the current line under and to the right of the cursor.
  4201.  
  4202.  F7
  4203.       Quit editing.  Abandon the procedure(s) being edited.  (If
  4204.       any changes have been made, the editor asks before
  4205.       abandoning them.)
  4206.  
  4207.  F9
  4208.       End editing.  Save the procedure(s) being edited.
  4209.  
  4210.  Home
  4211.       Position the cursor in the first column of both the current
  4212.       file line and the screen.
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.                                                            Page 55
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.                                 Introduction to the LadyBug Editor
  4229.  
  4230.  
  4231.  Ins
  4232.       Toggle between insert and replace modes.  The status line
  4233.       describes which is in effect.  The cursor also changes size.
  4234.  
  4235.  Pg Dn
  4236.       Scroll down 20 lines when the screen is 80 characters wide
  4237.       and 18 lines when 40 wide.
  4238.  
  4239.  Pg Up
  4240.       Scroll up 20 lines when the screen is 80 characters wide and
  4241.       18 lines when 40 wide.
  4242.  
  4243.  Shift-F8
  4244.       Delete the line at the cursor.  The cursor moves to the next
  4245.       line in the file.
  4246.  
  4247.  Tab
  4248.       Tab right to the beginning of the next word.  (Words are
  4249.       groups of characters separated by blanks.)
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.                                                            Page 56
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  16. HINTS ON USING LADYBUG
  4298.  
  4299.  
  4300.  This chapter contains several helpful hints about how to use
  4301.  LadyBug effectively.
  4302.  
  4303.  
  4304.  
  4305.  16.1. PRINTING THE SCREEN ON AN IBM OR EPSON PRINTER
  4306.  
  4307.  IBM printers must be either the Graphics Printer or the Matrix
  4308.  Printer with either the IBM Graphics upgrade or Epson GrafTrax
  4309.  upgrade.  Epson printers must have the GrafTrax feature.
  4310.  
  4311.  Under DOS 2.0 (or later systems) you must give the GRAPHICS
  4312.  command in DOS before running LadyBug.
  4313.  
  4314.  Under DOS 1.1 or 1.0 there is no way to print the graphics screen
  4315.  unless you have a GRAPHICS command distributed with the IBM
  4316.  Graphics printer for that version, or an equivalent.
  4317.  
  4318.  
  4319.  
  4320.  16.2. PRINTING THE SCREEN ON OTHER PRINTERS
  4321.  
  4322.  The manufacturers of many dot matrix printers provide software
  4323.  which will print the graphics screen.  Other routines are
  4324.  available through various PC clubs.
  4325.  
  4326.  
  4327.  
  4328.  16.3. THE READ COMMAND
  4329.  
  4330.  The READ command described on page 40 causes LadyBug to
  4331.  temporarily stop reading commands from the keyboard.  Commands
  4332.  are read instead from the file named.
  4333.  
  4334.  Any LadyBug command can be in the file.  However, there is no way
  4335.  to create a file from within LadyBug which contains arbitrary
  4336.  commands.  It is necessary to use a program called an "editor" to
  4337.  create the file.(5)
  4338.  
  4339.  The READ command can itself occur within a READ command.  And
  4340.  another READ in that one, and another read in that one.  The
  4341.  limit is four active READ commands.
  4342.  
  4343.  READ files can be created which contain long sequences of
  4344.  
  4345.  ____________________
  4346.  
  4347.  (5) An editor named FRED, which is distributed with LadyBug, will
  4348.  create such files.  FRED is very similar to the LadyBug editor.
  4349.  However any editor will do, including the EDLIN program which
  4350.  comes with DOS.
  4351.  
  4352.  
  4353.                                                            Page 57
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.                                             Hints On Using LadyBug
  4361.  
  4362.  
  4363.  commands to draw large pictures.  The commands are executed and
  4364.  discarded; they do not take space in the workspace unless they
  4365.  are MAKE, TO, or DEFINE commands.
  4366.  
  4367.  
  4368.  
  4369.  16.4. TAILORING LADYBUG: THE PROFILE
  4370.  
  4371.  When LadyBug starts up, it READs a workspace named PROFILE.BUG.
  4372.  This workspace file can be modified to contain any LadyBug
  4373.  commands.  When it is read, the commands will be executed.
  4374.  
  4375.  
  4376.  
  4377.  16.5. PERFORMANCE HINTS
  4378.  
  4379.  Major performance improvements:
  4380.  
  4381.  -   Hide the LadyBug using HB or function key F10.  Procedures
  4382.      may run as much as 3 times faster with the LadyBug hidden.
  4383.  
  4384.  -   Unwind procedures.  Of the following, POLYB is takes 70
  4385.      percent of the time of POLYA.
  4386.  
  4387.         to polya :d :a               to polyb :d :a
  4388.         fd :d  rt :a                 fd :d  rt :a
  4389.         poly :d :a                   fd :d  rt :a
  4390.         end                          poly :d :a
  4391.                                      end
  4392.  
  4393.  -   Repeat instead of recurse.  POLYC is twice as fast as POLYA.
  4394.  
  4395.         to polyc :d :a
  4396.         repeat 1000 [fd :d  rt :a]
  4397.         poly :d :a
  4398.         end
  4399.  
  4400.  Minor improvements:
  4401.  
  4402.  -   Specify NOCLIP and NOWRAP when there is no danger of needing
  4403.      CLIP or WRAP.
  4404.  
  4405.  -   Put multiple statements on a line.
  4406.  
  4407.  In any case, don't worry about these performance improvements
  4408.  until you have proven that you need them.  Premature use of them
  4409.  will simply complicate the creation process.
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.                                                            Page 58
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.  APPENDIX A. ABOUT THE LADYBUG EDITOR
  4430.  
  4431.  
  4432.  This appendix describes the LadyBug editor completely.  It
  4433.  repeats the introductory information given in the main part of
  4434.  the document.
  4435.  
  4436.  The LadyBug Editor is a full screen editor for LadyBug
  4437.  procedures.  It displays procedures or groups of procedures up to
  4438.  500 lines long and with lines up to 254 characters long.  It uses
  4439.  the IBM Monochrome Display or 40 or 80 column graphics display.
  4440.  
  4441.  The screen is a window onto the file.  The window can move up,
  4442.  down, left and right.  Lines which are longer than the screen are
  4443.  partly displayed.  If you insert data, characters seem to be lost
  4444.  off of the end of the line; they are not lost but are just no
  4445.  longer displayed.  Move the cursor off of the screen to the right
  4446.  and they will reappear as the window moves.
  4447.  
  4448.  If memory becomes nearly full while you are editing, the LadyBug
  4449.  Editor tells you and lets you continue editing but won't let you
  4450.  add more lines.
  4451.  
  4452.  
  4453.  
  4454.  A.1. THE LADYBUG EDITOR KEYS
  4455.  
  4456.  The following list defines the meaning of each key.  The term
  4457.  "current line" means the line the cursor is currently on.
  4458.  
  4459.  Alt-d
  4460.       Delete a marked area; see Alt-l for more information.
  4461.  
  4462.  Alt-j
  4463.       Join the next line onto the current one at its end.
  4464.  
  4465.  Alt-l
  4466.       Mark the current line or extend a group of marked lines.
  4467.       The first Alt-l marks a line and displays it in reverse
  4468.       video.  The second marks all lines from the first one
  4469.       through the second.  Further Alt-l keystrokes extend the
  4470.       marked area to the current line (or shrink it from the
  4471.       nearest edge).
  4472.  
  4473.       Marked areas may be copied, deleted, or unmarked.  See
  4474.       Alt-z, Alt-d, and Alt-u.
  4475.  
  4476.  Alt-s
  4477.       Split the current line into two parts at the cursor.  At
  4478.       column one this adds a new line before the current one.
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.                                                            Page 59
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.                                           About the LadyBug Editor
  4493.  
  4494.  
  4495.  Alt-u
  4496.       Unmark an area; see Alt-l.
  4497.  
  4498.  Alt-z
  4499.       Copy a marked area to just after the current line.  A marked
  4500.       area cannot be copied into itself.
  4501.  
  4502.  Backspace
  4503.       Backspace over and delete the previous character.
  4504.  
  4505.  Character keys, shifted or unshifted.
  4506.       Enter the character into the current line.  If in insert
  4507.       mode, put it at the cursor position and slide the characters
  4508.       under and to the right of the cursor to the right.  If in
  4509.       replace mode, replace the character under the cursor.
  4510.  
  4511.  Ctrl-End
  4512.       Position the cursor on the last line of the file.  Keep it
  4513.       in the same column.
  4514.  
  4515.  Ctrl-Home
  4516.       Position the cursor on the top line of the file.  Keep it in
  4517.       the same column
  4518.  
  4519.  Ctrl-Left
  4520.       Move the cursor to the left 40 positions.
  4521.  
  4522.  Ctrl-Pg Dn
  4523.       Position the cursor at the bottom edge of the screen (or on
  4524.       the last line of the file if encountered first).  The column
  4525.       position is unchanged.
  4526.  
  4527.  Ctrl-Right
  4528.       Move the cursor to the right 40 positions.
  4529.  
  4530.  Cursor keys (arrows on numeric keypad)
  4531.       Move the cursor up, down, left, or right one position.  If
  4532.       the cursor would move off of the screen in a direction in
  4533.       which there is more data, then scroll the screen one
  4534.       character in that direction.
  4535.  
  4536.  Del
  4537.       Delete the character under the cursor.  Slide characters at
  4538.       its right to the left one position.
  4539.  
  4540.  End
  4541.       Position the cursor past the end of current line.
  4542.  
  4543.  Enter key
  4544.       Put a new line in the file and position the cursor at the
  4545.       front of it.  (Also see Alt-s.)
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.                                                            Page 60
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.                                           About the LadyBug Editor
  4559.  
  4560.  
  4561.  F5
  4562.       Clear the current line and position the cursor at the left
  4563.       edge.
  4564.  
  4565.  F6
  4566.       Clear the current line under and to the right of the cursor.
  4567.  
  4568.  F7
  4569.       Quit editing.  If any procedure has been changed, you will
  4570.       be prompted for a 'y' before the LadyBug Editor really
  4571.       quits.
  4572.  
  4573.  F9
  4574.       Stop editing.  Re-enter LadyBug mode with the changed
  4575.       procedure(s).
  4576.  
  4577.  Home
  4578.       Position the cursor in the first column of both the current
  4579.       file line and the screen.
  4580.  
  4581.  Ins
  4582.       Toggle between insert and replace modes.  The status line
  4583.       describes which is in effect.
  4584.  
  4585.  Pg Dn
  4586.       Scroll down 20 lines when the screen is 80 columns wide and
  4587.       18 lines when it is 40 wide.
  4588.  
  4589.  Pg Up
  4590.       Scroll up 20 lines when the screen is 80 columns wide and 18
  4591.       lines when it is 40 wide.
  4592.  
  4593.  Shift-F4
  4594.       Undo a change to the current line.  Once the cursor is moved
  4595.       from the line the change cannot be undone with this key.
  4596.  
  4597.  Shift-F8
  4598.       Delete the line at the cursor.  The cursor moves to the next
  4599.       line in the file.
  4600.  
  4601.  Tab
  4602.       Tab right to the beginning of the next word.  (Words are
  4603.       groups of characters separated by blanks.)
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.                                                            Page 61
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.  APPENDIX B. THE PLAY COMMAND
  4628.  
  4629.  
  4630.  This appendix describes the PLAY command completely, repeating
  4631.  information contained in the summary in the main part of this
  4632.  document.
  4633.  
  4634.  The PLAY statement is the word "PLAY" followed by a string which
  4635.  contains special music commands.  These commands define notes to
  4636.  play, or tell PLAY how to play the notes.
  4637.  
  4638.  Note: Spaces and capitalization in the PLAY statement are
  4639.  optional.
  4640.  
  4641.  
  4642.  
  4643.  B.1. MUSIC COMMANDS
  4644.  
  4645.  
  4646.  A TO G WITH OPTIONAL '#', '+', OR '-'
  4647.  
  4648.  Play the note given.  Append a # or + if the note is a sharp or a
  4649.  - if it is a flat.
  4650.  
  4651.  
  4652.  LN
  4653.  
  4654.  Set the default length of all notes which follow.  For example,
  4655.  L1 means that all notes are whole notes, L2 means half notes, and
  4656.  L4 means quarter notes.  The default is L4.
  4657.  
  4658.  The value of n may vary from 1 to 64.  The actual note length is
  4659.  1/n.  That is, if n is 8 then the note has a length of 1/8.
  4660.  Unless changed by the T command, each quarter note lasts 1/2
  4661.  second.)
  4662.  
  4663.  The default length may be changed for any note by appending a
  4664.  different length to it.  For example, in
  4665.  
  4666.     PLAY "'L4 a b c8'
  4667.  
  4668.  the notes 'a' and 'b' will be played as quarter notes but 'c'
  4669.  will be an eighth note.
  4670.  
  4671.  
  4672.  MB
  4673.  
  4674.  Tell PLAY to play music in the background; that is, to start the
  4675.  music playing and to proceed to the next statement.  If LadyBug
  4676.  then finds another SOUND or PLAY statement, it pauses until the
  4677.  tune is complete.  Up to 32 notes (or rests) may be played in the
  4678.  background.  MB is NOT the default.
  4679.  
  4680.  Once you have given the MB command in one PLAY statement that all
  4681.  
  4682.  
  4683.                                                            Page 62
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.                                                   The PLAY Command
  4691.  
  4692.  
  4693.  further PLAY statements run in the background.
  4694.  
  4695.  
  4696.  MF
  4697.  
  4698.  Play music in the foreground; that is, wait for the music to
  4699.  complete before proceeding to the next statement.  This is the
  4700.  default.
  4701.  
  4702.  
  4703.  MN
  4704.  
  4705.  Play notes the "normal" length of time.  (MN means Music Normal.)
  4706.  This is defined as 7/8th of the time specified by the note
  4707.  length.  The other 1/8 of the time is silence.
  4708.  
  4709.  
  4710.  ML
  4711.  
  4712.  Play notes the full time specified by the note length.  (ML means
  4713.  Music Legato).  There is NO pause between notes.
  4714.  
  4715.  
  4716.  MS
  4717.  
  4718.  Play notes 3/4 of the time specified by the note length.  (MS
  4719.  means Music Staccato.)  The other 1/4 of the time it rests.
  4720.  
  4721.  
  4722.  N N
  4723.  
  4724.  Play note n.  The value of n may range from 0 to 84 with 0
  4725.  meaning a rest (no sound).  Note 1 is the C of octave zero.
  4726.  
  4727.  
  4728.  O N
  4729.  
  4730.  Set octave n as the current octave.  All notes given as letters
  4731.  are in this octave.  The default octave is 4.  The value of n may
  4732.  be 0 through 7.  For example, the following two commands are
  4733.  equivalent:
  4734.  
  4735.  PLAY "O0c
  4736.  PLAY "N1
  4737.  
  4738.  An octave has the notes C, D, E, F, G, H, A and B in it, in that
  4739.  order.  The octave does NOT start with the note A.
  4740.  
  4741.  The table below shows the frequencies for each note.  The values
  4742.  in octaves three and above have been rounded to integers.  The
  4743.  minus signs mean "flat".
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.                                                            Page 63
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.                                                   The PLAY Command
  4757.  
  4758.  
  4759.          ---------------- Octave ----------------
  4760.  Note     0     1      2      3    4    5     6
  4761.  ------  ----------------------------------------
  4762.  c       32.7  65.4   130.8  262  523* 1046  2093
  4763.  c# d-   34.6  69.3   138.6  277  554  1109  2217
  4764.  d       36.7  73.4   146.8  294  587  1175  2349
  4765.  d# e-   38.9  77.8   155.6  311  622  1244  2489
  4766.  e       41.2  82.4   164.8  330  659  1318  2637
  4767.  f       43.7  87.3   174.6  349  698  1397  2794
  4768.  f# g-   46.2  92.5   185.0  370  740  1480  2960
  4769.  g       49.0  98.0   196.0  392  784  1568  3136
  4770.  g# a-   51.9  103.8  207.7  415  831  1661  3322
  4771.  a       55    110    220    440  880  1760  3520
  4772.  a# b-   58.3  116.5  233.1  466  932  1865  3729
  4773.  b       61.7  123.5  246.9  494  988  1975  3951
  4774.          * - Middle C
  4775.  
  4776.           Frequencies for Seven Octaves
  4777.  
  4778.  
  4779.  P N
  4780.  
  4781.  Pause for n time units.  The meaning of the value of n is the
  4782.  same as in the L command.  The value of n may range from 1 to 64.
  4783.  
  4784.  
  4785.  T N
  4786.  
  4787.  Set the tempo.  The tempo is the number of quarter notes per
  4788.  minute The value of n may range from 32 to 255.  The default is
  4789.  120.
  4790.  
  4791.  This means that there are 120 quarter notes per minute or that
  4792.  each quarter note begins 1/2 second after the previous quarter
  4793.  note.
  4794.  
  4795.  
  4796.  A DOT (.)
  4797.  
  4798.  A dot, placed after a note, causes the note to be played 3/2 the
  4799.  time it would otherwise be played.  A second dot multiplies the
  4800.  length again by 3/2 giving a result of 9/4 the time of the
  4801.  original note.  Dots may also appear after the P and N commands.
  4802.  
  4803.  Note: There are two kinds of dotted notes in music; those with a
  4804.  dot BELOW the note which means staccato, and those with one or
  4805.  two dots AFTER the note which means to change the note timing.
  4806.  
  4807.  PLAY's dot convention differs from that used in normal music
  4808.  notation where the first dot after a note adds 1/2 of the note
  4809.  time, and a second dot adds 1/2 of 1/2 to the note time.  Thus a
  4810.  note with double dots would have a length of 7/4 of its original
  4811.  length rather than the 9/4 that PLAY has.
  4812.  
  4813.  
  4814.  
  4815.                                                            Page 64
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.                                                   The PLAY Command
  4823.  
  4824.  
  4825.  DEFAULTS
  4826.  
  4827.  The defaults given are what you get when LadyBug first starts up.
  4828.  However, if you change the default in one PLAY statement, it
  4829.  stays changed for further statements.
  4830.  
  4831.  
  4832.  
  4833.  B.2. EXAMPLES OF PLAY STATEMENTS
  4834.  
  4835.  This sections illustrates the use of the Play statement.  The
  4836.  workspace named SOUNDS contains all of the following examples of
  4837.  Play and additional ones.
  4838.  
  4839.  First, a space ship:
  4840.  
  4841.  Example:
  4842.  
  4843.     to ship1
  4844.        play "'L64 T255'
  4845.        repeat 10 [play "'n40 n42 n44 n46 n48 n50 n48 n46 n44 n42 n40']
  4846.     end
  4847.  
  4848.  Now, a clock ticking:
  4849.  
  4850.  Example:
  4851.  
  4852.     to clock :tics
  4853.        play "'L50 MB MS T255'
  4854.        repeat :tics [play "'N1 P1 N2 P1']
  4855.     end
  4856.  
  4857.  And now, a bird call:
  4858.  
  4859.  Example:
  4860.  
  4861.     to bird1
  4862.        play "'L64 MB ML T255 O4'
  4863.        play "'N64 N66 N68 N70 P64'
  4864.        play "'N66 N68 N70 N72 N74 N76 N78 P64'
  4865.        play "'N66 N68 N70 N72 P64'
  4866.        play "'N64 N66 N68 N70 P64'
  4867.        play "'N70 N72 N74 N76 N78 N80 P64'
  4868.        play "'N66 N68 N70 N72 P64'
  4869.     end
  4870.  
  4871.  
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.  
  4878.  
  4879.  
  4880.  
  4881.                                                            Page 65
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  
  4891.  APPENDIX C. A GUIDE TO EXAMPLE PROCEDURES
  4892.  
  4893.  
  4894.  This chapter describes the example workspaces which come with
  4895.  LadyBug.  Each section name below is the name of a workspace.
  4896.  Issue the command:
  4897.  
  4898.     READ "name
  4899.  
  4900.  
  4901.  
  4902.  C.1. BCAKE
  4903.  
  4904.     to bcake :age
  4905.  
  4906.  Draws a birthday cake in color and plays Happy Birthday.
  4907.  Submitted by Daniel D. Wheeler, Cincinnati, OH.  Try:
  4908.  
  4909.     bcake 5
  4910.  
  4911.  
  4912.  
  4913.  C.2. C
  4914.  
  4915.     to c :size :level
  4916.  
  4917.  Draws a "C". curve.  Adapted from a procedure in TURTLE GRAPHICS.
  4918.  Try:
  4919.  
  4920.     C 5 6
  4921.  
  4922.  
  4923.  
  4924.  C.3. DYNA
  4925.  
  4926.     to startup
  4927.     to dt :age
  4928.  
  4929.  Displays the "Dyna Turtle".  The dyna turtle is really the
  4930.  LadyBug acting like a space ship under the influence of Newton's
  4931.  Laws.  It starts off motionless at the home position.  The "r"
  4932.  and "l" keys turn the ship 30 degrees right and left.  The "k"
  4933.  key "kicks" the ship in the direction it is pointing.
  4934.  
  4935.  Adapted from LOGO FOR THE APPLE II.
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.                                                            Page 66
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.                                      A Guide To Example Procedures
  4955.  
  4956.  
  4957.  C.4. DRAGON
  4958.  
  4959.     to dragon :size :order
  4960.  
  4961.  Draws a dragon curve.  Adapted from TURTLE GRAPHICS.  Try:
  4962.  
  4963.     dragon 5 11
  4964.  
  4965.  
  4966.  
  4967.  C.5. DUOPOLY
  4968.  
  4969.     duopoly :side1 :angle1 :side2 :angle2
  4970.  
  4971.  Adapted from TURTLE GRAPHICS.  Try:
  4972.  
  4973.     duopoly 12 10 12 -15
  4974.     duopoly 18 19 18 -20
  4975.     duopoly 45 90 45 320
  4976.     duopoly 12 10  4 -15
  4977.  
  4978.  
  4979.  
  4980.  C.6. HILBERT
  4981.  
  4982.     hilbert :size :level
  4983.  
  4984.  Adapted from TURTLE GRAPHICS, page 98.  Draws a Hilbert curve.
  4985.  Try:
  4986.  
  4987.     hilbert 10 3
  4988.  
  4989.  or
  4990.  
  4991.     hilbert 5 5
  4992.  
  4993.  
  4994.  
  4995.  C.7. INSPI
  4996.  
  4997.     to inspi :side :angle :inc
  4998.  
  4999.  Adapted from various LOGO books.  Draws an inward spiral with an
  5000.  increasing inward turning angle; it thus eventually turns out.
  5001.  Slight differences in the angle make totally different pictures.
  5002.  For example, try:
  5003.  
  5004.     inspi 10 10 15
  5005.     inspi 10 10 16
  5006.     inspi 10 10 10
  5007.     inspi 10 10  7
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.                                                            Page 67
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.                                      A Guide To Example Procedures
  5021.  
  5022.  
  5023.  C.8. LUDWIG
  5024.  
  5025.     to ludwig
  5026.  
  5027.  Plays a tune by Beethoven.  Adapted from a BASIC program whose
  5028.  author is unknown.
  5029.  
  5030.  
  5031.  
  5032.  C.9. MISC
  5033.  
  5034.     to corner.tri :size
  5035.     to cornerpoly  :size :angle :totalturn
  5036.     to nested.triangle :size
  5037.     to rays :angle :incangle :dist :incdist
  5038.     to tree :l
  5039.     to outward.tri :size
  5040.     to spiralsq
  5041.  
  5042.  CORNER.TRI draws a triangle with smaller triangles on the
  5043.  corners.
  5044.  
  5045.  CORNERPOLY does a similar thing for general polygons.
  5046.  
  5047.  NESTED.TRIANGLE draws triangles inside triangles inside
  5048.  triangles.
  5049.  
  5050.  Rays draws rays out from the current position.  The rays increase
  5051.  in length and angle with time.
  5052.  
  5053.  TREE draws a simple tree.
  5054.  
  5055.  OUTWARD.TRI is similar to CORNER.TRI.
  5056.  
  5057.  SPIRALSQ draws a square with the given size.  Rotates the turtle
  5058.  45 degrees and draws another square with a side the length of the
  5059.  diagonal of the first square.  Repeats the process with ever
  5060.  increasing squares.  Adapted from LOGO FOR THE APPLE II.
  5061.  
  5062.  Most of these are adapted from TURTLE GRAPHICS.
  5063.  
  5064.  
  5065.  
  5066.  C.10. POLY
  5067.  
  5068.     to poly :side :angle
  5069.  
  5070.  The basic LOGO procedure.  It draws polygons.  Try:
  5071.  
  5072.     poly 100 90
  5073.     poly 100 120
  5074.     poly 100 144
  5075.     poly 100 162
  5076.  
  5077.  
  5078.  
  5079.                                                            Page 68
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.                                      A Guide To Example Procedures
  5087.  
  5088.  
  5089.  C.11. POLYSPI
  5090.  
  5091.     to polyspi :side :angle :inc
  5092.  
  5093.  Very similar to POLY but the side is incremented after each time
  5094.  it is drawn.  Try:
  5095.  
  5096.     polyspi 1 45 1
  5097.     polyspi 5 119 3
  5098.     polyspi 5 120 3
  5099.     polyspi 5 144 3
  5100.  
  5101.  
  5102.  
  5103.  C.12. RAIL
  5104.  
  5105.     to rail
  5106.  
  5107.  Rail plays a familiar old song but with a complexity that seems
  5108.  impossible considering the instrument.  It is adapted from
  5109.  RAIL.BAS which was on a disk someone gave the author of LadyBug;
  5110.  there was no name on the RAIL program.  Other procedures in the
  5111.  workspace are rail1 through rail15 and are called by rail.  Try:
  5112.  
  5113.     rail
  5114.  
  5115.  
  5116.  
  5117.  C.13. SLINKY
  5118.  
  5119.     to shrinkcircle :size
  5120.     to rslinky :size
  5121.     to spinslink :size
  5122.     to growcircle :size
  5123.  
  5124.  A set of circle drawing demonstrations adapted from LOGO FOR THE
  5125.  APPLE II.  Try:
  5126.  
  5127.     shrinkcircle 100
  5128.     rslinky 50
  5129.     spinslinky 50
  5130.     growcircle 10
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.                                                            Page 69
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.                                      A Guide To Example Procedures
  5153.  
  5154.  
  5155.  C.14. SNOWFLAK
  5156.  
  5157.     to snowflake :size :level
  5158.  
  5159.  Draws a snowflake. Try:
  5160.  
  5161.     snowflake 100 2
  5162.     snowflake 100 3
  5163.  
  5164.  
  5165.  
  5166.  C.15. SPIRO
  5167.  
  5168.     to spiro :size :angle :max
  5169.  
  5170.  Adapted from TURTLE GRAPHICS.  Try:
  5171.  
  5172.     spiro 5 45 10
  5173.     spiro 10 120 7
  5174.     spiro 10 90 9
  5175.  
  5176.  
  5177.  
  5178.  C.16. SOUNDS
  5179.  
  5180.     to ship1
  5181.     to ship2
  5182.     to ship3
  5183.     to clicks
  5184.     to clock :tics
  5185.     to bird1
  5186.     to bird2
  5187.     to bird3
  5188.     to bird4
  5189.     to birds
  5190.  
  5191.  A number of different sounds.  Ships are space ships, not ocean
  5192.  ships.  The clock ticks the number of times given.  "Birds" makes
  5193.  various bird calls.  Try:
  5194.  
  5195.     birds
  5196.     clock 20
  5197.     ship1
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.                                                            Page 70
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.                                      A Guide To Example Procedures
  5219.  
  5220.  
  5221.  C.17. SPINSQ
  5222.  
  5223.     to spinsquares :size
  5224.  
  5225.  Draws a square and turns 20 degrees to the right.  Repeats the
  5226.  process.  Try:
  5227.  
  5228.     spinsquares 50
  5229.  
  5230.  
  5231.  
  5232.  C.18. TREES
  5233.  
  5234.     to vee
  5235.     to branch
  5236.     to bush
  5237.     to greentree
  5238.     to treemove
  5239.     to trees
  5240.  
  5241.  Adapted from LOGO FOR THE APPLE II.  Try:
  5242.  
  5243.     trees
  5244.  
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.  
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.  
  5277.                                                            Page 71
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  APPENDIX D. FORMAT AND CONTENTS OF SAVED WORKSPACES
  5288.  
  5289.  
  5290.  Workspaces are saved on disk with the SAVE command and are
  5291.  reloaded with the LOAD or READ commands.  The saved workspace
  5292.  reflects the definitions of procedures and values of variables
  5293.  that existed when the SAVE command was executed.
  5294.  
  5295.  The status of currently executing commands or procedures is not
  5296.  saved.
  5297.  
  5298.  The workspace is saved on disk such that the file contains
  5299.  commands which can be executed to rebuild the workspace contents.
  5300.  
  5301.  For example, you issue the commands:
  5302.  
  5303.     clearws
  5304.  
  5305.     to poly :d :a
  5306.     ; the standard, simple, POLY procedure
  5307.     fd :d
  5308.     rt :a
  5309.     end
  5310.  
  5311.     make "abc "'Some value'
  5312.     make "n 4 * 5
  5313.  
  5314.     save "dave
  5315.  
  5316.  The file DAVE.BUG looks like this:
  5317.  
  5318.     to "poly  :d :a
  5319.     ; the standard, simple, POLY procedure
  5320.     fd :d
  5321.     rt :a
  5322.     end
  5323.  
  5324.     make "abc "'Some value'
  5325.     make "n 20
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342.  
  5343.                                                            Page 72
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  APPENDIX E. REDEFINING THE NAMES OF PRIMITIVES
  5354.  
  5355.  
  5356.  
  5357.  E.1. .PRIMSYN [LIST]
  5358.  
  5359.            .ix.Redefining command names
  5360.  
  5361.            The command .PRIMSYM adds synonyms for primitive
  5362.            commands.  These synonyms can add words from other
  5363.            languages or can redefine what primitive commands do.
  5364.            The command has the form:
  5365.  
  5366.               .primsyn list
  5367.  
  5368.            or
  5369.  
  5370.               .primsyn "clear
  5371.  
  5372.            The list contains pairs of words.  The first word in a
  5373.            pair is the new name for a primitive.  The second is
  5374.            the name of the primitive.  The names are truncated to
  5375.            8 characters if necessary.  The primitive names are not
  5376.            checked for validity; it is possible to add a synonym
  5377.            for a primitive that does not exist.
  5378.  
  5379.            Each time .primsyn is issued the synonyms are added to
  5380.            any existing synonyms.  The command ".primsyn clear"
  5381.            clears all synonyms.
  5382.  
  5383.            Example:
  5384.  
  5385.                .primsyn  [ff forward  bb backward  hd heading]
  5386.  
  5387.            This defines 'ff' as a new name for 'forward', 'bb' as
  5388.            a new name for 'backward', etc.
  5389.  
  5390.            The synonyms are used for both commands and words which
  5391.            return values.  LadyBug always looks to see if there is
  5392.            a synonym before it looks a name up in its table of
  5393.            primitives.
  5394.  
  5395.            It is possible to effectively rename primitives with
  5396.            .primsyn.  For example:
  5397.  
  5398.            Example:
  5399.  
  5400.                .primsyn  [fd bk  bk fd]
  5401.  
  5402.            This causes all 'fd' commands to become 'bk' and all
  5403.            'bk' commands to become 'fd'.
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.                                                            Page 73
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  APPENDIX F. HACKERS ONLY
  5420.  
  5421.  
  5422.  This appendix contains commands which may be of interest to
  5423.  advanced LadyBug users.  (Advanced users who care about esoteric
  5424.  commands are often called "hackers".)
  5425.  
  5426.  
  5427.  
  5428.  F.1. .DEBUG
  5429.  
  5430.            Turn on debug mode.  In debug mode, each command is
  5431.            printed as it is encountered; LadyBug does not pause.
  5432.            On occasion, other output also occurs.
  5433.  
  5434.  
  5435.  
  5436.  F.2. .STACK
  5437.  
  5438.            Display the execution stack showing what procedures,
  5439.            repeats, and pauses are active.
  5440.  
  5441.  
  5442.  
  5443.  F.3. .SYMTAB
  5444.  
  5445.            Display the symbol table.  The name, value, and type of
  5446.            every symbol is shown.
  5447.  
  5448.  
  5449.  
  5450.  F.4. NAMES THAT RETURN VALUES.
  5451.  
  5452.  .LOWWATER
  5453.  
  5454.      Returns the position in the symbol table of the last symbol
  5455.      belonging to the next procedure up the nest.  Symbols at
  5456.      .lowwater + 1 were defined by the current procedure.
  5457.  
  5458.  .NVSYM
  5459.  
  5460.      The number of symbols in the symbol table.  Some of the
  5461.      entries may be empty; if so, their .vval will be "NoToken".
  5462.  
  5463.  .VSYM n
  5464.  
  5465.      The name of the n'th variable in the symbol table.
  5466.      Procedures have the name proc:procname; POLY is named
  5467.      "proc:poly".
  5468.  
  5469.  .VVAL n
  5470.  
  5471.      The value of the n'th variable in the symbol table.
  5472.  
  5473.  
  5474.  
  5475.                                                            Page 74
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.                                                       Hackers Only
  5483.  
  5484.  
  5485.  .VTYPE n
  5486.  
  5487.      The type of the n'th variable in the symbol table.  The types
  5488.      can be "NoToken", "String", "Word", "List", or "Number".
  5489.      Each is currently padded with blanks to a length of 8
  5490.      characters.
  5491.  
  5492.  WARNING: These commands and words are documented for use in
  5493.  debugging procedures, not for building applications.  Their
  5494.  definitions may change in future releases of LadyBug.
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.                                                            Page 75
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548.  
  5549.  
  5550.  
  5551.  APPENDIX G. ERROR MESSAGES
  5552.  
  5553.  
  5554.  (PROCEDURE) DIDN'T OUTPUT ANYTHING.
  5555.       The procedure was invoked in an expression but the procedure
  5556.       did not terminate with an OUTPUT command.
  5557.  
  5558.  (COMMAND) DOESN'T LIKE (NUMBER/WORD/LIST) AS INPUT.
  5559.  
  5560.  (COMMAND) DOESN'T LIKE TO WORK AFTER YOU SAID DRAW.
  5561.       The command works only in text mode; issue the NODRAW
  5562.       command and try again.
  5563.  
  5564.  (COMMAND) DOESN'T LIKE TO WORK AFTER YOU SAID NODRAW.
  5565.       The command works only in graphics mode; issue the RAW
  5566.       command and try again.
  5567.  
  5568.  (COMMAND) DOESN'T LIKE (WORD/LIST/STRING) AS INPUT.
  5569.       The input does not match what the command expects.
  5570.  
  5571.  (COMMAND) HAS TOO MANY INPUTS
  5572.  
  5573.  (COMMAND) NEEDS MORE INPUTS.
  5574.  
  5575.  BACKGROUND DOESN'T LIKE COLOR NUMBER OF (NUMBER)
  5576.  
  5577.  CANNOT RAISE NUMBER TO NON-INTEGRAL VALUE
  5578.  
  5579.  CANNOT RUN A PROCEDURE WHILE STARTING UP A PROCEDURE.
  5580.       A procedure cannot be invoked in an expression which is an
  5581.       input to another procedure.
  5582.  
  5583.  CURSOR POSITION IS OFF OF SCREEN:  (NUMBER)  (NUMBER)
  5584.  
  5585.  DEFINE DOESN'T LIKE (WORD/STRING) AS INPUT.
  5586.       DEFINE must have a word as its first input and a list as its
  5587.       second input.
  5588.  
  5589.  DON'T KNOW HOW TO DO ARITHMETIC ON (WORD)
  5590.  
  5591.  DON'T KNOW WHAT TO DO WITH OUTPUT VALUE: (VALUE)
  5592.       A procedure ended with an OUTPUT command but the procedure
  5593.       was not invoked as a part of an expression.
  5594.  
  5595.  EDIT DOESN'T LIKE SO MUCH TO EDIT.
  5596.       The number of lines given exceeded the limit of the editor
  5597.       or the size of the data exceeded the space available.
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.                                                            Page 76
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614.                                                     Error Messages
  5615.  
  5616.  
  5617.  ERROR CONVERTING (WORD) TO A NUMBER
  5618.       The word was in an expression, or in a place where a number
  5619.       was expected, but was not a valid number.
  5620.  
  5621.  FATAL ERROR (NUMBER) AT (LINE)
  5622.       Whoops!  This should never happen but it might.  Please let
  5623.       the author know.
  5624.  
  5625.  FILE NOT FOUND
  5626.       A disk file was not found.
  5627.  
  5628.  I DON'T KNOW HOW TO (COMMAND)
  5629.       LadyBug could not find the command in its internal table of
  5630.       commands and could not find a procedure with the name.
  5631.  
  5632.  I DON'T KNOW HOW TO PLAY THIS: (TUNE)
  5633.       Something is wrong with the music specification.
  5634.  
  5635.  INTERNAL ERROR (NUMBER)
  5636.       Whoops!  This should ever happen but it might.  Please let
  5637.       the author know.
  5638.  
  5639.  INVALID SYMBOL:  (NAME)
  5640.  
  5641.  LADYBUG DOESN'T LIKE TO SCRUNCH THIS MUCH:  (NUMBER)
  5642.       SETSCRUNCH can accept numbers from .1 to 10 only.
  5643.  
  5644.  MAXIMUM NUMBER OF LINES IN USE.
  5645.       In the editor, the maximum number of lines is in use.
  5646.  
  5647.  MAXIMUM NUMBER OF SYMBOLS REACHED WITH (SYMBOL)
  5648.       The symbol table is full.  This might happen if you have a
  5649.       very large number of procedures and/or variables.  It might
  5650.       also happen if you have paused many times without going back
  5651.       to the top level command prompt.
  5652.  
  5653.  MISSING VALUE AFTER (WORD)
  5654.  
  5655.  PAINT DOESN'T LIKE PAINT COLOR NUMBER OF  (NUMBER)
  5656.  
  5657.  PAINT DOESN'T LIKE BOUNDARY COLOR NUMBER OF  (NUMBER)
  5658.  
  5659.  PALETTE DOESN'T LIKE PALETTE NUMBER OF  (NUMBER)
  5660.  
  5661.  PENCOLOR DOESN'T LIKE COLOR NUMBER OF  (NUMBER)
  5662.  
  5663.  PROCEDURE NESTING IS TOO DEEP.
  5664.       Too many procedures, repeats, pauses, or uncompleted
  5665.       expressions.
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.  
  5672.  
  5673.                                                            Page 77
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.                                                     Error Messages
  5681.  
  5682.  
  5683.  PROCEDURE (NAME) WAS NOT FOUND.
  5684.  
  5685.  RAN OUT OF ROOM IN EXPRESSION.
  5686.       Too many procedures, repeats, pauses, or uncompleted
  5687.       expressions.
  5688.  
  5689.  RUN DOESN'T LIKE (WORD) AS INPUT.  IT EXPECTS A LIST.
  5690.  
  5691.  TO OR PROCEDURE NAME MISSING.
  5692.       In editor, while trying to save the procedures it was
  5693.       discovered that either the keyword TO was missing of the
  5694.       name of a procedure was missing.
  5695.  
  5696.  TOO MANY ACTIVE FILE REFERENCES; (WORD) IGNORED.
  5697.       Commands executed as a result of a READ command have issued
  5698.       other READ command to a depth of four.
  5699.  
  5700.  TOO MANY REPEAT STATEMENTS ACTIVE.
  5701.       Too many procedures, repeats, pauses, or uncompleted
  5702.       expressions.
  5703.  
  5704.  VARIABLE (NAME) WAS NOT FOUND.
  5705.  
  5706.  WARNING: ALMOST OUT OF SPACE.
  5707.       The editor is almost out of working space.  It will not let
  5708.       you add more characters.
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.                                                            Page 78
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.  APPENDIX H. LIMITS AND CAPACITIES
  5750.  
  5751.  
  5752.  Maximum total procedures and variables in workspace
  5753.     200
  5754.  
  5755.  Maximum total procedure, repeat, pause, read/load, expression,
  5756.  and parenthesis nesting depth
  5757.     40 total, but see below
  5758.  
  5759.  Maximum number of editor lines
  5760.     500
  5761.  
  5762.  Maximum procedure size, in characters
  5763.     32760
  5764.  
  5765.  Procedures can appear to nest much deeper than the limit of 40
  5766.  due to the recognition of "tail recursion".  When the last thing
  5767.  a procedure does is call itself, LadyBug recognizes that it need
  5768.  not keep information about the old procedure call since it is
  5769.  essentially done.  Therefore such a call does not increase the
  5770.  nesting depth.
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.                                                            Page 79
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  INDEX
  5816.  
  5817.  
  5818.  +, 48
  5819.  <=, 49
  5820.  >, 49
  5821.  =, 49
  5822.  ^, 48
  5823.  \, 49
  5824.  >=, 49
  5825.  <>, 49
  5826.  <, 49
  5827.  *, 48
  5828.  -, 48
  5829.  
  5830.  
  5831.  
  5832.  --- A ---
  5833.  
  5834.  ABS keyword, 44
  5835.  AND procedure, 52
  5836.  Angles, 10
  5837.  ARCTAN keyword, 44
  5838.  Arithmetic operator
  5839.    *, 48
  5840.    +, 48
  5841.    -, 48
  5842.    /, 48
  5843.    \, 49
  5844.    ^, 48
  5845.  ASC keyword, 44
  5846.  Aspect ratio, 20, 45
  5847.  Author, i
  5848.  AUTOEXEC.BAT file, 5
  5849.  Automatic startup, 5
  5850.  
  5851.  
  5852.  
  5853.  --- B ---
  5854.  
  5855.  BACK command, 14
  5856.  Background colors, 14, 44
  5857.  BACKGROUND command, 14
  5858.  BACKGROUND keyword, 44
  5859.  Backup, 5
  5860.  BEEP command, 23
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.                                                            Page 80
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.                                                              Index
  5879.  
  5880.  
  5881.  --- C ---
  5882.  
  5883.  CATALOG command, 37
  5884.  Changes in this version, 3
  5885.  CHAR keyword, 44
  5886.  CLEARINPUT command, 25
  5887.  CLEARSCREEN command, 15
  5888.  CLEARTEXT command, 27
  5889.  CLEARWS command, 37
  5890.  CLIP, 14
  5891.  CLIP command, 15
  5892.  CO Command, 42
  5893.  Color
  5894.    background, 14
  5895.    numbers, 14
  5896.    painting, 18
  5897.    palette, 18
  5898.    pen colors, 18, 45
  5899.  Command name synonyms, 73
  5900.  Command prompt, 41
  5901.  Comment Command, 43
  5902.  CONTINUE Command, 42
  5903.  Copying, ii
  5904.  COS keyword, 44
  5905.  Cursor
  5906.    positioning, 27
  5907.  CURSOR command, 27
  5908.  
  5909.  
  5910.  
  5911.  --- D ---
  5912.  
  5913.  DEFINE command, 37
  5914.  Defining procedures, 29
  5915.  Diskette
  5916.    setting up for execution, 7
  5917.  Distribution, secondary, ii
  5918.  DOS, 2
  5919.  DOS GRAPHICS command, 57
  5920.  DRAW, 14
  5921.  DRAW command, 6, 15
  5922.  
  5923.  
  5924.  
  5925.  --- E ---
  5926.  
  5927.  ED command, 54
  5928.  EDIT command, 29, 38, 54
  5929.  Editing active procedures, 42
  5930.  Editing files, 29, 54, 59
  5931.  Editing screen, 11
  5932.  Editor key
  5933.    Alt-d: delete area, 59
  5934.    Alt-j: join lines, 59
  5935.  
  5936.  
  5937.                                                            Page 81
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.                                                              Index
  5945.  
  5946.  
  5947.    Alt-l: mark lines, 59
  5948.    Alt-s: split lines, 59
  5949.    Alt-u: unmark lines, 60
  5950.    Alt-z: copy lines, 60
  5951.    Backspace, 55, 60
  5952.    Character keys, 55, 60
  5953.    Ctrl-End: move to end of file, 60
  5954.    Ctrl-Home: move to start of file, 60
  5955.    Ctrl-Left: left 40 columns, 60
  5956.    Ctrl-Pg Dn: to bottom edge, 60
  5957.    Ctrl-Right: right 40 columns, 60
  5958.    Cursor keys, 55, 60
  5959.    Del, 55, 60
  5960.    End, 55
  5961.    End: to end of line, 60
  5962.    Enter key, 55, 60
  5963.    F5: clear line, 55, 61
  5964.    F6: clear to EOL, 55, 61
  5965.    F7: quit editing, 55, 61
  5966.    F9: End editing, 55
  5967.    F9: stop editing, 61
  5968.    Home, 55, 61
  5969.    Ins, 56, 61
  5970.    Pg Dn, 56, 61
  5971.    Pg Up, 56, 61
  5972.    Shift-F4: undo, 61
  5973.    Shift-F8: delete line, 56, 61
  5974.    Tab, 56, 61
  5975.  EDLIN editor, 57
  5976.  END command, 29, 54
  5977.  ERASE command, 38
  5978.  ERASEFILE command, 39
  5979.  ERNAME command, 39
  5980.  ERROR command, 30
  5981.  Error messages, 76
  5982.  EXP keyword, 45
  5983.  Expressions, 13, 48
  5984.  
  5985.  
  5986.  
  5987.  --- F ---
  5988.  
  5989.  File
  5990.    PROFILE.BUG, 20, 58
  5991.  Floating point numbers, 44
  5992.  "Foreign" languages, 73
  5993.  FOREVER command, 30
  5994.  FOREVER procedure, 52
  5995.  FORWARD command, 16
  5996.  FRED editor, 57
  5997.  Function key
  5998.    F10: hide LadyBug, 6
  5999.    F1: stop drawing, 5
  6000.    F3: help, 5
  6001.  
  6002.  
  6003.                                                            Page 82
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.                                                              Index
  6011.  
  6012.  
  6013.    F5: pause, 5
  6014.    F5: Pausing execution, 41
  6015.    F9: trace mode, 6
  6016.  
  6017.  
  6018.  
  6019.  --- G ---
  6020.  
  6021.  GOODBYE command, 30
  6022.  Graphics commands, 14
  6023.  Graphics mode, 10, 14, 15, 17, 25
  6024.  Graphics screens, 10
  6025.  
  6026.  
  6027.  
  6028.  --- H ---
  6029.  
  6030.  Heading, 10
  6031.  HEADING keyword, 45
  6032.  HIDDEN? keyword, 48
  6033.  HIDEBUG command, 16
  6034.  HIDETURTLE command, 16
  6035.  HOME command, 16
  6036.  
  6037.  
  6038.  
  6039.  --- I ---
  6040.  
  6041.  IF command, 30, 31, 32
  6042.  IFFALSE command, 32
  6043.  IFTRUE command, 32
  6044.  Initialization, 58
  6045.  Input and output, 25
  6046.  Inputs to procedures, 41
  6047.  INTEGER keyword, 45
  6048.  Integer numbers, 44
  6049.  
  6050.  
  6051.  
  6052.  --- J ---
  6053.  
  6054.  Joystick, 47
  6055.  
  6056.  
  6057.  
  6058.  --- K ---
  6059.  
  6060.  KEYP keyword, 47
  6061.  
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.  
  6068.  
  6069.                                                            Page 83
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.                                                              Index
  6077.  
  6078.  
  6079.  --- L ---
  6080.  
  6081.  LEFT command, 16
  6082.  Limits, 42, 79
  6083.  Lists, 12, 45
  6084.  LOAD command, 39
  6085.  LOCAL command, 33
  6086.  LOG keyword, 45
  6087.  
  6088.  
  6089.  
  6090.  --- M ---
  6091.  
  6092.  MAKE command, 34
  6093.  MAX procedure, 52
  6094.  MIN procedure, 52
  6095.  Monochrome display, 2, 11, 54, 59
  6096.  
  6097.  
  6098.  
  6099.  --- N ---
  6100.  
  6101.  Nested group of procedures, 41
  6102.  Nest of procedures, 41
  6103.  NOCLIP, 14
  6104.  NOCLIP command, 17
  6105.  NODRAW, 14
  6106.  NODRAW command, 17
  6107.  NOT keyword, 50
  6108.  NOTRACE Command, 42
  6109.  NOWINDOW, 14
  6110.  NOWINDOW command, 17
  6111.  NOWRAP, 14
  6112.  NOWRAP command, 17
  6113.  NUMBER? keyword, 45
  6114.  Numbers, 12
  6115.    floating point, 44
  6116.    integers, 44
  6117.  
  6118.  
  6119.  
  6120.  --- O ---
  6121.  
  6122.  OR procedure, 53
  6123.  OUTPUT command, 34
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.                                                            Page 84
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142.                                                              Index
  6143.  
  6144.  
  6145.  --- P ---
  6146.  
  6147.  PADDLEBUTTON keyword, 47
  6148.  PADDLE keyword, 47
  6149.  PAINT command, 18
  6150.  Painting, 18
  6151.  PALETTE command, 18
  6152.  PALETTE keyword, 45
  6153.  PAUSE Command, 42
  6154.  Pausing, 53
  6155.  Pausing procedures, 41
  6156.  PC/DOS, 2
  6157.  PC keyword, 45
  6158.  PENCOLOR command, 18
  6159.  PENCOLOR keyword, 45
  6160.  PENDOWN command, 19
  6161.  PENDOWN? keyword, 47
  6162.  PENUP command, 19
  6163.  PENUP? keyword, 47
  6164.  Performance Hints, 58
  6165.  Performance hint, 6, 22
  6166.  PLAY command, 23, 62
  6167.    examples, 65
  6168.  POLY procedure, 6
  6169.  POLYSPI procedure, 6
  6170.  .PRIMSYN command, 73
  6171.  PRINT1 command, 25
  6172.  PRINT command, 25
  6173.  Printing data, 25
  6174.  Printing the screen, 57
  6175.  PRINTOUT command, 39
  6176.  Procedures, 9, 41
  6177.    as commands, 41
  6178.    creating, 41
  6179.    defining, 29, 37, 40, 54
  6180.    inputs to, 41
  6181.    maximum number of, 79
  6182.    maximum size, 79
  6183.    pausing, 41
  6184.    returning from, 36
  6185.    returning values from, 34
  6186.    running, 41
  6187.    tail recursion, 79
  6188.  Procedure set, 30
  6189.  PROFILE.BUG file, 20, 58
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.                                                            Page 85
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.                                                              Index
  6209.  
  6210.  
  6211.  --- R ---
  6212.  
  6213.  RANDOMIZE command, 35
  6214.  RANDOM keyword, 45
  6215.  RC keyword, 47
  6216.  RC? keyword, 47
  6217.  READCHARACTER keyword, 47
  6218.  READCHAR keyword, 47
  6219.  READ command, 40, 57
  6220.  References, 1
  6221.  Relational expressions, 49, 52
  6222.  Relational operator
  6223.    <, 49
  6224.    <=, 49
  6225.    <>, 49
  6226.    =, 49
  6227.    >, 49
  6228.    >=, 49
  6229.  REPEAT command, 35
  6230.  REQUEST keyword, 47
  6231.  Requirements, 2
  6232.  RIGHT command, 19
  6233.  RQ keyword, 47
  6234.  RUN command, 35
  6235.  RUN keyword, 45
  6236.  Running LadyBug, 5
  6237.  
  6238.  
  6239.  
  6240.  --- S ---
  6241.  
  6242.  SAVE command, 40
  6243.  Screens, 10
  6244.    printing, 57
  6245.    width, 28
  6246.  SCRUNCH keyword, 45
  6247.  SE keyword, 45
  6248.  SENTENCE keyword, 45
  6249.  SETBG command, 20
  6250.  SETHEADING command, 19
  6251.  SETPAL command, 20
  6252.  SETPC command, 20
  6253.  SETSCRUNCH, 14
  6254.  SETSCRUNCH command, 20
  6255.  .SETSCRUNCH command, 20
  6256.  Setup for execution, 7
  6257.  SETWIDTH command, 28
  6258.  SETX command, 20
  6259.  SETXY command, 21
  6260.  SETY command, 21
  6261.  SHOWBUG command, 21
  6262.  SHOWING? keyword, 48
  6263.  SHOWTURTLE command, 21
  6264.  SIGN keyword, 46
  6265.  
  6266.  
  6267.                                                            Page 86
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.                                                              Index
  6275.  
  6276.  
  6277.  SIN keyword, 46
  6278.  Sounds
  6279.    playing tunes, 23, 62
  6280.    single notes, 24
  6281.  Source code, iii
  6282.  SQRT keyword, 46
  6283.  STICKBUTTON keyword, 47
  6284.  STICK keyword, 47
  6285.  STOP command, 36
  6286.  Strings, 13
  6287.  
  6288.  
  6289.  
  6290.  --- T ---
  6291.  
  6292.  TAN keyword, 46
  6293.  TEST command, 36
  6294.  TEXTCOLUMNS command, 28
  6295.  Text Mode, 27
  6296.  Text mode, 11, 14, 15, 17, 25, 28
  6297.  Text screen, 11
  6298.  THING keyword, 46
  6299.  TO command, 40
  6300.  TONE command, 24
  6301.  Tools workspaces, 52
  6302.  TOPLEVEL command, 36
  6303.  TOPLEVEL Command, 43
  6304.  TRACE Command, 43
  6305.  TYPE command, 26
  6306.  
  6307.  
  6308.  
  6309.  --- U ---
  6310.  
  6311.  User Supported Software, i, ii
  6312.  
  6313.  
  6314.  
  6315.  --- V ---
  6316.  
  6317.  Variables, 9
  6318.    assigning, 34
  6319.    creating, 34
  6320.    maximum number of, 79
  6321.    scope, 33, 34
  6322.    scope example, 33
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.                                                            Page 87
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.                                                              Index
  6341.  
  6342.  
  6343.  --- W ---
  6344.  
  6345.  WAIT command, 36
  6346.  WAIT procedure, 53
  6347.  Warrantee, disclaimer of, i
  6348.  WHILE command, 36
  6349.  WHILE procedure, 53
  6350.  WINDOW, 14
  6351.  WINDOW command, 22
  6352.  WORD keyword, 46
  6353.  Words, 12
  6354.  Workspace, 9
  6355.    managing, 37
  6356.  WRAP, 14
  6357.  WRAP command, 22
  6358.  
  6359.  
  6360.  
  6361.  --- X ---
  6362.  
  6363.  XCOR keyword, 46
  6364.  XOR procedure, 53
  6365.  
  6366.  
  6367.  
  6368.  --- Y ---
  6369.  
  6370.  YCOR keyword, 46
  6371.  Young People's LOGO Association, 1
  6372.  YPLA, 1
  6373.  
  6374.  
  6375.  
  6376.  
  6377.  
  6378.  
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397.  
  6398.  
  6399.                                                            Page 88
  6400.  
  6401.  
  6402.  
  6403.